private/version/checker: remove code which was moved to

`storj/private/debug` package

Change-Id: I44dfecd6ab875fb33851a22cf10b3064da9bfd65
This commit is contained in:
Michal Niewrzal 2020-03-24 17:51:30 +01:00 committed by Egon Elbre
parent bd9a998abd
commit 2a482e8bc4

View File

@ -6,7 +6,6 @@ package checker
import (
"context"
"fmt"
"net/http"
"sync"
"time"
@ -141,33 +140,6 @@ func (service *Service) Checked() bool {
return service.checked.Released()
}
// DebugHandler implements version info endpoint.
type DebugHandler struct {
log *zap.Logger
}
// NewDebugHandler returns new debug handler.
func NewDebugHandler(log *zap.Logger) *DebugHandler {
return &DebugHandler{log}
}
// ServeHTTP returns a json representation of the current version information for the binary.
func (server *DebugHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
j, err := version.Build.Marshal()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, err = w.Write(append(j, '\n'))
if err != nil {
server.log.Sugar().Errorf("error writing data to client: %w", err)
}
}
// isAcceptedVersion compares and checks if the passed version is greater/equal than the minimum required version
func isAcceptedVersion(test version.SemVer, target version.OldSemVer) bool {
return test.Major > uint64(target.Major) || (test.Major == uint64(target.Major) && (test.Minor > uint64(target.Minor) || (test.Minor == uint64(target.Minor) && test.Patch >= uint64(target.Patch))))