@rpckit/cluster 0.9.99
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 +61 -0
- package/dist/cluster.d.ts +4 -0
- package/dist/cluster.d.ts.map +1 -0
- package/dist/cluster.js +219 -0
- package/dist/cluster.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @rpckit/cluster
|
|
2
|
+
|
|
3
|
+
Cluster meta-transport for rpckit. Provides m-of-n quorum consensus across multiple transports.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rpckit/core @rpckit/cluster
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { ElectrumCashSchema } from '@rpckit/core/electrum-cash'
|
|
15
|
+
import { cluster } from '@rpckit/cluster'
|
|
16
|
+
import { webSocket } from '@rpckit/websocket'
|
|
17
|
+
|
|
18
|
+
const transport = cluster<ElectrumCashSchema>(
|
|
19
|
+
[
|
|
20
|
+
webSocket('wss://server1.example.com:50004'),
|
|
21
|
+
webSocket('wss://server2.example.com:50004'),
|
|
22
|
+
webSocket('wss://server3.example.com:50004'),
|
|
23
|
+
],
|
|
24
|
+
{ quorum: 2, timeout: 10000 }, // Require 2-of-3 agreement
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
await transport.connect()
|
|
28
|
+
|
|
29
|
+
// Only resolves when 2 servers return identical results
|
|
30
|
+
const tip = await transport.request('blockchain.headers.get_tip')
|
|
31
|
+
|
|
32
|
+
await transport.close()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Options
|
|
36
|
+
|
|
37
|
+
- `quorum` - Number of identical responses required (must be ≥1 and ≤ number of transports)
|
|
38
|
+
- `timeout` - Timeout in ms for quorum to be reached
|
|
39
|
+
|
|
40
|
+
## How It Works
|
|
41
|
+
|
|
42
|
+
1. Request is sent to all transports in parallel
|
|
43
|
+
2. Responses are compared using deep equality
|
|
44
|
+
3. When `quorum` transports return identical results, that result is returned
|
|
45
|
+
4. If quorum cannot be reached (too many errors or different results), an error is thrown
|
|
46
|
+
|
|
47
|
+
Subscriptions also support quorum - notifications are only forwarded when enough transports agree.
|
|
48
|
+
|
|
49
|
+
## Response Observation
|
|
50
|
+
|
|
51
|
+
Monitor all requests and responses from individual transports:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const unsub = transport.onResponse(({ method, params, transport, response, error, status }) => {
|
|
55
|
+
console.log(`${method} via ${transport.url}: ${status}`)
|
|
56
|
+
})
|
|
57
|
+
// Later: unsub()
|
|
58
|
+
|
|
59
|
+
// Access underlying transports
|
|
60
|
+
console.log(transport.transports)
|
|
61
|
+
```
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClusterTransport, ClusterTransportOptions } from '@rpckit/core';
|
|
2
|
+
export declare function cluster<T>(transports: [T], options: ClusterTransportOptions): T;
|
|
3
|
+
export declare function cluster<T>(transports: [T, T, ...T[]], options: ClusterTransportOptions): ClusterTransport;
|
|
4
|
+
//# sourceMappingURL=cluster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../src/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAChB,uBAAuB,EAKxB,MAAM,cAAc,CAAA;AA4CrB,wBAAgB,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,GAAG,CAAC,CAAA;AAGhF,wBAAgB,OAAO,CAAC,CAAC,EACvB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAC1B,OAAO,EAAE,uBAAuB,GAC/B,gBAAgB,CAAA"}
|
package/dist/cluster.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
function deepEqual(a, b) {
|
|
2
|
+
if (a === b)
|
|
3
|
+
return true;
|
|
4
|
+
if (a === null ||
|
|
5
|
+
b === null ||
|
|
6
|
+
typeof a !== 'object' ||
|
|
7
|
+
typeof b !== 'object')
|
|
8
|
+
return false;
|
|
9
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
10
|
+
return false;
|
|
11
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
12
|
+
if (a.length !== b.length)
|
|
13
|
+
return false;
|
|
14
|
+
return a.every((v, i) => deepEqual(v, b[i]));
|
|
15
|
+
}
|
|
16
|
+
const keysA = Object.keys(a);
|
|
17
|
+
const keysB = Object.keys(b);
|
|
18
|
+
if (keysA.length !== keysB.length)
|
|
19
|
+
return false;
|
|
20
|
+
return keysA.every((key) => deepEqual(a[key], b[key]));
|
|
21
|
+
}
|
|
22
|
+
function checkQuorum(results, quorum) {
|
|
23
|
+
for (const candidate of results) {
|
|
24
|
+
const count = results.filter((r) => deepEqual(r, candidate)).length;
|
|
25
|
+
if (count >= quorum) {
|
|
26
|
+
return { reached: true, value: candidate };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return { reached: false };
|
|
30
|
+
}
|
|
31
|
+
// Implementation
|
|
32
|
+
export function cluster(transports, options) {
|
|
33
|
+
const { quorum, timeout = 10000 } = options;
|
|
34
|
+
if (quorum < 1) {
|
|
35
|
+
throw new Error(`Quorum must be at least 1, got ${quorum}`);
|
|
36
|
+
}
|
|
37
|
+
if (quorum > transports.length) {
|
|
38
|
+
throw new Error(`Quorum ${quorum} exceeds number of transports (${transports.length})`);
|
|
39
|
+
}
|
|
40
|
+
// Single transport with quorum=1: no need to wrap
|
|
41
|
+
if (transports.length === 1) {
|
|
42
|
+
return transports[0];
|
|
43
|
+
}
|
|
44
|
+
const responseListeners = new Set();
|
|
45
|
+
return {
|
|
46
|
+
url: transports.map((t) => t.url).join(','),
|
|
47
|
+
get transports() {
|
|
48
|
+
return transports;
|
|
49
|
+
},
|
|
50
|
+
onResponse(listener) {
|
|
51
|
+
responseListeners.add(listener);
|
|
52
|
+
return () => {
|
|
53
|
+
responseListeners.delete(listener);
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
async connect() {
|
|
57
|
+
await Promise.all(transports.map((t) => t.connect()));
|
|
58
|
+
},
|
|
59
|
+
async request(method, ...params) {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
const results = [];
|
|
62
|
+
let settled = false;
|
|
63
|
+
let completed = 0;
|
|
64
|
+
const timer = setTimeout(() => {
|
|
65
|
+
if (!settled) {
|
|
66
|
+
settled = true;
|
|
67
|
+
reject(new Error('Cluster quorum not reached within timeout'));
|
|
68
|
+
}
|
|
69
|
+
}, timeout);
|
|
70
|
+
for (const transport of transports) {
|
|
71
|
+
// biome-ignore lint/suspicious/noExplicitAny: meta-transport delegates with erased types
|
|
72
|
+
;
|
|
73
|
+
transport.request(method, ...params).then((result) => {
|
|
74
|
+
for (const listener of responseListeners) {
|
|
75
|
+
listener({
|
|
76
|
+
method,
|
|
77
|
+
params,
|
|
78
|
+
transport,
|
|
79
|
+
response: result,
|
|
80
|
+
status: 'success',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (settled)
|
|
84
|
+
return;
|
|
85
|
+
results.push(result);
|
|
86
|
+
completed++;
|
|
87
|
+
const { reached, value } = checkQuorum(results, quorum);
|
|
88
|
+
if (reached) {
|
|
89
|
+
settled = true;
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
resolve(value);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (completed === transports.length && !settled) {
|
|
95
|
+
settled = true;
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
reject(new Error('Cluster quorum not reached'));
|
|
98
|
+
}
|
|
99
|
+
}, (error) => {
|
|
100
|
+
for (const listener of responseListeners) {
|
|
101
|
+
listener({
|
|
102
|
+
method,
|
|
103
|
+
params,
|
|
104
|
+
transport,
|
|
105
|
+
error,
|
|
106
|
+
status: 'error',
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (settled)
|
|
110
|
+
return;
|
|
111
|
+
completed++;
|
|
112
|
+
const remaining = transports.length - completed;
|
|
113
|
+
const maxPossible = results.length + remaining;
|
|
114
|
+
if (maxPossible < quorum) {
|
|
115
|
+
settled = true;
|
|
116
|
+
clearTimeout(timer);
|
|
117
|
+
reject(new Error('Cluster quorum not reachable'));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
async subscribe(method, ...args) {
|
|
124
|
+
const onData = args.pop();
|
|
125
|
+
const params = args;
|
|
126
|
+
const unsubs = [];
|
|
127
|
+
const initialResults = [];
|
|
128
|
+
let initialResolved = false;
|
|
129
|
+
const notifiedValues = new Set();
|
|
130
|
+
// Collect notifications and check quorum before forwarding
|
|
131
|
+
const pendingNotifications = [];
|
|
132
|
+
function handleNotification(data) {
|
|
133
|
+
pendingNotifications.push(data);
|
|
134
|
+
const { reached, value } = checkQuorum(pendingNotifications, quorum);
|
|
135
|
+
if (reached) {
|
|
136
|
+
const key = JSON.stringify(value);
|
|
137
|
+
if (!notifiedValues.has(key)) {
|
|
138
|
+
notifiedValues.add(key);
|
|
139
|
+
onData(value);
|
|
140
|
+
}
|
|
141
|
+
// Remove matched values from pending
|
|
142
|
+
let removed = 0;
|
|
143
|
+
for (let i = pendingNotifications.length - 1; i >= 0 && removed < quorum; i--) {
|
|
144
|
+
if (deepEqual(pendingNotifications[i], value)) {
|
|
145
|
+
pendingNotifications.splice(i, 1);
|
|
146
|
+
removed++;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Wait for quorum on initial subscription results
|
|
152
|
+
const initialResult = await new Promise((resolve, reject) => {
|
|
153
|
+
let completed = 0;
|
|
154
|
+
const timer = setTimeout(() => {
|
|
155
|
+
if (!initialResolved) {
|
|
156
|
+
initialResolved = true;
|
|
157
|
+
reject(new Error('Cluster subscription quorum not reached within timeout'));
|
|
158
|
+
}
|
|
159
|
+
}, timeout);
|
|
160
|
+
for (const transport of transports) {
|
|
161
|
+
let isFirstCallback = true;
|
|
162
|
+
transport.subscribe(method, ...params, (data) => {
|
|
163
|
+
if (isFirstCallback) {
|
|
164
|
+
// This is the initial result
|
|
165
|
+
isFirstCallback = false;
|
|
166
|
+
if (initialResolved)
|
|
167
|
+
return;
|
|
168
|
+
initialResults.push(data);
|
|
169
|
+
completed++;
|
|
170
|
+
const { reached, value } = checkQuorum(initialResults, quorum);
|
|
171
|
+
if (reached) {
|
|
172
|
+
initialResolved = true;
|
|
173
|
+
clearTimeout(timer);
|
|
174
|
+
resolve(value);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (completed === transports.length && !initialResolved) {
|
|
178
|
+
initialResolved = true;
|
|
179
|
+
clearTimeout(timer);
|
|
180
|
+
reject(new Error('Cluster subscription quorum not reached'));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// This is a notification
|
|
185
|
+
handleNotification(data);
|
|
186
|
+
}
|
|
187
|
+
}).then((unsub) => {
|
|
188
|
+
unsubs.push(unsub);
|
|
189
|
+
}, (_error) => {
|
|
190
|
+
if (initialResolved)
|
|
191
|
+
return;
|
|
192
|
+
completed++;
|
|
193
|
+
const remaining = transports.length - completed;
|
|
194
|
+
const maxPossible = initialResults.length + remaining;
|
|
195
|
+
if (maxPossible < quorum) {
|
|
196
|
+
initialResolved = true;
|
|
197
|
+
clearTimeout(timer);
|
|
198
|
+
reject(new Error('Cluster subscription quorum not reachable'));
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
// Deliver initial result
|
|
204
|
+
onData(initialResult);
|
|
205
|
+
const unsub = async (cleanup) => {
|
|
206
|
+
// Unsubscribe from all transports
|
|
207
|
+
for (const u of unsubs) {
|
|
208
|
+
await u(cleanup);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
return unsub;
|
|
212
|
+
},
|
|
213
|
+
async close() {
|
|
214
|
+
responseListeners.clear();
|
|
215
|
+
await Promise.all(transports.map((t) => t.close()));
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=cluster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster.js","sourceRoot":"","sources":["../src/cluster.ts"],"names":[],"mappings":"AAUA,SAAS,SAAS,CAAC,CAAU,EAAE,CAAU;IACvC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxB,IACE,CAAC,KAAK,IAAI;QACV,CAAC,KAAK,IAAI;QACV,OAAO,CAAC,KAAK,QAAQ;QACrB,OAAO,CAAC,KAAK,QAAQ;QAErB,OAAO,KAAK,CAAA;IAEd,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;YAAE,OAAO,KAAK,CAAA;QACvC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAA4B,CAAC,CAAA;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,IA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,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACrD,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rpckit/cluster",
|
|
3
|
+
"version": "0.9.99",
|
|
4
|
+
"description": "Cluster meta-transport for rpckit with m-of-n quorum consensus",
|
|
5
|
+
"author": "mainnet_pat",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"json-rpc",
|
|
22
|
+
"rpc",
|
|
23
|
+
"cluster",
|
|
24
|
+
"quorum",
|
|
25
|
+
"consensus",
|
|
26
|
+
"typescript"
|
|
27
|
+
],
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/mainnet-pat/rpckit.git",
|
|
31
|
+
"directory": "packages/cluster"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://rpckit.dev",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/mainnet-pat/rpckit/issues"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@rpckit/core": "*"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"typescript": "^5.7.0"
|
|
45
|
+
}
|
|
46
|
+
}
|