liuxiaolong
2020-11-18 15c091bccbe9ee6e5e72dc93d413a2b67c13579c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package boltcache
 
import "sync"
 
type storeState struct {
    lastLock sync.Mutex
    lastLogIndex   uint64
}
 
func (s *storeState) getLastLog() (index uint64) {
    s.lastLock.Lock()
    index = s.lastLogIndex
    s.lastLock.Unlock()
    return
}
 
func (s *storeState) setLastLog(index uint64) {
    s.lastLock.Lock()
    s.lastLogIndex = index
    s.lastLock.Unlock()
}