本文整理汇总了Golang中github.com/docker/libnetwork/datastore.DefaultScopes函数的典型用法代码示例。如果您正苦于以下问题:Golang DefaultScopes函数的具体用法?Golang DefaultScopes怎么用?Golang DefaultScopes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultScopes函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: LoadDefaultScopes
// LoadDefaultScopes loads default scope configs for scopes which
// doesn't have explicit user specified configs.
func (c *Config) LoadDefaultScopes(dataDir string) {
for k, v := range datastore.DefaultScopes(dataDir) {
if _, ok := c.Scopes[k]; !ok {
c.Scopes[k] = v
}
}
}
示例2: main
func main() {
kingpin.Parse()
if *debug {
logrus.SetLevel(logrus.DebugLevel)
}
dc := &driverCallback{}
driverOptions := options.Generic{
"EnableIPTables": *iptables,
"EnableIPForwarding": *ipForward,
}
genericOption := make(map[string]interface{})
genericOption[netlabel.GenericData] = driverOptions
for k, v := range datastore.DefaultScopes("") {
if !v.IsValid() {
continue
}
genericOption[netlabel.MakeKVProvider(k)] = v.Client.Provider
genericOption[netlabel.MakeKVProviderURL(k)] = v.Client.Address
genericOption[netlabel.MakeKVProviderConfig(k)] = v.Client.Config
}
err := bridge.Init(dc, genericOption)
if err != nil {
logrus.Fatalf("Failed to initialize the bridge: %v", err)
}
h := network.NewHandler(dc.driver)
h.ServeUnix("", pluginName)
}
示例3: TestBoltdbBackend
func TestBoltdbBackend(t *testing.T) {
defer os.Remove(datastore.DefaultScopes("")[datastore.LocalScope].Client.Address)
testLocalBackend(t, "", "", nil)
defer os.Remove("/tmp/boltdb.db")
config := &store.Config{Bucket: "testBackend"}
testLocalBackend(t, "boltdb", "/tmp/boltdb.db", config)
}
示例4: createController
func createController() error {
var err error
// Cleanup local datastore file
os.Remove(datastore.DefaultScopes("")[datastore.LocalScope].Client.Address)
option := options.Generic{
"EnableIPForwarding": true,
}
genericOption := make(map[string]interface{})
genericOption[netlabel.GenericData] = option
cfgOptions, err := libnetwork.OptionBoltdbWithRandomDBFile()
if err != nil {
return err
}
controller, err = libnetwork.New(append(cfgOptions, config.OptionDriverConfig(bridgeNetType, genericOption))...)
if err != nil {
return err
}
return nil
}