@delali/narsil 0.3.0 → 0.3.1-next.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/{adapters-79OIa4xm.d.ts → adapters-BQFQ4PRz.d.ts} +27 -1
- package/dist/browser/chunk-BDOSMEEP.mjs +493 -0
- package/dist/browser/chunk-EJDUFWSO.mjs +602 -0
- package/dist/browser/chunk-HOZW3PKP.mjs +9 -0
- package/dist/browser/chunk-JOVZ6HMT.mjs +4358 -0
- package/dist/browser/chunk-JPTQZWJQ.mjs +10 -0
- package/dist/browser/chunk-KPJMDPHG.mjs +24558 -0
- package/dist/browser/chunk-PGIM3HIM.mjs +2743 -0
- package/dist/browser/chunk-RHG4O77A.mjs +206 -0
- package/dist/browser/chunk-RIJSLY2I.mjs +360 -0
- package/dist/browser/durability-wiring-SRUYT3VV.mjs +3875 -0
- package/dist/browser/module-CBB2ETYP.mjs +3111 -0
- package/dist/browser/release-76MXRPGV.mjs +33 -0
- package/dist/browser/replace-RURXTGVG.mjs +57 -0
- package/dist/browser/restore-queue-EEZQO6RF.mjs +35 -0
- package/dist/browser/runtime-7ZAHCHWR.mjs +557 -0
- package/dist/browser/snapshot-OAAA5UJ7.mjs +1210 -0
- package/dist/browser/write-7D6VIK6O.mjs +208 -0
- package/dist/{capabilities-DSsOGz6F.d.ts → capabilities-DiGlB6Sr.d.ts} +68 -7
- package/dist/chunk-2RIRGOUL.mjs +113 -0
- package/dist/chunk-37CD3OKS.mjs +87 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-46D6JQIG.mjs +426 -0
- package/dist/{chunk-VMRR3DQU.mjs → chunk-5JNA5SKS.mjs} +546 -35
- package/dist/chunk-747OHOUA.mjs +11 -0
- package/dist/chunk-75XIEF6H.mjs +126 -0
- package/dist/chunk-7X5JST5L.mjs +114 -0
- package/dist/chunk-BOFBLJFZ.mjs +209 -0
- package/dist/{chunk-USKFU7J5.mjs → chunk-BWJVNZPR.mjs} +8 -1
- package/dist/chunk-C7SLA6CM.mjs +19 -0
- package/dist/{chunk-POWOTUKJ.mjs → chunk-CQUMNIIG.mjs} +3 -6
- package/dist/chunk-CVXLLEQ3.mjs +1011 -0
- package/dist/chunk-DJHHF2L5.mjs +17 -0
- package/dist/chunk-E74YLAIG.mjs +24 -0
- package/dist/{chunk-UXNWQZST.mjs → chunk-EMRMGYRE.mjs} +236 -18
- package/dist/chunk-EWZLIYHV.mjs +57 -0
- package/dist/chunk-GBEEG5AN.mjs +35 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/chunk-HJSN7UYG.mjs +10 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-HMFNFVP7.mjs +14 -0
- package/dist/chunk-J5QP52HA.mjs +1751 -0
- package/dist/{chunk-YNVIUGF5.mjs → chunk-JZVARCRZ.mjs} +3 -28
- package/dist/chunk-KOKM4PQN.mjs +52 -0
- package/dist/{chunk-B2TFROFX.mjs → chunk-KWTW6VTG.mjs} +465 -250
- package/dist/chunk-KZ3NX2P7.mjs +21 -0
- package/dist/chunk-L5ORED7V.mjs +25 -0
- package/dist/{chunk-THYRHHO2.mjs → chunk-LGAMKHA2.mjs} +2009 -2351
- package/dist/chunk-LKOB5COA.mjs +117 -0
- package/dist/chunk-LPQOEU5M.mjs +96 -0
- package/dist/{chunk-3LHGNRYE.mjs → chunk-LXWDQLTW.mjs} +7 -2
- package/dist/{chunk-L6TNPLAR.mjs → chunk-OEYI3KRB.mjs} +270 -108
- package/dist/chunk-OM362BRO.mjs +948 -0
- package/dist/chunk-OZDFA4WC.mjs +67 -0
- package/dist/chunk-P36MUFEJ.mjs +10 -0
- package/dist/chunk-PC2G76VW.mjs +2540 -0
- package/dist/{chunk-GCM3JFVA.mjs → chunk-PNEYIHA4.mjs} +11 -2
- package/dist/chunk-PNFKUCG3.mjs +1130 -0
- package/dist/chunk-Q6XWVUZX.mjs +44 -0
- package/dist/chunk-R27EMH5M.mjs +617 -0
- package/dist/{chunk-YMZCMH5M.mjs → chunk-R6A773WK.mjs} +19 -24
- package/dist/chunk-RF7PLG43.mjs +106 -0
- package/dist/chunk-RFBLQLLZ.mjs +16 -0
- package/dist/{chunk-Y3L5MDRV.mjs → chunk-RFVUDM5E.mjs} +17 -2
- package/dist/chunk-S7FL6UAH.mjs +521 -0
- package/dist/chunk-S7GNDRPS.mjs +651 -0
- package/dist/chunk-SP3NM3ZG.mjs +3537 -0
- package/dist/chunk-U476IXKQ.mjs +10 -0
- package/dist/chunk-UA3AUGNV.mjs +462 -0
- package/dist/chunk-UTG5YNXV.mjs +507 -0
- package/dist/chunk-VI4R6W25.mjs +8484 -0
- package/dist/chunk-WQBCBKY3.mjs +8 -0
- package/dist/{chunk-24RXHMEL.mjs → chunk-WVCOCKBU.mjs} +3794 -7570
- package/dist/chunk-X5CV2E2B.mjs +1 -0
- package/dist/chunk-XADZPPZI.mjs +614 -0
- package/dist/chunk-YEEQHT4V.mjs +212 -0
- package/dist/chunk-YTJCGKM4.mjs +56 -0
- package/dist/chunk-YYQIODMF.mjs +275 -0
- package/dist/chunk-ZI34TVOA.mjs +144 -0
- package/dist/{chunk-OOSIDHA3.mjs → chunk-ZKWYWW4Y.mjs} +1 -1
- package/dist/chunk-ZM7KU4YW.mjs +35 -0
- package/dist/{client-BQK6Tf6A.d.ts → client-BOStAkc5.d.ts} +160 -37
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +209 -45
- package/dist/{config-DmXULPa-.d.ts → config-Cjvzbs_j.d.ts} +51 -3
- package/dist/config-DffQlmRq.d.ts +421 -0
- package/dist/direct-executor-ZD64PPEZ.mjs +24 -0
- package/dist/distribution/coordinator/etcd.d.ts +79 -18
- package/dist/distribution/coordinator/etcd.mjs +553 -109
- package/dist/distribution/coordinator/in-memory.d.ts +4 -3
- package/dist/distribution/coordinator/in-memory.mjs +22 -3
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +79 -14
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +12 -7
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +50 -28
- package/dist/distribution.d.ts +144 -23
- package/dist/distribution.mjs +14479 -8173
- package/dist/durability-wiring-FEUBR5BT.mjs +3330 -0
- package/dist/embeddings/openai.d.ts +2 -2
- package/dist/embeddings/openai.mjs +22 -133
- package/dist/{engine-CIOyFozK.d.ts → engine-rC0vjjY-.d.ts} +165 -141
- package/dist/{memory-yFaVn2xZ.d.ts → events-DqOIg5xa.d.ts} +645 -136
- package/dist/{types-DAK7mnUZ.d.ts → index-Bkdt8nDw.d.ts} +182 -45
- package/dist/index.browser.mjs +4 -32180
- package/dist/index.d.ts +91 -20
- package/dist/index.mjs +33 -16
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +2 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/module-3S65MVCM.mjs +2151 -0
- package/dist/partial-words-DTIHO8G4.d.ts +19 -0
- package/dist/partial-words.d.ts +22 -0
- package/dist/partial-words.mjs +17 -0
- package/dist/pattern-Cledccbl.d.ts +18 -0
- package/dist/pattern.d.ts +22 -0
- package/dist/pattern.mjs +12 -0
- package/dist/persistence/durability/checkpoint-worker.d.ts +119 -72
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -18
- package/dist/react.d.ts +279 -183
- package/dist/react.mjs +201 -48
- package/dist/release-BH3DKW3T.mjs +33 -0
- package/dist/replace-CEO5KJJ3.mjs +57 -0
- package/dist/rerank-K7C4WZFG.mjs +60 -0
- package/dist/rerankers/http.d.ts +50 -0
- package/dist/rerankers/http.mjs +104 -0
- package/dist/restore-queue-KQHA7ZV2.mjs +35 -0
- package/dist/runtime-6Y4ZYXOG.mjs +177 -0
- package/dist/{schema-d5Afu03A.d.ts → schema-4W_7tk1f.d.ts} +81 -11
- package/dist/server.d.ts +13 -12
- package/dist/server.mjs +611 -80
- package/dist/snapshot-QGZPODM5.mjs +799 -0
- package/dist/synonyms-CpOAHPa-.d.ts +52 -0
- package/dist/synonyms.d.ts +22 -0
- package/dist/synonyms.mjs +12 -0
- package/dist/{tasks-CH2Dod8w.d.ts → tasks-CwPTz-tP.d.ts} +10 -3
- package/dist/thread-N3IUGUS3.mjs +697 -0
- package/dist/{types-BQDlIvfS.d.ts → types-2qoitTXg.d.ts} +1 -1
- package/dist/{types-D5OwhtsQ.d.ts → types-Cz5okLml.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +46 -4
- package/dist/vector/search-worker.mjs +21 -11
- package/dist/workers/entry.mjs +9 -6
- package/dist/write-U5RI7MAX.mjs +241 -0
- package/package.json +55 -9
- package/dist/chunk-3L4U6EJQ.mjs +0 -49
- package/dist/chunk-IFBKLBGB.mjs +0 -7
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-U7KYW4BA.mjs +0 -135
- package/dist/chunk-ZJ4CSAB2.mjs +0 -13
- package/dist/chunk-ZNZBXMP5.mjs +0 -2117
- package/dist/chunk-ZZT3EAUC.mjs +0 -11168
- package/dist/config-BhldZgaK.d.ts +0 -194
- package/dist/direct-executor-ALAVE7FC.mjs +0 -12
- package/dist/serialization/crc32-worker.d.ts +0 -20
- package/dist/serialization/crc32-worker.mjs +0 -62
- package/dist/simd-DW5AtJ6B.d.ts +0 -41
- package/dist/thread-DYHEQRVY.mjs +0 -402
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SchemaDefinition } from './schema-
|
|
1
|
+
import { S as SchemaDefinition } from './schema-4W_7tk1f.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* What a node does in a cluster. A node may hold several roles at once.
|
|
@@ -10,29 +10,6 @@ import { S as SchemaDefinition } from './schema-d5Afu03A.js';
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
type NodeRole = 'data' | 'coordinator' | 'controller';
|
|
13
|
-
/**
|
|
14
|
-
* Where one partition stands in its move between nodes.
|
|
15
|
-
*
|
|
16
|
-
* `ACTIVE` is the steady state. `INITIALISING` means a node is still filling
|
|
17
|
-
* it, `MIGRATING` means it is moving, `DECOMMISSIONING` means it is being
|
|
18
|
-
* drained, and `UNASSIGNED` means no node holds it.
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
type PartitionState = 'UNASSIGNED' | 'INITIALISING' | 'ACTIVE' | 'MIGRATING' | 'DECOMMISSIONING';
|
|
23
|
-
/**
|
|
24
|
-
* Why a partition stays `UNASSIGNED` after the controller has asked its last holders for a copy.
|
|
25
|
-
*
|
|
26
|
-
* `HOLDER_OFFLINE` means a last holder has yet to register again, so the controller is still waiting for it.
|
|
27
|
-
* `HOLDER_UNREACHABLE` means a registered holder left the request unanswered or answered with a payload the
|
|
28
|
-
* controller could not read. `HOLDER_IDENTITY_MISMATCH` means a holder answered under a different index identity,
|
|
29
|
-
* so its copy holds the documents of an earlier index of the same name, or it keeps no copy of that name at all.
|
|
30
|
-
* `HOLDER_WITHOUT_DATA` means every holder answered under the coordinator's identity with a list that left the
|
|
31
|
-
* partition out.
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
type UnassignedReason = 'HOLDER_OFFLINE' | 'HOLDER_UNREACHABLE' | 'HOLDER_IDENTITY_MISMATCH' | 'HOLDER_WITHOUT_DATA';
|
|
36
13
|
/**
|
|
37
14
|
* What one node has to offer, which the allocator weighs when it places
|
|
38
15
|
* partitions.
|
|
@@ -47,6 +24,46 @@ interface NodeCapacity {
|
|
|
47
24
|
/** The node can give this much disk to durability, and reports `null` when it keeps nothing on disk. */
|
|
48
25
|
diskBytes: number | null;
|
|
49
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* How much memory one node uses against its limits, which the node publishes with every heartbeat so that the cluster
|
|
29
|
+
* stops taking writes before the node runs out of memory.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
interface NodeMemoryReport {
|
|
34
|
+
/** The whole process holds this many bytes of resident memory, including vectors and segments kept outside the heap. */
|
|
35
|
+
processBytes: number;
|
|
36
|
+
/** The process may hold this many bytes, which is the container's memory limit or else the host's total memory. */
|
|
37
|
+
processLimitBytes: number;
|
|
38
|
+
/**
|
|
39
|
+
* The main thread's old generation uses this many bytes. The old generation is the V8 heap without the young
|
|
40
|
+
* generation, which holds new objects until the collector empties it.
|
|
41
|
+
*/
|
|
42
|
+
heapBytes: number;
|
|
43
|
+
/**
|
|
44
|
+
* The main thread's old generation may grow to this many bytes. This is the `--max-old-space-size` figure where the
|
|
45
|
+
* process sets it, and otherwise V8's heap limit less the young generation's share.
|
|
46
|
+
*/
|
|
47
|
+
heapLimitBytes: number;
|
|
48
|
+
/**
|
|
49
|
+
* This is true while the node refuses writes, which starts once either figure passes the block fraction of its limit
|
|
50
|
+
* and ends once both fall below the resume fraction. Every index with a copy on the node refuses inserts and updates
|
|
51
|
+
* with `CLUSTER_WRITE_BLOCKED` while it holds.
|
|
52
|
+
*/
|
|
53
|
+
full: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The estimated size of each partition copy that one node holds of one index, which the controller weighs when it
|
|
57
|
+
* places further copies.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
interface IndexPartitionBytes {
|
|
62
|
+
/** The partitions belong to this index. */
|
|
63
|
+
indexName: string;
|
|
64
|
+
/** Each entry pairs a partition id with the estimated bytes that the node's copy of it holds. */
|
|
65
|
+
partitions: Array<[partitionId: number, bytes: number]>;
|
|
66
|
+
}
|
|
50
67
|
/**
|
|
51
68
|
* What a node publishes about itself when it joins a cluster.
|
|
52
69
|
*
|
|
@@ -67,7 +84,69 @@ interface NodeRegistration {
|
|
|
67
84
|
version: string;
|
|
68
85
|
/** These free-form labels are where a zone or rack goes for zone-aware allocation. */
|
|
69
86
|
metadata?: Record<string, string>;
|
|
87
|
+
/** The node uses this much memory, and the field is absent where the node's runtime cannot measure it. */
|
|
88
|
+
memory?: NodeMemoryReport;
|
|
89
|
+
/**
|
|
90
|
+
* The node's copies hold these estimated sizes. The controller counts a partition that no node reports as 50 MB
|
|
91
|
+
* when it places copies.
|
|
92
|
+
*/
|
|
93
|
+
partitionBytes?: IndexPartitionBytes[];
|
|
94
|
+
/**
|
|
95
|
+
* The node is leaving the cluster where this is true, so the controller places no new copy on it and moves every
|
|
96
|
+
* copy it holds to other nodes. An absent value counts as false.
|
|
97
|
+
*/
|
|
98
|
+
draining?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* How long the coordinator is certain to keep holding a node's registration,
|
|
102
|
+
* measured from the moment the node sent the last renewal that the
|
|
103
|
+
* coordinator accepted.
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
interface RegistrationLease {
|
|
108
|
+
/** The registration stays held for at least this many more milliseconds, and the figure falls below zero once that time has passed. */
|
|
109
|
+
remainingMs: number;
|
|
110
|
+
/** The coordinator granted the lease for this many milliseconds, which is the lifetime that `remainingMs` counts down from. */
|
|
111
|
+
ttlMs: number;
|
|
70
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Tells watchers that a node joined or left.
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
interface NodeEvent {
|
|
119
|
+
/** This says which change it is. */
|
|
120
|
+
type: 'node_joined' | 'node_left';
|
|
121
|
+
/** This node joined or left. */
|
|
122
|
+
nodeId: string;
|
|
123
|
+
/** The node published this on joining, and it is `null` when the node left. */
|
|
124
|
+
registration: NodeRegistration | null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Where one partition stands in its move between nodes.
|
|
129
|
+
*
|
|
130
|
+
* `ACTIVE` is the steady state. `INITIALISING` means a node is still filling
|
|
131
|
+
* it, `MIGRATING` means it is moving, `DECOMMISSIONING` means it is being
|
|
132
|
+
* drained, and `UNASSIGNED` means no node holds it.
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
type PartitionState = 'UNASSIGNED' | 'INITIALISING' | 'ACTIVE' | 'MIGRATING' | 'DECOMMISSIONING';
|
|
137
|
+
/**
|
|
138
|
+
* Why a partition stays `UNASSIGNED` after the controller has asked its last holders for a copy.
|
|
139
|
+
*
|
|
140
|
+
* `HOLDER_OFFLINE` means a last holder has yet to register again, so the controller is still waiting for it.
|
|
141
|
+
* `HOLDER_UNREACHABLE` means a registered holder left the request unanswered or answered with a payload the
|
|
142
|
+
* controller could not read. `HOLDER_IDENTITY_MISMATCH` means a holder answered under a different index identity,
|
|
143
|
+
* so its copy holds the documents of an earlier index of the same name, or it keeps no copy of that name at all.
|
|
144
|
+
* `HOLDER_WITHOUT_DATA` means every holder answered under the coordinator's identity with a list that left the
|
|
145
|
+
* partition out.
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
type UnassignedReason = 'HOLDER_OFFLINE' | 'HOLDER_UNREACHABLE' | 'HOLDER_IDENTITY_MISMATCH' | 'HOLDER_WITHOUT_DATA';
|
|
71
150
|
/**
|
|
72
151
|
* Which nodes hold one partition, and where that partition stands.
|
|
73
152
|
*
|
|
@@ -80,6 +159,12 @@ interface PartitionAssignment {
|
|
|
80
159
|
replicas: string[];
|
|
81
160
|
/** These replicas are current enough to be promoted, which is the set a failover picks from. */
|
|
82
161
|
inSyncSet: string[];
|
|
162
|
+
/**
|
|
163
|
+
* The controller is moving the copies on these nodes elsewhere, and each one stays in `replicas` and in `inSyncSet`
|
|
164
|
+
* until the copies outside this list reach the replication factor in sync. The field is absent while no move is
|
|
165
|
+
* under way.
|
|
166
|
+
*/
|
|
167
|
+
removingReplicas?: string[];
|
|
83
168
|
/** These nodes still hold a copy of a partition no node serves, and the field stays until the partition is `ACTIVE`. */
|
|
84
169
|
lastHolders?: string[];
|
|
85
170
|
/** This says where the partition stands in its move between nodes. */
|
|
@@ -105,19 +190,19 @@ interface AllocationTable {
|
|
|
105
190
|
replicationFactor: number;
|
|
106
191
|
/** These assignments are keyed by partition id. */
|
|
107
192
|
assignments: Map<number, PartitionAssignment>;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
193
|
+
/**
|
|
194
|
+
* The name of the index that serves this index name since a partition count change finished. A table that carries
|
|
195
|
+
* it holds no assignments, and every read, write, and metadata lookup for this name goes to that index. The field
|
|
196
|
+
* is absent until the first change of the partition count.
|
|
197
|
+
*/
|
|
198
|
+
generation?: string;
|
|
199
|
+
/**
|
|
200
|
+
* The identity of the index that this table allocates, which the controller copies from the index metadata. When a
|
|
201
|
+
* node holds a table for a name and receives one with a different uuid, it takes the received table whatever the two
|
|
202
|
+
* versions are, because the name then refers to another index. The field is absent from a table that an earlier
|
|
203
|
+
* release wrote.
|
|
204
|
+
*/
|
|
205
|
+
indexUuid?: string;
|
|
121
206
|
}
|
|
122
207
|
/**
|
|
123
208
|
* Tells watchers that an index's allocation changed.
|
|
@@ -186,6 +271,39 @@ interface ClusterCoordinator {
|
|
|
186
271
|
* @param nodeId - The node to remove.
|
|
187
272
|
*/
|
|
188
273
|
deregisterNode(nodeId: string): Promise<void>;
|
|
274
|
+
/**
|
|
275
|
+
* Reports how much longer the coordinator is certain to hold a node's
|
|
276
|
+
* registration, which is how long the node may keep acting as a primary.
|
|
277
|
+
*
|
|
278
|
+
* A primary refuses writes with `PARTITION_NOT_PRIMARY` once this time runs
|
|
279
|
+
* out, because the controller may then have promoted another copy. A
|
|
280
|
+
* coordinator that leaves this member out gets no such fence, so a primary
|
|
281
|
+
* that loses touch with it keeps answering writes until it reads a newer
|
|
282
|
+
* allocation table.
|
|
283
|
+
*
|
|
284
|
+
* @param nodeId - The node whose registration this process wrote.
|
|
285
|
+
* @returns The time left and the lease lifetime it counts against, or
|
|
286
|
+
* `null` where this process holds no live registration for the node.
|
|
287
|
+
*/
|
|
288
|
+
registrationLease?(nodeId: string): RegistrationLease | null;
|
|
289
|
+
/**
|
|
290
|
+
* Renews a node's registration lease once and reports how much longer the
|
|
291
|
+
* coordinator holds the registration after that renewal.
|
|
292
|
+
*
|
|
293
|
+
* A primary calls this before it refuses a write because
|
|
294
|
+
* {@link ClusterCoordinator.registrationLease} reports too little time
|
|
295
|
+
* left, so that a node whose renewals ran late behind its own work keeps
|
|
296
|
+
* serving. The coordinator cannot renew a lease that has already expired,
|
|
297
|
+
* so an accepted renewal shows that the registration stayed held
|
|
298
|
+
* throughout. A coordinator that leaves this member out leaves the
|
|
299
|
+
* primary with the reading from `registrationLease` alone.
|
|
300
|
+
*
|
|
301
|
+
* @param nodeId - The node whose registration this process wrote.
|
|
302
|
+
* @returns The time left after the renewal and the lease lifetime it counts
|
|
303
|
+
* against, or `null` where this process holds no live registration for the
|
|
304
|
+
* node.
|
|
305
|
+
*/
|
|
306
|
+
confirmRegistrationLease?(nodeId: string): Promise<RegistrationLease | null>;
|
|
189
307
|
/**
|
|
190
308
|
* Lists the nodes currently published.
|
|
191
309
|
*
|
|
@@ -207,17 +325,29 @@ interface ClusterCoordinator {
|
|
|
207
325
|
*/
|
|
208
326
|
getAllocation(indexName: string): Promise<AllocationTable | null>;
|
|
209
327
|
/**
|
|
210
|
-
* Writes one index's allocation
|
|
211
|
-
*
|
|
328
|
+
* Writes one index's allocation without checking the stored version or the
|
|
329
|
+
* controller lease, which only a test or an operator's repair should do.
|
|
212
330
|
*
|
|
213
331
|
* @param indexName - The index to write.
|
|
214
332
|
* @param table - The allocation to store.
|
|
215
|
-
* @
|
|
216
|
-
* while no allocation exists, or omit it to write unconditionally.
|
|
217
|
-
* @returns True when the write went through, and false when the expected
|
|
218
|
-
* version no longer matched.
|
|
333
|
+
* @returns True once the write has gone through.
|
|
219
334
|
*/
|
|
220
|
-
putAllocation(indexName: string, table: AllocationTable
|
|
335
|
+
putAllocation(indexName: string, table: AllocationTable): Promise<boolean>;
|
|
336
|
+
/**
|
|
337
|
+
* Writes one index's allocation while the stored table still carries the
|
|
338
|
+
* version that the caller read and the writer still holds the controller
|
|
339
|
+
* lease, checking both in one atomic operation.
|
|
340
|
+
*
|
|
341
|
+
* @param indexName - The index to write.
|
|
342
|
+
* @param table - The allocation to store.
|
|
343
|
+
* @param expectedVersion - The version that the caller read, or `null` to
|
|
344
|
+
* write only while the index has no allocation yet.
|
|
345
|
+
* @param writerNodeId - The node that writes the table, which must hold the
|
|
346
|
+
* `_narsil/controller` lease when the write takes effect.
|
|
347
|
+
* @returns True when the write went through, and false when the stored
|
|
348
|
+
* version no longer matched or the writer did not hold the controller lease.
|
|
349
|
+
*/
|
|
350
|
+
putAllocation(indexName: string, table: AllocationTable, expectedVersion: number | null, writerNodeId: string): Promise<boolean>;
|
|
221
351
|
/**
|
|
222
352
|
* Removes one index's allocation, which is the last step of dropping the
|
|
223
353
|
* index. Deleting an allocation that does not exist does nothing.
|
|
@@ -291,6 +421,13 @@ interface ClusterCoordinator {
|
|
|
291
421
|
* @returns True when the write went through.
|
|
292
422
|
*/
|
|
293
423
|
compareAndSet(key: string, expected: Uint8Array | null, value: Uint8Array): Promise<boolean>;
|
|
424
|
+
/**
|
|
425
|
+
* Removes one key of cluster metadata, and does nothing when the key already
|
|
426
|
+
* holds nothing.
|
|
427
|
+
*
|
|
428
|
+
* @param key - The key to remove.
|
|
429
|
+
*/
|
|
430
|
+
delete(key: string): Promise<void>;
|
|
294
431
|
/**
|
|
295
432
|
* Reads one index's schema, which is how a node joining later learns the
|
|
296
433
|
* layout of an index it has never held.
|
|
@@ -340,4 +477,4 @@ interface ClusterCoordinator {
|
|
|
340
477
|
shutdown(): Promise<void>;
|
|
341
478
|
}
|
|
342
479
|
|
|
343
|
-
export type { AllocationTable as A, ClusterCoordinator as C, NodeRole as N, PartitionAssignment as P, SchemaEvent as S, UnassignedReason as U, NodeRegistration as a, NodeCapacity as b, AllocationConstraints as c, AllocationEvent as d, NodeEvent as e,
|
|
480
|
+
export type { AllocationTable as A, ClusterCoordinator as C, IndexPartitionBytes as I, NodeRole as N, PartitionAssignment as P, RegistrationLease as R, SchemaEvent as S, UnassignedReason as U, NodeRegistration as a, NodeCapacity as b, AllocationConstraints as c, AllocationEvent as d, NodeEvent as e, NodeMemoryReport as f, PartitionState as g };
|