manifest

package
v1.17.4-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: BSD-3-Clause Imports: 7 Imported by: 3

Documentation

Overview

Package manifest contains the abstractions needed for collection representation in Swarm.

Index

Constants

View Source
const (
	RootPath                      = "/"
	WebsiteIndexDocumentSuffixKey = "website-index-document"
	WebsiteErrorDocumentPathKey   = "website-error-document"
	EntryMetadataContentTypeKey   = "Content-Type"
	EntryMetadataFilenameKey      = "Filename"
)
View Source
const DefaultManifestType = ManifestMantarayContentType
View Source
const (
	// ManifestMantarayContentType represents content type used for noting that
	// specific file should be processed as mantaray manifest.
	ManifestMantarayContentType = "application/bzz-manifest-mantaray+octet-stream"
)
View Source
const (
	// ManifestSimpleContentType represents content type used for noting that
	// specific file should be processed as 'simple' manifest
	ManifestSimpleContentType = "application/bzz-manifest-simple+json"
)

Variables

View Source
var (
	// ErrNotFound is returned when an Entry is not found in the manifest.
	ErrNotFound = errors.New("manifest: not found")

	// ErrInvalidManifestType is returned when an unknown manifest type
	// is provided to the function.
	ErrInvalidManifestType = errors.New("manifest: invalid type")

	// ErrMissingReference is returned when the reference for the manifest file
	// is missing.
	ErrMissingReference = errors.New("manifest: missing reference")
)

Functions

This section is empty.

Types

type Entry

type Entry interface {
	// Reference returns the address of the file.
	Reference() swarm.Address
	// Metadata returns the metadata of the file.
	Metadata() map[string]string
}

Entry represents a single manifest entry.

func NewEntry

func NewEntry(reference swarm.Address, metadata map[string]string) Entry

NewEntry creates a new manifest entry.

type Interface

type Interface interface {
	// Type returns manifest implementation type information
	Type() string
	// Add a manifest entry to the specified path.
	Add(context.Context, string, Entry) error
	// Remove a manifest entry on the specified path.
	Remove(context.Context, string) error
	// Lookup returns a manifest entry if one is found in the specified path.
	Lookup(context.Context, string) (Entry, error)
	// HasPrefix tests whether the specified prefix path exists.
	HasPrefix(context.Context, string) (bool, error)
	// Store stores the manifest, returning the resulting address.
	Store(context.Context, ...StoreSizeFunc) (swarm.Address, error)
	// IterateAddresses is used to iterate over chunks addresses for
	// the manifest.
	IterateAddresses(context.Context, swarm.AddressIterFunc) error
}

Interface for operations with manifest.

func NewDefaultManifest

func NewDefaultManifest(
	ls file.LoadSaver,
	encrypted bool,
) (Interface, error)

NewDefaultManifest creates a new manifest with default type.

func NewDefaultManifestReference added in v0.6.0

func NewDefaultManifestReference(
	reference swarm.Address,
	ls file.LoadSaver,
) (Interface, error)

NewDefaultManifestReference creates a new manifest with default type.

func NewManifest

func NewManifest(
	manifestType string,
	ls file.LoadSaver,
	encrypted bool,
) (Interface, error)

NewManifest creates a new manifest.

func NewManifestReference

func NewManifestReference(
	manifestType string,
	reference swarm.Address,
	ls file.LoadSaver,
) (Interface, error)

NewManifestReference loads existing manifest.

func NewMantarayManifest

func NewMantarayManifest(
	ls file.LoadSaver,
	encrypted bool,
) (Interface, error)

NewMantarayManifest creates a new mantaray-based manifest.

func NewMantarayManifestReference

func NewMantarayManifestReference(
	reference swarm.Address,
	ls file.LoadSaver,
) (Interface, error)

NewMantarayManifestReference loads existing mantaray-based manifest.

func NewSimpleManifest

func NewSimpleManifest(ls file.LoadSaver) (Interface, error)

NewSimpleManifest creates a new simple manifest.

func NewSimpleManifestReference

func NewSimpleManifestReference(ref swarm.Address, l file.LoadSaver) (Interface, error)

NewSimpleManifestReference loads existing simple manifest.

type StoreSizeFunc added in v0.5.0

type StoreSizeFunc func(int64) error

StoreSizeFunc is a callback on every content size that will be stored by the Store function.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL