func (base *Base) Reader(ctx context.Context, path string, offset int64) (io.ReadCloser, error) {
	ctx, done := context.WithTrace(ctx)
	defer done("%s.Reader(%q, %d)", base.Name(), path, offset)
	if offset < 0 {
		return nil, storagedriver.InvalidOffsetError{Path: path, Offset: offset, DriverName: base.StorageDriver.Name()}
	}
	if !storagedriver.PathRegexp.MatchString(path) {
		return nil, storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}
	}
	rc, e := base.StorageDriver.Reader(ctx, path, offset)
	return rc, base.setDriverName(e)
}
Reader wraps Reader of underlying storage driver.
package base
import (
	"io"
	"github.com/docker/distribution/context"
	storagedriver "github.com/docker/distribution/registry/storage/driver"
)
type Base struct {
	storagedriver.StorageDriver
}
func (base *Base) setDriverName(e error) error {
	switch actual := e.(type) {
	case nil:
		return nil
	case storagedriver.ErrUnsupportedMethod:
		actual.DriverName = base.StorageDriver.Name()
		return actual
	case storagedriver.PathNotFoundError:
		actual.DriverName = base.StorageDriver.Name()
		return actual
	case storagedriver.InvalidPathError:
		actual.DriverName = base.StorageDriver.Name()
		return actual
	case storagedriver.InvalidOffsetError:
		actual.DriverName = base.StorageDriver.Name()
		return actual
	default:
		storageError := storagedriver.Error{
			DriverName: base.StorageDriver.Name(),
			Enclosed:   e,
		}
		return storageError
	}
}
func (base *Base) GetContent(ctx context.Context, path string) ([]byte, error) {
	ctx, done := context.WithTrace(ctx)
	defer done("%s.GetContent(%q)", base.Name(), path)
	if !storagedriver.PathRegexp.MatchString(path) {
		return nil, storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}
	}
	b, e := base.StorageDriver.GetContent(ctx, path)
	return b, base.setDriverName(e)
}
func (base *Base) PutContent(ctx context.Context, path string, content []byte) error {
	ctx, done := context.WithTrace(ctx)
	defer done("%s.PutContent(%q)", base.Name(), path)
	if !storagedriver.PathRegexp.MatchString(path) {
		return storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}
	}
	return base.setDriverName(base.StorageDriver.PutContent(ctx, path, content))
}