pub struct AgentResourcePolicy(/* private fields */);Expand description
Shared bounded resource policy with explicit expiring CAS refresh. Replacements affect later authorization checks, not already granted work.
Implementations§
Source§impl AgentResourcePolicy
impl AgentResourcePolicy
Sourcepub const MAX_LEASE: Duration
pub const MAX_LEASE: Duration
Maximum local freshness lease. Renew only from a revalidated trusted source.
Sourcepub fn new(
artifact: PolicyArtifact,
lease: Duration,
) -> Result<Self, PolicyError>
pub fn new( artifact: PolicyArtifact, lease: Duration, ) -> Result<Self, PolicyError>
Installs a retained artifact at generation 1 with finite freshness.
§Errors
Rejects zero/excessive lease, expired artifact or unavailable host clock.
Sourcepub fn replace(
&self,
expected_generation: u64,
artifact: PolicyArtifact,
lease: Duration,
) -> Result<u64, PolicyError>
pub fn replace( &self, expected_generation: u64, artifact: PolicyArtifact, lease: Duration, ) -> Result<u64, PolicyError>
Atomically replaces the snapshot after validating a trusted refresh. Unrelated rule changes do not alter a selected rule’s admission evidence.
§Errors
Invalid/expired input, stale generation, overflow or poisoned lock leave the previous snapshot intact. This is not cross-replica coordination.
Sourcepub fn generation(&self) -> Result<u64, PolicyError>
pub fn generation(&self) -> Result<u64, PolicyError>
Returns process-local CAS generation; neither a digest nor freshness proof.
§Errors
Rejects poisoned policy state.
Sourcepub fn check_readiness(&self) -> Result<(), PolicyError>
pub fn check_readiness(&self) -> Result<(), PolicyError>
Checks the current snapshot without granting an operation or doing I/O. An empty, fresh deny-all artifact is healthy.
§Errors
Rejects absolute/monotonic expiration, clock failure or poisoned state.
Trait Implementations§
Source§impl AgentServiceAuthorizer for AgentResourcePolicy
impl AgentServiceAuthorizer for AgentResourcePolicy
Auto Trait Implementations§
impl !Freeze for AgentResourcePolicy
impl Forget for AgentResourcePolicy
impl Move for AgentResourcePolicy
impl RefUnwindSafe for AgentResourcePolicy
impl Send for AgentResourcePolicy
impl Sync for AgentResourcePolicy
impl Unpin for AgentResourcePolicy
impl UnsafeUnpin for AgentResourcePolicy
impl UnwindSafe for AgentResourcePolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more