@delali/narsil 0.3.1-next.109 → 0.3.1-next.111
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 +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/browser/{chunk-RYWURYTW.mjs → chunk-2CBQ2PCC.mjs} +1 -1
- package/dist/browser/{chunk-3RXEGUGO.mjs → chunk-5BQPBG3G.mjs} +41 -4
- package/dist/browser/{chunk-XHRHOH2P.mjs → chunk-6YUUEMQ4.mjs} +139 -28
- package/dist/browser/{chunk-SCBBEQWD.mjs → chunk-HQOYKRMB.mjs} +13 -13
- package/dist/browser/{chunk-EQ7BQ6VZ.mjs → chunk-LJS6PREA.mjs} +1 -0
- package/dist/browser/{chunk-Z2K5AGZL.mjs → chunk-OVY4RPDS.mjs} +3 -3
- package/dist/browser/{chunk-S7KNCVPU.mjs → chunk-P7C2S5JX.mjs} +2 -2
- package/dist/browser/{durability-wiring-JJGE7MED.mjs → durability-wiring-CYAJBYCO.mjs} +48 -20
- package/dist/browser/{module-PCKQADMQ.mjs → module-DYKR4INA.mjs} +5 -5
- package/dist/browser/{restore-queue-2STSWU2E.mjs → restore-queue-RTZGJT4D.mjs} +1 -1
- package/dist/browser/{runtime-ARKW5NZX.mjs → runtime-FL5K4JOH.mjs} +1 -1
- package/dist/browser/{snapshot-3AZDQKNA.mjs → snapshot-BU6I25CW.mjs} +27 -14
- package/dist/browser/{write-XXLMPT3Y.mjs → write-RUPYHPBZ.mjs} +5 -5
- package/dist/{capabilities-D4MUmjfe.d.ts → capabilities-ByaX8Arf.d.ts} +2 -2
- package/dist/{chunk-FN75BCXC.mjs → chunk-2RAQKITH.mjs} +1 -1
- package/dist/{chunk-SAZB7ZHT.mjs → chunk-542TD4BL.mjs} +1 -1
- package/dist/{chunk-YP23IAV5.mjs → chunk-63HFWQEA.mjs} +4 -3
- package/dist/{chunk-FV5CP3E2.mjs → chunk-6ODIY6ZB.mjs} +1 -1
- package/dist/{chunk-RQ7LOBLD.mjs → chunk-6PN3U6XW.mjs} +1 -1
- package/dist/{chunk-CYXLPFBG.mjs → chunk-6S7YRUPQ.mjs} +123 -35
- package/dist/{chunk-C57FPCTL.mjs → chunk-7JOONQ24.mjs} +6 -6
- package/dist/{chunk-IBJWO5PF.mjs → chunk-7ZZQNOIY.mjs} +1 -1
- package/dist/{chunk-SYHS56F7.mjs → chunk-CUVTRLA4.mjs} +26 -13
- package/dist/{chunk-AWZVJCCW.mjs → chunk-DG62H7OD.mjs} +2 -2
- package/dist/{chunk-LWQTFKRS.mjs → chunk-FUUP45IS.mjs} +1 -1
- package/dist/{chunk-C55OFKU6.mjs → chunk-HNAP2KTG.mjs} +2 -2
- package/dist/{chunk-5LP7OU6B.mjs → chunk-IR4KQ4WB.mjs} +2 -2
- package/dist/{chunk-ICZW4J3I.mjs → chunk-IW6UR3AF.mjs} +21 -21
- package/dist/{chunk-FABI2JA7.mjs → chunk-J6YVB2XM.mjs} +1 -1
- package/dist/{chunk-H5465KUZ.mjs → chunk-JBPYFYIU.mjs} +4 -3
- package/dist/{chunk-62GK7UUS.mjs → chunk-KCQG2PJT.mjs} +3 -3
- package/dist/{chunk-U6FT7LKG.mjs → chunk-LOBYK2FG.mjs} +3 -3
- package/dist/{chunk-XY6Z7T5W.mjs → chunk-N57XXGPG.mjs} +2 -2
- package/dist/{chunk-S2CKO6PP.mjs → chunk-OBWUWZRA.mjs} +1 -0
- package/dist/{chunk-CKRP7GCS.mjs → chunk-OCB7TMUQ.mjs} +1 -1
- package/dist/{chunk-NYWUBTMH.mjs → chunk-OFYKBKKV.mjs} +1 -1
- package/dist/{chunk-VIXXQEX6.mjs → chunk-PKE2PCTS.mjs} +43 -6
- package/dist/{chunk-ZBZRBM2Z.mjs → chunk-PT7VRWS7.mjs} +3 -3
- package/dist/{chunk-DUWYU4D5.mjs → chunk-PWIWSUCX.mjs} +2 -2
- package/dist/{chunk-5W7ADHK7.mjs → chunk-QI6JW4PM.mjs} +1 -1
- package/dist/{chunk-SD2EYVU4.mjs → chunk-QIFOXLWF.mjs} +2 -2
- package/dist/{chunk-N75MAOM7.mjs → chunk-R2MRGYU5.mjs} +2 -2
- package/dist/{chunk-4GD43FSW.mjs → chunk-R2MRMH6M.mjs} +10 -10
- package/dist/{chunk-RSSLOFRP.mjs → chunk-SXVDBHYJ.mjs} +39 -8
- package/dist/{chunk-HL2GAS5N.mjs → chunk-UGKO3RG2.mjs} +7 -7
- package/dist/{chunk-5DPTHLMX.mjs → chunk-V7G627TA.mjs} +1 -1
- package/dist/{chunk-MVWWAHTR.mjs → chunk-VK45J47R.mjs} +1 -1
- package/dist/{chunk-RPIE4QCL.mjs → chunk-YH5OIL7B.mjs} +2 -0
- package/dist/{chunk-JKOBHB4A.mjs → chunk-YIDSHBQS.mjs} +2 -2
- package/dist/{chunk-PA5WZWLC.mjs → chunk-YLE75NQ5.mjs} +2 -2
- package/dist/{chunk-A2HWRBQE.mjs → chunk-YSR5L3XJ.mjs} +2 -2
- package/dist/{client-Ba9yP-Rr.d.ts → client-BdnzDFtO.d.ts} +2 -2
- package/dist/client.d.ts +6 -6
- package/dist/client.mjs +1 -0
- package/dist/{config-C-xXz8bC.d.ts → config-CSgvApt0.d.ts} +1 -1
- package/dist/{config-Dc_8-byz.d.ts → config-ujZESkJz.d.ts} +1 -1
- package/dist/{direct-executor-QH2M6AK2.mjs → direct-executor-QFAUKTCQ.mjs} +11 -11
- package/dist/distribution/coordinator/etcd.mjs +94 -5
- package/dist/distribution/transport/grpc.mjs +24 -8
- package/dist/distribution/transport/in-memory.mjs +4 -4
- package/dist/distribution/transport/tcp.mjs +6 -6
- package/dist/distribution.d.ts +5 -5
- package/dist/distribution.mjs +1232 -377
- package/dist/{durability-wiring-4HWX7OVP.mjs → durability-wiring-NUHTYXHA.mjs} +65 -38
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CMZ5XSLy.d.ts → engine-C_HSy3iz.d.ts} +1 -1
- package/dist/{events-dnvgprIl.d.ts → events-CJsXF1F9.d.ts} +1 -0
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +16 -16
- package/dist/{module-IYILOTU3.mjs → module-WP4VVGV2.mjs} +9 -9
- package/dist/partial-words.mjs +5 -5
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +12 -0
- package/dist/persistence/durability/checkpoint-worker.mjs +25 -23
- package/dist/react.d.ts +6 -6
- package/dist/react.mjs +1 -0
- package/dist/{rerank-EHJVXEDP.mjs → rerank-3POMPQNX.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{restore-queue-BONSQWCI.mjs → restore-queue-QSLGXZJB.mjs} +1 -1
- package/dist/{runtime-LEX2F7OW.mjs → runtime-C2435MPK.mjs} +5 -5
- package/dist/server.d.ts +8 -8
- package/dist/server.mjs +12 -12
- package/dist/{snapshot-DWDLN5YW.mjs → snapshot-IV3S2TMI.mjs} +25 -25
- package/dist/synonyms.mjs +3 -3
- package/dist/{tasks-B4B2cMK5.d.ts → tasks-CI3Fvkxw.d.ts} +1 -1
- package/dist/{thread-I32PUURR.mjs → thread-THLCKMEB.mjs} +11 -11
- package/dist/vector/search-worker.mjs +4 -4
- package/dist/workers/entry.mjs +5 -5
- package/dist/{write-AOFSHACR.mjs → write-VGRTOS7N.mjs} +18 -18
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_NODE_ID_LENGTH, CONTROLLER_LEASE_KEY, MAX_WATCHERS } from '../../chunk-44W3CBNG.mjs';
|
|
2
2
|
import '../../chunk-R6A773WK.mjs';
|
|
3
3
|
import { compareCodePoints } from '../../chunk-YTJCGKM4.mjs';
|
|
4
|
-
import { NarsilError, ErrorCodes, describeError } from '../../chunk-
|
|
4
|
+
import { NarsilError, ErrorCodes, describeError } from '../../chunk-OBWUWZRA.mjs';
|
|
5
5
|
import { encode, decode } from '@msgpack/msgpack';
|
|
6
6
|
|
|
7
7
|
// src/distribution/coordinator/etcd/constants.ts
|
|
@@ -13,6 +13,54 @@ var RECONNECT_FIRST_DELAY_MS = 100;
|
|
|
13
13
|
var RECONNECT_LONGEST_DELAY_MS = 5e3;
|
|
14
14
|
var ETCD_START_PROBE_TIMEOUT_MS = 1e4;
|
|
15
15
|
var ETCD_CALL_TIMEOUT_MS = 5e3;
|
|
16
|
+
var ETCD_KEEPALIVE_TIME_MS = 1e4;
|
|
17
|
+
var ETCD_KEEPALIVE_TIMEOUT_MS = 5e3;
|
|
18
|
+
var ETCD_WATCH_ATTACH_TIMEOUT_MS = 1e4;
|
|
19
|
+
var ETCD_ENDPOINT_FAILURE_THRESHOLD = 3;
|
|
20
|
+
var ETCD_ENDPOINT_SKIP_MS = 5e3;
|
|
21
|
+
|
|
22
|
+
// src/distribution/coordinator/etcd/endpoint-breaker.ts
|
|
23
|
+
var NEVER_ABORTED = new AbortController().signal;
|
|
24
|
+
var noListeners = () => ({ dispose: () => {
|
|
25
|
+
} });
|
|
26
|
+
var EndpointSkippedError = class extends NarsilError {
|
|
27
|
+
isBrokenCircuitError = true;
|
|
28
|
+
};
|
|
29
|
+
var SkippingEndpointBreaker = class {
|
|
30
|
+
constructor(endpoint, counts) {
|
|
31
|
+
this.endpoint = endpoint;
|
|
32
|
+
this.counts = counts;
|
|
33
|
+
}
|
|
34
|
+
onSuccess = noListeners;
|
|
35
|
+
onFailure = noListeners;
|
|
36
|
+
consecutiveFailures = 0;
|
|
37
|
+
skippedUntil = 0;
|
|
38
|
+
async execute(fn, signal = NEVER_ABORTED) {
|
|
39
|
+
if (Date.now() < this.skippedUntil) {
|
|
40
|
+
throw new EndpointSkippedError(
|
|
41
|
+
ErrorCodes.COORDINATOR_UNAVAILABLE,
|
|
42
|
+
`etcd endpoint ${this.endpoint} failed ${ETCD_ENDPOINT_FAILURE_THRESHOLD} calls in a row, so this client skips it for ${ETCD_ENDPOINT_SKIP_MS} ms`,
|
|
43
|
+
{ endpoint: this.endpoint }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const result = await fn({ signal });
|
|
48
|
+
this.consecutiveFailures = 0;
|
|
49
|
+
return result;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error instanceof Error && this.counts(error)) {
|
|
52
|
+
this.consecutiveFailures += 1;
|
|
53
|
+
if (this.consecutiveFailures >= ETCD_ENDPOINT_FAILURE_THRESHOLD) {
|
|
54
|
+
this.skippedUntil = Date.now() + ETCD_ENDPOINT_SKIP_MS;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function createEndpointBreaker(endpoint, counts) {
|
|
62
|
+
return new SkippingEndpointBreaker(endpoint, counts);
|
|
63
|
+
}
|
|
16
64
|
|
|
17
65
|
// src/distribution/coordinator/etcd/types.ts
|
|
18
66
|
var DEFAULT_ETCD_CONFIG = {
|
|
@@ -181,6 +229,16 @@ async function loadEtcd3Module() {
|
|
|
181
229
|
// src/distribution/coordinator/etcd/prefix-watch.ts
|
|
182
230
|
function connectedOrDropped(watcher) {
|
|
183
231
|
return new Promise((resolve, reject) => {
|
|
232
|
+
const timer = setTimeout(() => {
|
|
233
|
+
detach();
|
|
234
|
+
reject(
|
|
235
|
+
new NarsilError(
|
|
236
|
+
ErrorCodes.COORDINATOR_UNAVAILABLE,
|
|
237
|
+
`etcd did not attach the watch within ${ETCD_WATCH_ATTACH_TIMEOUT_MS} ms`
|
|
238
|
+
)
|
|
239
|
+
);
|
|
240
|
+
}, ETCD_WATCH_ATTACH_TIMEOUT_MS);
|
|
241
|
+
timer.unref?.();
|
|
184
242
|
const onConnected = () => {
|
|
185
243
|
detach();
|
|
186
244
|
resolve();
|
|
@@ -190,6 +248,7 @@ function connectedOrDropped(watcher) {
|
|
|
190
248
|
reject(error);
|
|
191
249
|
};
|
|
192
250
|
function detach() {
|
|
251
|
+
clearTimeout(timer);
|
|
193
252
|
watcher.off("connected", onConnected);
|
|
194
253
|
watcher.off("disconnected", onDropped);
|
|
195
254
|
watcher.off("error", onDropped);
|
|
@@ -233,12 +292,16 @@ async function watchPrefix(context, prefix, handlers) {
|
|
|
233
292
|
return String(BigInt(listing.header.revision) + 1n);
|
|
234
293
|
}
|
|
235
294
|
async function watchFrom(startRevision2) {
|
|
236
|
-
const
|
|
295
|
+
const client = context.watchClient.current();
|
|
296
|
+
const watcher = client.watch().prefix(prefix).startRevision(startRevision2).watcher();
|
|
237
297
|
try {
|
|
238
298
|
await connectedOrDropped(watcher);
|
|
239
299
|
} catch (error) {
|
|
300
|
+
watcher.on("error", () => {
|
|
301
|
+
});
|
|
240
302
|
watcher.cancel().catch(() => {
|
|
241
303
|
});
|
|
304
|
+
context.watchClient.replace(client);
|
|
242
305
|
throw error;
|
|
243
306
|
}
|
|
244
307
|
if (stopped || context.isShutdown()) {
|
|
@@ -733,6 +796,24 @@ function validatePartitionState(value) {
|
|
|
733
796
|
return value;
|
|
734
797
|
}
|
|
735
798
|
|
|
799
|
+
// src/distribution/coordinator/etcd/watch-client.ts
|
|
800
|
+
function createReplaceableWatchClient(open) {
|
|
801
|
+
let client = open();
|
|
802
|
+
let closed = false;
|
|
803
|
+
return {
|
|
804
|
+
current: () => client,
|
|
805
|
+
replace(stale) {
|
|
806
|
+
if (closed || stale !== client) return;
|
|
807
|
+
client = open();
|
|
808
|
+
stale.close();
|
|
809
|
+
},
|
|
810
|
+
close() {
|
|
811
|
+
closed = true;
|
|
812
|
+
client.close();
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
|
|
736
817
|
// src/distribution/coordinator/etcd/index.ts
|
|
737
818
|
async function createEtcdCoordinator(config) {
|
|
738
819
|
const resolvedConfig = {
|
|
@@ -742,12 +823,18 @@ async function createEtcdCoordinator(config) {
|
|
|
742
823
|
requireEtcdMaxRequestBytes(resolvedConfig.maxRequestBytes);
|
|
743
824
|
const securityOptions = etcdSecurityOptions(resolvedConfig);
|
|
744
825
|
const etcd3Module = await loadEtcd3Module();
|
|
745
|
-
const
|
|
826
|
+
const openClient = () => new etcd3Module.Etcd3({
|
|
746
827
|
hosts: resolvedConfig.endpoints,
|
|
747
|
-
grpcOptions: {
|
|
828
|
+
grpcOptions: {
|
|
829
|
+
"grpc.max_receive_message_length": ETCD_MAX_RESPONSE_BYTES,
|
|
830
|
+
"grpc.keepalive_time_ms": ETCD_KEEPALIVE_TIME_MS,
|
|
831
|
+
"grpc.keepalive_timeout_ms": ETCD_KEEPALIVE_TIMEOUT_MS
|
|
832
|
+
},
|
|
748
833
|
defaultCallOptions: (context) => context.isStream ? {} : { deadline: Date.now() + ETCD_CALL_TIMEOUT_MS },
|
|
834
|
+
faultHandling: { host: (endpoint) => createEndpointBreaker(endpoint, etcd3Module.isRecoverableError) },
|
|
749
835
|
...securityOptions
|
|
750
836
|
});
|
|
837
|
+
const client = openClient();
|
|
751
838
|
const keys = coordinatorKeys(resolvedConfig);
|
|
752
839
|
try {
|
|
753
840
|
await probeEtcd(client, etcd3Module, keys.nodePrefix(), resolvedConfig.endpoints);
|
|
@@ -779,7 +866,8 @@ async function createEtcdCoordinator(config) {
|
|
|
779
866
|
});
|
|
780
867
|
watchers.delete(watcher);
|
|
781
868
|
}
|
|
782
|
-
const
|
|
869
|
+
const watchClient = createReplaceableWatchClient(openClient);
|
|
870
|
+
const watchContext = { client, watchClient, addWatcher, removeWatcher, isShutdown: () => isShutdown };
|
|
783
871
|
const coordinator = {
|
|
784
872
|
async registerNode(registration) {
|
|
785
873
|
assertNotShutdown();
|
|
@@ -1003,6 +1091,7 @@ async function createEtcdCoordinator(config) {
|
|
|
1003
1091
|
await Promise.all(cancelPromises);
|
|
1004
1092
|
watchers.clear();
|
|
1005
1093
|
await leaseManager.revokeAll();
|
|
1094
|
+
watchClient.close();
|
|
1006
1095
|
client.close();
|
|
1007
1096
|
}
|
|
1008
1097
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-
|
|
2
|
-
import { timeoutsOf, replyDeadlineMs } from '../../chunk-
|
|
1
|
+
import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-J6YVB2XM.mjs';
|
|
2
|
+
import { timeoutsOf, replyDeadlineMs } from '../../chunk-PWIWSUCX.mjs';
|
|
3
3
|
import { MAX_MESSAGE_SIZE_BYTES, GRPC_KEEPALIVE_TIMEOUT_MS, GRPC_KEEPALIVE_TIME_MS, GRPC_ENVELOPE_OVERHEAD_BYTES } from '../../chunk-UNEEFTEU.mjs';
|
|
4
|
-
import { TransportError, TransportErrorCodes } from '../../chunk-
|
|
5
|
-
import { NarsilError, ErrorCodes } from '../../chunk-
|
|
4
|
+
import { TransportError, TransportErrorCodes } from '../../chunk-YH5OIL7B.mjs';
|
|
5
|
+
import { NarsilError, ErrorCodes } from '../../chunk-OBWUWZRA.mjs';
|
|
6
6
|
|
|
7
7
|
// src/distribution/transport/grpc/codec.ts
|
|
8
8
|
var FIELD_ONE_LENGTH_DELIMITED_KEY = 10;
|
|
@@ -152,7 +152,7 @@ var GrpcClientPool = class {
|
|
|
152
152
|
}
|
|
153
153
|
async send(target, message) {
|
|
154
154
|
const messageBytes = this.encodeChecked(target, message);
|
|
155
|
-
const client = await this.
|
|
155
|
+
const client = await this.readyClient(target);
|
|
156
156
|
const responseBytes = await this.unaryCall(
|
|
157
157
|
client,
|
|
158
158
|
target,
|
|
@@ -265,7 +265,7 @@ var GrpcClientPool = class {
|
|
|
265
265
|
}
|
|
266
266
|
assertOpen() {
|
|
267
267
|
if (this.closed) {
|
|
268
|
-
throw new TransportError(TransportErrorCodes.
|
|
268
|
+
throw new TransportError(TransportErrorCodes.CONNECT_FAILED, "gRPC client pool has been shut down");
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
getClient(target) {
|
|
@@ -283,8 +283,24 @@ var GrpcClientPool = class {
|
|
|
283
283
|
});
|
|
284
284
|
return clientPromise;
|
|
285
285
|
}
|
|
286
|
+
async readyClient(target) {
|
|
287
|
+
const client = await this.getClient(target);
|
|
288
|
+
if (client.getChannel().getConnectivityState(false) === this.grpc.connectivityState.READY) {
|
|
289
|
+
return client;
|
|
290
|
+
}
|
|
291
|
+
const ready = this.awaitReady(client, target);
|
|
292
|
+
this.clients.set(target, ready);
|
|
293
|
+
ready.catch(() => {
|
|
294
|
+
if (this.clients.get(target) === ready) {
|
|
295
|
+
this.clients.delete(target);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return ready;
|
|
299
|
+
}
|
|
286
300
|
connect(target) {
|
|
287
|
-
|
|
301
|
+
return this.awaitReady(new this.grpc.Client(target, this.credentials(), channelOptions()), target);
|
|
302
|
+
}
|
|
303
|
+
awaitReady(client, target) {
|
|
288
304
|
const channel = client.getChannel();
|
|
289
305
|
const { READY, SHUTDOWN, TRANSIENT_FAILURE } = this.grpc.connectivityState;
|
|
290
306
|
const deadline = Date.now() + this.config.connectTimeout;
|
|
@@ -614,7 +630,7 @@ async function createGrpcTransport(nodeId, config) {
|
|
|
614
630
|
function assertNotShutdown() {
|
|
615
631
|
if (isShutdown) {
|
|
616
632
|
throw new TransportError(
|
|
617
|
-
TransportErrorCodes.
|
|
633
|
+
TransportErrorCodes.CONNECT_FAILED,
|
|
618
634
|
`gRPC transport for node '${nodeId}' has been shut down`,
|
|
619
635
|
{ nodeId }
|
|
620
636
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { timeoutsOf, replyDeadlineMs } from '../../chunk-
|
|
1
|
+
import { timeoutsOf, replyDeadlineMs } from '../../chunk-PWIWSUCX.mjs';
|
|
2
2
|
import { MAX_MESSAGE_SIZE_BYTES } from '../../chunk-UNEEFTEU.mjs';
|
|
3
|
-
import { DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes } from '../../chunk-
|
|
3
|
+
import { DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes } from '../../chunk-YH5OIL7B.mjs';
|
|
4
4
|
|
|
5
5
|
// src/distribution/transport/in-memory.ts
|
|
6
6
|
function createInMemoryNetwork() {
|
|
@@ -27,7 +27,7 @@ function createInMemoryTransport(nodeId, network, config) {
|
|
|
27
27
|
function assertNotShutdown() {
|
|
28
28
|
if (isShutdown) {
|
|
29
29
|
throw new TransportError(
|
|
30
|
-
TransportErrorCodes.
|
|
30
|
+
TransportErrorCodes.CONNECT_FAILED,
|
|
31
31
|
`Transport for node '${nodeId}' has been shut down`,
|
|
32
32
|
{ nodeId }
|
|
33
33
|
);
|
|
@@ -36,7 +36,7 @@ function createInMemoryTransport(nodeId, network, config) {
|
|
|
36
36
|
function lookupPeer(target) {
|
|
37
37
|
const peer = network.getTransport(target);
|
|
38
38
|
if (peer === void 0) {
|
|
39
|
-
throw new TransportError(TransportErrorCodes.
|
|
39
|
+
throw new TransportError(TransportErrorCodes.CONNECT_FAILED, `Node '${target}' is not reachable`, { target });
|
|
40
40
|
}
|
|
41
41
|
return peer;
|
|
42
42
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_TCP_CONFIG, encodeTransportMessage, encodeFrame, FRAME_TYPE_REQUEST, FrameParser, FRAME_TYPE_RESPONSE, decodeTransportMessage, FRAME_TYPE_STREAM_CHUNK, FRAME_TYPE_STREAM_END } from '../../chunk-
|
|
2
|
-
import { timeoutsOf, replyDeadlineMs } from '../../chunk-
|
|
1
|
+
import { DEFAULT_TCP_CONFIG, encodeTransportMessage, encodeFrame, FRAME_TYPE_REQUEST, FrameParser, FRAME_TYPE_RESPONSE, decodeTransportMessage, FRAME_TYPE_STREAM_CHUNK, FRAME_TYPE_STREAM_END } from '../../chunk-J6YVB2XM.mjs';
|
|
2
|
+
import { timeoutsOf, replyDeadlineMs } from '../../chunk-PWIWSUCX.mjs';
|
|
3
3
|
import { MAX_MESSAGE_SIZE_BYTES } from '../../chunk-UNEEFTEU.mjs';
|
|
4
|
-
import { TransportError, TransportErrorCodes } from '../../chunk-
|
|
4
|
+
import { TransportError, TransportErrorCodes } from '../../chunk-YH5OIL7B.mjs';
|
|
5
5
|
import { connect as connect$1, createServer as createServer$1 } from 'net';
|
|
6
6
|
import { connect, createServer } from 'tls';
|
|
7
7
|
|
|
@@ -71,7 +71,7 @@ var TcpConnectionPool = class {
|
|
|
71
71
|
}
|
|
72
72
|
async send(target, message) {
|
|
73
73
|
if (this.closed) {
|
|
74
|
-
throw new TransportError(TransportErrorCodes.
|
|
74
|
+
throw new TransportError(TransportErrorCodes.CONNECT_FAILED, "Connection pool has been shut down");
|
|
75
75
|
}
|
|
76
76
|
const messageBytes = encodeTransportMessage(message);
|
|
77
77
|
if (messageBytes.byteLength > MAX_MESSAGE_SIZE_BYTES) {
|
|
@@ -113,7 +113,7 @@ var TcpConnectionPool = class {
|
|
|
113
113
|
}
|
|
114
114
|
async stream(target, message, handler) {
|
|
115
115
|
if (this.closed) {
|
|
116
|
-
throw new TransportError(TransportErrorCodes.
|
|
116
|
+
throw new TransportError(TransportErrorCodes.CONNECT_FAILED, "Connection pool has been shut down");
|
|
117
117
|
}
|
|
118
118
|
const messageBytes = encodeTransportMessage(message);
|
|
119
119
|
const socket = await this.getOrCreateConnection(target);
|
|
@@ -571,7 +571,7 @@ function createTcpTransport(nodeId, config) {
|
|
|
571
571
|
function assertNotShutdown() {
|
|
572
572
|
if (isShutdown) {
|
|
573
573
|
throw new TransportError(
|
|
574
|
-
TransportErrorCodes.
|
|
574
|
+
TransportErrorCodes.CONNECT_FAILED,
|
|
575
575
|
`TCP transport for node '${nodeId}' has been shut down`,
|
|
576
576
|
{ nodeId }
|
|
577
577
|
);
|
package/dist/distribution.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-
|
|
2
|
-
export { c as ClusterControllerConfig, d as ClusterHealth, e as ClusterHealthStatus, f as ClusterMemoryConfig, g as ClusterMetrics, h as ClusterNodeInfo, i as ClusterQueryConfig, j as CommitPointFigure, k as CoordinatorRequestFigure, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, l as ReplicationConfig } from './config-
|
|
1
|
+
import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-ujZESkJz.js';
|
|
2
|
+
export { c as ClusterControllerConfig, d as ClusterHealth, e as ClusterHealthStatus, f as ClusterMemoryConfig, g as ClusterMetrics, h as ClusterNodeInfo, i as ClusterQueryConfig, j as CommitPointFigure, k as CoordinatorRequestFigure, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, l as ReplicationConfig } from './config-ujZESkJz.js';
|
|
3
3
|
import { R as RerankAdapter } from './adapters-BQFQ4PRz.js';
|
|
4
|
-
import { B as BatchResult, L as ListParams, g as ListResult, h as SuggestParams, j as SuggestResult, Q as QueryParams, P as PreflightResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './events-
|
|
4
|
+
import { B as BatchResult, L as ListParams, g as ListResult, h as SuggestParams, j as SuggestResult, Q as QueryParams, P as PreflightResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './events-CJsXF1F9.js';
|
|
5
5
|
import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-4W_7tk1f.js';
|
|
6
6
|
import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
|
|
7
7
|
import { b as NodeCapacity, N as NodeRole } from './index-Cl5qQauj.js';
|
|
8
8
|
export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, I as IndexPartitionBytes, e as NodeEvent, f as NodeMemoryReport, a as NodeRegistration, P as PartitionAssignment, g as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-Cl5qQauj.js';
|
|
9
|
-
import { N as Narsil } from './engine-
|
|
9
|
+
import { N as Narsil } from './engine-C_HSy3iz.js';
|
|
10
10
|
export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-DvncmvuQ.js';
|
|
11
|
-
import './config-
|
|
11
|
+
import './config-CSgvApt0.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The cluster splits an index into this many partitions when
|