reifydb_store_multi/hot/
result.rs1use reifydb_core::{
5 common::CommitVersion,
6 encoded::key::EncodedKey,
7 interface::store::{MultiVersionValues, SingleVersionValues},
8};
9
10#[derive(Debug, Clone)]
11pub enum MultiVersionGetResult {
12 Value(MultiVersionValues),
13 Tombstone {
14 key: EncodedKey,
15 version: CommitVersion,
16 },
17 NotFound,
18}
19
20impl MultiVersionGetResult {
21 pub fn is_tombstone(&self) -> bool {
22 matches!(self, Self::Tombstone { .. })
23 }
24
25 pub fn is_value(&self) -> bool {
26 matches!(self, Self::Value(_))
27 }
28
29 pub fn into_option(self) -> Option<MultiVersionValues> {
30 match self {
31 Self::Value(v) => Some(v),
32 _ => None,
33 }
34 }
35}
36
37impl Into<Option<MultiVersionValues>> for MultiVersionGetResult {
38 fn into(self) -> Option<MultiVersionValues> {
39 self.into_option()
40 }
41}
42
43#[derive(Debug, Clone)]
44pub enum SingleVersionGetResult {
45 Value(SingleVersionValues),
46 Tombstone {
47 key: EncodedKey,
48 },
49 NotFound,
50}
51
52impl SingleVersionGetResult {
53 pub fn is_tombstone(&self) -> bool {
54 matches!(self, Self::Tombstone { .. })
55 }
56
57 pub fn is_value(&self) -> bool {
58 matches!(self, Self::Value(_))
59 }
60
61 pub fn into_option(self) -> Option<SingleVersionValues> {
62 match self {
63 Self::Value(v) => Some(v),
64 _ => None,
65 }
66 }
67}
68
69impl Into<Option<SingleVersionValues>> for SingleVersionGetResult {
70 fn into(self) -> Option<SingleVersionValues> {
71 self.into_option()
72 }
73}
74
75#[derive(Debug, Clone)]
76pub enum MultiVersionIterResult {
77 Value(MultiVersionValues),
78 Tombstone {
79 key: EncodedKey,
80 version: CommitVersion,
81 },
82}
83
84#[derive(Debug, Clone)]
85pub enum SingleVersionIterResult {
86 Value(SingleVersionValues),
87 Tombstone {
88 key: EncodedKey,
89 },
90}
91
92impl SingleVersionIterResult {
93 pub fn into_option(self) -> Option<SingleVersionValues> {
94 match self {
95 Self::Value(v) => Some(v),
96 Self::Tombstone {
97 ..
98 } => None,
99 }
100 }
101
102 pub fn key(&self) -> &EncodedKey {
103 match self {
104 Self::Value(v) => &v.key,
105 Self::Tombstone {
106 key,
107 } => key,
108 }
109 }
110}