Skip to main content

lb_rs/service/
activity.rs

1use crate::Lb;
2use crate::io::docs::LocalDocuments;
3use crate::io::server::Server;
4use serde::{Deserialize, Serialize};
5use uuid::Uuid;
6
7impl<S: Server, D: LocalDocuments> Lb<S, D> {
8    /// hint to background processing pipelines whether or not a user is around
9    pub fn app_foregrounded(&self) {
10        let bg_lb = self.clone();
11        tokio::spawn(async move {
12            *bg_lb.user_last_seen.write().await = web_time::Instant::now();
13            bg_lb.user_wake.notify_one();
14        });
15    }
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize, Ord, PartialEq, PartialOrd, Eq, Hash, Copy)]
19pub enum DocEvent {
20    Read(Uuid, i64),
21    Write(Uuid, i64),
22}