nofeardb.engine.StorageEngine

class nofeardb.engine.StorageEngine(root: str)

Bases: object

Storage Engine Class

create(doc: Document)

create the document (and persist changes to all related documents)

Parameters

doc (nofeardb.orm.Document) – document to create.

Raises

nofeardb.exceptions.NotCreateableException – If the document can not be created.

create_json(doc: Document) dict

creates the json that should be stored for a new object

delete(doc: Document)

delete the document

delete_json(doc: Document)

deletes document data from disk

get_doc_basepath(doc: Document)

get the base file path for the document type

lazy_load(doc: Document)

executes lazy loading for docs that are marked as LAZY

read(doc_type: type) Query

read the documents of the specified type

register_models(models: List[type])

Register the model classes to the storage engine. Needed to recosntruct the models from json.

resolve_dependencies(doc: Document, scope: Optional[str] = None) List[Document]

creates a stack with depending documents

update(doc: Document)

update the document

update_json(json_to_update: dict, doc: Document) dict

updates the json by modified fields of an object

write_json(doc: Document)

writes the document data to disk