Skip to content

Commit

Permalink
feat: implement batch map (#132)
Browse files Browse the repository at this point in the history
Signed-off-by: Sidhant Kohli <[email protected]>
  • Loading branch information
kohlisid authored Jul 2, 2024
1 parent 5b76519 commit 8f15f07
Show file tree
Hide file tree
Showing 19 changed files with 952 additions and 31 deletions.
73 changes: 50 additions & 23 deletions pkg/apis/proto/map/v1/map.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions pkg/apis/proto/map/v1/map.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ service Map {

// IsReady is the heartbeat endpoint for gRPC.
rpc IsReady(google.protobuf.Empty) returns (ReadyResponse);

// MapStreamFn is a bi-directional streaming rpc which applies a
// Map function on each element of the stream and then returns streams
// back MapResponse elements.
// TODO(map-batch): in the target state when we move the current
// unary implementation to bi-di as well, we can rename this and
// use a single rpc for both.
rpc MapStreamFn(stream MapRequest) returns (stream MapResponse);
}

/**
Expand All @@ -24,18 +32,25 @@ message MapRequest {
google.protobuf.Timestamp event_time = 3;
google.protobuf.Timestamp watermark = 4;
map<string, string> headers = 5;
string id = 6;
}

/**
* MapResponse represents a response element.
*/
// TODO(map-batch) - currently this is used by both batch map and unary map.
// Do we want to have a separate response struct for batch map responses
// which have only one element instead of a list of responses.
// In that case we need a different mechanism to indicate that all the responses for a given request
// have been completed.
message MapResponse {
message Result {
repeated string keys = 1;
bytes value = 2;
repeated string tags = 3;
}
repeated Result results = 1;
string id = 2;
}

/**
Expand Down
85 changes: 83 additions & 2 deletions pkg/apis/proto/map/v1/map_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f15f07

Please sign in to comment.