MCPcopy Create free account
hub / github.com/dadgar/onecache / parse

Method parse

onecache/memcache_handlers.go:192–228  ·  view source on GitHub ↗
(flags []string)

Source from the content-addressed store, hash-verified

190}
191
192func (h *addHandler) parse(flags []string) error {
193 l := len(flags)
194 if l != 4 && l != 5 {
195 return fmt.Errorf("received an unexpected number of flags (%d); expect %v", l, expectedSetInput)
196 }
197
198 h.args.Key = flags[0]
199
200 flag, err := strconv.ParseInt(flags[1], 10, 32)
201 if err != nil {
202 return fmt.Errorf("could not parse flag field: %v", err)
203 }
204 h.args.Flags = int32(flag)
205
206 exp, err := strconv.ParseInt(flags[2], 10, 32)
207 if err != nil {
208 return fmt.Errorf("could not parse expiration field: %v", err)
209 return err
210 }
211 h.args.Exp = convertMemcacheExpToUnix(int32(exp))
212
213 bytes, err := strconv.ParseInt(flags[3], 10, 64)
214 if err != nil {
215 return fmt.Errorf("could not parse bytes field: %v", err)
216 }
217 h.size = bytes
218
219 if l == 5 {
220 if flags[4] != noreply {
221 return fmt.Errorf("was expecting %v; got %v", noreply, flags[4])
222 }
223
224 h.noReply = true
225 }
226
227 return nil
228}
229
230func (h *addHandler) readBytes() int64 {
231 return h.size

Callers

nothing calls this directly

Calls 1

convertMemcacheExpToUnixFunction · 0.85

Tested by

no test coverage detected