mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
storage: Get -> ConsistentIndex in ConsistentIndexGetter
To make the method name more specific in the context.
This commit is contained in:
parent
cacc0d6432
commit
41cb39b68a
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user