@delali/narsil 0.3.1-next.156 → 0.3.1-next.157
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/{analysis-change-5BQOQ4BF.mjs → analysis-change-CKEMM2MC.mjs} +9 -9
- package/dist/{react-native/chunks/analysis-change-entry-SCVWK6OU.mjs → analysis-change-entry-SEDMJ6MW.mjs} +1 -1
- package/dist/browser/{analysis-change-435CUEPZ.mjs → analysis-change-ZKGJFENM.mjs} +38 -29
- package/dist/{analysis-change-entry-TXX6JSMX.mjs → browser/analysis-change-entry-5BFUVMHJ.mjs} +1 -1
- package/dist/browser/{chunk-BHFQATSC.mjs → chunk-25MTVDYD.mjs} +1 -1
- package/dist/browser/{chunk-IZXVW2ZJ.mjs → chunk-3NLMB5CC.mjs} +2 -2
- package/dist/browser/{chunk-23XRXIBW.mjs → chunk-5YWB3E2W.mjs} +8 -1
- package/dist/browser/chunk-AI5UI46D.mjs +12 -0
- package/dist/browser/{chunk-2CFI5VVV.mjs → chunk-BLT4RHCJ.mjs} +2 -2
- package/dist/browser/{chunk-4NGKC4H4.mjs → chunk-C26SPCGQ.mjs} +7 -6
- package/dist/browser/{chunk-6LWDPLTB.mjs → chunk-C4FJ3WDY.mjs} +1 -1
- package/dist/browser/{chunk-MGI4BCXC.mjs → chunk-CXNTHHA7.mjs} +2 -2
- package/dist/browser/{chunk-STOWQFT3.mjs → chunk-DUH6QUVU.mjs} +547 -2
- package/dist/browser/chunk-EKMGCRSR.mjs +61 -0
- package/dist/browser/{chunk-SSTPBZZX.mjs → chunk-GFAZPSWK.mjs} +5 -5
- package/dist/browser/{chunk-3SSRJMFN.mjs → chunk-HUCSHDTB.mjs} +1 -1
- package/dist/browser/{chunk-K4Q6KX3R.mjs → chunk-K3IPRX6D.mjs} +48 -17
- package/dist/browser/{chunk-MOG4OVDK.mjs → chunk-MY2XKH22.mjs} +1 -12
- package/dist/browser/{chunk-3V7DNNZL.mjs → chunk-N23GL72Q.mjs} +178 -801
- package/dist/browser/{chunk-NQAME3RK.mjs → chunk-UATIJ4KU.mjs} +2 -2
- package/dist/browser/{chunk-2TI4SSUP.mjs → chunk-UKOWD2K5.mjs} +3 -3
- package/dist/browser/{chunk-7U3WVJUP.mjs → chunk-UTMHUHUV.mjs} +2 -2
- package/dist/browser/{chunk-EA63E3D2.mjs → chunk-V43N6TZO.mjs} +5 -5
- package/dist/browser/{chunk-CRE3G7F3.mjs → chunk-VY5KW3HN.mjs} +3 -3
- package/dist/browser/{chunk-WI4MR75E.mjs → chunk-X7TXYUKO.mjs} +1 -1
- package/dist/browser/{chunk-KZWSX6BH.mjs → chunk-Y6IBAUNO.mjs} +2 -86
- package/dist/browser/{cold-module-2EHCIV4K.mjs → cold-module-YNUUDNOM.mjs} +12 -10
- package/dist/browser/{durability-wiring-A7BVG2DW.mjs → durability-wiring-GVZEE46O.mjs} +64 -21
- package/dist/browser/{engine-hooks-E4UD67JD.mjs → engine-hooks-HBVS6YM4.mjs} +5 -4
- package/dist/browser/{geo-index-HHWGMNIS.mjs → geo-index-OTV7VPIR.mjs} +2 -1
- package/dist/browser/{import-DXYB6756.mjs → import-5ESVMFDJ.mjs} +6 -5
- package/dist/browser/{module-NIYMEA5R.mjs → module-NDSQLPMQ.mjs} +11 -9
- package/dist/{release-BH3DKW3T.mjs → browser/release-HYXPVJVS.mjs} +0 -1
- package/dist/browser/{restore-hooks-YPN4ZFCY.mjs → restore-hooks-IE3GGYHG.mjs} +8 -7
- package/dist/browser/{restore-queue-G3RQGL3Y.mjs → restore-queue-LQBBTODR.mjs} +3 -3
- package/dist/browser/{retention-ZWVMNC3Q.mjs → retention-TY3L3BFN.mjs} +7 -6
- package/dist/browser/{snapshot-VEQNIE6C.mjs → snapshot-5FHPPCNZ.mjs} +16 -14
- package/dist/browser/{start-BM442C6R.mjs → start-2UZTOBG5.mjs} +8 -7
- package/dist/browser/{write-2EVMZWDE.mjs → write-ULXAN5B4.mjs} +10 -8
- package/dist/{capabilities-Da4ywVVl.d.ts → capabilities-D3AoBJoF.d.ts} +2 -2
- package/dist/{chunk-K5QFDYST.mjs → chunk-24FNVRKB.mjs} +1 -1
- package/dist/{chunk-DP5C7YFQ.mjs → chunk-2ROUFMQX.mjs} +2 -2
- package/dist/{chunk-PWC4VB3Q.mjs → chunk-4B7JIGQD.mjs} +2 -2
- package/dist/{chunk-FAKFUDZZ.mjs → chunk-4LMSZAK6.mjs} +14 -3
- package/dist/{chunk-6I6AYAXS.mjs → chunk-4ZTHGTVX.mjs} +2 -2
- package/dist/{chunk-QOW2JPUI.mjs → chunk-BNL5OPRV.mjs} +6 -6
- package/dist/{chunk-3HYC4JRF.mjs → chunk-C7XQYG6U.mjs} +2 -2
- package/dist/{chunk-WX4LAO6M.mjs → chunk-CQZXZ75V.mjs} +3 -97
- package/dist/{chunk-4KKXNJM6.mjs → chunk-CWS55TEX.mjs} +2 -2
- package/dist/{chunk-2UV4QBHW.mjs → chunk-EYD7K3H6.mjs} +5 -5
- package/dist/{chunk-EFBDHH5P.mjs → chunk-FEZVDOWX.mjs} +160 -245
- package/dist/{chunk-XAXKV65G.mjs → chunk-FUD5XSZ5.mjs} +1 -1
- package/dist/{chunk-JDJBQLRO.mjs → chunk-GPWMUPCA.mjs} +10 -10
- package/dist/{chunk-25KDNIZZ.mjs → chunk-IIRIG7H5.mjs} +1 -1
- package/dist/{chunk-TZTRKM33.mjs → chunk-JSV6OQ4C.mjs} +1 -1
- package/dist/{chunk-NF4DT3IH.mjs → chunk-JTYPJF3T.mjs} +8 -1
- package/dist/chunk-KCQYFO4K.mjs +62 -0
- package/dist/{chunk-CSLGFPFQ.mjs → chunk-LDNCLRZU.mjs} +1 -1
- package/dist/{chunk-MQOJIO5B.mjs → chunk-MW6BR4QP.mjs} +2 -2
- package/dist/{react-native/chunks/chunk-MUWD2H2S.mjs → chunk-MWD5VPN7.mjs} +2 -2
- package/dist/{chunk-XXHN7J46.mjs → chunk-ODYKO5TO.mjs} +1 -1
- package/dist/{chunk-RDXO6JST.mjs → chunk-OG7UGJ6F.mjs} +2 -2
- package/dist/{chunk-FYOVBEMM.mjs → chunk-OQLD2BSW.mjs} +2 -2
- package/dist/{chunk-I53G4JAU.mjs → chunk-OYABFKTW.mjs} +2 -2
- package/dist/{chunk-TZ3355VS.mjs → chunk-P5LANSH6.mjs} +1 -1
- package/dist/{chunk-P5ZI2P2W.mjs → chunk-PIH5SJ4N.mjs} +3 -3
- package/dist/{chunk-HFPMMRQT.mjs → chunk-PSZI4O24.mjs} +51 -4
- package/dist/{chunk-L6V6BST3.mjs → chunk-PV2CG7EJ.mjs} +3 -552
- package/dist/{chunk-SA5LOGO3.mjs → chunk-PWGYQXML.mjs} +1 -1
- package/dist/{chunk-BWZ3P4MU.mjs → chunk-QLDABJZM.mjs} +3 -3
- package/dist/{chunk-JWRUUCWD.mjs → chunk-RCX4WNLC.mjs} +2 -2
- package/dist/{chunk-DWEPMFJE.mjs → chunk-RIHIVFIQ.mjs} +5 -5
- package/dist/{chunk-FNGAM5B7.mjs → chunk-RWURUDSP.mjs} +8 -8
- package/dist/{chunk-I2KPOLOZ.mjs → chunk-SMOOSIAW.mjs} +3 -3
- package/dist/{chunk-TGS5UXBE.mjs → chunk-SOI6LTHM.mjs} +3 -3
- package/dist/{chunk-YTWZVGCB.mjs → chunk-UD5HIS4U.mjs} +1 -1
- package/dist/{chunk-46KY2PJD.mjs → chunk-UJDJB3NE.mjs} +37 -29
- package/dist/{chunk-Z2KAFCRT.mjs → chunk-VSLSGASN.mjs} +2 -2
- package/dist/{chunk-VTTRFF2C.mjs → chunk-VZ2ONHEE.mjs} +9 -5
- package/dist/chunk-W5EB5XKI.mjs +741 -0
- package/dist/{chunk-7LXHHCXZ.mjs → chunk-W7OSSKH5.mjs} +46 -16
- package/dist/{chunk-ZKP7G7TV.mjs → chunk-XXJZMTZT.mjs} +1 -1
- package/dist/{chunk-FRBFVQFN.mjs → chunk-ZPZ3YGXV.mjs} +4 -4
- package/dist/{client-DRv7UVeY.d.ts → client-kqSMevVi.d.ts} +15 -3
- package/dist/client.d.ts +6 -6
- package/dist/client.mjs +4 -0
- package/dist/{cold-module-6MO2XJF2.mjs → cold-module-VOJXMNZB.mjs} +13 -12
- package/dist/{config-DMwffLKn.d.ts → config-B4v_Htpu.d.ts} +1 -1
- package/dist/{config-CoSig5Ox.d.ts → config-CTP01fns.d.ts} +1 -1
- package/dist/{direct-executor-FTMYY3TI.mjs → direct-executor-V5DRIECI.mjs} +5 -5
- package/dist/distribution.d.ts +4 -4
- package/dist/distribution.mjs +72 -64
- package/dist/{durability-wiring-VIF5MOSY.mjs → durability-wiring-3TD62MBI.mjs} +38 -30
- package/dist/{engine-CFxPYqEk.d.ts → engine-CkPn2PWE.d.ts} +1 -1
- package/dist/{engine-hooks-EGUGNZYE.mjs → engine-hooks-HA3SBOBR.mjs} +8 -8
- package/dist/{import-XKDPJQDP.mjs → import-GPKLTSKA.mjs} +8 -8
- package/dist/index.browser.mjs +4 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +7 -7
- package/dist/index.react-native.mjs +3 -3
- package/dist/{long-query-thread-YA4IAYSY.mjs → long-query-thread-QDFQSJD6.mjs} +13 -13
- package/dist/{module-FQ4JWNQJ.mjs → module-JYHFTVPS.mjs} +12 -11
- package/dist/{paged-partition-archive-PXW5XAYU.mjs → paged-partition-archive-RLRGOXDX.mjs} +14 -14
- package/dist/partial-words.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.mjs +13 -12
- package/dist/query-suggestions/merge-worker.mjs +9 -9
- package/dist/query-suggestions.browser.mjs +9 -8
- package/dist/query-suggestions.d.ts +1 -1
- package/dist/query-suggestions.mjs +17 -17
- package/dist/react-native/chunks/{analysis-change-LT5QBQ3H.mjs → analysis-change-QUVDNABS.mjs} +37 -29
- package/dist/{browser/analysis-change-entry-HZXKPPGV.mjs → react-native/chunks/analysis-change-entry-OC4XASBF.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-KV46CT4D.mjs → chunk-4AV5PPH6.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-GXX3DQXP.mjs → chunk-4COWCEY7.mjs} +188 -163
- package/dist/react-native/chunks/{chunk-G43IPIDG.mjs → chunk-4NWR3NGS.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-3JWDECAZ.mjs → chunk-5MSX5FRT.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-6WA3C3DV.mjs → chunk-6OFDUYVX.mjs} +8 -1
- package/dist/react-native/chunks/{chunk-NB3LP33V.mjs → chunk-6ZELFCK5.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-4JYO3JD2.mjs → chunk-BITYFZSZ.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-ZXZFN7FI.mjs → chunk-DMIFXZ3Q.mjs} +1 -1
- package/dist/{chunk-KF4EXSM4.mjs → react-native/chunks/chunk-IAENKE2D.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-ZLWVW734.mjs → chunk-KSBYEMCB.mjs} +1 -1
- package/dist/react-native/chunks/chunk-KU646XXT.mjs +164 -0
- package/dist/react-native/chunks/{chunk-MIP4SOR6.mjs → chunk-OCSLSH27.mjs} +164 -244
- package/dist/react-native/chunks/chunk-OXM66LO6.mjs +62 -0
- package/dist/react-native/chunks/{chunk-VWUDIOT6.mjs → chunk-TORU2OHQ.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-PDRWWPKV.mjs → chunk-WVWJNUMN.mjs} +48 -18
- package/dist/react-native/chunks/{chunk-UQ4OAXKU.mjs → chunk-WW2X2AEI.mjs} +4 -4
- package/dist/react-native/chunks/{chunk-QUKQNI3H.mjs → chunk-ZNZ6CPAZ.mjs} +2 -87
- package/dist/react-native/chunks/{chunk-TP6KCKER.mjs → chunk-ZVQMBF2H.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-POPDAGH6.mjs → chunk-ZWAIN4GG.mjs} +6 -6
- package/dist/react-native/chunks/{cold-module-KVZYUGRY.mjs → cold-module-N6KFNNZA.mjs} +9 -8
- package/dist/react-native/chunks/{durability-wiring-34OYO32E.mjs → durability-wiring-RN64S2TL.mjs} +63 -21
- package/dist/react-native/chunks/{engine-hooks-M7JV46NH.mjs → engine-hooks-CWA5CKCA.mjs} +4 -4
- package/dist/react-native/chunks/{import-H6AQREWI.mjs → import-5UAWBRJP.mjs} +4 -4
- package/dist/react-native/chunks/{module-LBZPGOWH.mjs → module-6RP4ZCBW.mjs} +8 -7
- package/dist/react-native/chunks/{release-D7ZTIANM.mjs → release-2SIHZWDO.mjs} +0 -1
- package/dist/react-native/chunks/{restore-hooks-IBGIY3DR.mjs → restore-hooks-ENFMDTWC.mjs} +7 -7
- package/dist/react-native/chunks/{restore-queue-ZZX54AH7.mjs → restore-queue-4R6AASE5.mjs} +3 -3
- package/dist/react-native/chunks/{retention-EW4TTDFB.mjs → retention-5GTFT3GR.mjs} +6 -6
- package/dist/react-native/chunks/{snapshot-REYVIN3X.mjs → snapshot-5LGPQXFS.mjs} +15 -14
- package/dist/react-native/chunks/{start-BQK6KN3R.mjs → start-ZQJVZ5DN.mjs} +7 -7
- package/dist/react-native/chunks/{write-FQAYCZF5.mjs → write-6BRYIIZ7.mjs} +7 -6
- package/dist/react-native/partial-words.mjs +2 -2
- package/dist/react-native/query-suggestions.mjs +8 -8
- package/dist/react-native/sync.mjs +44 -10
- package/dist/react.d.ts +7 -7
- package/dist/{browser/release-76MXRPGV.mjs → release-SMR4WJD4.mjs} +0 -1
- package/dist/{restore-hooks-CDERDEF4.mjs → restore-hooks-HXLIEB4A.mjs} +12 -12
- package/dist/{restore-queue-7NNSTROA.mjs → restore-queue-LZH7LMLR.mjs} +3 -3
- package/dist/{retention-QSVBBNRM.mjs → retention-3K7ARGAG.mjs} +12 -12
- package/dist/server.d.ts +10 -8
- package/dist/server.mjs +37 -29
- package/dist/{snapshot-RH4NSKIZ.mjs → snapshot-O7ICP7NJ.mjs} +24 -23
- package/dist/{start-MCKCOGIW.mjs → start-S4PFP6RS.mjs} +14 -14
- package/dist/sync/filesystem.d.ts +2 -2
- package/dist/sync/indexeddb.d.ts +2 -2
- package/dist/sync.browser.mjs +44 -10
- package/dist/sync.d.ts +3 -3
- package/dist/sync.mjs +44 -10
- package/dist/{tasks-qrJojgST.d.ts → tasks-CoNjxbop.d.ts} +2 -2
- package/dist/{thread-O4SBJJJS.mjs → thread-YLJ3ZPQ3.mjs} +12 -12
- package/dist/{types-BZCGjfLn.d.ts → types-DPMjfOr_.d.ts} +1 -1
- package/dist/workers/entry.mjs +5 -5
- package/dist/{write-3FK7NG3Y.mjs → write-2OBJGLFS.mjs} +11 -10
- package/openapi.json +71 -0
- package/package.json +7 -7
- package/dist/chunk-BU4SAIC4.mjs +0 -196
- package/dist/react-native/chunks/chunk-DNXOMPAQ.mjs +0 -191
|
@@ -5,13 +5,13 @@ import { splitWorkerBudget, resolveWorkerCount, resolveRequestThreadCount, DEFAU
|
|
|
5
5
|
import { MAX_INDEX_CONFIGURATION_BYTES, MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN, BATCH_CHUNK_SIZE, MAX_DOC_ID_LENGTH, ABSOLUTE_WINDOWS_PATH_PATTERN, MODULE_URL_SCHEME_PATTERN, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, MAX_SUGGEST_LIMIT, FOREIGN_STATS_TTL_MS, DEFAULT_SUGGEST_LIMIT, DEFAULT_LIMIT, DEFAULT_OFFSET, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION } from './chunk-AM7RSBPF.mjs';
|
|
6
6
|
import { reactNativeHost } from './chunk-MVXELMJX.mjs';
|
|
7
7
|
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, MATCHER_STATE_BUDGET_BYTES, MAX_FILTER_TESTS, FILTER_OPERAND_COPY_DEPTH, TYPO_CLAIM_SLOTS_PER_WORD, PATTERN_WORK_FLUSH_UNITS } from './chunk-RDWG33MM.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { expandTermPrefix, suggestDisplayTerms, sameFields, partitionDocumentFrequency, visitDocumentSurfaceSpellings, visitDocumentSpellings } from './chunk-KU646XXT.mjs';
|
|
9
9
|
import { fuzzyPrefixOf, boundedLevenshtein, fuzzyTermMatches } from './chunk-UNUFZ2QY.mjs';
|
|
10
10
|
import { emitSyncChange, withOpenIndex, oneAtATime } from './chunk-JDOEEMEF.mjs';
|
|
11
11
|
import { encodeStringBlob, encodeLookupKey, visitTokens, codePointOrder, tokenize, installNativeAnalysis, NATIVE_ANALYSIS_FIRST_TOKEN_RECORDS, NATIVE_ANALYSIS_HELD_TERMS } from './chunk-2PRHILX3.mjs';
|
|
12
12
|
import { requireWithinFileLimit, HEADER_SIZE, payloadByteLength, checksumOfChunks, packEnvelopeWithEngineVersion, INDEX_CONFIGURATION_ENVELOPE_VERSION, readHeapStatistics, readOldGenerationStatistics } from './chunk-YH7QY657.mjs';
|
|
13
13
|
import { fnv1a, FNV_OFFSET_BASIS, fnv1aContinue, fnv1aContinueTaggedNumbers } from './chunk-CHPTFFJM.mjs';
|
|
14
|
-
import { flattenSchema, partialFieldsOf, schemaFieldsOf, validateSchema, requireCreatableSchema, encodeDocument, extractVectorFieldsFromSchema } from './chunk-
|
|
14
|
+
import { isLatitude, isLongitude, flattenSchema, partialFieldsOf, getNestedValue, schemaFieldsOf, tokenizeOptions, raiseEarlierReleaseGraphSetting, messagePackUpperBoundBytes, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, validateDocument, validateDocumentStrict, textFieldsChanged, encodeDocument, extractVectorFieldsFromSchema, getFlatSchema, getOrCreateFieldNameIndex, validateRequiredFields, requireDocumentWithinSizeLimit } from './chunk-4COWCEY7.mjs';
|
|
15
15
|
import { MAX_DOCUMENT_ENCODING_DEPTH } from './chunk-6VBXNFLE.mjs';
|
|
16
16
|
import { parsedTypeOf, isSingleStringFieldType, isWordIndexedBase, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, PROTOTYPE_POLLUTION_KEYS, isPlainObject, isWordIndexedFieldType, isStringValuedBase, MAX_NESTING_DEPTH, withSortableOption, isGeopointOrVectorType, isListBase, VECTOR_PATTERN } from './chunk-C5G6TJ7A.mjs';
|
|
17
17
|
import { resolveIndexAnalysis, getLanguage } from './chunk-MJDQU5MW.mjs';
|
|
@@ -13398,7 +13398,7 @@ async function attachSegments(entry, action) {
|
|
|
13398
13398
|
growPartitionsTo(entry.manager, segment.partitionId);
|
|
13399
13399
|
const surfaceForms = segment.survivingSurfaceForms;
|
|
13400
13400
|
const spellings = surfaceForms === void 0 ? void 0 : NO_REMOVED_SPELLINGS;
|
|
13401
|
-
const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-
|
|
13401
|
+
const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-6RP4ZCBW.mjs')).createPagedFrozenSegment(segment.snapshot) : createSharedFrozenSegment(segment.snapshot, surfaceForms);
|
|
13402
13402
|
for (const docId of segment.tombstonedDocIds ?? []) frozen.tombstoneDocument(docId, spellings);
|
|
13403
13403
|
entry.manager.attachFrozenSegment(segment.partitionId, frozen);
|
|
13404
13404
|
}
|
|
@@ -13453,7 +13453,7 @@ function runSegmentAction(entry, action) {
|
|
|
13453
13453
|
case "attachSegments":
|
|
13454
13454
|
return attachSegments(entry, action);
|
|
13455
13455
|
case "adoptDiskSegments":
|
|
13456
|
-
return import('./module-
|
|
13456
|
+
return import('./module-6RP4ZCBW.mjs').then((code) => code.adoptSegmentsOnWorker(entry.manager, action));
|
|
13457
13457
|
case "compactSegments": {
|
|
13458
13458
|
const partition = requireComposite(entry, action.indexName, action.partitionId, "compact");
|
|
13459
13459
|
return mergeFrozenSegments(
|
|
@@ -13744,16 +13744,19 @@ function createDirectExecutor(options) {
|
|
|
13744
13744
|
case "insert": {
|
|
13745
13745
|
const entry = requireIndex(action.indexName);
|
|
13746
13746
|
entry.manager.insert(action.docId, action.document, action.skipClone ? { skipClone: true } : void 0);
|
|
13747
|
+
options?.onDocumentWrite?.(action);
|
|
13747
13748
|
return void 0;
|
|
13748
13749
|
}
|
|
13749
13750
|
case "remove": {
|
|
13750
13751
|
const entry = requireIndex(action.indexName);
|
|
13751
13752
|
entry.manager.remove(action.docId, action.removedSpellings);
|
|
13753
|
+
options?.onDocumentWrite?.(action);
|
|
13752
13754
|
return void 0;
|
|
13753
13755
|
}
|
|
13754
13756
|
case "update": {
|
|
13755
13757
|
const entry = requireIndex(action.indexName);
|
|
13756
13758
|
entry.manager.update(action.docId, action.document, void 0, action.removedSpellings);
|
|
13759
|
+
options?.onDocumentWrite?.(action);
|
|
13757
13760
|
return void 0;
|
|
13758
13761
|
}
|
|
13759
13762
|
case "query":
|
|
@@ -13800,6 +13803,7 @@ function createDirectExecutor(options) {
|
|
|
13800
13803
|
entry.manager.resetVectorIndexes(vectorIndexesFor(action.indexName, entry.config));
|
|
13801
13804
|
entry.vectorIndexes = entry.manager.getVectorIndexes();
|
|
13802
13805
|
entry.vectorCopies = createHeldVectorCopies();
|
|
13806
|
+
options?.onDocumentWrite?.(action);
|
|
13803
13807
|
return void 0;
|
|
13804
13808
|
}
|
|
13805
13809
|
case "serialize": {
|
|
@@ -13876,7 +13880,7 @@ var TEXT_REBUILD_SWITCH_BACKLOG_DOCUMENTS = 1e3;
|
|
|
13876
13880
|
// src/partitioning/rewrite-spill-of.ts
|
|
13877
13881
|
async function rewriteSpillOf(storage, manager, target) {
|
|
13878
13882
|
if (storage === void 0 || (target?.config ?? manager.config).textStorage !== "disk") return null;
|
|
13879
|
-
const { openRewriteSpill } = await import('./module-
|
|
13883
|
+
const { openRewriteSpill } = await import('./module-6RP4ZCBW.mjs');
|
|
13880
13884
|
return openRewriteSpill(storage, manager, target);
|
|
13881
13885
|
}
|
|
13882
13886
|
|
|
@@ -14484,7 +14488,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
|
14484
14488
|
const existing = deps.indexRegistry.get(metadata.indexName);
|
|
14485
14489
|
if (existing !== void 0) {
|
|
14486
14490
|
if ((metadata.analysisGeneration ?? 0) > existing.analysisGeneration) {
|
|
14487
|
-
const { adoptSavedAnalysis } = await import('./analysis-change-
|
|
14491
|
+
const { adoptSavedAnalysis } = await import('./analysis-change-QUVDNABS.mjs');
|
|
14488
14492
|
adoptSavedAnalysis(deps.executor.getManager(metadata.indexName), existing, metadata);
|
|
14489
14493
|
}
|
|
14490
14494
|
if (loadData && deps.executor.getManager(metadata.indexName) === void 0) {
|
|
@@ -15723,16 +15727,16 @@ function documentWeight(action) {
|
|
|
15723
15727
|
}
|
|
15724
15728
|
return 1;
|
|
15725
15729
|
}
|
|
15730
|
+
var NO_VECTOR_FIELDS = /* @__PURE__ */ new Set();
|
|
15726
15731
|
function vectorFieldPathsOf(state, indexName) {
|
|
15727
|
-
|
|
15728
|
-
if (entry === void 0) return /* @__PURE__ */ new Set();
|
|
15729
|
-
return new Set(extractVectorFieldsFromSchema(entry.config.schema).keys());
|
|
15732
|
+
return state.indexRegistry.get(indexName)?.vectorFieldPaths ?? NO_VECTOR_FIELDS;
|
|
15730
15733
|
}
|
|
15731
15734
|
function withoutVectors(document, fieldPaths) {
|
|
15735
|
+
if (fieldPaths.size === 0) return document;
|
|
15732
15736
|
return prepareDocumentVectors(document, fieldPaths).partitionDoc;
|
|
15733
15737
|
}
|
|
15734
15738
|
function detachCallerDocuments(state, action) {
|
|
15735
|
-
if (
|
|
15739
|
+
if (action.type !== "insert" && action.type !== "update" && action.type !== "mergeSegments") return action;
|
|
15736
15740
|
const fieldPaths = vectorFieldPathsOf(state, action.indexName);
|
|
15737
15741
|
if (action.type === "insert") {
|
|
15738
15742
|
const stripped = withoutVectors(action.document, fieldPaths);
|
|
@@ -15743,17 +15747,14 @@ function detachCallerDocuments(state, action) {
|
|
|
15743
15747
|
const stripped = withoutVectors(action.document, fieldPaths);
|
|
15744
15748
|
return { ...action, document: stripped !== action.document ? stripped : structuredClone(stripped) };
|
|
15745
15749
|
}
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
};
|
|
15755
|
-
}
|
|
15756
|
-
return action;
|
|
15750
|
+
return {
|
|
15751
|
+
...action,
|
|
15752
|
+
segments: action.segments.map((segment) => {
|
|
15753
|
+
const documents = segment.documents.map((document) => withoutVectors(document, fieldPaths));
|
|
15754
|
+
const cloned = action.skipClone === true || fieldPaths.size > 0 ? documents : structuredClone(documents);
|
|
15755
|
+
return { ...segment, documents: cloned };
|
|
15756
|
+
})
|
|
15757
|
+
};
|
|
15757
15758
|
}
|
|
15758
15759
|
function partitionLedger(state, indexName, partitionId) {
|
|
15759
15760
|
let byPartition = state.segmentLedger.get(indexName);
|
|
@@ -15769,6 +15770,10 @@ function partitionLedger(state, indexName, partitionId) {
|
|
|
15769
15770
|
return entries;
|
|
15770
15771
|
}
|
|
15771
15772
|
function recordSegmentBroadcast(state, action) {
|
|
15773
|
+
if (action.type === "clear") {
|
|
15774
|
+
state.segmentLedger.delete(action.indexName);
|
|
15775
|
+
return;
|
|
15776
|
+
}
|
|
15772
15777
|
if (action.type === "attachSegments") {
|
|
15773
15778
|
for (const segment of action.segments) {
|
|
15774
15779
|
partitionLedger(state, action.indexName, segment.partitionId).push({
|
|
@@ -15852,19 +15857,9 @@ async function replicateToWorkers(state, action) {
|
|
|
15852
15857
|
await dispatchToWorkers(state, action);
|
|
15853
15858
|
return;
|
|
15854
15859
|
}
|
|
15855
|
-
|
|
15856
|
-
const
|
|
15857
|
-
|
|
15858
|
-
if (loading2 !== void 0) {
|
|
15859
|
-
queueForCopies(state, detached);
|
|
15860
|
-
if (loading2.length % LOAD_BUFFER_YIELD_INTERVAL === 0) await yieldToEventLoop2();
|
|
15861
|
-
return;
|
|
15862
|
-
}
|
|
15863
|
-
const queue = state.replicationQueues.get(action.indexName);
|
|
15864
|
-
if (queue !== void 0 && queue.pendingDocuments + documentWeight(detached) > MAX_PENDING_REPLICATION_DOCUMENTS) {
|
|
15865
|
-
await new Promise((resume) => queue.drainWaiters.push(resume));
|
|
15866
|
-
}
|
|
15867
|
-
queueForCopies(state, detached);
|
|
15860
|
+
recordMainWrite(state, action);
|
|
15861
|
+
const waiting = replicationRoomWait(state, action.indexName);
|
|
15862
|
+
if (waiting !== null) await waiting;
|
|
15868
15863
|
}
|
|
15869
15864
|
function queueForCopies(state, action) {
|
|
15870
15865
|
if (!("indexName" in action)) return;
|
|
@@ -15876,6 +15871,22 @@ function queueForCopies(state, action) {
|
|
|
15876
15871
|
if (state.workerPool === null || !state.scaledOutIndexes.has(action.indexName)) return;
|
|
15877
15872
|
enqueueReplication(state, action.indexName, action);
|
|
15878
15873
|
}
|
|
15874
|
+
function recordMainWrite(state, action) {
|
|
15875
|
+
if (!("indexName" in action) || !copiesWillReceive(state, action.indexName)) return;
|
|
15876
|
+
queueForCopies(state, detachCallerDocuments(state, action));
|
|
15877
|
+
}
|
|
15878
|
+
function replicationRoomWait(state, indexName) {
|
|
15879
|
+
const loading2 = state.copyLoadBuffers.get(indexName);
|
|
15880
|
+
if (loading2 !== void 0) {
|
|
15881
|
+
const lastYield = state.copyLoadBufferYieldMarks.get(loading2) ?? 0;
|
|
15882
|
+
if (loading2.length - lastYield < LOAD_BUFFER_YIELD_INTERVAL) return null;
|
|
15883
|
+
state.copyLoadBufferYieldMarks.set(loading2, loading2.length);
|
|
15884
|
+
return yieldToEventLoop2();
|
|
15885
|
+
}
|
|
15886
|
+
const queue = state.replicationQueues.get(indexName);
|
|
15887
|
+
if (queue === void 0 || queue.pendingDocuments < MAX_PENDING_REPLICATION_DOCUMENTS) return null;
|
|
15888
|
+
return new Promise((resume) => queue.drainWaiters.push(resume));
|
|
15889
|
+
}
|
|
15879
15890
|
function settled(queue) {
|
|
15880
15891
|
return Promise.all([...queue.inFlight, queue.tail]).then(() => void 0);
|
|
15881
15892
|
}
|
|
@@ -15952,6 +15963,7 @@ function freezeLiveTail(state, indexName, manager, partitionId, floor) {
|
|
|
15952
15963
|
}
|
|
15953
15964
|
}
|
|
15954
15965
|
function flushGrownTails(state, indexName) {
|
|
15966
|
+
if (!state.scaledOutIndexes.has(indexName)) return;
|
|
15955
15967
|
const manager = state.executor.getManager(indexName);
|
|
15956
15968
|
if (manager === void 0) return;
|
|
15957
15969
|
for (let partitionId = 0; partitionId < manager.partitionCount; partitionId++) {
|
|
@@ -15974,25 +15986,10 @@ function mainCompositeOf(manager, partitionId) {
|
|
|
15974
15986
|
const partition = manager.getPartition(partitionId);
|
|
15975
15987
|
return isCompositePartition(partition) ? partition : null;
|
|
15976
15988
|
}
|
|
15977
|
-
function holdUnbroadcastSegments(state, indexName, segmentIds) {
|
|
15978
|
-
let held = state.unbroadcastSegments.get(indexName);
|
|
15979
|
-
if (held === void 0) {
|
|
15980
|
-
held = /* @__PURE__ */ new Set();
|
|
15981
|
-
state.unbroadcastSegments.set(indexName, held);
|
|
15982
|
-
}
|
|
15983
|
-
for (const segmentId of segmentIds) held.add(segmentId);
|
|
15984
|
-
}
|
|
15985
|
-
function releaseUnbroadcastSegments(state, indexName, segmentIds) {
|
|
15986
|
-
const held = state.unbroadcastSegments.get(indexName);
|
|
15987
|
-
if (held === void 0) return;
|
|
15988
|
-
for (const segmentId of segmentIds) held.delete(segmentId);
|
|
15989
|
-
if (held.size === 0) state.unbroadcastSegments.delete(indexName);
|
|
15990
|
-
}
|
|
15991
15989
|
function candidateSegmentIds(state, indexName, manager, partitionId, policy) {
|
|
15992
|
-
const unbroadcast = state.unbroadcastSegments.get(indexName);
|
|
15993
15990
|
const composite = mainCompositeOf(manager, partitionId);
|
|
15994
15991
|
if (composite !== null) {
|
|
15995
|
-
const sizes = composite.frozenSegmentSizes().
|
|
15992
|
+
const sizes = composite.frozenSegmentSizes().map((size) => ({ segmentId: size.segmentId, documentCount: size.liveDocumentCount }));
|
|
15996
15993
|
const picks = pickSegmentIds(sizes, policy);
|
|
15997
15994
|
if (picks !== null) return picks;
|
|
15998
15995
|
}
|
|
@@ -16026,6 +16023,17 @@ async function compactOnWorker(state, indexName, partitionId, segmentIds) {
|
|
|
16026
16023
|
lease.release();
|
|
16027
16024
|
}
|
|
16028
16025
|
}
|
|
16026
|
+
function ledgerHoldsAll(state, indexName, partitionId, segmentIds) {
|
|
16027
|
+
const entries = state.segmentLedger.get(indexName)?.get(partitionId);
|
|
16028
|
+
if (entries === void 0) return false;
|
|
16029
|
+
const held = new Set(entries.map((entry) => entry.segmentId));
|
|
16030
|
+
return segmentIds.every((segmentId) => held.has(segmentId));
|
|
16031
|
+
}
|
|
16032
|
+
function segmentsStillHeld(state, indexName, manager, partitionId, segmentIds, mergedOnMain) {
|
|
16033
|
+
if (state.executor.getManager(indexName) !== manager) return false;
|
|
16034
|
+
if (mergedOnMain === null) return ledgerHoldsAll(state, indexName, partitionId, segmentIds);
|
|
16035
|
+
return mainCompositeOf(manager, partitionId) === mergedOnMain && mainHoldsAll(mergedOnMain, segmentIds);
|
|
16036
|
+
}
|
|
16029
16037
|
function forgetLedgerSegments(state, indexName, partitionId, segmentIds) {
|
|
16030
16038
|
const entries = state.segmentLedger.get(indexName)?.get(partitionId);
|
|
16031
16039
|
if (entries === void 0) return;
|
|
@@ -16051,8 +16059,10 @@ async function compactPartitionSegments(state, indexName, manager, partitionId,
|
|
|
16051
16059
|
if (!mainCanMerge) forgetLedgerSegments(state, indexName, partitionId, segmentIds);
|
|
16052
16060
|
return false;
|
|
16053
16061
|
}
|
|
16054
|
-
const
|
|
16055
|
-
|
|
16062
|
+
const mergedOnMain = mainCanMerge ? composite : null;
|
|
16063
|
+
if (!segmentsStillHeld(state, indexName, manager, partitionId, segmentIds, mergedOnMain)) return false;
|
|
16064
|
+
const removedSpellings = mergedOnMain?.swapFrozenSegments(segmentIds, createSharedFrozenSegment(snapshot));
|
|
16065
|
+
recordMainWrite(state, {
|
|
16056
16066
|
type: "swapSegments",
|
|
16057
16067
|
indexName,
|
|
16058
16068
|
partitionId,
|
|
@@ -16094,19 +16104,34 @@ function maybeCompactSegments(state, indexName, policy = "ingest") {
|
|
|
16094
16104
|
});
|
|
16095
16105
|
state.compactionsInFlight.set(indexName, run);
|
|
16096
16106
|
}
|
|
16097
|
-
function
|
|
16098
|
-
cancelIdleMerge(state, indexName);
|
|
16107
|
+
function armIdleMerge(state, indexName, dueAt, delayMs) {
|
|
16099
16108
|
const timer = setTimeout(() => {
|
|
16109
|
+
const pending = state.idleMergeTimers.get(indexName);
|
|
16110
|
+
if (pending === void 0 || pending.timer !== timer) return;
|
|
16111
|
+
const remainingMs = pending.dueAt - Date.now();
|
|
16112
|
+
if (remainingMs > 0) {
|
|
16113
|
+
armIdleMerge(state, indexName, pending.dueAt, remainingMs);
|
|
16114
|
+
return;
|
|
16115
|
+
}
|
|
16100
16116
|
state.idleMergeTimers.delete(indexName);
|
|
16101
16117
|
maybeCompactSegments(state, indexName, "idle");
|
|
16102
|
-
},
|
|
16118
|
+
}, delayMs);
|
|
16103
16119
|
if (typeof timer.unref === "function") timer.unref();
|
|
16104
|
-
state.idleMergeTimers.set(indexName, timer);
|
|
16120
|
+
state.idleMergeTimers.set(indexName, { timer, dueAt });
|
|
16121
|
+
}
|
|
16122
|
+
function scheduleIdleMerge(state, indexName) {
|
|
16123
|
+
const dueAt = Date.now() + IDLE_MERGE_DELAY_MS;
|
|
16124
|
+
const pending = state.idleMergeTimers.get(indexName);
|
|
16125
|
+
if (pending !== void 0) {
|
|
16126
|
+
pending.dueAt = dueAt;
|
|
16127
|
+
return;
|
|
16128
|
+
}
|
|
16129
|
+
armIdleMerge(state, indexName, dueAt, IDLE_MERGE_DELAY_MS);
|
|
16105
16130
|
}
|
|
16106
16131
|
function cancelIdleMerge(state, indexName) {
|
|
16107
|
-
const
|
|
16108
|
-
if (
|
|
16109
|
-
clearTimeout(timer);
|
|
16132
|
+
const pending = state.idleMergeTimers.get(indexName);
|
|
16133
|
+
if (pending === void 0) return;
|
|
16134
|
+
clearTimeout(pending.timer);
|
|
16110
16135
|
state.idleMergeTimers.delete(indexName);
|
|
16111
16136
|
}
|
|
16112
16137
|
async function awaitCompactions(state) {
|
|
@@ -16858,13 +16883,13 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
|
|
|
16858
16883
|
desyncedIndexes: /* @__PURE__ */ new Set(),
|
|
16859
16884
|
copyReleaseHolds: /* @__PURE__ */ new Map(),
|
|
16860
16885
|
copyLoadBuffers: /* @__PURE__ */ new Map(),
|
|
16886
|
+
copyLoadBufferYieldMarks: /* @__PURE__ */ new WeakMap(),
|
|
16861
16887
|
copyTransitions: /* @__PURE__ */ new Map(),
|
|
16862
16888
|
droppedCopies: /* @__PURE__ */ new Map(),
|
|
16863
16889
|
lastAccessAt: /* @__PURE__ */ new Map(),
|
|
16864
16890
|
copyReloadCounts: /* @__PURE__ */ new Map(),
|
|
16865
16891
|
replicationQueues: /* @__PURE__ */ new Map(),
|
|
16866
16892
|
segmentLedger: /* @__PURE__ */ new Map(),
|
|
16867
|
-
unbroadcastSegments: /* @__PURE__ */ new Map(),
|
|
16868
16893
|
compactionsInFlight: /* @__PURE__ */ new Map(),
|
|
16869
16894
|
idleMergeTimers: /* @__PURE__ */ new Map(),
|
|
16870
16895
|
sharedVectorFields: /* @__PURE__ */ new Map(),
|
|
@@ -17019,7 +17044,6 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
|
|
|
17019
17044
|
state.lastAccessAt.delete(indexName);
|
|
17020
17045
|
state.replicationQueues.delete(indexName);
|
|
17021
17046
|
state.segmentLedger.delete(indexName);
|
|
17022
|
-
state.unbroadcastSegments.delete(indexName);
|
|
17023
17047
|
}
|
|
17024
17048
|
async function replicate(action) {
|
|
17025
17049
|
await replicateToWorkers(state, action);
|
|
@@ -17030,10 +17054,31 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
|
|
|
17030
17054
|
scheduleIdleMerge(state, action.indexName);
|
|
17031
17055
|
}
|
|
17032
17056
|
}
|
|
17057
|
+
function afterMainWrites(indexName, growth) {
|
|
17058
|
+
if (growth === "segments") maybeCompactSegments(state, indexName);
|
|
17059
|
+
if (growth === "liveTail") flushGrownTails(state, indexName);
|
|
17060
|
+
if (state.scaledOutIndexes.has(indexName) || state.copyLoadBuffers.has(indexName)) {
|
|
17061
|
+
scheduleIdleMerge(state, indexName);
|
|
17062
|
+
}
|
|
17063
|
+
}
|
|
17064
|
+
function copiesFollow(indexName) {
|
|
17065
|
+
return state.scaledOutIndexes.has(indexName) || state.copyLoadBuffers.has(indexName) || state.replicationQueues.has(indexName);
|
|
17066
|
+
}
|
|
17067
|
+
function settleMainWrites(indexName, growth = "liveTail") {
|
|
17068
|
+
if (growth !== "segments" && !copiesFollow(indexName)) return null;
|
|
17069
|
+
const waiting = replicationRoomWait(state, indexName);
|
|
17070
|
+
if (waiting === null) {
|
|
17071
|
+
afterMainWrites(indexName, growth);
|
|
17072
|
+
return null;
|
|
17073
|
+
}
|
|
17074
|
+
return waiting.then(() => afterMainWrites(indexName, growth));
|
|
17075
|
+
}
|
|
17033
17076
|
return {
|
|
17034
17077
|
scaleOutReadyIndexes: () => scaleOutReadyIndexes(state),
|
|
17035
17078
|
scaleOutBeforeBatch: (indexName, incomingCount) => scaleOutBeforeBatch(state, indexName, incomingCount),
|
|
17036
17079
|
replicateToWorkers: replicate,
|
|
17080
|
+
recordMainWrite: (action) => recordMainWrite(state, action),
|
|
17081
|
+
settleMainWrites,
|
|
17037
17082
|
awaitReplication: (indexName) => awaitReplicationIdle(state, indexName),
|
|
17038
17083
|
queueDiskAdoption: (action) => queueForCopies(state, action),
|
|
17039
17084
|
awaitWrites: (indexName) => awaitWritesApplied(state, indexName),
|
|
@@ -17043,8 +17088,6 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
|
|
|
17043
17088
|
isIndexBusy: (indexName) => isIndexBusy(state, indexName),
|
|
17044
17089
|
buildSegments: (requests) => buildSegments(state, requests),
|
|
17045
17090
|
segmentBuildConcurrency: (indexName) => segmentBuildConcurrency(state, indexName),
|
|
17046
|
-
holdUnbroadcastSegments: (indexName, segmentIds) => holdUnbroadcastSegments(state, indexName, segmentIds),
|
|
17047
|
-
releaseUnbroadcastSegments: (indexName, segmentIds) => releaseUnbroadcastSegments(state, indexName, segmentIds),
|
|
17048
17091
|
searchViaWorker: (indexName, params, globalStats, partitionIds, patternWork, bm25) => searchViaWorker(state, indexName, params, globalStats, partitionIds, patternWork, bm25),
|
|
17049
17092
|
hasWorkerPool: () => state.workerPool !== null,
|
|
17050
17093
|
mainCopyQueries: () => state.mainCopyQueries ?? "lone",
|
|
@@ -17067,11 +17110,11 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
|
|
|
17067
17110
|
if (hold === void 0) state.copyReleaseHolds.set(indexName, { holders: 1, reloads: false });
|
|
17068
17111
|
else hold.holders += 1;
|
|
17069
17112
|
state.desyncedIndexes.add(indexName);
|
|
17070
|
-
const { releaseIndexCopies } = await import('./release-
|
|
17113
|
+
const { releaseIndexCopies } = await import('./release-2SIHZWDO.mjs');
|
|
17071
17114
|
return releaseIndexCopies(state, indexName, copyReleaseSteps);
|
|
17072
17115
|
},
|
|
17073
17116
|
async endCopyRelease(indexName, reloads) {
|
|
17074
|
-
const { endCopyRelease } = await import('./release-
|
|
17117
|
+
const { endCopyRelease } = await import('./release-2SIHZWDO.mjs');
|
|
17075
17118
|
await endCopyRelease(state, indexName, reloads, copyReleaseSteps);
|
|
17076
17119
|
},
|
|
17077
17120
|
resyncIndex,
|
|
@@ -17120,12 +17163,13 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
|
|
|
17120
17163
|
if (config?.lifecycle !== void 0 && durabilityTier === null) {
|
|
17121
17164
|
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "Index lifecycle settings require durability");
|
|
17122
17165
|
}
|
|
17123
|
-
const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-
|
|
17166
|
+
const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-RN64S2TL.mjs');
|
|
17124
17167
|
const filesystemDurability = durabilityTier?.kind === "wal";
|
|
17125
17168
|
const executor = createDirectExecutor({
|
|
17126
17169
|
vectorWorkerCopies: vectorCopyPolicy,
|
|
17127
17170
|
vectorStorage: filesystemDurability ? "disk" : "memory",
|
|
17128
|
-
onVectorGraphRepaired: (indexName) => void durability?.manager.checkpointAfterInFlight(indexName)
|
|
17171
|
+
onVectorGraphRepaired: (indexName) => void durability?.manager.checkpointAfterInFlight(indexName),
|
|
17172
|
+
onDocumentWrite: (action) => orchestrator.recordMainWrite(action)
|
|
17129
17173
|
});
|
|
17130
17174
|
const pluginRegistry = createPluginRegistry();
|
|
17131
17175
|
if (config?.plugins) {
|
|
@@ -17264,7 +17308,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
|
|
|
17264
17308
|
reloadIndex: (indexName) => emitWriteEventAfter(
|
|
17265
17309
|
{ eventHandlers, mutationCtx },
|
|
17266
17310
|
indexName,
|
|
17267
|
-
|
|
17311
|
+
durabilityWiring?.reloadIndexAndCopies(orchestrator, durability, indexName) ?? Promise.resolve()
|
|
17268
17312
|
),
|
|
17269
17313
|
onError(error) {
|
|
17270
17314
|
if (emitEngineEvent(eventHandlers, "invalidationError", { error }) === 0) {
|
|
@@ -17306,7 +17350,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
|
|
|
17306
17350
|
requireManager,
|
|
17307
17351
|
resumeChange: async (indexName) => {
|
|
17308
17352
|
if ((indexRegistry.get(indexName)?.pendingAnalysis ?? null) === null) return;
|
|
17309
|
-
await (await import('./analysis-change-entry-
|
|
17353
|
+
await (await import('./analysis-change-entry-OC4XASBF.mjs')).resumeChangeOf(engineCore, indexName);
|
|
17310
17354
|
},
|
|
17311
17355
|
onClose: hooks?.onIndexClose,
|
|
17312
17356
|
onOpen: (indexName) => {
|
|
@@ -17394,7 +17438,7 @@ async function startEngineCore(core, config) {
|
|
|
17394
17438
|
checkHeapAfterRecovery(core);
|
|
17395
17439
|
}
|
|
17396
17440
|
if (core.invalidation) await core.invalidation.start();
|
|
17397
|
-
if (core.durability) await (await import('./analysis-change-entry-
|
|
17441
|
+
if (core.durability) await (await import('./analysis-change-entry-OC4XASBF.mjs')).resumeEveryChange(core);
|
|
17398
17442
|
if (config?.lifecycle === void 0) await core.analysisRebuild.reviewStaleIndexes();
|
|
17399
17443
|
} catch (err) {
|
|
17400
17444
|
await core.durability?.manager.shutdown().catch(() => void 0);
|
|
@@ -18678,7 +18722,7 @@ async function dropEngineIndex(core, name) {
|
|
|
18678
18722
|
const entry = core.requireIndex(name);
|
|
18679
18723
|
const changeRecorded = () => entry.pendingAnalysis !== null || entry.durableAnalysis !== null;
|
|
18680
18724
|
const abandonChange = async () => {
|
|
18681
|
-
await (await import('./analysis-change-entry-
|
|
18725
|
+
await (await import('./analysis-change-entry-OC4XASBF.mjs')).abandonChangeOf(core, name);
|
|
18682
18726
|
};
|
|
18683
18727
|
if (changeRecorded()) await abandonChange();
|
|
18684
18728
|
await core.indexState.drop(name, async () => {
|
|
@@ -19234,14 +19278,8 @@ async function insertDocument(ctx, indexName, document, docId, options) {
|
|
|
19234
19278
|
} catch (err) {
|
|
19235
19279
|
console.warn("afterInsert plugin hook error:", err instanceof Error ? err.message : String(err));
|
|
19236
19280
|
}
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
indexName,
|
|
19240
|
-
docId: resolvedDocId,
|
|
19241
|
-
document: partitionDoc,
|
|
19242
|
-
requestId: `replicate-insert-${resolvedDocId}`,
|
|
19243
|
-
skipClone: options?.skipClone
|
|
19244
|
-
});
|
|
19281
|
+
const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
|
|
19282
|
+
if (roomForCopies !== null) await roomForCopies;
|
|
19245
19283
|
for (const fieldPath of extractedVectors.keys()) {
|
|
19246
19284
|
const vecIndex = insertVecIndexes.get(fieldPath);
|
|
19247
19285
|
if (vecIndex) {
|
|
@@ -19452,6 +19490,8 @@ async function applyAdmittedDocuments(ctx, indexName, admitted, options, failed)
|
|
|
19452
19490
|
}
|
|
19453
19491
|
succeeded.push(doc.docId);
|
|
19454
19492
|
}
|
|
19493
|
+
const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
|
|
19494
|
+
if (roomForCopies !== null) await roomForCopies;
|
|
19455
19495
|
const applied = chunkStart + BATCH_CHUNK_SIZE;
|
|
19456
19496
|
if (applied < admitted.length) {
|
|
19457
19497
|
ctx.checkHeapPressure(indexName);
|
|
@@ -19496,75 +19536,34 @@ function buildSegmentRequests(indexName, docIds, documents, partitionCount, skip
|
|
|
19496
19536
|
}
|
|
19497
19537
|
return { requests, memberIndexes };
|
|
19498
19538
|
}
|
|
19499
|
-
function
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
const snapshot = segment.snapshot ?? (segment.payload === null ? null : freezeSegmentShared(segment.payload, segment.documents, segment.segmentId));
|
|
19503
|
-
if (snapshot === null) return null;
|
|
19504
|
-
frozen.push({ partitionId: segment.partitionId, snapshot });
|
|
19505
|
-
}
|
|
19506
|
-
return frozen;
|
|
19507
|
-
}
|
|
19508
|
-
function tryFreezeSegmentsForAttach(segments) {
|
|
19539
|
+
function sharedSnapshotOf(segment) {
|
|
19540
|
+
if (segment.snapshot !== null) return segment.snapshot;
|
|
19541
|
+
if (segment.payload === null) return null;
|
|
19509
19542
|
try {
|
|
19510
|
-
return
|
|
19543
|
+
return freezeSegmentShared(segment.payload, segment.documents, segment.segmentId);
|
|
19511
19544
|
} catch (err) {
|
|
19512
19545
|
console.warn("Segment freeze failed, replicating by merge instead:", err);
|
|
19513
19546
|
return null;
|
|
19514
19547
|
}
|
|
19515
19548
|
}
|
|
19516
|
-
function
|
|
19517
|
-
const
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
}
|
|
19525
|
-
function snapshotSegments(segments) {
|
|
19526
|
-
const shared = [];
|
|
19527
|
-
for (const segment of segments) {
|
|
19528
|
-
if (segment.snapshot !== null) shared.push({ partitionId: segment.partitionId, snapshot: segment.snapshot });
|
|
19529
|
-
}
|
|
19530
|
-
return shared;
|
|
19531
|
-
}
|
|
19532
|
-
function attachSegments2(orchestrator, indexName, segments) {
|
|
19533
|
-
return orchestrator.replicateToWorkers({
|
|
19534
|
-
type: "attachSegments",
|
|
19535
|
-
indexName,
|
|
19536
|
-
segments,
|
|
19537
|
-
requestId: `attach-segments-${indexName}-${segments.length}`
|
|
19538
|
-
});
|
|
19539
|
-
}
|
|
19540
|
-
async function broadcastBuiltSegments(orchestrator, indexName, segments, skipClone) {
|
|
19541
|
-
const frozen = tryFreezeSegmentsForAttach(segments);
|
|
19542
|
-
if (frozen !== null) {
|
|
19543
|
-
await attachSegments2(orchestrator, indexName, frozen);
|
|
19544
|
-
return;
|
|
19549
|
+
function copyActionOfSegment(indexName, segment, skipClone) {
|
|
19550
|
+
const snapshot = sharedSnapshotOf(segment);
|
|
19551
|
+
if (snapshot !== null) {
|
|
19552
|
+
return {
|
|
19553
|
+
type: "attachSegments",
|
|
19554
|
+
indexName,
|
|
19555
|
+
segments: [{ partitionId: segment.partitionId, snapshot }],
|
|
19556
|
+
requestId: `attach-segments-${indexName}-${segment.segmentId}`
|
|
19557
|
+
};
|
|
19545
19558
|
}
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
const plain = payloadSegments(segments);
|
|
19549
|
-
if (plain.length === 0) return;
|
|
19550
|
-
await orchestrator.replicateToWorkers({
|
|
19559
|
+
if (segment.payload === null) return null;
|
|
19560
|
+
return {
|
|
19551
19561
|
type: "mergeSegments",
|
|
19552
19562
|
indexName,
|
|
19553
|
-
segments:
|
|
19554
|
-
requestId: `merge-segments-${indexName}-${
|
|
19563
|
+
segments: [{ partitionId: segment.partitionId, payload: segment.payload, documents: segment.documents }],
|
|
19564
|
+
requestId: `merge-segments-${indexName}-${segment.segmentId}`,
|
|
19555
19565
|
skipClone: skipClone === true ? true : void 0
|
|
19556
|
-
}
|
|
19557
|
-
}
|
|
19558
|
-
async function replicateAsSegments(ctx, indexName, docIds, documents, skipClone) {
|
|
19559
|
-
if (docIds.length < MIN_DOCUMENTS_FOR_SEGMENTS) return false;
|
|
19560
|
-
const workers = ctx.orchestrator.segmentBuildConcurrency(indexName);
|
|
19561
|
-
if (workers <= 0) return false;
|
|
19562
|
-
const manager = ctx.requireManager(indexName);
|
|
19563
|
-
const { requests } = buildSegmentRequests(indexName, docIds, documents, manager.partitionCount, skipClone);
|
|
19564
|
-
const built = await ctx.orchestrator.buildSegments(requests);
|
|
19565
|
-
if (built === null || built.length === 0) return false;
|
|
19566
|
-
await broadcastBuiltSegments(ctx.orchestrator, indexName, built, skipClone);
|
|
19567
|
-
return true;
|
|
19566
|
+
};
|
|
19568
19567
|
}
|
|
19569
19568
|
|
|
19570
19569
|
// src/engine/mutations/insert-batch-segments.ts
|
|
@@ -19572,26 +19571,11 @@ function mainStoreDocument(doc, options) {
|
|
|
19572
19571
|
if (doc.extractedVectors.size > 0 || options?.skipClone === true) return doc.partitionDoc;
|
|
19573
19572
|
return structuredClone(doc.partitionDoc);
|
|
19574
19573
|
}
|
|
19575
|
-
async function replicateDocuments(ctx, indexName, docs, options) {
|
|
19576
|
-
for (const doc of docs) {
|
|
19577
|
-
await ctx.orchestrator.replicateToWorkers({
|
|
19578
|
-
type: "insert",
|
|
19579
|
-
indexName,
|
|
19580
|
-
docId: doc.docId,
|
|
19581
|
-
document: doc.partitionDoc,
|
|
19582
|
-
requestId: `replicate-insert-${doc.docId}`,
|
|
19583
|
-
skipClone: options?.skipClone
|
|
19584
|
-
});
|
|
19585
|
-
}
|
|
19586
|
-
}
|
|
19587
19574
|
async function applyIndividually(ctx, indexName, admitted, options, failed) {
|
|
19588
19575
|
const applied = await applyAdmittedDocuments(ctx, indexName, admitted, options, failed);
|
|
19589
|
-
const succeededIds = new Set(applied.succeeded);
|
|
19590
|
-
const replicable = admitted.filter((doc) => succeededIds.has(doc.docId) && !applied.buffered.has(doc.docId));
|
|
19591
|
-
await replicateDocuments(ctx, indexName, replicable, options);
|
|
19592
19576
|
return { succeeded: applied.succeeded, touchedVectorFields: applied.touchedVectorFields };
|
|
19593
19577
|
}
|
|
19594
|
-
function attachOnce(manager, attachment) {
|
|
19578
|
+
function attachOnce(ctx, manager, attachment) {
|
|
19595
19579
|
if (attachment.failure !== void 0) throw attachment.failure;
|
|
19596
19580
|
if (attachment.attached) return;
|
|
19597
19581
|
try {
|
|
@@ -19603,11 +19587,12 @@ function attachOnce(manager, attachment) {
|
|
|
19603
19587
|
attachment.failure = error;
|
|
19604
19588
|
throw error;
|
|
19605
19589
|
}
|
|
19590
|
+
if (attachment.copyAction !== null) ctx.orchestrator.recordMainWrite(attachment.copyAction);
|
|
19606
19591
|
}
|
|
19607
19592
|
function applyOfMergedDocument(ctx, indexName, doc, attachment, progress) {
|
|
19608
19593
|
const manager = ctx.requireManager(indexName);
|
|
19609
19594
|
const attachToIndex = async () => {
|
|
19610
|
-
attachOnce(manager, attachment);
|
|
19595
|
+
attachOnce(ctx, manager, attachment);
|
|
19611
19596
|
progress.applied = true;
|
|
19612
19597
|
try {
|
|
19613
19598
|
insertDocumentVectors(
|
|
@@ -19631,13 +19616,14 @@ function applyOfMergedDocument(ctx, indexName, doc, attachment, progress) {
|
|
|
19631
19616
|
};
|
|
19632
19617
|
return indexChangeOutsideExternalWaits(attachToIndex);
|
|
19633
19618
|
}
|
|
19634
|
-
function chunksOfWholeSegments(built, frozen, memberIndexes, admitted) {
|
|
19619
|
+
function chunksOfWholeSegments(indexName, built, frozen, memberIndexes, admitted, options) {
|
|
19635
19620
|
const chunks = [];
|
|
19636
19621
|
let chunk = { docs: [], attachmentOf: /* @__PURE__ */ new Map() };
|
|
19637
19622
|
for (let i = 0; i < built.length; i++) {
|
|
19638
19623
|
const attachment = {
|
|
19639
19624
|
partitionId: built[i].partitionId,
|
|
19640
19625
|
segments: [frozen[i]],
|
|
19626
|
+
copyAction: copyActionOfSegment(indexName, built[i], options?.skipClone),
|
|
19641
19627
|
attached: false,
|
|
19642
19628
|
failure: void 0
|
|
19643
19629
|
};
|
|
@@ -19654,12 +19640,12 @@ function chunksOfWholeSegments(built, frozen, memberIndexes, admitted) {
|
|
|
19654
19640
|
if (chunk.docs.length > 0) chunks.push(chunk);
|
|
19655
19641
|
return chunks;
|
|
19656
19642
|
}
|
|
19657
|
-
async function recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, failed) {
|
|
19643
|
+
async function recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, options, failed) {
|
|
19658
19644
|
const hasAfterHook = ctx.pluginRegistry.hasHooks("afterInsert");
|
|
19659
19645
|
const succeededIds = /* @__PURE__ */ new Set();
|
|
19660
19646
|
const errorOf = /* @__PURE__ */ new Map();
|
|
19661
19647
|
const touchedVectorFields = /* @__PURE__ */ new Set();
|
|
19662
|
-
const chunks = chunksOfWholeSegments(built, frozen, memberIndexes, admitted);
|
|
19648
|
+
const chunks = chunksOfWholeSegments(indexName, built, frozen, memberIndexes, admitted, options);
|
|
19663
19649
|
for (let index = 0; index < chunks.length; index++) {
|
|
19664
19650
|
const { docs, attachmentOf } = chunks[index];
|
|
19665
19651
|
const progress = docs.map(() => ({ applied: false }));
|
|
@@ -19694,40 +19680,23 @@ async function recordMergedDocuments(ctx, indexName, built, frozen, memberIndexe
|
|
|
19694
19680
|
}
|
|
19695
19681
|
succeededIds.add(doc.docId);
|
|
19696
19682
|
}
|
|
19683
|
+
const roomForCopies = ctx.orchestrator.settleMainWrites(indexName, "segments");
|
|
19684
|
+
if (roomForCopies !== null) await roomForCopies;
|
|
19697
19685
|
if (index + 1 < chunks.length) {
|
|
19698
19686
|
ctx.checkHeapPressure(indexName);
|
|
19699
19687
|
await new Promise((r) => setTimeout(r, 0));
|
|
19700
19688
|
}
|
|
19701
19689
|
}
|
|
19702
19690
|
const succeeded = [];
|
|
19703
|
-
const failedDocIds = /* @__PURE__ */ new Set();
|
|
19704
19691
|
for (const doc of admitted) {
|
|
19705
19692
|
if (succeededIds.has(doc.docId)) {
|
|
19706
19693
|
succeeded.push(doc.docId);
|
|
19707
19694
|
continue;
|
|
19708
19695
|
}
|
|
19709
19696
|
if (!errorOf.has(doc.docId)) continue;
|
|
19710
|
-
failedDocIds.add(doc.docId);
|
|
19711
19697
|
failed.push({ docId: doc.docId, error: asBatchInsertError(errorOf.get(doc.docId)) });
|
|
19712
19698
|
}
|
|
19713
|
-
return { succeeded, touchedVectorFields
|
|
19714
|
-
}
|
|
19715
|
-
async function broadcastSegments(ctx, indexName, built, memberIndexes, admitted, failedDocIds, options) {
|
|
19716
|
-
const clean = [];
|
|
19717
|
-
const retryDocs = [];
|
|
19718
|
-
for (let i = 0; i < built.length; i++) {
|
|
19719
|
-
const members = memberIndexes[i].map((m) => admitted[m]);
|
|
19720
|
-
if (members.some((doc) => failedDocIds.has(doc.docId))) {
|
|
19721
|
-
retryDocs.push(...members.filter((doc) => !failedDocIds.has(doc.docId)));
|
|
19722
|
-
continue;
|
|
19723
|
-
}
|
|
19724
|
-
clean.push(built[i]);
|
|
19725
|
-
}
|
|
19726
|
-
if (clean.length > 0) {
|
|
19727
|
-
await broadcastBuiltSegments(ctx.orchestrator, indexName, clean, options?.skipClone);
|
|
19728
|
-
}
|
|
19729
|
-
await replicateDocuments(ctx, indexName, retryDocs, options);
|
|
19730
|
-
return clean.map((segment) => segment.segmentId);
|
|
19699
|
+
return { succeeded, touchedVectorFields };
|
|
19731
19700
|
}
|
|
19732
19701
|
function frozenSegmentOf(segment, members, options) {
|
|
19733
19702
|
if (segment.snapshot !== null) return createSharedFrozenSegment(segment.snapshot);
|
|
@@ -19781,20 +19750,7 @@ async function ingestAdmitted(ctx, indexName, admitted, options, failed) {
|
|
|
19781
19750
|
for (const doc of admitted) {
|
|
19782
19751
|
if (manager.has(doc.docId)) return applyIndividually(ctx, indexName, admitted, options, failed);
|
|
19783
19752
|
}
|
|
19784
|
-
|
|
19785
|
-
ctx.orchestrator.holdUnbroadcastSegments(indexName, segmentIds);
|
|
19786
|
-
const recorded = await recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, failed);
|
|
19787
|
-
const broadcast = await broadcastSegments(
|
|
19788
|
-
ctx,
|
|
19789
|
-
indexName,
|
|
19790
|
-
built,
|
|
19791
|
-
memberIndexes,
|
|
19792
|
-
admitted,
|
|
19793
|
-
recorded.failedDocIds,
|
|
19794
|
-
options
|
|
19795
|
-
);
|
|
19796
|
-
ctx.orchestrator.releaseUnbroadcastSegments(indexName, broadcast);
|
|
19797
|
-
return { succeeded: recorded.succeeded, touchedVectorFields: recorded.touchedVectorFields };
|
|
19753
|
+
return recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, options, failed);
|
|
19798
19754
|
}
|
|
19799
19755
|
async function insertBatchViaSegments(ctx, indexName, documents, options) {
|
|
19800
19756
|
const failed = [];
|
|
@@ -19822,7 +19778,6 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
|
|
|
19822
19778
|
return insertBatchViaSegments(ctx, indexName, documents, options);
|
|
19823
19779
|
}
|
|
19824
19780
|
const succeeded = [];
|
|
19825
|
-
const succeededDocs = [];
|
|
19826
19781
|
const failed = [];
|
|
19827
19782
|
const hasBeforeHook = ctx.pluginRegistry.hasHooks("beforeInsert");
|
|
19828
19783
|
const hasAfterHook = ctx.pluginRegistry.hasHooks("afterInsert");
|
|
@@ -19831,7 +19786,6 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
|
|
|
19831
19786
|
const batchVecIndexes = batchManager.getVectorIndexes();
|
|
19832
19787
|
const batchVectorFieldPaths = batchVecIndexes.size > 0 ? entry.vectorFieldPaths : /* @__PURE__ */ new Set();
|
|
19833
19788
|
const touchedVectorFields = /* @__PURE__ */ new Set();
|
|
19834
|
-
const bufferedDocIds = /* @__PURE__ */ new Set();
|
|
19835
19789
|
for (let chunkStart = 0; chunkStart < documents.length; chunkStart += BATCH_CHUNK_SIZE) {
|
|
19836
19790
|
if (ctx.abortController.signal.aborted) break;
|
|
19837
19791
|
const chunkEnd = Math.min(chunkStart + BATCH_CHUNK_SIZE, documents.length);
|
|
@@ -19859,9 +19813,7 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
|
|
|
19859
19813
|
continue;
|
|
19860
19814
|
}
|
|
19861
19815
|
if (application.status === "buffered") {
|
|
19862
|
-
bufferedDocIds.add(doc.docId);
|
|
19863
19816
|
succeeded.push(doc.docId);
|
|
19864
|
-
succeededDocs.push(doc.partitionDoc);
|
|
19865
19817
|
continue;
|
|
19866
19818
|
}
|
|
19867
19819
|
for (const fieldPath of doc.extractedVectors.keys()) {
|
|
@@ -19875,7 +19827,6 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
|
|
|
19875
19827
|
}
|
|
19876
19828
|
}
|
|
19877
19829
|
succeeded.push(doc.docId);
|
|
19878
|
-
succeededDocs.push(doc.partitionDoc);
|
|
19879
19830
|
}
|
|
19880
19831
|
}
|
|
19881
19832
|
const prepared = [];
|
|
@@ -19909,32 +19860,13 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
|
|
|
19909
19860
|
}
|
|
19910
19861
|
}
|
|
19911
19862
|
if (prepared.length > 0) await applyPrepared(prepared);
|
|
19863
|
+
const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
|
|
19864
|
+
if (roomForCopies !== null) await roomForCopies;
|
|
19912
19865
|
if (chunkEnd < documents.length) {
|
|
19913
19866
|
ctx.checkHeapPressure(indexName);
|
|
19914
19867
|
await new Promise((r) => setTimeout(r, 0));
|
|
19915
19868
|
}
|
|
19916
19869
|
}
|
|
19917
|
-
const replicableIds = [];
|
|
19918
|
-
const replicableDocs = [];
|
|
19919
|
-
for (let i = 0; i < succeeded.length; i++) {
|
|
19920
|
-
if (bufferedDocIds.has(succeeded[i])) continue;
|
|
19921
|
-
replicableIds.push(succeeded[i]);
|
|
19922
|
-
replicableDocs.push(succeededDocs[i]);
|
|
19923
|
-
}
|
|
19924
|
-
const replicatedAsSegments = copiesBuildSegments && await replicateAsSegments(ctx, indexName, replicableIds, replicableDocs, options?.skipClone);
|
|
19925
|
-
if (!replicatedAsSegments) {
|
|
19926
|
-
for (let i = 0; i < replicableIds.length; i++) {
|
|
19927
|
-
if (turnsAreBudgeted && turnIsSpent()) await yieldTurn();
|
|
19928
|
-
await ctx.orchestrator.replicateToWorkers({
|
|
19929
|
-
type: "insert",
|
|
19930
|
-
indexName,
|
|
19931
|
-
docId: replicableIds[i],
|
|
19932
|
-
document: replicableDocs[i],
|
|
19933
|
-
requestId: `replicate-insert-${replicableIds[i]}`,
|
|
19934
|
-
skipClone: options?.skipClone
|
|
19935
|
-
});
|
|
19936
|
-
}
|
|
19937
|
-
}
|
|
19938
19870
|
for (const fieldPath of touchedVectorFields) {
|
|
19939
19871
|
const vecIndex = batchVecIndexes.get(fieldPath);
|
|
19940
19872
|
if (vecIndex) {
|
|
@@ -19990,19 +19922,14 @@ function applyOfRemoval(ctx, indexName, prepared) {
|
|
|
19990
19922
|
return indexChangeOutsideExternalWaits(removeFromIndex);
|
|
19991
19923
|
}
|
|
19992
19924
|
async function settleRemoval(ctx, indexName, prepared) {
|
|
19993
|
-
const { docId
|
|
19925
|
+
const { docId } = prepared;
|
|
19994
19926
|
try {
|
|
19995
19927
|
await ctx.pluginRegistry.runHook("afterRemove", { indexName, docId });
|
|
19996
19928
|
} catch (err) {
|
|
19997
19929
|
console.warn("afterRemove plugin hook error:", err instanceof Error ? err.message : String(err));
|
|
19998
19930
|
}
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
indexName,
|
|
20002
|
-
docId,
|
|
20003
|
-
requestId: `replicate-remove-${docId}`,
|
|
20004
|
-
removedSpellings
|
|
20005
|
-
});
|
|
19931
|
+
const roomForCopies = ctx.orchestrator.settleMainWrites(indexName, "none");
|
|
19932
|
+
if (roomForCopies !== null) await roomForCopies;
|
|
20006
19933
|
}
|
|
20007
19934
|
async function removeDocument(ctx, indexName, docId, options) {
|
|
20008
19935
|
ctx.guardShutdown();
|
|
@@ -20100,14 +20027,8 @@ async function settleUpdate(ctx, indexName, prepared) {
|
|
|
20100
20027
|
} catch (err) {
|
|
20101
20028
|
console.warn("afterUpdate plugin hook error:", err instanceof Error ? err.message : String(err));
|
|
20102
20029
|
}
|
|
20103
|
-
|
|
20104
|
-
|
|
20105
|
-
indexName,
|
|
20106
|
-
docId: prepared.docId,
|
|
20107
|
-
document: prepared.partitionDoc,
|
|
20108
|
-
requestId: `replicate-update-${prepared.docId}`,
|
|
20109
|
-
removedSpellings: prepared.removedSpellings
|
|
20110
|
-
});
|
|
20030
|
+
const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
|
|
20031
|
+
if (roomForCopies !== null) await roomForCopies;
|
|
20111
20032
|
const vecIndexes = ctx.requireManager(indexName).getVectorIndexes();
|
|
20112
20033
|
for (const [fieldPath, vec] of prepared.extractedVectors) {
|
|
20113
20034
|
if (vec === null) continue;
|
|
@@ -20454,7 +20375,6 @@ async function withRenewedSyncEpoch(core, indexName, change) {
|
|
|
20454
20375
|
function clearEngineIndex(core, indexName) {
|
|
20455
20376
|
return withRenewedSyncEpoch(core, indexName, async () => {
|
|
20456
20377
|
await core.executor.execute({ type: "clear", indexName, requestId: indexName });
|
|
20457
|
-
await core.orchestrator.replicateToWorkers({ type: "clear", indexName, requestId: `replicate-clear-${indexName}` });
|
|
20458
20378
|
core.watermarkNotifier.forget(indexName);
|
|
20459
20379
|
const durable = core.durability?.manager;
|
|
20460
20380
|
await (durable?.checkpointFromMemory?.(indexName) ?? durable?.checkpoint(indexName));
|
|
@@ -20551,7 +20471,7 @@ function portabilityOperations(core, config, engine) {
|
|
|
20551
20471
|
const { restoresInFlight } = core;
|
|
20552
20472
|
const previous = restoresInFlight.get(indexName) ?? Promise.resolve();
|
|
20553
20473
|
const restored = previous.then(async () => {
|
|
20554
|
-
const { runRestore } = await import('./restore-queue-
|
|
20474
|
+
const { runRestore } = await import('./restore-queue-4R6AASE5.mjs');
|
|
20555
20475
|
await runRestore(core, restoreHost, indexName, data, engine());
|
|
20556
20476
|
});
|
|
20557
20477
|
const settled2 = restored.then(
|
|
@@ -20582,7 +20502,7 @@ function portabilityOperations(core, config, engine) {
|
|
|
20582
20502
|
return {
|
|
20583
20503
|
snapshot(indexName, options) {
|
|
20584
20504
|
return withOpenIndex2(indexName, async () => {
|
|
20585
|
-
const { createSnapshot } = await import('./snapshot-
|
|
20505
|
+
const { createSnapshot } = await import('./snapshot-5LGPQXFS.mjs');
|
|
20586
20506
|
return createSnapshot(snapshotDepsOf(indexName), options?.queryHistory === true ? core : null);
|
|
20587
20507
|
});
|
|
20588
20508
|
},
|
|
@@ -20595,8 +20515,8 @@ function portabilityOperations(core, config, engine) {
|
|
|
20595
20515
|
exportDocuments(indexName) {
|
|
20596
20516
|
return withOpenIndex2(indexName, async () => {
|
|
20597
20517
|
const [{ checkpointForArchive }, { documentExportStream }] = await Promise.all([
|
|
20598
|
-
import('./snapshot-
|
|
20599
|
-
import('./write-
|
|
20518
|
+
import('./snapshot-5LGPQXFS.mjs'),
|
|
20519
|
+
import('./write-6BRYIIZ7.mjs')
|
|
20600
20520
|
]);
|
|
20601
20521
|
const header = indexConfigurationOf(core.requireIndex(indexName));
|
|
20602
20522
|
return documentExportStream(header, await checkpointForArchive(snapshotDepsOf(indexName)));
|
|
@@ -20604,7 +20524,7 @@ function portabilityOperations(core, config, engine) {
|
|
|
20604
20524
|
},
|
|
20605
20525
|
importDocumentExport(indexName, data) {
|
|
20606
20526
|
core.guardShutdown();
|
|
20607
|
-
const imported = import('./import-
|
|
20527
|
+
const imported = import('./import-5UAWBRJP.mjs').then(
|
|
20608
20528
|
({ readDocumentExport }) => readDocumentExport(engine(), indexName, data)
|
|
20609
20529
|
);
|
|
20610
20530
|
return emitWriteEventAfter(core, indexName, imported);
|
|
@@ -22625,7 +22545,7 @@ function createNarsilFromCore(core, config) {
|
|
|
22625
22545
|
const entry = requireIndex(indexName);
|
|
22626
22546
|
await withOpenIndexWrite(indexName, async () => {
|
|
22627
22547
|
if (entry.pendingAnalysis === null) return core.analysisRebuild.rebuild(indexName);
|
|
22628
|
-
return (await import('./analysis-change-
|
|
22548
|
+
return (await import('./analysis-change-QUVDNABS.mjs')).resumeAnalysisChange(core, indexName);
|
|
22629
22549
|
});
|
|
22630
22550
|
},
|
|
22631
22551
|
async changeAnalysis(indexName, change) {
|
|
@@ -22633,7 +22553,7 @@ function createNarsilFromCore(core, config) {
|
|
|
22633
22553
|
requireIndex(indexName);
|
|
22634
22554
|
const changed = withOpenIndex2(
|
|
22635
22555
|
indexName,
|
|
22636
|
-
async () => (await import('./analysis-change-
|
|
22556
|
+
async () => (await import('./analysis-change-QUVDNABS.mjs')).changeIndexAnalysis(core, indexName, change)
|
|
22637
22557
|
);
|
|
22638
22558
|
await emitWriteEventAfter(core, indexName, changed);
|
|
22639
22559
|
},
|
|
@@ -22668,7 +22588,7 @@ function createNarsilFromCore(core, config) {
|
|
|
22668
22588
|
const rebalanced = withOpenIndex2(
|
|
22669
22589
|
indexName,
|
|
22670
22590
|
() => withRenewedSyncEpoch(core, indexName, async () => {
|
|
22671
|
-
const { executeRebalance } = await import('./analysis-change-
|
|
22591
|
+
const { executeRebalance } = await import('./analysis-change-QUVDNABS.mjs');
|
|
22672
22592
|
const running = executeRebalance(requireManager(indexName), indexName, targetPartitionCount, rebalanceCtx);
|
|
22673
22593
|
releaseWrites();
|
|
22674
22594
|
await running;
|
|
@@ -22792,7 +22712,7 @@ async function createNarsil(config) {
|
|
|
22792
22712
|
await startEngineCore(core, runnableConfig);
|
|
22793
22713
|
const engine = createNarsilFromCore(core, runnableConfig);
|
|
22794
22714
|
if (runnableConfig?.querySuggestions !== void 0 || core.durability !== null) {
|
|
22795
|
-
await (await import('./engine-hooks-
|
|
22715
|
+
await (await import('./engine-hooks-CWA5CKCA.mjs')).startQuerySuggestions(core, engine, runnableConfig);
|
|
22796
22716
|
}
|
|
22797
22717
|
return engine;
|
|
22798
22718
|
}
|