Refactor model stuff, including cleaner CRDTs

This commit is contained in:
Alex Auvolat
2021-03-10 16:21:56 +01:00
parent 6a3dcf3974
commit f319a7d374
20 changed files with 591 additions and 457 deletions
+3 -3
View File
@@ -2,6 +2,8 @@ use serde::{Deserialize, Serialize};
use garage_util::data::*;
use crate::crdt::CRDT;
pub trait PartitionKey {
fn hash(&self) -> Hash;
}
@@ -35,12 +37,10 @@ impl SortKey for Hash {
}
pub trait Entry<P: PartitionKey, S: SortKey>:
PartialEq + Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync
CRDT + PartialEq + Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync
{
fn partition_key(&self) -> &P;
fn sort_key(&self) -> &S;
fn merge(&mut self, other: &Self);
}
pub trait TableSchema: Send + Sync {