Skip to content

Commit

Permalink
*: decouple operator handler and server (#7089)
Browse files Browse the repository at this point in the history
ref #5839

Signed-off-by: lhy1024 <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
lhy1024 and ti-chi-bot[bot] authored Sep 19, 2023
1 parent 559ea7f commit dff99fd
Show file tree
Hide file tree
Showing 11 changed files with 600 additions and 530 deletions.
30 changes: 30 additions & 0 deletions errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,36 @@ error = '''
TCP socks error
'''

["PD:operator:ErrAddOperator"]
error = '''
failed to add operator, maybe already have one
'''

["PD:operator:ErrOperatorNotFound"]
error = '''
operator not found
'''

["PD:operator:ErrPluginNotFound"]
error = '''
plugin is not found: %s
'''

["PD:operator:ErrRegionAbnormalPeer"]
error = '''
region %v has abnormal peer
'''

["PD:operator:ErrRegionNotAdjacent"]
error = '''
two regions are not adjacent
'''

["PD:operator:ErrRegionNotFound"]
error = '''
region %v not found
'''

["PD:os:ErrOSOpen"]
error = '''
open error
Expand Down
24 changes: 24 additions & 0 deletions pkg/errs/errno.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,30 @@ var (
ErrClientGetMinTSO = errors.Normalize("get min TSO failed, %v", errors.RFCCodeText("PD:client:ErrClientGetMinTSO"))
)

// operator errors
var (
// ErrOperatorNotFound is error info for operator not found.
ErrOperatorNotFound = errors.Normalize("operator not found", errors.RFCCodeText("PD:operator:ErrOperatorNotFound"))
// ErrAddOperator is error info for already have an operator when adding operator.
ErrAddOperator = errors.Normalize("failed to add operator, maybe already have one", errors.RFCCodeText("PD:operator:ErrAddOperator"))
)

// region errors
var (
// ErrRegionNotAdjacent is error info for region not adjacent.
ErrRegionNotAdjacent = errors.Normalize("two regions are not adjacent", errors.RFCCodeText("PD:operator:ErrRegionNotAdjacent"))
// ErrRegionNotFound is error info for region not found.
ErrRegionNotFound = errors.Normalize("region %v not found", errors.RFCCodeText("PD:operator:ErrRegionNotFound"))
// ErrRegionAbnormalPeer is error info for region has abnormal peer.
ErrRegionAbnormalPeer = errors.Normalize("region %v has abnormal peer", errors.RFCCodeText("PD:operator:ErrRegionAbnormalPeer"))
)

// plugin errors
var (
// ErrPluginNotFound is error info for plugin not found.
ErrPluginNotFound = errors.Normalize("plugin is not found: %s", errors.RFCCodeText("PD:operator:ErrPluginNotFound"))
)

// schedule errors
var (
ErrUnexpectedOperatorStatus = errors.Normalize("operator with unexpected status", errors.RFCCodeText("PD:schedule:ErrUnexpectedOperatorStatus"))
Expand Down
Loading

0 comments on commit dff99fd

Please sign in to comment.