-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
timer: move Timer inteface to
dbft
package
Store Timer interface along with other dBFT interfaces and provide default timer implementation in `timer` package. A part of #84. Signed-off-by: Anna Shaleva <[email protected]>
- Loading branch information
1 parent
2e3645e
commit d26fc83
Showing
4 changed files
with
46 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package dbft | ||
|
||
import ( | ||
"time" | ||
|
||
timer2 "github.com/nspcc-dev/dbft/timer" | ||
) | ||
|
||
// Timer is an interface which implements all time-related | ||
// functions. It can be mocked for testing. | ||
type Timer interface { | ||
// Now returns current time. | ||
Now() time.Time | ||
// Reset | ||
Reset(s timer2.HV, d time.Duration) | ||
// Sleep stops execution for duration d. | ||
Sleep(d time.Duration) | ||
// Extend extends current timer with duration d. | ||
Extend(d time.Duration) | ||
// Stop stops timer. | ||
Stop() | ||
// HV returns current height and view set for the timer. | ||
HV() timer2.HV | ||
// C returns channel for timer events. | ||
C() <-chan time.Time | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters