Class: Estore::Commands::ReadBatch
- Inherits:
-
Object
- Object
- Estore::Commands::ReadBatch
- Includes:
- Command, Command::ReadStreamForward
- Defined in:
- lib/estore/commands/read_batch.rb
Instance Attribute Summary
Attributes included from Command
Instance Method Summary collapse
- #call ⇒ Object
- #handle(message) ⇒ Object
-
#initialize(connection, stream, from, limit) ⇒ ReadBatch
constructor
A new instance of ReadBatch.
Methods included from Command::ReadStreamForward
Methods included from Command
#decode, #promise, #register!, #reject!, #remove!, #write
Constructor Details
#initialize(connection, stream, from, limit) ⇒ ReadBatch
Returns a new instance of ReadBatch.
7 8 9 10 |
# File 'lib/estore/commands/read_batch.rb', line 7 def initialize(connection, stream, from, limit) super(connection) @stream, @from, @limit = stream, from, limit end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 |
# File 'lib/estore/commands/read_batch.rb', line 12 def call register! read(@stream, @from, @limit) promise end |
#handle(message) ⇒ Object
18 19 20 21 22 |
# File 'lib/estore/commands/read_batch.rb', line 18 def handle(, *) remove! response = decode(ReadStreamEventsCompleted, ) promise.fulfill(Array(response.events)) end |