plugin-cluster-manager 1.1.5 → 1.1.6
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/README.md +17 -5
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/locale/en-US.json +28 -4
- package/dist/locale/vi-VN.json +28 -4
- package/dist/locale/zh-CN.json +28 -4
- package/dist/server/actions/event-queue-monitor.js +123 -1
- package/dist/server/actions/orchestrator.js +1 -1
- package/dist/server/actions/plugin-operations.js +171 -0
- package/dist/server/collections/cluster-manager-plugins.js +44 -0
- package/dist/server/plugin.js +8 -2
- package/package.json +9 -4
- package/src/client/ClusterManagerLayout.tsx +16 -10
- package/src/client/EventQueueMonitor.tsx +349 -202
- package/src/client/PluginOperations.tsx +226 -0
- package/src/locale/en-US.json +28 -4
- package/src/locale/vi-VN.json +28 -4
- package/src/locale/zh-CN.json +28 -4
- package/src/server/actions/event-queue-monitor.ts +234 -95
- package/src/server/actions/orchestrator.ts +1 -1
- package/src/server/actions/plugin-operations.ts +151 -0
- package/src/server/collections/cluster-manager-plugins.ts +19 -0
- package/src/server/plugin.ts +28 -20
- package/dist/client/AclCacheManager.d.ts +0 -2
- package/dist/client/CacheMonitor.d.ts +0 -2
- package/dist/client/ClusterManagerLayout.d.ts +0 -2
- package/dist/client/ClusterNodes.d.ts +0 -2
- package/dist/client/ContainerOrchestrator.d.ts +0 -2
- package/dist/client/EventQueueMonitor.d.ts +0 -2
- package/dist/client/LockMonitor.d.ts +0 -2
- package/dist/client/PackageInstaller.d.ts +0 -2
- package/dist/client/RedisMonitor.d.ts +0 -2
- package/dist/client/TaskManager.d.ts +0 -2
- package/dist/client/WorkflowExecutions.d.ts +0 -2
- package/dist/client/index.d.ts +0 -5
- package/dist/client/utils.d.ts +0 -12
- package/dist/index.d.ts +0 -2
- package/dist/server/actions/acl-cache.d.ts +0 -53
- package/dist/server/actions/cache-monitor.d.ts +0 -23
- package/dist/server/actions/cluster-nodes.d.ts +0 -49
- package/dist/server/actions/event-queue-monitor.d.ts +0 -13
- package/dist/server/actions/lock-monitor.d.ts +0 -19
- package/dist/server/actions/orchestrator.d.ts +0 -58
- package/dist/server/actions/package-manager.d.ts +0 -6
- package/dist/server/actions/redis-monitor.d.ts +0 -12
- package/dist/server/actions/tasks.d.ts +0 -7
- package/dist/server/actions/workflow-executions.d.ts +0 -7
- package/dist/server/adapters/redis-lock-adapter.d.ts +0 -15
- package/dist/server/adapters/redis-node-registry.d.ts +0 -12
- package/dist/server/adapters/redis-pubsub-adapter.d.ts +0 -16
- package/dist/server/collections/app.d.ts +0 -8
- package/dist/server/collections/cluster-manager-acl-cache.d.ts +0 -22
- package/dist/server/collections/cluster-manager-cache-mgr.d.ts +0 -22
- package/dist/server/collections/cluster-manager-cluster.d.ts +0 -22
- package/dist/server/collections/cluster-manager-lock.d.ts +0 -22
- package/dist/server/collections/cluster-manager-queue.d.ts +0 -22
- package/dist/server/collections/cluster-manager-redis.d.ts +0 -22
- package/dist/server/collections/cluster-manager-workflow.d.ts +0 -22
- package/dist/server/collections/cluster-manager.d.ts +0 -22
- package/dist/server/collections/orchestrator-settings.d.ts +0 -59
- package/dist/server/collections/orchestrator-stacks.d.ts +0 -102
- package/dist/server/collections/worker-orchestrator.d.ts +0 -22
- package/dist/server/collections/worker-packages-configs.d.ts +0 -3
- package/dist/server/collections/worker-packages.d.ts +0 -22
- package/dist/server/index.d.ts +0 -1
- package/dist/server/orchestrator/PackageManager.d.ts +0 -37
- package/dist/server/orchestrator/docker-adapter.d.ts +0 -41
- package/dist/server/orchestrator/index.d.ts +0 -4
- package/dist/server/orchestrator/k8s-adapter.d.ts +0 -50
- package/dist/server/orchestrator/leader-election.d.ts +0 -48
- package/dist/server/orchestrator/types.d.ts +0 -84
- package/dist/server/plugin.d.ts +0 -26
- package/dist/server/utils/node.d.ts +0 -6
- package/dist/server/utils/redis.d.ts +0 -29
- package/dist/shared/packages.d.ts +0 -23
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DUMMY COLLECTION
|
|
3
|
-
* This collection is created to prevent NocoBase workflow/ACL from throwing the error:
|
|
4
|
-
* '[Workflow pre-action]: collection "workerOrchestrator" not found'
|
|
5
|
-
*
|
|
6
|
-
* Since 'workerOrchestrator' is registered as a resourcer in plugin.ts, NocoBase
|
|
7
|
-
* implicitly looks for a collection with the same name.
|
|
8
|
-
* We set dumpRules: 'skip' and avoid timestamps to ensure this collection
|
|
9
|
-
* is completely ignored during backups/migrations and doesn't pollute the actual DB.
|
|
10
|
-
*/
|
|
11
|
-
declare const _default: {
|
|
12
|
-
name: string;
|
|
13
|
-
dumpRules: string;
|
|
14
|
-
autoGenId: boolean;
|
|
15
|
-
createdAt: boolean;
|
|
16
|
-
updatedAt: boolean;
|
|
17
|
-
fields: {
|
|
18
|
-
name: string;
|
|
19
|
-
type: string;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DUMMY COLLECTION
|
|
3
|
-
* This collection is created to prevent NocoBase workflow/ACL from throwing the error:
|
|
4
|
-
* '[Workflow pre-action]: collection "workerPackages" not found'
|
|
5
|
-
*
|
|
6
|
-
* Since 'workerPackages' is registered as a resourcer in plugin.ts, NocoBase
|
|
7
|
-
* implicitly looks for a collection with the same name.
|
|
8
|
-
* We set dumpRules: 'skip' and avoid timestamps to ensure this collection
|
|
9
|
-
* is completely ignored during backups/migrations and doesn't pollute the actual DB.
|
|
10
|
-
*/
|
|
11
|
-
declare const _default: {
|
|
12
|
-
name: string;
|
|
13
|
-
dumpRules: string;
|
|
14
|
-
autoGenId: boolean;
|
|
15
|
-
createdAt: boolean;
|
|
16
|
-
updatedAt: boolean;
|
|
17
|
-
fields: {
|
|
18
|
-
name: string;
|
|
19
|
-
type: string;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
package/dist/server/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './plugin';
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Application from '@nocobase/server';
|
|
2
|
-
type TargetRole = 'app' | 'worker' | 'sandbox' | 'all';
|
|
3
|
-
interface InstallPayload {
|
|
4
|
-
targetRole: TargetRole;
|
|
5
|
-
packages: {
|
|
6
|
-
apt?: string[];
|
|
7
|
-
npm?: string[];
|
|
8
|
-
python?: string[];
|
|
9
|
-
};
|
|
10
|
-
registryConfig?: {
|
|
11
|
-
aptMirrorUrl?: string;
|
|
12
|
-
npmRegistryUrl?: string;
|
|
13
|
-
pypiIndexUrl?: string;
|
|
14
|
-
pypiTrustedHost?: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export declare class PackageManager {
|
|
18
|
-
private app;
|
|
19
|
-
constructor(app: Application);
|
|
20
|
-
/**
|
|
21
|
-
* Called from REST action when admin clicks "Install Packages".
|
|
22
|
-
* Publishes task to all nodes via PubSub. Nodes will filter by targetRole.
|
|
23
|
-
*/
|
|
24
|
-
dispatchInstall(payload: InstallPayload): Promise<string>;
|
|
25
|
-
executeInstall(payload: InstallPayload): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Run a command without a shell so registry URLs and package names are not re-parsed as shell syntax.
|
|
28
|
-
*/
|
|
29
|
-
private runCommand;
|
|
30
|
-
private getMissingPackages;
|
|
31
|
-
private isPackageInstalled;
|
|
32
|
-
private runStatus;
|
|
33
|
-
private configureAptMirror;
|
|
34
|
-
private moveIfExists;
|
|
35
|
-
private updateInstallStatus;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Docker Adapter — MVP implementation
|
|
3
|
-
*
|
|
4
|
-
* Uses dockerode to communicate with the Docker daemon via unix socket.
|
|
5
|
-
* Containers are tagged with label `orchestrator.stack=<stackName>` for identification.
|
|
6
|
-
*
|
|
7
|
-
* Security: Docker socket = root on host. Only admin users should access
|
|
8
|
-
* orchestrator actions (enforced by ACL in plugin.ts).
|
|
9
|
-
*/
|
|
10
|
-
import type { IOrchestratorAdapter, ContainerInfo, ScaleResult, ContainerStats, StackConfig } from './types';
|
|
11
|
-
export declare class DockerAdapter implements IOrchestratorAdapter {
|
|
12
|
-
readonly name = "docker";
|
|
13
|
-
private docker;
|
|
14
|
-
private workerLabels;
|
|
15
|
-
constructor(options?: {
|
|
16
|
-
socketPath?: string;
|
|
17
|
-
host?: string;
|
|
18
|
-
port?: number;
|
|
19
|
-
workerLabelSelector?: string;
|
|
20
|
-
});
|
|
21
|
-
ping(): Promise<boolean>;
|
|
22
|
-
listContainers(stack: StackConfig): Promise<ContainerInfo[]>;
|
|
23
|
-
assertManagedByStack(stack: StackConfig, containerId: string): Promise<void>;
|
|
24
|
-
scale(stack: StackConfig, replicas: number): Promise<ScaleResult>;
|
|
25
|
-
startContainer(containerId: string): Promise<void>;
|
|
26
|
-
stopContainer(containerId: string, timeoutSecs?: number): Promise<void>;
|
|
27
|
-
removeContainer(containerId: string): Promise<void>;
|
|
28
|
-
getStats(containerId: string): Promise<ContainerStats>;
|
|
29
|
-
getLogs(containerId: string, tail?: number): Promise<string>;
|
|
30
|
-
listNetworks(): Promise<{
|
|
31
|
-
id: string;
|
|
32
|
-
name: string;
|
|
33
|
-
}[]>;
|
|
34
|
-
private mapState;
|
|
35
|
-
private buildEnvArray;
|
|
36
|
-
private buildLabelFilters;
|
|
37
|
-
private parseLabelSelector;
|
|
38
|
-
private labelsMatch;
|
|
39
|
-
private parseMemory;
|
|
40
|
-
private demuxDockerLogs;
|
|
41
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kubernetes Adapter
|
|
3
|
-
*
|
|
4
|
-
* Manages worker Deployments/Pods via the K8s API using in-cluster ServiceAccount
|
|
5
|
-
* or kubeconfig. Only manages resources labeled with `orchestrator.stack=<stackName>`.
|
|
6
|
-
*
|
|
7
|
-
* Prerequisites:
|
|
8
|
-
* - ServiceAccount with RBAC: get/list/create/patch/update on Deployments and Deployments/scale
|
|
9
|
-
* - get/list/delete on Pods and get on Pods/log
|
|
10
|
-
* - Or KUBECONFIG env var pointing to a valid kubeconfig file
|
|
11
|
-
*/
|
|
12
|
-
import type { IOrchestratorAdapter, ContainerInfo, ScaleResult, ContainerStats, StackConfig } from './types';
|
|
13
|
-
export declare class K8sAdapter implements IOrchestratorAdapter {
|
|
14
|
-
readonly name = "kubernetes";
|
|
15
|
-
private appsApi;
|
|
16
|
-
private coreApi;
|
|
17
|
-
private kc;
|
|
18
|
-
private namespace;
|
|
19
|
-
private workerLabelSelector;
|
|
20
|
-
private workerLabels;
|
|
21
|
-
constructor(options?: {
|
|
22
|
-
kubeconfig?: string;
|
|
23
|
-
context?: string;
|
|
24
|
-
namespace?: string;
|
|
25
|
-
workerLabelSelector?: string;
|
|
26
|
-
});
|
|
27
|
-
ping(): Promise<boolean>;
|
|
28
|
-
listContainers(stack: StackConfig): Promise<ContainerInfo[]>;
|
|
29
|
-
scale(stack: StackConfig, replicas: number): Promise<ScaleResult>;
|
|
30
|
-
startContainer(containerId: string): Promise<void>;
|
|
31
|
-
stopContainer(containerId: string): Promise<void>;
|
|
32
|
-
removeContainer(containerId: string): Promise<void>;
|
|
33
|
-
getStats(containerId: string): Promise<ContainerStats>;
|
|
34
|
-
getLogs(containerId: string, tail?: number): Promise<string>;
|
|
35
|
-
assertManagedByStack(stack: StackConfig, containerId: string): Promise<void>;
|
|
36
|
-
private parsePodRef;
|
|
37
|
-
private buildDeployment;
|
|
38
|
-
private buildWorkerLabels;
|
|
39
|
-
private buildContainerEnv;
|
|
40
|
-
private buildResources;
|
|
41
|
-
private cleanArray;
|
|
42
|
-
private isEmptyValue;
|
|
43
|
-
private isNotFound;
|
|
44
|
-
private assertDeploymentManagedByStack;
|
|
45
|
-
private joinSelectors;
|
|
46
|
-
private parseLabelSelector;
|
|
47
|
-
private labelsMatch;
|
|
48
|
-
private mapPodPhase;
|
|
49
|
-
private parseK8sMemory;
|
|
50
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Leader Election using native Redis commands
|
|
3
|
-
*
|
|
4
|
-
* Ensures only ONE app instance runs orchestrator write operations (scale, start, stop).
|
|
5
|
-
* Other instances remain read-only followers.
|
|
6
|
-
*
|
|
7
|
-
* Flow:
|
|
8
|
-
* 1. After app starts, tryBecomeLeader() attempts to acquire the Redis lock using SET NX PX.
|
|
9
|
-
* 2. If acquired → this node is leader; a renewal timer extends the lock periodically using a Lua script.
|
|
10
|
-
* 3. If not acquired → this node is follower; it retries periodically.
|
|
11
|
-
* 4. On app stop → release the lock gracefully using a Lua script.
|
|
12
|
-
* 5. On crash → lock auto-expires after TTL.
|
|
13
|
-
*/
|
|
14
|
-
export declare class LeaderElection {
|
|
15
|
-
private app;
|
|
16
|
-
private renewTimer;
|
|
17
|
-
private retryTimer;
|
|
18
|
-
private _isLeader;
|
|
19
|
-
private _leaderId;
|
|
20
|
-
private standaloneMode;
|
|
21
|
-
private enabled;
|
|
22
|
-
private _disabledReason;
|
|
23
|
-
private redis;
|
|
24
|
-
constructor(app: any, options?: {
|
|
25
|
-
standaloneMode?: boolean;
|
|
26
|
-
enabled?: boolean;
|
|
27
|
-
disabledReason?: string;
|
|
28
|
-
});
|
|
29
|
-
get isLeader(): boolean;
|
|
30
|
-
get leaderId(): string;
|
|
31
|
-
get disabledReason(): string;
|
|
32
|
-
/**
|
|
33
|
-
* Initialize Redis client. Must be called after Redis is connected.
|
|
34
|
-
*/
|
|
35
|
-
init(): Promise<boolean>;
|
|
36
|
-
/**
|
|
37
|
-
* Attempt to become the orchestrator leader.
|
|
38
|
-
* If successful, starts a renewal loop.
|
|
39
|
-
* If not, starts a retry loop.
|
|
40
|
-
*/
|
|
41
|
-
tryBecomeLeader(): Promise<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Gracefully release leadership.
|
|
44
|
-
*/
|
|
45
|
-
release(): Promise<void>;
|
|
46
|
-
private startRenewal;
|
|
47
|
-
private startRetry;
|
|
48
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orchestrator Adapter Interface
|
|
3
|
-
*
|
|
4
|
-
* Abstraction layer for container runtimes (Docker, K8s, Swarm).
|
|
5
|
-
* Each adapter implements this interface so the plugin logic is runtime-agnostic.
|
|
6
|
-
*/
|
|
7
|
-
export interface ContainerInfo {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
status: 'running' | 'stopped' | 'pending' | 'error' | 'creating' | 'exited';
|
|
11
|
-
image: string;
|
|
12
|
-
createdAt: Date;
|
|
13
|
-
cpu?: number;
|
|
14
|
-
memory?: number;
|
|
15
|
-
labels?: Record<string, string>;
|
|
16
|
-
}
|
|
17
|
-
export interface ScaleResult {
|
|
18
|
-
previousReplicas: number;
|
|
19
|
-
currentReplicas: number;
|
|
20
|
-
containersCreated?: string[];
|
|
21
|
-
containersRemoved?: string[];
|
|
22
|
-
}
|
|
23
|
-
export interface ContainerStats {
|
|
24
|
-
cpu: number;
|
|
25
|
-
memory: number;
|
|
26
|
-
memoryLimit: number;
|
|
27
|
-
networkRx: number;
|
|
28
|
-
networkTx: number;
|
|
29
|
-
}
|
|
30
|
-
export interface StackConfig {
|
|
31
|
-
id?: number;
|
|
32
|
-
name: string;
|
|
33
|
-
adapter: 'docker' | 'kubernetes';
|
|
34
|
-
image: string;
|
|
35
|
-
command?: string;
|
|
36
|
-
envVars?: Record<string, string>;
|
|
37
|
-
volumes?: string[];
|
|
38
|
-
networks?: string[];
|
|
39
|
-
resourceLimits?: {
|
|
40
|
-
memory?: string;
|
|
41
|
-
cpu?: string;
|
|
42
|
-
};
|
|
43
|
-
replicas: number;
|
|
44
|
-
desiredReplicas: number;
|
|
45
|
-
enabled: boolean;
|
|
46
|
-
namespace?: string;
|
|
47
|
-
deploymentName?: string;
|
|
48
|
-
serviceAccountName?: string;
|
|
49
|
-
imagePullPolicy?: string;
|
|
50
|
-
k8sContainerName?: string;
|
|
51
|
-
k8sEnv?: Record<string, any>[];
|
|
52
|
-
k8sEnvFrom?: Record<string, any>[];
|
|
53
|
-
k8sVolumeMounts?: Record<string, any>[];
|
|
54
|
-
k8sVolumes?: Record<string, any>[];
|
|
55
|
-
networkMode?: string;
|
|
56
|
-
restartPolicy?: string;
|
|
57
|
-
}
|
|
58
|
-
export interface IOrchestratorAdapter {
|
|
59
|
-
/** Human-readable adapter name */
|
|
60
|
-
readonly name: string;
|
|
61
|
-
/** Test connectivity to the runtime */
|
|
62
|
-
ping(): Promise<boolean>;
|
|
63
|
-
/** List containers managed by a stack */
|
|
64
|
-
listContainers(stack: StackConfig): Promise<ContainerInfo[]>;
|
|
65
|
-
/** Verify that a runtime container/pod belongs to the requested stack */
|
|
66
|
-
assertManagedByStack(stack: StackConfig, containerId: string): Promise<void>;
|
|
67
|
-
/** Scale stack to N replicas */
|
|
68
|
-
scale(stack: StackConfig, replicas: number): Promise<ScaleResult>;
|
|
69
|
-
/** Start a stopped container */
|
|
70
|
-
startContainer(containerId: string): Promise<void>;
|
|
71
|
-
/** Gracefully stop a running container */
|
|
72
|
-
stopContainer(containerId: string, timeoutSecs?: number): Promise<void>;
|
|
73
|
-
/** Remove/delete a container (force) */
|
|
74
|
-
removeContainer(containerId: string): Promise<void>;
|
|
75
|
-
/** Get real-time resource stats for a container */
|
|
76
|
-
getStats(containerId: string): Promise<ContainerStats>;
|
|
77
|
-
/** Get tail logs from a container */
|
|
78
|
-
getLogs(containerId: string, tail?: number): Promise<string>;
|
|
79
|
-
/** List available networks (if supported by adapter) */
|
|
80
|
-
listNetworks?(): Promise<{
|
|
81
|
-
id: string;
|
|
82
|
-
name: string;
|
|
83
|
-
}[]>;
|
|
84
|
-
}
|
package/dist/server/plugin.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@nocobase/server';
|
|
2
|
-
import { RedisNodeRegistry } from './adapters/redis-node-registry';
|
|
3
|
-
import type { IOrchestratorAdapter } from './orchestrator/types';
|
|
4
|
-
import { LeaderElection } from './orchestrator/leader-election';
|
|
5
|
-
export declare class PluginClusterManagerServer extends Plugin {
|
|
6
|
-
nodeRegistry: RedisNodeRegistry;
|
|
7
|
-
orchestrator: IOrchestratorAdapter | null;
|
|
8
|
-
leaderElection: LeaderElection | null;
|
|
9
|
-
beforeLoad(): Promise<void>;
|
|
10
|
-
load(): Promise<void>;
|
|
11
|
-
private registerPubSubAdapter;
|
|
12
|
-
/**
|
|
13
|
-
* Initialize the Container Orchestrator subsystem.
|
|
14
|
-
* Config is loaded from DB (orchestratorSettings collection) first,
|
|
15
|
-
* then falls back to ORCHESTRATOR_ADAPTER env var.
|
|
16
|
-
* This allows manual configuration via the NocoBase admin UI.
|
|
17
|
-
*/
|
|
18
|
-
private initOrchestrator;
|
|
19
|
-
/**
|
|
20
|
-
* Connect (or reconnect) the orchestrator adapter based on settings.
|
|
21
|
-
* Can be called at startup or when user saves new settings via UI.
|
|
22
|
-
*/
|
|
23
|
-
connectAdapter(settings: any): Promise<boolean>;
|
|
24
|
-
private isWorkerOnlyNode;
|
|
25
|
-
}
|
|
26
|
-
export default PluginClusterManagerServer;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate a universally unique identifier for this specific Node.js process.
|
|
3
|
-
* Combines app name, worker mode, hostname, port, and PID to ensure uniqueness
|
|
4
|
-
* even when multiple workers run on the exact same host.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getLocalNodeId(app: any): string;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Context } from '@nocobase/actions';
|
|
2
|
-
export declare function getRedisClient(app?: any): any;
|
|
3
|
-
/**
|
|
4
|
-
* Get the shared Redis connection from the app's connection manager.
|
|
5
|
-
* Returns undefined if Redis is not configured.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getRedis(ctx: Context): any;
|
|
8
|
-
/**
|
|
9
|
-
* Get Redis connection or throw 503 if not available.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getRedisOrThrow(ctx: Context): any;
|
|
12
|
-
/**
|
|
13
|
-
* Scan Redis keys using SCAN (cursor-based) instead of the blocking KEYS command.
|
|
14
|
-
* Safe for production use — never blocks the Redis event loop.
|
|
15
|
-
*
|
|
16
|
-
* @param redis - Redis client instance
|
|
17
|
-
* @param pattern - Glob pattern to match keys (e.g. "acl:can:*")
|
|
18
|
-
* @param batchSize - Number of keys to scan per iteration (default 200)
|
|
19
|
-
*/
|
|
20
|
-
export declare function scanKeys(redis: any, pattern: string, batchSize?: number): Promise<string[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Delete keys in chunked batches to avoid exceeding Redis command argument limits.
|
|
23
|
-
*
|
|
24
|
-
* @param redis - Redis client instance
|
|
25
|
-
* @param keys - Array of keys to delete
|
|
26
|
-
* @param chunkSize - Max keys per DEL command (default 500)
|
|
27
|
-
* @returns Total number of keys deleted
|
|
28
|
-
*/
|
|
29
|
-
export declare function deleteKeysChunked(redis: any, keys: string[], chunkSize?: number): Promise<number>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_WORKER_PACKAGES: {
|
|
2
|
-
apt: string[];
|
|
3
|
-
python: string[];
|
|
4
|
-
npm: string[];
|
|
5
|
-
};
|
|
6
|
-
export interface WorkerPackageMap {
|
|
7
|
-
apt?: string[];
|
|
8
|
-
npm?: string[];
|
|
9
|
-
python?: string[];
|
|
10
|
-
}
|
|
11
|
-
export interface CustomPackageMap {
|
|
12
|
-
python?: string[];
|
|
13
|
-
node?: string[];
|
|
14
|
-
npm?: string[];
|
|
15
|
-
}
|
|
16
|
-
export declare function normalizePackages(packages?: Array<string | undefined>): string[];
|
|
17
|
-
export declare function parsePackageText(value: unknown, fallback?: string[]): string[];
|
|
18
|
-
export declare function formatPackageText(packages?: string[]): string;
|
|
19
|
-
export declare function packagesFromConfig(config: {
|
|
20
|
-
aptPackages?: unknown;
|
|
21
|
-
pythonPackages?: unknown;
|
|
22
|
-
npmPackages?: unknown;
|
|
23
|
-
}): WorkerPackageMap;
|