refactor: drop postgres backend

This commit is contained in:
2026-10-25 20:34:07 +01:00
parent 59238a36d8
commit 933400e1c2
82 changed files with 77 additions and 7937 deletions

View File

@@ -13,10 +13,6 @@ pub async fn create(
EventBusBackend::Db => {
tracing::info!("event bus: DB queue");
match db_pool {
#[cfg(feature = "postgres")]
DbPool::Postgres(pool) => Ok(
postgres_event_queue::PostgresEventQueue::create_channel(pool.clone()).await?,
),
#[cfg(feature = "sqlite")]
DbPool::Sqlite(pool) => {
Ok(sqlite_event_queue::SqliteEventQueue::create_channel(pool.clone()).await?)

View File

@@ -1,4 +1,5 @@
mod event_bus;
#[cfg(feature = "federation")]
mod follow_backfill_handler;
use std::sync::Arc;
@@ -12,10 +13,8 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
use domain::ports::{EventHandler, MovieEnrichmentClient, PeriodicJob, PersonEnrichmentClient};
#[cfg(not(any(feature = "sqlite", feature = "postgres")))]
compile_error!(
"At least one database backend must be enabled. Use --features sqlite or --features postgres"
);
#[cfg(not(feature = "sqlite"))]
compile_error!("The sqlite feature must be enabled. Use --features sqlite");
#[tokio::main]
async fn main() -> anyhow::Result<()> {
@@ -23,7 +22,7 @@ async fn main() -> anyhow::Result<()> {
init_tracing();
let database_url = std::env::var("DATABASE_URL").context("DATABASE_URL must be set")?;
let backend = std::env::var("DATABASE_BACKEND").unwrap_or_else(|_| "sqlite".to_string());
warn_if_database_backend_set();
let app_config = AppConfig::from_env();
let instance = domain::value_objects::InstanceIdentity::new(app_config.base_url.clone());
@@ -47,8 +46,7 @@ async fn main() -> anyhow::Result<()> {
.clone()
.map(|c| c as Arc<dyn PersonEnrichmentClient>);
let db =
composition::factory::build_database_adapters(&backend, &database_url, &instance).await?;
let db = composition::factory::build_database_adapters(&database_url, &instance).await?;
let (event_publisher_arc, consumer_arc) = event_bus::create(&db.db_pool).await?;
let worker_services = application::WorkerServices {
@@ -88,10 +86,6 @@ async fn main() -> anyhow::Result<()> {
composition::DbPool::Sqlite(pool) => {
sqlite_federation::wire(pool.clone(), instance.clone())
}
#[cfg(feature = "postgres-federation")]
composition::DbPool::Postgres(pool) => {
postgres_federation::wire(pool.clone(), instance.clone())
}
};
let movie_command = db.movie_command;
@@ -103,6 +97,7 @@ async fn main() -> anyhow::Result<()> {
let person_query = db.person_query;
let search_command = db.search_command;
let wrapup_repo = db.wrapup_repo;
#[cfg(feature = "federation")]
let remote_goal = db.remote_goal;
let refresh_session = db.refresh_session;
@@ -306,6 +301,14 @@ async fn main() -> anyhow::Result<()> {
Ok(())
}
fn warn_if_database_backend_set() {
if let Ok(v) = std::env::var("DATABASE_BACKEND")
&& v != "sqlite"
{
tracing::warn!("DATABASE_BACKEND is ignored; SQLite is the only backend");
}
}
fn init_tracing() {
tracing_subscriber::registry()
.with(log_filter("worker=info,application=info,k_ap=info"))