Skip to main content

Module offload

Module offload 

Source
Expand description

Copy a sealed block to an object store before retention unlinks it.

The whole module is one idea. A block directory’s name already carries its own time range, node and sequence (section 3.2), so a flat namespace of those names is the catalog: Target::list is one call to the store’s own list API and nothing here writes an index, a manifest or a marker beside the blocks. There is no second thing to keep consistent, which is what principle 4 asks for — kill the process mid-sweep and the only state is what the store lists, which is the same answer before and after.

Four limits, all deliberate:

  • Only sealed, immutable blocks already past the retention cutoff are uploaded. The hot path does not reach this module and the upload happens on the retention worker’s spawn_blocking thread, once a minute.
  • An offloaded block is never mapped. Target::pull copies it back into the data directory and the read path opens it there, so section 9’s refusal to mmap a networked filesystem holds unchanged: this is a read of bytes, not a mapping of them.
  • A block is deleted locally only after its copy is visible in the store under its final name. The direction of the failure is fixed — a crash leaves two copies, never zero.
  • file:// is the only scheme implemented. See Target::parse.

Structs§

Target
Where offloaded blocks go. Parsed from --offload.

Functions§

copy_block 🔒
Stage a whole block directory into root/.tmp, then rename it into place.
copy_file 🔒
Copy one file’s bytes, giving the destination a current modification time.
copy_files 🔒
differs 🔒
Why two copies of one block name are not the same block, or None.
fsync_dir 🔒
sizes 🔒
(file name, length) for the regular files directly in dir, sorted.
split 🔒
(partition, block name) out of …/<signal>/p=<hour>/<block>.