Documentation
¶
Overview ¶
Package statuscalc provides utilities for calculating SubnetPool status metrics
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeBlockSizeKey ¶
NormalizeBlockSizeKey ensures a block size key is in the standard format Converts "/24" to "24" and ensures it's a valid integer
Types ¶
type CalculateResult ¶
type CalculateResult struct { // AllocatedCount is the total number of allocations AllocatedCount int // FreeCountBySize maps block sizes to their free count // Uses both "24" and "/24" format keys for compatibility FreeCountBySize map[string]int // AllocatedCIDRs maps CIDRs to their cluster IDs AllocatedCIDRs map[string]string }
CalculateResult contains the results of SubnetPool status calculations
func Calculate ¶
func Calculate(poolCIDR string, allocations []*ipamv1.Subnet, childCIDRs []string) (*CalculateResult, error)
Calculate computes status metrics for a pool based on its CIDR, allocations, and child SubnetPools Returns: - AllocatedCount: Total number of allocations (including child SubnetPools) - FreeCountBySize: Map of blockSize -> free count - AllocatedCIDRs: Map of CIDR -> clusterID - error: Any error that occurred during calculation
Click to show internal directories.
Click to hide internal directories.