diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-10 16:38:31 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-10 16:38:31 +0100 |
commit | 445912dc6a3b65d0726b9378b3542b4061272cf4 (patch) | |
tree | bf1ac419b305254b71b9e17857f1e926ef6c2844 /src/model/bucket_table.rs | |
parent | 0fd7df8fa0741caa622b2bae979aac867f443154 (diff) | |
download | garage-445912dc6a3b65d0726b9378b3542b4061272cf4.tar.gz garage-445912dc6a3b65d0726b9378b3542b4061272cf4.zip |
Remove migration paths from 0.1 branch
Diffstat (limited to 'src/model/bucket_table.rs')
-rw-r--r-- | src/model/bucket_table.rs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs index 5bc8b7f9..6330dced 100644 --- a/src/model/bucket_table.rs +++ b/src/model/bucket_table.rs @@ -5,11 +5,6 @@ use garage_table::*; use crate::key_table::PermissionSet; -// We import the same file but in its version 0.1.0. -// We can then access v0.1.0 data structures. -// We use them to perform migrations. -use model010::bucket_table as prev; - /// A bucket is a collection of objects /// /// Its parameters are not directly accessible as: @@ -108,39 +103,4 @@ impl TableSchema for BucketTable { fn matches_filter(entry: &Self::E, filter: &Self::Filter) -> bool { filter.apply(entry.is_deleted()) } - - fn try_migrate(bytes: &[u8]) -> Option<Self::E> { - let old = match rmp_serde::decode::from_read_ref::<_, prev::Bucket>(bytes) { - Ok(x) => x, - Err(_) => return None, - }; - if old.deleted { - Some(Bucket { - name: old.name, - state: crdt::LWW::migrate_from_raw(old.timestamp, BucketState::Deleted), - }) - } else { - let mut keys = crdt::LWWMap::new(); - for ak in old.authorized_keys() { - keys.merge(&crdt::LWWMap::migrate_from_raw_item( - ak.key_id.clone(), - ak.timestamp, - PermissionSet { - allow_read: ak.allow_read, - allow_write: ak.allow_write, - }, - )); - } - - 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(params)), - }) - } - } } |