|
|
@ -33,8 +33,6 @@ type State struct { |
|
|
|
// view changing id is used during view change mode
|
|
|
|
// view changing id is used during view change mode
|
|
|
|
// it is the next view id
|
|
|
|
// it is the next view id
|
|
|
|
viewChangingID uint64 |
|
|
|
viewChangingID uint64 |
|
|
|
|
|
|
|
|
|
|
|
isBackup bool |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Mode return the current node mode
|
|
|
|
// Mode return the current node mode
|
|
|
@ -44,10 +42,6 @@ func (pm *State) Mode() Mode { |
|
|
|
|
|
|
|
|
|
|
|
// SetMode set the node mode as required
|
|
|
|
// SetMode set the node mode as required
|
|
|
|
func (pm *State) SetMode(s Mode) { |
|
|
|
func (pm *State) SetMode(s Mode) { |
|
|
|
if s == Normal && pm.isBackup { |
|
|
|
|
|
|
|
s = NormalBackup |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pm.mode = s |
|
|
|
pm.mode = s |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -81,10 +75,6 @@ func (pm *State) GetViewChangeDuraion() time.Duration { |
|
|
|
return time.Duration(diff * diff * int64(viewChangeDuration)) |
|
|
|
return time.Duration(diff * diff * int64(viewChangeDuration)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (pm *State) SetIsBackup(isBackup bool) { |
|
|
|
|
|
|
|
pm.isBackup = isBackup |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fallbackNextViewID return the next view ID and duration when there is an exception
|
|
|
|
// fallbackNextViewID return the next view ID and duration when there is an exception
|
|
|
|
// to calculate the time-based viewId
|
|
|
|
// to calculate the time-based viewId
|
|
|
|
func (consensus *Consensus) fallbackNextViewID() (uint64, time.Duration) { |
|
|
|
func (consensus *Consensus) fallbackNextViewID() (uint64, time.Duration) { |
|
|
|