this repo has no description
1use crate::repo::PostgresBlockStore; 2use crate::storage::{BlobStorage, S3BlobStorage}; 3use crate::sync::firehose::SequencedEvent; 4use sqlx::PgPool; 5use std::sync::Arc; 6use tokio::sync::broadcast; 7 8#[derive(Clone)] 9pub struct AppState { 10 pub db: PgPool, 11 pub block_store: PostgresBlockStore, 12 pub blob_store: Arc<dyn BlobStorage>, 13 pub firehose_tx: broadcast::Sender<SequencedEvent>, 14} 15 16impl AppState { 17 pub async fn new(db: PgPool) -> Self { 18 let block_store = PostgresBlockStore::new(db.clone()); 19 let blob_store = S3BlobStorage::new().await; 20 let (firehose_tx, _) = broadcast::channel(1000); 21 Self { 22 db, 23 block_store, 24 blob_store: Arc::new(blob_store), 25 firehose_tx, 26 } 27 } 28}