代码拉取完成,页面将自动刷新
package persist
import (
"github.com/docker/machine/drivers/errdriver"
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/drivers/plugin/localbinary"
"github.com/docker/machine/libmachine/drivers/rpc"
"github.com/docker/machine/libmachine/host"
)
type PluginDriverFactory interface {
NewPluginDriver(driverName string, rawDriver []byte) (drivers.Driver, error)
}
type RPCPluginDriverFactory struct{}
type PluginStore struct {
*Filestore
PluginDriverFactory
}
func (factory RPCPluginDriverFactory) NewPluginDriver(driverName string, rawDriver []byte) (drivers.Driver, error) {
d, err := rpcdriver.NewRPCClientDriver(driverName, rawDriver)
if err != nil {
// Not being able to find a driver binary is a "known error"
if _, ok := err.(localbinary.ErrPluginBinaryNotFound); ok {
return errdriver.NewDriver(driverName), nil
}
return nil, err
}
if driverName == "virtualbox" {
return drivers.NewSerialDriver(d), nil
}
return d, nil
}
func NewPluginStore(path, caCertPath, caPrivateKeyPath string) *PluginStore {
return &PluginStore{
Filestore: NewFilestore(path, caCertPath, caPrivateKeyPath),
PluginDriverFactory: RPCPluginDriverFactory{},
}
}
func (ps PluginStore) Load(name string) (*host.Host, error) {
h, err := ps.Filestore.Load(name)
if err != nil {
return nil, err
}
d, err := ps.NewPluginDriver(h.DriverName, h.RawDriver)
if err != nil {
return nil, err
}
h.Driver = d
return h, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。