Closed sgwilym closed 3 years ago
Nice, looks good! I like those functions canAddWorkspace
and getWorkspacePath
, very flexible. 👍
Maybe related or not, here's something I've only just reached clarity about:
Each workspace needs its own separate list of peers that it syncs with. Something like:
+gardening.abcdefg
can sync with: [me.pubhosting.com, gardeningfriends-pub.com]
+secretrecipes.xxxxx
can sync with: [me.pubhosting.com]
We want to make sure that +secretrecipes.xxxxx
doesn't get synced out to some random pub that we trust to talk about gardening but not about secret recipes.
If we're not careful, a workspace's data could end up spreading across a whole wide world of pubs. In SSB this is the desired behaviour, but in Earthstar I'm realizing now that pubs shouldn't sync with each other. Instead, users should initiate syncing only with pubs they trust for each workspace specifically.
Here "pubs" mean, like "unattended peers"? Peers that are not acting directly on the behalf of one user. If earthstar-graphql is running on localhost it's not a pub, even it though it may be a "server" technically speaking. We need better vocabulary about this.
I made an issue in the main earthstar repo about the broader topic of how new workspaces spread between peers. Sorry for ruminating on it in this thread, it's not super related to this PR :)
@cinnamon-bun Cool, I have an idea about this that I'll share there!
Closes #4.
addWorkspace
mutation, and removes the previous behaviour of an unseen workspace being added when passed to thesync
mutation.canAddWorkspace
arg to context creator functions, where you can pass a function that acts as a check for whether a workspace can be added or not (e.g. you could implement a blocklist, or authorise only certain users).makeSqliteContext
with the addition of a requiredgetWorkspacePath
arg, which is a function used to derive the path the SQLite database is stored at from a workspace address.@cinnamon-bun Putting this up as a PR so you can take a gander if you like, I'll merge in a day or two if you have no problems.