Class: LiveQueryPool

Inherits:
Volt::GenericPool show all
Defined in:
app/volt/tasks/live_query/live_query_pool.rb

Overview

LiveQueryPool runs on the server and keeps track of all outstanding queries.

Instance Attribute Summary

Attributes inherited from Volt::GenericPool

#pool

Instance Method Summary collapse

Methods inherited from Volt::GenericPool

#clear, #create_new_item, #inspect, #lookup_all, #lookup_without_generate, #print, #remove, #transform_item

Constructor Details

#initialize(data_store, volt_app) ⇒ LiveQueryPool

Returns a new instance of LiveQueryPool.



8
9
10
11
12
# File 'app/volt/tasks/live_query/live_query_pool.rb', line 8

def initialize(data_store, volt_app)
  @data_store = data_store
  @volt_app = volt_app
  super()
end

Instance Method Details

#lookup(collection, query) ⇒ Object



14
15
16
17
18
19
# File 'app/volt/tasks/live_query/live_query_pool.rb', line 14

def lookup(collection, query)
  # collection = collection.to_sym
  query = normalize_query(query)

  super(collection, query)
end

#updated_collection(collection, skip_channel, from_message_bus = false) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'app/volt/tasks/live_query/live_query_pool.rb', line 21

def updated_collection(collection, skip_channel, from_message_bus=false)
  # collection = collection.to_sym
  lookup_all(collection).each do |live_query|
    live_query.run(skip_channel)
  end

  msg_bus = @volt_app.message_bus
  if !from_message_bus && collection != 'active_volt_instances' && msg_bus
    msg_bus.publish('volt_collection_update', collection)
  end
end