Skip to content

Commit 4f1393c

Browse files
committed
Add filesystem-backed disk registry
Implements ociregistry.Interface against the filesystem. Blobs, manifests, and tags stored under STORAGE_PATH/{nodeName}/. Persists across pod restarts when PVC is mounted. Uses ociunify for pull-through cache mode.
1 parent 8e5e62d commit 4f1393c

File tree

2 files changed

+425
-3
lines changed

2 files changed

+425
-3
lines changed

components/containerregistry/containerregistry.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"sync"
1111

1212
"cuelabs.dev/go/oci/ociregistry/ociclient"
13-
"cuelabs.dev/go/oci/ociregistry/ocimem"
1413
"cuelabs.dev/go/oci/ociregistry/ociserver"
1514
"cuelabs.dev/go/oci/ociregistry/ociunify"
1615
"github.com/rs/zerolog/log"
@@ -119,8 +118,17 @@ func (c *Component) start(ctx context.Context, handler module.Handler, cfg Start
119118
c.cancelFunc = cancel
120119
c.cancelFuncLock.Unlock()
121120

122-
// Local in-memory registry (TODO: disk-backed implementation using storagePath)
123-
local := ocimem.New()
121+
storagePath := c.storagePath
122+
if storagePath == "" {
123+
storagePath = filepath.Join(os.TempDir(), "registry")
124+
if err := os.MkdirAll(storagePath, 0o755); err != nil {
125+
cancel()
126+
return fmt.Errorf("failed to create storage directory: %w", err)
127+
}
128+
}
129+
130+
// Filesystem-backed local registry
131+
local := NewDiskRegistry(storagePath)
124132

125133
var httpHandler http.Handler
126134

0 commit comments

Comments
 (0)