Skip to content

Commit

Permalink
feat: add rule transition
Browse files Browse the repository at this point in the history
  • Loading branch information
earayu committed Dec 28, 2023
1 parent ef8ccb5 commit 464a913
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions go/vt/vttablet/tabletserver/role/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,29 @@ var (

const LORRY_HTTP_PORT_ENV_NAME = "LORRY_HTTP_PORT"

const Leader = "Leader"
const Candidate = "Candidate"
const Follower = "Follower"
const Learner = "Learner"
const Logger = "Logger"
const (
PRIMARY = "primary"
SECONDARY = "secondary"
MASTER = "master"
SLAVE = "slave"
LEADER = "Leader"
FOLLOWER = "Follower"
LEARNER = "Learner"
CANDIDATE = "Candidate"
LOGGER = "Logger"
)

func transitionRoleType(role string) topodatapb.TabletType {
switch role {
case Leader:
case LEADER, PRIMARY, MASTER:
return topodatapb.TabletType_PRIMARY
case Follower:
case FOLLOWER, SECONDARY, SLAVE:
return topodatapb.TabletType_REPLICA
case Candidate:
case CANDIDATE:
return topodatapb.TabletType_REPLICA
case Learner:
case LEARNER:
return topodatapb.TabletType_RDONLY
case Logger:
case LOGGER:
return topodatapb.TabletType_SPARE
default:
return topodatapb.TabletType_UNKNOWN
Expand Down

0 comments on commit 464a913

Please sign in to comment.