pub struct IicpNode { /* private fields */ }Expand description
IICP provider node — handles registration, heartbeats, and task serving.
Implementations§
Source§impl IicpNode
impl IicpNode
pub fn new(cfg: NodeConfig) -> Self
Sourcepub fn node_hmac_key(&self) -> String
pub fn node_hmac_key(&self) -> String
Current HMAC key in use for ADR-019 pricing signatures (empty if unregistered AND no operator-provisioned key).
Sourcepub fn cfg(&self) -> &NodeConfig
pub fn cfg(&self) -> &NodeConfig
Borrow this node’s configuration. Useful for callers (e.g.
crate::conformance::run_conformance_checks) that need to inspect
directory_url, endpoint, or node_id without owning the config.
Sourcepub fn set_relay_worker_endpoint(&mut self, endpoint: String)
pub fn set_relay_worker_endpoint(&mut self, endpoint: String)
Set the relay-worker endpoint after construction. Used by the CLI when a
relay is auto-elected post-NAT-detection (tier ≥ 3): serve() reads
self.cfg.relay_worker_endpoint to start the outbound relay session.
Sourcepub async fn deregister(&self, node_token: Option<&str>) -> Result<()>
pub async fn deregister(&self, node_token: Option<&str>) -> Result<()>
Tell the directory this node is going away.
Mirrors iicp_client.IicpNode.deregister (Python iter-1471) and
IicpNode.deregister (TS iter-1474). Best-effort: shutdown paths
swallow failures so a flaky directory connection doesn’t block exit.
Deregister from the directory. node_token defaults to the token stashed by
register() (BUG-5) when None — pass Some(token) to override.
Sourcepub async fn register(&self) -> Result<String>
pub async fn register(&self) -> Result<String>
Register with the directory and return the assigned node_token.
Payload conforms to spec/iicp-dir.md §3.1 REGISTER plus the v0.7.0
dual-endpoint extension (transport_endpoint). Pre-iter-1413
builds sent a non-spec flat-intent shape that the production
directory rejects with 422; fixed here.
Sourcepub async fn heartbeat(&self, node_token: &str) -> Result<()>
pub async fn heartbeat(&self, node_token: &str) -> Result<()>
Send a single heartbeat to the directory.