Class: TransactionEventStore::Client
- Inherits:
-
RubyEventStore::Client
- Object
- RubyEventStore::Client
- TransactionEventStore::Client
- Defined in:
- lib/transaction_event_store/client.rb
Defined Under Namespace
Classes: Page
Instance Method Summary collapse
- #last_stream_snapshot(stream_name) ⇒ Object
- #notify_subscribers(event) ⇒ Object
- #publish_snapshot(event, stream_name: GLOBAL_STREAM, expected_version: :any) ⇒ Object
- #read_all_streams_backward(start: :head, count: page_size) ⇒ Object
- #read_all_streams_forward(start: :head, count: page_size) ⇒ Object
- #read_events_backward(stream_name, start: :head, count: page_size) ⇒ Object
- #read_events_forward(stream_name, start: :head, count: page_size) ⇒ Object
- #with_lock(stream, &block) ⇒ Object
Instance Method Details
#last_stream_snapshot(stream_name) ⇒ Object
19 20 21 |
# File 'lib/transaction_event_store/client.rb', line 19 def last_stream_snapshot(stream_name) repository.last_stream_snapshot(stream_name) end |
#notify_subscribers(event) ⇒ Object
15 16 17 |
# File 'lib/transaction_event_store/client.rb', line 15 def notify_subscribers(event) event_broker.notify_subscribers(event) end |
#publish_snapshot(event, stream_name: GLOBAL_STREAM, expected_version: :any) ⇒ Object
9 10 11 12 13 |
# File 'lib/transaction_event_store/client.rb', line 9 def publish_snapshot(event, stream_name: GLOBAL_STREAM, expected_version: :any) validate_expected_version(stream_name, expected_version) repository.create_snapshot(event, stream_name) :ok end |
#read_all_streams_backward(start: :head, count: page_size) ⇒ Object
40 41 42 43 |
# File 'lib/transaction_event_store/client.rb', line 40 def read_all_streams_backward(start: :head, count: page_size) page = Page.new(repository, start, count) repository.read_all_streams_backward(page.start, page.count) end |
#read_all_streams_forward(start: :head, count: page_size) ⇒ Object
35 36 37 38 |
# File 'lib/transaction_event_store/client.rb', line 35 def read_all_streams_forward(start: :head, count: page_size) page = Page.new(repository, start, count) repository.read_all_streams_forward(page.start, page.count) end |
#read_events_backward(stream_name, start: :head, count: page_size) ⇒ Object
29 30 31 32 33 |
# File 'lib/transaction_event_store/client.rb', line 29 def read_events_backward(stream_name, start: :head, count: page_size) raise IncorrectStreamData if stream_name.nil? || stream_name.empty? page = Page.new(repository, start, count) repository.read_events_backward(stream_name, page.start, page.count) end |
#read_events_forward(stream_name, start: :head, count: page_size) ⇒ Object
23 24 25 26 27 |
# File 'lib/transaction_event_store/client.rb', line 23 def read_events_forward(stream_name, start: :head, count: page_size) raise IncorrectStreamData if stream_name.nil? || stream_name.empty? page = Page.new(repository, start, count) repository.read_events_forward(stream_name, page.start, page.count) end |
#with_lock(stream, &block) ⇒ Object
5 6 7 |
# File 'lib/transaction_event_store/client.rb', line 5 def with_lock(stream, &block) repository.with_lock(stream, &block) end |