buffer

package
v0.0.0-...-eace9c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages a temporary file for buffering memory data.

func NewBufferManager

func NewBufferManager(outputFile string) (*Manager, error)

NewBufferManager creates a new BufferManager with a temporary file

func (*Manager) Close

func (bm *Manager) Close() error

Close closes the BufferManager and cleans up the temp file.

func (*Manager) GetExistingOffsetForVMA

func (bm *Manager) GetExistingOffsetForVMA(vmaStart, vmaSize uint64) (tmpOffset TmpOffset, ok bool)

GetExistingOffsetForVMA returns the offset in the temp file for the given VMA if it exists.

func (*Manager) GetMmapPointer

func (bm *Manager) GetMmapPointer(offset TmpOffset) (unsafe.Pointer, error)

GetMmapPointer returns a pointer to the mmap data at the given offset.

func (*Manager) GetOffsetForVMA

func (bm *Manager) GetOffsetForVMA(vmaStart, vmaSize uint64) TmpOffset

GetOffsetForVMA returns the offset in the temp file for the given VMA.

func (*Manager) PunchHole

func (bm *Manager) PunchHole(offset TmpOffset, length uint64) error

PunchHole punches a hole in the temp file to free disk space.

func (*Manager) WriteData

func (bm *Manager) WriteData(offset TmpOffset, data []byte) error

WriteData writes data to the temp file at the given offset.

func (*Manager) WriteDataTo

func (bm *Manager) WriteDataTo(writer io.WriterAt, writerOffset int64, tmpOffset TmpOffset, size uint64) error

WriteDataTo writes data directly from the mmap buffer to the given io.WriterAt. This avoids allocations by writing directly from the mmapped memory.

type TmpOffset

type TmpOffset int64

TmpOffset represents an offset in the temporary file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL