Correct godoc messages according to review comments

This commit is contained in:
Yuki Yugui Sonoda
2014-07-17 12:27:58 +09:00
parent df9da65939
commit 5e31ca3b27
3 changed files with 7 additions and 7 deletions

View File

@@ -22,10 +22,9 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
) )
// Status is a enum type which describes a health status of a container.
type Status int type Status int
// These are the valid values of type Status. // Status takes only one of values of these constants.
const ( const (
Healthy Status = iota Healthy Status = iota
Unhealthy Unhealthy
@@ -37,10 +36,10 @@ type HTTPGetInterface interface {
Get(url string) (*http.Response, error) Get(url string) (*http.Response, error)
} }
// Check checks if GET request to the url succeeds. // Check checks if a GET request to the url succeeds.
// If the HTTP response code is successful, it returns Healthy. // If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Healthy.
// If the HTTP response code is unsuccessful, it returns Unhealthy. // If the HTTP response code is unsuccessful, it returns Unhealthy.
// And it return Unknown and err if the HTTP communication itself fails. // It returns Unknown and err if the HTTP communication itself fails.
func Check(url string, client HTTPGetInterface) (Status, error) { func Check(url string, client HTTPGetInterface) (Status, error) {
res, err := client.Get(url) res, err := client.Get(url)
if res.Body != nil { if res.Body != nil {

View File

@@ -25,7 +25,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
) )
// HealthChecker hides implementation details of how to check if the container is healthy. // HealthChecker defines an abstract interface for checking container health.
type HealthChecker interface { type HealthChecker interface {
HealthCheck(container api.Container) (Status, error) HealthCheck(container api.Container) (Status, error)
} }
@@ -48,6 +48,7 @@ type MuxHealthChecker struct {
// HealthCheck delegates the health-checking of the container to one of the bundled implementations. // HealthCheck delegates the health-checking of the container to one of the bundled implementations.
// It chooses an implementation according to container.LivenessProbe.Type. // It chooses an implementation according to container.LivenessProbe.Type.
// If there is no matching healthc checker it returns Unknown, nil.
func (m *MuxHealthChecker) HealthCheck(container api.Container) (Status, error) { func (m *MuxHealthChecker) HealthCheck(container api.Container) (Status, error) {
checker, ok := m.checkers[container.LivenessProbe.Type] checker, ok := m.checkers[container.LivenessProbe.Type]
if !ok || checker == nil { if !ok || checker == nil {

View File

@@ -23,7 +23,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
) )
// fakeHTTPClient is a face implementation of HTTPGetInterface. // fakeHTTPClient is a fake implementation of HTTPGetInterface.
type fakeHTTPClient struct { type fakeHTTPClient struct {
req string req string
res http.Response res http.Response