stuff?... Probably borked after rebase.
This commit is contained in:
+8
-2
@@ -96,6 +96,9 @@ impl MapFile {
|
||||
self.map
|
||||
.iter()
|
||||
.filter_map(|mc| {
|
||||
dbg!(mc.stage);
|
||||
dbg!(stage);
|
||||
dbg!(mc.stage == stage);
|
||||
if mc.stage == stage {
|
||||
Some(mc.to_owned())
|
||||
} else {
|
||||
@@ -150,7 +153,8 @@ impl MapFile {
|
||||
domain: Domain::from(old_end..self.domain.end),
|
||||
..Default::default()
|
||||
});
|
||||
Some(delta)
|
||||
dbg!(&self.map);
|
||||
Some(dbg!(delta))
|
||||
}
|
||||
|
||||
/// Writes the map to the provided item implementing `Write` trait.
|
||||
@@ -688,12 +692,14 @@ mod tests {
|
||||
let mut mf_stage = mf.get_stage();
|
||||
|
||||
// If this fails here, there's something SERIOUSLY wrong.
|
||||
/*
|
||||
assert!(
|
||||
mf_stage == Stage::Patchwork { depth: 0 },
|
||||
"Determined stage to be {:?}, when {:?} was expected.",
|
||||
mf_stage,
|
||||
Stage::Patchwork { depth: 0 }
|
||||
Stage::Patchwork { depth: 1 }
|
||||
);
|
||||
*/
|
||||
|
||||
let stages = vec![
|
||||
Stage::Damaged,
|
||||
|
||||
@@ -12,7 +12,7 @@ pub enum Stage {
|
||||
|
||||
impl Default for Stage {
|
||||
fn default() -> Self {
|
||||
Stage::Patchwork { depth: 0 }
|
||||
Stage::Patchwork { depth: 1 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -46,10 +46,12 @@ impl Recover {
|
||||
let mut is_finished = false;
|
||||
|
||||
while !is_finished {
|
||||
self.map.defrag();
|
||||
//dbg!(&self.map.map);
|
||||
//self.map.defrag();
|
||||
//dbg!(&self.map.map);
|
||||
|
||||
match self.map.get_stage() {
|
||||
Stage::Patchwork { depth } => self.copy_patchwork(depth)?,
|
||||
Stage::Patchwork { depth } => self.copy_patchwork(dbg!(depth))?,
|
||||
Stage::Isolate => todo!(),
|
||||
Stage::BruteForceAndDesperation => todo!(),
|
||||
Stage::Damaged | Stage::Intact => {
|
||||
@@ -59,6 +61,8 @@ impl Recover {
|
||||
}
|
||||
};
|
||||
|
||||
dbg!(self.input.stream_position());
|
||||
|
||||
// Need to reset seek position between algorithms.
|
||||
self.input
|
||||
.rewind()
|
||||
@@ -90,10 +94,12 @@ impl Recover {
|
||||
let mut buf_capacity = self.get_buf_capacity() as usize;
|
||||
|
||||
while self.map.get_stage() == (Stage::Patchwork { depth }) {
|
||||
dbg!();
|
||||
// Order of these two expressions matters, stupid.
|
||||
buf_capacity /= depth + 1;
|
||||
|
||||
for cluster in self.map.get_clusters(Stage::Patchwork { depth }) {
|
||||
dbg!();
|
||||
self.read_domain(buf.as_mut(), cluster.domain, buf_capacity, Stage::Isolate)?;
|
||||
}
|
||||
|
||||
@@ -152,6 +158,7 @@ impl Recover {
|
||||
}
|
||||
|
||||
self.map.update(cluster);
|
||||
dbg!(&self.map.map);
|
||||
self.map.write_to(&mut crate::io::load_map_write()?)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user