liuxiaolong
2020-11-18 911e6eb6a1a1ab5dd979a1917b79a5465da88181
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()
}