Skip to main content

process_patch

Function process_patch 

Source
pub fn process_patch<F, G>(
    patch: &SyncdPatch,
    state: &mut HashState,
    get_keys: F,
    get_prev_value_mac: G,
    validate_macs: bool,
    collection_name: &str,
) -> Result<PatchProcessingResult, AppStateError>
Expand description

Process a single patch and decode its mutations.

This is a pure, synchronous function that processes a patch without any async operations. Key and previous value lookup are done via callbacks.

§Arguments

  • patch - The patch to process
  • state - The current hash state (will be mutated in place)
  • get_keys - Callback to get expanded keys for a key ID
  • get_prev_value_mac - Callback to get previous value MAC for an index MAC
  • validate_macs - Whether to validate MACs during processing
  • collection_name - The collection name (for MAC validation)

§Returns

A PatchProcessingResult containing the new state and decoded mutations.