| Class | Rddb::MaterializationStore::S3MaterializationStore |
| In: |
lib/rddb/materialization_store/s3_materialization_store.rb
|
| Parent: | Base |
Materialization store implementation that stores view data in S3.
Initialized the view store with the given bucket name and options.
# 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
The bucket name
# 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.
# 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.
# 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.
# 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