Class: Hasta::LocalStorage

Inherits:
Object
  • Object
show all
Includes:
Storage
Defined in:
lib/hasta/local_storage.rb

Overview

The read/write file storage interface to the local representation of the S3 data used by the local map/reduce jobs

Instance Method Summary collapse

Methods included from Storage

#exists?, #files_for, #initialize

Instance Method Details

#write(s3_uri, data_source) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hasta/local_storage.rb', line 14

def write(s3_uri, data_source)
  contents = StringIO.new
  data_source.each_line do |line|
    contents << line
  end

  write_to(
    s3_uri.file? ? s3_uri : s3_uri.append('part-00000'),
    contents.string
  )
end