class Akasha::Storage::HttpEventStore
HTTP-based interface to Eventstore (geteventstore.com)
Public Class Methods
new(host: 'localhost', port: 2113, username: nil, password: nil, max_retries: 0)
click to toggle source
Creates a new event store client, connecting to the specified `host` and `port` using an optional `username` and `password`. Use the `max_retries` option to choose how many times to retry in case of network failures.
# File lib/akasha/storage/http_event_store.rb, line 11 def initialize(host: 'localhost', port: 2113, username: nil, password: nil, max_retries: 0) @client = Client.new(host: host, port: port, username: username, password: password) @max_retries = max_retries end
Public Instance Methods
[](stream_name)
click to toggle source
Shortcut for accessing streams by their names.
# File lib/akasha/storage/http_event_store.rb, line 24 def [](stream_name) Stream.new(@client, stream_name, max_retries: @max_retries) end
merge_all_by_event(into:, only:, namespace: nil)
click to toggle source
Merges all streams into one, filtering the resulting stream so it only contains events with the specified names, using a projection.
Arguments:
`into` - name of the new stream `only` - array of event names `namespace` - optional namespace; if provided, the resulting stream will only contain events with the same `metadata[:namespace]`
# File lib/akasha/storage/http_event_store.rb, line 37 def merge_all_by_event(into:, only:, namespace: nil) @client.merge_all_by_event(into, only, namespace: namespace, max_retries: @max_retries) end
streams()
click to toggle source
Returns a Hash of streams. You can retrieve a Stream
instance corresponding to any stream by its name. The stream does not have to exist, appending to it will create it.
# File lib/akasha/storage/http_event_store.rb, line 19 def streams self # Use the `[]` method on self. end