docs: add multi chunks layout in chunks readme file (#567)

This commit is contained in:
zhulongcheng 2019-03-25 18:33:38 +08:00 committed by Krasi Georgiev
parent e11e01f68d
commit db9177de0c

View file

@ -1,15 +1,31 @@
# Chunks Disk Format # 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> │ magic(0x85BD40DD) <4 byte> │ version(1) <1 byte>
├────────────────────────────────────────┴──────────────────────┤ ├────────────────────────────┴─────────────────────┤
│ ┌───────────────┬───────────────────┬──────┬────────────────┐ │ │ ┌──────────────────────────────────────────────┐ │
│ │ len <uvarint> │ encoding <1 byte> │ data │ CRC32 <4 byte> │ │ │ │ Chunk 1 │ │
│ └───────────────┴───────────────────┴──────┴────────────────┘ │ │ ├──────────────────────────────────────────────┤ │
└───────────────────────────────────────────────────────────────┘ │ │ ... │ │
│ ├──────────────────────────────────────────────┤ │
│ │ Chunk N │ │
│ └──────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘
```
# Chunk
```
┌───────────────┬───────────────────┬──────────────┬────────────────┐
│ len <uvarint> │ encoding <1 byte> │ data <bytes> │ CRC32 <4 byte>
└───────────────┴───────────────────┴──────────────┴────────────────┘
``` ```