Sigil documentation
ReferenceRust referencesigil-czac

sigil-czac · routing

Source declarations, signatures and documentation for routing.

Source: sigil/node/sigil-czac/src/routing.rs. SHA-256: 1d6fb16ae6411c0cd764e687dae5a9397e292d3ec0ab24308f272db2c023fb6d.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

routing::ZoneEndpoint

A zone endpoint registration in the routing table.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ZoneEndpoint {
/// Unique zone identifier.

pub zone_id: String,
/// OAS DID of the organization that owns this zone.

pub org_did: String,
/// Multiaddresses where this zone can be reached.

pub addresses: Vec<String>,
/// Capabilities this zone advertises (e.g., "czac.payment", "czac.broadcast").

pub capabilities: Vec<String>,
/// Unix timestamp when this endpoint was last seen / refreshed.

pub last_seen: u64,
/// Time-to-live in seconds before this entry is considered stale.

pub ttl: u64
}

Source line: 16.

routing::ZoneEndpoint::is_expired

Check whether this endpoint has expired at the given time.

pub fn is_expired(&self, now: u64) -> bool;

Source line: 33.

routing::RoutingTable

Routing table for zone endpoint discovery.

Provides O(1) lookup by zone ID and O(n) lookup by org DID.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RoutingTable {

}

Source line: 42.

routing::RoutingTable::new

Create a new routing table with the given default cache TTL.

pub fn new(cache_ttl: u64) -> Self;

Source line: 51.

routing::RoutingTable::register

Register or update a zone endpoint.

Returns an error if the endpoint has no zone ID or no addresses.

pub fn register(&mut self, endpoint: ZoneEndpoint) -> Result<(), CzacError>;

Source line: 61.

routing::RoutingTable::lookup

Look up a zone endpoint by zone ID.

pub fn lookup(&self, zone_id: &str) -> Option<&ZoneEndpoint>;

Source line: 78.

routing::RoutingTable::lookup_by_org

Look up all zone endpoints belonging to a given organization.

pub fn lookup_by_org(&self, org_did: &str) -> Vec<&ZoneEndpoint>;

Source line: 83.

routing::RoutingTable::remove_expired

Remove all expired endpoints. Returns the number of entries removed.

pub fn remove_expired(&mut self, now: u64) -> usize;

Source line: 91.

routing::RoutingTable::all_zones

Return zone IDs of all registered endpoints.

pub fn all_zones(&self) -> Vec<&str>;

Source line: 98.

routing::RoutingTable::len

Returns the number of registered endpoints.

pub fn len(&self) -> usize;

Source line: 103.

routing::RoutingTable::is_empty

Returns true if the routing table is empty.

pub fn is_empty(&self) -> bool;

Source line: 108.

routing::RoutingTable::cache_ttl

Returns the default cache TTL.

pub fn cache_ttl(&self) -> u64;

Source line: 113.

routing::RoutingTable::remove

Remove a specific zone endpoint by zone ID.

pub fn remove(&mut self, zone_id: &str) -> Option<ZoneEndpoint>;

Source line: 118.

On this page