Skip to content

Conversation

@weisd
Copy link
Contributor

@weisd weisd commented Oct 22, 2025

Pull Request: Refactor object metadata filtering logic

Summary

This PR refactors the filter_object_metadata function by moving it from ecfs.rs to options.rs and improving its implementation to properly handle metadata prefixes.

Changes Made

Files Modified:

  • rustfs/src/storage/ecfs.rs: Removed the filter_object_metadata function (35 lines removed)
  • rustfs/src/storage/options.rs: Added the filter_object_metadata function with improved logic (37 lines added)

Key Improvements:

  1. Code Organization: Moved the metadata filtering function from ecfs.rs to options.rs for better code organization and reusability
  2. Enhanced Metadata Handling: Improved the function to properly strip prefixes from metadata keys:
    • Handles x-amz-meta- prefixes correctly
    • Handles x-rustfs-meta- prefixes correctly
    • Removes prefixes and stores clean key-value pairs
  3. Import Cleanup: Added necessary imports in options.rs for the function dependencies
  4. Code Deduplication: Centralized metadata filtering logic in a more appropriate module

Technical Details:

  • The function now properly processes metadata keys by removing standard prefixes
  • Maintains backward compatibility with existing metadata filtering behavior
  • Filters out reserved metadata, empty object lock fields, and unencrypted content metadata
  • Returns None for empty filtered metadata, Some(HashMap) otherwise

Testing

  • Unit tests pass
  • Integration tests pass
  • Manual testing of metadata filtering functionality

Impact

  • Low Risk: This is a refactoring change that improves code organization
  • No Breaking Changes: Function behavior remains the same
  • Better Maintainability: Centralized metadata filtering logic

@weisd weisd merged commit d9e5f5d into main Oct 22, 2025
14 checks passed
@weisd weisd deleted the fix/filtermata branch October 22, 2025 02:35
houseme pushed a commit that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant