aboutsummaryrefslogtreecommitdiff
path: root/src/table/util.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-04-27 16:14:44 +0200
committerAlex Auvolat <alex@adnab.me>2023-06-09 16:23:37 +0200
commit6005491cd8adf569c0b7f88fc6b3af3f166963ea (patch)
treeb66f8a24d48eee04b43f0c20e58cb9c80696e903 /src/table/util.rs
parentea3bfd2ab107497c47718dec3c6c6cda45cd1a43 (diff)
downloadgarage-6005491cd8adf569c0b7f88fc6b3af3f166963ea.tar.gz
garage-6005491cd8adf569c0b7f88fc6b3af3f166963ea.zip
Use Cow<[u8]> for sort keys
Diffstat (limited to 'src/table/util.rs')
-rw-r--r--src/table/util.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/table/util.rs b/src/table/util.rs
index 0b10cf3f..39412c79 100644
--- a/src/table/util.rs
+++ b/src/table/util.rs
@@ -1,3 +1,5 @@
+use std::borrow::Cow;
+
use serde::{Deserialize, Serialize};
use garage_util::data::*;
@@ -7,8 +9,8 @@ use crate::schema::*;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct EmptyKey;
impl SortKey for EmptyKey {
- fn sort_key(&self) -> &[u8] {
- &[]
+ fn sort_key(&self) -> Cow<'_, [u8]> {
+ Cow::from(&[][..])
}
}
impl PartitionKey for EmptyKey {