Exemplo n.º 1
0
Arquivo: node.go Projeto: algoadv/etcd
func startNode(id uint64, peers []raft.Peer, iface iface) *node {
	st := raft.NewMemoryStorage()
	c := &raft.Config{
		ID:              id,
		ElectionTick:    10,
		HeartbeatTick:   1,
		Storage:         st,
		MaxSizePerMsg:   1024 * 1024,
		MaxInflightMsgs: 256,
	}
	rn := raft.StartNode(c, peers)
	n := &node{
		Node:    rn,
		id:      id,
		storage: st,
		iface:   iface,
		pausec:  make(chan bool),
	}
	n.start()
	return n
}
Exemplo n.º 2
0
func newRaftStorage() *raftStorage {
	return &raftStorage{
		MemoryStorage: raft.NewMemoryStorage(),
	}
}