You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
get ready for beta release
This commit is contained in:
@@ -1,82 +1,82 @@
|
||||
import { TimeSeriesAggregationType, TimeSeriesDuplicatePolicies } from '.';
|
||||
// import { TimeSeriesAggregationType, TimeSeriesDuplicatePolicies } from '.';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(key: string): Array<string> {
|
||||
return ['TS.INFO', key];
|
||||
}
|
||||
// export function transformArguments(key: string): Array<string> {
|
||||
// return ['TS.INFO', key];
|
||||
// }
|
||||
|
||||
export type InfoRawReply = [
|
||||
'totalSamples',
|
||||
number,
|
||||
'memoryUsage',
|
||||
number,
|
||||
'firstTimestamp',
|
||||
number,
|
||||
'lastTimestamp',
|
||||
number,
|
||||
'retentionTime',
|
||||
number,
|
||||
'chunkCount',
|
||||
number,
|
||||
'chunkSize',
|
||||
number,
|
||||
'chunkType',
|
||||
string,
|
||||
'duplicatePolicy',
|
||||
TimeSeriesDuplicatePolicies | null,
|
||||
'labels',
|
||||
Array<[name: string, value: string]>,
|
||||
'sourceKey',
|
||||
string | null,
|
||||
'rules',
|
||||
Array<[key: string, timeBucket: number, aggregationType: TimeSeriesAggregationType]>
|
||||
];
|
||||
// export type InfoRawReply = [
|
||||
// 'totalSamples',
|
||||
// number,
|
||||
// 'memoryUsage',
|
||||
// number,
|
||||
// 'firstTimestamp',
|
||||
// number,
|
||||
// 'lastTimestamp',
|
||||
// number,
|
||||
// 'retentionTime',
|
||||
// number,
|
||||
// 'chunkCount',
|
||||
// number,
|
||||
// 'chunkSize',
|
||||
// number,
|
||||
// 'chunkType',
|
||||
// string,
|
||||
// 'duplicatePolicy',
|
||||
// TimeSeriesDuplicatePolicies | null,
|
||||
// 'labels',
|
||||
// Array<[name: string, value: string]>,
|
||||
// 'sourceKey',
|
||||
// string | null,
|
||||
// 'rules',
|
||||
// Array<[key: string, timeBucket: number, aggregationType: TimeSeriesAggregationType]>
|
||||
// ];
|
||||
|
||||
export interface InfoReply {
|
||||
totalSamples: number;
|
||||
memoryUsage: number;
|
||||
firstTimestamp: number;
|
||||
lastTimestamp: number;
|
||||
retentionTime: number;
|
||||
chunkCount: number;
|
||||
chunkSize: number;
|
||||
chunkType: string;
|
||||
duplicatePolicy: TimeSeriesDuplicatePolicies | null;
|
||||
labels: Array<{
|
||||
name: string;
|
||||
value: string;
|
||||
}>;
|
||||
sourceKey: string | null;
|
||||
rules: Array<{
|
||||
key: string;
|
||||
timeBucket: number;
|
||||
aggregationType: TimeSeriesAggregationType
|
||||
}>;
|
||||
}
|
||||
// export interface InfoReply {
|
||||
// totalSamples: number;
|
||||
// memoryUsage: number;
|
||||
// firstTimestamp: number;
|
||||
// lastTimestamp: number;
|
||||
// retentionTime: number;
|
||||
// chunkCount: number;
|
||||
// chunkSize: number;
|
||||
// chunkType: string;
|
||||
// duplicatePolicy: TimeSeriesDuplicatePolicies | null;
|
||||
// labels: Array<{
|
||||
// name: string;
|
||||
// value: string;
|
||||
// }>;
|
||||
// sourceKey: string | null;
|
||||
// rules: Array<{
|
||||
// key: string;
|
||||
// timeBucket: number;
|
||||
// aggregationType: TimeSeriesAggregationType
|
||||
// }>;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
return {
|
||||
totalSamples: reply[1],
|
||||
memoryUsage: reply[3],
|
||||
firstTimestamp: reply[5],
|
||||
lastTimestamp: reply[7],
|
||||
retentionTime: reply[9],
|
||||
chunkCount: reply[11],
|
||||
chunkSize: reply[13],
|
||||
chunkType: reply[15],
|
||||
duplicatePolicy: reply[17],
|
||||
labels: reply[19].map(([name, value]) => ({
|
||||
name,
|
||||
value
|
||||
})),
|
||||
sourceKey: reply[21],
|
||||
rules: reply[23].map(([key, timeBucket, aggregationType]) => ({
|
||||
key,
|
||||
timeBucket,
|
||||
aggregationType
|
||||
}))
|
||||
};
|
||||
}
|
||||
// export function transformReply(reply: InfoRawReply): InfoReply {
|
||||
// return {
|
||||
// totalSamples: reply[1],
|
||||
// memoryUsage: reply[3],
|
||||
// firstTimestamp: reply[5],
|
||||
// lastTimestamp: reply[7],
|
||||
// retentionTime: reply[9],
|
||||
// chunkCount: reply[11],
|
||||
// chunkSize: reply[13],
|
||||
// chunkType: reply[15],
|
||||
// duplicatePolicy: reply[17],
|
||||
// labels: reply[19].map(([name, value]) => ({
|
||||
// name,
|
||||
// value
|
||||
// })),
|
||||
// sourceKey: reply[21],
|
||||
// rules: reply[23].map(([key, timeBucket, aggregationType]) => ({
|
||||
// key,
|
||||
// timeBucket,
|
||||
// aggregationType
|
||||
// }))
|
||||
// };
|
||||
// }
|
||||
|
@@ -1,57 +1,57 @@
|
||||
import {
|
||||
transformArguments as transformInfoArguments,
|
||||
InfoRawReply,
|
||||
InfoReply,
|
||||
transformReply as transformInfoReply
|
||||
} from './INFO';
|
||||
// import {
|
||||
// transformArguments as transformInfoArguments,
|
||||
// InfoRawReply,
|
||||
// InfoReply,
|
||||
// transformReply as transformInfoReply
|
||||
// } from './INFO';
|
||||
|
||||
export { IS_READ_ONLY, FIRST_KEY_INDEX } from './INFO';
|
||||
// export { IS_READ_ONLY, FIRST_KEY_INDEX } from './INFO';
|
||||
|
||||
export function transformArguments(key: string): Array<string> {
|
||||
const args = transformInfoArguments(key);
|
||||
args.push('DEBUG');
|
||||
return args;
|
||||
}
|
||||
// export function transformArguments(key: string): Array<string> {
|
||||
// const args = transformInfoArguments(key);
|
||||
// args.push('DEBUG');
|
||||
// return args;
|
||||
// }
|
||||
|
||||
type InfoDebugRawReply = [
|
||||
...InfoRawReply,
|
||||
'keySelfName',
|
||||
string,
|
||||
'chunks',
|
||||
Array<[
|
||||
'startTimestamp',
|
||||
number,
|
||||
'endTimestamp',
|
||||
number,
|
||||
'samples',
|
||||
number,
|
||||
'size',
|
||||
number,
|
||||
'bytesPerSample',
|
||||
string
|
||||
]>
|
||||
];
|
||||
// type InfoDebugRawReply = [
|
||||
// ...InfoRawReply,
|
||||
// 'keySelfName',
|
||||
// string,
|
||||
// 'chunks',
|
||||
// Array<[
|
||||
// 'startTimestamp',
|
||||
// number,
|
||||
// 'endTimestamp',
|
||||
// number,
|
||||
// 'samples',
|
||||
// number,
|
||||
// 'size',
|
||||
// number,
|
||||
// 'bytesPerSample',
|
||||
// string
|
||||
// ]>
|
||||
// ];
|
||||
|
||||
interface InfoDebugReply extends InfoReply {
|
||||
keySelfName: string;
|
||||
chunks: Array<{
|
||||
startTimestamp: number;
|
||||
endTimestamp: number;
|
||||
samples: number;
|
||||
size: number;
|
||||
bytesPerSample: string;
|
||||
}>;
|
||||
}
|
||||
// interface InfoDebugReply extends InfoReply {
|
||||
// keySelfName: string;
|
||||
// chunks: Array<{
|
||||
// startTimestamp: number;
|
||||
// endTimestamp: number;
|
||||
// samples: number;
|
||||
// size: number;
|
||||
// bytesPerSample: string;
|
||||
// }>;
|
||||
// }
|
||||
|
||||
export function transformReply(rawReply: InfoDebugRawReply): InfoDebugReply {
|
||||
const reply = transformInfoReply(rawReply as unknown as InfoRawReply);
|
||||
(reply as InfoDebugReply).keySelfName = rawReply[25];
|
||||
(reply as InfoDebugReply).chunks = rawReply[27].map(chunk => ({
|
||||
startTimestamp: chunk[1],
|
||||
endTimestamp: chunk[3],
|
||||
samples: chunk[5],
|
||||
size: chunk[7],
|
||||
bytesPerSample: chunk[9]
|
||||
}));
|
||||
return reply as InfoDebugReply;
|
||||
}
|
||||
// export function transformReply(rawReply: InfoDebugRawReply): InfoDebugReply {
|
||||
// const reply = transformInfoReply(rawReply as unknown as InfoRawReply);
|
||||
// (reply as InfoDebugReply).keySelfName = rawReply[25];
|
||||
// (reply as InfoDebugReply).chunks = rawReply[27].map(chunk => ({
|
||||
// startTimestamp: chunk[1],
|
||||
// endTimestamp: chunk[3],
|
||||
// samples: chunk[5],
|
||||
// size: chunk[7],
|
||||
// bytesPerSample: chunk[9]
|
||||
// }));
|
||||
// return reply as InfoDebugReply;
|
||||
// }
|
||||
|
Reference in New Issue
Block a user