Add package-level doc comments for go doc and gopls
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
27
circuitbreaker/doc.go
Normal file
27
circuitbreaker/doc.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Package circuitbreaker provides a per-host circuit breaker as HTTP middleware.
|
||||
//
|
||||
// The circuit breaker monitors request failures and temporarily blocks requests
|
||||
// to unhealthy hosts, allowing them time to recover before retrying.
|
||||
//
|
||||
// # State machine
|
||||
//
|
||||
// - Closed — normal operation, requests pass through
|
||||
// - Open — too many failures, requests are rejected with ErrCircuitOpen
|
||||
// - HalfOpen — after a cooldown period, one probe request is allowed through
|
||||
//
|
||||
// # Usage
|
||||
//
|
||||
// mw := circuitbreaker.Transport(
|
||||
// circuitbreaker.WithThreshold(5),
|
||||
// circuitbreaker.WithTimeout(30 * time.Second),
|
||||
// )
|
||||
// transport := mw(http.DefaultTransport)
|
||||
//
|
||||
// The circuit breaker is per-host: each unique request host gets its own
|
||||
// independent breaker state machine stored in a sync.Map.
|
||||
//
|
||||
// # Sentinel errors
|
||||
//
|
||||
// ErrCircuitOpen is returned when a request is rejected because the circuit
|
||||
// is in the Open state.
|
||||
package circuitbreaker
|
||||
Reference in New Issue
Block a user