-
Notifications
You must be signed in to change notification settings - Fork 12
StringDB 10.0.0 Format
SirJosh3917 edited this page Feb 23, 2019
·
1 revision
The first 8 bytes are dedicated to the "index chain".
An index is encoded as:
- a single byte for the length
- 4 bytes for the position in the file, relative to the current location
- the index
An index cannot:
- be as long or longer than 0xFF chars
- be a length less than 1
A value is enocded as:
- a variable integer for the length
- the value
An index jump is encoded as:
- 0xFF
- 4 bytes for the position to jump to, relative to the current location.
A file might look something like:
- 8 byte index chain
- "hello" index, jumping to 123
- "world" index, jumping to 456
- index chain, jumping to 0, (at 100)
- "Hello, " value, (at 123)
- "World!" value, (at 456)
If you were going to write more to this file, the first 8 bytes, the index chain, would be stored to "100", so that we could overwrite the previous index jump and jump to the new values.
The 4 bytes are uints so you can have about 4GB written in a single go, in theory, without problems.