From d8b91b969c2bbf9155448b5dad36e44ac37b76a1 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Mon, 24 Apr 2017 10:33:08 +0200 Subject: [PATCH] docs: add chunk file format --- Documentation/format/chunks.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/format/chunks.md diff --git a/Documentation/format/chunks.md b/Documentation/format/chunks.md new file mode 100644 index 0000000000..fdb45384c9 --- /dev/null +++ b/Documentation/format/chunks.md @@ -0,0 +1,29 @@ +# Chunks Disk Format + +The following describes the format of a single chunks file, which is created in the `chunks/` directory of a block. + +``` + ┌────────────────────────────┬──────────────────┐ + │ magic(0x85BD40DD) <4 byte> | version <1 byte> │ + ├────────────────────────────┴──────────────────┤ + │ Body ... │ + └───────────────────────────────────────────────┘ +``` + +Available versions: +* v1 (`1`) + +## Body (v1) + +The body contains a sequence of chunks, each of which has the following format. + +``` +┌─────────────────────────────────────────────────────────┐ +│ ┌──────────────┬───────────────────┬────────────┐ │ +│ │ len | encoding <1 byte> │ data │ ... │ +│ └──────────────┴───────────────────┴────────────┘ │ +└─────────────────────────────────────────────────────────┘ +``` + +The length marks the length of the encoding byte and data combined. +The CRC checksum is calculated over the encoding byte and data. \ No newline at end of file