Documentation
¶
Index ¶
- Constants
- func DialAddress(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func GetClientCommonName(ctx context.Context) (clientCommonName string)
- func GetMethod(ctx context.Context) string
- func Listener(bindAddr string) (net.Listener, error)
- func LoggedStreaming(log logger.Triggerable) grpc.StreamServerInterceptor
- func LoggedUnary(log logger.Triggerable) grpc.UnaryServerInterceptor
- func MetaValue(md metadata.MD, key string) string
- func RecoverStream(opts ...RecoveryOption) grpc.StreamServerInterceptor
- func RecoverUnary(opts ...RecoveryOption) grpc.UnaryServerInterceptor
- func TracedUnary(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
- func UnaryChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- func WithClientCommonName(ctx context.Context, commonName string) context.Context
- func WithMethod(ctx context.Context, fullMethod string) context.Context
- type Graceful
- type RecoveryHandlerFunc
- type RecoveryOption
Constants ¶
const ( MetaTagAuthority = "authority" MetaTagContentType = "content-type" MetaTagUserAgent = "user-agent" )
MetaTags These are common tags found in the metadata for rpc calls, both unary and streaming.
Variables ¶
This section is empty.
Functions ¶
func DialAddress ¶
func DialAddress(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialAddress dials an address with a given set of dial options. It resolves how to dial unix sockets if the address is prefixed with `unix://`.
func GetClientCommonName ¶
GetClientCommonName fetches the client common name from the context.
func Listener ¶
Listener creates a net listener for a given bind address. It handles detecting if we should create a unix socket address.
func LoggedStreaming ¶
func LoggedStreaming(log logger.Triggerable) grpc.StreamServerInterceptor
LoggedStreaming returns a streaming server interceptor.
func LoggedUnary ¶
func LoggedUnary(log logger.Triggerable) grpc.UnaryServerInterceptor
LoggedUnary returns a unary server interceptor.
func RecoverStream ¶
func RecoverStream(opts ...RecoveryOption) grpc.StreamServerInterceptor
RecoverStream returns a new streaming server interceptor for panic recovery.
func RecoverUnary ¶
func RecoverUnary(opts ...RecoveryOption) grpc.UnaryServerInterceptor
RecoverUnary returns a new unary server interceptor for panic recovery.
func TracedUnary ¶
func TracedUnary(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
TracedUnary returns a unary server interceptor.
func UnaryChain ¶
func UnaryChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
UnaryChain reads the middleware variadic args and organizes the calls recursively in the order they appear.
func WithClientCommonName ¶
WithClientCommonName adds a client common name to a context as a value. This value will supercede parsing the value.
Types ¶
type Graceful ¶
type Graceful struct {
Log logger.FullReceiver
Latch async.Latch
Listener net.Listener
Server *grpc.Server
}
Graceful is a shim for graceful hosting grpc servers.
func NewGraceful ¶
NewGraceful returns a new graceful host for a grpc server.
func (*Graceful) NotifyStarted ¶
func (gz *Graceful) NotifyStarted() <-chan struct{}
NotifyStarted returns the notify started signal.
func (*Graceful) NotifyStopped ¶
func (gz *Graceful) NotifyStopped() <-chan struct{}
NotifyStopped returns the notify stopped signal.
func (*Graceful) WithLogger ¶
func (gz *Graceful) WithLogger(log logger.FullReceiver) *Graceful
WithLogger sets the logger.
type RecoveryHandlerFunc ¶
type RecoveryHandlerFunc func(p interface{}) (err error)
RecoveryHandlerFunc is a function that recovers from the panic `p` by returning an `error`.
type RecoveryOption ¶
type RecoveryOption func(*recoveryOptions)
RecoveryOption is a type that provides a recovery option.
func WithRecoveryHandler ¶
func WithRecoveryHandler(f RecoveryHandlerFunc) RecoveryOption
WithRecoveryHandler customizes the function for recovering from a panic.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
full
command
Package main implements a server for the Status service and implements a number of extra features like logging and recovery.
|
Package main implements a server for the Status service and implements a number of extra features like logging and recovery. |
|
full/client
command
|
|