We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a04c71c commit f03ab8bCopy full SHA for f03ab8b
1 file changed
libsql-wal/src/swap_strategy/frame_count.rs
@@ -0,0 +1,22 @@
1
+use super::SwapStrategy;
2
+
3
+/// A swap strategy that swaps if the count of frames in the wal exceed some threshold
4
+pub struct FrameCountSwapStrategy {
5
+ max_frames_in_wal: usize,
6
+}
7
8
+impl FrameCountSwapStrategy {
9
+ pub fn new(max_frames_in_wal: usize) -> Self {
10
+ Self { max_frames_in_wal }
11
+ }
12
13
14
+impl SwapStrategy for FrameCountSwapStrategy {
15
+ #[inline(always)]
16
+ fn should_swap(&self, frames_in_wal: usize) -> bool {
17
+ frames_in_wal >= self.max_frames_in_wal
18
19
20
21
+ fn swapped(&self) { }
22
0 commit comments