Skip to main content

DurableAdaptiveSession

Struct DurableAdaptiveSession 

Source
pub struct DurableAdaptiveSession { /* private fields */ }
Available on crate feature std only.
Expand description

Durable Phase 1 Adaptive Kernel Protocol v1 session backed by a StateStore.

Phase 1 enforces Keep / Shadow only execution: no active parameter mutations are permitted, every transition persists through StateStore before committing in-memory state (fail-closed on storage errors), and legacy schema v6 snapshots migrate to v7 without gaining active rights.

Implementations§

Source§

impl DurableAdaptiveSession

Source

pub fn open_keep( store: Box<dyn StateStore>, baseline_policy: PolicySnapshot, ) -> Result<Self>

Opens a durable Keep-only adaptive session backed by store.

Source

pub fn open_shadow( store: Box<dyn StateStore>, config: AdaptiveConfig, baseline_policy: PolicySnapshot, ) -> Result<Self>

Opens a durable Shadow-mode adaptive session backed by store.

Even if config.mode requests AdaptiveMode::Active, Phase 1 clamps the session to AdaptiveMode::Shadow so no executable parameter mutation occurs.

Source

pub fn open_active( store: Box<dyn StateStore>, config: AdaptiveConfig, baseline_policy: PolicySnapshot, ) -> Result<Self>

Opens a durable Active-mode adaptive session with explicit opt-in.

Legacy snapshots (schema < 7) still fail closed with active_permission_granted == false and emit only Keep until migrated.

Source

pub fn machine(&self) -> &AdaptiveStateMachine

Returns a read-only view of the underlying protocol state machine.

Source

pub fn schema_version(&self) -> u32

Returns the loaded/migrated KernelSnapshot schema version.

Source

pub fn propose( &mut self, req: ProposalRequest, ) -> Result<ProposalResponse, AdaptiveSessionError>

Evaluates and durably persists a propose request (fail-closed on storage error).

Source

pub fn acknowledge_applied( &mut self, receipt: ExecutionReceipt, ) -> Result<PolicySnapshot, AdaptiveSessionError>

Evaluates and durably persists an acknowledge_applied receipt.

Source

pub fn feedback( &mut self, req: FeedbackRequest, ) -> Result<FeedbackReceipt, AdaptiveSessionError>

Evaluates and durably persists an external feedback request.

Source

pub fn record_expired_tombstone( &mut self, request_id: impl Into<String>, ) -> Result<(), AdaptiveSessionError>

Durably records an expired request tombstone so it can never re-execute across restarts.

Source

pub fn confirmed_params(&self) -> &BTreeMap<String, f64>

Returns the currently confirmed parameter map (unchanged in Keep/Shadow modes).

Source

pub fn confirmed_policy(&self) -> &PolicySnapshot

Returns the currently confirmed PolicySnapshot.

Source

pub fn active_permission_granted(&self) -> bool

Returns whether active adaptation permission is granted for this session.

Source

pub fn recommend_recovery( &self, recovery_params: BTreeMap<String, f64>, ) -> Result<RecoveryRecommendation, AdaptiveSessionError>

Produces a bounded recovery recommendation under a strictly newer version.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DurableAdaptiveSession

§

impl !UnwindSafe for DurableAdaptiveSession

§

impl Forget for DurableAdaptiveSession

§

impl Freeze for DurableAdaptiveSession
where *const dyn StateStore is !null: Freeze, PhantomData<dyn StateStore>: Freeze, *const LeafNode<String, f64> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, f64)>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const LeafNode<String, TrackedProposal> is !null: Freeze, PhantomData<Box<(String, TrackedProposal)>>: Freeze, *const LeafNode<String, StoredRequest> is !null: Freeze, PhantomData<Box<(String, StoredRequest)>>: Freeze, *const LeafNode<String, StoredFeedback> is !null: Freeze, PhantomData<Box<(String, StoredFeedback)>>: Freeze, *const LeafNode<String, SetValZST> is !null: Freeze, PhantomData<Box<(String, SetValZST)>>: Freeze, PhantomData<Case>: Freeze, *const LeafNode<String, Strategy> is !null: Freeze, PhantomData<Box<(String, Strategy)>>: Freeze, *const LeafNode<String, String> is !null: Freeze, PhantomData<Box<(String, String)>>: Freeze, PhantomData<(CognitivePatch, String)>: Freeze, PhantomData<MetaMetrics>: Freeze, PhantomData<MetaCacheEntry>: Freeze, PhantomData<f64>: Freeze, *const LeafNode<String, PersistedProposalRecord> is !null: Freeze, PhantomData<Box<(String, PersistedProposalRecord)>>: Freeze, *const LeafNode<String, PersistedRequestRecord> is !null: Freeze, PhantomData<Box<(String, PersistedRequestRecord)>>: Freeze, *const LeafNode<String, PersistedFeedbackRecord> is !null: Freeze, PhantomData<Box<(String, PersistedFeedbackRecord)>>: Freeze,

§

impl Move for DurableAdaptiveSession

§

impl Send for DurableAdaptiveSession
where BoxRaw<dyn StateStore>: Send, NodeRef<Owned, String, f64, LeafOrInternal>: Send, BoxRaw<(String, f64)>: Send, RawVecInner: Send, NodeRef<Owned, String, TrackedProposal, LeafOrInternal>: Send, BoxRaw<(String, TrackedProposal)>: Send, NodeRef<Owned, String, StoredRequest, LeafOrInternal>: Send, BoxRaw<(String, StoredRequest)>: Send, NodeRef<Owned, String, StoredFeedback, LeafOrInternal>: Send, BoxRaw<(String, StoredFeedback)>: Send, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Send, BoxRaw<(String, SetValZST)>: Send, NonZero<i32>: Send, Utc: Send, NodeRef<Owned, String, Strategy, LeafOrInternal>: Send, BoxRaw<(String, Strategy)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, PersistedProposalRecord, LeafOrInternal>: Send, BoxRaw<(String, PersistedProposalRecord)>: Send, NodeRef<Owned, String, PersistedRequestRecord, LeafOrInternal>: Send, BoxRaw<(String, PersistedRequestRecord)>: Send, NodeRef<Owned, String, PersistedFeedbackRecord, LeafOrInternal>: Send, BoxRaw<(String, PersistedFeedbackRecord)>: Send,

§

impl Sync for DurableAdaptiveSession
where BoxRaw<dyn StateStore>: Sync, NodeRef<Owned, String, f64, LeafOrInternal>: Sync, BoxRaw<(String, f64)>: Sync, RawVecInner: Sync, NodeRef<Owned, String, TrackedProposal, LeafOrInternal>: Sync, BoxRaw<(String, TrackedProposal)>: Sync, NodeRef<Owned, String, StoredRequest, LeafOrInternal>: Sync, BoxRaw<(String, StoredRequest)>: Sync, NodeRef<Owned, String, StoredFeedback, LeafOrInternal>: Sync, BoxRaw<(String, StoredFeedback)>: Sync, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Sync, BoxRaw<(String, SetValZST)>: Sync, NonZero<i32>: Sync, Utc: Sync, NodeRef<Owned, String, Strategy, LeafOrInternal>: Sync, BoxRaw<(String, Strategy)>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, PersistedProposalRecord, LeafOrInternal>: Sync, BoxRaw<(String, PersistedProposalRecord)>: Sync, NodeRef<Owned, String, PersistedRequestRecord, LeafOrInternal>: Sync, BoxRaw<(String, PersistedRequestRecord)>: Sync, NodeRef<Owned, String, PersistedFeedbackRecord, LeafOrInternal>: Sync, BoxRaw<(String, PersistedFeedbackRecord)>: Sync,

§

impl Unpin for DurableAdaptiveSession
where Box<dyn StateStore>: Unpin, *const LeafNode<String, f64> is !null: Unpin, Box<(String, f64)>: Unpin, *const u8 is !null: Unpin, *const LeafNode<String, TrackedProposal> is !null: Unpin, Box<(String, TrackedProposal)>: Unpin, *const LeafNode<String, StoredRequest> is !null: Unpin, Box<(String, StoredRequest)>: Unpin, *const LeafNode<String, StoredFeedback> is !null: Unpin, Box<(String, StoredFeedback)>: Unpin, *const LeafNode<String, SetValZST> is !null: Unpin, Box<(String, SetValZST)>: Unpin, NonZero<i32>: Unpin, Utc: Unpin, *const LeafNode<String, Strategy> is !null: Unpin, Box<(String, Strategy)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, PersistedProposalRecord> is !null: Unpin, Box<(String, PersistedProposalRecord)>: Unpin, *const LeafNode<String, PersistedRequestRecord> is !null: Unpin, Box<(String, PersistedRequestRecord)>: Unpin, *const LeafNode<String, PersistedFeedbackRecord> is !null: Unpin, Box<(String, PersistedFeedbackRecord)>: Unpin,

§

impl UnsafeUnpin for DurableAdaptiveSession
where *const dyn StateStore is !null: UnsafeUnpin, PhantomData<dyn StateStore>: UnsafeUnpin, *const LeafNode<String, f64> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, f64)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const LeafNode<String, TrackedProposal> is !null: UnsafeUnpin, PhantomData<Box<(String, TrackedProposal)>>: UnsafeUnpin, *const LeafNode<String, StoredRequest> is !null: UnsafeUnpin, PhantomData<Box<(String, StoredRequest)>>: UnsafeUnpin, *const LeafNode<String, StoredFeedback> is !null: UnsafeUnpin, PhantomData<Box<(String, StoredFeedback)>>: UnsafeUnpin, *const LeafNode<String, SetValZST> is !null: UnsafeUnpin, PhantomData<Box<(String, SetValZST)>>: UnsafeUnpin, PhantomData<Case>: UnsafeUnpin, *const LeafNode<String, Strategy> is !null: UnsafeUnpin, PhantomData<Box<(String, Strategy)>>: UnsafeUnpin, *const LeafNode<String, String> is !null: UnsafeUnpin, PhantomData<Box<(String, String)>>: UnsafeUnpin, PhantomData<(CognitivePatch, String)>: UnsafeUnpin, PhantomData<MetaMetrics>: UnsafeUnpin, PhantomData<MetaCacheEntry>: UnsafeUnpin, PhantomData<f64>: UnsafeUnpin, *const LeafNode<String, PersistedProposalRecord> is !null: UnsafeUnpin, PhantomData<Box<(String, PersistedProposalRecord)>>: UnsafeUnpin, *const LeafNode<String, PersistedRequestRecord> is !null: UnsafeUnpin, PhantomData<Box<(String, PersistedRequestRecord)>>: UnsafeUnpin, *const LeafNode<String, PersistedFeedbackRecord> is !null: UnsafeUnpin, PhantomData<Box<(String, PersistedFeedbackRecord)>>: UnsafeUnpin,

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> 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> 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, 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<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