From 2f0169c3ab267032237fa41ec72317c25f3886bf Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 15 Jun 2015 10:22:38 -0700 Subject: [PATCH] raft: fix usage section of doc We recently added a config struct to start raft. Update our doc accordingly. --- raft/doc.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/raft/doc.go b/raft/doc.go index 7a5104abf..0009006fb 100644 --- a/raft/doc.go +++ b/raft/doc.go @@ -19,8 +19,16 @@ Usage The primary object in raft is a Node. You either start a Node from scratch using raft.StartNode or start a Node from some initial state using raft.RestartNode. - storage := raft.NewMemoryStorage() - n := raft.StartNode(0x01, []raft.Peer{{ID: 0x02}, {ID: 0x03}}, 3, 1, storage) + storage := raft.NewMemoryStorage() + c := &Config{ + ID: 0x01, + ElectionTick: 10, + HeartbeatTick: 1, + Storage: storage, + MaxSizePerMsg: 4096, + MaxInflightMsgs: 256, + } + n := raft.StartNode(c, []raft.Peer{{ID: 0x02}, {ID: 0x03}}) Now that you are holding onto a Node you have a few responsibilities: