Skip to content

Commit

Permalink
[esArchiver] stable archives (elastic#30477) (elastic#30706)
Browse files Browse the repository at this point in the history
* [esArchiver/save] serialize with stable json stringify

* [esArchives] rebuild all archives
  • Loading branch information
Spencer authored Feb 14, 2019
1 parent e49dbaa commit e80d433
Show file tree
Hide file tree
Showing 139 changed files with 13,116 additions and 13,331 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
"jest-cli": "^23.6.0",
"jest-raw-loader": "^1.0.1",
"jimp": "0.2.28",
"json-stable-stringify": "^1.0.1",
"json5": "^1.0.1",
"karma": "3.1.4",
"karma-chrome-launcher": "2.1.1",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-dev-utils/src/streams/concat_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { createReduceStream } from './reduce_stream';
* Concatenate values into an array:
* createListStream([1,2,3])
* .pipe(createConcatStream([]))
* .pipe(createJsonStringifyStream())
* .on('data', console.log)
* // logs "[1,2,3]"
*
Expand Down
6 changes: 4 additions & 2 deletions src/es_archiver/lib/archives/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
import { createGzip, Z_BEST_COMPRESSION } from 'zlib';
import { PassThrough } from 'stream';

import stringify from 'json-stable-stringify';

import {
createMapStream,
createIntersperseStream,
createJsonStringifyStream
} from '../../../legacy/utils';

import { RECORD_SEPARATOR } from './constants';

export function createFormatArchiveStreams({ gzip = false } = {}) {
return [
createJsonStringifyStream({ pretty: true }),
createMapStream(record => stringify(record, { space: ' ' })),
createIntersperseStream(RECORD_SEPARATOR),
gzip ? createGzip({ level: Z_BEST_COMPRESSION }) : new PassThrough(),
];
Expand Down
4 changes: 2 additions & 2 deletions src/es_archiver/lib/archives/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { PassThrough } from 'stream';
import {
createSplitStream,
createReplaceStream,
createJsonParseStream,
createMapStream,
} from '../../../legacy/utils';

import { RECORD_SEPARATOR } from './constants';
Expand All @@ -33,6 +33,6 @@ export function createParseArchiveStreams({ gzip = false } = {}) {
gzip ? createGunzip() : new PassThrough(),
createReplaceStream('\r\n', '\n'),
createSplitStream(RECORD_SEPARATOR),
createJsonParseStream(),
createMapStream(json => JSON.parse(json.trim())),
];
}
2 changes: 0 additions & 2 deletions src/legacy/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export {
concatStreamProviders,
createConcatStream,
createIntersperseStream,
createJsonParseStream,
createJsonStringifyStream,
createListStream,
createPromiseFromStreams,
createReduceStream,
Expand Down
1 change: 0 additions & 1 deletion src/legacy/utils/streams/concat_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { createReduceStream } from './reduce_stream';
* Concatenate values into an array:
* createListStream([1,2,3])
* .pipe(createConcatStream([]))
* .pipe(createJsonStringifyStream())
* .on('data', console.log)
* // logs "[1,2,3]"
*
Expand Down
1 change: 0 additions & 1 deletion src/legacy/utils/streams/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export { createIntersperseStream } from './intersperse_stream';
export { createSplitStream } from './split_stream';
export { createListStream } from './list_stream';
export { createReduceStream } from './reduce_stream';
export { createJsonParseStream, createJsonStringifyStream } from './json_streams';
export { createPromiseFromStreams } from './promise_from_streams';
export { createConcatStream } from './concat_stream';
export { createMapStream } from './map_stream';
Expand Down
77 changes: 0 additions & 77 deletions src/legacy/utils/streams/json_streams.js

This file was deleted.

161 changes: 0 additions & 161 deletions src/legacy/utils/streams/json_streams.test.js

This file was deleted.

Binary file modified test/functional/fixtures/es_archiver/alias/data.json.gz
Binary file not shown.
Loading

0 comments on commit e80d433

Please sign in to comment.