Commit 9ddbeeb
authored
Subset of #6700
Motivation
`HttpFilterFactory<T extends Message>` forced each factory
implementation to declare a specific protobuf `Message` type for its
config, and required the framework to own config parsing and
`FilterConfig` envelope unwrapping. This made it difficult to handle
unknown or dynamically-typed xDS filter configs (e.g. Istio-specific
filters), and leaked framework concerns into the factory API.
Additionally, `ParsedFilterConfig` wrapped per-route filter configs and
required the framework to merge and propagate them through the snapshot
hierarchy (`RouteSnapshot` → `VirtualHostSnapshot` → `RouteEntry`),
coupling snapshot construction to filter logic.
Modifications
- Replace `HttpFilterFactory<T extends Message>` with an untyped
`HttpFilterFactory` interface; `create(HttpFilter, Any)` now receives
the raw `Any` config directly, and factories are responsible for all
parsing including `FilterConfig` envelope unwrapping. Returning `null`
skips the filter.
- Introduce `XdsHttpFilter` as the return type of `create()`, with
default no-op `httpPreprocessor()`, `rpcPreprocessor()`,
`httpDecorator()`, and `rpcDecorator()` methods.
- Delete `ParsedFilterConfig`; per-route filter configs are now stored
and merged as `Map<String, Any>` directly.
- Move 3-level `typed_per_filter_config` merging (route-config → vhost →
route) into `RouteEntry`'s constructor, eliminating
`withFilterConfigs()` from `VirtualHostSnapshot` and `withRouter()` from
`RouteSnapshot`.
- Thread `@Nullable ListenerXdsResource` through `RouteStream` inner
classes so `RouteEntry` can access upstream HTTP filters from the Router
directly.
- Update `RouterFilterFactory` to implement the new untyped interface.
- Simplify `FilterUtil`: remove `toParsedFilterConfigs()`, update
`mergeFilterConfigs` to operate on `Map<String, Any>`,
`buildUpstreamFilter` takes `@Nullable RetryPolicy` directly.
Result
- `HttpFilterFactory` implementations no longer need to declare a
protobuf type parameter, and can handle any xDS filter config including
unknown or Istio-specific ones.
- Per-route filter config merging is self-contained in `RouteEntry`
rather than spread across the snapshot hierarchy.
- `RouteEntry.filterConfig(String)` now returns `@Nullable Any` instead
of `@Nullable ParsedFilterConfig`.
Breaking
- `HttpFilterFactory` implementations must now implement `XdsHttpFilter
create(HttpFilter httpFilter, Any config)` for custom filter
implementations
1 parent f21a684 commit 9ddbeeb
File tree
12 files changed
+239
-423
lines changed- xds/src/main/java/com/linecorp/armeria/xds
- client/endpoint
- filter
12 files changed
+239
-423
lines changedLines changed: 34 additions & 89 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | | - | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 31 | | |
41 | 32 | | |
42 | 33 | | |
| 34 | + | |
43 | 35 | | |
| 36 | + | |
44 | 37 | | |
45 | 38 | | |
46 | 39 | | |
47 | 40 | | |
48 | 41 | | |
49 | 42 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
65 | 50 | | |
66 | 51 | | |
67 | 52 | | |
| |||
73 | 58 | | |
74 | 59 | | |
75 | 60 | | |
76 | | - | |
77 | | - | |
| 61 | + | |
| 62 | + | |
78 | 63 | | |
79 | 64 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 65 | + | |
| 66 | + | |
85 | 67 | | |
86 | 68 | | |
87 | 69 | | |
88 | 70 | | |
89 | 71 | | |
90 | | - | |
91 | | - | |
| 72 | + | |
| 73 | + | |
92 | 74 | | |
93 | 75 | | |
94 | 76 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
101 | 80 | | |
102 | 81 | | |
103 | | - | |
104 | | - | |
| 82 | + | |
| 83 | + | |
105 | 84 | | |
106 | | - | |
| 85 | + | |
107 | 86 | | |
108 | | - | |
| 87 | + | |
109 | 88 | | |
110 | 89 | | |
111 | 90 | | |
112 | 91 | | |
113 | 92 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
117 | 96 | | |
118 | 97 | | |
119 | | - | |
120 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
121 | 103 | | |
122 | | - | |
| 104 | + | |
123 | 105 | | |
124 | 106 | | |
125 | 107 | | |
126 | 108 | | |
127 | 109 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
168 | 113 | | |
169 | 114 | | |
170 | 115 | | |
| |||
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 45 | + | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
| 65 | + | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
Lines changed: 0 additions & 119 deletions
This file was deleted.
0 commit comments