zhangzengfei
2022-10-18 78b58d3fc68f7ede33f0bc681b7914bc2b29cc82
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()
}