Class: Akasha::Storage::HttpEventStore::ProjectionManager

Inherits:
Object
  • Object
show all
Defined in:
lib/akasha/storage/http_event_store/projection_manager.rb

Overview

Manages HTTP ES projections.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ProjectionManager

Returns a new instance of ProjectionManager


6
7
8
# File 'lib/akasha/storage/http_event_store/projection_manager.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#merge_all_by_event(name, event_names, namespace: nil) ⇒ Object

Merges all streams into one, filtering the resulting stream so it only contains events with the specified names, using a projection.

Arguments:

`name` - name of the projection stream
`event_names` - array of event names
`namespace` - optional namespace; if provided, the resulting stream will
              only contain events with the same metadata.namespace

19
20
21
22
# File 'lib/akasha/storage/http_event_store/projection_manager.rb', line 19

def merge_all_by_event(name, event_names, namespace: nil)
  attempt_create_projection(name, event_names, namespace) ||
    update_projection(name, event_names, namespace)
end