Skip to main content

commit_bridge/
context.rs

1//! Shared context for background engines.
2
3use crate::config::Config;
4use crate::polling::git::GitFetcher;
5use crate::repository::SqliteRepository;
6use sqlx::SqlitePool;
7use std::sync::Arc;
8use tokio_util::sync::CancellationToken;
9
10/// Shared dependencies across background engines.
11#[derive(Clone)]
12pub struct SharedContext {
13    /// Configuration
14    pub config: Config,
15
16    /// Repository for data access.
17    pub repository: Arc<SqliteRepository>,
18
19    /// SQLx connection pool.
20    pub db_pool: SqlitePool,
21
22    /// Token to signal task cancellation.
23    pub token: CancellationToken,
24
25    /// Git fetcher for polling.
26    pub git_fetcher: Arc<dyn GitFetcher>,
27}