MirroredStore
A remote store whose reads are copied into the local files and served from them when it is away.
A read of an object the last listing showed unchanged since it was
mirrored is served from the mirror, so reloading many objects costs one
listing. After a failure the remote store is left alone for
RETRY_SECONDS, so a store that is away does not hold up every read.
Attributes
attributeRETRY_SECONDS= 10.0attributeFRESH_SECONDS= 5.0attributeremote= remoteattributelocal= FileStore()attributereachable= TrueFunctions
constructor__init__(remote) -> NoneWrap remote.
paramremoteObjectStoreReturns
Nonefunc_away(exc) -> NoneNote that the remote store stopped answering.
paramexcExceptionReturns
Nonefunc_resting() -> boolWhether the remote store failed too recently to be asked again.
Returns
boolfuncget(key) -> tuple[bytes, str] | NoneRead through to the remote store, falling back to the mirror.
paramkeystrReturns
tuple[bytes, str] | Nonefuncput(key, data, if_match=None, if_absent=False) -> strWrite to the remote store, then to the mirror.
paramkeystrparamdatabytesparamif_matchstr | None= Noneparamif_absentbool= FalseReturns
strfuncdelete(key, if_match=None) -> NoneDelete from the remote store, then from the mirror.
paramkeystrparamif_matchstr | None= NoneReturns
Nonefunclist(prefix='') -> dict[str, str]List the remote store, or the mirror while it is away; a listing is reused for a second.
paramprefixstr= ''Returns
dict[str, str]