| | |
| | | package boltcache |
| | | |
| | | import "strconv" |
| | | |
| | | //添加一条日志 |
| | | func (ls *LogStore) ApplyLog(logData []byte) { |
| | | lastLogIndex := ls.getLastLog() |
| | |
| | | return nil |
| | | } |
| | | |
| | | // 遍历数据, 输出原始数据 |
| | | func (ls *LogStore) ForEach(f func(v []byte) error) { |
| | | ls.store.ForEach(f) |
| | | } |
| | | |
| | | func (ls *LogStore) Size() int { |
| | | start, _ := ls.store.FirstIndex(confBucket) |
| | | end, _ := ls.store.LastIndex(confBucket) |
| | | |
| | | totalSize := 0 |
| | | |
| | | for ; start <= end; start++ { |
| | | bucketName := bucketPre + strconv.Itoa(int(start)) |
| | | bucketSize, err := ls.store.Size(bucketName) |
| | | if err == nil { |
| | | totalSize = totalSize + bucketSize |
| | | } |
| | | } |
| | | |
| | | return totalSize |
| | | } |
| | | |
| | | //提供给外层使用,删除日志 |
| | | func (ls *LogStore) Delete(lc *LogCon) error { |
| | | return ls.store.Delete(lc) |