Documentation ¶
Index ¶
Constants ¶
View Source
const ( // MaxAllowedTimer is the maximum allowed timer duration in the system // exported for integration tests MaxAllowedTimer = 100 * 365 * 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func ValidateAndCapTimer ¶ added in v1.23.0
func ValidateAndCapTimer(delay *durationpb.Duration) error
TODO: remove this logic, rely on scheduled task dropping logic in mutableState for long duration timers
Types ¶
type Gate ¶
type Gate interface { // FireCh return the channel which will be fired when time is up FireCh() <-chan struct{} // FireAfter check will the timer get fired after a certain time FireAfter(now time.Time) bool // Update the timer gate, return true if update is a success. // Success means timer is idle or timer is set with a sooner time to fire Update(nextTime time.Time) bool // Close shutdown the timer Close() }
Gate interface
type LocalGate ¶
type LocalGate interface { Gate }
func NewLocalGate ¶
func NewLocalGate(timeSource clock.TimeSource) LocalGate
NewLocalGate create a new timer gate instance
type LocalGateImpl ¶
type LocalGateImpl struct {
// contains filtered or unexported fields
}
func (*LocalGateImpl) FireAfter ¶
func (lg *LocalGateImpl) FireAfter(now time.Time) bool
FireAfter check will the timer get fired after a certain time
func (*LocalGateImpl) FireCh ¶ added in v1.21.0
func (lg *LocalGateImpl) FireCh() <-chan struct{}
FireCh return the channel which will be fired when time is up
type RemoteGate ¶
type RemoteGateImpl ¶
type RemoteGateImpl struct { // lock for timer and next wakeup time sync.Mutex // contains filtered or unexported fields }
func (*RemoteGateImpl) FireAfter ¶
func (rg *RemoteGateImpl) FireAfter(now time.Time) bool
FireAfter check will the timer get fired after a certain time
func (*RemoteGateImpl) FireCh ¶ added in v1.21.0
func (rg *RemoteGateImpl) FireCh() <-chan struct{}
FireCh return the channel which will be fired when time is up
func (*RemoteGateImpl) SetCurrentTime ¶
func (rg *RemoteGateImpl) SetCurrentTime(currentTime time.Time) bool
SetCurrentTime set the current time, and additionally fire the fire chan if new "current" time is after the next wake-up time, return true if "current" is actually updated
Click to show internal directories.
Click to hide internal directories.