diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-12-12 21:35:29 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-12-12 21:35:29 +0100 |
commit | 96388acf230d48877a037b21931f61e2c63d2574 (patch) | |
tree | 091b48fd2ec868abe38afde891dd2c22df6eddaf /src/model/bucket_table.rs | |
parent | e1ce2b228aaacd5984bf4e1b73a0a6c1276f78e5 (diff) | |
download | garage-96388acf230d48877a037b21931f61e2c63d2574.tar.gz garage-96388acf230d48877a037b21931f61e2c63d2574.zip |
Implement migration
Diffstat (limited to 'src/model/bucket_table.rs')
-rw-r--r-- | src/model/bucket_table.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs index b6b0fceb..08d0d168 100644 --- a/src/model/bucket_table.rs +++ b/src/model/bucket_table.rs @@ -10,6 +10,11 @@ use crate::key_table::PermissionSet; use model010::bucket_table as prev; +/// A bucket is a collection of objects +/// +/// Its parameters are not directly accessible as: +/// - It must be possible to merge paramaters, hence the use of a LWW CRDT. +/// - A bucket has 2 states, Present or Deleted and parameters make sense only if present. #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] pub struct Bucket { // Primary key @@ -123,9 +128,15 @@ impl TableSchema for BucketTable { }, )); } + + let params = BucketParams { + authorized_keys: keys, + website: crdt::LWW::new(false) + }; + Some(Bucket { name: old.name, - state: crdt::LWW::migrate_from_raw(old.timestamp, BucketState::Present(keys)), + state: crdt::LWW::migrate_from_raw(old.timestamp, BucketState::Present(params)), }) } } |