Class Rddb::MaterializationStore::S3MaterializationStore
In: lib/rddb/materialization_store/s3_materialization_store.rb
Parent: Base

Materialization store implementation that stores view data in S3.

Methods

bucket_name   delete   exists?   find   new   store  

Included Modules

AWS::S3

Public Class methods

Initialized the view store with the given bucket name and options.

[Source]

    # File lib/rddb/materialization_store/s3_materialization_store.rb, line 8
 8:       def initialize(bucket_name, options={})
 9:         AWS::S3::Base.establish_connection!(options[:s3])
10:         @bucket_name = bucket_name
11:         @options = options
12:         @options[:basedir] ||= 'materializations'
13:       end

Public Instance methods

The bucket name

[Source]

    # File lib/rddb/materialization_store/s3_materialization_store.rb, line 16
16:       def bucket_name
17:         returning @bucket_name do |name|
18:           begin
19:             Bucket.create(name)
20:           rescue => e
21:             #puts "Error creating bucket: #{e}"
22:           end
23:         end
24:       end

Delete the view.

[Source]

    # File lib/rddb/materialization_store/s3_materialization_store.rb, line 40
40:       def delete(name)
41:         S3Object.delete(File.join(basedir, name), bucket_name)
42:       end

Return true if the view exists in storage.

[Source]

    # File lib/rddb/materialization_store/s3_materialization_store.rb, line 45
45:       def exists?(name)
46:         S3Object.exists?(File.join(basedir, name), bucket_name)
47:       end

Find the view.

[Source]

    # File lib/rddb/materialization_store/s3_materialization_store.rb, line 27
27:       def find(name)
28:         d = S3Object.value(File.join(basedir, name), bucket_name)
29:         Marshal.load(d)
30:       end

Store the view.

[Source]

    # File lib/rddb/materialization_store/s3_materialization_store.rb, line 33
33:       def store(view)
34:         if view.materialized?
35:           S3Object.store(File.join(basedir, view.name), Marshal.dump(view.materialized), bucket_name)
36:         end
37:       end

[Validate]