Documentation ¶
Index ¶
- type ClientMessageStreamer
- type Option
- type ServerMessageStreamer
- type Service
- func (s *Service) CreateRequestStreamer(sender util.RequestMessageWriter, closer util.ClientStreamCloser) *ClientMessageStreamer
- func (s *Service) HandleServerStreamRequest(respWriter util.ResponseMessageWriter) util.ResponseMessageWriter
- func (s *Service) HandleUnaryRequest(ctx context.Context, req interface{}, handler util.UnaryHandler) (util.ResponseMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientMessageStreamer ¶
type ClientMessageStreamer struct {
// contains filtered or unexported fields
}
ClientMessageStreamer represents client-side message streamer that sets meta values to the response.
func (*ClientMessageStreamer) CloseAndRecv ¶
func (s *ClientMessageStreamer) CloseAndRecv() (util.ResponseMessage, error)
CloseAndRecv closes internal stream, receivers the response, sets meta values and returns the result.
func (*ClientMessageStreamer) Send ¶
func (s *ClientMessageStreamer) Send(req interface{}) error
Send calls send method of internal streamer.
type Option ¶
type Option func(*cfg)
Option is an option of Service constructor.
func WithNetworkState ¶
WithNetworkState returns option to set network state of Service.
type ServerMessageStreamer ¶
type ServerMessageStreamer struct {
// contains filtered or unexported fields
}
ServerMessageStreamer represents server-side message streamer that sets meta values to all response messages.
func (*ServerMessageStreamer) Recv ¶
func (s *ServerMessageStreamer) Recv() (util.ResponseMessage, error)
Recv calls Recv method of internal streamer, sets response meta values and returns the response.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents universal v2 service that sets response meta header values.
func NewService ¶
NewService creates, initializes and returns Service instance.
func (*Service) CreateRequestStreamer ¶
func (s *Service) CreateRequestStreamer(sender util.RequestMessageWriter, closer util.ClientStreamCloser) *ClientMessageStreamer
CreateRequestStreamer wraps stream methods and returns ClientMessageStreamer instance.
func (*Service) HandleServerStreamRequest ¶
func (s *Service) HandleServerStreamRequest(respWriter util.ResponseMessageWriter) util.ResponseMessageWriter
HandleServerStreamRequest builds internal streamer via handlers, wraps it to ServerMessageStreamer and returns the result.
func (*Service) HandleUnaryRequest ¶
func (s *Service) HandleUnaryRequest(ctx context.Context, req interface{}, handler util.UnaryHandler) (util.ResponseMessage, error)
HandleUnaryRequest call passes request to handler, sets response meta header values and returns it.