Skip to main content

CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn adapter_name(&self) -> &str;
    fn spawn_actor<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        actor_type: &'life1 str,
        actor_name: &'life2 str,
        args: &'life3 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn tell_actor<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        actor_name: &'life1 str,
        message_type: &'life2 str,
        payload: &'life3 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn ask_actor<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        actor_name: &'life1 str,
        message_type: &'life2 str,
        payload: &'life3 [u8],
        timeout_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn stop_actor<'life0, 'life1, 'async_trait>(
        &'life0 self,
        actor_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn watch_actor<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        watcher_name: &'life1 str,
        target_name: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn actor_count(&self) -> u32 { ... }
}
Expand description

Handler for actor management commands dispatched by the test node gRPC server.

Each method maps to an RPC in the TestNodeService proto definition. Implementations should be thread-safe and maintain their own actor registry.

Required Methods§

Source

fn adapter_name(&self) -> &str

Human-readable adapter name (e.g. “ractor”, “kameo”, “coerce”).

Source

fn spawn_actor<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, actor_type: &'life1 str, actor_name: &'life2 str, args: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Spawn an actor of the given type with the given name. Returns the actor ID on success.

Source

fn tell_actor<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, actor_name: &'life1 str, message_type: &'life2 str, payload: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Fire-and-forget message to an actor.

Source

fn ask_actor<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, actor_name: &'life1 str, message_type: &'life2 str, payload: &'life3 [u8], timeout_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Request-reply message to an actor. Returns the serialized reply. If timeout_ms > 0, the ask should be cancelled after that many milliseconds.

Source

fn stop_actor<'life0, 'life1, 'async_trait>( &'life0 self, actor_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop an actor by name.

Provided Methods§

Source

fn watch_actor<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, watcher_name: &'life1 str, target_name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Register a watch: when target_name stops, notify watcher_name.

Source

fn actor_count(&self) -> u32

Return the number of live actors managed by this handler.

Implementors§