mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 21:07:43 +00:00
+16
-12
@@ -2,13 +2,14 @@ pub mod handlers;
|
||||
pub mod router;
|
||||
|
||||
use common::error::Result;
|
||||
use ecstore::global::{is_dist_erasure, is_erasure};
|
||||
use hyper::Method;
|
||||
use router::{AdminOperation, S3Router};
|
||||
use s3s::route::S3Route;
|
||||
|
||||
const ADMIN_PREFIX: &str = "/rustfs/admin";
|
||||
|
||||
pub fn make_admin_route() -> Result<impl S3Route> {
|
||||
pub async fn make_admin_route() -> Result<impl S3Route> {
|
||||
let mut r = S3Router::new();
|
||||
|
||||
r.insert(Method::POST, "/", AdminOperation(&handlers::AssumeRoleHandle {}))?;
|
||||
@@ -53,17 +54,6 @@ pub fn make_admin_route() -> Result<impl S3Route> {
|
||||
AdminOperation(&handlers::MetricsHandler {}),
|
||||
)?;
|
||||
|
||||
r.insert(
|
||||
Method::POST,
|
||||
format!("{}{}", ADMIN_PREFIX, "/v3/heal/{bucket}/{prefix}").as_str(),
|
||||
AdminOperation(&handlers::HealHandler {}),
|
||||
)?;
|
||||
r.insert(
|
||||
Method::POST,
|
||||
format!("{}{}", ADMIN_PREFIX, "/v3/background-heal/status").as_str(),
|
||||
AdminOperation(&handlers::BackgroundHealStatusHandler {}),
|
||||
)?;
|
||||
|
||||
r.insert(
|
||||
Method::GET,
|
||||
format!("{}{}", ADMIN_PREFIX, "/v3/pools/list").as_str(),
|
||||
@@ -101,5 +91,19 @@ pub fn make_admin_route() -> Result<impl S3Route> {
|
||||
AdminOperation(&handlers::RebalanceStop {}),
|
||||
)?;
|
||||
|
||||
// Some APIs are only available in EC mode
|
||||
// if is_dist_erasure().await || is_erasure().await {
|
||||
r.insert(
|
||||
Method::POST,
|
||||
format!("{}{}", ADMIN_PREFIX, "/v3/heal/{bucket}/{prefix}").as_str(),
|
||||
AdminOperation(&handlers::HealHandler {}),
|
||||
)?;
|
||||
r.insert(
|
||||
Method::POST,
|
||||
format!("{}{}", ADMIN_PREFIX, "/v3/background-heal/status").as_str(),
|
||||
AdminOperation(&handlers::BackgroundHealStatusHandler {}),
|
||||
)?;
|
||||
// }
|
||||
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
+6
-2
@@ -10,7 +10,7 @@ use clap::Parser;
|
||||
use common::error::{Error, Result};
|
||||
use ecstore::{
|
||||
endpoints::EndpointServerPools,
|
||||
heal::data_scanner::init_data_scanner,
|
||||
heal::{background_heal_ops::init_auto_heal, data_scanner::init_data_scanner},
|
||||
set_global_endpoints,
|
||||
store::{init_local_disks, ECStore},
|
||||
update_erasure_type,
|
||||
@@ -192,7 +192,11 @@ async fn run(opt: config::Opt) -> Result<()> {
|
||||
})?;
|
||||
warn!(" init store success!");
|
||||
// init scanner
|
||||
init_data_scanner().await;
|
||||
// init_data_scanner().await;
|
||||
// // init auto heal
|
||||
// init_auto_heal().await;
|
||||
|
||||
info!("server was started");
|
||||
|
||||
tokio::select! {
|
||||
_ = tokio::signal::ctrl_c() => {
|
||||
|
||||
Reference in New Issue
Block a user