pub struct RoutingPolicy {
pub truth_preferences: HashMap<String, String>,
pub risk_tier_backends: HashMap<RiskTier, Vec<String>>,
pub data_classification_backends: HashMap<DataClassification, Vec<String>>,
pub default_backend: String,
}Expand description
Policy for routing requests to backends.
Routing should be policy-based, not ad-hoc. This type encodes the rules for selecting backends based on:
- Truth preferences (which truths prefer which backends)
- Risk tier (critical/high-risk operations may require local)
- Data classification (sensitive data may require local)
§Axiom: Explicit Authority
Backend selection is never implicit. Policies must explicitly allow remote backends, and default-deny is the recommended stance.
Fields§
§truth_preferences: HashMap<String, String>Truth target → preferred backend
risk_tier_backends: HashMap<RiskTier, Vec<String>>Risk tier → allowed backends
data_classification_backends: HashMap<DataClassification, Vec<String>>Data classification → allowed backends
default_backend: StringDefault backend if no rule matches
Implementations§
Source§impl RoutingPolicy
impl RoutingPolicy
Sourcepub fn default_deny_remote() -> Self
pub fn default_deny_remote() -> Self
Create a policy that denies remote backends by default.
Remote backends must be explicitly allowed via risk tier or data classification. This is the recommended default for security-conscious deployments.
Sourcepub fn is_backend_allowed(
&self,
backend_name: &str,
risk_tier: RiskTier,
data_classification: DataClassification,
) -> bool
pub fn is_backend_allowed( &self, backend_name: &str, risk_tier: RiskTier, data_classification: DataClassification, ) -> bool
Check if a backend is allowed for the given context.
Sourcepub fn select_backend(
&self,
truth_ids: &[String],
risk_tier: RiskTier,
data_classification: DataClassification,
) -> &str
pub fn select_backend( &self, truth_ids: &[String], risk_tier: RiskTier, data_classification: DataClassification, ) -> &str
Select a backend for the given request context.
Trait Implementations§
Source§impl Clone for RoutingPolicy
impl Clone for RoutingPolicy
Source§fn clone(&self) -> RoutingPolicy
fn clone(&self) -> RoutingPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RoutingPolicy
impl Debug for RoutingPolicy
Source§impl Default for RoutingPolicy
impl Default for RoutingPolicy
Source§impl<'de> Deserialize<'de> for RoutingPolicy
impl<'de> Deserialize<'de> for RoutingPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RoutingPolicy
impl RefUnwindSafe for RoutingPolicy
impl Send for RoutingPolicy
impl Sync for RoutingPolicy
impl Unpin for RoutingPolicy
impl UnwindSafe for RoutingPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more