pub struct RecentPostsPen { /* private fields */ }Expand description
Short-lived scratch space for posts the local client has just submitted.
After a successful submit_post, the resulting commit tokens and encoded post bytes are
recorded here. When any SingleTimeline calls get_more_posts, it consults the pen for
entries whose BucketLocation matches the timeline being viewed. This ensures the user’s
own posts appear immediately — even before the post bundles have propagated through the
network caches — and works across all timeline types (User, Hashtag, Mention, Reply, Sequel, etc.).
Entries expire after 10 minutes (by which time the network caches will have refreshed and
the posts will appear naturally from the PostBundleManager). Deduplication against the
SingleTimeline’s post_ids_already_seen set prevents a post from showing up twice once
it does arrive from the network.
Implementations§
Source§impl RecentPostsPen
impl RecentPostsPen
pub fn new() -> Self
Sourcepub fn add_all(
&mut self,
bucket_locations_and_post_ids: &[(BucketLocation, Id)],
encoded_post_bytes: Bytes,
time_millis: TimeMillis,
)
pub fn add_all( &mut self, bucket_locations_and_post_ids: &[(BucketLocation, Id)], encoded_post_bytes: Bytes, time_millis: TimeMillis, )
Add pen entries from commit tokens. Each token represents the post committed to a particular timeline (User, Hashtag, Mention, etc.) — we store one entry per token.
Sourcepub fn get_matching_posts(
&mut self,
bucket_type: BucketType,
base_id: &Id,
already_seen_ids: &HashSet<Id>,
current_time: TimeMillis,
) -> Vec<(BucketLocation, Bytes, Id)>
pub fn get_matching_posts( &mut self, bucket_type: BucketType, base_id: &Id, already_seen_ids: &HashSet<Id>, current_time: TimeMillis, ) -> Vec<(BucketLocation, Bytes, Id)>
Returns matching pen posts for the given timeline, excluding expired and already-seen entries.
Multiple entries for the same post_id may be returned (e.g. from multiple commit tokens);
SingleTimeline handles deduplication via post_ids_already_seen.
Auto Trait Implementations§
impl Freeze for RecentPostsPen
impl RefUnwindSafe for RecentPostsPen
impl Send for RecentPostsPen
impl Sync for RecentPostsPen
impl Unpin for RecentPostsPen
impl UnsafeUnpin for RecentPostsPen
impl UnwindSafe for RecentPostsPen
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
§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>
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>
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