Skip to content

Commit e1bf35e

Browse files
committed
meta; parser updates for 'next' branch.
1 parent c5ffe37 commit e1bf35e

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

protocol.go

+3-15
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,16 @@ const (
9494
_ = iota
9595
McCHECK_ERROR // bodge. guessing these should all be in err...
9696
McVA
97-
McHD
97+
McOK
9898
McEN
9999
McME
100-
McST
101100
McNS
102101
McEX
103102
McNF
104-
McDE
105103
McMN
106104
McSE
107105
McER
108106
McCL
109-
McOK
110107
McHIT
111108
McMISS
112109
McSTORED
@@ -152,24 +149,19 @@ func (c *Client) ParseMetaResponse() (rflags []byte, value []byte, code McCode,
152149
}
153150
value = value[:size]
154151
code = McVA
155-
case "HD":
152+
case "OK":
156153
//parts := bytes.Split(line[:len(line)-2], []byte(" "))
157154
// Chop "HD " and rest are flags.
158-
// TODO: need to cut the \r\n off end as well?
159155
rflags = line[3 : len(line)-2]
160156
// No value to read, so we're done parsing the response.
161-
code = McHD
157+
code = McOK
162158
case "EN":
163159
// MetaGet miss
164160
code = McEN
165161
case "ME":
166162
// Meta Debug command
167163
value = line[3 : len(line)-2]
168164
code = McME
169-
case "ST":
170-
// Meta STORED
171-
rflags = line[3 : len(line)-2]
172-
code = McST
173165
case "NS":
174166
// Meta NOT_STORED
175167
rflags = line[3 : len(line)-2]
@@ -182,10 +174,6 @@ func (c *Client) ParseMetaResponse() (rflags []byte, value []byte, code McCode,
182174
// Meta NOT_FOUND (set or delete)
183175
rflags = line[3 : len(line)-2]
184176
code = McNF
185-
case "DE":
186-
// Meta deleted
187-
rflags = line[3 : len(line)-2]
188-
code = McDE
189177
case "MN":
190178
// Meta NOP (response flush marker)
191179
code = McMN

protocol_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestMeta(t *testing.T) {
2929
t.Fatalf("metaset error: %v", err)
3030
}
3131
_, _, c, err := mc.MetaReceive()
32-
if c != McST {
32+
if c != McOK {
3333
t.Fatalf("metaset not stored: %d", c)
3434
}
3535
}

0 commit comments

Comments
 (0)