代码拉取完成,页面将自动刷新
package raft
const (
StateChangeEventType = "stateChange"
LeaderChangeEventType = "leaderChange"
TermChangeEventType = "termChange"
CommitEventType = "commit"
AddPeerEventType = "addPeer"
RemovePeerEventType = "removePeer"
RemovedEventType = "removed"
HeartbeatIntervalEventType = "heartbeatInterval"
ElectionTimeoutThresholdEventType = "electionTimeoutThreshold"
HeartbeatEventType = "heartbeat"
)
// Event represents an action that occurred within the Raft library.
// Listeners can subscribe to event types by using the Server.AddEventListener() function.
type Event interface {
Type() string
Source() interface{}
Value() interface{}
PrevValue() interface{}
}
// event is the concrete implementation of the Event interface.
type event struct {
typ string
source interface{}
value interface{}
prevValue interface{}
}
// newEvent creates a new event.
func newEvent(typ string, value interface{}, prevValue interface{}) *event {
return &event{
typ: typ,
value: value,
prevValue: prevValue,
}
}
// Type returns the type of event that occurred.
func (e *event) Type() string {
return e.typ
}
// Source returns the object that dispatched the event.
func (e *event) Source() interface{} {
return e.source
}
// Value returns the current value associated with the event, if applicable.
func (e *event) Value() interface{} {
return e.value
}
// PrevValue returns the previous value associated with the event, if applicable.
func (e *event) PrevValue() interface{} {
return e.prevValue
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。