We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0622523 commit b7236baCopy full SHA for b7236ba
1 file changed
libsql-wal/src/swap_strategy/mod.rs
@@ -4,4 +4,31 @@ pub(crate) mod frame_count;
4
pub(crate) trait SwapStrategy: Sync + Send + 'static {
5
fn should_swap(&self, frames_in_wal: usize) -> bool;
6
fn swapped(&self);
7
+
8
+ fn and<O: SwapStrategy>(self, other: O) -> And<Self, O>
9
+ where
10
+ Self: Sized,
11
+ {
12
+ And(self, other)
13
+ }
14
15
+pub struct And<A, B>(A, B);
16
17
+impl<A, B> SwapStrategy for And<A, B>
18
+where
19
+ A: SwapStrategy,
20
+ B: SwapStrategy,
21
+{
22
+ #[inline(always)]
23
+ fn should_swap(&self, frames_in_wal: usize) -> bool {
24
+ self.0.should_swap(frames_in_wal) && self.1.should_swap(frames_in_wal)
25
26
27
28
+ fn swapped(&self) {
29
+ self.0.swapped();
30
+ self.1.swapped();
31
32
+}
33
34
}
0 commit comments