bump(github.com/benbjohnson/go-raft): d46748244f1f1830a002b8f645342426c5d73e81
This commit is contained in:
28
third_party/github.com/benbjohnson/go-raft/join_command.go
vendored
Normal file
28
third_party/github.com/benbjohnson/go-raft/join_command.go
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
package raft
|
||||
|
||||
// Join command interface
|
||||
type JoinCommand interface {
|
||||
CommandName() string
|
||||
Apply(server *Server) (interface{}, error)
|
||||
NodeName() string
|
||||
}
|
||||
|
||||
// Join command
|
||||
type DefaultJoinCommand struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// The name of the Join command in the log
|
||||
func (c *DefaultJoinCommand) CommandName() string {
|
||||
return "raft:join"
|
||||
}
|
||||
|
||||
func (c *DefaultJoinCommand) Apply(server *Server) (interface{}, error) {
|
||||
err := server.AddPeer(c.Name)
|
||||
|
||||
return []byte("join"), err
|
||||
}
|
||||
|
||||
func (c *DefaultJoinCommand) NodeName() string {
|
||||
return c.Name
|
||||
}
|
Reference in New Issue
Block a user