-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add some README notes on available settings #1177
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
use anyhow::{bail, ensure, Context}; | ||
|
@@ -17,6 +18,7 @@ use storage_proofs_core::{ | |
use super::graph::{StackedGraph, DEGREE}; | ||
|
||
/// Path in which to store the parents caches. | ||
pub const PARENT_CACHE_ENV_VAR: &str = "FIL_PROOFS_PARENT_CACHE"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went with the existing approach taken by the PARAMETER_CACHE There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But can move them both to settings |
||
const PARENT_CACHE_DIR: &str = "/var/tmp/filecoin-parents"; | ||
|
||
/// u32 = 4 bytes | ||
|
@@ -238,6 +240,13 @@ impl ParentCache { | |
} | ||
} | ||
|
||
fn parent_cache_dir_name() -> String { | ||
match env::var(PARENT_CACHE_ENV_VAR) { | ||
Ok(dir) => dir, | ||
Err(_) => String::from(PARENT_CACHE_DIR), | ||
} | ||
} | ||
|
||
fn cache_path<H, G>(cache_entries: u32, graph: &StackedGraph<H, G>) -> PathBuf | ||
where | ||
H: Hasher, | ||
|
@@ -252,7 +261,7 @@ where | |
} | ||
hasher.input(cache_entries.to_le_bytes()); | ||
let h = hasher.result(); | ||
PathBuf::from(PARENT_CACHE_DIR).join(format!( | ||
PathBuf::from(parent_cache_dir_name()).join(format!( | ||
"v{}-sdr-parent-{}.cache", | ||
VERSION, | ||
hex::encode(h), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dignifiedquire Can you check that my sizes above are sane? I pulled those out from looking at the code, but there was a comment you made elsewhere that indicated each cached node was 56 bytes (i.e. using 112KiB RAM), so I'm looking for clarification/corrections here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying, it's been updated.