Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve sub-collection watchers. #4

Open
amiller-gh opened this issue Mar 25, 2021 · 0 comments
Open

feat: Improve sub-collection watchers. #4

amiller-gh opened this issue Mar 25, 2021 · 0 comments

Comments

@amiller-gh
Copy link
Collaborator

Currently, sub-collections get their own cache documents. This is good because sub-collections can get pretty large sometimes!

However, for sub-collections of the same type, it would be nice to know exactly which ones are dirty. We can conceivably keep a generation cache document for the sub collection type to know which sub-collections contain a dirty object.

ex:

collection/0/sub-collection

{
  "collection/document/sub-collection/0": 0,
  "collection/document/sub-collection/1": 1,
  "collection/document/sub-collection/2": 0
} 

collection/1/sub-collection

{
  "collection/document/sub-collection/0": 0,
  "collection/document/sub-collection/1": 0,
  "collection/document/sub-collection/2": 0
} 

collection/*/sub-collection

{
  "0": 1,
  "1": 0
} 

We can watch all sub-collections by calling FireStash.watch('collection/*/sub-collection'). This will ensure that all local sub-collections are up to date with minimal reads. A corrosponding event should be fired on any sub-collection change.

On firestash update calls, this will give us another document to bulk-update... but I think this may be worth it to reduce ballooning read requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant