From 3878b12698dbbc422e007160dcb6712432c2c082 Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Wed, 30 Jan 2019 16:32:35 +0100 Subject: [PATCH] storage: add Store.VisitReplicas Release note: None --- pkg/storage/store.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/storage/store.go b/pkg/storage/store.go index ed2925e8e95e..c5497e144017 100644 --- a/pkg/storage/store.go +++ b/pkg/storage/store.go @@ -1788,6 +1788,13 @@ func (s *Store) GossipDeadReplicas(ctx context.Context) error { return s.cfg.Gossip.AddInfoProto(key, &deadReplicas, gossip.StoreTTL) } +// VisitReplicas invokes the visitor on the Store's Replicas until the visitor returns false. +// Replicas which are added to the Store after iteration begins may or may not be observed. +func (s *Store) VisitReplicas(visitor func(*Replica) bool) { + v := newStoreReplicaVisitor(s) + v.Visit(visitor) +} + // Bootstrap writes a new store ident to the underlying engine. To // ensure that no crufty data already exists in the engine, it scans // the engine contents before writing the new store ident. The engine