Documentation ¶
Index ¶
- Variables
- func Init(path string) error
- func WithDoubleIpfs(t *testing.T, portOff int, fn func(t *testing.T, ipfsPathA, ipfsPathB string))
- func WithIpfs(t *testing.T, portOff int, fn func(t *testing.T, ipfsPath string))
- type Node
- func (nd *Node) Add(r io.Reader) (h.Hash, error)
- func (nd *Node) Cat(hash h.Hash) (mio.Stream, error)
- func (nd *Node) Close() error
- func (nd *Node) Connect() error
- func (nd *Node) Dial(peerHash, fingerprint, protocol string) (net.Conn, error)
- func (nd *Node) Disconnect() error
- func (nd *Node) GC() ([]h.Hash, error)
- func (nd *Node) Identity() (peer.Info, error)
- func (nd *Node) IsCached(hash h.Hash) (bool, error)
- func (nd *Node) IsOnline() bool
- func (nd *Node) IsPinned(hash h.Hash) (bool, error)
- func (nd *Node) Listen(protocol string) (net.Listener, error)
- func (nd *Node) Name() string
- func (nd *Node) Pin(hash h.Hash) error
- func (nd *Node) Ping(addr string) (netBackend.Pinger, error)
- func (nd *Node) PublishEvent(topic string, data []byte) error
- func (nd *Node) PublishName(name string) error
- func (nd *Node) ResolveName(ctx context.Context, name string) ([]peer.Info, error)
- func (nd *Node) Subscribe(ctx context.Context, topic string) (eventsBackend.Subscription, error)
- func (nd *Node) Unpin(hash h.Hash) error
- func (n *Node) Version() *VersionInfo
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOffline is returned by operations that need online support // to work when the backend is in offline mode. ErrOffline = errors.New("backend is in offline mode") )
var ErrWaiting = errors.New("waiting for route")
ErrWaiting is the initial error state of a pinger. The error will be unset once a successful ping was made.
Functions ¶
func Init ¶
Init will create the folder structure for anything that needs to be persisted in the repository.
func WithDoubleIpfs ¶
WithDoubleIpfs starts two IPFS instances in parallel.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the struct that holds the httpipfs backend together. It is a shallow type that has not much own state and is very light.
func (*Node) Dial ¶
Dial will open a connection to the peer identified by `peerHash`, running `protocol` over it.
func (*Node) Disconnect ¶
Disconnect implements Backend.Disconnect
func (*Node) GC ¶
GC will trigger the garbage collector of IPFS. Cleaned up hashes will be returned as a list (note that those hashes are not always ours)
func (*Node) Identity ¶
Identity returns our own identity. It will cache the identity after the first request.
func (*Node) IsOnline ¶
IsOnline returns true if the node is in online mode and the daemon is reachable.
func (*Node) Ping ¶
func (nd *Node) Ping(addr string) (netBackend.Pinger, error)
Ping will return a pinger for `addr`.
func (*Node) PublishEvent ¶
PublishEvent will publish `data` on `topic`.
func (*Node) PublishName ¶
PublishName will announce `name` to the network and make us discoverable.
func (*Node) ResolveName ¶
ResolveName will return all peers that identify themselves as `name`. If ctx is canceled it will return early, but return no error.
func (*Node) Subscribe ¶
func (nd *Node) Subscribe(ctx context.Context, topic string) (eventsBackend.Subscription, error)
Subscribe will create a subscription for `topic`. You can use the subscription to wait for the next incoming message. This will only work if the daemon supports/has enabled pub sub.
func (*Node) Version ¶
func (n *Node) Version() *VersionInfo
Version returns detailed VersionInfo info as struct
type VersionInfo ¶
type VersionInfo struct {
// contains filtered or unexported fields
}
VersionInfo holds version info (yeah, golint)
func (*VersionInfo) Rev ¶
func (v *VersionInfo) Rev() string
Rev returns the git revision of the backend
func (*VersionInfo) SemVer ¶
func (v *VersionInfo) SemVer() string
SemVer returns a VersionInfo string complying semantic versioning