-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeyspec.txt
More file actions
58 lines (44 loc) · 2.49 KB
/
keyspec.txt
File metadata and controls
58 lines (44 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Key spec.
The following grammar specifies the keys used for storing each DAG and
related keys in a B-tree.
Basic Types
The following basic types are used as terminals in the rest of the grammar. Each
type must be serialized in little-endian format.
"" empty string
byte 1 byte (8-bits)
Non-terminals
The following specifies the rest of the key grammar. Note that quoted strings
represent terminals, and should be interpreted with C semantics (e.g. "\x01"
represents the byte 0000 0001). Also note that we use the * operator as
shorthand for repetition (e.g. ("\x01"*2) is "\x01\x01"). When used as a unary
operator, * means that the repetition can occur 0 or more times.
key ::= name subkey "" any key is a name followed by a subkey
name ::= string name of the key space
subkey ::=
| "\x01" id ival dskey, data store key
| "\x02" ival ikey, i index key
| "\x03" id version headkey, head index key
| "\x04" version vkey, version index key
| "\x05" string uskey, user store key
ival ::= lbeint i value, monotonically increasing number
id ::= string used to identify data store values
pe ::= string name of a perspective
version ::= lbeint version number
lbeint ::= byte (byte*) Large int - The byte is the number of bytes
in (byte*). The (byte*) is one to 254 bytes
written that should be interpreted as an
unsigned integer in big endian format.
string ::= byte (byte*) "\x00" String - The byte is the number bytes in the
(byte*) + 1 (for the trailing '\x00'). The
(byte*) is zero or more ASCII encoded
characters and must not contain '\x00' byte.
opts ::= byte option bits, single byte:
0x01 = conflict, when a merge with this
item failed
The values for the given keys are as follows:
key: "\x01", value: BSON serialized javascript object
key: "\x02", value: key of subtype "\x03"
key: "\x03", value: opts ival
key: "\x04", value: key of subtype "\x01"
key: "\x05", value: (byte*) one or more bytes (node Buffer)
Copied from http://bsonspec.org/spec.html and modified by Tim Kuijsten