Class: EventStoreClient::GRPC::Options::Streams::ReadOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/event_store_client/adapters/grpc/options/streams/read_options.rb

Instance Method Summary collapse

Constructor Details

#initialize(stream_name, options, config:) ⇒ ReadOptions

Returns a new instance of ReadOptions.

Parameters:

  • stream_name (String)
  • options (Hash)
  • config (EventStoreClient::Config)
  • [String] (Hash)

    a customizable set of options

  • [Integer] (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options

  • [Symbol] (Hash)

    a customizable set of options

  • [Hash] (Hash)

    a customizable set of options



41
42
43
44
45
# File 'lib/event_store_client/adapters/grpc/options/streams/read_options.rb', line 41

def initialize(stream_name, options, config:)
  @stream_name = stream_name
  @options = options
  @config = config
end

Instance Method Details

#request_optionsHash

Returns see event_store.client.streams.ReadReq.Options for available options.

Returns:

  • (Hash)

    see event_store.client.streams.ReadReq.Options for available options



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/event_store_client/adapters/grpc/options/streams/read_options.rb', line 48

def request_options
  request_options = {}
  request_options.merge!(
    Shared::Options::StreamOptions.new(stream_name, options).request_options
  )
  request_options[:read_direction] = options[:direction]
  request_options[:count] = options[:max_count] || config.per_page
  request_options[:resolve_links] = options[:resolve_link_tos]
  request_options.merge!(
    Shared::Options::FilterOptions.new(options[:filter]).request_options
  )
  # This option means how event#id would look like in the response. If you provided
  # :string key, then #id will be a normal UUID string. If you provided :structured
  # key, then #id will be an instance of EventStore::Client::UUID::Structured class.
  # Note: for some reason if you don't provide this option - the request hangs forever
  # Examples:
  #   <EventStore::Client::UUID::Structured:
  #     most_significant_bits: 1266766466329758182,
  #     least_significant_bits: -8366670759139390653>
  #   <EventStore::Client::UUID: string: "f0e1771c-334b-4b8d-ad88-c2024ccbe141">
  request_options[:uuid_option] = { string: EventStore::Client::Empty.new }
  request_options
end