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

Method BackendConn

pkg/proxy/backend.go:461–487  ·  view source on GitHub ↗
(database int32, seed uint, must bool)

Source from the content-addressed store, hash-verified

459}
460
461func (s *sharedBackendConn) BackendConn(database int32, seed uint, must bool) *BackendConn {
462 if s == nil {
463 return nil
464 }
465
466 if s.single != nil {
467 bc := s.single[database]
468 if must || bc.IsConnected() {
469 return bc
470 }
471 return nil
472 }
473
474 var parallel = s.conns[database]
475
476 var i = seed
477 for range parallel {
478 i = (i + 1) % uint(len(parallel))
479 if bc := parallel[i]; bc.IsConnected() {
480 return bc
481 }
482 }
483 if !must {
484 return nil
485 }
486 return parallel[0]
487}
488
489type sharedBackendConnPool struct {
490 config *Config

Callers 4

dispatchAddrMethod · 0.80
slotsmgrtMethod · 0.80
slotsmgrtExecWrapperMethod · 0.80
forward2Method · 0.80

Calls 1

IsConnectedMethod · 0.80

Tested by

no test coverage detected