concrete-datastore icon indicating copy to clipboard operation
concrete-datastore copied to clipboard

Feature : mechanism to avoid mid-air edit collisions

Open KhaledBousrih opened this issue 5 years ago • 0 comments

In order to avoid mid-air edit collisions, GET responses on an instance should include an ETag header with as value the last_modification_date of this instance.

When attempting a PATCH request on an instance, the request should include the If-Match header with as value the ETag value retrieved from the API (i.e the last_modification_date of the instance):

  • If a PATCH request does not include a If-Match header: update the instance anyways.
  • Otherwise:
    • if the If-Match matches with the last_modification_date of the instance to update, allow the request to update the instance.
    • if it does not match, return a HTTP 409 CONFLICT response.

Useful sources:

  • ETags: https://devdocs.io/http/headers/etag
  • Django Middelware: https://docs.djangoproject.com/fr/2.2/ref/middleware/#django.middleware.http.ConditionalGetMiddleware

KhaledBousrih avatar Apr 07 '20 14:04 KhaledBousrih