coreapi

package
v0.4.14-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2018 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoreAPI added in v0.4.8

func NewCoreAPI(n *core.IpfsNode) coreiface.CoreAPI

NewCoreAPI creates new instance of IPFS CoreAPI backed by go-ipfs Node.

func ParseCid added in v0.4.8

func ParseCid(c *cid.Cid) coreiface.Path

ParseCid parses the path from `c`, retruns the parsed path.

func ParsePath added in v0.4.8

func ParsePath(p string) (coreiface.Path, error)

ParsePath parses path `p` using ipfspath parser, returns the parsed path.

func ResolvedPath added in v0.4.8

func ResolvedPath(p string, c *cid.Cid, r *cid.Cid) coreiface.Path

ResolvePath parses path from string `p`, returns parsed path.

Types

type BlockAPI

type BlockAPI struct {
	*CoreAPI
	*caopts.BlockOptions
}

func (*BlockAPI) Get

func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, error)

func (*BlockAPI) Put

func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.BlockPutOption) (coreiface.Path, error)

func (*BlockAPI) Rm

func (api *BlockAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.BlockRmOption) error

func (*BlockAPI) Stat

type BlockStat

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

func (*BlockStat) Path

func (bs *BlockStat) Path() coreiface.Path

func (*BlockStat) Size

func (bs *BlockStat) Size() int

type CoreAPI added in v0.4.8

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

func (*CoreAPI) Block

func (api *CoreAPI) Block() coreiface.BlockAPI

func (*CoreAPI) Dag

func (api *CoreAPI) Dag() coreiface.DagAPI

Dag returns the DagAPI interface backed by the go-ipfs node

func (*CoreAPI) Key

func (api *CoreAPI) Key() coreiface.KeyAPI

Key returns the KeyAPI interface backed by the go-ipfs node

func (*CoreAPI) Name

func (api *CoreAPI) Name() coreiface.NameAPI

Name returns the NameAPI interface backed by the go-ipfs node

func (*CoreAPI) Object

func (api *CoreAPI) Object() coreiface.ObjectAPI

Object returns the ObjectAPI interface backed by the go-ipfs node

func (*CoreAPI) Pin

func (api *CoreAPI) Pin() coreiface.PinAPI

func (*CoreAPI) ResolveNode added in v0.4.8

func (api *CoreAPI) ResolveNode(ctx context.Context, p coreiface.Path) (coreiface.Node, error)

ResolveNode resolves the path `p` using Unixfx resolver, gets and returns the resolved Node.

func (*CoreAPI) ResolvePath added in v0.4.8

func (api *CoreAPI) ResolvePath(ctx context.Context, p coreiface.Path) (coreiface.Path, error)

ResolvePath resolves the path `p` using Unixfs resolver, returns the resolved path. TODO: store all of ipfspath.Resolver.ResolvePathComponents() in Path

func (*CoreAPI) Unixfs added in v0.4.8

func (api *CoreAPI) Unixfs() coreiface.UnixfsAPI

Unixfs returns the UnixfsAPI interface backed by the go-ipfs node

type DagAPI

type DagAPI struct {
	*CoreAPI
	*caopts.DagOptions
}

func (*DagAPI) Get

func (api *DagAPI) Get(ctx context.Context, path coreiface.Path) (coreiface.Node, error)

Get resolves `path` using Unixfs resolver, returns the resolved Node.

func (*DagAPI) Put

func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPutOption) (coreiface.Path, error)

Put inserts data using specified format and input encoding. Unless used with `WithCodes` or `WithHash`, the defaults "dag-cbor" and "sha256" are used. Returns the path of the inserted data.

func (*DagAPI) Tree

func (api *DagAPI) Tree(ctx context.Context, p coreiface.Path, opts ...caopts.DagTreeOption) ([]coreiface.Path, error)

Tree returns list of paths within a node specified by the path `p`.

type KeyAPI

type KeyAPI struct {
	*CoreAPI
	*caopts.KeyOptions
}

func (*KeyAPI) Generate

func (api *KeyAPI) Generate(ctx context.Context, name string, opts ...caopts.KeyGenerateOption) (coreiface.Key, error)

Generate generates new key, stores it in the keystore under the specified name and returns a base58 encoded multihash of its public key.

func (*KeyAPI) List

func (api *KeyAPI) List(ctx context.Context) ([]coreiface.Key, error)

List returns a list keys stored in keystore.

func (*KeyAPI) Remove

func (api *KeyAPI) Remove(ctx context.Context, name string) (coreiface.Path, error)

Remove removes keys from keystore. Returns ipns path of the removed key.

func (*KeyAPI) Rename

func (api *KeyAPI) Rename(ctx context.Context, oldName string, newName string, opts ...caopts.KeyRenameOption) (coreiface.Key, bool, error)

Rename renames `oldName` to `newName`. Returns the key and whether another key was overwritten, or an error.

type Link struct {
	Name, Hash string
	Size       uint64
}

type NameAPI

type NameAPI struct {
	*CoreAPI
	*caopts.NameOptions
}

func (*NameAPI) Publish

Publish announces new IPNS name and returns the new IPNS entry.

func (*NameAPI) Resolve

func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (coreiface.Path, error)

Resolve attempts to resolve the newest version of the specified name and returns its path.

type Node

type Node struct {
	Links []Link
	Data  string
}

type ObjectAPI

type ObjectAPI struct {
	*CoreAPI
	*caopts.ObjectOptions
}
func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name string, child coreiface.Path, opts ...caopts.ObjectAddLinkOption) (coreiface.Path, error)

func (*ObjectAPI) AppendData

func (api *ObjectAPI) AppendData(ctx context.Context, path coreiface.Path, r io.Reader) (coreiface.Path, error)

func (*ObjectAPI) Data

func (api *ObjectAPI) Data(ctx context.Context, path coreiface.Path) (io.Reader, error)

func (*ObjectAPI) Get

func (api *ObjectAPI) Get(ctx context.Context, path coreiface.Path) (coreiface.Node, error)
func (api *ObjectAPI) Links(ctx context.Context, path coreiface.Path) ([]*coreiface.Link, error)

func (*ObjectAPI) New

func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (coreiface.Node, error)

func (*ObjectAPI) Put

func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.ObjectPutOption) (coreiface.Path, error)
func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link string) (coreiface.Path, error)

func (*ObjectAPI) SetData

func (api *ObjectAPI) SetData(ctx context.Context, path coreiface.Path, r io.Reader) (coreiface.Path, error)

func (*ObjectAPI) Stat

func (api *ObjectAPI) Stat(ctx context.Context, path coreiface.Path) (*coreiface.ObjectStat, error)

type PinAPI

type PinAPI struct {
	*CoreAPI
	*caopts.PinOptions
}

func (*PinAPI) Add

func (api *PinAPI) Add(ctx context.Context, p coreiface.Path, opts ...caopts.PinAddOption) error

func (*PinAPI) Ls

func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) ([]coreiface.Pin, error)

func (*PinAPI) Rm

func (api *PinAPI) Rm(ctx context.Context, p coreiface.Path) error

func (*PinAPI) Update

func (api *PinAPI) Update(ctx context.Context, from coreiface.Path, to coreiface.Path, opts ...caopts.PinUpdateOption) error

func (*PinAPI) Verify

func (api *PinAPI) Verify(ctx context.Context) (<-chan coreiface.PinStatus, error)

type UnixfsAPI

type UnixfsAPI CoreAPI

func (*UnixfsAPI) Add

func (api *UnixfsAPI) Add(ctx context.Context, r io.Reader) (coreiface.Path, error)

Add builds a merkledag node from a reader, adds it to the blockstore, and returns the key representing that node.

func (*UnixfsAPI) Cat

Cat returns the data contained by an IPFS or IPNS object(s) at path `p`.

func (*UnixfsAPI) Ls

func (api *UnixfsAPI) Ls(ctx context.Context, p coreiface.Path) ([]*coreiface.Link, error)

Ls returns the contents of an IPFS or IPNS object(s) at path p, with the format: `<link base58 hash> <link size in bytes> <link name>`

Directories

Path Synopsis
Package iface defines IPFS Core API which is a set of interfaces used to interact with IPFS nodes.
Package iface defines IPFS Core API which is a set of interfaces used to interact with IPFS nodes.

Jump to

Keyboard shortcuts

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