Skip to content

Serverpool connection

campadrenalin edited this page Sep 22, 2011 · 2 revisions

ConcurrenTree.util.server.pool.connection

Connection

Represents a single connection provided by a server in the pool. It exchanges messages with the pool bus (message = a dict with a value for key "type"), and exchanges strings with its own server, which handles IO. It is the server's duty to call connection.cycle() and server_pull and server_push the connection's ioqueue property.

This is meant to be used as a base class for protocol-specific subclasses, like model.bcp.connection.

Methods:
* __init__() # Initializes properties
* cycle() # Function to be called regularly by the server, allows connection to do its thing on server time.
* read() # Called by cycle. Reads input from ioqueue, operates the buffer, and forwards input to incoming().
* write() # Called by cycle. Reads output from queue, calls outgoing(), and sends the result to ioqueue.
* incoming(value) # takes raw input and returns the new buffer. Override required.
* outgoing(value) # takes a message from the pool, returns a string to output to ioqueue. Override required.
* close() # Close the connection.

Properties:
* queue # A Doublequeue for communication with the pool in messages (pool is the server).
* ioqueue # A Doublequeue for communication with the server in strings.
* buffer # A string the connection uses for IO input that allows incomplete remote data to be received in chunks.
* closed # A boolean.

Serverpool System
Python Library

Clone this wiki locally