@@ -321,6 +321,19 @@ func (r *Root) ForEachAt(ctx context.Context, start uint64, cb func(uint64, *cbg
321321 return r .node .forEachAt (ctx , r .store , r .bitWidth , r .height , start , 0 , cb )
322322}
323323
324+ // ForEachTrackedWithNodeSink iterates over the entire AMT and calls the cb function for each
325+ // entry found in the leaf nodes. The callback will receive the index and the
326+ // value of each element.
327+ func (r * Root ) ForEachTrackedWithNodeSink (ctx context.Context , b * bytes.Buffer , sink cbg.CBORUnmarshaler , cb func (uint64 , * cbg.Deferred , []int ) error ) error {
328+ return r .node .forEachAtTrackedWithNodeSink (ctx , r .store , []int {}, r .bitWidth , r .height , 0 , 0 , b , sink , cb )
329+ }
330+
331+ // ForEachAtTrackedWithNodeSink iterates over the AMT beginning from the given start index. See
332+ // ForEach for more details.
333+ func (r * Root ) ForEachAtTrackedWithNodeSink (ctx context.Context , start uint64 , b * bytes.Buffer , sink cbg.CBORUnmarshaler , cb func (uint64 , * cbg.Deferred , []int ) error ) error {
334+ return r .node .forEachAtTrackedWithNodeSink (ctx , r .store , []int {}, r .bitWidth , r .height , start , 0 , b , sink , cb )
335+ }
336+
324337// FirstSetIndex finds the lowest index in this AMT that has a value set for
325338// it. If this operation is called on an empty AMT, an ErrNoValues will be
326339// returned.
0 commit comments