response

package
v0.0.0-...-0ba0ddf Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

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 any) error

Send calls send method of internal streamer.

type Option

type Option func(*cfg)

Option is an option of Service constructor.

func WithNetworkState

func WithNetworkState(v netmap.State) Option

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

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

func NewService(opts ...Option) *Service

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 any, handler util.UnaryHandler) (util.ResponseMessage, error)

HandleUnaryRequest call passes request to handler, sets response meta header values and returns it.

Jump to

Keyboard shortcuts

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