-
Notifications
You must be signed in to change notification settings - Fork 157
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
irmin-(client|server): remove server-side state, simplify batch api, and cleanups #2272
Conversation
5fbbba3
to
94731f3
Compare
Thanks. Simplifying this API to store less state on the server is a good idea. There is still something off in that API that we could improve. For instance, we have:
If you blink hard enough, both types should be Merkle proofs (i.e. a tree with some trees hidden behind a hash). I wonder if we could instead expose a client-side API to manipulate Merkle proofs and base all client/server messages on this instead of custom, non-optimised approximations. I don't have more concrete suggestions apart that I believe you are going in the right direction :-) Also, another thing to consider for the client-side API is how it will look when using other languages (e.g. Python or C). So, we need to check what bindings would look like. |
94731f3
to
68f97da
Compare
The tree part of the batch api definitely could use more exploration (this PR only removes server-side id trees but keeps the rest mostly untouched). If you are adding a pre-existing tree, I think that the api works decently well (just using the tree's key), but if the tree doesn't have a key it falls back to concrete trees, which doesn't seem that great. I'll think about how to unify this using proofs but am open to more thoughts about how it might work if you have them to share! I think the contents part of the batch works okay. It is either a new value or a hash for an existing value (although maybe it should be
Good point. I've exercised it lightly for OCaml through the example, but I agree looking at foreign bindings is a good exercise. I guess a first step would be adding |
I think the initial goal we had with Zach was:
I think 1. and 2. are working for Maybe the right way to address this (not in this PR, which is already a reasonable simplification of the batch API) is to look at all the API calls that involve |
Instead of setting/getting a current branch from the server, use the status of the store on the client to create it when needed on the server.
68f97da
to
c3a089f
Compare
@art-w thanks for the review! I've updated both the things you called out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This is a follow up PR from the initial
irmin-server
integration PR.The big changes:
There are several other cleanups: adopting
irmin
's[%log.* ...]
ppx since this is now an officialirmin
sub-project, adding a full example that demonstrates batching, and adding a mutex for requests so that the server is only processing one client request at a time.It's also worth noting that I discovered a bug in
irmin-git
/ocaml-git
while testing the batchapply
API. I opened PR forocaml-git
that fixes the core issue, but until that is released and thenirmin-git
is patched, we cannot use the batch api'sadd_value
withirmin-git
since it results in a decoding issue on the server.