datauri

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrSchemeNotSupported indicates a given URI scheme is not supported.
	ErrSchemeNotSupported = errors.New("scheme not supported")

	// ErrCarFileUnavailable indicates a given URI points to an unavailable car file.
	ErrCarFileUnavailable = errors.New("car file unavailable")

	// ErrInvalidCarFile indicates a given URI points to an invalid car file.
	ErrInvalidCarFile = errors.New("invalid car file")
)

Functions

This section is empty.

Types

type HTTPURI

type HTTPURI struct {
	// contains filtered or unexported fields
}

HTTPURI is used to get http/https resources.

func (*HTTPURI) Cid

func (u *HTTPURI) Cid() cid.Cid

Cid returns the data cid referenced by the uri.

func (*HTTPURI) String

func (u *HTTPURI) String() string

String returns the uri as a string.

func (*HTTPURI) Validate

func (u *HTTPURI) Validate(ctx context.Context) error

Validate checks the integrity of the car file. The cid associated with the uri must be the one and only root of the car file.

func (*HTTPURI) Write

func (u *HTTPURI) Write(ctx context.Context, writer io.Writer) error

Write the uri's car file to writer.

type URI

type URI interface {
	fmt.Stringer
	Cid() cid.Cid
	Write(context.Context, io.Writer) error
	Validate(ctx context.Context) error
}

URI describes a data car file for a storage deal.

func NewFromSources

func NewFromSources(payloadCid string, sources auction.Sources) (URI, error)

NewFromSources returns a new URI from the given sources.

func NewURI

func NewURI(payloadCid string, uri string) (URI, error)

NewURI returns a new URI for the given string uri. ErrSchemeNotSupported is returned if the scheme is not supported.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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