From 925856f6b8da32e569a6fed4bb530bd2bdba7e1f Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 14 May 2026 13:32:23 +0200 Subject: [PATCH] =?UTF-8?q?feat(domain):=20OutboundFederationPort=20?= =?UTF-8?q?=E2=80=94=20thin=20AP=20broadcast=20abstraction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/domain/src/ports.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/crates/domain/src/ports.rs b/crates/domain/src/ports.rs index 8457d24..36f8dda 100644 --- a/crates/domain/src/ports.rs +++ b/crates/domain/src/ports.rs @@ -233,3 +233,38 @@ pub trait ActivityPubRepository: Send + Sync { /// Total locally-authored thought count for NodeInfo responses. async fn count_local_notes(&self) -> Result; } + +#[async_trait] +pub trait OutboundFederationPort: Send + Sync { + /// Fan out a new local Note to all accepted followers. + async fn broadcast_create( + &self, + author_user_id: &UserId, + thought: &Thought, + author_username: &str, + ) -> Result<(), DomainError>; + + /// Fan out a Delete tombstone for a now-deleted local Note. + /// `thought_ap_id` is pre-constructed by the caller because the thought + /// has already been deleted from the DB when this fires. + async fn broadcast_delete( + &self, + author_user_id: &UserId, + thought_ap_id: &str, + ) -> Result<(), DomainError>; + + /// Fan out an Update(Note) for an edited local thought. + async fn broadcast_update( + &self, + author_user_id: &UserId, + thought: &Thought, + author_username: &str, + ) -> Result<(), DomainError>; + + /// Fan out an Announce(object_ap_id) for a boost. + async fn broadcast_announce( + &self, + booster_user_id: &UserId, + object_ap_id: &str, + ) -> Result<(), DomainError>; +}