Class: EventStoreClient::GRPC::Client
- Inherits:
- 
      Object
      
        - Object
- EventStoreClient::GRPC::Client
 
- Defined in:
- lib/event_store_client/adapters/grpc/client.rb
Instance Attribute Summary collapse
- 
  
    
      #config  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute config. 
Instance Method Summary collapse
- #append_to_stream(stream_name, events_or_event, options: {}, credentials: {}) {|EventStore::Client::Streams::AppendReq, EventStore::Client::Streams::AppendReq| ... } ⇒ EventStore::Client::Streams::AppendResp+
- #cluster_info(credentials: {}) ⇒ EventStore::Client::Gossip::ClusterInfo
- #delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::DeleteReq::Options| ... } ⇒ EventStore::Client::Streams::DeleteResp
- #hard_delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::TombstoneReq::Options| ... } ⇒ EventStore::Client::Streams::DeleteResp
- 
  
    
      #initialize(config)  ⇒ Client 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Client. 
- 
  
    
      #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| ... } ⇒ Array<EventStoreClient::DeserializedEvent>, Array<EventStore::Client::Streams::ReadResp>
- 
  
    
      #read_paginated(stream_name, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk)  ⇒ Enumerator 
    
    
  
  
  
  
  
  
  
  
  
    EventStore::Client::Streams::ReadResp on each iteration depending on ‘:skip_deserialization` argument value. 
- 
  
    
      #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| ... } ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    Subscribe to the given stream and listens for events. 
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
| 11 12 13 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 11 def initialize(config) @config = config end | 
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
| 8 9 10 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 8 def config @config end | 
Instance Method Details
#append_to_stream(stream_name, events_or_event, options: {}, credentials: {}) {|EventStore::Client::Streams::AppendReq, EventStore::Client::Streams::AppendReq| ... } ⇒ EventStore::Client::Streams::AppendResp+
| 36 37 38 39 40 41 42 43 44 45 46 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 36 def append_to_stream(stream_name, events_or_event, options: {}, credentials: {}, &blk) if events_or_event.is_a?(Array) Commands::Streams::AppendMultiple.new(config: config, **credentials).call( stream_name, events_or_event, options: ) else Commands::Streams::Append.new(config: config, **credentials).call( stream_name, events_or_event, options: , &blk ) end end | 
#cluster_info(credentials: {}) ⇒ EventStore::Client::Gossip::ClusterInfo
| 282 283 284 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 282 def cluster_info(credentials: {}) Commands::Gossip::ClusterInfo.new(config: config, **credentials).call end | 
#delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::DeleteReq::Options| ... } ⇒ EventStore::Client::Streams::DeleteResp
| 167 168 169 170 171 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 167 def delete_stream(stream_name, options: {}, credentials: {}, &blk) Commands::Streams::Delete. new(config: config, **credentials). call(stream_name, options: , &blk) end | 
#hard_delete_stream(stream_name, options: {}, credentials: {}) {|EventStore::Client::Streams::TombstoneReq::Options| ... } ⇒ EventStore::Client::Streams::DeleteResp
| 143 144 145 146 147 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 143 def hard_delete_stream(stream_name, options: {}, credentials: {}, &blk) Commands::Streams::HardDelete. new(config: config, **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.
| 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 260 def link_to(stream_name, events_or_event, options: {}, credentials: {}, &blk) if events_or_event.is_a?(Array) Commands::Streams::LinkToMultiple.new(config: config, **credentials).call( stream_name, events_or_event, options: , &blk ) else Commands::Streams::LinkTo.new(config: config, **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| ... } ⇒ Array<EventStoreClient::DeserializedEvent>, Array<EventStore::Client::Streams::ReadResp>
| 98 99 100 101 102 103 104 105 106 107 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 98 def read(stream_name, options: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, credentials: {}, &blk) Commands::Streams::Read.new(config: config, **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
EventStore::Client::Streams::ReadResp on each iteration depending on ‘:skip_deserialization` argument value
| 113 114 115 116 117 118 119 120 121 122 123 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 113 def read_paginated(stream_name, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) Commands::Streams::ReadPaginated.new(config: config, **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
| 242 243 244 245 246 247 248 249 250 251 252 253 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 242 def subscribe_to_all(handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) Commands::Streams::Subscribe.new(config: config, **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| ... } ⇒ void
This method returns an undefined value.
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.
| 226 227 228 229 230 231 232 233 234 235 236 237 | # File 'lib/event_store_client/adapters/grpc/client.rb', line 226 def subscribe_to_stream(stream_name, handler:, options: {}, credentials: {}, skip_deserialization: config.skip_deserialization, skip_decryption: config.skip_decryption, &blk) Commands::Streams::Subscribe.new(config: config, **credentials).call( stream_name, handler: handler, options: , skip_deserialization: skip_deserialization, skip_decryption: skip_decryption, &blk ) end |