rpc

package
v0.22.9-patch-1-epoch-... Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: AGPL-3.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPServer

func NewHTTPServer(
	grpcServer *grpc.Server,
	address string,
) *http.Server

NewHTTPServer creates and intializes a new HTTP GRPC proxy server

func NewRateLimiterInterceptor added in v0.14.8

func NewRateLimiterInterceptor(log zerolog.Logger, apiRateLimits map[string]int, apiBurstLimits map[string]int) *rateLimiterInterceptor

NewRateLimiterInterceptor creates a new rate limiter interceptor with the defined per second rate limits and the optional burst limit for each API.

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
	MaxMsgSize                int                              // GRPC max message size
	ExecutionClientTimeout    time.Duration                    // execution API GRPC client timeout
	CollectionClientTimeout   time.Duration                    // collection API GRPC client timeout
	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 New

func New(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,
	collectionGRPCPort uint,
	executionGRPCPort uint,
	retryEnabled bool,
	rpcMetricsEnabled bool,
	apiRatelimits map[string]int,
	apiBurstLimits map[string]int,
) *Engine

New returns a new RPC engine.

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) SecureGRPCAddress added in v0.20.0

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

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

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

type HTTPHeader

type HTTPHeader struct {
	Key   string
	Value string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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