Refactor how things are migrated

This commit is contained in:
Alex Auvolat
2023-01-03 14:44:47 +01:00
parent 582b076179
commit cdb2a591e9
27 changed files with 638 additions and 709 deletions
+19 -10
View File
@@ -1,4 +1,3 @@
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use garage_db as db;
@@ -10,19 +9,29 @@ use garage_table::*;
use garage_block::manager::*;
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
pub struct BlockRef {
/// Hash (blake2 sum) of the block, used as partition key
pub block: Hash,
mod v08 {
use garage_util::crdt;
use garage_util::data::{Hash, Uuid};
use serde::{Deserialize, Serialize};
/// Id of the Version for the object containing this block, used as sorting key
pub version: Uuid,
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
pub struct BlockRef {
/// Hash (blake2 sum) of the block, used as partition key
pub block: Hash,
// Keep track of deleted status
/// Is the Version that contains this block deleted
pub deleted: crdt::Bool,
/// Id of the Version for the object containing this block, used as sorting key
pub version: Uuid,
// Keep track of deleted status
/// Is the Version that contains this block deleted
pub deleted: crdt::Bool,
}
impl garage_util::migrate::InitialFormat for BlockRef {}
}
pub use v08::*;
impl Entry<Hash, Uuid> for BlockRef {
fn partition_key(&self) -> &Hash {
&self.block