/usr/share/gocode/src/github.com/lxc/lxd/shared/container.go is in golang-github-lxc-lxd-dev 2.0.2-0ubuntu1~16.04.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | package shared
import (
"time"
)
type ContainerState struct {
Status string `json:"status"`
StatusCode StatusCode `json:"status_code"`
Disk map[string]ContainerStateDisk `json:"disk"`
Memory ContainerStateMemory `json:"memory"`
Network map[string]ContainerStateNetwork `json:"network"`
Pid int64 `json:"pid"`
Processes int64 `json:"processes"`
}
type ContainerStateDisk struct {
Usage int64 `json:"usage"`
}
type ContainerStateMemory struct {
Usage int64 `json:"usage"`
UsagePeak int64 `json:"usage_peak"`
SwapUsage int64 `json:"swap_usage"`
SwapUsagePeak int64 `json:"swap_usage_peak"`
}
type ContainerStateNetwork struct {
Addresses []ContainerStateNetworkAddress `json:"addresses"`
Counters ContainerStateNetworkCounters `json:"counters"`
Hwaddr string `json:"hwaddr"`
HostName string `json:"host_name"`
Mtu int `json:"mtu"`
State string `json:"state"`
Type string `json:"type"`
}
type ContainerStateNetworkAddress struct {
Family string `json:"family"`
Address string `json:"address"`
Netmask string `json:"netmask"`
Scope string `json:"scope"`
}
type ContainerStateNetworkCounters struct {
BytesReceived int64 `json:"bytes_received"`
BytesSent int64 `json:"bytes_sent"`
PacketsReceived int64 `json:"packets_received"`
PacketsSent int64 `json:"packets_sent"`
}
type ContainerExecControl struct {
Command string `json:"command"`
Args map[string]string `json:"args"`
}
type SnapshotInfo struct {
Architecture string `json:"architecture"`
Config map[string]string `json:"config"`
CreationDate time.Time `json:"created_at"`
Devices Devices `json:"devices"`
Ephemeral bool `json:"ephemeral"`
ExpandedConfig map[string]string `json:"expanded_config"`
ExpandedDevices Devices `json:"expanded_devices"`
Name string `json:"name"`
Profiles []string `json:"profiles"`
Stateful bool `json:"stateful"`
}
type ContainerInfo struct {
Architecture string `json:"architecture"`
Config map[string]string `json:"config"`
CreationDate time.Time `json:"created_at"`
Devices Devices `json:"devices"`
Ephemeral bool `json:"ephemeral"`
ExpandedConfig map[string]string `json:"expanded_config"`
ExpandedDevices Devices `json:"expanded_devices"`
Name string `json:"name"`
Profiles []string `json:"profiles"`
Stateful bool `json:"stateful"`
Status string `json:"status"`
StatusCode StatusCode `json:"status_code"`
}
func (c ContainerInfo) IsActive() bool {
switch c.StatusCode {
case Stopped:
return false
case Error:
return false
default:
return true
}
}
/*
* BriefContainerState contains a subset of the fields in
* ContainerState, namely those which a user may update
*/
type BriefContainerInfo struct {
Name string `json:"name"`
Profiles []string `json:"profiles"`
Config map[string]string `json:"config"`
Devices Devices `json:"devices"`
Ephemeral bool `json:"ephemeral"`
}
func (c *ContainerInfo) Brief() BriefContainerInfo {
retstate := BriefContainerInfo{Name: c.Name,
Profiles: c.Profiles,
Config: c.Config,
Devices: c.Devices,
Ephemeral: c.Ephemeral}
return retstate
}
func (c *ContainerInfo) BriefExpanded() BriefContainerInfo {
retstate := BriefContainerInfo{Name: c.Name,
Profiles: c.Profiles,
Config: c.ExpandedConfig,
Devices: c.ExpandedDevices,
Ephemeral: c.Ephemeral}
return retstate
}
type ContainerAction string
const (
Stop ContainerAction = "stop"
Start ContainerAction = "start"
Restart ContainerAction = "restart"
Freeze ContainerAction = "freeze"
Unfreeze ContainerAction = "unfreeze"
)
type ProfileConfig struct {
Name string `json:"name"`
Config map[string]string `json:"config"`
Description string `json:"description"`
Devices Devices `json:"devices"`
}
|