vendor: upgrade containers/storage

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-05-17 19:18:35 +02:00
parent 5addc8caf0
commit ecd0006e80
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
114 changed files with 11464 additions and 1003 deletions

View file

@ -6,8 +6,8 @@ import (
"io/ioutil"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var (
@ -22,7 +22,7 @@ func container(flags *mflag.FlagSet, action string, m storage.Store, args []stri
}
matches := []*storage.Container{}
for _, arg := range args {
if container, err := m.GetContainer(arg); err == nil {
if container, err := m.Container(arg); err == nil {
matches = append(matches, container)
}
}
@ -56,7 +56,7 @@ func container(flags *mflag.FlagSet, action string, m storage.Store, args []stri
}
func listContainerBigData(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
container, err := m.GetContainer(args[0])
container, err := m.Container(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -73,7 +73,7 @@ func listContainerBigData(flags *mflag.FlagSet, action string, m storage.Store,
}
func getContainerBigData(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
container, err := m.GetContainer(args[0])
container, err := m.Container(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -87,7 +87,7 @@ func getContainerBigData(flags *mflag.FlagSet, action string, m storage.Store, a
}
output = f
}
b, err := m.GetContainerBigData(container.ID, args[1])
b, err := m.ContainerBigData(container.ID, args[1])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -98,7 +98,7 @@ func getContainerBigData(flags *mflag.FlagSet, action string, m storage.Store, a
}
func setContainerBigData(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
container, err := m.GetContainer(args[0])
container, err := m.Container(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -126,7 +126,7 @@ func setContainerBigData(flags *mflag.FlagSet, action string, m storage.Store, a
}
func getContainerDir(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
path, err := m.GetContainerDirectory(args[0])
path, err := m.ContainerDirectory(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -136,7 +136,7 @@ func getContainerDir(flags *mflag.FlagSet, action string, m storage.Store, args
}
func getContainerRunDir(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
path, err := m.GetContainerRunDirectory(args[0])
path, err := m.ContainerRunDirectory(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
func containers(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {

View file

@ -7,9 +7,9 @@ import (
"io/ioutil"
"os"
"github.com/containers/storage"
"github.com/containers/storage/opts"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var (
@ -51,13 +51,13 @@ func importLayer(flags *mflag.FlagSet, action string, m storage.Store, args []st
}
diffStream := io.Reader(os.Stdin)
if applyDiffFile != "" {
if f, err := os.Open(applyDiffFile); err != nil {
f, err := os.Open(applyDiffFile)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
} else {
diffStream = f
defer f.Close()
}
diffStream = f
defer f.Close()
}
layer, _, err := m.PutLayer(paramID, parent, paramNames, paramMountLabel, !paramCreateRO, diffStream)
if err != nil {

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var testDeleteImage = false

View file

@ -6,9 +6,9 @@ import (
"io"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var (
@ -63,13 +63,13 @@ func diff(flags *mflag.FlagSet, action string, m storage.Store, args []string) i
}
diffStream := io.Writer(os.Stdout)
if diffFile != "" {
if f, err := os.Create(diffFile); err != nil {
f, err := os.Create(diffFile)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
} else {
diffStream = f
defer f.Close()
}
diffStream = f
defer f.Close()
}
reader, err := m.Diff(from, to)
if err != nil {
@ -108,13 +108,13 @@ func applyDiff(flags *mflag.FlagSet, action string, m storage.Store, args []stri
}
diffStream := io.Reader(os.Stdin)
if applyDiffFile != "" {
if f, err := os.Open(applyDiffFile); err != nil {
f, err := os.Open(applyDiffFile)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
} else {
diffStream = f
defer f.Close()
}
diffStream = f
defer f.Close()
}
_, err := m.ApplyDiff(args[0], diffStream)
if err != nil {

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var (
@ -26,17 +26,17 @@ func exist(flags *mflag.FlagSet, action string, m storage.Store, args []string)
exists := m.Exists(what)
existDict[what] = exists
if existContainer {
if c, err := m.GetContainer(what); c == nil || err != nil {
if c, err := m.Container(what); c == nil || err != nil {
exists = false
}
}
if existImage {
if i, err := m.GetImage(what); i == nil || err != nil {
if i, err := m.Image(what); i == nil || err != nil {
exists = false
}
}
if existLayer {
if l, err := m.GetLayer(what); l == nil || err != nil {
if l, err := m.Layer(what); l == nil || err != nil {
exists = false
}
}

View file

@ -6,8 +6,8 @@ import (
"io/ioutil"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var (
@ -17,7 +17,7 @@ var (
func image(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
matched := []*storage.Image{}
for _, arg := range args {
if image, err := m.GetImage(arg); err == nil {
if image, err := m.Image(arg); err == nil {
matched = append(matched, image)
}
}
@ -42,7 +42,7 @@ func image(flags *mflag.FlagSet, action string, m storage.Store, args []string)
}
func listImageBigData(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
image, err := m.GetImage(args[0])
image, err := m.Image(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -59,7 +59,7 @@ func listImageBigData(flags *mflag.FlagSet, action string, m storage.Store, args
}
func getImageBigData(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
image, err := m.GetImage(args[0])
image, err := m.Image(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -73,7 +73,7 @@ func getImageBigData(flags *mflag.FlagSet, action string, m storage.Store, args
}
output = f
}
b, err := m.GetImageBigData(image.ID, args[1])
b, err := m.ImageBigData(image.ID, args[1])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -84,7 +84,7 @@ func getImageBigData(flags *mflag.FlagSet, action string, m storage.Store, args
}
func setImageBigData(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
image, err := m.GetImage(args[0])
image, err := m.Image(args[0])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
func images(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var listLayersTree = false

View file

@ -5,10 +5,10 @@ import (
"os"
"github.com/Sirupsen/logrus"
"github.com/containers/storage"
"github.com/containers/storage/opts"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/pkg/reexec"
"github.com/containers/storage/storage"
)
type command struct {

View file

@ -7,8 +7,8 @@ import (
"os"
"strings"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var metadataQuiet = false
@ -20,7 +20,7 @@ func metadata(flags *mflag.FlagSet, action string, m storage.Store, args []strin
metadataDict := make(map[string]string)
missingAny := false
for _, what := range args {
if metadata, err := m.GetMetadata(what); err == nil {
if metadata, err := m.Metadata(what); err == nil {
metadataDict[what] = strings.TrimSuffix(metadata, "\n")
} else {
missingAny = true

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
type mountPointOrError struct {

View file

@ -5,9 +5,9 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/opts"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
func addNames(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {
@ -19,7 +19,7 @@ func addNames(flags *mflag.FlagSet, action string, m storage.Store, args []strin
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
}
oldnames, err := m.GetNames(id)
oldnames, err := m.Names(id)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -35,7 +35,7 @@ func addNames(flags *mflag.FlagSet, action string, m storage.Store, args []strin
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
}
names, err := m.GetNames(id)
names, err := m.Names(id)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
@ -59,7 +59,7 @@ func setNames(flags *mflag.FlagSet, action string, m storage.Store, args []strin
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1
}
names, err := m.GetNames(id)
names, err := m.Names(id)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
return 1

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
var (

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
func status(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
func version(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"github.com/containers/storage"
"github.com/containers/storage/pkg/mflag"
"github.com/containers/storage/storage"
)
func wipe(flags *mflag.FlagSet, action string, m storage.Store, args []string) int {

View file

@ -264,7 +264,7 @@ func (r *containerStore) Create(id string, names []string, image, layer, metadat
return container, err
}
func (r *containerStore) GetMetadata(id string) (string, error) {
func (r *containerStore) Metadata(id string) (string, error) {
if container, ok := r.lookup(id); ok {
return container.Metadata, nil
}
@ -347,7 +347,7 @@ func (r *containerStore) Exists(id string) bool {
return ok
}
func (r *containerStore) GetBigData(id, key string) ([]byte, error) {
func (r *containerStore) BigData(id, key string) ([]byte, error) {
c, ok := r.lookup(id)
if !ok {
return nil, ErrContainerUnknown
@ -355,7 +355,7 @@ func (r *containerStore) GetBigData(id, key string) ([]byte, error) {
return ioutil.ReadFile(r.datapath(c.ID, key))
}
func (r *containerStore) GetBigDataSize(id, key string) (int64, error) {
func (r *containerStore) BigDataSize(id, key string) (int64, error) {
c, ok := r.lookup(id)
if !ok {
return -1, ErrContainerUnknown
@ -366,7 +366,7 @@ func (r *containerStore) GetBigDataSize(id, key string) (int64, error) {
return -1, ErrSizeUnknown
}
func (r *containerStore) GetBigDataNames(id string) ([]string, error) {
func (r *containerStore) BigDataNames(id string) ([]string, error) {
c, ok := r.lookup(id)
if !ok {
return nil, ErrContainerUnknown

View file

@ -185,8 +185,8 @@ func (a *Driver) Status() [][2]string {
}
}
// GetMetadata not implemented
func (a *Driver) GetMetadata(id string) (map[string]string, error) {
// Metadata not implemented
func (a *Driver) Metadata(id string) (map[string]string, error) {
return nil, nil
}

View file

@ -143,8 +143,8 @@ func (d *Driver) Status() [][2]string {
return status
}
// GetMetadata returns empty metadata for this driver.
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
// Metadata returns empty metadata for this driver.
func (d *Driver) Metadata(id string) (map[string]string, error) {
return nil, nil
}

View file

@ -94,8 +94,8 @@ func (d *Driver) Status() [][2]string {
return status
}
// GetMetadata returns a map of information about the device.
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
// Metadata returns a map of information about the device.
func (d *Driver) Metadata(id string) (map[string]string, error) {
m, err := d.DeviceSet.exportDeviceMetadata(id)
if err != nil {

View file

@ -69,7 +69,7 @@ type ProtoDriver interface {
Status() [][2]string
// Returns a set of key-value pairs which give low level information
// about the image/container driver is managing.
GetMetadata(id string) (map[string]string, error)
Metadata(id string) (map[string]string, error)
// Cleanup performs necessary tasks to release resources
// held by the driver, e.g., unmounting all layered filesystems
// known to this driver.

View file

@ -226,9 +226,9 @@ func (d *Driver) Status() [][2]string {
}
}
// GetMetadata returns meta data about the overlay driver such as
// Metadata returns meta data about the overlay driver such as
// LowerDir, UpperDir, WorkDir and MergeDir used to store data.
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
func (d *Driver) Metadata(id string) (map[string]string, error) {
dir := d.dir(id)
if _, err := os.Stat(dir); err != nil {
return nil, err

View file

@ -144,12 +144,12 @@ func (d *graphDriverProxy) Status() [][2]string {
return ret.Status
}
func (d *graphDriverProxy) GetMetadata(id string) (map[string]string, error) {
func (d *graphDriverProxy) Metadata(id string) (map[string]string, error) {
args := &graphDriverRequest{
ID: id,
}
var ret graphDriverResponse
if err := d.client.Call("GraphDriver.GetMetadata", args, &ret); err != nil {
if err := d.client.Call("GraphDriver.Metadata", args, &ret); err != nil {
return nil, err
}
if ret.Err != "" {

View file

@ -58,8 +58,8 @@ func (d *Driver) Status() [][2]string {
return nil
}
// GetMetadata is used for implementing the graphdriver.ProtoDriver interface. VFS does not currently have any meta data.
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
// Metadata is used for implementing the graphdriver.ProtoDriver interface. VFS does not currently have any meta data.
func (d *Driver) Metadata(id string) (map[string]string, error) {
return nil, nil
}

View file

@ -133,7 +133,7 @@ func (d *Driver) create(id, parent, mountLabel string, readOnly bool, storageOpt
var layerChain []string
if rPId != "" {
parentPath, err := hcsshim.GetLayerMountPath(d.info, rPId)
parentPath, err := hcsshim.LayerMountPath(d.info, rPId)
if err != nil {
return err
}
@ -248,7 +248,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
return "", err
}
mountPath, err := hcsshim.GetLayerMountPath(d.info, rID)
mountPath, err := hcsshim.LayerMountPath(d.info, rID)
if err != nil {
d.ctr.Decrement(rID)
if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil {
@ -403,7 +403,7 @@ func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (int64, error
if err != nil {
return 0, err
}
parentPath, err := hcsshim.GetLayerMountPath(d.info, rPId)
parentPath, err := hcsshim.LayerMountPath(d.info, rPId)
if err != nil {
return 0, err
}
@ -446,8 +446,8 @@ func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
return archive.ChangesSize(layerFs, changes), nil
}
// GetMetadata returns custom driver information.
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
// Metadata returns custom driver information.
func (d *Driver) Metadata(id string) (map[string]string, error) {
m := make(map[string]string)
m["dir"] = d.dir(id)
return m, nil

View file

@ -210,8 +210,8 @@ func (d *Driver) Status() [][2]string {
}
}
// GetMetadata returns image/container metadata related to graph driver
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
// Metadata returns image/container metadata related to graph driver
func (d *Driver) Metadata(id string) (map[string]string, error) {
return nil, nil
}

View file

@ -249,7 +249,7 @@ func (r *imageStore) Create(id string, names []string, layer, metadata string) (
return image, err
}
func (r *imageStore) GetMetadata(id string) (string, error) {
func (r *imageStore) Metadata(id string) (string, error) {
if image, ok := r.lookup(id); ok {
return image.Metadata, nil
}
@ -331,7 +331,7 @@ func (r *imageStore) Exists(id string) bool {
return ok
}
func (r *imageStore) GetBigData(id, key string) ([]byte, error) {
func (r *imageStore) BigData(id, key string) ([]byte, error) {
image, ok := r.lookup(id)
if !ok {
return nil, ErrImageUnknown
@ -339,7 +339,7 @@ func (r *imageStore) GetBigData(id, key string) ([]byte, error) {
return ioutil.ReadFile(r.datapath(image.ID, key))
}
func (r *imageStore) GetBigDataSize(id, key string) (int64, error) {
func (r *imageStore) BigDataSize(id, key string) (int64, error) {
image, ok := r.lookup(id)
if !ok {
return -1, ErrImageUnknown
@ -350,7 +350,7 @@ func (r *imageStore) GetBigDataSize(id, key string) (int64, error) {
return -1, ErrSizeUnknown
}
func (r *imageStore) GetBigDataNames(id string) ([]string, error) {
func (r *imageStore) BigDataNames(id string) ([]string, error) {
image, ok := r.lookup(id)
if !ok {
return nil, ErrImageUnknown

View file

@ -163,7 +163,6 @@ type layerStore struct {
idindex *truncindex.TruncIndex
byid map[string]*Layer
byname map[string]*Layer
byparent map[string][]*Layer
bymount map[string]*Layer
}
@ -231,7 +230,6 @@ func (r *layerStore) Load() error {
r.idindex = truncindex.NewTruncIndex(idlist)
r.byid = ids
r.byname = names
r.byparent = parents
r.bymount = mounts
err = nil
// Last step: try to remove anything that a previous user of this
@ -309,7 +307,6 @@ func newLayerStore(rundir string, layerdir string, driver drivers.Driver) (Layer
byid: make(map[string]*Layer),
bymount: make(map[string]*Layer),
byname: make(map[string]*Layer),
byparent: make(map[string][]*Layer),
}
if err := rlstore.Load(); err != nil {
return nil, err
@ -400,12 +397,6 @@ func (r *layerStore) Put(id, parent string, names []string, mountLabel string, o
for _, name := range names {
r.byname[name] = layer
}
if pslice, ok := r.byparent[parent]; ok {
pslice = append(pslice, layer)
r.byparent[parent] = pslice
} else {
r.byparent[parent] = []*Layer{layer}
}
for flag, value := range flags {
layer.Flags[flag] = value
}
@ -520,7 +511,7 @@ func (r *layerStore) SetNames(id string, names []string) error {
return ErrLayerUnknown
}
func (r *layerStore) GetMetadata(id string) (string, error) {
func (r *layerStore) Metadata(id string) (string, error) {
if layer, ok := r.lookup(id); ok {
return layer.Metadata, nil
}
@ -553,23 +544,8 @@ func (r *layerStore) Delete(id string) error {
err := r.driver.Remove(id)
if err == nil {
os.Remove(r.tspath(id))
pslice := r.byparent[layer.Parent]
newPslice := []*Layer{}
for _, candidate := range pslice {
if candidate.ID != id {
newPslice = append(newPslice, candidate)
}
}
delete(r.byid, id)
r.idindex.Delete(id)
if len(newPslice) > 0 {
r.byparent[layer.Parent] = newPslice
} else {
delete(r.byparent, layer.Parent)
}
for _, name := range layer.Names {
delete(r.byname, name)
}
if layer.MountPoint != "" {
delete(r.bymount, layer.MountPoint)
}
@ -619,11 +595,12 @@ func (r *layerStore) Wipe() error {
return nil
}
func (r *layerStore) findParentAndLayer(from, to string) (fromID string, toID string, fromLayer *Layer, toLayer *Layer, err error) {
func (r *layerStore) findParentAndLayer(from, to string) (fromID string, toID string, toLayer *Layer, err error) {
var ok bool
var fromLayer *Layer
toLayer, ok = r.lookup(to)
if !ok {
return "", "", nil, nil, ErrLayerUnknown
return "", "", nil, ErrLayerUnknown
}
to = toLayer.ID
if from == "" {
@ -631,19 +608,20 @@ func (r *layerStore) findParentAndLayer(from, to string) (fromID string, toID st
}
if from != "" {
fromLayer, ok = r.lookup(from)
if !ok {
if ok {
from = fromLayer.ID
} else {
fromLayer, ok = r.lookup(toLayer.Parent)
if !ok {
return "", "", nil, nil, ErrParentUnknown
if ok {
from = fromLayer.ID
}
}
from = fromLayer.ID
}
return from, to, fromLayer, toLayer, nil
return from, to, toLayer, nil
}
func (r *layerStore) Changes(from, to string) ([]archive.Change, error) {
from, to, _, _, err := r.findParentAndLayer(from, to)
from, to, _, err := r.findParentAndLayer(from, to)
if err != nil {
return nil, ErrLayerUnknown
}
@ -682,7 +660,7 @@ func (r *layerStore) newFileGetter(id string) (drivers.FileGetCloser, error) {
func (r *layerStore) Diff(from, to string) (io.ReadCloser, error) {
var metadata storage.Unpacker
from, to, _, toLayer, err := r.findParentAndLayer(from, to)
from, to, toLayer, err := r.findParentAndLayer(from, to)
if err != nil {
return nil, ErrLayerUnknown
}
@ -772,7 +750,7 @@ func (r *layerStore) Diff(from, to string) (io.ReadCloser, error) {
}
func (r *layerStore) DiffSize(from, to string) (size int64, err error) {
from, to, _, _, err = r.findParentAndLayer(from, to)
from, to, _, err = r.findParentAndLayer(from, to)
if err != nil {
return -1, ErrLayerUnknown
}