mz_storage::upsert::types

Function consolidating_merge_function

Source
pub(crate) fn consolidating_merge_function<T, O>(
    _key: UpsertKey,
    updates: impl Iterator<Item = StateValue<T, O>>,
) -> StateValue<T, O>
where O: Default, T: Eq,
Expand description

A function that merges a set of updates for a key into the existing value for the key. This is called by the backend implementation when it has accumulated a set of updates for a key, and needs to merge them into the existing value for the key.

The function is called with the following arguments:

  • The key for which the merge is being performed.
  • An iterator over any current value and merge operands queued for the key.

The function should return the new value for the key after merging all the updates.