fix master maintenance logic

Signed-off-by: Lei Liu <lei01.liu@horizon.ai>
This commit is contained in:
Lei Liu
2019-11-12 14:21:43 +08:00
parent ee90236a97
commit 46755ea1e1
8 changed files with 50 additions and 42 deletions

View File

@@ -17,14 +17,14 @@ type MemoryMappedFile struct {
func NewMemoryMappedFile(f *os.File, memoryMapSizeMB uint32) *MemoryMappedFile {
mmf := &MemoryMappedFile{
mm : new(MemoryMap),
mm: new(MemoryMap),
}
mmf.mm.CreateMemoryMap(f, 1024*1024*uint64(memoryMapSizeMB))
return mmf
}
func (mmf *MemoryMappedFile) ReadAt(p []byte, off int64) (n int, err error) {
readBytes, e := mmf.mm.ReadMemory(uint64(off), uint64(len(p)))
readBytes, e := mmf.mm.ReadMemory(uint64(off), uint64(len(p)))
if e != nil {
return 0, e
}