Skip to main content

RemoteTransport

Trait RemoteTransport 

Source
pub trait RemoteTransport: Send + Sync {
    // Required methods
    fn remote_send(
        &self,
        node_addr: &str,
        agent_id: usize,
        trit: i8,
    ) -> Result<()>;
    fn remote_await(&self, node_addr: &str, agent_id: usize) -> Result<i8>;
}
Expand description

Abstracts the TCP layer so ternlang-core doesn’t depend on ternlang-runtime. Implement this trait on TernNode in ternlang-runtime, then inject via BetVm::set_remote(Arc<dyn RemoteTransport>).

Required Methods§

Source

fn remote_send(&self, node_addr: &str, agent_id: usize, trit: i8) -> Result<()>

Send a trit (-1/0/+1) to the specified remote agent’s mailbox (fire-and-forget).

Source

fn remote_await(&self, node_addr: &str, agent_id: usize) -> Result<i8>

Request the remote agent to process its mailbox and return the result trit.

Implementors§