本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/models.DesiredLRPSchedulingInfo.ModificationTag方法的典型用法代码示例。如果您正苦于以下问题:Golang DesiredLRPSchedulingInfo.ModificationTag方法的具体用法?Golang DesiredLRPSchedulingInfo.ModificationTag怎么用?Golang DesiredLRPSchedulingInfo.ModificationTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/bbs/models.DesiredLRPSchedulingInfo
的用法示例。
在下文中一共展示了DesiredLRPSchedulingInfo.ModificationTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createDesiredLRPSchedulingInfo
func (db *ETCDDB) createDesiredLRPSchedulingInfo(logger lager.Logger, schedulingInfo *models.DesiredLRPSchedulingInfo) error {
epochGuid, err := uuid.NewV4()
if err != nil {
logger.Error("failed-to-generate-epoch", err)
return models.ErrUnknownError
}
schedulingInfo.ModificationTag = models.NewModificationTag(epochGuid.String(), 0)
serializedSchedInfo, err := db.serializeModel(logger, schedulingInfo)
if err != nil {
logger.Error("failed-to-serialize", err)
return err
}
logger.Debug("persisting-scheduling-info")
_, err = db.client.Create(DesiredLRPSchedulingInfoSchemaPath(schedulingInfo.ProcessGuid), serializedSchedInfo, NO_TTL)
if err != nil {
return ErrorFromEtcdError(logger, err)
}
logger.Debug("succeeded-persisting-scheduling-info")
return nil
}
示例2: 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})
}
}