readatbuf

package
v0.0.0-...-319d980 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashUInt

func HashUInt(v uint) uint32

Types

type Reader

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

Reader implements buffering for random access reads via the `ReaderAt` interface.

func New

func New(inner io.ReaderAt, pageSize, cacheSize uint) (reader *Reader, err error)

New creates a new buffered reader supporting random access. The pageSize argument decides the size of each region (page) tracked in the cache. cacheSize defines the maximum number of pages to cache.

func (*Reader) InvalidateCache

func (reader *Reader) InvalidateCache()

InvalidateCache flushes the internal cache. Resets the statistics.

func (*Reader) ReadAt

func (reader *Reader) ReadAt(p []byte, off int64) (int, error)

ReadAt implements the `ReaderAt` interface.

func (*Reader) Statistics

func (reader *Reader) Statistics() Statistics

Statistics returns statistics about cache efficiency.

type Statistics

type Statistics struct {
	Hits      uint64
	Misses    uint64
	Evictions uint64
}

Statistics contains statistics about cache efficiency.

Jump to

Keyboard shortcuts

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