1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 // State indicates whether a worker is available to do work, and (if
12 // not) whether/when it is expected to become ready.
16 StateUnknown State = iota // might be running a container already
17 StateBooting // instance is booting
18 StateRunning // instance is running
19 StateShutdown // worker has stopped monitoring the instance
20 StateHold // running, but not available to run new containers
25 maxPingFailTime = 10 * time.Minute
28 var stateString = map[State]string{
29 StateUnknown: "unknown",
30 StateBooting: "booting",
31 StateRunning: "running",
32 StateShutdown: "shutdown",
36 // String implements fmt.Stringer.
37 func (s State) String() string {
41 // MarshalText implements encoding.TextMarshaler so a JSON encoding of
42 // map[State]anything uses the state's string representation.
43 func (s State) MarshalText() ([]byte, error) {
44 return []byte(stateString[s]), nil