ipfs

package
v0.0.0-...-6f193cf Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPFS

type IPFS interface {
	AddDir(string) (string, error)
}

IPFS ipfs interface to abstract the manager

type IpfsManager

type IpfsManager struct {
	Shell *shell.Shell
	// contains filtered or unexported fields
}

IpfsManager is our helper wrapper for IPFS

func NewManager

func NewManager(ipfsURL string) (*IpfsManager, error)

NewManager is used to instantiate IpfsManager with a connection to an ipfs api. if token is provided, we use it to establish an authentication, direct connection to an ipfs node api, which involves skipping multiaddr parsing. This is useful in situations such as interacting with Nexus' delegator to talk with private ipfs networks which use non-standard connection methods.

func (*IpfsManager) Add

func (im *IpfsManager) Add(r io.Reader, options ...shell.AddOpts) (string, error)

Add is a wrapper used to add a file to IPFS

func (*IpfsManager) AddDir

func (im *IpfsManager) AddDir(dir string) (string, error)

AddDir is used to add a directory to ipfs

func (*IpfsManager) AppendData

func (im *IpfsManager) AppendData(root string, data interface{}) (string, error)

AppendData is used to modify the raw data within an object, to a max of 1MB Anything larger than 1MB will not be respected by the rest of the network

func (*IpfsManager) Cat

func (im *IpfsManager) Cat(cid string) ([]byte, error)

Cat is used to get cat an ipfs object

func (*IpfsManager) CheckPin

func (im *IpfsManager) CheckPin(hash string) (bool, error)

CheckPin checks whether or not a pin is present

func (*IpfsManager) DagGet

func (im *IpfsManager) DagGet(cid string, out interface{}) error

DagGet is used to get an ipld object

func (*IpfsManager) DagPut

func (im *IpfsManager) DagPut(data interface{}, encoding, kind string) (string, error)

DagPut is used to store data as an ipld object

func (*IpfsManager) List

func (im *IpfsManager) List(cid string) ([]*shell.LsLink, error)

List is used to list all cid from a directory cid

func (*IpfsManager) NewObject

func (im *IpfsManager) NewObject(template string) (string, error)

NewObject is used to create a generic object from a template type

func (*IpfsManager) NodeAddress

func (im *IpfsManager) NodeAddress() string

NodeAddress returns the node the manager is connected to

func (im *IpfsManager) PatchLink(root, path, childHash string, create bool) (string, error)

PatchLink is used to link two objects together path really means the name of the link create is used to specify whether intermediary nodes should be generated

func (*IpfsManager) Pin

func (im *IpfsManager) Pin(hash string) error

Pin is a wrapper method to pin a hash. pinning prevents GC and persistently stores on disk

func (*IpfsManager) PubSubPublish

func (im *IpfsManager) PubSubPublish(topic string, data string) error

PubSubPublish is used to publish a a message to the given topic

func (*IpfsManager) Refs

func (im *IpfsManager) Refs(hash string, recursive, unique bool) ([]string, error)

Refs is used to retrieve references of a hash

func (*IpfsManager) Resolve

func (im *IpfsManager) Resolve(hash string) (string, error)

Resolve is used to resolve an IPNS hash

func (*IpfsManager) SetData

func (im *IpfsManager) SetData(root string, data interface{}) (string, error)

SetData is used to set the data field of an ipfs object

func (*IpfsManager) SwarmConnect

func (im *IpfsManager) SwarmConnect(ctx context.Context, addrs ...string) error

SwarmConnect is use to open a connection a one or more ipfs nodes

Jump to

Keyboard shortcuts

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