use std::sync::Arc;
use crate::compression::CompressionService;
use crate::state_store::Session;
#[derive(Clone)]
pub struct CompressionApi {
service: Arc<CompressionService>,
}
impl CompressionApi {
pub fn new(service: Arc<CompressionService>) -> Self {
Self { service }
}
pub fn spawn_compress(&self, session_id: String) {
self.service.spawn_compress(session_id)
}
pub fn should_compress(&self, session: &Session) -> bool {
self.service.should_compress(session)
}
pub async fn compress_now(&self, session_id: &str) -> anyhow::Result<()> {
self.service.compress(session_id).await
}
}