1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00
Files
kubo/plugin/plugin.go
Michael Muré 72026b896f plugins: support Close() for Tracer plugins as well
Most of the tracers available need to properly close to send
the remaining traces before the process exit.
2019-09-24 17:43:07 +09:00

29 lines
820 B
Go

package plugin
// Environment is the environment passed into the plugin on init.
type Environment struct {
// Path to the IPFS repo.
Repo string
// The plugin's config, if specified.
Config interface{}
}
// 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 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
}