2017-04-24 08:33:08 +00:00
|
|
|
# Chunks Disk Format
|
|
|
|
|
2019-03-25 10:33:38 +00:00
|
|
|
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.
|
2017-04-28 12:17:53 +00:00
|
|
|
|
2019-03-25 10:33:38 +00:00
|
|
|
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).
|
2017-04-24 08:33:08 +00:00
|
|
|
|
|
|
|
```
|
2019-09-19 10:56:32 +00:00
|
|
|
┌──────────────────────────────┐
|
|
|
|
│ magic(0x85BD40DD) <4 byte> │
|
|
|
|
├──────────────────────────────┤
|
|
|
|
│ version(1) <1 byte> │
|
|
|
|
├──────────────────────────────┤
|
|
|
|
│ padding(0) <3 byte> │
|
|
|
|
├──────────────────────────────┤
|
|
|
|
│ ┌──────────────────────────┐ │
|
|
|
|
│ │ Chunk 1 │ │
|
|
|
|
│ ├──────────────────────────┤ │
|
|
|
|
│ │ ... │ │
|
|
|
|
│ ├──────────────────────────┤ │
|
|
|
|
│ │ Chunk N │ │
|
|
|
|
│ └──────────────────────────┘ │
|
|
|
|
└──────────────────────────────┘
|
2019-03-25 10:33:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# Chunk
|
|
|
|
|
|
|
|
```
|
|
|
|
┌───────────────┬───────────────────┬──────────────┬────────────────┐
|
|
|
|
│ len <uvarint> │ encoding <1 byte> │ data <bytes> │ CRC32 <4 byte> │
|
|
|
|
└───────────────┴───────────────────┴──────────────┴────────────────┘
|
2017-04-24 08:33:08 +00:00
|
|
|
```
|