cas

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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, casLink string, ipfsClient *ipfs.Client, metrics metricsProvider,
	cacheSize int, opts ...extendedcasclient.CIDFormatOption) (*CAS, error)

New returns a new CAS that uses the passed in provider as a backing store for local CAS storage. ipfsClient is optional, but if provided (not nil), then writes will go to IPFS in addition to the passed in provider. Reads are always done on only the passed in provider. If no CID version is specified, then v1 will be used by default.

func (*CAS) GetPrimaryWriterType

func (p *CAS) GetPrimaryWriterType() string

GetPrimaryWriterType returns primary writer type.

func (*CAS) Read

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

Read reads the content of the given address from the underlying local CAS 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 CAS provider (and IPFS if configured) using this CAS' default CID version. Returns the address of the content.

func (*CAS) WriteWithCIDFormat

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

WriteWithCIDFormat writes the given content to the underlying local CAS provider (and IPFS if configured) using the CID format specified by opts. 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