proxystore.connectors.file¶
File system connector implementation.
FileKey
¶
Bases: NamedTuple
Key to objects in a file system directory.
Attributes:
-
filename(str) –Unique object filename.
FileConnector
¶
Connector to shared file system.
This connector writes objects to unique files within store_dir. Marker
files are used to indicate that an object is finished being written
to avoid race conditions.
Parameters:
-
store_dir(str | PathLike[str]) –Path to directory to store data in. Note this directory will be deleted upon closing the store.
-
clear(bool, default:True) –Clear all objects on
close()by removingstore_dir. -
buffering(int, default:-1) –Buffering policy used with
open().
Source code in proxystore/connectors/file.py
close
¶
Close the connector and clean up.
Warning
This will delete the store_dir directory by default.
Note
A Store only clears its
connector when closed if the store is the
owner. Stores created
implicitly, such as when resolving a proxy, never clear their
connector.
Warning
This method should only be called at the end of the program when the connector will no longer be used, for example once all proxies have been resolved.
Parameters:
-
clear(bool | None, default:None) –Remove the store directory. Overrides the default value of
clearprovided when theFileConnectorwas instantiated.
Returns:
-
bool–If the store directory was removed.
Source code in proxystore/connectors/file.py
config
¶
Get the connector configuration.
The configuration contains all the information needed to reconstruct the connector object.
Source code in proxystore/connectors/file.py
from_config
classmethod
¶
from_config(config: dict[str, Any]) -> FileConnector
Create a new connector instance from a configuration.
Parameters:
Source code in proxystore/connectors/file.py
evict
¶
evict(key: FileKey) -> None
Evict the object associated with the key.
Parameters:
-
key(FileKey) –Key associated with object to evict.
Source code in proxystore/connectors/file.py
exists
¶
get
¶
Get the serialized object associated with the key.
Parameters:
-
key(FileKey) –Key associated with the object to retrieve.
Returns:
-
BytesLike | None–Serialized object or
Noneif the object does not exist.
Source code in proxystore/connectors/file.py
get_batch
¶
Get a batch of serialized objects associated with the keys.
Parameters:
Returns:
-
list[BytesLike | None]–List with same order as
keyswith the serialized objects or -
list[BytesLike | None]–Noneif the corresponding key does not have an associated object.
Source code in proxystore/connectors/file.py
new_key
¶
Create a new key.
Parameters:
-
obj(BytesLike | None, default:None) –Optional object which the key will be associated with. Ignored by this implementation.
Returns:
Source code in proxystore/connectors/file.py
put
¶
put_batch
¶
Put a batch of serialized objects in the store.
Parameters:
Returns:
-
list[FileKey]–List of keys with the same order as
objswhich can be used to -
list[FileKey]–retrieve the objects.
Source code in proxystore/connectors/file.py
set
¶
Set the object associated with a key.
Note
The Connector
provides write-once, read-many semantics. Thus,
set()
should only be called once per key, otherwise unexpected behavior
can occur.
Parameters:
-
key(FileKey) –Key that the object will be associated with.
-
obj(BytesLike) –Object to associate with the key.