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

Method parse

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

Source from the content-addressed store, hash-verified

56}
57
58func (h *setHandler) parse(flags []string) error {
59 l := len(flags)
60 if l != 4 && l != 5 {
61 return fmt.Errorf("received an unexpected number of flags (%d); expect %v", l, expectedSetInput)
62 }
63
64 h.args.Key = flags[0]
65
66 flag, err := strconv.ParseInt(flags[1], 10, 32)
67 if err != nil {
68 return fmt.Errorf("could not parse flag field: %v", err)
69 }
70 h.args.Flags = int32(flag)
71
72 exp, err := strconv.ParseInt(flags[2], 10, 32)
73 if err != nil {
74 return fmt.Errorf("could not parse expiration field: %v", err)
75 return err
76 }
77 h.args.Exp = convertMemcacheExpToUnix(int32(exp))
78
79 bytes, err := strconv.ParseInt(flags[3], 10, 64)
80 if err != nil {
81 return fmt.Errorf("could not parse bytes field: %v", err)
82 }
83 h.size = bytes
84
85 if l == 5 {
86 if flags[4] != noreply {
87 return fmt.Errorf("was expecting %v; got %v", noreply, flags[4])
88 }
89
90 h.noReply = true
91 }
92
93 return nil
94}
95
96func (h *setHandler) readBytes() int64 {
97 return h.size

Callers

nothing calls this directly

Calls 1

convertMemcacheExpToUnixFunction · 0.85

Tested by

no test coverage detected