package grpcx
import "github.com/apache/beam/sdks/v2/go/pkg/beam/util/grpcx"
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
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.
func WriteWorkerID ¶
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 ¶
HookFactory is a function that creates hooks from supplied arguments.
Source Files ¶
- Version
- v2.65.0 (latest)
- Published
- May 6, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 1 day ago –
Tools for package owners.