coreapi

package
Version: v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package coreapi provides direct access to the core commands in IPFS. If you are embedding IPFS directly in your Go program, this package is the public interface you should use to read and write files or otherwise control IPFS.

If you are running IPFS as a separate process, you should use `go-ipfs-api` to work with it via HTTP. As we finalize the interfaces here, `go-ipfs-api` will transparently adopt them so you can use the same code with either package.

**NOTE: this package is experimental.** `go-ipfs` has mainly been developed as a standalone application and library-style use of this package is still new. Interfaces here aren't yet completely stable.

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.

Types

type BlockAPI added in v0.4.14

type BlockAPI CoreAPI

func (*BlockAPI) Get added in v0.4.14

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

func (*BlockAPI) Put added in v0.4.14

func (*BlockAPI) Rm added in v0.4.14

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

func (*BlockAPI) Stat added in v0.4.14

type BlockStat added in v0.4.14

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

func (*BlockStat) Path added in v0.4.14

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

func (*BlockStat) Size added in v0.4.14

func (bs *BlockStat) Size() int

type CoreAPI added in v0.4.8

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

func (*CoreAPI) Block added in v0.4.14

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

Block returns the BlockAPI interface implementation backed by the go-ipfs node

func (*CoreAPI) Dag added in v0.4.14

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

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

func (*CoreAPI) Key added in v0.4.14

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

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

func (*CoreAPI) Name added in v0.4.14

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

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

func (*CoreAPI) Object added in v0.4.14

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

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

func (*CoreAPI) Pin added in v0.4.14

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

Pin returns the PinAPI interface implementation backed by the go-ipfs node

func (*CoreAPI) ResolveNode added in v0.4.8

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

ResolveNode resolves the path `p` using Unixfs 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.ResolvedPath, error)

ResolvePath resolves the path `p` using Unixfs resolver, returns the resolved path.

func (*CoreAPI) Unixfs added in v0.4.8

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

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

type DagAPI added in v0.4.14

type DagAPI CoreAPI

func (*DagAPI) Get added in v0.4.14

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

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

func (*DagAPI) Put added in v0.4.14

func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPutOption) (coreiface.ResolvedPath, 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 added in v0.4.14

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 added in v0.4.14

type KeyAPI CoreAPI

func (*KeyAPI) Generate added in v0.4.14

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 added in v0.4.14

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

List returns a list keys stored in keystore.

func (*KeyAPI) Remove added in v0.4.14

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 added in v0.4.14

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 added in v0.4.14

type NameAPI CoreAPI

func (*NameAPI) Publish added in v0.4.14

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

func (*NameAPI) Resolve added in v0.4.14

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 added in v0.4.14

type Node struct {
	Links []Link
	Data  string
}

type ObjectAPI added in v0.4.14

type ObjectAPI CoreAPI

func (*ObjectAPI) AppendData added in v0.4.14

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

func (*ObjectAPI) Data added in v0.4.14

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

func (*ObjectAPI) Get added in v0.4.14

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

func (*ObjectAPI) New added in v0.4.14

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

func (*ObjectAPI) Put added in v0.4.14

func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link string) (coreiface.ResolvedPath, error)

func (*ObjectAPI) SetData added in v0.4.14

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

func (*ObjectAPI) Stat added in v0.4.14

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

type PinAPI added in v0.4.14

type PinAPI CoreAPI

func (*PinAPI) Add added in v0.4.14

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

func (*PinAPI) Ls added in v0.4.14

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

func (*PinAPI) Rm added in v0.4.14

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

func (*PinAPI) Update added in v0.4.14

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

func (*PinAPI) Verify added in v0.4.14

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

type UnixfsAPI

type UnixfsAPI CoreAPI

func (*UnixfsAPI) Add

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) ([]*ipld.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
t or T : Toggle theme light dark auto
y or Y : Canonical URL