proxystore.store.dim.websockets
Websockets implementation.
WebsocketStoreKey ¶
Bases: NamedTuple
Key to objects in a WebsocketStore.
WebsocketStore ¶
WebsocketStore(
name: str,
*,
interface: str,
port: int,
max_size: int = MAX_SIZE_DEFAULT,
cache_size: int = 16,
stats: bool = False
) -> None
Bases: Store[WebsocketStoreKey]
Distributed in-memory store using websockets.
This client will initialize a local Websocket server (Peer service) that it will store data to.
Parameters:
-
name
(
str
) –Name of the store instance.
-
interface
(
str
) –The network interface to use.
-
port
(
int
) –The desired port for communication.
-
max_size
(
int
) –The maximum size to be communicated via websockets.
-
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/dim/websockets.py
handler
async
¶
Websocket handler function implementation.
Parameters:
-
event
(
bytes
) –A pickled dictionary consisting of the data, its key and the operation to perform on the data
-
addr
(
str
) –The address of the server to connect to
Returns:
-
bytes
–The result of the operation on the data.
Source code in proxystore/store/dim/websockets.py
close ¶
Terminate Peer server process.
Source code in proxystore/store/dim/websockets.py
WebsocketServer ¶
WebsocketServer implementation.
Parameters:
-
host
(
str
) –IP address of the location to start the server.
-
port
(
int
) –The port to initiate communication on.
-
max_size
(
int
) –The maximum size allowed for websocket communication.
Source code in proxystore/store/dim/websockets.py
set ¶
Obtain and store locally data from client.
Parameters:
Returns:
-
Status
–Operation status.
Source code in proxystore/store/dim/websockets.py
get ¶
Return data at a given key back to the client.
Parameters:
-
key
(
str
) –The object key,
Returns:
Source code in proxystore/store/dim/websockets.py
evict ¶
exists ¶
handler
async
¶
Handle websocket connection requests.
Parameters:
-
websocket
(
WebSocketServerProtocol
) –The websocket server.
Source code in proxystore/store/dim/websockets.py
launch
async
¶
Launch the server.