本文整理匯總了Golang中github.com/cloudfoundry/hm9000/models.PendingStopMessage.StoreKey方法的典型用法代碼示例。如果您正苦於以下問題:Golang PendingStopMessage.StoreKey方法的具體用法?Golang PendingStopMessage.StoreKey怎麽用?Golang PendingStopMessage.StoreKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/hm9000/models.PendingStopMessage
的用法示例。
在下文中一共展示了PendingStopMessage.StoreKey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: appendStopMessageIfNotDuplicate
func (a *appAnalyzer) appendStopMessageIfNotDuplicate(message models.PendingStopMessage, loggingMessage string, additionalDetails map[string]string) {
existingMessage, alreadyQueued := a.existingPendingStopMessages[message.StoreKey()]
if !alreadyQueued {
a.logger.Info(fmt.Sprintf("Enqueuing Stop Message: %s", loggingMessage), message.LogDescription(), additionalDetails)
a.stopMessages[message.StoreKey()] = message
} else {
a.logger.Info(fmt.Sprintf("Skipping Already Enqueued Stop Message: %s", loggingMessage), existingMessage.LogDescription(), additionalDetails)
}
}
示例2:
Describe("Saving stop messages", func() {
BeforeEach(func() {
err := store.SavePendingStopMessages(
message1,
message2,
)
Ω(err).ShouldNot(HaveOccurred())
})
It("stores the passed in stop messages", func() {
node, err := storeAdapter.ListRecursively("/hm/v1/stop")
Ω(err).ShouldNot(HaveOccurred())
Ω(node.ChildNodes).Should(HaveLen(2))
Ω(node.ChildNodes).Should(ContainElement(storeadapter.StoreNode{
Key: "/hm/v1/stop/" + message1.StoreKey(),
Value: message1.ToJSON(),
TTL: 0,
}))
Ω(node.ChildNodes).Should(ContainElement(storeadapter.StoreNode{
Key: "/hm/v1/stop/" + message2.StoreKey(),
Value: message2.ToJSON(),
TTL: 0,
}))
})
})
Describe("Fetching stop message", func() {
Context("When the stop message is present", func() {
BeforeEach(func() {
err := store.SavePendingStopMessages(