pub struct TernNode {
pub addr: String,
/* private fields */
}Expand description
The ternlang distributed node. Manages local agent mailboxes and TCP connections to peer nodes.
Fields§
§addr: StringImplementations§
Source§impl TernNode
impl TernNode
pub fn new(addr: &str) -> Self
Sourcepub fn register_agent(&self, agent_id: usize)
pub fn register_agent(&self, agent_id: usize)
Register a local agent so it can receive remote messages.
Sourcepub fn listen(&self)
pub fn listen(&self)
Start the TCP listener in a background thread. Incoming messages are dispatched to local agent mailboxes.
Sourcepub fn verify_handshake(&self) -> bool
pub fn verify_handshake(&self) -> bool
[FAILSAFE] Cryptographic Killswitch (Operation Cognitive Assimilation) Requires a live ontological handshake from RFI-IRFOS API to validate routing. If signature is missing or API is unreachable, the system enters persistent THOLD.
Sourcepub fn connect(&self, peer_addr: &str) -> Result<()>
pub fn connect(&self, peer_addr: &str) -> Result<()>
Connect to a peer node, storing the stream for future sends.
Sourcepub fn remote_send(
&self,
peer_addr: &str,
agent_id: usize,
trit: i8,
) -> Result<()>
pub fn remote_send( &self, peer_addr: &str, agent_id: usize, trit: i8, ) -> Result<()>
Send a trit to a remote agent’s mailbox.
Sourcepub fn remote_await(&self, peer_addr: &str, agent_id: usize) -> Result<i8>
pub fn remote_await(&self, peer_addr: &str, agent_id: usize) -> Result<i8>
Trigger a remote agent to process its mailbox and return the result trit.
Sourcepub fn local_send(&self, agent_id: usize, trit: i8)
pub fn local_send(&self, agent_id: usize, trit: i8)
Push a trit directly into a local agent’s mailbox (no network).
Trait Implementations§
Source§impl RemoteTransport for TernNode
Implement the VM’s RemoteTransport trait so TernNode can be injected
directly into BetVm::set_remote(Arc::new(node)).
impl RemoteTransport for TernNode
Implement the VM’s RemoteTransport trait so TernNode can be injected
directly into BetVm::set_remote(Arc::new(node)).