Skip to main content

PostBundleManager

Trait PostBundleManager 

Source
pub trait PostBundleManager: Send + Sync {
    // Required method
    fn get_post_bundle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bucket_location: &'life1 BucketLocation,
        time_millis: TimeMillis,
    ) -> Pin<Box<dyn Future<Output = Result<EncodedPostBundleV1>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn get_post_bundle_settled<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bucket_location: &'life1 BucketLocation,
        time_millis: TimeMillis,
    ) -> Pin<Box<dyn Future<Output = Result<EncodedPostBundleV1>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

The abstract lookup from “give me the posts at this (location, time) bucket” to an EncodedPostBundleV1.

Timeline code above this trait does not care whether the bundle came from the local cache, from a single network peer, or was stitched together from several peers after a healing round — it just calls get_post_bundle. The production implementation is crate::client::post_bundle::live_post_bundle_manager::LivePostBundleManager, which checks local ClientStorage first, falls back to the best peer from crate::client::peer_tracker::peer_tracker::PeerTracker, and transparently heals missing posts. Tests swap in stub implementations that return canned bundles so the timeline logic can be exercised without any network.

Required Methods§

Source

fn get_post_bundle<'life0, 'life1, 'async_trait>( &'life0 self, bucket_location: &'life1 BucketLocation, time_millis: TimeMillis, ) -> Pin<Box<dyn Future<Output = Result<EncodedPostBundleV1>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The bundle for this bucket, as soon as one is good enough to show. An implementation may answer with a provisional bundle (e.g. the first authoritative reply) while it keeps reconciling in the background, so the posts or overflowed flag may be incomplete. Use this for display; use Self::get_post_bundle_settled when a decision depends on the bundle being complete.

Provided Methods§

Source

fn get_post_bundle_settled<'life0, 'life1, 'async_trait>( &'life0 self, bucket_location: &'life1 BucketLocation, time_millis: TimeMillis, ) -> Pin<Box<dyn Future<Output = Result<EncodedPostBundleV1>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The bundle once it has fully settled (e.g. best-of-several-servers). Implementations that never answer provisionally can rely on this default.

Implementors§