diff --git a/hack/cmds/commands.json b/hack/cmds/commands.json index 1c9eeac2..226ce6a5 100644 --- a/hack/cmds/commands.json +++ b/hack/cmds/commands.json @@ -6938,6 +6938,51 @@ "since": "5.0.0", "group": "stream" }, + "XCFGSET": { + "summary": "Sets the IDMP configuration parameters for a stream.", + "complexity": "O(1)", + "arguments": [ + { + "name": "key", + "type": "key", + "key_spec_index": 0 + }, + { + "name": "idmp-duration-block", + "type": "block", + "optional": true, + "arguments": [ + { + "name": "idmp-duration-token", + "type": "pure-token", + "token": "IDMP-DURATION" + }, + { + "name": "duration", + "type": "integer" + } + ] + }, + { + "name": "idmp-maxsize-block", + "type": "block", + "optional": true, + "arguments": [ + { + "name": "idmp-maxsize-token", + "type": "pure-token", + "token": "IDMP-MAXSIZE" + }, + { + "name": "maxsize", + "type": "integer" + } + ] + } + ], + "since": "8.6.0", + "group": "stream" + }, "XDEL": { "summary": "Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist.", "complexity": "O(1) for each single item to delete in the stream, regardless of the stream size.", diff --git a/internal/cmds/gen_stream.go b/internal/cmds/gen_stream.go index 408895ff..ae52f37c 100644 --- a/internal/cmds/gen_stream.go +++ b/internal/cmds/gen_stream.go @@ -552,6 +552,74 @@ func (c XautoclaimStart) Build() Completed { return Completed{cs: c.cs, cf: uint16(c.cf), ks: c.ks} } +type Xcfgset Incomplete + +func (b Builder) Xcfgset() (c Xcfgset) { + c = Xcfgset{cs: get(), ks: b.ks} + c.cs.s = append(c.cs.s, "XCFGSET") + return c +} + +func (c Xcfgset) Key(key string) XcfgsetKey { + if c.ks&NoSlot == NoSlot { + c.ks = NoSlot | slot(key) + } else { + c.ks = check(c.ks, slot(key)) + } + c.cs.s = append(c.cs.s, key) + return (XcfgsetKey)(c) +} + +type XcfgsetIdmpDurationBlockDuration Incomplete + +func (c XcfgsetIdmpDurationBlockDuration) IdmpMaxsize() XcfgsetIdmpMaxsizeBlockIdmpMaxsizeTokenIdmpMaxsize { + c.cs.s = append(c.cs.s, "IDMP-MAXSIZE") + return (XcfgsetIdmpMaxsizeBlockIdmpMaxsizeTokenIdmpMaxsize)(c) +} + +func (c XcfgsetIdmpDurationBlockDuration) Build() Completed { + c.cs.Build() + return Completed{cs: c.cs, cf: uint16(c.cf), ks: c.ks} +} + +type XcfgsetIdmpDurationBlockIdmpDurationTokenIdmpDuration Incomplete + +func (c XcfgsetIdmpDurationBlockIdmpDurationTokenIdmpDuration) Duration(duration int64) XcfgsetIdmpDurationBlockDuration { + c.cs.s = append(c.cs.s, strconv.FormatInt(duration, 10)) + return (XcfgsetIdmpDurationBlockDuration)(c) +} + +type XcfgsetIdmpMaxsizeBlockIdmpMaxsizeTokenIdmpMaxsize Incomplete + +func (c XcfgsetIdmpMaxsizeBlockIdmpMaxsizeTokenIdmpMaxsize) Maxsize(maxsize int64) XcfgsetIdmpMaxsizeBlockMaxsize { + c.cs.s = append(c.cs.s, strconv.FormatInt(maxsize, 10)) + return (XcfgsetIdmpMaxsizeBlockMaxsize)(c) +} + +type XcfgsetIdmpMaxsizeBlockMaxsize Incomplete + +func (c XcfgsetIdmpMaxsizeBlockMaxsize) Build() Completed { + c.cs.Build() + return Completed{cs: c.cs, cf: uint16(c.cf), ks: c.ks} +} + +type XcfgsetKey Incomplete + +func (c XcfgsetKey) IdmpDuration() XcfgsetIdmpDurationBlockIdmpDurationTokenIdmpDuration { + c.cs.s = append(c.cs.s, "IDMP-DURATION") + return (XcfgsetIdmpDurationBlockIdmpDurationTokenIdmpDuration)(c) +} + +func (c XcfgsetKey) IdmpMaxsize() XcfgsetIdmpMaxsizeBlockIdmpMaxsizeTokenIdmpMaxsize { + c.cs.s = append(c.cs.s, "IDMP-MAXSIZE") + return (XcfgsetIdmpMaxsizeBlockIdmpMaxsizeTokenIdmpMaxsize)(c) +} + +func (c XcfgsetKey) Build() Completed { + c.cs.Build() + return Completed{cs: c.cs, cf: uint16(c.cf), ks: c.ks} +} + type Xclaim Incomplete func (b Builder) Xclaim() (c Xclaim) { diff --git a/internal/cmds/gen_stream_test.go b/internal/cmds/gen_stream_test.go index c6f00fc1..fa64be31 100644 --- a/internal/cmds/gen_stream_test.go +++ b/internal/cmds/gen_stream_test.go @@ -51,6 +51,10 @@ func stream0(s Builder) { s.Xautoclaim().Key("1").Group("1").Consumer("1").MinIdleTime("1").Start("1").Count(1).Build() s.Xautoclaim().Key("1").Group("1").Consumer("1").MinIdleTime("1").Start("1").Justid().Build() s.Xautoclaim().Key("1").Group("1").Consumer("1").MinIdleTime("1").Start("1").Build() + s.Xcfgset().Key("1").IdmpDuration().Duration(1).IdmpMaxsize().Maxsize(1).Build() + s.Xcfgset().Key("1").IdmpDuration().Duration(1).Build() + s.Xcfgset().Key("1").IdmpMaxsize().Maxsize(1).Build() + s.Xcfgset().Key("1").Build() s.Xclaim().Key("1").Group("1").Consumer("1").MinIdleTime("1").Id("1").Id("1").Idle(1).Time(1).Retrycount(1).Force().Justid().Lastid().Build() s.Xclaim().Key("1").Group("1").Consumer("1").MinIdleTime("1").Id("1").Id("1").Idle(1).Time(1).Retrycount(1).Force().Justid().Build() s.Xclaim().Key("1").Group("1").Consumer("1").MinIdleTime("1").Id("1").Id("1").Idle(1).Time(1).Retrycount(1).Force().Lastid().Build() @@ -101,13 +105,13 @@ func stream0(s Builder) { s.Xpending().Key("1").Group("1").Build() s.Xrange().Key("1").Start("1").End("1").Count(1).Build() s.Xrange().Key("1").Start("1").End("1").Build() +} + +func stream1(s Builder) { s.Xread().Count(1).Block(1).Streams().Key("1").Key("1").Id("1").Id("1").Build() s.Xread().Count(1).Streams().Key("1").Key("1").Id("1").Id("1").Build() s.Xread().Block(1).Streams().Key("1").Key("1").Id("1").Id("1").Build() s.Xread().Streams().Key("1").Key("1").Id("1").Id("1").Build() -} - -func stream1(s Builder) { s.Xreadgroup().Group("1", "1").Count(1).Block(1).Noack().Claim("1").Streams().Key("1").Key("1").Id("1").Id("1").Build() s.Xreadgroup().Group("1", "1").Count(1).Block(1).Noack().Streams().Key("1").Key("1").Id("1").Id("1").Build() s.Xreadgroup().Group("1", "1").Count(1).Block(1).Claim("1").Streams().Key("1").Key("1").Id("1").Id("1").Build()