Skip to content

Latest commit

 

History

History
100 lines (69 loc) · 2.3 KB

FORMAT.md

File metadata and controls

100 lines (69 loc) · 2.3 KB

EVENTED::DATABASE FORMAT

This file describes the Evented::Database storage format.

Data types

There are 4 basic data types:

  • string: a string.
  • number: a float or integer.
  • array: an ordered list of other data types.
  • hash: a key:value dictionary.

Storage syntax

All data is stored as strings; they must be encoded and parsed into the below formats.

Numbers

Numbers are nothing more than numbers. No need to make it complicated.

1
46
3.5
0.5553

Strings

Strings are stored wrapped in double quotes. Any double quotes in itself should be escaped with the backslash character. Backslashes can be escaped as well.

"some simple string"
"a string with \"quotes\" in it"
"a string with a backslash (\\) in it"

Arrays

List values are comma-separated value identifiers.

4,5,6,7
1,2,3,4,5,6

Hashes

Hash pairs are comma-separated, in the form of key:value_identifier.

myKey:34,otherKey:37,someOtherkey:983

Tables

Evented::Database uses two databases: one for storing the location of values and one for the values themselves.

The location table

The location table (locations) stores the locations of values by using numerical identifiers. Each value has a unique identifier.

---------------------------------------------
| block      | blockname  | dkey | valueid  |
--------------------------------------------
| block_type | block_name | key  | value_id |
---------------------------------------------

Data stored in this table

  • block_type: the string type of the block for named blocks; "section" for unnamed.
  • block_name: the string name of the block.
  • key: the string key this value represents.
  • value_id: the identifier of the value in the value table.

The value table

The value table (dvalues) stores the actual values and their identifiers. It also stores the type of the value.

---------------------------------
| valueid  | valuetype  | value |
---------------------------------
| value_id | value_type | value |
---------------------------------

Data stored in this table

  • value_id: the identifier of the value in the value table.
  • value_type: the string type of the value as seen in "Data types" above.
  • value: the value being stored in the syntax seen in "Storage syntax" above.