v7 migration progress
This commit is contained in:
@@ -62,7 +62,8 @@ fn attempt_migrate(mut key_h: H256, val: &[u8]) -> Option<H256> {
|
||||
}
|
||||
|
||||
/// Version for ArchiveDB.
|
||||
pub struct ArchiveV7;
|
||||
#[derive(Default)]
|
||||
pub struct ArchiveV7(usize);
|
||||
|
||||
impl SimpleMigration for ArchiveV7 {
|
||||
fn version(&self) -> u32 {
|
||||
@@ -70,6 +71,12 @@ impl SimpleMigration for ArchiveV7 {
|
||||
}
|
||||
|
||||
fn simple_migrate(&mut self, key: Vec<u8>, value: Vec<u8>) -> Option<(Vec<u8>, Vec<u8>)> {
|
||||
self.0 += 1;
|
||||
if self.0 == 100_000 {
|
||||
self.0 = 0;
|
||||
println!(".");
|
||||
}
|
||||
|
||||
if key.len() != 32 {
|
||||
// metadata key, ignore.
|
||||
return Some((key, value));
|
||||
@@ -228,7 +235,14 @@ impl Migration for OverlayRecentV7 {
|
||||
_ => return Err(Error::MigrationImpossible), // missing or wrong version
|
||||
}
|
||||
|
||||
let mut count = 0;
|
||||
for (key, value) in source.iter() {
|
||||
count += 1;
|
||||
if count == 100_000 {
|
||||
count = 0;
|
||||
println!(".");
|
||||
}
|
||||
|
||||
let mut key = key.into_vec();
|
||||
if key.len() == 32 {
|
||||
let key_h = H256::from_slice(&key[..]);
|
||||
|
||||
Reference in New Issue
Block a user