From 188aec0e6d94e7d6c407cf00ec48da14b2bcfe0b Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 27 Mar 2015 23:45:11 +0100 Subject: [PATCH] Remove now-unused utility.Time type. --- utility/test/time.go | 42 ----------------------------------------- utility/time.go | 45 -------------------------------------------- 2 files changed, 87 deletions(-) delete mode 100644 utility/test/time.go delete mode 100644 utility/time.go diff --git a/utility/test/time.go b/utility/test/time.go deleted file mode 100644 index 54aaeb28f..000000000 --- a/utility/test/time.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package test - -import ( - "github.com/prometheus/prometheus/utility" - "time" -) - -type instantProvider struct { - index int - timeQueue []time.Time -} - -func (t *instantProvider) Now() (time time.Time) { - time = t.timeQueue[t.index] - - t.index++ - - return -} - -// NewInstantProvider furnishes an InstantProvider with prerecorded responses -// for calls made against it. It has no validation behaviors of its own and -// will panic if times are requested more than available pre-recorded behaviors. -func NewInstantProvider(times []time.Time) utility.InstantProvider { - return &instantProvider{ - index: 0, - timeQueue: times, - } -} diff --git a/utility/time.go b/utility/time.go deleted file mode 100644 index 3fbe54fd6..000000000 --- a/utility/time.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package utility - -import ( - "time" -) - -// InstantProvider is a basic interface only useful in testing contexts for -// dispensing the time in a controlled manner. -type InstantProvider interface { - // The current instant. - Now() time.Time -} - -// Time is a simple means for fluently wrapping around standard Go timekeeping -// mechanisms to enhance testability without compromising code readability. -// -// It is sufficient for use on bare initialization. A provider should be -// set only for test contexts. When not provided, it emits the current -// system time. -type Time struct { - // The underlying means through which time is provided, if supplied. - Provider InstantProvider -} - -// Now emits the current instant. -func (t Time) Now() time.Time { - if t.Provider == nil { - return time.Now() - } - - return t.Provider.Now() -}