func (v *View) sanityCheck(key string) error {
	if strings.Contains(key, "..") {
		return ErrRelativePath
	}
	return nil
}
sanityCheck is used to perform a sanity check on a key
package physical
import (
	"context"
	"errors"
	"strings"
)
var (
	ErrRelativePath = errors.New("relative paths not supported")
)
type View struct {
	backend Backend
	prefix  string
}
var _ Backend = (*View)(nil)
func NewView(backend Backend, prefix string) *View {
	return &View{
		backend: backend,
		prefix:  prefix,
	}
}
func (v *View) List(ctx context.Context, prefix string) ([]string, error) {
	if err := v.sanityCheck(prefix); err != nil {
		return nil, err
	}
	return v.backend.List(ctx, v.expandKey(prefix))
}
func (v *View) Get(ctx context.Context, key string) (*Entry, error) {
	if err := v.sanityCheck(key); err != nil {
		return nil, err
	}
	entry, err := v.backend.Get(ctx, v.expandKey(key))
	if err != nil {
		return nil, err
	}
	if entry == nil {
		return nil, nil
	}
	if entry != nil {
		entry.Key = v.truncateKey(entry.Key)
	}
	return &Entry{
		Key:   entry.Key,
		Value: entry.Value,
	}, nil
}
func (v *View) Put(ctx context.Context, entry *Entry) error {
	if err := v.sanityCheck(entry.Key); err != nil {
		return err
	}
	nested := &Entry{
		Key:   v.expandKey(entry.Key),
		Value: entry.Value,
	}
	return v.backend.Put(ctx, nested)
}
func (v *View) Delete(ctx context.Context, key string) error {
	if err := v.sanityCheck(key); err != nil {
		return err
	}
	return v.backend.Delete(ctx, v.expandKey(key))
}