add Anope->Echo migration importer (echo import)
All checks were successful
CI / check (push) Successful in 3m41s

New 'echo import <anope.json> <out.log> [node]' subcommand builds a fresh event
log from an Anope db_json: accounts (identity only — Anope's one-way password
hashes can't become SCRAM verifiers, so migrated users auth by certfp/external
authority), grouped nicks, cert fingerprints, vhosts, channels (+desc/topic/
assigned bot), access mapped to op/voice by each channel's AUTOOP/AUTOVOICE
thresholds, param-less mode locks, BotServ bots (service pseudo-clients skipped),
and memos. Read-only on the source; self-verifies by replaying the produced log.
Verified against the live backup (11 accounts, 10 channels, 10 bots) + a unit
test over a synthetic fixture. The prerequisite for a safe cutover.
This commit is contained in:
Jean Chevronnet 2026-07-16 13:05:45 +00:00
parent b23bf5d8a9
commit 062eae703e
No known key found for this signature in database
3 changed files with 366 additions and 0 deletions

View file

@ -1202,6 +1202,13 @@ impl Db {
Ok(())
}
/// Append a pre-built event during a one-off import, bypassing the live-mutation
/// methods so original timestamps and ids are preserved verbatim. State is
/// rebuilt from the log on the next open; only meant for the `import` tool.
pub fn migrate_append(&mut self, event: Event) -> std::io::Result<()> {
self.log.append(event)
}
/// Whether the log has grown enough past the live state to be worth compacting.
pub fn should_compact(&self) -> bool {
self.log.len() > (self.accounts.len() + self.channels.len()) * 3 + 64