Documentation ¶
Overview ¶
Package grpcx contains utilities for working with gRPC.
Index ¶
- Variables
- func DefaultDial(ctx context.Context, endpoint string, timeout time.Duration) (*grpc.ClientConn, error)
- func EnableHook(name string, opts ...string)
- func ReadWorkerID(ctx context.Context) (string, error)
- func RegisterHook(name string, c HookFactory)
- func WriteWorkerID(ctx context.Context, id string) context.Context
- type Hook
- type HookFactory
Constants ¶
This section is empty.
Variables ¶
var Dial = DefaultDial
Dial is a convenience wrapper over grpc.Dial. It can be overridden to provide a customized dialing behavior.
Functions ¶
func DefaultDial ¶
func DefaultDial(ctx context.Context, endpoint string, timeout time.Duration) (*grpc.ClientConn, error)
DefaultDial is a dialer that specifies an insecure blocking connection with a timeout.
func EnableHook ¶
EnableHook is called to request the use of the gRPC hook in a pipeline.
func ReadWorkerID ¶
ReadWorkerID reads the worker ID from an incoming gRPC request context.
func RegisterHook ¶
func RegisterHook(name string, c HookFactory)
RegisterHook registers a HookFactory for the supplied identifier. It panics if the same identifier is registered twice.
Types ¶
type Hook ¶
type Hook struct { // Dialer allows the runner to customize the gRPC dialing behavior. Dialer func(context.Context, string, time.Duration) (*grpc.ClientConn, error) }
Hook allow a runner to customize various aspects of gRPC communication with the FnAPI harness. Each member of the struct is optional; the default behavior will be used if a value is not supplied.