global: snapshot + lock file + better errors

This commit is contained in:
nym21
2025-08-07 17:29:30 +02:00
parent 4740610923
commit 03e3760152
38 changed files with 851 additions and 473 deletions

View File

@@ -5,7 +5,7 @@ use std::{
path::{Path, PathBuf},
};
use crate::{blk_recap::BlkRecap, BlkIndexToBlkPath, Height};
use crate::{BlkIndexToBlkPath, Height, blk_recap::BlkRecap};
#[derive(Debug)]
pub struct BlkIndexToBlkRecap {
@@ -48,12 +48,12 @@ impl BlkIndexToBlkRecap {
.iter()
.for_each(|(blk_index, blk_path)| {
unprocessed_keys.remove(blk_index);
if let Some(blk_recap) = self.tree.get(blk_index) {
if blk_recap.has_different_modified_time(blk_path) {
self.tree.remove(blk_index).unwrap();
if min_removed_blk_index.is_none_or(|_blk_index| *blk_index < _blk_index) {
min_removed_blk_index.replace(*blk_index);
}
if let Some(blk_recap) = self.tree.get(blk_index)
&& blk_recap.has_different_modified_time(blk_path)
{
self.tree.remove(blk_index).unwrap();
if min_removed_blk_index.is_none_or(|_blk_index| *blk_index < _blk_index) {
min_removed_blk_index.replace(*blk_index);
}
}
});
@@ -85,10 +85,10 @@ impl BlkIndexToBlkRecap {
start = Some(*found.0);
}
if let Some(min_removed) = min_removed {
if start.is_none_or(|start| start > min_removed) {
start = Some(min_removed);
}
if let Some(min_removed) = min_removed
&& start.is_none_or(|start| start > min_removed)
{
start = Some(min_removed);
}
// Should only be none if asking for a too high start