From a0832824822168774ba9649b8bdb383daf5f8a36 Mon Sep 17 00:00:00 2001 From: lorneli Date: Wed, 2 May 2018 22:02:45 +0800 Subject: [PATCH] raft: describe the purpose of lockedRand Struct lockedRand wraps rand.Rand with mutex lock because it's accessed by multiple raft groups. --- raft/raft.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/raft/raft.go b/raft/raft.go index 92857beb1..9a2d52b98 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -72,8 +72,8 @@ const ( var ErrProposalDropped = errors.New("raft proposal dropped") // lockedRand is a small wrapper around rand.Rand to provide -// synchronization. Only the methods needed by the code are exposed -// (e.g. Intn). +// synchronization among multiple raft groups. Only the methods needed +// by the code are exposed (e.g. Intn). type lockedRand struct { mu sync.Mutex rand *rand.Rand