wal

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WalFlags       = os.O_APPEND | os.O_CREATE | os.O_RDWR
	WalPermissions = 0666
)

Variables

View Source
var ErrInvalidCRC = errors.New("invalid CRC checksum")
View Source
var (
	ErrReadingRecord = errors.New("error reading record")
)

Functions

This section is empty.

Types

type InMemWAL

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

func NewMemWAL

func NewMemWAL(t *testing.T) *InMemWAL

func (*InMemWAL) Append

func (wal *InMemWAL) Append(b []byte) error

func (*InMemWAL) ReadAll

func (wal *InMemWAL) ReadAll() ([][]byte, error)

type WriteAheadLog

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

func New

func New(fileName string) (*WriteAheadLog, error)

New opens a write ahead log file, creating one if necessary. Call Close() on the WriteAheadLog to ensure the file is closed after use.

func (*WriteAheadLog) Append

func (w *WriteAheadLog) Append(b []byte) error

Appends a record to the write ahead log Must flush the OS cache on every append to ensure consistency

func (*WriteAheadLog) Close

func (w *WriteAheadLog) Close() error

func (*WriteAheadLog) ReadAll

func (w *WriteAheadLog) ReadAll() ([][]byte, error)

func (*WriteAheadLog) Truncate

func (w *WriteAheadLog) Truncate() error

Truncate truncates the write ahead log

Jump to

Keyboard shortcuts

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