Bases: Protocol[KeyT]
Connector protocol for interfacing with external object storage.
The Connector protocol defines the interface for interacting with a
byte-level object store.
close()
Close the connector and clean up.
Source code in proxystore/connectors/connector.py
| def close(self) -> None:
"""Close the connector and clean up."""
...
|
config()
config() -> dict[str, Any]
Get the connector configuration.
The configuration contains all the information needed to reconstruct
the connector object.
Returns:
Source code in proxystore/connectors/connector.py
| def config(self) -> dict[str, Any]:
"""Get the connector configuration.
The configuration contains all the information needed to reconstruct
the connector object.
Returns:
Connector configuration.
"""
...
|
from_config()
classmethod
from_config(config: dict[str, Any]) -> Connector[Any]
Create a new connector instance from a configuration.
Parameters:
-
config
(
dict[str, Any]
)
–
Configuration returned by .config()
.
Returns:
Source code in proxystore/connectors/connector.py
| @classmethod
def from_config(cls, config: dict[str, Any]) -> Connector[Any]:
"""Create a new connector instance from a configuration.
Args:
config: Configuration returned by `#!python .config()`.
Returns:
Connector instance.
"""
...
|
evict()
Evict the object associated with the key.
Parameters:
-
key
(
KeyT
)
–
Key associated with object to evict.
Source code in proxystore/connectors/connector.py
| def evict(self, key: KeyT) -> None:
"""Evict the object associated with the key.
Args:
key: Key associated with object to evict.
"""
...
|
exists()
exists(key: KeyT) -> bool
Check if an object associated with the key exists.
Parameters:
-
key
(
KeyT
)
–
Key potentially associated with stored object.
Returns:
-
bool
–
If an object associated with the key exists.
Source code in proxystore/connectors/connector.py
| def exists(self, key: KeyT) -> bool:
"""Check if an object associated with the key exists.
Args:
key: Key potentially associated with stored object.
Returns:
If an object associated with the key exists.
"""
...
|
get()
get(key: KeyT) -> bytes | None
Get the serialized object associated with the key.
Parameters:
-
key
(
KeyT
)
–
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/connector.py
| def get(self, key: KeyT) -> bytes | None:
"""Get the serialized object associated with the key.
Args:
key: Key associated with the object to retrieve.
Returns:
Serialized object or `None` if the object does not exist.
"""
...
|
get_batch()
get_batch(keys: Sequence[KeyT]) -> list[bytes | None]
Get a batch of serialized objects associated with the keys.
Parameters:
-
keys
(
Sequence[KeyT]
)
–
Sequence of keys associated with objects to retrieve.
Returns:
-
list[bytes | None]
–
List with same order as keys
with the serialized objects or None
if the corresponding key does not have an associated object.
Source code in proxystore/connectors/connector.py
| def get_batch(self, keys: Sequence[KeyT]) -> list[bytes | None]:
"""Get a batch of serialized objects associated with the keys.
Args:
keys: Sequence of keys associated with objects to retrieve.
Returns:
List with same order as `keys` with the serialized objects or \
`None` if the corresponding key does not have an associated object.
"""
...
|
put()
Put a serialized object in the store.
Parameters:
-
obj
(
bytes
)
–
Serialized object to put in the store.
Returns:
-
KeyT
–
Key which can be used to retrieve the object.
Source code in proxystore/connectors/connector.py
| def put(self, obj: bytes) -> KeyT:
"""Put a serialized object in the store.
Args:
obj: Serialized object to put in the store.
Returns:
Key which can be used to retrieve the object.
"""
...
|
put_batch()
put_batch(objs: Sequence[bytes]) -> list[KeyT]
Put a batch of serialized objects in the store.
Parameters:
-
objs
(
Sequence[bytes]
)
–
Sequence of serialized objects to put in the store.
Returns:
-
list[KeyT]
–
List of keys with the same order as objs
which can be used to retrieve the objects.
Source code in proxystore/connectors/connector.py
| def put_batch(self, objs: Sequence[bytes]) -> list[KeyT]:
"""Put a batch of serialized objects in the store.
Args:
objs: Sequence of serialized objects to put in the store.
Returns:
List of keys with the same order as `objs` which can be used to \
retrieve the objects.
"""
...
|