Skip to main content

InstanceRuntimeConfig

Struct InstanceRuntimeConfig 

Source
pub struct InstanceRuntimeConfig {
    pub snapshots: SnapshotManagerConfig,
    pub leases: AccountLeaseConfig,
    pub usage: UsageWriterConfig,
    pub sharding: LocalSharding,
    pub snapshot_history_capacity: NonZeroUsize,
    pub idle_account_linger: Duration,
    pub manager_restart_backoff: Duration,
    pub shutdown_deadline: Duration,
}
Expand description

Everything an InstanceRuntime needs to run one instance’s control plane: snapshot distribution, per-account lease refill, usage accounting, local sharding, account lifecycle timing and the shutdown budget.

There are no defaults; every value is a deployment decision. validate runs before any task starts (INVARIANTS.md 16), and docs/GETTING_STARTED.md walks through a worked configuration.

Fields§

§snapshots: SnapshotManagerConfig

Snapshot distribution: which principals to serve, and how often and how patiently to fetch them. Validated by SnapshotManagerConfig::validate; a TrackedPrincipals::Fixed list must also fit snapshot_history_capacity.

§leases: AccountLeaseConfig

Lease refill settings applied to every account the runtime discovers. Validated by AccountLeaseConfig::validate. Its shutdown_release_deadline is one of the two phases shutdown_deadline must cover.

§usage: UsageWriterConfig

The bounded usage queue and its writer. Validated by UsageWriterConfig::validate. Its shutdown_drain_deadline is the other phase shutdown_deadline must cover.

§sharding: LocalSharding

Instance-local shard layout for the snapshot map and every account’s lease slot. LocalSharding::SINGLE is the unsharded layout; more shards trade per-account memory for less cache-line sharing between request-serving threads, and help only while those threads do not outnumber the shards (RuntimeReport::sharding reports whether they do). See docs/LOCAL_SHARDING.md.

§snapshot_history_capacity: NonZeroUsize

Retained snapshot histories, including in-flight authoritative reads. Cover the simultaneously served principal set; exceeding it evicts principals until a fresh source read can reconstruct their history.

Counted in principals. Too small evicts live principals, which deny until the next authoritative read restores them and show up in SnapshotStats::history_evictions; larger costs memory per retained history. Must be at least the length of a TrackedPrincipals::Fixed list.

§idle_account_linger: Duration

Time with no fresh active principal before returning routine grants. Zero requests immediate retirement; this is not a traffic-idle timer.

An account becomes ineligible when its last active, unexpired snapshot is removed, revoked, suspended or expires; its lease manager then lingers for this long and is retired (releasing its lease) unless a fresh active principal returns first. Too short churns lease acquire and release when an account’s snapshots briefly lapse; too long holds granted units on an instance that can no longer spend them. Must fit the monotonic clock.

§manager_restart_backoff: Duration

Delay before restarting an account’s lease manager that exited while the account was still eligible. The account is in AccountPhase::Backoff meanwhile, with no manager refilling its slot.

Too short retries a failing allocator or a crashing task in a tight loop; too long leaves the account’s slot unrefilled, and readiness counts it unmanaged, for the whole delay. An integrity fault is never restarted: it shuts the runtime down instead (INVARIANTS.md 31). Must be positive.

§shutdown_deadline: Duration

One budget, measured from the first shutdown request.

Covers the usage drain, the snapshot manager’s stop and every account’s lease release; a background failure that triggers shutdown starts it too. Must be at least usage.shutdown_drain_deadline + leases.shutdown_release_deadline. Too short leaves usage unresolved and leases abandoned to TTL reclaim (INVARIANTS.md 9), reported in RuntimeShutdownReport; the value is also how long an orchestrator must allow the process to stop.

Implementations§

Source§

impl InstanceRuntimeConfig

Source

pub fn validate(&self) -> Result<(), InstanceRuntimeConfigError>

Check the whole configuration without starting anything: each component’s own validate, a fixed principal list within snapshot_history_capacity, a shutdown_deadline that covers the usage drain plus lease release, a positive manager_restart_backoff, and every duration representable on the monotonic clock. InstanceRuntime::spawn calls this first.

§Errors

The first rule the configuration breaks.

Trait Implementations§

Source§

impl Clone for InstanceRuntimeConfig

Source§

fn clone(&self) -> Self

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for InstanceRuntimeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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
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
Source§

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

Source§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

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

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