Documentation
¶
Index ¶
- Constants
- Variables
- type Entry
- type Interface
- func NewDefaultManifest(encrypted bool, storer storage.Storer) (Interface, error)
- func NewManifest(manifestType string, encrypted bool, storer storage.Storer) (Interface, error)
- func NewManifestReference(ctx context.Context, manifestType string, reference swarm.Address, ...) (Interface, error)
- func NewMantarayManifest(encrypted bool, storer storage.Storer) (Interface, error)
- func NewMantarayManifestReference(ctx context.Context, reference swarm.Address, encrypted bool, ...) (Interface, error)
- func NewMantarayManifestWithObfuscationKeyFn(encrypted bool, storer storage.Storer, ...) (Interface, error)
- func NewSimpleManifest(encrypted bool, storer storage.Storer) (Interface, error)
- func NewSimpleManifestReference(ctx context.Context, reference swarm.Address, encrypted bool, ...) (Interface, error)
Constants ¶
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.
type Interface ¶
type Interface interface {
// Type returns manifest implementation type information
Type() string
// Add a manifest entry to the specified path.
Add(string, Entry) error
// Remove a manifest entry on the specified path.
Remove(string) error
// Lookup returns a manifest entry if one is found in the specified path.
Lookup(string) (Entry, error)
// HasPrefix tests whether the specified prefix path exists.
HasPrefix(string) (bool, error)
// Store stores the manifest, returning the resulting address.
Store(context.Context, storage.ModePut) (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 ¶
NewDefaultManifest creates a new manifest with default type.
func NewManifest ¶
NewManifest creates a new manifest.
func NewManifestReference ¶
func NewManifestReference( ctx context.Context, manifestType string, reference swarm.Address, encrypted bool, storer storage.Storer, ) (Interface, error)
NewManifestReference loads existing manifest.
func NewMantarayManifest ¶
NewMantarayManifest creates a new mantaray-based manifest.
func NewMantarayManifestReference ¶
func NewMantarayManifestReference( ctx context.Context, reference swarm.Address, encrypted bool, storer storage.Storer, ) (Interface, error)
NewMantarayManifestReference loads existing mantaray-based manifest.
func NewMantarayManifestWithObfuscationKeyFn ¶ added in v0.4.0
func NewMantarayManifestWithObfuscationKeyFn( encrypted bool, storer storage.Storer, obfuscationKeyFn func([]byte) (int, error), ) (Interface, error)
NewMantarayManifestWithObfuscationKeyFn creates a new mantaray-based manifest with configured obfuscation key
NOTE: This should only be used in tests.
func NewSimpleManifest ¶
NewSimpleManifest creates a new simple manifest.
Click to show internal directories.
Click to hide internal directories.