raftstore

package
v0.0.0-...-388aa53 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cfg

type Cfg struct {
	DataPath         string
	StoreOptionsPath string
	Lables           []meta.Label

	ProphetName    string
	ProphetAddr    string
	ProphetOptions []prophet.Option

	// about raft
	ElectionTick           int
	HeartbeatTick          int
	MaxSizePerMsg          uint64
	MaxInflightMsgs        int
	MinRaftLogCount        uint64
	MaxRaftLogCount        uint64
	MaxRaftLogBytes        uint64
	MaxRaftLogLag          uint64
	MaxRaftEntryBytes      uint64
	MaxPeerDownTime        time.Duration
	RaftTickDuration       time.Duration
	RaftLogCompactDuration time.Duration
	RaftCheckSplitDuration time.Duration
	SyncWrite              bool

	// about batching
	MaxBatchingSize int

	// about db
	MaxDBRecords uint64

	// about worker
	ApplyWorkerCount    uint64
	SentRaftWorkerCount uint64
	SentSnapWorkerCount uint64

	// about snapshot
	LimitSnapChunkRate  int
	LimitSnapChunkBytes uint64

	// about prophet
	DBHBInterval    time.Duration
	StoreHBInterval time.Duration

	// about vectordb
	Dim                  int
	FlatThr              int
	DistThr              float32
	LimitRebuildIndex    int
	RebuildIndexDuration time.Duration

	// about mq
	Topic, GroupPrefix string
	MQAddrs            []string
}

Cfg raftstore configuration

func (*Cfg) Adjust

func (c *Cfg) Adjust()

Adjust adjust

type ContainerAdapter

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

ContainerAdapter adapter for prophet's container and store

func (*ContainerAdapter) Clone

func (c *ContainerAdapter) Clone() prophet.Container

Clone adapter prophet

func (*ContainerAdapter) ID

func (c *ContainerAdapter) ID() uint64

ID adapter prophet

func (*ContainerAdapter) Lables

func (c *ContainerAdapter) Lables() []prophet.Pair

Lables adapter prophet

func (*ContainerAdapter) Marshal

func (c *ContainerAdapter) Marshal() ([]byte, error)

Marshal adapter prophet

func (*ContainerAdapter) State

func (c *ContainerAdapter) State() prophet.State

State adapter prophet

func (*ContainerAdapter) Unmarshal

func (c *ContainerAdapter) Unmarshal(data []byte) error

Unmarshal adapter prophet

type Option

type Option func(*options)

Option raftstore option

func WithApplyWorkerCount

func WithApplyWorkerCount(value uint64) Option

WithApplyWorkerCount set ApplyWorkerCount

func WithDBHBInterval

func WithDBHBInterval(value time.Duration) Option

WithDBHBInterval set DBHBInterval

func WithDim

func WithDim(value int) Option

WithDim set Dim

func WithDistThr

func WithDistThr(value float32) Option

WithDistThr set DistThr

func WithElectionTick

func WithElectionTick(value int) Option

WithElectionTick set ElectionTick

func WithFlatThr

func WithFlatThr(value int) Option

WithFlatThr set FlatThr

func WithHeartbeatTick

func WithHeartbeatTick(value int) Option

WithHeartbeatTick set HeartbeatTick

func WithLabel

func WithLabel(key, value string) Option

WithLabel set raftstore storage option path

func WithLimitRebuildIndex

func WithLimitRebuildIndex(value int) Option

WithLimitRebuildIndex set LimitRebuildIndex

func WithLimitSnapChunkBytes

func WithLimitSnapChunkBytes(value uint64) Option

WithLimitSnapChunkBytes set LimitSnapChunkBytes

func WithLimitSnapChunkRate

func WithLimitSnapChunkRate(value int) Option

WithLimitSnapChunkRate set LimitSnapChunkRate

func WithMQ

func WithMQ(topic, groupPrefix string, mqAddrs []string) Option

WithMQ set mq

func WithMaxBatchingSize

func WithMaxBatchingSize(value int) Option

WithMaxBatchingSize set MaxBatchingSize

func WithMaxDBRecords

func WithMaxDBRecords(value uint64) Option

WithMaxDBRecords set MaxDBRecords

func WithMaxInflightMsgs

func WithMaxInflightMsgs(value int) Option

WithMaxInflightMsgs set MaxInflightMsgs

func WithMaxPeerDownTime

func WithMaxPeerDownTime(value time.Duration) Option

WithMaxPeerDownTime set MaxPeerDownTime

func WithMaxRaftEntryBytes

func WithMaxRaftEntryBytes(value uint64) Option

WithMaxRaftEntryBytes set MaxRaftEntryBytes

func WithMaxRaftLogBytes

func WithMaxRaftLogBytes(value uint64) Option

WithMaxRaftLogBytes set MaxRaftLogBytes

func WithMaxRaftLogCount

func WithMaxRaftLogCount(value uint64) Option

WithMaxRaftLogCount set MaxRaftLogCount

func WithMaxRaftLogLag

func WithMaxRaftLogLag(value uint64) Option

WithMaxRaftLogLag set MaxRaftLogLag

func WithMaxSizePerMsg

func WithMaxSizePerMsg(value uint64) Option

WithMaxSizePerMsg set MaxSizePerMsg

func WithMinRaftLogCount

func WithMinRaftLogCount(value uint64) Option

WithMinRaftLogCount set MinRaftLogCount

func WithProphetAddr

func WithProphetAddr(addr string) Option

WithProphetAddr set prophet name

func WithProphetName

func WithProphetName(name string) Option

WithProphetName set prophet name

func WithProphetOption

func WithProphetOption(opt prophet.Option) Option

WithProphetOption append a prophet option

func WithRaftCheckSplitDuration

func WithRaftCheckSplitDuration(value time.Duration) Option

WithRaftCheckSplitDuration set RaftCheckSplitDuration

func WithRaftLogCompactDuration

func WithRaftLogCompactDuration(value time.Duration) Option

WithRaftLogCompactDuration set RaftLogCompactDuration

func WithRaftTickDuration

func WithRaftTickDuration(value time.Duration) Option

WithRaftTickDuration set RaftTickDuration

func WithRebuildIndexDuration

func WithRebuildIndexDuration(value time.Duration) Option

WithRebuildIndexDuration set RebuildIndexDuration

func WithSentRaftWorkerCount

func WithSentRaftWorkerCount(value uint64) Option

WithSentRaftWorkerCount set SentRaftWorkerCount

func WithSentSnapWorkerCount

func WithSentSnapWorkerCount(value uint64) Option

WithSentSnapWorkerCount set SentSnapWorkerCount

func WithStoreDataPath

func WithStoreDataPath(path string) Option

WithStoreDataPath set raftstore storage data path

func WithStoreHBInterval

func WithStoreHBInterval(value time.Duration) Option

WithStoreHBInterval set StoreHBInterval

func WithStoreOptionsPath

func WithStoreOptionsPath(path string) Option

WithStoreOptionsPath set raftstore storage option path

func WithSyncWrite

func WithSyncWrite(value bool) Option

WithSyncWrite set SyncWrite

type PeerReplicate

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

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

type ProphetAdapter

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

ProphetAdapter adapter prophet

func (*ProphetAdapter) ChangeLeader

func (pa *ProphetAdapter) ChangeLeader(resourceID uint64, newLeader *prophet.Peer)

ChangeLeader prophet adapter

func (*ProphetAdapter) ChangePeer

func (pa *ProphetAdapter) ChangePeer(resourceID uint64, peer *prophet.Peer, changeType prophet.ChangePeerType)

ChangePeer prophet adapter

func (*ProphetAdapter) ContainerHBInterval

func (pa *ProphetAdapter) ContainerHBInterval() time.Duration

ContainerHBInterval fetch container HB interface

func (*ProphetAdapter) FetchContainerHB

func (pa *ProphetAdapter) FetchContainerHB() *prophet.ContainerHeartbeatReq

FetchContainerHB fetch container HB

func (*ProphetAdapter) FetchLeaderResources

func (pa *ProphetAdapter) FetchLeaderResources() []uint64

FetchLeaderResources fetch all local leader resources

func (*ProphetAdapter) FetchResourceHB

func (pa *ProphetAdapter) FetchResourceHB(id uint64) *prophet.ResourceHeartbeatReq

FetchResourceHB fetch resource HB

func (*ProphetAdapter) HBHandler

func (pa *ProphetAdapter) HBHandler() prophet.HeartbeatHandler

HBHandler HB hander

func (*ProphetAdapter) NewContainer

func (pa *ProphetAdapter) NewContainer() prophet.Container

NewContainer return a new container

func (*ProphetAdapter) NewResource

func (pa *ProphetAdapter) NewResource() prophet.Resource

NewResource return a new resource

func (*ProphetAdapter) ResourceHBInterval

func (pa *ProphetAdapter) ResourceHBInterval() time.Duration

ResourceHBInterval fetch resource HB interface

type ResourceAdapter

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

ResourceAdapter adapter for prophet's resource and db

func (*ResourceAdapter) Changed

func (r *ResourceAdapter) Changed(other prophet.Resource) bool

Changed adapter prophet

func (*ResourceAdapter) Clone

func (r *ResourceAdapter) Clone() prophet.Resource

Clone adapter prophet

func (*ResourceAdapter) ID

func (r *ResourceAdapter) ID() uint64

ID adapter prophet

func (*ResourceAdapter) Marshal

func (r *ResourceAdapter) Marshal() ([]byte, error)

Marshal adapter prophet

func (*ResourceAdapter) Peers

func (r *ResourceAdapter) Peers() []*prophet.Peer

Peers adapter prophet

func (*ResourceAdapter) SetPeers

func (r *ResourceAdapter) SetPeers(peers []*prophet.Peer)

SetPeers adapter prophet

func (*ResourceAdapter) Stale

func (r *ResourceAdapter) Stale(other prophet.Resource) bool

Stale adapter prophet

func (*ResourceAdapter) Unmarshal

func (r *ResourceAdapter) Unmarshal(data []byte) error

Unmarshal adapter prophet

type SnapshotManager

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

SnapshotManager manager snapshot

type Store

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

Store manager local raft groups

func NewStore

func NewStore(meta meta.Store, opts ...Option) *Store

NewStore returns store

func NewStoreWithCfg

func NewStoreWithCfg(meta meta.Store, cfg *Cfg) *Store

NewStoreWithCfg returns store with cfg

func (*Store) BecomeFollower

func (s *Store) BecomeFollower()

BecomeFollower this node is become prophet follower

func (*Store) BecomeLeader

func (s *Store) BecomeLeader()

BecomeLeader this node is become prophet leader

func (*Store) HandleInsert

func (s *Store) HandleInsert(req *rpc.InsertRequest, cb func(interface{}))

HandleInsert handle insert request

func (*Store) HandleSearch

func (s *Store) HandleSearch(req *rpc.SearchRequest, cb func(interface{}))

HandleSearch handle search request

func (*Store) HandleUpdate

func (s *Store) HandleUpdate(req *rpc.UpdateRequest, cb func(interface{}))

HandleUpdate handle update request

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