ModelLock

class ModelLock[T]

Description

Interface for locking model resources.

For example:

  1. Locking all mutex protected documents.

  2. No-op lock to already locked documents.

Inheritance:

Members defined in ModelLock (3 members)

acquire

Acquire locks to all locked documents. Return a list of documents that the locks give access to.

append

Append an unlocked document, and lock it. Should only ever be called under an acquired lock.

release

Release all acquired document locks and return a tuple of (success, unlocked type).

Methods

abstractmethod acquire() → list[syside.Document]

Acquire locks to all locked documents. Return a list of documents that the locks give access to.

abstractmethod append(document: syside.SharedMutex[syside.Document]) → syside.Document

Append an unlocked document, and lock it. Should only ever be called under an acquired lock.

abstractmethod release(exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: types.TracebackType | None = None) → tuple[bool | None, T]

Release all acquired document locks and return a tuple of (success, unlocked type).

Accepts the same arguments as standard __exit__ method where it will typically be called.