本文整理匯總了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(),
}
}
示例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)
}
示例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())
}
}