diff --git a/storage/consistent_watchable_store.go b/storage/consistent_watchable_store.go index aedc55341..ced58a1d4 100644 --- a/storage/consistent_watchable_store.go +++ b/storage/consistent_watchable_store.go @@ -26,8 +26,8 @@ var ( // ConsistentIndexGetter is an interface that wraps the Get method. // Consistent index is the offset of an entry in a consistent replicated log. type ConsistentIndexGetter interface { - // Get gets the consistent index of current executing entry. - Get() uint64 + // ConsistentIndex returns the consistent index of current executing entry. + ConsistentIndex() uint64 } type consistentWatchableStore struct { @@ -80,7 +80,7 @@ func (s *consistentWatchableStore) TxnBegin() int64 { // TODO: avoid this unnecessary allocation bs := make([]byte, 8) - binary.BigEndian.PutUint64(bs, s.ig.Get()) + binary.BigEndian.PutUint64(bs, s.ig.ConsistentIndex()) // put the index into the underlying backend // tx has been locked in TxnBegin, so there is no need to lock it again s.watchableStore.store.tx.UnsafePut(metaBucketName, consistentIndexKeyName, bs) diff --git a/storage/kv_test.go b/storage/kv_test.go index fc99923c3..952be988a 100644 --- a/storage/kv_test.go +++ b/storage/kv_test.go @@ -821,7 +821,7 @@ func TestWatchableKVWatch(t *testing.T) { type indexVal uint64 -func (v *indexVal) Get() uint64 { return uint64(*v) } +func (v *indexVal) ConsistentIndex() uint64 { return uint64(*v) } func TestConsistentWatchableKVConsistentIndex(t *testing.T) { var idx indexVal