ipfs

package
v0.0.0-...-b598ae0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: GPL-3.0 Imports: 45 Imported by: 0

README

IPFS

This package is a superset of tools used to simplify certain actions on IPFS.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeNewIPFSNodes

func FakeNewIPFSNodes(ctx context.Context, numPeers int) []*core.IpfsNode

func FakeNewIPFSNodesNetworked

func FakeNewIPFSNodesNetworked(mn mocknet.Mocknet, ctx context.Context, numPeers int, existing []*core.IpfsNode) []*core.IpfsNode

func OpenIPFSRepo

func OpenIPFSRepo(ctx context.Context, path string, limited bool, swarmkey []byte) (*core.IpfsNode, error)

func Publish

func Publish(node *core.IpfsNode, topic string, data []byte) error

func PublishPath

func PublishPath(n *core.IpfsNode, pth path.Path) error

func StringToCid

func StringToCid(value string) *cid.Cid

func StringToCid2

func StringToCid2(value string) *cid.Cid

func Subscribe

func Subscribe(node *core.IpfsNode, topic string, didChange func(peer peer.ID, data []byte)) (*floodsub.Subscription, error)

Types

type BitswapService

type BitswapService struct {
	// contains filtered or unexported fields
}

Find other peers around a subject. This is done by using kad-DHT.

func NewBitSwap

func NewBitSwap(node *core.IpfsNode) (*BitswapService, error)

func (*BitswapService) DecodeKey

func (b *BitswapService) DecodeKey(key string) (string, error)

func (*BitswapService) Find

func (b *BitswapService) Find(subject string, num int) <-chan pstore.PeerInfo

func (*BitswapService) GetShardedValues

func (b *BitswapService) GetShardedValues(ctx context.Context, keyType string, rawKey string) ([][]byte, error)

func (*BitswapService) GetValue

func (b *BitswapService) GetValue(ctx context.Context, keyType string, rawKey string) ([]byte, error)

func (*BitswapService) Provide

func (b *BitswapService) Provide(subject string) error

func (*BitswapService) PutShardedValues

func (b *BitswapService) PutShardedValues(keyType string, rawKey string, data []byte) error

Sharded value means that on this key type we can have several values. The value put in here will get shared over slots

func (*BitswapService) PutValue

func (b *BitswapService) PutValue(keyType string, rawKey string, data []byte) error

func (*BitswapService) RegisterValidator

func (b *BitswapService) RegisterValidator(key string, validatorFunc validateFunc_t, selectFunc selectFunc_t, cache bool) error

type FilesAPI

type FilesAPI struct {
	// contains filtered or unexported fields
}

Simplifies all the interactions with IPFS.

func NewFilesAPI

func NewFilesAPI(ctx context.Context, node *core.IpfsNode, api iface.CoreAPI) (*FilesAPI, error)

func (*FilesAPI) GetFile

func (d *FilesAPI) GetFile(path string) ([]byte, error)

Path could be "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk"

func (*FilesAPI) GetPeerFile

func (d *FilesAPI) GetPeerFile(owner libp2pPeer.ID, name string) ([]byte, error)

func (*FilesAPI) GetPeerFiles

func (d *FilesAPI) GetPeerFiles(owner libp2pPeer.ID) ([]*ipld.Link, error)

func (*FilesAPI) PublishPeerFiles

func (d *FilesAPI) PublishPeerFiles(files []files.File) (string, error)

func (*FilesAPI) SaveFile

func (d *FilesAPI) SaveFile(data []byte) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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