當前位置: 首頁>>代碼示例>>Golang>>正文


Golang StoreAdapter.Disconnect方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/hm9000/storeadapter.StoreAdapter.Disconnect方法的典型用法代碼示例。如果您正苦於以下問題:Golang StoreAdapter.Disconnect方法的具體用法?Golang StoreAdapter.Disconnect怎麽用?Golang StoreAdapter.Disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry/hm9000/storeadapter.StoreAdapter的用法示例。


在下文中一共展示了StoreAdapter.Disconnect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

		var err error
		conf, err = config.DefaultConfig()
		Ω(err).ShouldNot(HaveOccured())
		etcdAdapter = storeadapter.NewETCDStoreAdapter(etcdRunner.NodeURLS(), conf.StoreMaxConcurrentRequests)
		err = etcdAdapter.Connect()
		Ω(err).ShouldNot(HaveOccured())

		app1 = app.NewApp()
		app2 = app.NewApp()
		app3 = app.NewApp()

		store = NewStore(conf, etcdAdapter)
	})

	AfterEach(func() {
		etcdAdapter.Disconnect()
	})

	Describe("Saving desired state ", func() {
		BeforeEach(func() {
			err := store.SaveDesiredState([]models.DesiredAppState{
				app1.DesiredState(0),
				app2.DesiredState(0),
			})
			Ω(err).ShouldNot(HaveOccured())
		})

		It("can stores the passed in desired state", func() {
			nodes, err := etcdAdapter.List("/desired")
			Ω(err).ShouldNot(HaveOccured())
			Ω(nodes).Should(HaveLen(2))
開發者ID:Zhann,項目名稱:hm9000,代碼行數:31,代碼來源:desired_state_test.go

示例2:

							storeAdapter = storeadapter.NewETCDStoreAdapter(storeRunner.NodeURLS(), workerpool.NewWorkerPool(concurrency))
							err := storeAdapter.Connect()
							Ω(err).ShouldNot(HaveOccured())
						} else if storeType == "Zookeeper" {
							storeRunner = storerunner.NewZookeeperClusterRunner(2181, nodes)
							storeRunner.Start()

							storeAdapter = storeadapter.NewZookeeperStoreAdapter(storeRunner.NodeURLS(), workerpool.NewWorkerPool(concurrency), &timeprovider.RealTimeProvider{}, time.Second)
							err := storeAdapter.Connect()
							Ω(err).ShouldNot(HaveOccured())
						}
					})

					AfterEach(func() {
						storeAdapter.Disconnect()
						storeRunner.Stop()
						storeRunner = nil
					})

					randomBytes := func(sizeInBytes int) []byte {
						seedBytes := []byte{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
						randomBytes := make([]byte, sizeInBytes)
						for i := 0; i < sizeInBytes; i++ {
							randomBytes[i] = seedBytes[rand.Intn(len(seedBytes))]
						}

						return randomBytes
					}

					for _, recordSize := range recordSizes {
開發者ID:pivotal-cf-experimental,項目名稱:hmperformance,代碼行數:30,代碼來源:detailed_store_performance_test.go


注:本文中的github.com/cloudfoundry/hm9000/storeadapter.StoreAdapter.Disconnect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。