Documentation ¶
Overview ¶
Go (golang) Bindings for 0mq (zmq, zeromq)
Index ¶
- Constants
- Variables
- func Device(t DeviceType, in, out *Socket) error
- func Poll(items []PollItem, timeout time.Duration) (count int, err error)
- func Version() (int, int, int)
- type BoolSocketOption
- type Context
- type DeviceType
- type Int64SocketOption
- type IntSocketOption
- type MessageOption
- type PollEvents
- type PollItem
- type PollItems
- type SendRecvOption
- type Socket
- func (s *Socket) Affinity() (uint64, error)
- func (s *Socket) Backlog() (int, error)
- func (s *Socket) Bind(address string) error
- func (s *Socket) Close() error
- func (s *Socket) Connect(address string) error
- func (s *Socket) Events() (uint64, error)
- func (s *Socket) GetSockOptBool(option BoolSocketOption) (value bool, err error)
- func (s *Socket) GetSockOptInt(option IntSocketOption) (value int, err error)
- func (s *Socket) GetSockOptInt64(option Int64SocketOption) (value int64, err error)
- func (s *Socket) GetSockOptString(option StringSocketOption) (value string, err error)
- func (s *Socket) GetSockOptUInt64(option UInt64SocketOption) (value uint64, err error)
- func (s *Socket) HWM() (uint64, error)
- func (s *Socket) Identity() (string, error)
- func (s *Socket) Linger() (time.Duration, error)
- func (s *Socket) McastLoop() (bool, error)
- func (s *Socket) Rate() (int64, error)
- func (s *Socket) RcvBuf() (uint64, error)
- func (s *Socket) RcvMore() (bool, error)
- func (s *Socket) RcvTimeout() (time.Duration, error)
- func (s *Socket) ReconnectIvl() (time.Duration, error)
- func (s *Socket) ReconnectIvlMax() (time.Duration, error)
- func (s *Socket) RecoveryIvl() (time.Duration, error)
- func (s *Socket) Recv(flags SendRecvOption) (data []byte, err error)
- func (s *Socket) RecvMultipart(flags SendRecvOption) (parts [][]byte, err error)
- func (s *Socket) Send(data []byte, flags SendRecvOption) error
- func (s *Socket) SendMultipart(parts [][]byte, flags SendRecvOption) (err error)
- func (s *Socket) SetAffinity(value uint64) error
- func (s *Socket) SetBacklog(value int) error
- func (s *Socket) SetHWM(value uint64) error
- func (s *Socket) SetIdentity(value string) error
- func (s *Socket) SetLinger(value time.Duration) error
- func (s *Socket) SetMcastLoop(value bool) error
- func (s *Socket) SetRate(value int64) error
- func (s *Socket) SetRcvBuf(value uint64) error
- func (s *Socket) SetRcvTimeout(value time.Duration) error
- func (s *Socket) SetReconnectIvl(value time.Duration) error
- func (s *Socket) SetReconnectIvlMax(value time.Duration) error
- func (s *Socket) SetRecoveryIvl(value time.Duration) error
- func (s *Socket) SetSndBuf(value uint64) error
- func (s *Socket) SetSndTimeout(value time.Duration) error
- func (s *Socket) SetSockOptInt(option IntSocketOption, value int) error
- func (s *Socket) SetSockOptInt64(option Int64SocketOption, value int64) error
- func (s *Socket) SetSockOptString(option StringSocketOption, value string) error
- func (s *Socket) SetSockOptStringNil(option StringSocketOption) error
- func (s *Socket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error
- func (s *Socket) SetSubscribe(value string) error
- func (s *Socket) SetSwap(value int64) error
- func (s *Socket) SetUnsubscribe(value string) error
- func (s *Socket) SndBuf() (uint64, error)
- func (s *Socket) SndTimeout() (time.Duration, error)
- func (s *Socket) Swap() (int64, error)
- func (s *Socket) Type() (SocketType, error)
- type SocketType
- type StringSocketOption
- type UInt64SocketOption
- type ZmqOsSocketType
Constants ¶
const ( // NewSocket types PAIR = SocketType(C.ZMQ_PAIR) PUB = SocketType(C.ZMQ_PUB) SUB = SocketType(C.ZMQ_SUB) REQ = SocketType(C.ZMQ_REQ) REP = SocketType(C.ZMQ_REP) DEALER = SocketType(C.ZMQ_DEALER) ROUTER = SocketType(C.ZMQ_ROUTER) PULL = SocketType(C.ZMQ_PULL) PUSH = SocketType(C.ZMQ_PUSH) XPUB = SocketType(C.ZMQ_XPUB) XSUB = SocketType(C.ZMQ_XSUB) // Deprecated aliases XREQ = DEALER XREP = ROUTER UPSTREAM = PULL DOWNSTREAM = PUSH // NewSocket options AFFINITY = UInt64SocketOption(C.ZMQ_AFFINITY) IDENTITY = StringSocketOption(C.ZMQ_IDENTITY) SUBSCRIBE = StringSocketOption(C.ZMQ_SUBSCRIBE) UNSUBSCRIBE = StringSocketOption(C.ZMQ_UNSUBSCRIBE) RATE = Int64SocketOption(C.ZMQ_RATE) RECOVERY_IVL = Int64SocketOption(C.ZMQ_RECOVERY_IVL) SNDBUF = UInt64SocketOption(C.ZMQ_SNDBUF) RCVBUF = UInt64SocketOption(C.ZMQ_RCVBUF) FD = Int64SocketOption(C.ZMQ_FD) EVENTS = UInt64SocketOption(C.ZMQ_EVENTS) TYPE = UInt64SocketOption(C.ZMQ_TYPE) LINGER = IntSocketOption(C.ZMQ_LINGER) RECONNECT_IVL = IntSocketOption(C.ZMQ_RECONNECT_IVL) RECONNECT_IVL_MAX = IntSocketOption(C.ZMQ_RECONNECT_IVL_MAX) BACKLOG = IntSocketOption(C.ZMQ_BACKLOG) // Send/recv options SNDMORE = SendRecvOption(C.ZMQ_SNDMORE) )
const ( POLLIN = PollEvents(C.ZMQ_POLLIN) POLLOUT = PollEvents(C.ZMQ_POLLOUT) POLLERR = PollEvents(C.ZMQ_POLLERR) )
const ( STREAMER = DeviceType(C.ZMQ_STREAMER) FORWARDER = DeviceType(C.ZMQ_FORWARDER) QUEUE = DeviceType(C.ZMQ_QUEUE) )
const ( RCVTIMEO = IntSocketOption(C.ZMQ_RCVTIMEO) SNDTIMEO = IntSocketOption(C.ZMQ_SNDTIMEO) )
const ( RCVMORE = UInt64SocketOption(C.ZMQ_RCVMORE) RECOVERY_IVL_MSEC = Int64SocketOption(C.ZMQ_RECOVERY_IVL_MSEC) SWAP = Int64SocketOption(C.ZMQ_SWAP) MCAST_LOOP = Int64SocketOption(C.ZMQ_MCAST_LOOP) HWM = UInt64SocketOption(C.ZMQ_HWM) NOBLOCK = SendRecvOption(C.ZMQ_NOBLOCK) // Forwards-compatible aliases: DONTWAIT = NOBLOCK )
Variables ¶
Functions ¶
func Device ¶
func Device(t DeviceType, in, out *Socket) error
run a zmq_device passing messages between in and out
Types ¶
type BoolSocketOption ¶
type BoolSocketOption int
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
* A context handles socket creation and asynchronous message delivery. * There should generally be one context per application.
func (*Context) NewSocket ¶
func (c *Context) NewSocket(t SocketType) (*Socket, error)
Create a new socket. void *zmq_socket (void *context, int type);
func (*Context) SetIOThreads ¶
Set a context option.
type DeviceType ¶
type DeviceType int
type Int64SocketOption ¶
type Int64SocketOption int
type IntSocketOption ¶
type IntSocketOption int
type MessageOption ¶
type MessageOption int
type PollEvents ¶
type PollItem ¶
type PollItem struct { Socket *Socket // socket to poll for events on Fd ZmqOsSocketType // fd to poll for events on as returned from os.File.Fd() Events PollEvents // event set to poll for REvents PollEvents // events that were present }
Item to poll for read/write events on, either a *Socket or a file descriptor
type SendRecvOption ¶
type SendRecvOption int
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
func (*Socket) Backlog ¶
ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections.
func (*Socket) Bind ¶
Bind the socket to a listening address. int zmq_bind (void *s, const char *addr);
func (*Socket) Connect ¶
Connect the socket to an address. int zmq_connect (void *s, const char *addr);
func (*Socket) GetSockOptBool ¶
func (s *Socket) GetSockOptBool(option BoolSocketOption) (value bool, err error)
func (*Socket) GetSockOptInt ¶
func (s *Socket) GetSockOptInt(option IntSocketOption) (value int, err error)
Get an int option from the socket. int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen);
func (*Socket) GetSockOptInt64 ¶
func (s *Socket) GetSockOptInt64(option Int64SocketOption) (value int64, err error)
Get an int64 option from the socket. int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen);
func (*Socket) GetSockOptString ¶
func (s *Socket) GetSockOptString(option StringSocketOption) (value string, err error)
Get a string option from the socket. int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen);
func (*Socket) GetSockOptUInt64 ¶
func (s *Socket) GetSockOptUInt64(option UInt64SocketOption) (value uint64, err error)
Get a uint64 option from the socket. int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen);
func (*Socket) RcvTimeout ¶
ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN.
func (*Socket) ReconnectIvl ¶
ZMQ_RECONNECT_IVL: Retrieve reconnection interval.
func (*Socket) ReconnectIvlMax ¶
ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval.
func (*Socket) RecoveryIvl ¶
ZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds.
func (*Socket) Recv ¶
func (s *Socket) Recv(flags SendRecvOption) (data []byte, err error)
Receive a message from the socket. int zmq_recv (void *s, zmq_msg_t *msg, int flags);
func (*Socket) RecvMultipart ¶
func (s *Socket) RecvMultipart(flags SendRecvOption) (parts [][]byte, err error)
Receive a multipart message.
func (*Socket) Send ¶
func (s *Socket) Send(data []byte, flags SendRecvOption) error
Send a message to the socket. int zmq_send (void *s, zmq_msg_t *msg, int flags);
func (*Socket) SendMultipart ¶
func (s *Socket) SendMultipart(parts [][]byte, flags SendRecvOption) (err error)
Send a multipart message.
func (*Socket) SetAffinity ¶
ZMQ_AFFINITY: Set I/O thread affinity.
func (*Socket) SetBacklog ¶
ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections.
func (*Socket) SetIdentity ¶
ZMQ_IDENTITY: Set socket identity.
func (*Socket) SetMcastLoop ¶
ZMQ_MCAST_LOOP: Control multicast loop-back.
func (*Socket) SetRcvTimeout ¶
ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN.
func (*Socket) SetReconnectIvl ¶
ZMQ_RECONNECT_IVL: Set reconnection interval.
func (*Socket) SetReconnectIvlMax ¶
ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval.
func (*Socket) SetRecoveryIvl ¶
ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds.
func (*Socket) SetSndTimeout ¶
ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN.
func (*Socket) SetSockOptInt ¶
func (s *Socket) SetSockOptInt(option IntSocketOption, value int) error
Set an int option on the socket. int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (*Socket) SetSockOptInt64 ¶
func (s *Socket) SetSockOptInt64(option Int64SocketOption, value int64) error
Set an int64 option on the socket. int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (*Socket) SetSockOptString ¶
func (s *Socket) SetSockOptString(option StringSocketOption, value string) error
Set a string option on the socket. int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (*Socket) SetSockOptStringNil ¶
func (s *Socket) SetSockOptStringNil(option StringSocketOption) error
Set a string option on the socket to nil. int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (*Socket) SetSockOptUInt64 ¶
func (s *Socket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error
Set a uint64 option on the socket. int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);
func (*Socket) SetSubscribe ¶
ZMQ_SUBSCRIBE: Establish message filter.
func (*Socket) SetUnsubscribe ¶
ZMQ_UNSUBSCRIBE: Remove message filter.
func (*Socket) SndTimeout ¶
ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN.
type SocketType ¶
type SocketType int
type StringSocketOption ¶
type StringSocketOption int
type UInt64SocketOption ¶
type UInt64SocketOption int
type ZmqOsSocketType ¶
func (ZmqOsSocketType) ToRaw ¶
func (self ZmqOsSocketType) ToRaw() C.int