Skip to content

Commit bd7b38b

Browse files
committed
Improve child performances (#1314)
1 parent bd8892c commit bd7b38b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+19719
-7762
lines changed

.github/workflows/nodejs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,49 @@ jobs:
101101
run: |
102102
npm run test:integration:helpers
103103
104+
bundler-support:
105+
name: Bundler support
106+
runs-on: ubuntu-latest
107+
108+
steps:
109+
- uses: actions/checkout@v2
110+
111+
- name: Configure sysctl limits
112+
run: |
113+
sudo swapoff -a
114+
sudo sysctl -w vm.swappiness=1
115+
sudo sysctl -w fs.file-max=262144
116+
sudo sysctl -w vm.max_map_count=262144
117+
118+
- name: Runs Elasticsearch
119+
uses: elastic/elastic-github-actions/elasticsearch@master
120+
with:
121+
stack-version: 8.0.0-SNAPSHOT
122+
123+
- name: Use Node.js 14.x
124+
uses: actions/setup-node@v1
125+
with:
126+
node-version: 14.x
127+
128+
- name: Install
129+
run: |
130+
npm install
131+
npm install --prefix test/bundlers/parcel-test
132+
npm install --prefix test/bundlers/rollup-test
133+
npm install --prefix test/bundlers/webpack-test
134+
135+
- name: Build
136+
run: |
137+
npm run build --prefix test/bundlers/parcel-test
138+
npm run build --prefix test/bundlers/rollup-test
139+
npm run build --prefix test/bundlers/webpack-test
140+
141+
- name: Run bundle
142+
run: |
143+
npm start --prefix test/bundlers/parcel-test
144+
npm start --prefix test/bundlers/rollup-test
145+
npm start --prefix test/bundlers/webpack-test
146+
104147
code-coverage:
105148
name: Code coverage
106149
runs-on: ubuntu-latest

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ elasticsearch*
5656
test/benchmarks/macro/fixtures/*
5757

5858
*-junit.xml
59+
60+
.cache
61+
62+
test/bundlers/**/bundle.js

api/api/async_search.js

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
'use strict'
21+
22+
/* eslint camelcase: 0 */
23+
/* eslint no-unused-vars: 0 */
24+
25+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'keep_on_completion', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'version', 'seq_no_primary_term', 'max_concurrent_shard_requests']
27+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletionTimeout: 'wait_for_completion_timeout', keepAlive: 'keep_alive', typedKeys: 'typed_keys', keepOnCompletion: 'keep_on_completion', batchedReduceSize: 'batched_reduce_size', requestCache: 'request_cache', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', seqNoPrimaryTerm: 'seq_no_primary_term', maxConcurrentShardRequests: 'max_concurrent_shard_requests' }
28+
29+
function AsyncSearchApi (transport, ConfigurationError) {
30+
this.transport = transport
31+
this[kConfigurationError] = ConfigurationError
32+
}
33+
34+
AsyncSearchApi.prototype.delete = function asyncSearchDeleteApi (params, options, callback) {
35+
;[params, options, callback] = normalizeArguments(params, options, callback)
36+
37+
// check required parameters
38+
if (params['id'] == null) {
39+
const err = new this[kConfigurationError]('Missing required parameter: id')
40+
return handleError(err, callback)
41+
}
42+
43+
var { method, body, id, ...querystring } = params
44+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45+
46+
var path = ''
47+
if (method == null) method = 'DELETE'
48+
path = '/' + '_async_search' + '/' + encodeURIComponent(id)
49+
50+
// build request object
51+
const request = {
52+
method,
53+
path,
54+
body: body || '',
55+
querystring
56+
}
57+
58+
return this.transport.request(request, options, callback)
59+
}
60+
61+
AsyncSearchApi.prototype.get = function asyncSearchGetApi (params, options, callback) {
62+
;[params, options, callback] = normalizeArguments(params, options, callback)
63+
64+
// check required parameters
65+
if (params['id'] == null) {
66+
const err = new this[kConfigurationError]('Missing required parameter: id')
67+
return handleError(err, callback)
68+
}
69+
70+
var { method, body, id, ...querystring } = params
71+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
72+
73+
var path = ''
74+
if (method == null) method = 'GET'
75+
path = '/' + '_async_search' + '/' + encodeURIComponent(id)
76+
77+
// build request object
78+
const request = {
79+
method,
80+
path,
81+
body: null,
82+
querystring
83+
}
84+
85+
return this.transport.request(request, options, callback)
86+
}
87+
88+
AsyncSearchApi.prototype.submit = function asyncSearchSubmitApi (params, options, callback) {
89+
;[params, options, callback] = normalizeArguments(params, options, callback)
90+
91+
var { method, body, index, ...querystring } = params
92+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93+
94+
var path = ''
95+
if ((index) != null) {
96+
if (method == null) method = 'POST'
97+
path = '/' + encodeURIComponent(index) + '/' + '_async_search'
98+
} else {
99+
if (method == null) method = 'POST'
100+
path = '/' + '_async_search'
101+
}
102+
103+
// build request object
104+
const request = {
105+
method,
106+
path,
107+
body: body || '',
108+
querystring
109+
}
110+
111+
return this.transport.request(request, options, callback)
112+
}
113+
114+
module.exports = AsyncSearchApi

api/api/autoscaling.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
'use strict'
21+
22+
/* eslint camelcase: 0 */
23+
/* eslint no-unused-vars: 0 */
24+
25+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
27+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
28+
29+
function AutoscalingApi (transport, ConfigurationError) {
30+
this.transport = transport
31+
this[kConfigurationError] = ConfigurationError
32+
}
33+
34+
AutoscalingApi.prototype.deleteAutoscalingPolicy = function autoscalingDeleteAutoscalingPolicyApi (params, options, callback) {
35+
;[params, options, callback] = normalizeArguments(params, options, callback)
36+
37+
// check required parameters
38+
if (params['name'] == null) {
39+
const err = new this[kConfigurationError]('Missing required parameter: name')
40+
return handleError(err, callback)
41+
}
42+
43+
var { method, body, name, ...querystring } = params
44+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45+
46+
var path = ''
47+
if (method == null) method = 'DELETE'
48+
path = '/' + '_autoscaling' + '/' + 'policy' + '/' + encodeURIComponent(name)
49+
50+
// build request object
51+
const request = {
52+
method,
53+
path,
54+
body: body || '',
55+
querystring
56+
}
57+
58+
return this.transport.request(request, options, callback)
59+
}
60+
61+
AutoscalingApi.prototype.getAutoscalingDecision = function autoscalingGetAutoscalingDecisionApi (params, options, callback) {
62+
;[params, options, callback] = normalizeArguments(params, options, callback)
63+
64+
var { method, body, ...querystring } = params
65+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66+
67+
var path = ''
68+
if (method == null) method = 'GET'
69+
path = '/' + '_autoscaling' + '/' + 'decision'
70+
71+
// build request object
72+
const request = {
73+
method,
74+
path,
75+
body: null,
76+
querystring
77+
}
78+
79+
return this.transport.request(request, options, callback)
80+
}
81+
82+
AutoscalingApi.prototype.getAutoscalingPolicy = function autoscalingGetAutoscalingPolicyApi (params, options, callback) {
83+
;[params, options, callback] = normalizeArguments(params, options, callback)
84+
85+
// check required parameters
86+
if (params['name'] == null) {
87+
const err = new this[kConfigurationError]('Missing required parameter: name')
88+
return handleError(err, callback)
89+
}
90+
91+
var { method, body, name, ...querystring } = params
92+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93+
94+
var path = ''
95+
if (method == null) method = 'GET'
96+
path = '/' + '_autoscaling' + '/' + 'policy' + '/' + encodeURIComponent(name)
97+
98+
// build request object
99+
const request = {
100+
method,
101+
path,
102+
body: null,
103+
querystring
104+
}
105+
106+
return this.transport.request(request, options, callback)
107+
}
108+
109+
AutoscalingApi.prototype.putAutoscalingPolicy = function autoscalingPutAutoscalingPolicyApi (params, options, callback) {
110+
;[params, options, callback] = normalizeArguments(params, options, callback)
111+
112+
// check required parameters
113+
if (params['name'] == null) {
114+
const err = new this[kConfigurationError]('Missing required parameter: name')
115+
return handleError(err, callback)
116+
}
117+
if (params['body'] == null) {
118+
const err = new this[kConfigurationError]('Missing required parameter: body')
119+
return handleError(err, callback)
120+
}
121+
122+
var { method, body, name, ...querystring } = params
123+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
124+
125+
var path = ''
126+
if (method == null) method = 'PUT'
127+
path = '/' + '_autoscaling' + '/' + 'policy' + '/' + encodeURIComponent(name)
128+
129+
// build request object
130+
const request = {
131+
method,
132+
path,
133+
body: body || '',
134+
querystring
135+
}
136+
137+
return this.transport.request(request, options, callback)
138+
}
139+
140+
Object.defineProperties(AutoscalingApi.prototype, {
141+
delete_autoscaling_policy: { get () { return this.deleteAutoscalingPolicy } },
142+
get_autoscaling_decision: { get () { return this.getAutoscalingDecision } },
143+
get_autoscaling_policy: { get () { return this.getAutoscalingPolicy } },
144+
put_autoscaling_policy: { get () { return this.putAutoscalingPolicy } }
145+
})
146+
147+
module.exports = AutoscalingApi

0 commit comments

Comments
 (0)