You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2017/01/25 17:30:24 UTC

[13/20] incubator-trafficcontrol git commit: Remove TM2 unused funcs

Remove TM2 unused funcs


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4fec5996
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4fec5996
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4fec5996

Branch: refs/heads/master
Commit: 4fec5996b894040498cd4df1df091a7093cfd6a2
Parents: 1ffb301
Author: Robert Butts <ro...@gmail.com>
Authored: Mon Jan 23 15:22:15 2017 -0700
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Jan 25 10:29:46 2017 -0700

----------------------------------------------------------------------
 .../experimental/traffic_monitor/cache/data.go  |  8 ------
 .../traffic_monitor/health/cache_health.go      | 30 --------------------
 .../traffic_monitor/manager/datarequest.go      | 12 --------
 3 files changed, 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4fec5996/traffic_monitor/experimental/traffic_monitor/cache/data.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/cache/data.go b/traffic_monitor/experimental/traffic_monitor/cache/data.go
index bad75a0..81b938a 100644
--- a/traffic_monitor/experimental/traffic_monitor/cache/data.go
+++ b/traffic_monitor/experimental/traffic_monitor/cache/data.go
@@ -178,14 +178,6 @@ func ToInfo(r Result) ResultInfo {
 	}
 }
 
-func toInfos(rs []Result) []ResultInfo {
-	infos := make([]ResultInfo, len(rs), len(rs))
-	for i, r := range rs {
-		infos[i] = ToInfo(r)
-	}
-	return infos
-}
-
 func copyResultInfos(a []ResultInfo) []ResultInfo {
 	b := make([]ResultInfo, len(a), len(a))
 	copy(b, a)

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4fec5996/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/health/cache_health.go b/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
index 15d5b9a..0a00838 100644
--- a/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
+++ b/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
@@ -23,7 +23,6 @@ import (
 	"fmt"
 	"strconv"
 	"strings"
-	"time"
 
 	"github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/common/log"
 	"github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/traffic_monitor/cache"
@@ -95,35 +94,6 @@ func GetVitals(newResult *cache.Result, prevResult *cache.Result, mc *to.Traffic
 	// log.Infoln(newResult.Id, "BytesOut", newResult.Vitals.BytesOut, "BytesIn", newResult.Vitals.BytesIn, "Kbps", newResult.Vitals.KbpsOut, "max", newResult.Vitals.MaxKbpsOut)
 }
 
-// getKbpsThreshold returns the numeric kbps threshold, from the Traffic Ops string value. If there is a parse error, it logs a warning and returns the max floating point number, signifying no limit
-// TODO add float64 to Traffic Ops Client interface
-func getKbpsThreshold(threshStr string) (int64, bool) {
-	if len(threshStr) == 0 {
-		return 0, false
-	}
-	if threshStr[0] == '>' {
-		threshStr = threshStr[1:]
-	}
-	thresh, err := strconv.ParseInt(threshStr, 10, 64)
-	if err != nil {
-		return 0, false
-	}
-	return thresh, true
-}
-
-// TODO add time.Duration to Traffic Ops Client interface
-func getQueryThreshold(threshInt int64) (time.Duration, bool) {
-	if threshInt == 0 {
-		return 0, false
-	}
-	return time.Duration(threshInt) * time.Millisecond, true
-}
-
-func cacheCapacityKbps(result cache.Result) int64 {
-	kbpsInMbps := int64(1000)
-	return int64(result.Astats.System.InfSpeed) * kbpsInMbps
-}
-
 // EvalCache returns whether the given cache should be marked available, a string describing why, and which stat exceeded a threshold. The `stats` may be nil, for pollers which don't poll stats.
 // The availability of EvalCache MAY NOT be used to directly set the cache's local availability, because the threshold stats may not be part of the poller which produced the result. Rather, if the cache was previously unavailable from a threshold, it must be verified that threshold stat is in the results before setting the cache to available.
 // TODO change to return a `cache.AvailableStatus`

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4fec5996/traffic_monitor/experimental/traffic_monitor/manager/datarequest.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/manager/datarequest.go b/traffic_monitor/experimental/traffic_monitor/manager/datarequest.go
index 3cc4c4a..30fcc47 100644
--- a/traffic_monitor/experimental/traffic_monitor/manager/datarequest.go
+++ b/traffic_monitor/experimental/traffic_monitor/manager/datarequest.go
@@ -557,18 +557,6 @@ func srvTRConfig(opsConfig OpsConfigThreadsafe, toSession towrap.ITrafficOpsSess
 	return toSession.CRConfigRaw(cdnName)
 }
 
-func makeWrapAll(errorCount threadsafe.Uint, unpolledCaches threadsafe.UnpolledCaches) func(http.HandlerFunc) http.HandlerFunc {
-	return func(f http.HandlerFunc) http.HandlerFunc {
-		return wrapUnpolledCheck(unpolledCaches, errorCount, f)
-	}
-}
-
-func makeCrConfigHandler(wrapper func(http.HandlerFunc) http.HandlerFunc, errorCount threadsafe.Uint, opsConfig OpsConfigThreadsafe, toSession towrap.ITrafficOpsSession) http.HandlerFunc {
-	return wrapper(WrapErr(errorCount, func() ([]byte, error) {
-		return srvTRConfig(opsConfig, toSession)
-	}, ContentTypeJSON))
-}
-
 func srvTRState(params url.Values, localStates peer.CRStatesThreadsafe, combinedStates peer.CRStatesThreadsafe) ([]byte, error) {
 	if _, raw := params["raw"]; raw {
 		return srvTRStateSelf(localStates)