This PR adds offline support to the Firestore API. It can be enabled or disabled with a new property called persistence_enabled. Here's what it does.
When online, any add or update task creates a new cache file for each document created. When deleted, it gets deleted in the cache directory as well.
When offline however, the delete tasks create a cache file that represents the document being deleted. get tasks also come from the cache files. add and update operations mostly do what they'd do when online.
When back online, all the cache files that were modified after going offline are uploaded to the server, including the "deleted" ones, which delete them on the server end.
Some known issues and solvable limitations:
Queries aren't supported in offline mode.
A list can't be order in offline mode.
If a document is deleted and then uploaded, then going back online will only update the documents.
Also, the list function now returns a list of document objects, plus a page token at the end of the array.
This PR adds offline support to the Firestore API. It can be enabled or disabled with a new property called
persistence_enabled
. Here's what it does.add
orupdate
task creates a new cache file for each document created. When deleted, it gets deleted in the cache directory as well.delete
tasks create a cache file that represents the document being deleted.get
tasks also come from the cache files.add
andupdate
operations mostly do what they'd do when online.Some known issues and solvable limitations:
Also, the list function now returns a list of document objects, plus a page token at the end of the array.