Documentation ¶
Index ¶
- type Command
- type Commit
- type CommitApplier
- type Config
- type LeaderFunc
- type Membership
- type NodeConfig
- type Peer
- type Peers
- type RaftNode
- func (rc *RaftNode) AppliedIndex() uint64
- func (rc *RaftNode) Apply(ctx context.Context, buf []byte) error
- func (rc *RaftNode) CommittedIndex() uint64
- func (rc *RaftNode) GetMembers(ctx context.Context, in *api.GetMembersRequest) (*api.GetMembersResponse, error)
- func (rc *RaftNode) GetStatus(ctx context.Context, in *api.GetStatusRequest) (*api.GetStatusResponse, error)
- func (rc *RaftNode) GetTopology(ctx context.Context, in *api.GetTopologyRequest) (*api.GetTopologyResponse, error)
- func (rc *RaftNode) IsLeader() bool
- func (rc *RaftNode) IsLearner() bool
- func (rc *RaftNode) IsRemovedFromCluster() bool
- func (rc *RaftNode) IsVoter() bool
- func (rc *RaftNode) JoinCluster(ctx context.Context, in *api.RaftContext) (*api.JoinClusterResponse, error)
- func (rc *RaftNode) Leader() uint64
- func (rc *RaftNode) Leave(ctx context.Context) error
- func (rc *RaftNode) Process(ctx context.Context, m raftpb.Message) error
- func (rc *RaftNode) ProcessMessage(ctx context.Context, message *raftpb.Message) (*api.Payload, error)
- func (rc *RaftNode) PromoteMember(ctx context.Context, in *api.RaftContext) (*api.PromoteMemberResponse, error)
- func (rc *RaftNode) Ready() <-chan struct{}
- func (rc *RaftNode) RemoveMember(ctx context.Context, message *api.RemoveMemberRequest) (*api.RemoveMemberResponse, error)
- func (rc *RaftNode) ReportNewPeer(ctx context.Context, id uint64, address string) error
- func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (rc *RaftNode) ReportUnreachable(id uint64)
- func (rc *RaftNode) Run(ctx context.Context, peers []Peer, join bool, config NodeConfig)
- func (rc *RaftNode) Send(ctx context.Context, messages []raftpb.Message)
- func (rc *RaftNode) Serve(grpcServer *grpc.Server)
- type SnapshotApplier
- type SnapshotNotifier
- type StableStorage
- type StatsProvider
- type StatsProviderGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { NodeID uint64 NodeAddress string ClusterID string DataDir string GetSnapshot func() ([]byte, error) CommitApplier CommitApplier SnapshotApplier SnapshotApplier SnapshotNotifier SnapshotNotifier }
type LeaderFunc ¶
LeaderFunc is a function that will be run on the Leader node. LeaderFunc must stop as soon as the given context is cancelled.
type Membership ¶
type NodeConfig ¶
type NodeConfig struct { AppliedIndex uint64 DisableProposalForwarding bool LeaderFunc LeaderFunc }
type Peer ¶
Peer represents a remote raft peer
func (Peer) MarshalLogObject ¶
func (p Peer) MarshalLogObject(e zapcore.ObjectEncoder) error
type Peers ¶
type Peers []Peer
func (Peers) MarshalLogArray ¶
func (p Peers) MarshalLogArray(e zapcore.ArrayEncoder) error
type RaftNode ¶
type RaftNode struct {
// contains filtered or unexported fields
}
func NewNode ¶
func NewNode(config Config, mesh Membership, logger *zap.Logger) *RaftNode
NewNode initiates a raft instance and returns a committed log entry channel and error channel. Proposals for log updates are sent over the provided the proposal channel. All log entries are replayed over the commit channel, followed by a nil message (to indicate the channel is current), then new log entries. To shutdown, close proposeC and read errorC.
func (*RaftNode) AppliedIndex ¶ added in v1.8.26
func (*RaftNode) CommittedIndex ¶ added in v1.8.26
func (*RaftNode) GetMembers ¶
func (rc *RaftNode) GetMembers(ctx context.Context, in *api.GetMembersRequest) (*api.GetMembersResponse, error)
func (*RaftNode) GetStatus ¶
func (rc *RaftNode) GetStatus(ctx context.Context, in *api.GetStatusRequest) (*api.GetStatusResponse, error)
func (*RaftNode) GetTopology ¶ added in v1.9.0
func (rc *RaftNode) GetTopology(ctx context.Context, in *api.GetTopologyRequest) (*api.GetTopologyResponse, error)
func (*RaftNode) IsRemovedFromCluster ¶
func (*RaftNode) JoinCluster ¶
func (rc *RaftNode) JoinCluster(ctx context.Context, in *api.RaftContext) (*api.JoinClusterResponse, error)
func (*RaftNode) ProcessMessage ¶
func (*RaftNode) PromoteMember ¶ added in v1.9.0
func (rc *RaftNode) PromoteMember(ctx context.Context, in *api.RaftContext) (*api.PromoteMemberResponse, error)
func (*RaftNode) RemoveMember ¶ added in v1.8.16
func (rc *RaftNode) RemoveMember(ctx context.Context, message *api.RemoveMemberRequest) (*api.RemoveMemberResponse, error)
func (*RaftNode) ReportNewPeer ¶
func (*RaftNode) ReportSnapshot ¶
func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)
func (*RaftNode) ReportUnreachable ¶
type SnapshotApplier ¶ added in v1.8.0
type SnapshotNotifier ¶ added in v1.8.20
SnapshotNotifier is called when a raft snapshot is created, and inform application to sync its state.
type StableStorage ¶ added in v1.8.31
type StatsProvider ¶
type StatsProvider interface {
Histogram(name string) *prometheus.Histogram
}
type StatsProviderGetter ¶
type StatsProviderGetter func() StatsProvider
Click to show internal directories.
Click to hide internal directories.