Alternative ATProto PDS implementation
1use anyhow::Result;
2use deadpool_diesel::sqlite::{Manager, Pool, Runtime};
3
4#[tracing::instrument(skip_all)]
5/// Establish a connection to the database
6/// Takes a database URL as an argument (like "sqlite://data/sqlite.db")
7pub(crate) fn establish_pool(database_url: &str) -> Result<Pool> {
8 tracing::debug!("Establishing database connection");
9 let manager = Manager::new(database_url, Runtime::Tokio1);
10 let pool = Pool::builder(manager)
11 .max_size(8)
12 .build()
13 .expect("should be able to create connection pool");
14 tracing::debug!("Database connection established");
15 Ok(pool)
16}