wal

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogPrefix = "wal-"
	LogSuffix = ".seg"
)

Variables

View Source
var (
	ErrOutOfBounds    = errors.New("error: out of bounds")
	ErrSegmentFull    = errors.New("error: segment is full")
	ErrFileClosed     = errors.New("error: file closed")
	ErrBadArgument    = errors.New("error: bad argument")
	ErrNoPathProvided = errors.New("error: no path provided")
	ErrOptionsMissing = errors.New("error: options missing")
)

Functions

This section is empty.

Types

type WriteAheadLog

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

WriteAheadLog is a write-ahead log structure

func Open

func Open(path string) (*WriteAheadLog, error)

Open opens and returns a new write-ahead log structure

func (*WriteAheadLog) Close

func (l *WriteAheadLog) Close() error

Close syncs and closes the write-ahead log

func (*WriteAheadLog) Count

func (l *WriteAheadLog) Count() int

Count returns the number of entries currently in the write-ahead log

func (*WriteAheadLog) FirstIndex

func (l *WriteAheadLog) FirstIndex() int64

FirstIndex returns the write-ahead logs first index

func (*WriteAheadLog) LastIndex

func (l *WriteAheadLog) LastIndex() int64

LastIndex returns the write-ahead logs first index

func (*WriteAheadLog) Path

func (l *WriteAheadLog) Path() string

func (*WriteAheadLog) Read

func (l *WriteAheadLog) Read(index int64) (string, []byte, error)

Read reads an entry from the write-ahead log at the specified index

func (*WriteAheadLog) Scan

func (l *WriteAheadLog) Scan(iter func(index int64, key string, value []byte) bool) error

Scan provides an iterator method for the write-ahead log

func (*WriteAheadLog) String

func (l *WriteAheadLog) String() string

String is the stringer method for the write-ahead log

func (*WriteAheadLog) TruncateFront

func (l *WriteAheadLog) TruncateFront(index int64) error

TruncateFront removes all segments and entries before specified index

func (*WriteAheadLog) Write

func (l *WriteAheadLog) Write(key string, value []byte) (int64, error)

WriteIndexEntry writes an entry to the write-ahead log in an append-only fashion

Jump to

Keyboard shortcuts

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