event_store_client 1.4.9 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -145
- data/docs/appending_events.md +155 -0
- data/docs/catch_up_subscriptions.md +253 -0
- data/docs/configuration.md +83 -0
- data/docs/deleting_streams.md +25 -0
- data/docs/encrypting_events.md +84 -0
- data/docs/linking_events.md +149 -0
- data/docs/reading_events.md +200 -0
- data/lib/event_store_client/adapters/grpc/client.rb +244 -105
- data/lib/event_store_client/adapters/grpc/cluster/gossip_discover.rb +131 -0
- data/lib/event_store_client/adapters/grpc/cluster/insecure_connection.rb +21 -0
- data/lib/event_store_client/adapters/grpc/cluster/member.rb +18 -0
- data/lib/event_store_client/adapters/grpc/cluster/queryless_discover.rb +25 -0
- data/lib/event_store_client/adapters/grpc/cluster/secure_connection.rb +71 -0
- data/lib/event_store_client/adapters/grpc/command_registrar.rb +7 -7
- data/lib/event_store_client/adapters/grpc/commands/command.rb +63 -25
- data/lib/event_store_client/adapters/grpc/commands/gossip/cluster_info.rb +24 -0
- data/lib/event_store_client/adapters/grpc/commands/streams/append.rb +43 -68
- data/lib/event_store_client/adapters/grpc/commands/streams/append_multiple.rb +44 -0
- data/lib/event_store_client/adapters/grpc/commands/streams/delete.rb +21 -17
- data/lib/event_store_client/adapters/grpc/commands/streams/hard_delete.rb +39 -0
- data/lib/event_store_client/adapters/grpc/commands/streams/link_to.rb +7 -52
- data/lib/event_store_client/adapters/grpc/commands/streams/link_to_multiple.rb +44 -0
- data/lib/event_store_client/adapters/grpc/commands/streams/read.rb +20 -85
- data/lib/event_store_client/adapters/grpc/commands/streams/read_paginated.rb +174 -0
- data/lib/event_store_client/adapters/grpc/commands/streams/subscribe.rb +31 -106
- data/lib/event_store_client/adapters/grpc/connection.rb +56 -36
- data/lib/event_store_client/adapters/grpc/discover.rb +75 -0
- data/lib/event_store_client/adapters/grpc/generated/cluster_pb.rb +106 -18
- data/lib/event_store_client/adapters/grpc/generated/cluster_services_pb.rb +12 -12
- data/lib/event_store_client/adapters/grpc/generated/code_pb.rb +34 -0
- data/lib/event_store_client/adapters/grpc/generated/gossip_pb.rb +3 -2
- data/lib/event_store_client/adapters/grpc/generated/gossip_services_pb.rb +3 -3
- data/lib/event_store_client/adapters/grpc/generated/monitoring_pb.rb +25 -0
- data/lib/event_store_client/adapters/grpc/generated/monitoring_services_pb.rb +26 -0
- data/lib/event_store_client/adapters/grpc/generated/operations_pb.rb +2 -1
- data/lib/event_store_client/adapters/grpc/generated/operations_services_pb.rb +8 -7
- data/lib/event_store_client/adapters/grpc/generated/persistent_pb.rb +199 -38
- data/lib/event_store_client/adapters/grpc/generated/persistent_services_pb.rb +7 -3
- data/lib/event_store_client/adapters/grpc/generated/projections_pb.rb +9 -26
- data/lib/event_store_client/adapters/grpc/generated/projections_services_pb.rb +4 -3
- data/lib/event_store_client/adapters/grpc/generated/serverfeatures_pb.rb +29 -0
- data/lib/event_store_client/adapters/grpc/generated/serverfeatures_services_pb.rb +26 -0
- data/lib/event_store_client/adapters/grpc/generated/shared_pb.rb +54 -12
- data/lib/event_store_client/adapters/grpc/generated/status_pb.rb +23 -0
- data/lib/event_store_client/adapters/grpc/generated/streams_pb.rb +104 -64
- data/lib/event_store_client/adapters/grpc/generated/streams_services_pb.rb +3 -2
- data/lib/event_store_client/adapters/grpc/generated/users_services_pb.rb +2 -2
- data/lib/event_store_client/adapters/grpc/options/streams/read_options.rb +78 -0
- data/lib/event_store_client/adapters/grpc/options/streams/write_options.rb +39 -0
- data/lib/event_store_client/adapters/grpc/shared/event_deserializer.rb +52 -0
- data/lib/event_store_client/adapters/grpc/shared/options/filter_options.rb +76 -0
- data/lib/event_store_client/adapters/grpc/shared/options/stream_options.rb +91 -0
- data/lib/event_store_client/adapters/grpc/shared/streams/process_response.rb +28 -0
- data/lib/event_store_client/adapters/grpc/shared/streams/process_responses.rb +33 -0
- data/lib/event_store_client/adapters/grpc.rb +28 -12
- data/lib/event_store_client/configuration.rb +39 -54
- data/lib/event_store_client/connection/url.rb +57 -0
- data/lib/event_store_client/connection/url_parser.rb +144 -0
- data/lib/event_store_client/data_decryptor.rb +2 -9
- data/lib/event_store_client/deserialized_event.rb +35 -10
- data/lib/event_store_client/encryption_metadata.rb +0 -1
- data/lib/event_store_client/event.rb +4 -2
- data/lib/event_store_client/extensions/options_extension.rb +87 -0
- data/lib/event_store_client/mapper/default.rb +12 -9
- data/lib/event_store_client/mapper/encrypted.rb +18 -17
- data/lib/event_store_client/types.rb +1 -1
- data/lib/event_store_client/utils.rb +30 -0
- data/lib/event_store_client/version.rb +1 -1
- data/lib/event_store_client.rb +8 -7
- metadata +74 -83
- data/lib/event_store_client/adapters/grpc/Protos/cluster.proto +0 -149
- data/lib/event_store_client/adapters/grpc/Protos/gossip.proto +0 -44
- data/lib/event_store_client/adapters/grpc/Protos/operations.proto +0 -45
- data/lib/event_store_client/adapters/grpc/Protos/persistent.proto +0 -180
- data/lib/event_store_client/adapters/grpc/Protos/projections.proto +0 -174
- data/lib/event_store_client/adapters/grpc/Protos/shared.proto +0 -22
- data/lib/event_store_client/adapters/grpc/Protos/streams.proto +0 -242
- data/lib/event_store_client/adapters/grpc/Protos/users.proto +0 -119
- data/lib/event_store_client/adapters/grpc/README.md +0 -16
- data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/create.rb +0 -46
- data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/delete.rb +0 -34
- data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/read.rb +0 -77
- data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/settings_schema.rb +0 -38
- data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/update.rb +0 -48
- data/lib/event_store_client/adapters/grpc/commands/projections/create.rb +0 -48
- data/lib/event_store_client/adapters/grpc/commands/projections/delete.rb +0 -34
- data/lib/event_store_client/adapters/grpc/commands/projections/update.rb +0 -44
- data/lib/event_store_client/adapters/grpc/commands/streams/read_all.rb +0 -43
- data/lib/event_store_client/adapters/grpc/commands/streams/tombstone.rb +0 -35
- data/lib/event_store_client/adapters/http/README.md +0 -16
- data/lib/event_store_client/adapters/http/client.rb +0 -161
- data/lib/event_store_client/adapters/http/commands/command.rb +0 -27
- data/lib/event_store_client/adapters/http/commands/persistent_subscriptions/ack.rb +0 -15
- data/lib/event_store_client/adapters/http/commands/persistent_subscriptions/create.rb +0 -35
- data/lib/event_store_client/adapters/http/commands/persistent_subscriptions/read.rb +0 -60
- data/lib/event_store_client/adapters/http/commands/projections/create.rb +0 -33
- data/lib/event_store_client/adapters/http/commands/projections/update.rb +0 -31
- data/lib/event_store_client/adapters/http/commands/streams/append.rb +0 -49
- data/lib/event_store_client/adapters/http/commands/streams/delete.rb +0 -16
- data/lib/event_store_client/adapters/http/commands/streams/link_to.rb +0 -49
- data/lib/event_store_client/adapters/http/commands/streams/read.rb +0 -52
- data/lib/event_store_client/adapters/http/commands/streams/tombstone.rb +0 -17
- data/lib/event_store_client/adapters/http/connection.rb +0 -46
- data/lib/event_store_client/adapters/http/request_method.rb +0 -28
- data/lib/event_store_client/adapters/http.rb +0 -17
- data/lib/event_store_client/adapters/in_memory.rb +0 -144
- data/lib/event_store_client/broker.rb +0 -40
- data/lib/event_store_client/catch_up_subscription.rb +0 -42
- data/lib/event_store_client/catch_up_subscriptions.rb +0 -92
- data/lib/event_store_client/client.rb +0 -73
- data/lib/event_store_client/error_handler.rb +0 -10
- data/lib/event_store_client/subscription.rb +0 -23
- data/lib/event_store_client/subscriptions.rb +0 -38
- data/lib/event_store_client/value_objects/read_direction.rb +0 -43
@@ -1,242 +0,0 @@
|
|
1
|
-
syntax = "proto3";
|
2
|
-
package event_store.client.streams;
|
3
|
-
option java_package = "com.eventstore.dbclient.proto.streams";
|
4
|
-
|
5
|
-
import "shared.proto";
|
6
|
-
|
7
|
-
service Streams {
|
8
|
-
rpc Read (ReadReq) returns (stream ReadResp);
|
9
|
-
rpc Append (stream AppendReq) returns (AppendResp);
|
10
|
-
rpc Delete (DeleteReq) returns (DeleteResp);
|
11
|
-
rpc Tombstone (TombstoneReq) returns (TombstoneResp);
|
12
|
-
}
|
13
|
-
|
14
|
-
message ReadReq {
|
15
|
-
Options options = 1;
|
16
|
-
|
17
|
-
message Options {
|
18
|
-
oneof stream_option {
|
19
|
-
StreamOptions stream = 1;
|
20
|
-
AllOptions all = 2;
|
21
|
-
}
|
22
|
-
ReadDirection read_direction = 3;
|
23
|
-
bool resolve_links = 4;
|
24
|
-
oneof count_option {
|
25
|
-
uint64 count = 5;
|
26
|
-
SubscriptionOptions subscription = 6;
|
27
|
-
}
|
28
|
-
oneof filter_option {
|
29
|
-
FilterOptions filter = 7;
|
30
|
-
event_store.client.shared.Empty no_filter = 8;
|
31
|
-
}
|
32
|
-
UUIDOption uuid_option = 9;
|
33
|
-
|
34
|
-
enum ReadDirection {
|
35
|
-
Forwards = 0;
|
36
|
-
Backwards = 1;
|
37
|
-
}
|
38
|
-
message StreamOptions {
|
39
|
-
event_store.client.shared.StreamIdentifier stream_identifier = 1;
|
40
|
-
oneof revision_option {
|
41
|
-
uint64 revision = 2;
|
42
|
-
event_store.client.shared.Empty start = 3;
|
43
|
-
event_store.client.shared.Empty end = 4;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
message AllOptions {
|
47
|
-
oneof all_option {
|
48
|
-
Position position = 1;
|
49
|
-
event_store.client.shared.Empty start = 2;
|
50
|
-
event_store.client.shared.Empty end = 3;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
message SubscriptionOptions {
|
54
|
-
}
|
55
|
-
message Position {
|
56
|
-
uint64 commit_position = 1;
|
57
|
-
uint64 prepare_position = 2;
|
58
|
-
}
|
59
|
-
message FilterOptions {
|
60
|
-
oneof filter {
|
61
|
-
Expression stream_identifier = 1;
|
62
|
-
Expression event_type = 2;
|
63
|
-
}
|
64
|
-
oneof window {
|
65
|
-
uint32 max = 3;
|
66
|
-
event_store.client.shared.Empty count = 4;
|
67
|
-
}
|
68
|
-
uint32 checkpointIntervalMultiplier = 5;
|
69
|
-
|
70
|
-
message Expression {
|
71
|
-
string regex = 1;
|
72
|
-
repeated string prefix = 2;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
message UUIDOption {
|
76
|
-
oneof content {
|
77
|
-
event_store.client.shared.Empty structured = 1;
|
78
|
-
event_store.client.shared.Empty string = 2;
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
message ReadResp {
|
85
|
-
oneof content {
|
86
|
-
ReadEvent event = 1;
|
87
|
-
SubscriptionConfirmation confirmation = 2;
|
88
|
-
Checkpoint checkpoint = 3;
|
89
|
-
StreamNotFound stream_not_found = 4;
|
90
|
-
}
|
91
|
-
|
92
|
-
message ReadEvent {
|
93
|
-
RecordedEvent event = 1;
|
94
|
-
RecordedEvent link = 2;
|
95
|
-
oneof position {
|
96
|
-
uint64 commit_position = 3;
|
97
|
-
event_store.client.shared.Empty no_position = 4;
|
98
|
-
}
|
99
|
-
|
100
|
-
message RecordedEvent {
|
101
|
-
event_store.client.shared.UUID id = 1;
|
102
|
-
event_store.client.shared.StreamIdentifier stream_identifier = 2;
|
103
|
-
uint64 stream_revision = 3;
|
104
|
-
uint64 prepare_position = 4;
|
105
|
-
uint64 commit_position = 5;
|
106
|
-
map<string, string> metadata = 6;
|
107
|
-
bytes custom_metadata = 7;
|
108
|
-
bytes data = 8;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
message SubscriptionConfirmation {
|
112
|
-
string subscription_id = 1;
|
113
|
-
}
|
114
|
-
message Checkpoint {
|
115
|
-
uint64 commit_position = 1;
|
116
|
-
uint64 prepare_position = 2;
|
117
|
-
}
|
118
|
-
message StreamNotFound {
|
119
|
-
event_store.client.shared.StreamIdentifier stream_identifier = 1;
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
message AppendReq {
|
124
|
-
oneof content {
|
125
|
-
Options options = 1;
|
126
|
-
ProposedMessage proposed_message = 2;
|
127
|
-
}
|
128
|
-
|
129
|
-
message Options {
|
130
|
-
event_store.client.shared.StreamIdentifier stream_identifier = 1;
|
131
|
-
oneof expected_stream_revision {
|
132
|
-
uint64 revision = 2;
|
133
|
-
event_store.client.shared.Empty no_stream = 3;
|
134
|
-
event_store.client.shared.Empty any = 4;
|
135
|
-
event_store.client.shared.Empty stream_exists = 5;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
message ProposedMessage {
|
139
|
-
event_store.client.shared.UUID id = 1;
|
140
|
-
map<string, string> metadata = 2;
|
141
|
-
bytes custom_metadata = 3;
|
142
|
-
bytes data = 4;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
message AppendResp {
|
147
|
-
oneof result {
|
148
|
-
Success success = 1;
|
149
|
-
WrongExpectedVersion wrong_expected_version = 2;
|
150
|
-
}
|
151
|
-
|
152
|
-
message Position {
|
153
|
-
uint64 commit_position = 1;
|
154
|
-
uint64 prepare_position = 2;
|
155
|
-
}
|
156
|
-
|
157
|
-
message Success {
|
158
|
-
oneof current_revision_option {
|
159
|
-
uint64 current_revision = 1;
|
160
|
-
event_store.client.shared.Empty no_stream = 2;
|
161
|
-
}
|
162
|
-
oneof position_option {
|
163
|
-
Position position = 3;
|
164
|
-
event_store.client.shared.Empty no_position = 4;
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
message WrongExpectedVersion {
|
169
|
-
oneof current_revision_option_20_6_0 {
|
170
|
-
uint64 current_revision_20_6_0 = 1;
|
171
|
-
event_store.client.shared.Empty no_stream_20_6_0 = 2;
|
172
|
-
}
|
173
|
-
oneof expected_revision_option_20_6_0 {
|
174
|
-
uint64 expected_revision_20_6_0 = 3;
|
175
|
-
event_store.client.shared.Empty any_20_6_0 = 4;
|
176
|
-
event_store.client.shared.Empty stream_exists_20_6_0 = 5;
|
177
|
-
}
|
178
|
-
oneof current_revision_option {
|
179
|
-
uint64 current_revision = 6;
|
180
|
-
event_store.client.shared.Empty current_no_stream = 7;
|
181
|
-
}
|
182
|
-
oneof expected_revision_option {
|
183
|
-
uint64 expected_revision = 8;
|
184
|
-
event_store.client.shared.Empty expected_any = 9;
|
185
|
-
event_store.client.shared.Empty expected_stream_exists = 10;
|
186
|
-
event_store.client.shared.Empty expected_no_stream = 11;
|
187
|
-
}
|
188
|
-
|
189
|
-
}
|
190
|
-
}
|
191
|
-
|
192
|
-
message DeleteReq {
|
193
|
-
Options options = 1;
|
194
|
-
|
195
|
-
message Options {
|
196
|
-
event_store.client.shared.StreamIdentifier stream_identifier = 1;
|
197
|
-
oneof expected_stream_revision {
|
198
|
-
uint64 revision = 2;
|
199
|
-
event_store.client.shared.Empty no_stream = 3;
|
200
|
-
event_store.client.shared.Empty any = 4;
|
201
|
-
event_store.client.shared.Empty stream_exists = 5;
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
message DeleteResp {
|
207
|
-
oneof position_option {
|
208
|
-
Position position = 1;
|
209
|
-
event_store.client.shared.Empty no_position = 2;
|
210
|
-
}
|
211
|
-
|
212
|
-
message Position {
|
213
|
-
uint64 commit_position = 1;
|
214
|
-
uint64 prepare_position = 2;
|
215
|
-
}
|
216
|
-
}
|
217
|
-
|
218
|
-
message TombstoneReq {
|
219
|
-
Options options = 1;
|
220
|
-
|
221
|
-
message Options {
|
222
|
-
event_store.client.shared.StreamIdentifier stream_identifier = 1;
|
223
|
-
oneof expected_stream_revision {
|
224
|
-
uint64 revision = 2;
|
225
|
-
event_store.client.shared.Empty no_stream = 3;
|
226
|
-
event_store.client.shared.Empty any = 4;
|
227
|
-
event_store.client.shared.Empty stream_exists = 5;
|
228
|
-
}
|
229
|
-
}
|
230
|
-
}
|
231
|
-
|
232
|
-
message TombstoneResp {
|
233
|
-
oneof position_option {
|
234
|
-
Position position = 1;
|
235
|
-
event_store.client.shared.Empty no_position = 2;
|
236
|
-
}
|
237
|
-
|
238
|
-
message Position {
|
239
|
-
uint64 commit_position = 1;
|
240
|
-
uint64 prepare_position = 2;
|
241
|
-
}
|
242
|
-
}
|
@@ -1,119 +0,0 @@
|
|
1
|
-
syntax = "proto3";
|
2
|
-
package event_store.client.users;
|
3
|
-
option java_package = "com.eventstore.dbclient.proto.users";
|
4
|
-
|
5
|
-
service Users {
|
6
|
-
rpc Create (CreateReq) returns (CreateResp);
|
7
|
-
rpc Update (UpdateReq) returns (UpdateResp);
|
8
|
-
rpc Delete (DeleteReq) returns (DeleteResp);
|
9
|
-
rpc Disable (DisableReq) returns (DisableResp);
|
10
|
-
rpc Enable (EnableReq) returns (EnableResp);
|
11
|
-
rpc Details (DetailsReq) returns (stream DetailsResp);
|
12
|
-
rpc ChangePassword (ChangePasswordReq) returns (ChangePasswordResp);
|
13
|
-
rpc ResetPassword (ResetPasswordReq) returns (ResetPasswordResp);
|
14
|
-
}
|
15
|
-
|
16
|
-
message CreateReq {
|
17
|
-
Options options = 1;
|
18
|
-
message Options {
|
19
|
-
string login_name = 1;
|
20
|
-
string password = 2;
|
21
|
-
string full_name = 3;
|
22
|
-
repeated string groups = 4;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
message CreateResp {
|
27
|
-
|
28
|
-
}
|
29
|
-
|
30
|
-
message UpdateReq {
|
31
|
-
Options options = 1;
|
32
|
-
message Options {
|
33
|
-
string login_name = 1;
|
34
|
-
string password = 2;
|
35
|
-
string full_name = 3;
|
36
|
-
repeated string groups = 4;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
message UpdateResp {
|
41
|
-
|
42
|
-
}
|
43
|
-
|
44
|
-
message DeleteReq {
|
45
|
-
Options options = 1;
|
46
|
-
message Options {
|
47
|
-
string login_name = 1;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
message DeleteResp {
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
message EnableReq {
|
56
|
-
Options options = 1;
|
57
|
-
message Options {
|
58
|
-
string login_name = 1;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
message EnableResp {
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
message DisableReq {
|
67
|
-
Options options = 1;
|
68
|
-
message Options {
|
69
|
-
string login_name = 1;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
message DisableResp {
|
74
|
-
}
|
75
|
-
|
76
|
-
message DetailsReq {
|
77
|
-
Options options = 1;
|
78
|
-
message Options {
|
79
|
-
string login_name = 1;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
message DetailsResp {
|
84
|
-
UserDetails user_details = 1;
|
85
|
-
message UserDetails {
|
86
|
-
string login_name = 1;
|
87
|
-
string full_name = 2;
|
88
|
-
repeated string groups = 3;
|
89
|
-
DateTime last_updated = 4;
|
90
|
-
bool disabled = 5;
|
91
|
-
|
92
|
-
message DateTime {
|
93
|
-
int64 ticks_since_epoch = 1;
|
94
|
-
}
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
message ChangePasswordReq {
|
99
|
-
Options options = 1;
|
100
|
-
message Options {
|
101
|
-
string login_name = 1;
|
102
|
-
string current_password = 2;
|
103
|
-
string new_password = 3;
|
104
|
-
}
|
105
|
-
}
|
106
|
-
|
107
|
-
message ChangePasswordResp {
|
108
|
-
}
|
109
|
-
|
110
|
-
message ResetPasswordReq {
|
111
|
-
Options options = 1;
|
112
|
-
message Options {
|
113
|
-
string login_name = 1;
|
114
|
-
string new_password = 2;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
message ResetPasswordResp {
|
119
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
### GRPC adapter
|
2
|
-
|
3
|
-
This adapter targets the EventstoreDB version `>= "20.*"
|
4
|
-
|
5
|
-
### Configuration
|
6
|
-
|
7
|
-
As by default EventStoreClient uses GRPC adapter. No need to configure anything if you want to use it,
|
8
|
-
however to set it explicitly, place the snippet below in your initializer or when you boot your application.
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
require 'event_store_client/adapters/grpc'
|
12
|
-
|
13
|
-
EventStoreClient.configure do |config|
|
14
|
-
config.adapter = :grpc
|
15
|
-
end
|
16
|
-
```
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/persistent_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/persistent_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/settings_schema'
|
9
|
-
|
10
|
-
module EventStoreClient
|
11
|
-
module GRPC
|
12
|
-
module Commands
|
13
|
-
module PersistentSubscriptions
|
14
|
-
class Create < Command
|
15
|
-
use_request EventStore::Client::PersistentSubscriptions::CreateReq
|
16
|
-
use_service EventStore::Client::PersistentSubscriptions::PersistentSubscriptions::Stub
|
17
|
-
|
18
|
-
# Creates persistent subscription in a given group
|
19
|
-
# @param [String] name of the stream to subscribe
|
20
|
-
# @param [String] name of the subscription group
|
21
|
-
# @param [Hash] options - additional settings to be set on subscription.
|
22
|
-
# Refer to SettingsSchema for detailed attributes allowed
|
23
|
-
# @return [Dry::Monads::Result::Success, Dry::Monads::Result::Failure]
|
24
|
-
#
|
25
|
-
def call(stream, group, options: {})
|
26
|
-
schema = SettingsSchema.call(options)
|
27
|
-
return Failure(schema.errors) if schema.failure?
|
28
|
-
opts =
|
29
|
-
{
|
30
|
-
stream_identifier: {
|
31
|
-
streamName: stream
|
32
|
-
},
|
33
|
-
group_name: group,
|
34
|
-
settings: schema.to_h
|
35
|
-
}
|
36
|
-
|
37
|
-
service.create(request.new(options: opts), metadata: metadata)
|
38
|
-
Success()
|
39
|
-
rescue ::GRPC::AlreadyExists
|
40
|
-
Failure(:conflict)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/persistent_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/persistent_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
|
9
|
-
module EventStoreClient
|
10
|
-
module GRPC
|
11
|
-
module Commands
|
12
|
-
module PersistentSubscriptions
|
13
|
-
class Delete < Command
|
14
|
-
use_request EventStore::Client::PersistentSubscriptions::DeleteReq
|
15
|
-
use_service EventStore::Client::PersistentSubscriptions::PersistentSubscriptions::Stub
|
16
|
-
|
17
|
-
def call(stream, group)
|
18
|
-
opts =
|
19
|
-
{
|
20
|
-
stream_identifier: {
|
21
|
-
streamName: stream
|
22
|
-
},
|
23
|
-
group_name: group
|
24
|
-
}
|
25
|
-
service.delete(request.new(options: opts), metadata: metadata)
|
26
|
-
Success()
|
27
|
-
rescue ::GRPC::NotFound
|
28
|
-
Failure(:not_found)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/persistent_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/persistent_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/settings_schema'
|
9
|
-
require 'irb'
|
10
|
-
module EventStoreClient
|
11
|
-
module GRPC
|
12
|
-
module Commands
|
13
|
-
module PersistentSubscriptions
|
14
|
-
class Read < Command
|
15
|
-
use_request EventStore::Client::PersistentSubscriptions::ReadReq
|
16
|
-
use_service EventStore::Client::PersistentSubscriptions::PersistentSubscriptions::Stub
|
17
|
-
|
18
|
-
# Read given persistent subscription
|
19
|
-
# @param [String] name of the stream to subscribe
|
20
|
-
# @param [String] name of the subscription group
|
21
|
-
# @param [Hash] options - additional settings to be set on subscription.
|
22
|
-
# Refer to SettingsSchema for detailed attributes allowed
|
23
|
-
# @return [Dry::Monads::Result::Success, Dry::Monads::Result::Failure]
|
24
|
-
#
|
25
|
-
def call(stream, group, options: {})
|
26
|
-
count = options[:count].to_i
|
27
|
-
opts =
|
28
|
-
{
|
29
|
-
stream_identifier: {
|
30
|
-
streamName: stream
|
31
|
-
},
|
32
|
-
buffer_size: count,
|
33
|
-
group_name: group,
|
34
|
-
uuid_option: {
|
35
|
-
structured: {}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
requests = [request.new(options: opts)] # please notice that it's an array. Should be?
|
40
|
-
|
41
|
-
skip_decryption = options[:skip_decryption] || false
|
42
|
-
service.read(requests, metadata: metadata).each do |res|
|
43
|
-
next if res.subscription_confirmation
|
44
|
-
yield deserialize_event(res.event.event, skip_decryption: skip_decryption) if block_given?
|
45
|
-
end
|
46
|
-
Success()
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def deserialize_event(entry, skip_decryption: false)
|
52
|
-
id = entry.id.string
|
53
|
-
id = SecureRandom.uuid if id.nil? || id.empty?
|
54
|
-
|
55
|
-
data = (entry.data.nil? || entry.data.empty?) ? '{}' : entry.data
|
56
|
-
|
57
|
-
metadata =
|
58
|
-
JSON.parse(entry.custom_metadata || '{}').merge(
|
59
|
-
entry.metadata.to_h || {}
|
60
|
-
).to_json
|
61
|
-
|
62
|
-
config.mapper.deserialize(
|
63
|
-
EventStoreClient::Event.new(
|
64
|
-
id: id,
|
65
|
-
title: "#{entry.stream_revision}@#{entry.stream_identifier.streamName}",
|
66
|
-
type: entry.metadata['type'],
|
67
|
-
data: data,
|
68
|
-
metadata: metadata
|
69
|
-
),
|
70
|
-
skip_decryption: skip_decryption
|
71
|
-
)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/settings_schema.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/persistent_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/persistent_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
|
9
|
-
module EventStoreClient
|
10
|
-
module GRPC
|
11
|
-
module Commands
|
12
|
-
module PersistentSubscriptions
|
13
|
-
# Ensures the proper format of the parameters passed to the subscirption request
|
14
|
-
#
|
15
|
-
SettingsSchema = Dry::Schema.Params do
|
16
|
-
optional(:resolve_links).value(Dry::Types['bool'].default(true))
|
17
|
-
optional(:revision).value(Dry::Types['integer'])
|
18
|
-
optional(:extra_statistics).value(Dry::Types['bool'])
|
19
|
-
optional(:max_retry_count).value(Dry::Types['integer'])
|
20
|
-
optional(:min_checkpoint_count).value(Dry::Types['integer'])
|
21
|
-
optional(:max_checkpoint_count).value(Dry::Types['integer'])
|
22
|
-
optional(:max_subscriber_count).value(Dry::Types['integer'])
|
23
|
-
optional(:live_buffer_size).value(Dry::Types['integer'])
|
24
|
-
optional(:read_batch_size).value(Dry::Types['integer'])
|
25
|
-
optional(:history_buffer_size).value(Dry::Types['integer'].default(500))
|
26
|
-
optional(:message_timeout_ms).value(Dry::Types['integer'].default(10_000))
|
27
|
-
# optional(:message_timeout_ticks).value(Dry::Types['integer'].default(10000))
|
28
|
-
|
29
|
-
optional(:checkpoint_after_ms).value(Dry::Types['integer'].default(1000))
|
30
|
-
optional(:named_consumer_strategy).value(
|
31
|
-
Dry::Types['symbol'].default(:RoundRobin),
|
32
|
-
included_in?: %i[DispatchToSingle RoundRobin Pinned]
|
33
|
-
)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/persistent_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/persistent_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/settings_schema'
|
9
|
-
|
10
|
-
module EventStoreClient
|
11
|
-
module GRPC
|
12
|
-
module Commands
|
13
|
-
module PersistentSubscriptions
|
14
|
-
class Update < Command
|
15
|
-
use_request EventStore::Client::PersistentSubscriptions::UpdateReq
|
16
|
-
use_service EventStore::Client::PersistentSubscriptions::PersistentSubscriptions::Stub
|
17
|
-
|
18
|
-
# Creates persistent subscription in a given group
|
19
|
-
# @param [String] name of the subscription stream to update
|
20
|
-
# @param [String] name of the subscription group
|
21
|
-
# @param [Hash] options - additional settings to be set on subscription.
|
22
|
-
# Refer to EventStoreClient::GRPC::Commands::SettingsSchema
|
23
|
-
# for detailed attributes schema
|
24
|
-
# @return [Dry::Monads::Result::Success, Dry::Monads::Result::Failure]
|
25
|
-
#
|
26
|
-
def call(stream, group, options: {})
|
27
|
-
schema = SettingsSchema.call(options)
|
28
|
-
return Failure(schema.errors) if schema.failure?
|
29
|
-
|
30
|
-
opts =
|
31
|
-
{
|
32
|
-
stream_identifier: {
|
33
|
-
streamName: stream
|
34
|
-
},
|
35
|
-
group_name: group,
|
36
|
-
settings: schema.to_h
|
37
|
-
}
|
38
|
-
service.update(request.new(options: opts), metadata: metadata)
|
39
|
-
Success()
|
40
|
-
rescue ::GRPC::Unknown => e
|
41
|
-
return Failure(:not_found) if e.message.include?('DoesNotExist')
|
42
|
-
raise e
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/projections_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/projections_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
|
9
|
-
module EventStoreClient
|
10
|
-
module GRPC
|
11
|
-
module Commands
|
12
|
-
module Projections
|
13
|
-
class Create < Command
|
14
|
-
use_request EventStore::Client::Projections::CreateReq
|
15
|
-
use_service EventStore::Client::Projections::Projections::Stub
|
16
|
-
|
17
|
-
def call(name, streams)
|
18
|
-
data = <<~STRING
|
19
|
-
fromStreams(#{streams})
|
20
|
-
.when({
|
21
|
-
$any: function(s,e) {
|
22
|
-
linkTo("#{name}", e)
|
23
|
-
}
|
24
|
-
})
|
25
|
-
STRING
|
26
|
-
|
27
|
-
options =
|
28
|
-
{
|
29
|
-
query: data,
|
30
|
-
continuous: {
|
31
|
-
name: name,
|
32
|
-
track_emitted_streams: true
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
res = Try do
|
37
|
-
service.create(request.new(options: options), metadata: metadata)
|
38
|
-
end
|
39
|
-
|
40
|
-
res.error? ? res.to_result : Success()
|
41
|
-
rescue ::GRPC::Unknown => e
|
42
|
-
Failure(:conflict) if e.message.include?('Conflict')
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'grpc'
|
4
|
-
require 'event_store_client/adapters/grpc/generated/projections_pb.rb'
|
5
|
-
require 'event_store_client/adapters/grpc/generated/projections_services_pb.rb'
|
6
|
-
|
7
|
-
require 'event_store_client/adapters/grpc/commands/command'
|
8
|
-
|
9
|
-
module EventStoreClient
|
10
|
-
module GRPC
|
11
|
-
module Commands
|
12
|
-
module Projections
|
13
|
-
class Delete < Command
|
14
|
-
use_request EventStore::Client::Projections::DeleteReq
|
15
|
-
use_service EventStore::Client::Projections::Projections::Stub
|
16
|
-
|
17
|
-
def call(name, options: {})
|
18
|
-
opts = {
|
19
|
-
name: name,
|
20
|
-
delete_emitted_streams: true,
|
21
|
-
delete_state_stream: true,
|
22
|
-
delete_checkpoint_stream: true
|
23
|
-
}.merge(options)
|
24
|
-
|
25
|
-
service.delete(request.new(options: opts), metadata: metadata)
|
26
|
-
Success()
|
27
|
-
rescue ::GRPC::Unknown => e
|
28
|
-
Failure(:not_found) if e.message.include?('OperationFailed')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|