Browse Source

raft: describe the purpose of lockedRand

Struct lockedRand wraps rand.Rand with mutex lock because it's
accessed by multiple raft groups.
lorneli 7 years ago
parent
commit
a083282482
1 changed files with 2 additions and 2 deletions
  1. 2 2
      raft/raft.go

+ 2 - 2
raft/raft.go

@@ -72,8 +72,8 @@ const (
 var ErrProposalDropped = errors.New("raft proposal dropped")
 var ErrProposalDropped = errors.New("raft proposal dropped")
 
 
 // lockedRand is a small wrapper around rand.Rand to provide
 // 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 {
 type lockedRand struct {
 	mu   sync.Mutex
 	mu   sync.Mutex
 	rand *rand.Rand
 	rand *rand.Rand