Skip to content
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

Spike: returning a record replacement with glide strings. #418

Conversation

Yury-Fridlyand
Copy link

@Yury-Fridlyand Yury-Fridlyand commented Aug 26, 2024

TODO:

  • Complete code todos
  • Complete updating commands:
    • xinfo streams
    • function stats
    • function list
    • commands which return ClusterValue
  • Update examples in docs
  • Update description of returned types where changed
  • Update examples - indirect changes (especially zadd - used in examples of other commands)
  • Update transaction
  • Fix tests
  • Update exports
  • Add new tests
  • Update doc for custom command

List of commands:

  • LMPOP
  • BLMPOP
  • BZMPOP
  • ZPOPMIN
  • ZPOPMAX
  • ZMPOP
  • ZDIFFWITHSCORES
  • ZINTERWITHSCORES
  • ZUNIONWITHSCORES
  • HGETALL
  • LSCIDX - no return type change
  • PUBSUB NUMSUB
  • XRANGE - no return type change
  • XREVRANGE - no return type change
  • XINFO GROUPS - no return type change
  • XINFO CONSUMERS - no return type change
  • XINFO STREAM - no return type change
  • XCLAIM - no return type change
  • XAUTOCLAIM - no return type change
  • XREAD
  • XREADGROUP

node/rust-client/src/lib.rs Outdated Show resolved Hide resolved
node/tsconfig.json Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Show resolved Hide resolved

// GLideRecord for score for sorted set commands?
// TODO export
export type ElementScoreData = { element: GlideString; score: number }[];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I agree. This way you explicitly convey that this data type is meant for storing elements and their associated scores. This is more explicit than using GlideRecord , where the meaning of "key" and "value" might be less obvious without additional comments

});
}

/** Downcast `GlideRecord` to `Record`. Use if you are 146% aware that `data` keys are always strings. */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

146?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 100% is not enough

): Promise<Record<string, [string, string][]> | null> {
return this.createWritePromise(createXRevRange(key, end, start, count));
options?: { count?: number } & DecoderOption,
): Promise<{ entryID: GlideString; data: [string, string][] }[] | null> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the data not need to be a GlideString?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is a user data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: entry ID could be given by the user, but it is still in number-like format (to be precise: "<uint>-<uint>"). I updated it by introducing

export type StreamEntryDataType = Record<string, [GlideString, GlideString][]>;

Data is user data, which could contain anything

node/rust-client/src/lib.rs Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/tsconfig.json Outdated Show resolved Hide resolved
@Yury-Fridlyand Yury-Fridlyand merged commit 3e9264f into node/integ-yuryf-valkey-292-mget-mset Aug 28, 2024
3 of 8 checks passed
@Yury-Fridlyand Yury-Fridlyand deleted the node/yuryf-valkey-292-mget-mset branch August 28, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants