class EventStoreClient::GRPC::Commands::Streams::ReadAll

Public Instance Methods

call(stream_name, options: {}) click to toggle source
# File lib/event_store_client/adapters/grpc/commands/streams/read_all.rb, line 21
def call(stream_name, options: {})
  start ||= options[:start] || 0
  count ||= options[:count] || 20
  events = []

  loop do
    res = Read.new.call(
      stream_name, options: options.merge(start: start, count: count)
    )
    break if res.failure?
    break if (entries = res.value!).empty?

    events += entries
    start += count
  end

  Success(events)
end