Skip to main content

LiveConfigAuthority

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

Source

pub fn new(config: Config) -> Self

Create the authority for one daemon generation. The initial config is the first publication of a fresh epoch.

Source

pub fn new_owned(config: Config) -> Result<Self>

Create an authority that exclusively owns this config across processes.

Source

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.

Source

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.

Source

pub fn snapshot_config(&self) -> Config

Clone the currently published config.

Source

pub fn published_revision(&self) -> ConfigRevision

The currently published revision.

Source

pub fn application_status(&self) -> ConfigApplicationStatus

Application facts for the daemon, without exposing RPC sessions.

Source

pub fn config_epoch(&self) -> ConfigEpoch

The epoch of this authority’s publication domain. Cloned authorities share it; a full replacement authority does not.

Source

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.

Source

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.

Source

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.

Source

pub fn agent_lifecycle(&self) -> AgentLifecycleCoordinator

Return the alias-scoped lifecycle authority shared by this daemon run.

Source

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.

Source

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.

Source

pub async fn drain_agent_lifecycle(&self)

Drain a closed generation and release its process ownership.

Source

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.

Source

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

Source§

fn clone(&self) -> LiveConfigAuthority

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · §

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more