feat(dev): correlate telemetry recovery, safety stops and passive drive evidence
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"nodedc.local/mission-core/node-agent/internal/routers"
|
||||
@@ -54,6 +55,7 @@ type Pairing struct {
|
||||
network *NetworkProfile
|
||||
uplink *uplinkController
|
||||
mu sync.Mutex
|
||||
roverAuthority atomic.Pointer[CoreBinding]
|
||||
path string
|
||||
store *Store
|
||||
state PairState
|
||||
@@ -104,6 +106,7 @@ func OpenPairing(store *Store, dir, version string, inventory func() Inventory)
|
||||
return nil, e
|
||||
}
|
||||
}
|
||||
p.publishRoverBinding()
|
||||
return p, nil
|
||||
}
|
||||
func savePrivateJSON(path string, value any) error {
|
||||
@@ -142,6 +145,7 @@ func (p *Pairing) save(next PairState) error {
|
||||
return e
|
||||
}
|
||||
p.state = next
|
||||
p.publishRoverBinding()
|
||||
return nil
|
||||
}
|
||||
func digest(value string) string { h := sha256.Sum256([]byte(value)); return hex.EncodeToString(h[:]) }
|
||||
@@ -152,11 +156,14 @@ func (p *Pairing) expire() error {
|
||||
return nil
|
||||
}
|
||||
func (p *Pairing) status() map[string]any {
|
||||
// Inventory may wait on an OS device. It is not pairing state and must not
|
||||
// extend the pairing transaction (or block its liveness/authority readers).
|
||||
addresses := p.addresses()
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
_ = p.expire()
|
||||
id, _ := p.store.Public()
|
||||
out := map[string]any{"network_profile": p.networkViewLocked(), "phase": p.state.Phase, "node_id": id, "connection": p.connection, "last_seen": p.lastSeen, "notice": p.listenError, "addresses": p.addresses(), "pending_revocations": len(p.state.Revocations)}
|
||||
out := map[string]any{"network_profile": p.networkViewLocked(), "phase": p.state.Phase, "node_id": id, "connection": p.connection, "last_seen": p.lastSeen, "notice": p.listenError, "addresses": addresses, "pending_revocations": len(p.state.Revocations)}
|
||||
if i := p.state.Invitation; i != nil {
|
||||
out["invitation"] = map[string]any{"id": i.ID, "endpoint": i.Endpoint, "expires_at": i.ExpiresAt}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user