raftstore

package
v0.0.0-...-acb9878 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 34 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCell

func DeleteCell(id uint64, wb storage.WriteBatch) error

DeleteCell delete cell with state, raft state and apply state.

func GetMaxKey

func GetMaxKey() []byte

GetMaxKey return max key

func GetMinKey

func GetMinKey() []byte

GetMinKey return min key

func GetStoreIdentKey

func GetStoreIdentKey() []byte

GetStoreIdentKey return key of StoreIdent

func HasOverlap

func HasOverlap(c1, c2 *metapb.Cell) bool

HasOverlap check cells has overlap

func SaveCell

func SaveCell(driver storage.Driver, cell metapb.Cell) error

SaveCell save cell with state, raft state and apply state.

func StalEpoch

func StalEpoch(target, check metapb.CellEpoch) bool

StalEpoch returns true if the target epoch is stale

Types

type Cfg

type Cfg struct {
	Addr                      string
	DataPath                  string
	OptionPath                string
	CellCapacity              uint64
	DurationHeartbeatStore    time.Duration
	DurationHeartbeatCell     time.Duration
	DurationSplitCheck        time.Duration
	DurationCompact           time.Duration
	DurationReportMetric      time.Duration
	DurationRaftTick          time.Duration
	DurationRetrySentSnapshot time.Duration
	LimitPeerDownDuration     time.Duration
	LimitCompactCount         uint64
	LimitCompactBytes         uint64
	LimitCompactLag           uint64
	LimitRaftMsgCount         int
	LimitRaftMsgBytes         uint64
	LimitRaftEntryBytes       uint64
	LimitSnapChunkBytes       uint64
	LimitSnapChunkRate        uint64
	LimitConcurrencyWrite     uint64
	LimitNemoInstance         int
	ThresholdCompact          uint64
	ThresholdSplitCheckBytes  uint64
	ThresholdRaftElection     int
	ThresholdRaftHeartbeat    int
	BatchSizeProposal         uint64
	BatchSizeSent             uint64
	WorkerCountSent           uint64
	WorkerCountSentSnap       uint64
	WorkerCountApply          uint64
	EnableSyncRaftLog         bool
	EnableMetricsRequest      bool
}

Cfg for raftstore

func NewCfg

func NewCfg() *Cfg

NewCfg return default cfg

type PeerReplicate

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

PeerReplicate is the cell's peer replicate. Every cell replicate has a PeerReplicate.

type SnapshotManager

type SnapshotManager interface {
	Register(msg *mraft.SnapshotMessage, step int) bool
	Deregister(msg *mraft.SnapshotMessage, step int)
	Create(msg *mraft.SnapshotMessage) error
	Exists(msg *mraft.SnapshotMessage) bool
	WriteTo(msg *mraft.SnapshotMessage, conn goetty.IOSession) (uint64, error)
	CleanSnap(msg *mraft.SnapshotMessage) error
	ReceiveSnapData(msg *mraft.SnapshotMessage) error
	Apply(msg *mraft.SnapshotMessage) error
}

SnapshotManager manager snapshot

type Store

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

Store is the store for raft

func NewStore

func NewStore(clusterID uint64, pdClient *pd.Client, meta metapb.Store, engines []storage.Driver, cfg *Cfg) *Store

NewStore returns store

func (*Store) GetID

func (s *Store) GetID() uint64

GetID returns store id

func (*Store) GetMeta

func (s *Store) GetMeta() metapb.Store

GetMeta returns store meta

func (*Store) OnProxyReq

func (s *Store) OnProxyReq(req *raftcmdpb.Request, cb func(*raftcmdpb.RaftCMDResponse)) error

OnProxyReq process proxy req

func (*Store) OnRedisCommand

func (s *Store) OnRedisCommand(sessionID int64, cmdType raftcmdpb.CMDType, cmd redis.Command, cb func(*raftcmdpb.RaftCMDResponse)) ([]byte, error)

OnRedisCommand process redis command

func (*Store) SetKeyConvertFun

func (s *Store) SetKeyConvertFun(fn func([]byte, func([]byte) metapb.Cell) metapb.Cell)

SetKeyConvertFun set key convert function

func (*Store) Start

func (s *Store) Start()

Start returns the error when start store

func (*Store) Stop

func (s *Store) Stop() error

Stop returns the error when stop store

Jump to

Keyboard shortcuts

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