index

package
v0.0.0-...-3336bd9 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	File             *os.File
	Size             uint64
	MemoryMap        gommap.MMap
	UseMemoryMapping bool
}

func NewIndex

func NewIndex(optFns ...IndexOptions) (*Index, error)

func (*Index) Close

func (i *Index) Close() error

func (*Index) Read

func (i *Index) Read(in int64) (out uint32, pos uint64, err error)

func (*Index) Write

func (i *Index) Write(off uint32, pos uint64) error

type IndexOptions

type IndexOptions func(*Options)

Represents a function that applies configuration options to an Options instance

func WithAutoCreate

func WithAutoCreate(autoCreate bool) IndexOptions

Option to enable or disable automatic index file creation.

func WithFile

func WithFile(f *os.File) IndexOptions

Set the file to be indexed

func WithFilePath

func WithFilePath(path string) IndexOptions

Specifies the file path for the store's backing file

func WithMaxIndexBytes

func WithMaxIndexBytes(maxIndexBytes uint64) IndexOptions

Sets the maximum number of bytes for the index file itself.

func WithMemoryMapping

func WithMemoryMapping(use bool) IndexOptions

Enables or disables memory mapping for the index file.

type Options

type Options struct {
	File             *os.File
	FilePath         string
	UseMemoryMapping bool
	AutoCreate       bool
	MaxIndexBytes    uint64
}

func DefaultOptions

func DefaultOptions() *Options

Default settings for Index

Jump to

Keyboard shortcuts

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