working commit

This commit is contained in:
2026-02-23 00:07:38 +02:00
parent 685880c8a8
commit b6efc19f7a
41 changed files with 11938 additions and 93 deletions
+31
View File
@@ -16,6 +16,7 @@ import (
"fmt"
"io"
"net/http"
"slices"
"strconv"
"mstore/pkg/auxoci"
@@ -470,3 +471,33 @@ func (oper *Operator) GetReferer(ctx context.Context, params *GetRefererParams)
res.Reference = manifests[0].Reference
return res, http.StatusOK, err
}
type ListManifestsParams struct {
N int64
}
type ListManifestsResult struct {
Catalog []string `json:"repositories"`
}
func (oper *Operator) ListManifests(ctx context.Context, params *ListManifestsParams) (*ListManifestsResult, int, error) {
var err error
res := &ListManifestsResult{
Catalog: make([]string, 0),
}
refMap := make(map[string]bool)
descrs, err := oper.mdb.ListAllManifests(ctx)
if err != nil {
return res, http.StatusInternalServerError, err
}
for _, descr := range descrs {
_, yet := refMap[descr.Reference]
if !yet {
refMap[descr.Reference] = true
}
}
for key, _ := range refMap {
res.Catalog = append(res.Catalog, key)
}
slices.Sort(res.Catalog)
return res, http.StatusOK, err
}