Struct ExternalStore

Struct Documentation

struct ExternalStore

A store of values held outside a CacheManager hierarchy’s own entries that the peak metering must still see – in practice the ordered executor’s CellRegistry.

One object describes the store from all three angles the metering needs, so they cannot disagree: how many bytes it holds, which values those are, and whether it holds a given buffer. A hierarchy is told about the store with CacheManager::set_external_store on its chain-root cache.

Public Members

std::function<std::size_t()> bytes
Return:

the bytes the store holds that no scope cache already counts.

std::function<void(std::function<void(std::size_t hash, std::size_t bytes)> const &emit)> for_each

Calls emit(hash, bytes) once per value bytes() counts.

std::function<bool(ResultPtr const &value)> holds
Return:

whether the store physically holds value (pointer identity), i.e. whether value's bytes are among those bytes() counts (or a scope cache’s).