-
Notifications
You must be signed in to change notification settings - Fork 152
Node: Add binary variant to server management commands. #2179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
6f4fb2d
7f44c77
a874953
85bb655
ae46829
ca5789f
00b4be5
1114f89
0982891
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -256,15 +256,19 @@ export class GlideClient extends BaseClient { | |
| }); | ||
| } | ||
|
|
||
| /** Get information and statistics about the Redis server. | ||
| /** | ||
| * Gets information and statistics about the server. | ||
| * | ||
| * @see {@link https://valkey.io/commands/info/|valkey.io} for details. | ||
| * | ||
| * @param options - A list of InfoSection values specifying which sections of information to retrieve. | ||
| * When no parameter is provided, the default option is assumed. | ||
| * @returns a string containing the information for the sections requested. | ||
| * @param sections - (Optional) A list of {@link InfoOptions} values specifying which sections of information to retrieve. | ||
| * When no parameter is provided, the {@link InfoOptions.Default|default option} is assumed. | ||
| * @returns A string containing the information for the sections requested. | ||
| */ | ||
| public async info(options?: InfoOptions[]): Promise<string> { | ||
| return this.createWritePromise(createInfo(options)); | ||
| public async info(sections?: InfoOptions[]): Promise<string> { | ||
| return this.createWritePromise(createInfo(sections), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** Change the currently selected Redis database. | ||
|
|
@@ -300,7 +304,9 @@ export class GlideClient extends BaseClient { | |
| return this.createWritePromise(createClientGetName()); | ||
| } | ||
|
|
||
| /** Rewrite the configuration file with the current configuration. | ||
| /** | ||
| * Rewrites the configuration file with the current configuration. | ||
| * | ||
| * @see {@link https://valkey.io/commands/config-rewrite/|valkey.io} for details. | ||
| * | ||
| * @returns "OK" when the configuration was rewritten properly. Otherwise, an error is thrown. | ||
|
|
@@ -313,10 +319,13 @@ export class GlideClient extends BaseClient { | |
| * ``` | ||
| */ | ||
| public async configRewrite(): Promise<"OK"> { | ||
| return this.createWritePromise(createConfigRewrite()); | ||
| return this.createWritePromise(createConfigRewrite(), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** Resets the statistics reported by Redis using the INFO and LATENCY HISTOGRAM commands. | ||
| /** | ||
| * Resets the statistics reported by the server using the `INFO` and `LATENCY HISTOGRAM` commands. | ||
| * | ||
| * @see {@link https://valkey.io/commands/config-resetstat/|valkey.io} for details. | ||
| * | ||
|
|
@@ -330,7 +339,9 @@ export class GlideClient extends BaseClient { | |
| * ``` | ||
| */ | ||
| public async configResetStat(): Promise<"OK"> { | ||
| return this.createWritePromise(createConfigResetStat()); | ||
| return this.createWritePromise(createConfigResetStat(), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** Returns the current connection id. | ||
|
|
@@ -342,11 +353,14 @@ export class GlideClient extends BaseClient { | |
| return this.createWritePromise(createClientId()); | ||
| } | ||
|
|
||
| /** Reads the configuration parameters of a running Redis server. | ||
| /** | ||
| * Reads the configuration parameters of the running server. | ||
| * | ||
| * @see {@link https://valkey.io/commands/config-get/|valkey.io} for details. | ||
| * | ||
| * @param parameters - A list of configuration parameter names to retrieve values for. | ||
| * @param decoder - (Optional) {@link Decoder} type which defines how to handle the response. | ||
| * If not set, the {@link BaseClientConfiguration.defaultDecoder|default decoder} will be used. | ||
| * | ||
| * @returns A map of values corresponding to the configuration parameters. | ||
| * | ||
|
|
@@ -359,16 +373,19 @@ export class GlideClient extends BaseClient { | |
| */ | ||
| public async configGet( | ||
| parameters: string[], | ||
| ): Promise<Record<string, string>> { | ||
| return this.createWritePromise(createConfigGet(parameters)); | ||
| decoder?: Decoder, | ||
| ): Promise<Record<string, GlideString>> { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that config parameter names are defined by the server, so all of them are simple strings. |
||
| return this.createWritePromise(createConfigGet(parameters), { | ||
| decoder: decoder, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Set configuration parameters to the specified values. | ||
| * Sets configuration parameters to the specified values. | ||
| * | ||
| * @see {@link https://valkey.io/commands/config-set/|valkey.io} for details. | ||
| * @param parameters - A List of keyValuePairs consisting of configuration parameters and their respective values to set. | ||
| * @returns "OK" when the configuration was set properly. Otherwise an error is thrown. | ||
| * @param parameters - A map consisting of configuration parameters and their respective values to set. | ||
|
Yury-Fridlyand marked this conversation as resolved.
|
||
| * @returns `"OK"` when the configuration was set properly. Otherwise an error is thrown. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
|
|
@@ -377,8 +394,12 @@ export class GlideClient extends BaseClient { | |
| * console.log(result); // Output: 'OK' | ||
| * ``` | ||
| */ | ||
| public async configSet(parameters: Record<string, string>): Promise<"OK"> { | ||
| return this.createWritePromise(createConfigSet(parameters)); | ||
| public async configSet( | ||
| parameters: Record<string, GlideString>, | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| ): Promise<"OK"> { | ||
| return this.createWritePromise(createConfigSet(parameters), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** Echoes the provided `message` back. | ||
|
|
@@ -398,22 +419,24 @@ export class GlideClient extends BaseClient { | |
| return this.createWritePromise(createEcho(message)); | ||
| } | ||
|
|
||
| /** Returns the server time | ||
| /** | ||
| * Returns the server time. | ||
| * | ||
| * @see {@link https://valkey.io/commands/time/|valkey.io} for details. | ||
| * | ||
| * @returns - The current server time as a two items `array`: | ||
| * A Unix timestamp and the amount of microseconds already elapsed in the current second. | ||
| * The returned `array` is in a [Unix timestamp, Microseconds already elapsed] format. | ||
| * @returns The current server time as an `array` with two items: | ||
| * - A Unix timestamp, | ||
| * - The amount of microseconds already elapsed in the current second. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * // Example usage of time command | ||
| * const result = await client.time(); | ||
| * console.log(result); // Output: ['1710925775', '913580'] | ||
| * console.log(await client.time()); // Output: ['1710925775', '913580'] | ||
| * ``` | ||
| */ | ||
| public async time(): Promise<[string, string]> { | ||
| return this.createWritePromise(createTime()); | ||
| return this.createWritePromise(createTime(), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -482,7 +505,7 @@ export class GlideClient extends BaseClient { | |
| * | ||
| * @see {@link https://valkey.io/commands/lolwut/|valkey.io} for more details. | ||
| * | ||
| * @param options - The LOLWUT options | ||
| * @param options - (Optional) The LOLWUT options - see {@link LolwutOptions}. | ||
| * @returns A piece of generative computer art along with the current server version. | ||
| * | ||
| * @example | ||
|
|
@@ -492,7 +515,9 @@ export class GlideClient extends BaseClient { | |
| * ``` | ||
| */ | ||
| public async lolwut(options?: LolwutOptions): Promise<string> { | ||
| return this.createWritePromise(createLolwut(options)); | ||
| return this.createWritePromise(createLolwut(options), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -710,35 +735,39 @@ export class GlideClient extends BaseClient { | |
| * | ||
| * @see {@link https://valkey.io/commands/flushall/|valkey.io} for more details. | ||
| * | ||
| * @param mode - The flushing mode, could be either {@link FlushMode.SYNC} or {@link FlushMode.ASYNC}. | ||
| * @returns `OK`. | ||
| * @param mode - (Optional) The flushing mode, could be either {@link FlushMode.SYNC} or {@link FlushMode.ASYNC}. | ||
| * @returns `"OK"`. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const result = await client.flushall(FlushMode.SYNC); | ||
| * console.log(result); // Output: 'OK' | ||
| * ``` | ||
| */ | ||
| public async flushall(mode?: FlushMode): Promise<string> { | ||
| return this.createWritePromise(createFlushAll(mode)); | ||
| public async flushall(mode?: FlushMode): Promise<"OK"> { | ||
| return this.createWritePromise(createFlushAll(mode), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Deletes all the keys of the currently selected database. This command never fails. | ||
| * | ||
| * @see {@link https://valkey.io/commands/flushdb/|valkey.io} for more details. | ||
| * | ||
| * @param mode - The flushing mode, could be either {@link FlushMode.SYNC} or {@link FlushMode.ASYNC}. | ||
| * @returns `OK`. | ||
| * @param mode - (Optional) The flushing mode, could be either {@link FlushMode.SYNC} or {@link FlushMode.ASYNC}. | ||
| * @returns `"OK"`. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const result = await client.flushdb(FlushMode.SYNC); | ||
| * console.log(result); // Output: 'OK' | ||
| * ``` | ||
| */ | ||
| public async flushdb(mode?: FlushMode): Promise<string> { | ||
| return this.createWritePromise(createFlushDB(mode)); | ||
| public async flushdb(mode?: FlushMode): Promise<"OK"> { | ||
| return this.createWritePromise(createFlushDB(mode), { | ||
| decoder: Decoder.String, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -881,6 +910,7 @@ export class GlideClient extends BaseClient { | |
| * @see {@link https://valkey.io/commands/lastsave/|valkey.io} for more details. | ||
| * | ||
| * @returns `UNIX TIME` of the last DB save executed with success. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const timestamp = await client.lastsave(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used in this file?
Maybe RouteOption should be defined in GlideClusterClient because it's not ever used here.
Thoughts?