Writing a Plugin
Interface
package sample
import (
"context"
"github.com/roadrunner-server/endure/v2/dep"
)
type (
// Service interface can be implemented by the plugin to use start/stop functionality
Service interface {
// Serve starts the plugin
Serve() chan error
// Stop stops the plugin
Stop(context.Context) error
}
// Named -> name of the service
Named interface {
// Name returns a user-friendly name of the plugin
Name() string
}
// Provider declares the ability to provide service edges of declared types.
Provider interface {
// Provides returns a set of functions that provide dependencies to other plugins
Provides() []*dep.Out
}
// Weighted is optional to implement, but when implemented, the return value is used during topological sort
Weighted interface {
Weight() uint
}
// Collector declares the ability to accept plugins that match the provided method signature.
Collector interface {
// Collects searches for plugins that implement the given interfaces in the args
Collects() []*dep.In
}
)Plugin definition
Disabling a plugin
Dependencies
Configuration
YAML configuration sample
Plugin
Configuration
Serving
Plugin
Collecting dependencies at runtime
RPC Methods
Tips
Last updated