Command-line launcher and event loop for x/84.

x84.engine.accept(log, server, check_ban)[source]

Accept new connection from server, spawning an unmanaged thread.

Connecting socket accepted is server.server_socket, instantiate a new instance of client_factory, with optional keyword arguments defined by server.client_factory_kwargs, registering it with dictionary server.clients, and spawning an unmanaged thread using connect_factory, with optional keyword arguments server.connect_factory_kwargs.

x84.engine.client_recv(servers, ready_fds, log)[source]

Test all clients for recv_ready().

If any data is available, then client.socket_recv() is called, buffering the data for the session which is exhausted by session_send().

x84.engine.client_send(terminals, log)[source]

Test all clients for send_ready().

If any data is available, then tty.client.send() is called. This is data sent from the session to the tcp client.

x84.engine.find_server(servers, fd)[source]

Find matching server.server_socket for given file descriptor.


Instantiate and return enabled servers by configuration CFG.


Return file descriptors of all tty.master_read pipes.

x84.engine.handle_lock(locks, tty, event, data, tap_events, log)[source]

handle locking event of (lock-key, (method, stale)).


x84 main entry point. The system begins and ends here.

Command line arguments to engine.py:

  • --config= location of alternate configuration file
  • --logger= location of alternate logging.ini file
x84.engine.session_recv(locks, terminals, log, tap_events)[source]

Receive data waiting for terminal sessions.

All data received from subprocess is handled here.


Test all tty clients for input_ready().

Meaning, tcp data has been buffered to be received by the tty session, and send it to the tty input queue (tty.master_write). Also, test all sessions for idle timeout, signaling exit to subprocess when reached.


Database request handler for x/84.

class x84.db.DBHandler(queue, event, data)[source]

Bases: threading.Thread

This handler receives and handles a dictionary-based “database command”.

See complimenting x84.bbs.dbproxy.DBProxy, which behaves as a dictionary and “packs” command iterables through an IPC event queue which is then dispatched by the engine.

The return values are sent to the session queue with equal ‘event’ name.

Class initializer.

  • queue (multiprocessing.Pipe) – parent input end of a tty session ipc queue (tty.master_write).
  • event (str) – database schema in form of string 'db-schema' or 'db=schema'. When '-' is used, the result is returned as a single transfer. When '=', an iterable is yielded and the data is transfered via the IPC Queue as a stream.
  • data (tuple) – a dict method proxy command sequence in form of (table, command, arguments). For example, ``(‘unnamed’, ‘pop’, 0).

Execute database command and return results to session queue.


Verify permission access of given database file.

  • AssertionError – file or folder is not writable.
  • OSError – could not write containing folder.
x84.db.get_database(filepath, table)[source]

Return sqlitedict.SqliteDict instance for given database.


Return filesystem path of given database schema.

x84.db.get_db_func(dictdb, cmd)[source]

Return callable function of method on dictdb.

Raises AssertionError:
 not a valid method or not callable.
x84.db.get_db_lock(schema, table)[source]

Return database lock for given (schema, table).

x84.db.log_db_cmd(log, schema, cmd, args)[source]

Log database command (when tap_db ini option is used).


Parse a database event into (iterable, schema).

Called by class initializer, to determine if the event should return an iterable, and for what database name (schema).

Return type:tuple