Struct LiveConfigAuthority
pub struct LiveConfigAuthority { /* private fields */ }Expand description
The live configuration state shared by one supervised daemon generation.
The write lock is deliberately paired with the published-config storage
so every mutation path uses the same serialization witness as the live
state. The published pair (config plus its opaque revision) lives in
zeroclaw_config::live; this authority owns who may publish and when.
Readers receive LiveConfigHandle through Self::live_handle; the
writable storage is never exposed. Writers admit through
Self::begin_config_commit, which serializes on the writer mutex and
admits a generation write lease as one unit.
Implementations§
Source§impl LiveConfigAuthority
impl LiveConfigAuthority
Sourcepub fn new(config: Config) -> Self
pub fn new(config: Config) -> Self
Create the authority for one daemon generation. The initial config is the first publication of a fresh epoch.
Sourcepub fn new_owned(config: Config) -> Result<Self>
pub fn new_owned(config: Config) -> Result<Self>
Create an authority that exclusively owns this config across processes.
Sourcepub fn new_with_ownership(
config: Config,
ownership: ConfigOwnershipGuard,
) -> Self
pub fn new_with_ownership( config: Config, ownership: ConfigOwnershipGuard, ) -> Self
Create an authority from a guard acquired by a caller that resolved the config identity before loading the executable config. The guard is transferred into the authority and shared by every derived capability. The loaded config becomes the initial publication of a fresh epoch: a full daemon reload is a new publication domain, never a continuation of the retired generation’s sequence.
Sourcepub fn live_handle(&self) -> LiveConfigHandle
pub fn live_handle(&self) -> LiveConfigHandle
Return the read-only live-config handle shared by all consumers of this authority. The handle observes the config and its revision as one pair and exposes no write path.
Sourcepub fn snapshot_config(&self) -> Config
pub fn snapshot_config(&self) -> Config
Clone the currently published config.
Sourcepub fn published_revision(&self) -> ConfigRevision
pub fn published_revision(&self) -> ConfigRevision
The currently published revision.
Sourcepub fn application_status(&self) -> ConfigApplicationStatus
pub fn application_status(&self) -> ConfigApplicationStatus
Application facts for the daemon, without exposing RPC sessions.
Sourcepub fn config_epoch(&self) -> ConfigEpoch
pub fn config_epoch(&self) -> ConfigEpoch
The epoch of this authority’s publication domain. Cloned authorities share it; a full replacement authority does not.
Sourcepub async fn begin_config_commit(
&self,
) -> Result<ConfigCommit, ConfigCommitError>
pub async fn begin_config_commit( &self, ) -> Result<ConfigCommit, ConfigCommitError>
Admit one serialized config write: acquire the process-wide writer
mutex, then admit a generation write lease into the lifecycle
generation. The returned ConfigCommit owns both for its whole
lifetime, so a commit dispatched to a retained task keeps
serialization and stays drain-visible even when its requester
disappears.
Admission fails closed once the generation is closing. The writer mutex is acquired before the lease: a waiter parked on the mutex holds no lifecycle state, so a closing generation never drains against a waiter that will simply be refused.
Sourcepub async fn lock_config_writer(&self) -> OwnedMutexGuard<()>
pub async fn lock_config_writer(&self) -> OwnedMutexGuard<()>
Hold this authority’s config writer mutex without admitting a commit.
Readers in the route-generation transaction (session construction,
session/configure, rehydration and its reconciliation) take it so
that no commit publishes while they build from config. It admits no
write lease, so a closing generation never drains against a reader.
Sourcepub fn try_lock_config_writer(&self) -> Option<OwnedMutexGuard<()>>
pub fn try_lock_config_writer(&self) -> Option<OwnedMutexGuard<()>>
Self::lock_config_writer without waiting: None while a commit or
another reader holds the mutex.
Sourcepub fn agent_lifecycle(&self) -> AgentLifecycleCoordinator
pub fn agent_lifecycle(&self) -> AgentLifecycleCoordinator
Return the alias-scoped lifecycle authority shared by this daemon run.
Sourcepub fn execution_capability(&self) -> AgentExecutionCapability
pub fn execution_capability(&self) -> AgentExecutionCapability
Bind target execution admission to this authority’s live config and alias lifecycle coordinator. Callers keep the returned capability and pass it into the target factory or detached task; it is not a registry and does not create another config owner.
Sourcepub fn close_agent_lifecycle(&self)
pub fn close_agent_lifecycle(&self)
Close lifecycle admission for this daemon generation. New agent work and new config commits are both refused afterwards; already-admitted work runs to completion and is drained by the drain methods below.
Sourcepub async fn drain_agent_lifecycle(&self)
pub async fn drain_agent_lifecycle(&self)
Drain a closed generation and release its process ownership.
Sourcepub async fn drain_agent_lifecycle_retaining_ownership(&self)
pub async fn drain_agent_lifecycle_retaining_ownership(&self)
Drain a closed generation while RETAINING process ownership, so a
daemon reload can transfer the guard into the next generation without
an unlocked read/reacquire interval. Pair with
Self::take_process_ownership once the drain completes.
Sourcepub fn take_process_ownership(&self) -> Option<ConfigOwnershipGuard>
pub fn take_process_ownership(&self) -> Option<ConfigOwnershipGuard>
Transfer the process-ownership guard out of this authority. Returns
None when ownership was already released by a completed drain or
never acquired.
Trait Implementations§
Source§impl Clone for LiveConfigAuthority
impl Clone for LiveConfigAuthority
Source§fn clone(&self) -> LiveConfigAuthority
fn clone(&self) -> LiveConfigAuthority
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LiveConfigAuthority
impl !UnwindSafe for LiveConfigAuthority
impl Freeze for LiveConfigAuthority
impl Send for LiveConfigAuthority
impl Sync for LiveConfigAuthority
impl Unpin for LiveConfigAuthority
impl UnsafeUnpin for LiveConfigAuthority
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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