pub struct Entry { /* private fields */ }
Expand description
A single entry in a Replica
An entry is identified by a key, its Author
, and the Replica
’s
NamespaceSecret
. Its value is the 32-byte BLAKE3 hash
of the entry’s content data, the size of this content data, and a timestamp.
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn new(id: RecordIdentifier, record: Record) -> Self
pub fn new(id: RecordIdentifier, record: Record) -> Self
Create a new entry
Sourcepub fn new_empty(id: RecordIdentifier) -> Self
pub fn new_empty(id: RecordIdentifier) -> Self
Create a new empty entry with the current timestamp.
Sourcepub fn validate_empty(&self) -> Result<(), ValidationFailure>
pub fn validate_empty(&self) -> Result<(), ValidationFailure>
Validate that the entry has the empty hash if the length is 0, or a non-zero length.
Sourcepub fn id(&self) -> &RecordIdentifier
pub fn id(&self) -> &RecordIdentifier
Get the RecordIdentifier
for this entry.
Sourcepub fn namespace(&self) -> NamespaceId
pub fn namespace(&self) -> NamespaceId
Get the NamespaceId
of this entry.
Get the AuthorId
of this entry.
Sourcepub fn content_hash(&self) -> Hash
pub fn content_hash(&self) -> Hash
Get the content hash of the record.
Sourcepub fn content_len(&self) -> u64
pub fn content_len(&self) -> u64
Get the content length of the record.
Sourcepub fn encode(&self, out: &mut Vec<u8>)
pub fn encode(&self, out: &mut Vec<u8>)
Serialize this entry into its canonical byte representation used for signing.
Sourcepub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn to_vec(&self) -> Vec<u8> ⓘ
Serialize this entry into a new vector with its canonical byte representation.
Sourcepub fn sign(self, namespace: &NamespaceSecret, author: &Author) -> SignedEntry
pub fn sign(self, namespace: &NamespaceSecret, author: &Author) -> SignedEntry
Sign this entry with a NamespaceSecret
and Author
.
Methods from Deref<Target = Record>§
Sourcepub fn content_len(&self) -> u64
pub fn content_len(&self) -> u64
Get the length of the data addressed by this record’s content hash.
Sourcepub fn content_hash(&self) -> Hash
pub fn content_hash(&self) -> Hash
Get the [struct@Hash
] of the content data of this record.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
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>,
Source§impl From<SignedEntry> for Entry
impl From<SignedEntry> for Entry
Source§fn from(value: SignedEntry) -> Self
fn from(value: SignedEntry) -> Self
Source§impl Ord for Entry
impl Ord for Entry
Source§impl PartialOrd for Entry
impl PartialOrd for Entry
impl Eq for Entry
impl StructuralPartialEq for Entry
Auto Trait Implementations§
impl !Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.