Skip to content

Commit e7ba5c7

Browse files
authored
Disk-only MT (#796)
* feat(storage-proofs): replace DiskMmapStore with disk-only DiskStore * use released version
1 parent 5a432ce commit e7ba5c7

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

storage-proofs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ bench = false
1515
bitvec = "0.5"
1616
rand = "0.4"
1717
libc = "0.2"
18-
merkletree = "0.7.1"
18+
merkletree = "=0.8"
1919
failure = "0.1"
2020
byteorder = "1"
2121
config = "0.9.3"

storage-proofs/src/drgraph.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::parameter_cache::ParameterSetMetadata;
1212
use crate::util::{data_at_node, NODE_SIZE};
1313

1414
#[cfg(feature = "disk-trees")]
15-
use crate::merkle::DiskMmapStore;
15+
use crate::merkle::DiskStore;
1616
#[cfg(feature = "disk-trees")]
1717
use merkletree::merkle::next_pow2;
1818
#[cfg(feature = "disk-trees")]
@@ -122,10 +122,9 @@ pub trait Graph<H: Hasher>: ::std::fmt::Debug + Clone + PartialEq + Eq {
122122
top_half_path.to_str()
123123
);
124124

125-
let leaves_disk_mmap =
126-
DiskMmapStore::new_with_path(next_pow2(self.size()), leaves_path);
125+
let leaves_disk_mmap = DiskStore::new_with_path(next_pow2(self.size()), leaves_path);
127126
let top_half_disk_mmap =
128-
DiskMmapStore::new_with_path(next_pow2(self.size()), top_half_path);
127+
DiskStore::new_with_path(next_pow2(self.size()), top_half_path);
129128

130129
// FIXME: `new_with_path` is using the `from_iter` implementation,
131130
// instead the `parallel` flag should be passed also as argument
@@ -138,7 +137,7 @@ pub trait Graph<H: Hasher>: ::std::fmt::Debug + Clone + PartialEq + Eq {
138137
top_half_disk_mmap,
139138
))
140139
// If path is `None` use the existing code that will eventually
141-
// call the default `DiskMmapStore::new` creating a temporary
140+
// call the default `DiskStore::new` creating a temporary
142141
// file.
143142
} else if parallel {
144143
Ok(MerkleTree::from_par_iter(

storage-proofs/src/layered_drgporep.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,6 @@ pub trait Layers {
337337
})
338338
.collect::<Result<Vec<_>>>()?;
339339

340-
// Offload the data tree, we won't use it in the next iteration,
341-
// only `tree_r` is reused (as the new `tree_d`).
342-
aux[layer].try_offload_store();
343-
// Only if this is the last iteration also offload `tree_r`.
344-
if layer == layers - 1 {
345-
aux[layer + 1].try_offload_store();
346-
}
347-
348340
Ok(partition_proofs)
349341
})
350342
.collect::<Result<Vec<_>>>()
@@ -569,7 +561,6 @@ pub trait Layers {
569561
// replications many times in the same run so they may end up
570562
// reusing the same files with invalid (old) data and failing.
571563

572-
tree_d.try_offload_store();
573564
return tree_d;
574565
}
575566
}

storage-proofs/src/merkle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use crate::hasher::{Domain, Hasher};
1616
// `mmap`ed `MerkleTree` (replacing the previously `Vec`-backed
1717
// `MerkleTree`, now encapsulated in `merkle::VecStore` and exposed
1818
// as `VecMerkleTree`).
19-
pub type DiskMmapStore<E> = merkletree::merkle::DiskMmapStore<E>;
19+
pub type DiskStore<E> = merkletree::merkle::DiskStore<E>;
2020
pub type VecMerkleTree<T, A> = merkle::MerkleTree<T, A, VecStore<T>>;
2121
#[cfg(feature = "disk-trees")]
22-
pub type MerkleTree<T, A> = merkle::MerkleTree<T, A, DiskMmapStore<T>>;
22+
pub type MerkleTree<T, A> = merkle::MerkleTree<T, A, DiskStore<T>>;
2323
#[cfg(not(feature = "disk-trees"))]
2424
pub type MerkleTree<T, A> = merkle::MerkleTree<T, A, MmapStore<T>>;
2525

0 commit comments

Comments
 (0)