pub struct EncodedPostBundleFeedbackV1 {
pub header: EncodedPostBundleFeedbackHeaderV1,
pub feedbacks_bytes: Bytes,
}Fields§
§header: EncodedPostBundleFeedbackHeaderV1§feedbacks_bytes: BytesImplementations§
Source§impl EncodedPostBundleFeedbackV1
impl EncodedPostBundleFeedbackV1
pub fn to_bytes(&self) -> Result<Bytes>
pub fn from_bytes(bytes: Bytes) -> Result<Self>
Sourcepub fn verify(&self) -> Result<()>
pub fn verify(&self) -> Result<()>
Verifies that this bundle is legitimate enough to cache.
Checks:
- The bundle header is valid and its signature verifies.
- The feedback body is a valid multiple of
ENTRY_SIZE(no partial entries). - The header’s hash is the same as the body’s
- Each feedback entry’s proof-of-work is correct.
pub fn get_post_pow_for_feedback_type( &self, post_id: &Id, feedback_type: u8, ) -> Pow
Sourcepub fn merge(bundles: &[Self]) -> Option<Self>
pub fn merge(bundles: &[Self]) -> Option<Self>
Unions an array of bundles by taking the highest-pow entry for each
(post_id, feedback_type) pair across all bundles. The header is
taken from the most-recently-timestamped bundle. Returns None if
bundles is empty.
pub fn get_post_pows(&self, post_id: &Id) -> [Pow; 256]
Trait Implementations§
Source§impl Clone for EncodedPostBundleFeedbackV1
impl Clone for EncodedPostBundleFeedbackV1
Source§fn clone(&self) -> EncodedPostBundleFeedbackV1
fn clone(&self) -> EncodedPostBundleFeedbackV1
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EncodedPostBundleFeedbackV1
impl Debug for EncodedPostBundleFeedbackV1
impl StructuralPartialEq for EncodedPostBundleFeedbackV1
Auto Trait Implementations§
impl !Freeze for EncodedPostBundleFeedbackV1
impl RefUnwindSafe for EncodedPostBundleFeedbackV1
impl Send for EncodedPostBundleFeedbackV1
impl Sync for EncodedPostBundleFeedbackV1
impl Unpin for EncodedPostBundleFeedbackV1
impl UnsafeUnpin for EncodedPostBundleFeedbackV1
impl UnwindSafe for EncodedPostBundleFeedbackV1
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.