Skip to content

Commit

Permalink
add allowNonCoveredSlots option to ScanOptions and update GlideCluste…
Browse files Browse the repository at this point in the history
…rClient

Signed-off-by: avifenesh <aviarchi1994@gmail.com>
  • Loading branch information
avifenesh committed Dec 18, 2024
1 parent 84adcfe commit 2a3b1db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions node/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ In order to run these tests, use:
```bash
npm run test-modules -- --cluster-endpoints=<address>:<port>
```
Note: these tests don't run with standalone server as of now.

### REPL (interactive shell)
Expand Down
1 change: 1 addition & 0 deletions node/src/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3855,6 +3855,7 @@ export interface BaseScanOptions {
*/
export interface ScanOptions extends BaseScanOptions {
type?: ObjectType;
allowNonCoveredSlots?: boolean;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions node/src/GlideClusterClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ export class GlideClusterClient extends BaseClient {
command.objectType = options.type;
}

command.allowNonCoveredSlots = options?.allowNonCoveredSlots ?? false;
return command;
}

Expand Down Expand Up @@ -651,14 +652,14 @@ export class GlideClusterClient extends BaseClient {
* console.log(allKeys); // ["key1", "key2", "key3"]
*
* // Iterate over keys matching a pattern
* await client.mset([{key: "key1", value: "value1"}, {key: "key2", value: "value2"}, {key: "notMykey", value: "value3"}, {key: "somethingElse", value: "value4"}]);
* await client.mset([{key: "key1", value: "value1"}, {key: "key2", value: "value2"}, {key: "notMyKey", value: "value3"}, {key: "somethingElse", value: "value4"}]);
* let cursor = new ClusterScanCursor();
* const matchedKeys: GlideString[] = [];
* while (!cursor.isFinished()) {
* const [cursor, keys] = await client.scan(cursor, { match: "*key*", count: 10 });
* matchedKeys.push(...keys);
* }
* console.log(matchedKeys); // ["key1", "key2", "notMykey"]
* console.log(matchedKeys); // ["key1", "key2", "notMyKey"]
*
* // Iterate over keys of a specific type
* await client.mset([{key: "key1", value: "value1"}, {key: "key2", value: "value2"}, {key: "key3", value: "value3"}]);
Expand Down

0 comments on commit 2a3b1db

Please sign in to comment.