@delali/narsil 0.3.1-next.112 → 0.3.1-next.115
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/dist/browser/{chunk-UR5MNN53.mjs → chunk-2TMWIATH.mjs} +108 -67
- package/dist/browser/{chunk-OVY4RPDS.mjs → chunk-73U5DWOZ.mjs} +39 -4
- package/dist/browser/{chunk-O5IKTA27.mjs → chunk-FODCC3MK.mjs} +1 -1
- package/dist/browser/{chunk-YRYBTRWB.mjs → chunk-I45FAGOF.mjs} +2 -2
- package/dist/browser/{durability-wiring-CPEMDDK7.mjs → durability-wiring-CSMTKEYX.mjs} +3 -3
- package/dist/browser/{module-DYKR4INA.mjs → module-G2PPZV3B.mjs} +127 -33
- package/dist/browser/{restore-queue-2H4QDQV4.mjs → restore-queue-N7N42PBS.mjs} +1 -1
- package/dist/browser/{runtime-FL5K4JOH.mjs → runtime-BX6XRFYR.mjs} +2 -2
- package/dist/browser/{snapshot-ISZMBDCN.mjs → snapshot-EBH6RXQO.mjs} +6 -5
- package/dist/browser/{write-IABOLE4N.mjs → write-5ZKFINX3.mjs} +2 -2
- package/dist/{capabilities-ByaX8Arf.d.ts → capabilities-DOgB3pPf.d.ts} +2 -2
- package/dist/{chunk-ZXZ26WSO.mjs → chunk-22YPZVMG.mjs} +5 -1
- package/dist/{chunk-R2MRGYU5.mjs → chunk-4ZKBKPBV.mjs} +22 -2
- package/dist/{chunk-GLZI636G.mjs → chunk-5VVSHCXT.mjs} +27 -12
- package/dist/{chunk-3COL24MT.mjs → chunk-7EWQZQDT.mjs} +1 -1
- package/dist/{chunk-QI6JW4PM.mjs → chunk-BCNUJVTT.mjs} +1 -1
- package/dist/{chunk-3RRATITJ.mjs → chunk-BCSWODXP.mjs} +75 -55
- package/dist/{thread-WGBCVJII.mjs → chunk-DEXID4ZT.mjs} +301 -200
- package/dist/chunk-EBIHRL7B.mjs +21 -0
- package/dist/{chunk-YIDSHBQS.mjs → chunk-HC5NURS6.mjs} +33 -4
- package/dist/{chunk-V7G627TA.mjs → chunk-HFJXEFFV.mjs} +13 -62
- package/dist/{chunk-63HFWQEA.mjs → chunk-IE43SRL3.mjs} +276 -102
- package/dist/chunk-IWVEG5CX.mjs +67 -0
- package/dist/{chunk-2IFU7SXG.mjs → chunk-KGVC6KJ3.mjs} +4 -4
- package/dist/{chunk-7CI34JAP.mjs → chunk-KVLX65KD.mjs} +4 -4
- package/dist/{chunk-5WEBVYOA.mjs → chunk-N53HN5VA.mjs} +16 -9
- package/dist/chunk-N6J6EJW3.mjs +198 -0
- package/dist/{chunk-PT7VRWS7.mjs → chunk-NX7KU77V.mjs} +3 -2
- package/dist/{chunk-QIFOXLWF.mjs → chunk-OGFSUXYY.mjs} +2 -2
- package/dist/chunk-PELHVTO7.mjs +24 -0
- package/dist/{chunk-V7ISFBFC.mjs → chunk-Q62NDKEC.mjs} +5 -4
- package/dist/{chunk-6OXNHLNZ.mjs → chunk-RIIUZJQ3.mjs} +1 -1
- package/dist/{chunk-BVOUSX3U.mjs → chunk-UDZYIWDP.mjs} +3 -3
- package/dist/{chunk-HNAP2KTG.mjs → chunk-VFAXPDBH.mjs} +1 -0
- package/dist/{chunk-IBTKJIV7.mjs → chunk-VOKEYJHU.mjs} +1 -1
- package/dist/{chunk-C7SLA6CM.mjs → chunk-W55X2BYN.mjs} +5 -1
- package/dist/{chunk-IM76DLA7.mjs → chunk-YCFQ5754.mjs} +2 -2
- package/dist/{chunk-VLRT47GU.mjs → chunk-YCSRB3IN.mjs} +3 -3
- package/dist/{chunk-CQUMNIIG.mjs → chunk-Z4DZ4KK2.mjs} +1 -0
- package/dist/{chunk-SOADQINJ.mjs → chunk-ZATRDAYU.mjs} +31 -3
- package/dist/{chunk-2RAQKITH.mjs → chunk-ZR63OGT2.mjs} +1 -1
- package/dist/{client-BdnzDFtO.d.ts → client-BGzLNt78.d.ts} +2 -2
- package/dist/client.d.ts +6 -6
- package/dist/{config-ujZESkJz.d.ts → config-CS5ADSrx.d.ts} +18 -2
- package/dist/{config-CSgvApt0.d.ts → config-CSYMTTm1.d.ts} +1 -1
- package/dist/{direct-executor-ZSTKRA6Z.mjs → direct-executor-OUY4RPTU.mjs} +7 -6
- package/dist/distribution.d.ts +5 -5
- package/dist/distribution.mjs +79 -42
- package/dist/{durability-wiring-EQTFL3B4.mjs → durability-wiring-5V6DVHFK.mjs} +17 -16
- package/dist/{engine-C_HSy3iz.d.ts → engine-CCBBGmMR.d.ts} +1 -1
- package/dist/{events-CJsXF1F9.d.ts → events-D8GPB1-H.d.ts} +5 -0
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +10 -9
- package/dist/long-query-thread-HMQM2FWL.mjs +118 -0
- package/dist/{module-WP4VVGV2.mjs → module-3IMTXNPW.mjs} +92 -29
- package/dist/pattern.mjs +1 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +14 -13
- package/dist/react.d.ts +6 -6
- package/dist/{rerank-3POMPQNX.mjs → rerank-NYX5S7OG.mjs} +3 -3
- package/dist/{restore-queue-WZTMTJP2.mjs → restore-queue-J6PCG4ON.mjs} +1 -1
- package/dist/{runtime-C2435MPK.mjs → runtime-XNYW6AWX.mjs} +2 -2
- package/dist/server.d.ts +8 -8
- package/dist/server.mjs +110 -258
- package/dist/{snapshot-EU6NNB2P.mjs → snapshot-57WF53MK.mjs} +18 -17
- package/dist/{tasks-CI3Fvkxw.d.ts → tasks-5_LCFEzF.d.ts} +1 -1
- package/dist/thread-FDEHU5G3.mjs +31 -0
- package/dist/vector/search-worker.mjs +2 -2
- package/dist/workers/entry.mjs +19 -7
- package/dist/{write-CKRWS3P5.mjs → write-YEI7A5OR.mjs} +11 -10
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, bitsetHas, createBitSet, bitsetSet, bitsetIsEmpty, bitsetOrInto, bitsetAndNotInto, bitsetAndInto, bitsetFromSet, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-
|
|
1
|
+
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, bitsetHas, createBitSet, bitsetSet, bitsetIsEmpty, bitsetOrInto, bitsetAndNotInto, bitsetAndInto, bitsetFromSet, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-VFAXPDBH.mjs';
|
|
2
2
|
import { GEO_UNIT_METRES, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, FILTER_OPERAND_COPY_DEPTH } from './chunk-WQBCBKY3.mjs';
|
|
3
3
|
import { expandTermPrefix, suggestDisplayTerms, getNestedValue, textFieldsChanged, getFlatSchema, tokenizeOptions, partialWordSearchModule, getOrCreateFieldNameIndex, partitionDocumentFrequency } from './chunk-KCQG2PJT.mjs';
|
|
4
4
|
import { isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, partialFieldsOf, schemaFieldsOf, flattenSchema, validateDocument, validateDocumentStrict, ANTIMERIDIAN_SPAN_DEGREES, FULL_TURN_DEGREES, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, VINCENTY_CONVERGENCE_THRESHOLD, EARTH_RADIUS_METERS, RADIUS_BOX_MARGIN_RATIO, RADIUS_BOX_MARGIN_RADIANS, DEG_TO_RAD, VINCENTY_MAX_ITERATIONS } from './chunk-DG62H7OD.mjs';
|
|
@@ -7664,7 +7664,7 @@ function capExceeded(cap) {
|
|
|
7664
7664
|
{ cap }
|
|
7665
7665
|
);
|
|
7666
7666
|
}
|
|
7667
|
-
function localMeter(cap, spent, matcherStateBytes, flushUnits) {
|
|
7667
|
+
function localMeter(cap, spent, matcherStateBytes, flushUnits, clock) {
|
|
7668
7668
|
let total = spent;
|
|
7669
7669
|
let sharedCount = null;
|
|
7670
7670
|
const spentSoFar = () => sharedCount === null ? total : Number(Atomics.load(sharedCount, 0));
|
|
@@ -7672,11 +7672,13 @@ function localMeter(cap, spent, matcherStateBytes, flushUnits) {
|
|
|
7672
7672
|
cap,
|
|
7673
7673
|
matcherStateBytes,
|
|
7674
7674
|
flushUnits,
|
|
7675
|
+
clock,
|
|
7675
7676
|
add(units) {
|
|
7676
7677
|
if (units <= 0) return;
|
|
7677
7678
|
if (sharedCount === null) total += units;
|
|
7678
7679
|
else total = Number(Atomics.add(sharedCount, 0, BigInt(units))) + units;
|
|
7679
7680
|
if (total > cap) throw capExceeded(cap);
|
|
7681
|
+
if (clock !== void 0) clock.tick(units);
|
|
7680
7682
|
},
|
|
7681
7683
|
remaining() {
|
|
7682
7684
|
return cap - spentSoFar();
|
|
@@ -7715,8 +7717,8 @@ function localMeter(cap, spent, matcherStateBytes, flushUnits) {
|
|
|
7715
7717
|
};
|
|
7716
7718
|
return meter;
|
|
7717
7719
|
}
|
|
7718
|
-
function createPatternWorkMeter(cap = DEFAULT_PATTERN_WORK_CAP) {
|
|
7719
|
-
return localMeter(cap, 0, MATCHER_STATE_BUDGET_BYTES, PATTERN_WORK_FLUSH_UNITS);
|
|
7720
|
+
function createPatternWorkMeter(cap = DEFAULT_PATTERN_WORK_CAP, clock) {
|
|
7721
|
+
return localMeter(cap, 0, MATCHER_STATE_BUDGET_BYTES, PATTERN_WORK_FLUSH_UNITS, clock);
|
|
7720
7722
|
}
|
|
7721
7723
|
function sharedMeter(work, counter) {
|
|
7722
7724
|
const view = new BigInt64Array(counter);
|
|
@@ -7730,11 +7732,12 @@ function sharedMeter(work, counter) {
|
|
|
7730
7732
|
},
|
|
7731
7733
|
remaining() {
|
|
7732
7734
|
return work.cap - Number(Atomics.load(view, 0));
|
|
7733
|
-
}
|
|
7735
|
+
},
|
|
7736
|
+
clock: void 0
|
|
7734
7737
|
};
|
|
7735
7738
|
}
|
|
7736
7739
|
function joinPatternWorkMeter(work) {
|
|
7737
|
-
const meter = work.counter === null ? localMeter(work.cap, work.spent, work.matcherStateBytes, work.flushUnits) : sharedMeter(work, work.counter);
|
|
7740
|
+
const meter = work.counter === null ? localMeter(work.cap, work.spent, work.matcherStateBytes, work.flushUnits, void 0) : sharedMeter(work, work.counter);
|
|
7738
7741
|
let spent = 0;
|
|
7739
7742
|
return {
|
|
7740
7743
|
matcherStateBytes: meter.matcherStateBytes,
|
|
@@ -7745,6 +7748,7 @@ function joinPatternWorkMeter(work) {
|
|
|
7745
7748
|
meter.add(units);
|
|
7746
7749
|
},
|
|
7747
7750
|
remaining: () => meter.remaining(),
|
|
7751
|
+
clock: meter.clock,
|
|
7748
7752
|
spent: () => spent
|
|
7749
7753
|
};
|
|
7750
7754
|
}
|
|
@@ -8282,7 +8286,7 @@ function ordersAfterAnchor(result, anchor, sort) {
|
|
|
8282
8286
|
function applyPagination(results, limit, offset, binding, cursor, sort, pinnedIds) {
|
|
8283
8287
|
const decoded = cursor ? decodePageCursor(cursor) : null;
|
|
8284
8288
|
if (decoded !== null && cursor !== void 0) {
|
|
8285
|
-
requireMatchingCursor(decoded, cursor, sort?.signature ?? null, true, binding);
|
|
8289
|
+
requireMatchingCursor(decoded, cursor, sort?.signature ?? null, true, binding());
|
|
8286
8290
|
}
|
|
8287
8291
|
if (limit <= 0) {
|
|
8288
8292
|
return { paginated: [] };
|
|
@@ -8310,14 +8314,14 @@ function applyPagination(results, limit, offset, binding, cursor, sort, pinnedId
|
|
|
8310
8314
|
sortKey: sort.sortKeyOf(lastResult.id).map(toComparableSortValue),
|
|
8311
8315
|
sortSignature: sort.signature,
|
|
8312
8316
|
depth,
|
|
8313
|
-
binding
|
|
8317
|
+
binding: binding()
|
|
8314
8318
|
}) : encodePageCursor({
|
|
8315
8319
|
anchor: lastResult.id,
|
|
8316
8320
|
score: lastResult.score ?? null,
|
|
8317
8321
|
sortKey: null,
|
|
8318
8322
|
sortSignature: null,
|
|
8319
8323
|
depth,
|
|
8320
|
-
binding
|
|
8324
|
+
binding: binding()
|
|
8321
8325
|
});
|
|
8322
8326
|
}
|
|
8323
8327
|
return { paginated: sliced, nextCursor };
|
|
@@ -8547,6 +8551,7 @@ async function fanOutQuery(manager, params, language, schema, config, searchOpti
|
|
|
8547
8551
|
const partitionFacets = [];
|
|
8548
8552
|
const everyValue = params.facets ? everyValueFacetConfig(params.facets) : void 0;
|
|
8549
8553
|
for (const partition of partitions) {
|
|
8554
|
+
options.patternWork?.clock?.check();
|
|
8550
8555
|
const result = dispatchSinglePartition(partition, params, language, schema, options);
|
|
8551
8556
|
if (everyValue) {
|
|
8552
8557
|
partitionFacets.push(partition.computeFacets(facetMatchSetOf(result), everyValue, schema));
|
|
@@ -8557,6 +8562,7 @@ async function fanOutQuery(manager, params, language, schema, config, searchOpti
|
|
|
8557
8562
|
facets = mergeFacets(partitionFacets, params.facets);
|
|
8558
8563
|
}
|
|
8559
8564
|
}
|
|
8565
|
+
options.patternWork?.clock?.check();
|
|
8560
8566
|
const allScoredArrays = outcomes.map((o) => o.result.scored);
|
|
8561
8567
|
const merged = kWayMerge(allScoredArrays);
|
|
8562
8568
|
let totalMatched = 0;
|
|
@@ -8613,6 +8619,7 @@ function fanOutMatchCount(manager, params, language, schema, options) {
|
|
|
8613
8619
|
patternWork: options?.searchOptions?.patternWork ?? createPatternWorkMeter()
|
|
8614
8620
|
};
|
|
8615
8621
|
for (const partition of partitionsIn(manager, options?.partitionIds)) {
|
|
8622
|
+
searchOptions.patternWork.clock?.check();
|
|
8616
8623
|
const matches = fulltextMatches(partition, params, language, schema, searchOptions);
|
|
8617
8624
|
if (matches !== null) count += matches.count;
|
|
8618
8625
|
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { sendError, RELAY_STREAM_CHUNKS_IN_FLIGHT } from './chunk-IE43SRL3.mjs';
|
|
2
|
+
import { ServerErrorCodes } from './chunk-OBWUWZRA.mjs';
|
|
3
|
+
import { rm } from 'fs/promises';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
// src/server/request-threads/captured-response.ts
|
|
7
|
+
var DEFAULT_STATUS = 200;
|
|
8
|
+
var NO_RESPONSE_STATUS = 500;
|
|
9
|
+
function statusOf(line) {
|
|
10
|
+
const parsed = Number.parseInt(line, 10);
|
|
11
|
+
return Number.isFinite(parsed) ? parsed : DEFAULT_STATUS;
|
|
12
|
+
}
|
|
13
|
+
function bodyBytes(body) {
|
|
14
|
+
if (body === void 0) return new Uint8Array(0);
|
|
15
|
+
if (typeof body === "string") return Buffer.from(body, "utf8");
|
|
16
|
+
return body;
|
|
17
|
+
}
|
|
18
|
+
function createRelayAbort() {
|
|
19
|
+
const listeners = [];
|
|
20
|
+
let aborted = false;
|
|
21
|
+
return {
|
|
22
|
+
get aborted() {
|
|
23
|
+
return aborted;
|
|
24
|
+
},
|
|
25
|
+
onAbort(fn) {
|
|
26
|
+
if (aborted) fn();
|
|
27
|
+
else listeners.push(fn);
|
|
28
|
+
},
|
|
29
|
+
trigger() {
|
|
30
|
+
if (aborted) return;
|
|
31
|
+
aborted = true;
|
|
32
|
+
for (const fn of listeners) fn();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createCapturingResponse(remoteAddress, requestId, sendPart) {
|
|
37
|
+
let status = DEFAULT_STATUS;
|
|
38
|
+
const headers = [];
|
|
39
|
+
let finished = false;
|
|
40
|
+
let streaming = false;
|
|
41
|
+
let inFlight = 0;
|
|
42
|
+
let writable = null;
|
|
43
|
+
const abort = createRelayAbort();
|
|
44
|
+
let resolveDone = () => void 0;
|
|
45
|
+
const done = new Promise((resolve) => {
|
|
46
|
+
resolveDone = resolve;
|
|
47
|
+
});
|
|
48
|
+
function finish(body) {
|
|
49
|
+
if (finished) return;
|
|
50
|
+
finished = true;
|
|
51
|
+
if (streaming) {
|
|
52
|
+
sendPart({ type: "stream-end", requestId, failed: false }, []);
|
|
53
|
+
resolveDone(null);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
resolveDone({ status, headers, body });
|
|
57
|
+
}
|
|
58
|
+
function startStreaming() {
|
|
59
|
+
if (streaming) return;
|
|
60
|
+
streaming = true;
|
|
61
|
+
sendPart({ type: "stream-start", requestId, status, headers }, []);
|
|
62
|
+
}
|
|
63
|
+
const sink = {
|
|
64
|
+
cork(callback) {
|
|
65
|
+
callback();
|
|
66
|
+
return sink;
|
|
67
|
+
},
|
|
68
|
+
writeStatus(line) {
|
|
69
|
+
if (!finished && !streaming) status = statusOf(line);
|
|
70
|
+
return sink;
|
|
71
|
+
},
|
|
72
|
+
writeHeader(key, value) {
|
|
73
|
+
if (!finished && !streaming) headers.push([key, value]);
|
|
74
|
+
return sink;
|
|
75
|
+
},
|
|
76
|
+
end(body) {
|
|
77
|
+
finish(bodyBytes(body));
|
|
78
|
+
return sink;
|
|
79
|
+
},
|
|
80
|
+
write(chunk) {
|
|
81
|
+
if (finished || abort.aborted) return true;
|
|
82
|
+
startStreaming();
|
|
83
|
+
const copy = new Uint8Array(chunk.byteLength);
|
|
84
|
+
copy.set(chunk);
|
|
85
|
+
inFlight += 1;
|
|
86
|
+
sendPart({ type: "stream-chunk", requestId, chunk: copy }, [copy.buffer]);
|
|
87
|
+
return inFlight < RELAY_STREAM_CHUNKS_IN_FLIGHT;
|
|
88
|
+
},
|
|
89
|
+
pause: () => void 0,
|
|
90
|
+
resume: () => void 0,
|
|
91
|
+
close() {
|
|
92
|
+
if (finished) return sink;
|
|
93
|
+
finished = true;
|
|
94
|
+
if (streaming) {
|
|
95
|
+
sendPart({ type: "stream-end", requestId, failed: true }, []);
|
|
96
|
+
resolveDone(null);
|
|
97
|
+
} else {
|
|
98
|
+
status = NO_RESPONSE_STATUS;
|
|
99
|
+
resolveDone({ status, headers, body: new Uint8Array(0) });
|
|
100
|
+
}
|
|
101
|
+
return sink;
|
|
102
|
+
},
|
|
103
|
+
endWithoutBody() {
|
|
104
|
+
finish(new Uint8Array(0));
|
|
105
|
+
return sink;
|
|
106
|
+
},
|
|
107
|
+
tryEnd(body) {
|
|
108
|
+
finish(body);
|
|
109
|
+
return [true, true];
|
|
110
|
+
},
|
|
111
|
+
getWriteOffset: () => 0,
|
|
112
|
+
onWritable(handler) {
|
|
113
|
+
writable = handler;
|
|
114
|
+
return sink;
|
|
115
|
+
},
|
|
116
|
+
onAborted: () => sink,
|
|
117
|
+
onData: () => sink,
|
|
118
|
+
getRemoteAddressAsText: () => new TextEncoder().encode(remoteAddress).buffer
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
sink,
|
|
122
|
+
abort,
|
|
123
|
+
done,
|
|
124
|
+
credit() {
|
|
125
|
+
inFlight = Math.max(0, inFlight - 1);
|
|
126
|
+
if (inFlight >= RELAY_STREAM_CHUNKS_IN_FLIGHT || writable === null) return;
|
|
127
|
+
const handler = writable;
|
|
128
|
+
writable = null;
|
|
129
|
+
handler(0);
|
|
130
|
+
},
|
|
131
|
+
cancel() {
|
|
132
|
+
abort.trigger();
|
|
133
|
+
if (writable !== null) {
|
|
134
|
+
const handler = writable;
|
|
135
|
+
writable = null;
|
|
136
|
+
handler(0);
|
|
137
|
+
}
|
|
138
|
+
if (!finished) {
|
|
139
|
+
finished = true;
|
|
140
|
+
resolveDone(null);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
finishUnanswered() {
|
|
144
|
+
if (finished) return;
|
|
145
|
+
if (streaming) {
|
|
146
|
+
finished = true;
|
|
147
|
+
sendPart({ type: "stream-end", requestId, failed: true }, []);
|
|
148
|
+
resolveDone(null);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
status = NO_RESPONSE_STATUS;
|
|
152
|
+
finish(new Uint8Array(0));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function toRelayedResponse(requestId, captured) {
|
|
157
|
+
return { type: "response", requestId, status: captured.status, headers: captured.headers, body: captured.body };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/server/request-threads/answer-request.ts
|
|
161
|
+
function spooledBodyOf(relayed) {
|
|
162
|
+
if (relayed === null) return null;
|
|
163
|
+
return {
|
|
164
|
+
path: relayed.path,
|
|
165
|
+
bytes: relayed.bytes,
|
|
166
|
+
remove: () => rm(path.dirname(relayed.path), { recursive: true, force: true })
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async function answerRequest(handler, request, port, streams) {
|
|
170
|
+
const captured = createCapturingResponse(
|
|
171
|
+
request.hookContext?.remoteAddress ?? "",
|
|
172
|
+
request.requestId,
|
|
173
|
+
(part, moved) => port.postMessage(part, moved)
|
|
174
|
+
);
|
|
175
|
+
streams.set(request.requestId, captured);
|
|
176
|
+
const ctx = {
|
|
177
|
+
res: captured.sink,
|
|
178
|
+
params: request.params,
|
|
179
|
+
query: new URLSearchParams(request.query),
|
|
180
|
+
contentType: request.contentType,
|
|
181
|
+
rawBody: request.rawBody === null ? null : Buffer.from(request.rawBody.buffer, request.rawBody.byteOffset, request.rawBody.byteLength),
|
|
182
|
+
bodyRefusal: request.bodyRefusal,
|
|
183
|
+
spooledBody: spooledBodyOf(request.spooledBody),
|
|
184
|
+
abort: captured.abort,
|
|
185
|
+
hookContext: request.hookContext
|
|
186
|
+
};
|
|
187
|
+
try {
|
|
188
|
+
await handler(ctx);
|
|
189
|
+
} catch {
|
|
190
|
+
sendError(ctx.res, 500, ServerErrorCodes.INTERNAL_ERROR, "An unexpected error occurred");
|
|
191
|
+
}
|
|
192
|
+
captured.finishUnanswered();
|
|
193
|
+
const answered = await captured.done;
|
|
194
|
+
streams.delete(request.requestId);
|
|
195
|
+
return answered === null ? null : toRelayedResponse(request.requestId, answered);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export { answerRequest };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VECTOR_FILE_MAX_VECTORS, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors, VECTOR_GRAPH_PART_VECTORS, VECTOR_GRAPH_PART_PAYLOAD_VERSION, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, vectorsToBytes } from './chunk-OCB7TMUQ.mjs';
|
|
2
|
-
import { createOrdinalFilter, addToOrdinalFilter, osqBitsOf, STORE_ORDINAL_LAYOUT_GENERATION, removeFromOrdinalFilter, createHNSWIndex, STORE_CALIBRATION_GENERATION, graphWithoutNodes, createOsqScratch, osqQuantize } from './chunk-
|
|
2
|
+
import { createOrdinalFilter, addToOrdinalFilter, osqBitsOf, STORE_ORDINAL_LAYOUT_GENERATION, removeFromOrdinalFilter, createHNSWIndex, STORE_CALIBRATION_GENERATION, graphWithoutNodes, createOsqScratch, osqQuantize } from './chunk-HC5NURS6.mjs';
|
|
3
3
|
import { osqRecordBytes, writeRecord } from './chunk-37CD3OKS.mjs';
|
|
4
4
|
import { MAX_DOC_ID_LENGTH } from './chunk-LXWDQLTW.mjs';
|
|
5
5
|
import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
|
|
@@ -82,6 +82,7 @@ var BUILD_CHUNK_SIZE = 100;
|
|
|
82
82
|
var BUILD_TURN_HANDOVER_AFTER_MS = 50;
|
|
83
83
|
var BUILD_RETRY_FIRST_DELAY_MS = 250;
|
|
84
84
|
var BUILD_RETRY_MAX_DELAY_MS = 3e4;
|
|
85
|
+
var SHUFFLED_REBUILD_MEMORY_RETRY_MS = 1e3;
|
|
85
86
|
var REBUILD_REMOVED_RATIO = 0.2;
|
|
86
87
|
var DRIFT_CHECK_GROWTH_FACTOR = 2;
|
|
87
88
|
var RECALIBRATION_DRIFT_RATIO = 2.5;
|
|
@@ -648,4 +649,4 @@ function recordCheckpoint(state, plan, written) {
|
|
|
648
649
|
state.savedSignature = plan.signature;
|
|
649
650
|
}
|
|
650
651
|
|
|
651
|
-
export { BUILD_CHUNK_SIZE, BUILD_RETRY_FIRST_DELAY_MS, BUILD_RETRY_MAX_DELAY_MS, DEFAULT_FILTER_THRESHOLD, DEFAULT_PROMOTION_THRESHOLD, DISK_ADOPTION_YIELD_INTERVAL, DRIFT_CHECK_GROWTH_FACTOR, ESTIMATED_MS_PER_TOMBSTONE, ESTIMATED_MS_PER_VECTOR_REBUILD, OSQ4_MIN_DIMENSION, RECALIBRATION_CHUNK_VECTORS, RECALIBRATION_DRIFT_RATIO, VECTOR_WORKER_COPIES_ALLOWED, WORKER_COPY_MIN_VECTORS, adoptGraph, adoptLoadedCalibration, allLiveDocIds, assignStorePartitions, deserialize, emptyFieldBeforeRestore, fieldHandlesOf, filterForOptions, graphNeedsRebuild, handOverBuildTurns, liveOrdinals, liveSize, noBuildHistory, ordinalFilterForSubsets, planCheckpoint, recalibrateFromStore, recordCheckpoint, releaseReplacedVectors, signatureOf, threadsHoldCurrentLayout, vectorsPerFile, yieldBuildTurn };
|
|
652
|
+
export { BUILD_CHUNK_SIZE, BUILD_RETRY_FIRST_DELAY_MS, BUILD_RETRY_MAX_DELAY_MS, DEFAULT_FILTER_THRESHOLD, DEFAULT_PROMOTION_THRESHOLD, DISK_ADOPTION_YIELD_INTERVAL, DRIFT_CHECK_GROWTH_FACTOR, ESTIMATED_MS_PER_TOMBSTONE, ESTIMATED_MS_PER_VECTOR_REBUILD, OSQ4_MIN_DIMENSION, RECALIBRATION_CHUNK_VECTORS, RECALIBRATION_DRIFT_RATIO, SHUFFLED_REBUILD_MEMORY_RETRY_MS, VECTOR_WORKER_COPIES_ALLOWED, WORKER_COPY_MIN_VECTORS, adoptGraph, adoptLoadedCalibration, allLiveDocIds, assignStorePartitions, deserialize, emptyFieldBeforeRestore, fieldHandlesOf, filterForOptions, graphNeedsRebuild, handOverBuildTurns, liveOrdinals, liveSize, noBuildHistory, ordinalFilterForSubsets, planCheckpoint, recalibrateFromStore, recordCheckpoint, releaseReplacedVectors, signatureOf, threadsHoldCurrentLayout, vectorsPerFile, yieldBuildTurn };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { rerankQueryTextOf } from './chunk-KZ3NX2P7.mjs';
|
|
2
|
-
import { fixedHybridDepthOf, pageByPosition, requireWithinHybridDepth } from './chunk-
|
|
2
|
+
import { fixedHybridDepthOf, pageByPosition, requireWithinHybridDepth } from './chunk-ZR63OGT2.mjs';
|
|
3
3
|
import { DEFAULT_RERANK_WINDOW, MIN_RERANK_WINDOW } from './chunk-HJSN7UYG.mjs';
|
|
4
4
|
import { DEFAULT_LIMIT, DEFAULT_OFFSET } from './chunk-LXWDQLTW.mjs';
|
|
5
5
|
import { RESULT_WINDOW } from './chunk-E74YLAIG.mjs';
|
|
@@ -90,7 +90,7 @@ function rerankTextOf(values) {
|
|
|
90
90
|
// src/rerank/pipeline.ts
|
|
91
91
|
function rerankCursorDepth(cursor, binding, host) {
|
|
92
92
|
const decoded = host.decodePageCursor(cursor);
|
|
93
|
-
host.requireMatchingCursor(decoded, cursor, null, true, binding);
|
|
93
|
+
host.requireMatchingCursor(decoded, cursor, null, true, binding());
|
|
94
94
|
return decoded.depth ?? 0;
|
|
95
95
|
}
|
|
96
96
|
function requireWithinReach(cursorDepth, offset, limit) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/runtime/background-memory.ts
|
|
2
|
+
var admissions = /* @__PURE__ */ new Set();
|
|
3
|
+
var waiting = /* @__PURE__ */ new Map();
|
|
4
|
+
function addBackgroundAdmission(admission) {
|
|
5
|
+
admissions.add(admission);
|
|
6
|
+
return () => {
|
|
7
|
+
admissions.delete(admission);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function admitsBackgroundBytes(bytes) {
|
|
11
|
+
for (const admission of admissions) {
|
|
12
|
+
if (!admission(bytes)) return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
function noteWaitingForMemory(owner, work) {
|
|
17
|
+
if (work === null) waiting.delete(owner);
|
|
18
|
+
else waiting.set(owner, work);
|
|
19
|
+
}
|
|
20
|
+
function workWaitingForMemory() {
|
|
21
|
+
return [...waiting.values()];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { addBackgroundAdmission, admitsBackgroundBytes, noteWaitingForMemory, workWaitingForMemory };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { requirePatternSearchFor, requirePartialWordSearchFor, createPartitionIndex, buildPartialWordTableFrom, recordValueSize, patternIndexOf, encodeFieldIndexes, encodePartialSpellingsOf, countPartialSpelling, copyVectorsInto, isCompositePartition, fnv1a, partialSpellingsOfDocuments, createFrozenPartialWords, requirePatternSearch, documentValueBytes, cloneProjected, projectIncludedPaths, valueWithOwnBuffers, createSurfaceRegistry, MAX_TERM_FREQUENCY, joinPatternWorkMeter, fanOutQuery, sanitizeGlobalStats, countsWithoutScores, fanOutMatchCount, createCompositePartition, createGeoIndex, documentWithOwnBuffers, readProjectedPath, createNumericIndex, createBooleanIndex, createEnumIndex, ValueAffixes } from './chunk-
|
|
1
|
+
import { requirePatternSearchFor, requirePartialWordSearchFor, createPartitionIndex, buildPartialWordTableFrom, recordValueSize, patternIndexOf, encodeFieldIndexes, encodePartialSpellingsOf, countPartialSpelling, copyVectorsInto, isCompositePartition, fnv1a, partialSpellingsOfDocuments, createFrozenPartialWords, requirePatternSearch, documentValueBytes, cloneProjected, projectIncludedPaths, valueWithOwnBuffers, createSurfaceRegistry, MAX_TERM_FREQUENCY, joinPatternWorkMeter, fanOutQuery, sanitizeGlobalStats, countsWithoutScores, fanOutMatchCount, createCompositePartition, createGeoIndex, documentWithOwnBuffers, readProjectedPath, createNumericIndex, createBooleanIndex, createEnumIndex, ValueAffixes } from './chunk-N53HN5VA.mjs';
|
|
2
2
|
import { generateId, getLanguage } from './chunk-FUUP45IS.mjs';
|
|
3
|
-
import { readHeapStatistics, readResidentMemory } from './chunk-
|
|
4
|
-
import { GrowableUint32, bitsetHas, bitsetSet, createBitSet } from './chunk-
|
|
3
|
+
import { readHeapStatistics, readResidentMemory } from './chunk-ZATRDAYU.mjs';
|
|
4
|
+
import { GrowableUint32, bitsetHas, bitsetSet, createBitSet } from './chunk-VFAXPDBH.mjs';
|
|
5
5
|
import { tokenizeOptions, getNestedValue, sameFields, visitDocumentSurfaceSpellings, visitDocumentSpellings } from './chunk-KCQG2PJT.mjs';
|
|
6
6
|
import { schemaFieldsOf, partialFieldsOf, encodeDocument, validateDocument, validateDocumentStrict, extractVectorFieldsFromSchema } from './chunk-DG62H7OD.mjs';
|
|
7
7
|
import { fuzzyPrefixOf, boundedLevenshtein } from './chunk-GES7U2PM.mjs';
|
|
@@ -9,7 +9,7 @@ import { isWordIndexedBase } from './chunk-6ODIY6ZB.mjs';
|
|
|
9
9
|
import { resolveIndexAnalysis, synonymSearchModule } from './chunk-IR4KQ4WB.mjs';
|
|
10
10
|
import { visitTokens, codePointOrder, encodeStringBlob, encodeLookupKey, SEGMENT_TOKEN_TABLE_START, SEGMENT_POSTING_LOG_START, SEGMENT_POSITION_POOL_START, SEGMENT_FIELD_SCRATCH_START, FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION } from './chunk-OFYKBKKV.mjs';
|
|
11
11
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
12
|
-
import { loadedVectorCode, loadVectorCode, loadVectorCodeFor, requireLoadedVectorCode } from './chunk-
|
|
12
|
+
import { loadedVectorCode, loadVectorCode, loadVectorCodeFor, requireLoadedVectorCode } from './chunk-BCNUJVTT.mjs';
|
|
13
13
|
import { PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
|
|
14
14
|
import { NarsilError, ErrorCodes } from './chunk-OBWUWZRA.mjs';
|
|
15
15
|
import { Decoder, decode } from '@msgpack/msgpack';
|
|
@@ -3353,6 +3353,7 @@ function createDirectExecutor(options) {
|
|
|
3353
3353
|
);
|
|
3354
3354
|
}
|
|
3355
3355
|
case "serveRequests":
|
|
3356
|
+
case "serveLongQueries":
|
|
3356
3357
|
case "stopServing": {
|
|
3357
3358
|
throw new NarsilError(
|
|
3358
3359
|
ErrorCodes.CONFIG_INVALID,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDLE_HEAP_CLEANUP_CHECK_MS, IDLE_HEAP_CLEANUP_MAX_UTILISATION, IDLE_HEAP_CLEANUP_MAX_GROWTH_BYTES, IDLE_HEAP_CLEANUP_QUIET_CHECKS, IDLE_HEAP_CLEANUP_MIN_RECLAIMABLE_BYTES } from './chunk-
|
|
1
|
+
import { IDLE_HEAP_CLEANUP_CHECK_MS, IDLE_HEAP_CLEANUP_MAX_UTILISATION, IDLE_HEAP_CLEANUP_MAX_GROWTH_BYTES, IDLE_HEAP_CLEANUP_QUIET_CHECKS, IDLE_HEAP_CLEANUP_MIN_RECLAIMABLE_BYTES } from './chunk-22YPZVMG.mjs';
|
|
2
2
|
import { performance } from 'perf_hooks';
|
|
3
3
|
import { setFlagsFromString, getHeapStatistics } from 'v8';
|
|
4
4
|
import { runInNewContext } from 'vm';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readMetadataEnvelope } from './chunk-
|
|
2
|
-
import { readWalSegments, durableRecordMissing, checkpointLastSeqNo, SEGMENT_HEADER_SIZE } from './chunk-
|
|
3
|
-
import { applyDeleteEntry, applyIndexEntry } from './chunk-
|
|
1
|
+
import { readMetadataEnvelope } from './chunk-YCSRB3IN.mjs';
|
|
2
|
+
import { readWalSegments, durableRecordMissing, checkpointLastSeqNo, SEGMENT_HEADER_SIZE } from './chunk-KGVC6KJ3.mjs';
|
|
3
|
+
import { applyDeleteEntry, applyIndexEntry } from './chunk-7EWQZQDT.mjs';
|
|
4
4
|
|
|
5
5
|
// src/persistence/durability/recovery.ts
|
|
6
6
|
async function listPersistedIndexes(directory) {
|
|
@@ -1865,6 +1865,7 @@ function answeredByTypoTest(request, tally) {
|
|
|
1865
1865
|
}
|
|
1866
1866
|
function matchPattern(request) {
|
|
1867
1867
|
const { operator, caseFold, index, matches, host } = request;
|
|
1868
|
+
request.meter.clock?.check();
|
|
1868
1869
|
const tally = new WorkTally(request.meter);
|
|
1869
1870
|
if (answeredByTypoTest(request, tally)) {
|
|
1870
1871
|
tally.flush();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sanitizeSurfaceForms, patternIndexesFromWire, dropStoredVectorValues } from './chunk-
|
|
1
|
+
import { sanitizeSurfaceForms, patternIndexesFromWire, dropStoredVectorValues } from './chunk-YCSRB3IN.mjs';
|
|
2
2
|
import { requireValidFieldTypes } from './chunk-DG62H7OD.mjs';
|
|
3
3
|
import { VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
|
|
4
4
|
import { decode } from '@msgpack/msgpack';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { countEngineThread } from './chunk-EBIHRL7B.mjs';
|
|
2
|
+
|
|
1
3
|
// src/workers/node-worker.ts
|
|
2
4
|
async function spawnNodeWorker(entryPoint, resourceLimits) {
|
|
3
5
|
try {
|
|
4
6
|
const workerThreads = await import('worker_threads');
|
|
5
|
-
|
|
7
|
+
const worker = new workerThreads.Worker(entryPoint, { resourceLimits });
|
|
8
|
+
countEngineThread(worker, resourceLimits?.maxYoungGenerationSizeMb);
|
|
9
|
+
return worker;
|
|
6
10
|
} catch {
|
|
7
11
|
return null;
|
|
8
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nodeThreadId } from './chunk-
|
|
1
|
+
import { nodeThreadId } from './chunk-W55X2BYN.mjs';
|
|
2
2
|
import { getFs, getPath } from './chunk-HLPRHOSO.mjs';
|
|
3
|
-
import { DIRECTORY_LOCK_ATTEMPTS, DIRECTORY_LOCK_SETTLE_MS, DIRECTORY_LOCK_PROCESS_START_TOLERANCE_MS } from './chunk-
|
|
3
|
+
import { DIRECTORY_LOCK_ATTEMPTS, DIRECTORY_LOCK_SETTLE_MS, DIRECTORY_LOCK_PROCESS_START_TOLERANCE_MS } from './chunk-KGVC6KJ3.mjs';
|
|
4
4
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
5
5
|
import { NarsilError, ErrorCodes } from './chunk-OBWUWZRA.mjs';
|
|
6
6
|
import { openSync, close, readFileSync } from 'fs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead, VECTOR_FILE_MAX_VECTORS, deadBytesFor } from './chunk-OCB7TMUQ.mjs';
|
|
2
|
-
import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, readSegmentFile, manifestKey, segmentsPrefix, readListedFile, requireListedChecksum, vectorFileKey, graphPartKey } from './chunk-
|
|
3
|
-
import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, readHeader, HEADER_SIZE, crc32, engineVersionParts, writeHeader, packChecksummedEnvelope } from './chunk-
|
|
4
|
-
import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-
|
|
2
|
+
import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, readSegmentFile, manifestKey, segmentsPrefix, readListedFile, requireListedChecksum, vectorFileKey, graphPartKey } from './chunk-KGVC6KJ3.mjs';
|
|
3
|
+
import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, readHeader, HEADER_SIZE, crc32, engineVersionParts, writeHeader, packChecksummedEnvelope } from './chunk-BCSWODXP.mjs';
|
|
4
|
+
import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-Q62NDKEC.mjs';
|
|
5
5
|
import { flattenSchema, requireValidFieldTypes, isQuantizationMode, isStorageMode } from './chunk-DG62H7OD.mjs';
|
|
6
6
|
import { MAX_FILE_BYTES, VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
|
|
7
7
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { youngGenerationBytesOfThisV8 } from './chunk-EBIHRL7B.mjs';
|
|
2
|
+
import { PROCESS_LIMIT_REFRESH_INTERVAL_MS } from './chunk-22YPZVMG.mjs';
|
|
2
3
|
import { totalmem, freemem } from 'os';
|
|
3
4
|
import { getHeapSpaceStatistics, getHeapStatistics } from 'v8';
|
|
4
5
|
|
|
@@ -16,6 +17,15 @@ function memoryTheHostAllows() {
|
|
|
16
17
|
const constrained = process.constrainedMemory?.() ?? 0;
|
|
17
18
|
return constrained > 0 ? constrained : totalmem();
|
|
18
19
|
}
|
|
20
|
+
function readConfiguredOldSpaceMegabytes() {
|
|
21
|
+
let megabytes = null;
|
|
22
|
+
for (const entry of flagEntries()) {
|
|
23
|
+
const inMegabytes = IN_MEGABYTES.exec(entry);
|
|
24
|
+
if (inMegabytes !== null) megabytes = Number(inMegabytes[1]);
|
|
25
|
+
if (AS_PERCENTAGE.test(entry)) megabytes = null;
|
|
26
|
+
}
|
|
27
|
+
return megabytes !== null && Number.isFinite(megabytes) && megabytes > 0 ? megabytes : null;
|
|
28
|
+
}
|
|
19
29
|
function readConfiguredLimit() {
|
|
20
30
|
let megabytes = null;
|
|
21
31
|
let percentage = null;
|
|
@@ -59,6 +69,21 @@ function heapSizeLimitBytes() {
|
|
|
59
69
|
if (heapSizeLimit === void 0) heapSizeLimit = getHeapStatistics().heap_size_limit;
|
|
60
70
|
return heapSizeLimit;
|
|
61
71
|
}
|
|
72
|
+
function readYoungGenerationCeiling() {
|
|
73
|
+
const fromSemiSpace = configuredYoungGenerationBytes();
|
|
74
|
+
if (fromSemiSpace !== null) return fromSemiSpace;
|
|
75
|
+
const oldSpaceMegabytes = readConfiguredOldSpaceMegabytes();
|
|
76
|
+
if (oldSpaceMegabytes !== null) {
|
|
77
|
+
const beyondOldSpace = heapSizeLimitBytes() - oldSpaceMegabytes * MEGABYTE_BYTES;
|
|
78
|
+
if (beyondOldSpace > 0) return beyondOldSpace;
|
|
79
|
+
}
|
|
80
|
+
return youngGenerationBytesOfThisV8();
|
|
81
|
+
}
|
|
82
|
+
var youngGenerationCeiling;
|
|
83
|
+
function youngGenerationCeilingBytes() {
|
|
84
|
+
if (youngGenerationCeiling === void 0) youngGenerationCeiling = readYoungGenerationCeiling();
|
|
85
|
+
return youngGenerationCeiling;
|
|
86
|
+
}
|
|
62
87
|
function readOldGenerationStatistics() {
|
|
63
88
|
try {
|
|
64
89
|
let usedBytes = 0;
|
|
@@ -74,13 +99,16 @@ function readOldGenerationStatistics() {
|
|
|
74
99
|
committedBytes += space.space_size;
|
|
75
100
|
}
|
|
76
101
|
}
|
|
77
|
-
const
|
|
102
|
+
const youngCeilingBytes = youngGenerationCeilingBytes();
|
|
103
|
+
const limitBytes2 = configuredLimitBytes() ?? heapSizeLimitBytes() - youngCeilingBytes;
|
|
78
104
|
if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
|
|
79
105
|
return {
|
|
80
106
|
usedBytes,
|
|
81
107
|
limitBytes: limitBytes2,
|
|
82
108
|
youngUsedBytes: Number.isFinite(youngUsedBytes) ? youngUsedBytes : 0,
|
|
83
|
-
committedBytes: Number.isFinite(committedBytes) ? committedBytes : usedBytes
|
|
109
|
+
committedBytes: Number.isFinite(committedBytes) ? committedBytes : usedBytes,
|
|
110
|
+
youngReserveBytes: Number.isFinite(youngCapacityBytes) ? Math.max(0, youngCeilingBytes - youngCapacityBytes) : 0,
|
|
111
|
+
youngCeilingBytes
|
|
84
112
|
};
|
|
85
113
|
} catch {
|
|
86
114
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-4W_7tk1f.js';
|
|
2
|
-
import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, Q as QueryParams, e as QueryResult, P as PreflightResult, h as SuggestParams, j as SuggestResult } from './events-
|
|
2
|
+
import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, Q as QueryParams, e as QueryResult, P as PreflightResult, h as SuggestParams, j as SuggestResult } from './events-D8GPB1-H.js';
|
|
3
3
|
import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
|
|
4
|
-
import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-
|
|
4
|
+
import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-5_LCFEzF.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This is the `fetch` implementation the client sends every request through.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-
|
|
2
|
-
export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-
|
|
3
|
-
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-
|
|
4
|
-
export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-
|
|
1
|
+
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-D8GPB1-H.js';
|
|
2
|
+
export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-DOgB3pPf.js';
|
|
3
|
+
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-5_LCFEzF.js';
|
|
4
|
+
export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-BGzLNt78.js';
|
|
5
5
|
import './schema-4W_7tk1f.js';
|
|
6
6
|
import './adapters-BQFQ4PRz.js';
|
|
7
7
|
import './synonyms-CpOAHPa-.js';
|
|
8
|
-
import './config-
|
|
9
|
-
import './config-
|
|
8
|
+
import './config-CS5ADSrx.js';
|
|
9
|
+
import './config-CSYMTTm1.js';
|
|
10
10
|
import './index-Cl5qQauj.js';
|
|
11
11
|
import './types-DvncmvuQ.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NarsilConfig } from './config-
|
|
1
|
+
import { N as NarsilConfig } from './config-CSYMTTm1.js';
|
|
2
2
|
import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './index-Cl5qQauj.js';
|
|
3
3
|
import { N as NodeTransport } from './types-DvncmvuQ.js';
|
|
4
4
|
|
|
@@ -123,6 +123,17 @@ interface CoordinatorRequestFigure {
|
|
|
123
123
|
/** The total time that the calls took, in seconds. */
|
|
124
124
|
sumSeconds: number;
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* A vector field whose rebuild waits for memory on this node.
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
interface VectorRebuildWaitFigure {
|
|
132
|
+
/** The index that holds the vector field. */
|
|
133
|
+
indexName: string;
|
|
134
|
+
/** The vector field whose graph waits to be rebuilt. */
|
|
135
|
+
fieldName: string;
|
|
136
|
+
}
|
|
126
137
|
/**
|
|
127
138
|
* The replication and coordinator figures that one node reports.
|
|
128
139
|
*
|
|
@@ -137,6 +148,11 @@ interface ClusterMetrics {
|
|
|
137
148
|
partitions: PartitionReplicationFigure[];
|
|
138
149
|
/** The timing of this node's coordinator calls, one entry per kind of call that the node has made. */
|
|
139
150
|
coordinatorRequests: CoordinatorRequestFigure[];
|
|
151
|
+
/**
|
|
152
|
+
* Each vector field on this node whose rebuild, the one that keeps recall up, waits because the node lacks the
|
|
153
|
+
* memory to hold a second graph beside the one it serves. The rebuild starts once the node has room.
|
|
154
|
+
*/
|
|
155
|
+
vectorRebuildsWaitingForMemory: VectorRebuildWaitFigure[];
|
|
140
156
|
}
|
|
141
157
|
|
|
142
158
|
/**
|
|
@@ -421,4 +437,4 @@ interface ClusterNodeInfo {
|
|
|
421
437
|
status: string;
|
|
422
438
|
}
|
|
423
439
|
|
|
424
|
-
export type { ClusterNamespace as C, IndexHealth as I, NodeReadiness as N, PartitionReplicationFigure as P, ReplicaLagFigure as R, CreateIndexOptions as a, ClusterNodeConfig as b, ClusterControllerConfig as c, ClusterHealth as d, ClusterHealthStatus as e, ClusterMemoryConfig as f, ClusterMetrics as g, ClusterNodeInfo as h, ClusterQueryConfig as i, CommitPointFigure as j, CoordinatorRequestFigure as k, ReplicationConfig as l };
|
|
440
|
+
export type { ClusterNamespace as C, IndexHealth as I, NodeReadiness as N, PartitionReplicationFigure as P, ReplicaLagFigure as R, VectorRebuildWaitFigure as V, CreateIndexOptions as a, ClusterNodeConfig as b, ClusterControllerConfig as c, ClusterHealth as d, ClusterHealthStatus as e, ClusterMemoryConfig as f, ClusterMetrics as g, ClusterNodeInfo as h, ClusterQueryConfig as i, CommitPointFigure as j, CoordinatorRequestFigure as k, ReplicationConfig as l };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter, R as RerankAdapter } from './adapters-BQFQ4PRz.js';
|
|
2
|
-
import { Q as QueryParams, e as QueryResult, f as NarsilEventHandlers } from './events-
|
|
2
|
+
import { Q as QueryParams, e as QueryResult, f as NarsilEventHandlers } from './events-D8GPB1-H.js';
|
|
3
3
|
import { I as IndexConfig, A as AnyDocument } from './schema-4W_7tk1f.js';
|
|
4
4
|
|
|
5
5
|
/**
|