-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.go
76 lines (70 loc) · 3.21 KB
/
const.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) 2019 Meng Huang ([email protected])
// This package is licensed under a MIT license that can be found in the LICENSE file.
package raft
import (
"time"
)
const (
defaultStartWait = 3 * 1000 * time.Millisecond
defaultNodeTick = time.Millisecond * 100
defaultUpdateTick = time.Millisecond * 100
defaultNodeTracePrintTick = 1000 * time.Millisecond
defaultHeartbeatTick = 100 * time.Millisecond
defaultDetectTick = 100 * time.Millisecond
defaultKeepAliveTick = 10 * 1000 * time.Millisecond
defaultCheckLogTick = time.Second
defaultElectionTimeout = 1000 * time.Millisecond
defaultHearbeatTimeout = 100 * time.Millisecond
defaultRequestVoteTimeout = 1000 * time.Millisecond
defaultAppendEntriesTimeout = 60 * 1000 * time.Millisecond
defaultInstallSnapshotTimeout = 60 * 1000 * time.Millisecond
defaultGetLeaderTimeout = 60 * 1000 * time.Millisecond
defaultAddMemberTimeout = 60 * 1000 * time.Millisecond
defaultRemoveMemberTimeout = 60 * 1000 * time.Millisecond
defaultSetMetaTimeout = 60 * 1000 * time.Millisecond
defaultGetMetaTimeout = 60 * 1000 * time.Millisecond
defaultCommandTimeout = 60 * 1000 * time.Millisecond
defaultMatchTimeout = 60 * 1000 * time.Millisecond
defaultMaxBatch = 32 * 1024
defaultMaxCache = 32 * 1024
defaultTarTick = time.Second
defaultMaxDelay = time.Millisecond
defaultDataDir = "default.raft"
defaultConfig = "config"
defaultCommitIndex = "commitindex"
defaultSnapshot = "snapshot"
defaultLastIncludedIndex = "lastincludedindex"
defaultLastIncludedTerm = "lastincludedterm"
defaultLastTarIndex = "lasttarindex"
defaultTar = "tar"
defaultTarGz = "tar.gz"
defaultTmp = ".tmp"
defaultFlush = ".flush"
defaultChunkSize int64 = 1 << 24
)
// SnapshotPolicy represents a snapshot policy type.
type SnapshotPolicy int
const (
// Never is a SnapshotPolicy that will never sync the snapshot to the disk.
Never SnapshotPolicy = 0
// EverySecond is a SnapshotPolicy that will sync the snapshot to the disk every second.
EverySecond SnapshotPolicy = 1
// EveryMinute is a SnapshotPolicy that will sync the snapshot to the disk every minute.
EveryMinute SnapshotPolicy = 2
// EveryHour is a SnapshotPolicy that will sync the snapshot to the disk every hour.
EveryHour SnapshotPolicy = 3
// EveryDay is a SnapshotPolicy that will sync the snapshot to the disk every day.
EveryDay SnapshotPolicy = 4
// DefalutSync is a defalut SnapshotPolicy.
DefalutSync SnapshotPolicy = 5
// CustomSync is a custom SnapshotPolicy.
CustomSync SnapshotPolicy = 6
)
const (
secondsSaveSnapshot1 = 900
changesSaveSnapshot1 = 1
secondsSaveSnapshot2 = 300
changesSaveSnapshot2 = 10
secondsSaveSnapshot3 = 60
changesSaveSnapshot3 = 10000
)