Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about Get method of blob controller #20690

Open
pendoragon opened this issue Jul 3, 2024 · 0 comments
Open

Questions about Get method of blob controller #20690

pendoragon opened this issue Jul 3, 2024 · 0 comments

Comments

@pendoragon
Copy link

I was looking at harbor code and get a bit confused by the code below:

keywords := make(map[string]interface{})
if digest != "" {
ol := q.OrList{
Values: []interface{}{
digest,
},
}
keywords["digest"] = &ol
}
if opts.ProjectID != 0 {
keywords["projectID"] = opts.ProjectID
}
if opts.ArtifactDigest != "" {
keywords["artifactDigest"] = opts.ArtifactDigest
}
query := &q.Query{
Keywords: keywords,
}
blobs, err := c.blobMgr.List(ctx, query)

The Get method supports options like ArtifactDigest and ProjectID. These options gets converted to query keywords.
Under the hood, it calls List method of blob manager, which just queries table blob of the database

func (d *dao) ListBlobs(ctx context.Context, query *q.Query) ([]*models.Blob, error) {
qs, err := orm.QuerySetter(ctx, &models.Blob{}, query)
if err != nil {
return nil, err
}
blobs := []*models.Blob{}
if _, err = qs.All(&blobs); err != nil {
return nil, err
}
return blobs, nil
}

However, the blob table has no projectID or artifactDigest column. Am i missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant