Documentation ¶
Index ¶
- func NewHTTPServer(grpcServer *grpc.Server, address string) *http.Server
- type Config
- type Engine
- type Forwarder
- func (f *Forwarder) ExecuteScriptAtBlockHeight(context context.Context, req *access.ExecuteScriptAtBlockHeightRequest) (*access.ExecuteScriptResponse, error)
- func (f *Forwarder) ExecuteScriptAtBlockID(context context.Context, req *access.ExecuteScriptAtBlockIDRequest) (*access.ExecuteScriptResponse, error)
- func (f *Forwarder) ExecuteScriptAtLatestBlock(context context.Context, req *access.ExecuteScriptAtLatestBlockRequest) (*access.ExecuteScriptResponse, error)
- func (f *Forwarder) GetAccount(context context.Context, req *access.GetAccountRequest) (*access.GetAccountResponse, error)
- func (f *Forwarder) GetAccountAtBlockHeight(context context.Context, req *access.GetAccountAtBlockHeightRequest) (*access.AccountResponse, error)
- func (f *Forwarder) GetAccountAtLatestBlock(context context.Context, req *access.GetAccountAtLatestBlockRequest) (*access.AccountResponse, error)
- func (f *Forwarder) GetBlockByHeight(context context.Context, req *access.GetBlockByHeightRequest) (*access.BlockResponse, error)
- func (f *Forwarder) GetBlockByID(context context.Context, req *access.GetBlockByIDRequest) (*access.BlockResponse, error)
- func (f *Forwarder) GetBlockHeaderByHeight(context context.Context, req *access.GetBlockHeaderByHeightRequest) (*access.BlockHeaderResponse, error)
- func (f *Forwarder) GetBlockHeaderByID(context context.Context, req *access.GetBlockHeaderByIDRequest) (*access.BlockHeaderResponse, error)
- func (f *Forwarder) GetCollectionByID(context context.Context, req *access.GetCollectionByIDRequest) (*access.CollectionResponse, error)
- func (f *Forwarder) GetEventsForBlockIDs(context context.Context, req *access.GetEventsForBlockIDsRequest) (*access.EventsResponse, error)
- func (f *Forwarder) GetEventsForHeightRange(context context.Context, req *access.GetEventsForHeightRangeRequest) (*access.EventsResponse, error)
- func (f *Forwarder) GetExecutionResultForBlockID(context context.Context, req *access.GetExecutionResultForBlockIDRequest) (*access.ExecutionResultForBlockIDResponse, error)
- func (f *Forwarder) GetLatestBlock(context context.Context, req *access.GetLatestBlockRequest) (*access.BlockResponse, error)
- func (f *Forwarder) GetLatestBlockHeader(context context.Context, req *access.GetLatestBlockHeaderRequest) (*access.BlockHeaderResponse, error)
- func (f *Forwarder) GetLatestProtocolStateSnapshot(context context.Context, req *access.GetLatestProtocolStateSnapshotRequest) (*access.ProtocolStateSnapshotResponse, error)
- func (f *Forwarder) GetNetworkParameters(context context.Context, req *access.GetNetworkParametersRequest) (*access.GetNetworkParametersResponse, error)
- func (f *Forwarder) GetTransaction(context context.Context, req *access.GetTransactionRequest) (*access.TransactionResponse, error)
- func (f *Forwarder) GetTransactionResult(context context.Context, req *access.GetTransactionRequest) (*access.TransactionResultResponse, error)
- func (f *Forwarder) GetTransactionResultByIndex(context context.Context, req *access.GetTransactionByIndexRequest) (*access.TransactionResultResponse, error)
- func (f *Forwarder) GetTransactionResultsByBlockID(context context.Context, req *access.GetTransactionsByBlockIDRequest) (*access.TransactionResultsResponse, error)
- func (f *Forwarder) GetTransactionsByBlockID(context context.Context, req *access.GetTransactionsByBlockIDRequest) (*access.TransactionsResponse, error)
- func (f *Forwarder) Ping(context context.Context, req *access.PingRequest) (*access.PingResponse, error)
- func (f *Forwarder) SendTransaction(context context.Context, req *access.SendTransactionRequest) (*access.SendTransactionResponse, error)
- type HTTPHeader
- type RPCEngineBuilder
- func (builder *RPCEngineBuilder) Build() (*Engine, error)
- func (builder *RPCEngineBuilder) WithBlockSignerDecoder(signerIndicesDecoder hotstuff.BlockSignerDecoder) *RPCEngineBuilder
- func (builder *RPCEngineBuilder) WithLegacy() *RPCEngineBuilder
- func (builder *RPCEngineBuilder) WithMetrics() *RPCEngineBuilder
- func (builder *RPCEngineBuilder) WithNewHandler(handler accessproto.AccessAPIServer) *RPCEngineBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { UnsecureGRPCListenAddr string // the non-secure GRPC server address as ip:port SecureGRPCListenAddr string // the secure GRPC server address as ip:port TransportCredentials credentials.TransportCredentials // the secure GRPC credentials HTTPListenAddr string // the HTTP web proxy address as ip:port RESTListenAddr string // the REST server address as ip:port (if empty the REST server will not be started) CollectionAddr string // the address of the upstream collection node HistoricalAccessAddrs string // the list of all access nodes from previous spork MaxMsgSize int // GRPC max message size ExecutionClientTimeout time.Duration // execution API GRPC client timeout CollectionClientTimeout time.Duration // collection API GRPC client timeout ConnectionPoolSize uint // size of the cache for storing collection and execution connections MaxHeightRange uint // max size of height range requests PreferredExecutionNodeIDs []string // preferred list of upstream execution node IDs FixedExecutionNodeIDs []string // fixed list of execution node IDs to choose from if no node node ID can be chosen from the PreferredExecutionNodeIDs }
Config defines the configurable options for the access node server A secure GRPC server here implies a server that presents a self-signed TLS certificate and a client that authenticates the server via a pre-shared public key
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine exposes the server with a simplified version of the Access API. An unsecured GRPC server (default port 9000), a secure GRPC server (default port 9001) and an HTTP Web proxy (default port 8000) are brought up.
func (*Engine) Done ¶
func (e *Engine) Done() <-chan struct{}
Done returns a done channel that is closed once the engine has fully stopped. It sends a signal to stop the gRPC server, then closes the channel.
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready returns a ready channel that is closed once the engine has fully started. The RPC engine is ready when the gRPC server has successfully started.
func (*Engine) RestApiAddress ¶ added in v0.23.2
func (*Engine) SecureGRPCAddress ¶ added in v0.20.0
func (*Engine) SubmitLocal ¶
func (e *Engine) SubmitLocal(event interface{})
SubmitLocal submits an event originating on the local node.
func (*Engine) UnsecureGRPCAddress ¶ added in v0.20.0
type Forwarder ¶ added in v0.27.0
type Forwarder struct {
UpstreamHandler accessproto.AccessAPIClient
}
func (*Forwarder) ExecuteScriptAtBlockHeight ¶ added in v0.27.0
func (f *Forwarder) ExecuteScriptAtBlockHeight(context context.Context, req *access.ExecuteScriptAtBlockHeightRequest) (*access.ExecuteScriptResponse, error)
func (*Forwarder) ExecuteScriptAtBlockID ¶ added in v0.27.0
func (f *Forwarder) ExecuteScriptAtBlockID(context context.Context, req *access.ExecuteScriptAtBlockIDRequest) (*access.ExecuteScriptResponse, error)
func (*Forwarder) ExecuteScriptAtLatestBlock ¶ added in v0.27.0
func (f *Forwarder) ExecuteScriptAtLatestBlock(context context.Context, req *access.ExecuteScriptAtLatestBlockRequest) (*access.ExecuteScriptResponse, error)
func (*Forwarder) GetAccount ¶ added in v0.27.0
func (f *Forwarder) GetAccount(context context.Context, req *access.GetAccountRequest) (*access.GetAccountResponse, error)
func (*Forwarder) GetAccountAtBlockHeight ¶ added in v0.27.0
func (f *Forwarder) GetAccountAtBlockHeight(context context.Context, req *access.GetAccountAtBlockHeightRequest) (*access.AccountResponse, error)
func (*Forwarder) GetAccountAtLatestBlock ¶ added in v0.27.0
func (f *Forwarder) GetAccountAtLatestBlock(context context.Context, req *access.GetAccountAtLatestBlockRequest) (*access.AccountResponse, error)
func (*Forwarder) GetBlockByHeight ¶ added in v0.27.0
func (f *Forwarder) GetBlockByHeight(context context.Context, req *access.GetBlockByHeightRequest) (*access.BlockResponse, error)
func (*Forwarder) GetBlockByID ¶ added in v0.27.0
func (f *Forwarder) GetBlockByID(context context.Context, req *access.GetBlockByIDRequest) (*access.BlockResponse, error)
func (*Forwarder) GetBlockHeaderByHeight ¶ added in v0.27.0
func (f *Forwarder) GetBlockHeaderByHeight(context context.Context, req *access.GetBlockHeaderByHeightRequest) (*access.BlockHeaderResponse, error)
func (*Forwarder) GetBlockHeaderByID ¶ added in v0.27.0
func (f *Forwarder) GetBlockHeaderByID(context context.Context, req *access.GetBlockHeaderByIDRequest) (*access.BlockHeaderResponse, error)
func (*Forwarder) GetCollectionByID ¶ added in v0.27.0
func (f *Forwarder) GetCollectionByID(context context.Context, req *access.GetCollectionByIDRequest) (*access.CollectionResponse, error)
func (*Forwarder) GetEventsForBlockIDs ¶ added in v0.27.0
func (f *Forwarder) GetEventsForBlockIDs(context context.Context, req *access.GetEventsForBlockIDsRequest) (*access.EventsResponse, error)
func (*Forwarder) GetEventsForHeightRange ¶ added in v0.27.0
func (f *Forwarder) GetEventsForHeightRange(context context.Context, req *access.GetEventsForHeightRangeRequest) (*access.EventsResponse, error)
func (*Forwarder) GetExecutionResultForBlockID ¶ added in v0.27.0
func (f *Forwarder) GetExecutionResultForBlockID(context context.Context, req *access.GetExecutionResultForBlockIDRequest) (*access.ExecutionResultForBlockIDResponse, error)
func (*Forwarder) GetLatestBlock ¶ added in v0.27.0
func (f *Forwarder) GetLatestBlock(context context.Context, req *access.GetLatestBlockRequest) (*access.BlockResponse, error)
func (*Forwarder) GetLatestBlockHeader ¶ added in v0.27.0
func (f *Forwarder) GetLatestBlockHeader(context context.Context, req *access.GetLatestBlockHeaderRequest) (*access.BlockHeaderResponse, error)
func (*Forwarder) GetLatestProtocolStateSnapshot ¶ added in v0.27.0
func (f *Forwarder) GetLatestProtocolStateSnapshot(context context.Context, req *access.GetLatestProtocolStateSnapshotRequest) (*access.ProtocolStateSnapshotResponse, error)
func (*Forwarder) GetNetworkParameters ¶ added in v0.27.0
func (f *Forwarder) GetNetworkParameters(context context.Context, req *access.GetNetworkParametersRequest) (*access.GetNetworkParametersResponse, error)
func (*Forwarder) GetTransaction ¶ added in v0.27.0
func (f *Forwarder) GetTransaction(context context.Context, req *access.GetTransactionRequest) (*access.TransactionResponse, error)
func (*Forwarder) GetTransactionResult ¶ added in v0.27.0
func (f *Forwarder) GetTransactionResult(context context.Context, req *access.GetTransactionRequest) (*access.TransactionResultResponse, error)
func (*Forwarder) GetTransactionResultByIndex ¶ added in v0.27.0
func (f *Forwarder) GetTransactionResultByIndex(context context.Context, req *access.GetTransactionByIndexRequest) (*access.TransactionResultResponse, error)
func (*Forwarder) GetTransactionResultsByBlockID ¶ added in v0.27.0
func (f *Forwarder) GetTransactionResultsByBlockID(context context.Context, req *access.GetTransactionsByBlockIDRequest) (*access.TransactionResultsResponse, error)
func (*Forwarder) GetTransactionsByBlockID ¶ added in v0.27.0
func (f *Forwarder) GetTransactionsByBlockID(context context.Context, req *access.GetTransactionsByBlockIDRequest) (*access.TransactionsResponse, error)
func (*Forwarder) Ping ¶ added in v0.27.0
func (f *Forwarder) Ping(context context.Context, req *access.PingRequest) (*access.PingResponse, error)
func (*Forwarder) SendTransaction ¶ added in v0.27.0
func (f *Forwarder) SendTransaction(context context.Context, req *access.SendTransactionRequest) (*access.SendTransactionResponse, error)
type HTTPHeader ¶
type RPCEngineBuilder ¶ added in v0.27.0
type RPCEngineBuilder struct { *Engine // contains filtered or unexported fields }
func NewBuilder ¶ added in v0.27.0
func NewBuilder(log zerolog.Logger, state protocol.State, config Config, collectionRPC accessproto.AccessAPIClient, historicalAccessNodes []accessproto.AccessAPIClient, blocks storage.Blocks, headers storage.Headers, collections storage.Collections, transactions storage.Transactions, executionReceipts storage.ExecutionReceipts, executionResults storage.ExecutionResults, chainID flow.ChainID, transactionMetrics module.TransactionMetrics, accessMetrics module.AccessMetrics, collectionGRPCPort uint, executionGRPCPort uint, retryEnabled bool, rpcMetricsEnabled bool, apiRatelimits map[string]int, apiBurstLimits map[string]int, ) (*RPCEngineBuilder, error)
NewBuilder returns a new RPC engine builder.
func NewRPCEngineBuilder ¶ added in v0.27.0
func NewRPCEngineBuilder(engine *Engine) *RPCEngineBuilder
NewRPCEngineBuilder helps to build a new RPC engine.
func (*RPCEngineBuilder) Build ¶ added in v0.27.0
func (builder *RPCEngineBuilder) Build() (*Engine, error)
func (*RPCEngineBuilder) WithBlockSignerDecoder ¶ added in v0.27.0
func (builder *RPCEngineBuilder) WithBlockSignerDecoder(signerIndicesDecoder hotstuff.BlockSignerDecoder) *RPCEngineBuilder
WithBlockSignerDecoder specifies that signer indices in block headers should be translated to full node IDs with the given decoder. Caution: you can inject either a `BlockSignerDecoder` (via method `WithBlockSignerDecoder`)
or an `AccessAPIServer` (via method `WithNewHandler`); but not both. If both are specified, the builder will error during the build step.
Returns self-reference for chaining.
func (*RPCEngineBuilder) WithLegacy ¶ added in v0.27.0
func (builder *RPCEngineBuilder) WithLegacy() *RPCEngineBuilder
WithLegacy specifies that a legacy access API should be instantiated Returns self-reference for chaining.
func (*RPCEngineBuilder) WithMetrics ¶ added in v0.27.0
func (builder *RPCEngineBuilder) WithMetrics() *RPCEngineBuilder
WithMetrics specifies the metrics should be collected. Returns self-reference for chaining.
func (*RPCEngineBuilder) WithNewHandler ¶ added in v0.27.0
func (builder *RPCEngineBuilder) WithNewHandler(handler accessproto.AccessAPIServer) *RPCEngineBuilder
WithNewHandler specifies that the given `AccessAPIServer` should be used for serving API queries. Caution: you can inject either a `BlockSignerDecoder` (via method `WithBlockSignerDecoder`)
or an `AccessAPIServer` (via method `WithNewHandler`); but not both. If both are specified, the builder will error during the build step.
Returns self-reference for chaining.