Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding service definitions for Projections #34

Merged
merged 9 commits into from
Mar 24, 2021
97 changes: 97 additions & 0 deletions Source/Runtime/Events.Processing/Projections.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

syntax = "proto3";

import "Fundamentals/Artifacts/Artifact.proto";
import "Fundamentals/Protobuf/Uuid.proto";
import "Fundamentals/Protobuf/Failure.proto";
import "Fundamentals/Services/ReverseCallContext.proto";
import "Fundamentals/Services/Ping.proto";
import "Runtime/Events.Processing/StreamEvent.proto";
import "Runtime/Events.Processing/Processors.proto";

package dolittle.runtime.events.processing;

option csharp_namespace = "Dolittle.Runtime.Events.Processing.Contracts";

enum ProjectEventKeySelectorType {
EVENT_SOURCE_ID = 0;
PARTITION_ID = 1;
PROPERTY = 2;
}

message ProjectionEventKeySelector {
ProjectEventKeySelectorType type = 1;
string expression = 2;
}

message ProjectionEventSelector {
artifacts.Artifact eventType = 1;
ProjectionEventKeySelector keySelector = 2;
}

message ProjectionRegistrationRequest {
services.ReverseCallArgumentsContext callContext = 1;
protobuf.Uuid scopeId = 2;
protobuf.Uuid projectionId = 3;
repeated ProjectionEventSelector events = 4;
string initialState = 5;
}

enum ProjectionNextStateType {
REPLACE = 0;
DELETE = 1;
}

message ProjectionNextState {
ProjectionNextStateType type = 1;
string value = 2;
}

message ProjectionResponse {
services.ReverseCallResponseContext callContext = 1;
ProjectionNextState nextState = 2;
ProcessorFailure failure = 3; // If not set/empty - no failure
}

message ProjectionClientToRuntimeMessage {
oneof Message {
ProjectionRegistrationRequest registrationRequest = 1;
ProjectionResponse handleResult = 2;
services.Pong pong = 3;
}
}

message ProjectionRegistrationResponse {
protobuf.Failure failure = 1;
}

enum ProjectionCurrentStateType {
CREATED_FROM_INITIAL_STATE = 0;
PERSISTED = 1;
}

message ProjectionCurrentState {
ProjectionCurrentStateType type = 1;
string state = 2;
}

message ProjectionRequest {
services.ReverseCallRequestContext callContext = 1;
ProjectionCurrentState currentState = 2;
StreamEvent event = 3;
RetryProcessingState retryProcessingState = 4;
}

message ProjectionRuntimeToClientMessage {
oneof Message {
ProjectionRegistrationResponse registrationResponse = 1;
ProjectionRequest handleRequest = 2;
services.Ping ping = 3;
}
}

service Projections {
rpc Connect(stream ProjectionClientToRuntimeMessage) returns(stream ProjectionRuntimeToClientMessage);
}