From a1365a81964a410d765533f98ef874b16fc21a4a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 21 Aug 2025 14:25:48 +1000 Subject: [PATCH] Just use File.WriteAt for mmap file io WriteAt Also remove WriteTo for shared handle, it doesn't make sense without a pos. --- storage/file-io-mmap.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/storage/file-io-mmap.go b/storage/file-io-mmap.go index ec060712..b11dca84 100644 --- a/storage/file-io-mmap.go +++ b/storage/file-io-mmap.go @@ -163,14 +163,9 @@ type mmapSharedFileHandle struct { } func (m *mmapSharedFileHandle) WriteAt(p []byte, off int64) (n int, err error) { - //fmt.Println("mmapSharedFileHandle.WriteAt", off, len(p), len(m.f.m)) - n = copy(m.f.m[off:], p) - return -} - -func (m *mmapSharedFileHandle) WriteTo(w io.Writer) (n int64, err error) { - //TODO implement me - panic("implement me") + // It's not actually worth the hassle to write using mmap here since the caller provided the + // buffer already. + return m.f.f.WriteAt(p, off) } func (m *mmapSharedFileHandle) ReadAt(p []byte, off int64) (n int, err error) { -- 2.51.0