Documentation ¶
Index ¶
Constants ¶
const (
DefaultStoreScanInterval = time.Second
)
Variables ¶
This section is empty.
Functions ¶
func NewClusterScanKeyWith ¶ added in v1.0.0
func NewClusterScanKeyWith(cluster string) coordinator.Key
NewClusterScanKeyWith returns a new scan node key to get all node states with the specified cluster.
func NewNodeKeyWith ¶ added in v1.0.0
func NewNodeKeyWith(node cluster.Node) coordinator.Key
NewNodeKeyWith returns a new node key with the specified node.
func NewNodeScanKey ¶ added in v1.0.0
func NewNodeScanKey() coordinator.Key
NewNodeScanKey returns a new scan node key to get all node states.
func NewNodeWith ¶ added in v1.0.0
func NewNodeWith(obj *NodeObject) (cluster.Node, error)
NewNodeWith returns a new node with the specified node object.
Types ¶
type MessageQueue ¶ added in v1.0.0
type MessageQueue struct {
// contains filtered or unexported fields
}
MessageQueue is a queue for coordinator message.
func NewMessageQueue ¶ added in v1.0.0
func NewMessageQueue() *MessageQueue
NewMessageQueue returns a new messageQueue.
func (*MessageQueue) EnqueueMessage ¶ added in v1.0.0
func (q *MessageQueue) EnqueueMessage(msg coordinator.Message)
EnqueueMessage appends a message to the queue.
func (*MessageQueue) PopMessage ¶ added in v1.0.0
func (q *MessageQueue) PopMessage() (coordinator.Message, error)
PopMessage removes a message from the queue.
func (*MessageQueue) PushMessage ¶ added in v1.0.0
func (q *MessageQueue) PushMessage(msg coordinator.Message)
PushMessage pushes a message to the queue.
type NodeObject ¶ added in v1.0.0
type NodeObject struct { ID string Cluster string Host string Clock uint64 Time time.Time Status string }
NodeObject represents a store node state object.
func NewNodeObject ¶ added in v1.0.0
func NewNodeObject() *NodeObject
NewNodeObject returns a new node object.
func NewNodeObjectWith ¶ added in v1.0.0
func NewNodeObjectWith(node cluster.Node) *NodeObject
NewNodeObjectWith returns a new node object with the specified node.
type Service ¶
type Service interface { coordinator.Coordinator plugins.Service // SetNodeState posts the specified node status to the coordinator. SetNodeState(node cluster.Node) error // GetClusterState gets the current cluster state. GetClusterState(cluster string) (cluster.Cluster, error) }
Service is an interface for the coordinator service.
func NewServiceWith ¶
func NewServiceWith(service core.CoordinatorService) Service
NewService returns a new coordinator service with the specified core coordinator service.