pub fn resolve_index_blob_warn_threshold(
health: Option<&RepositoryHealthSpec>,
) -> i64Expand description
Resolve the effective index-blob warning threshold from an optional
spec.health. Pure, so it’s shared by the admission webhook, the controller,
and tests without forking the default/disable semantics:
- absent spec or unset field ⇒
DEFAULT_INDEX_BLOB_WARN_THRESHOLD, Some(0)⇒0(the sentinel that disables the warning),Some(n)⇒n.
use kopiur_api::repository::{resolve_index_blob_warn_threshold, RepositoryHealthSpec};
use kopiur_api::consts::DEFAULT_INDEX_BLOB_WARN_THRESHOLD;
assert_eq!(resolve_index_blob_warn_threshold(None), DEFAULT_INDEX_BLOB_WARN_THRESHOLD);
let h = RepositoryHealthSpec { index_blob_warn_threshold: Some(0), ..Default::default() };
assert_eq!(resolve_index_blob_warn_threshold(Some(&h)), 0); // disabled
let h = RepositoryHealthSpec { index_blob_warn_threshold: Some(250), ..Default::default() };
assert_eq!(resolve_index_blob_warn_threshold(Some(&h)), 250);