Refactor commands.

This commit is contained in:
Ben Johnson
2013-10-11 01:02:38 -06:00
parent 594c2cab47
commit 89334df5ae
25 changed files with 886 additions and 820 deletions

19
command/command.go Normal file
View File

@ -0,0 +1,19 @@
package command
import (
"github.com/coreos/go-raft"
)
// A command represents an action to be taken on the replicated state machine.
type Command interface {
CommandName() string
Apply(server *raft.Server) (interface{}, error)
}
// Registers commands to the Raft library.
func Register() {
raft.RegisterCommand(&DeleteCommand{})
raft.RegisterCommand(&TestAndSetCommand{})
raft.RegisterCommand(&CreateCommand{})
raft.RegisterCommand(&UpdateCommand{})
}