From 1f67e52d3e91574f98c11fcf657370b88dea1196 Mon Sep 17 00:00:00 2001 From: Sara Pellegrini Date: Thu, 16 Nov 2023 11:55:32 +0100 Subject: [PATCH 01/31] Adding proto file for supporting DCB grpc API in Axon Server --- src/main/proto/dcb.proto | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/main/proto/dcb.proto diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto new file mode 100644 index 0000000..ca7aa4a --- /dev/null +++ b/src/main/proto/dcb.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; +package io.axoniq.axonserver.grpc.event.dcb; +import "common.proto"; +option java_multiple_files = true; + +service DcbEventStore { + rpc AppendEvent (stream AppendEventsRequest) returns (AppendEventsResponse) { + + } +} + +message AppendEventsRequest { + oneof request { + ConsistencyCondition condition = 1; + TaggedEvent event = 2; + Commit commit = 3; + } +} + +message TaggedEvent { + Event event = 1; + repeated Tag tags = 2; +} + +message Tag { + string key = 1; + string value = 2; +} + +message Event { + +} + +message Commit { + +} + +message ConsistencyCondition { + Position consistencyMarker = 1; + StreamQuery streamQuery = 2; +} + +message Position { + int64 global_sequence = 1; +} + +message StreamQuery { + +} + +message AppendEventsResponse { + oneof response { + AppendEventsSuccess success = 1; + AppendEventsFailure failure = 2; + } +} + +message AppendEventsSuccess { + Position lastPosition = 1; +} + +message AppendEventsFailure { + ErrorMessage errorMessage = 1; +} \ No newline at end of file From cecd0be171df0f93b373da4ecdbb9a7fc60afb5f Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Wed, 22 Nov 2023 11:24:56 +0100 Subject: [PATCH 02/31] Defined new Event message. Refined the rest of the DCB GRPC API. --- src/main/proto/dcb.proto | 41 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index ca7aa4a..372208b 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -1,6 +1,5 @@ syntax = "proto3"; package io.axoniq.axonserver.grpc.event.dcb; -import "common.proto"; option java_multiple_files = true; service DcbEventStore { @@ -13,52 +12,50 @@ message AppendEventsRequest { oneof request { ConsistencyCondition condition = 1; TaggedEvent event = 2; - Commit commit = 3; } } message TaggedEvent { Event event = 1; - repeated Tag tags = 2; + string type = 2; + repeated Tag tags = 3; } message Tag { - string key = 1; - string value = 2; + bytes key = 1; + bytes value = 2; } message Event { - + /* The unique identifier of this event */ + string identifier = 1; + /* The Payload of the Event */ + bytes payload = 2; } -message Commit { - +message TimestampedEvent { + int64 timestamp = 1; + TaggedEvent event = 2; } message ConsistencyCondition { - Position consistencyMarker = 1; - StreamQuery streamQuery = 2; + Position consistency_marker = 1; + StreamQuery stream_query = 2; } message Position { - int64 global_sequence = 1; + int64 sequence = 1; } message StreamQuery { - + repeated Criterion criteria = 1; } -message AppendEventsResponse { - oneof response { - AppendEventsSuccess success = 1; - AppendEventsFailure failure = 2; - } +message Criterion { + string type = 1; + repeated Tag tags = 2; } -message AppendEventsSuccess { +message AppendEventsResponse { Position lastPosition = 1; -} - -message AppendEventsFailure { - ErrorMessage errorMessage = 1; } \ No newline at end of file From 6abdaa7484d3dc68d358fa6c8da870774b42ab14 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 23 Nov 2023 11:54:00 +0100 Subject: [PATCH 03/31] Added a way to reference the Criteria. Events sent from the server will be identifiable by this reference. --- src/main/proto/dcb.proto | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 372208b..e4da729 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -18,7 +18,7 @@ message AppendEventsRequest { message TaggedEvent { Event event = 1; string type = 2; - repeated Tag tags = 3; + repeated Tag tag = 3; } message Tag { @@ -33,9 +33,10 @@ message Event { bytes payload = 2; } -message TimestampedEvent { - int64 timestamp = 1; - TaggedEvent event = 2; +message ServerSentEvent { + repeated string filter_key = 1; + int64 timestamp = 2; + TaggedEvent tagged_event = 3; } message ConsistencyCondition { @@ -52,10 +53,17 @@ message StreamQuery { } message Criterion { + string filter_key = 1; + oneof criterion { + TagsAndTypeCriterion tags_and_types = 2; + } +} + +message TagsAndTypeCriterion { string type = 1; - repeated Tag tags = 2; + repeated Tag tag = 2; } message AppendEventsResponse { - Position lastPosition = 1; + Position last_position = 1; } \ No newline at end of file From 211ad36803d0ae614d9c2764a9f27e1e8969e1b9 Mon Sep 17 00:00:00 2001 From: Sara Pellegrini Date: Fri, 24 Nov 2023 12:23:09 +0100 Subject: [PATCH 04/31] Removed client details from Event Store library. Implemented first version of Intercepting Event Store Service. --- src/main/proto/dcb.proto | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index e4da729..4f54579 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -29,8 +29,11 @@ message Tag { message Event { /* The unique identifier of this event */ string identifier = 1; + + reserved 2, 3, 4, 5, 6, 7, 8; /* The Payload of the Event */ - bytes payload = 2; + bytes payload = 9; + } message ServerSentEvent { @@ -49,7 +52,7 @@ message Position { } message StreamQuery { - repeated Criterion criteria = 1; + repeated Criterion criterion = 1; } message Criterion { From ad0b2995cedb20157d268b45b79f59a0fd0a3d28 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Wed, 20 Mar 2024 15:02:23 +0100 Subject: [PATCH 05/31] Added RPC for streaming events for command models. --- src/main/proto/dcb.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 4f54579..5051dd1 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -6,6 +6,10 @@ service DcbEventStore { rpc AppendEvent (stream AppendEventsRequest) returns (AppendEventsResponse) { } + + rpc Events (StreamQuery) returns (stream ServerSentEvent) { + + } } message AppendEventsRequest { From d8ff95e9de91e361e9210303f8f984c74301de29 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Wed, 5 Jun 2024 10:37:07 +0200 Subject: [PATCH 06/31] Added consistency marker to the `events` RPC. --- src/main/proto/dcb.proto | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 5051dd1..f5c6923 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -7,7 +7,7 @@ service DcbEventStore { } - rpc Events (StreamQuery) returns (stream ServerSentEvent) { + rpc Events (StreamQuery) returns (stream StreamQueryResult) { } } @@ -40,6 +40,13 @@ message Event { } +message StreamQueryResult { + oneof result { + ServerSentEvent event = 1; + Position consistency_marker = 2; // always a single value + } +} + message ServerSentEvent { repeated string filter_key = 1; int64 timestamp = 2; From 632aa91ab190f6fab148557edcaeb66f1667ab2d Mon Sep 17 00:00:00 2001 From: Marco Amann Date: Thu, 6 Jun 2024 10:56:40 +0200 Subject: [PATCH 07/31] Introduce Seed to denote position before event stream --- src/main/proto/dcb.proto | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index f5c6923..d5d1ef0 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -54,12 +54,42 @@ message ServerSentEvent { } message ConsistencyCondition { + /** +- The Position to start checking for the consistency of an append +- Examples + - When Consistency marker is n (where n > 0), event with Global Sequence Number n will not + be checked, but we start checking at event n + 1 (if existing) + - When Consistency marker is 0, the first event in the event store + (Global Sequence Number = 0) will not be checked + - When Consistency marker is the `Seed`, the check starts with the very first event (if any) in the event store + - When creating a new command model, `Seed` can be used to verify the + command model has never been used before. + Subsequent appends for this command model **must** use ConsistencyMarker of at least the + Global Sequence Number of the latest event in the command model + */ Position consistency_marker = 1; StreamQuery stream_query = 2; } +/** +Marks the position in or before the event stream +- Either + - The `Seed` alt names we thought about: Initial, Origin, Seed, Before, Null, Thingamajig, ∅ + - Global Sequence Number of an event +May contain shard or tier information as well. + */ message Position { - int64 sequence = 1; + oneof raw { + int64 sequence = 1; + Seed seed = 2; + } +} + +/** + Denotes the position before the start of the event stream + */ +message Seed{ + } message StreamQuery { From 3696f49a7ad68acdee9f14eb471cc57ae18b2c02 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 20 Jun 2024 11:39:16 +0200 Subject: [PATCH 08/31] Added stream events API. Refactored the state of the API. --- src/main/proto/dcb.proto | 105 +++++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 37 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index d5d1ef0..66cd808 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -3,26 +3,27 @@ package io.axoniq.axonserver.grpc.event.dcb; option java_multiple_files = true; service DcbEventStore { - rpc AppendEvent (stream AppendEventsRequest) returns (AppendEventsResponse) { - } + rpc Append (stream AppendRequest) returns (AppendResponse); - rpc Events (StreamQuery) returns (stream StreamQueryResult) { + // finite + rpc Source (SourceRequest) returns (stream SourceResponse); - } + // infinite + rpc Stream (StreamRequest) returns (stream StreamResponse); } -message AppendEventsRequest { - oneof request { - ConsistencyCondition condition = 1; - TaggedEvent event = 2; - } -} +// Shared +// PlainEvent, Raw, NakedEvent, IdentifiableEventPayload -message TaggedEvent { - Event event = 1; - string type = 2; - repeated Tag tag = 3; +// Event storage engine +message IdentifiableEventPayload { + /* The unique identifier of this event */ + string identifier = 1; + + reserved 2, 3, 4, 5, 6, 7, 8; + /* The Payload of the Event */ + bytes payload = 9; } message Tag { @@ -30,27 +31,49 @@ message Tag { bytes value = 2; } -message Event { - /* The unique identifier of this event */ - string identifier = 1; +message TypedEventPayload { + IdentifiableEventPayload event = 1; + string type = 2; +} - reserved 2, 3, 4, 5, 6, 7, 8; - /* The Payload of the Event */ - bytes payload = 9; +message TaggedEventPayload { + TypedEventPayload typed_event = 1; + repeated Tag tag = 2; +} +// Appending +message AppendRequest { + oneof request { + ConsistencyCondition condition = 1; + Event event = 2; + } + + message Event { + TaggedEventPayload event = 1; + } } -message StreamQueryResult { +message AppendResponse { + Position last_position = 1; +} + +// Sourcing +message SourceRequest { + repeated Criterion criterion = 1; +} + +message SourceResponse { oneof result { - ServerSentEvent event = 1; - Position consistency_marker = 2; // always a single value + // ServetSentEvent, DomainEvent, SourcedEvent, TypedEvent, Item + Event event = 1; // plain event, tags, type, timestamp, filterkey + Position consistency_marker = 2; } -} -message ServerSentEvent { - repeated string filter_key = 1; - int64 timestamp = 2; - TaggedEvent tagged_event = 3; + message Event { + repeated string filter_key = 1; + int64 timestamp = 2; + TaggedEventPayload tagged_event = 3; + } } message ConsistencyCondition { @@ -68,7 +91,7 @@ message ConsistencyCondition { Global Sequence Number of the latest event in the command model */ Position consistency_marker = 1; - StreamQuery stream_query = 2; + SourceRequest stream_query = 2; } /** @@ -88,12 +111,8 @@ message Position { /** Denotes the position before the start of the event stream */ -message Seed{ - -} +message Seed { -message StreamQuery { - repeated Criterion criterion = 1; } message Criterion { @@ -108,6 +127,18 @@ message TagsAndTypeCriterion { repeated Tag tag = 2; } -message AppendEventsResponse { - Position last_position = 1; -} \ No newline at end of file +// Streaming + +message StreamRequest { + /* The token to start streaming from */ + int64 tracking_token = 1; +} + +message StreamResponse { + int64 tracking_token = 1; + Event event = 2; + + message Event { + TypedEventPayload typed_event = 1; + } +} From 5509da4fca9fcfffdd50626972455784b9f6ad06 Mon Sep 17 00:00:00 2001 From: Marco Amann Date: Thu, 20 Jun 2024 12:10:56 +0200 Subject: [PATCH 09/31] Renamed field for dcb api --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 66cd808..26988ee 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -91,7 +91,7 @@ message ConsistencyCondition { Global Sequence Number of the latest event in the command model */ Position consistency_marker = 1; - SourceRequest stream_query = 2; + SourceRequest source_request = 2; } /** From 7dd1b1b90bdbe5015584b78a60d0f0909c670a03 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Wed, 7 Aug 2024 11:57:46 +0200 Subject: [PATCH 10/31] - Added range to SourceRequest - Replaced Seed with Head - Added shortcut for filtering events on multiple types --- src/main/proto/dcb.proto | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 26988ee..2887058 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -43,10 +43,8 @@ message TaggedEventPayload { // Appending message AppendRequest { - oneof request { - ConsistencyCondition condition = 1; - Event event = 2; - } + ConsistencyCondition condition = 1; + Event event = 2; message Event { TaggedEventPayload event = 1; @@ -59,7 +57,9 @@ message AppendResponse { // Sourcing message SourceRequest { - repeated Criterion criterion = 1; + int64 from_sequence = 1; + int64 to_sequence = 2; + repeated Criterion criterion = 3; } message SourceResponse { @@ -91,39 +91,39 @@ message ConsistencyCondition { Global Sequence Number of the latest event in the command model */ Position consistency_marker = 1; - SourceRequest source_request = 2; + repeated Criterion criterion = 2; } /** Marks the position in or before the event stream - Either - - The `Seed` alt names we thought about: Initial, Origin, Seed, Before, Null, Thingamajig, ∅ + - The `Head` - Global Sequence Number of an event May contain shard or tier information as well. */ message Position { oneof raw { int64 sequence = 1; - Seed seed = 2; + Head head = 2; } } /** - Denotes the position before the start of the event stream + Denotes the position of the _head_ of the event stream */ -message Seed { +message Head { } message Criterion { string filter_key = 1; oneof criterion { - TagsAndTypeCriterion tags_and_types = 2; + TagsAndTypesCriterion tags_and_types = 2; } } -message TagsAndTypeCriterion { - string type = 1; +message TagsAndTypesCriterion { + repeated string type = 1; repeated Tag tag = 2; } @@ -131,7 +131,7 @@ message TagsAndTypeCriterion { message StreamRequest { /* The token to start streaming from */ - int64 tracking_token = 1; + int64 from_sequence = 1; } message StreamResponse { From fb1a517d8d67ed0795db067de25d0da43e4eb17c Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Fri, 18 Oct 2024 10:20:33 +0200 Subject: [PATCH 11/31] - proposal for building the criteria --- src/main/proto/dcb.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 2887058..85edb84 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -127,6 +127,8 @@ message TagsAndTypesCriterion { repeated Tag tag = 2; } +// criteria(criterion(type(StudentSubscribed), type(StudentUnsubscribed), studentId(1), course(1))) + // Streaming message StreamRequest { From 16e1bcf0b568c66f4f17f796968535537663a39b Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Mon, 6 Jan 2025 16:25:17 +0100 Subject: [PATCH 12/31] - Adjusted comments from consistency marker. --- src/main/proto/dcb.proto | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 85edb84..67596be 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -80,10 +80,8 @@ message ConsistencyCondition { /** - The Position to start checking for the consistency of an append - Examples - - When Consistency marker is n (where n > 0), event with Global Sequence Number n will not - be checked, but we start checking at event n + 1 (if existing) - - When Consistency marker is 0, the first event in the event store - (Global Sequence Number = 0) will not be checked + - When Consistency marker is n (where n > 0), event with Global Sequence Number n will be checked + - When Consistency marker is 0, the first event in the event store (Global Sequence Number = 0) will be checked - When Consistency marker is the `Seed`, the check starts with the very first event (if any) in the event store - When creating a new command model, `Seed` can be used to verify the command model has never been used before. From 75a9fbd5e37b10ebb5d35f1d9de377e770bd5122 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 9 Jan 2025 15:01:31 +0100 Subject: [PATCH 13/31] WIP: DCB Snapshot Store. --- src/main/proto/dcb.proto | 67 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 67596be..8f8b27d 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -13,6 +13,71 @@ service DcbEventStore { rpc Stream (StreamRequest) returns (stream StreamResponse); } +service DcbSnapshotStore { + + rpc Put (PutRequest) returns (PutResponse); + + rpc Add (AddRequest) returns (AddResponse); + + rpc Delete (DeleteRequest) returns (DeleteResponse); + + rpc List (ListRequest) returns (stream ListResponse); + + rpc GetLast (GetRequest) returns (GetResponse); +} + +message Snapshot { + string name = 1; + string revision = 2; + bytes payload = 3; +} + +message PutRequest { + bytes key = 1; + int64 sequence = 2; + Snapshot snapshot = 3; +} + +message PutResponse { + +} + +message AddRequest { + bytes key = 1; + int64 sequence = 2; + Snapshot snapshot = 3; +} + +message AddResponse { + +} + +message DeleteRequest { + bytes key = 1; + // exclusive + int64 to_sequence = 2; +} + +message DeleteResponse { + +} + +message ListRequest { + +} + +message ListResponse { + +} + +message GetRequest { + +} + +message GetResponse { + +} + // Shared // PlainEvent, Raw, NakedEvent, IdentifiableEventPayload @@ -135,7 +200,7 @@ message StreamRequest { } message StreamResponse { - int64 tracking_token = 1; + int64 sequence = 1; Event event = 2; message Event { From c1977a5d504c86fbe6b67af5d32466eb1a7abd0e Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Mon, 13 Jan 2025 14:52:52 +0100 Subject: [PATCH 14/31] DCB Snapshot Store. --- src/main/proto/dcb.proto | 45 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 8f8b27d..41d7bb9 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -15,15 +15,13 @@ service DcbEventStore { service DcbSnapshotStore { - rpc Put (PutRequest) returns (PutResponse); - - rpc Add (AddRequest) returns (AddResponse); + rpc Add (AddRequest) returns (AddResponse); rpc Delete (DeleteRequest) returns (DeleteResponse); rpc List (ListRequest) returns (stream ListResponse); - rpc GetLast (GetRequest) returns (GetResponse); + rpc GetLast (GetLastRequest) returns (GetLastResponse); } message Snapshot { @@ -32,20 +30,11 @@ message Snapshot { bytes payload = 3; } -message PutRequest { - bytes key = 1; - int64 sequence = 2; - Snapshot snapshot = 3; -} - -message PutResponse { - -} - message AddRequest { bytes key = 1; int64 sequence = 2; - Snapshot snapshot = 3; + bool prune = 3; + Snapshot snapshot = 4; } message AddResponse { @@ -54,28 +43,38 @@ message AddResponse { message DeleteRequest { bytes key = 1; + // inclusive + int64 from_sequence = 2; // exclusive - int64 to_sequence = 2; + int64 to_sequence = 3; } message DeleteResponse { - + int32 num_of_deleted_snapshots = 1; } message ListRequest { - + bytes key = 1; + // inclusive + int64 from_sequence = 2; + // exclusive + int64 to_sequence = 3; } message ListResponse { - + bytes key = 1; + int64 sequence = 2; + Snapshot snapshot = 3; } -message GetRequest { - +message GetLastRequest { + bytes key = 1; } -message GetResponse { - +message GetLastResponse { + bytes key = 1; + int64 sequence = 2; + Snapshot snapshot = 3; } // Shared From 440ffd55b974fc97d7cd457abe0e547dbfddfead Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Fri, 17 Jan 2025 13:09:03 +0100 Subject: [PATCH 15/31] ReTagging. --- src/main/proto/dcb.proto | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 41d7bb9..2a0f894 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -11,19 +11,51 @@ service DcbEventStore { // infinite rpc Stream (StreamRequest) returns (stream StreamResponse); + + rpc AddTags (AddTagsRequest) returns (AddTagsResponse); + + rpc RemoveTags (RemoveTagsRequest) returns (RemoveTagsResponse); + + rpc GetTags (GetTagsRequest) returns (GetTagsResponse); } service DcbSnapshotStore { rpc Add (AddRequest) returns (AddResponse); - + rpc Delete (DeleteRequest) returns (DeleteResponse); - + rpc List (ListRequest) returns (stream ListResponse); - + rpc GetLast (GetLastRequest) returns (GetLastResponse); } +message AddTagsRequest { + int64 sequence = 1; + repeated Tag tag = 2; +} + +message AddTagsResponse { + +} + +message RemoveTagsRequest { + int64 sequence = 1; + repeated Tag tag = 2; +} + +message RemoveTagsResponse { + +} + +message GetTagsRequest { + int64 sequence = 1; +} + +message GetTagsResponse { + repeated Tag tag = 1; +} + message Snapshot { string name = 1; string revision = 2; From 4bc9200861dd683b96c976e48c3c4373bd503962 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Tue, 21 Jan 2025 15:11:15 +0100 Subject: [PATCH 16/31] Streamlined the API. --- src/main/proto/dcb.proto | 282 +++++++++++++++++++-------------------- 1 file changed, 134 insertions(+), 148 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 2a0f894..6a23dd4 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -4,13 +4,20 @@ option java_multiple_files = true; service DcbEventStore { - rpc Append (stream AppendRequest) returns (AppendResponse); + rpc Append (stream AppendEventsRequest) returns (AppendEventsResponse); // finite - rpc Source (SourceRequest) returns (stream SourceResponse); + rpc Source (SourceEventsRequest) returns (stream SourceEventsResponse); // infinite - rpc Stream (StreamRequest) returns (stream StreamResponse); + rpc Stream (StreamEventsRequest) returns (stream StreamEventsResponse); + + rpc GetHead(GetHeadRequest) returns (GetHeadResponse); + + rpc GetTail(GetTailRequest) returns (GetTailResponse); + + // approximation + rpc GetSequenceAt(GetSequenceAtRequest) returns (GetSequenceAtResponse); rpc AddTags (AddTagsRequest) returns (AddTagsResponse); @@ -21,220 +28,199 @@ service DcbEventStore { service DcbSnapshotStore { - rpc Add (AddRequest) returns (AddResponse); + rpc Add (AddSnapshotRequest) returns (AddSnapshotResponse); - rpc Delete (DeleteRequest) returns (DeleteResponse); + rpc Delete (DeleteSnapshotsRequest) returns (DeleteSnapshotsResponse); - rpc List (ListRequest) returns (stream ListResponse); + rpc List (ListSnapshotsRequest) returns (stream ListSnapshotsResponse); - rpc GetLast (GetLastRequest) returns (GetLastResponse); + rpc GetLast (GetLastSnapshotRequest) returns (GetLastSnapshotResponse); } -message AddTagsRequest { - int64 sequence = 1; - repeated Tag tag = 2; +message Event { + /* The unique identifier of this event */ + string identifier = 1; + int64 timestamp = 2; + string name = 3; + string version = 4; + /* The Payload of the Event */ + bytes payload = 5; + map metadata = 6; } -message AddTagsResponse { - +message Tag { + bytes key = 1; + bytes value = 2; } -message RemoveTagsRequest { - int64 sequence = 1; +message TaggedEvent { + Event event = 1; repeated Tag tag = 2; } -message RemoveTagsResponse { - +message SequencedEvent { + int64 sequence = 1; + Event event = 2; } -message GetTagsRequest { - int64 sequence = 1; +// Appending +message AppendEventsRequest { + ConsistencyCondition condition = 1; + repeated TaggedEvent event = 2; } -message GetTagsResponse { - repeated Tag tag = 1; +message AppendEventsResponse { + int64 last_position = 1; } -message Snapshot { - string name = 1; - string revision = 2; - bytes payload = 3; +// Sourcing +message SourceEventsRequest { + // inclusive + int64 from_sequence = 1; + repeated Criterion criterion = 2; } -message AddRequest { - bytes key = 1; - int64 sequence = 2; - bool prune = 3; - Snapshot snapshot = 4; +message SourceEventsResponse { + oneof result { + SequencedEvent event = 1; + int64 consistency_marker = 2; + } } -message AddResponse { - +message ConsistencyCondition { + /** +- The Position to start checking for the consistency of an append +- Examples + - When Consistency marker is n (where n > 0), event with Global Sequence Number n will be checked + - When Consistency marker is 0, the first event in the event store (Global Sequence Number = 0) will be checked + - When Consistency marker is the `Seed`, the check starts with the very first event (if any) in the event store + - When creating a new command model, `Seed` can be used to verify the + command model has never been used before. + Subsequent appends for this command model **must** use ConsistencyMarker of at least the + Global Sequence Number of the latest event in the command model + */ + int64 consistency_marker = 1; + repeated Criterion criterion = 2; } -message DeleteRequest { - bytes key = 1; - // inclusive - int64 from_sequence = 2; - // exclusive - int64 to_sequence = 3; +message Criterion { + TagsAndNamesCriterion tags_and_names = 1; } -message DeleteResponse { - int32 num_of_deleted_snapshots = 1; +message TagsAndNamesCriterion { + repeated string name = 1; + repeated Tag tag = 2; } -message ListRequest { - bytes key = 1; - // inclusive - int64 from_sequence = 2; - // exclusive - int64 to_sequence = 3; +message StreamEventsRequest { + /* The token to start streaming from */ + int64 from_sequence = 1; + repeated Criterion criterion = 2; } -message ListResponse { - bytes key = 1; - int64 sequence = 2; - Snapshot snapshot = 3; +message StreamEventsResponse { + SequencedEvent event = 1; } -message GetLastRequest { - bytes key = 1; +message GetHeadRequest { + } -message GetLastResponse { - bytes key = 1; - int64 sequence = 2; - Snapshot snapshot = 3; +message GetHeadResponse { + int64 sequence = 1; } -// Shared -// PlainEvent, Raw, NakedEvent, IdentifiableEventPayload +message GetTailRequest { -// Event storage engine -message IdentifiableEventPayload { - /* The unique identifier of this event */ - string identifier = 1; +} - reserved 2, 3, 4, 5, 6, 7, 8; - /* The Payload of the Event */ - bytes payload = 9; +message GetTailResponse { + int64 sequence = 1; } -message Tag { - bytes key = 1; - bytes value = 2; +message GetSequenceAtRequest { + int64 timestamp = 1; } -message TypedEventPayload { - IdentifiableEventPayload event = 1; - string type = 2; +message GetSequenceAtResponse { + int64 sequence = 1; } -message TaggedEventPayload { - TypedEventPayload typed_event = 1; +message AddTagsRequest { + int64 sequence = 1; repeated Tag tag = 2; } -// Appending -message AppendRequest { - ConsistencyCondition condition = 1; - Event event = 2; - - message Event { - TaggedEventPayload event = 1; - } -} +message AddTagsResponse { -message AppendResponse { - Position last_position = 1; } -// Sourcing -message SourceRequest { - int64 from_sequence = 1; - int64 to_sequence = 2; - repeated Criterion criterion = 3; +message RemoveTagsRequest { + int64 sequence = 1; + repeated Tag tag = 2; } -message SourceResponse { - oneof result { - // ServetSentEvent, DomainEvent, SourcedEvent, TypedEvent, Item - Event event = 1; // plain event, tags, type, timestamp, filterkey - Position consistency_marker = 2; - } +message RemoveTagsResponse { - message Event { - repeated string filter_key = 1; - int64 timestamp = 2; - TaggedEventPayload tagged_event = 3; - } } -message ConsistencyCondition { - /** -- The Position to start checking for the consistency of an append -- Examples - - When Consistency marker is n (where n > 0), event with Global Sequence Number n will be checked - - When Consistency marker is 0, the first event in the event store (Global Sequence Number = 0) will be checked - - When Consistency marker is the `Seed`, the check starts with the very first event (if any) in the event store - - When creating a new command model, `Seed` can be used to verify the - command model has never been used before. - Subsequent appends for this command model **must** use ConsistencyMarker of at least the - Global Sequence Number of the latest event in the command model - */ - Position consistency_marker = 1; - repeated Criterion criterion = 2; +message GetTagsRequest { + int64 sequence = 1; } -/** -Marks the position in or before the event stream -- Either - - The `Head` - - Global Sequence Number of an event -May contain shard or tier information as well. - */ -message Position { - oneof raw { - int64 sequence = 1; - Head head = 2; - } +message GetTagsResponse { + repeated Tag tag = 1; } -/** - Denotes the position of the _head_ of the event stream - */ -message Head { +message Snapshot { + string name = 1; + string revision = 2; + bytes payload = 3; +} +message AddSnapshotRequest { + bytes key = 1; + int64 sequence = 2; + bool prune = 3; + Snapshot snapshot = 4; } -message Criterion { - string filter_key = 1; - oneof criterion { - TagsAndTypesCriterion tags_and_types = 2; - } +message AddSnapshotResponse { + } -message TagsAndTypesCriterion { - repeated string type = 1; - repeated Tag tag = 2; +message DeleteSnapshotsRequest { + bytes key = 1; + // inclusive + int64 from_sequence = 2; + // exclusive + int64 to_sequence = 3; } -// criteria(criterion(type(StudentSubscribed), type(StudentUnsubscribed), studentId(1), course(1))) +message DeleteSnapshotsResponse { -// Streaming +} -message StreamRequest { - /* The token to start streaming from */ - int64 from_sequence = 1; +message ListSnapshotsRequest { + bytes key = 1; + // inclusive + int64 from_sequence = 2; + // exclusive + int64 to_sequence = 3; } -message StreamResponse { - int64 sequence = 1; - Event event = 2; +message ListSnapshotsResponse { + bytes key = 1; + int64 sequence = 2; + Snapshot snapshot = 3; +} - message Event { - TypedEventPayload typed_event = 1; - } +message GetLastSnapshotRequest { + bytes key = 1; } + +message GetLastSnapshotResponse { + bytes key = 1; + int64 sequence = 2; + Snapshot snapshot = 3; +} \ No newline at end of file From 89ead2852b3e9ae1cfc76c04ff6606925493f380 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 10 Mar 2025 13:26:42 +0100 Subject: [PATCH 17/31] add DCB flag to context --- src/main/proto/admin.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/proto/admin.proto b/src/main/proto/admin.proto index 852f69d..e2fa5ea 100644 --- a/src/main/proto/admin.proto +++ b/src/main/proto/admin.proto @@ -44,6 +44,7 @@ message CreateContextRequest { string name = 1; string replicationGroupName = 2; map meta_data = 3; + bool dcbContext = 4; } message UpdateContextPropertiesRequest { @@ -66,6 +67,7 @@ message ContextOverview { map meta_data = 3; int64 pendingSince = 4; bool changePending = 5; + bool dcbContext = 6; } message ContextUpdate { From a701608a156e97d984368009a5e0adb42fb53bae Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 23 Apr 2025 09:51:38 +0200 Subject: [PATCH 18/31] update version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 22fe5c7..0f4425a 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 4.0.0 io.axoniq axon-server-api - 2024.2.0-SNAPSHOT + 2025.1.0-SNAPSHOT Axon Server API Public API for communication with AxonServer From 9ea324f09cefda7b240df231f9e5272626f89350 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 23 Apr 2025 09:53:03 +0200 Subject: [PATCH 19/31] update version --- .github/workflows/maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b5a940f..d0be9a2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -5,6 +5,7 @@ on: branches: - master - axon-server-api-*.*.x + - feature/dcb workflow_dispatch: jobs: From 761a95a1a27d7d21a618e7300b29ed76441c210a Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 23 Apr 2025 09:54:43 +0200 Subject: [PATCH 20/31] update github action --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index d0be9a2..4ef96f7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -27,7 +27,7 @@ jobs: server-password: MAVEN_PASSWORD - name: Cache .m2 - uses: actions/cache@v2.1.3 + uses: actions/cache@v4.2.23 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From 6252ab065534ba25209f557fac2250cc6218c162 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 23 Apr 2025 09:55:54 +0200 Subject: [PATCH 21/31] update github action --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4ef96f7..1a37fff 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -27,7 +27,7 @@ jobs: server-password: MAVEN_PASSWORD - name: Cache .m2 - uses: actions/cache@v4.2.23 + uses: actions/cache@v4.2.3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From d3aff5d85bc33b15105555f83391035d292a9f5c Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Mon, 5 May 2025 17:26:34 +0200 Subject: [PATCH 22/31] Send consistency marker, sequence of the first event, and transaction size as the response to append events. --- src/main/proto/dcb.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 6a23dd4..ff344cf 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -70,7 +70,9 @@ message AppendEventsRequest { } message AppendEventsResponse { - int64 last_position = 1; + int64 sequence_of_the_first_event = 1; + int32 transaction_size = 2; + int64 consistency_marker = 3; } // Sourcing From 5ff2897846d51ced3ea2c2739a583eb946514c65 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Wed, 14 May 2025 18:12:20 +0200 Subject: [PATCH 23/31] Add docs to the DCB APIs. --- src/main/proto/dcb.proto | 229 ++++++++++++++++++++++++++++++++++----- 1 file changed, 202 insertions(+), 27 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index ff344cf..1fcf058 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -2,227 +2,402 @@ syntax = "proto3"; package io.axoniq.axonserver.grpc.event.dcb; option java_multiple_files = true; +/* EXPERIMENTAL: Service providing Event Store RPCs supporting DCB. */ service DcbEventStore { + /* Appends new events to the store. */ rpc Append (stream AppendEventsRequest) returns (AppendEventsResponse); - // finite + /* Provides a finite stream of events based on the passed SourceEventsRequest. */ rpc Source (SourceEventsRequest) returns (stream SourceEventsResponse); - // infinite + /* Provides an infinite stream of events based on the passed StreamEventsRequest. */ rpc Stream (StreamEventsRequest) returns (stream StreamEventsResponse); - rpc GetHead(GetHeadRequest) returns (GetHeadResponse); + /* Gets the current _head_ of the Event Store. The _head_ points to a sequence of the first event to be appended. */ + rpc GetHead (GetHeadRequest) returns (GetHeadResponse); - rpc GetTail(GetTailRequest) returns (GetTailResponse); + /* Gets the current _tail_ of the Event Store. The _tail_ points to a sequence of the first event stored. */ + rpc GetTail (GetTailRequest) returns (GetTailResponse); - // approximation - rpc GetSequenceAt(GetSequenceAtRequest) returns (GetSequenceAtResponse); + /* Gets the sequence of the event whose timestamp approximately matches the given request. It returns the first + event whose timestamp is greater or equal than the provided timestamp. If the provided timestamp is after the + timestamp of the last event in the event store, the HEAD is returned. + N.B. Axon Server does not assign timestamps to events. The timestamps used for fulfilling this RPC are timestamps + provided by the client. It could happen that there are events after the returned sequence that have an earlier + timestamp. Axon Server does not reject appends if timestamps of events are not monotonically increasing. */ + rpc GetSequenceAt (GetSequenceAtRequest) returns (GetSequenceAtResponse); + + /* Assigns tags to the event identified by its sequence. */ rpc AddTags (AddTagsRequest) returns (AddTagsResponse); + /* Removes tags from the event identified by its sequence. */ rpc RemoveTags (RemoveTagsRequest) returns (RemoveTagsResponse); + /* Gets tags for the event identified by its sequence. */ rpc GetTags (GetTagsRequest) returns (GetTagsResponse); } +/* EXPERIMENTAL: Service providing Snapshot Store RPCs. */ service DcbSnapshotStore { + /* Adds a snapshot to the snapshot store. */ rpc Add (AddSnapshotRequest) returns (AddSnapshotResponse); + /* Deletes a snapshot from the snapshot store. */ rpc Delete (DeleteSnapshotsRequest) returns (DeleteSnapshotsResponse); + /* Retrieves snapshots from the snapshot store. */ rpc List (ListSnapshotsRequest) returns (stream ListSnapshotsResponse); + /* Gets the latest snapshot based on the request from the snapshot store. */ rpc GetLast (GetLastSnapshotRequest) returns (GetLastSnapshotResponse); } +/* The event message. */ message Event { - /* The unique identifier of this event */ + + /* The unique identifier of the event. */ string identifier = 1; + + /* The timestamp of the event. */ int64 timestamp = 2; + + /* The name of the event. */ string name = 3; + + /* The version of the event. */ string version = 4; - /* The Payload of the Event */ + + /* The payload of the event. */ bytes payload = 5; + + /* The metadata of the event. */ map metadata = 6; } +/* The tag. Describes an event with more details. Usually using concepts from the Domain. */ message Tag { + + /* The key of the tag. */ bytes key = 1; + + /* The value of the tag. */ bytes value = 2; } +/* The event described in more details by a list of tags. */ message TaggedEvent { + + /* The event. */ Event event = 1; + + /* List of tags describing the given event in more details. */ repeated Tag tag = 2; } +/* The event retrieved from the event store with its corresponding sequence. */ message SequencedEvent { + + /* The sequence of the event. */ int64 sequence = 1; + + /* The event. */ Event event = 2; } -// Appending +/* The message representing the request to append events to the event store. */ message AppendEventsRequest { + + /* The condition used to check the validity of this request. If omitted, events will be appended unconditionally. */ ConsistencyCondition condition = 1; + + /* A list of tagged events to be appended to the event store if the condition is met. + These events are considered as a transaction - they are either all appended or none of them is appended. + The event store will index the events based on provided tags for future faster retrieval. */ repeated TaggedEvent event = 2; } +/* The response of a successful append events request. If there was an issue with the append events request, +the stream will complete with an error. */ message AppendEventsResponse { + + /* The sequence of the first event stored in the event store. + Corresponding to the list of events (a transaction) passed in the AppendEventsRequest. */ int64 sequence_of_the_first_event = 1; + + /* The number of events appended. Matches the number of events passed in the AppendEventsRequest. */ int32 transaction_size = 2; + + /* The consistency marker which may be used for a subsequent append events requests. Do note that during the time this + consistency marker may get far behind the head of the event store which will increase the time needed for the append + events request to be validated. If you don't plan to do subsequent append events requests in a "short" period of time, + use Source RPC to refresh the consistency marker. */ int64 consistency_marker = 3; } -// Sourcing +/* The request to source events from the event store. It results in a finite stream of events completed by +the event store. It may also be cancelled by the client. Only events matching the given criteria +(a provided list of criterions) will be present in the stream. The stream is capped by the HEAD of the event store. */ message SourceEventsRequest { - // inclusive + + /* An inclusive sequence of the first event to be included in the resulting stream. */ int64 from_sequence = 1; + + /* The criteria consisting of the list of criterions. If at least one of these criterions is met, + the criteria is met. */ repeated Criterion criterion = 2; } +/* The response to the SourceEventsRequest. It consists either of an event (with its corresponding sequence) or a +consistency marker. The consistency marker should be used in the following AppendEventsRequest related to the same +criteria. */ message SourceEventsResponse { oneof result { + + /* The event matching the criteria with its corresponding sequence. */ SequencedEvent event = 1; + + /* The consistency marker to be used for the following append related to the same criteria. */ int64 consistency_marker = 2; } } +/* The condition for an AppendEventsRequest. Consists of the consistency marker and the criteria +(a list of criterions). */ message ConsistencyCondition { - /** -- The Position to start checking for the consistency of an append -- Examples - - When Consistency marker is n (where n > 0), event with Global Sequence Number n will be checked - - When Consistency marker is 0, the first event in the event store (Global Sequence Number = 0) will be checked - - When Consistency marker is the `Seed`, the check starts with the very first event (if any) in the event store - - When creating a new command model, `Seed` can be used to verify the - command model has never been used before. - Subsequent appends for this command model **must** use ConsistencyMarker of at least the - Global Sequence Number of the latest event in the command model - */ + + /* The sequence used to start checking for the consistency of an append. If there are events with a sequence greater + or equal than the consistency marker, and are matching the given criteria the condition is not met and the transaction + is rejected. Otherwise, it is accepted. */ int64 consistency_marker = 1; + + /* The criteria. Consists of a list of criterions. If a single criterion is met, the whole criteria is met. */ repeated Criterion criterion = 2; } +/* The integral part of the criteria. */ message Criterion { + + /* The criterion based on event tags and event names. */ TagsAndNamesCriterion tags_and_names = 1; } +/* The criterion based on event tags and event names. The event meets this criterion if ALL tags from this criterion +are present in the tags of the event AND if the event name is present in one of the names of the this criterion. */ message TagsAndNamesCriterion { + + /* A list of event names. The event meets this criterion if its name is in one of the names in this list. */ repeated string name = 1; + + /* A list of event tags. The event meets this criterion if it contains all the tags from this list. It meets the + criterion if it contains more than provided list here, but it MUST contain all from the list. */ repeated Tag tag = 2; } +/* The request to provide an infinite stream of events from the event store. The client may cancel the stream at any +time. */ message StreamEventsRequest { - /* The token to start streaming from */ + + /* The inclusive sequence to start streaming from. */ int64 from_sequence = 1; + + /* The criteria used to filter out events. Represented by a list of criterions. If at least one is met, the whole + criteria is met. */ repeated Criterion criterion = 2; } +/* The response to the StreamEventsRequest. */ message StreamEventsResponse { + + /* The event with its corresponding sequence. */ SequencedEvent event = 1; } +/* The request to retrieve the current HEAD of the event store. */ message GetHeadRequest { } +/* The current HEAD of the event store. */ message GetHeadResponse { + + /* The sequence of the current head. Points to the position of the first event to be appended. The HEAD of an empty + event store is 0. */ int64 sequence = 1; } +/* The request to retrieve the current TAIL of the event store. */ message GetTailRequest { } +/* The current TAIL of the event store. */ message GetTailResponse { + + /* The sequence of the first event in the event store. 0 for an empty event store. 0 for a non-truncated event store. + Non-zero for a truncated event store. */ int64 sequence = 1; } +/* The request to get the sequence of the event whose timestamp the same as the timestamp provided in the request. +If there are no events with the exact timestamp, then the sequence of the first one after the provided timestamp is +returned. If the provided timestamp is greater that the sequence of the last event in the event store, +the HEAD is returned. */ message GetSequenceAtRequest { + + /* The timestamp. */ int64 timestamp = 1; } +/* The sequence of the event approximately close to the provided timestamp. */ message GetSequenceAtResponse { + + /* The sequence of the event. */ int64 sequence = 1; } +/* The request to add tags to the event. */ message AddTagsRequest { + + /* The sequence of the event whose tags list will be expanded with the tags from the request. */ int64 sequence = 1; + + /* The tags to be added to the event. If the event already contains a tag from the same list + (with the same key and the value) the new one will be ignored. */ repeated Tag tag = 2; } +/* The response indicating a successful addition of tags to the event. */ message AddTagsResponse { } +/* The request to remove tags from the event. */ message RemoveTagsRequest { + + /* The sequence of the event whose tags should be removed. */ int64 sequence = 1; + + /* Tags to be removed. */ repeated Tag tag = 2; } +/* The response indicating a successful removal of tags for the event. */ message RemoveTagsResponse { } +/* The request to retrieve tags of the event. */ message GetTagsRequest { + + /* The sequence of the event whose tags should be retrieved. */ int64 sequence = 1; } +/* The response containing tags of an event. */ message GetTagsResponse { + + /* The tags associated to the event. */ repeated Tag tag = 1; } +/* The snapshot. */ message Snapshot { + + /* The name of the snapshot. */ string name = 1; + + /* The revision of the snapshot. */ string revision = 2; + + /* The payload of the snapshot. */ bytes payload = 3; } +/* The request to add the snapshot to the snapshot store. */ message AddSnapshotRequest { + + /* The key this snapshot is added to. */ bytes key = 1; + + /* The sequence of the snapshot. Usually linked to the sequence of the event in the event store up to which + the snapshot is taken. */ int64 sequence = 2; + + /* If set to true, older snapshots for the same key are pruned. */ bool prune = 3; + + /* The snapshot. */ Snapshot snapshot = 4; } +/* The response indicating the successful addition of the snapshot. */ message AddSnapshotResponse { } +/* The request to delete the snapshot from the snapshot store. */ message DeleteSnapshotsRequest { + + /* The key the snapshot is identified by. */ bytes key = 1; - // inclusive + + /* The inclusive bottom bound sequence of the snapshot to start the deletion. */ int64 from_sequence = 2; - // exclusive + + /* The exclusive upper bound sequence of the snapshot to end the deletion. */ int64 to_sequence = 3; } +/* The response indicating the successful deletion of the snapshot. */ message DeleteSnapshotsResponse { } +/* The request to retrieve all snapshots from the snapshot store based on the key and sequence bounds. */ message ListSnapshotsRequest { + + /* The key of the snapshot. */ bytes key = 1; - // inclusive + + /* The inclusive bottom bound sequence used to filter out snapshots. */ int64 from_sequence = 2; - // exclusive + + /* The exclusive upper bound sequence used to filter out snapshots. */ int64 to_sequence = 3; } +/* The response to the ListSnapshotRequest. */ message ListSnapshotsResponse { + + /* The key of the snapshot. */ bytes key = 1; + + /* The sequence of the snapshot. */ int64 sequence = 2; + + /* The snapshot. */ Snapshot snapshot = 3; } +/* The request to retrieve the snapshot with the highest sequence from the snapshot store. */ message GetLastSnapshotRequest { + + /* The key of the snapshot. */ bytes key = 1; } +/* The response to GetLatestSnapshotRequest. */ message GetLastSnapshotResponse { + + /* The key of the snapshot. */ bytes key = 1; + + /* The sequence of the snapshot. */ int64 sequence = 2; + + /* The snapshot. */ Snapshot snapshot = 3; } \ No newline at end of file From 5586d55e6dbaa1fbba3a0598eeb33489c1a7db69 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:34:06 +0200 Subject: [PATCH 24/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 1fcf058..4147b0d 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -114,7 +114,7 @@ message AppendEventsRequest { ConsistencyCondition condition = 1; /* A list of tagged events to be appended to the event store if the condition is met. - These events are considered as a transaction - they are either all appended or none of them is appended. + These events are considered as a transaction - they are either all appended or none of them are appended. The event store will index the events based on provided tags for future faster retrieval. */ repeated TaggedEvent event = 2; } From e96b3a13e86af4b9fa139767437af91996fd0aa3 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:34:23 +0200 Subject: [PATCH 25/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 4147b0d..e4912e8 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -14,7 +14,7 @@ service DcbEventStore { /* Provides an infinite stream of events based on the passed StreamEventsRequest. */ rpc Stream (StreamEventsRequest) returns (stream StreamEventsResponse); - /* Gets the current _head_ of the Event Store. The _head_ points to a sequence of the first event to be appended. */ + /* Gets the current _head_ of the Event Store. The _head_ points to the sequence of the first event to be appended. */ rpc GetHead (GetHeadRequest) returns (GetHeadResponse); /* Gets the current _tail_ of the Event Store. The _tail_ points to a sequence of the first event stored. */ From 25f1f0ed8150336e42ee237e4a96244129ac41e1 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:34:32 +0200 Subject: [PATCH 26/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index e4912e8..e07fd8d 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -17,7 +17,7 @@ service DcbEventStore { /* Gets the current _head_ of the Event Store. The _head_ points to the sequence of the first event to be appended. */ rpc GetHead (GetHeadRequest) returns (GetHeadResponse); - /* Gets the current _tail_ of the Event Store. The _tail_ points to a sequence of the first event stored. */ + /* Gets the current _tail_ of the Event Store. The _tail_ points to the sequence of the first event stored. */ rpc GetTail (GetTailRequest) returns (GetTailResponse); /* Gets the sequence of the event whose timestamp approximately matches the given request. It returns the first From 883ceec3ee869ec5f6f70e349374d62aa864e820 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:34:45 +0200 Subject: [PATCH 27/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index e07fd8d..0617f50 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -133,7 +133,7 @@ message AppendEventsResponse { /* The consistency marker which may be used for a subsequent append events requests. Do note that during the time this consistency marker may get far behind the head of the event store which will increase the time needed for the append events request to be validated. If you don't plan to do subsequent append events requests in a "short" period of time, - use Source RPC to refresh the consistency marker. */ + use the Source RPC to refresh the consistency marker. */ int64 consistency_marker = 3; } From c0fa2795c31a619057779cef0b841f4010176dde Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:35:07 +0200 Subject: [PATCH 28/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 0617f50..d4bef04 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -151,8 +151,7 @@ message SourceEventsRequest { } /* The response to the SourceEventsRequest. It consists either of an event (with its corresponding sequence) or a -consistency marker. The consistency marker should be used in the following AppendEventsRequest related to the same -criteria. */ +consistency marker. The consistency marker should be used in a following AppendEventsRequest related to the criteria used in the SourceEventsRequest this response originates from. */ message SourceEventsResponse { oneof result { From fd217b3d63409c3752b56d1e2027ef226be66717 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:35:20 +0200 Subject: [PATCH 29/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index d4bef04..7f02a8c 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -168,7 +168,7 @@ message SourceEventsResponse { message ConsistencyCondition { /* The sequence used to start checking for the consistency of an append. If there are events with a sequence greater - or equal than the consistency marker, and are matching the given criteria the condition is not met and the transaction + or equal than the consistency marker and those are matching the given criteria, the condition is not met and the transaction is rejected. Otherwise, it is accepted. */ int64 consistency_marker = 1; From 82d111c4f028543490cc81b77c44e4ada94be1ad Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:35:36 +0200 Subject: [PATCH 30/31] Update src/main/proto/dcb.proto Co-authored-by: Steven van Beelen --- src/main/proto/dcb.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index 7f02a8c..f5402a2 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -240,7 +240,7 @@ message GetTailResponse { int64 sequence = 1; } -/* The request to get the sequence of the event whose timestamp the same as the timestamp provided in the request. +/* The request to get the sequence of the event whose timestamp is the same as the timestamp provided in the request. If there are no events with the exact timestamp, then the sequence of the first one after the provided timestamp is returned. If the provided timestamp is greater that the sequence of the last event in the event store, the HEAD is returned. */ From e4918269c00b0e08a745a0f0b4bce40e737c3665 Mon Sep 17 00:00:00 2001 From: Milan Savic Date: Thu, 15 May 2025 16:41:00 +0200 Subject: [PATCH 31/31] Docs adaption after the review. --- src/main/proto/dcb.proto | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/proto/dcb.proto b/src/main/proto/dcb.proto index f5402a2..6a6d2c7 100644 --- a/src/main/proto/dcb.proto +++ b/src/main/proto/dcb.proto @@ -20,9 +20,8 @@ service DcbEventStore { /* Gets the current _tail_ of the Event Store. The _tail_ points to the sequence of the first event stored. */ rpc GetTail (GetTailRequest) returns (GetTailResponse); - /* Gets the sequence of the event whose timestamp approximately matches the given request. It returns the first - event whose timestamp is greater or equal than the provided timestamp. If the provided timestamp is after the - timestamp of the last event in the event store, the HEAD is returned. + /* Returns the lowest sequence of an event with a timestamp equal to or higher than the given timestamp. The HEAD is + returned if no events exist with a timestamp equal to or higher than the given timestamp. N.B. Axon Server does not assign timestamps to events. The timestamps used for fulfilling this RPC are timestamps provided by the client. It could happen that there are events after the returned sequence that have an earlier @@ -279,7 +278,7 @@ message RemoveTagsRequest { /* The sequence of the event whose tags should be removed. */ int64 sequence = 1; - /* Tags to be removed. */ + /* Tags to be removed. If the event is not tagged with listed tags, they are skipped. */ repeated Tag tag = 2; }