diff --git a/ingestor/src/collections.rs b/ingestor/src/collections.rs index b9ca1c1..bf5d5c6 100644 --- a/ingestor/src/collections.rs +++ b/ingestor/src/collections.rs @@ -74,7 +74,8 @@ pub mod my_spoor_session; pub use my_spoor_session::MySpoorSession; pub mod my_spoor_activity; pub use my_spoor_activity::MySpoorActivity; - +pub mod app_bsky_post; +pub use app_bsky_post::AppBskyPost; struct CommitIngestorState; diff --git a/ingestor/src/collections/app_bsky_post.rs b/ingestor/src/collections/app_bsky_post.rs new file mode 100644 index 0000000..45c740d --- /dev/null +++ b/ingestor/src/collections/app_bsky_post.rs @@ -0,0 +1,26 @@ +use crate::collections::CommitIngestorState; +use rocketman::types::event::Event; +use serde_json::Value; +use anyhow::Result; +use tracing::info; + +async fn handle_change( + _state: CommitIngestorState, + message: Event +) -> Result<()> { + info!("{:?}", message); + Ok(()) +} + +async fn handle_delete( + _state: CommitIngestorState, + message: Event +) -> Result<()> { + info!("{:?}", message); + Ok(()) +} + +create_commit_collection!(AppBskyPost, "app.bsky.feed.post".to_string(), + change => handle_change, + delete => handle_delete, +); diff --git a/ingestor/src/ingestor.rs b/ingestor/src/ingestor.rs index 2bbdad9..e2a80f3 100644 --- a/ingestor/src/ingestor.rs +++ b/ingestor/src/ingestor.rs @@ -25,7 +25,8 @@ impl Ingestor { } pub async fn start(self) { - info!("Starting ingestor"); + info!("Starting ingestor with the following collections: {:?}", + self.ingesters.keys()); let opts = JetstreamOptions::builder() .wanted_collections(self.ingesters.keys().cloned().collect()) .build(); diff --git a/ingestor/src/main.rs b/ingestor/src/main.rs index 0214287..18a3541 100644 --- a/ingestor/src/main.rs +++ b/ingestor/src/main.rs @@ -1,7 +1,7 @@ use crate::{ collections::{ Collection, - MySpoorActivity, MySpoorSession, + MySpoorActivity, MySpoorSession, AppBskyPost, }, ingestor::Ingestor, }; @@ -17,5 +17,6 @@ async fn main() { let mut ingestor = Ingestor::new(); ingestor.add_collection(MySpoorActivity::new()); ingestor.add_collection(MySpoorSession::new()); + ingestor.add_collection(AppBskyPost::new()); ingestor.start().await; }