Skip to main content

actionqueue_executor_local/
identity.rs

1//! Executor identity abstraction for lease ownership.
2//!
3//! [`ExecutorIdentity`] abstracts "who is executing this run" beyond the
4//! hardcoded `"runtime"` string used in lease acquire and heartbeat commands.
5//!
6//! In v0.x, only [`LocalExecutorIdentity`] is used. In v1.0 (Sprint 4),
7//! remote actors will provide their own identity via this trait, allowing
8//! the dispatch loop to issue leases on their behalf without code changes.
9
10/// Identity of the executor acquiring and heartbeating leases.
11///
12/// Implemented by the dispatch loop's configured executor. In the local
13/// case, this always returns `"runtime"`. Remote actors in Sprint 4 will
14/// provide their registered actor identity string instead.
15pub trait ExecutorIdentity: Send + Sync {
16    /// Returns the identity string used as the lease owner.
17    fn identity(&self) -> &str;
18}
19
20/// The local executor identity — used when ActionQueue runs all work in-process.
21///
22/// Returns `"runtime"` as the lease owner, matching the previous hardcoded value.
23#[derive(Debug, Clone, Default)]
24pub struct LocalExecutorIdentity;
25
26impl ExecutorIdentity for LocalExecutorIdentity {
27    fn identity(&self) -> &str {
28        "runtime"
29    }
30}