etcd/store/v2/sync_command.go
2013-11-22 08:59:24 -08:00

29 lines
479 B
Go

package v2
import (
"time"
"github.com/coreos/etcd/store"
"github.com/coreos/raft"
)
func init() {
raft.RegisterCommand(&SyncCommand{})
}
type SyncCommand struct {
Time time.Time `json:"time"`
}
// The name of the Sync command in the log
func (c SyncCommand) CommandName() string {
return "etcd:sync"
}
func (c SyncCommand) Apply(server raft.Server) (interface{}, error) {
s, _ := server.StateMachine().(store.Store)
s.DeleteExpiredKeys(c.Time)
return nil, nil
}