Class: Upkeep::Subscriptions::Subscription
- Inherits:
-
Data
- Object
- Data
- Upkeep::Subscriptions::Subscription
- Defined in:
- lib/upkeep/subscriptions/store.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#recorder ⇒ Object
readonly
Returns the value of attribute recorder.
-
#subscriber_id ⇒ Object
readonly
Returns the value of attribute subscriber_id.
Class Method Summary collapse
Instance Method Summary collapse
- #explain ⇒ Object
- #identity_signature(frame_id) ⇒ Object
- #replay_recipe(frame_id) ⇒ Object
- #to_h ⇒ Object
- #to_persistent_h ⇒ Object
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph
14 15 16 |
# File 'lib/upkeep/subscriptions/store.rb', line 14 def graph @graph end |
#id ⇒ Object (readonly)
Returns the value of attribute id
14 15 16 |
# File 'lib/upkeep/subscriptions/store.rb', line 14 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
14 15 16 |
# File 'lib/upkeep/subscriptions/store.rb', line 14 def @metadata end |
#recorder ⇒ Object (readonly)
Returns the value of attribute recorder
14 15 16 |
# File 'lib/upkeep/subscriptions/store.rb', line 14 def recorder @recorder end |
#subscriber_id ⇒ Object (readonly)
Returns the value of attribute subscriber_id
14 15 16 |
# File 'lib/upkeep/subscriptions/store.rb', line 14 def subscriber_id @subscriber_id end |
Class Method Details
.from_h(snapshot) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/upkeep/subscriptions/store.rb', line 57 def self.from_h(snapshot) snapshot = Dependencies.symbolize_keys(snapshot) recorder = Runtime::Recorder.from_h(snapshot.fetch(:recorder)) new( snapshot.fetch(:id), snapshot.fetch(:subscriber_id), recorder, recorder.graph, snapshot.fetch(:metadata) ) end |
Instance Method Details
#explain ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/upkeep/subscriptions/store.rb', line 15 def explain dependency_nodes = graph.dependency_nodes dependencies = dependency_nodes.map(&:payload) { id: id, subscriber_id: subscriber_id, tables: active_record_tables(dependencies), identity: identity_dependencies(dependencies), frame_count: graph.frame_nodes.size, dependency_count: dependency_nodes.size, lookup_keys: lookup_keys_for(dependencies), metadata: } end |
#identity_signature(frame_id) ⇒ Object
31 32 33 |
# File 'lib/upkeep/subscriptions/store.rb', line 31 def identity_signature(frame_id) recorder.identity_signature(frame_id) end |
#replay_recipe(frame_id) ⇒ Object
35 36 37 |
# File 'lib/upkeep/subscriptions/store.rb', line 35 def replay_recipe(frame_id) graph.node(frame_id).payload[:recipe] end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/upkeep/subscriptions/store.rb', line 39 def to_h { id: id, subscriber_id: subscriber_id, recorder: recorder.to_h, metadata: } end |
#to_persistent_h ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/upkeep/subscriptions/store.rb', line 48 def to_persistent_h { id: id, subscriber_id: subscriber_id, recorder: recorder.to_persistent_h, metadata: } end |