this repo has no description
1use sqlx::PgPool;
2use crate::repo::PostgresBlockStore;
3use crate::storage::{BlobStorage, S3BlobStorage};
4use std::sync::Arc;
5
6#[derive(Clone)]
7pub struct AppState {
8 pub db: PgPool,
9 pub block_store: PostgresBlockStore,
10 pub blob_store: Arc<dyn BlobStorage>,
11}
12
13impl AppState {
14 pub async fn new(db: PgPool) -> Self {
15 let block_store = PostgresBlockStore::new(db.clone());
16 let blob_store = S3BlobStorage::new().await;
17 Self { db, block_store, blob_store: Arc::new(blob_store) }
18 }
19}