id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
139,800
control-center/serviced
volume/btrfs/btrfs.go
SnapshotInfo
func (v *BtrfsVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) { if v.isInvalidSnapshot(label) { return nil, volume.ErrInvalidSnapshot } reader, err := v.ReadMetadata(label, ".SNAPSHOTINFO") if err != nil { glog.Errorf("Could not get info for snapshot %s: %s", label, err) return nil, err } ...
go
func (v *BtrfsVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) { if v.isInvalidSnapshot(label) { return nil, volume.ErrInvalidSnapshot } reader, err := v.ReadMetadata(label, ".SNAPSHOTINFO") if err != nil { glog.Errorf("Could not get info for snapshot %s: %s", label, err) return nil, err } ...
[ "func", "(", "v", "*", "BtrfsVolume", ")", "SnapshotInfo", "(", "label", "string", ")", "(", "*", "volume", ".", "SnapshotInfo", ",", "error", ")", "{", "if", "v", ".", "isInvalidSnapshot", "(", "label", ")", "{", "return", "nil", ",", "volume", ".", ...
// SnapshotInfo returns the meta info for a snapshot
[ "SnapshotInfo", "returns", "the", "meta", "info", "for", "a", "snapshot" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/btrfs/btrfs.go#L369-L387
139,801
control-center/serviced
volume/btrfs/btrfs.go
getEnvMinDuration
func getEnvMinDuration(envvar string, def, min int32) time.Duration { duration := def envval := os.Getenv(envvar) if len(strings.TrimSpace(envval)) == 0 { // ignore unset envvar } else if intVal, intErr := strconv.ParseInt(envval, 0, 32); intErr != nil { glog.Warningf("ignoring invalid %s of '%s': %s", envvar, ...
go
func getEnvMinDuration(envvar string, def, min int32) time.Duration { duration := def envval := os.Getenv(envvar) if len(strings.TrimSpace(envval)) == 0 { // ignore unset envvar } else if intVal, intErr := strconv.ParseInt(envval, 0, 32); intErr != nil { glog.Warningf("ignoring invalid %s of '%s': %s", envvar, ...
[ "func", "getEnvMinDuration", "(", "envvar", "string", ",", "def", ",", "min", "int32", ")", "time", ".", "Duration", "{", "duration", ":=", "def", "\n", "envval", ":=", "os", ".", "Getenv", "(", "envvar", ")", "\n", "if", "len", "(", "strings", ".", ...
// getEnvMinDuration returns the time.Duration env var meeting minimum and default duration
[ "getEnvMinDuration", "returns", "the", "time", ".", "Duration", "env", "var", "meeting", "minimum", "and", "default", "duration" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/btrfs/btrfs.go#L519-L534
139,802
control-center/serviced
volume/btrfs/btrfs.go
snapshotExists
func (v *BtrfsVolume) snapshotExists(label string) (exists bool, err error) { rlabel := v.rawSnapshotLabel(label) plabel := v.prettySnapshotLabel(label) if snapshots, err := v.Snapshots(); err != nil { glog.Errorf("Could not get current snapshot list: %v", err) return false, ErrBtrfsListingSnapshots } else { ...
go
func (v *BtrfsVolume) snapshotExists(label string) (exists bool, err error) { rlabel := v.rawSnapshotLabel(label) plabel := v.prettySnapshotLabel(label) if snapshots, err := v.Snapshots(); err != nil { glog.Errorf("Could not get current snapshot list: %v", err) return false, ErrBtrfsListingSnapshots } else { ...
[ "func", "(", "v", "*", "BtrfsVolume", ")", "snapshotExists", "(", "label", "string", ")", "(", "exists", "bool", ",", "err", "error", ")", "{", "rlabel", ":=", "v", ".", "rawSnapshotLabel", "(", "label", ")", "\n", "plabel", ":=", "v", ".", "prettySnap...
// snapshotExists queries the snapshot existence for the given label
[ "snapshotExists", "queries", "the", "snapshot", "existence", "for", "the", "given", "label" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/btrfs/btrfs.go#L643-L657
139,803
control-center/serviced
volume/btrfs/btrfs.go
runBtrfsSend
func runBtrfsSend(writer io.Writer, sudoer bool, parentpath, path string) error { cmdArgs := []string{"btrfs", "send", path} if parentpath = strings.TrimSpace(parentpath); parentpath != "" { cmdArgs = append(cmdArgs, "-p", parentpath) } if sudoer { cmdArgs = append([]string{"sudo", "-n"}, cmdArgs...) } cmd :=...
go
func runBtrfsSend(writer io.Writer, sudoer bool, parentpath, path string) error { cmdArgs := []string{"btrfs", "send", path} if parentpath = strings.TrimSpace(parentpath); parentpath != "" { cmdArgs = append(cmdArgs, "-p", parentpath) } if sudoer { cmdArgs = append([]string{"sudo", "-n"}, cmdArgs...) } cmd :=...
[ "func", "runBtrfsSend", "(", "writer", "io", ".", "Writer", ",", "sudoer", "bool", ",", "parentpath", ",", "path", "string", ")", "error", "{", "cmdArgs", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "path", "}", "\n", "if", "pa...
// runBtrfsSend writes a btrfs snapshot to a write handle
[ "runBtrfsSend", "writes", "a", "btrfs", "snapshot", "to", "a", "write", "handle" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/btrfs/btrfs.go#L660-L676
139,804
control-center/serviced
volume/btrfs/btrfs.go
runBtrfsRecv
func runBtrfsRecv(reader io.Reader, sudoer bool, path string) error { cmdArgs := []string{"btrfs", "receive", path} if sudoer { cmdArgs = append([]string{"sudo", "-n"}, cmdArgs...) } cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) cmd.Stdin = reader cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd....
go
func runBtrfsRecv(reader io.Reader, sudoer bool, path string) error { cmdArgs := []string{"btrfs", "receive", path} if sudoer { cmdArgs = append([]string{"sudo", "-n"}, cmdArgs...) } cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) cmd.Stdin = reader cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd....
[ "func", "runBtrfsRecv", "(", "reader", "io", ".", "Reader", ",", "sudoer", "bool", ",", "path", "string", ")", "error", "{", "cmdArgs", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "path", "}", "\n", "if", "sudoer", "{", "cmdArg...
// runBtrfsRecv reads a btrfs snapshot to a read handle
[ "runBtrfsRecv", "reads", "a", "btrfs", "snapshot", "to", "a", "read", "handle" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/btrfs/btrfs.go#L679-L693
139,805
control-center/serviced
facade/serviceregistry_cache.go
BuildCache
func (sc *serviceRegistryCache) BuildCache(publicPorts map[zkr.PublicPortKey]zkr.PublicPort, vhosts map[zkr.VHostKey]zkr.VHost) { sc.registry = make(map[string]*serviceRegistry, 0) for key, value := range publicPorts { serviceRegistry := sc.GetRegistryForService(value.ServiceID) serviceRegistry.PublicPorts[key] =...
go
func (sc *serviceRegistryCache) BuildCache(publicPorts map[zkr.PublicPortKey]zkr.PublicPort, vhosts map[zkr.VHostKey]zkr.VHost) { sc.registry = make(map[string]*serviceRegistry, 0) for key, value := range publicPorts { serviceRegistry := sc.GetRegistryForService(value.ServiceID) serviceRegistry.PublicPorts[key] =...
[ "func", "(", "sc", "*", "serviceRegistryCache", ")", "BuildCache", "(", "publicPorts", "map", "[", "zkr", ".", "PublicPortKey", "]", "zkr", ".", "PublicPort", ",", "vhosts", "map", "[", "zkr", ".", "VHostKey", "]", "zkr", ".", "VHost", ")", "{", "sc", ...
// BuildCache creates a new service registry cache from the specified data
[ "BuildCache", "creates", "a", "new", "service", "registry", "cache", "from", "the", "specified", "data" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/serviceregistry_cache.go#L58-L69
139,806
control-center/serviced
facade/serviceregistry_cache.go
GetRegistryForService
func (sc *serviceRegistryCache) GetRegistryForService(serviceID string) *serviceRegistry { registry, ok := sc.registry[serviceID] if !ok { registry = &serviceRegistry{ ServiceID: serviceID, PublicPorts: make(map[zkr.PublicPortKey]zkr.PublicPort, 0), VHosts: make(map[zkr.VHostKey]zkr.VHost, 0), } ...
go
func (sc *serviceRegistryCache) GetRegistryForService(serviceID string) *serviceRegistry { registry, ok := sc.registry[serviceID] if !ok { registry = &serviceRegistry{ ServiceID: serviceID, PublicPorts: make(map[zkr.PublicPortKey]zkr.PublicPort, 0), VHosts: make(map[zkr.VHostKey]zkr.VHost, 0), } ...
[ "func", "(", "sc", "*", "serviceRegistryCache", ")", "GetRegistryForService", "(", "serviceID", "string", ")", "*", "serviceRegistry", "{", "registry", ",", "ok", ":=", "sc", ".", "registry", "[", "serviceID", "]", "\n", "if", "!", "ok", "{", "registry", "...
// getRegistryForService returns the registry entry for the spcified service. If the service is not already in the // cache, then an empty entry is added to the cache and returned
[ "getRegistryForService", "returns", "the", "registry", "entry", "for", "the", "spcified", "service", ".", "If", "the", "service", "is", "not", "already", "in", "the", "cache", "then", "an", "empty", "entry", "is", "added", "to", "the", "cache", "and", "retur...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/serviceregistry_cache.go#L141-L152
139,807
control-center/serviced
commons/queue/queue.go
NewChannelQueue
func NewChannelQueue(capacity int) (Queue, error) { cap := int32(capacity) if capacity <= 0 { return nil, fmt.Errorf("Invalid size for queue: %d", capacity) } qChan := make(chan interface{}, cap) return &chanQueue{capacity: cap, qChan: qChan}, nil }
go
func NewChannelQueue(capacity int) (Queue, error) { cap := int32(capacity) if capacity <= 0 { return nil, fmt.Errorf("Invalid size for queue: %d", capacity) } qChan := make(chan interface{}, cap) return &chanQueue{capacity: cap, qChan: qChan}, nil }
[ "func", "NewChannelQueue", "(", "capacity", "int", ")", "(", "Queue", ",", "error", ")", "{", "cap", ":=", "int32", "(", "capacity", ")", "\n", "if", "capacity", "<=", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cap...
// NewChannelQueue creates a queue with a given capacity. If capacity <=0, error is returned
[ "NewChannelQueue", "creates", "a", "queue", "with", "a", "given", "capacity", ".", "If", "capacity", "<", "=", "0", "error", "is", "returned" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/queue/queue.go#L49-L57
139,808
control-center/serviced
zzk/service/hostiplistener.go
NewHostIPListener
func NewHostIPListener(hostid string, handler HostIPHandler, binds []string) *HostIPListener { passive := make(map[string]struct{}) for _, ip := range binds { req := IPRequest{HostID: hostid, IPAddress: ip} passive[req.IPID()] = struct{}{} } return &HostIPListener{ hostid: hostid, handler: handler, acti...
go
func NewHostIPListener(hostid string, handler HostIPHandler, binds []string) *HostIPListener { passive := make(map[string]struct{}) for _, ip := range binds { req := IPRequest{HostID: hostid, IPAddress: ip} passive[req.IPID()] = struct{}{} } return &HostIPListener{ hostid: hostid, handler: handler, acti...
[ "func", "NewHostIPListener", "(", "hostid", "string", ",", "handler", "HostIPHandler", ",", "binds", "[", "]", "string", ")", "*", "HostIPListener", "{", "passive", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "for", "_", ...
// NewHostIPListener instantiates a new host ip listener.
[ "NewHostIPListener", "instantiates", "a", "new", "host", "ip", "listener", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostiplistener.go#L48-L62
139,809
control-center/serviced
zzk/service/hostiplistener.go
Listen
func (l *HostIPListener) Listen(cancel <-chan interface{}, conn client.Connection) { zzk.Listen2(cancel, conn, l) }
go
func (l *HostIPListener) Listen(cancel <-chan interface{}, conn client.Connection) { zzk.Listen2(cancel, conn, l) }
[ "func", "(", "l", "*", "HostIPListener", ")", "Listen", "(", "cancel", "<-", "chan", "interface", "{", "}", ",", "conn", "client", ".", "Connection", ")", "{", "zzk", ".", "Listen2", "(", "cancel", ",", "conn", ",", "l", ")", "\n", "}" ]
// Listen implements zzk.Listener2. It starts the listener for the host ip // nodes.
[ "Listen", "implements", "zzk", ".", "Listener2", ".", "It", "starts", "the", "listener", "for", "the", "host", "ip", "nodes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostiplistener.go#L66-L68
139,810
control-center/serviced
zzk/service/hostiplistener.go
Post
func (l *HostIPListener) Post(p map[string]struct{}) { l.mu.Lock() defer l.mu.Unlock() for id := range l.passive { if _, ok := p[id]; !ok { delete(l.passive, id) _, ipaddr, _ := ParseIPID(id) req := IPRequest{HostID: l.hostid, IPAddress: ipaddr} l.release(req) } } }
go
func (l *HostIPListener) Post(p map[string]struct{}) { l.mu.Lock() defer l.mu.Unlock() for id := range l.passive { if _, ok := p[id]; !ok { delete(l.passive, id) _, ipaddr, _ := ParseIPID(id) req := IPRequest{HostID: l.hostid, IPAddress: ipaddr} l.release(req) } } }
[ "func", "(", "l", "*", "HostIPListener", ")", "Post", "(", "p", "map", "[", "string", "]", "struct", "{", "}", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "for", "id", ":=", ...
// Post synchronizes the passive thread list by unbinding all inactive and // orphaned ips.
[ "Post", "synchronizes", "the", "passive", "thread", "list", "by", "unbinding", "all", "inactive", "and", "orphaned", "ips", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostiplistener.go#L98-L109
139,811
control-center/serviced
zzk/service/hostiplistener.go
loadThread
func (l *HostIPListener) loadThread(req IPRequest) bool { l.mu.Lock() defer l.mu.Unlock() var ( id = req.IPID() pth = path.Join("/ips", id) ) logger := plog.WithFields(logrus.Fields{ "ipid": id, "poolippath": pth, }) // load from cache _, ipok := l.passive[req.IPAddress] // make sure the nod...
go
func (l *HostIPListener) loadThread(req IPRequest) bool { l.mu.Lock() defer l.mu.Unlock() var ( id = req.IPID() pth = path.Join("/ips", id) ) logger := plog.WithFields(logrus.Fields{ "ipid": id, "poolippath": pth, }) // load from cache _, ipok := l.passive[req.IPAddress] // make sure the nod...
[ "func", "(", "l", "*", "HostIPListener", ")", "loadThread", "(", "req", "IPRequest", ")", "bool", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "(", "id", "=", "req", ".", "IP...
// loadThread loads the thread from the passive map
[ "loadThread", "loads", "the", "thread", "from", "the", "passive", "map" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostiplistener.go#L213-L247
139,812
control-center/serviced
zzk/service/hostiplistener.go
saveThread
func (l *HostIPListener) saveThread(id string) { l.mu.Lock() defer l.mu.Unlock() l.passive[id] = struct{}{} }
go
func (l *HostIPListener) saveThread(id string) { l.mu.Lock() defer l.mu.Unlock() l.passive[id] = struct{}{} }
[ "func", "(", "l", "*", "HostIPListener", ")", "saveThread", "(", "id", "string", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "l", ".", "passive", "[", "id", "]", "=", "struct", ...
// saveThread saves the thread to the passive map
[ "saveThread", "saves", "the", "thread", "to", "the", "passive", "map" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostiplistener.go#L250-L254
139,813
control-center/serviced
zzk/service/hostiplistener.go
release
func (l *HostIPListener) release(req IPRequest) { logger := plog.WithField("ipaddress", req.IPAddress) logger.Info("Releasing ip binding") if err := l.handler.ReleaseIP(req.IPAddress); err != nil { logger.WithError(err).Error("Could not release ip binding") } if err := DeleteIP(l.conn, req); err != nil { logg...
go
func (l *HostIPListener) release(req IPRequest) { logger := plog.WithField("ipaddress", req.IPAddress) logger.Info("Releasing ip binding") if err := l.handler.ReleaseIP(req.IPAddress); err != nil { logger.WithError(err).Error("Could not release ip binding") } if err := DeleteIP(l.conn, req); err != nil { logg...
[ "func", "(", "l", "*", "HostIPListener", ")", "release", "(", "req", "IPRequest", ")", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ",", "req", ".", "IPAddress", ")", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "if",...
// release drops the virtual ip and cleans up the zookeeper node
[ "release", "drops", "the", "virtual", "ip", "and", "cleans", "up", "the", "zookeeper", "node" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostiplistener.go#L257-L267
139,814
control-center/serviced
coordinator/client/retry/until_elapsed.go
UntilElapsed
func UntilElapsed(maxElapsed, sleepBetweenRetries time.Duration) Policy { return untilElapsed{ maxElapsed: maxElapsed, sleepBetweenRetries: sleepBetweenRetries, } }
go
func UntilElapsed(maxElapsed, sleepBetweenRetries time.Duration) Policy { return untilElapsed{ maxElapsed: maxElapsed, sleepBetweenRetries: sleepBetweenRetries, } }
[ "func", "UntilElapsed", "(", "maxElapsed", ",", "sleepBetweenRetries", "time", ".", "Duration", ")", "Policy", "{", "return", "untilElapsed", "{", "maxElapsed", ":", "maxElapsed", ",", "sleepBetweenRetries", ":", "sleepBetweenRetries", ",", "}", "\n", "}" ]
// UntilElapsed returns a policy that retries until a given amount of time elapses
[ "UntilElapsed", "returns", "a", "policy", "that", "retries", "until", "a", "given", "amount", "of", "time", "elapses" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/retry/until_elapsed.go#L26-L31
139,815
control-center/serviced
cli/api/backup.go
Backup
func (a *api) Backup(dirpath string, excludes []string, force bool) (string, error) { client, err := a.connectDAO() if err != nil { return "", err } var path string req := dao.BackupRequest{ Dirpath: dirpath, SnapshotSpacePercent: config.GetOptions().SnapshotSpacePercent, Excludes: ...
go
func (a *api) Backup(dirpath string, excludes []string, force bool) (string, error) { client, err := a.connectDAO() if err != nil { return "", err } var path string req := dao.BackupRequest{ Dirpath: dirpath, SnapshotSpacePercent: config.GetOptions().SnapshotSpacePercent, Excludes: ...
[ "func", "(", "a", "*", "api", ")", "Backup", "(", "dirpath", "string", ",", "excludes", "[", "]", "string", ",", "force", "bool", ")", "(", "string", ",", "error", ")", "{", "client", ",", "err", ":=", "a", ".", "connectDAO", "(", ")", "\n", "if"...
// Dump all templates and services to a tgz file. // This includes a snapshot of all shared file systems // and exports all docker images the services depend on.
[ "Dump", "all", "templates", "and", "services", "to", "a", "tgz", "file", ".", "This", "includes", "a", "snapshot", "of", "all", "shared", "file", "systems", "and", "exports", "all", "docker", "images", "the", "services", "depend", "on", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/backup.go#L28-L50
139,816
control-center/serviced
cli/api/backup.go
Restore
func (a *api) Restore(path string) error { client, err := a.connectDAO() if err != nil { return err } fp, err := filepath.Abs(path) if err != nil { return fmt.Errorf("could not convert '%s' to an absolute file path: %v", path, err) } return client.Restore(dao.RestoreRequest{Filename: filepath.Clean(fp)}, &...
go
func (a *api) Restore(path string) error { client, err := a.connectDAO() if err != nil { return err } fp, err := filepath.Abs(path) if err != nil { return fmt.Errorf("could not convert '%s' to an absolute file path: %v", path, err) } return client.Restore(dao.RestoreRequest{Filename: filepath.Clean(fp)}, &...
[ "func", "(", "a", "*", "api", ")", "Restore", "(", "path", "string", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectDAO", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fp", ",", "err", ":=...
// Restores templates, services, snapshots, and docker images from a tgz file. // This is the inverse of CmdBackup.
[ "Restores", "templates", "services", "snapshots", "and", "docker", "images", "from", "a", "tgz", "file", ".", "This", "is", "the", "inverse", "of", "CmdBackup", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/backup.go#L54-L66
139,817
control-center/serviced
commons/docker/kernel.go
StartKernel
func StartKernel() { client, err := getDockerClient() if err != nil { panic(fmt.Sprintf("can't create Docker client: %v", err)) } go kernel(client, done) }
go
func StartKernel() { client, err := getDockerClient() if err != nil { panic(fmt.Sprintf("can't create Docker client: %v", err)) } go kernel(client, done) }
[ "func", "StartKernel", "(", ")", "{", "client", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n", "go", "kernel", "(", ...
// StartKernel starts up the kernel loop that is responsible for handling all the API calls // in a goroutine.
[ "StartKernel", "starts", "up", "the", "kernel", "loop", "that", "is", "responsible", "for", "handling", "all", "the", "API", "calls", "in", "a", "goroutine", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/kernel.go#L101-L107
139,818
control-center/serviced
commons/docker/kernel.go
kernel
func kernel(dc ClientInterface, done <-chan struct{}) error { routeEventsToKernel(dc) eventactions := mkEventActionTable() for { select { case req := <-cmds.AddAction: event := req.args.event if _, ok := eventactions[event]; !ok { req.errchan <- fmt.Errorf("docker: unknown event type: %s", event) ...
go
func kernel(dc ClientInterface, done <-chan struct{}) error { routeEventsToKernel(dc) eventactions := mkEventActionTable() for { select { case req := <-cmds.AddAction: event := req.args.event if _, ok := eventactions[event]; !ok { req.errchan <- fmt.Errorf("docker: unknown event type: %s", event) ...
[ "func", "kernel", "(", "dc", "ClientInterface", ",", "done", "<-", "chan", "struct", "{", "}", ")", "error", "{", "routeEventsToKernel", "(", "dc", ")", "\n\n", "eventactions", ":=", "mkEventActionTable", "(", ")", "\n\n", "for", "{", "select", "{", "case"...
// kernel is responsible for executing all the Docker client commands.
[ "kernel", "is", "responsible", "for", "executing", "all", "the", "Docker", "client", "commands", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/kernel.go#L110-L159
139,819
control-center/serviced
dfs/registry/pull.go
ImagePath
func (l *RegistryListener) ImagePath(image string) (string, error) { imageID, err := commons.ParseImageID(image) if err != nil { return "", err } rImage := &registry.Image{ Library: imageID.User, Repo: imageID.Repo, Tag: imageID.Tag, } if imageID.IsLatest() { rImage.Tag = docker.Latest } return...
go
func (l *RegistryListener) ImagePath(image string) (string, error) { imageID, err := commons.ParseImageID(image) if err != nil { return "", err } rImage := &registry.Image{ Library: imageID.User, Repo: imageID.Repo, Tag: imageID.Tag, } if imageID.IsLatest() { rImage.Tag = docker.Latest } return...
[ "func", "(", "l", "*", "RegistryListener", ")", "ImagePath", "(", "image", "string", ")", "(", "string", ",", "error", ")", "{", "imageID", ",", "err", ":=", "commons", ".", "ParseImageID", "(", "image", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// ImagePath returns the proper path to the registry image
[ "ImagePath", "returns", "the", "proper", "path", "to", "the", "registry", "image" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/pull.go#L48-L62
139,820
control-center/serviced
cli/cmd/key.go
outputCommonKey
func (c *ServicedCli) outputCommonKey(host *host.Host, nat utils.URL, keyData []byte) { keyfileName := filepath.Join(config.GetOptions().EtcPath, auth.DelegateKeyFileName) c.outputDelegateKey(host, nat, keyData, keyfileName, true) }
go
func (c *ServicedCli) outputCommonKey(host *host.Host, nat utils.URL, keyData []byte) { keyfileName := filepath.Join(config.GetOptions().EtcPath, auth.DelegateKeyFileName) c.outputDelegateKey(host, nat, keyData, keyfileName, true) }
[ "func", "(", "c", "*", "ServicedCli", ")", "outputCommonKey", "(", "host", "*", "host", ".", "Host", ",", "nat", "utils", ".", "URL", ",", "keyData", "[", "]", "byte", ")", "{", "keyfileName", ":=", "filepath", ".", "Join", "(", "config", ".", "GetOp...
// Registers a host with the given keydata, and stores the key at the location designated by auth.DelegateKeyFileName
[ "Registers", "a", "host", "with", "the", "given", "keydata", "and", "stores", "the", "key", "at", "the", "location", "designated", "by", "auth", ".", "DelegateKeyFileName" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/key.go#L176-L179
139,821
control-center/serviced
rpc/master/instance_server.go
StopServiceInstance
func (s *Server) StopServiceInstance(req ServiceInstanceRequest, unused *string) (err error) { err = s.f.StopServiceInstance(s.context(), req.ServiceID, req.InstanceID) return }
go
func (s *Server) StopServiceInstance(req ServiceInstanceRequest, unused *string) (err error) { err = s.f.StopServiceInstance(s.context(), req.ServiceID, req.InstanceID) return }
[ "func", "(", "s", "*", "Server", ")", "StopServiceInstance", "(", "req", "ServiceInstanceRequest", ",", "unused", "*", "string", ")", "(", "err", "error", ")", "{", "err", "=", "s", ".", "f", ".", "StopServiceInstance", "(", "s", ".", "context", "(", "...
// StopServiceInstance stops a single service instance
[ "StopServiceInstance", "stops", "a", "single", "service", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/instance_server.go#L38-L41
139,822
control-center/serviced
rpc/master/instance_server.go
LocateServiceInstance
func (s *Server) LocateServiceInstance(req ServiceInstanceRequest, res *service.LocationInstance) (err error) { location, err := s.f.LocateServiceInstance(s.context(), req.ServiceID, req.InstanceID) if err != nil { return } *res = *location return }
go
func (s *Server) LocateServiceInstance(req ServiceInstanceRequest, res *service.LocationInstance) (err error) { location, err := s.f.LocateServiceInstance(s.context(), req.ServiceID, req.InstanceID) if err != nil { return } *res = *location return }
[ "func", "(", "s", "*", "Server", ")", "LocateServiceInstance", "(", "req", "ServiceInstanceRequest", ",", "res", "*", "service", ".", "LocationInstance", ")", "(", "err", "error", ")", "{", "location", ",", "err", ":=", "s", ".", "f", ".", "LocateServiceIn...
// LocateServiceInstance locates a single service instance
[ "LocateServiceInstance", "locates", "a", "single", "service", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/instance_server.go#L44-L51
139,823
control-center/serviced
coordinator/client/retry/exponential_backoff.go
ExponentialBackoff
func ExponentialBackoff(baseSleepTime time.Duration, maxRetries int) Policy { return exponentialBackoff{ baseSleepTime: baseSleepTime, maxRetries: maxRetries, } }
go
func ExponentialBackoff(baseSleepTime time.Duration, maxRetries int) Policy { return exponentialBackoff{ baseSleepTime: baseSleepTime, maxRetries: maxRetries, } }
[ "func", "ExponentialBackoff", "(", "baseSleepTime", "time", ".", "Duration", ",", "maxRetries", "int", ")", "Policy", "{", "return", "exponentialBackoff", "{", "baseSleepTime", ":", "baseSleepTime", ",", "maxRetries", ":", "maxRetries", ",", "}", "\n", "}" ]
// ExponentialBackoff returns a policy that will retry up to maxRetries with an exponentially increasing // sleep time.
[ "ExponentialBackoff", "returns", "a", "policy", "that", "will", "retry", "up", "to", "maxRetries", "with", "an", "exponentially", "increasing", "sleep", "time", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/retry/exponential_backoff.go#L28-L33
139,824
control-center/serviced
rpc/master/publicendpoint_client.go
RemovePublicEndpointVHost
func (c *Client) RemovePublicEndpointVHost(serviceid, endpointName, vhost string) error { request := &PublicEndpointRequest{ Serviceid: serviceid, EndpointName: endpointName, Name: vhost, } return c.call("RemovePublicEndpointVHost", request, nil) }
go
func (c *Client) RemovePublicEndpointVHost(serviceid, endpointName, vhost string) error { request := &PublicEndpointRequest{ Serviceid: serviceid, EndpointName: endpointName, Name: vhost, } return c.call("RemovePublicEndpointVHost", request, nil) }
[ "func", "(", "c", "*", "Client", ")", "RemovePublicEndpointVHost", "(", "serviceid", ",", "endpointName", ",", "vhost", "string", ")", "error", "{", "request", ":=", "&", "PublicEndpointRequest", "{", "Serviceid", ":", "serviceid", ",", "EndpointName", ":", "e...
// Remove a vhost public endpoint from a service.
[ "Remove", "a", "vhost", "public", "endpoint", "from", "a", "service", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/publicendpoint_client.go#L75-L82
139,825
control-center/serviced
domain/service/walk.go
Walk
func Walk(serviceID string, visitFn Visit, getService GetService, getChildren GetChildServices) error { // get the children subServices, err := getChildren(serviceID) if err != nil { return err } // walk the children for _, svc := range subServices { if err := Walk(svc.ID, visitFn, getService, getChildren); ...
go
func Walk(serviceID string, visitFn Visit, getService GetService, getChildren GetChildServices) error { // get the children subServices, err := getChildren(serviceID) if err != nil { return err } // walk the children for _, svc := range subServices { if err := Walk(svc.ID, visitFn, getService, getChildren); ...
[ "func", "Walk", "(", "serviceID", "string", ",", "visitFn", "Visit", ",", "getService", "GetService", ",", "getChildren", "GetChildServices", ")", "error", "{", "// get the children", "subServices", ",", "err", ":=", "getChildren", "(", "serviceID", ")", "\n", "...
//Walk traverses the service hierarchy and calls the supplied Visit function on each service
[ "Walk", "traverses", "the", "service", "hierarchy", "and", "calls", "the", "supplied", "Visit", "function", "on", "each", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/walk.go#L29-L50
139,826
control-center/serviced
rpc/master/docker_client.go
UpgradeRegistry
func (c *Client) UpgradeRegistry(endpoint string, override bool) error { req := UpgradeDockerRequest{endpoint, override} return c.call("UpgradeRegistry", req, new(int)) }
go
func (c *Client) UpgradeRegistry(endpoint string, override bool) error { req := UpgradeDockerRequest{endpoint, override} return c.call("UpgradeRegistry", req, new(int)) }
[ "func", "(", "c", "*", "Client", ")", "UpgradeRegistry", "(", "endpoint", "string", ",", "override", "bool", ")", "error", "{", "req", ":=", "UpgradeDockerRequest", "{", "endpoint", ",", "override", "}", "\n", "return", "c", ".", "call", "(", "\"", "\"",...
// UpgradeRegistry migrates images from an older or remote docker registry and // updates the index.
[ "UpgradeRegistry", "migrates", "images", "from", "an", "older", "or", "remote", "docker", "registry", "and", "updates", "the", "index", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/docker_client.go#L30-L33
139,827
control-center/serviced
facade/logstash.go
findNewestFilter
func findNewestFilter(filterName string, logInfo serviceLogInfo, logFilters []*logfilter.LogFilter) (string, bool) { matchingFilters := []*logfilter.LogFilter{} for _, filter := range logFilters { if filterName == filter.Name { matchingFilters = append(matchingFilters, filter) } } var closest *logfilter.Log...
go
func findNewestFilter(filterName string, logInfo serviceLogInfo, logFilters []*logfilter.LogFilter) (string, bool) { matchingFilters := []*logfilter.LogFilter{} for _, filter := range logFilters { if filterName == filter.Name { matchingFilters = append(matchingFilters, filter) } } var closest *logfilter.Log...
[ "func", "findNewestFilter", "(", "filterName", "string", ",", "logInfo", "serviceLogInfo", ",", "logFilters", "[", "]", "*", "logfilter", ".", "LogFilter", ")", "(", "string", ",", "bool", ")", "{", "matchingFilters", ":=", "[", "]", "*", "logfilter", ".", ...
// Finds the newest match for the named filter by version. // If an exact match is found, use it. Otherwise, return the newest version of the named filter
[ "Finds", "the", "newest", "match", "for", "the", "named", "filter", "by", "version", ".", "If", "an", "exact", "match", "is", "found", "use", "it", ".", "Otherwise", "return", "the", "newest", "version", "of", "the", "named", "filter" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/logstash.go#L235-L268
139,828
control-center/serviced
facade/logstash.go
writeLogStashConfigFile
func writeLogStashConfigFile(filterSection string, auditLogSection string, outputPath string) error { // read the log configuration template templatePath := filepath.Join(getLogstashConfigDirectory(), "logstash.conf.template") contents, err := ioutil.ReadFile(templatePath) if err != nil { return err } // the ...
go
func writeLogStashConfigFile(filterSection string, auditLogSection string, outputPath string) error { // read the log configuration template templatePath := filepath.Join(getLogstashConfigDirectory(), "logstash.conf.template") contents, err := ioutil.ReadFile(templatePath) if err != nil { return err } // the ...
[ "func", "writeLogStashConfigFile", "(", "filterSection", "string", ",", "auditLogSection", "string", ",", "outputPath", "string", ")", "error", "{", "// read the log configuration template", "templatePath", ":=", "filepath", ".", "Join", "(", "getLogstashConfigDirectory", ...
// This method writes out the config file for logstash. It uses // the logstash.conf.template and does a variable replacement.
[ "This", "method", "writes", "out", "the", "config", "file", "for", "logstash", ".", "It", "uses", "the", "logstash", ".", "conf", ".", "template", "and", "does", "a", "variable", "replacement", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/logstash.go#L293-L332
139,829
control-center/serviced
facade/logstash.go
GreaterThanOrEqual
func (sli *serviceLogInfo) GreaterThanOrEqual(value string) bool { if sli.Version == "" { return false } else if value == "" { return true } a := version.Version(sli.Version) b := version.Version(value) return a.GreaterThanOrEqualTo(b) }
go
func (sli *serviceLogInfo) GreaterThanOrEqual(value string) bool { if sli.Version == "" { return false } else if value == "" { return true } a := version.Version(sli.Version) b := version.Version(value) return a.GreaterThanOrEqualTo(b) }
[ "func", "(", "sli", "*", "serviceLogInfo", ")", "GreaterThanOrEqual", "(", "value", "string", ")", "bool", "{", "if", "sli", ".", "Version", "==", "\"", "\"", "{", "return", "false", "\n", "}", "else", "if", "value", "==", "\"", "\"", "{", "return", ...
// Returns true if serviceLogInfo.Version is >= version.
[ "Returns", "true", "if", "serviceLogInfo", ".", "Version", "is", ">", "=", "version", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/logstash.go#L348-L358
139,830
control-center/serviced
node/virtualip.go
Matches
func (ip *IP) Matches(ipaddr, device string) bool { return ip.Addr == ipaddr && ip.Device == device }
go
func (ip *IP) Matches(ipaddr, device string) bool { return ip.Addr == ipaddr && ip.Device == device }
[ "func", "(", "ip", "*", "IP", ")", "Matches", "(", "ipaddr", ",", "device", "string", ")", "bool", "{", "return", "ip", ".", "Addr", "==", "ipaddr", "&&", "ip", ".", "Device", "==", "device", "\n", "}" ]
// Matches returns true if the address and device match
[ "Matches", "returns", "true", "if", "the", "address", "and", "device", "match" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L50-L52
139,831
control-center/serviced
node/virtualip.go
NewVirtualIPManager
func NewVirtualIPManager(label string) *VirtualIPManager { return &VirtualIPManager{ label: label, mu: &sync.Mutex{}, } }
go
func NewVirtualIPManager(label string) *VirtualIPManager { return &VirtualIPManager{ label: label, mu: &sync.Mutex{}, } }
[ "func", "NewVirtualIPManager", "(", "label", "string", ")", "*", "VirtualIPManager", "{", "return", "&", "VirtualIPManager", "{", "label", ":", "label", ",", "mu", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "}", "\n", "}" ]
// NewVirtualIPManager instantiates an instance of the VirtualIPManager
[ "NewVirtualIPManager", "instantiates", "an", "instance", "of", "the", "VirtualIPManager" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L61-L66
139,832
control-center/serviced
node/virtualip.go
GetAll
func (v *VirtualIPManager) GetAll() (ips []IP) { cmd := exec.Command("ip", "-o", "a", "show", "label", fmt.Sprintf("*:%s*", v.label)) stdout, _ := cmd.StdoutPipe() cmd.Start() defer cmd.Wait() scanner := bufio.NewScanner(stdout) for scanner.Scan() { if ip := v.loadIP(scanner.Bytes()); ip != nil { ips = app...
go
func (v *VirtualIPManager) GetAll() (ips []IP) { cmd := exec.Command("ip", "-o", "a", "show", "label", fmt.Sprintf("*:%s*", v.label)) stdout, _ := cmd.StdoutPipe() cmd.Start() defer cmd.Wait() scanner := bufio.NewScanner(stdout) for scanner.Scan() { if ip := v.loadIP(scanner.Bytes()); ip != nil { ips = app...
[ "func", "(", "v", "*", "VirtualIPManager", ")", "GetAll", "(", ")", "(", "ips", "[", "]", "IP", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ...
// GetAll returns all the bound virtual ips
[ "GetAll", "returns", "all", "the", "bound", "virtual", "ips" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L69-L84
139,833
control-center/serviced
node/virtualip.go
Find
func (v *VirtualIPManager) Find(ipprefix string) *IP { cmd := exec.Command("ip", "-o", "a", "show", "label", fmt.Sprintf("*:%s*", v.label), "to", ipprefix) output, _ := cmd.CombinedOutput() return v.loadIP(output) }
go
func (v *VirtualIPManager) Find(ipprefix string) *IP { cmd := exec.Command("ip", "-o", "a", "show", "label", fmt.Sprintf("*:%s*", v.label), "to", ipprefix) output, _ := cmd.CombinedOutput() return v.loadIP(output) }
[ "func", "(", "v", "*", "VirtualIPManager", ")", "Find", "(", "ipprefix", "string", ")", "*", "IP", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", ...
// Find returns the matching binding for the given ip address
[ "Find", "returns", "the", "matching", "binding", "for", "the", "given", "ip", "address" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L87-L91
139,834
control-center/serviced
node/virtualip.go
Release
func (v *VirtualIPManager) Release(ipaddr, device string) error { logger := plog.WithFields(logrus.Fields{ "ipaddress": ipaddr, "device": device, }) cmd := exec.Command("ip", "a", "del", ipaddr, "dev", device) output, err := cmd.CombinedOutput() if err != nil { logger.WithError(err).WithFields(logrus.Fie...
go
func (v *VirtualIPManager) Release(ipaddr, device string) error { logger := plog.WithFields(logrus.Fields{ "ipaddress": ipaddr, "device": device, }) cmd := exec.Command("ip", "a", "del", ipaddr, "dev", device) output, err := cmd.CombinedOutput() if err != nil { logger.WithError(err).WithFields(logrus.Fie...
[ "func", "(", "v", "*", "VirtualIPManager", ")", "Release", "(", "ipaddr", ",", "device", "string", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "ipaddr", ",", "\"", "\"", ":", "devi...
// Release releases the virtual ip binding
[ "Release", "releases", "the", "virtual", "ip", "binding" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L94-L112
139,835
control-center/serviced
node/virtualip.go
Bind
func (v *VirtualIPManager) Bind(ipaddr, device string) error { v.mu.Lock() defer v.mu.Unlock() logger := plog.WithFields(logrus.Fields{ "ipaddress": ipaddr, "device": device, }) cmd := exec.Command("ip", "a", "add", ipaddr, "dev", device, "label", v.nextLabel(device)) output, err := cmd.CombinedOutput() ...
go
func (v *VirtualIPManager) Bind(ipaddr, device string) error { v.mu.Lock() defer v.mu.Unlock() logger := plog.WithFields(logrus.Fields{ "ipaddress": ipaddr, "device": device, }) cmd := exec.Command("ip", "a", "add", ipaddr, "dev", device, "label", v.nextLabel(device)) output, err := cmd.CombinedOutput() ...
[ "func", "(", "v", "*", "VirtualIPManager", ")", "Bind", "(", "ipaddr", ",", "device", "string", ")", "error", "{", "v", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "logger", ":=", "plog", ".",...
// Bind binds a virtual ip to a device
[ "Bind", "binds", "a", "virtual", "ip", "to", "a", "device" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L115-L136
139,836
control-center/serviced
node/virtualip.go
BindIP
func (a *HostAgent) BindIP(ipprefix, netmask, iface string) error { logger := plog.WithFields(logrus.Fields{ "ipaddress": ipprefix, "netmask": netmask, "interface": iface, }) // calculate the cidr bytes cidr, _ := net.IPMask(net.ParseIP(netmask).To4()).Size() ip := fmt.Sprintf("%s/%d", ipprefix, cidr) i...
go
func (a *HostAgent) BindIP(ipprefix, netmask, iface string) error { logger := plog.WithFields(logrus.Fields{ "ipaddress": ipprefix, "netmask": netmask, "interface": iface, }) // calculate the cidr bytes cidr, _ := net.IPMask(net.ParseIP(netmask).To4()).Size() ip := fmt.Sprintf("%s/%d", ipprefix, cidr) i...
[ "func", "(", "a", "*", "HostAgent", ")", "BindIP", "(", "ipprefix", ",", "netmask", ",", "iface", "string", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "ipprefix", ",", "\"", "\"",...
// BindIP creates a virtual ip if it doesn't already exist.
[ "BindIP", "creates", "a", "virtual", "ip", "if", "it", "doesn", "t", "already", "exist", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L175-L211
139,837
control-center/serviced
node/virtualip.go
ReleaseIP
func (a *HostAgent) ReleaseIP(ipprefix string) error { logger := plog.WithField("ipaddress", ipprefix) if vip := a.vip.Find(ipprefix); vip != nil { if err := a.vip.Release(vip.Addr, vip.Device); err != nil { logger.WithError(err).Error("Could not release virtual ip") return err } } return nil }
go
func (a *HostAgent) ReleaseIP(ipprefix string) error { logger := plog.WithField("ipaddress", ipprefix) if vip := a.vip.Find(ipprefix); vip != nil { if err := a.vip.Release(vip.Addr, vip.Device); err != nil { logger.WithError(err).Error("Could not release virtual ip") return err } } return nil }
[ "func", "(", "a", "*", "HostAgent", ")", "ReleaseIP", "(", "ipprefix", "string", ")", "error", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ",", "ipprefix", ")", "\n", "if", "vip", ":=", "a", ".", "vip", ".", "Find", "(", "ippref...
// ReleaseIP releases a virtual ip if hasn't yet been released.
[ "ReleaseIP", "releases", "a", "virtual", "ip", "if", "hasn", "t", "yet", "been", "released", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/virtualip.go#L214-L224
139,838
control-center/serviced
web/resources.go
restRestartService
func restRestartService(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { restBadRequest(w, err) return } logger := plog.WithField("serviceid", serviceID) auto := r.FormValue("auto") autoLaunch := true switch auto ...
go
func restRestartService(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { restBadRequest(w, err) return } logger := plog.WithField("serviceid", serviceID) auto := r.FormValue("auto") autoLaunch := true switch auto ...
[ "func", "restRestartService", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "serviceID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", ...
// restRestartService restarts the service with the given id and all of its children
[ "restRestartService", "restarts", "the", "service", "with", "the", "given", "id", "and", "all", "of", "its", "children" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/resources.go#L564-L602
139,839
control-center/serviced
web/resources.go
restRestartServices
func restRestartServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { var serviceRequest dao.ScheduleServiceRequest err := r.DecodeJsonPayload(&serviceRequest) if err != nil { plog.WithError(err).Debug("Could not decode service payload") restBadRequest(w, err) return } logger := plog.Wi...
go
func restRestartServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { var serviceRequest dao.ScheduleServiceRequest err := r.DecodeJsonPayload(&serviceRequest) if err != nil { plog.WithError(err).Debug("Could not decode service payload") restBadRequest(w, err) return } logger := plog.Wi...
[ "func", "restRestartServices", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "var", "serviceRequest", "dao", ".", "ScheduleServiceRequest", "\n", "err", ":=", "r", ".", "De...
// restRetartServices starts the services with the given ids and all of their children
[ "restRetartServices", "starts", "the", "services", "with", "the", "given", "ids", "and", "all", "of", "their", "children" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/resources.go#L605-L631
139,840
control-center/serviced
web/resources.go
restStopService
func restStopService(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { restBadRequest(w, err) return } logger := plog.WithField("serviceid", serviceID) auto := r.FormValue("auto") autoLaunch := true switch auto { ...
go
func restStopService(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { restBadRequest(w, err) return } logger := plog.WithField("serviceid", serviceID) auto := r.FormValue("auto") autoLaunch := true switch auto { ...
[ "func", "restStopService", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "serviceID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\...
// restStopService stop the service with the given id and all of its children
[ "restStopService", "stop", "the", "service", "with", "the", "given", "id", "and", "all", "of", "its", "children" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/resources.go#L703-L731
139,841
control-center/serviced
web/resources.go
restStopServices
func restStopServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { var serviceRequest dao.ScheduleServiceRequest err := r.DecodeJsonPayload(&serviceRequest) if err != nil { plog.WithError(err).Debug("Could not decode service payload") restBadRequest(w, err) return } logger := plog.WithF...
go
func restStopServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { var serviceRequest dao.ScheduleServiceRequest err := r.DecodeJsonPayload(&serviceRequest) if err != nil { plog.WithError(err).Debug("Could not decode service payload") restBadRequest(w, err) return } logger := plog.WithF...
[ "func", "restStopServices", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "var", "serviceRequest", "dao", ".", "ScheduleServiceRequest", "\n", "err", ":=", "r", ".", "Decod...
// restStopServices stops the services with the given ids and all of their children
[ "restStopServices", "stops", "the", "services", "with", "the", "given", "ids", "and", "all", "of", "their", "children" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/resources.go#L734-L757
139,842
control-center/serviced
web/resources.go
RestBackupFileList
func RestBackupFileList(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient) { var fileData []dao.BackupFile if err := client.ListBackups("", &fileData); err != nil { restServerError(w, err) return } w.WriteJson(&fileData) }
go
func RestBackupFileList(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient) { var fileData []dao.BackupFile if err := client.ListBackups("", &fileData); err != nil { restServerError(w, err) return } w.WriteJson(&fileData) }
[ "func", "RestBackupFileList", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "client", "*", "daoclient", ".", "ControlClient", ")", "{", "var", "fileData", "[", "]", "dao", ".", "BackupFile", "\n", "if", "err", ...
// RestBackupFileList implements a rest call that will return a list of the current backup files. // The return value is a JSON struct of type JsonizableFileInfo.
[ "RestBackupFileList", "implements", "a", "rest", "call", "that", "will", "return", "a", "list", "of", "the", "current", "backup", "files", ".", "The", "return", "value", "is", "a", "JSON", "struct", "of", "type", "JsonizableFileInfo", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/resources.go#L964-L971
139,843
control-center/serviced
node/container.go
StopContainer
func (a *HostAgent) StopContainer(serviceID string, instanceID int) error { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) // find the container by name ctrName := fmt.Sprintf("%s-%d", serviceID, instanceID) ctr, err := docker.FindContainer(ctrName) if err == dock...
go
func (a *HostAgent) StopContainer(serviceID string, instanceID int) error { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) // find the container by name ctrName := fmt.Sprintf("%s-%d", serviceID, instanceID) ctr, err := docker.FindContainer(ctrName) if err == dock...
[ "func", "(", "a", "*", "HostAgent", ")", "StopContainer", "(", "serviceID", "string", ",", "instanceID", "int", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "serviceID", ",", "\"", "\"",...
// StopContainer stops running container or returns nil if the container does // not exist or has already stopped.
[ "StopContainer", "stops", "running", "container", "or", "returns", "nil", "if", "the", "container", "does", "not", "exist", "or", "has", "already", "stopped", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L65-L92
139,844
control-center/serviced
node/container.go
AttachContainer
func (a *HostAgent) AttachContainer(state *zkservice.ServiceState, serviceID string, instanceID int) (<-chan time.Time, error) { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, "containerid": state.ContainerID, }) // find the container by name ctrName := fmt.Sprintf...
go
func (a *HostAgent) AttachContainer(state *zkservice.ServiceState, serviceID string, instanceID int) (<-chan time.Time, error) { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, "containerid": state.ContainerID, }) // find the container by name ctrName := fmt.Sprintf...
[ "func", "(", "a", "*", "HostAgent", ")", "AttachContainer", "(", "state", "*", "zkservice", ".", "ServiceState", ",", "serviceID", "string", ",", "instanceID", "int", ")", "(", "<-", "chan", "time", ".", "Time", ",", "error", ")", "{", "logger", ":=", ...
// AttachContainer returns a channel that monitors the run state of a given // container.
[ "AttachContainer", "returns", "a", "channel", "that", "monitors", "the", "run", "state", "of", "a", "given", "container", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L96-L137
139,845
control-center/serviced
node/container.go
StartContainer
func (a *HostAgent) StartContainer(cancel <-chan interface{}, serviceID string, instanceID int) (*zkservice.ServiceState, <-chan time.Time, error) { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) a.serviceCache.Invalidate(serviceID, instanceID) evaluatedService, ten...
go
func (a *HostAgent) StartContainer(cancel <-chan interface{}, serviceID string, instanceID int) (*zkservice.ServiceState, <-chan time.Time, error) { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) a.serviceCache.Invalidate(serviceID, instanceID) evaluatedService, ten...
[ "func", "(", "a", "*", "HostAgent", ")", "StartContainer", "(", "cancel", "<-", "chan", "interface", "{", "}", ",", "serviceID", "string", ",", "instanceID", "int", ")", "(", "*", "zkservice", ".", "ServiceState", ",", "<-", "chan", "time", ".", "Time", ...
// StartContainer creates a new container and starts. It returns info about // the container, and an event monitor to track the running state of the // service.
[ "StartContainer", "creates", "a", "new", "container", "and", "starts", ".", "It", "returns", "info", "about", "the", "container", "and", "an", "event", "monitor", "to", "track", "the", "running", "state", "of", "the", "service", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L142-L197
139,846
control-center/serviced
node/container.go
RestartContainer
func (a *HostAgent) RestartContainer(cancel <-chan interface{}, serviceID string, instanceID int) error { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) // look up the container to get the image ctrName := fmt.Sprintf("%s-%d", serviceID, instanceID) ctr, err := doc...
go
func (a *HostAgent) RestartContainer(cancel <-chan interface{}, serviceID string, instanceID int) error { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) // look up the container to get the image ctrName := fmt.Sprintf("%s-%d", serviceID, instanceID) ctr, err := doc...
[ "func", "(", "a", "*", "HostAgent", ")", "RestartContainer", "(", "cancel", "<-", "chan", "interface", "{", "}", ",", "serviceID", "string", ",", "instanceID", "int", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields"...
// RestartContainer asynchronously pulls the latest image of a running // container before stopping the service. After the service has stopped, the // listener will be notified by the event monitor.
[ "RestartContainer", "asynchronously", "pulls", "the", "latest", "image", "of", "a", "running", "container", "before", "stopping", "the", "service", ".", "After", "the", "service", "has", "stopped", "the", "listener", "will", "be", "notified", "by", "the", "event...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L202-L260
139,847
control-center/serviced
node/container.go
ResumeContainer
func (a *HostAgent) ResumeContainer(serviceID string, instanceID int) error { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) svc, err := a.getService(serviceID) if err != nil { logger.WithError(err).Debug("Unable to retrieve service") return nil } ctrName := ...
go
func (a *HostAgent) ResumeContainer(serviceID string, instanceID int) error { logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "instanceid": instanceID, }) svc, err := a.getService(serviceID) if err != nil { logger.WithError(err).Debug("Unable to retrieve service") return nil } ctrName := ...
[ "func", "(", "a", "*", "HostAgent", ")", "ResumeContainer", "(", "serviceID", "string", ",", "instanceID", "int", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "serviceID", ",", "\"", "\"...
// ResumeContainer resumes a paused container
[ "ResumeContainer", "resumes", "a", "paused", "container" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L263-L304
139,848
control-center/serviced
node/container.go
PauseContainer
func (a *HostAgent) PauseContainer(serviceID string, instanceID int) error { commandTimeout := time.Duration( config.GetOptions().MaxDFSTimeout + 1) * time.Second pidFile := "/pause.pid" kill := fmt.Sprintf( "if [ -f %[1]s ]; then pid=$(cat %[1]s); if [ \"$pid\" ];" + "then kill $pid; fi; rm -f %[1]s; fi", pi...
go
func (a *HostAgent) PauseContainer(serviceID string, instanceID int) error { commandTimeout := time.Duration( config.GetOptions().MaxDFSTimeout + 1) * time.Second pidFile := "/pause.pid" kill := fmt.Sprintf( "if [ -f %[1]s ]; then pid=$(cat %[1]s); if [ \"$pid\" ];" + "then kill $pid; fi; rm -f %[1]s; fi", pi...
[ "func", "(", "a", "*", "HostAgent", ")", "PauseContainer", "(", "serviceID", "string", ",", "instanceID", "int", ")", "error", "{", "commandTimeout", ":=", "time", ".", "Duration", "(", "config", ".", "GetOptions", "(", ")", ".", "MaxDFSTimeout", "+", "1",...
// PauseContainer pauses a running container
[ "PauseContainer", "pauses", "a", "running", "container" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L307-L384
139,849
control-center/serviced
node/container.go
pullImage
func (a *HostAgent) pullImage(logger *log.Entry, cancel <-chan interface{}, imageID string) (string, string, error) { conn, err := zzk.GetLocalConnection("/") if err != nil { logger.WithError(err).Debug("Could not connect to coordinator") // TODO: wrap error? return "", "", err } timeoutC := make(chan time....
go
func (a *HostAgent) pullImage(logger *log.Entry, cancel <-chan interface{}, imageID string) (string, string, error) { conn, err := zzk.GetLocalConnection("/") if err != nil { logger.WithError(err).Debug("Could not connect to coordinator") // TODO: wrap error? return "", "", err } timeoutC := make(chan time....
[ "func", "(", "a", "*", "HostAgent", ")", "pullImage", "(", "logger", "*", "log", ".", "Entry", ",", "cancel", "<-", "chan", "interface", "{", "}", ",", "imageID", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "conn", ",", "er...
// pullImage pulls the service image and returns the uuid string // of the image and the fully qualified image name.
[ "pullImage", "pulls", "the", "service", "image", "and", "returns", "the", "uuid", "string", "of", "the", "image", "and", "the", "fully", "qualified", "image", "name", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L388-L438
139,850
control-center/serviced
node/container.go
monitorContainer
func (a *HostAgent) monitorContainer(logger *log.Entry, ctr *docker.Container) <-chan time.Time { ev := make(chan time.Time, 1) ctr.OnEvent(docker.Die, func(_ string) { someSlice := strings.Split(ctr.Name, "-") serviceID := someSlice[0] instanceID, err := strconv.ParseInt(someSlice[1], 10, 0) a.setInstanceSta...
go
func (a *HostAgent) monitorContainer(logger *log.Entry, ctr *docker.Container) <-chan time.Time { ev := make(chan time.Time, 1) ctr.OnEvent(docker.Die, func(_ string) { someSlice := strings.Split(ctr.Name, "-") serviceID := someSlice[0] instanceID, err := strconv.ParseInt(someSlice[1], 10, 0) a.setInstanceSta...
[ "func", "(", "a", "*", "HostAgent", ")", "monitorContainer", "(", "logger", "*", "log", ".", "Entry", ",", "ctr", "*", "docker", ".", "Container", ")", "<-", "chan", "time", ".", "Time", "{", "ev", ":=", "make", "(", "chan", "time", ".", "Time", ",...
// monitorContainer tracks the running state of the container. // runs when the container dies
[ "monitorContainer", "tracks", "the", "running", "state", "of", "the", "container", ".", "runs", "when", "the", "container", "dies" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L442-L479
139,851
control-center/serviced
node/container.go
exposeAssignedIPs
func (a *HostAgent) exposeAssignedIPs(state *zkservice.ServiceState, ctr *docker.Container) { logger := plog.WithFields(log.Fields{ "containerid": state.ContainerID, "containername": ctr.Name, }) protocols := map[string]struct{}{} if ip := state.AssignedIP; ip != "" { for _, exp := range state.Exports { ...
go
func (a *HostAgent) exposeAssignedIPs(state *zkservice.ServiceState, ctr *docker.Container) { logger := plog.WithFields(log.Fields{ "containerid": state.ContainerID, "containername": ctr.Name, }) protocols := map[string]struct{}{} if ip := state.AssignedIP; ip != "" { for _, exp := range state.Exports { ...
[ "func", "(", "a", "*", "HostAgent", ")", "exposeAssignedIPs", "(", "state", "*", "zkservice", ".", "ServiceState", ",", "ctr", "*", "docker", ".", "Container", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "...
// exposeAssignedIPs sets up iptables forwarding rules for endpoints with // assigned ips.
[ "exposeAssignedIPs", "sets", "up", "iptables", "forwarding", "rules", "for", "endpoints", "with", "assigned", "ips", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L483-L519
139,852
control-center/serviced
node/container.go
dockerLogsToFile
func dockerLogsToFile(containerid string, numlines int) { // TODO: need to get logs from api fname := filepath.Join(os.TempDir(), fmt.Sprintf("%s.container.log", containerid)) f, e := os.Create(fname) if e != nil { plog.WithError(e).WithFields(log.Fields{ "file": fname, }).Debug("Unable to create container ...
go
func dockerLogsToFile(containerid string, numlines int) { // TODO: need to get logs from api fname := filepath.Join(os.TempDir(), fmt.Sprintf("%s.container.log", containerid)) f, e := os.Create(fname) if e != nil { plog.WithError(e).WithFields(log.Fields{ "file": fname, }).Debug("Unable to create container ...
[ "func", "dockerLogsToFile", "(", "containerid", "string", ",", "numlines", "int", ")", "{", "// TODO: need to get logs from api", "fname", ":=", "filepath", ".", "Join", "(", "os", ".", "TempDir", "(", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", ...
// dockerLogsToFile dumps container logs to file
[ "dockerLogsToFile", "dumps", "container", "logs", "to", "file" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L546-L569
139,853
control-center/serviced
node/container.go
setupContainer
func (a *HostAgent) setupContainer(tenantID string, svc *service.Service, instanceID int, imageUUID string) (*docker.Container, *zkservice.ServiceState, error) { logger := plog.WithFields(log.Fields{ "tenantid": tenantID, "servicename": svc.Name, "serviceid": svc.ID, "instanceid": instanceID, }) cfg, h...
go
func (a *HostAgent) setupContainer(tenantID string, svc *service.Service, instanceID int, imageUUID string) (*docker.Container, *zkservice.ServiceState, error) { logger := plog.WithFields(log.Fields{ "tenantid": tenantID, "servicename": svc.Name, "serviceid": svc.ID, "instanceid": instanceID, }) cfg, h...
[ "func", "(", "a", "*", "HostAgent", ")", "setupContainer", "(", "tenantID", "string", ",", "svc", "*", "service", ".", "Service", ",", "instanceID", "int", ",", "imageUUID", "string", ")", "(", "*", "docker", ".", "Container", ",", "*", "zkservice", ".",...
// setupContainer creates and populates two structures, a docker client Config and a docker client HostConfig structure // that are used to create and start a container respectively. The information used to populate the structures is pulled from // the service, serviceState, and conn values that are passed into setupCo...
[ "setupContainer", "creates", "and", "populates", "two", "structures", "a", "docker", "client", "Config", "and", "a", "docker", "client", "HostConfig", "structure", "that", "are", "used", "to", "create", "and", "start", "a", "container", "respectively", ".", "The...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/container.go#L574-L598
139,854
control-center/serviced
config/options.go
LoadOptions
func LoadOptions(ops Options) { options = ops // Check option boundaries if options.ESStartupTimeout < minTimeout { log.WithFields(logrus.Fields{ "mintimeout": minTimeout, }).Debug("Overriding Elastic startup timeout") options.ESStartupTimeout = minTimeout } if options.ZKReconnectStartDelay < 1 { log....
go
func LoadOptions(ops Options) { options = ops // Check option boundaries if options.ESStartupTimeout < minTimeout { log.WithFields(logrus.Fields{ "mintimeout": minTimeout, }).Debug("Overriding Elastic startup timeout") options.ESStartupTimeout = minTimeout } if options.ZKReconnectStartDelay < 1 { log....
[ "func", "LoadOptions", "(", "ops", "Options", ")", "{", "options", "=", "ops", "\n\n", "// Check option boundaries", "if", "options", ".", "ESStartupTimeout", "<", "minTimeout", "{", "log", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":...
// LoadOptions overwrites the existing server options
[ "LoadOptions", "overwrites", "the", "existing", "server", "options" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/config/options.go#L151-L181
139,855
control-center/serviced
dao/elasticsearch/service.go
AddService
func (this *ControlPlaneDao) AddService(svc service.Service, serviceId *string) error { if err := this.facade.DFSLock(datastore.Get()).LockWithTimeout("add service", userLockTimeout); err != nil { glog.Warningf("Cannot add service: %s", err) return err } defer this.facade.DFSLock(datastore.Get()).Unlock() retu...
go
func (this *ControlPlaneDao) AddService(svc service.Service, serviceId *string) error { if err := this.facade.DFSLock(datastore.Get()).LockWithTimeout("add service", userLockTimeout); err != nil { glog.Warningf("Cannot add service: %s", err) return err } defer this.facade.DFSLock(datastore.Get()).Unlock() retu...
[ "func", "(", "this", "*", "ControlPlaneDao", ")", "AddService", "(", "svc", "service", ".", "Service", ",", "serviceId", "*", "string", ")", "error", "{", "if", "err", ":=", "this", ".", "facade", ".", "DFSLock", "(", "datastore", ".", "Get", "(", ")",...
// AddService adds a new service. Returns an error if service already exists.
[ "AddService", "adds", "a", "new", "service", ".", "Returns", "an", "error", "if", "service", "already", "exists", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dao/elasticsearch/service.go#L31-L39
139,856
control-center/serviced
dao/elasticsearch/service.go
CloneService
func (this *ControlPlaneDao) CloneService(request dao.ServiceCloneRequest, clonedServiceId *string) error { if err := this.facade.DFSLock(datastore.Get()).LockWithTimeout("clone service", userLockTimeout); err != nil { glog.Warningf("Cannot clone service: %s", err) return err } defer this.facade.DFSLock(datastor...
go
func (this *ControlPlaneDao) CloneService(request dao.ServiceCloneRequest, clonedServiceId *string) error { if err := this.facade.DFSLock(datastore.Get()).LockWithTimeout("clone service", userLockTimeout); err != nil { glog.Warningf("Cannot clone service: %s", err) return err } defer this.facade.DFSLock(datastor...
[ "func", "(", "this", "*", "ControlPlaneDao", ")", "CloneService", "(", "request", "dao", ".", "ServiceCloneRequest", ",", "clonedServiceId", "*", "string", ")", "error", "{", "if", "err", ":=", "this", ".", "facade", ".", "DFSLock", "(", "datastore", ".", ...
// CloneService clones a service. Returns an error if given serviceID is not found.
[ "CloneService", "clones", "a", "service", ".", "Returns", "an", "error", "if", "given", "serviceID", "is", "not", "found", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dao/elasticsearch/service.go#L50-L74
139,857
control-center/serviced
dao/elasticsearch/service.go
GetService
func (this *ControlPlaneDao) GetService(id string, myService *service.Service) error { svc, err := this.facade.GetService(datastore.Get(), id) if svc != nil { *myService = *svc } return err }
go
func (this *ControlPlaneDao) GetService(id string, myService *service.Service) error { svc, err := this.facade.GetService(datastore.Get(), id) if svc != nil { *myService = *svc } return err }
[ "func", "(", "this", "*", "ControlPlaneDao", ")", "GetService", "(", "id", "string", ",", "myService", "*", "service", ".", "Service", ")", "error", "{", "svc", ",", "err", ":=", "this", ".", "facade", ".", "GetService", "(", "datastore", ".", "Get", "...
// GetService gets a service.
[ "GetService", "gets", "a", "service", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dao/elasticsearch/service.go#L129-L135
139,858
control-center/serviced
dao/elasticsearch/service.go
StartService
func (this *ControlPlaneDao) StartService(request dao.ScheduleServiceRequest, affected *int) (err error) { *affected, err = this.facade.StartService(datastore.Get(), request) return err }
go
func (this *ControlPlaneDao) StartService(request dao.ScheduleServiceRequest, affected *int) (err error) { *affected, err = this.facade.StartService(datastore.Get(), request) return err }
[ "func", "(", "this", "*", "ControlPlaneDao", ")", "StartService", "(", "request", "dao", ".", "ScheduleServiceRequest", ",", "affected", "*", "int", ")", "(", "err", "error", ")", "{", "*", "affected", ",", "err", "=", "this", ".", "facade", ".", "StartS...
// start the provided service
[ "start", "the", "provided", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dao/elasticsearch/service.go#L167-L170
139,859
control-center/serviced
dao/elasticsearch/service.go
WaitService
func (this *ControlPlaneDao) WaitService(request dao.WaitServiceRequest, _ *int) (err error) { return this.facade.WaitService(datastore.Get(), request.DesiredState, request.Timeout, request.Recursive, request.ServiceIDs...) }
go
func (this *ControlPlaneDao) WaitService(request dao.WaitServiceRequest, _ *int) (err error) { return this.facade.WaitService(datastore.Get(), request.DesiredState, request.Timeout, request.Recursive, request.ServiceIDs...) }
[ "func", "(", "this", "*", "ControlPlaneDao", ")", "WaitService", "(", "request", "dao", ".", "WaitServiceRequest", ",", "_", "*", "int", ")", "(", "err", "error", ")", "{", "return", "this", ".", "facade", ".", "WaitService", "(", "datastore", ".", "Get"...
// WaitService waits for the given service IDs to reach a particular state
[ "WaitService", "waits", "for", "the", "given", "service", "IDs", "to", "reach", "a", "particular", "state" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dao/elasticsearch/service.go#L197-L199
139,860
control-center/serviced
commons/proc/nfsfs.go
GetMountInfo
func GetMountInfo(mountpoint string) (*MountInfo, error) { command := []string{"bash", "-c", fmt.Sprintf(procFindmntCommand, mountpoint)} thecmd := exec.Command(command[0], command[1:]...) glog.V(1).Infof("command: %+v", command) output, err := thecmd.CombinedOutput() if err != nil { glog.Warningf("could not fi...
go
func GetMountInfo(mountpoint string) (*MountInfo, error) { command := []string{"bash", "-c", fmt.Sprintf(procFindmntCommand, mountpoint)} thecmd := exec.Command(command[0], command[1:]...) glog.V(1).Infof("command: %+v", command) output, err := thecmd.CombinedOutput() if err != nil { glog.Warningf("could not fi...
[ "func", "GetMountInfo", "(", "mountpoint", "string", ")", "(", "*", "MountInfo", ",", "error", ")", "{", "command", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "procFindmntCommand", ",", "mountpoint", ")...
// GetMountInfo gets the mount info of the mountpoint
[ "GetMountInfo", "gets", "the", "mount", "info", "of", "the", "mountpoint" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/proc/nfsfs.go#L116-L165
139,861
control-center/serviced
commons/proc/nfsfs.go
GetNFSVolumeInfo
func GetNFSVolumeInfo(mountpoint string) (*NFSMountInfo, error) { minfo, err := GetMountInfo(mountpoint) if err != nil { return nil, err } if !strings.HasPrefix(minfo.FSType, "nfs") { return nil, fmt.Errorf("%s is not nfs; uses %s", minfo.LocalPath, minfo.FSType) } info := NFSMountInfo{ MountInfo: *minfo,...
go
func GetNFSVolumeInfo(mountpoint string) (*NFSMountInfo, error) { minfo, err := GetMountInfo(mountpoint) if err != nil { return nil, err } if !strings.HasPrefix(minfo.FSType, "nfs") { return nil, fmt.Errorf("%s is not nfs; uses %s", minfo.LocalPath, minfo.FSType) } info := NFSMountInfo{ MountInfo: *minfo,...
[ "func", "GetNFSVolumeInfo", "(", "mountpoint", "string", ")", "(", "*", "NFSMountInfo", ",", "error", ")", "{", "minfo", ",", "err", ":=", "GetMountInfo", "(", "mountpoint", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "...
// GetNFSVolumeInfo gets the NFSMountInfo of the mountpoint
[ "GetNFSVolumeInfo", "gets", "the", "NFSMountInfo", "of", "the", "mountpoint" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/proc/nfsfs.go#L168-L183
139,862
control-center/serviced
container/vif.go
SetSubnet
func (reg *VIFRegistry) SetSubnet(subnet string) error { if err := validation.IsSubnetCIDR(subnet); err != nil { return err } reg.subnet = subnet glog.Infof("vif subnet is: %s", reg.subnet) return nil }
go
func (reg *VIFRegistry) SetSubnet(subnet string) error { if err := validation.IsSubnetCIDR(subnet); err != nil { return err } reg.subnet = subnet glog.Infof("vif subnet is: %s", reg.subnet) return nil }
[ "func", "(", "reg", "*", "VIFRegistry", ")", "SetSubnet", "(", "subnet", "string", ")", "error", "{", "if", "err", ":=", "validation", ".", "IsSubnetCIDR", "(", "subnet", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "reg", "."...
// SetSubnet sets the subnet used for virtual addresses
[ "SetSubnet", "sets", "the", "subnet", "used", "for", "virtual", "addresses" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/vif.go#L55-L62
139,863
control-center/serviced
utils/shell_quote.go
ShellQuoteArg
func ShellQuoteArg(arg string) string { if arg == "" { return "''" } if !hasUnsafeChar.MatchString(arg) { return arg } // wrap with single quotes; put existing single quotes into double quotes return "'" + strings.Replace(arg, "'", "'\"'\"'", -1) + "'" }
go
func ShellQuoteArg(arg string) string { if arg == "" { return "''" } if !hasUnsafeChar.MatchString(arg) { return arg } // wrap with single quotes; put existing single quotes into double quotes return "'" + strings.Replace(arg, "'", "'\"'\"'", -1) + "'" }
[ "func", "ShellQuoteArg", "(", "arg", "string", ")", "string", "{", "if", "arg", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n\n", "if", "!", "hasUnsafeChar", ".", "MatchString", "(", "arg", ")", "{", "return", "arg", "\n", "}", "\n\n", ...
// Quote a single argument
[ "Quote", "a", "single", "argument" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/shell_quote.go#L22-L33
139,864
control-center/serviced
utils/shell_quote.go
ShellQuoteArgs
func ShellQuoteArgs(args []string) string { quotedArgs := []string{} for _, arg := range args { quotedArgs = append(quotedArgs, ShellQuoteArg(arg)) } return strings.Join(quotedArgs, " ") }
go
func ShellQuoteArgs(args []string) string { quotedArgs := []string{} for _, arg := range args { quotedArgs = append(quotedArgs, ShellQuoteArg(arg)) } return strings.Join(quotedArgs, " ") }
[ "func", "ShellQuoteArgs", "(", "args", "[", "]", "string", ")", "string", "{", "quotedArgs", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "arg", ":=", "range", "args", "{", "quotedArgs", "=", "append", "(", "quotedArgs", ",", "ShellQuoteA...
// Quote a list of arguments and join them with spaces
[ "Quote", "a", "list", "of", "arguments", "and", "join", "them", "with", "spaces" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/shell_quote.go#L36-L42
139,865
control-center/serviced
web/hostresource.go
restGetAggregateServices
func restGetAggregateServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { values := r.URL.Query() serviceIDs := values["serviceId"] since := values.Get("since") var tsince time.Duration if since == "" { tsince = time.Hour } else { tint, err := strconv.ParseInt(since, 10, 64) if err != n...
go
func restGetAggregateServices(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { values := r.URL.Query() serviceIDs := values["serviceId"] since := values.Get("since") var tsince time.Duration if since == "" { tsince = time.Hour } else { tint, err := strconv.ParseInt(since, 10, 64) if err != n...
[ "func", "restGetAggregateServices", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "values", ":=", "r", ".", "URL", ".", "Query", "(", ")", "\n", "serviceIDs", ":=", "va...
// restGetAggregateServices provides aggregate service information
[ "restGetAggregateServices", "provides", "aggregate", "service", "information" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/hostresource.go#L404-L445
139,866
control-center/serviced
web/hostresource.go
restGetHost
func restGetHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for GET")) return } facade := ctx.getFa...
go
func restGetHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for GET")) return } facade := ctx.getFa...
[ "func", "restGetHost", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "hostID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", "...
//restGetHost retrieves a host. Response is Host
[ "restGetHost", "retrieves", "a", "host", ".", "Response", "is", "Host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/hostresource.go#L461-L487
139,867
control-center/serviced
web/hostresource.go
restUpdateHost
func restUpdateHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for PUT")) return } glog.V(3).Infof("...
go
func restUpdateHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for PUT")) return } glog.V(3).Infof("...
[ "func", "restUpdateHost", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "hostID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", ...
//restUpdateHost updates a host. Request input is host.Host
[ "restUpdateHost", "updates", "a", "host", ".", "Request", "input", "is", "host", ".", "Host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/hostresource.go#L618-L646
139,868
control-center/serviced
web/hostresource.go
restRemoveHost
func restRemoveHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for DELETE")) return } facade := ctx...
go
func restRemoveHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for DELETE")) return } facade := ctx...
[ "func", "restRemoveHost", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "hostID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", ...
//restRemoveHost removes a host using host-id
[ "restRemoveHost", "removes", "a", "host", "using", "host", "-", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/hostresource.go#L649-L669
139,869
control-center/serviced
web/hostresource.go
restResetHostKey
func restResetHostKey(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for DELETE")) return } facade := c...
go
func restResetHostKey(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { hostID, err := url.QueryUnescape(r.PathParam("hostId")) if err != nil { restBadRequest(w, err) return } else if len(hostID) == 0 { restBadRequest(w, fmt.Errorf("hostID must be specified for DELETE")) return } facade := c...
[ "func", "restResetHostKey", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "hostID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\""...
// restResetHostKey generates and returns a new host-key for a given host-id
[ "restResetHostKey", "generates", "and", "returns", "a", "new", "host", "-", "key", "for", "a", "given", "host", "-", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/hostresource.go#L672-L692
139,870
control-center/serviced
zzk/service/host.go
RemoveHost
func RemoveHost(cancel <-chan struct{}, conn client.Connection, poolID, hostID string) error { basepth := "" if poolID != "" { basepth = path.Join("/pools", poolID) } pth := path.Join(basepth, "/hosts", hostID) logger := plog.WithFields(log.Fields{ "hostid": hostID, "zkpath": pth, }) // lock the host fro...
go
func RemoveHost(cancel <-chan struct{}, conn client.Connection, poolID, hostID string) error { basepth := "" if poolID != "" { basepth = path.Join("/pools", poolID) } pth := path.Join(basepth, "/hosts", hostID) logger := plog.WithFields(log.Fields{ "hostid": hostID, "zkpath": pth, }) // lock the host fro...
[ "func", "RemoveHost", "(", "cancel", "<-", "chan", "struct", "{", "}", ",", "conn", "client", ".", "Connection", ",", "poolID", ",", "hostID", "string", ")", "error", "{", "basepth", ":=", "\"", "\"", "\n", "if", "poolID", "!=", "\"", "\"", "{", "bas...
// RemoveHost removes an existing host, after waiting for existing states to // shutdown.
[ "RemoveHost", "removes", "an", "existing", "host", "after", "waiting", "for", "existing", "states", "to", "shutdown", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/host.go#L96-L190
139,871
control-center/serviced
zzk/service/host.go
removeHost
func removeHost(conn client.Connection, poolID, hostID string) error { basepth := "" if poolID != "" { basepth = path.Join("/pools", poolID) } pth := path.Join(basepth, "/hosts", hostID) t := conn.NewTransaction() if err := rmr(conn, t, pth); err != nil { return err } if err := t.Commit(); err != nil { r...
go
func removeHost(conn client.Connection, poolID, hostID string) error { basepth := "" if poolID != "" { basepth = path.Join("/pools", poolID) } pth := path.Join(basepth, "/hosts", hostID) t := conn.NewTransaction() if err := rmr(conn, t, pth); err != nil { return err } if err := t.Commit(); err != nil { r...
[ "func", "removeHost", "(", "conn", "client", ".", "Connection", ",", "poolID", ",", "hostID", "string", ")", "error", "{", "basepth", ":=", "\"", "\"", "\n", "if", "poolID", "!=", "\"", "\"", "{", "basepth", "=", "path", ".", "Join", "(", "\"", "\"",...
// removeHost deletes a host from zookeeper
[ "removeHost", "deletes", "a", "host", "from", "zookeeper" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/host.go#L193-L208
139,872
control-center/serviced
zzk/service/host.go
rmr
func rmr(conn client.Connection, t client.Transaction, pth string) error { ch, err := conn.Children(pth) if err == client.ErrNoNode { return nil } else if err != nil { return err } for _, n := range ch { if err := rmr(conn, t, path.Join(pth, n)); err != nil { return err } } t.Delete(pth) return nil ...
go
func rmr(conn client.Connection, t client.Transaction, pth string) error { ch, err := conn.Children(pth) if err == client.ErrNoNode { return nil } else if err != nil { return err } for _, n := range ch { if err := rmr(conn, t, path.Join(pth, n)); err != nil { return err } } t.Delete(pth) return nil ...
[ "func", "rmr", "(", "conn", "client", ".", "Connection", ",", "t", "client", ".", "Transaction", ",", "pth", "string", ")", "error", "{", "ch", ",", "err", ":=", "conn", ".", "Children", "(", "pth", ")", "\n", "if", "err", "==", "client", ".", "Err...
// rmr is a recursive delete via transaction
[ "rmr", "is", "a", "recursive", "delete", "via", "transaction" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/host.go#L211-L226
139,873
control-center/serviced
zzk/service/host.go
GetCurrentHosts
func GetCurrentHosts(conn client.Connection, poolid string) ([]string, error) { logger := plog.WithField("poolid", poolid) onlineHosts := make([]string, 0) pth := path.Join("/pools", poolid, "hosts") ch, err := conn.Children(pth) if err != nil && err != client.ErrNoNode { logger.WithError(err).Debug("Could not...
go
func GetCurrentHosts(conn client.Connection, poolid string) ([]string, error) { logger := plog.WithField("poolid", poolid) onlineHosts := make([]string, 0) pth := path.Join("/pools", poolid, "hosts") ch, err := conn.Children(pth) if err != nil && err != client.ErrNoNode { logger.WithError(err).Debug("Could not...
[ "func", "GetCurrentHosts", "(", "conn", "client", ".", "Connection", ",", "poolid", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ",", "poolid", ")", "\n\n", "onlineHosts", ":...
// GetCurrentHosts returns the list of hosts that are currently active in a // resource pool.
[ "GetCurrentHosts", "returns", "the", "list", "of", "hosts", "that", "are", "currently", "active", "in", "a", "resource", "pool", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/host.go#L274-L300
139,874
control-center/serviced
zzk/service/host.go
IsHostOnline
func IsHostOnline(conn client.Connection, poolid, hostid string) (bool, error) { logger := plog.WithField("hostid", hostid) basepth := "/" if poolid != "" { basepth = path.Join("/pools", poolid) } pth := path.Join(basepth, "/hosts", hostid, "online") ch, err := conn.Children(pth) if err != nil && err != clie...
go
func IsHostOnline(conn client.Connection, poolid, hostid string) (bool, error) { logger := plog.WithField("hostid", hostid) basepth := "/" if poolid != "" { basepth = path.Join("/pools", poolid) } pth := path.Join(basepth, "/hosts", hostid, "online") ch, err := conn.Children(pth) if err != nil && err != clie...
[ "func", "IsHostOnline", "(", "conn", "client", ".", "Connection", ",", "poolid", ",", "hostid", "string", ")", "(", "bool", ",", "error", ")", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ",", "hostid", ")", "\n\n", "basepth", ":=", ...
// IsHostOnline returns true if a provided host is currently active.
[ "IsHostOnline", "returns", "true", "if", "a", "provided", "host", "is", "currently", "active", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/host.go#L303-L319
139,875
control-center/serviced
dfs/nfs/server.go
NewServer
func NewServer(basePath, exportedName, network string) (*Server, error) { if len(exportedName) < 2 || strings.Contains(exportedName, "/") { return nil, ErrInvalidExportedName } if len(basePath) < 2 { return nil, ErrInvalidBasePath } if err := verifyExportsDir(basePath); err != nil { return nil, err } expo...
go
func NewServer(basePath, exportedName, network string) (*Server, error) { if len(exportedName) < 2 || strings.Contains(exportedName, "/") { return nil, ErrInvalidExportedName } if len(basePath) < 2 { return nil, ErrInvalidBasePath } if err := verifyExportsDir(basePath); err != nil { return nil, err } expo...
[ "func", "NewServer", "(", "basePath", ",", "exportedName", ",", "network", "string", ")", "(", "*", "Server", ",", "error", ")", "{", "if", "len", "(", "exportedName", ")", "<", "2", "||", "strings", ".", "Contains", "(", "exportedName", ",", "\"", "\"...
// NewServer returns a nfs.Server object that manages the given nfs mounts to // configured clients; basePath is the path for volumes, exportedName is the container dir to hold exported volumes
[ "NewServer", "returns", "a", "nfs", ".", "Server", "object", "that", "manages", "the", "given", "nfs", "mounts", "to", "configured", "clients", ";", "basePath", "is", "the", "path", "for", "volumes", "exportedName", "is", "the", "container", "dir", "to", "ho...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L111-L147
139,876
control-center/serviced
dfs/nfs/server.go
GetDevice
func (c *Server) GetDevice(path string) (uint64, error) { // Get sys stats on the paths. stat, err := os.Stat(path) if err != nil { return 0, fmt.Errorf("Unable to get volume stats for %s: %s", path, err) } // Cast each of the stats to a syscall.Stat_t to get the device information. sysStat1, ok := stat.Sys()....
go
func (c *Server) GetDevice(path string) (uint64, error) { // Get sys stats on the paths. stat, err := os.Stat(path) if err != nil { return 0, fmt.Errorf("Unable to get volume stats for %s: %s", path, err) } // Cast each of the stats to a syscall.Stat_t to get the device information. sysStat1, ok := stat.Sys()....
[ "func", "(", "c", "*", "Server", ")", "GetDevice", "(", "path", "string", ")", "(", "uint64", ",", "error", ")", "{", "// Get sys stats on the paths.", "stat", ",", "err", ":=", "os", ".", "Stat", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{"...
// Returns the backing device for a given path. Set on the Driver object to // make the mount device check testable.
[ "Returns", "the", "backing", "device", "for", "a", "given", "path", ".", "Set", "on", "the", "Driver", "object", "to", "make", "the", "mount", "device", "check", "testable", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L161-L174
139,877
control-center/serviced
dfs/nfs/server.go
Clients
func (c *Server) Clients() []string { clients := make([]string, len(c.clients)) i := 0 for key := range c.clients { clients[i] = key } return clients }
go
func (c *Server) Clients() []string { clients := make([]string, len(c.clients)) i := 0 for key := range c.clients { clients[i] = key } return clients }
[ "func", "(", "c", "*", "Server", ")", "Clients", "(", ")", "[", "]", "string", "{", "clients", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "c", ".", "clients", ")", ")", "\n", "i", ":=", "0", "\n", "for", "key", ":=", "range", "c"...
// Clients returns the IP Addresses of the current clients
[ "Clients", "returns", "the", "IP", "Addresses", "of", "the", "current", "clients" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L177-L184
139,878
control-center/serviced
dfs/nfs/server.go
SetClients
func (c *Server) SetClients(clients ...string) { c.Lock() defer c.Unlock() filteredClients := c.filterHostsWithoutDfsPerms(clients) c.clients = make(map[string]struct{}) for _, client := range filteredClients { c.clients[client] = struct{}{} } }
go
func (c *Server) SetClients(clients ...string) { c.Lock() defer c.Unlock() filteredClients := c.filterHostsWithoutDfsPerms(clients) c.clients = make(map[string]struct{}) for _, client := range filteredClients { c.clients[client] = struct{}{} } }
[ "func", "(", "c", "*", "Server", ")", "SetClients", "(", "clients", "...", "string", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "filteredClients", ":=", "c", ".", "filterHostsWithoutDfsPerms", "(", "clients...
// SetClients replaces the existing clients with the new clients
[ "SetClients", "replaces", "the", "existing", "clients", "with", "the", "new", "clients" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L206-L215
139,879
control-center/serviced
dfs/nfs/server.go
Sync
func (c *Server) Sync() error { c.Lock() defer c.Unlock() if err := c.hostsDeny(); err != nil { glog.Errorf("error writing host deny %v", err) return err } if err := c.hostsAllow(); err != nil { glog.Errorf("error writing host allow %v", err) return err } if err := c.writeExports(); err != nil { glog.E...
go
func (c *Server) Sync() error { c.Lock() defer c.Unlock() if err := c.hostsDeny(); err != nil { glog.Errorf("error writing host deny %v", err) return err } if err := c.hostsAllow(); err != nil { glog.Errorf("error writing host allow %v", err) return err } if err := c.writeExports(); err != nil { glog.E...
[ "func", "(", "c", "*", "Server", ")", "Sync", "(", ")", "error", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "c", ".", "hostsDeny", "(", ")", ";", "err", "!=", "nil", "{", "glog", "...
// Sync ensures that the nfs exports are visible to all clients
[ "Sync", "ensures", "that", "the", "nfs", "exports", "are", "visible", "to", "all", "clients" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L235-L260
139,880
control-center/serviced
dfs/nfs/server.go
Restart
func (c *Server) Restart() error { c.Lock() defer c.Unlock() if err := c.hostsDeny(); err != nil { return err } if err := c.hostsAllow(); err != nil { return err } if err := c.writeExports(); err != nil { return err } if err := restart(); err != nil { return err } c.cleanupBindMounts() return nil }
go
func (c *Server) Restart() error { c.Lock() defer c.Unlock() if err := c.hostsDeny(); err != nil { return err } if err := c.hostsAllow(); err != nil { return err } if err := c.writeExports(); err != nil { return err } if err := restart(); err != nil { return err } c.cleanupBindMounts() return nil }
[ "func", "(", "c", "*", "Server", ")", "Restart", "(", ")", "error", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "c", ".", "hostsDeny", "(", ")", ";", "err", "!=", "nil", "{", "return"...
// Restart restarts the nfs subsystem
[ "Restart", "restarts", "the", "nfs", "subsystem" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L263-L280
139,881
control-center/serviced
dfs/nfs/server.go
Stop
func (c *Server) Stop() error { c.Lock() defer c.Unlock() if err := stop(); err != nil { glog.Errorf("err running stop %v", err) return err } c.cleanupBindMounts() return nil }
go
func (c *Server) Stop() error { c.Lock() defer c.Unlock() if err := stop(); err != nil { glog.Errorf("err running stop %v", err) return err } c.cleanupBindMounts() return nil }
[ "func", "(", "c", "*", "Server", ")", "Stop", "(", ")", "error", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "stop", "(", ")", ";", "err", "!=", "nil", "{", "glog", ".", "Errorf", "...
// Stop stops the nfs subsystem
[ "Stop", "stops", "the", "nfs", "subsystem" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L283-L292
139,882
control-center/serviced
dfs/nfs/server.go
cleanupBindMounts
func (c *Server) cleanupBindMounts() { edir := filepath.Join(exportsDir, c.exportedName) //umount any directories not exported if dirContents, err := ioutil.ReadDir(edir); err != nil { glog.Warningf("could not read contents of %s; %v", edir, err) } else { for _, file := range dirContents { if _, found := c.e...
go
func (c *Server) cleanupBindMounts() { edir := filepath.Join(exportsDir, c.exportedName) //umount any directories not exported if dirContents, err := ioutil.ReadDir(edir); err != nil { glog.Warningf("could not read contents of %s; %v", edir, err) } else { for _, file := range dirContents { if _, found := c.e...
[ "func", "(", "c", "*", "Server", ")", "cleanupBindMounts", "(", ")", "{", "edir", ":=", "filepath", ".", "Join", "(", "exportsDir", ",", "c", ".", "exportedName", ")", "\n", "//umount any directories not exported", "if", "dirContents", ",", "err", ":=", "iou...
// umnount any bind mounts in exported directory if not exported
[ "umnount", "any", "bind", "mounts", "in", "exported", "directory", "if", "not", "exported" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L419-L442
139,883
control-center/serviced
dfs/nfs/server.go
removeDeprecated
func (c *Server) removeDeprecated(dirpath string) { if dirContents, err := ioutil.ReadDir(dirpath); !os.IsNotExist(err) { if err != nil { glog.Warningf("Could not look up deprecated exports path %s: %s", dirpath, err) return } // Unmount path if err := mp.Unmount(dirpath); err != nil { glog.Warningf(...
go
func (c *Server) removeDeprecated(dirpath string) { if dirContents, err := ioutil.ReadDir(dirpath); !os.IsNotExist(err) { if err != nil { glog.Warningf("Could not look up deprecated exports path %s: %s", dirpath, err) return } // Unmount path if err := mp.Unmount(dirpath); err != nil { glog.Warningf(...
[ "func", "(", "c", "*", "Server", ")", "removeDeprecated", "(", "dirpath", "string", ")", "{", "if", "dirContents", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "dirpath", ")", ";", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", "err", ...
// removeDeprecated will clean up any old exports path
[ "removeDeprecated", "will", "clean", "up", "any", "old", "exports", "path" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L445-L469
139,884
control-center/serviced
dfs/nfs/server.go
bindMountImp
func bindMountImp(src, dst string) error { glog.Infof("bindMount %s at %s", src, dst) if mounted, err := mp.IsMounted(dst); err != nil { return err } else if mounted { return nil } if err := os.MkdirAll(dst, 0775); err != nil { return err } runMountCommand := func(options ...string) ([]byte, error) { cmd...
go
func bindMountImp(src, dst string) error { glog.Infof("bindMount %s at %s", src, dst) if mounted, err := mp.IsMounted(dst); err != nil { return err } else if mounted { return nil } if err := os.MkdirAll(dst, 0775); err != nil { return err } runMountCommand := func(options ...string) ([]byte, error) { cmd...
[ "func", "bindMountImp", "(", "src", ",", "dst", "string", ")", "error", "{", "glog", ".", "Infof", "(", "\"", "\"", ",", "src", ",", "dst", ")", "\n", "if", "mounted", ",", "err", ":=", "mp", ".", "IsMounted", "(", "dst", ")", ";", "err", "!=", ...
// bindMountImp performs a bind mount of src to dst.
[ "bindMountImp", "performs", "a", "bind", "mount", "of", "src", "to", "dst", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/server.go#L476-L506
139,885
control-center/serviced
cli/cmd/template.go
initTemplate
func (c *ServicedCli) initTemplate() { c.app.Commands = append(c.app.Commands, cli.Command{ Name: "template", Usage: "Administers templates", Description: "", Subcommands: []cli.Command{ { Name: "list", Usage: "Lists all templates", Description: "serviced template li...
go
func (c *ServicedCli) initTemplate() { c.app.Commands = append(c.app.Commands, cli.Command{ Name: "template", Usage: "Administers templates", Description: "", Subcommands: []cli.Command{ { Name: "list", Usage: "Lists all templates", Description: "serviced template li...
[ "func", "(", "c", "*", "ServicedCli", ")", "initTemplate", "(", ")", "{", "c", ".", "app", ".", "Commands", "=", "append", "(", "c", ".", "app", ".", "Commands", ",", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", ...
// initTemplate is the initializer for serviced template
[ "initTemplate", "is", "the", "initializer", "for", "serviced", "template" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L30-L92
139,886
control-center/serviced
cli/cmd/template.go
templates
func (c *ServicedCli) templates() (data []string) { templates, err := c.driver.GetServiceTemplates() if err != nil || templates == nil || len(templates) == 0 { return } data = make([]string, len(templates)) for i, t := range templates { data[i] = t.ID } return }
go
func (c *ServicedCli) templates() (data []string) { templates, err := c.driver.GetServiceTemplates() if err != nil || templates == nil || len(templates) == 0 { return } data = make([]string, len(templates)) for i, t := range templates { data[i] = t.ID } return }
[ "func", "(", "c", "*", "ServicedCli", ")", "templates", "(", ")", "(", "data", "[", "]", "string", ")", "{", "templates", ",", "err", ":=", "c", ".", "driver", ".", "GetServiceTemplates", "(", ")", "\n", "if", "err", "!=", "nil", "||", "templates", ...
// Returns a list of all available template IDs
[ "Returns", "a", "list", "of", "all", "available", "template", "IDs" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L95-L107
139,887
control-center/serviced
cli/cmd/template.go
printTemplatesFirst
func (c *ServicedCli) printTemplatesFirst(ctx *cli.Context) { if len(ctx.Args()) > 0 { return } for _, t := range c.templates() { fmt.Println(t) } }
go
func (c *ServicedCli) printTemplatesFirst(ctx *cli.Context) { if len(ctx.Args()) > 0 { return } for _, t := range c.templates() { fmt.Println(t) } }
[ "func", "(", "c", "*", "ServicedCli", ")", "printTemplatesFirst", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "0", "{", "return", "\n", "}", "\n\n", "for", "_", ",", "t", ":=", "ra...
// Bash-completion command that prints the list of templates as the first // argument
[ "Bash", "-", "completion", "command", "that", "prints", "the", "list", "of", "templates", "as", "the", "first", "argument" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L111-L119
139,888
control-center/serviced
cli/cmd/template.go
printTemplateDeploy
func (c *ServicedCli) printTemplateDeploy(ctx *cli.Context) { var output []string switch len(ctx.Args()) { case 0: output = c.templates() case 1: output = c.pools() } for _, o := range output { fmt.Println(o) } }
go
func (c *ServicedCli) printTemplateDeploy(ctx *cli.Context) { var output []string switch len(ctx.Args()) { case 0: output = c.templates() case 1: output = c.pools() } for _, o := range output { fmt.Println(o) } }
[ "func", "(", "c", "*", "ServicedCli", ")", "printTemplateDeploy", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "var", "output", "[", "]", "string", "\n\n", "switch", "len", "(", "ctx", ".", "Args", "(", ")", ")", "{", "case", "0", ":", "output...
// Bash-completion command that prints the command options for // serviced template deploy
[ "Bash", "-", "completion", "command", "that", "prints", "the", "command", "options", "for", "serviced", "template", "deploy" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L123-L136
139,889
control-center/serviced
cli/cmd/template.go
printTemplatesAll
func (c *ServicedCli) printTemplatesAll(ctx *cli.Context) { args := ctx.Args() for _, t := range c.templates() { for _, a := range args { if t == a { goto next } } fmt.Println(t) next: } }
go
func (c *ServicedCli) printTemplatesAll(ctx *cli.Context) { args := ctx.Args() for _, t := range c.templates() { for _, a := range args { if t == a { goto next } } fmt.Println(t) next: } }
[ "func", "(", "c", "*", "ServicedCli", ")", "printTemplatesAll", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n\n", "for", "_", ",", "t", ":=", "range", "c", ".", "templates", "(", ")", "{", "for"...
// Bash-completion command that prints the list of templates as all arguments
[ "Bash", "-", "completion", "command", "that", "prints", "the", "list", "of", "templates", "as", "all", "arguments" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L139-L151
139,890
control-center/serviced
cli/cmd/template.go
cmdTemplateAdd
func (c *ServicedCli) cmdTemplateAdd(ctx *cli.Context) { var input *os.File if filepath := ctx.Args().First(); filepath != "" { var err error if input, err = os.Open(filepath); err != nil { fmt.Fprintln(os.Stderr, err) return } defer input.Close() } else { input = os.Stdin } if template, err := c...
go
func (c *ServicedCli) cmdTemplateAdd(ctx *cli.Context) { var input *os.File if filepath := ctx.Args().First(); filepath != "" { var err error if input, err = os.Open(filepath); err != nil { fmt.Fprintln(os.Stderr, err) return } defer input.Close() } else { input = os.Stdin } if template, err := c...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdTemplateAdd", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "var", "input", "*", "os", ".", "File", "\n\n", "if", "filepath", ":=", "ctx", ".", "Args", "(", ")", ".", "First", "(", ")", ";", "fil...
// serviced template add TEMPLATE
[ "serviced", "template", "add", "TEMPLATE" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L199-L220
139,891
control-center/serviced
cli/cmd/template.go
cmdTemplateRemove
func (c *ServicedCli) cmdTemplateRemove(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "remove") return } for _, id := range args { if err := c.driver.RemoveServiceTemplate(id); err != nil { fmt.Fprintf(os.Stderr, "%s: %s\n", id, err...
go
func (c *ServicedCli) cmdTemplateRemove(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "remove") return } for _, id := range args { if err := c.driver.RemoveServiceTemplate(id); err != nil { fmt.Fprintf(os.Stderr, "%s: %s\n", id, err...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdTemplateRemove", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "<", "1", "{", "fmt", ".", "Printf", "(", "\"", "...
// serviced template remove TEMPLATEID ...
[ "serviced", "template", "remove", "TEMPLATEID", "..." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/template.go#L223-L238
139,892
control-center/serviced
cli/cmd/cmd.go
Run
func (c *ServicedCli) Run(args []string) { if err := c.app.Run(args); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) } }
go
func (c *ServicedCli) Run(args []string) { if err := c.app.Run(args); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) } }
[ "func", "(", "c", "*", "ServicedCli", ")", "Run", "(", "args", "[", "]", "string", ")", "{", "if", "err", ":=", "c", ".", "app", ".", "Run", "(", "args", ")", ";", "err", "!=", "nil", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",",...
// Run builds the command-line interface for serviced and runs.
[ "Run", "builds", "the", "command", "-", "line", "interface", "for", "serviced", "and", "runs", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/cmd.go#L192-L196
139,893
control-center/serviced
cli/api/elastigologdriver.go
LogstashDays
func (driver *elastigoLogDriver) LogstashDays() ([]string, error) { response, e := elastigo.DoCommand("GET", "/_aliases", nil) if e != nil { return []string{}, fmt.Errorf("couldn't fetch list of indices: %s", e) } var aliasMap map[string]interface{} if e = json.Unmarshal(response, &aliasMap); e != nil { return...
go
func (driver *elastigoLogDriver) LogstashDays() ([]string, error) { response, e := elastigo.DoCommand("GET", "/_aliases", nil) if e != nil { return []string{}, fmt.Errorf("couldn't fetch list of indices: %s", e) } var aliasMap map[string]interface{} if e = json.Unmarshal(response, &aliasMap); e != nil { return...
[ "func", "(", "driver", "*", "elastigoLogDriver", ")", "LogstashDays", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "response", ",", "e", ":=", "elastigo", ".", "DoCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ")", "\n", "if"...
// Returns a list of all the dates for which a logstash-YYYY.MM.DD index is available in ES logstash. // The strings are in YYYY.MM.DD format, and in reverse chronological order.
[ "Returns", "a", "list", "of", "all", "the", "dates", "for", "which", "a", "logstash", "-", "YYYY", ".", "MM", ".", "DD", "index", "is", "available", "in", "ES", "logstash", ".", "The", "strings", "are", "in", "YYYY", ".", "MM", ".", "DD", "format", ...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/elastigologdriver.go#L56-L76
139,894
control-center/serviced
cli/api/elastigologdriver.go
ScrollSearch
func (driver *elastigoLogDriver) ScrollSearch(scrollID string) (elastigocore.SearchResult, error) { prettyPrint := false return elastigocore.Scroll(prettyPrint, scrollID, esLogstashScrollTimeout) }
go
func (driver *elastigoLogDriver) ScrollSearch(scrollID string) (elastigocore.SearchResult, error) { prettyPrint := false return elastigocore.Scroll(prettyPrint, scrollID, esLogstashScrollTimeout) }
[ "func", "(", "driver", "*", "elastigoLogDriver", ")", "ScrollSearch", "(", "scrollID", "string", ")", "(", "elastigocore", ".", "SearchResult", ",", "error", ")", "{", "prettyPrint", ":=", "false", "\n", "return", "elastigocore", ".", "Scroll", "(", "prettyPri...
// Scroll to the next set of search results
[ "Scroll", "to", "the", "next", "set", "of", "search", "results" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/elastigologdriver.go#L92-L95
139,895
control-center/serviced
tools/serviced-storage/thinpool.go
runCommand
func runCommand(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error) { var stderrBuffer bytes.Buffer var stdoutBuffer bytes.Buffer cmd.Stderr = &stderrBuffer cmd.Stdout = &stdoutBuffer cmdErr := cmd.Run() exitCode, success := utils.GetExitStatus(cmdErr) if success { cmdErr = nil } return st...
go
func runCommand(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error) { var stderrBuffer bytes.Buffer var stdoutBuffer bytes.Buffer cmd.Stderr = &stderrBuffer cmd.Stdout = &stdoutBuffer cmdErr := cmd.Run() exitCode, success := utils.GetExitStatus(cmdErr) if success { cmdErr = nil } return st...
[ "func", "runCommand", "(", "cmd", "*", "exec", ".", "Cmd", ")", "(", "stdout", "string", ",", "stderr", "string", ",", "exitCode", "int", ",", "err", "error", ")", "{", "var", "stderrBuffer", "bytes", ".", "Buffer", "\n", "var", "stdoutBuffer", "bytes", ...
// runCommand runs the command and returns the stdout, stderr, exit code, and error. // If the command ran but returned non-zero, the error is nil
[ "runCommand", "runs", "the", "command", "and", "returns", "the", "stdout", "stderr", "exit", "code", "and", "error", ".", "If", "the", "command", "ran", "but", "returned", "non", "-", "zero", "the", "error", "is", "nil" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/thinpool.go#L46-L57
139,896
control-center/serviced
rpc/master/service_server.go
ServiceUse
func (s *Server) ServiceUse(request *ServiceUseRequest, response *string) error { if err := s.f.ServiceUse(s.context(), request.ServiceID, request.ImageID, request.Registry, request.ReplaceImgs, request.NoOp); err != nil { return err } *response = "" return nil }
go
func (s *Server) ServiceUse(request *ServiceUseRequest, response *string) error { if err := s.f.ServiceUse(s.context(), request.ServiceID, request.ImageID, request.Registry, request.ReplaceImgs, request.NoOp); err != nil { return err } *response = "" return nil }
[ "func", "(", "s", "*", "Server", ")", "ServiceUse", "(", "request", "*", "ServiceUseRequest", ",", "response", "*", "string", ")", "error", "{", "if", "err", ":=", "s", ".", "f", ".", "ServiceUse", "(", "s", ".", "context", "(", ")", ",", "request", ...
// Use a new image for a given service - this will pull the image and tag it
[ "Use", "a", "new", "image", "for", "a", "given", "service", "-", "this", "will", "pull", "the", "image", "and", "tag", "it" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_server.go#L60-L66
139,897
control-center/serviced
rpc/master/service_server.go
WaitService
func (s *Server) WaitService(request *WaitServiceRequest, throwaway *string) error { err := s.f.WaitService(s.context(), request.State, request.Timeout, request.Recursive, request.ServiceIDs...) return err }
go
func (s *Server) WaitService(request *WaitServiceRequest, throwaway *string) error { err := s.f.WaitService(s.context(), request.State, request.Timeout, request.Recursive, request.ServiceIDs...) return err }
[ "func", "(", "s", "*", "Server", ")", "WaitService", "(", "request", "*", "WaitServiceRequest", ",", "throwaway", "*", "string", ")", "error", "{", "err", ":=", "s", ".", "f", ".", "WaitService", "(", "s", ".", "context", "(", ")", ",", "request", "....
// Wait on specified services to be in the given state
[ "Wait", "on", "specified", "services", "to", "be", "in", "the", "given", "state" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_server.go#L69-L72
139,898
control-center/serviced
rpc/master/service_server.go
GetService
func (s *Server) GetService(serviceID string, svc *service.Service) error { sv, err := s.f.GetService(s.context(), serviceID) if err != nil { return err } *svc = *sv return nil }
go
func (s *Server) GetService(serviceID string, svc *service.Service) error { sv, err := s.f.GetService(s.context(), serviceID) if err != nil { return err } *svc = *sv return nil }
[ "func", "(", "s", "*", "Server", ")", "GetService", "(", "serviceID", "string", ",", "svc", "*", "service", ".", "Service", ")", "error", "{", "sv", ",", "err", ":=", "s", ".", "f", ".", "GetService", "(", "s", ".", "context", "(", ")", ",", "ser...
// Get a specific service
[ "Get", "a", "specific", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_server.go#L105-L112
139,899
control-center/serviced
dfs/list.go
List
func (dfs *DistributedFilesystem) List(tenantID string) ([]string, error) { vol, err := dfs.disk.Get(tenantID) if err != nil { glog.Errorf("Could not get volume for tenant %s: %s", tenantID, err) return nil, err } snapshots, err := vol.Snapshots() if err != nil { glog.Errorf("Could not get snapshots for tena...
go
func (dfs *DistributedFilesystem) List(tenantID string) ([]string, error) { vol, err := dfs.disk.Get(tenantID) if err != nil { glog.Errorf("Could not get volume for tenant %s: %s", tenantID, err) return nil, err } snapshots, err := vol.Snapshots() if err != nil { glog.Errorf("Could not get snapshots for tena...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "List", "(", "tenantID", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "vol", ",", "err", ":=", "dfs", ".", "disk", ".", "Get", "(", "tenantID", ")", "\n", "if", "err", "!=", ...
// List returns the list of snapshots for a given tenant.
[ "List", "returns", "the", "list", "of", "snapshots", "for", "a", "given", "tenant", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/list.go#L19-L31