pub struct LivePolicyState { /* private fields */ }Expand description
The kernel-side live policy state: the resolved configuration plus the revision that guards mutations of it.
Two rules live here rather than at each callsite:
- Optimistic concurrency belongs to the patch, not to a policy. DEC-6 removed
SIGNAL_POLICY_VERSIONandSignalPolicyConfig.version; a signal policy has no version of its own, and the single revision counter below is what two concurrent writers race on. A patch whoseexpected_revisiondoes not match the current one is refused, so the second writer re-reads instead of silently overwriting the first. - Live resource changes only ever shrink. Growing a quota is a reservation fact — it needs an admission decision from whoever owns the budget — not a policy edit, so it has no representation here.
Implementations§
Source§impl LivePolicyState
impl LivePolicyState
Sourcepub fn new(config: ResolvedOperationConfig) -> Self
pub fn new(config: ResolvedOperationConfig) -> Self
Start from the genesis record’s resolved configuration at revision 0.
Sourcepub fn restore(revision: WireU64, config: ResolvedOperationConfig) -> Self
pub fn restore(revision: WireU64, config: ResolvedOperationConfig) -> Self
§12.2 · reinstall the live policy a checkpoint recorded, revision included.
Distinct from Self::new on purpose: new starts a fresh operation at revision 0 with
the genesis configuration, and using it for a restore would silently rewind the revision a
concurrent patch writer is racing on.
pub fn revision(&self) -> WireU64
pub fn config(&self) -> &ResolvedOperationConfig
Sourcepub fn apply(
&mut self,
command: &ApplyPolicyPatchCommand,
) -> Result<WireU64, WireRejection>
pub fn apply( &mut self, command: &ApplyPolicyPatchCommand, ) -> Result<WireU64, WireRejection>
Apply one revision-guarded patch.
Atomic in the same structural sense as configuration resolution: the next configuration is built and validated as a whole before anything is stored, so a rejected patch leaves both the configuration and the revision exactly as they were.
Trait Implementations§
Source§impl Clone for LivePolicyState
impl Clone for LivePolicyState
Source§fn clone(&self) -> LivePolicyState
fn clone(&self) -> LivePolicyState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more