cic-chain-events/internal/syncer/stats.go

28 lines
483 B
Go
Raw Normal View History

2023-01-05 12:45:09 +01:00
package syncer
import (
"sync/atomic"
)
// Stats synchronizes block cursors values across the head and janitor.
2023-01-05 12:45:09 +01:00
type Stats struct {
headCursor atomic.Uint64
lowerBound atomic.Uint64
}
func (s *Stats) UpdateHeadCursor(val uint64) {
s.headCursor.Store(val)
}
func (s *Stats) GetHeadCursor() uint64 {
return s.headCursor.Load()
}
func (s *Stats) UpdateLowerBound(val uint64) {
s.lowerBound.Store(val)
}
func (s *Stats) GetLowerBound() uint64 {
return s.lowerBound.Load()
}