Documentation
¶
Overview ¶
Package datastore defines middleware that injects the datastore into the context.
Index ¶
- func ContextWithDatastore(ctx context.Context, datastore datastore.Datastore) context.Context
- func ContextWithHandle(ctx context.Context) context.Context
- func FromContext(ctx context.Context) datastore.Datastore
- func MustFromContext(ctx context.Context) datastore.Datastore
- func SetInContext(ctx context.Context, datastore datastore.Datastore) error
- func StreamCountingInterceptor() grpc.StreamServerInterceptor
- func StreamServerInterceptor(datastore datastore.Datastore) grpc.StreamServerInterceptor
- func UnaryCountingInterceptor() grpc.UnaryServerInterceptor
- func UnaryServerInterceptor(datastore datastore.Datastore) grpc.UnaryServerInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithDatastore ¶
ContextWithDatastore adds the handle and datastore in one step
func ContextWithHandle ¶
ContextWithHandle adds a placeholder to a context that will later be filled by the datastore
func FromContext ¶
FromContext reads the selected datastore out of a context.Context and returns nil if it does not exist.
func MustFromContext ¶
MustFromContext reads the selected datastore out of a context.Context and panics if it does not exist
func SetInContext ¶
SetInContext adds a datastore to the given context
func StreamCountingInterceptor ¶ added in v1.48.0
func StreamCountingInterceptor() grpc.StreamServerInterceptor
StreamCountingInterceptor wraps the datastore in a counting proxy for each stream request. After the stream completes, it exports the counts to Prometheus metrics.
func StreamServerInterceptor ¶
func StreamServerInterceptor(datastore datastore.Datastore) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new stream server interceptor that adds the datastore to the context
func UnaryCountingInterceptor ¶ added in v1.48.0
func UnaryCountingInterceptor() grpc.UnaryServerInterceptor
UnaryCountingInterceptor wraps the datastore in a counting proxy for each unary request. After the request completes, it exports the counts to Prometheus metrics.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(datastore datastore.Datastore) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor that adds the datastore to the context
Types ¶
This section is empty.