Skip to content

Update FIELDS argument to block type for HFE commands schema#13339

Merged
sundb merged 1 commit intoredis:unstablefrom
j178:unstable
Jun 14, 2024
Merged

Update FIELDS argument to block type for HFE commands schema#13339
sundb merged 1 commit intoredis:unstablefrom
j178:unstable

Conversation

@j178
Copy link
Contributor

@j178 j178 commented Jun 12, 2024

I reviewed XREAD command syntax:

XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] id [id ...]

Here’s the structure for XREAD:

"arguments": [
            {
                "token": "COUNT",
                "name": "count",
                "type": "integer",
                "optional": true
            },
            {
                "token": "BLOCK",
                "name": "milliseconds",
                "type": "integer",
                "optional": true
            },
            {
                "name": "streams",
                "token": "STREAMS",
                "type": "block",
                "arguments": [
                    {
                        "name": "key",
                        "type": "key",
                        "key_spec_index": 0,
                        "multiple": true
                    },
                    {
                        "name": "ID",
                        "type": "string",
                        "multiple": true
                    }
                ]
            }
]

Now, consider the HEXPIRE syntax:

HEXPIRE key seconds [NX | XX | GT | LT] FIELDS numfields field [field ...]

Since the FIELDS token functions similarly to STREAMS, and given that STREAMS is defined as a block, I believe the FIELDS in hepxire should also be defined as a block.

@sundb sundb requested review from moticless and tezc June 12, 2024 12:18
Copy link
Collaborator

@tezc tezc left a comment

Choose a reason for hiding this comment

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

LGTM. Without block type, it implies these arguments can be given individually which is not correct.

@sundb sundb changed the title Fix hash field expiration commands: FIELDS argument should be block type Update FIELDS argument to block type for HFE commands schema Jun 13, 2024
@sundb sundb merged commit 871c985 into redis:unstable Jun 14, 2024
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
…#13339)

I reviewed `XREAD` command syntax:
```
XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] id [id ...]
```

Here’s the structure for `XREAD`:
```json
"arguments": [
            {
                "token": "COUNT",
                "name": "count",
                "type": "integer",
                "optional": true
            },
            {
                "token": "BLOCK",
                "name": "milliseconds",
                "type": "integer",
                "optional": true
            },
            {
                "name": "streams",
                "token": "STREAMS",
                "type": "block",
                "arguments": [
                    {
                        "name": "key",
                        "type": "key",
                        "key_spec_index": 0,
                        "multiple": true
                    },
                    {
                        "name": "ID",
                        "type": "string",
                        "multiple": true
                    }
                ]
            }
]
```

Now, consider the `HEXPIRE` syntax:
```
HEXPIRE key seconds [NX | XX | GT | LT] FIELDS numfields field [field ...]
```

Since the `FIELDS` token functions similarly to `STREAMS`, and given that `STREAMS` is defined as a block, I believe the `FIELDS` in `hepxire` should also be defined as a block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants