Documentation ¶
Overview ¶
Package plugin provides an easy way to create the required CLI for a plugin. It abstracts away all the command line and file parsing so users just need to implement the actual logic.
Package plugin provides an easy way to create the required CLI for a plugin. It abstracts away all the command line and file parsing so users just need to implement the actual logic.
Package plugin provides an easy way to create the required CLI for a plugin. It abstracts away all the command line and file parsing so users just need to implement the actual logic.
Package plugin provides an easy way to create the required CLI for a plugin. It abstracts away all the command line and file parsing so users just need to implement the actual logic.
Please see the main BPM-SDK documentation for more details on how to implement a new plugin.
Index ¶
- Constants
- func Initialize(plugin Plugin)
- type Configurator
- type DockerLifecycleHandler
- func (d DockerLifecycleHandler) RemoveData(currentNode node.Node) error
- func (d DockerLifecycleHandler) RemoveRuntime(currentNode node.Node) error
- func (d DockerLifecycleHandler) Start(currentNode node.Node) error
- func (d DockerLifecycleHandler) Status(currentNode node.Node) (string, error)
- func (d DockerLifecycleHandler) Stop(currentNode node.Node) error
- type DockerPlugin
- type DockerUpgrader
- type DummyTester
- type FileConfigurator
- type IdentityCreator
- type LifecycleHandler
- type MetaInfo
- type Parameter
- type ParameterValidator
- type Plugin
- type SimpleParameterValidator
- type Tester
- type Upgrader
Constants ¶
const ( ParameterTypeBool = "bool" ParameterTypeString = "string" SupportsTest = "test" SupportsUpgrade = "upgrade" SupportsIdentity = "identity" )
const (
// ConfigsDirectory is the subdirectory under the node directory where configs are saved
ConfigsDirectory = "configs"
)
const (
// LogsDirectory is the subdirectory under the node directory where logs are saved
LogsDirectory = "logs"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configurator ¶ added in v0.10.0
type Configurator interface { // Function that creates the configuration for the node Configure(currentNode node.Node) error // Removes configuration related to the node RemoveConfig(currentNode node.Node) error }
Configurator is the interface that wraps the Configure method
type DockerLifecycleHandler ¶ added in v0.10.0
type DockerLifecycleHandler struct {
// contains filtered or unexported fields
}
DockerLifecycleHandler provides functions to manage a node using plain docker containers
func NewDockerLifecycleHandler ¶ added in v0.10.0
func NewDockerLifecycleHandler(containers []docker.Container) DockerLifecycleHandler
NewDockerLifecycleHandler creates an instance of DockerLifecycleHandler
func (DockerLifecycleHandler) RemoveData ¶ added in v0.10.0
func (d DockerLifecycleHandler) RemoveData(currentNode node.Node) error
RemoveData removes any data (typically the blockchain itself) related to the node
func (DockerLifecycleHandler) RemoveRuntime ¶ added in v0.10.0
func (d DockerLifecycleHandler) RemoveRuntime(currentNode node.Node) error
RemoveRuntime removes the docker network and containers
func (DockerLifecycleHandler) Start ¶ added in v0.10.0
func (d DockerLifecycleHandler) Start(currentNode node.Node) error
Start starts monitoring agents and delegates to another function to start blockchain containers
type DockerPlugin ¶
type DockerPlugin struct { ParameterValidator IdentityCreator Configurator LifecycleHandler Upgrader Tester // contains filtered or unexported fields }
DockerPlugin is an implementation of the Plugin interface. It provides based functionality for a docker based plugin
func NewDockerPlugin ¶
func NewDockerPlugin(name string, version string, description string, parameters []Parameter, templates map[string]string, containers []docker.Container) DockerPlugin
NewDockerPlugin creates a new instance of DockerPlugin
func (DockerPlugin) Meta ¶
func (d DockerPlugin) Meta() MetaInfo
Meta returns the MetaInfo of a plugin
type DockerUpgrader ¶ added in v0.10.0
type DockerUpgrader struct {
// contains filtered or unexported fields
}
DockerUpgrader provides a default strategy for upgrading docker based nodes
The default upgrade strategy uses a LifecycleHandler to remove all containers. If they where running they get started again which will pull new container images.
This works as long as only the container versions change. If the the upgrade needs changes to the configs or migrations tasks it is recommended to provide a custom Upgrader.
func NewDockerUpgrader ¶ added in v0.10.0
func NewDockerUpgrader(containers []docker.Container) DockerUpgrader
NewDockerUpgrader instantiates DockerUpgrader
type DummyTester ¶ added in v0.10.0
type DummyTester struct{}
DummyTester does nothing except panicking
This Tester can be used if the plugin doesn't support testing
func NewDummyTester ¶ added in v0.10.0
func NewDummyTester() DummyTester
type FileConfigurator ¶ added in v0.10.0
type FileConfigurator struct {
// contains filtered or unexported fields
}
FileConfigurator creates configuration files from templates
func NewFileConfigurator ¶ added in v0.10.0
func NewFileConfigurator(configFilesAndTemplates map[string]string) FileConfigurator
NewFileConfigurator creates an instance of FileConfigurator
func (FileConfigurator) Configure ¶ added in v0.10.0
func (d FileConfigurator) Configure(currentNode node.Node) error
Configure creates configuration files for the blockchain client
func (FileConfigurator) RemoveConfig ¶ added in v0.10.0
func (d FileConfigurator) RemoveConfig(currentNode node.Node) error
RemoveConfig removes configuration files related to the node
type IdentityCreator ¶ added in v0.10.0
type IdentityCreator interface { // Function that creates the identity of a node CreateIdentity(currentNode node.Node) error // Removes identity related to the node RemoveIdentity(currentNode node.Node) error }
IdentityCreator provides functions to create and remove the identity (e.g. private keys) of a node
type LifecycleHandler ¶ added in v0.10.0
type LifecycleHandler interface { // Function to start a node Start(currentNode node.Node) error // Function to stop a running node Stop(currentNode node.Node) error // Function to return the status (running, incomplete, stopped) of a node Status(currentNode node.Node) (string, error) // Removes any data (typically the blockchain itself) related to the node RemoveData(currentNode node.Node) error // Removes everything other than data and configuration related to the node RemoveRuntime(currentNode node.Node) error }
LifecycleHandler provides functions to manage a node
type MetaInfo ¶
type ParameterValidator ¶ added in v0.10.0
type ParameterValidator interface { // ValidateParameters validates the ndoe parameters ValidateParameters(currentNode node.Node) error }
ParameterValidator provides a function to validate the node parameters
type Plugin ¶
type Plugin interface { // Returns the name of the plugin Name() string // Return plugin meta information such as: What's supported, possible parameters Meta() MetaInfo ParameterValidator IdentityCreator Configurator LifecycleHandler Upgrader Tester }
Plugin describes and provides the functionality for a plugin
type SimpleParameterValidator ¶ added in v0.10.0
type SimpleParameterValidator struct {
// contains filtered or unexported fields
}
SimpleParameterValidator is a simple validator
It checks if all parameters exist and if mandatory parameters have a value
func NewSimpleParameterValidator ¶ added in v0.10.0
func NewSimpleParameterValidator(pluginParameters []Parameter) SimpleParameterValidator
NewSimpleParameterValidator creates an instance of SimpleParameterValidator
func (SimpleParameterValidator) ValidateParameters ¶ added in v0.10.0
func (m SimpleParameterValidator) ValidateParameters(currentNode node.Node) error
ValidateParameters checks if mandatory parameters are passed in