Bedrock.DataPlane.Resolver.Conflicts (bedrock v0.5.2)
View SourceOptimized conflict tracking that separates point writes from range operations.
Uses MapSets for O(1) point conflict detection and interval trees only for true range operations. Point writes are detected by the pattern where end_key == start_key <> <<0>>.
This provides significant performance improvements for import scenarios with many unique point writes.
Summary
Functions
Adds conflicts for a new version to the structure. If the version matches the most recent version, merges the conflicts instead of creating a new entry.
Checks if any of the given conflicts overlap with existing conflicts at versions greater than the specified version.
Returns metrics about the conflict structure for debugging.
Creates a new empty versioned conflicts structure.
Removes conflicts older than the specified version.
Separates conflicts into point writes and true ranges based on key patterns. Point writes have end_key == start_key <> <<0>>.
Types
@type t() :: %Bedrock.DataPlane.Resolver.Conflicts{ versions: [ {Bedrock.version(), MapSet.t(binary()), Bedrock.DataPlane.Resolver.Tree.t() | nil} ] }
Functions
@spec add_conflicts(t(), [Bedrock.key_range()], Bedrock.version()) :: t()
Adds conflicts for a new version to the structure. If the version matches the most recent version, merges the conflicts instead of creating a new entry.
@spec check_conflicts(t(), [Bedrock.key_range()], Bedrock.version()) :: :ok | :abort
Checks if any of the given conflicts overlap with existing conflicts at versions greater than the specified version.
@spec metrics(t()) :: %{ version_count: non_neg_integer(), total_points: non_neg_integer(), total_ranges: non_neg_integer() }
Returns metrics about the conflict structure for debugging.
@spec new() :: %Bedrock.DataPlane.Resolver.Conflicts{versions: []}
Creates a new empty versioned conflicts structure.
@spec remove_old_conflicts(t(), Bedrock.version()) :: t()
Removes conflicts older than the specified version.
@spec separate_conflicts([Bedrock.key_range()]) :: {MapSet.t(binary()), [Bedrock.key_range()]}
Separates conflicts into point writes and true ranges based on key patterns. Point writes have end_key == start_key <> <<0>>.