veilid_core/table_store/tasks/
mod.rs1pub mod cleanup_tables;
2pub mod flush_tables;
3
4use super::*;
5
6impl TableStore {
7 pub(super) fn setup_tasks(&self) {
8 veilid_log!(self debug "starting flush tables task");
10 impl_setup_task_async!(self, Self, flush_tables_task, flush_tables_task_routine);
11
12 veilid_log!(self debug "starting cleanup tables task");
14 impl_setup_task_async!(self, Self, cleanup_tables_task, cleanup_tables_task_routine);
15 }
16
17 #[cfg_attr(feature = "instrument", instrument(parent = None, level = "trace", target = "tstore", name = "TableStore::tick", skip_all, err))]
18 pub async fn tick(&self, _lag: Option<TimestampDuration>) -> EyreResult<()> {
22 let Ok(_startup_guard) = self.startup_lock.enter() else {
23 return Ok(());
24 };
25
26 self.flush_tables_task.tick().await?;
28
29 self.cleanup_tables_task.tick().await?;
31
32 Ok(())
33 }
34
35 #[cfg_attr(
36 feature = "instrument",
37 instrument(level = "trace", target = "stor", skip_all)
38 )]
39 pub(super) async fn cancel_tasks(&self) {
40 veilid_log!(self debug "stopping flush tables task");
41 if let Err(e) = self.flush_tables_task.stop().await {
42 veilid_log!(self warn "flush_tables_task not stopped: {}", e);
43 }
44 veilid_log!(self debug "stopping cleanup tables task");
45 if let Err(e) = self.cleanup_tables_task.stop().await {
46 veilid_log!(self warn "cleanup_tables_task not stopped: {}", e);
47 }
48 }
49}