fleche.storage.memory
Classes
A concrete implementation of Storage that stores values in an in-memory dictionary. |
|
Mixin that locks per-key so concurrent ops on different keys proceed in parallel. |
|
Mixin that locks per-key so concurrent ops on different keys proceed in parallel. |
Module Contents
- class fleche.storage.memory.MemoryBackend[source]
Bases:
fleche.storage.base.StorageBackendA concrete implementation of Storage that stores values in an in-memory dictionary.
- storage: dict[fleche.digest.Digest, Any][source]
- list() Iterable[fleche.digest.Digest][source]
- put(value: Any, key: fleche.digest.Digest) fleche.digest.Digest[source]
- get(key: fleche.digest.Digest) Any[source]
- _contains(key: fleche.digest.Digest) bool[source]
- _evict(key: fleche.digest.Digest) None[source]
- class fleche.storage.memory.ValueMemory[source]
Bases:
fleche.storage.thread_safe.PerKeyLockMixin,fleche.storage.destructuring.DestructuringMixin,fleche.storage.base.ValueMixin,MemoryBackendMixin that locks per-key so concurrent ops on different keys proceed in parallel.
A lightweight
threading.Lockguards the lock-table itself; once the per-keyRLockis 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.expandinsideload).Instances must be hashable. Place before the concrete storage class in the MRO:
@dataclass(frozen=True) class PerKeyValuePickle(PerKeyLockMixin, ValuePickleFile): ...
- class fleche.storage.memory.CallMemory[source]
Bases:
fleche.storage.thread_safe.PerKeyLockMixin,fleche.storage.base.CallMixin,MemoryBackendMixin that locks per-key so concurrent ops on different keys proceed in parallel.
A lightweight
threading.Lockguards the lock-table itself; once the per-keyRLockis 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.expandinsideload).Instances must be hashable. Place before the concrete storage class in the MRO:
@dataclass(frozen=True) class PerKeyValuePickle(PerKeyLockMixin, ValuePickleFile): ...