コード例 #1
0
ファイル: helpers_test.go プロジェクト: hvaara/cockroach
// LeaseExpiration returns an int64 to increment a manual clock with to
// make sure that all active range leases expire.
func (s *Store) LeaseExpiration(clock *hlc.Clock) int64 {
	// Due to lease extensions, the remaining interval can be longer than just
	// the sum of the offset (=length of stasis period) and the active
	// duration, but definitely not by 2x.
	return 2 * int64(s.cfg.RangeLeaseActiveDuration+clock.MaxOffset())
}
コード例 #2
0
ファイル: node_liveness.go プロジェクト: knz/cockroach
func (l *Liveness) isLive(clock *hlc.Clock) bool {
	expiration := l.Expiration.Add(-int64(clock.MaxOffset()), 0)
	return clock.Now().Less(expiration)
}