hashiverse_lib/client/post_bundle/post_bundle_feedback_manager.rs
1//! # Post-bundle feedback lookup trait
2//!
3//! Counterpart of
4//! [`crate::client::post_bundle::post_bundle_manager::PostBundleManager`]. Where the
5//! post-bundle manager fetches the posts themselves, this trait fetches the
6//! [`crate::protocol::posting::encoded_post_bundle_feedback::EncodedPostBundleFeedbackV1`]
7//! carrying reactions, flags, and visibility hints.
8//!
9//! They are split because feedback mutates long after the underlying bundle has sealed,
10//! and many clients (e.g. a read-only archival cache) don't need the feedback layer at
11//! all. Separating the trait keeps both concerns independently cacheable and testable.
12
13use crate::protocol::posting::encoded_post_bundle_feedback::EncodedPostBundleFeedbackV1;
14use crate::tools::buckets::BucketLocation;
15use crate::tools::time::TimeMillis;
16
17/// The counterpart to [`PostBundleManager`] that fetches the signed feedback attached to a
18/// post bundle — the reactions, flags, and visibility hints that clients use to filter and
19/// rank the posts they display.
20///
21/// Feedback is carried separately from the post bundle on purpose: feedback mutates long
22/// after the original bundle has been sealed, and not every client needs it (for instance
23/// timelines that bypass moderation thresholds can skip the fetch). Implementors follow the
24/// same cache-then-network pattern as `PostBundleManager`.
25#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
26#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
27pub trait PostBundleFeedbackManager: Send + Sync {
28 async fn get_post_bundle_feedback(&self, bucket_location: BucketLocation, time_millis: TimeMillis) -> anyhow::Result<EncodedPostBundleFeedbackV1>;
29}