Documentation ¶
Index ¶
- Constants
- func BuildEStargz(ents []TarEntry, opts ...BuildEStargzOption) (*io.SectionReader, digest.Digest, error)
- func BuildTar(ents []TarEntry, opts ...BuildTarOption) io.Reader
- func EnsureHello(ctx context.Context) (*ocispec.Descriptor, content.Store, error)
- func RandomBytes(t *testing.T, n int) []byte
- type BuildEStargzOption
- type BuildTarOption
- type BuildTarOptions
- type Compression
- type CompressionFactory
- type DirectoryBuildTarOption
- type FileBuildTarOption
- type TarEntry
- func Blockdev(name string, major, minor int64) TarEntry
- func Chardev(name string, major, minor int64) TarEntry
- func Dir(name string, opts ...DirectoryBuildTarOption) TarEntry
- func Fifo(name string) TarEntry
- func File(name, contents string, opts ...FileBuildTarOption) TarEntry
- func Link(name, linkname string) TarEntry
- func Symlink(name, target string) TarEntry
Constants ¶
const ( // HelloArchiveURL points to an OCI archive of `hello-world`. // Exported from `docker.io/library/hello-world@sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec` . // See https://github.com/AkihiroSuda/test-oci-archives/releases/tag/v20210101 HelloArchiveURL = "https://github.com/AkihiroSuda/test-oci-archives/releases/download/v20210101/hello-world.tar.gz" // HelloArchiveDigest is the digest of the archive. HelloArchiveDigest = "sha256:5aa022621c4de0e941ab2a30d4569c403e156b4ba2de2ec32e382ae8679f40e1" )
Variables ¶
This section is empty.
Functions ¶
func BuildEStargz ¶ added in v0.6.0
func BuildEStargz(ents []TarEntry, opts ...BuildEStargzOption) (*io.SectionReader, digest.Digest, error)
func BuildTar ¶ added in v0.4.0
func BuildTar(ents []TarEntry, opts ...BuildTarOption) io.Reader
BuildTar builds a tar blob
func EnsureHello ¶
EnsureHello creates a temp content store and ensures `hello-world` image from HelloArchiveURL into the store.
Types ¶
type BuildEStargzOption ¶ added in v0.6.0
type BuildEStargzOption func(o *buildEStargzOptions) error
func WithBuildTarOptions ¶ added in v0.10.0
func WithBuildTarOptions(to ...BuildTarOption) BuildEStargzOption
WithBuildTarOptions option specifies the options for tar creation
func WithEStargzOptions ¶ added in v0.6.0
func WithEStargzOptions(eo ...estargz.Option) BuildEStargzOption
WithEStargzOptions specifies options for estargz lib
type BuildTarOption ¶ added in v0.6.0
type BuildTarOption func(o *BuildTarOptions)
BuildTarOption is an option used during building blob.
func WithPrefix ¶ added in v0.4.0
func WithPrefix(prefix string) BuildTarOption
WithPrefix is an option to add a prefix string to each file name (e.g. "./", "/", etc.)
type BuildTarOptions ¶ added in v0.6.0
type BuildTarOptions struct { // Prefix is the prefix string need to be added to each file name (e.g. "./", "/", etc.) Prefix string }
BuildTarOptions is a set of options used during building blob.
type Compression ¶ added in v0.13.0
type Compression interface { estargz.Compressor estargz.Decompressor // DecompressTOC decompresses the passed blob and returns a reader of TOC JSON. // This is needed to be used from metadata pkg DecompressTOC(io.Reader) (tocJSON io.ReadCloser, err error) }
type CompressionFactory ¶ added in v0.13.0
type CompressionFactory func() Compression
func ExternalTOCGzipCompressionWithLevel ¶ added in v0.13.0
func ExternalTOCGzipCompressionWithLevel(compressionLevel int) CompressionFactory
func GzipCompressionWithLevel ¶ added in v0.13.0
func GzipCompressionWithLevel(compressionLevel int) CompressionFactory
func ZstdCompressionWithLevel ¶ added in v0.13.0
func ZstdCompressionWithLevel(compressionLevel zstd.EncoderLevel) CompressionFactory
type DirectoryBuildTarOption ¶ added in v0.6.0
type DirectoryBuildTarOption func(o *dirOpts)
DirectoryBuildTarOption is an option for a directory entry.
func WithDirModTime ¶ added in v0.10.0
func WithDirModTime(modTime time.Time) DirectoryBuildTarOption
WithDirModTime specifies the modtime of the dir.
func WithDirMode ¶ added in v0.5.0
func WithDirMode(mode os.FileMode) DirectoryBuildTarOption
WithDirMode specifies the mode of the directory.
func WithDirOwner ¶ added in v0.4.0
func WithDirOwner(uid, gid int) DirectoryBuildTarOption
WithDirOwner specifies the owner of the directory.
func WithDirXattrs ¶ added in v0.5.0
func WithDirXattrs(xattrs map[string]string) DirectoryBuildTarOption
WithDirXattrs specifies the extended attributes of the directory.
type FileBuildTarOption ¶ added in v0.6.0
type FileBuildTarOption func(o *fileOpts)
FileBuildTarOption is an option for a file entry.
func WithFileModTime ¶ added in v0.10.0
func WithFileModTime(modTime time.Time) FileBuildTarOption
WithFileModTime specifies the modtime of the file.
func WithFileMode ¶ added in v0.5.0
func WithFileMode(mode os.FileMode) FileBuildTarOption
WithFileMode specifies the mode of the file.
func WithFileOwner ¶ added in v0.4.0
func WithFileOwner(uid, gid int) FileBuildTarOption
WithFileOwner specifies the owner of the file.
func WithFileXattrs ¶ added in v0.4.0
func WithFileXattrs(xattrs map[string]string) FileBuildTarOption
WithFileXattrs specifies the extended attributes of the file.
type TarEntry ¶ added in v0.4.0
type TarEntry interface {
AppendTar(tw *tar.Writer, opts BuildTarOptions) error
}
TarEntry is an entry of tar.
func Dir ¶ added in v0.4.0
func Dir(name string, opts ...DirectoryBuildTarOption) TarEntry
Dir is a directory entry
func File ¶ added in v0.4.0
func File(name, contents string, opts ...FileBuildTarOption) TarEntry
File is a regilar file entry