Skip to content

proxystore.store.local

LocalStore Implementation.

LocalStoreKey

Bases: NamedTuple

Key to objects in a LocalStore.

id class-attribute

id: str

Unique object ID.

LocalStore

LocalStore(
    name: str,
    *,
    store_dict: dict[LocalStoreKey, bytes] | None = None,
    cache_size: int = 16,
    stats: bool = False
) -> None

Bases: Store[LocalStoreKey]

Local Memory Key-Object Store.

Warning

:class:LocalStore <.LocalStore> should typically be used for testing proxystore locally as using proxy store within the same Python process is unnecessary.

Parameters:

  • name (str) –

    Name of this store instance.

  • store_dict (dict[LocalStoreKey, bytes] | None) –

    Dictionary to store data in. If not specified, a new empty dict will be generated.

  • cache_size (int) –

    Size of LRU cache (in # of objects). If 0, the cache is disabled. The cache is local to the Python process.

  • stats (bool) –

    Collect stats on store operations.

Source code in proxystore/store/local.py
def __init__(
    self,
    name: str,
    *,
    store_dict: dict[LocalStoreKey, bytes] | None = None,
    cache_size: int = 16,
    stats: bool = False,
) -> None:
    self._store: dict[LocalStoreKey, bytes] = {}
    if store_dict is not None:
        self._store = store_dict

    super().__init__(
        name,
        cache_size=cache_size,
        stats=stats,
        kwargs={'store_dict': self._store},
    )