Skip to content

Commit

Permalink
indexer: add DeleteManifests method
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Jan 14, 2022
1 parent b1fe4db commit 7881911
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions indexer/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Mock struct {
IndexReport_ func(ctx context.Context, digest claircore.Digest) (*claircore.IndexReport, bool, error)
State_ func(ctx context.Context) (string, error)
AffectedManifests_ func(ctx context.Context, vulns []claircore.Vulnerability) (*claircore.AffectedManifests, error)
DeleteManifests_ func(context.Context, ...claircore.Digest) ([]claircore.Digest, error)
}

func (i *Mock) Index(ctx context.Context, manifest *claircore.Manifest) (*claircore.IndexReport, error) {
Expand Down Expand Up @@ -46,3 +47,10 @@ func (i *Mock) AffectedManifests(ctx context.Context, vulns []claircore.Vulnerab
}
return i.AffectedManifests_(ctx, vulns)
}

func (i *Mock) DeleteManifests(ctx context.Context, d ...claircore.Digest) ([]claircore.Digest, error) {
if i.DeleteManifests_ == nil {
panic("mock indexer: unexpected call to DeleteManifests")
}
return i.DeleteManifests_(ctx, d...)
}
1 change: 1 addition & 0 deletions indexer/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type StateIndexer interface {
// Indexer is an interface for computing a IndexReport given a Manifest.
type Indexer interface {
Index(ctx context.Context, manifest *claircore.Manifest) (*claircore.IndexReport, error)
DeleteManifests(context.Context, ...claircore.Digest) ([]claircore.Digest, error)
}

// Reporter is an interface for retreiving an IndexReport given a manifest digest.
Expand Down

0 comments on commit 7881911

Please sign in to comment.