rpc

package
v0.33.36-tx-error-mess... Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: AGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const MaxNodesCnt = 3

MaxNodesCnt is the maximum number of nodes that will be contacted to complete an API request.

Variables

This section is empty.

Functions

func ChooseFromPreferredENIDs

func ChooseFromPreferredENIDs(allENs flow.IdentityList,
	executorIDs flow.IdentifierList,
	preferredENIdentifiers flow.IdentifierList,
) flow.IdentityList

ChooseFromPreferredENIDs finds the subset of execution nodes if preferred execution nodes are defined. If preferredENIdentifiers is set and there are less than maxNodesCnt nodes selected, than the list is padded up to maxNodesCnt nodes using the following order: 1. Use any EN with a receipt. 2. Use any preferred node not already selected. 3. Use any EN not already selected.

func ConvertError added in v0.30.0

func ConvertError(err error, msg string, defaultCode codes.Code) error

ConvertError converts a generic error into a grpc status error. The input may either be a status.Error already, or standard error type. Any error that matches on of the common status code mappings will be converted, all unmatched errors will be converted to the provided defaultCode.

func ConvertIndexError added in v0.33.13

func ConvertIndexError(err error, height uint64, defaultMsg string) error

ConvertIndexError converts errors related to index and storage to appropriate gRPC status errors. If the error is nil, it returns nil. If the error is not recognized, it falls back to ConvertError with the provided default message and Internal gRPC code.

func ConvertMultiError added in v0.29.12

func ConvertMultiError(err *multierror.Error, msg string, defaultCode codes.Code) error

ConvertMultiError converts a multierror to a grpc status error. If the errors have related status codes, the common code is returned, otherwise defaultCode is used.

func ConvertStorageError added in v0.29.0

func ConvertStorageError(err error) error

ConvertStorageError converts a generic error into a grpc status error, converting storage errors into codes.NotFound

func ExecutionNodesForBlockID

func ExecutionNodesForBlockID(
	ctx context.Context,
	blockID flow.Identifier,
	executionReceipts storage.ExecutionReceipts,
	state protocol.State,
	log zerolog.Logger,
	preferredENIdentifiers flow.IdentifierList,
	fixedENIdentifiers flow.IdentifierList,
) (flow.IdentityList, error)

ExecutionNodesForBlockID returns upto maxNodesCnt number of randomly chosen execution node identities which have executed the given block ID. If no such execution node is found, an InsufficientExecutionReceipts error is returned.

func IdentifierList added in v0.38.0

func IdentifierList(ids []string) (flow.IdentifierList, error)

func LoggingInterceptor added in v0.29.0

func LoggingInterceptor(log zerolog.Logger) []grpc.UnaryServerInterceptor

LoggingInterceptor creates the logging interceptors to log incoming GRPC request and response (minus the payload body)

func NewRateLimiterInterceptor

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

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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