// 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 }
// 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 }
// 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() // TODO(tschottdorf): It's dangerous to inject timestamps (which will make // it into the HLC) like that. tc.lowWater.WallTime += clock.MaxOffset().Nanoseconds() tc.latest = tc.lowWater }
// 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()) }
// 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()) }