plugin

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 6 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment added in v0.14.0

type Environment struct {
	// Path to the IPFS repo.
	Repo string

	// The plugin's config, if specified in the
	// Plugins.Plugins["plugin-name"].Config field of the user's go-ipfs
	// config. See docs/plugins.md for details.
	//
	// This is an arbitrary JSON-like object unmarshaled into an interface{}
	// according to https://golang.org/pkg/encoding/json/#Unmarshal.
	Config interface{}
}

Environment is the environment passed into the plugin on init.

type Plugin

type Plugin interface {
	// Name should return unique name of the plugin
	Name() string

	// Version returns current version of the plugin
	Version() string

	// Init is called once when the Plugin is being loaded
	// The plugin is passed an environment containing the path to the
	// (possibly uninitialized) IPFS repo and the plugin's config.
	Init(env *Environment) error
}

Plugin is the base interface for all kinds of go-ipfs plugins It will be included in interfaces of different Plugins

Optionally, Plugins can implement io.Closer if they want to have a termination step when unloading.

type PluginDaemon added in v0.4.19

type PluginDaemon interface {
	Plugin

	Start(coreiface.CoreAPI) error
}

PluginDaemon is an interface for daemon plugins. These plugins will be run on the daemon and will be given access to an implementation of the CoreAPI.

type PluginDaemonInternal added in v0.14.0

type PluginDaemonInternal interface {
	Plugin

	Start(*core.IpfsNode) error
}

PluginDaemonInternal is an interface for daemon plugins. These plugins will be run on the daemon and will be given a direct access to the IpfsNode.

Note: PluginDaemonInternal is considered internal and no guarantee is made concerning the stability of its API. If you can, use PluginAPI instead.

type PluginDatastore added in v0.4.18

type PluginDatastore interface {
	Plugin

	DatastoreTypeName() string
	DatastoreConfigParser() fsrepo.ConfigFromMap
}

PluginDatastore is an interface that can be implemented to add handlers for for different datastores.

type PluginFx added in v0.15.0

type PluginFx interface {
	Plugin
	Options(core.FXNodeInfo) ([]fx.Option, error)
}

PluginFx can be used to customize the fx options passed to the go-ipfs app when it is initialized.

This is invasive and depends on internal details such as the structure of the dependency graph, so breaking changes might occur between releases. So it's recommended to keep this as simple as possible, and stick to overriding interfaces with fx.Replace() or fx.Decorate().

The returned options become the complete array of options passed to fx. Generally you'll want to append additional options to NodeInfo.FXOptions and return that.

type PluginIPLD

type PluginIPLD interface {
	Plugin

	Register(multicodec.Registry) error
}

PluginIPLD is an interface that can be implemented to add handlers for for different IPLD codecs.

type PluginTracer added in v0.4.15

type PluginTracer interface {
	Plugin

	InitTracer() (opentracing.Tracer, error)
}

PluginTracer is an interface that can be implemented to add a tracer.

Directories

Path Synopsis
plugins
git

Jump to

Keyboard shortcuts

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