func()

in lib/backend/shadowbackend/client.go [206:230]


func (c *Client) Stat(namespace string, name string) (*core.BlobInfo, error) {
	// read from both, fail if error from either
	res, errA := c.active.Stat(namespace, name)
	_, errS := c.shadow.Stat(namespace, name)

	if isNotFoundErr(errA) && isNotFoundErr(errS) {
		return nil, backenderrors.ErrBlobNotFound
	}

	if errA != nil || errS != nil {
		if errA != nil && errS == nil {
			log.Errorf("[Stat] error getting %s for namespace '%s' from active backend: %v", name, namespace, errA)
			return nil, errA
		}

		if errS != nil && errA == nil {
			log.Errorf("[Stat] error getting %s for namespace '%s' from shadow backend: %v", name, namespace, errS)
			return nil, errS
		}

		return nil, fmt.Errorf("[Stat] error in both backends for %s in namespace '%s'. active: '%v', shadow: '%v'", name, namespace, errA, errS)
	}

	return res, nil
}