MCPcopy
hub / github.com/CodisLabs/codis / Lpop

Method Lpop

extern/deprecated/redis-test/utils.go:349–373  ·  view source on GitHub ↗
(c *Conn)

Source from the content-addressed store, hash-verified

347}
348
349func (u *Unit) Lpop(c *Conn) {
350 var rsp interface{}
351 defer func() {
352 if x := recover(); x != nil {
353 Panic("lpop: c = %s, key = '%s', error = '%s', rsp = %v", c.Addr(), u.key, x, rsp)
354 }
355 }()
356 switch u.val.(type) {
357 default:
358 panic("not a string list")
359 case *list.List:
360 }
361 l := u.val.(*list.List)
362 if l.Len() == 0 {
363 panic("list is empty")
364 }
365 var err error
366 if rsp, err = c.Do("lpop", u.key); err != nil {
367 panic(err)
368 }
369 v := c.String(rsp)
370 if s := l.Remove(l.Front()).(string); s != v {
371 panic(fmt.Sprintf("return = %s, expect = %s", v, s))
372 }
373}
374
375func (u *Unit) Append(c *Conn, a string) {
376 var rsp interface{}

Callers 1

playerMethod · 0.80

Calls 5

PanicFunction · 0.70
AddrMethod · 0.45
LenMethod · 0.45
DoMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected