raft

package
v0.0.0-...-7f8ad27 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFSM

func NewFSM(buffer *ringbuffer.RingBuffer) rafthashi.FSM

func NewSnapshotStore

func NewSnapshotStore() rafthashi.SnapshotStore

func NewStableStore

func NewStableStore() rafthashi.StableStore

func NewTransport

func NewTransport(bufferName, intraAddr string, clientFetcher ClientFetcher, rpc <-chan rafthashi.RPC) rafthashi.Transport

func WithBufferSize

func WithBufferSize(size int) func(*Config)

func WithLogger

func WithLogger(logger *log.Logger) func(*Config)

func WithPeers

func WithPeers(peers []string) func(*Config)

Types

type BufferReader

type BufferReader interface {
	ReadAt(readIndex uint64) (*rafthashi.Log, uint64, error)
	LastIndex() uint64
}

type BuildOp

type BuildOp func(*Config)

type ClientFetcher

type ClientFetcher interface {
	Fetch(target string) intra.NodeRaftClient
}

type Config

type Config struct {
	*rafthashi.Config
	// contains filtered or unexported fields
}

type ConsumerFetcher

type ConsumerFetcher interface {
	Fetch(bufferName string) <-chan rafthashi.RPC
	Addr() string
}

type Node

type Node interface {
	AddPeer(peer string) rafthashi.Future
	RemovePeer(peer string) rafthashi.Future
}

type PeerRepair

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

func NewPeerRepair

func NewPeerRepair(store rafthashi.PeerStore, node Node) *PeerRepair

func (*PeerRepair) ExpectedPeers

func (r *PeerRepair) ExpectedPeers() (peers []string)

func (*PeerRepair) SetExpectedPeers

func (r *PeerRepair) SetExpectedPeers(peers []string)

type PeerStore

type PeerStore interface {
	rafthashi.PeerStore
}

type Raft

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

func Build

func Build(bufferName string, consumerFetcher ConsumerFetcher, ops ...BuildOp) (*Raft, error)

func (*Raft) ExpectedPeers

func (r *Raft) ExpectedPeers() (peers []string)

func (*Raft) LastIndex

func (r *Raft) LastIndex() uint64

func (*Raft) Leader

func (r *Raft) Leader() string

func (*Raft) ReadAt

func (r *Raft) ReadAt(index uint64) (entry []byte, seq uint64, err error)

func (*Raft) SetExpectedPeers

func (r *Raft) SetExpectedPeers(peers []string)

func (*Raft) Shutdown

func (r *Raft) Shutdown() rafthashi.Future

func (*Raft) Write

func (r *Raft) Write(storedData stored.Data, timeout time.Duration) error

Directories

Path Synopsis
buffers

Jump to

Keyboard shortcuts

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