Class: EventStoreClient::GRPC::Client
- Inherits:
-
Object
- Object
- EventStoreClient::GRPC::Client
- Includes:
- Configuration
- Defined in:
- lib/event_store_client/adapters/grpc/client.rb
Instance Method Summary collapse
-
#append_to_stream(stream_name, events_or_event, options: {}, credentials: {}) {|EventStore::Client::Streams::AppendReq, EventStore::Client::Streams::AppendReq| ... } ⇒ Dry::Monads::Result::Success, ...
Returns monads’ Success/Failure in case whether request was performed.
- #cluster_info(credentials: {}) ⇒ Dry::Monads::Success, Dry::Monads::Failure
- #delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::DeleteReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
- #hard_delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::TombstoneReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
-
#link_to(stream_name, events_or_event, options: {}, credentials: {}, &blk) ⇒ Object
Links event from one stream into another stream.
- #read(stream_name, options: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, credentials: {}) {|EventStore::Client::Streams::ReadReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
-
#read_paginated(stream_name, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) ⇒ Enumerator
Enumerator will yield Dry::Monads::Success or Dry::Monads::Failure on each iteration.
-
#subscribe_to_all(handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) ⇒ Object
This method acts the same as #subscribe_to_stream with the only exception that it subscribes to $all stream.
-
#subscribe_to_stream(stream_name, handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption) {|EventStore::Client::Streams::ReadReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
Subscribe to the given stream and listens for events.
Methods included from Configuration
Instance Method Details
#append_to_stream(stream_name, events_or_event, options: {}, credentials: {}) {|EventStore::Client::Streams::AppendReq, EventStore::Client::Streams::AppendReq| ... } ⇒ Dry::Monads::Result::Success, ...
Returns monads’ Success/Failure in case whether request was performed.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 31 def append_to_stream(stream_name, events_or_event, options: {}, credentials: {}, &blk) if events_or_event.is_a?(Array) Commands::Streams::AppendMultiple.new(**credentials).call( stream_name, events_or_event, options: ) else Commands::Streams::Append.new(**credentials).call( stream_name, events_or_event, options: , &blk ) end end |
#cluster_info(credentials: {}) ⇒ Dry::Monads::Success, Dry::Monads::Failure
269 270 271 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 269 def cluster_info(credentials: {}) Commands::Gossip::ClusterInfo.new(**credentials).call end |
#delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::DeleteReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
156 157 158 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 156 def delete_stream(stream_name, options: {}, credentials: {}, &blk) Commands::Streams::Delete.new(**credentials).call(stream_name, options: , &blk) end |
#hard_delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::TombstoneReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
135 136 137 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 135 def hard_delete_stream(stream_name, options: {}, credentials: {}, &blk) Commands::Streams::HardDelete.new(**credentials).call(stream_name, options: , &blk) end |
#link_to(stream_name, events_or_event, options: {}, credentials: {}, &blk) ⇒ Object
Links event from one stream into another stream. You can later access it by providing :resolve_link_tos option when reading from a stream. If you provide an event that does not present in EventStore database yet - its data will not be appended properly to the stream, thus, making it look as a malformed event.
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 247 def link_to(stream_name, events_or_event, options: {}, credentials: {}, &blk) if events_or_event.is_a?(Array) Commands::Streams::LinkToMultiple.new(**credentials).call( stream_name, events_or_event, options: , &blk ) else Commands::Streams::LinkTo.new(**credentials).call( stream_name, events_or_event, options: , &blk ) end end |
#read(stream_name, options: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, credentials: {}) {|EventStore::Client::Streams::ReadReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 92 def read(stream_name, options: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, credentials: {}, &blk) Commands::Streams::Read.new(**credentials).call( stream_name, options: , skip_deserialization: skip_deserialization, skip_decryption: skip_decryption, &blk ) end |
#read_paginated(stream_name, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) ⇒ Enumerator
Returns enumerator will yield Dry::Monads::Success or Dry::Monads::Failure on each iteration.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 106 def read_paginated(stream_name, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) Commands::Streams::ReadPaginated.new(**credentials).call( stream_name, options: , skip_deserialization: skip_deserialization, skip_decryption: skip_decryption, &blk ) end |
#subscribe_to_all(handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) ⇒ Object
This method acts the same as #subscribe_to_stream with the only exception that it subscribes to $all stream
229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 229 def subscribe_to_all(handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) Commands::Streams::Subscribe.new(**credentials).call( '$all', handler: handler, options: , skip_deserialization: skip_deserialization, skip_decryption: skip_decryption, &blk ) end |
#subscribe_to_stream(stream_name, handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption) {|EventStore::Client::Streams::ReadReq::Options| ... } ⇒ Dry::Monads::Success, Dry::Monads::Failure
Subscribe to the given stream and listens for events. Note, that it will block execution of
current stack. If you want to do it asynchronous - consider putting it out of current
thread.
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 213 def subscribe_to_stream(stream_name, handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) Commands::Streams::Subscribe.new(**credentials).call( stream_name, handler: handler, options: , skip_deserialization: skip_deserialization, skip_decryption: skip_decryption, &blk ) end |