Index API
Creating indices
Field indices can be created either through the dboo command line tool, or through the API in respective language. Index type is always specified and options controlling the index update, cache sizes etc can be specified.
dboo me@MyDatabase>
dboo me@MyDatabase> create index MyClass::member_field --index_type=btree (1)
dboo me@MyDatabase>
dboo::odb db{host, port, uid, pwd, db};
db.create_index(&MyClass::member_field, dboo::btree); (1)
const db = dboo.odb(host, port, uid, pwd, db);
db.create_index("MyClass::member_field", dboo.btree); (1)
Notes
- 1
Creating an index for MyClass::member_field of type btree.
Index type
btree - an ordered on disk b-tree with an in-memory cache.
hashmap - an unordered on disk extendible hashmap with an in-memory cache and potentially an in-memory bloom filter.
bloom_filter - an in-memory bloom filter.
Options
cache_size - Maximum number of blocks in the in-memory cache. Defaults to 10000.
update_buffer - Minimum number of objects in the update buffer. Defaults to 1000.
User defined properties
The user can set user defined properties on the index:
1dboo me@MyDatabase> modify index MyClass::member --property=OptA:1.1231,OptB:AValue (1)
2dboo me@MyDatabase> list indices MyClass::.* --properties
3MyClass::member (dboo::double) [btree]: 10000 objects, 258048 bytes (78kB): good
4 Properties:
5 OptA: 1.1231
6 OptB: AValue
7 cache_size: 1000
8 update_buffer_limit: 1000
9 update_order: 2
1auto opt1 = dboo::option {"MyProperty1"sv, "Value1"s}; (2)
2auto opt2 = dboo::option {"MyProperty2"sv, 4.54}; (3)
3
4db.modify_index( &MyClass::member_field, opt1 | opt2 ); (4)
Notes
DBOO manager
- 1
Applying custom properties OptA and OptB to index MyClass::member
C++
- 2
Creating an option with value “Value1”.
- 3
Creating an option with value 4.54.
- 4
Applying both opt1 and opt2 to index.
Rebuilding indices
Individual field indices can be rebuilt using the rebuild index command or rebuild_index API.
All indices, including all type indices are rebuilt with rebuild_all_indices.
Work in progress…
Deleting indices
Field indices can be deleted. The index configuration and all on disk data is deleted.
Work in progress…
Modifying indices
Work in progress…
Options
Work in progress…