Allow requests with some sort of durability guarantee
fatho opened this issue · 2 comments
Currently, requests to the HTTP API post the command to the core queue and then immediately return. This could lead to a situation where a GET
following a PUT
returns stale data.
The proposal is to add a durable
URL parameter that causes PUT
and DELETE
requests to wait until the modification has been applied to the data store. The easiest way is probably to create a new MVar in the request and pass it along the modification in the corresponding command:
Line 50 in e6cfbec
would become
| Modify Modification (Maybe (MVar ()))
The Nothing
case would behave as before, in the Just
case, the MVar
is filled after the modification has been processed and the request handler blocks with takeMVar
.
Here’s a good overview of how to write data to disk in a way that ensures consistency: https://danluu.com/file-consistency/.