MCPcopy Create free account
hub / github.com/aptly-dev/aptly / ForEach

Method ForEach

deb/snapshot.go:355–365  ·  view source on GitHub ↗

ForEach runs method for each snapshot

(handler func(*Snapshot) error)

Source from the content-addressed store, hash-verified

353
354// ForEach runs method for each snapshot
355func (collection *SnapshotCollection) ForEach(handler func(*Snapshot) error) error {
356 return collection.db.ProcessByPrefix([]byte("S"), func(_, blob []byte) error {
357 s := &Snapshot{}
358 if err := s.Decode(blob); err != nil {
359 log.Printf("Error decoding snapshot: %s\n", err)
360 return nil
361 }
362
363 return handler(s)
364 })
365}
366
367// ForEachSorted runs method for each snapshot following some sort order
368func (collection *SnapshotCollection) ForEachSorted(sortMethod string, handler func(*Snapshot) error) error {

Callers 1

Calls 3

ProcessByPrefixMethod · 0.65
PrintfMethod · 0.65
DecodeMethod · 0.45

Tested by 1