added preload and streaming buffer pool

This commit is contained in:
ston1th 2022-08-19 19:01:28 +02:00
commit b010b3a93e
5 changed files with 70 additions and 20 deletions

View file

@ -134,9 +134,7 @@ func (f *File) readToCache(p []byte) (n int, err error) {
n, err = f.readSource(p)
if n > 0 {
// async cache write
buf := make([]byte, n)
copy(buf, p[:n])
if _, err = f.md.WriteAt(buf, f.offset); err != nil {
if _, err = f.md.WriteAt(p[:n], f.offset); err != nil {
log.Error(err, "error writing cache file")
return
}