grpcx

package
v2.23.0-RC2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package grpcx contains utilities for working with gRPC.

Index

Constants

This section is empty.

Variables

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

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

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

func ReadWorkerID

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

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.

func WriteWorkerID

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.

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.

type HookFactory

type HookFactory func([]string) Hook

HookFactory is a function that creates hooks from supplied arguments.

Jump to

Keyboard shortcuts

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