mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Migration 39: flag reprocess relay lists is needed
This commit is contained in:
parent
c8ae74d85a
commit
2ca285fd68
28
gossip-lib/src/storage/migrations/m39.rs
Normal file
28
gossip-lib/src/storage/migrations/m39.rs
Normal 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(())
|
||||
}
|
||||
}
|
@ -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"),
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user