Skip to content

Commit

Permalink
Add new rpc endpoints
Browse files Browse the repository at this point in the history
Added the following endpoints
- SubscribeExecutionDataFromStartBlockID
- SubscribeExecutionDataFromStartBlockHeight
- SubscribeExecutionDataFromLatest
  • Loading branch information
k1nder10 committed Apr 23, 2024
1 parent 9113211 commit 0fd55a5
Show file tree
Hide file tree
Showing 3 changed files with 541 additions and 107 deletions.
75 changes: 73 additions & 2 deletions protobuf/flow/executiondata/executiondata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,46 @@ service ExecutionDataAPI {
rpc SubscribeExecutionData(SubscribeExecutionDataRequest)
returns (stream SubscribeExecutionDataResponse);

// Warning: this function is deprecated and will be removed in a future version.
// Use SubscribeEventsFromStartBlockID, SubscribeEventsFromStartHeight or SubscribeEventsFromLatest.
// SubscribeExecutionDataFromStartBlockID streams execution data for all blocks
// starting at the requested start block, up until the latest available block.
// Once the latest is reached, the stream will remain open and responses are
// sent for each new execution data as it becomes available.
//
// Errors:
// - InvalidArgument is returned if the request contains an invalid start
// block.
// - NotFound is returned if the start block is not currently available on the
// node. This may happen if the block was from a previous spork,
// or if the block has yet not been received.
rpc SubscribeExecutionDataFromStartBlockID(
SubscribeExecutionDataFromStartBlockIDRequest)
returns (stream SubscribeExecutionDataResponse);

// SubscribeExecutionDataFromStartBlockHeight streams execution data for all blocks
// starting at the requested start block, up until the latest available block.
// Once the latest is reached, the stream will remain open and responses are
// sent for each new execution data as it becomes available.
//
// Errors:
// - InvalidArgument is returned if the request contains an invalid start
// block.
// - NotFound is returned if the start block is not currently available on the
// node. This may happen if the block was from a previous spork,
// or if the block has yet not been received.
rpc SubscribeExecutionDataFromStartBlockHeight(
SubscribeExecutionDataFromStartBlockHeightRequest)
returns (stream SubscribeExecutionDataResponse);

// SubscribeExecutionDataFromStartBlockHeight streams execution data for all blocks
// starting from the latest block.
//
// Errors:
// - NotFound is returned if the start block is not currently available on the
// node. This may happen if the block was from a previous spork,
// or if the block has yet not been received.
rpc SubscribeExecutionDataFromLatest(SubscribeExecutionDataFromLatestRequest)
returns (stream SubscribeExecutionDataResponse);

//
// SubscribeEvents streams events for all blocks starting at the requested
// start block, up until the latest available block. Once the latest is
Expand Down Expand Up @@ -260,6 +298,39 @@ message SubscribeExecutionDataResponse {
google.protobuf.Timestamp block_timestamp = 3;
}

// The request for SubscribeExecutionDataFromStartBlockIDRequest
message SubscribeExecutionDataFromStartBlockIDRequest {
// Block ID of the first block to get execution data for.
bytes start_block_id = 1;

// Preferred event encoding version of the block events payload.
// Possible variants:
// 1. CCF
// 2. JSON-CDC
entities.EventEncodingVersion event_encoding_version = 2;
}

// The request for SubscribeExecutionDataFromStartBlockHeightRequest
message SubscribeExecutionDataFromStartBlockHeightRequest {
// Block height of the first block to get execution data for.
uint64 start_block_height = 1;

// Preferred event encoding version of the block events payload.
// Possible variants:
// 1. CCF
// 2. JSON-CDC
entities.EventEncodingVersion event_encoding_version = 2;
}

// The request for SubscribeExecutionDataFromLatestRequest
message SubscribeExecutionDataFromLatestRequest {
// Preferred event encoding version of the block events payload.
// Possible variants:
// 1. CCF
// 2. JSON-CDC
entities.EventEncodingVersion event_encoding_version = 1;
}

// The request for SubscribeEvents
message SubscribeEventsRequest {
// Block ID of the first block to search for events.
Expand Down
Loading

0 comments on commit 0fd55a5

Please sign in to comment.