ZIO
Python and C++ interface to ZeroMQ and Zyre
Namespaces | Classes | Typedefs | Functions | Variables
zio Namespace Reference

implementation of ZIO data flow protocol endpoints More...

Namespaces

 __main__
 
 domo
 
 flow
 ZIO data flow.
 
 jsonnet
 
 level
 
 lispish
 
 mains
 
 message
 
 node
 
 peer
 
 port
 
 rules
 
 tens
 
 util
 

Classes

struct  CoordHeader
 
class  exception
 general exception class for zio More...
 
struct  Header
 
class  Message
 a ZIO message More...
 
class  message_error
 exception indicating message error More...
 
class  Node
 An identified vertex in a ported, directed graph. More...
 
class  Outbox
 output objects of a fixed native type with levels expressed as methods. More...
 
class  Peer
 Peer at the network to discover peers and advertise self. More...
 
struct  peer_info_t
 
class  Port
 A port holds a socket in the context of a node. More...
 
struct  PrefixHeader
 
class  socket_error
 exception indicating a socket error More...
 
class  zactor_t
 

Typedefs

using json = nlohmann::json
 
typedef uint64_t origin_t
 
typedef uint64_t granule_t
 
typedef uint64_t seqno_t
 
typedef Outbox< std::string > Logger
 two special types of outboxes. More...
 
typedef Outbox< zio::jsonMetric
 Emit structured data. More...
 
typedef std::string nickname_t
 A peer asserts a nickname. More...
 
typedef std::string uuid_t
 Uniquely identify a peer. More...
 
typedef std::string header_key_t
 A "header" is on in a set of key/value pairs asserted by a peer. More...
 
typedef std::string header_value_t
 
typedef std::pair< header_key_t, header_value_theader_t
 
typedef std::map< header_key_t, header_value_theaderset_t
 
typedef std::map< uuid_t, peer_info_tpeerset_t
 
typedef std::shared_ptr< Portportptr_t
 The context can't be copied and ports like to be shared. More...
 
typedef std::chrono::milliseconds time_unit_t
 
typedef std::string remote_identity_t
 

Functions

std::pair< socket_t, socket_tcreate_linked_pairs (context_t &ctx)
 
int sock_type (const socket_t &sock)
 Return the ZeroMQ socket type number for the socket. More...
 
std::string sock_type_name (int stype)
 
void init_signals ()
 
void init_logging ()
 
void init_all ()
 
remote_identity_t recv_serverish (socket_t &socket, multipart_t &mmsg)
 
remote_identity_t recv_server (socket_t &server_socket, multipart_t &mmsg)
 
remote_identity_t recv_router (socket_t &router_socket, multipart_t &mmsg)
 
void send_serverish (socket_t &socket, multipart_t &mmsg, remote_identity_t rid)
 
void send_server (socket_t &server_socket, multipart_t &mmsg, remote_identity_t rid)
 
void send_router (socket_t &router_socket, multipart_t &mmsg, remote_identity_t rid)
 
void recv_clientish (socket_t &socket, multipart_t &mmsg)
 
void recv_client (socket_t &client_socket, multipart_t &mmsg)
 
void recv_dealer (socket_t &dealer_socket, multipart_t &mmsg)
 
void send_clientish (socket_t &socket, multipart_t &mmsg)
 
void send_client (socket_t &client_socket, multipart_t &mmsg)
 
void send_dealer (socket_t &dealer_socket, multipart_t &mmsg)
 
std::chrono::milliseconds now_ms ()
 
std::chrono::microseconds now_us ()
 
void sleep_ms (std::chrono::milliseconds zzz)
 
bool interrupted ()
 
void catch_signals ()
 

Variables

const int HEARTBEAT_LIVENESS = 3
 
const time_unit_t HEARTBEAT_INTERVAL {2500}
 
const time_unit_t HEARTBEAT_EXPIRY {HEARTBEAT_INTERVAL * HEARTBEAT_LIVENESS}
 

Detailed Description

implementation of ZIO data flow protocol endpoints

An actor is a function running in a thread with a control link to the parent thread.

This actor implements the "mini protocol" for startup/shutdown used by CZMQ

ZIO domo protocol constants

This header holds 7/MDP constants.

Functions to manage message data including send and receiving with a socket.

Handle TENS message form.

The zio module provides Python functionality similar to C++ libzio.

This module does not bepend on libzio and instead uses PyZMQ and Pyre.

The Python classes are similar if not exactly the same as those found
in the zio:: C++ namespace.

>>> import zio
>>> n = zio.Node(...)
>>> p = n.port("portname", zmq.CLIENT)
>>> p.bind(...)
>>> p.connect(...)
>>> f = zio.Flow(p)
>>> bot = f.bot()
>>> dat = ...
>>> ok = f.dat(dat)

Typedef Documentation

◆ granule_t

typedef uint64_t zio::granule_t

Definition at line 37 of file message.hpp.

◆ header_key_t

typedef std::string zio::header_key_t

A "header" is on in a set of key/value pairs asserted by a peer.

Definition at line 17 of file peer.hpp.

◆ header_t

Definition at line 21 of file peer.hpp.

◆ header_value_t

typedef std::string zio::header_value_t

Definition at line 18 of file peer.hpp.

◆ headerset_t

Definition at line 22 of file peer.hpp.

◆ json

using zio::json = typedef nlohmann::json

Definition at line 9 of file interned.hpp.

◆ Logger

typedef Outbox<std::string> zio::Logger

two special types of outboxes.

A text based logger to use like print().

Definition at line 65 of file outbox.hpp.

◆ Metric

Emit structured data.

Definition at line 68 of file outbox.hpp.

◆ nickname_t

typedef std::string zio::nickname_t

A peer asserts a nickname.

Definition at line 12 of file peer.hpp.

◆ origin_t

typedef uint64_t zio::origin_t

Definition at line 36 of file message.hpp.

◆ peerset_t

typedef std::map<uuid_t, peer_info_t> zio::peerset_t

Definition at line 36 of file peer.hpp.

◆ portptr_t

typedef std::shared_ptr<Port> zio::portptr_t

The context can't be copied and ports like to be shared.

Definition at line 148 of file port.hpp.

◆ remote_identity_t

typedef std::string zio::remote_identity_t

Definition at line 24 of file util.hpp.

◆ seqno_t

typedef uint64_t zio::seqno_t

Definition at line 38 of file message.hpp.

◆ time_unit_t

typedef std::chrono::milliseconds zio::time_unit_t

Definition at line 11 of file util.hpp.

◆ uuid_t

typedef std::string zio::uuid_t

Uniquely identify a peer.

Definition at line 14 of file peer.hpp.

Function Documentation

◆ catch_signals()

void zio::catch_signals ( )

Catch signals and set interrupted to true.

This should be called from main(). For higher level interface, see zio::init_signals() or zio::init_all() from zio/main.hpp.

Definition at line 200 of file util.cpp.

◆ create_linked_pairs()

std::pair<socket_t, socket_t> zio::create_linked_pairs ( context_t ctx)
inline

Return a linked pair of PAIR sockets.

First is bound and second is connected via inproc://

Definition at line 22 of file actor.hpp.

◆ init_all()

void zio::init_all ( )

Definition at line 22 of file main.cpp.

◆ init_logging()

void zio::init_logging ( )

Definition at line 13 of file main.cpp.

◆ init_signals()

void zio::init_signals ( )

Definition at line 8 of file main.cpp.

◆ interrupted()

bool zio::interrupted ( )

Return true when a signal has been sent to the application.

Exit main loop if ever true.

The catch_signals() function must be called in main() for this to ever return true.

Definition at line 194 of file util.cpp.

◆ now_ms()

std::chrono::milliseconds zio::now_ms ( )

Current system time in milliseconds.

Definition at line 174 of file util.cpp.

◆ now_us()

std::chrono::microseconds zio::now_us ( )

Current system time in microseconds.

Definition at line 178 of file util.cpp.

◆ recv_client()

void zio::recv_client ( socket_t client_socket,
multipart_t &  mmsg 
)

◆ recv_clientish()

void zio::recv_clientish ( socket_t socket,
multipart_t &  mmsg 
)

◆ recv_dealer()

void zio::recv_dealer ( socket_t dealer_socket,
multipart_t &  mmsg 
)

◆ recv_router()

remote_identity_t zio::recv_router ( socket_t router_socket,
multipart_t &  mmsg 
)

◆ recv_server()

remote_identity_t zio::recv_server ( socket_t server_socket,
multipart_t &  mmsg 
)

◆ recv_serverish()

remote_identity_t zio::recv_serverish ( socket_t socket,
multipart_t &  mmsg 
)

◆ send_client()

void zio::send_client ( socket_t client_socket,
multipart_t &  mmsg 
)

◆ send_clientish()

void zio::send_clientish ( socket_t socket,
multipart_t &  mmsg 
)

◆ send_dealer()

void zio::send_dealer ( socket_t dealer_socket,
multipart_t &  mmsg 
)

◆ send_router()

void zio::send_router ( socket_t router_socket,
multipart_t &  mmsg,
remote_identity_t  rid 
)

◆ send_server()

void zio::send_server ( socket_t server_socket,
multipart_t &  mmsg,
remote_identity_t  rid 
)

◆ send_serverish()

void zio::send_serverish ( socket_t socket,
multipart_t &  mmsg,
remote_identity_t  rid 
)

◆ sleep_ms()

void zio::sleep_ms ( std::chrono::milliseconds  zzz)

Sleep a while

Definition at line 183 of file util.cpp.

◆ sock_type()

int zio::sock_type ( const socket_t sock)

Return the ZeroMQ socket type number for the socket.

Definition at line 6 of file interned.cpp.

◆ sock_type_name()

std::string zio::sock_type_name ( int  stype)

Definition at line 11 of file interned.cpp.

Variable Documentation

◆ HEARTBEAT_EXPIRY

const time_unit_t zio::HEARTBEAT_EXPIRY {HEARTBEAT_INTERVAL * HEARTBEAT_LIVENESS}

Definition at line 16 of file util.hpp.

◆ HEARTBEAT_INTERVAL

const time_unit_t zio::HEARTBEAT_INTERVAL {2500}

Definition at line 15 of file util.hpp.

◆ HEARTBEAT_LIVENESS

const int zio::HEARTBEAT_LIVENESS = 3

Definition at line 14 of file util.hpp.