earthstar-project / earthstar-graphql

Query, sync and set data to earthstar workspaces using GraphQL.
GNU Affero General Public License v3.0
6 stars 1 forks source link

Add `addWorkspace` mutation #9

Closed sgwilym closed 3 years ago

sgwilym commented 3 years ago

Closes #4.

@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.

cinnamon-bun commented 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.

cinnamon-bun commented 3 years ago

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 :)

https://github.com/earthstar-project/earthstar/issues/34

sgwilym commented 3 years ago

@cinnamon-bun Cool, I have an idea about this that I'll share there!