@persistica/flux-mesh 0.0.26 → 0.0.28
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/index.js +30 -30
- package/package.json +1 -1
- package/src/_managers/agent.manager.d.ts +3 -3
- package/src/_managers/authority.manager.d.ts +2 -2
- package/src/_managers/global/global-client.manager.d.ts +2 -0
- package/src/_managers/local/local-agent.manager.d.ts +3 -3
- package/src/_managers/local/local-authority.manager.d.ts +2 -2
- package/src/_routes/auth/network-client.post.route.d.ts +3 -3
- package/src/_ws-handlers/ws-socket-close.d.ts +4 -0
- package/src/business-logic/channels/channel-manager.class.d.ts +7 -15
- package/src/business-logic/channels/channel-manager.utils.d.ts +4 -0
- package/src/business-logic/processes/process.class.d.ts +24 -0
- package/src/main.d.ts +2 -0
- package/src/register/network-agent-redis-cache.class.d.ts +3 -3
- package/src/register/network-agent.service.d.ts +30 -0
- package/src/register/{network-authority-redis-cache.class.d.ts → network-authority-cache.class.d.ts} +3 -2
- package/src/routing/redis/redis-connection.class.d.ts +23 -14
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type TAddress, type TClientId } from '@flux/shared/types';
|
|
2
2
|
import { RedisConnection } from '../routing/redis/redis-connection.class';
|
|
3
3
|
import { TConnectedClientSocket } from '../connected-client-socket.types';
|
|
4
|
-
import {
|
|
4
|
+
import { NetworkAgentService } from '../register/network-agent.service';
|
|
5
5
|
export declare class AgentManager {
|
|
6
6
|
private readonly _redisConnection;
|
|
7
7
|
private readonly _clientMap;
|
|
8
|
-
private readonly
|
|
8
|
+
private readonly _networkAgentService;
|
|
9
9
|
private readonly machineAddress;
|
|
10
10
|
private readonly processAddress;
|
|
11
11
|
private readonly _globalClientManager;
|
|
12
12
|
private readonly _localAgentManager;
|
|
13
|
-
constructor(_redisConnection: RedisConnection, _clientMap: Map<TClientId, TConnectedClientSocket>,
|
|
13
|
+
constructor(_redisConnection: RedisConnection, _clientMap: Map<TClientId, TConnectedClientSocket>, _networkAgentService: NetworkAgentService);
|
|
14
14
|
kick(agentAddress: TAddress): void;
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TAddress, type TClientId } from '@flux/shared/types';
|
|
2
2
|
import { RedisConnection } from '../routing/redis/redis-connection.class';
|
|
3
3
|
import { TConnectedClientSocket } from '../connected-client-socket.types';
|
|
4
|
-
import {
|
|
4
|
+
import { NetworkAuthorityCache } from '../register/network-authority-cache.class';
|
|
5
5
|
export declare class AuthorityManager {
|
|
6
6
|
private readonly _redisConnection;
|
|
7
7
|
private readonly _clientMap;
|
|
@@ -10,6 +10,6 @@ export declare class AuthorityManager {
|
|
|
10
10
|
private readonly processAddress;
|
|
11
11
|
private readonly _globalClientManager;
|
|
12
12
|
private readonly _localAuthorityManager;
|
|
13
|
-
constructor(_redisConnection: RedisConnection, _clientMap: Map<TClientId, TConnectedClientSocket>, _networkAuthorityRedisCache:
|
|
13
|
+
constructor(_redisConnection: RedisConnection, _clientMap: Map<TClientId, TConnectedClientSocket>, _networkAuthorityRedisCache: NetworkAuthorityCache);
|
|
14
14
|
kick(authorityAddress: TAddress): void;
|
|
15
15
|
}
|
|
@@ -8,6 +8,8 @@ import { RedisConnection } from '../../routing/redis/redis-connection.class';
|
|
|
8
8
|
export declare class GlobalClientManager {
|
|
9
9
|
private readonly _redisConnection;
|
|
10
10
|
private readonly processAddress;
|
|
11
|
+
private readonly networkAgentRedisService;
|
|
12
|
+
private readonly networkAuthorityRedisService;
|
|
11
13
|
constructor(_redisConnection: RedisConnection);
|
|
12
14
|
/**
|
|
13
15
|
* Sends a global message to kick a client.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { TClientId } from '@flux/shared/types';
|
|
5
5
|
import { TConnectedClientSocket } from '../../connected-client-socket.types';
|
|
6
|
-
import {
|
|
6
|
+
import { NetworkAgentService } from '../../register/network-agent.service';
|
|
7
7
|
export declare class LocalAgentManager {
|
|
8
8
|
private readonly _clientMap;
|
|
9
|
-
private readonly
|
|
10
|
-
constructor(_clientMap: Map<TClientId, TConnectedClientSocket>,
|
|
9
|
+
private readonly _networkAgentService;
|
|
10
|
+
constructor(_clientMap: Map<TClientId, TConnectedClientSocket>, _networkAgentService: NetworkAgentService);
|
|
11
11
|
kickAgent(clientId: TClientId): Promise<void>;
|
|
12
12
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { TClientId } from '@flux/shared/types';
|
|
5
5
|
import type { TConnectedClientSocket } from '../../connected-client-socket.types';
|
|
6
|
-
import {
|
|
6
|
+
import { NetworkAuthorityCache } from '../../register/network-authority-cache.class';
|
|
7
7
|
export declare class LocalAuthorityManager {
|
|
8
8
|
private readonly _clientMap;
|
|
9
9
|
private readonly _networkAuthorityRedisCache;
|
|
10
|
-
constructor(_clientMap: Map<TClientId, TConnectedClientSocket>, _networkAuthorityRedisCache:
|
|
10
|
+
constructor(_clientMap: Map<TClientId, TConnectedClientSocket>, _networkAuthorityRedisCache: NetworkAuthorityCache);
|
|
11
11
|
kickAuthority(clientId: TClientId): Promise<void>;
|
|
12
12
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { BunRequest } from 'bun';
|
|
2
2
|
import type { GlobalRPCClient } from '../../routing/rpc/core/global-rpc-client.class';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NetworkAuthorityCache } from '../../register/network-authority-cache.class';
|
|
4
4
|
/**
|
|
5
5
|
* This route is used to authorize an agent connection.
|
|
6
6
|
*
|
|
7
7
|
* @param { BunRequest } request - The incoming HTTP request
|
|
8
|
-
* @param {
|
|
8
|
+
* @param { NetworkAuthorityCache } networkAuthorityManager - The network authority manager
|
|
9
9
|
* @param { GlobalRPCClient<'authorizeAgentConnection'> } globalRPCClient - The global RPC client
|
|
10
10
|
*
|
|
11
11
|
* @returns { Promise<Response> } The HTTP response with auth token or error
|
|
12
12
|
*/
|
|
13
|
-
export declare const authorizeAgentConnection: (request: BunRequest, networkAuthorityManager:
|
|
13
|
+
export declare const authorizeAgentConnection: (request: BunRequest, networkAuthorityManager: NetworkAuthorityCache, globalRPCClient: GlobalRPCClient<"authorizeAgentConnection">) => Promise<Response>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TConnectedClientSocket } from '../connected-client-socket.types';
|
|
2
|
+
import { NetworkAuthorityCache } from '../register/network-authority-cache.class';
|
|
3
|
+
import { NetworkAgentService } from '../register/network-agent.service';
|
|
4
|
+
export declare const onSocketClosed: (clientMap: Map<string, TConnectedClientSocket>, networkAuthorityRedisCache: NetworkAuthorityCache, networkAgentService: () => NetworkAgentService) => (ws: TConnectedClientSocket, code: number) => Promise<void>;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { type TAddress, type TChannelName, type TNetworkId_S, type TSubscription_S } from '@flux/shared/types';
|
|
1
|
+
import { type TAddress, type TChannelName, type TNetworkId_S, type TSubscription_S, type TClientId } from '@flux/shared/types';
|
|
2
2
|
import type { GlobalChannelPubsub } from '../../routing/global-channel/global-channel-pubsub.class';
|
|
3
|
-
export declare const MAX_CHANNEL_MEMBERS_BY_SUBSCRIPTION_TYPE: {
|
|
4
|
-
[key in TSubscription_S]: number;
|
|
5
|
-
};
|
|
6
|
-
export declare const MAX_CHANNEL_MEMBERS: number;
|
|
7
|
-
export declare const normalizeSubscriptionType: (subscriptionType?: unknown) => TSubscription_S | undefined;
|
|
8
|
-
export declare const resolveSubscriptionTypeOrDefault: (subscriptionType?: unknown) => TSubscription_S;
|
|
9
|
-
export declare const readMaxChannelMembers: (subscriptionType?: unknown) => number;
|
|
10
|
-
export declare const readSubscriptionTypeFromClaim: (claim?: unknown) => TSubscription_S | undefined;
|
|
11
|
-
export declare const canChannelHaveMoreMembers: (memberCount: number, subscriptionType?: TSubscription_S) => boolean;
|
|
12
3
|
export declare class NetworkChannelManager {
|
|
13
4
|
private readonly _globalChannelPubsub;
|
|
14
5
|
private readonly channelUsageCount;
|
|
15
6
|
private readonly redisConnection;
|
|
16
|
-
private readonly
|
|
7
|
+
private readonly networkChannelService;
|
|
17
8
|
constructor(_globalChannelPubsub: GlobalChannelPubsub);
|
|
18
9
|
/**
|
|
19
10
|
* Checks if a channel can have more members.
|
|
@@ -33,12 +24,13 @@ export declare class NetworkChannelManager {
|
|
|
33
24
|
* Leaves all network channels.
|
|
34
25
|
*/
|
|
35
26
|
leaveAllNetworkChannels(networkId: TNetworkId_S, clientAddress: TAddress, channelNames: Set<TChannelName>): Promise<void>;
|
|
36
|
-
|
|
37
|
-
* Creates a network channel if it does not exist.
|
|
38
|
-
*/
|
|
39
|
-
private createNetworkChannelIfNotExist;
|
|
27
|
+
readChannelNamesForClientId(networkId: TNetworkId_S, clientId: TClientId): Promise<Set<TChannelName>>;
|
|
40
28
|
/**
|
|
41
29
|
* Increases the usage count of a channel.
|
|
42
30
|
*/
|
|
43
31
|
increaseUsageCount(networkId: TNetworkId_S, channelName: TChannelName, usage: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a network channel if it does not exist.
|
|
34
|
+
*/
|
|
35
|
+
private createNetworkChannelIfNotExist;
|
|
44
36
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TSubscription_S } from '@flux/shared/types';
|
|
2
|
+
export declare const resolveSubscriptionTypeOrDefault: (subscriptionType?: unknown) => TSubscription_S;
|
|
3
|
+
export declare const readSubscriptionTypeFromClaim: (claim?: unknown) => TSubscription_S | undefined;
|
|
4
|
+
export declare const canChannelHaveMoreMembers: (memberCount: number, subscriptionType?: TSubscription_S) => boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type TProcessAddress, type TMachineAddress } from '@flux/shared/types';
|
|
2
|
+
import { RedisConnection } from '../../routing/redis/redis-connection.class';
|
|
3
|
+
import { NetworkAgentService } from '../../register/network-agent.service';
|
|
4
|
+
export declare class ProcessClass {
|
|
5
|
+
private readonly _redisConnection;
|
|
6
|
+
private readonly _networkAgentService;
|
|
7
|
+
constructor(_redisConnection: RedisConnection, _networkAgentService: NetworkAgentService);
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
cleanupOrphans(machineAddress: TMachineAddress): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Marks the given address as connected in Redis.
|
|
14
|
+
*/
|
|
15
|
+
setConnected(processAddress: TProcessAddress): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Marks the given address as disconnected in Redis.
|
|
18
|
+
*/
|
|
19
|
+
setDisconnected(processAddress: TProcessAddress): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Returns up to 3 lost processes while prioritizing ones that have been running on this machine, and oldest.
|
|
22
|
+
*/
|
|
23
|
+
private readDisconnectedAddresses;
|
|
24
|
+
}
|
package/src/main.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare class FluxMeshServer {
|
|
|
12
12
|
private readonly globalChannelPubsub;
|
|
13
13
|
private readonly channelManager;
|
|
14
14
|
private readonly agentManager;
|
|
15
|
+
private readonly processClass;
|
|
16
|
+
private readonly networkAgentService;
|
|
15
17
|
constructor(optionsOrPort?: (TOptions | number) | undefined);
|
|
16
18
|
onReady(fn: () => void): void;
|
|
17
19
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NetworkAgentRedisService } from '@flux/mesh/store/redis/network-agent';
|
|
2
2
|
import { NetworkUsageRedisCacheService } from '@flux/mesh/store/redis/network-usage';
|
|
3
3
|
import type { TAddress, TClientId, TAgentOwnUId, TNetworkId_S } from '@flux/shared/types';
|
|
4
4
|
import type { TFluxClientUID } from '@flux/shared/utils';
|
|
@@ -13,7 +13,7 @@ export declare class NetworkAgentRedisCache {
|
|
|
13
13
|
* Register an agent.
|
|
14
14
|
*
|
|
15
15
|
* @param { TNetworkId_S } networkId - The network ID
|
|
16
|
-
* @param { TClientId }
|
|
16
|
+
* @param { TClientId } clientId - The client socket ID
|
|
17
17
|
* @param { Bun.SocketAddress | null } ip - The client IP address
|
|
18
18
|
* @param { TAddress } address - The client address
|
|
19
19
|
* @param { object } throughput - The throughput tracking object
|
|
@@ -22,7 +22,7 @@ export declare class NetworkAgentRedisCache {
|
|
|
22
22
|
*
|
|
23
23
|
* @returns { Promise<void> }
|
|
24
24
|
*/
|
|
25
|
-
registerAgent(networkId: TNetworkId_S,
|
|
25
|
+
registerAgent(networkId: TNetworkId_S, clientId: TClientId, ip: Bun.SocketAddress | null, address: TAddress, throughput: {
|
|
26
26
|
bytes: number;
|
|
27
27
|
packets: number;
|
|
28
28
|
}, uid?: TAgentOwnUId, machineUID?: TFluxClientUID): Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TAddress, TClientId, TAgentOwnUId, TNetworkId_S, TChannelName } from '@flux/shared/types';
|
|
2
|
+
import type { TFluxClientUID } from '@flux/shared/utils';
|
|
3
|
+
import { NetworkAgentRedisCache } from './network-agent-redis-cache.class';
|
|
4
|
+
import { NetworkChannelManager } from '../business-logic/channels/channel-manager.class';
|
|
5
|
+
import { RedisConnection } from '../routing/redis/redis-connection.class';
|
|
6
|
+
export declare class NetworkAgentService {
|
|
7
|
+
private readonly networkAgentRedisCache;
|
|
8
|
+
private readonly redisConnection;
|
|
9
|
+
private readonly networkChannelManager;
|
|
10
|
+
private readonly networkAgentRedisRepository;
|
|
11
|
+
constructor(networkAgentRedisCache: NetworkAgentRedisCache, redisConnection: RedisConnection, networkChannelManager: NetworkChannelManager);
|
|
12
|
+
/**
|
|
13
|
+
* Register an agent.
|
|
14
|
+
*/
|
|
15
|
+
registerAgent(networkId: TNetworkId_S, clientId: TClientId, ip: Bun.SocketAddress | null, address: TAddress, throughput: {
|
|
16
|
+
bytes: number;
|
|
17
|
+
packets: number;
|
|
18
|
+
}, uid?: TAgentOwnUId, machineUID?: TFluxClientUID): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Unregisters a network agent UID and associated data from the Redis hash.
|
|
21
|
+
*/
|
|
22
|
+
unregister(clientId: TClientId, clientAddress?: TAddress, networkId?: TNetworkId_S, networkChannels?: Set<TChannelName>, clientOwnUId?: {
|
|
23
|
+
clientOwnUId: TAgentOwnUId;
|
|
24
|
+
networkId: TNetworkId_S;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the network client address by an agent's UID, using a local cache to avoid unnecessary Redis calls.
|
|
28
|
+
*/
|
|
29
|
+
resolveClientAddressByUid(networkId: TNetworkId_S, clientOwnUId: TAgentOwnUId): Promise<TAddress>;
|
|
30
|
+
}
|
package/src/register/{network-authority-redis-cache.class.d.ts → network-authority-cache.class.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TAddress, type TClientId, type TNetworkId_S } from '@flux/shared/types';
|
|
2
2
|
import type { TFluxClientUID } from '@flux/shared/utils';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class NetworkAuthorityCache {
|
|
4
4
|
private readonly redisConnection;
|
|
5
5
|
private readonly cache;
|
|
6
6
|
private readonly clientCache;
|
|
@@ -9,11 +9,12 @@ export declare class NetworkAuthorityRedisCache {
|
|
|
9
9
|
*
|
|
10
10
|
* @param { TNetworkId_S } networkId - The network ID to register on
|
|
11
11
|
* @param { TClientId } clientId - The socket ID of the authority
|
|
12
|
+
* @param { Bun.SocketAddress | null } ip - The client IP address
|
|
12
13
|
* @param { TFluxClientUID } [machineUID] - Optional machine UID
|
|
13
14
|
*
|
|
14
15
|
* @returns { Promise<void> }
|
|
15
16
|
*/
|
|
16
|
-
register(networkId: TNetworkId_S, clientId: TClientId, machineUID?: TFluxClientUID): Promise<void>;
|
|
17
|
+
register(networkId: TNetworkId_S, clientId: TClientId, ip: Bun.SocketAddress | null, machineUID?: TFluxClientUID): Promise<void>;
|
|
17
18
|
/**
|
|
18
19
|
* Unregisters a network authority from the local network.
|
|
19
20
|
*
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { TAddress, TClientId, TNetworkId_S, TNetworkToken_S, TProcessAddress } from '@flux/shared/types';
|
|
2
|
-
import { NetworkAuthorityRedisSortedSet } from '@flux/mesh/store/redis/network-authority';
|
|
3
|
-
import { NetworkAgentRedisService } from '@flux/mesh/store/redis/network-agent';
|
|
4
2
|
import type { TGlobalChannel } from '../global-channel/global-channel-pubsub.class';
|
|
5
3
|
/**
|
|
6
4
|
* Singleton function to get the Redis connection.
|
|
@@ -12,17 +10,16 @@ import type { TGlobalChannel } from '../global-channel/global-channel-pubsub.cla
|
|
|
12
10
|
export declare const getMeshRedisConnection: (_connectionString?: string) => RedisConnection;
|
|
13
11
|
export type MessageCallback = (message: string, channel?: string) => unknown;
|
|
14
12
|
export declare class RedisConnection {
|
|
15
|
-
private readonly _optionsOrURL;
|
|
16
13
|
private readonly cacheClient;
|
|
17
14
|
private readonly pubSub;
|
|
18
|
-
readonly networkAuthoritySet: NetworkAuthorityRedisSortedSet;
|
|
19
|
-
readonly networkAgentRedisService: NetworkAgentRedisService;
|
|
20
15
|
readonly hash: {
|
|
21
16
|
sadd: (key: Bun.RedisClient.KeyLike, ...members: string[]) => Promise<number>;
|
|
22
17
|
hset: {
|
|
23
18
|
(key: Bun.RedisClient.KeyLike, fields: Record<string | number, Bun.RedisClient.KeyLike | number>): Promise<number>;
|
|
24
19
|
(key: Bun.RedisClient.KeyLike, field: Bun.RedisClient.KeyLike, value: Bun.RedisClient.KeyLike, ...rest: Bun.RedisClient.KeyLike[]): Promise<number>;
|
|
25
20
|
};
|
|
21
|
+
hget: (key: Bun.RedisClient.KeyLike, field: Bun.RedisClient.KeyLike) => Promise<string | null>;
|
|
22
|
+
hdel: (key: Bun.RedisClient.KeyLike, field: Bun.RedisClient.KeyLike, ...rest: Bun.RedisClient.KeyLike[]) => Promise<number>;
|
|
26
23
|
smembers: (key: Bun.RedisClient.KeyLike) => Promise<string[]>;
|
|
27
24
|
srem: (key: Bun.RedisClient.KeyLike, ...members: string[]) => Promise<number>;
|
|
28
25
|
scard: (key: Bun.RedisClient.KeyLike) => Promise<number>;
|
|
@@ -34,7 +31,25 @@ export declare class RedisConnection {
|
|
|
34
31
|
};
|
|
35
32
|
expire: (key: Bun.RedisClient.KeyLike, seconds: number) => Promise<number>;
|
|
36
33
|
};
|
|
37
|
-
|
|
34
|
+
readonly sortedSet: {
|
|
35
|
+
zadd: (key: Bun.RedisClient.KeyLike, ...args: (string | number)[]) => Promise<number>;
|
|
36
|
+
zrem: (key: Bun.RedisClient.KeyLike, member: Bun.RedisClient.KeyLike, ...members: Bun.RedisClient.KeyLike[]) => Promise<number>;
|
|
37
|
+
zscore: (key: Bun.RedisClient.KeyLike, member: string) => Promise<number | null>;
|
|
38
|
+
zrangebylex: {
|
|
39
|
+
(key: Bun.RedisClient.KeyLike, min: string, max: string): Promise<string[]>;
|
|
40
|
+
(key: Bun.RedisClient.KeyLike, min: string, max: string, limit: "LIMIT", offset: number, count: number): Promise<string[]>;
|
|
41
|
+
(key: Bun.RedisClient.KeyLike, min: string, max: string, ...options: (string | number)[]): Promise<string[]>;
|
|
42
|
+
};
|
|
43
|
+
zrangebyscore: {
|
|
44
|
+
(key: Bun.RedisClient.KeyLike, min: string | number, max: string | number): Promise<string[]>;
|
|
45
|
+
(key: Bun.RedisClient.KeyLike, min: string | number, max: string | number, withscores: "WITHSCORES"): Promise<[string, number][]>;
|
|
46
|
+
(key: Bun.RedisClient.KeyLike, min: string | number, max: string | number, limit: "LIMIT", offset: number, count: number): Promise<string[]>;
|
|
47
|
+
(key: Bun.RedisClient.KeyLike, min: string | number, max: string | number, withscores: "WITHSCORES", ...options: (string | number)[]): Promise<[string, number][]>;
|
|
48
|
+
(key: Bun.RedisClient.KeyLike, min: string | number, max: string | number, withscores: "WITHSCORES", limit: "LIMIT", offset: number, count: number, ...options: (string | number)[]): Promise<[string, number][]>;
|
|
49
|
+
(key: Bun.RedisClient.KeyLike, min: string | number, max: string | number, ...options: (string | number)[]): Promise<string[]>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
constructor(optionsOrURL: string | {
|
|
38
53
|
name?: string;
|
|
39
54
|
url: string;
|
|
40
55
|
});
|
|
@@ -76,6 +91,8 @@ export declare class RedisConnection {
|
|
|
76
91
|
getNetworkTokenValues(networkId: TNetworkId_S): Promise<TNetworkToken_S[]>;
|
|
77
92
|
publishCustom(subChannel: 'kick-client-agent' | 'kick-client-authority', destinationProcessAddress: TProcessAddress, message: string): Promise<number>;
|
|
78
93
|
subscribeToCustom(subChannel: 'kick-client-agent' | 'kick-client-authority', destinationProcessAddress: TProcessAddress, callback: (data: string) => void): void;
|
|
94
|
+
publishGlobal(networkId: TNetworkId_S, channel: 'agent-count-change' | `agent-throughput` | 'agent-created' | 'agent-deleted' | 'authority-count-change' | 'authority-created' | 'authority-deleted' | 'channel-created' | 'channel-usage' | 'channel-count' | 'channel-updated' | 'channel-deleted', message: string): Promise<number>;
|
|
95
|
+
subscribeGlobal(networkId: TNetworkId_S, channel: 'agent-count-change' | `agent-throughput` | 'agent-created' | 'agent-deleted' | 'authority-count-change' | 'authority-created' | 'authority-deleted' | 'channel-created' | 'channel-usage' | 'channel-count' | 'channel-updated' | 'channel-deleted', callback: (data: string) => void): Promise<void>;
|
|
79
96
|
/**
|
|
80
97
|
* Publishes a message directly to an address.
|
|
81
98
|
*/
|
|
@@ -97,14 +114,6 @@ export declare class RedisConnection {
|
|
|
97
114
|
* Unsubscribes a callback from data packets on a specific network channel.
|
|
98
115
|
*/
|
|
99
116
|
unsubscribeFromNetworkChannel(networkId: string, channelName: string, callback: (clientId: TClientId, data: string) => void): void;
|
|
100
|
-
/**
|
|
101
|
-
* Marks the given address as connected in Redis.
|
|
102
|
-
*/
|
|
103
|
-
setConnected(address: string): Promise<void>;
|
|
104
|
-
/**
|
|
105
|
-
* Marks the given address as disconnected in Redis.
|
|
106
|
-
*/
|
|
107
|
-
setDisconnected(_address: string): Promise<void>;
|
|
108
117
|
/**
|
|
109
118
|
* Disconnects the Redis cache and pub/sub.
|
|
110
119
|
*
|