MCPcopy
hub / github.com/etcd-io/bbolt / walkBucket

Function walkBucket

compact.go:99–119  ·  view source on GitHub ↗
(b *Bucket, keypath [][]byte, k, v []byte, seq uint64, fn walkFunc)

Source from the content-addressed store, hash-verified

97}
98
99func walkBucket(b *Bucket, keypath [][]byte, k, v []byte, seq uint64, fn walkFunc) error {
100 // Execute callback.
101 if err := fn(keypath, k, v, seq); err != nil {
102 return err
103 }
104
105 // If this is not a bucket then stop.
106 if v != nil {
107 return nil
108 }
109
110 // Iterate over each child key/value.
111 keypath = append(keypath, k)
112 return b.ForEach(func(k, v []byte) error {
113 if v == nil {
114 bkt := b.Bucket(k)
115 return walkBucket(bkt, keypath, k, nil, bkt.Sequence(), fn)
116 }
117 return walkBucket(b, keypath, k, v, b.Sequence(), fn)
118 })
119}

Callers 1

walkFunction · 0.70

Calls 3

SequenceMethod · 0.80
ForEachMethod · 0.45
BucketMethod · 0.45

Tested by

no test coverage detected