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