@@ -215,10 +215,21 @@ pub trait KVStore {
215
215
fn read (
216
216
& self , primary_namespace : & str , secondary_namespace : & str , key : & str ,
217
217
) -> Pin < Box < dyn Future < Output = Result < Vec < u8 > , io:: Error > > + ' static + Send > > ;
218
- /// Persists the given data under the given `key`. Note that the order of multiple writes calls needs to be retained
219
- /// when persisting asynchronously. One possible way to accomplish this is by assigning a version number to each
220
- /// write before returning the future, and then during asynchronous execution, ensuring that the writes are executed in
221
- /// the correct order.
218
+ /// Persists the given data under the given `key`.
219
+ ///
220
+ /// The order of multiple writes to the same key needs to be retained while persisting
221
+ /// asynchronously. In other words, if two writes to the same key occur, the state (as seen by
222
+ /// [`Self::read`]) must either see the first write then the second, or only ever the second,
223
+ /// no matter when the futures complete (and must always contain the second write once the
224
+ /// second future completes). The state should never contain the first write after the second
225
+ /// write's future completes, nor should it contain the second write, then contain the first
226
+ /// write at any point thereafter (even if the second write's future hasn't yet completed).
227
+ ///
228
+ /// One way to ensure this requirement is met is by assigning a version number to each write
229
+ /// before returning the future, and then during asynchronous execution, ensuring that the
230
+ /// writes are executed in the correct order.
231
+ ///
232
+ /// Note that no ordering requirements exist for writes to different keys.
222
233
///
223
234
/// Will create the given `primary_namespace` and `secondary_namespace` if not already present in the store.
224
235
fn write (
0 commit comments