weave-dht · crate
Source declarations, signatures and documentation for crate.
Source: sigil/weave/network/weave-dht/src/lib.rs. SHA-256: 3bf71679acf54a672835d3c3440d7a59ac0e0411c6e830615638d51996ad6116.
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.
private_route_v1
pub mod private_route_v1;Source line: 45.
route_v1
pub mod route_v1;Source line: 48.
pub use enhanced::EnhancedDhtNode;
pub use enhanced::EnhancedDhtNode;Source line: 71.
pub use envelope::{validate_envelope, DidEnvelope, Proof};
pub use envelope::{validate_envelope, DidEnvelope, Proof};Source line: 72.
pub use methods::{AdapterRegistry, DhtMethodAdapter, MarsAdapter, MarsConfig, MethodAdapter};
pub use methods::{AdapterRegistry, DhtMethodAdapter, MarsAdapter, MarsConfig, MethodAdapter};Source line: 73.
pub use relay::{RelayConfig as LocalRelayConfig, RelayProtocol, SessionId};
pub use relay::{RelayConfig as LocalRelayConfig, RelayProtocol, SessionId};Source line: 74.
pub use store_usage_demo::demo_rocksdb_store_usage;
#[cfg(feature = "rocksdb-store")]
pub use store_usage_demo::demo_rocksdb_store_usage;Source line: 76.
pub use store_usage_demo::{demo_memory_store_usage, demo_store_factory_usage};
pub use store_usage_demo::{demo_memory_store_usage, demo_store_factory_usage};Source line: 77.
pub use weave::{
AnnounceOpts, AnnouncementState, MutableValue, PeerInfo, WeaveDht, WeaveDhtAdapter, WeaveDhtConfig, };
pub use weave::{
AnnounceOpts, AnnouncementState, MutableValue, PeerInfo, WeaveDht, WeaveDhtAdapter,
WeaveDhtConfig,
};Source line: 78.
key_utils::did_key
Convenience helper – converts an agent DID into the standard /oas/{did} record key.
pub fn did_key(did: &str) -> Key;Source line: 92.
key_utils::did_env_key
Envelope record key /oas-env/{did}
pub fn did_env_key(did: &str) -> Key;Source line: 98.
key_utils::RecordKey
pub type RecordKey = Key;Source line: 103.
pub use key_utils::{did_env_key, did_key, RecordKey};
pub use key_utils::{did_env_key, did_key, RecordKey};Source line: 106.
::DhtHandle
Cloneable handle for interacting with the DHT task.
#[derive(Clone)]
pub struct DhtHandle {
}Source line: 143.
::DhtHandle::get_record
Retrieve a record value by key.
pub async fn get_record(&self, key: Key) -> Result<Option<Vec<u8>>>;Source line: 149.
::DhtHandle::get
Convenience method using the old name
pub async fn get(&self, key: Key) -> Result<Option<Vec<u8>>>;Source line: 156.
::DhtHandle::put_record
Publish a record to the DHT.
pub async fn put_record(&self, key: Key, value: Vec<u8>) -> Result<()>;Source line: 161.
::DhtHandle::put
Convenience method using the old name
pub async fn put(&self, key: Key, value: Vec<u8>) -> Result<()>;Source line: 174.
::DhtHandle::add_address
Add a known address for a peer
pub fn add_address(&self, peer_id: &libp2p::PeerId, addr: libp2p::Multiaddr);Source line: 179.
::DhtHandle::list_peers
List connected peers
pub async fn list_peers(&self) -> Result<Vec<String>>;Source line: 187.
::DhtHandle::list_listeners
List current listen addresses
pub async fn list_listeners(&self) -> Result<Vec<String>>;Source line: 195.
::DhtHandle::store_stats
Get RocksDB store stats: (approx_bytes, max_bytes, record_ttl_secs, provider_ttl_secs)
pub async fn store_stats(&self) -> Result<(Option<u64>, Option<u64>, u64, u64)>;Source line: 205.
::DhtHandle::get_dcutr_count
#[cfg(feature = "testhooks")]
pub async fn get_dcutr_count(&self) -> Result<u64>;Source line: 214.
::DhtNode
Running node instance – mainly a wrapper that keeps the handle alive.
pub struct DhtNode {
}Source line: 224.
::DhtNode::handle
pub fn handle(&self) -> DhtHandle;Source line: 232.
::DhtNode::peer_id
pub fn peer_id(&self) -> libp2p::PeerId;Source line: 236.
::DhtNode::listen_port
pub fn listen_port(&self) -> u16;Source line: 240.
::DhtNode::builder
pub fn builder() -> DhtNodeBuilder;Source line: 244.
::DhtNode::into_enhanced
Create an enhanced node with Weave compatibility
pub fn into_enhanced(
self,
weave_config: WeaveDhtConfig,
relay_config: LocalRelayConfig,
) -> EnhancedDhtNode;Source line: 249.
::DhtNodeBuilder
Builder for configuring a DHT node.
pub struct DhtNodeBuilder {
}Source line: 265.
::DhtNodeBuilder::bootstrap_peers
Provide bootstrap peer multiaddrs ("/ip4/…/p2p/…").
pub fn bootstrap_peers(mut self, peers: Vec<String>) -> Self;Source line: 300.
::DhtNodeBuilder::in_memory
Run in-memory only (no external transport) – useful for unit tests.
pub fn in_memory(mut self) -> Self;Source line: 306.
::DhtNodeBuilder::listen_port
Set specific listen port
pub fn listen_port(mut self, port: u16) -> Self;Source line: 312.
::DhtNodeBuilder::mdns
Enable or disable local mDNS peer discovery.
pub fn mdns(mut self, enabled: bool) -> Self;Source line: 318.
::DhtNodeBuilder::with_weave
Enable Weave compatibility
pub fn with_weave(mut self, config: WeaveDhtConfig) -> Self;Source line: 324.
::DhtNodeBuilder::with_relay
Enable relay protocol
pub fn with_relay(mut self, config: LocalRelayConfig) -> Self;Source line: 330.
::DhtNodeBuilder::relay_peers
Provide relay peer multiaddrs for circuit reservations
pub fn relay_peers(mut self, peers: Vec<String>) -> Self;Source line: 336.
::DhtNodeBuilder::store_path
Configure persistent store path and limits
pub fn store_path(mut self, path: impl Into<String>) -> Self;Source line: 342.
::DhtNodeBuilder::max_disk_bytes
pub fn max_disk_bytes(mut self, max: u64) -> Self;Source line: 346.
::DhtNodeBuilder::record_ttl_secs
pub fn record_ttl_secs(mut self, secs: u64) -> Self;Source line: 350.
::DhtNodeBuilder::provider_ttl_secs
pub fn provider_ttl_secs(mut self, secs: u64) -> Self;Source line: 354.
::DhtNodeBuilder::start
Starts the node, spawning the swarm task onto the tokio runtime.
pub async fn start(self) -> Result<DhtNode>;Source line: 360.
::set_global_handle
pub fn set_global_handle(handle: DhtHandle);Source line: 959.
::global_handle
pub fn global_handle() -> Option<DhtHandle>;Source line: 963.
::DhtConfig
Configuration for DHT client
pub struct DhtConfig {
pub bootstrap_nodes: Vec<String>,
pub port: u16
}Source line: 968.
::DhtConfig::new
pub fn new(bootstrap_nodes: Vec<String>, port: u16) -> Self;Source line: 974.
::DhtClient
DHT client for publishing and resolving DID documents
pub struct DhtClient {
}Source line: 992.
::DhtClient::new
Create a new DHT client with configuration
pub async fn new(config: DhtConfig) -> Result<Self>;Source line: 998.
::DhtClient::publish_did_document
Publish a DID document to the DHT
pub async fn publish_did_document(
&mut self,
did: &str,
document: &oas_document::OasDocument,
) -> Result<()>;Source line: 1011.
::DhtClient::resolve_did_document
Resolve a DID document from the DHT
pub async fn resolve_did_document(&mut self, did: &str) -> Result<oas_document::OasDocument>;Source line: 1023.
::DhtClient::handle
Get the underlying DHT handle
pub fn handle(&self) -> &DhtHandle;Source line: 1036.