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:
@@ -19,6 +19,7 @@ import (
|
||||
"git.eeqj.de/sneak/routewatch/internal/ristypes"
|
||||
)
|
||||
|
||||
// Configuration constants for the RIS Live streamer.
|
||||
const (
|
||||
risLiveURL = "https://ris-live.ripe.net/v1/stream/?format=json&" +
|
||||
"client=https%3A%2F%2Fgit.eeqj.de%2Fsneak%2Froutewatch"
|
||||
@@ -36,16 +37,22 @@ const (
|
||||
backpressureSlope = 2.0 // Slope for linear drop probability increase
|
||||
)
|
||||
|
||||
// MessageHandler is an interface for handling RIS messages
|
||||
// MessageHandler defines the interface for processing RIS messages.
|
||||
// Implementations must specify which message types they want to receive,
|
||||
// how to process messages, and their desired queue capacity.
|
||||
type MessageHandler interface {
|
||||
// WantsMessage returns true if this handler wants to process messages of the given type
|
||||
// WantsMessage returns true if this handler wants to process messages of the given type.
|
||||
WantsMessage(messageType string) bool
|
||||
|
||||
// HandleMessage processes a RIS message
|
||||
// HandleMessage processes a RIS message. This method is called from a dedicated
|
||||
// goroutine for each handler, so implementations do not need to be goroutine-safe
|
||||
// with respect to other handlers.
|
||||
HandleMessage(msg *ristypes.RISMessage)
|
||||
|
||||
// QueueCapacity returns the desired queue capacity for this handler
|
||||
// Handlers that process quickly can have larger queues
|
||||
// QueueCapacity returns the desired queue capacity for this handler.
|
||||
// Handlers that process quickly can have larger queues to buffer bursts.
|
||||
// When the queue fills up, messages will be dropped according to the
|
||||
// backpressure algorithm.
|
||||
QueueCapacity() int
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user