mq

package
v0.0.0-...-389f781 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK    = []byte{0}
	NOK   = []byte{1}
	ERROR = []byte{2}
)

Functions

func Close

func Close(s *zmq4.Socket) error

func Connect

func Connect(ctx *zmq4.Context) (*zmq4.Socket, error)

func Decode

func Decode[T any](b []byte) (T, error)

func Encode

func Encode(v any) ([]byte, error)

func EncodeRouteMessage

func EncodeRouteMessage[T any](rid byte, d T) ([]byte, error)

Nodes should use this function to encode messages to send to central-server.

func LogReplyError

func LogReplyError(err error)

func NewContext

func NewContext() (*zmq4.Context, error)

func RegisterHandlers

func RegisterHandlers(s *zmq4.Socket)

func RegisterPub

func RegisterPub(s *zmq4.Socket)

func Reply

func Reply(s *zmq4.Socket, m ReplyMessage) error

func ReplyNOK

func ReplyNOK(s *zmq4.Socket) error

func ReplyOK

func ReplyOK(s *zmq4.Socket) error

func Send

func Send(s *zmq4.Socket, b []byte) (bool, error)

func SendRawRouteMessage

func SendRawRouteMessage[T any](s *zmq4.Socket, rid byte, d T) ([]byte, error)

func SendRouteMessage

func SendRouteMessage[T any](s *zmq4.Socket, rid byte, d T) (bool, error)

func ServerAddress

func ServerAddress() string

func Start

func Start(ctx *zmq4.Context) (*zmq4.Socket, error)

Types

type ReplyMessage

type ReplyMessage struct {
	Error error
	Data  any
}

func EmptyReplyMessage

func EmptyReplyMessage() ReplyMessage

func ErrorReplyMessage

func ErrorReplyMessage(err error) ReplyMessage

func JSONReplyMessage

func JSONReplyMessage(v any) ReplyMessage

func NotOkReplyMessage

func NotOkReplyMessage() ReplyMessage

func OkReplyMessage

func OkReplyMessage() ReplyMessage

Jump to

Keyboard shortcuts

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