You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
some more commands
This commit is contained in:
@@ -1,41 +1,34 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './LCS_IDX';
|
||||
import LCS_IDX from './LCS_IDX';
|
||||
|
||||
describe('LCS_IDX', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
describe('LCS IDX', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('1', '2'),
|
||||
['LCS', '1', '2', 'IDX']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
LCS_IDX.transformArguments('1', '2'),
|
||||
['LCS', '1', '2', 'IDX']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.lcsIdx', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.mSet({
|
||||
'1': 'abc',
|
||||
'2': 'bc'
|
||||
}),
|
||||
client.lcsIdx('1', '2')
|
||||
]);
|
||||
testUtils.testWithClient('client.lcsIdx', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.mSet({
|
||||
'1': 'abc',
|
||||
'2': 'bc'
|
||||
}),
|
||||
client.lcsIdx('1', '2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(
|
||||
reply,
|
||||
{
|
||||
matches: [{
|
||||
key1: {
|
||||
start: 1,
|
||||
end: 2
|
||||
},
|
||||
key2: {
|
||||
start: 0,
|
||||
end: 1
|
||||
}
|
||||
}],
|
||||
length: 2
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
console.log(reply);
|
||||
|
||||
assert.deepEqual(
|
||||
reply,
|
||||
{
|
||||
matches: [[[1, 2], [0, 1]]],
|
||||
len: 2
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,48 +1,50 @@
|
||||
// import { RedisArgument, TuplesToMapReply, BlobStringReply, ArrayReply, NumberReply, Resp2Reply, Command, TuplesReply } from '../RESP/types';
|
||||
// import LCS from './LCS';
|
||||
import { RedisArgument, TuplesToMapReply, BlobStringReply, ArrayReply, NumberReply, Resp2Reply, Command, TuplesReply } from '../RESP/types';
|
||||
import LCS from './LCS';
|
||||
|
||||
// export interface LcsIdxOptions {
|
||||
// MINMATCHLEN?: number;
|
||||
// }
|
||||
export interface LcsIdxOptions {
|
||||
MINMATCHLEN?: number;
|
||||
}
|
||||
|
||||
// export type LcsIdxRange = TuplesReply<[
|
||||
// start: NumberReply,
|
||||
// end: NumberReply
|
||||
// ]>;
|
||||
export type LcsIdxRange = TuplesReply<[
|
||||
start: NumberReply,
|
||||
end: NumberReply
|
||||
]>;
|
||||
|
||||
// export type LcsIdxMatches = ArrayReply<
|
||||
// TuplesReply<[
|
||||
// key1: LcsIdxRange,
|
||||
// key2: LcsIdxRange
|
||||
// ]>
|
||||
// >;
|
||||
export type LcsIdxMatches = ArrayReply<
|
||||
TuplesReply<[
|
||||
key1: LcsIdxRange,
|
||||
key2: LcsIdxRange
|
||||
]>
|
||||
>;
|
||||
|
||||
// export type LcsIdxReply = TuplesToMapReply<[
|
||||
// [BlobStringReply<'matches'>, LcsIdxMatches],
|
||||
// [BlobStringReply<'len'>, NumberReply]
|
||||
// ]>;
|
||||
export type LcsIdxReply = TuplesToMapReply<[
|
||||
[BlobStringReply<'matches'>, LcsIdxMatches],
|
||||
[BlobStringReply<'len'>, NumberReply]
|
||||
]>;
|
||||
|
||||
// export default {
|
||||
// FIRST_KEY_INDEX: LCS.FIRST_KEY_INDEX,
|
||||
// IS_READ_ONLY: LCS.IS_READ_ONLY,
|
||||
// transformArguments(
|
||||
// key1: RedisArgument,
|
||||
// key2: RedisArgument,
|
||||
// options?: LcsIdxOptions
|
||||
// ) {
|
||||
// const args = LCS.transformArguments(key1, key2);
|
||||
export default {
|
||||
FIRST_KEY_INDEX: LCS.FIRST_KEY_INDEX,
|
||||
IS_READ_ONLY: LCS.IS_READ_ONLY,
|
||||
transformArguments(
|
||||
key1: RedisArgument,
|
||||
key2: RedisArgument,
|
||||
options?: LcsIdxOptions
|
||||
) {
|
||||
const args = LCS.transformArguments(key1, key2);
|
||||
|
||||
// if (options?.MINMATCHLEN) {
|
||||
// args.push('MINMATCHLEN', options.MINMATCHLEN.toString());
|
||||
// }
|
||||
args.push('IDX');
|
||||
|
||||
// return args;
|
||||
// },
|
||||
// transformReply: {
|
||||
// 2: (reply: Resp2Reply<LcsIdxReply>) => ({
|
||||
// matches: reply[1],
|
||||
// len: reply[2]
|
||||
// }),
|
||||
// 3: undefined as unknown as () => LcsIdxReply
|
||||
// }
|
||||
// } as const satisfies Command;
|
||||
if (options?.MINMATCHLEN) {
|
||||
args.push('MINMATCHLEN', options.MINMATCHLEN.toString());
|
||||
}
|
||||
|
||||
return args;
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<LcsIdxReply>) => ({
|
||||
matches: reply[1],
|
||||
len: reply[3]
|
||||
}),
|
||||
3: undefined as unknown as () => LcsIdxReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,42 +1,35 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './LCS_IDX_WITHMATCHLEN';
|
||||
import LCS_IDX_WITHMATCHLEN from './LCS_IDX_WITHMATCHLEN';
|
||||
|
||||
describe('LCS_IDX_WITHMATCHLEN', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
describe('LCS IDX WITHMATCHLEN', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('1', '2'),
|
||||
['LCS', '1', '2', 'IDX', 'WITHMATCHLEN']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
LCS_IDX_WITHMATCHLEN.transformArguments('1', '2'),
|
||||
['LCS', '1', '2', 'IDX', 'WITHMATCHLEN']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.lcsIdxWithMatchLen', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.mSet({
|
||||
'1': 'abc',
|
||||
'2': 'bc'
|
||||
}),
|
||||
client.lcsIdxWithMatchLen('1', '2')
|
||||
]);
|
||||
testUtils.testWithClient('client.lcsIdxWithMatchLen', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.mSet({
|
||||
'1': 'abc',
|
||||
'2': 'bc'
|
||||
}),
|
||||
client.lcsIdxWithMatchLen('1', '2')
|
||||
]);
|
||||
|
||||
assert.deepEqual(
|
||||
reply,
|
||||
{
|
||||
matches: [{
|
||||
key1: {
|
||||
start: 1,
|
||||
end: 2
|
||||
},
|
||||
key2: {
|
||||
start: 0,
|
||||
end: 1
|
||||
},
|
||||
length: 2
|
||||
}],
|
||||
length: 2
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
assert.deepEqual(
|
||||
reply,
|
||||
{
|
||||
matches: [
|
||||
[[[1, 2], [0, 1]]],
|
||||
2
|
||||
],
|
||||
len: 2
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,47 +1,36 @@
|
||||
// import { RedisArgument, TuplesToMapReply, BlobStringReply, ArrayReply, NumberReply, Resp2Reply, Command, TuplesReply } from '../RESP/types';
|
||||
// import LCS from './LCS';
|
||||
// import { LcsIdxRange } from './LCS_IDX';
|
||||
import { RedisArgument, TuplesToMapReply, BlobStringReply, ArrayReply, NumberReply, Resp2Reply, Command, TuplesReply } from '../RESP/types';
|
||||
import LCS_IDX, { LcsIdxOptions, LcsIdxRange } from './LCS_IDX';
|
||||
|
||||
// interface LcsIdxOptions {
|
||||
// MINMATCHLEN?: number;
|
||||
// }
|
||||
export type LcsIdxWithMatchLenMatches = ArrayReply<
|
||||
TuplesReply<[
|
||||
key1: LcsIdxRange,
|
||||
key2: LcsIdxRange,
|
||||
len: NumberReply
|
||||
]>
|
||||
>;
|
||||
|
||||
// export type LcsIdxWithMatchLenMatches = ArrayReply<
|
||||
// TuplesReply<[
|
||||
// key1: LcsIdxRange,
|
||||
// key2: LcsIdxRange,
|
||||
// len: NumberReply
|
||||
// ]>
|
||||
// >;
|
||||
export type LcsIdxWithMatchLenReply = TuplesToMapReply<[
|
||||
[BlobStringReply<'matches'>, LcsIdxWithMatchLenMatches],
|
||||
[BlobStringReply<'len'>, NumberReply]
|
||||
]>;
|
||||
|
||||
// export type LcsIdxReply = TuplesToMapReply<[
|
||||
// [BlobStringReply<'matches'>, LcsIdxWithMatchLenMatches],
|
||||
// [BlobStringReply<'len'>, NumberReply]
|
||||
// ]>;
|
||||
|
||||
// export default {
|
||||
// FIRST_KEY_INDEX: LCS.FIRST_KEY_INDEX,
|
||||
// IS_READ_ONLY: LCS.IS_READ_ONLY,
|
||||
// transformArguments(
|
||||
// key1: RedisArgument,
|
||||
// key2: RedisArgument,
|
||||
// options?: LcsIdxOptions
|
||||
// ) {
|
||||
// const args = LCS.transformArguments(key1, key2);
|
||||
|
||||
// if (options?.MINMATCHLEN) {
|
||||
// args.push('MINMATCHLEN', options.MINMATCHLEN.toString());
|
||||
// }
|
||||
|
||||
// args.push('WITHMATCHLEN');
|
||||
|
||||
// return args;
|
||||
// },
|
||||
// transformReply: {
|
||||
// 2: (reply: Resp2Reply<LcsIdxReply>) => ({
|
||||
// matches: reply[1],
|
||||
// len: reply[2]
|
||||
// }),
|
||||
// 3: undefined as unknown as () => LcsIdxReply
|
||||
// }
|
||||
// } as const satisfies Command;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: LCS_IDX.FIRST_KEY_INDEX,
|
||||
IS_READ_ONLY: LCS_IDX.IS_READ_ONLY,
|
||||
transformArguments(
|
||||
key1: RedisArgument,
|
||||
key2: RedisArgument,
|
||||
options?: LcsIdxOptions
|
||||
) {
|
||||
const args = LCS_IDX.transformArguments(key1, key2);
|
||||
args.push('WITHMATCHLEN');
|
||||
return args;
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<LcsIdxWithMatchLenReply>) => ({
|
||||
matches: reply[1],
|
||||
len: reply[3]
|
||||
}),
|
||||
3: undefined as unknown as () => LcsIdxWithMatchLenReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,35 +1,35 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './LOLWUT';
|
||||
import LOLWUT from './LOLWUT';
|
||||
|
||||
describe('LOLWUT', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['LOLWUT']
|
||||
);
|
||||
});
|
||||
|
||||
it('with version', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(5),
|
||||
['LOLWUT', 'VERSION', '5']
|
||||
);
|
||||
});
|
||||
|
||||
it('with version and optional arguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(5, 1, 2, 3),
|
||||
['LOLWUT', 'VERSION', '5', '1', '2', '3']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
LOLWUT.transformArguments(),
|
||||
['LOLWUT']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.LOLWUT', async client => {
|
||||
assert.equal(
|
||||
typeof (await client.LOLWUT()),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('with version', () => {
|
||||
assert.deepEqual(
|
||||
LOLWUT.transformArguments(5),
|
||||
['LOLWUT', 'VERSION', '5']
|
||||
);
|
||||
});
|
||||
|
||||
it('with version and optional arguments', () => {
|
||||
assert.deepEqual(
|
||||
LOLWUT.transformArguments(5, 1, 2, 3),
|
||||
['LOLWUT', 'VERSION', '5', '1', '2', '3']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.LOLWUT', async client => {
|
||||
assert.equal(
|
||||
typeof (await client.LOLWUT()),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './MEMORY_DOCTOR';
|
||||
import MEMORY_DOCTOR from './MEMORY_DOCTOR';
|
||||
|
||||
describe('MEMORY DOCTOR', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['MEMORY', 'DOCTOR']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
MEMORY_DOCTOR.transformArguments(),
|
||||
['MEMORY', 'DOCTOR']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.memoryDoctor', async client => {
|
||||
assert.equal(
|
||||
typeof (await client.memoryDoctor()),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.memoryDoctor', async client => {
|
||||
assert.equal(
|
||||
typeof (await client.memoryDoctor()),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,10 @@
|
||||
export function transformArguments(): Array<string> {
|
||||
return ['MEMORY', 'DOCTOR'];
|
||||
}
|
||||
import { BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export declare function transformReply(): string;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['MEMORY', 'DOCTOR'];
|
||||
},
|
||||
transformReply: undefined as unknown as () => BlobStringReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './MEMORY_MALLOC-STATS';
|
||||
import MEMORY_MALLOC_STATS from './MEMORY_MALLOC-STATS';
|
||||
|
||||
describe('MEMORY MALLOC-STATS', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['MEMORY', 'MALLOC-STATS']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
MEMORY_MALLOC_STATS.transformArguments(),
|
||||
['MEMORY', 'MALLOC-STATS']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.memoryMallocStats', async client => {
|
||||
assert.equal(
|
||||
typeof (await client.memoryDoctor()),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.memoryMallocStats', async client => {
|
||||
assert.equal(
|
||||
typeof (await client.memoryMallocStats()),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,11 @@
|
||||
export function transformArguments(): Array<string> {
|
||||
return ['MEMORY', 'MALLOC-STATS'];
|
||||
}
|
||||
import { BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['MEMORY', 'MALLOC-STATS'];
|
||||
},
|
||||
transformReply: undefined as unknown as () => BlobStringReply
|
||||
} as const satisfies Command;
|
||||
|
||||
export declare function transformReply(): string;
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './MEMORY_PURGE';
|
||||
import MEMORY_PURGE from './MEMORY_PURGE';
|
||||
|
||||
describe('MEMORY PURGE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['MEMORY', 'PURGE']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
MEMORY_PURGE.transformArguments(),
|
||||
['MEMORY', 'PURGE']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.memoryPurge', async client => {
|
||||
assert.equal(
|
||||
await client.memoryPurge(),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.memoryPurge', async client => {
|
||||
assert.equal(
|
||||
await client.memoryPurge(),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,11 @@
|
||||
export function transformArguments(): Array<string> {
|
||||
return ['MEMORY', 'PURGE'];
|
||||
}
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments() {
|
||||
return ['MEMORY', 'PURGE'];
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
||||
export declare function transformReply(): string;
|
||||
|
@@ -1,108 +1,43 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments, transformReply } from './MEMORY_STATS';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import MEMORY_STATS from './MEMORY_STATS';
|
||||
|
||||
describe('MEMORY STATS', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['MEMORY', 'STATS']
|
||||
);
|
||||
});
|
||||
// describe('MEMORY STATS', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// MEMORY_STATS.transformArguments(),
|
||||
// ['MEMORY', 'STATS']
|
||||
// );
|
||||
// });
|
||||
|
||||
it('transformReply', () => {
|
||||
assert.deepEqual(
|
||||
transformReply([
|
||||
'peak.allocated',
|
||||
952728,
|
||||
'total.allocated',
|
||||
892904,
|
||||
'startup.allocated',
|
||||
809952,
|
||||
'replication.backlog',
|
||||
0,
|
||||
'clients.slaves',
|
||||
0,
|
||||
'clients.normal',
|
||||
41000,
|
||||
'aof.buffer',
|
||||
0,
|
||||
'lua.caches',
|
||||
0,
|
||||
'db.0',
|
||||
[
|
||||
'overhead.hashtable.main',
|
||||
72,
|
||||
'overhead.hashtable.expires',
|
||||
0
|
||||
],
|
||||
'overhead.total',
|
||||
850952,
|
||||
'keys.count',
|
||||
0,
|
||||
'keys.bytes-per-key',
|
||||
0,
|
||||
'dataset.bytes',
|
||||
41952,
|
||||
'dataset.percentage',
|
||||
'50.573825836181641',
|
||||
'peak.percentage',
|
||||
'93.720771789550781',
|
||||
'allocator.allocated',
|
||||
937632,
|
||||
'allocator.active',
|
||||
1191936,
|
||||
'allocator.resident',
|
||||
4005888,
|
||||
'allocator-fragmentation.ratio',
|
||||
'1.2712193727493286',
|
||||
'allocator-fragmentation.bytes',
|
||||
254304,
|
||||
'allocator-rss.ratio',
|
||||
'3.3608248233795166',
|
||||
'allocator-rss.bytes',
|
||||
2813952,
|
||||
'rss-overhead.ratio',
|
||||
'2.4488751888275146',
|
||||
'rss-overhead.bytes',
|
||||
5804032,
|
||||
'fragmentation',
|
||||
'11.515504837036133',
|
||||
'fragmentation.bytes',
|
||||
8958032
|
||||
]),
|
||||
{
|
||||
peakAllocated: 952728,
|
||||
totalAllocated: 892904,
|
||||
startupAllocated: 809952,
|
||||
replicationBacklog: 0,
|
||||
clientsReplicas: 0,
|
||||
clientsNormal: 41000,
|
||||
aofBuffer: 0,
|
||||
luaCaches: 0,
|
||||
overheadTotal: 850952,
|
||||
keysCount: 0,
|
||||
keysBytesPerKey: 0,
|
||||
datasetBytes: 41952,
|
||||
datasetPercentage: 50.573825836181641,
|
||||
peakPercentage: 93.720771789550781,
|
||||
allocatorAllocated: 937632,
|
||||
allocatorActive: 1191936,
|
||||
allocatorResident: 4005888,
|
||||
allocatorFragmentationRatio: 1.2712193727493286,
|
||||
allocatorFragmentationBytes: 254304,
|
||||
allocatorRssRatio: 3.3608248233795166,
|
||||
allocatorRssBytes: 2813952,
|
||||
rssOverheadRatio: 2.4488751888275146,
|
||||
rssOverheadBytes: 5804032,
|
||||
fragmentation: 11.515504837036133,
|
||||
fragmentationBytes: 8958032,
|
||||
db: {
|
||||
0: {
|
||||
overheadHashtableMain: 72,
|
||||
overheadHashtableExpires: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
// testUtils.testWithClient('client.memoryStats', async client => {
|
||||
// const memoryStats = await client.memoryStats();
|
||||
// assert.equal(typeof memoryStats['peak.allocated'], 'number');
|
||||
// assert.equal(typeof memoryStats['total.allocated'], 'number');
|
||||
// assert.equal(typeof memoryStats['startup.allocated'], 'number');
|
||||
// assert.equal(typeof memoryStats['replication.backlog'], 'number');
|
||||
// assert.equal(typeof memoryStats['clients.slaves'], 'number');
|
||||
// assert.equal(typeof memoryStats['clients.normal'], 'number');
|
||||
// assert.equal(typeof memoryStats['cluster.links'], 'number');
|
||||
// assert.equal(typeof memoryStats['aof.buffer'], 'number');
|
||||
// assert.equal(typeof memoryStats['lua.caches'], 'number');
|
||||
// assert.equal(typeof memoryStats['functions.caches'], 'number');
|
||||
// assert.equal(typeof memoryStats['overhead.total'], 'number');
|
||||
// assert.equal(typeof memoryStats['keys.count'], 'number');
|
||||
// assert.equal(typeof memoryStats['keys.bytes-per-key'], 'number');
|
||||
// assert.equal(typeof memoryStats['dataset.bytes'], 'number');
|
||||
// assert.equal(typeof memoryStats['dataset.percentage'], 'string');
|
||||
// assert.equal(typeof memoryStats['peak.percentage'], 'string');
|
||||
// assert.equal(typeof memoryStats['allocator.allocated'], 'number');
|
||||
// assert.equal(typeof memoryStats['allocator.active'], 'number');
|
||||
// assert.equal(typeof memoryStats['allocator.resident'], 'number');
|
||||
// assert.equal(typeof memoryStats['allocator-fragmentation.ratio'], 'string');
|
||||
// assert.equal(typeof memoryStats['allocator-fragmentation.bytes'], 'number');
|
||||
// assert.equal(typeof memoryStats['allocator-rss.ratio'], 'string');
|
||||
// assert.equal(typeof memoryStats['allocator-rss.bytes'], 'number');
|
||||
// assert.equal(typeof memoryStats['rss-overhead.ratio'], 'string');
|
||||
// assert.equal(typeof memoryStats['rss-overhead.bytes'], 'number');
|
||||
// assert.equal(typeof memoryStats['fragmentation'], 'string');
|
||||
// assert.equal(typeof memoryStats['fragmentation.bytes'], 'number');
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
@@ -1,93 +1,53 @@
|
||||
export function transformArguments(): Array<string> {
|
||||
return ['MEMORY', 'STATS'];
|
||||
}
|
||||
// import { TuplesToMapReply, BlobStringReply, NumberReply, DoubleReply, Command, Resp2Reply } from '../RESP/types';
|
||||
|
||||
interface MemoryStatsReply {
|
||||
peakAllocated: number;
|
||||
totalAllocated: number;
|
||||
startupAllocated: number;
|
||||
replicationBacklog: number;
|
||||
clientsReplicas: number;
|
||||
clientsNormal: number;
|
||||
aofBuffer: number;
|
||||
luaCaches: number;
|
||||
overheadTotal: number;
|
||||
keysCount: number;
|
||||
keysBytesPerKey: number;
|
||||
datasetBytes: number;
|
||||
datasetPercentage: number;
|
||||
peakPercentage: number;
|
||||
allocatorAllocated?: number,
|
||||
allocatorActive?: number;
|
||||
allocatorResident?: number;
|
||||
allocatorFragmentationRatio?: number;
|
||||
allocatorFragmentationBytes?: number;
|
||||
allocatorRssRatio?: number;
|
||||
allocatorRssBytes?: number;
|
||||
rssOverheadRatio?: number;
|
||||
rssOverheadBytes?: number;
|
||||
fragmentation?: number;
|
||||
fragmentationBytes: number;
|
||||
db: {
|
||||
[key: number]: {
|
||||
overheadHashtableMain: number;
|
||||
overheadHashtableExpires: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
// export type MemoryStatsReply = TuplesToMapReply<[
|
||||
// [BlobStringReply<'peak.allocated'>, NumberReply],
|
||||
// [BlobStringReply<'total.allocated'>, NumberReply],
|
||||
// [BlobStringReply<'startup.allocated'>, NumberReply],
|
||||
// [BlobStringReply<'replication.backlog'>, NumberReply],
|
||||
// [BlobStringReply<'clients.slaves'>, NumberReply],
|
||||
// [BlobStringReply<'clients.normal'>, NumberReply],
|
||||
// [BlobStringReply<'cluster.links'>, NumberReply],
|
||||
// [BlobStringReply<'aof.buffer'>, NumberReply],
|
||||
// [BlobStringReply<'lua.caches'>, NumberReply],
|
||||
// [BlobStringReply<'functions.caches'>, NumberReply],
|
||||
// [BlobStringReply<'overhead.total'>, NumberReply],
|
||||
// [BlobStringReply<'keys.count'>, NumberReply],
|
||||
// [BlobStringReply<'keys.bytes-per-key'>, NumberReply],
|
||||
// [BlobStringReply<'dataset.bytes'>, NumberReply],
|
||||
// [BlobStringReply<'dataset.percentage'>, DoubleReply],
|
||||
// [BlobStringReply<'peak.percentage'>, DoubleReply],
|
||||
// [BlobStringReply<'allocator.allocated'>, NumberReply],
|
||||
// [BlobStringReply<'allocator.active'>, NumberReply],
|
||||
// [BlobStringReply<'allocator.resident'>, NumberReply],
|
||||
// [BlobStringReply<'allocator-fragmentation.ratio'>, DoubleReply],
|
||||
// [BlobStringReply<'allocator-fragmentation.bytes'>, NumberReply],
|
||||
// [BlobStringReply<'allocator-rss.ratio'>, DoubleReply],
|
||||
// [BlobStringReply<'allocator-rss.bytes'>, NumberReply],
|
||||
// [BlobStringReply<'rss-overhead.ratio'>, DoubleReply],
|
||||
// [BlobStringReply<'rss-overhead.bytes'>, NumberReply],
|
||||
// [BlobStringReply<'fragmentation'>, DoubleReply],
|
||||
// [BlobStringReply<'fragmentation.bytes'>, NumberReply]
|
||||
// ]>;
|
||||
|
||||
const FIELDS_MAPPING = {
|
||||
'peak.allocated': 'peakAllocated',
|
||||
'total.allocated': 'totalAllocated',
|
||||
'startup.allocated': 'startupAllocated',
|
||||
'replication.backlog': 'replicationBacklog',
|
||||
'clients.slaves': 'clientsReplicas',
|
||||
'clients.normal': 'clientsNormal',
|
||||
'aof.buffer': 'aofBuffer',
|
||||
'lua.caches': 'luaCaches',
|
||||
'overhead.total': 'overheadTotal',
|
||||
'keys.count': 'keysCount',
|
||||
'keys.bytes-per-key': 'keysBytesPerKey',
|
||||
'dataset.bytes': 'datasetBytes',
|
||||
'dataset.percentage': 'datasetPercentage',
|
||||
'peak.percentage': 'peakPercentage',
|
||||
'allocator.allocated': 'allocatorAllocated',
|
||||
'allocator.active': 'allocatorActive',
|
||||
'allocator.resident': 'allocatorResident',
|
||||
'allocator-fragmentation.ratio': 'allocatorFragmentationRatio',
|
||||
'allocator-fragmentation.bytes': 'allocatorFragmentationBytes',
|
||||
'allocator-rss.ratio': 'allocatorRssRatio',
|
||||
'allocator-rss.bytes': 'allocatorRssBytes',
|
||||
'rss-overhead.ratio': 'rssOverheadRatio',
|
||||
'rss-overhead.bytes': 'rssOverheadBytes',
|
||||
'fragmentation': 'fragmentation',
|
||||
'fragmentation.bytes': 'fragmentationBytes'
|
||||
},
|
||||
DB_FIELDS_MAPPING = {
|
||||
'overhead.hashtable.main': 'overheadHashtableMain',
|
||||
'overhead.hashtable.expires': 'overheadHashtableExpires'
|
||||
};
|
||||
// export default {
|
||||
// FIRST_KEY_INDEX: undefined,
|
||||
// IS_READ_ONLY: true,
|
||||
// transformArguments() {
|
||||
// return ['MEMORY', 'STATS'];
|
||||
// },
|
||||
// transformReply: {
|
||||
// 2: (rawReply: Array<BlobStringReply | NumberReply>) => {
|
||||
// const reply: Partial<Resp2Reply<MemoryStatsReply['DEFAULT']>> = {};
|
||||
|
||||
export function transformReply(rawReply: Array<string | number | Array<string | number>>): MemoryStatsReply {
|
||||
const reply: any = {
|
||||
db: {}
|
||||
};
|
||||
// let i = 0;
|
||||
// while (i < rawReply.length) {
|
||||
// const key = rawReply[i++] as keyof MemoryStatsReply['DEFAULT'];
|
||||
// reply[key] = rawReply[i++] as any;
|
||||
// }
|
||||
|
||||
for (let i = 0; i < rawReply.length; i += 2) {
|
||||
const key = rawReply[i] as string;
|
||||
if (key.startsWith('db.')) {
|
||||
const dbTuples = rawReply[i + 1] as Array<string | number>,
|
||||
db: any = {};
|
||||
for (let j = 0; j < dbTuples.length; j += 2) {
|
||||
db[DB_FIELDS_MAPPING[dbTuples[j] as keyof typeof DB_FIELDS_MAPPING]] = dbTuples[j + 1];
|
||||
}
|
||||
|
||||
reply.db[key.substring(3)] = db;
|
||||
continue;
|
||||
}
|
||||
|
||||
reply[FIELDS_MAPPING[key as keyof typeof FIELDS_MAPPING]] = Number(rawReply[i + 1]);
|
||||
}
|
||||
|
||||
return reply as MemoryStatsReply;
|
||||
}
|
||||
// return reply as MemoryStatsReply['DEFAULT'];
|
||||
// },
|
||||
// 3: undefined as unknown as () => MemoryStatsReply
|
||||
// }
|
||||
// } as const satisfies Command;
|
||||
|
@@ -1,30 +1,30 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './MEMORY_USAGE';
|
||||
import MEMORY_USAGE from './MEMORY_USAGE';
|
||||
|
||||
describe('MEMORY USAGE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key'),
|
||||
['MEMORY', 'USAGE', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
it('with SAMPLES', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', {
|
||||
SAMPLES: 1
|
||||
}),
|
||||
['MEMORY', 'USAGE', 'key', 'SAMPLES', '1']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
MEMORY_USAGE.transformArguments('key'),
|
||||
['MEMORY', 'USAGE', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.memoryUsage', async client => {
|
||||
assert.equal(
|
||||
await client.memoryUsage('key'),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('with SAMPLES', () => {
|
||||
assert.deepEqual(
|
||||
MEMORY_USAGE.transformArguments('key', {
|
||||
SAMPLES: 1
|
||||
}),
|
||||
['MEMORY', 'USAGE', 'key', 'SAMPLES', '1']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.memoryUsage', async client => {
|
||||
assert.equal(
|
||||
await client.memoryUsage('key'),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,19 +1,20 @@
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
import { NumberReply, NullReply, Command, RedisArgument } from '../RESP/types';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
interface MemoryUsageOptions {
|
||||
SAMPLES?: number;
|
||||
export interface MemoryUsageOptions {
|
||||
SAMPLES?: number;
|
||||
}
|
||||
|
||||
export function transformArguments(key: string, options?: MemoryUsageOptions): Array<string> {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument, options?: MemoryUsageOptions) {
|
||||
const args = ['MEMORY', 'USAGE', key];
|
||||
|
||||
if (options?.SAMPLES) {
|
||||
args.push('SAMPLES', options.SAMPLES.toString());
|
||||
args.push('SAMPLES', options.SAMPLES.toString());
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): number | null;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply | NullReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './MODULE_LIST';
|
||||
import MODULE_LIST from './MODULE_LIST';
|
||||
|
||||
describe('MODULE LIST', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['MODULE', 'LIST']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
MODULE_LIST.transformArguments(),
|
||||
['MODULE', 'LIST']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -2,7 +2,7 @@ import { ArrayReply, BlobStringReply, NumberReply, Command, Resp2Reply, TuplesTo
|
||||
|
||||
export type ModuleListReply = ArrayReply<TuplesToMapReply<[
|
||||
[BlobStringReply<'name'>, BlobStringReply],
|
||||
[BlobStringReply<'version'>, NumberReply],
|
||||
[BlobStringReply<'ver'>, NumberReply],
|
||||
]>>;
|
||||
|
||||
export default {
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
2: (reply: Resp2Reply<ModuleListReply>) => {
|
||||
return reply.map(module => ({
|
||||
name: module[1],
|
||||
version: module[3]
|
||||
ver: module[3]
|
||||
}));
|
||||
},
|
||||
3: undefined as unknown as () => ModuleListReply
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './MODULE_LOAD';
|
||||
import MODULE_LOAD from './MODULE_LOAD';
|
||||
|
||||
describe('MODULE LOAD', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('path'),
|
||||
['MODULE', 'LOAD', 'path']
|
||||
);
|
||||
});
|
||||
|
||||
it('with module args', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('path', ['1', '2']),
|
||||
['MODULE', 'LOAD', 'path', '1', '2']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
MODULE_LOAD.transformArguments('path'),
|
||||
['MODULE', 'LOAD', 'path']
|
||||
);
|
||||
});
|
||||
|
||||
it('with module args', () => {
|
||||
assert.deepEqual(
|
||||
MODULE_LOAD.transformArguments('path', ['1', '2']),
|
||||
['MODULE', 'LOAD', 'path', '1', '2']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -13,5 +13,5 @@ export default {
|
||||
|
||||
return args;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './MODULE_UNLOAD';
|
||||
import MODULE_UNLOAD from './MODULE_UNLOAD';
|
||||
|
||||
describe('MODULE UNLOAD', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('name'),
|
||||
['MODULE', 'UNLOAD', 'name']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
MODULE_UNLOAD.transformArguments('name'),
|
||||
['MODULE', 'UNLOAD', 'name']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -6,5 +6,5 @@ export default {
|
||||
transformArguments(name: RedisArgument) {
|
||||
return ['MODULE', 'UNLOAD', name];
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,28 +1,28 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './PUBSUB_CHANNELS';
|
||||
import PUBSUB_CHANNELS from './PUBSUB_CHANNELS';
|
||||
|
||||
describe('PUBSUB CHANNELS', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['PUBSUB', 'CHANNELS']
|
||||
);
|
||||
});
|
||||
|
||||
it('with pattern', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('patter*'),
|
||||
['PUBSUB', 'CHANNELS', 'patter*']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_CHANNELS.transformArguments(),
|
||||
['PUBSUB', 'CHANNELS']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubChannels', async client => {
|
||||
assert.deepEqual(
|
||||
await client.pubSubChannels(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('with pattern', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_CHANNELS.transformArguments('patter*'),
|
||||
['PUBSUB', 'CHANNELS', 'patter*']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubChannels', async client => {
|
||||
assert.deepEqual(
|
||||
await client.pubSubChannels(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './PUBSUB_NUMPAT';
|
||||
import PUBSUB_NUMPAT from './PUBSUB_NUMPAT';
|
||||
|
||||
describe('PUBSUB NUMPAT', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['PUBSUB', 'NUMPAT']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_NUMPAT.transformArguments(),
|
||||
['PUBSUB', 'NUMPAT']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubNumPat', async client => {
|
||||
assert.equal(
|
||||
await client.pubSubNumPat(),
|
||||
0
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.pubSubNumPat', async client => {
|
||||
assert.equal(
|
||||
await client.pubSubNumPat(),
|
||||
0
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,35 +1,35 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './PUBSUB_NUMSUB';
|
||||
import PUBSUB_NUMSUB from './PUBSUB_NUMSUB';
|
||||
|
||||
describe('PUBSUB NUMSUB', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['PUBSUB', 'NUMSUB']
|
||||
);
|
||||
});
|
||||
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('channel'),
|
||||
['PUBSUB', 'NUMSUB', 'channel']
|
||||
);
|
||||
});
|
||||
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(['1', '2']),
|
||||
['PUBSUB', 'NUMSUB', '1', '2']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_NUMSUB.transformArguments(),
|
||||
['PUBSUB', 'NUMSUB']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubNumSub', async client => {
|
||||
assert.deepEqual(
|
||||
await client.pubSubNumSub(),
|
||||
Object.create(null)
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_NUMSUB.transformArguments('channel'),
|
||||
['PUBSUB', 'NUMSUB', 'channel']
|
||||
);
|
||||
});
|
||||
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_NUMSUB.transformArguments(['1', '2']),
|
||||
['PUBSUB', 'NUMSUB', '1', '2']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubNumSub', async client => {
|
||||
assert.deepEqual(
|
||||
await client.pubSubNumSub(),
|
||||
Object.create(null)
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,30 +1,30 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './PUBSUB_SHARDCHANNELS';
|
||||
import PUBSUB_SHARDCHANNELS from './PUBSUB_SHARDCHANNELS';
|
||||
|
||||
describe('PUBSUB SHARDCHANNELS', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('without pattern', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['PUBSUB', 'SHARDCHANNELS']
|
||||
);
|
||||
});
|
||||
|
||||
it('with pattern', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('patter*'),
|
||||
['PUBSUB', 'SHARDCHANNELS', 'patter*']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('without pattern', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_SHARDCHANNELS.transformArguments(),
|
||||
['PUBSUB', 'SHARDCHANNELS']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubShardChannels', async client => {
|
||||
assert.deepEqual(
|
||||
await client.pubSubShardChannels(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('with pattern', () => {
|
||||
assert.deepEqual(
|
||||
PUBSUB_SHARDCHANNELS.transformArguments('patter*'),
|
||||
['PUBSUB', 'SHARDCHANNELS', 'patter*']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.pubSubShardChannels', async client => {
|
||||
assert.deepEqual(
|
||||
await client.pubSubShardChannels(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -4,7 +4,7 @@ export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(pattern?: RedisArgument) {
|
||||
const args: Array<RedisArgument> = ['PUBSUB', 'bb'];
|
||||
const args: Array<RedisArgument> = ['PUBSUB', 'SHARDCHANNELS'];
|
||||
|
||||
if (pattern) {
|
||||
args.push(pattern);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './READONLY';
|
||||
import READONLY from './READONLY';
|
||||
|
||||
describe('READONLY', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
READONLY.transformArguments(),
|
||||
['READONLY']
|
||||
);
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './READWRITE';
|
||||
import READWRITE from './READWRITE';
|
||||
|
||||
describe('READWRITE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['READWRITE']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
READWRITE.transformArguments(),
|
||||
['READWRITE']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './REPLICAOF';
|
||||
import REPLICAOF from './REPLICAOF';
|
||||
|
||||
describe('REPLICAOF', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('host', 1),
|
||||
['REPLICAOF', 'host', '1']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
REPLICAOF.transformArguments('host', 1),
|
||||
['REPLICAOF', 'host', '1']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './RESTORE-ASKING';
|
||||
import RESTORE_ASKING from './RESTORE-ASKING';
|
||||
|
||||
describe('RESTORE-ASKING', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['RESTORE-ASKING']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
RESTORE_ASKING.transformArguments(),
|
||||
['RESTORE-ASKING']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './SAVE';
|
||||
import SAVE from './SAVE';
|
||||
|
||||
describe('SAVE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['SAVE']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
SAVE.transformArguments(),
|
||||
['SAVE']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -103,8 +103,8 @@ import INCRBYFLOAT from './INCRBYFLOAT';
|
||||
import INFO from './INFO';
|
||||
import KEYS from './KEYS';
|
||||
import LASTSAVE from './LASTSAVE';
|
||||
// import LCS_IDX_WITHMATCHLEN from './LCS_IDX_WITHMATCHLEN';
|
||||
// import LCS_IDX from './LCS_IDX';
|
||||
import LCS_IDX_WITHMATCHLEN from './LCS_IDX_WITHMATCHLEN';
|
||||
import LCS_IDX from './LCS_IDX';
|
||||
import LCS_LEN from './LCS_LEN';
|
||||
import LCS from './LCS';
|
||||
import LINDEX from './LINDEX';
|
||||
@@ -112,6 +112,7 @@ import LINSERT from './LINSERT';
|
||||
import LLEN from './LLEN';
|
||||
import LMOVE from './LMOVE';
|
||||
import LMPOP from './LMPOP';
|
||||
import LOLWUT from './LOLWUT';
|
||||
import LPOP_COUNT from './LPOP_COUNT';
|
||||
import LPOP from './LPOP';
|
||||
import LPOS_COUNT from './LPOS_COUNT';
|
||||
@@ -122,7 +123,15 @@ import LRANGE from './LRANGE';
|
||||
import LREM from './LREM';
|
||||
import LSET from './LSET';
|
||||
import LTRIM from './LTRIM';
|
||||
import MEMORY_DOCTOR from './MEMORY_DOCTOR';
|
||||
import MEMORY_MALLOC_STATS from './MEMORY_MALLOC-STATS';
|
||||
import MEMORY_PURGE from './MEMORY_PURGE';
|
||||
// import MEMORY_STATS from './MEMORY_STATS';
|
||||
import MEMORY_USAGE from './MEMORY_USAGE';
|
||||
import MGET from './MGET';
|
||||
import MODULE_LIST from './MODULE_LIST';
|
||||
import MODULE_LOAD from './MODULE_LOAD';
|
||||
import MODULE_UNLOAD from './MODULE_UNLOAD';
|
||||
import MOVE from './MOVE';
|
||||
import MSET from './MSET';
|
||||
import MSETNX from './MSETNX';
|
||||
@@ -140,6 +149,11 @@ import PFMERGE from './PFMERGE';
|
||||
import PING from './PING';
|
||||
import PSETEX from './PSETEX';
|
||||
import PTTL from './PTTL';
|
||||
import PUBLISH from './PUBLISH';
|
||||
import PUBSUB_CHANNELS from './PUBSUB_CHANNELS';
|
||||
import PUBSUB_NUMPAT from './PUBSUB_NUMPAT';
|
||||
import PUBSUB_NUMSUB from './PUBSUB_NUMSUB';
|
||||
import PUBSUB_SHARDCHANNELS from './PUBSUB_SHARDCHANNELS';
|
||||
import RANDOMKEY from './RANDOMKEY';
|
||||
import READONLY from './READONLY';
|
||||
import RENAME from './RENAME';
|
||||
@@ -443,8 +457,10 @@ export default {
|
||||
keys: KEYS,
|
||||
LASTSAVE,
|
||||
lastSave: LASTSAVE,
|
||||
// LCS_IDX_WITHMATCHLEN,
|
||||
// LCS_IDX,
|
||||
LCS_IDX_WITHMATCHLEN,
|
||||
lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN,
|
||||
LCS_IDX,
|
||||
lcsIdx: LCS_IDX,
|
||||
LCS_LEN,
|
||||
lcsLen: LCS_LEN,
|
||||
LCS,
|
||||
@@ -459,6 +475,7 @@ export default {
|
||||
lMove: LMOVE,
|
||||
LMPOP,
|
||||
lmPop: LMPOP,
|
||||
LOLWUT,
|
||||
LPOP_COUNT,
|
||||
lPopCount: LPOP_COUNT,
|
||||
LPOP,
|
||||
@@ -479,8 +496,24 @@ export default {
|
||||
lSet: LSET,
|
||||
LTRIM,
|
||||
lTrim: LTRIM,
|
||||
MEMORY_DOCTOR,
|
||||
memoryDoctor: MEMORY_DOCTOR,
|
||||
'MEMORY_MALLOC-STATS': MEMORY_MALLOC_STATS,
|
||||
memoryMallocStats: MEMORY_MALLOC_STATS,
|
||||
MEMORY_PURGE,
|
||||
memoryPurge: MEMORY_PURGE,
|
||||
// MEMORY_STATS,
|
||||
// memoryStats: MEMORY_STATS,
|
||||
MEMORY_USAGE,
|
||||
memoryUsage: MEMORY_USAGE,
|
||||
MGET,
|
||||
mGet: MGET,
|
||||
MODULE_LIST,
|
||||
moduleList: MODULE_LIST,
|
||||
MODULE_LOAD,
|
||||
moduleLoad: MODULE_LOAD,
|
||||
MODULE_UNLOAD,
|
||||
moduleUnload: MODULE_UNLOAD,
|
||||
MOVE,
|
||||
move: MOVE,
|
||||
MSET,
|
||||
@@ -518,6 +551,16 @@ export default {
|
||||
pSetEx: PSETEX,
|
||||
PTTL,
|
||||
pTTL: PTTL,
|
||||
PUBLISH,
|
||||
publish: PUBLISH,
|
||||
PUBSUB_CHANNELS,
|
||||
pubSubChannels: PUBSUB_CHANNELS,
|
||||
PUBSUB_NUMPAT,
|
||||
pubSubNumPat: PUBSUB_NUMPAT,
|
||||
PUBSUB_NUMSUB,
|
||||
pubSubNumSub: PUBSUB_NUMSUB,
|
||||
PUBSUB_SHARDCHANNELS,
|
||||
pubSubShardChannels: PUBSUB_SHARDCHANNELS,
|
||||
RANDOMKEY,
|
||||
randomKey: RANDOMKEY,
|
||||
READONLY,
|
||||
|
Reference in New Issue
Block a user