proxystore.endpoint.p2p.addrs¶
Cache of peer addresses.
The address of a peer (its home relay URL and direct addresses) is saved after each successful connection so the peer can be reached later even if discovery is unavailable, as long as the addresses of the peer have not changed.
ADDR_CACHE_VERSION
module-attribute
¶
Format version of the peer address cache file.
PeerAddr
¶
Bases: BaseModel
Cached address of a peer.
Attributes:
-
relay_url(str | None) –URL of the home relay of the peer.
-
addresses(list[str]) –Direct addresses of the peer.
PeerAddrCacheFile
¶
Bases: VersionedFile
Contents of the peer address cache file.
Attributes:
-
version(int) –Format version of the file.
-
peers(dict[EndpointId, PeerAddr]) –Mapping of peer IDs to addresses.
PeerAddrCache
¶
PeerAddrCache(path: str)
Cache of peer addresses stored in a JSON file.
Example
Parameters:
-
path(str) –Path to the cache file.
Source code in proxystore/endpoint/p2p/addrs.py
load
¶
load() -> dict[EndpointId, EndpointAddr]
Load cached peer addresses.
The cache is only an optimization so errors are logged rather than raised.
Returns:
-
dict[EndpointId, EndpointAddr]–Mapping of peer IDs to addresses. The mapping is empty if the file does not exist, is malformed, or has an unsupported format version.
Source code in proxystore/endpoint/p2p/addrs.py
save
¶
save(addrs: Mapping[EndpointId, EndpointAddr]) -> None
Atomically save peer addresses, replacing the cached addresses.
Parameters:
-
addrs(Mapping[EndpointId, EndpointAddr]) –Mapping of peer IDs to addresses.