aboutsummaryrefslogtreecommitdiff
path: root/src/model/key_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-22 18:50:08 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-04 12:47:28 +0100
commitd8ab5bdc3e20759e5ba8a6844393757da3539372 (patch)
tree7fc9abc578bb4185691313889ed94aedca09dbc4 /src/model/key_table.rs
parentc7d5c732442c5802058b46205d450d4620772b7b (diff)
downloadgarage-d8ab5bdc3e20759e5ba8a6844393757da3539372.tar.gz
garage-d8ab5bdc3e20759e5ba8a6844393757da3539372.zip
New buckets for 0.6.0: fix model and migration
Diffstat (limited to 'src/model/key_table.rs')
-rw-r--r--src/model/key_table.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index 3285e355..daea5473 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -6,6 +6,8 @@ use garage_util::data::*;
use crate::permission::BucketKeyPerm;
+use garage_model_050::key_table as old;
+
/// An api key
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub struct Key {
@@ -173,11 +175,8 @@ impl TableSchema for KeyTable {
}
fn try_migrate(bytes: &[u8]) -> Option<Self::E> {
- let old_k =
- match rmp_serde::decode::from_read_ref::<_, garage_model_050::key_table::Key>(bytes) {
- Ok(x) => x,
- Err(_) => return None,
- };
+ let old_k = rmp_serde::decode::from_read_ref::<_, old::Key>(bytes).ok()?;
+
let state = if old_k.deleted.get() {
crdt::Deletable::Deleted
} else {