ceremonyclient/types/hypergraph/sync.go
Cassandra Heart dbd95bd9e9
v2.1.0 (#439)
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete

* 2.1.0 main node rollup
2025-09-30 02:48:15 -05:00

32 lines
517 B
Go

package hypergraph
import (
"sync/atomic"
"time"
)
type SyncController struct {
isSyncing atomic.Bool
SyncStatus map[string]*SyncInfo
}
func (s *SyncController) TryEstablishSyncSession() bool {
return !s.isSyncing.Swap(true)
}
func (s *SyncController) EndSyncSession() {
s.isSyncing.Store(false)
}
type SyncInfo struct {
Unreachable bool
LastSynced time.Time
}
func NewSyncController() *SyncController {
return &SyncController{
isSyncing: atomic.Bool{},
SyncStatus: map[string]*SyncInfo{},
}
}