Add a new TransactingConfigStore protocol. This TransactingConfigStore is a
ConfigStore that provides a method for establishing a transaction.
What a transaction means can depend on the store but generally it is
intended to provide a way to use database transactions with the store
abstraction.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
TYPE_CHECKING,
Any,
Collection,
+ ContextManager,
Dict,
Iterator,
List,
... # pragma: no cover
+class TransactingConfigStore(ConfigStore, Protocol):
+ """A protocol for a config store that supports transactions.
+ Using the transactions can make using the store more robust or
+ efficient.
+ """
+
+ def transaction(self) -> ContextManager[None]:
+ """Return a context manager that wraps a transaction. What exactly
+ this means depends on the store. Typically this would wrap a database
+ transaction.
+ """
+ ... # pragma: no cover
+
+
class PathResolver(Protocol):
"""A protocol describing a type that can map volumes, subvolumes, and
paths to real paths within a cephfs system.