wal

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package wal provides a simple interface for Write-Ahead Logging (WAL) of operations on HNSW indices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeletionMark

type DeletionMark struct {
	ID uint32
}

DeletionMark is a log entry representing the operation of marking data for deletion.

type EfSetting

type EfSetting struct {
	Ef int
}

EfSetting is a log entry representing the operation of setting the "ef" parameter.

type Log

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

Log is an object to conveniently handle write-ahead log files for HNSW indices.

func NewLog

func NewLog(filename string) *Log

NewLog creates a new Log.

func (*Log) Close

func (log *Log) Close() error

Close closes the file if necessary, and frees related internal resources.

func (*Log) Delete

func (log *Log) Delete() error

Delete removes the log file, virtually emptying the log.

func (*Log) Read

func (log *Log) Read(fn func(e interface{}) error) (err error)

Read reads all entries from the log file and calls the given function for each of them.

If the log file does not exists, no error is returned, since this scenario is considered an equivalent of having an empty log.

If the log file was still open for writing, it is first closed.

The callback function can return an error; if it is not nil, the entries iteration will stop, and the Read function will returned the same error.

func (*Log) WriteDeletionMark

func (log *Log) WriteDeletionMark(id uint32) error

WriteDeletionMark appends a new DeletionMark entry to the log.

func (*Log) WriteEfSetting

func (log *Log) WriteEfSetting(ef int) error

WriteEfSetting appends a new EfSetting entry to the log.

func (*Log) WritePointAddition

func (log *Log) WritePointAddition(vector []float32, id uint32) error

WritePointAddition appends a new PointAddition entry to the log.

type PointAddition

type PointAddition struct {
	Vector []float32
	ID     uint32
}

PointAddition is a log entry representing the operation of adding new data.

Jump to

Keyboard shortcuts

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