diff options
author | Alex Auvolat <alex@adnab.me> | 2022-01-03 19:06:04 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-01-04 12:53:14 +0100 |
commit | df35feba18787cac06b2a87e3426752fb78da2d5 (patch) | |
tree | 9e7de3ade1ced3d47518854287ecd34c91b1a9be /src/model/bucket_table.rs | |
parent | 1bcd6fabbdc0cd9dee88ba28daecb5339f2c13ec (diff) | |
download | garage-df35feba18787cac06b2a87e3426752fb78da2d5.tar.gz garage-df35feba18787cac06b2a87e3426752fb78da2d5.zip |
New buckets for 0.6.0: make bucket id a SK and not a HK, CLI updates
Diffstat (limited to 'src/model/bucket_table.rs')
-rw-r--r-- | src/model/bucket_table.rs | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs index 52c2316c..d687e774 100644 --- a/src/model/bucket_table.rs +++ b/src/model/bucket_table.rs @@ -105,15 +105,29 @@ impl Bucket { crdt::Deletable::Present(state) => state.authorized_keys.items(), } } -} -impl Entry<Uuid, EmptyKey> for Bucket { - fn partition_key(&self) -> &Uuid { - &self.id + pub fn aliases(&self) -> &[(String, u64, bool)] { + match &self.state { + crdt::Deletable::Deleted => &[], + crdt::Deletable::Present(state) => state.aliases.items(), + } + } + + pub fn local_aliases(&self) -> &[((String, String), u64, bool)] { + match &self.state { + crdt::Deletable::Deleted => &[], + crdt::Deletable::Present(state) => state.local_aliases.items(), + } } - fn sort_key(&self) -> &EmptyKey { +} + +impl Entry<EmptyKey, Uuid> for Bucket { + fn partition_key(&self) -> &EmptyKey { &EmptyKey } + fn sort_key(&self) -> &Uuid { + &self.id + } } impl Crdt for Bucket { @@ -127,8 +141,8 @@ pub struct BucketTable; impl TableSchema for BucketTable { const TABLE_NAME: &'static str = "bucket_v2"; - type P = Uuid; - type S = EmptyKey; + type P = EmptyKey; + type S = Uuid; type E = Bucket; type Filter = DeletedFilter; |