Skip to main content

InnerState

Struct InnerState 

Source
pub struct InnerState {
Show 22 fields pub data_dir: PathBuf, pub db_path: PathBuf, pub unsafe_mode: bool, pub async_database: Arc<AsyncDatabase>, pub logs_dir: PathBuf, pub config_runtime: ArcSwap<ConfigRuntimeSnapshot>, pub running: Mutex<HashMap<String, RunningTask>>, pub agent_health: RwLock<HashMap<String, AgentHealthState>>, pub agent_metrics: RwLock<HashMap<String, AgentMetrics>>, pub agent_lifecycle: RwLock<HashMap<String, AgentRuntimeState>>, pub event_sink: RwLock<Arc<dyn EventSink>>, pub db_writer: Arc<DbWriteCoordinator>, pub session_store: Arc<AsyncSessionStore>, pub task_repo: Arc<AsyncSqliteTaskRepository>, pub store_manager: StoreManager, pub plugin_policy: PluginPolicy, pub daemon_runtime: DaemonRuntimeState, pub worker_notify: Arc<Notify>, pub trigger_event_tx: Sender<TriggerEventPayload>, pub trigger_engine_handle: Mutex<Option<TriggerEngineHandle>>, pub fs_watcher_reload_tx: Mutex<Option<Sender<()>>>, pub task_enqueuer: Arc<dyn TaskEnqueuer>,
}
Expand description

Shared daemon state referenced by services and scheduler code.

Fields§

§data_dir: PathBuf

Runtime data directory (~/.orchestratord by default).

§db_path: PathBuf

SQLite database path.

§unsafe_mode: bool

Whether unsafe mode is enabled.

§async_database: Arc<AsyncDatabase>

Async database handle.

§logs_dir: PathBuf

Directory containing task and command logs.

§config_runtime: ArcSwap<ConfigRuntimeSnapshot>

Atomically swappable configuration snapshot.

§running: Mutex<HashMap<String, RunningTask>>

Currently running tasks keyed by task ID.

§agent_health: RwLock<HashMap<String, AgentHealthState>>

Runtime agent-health map.

§agent_metrics: RwLock<HashMap<String, AgentMetrics>>

Runtime agent metrics map.

§agent_lifecycle: RwLock<HashMap<String, AgentRuntimeState>>

Runtime agent lifecycle map.

§event_sink: RwLock<Arc<dyn EventSink>>

Event sink used by synchronous and asynchronous execution paths.

§db_writer: Arc<DbWriteCoordinator>

Serialized database write coordinator.

§session_store: Arc<AsyncSessionStore>

Interactive session store.

§task_repo: Arc<AsyncSqliteTaskRepository>

Async task repository wrapper.

§store_manager: StoreManager

Workflow store manager.

§plugin_policy: PluginPolicy

Plugin security policy (loaded from {data_dir}/plugin-policy.yaml).

§daemon_runtime: DaemonRuntimeState

Runtime daemon lifecycle state.

§worker_notify: Arc<Notify>

In-process wakeup channel for idle workers.

§trigger_event_tx: Sender<TriggerEventPayload>

Broadcast channel for trigger-relevant task events (task_completed / task_failed).

§trigger_engine_handle: Mutex<Option<TriggerEngineHandle>>

Handle for notifying the trigger engine of config changes.

§fs_watcher_reload_tx: Mutex<Option<Sender<()>>>

Handle for notifying the filesystem watcher of config changes. Set by the daemon; None in CLI-only contexts.

§task_enqueuer: Arc<dyn TaskEnqueuer>

Scheduler port for cross-crate task enqueue dispatch.

Wired with the real scheduler implementation by the daemon; defaults to NoopTaskEnqueuer in tests and CLI-only contexts.

Implementations§

Source§

impl InnerState

Source

pub fn emit_event( &self, task_id: &str, task_item_id: Option<&str>, event_type: &str, payload: Value, )

Emits an event through the currently configured event sink.

When the event is task_completed or task_failed, it is also broadcast on trigger_event_tx so the trigger engine can evaluate event triggers.

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> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
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, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

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

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

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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 = 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.
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