cluster

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NodeEventType_name = map[NodeEventType]string{
		NodeEventTypeUnknown: "unknown",
		NodeEventTypeJoin:    "join",
		NodeEventTypeLeave:   "leave",
		NodeEventTypeUpdate:  "update",
	}
	NodeEventType_value = map[string]NodeEventType{
		"unknown": NodeEventTypeUnknown,
		"join":    NodeEventTypeJoin,
		"leave":   NodeEventTypeLeave,
		"update":  NodeEventTypeUpdate,
	}
)

Enum value maps for NodeEventType.

View Source
var (
	NodeState_name = map[NodeState]string{
		NodeStateUnknown: "unknown",
		NodeStateAlive:   "alive",
		NodeStateSuspect: "suspect",
		NodeStateDead:    "dead",
		NodeStateLeft:    "left",
	}
	NodeState_value = map[string]NodeState{
		"unknown": NodeStateUnknown,
		"alive":   NodeStateAlive,
		"suspect": NodeStateSuspect,
		"dead":    NodeStateDead,
		"left":    NodeStateLeft,
	}
)

Enum value maps for NodeState.

View Source
var (
	NodeRole_name = map[NodeRole]string{
		NodeRoleUnknown:  "unknown",
		NodeRoleIndexer:  "indexer",
		NodeRoleSearcher: "searcher",
	}
	NodeRole_value = map[string]NodeRole{
		"unknown":  NodeRoleUnknown,
		"indexer":  NodeRoleIndexer,
		"searcher": NodeRoleSearcher,
	}
)

Enum value maps for NodeRole.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(host string, bindPort int, nodeMetadata NodeMetadata, isSeedNode bool, logger *zap.Logger) (*Cluster, error)

func (*Cluster) ClusterEvents

func (c *Cluster) ClusterEvents() <-chan ClusterEvent

func (*Cluster) IsIndexer

func (c *Cluster) IsIndexer() bool

func (*Cluster) IsSearcher

func (c *Cluster) IsSearcher() bool

func (*Cluster) IsSeedNode

func (c *Cluster) IsSeedNode() bool

func (*Cluster) Join

func (c *Cluster) Join(seeds []string) (int, error)

func (*Cluster) Leave

func (c *Cluster) Leave(timeout time.Duration) error

func (*Cluster) LocalNodeMetadata

func (c *Cluster) LocalNodeMetadata() (*NodeMetadata, error)

func (*Cluster) LocalNodeName

func (c *Cluster) LocalNodeName() string

func (*Cluster) LookupIndexer

func (c *Cluster) LookupIndexer(key string) string

func (*Cluster) LookupSearchers

func (c *Cluster) LookupSearchers(key string, numNodes int) []string

func (*Cluster) NodeAddress

func (c *Cluster) NodeAddress(nodeName string) (string, error)

func (*Cluster) NodeMetadata

func (c *Cluster) NodeMetadata(nodeName string) (*NodeMetadata, error)

func (*Cluster) NodePort

func (c *Cluster) NodePort(nodeName string) (uint16, error)

func (*Cluster) NodeState

func (c *Cluster) NodeState(nodeName string) (NodeState, error)

func (*Cluster) Nodes

func (c *Cluster) Nodes() []string

func (*Cluster) Start

func (c *Cluster) Start() error

func (*Cluster) Stop

func (c *Cluster) Stop() error

type ClusterEvent

type ClusterEvent struct {
	NodeEvent NodeEvent
	Members   []string
}

type NodeEvent

type NodeEvent struct {
	Type         NodeEventType
	NodeName     string
	NodeMetadata *NodeMetadata
	NodeState    NodeState
}

type NodeEventDelegate

type NodeEventDelegate struct {
	NodeEvents chan NodeEvent
	// contains filtered or unexported fields
}

func NewNodeEventDelegate

func NewNodeEventDelegate(logger *zap.Logger) *NodeEventDelegate

func (*NodeEventDelegate) NotifyJoin

func (d *NodeEventDelegate) NotifyJoin(node *memberlist.Node)

func (*NodeEventDelegate) NotifyLeave

func (d *NodeEventDelegate) NotifyLeave(node *memberlist.Node)

func (*NodeEventDelegate) NotifyUpdate

func (d *NodeEventDelegate) NotifyUpdate(node *memberlist.Node)

type NodeEventType

type NodeEventType int
const (
	NodeEventTypeUnknown NodeEventType = iota
	NodeEventTypeJoin
	NodeEventTypeLeave
	NodeEventTypeUpdate
)

type NodeMetadata

type NodeMetadata struct {
	GrpcPort int        `json:"grpc_port"`
	HttpPort int        `json:"http_port"`
	Roles    []NodeRole `json:"roles"`
}

func NewNodeMetadata

func NewNodeMetadata() *NodeMetadata

func NewNodeMetadataWithBytes

func NewNodeMetadataWithBytes(data []byte) (*NodeMetadata, error)

func (*NodeMetadata) IsIndexer

func (m *NodeMetadata) IsIndexer() bool

func (*NodeMetadata) IsSearcher

func (m *NodeMetadata) IsSearcher() bool

func (*NodeMetadata) Marshal

func (m *NodeMetadata) Marshal() ([]byte, error)

type NodeMetadataDelegate

type NodeMetadataDelegate struct {
	// contains filtered or unexported fields
}

func NewNodeMetadataDelegate

func NewNodeMetadataDelegate(metadata NodeMetadata, logger *zap.Logger) *NodeMetadataDelegate

func (*NodeMetadataDelegate) GetBroadcasts

func (d *NodeMetadataDelegate) GetBroadcasts(overhead, limit int) [][]byte

func (*NodeMetadataDelegate) LocalState

func (d *NodeMetadataDelegate) LocalState(join bool) []byte

func (*NodeMetadataDelegate) MergeRemoteState

func (d *NodeMetadataDelegate) MergeRemoteState(buf []byte, join bool)

func (*NodeMetadataDelegate) NodeMeta

func (d *NodeMetadataDelegate) NodeMeta(limit int) []byte

func (*NodeMetadataDelegate) NotifyMsg

func (d *NodeMetadataDelegate) NotifyMsg(msg []byte)

type NodeRole

type NodeRole int
const (
	NodeRoleUnknown NodeRole = iota
	NodeRoleIndexer
	NodeRoleSearcher
)

type NodeState

type NodeState int
const (
	NodeStateUnknown NodeState = iota
	NodeStateAlive
	NodeStateSuspect
	NodeStateDead
	NodeStateLeft
)

Jump to

Keyboard shortcuts

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