pub struct NetworkFacade {Show 18 fields
pub node: NetworkNode,
pub semantic_dht: Option<Arc<RwLock<SemanticDht>>>,
pub gossipsub: Option<Arc<RwLock<GossipSubManager>>>,
pub geo_router: Option<Arc<RwLock<GeoRouter>>>,
pub quality_predictor: Option<Arc<RwLock<QualityPredictor>>>,
pub peer_selector: Option<Arc<RwLock<PeerSelector>>>,
pub multipath_quic: Option<Arc<RwLock<MultipathQuicManager>>>,
pub tor_manager: Option<Arc<RwLock<TorManager>>>,
pub bandwidth_throttle: Option<Arc<RwLock<BandwidthThrottle>>>,
pub adaptive_polling: Option<Arc<RwLock<AdaptivePolling>>>,
pub background_mode: Option<Arc<RwLock<BackgroundModeManager>>>,
pub offline_queue: Option<Arc<RwLock<OfflineQueue>>>,
pub memory_monitor: Option<Arc<RwLock<MemoryMonitor>>>,
pub network_monitor: Option<Arc<RwLock<NetworkMonitor>>>,
pub query_batcher: Option<Arc<RwLock<QueryBatcher>>>,
pub peer_store: Arc<RwLock<PeerStore>>,
pub dht_manager: Arc<RwLock<DhtManager>>,
pub dht_provider_registry: Arc<RwLock<DhtProviderRegistry>>,
}Expand description
High-level network facade integrating all modules
Fields§
§node: NetworkNodeCore network node
semantic_dht: Option<Arc<RwLock<SemanticDht>>>Optional modules
gossipsub: Option<Arc<RwLock<GossipSubManager>>>§geo_router: Option<Arc<RwLock<GeoRouter>>>§quality_predictor: Option<Arc<RwLock<QualityPredictor>>>§peer_selector: Option<Arc<RwLock<PeerSelector>>>§multipath_quic: Option<Arc<RwLock<MultipathQuicManager>>>§tor_manager: Option<Arc<RwLock<TorManager>>>§bandwidth_throttle: Option<Arc<RwLock<BandwidthThrottle>>>§adaptive_polling: Option<Arc<RwLock<AdaptivePolling>>>§background_mode: Option<Arc<RwLock<BackgroundModeManager>>>§offline_queue: Option<Arc<RwLock<OfflineQueue>>>§memory_monitor: Option<Arc<RwLock<MemoryMonitor>>>§network_monitor: Option<Arc<RwLock<NetworkMonitor>>>§query_batcher: Option<Arc<RwLock<QueryBatcher>>>§peer_store: Arc<RwLock<PeerStore>>Always-available supporting modules
dht_manager: Arc<RwLock<DhtManager>>§dht_provider_registry: Arc<RwLock<DhtProviderRegistry>>Implementations§
Source§impl NetworkFacade
impl NetworkFacade
Sourcepub fn new(config: NetworkConfig) -> Result<Self>
pub fn new(config: NetworkConfig) -> Result<Self>
Create a new network facade with default configuration
Sourcepub fn connected_peers(&self) -> Vec<PeerId>
pub fn connected_peers(&self) -> Vec<PeerId>
Get connected peers
Sourcepub async fn disconnect(&mut self, peer_id: PeerId) -> Result<()>
pub async fn disconnect(&mut self, peer_id: PeerId) -> Result<()>
Disconnect from a peer
Sourcepub async fn find_providers(&mut self, cid: &Cid) -> Result<()>
pub async fn find_providers(&mut self, cid: &Cid) -> Result<()>
Find providers for content
Sourcepub fn get_health(&self) -> NetworkHealthSummary
pub fn get_health(&self) -> NetworkHealthSummary
Get network health summary
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if network is healthy
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Get peer count
Sourcepub fn is_connected_to(&self, peer_id: &PeerId) -> bool
pub fn is_connected_to(&self, peer_id: &PeerId) -> bool
Check if connected to peer
Sourcepub fn bytes_sent(&self) -> u64
pub fn bytes_sent(&self) -> u64
Get bytes sent
Sourcepub fn bytes_received(&self) -> u64
pub fn bytes_received(&self) -> u64
Get bytes received
Sourcepub async fn with_tor_manager(
&mut self,
config: TorConfig,
) -> Result<(), TorError>
pub async fn with_tor_manager( &mut self, config: TorConfig, ) -> Result<(), TorError>
Add a Tor manager after creation (requires async initialization)
Sourcepub fn semantic_search(
&self,
namespace: &NamespaceId,
embedding: Vec<f32>,
top_k: usize,
) -> Result<Vec<SemanticResult>>
pub fn semantic_search( &self, namespace: &NamespaceId, embedding: Vec<f32>, top_k: usize, ) -> Result<Vec<SemanticResult>>
Perform semantic search using vector embeddings (requires semantic_dht)
§Returns
Returns an error if semantic DHT is not enabled
Sourcepub fn index_content(
&self,
cid: Cid,
embedding: Vec<f32>,
namespace: NamespaceId,
) -> Result<()>
pub fn index_content( &self, cid: Cid, embedding: Vec<f32>, namespace: NamespaceId, ) -> Result<()>
Index content with semantic embedding (requires semantic_dht)
Sourcepub fn register_semantic_namespace(
&self,
namespace: NamespaceId,
dimension: usize,
) -> Result<()>
pub fn register_semantic_namespace( &self, namespace: NamespaceId, dimension: usize, ) -> Result<()>
Register a semantic namespace (requires semantic_dht)
Sourcepub fn unsubscribe(&self, topic: &str) -> Result<()>
pub fn unsubscribe(&self, topic: &str) -> Result<()>
Unsubscribe from a topic (requires gossipsub)
Sourcepub fn publish(&self, topic: &str, data: Vec<u8>) -> Result<MessageId>
pub fn publish(&self, topic: &str, data: Vec<u8>) -> Result<MessageId>
Publish a message to a topic (requires gossipsub)
Sourcepub fn subscribed_topics(&self) -> Result<Vec<String>>
pub fn subscribed_topics(&self) -> Result<Vec<String>>
Get subscribed topics (requires gossipsub)
Sourcepub fn find_nearby_peers(&self, location: GeoLocation) -> Result<Vec<PeerId>>
pub fn find_nearby_peers(&self, location: GeoLocation) -> Result<Vec<PeerId>>
Find nearby peers based on geographic location (requires geo_routing)
Sourcepub fn set_peer_location(
&self,
peer_id: PeerId,
location: GeoLocation,
) -> Result<()>
pub fn set_peer_location( &self, peer_id: PeerId, location: GeoLocation, ) -> Result<()>
Set location for a peer (requires geo_routing)
Sourcepub fn get_best_peers(
&self,
peers: &[PeerId],
count: usize,
) -> Result<Vec<PeerId>>
pub fn get_best_peers( &self, peers: &[PeerId], count: usize, ) -> Result<Vec<PeerId>>
Get best quality peers for content transfer (requires quality_predictor)
Sourcepub fn select_optimal_peers(
&self,
criteria: &SelectionCriteria,
) -> Result<Vec<PeerId>>
pub fn select_optimal_peers( &self, criteria: &SelectionCriteria, ) -> Result<Vec<PeerId>>
Select optimal peers (requires peer_selector)
Sourcepub fn get_network_stats(&self) -> NetworkStats
pub fn get_network_stats(&self) -> NetworkStats
Get comprehensive network statistics
Sourcepub fn get_module_status(&self) -> ModuleStatus
pub fn get_module_status(&self) -> ModuleStatus
Get detailed module status
Sourcepub fn get_memory_stats(&self) -> Result<MemoryStats>
pub fn get_memory_stats(&self) -> Result<MemoryStats>
Get memory usage statistics (requires memory_monitor)
Sourcepub async fn connect_batch(&mut self, addrs: Vec<Multiaddr>) -> Vec<Result<()>> ⓘ
pub async fn connect_batch(&mut self, addrs: Vec<Multiaddr>) -> Vec<Result<()>> ⓘ
Connect to multiple peers concurrently
Sourcepub async fn provide_batch(&mut self, cids: Vec<Cid>) -> Vec<Result<()>> ⓘ
pub async fn provide_batch(&mut self, cids: Vec<Cid>) -> Vec<Result<()>> ⓘ
Announce multiple CIDs to the DHT
Sourcepub async fn find_providers_batch(&mut self, cids: Vec<Cid>) -> Vec<Result<()>> ⓘ
pub async fn find_providers_batch(&mut self, cids: Vec<Cid>) -> Vec<Result<()>> ⓘ
Find providers for multiple CIDs
Sourcepub fn is_module_enabled(&self, module: &str) -> bool
pub fn is_module_enabled(&self, module: &str) -> bool
Check if a specific module is enabled
Sourcepub fn enabled_modules(&self) -> Vec<String>
pub fn enabled_modules(&self) -> Vec<String>
Get list of enabled module names
Auto Trait Implementations§
impl !Freeze for NetworkFacade
impl !RefUnwindSafe for NetworkFacade
impl Send for NetworkFacade
impl !Sync for NetworkFacade
impl Unpin for NetworkFacade
impl !UnwindSafe for NetworkFacade
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more