Skip to content

Commit 4a98ea6

Browse files
DEV: add RESP2/3 return information to the time series commands (#1895)
* DEV: add RESP2/3 return information to the time series commands * Apply suggestions from code review Co-authored-by: andy-stark-redis <164213578+andy-stark-redis@users.noreply.github.com> * Apply more suggestions from code review --------- Co-authored-by: andy-stark-redis <164213578+andy-stark-redis@users.noreply.github.com>
1 parent 55dc4a9 commit 4a98ea6

17 files changed

+360
-142
lines changed

content/commands/ts.add.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,6 @@ Use it only if you are creating a new time series. It is ignored if you are addi
213213
- Setting `RETENTION` and `LABELS` introduces additional time complexity.
214214
</note>
215215

216-
## Return value
217-
218-
Returns one of these replies:
219-
220-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
221-
- [] on error (invalid arguments, wrong key type, etc.), when duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp
222-
223216
## Complexity
224217

225218
If a compaction rule exists on a time series, the performance of `TS.ADD` can be reduced.
@@ -246,6 +239,24 @@ Add a sample to the time series, setting the sample's timestamp to the current U
246239
{{< / highlight >}}
247240
</details>
248241

242+
## Return information
243+
244+
{{< multitabs id="ts-add-return-info"
245+
tab1="RESP2"
246+
tab2="RESP3" >}}
247+
248+
One of the following:
249+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
250+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp.
251+
252+
-tab-sep-
253+
254+
One of the following:
255+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
256+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp.
257+
258+
{{< /multitabs >}}
259+
249260
## See also
250261

251262
[`TS.CREATE`]({{< relref "commands/ts.create/" >}})

content/commands/ts.alter.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,6 @@ is set of label-value pairs that represent metadata labels of the key and serve
119119
If `LABELS` is specified, the given label list is applied. Labels that are not present in the given list are removed implicitly. Specifying `LABELS` with no label-value pairs removes all existing labels. See `LABELS` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}}).
120120
</details>
121121

122-
## Return value
123-
124-
Returns one of these replies:
125-
126-
- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly
127-
- [] on error (invalid arguments, wrong key type, key does not exist, etc.)
128-
129122
## Examples
130123

131124
<details open><summary><b>Alter a temperature time series</b></summary>
@@ -145,6 +138,24 @@ OK
145138
{{< / highlight >}}
146139
</details>
147140

141+
## Return information
142+
143+
{{< multitabs id="ts-alter-return-info"
144+
tab1="RESP2"
145+
tab2="RESP3" >}}
146+
147+
One of the following:
148+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is altered successfully.
149+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc.
150+
151+
-tab-sep-
152+
153+
One of the following:
154+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is altered successfully.
155+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc.
156+
157+
{{< /multitabs >}}
158+
148159
## See also
149160

150161
[`TS.CREATE`]({{< relref "commands/ts.create/" >}})

content/commands/ts.create.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,7 @@ is set of label-value pairs that represent metadata labels of the key and serve
180180
The [`TS.MGET`]({{< relref "commands/ts.mget/" >}}), [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}), and [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) commands operate on multiple time series based on their labels. The [`TS.QUERYINDEX`]({{< relref "commands/ts.queryindex/" >}}) command returns all time series keys matching a given filter based on their labels.
181181
</details>
182182

183-
## Return value
184-
185-
Returns one of these replies:
186-
187-
- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly
188-
- [] on error (invalid arguments, key already exists, etc.)
189-
190-
## Examples
183+
## Examples
191184

192185
<details open><summary><b>Create a temperature time series</b></summary>
193186

@@ -197,6 +190,24 @@ OK
197190
{{< / highlight >}}
198191
</details>
199192

193+
## Return information
194+
195+
{{< multitabs id="ts-create-return-info"
196+
tab1="RESP2"
197+
tab2="RESP3" >}}
198+
199+
One of the following:
200+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is created successfully.
201+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, key already exists, etc.
202+
203+
-tab-sep-
204+
205+
One of the following:
206+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is created successfully.
207+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, key already exists, etc.
208+
209+
{{< /multitabs >}}
210+
200211
## See also
201212

202213
[`TS.ADD`]({{< relref "commands/ts.add/" >}}) | [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}) | [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) | [`TS.MGET`]({{< relref "commands/ts.mget/" >}}) | [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) | [`TS.QUERYINDEX`]({{< relref "commands/ts.queryindex/" >}})

content/commands/ts.createrule.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,6 @@ ensures that there is a bucket that starts exactly at `alignTimestamp` and align
151151
For example, if `bucketDuration` is 24 hours (`24 * 3600 * 1000`), setting `alignTimestamp` to 6 hours after the Unix epoch (`6 * 3600 * 1000`) ensures that each bucket’s timeframe is `[06:00 .. 06:00)`.
152152
</details>
153153

154-
## Return value
155-
156-
Returns one of these replies:
157-
158-
- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly
159-
- [] on error (invalid arguments, wrong key type, etc.), when `sourceKey` does not exist, when `destKey` does not exist, when `sourceKey` is already a destination of a compaction rule, when `destKey` is already a source or a destination of a compaction rule, or when `sourceKey` and `destKey` are identical
160-
161154
## Examples
162155

163156
<details open>
@@ -184,9 +177,27 @@ Now, also create a compacted time series named _dailyDiffTemp_. This time series
184177
127.0.0.1:6379> TS.CREATE dailyDiffTemp:TLV LABELS type temp location TLV
185178
127.0.0.1:6379> TS.CREATERULE temp:TLV dailyDiffTemp:TLV AGGREGATION range 86400000 21600000
186179
{{< / highlight >}}
187-
180+
188181
</details>
189182

183+
## Return information
184+
185+
{{< multitabs id="ts-createrule-return-info"
186+
tab1="RESP2"
187+
tab2="RESP3" >}}
188+
189+
One of the following:
190+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is created successfully.
191+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `sourceKey` does not exist, `destKey` does not exist, `sourceKey` is already a destination of a compaction rule, `destKey` is already a source or a destination of a compaction rule, or `sourceKey` and `destKey` are identical.
192+
193+
-tab-sep-
194+
195+
One of the following:
196+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is created successfully.
197+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `sourceKey` does not exist, `destKey` does not exist, `sourceKey` is already a destination of a compaction rule, `destKey` is already a source or a destination of a compaction rule, or `sourceKey` and `destKey` are identical.
198+
199+
{{< /multitabs >}}
200+
190201
## See also
191202

192203
[`TS.DELETERULE`]({{< relref "commands/ts.deleterule/" >}})

content/commands/ts.decrby.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,23 @@ Use it only if you are creating a new time series. It is ignored if you are addi
173173
- Setting `RETENTION` and `LABELS` introduces additional time complexity.
174174
</note>
175175

176-
## Return value
176+
## Return information
177177

178-
Returns one of these replies:
178+
{{< multitabs id="ts-decrby-return-info"
179+
tab1="RESP2"
180+
tab2="RESP3" >}}
179181

180-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
181-
- [] on error (invalid arguments, wrong key type, etc.), or when `timestamp` is not equal to or higher than the maximum existing timestamp
182+
One of the following:
183+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
184+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp.
185+
186+
-tab-sep-
187+
188+
One of the following:
189+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
190+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp.
191+
192+
{{< /multitabs >}}
182193

183194
## See also
184195

content/commands/ts.del.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,7 @@ The given timestamp interval is closed (inclusive), meaning that samples whose t
6969

7070
</note>
7171

72-
## Return value
73-
74-
Returns one of these replies:
75-
76-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the number of samples that were deleted
77-
- [] on error (invalid arguments, wrong key type, etc.), when `timestamp` is older than the retention period compared to the maximum existing timestamp, or when an affected compaction bucket cannot be recalculated
78-
79-
## Examples
72+
## Examples
8073

8174
<details open><summary><b>Delete range of data points</b></summary>
8275

@@ -107,6 +100,24 @@ Delete the range of data points for temperature in Tel Aviv.
107100
{{< / highlight >}}
108101
</details>
109102

103+
## Return information
104+
105+
{{< multitabs id="ts-del-return-info"
106+
tab1="RESP2"
107+
tab2="RESP3" >}}
108+
109+
One of the following:
110+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of samples that were deleted.
111+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `timestamp` is older than the retention period compared to the maximum existing timestamp, or when an affected compaction bucket cannot be recalculated.
112+
113+
-tab-sep-
114+
115+
One of the following:
116+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of samples that were deleted.
117+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `timestamp` is older than the retention period compared to the maximum existing timestamp, or when an affected compaction bucket cannot be recalculated.
118+
119+
{{< /multitabs >}}
120+
110121
## See also
111122

112123
[`TS.ADD`]({{< relref "commands/ts.add/" >}})

content/commands/ts.deleterule.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,23 @@ is key name for destination (compacted) time series.
5151

5252
<note><b>Note:</b> This command does not delete the compacted series.</note>
5353

54-
## Return value
54+
## Return information
5555

56-
Returns one of these replies:
56+
{{< multitabs id="ts-deleterule-return-info"
57+
tab1="RESP2"
58+
tab2="RESP3" >}}
5759

58-
- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly
59-
- [] on error (invalid arguments, etc.), or when such rule does not exist
60+
One of the following:
61+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is deleted successfully.
62+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, or when such rule does not exist.
63+
64+
-tab-sep-
65+
66+
One of the following:
67+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is deleted successfully.
68+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, or when such rule does not exist.
69+
70+
{{< /multitabs >}}
6071

6172
## See also
6273

content/commands/ts.get.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ is used when a time series is a compaction. With `LATEST`, TS.GET reports the co
5555
The data in the latest bucket of a compaction is possibly partial. A bucket is _closed_ and compacted only upon arrival of a new sample that _opens_ a new _latest_ bucket. There are cases, however, when the compacted value of the latest (possibly partial) bucket is also required. In such a case, use `LATEST`.
5656
</details>
5757

58-
## Return value
59-
60-
Returns one of these replies:
61-
62-
- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of a single ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pair representing (timestamp, value(double)) of the sample with the highest timestamp
63-
- An empty [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) - when the time series is empty
64-
- [] (invalid arguments, wrong key type, key does not exist, etc.)
65-
6658
## Examples
6759

6860
<details open>
@@ -135,7 +127,27 @@ Get the latest maximum daily temperature (the temperature with the highest times
135127
{{< / highlight >}}
136128

137129
</details>
138-
130+
131+
## Return information
132+
133+
{{< multitabs id="ts-get-return-info"
134+
tab1="RESP2"
135+
tab2="RESP3" >}}
136+
137+
One of the following:
138+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of a single ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pair representing (timestamp, value) of the sample with the highest timestamp.
139+
* An empty [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) when the time series is empty.
140+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc.
141+
142+
-tab-sep-
143+
144+
One of the following:
145+
* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of a single ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) pair representing (timestamp, value) of the sample with the highest timestamp.
146+
* An empty [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) when the time series is empty.
147+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc.
148+
149+
{{< /multitabs >}}
150+
139151
## See also
140152

141153
[`TS.MGET`]({{< relref "commands/ts.mget/" >}})

content/commands/ts.incrby.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,6 @@ Use it only if you are creating a new time series. It is ignored if you are addi
174174
- Setting `RETENTION` and `LABELS` introduces additional time complexity.
175175
</note>
176176

177-
## Return value
178-
179-
Returns one of these replies:
180-
181-
- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
182-
- [] on error (invalid arguments, wrong key type, etc.), or when `timestamp` is not equal to or higher than the maximum existing timestamp
183-
184177
## Examples
185178

186179
<details open><summary><b>Store sum of data from several sources</b></summary>
@@ -215,9 +208,27 @@ Suppose a sensor ticks whenever a car is passed on a road, and you want to count
215208
(integer) 1658431553109
216209
{{< / highlight >}}
217210

218-
The timestamp is filled automatically.
211+
The timestamp is filled automatically.
219212
</details>
220213

214+
## Return information
215+
216+
{{< multitabs id="ts-incrby-return-info"
217+
tab1="RESP2"
218+
tab2="RESP3" >}}
219+
220+
One of the following:
221+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
222+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp.
223+
224+
-tab-sep-
225+
226+
One of the following:
227+
* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series.
228+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp.
229+
230+
{{< /multitabs >}}
231+
221232
## See also
222233

223234
[`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) | [`TS.CREATE`]({{< relref "commands/ts.create/" >}})

0 commit comments

Comments
 (0)