from abc import (
ABC,
abstractmethod,
)
from ..operations import (
DatabaseOperation,
DatabaseOperationFactory,
)
[docs]class LockDatabaseOperationFactory(DatabaseOperationFactory, ABC):
"""Lock Database Operation Factory class."""
[docs] @abstractmethod
def build_acquire(self, hashed_key: int) -> DatabaseOperation:
"""Build the database operation to acquire the lock.
:param hashed_key: The hashed key that identifies the lock.
:return: A ``DatabaseOperation`` instance.
"""
[docs] @abstractmethod
def build_release(self, hashed_key: int) -> DatabaseOperation:
"""Build the database operation to release the lock.
:param hashed_key: The hashed key that identifies the lock.
:return: A ``DatabaseOperation`` instance.
"""