当前位置: 首页>>代码示例>>Golang>>正文


Golang Namespace.Name方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/ducati-daemon/lib/namespace.Namespace.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang Namespace.Name方法的具体用法?Golang Namespace.Name怎么用?Golang Namespace.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/ducati-daemon/lib/namespace.Namespace的用法示例。


在下文中一共展示了Namespace.Name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Callback

func (r *Reloader) Callback(ns namespace.Namespace) error {

	nsName := ns.Name()

	vxlanName, err := getVxlanName(nsName)
	if err != nil {
		return fmt.Errorf("get vxlan name: %s", err)
	}

	err = r.Watcher.StartMonitor(ns, vxlanName)
	if err != nil {
		return fmt.Errorf("start monitor: %s", err)
	}

	return nil
}
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:16,代码来源:reloader.go

示例2: New

func New(
	logger lager.Logger,
	namespace namespace.Namespace,
	invoker Invoker,
	linkFactory LinkFactory,
	watcher watcher.MissWatcher,
) Sandbox {
	logger = logger.Session("network-sandbox", lager.Data{"namespace": namespace.Name()})

	return &NetworkSandbox{
		logger:      logger,
		namespace:   namespace,
		invoker:     invoker,
		linkFactory: linkFactory,
		watcher:     watcher,
	}
}
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:17,代码来源:sandbox.go

示例3: StopMonitor

func (w *missWatcher) StopMonitor(ns namespace.Namespace) error {
	w.Locker.Lock()
	defer w.Locker.Unlock()

	logger := w.Logger.Session("stop-monitor", lager.Data{"namespace": ns})
	logger.Info("called")
	defer logger.Info("complete")

	doneChan, ok := w.DoneChans[ns.Name()]
	if !ok {
		err := fmt.Errorf("namespace %s not monitored", ns.Name())
		logger.Error("done-channel-missing", err)
		return err
	}

	delete(w.DoneChans, ns.Name())
	close(doneChan)

	return nil
}
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:20,代码来源:watcher.go

示例4: StartMonitor

func (w *missWatcher) StartMonitor(ns namespace.Namespace, vxlanName string) error {
	logger := w.Logger.Session("start-monitor", lager.Data{"namespace": ns})
	logger.Info("called")
	defer logger.Info("complete")

	subChan := make(chan *Neigh)
	unresolvedMisses := make(chan Neighbor)
	resolvedNeighbors := make(chan Neighbor)

	doneChan := make(chan struct{})

	w.Locker.Lock()
	w.DoneChans[ns.Name()] = doneChan
	w.Locker.Unlock()

	err := w.startARPInserter(ns, vxlanName, resolvedNeighbors)
	if err != nil {
		return fmt.Errorf("arp inserter failed: %s", err)
	}

	err = w.Subscriber.Subscribe(ns, subChan, doneChan)
	if err != nil {
		return fmt.Errorf("subscribe in %s: %s", ns.Name(), err)
	}

	go func() {
		logger := logger.Session("forward-neighbor-messages")
		logger.Info("starting")
		for neigh := range subChan {
			unresolvedMisses <- Neighbor{
				SandboxName: ns.Name(),
				Neigh:       *neigh,
			}
		}
		logger.Info("complete")
	}()

	go w.Resolver.ResolveMisses(unresolvedMisses, resolvedNeighbors)

	return nil
}
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:41,代码来源:watcher.go

示例5:

		var (
			upSpec       models.CNIAddPayload
			downSpec     models.CNIDelPayload
			daemonClient *client.DaemonClient
			ipamResult   types.Result
		)

		BeforeEach(func() {
			Eventually(serverIsAvailable).Should(Succeed())

			daemonClient = client.New("http://"+address, http.DefaultClient)

			By("generating config and creating the request")
			upSpec = models.CNIAddPayload{
				Args:               "FOO=BAR;ABC=123",
				ContainerNamespace: containerNamespace.Name(),
				InterfaceName:      "vx-eth0",
				Network: models.NetworkPayload{
					models.Properties{
						AppID:   appID,
						SpaceID: spaceID,
					},
				},
				ContainerID: containerID,
			}

			downSpec = models.CNIDelPayload{
				InterfaceName:      "vx-eth0",
				ContainerNamespace: containerNamespace.Name(),
				ContainerID:        containerID,
			}
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:sandbox_namespace_consistency_test.go

示例6:

				Expect(logger).To(gbytes.Say("destroy.not-a-netns"))
			})
		})

		Context("when the namespace file is not a bind mount", func() {
			var ns namespace.Namespace

			BeforeEach(func() {
				var err error
				ns, err = repo.Create("already-destroyed")
				Expect(err).NotTo(HaveOccurred())

				err = repo.Destroy(ns)
				Expect(err).NotTo(HaveOccurred())

				f, err := os.Create(ns.Name())
				Expect(err).NotTo(HaveOccurred())
				f.Close()
			})

			AfterEach(func() {
				os.Remove(ns.Name())
			})

			It("returns an error", func() {
				err := repo.Destroy(ns)
				Expect(err).To(HaveOccurred())
			})

			It("does not remove the file", func() {
				Expect(ns.Name()).To(BeAnExistingFile())
开发者ID:cloudfoundry-incubator,项目名称:ducati-daemon,代码行数:31,代码来源:repository_test.go


注:本文中的github.com/cloudfoundry-incubator/ducati-daemon/lib/namespace.Namespace.Name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。