WeaveDocs
Filament

Interfaces

Shared interfaces in Filament — common traits and types that link, transport, and core implementations depend on.

Purpose

Experimental transport/runtime stack composed from filament core, crypto, link, packet, transport, types, interfaces, and utilities.

This page follows the real source shape for Filament and explains the workflow a developer is likely to use first.

Developer workflow

Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.

Primary types to know

  • Announce — filament/filament-transport/src/announce.rs
  • AnnounceManager — filament/filament-transport/src/announce.rs
  • AnnounceQueue — filament/filament-transport/src/announce.rs
  • AutoInterface — filament/filament-interfaces/src/auto.rs
  • AutoInterfaceBuilder — filament/filament-interfaces/src/auto.rs
  • AutoInterfaceConfig — filament/filament-interfaces/src/auto.rs
  • BandwidthManager — filament/filament-transport/src/bandwidth.rs
  • Channel — filament/filament-link/src/channel.rs
  • ChannelMessage — filament/filament-link/src/channel.rs
  • Config — filament/filament-core/src/config.rs
  • DestinationHash — filament/filament-transport/src/types.rs
  • DestinationHash — filament/filament-types/src/primitives.rs

Example shape

use filament_interfaces::{
    InterfaceManager, TCPClientConfig, TCPClientInterface, UDPInterface, UDPInterfaceConfig,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Each interface implementation produces a typed config object and registers
    // itself with the InterfaceManager. The manager owns the read/write loops.
    let mut manager = InterfaceManager::new();

    let tcp = TCPClientInterface::new(TCPClientConfig {
        peer_addr: "198.51.100.7:4040".parse()?,
        keepalive_secs: Some(30),
        ..TCPClientConfig::default()
    })?;
    let udp = UDPInterface::new(UDPInterfaceConfig {
        bind_addr: "0.0.0.0:0".parse()?,
        ..UDPInterfaceConfig::default()
    })?;

    manager.register(Box::new(tcp)).await?;
    manager.register(Box::new(udp)).await?;
    println!("registered interfaces: {}", manager.len());
    Ok(())
}