Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
func New(provider ariesstorage.Provider, opts ...extendedcasclient.CIDFormatOption) (*CAS, error)
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 ¶
Read reads the content of the given address from the underlying storage provider. Returns the content at the given address.
func (*CAS) Write ¶
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.