Add import --estimate: preview counts, sizes and a rough time before committing
#67
No files matched your search
@@ -35,8 +35,11 @@ server can be gone before the new one exists.
|
||||
|
||||
Both commands converge. An interrupted run picks up where it stopped, and a
|
||||
later `import` into the same archive adds what arrived since. Every command
|
||||
takes `--dry-run` and then only reports the plan. `inspect` reads an archive
|
||||
and changes nothing.
|
||||
takes `--dry-run` and then only reports the plan. An `import` also takes
|
||||
`--estimate`, which connects to the source and reports how much is new to
|
||||
fetch — counts, bytes and a rough time — before committing, and writes
|
||||
nothing. It reports sizes for `imap` and `maildir`; other sources fall back to
|
||||
a plain dry-run. `inspect` reads an archive and changes nothing.
|
||||
|
||||
The archive is also a backup. Import on a schedule, keep the file, and
|
||||
restore it later with `export`. An archive remembers which account filled it
|
||||
|
||||
+43
-1
@@ -151,6 +151,16 @@ struct GlobalArgs {
|
||||
#[arg(long, help = "Compute and report the full plan; perform no writes")]
|
||||
dry_run: bool,
|
||||
|
||||
#[arg(
|
||||
long,
|
||||
help = "Preview an import: counts, sizes and a rough time, before any writes",
|
||||
long_help = "Preview an import before committing: for each type, how much is new since \
|
||||
the archive was last filled, how many bytes that is, and a rough time.\n \
|
||||
Available for imap and maildir today; other sources fall back to --dry-run with a \
|
||||
note. It implies --dry-run, so it never writes. On an export it is just --dry-run."
|
||||
)]
|
||||
estimate: bool,
|
||||
|
||||
#[arg(
|
||||
short = 'v',
|
||||
long,
|
||||
@@ -889,6 +899,36 @@ pub enum Action {
|
||||
Inspect(InspectConfig),
|
||||
}
|
||||
|
||||
impl Action {
|
||||
/// Whether `--estimate` was asked for on an import at all. On an export it
|
||||
/// is just a dry run, so this is false there.
|
||||
pub fn estimate_requested(&self) -> bool {
|
||||
match self {
|
||||
Action::Import(c, _)
|
||||
| Action::ImportImap(c, _)
|
||||
| Action::ImportDav(c, _)
|
||||
| Action::ImportManageSieve(c, _)
|
||||
| Action::ImportMaildir(c, _)
|
||||
| Action::ImportTakeout(c, _)
|
||||
| Action::ImportFiles(c, _)
|
||||
| Action::ImportExchangeEws(c, _)
|
||||
| Action::ImportExchangeGraph(c, _) => c.estimate,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this import can give the size-and-time estimate: the source
|
||||
/// enumerates messages in its dry run and can size them cheaply. The
|
||||
/// others fall back to a plain dry run with a note; adding them is
|
||||
/// per-source follow-up work.
|
||||
pub fn estimate_available(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Action::ImportImap(c, _) | Action::ImportMaildir(c, _) if c.estimate
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
#[command(group(clap::ArgGroup::new("auth").required(true).args(["auth_basic", "auth_bearer"])))]
|
||||
pub struct ManageSieveImportArgs {
|
||||
@@ -2062,7 +2102,9 @@ fn common_config(global: &GlobalArgs, archive: PathBuf) -> CommonConfig {
|
||||
CommonConfig {
|
||||
archive,
|
||||
threads,
|
||||
dry_run: global.dry_run,
|
||||
// --estimate is a dry run that also measures sizes, so it implies it.
|
||||
dry_run: global.dry_run || global.estimate,
|
||||
estimate: global.estimate,
|
||||
max_retries: global.max_retries,
|
||||
allow_invalid_certs: global.allow_invalid_certs,
|
||||
logger: Logger::from_flags(global.quiet, global.verbose),
|
||||
|
||||
+12
-1
@@ -31,6 +31,13 @@ fn run() -> i32 {
|
||||
Err(err) => return fail(&err),
|
||||
};
|
||||
|
||||
let do_estimate = action.estimate_available();
|
||||
if action.estimate_requested() && !do_estimate {
|
||||
eprintln!(
|
||||
"note: --estimate isn't available for this source yet; running --dry-run instead \
|
||||
(its plan is below). Estimates work for imap and maildir today."
|
||||
);
|
||||
}
|
||||
let mut quiet_report = false;
|
||||
let mut partial = "some objects failed; the archive is consistent and resumable";
|
||||
let (outcome, logger) = match action {
|
||||
@@ -174,7 +181,11 @@ fn run() -> i32 {
|
||||
}
|
||||
};
|
||||
|
||||
if !quiet_report {
|
||||
if do_estimate {
|
||||
if outcome.error.is_none() {
|
||||
print!("{}", sync::estimate::render(&outcome.summary));
|
||||
}
|
||||
} else if !quiet_report {
|
||||
report(&outcome.summary);
|
||||
}
|
||||
match outcome.error {
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Coffey Labs LLC <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*/
|
||||
|
||||
//! The report an `--estimate` run prints: for each type, how much is new to
|
||||
//! fetch and, where the source can say cheaply, how many bytes; then a total
|
||||
//! and a rough time, before anything is written.
|
||||
//!
|
||||
//! The numbers come from the same dry-run enumeration an ordinary `--dry-run`
|
||||
//! does -- new versus already in the archive -- plus a size pass that asks the
|
||||
//! source only for sizes, never bodies. Not every source can give sizes
|
||||
//! without extra round trips; those report counts, and the size reads "not
|
||||
//! estimated".
|
||||
//!
|
||||
//! The time is deliberately a wide range and labelled rough: on a first run
|
||||
//! there is no measured throughput to go on, so it is bounded by a
|
||||
//! conservative message rate, not a promise.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::sync::Summary;
|
||||
use crate::sync::progress::format_duration;
|
||||
|
||||
/// The slow and fast ends of a plain message rate, in messages a second. Real
|
||||
/// throughput depends on the server, the network and message size; these are
|
||||
/// chosen to bracket the common case rather than to be exact.
|
||||
const RATE_SLOW: f64 = 5.0;
|
||||
const RATE_FAST: f64 = 20.0;
|
||||
|
||||
/// A size in bytes, as a short decimal string: `4.2 GB`, `880 MB`, `512 B`.
|
||||
/// Decimal (1000) units, because that is how disks and bandwidth are sold and
|
||||
/// how an operator sizing a move will reason about it.
|
||||
pub fn human_bytes(n: u64) -> String {
|
||||
const UNITS: [&str; 5] = ["B", "kB", "MB", "GB", "TB"];
|
||||
if n < 1000 {
|
||||
return format!("{n} B");
|
||||
}
|
||||
let mut value = n as f64;
|
||||
let mut unit = 0;
|
||||
while value >= 1000.0 && unit < UNITS.len() - 1 {
|
||||
value /= 1000.0;
|
||||
unit += 1;
|
||||
}
|
||||
// One decimal below 100, none above: 4.2 GB, but 512 MB.
|
||||
if value < 100.0 {
|
||||
format!("{value:.1} {}", UNITS[unit])
|
||||
} else {
|
||||
format!("{value:.0} {}", UNITS[unit])
|
||||
}
|
||||
}
|
||||
|
||||
/// The slow and fast ends of how long fetching `items` might take, as
|
||||
/// durations. Fast rate gives the short end, slow rate the long end.
|
||||
fn time_range(items: u64) -> (Duration, Duration) {
|
||||
let secs = |rate: f64| Duration::from_secs_f64((items as f64 / rate).ceil().max(0.0));
|
||||
(secs(RATE_FAST), secs(RATE_SLOW))
|
||||
}
|
||||
|
||||
/// The whole report as a string, ready to print. `per_type` entries with
|
||||
/// nothing new are left out; a run with nothing new at all says so.
|
||||
pub fn render(summary: &Summary) -> String {
|
||||
let mut out = String::from("Estimate (no writes):\n");
|
||||
|
||||
let mut total_items = 0u64;
|
||||
let mut total_bytes = 0u64;
|
||||
let mut any = false;
|
||||
|
||||
for (name, counts) in &summary.per_type {
|
||||
let items = counts.fetched;
|
||||
if items == 0 {
|
||||
continue;
|
||||
}
|
||||
any = true;
|
||||
total_items += items;
|
||||
total_bytes += counts.bytes;
|
||||
// Folders and other containers carry no transfer size; only append one
|
||||
// when there is one, so a mailbox row reads "2 new", an email row
|
||||
// "4 new, 19.8 kB".
|
||||
if counts.bytes > 0 {
|
||||
out.push_str(&format!(
|
||||
" {name}: {} new, {}\n",
|
||||
thousands_items(items),
|
||||
human_bytes(counts.bytes)
|
||||
));
|
||||
} else {
|
||||
out.push_str(&format!(" {name}: {} new\n", thousands_items(items)));
|
||||
}
|
||||
}
|
||||
|
||||
if !any {
|
||||
out.push_str(" nothing new since the archive was last filled\n");
|
||||
return out;
|
||||
}
|
||||
|
||||
out.push_str(" ----\n");
|
||||
if total_bytes > 0 {
|
||||
out.push_str(&format!(
|
||||
" total: {} new, {}\n",
|
||||
thousands_items(total_items),
|
||||
human_bytes(total_bytes)
|
||||
));
|
||||
} else {
|
||||
out.push_str(&format!(" total: {} new\n", thousands_items(total_items)));
|
||||
}
|
||||
|
||||
let (fast, slow) = time_range(total_items);
|
||||
out.push_str(&format!(
|
||||
" rough time: {}\u{2013}{} (first run, no measured rate yet)\n",
|
||||
format_duration(fast),
|
||||
format_duration(slow)
|
||||
));
|
||||
out
|
||||
}
|
||||
|
||||
/// `1,234` with grouping, plus the word, so a line reads `1,234 new`.
|
||||
fn thousands_items(n: u64) -> String {
|
||||
crate::sync::progress::thousands(n)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sync::TypeCounts;
|
||||
|
||||
#[test]
|
||||
fn human_bytes_scales_and_rounds() {
|
||||
assert_eq!(human_bytes(0), "0 B");
|
||||
assert_eq!(human_bytes(512), "512 B");
|
||||
assert_eq!(human_bytes(1000), "1.0 kB");
|
||||
assert_eq!(human_bytes(4_200_000_000), "4.2 GB");
|
||||
assert_eq!(human_bytes(512_000_000), "512 MB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn time_range_fast_end_is_shorter() {
|
||||
let (fast, slow) = time_range(1000);
|
||||
assert!(fast < slow);
|
||||
// 1000 at 20/s = 50s, at 5/s = 200s.
|
||||
assert_eq!(fast, Duration::from_secs(50));
|
||||
assert_eq!(slow, Duration::from_secs(200));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nothing_new_says_so() {
|
||||
let s = Summary::default();
|
||||
assert!(render(&s).contains("nothing new"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_type_with_bytes_shows_a_size_and_one_without_says_not_estimated() {
|
||||
let mut s = Summary::default();
|
||||
s.per_type.push((
|
||||
"Email",
|
||||
TypeCounts {
|
||||
fetched: 318,
|
||||
bytes: 4_200_000_000,
|
||||
..Default::default()
|
||||
},
|
||||
));
|
||||
s.per_type.push((
|
||||
"Calendar",
|
||||
TypeCounts {
|
||||
fetched: 12,
|
||||
..Default::default()
|
||||
},
|
||||
));
|
||||
let r = render(&s);
|
||||
assert!(r.contains("Email: 318 new, 4.2 GB"), "{r}");
|
||||
// A type with no measured bytes shows just the count, no size.
|
||||
assert!(r.contains("Calendar: 12 new\n"), "{r}");
|
||||
assert!(r.contains("total: 330 new, 4.2 GB"), "{r}");
|
||||
assert!(r.contains("rough time:"), "{r}");
|
||||
}
|
||||
}
|
||||
@@ -388,6 +388,7 @@ fn run_into(
|
||||
&mut client,
|
||||
&control_ctx,
|
||||
&resolved,
|
||||
common.estimate,
|
||||
logger,
|
||||
)?;
|
||||
return Ok(());
|
||||
@@ -1282,6 +1283,7 @@ fn dry_run_summary(
|
||||
client: &mut ImapClient,
|
||||
control_ctx: &ControlCtx,
|
||||
folders: &[ResolvedFolder],
|
||||
want_sizes: bool,
|
||||
logger: Logger,
|
||||
) -> Result<Summary, Error> {
|
||||
let mut mailbox = TypeCounts::default();
|
||||
@@ -1377,6 +1379,11 @@ fn dry_run_summary(
|
||||
email.created += diff.new.len() as u64;
|
||||
email.deleted += diff.vanished.len() as u64;
|
||||
email.fetched += diff.new.len() as u64;
|
||||
// --estimate: size the new messages without downloading them.
|
||||
if want_sizes && !diff.new.is_empty() {
|
||||
let sizes = fetch_sizes(client, control_ctx, &folder.name, &diff.new, logger);
|
||||
email.bytes += sizes.values().sum::<u64>();
|
||||
}
|
||||
let uv_note = if uv_changed {
|
||||
format!(
|
||||
" (UIDVALIDITY {} -> {})",
|
||||
|
||||
@@ -135,7 +135,7 @@ fn run_into(
|
||||
);
|
||||
|
||||
if common.dry_run {
|
||||
*summary = build_dry_run_summary(&conn, source_id, &resolved, logger)?;
|
||||
*summary = build_dry_run_summary(&conn, source_id, &resolved, common.estimate, logger)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -420,6 +420,7 @@ fn build_dry_run_summary(
|
||||
conn: &Connection,
|
||||
source_id: i64,
|
||||
folders: &[ResolvedFolder],
|
||||
want_sizes: bool,
|
||||
logger: Logger,
|
||||
) -> Result<Summary, Error> {
|
||||
let mut mailbox = TypeCounts::default();
|
||||
@@ -478,6 +479,16 @@ fn build_dry_run_summary(
|
||||
email.fetched += new_count;
|
||||
email.deleted += vanished_count;
|
||||
email.skipped += present_count;
|
||||
// --estimate: the new messages' sizes are free from the filesystem.
|
||||
if want_sizes {
|
||||
for entry in &listing.entries {
|
||||
if !local.contains_key(&entry.unique_id)
|
||||
&& let Ok(meta) = std::fs::metadata(&entry.path)
|
||||
{
|
||||
email.bytes += meta.len();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for name in &vanished_folder_names {
|
||||
if source_id >= 0 {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
pub mod batch;
|
||||
pub mod emailmeta;
|
||||
pub mod estimate;
|
||||
pub mod export;
|
||||
pub mod export_dav;
|
||||
pub mod export_imap;
|
||||
@@ -55,6 +56,10 @@ pub struct CommonConfig {
|
||||
pub archive: PathBuf,
|
||||
pub threads: usize,
|
||||
pub dry_run: bool,
|
||||
/// `--estimate`: a dry run that also measures how much there is to fetch
|
||||
/// -- counts and bytes -- and reports it, before any writes. It implies
|
||||
/// `dry_run`, so an estimate never changes anything.
|
||||
pub estimate: bool,
|
||||
pub max_retries: u32,
|
||||
pub allow_invalid_certs: bool,
|
||||
pub logger: Logger,
|
||||
@@ -90,6 +95,9 @@ pub struct TypeCounts {
|
||||
pub deleted: u64,
|
||||
pub skipped: u64,
|
||||
pub failed: u64,
|
||||
/// Bytes an `--estimate` run measured for what it would fetch, without
|
||||
/// downloading it. Zero on an ordinary run, which never counts them.
|
||||
pub bytes: u64,
|
||||
}
|
||||
|
||||
impl TypeCounts {
|
||||
@@ -176,6 +184,10 @@ impl Context {
|
||||
pub fn dry_run(&self) -> bool {
|
||||
self.common.dry_run
|
||||
}
|
||||
|
||||
pub fn estimate(&self) -> bool {
|
||||
self.common.estimate
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -180,6 +180,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -212,6 +212,7 @@ fn common(archive: &Path, dry_run: bool) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -32,6 +32,7 @@ pub fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 3,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -1397,6 +1397,7 @@ fn dry_run_writes_nothing_but_emits_per_collection_counts() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -1558,6 +1559,7 @@ fn dav_source_change_protection_fires_across_users_on_same_root() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -1711,6 +1713,7 @@ fn dav_common(archive: &std::path::Path) -> inbuxa_migrate::sync::CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::from_flags(true, 0),
|
||||
|
||||
@@ -47,6 +47,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -579,6 +579,7 @@ fn integration_dry_run_against_mock_server_lists_three_surfaces() {
|
||||
archive: tempfile::NamedTempFile::new().unwrap().path().to_owned(),
|
||||
threads: 2,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -691,6 +692,7 @@ fn integration_full_run_mail_only_imports_mime_via_value() {
|
||||
archive: archive_path.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -790,6 +792,7 @@ fn integration_duplicate_message_id_does_not_abort_run() {
|
||||
archive: archive_path.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -906,6 +909,7 @@ fn integration_full_run_is_convergent_on_second_invocation() {
|
||||
archive: path,
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -967,6 +971,7 @@ fn source_change_protection_refuses_a_different_account() {
|
||||
archive,
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -1025,6 +1030,7 @@ fn make_common(archive: std::path::PathBuf) -> inbuxa_migrate::sync::CommonConfi
|
||||
archive,
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -1110,6 +1116,7 @@ fn users_upn_routes_through_users_segment_not_me() {
|
||||
archive: tempfile::NamedTempFile::new().unwrap().path().to_owned(),
|
||||
threads: 2,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -1754,6 +1761,7 @@ fn full_run_records_graph_id_in_sync_id_exchange_graph_with_padding() {
|
||||
archive: archive.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -1827,6 +1835,7 @@ fn archive_mailbox_kind_encodes_synthetic_suffix_in_account_id() {
|
||||
archive: archive.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -1895,6 +1904,7 @@ fn allow_source_change_permits_overwriting_a_different_account() {
|
||||
archive: archive.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -1979,6 +1989,7 @@ fn dry_run_makes_no_per_item_get_and_no_sqlite_writes() {
|
||||
archive: archive.clone(),
|
||||
threads: 2,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -2150,6 +2161,7 @@ fn folder_enumeration_failure_skips_vanished_deletion() {
|
||||
archive: archive.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
@@ -3109,6 +3121,7 @@ fn app_only_signs_in_as_the_app_and_reads_the_named_mailbox() {
|
||||
archive: archive.clone(),
|
||||
threads: 2,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::new(0),
|
||||
|
||||
@@ -170,6 +170,7 @@ fn run_export(archive: &Path, base: &str, threads: usize) -> TypeCounts {
|
||||
archive: archive.to_path_buf(),
|
||||
threads,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -38,6 +38,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -61,6 +61,7 @@ fn dry_run(archive: &Path, base: &str) -> Summary {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 2,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -151,6 +151,7 @@ fn run_import(
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -2672,6 +2673,7 @@ fn dry_run_never_selects_noselect_ancestors() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -30,6 +30,7 @@ fn import(url: &str, archive: &Path) -> Summary {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -1272,6 +1272,7 @@ fn import_aborts_with_exit_two_when_the_advertised_api_url_is_unreachable() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::from_flags(true, 0),
|
||||
@@ -1330,6 +1331,7 @@ fn stay_on_url_sends_the_api_calls_to_the_connect_host() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: inbuxa_migrate::logging::Logger::from_flags(true, 0),
|
||||
|
||||
@@ -34,6 +34,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -139,6 +139,7 @@ fn run_basic(
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -671,6 +672,7 @@ fn transient_no_on_getscript_retries_then_succeeds() {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 3,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -725,6 +727,7 @@ fn bye_mid_listscripts_reconnects_and_succeeds() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 3,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -787,6 +790,7 @@ fn bye_mid_getscript_reconnects_and_completes_remaining_scripts() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 3,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -849,6 +853,7 @@ fn dry_run_does_not_mutate_archive() {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -896,6 +901,7 @@ fn oauthbearer_authenticates_end_to_end_when_advertised() {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -1008,6 +1014,7 @@ fn transient_no_exhausting_max_retries_skips_script_and_followup_picks_it_up() {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 2,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -1123,6 +1130,7 @@ fn export_writes_what_differs_and_moves_the_active_script() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -140,6 +140,7 @@ fn export_email_already_exists_is_matched_not_failed() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -282,6 +283,7 @@ fn export_mailbox_name_collision_merges_without_create() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -441,6 +443,7 @@ fn export_mailbox_already_exists_maps_existing_id() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -607,6 +610,7 @@ fn export_email_blob_not_found_reuploads_and_retries() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -709,6 +713,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -718,6 +723,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
fn common_dry(archive: &Path) -> CommonConfig {
|
||||
CommonConfig {
|
||||
dry_run: true,
|
||||
estimate: false,
|
||||
..common(archive)
|
||||
}
|
||||
}
|
||||
@@ -4330,6 +4336,7 @@ fn export_aborts_with_exit_two_when_the_advertised_api_url_is_unreachable() {
|
||||
archive: archive.clone(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -4500,6 +4507,7 @@ fn run_export(archive: &Path, base: &str, max_retries: u32) -> sync::Summary {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -42,6 +42,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -42,6 +42,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -277,6 +277,7 @@ fn graph_import_survives_a_full_export_to_stalwart() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 2,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -346,6 +347,7 @@ fn graph_import_survives_a_full_export_to_stalwart() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -52,6 +52,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 3,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -253,6 +254,7 @@ fn imap_and_jmap_imports_share_blob_set() {
|
||||
archive: jmap_archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -373,6 +375,7 @@ fn imap_imported_archive_exports_via_jmap() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -398,6 +401,7 @@ fn imap_imported_archive_exports_via_jmap() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -493,6 +497,7 @@ fn dovecot_noselect_parents_keep_the_tree_through_export() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -45,6 +45,7 @@ fn common(archive: &Path, dry_run: bool) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 4,
|
||||
dry_run,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -45,6 +45,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 1,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
@@ -562,6 +563,7 @@ fn maildir_and_jmap_imports_share_blob_bytes() {
|
||||
archive: jmap_archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -639,6 +641,7 @@ fn maildir_message_count_matches_jmap_for_same_corpus() {
|
||||
archive: jmap_archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -51,6 +51,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 3,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -235,6 +236,7 @@ fn managesieve_and_jmap_imports_share_blob_bytes() {
|
||||
archive: jmap_archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -380,6 +382,7 @@ fn managesieve_round_trip_via_jmap_export_converges() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
@@ -415,6 +418,7 @@ fn managesieve_round_trip_via_jmap_export_converges() {
|
||||
archive: archive.clone(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
@@ -23,6 +23,7 @@ fn common_for(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 1,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 0,
|
||||
allow_invalid_certs: false,
|
||||
logger: Logger::from_flags(true, 0),
|
||||
|
||||
@@ -42,6 +42,7 @@ fn common(archive: &Path) -> CommonConfig {
|
||||
archive: archive.to_path_buf(),
|
||||
threads: 4,
|
||||
dry_run: false,
|
||||
estimate: false,
|
||||
max_retries: 5,
|
||||
allow_invalid_certs: true,
|
||||
logger: Logger::from_flags(false, 0),
|
||||
|
||||
Reference in new issue
Block a user