github.com/midokura/kubeedge@v1.2.0-mido.0/tests/stubs/common/types/types.go (about) 1 /* 2 Copyright 2019 The KubeEdge Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package types 18 19 import "time" 20 21 // FakePod 22 type FakePod struct { 23 Namespace string `json:"namespace,omitempty"` 24 Name string `json:"name,omitempty"` 25 NodeName string `json:"nodename,omitempty"` 26 Status string `json:"status,omitempty"` 27 CreateTime int64 `json:"createtime,omitempty"` 28 RunningTime int64 `json:"runningtime,omitempty"` 29 } 30 31 // FakePodSort 32 type FakePodSort []FakePod 33 34 func (s FakePodSort) Len() int { 35 return len(s) 36 } 37 38 func (s FakePodSort) Swap(i, j int) { 39 s[i], s[j] = s[j], s[i] 40 } 41 42 func (s FakePodSort) Less(i, j int) bool { 43 return s[i].RunningTime-s[i].CreateTime < s[j].RunningTime-s[j].CreateTime 44 } 45 46 // Latency 47 type Latency struct { 48 Percent50 time.Duration `json:"percent50,omitempty"` 49 Percent90 time.Duration `json:"percent90,omitempty"` 50 Percent99 time.Duration `json:"percent99,omitempty"` 51 Percent100 time.Duration `json:"percent100,omitempty"` 52 }