cas

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 7 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. TODO (#344) Support writing and reading both v0 and v1 CIDs.

func New

func New(provider ariesstorage.Provider, useV0CIDs bool) (*CAS, error)

New returns a new CAS that uses the passed in provider as a backing store.

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. Returns the address of the content. TODO (#418): Support creating IPFS-compatible CIDs when content is > 256KB.

Jump to

Keyboard shortcuts

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