Skip to main content

tuwunel_service/migrations/
clear_state_local_error_memos.rs

1use tuwunel_core::{Result, warn};
2
3use super::CLEAR_STATE_LOCAL_ERROR_MEMOS;
4use crate::Services;
5
6/// Clears local state-resolution memo rows produced by older auth semantics.
7///
8/// Authoritative state and compressed state groups remain intact. The marker
9/// is written only after the derived memo map has been cleared successfully.
10#[tracing::instrument(level = "debug", skip_all)]
11pub(super) async fn clear_state_local_error_memos(services: &Services) -> Result {
12	let db = &services.db;
13	let memos = db["eventid_resolvedstate"].clone();
14
15	warn!("Clearing local state-resolution memo rows");
16	memos.clear().await;
17
18	db["global"].insert(CLEAR_STATE_LOCAL_ERROR_MEMOS, []);
19	memos.sort()
20}