Class: SampleDataDumpAwsS3CompressedDumpStorage::Gateway

Inherits:
Object
  • Object
show all
Defined in:
lib/sample_data_dump_aws_s3_compressed_dump_storage/gateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Gateway

Returns a new instance of Gateway.


15
16
17
# File 'lib/sample_data_dump_aws_s3_compressed_dump_storage/gateway.rb', line 15

def initialize(settings)
  @settings = settings
end

Instance Method Details

#retrieve_compressed_dump_file(table_configuration) ⇒ Object


26
27
28
29
30
31
# File 'lib/sample_data_dump_aws_s3_compressed_dump_storage/gateway.rb', line 26

def retrieve_compressed_dump_file(table_configuration)
  dump_file = SampleDataDump::Helpers::DumpFile.new(table_configuration, @settings)
  s3_file = s3_dump_file(dump_file.local_compressed_dump_file_name)
  path = s3_file.download_file(dump_file.local_compressed_dump_file_path)
  Dry::Monads::Success(path)
end

#store_compressed_dump_file(table_configuration) ⇒ Object


19
20
21
22
23
24
# File 'lib/sample_data_dump_aws_s3_compressed_dump_storage/gateway.rb', line 19

def store_compressed_dump_file(table_configuration)
  dump_file = SampleDataDump::Helpers::DumpFile.new(table_configuration, @settings)
  s3_file = s3_dump_file(dump_file.local_compressed_dump_file_name)
  s3_file.upload_file(dump_file.local_compressed_dump_file_path)
  Dry::Monads::Success(true)
end