@olane/o-node 0.7.51 → 0.7.52
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/src/connection/index.d.ts +6 -5
- package/dist/src/connection/index.d.ts.map +1 -1
- package/dist/src/connection/index.js +6 -5
- package/dist/src/connection/interfaces/{o-node-connection-stream.config.d.ts → o-node-stream.config.d.ts} +2 -2
- package/dist/src/connection/interfaces/o-node-stream.config.d.ts.map +1 -0
- package/dist/src/connection/interfaces/stream-init-message.d.ts +29 -0
- package/dist/src/connection/interfaces/stream-init-message.d.ts.map +1 -0
- package/dist/src/connection/interfaces/stream-init-message.js +8 -0
- package/dist/src/connection/interfaces/stream-manager.config.d.ts +8 -0
- package/dist/src/connection/interfaces/stream-manager.config.d.ts.map +1 -0
- package/dist/src/connection/o-node-connection.d.ts +5 -7
- package/dist/src/connection/o-node-connection.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection.js +26 -56
- package/dist/src/connection/o-node-connection.manager.d.ts +7 -0
- package/dist/src/connection/o-node-connection.manager.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection.manager.js +23 -5
- package/dist/src/connection/{o-node-connection-stream.d.ts → o-node-stream.d.ts} +6 -6
- package/dist/src/connection/o-node-stream.d.ts.map +1 -0
- package/dist/src/connection/{o-node-connection-stream.js → o-node-stream.js} +2 -2
- package/dist/src/connection/o-node-stream.manager.d.ts +181 -0
- package/dist/src/connection/o-node-stream.manager.d.ts.map +1 -0
- package/dist/src/connection/o-node-stream.manager.js +526 -0
- package/dist/src/connection/stream-manager.events.d.ts +83 -0
- package/dist/src/connection/stream-manager.events.d.ts.map +1 -0
- package/dist/src/connection/stream-manager.events.js +18 -0
- package/dist/src/o-node.tool.d.ts +0 -1
- package/dist/src/o-node.tool.d.ts.map +1 -1
- package/dist/src/o-node.tool.js +30 -20
- package/dist/test/helpers/stream-pool-test-helpers.d.ts +0 -75
- package/dist/test/helpers/stream-pool-test-helpers.d.ts.map +1 -1
- package/dist/test/helpers/stream-pool-test-helpers.js +262 -229
- package/dist/test/parent-child-registration.spec.js +1 -0
- package/package.json +7 -7
- package/dist/src/connection/interfaces/o-node-connection-stream.config.d.ts.map +0 -1
- package/dist/src/connection/interfaces/stream-pool-manager.config.d.ts +0 -41
- package/dist/src/connection/interfaces/stream-pool-manager.config.d.ts.map +0 -1
- package/dist/src/connection/o-node-connection-stream.d.ts.map +0 -1
- package/dist/src/connection/stream-handler.d.ts +0 -102
- package/dist/src/connection/stream-handler.d.ts.map +0 -1
- package/dist/src/connection/stream-handler.js +0 -357
- package/dist/src/connection/stream-pool-manager.d.ts +0 -86
- package/dist/src/connection/stream-pool-manager.d.ts.map +0 -1
- package/dist/src/connection/stream-pool-manager.events.d.ts +0 -57
- package/dist/src/connection/stream-pool-manager.events.d.ts.map +0 -1
- package/dist/src/connection/stream-pool-manager.events.js +0 -14
- package/dist/src/connection/stream-pool-manager.js +0 -356
- /package/dist/src/connection/interfaces/{o-node-connection-stream.config.js → o-node-stream.config.js} +0 -0
- /package/dist/src/connection/interfaces/{stream-pool-manager.config.js → stream-manager.config.js} +0 -0
|
@@ -1,229 +1,262 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// import type { Connection } from '@libp2p/interface';
|
|
3
|
+
// import type { Stream } from '@olane/o-config';
|
|
4
|
+
// import { oRequest } from '@olane/o-core';
|
|
5
|
+
// import { StreamHandler } from '../../src/connection/stream-handler.js';
|
|
6
|
+
// import { oNodeConnectionStream } from '../../src/connection/o-node-connection-stream.js';
|
|
7
|
+
// import { StreamPoolManagerConfig } from '../../src/index.js';
|
|
8
|
+
// /**
|
|
9
|
+
// * Create a mock stream for testing
|
|
10
|
+
// */
|
|
11
|
+
// export function createMockStream(
|
|
12
|
+
// id: string = 'test-stream',
|
|
13
|
+
// options: {
|
|
14
|
+
// status?: 'open' | 'closed' | 'reset';
|
|
15
|
+
// writeStatus?: 'writable' | 'writing' | 'closed';
|
|
16
|
+
// readStatus?: 'readable' | 'reading' | 'closed';
|
|
17
|
+
// remoteReadStatus?: 'readable' | 'reading' | 'closed';
|
|
18
|
+
// } = {},
|
|
19
|
+
// ): any {
|
|
20
|
+
// const stream = {
|
|
21
|
+
// id,
|
|
22
|
+
// status: options.status || 'open',
|
|
23
|
+
// writeStatus: options.writeStatus || 'writable',
|
|
24
|
+
// readStatus: options.readStatus || 'readable',
|
|
25
|
+
// remoteReadStatus: options.remoteReadStatus || 'readable',
|
|
26
|
+
// protocol: '/test/1.0.0',
|
|
27
|
+
// direction: 'outbound',
|
|
28
|
+
// timeline: { open: Date.now() },
|
|
29
|
+
// source: [],
|
|
30
|
+
// sink: async () => {},
|
|
31
|
+
// close: async () => {},
|
|
32
|
+
// closeRead: async () => {},
|
|
33
|
+
// closeWrite: async () => {},
|
|
34
|
+
// abort: async () => {},
|
|
35
|
+
// reset: () => {
|
|
36
|
+
// stream.status = 'reset';
|
|
37
|
+
// },
|
|
38
|
+
// };
|
|
39
|
+
// return stream;
|
|
40
|
+
// }
|
|
41
|
+
// /**
|
|
42
|
+
// * Create a mock P2P connection for testing
|
|
43
|
+
// */
|
|
44
|
+
// export function createMockP2PConnection(
|
|
45
|
+
// id: string = 'test-connection',
|
|
46
|
+
// status: 'open' | 'closed' = 'open',
|
|
47
|
+
// ): any {
|
|
48
|
+
// const streams: any[] = [];
|
|
49
|
+
// return {
|
|
50
|
+
// id,
|
|
51
|
+
// status,
|
|
52
|
+
// remotePeer: { toString: () => 'test-peer' },
|
|
53
|
+
// streams: () => streams,
|
|
54
|
+
// newStream: async (protocols: string[]) => {
|
|
55
|
+
// const stream = createMockStream(`stream-${streams.length}`, {
|
|
56
|
+
// status: 'open',
|
|
57
|
+
// });
|
|
58
|
+
// stream.protocol = protocols[0];
|
|
59
|
+
// streams.push(stream);
|
|
60
|
+
// return stream;
|
|
61
|
+
// },
|
|
62
|
+
// close: async () => {
|
|
63
|
+
// status = 'closed';
|
|
64
|
+
// },
|
|
65
|
+
// };
|
|
66
|
+
// }
|
|
67
|
+
// /**
|
|
68
|
+
// * Create a mock StreamHandler for testing
|
|
69
|
+
// */
|
|
70
|
+
// export function createMockStreamHandler(): any {
|
|
71
|
+
// const handler = {
|
|
72
|
+
// handleIncomingStreamCalls: [] as any[],
|
|
73
|
+
// handleOutgoingStreamCalls: [] as any[],
|
|
74
|
+
// shouldFailIncoming: false,
|
|
75
|
+
// shouldFailOutgoing: false,
|
|
76
|
+
// incomingStreamPromise: null as Promise<void> | null,
|
|
77
|
+
// incomingStreamResolve: null as (() => void) | null,
|
|
78
|
+
// handleIncomingStream: async (
|
|
79
|
+
// stream: Stream,
|
|
80
|
+
// connection: Connection,
|
|
81
|
+
// requestHandler: (request: oRequest, stream: Stream) => Promise<any>,
|
|
82
|
+
// ): Promise<void> => {
|
|
83
|
+
// handler.handleIncomingStreamCalls.push({
|
|
84
|
+
// stream,
|
|
85
|
+
// connection,
|
|
86
|
+
// requestHandler,
|
|
87
|
+
// });
|
|
88
|
+
// if (handler.shouldFailIncoming) {
|
|
89
|
+
// throw new Error('Mock incoming stream handler failure');
|
|
90
|
+
// }
|
|
91
|
+
// // Create a promise that can be externally resolved to simulate stream closure
|
|
92
|
+
// return new Promise((resolve) => {
|
|
93
|
+
// handler.incomingStreamResolve = resolve;
|
|
94
|
+
// });
|
|
95
|
+
// },
|
|
96
|
+
// handleOutgoingStream: async (
|
|
97
|
+
// stream: Stream,
|
|
98
|
+
// emitter: any,
|
|
99
|
+
// config: any,
|
|
100
|
+
// requestHandler?: any,
|
|
101
|
+
// requestId?: string | number,
|
|
102
|
+
// ): Promise<any> => {
|
|
103
|
+
// handler.handleOutgoingStreamCalls.push({
|
|
104
|
+
// stream,
|
|
105
|
+
// emitter,
|
|
106
|
+
// config,
|
|
107
|
+
// requestHandler,
|
|
108
|
+
// requestId,
|
|
109
|
+
// });
|
|
110
|
+
// if (handler.shouldFailOutgoing) {
|
|
111
|
+
// throw new Error('Mock outgoing stream handler failure');
|
|
112
|
+
// }
|
|
113
|
+
// return { result: { success: true, data: {} } };
|
|
114
|
+
// },
|
|
115
|
+
// // Helper to simulate stream closure/failure
|
|
116
|
+
// simulateStreamClosure: () => {
|
|
117
|
+
// if (handler.incomingStreamResolve) {
|
|
118
|
+
// handler.incomingStreamResolve();
|
|
119
|
+
// handler.incomingStreamResolve = null;
|
|
120
|
+
// }
|
|
121
|
+
// },
|
|
122
|
+
// // Helper to simulate stream error
|
|
123
|
+
// simulateStreamError: () => {
|
|
124
|
+
// if (handler.incomingStreamResolve) {
|
|
125
|
+
// // Reject the promise by throwing after a small delay
|
|
126
|
+
// setTimeout(() => {
|
|
127
|
+
// throw new Error('Stream closed');
|
|
128
|
+
// }, 10);
|
|
129
|
+
// }
|
|
130
|
+
// },
|
|
131
|
+
// };
|
|
132
|
+
// return handler;
|
|
133
|
+
// }
|
|
134
|
+
// /**
|
|
135
|
+
// * Create a mock oNodeConnectionStream
|
|
136
|
+
// */
|
|
137
|
+
// export function createMockConnectionStream(
|
|
138
|
+
// p2pStream?: any,
|
|
139
|
+
// streamType: 'dedicated-reader' | 'request-response' | 'general' = 'general',
|
|
140
|
+
// ): oNodeConnectionStream {
|
|
141
|
+
// const mockP2PStream = p2pStream || createMockStream();
|
|
142
|
+
// return new oNodeConnectionStream(mockP2PStream, {
|
|
143
|
+
// direction: 'outbound',
|
|
144
|
+
// reusePolicy: 'reuse',
|
|
145
|
+
// remoteAddress: { toString: () => 'o://test' } as any,
|
|
146
|
+
// streamType,
|
|
147
|
+
// });
|
|
148
|
+
// }
|
|
149
|
+
// /**
|
|
150
|
+
// * Factory for creating StreamPoolManager test config
|
|
151
|
+
// */
|
|
152
|
+
// export function createStreamPoolManagerConfig(
|
|
153
|
+
// overrides: Partial<StreamPoolManagerConfig> = {},
|
|
154
|
+
// ): StreamPoolManagerConfig {
|
|
155
|
+
// const mockP2PConnection = createMockP2PConnection();
|
|
156
|
+
// const mockStreamHandler = createMockStreamHandler();
|
|
157
|
+
// let streamCounter = 0;
|
|
158
|
+
// const defaultConfig: StreamPoolManagerConfig = {
|
|
159
|
+
// readerStreamIndex: 0,
|
|
160
|
+
// streamHandler: mockStreamHandler,
|
|
161
|
+
// p2pConnection: mockP2PConnection,
|
|
162
|
+
// requestHandler: async (request: oRequest, stream: Stream) => {
|
|
163
|
+
// return { success: true, data: {} };
|
|
164
|
+
// },
|
|
165
|
+
// createStream: async () => {
|
|
166
|
+
// const p2pStream = createMockStream(`stream-${streamCounter++}`);
|
|
167
|
+
// return createMockConnectionStream(p2pStream, 'general');
|
|
168
|
+
// },
|
|
169
|
+
// };
|
|
170
|
+
// return {
|
|
171
|
+
// ...defaultConfig,
|
|
172
|
+
// ...overrides,
|
|
173
|
+
// };
|
|
174
|
+
// }
|
|
175
|
+
// /**
|
|
176
|
+
// * Event capture helper for testing event emissions
|
|
177
|
+
// */
|
|
178
|
+
// export class EventCapture {
|
|
179
|
+
// private events: Array<{ type: string; data: any; timestamp: number }> = [];
|
|
180
|
+
// constructor(private emitter: any) {}
|
|
181
|
+
// /**
|
|
182
|
+
// * Start capturing events
|
|
183
|
+
// */
|
|
184
|
+
// start(eventNames: string[]): void {
|
|
185
|
+
// for (const eventName of eventNames) {
|
|
186
|
+
// this.emitter.on(eventName, (data: any) => {
|
|
187
|
+
// this.events.push({
|
|
188
|
+
// type: eventName,
|
|
189
|
+
// data,
|
|
190
|
+
// timestamp: Date.now(),
|
|
191
|
+
// });
|
|
192
|
+
// });
|
|
193
|
+
// }
|
|
194
|
+
// }
|
|
195
|
+
// /**
|
|
196
|
+
// * Get all captured events
|
|
197
|
+
// */
|
|
198
|
+
// getEvents(): Array<{ type: string; data: any; timestamp: number }> {
|
|
199
|
+
// return this.events;
|
|
200
|
+
// }
|
|
201
|
+
// /**
|
|
202
|
+
// * Get events of specific type
|
|
203
|
+
// */
|
|
204
|
+
// getEventsByType(type: string): any[] {
|
|
205
|
+
// return this.events.filter((e) => e.type === type).map((e) => e.data);
|
|
206
|
+
// }
|
|
207
|
+
// /**
|
|
208
|
+
// * Check if event was emitted
|
|
209
|
+
// */
|
|
210
|
+
// hasEvent(type: string): boolean {
|
|
211
|
+
// return this.events.some((e) => e.type === type);
|
|
212
|
+
// }
|
|
213
|
+
// /**
|
|
214
|
+
// * Get count of specific event type
|
|
215
|
+
// */
|
|
216
|
+
// getEventCount(type: string): number {
|
|
217
|
+
// return this.events.filter((e) => e.type === type).length;
|
|
218
|
+
// }
|
|
219
|
+
// /**
|
|
220
|
+
// * Wait for specific event
|
|
221
|
+
// */
|
|
222
|
+
// async waitForEvent(type: string, timeoutMs: number = 5000): Promise<any> {
|
|
223
|
+
// const startTime = Date.now();
|
|
224
|
+
// while (Date.now() - startTime < timeoutMs) {
|
|
225
|
+
// const event = this.events.find((e) => e.type === type);
|
|
226
|
+
// if (event) {
|
|
227
|
+
// return event.data;
|
|
228
|
+
// }
|
|
229
|
+
// await new Promise((resolve) => setTimeout(resolve, 10));
|
|
230
|
+
// }
|
|
231
|
+
// throw new Error(`Timeout waiting for event: ${type}`);
|
|
232
|
+
// }
|
|
233
|
+
// /**
|
|
234
|
+
// * Clear captured events
|
|
235
|
+
// */
|
|
236
|
+
// clear(): void {
|
|
237
|
+
// this.events = [];
|
|
238
|
+
// }
|
|
239
|
+
// }
|
|
240
|
+
// /**
|
|
241
|
+
// * Helper to make a stream invalid
|
|
242
|
+
// */
|
|
243
|
+
// export function makeStreamInvalid(stream: any): void {
|
|
244
|
+
// stream.p2pStream.status = 'closed';
|
|
245
|
+
// stream.p2pStream.writeStatus = 'closed';
|
|
246
|
+
// }
|
|
247
|
+
// /**
|
|
248
|
+
// * Helper to wait for condition with timeout
|
|
249
|
+
// */
|
|
250
|
+
// export async function waitFor(
|
|
251
|
+
// condition: () => boolean,
|
|
252
|
+
// timeoutMs: number = 5000,
|
|
253
|
+
// intervalMs: number = 10,
|
|
254
|
+
// ): Promise<void> {
|
|
255
|
+
// const startTime = Date.now();
|
|
256
|
+
// while (!condition()) {
|
|
257
|
+
// if (Date.now() - startTime > timeoutMs) {
|
|
258
|
+
// throw new Error('Timeout waiting for condition');
|
|
259
|
+
// }
|
|
260
|
+
// await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
261
|
+
// }
|
|
262
|
+
// }
|
|
@@ -13,6 +13,7 @@ describe('Parent-Child Registration', () => {
|
|
|
13
13
|
});
|
|
14
14
|
describe('Basic Registration', () => {
|
|
15
15
|
it('should register child with parent during startup', async () => {
|
|
16
|
+
console.log('Starting Basic Registration Test');
|
|
16
17
|
builder = new NetworkBuilder();
|
|
17
18
|
const leader = await builder.addNode('o://leader');
|
|
18
19
|
await builder.startNode('o://leader');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-node",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@eslint/eslintrc": "^3.3.1",
|
|
42
42
|
"@eslint/js": "^9.29.0",
|
|
43
|
-
"@olane/o-test": "0.7.
|
|
43
|
+
"@olane/o-test": "0.7.52",
|
|
44
44
|
"@tsconfig/node20": "^20.1.6",
|
|
45
45
|
"@types/jest": "^30.0.0",
|
|
46
46
|
"@types/json5": "^2.2.0",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"typescript": "5.4.5"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@olane/o-config": "0.7.
|
|
64
|
-
"@olane/o-core": "0.7.
|
|
65
|
-
"@olane/o-protocol": "0.7.
|
|
66
|
-
"@olane/o-tool": "0.7.
|
|
63
|
+
"@olane/o-config": "0.7.52",
|
|
64
|
+
"@olane/o-core": "0.7.52",
|
|
65
|
+
"@olane/o-protocol": "0.7.52",
|
|
66
|
+
"@olane/o-tool": "0.7.52",
|
|
67
67
|
"debug": "^4.4.1",
|
|
68
68
|
"dotenv": "^16.5.0",
|
|
69
69
|
"json5": "^2.2.3"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "706ee0d5b546e96b6c05270b39035ee7e08dadbd"
|
|
72
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-node-connection-stream.config.d.ts","sourceRoot":"","sources":["../../../../src/connection/interfaces/o-node-connection-stream.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,CAAC;AAE7E,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,QAAQ,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@libp2p/interface';
|
|
2
|
-
import { oRequest } from '@olane/o-core';
|
|
3
|
-
import type { Stream } from '@olane/o-config';
|
|
4
|
-
import type { oNodeConnectionStream } from '../o-node-connection-stream.js';
|
|
5
|
-
import type { StreamHandler } from '../stream-handler.js';
|
|
6
|
-
export interface StreamPoolManagerConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Pool size (total number of streams to maintain)
|
|
9
|
-
* Default: 10 (1 dedicated reader + 9 request-response)
|
|
10
|
-
*/
|
|
11
|
-
poolSize?: number;
|
|
12
|
-
/**
|
|
13
|
-
* Index of the dedicated reader stream in the pool
|
|
14
|
-
* Default: 0
|
|
15
|
-
*/
|
|
16
|
-
readerStreamIndex?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Stream handler for managing stream communication
|
|
19
|
-
*/
|
|
20
|
-
streamHandler: StreamHandler;
|
|
21
|
-
/**
|
|
22
|
-
* P2P connection for creating streams
|
|
23
|
-
*/
|
|
24
|
-
p2pConnection: Connection;
|
|
25
|
-
/**
|
|
26
|
-
* Request handler for incoming requests on the dedicated reader
|
|
27
|
-
*/
|
|
28
|
-
requestHandler?: (request: oRequest, stream: Stream) => Promise<any>;
|
|
29
|
-
/**
|
|
30
|
-
* Function to create a new stream
|
|
31
|
-
*/
|
|
32
|
-
createStream: () => Promise<oNodeConnectionStream>;
|
|
33
|
-
}
|
|
34
|
-
export interface StreamPoolStats {
|
|
35
|
-
totalStreams: number;
|
|
36
|
-
healthyStreams: number;
|
|
37
|
-
readerStreamHealth: 'healthy' | 'unhealthy' | 'not-initialized';
|
|
38
|
-
requestResponseStreams: number;
|
|
39
|
-
failureCount: number;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=stream-pool-manager.config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream-pool-manager.config.d.ts","sourceRoot":"","sources":["../../../../src/connection/interfaces/stream-pool-manager.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,aAAa,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAErE;;OAEG;IACH,YAAY,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,SAAS,GAAG,WAAW,GAAG,iBAAiB,CAAC;IAChE,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-node-connection-stream.d.ts","sourceRoot":"","sources":["../../../src/connection/o-node-connection-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAuB,OAAO,EAAiB,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAE9F;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,OAAO;aAI9B,SAAS,EAAE,MAAM;aACjB,MAAM,EAAE,2BAA2B;IAJrD,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAGhB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,2BAA2B;IAOrD,QAAQ;IA6BR;;;;;;;OAOG;IACH,IAAI,OAAO,IAAI,OAAO,CAMrB;IAED;;OAEG;IACH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB7B"}
|