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(dht_config: &DhtConfig) -> Self
pub fn new(dht_config: &DhtConfig) -> 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>,
) -> Result<Vec<MutableItem>>
pub async fn get( &self, pub_key: VerifyingKey, salt: Option<Vec<u8>>, more_recent_than: Option<i64>, ) -> 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)
Sourcepub async fn put_mutable(
&self,
signing_key: SigningKey,
salt: Option<Vec<u8>>,
data: Vec<u8>,
next_unix_minute_seq: i64,
) -> Result<()>
pub async fn put_mutable( &self, signing_key: SigningKey, salt: Option<Vec<u8>>, data: Vec<u8>, next_unix_minute_seq: i64, ) -> Result<()>
Publish a mutable record to the DHT.
§Arguments
signing_key- Ed25519 secret key for signingsalt- Optional salt for record slotdata- Record value to publishnext_unix_minute_seq- Sequence number for the record (per unix_minute)
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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