pub struct PostBundleFeedbackCache { /* private fields */ }Expand description
Intermediate-server cache for EncodedPostBundleFeedbackV1 data.
Two Moka caches:
bundles: weightedCache<Id, Arc<Mutex<CachedPostBundleFeedbackLocationEntry>>>with TTI. If a location_id hasn’t been queried withinCACHE_LOCATION_TTI, the entry is evicted.inflight:Cache<Id, ()>with 30-second TTL — tracks pending upload tokens.
Implementations§
Source§impl PostBundleFeedbackCache
impl PostBundleFeedbackCache
pub fn new(max_bytes: u64) -> Self
Sourcepub fn on_get(
&self,
bucket_location: &BucketLocation,
already_retrieved_peer_ids: &[Id],
peer_self: &Peer,
server_id: &ServerId,
now: TimeMillis,
) -> GetCacheResult
pub fn on_get( &self, bucket_location: &BucketLocation, already_retrieved_peer_ids: &[Id], peer_self: &Peer, server_id: &ServerId, now: TimeMillis, ) -> GetCacheResult
Called by the dispatch handler when serving a GetPostBundleFeedbackV1 request.
Sourcepub fn on_upload(
&self,
location_id: Id,
originator_peer_id: Id,
feedback_bytes: Bytes,
server_time: TimeMillis,
is_sealed: bool,
) -> bool
pub fn on_upload( &self, location_id: Id, originator_peer_id: Id, feedback_bytes: Bytes, server_time: TimeMillis, is_sealed: bool, ) -> bool
Called by the dispatch handler when a CachePostBundleFeedbackV1 upload arrives.
Unconditionally replaces any previously cached feedback — the uploader has the merged best.
Returns true if accepted, false if the entry was evicted before the upload arrived.
Auto Trait Implementations§
impl Freeze for PostBundleFeedbackCache
impl !RefUnwindSafe for PostBundleFeedbackCache
impl Send for PostBundleFeedbackCache
impl Sync for PostBundleFeedbackCache
impl Unpin for PostBundleFeedbackCache
impl UnsafeUnpin for PostBundleFeedbackCache
impl !UnwindSafe for PostBundleFeedbackCache
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
§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