pub struct ObserverRequirements {
pub needs_before_value: bool,
pub needs_prev_hlc: bool,
}Expand description
Per-observer declaration of which optional fields the backend
must populate on a TransactionEvent.
The backend OR’s all registered observers’ requirements and
produces exactly the fields some observer wants. Fields nobody
needs are skipped — for example, the “previous value” read
before commit is expensive (an extra RocksDB get); if neither
audit (with capture_state: false) nor replication (today) asks
for it, the backend skips that read entirely.
Fields§
§needs_before_value: boolRead the existing value at the key (if any) before committing
the new write. Costs an extra storage get. Audit with
capture_state: true needs this; replication today does not
(CRDT merge happens at apply time on the receiver using its
local state).
needs_prev_hlc: boolLook up the HLC timestamp of the existing record at the key
(if any) and pass it as prev_hlc for causal predecessor
tracking. Cheap because the HLC is stored alongside the
record metadata in a known location. Replication needs this
for the “this write observed prev HLC X” causal-chain
invariant; audit does not.
Implementations§
Trait Implementations§
Source§impl Clone for ObserverRequirements
impl Clone for ObserverRequirements
Source§fn clone(&self) -> ObserverRequirements
fn clone(&self) -> ObserverRequirements
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more