/usr/share/gocode/src/gopkg.in/lxc/go-lxc.v2/type.go is in golang-gopkg-lxc-go-lxc.v2-dev 0.0~git20160405.0.85d46fc-0ubuntu2.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | // Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved.
// Use of this source code is governed by a LGPLv2.1
// license that can be found in the LICENSE file.
// +build linux,cgo
package lxc
// #include <lxc/lxccontainer.h>
import "C"
import "fmt"
// Verbosity type
type Verbosity int
const (
// Quiet makes some API calls not to write anything to stdout
Quiet Verbosity = 1 << iota
// Verbose makes some API calls write to stdout
Verbose
)
// BackendStore type specifies possible backend types.
type BackendStore int
const (
// Btrfs backendstore type
Btrfs BackendStore = iota + 1
// Directory backendstore type
Directory
// LVM backendstore type
LVM
// ZFS backendstore type
ZFS
// Aufs backendstore type
Aufs
// Overlayfs backendstore type
Overlayfs
// Loopback backendstore type
Loopback
// Best backendstore type
Best
)
// BackendStore as string
func (t BackendStore) String() string {
switch t {
case Directory:
return "dir"
case ZFS:
return "zfs"
case Btrfs:
return "btrfs"
case LVM:
return "lvm"
case Aufs:
return "aufs"
case Overlayfs:
return "overlayfs"
case Loopback:
return "loopback"
case Best:
return "best"
}
return ""
}
var backendStoreMap = map[string]BackendStore{
"dir": Directory,
"zfs": ZFS,
"btrfs": Btrfs,
"lvm": LVM,
"aufs": Aufs,
"overlayfs": Overlayfs,
"loopback": Loopback,
"best": Best,
}
// Set is the method to set the flag value, part of the flag.Value interface.
func (t *BackendStore) Set(value string) error {
backend, ok := backendStoreMap[value]
if ok {
*t = backend
return nil
}
return ErrUnknownBackendStore
}
// State type specifies possible container states.
type State int
const (
// STOPPED means container is not running
STOPPED State = iota + 1
// STARTING means container is starting
STARTING
// RUNNING means container is running
RUNNING
// STOPPING means container is stopping
STOPPING
// ABORTING means container is aborting
ABORTING
// FREEZING means container is freezing
FREEZING
// FROZEN means containe is frozen
FROZEN
// THAWED means container is thawed
THAWED
)
// StateMap provides the mapping betweens the state names and states
var StateMap = map[string]State{
"STOPPED": STOPPED,
"STARTING": STARTING,
"RUNNING": RUNNING,
"STOPPING": STOPPING,
"ABORTING": ABORTING,
"FREEZING": FREEZING,
"FROZEN": FROZEN,
"THAWED": THAWED,
}
// State as string
func (t State) String() string {
switch t {
case STOPPED:
return "STOPPED"
case STARTING:
return "STARTING"
case RUNNING:
return "RUNNING"
case STOPPING:
return "STOPPING"
case ABORTING:
return "ABORTING"
case FREEZING:
return "FREEZING"
case FROZEN:
return "FROZEN"
case THAWED:
return "THAWED"
}
return ""
}
// Taken from http://golang.org/doc/effective_go.html#constants
// ByteSize type
type ByteSize float64
const (
_ = iota
// KB - kilobyte
KB ByteSize = 1 << (10 * iota)
// MB - megabyte
MB
// GB - gigabyte
GB
// TB - terabyte
TB
// PB - petabyte
PB
// EB - exabyte
EB
// ZB - zettabyte
ZB
// YB - yottabyte
YB
)
func (b ByteSize) String() string {
switch {
case b >= YB:
return fmt.Sprintf("%.2fYB", b/YB)
case b >= ZB:
return fmt.Sprintf("%.2fZB", b/ZB)
case b >= EB:
return fmt.Sprintf("%.2fEB", b/EB)
case b >= PB:
return fmt.Sprintf("%.2fPB", b/PB)
case b >= TB:
return fmt.Sprintf("%.2fTB", b/TB)
case b >= GB:
return fmt.Sprintf("%.2fGB", b/GB)
case b >= MB:
return fmt.Sprintf("%.2fMB", b/MB)
case b >= KB:
return fmt.Sprintf("%.2fKB", b/KB)
}
return fmt.Sprintf("%.2fB", b)
}
// LogLevel type specifies possible log levels.
type LogLevel int
const (
// TRACE priority
TRACE LogLevel = iota
// DEBUG priority
DEBUG
// INFO priority
INFO
// NOTICE priority
NOTICE
// WARN priority
WARN
// ERROR priority
ERROR
// CRIT priority
CRIT
// ALERT priority
ALERT
// FATAL priority
FATAL
)
var logLevelMap = map[string]LogLevel{
"TRACE": TRACE,
"DEBUG": DEBUG,
"INFO": INFO,
"NOTICE": NOTICE,
"WARN": WARN,
"ERROR": ERROR,
"CRIT": CRIT,
"ALERT": ALERT,
"FATAL": FATAL,
}
func (l LogLevel) String() string {
switch l {
case TRACE:
return "TRACE"
case DEBUG:
return "DEBUG"
case INFO:
return "INFO"
case NOTICE:
return "NOTICE"
case WARN:
return "WARN"
case ERROR:
return "ERROR"
case CRIT:
return "CRIT"
case ALERT:
return "ALERT"
case FATAL:
return "FATAL"
}
return "NOTSET"
}
// Personality allows to set the architecture for the container.
type Personality int64
const (
X86 Personality = 0x0008
X86_64 = 0x0000
)
const (
MIGRATE_PRE_DUMP = 0
MIGRATE_DUMP = 1
MIGRATE_RESTORE = 2
)
|