Ingestor, scaffolding
This commit is contained in:
parent
cee9bf78ef
commit
2f2e653d13
4 changed files with 52 additions and 25 deletions
15
ingestor/Cargo.toml
Normal file
15
ingestor/Cargo.toml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
[package]
|
||||||
|
name = "ingestor"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.98"
|
||||||
|
async-trait = "0.1.88"
|
||||||
|
atproto.workspace = true
|
||||||
|
rocketman = "0.2.0"
|
||||||
|
serde.workspace = true
|
||||||
|
serde_json.workspace = true
|
||||||
|
tokio.workspace = true
|
||||||
|
tracing-subscriber.workspace = true
|
||||||
|
tracing.workspace = true
|
||||||
25
ingestor/src/collection.rs
Normal file
25
ingestor/src/collection.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
use rocketman::types::event::Event;
|
||||||
|
use anyhow::Result;
|
||||||
|
|
||||||
|
enum Ingestor {
|
||||||
|
Jetstream(SpoorJetstream)
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SpoorJetstream;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl LexiconIngestor for SpoorJetstream {
|
||||||
|
async fn ingest(&self, message: Event<Value>) -> Result<()> {
|
||||||
|
info!("{:?}", message);
|
||||||
|
// if let Some(commit) = &message.commit {
|
||||||
|
// match commit.operation {
|
||||||
|
// Operation::Create | Operation::Update => {}
|
||||||
|
// Operation::Delete => {}
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// return Err("Message has no commit");
|
||||||
|
// }
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::lexicons::my::spoor::log::{Activity, Session};
|
use atproto::{
|
||||||
|
Collection,
|
||||||
|
lexicons::my::spoor::log::{Activity, Session},
|
||||||
|
};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use atrium_api::types::Collection;
|
|
||||||
use rocketman::{
|
use rocketman::{
|
||||||
options::JetstreamOptions,
|
options::JetstreamOptions,
|
||||||
ingestion::LexiconIngestor,
|
ingestion::LexiconIngestor,
|
||||||
|
|
@ -15,29 +17,6 @@ use std::{
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
};
|
};
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
use anyhow::Result;
|
|
||||||
|
|
||||||
enum Ingestor {
|
|
||||||
Jetstream(SpoorJetstream)
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SpoorJetstream;
|
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl LexiconIngestor for SpoorJetstream {
|
|
||||||
async fn ingest(&self, message: Event<Value>) -> Result<()> {
|
|
||||||
info!("{:?}", message);
|
|
||||||
// if let Some(commit) = &message.commit {
|
|
||||||
// match commit.operation {
|
|
||||||
// Operation::Create | Operation::Update => {}
|
|
||||||
// Operation::Delete => {}
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// return Err("Message has no commit");
|
|
||||||
// }
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn start_ingestor() {
|
pub async fn start_ingestor() {
|
||||||
info!("Starting ingestor");
|
info!("Starting ingestor");
|
||||||
8
ingestor/src/main.rs
Normal file
8
ingestor/src/main.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
let subscriber = tracing_subscriber::FmtSubscriber::new();
|
||||||
|
let _ = tracing::subscriber::set_global_default(subscriber);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue