Documentation
¶
Index ¶
- Variables
- type Action
- type Command
- type Daemon
- func (d *Daemon) CanStandby() bool
- func (d *Daemon) Dying() <-chan struct{}
- func (d *Daemon) HandleRestart(t restart.RestartType)
- func (d *Daemon) Init() error
- func (d *Daemon) Overlord() *overlord.Overlord
- func (d *Daemon) RebootIsFine(st *state.State) error
- func (d *Daemon) RebootIsMissing(st *state.State) error
- func (d *Daemon) SetDegradedMode(err error)
- func (d *Daemon) Start() error
- func (d *Daemon) Stop(sigCh chan<- os.Signal) error
- type Endpoint
- type HealthCheckInfo
- type Mount
- type Options
- type Response
- type ResponseFunc
- type ResponseType
- type SdkInfo
- type Tunnel
- type Workshop
- type WorkshopFileInfo
- type WorkshopInfo
- type Workshops
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Path string
PathPrefix string
//
GET ResponseFunc
PUT ResponseFunc
POST ResponseFunc
DELETE ResponseFunc
GuestOK bool
UserOK bool
UntrustedOK bool
AdminOnly bool
// contains filtered or unexported fields
}
A Command routes a request to an individual per-verb ResponseFunc
type Daemon ¶
A Daemon listens for requests and routes them to the right command
func (*Daemon) CanStandby ¶
func (*Daemon) HandleRestart ¶
func (d *Daemon) HandleRestart(t restart.RestartType)
HandleRestart implements overlord.RestartBehavior.
func (*Daemon) RebootIsFine ¶
RebootIsFine implements part of overlord.RestartBehavior.
func (*Daemon) RebootIsMissing ¶
RebootIsMissing implements part of overlord.RestartBehavior.
func (*Daemon) SetDegradedMode ¶
SetDegradedMode puts the daemon into a degraded mode which will the error given in the "err" argument for commands that are not marked as readonlyOK.
This is useful to report errors to the client when the daemon cannot work because e.g. a sanity check failed or the system is out of diskspace.
When the system is fine again calling "DegradedMode(nil)" is enough to put the daemon into full operation again.
type HealthCheckInfo ¶
type Options ¶
type Options struct {
// Dir is the workshop directory where all setup is found. Defaults to /var/lib/workshop.
Dir string
// SocketPath is an optional path for the unix socket used for the client
// to communicate with the daemon. Defaults to a hidden (dotted) name inside
// the workshop directory.
SocketPath string
// HTTPAddress is the address for the plain HTTP API server, for example
// ":4000" to listen on any address, port 4000. If not set, the HTTP API
// server is not started.
HTTPAddress string
}
Options holds the daemon setup required for the initialization of a new daemon.
type Response ¶
type Response interface {
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
Response knows how to serve itself, and how to find itself
func SyncResponse ¶
type ResponseFunc ¶
A ResponseFunc handles one of the individual verbs for a method
type ResponseType ¶
type ResponseType string
const ( ResponseTypeSync ResponseType = "sync" ResponseTypeAsync ResponseType = "async" ResponseTypeError ResponseType = "error" )
type SdkInfo ¶
type SdkInfo struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
Channel string `json:"channel,omitempty"`
Source string `json:"source,omitempty"`
Revision string `json:"revision"`
BuiltAt *time.Time `json:"built-at,omitempty"`
InstalledAt time.Time `json:"installed-at,omitzero"`
Health *HealthCheckInfo `json:"health-check,omitempty"`
Mounts []*Mount `json:"mounts,omitempty"`
Tunnels []*Tunnel `json:"tunnels,omitempty"`
}
type Workshop ¶
type Workshop struct {
WorkshopInfo
Path string `json:"path"`
}
type WorkshopFileInfo ¶
type WorkshopInfo ¶
type Workshops ¶
type Workshops struct {
Workshops []*WorkshopInfo `json:"workshops"`
Files []*WorkshopFileInfo `json:"files"`
}