|
|
@ -130,13 +130,16 @@ func memoryMapAndGenerate(path string, size uint64, generator func(buffer []uint |
|
|
|
data := buffer[len(dumpMagic):] |
|
|
|
data := buffer[len(dumpMagic):] |
|
|
|
generator(data) |
|
|
|
generator(data) |
|
|
|
|
|
|
|
|
|
|
|
if err := mem.Flush(); err != nil { |
|
|
|
if err := mem.Unmap(); err != nil { |
|
|
|
mem.Unmap() |
|
|
|
return nil, nil, nil, err |
|
|
|
dump.Close() |
|
|
|
} |
|
|
|
|
|
|
|
if err := dump.Close(); err != nil { |
|
|
|
|
|
|
|
return nil, nil, nil, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if err := os.Rename(temp, path); err != nil { |
|
|
|
return nil, nil, nil, err |
|
|
|
return nil, nil, nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
os.Rename(temp, path) |
|
|
|
return memoryMap(path) |
|
|
|
return dump, mem, data, nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// cache wraps an ethash cache with some metadata to allow easier concurrent use.
|
|
|
|
// cache wraps an ethash cache with some metadata to allow easier concurrent use.
|
|
|
|