stream

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientHandler

type ClientHandler struct {
	// contains filtered or unexported fields
}

func NewClientHandler

func NewClientHandler(
	rectToServerReqCb ClientRecvFromServerReqFunc,
	statusChangeCb ClientStatusChangeFunc,
) *ClientHandler

type ClientRecvFromServerReqFunc

type ClientRecvFromServerReqFunc func(*protos.ClientToServer) (bool, *protos.ServerToClient, error)

type ClientStatusChangeFunc added in v0.1.0

type ClientStatusChangeFunc func(defs.Status, control.ClientUID) error

type FromS

type FromS interface {
	*protos.ServerToClient | *protos.ServerToSampler
}

type Handler

type Handler[T ToS, F FromS] interface {
	// contains filtered or unexported methods
}

type Options

type Options struct {
	// RegistrationReqTimeout is a duration for the maximum amount of time to wait
	// for a registration request after a new client/sampler connection.
	RegistrationReqTimeout time.Duration
	// ResponseTimeout is a duration for the maximum amount of time to wait
	// for a response to a request send to the client/sampler.
	ResponseTimeout time.Duration
	// ServerReqsQueueLen defines how many client/sampler requests are allowed to be queued.
	ReqsQueueLen int
}

func NewOptionsDefault

func NewOptionsDefault() *Options

type SamplerHandler

type SamplerHandler struct {
	// contains filtered or unexported fields
}

func NewSamplerHandler

func NewSamplerHandler(
	rectToServerReqCb SamplerRecvFromServerReqFunc,
	statusChangeCb SamplerStatusChangeFunc,
) *SamplerHandler

type SamplerRecvFromServerReqFunc

type SamplerRecvFromServerReqFunc func(*protos.SamplerToServer) (bool, *protos.ServerToSampler, error)

type SamplerStatusChangeFunc added in v0.1.0

type SamplerStatusChangeFunc func(defs.Status, control.SamplerUID, *protos.SamplerToServer) error

type Stream

type Stream[T ToS, F FromS] struct {
	UID       string
	ServerUID string
	// contains filtered or unexported fields
}

func New

func New[T ToS, F FromS](logger logging.Logger, serverUID string, opts *Options, handler Handler[T, F]) *Stream[T, F]

func (*Stream[ToS, FromS]) Close

func (s *Stream[ToS, FromS]) Close(timeout time.Duration) error

func (*Stream[FromS, ToS]) FromServerMsg

func (s *Stream[FromS, ToS]) FromServerMsg() ToS

func (*Stream[ToS, FromS]) Handle

func (s *Stream[ToS, FromS]) Handle(stream grpcStream[ToS, FromS]) error

func (*Stream[ToS, FromS]) Send

func (s *Stream[ToS, FromS]) Send(fromS FromS) (ToS, error)

type ToS

type ToS interface {
	*protos.ClientToServer | *protos.SamplerToServer
}

Jump to

Keyboard shortcuts

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