Class Rddb::Materializer::ThreadedMaterializer
In: lib/rddb/materializer/threaded_materializer.rb
Parent: Object

Methods

Public Class methods

Initialize the materializer with the given database.

[Source]

    # File lib/rddb/materializer/threaded_materializer.rb, line 8
 8:       def initialize(database)
 9:         @database = database
10:         @materialization_thread = Thread.new(database.document_store.dup) do |ds|
11:           while true do
12:             view = materialization_queue.pop
13:             logger.info "Materializing the view '#{view.name}'" if logger
14:             view.materialize(ds)
15:             logger.info "The view '#{view.name}' is now materialized" if logger
16:           end
17:         end
18:       end

Public Instance methods

Callback that is invoked when a document is added to the database.

[Source]

    # File lib/rddb/materializer/threaded_materializer.rb, line 21
21:       def document_added(document)
22:         update_materialization_queue(document)
23:       end

Refresh all materialized views.

[Source]

    # File lib/rddb/materializer/threaded_materializer.rb, line 26
26:       def refresh_views
27:         database.views.each do |name,view|
28:           @materialization_queue << view if view.materialized?
29:         end
30:       end

[Validate]