Class Rddb::MaterializationStore::FilesystemMaterializationStore
In: lib/rddb/materialization_store/filesystem_materialization_store.rb
Parent: Base

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

Methods

delete   exists?   find   new   store  

Public Class methods

Initialized the materialization store with the given options.

Options:

  • :basedir: The base directory

[Source]

    # File lib/rddb/materialization_store/filesystem_materialization_store.rb, line 12
12:       def initialize(options={})
13:         @options = options
14:         @options[:basedir] ||= 'materializations'
15:       end

Public Instance methods

Delete the view.

[Source]

    # File lib/rddb/materialization_store/filesystem_materialization_store.rb, line 36
36:       def delete(name)
37:         File.delete(File.join(basedir, name)) if exists?(name)
38:       end

Return true if the view exists in storage.

[Source]

    # File lib/rddb/materialization_store/filesystem_materialization_store.rb, line 41
41:       def exists?(name)
42:         File.exist?(File.join(basedir, name))
43:       end

Find the view.

[Source]

    # File lib/rddb/materialization_store/filesystem_materialization_store.rb, line 18
18:       def find(name)
19:         if exists?(name)
20:           File.open(File.join(basedir, name)) do |f|
21:             Marshal.load(f)
22:           end
23:         end
24:       end

Store the view.

[Source]

    # File lib/rddb/materialization_store/filesystem_materialization_store.rb, line 27
27:       def store(view)
28:         if view.materialized?
29:           File.open(File.join(basedir, view.name), 'w') do |f|
30:             Marshal.dump(view.materialized, f)
31:           end
32:         end
33:       end

[Validate]