class Hasta::S3DataSource

Data source for reading data from S3

Attributes

combined_storage[R]
s3_uri[R]

Public Class Methods

new(s3_uri, combined_storage = Hasta.combined_storage) click to toggle source
# File lib/hasta/s3_data_source.rb, line 9
def initialize(s3_uri, combined_storage = Hasta.combined_storage)
  @s3_uri = s3_uri
  @combined_storage = combined_storage
end

Public Instance Methods

each_line() { |line| ... } click to toggle source
# File lib/hasta/s3_data_source.rb, line 18
def each_line
  return enum_for(:each_line) unless block_given?

  combined_storage.files_for(s3_uri).each do |file|
    Hasta.logger.debug(
      "Processing #{file.remote? ? 'remote' : 'local'} #{file.class}: #{file.key}"
    )
    file.each_line { |line| yield line }
  end
end
name() click to toggle source
# File lib/hasta/s3_data_source.rb, line 14
def name
  s3_uri.to_s
end
to_a() click to toggle source
# File lib/hasta/s3_data_source.rb, line 29
def to_a
  each_line.to_a
end
to_s() click to toggle source
# File lib/hasta/s3_data_source.rb, line 33
def to_s
  "#<#{self.class.name}:#{s3_uri}>"
end