Documentation
¶
Index ¶
- type Manager
- func (m *Manager) CheckHealth() (bool, error)
- func (m *Manager) Close() error
- func (m *Manager) CloseManager() error
- func (m *Manager) GetNodeByAddress(ctx context.Context, address string) (*NodeInfo, error)
- func (m *Manager) GetNodeByHostname(ctx context.Context, hostname string) (*NodeInfo, error)
- func (m *Manager) GetNodeByID(ctx context.Context, nodeID string) (*NodeInfo, error)
- func (m *Manager) GetNodeDetails() ([]NodeInfo, error)
- func (m *Manager) GetNodeID() string
- func (m *Manager) GetNodes(ctx context.Context) ([]*NodeInfo, error)
- func (m *Manager) InitMembershipProtocol() error
- func (m *Manager) JoinCluster(host string) error
- func (m *Manager) LeaveCluster() error
- func (m *Manager) ListNodes(ctx context.Context) ([]interface{}, error)
- func (m *Manager) RegisterNode(ctx context.Context, nodeInfo *NodeInfo) error
- func (m *Manager) RemoveNode(ctx context.Context, nodeID string) error
- func (m *Manager) SetNetworkManager(networkManager interface{})
- func (m *Manager) StartDiscovery() error
- func (m *Manager) StartHealthMonitoring(ctx context.Context, interval time.Duration)
- func (m *Manager) UpdateNodeResources(ctx context.Context, nodeID string, resources Resources) error
- func (m *Manager) UpdateNodeStatus(ctx context.Context, nodeID string, status NodeStatus) error
- func (m *Manager) WithMembership(membership MembershipManagerInterface) *Manager
- func (m *Manager) WithMembershipManager(membershipManager MembershipManagerInterface) *Manager
- func (m *Manager) WithStorage(storage *storage.Manager) *Manager
- type MembershipManagerInterface
- type NodeHealth
- type NodeInfo
- type NodeResources
- type NodeStatus
- type Resources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles node management and health checking
func NewManager ¶
NewManager creates a new node manager
func (*Manager) CheckHealth ¶
CheckHealth checks the health of the node
func (*Manager) CloseManager ¶
CloseManager closes the node manager and releases any resources
func (*Manager) GetNodeByAddress ¶
GetNodeByAddress returns a node by its address
func (*Manager) GetNodeByHostname ¶
GetNodeByHostname returns a node by its hostname
func (*Manager) GetNodeByID ¶
GetNodeByID returns a node by its ID
func (*Manager) GetNodeDetails ¶
GetNodeDetails returns details about all known nodes
func (*Manager) InitMembershipProtocol ¶
InitMembershipProtocol initializes the membership protocol
func (*Manager) JoinCluster ¶
JoinCluster joins an existing cluster
func (*Manager) LeaveCluster ¶
LeaveCluster gracefully leaves the cluster
func (*Manager) RegisterNode ¶
RegisterNode registers a node with the manager
func (*Manager) RemoveNode ¶
RemoveNode removes a node from the cluster
func (*Manager) SetNetworkManager ¶
func (m *Manager) SetNetworkManager(networkManager interface{})
SetNetworkManager sets the network manager
func (*Manager) StartDiscovery ¶
StartDiscovery starts the node discovery service
func (*Manager) StartHealthMonitoring ¶
StartHealthMonitoring starts periodic health monitoring
func (*Manager) UpdateNodeResources ¶
func (m *Manager) UpdateNodeResources(ctx context.Context, nodeID string, resources Resources) error
UpdateNodeResources updates the resources of a node
func (*Manager) UpdateNodeStatus ¶
UpdateNodeStatus updates the status of a node
func (*Manager) WithMembership ¶
func (m *Manager) WithMembership(membership MembershipManagerInterface) *Manager
WithMembership sets the membership manager
func (*Manager) WithMembershipManager ¶
func (m *Manager) WithMembershipManager(membershipManager MembershipManagerInterface) *Manager
WithMembershipManager sets the membership manager and returns the manager for chaining
type MembershipManagerInterface ¶
type MembershipManagerInterface interface {
Join(addresses []string) (int, error)
Leave(timeout time.Duration) error
GetMembers(ctx context.Context) ([]string, error)
RemoveMember(ctx context.Context, nodeID string) error
AddMember(nodeID string, address string)
}
MembershipManagerInterface defines the interface for membership manager
type NodeHealth ¶
type NodeHealth struct {
IsHealthy bool
LastCheck time.Time
CheckCount uint32
FailureCount uint32
MaxFailureThreshold uint32
}
NodeHealth represents the health status of a node
type NodeInfo ¶
type NodeInfo struct {
ID string
Address string
LastSeen time.Time
Resources NodeResources
Status NodeStatus
Hostname string
}
NodeInfo represents information about a node
type NodeResources ¶
type NodeResources struct {
CPUAvailable float64
MemoryAvailable uint64
ContainersRunning uint32
IsLeader bool
CPU int
Memory int
Disk int64
}
NodeResources represents the resources available on a node
type NodeStatus ¶
type NodeStatus string
NodeStatus represents the status of a node
const ( // NodeStatusReady indicates the node is ready to accept workloads NodeStatusReady NodeStatus = "ready" // NodeStatusMaintenance indicates the node is in maintenance mode NodeStatusMaintenance NodeStatus = "maintenance" // NodeStatusOffline indicates the node is offline NodeStatusOffline NodeStatus = "offline" // NodeStatusError indicates the node is in an error state NodeStatusError NodeStatus = "error" )