ipfs

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: LGPL-3.0 Imports: 44 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CidLength        = 36
	ZeroPeersTimeout = 2 * time.Minute
	GcPeriod         = time.Second * 15
)

Variables

View Source
var (
	EmptyCid  cid.Cid
	MinCid    [CidLength]byte
	MaxCid    [CidLength]byte
	TooBigErr = errors.New("ipfs data is too big")
)

Functions

func GetVersion

func GetVersion(ipfsdir string) (int, error)

func Migrate

func Migrate(ipfsdir string, to int) error

Types

type DataType added in v0.19.2

type DataType = uint32
const (
	Block   DataType = 1
	Flip    DataType = 2
	Profile DataType = 3
)

type Proxy

type Proxy interface {
	Add(data []byte, pin bool) (cid.Cid, error)
	Get(key []byte, dataType DataType) ([]byte, error)
	LoadTo(key []byte, to io.Writer, ctx context.Context, onLoading func(size, loaded int64)) error
	Pin(key []byte) error
	Unpin(key []byte) error
	Cid(data []byte) (cid.Cid, error)
	Port() int
	PeerId() string
	AddFile(absPath string, data io.ReadCloser, fi os.FileInfo) (cid.Cid, error)
	Host() core2.Host
	ShouldPin(dataType DataType) bool
}

func NewIpfsProxy

func NewIpfsProxy(cfg *config.IpfsConfig, bus eventbus.Bus) (Proxy, error)

func NewMemoryIpfsProxy

func NewMemoryIpfsProxy() Proxy

Jump to

Keyboard shortcuts

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