cas

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContentNotFound = errors.New("content not found")

ErrContentNotFound is used to indicate that content as a given address could not be found.

Functions

This section is empty.

Types

type CAS

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

CAS represents a content-addressable storage provider.

func New

New returns a new CAS that uses the passed in provider as a backing store. If no CID version is specified, then v1 will be used by default.

func (*CAS) Read

func (p *CAS) Read(address string) ([]byte, error)

Read reads the content of the given address from the underlying storage provider. Returns the content at the given address.

func (*CAS) Write

func (p *CAS) Write(content []byte) (string, error)

Write writes the given content to the underlying storage provider using this CAS' default CID version. Returns the address of the content.

func (*CAS) WriteWithCIDFormat added in v0.1.2

func (p *CAS) WriteWithCIDFormat(content []byte, opts ...extendedcasclient.CIDFormatOption) (string, error)

WriteWithCIDFormat writes the given content to the underlying storage provider. If useV0CID is true, then the older v0 CID version will be used for calculating the address of the content instead of the newer v1 version. Returns the address of the content. TODO (#418): Support creating IPFS-compatible CIDs when content is > 256KB. TODO (#443): Support v1 CID formats (different multibases and multicodecs) other than just the IPFS default.

Jump to

Keyboard shortcuts

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