diff --git a/protobuf/flow/executiondata/executiondata.proto b/protobuf/flow/executiondata/executiondata.proto index 582266d7f..aa0558aea 100644 --- a/protobuf/flow/executiondata/executiondata.proto +++ b/protobuf/flow/executiondata/executiondata.proto @@ -6,23 +6,170 @@ option go_package = "github.com/onflow/flow/protobuf/go/flow/access"; option java_package = "org.onflow.protobuf.access"; import "flow/entities/block_execution_data.proto"; +import "flow/entities/event.proto"; +import "google/protobuf/timestamp.proto"; -// ExecutionDataAPI is the API for providing Execution state sync data, currently from Access Nodes +// Execution Data API provides access to execution data from the Flow network service ExecutionDataAPI { - // ExecutionState - // GetExecutionDataByBlockID returns the execution_data object. Currently for - // use by the archive node to update its execution state. + // GetExecutionDataByBlockID returns execution data for a specific block ID. + // + // Errors: + // - InvalidArgument is returned if the request contains an invalid block ID. + // - NotFound is returned if the start block or execution data are 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 GetExecutionDataByBlockID(GetExecutionDataByBlockIDRequest) returns (GetExecutionDataByBlockIDResponse); -} -// Execution State + // SubscribeExecutionData 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 SubscribeExecutionData(SubscribeExecutionDataRequest) + 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 reached, the stream will remain open and responses + // are sent for each new block as it becomes available. + // + // Events within each block are filtered by the provided EventFilter, and only those events that + // match the filter are returned. If no filter is provided, all events are returned. + // + // Responses are returned for each block containing at least one event that matches the filter. + // Additionally, heatbeat responses (SubscribeEventsResponse with no events) are returned + // periodically to allow clients to track which blocks were searched. Clients can use this + // information to determine which block to start from when reconnecting. + // + // Errors: + // - InvalidArgument is returned if the request contains an invalid EventFilter or 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 SubscribeEvents(SubscribeEventsRequest) + returns (stream SubscribeEventsResponse); +} +// The request for GetExecutionDataByBlockID message GetExecutionDataByBlockIDRequest { + // Block ID of the block to get execution data for. bytes block_id = 1; } +// The response for GetExecutionDataByBlockID message GetExecutionDataByBlockIDResponse { + // BlockExecutionData for the block. entities.BlockExecutionData block_execution_data = 1; -} \ No newline at end of file +} + +// The request for SubscribeExecutionData +message SubscribeExecutionDataRequest { + // Block ID of the first block to get execution data for. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + bytes start_block_id = 1; + + // Block height of the first block to get execution data for. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + uint64 start_block_height = 2; +} + +// The response for SubscribeExecutionData +message SubscribeExecutionDataResponse { + // Block height of the block containing the execution data. + uint64 block_height = 1; + + // BlockExecutionData for the block. + // Note: The block's ID is included within the BlockExecutionData. + entities.BlockExecutionData block_execution_data = 2; + + // Timestamp from the block containing the execution data. + google.protobuf.Timestamp block_timestamp = 3; +} + +// The request for SubscribeEvents +message SubscribeEventsRequest { + // Block ID of the first block to search for events. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + bytes start_block_id = 1; + + // Block height of the first block to search for events. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + uint64 start_block_height = 2; + + // Filter to apply to events for each block searched. + // If no filter is provided, all events are returned. + EventFilter filter = 3; + + // Interval in block heights at which the server should return a heartbeat message to the client. + // The heartbeat is a normal SubscribeEventsResponse with no events, and allows clients to track + // which blocks were searched. Clients can use this information to determine which block to start + // from when reconnecting. + // + // The interval is calculated from the last response returned, which could be either another + // heartbeat or a response containing events. + uint64 heartbeat_interval = 4; +} + +// The response for SubscribeEvents +message SubscribeEventsResponse { + // Block ID of the block containing the events. + bytes block_id = 1; + + // Block height of the block containing the events. + uint64 block_height = 2; + + // Events matching the EventFilter in the request. + // The API may return no events which signals a periodic heartbeat. This allows clients to track + // which blocks were searched. Client can use this information to determine which block to start + // from when reconnecting. + repeated entities.Event events = 3; + + // Timestamp from the block containing the events. + google.protobuf.Timestamp block_timestamp = 4; +} + +// EventFilter defines the filter to apply to block events. +// Filters are applied as an OR operation, i.e. any event matching any of the filters is returned. +// If no filters are provided, all events are returned. +// If there are any invalid filters, the API will return an InvalidArgument error. +message EventFilter { + // A list of full event types to include. + // + // All events exactly matching any of the provided event types will be returned. + // + // Event types have 2 formats: + // - Protocol events: + // flow.[event name] + // - Smart contract events: + // A.[contract address].[contract name].[event name] + repeated string event_type = 1; + + // A list of contracts who's events should be included. + // + // All events emitted by any of the provided contracts will be returned. + // + // Contracts have the following name formats: + // - Protocol events: + // flow + // - Smart contract events: + // A.[contract address].[contract name] + // + // This filter matches on the full contract including its address, not just the contract's name. + repeated string contract = 2; + + // A list of addresses who's events should be included. + // + // All events emitted by any contract held by any of the provided addresses will be returned. + // + // Addresses must be Flow account addresses in hex format and valid for the network the node + // is connected to. i.e. only a mainnet address is valid for a mainnet node. + // Addresses may optionally include the 0x prefix. + repeated string address = 3; +} diff --git a/protobuf/go/flow/executiondata/executiondata.pb.go b/protobuf/go/flow/executiondata/executiondata.pb.go index 8896b2977..d6e90e5ec 100644 --- a/protobuf/go/flow/executiondata/executiondata.pb.go +++ b/protobuf/go/flow/executiondata/executiondata.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" proto "github.com/golang/protobuf/proto" entities "github.com/onflow/flow/protobuf/go/flow/entities" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" math "math" ) @@ -21,7 +22,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// The request for GetExecutionDataByBlockID type GetExecutionDataByBlockIDRequest struct { + // Block ID of the block to get execution data for. BlockId []byte `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -60,7 +63,9 @@ func (m *GetExecutionDataByBlockIDRequest) GetBlockId() []byte { return nil } +// The response for GetExecutionDataByBlockID type GetExecutionDataByBlockIDResponse struct { + // BlockExecutionData for the block. BlockExecutionData *entities.BlockExecutionData `protobuf:"bytes,1,opt,name=block_execution_data,json=blockExecutionData,proto3" json:"block_execution_data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -99,9 +104,364 @@ func (m *GetExecutionDataByBlockIDResponse) GetBlockExecutionData() *entities.Bl return nil } +// The request for SubscribeExecutionData +type SubscribeExecutionDataRequest struct { + // Block ID of the first block to get execution data for. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + StartBlockId []byte `protobuf:"bytes,1,opt,name=start_block_id,json=startBlockId,proto3" json:"start_block_id,omitempty"` + // Block height of the first block to get execution data for. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + StartBlockHeight uint64 `protobuf:"varint,2,opt,name=start_block_height,json=startBlockHeight,proto3" json:"start_block_height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SubscribeExecutionDataRequest) Reset() { *m = SubscribeExecutionDataRequest{} } +func (m *SubscribeExecutionDataRequest) String() string { return proto.CompactTextString(m) } +func (*SubscribeExecutionDataRequest) ProtoMessage() {} +func (*SubscribeExecutionDataRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_da469632570513fb, []int{2} +} + +func (m *SubscribeExecutionDataRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SubscribeExecutionDataRequest.Unmarshal(m, b) +} +func (m *SubscribeExecutionDataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SubscribeExecutionDataRequest.Marshal(b, m, deterministic) +} +func (m *SubscribeExecutionDataRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubscribeExecutionDataRequest.Merge(m, src) +} +func (m *SubscribeExecutionDataRequest) XXX_Size() int { + return xxx_messageInfo_SubscribeExecutionDataRequest.Size(m) +} +func (m *SubscribeExecutionDataRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SubscribeExecutionDataRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SubscribeExecutionDataRequest proto.InternalMessageInfo + +func (m *SubscribeExecutionDataRequest) GetStartBlockId() []byte { + if m != nil { + return m.StartBlockId + } + return nil +} + +func (m *SubscribeExecutionDataRequest) GetStartBlockHeight() uint64 { + if m != nil { + return m.StartBlockHeight + } + return 0 +} + +// The response for SubscribeExecutionData +type SubscribeExecutionDataResponse struct { + // Block height of the block containing the execution data. + BlockHeight uint64 `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // BlockExecutionData for the block. + // Note: The block's ID is included within the BlockExecutionData. + BlockExecutionData *entities.BlockExecutionData `protobuf:"bytes,2,opt,name=block_execution_data,json=blockExecutionData,proto3" json:"block_execution_data,omitempty"` + // Timestamp from the block containing the execution data. + BlockTimestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SubscribeExecutionDataResponse) Reset() { *m = SubscribeExecutionDataResponse{} } +func (m *SubscribeExecutionDataResponse) String() string { return proto.CompactTextString(m) } +func (*SubscribeExecutionDataResponse) ProtoMessage() {} +func (*SubscribeExecutionDataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_da469632570513fb, []int{3} +} + +func (m *SubscribeExecutionDataResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SubscribeExecutionDataResponse.Unmarshal(m, b) +} +func (m *SubscribeExecutionDataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SubscribeExecutionDataResponse.Marshal(b, m, deterministic) +} +func (m *SubscribeExecutionDataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubscribeExecutionDataResponse.Merge(m, src) +} +func (m *SubscribeExecutionDataResponse) XXX_Size() int { + return xxx_messageInfo_SubscribeExecutionDataResponse.Size(m) +} +func (m *SubscribeExecutionDataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SubscribeExecutionDataResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SubscribeExecutionDataResponse proto.InternalMessageInfo + +func (m *SubscribeExecutionDataResponse) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *SubscribeExecutionDataResponse) GetBlockExecutionData() *entities.BlockExecutionData { + if m != nil { + return m.BlockExecutionData + } + return nil +} + +func (m *SubscribeExecutionDataResponse) GetBlockTimestamp() *timestamppb.Timestamp { + if m != nil { + return m.BlockTimestamp + } + return nil +} + +// The request for SubscribeEvents +type SubscribeEventsRequest struct { + // Block ID of the first block to search for events. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + StartBlockId []byte `protobuf:"bytes,1,opt,name=start_block_id,json=startBlockId,proto3" json:"start_block_id,omitempty"` + // Block height of the first block to search for events. + // Only one of start_block_id and start_block_height may be provided, otherwise an InvalidArgument + // error is returned. If neither are provided, the latest sealed block is used. + StartBlockHeight uint64 `protobuf:"varint,2,opt,name=start_block_height,json=startBlockHeight,proto3" json:"start_block_height,omitempty"` + // Filter to apply to events for each block searched. + // If no filter is provided, all events are returned. + Filter *EventFilter `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + // Interval in block heights at which the server should return a heartbeat message to the client. + // The heartbeat is a normal SubscribeEventsResponse with no events, and allows clients to track + // which blocks were searched. Clients can use this information to determine which block to start + // from when reconnecting. + // + // The interval is calculated from the last response returned, which could be either another + // heartbeat or a response containing events. + HeartbeatInterval uint64 `protobuf:"varint,4,opt,name=heartbeat_interval,json=heartbeatInterval,proto3" json:"heartbeat_interval,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SubscribeEventsRequest) Reset() { *m = SubscribeEventsRequest{} } +func (m *SubscribeEventsRequest) String() string { return proto.CompactTextString(m) } +func (*SubscribeEventsRequest) ProtoMessage() {} +func (*SubscribeEventsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_da469632570513fb, []int{4} +} + +func (m *SubscribeEventsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SubscribeEventsRequest.Unmarshal(m, b) +} +func (m *SubscribeEventsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SubscribeEventsRequest.Marshal(b, m, deterministic) +} +func (m *SubscribeEventsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubscribeEventsRequest.Merge(m, src) +} +func (m *SubscribeEventsRequest) XXX_Size() int { + return xxx_messageInfo_SubscribeEventsRequest.Size(m) +} +func (m *SubscribeEventsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SubscribeEventsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SubscribeEventsRequest proto.InternalMessageInfo + +func (m *SubscribeEventsRequest) GetStartBlockId() []byte { + if m != nil { + return m.StartBlockId + } + return nil +} + +func (m *SubscribeEventsRequest) GetStartBlockHeight() uint64 { + if m != nil { + return m.StartBlockHeight + } + return 0 +} + +func (m *SubscribeEventsRequest) GetFilter() *EventFilter { + if m != nil { + return m.Filter + } + return nil +} + +func (m *SubscribeEventsRequest) GetHeartbeatInterval() uint64 { + if m != nil { + return m.HeartbeatInterval + } + return 0 +} + +// The response for SubscribeEvents +type SubscribeEventsResponse struct { + // Block ID of the block containing the events. + BlockId []byte `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + // Block height of the block containing the events. + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // Events matching the EventFilter in the request. + // The API may return no events which signals a periodic heartbeat. This allows clients to track + // which blocks were searched. Client can use this information to determine which block to start + // from when reconnecting. + Events []*entities.Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` + // Timestamp from the block containing the events. + BlockTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SubscribeEventsResponse) Reset() { *m = SubscribeEventsResponse{} } +func (m *SubscribeEventsResponse) String() string { return proto.CompactTextString(m) } +func (*SubscribeEventsResponse) ProtoMessage() {} +func (*SubscribeEventsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_da469632570513fb, []int{5} +} + +func (m *SubscribeEventsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SubscribeEventsResponse.Unmarshal(m, b) +} +func (m *SubscribeEventsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SubscribeEventsResponse.Marshal(b, m, deterministic) +} +func (m *SubscribeEventsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubscribeEventsResponse.Merge(m, src) +} +func (m *SubscribeEventsResponse) XXX_Size() int { + return xxx_messageInfo_SubscribeEventsResponse.Size(m) +} +func (m *SubscribeEventsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SubscribeEventsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SubscribeEventsResponse proto.InternalMessageInfo + +func (m *SubscribeEventsResponse) GetBlockId() []byte { + if m != nil { + return m.BlockId + } + return nil +} + +func (m *SubscribeEventsResponse) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *SubscribeEventsResponse) GetEvents() []*entities.Event { + if m != nil { + return m.Events + } + return nil +} + +func (m *SubscribeEventsResponse) GetBlockTimestamp() *timestamppb.Timestamp { + if m != nil { + return m.BlockTimestamp + } + return nil +} + +// EventFilter defines the filter to apply to block events. +// Filters are applied as an OR operation, i.e. any event matching any of the filters is returned. +// If no filters are provided, all events are returned. +// If there are any invalid filters, the API will return an InvalidArgument error. +type EventFilter struct { + // A list of full event types to include. + // + // All events exactly matching any of the provided event types will be returned. + // + // Event types have 2 formats: + // - Protocol events: + // flow.[event name] + // - Smart contract events: + // A.[contract address].[contract name].[event name] + EventType []string `protobuf:"bytes,1,rep,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + // A list of contracts who's events should be included. + // + // All events emitted by any of the provided contracts will be returned. + // + // Contracts have the following name formats: + // - Protocol events: + // flow + // - Smart contract events: + // A.[contract address].[contract name] + // + // This filter matches on the full contract including its address, not just the contract's name. + Contract []string `protobuf:"bytes,2,rep,name=contract,proto3" json:"contract,omitempty"` + // A list of addresses who's events should be included. + // + // All events emitted by any contract held by any of the provided addresses will be returned. + // + // Addresses must be Flow account addresses in hex format and valid for the network the node + // is connected to. i.e. only a mainnet address is valid for a mainnet node. + // Addresses may optionally include the 0x prefix. + Address []string `protobuf:"bytes,3,rep,name=address,proto3" json:"address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EventFilter) Reset() { *m = EventFilter{} } +func (m *EventFilter) String() string { return proto.CompactTextString(m) } +func (*EventFilter) ProtoMessage() {} +func (*EventFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_da469632570513fb, []int{6} +} + +func (m *EventFilter) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EventFilter.Unmarshal(m, b) +} +func (m *EventFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EventFilter.Marshal(b, m, deterministic) +} +func (m *EventFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventFilter.Merge(m, src) +} +func (m *EventFilter) XXX_Size() int { + return xxx_messageInfo_EventFilter.Size(m) +} +func (m *EventFilter) XXX_DiscardUnknown() { + xxx_messageInfo_EventFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_EventFilter proto.InternalMessageInfo + +func (m *EventFilter) GetEventType() []string { + if m != nil { + return m.EventType + } + return nil +} + +func (m *EventFilter) GetContract() []string { + if m != nil { + return m.Contract + } + return nil +} + +func (m *EventFilter) GetAddress() []string { + if m != nil { + return m.Address + } + return nil +} + func init() { proto.RegisterType((*GetExecutionDataByBlockIDRequest)(nil), "flow.access.GetExecutionDataByBlockIDRequest") proto.RegisterType((*GetExecutionDataByBlockIDResponse)(nil), "flow.access.GetExecutionDataByBlockIDResponse") + proto.RegisterType((*SubscribeExecutionDataRequest)(nil), "flow.access.SubscribeExecutionDataRequest") + proto.RegisterType((*SubscribeExecutionDataResponse)(nil), "flow.access.SubscribeExecutionDataResponse") + proto.RegisterType((*SubscribeEventsRequest)(nil), "flow.access.SubscribeEventsRequest") + proto.RegisterType((*SubscribeEventsResponse)(nil), "flow.access.SubscribeEventsResponse") + proto.RegisterType((*EventFilter)(nil), "flow.access.EventFilter") } func init() { @@ -109,21 +469,42 @@ func init() { } var fileDescriptor_da469632570513fb = []byte{ - // 256 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xcb, 0xc9, 0x2f, - 0xd7, 0x4f, 0xad, 0x48, 0x4d, 0x2e, 0x2d, 0xc9, 0xcc, 0xcf, 0x4b, 0x49, 0x2c, 0x49, 0x44, 0xe5, - 0xe9, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x71, 0x83, 0xd4, 0xe9, 0x25, 0x26, 0x27, 0xa7, 0x16, - 0x17, 0x4b, 0x69, 0x40, 0x34, 0xe5, 0x95, 0x64, 0x96, 0x64, 0xa6, 0x16, 0xeb, 0x27, 0xe5, 0xe4, - 0x27, 0x67, 0xc7, 0xc3, 0x75, 0xc5, 0x23, 0xb4, 0x29, 0xd9, 0x72, 0x29, 0xb8, 0xa7, 0x96, 0xb8, - 0xc2, 0xa4, 0x5c, 0x12, 0x4b, 0x12, 0x9d, 0x2a, 0x9d, 0x40, 0xea, 0x3d, 0x5d, 0x82, 0x52, 0x0b, - 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x24, 0xb9, 0x38, 0x20, 0x26, 0x64, 0xa6, 0x48, 0x30, 0x2a, 0x30, - 0x6a, 0xf0, 0x04, 0xb1, 0x83, 0xf9, 0x9e, 0x29, 0x4a, 0x15, 0x5c, 0x8a, 0x78, 0xb4, 0x17, 0x17, - 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x05, 0x73, 0x89, 0x60, 0x73, 0x01, 0xd8, 0x2c, 0x6e, 0x23, 0x45, - 0x3d, 0xb0, 0xcb, 0x61, 0x8e, 0xd5, 0x03, 0xeb, 0x46, 0x31, 0x31, 0x48, 0x28, 0x09, 0x43, 0xcc, - 0xa8, 0x8f, 0x91, 0x4b, 0x00, 0x45, 0xc4, 0x31, 0xc0, 0x53, 0xa8, 0x8a, 0x4b, 0x12, 0xa7, 0x73, - 0x84, 0x74, 0xf5, 0x90, 0x82, 0x48, 0x8f, 0x90, 0xaf, 0xa5, 0xf4, 0x88, 0x55, 0x0e, 0xf1, 0xa5, - 0x93, 0x0f, 0x97, 0x54, 0x7e, 0x51, 0xba, 0x5e, 0x7e, 0x1e, 0x58, 0x1b, 0x38, 0x74, 0x93, 0x4a, - 0xd3, 0xa0, 0xfa, 0xa3, 0xf4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, - 0x21, 0x4a, 0xf4, 0xc1, 0x04, 0x4c, 0x9d, 0x7e, 0x7a, 0x3e, 0x44, 0x00, 0xa2, 0x3e, 0x89, 0x0d, - 0x2c, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x1d, 0x90, 0xc5, 0xff, 0x01, 0x00, 0x00, + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x95, 0x93, 0x2a, 0x6d, 0x26, 0x51, 0x5b, 0x56, 0x15, 0x38, 0x96, 0x0a, 0x89, 0xa9, 0x50, + 0x04, 0xed, 0xba, 0x0a, 0x67, 0x0e, 0x84, 0xf2, 0x11, 0x89, 0x03, 0x72, 0x7b, 0xe2, 0x40, 0xb4, + 0xb6, 0x37, 0x8e, 0x45, 0xe2, 0x0d, 0xde, 0x49, 0x69, 0xf8, 0x89, 0x48, 0xfc, 0x04, 0x4e, 0xfc, + 0x11, 0x94, 0x5d, 0xdb, 0x89, 0x93, 0x26, 0x14, 0x21, 0x2e, 0x96, 0x66, 0xe6, 0xcd, 0x9b, 0xd9, + 0x7d, 0x6f, 0x0d, 0x4f, 0x06, 0x23, 0xf1, 0xd5, 0xe1, 0x37, 0xdc, 0x9f, 0x62, 0x24, 0xe2, 0x80, + 0x21, 0x2b, 0x46, 0x74, 0x92, 0x08, 0x14, 0xa4, 0x36, 0xc7, 0x51, 0xe6, 0xfb, 0x5c, 0x4a, 0xab, + 0xad, 0x9b, 0x62, 0x8c, 0x30, 0xe2, 0xd2, 0xf1, 0x46, 0xc2, 0xff, 0xdc, 0xcf, 0xbb, 0xfa, 0x8b, + 0x36, 0xab, 0x51, 0x44, 0xf2, 0x6b, 0x1e, 0x63, 0x5a, 0x7a, 0x14, 0x0a, 0x11, 0x8e, 0xb8, 0xa3, + 0x22, 0x6f, 0x3a, 0x70, 0x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a, + 0x76, 0x27, 0xac, 0x1e, 0x79, 0x6e, 0x90, 0x4f, 0x70, 0xb0, 0xe2, 0x1a, 0xf2, 0x78, 0x03, 0xc3, + 0xf2, 0x1b, 0xb1, 0x4e, 0xb6, 0x83, 0x32, 0xfe, 0xee, 0x7b, 0xb0, 0x44, 0x12, 0x52, 0x11, 0x2b, + 0x78, 0x2e, 0xbd, 0xee, 0xfb, 0x48, 0xc3, 0x08, 0x87, 0x53, 0x8f, 0xfa, 0x62, 0xec, 0x68, 0x88, + 0xa3, 0x3e, 0xf9, 0x3f, 0x3c, 0x14, 0x3a, 0xa1, 0xf1, 0x5e, 0x45, 0x15, 0x9e, 0xff, 0x0e, 0x00, + 0x00, 0xff, 0xff, 0xd5, 0x32, 0xcc, 0x95, 0x66, 0x06, 0x00, 0x00, } diff --git a/protobuf/go/flow/executiondata/executiondata_grpc.pb.go b/protobuf/go/flow/executiondata/executiondata_grpc.pb.go index 34c91b136..5e101ee33 100644 --- a/protobuf/go/flow/executiondata/executiondata_grpc.pb.go +++ b/protobuf/go/flow/executiondata/executiondata_grpc.pb.go @@ -22,7 +22,40 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ExecutionDataAPIClient interface { + // GetExecutionDataByBlockID returns execution data for a specific block ID. + // + // Errors: + // - InvalidArgument is returned if the request contains an invalid block ID. + // - NotFound is returned if the start block or execution data are 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. GetExecutionDataByBlockID(ctx context.Context, in *GetExecutionDataByBlockIDRequest, opts ...grpc.CallOption) (*GetExecutionDataByBlockIDResponse, error) + // SubscribeExecutionData 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. + SubscribeExecutionData(ctx context.Context, in *SubscribeExecutionDataRequest, opts ...grpc.CallOption) (ExecutionDataAPI_SubscribeExecutionDataClient, error) + // SubscribeEvents streams events 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 block as it becomes available. + // + // Events within each block are filtered by the provided EventFilter, and only those events that + // match the filter are returned. If no filter is provided, all events are returned. + // + // Responses are returned for each block containing at least one event that matches the filter. + // Additionally, heatbeat responses (SubscribeEventsResponse with no events) are returned + // periodically to allow clients to track which blocks were searched. Clients can use this + // information to determine which block to start from when reconnecting. + // + // Errors: + // - InvalidArgument is returned if the request contains an invalid EventFilter or 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. + SubscribeEvents(ctx context.Context, in *SubscribeEventsRequest, opts ...grpc.CallOption) (ExecutionDataAPI_SubscribeEventsClient, error) } type executionDataAPIClient struct { @@ -42,11 +75,108 @@ func (c *executionDataAPIClient) GetExecutionDataByBlockID(ctx context.Context, return out, nil } +func (c *executionDataAPIClient) SubscribeExecutionData(ctx context.Context, in *SubscribeExecutionDataRequest, opts ...grpc.CallOption) (ExecutionDataAPI_SubscribeExecutionDataClient, error) { + stream, err := c.cc.NewStream(ctx, &ExecutionDataAPI_ServiceDesc.Streams[0], "/flow.access.ExecutionDataAPI/SubscribeExecutionData", opts...) + if err != nil { + return nil, err + } + x := &executionDataAPISubscribeExecutionDataClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ExecutionDataAPI_SubscribeExecutionDataClient interface { + Recv() (*SubscribeExecutionDataResponse, error) + grpc.ClientStream +} + +type executionDataAPISubscribeExecutionDataClient struct { + grpc.ClientStream +} + +func (x *executionDataAPISubscribeExecutionDataClient) Recv() (*SubscribeExecutionDataResponse, error) { + m := new(SubscribeExecutionDataResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *executionDataAPIClient) SubscribeEvents(ctx context.Context, in *SubscribeEventsRequest, opts ...grpc.CallOption) (ExecutionDataAPI_SubscribeEventsClient, error) { + stream, err := c.cc.NewStream(ctx, &ExecutionDataAPI_ServiceDesc.Streams[1], "/flow.access.ExecutionDataAPI/SubscribeEvents", opts...) + if err != nil { + return nil, err + } + x := &executionDataAPISubscribeEventsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ExecutionDataAPI_SubscribeEventsClient interface { + Recv() (*SubscribeEventsResponse, error) + grpc.ClientStream +} + +type executionDataAPISubscribeEventsClient struct { + grpc.ClientStream +} + +func (x *executionDataAPISubscribeEventsClient) Recv() (*SubscribeEventsResponse, error) { + m := new(SubscribeEventsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // ExecutionDataAPIServer is the server API for ExecutionDataAPI service. // All implementations should embed UnimplementedExecutionDataAPIServer // for forward compatibility type ExecutionDataAPIServer interface { + // GetExecutionDataByBlockID returns execution data for a specific block ID. + // + // Errors: + // - InvalidArgument is returned if the request contains an invalid block ID. + // - NotFound is returned if the start block or execution data are 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. GetExecutionDataByBlockID(context.Context, *GetExecutionDataByBlockIDRequest) (*GetExecutionDataByBlockIDResponse, error) + // SubscribeExecutionData 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. + SubscribeExecutionData(*SubscribeExecutionDataRequest, ExecutionDataAPI_SubscribeExecutionDataServer) error + // SubscribeEvents streams events 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 block as it becomes available. + // + // Events within each block are filtered by the provided EventFilter, and only those events that + // match the filter are returned. If no filter is provided, all events are returned. + // + // Responses are returned for each block containing at least one event that matches the filter. + // Additionally, heatbeat responses (SubscribeEventsResponse with no events) are returned + // periodically to allow clients to track which blocks were searched. Clients can use this + // information to determine which block to start from when reconnecting. + // + // Errors: + // - InvalidArgument is returned if the request contains an invalid EventFilter or 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. + SubscribeEvents(*SubscribeEventsRequest, ExecutionDataAPI_SubscribeEventsServer) error } // UnimplementedExecutionDataAPIServer should be embedded to have forward compatible implementations. @@ -56,6 +186,12 @@ type UnimplementedExecutionDataAPIServer struct { func (UnimplementedExecutionDataAPIServer) GetExecutionDataByBlockID(context.Context, *GetExecutionDataByBlockIDRequest) (*GetExecutionDataByBlockIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetExecutionDataByBlockID not implemented") } +func (UnimplementedExecutionDataAPIServer) SubscribeExecutionData(*SubscribeExecutionDataRequest, ExecutionDataAPI_SubscribeExecutionDataServer) error { + return status.Errorf(codes.Unimplemented, "method SubscribeExecutionData not implemented") +} +func (UnimplementedExecutionDataAPIServer) SubscribeEvents(*SubscribeEventsRequest, ExecutionDataAPI_SubscribeEventsServer) error { + return status.Errorf(codes.Unimplemented, "method SubscribeEvents not implemented") +} // UnsafeExecutionDataAPIServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ExecutionDataAPIServer will @@ -86,6 +222,48 @@ func _ExecutionDataAPI_GetExecutionDataByBlockID_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _ExecutionDataAPI_SubscribeExecutionData_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SubscribeExecutionDataRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExecutionDataAPIServer).SubscribeExecutionData(m, &executionDataAPISubscribeExecutionDataServer{stream}) +} + +type ExecutionDataAPI_SubscribeExecutionDataServer interface { + Send(*SubscribeExecutionDataResponse) error + grpc.ServerStream +} + +type executionDataAPISubscribeExecutionDataServer struct { + grpc.ServerStream +} + +func (x *executionDataAPISubscribeExecutionDataServer) Send(m *SubscribeExecutionDataResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _ExecutionDataAPI_SubscribeEvents_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SubscribeEventsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExecutionDataAPIServer).SubscribeEvents(m, &executionDataAPISubscribeEventsServer{stream}) +} + +type ExecutionDataAPI_SubscribeEventsServer interface { + Send(*SubscribeEventsResponse) error + grpc.ServerStream +} + +type executionDataAPISubscribeEventsServer struct { + grpc.ServerStream +} + +func (x *executionDataAPISubscribeEventsServer) Send(m *SubscribeEventsResponse) error { + return x.ServerStream.SendMsg(m) +} + // ExecutionDataAPI_ServiceDesc is the grpc.ServiceDesc for ExecutionDataAPI service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -98,6 +276,17 @@ var ExecutionDataAPI_ServiceDesc = grpc.ServiceDesc{ Handler: _ExecutionDataAPI_GetExecutionDataByBlockID_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "SubscribeExecutionData", + Handler: _ExecutionDataAPI_SubscribeExecutionData_Handler, + ServerStreams: true, + }, + { + StreamName: "SubscribeEvents", + Handler: _ExecutionDataAPI_SubscribeEvents_Handler, + ServerStreams: true, + }, + }, Metadata: "flow/executiondata/executiondata.proto", }