From 227118dfb1c1864d558f223580b305f5bbd32121 Mon Sep 17 00:00:00 2001 From: Aleksei Voronov Date: Sat, 16 Sep 2023 17:16:01 +0200 Subject: [PATCH] Rename PostSaver into PostIndexer, which is a better name --- src/main.rs | 6 +++--- src/processes/mod.rs | 2 +- src/processes/{post_saver.rs => post_indexer.rs} | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/processes/{post_saver.rs => post_indexer.rs} (93%) diff --git a/src/main.rs b/src/main.rs index 6e6b12b..e4ad79c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use anyhow::Result; use crate::config::Config; use crate::processes::feed_server::FeedServer; -use crate::processes::post_saver::PostSaver; +use crate::processes::post_indexer::PostIndexer; use crate::processes::profile_classifier::ProfileClassifier; use crate::services::ai::AI; use crate::services::bluesky::Bluesky; @@ -20,12 +20,12 @@ async fn main() -> Result<()> { let bluesky = Bluesky::new("https://bsky.social"); let database = Database::connect(&config.database_url).await?; - let post_saver = PostSaver::new(&database, &bluesky); + let post_indexer = PostIndexer::new(&database, &bluesky); let profile_classifier = ProfileClassifier::new(&database, &ai, &bluesky); let feed_server = FeedServer::new(&database, &config); tokio::try_join!( - post_saver.start(), + post_indexer.start(), profile_classifier.start(), feed_server.serve(), )?; diff --git a/src/processes/mod.rs b/src/processes/mod.rs index 87e77d3..2820e1b 100644 --- a/src/processes/mod.rs +++ b/src/processes/mod.rs @@ -1,3 +1,3 @@ pub mod feed_server; -pub mod post_saver; +pub mod post_indexer; pub mod profile_classifier; diff --git a/src/processes/post_saver.rs b/src/processes/post_indexer.rs similarity index 93% rename from src/processes/post_saver.rs rename to src/processes/post_indexer.rs index 4576d0d..9a5254f 100644 --- a/src/processes/post_saver.rs +++ b/src/processes/post_indexer.rs @@ -4,25 +4,25 @@ use async_trait::async_trait; use crate::services::bluesky::{Bluesky, Operation, OperationProcessor}; use crate::services::database::Database; -pub struct PostSaver<'a> { +pub struct PostIndexer<'a> { database: &'a Database, bluesky: &'a Bluesky, } -impl<'a> PostSaver<'a> { +impl<'a> PostIndexer<'a> { pub fn new(database: &'a Database, bluesky: &'a Bluesky) -> Self { Self { database, bluesky } } } -impl<'a> PostSaver<'a> { +impl<'a> PostIndexer<'a> { pub async fn start(&self) -> Result<()> { Ok(self.bluesky.subscribe_to_operations(self).await?) } } #[async_trait] -impl<'a> OperationProcessor for PostSaver<'a> { +impl<'a> OperationProcessor for PostIndexer<'a> { async fn process_operation(&self, operation: &Operation) -> Result<()> { match operation { Operation::CreatePost {