aboutsummaryrefslogtreecommitdiff
path: root/src/table/schema.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-01-03 15:08:37 +0100
committerAlex Auvolat <alex@adnab.me>2023-01-03 15:08:37 +0100
commit426d8784dac0e39879af52d980887d3692fc907c (patch)
treea5bf205a5e8cd013e98cc88fe57aeaeebb86e30b /src/table/schema.rs
parenta81200d345e23b93b8f6e1d879b6b14efbdfb2bb (diff)
downloadgarage-426d8784dac0e39879af52d980887d3692fc907c.tar.gz
garage-426d8784dac0e39879af52d980887d3692fc907c.zip
cleanup
Diffstat (limited to 'src/table/schema.rs')
-rw-r--r--src/table/schema.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/table/schema.rs b/src/table/schema.rs
index 6538a32f..5cbf6c95 100644
--- a/src/table/schema.rs
+++ b/src/table/schema.rs
@@ -7,7 +7,9 @@ use garage_util::migrate::Migrate;
use crate::crdt::Crdt;
/// Trait for field used to partition data
-pub trait PartitionKey {
+pub trait PartitionKey:
+ Clone + PartialEq + Serialize + for<'de> Deserialize<'de> + Send + Sync + 'static
+{
/// Get the key used to partition
fn hash(&self) -> Hash;
}
@@ -28,7 +30,7 @@ impl PartitionKey for FixedBytes32 {
}
/// Trait for field used to sort data
-pub trait SortKey {
+pub trait SortKey: Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync + 'static {
/// Get the key used to sort
fn sort_key(&self) -> &[u8];
}
@@ -66,16 +68,9 @@ pub trait TableSchema: Send + Sync + 'static {
const TABLE_NAME: &'static str;
/// The partition key used in that table
- type P: PartitionKey
- + Clone
- + PartialEq
- + Serialize
- + for<'de> Deserialize<'de>
- + Send
- + Sync
- + 'static;
+ type P: PartitionKey;
/// The sort key used int that table
- type S: SortKey + Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync + 'static;
+ type S: SortKey;
/// They type for an entry in that table
type E: Entry<Self::P, Self::S>;