Class Rddb::ViewStore::S3ViewStore
In: lib/rddb/view_store/s3_view_store.rb
Parent: Base

View store implementation that stores view data in the file system.

Methods

bucket_name   delete   exists?   find   new   store  

Included Modules

AWS::S3

Public Class methods

Initialized the view store with the given options.

Options:

  • :basedir: The base directory

[Source]

    # File lib/rddb/view_store/s3_view_store.rb, line 13
13:       def initialize(bucket_name, options={})
14:         AWS::S3::Base.establish_connection!(options[:s3])
15:         @bucket_name = bucket_name
16:         @options = options
17:         @options[:basedir] ||= 'views'
18:       end

Public Instance methods

The bucket name

[Source]

    # File lib/rddb/view_store/s3_view_store.rb, line 21
21:       def bucket_name
22:         returning @bucket_name do |name|
23:           begin
24:             Bucket.create(name)
25:           rescue => e
26:             #puts "Error creating bucket: #{e}"
27:           end
28:         end
29:       end

Delete the view.

[Source]

    # File lib/rddb/view_store/s3_view_store.rb, line 42
42:       def delete(name)
43:         S3Object.delete(File.join(basedir, name), bucket_name)
44:       end

Return true if the view exists in storage.

[Source]

    # File lib/rddb/view_store/s3_view_store.rb, line 47
47:       def exists?(name)
48:         S3Object.exists?(File.join(basedir, name), bucket_name)
49:       end

Find the view.

[Source]

    # File lib/rddb/view_store/s3_view_store.rb, line 32
32:       def find(name)
33:         S3Object.value(File.join(basedir, name), bucket_name)
34:       end

Store the view.

[Source]

    # File lib/rddb/view_store/s3_view_store.rb, line 37
37:       def store(name, view_code)
38:         S3Object.store(File.join(basedir, name), view_code, bucket_name)
39:       end

[Validate]