func (m MetaFolders) Manifests() string {
	return filepath.Join(string(m), "manifests")
}
Manifests return the manifests folder path
package metadata
import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"os"
	"path/filepath"
	"github.com/opencontainers/go-digest"
	"github.com/pkg/errors"
	"github.com/setekhid/ketos/pkg/registry"
)
const KetosMetaFolder = ".ketos"
func SeekKetosFolder(path string) (string, error) {
	path, err := filepath.Abs(path)
	if err != nil {
		return "", errors.Wrap(err, "abs path")
	}
	for {
		mayKetos := filepath.Join(path, KetosMetaFolder)
		_, err := os.Stat(mayKetos)
		if err == nil {
			return mayKetos, nil
		}
		if !os.IsNotExist(err) {
			return "", errors.Wrap(err, "open ketos metadata")
		}
		parent := filepath.Dir(path)
		if path == parent {
			return "", errors.New("didn't find metadata")
		}
		path = parent
	}
}
func KetosFolder() (string, error) {
	wd, err := os.Getwd()
	if err != nil {
		return "", errors.Wrap(err, "get current working directory")
	}
	return SeekKetosFolder(wd)
}
type MetaFolders string
func (m MetaFolders) InitFolders() error {
	err := os.MkdirAll(filepath.Dir(m.Config()), os.ModePerm)
	if err != nil {
		return errors.Wrap(err, "mkdir directory of config")
	}
	err = os.MkdirAll(m.Container(), os.ModePerm)
	if err != nil {
		return errors.Wrap(err, "mkdir container directory")
	}
	err = os.MkdirAll(m.Layers(), os.ModePerm)
	if err != nil {
		return errors.Wrap(err, "mkdir layers")
	}
	err = os.MkdirAll(m.Packs(), os.ModePerm)
	if err != nil {
		return errors.Wrap(err, "mkdir layers")
	}
	err = os.MkdirAll(m.Manifests(), os.ModePerm)
	if err != nil {
		return errors.Wrap(err, "mkdir manifests")
	}
	return nil
}
func (m MetaFolders) InitConfig(image string) error {
	config := &KetosConfig{}
	config.InitImageName = image
	config.Repository.Registry, config.Repository.Name, _ =
		registry.DockerImage(image).Split()
	content, err := yaml.Marshal(config)
	if err != nil {
		return errors.Wrap(err, "marshal ketos config")
	}
	err = ioutil.WriteFile(m.Config(), content, os.ModePerm)
	if err != nil {
		return errors.Wrap(err, "write down config file")
	}
	return nil
}
func (m MetaFolders) Config() string {
	return filepath.Join(string(m), "config.yaml")
}
func (m MetaFolders) Container() string {
	return filepath.Dir(string(m))
}
func (m MetaFolders) Layers() string {
	return filepath.Join(string(m), "layers")
}
func (m MetaFolders) Layer(digest digest.Digest) string {
	return filepath.Join(m.Layers(), digest.String())
}
func (m MetaFolders) Packs() string {
	return filepath.Join(string(m), "packs")
}
func (m MetaFolders) Pack(digest digest.Digest) string {
	return filepath.Join(m.Packs(), digest.String())
}
func (m MetaFolders) MetaLayer(digest digest.Digest) string {
	return filepath.Join(m.Layers(), digest.Hex()+".json")
}