mirror of
https://github.com/containers/podman.git
synced 2025-11-16 19:17:06 +08:00
Update containers/storage
New pinned commit is 477e551dd493e5c80999d3690d3a201fd26ba2f1 Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #425 Approved by: rhatdan
This commit is contained in:
12
vendor/github.com/containers/storage/pkg/truncindex/truncindex.go
generated
vendored
12
vendor/github.com/containers/storage/pkg/truncindex/truncindex.go
generated
vendored
@@ -77,10 +77,7 @@ func (idx *TruncIndex) addID(id string) error {
|
||||
func (idx *TruncIndex) Add(id string) error {
|
||||
idx.Lock()
|
||||
defer idx.Unlock()
|
||||
if err := idx.addID(id); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return idx.addID(id)
|
||||
}
|
||||
|
||||
// Delete removes an ID from the TruncIndex. If there are multiple IDs
|
||||
@@ -128,8 +125,13 @@ func (idx *TruncIndex) Get(s string) (string, error) {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
|
||||
// Iterate iterates over all stored IDs, and passes each of them to the given handler.
|
||||
// Iterate iterates over all stored IDs and passes each of them to the given
|
||||
// handler. Take care that the handler method does not call any public
|
||||
// method on truncindex as the internal locking is not reentrant/recursive
|
||||
// and will result in deadlock.
|
||||
func (idx *TruncIndex) Iterate(handler func(id string)) {
|
||||
idx.Lock()
|
||||
defer idx.Unlock()
|
||||
idx.trie.Visit(func(prefix patricia.Prefix, item patricia.Item) error {
|
||||
handler(string(prefix))
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user