interceptors

package
v0.0.0-...-5a7d29f Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func UnaryServerInterceptor

func UnaryServerInterceptor(reportable ServerReportable) connect.UnaryInterceptorFunc

Types

type CallMeta

type CallMeta struct {
	ReqOrNil any
	Typ      connect.StreamType
	Service  string
	Method   string
	IsClient bool
}

func NewServerCallMeta

func NewServerCallMeta(spec connect.Spec, reqOrNil any) CallMeta

func (CallMeta) FullMethod

func (c CallMeta) FullMethod() string

type ClientReportable

type ClientReportable interface {
	ClientReporter(context.Context, CallMeta) (Reporter, context.Context)
}

type CommonReportableFunc

type CommonReportableFunc func(ctx context.Context, c CallMeta) (Reporter, context.Context)

CommonReportableFunc helper allows an easy way to implement reporter with common client and server logic.

func (CommonReportableFunc) ClientReporter

func (f CommonReportableFunc) ClientReporter(ctx context.Context, c CallMeta) (Reporter, context.Context)

func (CommonReportableFunc) ServerReporter

func (f CommonReportableFunc) ServerReporter(ctx context.Context, c CallMeta) (Reporter, context.Context)

type ConnectType

type ConnectType string
const (
	Unary        ConnectType = "unary"
	ClientStream ConnectType = "client_stream"
	ServerStream ConnectType = "server_stream"
	BidiStream   ConnectType = "bidi_stream"
)

type NoopReporter

type NoopReporter struct{}

func (NoopReporter) PostCall

func (NoopReporter) PostCall(error, time.Duration)

func (NoopReporter) PostMsgReceive

func (NoopReporter) PostMsgReceive(connect.AnyRequest, error, time.Duration)

func (NoopReporter) PostMsgSend

type Reporter

type Reporter interface {
	PostCall(err error, rpcDuration time.Duration)
	PostMsgSend(res connect.AnyResponse, err error, sendDuration time.Duration)
	PostMsgReceive(req connect.AnyRequest, err error, recvDuration time.Duration)
}

type ServerReportable

type ServerReportable interface {
	ServerReporter(context.Context, CallMeta) (Reporter, context.Context)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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