@@ -145,14 +145,22 @@ func checkCanInitializeEngine(ctx context.Context, eng storage.Engine) error {
145145 return err
146146}
147147
148+ // readKeyFn reads the given key, and unmarshals the value into the given proto.
149+ // Returns false if the key does not exist, or is requested out of order.
148150type readKeyFn func (roachpb.Key , protoutil.Message ) (bool , error )
151+
152+ // scanRangeIDFn reports the existence of a RangeID, and allows reading
153+ // RangeID-local keys via the readKeyFn callback.
149154type scanRangeIDFn func (roachpb.RangeID , readKeyFn ) error
150155
151- // iterateRangeIDKeys helps visit system keys that use RangeID prefixing (such
156+ // iterateRangeIDKeys helps visit storage keys that use RangeID prefixing (such
152157// as RaftHardStateKey, RangeTombstoneKey, and many others). Such keys could in
153- // principle exist at any RangeID, and this helper efficiently discovers all the
154- // keys of the desired type (as specified by the supplied `keyFn`) and, for each
155- // key-value pair discovered, unmarshals it into `msg` and then invokes `f`.
158+ // principle exist for any RangeID.
159+ //
160+ // The helper visits all RangeIDs that have any keys, and for each range calls
161+ // the scanRangeID function. The implementation of this function can request any
162+ // subset of RangeID-local keys via the readKeyFn callback. All keys must be
163+ // requested in sorted order.
156164//
157165// Iteration stops on the first error (and will pass through that error).
158166func iterateRangeIDKeys (
0 commit comments