pub struct Dht { /* private fields */ }Expand description
DHT client wrapper with actor-based concurrency.
Manages connections to the mainline DHT and handles mutable record get/put operations with automatic retries.
Implementations§
Source§impl Dht
impl Dht
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new DHT client.
Spawns a background actor for handling DHT operations.
Sourcepub async fn get(
&self,
pub_key: VerifyingKey,
salt: Option<Vec<u8>>,
more_recent_than: Option<i64>,
timeout: Duration,
) -> Result<Vec<MutableItem>>
pub async fn get( &self, pub_key: VerifyingKey, salt: Option<Vec<u8>>, more_recent_than: Option<i64>, timeout: Duration, ) -> Result<Vec<MutableItem>>
Retrieve mutable records from the DHT.
§Arguments
pub_key- Ed25519 public key for the recordsalt- Optional salt for record lookupmore_recent_than- Sequence number filter (get records newer than this)timeout- Maximum time to wait for results
Sourcepub async fn put_mutable(
&self,
signing_key: SigningKey,
pub_key: VerifyingKey,
salt: Option<Vec<u8>>,
data: Vec<u8>,
retry_count: Option<usize>,
timeout: Duration,
) -> Result<()>
pub async fn put_mutable( &self, signing_key: SigningKey, pub_key: VerifyingKey, salt: Option<Vec<u8>>, data: Vec<u8>, retry_count: Option<usize>, timeout: Duration, ) -> Result<()>
Publish a mutable record to the DHT.
§Arguments
signing_key- Ed25519 secret key for signingpub_key- Ed25519 public key (used for routing)salt- Optional salt for record slotdata- Record value to publishretry_count- Number of retry attempts (default: 3)timeout- Per-request timeout
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dht
impl RefUnwindSafe for Dht
impl Send for Dht
impl Sync for Dht
impl Unpin for Dht
impl UnwindSafe for Dht
Blanket Implementations§
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
Mutably borrows from an owned value. Read more