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


Golang leadership.Tracker类代码示例

本文整理汇总了Golang中github.com/juju/juju/worker/leadership.Tracker的典型用法代码示例。如果您正苦于以下问题:Golang Tracker类的具体用法?Golang Tracker怎么用?Golang Tracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: NewLeadershipContext

func NewLeadershipContext(accessor LeadershipSettingsAccessor, tracker leadership.Tracker) LeadershipContext {
	return &leadershipContext{
		accessor:    accessor,
		tracker:     tracker,
		serviceName: tracker.ServiceName(),
	}
}
开发者ID:Pankov404,项目名称:juju,代码行数:7,代码来源:leader.go

示例2: assertClaimLeader

func assertClaimLeader(c *gc.C, tracker leadership.Tracker, expect bool) {
	// Grab a ticket...
	ticket := tracker.ClaimLeader()

	// ...and check that it gives the expected result every time it's checked.
	assertTicket(c, ticket, expect)
	assertTicket(c, ticket, expect)
}
开发者ID:imoapps,项目名称:juju,代码行数:8,代码来源:tracker_test.go

示例3: assertWaitMinion

func assertWaitMinion(c *gc.C, tracker leadership.Tracker, expect bool) {
	ticket := tracker.WaitMinion()
	if expect {
		assertTicket(c, ticket, false)
		assertTicket(c, ticket, false)
		return
	}
	select {
	case <-time.After(trackerDuration / 4):
		// This wait needs to be small, compared to the resolution we run the
		// tests at, so as not to disturb client timing too much.
	case <-ticket.Ready():
		c.Fatalf("got unexpected readiness: %v", ticket.Wait())
	}
}
开发者ID:imoapps,项目名称:juju,代码行数:15,代码来源:tracker_test.go


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