perf(ecstore): use AHashMap for FileInfo metadata fields (#6738)

This commit is contained in:
houseme
2026-08-27 18:34:10 +08:00
committed by GitHub
parent 94a6da6e83
commit 13a2ae212e
26 changed files with 141 additions and 87 deletions
+7 -2
View File
@@ -89,7 +89,9 @@ pub fn is_object_encryption_marker(key: &str) -> bool {
}
/// Reads the logical object size recorded by encryption metadata.
pub fn get_object_encryption_original_size(metadata: &std::collections::HashMap<String, String>) -> std::io::Result<Option<i64>> {
pub fn get_object_encryption_original_size<S: std::hash::BuildHasher>(
metadata: &std::collections::HashMap<String, String, S>,
) -> std::io::Result<Option<i64>> {
let actual_size = super::get_str(metadata, super::SUFFIX_ACTUAL_SIZE);
let size = get_case_insensitive(metadata, RUSTFS_ENCRYPTION_ORIGINAL_SIZE)
.or_else(|| get_case_insensitive(metadata, SSEC_ORIGINAL_SIZE))
@@ -103,7 +105,10 @@ pub fn get_object_encryption_original_size(metadata: &std::collections::HashMap<
.map_err(|error| std::io::Error::other(format!("Failed to parse encryption original size: {error}")))
}
fn get_case_insensitive<'a>(metadata: &'a std::collections::HashMap<String, String>, key: &str) -> Option<&'a str> {
fn get_case_insensitive<'a, S: std::hash::BuildHasher>(
metadata: &'a std::collections::HashMap<String, String, S>,
key: &str,
) -> Option<&'a str> {
metadata.get(key).map(String::as_str).or_else(|| {
metadata
.iter()