rpc

package
v0.37.16 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: AGPL-3.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	CollectionAddr         string                           // the address of the upstream collection node
	HistoricalAccessAddrs  string                           // the list of all access nodes from previous spork

	BackendConfig  backend.Config // configurable options for creating Backend
	RestConfig     rest.Config    // the REST server configuration
	MaxMsgSize     uint           // GRPC max message size
	CompressorName string         // GRPC compressor name
}

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 {
	component.Component
	// 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) OnFinalizedBlock added in v0.31.0

func (e *Engine) OnFinalizedBlock(block *model.Block)

OnFinalizedBlock responds to block finalization events.

func (*Engine) RestApiAddress added in v0.23.2

func (e *Engine) RestApiAddress() net.Addr

RestApiAddress returns the listen address of the REST API server. Guaranteed to be non-nil after Engine.Ready is closed.

type HTTPHeader

type HTTPHeader struct {
	Key   string
	Value string
}

type Option added in v0.32.0

type Option func(*RPCEngineBuilder)

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,
	chainID flow.ChainID,
	accessMetrics module.AccessMetrics,
	rpcMetricsEnabled bool,
	me module.Local,
	backend *backend.Backend,
	restHandler access.API,
	secureGrpcServer *grpcserver.GrpcServer,
	unsecureGrpcServer *grpcserver.GrpcServer,
	stateStreamBackend state_stream.API,
	stateStreamConfig statestreambackend.Config,
	indexReporter state_synchronization.IndexReporter,
) (*RPCEngineBuilder, error)

NewBuilder returns a new RPC engine builder.

func NewRPCEngineBuilder added in v0.27.0

func NewRPCEngineBuilder(engine *Engine, me module.Local, finalizedHeaderCache module.FinalizedHeaderCache, indexReporter state_synchronization.IndexReporter) *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) DefaultHandler added in v0.33.30

func (builder *RPCEngineBuilder) DefaultHandler(signerIndicesDecoder hotstuff.BlockSignerDecoder) *access.Handler

func (*RPCEngineBuilder) RpcHandler added in v0.32.0

func (builder *RPCEngineBuilder) RpcHandler() accessproto.AccessAPIServer

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) WithRpcHandler added in v0.32.0

func (builder *RPCEngineBuilder) WithRpcHandler(handler accessproto.AccessAPIServer) *RPCEngineBuilder

WithRpcHandler 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 `WithRpcHandler`); but not both. If both are specified, the builder will error during the build step.

Returns self-reference for chaining.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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