server

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandler

func RegisterHandler[RequestType proto.Message, ResponseType proto.Message](
	s *RPCServer,
	rpc string,
	topic []string,
	svcImpl func(context.Context, RequestType) (ResponseType, error),
	affinityFunc AffinityFunc[RequestType],
) error

func RegisterStreamHandler

func RegisterStreamHandler[RequestType proto.Message, ResponseType proto.Message](
	s *RPCServer,
	rpc string,
	topic []string,
	svcImpl func(psrpc.ServerStream[ResponseType, RequestType]) error,
	affinityFunc StreamAffinityFunc,
) error

Types

type AffinityFunc

type AffinityFunc[RequestType proto.Message] func(context.Context, RequestType) float32

type RPCServer

type RPCServer struct {
	*info.ServiceDefinition
	psrpc.ServerOpts
	// contains filtered or unexported fields
}

func NewRPCServer

func NewRPCServer(sd *info.ServiceDefinition, b bus.MessageBus, opts ...psrpc.ServerOption) *RPCServer

func (*RPCServer) Close

func (s *RPCServer) Close(force bool)

func (*RPCServer) DeregisterHandler

func (s *RPCServer) DeregisterHandler(rpc string, topic []string)

func (*RPCServer) Publish

func (s *RPCServer) Publish(ctx context.Context, rpc string, topic []string, msg proto.Message) error

type Registerer

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

func NewRegisterer

func NewRegisterer(register, deregister any) Registerer

type RegistererSlice

type RegistererSlice []Registerer

func (RegistererSlice) Deregister

func (rs RegistererSlice) Deregister(params ...any)

func (RegistererSlice) Register

func (rs RegistererSlice) Register(params ...any) error

type StreamAffinityFunc

type StreamAffinityFunc func(ctx context.Context) float32

Jump to

Keyboard shortcuts

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