MCPcopy Create free account
hub / github.com/bobg/hashsplit / AllChunks

Method AllChunks

hashsplit.go:342–357  ·  view source on GitHub ↗

AllChunks produces an iterator over all the chunks in the tree. It does this with a recursive tree walk starting at n.

()

Source from the content-addressed store, hash-verified

340// AllChunks produces an iterator over all the chunks in the tree.
341// It does this with a recursive tree walk starting at n.
342func (n *TreeNode) AllChunks() iter.Seq[[]byte] {
343 return func(yield func([]byte) bool) {
344 for _, chunk := range n.Chunks {
345 if !yield(chunk) {
346 return
347 }
348 }
349 for _, child := range n.Children {
350 for chunk := range child.AllChunks() {
351 if !yield(chunk) {
352 return
353 }
354 }
355 }
356 }
357}
358
359// ErrNotFound is the error returned by Seek when the seek position lies outside the given node's range.
360var ErrNotFound = errors.New("not found")

Callers 1

TestTreeFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestTreeFunction · 0.64