github.com/kula/etcd@v0.2.1-0.20131226070625-e96234382ac0/store/v2/sync_command.go (about)

     1  package v2
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/coreos/etcd/store"
     7  	"github.com/coreos/raft"
     8  )
     9  
    10  func init() {
    11  	raft.RegisterCommand(&SyncCommand{})
    12  }
    13  
    14  type SyncCommand struct {
    15  	Time time.Time `json:"time"`
    16  }
    17  
    18  // The name of the Sync command in the log
    19  func (c SyncCommand) CommandName() string {
    20  	return "etcd:sync"
    21  }
    22  
    23  func (c SyncCommand) Apply(server raft.Server) (interface{}, error) {
    24  	s, _ := server.StateMachine().(store.Store)
    25  	s.DeleteExpiredKeys(c.Time)
    26  
    27  	return nil, nil
    28  }