memfile

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendableLookupFile

type AppendableLookupFile interface {
	LookupFileWithSize
}

AppendableLookupFile is a LookupFile that may be optimized for the following scenario. The file typically grows by aggressive appending, one element at a time.

func NewAppendOptimizedFile

func NewAppendOptimizedFile(file *os.File) AppendableLookupFile

type LookupFile

type LookupFile interface {
	io.ReaderAt
	io.WriterAt
	io.Closer
	Sync() error
}

LookupFile is a file-like array-like object. The file has array elements each a fixed number of bytes. Elements are written or read one at a time. By referring to io interfaces, we can arrange for os.File to be a naive non-optimized implementation.

type LookupFileWithSize

type LookupFileWithSize interface {
	LookupFile
	Stat() (os.FileInfo, error)
}

type SparseLookupFile

type SparseLookupFile interface {
	LookupFile
}

SparseLookupFile is a LookupFile that may be optimized for the following scenario. The file is fixed size, and starts life full of zeros. Elements are written or read one at a time.

func NewFixedSizeMemFile

func NewFixedSizeMemFile(filename string, perm os.FileMode) (SparseLookupFile, error)

NewFixedSizeMemFile Opens the file and keeps a copy in memory

Jump to

Keyboard shortcuts

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