coordinator

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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.

type StateType added in v1.0.0

type StateType byte

StateType represents a coordinator state type.

const (
	// NodeState represents a node state.
	NodeState StateType = 'N'
)

func (StateType) String added in v1.0.0

func (t StateType) String() string

String returns the string representation of the state type.

Directories

Path Synopsis
fdb

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL