Commit 2ea139c
authored
refactor: flow control config (#1581)
* refactor: Standardize FC config validation pattern
Introduces a consistent `ValidateAndApplyDefaults` method to the
configuration structs in the `flowcontrol/controller` and
`flowcontrol/registry` packages.
This change refactors the configuration handling to follow a unified
pattern:
- Configuration structs now have a `ValidateAndApplyDefaults` method
that returns a new, validated config object without mutating the
original.
- Constructors for `FlowController` and `FlowRegistry` now assume they
receive a valid configuration, simplifying their logic and pushing the
responsibility of validation to the caller.
- The `deepCopy` logic is corrected to ensure test assertions for
immutability pass reliably.
This improves the clarity and robustness of configuration management
within the flow control module, creating a consistent foundation for
future wiring work.
* feat(flowcontrol): Add bundled Flow Control config
Introduces a new top-level `Config` for the Flow Control layer.
This config bundles the configurations for the `controller` and
`registry` packages, providing a single, unified point of entry fo
validation and default application. This simplifies the management and
initialization of the flow control system by centralizing its
configuration.
* fix: Update controller tests with valid config
The previous commit introduced a unified and validated configuration
for the flow control system, requiring callers to pass a pre-validated
cofig to the controller and registry respectively. This change updates
the controller tests to provide a valid configuration instead of relying
on the now-removed defaulting logic in the constructor.1 parent 771dc5e commit 2ea139c
File tree
11 files changed
+245
-195
lines changed- pkg/epp/flowcontrol
- controller
- registry
11 files changed
+245
-195
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
66 | 61 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | 62 | | |
71 | | - | |
72 | | - | |
| 63 | + | |
| 64 | + | |
73 | 65 | | |
74 | | - | |
75 | | - | |
| 66 | + | |
| 67 | + | |
76 | 68 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
80 | 72 | | |
81 | | - | |
82 | | - | |
| 73 | + | |
| 74 | + | |
83 | 75 | | |
84 | 76 | | |
85 | 77 | | |
86 | | - | |
87 | | - | |
| 78 | + | |
| 79 | + | |
88 | 80 | | |
89 | | - | |
90 | | - | |
| 81 | + | |
| 82 | + | |
91 | 83 | | |
92 | | - | |
93 | | - | |
| 84 | + | |
| 85 | + | |
94 | 86 | | |
95 | | - | |
| 87 | + | |
96 | 88 | | |
97 | 89 | | |
98 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 121 | | |
127 | | - | |
| 122 | + | |
128 | 123 | | |
129 | 124 | | |
130 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | 276 | | |
294 | 277 | | |
295 | 278 | | |
| |||
813 | 796 | | |
814 | 797 | | |
815 | 798 | | |
| 799 | + | |
816 | 800 | | |
817 | 801 | | |
818 | 802 | | |
| |||
0 commit comments