當前位置: 首頁>>代碼示例>>Golang>>正文


Golang subnet.LeaseRenewer函數代碼示例

本文整理匯總了Golang中github.com/coreos/flannel/subnet.LeaseRenewer函數的典型用法代碼示例。如果您正苦於以下問題:Golang LeaseRenewer函數的具體用法?Golang LeaseRenewer怎麽用?Golang LeaseRenewer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了LeaseRenewer函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Run

func (rb *HostgwBackend) Run() {
	rb.wg.Add(1)
	go func() {
		subnet.LeaseRenewer(rb.ctx, rb.sm, rb.network, rb.lease)
		rb.wg.Done()
	}()

	log.Info("Watching for new subnet leases")
	evts := make(chan []subnet.Event)
	rb.wg.Add(1)
	go func() {
		subnet.WatchLeases(rb.ctx, rb.sm, rb.network, rb.lease, evts)
		rb.wg.Done()
	}()

	rb.rl = make([]netlink.Route, 0, 10)
	rb.wg.Add(1)
	go func() {
		rb.routeCheck(rb.ctx)
		rb.wg.Done()
	}()

	defer rb.wg.Wait()

	for {
		select {
		case evtBatch := <-evts:
			rb.handleSubnetEvents(evtBatch)

		case <-rb.ctx.Done():
			return
		}
	}
}
開發者ID:rajatchopra,項目名稱:flannel,代碼行數:34,代碼來源:hostgw.go

示例2: Run

func (vb *VXLANBackend) Run() {
	vb.wg.Add(1)
	go func() {
		subnet.LeaseRenewer(vb.ctx, vb.sm, vb.network, vb.lease)
		log.Info("LeaseRenewer exited")
		vb.wg.Done()
	}()

	log.Info("Watching for L3 misses")
	misses := make(chan *netlink.Neigh, 100)
	// Unfrtunately MonitorMisses does not take a cancel channel
	// as there's no wait to interrupt netlink socket recv
	go vb.dev.MonitorMisses(misses)

	log.Info("Watching for new subnet leases")
	evts := make(chan []subnet.Event)
	vb.wg.Add(1)
	go func() {
		subnet.WatchLeases(vb.ctx, vb.sm, vb.network, vb.lease, evts)
		log.Info("WatchLeases exited")
		vb.wg.Done()
	}()

	defer vb.wg.Wait()
	initialEvtsBatch := <-evts
	for {
		err := vb.handleInitialSubnetEvents(initialEvtsBatch)
		if err == nil {
			break
		}
		log.Error(err, " About to retry")
		time.Sleep(time.Second)
	}

	for {
		select {
		case miss := <-misses:
			vb.handleMiss(miss)

		case evtBatch := <-evts:
			vb.handleSubnetEvents(evtBatch)

		case <-vb.ctx.Done():
			return
		}
	}
}
開發者ID:rajatchopra,項目名稱:flannel,代碼行數:47,代碼來源:vxlan.go

示例3: Run

func (n *Network) Run(ctx context.Context) {
	wg := sync.WaitGroup{}
	wg.Add(1)
	go func() {
		n.be.Run(ctx)
		wg.Done()
	}()

	wg.Add(1)
	go func() {
		subnet.LeaseRenewer(ctx, n.sm, n.Name, n.lease)
		wg.Done()
	}()

	<-ctx.Done()
	wg.Wait()
}
開發者ID:OpenSorceress,項目名稱:flannel,代碼行數:17,代碼來源:network.go

示例4: Run

func (n *Network) Run(extIface *backend.ExternalInterface, inited func(bn backend.Network)) {
	wg := sync.WaitGroup{}

For:
	for {
		err := n.init()
		switch err {
		case nil:
			break For
		case context.Canceled:
			return
		default:
			log.Error(err)
			select {
			case <-n.ctx.Done():
				return
			case <-time.After(time.Second):
			}
		}
	}

	inited(n.bn)

	wg.Add(1)
	go func() {
		n.bn.Run(n.ctx)
		wg.Done()
	}()

	wg.Add(1)
	go func() {
		subnet.LeaseRenewer(n.ctx, n.sm, n.Name, n.bn.Lease())
		wg.Done()
	}()

	defer func() {
		if n.ipMasq {
			if err := teardownIPMasq(n.Config.Network); err != nil {
				log.Errorf("Failed to tear down IP Masquerade for network %v: %v", n.Name, err)
			}
		}
	}()

	wg.Wait()
}
開發者ID:jonboulle,項目名稱:flannel,代碼行數:45,代碼來源:network.go

示例5: Run

func (m *UdpBackend) Run() {
	// one for each goroutine below
	m.wg.Add(2)

	go func() {
		runCProxy(m.tun, m.conn, m.ctl2, m.tunNet.IP, m.mtu)
		m.wg.Done()
	}()

	go func() {
		subnet.LeaseRenewer(m.ctx, m.sm, m.network, m.lease)
		m.wg.Done()
	}()

	m.monitorEvents()

	m.wg.Wait()
}
開發者ID:rajatchopra,項目名稱:flannel,代碼行數:18,代碼來源:udp.go

示例6: Run

func (n *Network) Run() {
	wg := sync.WaitGroup{}
	wg.Add(1)
	go func() {
		n.be.Run(n.ctx)
		wg.Done()
	}()

	wg.Add(1)
	go func() {
		subnet.LeaseRenewer(n.ctx, n.sm, n.Name, n.lease)
		wg.Done()
	}()

	<-n.ctx.Done()
	n.be.UnregisterNetwork(n.ctx, n.Name)

	wg.Wait()
}
開發者ID:patrobinson,項目名稱:flannel,代碼行數:19,代碼來源:network.go

示例7: Run

func (m *AwsVpcBackend) Run() {
	subnet.LeaseRenewer(m.ctx, m.sm, m.network, m.lease)
}
開發者ID:nathanleiby,項目名稱:flannel,代碼行數:3,代碼來源:awsvpc.go

示例8: Run

func (g *GCEBackend) Run() {
	log.Info("GCE backend running")
	subnet.LeaseRenewer(g.ctx, g.sm, g.network, g.lease)
}
開發者ID:MarkBruns,項目名稱:flannel,代碼行數:4,代碼來源:gce.go


注:本文中的github.com/coreos/flannel/subnet.LeaseRenewer函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。