Skip to content

Commit 91c7ffc

Browse files
committed
fix: clean up public API for clearing files
`clear_layer_data()` and `clear_caches` are never called within `rust-fil-proofs` and also not used in `rust-filecoin-proofs-api`, hence remove them. The `clear_cache()` and `clear_synthetic_proofs()` functions don't need to be generic over the tree as it's never used within those functions. This is a breaking change. BREAKING CHANGE: signature of `clear_cache()` and `clear_synthetic_proofs()` changed. The generic parameter is no longer needed.
1 parent aa99ce4 commit 91c7ffc

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

filecoin-proofs/src/api/mod.rs

+2-38
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ pub use winning_post::*;
5151

5252
pub use storage_proofs_update::constants::{partition_count, TreeRHasher};
5353

54-
// TODO vmx 2023-09-26: The `Tree` generic is not needed, it's only there in order to not breaking
55-
// the public API. Once we break the API, remove that generic.
56-
// Ensure that any associated cached data persisted is discarded.
57-
pub fn clear_cache<Tree>(cache_dir: &Path) -> Result<()> {
54+
pub fn clear_cache(cache_dir: &Path) -> Result<()> {
5855
info!("clear_cache:start");
5956

6057
let result = stacked::clear_cache_dir(cache_dir);
@@ -64,40 +61,7 @@ pub fn clear_cache<Tree>(cache_dir: &Path) -> Result<()> {
6461
result
6562
}
6663

67-
// TODO vmx 2023-09-26: The `Tree` generic is not needed, it's only there in order to not breaking
68-
// the public API. Once we break the API, remove that generic.
69-
// Ensure that any associated cached data persisted is discarded.
70-
pub fn clear_caches<Tree: MerkleTreeTrait>(
71-
replicas: &BTreeMap<SectorId, PrivateReplicaInfo<Tree>>,
72-
) -> Result<()> {
73-
info!("clear_caches:start");
74-
75-
for replica in replicas.values() {
76-
clear_cache::<Tree>(replica.cache_dir.as_path())?;
77-
}
78-
79-
info!("clear_caches:finish");
80-
81-
Ok(())
82-
}
83-
84-
// TODO vmx 2023-09-26: The `Tree` generic is not needed, it's only there in order to not breaking
85-
// the public API. Once we break the API, remove that generic.
86-
// Ensure that any persisted layer data generated from porep are discarded.
87-
pub fn clear_layer_data<Tree>(cache_dir: &Path) -> Result<()> {
88-
info!("clear_layer_data:start");
89-
90-
let result = stacked::clear_cache_dir(cache_dir);
91-
92-
info!("clear_layer_data:finish");
93-
94-
result
95-
}
96-
97-
// TODO vmx 2023-09-26: The `Tree` generic is not needed, it's only there in order to not breaking
98-
// the public API. Once we break the API, remove that generic.
99-
// Ensure that any persisted vanilla proofs generated from synthetic porep are discarded.
100-
pub fn clear_synthetic_proofs<Tree>(cache_dir: &Path) -> Result<()> {
64+
pub fn clear_synthetic_proofs(cache_dir: &Path) -> Result<()> {
10165
info!("clear_synthetic_proofs:start");
10266

10367
let result = stacked::clear_synthetic_proofs(cache_dir);

0 commit comments

Comments
 (0)