You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
wip
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
// import { strict as assert } from 'node:assert';
|
||||
// import testUtils, { GLOBAL } from '../../test-utils';
|
||||
// import { transformArguments } from './INFO';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../../test-utils';
|
||||
import INFO from './INFO';
|
||||
|
||||
// describe('BF INFO', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('bloom'),
|
||||
// ['BF.INFO', 'bloom']
|
||||
// );
|
||||
// });
|
||||
describe('BF.INFO', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
INFO.transformArguments('bloom'),
|
||||
['BF.INFO', 'bloom']
|
||||
);
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.bf.info', async client => {
|
||||
// await client.bf.reserve('key', 0.01, 100);
|
||||
testUtils.testWithClient('client.bf.info', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.bf.reserve('key', 0.01, 100),
|
||||
client.bf.info('key')
|
||||
]);
|
||||
|
||||
// const info = await client.bf.info('key');
|
||||
// assert.equal(typeof info, 'object');
|
||||
// assert.equal(info.capacity, 100);
|
||||
// assert.equal(typeof info.size, 'number');
|
||||
// assert.equal(typeof info.numberOfFilters, 'number');
|
||||
// assert.equal(typeof info.numberOfInsertedItems, 'number');
|
||||
// assert.equal(typeof info.expansionRate, 'number');
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
assert.equal(typeof reply, 'object');
|
||||
assert.equal(reply.capacity, 100);
|
||||
assert.equal(typeof reply.size, 'number');
|
||||
assert.equal(typeof reply.numberOfFilters, 'number');
|
||||
assert.equal(typeof reply.numberOfInsertedItems, 'number');
|
||||
assert.equal(typeof reply.expansionRate, 'number');
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,57 +1,11 @@
|
||||
// // export type InfoRawReply = [
|
||||
// // _: string,
|
||||
// // capacity: number,
|
||||
// // _: string,
|
||||
// // size: number,
|
||||
// // _: string,
|
||||
// // numberOfFilters: number,
|
||||
// // _: string,
|
||||
// // numberOfInsertedItems: number,
|
||||
// // _: string,
|
||||
// // expansionRate: number,
|
||||
// // ];
|
||||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
// // export interface InfoReply {
|
||||
// // capacity: number;
|
||||
// // size: number;
|
||||
// // numberOfFilters: number;
|
||||
// // numberOfInsertedItems: number;
|
||||
// // expansionRate: number;
|
||||
// // }
|
||||
|
||||
// // export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
// // return {
|
||||
// // capacity: reply[1],
|
||||
// // size: reply[3],
|
||||
// // numberOfFilters: reply[5],
|
||||
// // numberOfInsertedItems: reply[7],
|
||||
// // expansionRate: reply[9]
|
||||
// // };
|
||||
// // }
|
||||
|
||||
// import { RedisArgument, Command, TuplesToMapReply, BlobStringReply, NumberReply } from '@redis/client/dist/lib/RESP/types';
|
||||
// import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/generic-transformers';
|
||||
|
||||
// export type BfInfoReply = TuplesToMapReply<[
|
||||
// [BlobStringReply<'Capacity'>, NumberReply],
|
||||
// [BlobStringReply<'Size'>, NumberReply],
|
||||
// [BlobStringReply<'Number of filters'>, NumberReply],
|
||||
|
||||
|
||||
// ]>;
|
||||
|
||||
// export default {
|
||||
// FIRST_KEY_INDEX: 1,
|
||||
// IS_READ_ONLY: true,
|
||||
// transformArguments(key: RedisArgument) {
|
||||
// return ['BF.INFO', key];
|
||||
// },
|
||||
// transformReply: {
|
||||
// 2: () => {
|
||||
|
||||
// },
|
||||
// 3: () => {
|
||||
|
||||
// }
|
||||
// }
|
||||
// } as const satisfies Command;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument) {
|
||||
return ['BF.INFO', key];
|
||||
},
|
||||
// TODO
|
||||
transformReply: undefined as unknown as () => any
|
||||
} as const satisfies Command;
|
||||
|
@@ -2,7 +2,7 @@ import type { RedisCommands } from '@redis/client/dist/lib/RESP/types';
|
||||
import ADD from './ADD';
|
||||
import CARD from './CARD';
|
||||
import EXISTS from './EXISTS';
|
||||
// import INFO from './INFO';
|
||||
import INFO from './INFO';
|
||||
import INSERT from './INSERT';
|
||||
import LOADCHUNK from './LOADCHUNK';
|
||||
import MADD from './MADD';
|
||||
@@ -17,8 +17,8 @@ export default {
|
||||
card: CARD,
|
||||
EXISTS,
|
||||
exists: EXISTS,
|
||||
// INFO,
|
||||
// info: INFO,
|
||||
INFO,
|
||||
info: INFO,
|
||||
INSERT,
|
||||
insert: INSERT,
|
||||
LOADCHUNK,
|
||||
|
@@ -1,27 +1,29 @@
|
||||
// import { strict as assert } from 'node:assert';
|
||||
// import testUtils, { GLOBAL } from '../../test-utils';
|
||||
// import { transformArguments } from './INFO';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../../test-utils';
|
||||
import INFO from './INFO';
|
||||
|
||||
// describe('CF INFO', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('cuckoo'),
|
||||
// ['CF.INFO', 'cuckoo']
|
||||
// );
|
||||
// });
|
||||
describe('CF.INFO', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
INFO.transformArguments('cuckoo'),
|
||||
['CF.INFO', 'cuckoo']
|
||||
);
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.cf.info', async client => {
|
||||
// await client.cf.reserve('key', 4);
|
||||
testUtils.testWithClient('client.cf.info', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.cf.reserve('key', 4),
|
||||
client.cf.info('key')
|
||||
]);
|
||||
|
||||
// const info = await client.cf.info('key');
|
||||
// assert.equal(typeof info, 'object');
|
||||
// assert.equal(typeof info.size, 'number');
|
||||
// assert.equal(typeof info.numberOfBuckets, 'number');
|
||||
// assert.equal(typeof info.numberOfFilters, 'number');
|
||||
// assert.equal(typeof info.numberOfInsertedItems, 'number');
|
||||
// assert.equal(typeof info.numberOfDeletedItems, 'number');
|
||||
// assert.equal(typeof info.bucketSize, 'number');
|
||||
// assert.equal(typeof info.expansionRate, 'number');
|
||||
// assert.equal(typeof info.maxIteration, 'number');
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
assert.equal(typeof reply, 'object');
|
||||
assert.equal(typeof reply.size, 'number');
|
||||
assert.equal(typeof reply.numberOfBuckets, 'number');
|
||||
assert.equal(typeof reply.numberOfFilters, 'number');
|
||||
assert.equal(typeof reply.numberOfInsertedItems, 'number');
|
||||
assert.equal(typeof reply.numberOfDeletedItems, 'number');
|
||||
assert.equal(typeof reply.bucketSize, 'number');
|
||||
assert.equal(typeof reply.expansionRate, 'number');
|
||||
assert.equal(typeof reply.maxIteration, 'number');
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,50 +1,53 @@
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
// export const IS_READ_ONLY = true;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument) {
|
||||
return ['CF.INFO', key];
|
||||
},
|
||||
// TODO
|
||||
// export type InfoRawReply = [
|
||||
// _: string,
|
||||
// size: number,
|
||||
// _: string,
|
||||
// numberOfBuckets: number,
|
||||
// _: string,
|
||||
// numberOfFilters: number,
|
||||
// _: string,
|
||||
// numberOfInsertedItems: number,
|
||||
// _: string,
|
||||
// numberOfDeletedItems: number,
|
||||
// _: string,
|
||||
// bucketSize: number,
|
||||
// _: string,
|
||||
// expansionRate: number,
|
||||
// _: string,
|
||||
// maxIteration: number
|
||||
// ];
|
||||
|
||||
// export function transformArguments(key: string): Array<string> {
|
||||
// return ['CF.INFO', key];
|
||||
// }
|
||||
// export interface InfoReply {
|
||||
// size: number;
|
||||
// numberOfBuckets: number;
|
||||
// numberOfFilters: number;
|
||||
// numberOfInsertedItems: number;
|
||||
// numberOfDeletedItems: number;
|
||||
// bucketSize: number;
|
||||
// expansionRate: number;
|
||||
// maxIteration: number;
|
||||
// }
|
||||
|
||||
// export type InfoRawReply = [
|
||||
// _: string,
|
||||
// size: number,
|
||||
// _: string,
|
||||
// numberOfBuckets: number,
|
||||
// _: string,
|
||||
// numberOfFilters: number,
|
||||
// _: string,
|
||||
// numberOfInsertedItems: number,
|
||||
// _: string,
|
||||
// numberOfDeletedItems: number,
|
||||
// _: string,
|
||||
// bucketSize: number,
|
||||
// _: string,
|
||||
// expansionRate: number,
|
||||
// _: string,
|
||||
// maxIteration: number
|
||||
// ];
|
||||
|
||||
// export interface InfoReply {
|
||||
// size: number;
|
||||
// numberOfBuckets: number;
|
||||
// numberOfFilters: number;
|
||||
// numberOfInsertedItems: number;
|
||||
// numberOfDeletedItems: number;
|
||||
// bucketSize: number;
|
||||
// expansionRate: number;
|
||||
// maxIteration: number;
|
||||
// }
|
||||
|
||||
// export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
// return {
|
||||
// size: reply[1],
|
||||
// numberOfBuckets: reply[3],
|
||||
// numberOfFilters: reply[5],
|
||||
// numberOfInsertedItems: reply[7],
|
||||
// numberOfDeletedItems: reply[9],
|
||||
// bucketSize: reply[11],
|
||||
// expansionRate: reply[13],
|
||||
// maxIteration: reply[15]
|
||||
// };
|
||||
// }
|
||||
// export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
// return {
|
||||
// size: reply[1],
|
||||
// numberOfBuckets: reply[3],
|
||||
// numberOfFilters: reply[5],
|
||||
// numberOfInsertedItems: reply[7],
|
||||
// numberOfDeletedItems: reply[9],
|
||||
// bucketSize: reply[11],
|
||||
// expansionRate: reply[13],
|
||||
// maxIteration: reply[15]
|
||||
// };
|
||||
// }
|
||||
transformReply: undefined as unknown as () => any
|
||||
} as const satisfies Command;
|
||||
|
@@ -4,7 +4,7 @@ import ADDNX from './ADDNX';
|
||||
import COUNT from './COUNT';
|
||||
import DEL from './DEL';
|
||||
import EXISTS from './EXISTS';
|
||||
// import INFO from './INFO';
|
||||
import INFO from './INFO';
|
||||
import INSERT from './INSERT';
|
||||
import INSERTNX from './INSERTNX';
|
||||
import LOADCHUNK from './LOADCHUNK';
|
||||
@@ -22,8 +22,8 @@ export default {
|
||||
del: DEL,
|
||||
EXISTS,
|
||||
exists: EXISTS,
|
||||
// INFO,
|
||||
// info: INFO,
|
||||
INFO,
|
||||
info: INFO,
|
||||
INSERT,
|
||||
insert: INSERT,
|
||||
INSERTNX,
|
||||
|
@@ -1,25 +1,27 @@
|
||||
// import { strict as assert } from 'node:assert';
|
||||
// import testUtils, { GLOBAL } from '../../test-utils';
|
||||
// import { transformArguments } from './INFO';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../../test-utils';
|
||||
import INFO from './INFO';
|
||||
|
||||
// describe('TDIGEST.INFO', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments('key'),
|
||||
// ['TDIGEST.INFO', 'key']
|
||||
// );
|
||||
// });
|
||||
describe('TDIGEST.INFO', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
INFO.transformArguments('key'),
|
||||
['TDIGEST.INFO', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.tDigest.info', async client => {
|
||||
// await client.tDigest.create('key');
|
||||
testUtils.testWithClient('client.tDigest.info', async client => {
|
||||
const [, reply] = await Promise.all([
|
||||
client.tDigest.create('key'),
|
||||
client.tDigest.info('key')
|
||||
]);
|
||||
|
||||
// const info = await client.tDigest.info('key');
|
||||
// assert(typeof info.capacity, 'number');
|
||||
// assert(typeof info.mergedNodes, 'number');
|
||||
// assert(typeof info.unmergedNodes, 'number');
|
||||
// assert(typeof info.mergedWeight, 'number');
|
||||
// assert(typeof info.unmergedWeight, 'number');
|
||||
// assert(typeof info.totalCompression, 'number');
|
||||
// assert(typeof info.totalCompression, 'number');
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
assert(typeof reply.capacity, 'number');
|
||||
assert(typeof reply.mergedNodes, 'number');
|
||||
assert(typeof reply.unmergedNodes, 'number');
|
||||
assert(typeof reply.mergedWeight, 'number');
|
||||
assert(typeof reply.unmergedWeight, 'number');
|
||||
assert(typeof reply.totalCompression, 'number');
|
||||
assert(typeof reply.totalCompression, 'number');
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,51 +1,49 @@
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
||||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument) {
|
||||
return ['TDIGEST.INFO', key];
|
||||
},
|
||||
// TODO
|
||||
// type InfoRawReply = [
|
||||
// 'Compression',
|
||||
// number,
|
||||
// 'Capacity',
|
||||
// number,
|
||||
// 'Merged nodes',
|
||||
// number,
|
||||
// 'Unmerged nodes',
|
||||
// number,
|
||||
// 'Merged weight',
|
||||
// string,
|
||||
// 'Unmerged weight',
|
||||
// string,
|
||||
// 'Total compressions',
|
||||
// number
|
||||
// ];
|
||||
|
||||
// export const IS_READ_ONLY = true;
|
||||
// interface InfoReply {
|
||||
// comperssion: number;
|
||||
// capacity: number;
|
||||
// mergedNodes: number;
|
||||
// unmergedNodes: number;
|
||||
// mergedWeight: number;
|
||||
// unmergedWeight: number;
|
||||
// totalCompression: number;
|
||||
// }
|
||||
|
||||
// export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||
// return [
|
||||
// 'TDIGEST.INFO',
|
||||
// key
|
||||
// ];
|
||||
// }
|
||||
|
||||
// type InfoRawReply = [
|
||||
// 'Compression',
|
||||
// number,
|
||||
// 'Capacity',
|
||||
// number,
|
||||
// 'Merged nodes',
|
||||
// number,
|
||||
// 'Unmerged nodes',
|
||||
// number,
|
||||
// 'Merged weight',
|
||||
// string,
|
||||
// 'Unmerged weight',
|
||||
// string,
|
||||
// 'Total compressions',
|
||||
// number
|
||||
// ];
|
||||
|
||||
// interface InfoReply {
|
||||
// comperssion: number;
|
||||
// capacity: number;
|
||||
// mergedNodes: number;
|
||||
// unmergedNodes: number;
|
||||
// mergedWeight: number;
|
||||
// unmergedWeight: number;
|
||||
// totalCompression: number;
|
||||
// }
|
||||
|
||||
// export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
// return {
|
||||
// comperssion: reply[1],
|
||||
// capacity: reply[3],
|
||||
// mergedNodes: reply[5],
|
||||
// unmergedNodes: reply[7],
|
||||
// mergedWeight: Number(reply[9]),
|
||||
// unmergedWeight: Number(reply[11]),
|
||||
// totalCompression: reply[13]
|
||||
// };
|
||||
// }
|
||||
// export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
// return {
|
||||
// comperssion: reply[1],
|
||||
// capacity: reply[3],
|
||||
// mergedNodes: reply[5],
|
||||
// unmergedNodes: reply[7],
|
||||
// mergedWeight: Number(reply[9]),
|
||||
// unmergedWeight: Number(reply[11]),
|
||||
// totalCompression: reply[13]
|
||||
// };
|
||||
// }
|
||||
transformReply: undefined as unknown as () => any
|
||||
} as const satisfies Command;
|
||||
|
@@ -4,7 +4,7 @@ import BYRANK from './BYRANK';
|
||||
import BYREVRANK from './BYREVRANK';
|
||||
import CDF from './CDF';
|
||||
import CREATE from './CREATE';
|
||||
// import INFO from './INFO';
|
||||
import INFO from './INFO';
|
||||
import MAX from './MAX';
|
||||
import MERGE from './MERGE';
|
||||
import MIN from './MIN';
|
||||
@@ -25,8 +25,8 @@ export default {
|
||||
cdf: CDF,
|
||||
CREATE,
|
||||
create: CREATE,
|
||||
// INFO,
|
||||
// info: INFO,
|
||||
INFO,
|
||||
info: INFO,
|
||||
MAX,
|
||||
max: MAX,
|
||||
MERGE,
|
||||
|
Reference in New Issue
Block a user