| Home | Trees | Index | Help |
|
|---|
| Package dejavu :: Module units :: Class Unit |
|
object --+
|
Unit
Unit(**kwarg properties). A generic, persistent object.
Units are the building-block of Dejavu. They are purposefully lightweight,
relying on Sandboxes to cache them, which in turn rely on Storage Managers
to load and save them.
They maintain their own "schema" via UnitProperty objects, so that the
Storage Managers don't need to know every detail about every Unit.
Storage Managers for simple databases, for example, will simply create
a single flat table for each unit type. If you write a custom Storage
Manager, you can do as you like; the only place you might run into a
problem is if you write a custom Storage Manager for custom Unit types,
because the knowledge between the two is indeterminate. For example,
if we provide a standard StorageManagerForLotusNotes, and you create
custom Units which interface with it, you should probably subclass and
extend our StorageManagerForLotusNotes with some custom storage logic.
sandbox: The sandbox in which the Unit "lives". Also serves as a flag
indicating whether this Unit has finished the initial creation
process.
Sandboxes receive Units during recall() and memorize();
these processes should set the sandbox attribute.
dirty: indicates whether elements in the _properties dictionary
have been modified. This flag is used by Sandboxes to optimize
forget(): they do not ask Storage Managers to save data for Units
which have not been modified. Because SM's may cache Units, no code
should set this flag other than UnitProperty.__set__ and SM's.
| Method Summary | |
|---|---|
__init__(self,
**kwargs)
| |
__copy__(self)
| |
__getstate__(self)
| |
__setstate__(self,
state)
| |
Auto-create a relation between self and unit(s). | |
Set UnitAssociations between nearClass.key and farClass.farKey. (Class method) | |
Return a list of UnitAssociation names. (Class method) | |
cleanse(self)
| |
dirty(self)
| |
Destroy this Unit. | |
identity(self)
| |
Return a tuple of names of indexed UnitProperties. (Class method) | |
many_to_one(nearClass,
nearKey,
farClass,
farKey)
(Class method) | |
one_to_many(nearClass,
nearKey,
farClass,
farKey)
(Class method) | |
one_to_one(nearClass,
nearKey,
farClass,
farKey)
(Class method) | |
remove_property(cls,
key)
(Class method) | |
Remove this Unit from memory (do not destroy). | |
Set Unit Properties for cls. (Class method) | |
Set a Unit Property for cls. (Class method) | |
Modify this Unit's property values (via keyword arguments). | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Class Variable Summary | |
|---|---|
type |
__metaclass__ = dejavu.units.MetaUnit |
UnitProperty |
ID = dejavu.units.UnitProperty(type=int, index=True, hin...
|
tuple |
identifiers = ('ID',)
|
list |
properties = ['ID']
|
UnitSequencerInteger |
sequencer = <dejavu.units.UnitSequencerInteger object at...
|
| Instance Method Details |
|---|
add(self, *units)Auto-create a relation between self and unit(s). |
forget(self)Destroy this Unit. |
repress(self)Remove this Unit from memory (do not destroy). |
update(self, **values)Modify this Unit's property values (via keyword arguments). The keyword arguments you supply will be checked against this Unit's known properties; only known properties will be updated. This keeps applications which accept arbitrary parameters safer. |
| Class Method Details |
|---|
associate(nearClass, nearKey, farClass, farKey, nearDescriptor, farDescriptor)Set UnitAssociations between nearClass.key and farClass.farKey. |
associations(cls)Return a list of UnitAssociation names. |
indices(cls)Return a tuple of names of indexed UnitProperties. |
set_properties(cls, types={}, descriptor=<class 'dejavu.units.UnitProperty'>)Set Unit Properties for cls. |
set_property(cls, key, type=<type 'unicode'>, index=False, descriptor=<class 'dejavu.units.UnitProperty'>)Set a Unit Property for cls. |
| Class Variable Details |
|---|
ID
|
identifiers
|
properties
|
sequencer
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Thu Jul 19 15:32:16 2007 | http://epydoc.sf.net |