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 ¶
- func NewCoreAPI(n *core.IpfsNode) coreiface.CoreAPI
- func ParseCid(c *cid.Cid) coreiface.Path
- func ParsePath(p string) (coreiface.Path, error)
- func ResolvedPath(p string, c *cid.Cid, r *cid.Cid) coreiface.Path
- type BlockAPI
- func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, error)
- func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.BlockPutOption) (coreiface.Path, error)
- func (api *BlockAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.BlockRmOption) error
- func (api *BlockAPI) Stat(ctx context.Context, p coreiface.Path) (coreiface.BlockStat, error)
- type BlockStat
- type CoreAPI
- func (api *CoreAPI) Block() coreiface.BlockAPI
- func (api *CoreAPI) Dag() coreiface.DagAPI
- func (api *CoreAPI) Key() coreiface.KeyAPI
- func (api *CoreAPI) Name() coreiface.NameAPI
- func (api *CoreAPI) Object() coreiface.ObjectAPI
- func (api *CoreAPI) Pin() coreiface.PinAPI
- func (api *CoreAPI) ResolveNode(ctx context.Context, p coreiface.Path) (ipld.Node, error)
- func (api *CoreAPI) ResolvePath(ctx context.Context, p coreiface.Path) (coreiface.Path, error)
- func (api *CoreAPI) Unixfs() coreiface.UnixfsAPI
- type DagAPI
- func (api *DagAPI) Get(ctx context.Context, path coreiface.Path) (ipld.Node, error)
- func (api *DagAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.DagPutOption) (coreiface.Path, error)
- func (api *DagAPI) Tree(ctx context.Context, p coreiface.Path, opts ...caopts.DagTreeOption) ([]coreiface.Path, error)
- type KeyAPI
- func (api *KeyAPI) Generate(ctx context.Context, name string, opts ...caopts.KeyGenerateOption) (coreiface.Key, error)
- func (api *KeyAPI) List(ctx context.Context) ([]coreiface.Key, error)
- func (api *KeyAPI) Remove(ctx context.Context, name string) (coreiface.Path, error)
- func (api *KeyAPI) Rename(ctx context.Context, oldName string, newName string, ...) (coreiface.Key, bool, error)
- type Link
- type NameAPI
- type Node
- type ObjectAPI
- func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name string, child coreiface.Path, ...) (coreiface.Path, error)
- func (api *ObjectAPI) AppendData(ctx context.Context, path coreiface.Path, r io.Reader) (coreiface.Path, error)
- func (api *ObjectAPI) Data(ctx context.Context, path coreiface.Path) (io.Reader, error)
- 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 (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (ipld.Node, error)
- 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 (api *ObjectAPI) SetData(ctx context.Context, path coreiface.Path, r io.Reader) (coreiface.Path, error)
- func (api *ObjectAPI) Stat(ctx context.Context, path coreiface.Path) (*coreiface.ObjectStat, error)
- type PinAPI
- func (api *PinAPI) Add(ctx context.Context, p coreiface.Path, opts ...caopts.PinAddOption) error
- func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) ([]coreiface.Pin, error)
- func (api *PinAPI) Rm(ctx context.Context, p coreiface.Path) error
- func (api *PinAPI) Update(ctx context.Context, from coreiface.Path, to coreiface.Path, ...) error
- func (api *PinAPI) Verify(ctx context.Context) (<-chan coreiface.PinStatus, error)
- type UnixfsAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCoreAPI ¶
NewCoreAPI creates new instance of IPFS CoreAPI backed by go-ipfs Node.
Types ¶
type BlockAPI ¶
type BlockAPI CoreAPI
type CoreAPI ¶
type CoreAPI struct {
// contains filtered or unexported fields
}
func (*CoreAPI) Block ¶
Block returns the BlockAPI interface implementation backed by the go-ipfs node
func (*CoreAPI) Object ¶
Object returns the ObjectAPI interface implementation backed by the go-ipfs node
func (*CoreAPI) ResolveNode ¶
ResolveNode resolves the path `p` using Unixfx resolver, gets and returns the resolved Node.
func (*CoreAPI) ResolvePath ¶
ResolvePath resolves the path `p` using Unixfs resolver, returns the resolved path. TODO: store all of ipfspath.Resolver.ResolvePathComponents() in Path
type DagAPI ¶ added in v0.4.14
type DagAPI CoreAPI
func (*DagAPI) Get ¶ added in v0.4.14
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.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.
type KeyAPI ¶
type KeyAPI CoreAPI
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.
type NameAPI ¶
type NameAPI CoreAPI
type ObjectAPI ¶
type ObjectAPI CoreAPI