relay_core_runtime/services/
policy.rs1use relay_core_api::policy::{ProxyPolicy, ProxyPolicyPatch};
2use crate::audit::AuditActor;
3use crate::CoreState;
4
5pub trait PolicyService: Send + Sync {
6 fn policy_snapshot(&self) -> ProxyPolicy;
7 fn update_policy_from(&self, actor: AuditActor, target: String, policy: ProxyPolicy);
8 fn patch_policy_from(&self, actor: AuditActor, target: String, patch: ProxyPolicyPatch);
9}
10
11impl PolicyService for CoreState {
12 fn policy_snapshot(&self) -> ProxyPolicy {
13 CoreState::policy_snapshot(self)
14 }
15
16 fn update_policy_from(&self, actor: AuditActor, target: String, policy: ProxyPolicy) {
17 CoreState::update_policy_from(self, actor, target, policy)
18 }
19
20 fn patch_policy_from(&self, actor: AuditActor, target: String, patch: ProxyPolicyPatch) {
21 CoreState::patch_policy_from(self, actor, target, patch)
22 }
23}