From f830ee4bf23f863505f12495a3549b5053097fff Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Thu, 27 Mar 2025 08:44:06 -0400 Subject: [PATCH 1/3] index storage path in env --- src/cli.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index ce2103d6e..b14967bc4 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -225,6 +225,14 @@ pub struct Options { )] pub hot_tier_storage_path: Option, + #[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, + #[arg( long, env = "P_MAX_DISK_USAGE_PERCENT", From 477cc1106e5ad833952bec6021f423e620a9d197 Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Thu, 27 Mar 2025 14:12:59 -0400 Subject: [PATCH 2/3] method to create index dir --- src/cli.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index b14967bc4..1f7e6259a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -427,6 +427,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 { From 30ede1e8c077ae6d87f2fc28237ee31dbe49b6de Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Thu, 27 Mar 2025 14:16:10 -0400 Subject: [PATCH 3/3] add todo --- src/cli.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cli.rs b/src/cli.rs index 1f7e6259a..ad2db244d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -225,6 +225,7 @@ pub struct Options { )] pub hot_tier_storage_path: Option, + //TODO: remove this when smart cache is implemented #[arg( long = "index-storage-path", env = "P_INDEX_DIR",