index

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderSize = int64(len(magic) + 2) // magic + version + params

Variables

View Source
var (
	VUnknown         = Version{}
	V1               = Version{/* contains filtered or unexported fields */}
	V2               = Version{/* contains filtered or unexported fields */}
	VLast    Version = V2 // always last version
)
View Source
var (
	ErrCorrupted = errors.New("index corrupted")
)
View Source
var ErrKeyNotFound = fmt.Errorf("key: %w", message.ErrNotFound)
View Source
var ErrOffsetAfterEnd = fmt.Errorf("%w: offset after end", message.ErrInvalidOffset)
View Source
var ErrOffsetBeforeStart = fmt.Errorf("%w: offset before start", message.ErrNotFound)
View Source
var ErrOffsetIndexEmpty = fmt.Errorf("%w: no offset items", message.ErrInvalidOffset)
View Source
var ErrOffsetNotFound = fmt.Errorf("%w: offset not found", message.ErrNotFound)
View Source
var ErrTimeAfterEnd = errors.New("time after end")
View Source
var ErrTimeBeforeStart = errors.New("time before start")
View Source
var ErrTimeIndexEmpty = fmt.Errorf("%w: no time items", message.ErrInvalidOffset)

Functions

func AppendKeys

func AppendKeys(keys art.Tree, items []Item)

func Consume

func Consume(items []Item, offset int64) (int64, int64, error)

func Get

func Get(items []Item, offset int64) (int64, error)

func KeyHash

func KeyHash(key []byte) uint64

func KeyHashEncoded

func KeyHashEncoded(h uint64) []byte

func Keys

func Keys(keys art.Tree, keyHash []byte) ([]int64, error)

func Stat

func Stat(path string, offset int64, opts Params) (int64, int, error)

func Time

func Time(items []Item, ts int64) (int64, error)

func Write

func Write(path string, offset int64, newVersion Version, opts Params, index []Item) (retErr error)

Types

type Item

type Item struct {
	Offset    int64
	Position  int64
	Timestamp int64
	KeyHash   uint64
}

func Read

func Read(path string, offset int64, opts Params) ([]Item, error)

type Params

type Params struct {
	Times bool
	Keys  bool
}

func (Params) NewItem

func (o Params) NewItem(m message.Message, position int64, prevts int64) Item

func (Params) Size

func (o Params) Size() int64

type Version

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

func GetVersion

func GetVersion(path string, offset int64, opts Params) (Version, error)

type Writer

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

func OpenWriter

func OpenWriter(path string, offset int64, newVersion Version, opts Params) (w *Writer, retErr error)

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Size

func (w *Writer) Size() int64

func (*Writer) Sync

func (w *Writer) Sync() error

func (*Writer) SyncAndClose

func (w *Writer) SyncAndClose() error

func (*Writer) Write

func (w *Writer) Write(it Item) error

Jump to

Keyboard shortcuts

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