@peerbit/document 13.1.25 → 13.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +19 -18
- package/dist/benchmark/document-put.d.ts +0 -2
- package/dist/benchmark/document-put.d.ts.map +0 -1
- package/dist/benchmark/document-put.js +0 -1362
- package/dist/benchmark/document-put.js.map +0 -1
- package/dist/benchmark/file-ingest.d.ts +0 -2
- package/dist/benchmark/file-ingest.d.ts.map +0 -1
- package/dist/benchmark/file-ingest.js +0 -682
- package/dist/benchmark/file-ingest.js.map +0 -1
- package/dist/benchmark/index.d.ts +0 -2
- package/dist/benchmark/index.d.ts.map +0 -1
- package/dist/benchmark/index.js +0 -160
- package/dist/benchmark/index.js.map +0 -1
- package/dist/benchmark/iterate-replicate-2.d.ts +0 -2
- package/dist/benchmark/iterate-replicate-2.d.ts.map +0 -1
- package/dist/benchmark/iterate-replicate-2.js +0 -200
- package/dist/benchmark/iterate-replicate-2.js.map +0 -1
- package/dist/benchmark/iterate-replicate.d.ts +0 -2
- package/dist/benchmark/iterate-replicate.d.ts.map +0 -1
- package/dist/benchmark/iterate-replicate.js +0 -212
- package/dist/benchmark/iterate-replicate.js.map +0 -1
- package/dist/benchmark/memory/child.d.ts +0 -2
- package/dist/benchmark/memory/child.d.ts.map +0 -1
- package/dist/benchmark/memory/child.js +0 -187
- package/dist/benchmark/memory/child.js.map +0 -1
- package/dist/benchmark/memory/index.d.ts +0 -2
- package/dist/benchmark/memory/index.d.ts.map +0 -1
- package/dist/benchmark/memory/index.js +0 -81
- package/dist/benchmark/memory/index.js.map +0 -1
- package/dist/benchmark/memory/utils.d.ts +0 -13
- package/dist/benchmark/memory/utils.d.ts.map +0 -1
- package/dist/benchmark/memory/utils.js +0 -2
- package/dist/benchmark/memory/utils.js.map +0 -1
- package/dist/benchmark/replication-network.d.ts +0 -2
- package/dist/benchmark/replication-network.d.ts.map +0 -1
- package/dist/benchmark/replication-network.js +0 -872
- package/dist/benchmark/replication-network.js.map +0 -1
- package/dist/benchmark/replication.d.ts +0 -2
- package/dist/benchmark/replication.d.ts.map +0 -1
- package/dist/benchmark/replication.js +0 -207
- package/dist/benchmark/replication.js.map +0 -1
|
@@ -1,682 +0,0 @@
|
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
import { field, option, variant } from "@dao-xyz/borsh";
|
|
36
|
-
import { Program } from "@peerbit/program";
|
|
37
|
-
import { TestSession } from "@peerbit/test-utils";
|
|
38
|
-
import { delay } from "@peerbit/time";
|
|
39
|
-
import { Documents, SearchRequest, SearchRequestIndexed, StringMatch, } from "../src/index.js";
|
|
40
|
-
const modes = ["adaptive", "fixed1"];
|
|
41
|
-
const argv = process.argv.slice(2);
|
|
42
|
-
const hasFlag = (name) => argv.includes(name);
|
|
43
|
-
const getArg = (name) => {
|
|
44
|
-
const index = argv.indexOf(name);
|
|
45
|
-
if (index === -1) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
return argv[index + 1];
|
|
49
|
-
};
|
|
50
|
-
const modeArg = getArg("--mode");
|
|
51
|
-
const selectedModes = modeArg == null
|
|
52
|
-
? modes
|
|
53
|
-
: modes.includes(modeArg)
|
|
54
|
-
? [modeArg]
|
|
55
|
-
: (() => {
|
|
56
|
-
throw new Error(`Invalid --mode '${modeArg}'. Expected one of: ${modes.join(", ")}`);
|
|
57
|
-
})();
|
|
58
|
-
const outputJson = process.env.BENCH_JSON === "1" || hasFlag("--json");
|
|
59
|
-
const envInt = (name, fallback) => {
|
|
60
|
-
const value = process.env[name];
|
|
61
|
-
if (value == null) {
|
|
62
|
-
return fallback;
|
|
63
|
-
}
|
|
64
|
-
const parsed = Number.parseInt(value, 10);
|
|
65
|
-
return Number.isFinite(parsed) ? parsed : fallback;
|
|
66
|
-
};
|
|
67
|
-
const chunkBytes = Math.max(1, envInt("FILE_INGEST_CHUNK_BYTES", 262144));
|
|
68
|
-
const chunks = Math.max(1, envInt("FILE_INGEST_CHUNKS", 24));
|
|
69
|
-
const warmupIterations = Math.max(0, envInt("FILE_INGEST_WARMUP", 1));
|
|
70
|
-
const iterations = Math.max(1, envInt("FILE_INGEST_ITERATIONS", 3));
|
|
71
|
-
const readyTimeoutMs = Math.max(1_000, envInt("FILE_INGEST_READY_TIMEOUT_MS", 30_000));
|
|
72
|
-
const pollDelayMs = Math.max(10, envInt("FILE_INGEST_POLL_DELAY_MS", 50));
|
|
73
|
-
const appendDurabilityEnv = process.env.FILE_INGEST_APPEND_DURABILITY;
|
|
74
|
-
const appendDurability = appendDurabilityEnv === "strict" || appendDurabilityEnv === "buffered"
|
|
75
|
-
? appendDurabilityEnv
|
|
76
|
-
: undefined;
|
|
77
|
-
const replicationByMode = {
|
|
78
|
-
adaptive: {
|
|
79
|
-
limits: {
|
|
80
|
-
cpu: {
|
|
81
|
-
max: 1,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
fixed1: {
|
|
86
|
-
factor: 1,
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
let FileRecord = (() => {
|
|
90
|
-
let _classDecorators = [variant("bench_file_record")];
|
|
91
|
-
let _classDescriptor;
|
|
92
|
-
let _classExtraInitializers = [];
|
|
93
|
-
let _classThis;
|
|
94
|
-
let _id_decorators;
|
|
95
|
-
let _id_initializers = [];
|
|
96
|
-
let _id_extraInitializers = [];
|
|
97
|
-
let _name_decorators;
|
|
98
|
-
let _name_initializers = [];
|
|
99
|
-
let _name_extraInitializers = [];
|
|
100
|
-
let _kind_decorators;
|
|
101
|
-
let _kind_initializers = [];
|
|
102
|
-
let _kind_extraInitializers = [];
|
|
103
|
-
let _size_decorators;
|
|
104
|
-
let _size_initializers = [];
|
|
105
|
-
let _size_extraInitializers = [];
|
|
106
|
-
let _ready_decorators;
|
|
107
|
-
let _ready_initializers = [];
|
|
108
|
-
let _ready_extraInitializers = [];
|
|
109
|
-
let _parentId_decorators;
|
|
110
|
-
let _parentId_initializers = [];
|
|
111
|
-
let _parentId_extraInitializers = [];
|
|
112
|
-
let _index_decorators;
|
|
113
|
-
let _index_initializers = [];
|
|
114
|
-
let _index_extraInitializers = [];
|
|
115
|
-
let _chunkCount_decorators;
|
|
116
|
-
let _chunkCount_initializers = [];
|
|
117
|
-
let _chunkCount_extraInitializers = [];
|
|
118
|
-
let _finalHash_decorators;
|
|
119
|
-
let _finalHash_initializers = [];
|
|
120
|
-
let _finalHash_extraInitializers = [];
|
|
121
|
-
let _bytes_decorators;
|
|
122
|
-
let _bytes_initializers = [];
|
|
123
|
-
let _bytes_extraInitializers = [];
|
|
124
|
-
var FileRecord = class {
|
|
125
|
-
static { _classThis = this; }
|
|
126
|
-
static {
|
|
127
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
128
|
-
_id_decorators = [field({ type: "string" })];
|
|
129
|
-
_name_decorators = [field({ type: "string" })];
|
|
130
|
-
_kind_decorators = [field({ type: "string" })];
|
|
131
|
-
_size_decorators = [field({ type: "u32" })];
|
|
132
|
-
_ready_decorators = [field({ type: "bool" })];
|
|
133
|
-
_parentId_decorators = [field({ type: option("string") })];
|
|
134
|
-
_index_decorators = [field({ type: option("u32") })];
|
|
135
|
-
_chunkCount_decorators = [field({ type: option("u32") })];
|
|
136
|
-
_finalHash_decorators = [field({ type: option("string") })];
|
|
137
|
-
_bytes_decorators = [field({ type: option(Uint8Array) })];
|
|
138
|
-
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
|
|
139
|
-
__esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
140
|
-
__esDecorate(null, null, _kind_decorators, { kind: "field", name: "kind", static: false, private: false, access: { has: obj => "kind" in obj, get: obj => obj.kind, set: (obj, value) => { obj.kind = value; } }, metadata: _metadata }, _kind_initializers, _kind_extraInitializers);
|
|
141
|
-
__esDecorate(null, null, _size_decorators, { kind: "field", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
|
|
142
|
-
__esDecorate(null, null, _ready_decorators, { kind: "field", name: "ready", static: false, private: false, access: { has: obj => "ready" in obj, get: obj => obj.ready, set: (obj, value) => { obj.ready = value; } }, metadata: _metadata }, _ready_initializers, _ready_extraInitializers);
|
|
143
|
-
__esDecorate(null, null, _parentId_decorators, { kind: "field", name: "parentId", static: false, private: false, access: { has: obj => "parentId" in obj, get: obj => obj.parentId, set: (obj, value) => { obj.parentId = value; } }, metadata: _metadata }, _parentId_initializers, _parentId_extraInitializers);
|
|
144
|
-
__esDecorate(null, null, _index_decorators, { kind: "field", name: "index", static: false, private: false, access: { has: obj => "index" in obj, get: obj => obj.index, set: (obj, value) => { obj.index = value; } }, metadata: _metadata }, _index_initializers, _index_extraInitializers);
|
|
145
|
-
__esDecorate(null, null, _chunkCount_decorators, { kind: "field", name: "chunkCount", static: false, private: false, access: { has: obj => "chunkCount" in obj, get: obj => obj.chunkCount, set: (obj, value) => { obj.chunkCount = value; } }, metadata: _metadata }, _chunkCount_initializers, _chunkCount_extraInitializers);
|
|
146
|
-
__esDecorate(null, null, _finalHash_decorators, { kind: "field", name: "finalHash", static: false, private: false, access: { has: obj => "finalHash" in obj, get: obj => obj.finalHash, set: (obj, value) => { obj.finalHash = value; } }, metadata: _metadata }, _finalHash_initializers, _finalHash_extraInitializers);
|
|
147
|
-
__esDecorate(null, null, _bytes_decorators, { kind: "field", name: "bytes", static: false, private: false, access: { has: obj => "bytes" in obj, get: obj => obj.bytes, set: (obj, value) => { obj.bytes = value; } }, metadata: _metadata }, _bytes_initializers, _bytes_extraInitializers);
|
|
148
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
149
|
-
FileRecord = _classThis = _classDescriptor.value;
|
|
150
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
151
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
152
|
-
}
|
|
153
|
-
id = __runInitializers(this, _id_initializers, void 0);
|
|
154
|
-
name = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _name_initializers, void 0));
|
|
155
|
-
kind = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _kind_initializers, void 0));
|
|
156
|
-
size = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _size_initializers, void 0));
|
|
157
|
-
ready = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _ready_initializers, void 0));
|
|
158
|
-
parentId = (__runInitializers(this, _ready_extraInitializers), __runInitializers(this, _parentId_initializers, void 0));
|
|
159
|
-
index = (__runInitializers(this, _parentId_extraInitializers), __runInitializers(this, _index_initializers, void 0));
|
|
160
|
-
chunkCount = (__runInitializers(this, _index_extraInitializers), __runInitializers(this, _chunkCount_initializers, void 0));
|
|
161
|
-
finalHash = (__runInitializers(this, _chunkCount_extraInitializers), __runInitializers(this, _finalHash_initializers, void 0));
|
|
162
|
-
bytes = (__runInitializers(this, _finalHash_extraInitializers), __runInitializers(this, _bytes_initializers, void 0));
|
|
163
|
-
constructor(properties) {
|
|
164
|
-
__runInitializers(this, _bytes_extraInitializers);
|
|
165
|
-
this.id = properties?.id ?? "";
|
|
166
|
-
this.name = properties?.name ?? "";
|
|
167
|
-
this.kind = properties?.kind ?? "chunk";
|
|
168
|
-
this.size = properties?.size ?? 0;
|
|
169
|
-
this.ready = properties?.ready ?? false;
|
|
170
|
-
this.parentId = properties?.parentId;
|
|
171
|
-
this.index = properties?.index;
|
|
172
|
-
this.chunkCount = properties?.chunkCount;
|
|
173
|
-
this.finalHash = properties?.finalHash;
|
|
174
|
-
this.bytes = properties?.bytes;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
return FileRecord = _classThis;
|
|
178
|
-
})();
|
|
179
|
-
let FileRecordIndexable = (() => {
|
|
180
|
-
let _classDecorators = [variant("bench_file_indexable")];
|
|
181
|
-
let _classDescriptor;
|
|
182
|
-
let _classExtraInitializers = [];
|
|
183
|
-
let _classThis;
|
|
184
|
-
let _id_decorators;
|
|
185
|
-
let _id_initializers = [];
|
|
186
|
-
let _id_extraInitializers = [];
|
|
187
|
-
let _name_decorators;
|
|
188
|
-
let _name_initializers = [];
|
|
189
|
-
let _name_extraInitializers = [];
|
|
190
|
-
let _kind_decorators;
|
|
191
|
-
let _kind_initializers = [];
|
|
192
|
-
let _kind_extraInitializers = [];
|
|
193
|
-
let _size_decorators;
|
|
194
|
-
let _size_initializers = [];
|
|
195
|
-
let _size_extraInitializers = [];
|
|
196
|
-
let _ready_decorators;
|
|
197
|
-
let _ready_initializers = [];
|
|
198
|
-
let _ready_extraInitializers = [];
|
|
199
|
-
let _parentId_decorators;
|
|
200
|
-
let _parentId_initializers = [];
|
|
201
|
-
let _parentId_extraInitializers = [];
|
|
202
|
-
let _index_decorators;
|
|
203
|
-
let _index_initializers = [];
|
|
204
|
-
let _index_extraInitializers = [];
|
|
205
|
-
var FileRecordIndexable = class {
|
|
206
|
-
static { _classThis = this; }
|
|
207
|
-
static {
|
|
208
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
209
|
-
_id_decorators = [field({ type: "string" })];
|
|
210
|
-
_name_decorators = [field({ type: "string" })];
|
|
211
|
-
_kind_decorators = [field({ type: "string" })];
|
|
212
|
-
_size_decorators = [field({ type: "u32" })];
|
|
213
|
-
_ready_decorators = [field({ type: "bool" })];
|
|
214
|
-
_parentId_decorators = [field({ type: option("string") })];
|
|
215
|
-
_index_decorators = [field({ type: option("u32") })];
|
|
216
|
-
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
|
|
217
|
-
__esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
218
|
-
__esDecorate(null, null, _kind_decorators, { kind: "field", name: "kind", static: false, private: false, access: { has: obj => "kind" in obj, get: obj => obj.kind, set: (obj, value) => { obj.kind = value; } }, metadata: _metadata }, _kind_initializers, _kind_extraInitializers);
|
|
219
|
-
__esDecorate(null, null, _size_decorators, { kind: "field", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
|
|
220
|
-
__esDecorate(null, null, _ready_decorators, { kind: "field", name: "ready", static: false, private: false, access: { has: obj => "ready" in obj, get: obj => obj.ready, set: (obj, value) => { obj.ready = value; } }, metadata: _metadata }, _ready_initializers, _ready_extraInitializers);
|
|
221
|
-
__esDecorate(null, null, _parentId_decorators, { kind: "field", name: "parentId", static: false, private: false, access: { has: obj => "parentId" in obj, get: obj => obj.parentId, set: (obj, value) => { obj.parentId = value; } }, metadata: _metadata }, _parentId_initializers, _parentId_extraInitializers);
|
|
222
|
-
__esDecorate(null, null, _index_decorators, { kind: "field", name: "index", static: false, private: false, access: { has: obj => "index" in obj, get: obj => obj.index, set: (obj, value) => { obj.index = value; } }, metadata: _metadata }, _index_initializers, _index_extraInitializers);
|
|
223
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
224
|
-
FileRecordIndexable = _classThis = _classDescriptor.value;
|
|
225
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
226
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
227
|
-
}
|
|
228
|
-
id = __runInitializers(this, _id_initializers, void 0);
|
|
229
|
-
name = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _name_initializers, void 0));
|
|
230
|
-
kind = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _kind_initializers, void 0));
|
|
231
|
-
size = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _size_initializers, void 0));
|
|
232
|
-
ready = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _ready_initializers, void 0));
|
|
233
|
-
parentId = (__runInitializers(this, _ready_extraInitializers), __runInitializers(this, _parentId_initializers, void 0));
|
|
234
|
-
index = (__runInitializers(this, _parentId_extraInitializers), __runInitializers(this, _index_initializers, void 0));
|
|
235
|
-
constructor(record) {
|
|
236
|
-
__runInitializers(this, _index_extraInitializers);
|
|
237
|
-
this.id = record.id;
|
|
238
|
-
this.name = record.name;
|
|
239
|
-
this.kind = record.kind;
|
|
240
|
-
this.size = record.size;
|
|
241
|
-
this.ready = record.ready;
|
|
242
|
-
this.parentId = record.parentId;
|
|
243
|
-
this.index = record.index;
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
return FileRecordIndexable = _classThis;
|
|
247
|
-
})();
|
|
248
|
-
let FileStore = (() => {
|
|
249
|
-
let _classDecorators = [variant("bench_file_store")];
|
|
250
|
-
let _classDescriptor;
|
|
251
|
-
let _classExtraInitializers = [];
|
|
252
|
-
let _classThis;
|
|
253
|
-
let _classSuper = Program;
|
|
254
|
-
let _files_decorators;
|
|
255
|
-
let _files_initializers = [];
|
|
256
|
-
let _files_extraInitializers = [];
|
|
257
|
-
var FileStore = class extends _classSuper {
|
|
258
|
-
static { _classThis = this; }
|
|
259
|
-
static {
|
|
260
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
261
|
-
_files_decorators = [field({ type: Documents })];
|
|
262
|
-
__esDecorate(null, null, _files_decorators, { kind: "field", name: "files", static: false, private: false, access: { has: obj => "files" in obj, get: obj => obj.files, set: (obj, value) => { obj.files = value; } }, metadata: _metadata }, _files_initializers, _files_extraInitializers);
|
|
263
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
264
|
-
FileStore = _classThis = _classDescriptor.value;
|
|
265
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
266
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
267
|
-
}
|
|
268
|
-
files = __runInitializers(this, _files_initializers, void 0);
|
|
269
|
-
constructor() {
|
|
270
|
-
super();
|
|
271
|
-
__runInitializers(this, _files_extraInitializers);
|
|
272
|
-
this.files = new Documents();
|
|
273
|
-
}
|
|
274
|
-
async open(options) {
|
|
275
|
-
await this.files.open({
|
|
276
|
-
type: FileRecord,
|
|
277
|
-
index: {
|
|
278
|
-
type: FileRecordIndexable,
|
|
279
|
-
},
|
|
280
|
-
appendDurability: options?.appendDurability,
|
|
281
|
-
replicate: options?.replicate,
|
|
282
|
-
replicas: { min: 1 },
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
return FileStore = _classThis;
|
|
287
|
-
})();
|
|
288
|
-
const average = (values) => values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
289
|
-
const round = (value, digits = 3) => Number.isFinite(value) ? Number(value.toFixed(digits)) : value;
|
|
290
|
-
const makePayloadChunks = () => {
|
|
291
|
-
const all = new Uint8Array(chunkBytes * chunks);
|
|
292
|
-
for (let i = 0; i < all.length; i++) {
|
|
293
|
-
all[i] = i % 251;
|
|
294
|
-
}
|
|
295
|
-
return Array.from({ length: chunks }, (_, index) => all.subarray(index * chunkBytes, (index + 1) * chunkBytes));
|
|
296
|
-
};
|
|
297
|
-
const uploadChunkedFile = async (store, fileName, payloadChunks) => {
|
|
298
|
-
const uploadId = `${fileName}-upload`;
|
|
299
|
-
const totalSize = payloadChunks.reduce((sum, value) => sum + value.byteLength, 0);
|
|
300
|
-
const hash = Buffer.from(uploadId).toString("base64url");
|
|
301
|
-
await store.files.put(new FileRecord({
|
|
302
|
-
id: uploadId,
|
|
303
|
-
name: fileName,
|
|
304
|
-
kind: "manifest",
|
|
305
|
-
size: totalSize,
|
|
306
|
-
chunkCount: payloadChunks.length,
|
|
307
|
-
ready: false,
|
|
308
|
-
}));
|
|
309
|
-
const chunkEntryHashes = [];
|
|
310
|
-
for (let index = 0; index < payloadChunks.length; index++) {
|
|
311
|
-
const bytes = payloadChunks[index];
|
|
312
|
-
const chunk = await store.files.put(new FileRecord({
|
|
313
|
-
id: `${uploadId}:${index}`,
|
|
314
|
-
name: `${fileName}/${index}`,
|
|
315
|
-
kind: "chunk",
|
|
316
|
-
size: bytes.byteLength,
|
|
317
|
-
parentId: uploadId,
|
|
318
|
-
index,
|
|
319
|
-
ready: true,
|
|
320
|
-
bytes,
|
|
321
|
-
}));
|
|
322
|
-
chunkEntryHashes.push(chunk.entry.hash);
|
|
323
|
-
}
|
|
324
|
-
const finalManifest = await store.files.put(new FileRecord({
|
|
325
|
-
id: uploadId,
|
|
326
|
-
name: fileName,
|
|
327
|
-
kind: "manifest",
|
|
328
|
-
size: totalSize,
|
|
329
|
-
chunkCount: payloadChunks.length,
|
|
330
|
-
ready: true,
|
|
331
|
-
finalHash: hash,
|
|
332
|
-
}));
|
|
333
|
-
return {
|
|
334
|
-
uploadId,
|
|
335
|
-
finalManifestEntryHash: finalManifest.entry.hash,
|
|
336
|
-
chunkEntryHashes,
|
|
337
|
-
};
|
|
338
|
-
};
|
|
339
|
-
const queryOptions = {
|
|
340
|
-
local: true,
|
|
341
|
-
remote: {
|
|
342
|
-
throwOnMissing: false,
|
|
343
|
-
replicate: true,
|
|
344
|
-
},
|
|
345
|
-
};
|
|
346
|
-
const waitForObserverReady = async (observer, upload, expectedChunks, startedAt, debugPeers) => {
|
|
347
|
-
const deadline = startedAt + readyTimeoutMs;
|
|
348
|
-
let entryPolls = 0;
|
|
349
|
-
let manifestPolls = 0;
|
|
350
|
-
let chunkPolls = 0;
|
|
351
|
-
let manifestSearchMs = 0;
|
|
352
|
-
let chunkSearchMs = 0;
|
|
353
|
-
let finalManifestEntryKnownMs;
|
|
354
|
-
let chunkEntriesKnownMs;
|
|
355
|
-
let manifestReadyMs;
|
|
356
|
-
let lastKnownChunkEntries = 0;
|
|
357
|
-
let lastManifestFound = false;
|
|
358
|
-
let lastManifestReady = false;
|
|
359
|
-
let lastChunkResults = 0;
|
|
360
|
-
let lastChunkResponses = [];
|
|
361
|
-
const labelPeer = (hash) => hash ? (debugPeers?.[hash] ?? hash) : "unknown";
|
|
362
|
-
while (performance.now() < deadline) {
|
|
363
|
-
entryPolls += 1;
|
|
364
|
-
if (finalManifestEntryKnownMs == null) {
|
|
365
|
-
const finalManifestKnown = (await observer.files.log.replicationIndex.count({
|
|
366
|
-
query: { hash: upload.finalManifestEntryHash },
|
|
367
|
-
})) > 0;
|
|
368
|
-
if (finalManifestKnown) {
|
|
369
|
-
finalManifestEntryKnownMs = performance.now() - startedAt;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (chunkEntriesKnownMs == null) {
|
|
373
|
-
let remainingChunkEntries = upload.chunkEntryHashes.length;
|
|
374
|
-
for (const hash of upload.chunkEntryHashes) {
|
|
375
|
-
const present = (await observer.files.log.replicationIndex.count({
|
|
376
|
-
query: { hash },
|
|
377
|
-
})) > 0;
|
|
378
|
-
if (!present) {
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
remainingChunkEntries -= 1;
|
|
382
|
-
}
|
|
383
|
-
lastKnownChunkEntries =
|
|
384
|
-
upload.chunkEntryHashes.length - remainingChunkEntries;
|
|
385
|
-
if (remainingChunkEntries === 0) {
|
|
386
|
-
chunkEntriesKnownMs = performance.now() - startedAt;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
manifestPolls += 1;
|
|
390
|
-
const manifestSearchStartedAt = performance.now();
|
|
391
|
-
const manifests = await observer.files.index.search(new SearchRequest({
|
|
392
|
-
query: new StringMatch({
|
|
393
|
-
key: "id",
|
|
394
|
-
value: upload.uploadId,
|
|
395
|
-
}),
|
|
396
|
-
fetch: 1,
|
|
397
|
-
}), queryOptions);
|
|
398
|
-
manifestSearchMs += performance.now() - manifestSearchStartedAt;
|
|
399
|
-
const manifest = manifests[0];
|
|
400
|
-
lastManifestFound = manifest != null;
|
|
401
|
-
lastManifestReady = manifest?.ready === true;
|
|
402
|
-
if (manifest?.ready) {
|
|
403
|
-
manifestReadyMs ??= performance.now() - startedAt;
|
|
404
|
-
chunkPolls += 1;
|
|
405
|
-
const chunkSearchStartedAt = performance.now();
|
|
406
|
-
const chunkResponses = [];
|
|
407
|
-
const chunkResults = await observer.files.index.search(new SearchRequest({
|
|
408
|
-
query: new StringMatch({
|
|
409
|
-
key: "parentId",
|
|
410
|
-
value: upload.uploadId,
|
|
411
|
-
}),
|
|
412
|
-
fetch: 0xffffffff,
|
|
413
|
-
}), {
|
|
414
|
-
...queryOptions,
|
|
415
|
-
onResponse: (response, from) => {
|
|
416
|
-
chunkResponses.push(`${labelPeer(from?.hashcode?.())}:results=${response?.results?.length ?? "?"},kept=${response?.kept?.toString?.() ?? "?"}`);
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
chunkSearchMs += performance.now() - chunkSearchStartedAt;
|
|
420
|
-
lastChunkResults = chunkResults.length;
|
|
421
|
-
lastChunkResponses = chunkResponses;
|
|
422
|
-
if (chunkResults.length === expectedChunks) {
|
|
423
|
-
return {
|
|
424
|
-
finalManifestEntryKnownMs: finalManifestEntryKnownMs ?? performance.now() - startedAt,
|
|
425
|
-
chunkEntriesKnownMs: chunkEntriesKnownMs ?? performance.now() - startedAt,
|
|
426
|
-
manifestReadyMs: manifestReadyMs ?? performance.now() - startedAt,
|
|
427
|
-
chunksReadyMs: performance.now() - startedAt,
|
|
428
|
-
manifestSearchMs,
|
|
429
|
-
chunkSearchMs,
|
|
430
|
-
entryPolls,
|
|
431
|
-
manifestPolls,
|
|
432
|
-
chunkPolls,
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
await delay(pollDelayMs);
|
|
437
|
-
}
|
|
438
|
-
throw new Error(`Timed out waiting for observer readiness for upload ${upload.uploadId}. ` +
|
|
439
|
-
`progress finalManifestEntryKnown=${finalManifestEntryKnownMs != null}, ` +
|
|
440
|
-
`chunkEntriesKnown=${lastKnownChunkEntries}/${upload.chunkEntryHashes.length}, ` +
|
|
441
|
-
`manifestFound=${lastManifestFound}, manifestReady=${lastManifestReady}, ` +
|
|
442
|
-
`chunkResults=${lastChunkResults}/${expectedChunks}, ` +
|
|
443
|
-
`chunkResponses=[${lastChunkResponses.join(";")}], ` +
|
|
444
|
-
`entryPolls=${entryPolls}, manifestPolls=${manifestPolls}, chunkPolls=${chunkPolls}`);
|
|
445
|
-
};
|
|
446
|
-
const countLocalChunks = async (store, uploadId) => (await store.files.index.search(new SearchRequestIndexed({
|
|
447
|
-
query: new StringMatch({
|
|
448
|
-
key: "parentId",
|
|
449
|
-
value: uploadId,
|
|
450
|
-
}),
|
|
451
|
-
fetch: 0xffffffff,
|
|
452
|
-
}), {
|
|
453
|
-
local: true,
|
|
454
|
-
remote: false,
|
|
455
|
-
resolve: false,
|
|
456
|
-
})).length;
|
|
457
|
-
const waitForReplicationSetup = async (writer, seeder) => {
|
|
458
|
-
let lastError;
|
|
459
|
-
for (let attempt = 0; attempt < 2; attempt++) {
|
|
460
|
-
try {
|
|
461
|
-
await Promise.all([
|
|
462
|
-
writer.files.log.waitForReplicator(seeder.node.identity.publicKey, {
|
|
463
|
-
timeout: readyTimeoutMs,
|
|
464
|
-
}),
|
|
465
|
-
seeder.files.log.waitForReplicator(writer.node.identity.publicKey, {
|
|
466
|
-
timeout: readyTimeoutMs,
|
|
467
|
-
}),
|
|
468
|
-
]);
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
catch (error) {
|
|
472
|
-
lastError = error;
|
|
473
|
-
if (attempt === 1) {
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
await delay(Math.min(1_000, pollDelayMs * 4));
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
throw lastError;
|
|
480
|
-
};
|
|
481
|
-
const runIteration = async (session, mode, sequence, payloadChunks) => {
|
|
482
|
-
const writer = await session.peers[0].open(new FileStore(), {
|
|
483
|
-
args: {
|
|
484
|
-
appendDurability,
|
|
485
|
-
replicate: replicationByMode[mode],
|
|
486
|
-
},
|
|
487
|
-
});
|
|
488
|
-
const seeder = await session.peers[1].open(writer.address, {
|
|
489
|
-
args: {
|
|
490
|
-
appendDurability,
|
|
491
|
-
replicate: replicationByMode[mode],
|
|
492
|
-
},
|
|
493
|
-
});
|
|
494
|
-
const observer = await session.peers[2].open(writer.address, {
|
|
495
|
-
args: {
|
|
496
|
-
appendDurability,
|
|
497
|
-
replicate: false,
|
|
498
|
-
},
|
|
499
|
-
});
|
|
500
|
-
let observerJoinMs = 0;
|
|
501
|
-
let observerJoinCalls = 0;
|
|
502
|
-
const originalObserverJoin = observer.files.log.join.bind(observer.files.log);
|
|
503
|
-
observer.files.log.join = (async (...args) => {
|
|
504
|
-
observerJoinCalls += 1;
|
|
505
|
-
const startedAt = performance.now();
|
|
506
|
-
try {
|
|
507
|
-
return await originalObserverJoin(...args);
|
|
508
|
-
}
|
|
509
|
-
finally {
|
|
510
|
-
observerJoinMs += performance.now() - startedAt;
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
try {
|
|
514
|
-
await waitForReplicationSetup(writer, seeder);
|
|
515
|
-
const startedAt = performance.now();
|
|
516
|
-
const upload = await uploadChunkedFile(writer, `${mode}-file-${sequence}`, payloadChunks);
|
|
517
|
-
const writerCompleteMs = performance.now() - startedAt;
|
|
518
|
-
let observerProgress;
|
|
519
|
-
try {
|
|
520
|
-
observerProgress = await waitForObserverReady(observer, upload, payloadChunks.length, startedAt, {
|
|
521
|
-
[writer.node.identity.publicKey.hashcode()]: "writer",
|
|
522
|
-
[seeder.node.identity.publicKey.hashcode()]: "seeder",
|
|
523
|
-
[observer.node.identity.publicKey.hashcode()]: "observer",
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
catch (error) {
|
|
527
|
-
const counts = await Promise.allSettled([
|
|
528
|
-
countLocalChunks(writer, upload.uploadId),
|
|
529
|
-
countLocalChunks(seeder, upload.uploadId),
|
|
530
|
-
countLocalChunks(observer, upload.uploadId),
|
|
531
|
-
]);
|
|
532
|
-
const [writerChunks, seederChunks, observerChunks] = counts.map((result) => result.status === "fulfilled"
|
|
533
|
-
? String(result.value)
|
|
534
|
-
: `error:${result.reason?.message ?? result.reason}`);
|
|
535
|
-
const detail = `localChunks writer=${writerChunks}, seeder=${seederChunks}, observer=${observerChunks}`;
|
|
536
|
-
if (error instanceof Error) {
|
|
537
|
-
error.message = `${error.message}. ${detail}`;
|
|
538
|
-
throw error;
|
|
539
|
-
}
|
|
540
|
-
throw new Error(`${String(error)}. ${detail}`);
|
|
541
|
-
}
|
|
542
|
-
return {
|
|
543
|
-
writerCompleteMs,
|
|
544
|
-
observerFinalManifestEntryKnownMs: observerProgress.finalManifestEntryKnownMs,
|
|
545
|
-
observerChunkEntriesKnownMs: observerProgress.chunkEntriesKnownMs,
|
|
546
|
-
observerManifestReadyMs: observerProgress.manifestReadyMs,
|
|
547
|
-
observerChunksReadyMs: observerProgress.chunksReadyMs,
|
|
548
|
-
observerManifestSearchMs: observerProgress.manifestSearchMs,
|
|
549
|
-
observerChunkSearchMs: observerProgress.chunkSearchMs,
|
|
550
|
-
observerJoinMs,
|
|
551
|
-
observerJoinCalls,
|
|
552
|
-
observerFinalManifestEntryKnownTailMs: observerProgress.finalManifestEntryKnownMs - writerCompleteMs,
|
|
553
|
-
observerChunkEntriesKnownTailMs: observerProgress.chunkEntriesKnownMs - writerCompleteMs,
|
|
554
|
-
observerManifestTailMs: observerProgress.manifestReadyMs - writerCompleteMs,
|
|
555
|
-
observerChunksTailMs: observerProgress.chunksReadyMs - writerCompleteMs,
|
|
556
|
-
entryPolls: observerProgress.entryPolls,
|
|
557
|
-
manifestPolls: observerProgress.manifestPolls,
|
|
558
|
-
chunkPolls: observerProgress.chunkPolls,
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
finally {
|
|
562
|
-
await Promise.allSettled([observer.close(), seeder.close(), writer.close()]);
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
const summarizeTask = (name, values) => {
|
|
566
|
-
const meanMs = average(values);
|
|
567
|
-
return {
|
|
568
|
-
name,
|
|
569
|
-
hz: round(1000 / meanMs, 6),
|
|
570
|
-
mean_ms: round(meanMs, 6),
|
|
571
|
-
rme: null,
|
|
572
|
-
samples: values.length,
|
|
573
|
-
};
|
|
574
|
-
};
|
|
575
|
-
const runMode = async (mode, payloadChunks) => {
|
|
576
|
-
const session = await TestSession.connected(3);
|
|
577
|
-
const samples = [];
|
|
578
|
-
try {
|
|
579
|
-
for (let i = 0; i < warmupIterations; i++) {
|
|
580
|
-
await runIteration(session, mode, -1 - i, payloadChunks);
|
|
581
|
-
}
|
|
582
|
-
for (let i = 0; i < iterations; i++) {
|
|
583
|
-
samples.push(await runIteration(session, mode, i, payloadChunks));
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
finally {
|
|
587
|
-
await session.stop();
|
|
588
|
-
}
|
|
589
|
-
return samples;
|
|
590
|
-
};
|
|
591
|
-
const payloadChunks = makePayloadChunks();
|
|
592
|
-
const results = await Promise.all(selectedModes.map(async (mode) => ({
|
|
593
|
-
mode,
|
|
594
|
-
samples: await runMode(mode, payloadChunks),
|
|
595
|
-
})));
|
|
596
|
-
const tasks = [];
|
|
597
|
-
for (const result of results) {
|
|
598
|
-
tasks.push(summarizeTask(`${result.mode}: writer-complete`, result.samples.map((sample) => sample.writerCompleteMs)));
|
|
599
|
-
tasks.push(summarizeTask(`${result.mode}: observer-final-manifest-entry-known`, result.samples.map((sample) => sample.observerFinalManifestEntryKnownMs)));
|
|
600
|
-
tasks.push(summarizeTask(`${result.mode}: observer-chunk-entries-known`, result.samples.map((sample) => sample.observerChunkEntriesKnownMs)));
|
|
601
|
-
tasks.push(summarizeTask(`${result.mode}: observer-manifest-ready`, result.samples.map((sample) => sample.observerManifestReadyMs)));
|
|
602
|
-
tasks.push(summarizeTask(`${result.mode}: observer-chunks-ready`, result.samples.map((sample) => sample.observerChunksReadyMs)));
|
|
603
|
-
tasks.push(summarizeTask(`${result.mode}: observer-manifest-search`, result.samples.map((sample) => sample.observerManifestSearchMs)));
|
|
604
|
-
tasks.push(summarizeTask(`${result.mode}: observer-chunk-search`, result.samples.map((sample) => sample.observerChunkSearchMs)));
|
|
605
|
-
tasks.push(summarizeTask(`${result.mode}: observer-join`, result.samples.map((sample) => sample.observerJoinMs)));
|
|
606
|
-
tasks.push(summarizeTask(`${result.mode}: observer-final-manifest-entry-known-tail`, result.samples.map((sample) => sample.observerFinalManifestEntryKnownTailMs)));
|
|
607
|
-
tasks.push(summarizeTask(`${result.mode}: observer-chunk-entries-known-tail`, result.samples.map((sample) => sample.observerChunkEntriesKnownTailMs)));
|
|
608
|
-
tasks.push(summarizeTask(`${result.mode}: observer-manifest-tail`, result.samples.map((sample) => sample.observerManifestTailMs)));
|
|
609
|
-
tasks.push(summarizeTask(`${result.mode}: observer-chunks-tail`, result.samples.map((sample) => sample.observerChunksTailMs)));
|
|
610
|
-
}
|
|
611
|
-
const output = {
|
|
612
|
-
name: "file-ingest",
|
|
613
|
-
tasks,
|
|
614
|
-
meta: {
|
|
615
|
-
chunks,
|
|
616
|
-
chunkBytes,
|
|
617
|
-
totalBytes: chunks * chunkBytes,
|
|
618
|
-
warmupIterations,
|
|
619
|
-
iterations,
|
|
620
|
-
readyTimeoutMs,
|
|
621
|
-
pollDelayMs,
|
|
622
|
-
appendDurability,
|
|
623
|
-
results: results.map((result) => ({
|
|
624
|
-
mode: result.mode,
|
|
625
|
-
writerCompleteMsAvg: round(average(result.samples.map((sample) => sample.writerCompleteMs))),
|
|
626
|
-
observerFinalManifestEntryKnownMsAvg: round(average(result.samples.map((sample) => sample.observerFinalManifestEntryKnownMs))),
|
|
627
|
-
observerChunkEntriesKnownMsAvg: round(average(result.samples.map((sample) => sample.observerChunkEntriesKnownMs))),
|
|
628
|
-
observerManifestReadyMsAvg: round(average(result.samples.map((sample) => sample.observerManifestReadyMs))),
|
|
629
|
-
observerChunksReadyMsAvg: round(average(result.samples.map((sample) => sample.observerChunksReadyMs))),
|
|
630
|
-
observerManifestSearchMsAvg: round(average(result.samples.map((sample) => sample.observerManifestSearchMs))),
|
|
631
|
-
observerChunkSearchMsAvg: round(average(result.samples.map((sample) => sample.observerChunkSearchMs))),
|
|
632
|
-
observerJoinMsAvg: round(average(result.samples.map((sample) => sample.observerJoinMs))),
|
|
633
|
-
observerJoinCallsAvg: round(average(result.samples.map((sample) => sample.observerJoinCalls))),
|
|
634
|
-
observerManifestTailMsAvg: round(average(result.samples.map((sample) => sample.observerManifestTailMs))),
|
|
635
|
-
observerFinalManifestEntryKnownTailMsAvg: round(average(result.samples.map((sample) => sample.observerFinalManifestEntryKnownTailMs))),
|
|
636
|
-
observerChunkEntriesKnownTailMsAvg: round(average(result.samples.map((sample) => sample.observerChunkEntriesKnownTailMs))),
|
|
637
|
-
observerChunksTailMsAvg: round(average(result.samples.map((sample) => sample.observerChunksTailMs))),
|
|
638
|
-
entryPollsAvg: round(average(result.samples.map((sample) => sample.entryPolls))),
|
|
639
|
-
manifestPollsAvg: round(average(result.samples.map((sample) => sample.manifestPolls))),
|
|
640
|
-
chunkPollsAvg: round(average(result.samples.map((sample) => sample.chunkPolls))),
|
|
641
|
-
samples: result.samples.map((sample) => ({
|
|
642
|
-
writerCompleteMs: round(sample.writerCompleteMs),
|
|
643
|
-
observerFinalManifestEntryKnownMs: round(sample.observerFinalManifestEntryKnownMs),
|
|
644
|
-
observerChunkEntriesKnownMs: round(sample.observerChunkEntriesKnownMs),
|
|
645
|
-
observerManifestReadyMs: round(sample.observerManifestReadyMs),
|
|
646
|
-
observerChunksReadyMs: round(sample.observerChunksReadyMs),
|
|
647
|
-
observerManifestSearchMs: round(sample.observerManifestSearchMs),
|
|
648
|
-
observerChunkSearchMs: round(sample.observerChunkSearchMs),
|
|
649
|
-
observerJoinMs: round(sample.observerJoinMs),
|
|
650
|
-
observerJoinCalls: sample.observerJoinCalls,
|
|
651
|
-
observerFinalManifestEntryKnownTailMs: round(sample.observerFinalManifestEntryKnownTailMs),
|
|
652
|
-
observerChunkEntriesKnownTailMs: round(sample.observerChunkEntriesKnownTailMs),
|
|
653
|
-
observerManifestTailMs: round(sample.observerManifestTailMs),
|
|
654
|
-
observerChunksTailMs: round(sample.observerChunksTailMs),
|
|
655
|
-
entryPolls: sample.entryPolls,
|
|
656
|
-
manifestPolls: sample.manifestPolls,
|
|
657
|
-
chunkPolls: sample.chunkPolls,
|
|
658
|
-
})),
|
|
659
|
-
})),
|
|
660
|
-
},
|
|
661
|
-
};
|
|
662
|
-
if (outputJson) {
|
|
663
|
-
await new Promise((resolve, reject) => {
|
|
664
|
-
process.stdout.write(JSON.stringify(output, null, 2), (error) => {
|
|
665
|
-
if (error) {
|
|
666
|
-
reject(error);
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
resolve();
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
console.table(tasks.map((task) => ({
|
|
675
|
-
task: task.name,
|
|
676
|
-
mean_ms: task.mean_ms,
|
|
677
|
-
ops_s: round(task.hz, 3),
|
|
678
|
-
samples: task.samples,
|
|
679
|
-
})));
|
|
680
|
-
}
|
|
681
|
-
process.exit(0);
|
|
682
|
-
//# sourceMappingURL=file-ingest.js.map
|