Add aggregator backfill, pulling fine+coarse buckets from collectors
This commit is contained in:
@@ -154,6 +154,32 @@ func (s *Store) coarseView() st.RingView {
|
||||
return st.RingView{Ring: ring, Head: s.coarseHead, Size: st.CoarseRingSize}
|
||||
}
|
||||
|
||||
// DumpRings returns copies of all non-empty fine and coarse ring snapshots in
|
||||
// chronological order. The lock is held only for the duration of the copy.
|
||||
func (s *Store) DumpRings() (fine, coarse []st.Snapshot) {
|
||||
s.mu.RLock()
|
||||
fineRing := s.fineRing
|
||||
fineHead := s.fineHead
|
||||
fineFilled := s.fineFilled
|
||||
coarseRing := s.coarseRing
|
||||
coarseHead := s.coarseHead
|
||||
coarseFilled := s.coarseFilled
|
||||
s.mu.RUnlock()
|
||||
|
||||
fine = make([]st.Snapshot, 0, fineFilled)
|
||||
for i := 0; i < fineFilled; i++ {
|
||||
idx := (fineHead - fineFilled + i + st.FineRingSize) % st.FineRingSize
|
||||
fine = append(fine, fineRing[idx])
|
||||
}
|
||||
|
||||
coarse = make([]st.Snapshot, 0, coarseFilled)
|
||||
for i := 0; i < coarseFilled; i++ {
|
||||
idx := (coarseHead - coarseFilled + i + st.CoarseRingSize) % st.CoarseRingSize
|
||||
coarse = append(coarse, coarseRing[idx])
|
||||
}
|
||||
return fine, coarse
|
||||
}
|
||||
|
||||
func (s *Store) Subscribe() chan st.Snapshot {
|
||||
ch := make(chan st.Snapshot, 4)
|
||||
s.subMu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user