storage: Get -> ConsistentIndex in ConsistentIndexGetter

To make the method name more specific in the context.
This commit is contained in:
Yicheng Qin 2015-10-23 15:45:40 -07:00
parent cacc0d6432
commit 41cb39b68a
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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