func NewManifestReference(
	manifestType string,
	reference swarm.Address,
	ls file.LoadSaver,
) (Interface, error) {
	switch manifestType {
	case ManifestSimpleContentType:
		return NewSimpleManifestReference(reference, ls)
	case ManifestMantarayContentType:
		return NewMantarayManifestReference(reference, ls)
	default:
		return nil, ErrInvalidManifestType
	}
}
NewManifestReference loads existing manifest.
package manifest
import (
	"context"
	"errors"
	"github.com/ethsana/sana/pkg/file"
	"github.com/ethsana/sana/pkg/swarm"
)
const DefaultManifestType = ManifestMantarayContentType
const (
	RootPath                      = "/"
	WebsiteIndexDocumentSuffixKey = "website-index-document"
	WebsiteErrorDocumentPathKey   = "website-error-document"
	EntryMetadataContentTypeKey   = "Content-Type"
	EntryMetadataFilenameKey      = "Filename"
)
var (
	ErrNotFound = errors.New("manifest: not found")
	ErrInvalidManifestType = errors.New("manifest: invalid type")
	ErrMissingReference = errors.New("manifest: missing reference")
)
type StoreSizeFunc func(int64) error
type Interface interface {
	Type() string
	Add(context.Context, string, Entry) error
	Remove(context.Context, string) error
	Lookup(context.Context, string) (Entry, error)
	HasPrefix(context.Context, string) (bool, error)
	Store(context.Context, ...StoreSizeFunc) (swarm.Address, error)
	IterateAddresses(context.Context, swarm.AddressIterFunc) error
}
type Entry interface {
	Reference() swarm.Address
	Metadata() map[string]string
}
func NewDefaultManifest(
	ls file.LoadSaver,
	encrypted bool,
) (Interface, error) {
	return NewManifest(DefaultManifestType, ls, encrypted)
}
func NewDefaultManifestReference(
	reference swarm.Address,
	ls file.LoadSaver,
) (Interface, error) {
	return NewManifestReference(DefaultManifestType, reference, ls)
}
func NewManifest(
	manifestType string,
	ls file.LoadSaver,
	encrypted bool,
) (Interface, error) {
	switch manifestType {
	case ManifestSimpleContentType:
		return NewSimpleManifest(ls)
	case ManifestMantarayContentType:
		return NewMantarayManifest(ls, encrypted)
	default:
		return nil, ErrInvalidManifestType
	}
}