mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-07 04:25:54 +00:00
perf(ecstore): use AHashMap for FileInfo metadata fields (#6738)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user