mirror of
https://github.com/containers/podman.git
synced 2025-12-12 17:57:31 +08:00
vendor containers/storage@main
Mainly to pull in fixes for #1382 which is impossible to reproduce locally so let's optimistically mark it as fixed and reopen if needed in the future. Fixes: #1382 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
8
vendor/github.com/containers/storage/pkg/truncindex/truncindex.go
generated
vendored
8
vendor/github.com/containers/storage/pkg/truncindex/truncindex.go
generated
vendored
@@ -25,7 +25,7 @@ var (
|
||||
|
||||
// ErrAmbiguousPrefix is returned if the prefix was ambiguous
|
||||
// (multiple ids for the prefix).
|
||||
type ErrAmbiguousPrefix struct {
|
||||
type ErrAmbiguousPrefix struct { //nolint: errname
|
||||
prefix string
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ type TruncIndex struct {
|
||||
}
|
||||
|
||||
// NewTruncIndex creates a new TruncIndex and initializes with a list of IDs.
|
||||
// Invalid IDs are _silently_ ignored.
|
||||
func NewTruncIndex(ids []string) (idx *TruncIndex) {
|
||||
idx = &TruncIndex{
|
||||
ids: make(map[string]struct{}),
|
||||
@@ -51,7 +52,7 @@ func NewTruncIndex(ids []string) (idx *TruncIndex) {
|
||||
trie: patricia.NewTrie(patricia.MaxPrefixPerNode(64)),
|
||||
}
|
||||
for _, id := range ids {
|
||||
idx.addID(id)
|
||||
_ = idx.addID(id) // Ignore invalid IDs. Duplicate IDs are not a problem.
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -132,7 +133,8 @@ func (idx *TruncIndex) Get(s string) (string, error) {
|
||||
func (idx *TruncIndex) Iterate(handler func(id string)) {
|
||||
idx.Lock()
|
||||
defer idx.Unlock()
|
||||
idx.trie.Visit(func(prefix patricia.Prefix, item patricia.Item) error {
|
||||
// Ignore the error from Visit: it can only fail if the provided visitor fails, and ours never does.
|
||||
_ = idx.trie.Visit(func(prefix patricia.Prefix, item patricia.Item) error {
|
||||
handler(string(prefix))
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user