mirror of
https://github.com/grassrootseconomics/cic-chain-events.git
synced 2024-11-22 23:56:46 +01:00
Mohammed Sohail
df88d9df16
* update config to better defaults * add docs, inline and md * add context support throughout * replace json with goccy/go-json for better decoding of large JSON * update graphql fetcher: replace ioutil with io * test runner script (until CI is ready) * update CI build config
28 lines
483 B
Go
28 lines
483 B
Go
package syncer
|
|
|
|
import (
|
|
"sync/atomic"
|
|
)
|
|
|
|
// Stats synchronizes block cursors values across the head and janitor.
|
|
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()
|
|
}
|