Просмотр исходного кода

raft: remove sync

We don't need SyncNode. We only care about things that have made it
through the store. We can do this there.
Blake Mizerany 11 лет назад
Родитель
Сommit
8d37587e47
1 измененных файлов с 0 добавлено и 41 удалено
  1. 0 41
      raft2/sync.go

+ 0 - 41
raft2/sync.go

@@ -1,41 +0,0 @@
-package raft
-
-import (
-	"code.google.com/p/go.net/context"
-	"github.com/coreos/etcd/wait"
-)
-
-type SyncNode struct {
-	n *Node
-	w wait.WaitList
-}
-
-func NewSyncNode(n *Node) *SyncNode { panic("not implemented") }
-
-type waitResp struct {
-	e   Entry
-	err error
-}
-
-func (n *SyncNode) Propose(ctx context.Context, id int64, data []byte) (Entry, error) {
-	ch := n.w.Register(id)
-	n.n.Propose(id, data)
-	select {
-	case x := <-ch:
-		wr := x.(waitResp)
-		return wr.e, wr.err
-	case <-ctx.Done():
-		n.w.Trigger(id, nil) // GC the Wait
-		return Entry{}, ctx.Err()
-	}
-}
-
-func (n *SyncNode) ReadState() (State, []Entry, []Message, error) {
-	st, ents, msgs, err := n.n.ReadState()
-	for _, e := range ents {
-		if e.Index >= st.CommitIndex {
-			n.w.Trigger(e.Id, waitResp{e: e, err: nil})
-		}
-	}
-	return st, ents, msgs, err
-}