wal

package module
v0.0.0-...-ab06e13 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 6 Imported by: 0

README

WAL

Fast and configurable write ahead log

Example

Basic WAL
name := log
opt := Options{
		SegmentSize: 1000000,
		SyncAfter:   1000,
	}
err := wal.New(name, opt)
l, err := wal.Load(name)
//handle err

l.Add([]byte("One"))
l.Add([]byte("Two"))
l.Add([]byte("Three"))

//3 is number of records & 0 is offset
resp, err := l.GetLast(3, 0)
Log Iterator
iter, err := wal.NewIterator(l)
//handle err
for !wal.IsEndOfLogError(err) {
	val := string(iter.Value)
	fmt.Println(val)
	err = iter.Next()
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Index out of bound
	ErrOutOfBound = errors.New("index out of bound")
)

Functions

This section is empty.

Types

type Log

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

func New

func New(name string, options *LogOptions) (*Log, error)

type LogOptions

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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