func (w *FilterLayerWriter) Close() (err error) {
	if w.context != 0 {
		err = importLayerEnd(w.context)
		if err != nil {
			err = hcserror.New(err, "ImportLayerEnd", "")
		}
		w.context = 0
	}
	return
}
Close completes the layer write operation. The error must be checked to ensure that the
operation was successful.
package wclayer
import (
	"errors"
	"io/ioutil"
	"os"
	"path/filepath"
	"github.com/Microsoft/go-winio"
	"github.com/Microsoft/hcsshim/internal/hcserror"
	"github.com/Microsoft/hcsshim/internal/safefile"
	"github.com/sirupsen/logrus"
)
func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) error {
	title := "hcsshim::ImportLayer "
	logrus.Debugf(title+"path %s folder %s", path, importFolderPath)
	layers, err := layerPathsToDescriptors(parentLayerPaths)
	if err != nil {
		return err
	}
	err = importLayer(&stdDriverInfo, path, importFolderPath, layers)
	if err != nil {
		err = hcserror.Errorf(err, title, "path=%s folder=%s", path, importFolderPath)
		logrus.Error(err)
		return err
	}
	logrus.Debugf(title+"succeeded path=%s folder=%s", path, importFolderPath)
	return nil
}
type LayerWriter interface {
	Add(name string, fileInfo *winio.FileBasicInfo) error
	AddLink(name string, target string) error
	Remove(name string) error
	Write(b []byte) (int, error)
	Close() error
}
type FilterLayerWriter struct {
	context uintptr
}
func (w *FilterLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) error {
	if name[0] != '\\' {
		name = `\` + name
	}
	err := importLayerNext(w.context, name, fileInfo)
	if err != nil {
		return hcserror.New(err, "ImportLayerNext", "")
	}
	return nil
}
func (w *FilterLayerWriter) AddLink(name string, target string) error {
	return errors.New("hard links not yet supported")
}
func (w *FilterLayerWriter) Remove(name string) error {
	if name[0] != '\\' {
		name = `\` + name
	}
	err := importLayerNext(w.context, name, nil)
	if err != nil {
		return hcserror.New(err, "ImportLayerNext", "")
	}
	return nil
}
func (w *FilterLayerWriter) Write(b []byte) (int, error) {
	err := importLayerWrite(w.context, b)
	if err != nil {
		err = hcserror.New(err, "ImportLayerWrite", "")
		return 0, err
	}
	return len(b), err
}