mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
improve code run fun
This commit is contained in:
@@ -5,7 +5,7 @@ sample_ratio = 2.0 # 采样率,表示每 2 条数据采样 1
|
|||||||
meter_interval = 30 # 指标收集间隔,单位为秒
|
meter_interval = 30 # 指标收集间隔,单位为秒
|
||||||
service_name = "rustfs" # 服务名称,用于标识当前服务
|
service_name = "rustfs" # 服务名称,用于标识当前服务
|
||||||
service_version = "0.1.0" # 服务版本号
|
service_version = "0.1.0" # 服务版本号
|
||||||
environments = "develop" # 运行环境,如开发环境 (develop)
|
environment = "develop" # 运行环境,如开发环境 (develop)
|
||||||
logger_level = "debug" # 日志级别,可选 debug/info/warn/error 等
|
logger_level = "debug" # 日志级别,可选 debug/info/warn/error 等
|
||||||
local_logging_enabled = true # 是否启用本地 stdout 日志记录,true 表示启用,false 表示禁用
|
local_logging_enabled = true # 是否启用本地 stdout 日志记录,true 表示启用,false 表示禁用
|
||||||
|
|
||||||
|
|||||||
+13
-8
@@ -53,6 +53,7 @@ use madmin::heal_commands::HealResultItem;
|
|||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use s3s::dto::{BucketVersioningStatus, ObjectLockConfiguration, ObjectLockEnabled, VersioningConfiguration};
|
use s3s::dto::{BucketVersioningStatus, ObjectLockConfiguration, ObjectLockEnabled, VersioningConfiguration};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
use std::net::SocketAddr;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::slice::Iter;
|
use std::slice::Iter;
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
@@ -100,7 +101,7 @@ pub struct ECStore {
|
|||||||
impl ECStore {
|
impl ECStore {
|
||||||
#[allow(clippy::new_ret_no_self)]
|
#[allow(clippy::new_ret_no_self)]
|
||||||
#[tracing::instrument(level = "debug", skip(endpoint_pools))]
|
#[tracing::instrument(level = "debug", skip(endpoint_pools))]
|
||||||
pub async fn new(_address: String, endpoint_pools: EndpointServerPools) -> Result<Arc<Self>> {
|
pub async fn new(address: SocketAddr, endpoint_pools: EndpointServerPools) -> Result<Arc<Self>> {
|
||||||
// let layouts = DisksLayout::from_volumes(endpoints.as_slice())?;
|
// let layouts = DisksLayout::from_volumes(endpoints.as_slice())?;
|
||||||
|
|
||||||
let mut deployment_id = None;
|
let mut deployment_id = None;
|
||||||
@@ -113,13 +114,17 @@ impl ECStore {
|
|||||||
let first_is_local = endpoint_pools.first_local();
|
let first_is_local = endpoint_pools.first_local();
|
||||||
|
|
||||||
let mut local_disks = Vec::new();
|
let mut local_disks = Vec::new();
|
||||||
|
info!("ECStore new address: {}", address.to_string());
|
||||||
init_local_peer(
|
let mut host = address.ip().to_string();
|
||||||
&endpoint_pools,
|
if host.is_empty() {
|
||||||
&GLOBAL_Rustfs_Host.read().await.to_string(),
|
host = GLOBAL_Rustfs_Host.read().await.to_string()
|
||||||
&GLOBAL_Rustfs_Port.read().await.to_string(),
|
}
|
||||||
)
|
let mut port = address.port().to_string();
|
||||||
.await;
|
if port.is_empty() {
|
||||||
|
port = GLOBAL_Rustfs_Port.read().await.to_string()
|
||||||
|
}
|
||||||
|
info!("ECStore new host: {}, port: {}", host, port);
|
||||||
|
init_local_peer(&endpoint_pools, &host, &port).await;
|
||||||
|
|
||||||
// debug!("endpoint_pools: {:?}", endpoint_pools);
|
// debug!("endpoint_pools: {:?}", endpoint_pools);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -497,7 +497,7 @@ async fn run(opt: config::Opt) -> Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// init store
|
// init store
|
||||||
let store = ECStore::new(server_address.clone(), endpoint_pools.clone())
|
let store = ECStore::new(server_addr.clone(), endpoint_pools.clone())
|
||||||
.await
|
.await
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
error!("ECStore::new {:?}", &err);
|
error!("ECStore::new {:?}", &err);
|
||||||
|
|||||||
Reference in New Issue
Block a user