lmdb: migration progress

This commit is contained in:
ardocrat
2026-06-01 17:29:53 +03:00
parent 00685a45c3
commit ebcf7feb28
8 changed files with 66 additions and 23 deletions
+3 -2
View File
@@ -43,7 +43,7 @@ use std::collections::HashMap;
use std::fs::{self, File};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::sync::{mpsc, Arc};
use std::time::{Duration, Instant};
/// Orphan pool size is limited by MAX_ORPHAN_SIZE
@@ -171,8 +171,9 @@ impl Chain {
genesis: Block,
pow_verifier: fn(&BlockHeader) -> Result<(), pow::Error>,
archive_mode: bool,
db_migration_prog_tx: Option<mpsc::Sender<i8>>,
) -> Result<Chain, Error> {
let store = Arc::new(store::ChainStore::new(&db_root)?);
let store = Arc::new(store::ChainStore::new(&db_root, db_migration_prog_tx)?);
// open the txhashset, creating a new one if necessary
let mut txhashset = txhashset::TxHashSet::open(db_root.clone(), store.clone(), None)?;
+6 -2
View File
@@ -28,7 +28,7 @@ use grin_core::ser;
use grin_store as store;
use grin_store::{option_to_not_found, Error};
use std::convert::TryInto;
use std::sync::Arc;
use std::sync::{mpsc, Arc};
const STORE_SUBPATH: &str = "chain";
@@ -67,13 +67,17 @@ pub struct ChainStore {
impl ChainStore {
/// Create new chain store
pub fn new(db_root: &str) -> Result<ChainStore, Error> {
pub fn new(
db_root: &str,
db_migration_prog_tx: Option<mpsc::Sender<i8>>,
) -> Result<ChainStore, Error> {
let db = store::Store::new(
db_root,
None,
Some(STORE_SUBPATH),
DB_PREFIXES.to_vec(),
None,
db_migration_prog_tx,
)?;
Ok(ChainStore { db })
}