dirBrowse rendered a single directory level but paid for a full recursive listing of the repo — on CephFS-backed LocalFS that is a walk of the entire storage root plus a sidecar read per object, which took Ceph down on large repos. Storage grows a ListDir primitive (os.ReadDir on localfs, Delimiter on S3) and the UI and the debian dists fallback use it; the recursive List stays for the docker page and now starts its walk at the requested prefix. The per-vrepo storage gauges on /metrics did the same full listing on every scrape; they are removed — the backend's own accounting (du, bucket metrics) covers capacity. Co-Authored-By: Claude Code <noreply@anthropic.com>
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
)
|
|
|
|
// NullStore is a Store that caches nothing: every lookup is a miss and
|
|
// every Put is discarded. It backs storage.type=none, where the proxy runs
|
|
// as a pure pass-through with no persistent cache.
|
|
type NullStore struct{}
|
|
|
|
func (NullStore) Get(ctx context.Context, key string) (io.ReadCloser, *ObjectMeta, error) {
|
|
return nil, nil, ErrNotFound
|
|
}
|
|
|
|
// Put drains r before reporting success: proxycache tees the upstream body
|
|
// into Put through an io.Pipe, so returning early would block the stream to
|
|
// the client.
|
|
func (NullStore) Put(ctx context.Context, key string, r io.Reader, meta ObjectMeta) error {
|
|
_, err := io.Copy(io.Discard, r)
|
|
return err
|
|
}
|
|
|
|
func (NullStore) Stat(ctx context.Context, key string) (*ObjectMeta, error) {
|
|
return nil, ErrNotFound
|
|
}
|
|
|
|
func (NullStore) List(ctx context.Context, prefix string) ([]ObjectInfo, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (NullStore) ListDir(ctx context.Context, prefix string) ([]string, []ObjectInfo, error) {
|
|
return nil, nil, nil
|
|
}
|