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


Golang DesiredLRP.Explode方法代碼示例

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


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

示例1: DesireLRP

// DesireLRP creates a DesiredLRPSchedulingInfo and a DesiredLRPRunInfo. In order
// to ensure that the complete model is available and there are no races in
// Desired Watches, DesiredLRPRunInfo is created before DesiredLRPSchedulingInfo.
func (db *ETCDDB) DesireLRP(logger lager.Logger, desiredLRP *models.DesiredLRP) error {
	logger = logger.Session("create-desired-lrp", lager.Data{"process-guid": desiredLRP.ProcessGuid})
	logger.Info("starting")
	defer logger.Info("complete")

	schedulingInfo, runInfo := desiredLRP.Explode()

	err := db.createDesiredLRPRunInfo(logger, &runInfo)
	if err != nil {
		return err
	}

	err = db.createDesiredLRPSchedulingInfo(logger, &schedulingInfo)
	if err != nil {
		return err
	}

	db.startInstanceRange(logger, 0, schedulingInfo.Instances, &schedulingInfo)
	return nil
}
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:23,代碼來源:desired_lrp_db.go

示例2: SetRawDesiredLRP

func (t *ETCDHelper) SetRawDesiredLRP(lrp *models.DesiredLRP) {
	schedulingInfo, runInfo := lrp.Explode()

	t.SetRawDesiredLRPSchedulingInfo(&schedulingInfo)
	t.SetRawDesiredLRPRunInfo(&runInfo)
}
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:6,代碼來源:creators.go

示例3:

				BeforeEach(func() {
					_, err := storeClient.Delete(deprecations.DesiredLRPSchemaRoot, true)
					Expect(err).NotTo(HaveOccurred())
				})

				It("continues the migration", func() {
					Expect(migrationErr).NotTo(HaveOccurred())
				})
			})
		})

		Context("when there are already 'migrated' data in the database", func() {
			var existingSplit *models.DesiredLRP
			BeforeEach(func() {
				existingSplit = newValidDesiredLRP("existing-split")
				schedulingInfo, runInfo := existingSplit.Explode()

				schedulingInfoPayload, err := serializer.Marshal(logger, format.ENCRYPTED_PROTO, &schedulingInfo)
				Expect(err).NotTo(HaveOccurred())
				runInfoPayload, err := serializer.Marshal(logger, format.ENCRYPTED_PROTO, &runInfo)
				Expect(err).NotTo(HaveOccurred())

				_, err = storeClient.Set(etcd.DesiredLRPSchedulingInfoSchemaPath("existing-split"), schedulingInfoPayload, 0)
				Expect(err).NotTo(HaveOccurred())
				_, err = storeClient.Set(etcd.DesiredLRPRunInfoSchemaPath("existing-split"), runInfoPayload, 0)
				Expect(err).NotTo(HaveOccurred())
			})

			It("deletes the existing lrp that was already split afterwards", func() {
				Expect(migrationErr).NotTo(HaveOccurred())
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:30,代碼來源:1442529338_split_desired_lrp_test.go


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