coreapi

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 60 Imported by: 41

Documentation

Overview

**NOTE: this package is experimental.**

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 `client/rpc` to work with it via HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoreAPI added in v0.4.8

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

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 path.Path) (io.Reader, error)

func (*BlockAPI) Put added in v0.4.14

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

func (*BlockAPI) Rm added in v0.4.14

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

func (*BlockAPI) Stat added in v0.4.14

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

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() path.ImmutablePath

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.APIDagService

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) PubSub added in v0.4.18

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

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

func (*CoreAPI) ResolveNode added in v0.4.8

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

func (api *CoreAPI) ResolvePath(ctx context.Context, p path.Path) (path.ImmutablePath, []string, error)

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

func (*CoreAPI) Routing added in v0.19.0

func (api *CoreAPI) Routing() coreiface.RoutingAPI

Routing returns the RoutingAPI interface implementation backed by the kubo node

func (*CoreAPI) Swarm added in v0.4.18

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

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

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

func (*CoreAPI) WithOptions added in v0.4.19

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

WithOptions returns api with global options applied

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.Key, 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.

func (*KeyAPI) Self added in v0.4.18

func (api *KeyAPI) Self(ctx context.Context) (coreiface.Key, error)

func (*KeyAPI) Sign added in v0.25.0

func (api *KeyAPI) Sign(ctx context.Context, name string, data []byte) (coreiface.Key, []byte, error)

func (*KeyAPI) Verify added in v0.25.0

func (api *KeyAPI) Verify(ctx context.Context, keyOrName string, signature, data []byte) (coreiface.Key, bool, 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

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

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) (path.Path, error)

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

func (*NameAPI) Search added in v0.4.18

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

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 (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...caopts.ObjectAddLinkOption) (path.ImmutablePath, error)

func (*ObjectAPI) Diff added in v0.4.18

func (api *ObjectAPI) Diff(ctx context.Context, before path.Path, after path.Path) ([]coreiface.ObjectChange, error)
func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (path.ImmutablePath, 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 path.Path, opts ...caopts.PinAddOption) error

func (*PinAPI) IsPinned added in v0.14.0

func (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.PinIsPinnedOption) (string, bool, error)

func (*PinAPI) Ls added in v0.4.14

func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) (<-chan coreiface.Pin, error)

func (*PinAPI) Rm added in v0.4.14

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

Rm pin rm api

func (*PinAPI) Update added in v0.4.14

func (api *PinAPI) Update(ctx context.Context, from path.Path, to path.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 PubSubAPI added in v0.4.18

type PubSubAPI CoreAPI

func (*PubSubAPI) Ls added in v0.4.18

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

func (*PubSubAPI) Peers added in v0.4.18

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

func (*PubSubAPI) Publish added in v0.4.18

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

func (*PubSubAPI) Subscribe added in v0.4.18

type RoutingAPI added in v0.19.0

type RoutingAPI CoreAPI

func (*RoutingAPI) FindPeer added in v0.27.0

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

func (*RoutingAPI) FindProviders added in v0.27.0

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

func (*RoutingAPI) Get added in v0.19.0

func (api *RoutingAPI) Get(ctx context.Context, key string) ([]byte, error)

func (*RoutingAPI) Provide added in v0.27.0

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

func (*RoutingAPI) Put added in v0.19.0

func (api *RoutingAPI) Put(ctx context.Context, key string, value []byte, opts ...caopts.RoutingPutOption) error

type SwarmAPI added in v0.4.18

type SwarmAPI CoreAPI

func (*SwarmAPI) Connect added in v0.4.18

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

func (*SwarmAPI) Disconnect added in v0.4.18

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

func (*SwarmAPI) KnownAddrs added in v0.4.18

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

func (*SwarmAPI) ListenAddrs added in v0.4.18

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

func (*SwarmAPI) LocalAddrs added in v0.4.18

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

func (*SwarmAPI) Peers added in v0.4.18

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

type UnixfsAPI

type UnixfsAPI CoreAPI

func (*UnixfsAPI) Add

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

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

func (*UnixfsAPI) Get added in v0.4.18

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

func (*UnixfsAPI) Ls

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>`

Jump to

Keyboard shortcuts

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