s.i.Items(object) : class documentation

Part of sasync.items View In Hierarchy Source for items.py Main doc for sAsync

I provide a public interface for non-blocking database access to persistently stored name:value items within a uniquely identified group, e.g., for a persistent dictionary using pdict.PersistentDict.

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.

Method __init__ Instantiates me for the items of a particular group uniquely identified by the supplied hashable ID.
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):

Instantiates 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 are particular to this constructor:

Parameters ID A hashable object that is used as my unique identifier.
nameType A type object defining the type that each name will be coerced to after being loaded as a string from the database.
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 2016-11-16 14:52:15.