本文整理匯總了Golang中github.com/juju/juju/environs/simplestreams.DataSource.Priority方法的典型用法代碼示例。如果您正苦於以下問題:Golang DataSource.Priority方法的具體用法?Golang DataSource.Priority怎麽用?Golang DataSource.Priority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/environs/simplestreams.DataSource
的用法示例。
在下文中一共展示了DataSource.Priority方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: storeImageMetadataFromFiles
// storeImageMetadataFromFiles puts image metadata found in sources into state.
func storeImageMetadataFromFiles(st *state.State, env environs.Environ, source simplestreams.DataSource) error {
// Read the image metadata, as we'll want to upload it to the environment.
imageConstraint := imagemetadata.NewImageConstraint(simplestreams.LookupParams{})
if inst, ok := env.(simplestreams.HasRegion); ok {
// If we can determine current region,
// we want only metadata specific to this region.
cloud, err := inst.Region()
if err != nil {
return err
}
imageConstraint.CloudSpec = cloud
}
existingMetadata, info, err := imagemetadata.Fetch([]simplestreams.DataSource{source}, imageConstraint)
if err != nil && !errors.IsNotFound(err) {
return errors.Annotate(err, "cannot read image metadata")
}
return storeImageMetadataInState(st, info.Source, source.Priority(), existingMetadata)
}