From db9177de0cc7fec169bda0ede005ffd6d6fd1d80 Mon Sep 17 00:00:00 2001 From: zhulongcheng Date: Mon, 25 Mar 2019 18:33:38 +0800 Subject: [PATCH] docs: add multi chunks layout in chunks readme file (#567) --- docs/format/chunks.md | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/docs/format/chunks.md b/docs/format/chunks.md index df388675e3..1ef86037f5 100644 --- a/docs/format/chunks.md +++ b/docs/format/chunks.md @@ -1,15 +1,31 @@ # Chunks Disk Format -The following describes the format of a single chunks file, which is created in the `chunks/` directory of a block. The maximum size per segment file is 512MiB. +The following describes the format of a chunks file, +which is created in the `chunks/` directory of a block. +The maximum size per segment file is 512MiB. -Chunks in the files are referenced from the index by uint64 composed of in-file offset (lower 4 bytes) and segment sequence number (upper 4 bytes). +Chunks in the files are referenced from the index by uint64 composed of +in-file offset (lower 4 bytes) and segment sequence number (upper 4 bytes). ``` -┌────────────────────────────────────────┬──────────────────────┐ -│ magic(0x85BD40DD) <4 byte> │ version(1) <1 byte> │ -├────────────────────────────────────────┴──────────────────────┤ -│ ┌───────────────┬───────────────────┬──────┬────────────────┐ │ -│ │ len │ encoding <1 byte> │ data │ CRC32 <4 byte> │ │ -│ └───────────────┴───────────────────┴──────┴────────────────┘ │ -└───────────────────────────────────────────────────────────────┘ +┌────────────────────────────┬─────────────────────┐ +│ magic(0x85BD40DD) <4 byte> │ version(1) <1 byte> │ +├────────────────────────────┴─────────────────────┤ +│ ┌──────────────────────────────────────────────┐ │ +│ │ Chunk 1 │ │ +│ ├──────────────────────────────────────────────┤ │ +│ │ ... │ │ +│ ├──────────────────────────────────────────────┤ │ +│ │ Chunk N │ │ +│ └──────────────────────────────────────────────┘ │ +└──────────────────────────────────────────────────┘ +``` + + +# Chunk + +``` +┌───────────────┬───────────────────┬──────────────┬────────────────┐ +│ len │ encoding <1 byte> │ data │ CRC32 <4 byte> │ +└───────────────┴───────────────────┴──────────────┴────────────────┘ ```