Files
mqtt_explorer/backend/internal/settings/runtime.go
Gilles Soulier 383ad292d3 first
2025-12-24 14:47:39 +01:00

25 lines
363 B
Go

package settings
import "sync"
type Runtime struct {
mu sync.RWMutex
current Settings
}
func NewRuntime(initial Settings) *Runtime {
return &Runtime{current: initial}
}
func (r *Runtime) Get() Settings {
r.mu.RLock()
defer r.mu.RUnlock()
return r.current
}
func (r *Runtime) Update(next Settings) {
r.mu.Lock()
r.current = next
r.mu.Unlock()
}