feat(api): 集群列表读改走 informer 缓存,审核队列、我的提交与备份列表改为服务端分页筛选并一次批量查构建,面板三页跟进

This commit is contained in:
Lemon-miaow committed 2026-09-25 18:13:21 +08:00
1 parent 0a66385d9f
commit 1054e62fa9
41 files changed
+1642 -295

No files matched your search

+21
View File
@@ -198,6 +198,9 @@ type Store interface {
CreateBuild(ctx context.Context, b *Build) error
// GetBuild loads one build, or ErrNotFound.
GetBuild(ctx context.Context, id string) (*Build, error)
// GetBuilds loads the builds among ids that exist, in no particular order and
// without their Dockerfile — one query for a whole list's worth of lookups.
GetBuilds(ctx context.Context, ids []string) ([]Build, error)
// SetBuildJob records the Job name and advances status to building.
SetBuildJob(ctx context.Context, id, jobName string) error
// FinishBuild sets a terminal status, an optional error, and finished_at.
@@ -519,6 +522,24 @@ func (b *Builder) Get(ctx context.Context, id string) (*Build, error) {
return b.Store.GetBuild(ctx, id)
}
// GetMany returns the builds among ids that exist, keyed by id, read as stored
// (no reconcile) and without their Dockerfile. An id with no row is absent from
// the map.
func (b *Builder) GetMany(ctx context.Context, ids []string) (map[string]Build, error) {
out := make(map[string]Build, len(ids))
if len(ids) == 0 {
return out, nil
}
builds, err := b.Store.GetBuilds(ctx, ids)
if err != nil {
return nil, err
}
for _, bld := range builds {
out[bld.ID] = bld
}
return out, nil
}
// ListBuilds pages the build history for the admin panel, so every admin sees
// every build (and can cancel a running one) from any browser. It reads rows as
// stored: reconcileBuilds advances them in the background, and GET