Documentation ¶
Overview ¶
Package manifest contains the abstractions needed for collection representation, It uses implementations in ethersphere/manifest repo under the hood.
Index ¶
- Constants
- Variables
- type Entry
- type Interface
- func NewDefaultManifest(ls file.LoadSaver, encrypted bool) (Interface, error)
- func NewDefaultManifestReference(reference boson.Address, ls file.LoadSaver) (Interface, error)
- func NewManifest(manifestType string, ls file.LoadSaver, encrypted bool) (Interface, error)
- func NewManifestReference(manifestType string, reference boson.Address, ls file.LoadSaver) (Interface, error)
- func NewMantarayManifest(ls file.LoadSaver, encrypted bool) (Interface, error)
- func NewMantarayManifestReference(reference boson.Address, ls file.LoadSaver) (Interface, error)
- func NewSimpleManifest(ls file.LoadSaver) (Interface, error)
- func NewSimpleManifestReference(ref boson.Address, l file.LoadSaver) (Interface, error)
- type NodeIterFunc
- type NodeType
- type StoreSizeFunc
Constants ¶
const ( RootPath = "/" ReferenceLinkKey = "reference" WebsiteIndexDocumentSuffixKey = "website-index-document" WebsiteErrorDocumentPathKey = "website-error-document" EntryMetadataContentTypeKey = "Content-Type" EntryMetadataDirnameKey = "Dirname" EntryMetadataFilenameKey = "Filename" )
const DefaultManifestType = ManifestMantarayContentType
const ( // ManifestMantarayContentType represents content type used for noting that // specific file should be processed as mantaray manifest. ManifestMantarayContentType = "application/manifest-mantaray+octet-stream" )
const ( // ManifestSimpleContentType represents content type used for noting that // specific file should be processed as 'simple' manifest ManifestSimpleContentType = "application/manifest-simple+json" )
Variables ¶
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() boson.Address // Metadata returns the metadata of the file. Metadata() map[string]string Index() int64 }
Entry represents a single 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 // Copy a manifest entry to the specified path. Copy(context.Context, boson.Address, string, string, bool) error // Move a manifest entry to the specified path. Move(context.Context, boson.Address, string, string, bool) 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) (boson.Address, error) // IterateDirectories is used to iterate over directory or file for the // manifest. IterateDirectories(context.Context, []byte, int, NodeIterFunc) error // IterateAddresses is used to iterate over chunks addresses for // the manifest. IterateAddresses(context.Context, boson.AddressIterFunc) error }
Interface for operations with manifest.
func NewDefaultManifest ¶
NewDefaultManifest creates a new manifest with default type.
func NewDefaultManifestReference ¶
NewDefaultManifestReference creates a new manifest with default type.
func NewManifest ¶
NewManifest creates a new manifest.
func NewManifestReference ¶
func NewManifestReference( manifestType string, reference boson.Address, ls file.LoadSaver, ) (Interface, error)
NewManifestReference loads existing manifest.
func NewMantarayManifest ¶
NewMantarayManifest creates a new mantaray-based manifest.
func NewMantarayManifestReference ¶
NewMantarayManifestReference loads existing mantaray-based manifest.
func NewSimpleManifest ¶
NewSimpleManifest creates a new simple manifest.
type NodeIterFunc ¶
NodeIterFunc is a callback on each level.
type StoreSizeFunc ¶
StoreSizeFunc is a callback on every content size that will be stored by the Store function.