func (s stateNone) String() string {
	return "none"
}
String() implements fmt.Stringer.String().
package checkpoint
import (
	"fmt"
	"time"
	"github.com/golang/glog"
)
type apiCondition struct {
	apiAvailable bool
	apiParent bool
	localRunning bool
	localParent bool
}
func (a apiCondition) String() string {
	return fmt.Sprintf("apiAvailable=%t, apiParent=%t, localRunning=%t, localParent=%t", a.apiAvailable, a.apiParent, a.localRunning, a.localParent)
}
type action int
const (
	none = iota
	start
	stop
	remove
)
func (a action) String() string {
	switch a {
	case none:
		return "none"
	case start:
		return "start"
	case stop:
		return "stop"
	case remove:
		return "remove"
	default:
		return "[unknown action]"
	}
}
type checkpointState interface {
	transition(time.Time, apiCondition) checkpointState
	action() action
}
type stateSelfCheckpointActive struct{}
func (s stateSelfCheckpointActive) transition(now time.Time, apis apiCondition) checkpointState {
	if !apis.apiAvailable {
		return s
	}
	if apis.apiParent {
		return s
	}
	return stateActiveGracePeriod{gracePeriodEnd: now.Add(checkpointGracePeriod)}.checkGracePeriod(now, apis)
}
func (s stateSelfCheckpointActive) action() action {
	return start
}
func (s stateSelfCheckpointActive) String() string {
	return "self-checkpoint"
}
type stateNone struct{}
func (s stateNone) transition(now time.Time, apis apiCondition) checkpointState {
	if apis.localRunning || apis.localParent {
		return stateInactive{}.transition(now, apis)
	}
	return s
}
func (s stateNone) action() action {
	return none
}