Struct CellRegistryHooks

Struct Documentation

struct CellRegistryHooks

Wiring CellRegistry needs from its owner (the ordered executor) but must not construct itself: the cross-call PersistentValueStore (a CacheManager member, one instance per top-level evaluation call, outliving any one CellRegistry), the map from a table value id to the canonical hash that the store and the CacheManager scope caches both key persistence on, and an optional metering hook. Every field defaults to “off”: a CellRegistry built with a default-constructed CellRegistryHooks does no persistence or bytes tracking (persistent cells are never seeded or published, and live_bytes stays a bookkeeping-only counter nobody observes).

Public Members

PersistentValueStore *persistent = nullptr

Cross-call persistence store; seed_persistent reads it, set publishes to it. Null disables both.

std::function<std::size_t(std::size_t value_id)> hash_of

A table value id’s canonical hash, the key persistent is addressed by. Required (alongside persistent) for seeding/publishing; a null function disables both exactly as a null persistent does.

std::function<void(std::size_t live_bytes)> on_bytes_changed

Metering: invoked with the new live_bytes total after every change. May be empty – CellRegistry does not require a metering consumer. Must not throw: it is also called while cells are released, which happens during stack unwinding too.

std::function<ResultPtr(CellId, ResultPtr)> stored_form

Invoked with a value about to be stored in a cell (set ); what it returns is stored in its place. Lets the owner store a value in another form (on disk, see Result::on_disk ). May be empty.

std::function<bool(CellId)> assemble_on_disk

Whether the value of a cell that is assembled from the batches of a loop should be assembled in its on-disk form from the start (see BackendArrayOps::make_zeros_on_disk ). Empty means never.

std::function<void(CellId, ResultPtr const&)> on_set

Accounting: invoked after a value is stored in a cell (set ), with the cell and the value. May be empty.

std::function<void(CellId, ResultPtr const&)> on_read

Accounting: invoked when a consumer’s operand read is served from a cell (CellReadResolver::fetch ), with the cell and the whole value it holds, before any slicing. May be empty.

bool strict_fill_once = eval::strict_fill_once()

Whether a fill-once violation throws (see CellRegistry::set). The default is the process-wide env gate eval::strict_fill_once(), which is latched on its first call anywhere in the process – so a test that needs strictness sets this field instead of the environment, which by then may be too late to have any effect.