ZIO
Python and C++ interface to ZeroMQ and Zyre
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
zio.flow.proto.Flow Class Reference

Public Member Functions

def __init__ (self, port)
 
def send_bot (self, msg)
 
def recv_bot (self, timeout=-1)
 
def slurp_pay (self, timeout=None)
 
def put (self, msg)
 
def flush_pay (self)
 
def get (self, timeout=None)
 
def send_eot (self, msg=Message())
 
def recv_eot (self, timeout=None)
 

Public Attributes

 port
 
 send_seqno
 
 is_sender
 
 credit
 
 total_credit
 
 recv_seqno
 
 routing_id
 

Static Public Attributes

int credit = 0
 
int total_credit = 0
 
bool is_sender = True
 
int routing_id = 0
 
int send_seqno = -1
 
int recv_seqno = -1
 

Detailed Description

A Flow object provides ZIO flow protocol API

It is equivalent to the C++ zio::flow::Flow class

All timeouts are in milliseconds.  A timeout of None means forever.

Definition at line 21 of file proto.py.

Constructor & Destructor Documentation

◆ __init__()

def zio.flow.proto.Flow.__init__ (   self,
  port 
)
Construct a flow object on a port.

Application shall handle ports bind/connect and online states.

Definition at line 37 of file proto.py.

Member Function Documentation

◆ flush_pay()

def zio.flow.proto.Flow.flush_pay (   self)
Send any accumulated credit as PAY.

This is called in a get() but app may call any time after a
BOT exchange.  Number of credits sent is returned.  This does
not block.

Definition at line 164 of file proto.py.

◆ get()

def zio.flow.proto.Flow.get (   self,
  timeout = None 
)
Receive and return a DAT message and send any accumulated PAY.

Return None if EOT was received instead of DAT.

Exceptions raised.

Definition at line 187 of file proto.py.

◆ put()

def zio.flow.proto.Flow.put (   self,
  msg 
)
Send a DAT message and slurp for any waiting PAY.

Return True if sent, None if an EOT was received instead of
PAY.

Definition at line 139 of file proto.py.

◆ recv_bot()

def zio.flow.proto.Flow.recv_bot (   self,
  timeout = -1 
)
Receive and return BOT message or None.

Returns None if EOT was received.  

Raises exceptions

Definition at line 63 of file proto.py.

◆ recv_eot()

def zio.flow.proto.Flow.recv_eot (   self,
  timeout = None 
)
Recv an EOT message.

EOT message is returned or None if timeout occurs.

If app explicitly calls send_eot() it should call recv_eot()
to wait for the ack from the other end.  If an app receives
EOT as an unepxected message while receiving PAY or DAT then
it should send_eot() but not expect another EOT ack.

Definition at line 244 of file proto.py.

◆ send_bot()

def zio.flow.proto.Flow.send_bot (   self,
  msg 
)
Send a BOT message to the other end.

Client calls send_bot() first, server calls send_bot() second.

Definition at line 45 of file proto.py.

◆ send_eot()

def zio.flow.proto.Flow.send_eot (   self,
  msg = Message() 
)
Send EOT message to other end.

Note, if app initiates the EOT, it should then call
recv_eot().  If it unexpectedly got EOT when recving another
then it should send EOT as a response.

Definition at line 224 of file proto.py.

◆ slurp_pay()

def zio.flow.proto.Flow.slurp_pay (   self,
  timeout = None 
)
Receive any waiting PAY messages

The flow object will slurp prior to a sending a DAT but the
application may call this at any time after BOT.  Number of
credits slurped is returned.  None is returned if other than a
PAY is received.  Caller should likely respond to that with
send_eot(msg,0).

Definition at line 105 of file proto.py.

Member Data Documentation

◆ credit [1/2]

int zio.flow.proto.Flow.credit = 0
static

Definition at line 30 of file proto.py.

◆ credit [2/2]

zio.flow.proto.Flow.credit

Definition at line 93 of file proto.py.

◆ is_sender [1/2]

bool zio.flow.proto.Flow.is_sender = True
static

Definition at line 32 of file proto.py.

◆ is_sender [2/2]

zio.flow.proto.Flow.is_sender

Definition at line 92 of file proto.py.

◆ port

zio.flow.proto.Flow.port

Definition at line 43 of file proto.py.

◆ recv_seqno [1/2]

int zio.flow.proto.Flow.recv_seqno = -1
static

Definition at line 35 of file proto.py.

◆ recv_seqno [2/2]

zio.flow.proto.Flow.recv_seqno

Definition at line 101 of file proto.py.

◆ routing_id [1/2]

int zio.flow.proto.Flow.routing_id = 0
static

Definition at line 33 of file proto.py.

◆ routing_id [2/2]

zio.flow.proto.Flow.routing_id

Definition at line 102 of file proto.py.

◆ send_seqno [1/2]

int zio.flow.proto.Flow.send_seqno = -1
static

Definition at line 34 of file proto.py.

◆ send_seqno [2/2]

zio.flow.proto.Flow.send_seqno

Definition at line 58 of file proto.py.

◆ total_credit [1/2]

int zio.flow.proto.Flow.total_credit = 0
static

Definition at line 31 of file proto.py.

◆ total_credit [2/2]

zio.flow.proto.Flow.total_credit

Definition at line 100 of file proto.py.


The documentation for this class was generated from the following file: