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

Method isSlotLocked

pkg/topom/context.go:63–79  ·  view source on GitHub ↗
(m *models.SlotMapping)

Source from the content-addressed store, hash-verified

61}
62
63func (ctx *context) isSlotLocked(m *models.SlotMapping) bool {
64 switch m.Action.State {
65 case models.ActionNothing, models.ActionPending:
66 return ctx.isGroupLocked(m.GroupId)
67 case models.ActionPreparing:
68 return ctx.isGroupLocked(m.GroupId)
69 case models.ActionPrepared:
70 return true
71 case models.ActionMigrating:
72 return ctx.isGroupLocked(m.GroupId) || ctx.isGroupLocked(m.Action.TargetId)
73 case models.ActionFinished:
74 return ctx.isGroupLocked(m.Action.TargetId)
75 default:
76 log.Panicf("slot-[%d] action state is invalid:\n%s", m.Id, m.Encode())
77 }
78 return false
79}
80
81func (ctx *context) toSlot(m *models.SlotMapping, p *models.Proxy) *models.Slot {
82 slot := &models.Slot{

Callers 1

toSlotMethod · 0.95

Calls 3

isGroupLockedMethod · 0.95
PanicfMethod · 0.80
EncodeMethod · 0.45

Tested by

no test coverage detected