AllChunks produces an iterator over all the chunks in the tree. It does this with a recursive tree walk starting at n.
()
| 340 | // AllChunks produces an iterator over all the chunks in the tree. |
| 341 | // It does this with a recursive tree walk starting at n. |
| 342 | func (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. |
| 360 | var ErrNotFound = errors.New("not found") |