prometheus/Documentation/format/tombstones.md
Goutham Veeramachaneni 9d388941ef
Add checksums and magic number to the tombstones.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-05-23 17:27:45 +05:30

4.1 KiB

Tombstones Disk Format

The following describes the format of a tombstones file, which is the directory of a block.

The last 8 bytes specifies the offset to the start of Stones section. The stones section is 0 padded to a multiple of 4 for fast scans.

┌────────────────────────────┬─────────────────────┐
│ magic(0x130BA30) <4b>      │ version(1) <1 byte> │
├────────────────────────────┴─────────────────────┤
│ ┌──────────────────────────────────────────────┐ │
│ │                   Ranges 1                   │ │
│ ├──────────────────────────────────────────────┤ │
│ │                      ...                     │ │
│ ├──────────────────────────────────────────────┤ │
│ │                   Ranges N                   │ │
│ ├──────────────────────────────────────────────┤ │
│ │                    Stones                    │ │
│ ├──────────────────────────────────────────────┤ │
│ │             Ref(stones start)<8b>            │ │
│ └──────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘

Ranges

┌──────────────────────────────────────────┐
│ ┌──────────────────────────────────────┐ │
│ │           #ranges <uvarint>          │ │
│ ├───────────────────┬──────────────────┤ │
│ │  mint <varint64>  │  maxt <varint64> │ │
│ ├───────────────────┴──────────────────┤ │
│ │                . . .                 │ │
│ ├──────────────────────────────────────┤ │
│ │              CRC32 <4b>              │ │   
│ └──────────────────────────────────────┘ │
└──────────────────────────────────────────┘

Stones

┌──────────────────────────────────────────┐
│ ┌──────────────────────────────────────┐ │
│ │              #stones <4b>            │ │
│ ├───────────────────┬──────────────────┤ │
│ │       ref <4b>    │    offset <8b>   │ │
│ ├───────────────────┴──────────────────┤ │
│ │                . . .                 │ │
│ └──────────────────────────────────────┘ │
└──────────────────────────────────────────┘

The offset here is the offset to the relevant ranges.