Skip to content

Commit 2084e6c

Browse files
authored
Merge branch 'master' into load-balance-search-commands-to-shards
2 parents 79fd0cf + e2f6700 commit 2084e6c

File tree

10 files changed

+354
-27
lines changed

10 files changed

+354
-27
lines changed

.github/actions/run-tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
2525
# Mapping of redis version to redis testing containers
2626
declare -A redis_version_mapping=(
27-
["8.4.x"]="8.4-RC1-pre"
27+
["8.4.x"]="8.4-RC1-pre.2"
2828
["8.2.x"]="8.2.1-pre"
2929
["8.0.x"]="8.0.2"
3030
)

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
4545
# Mapping of redis version to redis testing containers
4646
declare -A redis_version_mapping=(
47-
["8.4.x"]="8.4-RC1-pre"
47+
["8.4.x"]="8.4-RC1-pre.2"
4848
["8.2.x"]="8.2.1-pre"
4949
["8.0.x"]="8.0.2"
5050
)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
22
REDIS_VERSION ?= 8.4
33
RE_CLUSTER ?= false
44
RCE_DOCKER ?= true
5-
CLIENT_LIBS_TEST_IMAGE ?= redislabs/client-libs-test:8.4-RC1-pre
5+
CLIENT_LIBS_TEST_IMAGE ?= redislabs/client-libs-test:8.4-RC1-pre.2
66

77
docker.start:
88
export RE_CLUSTER=$(RE_CLUSTER) && \

acl_commands.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ type ACLCmdable interface {
88
ACLLog(ctx context.Context, count int64) *ACLLogCmd
99
ACLLogReset(ctx context.Context) *StatusCmd
1010

11+
ACLGenPass(ctx context.Context, bit int) *StringCmd
12+
1113
ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd
1214
ACLDelUser(ctx context.Context, username string) *IntCmd
15+
ACLUsers(ctx context.Context) *StringSliceCmd
16+
ACLWhoAmI(ctx context.Context) *StringCmd
1317
ACLList(ctx context.Context) *StringSliceCmd
1418

1519
ACLCat(ctx context.Context) *StringSliceCmd
@@ -65,6 +69,24 @@ func (c cmdable) ACLSetUser(ctx context.Context, username string, rules ...strin
6569
return cmd
6670
}
6771

72+
func (c cmdable) ACLGenPass(ctx context.Context, bit int) *StringCmd {
73+
cmd := NewStringCmd(ctx, "acl", "genpass")
74+
_ = c(ctx, cmd)
75+
return cmd
76+
}
77+
78+
func (c cmdable) ACLUsers(ctx context.Context) *StringSliceCmd {
79+
cmd := NewStringSliceCmd(ctx, "acl", "users")
80+
_ = c(ctx, cmd)
81+
return cmd
82+
}
83+
84+
func (c cmdable) ACLWhoAmI(ctx context.Context) *StringCmd {
85+
cmd := NewStringCmd(ctx, "acl", "whoami")
86+
_ = c(ctx, cmd)
87+
return cmd
88+
}
89+
6890
func (c cmdable) ACLList(ctx context.Context) *StringSliceCmd {
6991
cmd := NewStringSliceCmd(ctx, "acl", "list")
7092
_ = c(ctx, cmd)

acl_commands_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ var _ = Describe("ACL user commands", Label("NonRedisEnterprise"), func() {
9292
Expect(err).NotTo(HaveOccurred())
9393
Expect(res).To(HaveLen(1))
9494
Expect(res[0]).To(ContainSubstring("default"))
95+
96+
res, err = client.ACLUsers(ctx).Result()
97+
Expect(err).NotTo(HaveOccurred())
98+
Expect(res).To(HaveLen(1))
99+
Expect(res[0]).To(Equal("default"))
100+
101+
res1, err := client.ACLWhoAmI(ctx).Result()
102+
Expect(err).NotTo(HaveOccurred())
103+
Expect(res1).To(Equal("default"))
104+
})
105+
106+
It("gen password", func() {
107+
password, err := client.ACLGenPass(ctx, 0).Result()
108+
Expect(err).NotTo(HaveOccurred())
109+
Expect(password).NotTo(BeEmpty())
95110
})
96111

97112
It("setuser and deluser", func() {

command.go

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,12 @@ func (cmd *StringStructMapCmd) Clone() Cmder {
19371937
type XMessage struct {
19381938
ID string
19391939
Values map[string]interface{}
1940+
// MillisElapsedFromDelivery is the number of milliseconds since the entry was last delivered.
1941+
// Only populated when using XREADGROUP with CLAIM argument for claimed entries.
1942+
MillisElapsedFromDelivery int64
1943+
// DeliveredCount is the number of times the entry was delivered.
1944+
// Only populated when using XREADGROUP with CLAIM argument for claimed entries.
1945+
DeliveredCount int64
19401946
}
19411947

19421948
type XMessageSliceCmd struct {
@@ -2016,10 +2022,16 @@ func readXMessageSlice(rd *proto.Reader) ([]XMessage, error) {
20162022
}
20172023

20182024
func readXMessage(rd *proto.Reader) (XMessage, error) {
2019-
if err := rd.ReadFixedArrayLen(2); err != nil {
2025+
// Read array length can be 2 or 4 (with CLAIM metadata)
2026+
n, err := rd.ReadArrayLen()
2027+
if err != nil {
20202028
return XMessage{}, err
20212029
}
20222030

2031+
if n != 2 && n != 4 {
2032+
return XMessage{}, fmt.Errorf("redis: got %d elements in the XMessage array, expected 2 or 4", n)
2033+
}
2034+
20232035
id, err := rd.ReadString()
20242036
if err != nil {
20252037
return XMessage{}, err
@@ -2032,10 +2044,24 @@ func readXMessage(rd *proto.Reader) (XMessage, error) {
20322044
}
20332045
}
20342046

2035-
return XMessage{
2047+
msg := XMessage{
20362048
ID: id,
20372049
Values: v,
2038-
}, nil
2050+
}
2051+
2052+
if n == 4 {
2053+
msg.MillisElapsedFromDelivery, err = rd.ReadInt()
2054+
if err != nil {
2055+
return XMessage{}, err
2056+
}
2057+
2058+
msg.DeliveredCount, err = rd.ReadInt()
2059+
if err != nil {
2060+
return XMessage{}, err
2061+
}
2062+
}
2063+
2064+
return msg, nil
20392065
}
20402066

20412067
func stringInterfaceMapParser(rd *proto.Reader) (map[string]interface{}, error) {

0 commit comments

Comments
 (0)