diff --git a/Cargo.lock b/Cargo.lock index aeadb7866..a9fac1098 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9503,6 +9503,7 @@ dependencies = [ "clap", "const-str", "datafusion", + "faster-hex", "flatbuffers", "flate2", "futures", diff --git a/crates/ecstore/src/bucket/metadata_sys.rs b/crates/ecstore/src/bucket/metadata_sys.rs index 5e30841ad..7b36a1647 100644 --- a/crates/ecstore/src/bucket/metadata_sys.rs +++ b/crates/ecstore/src/bucket/metadata_sys.rs @@ -1043,11 +1043,8 @@ pub async fn get_on_demand_migration_config(bucket: &str) -> Result Result, OffsetDateTime)>> { - let sys = bucket_metadata_sys_of(ctx)?; +pub async fn get_on_demand_migration_config_in(api: &ECStore, bucket: &str) -> Result, OffsetDateTime)>> { + let sys = bucket_metadata_sys_of(&api.ctx)?; let lock = sys.read().await; lock.get_on_demand_migration_config(bucket).await } diff --git a/crates/ecstore/src/store/init.rs b/crates/ecstore/src/store/init.rs index 63d2b5fdd..764e48391 100644 --- a/crates/ecstore/src/store/init.rs +++ b/crates/ecstore/src/store/init.rs @@ -353,6 +353,11 @@ async fn resume_rebalance_after_init(store: Arc, rx: CancellationToken) } impl ECStore { + /// Shutdown token owned by this store instance. + pub fn background_cancel_token(&self) -> Option { + self.ctx.background_cancel_token() + } + /// Validate topology and process storage-class overrides before any disk is opened. pub fn validate_startup_storage_class(endpoint_pools: &EndpointServerPools) -> Result<()> { let drive_counts = startup_pool_drive_counts(endpoint_pools); diff --git a/crates/madmin/src/on_demand_migration.rs b/crates/madmin/src/on_demand_migration.rs index 0fce8af6c..e92899717 100644 --- a/crates/madmin/src/on_demand_migration.rs +++ b/crates/madmin/src/on_demand_migration.rs @@ -17,7 +17,7 @@ //! Wire types for `PUT`/`GET`/`DELETE /v3/on-demand-migration/{bucket}`, //! `GET .../status`, `POST .../backfill?op=start|cancel` and //! `GET .../backfill` (ODM-12), mirroring the server's config model -//! (`crates/ecstore/src/bucket/on_demand_migration/config.rs`) and handler +//! (`rustfs/src/on_demand_migration/config.rs`) and handler //! responses (`rustfs/src/admin/handlers/on_demand_migration.rs`). The SDK //! owns its own copies, madmin-go style; the fixtures under //! `fixtures/on_demand_migration/` are the contract both sides pin diff --git a/rustfs/Cargo.toml b/rustfs/Cargo.toml index aabf2d865..52a7e6598 100644 --- a/rustfs/Cargo.toml +++ b/rustfs/Cargo.toml @@ -276,6 +276,7 @@ rcgen = { workspace = true } # Async Runtime and Networking async-trait = { workspace = true } axum.workspace = true +faster-hex.workspace = true futures.workspace = true futures-lite.workspace = true futures-util.workspace = true diff --git a/rustfs/src/on_demand_migration/backfill.rs b/rustfs/src/on_demand_migration/backfill.rs index 8cc384ec8..f2d14b61d 100644 --- a/rustfs/src/on_demand_migration/backfill.rs +++ b/rustfs/src/on_demand_migration/backfill.rs @@ -471,7 +471,7 @@ impl BackfillContext for BucketBackfillContext { async fn config_updated_at(&self) -> Result, StorageError> { Ok( - super::config::decode_stored_config(get_on_demand_migration_config_in(&self.api.ctx, self.state.bucket()).await?)? + super::config::decode_stored_config(get_on_demand_migration_config_in(&self.api, self.state.bucket()).await?)? .map(|(_, updated_at)| updated_at), ) } @@ -1472,7 +1472,7 @@ impl Job { /// Spawns [`run_backfill_recovery_loop`] on the store's shutdown token; /// `false` (nothing spawned) when the store has no background token. pub fn spawn_backfill_recovery_loop(runner: Arc) -> bool { - let Some(cancel) = runner.api.ctx.background_cancel_token() else { + let Some(cancel) = runner.api.background_cancel_token() else { return false; }; tokio::spawn(run_backfill_recovery_loop(runner, cancel));