Add support for conditional operations
I would like to maintain an RRset of A records that point to several dynamic IP, for this I plan to have a script on each device that would take care of updating its own IP in the RRset. However if 2 or more IP changes at the same time the resulting concurrent read-modify-write access might lead to an inconsistent state.
The usual solution to this problem is to use HTTP conditionals to make sure that no update happened between the read and write. For this responses need to have ETag header and the conditional headers such as If-Match or If-None-Match need to be supported.
Mozilla has a overview of this topic: https://developer.mozilla.org/en-US/docs/Web/HTTP/Conditional_requests
As an alternative way, we were discussing API access on record level, but have not implemented that yet. Maybe it's a good opportunity to look back at that discussion @peterthomassen
Is there a general solution for conditional requests/ETags in Django?
Yes, there is: https://docs.djangoproject.com/en/3.0/topics/conditional-view-processing/
This topic (conditionals) as well as RR-level access is entangled with RFC2136 prerequisites and #357. It may make sense to think these through together, so leverage more generic data structure etc.
A way to go forward with this and #357 could be to implement the zone serial as etag, in order to fail concurrent updates.
A way to go forward with this and #357 could be to implement the zone serial as etag, in order to fail concurrent updates.
The serial would be perfect for the zone as a whole, for RR-set that wouldn't be ideal but better than nothing.