Skip to content

Commit 9177cf6

Browse files
committed
Update readme file
1 parent c592f4c commit 9177cf6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@ Logdb is a simple and save append only key/value database. Ideal for crypto key
1313
* full test coverage
1414
* mem leak free (valgrind check during CI)
1515

16+
Data format
17+
----------------
18+
19+
The data serialization format was designed to allow detection of all types of file corruption.
20+
Because logdb only appends data, possible file corruptions should be reduced.
21+
In case of a corrupt file, the static record header-magic as well as the per-record 16byte sha256
22+
allows to identify records.
23+
24+
[8 bytes] per file magic 0xF9, 0xAA, 0x03, 0xBA
25+
[int32_t/4 bytes] version number
26+
[int32_t/4 bytes] version flags
27+
---- records
28+
[8 bytes] static per record magic 0x88, 0x61, 0xAD, 0xFC, 0x5A, 0x11, 0x22, 0xF8
29+
[16 bytes] partial sha256 hash (first 16 bytes) of the record body
30+
---- record-body start ----
31+
[1 byte] record type (0 = write | 1 = erase)
32+
[varint] length of the key
33+
[variable] key data
34+
[varint] length of the value
35+
[variable] value data
36+
---- record-body end ----
37+
[16 bytes] partial sha256 of *all data* up to this point in logdb
38+
---- record end ---
39+
---- more records
40+
1641
How to Build
1742
----------------
1843
```

0 commit comments

Comments
 (0)