grpc_middleware

package
v1.41.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditUnaryInterceptor added in v1.21.0

func AuditUnaryInterceptor(logger *zap.Logger, eventPairChecker EventPairChecker) grpc.UnaryServerInterceptor

AuditUnaryInterceptor sends audit logs to configured sinks upon successful RPC requests for auditable events.

func CacheUnaryInterceptor

func CacheUnaryInterceptor(cache cache.Cacher, logger *zap.Logger) grpc.UnaryServerInterceptor

CacheUnaryInterceptor caches the response of a request if the request is cacheable. TODO: we could clean this up by using generics in 1.18+ to avoid the type switch/duplicate code.

func ErrorUnaryInterceptor

func ErrorUnaryInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

ErrorUnaryInterceptor intercepts known errors and returns the appropriate GRPC status code

func EvaluationUnaryInterceptor

func EvaluationUnaryInterceptor(analyticsEnabled bool) grpc.UnaryServerInterceptor

EvaluationUnaryInterceptor sets required request/response fields. Note: this should be added before any caching interceptor to ensure the request id/response fields are unique.

func FliptAcceptServerVersionFromContext added in v1.38.0

func FliptAcceptServerVersionFromContext(ctx context.Context) semver.Version

FliptAcceptServerVersionFromContext returns the flipt-accept-server-version from the context if it exists or the default version.

func FliptAcceptServerVersionUnaryInterceptor added in v1.38.0

func FliptAcceptServerVersionUnaryInterceptor(logger *zap.Logger) grpc.UnaryServerInterceptor

FliptAcceptServerVersionUnaryInterceptor is a grpc client interceptor that sets the flipt-accept-server-version in the context if provided in the metadata/header.

func ValidationUnaryInterceptor

func ValidationUnaryInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)

ValidationUnaryInterceptor validates incoming requests

func WithFliptAcceptServerVersion added in v1.38.0

func WithFliptAcceptServerVersion(ctx context.Context, version semver.Version) context.Context

WithFliptAcceptServerVersion sets the flipt version in the context.

Types

type EventPairChecker added in v1.27.0

type EventPairChecker interface {
	Check(eventPair string) bool
}

EventPairChecker is the middleware side contract for checking if an event pair exists.

type RequestIdentifiable added in v1.24.0

type RequestIdentifiable interface {
	// SetRequestIDIfNotBlank attempts to set the provided ID on the instance
	// If the ID was blank, it returns the ID provided to this call.
	// If the ID was not blank, it returns the ID found on the instance.
	SetRequestIDIfNotBlank(id string) string
}

type ResponseDurationRecordable added in v1.24.0

type ResponseDurationRecordable interface {
	// SetTimestamps records the start and end times on the target instance.
	SetTimestamps(start, end time.Time)
}

Jump to

Keyboard shortcuts

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