Database¶
Renku uses an internal database store in the .renku/metadata
that uses a
custom implementation of the ZODB object database, with a separate file per
main entity.
Custom database for store Persistent objects.
- class renku.core.metadata.database.Database(storage)[source]¶
The Metadata Object Database.
This class is equivalent to a
persistent.DataManager
and implements thepersistent.interfaces.IPersistentDataManager
interface.- add(object, oid=None)[source]¶
Add a new object to the database.
NOTE: Normally, we add objects to indexes but this method adds objects directly to Dataset’s root. Use it only for singleton objects that have no Index defined for them (e.g. Project).
- static generate_oid(object)[source]¶
Generate an
oid
for apersistent.Persistent
object based on its id.
- readCurrent(object)[source]¶
We don’t use this method but some Persistent logic require its existence.
- class renku.core.metadata.database.Index(*args, **kwargs)[source]¶
Database index.
Create an index where keys are extracted using attribute from an object or a key.
- Parameters
name – Index’s name
object_type – Type of objects that the index points to
attribute – Name of an attribute to be used to automatically generate a key (e.g. entity.path)
key_type – Type of keys. If not None then a key must be provided when updating the index
- add(object, *, key=None, key_object=None, verify=True)[source]¶
Update index with object.
If Index._attribute is not None then key is automatically generated. Key is extracted from key_object if it is not None; otherwise, it’s extracted from object.
- generate_key(object, *, key_object=None)[source]¶
Return index key for an object.
Key is extracted from key_object if it is not None; otherwise, it’s extracted from object.
- property name¶
Return Index’s name.
- property object_type¶
Return Index’s object_type.
- renku.core.metadata.database.MARKER = <object object>¶
NOTE: These are used as _p_serial to mark if an object was read from storage or is new
- class renku.core.metadata.database.ObjectReader(database)[source]¶
Deserialize objects loaded from storage.
- class renku.core.metadata.database.ObjectWriter(database)[source]¶
Serialize objects for storage in storage.
- class renku.core.metadata.database.Persistent(*args, **kwargs)[source]¶
Base Persistent class for renku classes.
Subclasses are assumed to be immutable once persisted to the database. If a class shouldn’t be immutable then subclass it directly from persistent.Persistent.
- property immutable¶
Return if object is immutable.
- class renku.core.metadata.database.RenkuOOBTree(*args)[source]¶
Customize
BTrees.OOBTree.BTree
implementation.