fleche.storage.bagofholding_file

Attributes

logger

VersionValidator

Classes

BagOfHoldingH5FileBackend

File-based storage backend using pickle.

ValueBagOfHoldingH5File

Mixin that locks per-key so concurrent ops on different keys proceed in parallel.

CallBagOfHoldingH5File

Mixin that locks per-key so concurrent ops on different keys proceed in parallel.

Module Contents

fleche.storage.bagofholding_file.logger[source]
fleche.storage.bagofholding_file.VersionValidator[source]
class fleche.storage.bagofholding_file.BagOfHoldingH5FileBackend[source]

Bases: fleche.storage.file.FileStorage

File-based storage backend using pickle.

Stores objects on the filesystem.

version_validator: VersionValidator | None = None[source]
__post_init__()[source]
_to_file(value: Any, path: pathlib.Path) None[source]
_from_file(path: pathlib.Path) Any[source]
class fleche.storage.bagofholding_file.ValueBagOfHoldingH5File[source]

Bases: fleche.storage.thread_safe.PerKeyLockMixin, fleche.storage.destructuring.DestructuringMixin, fleche.storage.base.ValueMixin, BagOfHoldingH5FileBackend

Mixin that locks per-key so concurrent ops on different keys proceed in parallel.

A lightweight threading.Lock guards the lock-table itself; once the per-key RLock is obtained the table lock is released, so two threads operating on different keys never block each other. Operations on the same key are serialized by the per-key lock, which is reentrant to allow nested calls (e.g. expand inside load).

Instances must be hashable. Place before the concrete storage class in the MRO:

@dataclass(frozen=True)
class PerKeyValuePickle(PerKeyLockMixin, ValuePickleFile): ...
class fleche.storage.bagofholding_file.CallBagOfHoldingH5File[source]

Bases: fleche.storage.thread_safe.PerKeyLockMixin, fleche.storage.base.CallMixin, BagOfHoldingH5FileBackend

Mixin that locks per-key so concurrent ops on different keys proceed in parallel.

A lightweight threading.Lock guards the lock-table itself; once the per-key RLock is obtained the table lock is released, so two threads operating on different keys never block each other. Operations on the same key are serialized by the per-key lock, which is reentrant to allow nested calls (e.g. expand inside load).

Instances must be hashable. Place before the concrete storage class in the MRO:

@dataclass(frozen=True)
class PerKeyValuePickle(PerKeyLockMixin, ValuePickleFile): ...