Commits

Objects are stored by doing commit on one or more objects. All objects stored in a commit are stored in one transaction. The object graph is analysed to find other referenced objects.

Object version

All objects has a version number which is incremented during commit.

Marking objects as updated

Objects can either be commit directly by passing them to commit(), or by first call updated() on the objects, followed by commit_all() and at some later point.

Traversing the object graph

API

commit

1MyType *object1 = ...;
2MyType *object2 = ...;
3AnotherType *anotherOobject = ...;
4
5db.commit({object1, object2});
6db.commit(anotherObject);
7
8std::vector<MyType*> objects;
9db.commit(objects);
1let object1 = ...;
2let object2 = ...;
3let anotherObject = ...;
4
5db.commit([object1, object2]);
6db.commit(anotherObject);
7
8let objects = [o1, o2, o3,...];
9db.commit(objects);

update & commit_all

1MyType *object1 = ...;
2MyType *object2 = ...;
3AnotherType *anotherOobject = ...;
4
5db.updated({object1, object2});
6db.updated(anotherObject);
7
8std::vector<MyType*> objects;
9db.commit_all();
1let object1 = ...;
2let object2 = ...;
3let anotherObject = ...;
4
5db.updated([object1, object2]);
6db.updated(anotherObject);
7
8let objects = [o1, o2, o3,...];
9db.commit_all();

Controlling disk sync, caching and storage behaviour

By applying a flag for the commit call the disk sync, caching and storage behaviour can be modified:

The flags are:

cache

The object data will be cached in memory in addition to being stored on disk.

1db.commit({object1, object2}, dboo::cache);
1db.commit([object1, object2], dboo.cache);

cache_only

Does not save the object to disk at all. Note that this should never be applied to commits of objects that are referenced by others that are stored to disk.

1db.commit({object1, object2}, dboo::no_store);
1db.commit([object1, object2], dboo.no_store);

no_sync

Avoids filesystem sync to disk within the transaction:

1db.commit({object1, object2}, dboo::no_sync);
1db.commit([object1, object2], dboo.no_sync);