-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
44 lines (35 loc) · 1.15 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package core
import "time"
/************
** Config **
************/
// Config contains the configuration of the raft algorithm
var Config = struct {
SchedulerNodeCount uint32
WorkerNodeCount uint32
ChannelBufferSize uint32
// NodeChannelMap contains all the channels used by the nodes to communicate with each other
NodeSpeedList []time.Duration
// NodeSpeedList contains the speed of each node to simulate different hardware
NodeChannelMap map[NodeType][]*ChannelContainer
// TIMEOUTS
// Range of time to wait for a leader heartbeat or granting vote to candidate
MinElectionTimeout time.Duration
MaxElectionTimeout time.Duration
MaxFindLeaderTimeout time.Duration
// INTERVALS
// Repeat interval for leader after it has sent out heartbeat
IsAliveNotificationInterval time.Duration
// RETRY
MaxRetryToFindLeader uint32
}{
SchedulerNodeCount: 5,
WorkerNodeCount: 2,
ChannelBufferSize: 100,
NodeChannelMap: nil,
MinElectionTimeout: 150 * time.Millisecond,
MaxElectionTimeout: 300 * time.Millisecond,
MaxFindLeaderTimeout: 300 * time.Millisecond,
IsAliveNotificationInterval: 50 * time.Millisecond,
MaxRetryToFindLeader: 3,
}