mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-28 17:18:58 +00:00
test accountinfo
This commit is contained in:
@@ -14,7 +14,7 @@ use super::condition::{
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||
|
||||
pub struct ActionSet(HashSet<Action>);
|
||||
pub struct ActionSet(pub HashSet<Action>);
|
||||
|
||||
impl ActionSet {
|
||||
pub fn is_match(&self, act: &Action) -> bool {
|
||||
|
||||
@@ -41,6 +41,12 @@ pub struct Resource {
|
||||
}
|
||||
|
||||
impl Resource {
|
||||
pub fn new(pattern: &str) -> Self {
|
||||
Self {
|
||||
pattern: pattern.to_owned(),
|
||||
rtype: ResourceARNType::ResourceARNS3,
|
||||
}
|
||||
}
|
||||
pub fn validate_bucket(&self, bucket: &str) -> Result<()> {
|
||||
self.validate()?;
|
||||
if !wildcard::match_pattern(&self.pattern, bucket)
|
||||
@@ -187,7 +193,7 @@ impl<'de> Deserialize<'de> for Resource {
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
|
||||
#[serde(transparent)]
|
||||
pub struct ResourceSet(HashSet<Resource>);
|
||||
pub struct ResourceSet(pub HashSet<Resource>);
|
||||
|
||||
impl ResourceSet {
|
||||
pub fn validate_bucket(&self, bucket: &str) -> Result<()> {
|
||||
|
||||
+12
-11
@@ -819,7 +819,7 @@ lazy_static! {
|
||||
#[async_trait::async_trait]
|
||||
impl StorageAPI for ECStore {
|
||||
async fn backend_info(&self) -> BackendInfo {
|
||||
let (standard_scparities, rrscparities) = {
|
||||
let (standard_sc_parity, rr_sc_parity) = {
|
||||
if let Some(sc) = GLOBAL_StorageClass.get() {
|
||||
let sc_parity = sc
|
||||
.get_parity_for_sc(storageclass::CLASS_STANDARD)
|
||||
@@ -833,17 +833,17 @@ impl StorageAPI for ECStore {
|
||||
}
|
||||
};
|
||||
|
||||
let mut standard_scdata = Vec::new();
|
||||
let mut rrscdata = Vec::new();
|
||||
let mut standard_sc_data = Vec::new();
|
||||
let mut rr_sc_data = Vec::new();
|
||||
let mut drives_per_set = Vec::new();
|
||||
let mut total_sets = Vec::new();
|
||||
|
||||
for (idx, set_count) in self.set_drive_counts().iter().enumerate() {
|
||||
if let Some(sc_parity) = standard_scparities {
|
||||
standard_scdata.push(set_count - sc_parity);
|
||||
if let Some(sc_parity) = standard_sc_parity {
|
||||
standard_sc_data.push(set_count - sc_parity);
|
||||
}
|
||||
if let Some(rr_sc_parity) = rrscparities {
|
||||
rrscdata.push(set_count - rr_sc_parity);
|
||||
if let Some(sc_parity) = rr_sc_parity {
|
||||
rr_sc_data.push(set_count - sc_parity);
|
||||
}
|
||||
total_sets.push(self.pools[idx].set_count);
|
||||
drives_per_set.push(*set_count);
|
||||
@@ -853,12 +853,13 @@ impl StorageAPI for ECStore {
|
||||
backend_type: BackendByte::Erasure,
|
||||
online_disks: BackendDisks::new(),
|
||||
offline_disks: BackendDisks::new(),
|
||||
standard_scdata,
|
||||
standard_scparities,
|
||||
rrscdata,
|
||||
rrscparities,
|
||||
standard_sc_data,
|
||||
standard_sc_parity,
|
||||
rr_sc_data,
|
||||
rr_sc_parity,
|
||||
total_sets,
|
||||
drives_per_set,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
async fn storage_info(&self) -> StorageInfo {
|
||||
|
||||
@@ -780,7 +780,7 @@ pub struct DeletedObject {
|
||||
// pub replication_state: ReplicationState,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
pub enum BackendByte {
|
||||
#[default]
|
||||
Unknown,
|
||||
@@ -824,7 +824,7 @@ pub struct StorageInfo {
|
||||
pub backend: BackendInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
pub struct BackendDisks(HashMap<String, usize>);
|
||||
|
||||
impl BackendDisks {
|
||||
@@ -836,15 +836,24 @@ impl BackendDisks {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
#[serde(rename_all = "PascalCase", default)]
|
||||
pub struct BackendInfo {
|
||||
pub backend_type: BackendByte,
|
||||
pub online_disks: BackendDisks,
|
||||
pub offline_disks: BackendDisks,
|
||||
pub standard_scdata: Vec<usize>,
|
||||
pub standard_scparities: Option<usize>,
|
||||
pub rrscdata: Vec<usize>,
|
||||
pub rrscparities: Option<usize>,
|
||||
#[serde(rename = "StandardSCData")]
|
||||
pub standard_sc_data: Vec<usize>,
|
||||
#[serde(rename = "StandardSCParities")]
|
||||
pub standard_sc_parities: Vec<usize>,
|
||||
#[serde(rename = "StandardSCParity")]
|
||||
pub standard_sc_parity: Option<usize>,
|
||||
#[serde(rename = "RRSCData")]
|
||||
pub rr_sc_data: Vec<usize>,
|
||||
#[serde(rename = "RRSCParities")]
|
||||
pub rr_sc_parities: Vec<usize>,
|
||||
#[serde(rename = "RRSCParity")]
|
||||
pub rr_sc_parity: Option<usize>,
|
||||
pub total_sets: Vec<usize>,
|
||||
pub drives_per_set: Vec<usize>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user