Class: Upkeep::Subscriptions::MemoryReverseIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/upkeep/subscriptions/store.rb

Constant Summary collapse

LOOKUP_NOTIFICATION =
"lookup_subscription_index.upkeep"

Instance Method Summary collapse

Constructor Details

#initialize(active_registry:, pending_registry:) ⇒ MemoryReverseIndex

Returns a new instance of MemoryReverseIndex.



128
129
130
131
# File 'lib/upkeep/subscriptions/store.rb', line 128

def initialize(active_registry:, pending_registry:)
  @active_registry = active_registry
  @pending_registry = pending_registry
end

Instance Method Details

#entries_for(changes) ⇒ Object



133
134
135
136
137
138
139
140
141
142
# File 'lib/upkeep/subscriptions/store.rb', line 133

def entries_for(changes)
  if ActiveSupport::Notifications.notifier.listening?(LOOKUP_NOTIFICATION)
    payload = { changes: Array(changes).size, store: "memory" }
    ActiveSupport::Notifications.instrument(LOOKUP_NOTIFICATION, payload) do
      entries_for_with_payload(changes, payload)
    end
  else
    active_registry.entries_for(changes)
  end
end

#summaryObject



144
145
146
# File 'lib/upkeep/subscriptions/store.rb', line 144

def summary
  active_registry.summary
end