event_store_client 0.2.8 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -37
  3. data/lib/event_store_client.rb +0 -2
  4. data/lib/event_store_client/adapters/grpc.rb +21 -0
  5. data/lib/event_store_client/adapters/grpc/Protos/cluster.proto +149 -0
  6. data/lib/event_store_client/adapters/grpc/Protos/gossip.proto +44 -0
  7. data/lib/event_store_client/adapters/grpc/Protos/operations.proto +45 -0
  8. data/lib/event_store_client/adapters/grpc/Protos/persistent.proto +180 -0
  9. data/lib/event_store_client/adapters/grpc/Protos/projections.proto +174 -0
  10. data/lib/event_store_client/adapters/grpc/Protos/shared.proto +22 -0
  11. data/lib/event_store_client/adapters/grpc/Protos/streams.proto +242 -0
  12. data/lib/event_store_client/adapters/grpc/Protos/users.proto +119 -0
  13. data/lib/event_store_client/adapters/grpc/client.rb +119 -0
  14. data/lib/event_store_client/adapters/grpc/command_registrar.rb +32 -0
  15. data/lib/event_store_client/adapters/grpc/commands/command.rb +43 -0
  16. data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/create.rb +46 -0
  17. data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/delete.rb +34 -0
  18. data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/read.rb +65 -0
  19. data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/settings_schema.rb +38 -0
  20. data/lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/update.rb +48 -0
  21. data/lib/event_store_client/adapters/grpc/commands/projections/create.rb +45 -0
  22. data/lib/event_store_client/adapters/grpc/commands/projections/delete.rb +34 -0
  23. data/lib/event_store_client/adapters/grpc/commands/projections/update.rb +42 -0
  24. data/lib/event_store_client/adapters/grpc/commands/streams/append.rb +61 -0
  25. data/lib/event_store_client/adapters/grpc/commands/streams/delete.rb +35 -0
  26. data/lib/event_store_client/adapters/grpc/commands/streams/link_to.rb +61 -0
  27. data/lib/event_store_client/adapters/grpc/commands/streams/read.rb +80 -0
  28. data/lib/event_store_client/adapters/grpc/commands/streams/read_all.rb +43 -0
  29. data/lib/event_store_client/adapters/grpc/commands/streams/tombstone.rb +35 -0
  30. data/lib/event_store_client/adapters/grpc/connection.rb +50 -0
  31. data/lib/event_store_client/adapters/grpc/generated/cluster_pb.rb +140 -0
  32. data/lib/event_store_client/adapters/grpc/generated/cluster_services_pb.rb +46 -0
  33. data/lib/event_store_client/adapters/grpc/generated/gossip_pb.rb +53 -0
  34. data/lib/event_store_client/adapters/grpc/generated/gossip_services_pb.rb +26 -0
  35. data/lib/event_store_client/adapters/grpc/generated/operations_pb.rb +49 -0
  36. data/lib/event_store_client/adapters/grpc/generated/operations_services_pb.rb +31 -0
  37. data/lib/event_store_client/adapters/grpc/generated/persistent_pb.rb +213 -0
  38. data/lib/event_store_client/adapters/grpc/generated/persistent_services_pb.rb +29 -0
  39. data/lib/event_store_client/adapters/grpc/generated/projections_pb.rb +193 -0
  40. data/lib/event_store_client/adapters/grpc/generated/projections_services_pb.rb +34 -0
  41. data/lib/event_store_client/adapters/grpc/generated/shared_pb.rb +35 -0
  42. data/lib/event_store_client/adapters/grpc/generated/streams_pb.rb +283 -0
  43. data/lib/event_store_client/adapters/grpc/generated/streams_services_pb.rb +29 -0
  44. data/lib/event_store_client/adapters/grpc/generated/users_pb.rb +126 -0
  45. data/lib/event_store_client/adapters/grpc/generated/users_services_pb.rb +33 -0
  46. data/lib/event_store_client/adapters/http.rb +16 -0
  47. data/lib/event_store_client/adapters/http/README.md +16 -0
  48. data/lib/event_store_client/adapters/http/client.rb +160 -0
  49. data/lib/event_store_client/adapters/http/commands/command.rb +27 -0
  50. data/lib/event_store_client/adapters/http/commands/persistent_subscriptions/ack.rb +15 -0
  51. data/lib/event_store_client/adapters/http/commands/persistent_subscriptions/create.rb +31 -0
  52. data/lib/event_store_client/adapters/http/commands/persistent_subscriptions/read.rb +57 -0
  53. data/lib/event_store_client/adapters/http/commands/projections/create.rb +30 -0
  54. data/lib/event_store_client/adapters/http/commands/streams/append.rb +49 -0
  55. data/lib/event_store_client/adapters/http/commands/streams/delete.rb +16 -0
  56. data/lib/event_store_client/adapters/http/commands/streams/link_to.rb +49 -0
  57. data/lib/event_store_client/adapters/http/commands/streams/read.rb +53 -0
  58. data/lib/event_store_client/adapters/http/commands/streams/tombstone.rb +17 -0
  59. data/lib/event_store_client/adapters/http/connection.rb +46 -0
  60. data/lib/event_store_client/adapters/http/request_method.rb +28 -0
  61. data/lib/event_store_client/adapters/in_memory.rb +142 -0
  62. data/lib/event_store_client/broker.rb +16 -5
  63. data/lib/event_store_client/client.rb +18 -72
  64. data/lib/event_store_client/configuration.rb +28 -14
  65. data/lib/event_store_client/data_decryptor.rb +13 -8
  66. data/lib/event_store_client/data_encryptor.rb +7 -6
  67. data/lib/event_store_client/deserialized_event.rb +10 -1
  68. data/lib/event_store_client/event.rb +2 -2
  69. data/lib/event_store_client/mapper/default.rb +0 -1
  70. data/lib/event_store_client/serializer/json.rb +2 -0
  71. data/lib/event_store_client/subscriptions.rb +4 -13
  72. data/lib/event_store_client/types.rb +3 -1
  73. data/lib/event_store_client/value_objects/read_direction.rb +43 -0
  74. data/lib/event_store_client/version.rb +1 -1
  75. metadata +97 -15
  76. data/lib/event_store_client/store_adapter.rb +0 -10
  77. data/lib/event_store_client/store_adapter/api/client.rb +0 -224
  78. data/lib/event_store_client/store_adapter/api/connection.rb +0 -43
  79. data/lib/event_store_client/store_adapter/api/request_method.rb +0 -30
  80. data/lib/event_store_client/store_adapter/in_memory.rb +0 -160
@@ -0,0 +1,174 @@
1
+ syntax = "proto3";
2
+ package event_store.client.projections;
3
+ option java_package = "com.eventstore.dbclient.proto.projections";
4
+
5
+ import "google/protobuf/struct.proto";
6
+ import "shared.proto";
7
+
8
+ service Projections {
9
+ rpc Create (CreateReq) returns (CreateResp);
10
+ rpc Update (UpdateReq) returns (UpdateResp);
11
+ rpc Delete (DeleteReq) returns (DeleteResp);
12
+ rpc Statistics (StatisticsReq) returns (stream StatisticsResp);
13
+ rpc Disable (DisableReq) returns (DisableResp);
14
+ rpc Enable (EnableReq) returns (EnableResp);
15
+ rpc Reset (ResetReq) returns (ResetResp);
16
+ rpc State (StateReq) returns (StateResp);
17
+ rpc Result (ResultReq) returns (ResultResp);
18
+ rpc RestartSubsystem (event_store.client.shared.Empty) returns (event_store.client.shared.Empty);
19
+ }
20
+
21
+ message CreateReq {
22
+ Options options = 1;
23
+
24
+ message Options {
25
+ oneof mode {
26
+ event_store.client.shared.Empty one_time = 1;
27
+ Transient transient = 2;
28
+ Continuous continuous = 3;
29
+ }
30
+ string query = 4;
31
+
32
+ message Transient {
33
+ string name = 1;
34
+ }
35
+ message Continuous {
36
+ string name = 1;
37
+ bool track_emitted_streams = 2;
38
+ }
39
+ }
40
+ }
41
+
42
+ message CreateResp {
43
+ }
44
+
45
+ message UpdateReq {
46
+ Options options = 1;
47
+
48
+ message Options {
49
+ string name = 1;
50
+ string query = 2;
51
+ oneof emit_option {
52
+ bool emit_enabled = 3;
53
+ event_store.client.shared.Empty no_emit_options = 4;
54
+ }
55
+ }
56
+ }
57
+
58
+ message UpdateResp {
59
+ }
60
+
61
+ message DeleteReq {
62
+ Options options = 1;
63
+
64
+ message Options {
65
+ string name = 1;
66
+ bool delete_emitted_streams = 2;
67
+ bool delete_state_stream = 3;
68
+ bool delete_checkpoint_stream = 4;
69
+ }
70
+ }
71
+
72
+ message DeleteResp {
73
+ }
74
+
75
+ message StatisticsReq {
76
+ Options options = 1;
77
+ message Options {
78
+ oneof mode {
79
+ string name = 1;
80
+ event_store.client.shared.Empty all = 2;
81
+ event_store.client.shared.Empty transient = 3;
82
+ event_store.client.shared.Empty continuous = 4;
83
+ event_store.client.shared.Empty one_time = 5;
84
+ }
85
+ }
86
+ }
87
+
88
+ message StatisticsResp {
89
+ Details details = 1;
90
+
91
+ message Details {
92
+ int64 coreProcessingTime = 1;
93
+ int64 version = 2;
94
+ int64 epoch = 3;
95
+ string effectiveName = 4;
96
+ int32 writesInProgress = 5;
97
+ int32 readsInProgress = 6;
98
+ int32 partitionsCached = 7;
99
+ string status = 8;
100
+ string stateReason = 9;
101
+ string name = 10;
102
+ string mode = 11;
103
+ string position = 12;
104
+ float progress = 13;
105
+ string lastCheckpoint = 14;
106
+ int64 eventsProcessedAfterRestart = 15;
107
+ string checkpointStatus = 16;
108
+ int64 bufferedEvents = 17;
109
+ int32 writePendingEventsBeforeCheckpoint = 18;
110
+ int32 writePendingEventsAfterCheckpoint = 19;
111
+ }
112
+ }
113
+
114
+ message StateReq {
115
+ Options options = 1;
116
+
117
+ message Options {
118
+ string name = 1;
119
+ string partition = 2;
120
+ }
121
+ }
122
+
123
+ message StateResp {
124
+ google.protobuf.Value state = 1;
125
+ }
126
+
127
+ message ResultReq {
128
+ Options options = 1;
129
+
130
+ message Options {
131
+ string name = 1;
132
+ string partition = 2;
133
+ }
134
+ }
135
+
136
+ message ResultResp {
137
+ google.protobuf.Value result = 1;
138
+ }
139
+
140
+ message ResetReq {
141
+ Options options = 1;
142
+
143
+ message Options {
144
+ string name = 1;
145
+ bool write_checkpoint = 2;
146
+ }
147
+ }
148
+
149
+ message ResetResp {
150
+ }
151
+
152
+
153
+ message EnableReq {
154
+ Options options = 1;
155
+
156
+ message Options {
157
+ string name = 1;
158
+ }
159
+ }
160
+
161
+ message EnableResp {
162
+ }
163
+
164
+ message DisableReq {
165
+ Options options = 1;
166
+
167
+ message Options {
168
+ string name = 1;
169
+ bool write_checkpoint = 2;
170
+ }
171
+ }
172
+
173
+ message DisableResp {
174
+ }
@@ -0,0 +1,22 @@
1
+ syntax = "proto3";
2
+ package event_store.client.shared;
3
+ option java_package = "com.eventstore.dbclient.proto.shared";
4
+
5
+ message UUID {
6
+ oneof value {
7
+ Structured structured = 1;
8
+ string string = 2;
9
+ }
10
+
11
+ message Structured {
12
+ int64 most_significant_bits = 1;
13
+ int64 least_significant_bits = 2;
14
+ }
15
+ }
16
+ message Empty {
17
+ }
18
+
19
+ message StreamIdentifier {
20
+ reserved 1 to 2;
21
+ bytes streamName = 3;
22
+ }
@@ -0,0 +1,242 @@
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
+ }
@@ -0,0 +1,119 @@
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
+ }