Skip to content

Commit cf4e1bb

Browse files
committed
remotecache: explicit names for registry and local
Signed-off-by: CrazyMax <[email protected]>
1 parent b3bb356 commit cf4e1bb

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

cache/remotecache/local/local.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ const (
2323
contentStoreIDPrefix = "local:"
2424
)
2525

26+
type exporter struct {
27+
remotecache.Exporter
28+
}
29+
30+
func (*exporter) Name() string {
31+
return "exporting cache to client directory"
32+
}
33+
2634
// ResolveCacheExporterFunc for "local" cache exporter.
2735
func ResolveCacheExporterFunc(sm *session.Manager) remotecache.ResolveCacheExporterFunc {
2836
return func(ctx context.Context, g session.Group, attrs map[string]string) (remotecache.Exporter, error) {
@@ -47,7 +55,7 @@ func ResolveCacheExporterFunc(sm *session.Manager) remotecache.ResolveCacheExpor
4755
if err != nil {
4856
return nil, err
4957
}
50-
return remotecache.NewExporter(cs, "", ociMediatypes, compressionConfig), nil
58+
return &exporter{remotecache.NewExporter(cs, "", ociMediatypes, compressionConfig)}, nil
5159
}
5260
}
5361

cache/remotecache/registry/registry.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ const (
4040
attrInsecure = "registry.insecure"
4141
)
4242

43+
type exporter struct {
44+
remotecache.Exporter
45+
}
46+
47+
func (*exporter) Name() string {
48+
return "exporting cache to registry"
49+
}
50+
4351
func ResolveCacheExporterFunc(sm *session.Manager, hosts docker.RegistryHosts) remotecache.ResolveCacheExporterFunc {
4452
return func(ctx context.Context, g session.Group, attrs map[string]string) (remotecache.Exporter, error) {
4553
compressionConfig, err := compression.ParseAttributes(attrs)
@@ -74,7 +82,7 @@ func ResolveCacheExporterFunc(sm *session.Manager, hosts docker.RegistryHosts) r
7482
if err != nil {
7583
return nil, err
7684
}
77-
return remotecache.NewExporter(contentutil.FromPusher(pusher), refString, ociMediatypes, compressionConfig), nil
85+
return &exporter{remotecache.NewExporter(contentutil.FromPusher(pusher), refString, ociMediatypes, compressionConfig)}, nil
7886
}
7987
}
8088

0 commit comments

Comments
 (0)