Documentation
ΒΆ
Index ΒΆ
- type Cluster
- type ClusterHealthChangeHook
- type ClusterHealthEvent
- type ClusterKit
- func (ck *ClusterKit) CreatePartitions() error
- func (ck *ClusterKit) CreatePartitionsContext(ctx context.Context) error
- func (ck *ClusterKit) DeleteCustomData(key string) error
- func (ck *ClusterKit) DeleteCustomDataContext(ctx context.Context, key string) error
- func (ck *ClusterKit) GetAllNodesForKey(key string) (primary *Node, replicas []Node, err error)
- func (ck *ClusterKit) GetCluster() *Cluster
- func (ck *ClusterKit) GetConsensusManager() *ConsensusManager
- func (ck *ClusterKit) GetCustomData(key string) ([]byte, error)
- func (ck *ClusterKit) GetCustomDataContext(ctx context.Context, key string) ([]byte, error)
- func (ck *ClusterKit) GetMetrics() *Metrics
- func (ck *ClusterKit) GetMyNodeID() string
- func (ck *ClusterKit) GetNodes(partition *Partition) []Node
- func (ck *ClusterKit) GetPartition(key string) (*Partition, error)
- func (ck *ClusterKit) GetPartitionStats() *PartitionStats
- func (ck *ClusterKit) GetPartitionsForNode(nodeID string) []*Partition
- func (ck *ClusterKit) GetPrimary(partition *Partition) *Node
- func (ck *ClusterKit) GetPrimaryNode(key string) (*Node, error)
- func (ck *ClusterKit) GetReplicaNodes(key string) ([]Node, error)
- func (ck *ClusterKit) GetReplicas(partition *Partition) []Node
- func (ck *ClusterKit) HealthCheck() *HealthStatus
- func (ck *ClusterKit) IsPrimary(partition *Partition) bool
- func (ck *ClusterKit) IsReplica(partition *Partition) bool
- func (ck *ClusterKit) ListCustomDataKeys() []string
- func (ck *ClusterKit) ListPartitions() []*Partition
- func (ck *ClusterKit) OnClusterHealthChange(hook ClusterHealthChangeHook)
- func (ck *ClusterKit) OnNodeJoin(hook NodeJoinHook)
- func (ck *ClusterKit) OnNodeLeave(hook NodeLeaveHook)
- func (ck *ClusterKit) OnNodeRejoin(hook NodeRejoinHook)
- func (ck *ClusterKit) OnPartitionChange(hook PartitionChangeHook)
- func (ck *ClusterKit) OnRebalanceComplete(hook RebalanceCompleteHook)
- func (ck *ClusterKit) OnRebalanceStart(hook RebalanceStartHook)
- func (ck *ClusterKit) RebalancePartitions() error
- func (ck *ClusterKit) RebalancePartitionsContext(ctx context.Context) error
- func (ck *ClusterKit) SetCustomData(key string, value []byte) error
- func (ck *ClusterKit) SetCustomDataContext(ctx context.Context, key string, value []byte) error
- func (ck *ClusterKit) Start() error
- func (ck *ClusterKit) Stop() error
- type Config
- type ConsensusManager
- func (cm *ConsensusManager) AddVoter(nodeID, address string) error
- func (cm *ConsensusManager) GetCurrentTerm() uint64
- func (cm *ConsensusManager) GetLeader() (*LeaderInfo, error)
- func (cm *ConsensusManager) GetStats() *ConsensusStats
- func (cm *ConsensusManager) IsLeader() bool
- func (cm *ConsensusManager) ProposeAction(action string, data interface{}) error
- func (cm *ConsensusManager) RemoveServer(nodeID string) error
- func (cm *ConsensusManager) Start() error
- func (cm *ConsensusManager) Stop() error
- func (cm *ConsensusManager) WaitForLeader(timeout time.Duration) error
- type ConsensusStats
- type DefaultLogger
- type HealthCheckConfig
- type HealthChecker
- type HealthStatus
- type HookManager
- type LeaderInfo
- type LogEntry
- type LogLevel
- type Logger
- type Metrics
- type NoOpLogger
- type Node
- type NodeHealth
- type NodeJoinEvent
- type NodeJoinHook
- type NodeLeaveEvent
- type NodeLeaveHook
- type NodeRejoinEvent
- type NodeRejoinHook
- type Options
- type Partition
- type PartitionChangeEvent
- type PartitionChangeHook
- type PartitionManager
- type PartitionMap
- type PartitionStats
- type RebalanceCompleteHook
- type RebalanceEvent
- type RebalanceStartHook
- type Result
- type WALEntry
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Cluster ΒΆ
type Cluster struct {
ID string `json:"id"`
Name string `json:"name"`
Nodes []Node `json:"nodes"`
NodeMap map[string]*Node `json:"-"` // O(1) node lookup by ID
PartitionMap *PartitionMap `json:"partition_map"`
Config *Config `json:"config"`
CustomData map[string][]byte `json:"custom_data,omitempty"` // Application-specific data replicated via Raft
}
Cluster represents the entire distributed cluster
func (*Cluster) GetNodeByID ΒΆ
GetNodeByID returns a node by ID - O(1) using NodeMap
func (*Cluster) RemoveNode ΒΆ
type ClusterHealthChangeHook ΒΆ
type ClusterHealthChangeHook func(event *ClusterHealthEvent)
ClusterHealthChangeHook is called when cluster health status changes
type ClusterHealthEvent ΒΆ
type ClusterHealthEvent struct {
HealthyNodes int // Number of healthy nodes
UnhealthyNodes int // Number of unhealthy nodes
TotalNodes int // Total nodes in cluster
Status string // "healthy", "degraded", "critical"
UnhealthyNodeIDs []string // IDs of unhealthy nodes
Timestamp time.Time // When health changed
}
ClusterHealthEvent represents cluster health status change
type ClusterKit ΒΆ
type ClusterKit struct {
// contains filtered or unexported fields
}
ClusterKit is the main entry point for the library
func (*ClusterKit) CreatePartitions ΒΆ
func (ck *ClusterKit) CreatePartitions() error
CreatePartitions initializes partitions and assigns them to nodes
func (*ClusterKit) CreatePartitionsContext ΒΆ
func (ck *ClusterKit) CreatePartitionsContext(ctx context.Context) error
CreatePartitionsContext initializes partitions with context support
func (*ClusterKit) DeleteCustomData ΒΆ
func (ck *ClusterKit) DeleteCustomData(key string) error
DeleteCustomData removes custom data from all nodes via Raft consensus This operation goes through Raft consensus and will fail if this node is not the leader
func (*ClusterKit) DeleteCustomDataContext ΒΆ
func (ck *ClusterKit) DeleteCustomDataContext(ctx context.Context, key string) error
DeleteCustomDataContext removes custom data with context support This operation goes through Raft consensus and will fail if this node is not the leader
func (*ClusterKit) GetAllNodesForKey ΒΆ
func (ck *ClusterKit) GetAllNodesForKey(key string) (primary *Node, replicas []Node, err error)
GetAllNodesForKey returns primary + all replica nodes for a key
func (*ClusterKit) GetCluster ΒΆ
func (ck *ClusterKit) GetCluster() *Cluster
GetCluster returns the current cluster state
func (*ClusterKit) GetConsensusManager ΒΆ
func (ck *ClusterKit) GetConsensusManager() *ConsensusManager
GetConsensusManager returns the consensus manager
func (*ClusterKit) GetCustomData ΒΆ
func (ck *ClusterKit) GetCustomData(key string) ([]byte, error)
GetCustomData retrieves custom data from the local cluster state This is a local read operation and does not require consensus Returns an error if the key is not found
func (*ClusterKit) GetCustomDataContext ΒΆ
GetCustomDataContext retrieves custom data with context support This is a local read operation and does not require consensus Returns an error if the key is not found
func (*ClusterKit) GetMetrics ΒΆ
func (ck *ClusterKit) GetMetrics() *Metrics
GetMetrics returns current cluster metrics
func (*ClusterKit) GetMyNodeID ΒΆ
func (ck *ClusterKit) GetMyNodeID() string
GetMyNodeID returns the current node's ID
func (*ClusterKit) GetNodes ΒΆ
func (ck *ClusterKit) GetNodes(partition *Partition) []Node
GetNodes returns all nodes (primary + replicas) for a partition Time Complexity: O(R) where R = replication factor
func (*ClusterKit) GetPartition ΒΆ
func (ck *ClusterKit) GetPartition(key string) (*Partition, error)
GetPartition determines which partition a key belongs to
func (*ClusterKit) GetPartitionStats ΒΆ
func (ck *ClusterKit) GetPartitionStats() *PartitionStats
GetPartitionStats returns partition distribution statistics
func (*ClusterKit) GetPartitionsForNode ΒΆ
func (ck *ClusterKit) GetPartitionsForNode(nodeID string) []*Partition
GetPartitionsForNode returns all partitions where the node is primary or replica
func (*ClusterKit) GetPrimary ΒΆ
func (ck *ClusterKit) GetPrimary(partition *Partition) *Node
GetPrimary returns the primary node for a partition Time Complexity: O(1)
func (*ClusterKit) GetPrimaryNode ΒΆ
func (ck *ClusterKit) GetPrimaryNode(key string) (*Node, error)
GetPrimaryNode returns the primary node for a given key
func (*ClusterKit) GetReplicaNodes ΒΆ
func (ck *ClusterKit) GetReplicaNodes(key string) ([]Node, error)
GetReplicaNodes returns all replica nodes for a given key This is a convenience function for developers to implement replication
func (*ClusterKit) GetReplicas ΒΆ
func (ck *ClusterKit) GetReplicas(partition *Partition) []Node
GetReplicas returns the replica nodes for a partition Time Complexity: O(R) where R = replication factor
func (*ClusterKit) HealthCheck ΒΆ
func (ck *ClusterKit) HealthCheck() *HealthStatus
HealthCheck returns detailed health status
func (*ClusterKit) IsPrimary ΒΆ
func (ck *ClusterKit) IsPrimary(partition *Partition) bool
IsPrimary checks if the current node is the primary for a partition
func (*ClusterKit) IsReplica ΒΆ
func (ck *ClusterKit) IsReplica(partition *Partition) bool
IsReplica checks if the current node is a replica for a partition
func (*ClusterKit) ListCustomDataKeys ΒΆ
func (ck *ClusterKit) ListCustomDataKeys() []string
ListCustomDataKeys returns all custom data keys currently stored in the cluster This is a local read operation and does not require consensus
func (*ClusterKit) ListPartitions ΒΆ
func (ck *ClusterKit) ListPartitions() []*Partition
ListPartitions returns all partitions
func (*ClusterKit) OnClusterHealthChange ΒΆ
func (ck *ClusterKit) OnClusterHealthChange(hook ClusterHealthChangeHook)
OnClusterHealthChange registers a callback for cluster health changes
func (*ClusterKit) OnNodeJoin ΒΆ
func (ck *ClusterKit) OnNodeJoin(hook NodeJoinHook)
OnNodeJoin registers a callback for when a NEW node joins
func (*ClusterKit) OnNodeLeave ΒΆ
func (ck *ClusterKit) OnNodeLeave(hook NodeLeaveHook)
OnNodeLeave registers a callback for when a node leaves/is removed
func (*ClusterKit) OnNodeRejoin ΒΆ
func (ck *ClusterKit) OnNodeRejoin(hook NodeRejoinHook)
OnNodeRejoin registers a callback for when a node REJOINS after being offline
func (*ClusterKit) OnPartitionChange ΒΆ
func (ck *ClusterKit) OnPartitionChange(hook PartitionChangeHook)
OnPartitionChange registers a callback for partition changes
func (*ClusterKit) OnRebalanceComplete ΒΆ
func (ck *ClusterKit) OnRebalanceComplete(hook RebalanceCompleteHook)
OnRebalanceComplete registers a callback for when rebalancing completes
func (*ClusterKit) OnRebalanceStart ΒΆ
func (ck *ClusterKit) OnRebalanceStart(hook RebalanceStartHook)
OnRebalanceStart registers a callback for when rebalancing starts
func (*ClusterKit) RebalancePartitions ΒΆ
func (ck *ClusterKit) RebalancePartitions() error
RebalancePartitions redistributes partitions when nodes join or leave
func (*ClusterKit) RebalancePartitionsContext ΒΆ
func (ck *ClusterKit) RebalancePartitionsContext(ctx context.Context) error
RebalancePartitionsContext redistributes partitions with context support
func (*ClusterKit) SetCustomData ΒΆ
func (ck *ClusterKit) SetCustomData(key string, value []byte) error
SetCustomData stores custom data that will be replicated across all nodes via Raft consensus The data is stored as raw bytes, allowing any serialization format (JSON, protobuf, msgpack, etc.) This operation goes through Raft consensus and will fail if this node is not the leader Maximum value size is 1MB to prevent excessive memory usage
func (*ClusterKit) SetCustomDataContext ΒΆ
SetCustomDataContext stores custom data with context support for cancellation The data is stored as raw bytes, allowing any serialization format (JSON, protobuf, msgpack, etc.) This operation goes through Raft consensus and will fail if this node is not the leader Maximum value size is 1MB to prevent excessive memory usage
func (*ClusterKit) Start ΒΆ
func (ck *ClusterKit) Start() error
Start begins the ClusterKit operations
type Config ΒΆ
type Config struct {
ClusterName string `json:"cluster_name"`
PartitionCount int `json:"partition_count"`
ReplicationFactor int `json:"replication_factor"`
}
Config holds cluster configuration
type ConsensusManager ΒΆ
type ConsensusManager struct {
// contains filtered or unexported fields
}
ConsensusManager handles leader election and consensus using Raft
func NewConsensusManager ΒΆ
func NewConsensusManager(ck *ClusterKit, bootstrap bool, raftAddr string) *ConsensusManager
NewConsensusManager creates a new consensus manager with Raft
func (*ConsensusManager) AddVoter ΒΆ
func (cm *ConsensusManager) AddVoter(nodeID, address string) error
AddVoter adds a new voting member to the Raft cluster
func (*ConsensusManager) GetCurrentTerm ΒΆ
func (cm *ConsensusManager) GetCurrentTerm() uint64
GetCurrentTerm returns the current election term
func (*ConsensusManager) GetLeader ΒΆ
func (cm *ConsensusManager) GetLeader() (*LeaderInfo, error)
GetLeader returns the current leader information
func (*ConsensusManager) GetStats ΒΆ
func (cm *ConsensusManager) GetStats() *ConsensusStats
GetStats returns consensus statistics from Raft
func (*ConsensusManager) IsLeader ΒΆ
func (cm *ConsensusManager) IsLeader() bool
IsLeader returns whether this node is the current leader
func (*ConsensusManager) ProposeAction ΒΆ
func (cm *ConsensusManager) ProposeAction(action string, data interface{}) error
ProposeAction proposes an action through Raft consensus
func (*ConsensusManager) RemoveServer ΒΆ
func (cm *ConsensusManager) RemoveServer(nodeID string) error
RemoveServer removes a server from the Raft cluster
func (*ConsensusManager) Start ΒΆ
func (cm *ConsensusManager) Start() error
Start begins the consensus manager with Raft
func (*ConsensusManager) Stop ΒΆ
func (cm *ConsensusManager) Stop() error
Stop stops the consensus manager
func (*ConsensusManager) WaitForLeader ΒΆ
func (cm *ConsensusManager) WaitForLeader(timeout time.Duration) error
WaitForLeader waits until a leader is elected or timeout
type ConsensusStats ΒΆ
type ConsensusStats struct {
State string `json:"state"`
Term uint64 `json:"term"`
LastLogIndex uint64 `json:"last_log_index"`
LastLogTerm uint64 `json:"last_log_term"`
CommitIndex uint64 `json:"commit_index"`
AppliedIndex uint64 `json:"applied_index"`
NumPeers int `json:"num_peers"`
Leader string `json:"leader"`
}
ConsensusStats returns consensus statistics
type DefaultLogger ΒΆ
type DefaultLogger struct {
// contains filtered or unexported fields
}
DefaultLogger implements Logger using standard library
func NewDefaultLogger ΒΆ
func NewDefaultLogger(level LogLevel) *DefaultLogger
NewDefaultLogger creates a new default logger
func (*DefaultLogger) Debug ΒΆ
func (l *DefaultLogger) Debug(msg string, args ...interface{})
func (*DefaultLogger) Error ΒΆ
func (l *DefaultLogger) Error(msg string, args ...interface{})
func (*DefaultLogger) Info ΒΆ
func (l *DefaultLogger) Info(msg string, args ...interface{})
func (*DefaultLogger) Warn ΒΆ
func (l *DefaultLogger) Warn(msg string, args ...interface{})
type HealthCheckConfig ΒΆ
type HealthCheckConfig struct {
Enabled bool // Enable automatic health checking
Interval time.Duration // How often to check (default: 5s)
Timeout time.Duration // Request timeout (default: 2s)
FailureThreshold int // Failures before removal (default: 3)
}
HealthCheckConfig configures the health checker
type HealthChecker ΒΆ
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker monitors node health and triggers removal on failures
func NewHealthChecker ΒΆ
func NewHealthChecker(ck *ClusterKit, config HealthCheckConfig) *HealthChecker
NewHealthChecker creates a new health checker
func (*HealthChecker) GetNodeHealth ΒΆ
func (hc *HealthChecker) GetNodeHealth() map[string]NodeHealth
GetNodeHealth returns health status of all nodes
type HealthStatus ΒΆ
type HealthStatus struct {
Healthy bool `json:"healthy"`
NodeID string `json:"node_id"`
NodeName string `json:"node_name"`
IsLeader bool `json:"is_leader"`
NodeCount int `json:"node_count"`
PartitionCount int `json:"partition_count"`
RaftState string `json:"raft_state"`
LastSync time.Time `json:"last_sync"`
Uptime string `json:"uptime"`
}
HealthStatus represents detailed health information
type HookManager ΒΆ
type HookManager struct {
// contains filtered or unexported fields
}
HookManager manages all cluster event hooks
type LeaderInfo ΒΆ
type LeaderInfo struct {
LeaderID string `json:"leader_id"`
LeaderName string `json:"leader_name"`
LeaderIP string `json:"leader_ip"`
Term uint64 `json:"term"`
ElectedAt time.Time `json:"elected_at"`
}
LeaderInfo contains information about the current leader
type LogEntry ΒΆ
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message"`
}
LogEntry represents a log entry
type Logger ΒΆ
type Logger interface {
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
Debug(msg string, args ...interface{})
}
Logger interface for structured logging
type Metrics ΒΆ
type Metrics struct {
NodeCount int `json:"node_count"`
PartitionCount int `json:"partition_count"`
RequestCount int64 `json:"request_count"`
ErrorCount int64 `json:"error_count"`
LastSync time.Time `json:"last_sync"`
IsLeader bool `json:"is_leader"`
RaftState string `json:"raft_state"`
UptimeSeconds int64 `json:"uptime_seconds"`
}
Metrics represents cluster metrics and monitoring data
type NoOpLogger ΒΆ
type NoOpLogger struct{}
NoOpLogger is a logger that does nothing (for testing)
func (*NoOpLogger) Debug ΒΆ
func (l *NoOpLogger) Debug(msg string, args ...interface{})
func (*NoOpLogger) Error ΒΆ
func (l *NoOpLogger) Error(msg string, args ...interface{})
func (*NoOpLogger) Info ΒΆ
func (l *NoOpLogger) Info(msg string, args ...interface{})
func (*NoOpLogger) Warn ΒΆ
func (l *NoOpLogger) Warn(msg string, args ...interface{})
type Node ΒΆ
type Node struct {
ID string `json:"id"`
IP string `json:"ip"`
Port int `json:"port"`
Name string `json:"name"`
Status string `json:"status"`
Services map[string]string `json:"services,omitempty"` // Service name -> address mapping
}
Node represents a single node in the cluster
type NodeHealth ΒΆ
type NodeHealth struct {
NodeID string `json:"node_id"`
Failures int `json:"failures"`
LastSeen time.Time `json:"last_seen"`
Healthy bool `json:"healthy"`
}
NodeHealth represents health status of a node
type NodeJoinEvent ΒΆ
type NodeJoinEvent struct {
Node *Node // The joining node
ClusterSize int // Total nodes after join
IsBootstrap bool // Is this the first node?
Timestamp time.Time // When the node joined
}
NodeJoinEvent represents a node joining the cluster
type NodeJoinHook ΒΆ
type NodeJoinHook func(event *NodeJoinEvent)
NodeJoinHook is called when a new node joins the cluster
type NodeLeaveEvent ΒΆ
type NodeLeaveEvent struct {
Node *Node // Full node info (ID, IP, Name, Status)
Reason string // "health_check_failure", "graceful_shutdown", "removed_by_admin"
PartitionsOwned []string // Partitions this node was primary for
PartitionsReplica []string // Partitions this node was replica for
Timestamp time.Time // When it left
}
NodeLeaveEvent represents a node leaving the cluster
type NodeLeaveHook ΒΆ
type NodeLeaveHook func(event *NodeLeaveEvent)
NodeLeaveHook is called when a node leaves or is removed from the cluster
type NodeRejoinEvent ΒΆ
type NodeRejoinEvent struct {
Node *Node // The rejoining node
OfflineDuration time.Duration // How long it was offline
LastSeenAt time.Time // When it was last seen
PartitionsBeforeLeave []string // Partitions it had before leaving
Timestamp time.Time // When it rejoined
}
NodeRejoinEvent represents a node rejoining after being offline
type NodeRejoinHook ΒΆ
type NodeRejoinHook func(event *NodeRejoinEvent)
NodeRejoinHook is called when an existing node rejoins after being offline This fires BEFORE rebalancing - use for preparation (e.g., clearing stale data)
type Options ΒΆ
type Options struct {
// Required
NodeID string // Unique ID for this node (e.g., "node-1")
HTTPAddr string // Address to listen on (e.g., ":8080")
// Optional - Auto-generated if not provided
NodeName string // Human-readable name (default: auto-generated from NodeID)
RaftAddr string // Raft bind address (default: auto-calculated from HTTPAddr)
DataDir string // Directory to store state (default: "./clusterkit-data")
SyncInterval time.Duration // Sync interval (default: 5s)
// Cluster Configuration - Flattened (no nested Config struct)
ClusterName string // Name of the cluster (default: "clusterkit-cluster")
PartitionCount int // Number of partitions (default: 16)
ReplicationFactor int // Replication factor (default: 3)
// Cluster Formation
JoinAddr string // Address of existing node to join (empty for first node)
Bootstrap bool // Set to true for first node (default: auto-detect)
// Health Checking
HealthCheck HealthCheckConfig // Health check configuration
// Application Services
Services map[string]string // Service name -> address mapping (e.g., {"kv": ":9080", "api": ":3000"})
// Optional Logger
Logger Logger // Custom logger (default: DefaultLogger with Info level)
}
Options for initializing ClusterKit
type Partition ΒΆ
type Partition struct {
ID string `json:"id"`
PrimaryNode string `json:"primary_node"`
ReplicaNodes []string `json:"replica_nodes"`
}
Partition represents a data partition in the cluster
type PartitionChangeEvent ΒΆ
type PartitionChangeEvent struct {
PartitionID string // The partition that changed (e.g., "partition-5")
CopyFromNodes []*Node // Nodes to copy data from (all nodes that have the data)
CopyToNode *Node // Node that needs the data (YOU)
ChangeReason string // "node_join", "node_leave", "rebalance", "manual"
OldPrimary string // Previous primary node ID
NewPrimary string // New primary node ID
Timestamp time.Time // When the change occurred
}
PartitionChangeEvent represents a partition assignment change
type PartitionChangeHook ΒΆ
type PartitionChangeHook func(event *PartitionChangeEvent)
PartitionChangeHook is called when a partition assignment changes
type PartitionManager ΒΆ
type PartitionManager struct {
// contains filtered or unexported fields
}
PartitionManager provides thread-safe partition operations
func NewPartitionManager ΒΆ
func NewPartitionManager() *PartitionManager
NewPartitionManager creates a new partition manager
func (*PartitionManager) Add ΒΆ
func (pm *PartitionManager) Add(partition *Partition)
Add adds a partition
func (*PartitionManager) Get ΒΆ
func (pm *PartitionManager) Get(partitionID string) (*Partition, bool)
Get retrieves a partition
func (*PartitionManager) List ΒΆ
func (pm *PartitionManager) List() []*Partition
List returns all partitions
func (*PartitionManager) Remove ΒΆ
func (pm *PartitionManager) Remove(partitionID string)
Remove removes a partition
type PartitionMap ΒΆ
type PartitionMap struct {
Partitions map[string]*Partition `json:"partitions"`
// contains filtered or unexported fields
}
PartitionMap manages all partitions in the cluster
type PartitionStats ΒΆ
type PartitionStats struct {
TotalPartitions int `json:"total_partitions"`
PartitionsPerNode map[string]int `json:"partitions_per_node"`
ReplicasPerNode map[string]int `json:"replicas_per_node"`
}
PartitionStats returns statistics about partitions
type RebalanceCompleteHook ΒΆ
type RebalanceCompleteHook func(event *RebalanceEvent, duration time.Duration)
RebalanceCompleteHook is called when a rebalance operation completes
type RebalanceEvent ΒΆ
type RebalanceEvent struct {
Trigger string // "node_join", "node_leave", "manual"
TriggerNodeID string // Which node caused it
PartitionsToMove int // How many partitions will move
NodesAffected []string // Which nodes are affected
Timestamp time.Time // When rebalance started
}
RebalanceEvent represents a rebalancing operation
type RebalanceStartHook ΒΆ
type RebalanceStartHook func(event *RebalanceEvent)
RebalanceStartHook is called when a rebalance operation starts
Source Files
ΒΆ
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
example
|
|
|
async
command
|
|
|
async/cmd/test_client
command
|
|
|
custom-data
command
|
|
|
server-side
command
|
|
|
sync
command
|
|
|
sync/cmd/test_client
command
|