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

Method handleRequest

pkg/proxy/session.go:254–306  ·  view source on GitHub ↗
(r *Request, d *Router)

Source from the content-addressed store, hash-verified

252}
253
254func (s *Session) handleRequest(r *Request, d *Router) error {
255 opstr, flag, err := getOpInfo(r.Multi)
256 if err != nil {
257 return err
258 }
259 r.OpStr = opstr
260 r.OpFlag = flag
261 r.Broken = &s.broken
262
263 if flag.IsNotAllowed() {
264 return fmt.Errorf("command '%s' is not allowed", opstr)
265 }
266
267 switch opstr {
268 case "QUIT":
269 return s.handleQuit(r)
270 case "AUTH":
271 return s.handleAuth(r)
272 }
273
274 if !s.authorized {
275 if s.config.SessionAuth != "" {
276 r.Resp = redis.NewErrorf("NOAUTH Authentication required")
277 return nil
278 }
279 s.authorized = true
280 }
281
282 switch opstr {
283 case "SELECT":
284 return s.handleSelect(r)
285 case "PING":
286 return s.handleRequestPing(r, d)
287 case "INFO":
288 return s.handleRequestInfo(r, d)
289 case "MGET":
290 return s.handleRequestMGet(r, d)
291 case "MSET":
292 return s.handleRequestMSet(r, d)
293 case "DEL":
294 return s.handleRequestDel(r, d)
295 case "EXISTS":
296 return s.handleRequestExists(r, d)
297 case "SLOTSINFO":
298 return s.handleRequestSlotsInfo(r, d)
299 case "SLOTSSCAN":
300 return s.handleRequestSlotsScan(r, d)
301 case "SLOTSMAPPING":
302 return s.handleRequestSlotsMapping(r, d)
303 default:
304 return d.dispatch(r)
305 }
306}
307
308func (s *Session) handleQuit(r *Request) error {
309 s.quit = true

Callers 1

loopReaderMethod · 0.95

Calls 15

handleQuitMethod · 0.95
handleAuthMethod · 0.95
handleSelectMethod · 0.95
handleRequestPingMethod · 0.95
handleRequestInfoMethod · 0.95
handleRequestMGetMethod · 0.95
handleRequestMSetMethod · 0.95
handleRequestDelMethod · 0.95
handleRequestExistsMethod · 0.95

Tested by

no test coverage detected