Typeberry by Fluffy Labs - v0.9.0
    Preparing search index...

    Class ValueRefs

    Decides when a content-addressed value can be removed from the values DB.

    A value is needed as long as some surviving state references it. Surviving states are the finalized tip plus its unfinalized descendants, so we track:

    • finalized: how many leaves in the current finalized-tip state reference V, advanced strictly by replaying finalized blocks' deltas (never on prune);
    • pending: how many surviving, not-yet-finalized blocks inserted V (an over-approximation of unfinalized references).

    A value is removable exactly when both counts reach zero.

    This class only makes decisions: every operation reads the current state through ValueRefsReader and returns a ValueRefsUpdate describing what should change. Nothing is written here - the owning backend applies the update with whatever consistency guarantees it can provide.

    Index

    Constructors

    Methods

    • Release the speculative references of a state being discarded.

      For a header that was still unfinalized (a dead fork) the returned update releases its inserted values, which may become collectable. For an already finalized state the update is empty (check with isEmptyUpdate): its delta was consumed on finality and its values are accounted for in finalized.

      Parameters

      Returns ValueRefsUpdate