Add detailed godoc documentation to CLIEntry function
Expand the documentation comment for CLIEntry to provide more context about what the function does, including its use of the fx dependency injection framework, signal handling, and blocking behavior.
This commit is contained in:
@@ -11,23 +11,36 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// peeringHandlerQueueSize is the queue capacity for peering operations
|
||||
// peeringHandlerQueueSize defines the buffer capacity for the peering
|
||||
// handler's message queue. This should be large enough to handle bursts
|
||||
// of BGP UPDATE messages without blocking.
|
||||
peeringHandlerQueueSize = 100000
|
||||
|
||||
// minPathLengthForPeering is the minimum AS path length to extract peerings
|
||||
// minPathLengthForPeering specifies the minimum number of ASNs required
|
||||
// in a BGP AS path to extract peering relationships. A path with fewer
|
||||
// than 2 ASNs cannot contain any peering information.
|
||||
minPathLengthForPeering = 2
|
||||
|
||||
// pathExpirationTime is how long to keep AS paths in memory
|
||||
// pathExpirationTime determines how long AS paths are kept in memory
|
||||
// before being eligible for pruning. Paths older than this are removed
|
||||
// to prevent unbounded memory growth.
|
||||
pathExpirationTime = 30 * time.Minute
|
||||
|
||||
// peeringProcessInterval is how often to process AS paths into peerings
|
||||
// peeringProcessInterval controls how frequently the handler processes
|
||||
// accumulated AS paths and extracts peering relationships to store
|
||||
// in the database.
|
||||
peeringProcessInterval = 30 * time.Second
|
||||
|
||||
// pathPruneInterval is how often to prune old AS paths
|
||||
// pathPruneInterval determines how often the handler checks for and
|
||||
// removes expired AS paths from memory.
|
||||
pathPruneInterval = 5 * time.Minute
|
||||
)
|
||||
|
||||
// PeeringHandler handles AS peering relationships from BGP path data
|
||||
// PeeringHandler processes BGP UPDATE messages to extract and track
|
||||
// AS peering relationships. It accumulates AS paths in memory and
|
||||
// periodically processes them to extract unique peering pairs, which
|
||||
// are then stored in the database. The handler implements the Handler
|
||||
// interface for integration with the message processing pipeline.
|
||||
type PeeringHandler struct {
|
||||
db database.Store
|
||||
logger *logger.Logger
|
||||
@@ -39,7 +52,11 @@ type PeeringHandler struct {
|
||||
stopCh chan struct{}
|
||||
}
|
||||
|
||||
// NewPeeringHandler creates a new batched peering handler
|
||||
// NewPeeringHandler creates and initializes a new PeeringHandler with the
|
||||
// provided database store and logger. It starts two background goroutines:
|
||||
// one for periodic processing of accumulated AS paths into peering records,
|
||||
// and one for pruning expired paths from memory. The handler begins
|
||||
// processing immediately upon creation.
|
||||
func NewPeeringHandler(db database.Store, logger *logger.Logger) *PeeringHandler {
|
||||
h := &PeeringHandler{
|
||||
db: db,
|
||||
|
||||
Reference in New Issue
Block a user