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
) –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
.
Source code in proxystore/connectors/file.py
close
¶
close(clear: bool | None = None) -> None
Close the connector and clean up.
Warning
This will delete the store_dir
directory by default.
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
clear
provided when theFileConnector
was instantiated.
Source code in proxystore/connectors/file.py
config
¶
Get the connector configuration.
The configuration contains all the information needed to reconstruct the connector object.
from_config
classmethod
¶
from_config(config: dict[str, Any]) -> FileConnector
Create a new connector instance from a configuration.
Parameters:
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:
-
bytes | None
–Serialized object or
None
if 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[bytes | None]
–List with same order as
keys
with the serialized objects or -
list[bytes | None]
–None
if the corresponding key does not have an associated object.
Source code in proxystore/connectors/file.py
new_key
¶
Create a new key.
Parameters:
-
obj
(bytes | 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
objs
which 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
(bytes
) –Object to associate with the key.