本文整理汇总了Golang中github.com/cockroachdb/cockroach/util/hlc.Clock.MaxOffset方法的典型用法代码示例。如果您正苦于以下问题:Golang Clock.MaxOffset方法的具体用法?Golang Clock.MaxOffset怎么用?Golang Clock.MaxOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cockroachdb/cockroach/util/hlc.Clock
的用法示例。
在下文中一共展示了Clock.MaxOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newTxn
// newTxn begins a transaction. For testing purposes, this comes with a ID
// pre-initialized, but with the Writing flag set to false.
func newTxn(clock *hlc.Clock, baseKey proto.Key) *proto.Transaction {
f, l, fun := caller.Lookup(1)
name := fmt.Sprintf("%s:%d %s", f, l, fun)
txn := proto.NewTransaction("test", baseKey, 1, proto.SERIALIZABLE, clock.Now(), clock.MaxOffset().Nanoseconds())
txn.Name = name
return txn
}
示例2: Clear
// Clear clears the cache and resets the low water mark to the
// current time plus the maximum clock offset.
func (tc *TimestampCache) Clear(clock *hlc.Clock) {
tc.rCache.Clear()
tc.wCache.Clear()
tc.lowWater = clock.Now()
tc.lowWater.WallTime += clock.MaxOffset().Nanoseconds()
tc.latest = tc.lowWater
}
示例3: newTxn
// newTxn begins a transaction.
func newTxn(clock *hlc.Clock, baseKey proto.Key) *proto.Transaction {
return proto.NewTransaction("test", baseKey, 1, proto.SERIALIZABLE, clock.Now(), clock.MaxOffset().Nanoseconds())
}
示例4: LeaseExpiration
// 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.ctx.rangeLeaseActiveDuration+clock.MaxOffset())
}