Files
MrAlders0n 0e242574fb feat(meshmapper): import region boundaries from the Zones API
Imported boundaries override borderFile on the border map and for foreign marking, falling back to the manual border when MeshMapper has none.
2026-09-30 12:38:36 -04:00

29 lines
781 B
Go

// Copyright 2026 Beacon Contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
package borders
import "sync/atomic"
// Live lets boundary refreshes replace the classifier under concurrent readers.
// A nil Live disables classification; an empty one reports unknown until stored.
type Live struct{ current atomic.Pointer[Local] }
func NewLive(local *Local) *Live {
live := &Live{}
live.current.Store(local)
return live
}
func (l *Live) Store(local *Local) { l.current.Store(local) }
// Ready reports whether any boundary is loaded.
func (l *Live) Ready() bool { return l != nil && l.current.Load() != nil }
func (l *Live) PossiblyForeign(role int16, lat, lng *float64) *bool {
if l == nil {
return nil
}
return l.current.Load().PossiblyForeign(role, lat, lng)
}