本文整理汇总了Golang中github.com/square/p2/pkg/types.PodID类的典型用法代码示例。如果您正苦于以下问题:Golang PodID类的具体用法?Golang PodID怎么用?Golang PodID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PodID类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: shouldRollAfterDelay
func (u *update) shouldRollAfterDelay(podID types.PodID) (int, int, error) {
// Check health again following the roll delay. If things have gotten
// worse since we last looked, or there is an error, we break this iteration.
checks, err := u.hcheck.Service(podID.String())
if err != nil {
return 0, 0, util.Errorf("Could not retrieve health following delay: %v", err)
}
afterDelayNew, err := u.countHealthy(u.NewRC, checks)
if err != nil {
return 0, 0, util.Errorf("Could not determine new service health: %v", err)
}
afterDelayOld, err := u.countHealthy(u.OldRC, checks)
if err != nil {
return 0, 0, util.Errorf("Could not determine old service health: %v", err)
}
afterDelayRemove, afterDelayAdd := rollAlgorithm(u.rollAlgorithmParams(afterDelayOld, afterDelayNew))
if afterDelayRemove <= 0 && afterDelayAdd <= 0 {
return 0, 0, util.Errorf("No nodes can be safely updated after %v roll delay, will wait again", u.RollDelay)
}
return afterDelayRemove, afterDelayAdd, nil
}
开发者ID:rudle,项目名称:p2,代码行数:26,代码来源:run_update.go
示例2: Pod
func (s *fakeKpStore) Pod(podPrefix kp.PodPrefix, nodeName types.NodeName, podID types.PodID) (
manifest.Manifest, time.Duration, error) {
key := path.Join(string(podPrefix), nodeName.String(), podID.String())
if manifest, ok := s.manifests[key]; ok {
return manifest, 0, nil
}
return nil, 0, pods.NoCurrentManifest
}
开发者ID:drcapulet,项目名称:p2,代码行数:8,代码来源:replication_controller_test.go
示例3: NewLegacyP2RM
// NewLegacyP2RM is a constructor for the P2RM type which configures it to
// remove a "legacy" pod. It will generate the storage types based on its
// api.Client argument
func NewLegacyP2RM(client consulutil.ConsulClient, podName types.PodID, nodeName types.NodeName, labeler labels.ApplicatorWithoutWatches) *P2RM {
rm := &P2RM{}
rm.LabelID = path.Join(nodeName.String(), podName.String())
rm.PodID = podName
rm.NodeName = nodeName
rm.PodUniqueKey = ""
rm.configureStorage(client, labeler)
return rm
}
开发者ID:petertseng,项目名称:p2,代码行数:12,代码来源:rm.go
示例4: computeUniqueName
func computeUniqueName(id types.PodID, uniqueKey types.PodUniqueKey) string {
name := id.String()
if uniqueKey != "" {
// If the pod was scheduled with a UUID, we want to namespace its pod home
// with the same uuid. This enables multiple pods with the same pod ID to
// exist on the same filesystem
name = fmt.Sprintf("%s-%s", name, uniqueKey)
}
return name
}
开发者ID:petertseng,项目名称:p2,代码行数:11,代码来源:factory.go
示例5: FindWhereLabeled
func (s *consulStore) FindWhereLabeled(podID types.PodID,
availabilityZone fields.AvailabilityZone,
clusterName fields.ClusterName) ([]fields.PodCluster, error) {
sel := klabels.Everything().
Add(fields.PodIDLabel, klabels.EqualsOperator, []string{podID.String()}).
Add(fields.AvailabilityZoneLabel, klabels.EqualsOperator, []string{availabilityZone.String()}).
Add(fields.ClusterNameLabel, klabels.EqualsOperator, []string{clusterName.String()})
podClusters, err := s.applicator.GetMatches(sel, labels.PC)
if err != nil {
return nil, err
}
ret := make([]fields.PodCluster, len(podClusters))
for i, pc := range podClusters {
ret[i], err = s.Get(fields.ID(pc.ID))
if err != nil {
return nil, err
}
}
return ret, nil
}
开发者ID:drcapulet,项目名称:p2,代码行数:22,代码来源:consul_store.go
示例6: pcCreateLockPath
func pcCreateLockPath(podID types.PodID,
availabilityZone fields.AvailabilityZone,
clusterName fields.ClusterName) string {
return path.Join(consulutil.LOCK_TREE, podID.String(), availabilityZone.String(), clusterName.String())
}
开发者ID:drcapulet,项目名称:p2,代码行数:5,代码来源:consul_store.go
示例7: ReplicationLockPath
// Returns the consul path to use when locking out any other pkg/replication-based deploys
// for a given pod ID
func ReplicationLockPath(podId types.PodID) string {
return path.Join(consulutil.LOCK_TREE, "replication", podId.String())
}
开发者ID:petertseng,项目名称:p2,代码行数:5,代码来源:constants.go
示例8: selectorFrom
func selectorFrom(az fields.AvailabilityZone, cn fields.ClusterName, podID types.PodID) klabels.Selector {
return klabels.Everything().
Add(fields.PodIDLabel, klabels.EqualsOperator, []string{podID.String()}).
Add(fields.AvailabilityZoneLabel, klabels.EqualsOperator, []string{az.String()}).
Add(fields.ClusterNameLabel, klabels.EqualsOperator, []string{cn.String()})
}
开发者ID:petertseng,项目名称:p2,代码行数:6,代码来源:main.go
示例9: DeletePod
func (s *fakeKpStore) DeletePod(podPrefix kp.PodPrefix, nodeName types.NodeName, podID types.PodID) (time.Duration, error) {
key := path.Join(string(podPrefix), nodeName.String(), podID.String())
delete(s.manifests, key)
return 0, nil
}
开发者ID:drcapulet,项目名称:p2,代码行数:5,代码来源:replication_controller_test.go
示例10: NewHookPod
func (f *hookFactory) NewHookPod(id types.PodID) *Pod {
home := filepath.Join(f.hookRoot, id.String())
return newPodWithHome(id, home, f.node)
}
开发者ID:rudle,项目名称:p2,代码行数:5,代码来源:factory.go
示例11: MakePodLabelKey
// these utility functions are used primarily while we exist in a mutable
// deployment world. We will need to figure out how to replace these with
// different datasources to allow RCs and DSs to continue to function correctly
// in the future.
func MakePodLabelKey(node types.NodeName, podID types.PodID) string {
return node.String() + "/" + podID.String()
}
开发者ID:drcapulet,项目名称:p2,代码行数:7,代码来源:consul_applicator.go
示例12: NewLegacyPod
func (f *factory) NewLegacyPod(id types.PodID) *Pod {
home := filepath.Join(f.podRoot, id.String())
return newPodWithHome(id, "", home, f.node)
}
开发者ID:petertseng,项目名称:p2,代码行数:4,代码来源:factory.go
注:本文中的github.com/square/p2/pkg/types.PodID类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论