wal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed          = errors.New("wal: closed")
	ErrNotFoundLogFile = errors.New("wal: not found log file")
)
View Source
var (
	ErrOutOfRange = errors.New("WAL: out of range")
)

Functions

This section is empty.

Types

type AppendCallback

type AppendCallback = func([]Range, error)

type AppendOneCallback

type AppendOneCallback = func(Range, error)

type OnEntryCallback

type OnEntryCallback = func(entry []byte, r Range) error

type Option

type Option func(*config)

func FromPosition

func FromPosition(pos int64) Option

func WithBlockSize

func WithBlockSize(blockSize int) Option

func WithFileSize

func WithFileSize(fileSize int64) Option

func WithFlushDelayTime

func WithFlushDelayTime(d time.Duration) Option

func WithIOEngine

func WithIOEngine(engine ioengine.Interface) Option

func WithReadOnly added in v0.9.0

func WithReadOnly() Option

func WithRecoveryCallback

func WithRecoveryCallback(cb OnEntryCallback) Option

type Range

type Range struct {
	SO int64
	EO int64
}

func Append

func Append(ctx context.Context, w *WAL, entries [][]byte) ([]Range, error)

func AppendOne

func AppendOne(ctx context.Context, w *WAL, entry []byte) (Range, error)

func DirectAppend

func DirectAppend(ctx context.Context, w *WAL, entries [][]byte) ([]Range, error)

func DirectAppendOne

func DirectAppendOne(ctx context.Context, w *WAL, entry []byte) (Range, error)

type WAL

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

WAL is write-ahead log.

func Open

func Open(ctx context.Context, dir string, opts ...Option) (*WAL, error)

func (*WAL) Append

func (w *WAL) Append(ctx context.Context, entries [][]byte, cb AppendCallback)

Append appends entries to WAL.

func (*WAL) AppendOne

func (w *WAL) AppendOne(ctx context.Context, entry []byte, cb AppendOneCallback)

func (*WAL) Close

func (w *WAL) Close()

func (*WAL) Compact

func (w *WAL) Compact(_ context.Context, off int64) error

func (*WAL) Dir

func (w *WAL) Dir() string

func (*WAL) Wait

func (w *WAL) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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