Just make sure everything works
This commit is contained in:
parent
079e8c5831
commit
0ce9c0e288
4 changed files with 32 additions and 3 deletions
|
|
@ -74,7 +74,8 @@ pub mod my_spoor_session;
|
||||||
pub use my_spoor_session::MySpoorSession;
|
pub use my_spoor_session::MySpoorSession;
|
||||||
pub mod my_spoor_activity;
|
pub mod my_spoor_activity;
|
||||||
pub use my_spoor_activity::MySpoorActivity;
|
pub use my_spoor_activity::MySpoorActivity;
|
||||||
|
pub mod app_bsky_post;
|
||||||
|
pub use app_bsky_post::AppBskyPost;
|
||||||
|
|
||||||
struct CommitIngestorState;
|
struct CommitIngestorState;
|
||||||
|
|
||||||
|
|
|
||||||
26
ingestor/src/collections/app_bsky_post.rs
Normal file
26
ingestor/src/collections/app_bsky_post.rs
Normal file
|
|
@ -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<Value>
|
||||||
|
) -> Result<()> {
|
||||||
|
info!("{:?}", message);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn handle_delete(
|
||||||
|
_state: CommitIngestorState,
|
||||||
|
message: Event<Value>
|
||||||
|
) -> Result<()> {
|
||||||
|
info!("{:?}", message);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
create_commit_collection!(AppBskyPost, "app.bsky.feed.post".to_string(),
|
||||||
|
change => handle_change,
|
||||||
|
delete => handle_delete,
|
||||||
|
);
|
||||||
|
|
@ -25,7 +25,8 @@ impl Ingestor {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start(self) {
|
pub async fn start(self) {
|
||||||
info!("Starting ingestor");
|
info!("Starting ingestor with the following collections: {:?}",
|
||||||
|
self.ingesters.keys());
|
||||||
let opts = JetstreamOptions::builder()
|
let opts = JetstreamOptions::builder()
|
||||||
.wanted_collections(self.ingesters.keys().cloned().collect())
|
.wanted_collections(self.ingesters.keys().cloned().collect())
|
||||||
.build();
|
.build();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
collections::{
|
collections::{
|
||||||
Collection,
|
Collection,
|
||||||
MySpoorActivity, MySpoorSession,
|
MySpoorActivity, MySpoorSession, AppBskyPost,
|
||||||
},
|
},
|
||||||
ingestor::Ingestor,
|
ingestor::Ingestor,
|
||||||
};
|
};
|
||||||
|
|
@ -17,5 +17,6 @@ async fn main() {
|
||||||
let mut ingestor = Ingestor::new();
|
let mut ingestor = Ingestor::new();
|
||||||
ingestor.add_collection(MySpoorActivity::new());
|
ingestor.add_collection(MySpoorActivity::new());
|
||||||
ingestor.add_collection(MySpoorSession::new());
|
ingestor.add_collection(MySpoorSession::new());
|
||||||
|
ingestor.add_collection(AppBskyPost::new());
|
||||||
ingestor.start().await;
|
ingestor.start().await;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue