1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use crate::cf_names::CFNamesExt;
use crate::errors::Result;
use crate::range::Range;
#[derive(Clone, Debug)]
pub enum DeleteStrategy {
DeleteFiles,
DeleteBlobs,
DeleteByKey,
DeleteByRange,
DeleteByWriter { sst_path: String },
}
pub trait MiscExt: CFNamesExt {
fn flush(&self, sync: bool) -> Result<()>;
fn flush_cf(&self, cf: &str, sync: bool) -> Result<()>;
fn delete_all_in_range(&self, strategy: DeleteStrategy, ranges: &[Range]) -> Result<()> {
for cf in self.cf_names() {
self.delete_ranges_cf(cf, strategy.clone(), ranges)?;
}
Ok(())
}
fn delete_ranges_cf(&self, cf: &str, strategy: DeleteStrategy, ranges: &[Range]) -> Result<()>;
fn get_approximate_memtable_stats_cf(&self, cf: &str, range: &Range) -> Result<(u64, u64)>;
fn ingest_maybe_slowdown_writes(&self, cf: &str) -> Result<bool>;
fn get_engine_used_size(&self) -> Result<u64>;
fn roughly_cleanup_ranges(&self, ranges: &[(Vec<u8>, Vec<u8>)]) -> Result<()>;
fn path(&self) -> &str;
fn sync_wal(&self) -> Result<()>;
fn exists(path: &str) -> bool;
fn dump_stats(&self) -> Result<String>;
fn get_latest_sequence_number(&self) -> u64;
fn get_oldest_snapshot_sequence_number(&self) -> Option<u64>;
fn get_total_sst_files_size_cf(&self, cf: &str) -> Result<Option<u64>>;
fn get_range_entries_and_versions(
&self,
cf: &str,
start: &[u8],
end: &[u8],
) -> Result<Option<(u64, u64)>>;
fn get_cf_num_files_at_level(&self, cf: &str, level: usize) -> Result<Option<u64>>;
fn get_cf_num_immutable_mem_table(&self, cf: &str) -> Result<Option<u64>>;
fn get_cf_compaction_pending_bytes(&self, cf: &str) -> Result<Option<u64>>;
fn is_stalled_or_stopped(&self) -> bool;
}