storage

package
v0.0.0-...-5f09003 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeConf

type NodeConf struct {
	NodeId          uint64
	Join            bool
	WalDirPath      string
	SnapshotDirPath string
	Peers           []Peer
}

type NodeState

type NodeState struct {
	LastAppliedIndex   uint64
	LastCommittedIndex uint64
	SnapshotIndex      uint64
	ConfState          raftpb.ConfState
}

type Peer

type Peer struct {
	ID      uint64
	Context storagepb.PeerContext
}

type Proposer

type Proposer interface {
	ProposeConfChange(ctx context.Context, confChange *raftpb.ConfChange)
	ProposeLogEntry(ctx context.Context, log *storagepb.LogEntry)
}

type RaftServiceContext

type RaftServiceContext struct {
	Listener net.Listener
	Logger   *zap.Logger
}

RaftServiceContext external dependencies which a Raft storage node relies on is passed in dependency injection style.

type RaftStorage

type RaftStorage struct {
	NodeConf
	NodeState
	// contains filtered or unexported fields
}

func NewRaftStorage

func NewRaftStorage(options RaftStorageOptions, context *RaftServiceContext) (*RaftStorage, error)

func (*RaftStorage) Close

func (r *RaftStorage) Close() error

func (*RaftStorage) IsIDRemoved

func (r *RaftStorage) IsIDRemoved(id uint64) bool

func (*RaftStorage) IsLeader

func (r *RaftStorage) IsLeader() bool

func (*RaftStorage) LeaderId

func (r *RaftStorage) LeaderId() uint64

func (*RaftStorage) LoadRaftPersistentState

func (r *RaftStorage) LoadRaftPersistentState() error

func (*RaftStorage) Process

func (r *RaftStorage) Process(ctx context.Context, m raftpb.Message) error

func (*RaftStorage) ReportSnapshot

func (r *RaftStorage) ReportSnapshot(id uint64, status raft.SnapshotStatus)

func (*RaftStorage) ReportUnreachable

func (r *RaftStorage) ReportUnreachable(id uint64)

func (*RaftStorage) SavePersistentState

func (r *RaftStorage) SavePersistentState() error

func (*RaftStorage) Snapshotter

func (r *RaftStorage) Snapshotter() *snap.Snapshotter

func (*RaftStorage) Start

func (r *RaftStorage) Start()

type RaftStorageOptions

type RaftStorageOptions struct {
	NodeId      uint64
	WalDirPath  string
	SnapDirPath string

	Join  bool
	Peers []string
}

type RaftStorageServer

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

func NewRaftStorageServer

func NewRaftStorageServer(bindAddr string, bindPort int, clusterId uint64, rs *RaftStorage) (*RaftStorageServer, error)

func (*RaftStorageServer) Start

func (t *RaftStorageServer) Start() error

func (*RaftStorageServer) Stop

func (t *RaftStorageServer) Stop() error

func (*RaftStorageServer) Storage

func (s *RaftStorageServer) Storage() *RaftStorage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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