Account modification function draft
Many implementations provide a single account modification function rather than two separate add and remove functions. This increases efficiency over high-latency links, and allows to carry out a transaction on forward-moving data with a single request.
The account modification function takes a set of additions and a set of removals, and executes them as a single operation:
An addition consists of an account identifier, a box label, and an object reference, and therefore corresponds to a single add operation.
Similarly, a removal consists of an account identifier, a box label, and a hash, and corresponds to a single remove operation.
The function proceeds as follows:
Note that removals are executed only after successful completion of all additions. Furthermore, the function returns success even if some or all removals fail.
Additions may be executed in parallel, but all additions must have completed successfully before executing any removals.
Removals may be executed in parallel, too.
Multiple modification or box listing requests may be processed concurrently. A list request may see the result of a partially executed modification request.
An added entry may not exist any more by the time the modification function returns, as a concurrent modification request may have removed it.
Formally, this function fulfills three properties:
- No removal takes place before all additions have completed successfully.
- If the function return success, all additions have completed successfully.
- If a hash is submitted for removal over and over again, it will eventually disappear from the box.