|
ZIO
Python and C++ interface to ZeroMQ and Zyre
|
Public Member Functions | |
| def | __init__ (self, ctx, ruleset, wactors=(), ractor=()) |
| def | __call__ (self, bot) |
| def | launch_read (self, filename, bot, rule) |
| def | launch_write (self, filename, bot, rule) |
| def | stop (self) |
Public Attributes | |
| ctx | |
| ruleset | |
| wactors | |
| ractor | |
| writers | |
| handlers | |
Use a ruleset to mate flow client to a file resource. The ruleset factory will apply each rule in the set and used the first one that evaluates True. This will govern the parameters for the file resource. The file resource is delegated to a pair of actor functions for reading and another for writing. A single reader/writer actor is launched to handle each new file and a reader or writer handler is used to handle each new client.
Definition at line 18 of file factories.py.
| def zio.flow.factories.Ruleset.__init__ | ( | self, | |
| ctx, | |||
| ruleset, | |||
wactors = (), |
|||
ractor = () |
|||
| ) |
Create a Factory with a ruleset.
Parameters
----------
ctx : a zmq.Context
ruleset: array of dictionary
A ruleset is a sequence of rule specifications (see Rule
Attributes below).
wactors : 2-tuple of 2-tuples specifing file writing actors
See below.
ractor : 2-tuple specifying file reading actors and any args
See below
The "*actors" args are 2-tuples specifying actor functions and
optional user data arguments for writing and reading.
The head of the 2-tuple is for the file actor which directly
manages some file resource. The tail is for the client actor
which will connect to the file actor socket (and presumably
some other socket). If either element of this 2-tuple is
itself a tuple then the head is treated as the actor function
and any remainder is passed to the function as user data
arguments.
A file actor is called as:
file_handler(ctx, pipe,
filename,
*user_data):
The file actor function must adhere to a simple protocol on
its actor pipe. After issuing the usual actor ready signal
and before entering its loop, the file actor shall return on
its actor pipe as a string the address of a bound socket to
which any subsequent client actors may connect.
A client actor is called as:
client_handler(ctx, pipe,
bot, rule_object, file_addr,
*user_data)
The client actor has no protocol on its actor pipe other than
the usual ready signal.
Rule Attributes
---------------
rule : string
An S-expression in terms of attributes evaluating to a
Boolean. First rule returning True is used. Here and
below "attributes" refer to the combination of BOT message
header values and any additional specified in the `attr`
Rule Attribute (described below).
rw : string
Takes value "read" or "write" and determines if the flow
is to be read from or written to file.
filepat : f-string
An f-string formatted against the attributes which
resolves to the name of the file to be read or written.
grouppat : f-string
An f-string formatted against attributes to determine and
to add a "hdfgroup" parameter to the BOT message prior to
it being sent into a read or write handler. The value
will be used to define an HDF base group path into which
messages from one stream will be mapped. This path must
be unique to the flow client.
attr : dictionary
An optional, extra dictionary of attributes updated on the
dictionary of message attributes prior to applying to the
rule or either patterns.
Definition at line 33 of file factories.py.
| def zio.flow.factories.Ruleset.__call__ | ( | self, | |
| bot | |||
| ) |
Given a bot, return a live actor or None if bot is rejected.
Definition at line 131 of file factories.py.
| def zio.flow.factories.Ruleset.launch_read | ( | self, | |
| filename, | |||
| bot, | |||
| rule | |||
| ) |
Definition at line 160 of file factories.py.
| def zio.flow.factories.Ruleset.launch_write | ( | self, | |
| filename, | |||
| bot, | |||
| rule | |||
| ) |
Definition at line 172 of file factories.py.
| def zio.flow.factories.Ruleset.stop | ( | self | ) |
Definition at line 198 of file factories.py.
| zio.flow.factories.Ruleset.ctx |
Definition at line 123 of file factories.py.
| zio.flow.factories.Ruleset.handlers |
Definition at line 128 of file factories.py.
| zio.flow.factories.Ruleset.ractor |
Definition at line 126 of file factories.py.
| zio.flow.factories.Ruleset.ruleset |
Definition at line 124 of file factories.py.
| zio.flow.factories.Ruleset.wactors |
Definition at line 125 of file factories.py.
| zio.flow.factories.Ruleset.writers |
Definition at line 127 of file factories.py.
1.8.13