ipfs

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: LGPL-3.0 Imports: 43 Imported by: 3

Documentation

Index

Constants

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

Variables

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

Functions

This section is empty.

Types

type DataType added in v0.19.2

type DataType = uint32
const (
	Block      DataType = 1
	Flip       DataType = 2
	Profile    DataType = 3
	TxReceipt  DataType = 4
	CustomData DataType = 5
)

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
	GetWithSizeLimit(key []byte, dataType DataType, size int64) ([]byte, error)
	PubSub() *pubsub.PubSub
	GC() (ctx context.Context, cancel context.CancelFunc)
}

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