-
Notifications
You must be signed in to change notification settings - Fork 210
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 Optimistic Concurrency Control / If-Match support to Node Objects (or all DB objects) #419
Comments
We've talked about something like this in the past. I'm 👍 on the general idea. |
Yeah, I have some questions about how the client could usefully leverage this, but it seems like the servers should fully support Etags as part of useful extensions to the HTTP protocol and then client-side we can figure out how they can be made useful. |
Hello @stevendanna and @lamont-granquist . I had done some Erlang development in the past, and quite much Ruby recently when using chef. |
@rafaltrojniak I can probably help you get started here. There are a few pieces to be modified:
All of these components are contained within the chef-server repository. Also available is an integrated development VM which should keep it relatively simple. If you're available on IRC, we can talk further this week? |
Hello @marcparadise , sorry for not responding - notification got missed between other ones. I had grabbed the repo and tried starting vagrant. Will try to move forward in the week. Is there any module graph/guideline so I can find proper erlang(oc_erchef) module to modify ? It looks like big codebase and I feel lost :/ |
No worries. Yeah, it's a bit of a maze when coming in fresh. I'd have to refresh my memory on where etags fit into the webmachine flow, but the components involved at minimum would be:
Another approach is to add support for If-Unmodified-Since: we already capture a last-modified time every time we update the node object. If we provide to the client via Last-Modified header and th client hands it back to us on PUT, that might make it even simpler. |
Is there any common "base class" (you'll have to translate from OO speak into something that might make sense in a functional erlang world) where we could fix this for all objects and not just node objects? And I do think that while we're adding |
Hello,
I'll dig more into the code and I plan to :
@lamont-granquist With the node Proof Of Concept I'll try to extend that to other objects (like nodes, environments and so one). I'm just afraid that because of the splitting objects (different records/modules definition for them) that will lead to some duplication, or using of complicated callbacks. But we'll see. |
I had some troubles with firing up the Vagrant box and tried to work on some eunit tests on my box.
|
On the server side I think this is as simple as adding the webmachine generate_etag and last_modified hooks. It looks like bookshelf already does this. If erchef did this for node objects then client code could be modified to supply an If-Match header with the Etag in the PUT request which would then get rejected by the server if the object had been updated and the tag changed.
The text was updated successfully, but these errors were encountered: