rename SubscriptionManager to Subscription

This commit is contained in:
Sasha 2024-10-27 18:36:39 +01:00
parent 09127dfc91
commit 2a5df25ca9
No known key found for this signature in database
2 changed files with 7 additions and 8 deletions

View File

@ -26,7 +26,7 @@ import {
import { PeerManager } from "../peer_manager.js"; import { PeerManager } from "../peer_manager.js";
import { MessageCache } from "./message_cache.js"; import { MessageCache } from "./message_cache.js";
import { SubscriptionManager } from "./subscription_manager.js"; import { Subscription } from "./subscription.js";
import { buildConfig } from "./utils.js"; import { buildConfig } from "./utils.js";
const log = new Logger("sdk:filter"); const log = new Logger("sdk:filter");
@ -36,7 +36,7 @@ class Filter implements IFilter {
private readonly config: FilterProtocolOptions; private readonly config: FilterProtocolOptions;
private readonly messageCache: MessageCache; private readonly messageCache: MessageCache;
private activeSubscriptions = new Map<string, SubscriptionManager>(); private activeSubscriptions = new Map<string, Subscription>();
public constructor( public constructor(
private connectionManager: ConnectionManager, private connectionManager: ConnectionManager,
@ -186,7 +186,7 @@ class Filter implements IFilter {
this.getActiveSubscription(pubsubTopic) ?? this.getActiveSubscription(pubsubTopic) ??
this.setActiveSubscription( this.setActiveSubscription(
pubsubTopic, pubsubTopic,
new SubscriptionManager( new Subscription(
pubsubTopic, pubsubTopic,
this.protocol, this.protocol,
this.connectionManager, this.connectionManager,
@ -263,17 +263,16 @@ class Filter implements IFilter {
return toAsyncIterator(this, decoders); return toAsyncIterator(this, decoders);
} }
//TODO: move to SubscriptionManager
private getActiveSubscription( private getActiveSubscription(
pubsubTopic: PubsubTopic pubsubTopic: PubsubTopic
): SubscriptionManager | undefined { ): Subscription | undefined {
return this.activeSubscriptions.get(pubsubTopic); return this.activeSubscriptions.get(pubsubTopic);
} }
private setActiveSubscription( private setActiveSubscription(
pubsubTopic: PubsubTopic, pubsubTopic: PubsubTopic,
subscription: SubscriptionManager subscription: Subscription
): SubscriptionManager { ): Subscription {
this.activeSubscriptions.set(pubsubTopic, subscription); this.activeSubscriptions.set(pubsubTopic, subscription);
return subscription; return subscription;
} }

View File

@ -36,7 +36,7 @@ import { DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL } from "./constants.js";
const log = new Logger("sdk:filter:subscription_manager"); const log = new Logger("sdk:filter:subscription_manager");
export class SubscriptionManager implements ISubscription { export class Subscription implements ISubscription {
private reliabilityMonitor: ReceiverReliabilityMonitor; private reliabilityMonitor: ReceiverReliabilityMonitor;
private keepAliveTimeout: number; private keepAliveTimeout: number;