wal

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read[T Event](logPath string, unmarshaller func(data []byte) (T, error)) (iter.Seq2[T, error], error)

Read reads all events from the WAL at logPath using the provided unmarshaller function.

Types

type BatchError

type BatchError struct {
	Index int
	Err   error
}

func (BatchError) Error

func (be BatchError) Error() string

type BatchErrors

type BatchErrors []BatchError

func (BatchErrors) Error

func (be BatchErrors) Error() string

type Event

type Event interface {
	encoding.BinaryMarshaler
}

type Writer

type Writer[T Event] struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter[T Event](logPath string) (*Writer[T], error)

NewWriter creates a new WAL writer for events of type T at the specified logPath. The log file is created if it does not exist, and truncated if it does.

func (*Writer[T]) Close

func (w *Writer[T]) Close() error

func (*Writer[T]) Compact

func (w *Writer[T]) Compact(all iter.Seq[T]) error

Compact rewrites the WAL to contain only the provided events, removing any redundant or obsolete entries.

func (*Writer[T]) Write

func (w *Writer[T]) Write(e ...T) error

Write appends an event to the WAL. Data is flushed to disk before returning.

Jump to

Keyboard shortcuts

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