raftds

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 8 Imported by: 0

README

raft-go-datastore

The package exports the Store which is an implementation of both a LogStore and StableStore.

It is meant to be used as a backend for the raft package here.

This implementation uses go-datastore.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store can be used as a LogStore and StableStore for Raft.

func NewStore

func NewStore(ds datastore.Datastore) *Store

func (*Store) Close

func (s *Store) Close() error

Close is used to gracefully close the datastore.

func (*Store) DeleteRange

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

DeleteRange deletes a range of log entries. The range is inclusive.

func (*Store) FirstIndex

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

FirstIndex returns the first index written. 0 for no entries.

func (*Store) Get

func (s *Store) Get(key []byte) ([]byte, error)

func (*Store) GetLog

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

func (*Store) GetUint64

func (s *Store) GetUint64(key []byte) (uint64, error)

func (*Store) LastIndex

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

LastIndex returns the last index written. 0 for no entries.

func (*Store) Set

func (s *Store) Set(key []byte, val []byte) error

func (*Store) SetUint64

func (s *Store) SetUint64(key []byte, val uint64) error

func (*Store) StoreLog

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

func (*Store) StoreLogs

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

Jump to

Keyboard shortcuts

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