File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ use std::ops::RangeBounds;
25
25
use futures_util:: StreamExt ;
26
26
use log:: warn;
27
27
28
+ use crate :: BeforeAfter ;
28
29
use crate :: KVResultStream ;
29
30
use crate :: MapApi ;
30
31
use crate :: MapApiRO ;
31
32
use crate :: MapKey ;
32
33
use crate :: Marked ;
33
34
use crate :: MarkedOf ;
34
- use crate :: Transition ;
35
35
36
36
/// A simple in-memory implementation of the Map API using a BTreeMap.
37
37
///
@@ -129,7 +129,7 @@ where M: Clone + Unpin + Send + Sync + 'static
129
129
& mut self ,
130
130
key : String ,
131
131
value : Option < ( <String as MapKey < M > >:: V , Option < M > ) > ,
132
- ) -> Result < Transition < MarkedOf < String , M > > , io:: Error > {
132
+ ) -> Result < BeforeAfter < MarkedOf < String , M > > , io:: Error > {
133
133
// The chance it is the bottom level is very low in a loaded system.
134
134
// Thus, we always tombstone the key if it is None.
135
135
Original file line number Diff line number Diff line change @@ -84,9 +84,17 @@ pub use crate::map_key::MapKey;
84
84
pub use crate :: map_value:: MapValue ;
85
85
pub use crate :: marked:: Marked ;
86
86
87
+ #[ deprecated( since = "0.2.0" , note = "Use `BeforeAfter` instead" ) ]
88
+ pub type Transition < T > = BeforeAfter < T > ;
89
+
87
90
/// Represents a transition from one state to another.
88
- /// The tuple contains the initial state and the resulting state.
89
- pub type Transition < T > = ( T , T ) ;
91
+ ///
92
+ /// This type is a tuple containing two elements:
93
+ /// - The first element represents the state before the transition (initial state)
94
+ /// - The second element represents the state after the transition (resulting state)
95
+ ///
96
+ /// It's commonly used to track changes in values or system states.
97
+ pub type BeforeAfter < T > = ( T , T ) ;
90
98
91
99
/// A boxed stream that yields `Result` of key-value pairs or an `io::Error`.
92
100
/// The stream is 'static to ensure it can live for the entire duration of the program.
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ use std::io;
22
22
23
23
use crate :: map_api_ro:: MapApiRO ;
24
24
use crate :: map_key:: MapKey ;
25
- use crate :: Transition ;
25
+ use crate :: BeforeAfter ;
26
26
27
27
/// Provides a read-write key-value map API, used to access state machine data.
28
28
///
80
80
///
81
81
/// # Returns
82
82
///
83
- /// A [`Transition `] containing:
83
+ /// A [`BeforeAfter `] containing:
84
84
/// - The old value (before the operation)
85
85
/// - The new value (after the operation)
86
86
///
92
92
& mut self ,
93
93
key : K ,
94
94
value : Option < ( K :: V , Option < M > ) > ,
95
- ) -> Result < Transition < crate :: MarkedOf < K , M > > , io:: Error > ;
95
+ ) -> Result < BeforeAfter < crate :: MarkedOf < K , M > > , io:: Error > ;
96
96
}
You can’t perform that action at this time.
0 commit comments