Skip to main content

DccService

Struct DccService 

Source
pub struct DccService { /* private fields */ }
Expand description

The Dynamic Context Core service.

Manages the cold-path analysis loop, GORNA arbitration, and agent coordination.

Implementations§

Source§

impl DccService

Source

pub fn new(config: DccConfig) -> (Self, Receiver<TelemetryEvent>)

Creates a new DCC service.

Source

pub fn set_adaptation_mode(&self, agent_id: AgentId, mode: AdaptationMode)

Sets the [AdaptationMode] for an agent — the developer-control surface over the adaptive core. Thread-safe; takes effect on the next arbitration tick. Manual(strategy) pins an agent, Stable blocks opportunistic upgrades, Bounded clamps the range, Learning (default) negotiates freely.

Source

pub fn adaptation_mode(&self, agent_id: AgentId) -> AdaptationMode

Returns the [AdaptationMode] configured for an agent (default Learning).

Source

pub fn set_hint(&self, hint: EngineHint)

Applies a developer [EngineHint] biasing GORNA arbitration — the same control axis as set_adaptation_mode. Cap bounds an agent’s per-frame time budget; Prioritize biases its negotiation weight. Thread-safe; takes effect on the next arbitration tick. Hints persist and accumulate per agent (latest value wins per kind) until cleared with clear_agent_hints. Advisory only: a Manual pin and the death-spiral safety stop still win.

Source

pub fn clear_agent_hints(&self, agent_id: AgentId)

Clears all developer hints for an agent, restoring engine defaults. Thread-safe; takes effect on the next arbitration tick.

Source

pub fn hints(&self) -> HashMap<AgentId, AgentHints>

Read-only snapshot of the accumulated per-agent hints (glass-box; safe any time), e.g. for the editor’s Control-Plane panel.

Source

pub fn layout_recommendations(&self) -> HashMap<String, LayoutRecommendation>

Read-only snapshot of the per-component layout recommendations the DCC’s advisor has derived from access telemetry — for the glass-box surface (e.g. the editor’s Control-Plane panel). Advisory only: the DCC observes the Data layer and recommends, it never repacks.

Source

pub fn start_decision_recording(&self)

Starts recording GORNA’s per-tick decisions into a fresh trace. The recording can be replayed later for bit-for-bit reproduction (QA, network lockstep, bug repro). Thread-safe; takes effect next tick.

Source

pub fn stop_decision_recording(&self) -> DecisionTrace

Stops recording and returns the captured [DecisionTrace].

Source

pub fn recorded_decisions(&self) -> DecisionTrace

A snapshot of the decisions recorded so far (glass-box; safe any time).

Source

pub fn replay_decisions(&self, trace: DecisionTrace)

Begins replaying trace: each subsequent arbitration tick issues the recorded strategies in order (bypassing live fit + AdaptationMode) until the trace is exhausted, then normal arbitration resumes.

Source

pub fn stop_replay(&self)

Stops any in-progress replay, returning to live arbitration.

Source

pub fn is_replaying(&self) -> bool

Whether a replay is currently in progress (trace not yet exhausted).

Source

pub fn connect_budget_channel(&mut self, channel: BudgetChannel)

Connects the DCC to the Scheduler’s budget channel. After GORNA arbitration, budgets are sent through this channel.

Source

pub fn register_agent(&self, agent: Arc<Mutex<dyn Agent>>, priority: f32)

Registers an agent with a priority value.

Higher priority values mean the agent is updated first in each frame. The agent is active in all engine modes.

Source

pub fn register_agent_for_mode( &self, agent: Arc<Mutex<dyn Agent>>, priority: f32, modes: Vec<EngineMode>, )

Registers an agent with a priority value, active only in the specified modes.

Higher priority values mean the agent is updated first in each frame. If modes is empty, the agent is active in all modes.

Source

pub fn start(&mut self, event_rx: Receiver<TelemetryEvent>)

Starts the DCC background thread.

Source

pub fn stop(&mut self)

Stops the DCC background thread.

Source

pub fn agent_registry(&self) -> &Arc<Mutex<AgentRegistry>>

Returns the agent registry for use by the Scheduler.

Source

pub fn event_sender(&self) -> Sender<TelemetryEvent>

Returns a sender handle to submit events to the DCC.

Source

pub fn get_context(&self) -> Context

Returns the current context.

Source

pub fn context_handle(&self) -> Arc<RwLock<Context>>

Returns a shared handle to the live context.

Used by observers (e.g. the editor’s Control Plane workspace) that want to read up-to-date hardware state, mode, and budget multiplier each frame without going through get_context()’s clone.

Source

pub fn initialize_agents(&self, context: &mut EngineContext<'_>)

Initializes all registered agents once after registration.

Should be called once after all agents are registered, giving them access to engine services for caching and lane setup.

Source

pub fn execute_agents(&self, context: &mut EngineContext<'_>)

Executes all registered agents in priority order.

Called each frame. Each agent selects the appropriate lanes and dispatches their execution.

Source

pub fn agent_count(&self) -> usize

Returns the number of registered agents.

Source

pub fn get_agent(&self, id: AgentId) -> Option<Arc<Mutex<dyn Agent>>>

Returns a reference to the agent with the given ID, if registered.

Trait Implementations§

Source§

impl Drop for DccService

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<T> AppLifecycle for T
where T: ?Sized,

§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.
§

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a reference to the inner value as &dyn Any.
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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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