Skip to content

Commit 0b72ed5

Browse files
StripCmqPolicies => StripCmqKeysFromPolicies
1 parent 1c7e503 commit 0b72ed5

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
## v0.27.0 (in development)
44

5-
No changes yet.
5+
* `ClusterDefinitionSet` transformations are maturing.
6+
7+
There are two `transformations::DefinitionSetTransformer`s
8+
available: one that removes classic queue mirroring-related (from the 3.13.x era) policy keys, and another
9+
that removes policies with empty definitions.
10+
11+
The two are supposed to be used together.
612

713

814
## v0.26.0 (Mar 10, 2024)

src/transformers.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ pub type TransformerFnOnce<T> = Box<dyn FnOnce(T) -> T>;
2424

2525
pub type TransformerFnMut<T> = Box<dyn FnMut(T) -> T>;
2626

27-
#[derive(Default)]
28-
pub struct StripCmqPolicies {}
27+
#[derive(Default, Debug)]
28+
pub struct StripCmqKeysFromPolicies {}
2929

30-
impl DefinitionSetTransformer for StripCmqPolicies {
30+
impl DefinitionSetTransformer for StripCmqKeysFromPolicies {
3131
fn transform<'a>(&self, defs: &'a mut ClusterDefinitionSet) -> &'a mut ClusterDefinitionSet {
3232
let pf = Box::new(|p: Policy| p.without_cmq_keys());
3333
let matched_policies = defs.update_policies(pf);
@@ -41,7 +41,7 @@ impl DefinitionSetTransformer for StripCmqPolicies {
4141
}
4242
}
4343

44-
#[derive(Default)]
44+
#[derive(Default, Debug)]
4545
pub struct DropEmptyPolicies {}
4646

4747
impl DefinitionSetTransformer for DropEmptyPolicies {
@@ -70,10 +70,11 @@ pub struct TransformationChain {
7070
impl From<Vec<&str>> for TransformationChain {
7171
fn from(names: Vec<&str>) -> Self {
7272
let mut vec: Vec<Box<dyn DefinitionSetTransformer>> = Vec::new();
73+
dbg!(&names);
7374
for name in names {
7475
match name {
75-
"strip_cmq_policies" => {
76-
vec.push(Box::new(StripCmqPolicies::default()));
76+
"strip_cmq_keys_from_policies" => {
77+
vec.push(Box::new(StripCmqKeysFromPolicies::default()));
7778
}
7879
"drop_empty_policies" => {
7980
vec.push(Box::new(DropEmptyPolicies::default()));
@@ -107,4 +108,8 @@ impl TransformationChain {
107108

108109
defs
109110
}
111+
112+
pub fn len(&self) -> usize {
113+
self.chain.len()
114+
}
110115
}

0 commit comments

Comments
 (0)