wal

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryType recordType = iota + 1
	IndexType
	FooterType
)
View Source
const (
	TrashPath = ".trash"
)

Variables

This section is empty.

Functions

func InitPath

func InitPath(dir string) error

func IsLogError

func IsLogError(err error) bool

func NewLogError

func NewLogError(filename string, offset int64, reason string) *logError

NewCorruptError new

Types

type Entry

type Entry struct {
	pb.Entry
}

func (*Entry) Decode

func (entry *Entry) Decode(data []byte) error

func (*Entry) Encode

func (entry *Entry) Encode(w io.Writer) (err error)

func (*Entry) Size

func (entry *Entry) Size() uint64

type RecordReadAt

type RecordReadAt interface {
	ReadAt(offset int64) (rec record, err error)
}

type Recorder

type Recorder interface {
	Encode(w io.Writer) error
	Size() uint64
}

type Snapshot

type Snapshot struct {
	Index uint64
	Term  uint64
}

func NewMeta

func NewMeta(dir string) (mt *meta, st Snapshot, hs pb.HardState, err error)

type Wal

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

Storage the storage

func OpenWal

func OpenWal(dir string, sync bool) (*Wal, error)

OpenWal

func (*Wal) ApplySnapshot

func (w *Wal) ApplySnapshot(st Snapshot) error

func (*Wal) Close

func (w *Wal) Close()

func (*Wal) Entries

func (w *Wal) Entries(lo, hi uint64, maxSize uint64) (entries []pb.Entry, err error)

func (*Wal) FirstIndex

func (w *Wal) FirstIndex() uint64

func (*Wal) InitialState

func (w *Wal) InitialState() pb.HardState

func (*Wal) LastIndex

func (w *Wal) LastIndex() uint64

func (*Wal) SaveEntries

func (w *Wal) SaveEntries(entries []pb.Entry) error

func (*Wal) SaveHardState

func (w *Wal) SaveHardState(hs pb.HardState) error

func (*Wal) Sync

func (w *Wal) Sync() error

func (*Wal) Term

func (w *Wal) Term(index uint64) (term uint64, err error)

func (*Wal) Truncate

func (w *Wal) Truncate(index uint64) error

Jump to

Keyboard shortcuts

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