aboutsummaryrefslogtreecommitdiff
path: root/src/model/key_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-11-20 23:01:12 +0100
committerAlex Auvolat <alex@adnab.me>2020-11-20 23:53:54 +0100
commitf8a04852a2cda84d4fd12ec19e90bbd8224bf4e9 (patch)
treebab388b5958fa0ae2bd8135ed137a54a0d97fc80 /src/model/key_table.rs
parente02e9e035e269cd6b660c92706db424a2edb5306 (diff)
downloadgarage-f8a04852a2cda84d4fd12ec19e90bbd8224bf4e9.tar.gz
garage-f8a04852a2cda84d4fd12ec19e90bbd8224bf4e9.zip
Convert bucket table to better CRDT representation
Diffstat (limited to 'src/model/key_table.rs')
-rw-r--r--src/model/key_table.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index 2b825aa3..ff9d7b79 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -1,8 +1,8 @@
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
-use garage_table::*;
use garage_table::crdt::CRDT;
+use garage_table::*;
use garage_util::error::Error;
@@ -24,7 +24,6 @@ pub struct Key {
// Authorized keys
pub authorized_buckets: crdt::LWWMap<String, PermissionSet>,
-
// CRDT interaction: deleted implies authorized_buckets is empty
}
@@ -125,10 +124,11 @@ impl TableSchema for KeyTable {
let it = crdt::LWWMap::migrate_from_raw_item(
ab.bucket.clone(),
ab.timestamp,
- PermissionSet{
+ PermissionSet {
allow_read: ab.allow_read,
allow_write: ab.allow_write,
- });
+ },
+ );
new.authorized_buckets.merge(&it);
}
Some(new)