One constraint: we are not able to sync time. So we just do best effort.
##Solution: ###Changes in raft
- Add a sync command in raft
type SyncCommand struct {
Time time.Time `json:"time"`| package main | |
| import ( | |
| "fmt" | |
| "github.com/boltdb/bolt" | |
| ) | |
| func main() { | |
| iterateBucket("db", "key") |
| // raft implements the raft protocol | |
| type raft interface { | |
| step(m Message) | |
| messages() []Message | |
| proposal(data []byte) | |
| applyPeerAdd(pi PeerInfo) // or using step through messaging? | |
| applyPeerRemove(pi PeerInfo) // or using step through messaging? | |
| } | |
| // a log interface used by raft pkg. |
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { | |
| tr := &http.Transport{ |