go-ipfs: github.com/ipfs/go-ipfs/core/coreapi Index | Files

package coreapi

import "github.com/ipfs/go-ipfs/core/coreapi"

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

Package Files

block.go coreapi.go dag.go dht.go key.go name.go object.go path.go pin.go provider.go pubsub.go swarm.go unixfs.go

func NewCoreAPI Uses

func NewCoreAPI(n *core.IpfsNode, opts ...options.ApiOption) (coreiface.CoreAPI, error)

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

type BlockAPI Uses

type BlockAPI CoreAPI

func (*BlockAPI) Get Uses

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

func (*BlockAPI) Put Uses

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

func (*BlockAPI) Rm Uses

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

func (*BlockAPI) Stat Uses

func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (coreiface.BlockStat, error)

type BlockStat Uses

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

func (*BlockStat) Path Uses

func (bs *BlockStat) Path() path.Resolved

func (*BlockStat) Size Uses

func (bs *BlockStat) Size() int

type CoreAPI Uses

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

func (*CoreAPI) Block Uses

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

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

func (*CoreAPI) Dag Uses

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

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

func (*CoreAPI) Dht Uses

func (api *CoreAPI) Dht() coreiface.DhtAPI

Dht returns the DhtAPI interface implementation backed by the go-ipfs node

func (*CoreAPI) Key Uses

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

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

func (*CoreAPI) Name Uses

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

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

func (*CoreAPI) Object Uses

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

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

func (*CoreAPI) Pin Uses

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

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

func (*CoreAPI) PubSub Uses

func (api *CoreAPI) PubSub() coreiface.PubSubAPI

PubSub returns the PubSubAPI interface implementation backed by the go-ipfs node

func (*CoreAPI) ResolveNode Uses

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

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

func (*CoreAPI) ResolvePath Uses

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

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

func (*CoreAPI) Swarm Uses

func (api *CoreAPI) Swarm() coreiface.SwarmAPI

Swarm returns the SwarmAPI interface implementation backed by the go-ipfs node

func (*CoreAPI) Unixfs Uses

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

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

func (*CoreAPI) WithOptions Uses

func (api *CoreAPI) WithOptions(opts ...options.ApiOption) (coreiface.CoreAPI, error)

WithOptions returns api with global options applied

type DhtAPI Uses

type DhtAPI CoreAPI

func (*DhtAPI) FindPeer Uses

func (api *DhtAPI) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error)

func (*DhtAPI) FindProviders Uses

func (api *DhtAPI) FindProviders(ctx context.Context, p path.Path, opts ...caopts.DhtFindProvidersOption) (<-chan peer.AddrInfo, error)

func (*DhtAPI) Provide Uses

func (api *DhtAPI) Provide(ctx context.Context, path path.Path, opts ...caopts.DhtProvideOption) error

type KeyAPI Uses

type KeyAPI CoreAPI

func (*KeyAPI) Generate Uses

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 Uses

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

List returns a list keys stored in keystore.

func (*KeyAPI) Remove Uses

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

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

func (*KeyAPI) Rename Uses

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.

func (*KeyAPI) Self Uses

func (api *KeyAPI) Self(ctx context.Context) (coreiface.Key, error)
type Link struct {
    Name, Hash string
    Size       uint64
}

type NameAPI Uses

type NameAPI CoreAPI

func (*NameAPI) Publish Uses

func (api *NameAPI) Publish(ctx context.Context, p path.Path, opts ...caopts.NamePublishOption) (coreiface.IpnsEntry, error)

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

func (*NameAPI) Resolve Uses

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

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

func (*NameAPI) Search Uses

func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.NameResolveOption) (<-chan coreiface.IpnsResult, error)

type Node Uses

type Node struct {
    Links []Link
    Data  string
}

type ObjectAPI Uses

type ObjectAPI CoreAPI
func (api *ObjectAPI) AddLink(ctx context.Context, base ipath.Path, name string, child ipath.Path, opts ...caopts.ObjectAddLinkOption) (ipath.Resolved, error)

func (*ObjectAPI) AppendData Uses

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

func (*ObjectAPI) Data Uses

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

func (*ObjectAPI) Diff Uses

func (api *ObjectAPI) Diff(ctx context.Context, before ipath.Path, after ipath.Path) ([]coreiface.ObjectChange, error)

func (*ObjectAPI) Get Uses

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

func (*ObjectAPI) New Uses

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

func (*ObjectAPI) Put Uses

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

func (*ObjectAPI) SetData Uses

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

func (*ObjectAPI) Stat Uses

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

type PinAPI Uses

type PinAPI CoreAPI

func (*PinAPI) Add Uses

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

func (*PinAPI) Ls Uses

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

func (*PinAPI) Rm Uses

func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOption) error

Rm pin rm api

func (*PinAPI) Update Uses

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

func (*PinAPI) Verify Uses

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

type ProviderAPI Uses

type ProviderAPI CoreAPI

ProviderAPI brings Provider behavior to CoreAPI

func (*ProviderAPI) Provide Uses

func (api *ProviderAPI) Provide(cid cid.Cid) error

Provide the given cid using the current provider

type PubSubAPI Uses

type PubSubAPI CoreAPI

func (*PubSubAPI) Ls Uses

func (api *PubSubAPI) Ls(ctx context.Context) ([]string, error)

func (*PubSubAPI) Peers Uses

func (api *PubSubAPI) Peers(ctx context.Context, opts ...caopts.PubSubPeersOption) ([]peer.ID, error)

func (*PubSubAPI) Publish Uses

func (api *PubSubAPI) Publish(ctx context.Context, topic string, data []byte) error

func (*PubSubAPI) Subscribe Uses

func (api *PubSubAPI) Subscribe(ctx context.Context, topic string, opts ...caopts.PubSubSubscribeOption) (coreiface.PubSubSubscription, error)

type SwarmAPI Uses

type SwarmAPI CoreAPI

func (*SwarmAPI) Connect Uses

func (api *SwarmAPI) Connect(ctx context.Context, pi peer.AddrInfo) error

func (*SwarmAPI) Disconnect Uses

func (api *SwarmAPI) Disconnect(ctx context.Context, addr ma.Multiaddr) error

func (*SwarmAPI) KnownAddrs Uses

func (api *SwarmAPI) KnownAddrs(context.Context) (map[peer.ID][]ma.Multiaddr, error)

func (*SwarmAPI) ListenAddrs Uses

func (api *SwarmAPI) ListenAddrs(context.Context) ([]ma.Multiaddr, error)

func (*SwarmAPI) LocalAddrs Uses

func (api *SwarmAPI) LocalAddrs(context.Context) ([]ma.Multiaddr, error)

func (*SwarmAPI) Peers Uses

func (api *SwarmAPI) Peers(context.Context) ([]coreiface.ConnectionInfo, error)

type UnixfsAPI Uses

type UnixfsAPI CoreAPI

func (*UnixfsAPI) Add Uses

func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options.UnixfsAddOption) (path.Resolved, error)

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

func (*UnixfsAPI) Get Uses

func (api *UnixfsAPI) Get(ctx context.Context, p path.Path) (files.Node, error)

func (*UnixfsAPI) Ls Uses

func (api *UnixfsAPI) Ls(ctx context.Context, p path.Path, opts ...options.UnixfsLsOption) (<-chan coreiface.DirEntry, 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>`

Package coreapi imports 59 packages (graph) and is imported by 39 packages. Updated 2019-09-03. Refresh now. Tools for package owners.