You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
init time series
This commit is contained in:
53
packages/time-series/lib/commands/INFO_DEBUG.ts
Normal file
53
packages/time-series/lib/commands/INFO_DEBUG.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import {
|
||||
transformArguments as transformInfoArguments,
|
||||
InfoRawReply,
|
||||
InfoReply,
|
||||
transformReply as transformInfoReply
|
||||
} 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;
|
||||
}
|
||||
|
||||
type InfoDebugRawReply = [
|
||||
...infoArgs: InfoRawReply,
|
||||
_: string,
|
||||
chunks: Array<[
|
||||
_: string,
|
||||
startTimestamp: number,
|
||||
_: string,
|
||||
endTimestamp: number,
|
||||
_: string,
|
||||
samples: number,
|
||||
_: string,
|
||||
size: number,
|
||||
_: string,
|
||||
bytesPerSample: string
|
||||
]>
|
||||
]
|
||||
|
||||
interface InfoDebugReply extends InfoReply {
|
||||
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).chunks = rawReply[25].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