Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ pub struct Options {
)]
pub hot_tier_storage_path: Option<PathBuf>,

//TODO: remove this when smart cache is implemented
#[arg(
long = "index-storage-path",
env = "P_INDEX_DIR",
value_parser = validation::canonicalize_path,
help = "Local path on this indexer used for indexing"
)]
pub index_storage_path: Option<PathBuf>,

#[arg(
long,
env = "P_MAX_DISK_USAGE_PERCENT",
Expand Down Expand Up @@ -419,6 +428,17 @@ impl Options {
&self.local_staging_path
}

/// Path to index directory, ensures that it exists or returns the PathBuf
pub fn index_dir(&self) -> Option<&PathBuf> {
if let Some(path) = &self.index_storage_path {
fs::create_dir_all(path)
.expect("Should be able to create index directory if it doesn't exist");
Some(path)
} else {
None
}
}

/// TODO: refactor and document
pub fn get_url(&self, mode: Mode) -> Url {
let (endpoint, env_var) = match mode {
Expand Down
Loading