Skip to main content

ActorSystemCmd

Enum ActorSystemCmd 

Source
pub enum ActorSystemCmd {
    Register {
        actor_type: String,
        address: String,
        mailbox: Arc<dyn Mailbox>,
        restart_tx: Sender<()>,
        kill_tx: Sender<()>,
        life_cycle: LifeCycle,
        result_tx: Sender<Result<(), ActorError>>,
        is_restarted: bool,
    },
    Restart {
        address_regex: String,
    },
    Unregister {
        address_regex: String,
    },
    FilterAddress {
        address_regex: String,
        result_tx: Sender<Vec<String>>,
    },
    FindActor {
        actor_type: String,
        address: String,
        result_tx: Sender<Option<(Arc<dyn Mailbox>, bool)>>,
    },
    SetLifeCycle {
        address: String,
        life_cycle: LifeCycle,
    },
    RegisterJob {
        job_id: String,
        controller: JobController,
    },
    FindJob {
        job_id: String,
        result_tx: Sender<Option<JobController>>,
    },
}
Expand description

Wire protocol between ActorSystem and the single actor_system_loop task that owns the registry. Most users never construct these directly — the public ActorSystem methods (send, register, restart, run_job, etc.) wrap each variant.

Exposed (and reachable via ActorSystem::handler_tx) so advanced callers can drive the loop manually — e.g. to issue several FindActor lookups without going through the cache.

Variants§

§

Register

Insert a fresh actor into the registry. is_restarted = true permits replacing an existing entry (used by the restart cycle); false rejects duplicates with AddressAlreadyExist.

Fields

§actor_type: String
§address: String
§mailbox: Arc<dyn Mailbox>
§restart_tx: Sender<()>
§kill_tx: Sender<()>
§life_cycle: LifeCycle
§is_restarted: bool
§

Restart

Trigger the restart cycle for every actor whose name matches the regex. Backs ActorSystem::restart.

Fields

§address_regex: String
§

Unregister

Tear down every actor whose name matches the regex. Backs ActorSystem::unregister.

Fields

§address_regex: String
§

FilterAddress

Snapshot of address names matching the regex. Backs filter_address and the local side of send_broadcast.

Fields

§address_regex: String
§result_tx: Sender<Vec<String>>
§

FindActor

Look up a specific actor by (actor_type, address). Returns the mailbox plus a ready flag (false while the actor is in Starting/Restarting). Backs the send-family methods’ post-cache lookups.

Fields

§actor_type: String
§address: String
§result_tx: Sender<Option<(Arc<dyn Mailbox>, bool)>>
§

SetLifeCycle

Update an actor’s LifeCycle. Pushed by the actor’s own run_actor loop at each transition.

Fields

§address: String
§life_cycle: LifeCycle
§

RegisterJob

Register a job’s JobController under job_id. Pushed by run_job after spawning the job loop, so abort_job / stop_job / resume_job can later look it up.

Fields

§job_id: String
§controller: JobController
§

FindJob

Look up a JobController by id. Backs abort_job / stop_job / resume_job.

Fields

§job_id: String

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

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