pub fn component_glob_matches(pattern: &str, value: &str) -> boolExpand description
Anchored per-component glob match: * matches any run of characters
(including none), ? matches exactly one, everything else is literal. This
is the ONE matcher both admission (via
validate_component_glob) and the replication mover use, so what the
webhook admitted and what the mover selects cannot fork. Deliberately
dependency-free — no regex, no glob crate.
Matching is per identity component (IdentityMatcher): there is no
separator to cross, so * spanning the whole component is exactly the
intended “match anything here” semantics.
use kopiur_api::snapshot_replication::component_glob_matches;
assert!(component_glob_matches("pg-*", "pg-main"));
assert!(component_glob_matches("*", ""));
assert!(component_glob_matches("data-?", "data-1"));
assert!(!component_glob_matches("pg", "pg-main")); // anchored: whole component
assert!(!component_glob_matches("data-?", "data-12"));
assert!(component_glob_matches("*.internal", "billing.svc.internal"));