Skip to main content

krabka_remote_storage/worm/
manifest.rs

1//! The segment manifest: the signed, chained record of one archived segment.
2//!
3//! A manifest names every object that one segment copy wrote, records a
4//! `SHA-256` digest for each, and binds the whole set to the partition's hash
5//! chain. [`canonical_manifest_bytes`] defines the byte encoding that the chain
6//! hashes. The writer and the verifier both call it. Never reimplement the
7//! layout, and never change it without changing
8//! [`MANIFEST_FORMAT_VERSION`] with it.
9//!
10//! The parts sit in submodules: the document types, the chain linkage, the
11//! canonical byte layout, and the signature.
12
13mod body;
14mod encoding;
15mod hex_bytes;
16mod linkage;
17mod signing;
18
19#[cfg(test)]
20mod test_support;
21
22pub use self::{
23    body::{ManifestBody, ObjectEntry, SegmentIdentity, SegmentManifest},
24    encoding::{MANIFEST_BODY_DOMAIN, canonical_manifest_bytes},
25    hex_bytes::{HexBytes, Sha256Digest},
26    linkage::{ChainHead, ChainStamp, EpochId, ManifestSeq, manifest_head},
27    signing::{
28        MANIFEST_DOMAIN, ManifestSignature, manifest_signing_bytes, verify_manifest_signature,
29    },
30};
31
32/// Version of the manifest encoding, both the JSON shape and the canonical
33/// byte layout. A change to either is a change to this number.
34pub const MANIFEST_FORMAT_VERSION: u32 = 2;
35
36/// Object-store key suffix of a segment manifest.
37pub const MANIFEST_SUFFIX: &str = ".manifest";