refactor(lifecycle): reuse the replication tag parser (#6761)

`crates/lifecycle/src/tagging.rs` carried a byte-identical copy of the `form_urlencoded` tag decoder already owned by `rustfs-replication`, plus a duplicate of its test. Since `crates/lifecycle` already depends on `rustfs-replication`, replace the copy with a `pub(crate) use` re-export: no new crate edge, one parser, and no second implementation to drift from the replication contract. The `rule.rs` call site is unchanged.

Also drop `crates/ecstore/src/bucket/lifecycle/tagging_boundary.rs`, a migration-era boundary shim with zero call sites in the tree.
This commit is contained in:
Zhengchao An
2026-08-28 06:56:13 +08:00
committed by GitHub
parent 2e6511566e
commit 921a48bd14
3 changed files with 6 additions and 68 deletions
+6 -30
View File
@@ -12,34 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::collections::HashMap;
//! Lifecycle tag decoding reuses the parser owned by `rustfs-replication`.
//!
//! `crates/lifecycle` already depends on `rustfs-replication`, so this is a
//! plain re-export: no new crate edge, and no second copy of the parser to
//! drift from the replication contract.
use url::form_urlencoded;
pub(crate) fn decode_tags_to_map(tags: &str) -> HashMap<String, String> {
let mut list = HashMap::new();
for (k, v) in form_urlencoded::parse(tags.as_bytes()) {
if k.is_empty() {
continue;
}
list.insert(k.to_string(), v.to_string());
}
list
}
#[cfg(test)]
mod tests {
use super::decode_tags_to_map;
#[test]
fn decode_tags_to_map_preserves_bucket_tagging_parser_behavior() {
let tags = decode_tags_to_map("env=prod&encoded=a%2Fb&=ignored");
assert_eq!(tags.get("env").map(String::as_str), Some("prod"));
assert_eq!(tags.get("encoded").map(String::as_str), Some("a/b"));
assert!(!tags.contains_key(""));
}
}
pub(crate) use rustfs_replication::tagging::decode_tags_to_map;