Add comprehensive godoc documentation to handler.go
Expand documentation comments for SimpleHandler type and its methods to better explain their purpose, parameters, and behavior.
This commit is contained in:
@@ -47,7 +47,10 @@ type peerUpdate struct {
|
||||
timestamp time.Time
|
||||
}
|
||||
|
||||
// NewPeerHandler creates a new batched peer tracking handler
|
||||
// NewPeerHandler creates a new PeerHandler with the given database store and logger.
|
||||
// It initializes the peer batch buffer and starts a background goroutine that
|
||||
// periodically flushes accumulated peer updates to the database. The handler
|
||||
// should be stopped by calling Stop when it is no longer needed.
|
||||
func NewPeerHandler(db database.Store, logger *logger.Logger) *PeerHandler {
|
||||
h := &PeerHandler{
|
||||
db: db,
|
||||
@@ -64,7 +67,9 @@ func NewPeerHandler(db database.Store, logger *logger.Logger) *PeerHandler {
|
||||
return h
|
||||
}
|
||||
|
||||
// WantsMessage returns true for all message types since we track peers from all messages
|
||||
// WantsMessage returns true for all message types since peer information
|
||||
// is extracted from every RIS message regardless of type. This satisfies
|
||||
// the MessageHandler interface.
|
||||
func (h *PeerHandler) WantsMessage(_ string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user