oxios_kernel/kernel_handle/
compression_api.rs1use std::sync::Arc;
4
5use crate::compression::CompressionService;
6use crate::state_store::Session;
7
8#[derive(Clone)]
10pub struct CompressionApi {
11 service: Arc<CompressionService>,
12}
13
14impl CompressionApi {
15 pub fn new(service: Arc<CompressionService>) -> Self {
17 Self { service }
18 }
19
20 pub fn spawn_compress(&self, session_id: String) {
22 self.service.spawn_compress(session_id)
23 }
24
25 pub fn should_compress(&self, session: &Session) -> bool {
27 self.service.should_compress(session)
28 }
29
30 pub async fn compress_now(&self, session_id: &str) -> anyhow::Result<()> {
32 self.service.compress(session_id).await
33 }
34}