I provide a public interface for non-blocking database access to persistently stored name:value items within a uniquely identified group.

Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database engine. A single argument is used, which specifies a connection to a database via an RFC-1738 url. In addition, the keyword options can be employed that are listed in the API docs for sasync.

You can set an engine globally, for all instances of me, via the sasync.engine package-level function, or via the queue.Factory.setGlobal class method. Alternatively, you can specify an engine for one particular instance by supplying the parameters to my constructor.

Construct me for the items of a particular group uniquely identified by the supplied hashable ID. In addition to any engine-specifying keywords supplied, the following is particular to my constructor:

ParametersnameTypeA type object defining the type that each name will be coerced to after being loaded as a string from the database.
Method __init__ Constructor
Method write Performs a database write transaction, returning a deferred to its completion.
Method load Loads item name from the database, returning a deferred to the loaded value. A Missing object represents the value of a missing item.
Method loadAll Loads all items in my group from the database, returning a deferred to a dict of the loaded values. The keys of the dict are coerced to the type of my nameType attribute.
Method update Updates the database entry for item name = value, returning a deferred that fires when the transaction is done.
Method insert Inserts a database entry for item name = value, returning a deferred that fires when the transaction is done.
Method delete Deletes the database entries for the items having the supplied *names, returning a deferred that fires when the transaction is done.
Method names Returns a deferred that fires with a list of the names of all items currently defined in my group.
def __init__(self, ID, *url, **kw):

Constructor

def write(self, funcName, name, value, niceness=None):

Performs a database write transaction, returning a deferred to its completion.

def load(self, name):

Loads item name from the database, returning a deferred to the loaded value. A Missing object represents the value of a missing item.

@defer.inlineCallbacks
def loadAll(self):

Loads all items in my group from the database, returning a deferred to a dict of the loaded values. The keys of the dict are coerced to the type of my nameType attribute.

def update(self, name, value):

Updates the database entry for item name = value, returning a deferred that fires when the transaction is done.

def insert(self, name, value):

Inserts a database entry for item name = value, returning a deferred that fires when the transaction is done.

def delete(self, *names):

Deletes the database entries for the items having the supplied *names, returning a deferred that fires when the transaction is done.

def names(self):

Returns a deferred that fires with a list of the names of all items currently defined in my group.

API Documentation for sAsync, generated by pydoctor at 2021-09-18 08:41:22.