本文整理匯總了Golang中github.com/apoydence/talaria/messages.Client.GetWriteToFile方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.GetWriteToFile方法的具體用法?Golang Client.GetWriteToFile怎麽用?Golang Client.GetWriteToFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/apoydence/talaria/messages.Client
的用法示例。
在下文中一共展示了Client.GetWriteToFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
var wg sync.WaitGroup
defer wg.Wait()
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer GinkgoRecover()
defer wg.Done()
expectedData := []byte("some-data")
_, err := client.WriteToFile(id, expectedData)
Expect(err).ToNot(HaveOccurred())
var msg *messages.Client
Eventually(mockServers[1].clientCh).Should(Receive(&msg))
Expect(msg.GetMessageType()).To(Equal(messages.Client_WriteToFile))
Expect(msg.GetWriteToFile().GetData()).To(Equal(expectedData))
}()
}
}, 5)
Measure("Writes to a file 1000 times in under a second", func(b Benchmarker) {
runtime := b.Time("runtime", func() {
mockServers[0].serverCh <- buildFileLocation(1)
count := 1000
go func() {
for i := 0; i < count; i++ {
mockServers[0].serverCh <- buildFileOffset(uint64(i+2), 101)
}
}()