@delali/narsil 0.3.1-next.185 → 0.3.1-next.193
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 +1 -0
- package/dist/adapters/filesystem.mjs +2 -2
- package/dist/adapters/gcs.mjs +2 -2
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +2 -2
- package/dist/browser/chunk-4E5APHTM.mjs +1459 -0
- package/dist/browser/{chunk-4ZICWS4V.mjs → chunk-QAOVAYAG.mjs} +1 -1
- package/dist/browser/{chunk-CPSHS46N.mjs → chunk-UQG4HUGQ.mjs} +82 -50
- package/dist/browser/{chunk-2Q45HI5H.mjs → chunk-YINZFPLT.mjs} +7 -0
- package/dist/browser/{module-XVLHJ7T7.mjs → module-ZZTNG5JZ.mjs} +26 -3
- package/dist/browser/{optional-writes-ZTBHYQMN.mjs → optional-writes-J5BHKEQL.mjs} +21 -8
- package/dist/browser/{storage-leaf-4XMCITJ6.mjs → storage-leaf-N3JMQ6CF.mjs} +14569 -13747
- package/dist/{capabilities-DAHXphRn.d.ts → capabilities-CLnQHIqV.d.ts} +51 -9
- package/dist/{chunk-KLVMK3R5.mjs → chunk-2CKDCC65.mjs} +1 -1
- package/dist/{chunk-CODGHJVW.mjs → chunk-2HVQYOOD.mjs} +40 -12
- package/dist/{chunk-M5I64AQW.mjs → chunk-3N5GUXBI.mjs} +33 -33
- package/dist/{chunk-DU23J5JG.mjs → chunk-5CIHQIA4.mjs} +6 -6
- package/dist/{react-native/chunks/chunk-ZUFOYZ5P.mjs → chunk-62X472AC.mjs} +1 -1
- package/dist/{chunk-QJGDB3WR.mjs → chunk-6GHX35ZM.mjs} +2 -2
- package/dist/{chunk-G3XRHAJA.mjs → chunk-6MC6BCXK.mjs} +3 -3
- package/dist/{chunk-X5NHWOXT.mjs → chunk-7P5YWDRQ.mjs} +2 -2
- package/dist/{chunk-MHBG33R5.mjs → chunk-7X4IIREW.mjs} +76 -46
- package/dist/{chunk-F4OOBPKA.mjs → chunk-AOYQTX6W.mjs} +1 -1
- package/dist/{chunk-D6FYUTFN.mjs → chunk-ASZLNVWW.mjs} +1 -1
- package/dist/{chunk-LR6JJVML.mjs → chunk-D2EJUM4A.mjs} +764 -699
- package/dist/{chunk-FETZYCH7.mjs → chunk-F6F4G322.mjs} +26 -1
- package/dist/{chunk-2YWWHMVC.mjs → chunk-FGOGT273.mjs} +2 -2
- package/dist/{chunk-5BUEBIXR.mjs → chunk-GLXLSPLO.mjs} +18 -5
- package/dist/{chunk-IE3Q62QD.mjs → chunk-GR5GMFJJ.mjs} +1 -1
- package/dist/{chunk-Y7QUFIGV.mjs → chunk-GXED6R3Q.mjs} +2 -2
- package/dist/{chunk-BVZWWMOU.mjs → chunk-HHYQMGPW.mjs} +2 -2
- package/dist/{chunk-SL53DHVE.mjs → chunk-HSA3H3VW.mjs} +121 -68
- package/dist/{chunk-YM2HI5N5.mjs → chunk-IL5DRCNU.mjs} +2 -2
- package/dist/{chunk-JDG6CCXM.mjs → chunk-JENWA4WX.mjs} +2 -2
- package/dist/{chunk-2GONI5HL.mjs → chunk-JXINPXRS.mjs} +5 -4
- package/dist/chunk-K5GNK5GE.mjs +602 -0
- package/dist/{chunk-WLFOLAQI.mjs → chunk-KBU3ZFJN.mjs} +2 -2
- package/dist/{chunk-EDEE7ETQ.mjs → chunk-KOA6T2IC.mjs} +3 -3
- package/dist/{chunk-N3M4NPML.mjs → chunk-M2Z5WVWW.mjs} +1 -1
- package/dist/{chunk-EWGIF6FQ.mjs → chunk-NJJN4FMM.mjs} +1 -1
- package/dist/{chunk-C7YQHCSO.mjs → chunk-P4F4UWLC.mjs} +1 -1
- package/dist/{chunk-VYSWVQCE.mjs → chunk-PAPQGC6I.mjs} +2 -2
- package/dist/{chunk-I2WJCRIH.mjs → chunk-R2PJKSNL.mjs} +1 -1
- package/dist/{chunk-6SZQETSC.mjs → chunk-RORNUNXW.mjs} +5 -2
- package/dist/{chunk-FBQYC5OX.mjs → chunk-SB5HCIIO.mjs} +16 -13
- package/dist/{chunk-CYCVPTTR.mjs → chunk-SCZI7COG.mjs} +2 -2
- package/dist/{chunk-O337MDRJ.mjs → chunk-SHES4VP5.mjs} +38 -13
- package/dist/{chunk-H4QYQ5DE.mjs → chunk-SIIDIGKI.mjs} +2 -2
- package/dist/{chunk-A3OAFUZI.mjs → chunk-SM2SYVIX.mjs} +2 -2
- package/dist/{chunk-II6XF6M4.mjs → chunk-SMLUZGSI.mjs} +9 -8
- package/dist/{chunk-2KCCQK4R.mjs → chunk-TSE2VWPX.mjs} +2 -2
- package/dist/{chunk-WSIU6YXQ.mjs → chunk-YPEJ6ODL.mjs} +1732 -743
- package/dist/{chunk-7WXGUTWK.mjs → chunk-Z6SIJH5O.mjs} +17 -6
- package/dist/{chunk-Q3ZZH5Z7.mjs → chunk-ZKOQR7EA.mjs} +7 -0
- package/dist/{chunk-CKEOTSF5.mjs → chunk-ZS2YUB2L.mjs} +6 -3
- package/dist/{chunk-FCQMZDRI.mjs → chunk-ZVZYJIIP.mjs} +3 -3
- package/dist/{client-DpqtT2XG.d.ts → client-uB0kp2yT.d.ts} +88 -5
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +3 -1265
- package/dist/{config-D9WR3MhO.d.ts → config-BvHQ-C7U.d.ts} +3 -3
- package/dist/{config-C687-reW.d.ts → config-PqgNY1H7.d.ts} +1 -1
- package/dist/{core-leaf-NEUM7PU3.mjs → core-leaf-TAR3GJVE.mjs} +3 -3
- package/dist/{direct-executor-37IH3ISS.mjs → direct-executor-WSZALYCV.mjs} +8 -8
- package/dist/distribution/coordinator/etcd.d.ts +1 -1
- package/dist/distribution/coordinator/etcd.mjs +35 -15
- package/dist/distribution/coordinator/in-memory.d.ts +1 -1
- package/dist/distribution/coordinator/in-memory.mjs +16 -6
- package/dist/distribution/transport/grpc.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +2 -2
- package/dist/distribution.d.ts +70 -9
- package/dist/distribution.mjs +1695 -680
- package/dist/{durability-config-NWU2G2SJ.mjs → durability-config-VWS2K24E.mjs} +1 -1
- package/dist/{react-native/chunks/embed-4LBSQD7U.mjs → embed-4PHHKGBK.mjs} +1 -1
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-De6JzTW8.d.ts → engine-qjAxJSKk.d.ts} +206 -7
- package/dist/{index-CBUl4z3E.d.ts → index-BaQIAnk0.d.ts} +137 -111
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +8 -8
- package/dist/index.react-native.mjs +9 -9
- package/dist/{long-query-thread-DIPJBMV7.mjs → long-query-thread-N2DNPEA3.mjs} +21 -21
- package/dist/{module-Z3CL4GJ4.mjs → module-UQFIJQMG.mjs} +33 -13
- package/dist/{msgpack-leaf-7KBYOVTF.mjs → msgpack-leaf-H5ZYW7S7.mjs} +4 -4
- package/dist/{optional-reads-ENKMVQ4Q.mjs → optional-reads-5HFMF2QZ.mjs} +2 -2
- package/dist/{optional-writes-YIVJMQ4D.mjs → optional-writes-CGDBJBHQ.mjs} +31 -18
- package/dist/{paged-partition-archive-IZ6U7DVN.mjs → paged-partition-archive-UK44CVXG.mjs} +20 -20
- package/dist/partial-words.browser.mjs +3 -3
- package/dist/partial-words.mjs +8 -8
- package/dist/pattern.browser.mjs +2 -2
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +7 -0
- package/dist/persistence/durability/checkpoint-worker.mjs +18 -18
- package/dist/{phrase-module-ZY3TLTQA.mjs → phrase-module-EFESWOCR.mjs} +2 -2
- package/dist/{query-actions-7EOKT3WD.mjs → query-actions-7BL3YZDW.mjs} +8 -8
- package/dist/query-suggestions/merge-worker.mjs +11 -11
- package/dist/query-suggestions.browser.mjs +3 -3
- package/dist/query-suggestions.d.ts +1 -1
- package/dist/query-suggestions.mjs +9 -9
- package/dist/react-native/chunks/{chunk-TQ26BKBH.mjs → chunk-43R4GCM7.mjs} +7 -0
- package/dist/react-native/chunks/{chunk-CBU4M3EU.mjs → chunk-63DZ26X5.mjs} +277 -75
- package/dist/react-native/chunks/{chunk-BN6FUB7N.mjs → chunk-AN4HKLB4.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-T5HF3FW3.mjs → chunk-BNFGA7TY.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-PVMEHBQO.mjs → chunk-CW2ZFXSE.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-NLEFMPY3.mjs → chunk-G434H5WG.mjs} +15 -4
- package/dist/react-native/chunks/{chunk-SK3DPAI4.mjs → chunk-HTBY4GON.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-ZQPSXN6C.mjs → chunk-IP3QLETQ.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-7TPO4FLE.mjs → chunk-LOKGE4OQ.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-ZDDJVR7X.mjs → chunk-MRH36RN3.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-YOTP2FPE.mjs → chunk-UO44MA5M.mjs} +1 -1
- package/dist/{chunk-4JBTALUC.mjs → react-native/chunks/chunk-UYAZLGEM.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-WFQ6YQZA.mjs → chunk-UYKIV2KT.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-IEY4DARA.mjs → chunk-XHYOQ4K4.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-OZ3XEM6D.mjs → chunk-ZUJCUPVS.mjs} +1 -1
- package/dist/react-native/chunks/{core-leaf-TPBRRWVN.mjs → core-leaf-5PVST5PR.mjs} +4 -4
- package/dist/react-native/chunks/{durability-config-RVTWSXPH.mjs → durability-config-FCSD4MXY.mjs} +1 -1
- package/dist/{embed-2QMYCD2Q.mjs → react-native/chunks/embed-HA2I7RCF.mjs} +1 -1
- package/dist/react-native/chunks/{gzip.react-native-DLO4WW27.mjs → gzip.react-native-CVM4NQG2.mjs} +2 -2
- package/dist/react-native/chunks/{module-COLNJNML.mjs → module-QRCYB7QV.mjs} +32 -9
- package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +7 -0
- package/dist/react-native/chunks/{optional-reads-74HYI4DO.mjs → optional-reads-AFPO2FEB.mjs} +3 -3
- package/dist/react-native/chunks/{optional-writes-QETIM6BI.mjs → optional-writes-GC6JWMAF.mjs} +31 -18
- package/dist/react-native/chunks/{phrase-module-UC4YGEBB.mjs → phrase-module-IGYBK7XH.mjs} +3 -3
- package/dist/react-native/chunks/{resolve-vector-text-FU7D4QP5.mjs → resolve-vector-text-GE2CRJKI.mjs} +1 -1
- package/dist/react-native/chunks/{restore-queue-3E2MJIJS.mjs → restore-queue-2ACONS4W.mjs} +12 -12
- package/dist/react-native/chunks/{segment-codec-leaf-IE4DXUZV.mjs → segment-codec-leaf-SSIWXVUG.mjs} +10 -10
- package/dist/react-native/chunks/{segment-merge-leaf-62LQ5WZB.mjs → segment-merge-leaf-I2WDFE6O.mjs} +11 -11
- package/dist/react-native/chunks/{storage-leaf-LNOLKWZB.mjs → storage-leaf-YXXMG4VR.mjs} +14727 -13915
- package/dist/react-native/chunks/{store-leaf-Y7CBOPFZ.mjs → store-leaf-FS7A4PZA.mjs} +11 -11
- package/dist/react-native/chunks/{suggestions-leaf-PSUGL6MI.mjs → suggestions-leaf-PSFCT5EX.mjs} +11 -11
- package/dist/react-native/chunks/{worker-copies-MW5O5U3D.mjs → worker-copies-QRMISMEL.mjs} +10 -10
- package/dist/react-native/partial-words.mjs +9 -9
- package/dist/react-native/pattern.mjs +5 -5
- package/dist/react-native/query-suggestions.mjs +9 -9
- package/dist/react-native/sync.mjs +433 -51
- package/dist/react-native/synonyms.mjs +9 -9
- package/dist/react.d.ts +8 -8
- package/dist/react.mjs +7 -0
- package/dist/{rerank-KTV5L7MZ.mjs → rerank-4GFC26FD.mjs} +8 -8
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{resolve-vector-text-SD6BEMKZ.mjs → resolve-vector-text-OD4J3WHF.mjs} +2 -2
- package/dist/{restore-queue-ES7TDJ5V.mjs → restore-queue-E4EIUYVV.mjs} +11 -11
- package/dist/{segment-codec-leaf-DO75VKEV.mjs → segment-codec-leaf-MP6DILVE.mjs} +9 -9
- package/dist/{segment-merge-leaf-JGND6LG5.mjs → segment-merge-leaf-ED2NMUC5.mjs} +9 -9
- package/dist/server.d.ts +13 -9
- package/dist/server.mjs +875 -348
- package/dist/{storage-leaf-ZI3H2WJY.mjs → storage-leaf-HQFO37W7.mjs} +5234 -5835
- package/dist/{store-leaf-YIH36Y5J.mjs → store-leaf-PL2G7RM5.mjs} +10 -10
- package/dist/{suggestions-leaf-FP5HSTFP.mjs → suggestions-leaf-I3MEHACP.mjs} +12 -12
- package/dist/sync/filesystem.d.ts +2 -2
- package/dist/sync/filesystem.mjs +16 -16
- package/dist/sync/indexeddb.browser.mjs +1 -1
- package/dist/sync/indexeddb.d.ts +2 -2
- package/dist/sync/indexeddb.mjs +3 -3
- package/dist/sync.browser.mjs +35 -1108
- package/dist/sync.d.ts +3 -3
- package/dist/sync.mjs +430 -51
- package/dist/synonyms.browser.mjs +3 -3
- package/dist/synonyms.mjs +8 -8
- package/dist/{tasks-X2IJQc8J.d.ts → tasks-C65V7lIr.d.ts} +3 -3
- package/dist/thread-LTFI3RK5.mjs +31 -0
- package/dist/{types-D0YasjoX.d.ts → types-CpCg-Gq-.d.ts} +1 -1
- package/dist/vector/search-worker.mjs +5 -5
- package/dist/{worker-copies-WYPRCNB7.mjs → worker-copies-P7YWXEP5.mjs} +11 -11
- package/dist/workers/entry.mjs +14 -14
- package/openapi.json +144 -0
- package/package.json +5 -7
- package/dist/chunk-URVH6BLO.mjs +0 -217
- package/dist/react-native/chunks/msgpack-leaf-GTKLF6GJ.mjs +0 -7
- package/dist/thread-NQRNW3IH.mjs +0 -31
- /package/dist/{chunk-CV3Q2EKO.mjs → chunk-S5QMWECL.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V8_YOUNG_GENERATION_BYTES_BY_MAJOR, SCRATCH_SLOTS_PER_THREAD_POOL } from './chunk-UPDNNOTG.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
3
3
|
|
|
4
4
|
// src/core/search-stop.ts
|
|
5
5
|
var signals = /* @__PURE__ */ new WeakMap();
|
|
@@ -73,6 +73,9 @@ function answerFromOneState(manager, answer, signal) {
|
|
|
73
73
|
function createDocIdMap() {
|
|
74
74
|
return /* @__PURE__ */ new Map();
|
|
75
75
|
}
|
|
76
|
+
function shardEntryRangeOf(entries) {
|
|
77
|
+
return { shards: 1, smallest: entries, largest: entries };
|
|
78
|
+
}
|
|
76
79
|
|
|
77
80
|
// src/runtime/engine-threads.ts
|
|
78
81
|
var MEGABYTE_BYTES = 1048576;
|
|
@@ -204,4 +207,4 @@ function splitWorkerBudget(total) {
|
|
|
204
207
|
return { keyword, vector: total - keyword };
|
|
205
208
|
}
|
|
206
209
|
|
|
207
|
-
export { CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, SHUTDOWN_TIMEOUT_MS, WORKER_YOUNG_GENERATION_MB, answerFromOneState, bindSearchSignal, bindSignalStop, countEngineThread, createDocIdMap, detectRuntime, engineThreadYoungGenerationBytes, missingWorkerEntry, nodeThreadId, requirePinnedState, requireSearchActive, resolveRequestThreadCount, resolveWorkerCount, resolveWorkerEntry, sharedStopOfSignal, signalOfSearch, spawnNodeWorker, splitWorkerBudget, stopOfSignal, youngGenerationBytesOfThisV8 };
|
|
210
|
+
export { CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, SHUTDOWN_TIMEOUT_MS, WORKER_YOUNG_GENERATION_MB, answerFromOneState, bindSearchSignal, bindSignalStop, countEngineThread, createDocIdMap, detectRuntime, engineThreadYoungGenerationBytes, missingWorkerEntry, nodeThreadId, requirePinnedState, requireSearchActive, resolveRequestThreadCount, resolveWorkerCount, resolveWorkerEntry, shardEntryRangeOf, sharedStopOfSignal, signalOfSearch, spawnNodeWorker, splitWorkerBudget, stopOfSignal, youngGenerationBytesOfThisV8 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { responseStopOf, sendRelayed, parseJson, validateQuery, rejectInvalid, refuseRegex, withServerRerankWindow, requestSignal, respondJson, encodeQueryResult, respondError, loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedBodyBudget, createSharedRequestGate, registerFeedRoute, registerServerRoutes, closeWhenTheProcessExits, statusLine, sendError, REQUEST_THREAD_MOVE_AFTER_MS, MAX_LONG_QUERIES_IN_FLIGHT, createDocumentReadHandlers, SERVER_CAPABILITIES, versionReport, serverRoutes, validateSuggest, isMainFeedNote, SEARCH_CLOCK_SAMPLE_UNITS, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed, stopResponse } from './chunk-
|
|
2
|
-
import { SYNC_CLOSE_GOING_AWAY, encodeJson } from './chunk-
|
|
3
|
-
import { importOptionalReads, loadSortingFor, holdsQuotedText, loadQueryCode, executeQuery, lazyQueryBinding, executePreflight, resolveProjection, projectionKeepsField, loadRerankRuntime, setNestedValue } from './chunk-
|
|
4
|
-
import { loadedMessagePack, loadMessagePack, extractVectorFieldsFromSchema } from './chunk-
|
|
5
|
-
import { answerFromOneState } from './chunk-
|
|
6
|
-
import { ServerErrorCodes, ErrorCodes, NarsilError, isNarsilError } from './chunk-
|
|
1
|
+
import { responseStopOf, sendRelayed, parseJson, validateQuery, rejectInvalid, refuseRegex, withServerRerankWindow, requestSignal, respondJson, encodeQueryResult, respondError, loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedBodyBudget, createSharedRequestGate, registerFeedRoute, SYNC_FEED_ROUTE, CHANGES_FEED_ROUTE, registerServerRoutes, closeWhenTheProcessExits, statusLine, sendError, REQUEST_THREAD_MOVE_AFTER_MS, MAX_LONG_QUERIES_IN_FLIGHT, createDocumentReadHandlers, SERVER_CAPABILITIES, versionReport, serverRoutes, validateSuggest, isMainFeedNote, SEARCH_CLOCK_SAMPLE_UNITS, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed, stopResponse } from './chunk-7X4IIREW.mjs';
|
|
2
|
+
import { SYNC_CLOSE_GOING_AWAY, encodeJson } from './chunk-F6F4G322.mjs';
|
|
3
|
+
import { importOptionalReads, loadSortingFor, holdsQuotedText, loadQueryCode, executeQuery, lazyQueryBinding, executePreflight, resolveProjection, projectionKeepsField, loadRerankRuntime, setNestedValue } from './chunk-HSA3H3VW.mjs';
|
|
4
|
+
import { loadedMessagePack, loadMessagePack, extractVectorFieldsFromSchema } from './chunk-7P5YWDRQ.mjs';
|
|
5
|
+
import { answerFromOneState } from './chunk-RORNUNXW.mjs';
|
|
6
|
+
import { ServerErrorCodes, ErrorCodes, NarsilError, isNarsilError } from './chunk-ZKOQR7EA.mjs';
|
|
7
7
|
|
|
8
8
|
// src/server/request-threads/feed-relay.ts
|
|
9
|
-
function threadFeedGateway(port, relay) {
|
|
9
|
+
function threadFeedGateway(port, relay, feed) {
|
|
10
10
|
const sockets = /* @__PURE__ */ new Map();
|
|
11
11
|
function post(note, transfer = []) {
|
|
12
12
|
try {
|
|
@@ -35,7 +35,7 @@ function threadFeedGateway(port, relay) {
|
|
|
35
35
|
return {
|
|
36
36
|
authorize: (context) => relay.authorize(context),
|
|
37
37
|
async admit(indexName, expiresAt) {
|
|
38
|
-
const reply = await relay.admitFeed(indexName, expiresAt);
|
|
38
|
+
const reply = await relay.admitFeed(feed, indexName, expiresAt);
|
|
39
39
|
const { feedId } = reply;
|
|
40
40
|
if (feedId === null) {
|
|
41
41
|
const error = reply.error;
|
|
@@ -337,8 +337,8 @@ function createRelayClient(port, touchIntervalMs) {
|
|
|
337
337
|
async awaitWrites(indexName, signal) {
|
|
338
338
|
await send((requestId) => ({ type: "await-writes", requestId, indexName }), [], signal);
|
|
339
339
|
},
|
|
340
|
-
async admitFeed(indexName, expiresAt) {
|
|
341
|
-
const reply = await send((requestId) => ({ type: "feed-admit", requestId, indexName, expiresAt }));
|
|
340
|
+
async admitFeed(feed, indexName, expiresAt) {
|
|
341
|
+
const reply = await send((requestId) => ({ type: "feed-admit", requestId, feed, indexName, expiresAt }));
|
|
342
342
|
if (reply.type === "feed-admitted") return reply;
|
|
343
343
|
throw portClosedError();
|
|
344
344
|
},
|
|
@@ -1069,8 +1069,11 @@ async function serveRequests(executor, settings) {
|
|
|
1069
1069
|
track: departure.track
|
|
1070
1070
|
});
|
|
1071
1071
|
const handlers = guardEveryRoute(threadHandlers(local, relay, longQueries, settings), departure);
|
|
1072
|
-
const feeds = settings.
|
|
1073
|
-
|
|
1072
|
+
const feeds = settings.feeds.map((feed) => {
|
|
1073
|
+
const gateway = threadFeedGateway(settings.port, relay, feed);
|
|
1074
|
+
registerFeedRoute(app, gateway, feed === "sync" ? SYNC_FEED_ROUTE : CHANGES_FEED_ROUTE);
|
|
1075
|
+
return gateway;
|
|
1076
|
+
});
|
|
1074
1077
|
registerServerRoutes(app, run, handlers, settings.limits, settings.cors);
|
|
1075
1078
|
servingApp = { app: child, relay, longQueries, feeds };
|
|
1076
1079
|
void closeWhenTheProcessExits(new Int32Array(settings.closeAtExit), closeRequestThread);
|
|
@@ -1081,7 +1084,7 @@ function closeRequestThread() {
|
|
|
1081
1084
|
if (servingApp === null) return;
|
|
1082
1085
|
const { app, relay, longQueries, feeds } = servingApp;
|
|
1083
1086
|
servingApp = null;
|
|
1084
|
-
feeds
|
|
1087
|
+
for (const gateway of feeds) gateway.close();
|
|
1085
1088
|
app.close();
|
|
1086
1089
|
longQueries.close();
|
|
1087
1090
|
relay.close();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFs, getPath } from './chunk-HLPRHOSO.mjs';
|
|
2
2
|
import { DIRECTORY_LOCK_ATTEMPTS, DIRECTORY_LOCK_SETTLE_MS, DIRECTORY_LOCK_PROCESS_START_TOLERANCE_MS } from './chunk-MSIN4NM3.mjs';
|
|
3
|
-
import { nodeThreadId } from './chunk-
|
|
4
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
3
|
+
import { nodeThreadId } from './chunk-RORNUNXW.mjs';
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
5
5
|
import { compareCodePoints } from './chunk-TGPKS2UM.mjs';
|
|
6
6
|
import { openSync, close, readFileSync } from 'fs';
|
|
7
7
|
import { rename, readFile, writeFile, unlink, realpath, readdir, readlink } from 'fs/promises';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { syncStorageOf, INDEX_CONFIGURATION_ENVELOPE_VERSION, MAX_SNAPSHOT_ANALYSIS_ATTEMPTS, encodeIndexConfiguration } from './chunk-
|
|
2
|
-
import { archiveLayout } from './chunk-
|
|
3
|
-
import { manifestFileRefs } from './chunk-
|
|
1
|
+
import { syncStorageOf, INDEX_CONFIGURATION_ENVELOPE_VERSION, MAX_SNAPSHOT_ANALYSIS_ATTEMPTS, encodeIndexConfiguration } from './chunk-K5GNK5GE.mjs';
|
|
2
|
+
import { archiveLayout } from './chunk-Z6SIJH5O.mjs';
|
|
3
|
+
import { manifestFileRefs } from './chunk-TSE2VWPX.mjs';
|
|
4
4
|
import { DIRECTORY_IDENTITY_CHECK_INTERVAL_MS } from './chunk-MSIN4NM3.mjs';
|
|
5
5
|
import { oneSyncChangeAtATime } from './chunk-V6EUBAIT.mjs';
|
|
6
|
-
import { openChecksummedEnvelope } from './chunk-
|
|
7
|
-
import { withOpenIndex, emitEngineEvent } from './chunk-
|
|
6
|
+
import { openChecksummedEnvelope } from './chunk-KOA6T2IC.mjs';
|
|
7
|
+
import { withOpenIndex, emitEngineEvent } from './chunk-HSA3H3VW.mjs';
|
|
8
8
|
import { decode } from './chunk-GXCDWLQI.mjs';
|
|
9
9
|
import { isSyncEpoch } from './chunk-BUMREPLU.mjs';
|
|
10
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
10
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
11
11
|
|
|
12
12
|
// src/persistence/durability/directory-watch.ts
|
|
13
13
|
function unrefInterval(tick, intervalMs) {
|
|
@@ -100,6 +100,7 @@ function createDirectoryWatch(directory, isStopped, onLost) {
|
|
|
100
100
|
// src/persistence/durability/sync/constants.ts
|
|
101
101
|
var LOG_READ_CHUNK_BYTES = 1048576;
|
|
102
102
|
var DEFAULT_HISTORY_MAX_AGE_MS = 2592e6;
|
|
103
|
+
var DEFAULT_CHANGES_HISTORY_MAX_BYTES_FLOOR = 1073741824;
|
|
103
104
|
|
|
104
105
|
// src/engine/sync/archive.ts
|
|
105
106
|
function publishedArchiveLayout(indexName, snapshot, storage) {
|
|
@@ -205,16 +206,40 @@ function stateOf(core) {
|
|
|
205
206
|
}
|
|
206
207
|
return state;
|
|
207
208
|
}
|
|
209
|
+
async function syncLimits(sync, storage, indexName) {
|
|
210
|
+
const published = sync.historyMaxBytes === void 0 ? await storage.published(indexName) : null;
|
|
211
|
+
return {
|
|
212
|
+
maxAgeMs: sync.historyMaxAgeMs ?? DEFAULT_HISTORY_MAX_AGE_MS,
|
|
213
|
+
maxBytes: sync.historyMaxBytes ?? (published === null ? Number.POSITIVE_INFINITY : publishedArchiveLayout(indexName, published, storage).byteLength)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
async function changesLimits(changes, storage, indexName) {
|
|
217
|
+
let maxBytes = changes.historyMaxBytes;
|
|
218
|
+
if (maxBytes === void 0) {
|
|
219
|
+
const manifest = await storage.currentManifest(indexName);
|
|
220
|
+
let checkpointBytes = 0;
|
|
221
|
+
if (manifest !== null) for (const ref of manifestFileRefs(manifest)) checkpointBytes += ref.bytes;
|
|
222
|
+
maxBytes = Math.max(checkpointBytes, DEFAULT_CHANGES_HISTORY_MAX_BYTES_FLOOR);
|
|
223
|
+
}
|
|
224
|
+
return { maxAgeMs: changes.historyMaxAgeMs ?? DEFAULT_HISTORY_MAX_AGE_MS, maxBytes };
|
|
225
|
+
}
|
|
226
|
+
async function historyLimitsOf(sync, changes, storage, indexName) {
|
|
227
|
+
const kept = sync?.active === true ? await syncLimits(sync, storage, indexName) : null;
|
|
228
|
+
const captured = changes === null ? null : await changesLimits(changes, storage, indexName);
|
|
229
|
+
if (kept === null) return captured;
|
|
230
|
+
if (captured === null) return kept;
|
|
231
|
+
return { maxAgeMs: Math.max(kept.maxAgeMs, captured.maxAgeMs), maxBytes: Math.max(kept.maxBytes, captured.maxBytes) };
|
|
232
|
+
}
|
|
208
233
|
async function enforce(core, indexName) {
|
|
209
|
-
const
|
|
234
|
+
const entry = core.indexRegistry.get(indexName);
|
|
210
235
|
const storage = core.durability?.manager.syncStorage?.();
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
const publishesSnapshots = core.mutationCtx.capacityScope !== "partition";
|
|
236
|
+
if (entry === void 0 || storage === void 0 || core.shutdownState.isShutdown) return;
|
|
237
|
+
const limits = await historyLimitsOf(entry.sync, entry.changes, storage, indexName);
|
|
238
|
+
if (limits === null) return;
|
|
239
|
+
const publishesSnapshots = entry.sync?.active === true && core.mutationCtx.capacityScope !== "partition";
|
|
215
240
|
await storage.enforceHistoryLimits(
|
|
216
241
|
indexName,
|
|
217
|
-
|
|
242
|
+
limits,
|
|
218
243
|
publishesSnapshots ? async () => {
|
|
219
244
|
const { unpin } = await publishedSyncSnapshot(core, indexName, true);
|
|
220
245
|
unpin();
|
|
@@ -250,7 +275,7 @@ function startSyncRetentionSweep(core) {
|
|
|
250
275
|
return;
|
|
251
276
|
}
|
|
252
277
|
for (const [indexName, entry] of core.indexRegistry) {
|
|
253
|
-
if (entry.sync?.active === true) scheduleSyncRetention(core, indexName);
|
|
278
|
+
if (entry.sync?.active === true || entry.changes !== null) scheduleSyncRetention(core, indexName);
|
|
254
279
|
}
|
|
255
280
|
}, HISTORY_SWEEP_INTERVAL_MS);
|
|
256
281
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex, rebuildSizeIndexes, requirePatternSearch, patternIndexOf } from './chunk-
|
|
2
|
-
import { getFlatSchema, schemaFieldsOf, getNestedValue } from './chunk-
|
|
1
|
+
import { createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex, rebuildSizeIndexes, requirePatternSearch, patternIndexOf } from './chunk-HSA3H3VW.mjs';
|
|
2
|
+
import { getFlatSchema, schemaFieldsOf, getNestedValue } from './chunk-7P5YWDRQ.mjs';
|
|
3
3
|
|
|
4
4
|
// src/core/partition/pattern-snapshot.ts
|
|
5
5
|
function serializePatternIndexes(state, schema) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isCompositePartition, encodeSegmentState, freezeSegmentShared } from './chunk-
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { isCompositePartition, encodeSegmentState, freezeSegmentShared } from './chunk-HSA3H3VW.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
3
3
|
|
|
4
4
|
// src/core/partition/frozen/share.ts
|
|
5
5
|
function shareFrozenSegment(segment, analysis) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { loadFailed, cachedFileBytes, COLD_LOAD_WAIT_WITHOUT_SEARCH_MS, readWholeSectionChecked, checkEverySectionPage, readFileRange, openPagedFile, readCacheOfThisThread, createSectionReader, closePagedFile, COLD_GRAPH_PART_VECTORS, decodeSections, readListedFile, requireListedChecksum, requireListedSize, SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES, failNativePage, COLD_WALK_NODES_READ_AHEAD } from './chunk-
|
|
2
|
-
import { isDead, VECTOR_FILE_PAYLOAD_VERSION, bytesToVectors, decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, requireBoundedUpperLists, osqRecordBytes, osqBitsOf, countDead, magnitude, rescoreDepth, defaultEfSearch, computeCodeBlockLayout, toScore, osqQuantize, createOsqScratch, stageQueryLevels, scalarQueryProducts, readTrailer, osqEstimate, osqDistance, toDistance, createFixedBuffer } from './chunk-
|
|
3
|
-
import { HEADER_SIZE, openChecksummedEnvelope, crc32, readHeader } from './chunk-
|
|
4
|
-
import { yieldToEventLoop, compareScores } from './chunk-
|
|
1
|
+
import { loadFailed, cachedFileBytes, COLD_LOAD_WAIT_WITHOUT_SEARCH_MS, readWholeSectionChecked, checkEverySectionPage, readFileRange, openPagedFile, readCacheOfThisThread, createSectionReader, closePagedFile, COLD_GRAPH_PART_VECTORS, decodeSections, readListedFile, requireListedChecksum, requireListedSize, SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES, failNativePage, COLD_WALK_NODES_READ_AHEAD } from './chunk-3N5GUXBI.mjs';
|
|
2
|
+
import { isDead, VECTOR_FILE_PAYLOAD_VERSION, bytesToVectors, decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, requireBoundedUpperLists, osqRecordBytes, osqBitsOf, countDead, magnitude, rescoreDepth, defaultEfSearch, computeCodeBlockLayout, toScore, osqQuantize, createOsqScratch, stageQueryLevels, scalarQueryProducts, readTrailer, osqEstimate, osqDistance, toDistance, createFixedBuffer } from './chunk-KBU3ZFJN.mjs';
|
|
3
|
+
import { HEADER_SIZE, openChecksummedEnvelope, crc32, readHeader } from './chunk-KOA6T2IC.mjs';
|
|
4
|
+
import { yieldToEventLoop, compareScores } from './chunk-HSA3H3VW.mjs';
|
|
5
5
|
import { decode, decodeMulti } from './chunk-GXCDWLQI.mjs';
|
|
6
|
-
import { signalOfSearch, requireSearchActive } from './chunk-
|
|
6
|
+
import { signalOfSearch, requireSearchActive } from './chunk-RORNUNXW.mjs';
|
|
7
7
|
import { MIN_M, MAX_M, MAX_LAYER_CAP } from './chunk-ZXX5GZEX.mjs';
|
|
8
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
8
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
9
9
|
import { compareCodePoints } from './chunk-TGPKS2UM.mjs';
|
|
10
10
|
|
|
11
11
|
// src/persistence/paged/cold-heap.ts
|
|
@@ -1064,10 +1064,11 @@ async function openListedFile(store, ref, what, allowsCompression) {
|
|
|
1064
1064
|
requireListedChecksum(what, ref.key, header.checksum, ref.checksum);
|
|
1065
1065
|
return { payload, payloadLength: header.payloadLength };
|
|
1066
1066
|
}
|
|
1067
|
-
async function readGraphParts(store, ref) {
|
|
1067
|
+
async function readGraphParts(store, ref, stillWanted = () => true) {
|
|
1068
1068
|
if (ref.graphParts.length === 0) return null;
|
|
1069
1069
|
const parts = [];
|
|
1070
1070
|
for (const part of ref.graphParts) {
|
|
1071
|
+
if (!stillWanted()) return null;
|
|
1071
1072
|
const { payload } = await openListedFile(store, part, "graph part", true);
|
|
1072
1073
|
const decoded = decodeVectorGraphPartPayload(decode(payload));
|
|
1073
1074
|
if (decoded.fieldName !== ref.fieldPath) {
|
|
@@ -1130,7 +1131,7 @@ async function loadFieldOnDemand(store, ref, vectorIndex, resolvePartition) {
|
|
|
1130
1131
|
vectorIndex.openColdField(field, async (beginRestore, stillWanted, loadingWanted) => {
|
|
1131
1132
|
await waitBeforeColdLoad(loadingWanted);
|
|
1132
1133
|
if (!stillWanted()) return;
|
|
1133
|
-
const graph = await readGraphParts(store, ref);
|
|
1134
|
+
const graph = await readGraphParts(store, ref, stillWanted);
|
|
1134
1135
|
if (!stillWanted()) return;
|
|
1135
1136
|
const restore = beginRestore({ liveVectors: liveVectorsOf(ref), holdsGraph: true, graph });
|
|
1136
1137
|
await loadFilesByParts(files, restore, ref.fieldPath, vectorIndex.dimension, stillWanted);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fnv1a } from './chunk-
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { fnv1a } from './chunk-HSA3H3VW.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
3
3
|
|
|
4
4
|
// src/persistence/durability/segment/layout.ts
|
|
5
5
|
var SEGMENT_ID_WIDTH = 16;
|