memfile

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 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 {
	LookupFile
}

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, error)

type FileWithSize added in v0.0.7

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

func NewFileWithSize added in v0.0.7

func NewFileWithSize(file *os.File) *FileWithSize

func (*FileWithSize) Close added in v0.0.7

func (fws *FileWithSize) Close() error

func (*FileWithSize) ReadAt added in v0.0.7

func (fws *FileWithSize) ReadAt(b []byte, off int64) (int, error)

func (*FileWithSize) Size added in v0.0.7

func (fws *FileWithSize) Size() int64

func (*FileWithSize) Sync added in v0.0.7

func (fws *FileWithSize) Sync() error

func (*FileWithSize) WriteAt added in v0.0.7

func (fws *FileWithSize) WriteAt(p []byte, off int64) (int, error)

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
	Size() int64
}

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