Documentation ¶
Index ¶
- Constants
- func CodeFromStatus(status int) codes.Code
- func Codec() grpc.Codec
- func CodecWithParent(fallback grpc.Codec) grpc.Codec
- func CopyMD(source metadata.MD) rpcMeta.MD
- func CopyRPCMD(source rpcMeta.MD) metadata.MD
- func NewCaller() transport.NewCaller
- func NewListener(addr string, opts specs.Options) transport.NewListener
- func StatusFromCode(code codes.Code) int
- type Call
- func (call *Call) Address() string
- func (call *Call) Close() error
- func (call *Call) Director(ctx context.Context) (*grpc.ClientConn, error)
- func (call *Call) GetMethod(name string) transport.Method
- func (call *Call) GetMethods() []transport.Method
- func (call *Call) SendMsg(ctx context.Context, rw transport.ResponseWriter, pr *transport.Request, ...) error
- type Caller
- type CallerOptions
- type EndpointOptions
- type ErrUnknownMethod
- type Listener
- func (listener *Listener) Close() error
- func (listener *Listener) Handle(ctx *broker.Context, endpoints []*transport.Endpoint, ...) error
- func (listener *Listener) Name() string
- func (listener *Listener) Serve() error
- func (listener *Listener) ServerReflectionInfo(stream rpb.ServerReflection_ServerReflectionInfoServer) error
- type ListenerOptions
- type Method
Constants ¶
const ( // ServiceOption represents the service name option key ServiceOption = "service" // MethodOption represents the method name option key MethodOption = "method" // PackageOption represents the package name option key PackageOption = "package" )
Variables ¶
This section is empty.
Functions ¶
func CodeFromStatus ¶
CodeFromStatus converts a response status error code into the corresponding gRPC status.
func Codec ¶
Codec returns a proxying grpc.Codec with the default protobuf codec as parent.
See CodecWithParent.
func CodecWithParent ¶
CodecWithParent returns a proxying grpc.Codec with a user provided codec as parent.
This codec is *crucial* to the functioning of the proxy. It allows the proxy server to be oblivious to the schema of the forwarded messages. It basically treats a gRPC message frame as raw bytes. However, if the server handler, or the client caller are not proxy-internal functions it will fall back to trying to decode the message using a fallback codec.
func NewListener ¶
func NewListener(addr string, opts specs.Options) transport.NewListener
NewListener constructs a new listener for the given addr
func StatusFromCode ¶
StatusFromCode converts a gRPC error code into the corresponding response status.
Types ¶
type Call ¶
type Call struct {
// contains filtered or unexported fields
}
Call represents the HTTP caller implementation
func (*Call) Director ¶
Director returns a client connection and a outgoing context for the given method
func (*Call) GetMethods ¶
GetMethods returns the available methods within the HTTP caller
type Caller ¶
type Caller struct {
// contains filtered or unexported fields
}
Caller represents the caller constructor
type CallerOptions ¶
type CallerOptions struct { }
CallerOptions represents the available HTTP options
func ParseCallerOptions ¶
func ParseCallerOptions(options specs.Options) (*CallerOptions, error)
ParseCallerOptions parses the given specs options into HTTP options
type EndpointOptions ¶
EndpointOptions represents the available HTTP options
func ParseEndpointOptions ¶
func ParseEndpointOptions(endpoint *transport.Endpoint) (*EndpointOptions, error)
ParseEndpointOptions parses the given specs options into HTTP options
type ErrUnknownMethod ¶
type ErrUnknownMethod struct {
Method string
}
ErrUnknownMethod occurs when undefined method is called
func (ErrUnknownMethod) Error ¶
func (e ErrUnknownMethod) Error() string
Error returns a description of the given error as a string
func (ErrUnknownMethod) Prettify ¶
func (e ErrUnknownMethod) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener represents a HTTP listener
func (*Listener) Handle ¶
func (listener *Listener) Handle(ctx *broker.Context, endpoints []*transport.Endpoint, codecs map[string]codec.Constructor) error
Handle parses the given endpoints and constructs route handlers
func (*Listener) Serve ¶
Serve opens the HTTP listener and calls the given handler function on reach request
func (*Listener) ServerReflectionInfo ¶
func (listener *Listener) ServerReflectionInfo(stream rpb.ServerReflection_ServerReflectionInfoServer) error
ServerReflectionInfo handles the gRPC reflection v1 alpha implementation.
type ListenerOptions ¶
type ListenerOptions struct { }
ListenerOptions represents the available HTTP options
func ParseListenerOptions ¶
func ParseListenerOptions(options specs.Options) (*ListenerOptions, error)
ParseListenerOptions parses the given specs options into HTTP options
type Method ¶
Method represents a gRPC endpoint
func (*Method) GetRequest ¶
GetRequest returns the request input parameter map
func (*Method) GetResponse ¶
GetResponse returns the request output parameter map
func (*Method) References ¶
References returns the available method references