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
Add graphql pub syncing #11
Conversation
Awesome! Should we call these sync queries or sync filters? There are 2 kinds of them, incoming and outgoing. I haven't implemented them anywhere yet though.
The outgoing filter is what you are willing to share. Maybe you only want to upload The incoming filter is what you want. Documents have to pass through both filters to be successfully sync'd (they have to be offererd and wanted). |
More details in this issue, including that you can stack multiple queries to combine them. Also, eventually, for efficiency: Peer1 can ask Peer2 for its incoming filter and apply it before transmitting, to reduce the amount of transmitted data. Peer2 still needs to apply it again, because it doesn't trust Peer1 to do it right.
|
Thanks to your comments and fresh eyes this morning, I came back at this with quite a few changes. Here’s what syncing looks like between two GraphQL peers with these new additions:
Some things I noticed while implementing this:
What if a workspace’s sync filters were stored somewhere in its — I also changed the This conceptual awkwardness is a side-effect of this lib being able to power a single client and a pub. 😬 I don’t think this’ll be the last time, either. — The two different context creation functions have been replaced by a single one. I think the schema context shape will become easier to manage if |
This adds a new exported function for syncing documents to a
IStorage
from a GraphQL endpoint, which means that earthstar-graphql servers can now act as pubs!As well as this, the
syncGraphql
function also supports filters, so peers can askearthstar-graphql
pubs for only a subset of documents they're interested in, i.e. efficient sync / partial replication.This new way of syncing has also been added as an argument to the
sync
mutation:Closes #5, Closes #6