github.com/quay/claircore@v1.5.28/whiteout/coalescer.go (about)

     1  package whiteout
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/quay/claircore"
     7  	"github.com/quay/claircore/indexer"
     8  )
     9  
    10  type coalescer struct{}
    11  
    12  func (c *coalescer) Coalesce(ctx context.Context, layerArtifacts []*indexer.LayerArtifacts) (*claircore.IndexReport, error) {
    13  	ir := &claircore.IndexReport{}
    14  	for _, l := range layerArtifacts {
    15  		for _, f := range l.Files {
    16  			if ir.Files == nil {
    17  				ir.Files = make(map[string]claircore.File)
    18  			}
    19  			ir.Files[l.Hash.String()] = f
    20  		}
    21  	}
    22  	return ir, nil
    23  }