beam: Index | Files

package grpcx

import ""

Package grpcx contains utilities for working with gRPC.


Package Files

dial.go hook.go metadata.go


var Dial = DefaultDial

Dial is a convenience wrapper over grpc.Dial. It can be overridden to provide a customized dialing behavior.

func DefaultDial Uses

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 Uses

func EnableHook(name string, opts ...string)

EnableHook is called to request the use of the gRPC hook in a pipeline.

func ReadWorkerID Uses

func ReadWorkerID(ctx context.Context) (string, error)

ReadWorkerID reads the worker ID from an incoming gRPC request context.

func RegisterHook Uses

func RegisterHook(name string, c HookFactory)

RegisterHook registers a HookFactory for the supplied identifier. It panics if the same identifier is registered twice.

func WriteWorkerID Uses

func WriteWorkerID(ctx context.Context, id string) context.Context

WriteWorkerID write the worker ID to an outgoing gRPC request context. It merges the information with any existing gRPC metadata.

type Hook Uses

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.

type HookFactory Uses

type HookFactory func([]string) Hook

HookFactory is a function that creates hooks from supplied arguments.

Package grpcx imports 8 packages (graph) and is imported by 8 packages. Updated 2020-08-15. Refresh now. Tools for package owners.