Migration 39: flag reprocess relay lists is needed

This commit is contained in:
Mike Dilger 2024-06-19 14:04:00 +12:00
parent c8ae74d85a
commit 2ca285fd68
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,28 @@
use crate::error::Error;
use crate::storage::Storage;
use heed::RwTxn;
impl Storage {
pub(super) fn m39_trigger(&self) -> Result<(), Error> {
Ok(())
}
pub(super) fn m39_migrate<'a>(
&'a self,
prefix: &str,
txn: &mut RwTxn<'a>,
) -> Result<(), Error> {
// Info message
tracing::info!("{prefix}: Flagging that relay lists need reprocessing...");
// Migrate
self.m39_flag_reprocess_relay_lists(txn)?;
Ok(())
}
fn m39_flag_reprocess_relay_lists<'a>(&'a self, txn: &mut RwTxn<'a>) -> Result<(), Error> {
self.set_flag_reprocess_relay_lists_needed(true, Some(txn))?;
Ok(())
}
}

View File

@ -32,6 +32,7 @@ mod m35;
mod m36;
mod m37;
mod m38;
mod m39;
mod m4;
mod m5;
mod m6;
@ -44,7 +45,7 @@ use crate::error::{Error, ErrorKind};
use heed::RwTxn;
impl Storage {
const MAX_MIGRATION_LEVEL: u32 = 38;
const MAX_MIGRATION_LEVEL: u32 = 39;
/// Initialize the database from empty
pub(super) fn init_from_empty(&self) -> Result<(), Error> {
@ -137,6 +138,7 @@ impl Storage {
36 => self.m36_trigger()?,
37 => self.m37_trigger()?,
38 => self.m38_trigger()?,
39 => self.m39_trigger()?,
_ => panic!("Unreachable migration level"),
}
@ -184,6 +186,7 @@ impl Storage {
36 => self.m36_migrate(&prefix, txn)?,
37 => self.m37_migrate(&prefix, txn)?,
38 => self.m38_migrate(&prefix, txn)?,
39 => self.m39_migrate(&prefix, txn)?,
_ => panic!("Unreachable migration level"),
};