load returns the persisted bytes for the given document key, or
undefined when nothing has been stored for it.
remove deletes any persisted bytes for the document key. It is a no-op
when nothing is stored.
save persists the given bytes for the document key, overwriting any
previously stored value.
DocStoreis a pluggable persistence backend for offline document state. The client serializes a document withDocument.toBytes()and hands the resulting envelope tosave; on a later attach it callsloadand, when bytes are present, rehydrates the document viaDocument.fromBytesso un-pushed local changes survive a reload.The interface is intentionally byte-oriented and async so that a durable backend (e.g. IndexedDB) can implement it without the client knowing which storage it talks to. The default
MemoryDocStorekeeps everything in a process-local map and is dependency-free.