Skip to content

Commit

Permalink
Add support for ProgressEventSkipped
Browse files Browse the repository at this point in the history
The new event indicates that a blob has been skipped. This information
can be used by CRI-O for more detailed image layer re-use metrics.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
  • Loading branch information
saschagrunert committed Jun 5, 2020
1 parent 8d71f3f commit f1c1394
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions copy/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,14 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to
logrus.Debugf("Skipping blob %s (already present):", srcInfo.Digest)
bar := ic.c.createProgressBar(pool, srcInfo, "blob", "skipped: already exists")
bar.SetTotal(0, true)

// Throw an event that the layer has been skipped
if ic.c.progress != nil && ic.c.progressInterval > 0 {
ic.c.progress <- types.ProgressProperties{
Event: types.ProgressEventSkipped,
Artifact: srcInfo,
}
}
return blobInfo, cachedDiffID, nil
}
}
Expand Down
4 changes: 4 additions & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ const (
// ProgressEventDone is fired when the data transfer has been finished for
// the specific artifact
ProgressEventDone

// ProgressEventSkipped is fired when the artifact has been skipped because
// its already available at the destination
ProgressEventSkipped
)

// ProgressProperties is used to pass information from the copy code to a monitor which
Expand Down

0 comments on commit f1c1394

Please sign in to comment.