mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-13 01:18:49 +00:00
- Added ClusterDiscoveryService to manage peer discovery and synchronization for RQLite nodes. - Introduced new configuration options for cluster synchronization intervals, peer inactivity limits, and minimum cluster size. - Enhanced validation logic to ensure proper configuration of cluster parameters. - Implemented metrics collection for cluster health and peer status, improving monitoring capabilities. - Updated RQLiteManager to integrate with the new discovery service, allowing for dynamic leadership and cluster joining logic.
23 lines
1017 B
Go
23 lines
1017 B
Go
package discovery
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// RQLiteNodeMetadata contains RQLite-specific information announced via LibP2P
|
|
type RQLiteNodeMetadata struct {
|
|
NodeID string `json:"node_id"` // RQLite node ID (from config)
|
|
RaftAddress string `json:"raft_address"` // Raft port address (e.g., "51.83.128.181:7001")
|
|
HTTPAddress string `json:"http_address"` // HTTP API address (e.g., "51.83.128.181:5001")
|
|
NodeType string `json:"node_type"` // "bootstrap" or "node"
|
|
RaftLogIndex uint64 `json:"raft_log_index"` // Current Raft log index (for data comparison)
|
|
LastSeen time.Time `json:"last_seen"` // Updated on every announcement
|
|
ClusterVersion string `json:"cluster_version"` // For compatibility checking
|
|
}
|
|
|
|
// PeerExchangeResponseV2 extends the original response with RQLite metadata
|
|
type PeerExchangeResponseV2 struct {
|
|
Peers []PeerInfo `json:"peers"`
|
|
RQLiteMetadata *RQLiteNodeMetadata `json:"rqlite_metadata,omitempty"`
|
|
}
|