70
70
71
71
public class EnrichPlugin extends Plugin implements ActionPlugin , IngestPlugin {
72
72
73
- static final Setting <Integer > ENRICH_FETCH_SIZE_SETTING =
74
- Setting .intSetting ("enrich.fetch_size" , 10000 , 1 , 1000000 , Setting .Property .NodeScope );
73
+ static final Setting <Integer > ENRICH_FETCH_SIZE_SETTING = Setting .intSetting (
74
+ "enrich.fetch_size" ,
75
+ 10000 ,
76
+ 1 ,
77
+ 1000000 ,
78
+ Setting .Property .NodeScope
79
+ );
75
80
76
- static final Setting <Integer > ENRICH_MAX_CONCURRENT_POLICY_EXECUTIONS =
77
- Setting .intSetting ("enrich.max_concurrent_policy_executions" , 50 , 1 , Setting .Property .NodeScope );
81
+ static final Setting <Integer > ENRICH_MAX_CONCURRENT_POLICY_EXECUTIONS = Setting .intSetting (
82
+ "enrich.max_concurrent_policy_executions" ,
83
+ 50 ,
84
+ 1 ,
85
+ Setting .Property .NodeScope
86
+ );
78
87
79
- static final Setting <TimeValue > ENRICH_CLEANUP_PERIOD =
80
- Setting .timeSetting ("enrich.cleanup_period" , new TimeValue (15 , TimeUnit .MINUTES ), Setting .Property .NodeScope );
88
+ static final Setting <TimeValue > ENRICH_CLEANUP_PERIOD = Setting .timeSetting (
89
+ "enrich.cleanup_period" ,
90
+ new TimeValue (15 , TimeUnit .MINUTES ),
91
+ Setting .Property .NodeScope
92
+ );
81
93
82
- public static final Setting <Integer > COORDINATOR_PROXY_MAX_CONCURRENT_REQUESTS =
83
- Setting .intSetting ("enrich.coordinator_proxy.max_concurrent_requests" , 8 , 1 , 10000 , Setting .Property .NodeScope );
94
+ public static final Setting <Integer > COORDINATOR_PROXY_MAX_CONCURRENT_REQUESTS = Setting .intSetting (
95
+ "enrich.coordinator_proxy.max_concurrent_requests" ,
96
+ 8 ,
97
+ 1 ,
98
+ 10000 ,
99
+ Setting .Property .NodeScope
100
+ );
84
101
85
- public static final Setting <Integer > COORDINATOR_PROXY_MAX_LOOKUPS_PER_REQUEST =
86
- Setting .intSetting ("enrich.coordinator_proxy.max_lookups_per_request" , 128 , 1 , 10000 , Setting .Property .NodeScope );
102
+ public static final Setting <Integer > COORDINATOR_PROXY_MAX_LOOKUPS_PER_REQUEST = Setting .intSetting (
103
+ "enrich.coordinator_proxy.max_lookups_per_request" ,
104
+ 128 ,
105
+ 1 ,
106
+ 10000 ,
107
+ Setting .Property .NodeScope
108
+ );
87
109
88
- static final Setting <Integer > ENRICH_MAX_FORCE_MERGE_ATTEMPTS =
89
- Setting .intSetting ("enrich.max_force_merge_attempts" , 3 , 1 , 10 , Setting .Property .NodeScope );
110
+ static final Setting <Integer > ENRICH_MAX_FORCE_MERGE_ATTEMPTS = Setting .intSetting (
111
+ "enrich.max_force_merge_attempts" ,
112
+ 3 ,
113
+ 1 ,
114
+ 10 ,
115
+ Setting .Property .NodeScope
116
+ );
90
117
91
118
private static final String QUEUE_CAPACITY_SETTING_NAME = "enrich.coordinator_proxy.queue_capacity" ;
92
- public static final Setting <Integer > COORDINATOR_PROXY_QUEUE_CAPACITY = new Setting <>(QUEUE_CAPACITY_SETTING_NAME ,
93
- settings -> {
94
- int maxConcurrentRequests = COORDINATOR_PROXY_MAX_CONCURRENT_REQUESTS .get (settings );
95
- int maxLookupsPerRequest = COORDINATOR_PROXY_MAX_LOOKUPS_PER_REQUEST .get (settings );
96
- return String .valueOf (maxConcurrentRequests * maxLookupsPerRequest );
97
- },
98
- val -> Setting .parseInt (val , 1 , Integer .MAX_VALUE , QUEUE_CAPACITY_SETTING_NAME ),
99
- Setting .Property .NodeScope );
119
+ public static final Setting <Integer > COORDINATOR_PROXY_QUEUE_CAPACITY = new Setting <>(QUEUE_CAPACITY_SETTING_NAME , settings -> {
120
+ int maxConcurrentRequests = COORDINATOR_PROXY_MAX_CONCURRENT_REQUESTS .get (settings );
121
+ int maxLookupsPerRequest = COORDINATOR_PROXY_MAX_LOOKUPS_PER_REQUEST .get (settings );
122
+ return String .valueOf (maxConcurrentRequests * maxLookupsPerRequest );
123
+ }, val -> Setting .parseInt (val , 1 , Integer .MAX_VALUE , QUEUE_CAPACITY_SETTING_NAME ), Setting .Property .NodeScope );
100
124
101
125
private final Settings settings ;
102
126
private final Boolean enabled ;
@@ -119,7 +143,9 @@ public Map<String, Processor.Factory> getProcessors(Processor.Parameters paramet
119
143
return Collections .singletonMap (EnrichProcessorFactory .TYPE , factory );
120
144
}
121
145
122
- protected XPackLicenseState getLicenseState () { return XPackPlugin .getSharedLicenseState (); }
146
+ protected XPackLicenseState getLicenseState () {
147
+ return XPackPlugin .getSharedLicenseState ();
148
+ }
123
149
124
150
public List <ActionHandler <? extends ActionRequest , ? extends ActionResponse >> getActions () {
125
151
if (enabled == false ) {
@@ -138,10 +164,15 @@ public Map<String, Processor.Factory> getProcessors(Processor.Parameters paramet
138
164
);
139
165
}
140
166
141
- public List <RestHandler > getRestHandlers (Settings settings , RestController restController , ClusterSettings clusterSettings ,
142
- IndexScopedSettings indexScopedSettings , SettingsFilter settingsFilter ,
143
- IndexNameExpressionResolver indexNameExpressionResolver ,
144
- Supplier <DiscoveryNodes > nodesInCluster ) {
167
+ public List <RestHandler > getRestHandlers (
168
+ Settings settings ,
169
+ RestController restController ,
170
+ ClusterSettings clusterSettings ,
171
+ IndexScopedSettings indexScopedSettings ,
172
+ SettingsFilter settingsFilter ,
173
+ IndexNameExpressionResolver indexNameExpressionResolver ,
174
+ Supplier <DiscoveryNodes > nodesInCluster
175
+ ) {
145
176
if (enabled == false ) {
146
177
return emptyList ();
147
178
}
@@ -156,17 +187,29 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
156
187
}
157
188
158
189
@ Override
159
- public Collection <Object > createComponents (Client client , ClusterService clusterService , ThreadPool threadPool ,
160
- ResourceWatcherService resourceWatcherService , ScriptService scriptService ,
161
- NamedXContentRegistry xContentRegistry , Environment environment ,
162
- NodeEnvironment nodeEnvironment , NamedWriteableRegistry namedWriteableRegistry ) {
190
+ public Collection <Object > createComponents (
191
+ Client client ,
192
+ ClusterService clusterService ,
193
+ ThreadPool threadPool ,
194
+ ResourceWatcherService resourceWatcherService ,
195
+ ScriptService scriptService ,
196
+ NamedXContentRegistry xContentRegistry ,
197
+ Environment environment ,
198
+ NodeEnvironment nodeEnvironment ,
199
+ NamedWriteableRegistry namedWriteableRegistry
200
+ ) {
163
201
if (enabled == false || transportClientMode ) {
164
202
return emptyList ();
165
203
}
166
204
167
205
EnrichPolicyLocks enrichPolicyLocks = new EnrichPolicyLocks ();
168
- EnrichPolicyMaintenanceService enrichPolicyMaintenanceService = new EnrichPolicyMaintenanceService (settings , client ,
169
- clusterService , threadPool , enrichPolicyLocks );
206
+ EnrichPolicyMaintenanceService enrichPolicyMaintenanceService = new EnrichPolicyMaintenanceService (
207
+ settings ,
208
+ client ,
209
+ clusterService ,
210
+ threadPool ,
211
+ enrichPolicyLocks
212
+ );
170
213
enrichPolicyMaintenanceService .initialize ();
171
214
return Arrays .asList (
172
215
enrichPolicyLocks ,
@@ -188,8 +231,11 @@ public Collection<Module> createGuiceModules() {
188
231
public List <NamedWriteableRegistry .Entry > getNamedWriteables () {
189
232
return Arrays .asList (
190
233
new NamedWriteableRegistry .Entry (MetaData .Custom .class , EnrichMetadata .TYPE , EnrichMetadata ::new ),
191
- new NamedWriteableRegistry .Entry (NamedDiff .class , EnrichMetadata .TYPE ,
192
- in -> EnrichMetadata .readDiffFrom (MetaData .Custom .class , EnrichMetadata .TYPE , in ))
234
+ new NamedWriteableRegistry .Entry (
235
+ NamedDiff .class ,
236
+ EnrichMetadata .TYPE ,
237
+ in -> EnrichMetadata .readDiffFrom (MetaData .Custom .class , EnrichMetadata .TYPE , in )
238
+ )
193
239
);
194
240
}
195
241
0 commit comments