archive

package
v0.29.1-improved-proto Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var API_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "API",
	HandlerType: (*APIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetFirst",
			Handler:    _API_GetFirst_Handler,
		},
		{
			MethodName: "GetLast",
			Handler:    _API_GetLast_Handler,
		},
		{
			MethodName: "GetHeightForBlock",
			Handler:    _API_GetHeightForBlock_Handler,
		},
		{
			MethodName: "GetCommit",
			Handler:    _API_GetCommit_Handler,
		},
		{
			MethodName: "GetHeader",
			Handler:    _API_GetHeader_Handler,
		},
		{
			MethodName: "GetEvents",
			Handler:    _API_GetEvents_Handler,
		},
		{
			MethodName: "GetRegisterValues",
			Handler:    _API_GetRegisterValues_Handler,
		},
		{
			MethodName: "GetCollection",
			Handler:    _API_GetCollection_Handler,
		},
		{
			MethodName: "ListCollectionsForHeight",
			Handler:    _API_ListCollectionsForHeight_Handler,
		},
		{
			MethodName: "GetGuarantee",
			Handler:    _API_GetGuarantee_Handler,
		},
		{
			MethodName: "GetTransaction",
			Handler:    _API_GetTransaction_Handler,
		},
		{
			MethodName: "GetHeightForTransaction",
			Handler:    _API_GetHeightForTransaction_Handler,
		},
		{
			MethodName: "ListTransactionsForHeight",
			Handler:    _API_ListTransactionsForHeight_Handler,
		},
		{
			MethodName: "GetResult",
			Handler:    _API_GetResult_Handler,
		},
		{
			MethodName: "GetSeal",
			Handler:    _API_GetSeal_Handler,
		},
		{
			MethodName: "ListSealsForHeight",
			Handler:    _API_ListSealsForHeight_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api.proto",
}

API_ServiceDesc is the grpc.ServiceDesc for API service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var DefaultConfig = Config{
	// contains filtered or unexported fields
}

Functions

func RegisterAPIServer

func RegisterAPIServer(s grpc.ServiceRegistrar, srv APIServer)

Types

type APIClient

type APIClient interface {
	GetFirst(ctx context.Context, in *GetFirstRequest, opts ...grpc.CallOption) (*GetFirstResponse, error)
	GetLast(ctx context.Context, in *GetLastRequest, opts ...grpc.CallOption) (*GetLastResponse, error)
	GetHeightForBlock(ctx context.Context, in *GetHeightForBlockRequest, opts ...grpc.CallOption) (*GetHeightForBlockResponse, error)
	GetCommit(ctx context.Context, in *GetCommitRequest, opts ...grpc.CallOption) (*GetCommitResponse, error)
	GetHeader(ctx context.Context, in *GetHeaderRequest, opts ...grpc.CallOption) (*GetHeaderResponse, error)
	GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error)
	GetRegisterValues(ctx context.Context, in *GetRegisterValuesRequest, opts ...grpc.CallOption) (*GetRegisterValuesResponse, error)
	GetCollection(ctx context.Context, in *GetCollectionRequest, opts ...grpc.CallOption) (*GetCollectionResponse, error)
	ListCollectionsForHeight(ctx context.Context, in *ListCollectionsForHeightRequest, opts ...grpc.CallOption) (*ListCollectionsForHeightResponse, error)
	GetGuarantee(ctx context.Context, in *GetGuaranteeRequest, opts ...grpc.CallOption) (*GetGuaranteeResponse, error)
	GetTransaction(ctx context.Context, in *GetTransactionRequest, opts ...grpc.CallOption) (*GetTransactionResponse, error)
	GetHeightForTransaction(ctx context.Context, in *GetHeightForTransactionRequest, opts ...grpc.CallOption) (*GetHeightForTransactionResponse, error)
	ListTransactionsForHeight(ctx context.Context, in *ListTransactionsForHeightRequest, opts ...grpc.CallOption) (*ListTransactionsForHeightResponse, error)
	GetResult(ctx context.Context, in *GetResultRequest, opts ...grpc.CallOption) (*GetResultResponse, error)
	GetSeal(ctx context.Context, in *GetSealRequest, opts ...grpc.CallOption) (*GetSealResponse, error)
	ListSealsForHeight(ctx context.Context, in *ListSealsForHeightRequest, opts ...grpc.CallOption) (*ListSealsForHeightResponse, error)
}

APIClient is the client API for API service.

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.

func NewAPIClient

func NewAPIClient(cc grpc.ClientConnInterface) APIClient

type APIServer

type APIServer interface {
	GetFirst(context.Context, *GetFirstRequest) (*GetFirstResponse, error)
	GetLast(context.Context, *GetLastRequest) (*GetLastResponse, error)
	GetHeightForBlock(context.Context, *GetHeightForBlockRequest) (*GetHeightForBlockResponse, error)
	GetCommit(context.Context, *GetCommitRequest) (*GetCommitResponse, error)
	GetHeader(context.Context, *GetHeaderRequest) (*GetHeaderResponse, error)
	GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error)
	GetRegisterValues(context.Context, *GetRegisterValuesRequest) (*GetRegisterValuesResponse, error)
	GetCollection(context.Context, *GetCollectionRequest) (*GetCollectionResponse, error)
	ListCollectionsForHeight(context.Context, *ListCollectionsForHeightRequest) (*ListCollectionsForHeightResponse, error)
	GetGuarantee(context.Context, *GetGuaranteeRequest) (*GetGuaranteeResponse, error)
	GetTransaction(context.Context, *GetTransactionRequest) (*GetTransactionResponse, error)
	GetHeightForTransaction(context.Context, *GetHeightForTransactionRequest) (*GetHeightForTransactionResponse, error)
	ListTransactionsForHeight(context.Context, *ListTransactionsForHeightRequest) (*ListTransactionsForHeightResponse, error)
	GetResult(context.Context, *GetResultRequest) (*GetResultResponse, error)
	GetSeal(context.Context, *GetSealRequest) (*GetSealResponse, error)
	ListSealsForHeight(context.Context, *ListSealsForHeightRequest) (*ListSealsForHeightResponse, error)
	// contains filtered or unexported methods
}

APIServer is the server API for API service. All implementations must embed UnimplementedAPIServer for forward compatibility

type Config

type Config struct {
	// contains filtered or unexported fields
}

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index implements the `index.Reader` interface on top of the DPS server's GRPC API. It can substitute for the on-disk index reader when executing scripts, such that script invoker and execution state are on two different machines across a network.

func IndexFromAPI

func IndexFromAPI(client APIClient, codec archive.Codec) *Index

IndexFromAPI creates a new instance of an index reader that uses the provided GRPC API client to retrieve state from the index.

func (*Index) Collection

func (i *Index) Collection(collID flow.Identifier) (*flow.LightCollection, error)

Collection returns the collection with the given ID.

func (*Index) CollectionsByHeight

func (i *Index) CollectionsByHeight(height uint64) ([]flow.Identifier, error)

CollectionsByHeight returns the transaction IDs within the given block.

func (*Index) Commit

func (i *Index) Commit(height uint64) (flow.StateCommitment, error)

Commit returns the commitment of the execution state as it was after the execution of the finalized block at the given height.

func (*Index) Events

func (i *Index) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)

Events returns the events of all transactions that were part of the finalized block at the given height. It can optionally filter them by event type; if no event types are given, all events are returned.

func (*Index) First

func (i *Index) First() (uint64, error)

First returns the height of the first finalized block that was indexed.

func (*Index) Guarantee

func (i *Index) Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)

Guarantee returns the collection guarantee for the given collection ID.

func (*Index) Header

func (i *Index) Header(height uint64) (*flow.Header, error)

Header returns the header for the finalized block at the given height.

func (*Index) HeightForBlock

func (i *Index) HeightForBlock(blockID flow.Identifier) (uint64, error)

HeightForBlock returns the height of the given blockID.

func (*Index) HeightForTransaction

func (i *Index) HeightForTransaction(txID flow.Identifier) (uint64, error)

HeightForTransaction returns the height of the given transaction ID.

func (*Index) Last

func (i *Index) Last() (uint64, error)

Last returns the height of the last finalized block that was indexed.

func (*Index) Result

func (i *Index) Result(txID flow.Identifier) (*flow.TransactionResult, error)

Result returns the result for a given transaction ID.

func (*Index) Seal

func (i *Index) Seal(sealID flow.Identifier) (*flow.Seal, error)

Seal returns the seal with the given ID.

func (*Index) SealsByHeight

func (i *Index) SealsByHeight(height uint64) ([]flow.Identifier, error)

SealsByHeight returns the seal IDs at the given height.

func (*Index) Transaction

func (i *Index) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)

Transaction returns the transaction with the given ID.

func (*Index) TransactionsByHeight

func (i *Index) TransactionsByHeight(height uint64) ([]flow.Identifier, error)

TransactionsByHeight returns the transaction IDs within the given block.

func (*Index) Values

func (i *Index) Values(height uint64, paths []ledger.Path) ([]ledger.Value, error)

Values returns the Ledger values of the execution state at the given paths as they were after the execution of the finalized block at the given height. For compatibility with existing Flow execution node code, a path that is not found within the indexed execution state returns a nil value without error.

type Option

type Option func(*Config)

func WithTracer

func WithTracer(tracer trace.Tracer) Option

type Server

type Server struct {
	UnimplementedAPIServer
	// contains filtered or unexported fields
}

Server is a simple implementation of the generated APIServer interface. It uses an index reader interface as the backend to retrieve the desired data. This is generally an on-disk interface, but could be a GRPC-based index as well, in which case there is a double redirection.

func NewServer

func NewServer(index archive.Reader, codec archive.Codec, options ...Option) *Server

NewServer creates a new server, using the provided index reader as a backend for data retrieval.

func (*Server) GetCollection

func (s *Server) GetCollection(ctx context.Context, req *GetCollectionRequest) (*GetCollectionResponse, error)

GetCollection implements the `GetCollection` method of the generated GRPC server.

func (*Server) GetCommit

func (s *Server) GetCommit(ctx context.Context, req *GetCommitRequest) (*GetCommitResponse, error)

GetCommit implements the `GetCommit` method of the generated GRPC server.

func (*Server) GetEvents

func (s *Server) GetEvents(ctx context.Context, req *GetEventsRequest) (*GetEventsResponse, error)

GetEvents implements the `GetEvents` method of the generated GRPC server.

func (*Server) GetFirst

func (s *Server) GetFirst(ctx context.Context, _ *GetFirstRequest) (*GetFirstResponse, error)

GetFirst implements the `GetFirst` method of the generated GRPC server.

func (*Server) GetGuarantee

func (s *Server) GetGuarantee(ctx context.Context, req *GetGuaranteeRequest) (*GetGuaranteeResponse, error)

GetGuarantee implements the `GetGuarantee` method of the generated GRPC server.

func (*Server) GetHeader

func (s *Server) GetHeader(ctx context.Context, req *GetHeaderRequest) (*GetHeaderResponse, error)

GetHeader implements the `GetHeader` method of the generated GRPC server.

func (*Server) GetHeightForBlock

func (s *Server) GetHeightForBlock(ctx context.Context, req *GetHeightForBlockRequest) (*GetHeightForBlockResponse, error)

GetHeightForBlock implements the `GetHeightForBlock` method of the generated GRPC server.

func (*Server) GetHeightForTransaction

func (s *Server) GetHeightForTransaction(ctx context.Context, req *GetHeightForTransactionRequest) (*GetHeightForTransactionResponse, error)

GetHeightForTransaction implements the `GetHeightForTransaction` method of the generated GRPC server.

func (*Server) GetLast

func (s *Server) GetLast(ctx context.Context, _ *GetLastRequest) (*GetLastResponse, error)

GetLast implements the `GetLast` method of the generated GRPC server.

func (*Server) GetRegisterValues

func (s *Server) GetRegisterValues(ctx context.Context, req *GetRegisterValuesRequest) (*GetRegisterValuesResponse, error)

GetRegisterValues implements the `GetRegisterValues` method of the generated GRPC server.

func (*Server) GetResult

func (s *Server) GetResult(ctx context.Context, req *GetResultRequest) (*GetResultResponse, error)

GetResult implements the `GetResult` method of the generated GRPC server.

func (*Server) GetSeal

func (s *Server) GetSeal(ctx context.Context, req *GetSealRequest) (*GetSealResponse, error)

GetSeal implements the `GetSeal` method of the generated GRPC server.

func (*Server) GetTransaction

func (s *Server) GetTransaction(ctx context.Context, req *GetTransactionRequest) (*GetTransactionResponse, error)

GetTransaction implements the `GetTransaction` method of the generated GRPC server.

func (*Server) ListCollectionsForHeight

func (s *Server) ListCollectionsForHeight(ctx context.Context, req *ListCollectionsForHeightRequest) (*ListCollectionsForHeightResponse, error)

ListCollectionsForHeight implements the `ListCollectionsForHeight` method of the generated GRPC server.

func (*Server) ListSealsForHeight

func (s *Server) ListSealsForHeight(ctx context.Context, req *ListSealsForHeightRequest) (*ListSealsForHeightResponse, error)

ListSealsForHeight implements the `ListSealsForHeight` method of the generated GRPC server.

func (*Server) ListTransactionsForHeight

func (s *Server) ListTransactionsForHeight(ctx context.Context, req *ListTransactionsForHeightRequest) (*ListTransactionsForHeightResponse, error)

ListTransactionsForHeight implements the `ListTransactionsForHeight` method of the generated GRPC server.

type UnimplementedAPIServer

type UnimplementedAPIServer struct {
}

UnimplementedAPIServer must be embedded to have forward compatible implementations.

func (UnimplementedAPIServer) GetCollection

func (UnimplementedAPIServer) GetCollection(context.Context, *GetCollectionRequest) (*GetCollectionResponse, error)

func (UnimplementedAPIServer) GetCommit

func (UnimplementedAPIServer) GetCommit(context.Context, *GetCommitRequest) (*GetCommitResponse, error)

func (UnimplementedAPIServer) GetEvents

func (UnimplementedAPIServer) GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error)

func (UnimplementedAPIServer) GetFirst

func (UnimplementedAPIServer) GetFirst(context.Context, *GetFirstRequest) (*GetFirstResponse, error)

func (UnimplementedAPIServer) GetGuarantee

func (UnimplementedAPIServer) GetGuarantee(context.Context, *GetGuaranteeRequest) (*GetGuaranteeResponse, error)

func (UnimplementedAPIServer) GetHeader

func (UnimplementedAPIServer) GetHeader(context.Context, *GetHeaderRequest) (*GetHeaderResponse, error)

func (UnimplementedAPIServer) GetHeightForBlock

func (UnimplementedAPIServer) GetHeightForBlock(context.Context, *GetHeightForBlockRequest) (*GetHeightForBlockResponse, error)

func (UnimplementedAPIServer) GetHeightForTransaction

func (UnimplementedAPIServer) GetHeightForTransaction(context.Context, *GetHeightForTransactionRequest) (*GetHeightForTransactionResponse, error)

func (UnimplementedAPIServer) GetLast

func (UnimplementedAPIServer) GetLast(context.Context, *GetLastRequest) (*GetLastResponse, error)

func (UnimplementedAPIServer) GetRegisterValues

func (UnimplementedAPIServer) GetRegisterValues(context.Context, *GetRegisterValuesRequest) (*GetRegisterValuesResponse, error)

func (UnimplementedAPIServer) GetResult

func (UnimplementedAPIServer) GetResult(context.Context, *GetResultRequest) (*GetResultResponse, error)

func (UnimplementedAPIServer) GetSeal

func (UnimplementedAPIServer) GetSeal(context.Context, *GetSealRequest) (*GetSealResponse, error)

func (UnimplementedAPIServer) GetTransaction

func (UnimplementedAPIServer) GetTransaction(context.Context, *GetTransactionRequest) (*GetTransactionResponse, error)

func (UnimplementedAPIServer) ListCollectionsForHeight

func (UnimplementedAPIServer) ListCollectionsForHeight(context.Context, *ListCollectionsForHeightRequest) (*ListCollectionsForHeightResponse, error)

func (UnimplementedAPIServer) ListSealsForHeight

func (UnimplementedAPIServer) ListSealsForHeight(context.Context, *ListSealsForHeightRequest) (*ListSealsForHeightResponse, error)

func (UnimplementedAPIServer) ListTransactionsForHeight

func (UnimplementedAPIServer) ListTransactionsForHeight(context.Context, *ListTransactionsForHeightRequest) (*ListTransactionsForHeightResponse, error)

type UnsafeAPIServer

type UnsafeAPIServer interface {
	// contains filtered or unexported methods
}

UnsafeAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to APIServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL