1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00
This commit is contained in:
Leibale
2023-06-20 20:04:05 -04:00
parent f22879dffa
commit 4894c26458
35 changed files with 848 additions and 662 deletions

View File

@@ -1,22 +1,25 @@
export enum ClusterSlotStates {
IMPORTING = 'IMPORTING',
MIGRATING = 'MIGRATING',
STABLE = 'STABLE',
NODE = 'NODE'
}
import { SimpleStringReply, Command } from '../RESP/types';
export function transformArguments(
slot: number,
state: ClusterSlotStates,
nodeId?: string
): Array<string> {
export const CLUSTER_SLOT_STATES = {
IMPORTING: 'IMPORTING',
MIGRATING: 'MIGRATING',
STABLE: 'STABLE',
NODE: 'NODE'
} as const;
export type ClusterSlotStates = typeof CLUSTER_SLOT_STATES[keyof typeof CLUSTER_SLOT_STATES];
export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(slot: number, state: ClusterSlotStates, nodeId?: string) {
const args = ['CLUSTER', 'SETSLOT', slot.toString(), state];
if (nodeId) {
args.push(nodeId);
args.push(nodeId);
}
return args;
}
export declare function transformReply(): 'OK';
},
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
} as const satisfies Command;