1e55ace875
This makes the output of `docker save` fully OCI compliant. When using the containerd image store, this code is not used. That exporter will just use containerd's export method and should give us the output we want for multi-arch images. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
30 lines
562 B
Go
30 lines
562 B
Go
package tar2go
|
|
|
|
import (
|
|
"io/fs"
|
|
)
|
|
|
|
var (
|
|
_ fs.FS = &filesystem{}
|
|
_ fs.File = &file{}
|
|
)
|
|
|
|
type filesystem struct {
|
|
idx *Index
|
|
}
|
|
|
|
func (f *filesystem) Open(name string) (fs.File, error) {
|
|
idx, err := f.idx.indexWithLock(name)
|
|
if err != nil {
|
|
return nil, &fs.PathError{Path: name, Op: "open", Err: err}
|
|
}
|
|
return newFile(idx), nil
|
|
}
|
|
|
|
func (f *filesystem) Stat(name string) (fs.FileInfo, error) {
|
|
idx, err := f.idx.indexWithLock(name)
|
|
if err != nil {
|
|
return nil, &fs.PathError{Path: name, Op: "stat", Err: err}
|
|
}
|
|
return &fileinfo{h: idx.hdr}, nil
|
|
}
|