dragon.infrastructure.connection

Internal objects required for infrastructure process communication.

Functions

Client([address, family, authkey])

Pipe([duplex, channels, options])

Pipe constructor, producing two Connections.

get_next_ctr()

make_uniq_chan_names()

Classes

Address

Address class for dragon servers and listeners and all that

CUID

A wrapper around int to allow waiting on a cuid.

Connection

Dragon infrastructure's internal connection class.

ConnectionOptions

Options for dragon.Connections

Listener

PipeOptions

Options for the Pipe factory.

class ConnectionOptions

Options for dragon.Connections

Separate object because this will expand over time.

There are a number of different facts about how one might want a Connection object to behave vs. its underlying Channels and its interaction with Global Services, together with anticipated need to let someone customize how the object behaves for performance. This object is meant to organize all these into one object.

class CreationPolicy

An enumeration.

__init__(*, creation_policy=CreationPolicy.EXTERNALLY_MANAGED, min_block_size=None, large_block_size=None, huge_block_size=None, default_pool=None)
class PipeOptions

Options for the Pipe factory.

Separate object because this, too, will expand over time.

Same rationale as for ConnectionOptions.

class CreationPolicy

An enumeration.

__init__(*, creation_policy=CreationPolicy.EARLY, conn_options=None)
class CUID

A wrapper around int to allow waiting on a cuid.

class Connection

Dragon infrastructure’s internal connection class.

class State

An enumeration.

__init__(*, inbound_initializer=None, outbound_initializer=None, options=None, policy=Policy((WaitMode(2), ReturnWhen(2))))

Initializes the Connection object.

The object is initialized in an inbound direction, an outbound direction, or both. These initializers can be either - a Channel object, whose lifecycle is assumed externally managed - a bytes-like descriptor, attached to lazily, destroyed automatically - a string name, for a rendezvous in Global services.

TODO: document current behavior and design intent MUCH more thoroughly

Parameters
  • inbound_initializer – an initializer for the inbound channel

  • outbound_initializer – an initializer for the outbound channel

  • options – ConnectionOptions object

  • policy – A Policy object.

ghost_close()

Force the connection into a closed state without sending EOT

This ‘ghosts’ the receiver on the other end, which won’t be getting an EOT message from this object, but when using externally managed Channels on this object that is what one might want to do, in order to transfer use of that Channel.

thread_wait(timeout, done_ev, ready)

Thread waiter signaling with an ev.

property closed

True if the connection is closed

property readable

True if the connection is readable

property writable

True if the connection is writable

Pipe(duplex=True, *, channels=None, options=None)

Pipe constructor, producing two Connections.

The channels parameter can be None, indicating that this is an anonymous Pipe requiring a new channel to be constructed and eventually destroyed by the receiver.

It can also be a Channel object or descriptor in which case the two Connections returned will communicate through the channel, with one being in read mode and the other in write mode.

Finally, if it is a tuple, it is expected to have two elements which are both channels or channel descriptors and each of which can send and receive.

If the channels parameter is None, then the duplex parameter governs whether the connections are full duplex and whether two new channels get created or only one.

If not duplex, the first one is the reader and the second the writer

The options object carries lifecycle and creation options for the Pipe call and also policy settings for the Connection objects that result, as well as policy on how the Connections objects should interact with the pool when sending data.

Parameters
  • channels – None or a Channel object or a 2-element tuple of distinct Channel objects

  • duplex – default True, whether to produce

  • options – a PipeOptions object

Returns

a pair of Connection objects.

class Address

Address class for dragon servers and listeners and all that

__init__(user_name='')