sasync.items.Items(object)
class documentation
Part of sasync.items
(View In Hierarchy)
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:
Parameters | nameType | A 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. |
Performs a database write transaction, returning a deferred to its completion.
Loads item name from the database, returning a deferred to the
loaded value. A Missing
object represents
the value of a missing item.
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.
Updates the database entry for item name = value, returning a deferred that fires when the transaction is done.
Inserts a database entry for item name = value, returning a deferred that fires when the transaction is done.