event_store_client 2.1.3 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf7ad41170584cd3dbe64ba7afff6e8e3af7a51277cf60e5732b6187e18e8170
4
- data.tar.gz: 2cb382ee414a9d00373954e05f6a931e9bec042a84491dd58d2d96f4fd47559c
3
+ metadata.gz: a4b94342dbb48eeba88c4f87758497bf3604ec01d1954163af2d9add2e88e46f
4
+ data.tar.gz: 195564b4fded0a7c5986b4f3b5b76a19ad97018113238389a26254df27191f49
5
5
  SHA512:
6
- metadata.gz: adec2fceef915b4383e694f299e91963bd27bebcf6b3bcf5a25d8549bc6b6038a2d58ab1937444a8ffa3fd8785ed6f8351ec9b9960537a4d4000d3f7ce80d6c0
7
- data.tar.gz: ad2b082b49f5c6d40f6f74bf5e31543878b1d09787650381687eb1b9367aecbc80121d277f929a242e26e7f82d15dede426dc0da983ced71712b87497a3ede36
6
+ metadata.gz: 62c2faaed828d92add77f8c8af76f7bae5fe3fa990e9820e4fc5dd6b74ad7b3fbe0e84aa7d2975c6903e91e959d6969d5ae30aa3d2916300086d2cfa81fce8b0
7
+ data.tar.gz: 5b282b014013149ecb61531ad02fe654321765f15da09fc4ffeadabc2fbefc21c919a769d657cfc0fe7922d80338dab6908bf1a00a21b672d9128603062e448f
@@ -83,3 +83,11 @@ Possible options:
83
83
  | grpcRetryAttempts | Integer | `3` | Number of times to retry GRPC requests. Does not apply to discovery requests. Final number of requests in cases of error will be initial request + grpcRetryAttempts. |
84
84
  | grpcRetryInterval | Integer | `100` | Milliseconds. Delay between GRPC requests. retries. |
85
85
  | throwOnAppendFailure | Boolean | `true` | Defines if append requests should immediately raise an error. If set to `false`, request will be retried in case of a server error. |
86
+
87
+ Examples:
88
+
89
+ ```
90
+ esdb://localhost:2113/?tls=false
91
+ esdb+discover://localhost:2113/?grpcRetryAttempts=3&grpcRetryInterval=300&discoverInterval=200
92
+ esdb://localhost:2113,localhost:2114,localhost:2115/?gossipTimeout=500&maxDiscoverAttempts=3
93
+ ```
@@ -117,7 +117,7 @@ module EventStoreClient
117
117
  # @param stream_name [String]
118
118
  # @return [Integer]
119
119
  def calc_next_position(raw_events, direction, stream_name)
120
- events = meaningful_events(raw_events).map { |e| e.event.event }
120
+ events = meaningful_events(raw_events).map(&:event)
121
121
 
122
122
  return next_position_for_all(events, direction) if stream_name == '$all'
123
123
 
@@ -128,18 +128,18 @@ module EventStoreClient
128
128
  # @param direction [Symbol] :Backwards or :Forwards
129
129
  # @return [Integer]
130
130
  def next_position_for_all(events, direction)
131
- return events.last.commit_position if direction == DEFAULT_READ_DIRECTION
131
+ return event_or_link(events.last).commit_position if direction == DEFAULT_READ_DIRECTION
132
132
 
133
- events.first.commit_position
133
+ event_or_link(events.first).commit_position
134
134
  end
135
135
 
136
136
  # @param events [Array<EventStore::Client::Streams::ReadResp::ReadEvent::RecordedEvent>]
137
137
  # @param direction [Symbol] :Backwards or :Forwards
138
138
  # @return [Integer]
139
139
  def next_position_for_regular(events, direction)
140
- return events.last.stream_revision + 1 if direction == DEFAULT_READ_DIRECTION
140
+ return event_or_link(events.last).stream_revision + 1 if direction == DEFAULT_READ_DIRECTION
141
141
 
142
- events.last.stream_revision - 1
142
+ event_or_link(events.last).stream_revision - 1
143
143
  end
144
144
 
145
145
  # @param raw_events [Array<EventStore::Client::Streams::ReadResp>]
@@ -166,6 +166,17 @@ module EventStoreClient
166
166
  "Current value is `#{max_count}'."
167
167
  )
168
168
  end
169
+
170
+ # Picks the correct object for later resolving of stream_revision from it. In case if we
171
+ # deal with links - we should prefer a link over a linked event, because exactly it
172
+ # contains correct stream revision of the stream we are reading from. Because if we pick
173
+ # a linked event's stream_revision, then it will be a revision from the stream that event
174
+ # belongs to - this can potentially create an infinite loop.
175
+ # @param event [EventStore::Client::Streams::ReadResp::ReadEvent]
176
+ # @return [EventStore::Client::Streams::ReadResp::ReadEvent::RecordedEvent]
177
+ def event_or_link(event)
178
+ event.link ? event.link : event.event
179
+ end
169
180
  end
170
181
  end
171
182
  end
@@ -4,6 +4,7 @@
4
4
  require 'google/protobuf'
5
5
 
6
6
  require 'google/protobuf/empty_pb'
7
+ require 'google/protobuf/any_pb'
7
8
 
8
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
10
  add_file("shared.proto", :syntax => :proto3) do
@@ -55,6 +56,30 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
55
56
  add_message "event_store.client.BadRequest" do
56
57
  optional :message, :string, 1
57
58
  end
59
+ add_message "event_store.client.Status" do
60
+ optional :code, :enum, 1, "event_store.client.Code"
61
+ optional :message, :string, 2
62
+ optional :details, :message, 3, "google.protobuf.Any"
63
+ end
64
+ add_enum "event_store.client.Code" do
65
+ value :OK, 0
66
+ value :CANCELLED, 1
67
+ value :UNKNOWN, 2
68
+ value :INVALID_ARGUMENT, 3
69
+ value :DEADLINE_EXCEEDED, 4
70
+ value :NOT_FOUND, 5
71
+ value :ALREADY_EXISTS, 6
72
+ value :PERMISSION_DENIED, 7
73
+ value :UNAUTHENTICATED, 16
74
+ value :RESOURCE_EXHAUSTED, 8
75
+ value :FAILED_PRECONDITION, 9
76
+ value :ABORTED, 10
77
+ value :OUT_OF_RANGE, 11
78
+ value :UNIMPLEMENTED, 12
79
+ value :INTERNAL, 13
80
+ value :UNAVAILABLE, 14
81
+ value :DATA_LOSS, 15
82
+ end
58
83
  end
59
84
  end
60
85
 
@@ -73,5 +98,7 @@ module EventStore
73
98
  InvalidTransaction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("event_store.client.InvalidTransaction").msgclass
74
99
  MaximumAppendSizeExceeded = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("event_store.client.MaximumAppendSizeExceeded").msgclass
75
100
  BadRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("event_store.client.BadRequest").msgclass
101
+ Status = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("event_store.client.Status").msgclass
102
+ Code = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("event_store.client.Code").enummodule
76
103
  end
77
104
  end
@@ -4,7 +4,6 @@
4
4
  require 'google/protobuf'
5
5
 
6
6
  require_relative 'shared_pb'
7
- require_relative 'status_pb'
8
7
  require 'google/protobuf/duration_pb'
9
8
  require 'google/protobuf/empty_pb'
10
9
  require 'google/protobuf/timestamp_pb'
@@ -211,7 +210,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
211
210
  optional :correlation_id, :message, 1, "event_store.client.UUID"
212
211
  optional :stream_identifier, :message, 4, "event_store.client.StreamIdentifier"
213
212
  oneof :result do
214
- optional :error, :message, 2, "google.rpc.Status"
213
+ optional :error, :message, 2, "event_store.client.Status"
215
214
  optional :success, :message, 3, "event_store.client.streams.BatchAppendResp.Success"
216
215
  end
217
216
  oneof :expected_stream_position do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EventStoreClient
4
- VERSION = '2.1.3'
4
+ VERSION = '2.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_store_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Wilgosz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-26 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -191,7 +191,6 @@ files:
191
191
  - lib/event_store_client/adapters/grpc/discover.rb
192
192
  - lib/event_store_client/adapters/grpc/generated/cluster_pb.rb
193
193
  - lib/event_store_client/adapters/grpc/generated/cluster_services_pb.rb
194
- - lib/event_store_client/adapters/grpc/generated/code_pb.rb
195
194
  - lib/event_store_client/adapters/grpc/generated/gossip_pb.rb
196
195
  - lib/event_store_client/adapters/grpc/generated/gossip_services_pb.rb
197
196
  - lib/event_store_client/adapters/grpc/generated/monitoring_pb.rb
@@ -205,7 +204,6 @@ files:
205
204
  - lib/event_store_client/adapters/grpc/generated/serverfeatures_pb.rb
206
205
  - lib/event_store_client/adapters/grpc/generated/serverfeatures_services_pb.rb
207
206
  - lib/event_store_client/adapters/grpc/generated/shared_pb.rb
208
- - lib/event_store_client/adapters/grpc/generated/status_pb.rb
209
207
  - lib/event_store_client/adapters/grpc/generated/streams_pb.rb
210
208
  - lib/event_store_client/adapters/grpc/generated/streams_services_pb.rb
211
209
  - lib/event_store_client/adapters/grpc/generated/users_pb.rb
@@ -1,34 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: code.proto
3
-
4
- require 'google/protobuf'
5
-
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_file("code.proto", :syntax => :proto3) do
8
- add_enum "google.rpc.Code" do
9
- value :OK, 0
10
- value :CANCELLED, 1
11
- value :UNKNOWN, 2
12
- value :INVALID_ARGUMENT, 3
13
- value :DEADLINE_EXCEEDED, 4
14
- value :NOT_FOUND, 5
15
- value :ALREADY_EXISTS, 6
16
- value :PERMISSION_DENIED, 7
17
- value :UNAUTHENTICATED, 16
18
- value :RESOURCE_EXHAUSTED, 8
19
- value :FAILED_PRECONDITION, 9
20
- value :ABORTED, 10
21
- value :OUT_OF_RANGE, 11
22
- value :UNIMPLEMENTED, 12
23
- value :INTERNAL, 13
24
- value :UNAVAILABLE, 14
25
- value :DATA_LOSS, 15
26
- end
27
- end
28
- end
29
-
30
- module Google
31
- module Rpc
32
- Code = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.rpc.Code").enummodule
33
- end
34
- end
@@ -1,23 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: status.proto
3
-
4
- require 'google/protobuf'
5
-
6
- require 'google/protobuf/any_pb'
7
- require_relative 'code_pb'
8
-
9
- Google::Protobuf::DescriptorPool.generated_pool.build do
10
- add_file("status.proto", :syntax => :proto3) do
11
- add_message "google.rpc.Status" do
12
- optional :code, :enum, 1, "google.rpc.Code"
13
- optional :message, :string, 2
14
- optional :details, :message, 3, "google.protobuf.Any"
15
- end
16
- end
17
- end
18
-
19
- module Google
20
- module Rpc
21
- Status = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.rpc.Status").msgclass
22
- end
23
- end