github.com/ethersphere/bee/v2@v2.2.0/pkg/manifest/simple/walker.go (about) 1 // Copyright 2020 The Swarm Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package simple 6 7 // WalkEntryFunc is the type of the function called for each entry visited 8 // by WalkEntry. 9 type WalkEntryFunc func(path string, entry Entry, err error) error 10 11 func (m *manifest) WalkEntry(root string, walkFn WalkEntryFunc) (err error) { 12 m.mu.Lock() 13 defer m.mu.Unlock() 14 15 for k, v := range m.Entries { 16 entry := newEntry(v.Ref, v.Meta) 17 err = walkFn(k, entry, nil) 18 if err != nil { 19 return err 20 } 21 } 22 23 return nil 24 }