refactor!: CQRS repository split — v0.3.0
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.
This commit is contained in:
@@ -9,13 +9,13 @@ use crate::error::Error;
|
||||
/// On repo error, skips the check rather than silently dropping the activity.
|
||||
pub(crate) async fn already_processed(activity_id: &Url, data: &Data<FederationData>) -> bool {
|
||||
let id = activity_id.as_str();
|
||||
match data.federation_repo.is_activity_processed(id).await {
|
||||
match data.activity_repo.is_activity_processed(id).await {
|
||||
Ok(true) => {
|
||||
tracing::debug!(activity_id = id, "duplicate activity, skipping");
|
||||
true
|
||||
}
|
||||
Ok(false) => {
|
||||
if let Err(e) = data.federation_repo.mark_activity_processed(id).await {
|
||||
if let Err(e) = data.activity_repo.mark_activity_processed(id).await {
|
||||
tracing::warn!(activity_id = id, error = %e, "failed to mark activity processed");
|
||||
}
|
||||
false
|
||||
@@ -39,7 +39,7 @@ pub(crate) async fn check_guards(
|
||||
return Ok(true);
|
||||
}
|
||||
let domain = actor.host_str().unwrap_or("");
|
||||
if data.federation_repo.is_domain_blocked(domain).await? {
|
||||
if data.blocklist_repo.is_domain_blocked(domain).await? {
|
||||
tracing::info!(actor = %actor, "ignoring activity from blocked domain");
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user