2026-11-02 08:19:04 +00:00
|
|
|
//! Value contracts for the single-worker actor prototype.
|
|
|
|
|
|
2026-11-02 09:08:49 +00:00
|
|
|
use runa_core::ImplementationId;
|
|
|
|
|
|
2026-11-02 08:19:04 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
|
pub struct ActorId(pub u64);
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
|
pub struct MailboxId(pub u64);
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
|
|
|
pub struct Message {
|
|
|
|
|
pub kind: i64,
|
|
|
|
|
pub value: i64,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
|
|
|
pub enum Status {
|
|
|
|
|
Idle,
|
|
|
|
|
Running,
|
|
|
|
|
Awaiting,
|
2026-11-02 11:35:29 +00:00
|
|
|
Paused,
|
2026-11-02 08:19:04 +00:00
|
|
|
Stopped,
|
|
|
|
|
Failed(String),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub struct ActorSnapshot {
|
|
|
|
|
pub id: ActorId,
|
|
|
|
|
pub mailbox: MailboxId,
|
|
|
|
|
pub implementation: ImplementationId,
|
|
|
|
|
pub incarnation: u64,
|
|
|
|
|
pub state: i64,
|
|
|
|
|
pub status: Status,
|
|
|
|
|
pub queued: Vec<Message>,
|
|
|
|
|
pub reserved: Option<Message>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub enum Event {
|
|
|
|
|
Spawned(ActorId),
|
|
|
|
|
Committed(ActorId),
|
|
|
|
|
Failed(ActorId, String),
|
|
|
|
|
Stopped(ActorId),
|
|
|
|
|
Restarted(ActorId),
|
2026-11-02 11:35:29 +00:00
|
|
|
Paused(ActorId),
|
|
|
|
|
Resumed(ActorId),
|
2026-11-02 09:18:07 +00:00
|
|
|
BehaviorInstalled(ActorId, ImplementationId),
|
2026-11-02 08:19:04 +00:00
|
|
|
}
|