pub(crate) mod session;
pub mod target;
use std::sync::Arc;
use crate::api::Api;
use crate::auth::Auth;
use crate::files::Staging;
use crate::hlc::Clock;
pub use session::{Blocked, Event, SpaceStatus, SyncState};
pub use target::v2::SubscriptionStatus;
pub(crate) fn spawn(
handle: &tokio::runtime::Handle,
f: impl std::future::Future<Output = ()> + Send + 'static,
) -> tokio::task::JoinHandle<()> {
let f: std::pin::Pin<Box<dyn std::future::Future<Output = ()> + Send>> = Box::pin(f);
handle.spawn(f)
}
pub(crate) fn spawn_blocking<R: Send + 'static>(
handle: &tokio::runtime::Handle,
f: impl FnOnce() -> R + Send + 'static,
) -> tokio::task::JoinHandle<R> {
let f: Box<dyn FnOnce() -> R + Send> = Box::new(f);
handle.spawn_blocking(f)
}
pub(crate) struct Ctx {
pub handle: tokio::runtime::Handle,
pub auth: Arc<Auth>,
pub api: Api,
pub clock: Arc<Clock>,
pub events: tokio::sync::broadcast::Sender<Event>,
pub staging: Staging,
pub meta: Arc<dyn crate::store::SyncStore>,
pub protocol: Option<u32>,
pub as_end_user: Option<String>,
}