Documentation
¶
Index ¶
- Constants
- type ControlPane
- type RaftServer
- func (r *RaftServer) AddNode(peerID uint64, address string, clusterIDs ...uint64) error
- func (r *RaftServer) BindCluster(initMembers string, join bool, clusterIDs ...uint64) error
- func (r *RaftServer) GetActiveClusters() []uint64
- func (r *RaftServer) GetClusterMap() map[uint64]uint64
- func (r *RaftServer) GetNodeMap() map[uint64][]uint64
- func (r *RaftServer) Init() error
- func (r *RaftServer) LeaderUpdated(info raftio.LeaderInfo)
- func (r *RaftServer) Propose(key uint64, data []byte, dur time.Duration) (*dragonboat.RequestResult, error)
- func (r *RaftServer) RequestSnapshot(timeout time.Duration) (uint64, uint64, error)
- func (r *RaftServer) ShuffleCluster(nodes ...uint64) error
- func (r *RaftServer) SnapshotCompleted() bool
- func (r *RaftServer) TransferClusters(toPeerID uint64, clusterIDs ...uint64) error
- type ReplicationEvent
- type SQLiteLogDB
- func (s *SQLiteLogDB) BinaryFormat() uint32
- func (s *SQLiteLogDB) Close()
- func (s *SQLiteLogDB) CompactEntriesTo(clusterID uint64, nodeID uint64, index uint64) (<-chan struct{}, error)
- func (s *SQLiteLogDB) DeleteSnapshot(clusterID uint64, nodeID uint64, index uint64) error
- func (s *SQLiteLogDB) GetBootstrapInfo(clusterID uint64, nodeID uint64) (raftpb.Bootstrap, error)
- func (s *SQLiteLogDB) ImportSnapshot(snp raftpb.Snapshot, nodeID uint64) error
- func (s *SQLiteLogDB) IterateEntries(entries []raftpb.Entry, size uint64, clusterID uint64, nodeID uint64, ...) ([]raftpb.Entry, uint64, error)
- func (s *SQLiteLogDB) ListNodeInfo() ([]raftio.NodeInfo, error)
- func (s *SQLiteLogDB) ListSnapshots(clusterID uint64, nodeID uint64, index uint64) ([]raftpb.Snapshot, error)
- func (s *SQLiteLogDB) Name() string
- func (s *SQLiteLogDB) ReadRaftState(clusterID uint64, nodeID uint64, snapshotIndex uint64) (raftio.RaftState, error)
- func (s *SQLiteLogDB) RemoveEntriesTo(clusterID uint64, nodeID uint64, index uint64) error
- func (s *SQLiteLogDB) RemoveNodeData(clusterID uint64, nodeID uint64) error
- func (s *SQLiteLogDB) SaveBootstrapInfo(clusterID uint64, nodeID uint64, bootstrap raftpb.Bootstrap) error
- func (s *SQLiteLogDB) SaveRaftState(updates []raftpb.Update, _ uint64) error
- func (s *SQLiteLogDB) SaveSnapshots(updates []raftpb.Update) error
- type SQLiteLogDBFactory
- type SQLiteStateMachine
- func (ssm *SQLiteStateMachine) Close() error
- func (ssm *SQLiteStateMachine) GetSnapshotDir() (string, error)
- func (ssm *SQLiteStateMachine) HasRestoredSnapshot() bool
- func (ssm *SQLiteStateMachine) HasSavedSnapshot() bool
- func (ssm *SQLiteStateMachine) Lookup(_ interface{}) (interface{}, error)
- func (ssm *SQLiteStateMachine) Open(_ <-chan struct{}) (uint64, error)
- func (ssm *SQLiteStateMachine) PrepareSnapshot() (interface{}, error)
- func (ssm *SQLiteStateMachine) RecoverFromSnapshot(reader io.Reader, _ <-chan struct{}) error
- func (ssm *SQLiteStateMachine) SaveSnapshot(path interface{}, writer io.Writer, _ <-chan struct{}) error
- func (ssm *SQLiteStateMachine) Sync() error
- func (ssm *SQLiteStateMachine) Update(entries []sm.Entry) ([]sm.Entry, error)
Constants ¶
View Source
const ( State raftInfoEntryType = 1 Entry raftInfoEntryType = 2 Bootstrap raftInfoEntryType = 3 Snapshot raftInfoEntryType = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControlPane ¶
type ControlPane struct {
// contains filtered or unexported fields
}
func NewControlPane ¶
func NewControlPane(raft *RaftServer) *ControlPane
func (*ControlPane) Run ¶
func (c *ControlPane) Run(addr string) error
type RaftServer ¶
type RaftServer struct {
// contains filtered or unexported fields
}
func NewRaftServer ¶
func NewRaftServer( bindAddress string, nodeID uint64, metaPath string, database *db.SqliteStreamDB, ) *RaftServer
func (*RaftServer) AddNode ¶
func (r *RaftServer) AddNode(peerID uint64, address string, clusterIDs ...uint64) error
func (*RaftServer) BindCluster ¶
func (r *RaftServer) BindCluster(initMembers string, join bool, clusterIDs ...uint64) error
func (*RaftServer) GetActiveClusters ¶
func (r *RaftServer) GetActiveClusters() []uint64
func (*RaftServer) GetClusterMap ¶
func (r *RaftServer) GetClusterMap() map[uint64]uint64
func (*RaftServer) GetNodeMap ¶
func (r *RaftServer) GetNodeMap() map[uint64][]uint64
func (*RaftServer) Init ¶
func (r *RaftServer) Init() error
func (*RaftServer) LeaderUpdated ¶
func (r *RaftServer) LeaderUpdated(info raftio.LeaderInfo)
func (*RaftServer) Propose ¶
func (r *RaftServer) Propose(key uint64, data []byte, dur time.Duration) (*dragonboat.RequestResult, error)
func (*RaftServer) RequestSnapshot ¶
func (*RaftServer) ShuffleCluster ¶
func (r *RaftServer) ShuffleCluster(nodes ...uint64) error
func (*RaftServer) SnapshotCompleted ¶
func (r *RaftServer) SnapshotCompleted() bool
func (*RaftServer) TransferClusters ¶
func (r *RaftServer) TransferClusters(toPeerID uint64, clusterIDs ...uint64) error
type ReplicationEvent ¶
func (*ReplicationEvent[T]) Marshal ¶
func (e *ReplicationEvent[T]) Marshal() ([]byte, error)
func (*ReplicationEvent[T]) Unmarshal ¶
func (e *ReplicationEvent[T]) Unmarshal(data []byte) error
type SQLiteLogDB ¶
type SQLiteLogDB struct {
// contains filtered or unexported fields
}
func (*SQLiteLogDB) BinaryFormat ¶
func (s *SQLiteLogDB) BinaryFormat() uint32
func (*SQLiteLogDB) Close ¶
func (s *SQLiteLogDB) Close()
func (*SQLiteLogDB) CompactEntriesTo ¶
func (s *SQLiteLogDB) CompactEntriesTo(clusterID uint64, nodeID uint64, index uint64) (<-chan struct{}, error)
func (*SQLiteLogDB) DeleteSnapshot ¶
func (s *SQLiteLogDB) DeleteSnapshot(clusterID uint64, nodeID uint64, index uint64) error
func (*SQLiteLogDB) GetBootstrapInfo ¶
func (*SQLiteLogDB) ImportSnapshot ¶
func (s *SQLiteLogDB) ImportSnapshot(snp raftpb.Snapshot, nodeID uint64) error
func (*SQLiteLogDB) IterateEntries ¶
func (s *SQLiteLogDB) IterateEntries( entries []raftpb.Entry, size uint64, clusterID uint64, nodeID uint64, low uint64, high uint64, maxSize uint64, ) ([]raftpb.Entry, uint64, error)
IterateEntries returns the continuous Raft log entries of the specified Raft node between the index value range of [low, high) up to a max size limit of maxSize bytes. It returns the located log entries, their total size in bytes and the occurred error.
func (*SQLiteLogDB) ListNodeInfo ¶
func (s *SQLiteLogDB) ListNodeInfo() ([]raftio.NodeInfo, error)
ListNodeInfo lists all available NodeInfo found in the log DB.
func (*SQLiteLogDB) ListSnapshots ¶
func (*SQLiteLogDB) Name ¶
func (s *SQLiteLogDB) Name() string
func (*SQLiteLogDB) ReadRaftState ¶
func (*SQLiteLogDB) RemoveEntriesTo ¶
func (s *SQLiteLogDB) RemoveEntriesTo(clusterID uint64, nodeID uint64, index uint64) error
RemoveEntriesTo removes entries associated with the specified Raft node up to the specified index.
func (*SQLiteLogDB) RemoveNodeData ¶
func (s *SQLiteLogDB) RemoveNodeData(clusterID uint64, nodeID uint64) error
func (*SQLiteLogDB) SaveBootstrapInfo ¶
func (*SQLiteLogDB) SaveRaftState ¶
func (s *SQLiteLogDB) SaveRaftState(updates []raftpb.Update, _ uint64) error
func (*SQLiteLogDB) SaveSnapshots ¶
func (s *SQLiteLogDB) SaveSnapshots(updates []raftpb.Update) error
type SQLiteLogDBFactory ¶
type SQLiteLogDBFactory struct {
// contains filtered or unexported fields
}
func NewSQLiteLogDBFactory ¶
func NewSQLiteLogDBFactory(metaPath string, nodeID uint64) *SQLiteLogDBFactory
func (*SQLiteLogDBFactory) Create ¶
func (f *SQLiteLogDBFactory) Create( _ config.NodeHostConfig, _ config.LogDBCallback, _ []string, _ []string, ) (raftio.ILogDB, error)
func (*SQLiteLogDBFactory) Name ¶
func (f *SQLiteLogDBFactory) Name() string
type SQLiteStateMachine ¶
type SQLiteStateMachine struct {
NodeID uint64
DB *db.SqliteStreamDB
RaftPath string
// contains filtered or unexported fields
}
func NewDBStateMachine ¶
func NewDBStateMachine(nodeID uint64, db *db.SqliteStreamDB, path string) *SQLiteStateMachine
func (*SQLiteStateMachine) Close ¶
func (ssm *SQLiteStateMachine) Close() error
func (*SQLiteStateMachine) GetSnapshotDir ¶
func (ssm *SQLiteStateMachine) GetSnapshotDir() (string, error)
func (*SQLiteStateMachine) HasRestoredSnapshot ¶
func (ssm *SQLiteStateMachine) HasRestoredSnapshot() bool
func (*SQLiteStateMachine) HasSavedSnapshot ¶
func (ssm *SQLiteStateMachine) HasSavedSnapshot() bool
func (*SQLiteStateMachine) Lookup ¶
func (ssm *SQLiteStateMachine) Lookup(_ interface{}) (interface{}, error)
func (*SQLiteStateMachine) Open ¶
func (ssm *SQLiteStateMachine) Open(_ <-chan struct{}) (uint64, error)
func (*SQLiteStateMachine) PrepareSnapshot ¶
func (ssm *SQLiteStateMachine) PrepareSnapshot() (interface{}, error)
func (*SQLiteStateMachine) RecoverFromSnapshot ¶
func (ssm *SQLiteStateMachine) RecoverFromSnapshot(reader io.Reader, _ <-chan struct{}) error
func (*SQLiteStateMachine) SaveSnapshot ¶
func (ssm *SQLiteStateMachine) SaveSnapshot(path interface{}, writer io.Writer, _ <-chan struct{}) error
func (*SQLiteStateMachine) Sync ¶
func (ssm *SQLiteStateMachine) Sync() error
Click to show internal directories.
Click to hide internal directories.