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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 187957f17bc4b5456a597e4571b63b76c62c6f0ed2587932e91b89501ac99f24
4
- data.tar.gz: 26a9d0983dded6a509aa9eaad683e238566fae621b13d1e33d602d00fbe85aef
3
+ metadata.gz: 85daf0871fa6854104f3a8d60ed70eb772097d715cf0c6bf2075757b92642ca9
4
+ data.tar.gz: 2708541aade94beb60a8acc430ab1482e8d47f007f1afbd8853d8cd9f2ed8354
5
5
  SHA512:
6
- metadata.gz: aaadb87d8986fb6c80c350aa191c0233150c51d34e4744540ebab203da9402b73890127b9e2b8bfb511a92a212bb0b5728378113ef7c6f33727de4f31b6d906d
7
- data.tar.gz: d1d480a4eaea4ba29155c7c19860eed356b90c93f50cff5a754473c947223c15233c8325dc8a101f8c8abd0621a419e02a4c86749cdab8ccf983210c6d68a02a
6
+ metadata.gz: 3f86262fe6d9e7669199967e2002852a09bf4950b36c8628ec6244fe79589e5d8c82f2af33b8eb37a5c9946988536f2de0f1244c7f350ecb98060c7e85e5342d
7
+ data.tar.gz: 1788aa456ffd3aef91b37b27f40baa0c01d04857df425e3eabd56ca4e95163dc8640beac763b4ec9df4f988da8007ef37311b50e3d2d70e6706dccc9f4c1feba
data/README.md CHANGED
@@ -5,6 +5,12 @@
5
5
 
6
6
  An easy-to use API client for connecting ruby applications with https://eventstore.org/
7
7
 
8
+ ## Supported adapters
9
+
10
+ - GRPC - default
11
+ - [HTTP](https://github.com/yousty/event_store_client/tree/master/lib/event_store_client/adapters/http/README.md) - Deprecated
12
+ - Memory - for testing
13
+
8
14
  ## Installation
9
15
  Add this line to your application's Gemfile:
10
16
 
@@ -24,6 +30,8 @@ $ gem install event_store_client
24
30
 
25
31
  ## Usage
26
32
 
33
+ Before you start, make sure you have a running EventStoreDB instance on your machine
34
+
27
35
  ### EventStore engine setup
28
36
 
29
37
  1. Download Event Store From https://eventstore.org/downloads/ or docker
@@ -32,33 +40,13 @@ $ gem install event_store_client
32
40
 
33
41
  2. Run the Event Store server
34
42
 
35
- `docker run --name eventstore -it -p 2113:2113 -p 1113:1113 eventstore/eventstore`
36
-
37
- 3. Set Basic HTTP auth enviornment variables #below are defaults
38
- - export EVENT_STORE_USER=admin
39
- - export EVENT_STORE_PASSWORD=changeit
43
+ `docker run --env EVENTSTORE_INSECURE=true --name eventstore -it -p 2113:2113 -p 1113:1113 eventstore/eventstore`
40
44
 
41
- Ref: https://eventstore.org/docs/http-api/security
42
-
43
- 4. Login to admin panel http://localhost:2113 and enable Projections for Event-Types
44
-
45
- ### Configure EventStoreClient
46
-
47
- Before you start, add this to the `initializer` or to the top of your script:
48
-
49
- `EventStoreClient.configure`
50
-
51
- For testing, you can use the InMemory adapter. To do it you should change the configuration.
52
-
53
- ```ruby
54
- EventStoreClient.configure do |config|
55
- config.adapter = EventStoreClient::StoreAdapter::InMemory.new(host: 'http://localhost', port: '2113')
56
- end
57
- ```
45
+ 4. Visit the admin panel http://localhost:2113 and enable Projections for Event-Types
58
46
 
59
47
  ### Create Dummy event and dummy Handler
60
48
 
61
- To test out the behavior, you'll need a sample event and handler to work with:
49
+ To test out the behavior, you'll need a sample event and event handler to work with:
62
50
 
63
51
  ```ruby
64
52
 
@@ -83,7 +71,7 @@ with an event being passed as an argument.
83
71
 
84
72
  ```ruby
85
73
  class DummyHandler
86
- def self.call(event)
74
+ def call(event)
87
75
  puts "Handled #{event.class.name}"
88
76
  end
89
77
  end
@@ -110,7 +98,7 @@ events = client.read('newstream')
110
98
  **Changing reading direction**
111
99
 
112
100
  ```ruby
113
- events = client.read('newstream', direction: 'backward') #default 'forward'
101
+ events = client.read('newstream', direction: 'backwards') #default 'forwards'
114
102
  ```
115
103
 
116
104
  **Reading all events from a stream**
@@ -122,12 +110,12 @@ events = client.read('newstream', all: true) #default 'false'
122
110
  ### Subscribing to events
123
111
 
124
112
  ```ruby
125
- client.subscribe(DummyHandler, to: [SomethingHappened])
113
+ client.subscribe(DummyHandler.new, to: [SomethingHappened])
126
114
 
127
- # now try to publish several events
115
+ # Now In another terminal seesion try to publish several events
128
116
  10.times { client.publish(stream: 'newstream', events: [event]) }
129
117
 
130
- You can also publish multiple events at once
118
+ # You can also publish multiple events at once
131
119
 
132
120
  events = (1..10).map { event }
133
121
  client.publish(stream: 'newstream', events: events)
@@ -141,22 +129,24 @@ client.publish(stream: 'newstream', events: events)
141
129
  client.stop_polling
142
130
  ```
143
131
 
144
- ### Linking existing events to the streem
132
+ ### Configure EventStoreClient
133
+
134
+ Before you start, add this to the `initializer` or to the top of your script:
145
135
 
146
- Event to be linked properly has to coantians original event id.
147
- Real events could be mixed with linked events in the same stream.
136
+ For testing, you can use the InMemory adapter. To do it you should change the configuration.
148
137
 
149
138
  ```ruby
150
- exisiting_event1 = client.read('newstream').last
151
- client.link_to(stream: 'anotherstream', events: [exisiting_event1, ...])
139
+ EventStoreClient.configure do |config|
140
+ config.adapter = EventStoreClient::InMemory.new(host: 'http://localhost', port: '2113')
141
+ end
152
142
  ```
153
143
 
154
- When you read from stream where links are placed. By default Event Store Client always resolve links for you returning the event that points to the link. You can use the ES-ResolveLinkTos: false HTTP header during readin stream to tell Event Store Client to return you the actual link and to not resolve it.
155
- More info: [ES-ResolveLinkTos](https://eventstore.org/docs/http-api/optional-http-headers/resolve-linkto/index.html?tabs=tabid-1%2Ctabid-3).
156
-
157
144
  ## Event Mappers
158
145
 
159
- We offer two types of mappers - default and encrypted.
146
+ At the moment we offer two types of mappers:
147
+
148
+ - default
149
+ - encrypted
160
150
 
161
151
  ### Default Mapper
162
152
 
@@ -12,8 +12,6 @@ require 'event_store_client/mapper'
12
12
 
13
13
  require 'event_store_client/configuration'
14
14
 
15
- require 'event_store_client/store_adapter'
16
-
17
15
  require 'event_store_client/subscription'
18
16
  require 'event_store_client/subscriptions'
19
17
  require 'event_store_client/broker'
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'event_store_client/value_objects/read_direction.rb'
4
+
5
+ require 'event_store_client/adapters/grpc/commands/streams/append'
6
+ require 'event_store_client/adapters/grpc/commands/streams/delete'
7
+ require 'event_store_client/adapters/grpc/commands/streams/link_to'
8
+ require 'event_store_client/adapters/grpc/commands/streams/read'
9
+ require 'event_store_client/adapters/grpc/commands/streams/read_all'
10
+ require 'event_store_client/adapters/grpc/commands/streams/tombstone'
11
+
12
+ require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/create'
13
+ require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/update'
14
+ require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/delete'
15
+ require 'event_store_client/adapters/grpc/commands/persistent_subscriptions/read'
16
+
17
+ require 'event_store_client/adapters/grpc/commands/projections/create'
18
+ require 'event_store_client/adapters/grpc/commands/projections/update'
19
+ require 'event_store_client/adapters/grpc/commands/projections/delete'
20
+
21
+ require 'event_store_client/adapters/grpc/client'
@@ -0,0 +1,149 @@
1
+ syntax = "proto3";
2
+ package event_store.cluster;
3
+ option java_package = "com.eventstore.dbclient.proto.cluster";
4
+
5
+ import "shared.proto";
6
+
7
+ service Gossip {
8
+ rpc Update (GossipRequest) returns (ClusterInfo);
9
+ rpc Read (event_store.client.shared.Empty) returns (ClusterInfo);
10
+ }
11
+
12
+ service Elections {
13
+ rpc ViewChange (ViewChangeRequest) returns (event_store.client.shared.Empty);
14
+ rpc ViewChangeProof (ViewChangeProofRequest) returns (event_store.client.shared.Empty);
15
+ rpc Prepare (PrepareRequest) returns (event_store.client.shared.Empty);
16
+ rpc PrepareOk (PrepareOkRequest) returns (event_store.client.shared.Empty);
17
+ rpc Proposal (ProposalRequest) returns (event_store.client.shared.Empty);
18
+ rpc Accept (AcceptRequest) returns (event_store.client.shared.Empty);
19
+
20
+ rpc LeaderIsResigning (LeaderIsResigningRequest) returns (event_store.client.shared.Empty);
21
+ rpc LeaderIsResigningOk (LeaderIsResigningOkRequest) returns (event_store.client.shared.Empty);
22
+ }
23
+
24
+ message GossipRequest {
25
+ ClusterInfo info = 1;
26
+ EndPoint server = 2;
27
+ }
28
+
29
+ message ViewChangeRequest {
30
+ event_store.client.shared.UUID server_id = 1;
31
+ EndPoint server_http = 2;
32
+ int32 attempted_view = 3;
33
+ }
34
+
35
+ message ViewChangeProofRequest {
36
+ event_store.client.shared.UUID server_id = 1;
37
+ EndPoint server_http = 2;
38
+ int32 installed_view = 3;
39
+ }
40
+
41
+ message PrepareRequest {
42
+ event_store.client.shared.UUID server_id = 1;
43
+ EndPoint server_http = 2;
44
+ int32 view = 3;
45
+ }
46
+
47
+ message PrepareOkRequest {
48
+ int32 view = 1;
49
+ event_store.client.shared.UUID server_id = 2;
50
+ EndPoint server_http = 3;
51
+ int32 epoch_number = 4;
52
+ int64 epoch_position = 5;
53
+ event_store.client.shared.UUID epoch_id = 6;
54
+ event_store.client.shared.UUID epoch_leader_instance_id = 7;
55
+ int64 last_commit_position = 8;
56
+ int64 writer_checkpoint = 9;
57
+ int64 chaser_checkpoint = 10;
58
+ int32 node_priority = 11;
59
+ ClusterInfo cluster_info = 12;
60
+ }
61
+
62
+ message ProposalRequest {
63
+ event_store.client.shared.UUID server_id = 1;
64
+ EndPoint server_http = 2;
65
+ event_store.client.shared.UUID leader_id = 3;
66
+ EndPoint leader_http = 4;
67
+ int32 view = 5;
68
+ int32 epoch_number = 6;
69
+ int64 epoch_position = 7;
70
+ event_store.client.shared.UUID epoch_id = 8;
71
+ event_store.client.shared.UUID epoch_leader_instance_id = 9;
72
+ int64 last_commit_position = 10;
73
+ int64 writer_checkpoint = 11;
74
+ int64 chaser_checkpoint = 12;
75
+ int32 node_priority = 13;
76
+ }
77
+
78
+ message AcceptRequest {
79
+ event_store.client.shared.UUID server_id = 1;
80
+ EndPoint server_http = 2;
81
+ event_store.client.shared.UUID leader_id = 3;
82
+ EndPoint leader_http = 4;
83
+ int32 view = 5;
84
+ }
85
+
86
+ message LeaderIsResigningRequest {
87
+ event_store.client.shared.UUID leader_id = 1;
88
+ EndPoint leader_http = 2;
89
+ }
90
+
91
+ message LeaderIsResigningOkRequest {
92
+ event_store.client.shared.UUID leader_id = 1;
93
+ EndPoint leader_http = 2;
94
+ event_store.client.shared.UUID server_id = 3;
95
+ EndPoint server_http = 4;
96
+ }
97
+
98
+ message ClusterInfo {
99
+ repeated MemberInfo members = 1;
100
+ }
101
+
102
+ message EndPoint {
103
+ string address = 1;
104
+ uint32 port = 2;
105
+ }
106
+
107
+ message MemberInfo {
108
+ enum VNodeState {
109
+ Initializing = 0;
110
+ DiscoverLeader = 1;
111
+ Unknown = 2;
112
+ PreReplica = 3;
113
+ CatchingUp = 4;
114
+ Clone = 5;
115
+ Follower = 6;
116
+ PreLeader = 7;
117
+ Leader = 8;
118
+ Manager = 9;
119
+ ShuttingDown = 10;
120
+ Shutdown = 11;
121
+ ReadOnlyLeaderless = 12;
122
+ PreReadOnlyReplica = 13;
123
+ ReadOnlyReplica = 14;
124
+ ResigningLeader = 15;
125
+ }
126
+ event_store.client.shared.UUID instance_id = 1;
127
+ int64 time_stamp = 2;
128
+ VNodeState state = 3;
129
+ bool is_alive = 4;
130
+ EndPoint http_end_point = 5;
131
+ EndPoint internal_tcp = 6;
132
+ EndPoint external_tcp = 7;
133
+ bool internal_tcp_uses_tls = 8;
134
+ bool external_tcp_uses_tls = 9;
135
+
136
+ int64 last_commit_position = 10;
137
+ int64 writer_checkpoint = 11;
138
+ int64 chaser_checkpoint = 12;
139
+ int64 epoch_position = 13;
140
+ int32 epoch_number = 14;
141
+ event_store.client.shared.UUID epoch_id = 15;
142
+
143
+ int32 node_priority = 16;
144
+ bool is_read_only_replica = 17;
145
+ string advertise_host_to_client_as = 18;
146
+ uint32 advertise_http_port_to_client_as = 19;
147
+ uint32 advertise_tcp_port_to_client_as = 20;
148
+ }
149
+
@@ -0,0 +1,44 @@
1
+ syntax = "proto3";
2
+ package event_store.client.gossip;
3
+ option java_package = "com.eventstore.dbclient.proto.gossip";
4
+
5
+ import "shared.proto";
6
+
7
+ service Gossip {
8
+ rpc Read (event_store.client.shared.Empty) returns (ClusterInfo);
9
+ }
10
+
11
+ message ClusterInfo {
12
+ repeated MemberInfo members = 1;
13
+ }
14
+
15
+ message EndPoint {
16
+ string address = 1;
17
+ uint32 port = 2;
18
+ }
19
+
20
+ message MemberInfo {
21
+ enum VNodeState {
22
+ Initializing = 0;
23
+ DiscoverLeader = 1;
24
+ Unknown = 2;
25
+ PreReplica = 3;
26
+ CatchingUp = 4;
27
+ Clone = 5;
28
+ Follower = 6;
29
+ PreLeader = 7;
30
+ Leader = 8;
31
+ Manager = 9;
32
+ ShuttingDown = 10;
33
+ Shutdown = 11;
34
+ ReadOnlyLeaderless = 12;
35
+ PreReadOnlyReplica = 13;
36
+ ReadOnlyReplica = 14;
37
+ ResigningLeader = 15;
38
+ }
39
+ event_store.client.shared.UUID instance_id = 1;
40
+ int64 time_stamp = 2;
41
+ VNodeState state = 3;
42
+ bool is_alive = 4;
43
+ EndPoint http_end_point = 5;
44
+ }
@@ -0,0 +1,45 @@
1
+ syntax = "proto3";
2
+ package event_store.client.operations;
3
+ option java_package = "com.eventstore.dbclient.proto.operations";
4
+
5
+ import "shared.proto";
6
+
7
+ service Operations {
8
+ rpc StartScavenge (StartScavengeReq) returns (ScavengeResp);
9
+ rpc StopScavenge (StopScavengeReq) returns (ScavengeResp);
10
+ rpc Shutdown (event_store.client.shared.Empty) returns (event_store.client.shared.Empty);
11
+ rpc MergeIndexes (event_store.client.shared.Empty) returns (event_store.client.shared.Empty);
12
+ rpc ResignNode (event_store.client.shared.Empty) returns (event_store.client.shared.Empty);
13
+ rpc SetNodePriority (SetNodePriorityReq) returns (event_store.client.shared.Empty);
14
+ rpc RestartPersistentSubscriptions (event_store.client.shared.Empty) returns (event_store.client.shared.Empty);
15
+ }
16
+
17
+ message StartScavengeReq {
18
+ Options options = 1;
19
+ message Options {
20
+ int32 thread_count = 1;
21
+ int32 start_from_chunk = 2;
22
+ }
23
+ }
24
+
25
+ message StopScavengeReq {
26
+ Options options = 1;
27
+ message Options {
28
+ string scavenge_id = 1;
29
+ }
30
+ }
31
+
32
+ message ScavengeResp {
33
+ string scavenge_id = 1;
34
+ ScavengeResult scavenge_result = 2;
35
+
36
+ enum ScavengeResult {
37
+ Started = 0;
38
+ InProgress = 1;
39
+ Stopped = 2;
40
+ }
41
+ }
42
+
43
+ message SetNodePriorityReq {
44
+ int32 priority = 1;
45
+ }
@@ -0,0 +1,180 @@
1
+ syntax = "proto3";
2
+ package event_store.client.persistent_subscriptions;
3
+ option java_package = "com.eventstore.dbclient.proto.persistentsubscriptions";
4
+
5
+ import "shared.proto";
6
+
7
+ service PersistentSubscriptions {
8
+ rpc Create (CreateReq) returns (CreateResp);
9
+ rpc Update (UpdateReq) returns (UpdateResp);
10
+ rpc Delete (DeleteReq) returns (DeleteResp);
11
+ rpc Read (stream ReadReq) returns (stream ReadResp);
12
+ }
13
+
14
+ message ReadReq {
15
+ oneof content {
16
+ Options options = 1;
17
+ Ack ack = 2;
18
+ Nack nack = 3;
19
+ }
20
+
21
+ message Options {
22
+ event_store.client.shared.StreamIdentifier stream_identifier = 1;
23
+ string group_name = 2;
24
+ int32 buffer_size = 3;
25
+ UUIDOption uuid_option = 4;
26
+
27
+ message UUIDOption {
28
+ oneof content {
29
+ event_store.client.shared.Empty structured = 1;
30
+ event_store.client.shared.Empty string = 2;
31
+ }
32
+ }
33
+ }
34
+
35
+ message Ack {
36
+ bytes id = 1;
37
+ repeated event_store.client.shared.UUID ids = 2;
38
+ }
39
+
40
+ message Nack {
41
+ bytes id = 1;
42
+ repeated event_store.client.shared.UUID ids = 2;
43
+ Action action = 3;
44
+ string reason = 4;
45
+
46
+ enum Action {
47
+ Unknown = 0;
48
+ Park = 1;
49
+ Retry = 2;
50
+ Skip = 3;
51
+ Stop = 4;
52
+ }
53
+ }
54
+ }
55
+
56
+ message ReadResp {
57
+ oneof content {
58
+ ReadEvent event = 1;
59
+ SubscriptionConfirmation subscription_confirmation = 2;
60
+ }
61
+ message ReadEvent {
62
+ RecordedEvent event = 1;
63
+ RecordedEvent link = 2;
64
+ oneof position {
65
+ uint64 commit_position = 3;
66
+ event_store.client.shared.Empty no_position = 4;
67
+ }
68
+ oneof count {
69
+ int32 retry_count = 5;
70
+ event_store.client.shared.Empty no_retry_count = 6;
71
+ }
72
+ message RecordedEvent {
73
+ event_store.client.shared.UUID id = 1;
74
+ event_store.client.shared.StreamIdentifier stream_identifier = 2;
75
+ uint64 stream_revision = 3;
76
+ uint64 prepare_position = 4;
77
+ uint64 commit_position = 5;
78
+ map<string, string> metadata = 6;
79
+ bytes custom_metadata = 7;
80
+ bytes data = 8;
81
+ }
82
+ }
83
+ message SubscriptionConfirmation {
84
+ string subscription_id = 1;
85
+ }
86
+ }
87
+
88
+ message CreateReq {
89
+ Options options = 1;
90
+
91
+ message Options {
92
+ event_store.client.shared.StreamIdentifier stream_identifier = 1;
93
+ string group_name = 2;
94
+ Settings settings = 3;
95
+ }
96
+
97
+ message Settings {
98
+ bool resolve_links = 1;
99
+ uint64 revision = 2;
100
+ bool extra_statistics = 3;
101
+ int32 max_retry_count = 5;
102
+ int32 min_checkpoint_count = 7;
103
+ int32 max_checkpoint_count = 8;
104
+ int32 max_subscriber_count = 9;
105
+ int32 live_buffer_size = 10;
106
+ int32 read_batch_size = 11;
107
+ int32 history_buffer_size = 12;
108
+ ConsumerStrategy named_consumer_strategy = 13;
109
+ oneof message_timeout {
110
+ int64 message_timeout_ticks = 4;
111
+ int32 message_timeout_ms = 14;
112
+ }
113
+ oneof checkpoint_after {
114
+ int64 checkpoint_after_ticks = 6;
115
+ int32 checkpoint_after_ms = 15;
116
+ }
117
+ }
118
+
119
+ enum ConsumerStrategy {
120
+ DispatchToSingle = 0;
121
+ RoundRobin = 1;
122
+ Pinned = 2;
123
+ }
124
+ }
125
+
126
+ message CreateResp {
127
+ }
128
+
129
+ message UpdateReq {
130
+ Options options = 1;
131
+
132
+ message Options {
133
+ event_store.client.shared.StreamIdentifier stream_identifier = 1;
134
+ string group_name = 2;
135
+ Settings settings = 3;
136
+ }
137
+
138
+ message Settings {
139
+ bool resolve_links = 1;
140
+ uint64 revision = 2;
141
+ bool extra_statistics = 3;
142
+ int32 max_retry_count = 5;
143
+ int32 min_checkpoint_count = 7;
144
+ int32 max_checkpoint_count = 8;
145
+ int32 max_subscriber_count = 9;
146
+ int32 live_buffer_size = 10;
147
+ int32 read_batch_size = 11;
148
+ int32 history_buffer_size = 12;
149
+ ConsumerStrategy named_consumer_strategy = 13;
150
+ oneof message_timeout {
151
+ int64 message_timeout_ticks = 4;
152
+ int32 message_timeout_ms = 14;
153
+ }
154
+ oneof checkpoint_after {
155
+ int64 checkpoint_after_ticks = 6;
156
+ int32 checkpoint_after_ms = 15;
157
+ }
158
+ }
159
+
160
+ enum ConsumerStrategy {
161
+ DispatchToSingle = 0;
162
+ RoundRobin = 1;
163
+ Pinned = 2;
164
+ }
165
+ }
166
+
167
+ message UpdateResp {
168
+ }
169
+
170
+ message DeleteReq {
171
+ Options options = 1;
172
+
173
+ message Options {
174
+ event_store.client.shared.StreamIdentifier stream_identifier = 1;
175
+ string group_name = 2;
176
+ }
177
+ }
178
+
179
+ message DeleteResp {
180
+ }