flatsql 3.11.0 → 3.12.0
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/README.md +61 -795
- package/bin/flatsql.mjs +76 -0
- package/cpp/README.md +18 -0
- package/cpp/include/flatsql/flatsql.h +162 -0
- package/cpp/include/flatsql/flatsql_io.h +159 -0
- package/docs/API-3.12.md +114 -0
- package/package.json +28 -123
- package/wasm/flatsql.wasm +0 -0
- package/wasm/index.d.ts +61 -548
- package/wasm/index.js +280 -1281
- package/wasm/integrity.json +6 -26
- package/wasm/runtime/LICENSE.sdk.txt +190 -0
- package/wasm/runtime/NOTICE.txt +2 -0
- package/wasm/runtime/browser-guest.mjs +1 -0
- package/wasm/runtime/browser-host.mjs +1 -0
- package/wasm/runtime/node-guest.mjs +2 -0
- package/wasm/runtime/node-host.mjs +5 -0
- package/wasm/runtime/opfsIoWorker.mjs +1 -0
- package/wasm/runtime/wasiThreadBrowserWorker.mjs +1 -0
- package/dist/artifacts/index.d.ts +0 -3
- package/dist/artifacts/index.d.ts.map +0 -1
- package/dist/artifacts/index.js +0 -3
- package/dist/artifacts/index.js.map +0 -1
- package/dist/artifacts/transport.d.ts +0 -5
- package/dist/artifacts/transport.d.ts.map +0 -1
- package/dist/artifacts/transport.js +0 -45
- package/dist/artifacts/transport.js.map +0 -1
- package/dist/artifacts/types.d.ts +0 -34
- package/dist/artifacts/types.d.ts.map +0 -1
- package/dist/artifacts/types.js +0 -2
- package/dist/artifacts/types.js.map +0 -1
- package/dist/btree/btree.d.ts +0 -34
- package/dist/btree/btree.d.ts.map +0 -1
- package/dist/btree/btree.js +0 -234
- package/dist/btree/btree.js.map +0 -1
- package/dist/btree/index.d.ts +0 -3
- package/dist/btree/index.d.ts.map +0 -1
- package/dist/btree/index.js +0 -3
- package/dist/btree/index.js.map +0 -1
- package/dist/btree/types.d.ts +0 -36
- package/dist/btree/types.d.ts.map +0 -1
- package/dist/btree/types.js +0 -55
- package/dist/btree/types.js.map +0 -1
- package/dist/cluster/index.d.ts +0 -11
- package/dist/cluster/index.d.ts.map +0 -1
- package/dist/cluster/index.js +0 -59
- package/dist/cluster/index.js.map +0 -1
- package/dist/response/artifact.d.ts +0 -4
- package/dist/response/artifact.d.ts.map +0 -1
- package/dist/response/artifact.js +0 -102
- package/dist/response/artifact.js.map +0 -1
- package/dist/response/cache-key.d.ts +0 -6
- package/dist/response/cache-key.d.ts.map +0 -1
- package/dist/response/cache-key.js +0 -114
- package/dist/response/cache-key.js.map +0 -1
- package/dist/response/index.d.ts +0 -5
- package/dist/response/index.d.ts.map +0 -1
- package/dist/response/index.js +0 -5
- package/dist/response/index.js.map +0 -1
- package/dist/response/memory-cache.d.ts +0 -17
- package/dist/response/memory-cache.d.ts.map +0 -1
- package/dist/response/memory-cache.js +0 -76
- package/dist/response/memory-cache.js.map +0 -1
- package/dist/response/types.d.ts +0 -57
- package/dist/response/types.d.ts.map +0 -1
- package/dist/response/types.js +0 -2
- package/dist/response/types.js.map +0 -1
- package/dist/schema/index.d.ts +0 -3
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js +0 -3
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/parser.d.ts +0 -25
- package/dist/schema/parser.d.ts.map +0 -1
- package/dist/schema/parser.js +0 -474
- package/dist/schema/parser.js.map +0 -1
- package/dist/schema/types.d.ts +0 -33
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js +0 -29
- package/dist/schema/types.js.map +0 -1
- package/dist/standalone/index.d.ts +0 -3
- package/dist/standalone/index.d.ts.map +0 -1
- package/dist/standalone/index.js +0 -3
- package/dist/standalone/index.js.map +0 -1
- package/dist/standalone/process-client.d.ts +0 -85
- package/dist/standalone/process-client.d.ts.map +0 -1
- package/dist/standalone/process-client.js +0 -537
- package/dist/standalone/process-client.js.map +0 -1
- package/dist/standalone/wasmedge-runner.d.ts +0 -19
- package/dist/standalone/wasmedge-runner.d.ts.map +0 -1
- package/dist/standalone/wasmedge-runner.js +0 -108
- package/dist/standalone/wasmedge-runner.js.map +0 -1
- package/dist/storage/index.d.ts +0 -3
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js +0 -3
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/stacked-flatbuffers.d.ts +0 -38
- package/dist/storage/stacked-flatbuffers.d.ts.map +0 -1
- package/dist/storage/stacked-flatbuffers.js +0 -253
- package/dist/storage/stacked-flatbuffers.js.map +0 -1
- package/dist/storage/types.d.ts +0 -23
- package/dist/storage/types.d.ts.map +0 -1
- package/dist/storage/types.js +0 -27
- package/dist/storage/types.js.map +0 -1
- package/dist/stress/aggregate.d.ts +0 -3
- package/dist/stress/aggregate.d.ts.map +0 -1
- package/dist/stress/aggregate.js +0 -61
- package/dist/stress/aggregate.js.map +0 -1
- package/dist/stress/docker-compose.d.ts +0 -17
- package/dist/stress/docker-compose.d.ts.map +0 -1
- package/dist/stress/docker-compose.js +0 -156
- package/dist/stress/docker-compose.js.map +0 -1
- package/dist/stress/index.d.ts +0 -10
- package/dist/stress/index.d.ts.map +0 -1
- package/dist/stress/index.js +0 -10
- package/dist/stress/index.js.map +0 -1
- package/dist/stress/metrics.d.ts +0 -3
- package/dist/stress/metrics.d.ts.map +0 -1
- package/dist/stress/metrics.js +0 -83
- package/dist/stress/metrics.js.map +0 -1
- package/dist/stress/native-publish-event-workload.d.ts +0 -3
- package/dist/stress/native-publish-event-workload.d.ts.map +0 -1
- package/dist/stress/native-publish-event-workload.js +0 -465
- package/dist/stress/native-publish-event-workload.js.map +0 -1
- package/dist/stress/production-gate.d.ts +0 -4
- package/dist/stress/production-gate.d.ts.map +0 -1
- package/dist/stress/production-gate.js +0 -12
- package/dist/stress/production-gate.js.map +0 -1
- package/dist/stress/report.d.ts +0 -3
- package/dist/stress/report.d.ts.map +0 -1
- package/dist/stress/report.js +0 -174
- package/dist/stress/report.js.map +0 -1
- package/dist/stress/sds-discovery.d.ts +0 -4
- package/dist/stress/sds-discovery.d.ts.map +0 -1
- package/dist/stress/sds-discovery.js +0 -40
- package/dist/stress/sds-discovery.js.map +0 -1
- package/dist/stress/smoke-runner.d.ts +0 -3
- package/dist/stress/smoke-runner.d.ts.map +0 -1
- package/dist/stress/smoke-runner.js +0 -64
- package/dist/stress/smoke-runner.js.map +0 -1
- package/dist/stress/types.d.ts +0 -219
- package/dist/stress/types.d.ts.map +0 -1
- package/dist/stress/types.js +0 -2
- package/dist/stress/types.js.map +0 -1
- package/dist/stress/workload.d.ts +0 -6
- package/dist/stress/workload.d.ts.map +0 -1
- package/dist/stress/workload.js +0 -144
- package/dist/stress/workload.js.map +0 -1
- package/docs/PARTITION-STORE-WASM.md +0 -338
- package/docs/PARTITION-STORE.md +0 -2380
- package/docs/agents/response-artifacts.md +0 -65
- package/docs/response-artifacts.md +0 -86
- package/scripts/stress-docker.sh +0 -279
- package/sdm/flatsql-spatial.wasm +0 -0
- package/sdm/index.d.ts +0 -88
- package/sdm/index.js +0 -253
- package/sdm/manifest.json +0 -402
- package/stress/docker/Dockerfile +0 -11
- package/stress/docker/docker-compose.yml +0 -51
- package/stress/sds/aggregate.mjs +0 -97
- package/stress/sds/run.mjs +0 -105
- package/stress/sds/write-compose.mjs +0 -96
- package/wasm/flatsql-client.js +0 -280
- package/wasm/flatsql-io.d.ts +0 -97
- package/wasm/flatsql-io.js +0 -621
- package/wasm/flatsql-p4-threads.wasm +0 -0
- package/wasm/flatsql-ps-threads.wasm +0 -0
- package/wasm/flatsql-wasi-noeh.wasm +0 -0
- package/wasm/flatsql-wasi.wasm +0 -0
- package/wasm/flatsql.js +0 -2
- package/wasm/flatsql.worker.js +0 -209
- package/wasm/native/flatsql_wasmedge_runner.cpp +0 -858
- package/wasm/ps-node-fault.d.mts +0 -23
- package/wasm/ps-node-fault.mjs +0 -381
- package/wasm/ps-node-guest.mjs +0 -173
- package/wasm/ps-node-host.d.mts +0 -95
- package/wasm/ps-node-host.mjs +0 -476
- package/wasm/ps-node-imports.mjs +0 -847
- package/wasm/ps.d.ts +0 -21
- package/wasm/ps.js +0 -75
- package/wasm/wasi.d.ts +0 -11
- package/wasm/wasi.js +0 -51
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
controller:
|
|
3
|
-
build:
|
|
4
|
-
context: ../..
|
|
5
|
-
dockerfile: stress/docker/Dockerfile
|
|
6
|
-
environment:
|
|
7
|
-
STRESS_MODE: ${STRESS_MODE:-smoke}
|
|
8
|
-
RUN_ID: ${RUN_ID:-docker-smoke}
|
|
9
|
-
NODE_COUNT: ${NODE_COUNT:-2}
|
|
10
|
-
NODE_STORAGE_GB: ${NODE_STORAGE_GB:-0.01}
|
|
11
|
-
RECORDS_PER_NODE: ${RECORDS_PER_NODE:-25}
|
|
12
|
-
BATCH_BYTES: ${BATCH_BYTES:-1048576}
|
|
13
|
-
QUERY_CONCURRENCY: ${QUERY_CONCURRENCY:-4}
|
|
14
|
-
HOT_QUERY_RATIO: ${HOT_QUERY_RATIO:-0.9}
|
|
15
|
-
SDS_SCHEMA_ROOT: /sds/schema
|
|
16
|
-
OUTPUT_DIR: /stress-results
|
|
17
|
-
RUNTIME: ${RUNTIME:-standalone}
|
|
18
|
-
NODE_ISOLATION: ${NODE_ISOLATION:-logical}
|
|
19
|
-
STRESS_TRANSPORT: docker-compose
|
|
20
|
-
volumes:
|
|
21
|
-
- ${SDS_SCHEMA_ROOT_HOST:-../../spacedatastandards.org/schema}:/sds/schema:ro
|
|
22
|
-
- ${OUTPUT_DIR_HOST:-../results/docker-smoke}:/stress-results
|
|
23
|
-
command:
|
|
24
|
-
- node
|
|
25
|
-
- stress/sds/run.mjs
|
|
26
|
-
- --mode
|
|
27
|
-
- ${STRESS_MODE:-smoke}
|
|
28
|
-
- --schema-root
|
|
29
|
-
- /sds/schema
|
|
30
|
-
- --output-dir
|
|
31
|
-
- /stress-results
|
|
32
|
-
- --nodes
|
|
33
|
-
- ${NODE_COUNT:-2}
|
|
34
|
-
- --storage-gb
|
|
35
|
-
- ${NODE_STORAGE_GB:-0.01}
|
|
36
|
-
- --records-per-node
|
|
37
|
-
- ${RECORDS_PER_NODE:-25}
|
|
38
|
-
- --batch-bytes
|
|
39
|
-
- ${BATCH_BYTES:-1048576}
|
|
40
|
-
- --query-concurrency
|
|
41
|
-
- ${QUERY_CONCURRENCY:-4}
|
|
42
|
-
- --hot-query-ratio
|
|
43
|
-
- ${HOT_QUERY_RATIO:-0.9}
|
|
44
|
-
- --run-id
|
|
45
|
-
- ${RUN_ID:-docker-smoke}
|
|
46
|
-
- --runtime
|
|
47
|
-
- ${RUNTIME:-standalone}
|
|
48
|
-
- --node-isolation
|
|
49
|
-
- ${NODE_ISOLATION:-logical}
|
|
50
|
-
- --transport
|
|
51
|
-
- docker-compose
|
package/stress/sds/aggregate.mjs
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { readdir } from 'node:fs/promises';
|
|
4
|
-
import { join, resolve } from 'node:path';
|
|
5
|
-
import { aggregateStressRunArtifacts, assertProductionReadiness } from '../../dist/stress/index.js';
|
|
6
|
-
|
|
7
|
-
function readOption(argv, name, defaultValue = undefined) {
|
|
8
|
-
const prefix = `--${name}=`;
|
|
9
|
-
let value = defaultValue;
|
|
10
|
-
for (let index = 0; index < argv.length; index++) {
|
|
11
|
-
const arg = argv[index];
|
|
12
|
-
if (arg === `--${name}`) {
|
|
13
|
-
value = argv[index + 1];
|
|
14
|
-
index++;
|
|
15
|
-
} else if (arg.startsWith(prefix)) {
|
|
16
|
-
value = arg.slice(prefix.length);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function readNumber(argv, name, defaultValue = undefined) {
|
|
23
|
-
const value = readOption(argv, name, defaultValue === undefined ? undefined : String(defaultValue));
|
|
24
|
-
if (value === undefined) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const parsed = Number(value);
|
|
28
|
-
if (!Number.isFinite(parsed)) {
|
|
29
|
-
throw new Error(`Invalid numeric value for --${name}: ${value}`);
|
|
30
|
-
}
|
|
31
|
-
return parsed;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function printHelp() {
|
|
35
|
-
console.log(`Usage: node stress/sds/aggregate.mjs [options]
|
|
36
|
-
|
|
37
|
-
Options:
|
|
38
|
-
--input-dir <path> Directory containing node result subdirectories
|
|
39
|
-
--output-dir <path> Directory for aggregate result artifacts
|
|
40
|
-
--run-id <id>
|
|
41
|
-
--mode smoke|full
|
|
42
|
-
--node-storage-gb <gb>
|
|
43
|
-
--records-per-node <count>
|
|
44
|
-
--transport in-process|docker-compose
|
|
45
|
-
--node-isolation logical|container
|
|
46
|
-
`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function listInputDirs(inputRoot) {
|
|
50
|
-
const entries = await readdir(inputRoot, { withFileTypes: true });
|
|
51
|
-
return entries
|
|
52
|
-
.filter((entry) => entry.isDirectory())
|
|
53
|
-
.map((entry) => join(inputRoot, entry.name))
|
|
54
|
-
.sort();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function main() {
|
|
58
|
-
const argv = process.argv.slice(2);
|
|
59
|
-
if (argv.includes('--help') || argv.includes('-h')) {
|
|
60
|
-
printHelp();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const inputRoot = resolve(readOption(argv, 'input-dir', 'stress/results/nodes'));
|
|
65
|
-
const outputDir = resolve(readOption(argv, 'output-dir', 'stress/results/aggregate'));
|
|
66
|
-
const runId = readOption(argv, 'run-id', process.env.RUN_ID ?? `sds-aggregate-${Date.now()}`);
|
|
67
|
-
const mode = readOption(argv, 'mode', process.env.STRESS_MODE ?? 'smoke');
|
|
68
|
-
const inputDirs = await listInputDirs(inputRoot);
|
|
69
|
-
|
|
70
|
-
const result = await aggregateStressRunArtifacts({
|
|
71
|
-
inputDirs,
|
|
72
|
-
outputDir,
|
|
73
|
-
runId,
|
|
74
|
-
mode,
|
|
75
|
-
nodeStorageGb: readNumber(argv, 'node-storage-gb', process.env.NODE_STORAGE_GB) ?? 1,
|
|
76
|
-
recordsPerNode: readNumber(argv, 'records-per-node', process.env.RECORDS_PER_NODE) ?? 0,
|
|
77
|
-
transport: readOption(argv, 'transport', process.env.STRESS_TRANSPORT ?? 'docker-compose'),
|
|
78
|
-
nodeIsolation: readOption(argv, 'node-isolation', process.env.NODE_ISOLATION ?? 'container'),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
console.log(`FlatSQL SDS aggregate ${result.manifest.mode} run: ${result.manifest.runId}`);
|
|
82
|
-
console.log(`Nodes: ${result.summary.nodes.length}`);
|
|
83
|
-
console.log(`Result directory: ${outputDir}`);
|
|
84
|
-
console.log(`Events: ${result.summary.eventCount}`);
|
|
85
|
-
console.log(`Request bytes: ${result.summary.totalRequestBytes}`);
|
|
86
|
-
console.log(`Response bytes: ${result.summary.totalResponseBytes}`);
|
|
87
|
-
console.log(`Cache hits/misses: ${result.summary.totalCacheHits}/${result.summary.totalCacheMisses}`);
|
|
88
|
-
|
|
89
|
-
if (result.manifest.mode === 'full') {
|
|
90
|
-
assertProductionReadiness(result.report);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
main().catch((error) => {
|
|
95
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
96
|
-
process.exitCode = 1;
|
|
97
|
-
});
|
package/stress/sds/run.mjs
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { assertProductionReadiness, runSmokeHarness } from '../../dist/stress/index.js';
|
|
5
|
-
|
|
6
|
-
function readOption(argv, name, defaultValue = undefined) {
|
|
7
|
-
const prefix = `--${name}=`;
|
|
8
|
-
let value = defaultValue;
|
|
9
|
-
for (let index = 0; index < argv.length; index++) {
|
|
10
|
-
const arg = argv[index];
|
|
11
|
-
if (arg === `--${name}`) {
|
|
12
|
-
value = argv[index + 1];
|
|
13
|
-
index++;
|
|
14
|
-
} else if (arg.startsWith(prefix)) {
|
|
15
|
-
value = arg.slice(prefix.length);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function readNumber(argv, name, defaultValue = undefined) {
|
|
22
|
-
const value = readOption(argv, name, defaultValue === undefined ? undefined : String(defaultValue));
|
|
23
|
-
if (value === undefined) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
const parsed = Number(value);
|
|
27
|
-
if (!Number.isFinite(parsed)) {
|
|
28
|
-
throw new Error(`Invalid numeric value for --${name}: ${value}`);
|
|
29
|
-
}
|
|
30
|
-
return parsed;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function printHelp() {
|
|
34
|
-
console.log(`Usage: node stress/sds/run.mjs [options]
|
|
35
|
-
|
|
36
|
-
Options:
|
|
37
|
-
--mode smoke|full
|
|
38
|
-
--schema-root <path>
|
|
39
|
-
--output-dir <path>
|
|
40
|
-
--nodes <count>
|
|
41
|
-
--node-id-offset <count>
|
|
42
|
-
--storage-gb <gb>
|
|
43
|
-
--records-per-node <count>
|
|
44
|
-
--batch-bytes <bytes>
|
|
45
|
-
--query-concurrency <count>
|
|
46
|
-
--hot-query-ratio <ratio>
|
|
47
|
-
--runtime standalone|wasmedge|native
|
|
48
|
-
--transport in-process|docker-compose
|
|
49
|
-
--node-isolation logical|container
|
|
50
|
-
--skip-production-gate
|
|
51
|
-
--run-id <id>
|
|
52
|
-
`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function main() {
|
|
56
|
-
const argv = process.argv.slice(2);
|
|
57
|
-
if (argv.includes('--help') || argv.includes('-h')) {
|
|
58
|
-
printHelp();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const mode = readOption(argv, 'mode', process.env.STRESS_MODE ?? 'smoke');
|
|
63
|
-
const runId = readOption(argv, 'run-id', process.env.RUN_ID ?? `sds-${mode}-${Date.now()}`);
|
|
64
|
-
const schemaRoot = resolve(
|
|
65
|
-
readOption(argv, 'schema-root', process.env.SDS_SCHEMA_ROOT ?? '../spacedatastandards.org/schema')
|
|
66
|
-
);
|
|
67
|
-
const outputDir = resolve(
|
|
68
|
-
readOption(argv, 'output-dir', process.env.OUTPUT_DIR ?? `stress/results/${runId}`)
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const result = await runSmokeHarness({
|
|
72
|
-
mode,
|
|
73
|
-
runId,
|
|
74
|
-
schemaRoot,
|
|
75
|
-
outputDir,
|
|
76
|
-
nodeCount: readNumber(argv, 'nodes', process.env.NODE_COUNT),
|
|
77
|
-
nodeIdOffset: readNumber(argv, 'node-id-offset', process.env.NODE_ID_OFFSET),
|
|
78
|
-
nodeStorageGb: readNumber(argv, 'storage-gb', process.env.NODE_STORAGE_GB),
|
|
79
|
-
recordsPerNode: readNumber(argv, 'records-per-node', process.env.RECORDS_PER_NODE),
|
|
80
|
-
batchBytes: readNumber(argv, 'batch-bytes', process.env.BATCH_BYTES),
|
|
81
|
-
queryConcurrency: readNumber(argv, 'query-concurrency', process.env.QUERY_CONCURRENCY),
|
|
82
|
-
hotQueryRatio: readNumber(argv, 'hot-query-ratio', process.env.HOT_QUERY_RATIO),
|
|
83
|
-
runtime: readOption(argv, 'runtime', process.env.RUNTIME),
|
|
84
|
-
transport: readOption(argv, 'transport', process.env.STRESS_TRANSPORT),
|
|
85
|
-
nodeIsolation: readOption(argv, 'node-isolation', process.env.NODE_ISOLATION),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
console.log(`FlatSQL SDS stress ${result.manifest.mode} run: ${result.manifest.runId}`);
|
|
89
|
-
console.log(`Schemas: ${result.manifest.schemaCount}`);
|
|
90
|
-
console.log(`Nodes: ${result.manifest.nodeCount}`);
|
|
91
|
-
console.log(`Result directory: ${outputDir}`);
|
|
92
|
-
console.log(`Events: ${result.summary.eventCount}`);
|
|
93
|
-
console.log(`Request bytes: ${result.summary.totalRequestBytes}`);
|
|
94
|
-
console.log(`Response bytes: ${result.summary.totalResponseBytes}`);
|
|
95
|
-
console.log(`Cache hits/misses: ${result.summary.totalCacheHits}/${result.summary.totalCacheMisses}`);
|
|
96
|
-
|
|
97
|
-
if (result.manifest.mode === 'full' && !argv.includes('--skip-production-gate')) {
|
|
98
|
-
assertProductionReadiness(result.report);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
main().catch((error) => {
|
|
103
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
104
|
-
process.exitCode = 1;
|
|
105
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { dirname, resolve } from 'node:path';
|
|
5
|
-
import { buildFullStressDockerCompose } from '../../dist/stress/index.js';
|
|
6
|
-
|
|
7
|
-
function readOption(argv, name, defaultValue = undefined) {
|
|
8
|
-
const prefix = `--${name}=`;
|
|
9
|
-
let value = defaultValue;
|
|
10
|
-
for (let index = 0; index < argv.length; index++) {
|
|
11
|
-
const arg = argv[index];
|
|
12
|
-
if (arg === `--${name}`) {
|
|
13
|
-
value = argv[index + 1];
|
|
14
|
-
index++;
|
|
15
|
-
} else if (arg.startsWith(prefix)) {
|
|
16
|
-
value = arg.slice(prefix.length);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function readNumber(argv, name, defaultValue = undefined) {
|
|
23
|
-
const value = readOption(argv, name, defaultValue === undefined ? undefined : String(defaultValue));
|
|
24
|
-
if (value === undefined) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const parsed = Number(value);
|
|
28
|
-
if (!Number.isFinite(parsed)) {
|
|
29
|
-
throw new Error(`Invalid numeric value for --${name}: ${value}`);
|
|
30
|
-
}
|
|
31
|
-
return parsed;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function printHelp() {
|
|
35
|
-
console.log(`Usage: node stress/sds/write-compose.mjs [options]
|
|
36
|
-
|
|
37
|
-
Options:
|
|
38
|
-
--output-file <path>
|
|
39
|
-
--project-root <path>
|
|
40
|
-
--schema-root-host <path>
|
|
41
|
-
--output-dir-host <path>
|
|
42
|
-
--run-id <id>
|
|
43
|
-
--mode smoke|full
|
|
44
|
-
--nodes <count>
|
|
45
|
-
--storage-gb <gb>
|
|
46
|
-
--records-per-node <count>
|
|
47
|
-
--batch-bytes <bytes>
|
|
48
|
-
--query-concurrency <count>
|
|
49
|
-
--hot-query-ratio <ratio>
|
|
50
|
-
--runtime standalone|wasmedge|native
|
|
51
|
-
`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async function main() {
|
|
55
|
-
const argv = process.argv.slice(2);
|
|
56
|
-
if (argv.includes('--help') || argv.includes('-h')) {
|
|
57
|
-
printHelp();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const outputFile = resolve(readOption(argv, 'output-file', 'stress/results/docker-compose.full.yml'));
|
|
62
|
-
const projectRoot = resolve(readOption(argv, 'project-root', process.cwd()));
|
|
63
|
-
const schemaRootHost = resolve(readOption(argv, 'schema-root-host', '../spacedatastandards.org/schema'));
|
|
64
|
-
const outputDirHost = resolve(readOption(argv, 'output-dir-host', 'stress/results/full'));
|
|
65
|
-
const nodeCount = readNumber(argv, 'nodes', process.env.NODE_COUNT) ?? 100;
|
|
66
|
-
|
|
67
|
-
const compose = buildFullStressDockerCompose({
|
|
68
|
-
projectRoot,
|
|
69
|
-
schemaRootHost,
|
|
70
|
-
outputDirHost,
|
|
71
|
-
runId: readOption(argv, 'run-id', process.env.RUN_ID ?? `sds-full-${Date.now()}`),
|
|
72
|
-
mode: readOption(argv, 'mode', process.env.STRESS_MODE ?? 'full'),
|
|
73
|
-
nodeCount,
|
|
74
|
-
nodeStorageGb: readNumber(argv, 'storage-gb', process.env.NODE_STORAGE_GB) ?? 1,
|
|
75
|
-
recordsPerNode: readNumber(argv, 'records-per-node', process.env.RECORDS_PER_NODE) ?? 2900000,
|
|
76
|
-
batchBytes: readNumber(argv, 'batch-bytes', process.env.BATCH_BYTES) ?? 1048576,
|
|
77
|
-
queryConcurrency: readNumber(argv, 'query-concurrency', process.env.QUERY_CONCURRENCY) ?? 64,
|
|
78
|
-
hotQueryRatio: readNumber(argv, 'hot-query-ratio', process.env.HOT_QUERY_RATIO) ?? 0.01,
|
|
79
|
-
runtime: readOption(argv, 'runtime', process.env.RUNTIME ?? 'standalone'),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
await mkdir(dirname(outputFile), { recursive: true });
|
|
83
|
-
await mkdir(outputDirHost, { recursive: true });
|
|
84
|
-
await mkdir(`${outputDirHost}/nodes`, { recursive: true });
|
|
85
|
-
await mkdir(`${outputDirHost}/aggregate`, { recursive: true });
|
|
86
|
-
await Promise.all(
|
|
87
|
-
Array.from({ length: nodeCount }, (_, nodeId) => mkdir(`${outputDirHost}/nodes/node-${nodeId}`, { recursive: true }))
|
|
88
|
-
);
|
|
89
|
-
await writeFile(outputFile, compose);
|
|
90
|
-
console.log(outputFile);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
main().catch((error) => {
|
|
94
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
95
|
-
process.exitCode = 1;
|
|
96
|
-
});
|
package/wasm/flatsql-client.js
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FlatSQL Worker Client
|
|
3
|
-
* Provides a clean async API for communicating with the FlatSQL worker.
|
|
4
|
-
* Works in: Browser, Node.js, Deno
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* import { FlatSQLClient, FlatSQLWorkerDatabase } from './flatsql-client.js';
|
|
8
|
-
*
|
|
9
|
-
* const client = new FlatSQLClient();
|
|
10
|
-
* await client.init();
|
|
11
|
-
*
|
|
12
|
-
* const db = await client.createDatabase(schema, 'mydb');
|
|
13
|
-
* await db.registerFileId('USER', 'User');
|
|
14
|
-
* const result = await db.query('SELECT * FROM User');
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// Environment detection
|
|
18
|
-
const isBrowser = typeof window !== 'undefined' || (typeof self !== 'undefined' && typeof importScripts === 'undefined');
|
|
19
|
-
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
20
|
-
const isDeno = typeof Deno !== 'undefined';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Create a worker based on the environment
|
|
24
|
-
*/
|
|
25
|
-
async function createWorker(workerPath) {
|
|
26
|
-
if (isNode) {
|
|
27
|
-
const { Worker } = await import('worker_threads');
|
|
28
|
-
return new Worker(workerPath);
|
|
29
|
-
} else if (isDeno) {
|
|
30
|
-
return new Worker(new URL(workerPath, import.meta.url), { type: 'module' });
|
|
31
|
-
} else {
|
|
32
|
-
// Browser
|
|
33
|
-
return new Worker(workerPath, { type: 'module' });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Setup message handlers for the worker
|
|
39
|
-
*/
|
|
40
|
-
function setupWorkerHandlers(worker, handlers) {
|
|
41
|
-
if (isNode) {
|
|
42
|
-
worker.on('message', handlers.onMessage);
|
|
43
|
-
worker.on('error', handlers.onError);
|
|
44
|
-
worker.on('exit', handlers.onExit);
|
|
45
|
-
} else {
|
|
46
|
-
worker.onmessage = (e) => handlers.onMessage(e.data);
|
|
47
|
-
worker.onerror = handlers.onError;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* FlatSQL Worker Client
|
|
53
|
-
* Manages communication with the FlatSQL worker.
|
|
54
|
-
*/
|
|
55
|
-
export class FlatSQLClient {
|
|
56
|
-
constructor(workerPath = './flatsql.worker.js') {
|
|
57
|
-
this.workerPath = workerPath;
|
|
58
|
-
this.worker = null;
|
|
59
|
-
this.pending = new Map();
|
|
60
|
-
this.nextId = 1;
|
|
61
|
-
this.ready = false;
|
|
62
|
-
this.readyPromise = null;
|
|
63
|
-
this.databases = new Map();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Initialize the client and worker
|
|
68
|
-
*/
|
|
69
|
-
async init() {
|
|
70
|
-
if (this.worker) return this;
|
|
71
|
-
|
|
72
|
-
this.worker = await createWorker(this.workerPath);
|
|
73
|
-
|
|
74
|
-
this.readyPromise = new Promise((resolve, reject) => {
|
|
75
|
-
const timeout = setTimeout(() => {
|
|
76
|
-
reject(new Error('Worker initialization timeout'));
|
|
77
|
-
}, 30000);
|
|
78
|
-
|
|
79
|
-
const handlers = {
|
|
80
|
-
onMessage: (data) => {
|
|
81
|
-
if (data.type === 'ready') {
|
|
82
|
-
clearTimeout(timeout);
|
|
83
|
-
this.ready = true;
|
|
84
|
-
resolve();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const { id, success, result, error } = data;
|
|
89
|
-
const pending = this.pending.get(id);
|
|
90
|
-
if (pending) {
|
|
91
|
-
this.pending.delete(id);
|
|
92
|
-
if (success) {
|
|
93
|
-
pending.resolve(result);
|
|
94
|
-
} else {
|
|
95
|
-
pending.reject(new Error(error));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
onError: (err) => {
|
|
100
|
-
clearTimeout(timeout);
|
|
101
|
-
reject(err);
|
|
102
|
-
},
|
|
103
|
-
onExit: (code) => {
|
|
104
|
-
if (code !== 0) {
|
|
105
|
-
reject(new Error(`Worker exited with code ${code}`));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
setupWorkerHandlers(this.worker, handlers);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
await this.readyPromise;
|
|
114
|
-
|
|
115
|
-
// Initialize WASM in worker
|
|
116
|
-
await this.call('init');
|
|
117
|
-
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Call a method on the worker
|
|
123
|
-
*/
|
|
124
|
-
async call(method, params = {}) {
|
|
125
|
-
if (!this.worker) {
|
|
126
|
-
throw new Error('Client not initialized. Call init() first.');
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const id = this.nextId++;
|
|
130
|
-
|
|
131
|
-
return new Promise((resolve, reject) => {
|
|
132
|
-
this.pending.set(id, { resolve, reject });
|
|
133
|
-
this.worker.postMessage({ id, method, params });
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Create a new database
|
|
139
|
-
*/
|
|
140
|
-
async createDatabase(schema, name = 'default') {
|
|
141
|
-
const dbId = `db_${this.nextId++}`;
|
|
142
|
-
await this.call('createDatabase', { id: dbId, schema, name });
|
|
143
|
-
const db = new FlatSQLWorkerDatabase(this, dbId);
|
|
144
|
-
this.databases.set(dbId, db);
|
|
145
|
-
return db;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Create a test User FlatBuffer (for demos)
|
|
150
|
-
*/
|
|
151
|
-
async createTestUser(id, name, email, age) {
|
|
152
|
-
const result = await this.call('createTestUser', { id, name, email, age });
|
|
153
|
-
return new Uint8Array(result.data);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Create a test Post FlatBuffer (for demos)
|
|
158
|
-
*/
|
|
159
|
-
async createTestPost(id, userId, title) {
|
|
160
|
-
const result = await this.call('createTestPost', { id, userId, title });
|
|
161
|
-
return new Uint8Array(result.data);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Terminate the worker
|
|
166
|
-
*/
|
|
167
|
-
terminate() {
|
|
168
|
-
if (this.worker) {
|
|
169
|
-
if (isNode) {
|
|
170
|
-
this.worker.terminate();
|
|
171
|
-
} else {
|
|
172
|
-
this.worker.terminate();
|
|
173
|
-
}
|
|
174
|
-
this.worker = null;
|
|
175
|
-
this.ready = false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* FlatSQL Database accessed through a worker
|
|
182
|
-
*/
|
|
183
|
-
export class FlatSQLWorkerDatabase {
|
|
184
|
-
constructor(client, dbId) {
|
|
185
|
-
this._client = client;
|
|
186
|
-
this._dbId = dbId;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Register a file ID for routing FlatBuffers to tables
|
|
191
|
-
*/
|
|
192
|
-
async registerFileId(fileId, tableName) {
|
|
193
|
-
await this._client.call('registerFileId', {
|
|
194
|
-
dbId: this._dbId,
|
|
195
|
-
fileId,
|
|
196
|
-
tableName
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Enable built-in demo extractors (User/Post)
|
|
202
|
-
*/
|
|
203
|
-
async enableDemoExtractors() {
|
|
204
|
-
await this._client.call('enableDemoExtractors', { dbId: this._dbId });
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Execute a SQL query
|
|
209
|
-
*/
|
|
210
|
-
async query(sql) {
|
|
211
|
-
return await this._client.call('query', { dbId: this._dbId, sql });
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Ingest a size-prefixed FlatBuffer stream
|
|
216
|
-
*/
|
|
217
|
-
async ingest(data) {
|
|
218
|
-
const result = await this._client.call('ingest', {
|
|
219
|
-
dbId: this._dbId,
|
|
220
|
-
data: Array.from(data)
|
|
221
|
-
});
|
|
222
|
-
return result.bytesConsumed;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Ingest a single FlatBuffer (without size prefix)
|
|
227
|
-
*/
|
|
228
|
-
async ingestOne(data) {
|
|
229
|
-
const result = await this._client.call('ingestOne', {
|
|
230
|
-
dbId: this._dbId,
|
|
231
|
-
data: Array.from(data)
|
|
232
|
-
});
|
|
233
|
-
return result.rowId;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Ingest multiple FlatBuffers (builds stream internally)
|
|
238
|
-
*/
|
|
239
|
-
async ingestStream(buffers) {
|
|
240
|
-
const result = await this._client.call('ingestStream', {
|
|
241
|
-
dbId: this._dbId,
|
|
242
|
-
buffers: buffers.map(b => Array.from(b))
|
|
243
|
-
});
|
|
244
|
-
return result;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Export database as binary blob
|
|
249
|
-
*/
|
|
250
|
-
async exportData() {
|
|
251
|
-
const result = await this._client.call('exportData', { dbId: this._dbId });
|
|
252
|
-
return new Uint8Array(result.data);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* List all tables
|
|
257
|
-
*/
|
|
258
|
-
async listTables() {
|
|
259
|
-
const result = await this._client.call('listTables', { dbId: this._dbId });
|
|
260
|
-
return result.tables;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Get database statistics
|
|
265
|
-
*/
|
|
266
|
-
async getStats() {
|
|
267
|
-
const result = await this._client.call('getStats', { dbId: this._dbId });
|
|
268
|
-
return result.stats;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Delete the database and free resources
|
|
273
|
-
*/
|
|
274
|
-
async delete() {
|
|
275
|
-
await this._client.call('deleteDatabase', { dbId: this._dbId });
|
|
276
|
-
this._client.databases.delete(this._dbId);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export default FlatSQLClient;
|