Skip to content

Commit

Permalink
docs(apk): document apkindex methods
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
  • Loading branch information
luhring committed Nov 8, 2024
1 parent 818ff3c commit fb9b8f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/apk/apk/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ func (i *indexCache) get(ctx context.Context, repoName, repoURL string, keys map
}
}

// IndexURL full URL to the index file for the given repo and arch
// IndexURL returns the full URL to the index file for the given repo and arch.
//
// `repo` is the URL of the repository including the protocol, e.g.
// "https://packages.wolfi.dev/os".
//
// `arch` is the architecture of the index, e.g. "x86_64" or "aarch64".
func IndexURL(repo, arch string) string {
return fmt.Sprintf("%s/%s/%s", repo, arch, indexFilename)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/apk/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func New(httpClient *http.Client) *Client {

// GetRemoteIndex retrieves the index of APK packages from the specified remote
// repository.
//
// `apkRepo` is the URL of the repository including the protocol, e.g.
// "https://packages.wolfi.dev/os".
//
// `arch` is the architecture of the index, e.g. "x86_64" or "aarch64".
func (c Client) GetRemoteIndex(ctx context.Context, apkRepo, arch string) (*apk.APKIndex, error) {
indexURL := apk.IndexURL(apkRepo, arch)

Expand Down

0 comments on commit fb9b8f0

Please sign in to comment.