OLD | NEW |
1 # LevelDB Coding Scheme | 1 # LevelDB Coding Scheme |
2 | 2 |
3 LevelDB stores key/value pairs. Keys and values are strings of bytes, | 3 LevelDB stores key/value pairs. Keys and values are strings of bytes, |
4 normally of type `std::string`. | 4 normally of type `std::string`. |
5 | 5 |
6 The keys in the backing store are variable-length tuples with | 6 The keys in the backing store are variable-length tuples with |
7 different types of fields, described here using the notation «a, b, c, | 7 different types of fields, described here using the notation «a, b, c, |
8 ...». Each key in the backing store starts with a ternary prefix: | 8 ...». Each key in the backing store starts with a ternary prefix: |
9 «database id, object store id, index id». For each, the id `0` is | 9 «database id, object store id, index id». For each, the id `0` is |
10 always reserved for metadata; other ids may be reserved as well. | 10 always reserved for metadata; other ids may be reserved as well. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 - - - - | 143 - - - - |
144 | 144 |
145 ## Global metadata | 145 ## Global metadata |
146 | 146 |
147 The prefix is «0, 0, 0», followed by a metadata type byte: | 147 The prefix is «0, 0, 0», followed by a metadata type byte: |
148 | 148 |
149 key | value | 149 key | value |
150 ------------------------------------|------ | 150 ------------------------------------|------ |
151 «0, 0, 0, 0» | backing store schema version (Int) [`Schem
aVersionKey`] | 151 «0, 0, 0, 0» | backing store schema version (Int) [`Schem
aVersionKey`] |
152 «0, 0, 0, 1» | maximum allocated database (Int) [`MaxData
baseIdKey`] | 152 «0, 0, 0, 1» | maximum allocated database (Int) [`MaxData
baseIdKey`] |
153 «0, 0, 0, 2» | SerializedScriptValue version (Int) [`Data
VersionKey`] | 153 «0, 0, 0, 2» | data format version (Int) [`DataVersionKey
`] |
154 «0, 0, 0, 3» | primary BlobJournal [`BlobJournalKey`] | 154 «0, 0, 0, 3» | primary BlobJournal [`BlobJournalKey`] |
155 «0, 0, 0, 4» | live BlobJournal [`LiveBlobJournalKey`] | 155 «0, 0, 0, 4» | live BlobJournal [`LiveBlobJournalKey`] |
156 «0, 0, 0, 100, database id (VarInt)» | Existence implies the database id is in t
he free list [`DatabaseFreeListKey`] - _obsolete_ | 156 «0, 0, 0, 100, database id (VarInt)» | Existence implies the database id is in t
he free list [`DatabaseFreeListKey`] - _obsolete_ |
157 «0, 0, 0, 201, origin (StringWithLength), database name (StringWithLength)» | Da
tabase id (Int) [`DatabaseNameKey`] | 157 «0, 0, 0, 201, origin (StringWithLength), database name (StringWithLength)» | Da
tabase id (Int) [`DatabaseNameKey`] |
158 | 158 |
159 *** aside | 159 *** aside |
160 Free lists (#100) are no longer used. The ID space is assumed to be | 160 Free lists (#100) are no longer used. The ID space is assumed to be |
161 sufficient. | 161 sufficient. |
162 *** | 162 *** |
163 | 163 |
| 164 The data format version encodes a `content::IndexedDBDataFormatVersion` object. |
| 165 It includes a 32-bit version for the V8 serialization code in its most |
| 166 significant bits, and a 32-bit version for the Blink serialization code in its |
| 167 least significant 32 bits. |
164 | 168 |
165 ## Database metadata | 169 ## Database metadata |
166 [`DatabaseMetaDataKey`] | 170 [`DatabaseMetaDataKey`] |
167 | 171 |
168 The prefix is «database id, 0, 0» followed by a metadata type Byte: | 172 The prefix is «database id, 0, 0» followed by a metadata type Byte: |
169 | 173 |
170 key | value | 174 key | value |
171 -----------------------|------- | 175 -----------------------|------- |
172 «database id, 0, 0, 0» | origin name (String) | 176 «database id, 0, 0, 0» | origin name (String) |
173 «database id, 0, 0, 1» | database name (String) | 177 «database id, 0, 0, 1» | database name (String) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 the same user (index) key in non-unique indexes prior to the inclusion | 318 the same user (index) key in non-unique indexes prior to the inclusion |
315 of the primary key in the key itself. `0` is always written now | 319 of the primary key in the key itself. `0` is always written now |
316 (which, as a VarInt, takes a single byte) | 320 (which, as a VarInt, takes a single byte) |
317 | 321 |
318 *** note | 322 *** note |
319 **Compatibility:** | 323 **Compatibility:** |
320 The sequence number and primary key, or just the primary key may not | 324 The sequence number and primary key, or just the primary key may not |
321 be present. In that case, enumerators that need the primary key must | 325 be present. In that case, enumerators that need the primary key must |
322 access the value. | 326 access the value. |
323 *** | 327 *** |
OLD | NEW |