func NewStoreCache(paths []string) (StoreCache, error) {
	sc := StoreCache{
		Paths:  paths,
		Images: map[Image]Archive{},
	}
	walkFn := func(dir string, inInfo os.FileInfo) error {
		path := filepath.Clean(filepath.Join(dir, inInfo.Name()))
		name := filepath.Base(path)
		if inInfo.Mode()&os.ModeSymlink != 0 {
			if lpath, err := filepath.EvalSymlinks(path); err != nil {
				return nil
			} else if inInfo, err = os.Lstat(lpath); err != nil {
				return nil
			}
		}
		if !inInfo.Mode().IsRegular() {
			return nil
		}
		var arFormat ArchiveFormat
		for _, format := range []ArchiveFormat{ArchiveFormatTgz, ArchiveFormatSquashfs} {
			if strings.HasSuffix(name, format.FileSuffix()) {
				arFormat = format
				break
			}
		}
		if arFormat == ArchiveFormatUnknown {
			return nil
		}
		baseName := strings.TrimSuffix(name, arFormat.FileSuffix())
		imageName := baseName
		imageRef := DefaultTagRef
		if strings.ContainsRune(baseName, ':') {
			subs := strings.Split(baseName, ":")
			imageRef = subs[len(subs)-1]
			imageName = strings.Join(subs[:len(subs)-1], "")
		}
		image := Image{
			Name:      imageName,
			Reference: imageRef,
		}
		archive := Archive{image, path, arFormat}
		ar, ok := sc.Images[image]
		if ok && archive.Format == ArchiveFormatSquashfs && ar.Format != ArchiveFormatSquashfs {
			logrus.WithFields(logrus.Fields{
				"name":      image.Name,
				"reference": image.Reference,
				"original":  ar.Filepath,
				"format":    ar.Format,
				"duplicate": path,
			}).Warn("prefering squashfs for duplicate image")
		} else if ok {
			logrus.WithFields(logrus.Fields{
				"name":      image.Name,
				"reference": image.Reference,
				"original":  ar.Filepath,
				"format":    ar.Format,
				"duplicate": path,
			}).Warn("skipped duplicate image")
			return nil
		} else {
			logrus.WithFields(logrus.Fields{
				"name":      image.Name,
				"reference": image.Reference,
				"format":    arFormat,
				"path":      path,
			}).Debug("new archive/reference added to cache")
		}
		sc.Images[image] = archive
		return nil
	}
	for _, dir := range paths {
		files, err := ioutil.ReadDir(dir)
		if err != nil {
			logrus.WithFields(logrus.Fields{
				"path": dir,
				"err":  err,
			}).Info("store skipped")
			continue
		}
		for _, fi := range files {
			_ = walkFn(dir, fi)
		}
	}
	return sc, nil
}
NewStoreCache constructs a new StoreCache using `paths` as lookup directories
package torcx
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/sirupsen/logrus"
)
type StoreCache struct {
	Paths []string
	Images map[Image]Archive
}