Module Superbol_cache.Layout

Where things sit under the cache root.

Every path starts with the format version, so that instances built against another layout occupy a disjoint subtree of the same root and neither reads nor reclaims what it does not understand.

Manifests and values are spread over a level of two-hexadecimal-digit directories. A single flat directory of several thousand entries is slow to list on the network mounts this cache is expected to live on, and slow to look up in on file-systems without directory indexing.

val version_dir : string
val manifests : string
val objects : string
val lock : string
val tmp : string

Where a store stages an item before publishing it. Kept out of the fanout directories so that a half-written item is never mistaken for an entry, and within the format's own subtree so that it shares its file-system.

val fanout : string -> string

Two hexadecimal digits are enough to keep directories small at the scale a single machine reaches, and cheap to compute.

val manifest : string -> string
val object_ : Stdlib.Digest.t -> string
val slots : string

Slots name the entries currently standing for some subject (typically, the current version of a document), so that they can be reclaimed once superseded. They are neither entries nor values, and are kept apart from both so that monitoring and pruning by size need not tell them apart.

val slot : string -> string
val is_key : string -> bool

is_key s holds of the hexadecimal renderings of digests, which is all a key may be: anything else read back from storage is not to be turned into a path.

val is_version_dir : string -> bool

is_version_dir name holds of the top-level entries this library owns, so that the pruner can tell a sibling format's subtree from unrelated files a user may have left in the cache root.