@observertc/observer-js 0.9.21-beta → 0.9.23-beta
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/.eslintrc.json +143 -0
- package/lib/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +54 -47
- package/lib/Observer.d.ts +1404 -38
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +479 -176
- package/lib/common/Semaphore.d.ts.map +1 -1
- package/lib/common/callMetaReports.d.ts.map +1 -1
- package/lib/common/callMetaReports.js +1 -0
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +15 -15
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +12 -1
- package/lib/entries/CallEntry.d.ts +611 -0
- package/lib/entries/CallEntry.d.ts.map +1 -0
- package/lib/entries/CallEntry.js +75 -0
- package/lib/entries/ClientEntry.d.ts +474 -0
- package/lib/entries/ClientEntry.d.ts.map +1 -0
- package/lib/entries/ClientEntry.js +101 -0
- package/lib/entries/InboundTrackEntry.d.ts +670 -0
- package/lib/entries/InboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/InboundTrackEntry.js +76 -0
- package/lib/entries/OutboundTrackEntry.d.ts +670 -0
- package/lib/entries/OutboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/OutboundTrackEntry.js +73 -0
- package/lib/entries/PeerConnectionEntry.d.ts +469 -0
- package/lib/entries/PeerConnectionEntry.d.ts.map +1 -0
- package/lib/entries/PeerConnectionEntry.js +144 -0
- package/lib/entries/SfuEntry.d.ts +150 -0
- package/lib/entries/SfuEntry.d.ts.map +1 -0
- package/lib/entries/SfuEntry.js +77 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuInboundRtpPadEntry.js +49 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuOutboundRtpPadEntry.js +47 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts +12 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts.map +1 -0
- package/lib/entries/SfuSctpChannelEntry.js +43 -0
- package/lib/entries/SfuTransportEntry.d.ts +82 -0
- package/lib/entries/SfuTransportEntry.d.ts.map +1 -0
- package/lib/entries/SfuTransportEntry.js +122 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.js +2 -6
- package/lib/middlewares/CallProcessor.d.ts.map +1 -1
- package/lib/middlewares/CallProcessor.js +15 -6
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +22 -26
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedCallEntries.js +29 -20
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +27 -18
- package/lib/middlewares/Middleware.d.ts.map +1 -1
- package/lib/middlewares/Middleware.js +13 -4
- package/lib/middlewares/Processor.d.ts.map +1 -1
- package/lib/middlewares/Processor.js +18 -9
- package/lib/middlewares/TransactionContext.d.ts.map +1 -1
- package/lib/middlewares/TransactionContext.js +84 -73
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +16 -7
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedSfusMiddleware.js +15 -6
- package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitClient.js +6 -18
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +17 -20
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +16 -21
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +16 -16
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +16 -17
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +24 -40
- package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfu.js +6 -7
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +3 -7
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +3 -8
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +3 -6
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuTransport.js +3 -6
- package/lib/processes/closePeerConnectionProcess.d.ts.map +1 -1
- package/lib/processes/closePeerConnectionProcess.js +14 -5
- package/lib/processes/detachClientProcess.d.ts.map +1 -1
- package/lib/processes/detachClientProcess.js +20 -17
- package/lib/processes/findRemoteMatches.d.ts +2 -2
- package/lib/processes/findRemoteMatches.d.ts.map +1 -1
- package/lib/processes/findRemoteMatches.js +70 -56
- package/lib/processes/inboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/inboundTrackRemoved.js +12 -3
- package/lib/processes/joinClientProcess.d.ts.map +1 -1
- package/lib/processes/joinClientProcess.js +15 -6
- package/lib/processes/outboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/outboundTrackRemoved.js +12 -3
- package/lib/samples/ObservedCall.d.ts.map +1 -1
- package/lib/samples/ObservedCall.js +1 -5
- package/lib/samples/ObservedCalls.d.ts.map +1 -1
- package/lib/samples/ObservedClient.d.ts.map +1 -1
- package/lib/samples/ObservedClient.js +1 -9
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundAudioTrack.js +1 -5
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundVideoTrack.js +1 -5
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundAudioTrack.js +1 -5
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundVideoTrack.js +1 -5
- package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/samples/ObservedPeerConnection.js +1 -12
- package/lib/samples/ObservedSfu.d.ts.map +1 -1
- package/lib/samples/ObservedSfu.js +1 -8
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuInboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuOutboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -1
- package/lib/samples/ObservedSfuSctpChannel.js +1 -5
- package/lib/samples/ObservedSfuTransport.d.ts.map +1 -1
- package/lib/samples/ObservedSfuTransport.js +1 -8
- package/lib/samples/ObservedSfus.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.js +42 -31
- package/lib/sinks/callEventReports.js +1 -0
- package/lib/sources/ObservedCallSource.d.ts +6 -3
- package/lib/sources/ObservedCallSource.d.ts.map +1 -1
- package/lib/sources/ObservedClientSource.d.ts +3 -2
- package/lib/sources/ObservedClientSource.d.ts.map +1 -1
- package/lib/sources/ObservedSfuSource.d.ts +3 -2
- package/lib/sources/ObservedSfuSource.d.ts.map +1 -1
- package/lib/sources/Sources.d.ts +8 -4
- package/lib/sources/Sources.d.ts.map +1 -1
- package/lib/sources/Sources.js +83 -46
- package/lib/storages/ObserverStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.js +40 -23
- package/package.json +1 -1
- package/src/Evaluator.ts +17 -9
- package/src/Observer.ts +230 -170
- package/src/common/Semaphore.ts +2 -0
- package/src/common/callMetaReports.ts +30 -28
- package/src/common/logger.ts +140 -132
- package/src/common/types.ts +1 -1
- package/src/common/utils.ts +12 -1
- package/src/entries/CallEntry.ts +62 -0
- package/src/entries/ClientEntry.ts +90 -0
- package/src/entries/InboundTrackEntry.ts +74 -0
- package/src/entries/OutboundTrackEntry.ts +72 -0
- package/src/entries/PeerConnectionEntry.ts +133 -0
- package/src/entries/SfuEntry.ts +62 -0
- package/src/entries/SfuInboundRtpPadEntry.ts +46 -0
- package/src/entries/SfuOutboundRtpPadEntry.ts +44 -0
- package/src/entries/SfuSctpChannelEntry.ts +39 -0
- package/src/entries/SfuTransportEntry.ts +109 -0
- package/src/index.ts +11 -0
- package/src/middlewares/CallOperationsContext.ts +9 -5
- package/src/middlewares/CallProcessor.ts +4 -2
- package/src/middlewares/CommitTransactionMiddleware.ts +8 -5
- package/src/middlewares/DeleteOutdatedCallEntries.ts +24 -16
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +24 -15
- package/src/middlewares/Middleware.ts +1 -0
- package/src/middlewares/Processor.ts +10 -5
- package/src/middlewares/TransactionContext.ts +1 -2
- package/src/middlewares/VisitObservedCallsMiddleware.ts +5 -2
- package/src/middlewares/VisitObservedSfusMiddleware.ts +8 -7
- package/src/middlewares/visitors/visitClient.ts +15 -1
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +4 -1
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
- package/src/middlewares/visitors/visitPeerConnection.ts +15 -2
- package/src/middlewares/visitors/visitSfu.ts +7 -1
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +4 -2
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +3 -1
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +23 -21
- package/src/middlewares/visitors/visitSfuTransport.ts +3 -1
- package/src/processes/closePeerConnectionProcess.ts +3 -0
- package/src/processes/detachClientProcess.ts +13 -4
- package/src/processes/findRemoteMatches.ts +32 -21
- package/src/processes/inboundTrackRemoved.ts +2 -0
- package/src/processes/joinClientProcess.ts +8 -2
- package/src/processes/outboundTrackRemoved.ts +2 -0
- package/src/samples/ObservedCall.ts +6 -0
- package/src/samples/ObservedCalls.ts +13 -7
- package/src/samples/ObservedClient.ts +24 -8
- package/src/samples/ObservedInboundAudioTrack.ts +3 -2
- package/src/samples/ObservedInboundVideoTrack.ts +3 -2
- package/src/samples/ObservedOutboundAudioTrack.ts +3 -2
- package/src/samples/ObservedOutboundVideoTrack.ts +3 -2
- package/src/samples/ObservedPeerConnection.ts +27 -11
- package/src/samples/ObservedSfu.ts +17 -10
- package/src/samples/ObservedSfuInboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuOutboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuSctpChannel.ts +13 -13
- package/src/samples/ObservedSfuTransport.ts +19 -7
- package/src/samples/ObservedSfus.ts +10 -5
- package/src/sinks/ObserverSink.ts +51 -44
- package/src/sinks/callEventReports.ts +1 -1
- package/src/sources/ObservedCallSource.ts +9 -6
- package/src/sources/ObservedClientSource.ts +3 -2
- package/src/sources/ObservedSfuSource.ts +4 -8
- package/src/sources/Sources.ts +107 -22
- package/src/storages/ObserverStorage.ts +1 -0
- package/src/storages/SimpleStorage.ts +44 -21
- package/tsconfig.json +7 -5
- package/.eslintrc.js +0 -27
package/src/Observer.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { ObserverReportsEmitter, ObserverSinkProcess, SinkConfig, SinkImpl } from './sinks/ObserverSink';
|
|
2
2
|
import { Sources, SourcesConfig } from './sources/Sources';
|
|
3
3
|
import { createSimpleStorageProvider, StorageProvider } from './storages/StorageProvider';
|
|
4
|
-
import * as Models from './models/Models';
|
|
5
4
|
import { Evaluator, EvaluatorConfig, EvaluatorProcess } from './Evaluator';
|
|
6
5
|
import { createSimpleSemaphoreProvider, SemaphoreProvider } from './common/Semaphore';
|
|
7
6
|
import { ObservedCallSourceConfig, ObservedCallSource } from './sources/ObservedCallSource';
|
|
8
|
-
import {
|
|
9
|
-
import { PartialBy } from './common/utils';
|
|
7
|
+
import { PartialBy, asyncIteratorConverter } from './common/utils';
|
|
10
8
|
import { createLogger, LogLevel } from './common/logger';
|
|
11
9
|
import { ObservedSfuSource, ObservedSfuSourceConfig } from './sources/ObservedSfuSource';
|
|
12
10
|
import { EventEmitter } from 'events';
|
|
11
|
+
import { CallEntry, createCallEntry } from './entries/CallEntry';
|
|
12
|
+
import { ClientEntry, createClientEntry } from './entries/ClientEntry';
|
|
13
|
+
import { PeerConnectionEntry, createPeerConnectionEntry } from './entries/PeerConnectionEntry';
|
|
14
|
+
import { InboundTrackEntry, createInboundTrackEntry } from './entries/InboundTrackEntry';
|
|
15
|
+
import { OutboundTrackEntry, createOutboundTrackEntry } from './entries/OutboundTrackEntry';
|
|
16
|
+
import { SfuEntry, createSfuEntry } from './entries/SfuEntry';
|
|
17
|
+
import { SfuTransportEntry, createSfuTransportEntry } from './entries/SfuTransportEntry';
|
|
18
|
+
import { SfuInboundRtpPadEntry, createSfuInboundRtpPadEntry } from './entries/SfuInboundRtpPadEntry';
|
|
19
|
+
import { SfuOutboundRtpPadEntry, createSfuOutboundRtpPadEntry } from './entries/SfuOutboundRtpPadEntry';
|
|
20
|
+
import { SfuSctpChannelEntry, createSfuSctpChannelEntry } from './entries/SfuSctpChannelEntry';
|
|
13
21
|
|
|
14
22
|
const logger = createLogger('Observer');
|
|
15
23
|
|
|
@@ -22,6 +30,7 @@ export type ObserverEvents = {
|
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
export type ObserverConfig = {
|
|
33
|
+
|
|
25
34
|
/**
|
|
26
35
|
*
|
|
27
36
|
* Sets the default serviceId for samples.
|
|
@@ -71,8 +80,8 @@ export class Observer {
|
|
|
71
80
|
);
|
|
72
81
|
|
|
73
82
|
const semaphores = providedConfig.semaphores ?? createSimpleSemaphoreProvider();
|
|
74
|
-
|
|
75
83
|
const storages = providedConfig.storages ?? createSimpleStorageProvider();
|
|
84
|
+
|
|
76
85
|
return new Observer(config, storages, semaphores);
|
|
77
86
|
}
|
|
78
87
|
|
|
@@ -88,7 +97,12 @@ export class Observer {
|
|
|
88
97
|
) {
|
|
89
98
|
this._sources = new Sources(config.sources);
|
|
90
99
|
this._sink = new SinkImpl(config.sink);
|
|
91
|
-
this._evaluator = new Evaluator(
|
|
100
|
+
this._evaluator = new Evaluator(
|
|
101
|
+
this.config.evaluator,
|
|
102
|
+
this._semaphores.callSemaphore,
|
|
103
|
+
this._storages,
|
|
104
|
+
this._sink
|
|
105
|
+
);
|
|
92
106
|
|
|
93
107
|
this._sources.on('observed-samples', (event) => {
|
|
94
108
|
this._emitter.emit('processing-started');
|
|
@@ -106,96 +120,70 @@ export class Observer {
|
|
|
106
120
|
this._sink.emit();
|
|
107
121
|
this._emitter.emit('processing-ended');
|
|
108
122
|
});
|
|
109
|
-
logger.debug(
|
|
123
|
+
logger.debug('Observer is created with config', this.config);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public get sources(): Sources {
|
|
127
|
+
return this._sources;
|
|
110
128
|
}
|
|
111
129
|
|
|
112
130
|
public on<K extends keyof ObserverEvents>(event: K, listener: (arg: ObserverEvents[K]) => void): this {
|
|
113
131
|
this._emitter.on(event, listener);
|
|
132
|
+
|
|
114
133
|
return this;
|
|
115
134
|
}
|
|
116
135
|
|
|
117
136
|
public once<K extends keyof ObserverEvents>(event: K, listener: (arg: ObserverEvents[K]) => void): this {
|
|
118
137
|
this._emitter.once(event, listener);
|
|
138
|
+
|
|
119
139
|
return this;
|
|
120
140
|
}
|
|
121
141
|
|
|
122
142
|
public off<K extends keyof ObserverEvents>(event: K, listener: (arg: ObserverEvents[K]) => void): this {
|
|
123
143
|
this._emitter.off(event, listener);
|
|
144
|
+
|
|
124
145
|
return this;
|
|
125
146
|
}
|
|
126
147
|
|
|
127
|
-
public createCallSource(
|
|
128
|
-
config: PartialBy<ObservedCallSourceConfig
|
|
129
|
-
): ObservedCallSource {
|
|
148
|
+
public createCallSource<T extends Record<string, unknown> = Record<string, unknown>>(
|
|
149
|
+
config: PartialBy<ObservedCallSourceConfig<T>, 'serviceId' | 'mediaUnitId' | 'appData'>
|
|
150
|
+
): ObservedCallSource<T> {
|
|
130
151
|
if (this._closed) {
|
|
131
|
-
throw new Error(
|
|
152
|
+
throw new Error('Attempted to create a call source on a closed observer');
|
|
132
153
|
}
|
|
133
|
-
let closed = false;
|
|
134
|
-
const serviceId = config.serviceId ?? this.config.defaultServiceId;
|
|
135
|
-
const mediaUnitId = config.mediaUnitId ?? this.config.defaultMediaUnitId;
|
|
136
|
-
const clientSources = new Map<string, ObservedClientSource>();
|
|
137
|
-
const callSource: ObservedCallSource = {
|
|
138
|
-
...config,
|
|
139
|
-
serviceId,
|
|
140
|
-
mediaUnitId,
|
|
141
|
-
createClientSource: (context) => {
|
|
142
|
-
const clientSource = this._sources.createClientSource({
|
|
143
|
-
...config,
|
|
144
|
-
...context,
|
|
145
|
-
serviceId,
|
|
146
|
-
mediaUnitId,
|
|
147
|
-
});
|
|
148
|
-
const closeClientSource = clientSource.close;
|
|
149
|
-
clientSource.close = () => {
|
|
150
|
-
closeClientSource();
|
|
151
|
-
clientSources.delete(context.clientId);
|
|
152
|
-
};
|
|
153
|
-
clientSources.set(context.clientId, clientSource);
|
|
154
|
-
return clientSource;
|
|
155
|
-
},
|
|
156
|
-
close: () => {
|
|
157
|
-
if (closed) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
for (const clientSource of clientSources.values()) {
|
|
161
|
-
clientSource.close();
|
|
162
|
-
}
|
|
163
|
-
clientSources.clear();
|
|
164
|
-
closed = true;
|
|
165
|
-
},
|
|
166
|
-
closed,
|
|
167
|
-
};
|
|
168
|
-
return callSource;
|
|
169
|
-
}
|
|
170
154
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
...config,
|
|
182
|
-
serviceId,
|
|
155
|
+
const {
|
|
156
|
+
serviceId = this.config.defaultServiceId,
|
|
157
|
+
mediaUnitId = this.config.defaultMediaUnitId,
|
|
158
|
+
appData = {} as T,
|
|
159
|
+
...callConfig
|
|
160
|
+
} = config;
|
|
161
|
+
|
|
162
|
+
return this._sources.createCallSource({
|
|
163
|
+
...callConfig,
|
|
164
|
+
appData,
|
|
183
165
|
mediaUnitId,
|
|
184
|
-
|
|
166
|
+
serviceId,
|
|
185
167
|
});
|
|
186
168
|
}
|
|
187
169
|
|
|
188
|
-
public createSfuSource(
|
|
189
|
-
config: PartialBy<ObservedSfuSourceConfig
|
|
170
|
+
public createSfuSource<T extends Record<string, unknown> = Record<string, unknown>>(
|
|
171
|
+
config: PartialBy<ObservedSfuSourceConfig<T>, 'serviceId' | 'mediaUnitId' | 'joined' | 'appData'>
|
|
190
172
|
): ObservedSfuSource {
|
|
191
173
|
if (this._closed) {
|
|
192
|
-
throw new Error(
|
|
174
|
+
throw new Error('Attempted to create a sfu source on a closed observer');
|
|
193
175
|
}
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
176
|
+
const {
|
|
177
|
+
appData = {} as T,
|
|
178
|
+
serviceId = this.config.defaultServiceId,
|
|
179
|
+
mediaUnitId = this.config.defaultMediaUnitId,
|
|
180
|
+
joined = Date.now(),
|
|
181
|
+
...sfuConfig
|
|
182
|
+
} = config;
|
|
183
|
+
|
|
184
|
+
return this._sources.createSfuSource<T>({
|
|
185
|
+
...sfuConfig,
|
|
186
|
+
appData,
|
|
199
187
|
serviceId,
|
|
200
188
|
mediaUnitId,
|
|
201
189
|
joined,
|
|
@@ -204,7 +192,7 @@ export class Observer {
|
|
|
204
192
|
|
|
205
193
|
public async evaluate() {
|
|
206
194
|
return new Promise<void>((resolve, reject) => {
|
|
207
|
-
this._evaluator.once('ready', err => {
|
|
195
|
+
this._evaluator.once('ready', (err) => {
|
|
208
196
|
if (err) reject(err);
|
|
209
197
|
else resolve();
|
|
210
198
|
});
|
|
@@ -218,7 +206,7 @@ export class Observer {
|
|
|
218
206
|
|
|
219
207
|
public addEvaluators(...processes: EvaluatorProcess[]) {
|
|
220
208
|
if (this._closed) {
|
|
221
|
-
throw new Error(
|
|
209
|
+
throw new Error('Attempted to add an evaluator to a closed observer');
|
|
222
210
|
}
|
|
223
211
|
for (const process of processes) {
|
|
224
212
|
this._evaluator.addProcess(process);
|
|
@@ -227,7 +215,7 @@ export class Observer {
|
|
|
227
215
|
|
|
228
216
|
public removeEvaluators(...processes: EvaluatorProcess[]) {
|
|
229
217
|
if (this._closed) {
|
|
230
|
-
throw new Error(
|
|
218
|
+
throw new Error('Attempted to remove an evaluator from a closed observer');
|
|
231
219
|
}
|
|
232
220
|
for (const process of processes) {
|
|
233
221
|
this._evaluator.removeProcess(process);
|
|
@@ -236,7 +224,7 @@ export class Observer {
|
|
|
236
224
|
|
|
237
225
|
public addSinks(...processes: ObserverSinkProcess[]) {
|
|
238
226
|
if (this._closed) {
|
|
239
|
-
throw new Error(
|
|
227
|
+
throw new Error('Attempted to add an evaluator to a closed observer');
|
|
240
228
|
}
|
|
241
229
|
for (const process of processes) {
|
|
242
230
|
this._sink.addProcess(process);
|
|
@@ -245,194 +233,267 @@ export class Observer {
|
|
|
245
233
|
|
|
246
234
|
public removeSinks(...processes: ObserverSinkProcess[]) {
|
|
247
235
|
if (this._closed) {
|
|
248
|
-
throw new Error(
|
|
236
|
+
throw new Error('Attempted to remove an evaluator from a closed observer');
|
|
249
237
|
}
|
|
250
238
|
for (const process of processes) {
|
|
251
239
|
this._sink.removeProcess(process);
|
|
252
240
|
}
|
|
253
241
|
}
|
|
254
242
|
|
|
255
|
-
public calls(): AsyncIterableIterator<
|
|
256
|
-
const
|
|
257
|
-
|
|
243
|
+
public calls(): AsyncIterableIterator<CallEntry> {
|
|
244
|
+
const storageProvider = this._storages;
|
|
245
|
+
|
|
246
|
+
return asyncIteratorConverter((async function *() {
|
|
247
|
+
for await (const [ , callModel ] of storageProvider.callStorage[Symbol.asyncIterator]()) {
|
|
248
|
+
if (!callModel) continue;
|
|
249
|
+
yield createCallEntry(storageProvider, callModel);
|
|
250
|
+
}
|
|
251
|
+
})());
|
|
258
252
|
}
|
|
259
253
|
|
|
260
|
-
public sfus(): AsyncIterableIterator<
|
|
261
|
-
const
|
|
262
|
-
|
|
254
|
+
public sfus(): AsyncIterableIterator<SfuEntry> {
|
|
255
|
+
const storageProvider = this._storages;
|
|
256
|
+
|
|
257
|
+
return asyncIteratorConverter((async function *() {
|
|
258
|
+
for await (const [ , sfuModel ] of storageProvider.sfuStorage[Symbol.asyncIterator]()) {
|
|
259
|
+
if (!sfuModel) continue;
|
|
260
|
+
yield createSfuEntry(storageProvider, sfuModel);
|
|
261
|
+
}
|
|
262
|
+
})());
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
public sfuTransports(): AsyncIterableIterator<
|
|
266
|
-
const
|
|
267
|
-
|
|
265
|
+
public sfuTransports(): AsyncIterableIterator<SfuTransportEntry> {
|
|
266
|
+
const storageProvider = this._storages;
|
|
267
|
+
|
|
268
|
+
return asyncIteratorConverter((async function *() {
|
|
269
|
+
for await (const [ , sfuTransportModel ] of storageProvider.sfuTransportStorage[Symbol.asyncIterator]()) {
|
|
270
|
+
if (!sfuTransportModel) continue;
|
|
271
|
+
yield createSfuTransportEntry(storageProvider, sfuTransportModel);
|
|
272
|
+
}
|
|
273
|
+
})());
|
|
268
274
|
}
|
|
269
275
|
|
|
270
|
-
public sfuInboundRtpPads(): AsyncIterableIterator<
|
|
271
|
-
const
|
|
272
|
-
|
|
276
|
+
public sfuInboundRtpPads(): AsyncIterableIterator<SfuInboundRtpPadEntry> {
|
|
277
|
+
const storageProvider = this._storages;
|
|
278
|
+
|
|
279
|
+
return asyncIteratorConverter((async function *() {
|
|
280
|
+
for await (const [ , sfuInboundRtpPadModel ] of storageProvider.sfuInboundRtpPadStorage[Symbol.asyncIterator]()) {
|
|
281
|
+
if (!sfuInboundRtpPadModel) continue;
|
|
282
|
+
yield createSfuInboundRtpPadEntry(storageProvider, sfuInboundRtpPadModel);
|
|
283
|
+
}
|
|
284
|
+
})());
|
|
273
285
|
}
|
|
274
286
|
|
|
275
|
-
public sfuOutboundRtpPads(): AsyncIterableIterator<
|
|
276
|
-
const
|
|
277
|
-
|
|
287
|
+
public sfuOutboundRtpPads(): AsyncIterableIterator<SfuOutboundRtpPadEntry> {
|
|
288
|
+
const storageProvider = this._storages;
|
|
289
|
+
|
|
290
|
+
return asyncIteratorConverter((async function *() {
|
|
291
|
+
for await (const [ , sfuOutboundRtpPadModel ] of storageProvider.sfuOutboundRtpPadStorage[Symbol.asyncIterator]()) {
|
|
292
|
+
if (!sfuOutboundRtpPadModel) continue;
|
|
293
|
+
yield createSfuOutboundRtpPadEntry(storageProvider, sfuOutboundRtpPadModel);
|
|
294
|
+
}
|
|
295
|
+
})());
|
|
278
296
|
}
|
|
279
297
|
|
|
280
|
-
public clients(): AsyncIterableIterator<
|
|
281
|
-
const
|
|
282
|
-
|
|
298
|
+
public clients(): AsyncIterableIterator<ClientEntry> {
|
|
299
|
+
const storageProvider = this._storages;
|
|
300
|
+
|
|
301
|
+
return asyncIteratorConverter((async function *() {
|
|
302
|
+
for await (const [ , callModel ] of storageProvider.clientStorage[Symbol.asyncIterator]()) {
|
|
303
|
+
if (!callModel) continue;
|
|
304
|
+
yield createClientEntry(storageProvider, callModel);
|
|
305
|
+
}
|
|
306
|
+
})());
|
|
283
307
|
}
|
|
284
308
|
|
|
285
|
-
public peerConnections(): AsyncIterableIterator<
|
|
286
|
-
const
|
|
287
|
-
|
|
309
|
+
public peerConnections(): AsyncIterableIterator<PeerConnectionEntry> {
|
|
310
|
+
const storageProvider = this._storages;
|
|
311
|
+
|
|
312
|
+
return asyncIteratorConverter((async function *() {
|
|
313
|
+
for await (const [ , peerConnectionModel ] of storageProvider.peerConnectionStorage[Symbol.asyncIterator]()) {
|
|
314
|
+
if (!peerConnectionModel) continue;
|
|
315
|
+
yield createPeerConnectionEntry(storageProvider, peerConnectionModel);
|
|
316
|
+
}
|
|
317
|
+
})());
|
|
288
318
|
}
|
|
289
319
|
|
|
290
320
|
public async getTrack(trackId: string) {
|
|
291
321
|
const { inboundTrackStorage, outboundTrackStorage } = this._storages;
|
|
292
|
-
const [
|
|
322
|
+
const [ inbTrackModel, outbTrackModel ] = await Promise.all([
|
|
293
323
|
inboundTrackStorage.get(trackId),
|
|
294
324
|
outboundTrackStorage.get(trackId),
|
|
295
325
|
]);
|
|
296
|
-
|
|
297
|
-
|
|
326
|
+
|
|
327
|
+
if (inbTrackModel) return createInboundTrackEntry(this._storages, inbTrackModel);
|
|
328
|
+
else if (outbTrackModel) return createOutboundTrackEntry(this._storages, outbTrackModel);
|
|
298
329
|
}
|
|
299
330
|
|
|
300
331
|
public async getAllTracks(trackIds: Iterable<string>) {
|
|
332
|
+
const storageProvider = this._storages;
|
|
301
333
|
const { inboundTrackStorage, outboundTrackStorage } = this._storages;
|
|
302
|
-
|
|
334
|
+
|
|
335
|
+
const [ inbTrackModels, outbTrackModels ] = await Promise.all([
|
|
303
336
|
inboundTrackStorage.getAll(trackIds),
|
|
304
337
|
outboundTrackStorage.getAll(trackIds),
|
|
305
338
|
]);
|
|
306
|
-
|
|
339
|
+
|
|
340
|
+
const result = new Map<string, InboundTrackEntry | OutboundTrackEntry>();
|
|
341
|
+
|
|
342
|
+
for (const [ trackId, model ] of inbTrackModels) {
|
|
343
|
+
result.set(trackId, createInboundTrackEntry(storageProvider, model));
|
|
344
|
+
}
|
|
345
|
+
for (const [ trackId, model ] of outbTrackModels) {
|
|
346
|
+
result.set(trackId, createOutboundTrackEntry(storageProvider, model));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return result;
|
|
307
350
|
}
|
|
308
351
|
|
|
309
|
-
public inboundTracks(): AsyncIterableIterator<
|
|
310
|
-
const
|
|
311
|
-
|
|
352
|
+
public inboundTracks(): AsyncIterableIterator<InboundTrackEntry> {
|
|
353
|
+
const storageProvider = this._storages;
|
|
354
|
+
|
|
355
|
+
return asyncIteratorConverter((async function *() {
|
|
356
|
+
for await (const [ , inboundTrackModel ] of storageProvider.inboundTrackStorage[Symbol.asyncIterator]()) {
|
|
357
|
+
if (!inboundTrackModel) continue;
|
|
358
|
+
yield createInboundTrackEntry(storageProvider, inboundTrackModel);
|
|
359
|
+
}
|
|
360
|
+
})());
|
|
312
361
|
}
|
|
313
362
|
|
|
314
|
-
public outboundTracks(): AsyncIterableIterator<
|
|
315
|
-
const
|
|
316
|
-
|
|
363
|
+
public outboundTracks(): AsyncIterableIterator<OutboundTrackEntry> {
|
|
364
|
+
const storageProvider = this._storages;
|
|
365
|
+
|
|
366
|
+
return asyncIteratorConverter((async function *() {
|
|
367
|
+
for await (const [ , outboundTrackModel ] of storageProvider.outboundTrackStorage[Symbol.asyncIterator]()) {
|
|
368
|
+
if (!outboundTrackModel) continue;
|
|
369
|
+
yield createOutboundTrackEntry(storageProvider, outboundTrackModel);
|
|
370
|
+
}
|
|
371
|
+
})());
|
|
317
372
|
}
|
|
318
373
|
|
|
319
|
-
public sfuSctpChannels(): AsyncIterableIterator<
|
|
320
|
-
const
|
|
321
|
-
|
|
374
|
+
public sfuSctpChannels(): AsyncIterableIterator<SfuSctpChannelEntry> {
|
|
375
|
+
const storageProvider = this._storages;
|
|
376
|
+
|
|
377
|
+
return asyncIteratorConverter((async function *() {
|
|
378
|
+
for await (const [ , sfuSctpChannelModel ] of storageProvider.sfuSctpChannelStorage[Symbol.asyncIterator]()) {
|
|
379
|
+
if (!sfuSctpChannelModel) continue;
|
|
380
|
+
yield createSfuSctpChannelEntry(storageProvider, sfuSctpChannelModel);
|
|
381
|
+
}
|
|
382
|
+
})());
|
|
322
383
|
}
|
|
323
384
|
|
|
324
|
-
public async getCall(callId: string): Promise<
|
|
325
|
-
|
|
326
|
-
return callStorage.get(callId);
|
|
385
|
+
public async getCall(callId: string): Promise<CallEntry> {
|
|
386
|
+
return createCallEntry(this._storages, await this._storages.callStorage.get(callId));
|
|
327
387
|
}
|
|
328
388
|
|
|
329
|
-
public async getAllCalls(callIds: Iterable<string>): Promise<ReadonlyMap<string,
|
|
330
|
-
const
|
|
331
|
-
|
|
389
|
+
public async getAllCalls(callIds: Iterable<string>): Promise<ReadonlyMap<string, CallEntry>> {
|
|
390
|
+
const models = await this._storages.callStorage.getAll(callIds);
|
|
391
|
+
|
|
392
|
+
return new Map(Array.from(models).map(([ callId, model ]) => [ callId, createCallEntry(this._storages, model) ]));
|
|
332
393
|
}
|
|
333
394
|
|
|
334
|
-
public async getSfu(sfuId: string): Promise<
|
|
335
|
-
|
|
336
|
-
return sfuStorage.get(sfuId);
|
|
395
|
+
public async getSfu(sfuId: string): Promise<SfuEntry> {
|
|
396
|
+
return createSfuEntry(this._storages, await this._storages.sfuStorage.get(sfuId));
|
|
337
397
|
}
|
|
338
398
|
|
|
339
|
-
public async getAllSfus(sfuIds: Iterable<string>): Promise<ReadonlyMap<string,
|
|
340
|
-
const
|
|
341
|
-
|
|
399
|
+
public async getAllSfus(sfuIds: Iterable<string>): Promise<ReadonlyMap<string, SfuEntry>> {
|
|
400
|
+
const models = await this._storages.sfuStorage.getAll(sfuIds);
|
|
401
|
+
|
|
402
|
+
return new Map(Array.from(models).map(([ sfuId, model ]) => [ sfuId, createSfuEntry(this._storages, model) ]));
|
|
342
403
|
}
|
|
343
404
|
|
|
344
|
-
public async getSfuTransport(sfuTransportId: string): Promise<
|
|
345
|
-
|
|
346
|
-
return sfuTransportStorage.get(sfuTransportId);
|
|
405
|
+
public async getSfuTransport(sfuTransportId: string): Promise<SfuTransportEntry | undefined> {
|
|
406
|
+
return createSfuTransportEntry(this._storages, await this._storages.sfuTransportStorage.get(sfuTransportId));
|
|
347
407
|
}
|
|
348
408
|
|
|
349
409
|
public async getAllSfuTransports(
|
|
350
410
|
sfuTransportIds: Iterable<string>
|
|
351
|
-
): Promise<ReadonlyMap<string,
|
|
352
|
-
const
|
|
353
|
-
|
|
411
|
+
): Promise<ReadonlyMap<string, SfuTransportEntry>> {
|
|
412
|
+
const models = await this._storages.sfuTransportStorage.getAll(sfuTransportIds);
|
|
413
|
+
|
|
414
|
+
return new Map(Array.from(models).map(([ sfuTransportId, model ]) => [ sfuTransportId, createSfuTransportEntry(this._storages, model) ]));
|
|
354
415
|
}
|
|
355
416
|
|
|
356
|
-
public async getSfuInboundRtpPad(sfuInboundRtpPadId: string): Promise<
|
|
357
|
-
|
|
358
|
-
return sfuInboundRtpPadStorage.get(sfuInboundRtpPadId);
|
|
417
|
+
public async getSfuInboundRtpPad(sfuInboundRtpPadId: string): Promise<SfuInboundRtpPadEntry | undefined> {
|
|
418
|
+
return createSfuInboundRtpPadEntry(this._storages, await this._storages.sfuInboundRtpPadStorage.get(sfuInboundRtpPadId));
|
|
359
419
|
}
|
|
360
420
|
|
|
361
421
|
public async getAllSfuInboundRtpPads(
|
|
362
422
|
sfuInboundRtpPadIds: Iterable<string>
|
|
363
|
-
): Promise<ReadonlyMap<string,
|
|
364
|
-
const
|
|
365
|
-
|
|
423
|
+
): Promise<ReadonlyMap<string, SfuInboundRtpPadEntry>> {
|
|
424
|
+
const models = await this._storages.sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds);
|
|
425
|
+
|
|
426
|
+
return new Map(Array.from(models).map(([ sfuInboundRtpPadId, model ]) => [ sfuInboundRtpPadId, createSfuInboundRtpPadEntry(this._storages, model) ]));
|
|
366
427
|
}
|
|
367
428
|
|
|
368
|
-
public async getSfuOutboundRtpPad(sfuOutboundRtpPadId: string): Promise<
|
|
369
|
-
|
|
370
|
-
return sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId);
|
|
429
|
+
public async getSfuOutboundRtpPad(sfuOutboundRtpPadId: string): Promise<SfuOutboundRtpPadEntry | undefined> {
|
|
430
|
+
return createSfuOutboundRtpPadEntry(this._storages, await this._storages.sfuOutboundRtpPadStorage.get(sfuOutboundRtpPadId));
|
|
371
431
|
}
|
|
372
432
|
|
|
373
433
|
public async getAllSfuOutboundRtpPads(
|
|
374
434
|
sfuOutboundRtpPadIds: Iterable<string>
|
|
375
|
-
): Promise<ReadonlyMap<string,
|
|
376
|
-
const
|
|
377
|
-
|
|
435
|
+
): Promise<ReadonlyMap<string, SfuOutboundRtpPadEntry>> {
|
|
436
|
+
const models = await this._storages.sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds);
|
|
437
|
+
|
|
438
|
+
return new Map(Array.from(models).map(([ sfuOutboundRtpPadId, model ]) => [ sfuOutboundRtpPadId, createSfuOutboundRtpPadEntry(this._storages, model) ]));
|
|
378
439
|
}
|
|
379
440
|
|
|
380
|
-
public async getClient(clientId: string): Promise<
|
|
381
|
-
|
|
382
|
-
return clientStorage.get(clientId);
|
|
441
|
+
public async getClient(clientId: string): Promise<ClientEntry> {
|
|
442
|
+
return createClientEntry(this._storages, await this._storages.clientStorage.get(clientId));
|
|
383
443
|
}
|
|
384
444
|
|
|
385
|
-
public async getAllClient(clientIds: Iterable<string>): Promise<ReadonlyMap<string,
|
|
386
|
-
const
|
|
387
|
-
|
|
445
|
+
public async getAllClient(clientIds: Iterable<string>): Promise<ReadonlyMap<string, ClientEntry>> {
|
|
446
|
+
const models = await this._storages.clientStorage.getAll(clientIds);
|
|
447
|
+
|
|
448
|
+
return new Map(Array.from(models).map(([ clientId, model ]) => [ clientId, createClientEntry(this._storages, model) ]));
|
|
388
449
|
}
|
|
389
450
|
|
|
390
|
-
public async getPeerConnection(peerConnectionId: string): Promise<
|
|
391
|
-
|
|
392
|
-
return peerConnectionStorage.get(peerConnectionId);
|
|
451
|
+
public async getPeerConnection(peerConnectionId: string): Promise<PeerConnectionEntry> {
|
|
452
|
+
return createPeerConnectionEntry(this._storages, await this._storages.peerConnectionStorage.get(peerConnectionId));
|
|
393
453
|
}
|
|
394
454
|
|
|
395
455
|
public async getAllPeerConnections(
|
|
396
456
|
peerConnectionIds: Iterable<string>
|
|
397
|
-
): Promise<ReadonlyMap<string,
|
|
398
|
-
const
|
|
399
|
-
|
|
457
|
+
): Promise<ReadonlyMap<string, PeerConnectionEntry>> {
|
|
458
|
+
const models = await this._storages.peerConnectionStorage.getAll(peerConnectionIds);
|
|
459
|
+
|
|
460
|
+
return new Map(Array.from(models).map(([ peerConnectionId, model ]) => [ peerConnectionId, createPeerConnectionEntry(this._storages, model) ]));
|
|
400
461
|
}
|
|
401
462
|
|
|
402
|
-
public async getInboundTrack(inboundTrackId: string): Promise<
|
|
403
|
-
|
|
404
|
-
return inboundTrackStorage.get(inboundTrackId);
|
|
463
|
+
public async getInboundTrack(inboundTrackId: string): Promise<InboundTrackEntry> {
|
|
464
|
+
return createInboundTrackEntry(this._storages, await this._storages.inboundTrackStorage.get(inboundTrackId));
|
|
405
465
|
}
|
|
406
466
|
|
|
407
467
|
public async getAllInboundTracks(
|
|
408
468
|
inboundTrackIds: Iterable<string>
|
|
409
|
-
): Promise<ReadonlyMap<string,
|
|
410
|
-
const
|
|
411
|
-
|
|
469
|
+
): Promise<ReadonlyMap<string, InboundTrackEntry>> {
|
|
470
|
+
const models = await this._storages.inboundTrackStorage.getAll(inboundTrackIds);
|
|
471
|
+
|
|
472
|
+
return new Map(Array.from(models).map(([ inboundTrackId, model ]) => [ inboundTrackId, createInboundTrackEntry(this._storages, model) ]));
|
|
412
473
|
}
|
|
413
474
|
|
|
414
|
-
public async getOutboundTrack(outboundTrackId: string): Promise<
|
|
415
|
-
|
|
416
|
-
return outboundTrackStorage.get(outboundTrackId);
|
|
475
|
+
public async getOutboundTrack(outboundTrackId: string): Promise<OutboundTrackEntry> {
|
|
476
|
+
return createOutboundTrackEntry(this._storages, await this._storages.outboundTrackStorage.get(outboundTrackId));
|
|
417
477
|
}
|
|
418
478
|
|
|
419
479
|
public async getAllOutboundTracks(
|
|
420
480
|
outboundTrackIds: Iterable<string>
|
|
421
|
-
): Promise<ReadonlyMap<string,
|
|
422
|
-
const
|
|
423
|
-
|
|
481
|
+
): Promise<ReadonlyMap<string, OutboundTrackEntry>> {
|
|
482
|
+
const models = await this._storages.outboundTrackStorage.getAll(outboundTrackIds);
|
|
483
|
+
|
|
484
|
+
return new Map(Array.from(models).map(([ outboundTrackId, model ]) => [ outboundTrackId, createOutboundTrackEntry(this._storages, model) ]));
|
|
424
485
|
}
|
|
425
486
|
|
|
426
|
-
public async getSfuSctpChannel(sctpChannelId: string): Promise<
|
|
427
|
-
|
|
428
|
-
return sfuSctpChannelStorage.get(sctpChannelId);
|
|
487
|
+
public async getSfuSctpChannel(sctpChannelId: string): Promise<SfuSctpChannelEntry | undefined> {
|
|
488
|
+
return createSfuSctpChannelEntry(this._storages, await this._storages.sfuSctpChannelStorage.get(sctpChannelId));
|
|
429
489
|
}
|
|
430
490
|
|
|
431
491
|
public async getAllSfuSctpChannel(
|
|
432
492
|
sctpChannelIds: Iterable<string>
|
|
433
|
-
): Promise<ReadonlyMap<string,
|
|
434
|
-
const
|
|
435
|
-
|
|
493
|
+
): Promise<ReadonlyMap<string, SfuSctpChannelEntry>> {
|
|
494
|
+
const models = await this._storages.sfuSctpChannelStorage.getAll(sctpChannelIds);
|
|
495
|
+
|
|
496
|
+
return new Map(Array.from(models).map(([ sctpChannelId, model ]) => [ sctpChannelId, createSfuSctpChannelEntry(this._storages, model) ]));
|
|
436
497
|
}
|
|
437
498
|
|
|
438
499
|
public get closed() {
|
|
@@ -441,8 +502,7 @@ export class Observer {
|
|
|
441
502
|
|
|
442
503
|
public close() {
|
|
443
504
|
if (this._closed) {
|
|
444
|
-
logger.debug(
|
|
445
|
-
return;
|
|
505
|
+
return logger.debug('Attempted to close twice');
|
|
446
506
|
}
|
|
447
507
|
this._closed = true;
|
|
448
508
|
this._sources.close();
|
package/src/common/Semaphore.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Semaphores are used to ensure that only one process can access the shared resource at a time.
|
|
4
4
|
*/
|
|
5
5
|
export interface Semaphore {
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Acquires the semaphore, blocking until the semaphore is available.
|
|
8
9
|
* When the semaphore is acquired, it prevents other processes from acquiring it.
|
|
@@ -29,6 +30,7 @@ export function createDummySemaphore(): Semaphore {
|
|
|
29
30
|
* SemaphoreProviders are used to manage access to shared resources across multiple processes.
|
|
30
31
|
*/
|
|
31
32
|
export interface SemaphoreProvider {
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* A Semaphore instance that manages access to the 'call' shared resource.
|
|
34
36
|
* This semaphore ensures that only one process can access the 'call' resource at a time.
|