zhangzengfei
2021-11-12 d7485b186f72742ee0a1bf34e7fc818b53f20870
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()
}