MCPcopy Index your code
hub / github.com/CodisLabs/codis / handleSelect

Method handleSelect

pkg/proxy/session.go:332–347  ·  view source on GitHub ↗
(r *Request)

Source from the content-addressed store, hash-verified

330}
331
332func (s *Session) handleSelect(r *Request) error {
333 if len(r.Multi) != 2 {
334 r.Resp = redis.NewErrorf("ERR wrong number of arguments for 'SELECT' command")
335 return nil
336 }
337 switch db, err := strconv.Atoi(string(r.Multi[1].Value)); {
338 case err != nil:
339 r.Resp = redis.NewErrorf("ERR invalid DB index")
340 case db < 0 || db >= int(s.config.BackendNumberDatabases):
341 r.Resp = redis.NewErrorf("ERR invalid DB index, only accept DB [0,%d)", s.config.BackendNumberDatabases)
342 default:
343 r.Resp = RespOK
344 s.database = int32(db)
345 }
346 return nil
347}
348
349func (s *Session) handleRequestPing(r *Request, d *Router) error {
350 var addr string

Callers 1

handleRequestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected