class Hasta::S3DataSink
Data sink for writing data to S3 storage
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_sink.rb, line 10 def initialize(s3_uri, combined_storage = Hasta.combined_storage) @s3_uri = s3_uri @combined_storage = combined_storage end
Public Instance Methods
<<(line)
click to toggle source
# File lib/hasta/s3_data_sink.rb, line 15 def <<(line) lines << Hasta.tab_separated_line(line) end
close()
click to toggle source
# File lib/hasta/s3_data_sink.rb, line 19 def close storage_uri = combined_storage.write(s3_uri, contents) Hasta.logger.debug( "Wrote #{lines.count} lines to uri: #{storage_uri} (#{LocalFilePath.for(storage_uri)})" ) self end
data_source()
click to toggle source
# File lib/hasta/s3_data_sink.rb, line 28 def data_source S3DataSource.new(s3_uri, combined_storage) end
to_s()
click to toggle source
# File lib/hasta/s3_data_sink.rb, line 32 def to_s "#<#{self.class.name}:#{s3_uri}>" end
Private Instance Methods
contents()
click to toggle source
# File lib/hasta/s3_data_sink.rb, line 44 def contents lines.join("\n") end
lines()
click to toggle source
# File lib/hasta/s3_data_sink.rb, line 40 def lines @lines ||= [] end