Skip to content

Commit 4d1b95c

Browse files
committed
add cli arg + env var for time range of hot tier
1 parent b05afb1 commit 4d1b95c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

server/src/cli.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ pub struct Cli {
5151
/// Size for local cache
5252
pub local_cache_size: u64,
5353

54+
/// Size for local cache
55+
pub local_cache_time_range: i64,
56+
5457
/// Username for the basic authentication on the server
5558
pub username: String,
5659

@@ -108,6 +111,7 @@ impl Cli {
108111
pub const DOMAIN_URI: &'static str = "origin";
109112
pub const STAGING: &'static str = "local-staging-path";
110113
pub const CACHE: &'static str = "cache-path";
114+
pub const CACHE_TIME_RANGE: &'static str = "cache-time-range";
111115
pub const QUERY_CACHE: &'static str = "query-cache-path";
112116
pub const QUERY_CACHE_SIZE: &'static str = "query-cache-size";
113117
pub const CACHE_SIZE: &'static str = "cache-size";
@@ -198,7 +202,16 @@ impl Cli {
198202
.help("Maximum allowed cache size for all streams combined (In human readable format, e.g 1GiB, 2GiB)")
199203
.next_line_help(true),
200204
)
201-
205+
.arg(
206+
Arg::new(Self::CACHE_TIME_RANGE)
207+
.long(Self::CACHE_TIME_RANGE)
208+
.env("P_CACHE_TIME_RANGE")
209+
.value_name("days")
210+
.default_value("10")
211+
.value_parser(value_parser!(i64))
212+
.help("Maximum allowed time in days for all streams combined (In human readable format, e.g 1, 2)")
213+
.next_line_help(true),
214+
)
202215
.arg(
203216
Arg::new(Self::QUERY_CACHE)
204217
.long(Self::QUERY_CACHE)
@@ -404,6 +417,11 @@ impl FromArgMatches for Cli {
404417
self.tls_key_path = m.get_one::<PathBuf>(Self::TLS_KEY).cloned();
405418
self.domain_address = m.get_one::<Url>(Self::DOMAIN_URI).cloned();
406419

420+
self.local_cache_time_range = m
421+
.get_one::<i64>(Self::CACHE_TIME_RANGE)
422+
.cloned()
423+
.expect("default value for cache time range");
424+
407425
self.address = m
408426
.get_one::<String>(Self::ADDRESS)
409427
.cloned()

0 commit comments

Comments
 (0)