@delali/narsil 0.3.1-next.145 → 0.3.1-next.146
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/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/analysis-change-ZCJNYBJM.mjs +39 -0
- package/dist/{analysis-change-entry-V4SQQSXQ.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
- package/dist/browser/{analysis-change-QTCQ5ETU.mjs → analysis-change-M65AZQQG.mjs} +8 -5
- package/dist/browser/{analysis-change-entry-KYEQSP3I.mjs → analysis-change-entry-H3YIOLXZ.mjs} +1 -1
- package/dist/browser/{chunk-GP4QLUQM.mjs → chunk-2JABMB4S.mjs} +10 -6
- package/dist/browser/{chunk-5WYWLTM5.mjs → chunk-4DYLCICG.mjs} +2 -2
- package/dist/browser/{chunk-75PMIFQA.mjs → chunk-4RD3AFSB.mjs} +1 -1
- package/dist/browser/{chunk-XWMEGKDC.mjs → chunk-5V74FFZE.mjs} +2 -2
- package/dist/browser/{chunk-PMBSBSCN.mjs → chunk-6OWX3OP2.mjs} +2 -2
- package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
- package/dist/browser/{chunk-ZALEKEUH.mjs → chunk-BVX2MEHA.mjs} +306 -607
- package/dist/browser/{chunk-FXPMF65P.mjs → chunk-D6UFGBF5.mjs} +15 -45
- package/dist/browser/{chunk-QNDWMPV2.mjs → chunk-IAXZAVYL.mjs} +25 -66
- package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
- package/dist/browser/{chunk-BTMRV5MY.mjs → chunk-KAEVGLYN.mjs} +2 -2
- package/dist/browser/{chunk-FHO5N7FD.mjs → chunk-LURXVCHG.mjs} +1 -1
- package/dist/browser/chunk-MPK76GVS.mjs +63 -0
- package/dist/browser/{chunk-6OFS7RUN.mjs → chunk-NVEJJP4R.mjs} +1 -1
- package/dist/browser/{chunk-U77XQJOY.mjs → chunk-ODQP7P3H.mjs} +455 -66
- package/dist/browser/{chunk-IFGTRRPU.mjs → chunk-PIS7ZAP7.mjs} +3 -25
- package/dist/browser/{chunk-XIHLIMFX.mjs → chunk-QMNZFFD3.mjs} +4 -3
- package/dist/browser/{chunk-AOKLYVTT.mjs → chunk-SRL47USS.mjs} +2 -2
- package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
- package/dist/browser/{chunk-LGJ6XMH5.mjs → chunk-W643QV3L.mjs} +6 -5
- package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
- package/dist/browser/{chunk-ZKVDQ5ZH.mjs → chunk-XILIT5MT.mjs} +8 -8
- package/dist/browser/{cold-module-Y2IJAP7S.mjs → cold-module-A5S6JFDN.mjs} +20 -20
- package/dist/browser/{durability-wiring-MLXZ5QQF.mjs → durability-wiring-W5AVV3RF.mjs} +53 -30
- package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
- package/dist/browser/import-PTT63AGK.mjs +12 -0
- package/dist/browser/{module-5LMDGXQH.mjs → module-CEKA7MQH.mjs} +13 -10
- package/dist/browser/module-X5PGOE47.mjs +4288 -0
- package/dist/browser/{phrase-module-KXNRTWCS.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
- package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
- package/dist/{restore-queue-UAVGBSJG.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
- package/dist/browser/{runtime-ZNEGK33G.mjs → runtime-D2ULZGCN.mjs} +3 -2
- package/dist/browser/{snapshot-2EGS2FYU.mjs → snapshot-DQ6A4PQP.mjs} +18 -14
- package/dist/browser/{write-WMZA6NSF.mjs → write-MAGRAIEH.mjs} +14 -11
- package/dist/{capabilities-CNnzGtqP.d.ts → capabilities-BT-HLDC8.d.ts} +2 -2
- package/dist/{chunk-FRJ5RGX7.mjs → chunk-2HJWQPR6.mjs} +2 -2
- package/dist/{chunk-DKMZ7JFW.mjs → chunk-3BVGJ4JR.mjs} +10 -4
- package/dist/{chunk-QYMAYU7M.mjs → chunk-3HV7M5OJ.mjs} +155 -149
- package/dist/chunk-3MXV3VHR.mjs +46 -0
- package/dist/{chunk-6FOJKNUR.mjs → chunk-3SBJVQLL.mjs} +2 -2
- package/dist/{chunk-PRID7CA6.mjs → chunk-3TVDTACC.mjs} +1 -1
- package/dist/{chunk-RTVAWNUL.mjs → chunk-5WB2A3XU.mjs} +9 -6
- package/dist/{chunk-LWFK3TC2.mjs → chunk-65WCV5JO.mjs} +1 -1
- package/dist/{chunk-G6Q5DEF5.mjs → chunk-6BWLDLS3.mjs} +3 -46
- package/dist/{chunk-W6M4RRAT.mjs → chunk-6C5EX2QR.mjs} +3 -3
- package/dist/{chunk-HOC5JP2H.mjs → chunk-6F6USYII.mjs} +119 -11
- package/dist/{chunk-7523VCM4.mjs → chunk-7HKWO4BJ.mjs} +7 -7
- package/dist/{chunk-ONDEEBTA.mjs → chunk-7N223GWV.mjs} +2 -2
- package/dist/{chunk-UGQULMSU.mjs → chunk-ADBS5XRI.mjs} +10 -10
- package/dist/{chunk-MJTEU2XK.mjs → chunk-AWNHDBKV.mjs} +429 -73
- package/dist/{chunk-2E2ZFOPT.mjs → chunk-B2FTZNNF.mjs} +2 -2
- package/dist/{chunk-NWTEJ2T7.mjs → chunk-B7XIOAMK.mjs} +3 -3
- package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
- package/dist/chunk-BTPGQC6Z.mjs +27 -0
- package/dist/{chunk-KG5N7LE6.mjs → chunk-CYYSZPVV.mjs} +11 -11
- package/dist/{chunk-HTMUGEFU.mjs → chunk-DOY6EG76.mjs} +6 -6
- package/dist/{chunk-UHVTEVF5.mjs → chunk-F22IOCR2.mjs} +10 -6
- package/dist/{chunk-FTQLF5JI.mjs → chunk-IRWP524D.mjs} +1 -1
- package/dist/{chunk-XLAI4OIO.mjs → chunk-IZT3G24Q.mjs} +2 -2
- package/dist/{chunk-SE7MKJVK.mjs → chunk-J7M73VY7.mjs} +1 -1
- package/dist/chunk-KAKQ74LS.mjs +53 -0
- package/dist/{chunk-GVPYMSLO.mjs → chunk-KYVRZAYP.mjs} +1 -1
- package/dist/{chunk-F442VZUL.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
- package/dist/{chunk-WDEWU46C.mjs → chunk-KZQIVGW7.mjs} +2 -2
- package/dist/{chunk-7AJAW6NN.mjs → chunk-L7TIAYPX.mjs} +8 -8
- package/dist/{chunk-GRFXSEFF.mjs → chunk-LDGGR7YT.mjs} +4 -81
- package/dist/{chunk-WMIV7PJ7.mjs → chunk-LJ4ENXOD.mjs} +15 -14
- package/dist/chunk-LQG5G2LY.mjs +39 -0
- package/dist/{chunk-IQHZMCLX.mjs → chunk-MDF6PDIA.mjs} +2 -0
- package/dist/{chunk-QXH2CS4V.mjs → chunk-NVTFQFUL.mjs} +7 -26
- package/dist/{chunk-5K2JHKM3.mjs → chunk-NYSONUB7.mjs} +1 -1
- package/dist/{chunk-OH7SX5MY.mjs → chunk-O4KUNDVF.mjs} +12 -10
- package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
- package/dist/{chunk-RNUP6WZ6.mjs → chunk-QEYF2SQ6.mjs} +2 -2
- package/dist/{chunk-RVBUQITB.mjs → chunk-QN5WVV5K.mjs} +7 -7
- package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
- package/dist/{chunk-BTARFTEN.mjs → chunk-SOUZMPME.mjs} +4 -4
- package/dist/{chunk-ISUOSACK.mjs → chunk-T4CJDBBE.mjs} +1 -1
- package/dist/{chunk-DHEJAGVW.mjs → chunk-TTCKT2RT.mjs} +5 -5
- package/dist/{chunk-QU2XF7VI.mjs → chunk-U2726TL5.mjs} +5 -4
- package/dist/{chunk-LYKUJNAV.mjs → chunk-U46IZNCW.mjs} +2 -2
- package/dist/{chunk-SNB4DYL3.mjs → chunk-U6NE6RCV.mjs} +4 -4
- package/dist/{chunk-SA52N7G3.mjs → chunk-VP6XRMWR.mjs} +4 -4
- package/dist/{chunk-YUCGFPMS.mjs → chunk-VQDZVWN3.mjs} +449 -405
- package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
- package/dist/{chunk-IV2XTSS2.mjs → chunk-XKPNKR3V.mjs} +16 -46
- package/dist/{chunk-UQS5PAS5.mjs → chunk-YGQOPB2Z.mjs} +1 -1
- package/dist/{chunk-SVO6NV4D.mjs → chunk-YKEHQUSZ.mjs} +4 -4
- package/dist/{chunk-6Z22L5RN.mjs → chunk-ZAYWOHVG.mjs} +1 -1
- package/dist/{chunk-QLDLQW36.mjs → chunk-ZEKDO7YX.mjs} +2 -2
- package/dist/chunk-ZXNNR73R.mjs +31 -0
- package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
- package/dist/{chunk-X5SBWARI.mjs → chunk-ZYKUD5NX.mjs} +9 -7
- package/dist/{client-DoYPHcUn.d.ts → client-Cn3gNxUU.d.ts} +3 -3
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +2 -0
- package/dist/{cold-module-NUD332YD.mjs → cold-module-2WWGBFJC.mjs} +36 -33
- package/dist/{config-CuUfls_H.d.ts → config-CfhH1IWQ.d.ts} +1 -1
- package/dist/{config-Dzs46im6.d.ts → config-aIsy7mcL.d.ts} +52 -1
- package/dist/direct-executor-QLVHMELJ.mjs +24 -0
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +4 -4
- package/dist/distribution.mjs +150 -255
- package/dist/{durability-wiring-K7RDXWL6.mjs → durability-wiring-GNWQSZI3.mjs} +67 -42
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-C0ifUEcm.d.ts → engine-CJRUHXgf.d.ts} +1 -1
- package/dist/gzip-F4HMIEEQ.mjs +1 -0
- package/dist/import-DX55PN4G.mjs +41 -0
- package/dist/index.browser.mjs +7 -4
- package/dist/index.d.ts +539 -5
- package/dist/index.mjs +22 -16
- package/dist/index.react-native.mjs +19 -0
- package/dist/{long-query-thread-FKVHRCHF.mjs → long-query-thread-SCUE62TO.mjs} +20 -17
- package/dist/{module-GJUKW5VU.mjs → module-HW6IXUM6.mjs} +601 -108
- package/dist/{module-TMFIWOD2.mjs → module-V5K4ZP23.mjs} +29 -23
- package/dist/{paged-partition-archive-WNUEMYWM.mjs → paged-partition-archive-FDIIWZNR.mjs} +31 -25
- package/dist/partial-words.mjs +5 -5
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.mjs +28 -22
- package/dist/{phrase-module-OMY3QQV7.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
- package/dist/pool-UPV5PVPY.mjs +298 -0
- package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
- package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
- package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
- package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
- package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
- package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
- package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
- package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
- package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
- package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
- package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
- package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
- package/dist/{browser/chunk-K7UFXEJS.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +12 -6
- package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
- package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
- package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
- package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
- package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
- package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
- package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
- package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
- package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
- package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
- package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
- package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
- package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
- package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
- package/dist/react-native/chunks/chunk-PU55IOG4.mjs +910 -0
- package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
- package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
- package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
- package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
- package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
- package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
- package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
- package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
- package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
- package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
- package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
- package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
- package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
- package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
- package/dist/{browser/module-Q6VFGLMG.mjs → react-native/chunks/module-JBBH6PZH.mjs} +609 -144
- package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
- package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
- package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
- package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
- package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
- package/dist/{browser/restore-queue-SOAHKZSQ.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
- package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
- package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
- package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
- package/dist/react-native/partial-words.mjs +733 -0
- package/dist/react-native/pattern.mjs +2442 -0
- package/dist/react-native/synonyms.mjs +460 -0
- package/dist/react.d.ts +7 -7
- package/dist/react.mjs +2 -0
- package/dist/{rerank-ZZ5CHKLW.mjs → rerank-3W54N6P2.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/restore-queue-BQWWNNQI.mjs +41 -0
- package/dist/{runtime-RAOCKSYA.mjs → runtime-L2DZYY6N.mjs} +5 -5
- package/dist/server.d.ts +8 -8
- package/dist/server.mjs +32 -28
- package/dist/{snapshot-DB5ZVCDN.mjs → snapshot-EHXTOTW5.mjs} +39 -33
- package/dist/synonyms.mjs +3 -3
- package/dist/{tasks-ChWp0wrF.d.ts → tasks-C4ElXr4P.d.ts} +2 -2
- package/dist/thread-I7DVHHW7.mjs +31 -0
- package/dist/vector/search-worker.mjs +7 -5
- package/dist/workers/entry.mjs +9 -9
- package/dist/{write-KZVTLGCI.mjs → write-SDJXXQ2G.mjs} +29 -23
- package/package.json +88 -7
- package/dist/analysis-change-D5APH4Z3.mjs +0 -34
- package/dist/browser/import-FTMLTPGQ.mjs +0 -9
- package/dist/direct-executor-FDQYQEJQ.mjs +0 -22
- package/dist/import-6KXFY6XI.mjs +0 -35
- package/dist/thread-OV6T555H.mjs +0 -28
- /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
|
@@ -1,39 +1,45 @@
|
|
|
1
|
-
export { actionPartitionsOf, adoptSegmentsOnWorker, bytesThatSegmentsHoldInMemory, checkPagedSegmentFully, closeUnusedSegments, countsAsLatestHolder, createPagedFrozenSegment, isPagedSegmentFile, keysThatSegmentsStillRead, mergePagedWindow, openFileVectorReads, openPagedSegmentScan, openPagedSnapshot, openRewriteSpill, pagedListingOf, pagedPartitionLines, pagedTombstonesFor, prepareDiskAdoption, startReadingOpeningSectionsAhead, swapPreparedPartitions, writePagedSegment } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { actionPartitionsOf, adoptSegmentsOnWorker, bytesThatSegmentsHoldInMemory, checkPagedSegmentFully, closeUnusedSegments, countsAsLatestHolder, createPagedFrozenSegment, isPagedSegmentFile, keysThatSegmentsStillRead, mergePagedWindow, openFileVectorReads, openPagedSegmentScan, openPagedSnapshot, openRewriteSpill, pagedListingOf, pagedPartitionLines, pagedTombstonesFor, prepareDiskAdoption, startReadingOpeningSectionsAhead, swapPreparedPartitions, writePagedSegment } from './chunk-ADBS5XRI.mjs';
|
|
2
|
+
import './chunk-3SBJVQLL.mjs';
|
|
3
|
+
import './chunk-NYSONUB7.mjs';
|
|
4
|
+
import './chunk-7N223GWV.mjs';
|
|
5
5
|
import './chunk-FOCV4CBZ.mjs';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
6
|
+
import './chunk-QN5WVV5K.mjs';
|
|
7
|
+
import './chunk-U2726TL5.mjs';
|
|
8
|
+
import './chunk-6C5EX2QR.mjs';
|
|
9
|
+
import './chunk-VQDZVWN3.mjs';
|
|
10
|
+
import './chunk-6F6USYII.mjs';
|
|
11
|
+
import './chunk-O4KUNDVF.mjs';
|
|
12
|
+
import './chunk-3HV7M5OJ.mjs';
|
|
13
|
+
import './chunk-KAKQ74LS.mjs';
|
|
11
14
|
import './chunk-HJSN7UYG.mjs';
|
|
12
|
-
import './chunk-
|
|
15
|
+
import './chunk-6BWLDLS3.mjs';
|
|
16
|
+
import './chunk-XIHUI4KB.mjs';
|
|
17
|
+
import './chunk-Q2UL2TPC.mjs';
|
|
18
|
+
import './chunk-3MXV3VHR.mjs';
|
|
13
19
|
import './chunk-EEBCDP36.mjs';
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-QYMAYU7M.mjs';
|
|
16
|
-
import './chunk-EBIHRL7B.mjs';
|
|
17
|
-
import './chunk-FRJ5RGX7.mjs';
|
|
20
|
+
import './chunk-2HJWQPR6.mjs';
|
|
18
21
|
import './chunk-X5CV2E2B.mjs';
|
|
19
22
|
import './chunk-TGP5M5R7.mjs';
|
|
20
23
|
import './chunk-U2BKYEC7.mjs';
|
|
24
|
+
import './chunk-ZAYWOHVG.mjs';
|
|
21
25
|
import './chunk-QHPYS427.mjs';
|
|
22
|
-
import './chunk-
|
|
23
|
-
import './chunk-
|
|
26
|
+
import './chunk-QYRNLLLI.mjs';
|
|
27
|
+
import './chunk-ZXNQEW43.mjs';
|
|
24
28
|
import './chunk-KOKM4PQN.mjs';
|
|
25
|
-
import './chunk-
|
|
29
|
+
import './chunk-NVTFQFUL.mjs';
|
|
30
|
+
import './chunk-LQG5G2LY.mjs';
|
|
31
|
+
import './chunk-BTPGQC6Z.mjs';
|
|
26
32
|
import './chunk-RFBLQLLZ.mjs';
|
|
27
|
-
import './chunk-
|
|
33
|
+
import './chunk-U46IZNCW.mjs';
|
|
28
34
|
import './chunk-JUKYYXSP.mjs';
|
|
29
|
-
import './chunk-
|
|
35
|
+
import './chunk-SOUZMPME.mjs';
|
|
30
36
|
import './chunk-FQBFZAWG.mjs';
|
|
31
|
-
import './chunk-
|
|
37
|
+
import './chunk-65WCV5JO.mjs';
|
|
32
38
|
import './chunk-4UMZ7KQL.mjs';
|
|
33
|
-
import './chunk-
|
|
34
|
-
import './chunk-
|
|
39
|
+
import './chunk-ZXX5GZEX.mjs';
|
|
40
|
+
import './chunk-KYVRZAYP.mjs';
|
|
35
41
|
import './chunk-L5ORED7V.mjs';
|
|
36
42
|
import './chunk-U476IXKQ.mjs';
|
|
37
|
-
import './chunk-
|
|
43
|
+
import './chunk-MDF6PDIA.mjs';
|
|
38
44
|
import './chunk-R6A773WK.mjs';
|
|
39
45
|
import './chunk-YTJCGKM4.mjs';
|
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { resolvePartitionId } from './chunk-
|
|
2
|
-
import { readVectorFile, VECTOR_FILE_ENVELOPE_VERSION } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import { loadFailed, decodeSections, SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-
|
|
6
|
-
import { vectorsPerFile } from './chunk-
|
|
7
|
-
import { isDead, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-
|
|
8
|
-
import './chunk-
|
|
1
|
+
import { resolvePartitionId } from './chunk-B7XIOAMK.mjs';
|
|
2
|
+
import { readVectorFile, VECTOR_FILE_ENVELOPE_VERSION } from './chunk-KZ5GQE4Z.mjs';
|
|
3
|
+
import './chunk-U6NE6RCV.mjs';
|
|
4
|
+
import './chunk-IRWP524D.mjs';
|
|
5
|
+
import { loadFailed, decodeSections, SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-7N223GWV.mjs';
|
|
6
|
+
import { vectorsPerFile } from './chunk-3BVGJ4JR.mjs';
|
|
7
|
+
import { isDead, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-ZEKDO7YX.mjs';
|
|
8
|
+
import './chunk-AWNHDBKV.mjs';
|
|
9
9
|
import './chunk-37CD3OKS.mjs';
|
|
10
10
|
import './chunk-DJHHF2L5.mjs';
|
|
11
11
|
import { PARTITION_COPY_VECTOR_RUN_BYTES } from './chunk-JDDXV6UF.mjs';
|
|
12
|
-
import { segmentsPrefix, encodeSegmentManifest, directoryCheckpointStore, vectorFileKey } from './chunk-
|
|
13
|
-
import { HEADER_SIZE, crc32Init, crc32Final, engineVersionParts, writeHeader, RESERVED_SIZE, crc32Update } from './chunk-
|
|
14
|
-
import './chunk-
|
|
12
|
+
import { segmentsPrefix, encodeSegmentManifest, directoryCheckpointStore, vectorFileKey } from './chunk-6C5EX2QR.mjs';
|
|
13
|
+
import { HEADER_SIZE, crc32Init, crc32Final, engineVersionParts, writeHeader, RESERVED_SIZE, crc32Update } from './chunk-VQDZVWN3.mjs';
|
|
14
|
+
import './chunk-6F6USYII.mjs';
|
|
15
|
+
import { generateId } from './chunk-O4KUNDVF.mjs';
|
|
16
|
+
import { isCompositePartition } from './chunk-3HV7M5OJ.mjs';
|
|
17
|
+
import './chunk-KAKQ74LS.mjs';
|
|
15
18
|
import './chunk-HJSN7UYG.mjs';
|
|
16
|
-
import './chunk-
|
|
19
|
+
import './chunk-6BWLDLS3.mjs';
|
|
20
|
+
import './chunk-XIHUI4KB.mjs';
|
|
21
|
+
import './chunk-Q2UL2TPC.mjs';
|
|
22
|
+
import './chunk-3MXV3VHR.mjs';
|
|
17
23
|
import './chunk-EEBCDP36.mjs';
|
|
18
|
-
import
|
|
19
|
-
import { isCompositePartition } from './chunk-QYMAYU7M.mjs';
|
|
20
|
-
import './chunk-EBIHRL7B.mjs';
|
|
21
|
-
import './chunk-FRJ5RGX7.mjs';
|
|
24
|
+
import './chunk-2HJWQPR6.mjs';
|
|
22
25
|
import './chunk-X5CV2E2B.mjs';
|
|
23
26
|
import './chunk-TGP5M5R7.mjs';
|
|
24
27
|
import './chunk-U2BKYEC7.mjs';
|
|
28
|
+
import './chunk-ZAYWOHVG.mjs';
|
|
25
29
|
import './chunk-QHPYS427.mjs';
|
|
26
|
-
import './chunk-
|
|
27
|
-
import './chunk-
|
|
30
|
+
import './chunk-QYRNLLLI.mjs';
|
|
31
|
+
import './chunk-ZXNQEW43.mjs';
|
|
28
32
|
import './chunk-KOKM4PQN.mjs';
|
|
29
|
-
import './chunk-
|
|
33
|
+
import './chunk-NVTFQFUL.mjs';
|
|
34
|
+
import './chunk-LQG5G2LY.mjs';
|
|
35
|
+
import './chunk-BTPGQC6Z.mjs';
|
|
30
36
|
import './chunk-RFBLQLLZ.mjs';
|
|
31
|
-
import './chunk-
|
|
37
|
+
import './chunk-U46IZNCW.mjs';
|
|
32
38
|
import './chunk-JUKYYXSP.mjs';
|
|
33
|
-
import { parseVectorDimension } from './chunk-
|
|
39
|
+
import { parseVectorDimension } from './chunk-SOUZMPME.mjs';
|
|
34
40
|
import './chunk-FQBFZAWG.mjs';
|
|
35
|
-
import './chunk-
|
|
41
|
+
import './chunk-65WCV5JO.mjs';
|
|
36
42
|
import './chunk-4UMZ7KQL.mjs';
|
|
37
|
-
import './chunk-
|
|
38
|
-
import './chunk-
|
|
43
|
+
import './chunk-ZXX5GZEX.mjs';
|
|
44
|
+
import './chunk-KYVRZAYP.mjs';
|
|
39
45
|
import './chunk-L5ORED7V.mjs';
|
|
40
46
|
import './chunk-U476IXKQ.mjs';
|
|
41
|
-
import './chunk-
|
|
47
|
+
import './chunk-MDF6PDIA.mjs';
|
|
42
48
|
import './chunk-R6A773WK.mjs';
|
|
43
49
|
import './chunk-YTJCGKM4.mjs';
|
|
44
50
|
import { decode, encode } from '@msgpack/msgpack';
|
package/dist/partial-words.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { partialWordSearchModule } from './chunk-
|
|
1
|
+
import { partialWordSearchModule } from './chunk-SOUZMPME.mjs';
|
|
2
2
|
import './chunk-FQBFZAWG.mjs';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-65WCV5JO.mjs';
|
|
4
4
|
import './chunk-4UMZ7KQL.mjs';
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
5
|
+
import './chunk-ZXX5GZEX.mjs';
|
|
6
|
+
import './chunk-KYVRZAYP.mjs';
|
|
7
7
|
import './chunk-L5ORED7V.mjs';
|
|
8
8
|
import './chunk-U476IXKQ.mjs';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-MDF6PDIA.mjs';
|
|
10
10
|
import './chunk-R6A773WK.mjs';
|
|
11
11
|
import './chunk-YTJCGKM4.mjs';
|
|
12
12
|
|
package/dist/pattern.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { patternSearchModule } from './chunk-
|
|
1
|
+
import { patternSearchModule } from './chunk-U46IZNCW.mjs';
|
|
2
2
|
import './chunk-JUKYYXSP.mjs';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-KYVRZAYP.mjs';
|
|
4
4
|
import './chunk-L5ORED7V.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-MDF6PDIA.mjs';
|
|
6
6
|
import './chunk-YTJCGKM4.mjs';
|
|
7
7
|
|
|
8
8
|
// src/pattern/index.ts
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
import { createDurableDirectory } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { createDurableDirectory } from '../../chunk-7HKWO4BJ.mjs';
|
|
2
|
+
import '../../chunk-BEZH7VEH.mjs';
|
|
3
3
|
import '../../chunk-HLPRHOSO.mjs';
|
|
4
|
-
import { writeCheckpointSegments } from '../../chunk-
|
|
4
|
+
import { writeCheckpointSegments } from '../../chunk-CYYSZPVV.mjs';
|
|
5
5
|
import '../../chunk-JDDXV6UF.mjs';
|
|
6
|
-
import { CHECKPOINT_WORKER_HEARTBEAT_MS } from '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import { directoryCheckpointStore } from '../../chunk-
|
|
6
|
+
import { CHECKPOINT_WORKER_HEARTBEAT_MS } from '../../chunk-QN5WVV5K.mjs';
|
|
7
|
+
import '../../chunk-U2726TL5.mjs';
|
|
8
|
+
import { directoryCheckpointStore } from '../../chunk-6C5EX2QR.mjs';
|
|
9
9
|
import '../../chunk-5QMHMELB.mjs';
|
|
10
|
-
import '../../chunk-
|
|
11
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-VQDZVWN3.mjs';
|
|
11
|
+
import '../../chunk-6F6USYII.mjs';
|
|
12
|
+
import '../../chunk-O4KUNDVF.mjs';
|
|
13
|
+
import '../../chunk-3HV7M5OJ.mjs';
|
|
14
|
+
import '../../chunk-KAKQ74LS.mjs';
|
|
12
15
|
import '../../chunk-HJSN7UYG.mjs';
|
|
13
|
-
import '../../chunk-
|
|
16
|
+
import '../../chunk-6BWLDLS3.mjs';
|
|
17
|
+
import '../../chunk-XIHUI4KB.mjs';
|
|
18
|
+
import '../../chunk-Q2UL2TPC.mjs';
|
|
19
|
+
import '../../chunk-3MXV3VHR.mjs';
|
|
14
20
|
import '../../chunk-EEBCDP36.mjs';
|
|
15
|
-
import '../../chunk-
|
|
16
|
-
import '../../chunk-QYMAYU7M.mjs';
|
|
17
|
-
import '../../chunk-EBIHRL7B.mjs';
|
|
18
|
-
import '../../chunk-FRJ5RGX7.mjs';
|
|
21
|
+
import '../../chunk-2HJWQPR6.mjs';
|
|
19
22
|
import '../../chunk-X5CV2E2B.mjs';
|
|
20
23
|
import '../../chunk-TGP5M5R7.mjs';
|
|
21
24
|
import '../../chunk-U2BKYEC7.mjs';
|
|
25
|
+
import '../../chunk-ZAYWOHVG.mjs';
|
|
22
26
|
import '../../chunk-QHPYS427.mjs';
|
|
23
|
-
import '../../chunk-
|
|
24
|
-
import '../../chunk-
|
|
27
|
+
import '../../chunk-QYRNLLLI.mjs';
|
|
28
|
+
import '../../chunk-ZXNQEW43.mjs';
|
|
25
29
|
import '../../chunk-KOKM4PQN.mjs';
|
|
26
|
-
import '../../chunk-
|
|
30
|
+
import '../../chunk-NVTFQFUL.mjs';
|
|
31
|
+
import '../../chunk-LQG5G2LY.mjs';
|
|
32
|
+
import '../../chunk-BTPGQC6Z.mjs';
|
|
27
33
|
import '../../chunk-RFBLQLLZ.mjs';
|
|
28
|
-
import '../../chunk-
|
|
34
|
+
import '../../chunk-U46IZNCW.mjs';
|
|
29
35
|
import '../../chunk-JUKYYXSP.mjs';
|
|
30
|
-
import '../../chunk-
|
|
36
|
+
import '../../chunk-SOUZMPME.mjs';
|
|
31
37
|
import '../../chunk-FQBFZAWG.mjs';
|
|
32
|
-
import '../../chunk-
|
|
38
|
+
import '../../chunk-65WCV5JO.mjs';
|
|
33
39
|
import '../../chunk-4UMZ7KQL.mjs';
|
|
34
|
-
import '../../chunk-
|
|
35
|
-
import '../../chunk-
|
|
40
|
+
import '../../chunk-ZXX5GZEX.mjs';
|
|
41
|
+
import '../../chunk-KYVRZAYP.mjs';
|
|
36
42
|
import '../../chunk-L5ORED7V.mjs';
|
|
37
43
|
import '../../chunk-U476IXKQ.mjs';
|
|
38
|
-
import '../../chunk-
|
|
44
|
+
import '../../chunk-MDF6PDIA.mjs';
|
|
39
45
|
import '../../chunk-R6A773WK.mjs';
|
|
40
46
|
import '../../chunk-YTJCGKM4.mjs';
|
|
41
47
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBitSet, bitsetIsEmpty, GrowableUint32, bitsetHas, bitsetSet } from './chunk-JUKYYXSP.mjs';
|
|
2
2
|
import { MAX_QUERY_PHRASES, MAX_PHRASE_WORDS } from './chunk-FQBFZAWG.mjs';
|
|
3
3
|
import { PHRASE_ROWS_START, PHRASE_SORT_RADIX_BITS, PHRASE_SORT_CLOCK_ROWS } from './chunk-4UMZ7KQL.mjs';
|
|
4
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
|
|
5
5
|
|
|
6
6
|
// src/core/partition/phrase-matching.ts
|
|
7
7
|
var UINT32_BITS = 32;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { fnv1a } from './chunk-KAKQ74LS.mjs';
|
|
2
|
+
import { resolveWorkerCount, SHUTDOWN_TIMEOUT_MS } from './chunk-3MXV3VHR.mjs';
|
|
3
|
+
import { createRequestId } from './chunk-QHPYS427.mjs';
|
|
4
|
+
import './chunk-BTPGQC6Z.mjs';
|
|
5
|
+
import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
|
|
6
|
+
|
|
7
|
+
// src/workers/pool-memory.ts
|
|
8
|
+
function toFinite(value) {
|
|
9
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
10
|
+
}
|
|
11
|
+
function toHeapLimit(value) {
|
|
12
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
|
|
13
|
+
}
|
|
14
|
+
async function memoryStatsOf(slots) {
|
|
15
|
+
const indices = [];
|
|
16
|
+
const pending = [];
|
|
17
|
+
for (const [slotIndex, slot] of slots) {
|
|
18
|
+
indices.push(slotIndex);
|
|
19
|
+
pending.push(
|
|
20
|
+
slot.executor.execute({ type: "memoryReport", requestId: createRequestId() }).catch(() => null)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const reports = await Promise.all(pending);
|
|
24
|
+
const stats = [];
|
|
25
|
+
for (let n = 0; n < indices.length; n++) {
|
|
26
|
+
const report = reports[n];
|
|
27
|
+
stats.push({
|
|
28
|
+
workerId: indices[n],
|
|
29
|
+
heapUsed: toFinite(report?.heapUsed),
|
|
30
|
+
heapTotal: toFinite(report?.heapTotal),
|
|
31
|
+
heapLimit: toHeapLimit(report?.heapLimit),
|
|
32
|
+
external: toFinite(report?.external)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return stats;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/workers/pool.ts
|
|
39
|
+
function createWorkerPool(config) {
|
|
40
|
+
const workerCount = resolveWorkerCount(config.count);
|
|
41
|
+
const queryWorkerCount = workerCount - Math.min(config.longQueryWorkers ?? 0, workerCount - 1);
|
|
42
|
+
const workers = /* @__PURE__ */ new Map();
|
|
43
|
+
const deadSlots = /* @__PURE__ */ new Set();
|
|
44
|
+
const goneSlots = /* @__PURE__ */ new Set();
|
|
45
|
+
const threadsStillRunning = /* @__PURE__ */ new Set();
|
|
46
|
+
const waitingForEveryThread = [];
|
|
47
|
+
const indexAssignment = /* @__PURE__ */ new Map();
|
|
48
|
+
let isShutdown = false;
|
|
49
|
+
function handleWorkerDeath(slotIndex, error) {
|
|
50
|
+
if (isShutdown) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const slot = workers.get(slotIndex);
|
|
54
|
+
if (slot !== void 0 && !slot.serving) {
|
|
55
|
+
workers.delete(slotIndex);
|
|
56
|
+
goneSlots.delete(slotIndex);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (deadSlots.has(slotIndex)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
deadSlots.add(slotIndex);
|
|
63
|
+
const indexNames = slot ? [...slot.indexes].sort() : [];
|
|
64
|
+
workers.delete(slotIndex);
|
|
65
|
+
config.onWorkerCrash?.(slotIndex, indexNames, error);
|
|
66
|
+
}
|
|
67
|
+
function handleWorkerGone(slotIndex) {
|
|
68
|
+
if (!deadSlots.has(slotIndex) || workers.has(slotIndex)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
goneSlots.add(slotIndex);
|
|
72
|
+
config.onWorkerGone?.(slotIndex);
|
|
73
|
+
}
|
|
74
|
+
function spawnSlot(slotIndex, serving) {
|
|
75
|
+
const slot = {
|
|
76
|
+
executor: config.workerFactory(
|
|
77
|
+
slotIndex,
|
|
78
|
+
(error) => handleWorkerDeath(slotIndex, error),
|
|
79
|
+
() => {
|
|
80
|
+
noteThreadGone(slot.executor);
|
|
81
|
+
handleWorkerGone(slotIndex);
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
indexes: /* @__PURE__ */ new Set(),
|
|
85
|
+
inFlight: 0,
|
|
86
|
+
serving
|
|
87
|
+
};
|
|
88
|
+
threadsStillRunning.add(slot.executor);
|
|
89
|
+
workers.set(slotIndex, slot);
|
|
90
|
+
return slot;
|
|
91
|
+
}
|
|
92
|
+
function noteThreadGone(executor) {
|
|
93
|
+
threadsStillRunning.delete(executor);
|
|
94
|
+
if (threadsStillRunning.size > 0) return;
|
|
95
|
+
for (const resume of waitingForEveryThread.splice(0)) resume();
|
|
96
|
+
}
|
|
97
|
+
function whenEveryThreadIsGone() {
|
|
98
|
+
if (threadsStillRunning.size === 0) return Promise.resolve();
|
|
99
|
+
return new Promise((resolve) => {
|
|
100
|
+
waitingForEveryThread.push(resolve);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function shutDownUntilTheThreadIsGone(executor) {
|
|
104
|
+
return executor.shutdown().then(() => noteThreadGone(executor));
|
|
105
|
+
}
|
|
106
|
+
function ensureWorker(slotIndex) {
|
|
107
|
+
const slot = workers.get(slotIndex);
|
|
108
|
+
if (slot !== void 0) return slot;
|
|
109
|
+
if (deadSlots.has(slotIndex)) return void 0;
|
|
110
|
+
return spawnSlot(slotIndex, true);
|
|
111
|
+
}
|
|
112
|
+
function deadWorkerIds() {
|
|
113
|
+
return [...deadSlots].filter((slotIndex) => goneSlots.has(slotIndex) && !workers.has(slotIndex)).sort((a, b) => a - b);
|
|
114
|
+
}
|
|
115
|
+
function spawnReplacement(slotIndex) {
|
|
116
|
+
if (isShutdown || !deadSlots.has(slotIndex) || !goneSlots.has(slotIndex) || workers.has(slotIndex)) return null;
|
|
117
|
+
const slot = spawnSlot(slotIndex, false);
|
|
118
|
+
return {
|
|
119
|
+
workerId: slotIndex,
|
|
120
|
+
executor: slot.executor,
|
|
121
|
+
hold(indexName) {
|
|
122
|
+
slot.indexes.add(indexName);
|
|
123
|
+
},
|
|
124
|
+
admit() {
|
|
125
|
+
if (workers.get(slotIndex) !== slot) return;
|
|
126
|
+
deadSlots.delete(slotIndex);
|
|
127
|
+
goneSlots.delete(slotIndex);
|
|
128
|
+
slot.serving = true;
|
|
129
|
+
},
|
|
130
|
+
abandon() {
|
|
131
|
+
if (workers.get(slotIndex) === slot) workers.delete(slotIndex);
|
|
132
|
+
void shutDownUntilTheThreadIsGone(slot.executor).catch(() => void 0);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function isLongQueryWorker(workerId) {
|
|
137
|
+
return workerId >= queryWorkerCount;
|
|
138
|
+
}
|
|
139
|
+
function assignSlot(indexName) {
|
|
140
|
+
const preferred = fnv1a(indexName) % queryWorkerCount;
|
|
141
|
+
for (let probe = 0; probe < queryWorkerCount; probe++) {
|
|
142
|
+
const candidate = (preferred + probe) % queryWorkerCount;
|
|
143
|
+
if (!deadSlots.has(candidate)) {
|
|
144
|
+
return candidate;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Every worker in the pool has crashed`);
|
|
148
|
+
}
|
|
149
|
+
function addIndex(indexName) {
|
|
150
|
+
if (isShutdown) {
|
|
151
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, "Worker pool has been shut down");
|
|
152
|
+
}
|
|
153
|
+
if (indexAssignment.has(indexName)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const slotIndex = assignSlot(indexName);
|
|
157
|
+
const slot = ensureWorker(slotIndex);
|
|
158
|
+
if (!slot) {
|
|
159
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Worker ${slotIndex} for index "${indexName}" has crashed`);
|
|
160
|
+
}
|
|
161
|
+
slot.indexes.add(indexName);
|
|
162
|
+
indexAssignment.set(indexName, slotIndex);
|
|
163
|
+
}
|
|
164
|
+
function removeIndex(indexName) {
|
|
165
|
+
for (const slot of workers.values()) slot.indexes.delete(indexName);
|
|
166
|
+
indexAssignment.delete(indexName);
|
|
167
|
+
}
|
|
168
|
+
function getExecutor(indexName) {
|
|
169
|
+
if (isShutdown) {
|
|
170
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, "Worker pool has been shut down");
|
|
171
|
+
}
|
|
172
|
+
const slotIndex = indexAssignment.get(indexName);
|
|
173
|
+
if (slotIndex === void 0) {
|
|
174
|
+
throw new NarsilError(ErrorCodes.INDEX_NOT_FOUND, `Index "${indexName}" is not registered in the worker pool`);
|
|
175
|
+
}
|
|
176
|
+
const slot = workers.get(slotIndex);
|
|
177
|
+
if (slot?.serving) {
|
|
178
|
+
return slot.executor;
|
|
179
|
+
}
|
|
180
|
+
for (const survivor of workers.values()) {
|
|
181
|
+
if (survivor.serving && survivor.indexes.has(indexName)) {
|
|
182
|
+
return survivor.executor;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Every worker holding index "${indexName}" has crashed`);
|
|
186
|
+
}
|
|
187
|
+
async function shutdown() {
|
|
188
|
+
if (isShutdown) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
isShutdown = true;
|
|
192
|
+
const shutdownPromises = [...threadsStillRunning].map((executor) => {
|
|
193
|
+
let timeoutId;
|
|
194
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
195
|
+
timeoutId = setTimeout(resolve, SHUTDOWN_TIMEOUT_MS);
|
|
196
|
+
});
|
|
197
|
+
return Promise.race([shutDownUntilTheThreadIsGone(executor), timeoutPromise]).finally(
|
|
198
|
+
() => clearTimeout(timeoutId)
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
await Promise.allSettled(shutdownPromises);
|
|
202
|
+
indexAssignment.clear();
|
|
203
|
+
}
|
|
204
|
+
function getAllExecutors() {
|
|
205
|
+
return [...workers.values()].map((slot) => slot.executor);
|
|
206
|
+
}
|
|
207
|
+
function executorEntries() {
|
|
208
|
+
return [...workers].map(([workerId, slot]) => ({ workerId, executor: slot.executor }));
|
|
209
|
+
}
|
|
210
|
+
function executorsHolding(indexName) {
|
|
211
|
+
const holders = [];
|
|
212
|
+
for (const slot of workers.values()) {
|
|
213
|
+
if (slot.indexes.has(indexName)) holders.push(slot.executor);
|
|
214
|
+
}
|
|
215
|
+
return holders;
|
|
216
|
+
}
|
|
217
|
+
function lease(workerId, slot) {
|
|
218
|
+
slot.inFlight += 1;
|
|
219
|
+
let released = false;
|
|
220
|
+
return {
|
|
221
|
+
workerId,
|
|
222
|
+
executor: slot.executor,
|
|
223
|
+
release() {
|
|
224
|
+
if (released) return;
|
|
225
|
+
released = true;
|
|
226
|
+
slot.inFlight -= 1;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function leaseLeastBusy(indexName) {
|
|
231
|
+
let chosenId = -1;
|
|
232
|
+
let chosen = null;
|
|
233
|
+
for (const [workerId, slot] of workers) {
|
|
234
|
+
if (!slot.serving || isLongQueryWorker(workerId)) continue;
|
|
235
|
+
if (indexName !== void 0 && !slot.indexes.has(indexName)) continue;
|
|
236
|
+
if (chosen === null || slot.inFlight < chosen.inFlight) {
|
|
237
|
+
chosenId = workerId;
|
|
238
|
+
chosen = slot;
|
|
239
|
+
}
|
|
240
|
+
if (chosen.inFlight === 0) break;
|
|
241
|
+
}
|
|
242
|
+
return chosen === null ? null : lease(chosenId, chosen);
|
|
243
|
+
}
|
|
244
|
+
function queriesInFlight() {
|
|
245
|
+
let total = 0;
|
|
246
|
+
for (const [workerId, slot] of workers) {
|
|
247
|
+
if (slot.serving && !isLongQueryWorker(workerId)) total += slot.inFlight;
|
|
248
|
+
}
|
|
249
|
+
return total;
|
|
250
|
+
}
|
|
251
|
+
function leaseIdle(limit) {
|
|
252
|
+
const leases = [];
|
|
253
|
+
for (const [workerId, slot] of workers) {
|
|
254
|
+
if (leases.length >= limit) break;
|
|
255
|
+
if (slot.serving && slot.inFlight === 0 && !isLongQueryWorker(workerId)) leases.push(lease(workerId, slot));
|
|
256
|
+
}
|
|
257
|
+
return leases;
|
|
258
|
+
}
|
|
259
|
+
function addIndexToAll(indexName) {
|
|
260
|
+
if (isShutdown) {
|
|
261
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, "Worker pool has been shut down");
|
|
262
|
+
}
|
|
263
|
+
for (let i = 0; i < workerCount; i++) {
|
|
264
|
+
ensureWorker(i)?.indexes.add(indexName);
|
|
265
|
+
}
|
|
266
|
+
indexAssignment.set(indexName, assignSlot(indexName));
|
|
267
|
+
}
|
|
268
|
+
function spawnAll() {
|
|
269
|
+
if (isShutdown) {
|
|
270
|
+
throw new NarsilError(ErrorCodes.WORKER_CRASHED, "Worker pool has been shut down");
|
|
271
|
+
}
|
|
272
|
+
for (let i = 0; i < workerCount; i++) ensureWorker(i);
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
getExecutor,
|
|
276
|
+
getAllExecutors,
|
|
277
|
+
executorEntries,
|
|
278
|
+
executorsHolding,
|
|
279
|
+
leaseLeastBusy,
|
|
280
|
+
leaseIdle,
|
|
281
|
+
isLongQueryWorker,
|
|
282
|
+
queriesInFlight,
|
|
283
|
+
spawnAll,
|
|
284
|
+
deadWorkerIds,
|
|
285
|
+
spawnReplacement,
|
|
286
|
+
get workerCount() {
|
|
287
|
+
return workerCount;
|
|
288
|
+
},
|
|
289
|
+
addIndex,
|
|
290
|
+
addIndexToAll,
|
|
291
|
+
removeIndex,
|
|
292
|
+
getMemoryStats: () => memoryStatsOf(workers.entries()),
|
|
293
|
+
shutdown,
|
|
294
|
+
whenEveryThreadIsGone
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export { createWorkerPool };
|