SealSkin

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.0
attributeFRESH_SECONDS
= 5.0
attributeremote
= remote
attributelocal
= FileStore()
attributereachable
= True

Functions

constructor__init__(remote) -> None

Wrap remote.

paramremoteObjectStore

Returns

None
func_away(exc) -> None

Note that the remote store stopped answering.

paramexcException

Returns

None
func_resting() -> bool

Whether the remote store failed too recently to be asked again.

Returns

bool
funcget(key) -> tuple[bytes, str] | None

Read through to the remote store, falling back to the mirror.

paramkeystr

Returns

tuple[bytes, str] | None
funcput(key, data, if_match=None, if_absent=False) -> str

Write to the remote store, then to the mirror.

paramkeystr
paramdatabytes
paramif_matchstr | None
= None
paramif_absentbool
= False

Returns

str
funcdelete(key, if_match=None) -> None

Delete from the remote store, then from the mirror.

paramkeystr
paramif_matchstr | None
= None

Returns

None
funclist(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]