pub struct Record {
pub key: Key,
pub value: Vec<u8>,
pub publisher: PeerId,
pub created_at: SystemTime,
pub expires_at: SystemTime,
pub signature: Option<Vec<u8>>,
}
Expand description
DHT record containing key-value data with metadata
Fields§
§key: Key
Record key
value: Vec<u8>
Record value
publisher: PeerId
Publisher peer ID
created_at: SystemTime
Record creation time
expires_at: SystemTime
Record expiration time
signature: Option<Vec<u8>>
Signature for verification (optional)
Implementations§
Source§impl Record
impl Record
Sourcepub fn with_ttl(
key: Key,
value: Vec<u8>,
publisher: PeerId,
ttl: Duration,
) -> Self
pub fn with_ttl( key: Key, value: Vec<u8>, publisher: PeerId, ttl: Duration, ) -> Self
Create a record with custom TTL
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if record has expired
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Record
impl<'de> Deserialize<'de> for Record
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnwindSafe for Record
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