Documentation
¶
Index ¶
- Constants
- func ChooseFromPreferredENIDs(allENs flow.IdentityList, executorIDs flow.IdentifierList, ...) flow.IdentityList
- func ConvertError(err error, msg string, defaultCode codes.Code) error
- func ConvertIndexError(err error, height uint64, defaultMsg string) error
- func ConvertMultiError(err *multierror.Error, msg string, defaultCode codes.Code) error
- func ConvertStorageError(err error) error
- func ExecutionNodesForBlockID(ctx context.Context, blockID flow.Identifier, ...) (flow.IdentitySkeletonList, error)
- func IdentifierList(ids []string) (flow.IdentifierList, error)
- func InterceptorLogger(l zerolog.Logger) logging.Logger
- func LoggingInterceptor(log zerolog.Logger) []grpc.UnaryServerInterceptor
- func NewRateLimiterInterceptor(log zerolog.Logger, apiRateLimits map[string]int, ...) *rateLimiterInterceptor
Constants ¶
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
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
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
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
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.IdentitySkeletonList, 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 InterceptorLogger ¶ added in v0.33.30
InterceptorLogger adapts zerolog logger to interceptor logger. This code is simple enough to be copied and not imported.
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.