zmq/poller

Types

ZPoller = object
  items*: seq[ZPollItem]

Poller type to simplify polling in ZMQ.

While, ZPoller can access the underlying socket to send / receive message, it must not close any socket. It is mandatory to manage the lifetimes of the polled sockets independently of the ZPoller - either manually or by using a ZConnection.

Procs

proc `=destroy`(poll: ZPoller) {....raises: [], tags: [], forbids: [].}
proc `[]`(poller: ZPoller; idx: int): lent ZPollItem {....raises: [], tags: [],
    forbids: [].}
proc events(p: ZPollItem): bool {....raises: [], tags: [], forbids: [].}
Evaluate the bitflag revents with the event flag passed at register
proc events(p: ZPollItem; events: int): bool {....raises: [], tags: [], forbids: [].}
Evaluate the bitflag revents with events
proc initZPoller(items: openArray[tuple[con: ZConnection, event: cshort]]): ZPoller {.
    ...raises: [], tags: [], forbids: [].}
Init a ZPoller with each item its events flags
proc initZPoller(items: openArray[tuple[sock: ZSocket, event: cshort]]): ZPoller {.
    ...raises: [], tags: [], forbids: [].}
Init a ZPoller with each item its events flags
proc initZPoller(items: openArray[ZConnection]; event: cshort): ZPoller {.
    ...raises: [], tags: [], forbids: [].}
Init a ZPoller with all items on the same event
proc initZPoller(items: openArray[ZSocket]; event: cshort): ZPoller {.
    ...raises: [], tags: [], forbids: [].}
Init a ZPoller with all items on the same event
proc len(poller: ZPoller): int {....raises: [], tags: [], forbids: [].}
Return the number of registered ZConnections
proc poll(items: openArray[ZPollItem]; timeout: int64): int32 {....raises: [],
    tags: [], forbids: [].}
High level poll function using array of ZPollItem
proc poll(poller: ZPoller; timeout: int64): int32 {....raises: [], tags: [],
    forbids: [].}
High level poll function
proc register(poller: var ZPoller; conn: ZConnection; event: int) {....raises: [],
    tags: [], forbids: [].}
Register ZConnection
proc register(poller: var ZPoller; sock: ZSocket; event: int) {....raises: [],
    tags: [], forbids: [].}
Register ZSocket function