wal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAction

func AppendAction(file io.Writer, action Action) error

func CreateWalAndReturnNotAppliedActions

func CreateWalAndReturnNotAppliedActions(file *os.File, lastAppliedLSN uint64) (*W, []Action, error)

Types

type Action

type Action struct {
	Type   ActionType
	LSN    uint64
	Key    []byte
	Value  []byte // optional
	Expire uint32 // optional. 0 is default and means no expire time
}

type ActionType

type ActionType byte
const (
	ActionTypeUnknown ActionType = iota
	ActionTypeSet
	ActionTypeDel
)

type W

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

func (*W) AppendDel

func (w *W) AppendDel(key []byte) (uint64, error)

func (*W) AppendSet

func (w *W) AppendSet(key []byte, value []byte, expire uint32) (uint64, error)

func (*W) Checkpoint

func (w *W) Checkpoint() error

Checkpoint for now checkpointing WAL means it's safe to delete all entries from the file Checkpoint mush be called only after the segment's file is persisted to the disk fully Otherwise some data changes can be lost in case of software or hardware faults

func (*W) LastLSN

func (w *W) LastLSN() uint64

Jump to

Keyboard shortcuts

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