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

Proposal: Remove store.Create, always return empty document from store.Fetch #10

Open
jonasfj opened this issue Oct 4, 2015 · 2 comments

Comments

@jonasfj
Copy link
Contributor

jonasfj commented Oct 4, 2015

@Jeffail, this is an opinionated proposal, if you don't like it please close it immediately.
There is no reason to do this if there are lots of valid use-cases for having create.


The idea is to remove store.Create and have store.Fetch always return an empty document, if a document doesn't exist. It'll still need an err response for internal errors, and in cases where documentId is too large or in a format not support by the storage engine.

A long with this I would probably suggest that we also reduce auth to only care about permissions Edit and ReadOnly. So technically someone could still prevent new documents, by restricting access using auth (ie. forbid anyone from editing a document that doesn't exist). But as far as curator goes, it seems like a lot of extra cases to deal with.


Unrelated My goal with this is to build an etherpad-like thing. Just more robust, better scalability and less maintenance, my biggest concern for now is complexity of the API, ie. there is a lot of corner cases that I don't think most people will care about.

The last concern is scalability, specifically I see some locks both curator and binder level... I filed a bug for the curator level lock to not cover I/O, but the binder level kick user locks seems to be about slow web sockets (are they able to make the document slow for all users?). Granted I'm less concerned about those for now.

@jonasfj
Copy link
Contributor Author

jonasfj commented Oct 4, 2015

Also if we do this, perhaps store.Fetch and store.Store should be renamed, get/set, and operate on `[]byte, so that any future model that does more fancy things can use the different stores too...

Proposed interface:

type Store interface {
    Set(id string, content []byte) error
    Get(id string) ([]byte, error)
}

I doubt anyone is going to do new document models... Text is pretty useful, though it would be nice to have some JSON properties for editor settings. But then again, when storing in blob storage, it's nice that all documents are plain text in terms for backup, etc.

@jonasfj
Copy link
Contributor Author

jonasfj commented Oct 4, 2015

Not sure if it would be feasible, but adding:
RegisterHandlers(register register.PubPrivEndpointRegister) error
Would also be nice, notably because different storage engines supports different ways of listing/search/finding documents.

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