Skip to content

Commit 0465327

Browse files
committed
change value type encoding
1 parent a711de5 commit 0465327

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/value_type.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ pub enum ValueType {
1515
/// "Weak" deletion (a.k.a. `SingleDelete` in `RocksDB`)
1616
WeakTombstone,
1717

18-
/// Value handle
18+
/// Value pointer
1919
///
2020
/// Points to a blob in a blob file.
21-
Indirection,
21+
Indirection = 4,
2222
}
2323

2424
impl ValueType {
@@ -39,9 +39,9 @@ impl TryFrom<u8> for ValueType {
3939
fn try_from(value: u8) -> Result<Self, Self::Error> {
4040
match value {
4141
0 => Ok(Self::Value),
42-
0x0000_0001 => Ok(Self::Tombstone),
43-
0x0000_0011 => Ok(Self::WeakTombstone),
44-
0b0000_0100 => Ok(Self::Indirection),
42+
1 => Ok(Self::Tombstone),
43+
2 => Ok(Self::WeakTombstone),
44+
4 => Ok(Self::Indirection),
4545
_ => Err(()),
4646
}
4747
}
@@ -51,9 +51,9 @@ impl From<ValueType> for u8 {
5151
fn from(value: ValueType) -> Self {
5252
match value {
5353
ValueType::Value => 0,
54-
ValueType::Tombstone => 0x0000_0001,
55-
ValueType::WeakTombstone => 0x0000_0011,
56-
ValueType::Indirection => 0b0000_0100,
54+
ValueType::Tombstone => 1,
55+
ValueType::WeakTombstone => 2,
56+
ValueType::Indirection => 4,
5757
}
5858
}
5959
}

0 commit comments

Comments
 (0)