Moved base plugin API to common
This commit is contained in:
Родитель
3a5f237ebe
Коммит
dbe4fae8af
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/Azure/Aqua/store"
|
||||
)
|
||||
|
||||
// Plugin object and interface
|
||||
// Plugin base object.
|
||||
type Plugin struct {
|
||||
Name string
|
||||
Version string
|
||||
|
@ -20,6 +20,13 @@ type Plugin struct {
|
|||
Listener *Listener
|
||||
}
|
||||
|
||||
// Plugin base interface.
|
||||
type PluginApi interface {
|
||||
Start(*PluginConfig) error
|
||||
Stop()
|
||||
SetOption(string, string)
|
||||
}
|
||||
|
||||
// Plugin common configuration.
|
||||
type PluginConfig struct {
|
||||
Name string
|
||||
|
|
|
@ -25,10 +25,7 @@ type ipamPlugin struct {
|
|||
}
|
||||
|
||||
type IpamPlugin interface {
|
||||
Start(*common.PluginConfig) error
|
||||
Stop()
|
||||
|
||||
SetOption(string, string)
|
||||
common.PluginApi
|
||||
}
|
||||
|
||||
// Creates a new IpamPlugin object.
|
||||
|
|
|
@ -23,6 +23,11 @@ type networkManager struct {
|
|||
sync.Mutex
|
||||
}
|
||||
|
||||
// NetworkManager API.
|
||||
type NetApi interface {
|
||||
AddExternalInterface(ifName string, subnet string) error
|
||||
}
|
||||
|
||||
// Creates a new network manager.
|
||||
func newNetworkManager() (*networkManager, error) {
|
||||
nm := &networkManager{
|
||||
|
|
|
@ -26,12 +26,7 @@ type netPlugin struct {
|
|||
}
|
||||
|
||||
type NetPlugin interface {
|
||||
Start(*common.PluginConfig) error
|
||||
Stop()
|
||||
}
|
||||
|
||||
type NetApi interface {
|
||||
AddExternalInterface(ifName string, subnet string) error
|
||||
common.PluginApi
|
||||
}
|
||||
|
||||
// Creates a new NetPlugin object.
|
||||
|
@ -96,14 +91,6 @@ func (plugin *netPlugin) Stop() {
|
|||
log.Printf("[net] Plugin stopped.")
|
||||
}
|
||||
|
||||
//
|
||||
// NetPlugin internal API
|
||||
//
|
||||
|
||||
func (plugin *netPlugin) AddExternalInterface(ifName string, subnet string) error {
|
||||
return plugin.nm.AddExternalInterface(ifName, subnet)
|
||||
}
|
||||
|
||||
//
|
||||
// Libnetwork remote network API implementation
|
||||
// https://github.com/docker/libnetwork/blob/master/docs/remote.md
|
||||
|
|
Загрузка…
Ссылка в новой задаче