class-v6: drop the second copy of DatasetSource's leaves methods the master merge brought in (master's copy lacked the geom field)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
c23f687bc0
commit
a7c2c082f9
1 changed files with 0 additions and 36 deletions
|
|
@ -416,42 +416,6 @@ impl DatasetSource {
|
|||
self.memhard().and_then(|m| m.leaves.as_ref())
|
||||
}
|
||||
|
||||
/// This source with the window's state leaves (class v5, `docs/design/class-v5-stored-state.md`): memory-hard mode
|
||||
/// under a shape with `state` only.
|
||||
pub fn with_leaves(mut self, leaves: std::sync::Arc<crate::state::StateLeaves>) -> Self {
|
||||
match &mut self.dataset {
|
||||
Dataset::MemoryHard(m) => {
|
||||
assert!(m.params.shape.state, "state leaves on a dataset whose shape has no state");
|
||||
m.leaves = Some(leaves);
|
||||
}
|
||||
Dataset::ClosedForm { .. } => panic!("state leaves on a closed-form dataset"),
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// A source of the same day with other leaves, the 256 MiB cache shared (the class v5 window refresh).
|
||||
pub fn refreshed(&self, leaves: std::sync::Arc<crate::state::StateLeaves>) -> Self {
|
||||
let dataset = match &self.dataset {
|
||||
Dataset::MemoryHard(m) => Dataset::MemoryHard(m.refreshed(leaves)),
|
||||
Dataset::ClosedForm { .. } => panic!("state leaves on a closed-form dataset"),
|
||||
};
|
||||
Self { log2_words: self.log2_words, mask: self.mask, key: self.key, key_bytes: self.key_bytes.clone(), dataset, hot: None }
|
||||
}
|
||||
|
||||
/// A copy of this source sharing its cache (and leaves), for a caller that needs an owned source from a shared one.
|
||||
pub fn refreshed_or_clone(&self) -> Self {
|
||||
let dataset = match &self.dataset {
|
||||
Dataset::MemoryHard(m) => Dataset::MemoryHard(crate::memhard::MemhardCpu { params: m.params.clone(), cache: m.cache.clone(), leaves: m.leaves.clone() }),
|
||||
Dataset::ClosedForm { d0, d1 } => Dataset::ClosedForm { d0: *d0, d1: *d1 },
|
||||
};
|
||||
Self { log2_words: self.log2_words, mask: self.mask, key: self.key, key_bytes: self.key_bytes.clone(), dataset, hot: None }
|
||||
}
|
||||
|
||||
/// The window's state leaves, when the source carries them.
|
||||
pub fn leaves(&self) -> Option<&std::sync::Arc<crate::state::StateLeaves>> {
|
||||
self.memhard().and_then(|m| m.leaves.as_ref())
|
||||
}
|
||||
|
||||
/// This source with the hot table of the epoch whose program seed bytes are `seed_bytes` (`mb` MiB).
|
||||
pub fn with_hot(mut self, seed_bytes: &[u8], mb: u32) -> Self {
|
||||
self.hot = Some(HotTable::for_seed_bytes(seed_bytes, mb));
|
||||
|
|
|
|||
Loading…
Reference in a new issue