@olane/o-node 0.7.49 → 0.7.51
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 +4 -0
- package/dist/src/connection/index.d.ts.map +1 -1
- package/dist/src/connection/index.js +4 -0
- package/dist/src/connection/interfaces/o-node-connection-stream.config.d.ts +8 -0
- package/dist/src/connection/interfaces/o-node-connection-stream.config.d.ts.map +1 -1
- package/dist/src/connection/interfaces/stream-pool-manager.config.d.ts +41 -0
- package/dist/src/connection/interfaces/stream-pool-manager.config.d.ts.map +1 -0
- package/dist/src/connection/interfaces/stream-pool-manager.config.js +1 -0
- package/dist/src/connection/o-node-connection-stream.d.ts +12 -0
- package/dist/src/connection/o-node-connection-stream.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection-stream.js +18 -0
- package/dist/src/connection/stream-pool-manager.d.ts +86 -0
- package/dist/src/connection/stream-pool-manager.d.ts.map +1 -0
- package/dist/src/connection/stream-pool-manager.events.d.ts +57 -0
- package/dist/src/connection/stream-pool-manager.events.d.ts.map +1 -0
- package/dist/src/connection/stream-pool-manager.events.js +14 -0
- package/dist/src/connection/stream-pool-manager.js +356 -0
- package/dist/src/interfaces/i-registrable-node.d.ts +7 -0
- package/dist/src/interfaces/i-registrable-node.d.ts.map +1 -1
- package/dist/src/managers/o-registration.manager.d.ts.map +1 -1
- package/dist/src/managers/o-registration.manager.js +11 -1
- package/dist/src/o-node.tool.d.ts.map +1 -1
- package/dist/src/o-node.tool.js +16 -13
- package/dist/test/connection-management.spec.js +24 -24
- package/dist/test/helpers/stream-pool-test-helpers.d.ts +76 -0
- package/dist/test/helpers/stream-pool-test-helpers.d.ts.map +1 -0
- package/dist/test/helpers/stream-pool-test-helpers.js +229 -0
- package/dist/test/network-communication.spec.js +68 -66
- package/dist/test/stream-pool-manager.spec.d.ts +1 -0
- package/dist/test/stream-pool-manager.spec.d.ts.map +1 -0
- package/dist/test/stream-pool-manager.spec.js +424 -0
- package/package.json +7 -7
|
@@ -2,6 +2,10 @@ export * from './o-node-connection.js';
|
|
|
2
2
|
export * from './o-node-connection.manager.js';
|
|
3
3
|
export * from './interfaces/o-node-connection.config.js';
|
|
4
4
|
export * from './interfaces/o-node-connection-manager.config.js';
|
|
5
|
+
export * from './interfaces/o-node-connection-stream.config.js';
|
|
6
|
+
export * from './interfaces/stream-pool-manager.config.js';
|
|
5
7
|
export * from './o-node-connection-stream.js';
|
|
6
8
|
export * from './stream-handler.config.js';
|
|
9
|
+
export * from './stream-pool-manager.js';
|
|
10
|
+
export * from './stream-pool-manager.events.js';
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kDAAkD,CAAC;AACjE,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC"}
|
|
@@ -2,5 +2,9 @@ export * from './o-node-connection.js';
|
|
|
2
2
|
export * from './o-node-connection.manager.js';
|
|
3
3
|
export * from './interfaces/o-node-connection.config.js';
|
|
4
4
|
export * from './interfaces/o-node-connection-manager.config.js';
|
|
5
|
+
export * from './interfaces/o-node-connection-stream.config.js';
|
|
6
|
+
export * from './interfaces/stream-pool-manager.config.js';
|
|
5
7
|
export * from './o-node-connection-stream.js';
|
|
6
8
|
export * from './stream-handler.config.js';
|
|
9
|
+
export * from './stream-pool-manager.js';
|
|
10
|
+
export * from './stream-pool-manager.events.js';
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { oAddress } from '@olane/o-core';
|
|
2
2
|
import { StreamReusePolicy } from '../stream-handler.config';
|
|
3
|
+
/**
|
|
4
|
+
* Stream type defines the role and usage pattern of a stream:
|
|
5
|
+
* - 'dedicated-reader': Stream exclusively used for reading incoming requests (background reader)
|
|
6
|
+
* - 'request-response': Stream used for outgoing request-response cycles
|
|
7
|
+
* - 'general': Stream with no specific role (default, backward compatible)
|
|
8
|
+
*/
|
|
9
|
+
export type StreamType = 'dedicated-reader' | 'request-response' | 'general';
|
|
3
10
|
export interface oNodeConnectionStreamConfig {
|
|
4
11
|
direction: 'inbound' | 'outbound';
|
|
5
12
|
reusePolicy: StreamReusePolicy;
|
|
6
13
|
remoteAddress: oAddress;
|
|
14
|
+
streamType?: StreamType;
|
|
7
15
|
}
|
|
8
16
|
//# sourceMappingURL=o-node-connection-stream.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,QAAQ,CAAC;CACzB"}
|
|
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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,6 +29,18 @@ export declare class oNodeConnectionStream extends oObject {
|
|
|
29
29
|
* Gets the age of the stream in milliseconds
|
|
30
30
|
*/
|
|
31
31
|
get age(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the stream type (defaults to 'general' for backward compatibility)
|
|
34
|
+
*/
|
|
35
|
+
get streamType(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if this stream is designated as a dedicated reader
|
|
38
|
+
*/
|
|
39
|
+
get isDedicatedReader(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if this stream is designated for request-response cycles
|
|
42
|
+
*/
|
|
43
|
+
get isRequestResponse(): boolean;
|
|
32
44
|
close(): Promise<void>;
|
|
33
45
|
}
|
|
34
46
|
//# sourceMappingURL=o-node-connection-stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB7B"}
|
|
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"}
|
|
@@ -49,6 +49,24 @@ export class oNodeConnectionStream extends oObject {
|
|
|
49
49
|
get age() {
|
|
50
50
|
return Date.now() - this.createdAt;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the stream type (defaults to 'general' for backward compatibility)
|
|
54
|
+
*/
|
|
55
|
+
get streamType() {
|
|
56
|
+
return this.config.streamType || 'general';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Checks if this stream is designated as a dedicated reader
|
|
60
|
+
*/
|
|
61
|
+
get isDedicatedReader() {
|
|
62
|
+
return this.streamType === 'dedicated-reader';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks if this stream is designated for request-response cycles
|
|
66
|
+
*/
|
|
67
|
+
get isRequestResponse() {
|
|
68
|
+
return this.streamType === 'request-response';
|
|
69
|
+
}
|
|
52
70
|
async close() {
|
|
53
71
|
// Don't close if reuse policy is enabled
|
|
54
72
|
if (this.config.reusePolicy === 'reuse') {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { oObject } from '@olane/o-core';
|
|
2
|
+
import { oNodeConnectionStream } from './o-node-connection-stream.js';
|
|
3
|
+
import { StreamPoolEvent, StreamPoolEventData } from './stream-pool-manager.events.js';
|
|
4
|
+
import type { StreamPoolManagerConfig, StreamPoolStats } from './interfaces/stream-pool-manager.config.js';
|
|
5
|
+
/**
|
|
6
|
+
* StreamPoolManager manages a pool of reusable streams with automatic recovery.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - Stream[0]: Dedicated reader for incoming requests (background loop)
|
|
10
|
+
* - Streams[1-N]: Round-robin pool for outgoing request-response cycles
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Automatic stream pool initialization
|
|
14
|
+
* - Dedicated reader with automatic restart on failure
|
|
15
|
+
* - Event-based stream monitoring (listens to 'close' events)
|
|
16
|
+
* - Automatic stream replacement when failures detected
|
|
17
|
+
* - Event emission for monitoring and observability
|
|
18
|
+
*/
|
|
19
|
+
export declare class StreamPoolManager extends oObject {
|
|
20
|
+
private streams;
|
|
21
|
+
private readonly POOL_SIZE;
|
|
22
|
+
private readonly READER_STREAM_INDEX;
|
|
23
|
+
private dedicatedReaderStream?;
|
|
24
|
+
private currentStreamIndex;
|
|
25
|
+
private failureCount;
|
|
26
|
+
private eventEmitter;
|
|
27
|
+
private streamEventHandlers;
|
|
28
|
+
private config;
|
|
29
|
+
private isInitialized;
|
|
30
|
+
private isClosing;
|
|
31
|
+
constructor(config: StreamPoolManagerConfig);
|
|
32
|
+
get backgroundReaderActive(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the stream pool and start the dedicated reader
|
|
35
|
+
*/
|
|
36
|
+
initialize(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Get a stream for outgoing request-response cycles using round-robin selection
|
|
39
|
+
*/
|
|
40
|
+
getStream(): Promise<oNodeConnectionStream>;
|
|
41
|
+
/**
|
|
42
|
+
* Get statistics about the stream pool
|
|
43
|
+
*/
|
|
44
|
+
getStats(): StreamPoolStats;
|
|
45
|
+
/**
|
|
46
|
+
* Close the stream pool and cleanup resources
|
|
47
|
+
*/
|
|
48
|
+
close(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Add event listener
|
|
51
|
+
*/
|
|
52
|
+
on<K extends StreamPoolEvent>(event: K | string, listener: (data: StreamPoolEventData[K]) => void): void;
|
|
53
|
+
/**
|
|
54
|
+
* Remove event listener
|
|
55
|
+
*/
|
|
56
|
+
off<K extends StreamPoolEvent>(event: K | string, listener: (data: StreamPoolEventData[K]) => void): void;
|
|
57
|
+
/**
|
|
58
|
+
* Emit event
|
|
59
|
+
*/
|
|
60
|
+
private emit;
|
|
61
|
+
/**
|
|
62
|
+
* Initialize the background reader on the dedicated stream
|
|
63
|
+
*/
|
|
64
|
+
private initializeBackgroundReader;
|
|
65
|
+
/**
|
|
66
|
+
* Handle dedicated reader failure with automatic recovery
|
|
67
|
+
*/
|
|
68
|
+
private handleReaderFailure;
|
|
69
|
+
/**
|
|
70
|
+
* Replace a stream at the given index
|
|
71
|
+
*/
|
|
72
|
+
private replaceStream;
|
|
73
|
+
/**
|
|
74
|
+
* Attach event listeners to a stream for monitoring
|
|
75
|
+
*/
|
|
76
|
+
private attachStreamListeners;
|
|
77
|
+
/**
|
|
78
|
+
* Remove event listeners from a stream
|
|
79
|
+
*/
|
|
80
|
+
private removeStreamListeners;
|
|
81
|
+
/**
|
|
82
|
+
* Handle stream close event - triggers immediate replacement
|
|
83
|
+
*/
|
|
84
|
+
private handleStreamClose;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=stream-pool-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-pool-manager.d.ts","sourceRoot":"","sources":["../../../src/connection/stream-pool-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAiC,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,eAAe,EACf,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,uBAAuB,EACvB,eAAe,EAChB,MAAM,4CAA4C,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IAE7C,OAAO,CAAC,qBAAqB,CAAC,CAAwB;IACtD,OAAO,CAAC,kBAAkB,CAAa;IAEvC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,YAAY,CAAoC;IACxD,OAAO,CAAC,mBAAmB,CAAgD;IAE3E,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,SAAS,CAAkB;gBAEvB,MAAM,EAAE,uBAAuB;IAa3C,IAAI,sBAAsB,YAEzB;IAED;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoDjC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAqCjD;;OAEG;IACH,QAAQ,IAAI,eAAe;IAuB3B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B5B;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,eAAe,EAC1B,KAAK,EAAE,CAAC,GAAG,MAAM,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,IAAI;IAIP;;OAEG;IACH,GAAG,CAAC,CAAC,SAAS,eAAe,EAC3B,KAAK,EAAE,CAAC,GAAG,MAAM,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,IAAI;IAIP;;OAEG;IACH,OAAO,CAAC,IAAI;IAOZ;;OAEG;YACW,0BAA0B;IA0ExC;;OAEG;YACW,mBAAmB;IA6BjC;;OAEG;YACW,aAAa;IA0C3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;CA2C1B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Events emitted by StreamPoolManager
|
|
3
|
+
*/
|
|
4
|
+
export declare enum StreamPoolEvent {
|
|
5
|
+
PoolInitialized = "pool-initialized",
|
|
6
|
+
PoolClosed = "pool-closed",
|
|
7
|
+
ReaderStarted = "reader-started",
|
|
8
|
+
ReaderFailed = "reader-failed",
|
|
9
|
+
ReaderRecovered = "reader-recovered",
|
|
10
|
+
RecoveryFailed = "recovery-failed",
|
|
11
|
+
StreamReplaced = "stream-replaced",
|
|
12
|
+
StreamFailed = "stream-failed"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Event data interfaces
|
|
16
|
+
*/
|
|
17
|
+
export interface PoolInitializedData {
|
|
18
|
+
poolSize: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ReaderStartedData {
|
|
21
|
+
streamId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ReaderFailedData {
|
|
24
|
+
error?: string;
|
|
25
|
+
failureCount: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ReaderRecoveredData {
|
|
28
|
+
failureCount: number;
|
|
29
|
+
}
|
|
30
|
+
export interface RecoveryFailedData {
|
|
31
|
+
error: string;
|
|
32
|
+
failureCount: number;
|
|
33
|
+
}
|
|
34
|
+
export interface StreamReplacedData {
|
|
35
|
+
index: number;
|
|
36
|
+
streamType: string;
|
|
37
|
+
}
|
|
38
|
+
export interface StreamFailedData {
|
|
39
|
+
index: number;
|
|
40
|
+
streamId: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
failureCount: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Mapped type for type-safe event listeners
|
|
46
|
+
*/
|
|
47
|
+
export type StreamPoolEventData = {
|
|
48
|
+
[StreamPoolEvent.PoolInitialized]: PoolInitializedData;
|
|
49
|
+
[StreamPoolEvent.PoolClosed]: void;
|
|
50
|
+
[StreamPoolEvent.ReaderStarted]: ReaderStartedData;
|
|
51
|
+
[StreamPoolEvent.ReaderFailed]: ReaderFailedData;
|
|
52
|
+
[StreamPoolEvent.ReaderRecovered]: ReaderRecoveredData;
|
|
53
|
+
[StreamPoolEvent.RecoveryFailed]: RecoveryFailedData;
|
|
54
|
+
[StreamPoolEvent.StreamReplaced]: StreamReplacedData;
|
|
55
|
+
[StreamPoolEvent.StreamFailed]: StreamFailedData;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=stream-pool-manager.events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-pool-manager.events.d.ts","sourceRoot":"","sources":["../../../src/connection/stream-pool-manager.events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACzB,eAAe,qBAAqB;IACpC,UAAU,gBAAgB;IAC1B,aAAa,mBAAmB;IAChC,YAAY,kBAAkB;IAC9B,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACvD,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;IACnC,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IACnD,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IACjD,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACvD,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACrD,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACrD,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAClD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Events emitted by StreamPoolManager
|
|
3
|
+
*/
|
|
4
|
+
export var StreamPoolEvent;
|
|
5
|
+
(function (StreamPoolEvent) {
|
|
6
|
+
StreamPoolEvent["PoolInitialized"] = "pool-initialized";
|
|
7
|
+
StreamPoolEvent["PoolClosed"] = "pool-closed";
|
|
8
|
+
StreamPoolEvent["ReaderStarted"] = "reader-started";
|
|
9
|
+
StreamPoolEvent["ReaderFailed"] = "reader-failed";
|
|
10
|
+
StreamPoolEvent["ReaderRecovered"] = "reader-recovered";
|
|
11
|
+
StreamPoolEvent["RecoveryFailed"] = "recovery-failed";
|
|
12
|
+
StreamPoolEvent["StreamReplaced"] = "stream-replaced";
|
|
13
|
+
StreamPoolEvent["StreamFailed"] = "stream-failed";
|
|
14
|
+
})(StreamPoolEvent || (StreamPoolEvent = {}));
|