feat: add federation processed activities table and update dependencies
- Created a new SQL migration to add the `federation_processed_activities` table with an index on `processed_at`. - Updated dependencies in `Cargo.toml` files across `bootstrap` and `worker` crates, including version updates for `k-ap`. - Enhanced the event publishing mechanism in the `factory.rs` file to include a new `KapPublisher` for handling federation events. - Refactored the `build` function in `factory.rs` to accommodate the new event publisher and improve ActivityPub service initialization. - Modified the worker's main loop to handle new federation event types and improved error handling for event processing. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -88,6 +88,15 @@ pub enum EventPayload {
|
||||
mentioned_user_id: String,
|
||||
author_user_id: String,
|
||||
},
|
||||
FederationDeliveryRequested {
|
||||
inbox: String,
|
||||
activity: serde_json::Value,
|
||||
signing_actor_id: String,
|
||||
},
|
||||
FederationBackfillRequested {
|
||||
owner_user_id: String,
|
||||
follower_inbox_url: String,
|
||||
},
|
||||
}
|
||||
|
||||
impl EventPayload {
|
||||
@@ -113,6 +122,8 @@ impl EventPayload {
|
||||
Self::RemoteFollowRejected { .. } => "federation.follow.rejected",
|
||||
Self::ActorMoved { .. } => "federation.actor.moved",
|
||||
Self::MentionReceived { .. } => "mentions.received",
|
||||
Self::FederationDeliveryRequested { .. } => "federation.delivery.requested",
|
||||
Self::FederationBackfillRequested { .. } => "federation.backfill.requested",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -409,6 +420,12 @@ impl TryFrom<EventPayload> for DomainEvent {
|
||||
)?),
|
||||
author_user_id: UserId::from_uuid(parse_uuid(&author_user_id, "author_user_id")?),
|
||||
},
|
||||
EventPayload::FederationDeliveryRequested { .. }
|
||||
| EventPayload::FederationBackfillRequested { .. } => {
|
||||
return Err(DomainError::Internal(
|
||||
"federation infrastructure event — not a domain event".into(),
|
||||
));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user