0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 08:42:34 +01:00
construct/include/ircd/db
2018-06-01 12:36:46 -07:00
..
database ircd::db: Convert rocksdb::port from pthread to ircd::ctx. 2018-06-01 12:36:46 -07:00
cache.h ircd::db: Add cache clear interface w/ console cmd. 2018-05-24 01:18:58 -07:00
cell.h ircd::db: Removed unused cell features. 2018-05-19 18:49:06 -07:00
column.h ircd::db: Properly maintain db::gopts as iterator state. 2018-05-25 03:07:30 -07:00
comparator.h ircd::db: Support additional rdb comparator features. 2018-05-21 19:52:18 -07:00
db.h ircd::db: Integrate checkpointing with database name and path schema. 2018-05-24 20:52:49 -07:00
delta.h ircd::db: minor cleanup: move this here. 2018-02-07 23:15:17 -08:00
index.h ircd::db: Properly maintain db::gopts as iterator state. 2018-05-25 03:07:30 -07:00
json.h ircd::json: Add specific extern undefined number. 2018-05-19 22:55:03 -07:00
merge.h Update Copyrastafaris. 2018-02-05 21:24:34 -08:00
opts.h ircd::db: Default to no checksums on all reads; add conf item; adjust opts. 2018-05-23 18:45:27 -07:00
prefix.h Update Copyrastafaris. 2018-02-05 21:24:34 -08:00
README.md ircd::db: Update README; remove old cruft. 2017-12-03 13:34:42 -08:00
row.h ircd::db: Remove the row tuple template constructor. 2018-05-20 01:48:47 -07:00
stats.h ircd::db: Consolidate various stats interfaces into header. 2018-05-23 17:04:02 -07:00
txn.h ircd::db: Fix issues with txn interface. 2018-04-16 15:20:08 -07:00

IRCd Database

The database is an object store built from the primitives of cell, column, and row.

Columns

While a simple key-value store could naively store a JSON document as a textual value, we provide additional structure schematized before opening a database: Every member of a JSON object is a column in this database. There is no specific support for recursion at this time, though that could be addressed by adding additional columns for the nested values.

Rows

Since columns are technically independent key-value stores (they have their own index), when an index key is the same between columns we call this a row. For basic object storage the schema is such that we use the same keys between all columns. For example, an index would be a username in a user database. The user database itself takes the form of a single JSON object and any member lookup happens on a user's row.

Cells

A cell is a single value in a column indexed by a key that should be able to form a row between columns. Consider the following near-json expression:

Important notes

!!! The database system is plugged into the userspace context system to facilitate IO. This means that an expensive database call (mostly on the read side) that has to do disk IO will suspend your userspace context. Remember that when your userspace context resumes on the other side of the call, the state of IRCd and even the database itself may have changed. We have a suite of tools to mitigate this. !!!

  • While the database schema is modifiable at runtime (we can add and remove columns on the fly) the database is very picky about opening the exact same way it last closed. This means, for now, we have the full object schema explicitly specified when the DB is first opened. All columns exist for the lifetime of the DB, whether or not you have a handle to them.