Skip to content

Home / reference / conflicts

icechunk.conflicts#

Conflict detection and resolution for concurrent writes.

icechunk.conflicts #

Classes:

Name Description
BasicConflictSolver

A basic conflict solver that allows for simple configuration of resolution behavior

Conflict

A conflict detected between snapshots

ConflictDetector

A conflict solver that can be used to detect conflicts between two stores, but does not resolve them

ConflictSolver

An abstract conflict solver that can be used to detect or resolve conflicts between two stores

ConflictType

Type of conflict detected

VersionSelection

Enum for selecting the which version of a conflict

BasicConflictSolver #

Bases: ConflictSolver

A basic conflict solver that allows for simple configuration of resolution behavior

This conflict solver allows for simple configuration of resolution behavior for conflicts that may occur during a rebase operation. It will attempt to resolve a limited set of conflicts based on the configuration options provided.

  • When a chunk conflict is encountered, the behavior is determined by the on_chunk_conflict option
  • When an array is deleted that has been updated, fail_on_delete_of_updated_array will determine whether to fail the rebase operation
  • When a group is deleted that has been updated, fail_on_delete_of_updated_group will determine whether to fail the rebase operation

Methods:

Name Description
__new__

Create a BasicConflictSolver object with the given configuration options

Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
class BasicConflictSolver(ConflictSolver):
    """A basic conflict solver that allows for simple configuration of resolution behavior

    This conflict solver allows for simple configuration of resolution behavior for conflicts that may occur during a rebase operation.
    It will attempt to resolve a limited set of conflicts based on the configuration options provided.

    - When a chunk conflict is encountered, the behavior is determined by the `on_chunk_conflict` option
    - When an array is deleted that has been updated, `fail_on_delete_of_updated_array` will determine whether to fail the rebase operation
    - When a group is deleted that has been updated, `fail_on_delete_of_updated_group` will determine whether to fail the rebase operation
    """

    def __new__(
        cls,
        *,
        on_chunk_conflict: VersionSelection = VersionSelection.UseOurs,
        fail_on_delete_of_updated_array: bool = False,
        fail_on_delete_of_updated_group: bool = False,
    ) -> BasicConflictSolver:
        """Create a BasicConflictSolver object with the given configuration options

        Parameters
        ----------
        on_chunk_conflict: VersionSelection
            The behavior to use when a chunk conflict is encountered, by default VersionSelection.use_theirs()
        fail_on_delete_of_updated_array: bool
            Whether to fail when a chunk is deleted that has been updated, by default False
        fail_on_delete_of_updated_group: bool
            Whether to fail when a group is deleted that has been updated, by default False
        """
        ...

__new__ #

__new__(
    *,
    on_chunk_conflict=VersionSelection.UseOurs,
    fail_on_delete_of_updated_array=False,
    fail_on_delete_of_updated_group=False,
)

Create a BasicConflictSolver object with the given configuration options

Parameters:

Name Type Description Default
on_chunk_conflict VersionSelection

The behavior to use when a chunk conflict is encountered, by default VersionSelection.use_theirs()

UseOurs
fail_on_delete_of_updated_array bool

Whether to fail when a chunk is deleted that has been updated, by default False

False
fail_on_delete_of_updated_group bool

Whether to fail when a group is deleted that has been updated, by default False

False
Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
def __new__(
    cls,
    *,
    on_chunk_conflict: VersionSelection = VersionSelection.UseOurs,
    fail_on_delete_of_updated_array: bool = False,
    fail_on_delete_of_updated_group: bool = False,
) -> BasicConflictSolver:
    """Create a BasicConflictSolver object with the given configuration options

    Parameters
    ----------
    on_chunk_conflict: VersionSelection
        The behavior to use when a chunk conflict is encountered, by default VersionSelection.use_theirs()
    fail_on_delete_of_updated_array: bool
        Whether to fail when a chunk is deleted that has been updated, by default False
    fail_on_delete_of_updated_group: bool
        Whether to fail when a group is deleted that has been updated, by default False
    """
    ...

Conflict #

A conflict detected between snapshots

Methods:

Name Description
__new__

Create a new Conflict.

Attributes:

Name Type Description
conflict_type ConflictType

The type of conflict detected

conflicted_chunks list[list[int]] | None

If the conflict is a chunk conflict, this will return the list of chunk indices that are in conflict

path str

The path of the node that caused the conflict

Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
class Conflict:
    """A conflict detected between snapshots"""

    def __new__(
        cls,
        conflict_type: ConflictType,
        path: str,
        conflicted_chunks: list[list[int]] | None = None,
    ) -> Conflict:
        """
        Create a new Conflict.

        Parameters
        ----------
        conflict_type: ConflictType
            The type of conflict.
        path: str
            The path of the node that caused the conflict.
        conflicted_chunks: list[list[int]] | None
            If the conflict is a chunk conflict, the list of chunk indices in conflict.
        """
        ...

    @property
    def conflict_type(self) -> ConflictType:
        """The type of conflict detected

        Returns:
            ConflictType: The type of conflict detected
        """
        ...

    @property
    def path(self) -> str:
        """The path of the node that caused the conflict

        Returns:
            str: The path of the node that caused the conflict
        """
        ...

    @property
    def conflicted_chunks(self) -> list[list[int]] | None:
        """If the conflict is a chunk conflict, this will return the list of chunk indices that are in conflict

        Returns:
            list[list[int]] | None: The list of chunk indices that are in conflict
        """
        ...

conflict_type property #

conflict_type

The type of conflict detected

Returns: ConflictType: The type of conflict detected

conflicted_chunks property #

conflicted_chunks

If the conflict is a chunk conflict, this will return the list of chunk indices that are in conflict

Returns: list[list[int]] | None: The list of chunk indices that are in conflict

path property #

path

The path of the node that caused the conflict

Returns: str: The path of the node that caused the conflict

__new__ #

__new__(conflict_type, path, conflicted_chunks=None)

Create a new Conflict.

Parameters:

Name Type Description Default
conflict_type ConflictType

The type of conflict.

required
path str

The path of the node that caused the conflict.

required
conflicted_chunks list[list[int]] | None

If the conflict is a chunk conflict, the list of chunk indices in conflict.

None
Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
def __new__(
    cls,
    conflict_type: ConflictType,
    path: str,
    conflicted_chunks: list[list[int]] | None = None,
) -> Conflict:
    """
    Create a new Conflict.

    Parameters
    ----------
    conflict_type: ConflictType
        The type of conflict.
    path: str
        The path of the node that caused the conflict.
    conflicted_chunks: list[list[int]] | None
        If the conflict is a chunk conflict, the list of chunk indices in conflict.
    """
    ...

ConflictDetector #

Bases: ConflictSolver

A conflict solver that can be used to detect conflicts between two stores, but does not resolve them

Where the BasicConflictSolver will attempt to resolve conflicts, the ConflictDetector will only detect them. This means that during a rebase operation the ConflictDetector will raise a RebaseFailed error if any conflicts are detected, and allow the rebase operation to be retried with a different conflict resolution strategy. Otherwise, if no conflicts are detected the rebase operation will succeed.

Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
class ConflictDetector(ConflictSolver):
    """A conflict solver that can be used to detect conflicts between two stores, but does not resolve them

    Where the `BasicConflictSolver` will attempt to resolve conflicts, the `ConflictDetector` will only detect them. This means
    that during a rebase operation the `ConflictDetector` will raise a `RebaseFailed` error if any conflicts are detected, and
    allow the rebase operation to be retried with a different conflict resolution strategy. Otherwise, if no conflicts are detected
    the rebase operation will succeed.
    """

    def __new__(cls) -> ConflictDetector: ...

ConflictSolver #

An abstract conflict solver that can be used to detect or resolve conflicts between two stores

This should never be used directly, but should be subclassed to provide specific conflict resolution behavior

Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
class ConflictSolver:
    """An abstract conflict solver that can be used to detect or resolve conflicts between two stores

    This should never be used directly, but should be subclassed to provide specific conflict resolution behavior
    """

    ...

ConflictType #

Bases: Enum

Type of conflict detected

Attributes:

Name Type Description
ChunkDoubleUpdate

A chunk update conflicts with an existing chunk update

ChunksUpdatedInDeletedArray

Chunks are updated in a deleted array

ChunksUpdatedInUpdatedArray

Chunks are updated in an updated array

DeleteOfUpdatedArray

A delete is attempted on an updated array

DeleteOfUpdatedGroup

A delete is attempted on an updated group

NewNodeConflictsWithExistingNode

A new node conflicts with an existing node

NewNodeInInvalidGroup

A new node is in an invalid group

ZarrMetadataDoubleUpdate

A zarr metadata update conflicts with an existing zarr metadata update

ZarrMetadataUpdateOfDeletedArray

A zarr metadata update is attempted on a deleted array

ZarrMetadataUpdateOfDeletedGroup

A zarr metadata update is attempted on a deleted group

Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
class ConflictType(Enum):
    """Type of conflict detected"""

    NewNodeConflictsWithExistingNode = (1,)
    """A new node conflicts with an existing node"""

    NewNodeInInvalidGroup = (2,)
    """A new node is in an invalid group"""

    ZarrMetadataDoubleUpdate = (3,)
    """A zarr metadata update conflicts with an existing zarr metadata update"""

    ZarrMetadataUpdateOfDeletedArray = (4,)
    """A zarr metadata update is attempted on a deleted array"""

    ZarrMetadataUpdateOfDeletedGroup = (5,)
    """A zarr metadata update is attempted on a deleted group"""

    ChunkDoubleUpdate = (6,)
    """A chunk update conflicts with an existing chunk update"""

    ChunksUpdatedInDeletedArray = (7,)
    """Chunks are updated in a deleted array"""

    ChunksUpdatedInUpdatedArray = (8,)
    """Chunks are updated in an updated array"""

    DeleteOfUpdatedArray = (9,)
    """A delete is attempted on an updated array"""

    DeleteOfUpdatedGroup = (10,)
    """A delete is attempted on an updated group"""

    (MoveOperationCannotBeRebased,) = (11,)
    """Move operation cannot be rebased"""

ChunkDoubleUpdate class-attribute instance-attribute #

ChunkDoubleUpdate = (6,)

A chunk update conflicts with an existing chunk update

ChunksUpdatedInDeletedArray class-attribute instance-attribute #

ChunksUpdatedInDeletedArray = (7,)

Chunks are updated in a deleted array

ChunksUpdatedInUpdatedArray class-attribute instance-attribute #

ChunksUpdatedInUpdatedArray = (8,)

Chunks are updated in an updated array

DeleteOfUpdatedArray class-attribute instance-attribute #

DeleteOfUpdatedArray = (9,)

A delete is attempted on an updated array

DeleteOfUpdatedGroup class-attribute instance-attribute #

DeleteOfUpdatedGroup = (10,)

A delete is attempted on an updated group

NewNodeConflictsWithExistingNode class-attribute instance-attribute #

NewNodeConflictsWithExistingNode = (1,)

A new node conflicts with an existing node

NewNodeInInvalidGroup class-attribute instance-attribute #

NewNodeInInvalidGroup = (2,)

A new node is in an invalid group

ZarrMetadataDoubleUpdate class-attribute instance-attribute #

ZarrMetadataDoubleUpdate = (3,)

A zarr metadata update conflicts with an existing zarr metadata update

ZarrMetadataUpdateOfDeletedArray class-attribute instance-attribute #

ZarrMetadataUpdateOfDeletedArray = (4,)

A zarr metadata update is attempted on a deleted array

ZarrMetadataUpdateOfDeletedGroup class-attribute instance-attribute #

ZarrMetadataUpdateOfDeletedGroup = (5,)

A zarr metadata update is attempted on a deleted group

VersionSelection #

Bases: Enum

Enum for selecting the which version of a conflict

Attributes:

Name Type Description
Fail int

Fail the rebase operation

UseOurs int

Use the version from the source store

UseTheirs int

Use the version from the target store

Source code in icechunk-python/python/icechunk/_icechunk_python.pyi
class VersionSelection(Enum):
    """Enum for selecting the which version of a conflict

    Attributes
    ----------
    Fail: int
        Fail the rebase operation
    UseOurs: int
        Use the version from the source store
    UseTheirs: int
        Use the version from the target store
    """

    Fail = 0
    UseOurs = 1
    UseTheirs = 2