raftwal

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 4 Imported by: 1

README

raft-wal

project is a work-in-progress and may not be ready for production

This repository provides the raftwal package. It uses the tidwall/wal write ahead log library and implements the raft.LogStore from the hashicorp/raft project.

Contact

Josh Baker @tidwall

License

raftwal source code is available under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogStore

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

LogStore is a write ahead Raft log

func Open

func Open(path string, opts *Options) (*LogStore, error)

Open the Raft log

func (*LogStore) Close

func (s *LogStore) Close() error

Close the Raft log

func (*LogStore) DeleteRange

func (s *LogStore) DeleteRange(min, max uint64) error

DeleteRange is used to delete logs within a given range inclusively.

func (*LogStore) FirstIndex

func (s *LogStore) FirstIndex() (uint64, error)

FirstIndex returns the first known index from the Raft log.

func (*LogStore) GetLog

func (s *LogStore) GetLog(index uint64, log *raft.Log) error

GetLog is used to retrieve a log from FastLogDB at a given index.

func (*LogStore) LastIndex

func (s *LogStore) LastIndex() (uint64, error)

LastIndex returns the last known index from the Raft log.

func (*LogStore) StoreLog

func (s *LogStore) StoreLog(log *raft.Log) error

StoreLog is used to store a single raft log

func (*LogStore) StoreLogs

func (s *LogStore) StoreLogs(logs []*raft.Log) error

StoreLogs is used to store a set of raft logs

func (*LogStore) Sync

func (s *LogStore) Sync()

Sync performs an fsync on the log. This is not necessary when the durability is set to High.

type Options

type Options struct {
	// NoSync disables fsync after writes. This is less durable and puts the
	// log at risk of data loss when there's a server crash. Default false.
	NoSync bool
}

Options for Open

Jump to

Keyboard shortcuts

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