grpcutil

package
v0.61.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CodecName = encodingproto.Name

CodecName uses default codec name to override default codec.

Variables

This section is empty.

Functions

func LogStreamInterceptor

func LogStreamInterceptor() grpc.StreamServerInterceptor

func LogUnaryInterceptor

func LogUnaryInterceptor() grpc.UnaryServerInterceptor

func PassMetadataUnaryClientInterceptor

func PassMetadataUnaryClientInterceptor() grpc.UnaryClientInterceptor

PassMetadataUnaryClientInterceptor passes metadata from incoming context to outgoing context.

func RecoverStreamInterceptor

func RecoverStreamInterceptor() grpc.StreamServerInterceptor

func RecoverUnaryInterceptor

func RecoverUnaryInterceptor() grpc.UnaryServerInterceptor

func ReturnToVTPoolUnaryServerInterceptor

func ReturnToVTPoolUnaryServerInterceptor() grpc.UnaryServerInterceptor

ReturnToVTPoolUnaryServerInterceptor calls ReturnToVTPool for each request that implements this method. It is necessary because vtproto does not return objects to the pool.

func StopGRPCServer

func StopGRPCServer(ctx context.Context, grpcServer *grpc.Server)

StopGRPCServer tries to gracefully stop the given gRPC server. If the context is canceled before graceful stop is finished, applies force stop.

func TraceUnaryInterceptor

func TraceUnaryInterceptor() grpc.UnaryServerInterceptor

Types

type VTProtoCodec

type VTProtoCodec struct{}

VTProtoCodec implements the Codec interface. It will use the codec vtproto, if possible, otherwise falls on the standard codec. This is necessary since not all structures implement vtproto codec (for example emptypb.Empty).

See: https://github.com/planetscale/vtprotobuf/tree/v0.6.0?tab=readme-ov-file#mixing-protobuf-implementations-with-grpc

func (VTProtoCodec) Marshal

func (VTProtoCodec) Marshal(v any) ([]byte, error)

func (VTProtoCodec) Name

func (VTProtoCodec) Name() string

func (VTProtoCodec) Unmarshal

func (VTProtoCodec) Unmarshal(data []byte, v any) error

type VTProtoMessage

type VTProtoMessage interface {
	MarshalVT() ([]byte, error)
	UnmarshalVT([]byte) error
}

Jump to

Keyboard shortcuts

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