pub(crate) fn emit_snapshot_diff<K, V, CB, P, F>(
session: &mut Session<'_, '_, Timestamp, CB, P>,
packer: &mut PermutedRowPacker,
prev: &BTreeMap<K, V>,
current: &BTreeMap<K, V>,
ts: Timestamp,
pack: F,
)Expand description
Emit the difference between two snapshots of a sampled source as updates at ts.
A sampled source reports its whole state on every read, so a changed value has to be expressed
as a retraction of the previous one paired with an insertion of the new one. A key absent from
current is retracted without a replacement, so a source that stops being readable drops out of
the collection rather than lingering at its last value.
pack takes the packer as an argument instead of closing over it, because it hands back rows
borrowed from it.