diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2a1b2cb..f101140 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -28,7 +28,7 @@ jobs: - name: get nightly toolchain for jetstream fmt run: rustup toolchain install nightly --allow-downgrade -c rustfmt - name: fmt - run: cargo fmt --package links --package constellation --package ufos --package spacedust --package who-am-i --package slingshot --package pocket -- --check + run: cargo fmt --package constellation --package links --package pocket --package quasar --package slingshot --package spacedust --package ufos -- --check - name: fmt jetstream (nightly) run: cargo +nightly fmt --package jetstream -- --check - name: clippy diff --git a/Cargo.lock b/Cargo.lock index a6a3f07..140124d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -778,6 +778,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.0", +] + [[package]] name = "chrono" version = "0.4.41" @@ -953,6 +964,7 @@ dependencies = [ "bincode 1.3.3", "clap", "ctrlc", + "eat-rocks", "flume", "fs4 0.12.0", "headers-accept", @@ -972,6 +984,8 @@ dependencies = [ "tokio", "tokio-util", "tower-http", + "tracing", + "tracing-subscriber", "tungstenite 0.26.2", "zstd", ] @@ -1031,6 +1045,24 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32c" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47" +dependencies = [ + "rustc_version", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -1381,6 +1413,20 @@ version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" +[[package]] +name = "eat-rocks" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a562da0f74abda90eb1cc96f7adf23a33ce1c71a8d714ae93afa27d33a7a31" +dependencies = [ + "crc32c", + "futures", + "object_store", + "thiserror 2.0.16", + "tokio", + "tracing", +] + [[package]] name = "ecdsa" version = "0.16.9" @@ -1930,11 +1976,25 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.2.0", "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.0", + "wasip2", + "wasip3", +] + [[package]] name = "gimli" version = "0.31.1" @@ -2239,6 +2299,12 @@ dependencies = [ "libm", ] +[[package]] +name = "humantime" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" + [[package]] name = "hyper" version = "1.6.0" @@ -2461,6 +2527,12 @@ dependencies = [ "syn", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -2764,6 +2836,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" version = "0.2.174" @@ -2787,7 +2865,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3005,6 +3083,16 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + [[package]] name = "mea" version = "0.6.3" @@ -3368,6 +3456,44 @@ dependencies = [ "memchr", ] +[[package]] +name = "object_store" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622acbc9100d3c10e2ee15804b0caa40e55c933d5aa53814cd520805b7958a49" +dependencies = [ + "async-trait", + "base64 0.22.1", + "bytes", + "chrono", + "form_urlencoded", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body-util", + "humantime", + "hyper", + "itertools 0.14.0", + "md-5", + "parking_lot", + "percent-encoding", + "quick-xml 0.39.2", + "rand 0.10.1", + "reqwest", + "ring", + "serde", + "serde_json", + "serde_urlencoded", + "thiserror 2.0.16", + "tokio", + "tracing", + "url", + "walkdir", + "wasm-bindgen-futures", + "web-time", +] + [[package]] name = "oid-registry" version = "0.8.1" @@ -3624,7 +3750,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "poem-derive", - "quick-xml", + "quick-xml 0.36.2", "rcgen", "regex", "reqwest", @@ -3676,7 +3802,7 @@ dependencies = [ "num-traits", "poem", "poem-openapi-derive", - "quick-xml", + "quick-xml 0.36.2", "regex", "serde", "serde_json", @@ -3826,6 +3952,16 @@ dependencies = [ "serde", ] +[[package]] +name = "quick-xml" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quick_cache" version = "0.6.12" @@ -3906,6 +4042,12 @@ version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.8.5" @@ -3927,6 +4069,17 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.0", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -3965,6 +4118,12 @@ dependencies = [ "getrandom 0.3.3", ] +[[package]] +name = "rand_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" + [[package]] name = "rand_xoshiro" version = "0.6.0" @@ -4128,6 +4287,7 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", ] @@ -4361,6 +4521,15 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.27" @@ -4672,7 +4841,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -4683,7 +4852,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -5361,9 +5530,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", @@ -5373,9 +5542,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -5384,9 +5553,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -5405,9 +5574,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", "nu-ansi-term", @@ -5689,6 +5858,16 @@ dependencies = [ "atomic-waker", ] +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -5713,6 +5892,24 @@ dependencies = [ "wit-bindgen-rt", ] +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -5784,6 +5981,53 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.11.4", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.2", + "indexmap 2.11.4", + "semver", +] + [[package]] name = "web-sys" version = "0.3.77" @@ -5844,6 +6088,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -6116,6 +6369,26 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + [[package]] name = "wit-bindgen-rt" version = "0.39.0" @@ -6125,6 +6398,74 @@ dependencies = [ "bitflags", ] +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.11.4", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap 2.11.4", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.11.4", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "write16" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index ee6470b..b613c6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,5 @@ members = [ [workspace.dependencies] clap = { version = "4.5.56", features = ["derive", "env"] } +tracing = "0.1.44" +tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } diff --git a/constellation/Cargo.toml b/constellation/Cargo.toml index 18cd525..5c099f9 100644 --- a/constellation/Cargo.toml +++ b/constellation/Cargo.toml @@ -13,6 +13,7 @@ axum-metrics = "0.2" bincode = "1.3.3" clap = { workspace = true } ctrlc = "3.4.5" +eat-rocks = { version = "0.1.1", optional = true, features = ["easy"] } flume = { version = "0.11.1", default-features = false } fs4 = { version = "0.12.0", features = ["sync"] } headers-accept = "0.1.4" @@ -30,6 +31,8 @@ serde_with = { version = "3.12.0", features = ["hex"] } tinyjson = "2.5.1" tokio-util = "0.7.13" tower-http = { version = "0.6.2", features = ["cors"] } +tracing = { version = "0.1.44", workspace = true } +tracing-subscriber = { version = "0.3.23", workspace = true } zstd = "0.13.2" [dependencies.tokio] @@ -45,4 +48,4 @@ tempfile = "3.15.0" [features] default = ["rocks"] -rocks = ["dep:rocksdb"] +rocks = ["dep:rocksdb", "dep:eat-rocks"] diff --git a/constellation/src/bin/rocks-restore-from-backup.rs b/constellation/src/bin/rocks-restore-from-backup.rs index 737d720..5ae6765 100644 --- a/constellation/src/bin/rocks-restore-from-backup.rs +++ b/constellation/src/bin/rocks-restore-from-backup.rs @@ -2,55 +2,137 @@ use crate::time::Instant; use anyhow::Result; use clap::Parser; use std::path::PathBuf; +use std::time; +use tracing::{error, info}; #[cfg(feature = "rocks")] use rocksdb::backup::{BackupEngine, BackupEngineOptions, RestoreOptions}; -use std::time; - -/// Aggregate links in the at-mosphere +/// Restore a rocksdb database #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { - /// the backup directory to restore *from* + /// the directory to restore the database into + dest: PathBuf, + /// restore from a rocksdb backup folder + #[arg(long, conflicts_with_all = ["endpoint", "prefix", "concurrency"])] + fs_dir: Option, + /// restore from public object storage + #[arg(long, default_value = "https://constellation.t3.storage.dev")] + endpoint: String, + /// specific backup to restore (default: latest) #[arg(long)] - from_backup_dir: PathBuf, - /// the db dir to restore *to* + backup: Option, + /// object-store key prefix + #[arg(long, default_value = "")] + prefix: String, + /// concurrency limit for object storage operations + /// + /// TODO: wire this through for the filesystem mode as well. #[arg(long)] - to_data_dir: PathBuf, + concurrency: Option, } #[cfg(feature = "rocks")] fn main() -> Result<()> { - let args = Args::parse(); - - eprintln!( - "restoring latest rocksdb backup from {:?} to {:?}...", - args.from_backup_dir, args.to_data_dir - ); - - let mut engine = BackupEngine::open( - &BackupEngineOptions::new(args.from_backup_dir)?, - &rocksdb::Env::new()?, - )?; + use tracing_subscriber::EnvFilter; + tracing_subscriber::fmt() + .with_env_filter( + EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")), + ) + .init(); + let args = Args::parse(); let t0 = Instant::now(); - if let Err(e) = engine.restore_from_latest_backup( - &args.to_data_dir, - &args.to_data_dir, - &RestoreOptions::default(), - ) { - eprintln!( - "restoring from backup failed after {:?}: {e:?}", - t0.elapsed() + + let result = if let Some(fs_dir) = args.fs_dir { + info!( + ?fs_dir, + ?args.dest, + backup = describe_backup(args.backup), + mode = "rocksdb fs", + "restoring rocksdb backup..." ); + restore_from_dir(&fs_dir, &args.dest, args.backup) } else { - eprintln!( - "success, restored latest from backup after {:?}", - t0.elapsed() + info!( + args.endpoint, + args.prefix, + ?args.dest, + backup = describe_backup(args.backup), + mode = "eat-rocks object storage", + "restoring rocksdb backup..." ); + restore_from_object_store( + &args.endpoint, + &args.prefix, + &args.dest, + args.backup, + args.concurrency, + ) + }; + + match result { + Ok(()) => info!( + elapsed = ?t0.elapsed(), + "backup restored." + ), + Err(err) => error!( + ?err, + elapsed = ?t0.elapsed(), + "failed to restore backup." + ), } + Ok(()) +} + +fn describe_backup(backup: Option) -> String { + match backup { + Some(id) => format!("#{id}"), + None => "(latest)".to_string(), + } +} + +#[cfg(feature = "rocks")] +fn restore_from_dir( + fs_dir: &std::path::Path, + dest: &std::path::Path, + backup_id: Option, +) -> Result<()> { + let mut engine = BackupEngine::open(&BackupEngineOptions::new(fs_dir)?, &rocksdb::Env::new()?)?; + let opts = RestoreOptions::default(); + match backup_id { + Some(id) => engine.restore_from_backup(dest, dest, &opts, id)?, + None => engine.restore_from_latest_backup(dest, dest, &opts)?, + } + Ok(()) +} + +#[cfg(feature = "rocks")] +fn restore_from_object_store( + endpoint: &str, + prefix: &str, + dest: &std::path::Path, + backup_id: Option, + concurrency: Option, +) -> Result<()> { + use eat_rocks::{public_bucket, restore, RestoreOptions}; + use tokio::runtime::Runtime; - eprintln!("bye."); + let rt = Runtime::new()?; + rt.block_on(async { + let store = public_bucket(endpoint)?; + restore( + store, + prefix, + dest, + RestoreOptions { + backup_id: backup_id.map(u64::from), + concurrency: concurrency.unwrap_or(RestoreOptions::default().concurrency), + ..Default::default() + }, + ) + .await + })?; Ok(()) } -- 2.51.2 From c4a1e87d3426f65fdbd68c1dca37eae4af27d27c Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 13 Apr 2026 17:42:46 -0400 Subject: [PATCH 2/2] log concurrency setting --- constellation/src/bin/rocks-restore-from-backup.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/constellation/src/bin/rocks-restore-from-backup.rs b/constellation/src/bin/rocks-restore-from-backup.rs index 5ae6765..0ad0583 100644 --- a/constellation/src/bin/rocks-restore-from-backup.rs +++ b/constellation/src/bin/rocks-restore-from-backup.rs @@ -59,6 +59,7 @@ fn main() -> Result<()> { args.endpoint, args.prefix, ?args.dest, + ?args.concurrency, backup = describe_backup(args.backup), mode = "eat-rocks object storage", "restoring rocksdb backup..."