Class: Hasta::CombinedStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/hasta/combined_storage.rb

Overview

The file storage interface used by the local map/reduce jobs

Instance Method Summary collapse

Constructor Details

#initialize(s3_storage, local_storage) ⇒ CombinedStorage

Returns a new instance of CombinedStorage.



9
10
11
12
# File 'lib/hasta/combined_storage.rb', line 9

def initialize(s3_storage, local_storage)
  @s3_storage = s3_storage
  @local_storage = local_storage
end

Instance Method Details

#files_for(s3_uri) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/hasta/combined_storage.rb', line 14

def files_for(s3_uri)
  if local_storage.exists?(s3_uri)
    local_storage.files_for(s3_uri)
  else
    s3_storage.files_for(s3_uri)
  end
end

#write(s3_uri, data_source) ⇒ Object



22
23
24
# File 'lib/hasta/combined_storage.rb', line 22

def write(s3_uri, data_source)
  local_storage.write(s3_uri, data_source)
end