FederationRepository (34 methods) → 4 focused traits:
ActivityRepository (2) — idempotency tracking
FollowRepository (18) — follower/following graph + migration
ActorRepository (6) — keypairs, remote actor cache, announce tracking
BlocklistRepository (8) — domain + actor blocklists
ApObjectHandler (10 methods) → 2 traits:
ApContentReader (3) — get_local_objects_for_user/page, count_local_posts
ApObjectHandler (9) — all inbox callbacks (on_create, on_mention, etc.)
Builder changes from positional args to named setters:
ActivityPubService::builder(base_url)
.activity_repo(arc)
.follow_repo(arc)
.actor_repo(arc)
.blocklist_repo(arc)
.user_repo(arc)
.content_reader(arc)
.object_handler(arc)
.build()
No behaviour changes.
12 lines
476 B
Rust
12 lines
476 B
Rust
use anyhow::Result;
|
|
use async_trait::async_trait;
|
|
|
|
/// Tracks which inbound AP activity IDs have already been processed.
|
|
/// Prevents duplicate handling when remote servers retry delivery.
|
|
/// Implementations should enforce a UNIQUE constraint on stored IDs.
|
|
#[async_trait]
|
|
pub trait ActivityRepository: Send + Sync {
|
|
async fn is_activity_processed(&self, activity_id: &str) -> Result<bool>;
|
|
async fn mark_activity_processed(&self, activity_id: &str) -> Result<()>;
|
|
}
|