Documentation
¶
Overview ¶
Package dynconfig provides dynamic configuration with atomic reads.
DynConfig allows runtime updates to configuration values without restarts. Reads are lock-free (~1.8 ns) using atomic.Value, making it suitable for hot-path configuration such as rate limits and feature flags.
Example:
cfg := dynconfig.New(initialConfig) current := cfg.Get() // atomic read, ~1.8 ns cfg.Set(newConfig) // atomic write with change notification
Package dynconfig provides dynamic configuration for GRIP execution pipelines.
Value[T] is the fundamental building block: it holds any configuration value (e.g., supervisor policy, admission limit) that can be swapped atomically at runtime without restarting the service.
Usage:
// Create a dynamic admission limit
limit := dynconfig.NewValue(100)
// Read the current value (lock-free)
current := limit.Get()
// Update at runtime (atomic swap)
limit.Set(200)
// Listen for changes
limit.OnChange(func(old, new int) {
log.Printf("admission limit changed: %d → %d", old, new)
})
Snapshot provides a registry for debugging active configuration:
snap := dynconfig.NewSnapshot()
snap.Register("admission_limit", func() any { return limit.Get() })
fmt.Println(snap.Capture()) // {"admission_limit": 200}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Snapshot ¶
Snapshot captures the current state of all registered dynamic values.
func NewSnapshot ¶
func NewSnapshot() *Snapshot
NewSnapshot creates a new configuration snapshot for debugging.