Skip to content

Commit 0f9548b

Browse files
committed
Clarify that all removals must be well-ordered, even lazy ones
In the previous commit we reverted 561da4c. One of the motivations for it (in addition to `lazy` removals being somewhat less, though still arguably useful in an async context) was that the ordering requirements of `lazy` removals is somewhat unclear. Here we simply default to the simplest safe option, requiring a total order across all `write` and `remove` operations to the same key, `lazy` or not.
1 parent 3b4c2ff commit 0f9548b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lightning/src/util/persist.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ pub trait KVStore {
255255
/// potentially get lost on crash after the method returns. Therefore, this flag should only be
256256
/// set for `remove` operations that can be safely replayed at a later time.
257257
///
258+
/// All removal operations must complete in a consistent total order with [`Self::write`]s
259+
/// to the same key. Whether a removal operation is `lazy` or not, [`Self::write`] operations
260+
/// to the same key which occur before a removal completes must cancel/overwrite the pending
261+
/// removal.
262+
///
258263
/// Returns successfully if no data will be stored for the given `primary_namespace`,
259264
/// `secondary_namespace`, and `key`, independently of whether it was present before its
260265
/// invokation or not.

0 commit comments

Comments
 (0)