当前位置: 首页>>代码示例>>Golang>>正文


Golang DesiredLRP.DesiredLRPResource方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/models.DesiredLRP.DesiredLRPResource方法的典型用法代码示例。如果您正苦于以下问题:Golang DesiredLRP.DesiredLRPResource方法的具体用法?Golang DesiredLRP.DesiredLRPResource怎么用?Golang DesiredLRP.DesiredLRPResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/bbs/models.DesiredLRP的用法示例。


在下文中一共展示了DesiredLRP.DesiredLRPResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: WriteSchedulingInfo

func (m *SplitDesiredLRP) WriteSchedulingInfo(logger lager.Logger, desiredLRP models.DesiredLRP) {
	schedulingInfo := models.DesiredLRPSchedulingInfo{
		DesiredLRPKey:      desiredLRP.DesiredLRPKey(),
		Annotation:         desiredLRP.Annotation,
		Instances:          desiredLRP.Instances,
		DesiredLRPResource: desiredLRP.DesiredLRPResource(),
	}
	if desiredLRP.Routes != nil {
		schedulingInfo.Routes = *desiredLRP.Routes
	}
	if desiredLRP.ModificationTag != nil {
		schedulingInfo.ModificationTag = *desiredLRP.ModificationTag
	}

	schedulingInfoPayload, marshalErr := m.serializer.Marshal(logger, format.ENCRYPTED_PROTO, &schedulingInfo)
	if marshalErr != nil {
		logger.Error("failed-marshaling-scheduling-info", marshalErr, lager.Data{"process_guid": schedulingInfo.ProcessGuid})
	}

	_, setErr := m.storeClient.Set(etcd.DesiredLRPSchedulingInfoSchemaPath(desiredLRP.ProcessGuid), schedulingInfoPayload, etcd.NO_TTL)
	if setErr != nil {
		logger.Error("failed-set-of-scheduling-info", marshalErr, lager.Data{"process_guid": schedulingInfo.ProcessGuid})
	}
}
开发者ID:timani,项目名称:bbs,代码行数:24,代码来源:1442529338_split_desired_lrp.go

示例2:

			desiredLRP *models.DesiredLRP

			desireErr error
		)

		JustBeforeEach(func() {
			desiredLRP = model_helpers.NewValidDesiredLRP("super-lrp")
			desireErr = client.DesireLRP(desiredLRP)
		})

		It("creates the desired LRP in the system", func() {
			Expect(desireErr).NotTo(HaveOccurred())
			persistedDesiredLRP, err := client.DesiredLRPByProcessGuid("super-lrp")
			Expect(err).NotTo(HaveOccurred())
			Expect(persistedDesiredLRP.DesiredLRPKey()).To(Equal(desiredLRP.DesiredLRPKey()))
			Expect(persistedDesiredLRP.DesiredLRPResource()).To(Equal(desiredLRP.DesiredLRPResource()))
			Expect(persistedDesiredLRP.Annotation).To(Equal(desiredLRP.Annotation))
			Expect(persistedDesiredLRP.Instances).To(Equal(desiredLRP.Instances))
			Expect(persistedDesiredLRP.DesiredLRPRunInfo()).To(Equal(desiredLRP.DesiredLRPRunInfo()))
		})
	})

	Describe("RemoveDesiredLRP", func() {
		var (
			desiredLRP *models.DesiredLRP

			removeErr error
		)

		JustBeforeEach(func() {
			desiredLRP = model_helpers.NewValidDesiredLRP("super-lrp")
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:31,代码来源:desired_lrp_test.go

示例3:

		BeforeEach(func() {
			lrp = model_helpers.NewValidDesiredLRP("some-process-guid")
			lrp.Instances = 5
		})

		Context("when the desired LRP does not yet exist", func() {
			It("persists the scheduling info and run info", func() {
				err := etcdDB.DesireLRP(logger, lrp)
				Expect(err).NotTo(HaveOccurred())

				persisted, err := etcdDB.DesiredLRPByProcessGuid(logger, "some-process-guid")
				Expect(err).NotTo(HaveOccurred())

				Expect(persisted.DesiredLRPKey()).To(Equal(lrp.DesiredLRPKey()))
				Expect(persisted.DesiredLRPResource()).To(Equal(lrp.DesiredLRPResource()))
				Expect(persisted.Annotation).To(Equal(lrp.Annotation))
				Expect(persisted.Instances).To(Equal(lrp.Instances))
				Expect(persisted.DesiredLRPRunInfo(clock.Now())).To(Equal(lrp.DesiredLRPRunInfo(clock.Now())))
			})

			It("sets the ModificationTag on the DesiredLRP", func() {
				err := etcdDB.DesireLRP(logger, lrp)
				Expect(err).NotTo(HaveOccurred())

				lrp, err := etcdDB.DesiredLRPByProcessGuid(logger, "some-process-guid")
				Expect(err).NotTo(HaveOccurred())

				Expect(lrp.ModificationTag.Epoch).NotTo(BeEmpty())
				Expect(lrp.ModificationTag.Index).To(BeEquivalentTo(0))
			})
开发者ID:timani,项目名称:bbs,代码行数:30,代码来源:desired_lrp_db_test.go

示例4:

			migrationErr = migration.Up(logger)
		})

		It("creates a DesiredLRPSchedulingInfo for all desired LRPs", func() {
			Expect(migrationErr).NotTo(HaveOccurred())

			response, err := storeClient.Get(etcd.DesiredLRPSchedulingInfoSchemaRoot, false, true)
			Expect(err).NotTo(HaveOccurred())
			Expect(response.Node.Nodes).To(HaveLen(1))

			for _, node := range response.Node.Nodes {
				var schedulingInfo models.DesiredLRPSchedulingInfo
				serializer.Unmarshal(logger, []byte(node.Value), &schedulingInfo)

				Expect(schedulingInfo.DesiredLRPKey).To(Equal(existingDesiredLRP.DesiredLRPKey()))
				Expect(schedulingInfo.DesiredLRPResource).To(Equal(existingDesiredLRP.DesiredLRPResource()))
				Expect(schedulingInfo.Annotation).To(Equal(existingDesiredLRP.Annotation))
				Expect(schedulingInfo.Instances).To(Equal(existingDesiredLRP.Instances))
				Expect(schedulingInfo.Routes).To(Equal(*existingDesiredLRP.Routes))
				Expect(schedulingInfo.ModificationTag).To(Equal(*existingDesiredLRP.ModificationTag))
			}
		})

		It("creates a DesiredLRPRunInfo for all desired LRPs", func() {
			Expect(migrationErr).NotTo(HaveOccurred())

			response, err := storeClient.Get(etcd.DesiredLRPRunInfoSchemaRoot, false, true)
			Expect(err).NotTo(HaveOccurred())
			Expect(response.Node.Nodes).To(HaveLen(1))

			for _, node := range response.Node.Nodes {
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:1442529338_split_desired_lrp_test.go


注:本文中的github.com/cloudfoundry-incubator/bbs/models.DesiredLRP.DesiredLRPResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。