Skip to main content

resolve_index_blob_warn_threshold

Function resolve_index_blob_warn_threshold 

Source
pub fn resolve_index_blob_warn_threshold(
    health: Option<&RepositoryHealthSpec>,
) -> i64
Expand 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:

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);