Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorCode(err error) int32
- func WrapError[T ~int32](err error, code T) error
- type Call
- type CallBase
- type CallIn
- type CallOut
- type Caller
- type Client
- type Dialer
- type Dispatcher
- type ErrorCoder
- type HTTPServer
- type ParentCallAccessor
- type RWDialer
- type RWFDialer
- type RWTransport
- type ReadWriteFlusher
- type ResponseFunc
- type ResponseType
- type SendFunc
- type Server
- type ServiceDispatcher
- type ServiceRegistry
- type Transport
Constants ¶
View Source
const ( ResponseTypeNone = iota ResponseTypeUndefined ResponseTypeError ResponseTypeStream ResponseTypeValue )
ResponseTypes ...
Variables ¶
View Source
var ErrClose = errors.New("response closed")
ErrClose returned when the the server closes a streaming response
View Source
var ErrInvalidType = errors.New("invaild type")
ErrInvalidType returned when the request or response type doesn't match the expected value
View Source
var ErrMessageTooLarge = errors.New("received message too large")
ErrMessageTooLarge emitted when received message exceeds configured limit
View Source
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented ...
Functions ¶
Types ¶
type CallIn ¶
type CallIn struct { CallBase ParentCallAccessor // contains filtered or unexported fields }
CallIn ...
type CallOut ¶
type CallOut struct { CallBase // contains filtered or unexported fields }
CallOut ...
func NewCallOut ¶
NewCallOut ...
func NewCallOutWithParent ¶
func NewCallOutWithParent(ctx context.Context, method string, arg proto.Message, parent Call) (*CallOut, error)
NewCallOutWithParent ...
func (*CallOut) ReadResponse ¶
ReadResponse ...
func (*CallOut) ReadResponseStream ¶
ReadResponseStream ...
type Caller ¶
type Caller interface { CallUnary(ctx context.Context, method string, req proto.Message, res proto.Message) error CallStreaming(ctx context.Context, method string, req proto.Message, res interface{}) error }
Caller ...
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client ...
func (*Client) CallStreaming ¶
func (c *Client) CallStreaming(ctx context.Context, method string, req proto.Message, res interface{}) error
CallStreaming ...
type Dialer ¶
type Dialer interface {
Dial(context.Context, Dispatcher) (Transport, error)
}
Dialer ...
type ErrorCoder ¶ added in v0.3.0
type HTTPServer ¶
type HTTPServer struct {
*ServiceDispatcher
}
HTTPServer ...
func (*HTTPServer) ServeHTTP ¶
func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ParentCallAccessor ¶
ParentCallAccessor ...
type RWDialer ¶
type RWDialer struct { Logger *zap.Logger ReadWriter io.ReadWriter MaxMessageBytes int }
RWDialer ...
type RWFDialer ¶
type RWFDialer struct { Logger *zap.Logger ReadWriteFlusher ReadWriteFlusher }
RWFDialer ...
type RWTransport ¶
type RWTransport struct {
// contains filtered or unexported fields
}
RWTransport ...
func (*RWTransport) Call ¶
func (t *RWTransport) Call(call *CallOut, fn ResponseFunc) error
Call ...
type ReadWriteFlusher ¶
type ReadWriteFlusher interface { io.ReadWriter Flush() error }
ReadWriteFlusher ...
type ResponseType ¶
type ResponseType int
ResponseType ...
func (ResponseType) String ¶
func (t ResponseType) String() string
type Server ¶
type Server struct { *ServiceDispatcher // contains filtered or unexported fields }
Server ...
type ServiceDispatcher ¶
type ServiceDispatcher struct {
// contains filtered or unexported fields
}
ServiceDispatcher ...
func NewServiceDispatcher ¶
func NewServiceDispatcher(logger *zap.Logger) *ServiceDispatcher
NewServiceDispatcher ...
func (*ServiceDispatcher) Dispatch ¶
func (h *ServiceDispatcher) Dispatch(call *CallIn, done func())
Dispatch ...
func (*ServiceDispatcher) RegisterMethod ¶
func (h *ServiceDispatcher) RegisterMethod(name string, method interface{})
RegisterMethod ...
type ServiceRegistry ¶
type ServiceRegistry interface {
RegisterMethod(name string, method interface{})
}
ServiceRegistry ...
Click to show internal directories.
Click to hide internal directories.