MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / validate

Method validate

server/api/raft.go:50–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48}
49
50func (r *MemberRequest) validate() error {
51 r.Operation = strings.ToLower(r.Operation)
52 if r.Operation != OperationAdd && r.Operation != OperationRemove {
53 return fmt.Errorf("operation must be one of [%s]",
54 strings.Join([]string{OperationAdd, OperationRemove}, ","))
55 }
56 if r.Operation == OperationAdd && r.Peer == "" {
57 return fmt.Errorf("peer should NOT be empty")
58 }
59 return nil
60}
61
62func (handler *RaftHandler) ListPeers(c *gin.Context) {
63 raftNode, _ := c.MustGet(consts.ContextKeyRaftNode).(*raft.Node)

Callers 1

UpdatePeerMethod · 0.95

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected