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,500 | control-center/serviced | rpc/rpcutils/authcodec.go | Close | func (a *AuthClientCodec) Close() error {
var err error
if err = a.wrappedcodec.Close(); err != nil {
log.WithError(err).Debug("Error closing wrapped RPC client codec")
}
if ourErr := a.conn.Close(); ourErr != nil {
log.WithError(ourErr).Debug("Error closing RPC client connection")
// This error is more impor... | go | func (a *AuthClientCodec) Close() error {
var err error
if err = a.wrappedcodec.Close(); err != nil {
log.WithError(err).Debug("Error closing wrapped RPC client codec")
}
if ourErr := a.conn.Close(); ourErr != nil {
log.WithError(ourErr).Debug("Error closing RPC client connection")
// This error is more impor... | [
"func",
"(",
"a",
"*",
"AuthClientCodec",
")",
"Close",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"if",
"err",
"=",
"a",
".",
"wrappedcodec",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
"err",
")... | // Closes the connection on the client side
// We don't change anything here, just let the underlying codec handle it. | [
"Closes",
"the",
"connection",
"on",
"the",
"client",
"side",
"We",
"don",
"t",
"change",
"anything",
"here",
"just",
"let",
"the",
"underlying",
"codec",
"handle",
"it",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/rpcutils/authcodec.go#L320-L331 |
139,501 | control-center/serviced | rpc/rpcutils/authcodec.go | NewDefaultAuthClient | func NewDefaultAuthClient(conn io.ReadWriteCloser) *rpc.Client {
return rpc.NewClientWithCodec(NewDefaultAuthClientCodec(conn))
} | go | func NewDefaultAuthClient(conn io.ReadWriteCloser) *rpc.Client {
return rpc.NewClientWithCodec(NewDefaultAuthClientCodec(conn))
} | [
"func",
"NewDefaultAuthClient",
"(",
"conn",
"io",
".",
"ReadWriteCloser",
")",
"*",
"rpc",
".",
"Client",
"{",
"return",
"rpc",
".",
"NewClientWithCodec",
"(",
"NewDefaultAuthClientCodec",
"(",
"conn",
")",
")",
"\n",
"}"
] | // NewDefaultAuthClient returns a new rpc.Client that uses our default client codec | [
"NewDefaultAuthClient",
"returns",
"a",
"new",
"rpc",
".",
"Client",
"that",
"uses",
"our",
"default",
"client",
"codec"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/rpcutils/authcodec.go#L334-L336 |
139,502 | control-center/serviced | commons/pool/pool.go | NewPool | func NewPool(capacity int, itemFactory ItemFactory) (Pool, error) {
q, err := queue.NewChannelQueue(capacity)
if err != nil {
return nil, err
}
itemMap := make(map[uint64]*Item)
pool := itemPool{itemMap: itemMap, itemQ: q, capacity: capacity, itemFactory: itemFactory}
return &pool, nil
} | go | func NewPool(capacity int, itemFactory ItemFactory) (Pool, error) {
q, err := queue.NewChannelQueue(capacity)
if err != nil {
return nil, err
}
itemMap := make(map[uint64]*Item)
pool := itemPool{itemMap: itemMap, itemQ: q, capacity: capacity, itemFactory: itemFactory}
return &pool, nil
} | [
"func",
"NewPool",
"(",
"capacity",
"int",
",",
"itemFactory",
"ItemFactory",
")",
"(",
"Pool",
",",
"error",
")",
"{",
"q",
",",
"err",
":=",
"queue",
".",
"NewChannelQueue",
"(",
"capacity",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
... | // NewPool create a pool with a capacity and factory for creating items. | [
"NewPool",
"create",
"a",
"pool",
"with",
"a",
"capacity",
"and",
"factory",
"for",
"creating",
"items",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/pool/pool.go#L63-L73 |
139,503 | control-center/serviced | commons/pool/pool.go | Borrowed | func (p *itemPool) Borrowed() int {
p.poolLock.RLock()
defer p.poolLock.RUnlock()
count := 0
for _, item := range p.itemMap {
if item.checkedOut {
count++
}
}
return count
} | go | func (p *itemPool) Borrowed() int {
p.poolLock.RLock()
defer p.poolLock.RUnlock()
count := 0
for _, item := range p.itemMap {
if item.checkedOut {
count++
}
}
return count
} | [
"func",
"(",
"p",
"*",
"itemPool",
")",
"Borrowed",
"(",
")",
"int",
"{",
"p",
".",
"poolLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"p",
".",
"poolLock",
".",
"RUnlock",
"(",
")",
"\n",
"count",
":=",
"0",
"\n",
"for",
"_",
",",
"item",
":="... | //Returns the current number of items borrowed | [
"Returns",
"the",
"current",
"number",
"of",
"items",
"borrowed"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/pool/pool.go#L177-L187 |
139,504 | control-center/serviced | commons/pool/pool.go | newItem | func (p *itemPool) newItem() (*Item, error) {
if len(p.itemMap) >= p.capacity {
return nil, ErrItemUnavailable
}
i, err := p.itemFactory()
if err != nil {
return nil, err
}
pItem := &Item{id: p.nextID(), Item: i}
p.itemMap[pItem.id] = pItem
return pItem, nil
} | go | func (p *itemPool) newItem() (*Item, error) {
if len(p.itemMap) >= p.capacity {
return nil, ErrItemUnavailable
}
i, err := p.itemFactory()
if err != nil {
return nil, err
}
pItem := &Item{id: p.nextID(), Item: i}
p.itemMap[pItem.id] = pItem
return pItem, nil
} | [
"func",
"(",
"p",
"*",
"itemPool",
")",
"newItem",
"(",
")",
"(",
"*",
"Item",
",",
"error",
")",
"{",
"if",
"len",
"(",
"p",
".",
"itemMap",
")",
">=",
"p",
".",
"capacity",
"{",
"return",
"nil",
",",
"ErrItemUnavailable",
"\n",
"}",
"\n",
"i",
... | // creates a new Item if it can | [
"creates",
"a",
"new",
"Item",
"if",
"it",
"can"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/pool/pool.go#L210-L222 |
139,505 | control-center/serviced | rpc/master/user_server.go | GetSystemUser | func (s *Server) GetSystemUser(unused struct{}, systemUser *user.User) error {
result, err := s.f.GetSystemUser(s.context())
if err != nil {
return err
}
*systemUser = result
return nil
} | go | func (s *Server) GetSystemUser(unused struct{}, systemUser *user.User) error {
result, err := s.f.GetSystemUser(s.context())
if err != nil {
return err
}
*systemUser = result
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetSystemUser",
"(",
"unused",
"struct",
"{",
"}",
",",
"systemUser",
"*",
"user",
".",
"User",
")",
"error",
"{",
"result",
",",
"err",
":=",
"s",
".",
"f",
".",
"GetSystemUser",
"(",
"s",
".",
"context",
"("... | // Get the system user | [
"Get",
"the",
"system",
"user"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/user_server.go#L21-L28 |
139,506 | control-center/serviced | dfs/taginfo.go | TagInfo | func (dfs *DistributedFilesystem) TagInfo(tenantID, tagName string) (*SnapshotInfo, error) {
vol, err := dfs.disk.Get(tenantID)
if err != nil {
glog.Errorf("Could not get tenant volume %s: %s", tenantID, err)
return nil, err
}
info, err := vol.GetSnapshotWithTag(tagName)
if err != nil {
glog.Errorf("Could no... | go | func (dfs *DistributedFilesystem) TagInfo(tenantID, tagName string) (*SnapshotInfo, error) {
vol, err := dfs.disk.Get(tenantID)
if err != nil {
glog.Errorf("Could not get tenant volume %s: %s", tenantID, err)
return nil, err
}
info, err := vol.GetSnapshotWithTag(tagName)
if err != nil {
glog.Errorf("Could no... | [
"func",
"(",
"dfs",
"*",
"DistributedFilesystem",
")",
"TagInfo",
"(",
"tenantID",
",",
"tagName",
"string",
")",
"(",
"*",
"SnapshotInfo",
",",
"error",
")",
"{",
"vol",
",",
"err",
":=",
"dfs",
".",
"disk",
".",
"Get",
"(",
"tenantID",
")",
"\n",
"... | // TagInfo returns information about an existing snapshot referenced by tag. | [
"TagInfo",
"returns",
"information",
"about",
"an",
"existing",
"snapshot",
"referenced",
"by",
"tag",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/taginfo.go#L19-L31 |
139,507 | control-center/serviced | utils/parser.go | parse | func (p *EnvironConfigReader) parse(reader io.Reader) error {
var (
line string
err error
)
bufReader := bufio.NewReader(reader)
for err != io.EOF {
line, err = bufReader.ReadString('\n')
if err != nil && err != io.EOF {
return err
}
line = strings.TrimSpace(strings.Split(line, "#")[0])
if err :... | go | func (p *EnvironConfigReader) parse(reader io.Reader) error {
var (
line string
err error
)
bufReader := bufio.NewReader(reader)
for err != io.EOF {
line, err = bufReader.ReadString('\n')
if err != nil && err != io.EOF {
return err
}
line = strings.TrimSpace(strings.Split(line, "#")[0])
if err :... | [
"func",
"(",
"p",
"*",
"EnvironConfigReader",
")",
"parse",
"(",
"reader",
"io",
".",
"Reader",
")",
"error",
"{",
"var",
"(",
"line",
"string",
"\n",
"err",
"error",
"\n",
")",
"\n\n",
"bufReader",
":=",
"bufio",
".",
"NewReader",
"(",
"reader",
")",
... | // parse is a really dumb reader parser. It maps only key values in the form
// of key=value and strips whitespaces surrounding either field. If the format
// does not match, then and error will return. | [
"parse",
"is",
"a",
"really",
"dumb",
"reader",
"parser",
".",
"It",
"maps",
"only",
"key",
"values",
"in",
"the",
"form",
"of",
"key",
"=",
"value",
"and",
"strips",
"whitespaces",
"surrounding",
"either",
"field",
".",
"If",
"the",
"format",
"does",
"n... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/parser.go#L79-L98 |
139,508 | control-center/serviced | domain/host/utils.go | currentHost | func currentHost(ip string, rpcPort int, poolID string) (host *Host, err error) {
cpus := runtime.NumCPU()
memory, err := utils.GetMemorySize()
if err != nil {
return nil, err
}
host = New()
hostname, err := os.Hostname()
if err != nil {
return nil, err
}
host.Name = hostname
hostidStr, err := utils.HostI... | go | func currentHost(ip string, rpcPort int, poolID string) (host *Host, err error) {
cpus := runtime.NumCPU()
memory, err := utils.GetMemorySize()
if err != nil {
return nil, err
}
host = New()
hostname, err := os.Hostname()
if err != nil {
return nil, err
}
host.Name = hostname
hostidStr, err := utils.HostI... | [
"func",
"currentHost",
"(",
"ip",
"string",
",",
"rpcPort",
"int",
",",
"poolID",
"string",
")",
"(",
"host",
"*",
"Host",
",",
"err",
"error",
")",
"{",
"cpus",
":=",
"runtime",
".",
"NumCPU",
"(",
")",
"\n",
"memory",
",",
"err",
":=",
"utils",
"... | // currentHost creates a Host object of the representing the host where this method is invoked. The passed in poolID is
// used as the resource pool in the result. | [
"currentHost",
"creates",
"a",
"Host",
"object",
"of",
"the",
"representing",
"the",
"host",
"where",
"this",
"method",
"is",
"invoked",
".",
"The",
"passed",
"in",
"poolID",
"is",
"used",
"as",
"the",
"resource",
"pool",
"in",
"the",
"result",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/host/utils.go#L45-L115 |
139,509 | control-center/serviced | domain/host/utils.go | getIPResources | func getIPResources(hostID string, hostIP string, staticIPs ...string) ([]HostIPResource, error) {
//make a map of all ipaddresses to interface
ifacemap, err := getInterfaceMap()
if err != nil {
return nil, err
}
hostLogger := plog.WithFields(log.Fields{
"hostid": hostID,
"hostip": hostIP,
})
hostLogger.W... | go | func getIPResources(hostID string, hostIP string, staticIPs ...string) ([]HostIPResource, error) {
//make a map of all ipaddresses to interface
ifacemap, err := getInterfaceMap()
if err != nil {
return nil, err
}
hostLogger := plog.WithFields(log.Fields{
"hostid": hostID,
"hostip": hostIP,
})
hostLogger.W... | [
"func",
"getIPResources",
"(",
"hostID",
"string",
",",
"hostIP",
"string",
",",
"staticIPs",
"...",
"string",
")",
"(",
"[",
"]",
"HostIPResource",
",",
"error",
")",
"{",
"//make a map of all ipaddresses to interface",
"ifacemap",
",",
"err",
":=",
"getInterface... | // getIPResources does the actual work of determining the IPs on the host. Parameters are the IPs to filter on | [
"getIPResources",
"does",
"the",
"actual",
"work",
"of",
"determining",
"the",
"IPs",
"on",
"the",
"host",
".",
"Parameters",
"are",
"the",
"IPs",
"to",
"filter",
"on"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/host/utils.go#L133-L180 |
139,510 | control-center/serviced | domain/host/utils.go | getInterfaceMap | func getInterfaceMap() (map[string]net.Interface, error) {
interfaces, err := net.Interfaces()
if err != nil {
plog.WithError(err).Debug("Unable to read network interfaces")
return nil, err
}
//make a of all ipaddresses to interface
ips := make(map[string]net.Interface)
for _, iface := range interfaces {
a... | go | func getInterfaceMap() (map[string]net.Interface, error) {
interfaces, err := net.Interfaces()
if err != nil {
plog.WithError(err).Debug("Unable to read network interfaces")
return nil, err
}
//make a of all ipaddresses to interface
ips := make(map[string]net.Interface)
for _, iface := range interfaces {
a... | [
"func",
"getInterfaceMap",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"net",
".",
"Interface",
",",
"error",
")",
"{",
"interfaces",
",",
"err",
":=",
"net",
".",
"Interfaces",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"plog",
".",
"WithError",
... | // getInterfaceMap returns a map of ip string to net.Interface | [
"getInterfaceMap",
"returns",
"a",
"map",
"of",
"ip",
"string",
"to",
"net",
".",
"Interface"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/host/utils.go#L183-L205 |
139,511 | control-center/serviced | commons/docker/ttl.go | RunTTL | func RunTTL(cancel <-chan interface{}, min, max time.Duration) {
utils.RunTTL(DockerTTL{}, cancel, min, max)
} | go | func RunTTL(cancel <-chan interface{}, min, max time.Duration) {
utils.RunTTL(DockerTTL{}, cancel, min, max)
} | [
"func",
"RunTTL",
"(",
"cancel",
"<-",
"chan",
"interface",
"{",
"}",
",",
"min",
",",
"max",
"time",
".",
"Duration",
")",
"{",
"utils",
".",
"RunTTL",
"(",
"DockerTTL",
"{",
"}",
",",
"cancel",
",",
"min",
",",
"max",
")",
"\n",
"}"
] | // RunTTL starts the ttl to reap stale docker containers. | [
"RunTTL",
"starts",
"the",
"ttl",
"to",
"reap",
"stale",
"docker",
"containers",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/ttl.go#L27-L29 |
139,512 | control-center/serviced | commons/docker/ttl.go | Purge | func (ttl DockerTTL) Purge(age time.Duration) (time.Duration, error) {
expire := time.Now().Add(-age)
ctrs, err := Containers()
if err != nil {
glog.Errorf("Could not look up containers: %s", err)
return 0, err
}
for _, ctr := range ctrs {
if finishTime := ctr.State.FinishedAt; finishTime.Unix() <= 0 || ctr.... | go | func (ttl DockerTTL) Purge(age time.Duration) (time.Duration, error) {
expire := time.Now().Add(-age)
ctrs, err := Containers()
if err != nil {
glog.Errorf("Could not look up containers: %s", err)
return 0, err
}
for _, ctr := range ctrs {
if finishTime := ctr.State.FinishedAt; finishTime.Unix() <= 0 || ctr.... | [
"func",
"(",
"ttl",
"DockerTTL",
")",
"Purge",
"(",
"age",
"time",
".",
"Duration",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"expire",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"-",
"age",
")",
"\n",
"ctrs",
",",
"e... | // Purge cleans up old docker containers and returns the time to live til the
// next purge.
// Implements utils.TTL | [
"Purge",
"cleans",
"up",
"old",
"docker",
"containers",
"and",
"returns",
"the",
"time",
"to",
"live",
"til",
"the",
"next",
"purge",
".",
"Implements",
"utils",
".",
"TTL"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/ttl.go#L39-L64 |
139,513 | control-center/serviced | domain/addressassignment/validation.go | ValidEntity | func (a *AddressAssignment) ValidEntity() error {
v := validation.NewValidationError()
v.Add(validation.NotEmpty("ServiceID", a.ServiceID))
v.Add(validation.NotEmpty("EndpointName", a.EndpointName))
v.Add(validation.IsIP(a.IPAddr))
v.Add(validation.ValidPort(int(a.Port)))
switch a.AssignmentType {
case commons.S... | go | func (a *AddressAssignment) ValidEntity() error {
v := validation.NewValidationError()
v.Add(validation.NotEmpty("ServiceID", a.ServiceID))
v.Add(validation.NotEmpty("EndpointName", a.EndpointName))
v.Add(validation.IsIP(a.IPAddr))
v.Add(validation.ValidPort(int(a.Port)))
switch a.AssignmentType {
case commons.S... | [
"func",
"(",
"a",
"*",
"AddressAssignment",
")",
"ValidEntity",
"(",
")",
"error",
"{",
"v",
":=",
"validation",
".",
"NewValidationError",
"(",
")",
"\n",
"v",
".",
"Add",
"(",
"validation",
".",
"NotEmpty",
"(",
"\"",
"\"",
",",
"a",
".",
"ServiceID"... | //ValidEntity used to make sure AddressAssignment is in a valid state | [
"ValidEntity",
"used",
"to",
"make",
"sure",
"AddressAssignment",
"is",
"in",
"a",
"valid",
"state"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/addressassignment/validation.go#L24-L47 |
139,514 | control-center/serviced | web/util.go | writeJSON | func writeJSON(w *rest.ResponseWriter, v interface{}, code int) {
w.Header().Set("content-type", "application/json")
w.WriteHeader(code)
err := w.WriteJson(v)
if err != nil {
panic(err)
}
} | go | func writeJSON(w *rest.ResponseWriter, v interface{}, code int) {
w.Header().Set("content-type", "application/json")
w.WriteHeader(code)
err := w.WriteJson(v)
if err != nil {
panic(err)
}
} | [
"func",
"writeJSON",
"(",
"w",
"*",
"rest",
".",
"ResponseWriter",
",",
"v",
"interface",
"{",
"}",
",",
"code",
"int",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(... | // WriteJSON struct as JSON with specified HTTP status code | [
"WriteJSON",
"struct",
"as",
"JSON",
"with",
"specified",
"HTTP",
"status",
"code"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/util.go#L92-L99 |
139,515 | control-center/serviced | facade/host.go | AddHostPrivate | func (f *Facade) AddHostPrivate(ctx datastore.Context, entity *host.Host) ([]byte, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddHostPrivate"))
alog := f.auditLogger.Message(ctx, "Adding Host with common key").Action(audit.Add).Entity(entity)
glog.V(2).Infof("Facade.AddHostPrivate: %v", entity)
i... | go | func (f *Facade) AddHostPrivate(ctx datastore.Context, entity *host.Host) ([]byte, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddHostPrivate"))
alog := f.auditLogger.Message(ctx, "Adding Host with common key").Action(audit.Add).Entity(entity)
glog.V(2).Infof("Facade.AddHostPrivate: %v", entity)
i... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"AddHostPrivate",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"entity",
"*",
"host",
".",
"Host",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"... | // AddHost registers a host with serviced. Returns the host's _public_ key.
// Returns an error if host already exists or if the host's IP is a virtual IP. | [
"AddHost",
"registers",
"a",
"host",
"with",
"serviced",
".",
"Returns",
"the",
"host",
"s",
"_public_",
"key",
".",
"Returns",
"an",
"error",
"if",
"host",
"already",
"exists",
"or",
"if",
"the",
"host",
"s",
"IP",
"is",
"a",
"virtual",
"IP",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L66-L77 |
139,516 | control-center/serviced | facade/host.go | generateDelegateKey | func (f *Facade) generateDelegateKey(ctx datastore.Context, entity *host.Host) ([]byte, error) {
// Generate new key
delegateHeaders := map[string]string{
"purpose": "delegate",
"host_ip": entity.IPAddr,
"host_id": entity.ID}
publicPEM, privatePEM, err := auth.GenerateRSAKeyPairPEM(delegateHeaders)
if err != ... | go | func (f *Facade) generateDelegateKey(ctx datastore.Context, entity *host.Host) ([]byte, error) {
// Generate new key
delegateHeaders := map[string]string{
"purpose": "delegate",
"host_ip": entity.IPAddr,
"host_id": entity.ID}
publicPEM, privatePEM, err := auth.GenerateRSAKeyPairPEM(delegateHeaders)
if err != ... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"generateDelegateKey",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"entity",
"*",
"host",
".",
"Host",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Generate new key",
"delegateHeaders",
":=",
"map",
"[",... | // Generate and store an RSA key for the host | [
"Generate",
"and",
"store",
"an",
"RSA",
"key",
"for",
"the",
"host"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L179-L214 |
139,517 | control-center/serviced | facade/host.go | UpdateHost | func (f *Facade) UpdateHost(ctx datastore.Context, entity *host.Host) error {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.UpdateHost"))
alog := f.auditLogger.Message(ctx, "Updating Host").Entity(entity).Action(audit.Update)
glog.V(2).Infof("Facade.UpdateHost: %+v", entity)
if err := f.DFSLock(ctx).LockWith... | go | func (f *Facade) UpdateHost(ctx datastore.Context, entity *host.Host) error {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.UpdateHost"))
alog := f.auditLogger.Message(ctx, "Updating Host").Entity(entity).Action(audit.Update)
glog.V(2).Infof("Facade.UpdateHost: %+v", entity)
if err := f.DFSLock(ctx).LockWith... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"UpdateHost",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"entity",
"*",
"host",
".",
"Host",
")",
"error",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics",
"(",
")",
... | // UpdateHost information for a registered host | [
"UpdateHost",
"information",
"for",
"a",
"registered",
"host"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L254-L299 |
139,518 | control-center/serviced | facade/host.go | GetHost | func (f *Facade) GetHost(ctx datastore.Context, hostID string) (*host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHost"))
glog.V(2).Infof("Facade.GetHost: id=%s", hostID)
var value host.Host
err := f.hostStore.Get(ctx, host.HostKey(hostID), &value)
glog.V(4).Infof("Facade.GetHost: get e... | go | func (f *Facade) GetHost(ctx datastore.Context, hostID string) (*host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHost"))
glog.V(2).Infof("Facade.GetHost: id=%s", hostID)
var value host.Host
err := f.hostStore.Get(ctx, host.HostKey(hostID), &value)
glog.V(4).Infof("Facade.GetHost: get e... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetHost",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostID",
"string",
")",
"(",
"*",
"host",
".",
"Host",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",... | // GetHost gets a host by id. Returns nil if host not found | [
"GetHost",
"gets",
"a",
"host",
"by",
"id",
".",
"Returns",
"nil",
"if",
"host",
"not",
"found"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L378-L392 |
139,519 | control-center/serviced | facade/host.go | GetHostKey | func (f *Facade) GetHostKey(ctx datastore.Context, hostID string) ([]byte, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHostKey"))
glog.V(2).Infof("Facade.GetHostKey: id=%s", hostID)
if key, err := f.hostkeyStore.Get(ctx, hostID); err != nil {
return nil, err
} else {
return []byte(key.PEM)... | go | func (f *Facade) GetHostKey(ctx datastore.Context, hostID string) ([]byte, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHostKey"))
glog.V(2).Infof("Facade.GetHostKey: id=%s", hostID)
if key, err := f.hostkeyStore.Get(ctx, hostID); err != nil {
return nil, err
} else {
return []byte(key.PEM)... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetHostKey",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostID",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Met... | // GetHostKey gets a host key by id. Returns nil if host not found | [
"GetHostKey",
"gets",
"a",
"host",
"key",
"by",
"id",
".",
"Returns",
"nil",
"if",
"host",
"not",
"found"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L395-L404 |
139,520 | control-center/serviced | facade/host.go | ResetHostKey | func (f *Facade) ResetHostKey(ctx datastore.Context, hostID string) ([]byte, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetHostKey"))
glog.V(2).Infof("Facade.ResetHostKey: id=%s", hostID)
alog := f.auditLogger.Message(ctx, "Resetting Host Key").
Action(audit.Update).ID(hostID).Type(host.GetTyp... | go | func (f *Facade) ResetHostKey(ctx datastore.Context, hostID string) ([]byte, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetHostKey"))
glog.V(2).Infof("Facade.ResetHostKey: id=%s", hostID)
alog := f.auditLogger.Message(ctx, "Resetting Host Key").
Action(audit.Update).ID(hostID).Type(host.GetTyp... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"ResetHostKey",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostID",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"M... | // ResetHostKey generates and returns a host key by id. Returns nil if host not found | [
"ResetHostKey",
"generates",
"and",
"returns",
"a",
"host",
"key",
"by",
"id",
".",
"Returns",
"nil",
"if",
"host",
"not",
"found"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L407-L419 |
139,521 | control-center/serviced | facade/host.go | RegisterHostKeys | func (f *Facade) RegisterHostKeys(ctx datastore.Context, entity *host.Host, nat utils.URL, keys []byte, prompt bool) error {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RegisterHostKeys"))
alog := f.auditLogger.Message(ctx, "Registering Host Keys").
Entity(entity).Action(audit.Update).WithField("nat", nat.... | go | func (f *Facade) RegisterHostKeys(ctx datastore.Context, entity *host.Host, nat utils.URL, keys []byte, prompt bool) error {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RegisterHostKeys"))
alog := f.auditLogger.Message(ctx, "Registering Host Keys").
Entity(entity).Action(audit.Update).WithField("nat", nat.... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"RegisterHostKeys",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"entity",
"*",
"host",
".",
"Host",
",",
"nat",
"utils",
".",
"URL",
",",
"keys",
"[",
"]",
"byte",
",",
"prompt",
"bool",
")",
"error",
"{",
"d... | // RegisterHost attempts to register a host's keys over ssh, or locally if it's
// the current host. | [
"RegisterHost",
"attempts",
"to",
"register",
"a",
"host",
"s",
"keys",
"over",
"ssh",
"or",
"locally",
"if",
"it",
"s",
"the",
"current",
"host",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L423-L428 |
139,522 | control-center/serviced | facade/host.go | SetHostExpiration | func (f *Facade) SetHostExpiration(ctx datastore.Context, hostid string, expiration int64) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.SetHostExpiration"))
f.hostRegistry.Set(hostid, expiration)
} | go | func (f *Facade) SetHostExpiration(ctx datastore.Context, hostid string, expiration int64) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.SetHostExpiration"))
f.hostRegistry.Set(hostid, expiration)
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"SetHostExpiration",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostid",
"string",
",",
"expiration",
"int64",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics",
"(",
... | // SetHostExpiration sets a host's auth token
// expiration time in the HostExpirationRegistry | [
"SetHostExpiration",
"sets",
"a",
"host",
"s",
"auth",
"token",
"expiration",
"time",
"in",
"the",
"HostExpirationRegistry"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L432-L435 |
139,523 | control-center/serviced | facade/host.go | RemoveHostExpiration | func (f *Facade) RemoveHostExpiration(ctx datastore.Context, hostid string) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveHostExpiration"))
f.hostRegistry.Remove(hostid)
} | go | func (f *Facade) RemoveHostExpiration(ctx datastore.Context, hostid string) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveHostExpiration"))
f.hostRegistry.Remove(hostid)
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"RemoveHostExpiration",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostid",
"string",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Start",
"(",
... | // RemoveHostExpiration removes a host from the
// HostExpirationRegistry | [
"RemoveHostExpiration",
"removes",
"a",
"host",
"from",
"the",
"HostExpirationRegistry"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L439-L442 |
139,524 | control-center/serviced | facade/host.go | HostIsAuthenticated | func (f *Facade) HostIsAuthenticated(ctx datastore.Context, hostid string) (bool, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.HostIsAuthenticated"))
isExpired, err := f.hostRegistry.IsExpired(hostid)
if err != nil {
return false, err
}
return !isExpired, nil
} | go | func (f *Facade) HostIsAuthenticated(ctx datastore.Context, hostid string) (bool, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.HostIsAuthenticated"))
isExpired, err := f.hostRegistry.IsExpired(hostid)
if err != nil {
return false, err
}
return !isExpired, nil
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"HostIsAuthenticated",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostid",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics"... | // HostIsAuthenticated checks whether a host has authenticated and has an unexpired
// token | [
"HostIsAuthenticated",
"checks",
"whether",
"a",
"host",
"has",
"authenticated",
"and",
"has",
"an",
"unexpired",
"token"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L446-L453 |
139,525 | control-center/serviced | facade/host.go | GetHosts | func (f *Facade) GetHosts(ctx datastore.Context) ([]host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHosts"))
return f.hostStore.GetN(ctx, 10000)
} | go | func (f *Facade) GetHosts(ctx datastore.Context) ([]host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHosts"))
return f.hostStore.GetN(ctx, 10000)
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetHosts",
"(",
"ctx",
"datastore",
".",
"Context",
")",
"(",
"[",
"]",
"host",
".",
"Host",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics",
"(",
... | // GetHosts returns a list of all registered hosts | [
"GetHosts",
"returns",
"a",
"list",
"of",
"all",
"registered",
"hosts"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L456-L459 |
139,526 | control-center/serviced | facade/host.go | GetActiveHostIDs | func (f *Facade) GetActiveHostIDs(ctx datastore.Context) ([]string, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetActiveHostIDs"))
hostids := []string{}
pools, err := f.GetResourcePools(ctx)
if err != nil {
glog.Errorf("Could not get resource pools: %v", err)
return nil, err
}
for _, p := r... | go | func (f *Facade) GetActiveHostIDs(ctx datastore.Context) ([]string, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetActiveHostIDs"))
hostids := []string{}
pools, err := f.GetResourcePools(ctx)
if err != nil {
glog.Errorf("Could not get resource pools: %v", err)
return nil, err
}
for _, p := r... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetActiveHostIDs",
"(",
"ctx",
"datastore",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics",
"(",
")",
... | // GetActiveHostIDs returns a list of active host ids | [
"GetActiveHostIDs",
"returns",
"a",
"list",
"of",
"active",
"host",
"ids"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L462-L479 |
139,527 | control-center/serviced | facade/host.go | FindHostsInPool | func (f *Facade) FindHostsInPool(ctx datastore.Context, poolID string) ([]host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindHostsInPool"))
return f.hostStore.FindHostsWithPoolID(ctx, poolID)
} | go | func (f *Facade) FindHostsInPool(ctx datastore.Context, poolID string) ([]host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindHostsInPool"))
return f.hostStore.FindHostsWithPoolID(ctx, poolID)
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"FindHostsInPool",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"poolID",
"string",
")",
"(",
"[",
"]",
"host",
".",
"Host",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
... | // FindHostsInPool returns a list of all hosts with poolID | [
"FindHostsInPool",
"returns",
"a",
"list",
"of",
"all",
"hosts",
"with",
"poolID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L482-L485 |
139,528 | control-center/serviced | facade/host.go | GetHostByIP | func (f *Facade) GetHostByIP(ctx datastore.Context, hostIP string) (*host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHostByIP"))
return f.hostStore.GetHostByIP(ctx, hostIP)
} | go | func (f *Facade) GetHostByIP(ctx datastore.Context, hostIP string) (*host.Host, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHostByIP"))
return f.hostStore.GetHostByIP(ctx, hostIP)
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetHostByIP",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostIP",
"string",
")",
"(",
"*",
"host",
".",
"Host",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
... | // GetHostByIP returns the host by IP address | [
"GetHostByIP",
"returns",
"the",
"host",
"by",
"IP",
"address"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L488-L491 |
139,529 | control-center/serviced | facade/host.go | GetReadHosts | func (f *Facade) GetReadHosts(ctx datastore.Context) ([]host.ReadHost, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetReadHosts"))
hosts, err := f.hostStore.GetN(ctx, 20000)
if err != nil {
return nil, err
}
return toReadHosts(hosts), nil
} | go | func (f *Facade) GetReadHosts(ctx datastore.Context) ([]host.ReadHost, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetReadHosts"))
hosts, err := f.hostStore.GetN(ctx, 20000)
if err != nil {
return nil, err
}
return toReadHosts(hosts), nil
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetReadHosts",
"(",
"ctx",
"datastore",
".",
"Context",
")",
"(",
"[",
"]",
"host",
".",
"ReadHost",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",
"(",
"ctx",
".",
"Metrics",
... | // GetReadHosts returns list of all hosts using a minimal representation of a host | [
"GetReadHosts",
"returns",
"list",
"of",
"all",
"hosts",
"using",
"a",
"minimal",
"representation",
"of",
"a",
"host"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L494-L502 |
139,530 | control-center/serviced | facade/host.go | FindReadHostsInPool | func (f *Facade) FindReadHostsInPool(ctx datastore.Context, poolID string) ([]host.ReadHost, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindReadHostsInPool"))
hosts, err := f.hostStore.FindHostsWithPoolID(ctx, poolID)
if err != nil {
return nil, err
}
return toReadHosts(hosts), nil
} | go | func (f *Facade) FindReadHostsInPool(ctx datastore.Context, poolID string) ([]host.ReadHost, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindReadHostsInPool"))
hosts, err := f.hostStore.FindHostsWithPoolID(ctx, poolID)
if err != nil {
return nil, err
}
return toReadHosts(hosts), nil
} | [
"func",
"(",
"f",
"*",
"Facade",
")",
"FindReadHostsInPool",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"poolID",
"string",
")",
"(",
"[",
"]",
"host",
".",
"ReadHost",
",",
"error",
")",
"{",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
".",
"Stop",... | // FindReadHostsInPool returns list of all hosts for a pool using a minimal representation of a host | [
"FindReadHostsInPool",
"returns",
"list",
"of",
"all",
"hosts",
"for",
"a",
"pool",
"using",
"a",
"minimal",
"representation",
"of",
"a",
"host"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L505-L513 |
139,531 | control-center/serviced | facade/host.go | GetHostStatuses | func (f *Facade) GetHostStatuses(ctx datastore.Context, hostIDs []string, since time.Time) ([]host.HostStatus, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHostStatuses"))
if hostIDs == nil {
return []host.HostStatus{}, nil
}
statuses := []host.HostStatus{}
for _, id := range hostIDs {
h, ... | go | func (f *Facade) GetHostStatuses(ctx datastore.Context, hostIDs []string, since time.Time) ([]host.HostStatus, error) {
defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHostStatuses"))
if hostIDs == nil {
return []host.HostStatus{}, nil
}
statuses := []host.HostStatus{}
for _, id := range hostIDs {
h, ... | [
"func",
"(",
"f",
"*",
"Facade",
")",
"GetHostStatuses",
"(",
"ctx",
"datastore",
".",
"Context",
",",
"hostIDs",
"[",
"]",
"string",
",",
"since",
"time",
".",
"Time",
")",
"(",
"[",
"]",
"host",
".",
"HostStatus",
",",
"error",
")",
"{",
"defer",
... | // GetHostStatuses returns the memory usage and whether or not a host is active | [
"GetHostStatuses",
"returns",
"the",
"memory",
"usage",
"and",
"whether",
"or",
"not",
"a",
"host",
"is",
"active"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/host.go#L516-L554 |
139,532 | control-center/serviced | zzk/registry/registry.go | DeleteExports | func DeleteExports(conn client.Connection, tenantID string) error {
pth := path.Join("/net/export", tenantID)
logger := plog.WithFields(log.Fields{
"tenantid": tenantID,
"zkpath": pth,
})
if err := conn.Delete(pth); err == client.ErrNoNode {
logger.Debug("No exports for tenant id")
return nil
} else if ... | go | func DeleteExports(conn client.Connection, tenantID string) error {
pth := path.Join("/net/export", tenantID)
logger := plog.WithFields(log.Fields{
"tenantid": tenantID,
"zkpath": pth,
})
if err := conn.Delete(pth); err == client.ErrNoNode {
logger.Debug("No exports for tenant id")
return nil
} else if ... | [
"func",
"DeleteExports",
"(",
"conn",
"client",
".",
"Connection",
",",
"tenantID",
"string",
")",
"error",
"{",
"pth",
":=",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"tenantID",
")",
"\n",
"logger",
":=",
"plog",
".",
"WithFields",
"(",
"log",
".",
... | // DeleteExports deletes all export data for a tenant id | [
"DeleteExports",
"deletes",
"all",
"export",
"data",
"for",
"a",
"tenant",
"id"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L60-L77 |
139,533 | control-center/serviced | zzk/registry/registry.go | GetPublicPort | func GetPublicPort(conn client.Connection, key PublicPortKey) (string, string, error) {
pth := path.Join("/net/pub", key.HostID, key.PortAddress)
logger := plog.WithFields(log.Fields{
"hostid": key.HostID,
"portaddress": key.PortAddress,
"zkpath": pth,
})
pub := &PublicPort{}
err := conn.Get(pth,... | go | func GetPublicPort(conn client.Connection, key PublicPortKey) (string, string, error) {
pth := path.Join("/net/pub", key.HostID, key.PortAddress)
logger := plog.WithFields(log.Fields{
"hostid": key.HostID,
"portaddress": key.PortAddress,
"zkpath": pth,
})
pub := &PublicPort{}
err := conn.Get(pth,... | [
"func",
"GetPublicPort",
"(",
"conn",
"client",
".",
"Connection",
",",
"key",
"PublicPortKey",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"pth",
":=",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"key",
".",
"HostID",
",",
"key",
".",
... | // GetPublicPort returns the service id and application of the public port | [
"GetPublicPort",
"returns",
"the",
"service",
"id",
"and",
"application",
"of",
"the",
"public",
"port"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L80-L109 |
139,534 | control-center/serviced | zzk/registry/registry.go | GetVHost | func GetVHost(conn client.Connection, key VHostKey) (string, string, error) {
pth := path.Join("/net/vhost", key.HostID, key.Subdomain)
logger := plog.WithFields(log.Fields{
"hostid": key.HostID,
"subdomain": key.Subdomain,
"zkpath": pth,
})
vhost := &VHost{}
err := conn.Get(pth, vhost)
if err == cl... | go | func GetVHost(conn client.Connection, key VHostKey) (string, string, error) {
pth := path.Join("/net/vhost", key.HostID, key.Subdomain)
logger := plog.WithFields(log.Fields{
"hostid": key.HostID,
"subdomain": key.Subdomain,
"zkpath": pth,
})
vhost := &VHost{}
err := conn.Get(pth, vhost)
if err == cl... | [
"func",
"GetVHost",
"(",
"conn",
"client",
".",
"Connection",
",",
"key",
"VHostKey",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"pth",
":=",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"key",
".",
"HostID",
",",
"key",
".",
"Subdoma... | // GetVHost returns the service id and application of the vhost | [
"GetVHost",
"returns",
"the",
"service",
"id",
"and",
"application",
"of",
"the",
"vhost"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L178-L207 |
139,535 | control-center/serviced | zzk/registry/registry.go | SyncServiceRegistry | func SyncServiceRegistry(conn client.Connection, request ServiceRegistrySyncRequest) error {
logger := plog.WithField("serviceid", request.ServiceID)
if len(request.PortsToDelete) == 0 &&
len(request.PortsToPublish) == 0 &&
len(request.VHostsToDelete) == 0 &&
len(request.VHostsToPublish) == 0 {
// Don'... | go | func SyncServiceRegistry(conn client.Connection, request ServiceRegistrySyncRequest) error {
logger := plog.WithField("serviceid", request.ServiceID)
if len(request.PortsToDelete) == 0 &&
len(request.PortsToPublish) == 0 &&
len(request.VHostsToDelete) == 0 &&
len(request.VHostsToPublish) == 0 {
// Don'... | [
"func",
"SyncServiceRegistry",
"(",
"conn",
"client",
".",
"Connection",
",",
"request",
"ServiceRegistrySyncRequest",
")",
"error",
"{",
"logger",
":=",
"plog",
".",
"WithField",
"(",
"\"",
"\"",
",",
"request",
".",
"ServiceID",
")",
"\n\n",
"if",
"len",
"... | // SyncServiceRegistry syncs all vhosts and public ports to those of a matching
// service. | [
"SyncServiceRegistry",
"syncs",
"all",
"vhosts",
"and",
"public",
"ports",
"to",
"those",
"of",
"a",
"matching",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L277-L307 |
139,536 | control-center/serviced | zzk/registry/registry.go | syncServicePublicPorts | func syncServicePublicPorts(conn client.Connection, tx client.Transaction, request ServiceRegistrySyncRequest) error {
logger := plog.WithField("serviceid", request.ServiceID)
pth := "/net/pub"
for _, pubKey := range request.PortsToDelete {
addrpth := path.Join(pth, pubKey.HostID, pubKey.PortAddress)
addrLogger... | go | func syncServicePublicPorts(conn client.Connection, tx client.Transaction, request ServiceRegistrySyncRequest) error {
logger := plog.WithField("serviceid", request.ServiceID)
pth := "/net/pub"
for _, pubKey := range request.PortsToDelete {
addrpth := path.Join(pth, pubKey.HostID, pubKey.PortAddress)
addrLogger... | [
"func",
"syncServicePublicPorts",
"(",
"conn",
"client",
".",
"Connection",
",",
"tx",
"client",
".",
"Transaction",
",",
"request",
"ServiceRegistrySyncRequest",
")",
"error",
"{",
"logger",
":=",
"plog",
".",
"WithField",
"(",
"\"",
"\"",
",",
"request",
"."... | // syncServicePublicPorts updates the transaction to include public port updates | [
"syncServicePublicPorts",
"updates",
"the",
"transaction",
"to",
"include",
"public",
"port",
"updates"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L310-L390 |
139,537 | control-center/serviced | zzk/registry/registry.go | syncServiceVHosts | func syncServiceVHosts(conn client.Connection, tx client.Transaction, request ServiceRegistrySyncRequest) error {
logger := plog.WithField("serviceid", request.ServiceID)
pth := "/net/vhost"
for _, vhostKey := range request.VHostsToDelete {
addrpth := path.Join(pth, vhostKey.HostID, vhostKey.Subdomain)
addrLogg... | go | func syncServiceVHosts(conn client.Connection, tx client.Transaction, request ServiceRegistrySyncRequest) error {
logger := plog.WithField("serviceid", request.ServiceID)
pth := "/net/vhost"
for _, vhostKey := range request.VHostsToDelete {
addrpth := path.Join(pth, vhostKey.HostID, vhostKey.Subdomain)
addrLogg... | [
"func",
"syncServiceVHosts",
"(",
"conn",
"client",
".",
"Connection",
",",
"tx",
"client",
".",
"Transaction",
",",
"request",
"ServiceRegistrySyncRequest",
")",
"error",
"{",
"logger",
":=",
"plog",
".",
"WithField",
"(",
"\"",
"\"",
",",
"request",
".",
"... | // syncServiceVHosts updates the transaction to include virtual host updates | [
"syncServiceVHosts",
"updates",
"the",
"transaction",
"to",
"include",
"virtual",
"host",
"updates"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L393-L473 |
139,538 | control-center/serviced | zzk/registry/registry.go | buildParentPaths | func buildParentPaths(logger *log.Entry, conn client.Connection, pathsToBuild map[string]string) *RegistryError {
for hostID, hostpth := range pathsToBuild {
hostLogger := logger.WithFields(log.Fields{
"hostid": hostID,
"zkpath": hostpth,
})
if err := conn.CreateDir(hostpth); err != nil {
retur... | go | func buildParentPaths(logger *log.Entry, conn client.Connection, pathsToBuild map[string]string) *RegistryError {
for hostID, hostpth := range pathsToBuild {
hostLogger := logger.WithFields(log.Fields{
"hostid": hostID,
"zkpath": hostpth,
})
if err := conn.CreateDir(hostpth); err != nil {
retur... | [
"func",
"buildParentPaths",
"(",
"logger",
"*",
"log",
".",
"Entry",
",",
"conn",
"client",
".",
"Connection",
",",
"pathsToBuild",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"RegistryError",
"{",
"for",
"hostID",
",",
"hostpth",
":=",
"range",
"pathsT... | // Build any missing parent directory paths | [
"Build",
"any",
"missing",
"parent",
"directory",
"paths"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/registry.go#L476-L491 |
139,539 | control-center/serviced | domain/applicationendpoint/applicationendpoint.go | BuildEndpointReports | func BuildEndpointReports(appEndpoints []ApplicationEndpoint) []EndpointReport {
endpoints := make([]EndpointReport, 0)
for _, appEndpoint := range appEndpoints {
endpoints = append(endpoints, EndpointReport{Endpoint: appEndpoint, Messages: []string{}})
}
return endpoints
} | go | func BuildEndpointReports(appEndpoints []ApplicationEndpoint) []EndpointReport {
endpoints := make([]EndpointReport, 0)
for _, appEndpoint := range appEndpoints {
endpoints = append(endpoints, EndpointReport{Endpoint: appEndpoint, Messages: []string{}})
}
return endpoints
} | [
"func",
"BuildEndpointReports",
"(",
"appEndpoints",
"[",
"]",
"ApplicationEndpoint",
")",
"[",
"]",
"EndpointReport",
"{",
"endpoints",
":=",
"make",
"(",
"[",
"]",
"EndpointReport",
",",
"0",
")",
"\n",
"for",
"_",
",",
"appEndpoint",
":=",
"range",
"appEn... | // BuildEndpointReports converts an array of ApplicationEndpoints to an array of EndpointReports | [
"BuildEndpointReports",
"converts",
"an",
"array",
"of",
"ApplicationEndpoints",
"to",
"an",
"array",
"of",
"EndpointReports"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/applicationendpoint/applicationendpoint.go#L47-L53 |
139,540 | control-center/serviced | domain/applicationendpoint/applicationendpoint.go | GetID | func (endpoint *ApplicationEndpoint) GetID() string {
return strings.ToLower(fmt.Sprintf("%s/%d %s %s", endpoint.ServiceID, endpoint.InstanceID, endpoint.Purpose, endpoint.Application))
} | go | func (endpoint *ApplicationEndpoint) GetID() string {
return strings.ToLower(fmt.Sprintf("%s/%d %s %s", endpoint.ServiceID, endpoint.InstanceID, endpoint.Purpose, endpoint.Application))
} | [
"func",
"(",
"endpoint",
"*",
"ApplicationEndpoint",
")",
"GetID",
"(",
")",
"string",
"{",
"return",
"strings",
".",
"ToLower",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"endpoint",
".",
"ServiceID",
",",
"endpoint",
".",
"InstanceID",
",",
"end... | // Returns a string which uniquely identifies an endpoint instance | [
"Returns",
"a",
"string",
"which",
"uniquely",
"identifies",
"an",
"endpoint",
"instance"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/applicationendpoint/applicationendpoint.go#L56-L58 |
139,541 | control-center/serviced | domain/applicationendpoint/applicationendpoint.go | Find | func (endpoint *ApplicationEndpoint) Find(endpoints []ApplicationEndpoint) *ApplicationEndpoint {
// Yes, this is brute-force linear search, but in practice the lists should be small, few 10s at most
endpointID := endpoint.GetID()
for _, entry := range endpoints {
if entry.GetID() == endpointID {
return &entry
... | go | func (endpoint *ApplicationEndpoint) Find(endpoints []ApplicationEndpoint) *ApplicationEndpoint {
// Yes, this is brute-force linear search, but in practice the lists should be small, few 10s at most
endpointID := endpoint.GetID()
for _, entry := range endpoints {
if entry.GetID() == endpointID {
return &entry
... | [
"func",
"(",
"endpoint",
"*",
"ApplicationEndpoint",
")",
"Find",
"(",
"endpoints",
"[",
"]",
"ApplicationEndpoint",
")",
"*",
"ApplicationEndpoint",
"{",
"// Yes, this is brute-force linear search, but in practice the lists should be small, few 10s at most",
"endpointID",
":=",
... | // Find the entry in endpoints which matches the specified endpoint | [
"Find",
"the",
"entry",
"in",
"endpoints",
"which",
"matches",
"the",
"specified",
"endpoint"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/applicationendpoint/applicationendpoint.go#L61-L70 |
139,542 | control-center/serviced | domain/applicationendpoint/applicationendpoint.go | Equals | func (a *ApplicationEndpoint) Equals(b *ApplicationEndpoint) bool {
if a.ServiceID != b.ServiceID {
return false
}
if a.InstanceID != b.InstanceID {
return false
}
if a.Application != b.Application {
return false
}
if a.Purpose != b.Purpose {
return false
}
if a.HostID != b.HostID {
return false
}
... | go | func (a *ApplicationEndpoint) Equals(b *ApplicationEndpoint) bool {
if a.ServiceID != b.ServiceID {
return false
}
if a.InstanceID != b.InstanceID {
return false
}
if a.Application != b.Application {
return false
}
if a.Purpose != b.Purpose {
return false
}
if a.HostID != b.HostID {
return false
}
... | [
"func",
"(",
"a",
"*",
"ApplicationEndpoint",
")",
"Equals",
"(",
"b",
"*",
"ApplicationEndpoint",
")",
"bool",
"{",
"if",
"a",
".",
"ServiceID",
"!=",
"b",
".",
"ServiceID",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"a",
".",
"InstanceID",
"!=",
... | // Equals verifies whether two endpoint objects are equal | [
"Equals",
"verifies",
"whether",
"two",
"endpoint",
"objects",
"are",
"equal"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/applicationendpoint/applicationendpoint.go#L73-L111 |
139,543 | control-center/serviced | dfs/untag.go | Untag | func (dfs *DistributedFilesystem) Untag(tenantID, tagName string) (string, error) {
vol, err := dfs.disk.Get(tenantID)
if err != nil {
glog.Errorf("Could not get tenant volume %s: %s", tenantID, err)
return "", err
}
label, err := vol.UntagSnapshot(tagName)
if err != nil {
glog.Errorf("Could not remove tag %... | go | func (dfs *DistributedFilesystem) Untag(tenantID, tagName string) (string, error) {
vol, err := dfs.disk.Get(tenantID)
if err != nil {
glog.Errorf("Could not get tenant volume %s: %s", tenantID, err)
return "", err
}
label, err := vol.UntagSnapshot(tagName)
if err != nil {
glog.Errorf("Could not remove tag %... | [
"func",
"(",
"dfs",
"*",
"DistributedFilesystem",
")",
"Untag",
"(",
"tenantID",
",",
"tagName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"vol",
",",
"err",
":=",
"dfs",
".",
"disk",
".",
"Get",
"(",
"tenantID",
")",
"\n",
"if",
"err",
... | // Untag removes an existing snapshot tag and returns the name of the affected
// snapshot. | [
"Untag",
"removes",
"an",
"existing",
"snapshot",
"tag",
"and",
"returns",
"the",
"name",
"of",
"the",
"affected",
"snapshot",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/untag.go#L20-L37 |
139,544 | control-center/serviced | cli/api/daemon.go | removeOrphanRegistryImages | func (d *daemon) removeOrphanRegistryImages() error {
log.Info("Checking the image registry for orphan images")
if images, err := d.facade.GetRegistryImages(d.dsContext); err != nil {
log.WithError(err).Error("Unable to get docker image registry entries")
return err
} else {
for _, image := range images {
i... | go | func (d *daemon) removeOrphanRegistryImages() error {
log.Info("Checking the image registry for orphan images")
if images, err := d.facade.GetRegistryImages(d.dsContext); err != nil {
log.WithError(err).Error("Unable to get docker image registry entries")
return err
} else {
for _, image := range images {
i... | [
"func",
"(",
"d",
"*",
"daemon",
")",
"removeOrphanRegistryImages",
"(",
")",
"error",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"if",
"images",
",",
"err",
":=",
"d",
".",
"facade",
".",
"GetRegistryImages",
"(",
"d",
".",
"dsContext",
")... | // Checks the image registry store for orphaned images. Removal of services prior to
// version 1.5.0 would orphan images in the registry, potentially causing an image
// conflict error later. All orphan image entries are removed when moving to version
// 1.5.0+. | [
"Checks",
"the",
"image",
"registry",
"store",
"for",
"orphaned",
"images",
".",
"Removal",
"of",
"services",
"prior",
"to",
"version",
"1",
".",
"5",
".",
"0",
"would",
"orphan",
"images",
"in",
"the",
"registry",
"potentially",
"causing",
"an",
"image",
... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/daemon.go#L626-L641 |
139,545 | control-center/serviced | cli/api/daemon.go | startLogstashPurger | func (d *daemon) startLogstashPurger(initialStart, cycleTime time.Duration) {
options := config.GetOptions()
// Run the first time after 10 minutes
select {
case <-d.shutdown:
return
case <-time.After(initialStart):
}
for {
isvcs.PurgeLogstashIndices(options.LogstashMaxDays, options.LogstashMaxSize)
select... | go | func (d *daemon) startLogstashPurger(initialStart, cycleTime time.Duration) {
options := config.GetOptions()
// Run the first time after 10 minutes
select {
case <-d.shutdown:
return
case <-time.After(initialStart):
}
for {
isvcs.PurgeLogstashIndices(options.LogstashMaxDays, options.LogstashMaxSize)
select... | [
"func",
"(",
"d",
"*",
"daemon",
")",
"startLogstashPurger",
"(",
"initialStart",
",",
"cycleTime",
"time",
".",
"Duration",
")",
"{",
"options",
":=",
"config",
".",
"GetOptions",
"(",
")",
"\n",
"// Run the first time after 10 minutes",
"select",
"{",
"case",
... | // startLogstashPurger purges logstash based on days and size | [
"startLogstashPurger",
"purges",
"logstash",
"based",
"on",
"days",
"and",
"size"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/daemon.go#L1253-L1269 |
139,546 | control-center/serviced | zzk/docker/action.go | Spawn | func (l *ActionListener) Spawn(shutdown <-chan interface{}, actionID string) {
defer func() {
glog.V(2).Infof("Action %s complete: ", actionID)
if err := l.conn.Delete(l.GetPath(actionID)); err != nil {
glog.Errorf("Could not delete %s: %s", l.GetPath(actionID), err)
}
}()
var action Action
if err := l.co... | go | func (l *ActionListener) Spawn(shutdown <-chan interface{}, actionID string) {
defer func() {
glog.V(2).Infof("Action %s complete: ", actionID)
if err := l.conn.Delete(l.GetPath(actionID)); err != nil {
glog.Errorf("Could not delete %s: %s", l.GetPath(actionID), err)
}
}()
var action Action
if err := l.co... | [
"func",
"(",
"l",
"*",
"ActionListener",
")",
"Spawn",
"(",
"shutdown",
"<-",
"chan",
"interface",
"{",
"}",
",",
"actionID",
"string",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"glog",
".",
"V",
"(",
"2",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",... | // Spawn attaches to a container and performs the requested action | [
"Spawn",
"attaches",
"to",
"a",
"container",
"and",
"performs",
"the",
"requested",
"action"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/docker/action.go#L83-L106 |
139,547 | control-center/serviced | zzk/docker/action.go | SendAction | func SendAction(conn client.Connection, action *Action) (string, error) {
uuid, err := utils.NewUUID()
if err != nil {
return "", err
}
node := actionPath(action.HostID, uuid)
if err := conn.Create(node, action); err != nil {
return "", err
} else if err := conn.Set(node, action); err != nil {
return "", e... | go | func SendAction(conn client.Connection, action *Action) (string, error) {
uuid, err := utils.NewUUID()
if err != nil {
return "", err
}
node := actionPath(action.HostID, uuid)
if err := conn.Create(node, action); err != nil {
return "", err
} else if err := conn.Set(node, action); err != nil {
return "", e... | [
"func",
"SendAction",
"(",
"conn",
"client",
".",
"Connection",
",",
"action",
"*",
"Action",
")",
"(",
"string",
",",
"error",
")",
"{",
"uuid",
",",
"err",
":=",
"utils",
".",
"NewUUID",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\... | // SendAction sends an action request to a particular host | [
"SendAction",
"sends",
"an",
"action",
"request",
"to",
"a",
"particular",
"host"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/docker/action.go#L109-L122 |
139,548 | control-center/serviced | web/serve.go | ServeTCP | func ServeTCP(cancel <-chan struct{}, listener net.Listener, tlsConfig *tls.Config, exports Exports) {
stopChan := make(chan bool)
wg := &sync.WaitGroup{}
go func() {
for {
local, err := listener.Accept()
if err != nil {
plog.WithError(err).Debug("Stopping accept on host:port")
return
}
if tl... | go | func ServeTCP(cancel <-chan struct{}, listener net.Listener, tlsConfig *tls.Config, exports Exports) {
stopChan := make(chan bool)
wg := &sync.WaitGroup{}
go func() {
for {
local, err := listener.Accept()
if err != nil {
plog.WithError(err).Debug("Stopping accept on host:port")
return
}
if tl... | [
"func",
"ServeTCP",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
",",
"listener",
"net",
".",
"Listener",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
",",
"exports",
"Exports",
")",
"{",
"stopChan",
":=",
"make",
"(",
"chan",
"bool",
")",
"\n",
... | // ServeTCP sets up a tcp based server connection given a set of exports. | [
"ServeTCP",
"sets",
"up",
"a",
"tcp",
"based",
"server",
"connection",
"given",
"a",
"set",
"of",
"exports",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/serve.go#L42-L99 |
139,549 | control-center/serviced | web/serve.go | ServeHTTP | func ServeHTTP(cancel <-chan struct{}, address, protocol string, listener net.Listener, tlsConfig *tls.Config, exports Exports) {
logger := plog.WithFields(log.Fields{
"portaddress": address,
"protocol": protocol,
"usetls": tlsConfig != nil,
})
portClosed := make(chan struct{})
// Setup a handler fo... | go | func ServeHTTP(cancel <-chan struct{}, address, protocol string, listener net.Listener, tlsConfig *tls.Config, exports Exports) {
logger := plog.WithFields(log.Fields{
"portaddress": address,
"protocol": protocol,
"usetls": tlsConfig != nil,
})
portClosed := make(chan struct{})
// Setup a handler fo... | [
"func",
"ServeHTTP",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
",",
"address",
",",
"protocol",
"string",
",",
"listener",
"net",
".",
"Listener",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
",",
"exports",
"Exports",
")",
"{",
"logger",
":=",
... | // ServeHTTP sets up an http server for handling a collection of endpoints | [
"ServeHTTP",
"sets",
"up",
"an",
"http",
"server",
"for",
"handling",
"a",
"collection",
"of",
"endpoints"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/serve.go#L102-L192 |
139,550 | control-center/serviced | domain/logfilter/validation.go | ValidEntity | func (lf *LogFilter) ValidEntity() error {
trimmed := strings.TrimSpace(lf.Name)
violations := validation.NewValidationError()
violations.Add(validation.NotEmpty("LogFilter.Name", lf.Name))
violations.Add(validation.StringsEqual(lf.Name, trimmed, "leading and trailing spaces not allowed for LogFilter name"))
trim... | go | func (lf *LogFilter) ValidEntity() error {
trimmed := strings.TrimSpace(lf.Name)
violations := validation.NewValidationError()
violations.Add(validation.NotEmpty("LogFilter.Name", lf.Name))
violations.Add(validation.StringsEqual(lf.Name, trimmed, "leading and trailing spaces not allowed for LogFilter name"))
trim... | [
"func",
"(",
"lf",
"*",
"LogFilter",
")",
"ValidEntity",
"(",
")",
"error",
"{",
"trimmed",
":=",
"strings",
".",
"TrimSpace",
"(",
"lf",
".",
"Name",
")",
"\n",
"violations",
":=",
"validation",
".",
"NewValidationError",
"(",
")",
"\n",
"violations",
"... | // ValidEntity validates LogFilter fields | [
"ValidEntity",
"validates",
"LogFilter",
"fields"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/logfilter/validation.go#L23-L39 |
139,551 | control-center/serviced | health/cache.go | New | func New() *HealthStatusCache {
cache := &HealthStatusCache{
mu: &sync.Mutex{},
data: make(map[HealthStatusKey]HealthStatusItem),
wg: &sync.WaitGroup{},
}
return cache
} | go | func New() *HealthStatusCache {
cache := &HealthStatusCache{
mu: &sync.Mutex{},
data: make(map[HealthStatusKey]HealthStatusItem),
wg: &sync.WaitGroup{},
}
return cache
} | [
"func",
"New",
"(",
")",
"*",
"HealthStatusCache",
"{",
"cache",
":=",
"&",
"HealthStatusCache",
"{",
"mu",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"data",
":",
"make",
"(",
"map",
"[",
"HealthStatusKey",
"]",
"HealthStatusItem",
")",
",",
"wg",... | // New returns a new HealthStatusCache instance | [
"New",
"returns",
"a",
"new",
"HealthStatusCache",
"instance"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L53-L60 |
139,552 | control-center/serviced | health/cache.go | SetPurgeFrequency | func (cache *HealthStatusCache) SetPurgeFrequency(interval time.Duration) {
cache.mu.Lock()
if cache.stop != nil {
close(cache.stop)
// Unlock before the Wait to avoid deadlock with DeleteExpired()
cache.mu.Unlock()
cache.wg.Wait()
// Reacquire the lock because we're about to change something in cache
c... | go | func (cache *HealthStatusCache) SetPurgeFrequency(interval time.Duration) {
cache.mu.Lock()
if cache.stop != nil {
close(cache.stop)
// Unlock before the Wait to avoid deadlock with DeleteExpired()
cache.mu.Unlock()
cache.wg.Wait()
// Reacquire the lock because we're about to change something in cache
c... | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"SetPurgeFrequency",
"(",
"interval",
"time",
".",
"Duration",
")",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"cache",
".",
"stop",
"!=",
"nil",
"{",
"close",
"(",
"cache",
".",
"... | // SetPurgeFrequency sets the autopurge interval for cache cleanup.
// Stops autopurge if interval is <= 0. | [
"SetPurgeFrequency",
"sets",
"the",
"autopurge",
"interval",
"for",
"cache",
"cleanup",
".",
"Stops",
"autopurge",
"if",
"interval",
"is",
"<",
"=",
"0",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L64-L98 |
139,553 | control-center/serviced | health/cache.go | Size | func (cache *HealthStatusCache) Size() int {
cache.mu.Lock()
defer cache.mu.Unlock()
return len(cache.data)
} | go | func (cache *HealthStatusCache) Size() int {
cache.mu.Lock()
defer cache.mu.Unlock()
return len(cache.data)
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"Size",
"(",
")",
"int",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"len",
"(",
"cache",
".",
"data",
")",
"\n",... | // Size returns the size of the cache. | [
"Size",
"returns",
"the",
"size",
"of",
"the",
"cache",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L101-L105 |
139,554 | control-center/serviced | health/cache.go | Get | func (cache *HealthStatusCache) Get(key HealthStatusKey) (HealthStatus, bool) {
cache.mu.Lock()
defer cache.mu.Unlock()
item, ok := cache.get(key)
return item.Value(), ok
} | go | func (cache *HealthStatusCache) Get(key HealthStatusKey) (HealthStatus, bool) {
cache.mu.Lock()
defer cache.mu.Unlock()
item, ok := cache.get(key)
return item.Value(), ok
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"Get",
"(",
"key",
"HealthStatusKey",
")",
"(",
"HealthStatus",
",",
"bool",
")",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
... | // Get returns an item from the cache if it hasn't yet expired. | [
"Get",
"returns",
"an",
"item",
"from",
"the",
"cache",
"if",
"it",
"hasn",
"t",
"yet",
"expired",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L108-L113 |
139,555 | control-center/serviced | health/cache.go | get | func (cache *HealthStatusCache) get(key HealthStatusKey) (item HealthStatusItem, ok bool) {
if item, ok = cache.data[key]; ok {
if item.Expired() {
cache.delete(key)
return HealthStatusItem{}, false
}
}
return
} | go | func (cache *HealthStatusCache) get(key HealthStatusKey) (item HealthStatusItem, ok bool) {
if item, ok = cache.data[key]; ok {
if item.Expired() {
cache.delete(key)
return HealthStatusItem{}, false
}
}
return
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"get",
"(",
"key",
"HealthStatusKey",
")",
"(",
"item",
"HealthStatusItem",
",",
"ok",
"bool",
")",
"{",
"if",
"item",
",",
"ok",
"=",
"cache",
".",
"data",
"[",
"key",
"]",
";",
"ok",
"{",
"if",
... | // get is non thread-safe | [
"get",
"is",
"non",
"thread",
"-",
"safe"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L116-L124 |
139,556 | control-center/serviced | health/cache.go | Set | func (cache *HealthStatusCache) Set(key HealthStatusKey, value HealthStatus, expire time.Duration) {
cache.mu.Lock()
defer cache.mu.Unlock()
cache.set(key, value, time.Now().Add(expire))
} | go | func (cache *HealthStatusCache) Set(key HealthStatusKey, value HealthStatus, expire time.Duration) {
cache.mu.Lock()
defer cache.mu.Unlock()
cache.set(key, value, time.Now().Add(expire))
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"Set",
"(",
"key",
"HealthStatusKey",
",",
"value",
"HealthStatus",
",",
"expire",
"time",
".",
"Duration",
")",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
"."... | // Set sets an item into the cache. | [
"Set",
"sets",
"an",
"item",
"into",
"the",
"cache",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L127-L131 |
139,557 | control-center/serviced | health/cache.go | set | func (cache *HealthStatusCache) set(key HealthStatusKey, value HealthStatus, expires time.Time) {
cache.data[key] = HealthStatusItem{value: value, expires: expires}
} | go | func (cache *HealthStatusCache) set(key HealthStatusKey, value HealthStatus, expires time.Time) {
cache.data[key] = HealthStatusItem{value: value, expires: expires}
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"set",
"(",
"key",
"HealthStatusKey",
",",
"value",
"HealthStatus",
",",
"expires",
"time",
".",
"Time",
")",
"{",
"cache",
".",
"data",
"[",
"key",
"]",
"=",
"HealthStatusItem",
"{",
"value",
":",
"va... | // set is non thread-safe | [
"set",
"is",
"non",
"thread",
"-",
"safe"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L134-L136 |
139,558 | control-center/serviced | health/cache.go | DeleteExpired | func (cache *HealthStatusCache) DeleteExpired() {
cache.mu.Lock()
defer cache.mu.Unlock()
for key, item := range cache.data {
if item.Expired() {
cache.delete(key)
}
}
} | go | func (cache *HealthStatusCache) DeleteExpired() {
cache.mu.Lock()
defer cache.mu.Unlock()
for key, item := range cache.data {
if item.Expired() {
cache.delete(key)
}
}
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"DeleteExpired",
"(",
")",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"key",
",",
"item",
":=",
"range",
"cache",
"."... | // DeleteExpired removes all expired items from the cache. | [
"DeleteExpired",
"removes",
"all",
"expired",
"items",
"from",
"the",
"cache",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L148-L156 |
139,559 | control-center/serviced | health/cache.go | DeleteInstance | func (cache *HealthStatusCache) DeleteInstance(serviceID string, instanceID int) {
cache.mu.Lock()
defer cache.mu.Unlock()
for key := range cache.data {
if key.ServiceID == serviceID && key.InstanceID == instanceID {
cache.delete(key)
}
}
} | go | func (cache *HealthStatusCache) DeleteInstance(serviceID string, instanceID int) {
cache.mu.Lock()
defer cache.mu.Unlock()
for key := range cache.data {
if key.ServiceID == serviceID && key.InstanceID == instanceID {
cache.delete(key)
}
}
} | [
"func",
"(",
"cache",
"*",
"HealthStatusCache",
")",
"DeleteInstance",
"(",
"serviceID",
"string",
",",
"instanceID",
"int",
")",
"{",
"cache",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cache",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
... | // DeleteInstance removes all health checks per instance. | [
"DeleteInstance",
"removes",
"all",
"health",
"checks",
"per",
"instance",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/health/cache.go#L159-L167 |
139,560 | control-center/serviced | isvcs/zkstats.go | GetZooKeeperCustomStats | func GetZooKeeperCustomStats(halt <-chan struct{}) error {
timeout := 30 * time.Second
timer := time.NewTimer(timeout)
for {
select {
case <-timer.C:
stats := []ZooKeeperStats{}
for _, key := range GetZooKeeperKeys() {
stats = append(stats, queryZooKeeperStats(key))
}
store.WriteAll(stats)
cas... | go | func GetZooKeeperCustomStats(halt <-chan struct{}) error {
timeout := 30 * time.Second
timer := time.NewTimer(timeout)
for {
select {
case <-timer.C:
stats := []ZooKeeperStats{}
for _, key := range GetZooKeeperKeys() {
stats = append(stats, queryZooKeeperStats(key))
}
store.WriteAll(stats)
cas... | [
"func",
"GetZooKeeperCustomStats",
"(",
"halt",
"<-",
"chan",
"struct",
"{",
"}",
")",
"error",
"{",
"timeout",
":=",
"30",
"*",
"time",
".",
"Second",
"\n",
"timer",
":=",
"time",
".",
"NewTimer",
"(",
"timeout",
")",
"\n\n",
"for",
"{",
"select",
"{"... | // GetZooKeeperCustomStats retrieves ZooKeeper specific stats form the ZooKeeper servers.
// This should be run as a separate go routine. | [
"GetZooKeeperCustomStats",
"retrieves",
"ZooKeeper",
"specific",
"stats",
"form",
"the",
"ZooKeeper",
"servers",
".",
"This",
"should",
"be",
"run",
"as",
"a",
"separate",
"go",
"routine",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/isvcs/zkstats.go#L250-L276 |
139,561 | control-center/serviced | commons/sync/timedmutex.go | Lock | func (m *TimedMutex) Lock(name string) {
select {
case <-m.ch:
m.holder.Store(name)
}
} | go | func (m *TimedMutex) Lock(name string) {
select {
case <-m.ch:
m.holder.Store(name)
}
} | [
"func",
"(",
"m",
"*",
"TimedMutex",
")",
"Lock",
"(",
"name",
"string",
")",
"{",
"select",
"{",
"case",
"<-",
"m",
".",
"ch",
":",
"m",
".",
"holder",
".",
"Store",
"(",
"name",
")",
"\n",
"}",
"\n",
"}"
] | // Lock locks the TimedMutex.
// name is a string to identify you to callers who fail to acquire the lock.
//
// If the mutex is already in use, the calling goroutine
// blocks until the mutex is available. | [
"Lock",
"locks",
"the",
"TimedMutex",
".",
"name",
"is",
"a",
"string",
"to",
"identify",
"you",
"to",
"callers",
"who",
"fail",
"to",
"acquire",
"the",
"lock",
".",
"If",
"the",
"mutex",
"is",
"already",
"in",
"use",
"the",
"calling",
"goroutine",
"bloc... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/sync/timedmutex.go#L49-L54 |
139,562 | control-center/serviced | commons/sync/timedmutex.go | LockWithTimeout | func (m *TimedMutex) LockWithTimeout(name string, timeout time.Duration) (gotLock bool, holder string) {
select {
case <-m.ch:
m.holder.Store(name)
return true, m.holder.Load().(string)
case <-time.After(timeout):
return false, m.holder.Load().(string)
}
} | go | func (m *TimedMutex) LockWithTimeout(name string, timeout time.Duration) (gotLock bool, holder string) {
select {
case <-m.ch:
m.holder.Store(name)
return true, m.holder.Load().(string)
case <-time.After(timeout):
return false, m.holder.Load().(string)
}
} | [
"func",
"(",
"m",
"*",
"TimedMutex",
")",
"LockWithTimeout",
"(",
"name",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"gotLock",
"bool",
",",
"holder",
"string",
")",
"{",
"select",
"{",
"case",
"<-",
"m",
".",
"ch",
":",
"m",
".",
... | // LockWithTimeout attempts to lock the TimedMutex but returns if it cannot acquire
// the lock within the time specified.
// name is a string to identify you to callers who fail to acquire the lock.
//
// The bool returned indicates whether you acquired the lock.
// The string is the name of the current holder of the ... | [
"LockWithTimeout",
"attempts",
"to",
"lock",
"the",
"TimedMutex",
"but",
"returns",
"if",
"it",
"cannot",
"acquire",
"the",
"lock",
"within",
"the",
"time",
"specified",
".",
"name",
"is",
"a",
"string",
"to",
"identify",
"you",
"to",
"callers",
"who",
"fail... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/sync/timedmutex.go#L62-L70 |
139,563 | control-center/serviced | web/exports.go | NewRoundRobinExports | func NewRoundRobinExports(data []registry.ExportDetails) *RoundRobinExports {
e := &RoundRobinExports{
mu: &sync.Mutex{},
}
e.set(data)
return e
} | go | func NewRoundRobinExports(data []registry.ExportDetails) *RoundRobinExports {
e := &RoundRobinExports{
mu: &sync.Mutex{},
}
e.set(data)
return e
} | [
"func",
"NewRoundRobinExports",
"(",
"data",
"[",
"]",
"registry",
".",
"ExportDetails",
")",
"*",
"RoundRobinExports",
"{",
"e",
":=",
"&",
"RoundRobinExports",
"{",
"mu",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"}",
"\n",
"e",
".",
"set",
"(",... | // NewRoundRobinExports creates a new round robin list of exports | [
"NewRoundRobinExports",
"creates",
"a",
"new",
"round",
"robin",
"list",
"of",
"exports"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/exports.go#L42-L48 |
139,564 | control-center/serviced | web/exports.go | Set | func (e *RoundRobinExports) Set(data []registry.ExportDetails) {
e.mu.Lock()
defer e.mu.Unlock()
e.set(data)
} | go | func (e *RoundRobinExports) Set(data []registry.ExportDetails) {
e.mu.Lock()
defer e.mu.Unlock()
e.set(data)
} | [
"func",
"(",
"e",
"*",
"RoundRobinExports",
")",
"Set",
"(",
"data",
"[",
"]",
"registry",
".",
"ExportDetails",
")",
"{",
"e",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"e",
".",
"set",
"("... | // Set updates the list of exports. | [
"Set",
"updates",
"the",
"list",
"of",
"exports",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/exports.go#L51-L55 |
139,565 | control-center/serviced | web/exports.go | set | func (e *RoundRobinExports) set(data []registry.ExportDetails) {
// reset the counter
e.xid = 0
// randomize the exports
e.data = make([]registry.ExportDetails, len(data))
for i, j := range rand.Perm(len(data)) {
e.data[i] = data[j]
}
} | go | func (e *RoundRobinExports) set(data []registry.ExportDetails) {
// reset the counter
e.xid = 0
// randomize the exports
e.data = make([]registry.ExportDetails, len(data))
for i, j := range rand.Perm(len(data)) {
e.data[i] = data[j]
}
} | [
"func",
"(",
"e",
"*",
"RoundRobinExports",
")",
"set",
"(",
"data",
"[",
"]",
"registry",
".",
"ExportDetails",
")",
"{",
"// reset the counter",
"e",
".",
"xid",
"=",
"0",
"\n\n",
"// randomize the exports",
"e",
".",
"data",
"=",
"make",
"(",
"[",
"]"... | // set updates the export list, but first randomizes the order and resets the
// counter. | [
"set",
"updates",
"the",
"export",
"list",
"but",
"first",
"randomizes",
"the",
"order",
"and",
"resets",
"the",
"counter",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/exports.go#L59-L69 |
139,566 | control-center/serviced | web/exports.go | Next | func (e *RoundRobinExports) Next() *registry.ExportDetails {
e.mu.Lock()
defer e.mu.Unlock()
// make sure there is data to submit
if size := len(e.data); size > 0 {
dat := e.data[e.xid]
e.xid = (e.xid + 1) % size
return &dat
}
return nil
} | go | func (e *RoundRobinExports) Next() *registry.ExportDetails {
e.mu.Lock()
defer e.mu.Unlock()
// make sure there is data to submit
if size := len(e.data); size > 0 {
dat := e.data[e.xid]
e.xid = (e.xid + 1) % size
return &dat
}
return nil
} | [
"func",
"(",
"e",
"*",
"RoundRobinExports",
")",
"Next",
"(",
")",
"*",
"registry",
".",
"ExportDetails",
"{",
"e",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"// make sure there is data to submit",
... | // Next returns the next available export | [
"Next",
"returns",
"the",
"next",
"available",
"export"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/exports.go#L72-L83 |
139,567 | control-center/serviced | container/metric_forwarder.go | NewMetricForwarder | func NewMetricForwarder(port, metricsRedirectURL string) (config *MetricForwarder, err error) {
if len(port) < 4 {
return nil, fmt.Errorf("invalid port specification: '%s'", port)
}
config = &MetricForwarder{
port: port,
metricsRedirectURL: metricsRedirectURL,
}
listener, err := net.Listen("tcp... | go | func NewMetricForwarder(port, metricsRedirectURL string) (config *MetricForwarder, err error) {
if len(port) < 4 {
return nil, fmt.Errorf("invalid port specification: '%s'", port)
}
config = &MetricForwarder{
port: port,
metricsRedirectURL: metricsRedirectURL,
}
listener, err := net.Listen("tcp... | [
"func",
"NewMetricForwarder",
"(",
"port",
",",
"metricsRedirectURL",
"string",
")",
"(",
"config",
"*",
"MetricForwarder",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"port",
")",
"<",
"4",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\... | // NewMetricForwarder creates a new metric forwarder at port, all metrics are forwarded to metricsRedirectURL | [
"NewMetricForwarder",
"creates",
"a",
"new",
"metric",
"forwarder",
"at",
"port",
"all",
"metrics",
"are",
"forwarded",
"to",
"metricsRedirectURL"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/metric_forwarder.go#L38-L53 |
139,568 | control-center/serviced | container/metric_forwarder.go | Close | func (forwarder *MetricForwarder) Close() error {
if forwarder != nil && forwarder.listener != nil {
(*forwarder.listener).Close()
forwarder.listener = nil
}
return nil
} | go | func (forwarder *MetricForwarder) Close() error {
if forwarder != nil && forwarder.listener != nil {
(*forwarder.listener).Close()
forwarder.listener = nil
}
return nil
} | [
"func",
"(",
"forwarder",
"*",
"MetricForwarder",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"forwarder",
"!=",
"nil",
"&&",
"forwarder",
".",
"listener",
"!=",
"nil",
"{",
"(",
"*",
"forwarder",
".",
"listener",
")",
".",
"Close",
"(",
")",
"\n",
"... | // Close shuts down the forwarder. | [
"Close",
"shuts",
"down",
"the",
"forwarder",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/metric_forwarder.go#L72-L78 |
139,569 | control-center/serviced | container/metric_forwarder.go | postAPIMetricsStore | func postAPIMetricsStore(redirectURL string) func(*rest.ResponseWriter, *rest.Request) {
return func(w *rest.ResponseWriter, request *rest.Request) {
proxyRequest, _ := http.NewRequest(request.Method, redirectURL, request.Body)
for k, v := range request.Header {
proxyRequest.Header[k] = v
}
proxyResponse, e... | go | func postAPIMetricsStore(redirectURL string) func(*rest.ResponseWriter, *rest.Request) {
return func(w *rest.ResponseWriter, request *rest.Request) {
proxyRequest, _ := http.NewRequest(request.Method, redirectURL, request.Body)
for k, v := range request.Header {
proxyRequest.Header[k] = v
}
proxyResponse, e... | [
"func",
"postAPIMetricsStore",
"(",
"redirectURL",
"string",
")",
"func",
"(",
"*",
"rest",
".",
"ResponseWriter",
",",
"*",
"rest",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"*",
"rest",
".",
"ResponseWriter",
",",
"request",
"*",
"rest",
".... | // postAPIMetricsStore redirects the post request to the configured address
// Any additional parameters should be encoded in the redirect url. For
// example, encode the containers tenant and service id. | [
"postAPIMetricsStore",
"redirects",
"the",
"post",
"request",
"to",
"the",
"configured",
"address",
"Any",
"additional",
"parameters",
"should",
"be",
"encoded",
"in",
"the",
"redirect",
"url",
".",
"For",
"example",
"encode",
"the",
"containers",
"tenant",
"and",... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/metric_forwarder.go#L83-L99 |
139,570 | control-center/serviced | rpc/master/pool_server.go | GetResourcePools | func (s *Server) GetResourcePools(empty struct{}, poolsReply *[]pool.ResourcePool) error {
pools, err := s.f.GetResourcePools(s.context())
if err != nil {
return err
}
*poolsReply = pools
return nil
} | go | func (s *Server) GetResourcePools(empty struct{}, poolsReply *[]pool.ResourcePool) error {
pools, err := s.f.GetResourcePools(s.context())
if err != nil {
return err
}
*poolsReply = pools
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetResourcePools",
"(",
"empty",
"struct",
"{",
"}",
",",
"poolsReply",
"*",
"[",
"]",
"pool",
".",
"ResourcePool",
")",
"error",
"{",
"pools",
",",
"err",
":=",
"s",
".",
"f",
".",
"GetResourcePools",
"(",
"s",... | // GetResourcePools returns all ResourcePools | [
"GetResourcePools",
"returns",
"all",
"ResourcePools"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/pool_server.go#L23-L31 |
139,571 | control-center/serviced | rpc/master/pool_server.go | AddResourcePool | func (s *Server) AddResourcePool(pool pool.ResourcePool, _ *struct{}) error {
return s.f.AddResourcePool(s.context(), &pool)
} | go | func (s *Server) AddResourcePool(pool pool.ResourcePool, _ *struct{}) error {
return s.f.AddResourcePool(s.context(), &pool)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"AddResourcePool",
"(",
"pool",
"pool",
".",
"ResourcePool",
",",
"_",
"*",
"struct",
"{",
"}",
")",
"error",
"{",
"return",
"s",
".",
"f",
".",
"AddResourcePool",
"(",
"s",
".",
"context",
"(",
")",
",",
"&",
... | // AddResourcePool adds the pool | [
"AddResourcePool",
"adds",
"the",
"pool"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/pool_server.go#L34-L36 |
139,572 | control-center/serviced | rpc/master/pool_server.go | GetResourcePool | func (s *Server) GetResourcePool(poolID string, reply *pool.ResourcePool) error {
response, err := s.f.GetResourcePool(s.context(), poolID)
if err != nil {
return err
}
if response == nil {
return errors.New("pool not found")
}
*reply = *response
return nil
} | go | func (s *Server) GetResourcePool(poolID string, reply *pool.ResourcePool) error {
response, err := s.f.GetResourcePool(s.context(), poolID)
if err != nil {
return err
}
if response == nil {
return errors.New("pool not found")
}
*reply = *response
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetResourcePool",
"(",
"poolID",
"string",
",",
"reply",
"*",
"pool",
".",
"ResourcePool",
")",
"error",
"{",
"response",
",",
"err",
":=",
"s",
".",
"f",
".",
"GetResourcePool",
"(",
"s",
".",
"context",
"(",
"... | // GetResourcePool gets the pool | [
"GetResourcePool",
"gets",
"the",
"pool"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/pool_server.go#L44-L54 |
139,573 | control-center/serviced | rpc/master/pool_server.go | RemoveResourcePool | func (s *Server) RemoveResourcePool(poolID string, _ *struct{}) error {
return s.f.RemoveResourcePool(s.context(), poolID)
} | go | func (s *Server) RemoveResourcePool(poolID string, _ *struct{}) error {
return s.f.RemoveResourcePool(s.context(), poolID)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"RemoveResourcePool",
"(",
"poolID",
"string",
",",
"_",
"*",
"struct",
"{",
"}",
")",
"error",
"{",
"return",
"s",
".",
"f",
".",
"RemoveResourcePool",
"(",
"s",
".",
"context",
"(",
")",
",",
"poolID",
")",
"... | // RemoveResourcePool removes the pool | [
"RemoveResourcePool",
"removes",
"the",
"pool"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/pool_server.go#L57-L59 |
139,574 | control-center/serviced | rpc/master/pool_server.go | GetPoolIPs | func (s *Server) GetPoolIPs(poolID string, reply *pool.PoolIPs) error {
response, err := s.f.GetPoolIPs(s.context(), poolID)
if err != nil {
return err
}
if response == nil {
return errors.New("pool not found")
}
*reply = *response
return nil
} | go | func (s *Server) GetPoolIPs(poolID string, reply *pool.PoolIPs) error {
response, err := s.f.GetPoolIPs(s.context(), poolID)
if err != nil {
return err
}
if response == nil {
return errors.New("pool not found")
}
*reply = *response
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetPoolIPs",
"(",
"poolID",
"string",
",",
"reply",
"*",
"pool",
".",
"PoolIPs",
")",
"error",
"{",
"response",
",",
"err",
":=",
"s",
".",
"f",
".",
"GetPoolIPs",
"(",
"s",
".",
"context",
"(",
")",
",",
"p... | // GetPoolIPs gets all ips available to a pool | [
"GetPoolIPs",
"gets",
"all",
"ips",
"available",
"to",
"a",
"pool"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/pool_server.go#L62-L72 |
139,575 | control-center/serviced | rpc/master/pool_server.go | AddVirtualIP | func (s *Server) AddVirtualIP(requestVirtualIP pool.VirtualIP, _ *struct{}) error {
return s.f.AddVirtualIP(s.context(), requestVirtualIP)
} | go | func (s *Server) AddVirtualIP(requestVirtualIP pool.VirtualIP, _ *struct{}) error {
return s.f.AddVirtualIP(s.context(), requestVirtualIP)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"AddVirtualIP",
"(",
"requestVirtualIP",
"pool",
".",
"VirtualIP",
",",
"_",
"*",
"struct",
"{",
"}",
")",
"error",
"{",
"return",
"s",
".",
"f",
".",
"AddVirtualIP",
"(",
"s",
".",
"context",
"(",
")",
",",
"r... | // AddVirtualIP adds a specific virtual IP to a pool | [
"AddVirtualIP",
"adds",
"a",
"specific",
"virtual",
"IP",
"to",
"a",
"pool"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/pool_server.go#L75-L77 |
139,576 | control-center/serviced | dfs/rollback.go | Rollback | func (dfs *DistributedFilesystem) Rollback(snapshotID string) error {
vol, info, err := dfs.getSnapshotVolumeAndInfo(snapshotID)
if err != nil {
return err
}
// do all the images exist in the registry?
r, err := vol.ReadMetadata(info.Label, ImagesMetadataFile)
if err != nil {
glog.Errorf("Could not receive im... | go | func (dfs *DistributedFilesystem) Rollback(snapshotID string) error {
vol, info, err := dfs.getSnapshotVolumeAndInfo(snapshotID)
if err != nil {
return err
}
// do all the images exist in the registry?
r, err := vol.ReadMetadata(info.Label, ImagesMetadataFile)
if err != nil {
glog.Errorf("Could not receive im... | [
"func",
"(",
"dfs",
"*",
"DistributedFilesystem",
")",
"Rollback",
"(",
"snapshotID",
"string",
")",
"error",
"{",
"vol",
",",
"info",
",",
"err",
":=",
"dfs",
".",
"getSnapshotVolumeAndInfo",
"(",
"snapshotID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Rollback reverts an application to a previous snapshot. | [
"Rollback",
"reverts",
"an",
"application",
"to",
"a",
"previous",
"snapshot",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/rollback.go#L22-L60 |
139,577 | control-center/serviced | zzk/leader.go | NewLeaderListener | func NewLeaderListener(path string) *LeaderListener {
return &LeaderListener{
path: path,
mu: &sync.Mutex{},
watchers: make([]watcher, 0),
}
} | go | func NewLeaderListener(path string) *LeaderListener {
return &LeaderListener{
path: path,
mu: &sync.Mutex{},
watchers: make([]watcher, 0),
}
} | [
"func",
"NewLeaderListener",
"(",
"path",
"string",
")",
"*",
"LeaderListener",
"{",
"return",
"&",
"LeaderListener",
"{",
"path",
":",
"path",
",",
"mu",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"watchers",
":",
"make",
"(",
"[",
"]",
"watcher",... | // NewLeaderListener instantiates a listener to watch the leader election at a
// given path. | [
"NewLeaderListener",
"instantiates",
"a",
"listener",
"to",
"watch",
"the",
"leader",
"election",
"at",
"a",
"given",
"path",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/leader.go#L37-L43 |
139,578 | control-center/serviced | zzk/leader.go | Wait | func (l *LeaderListener) Wait() <-chan struct{} {
l.mu.Lock()
defer l.mu.Unlock()
var c = make(chan struct{}, 1)
l.watchers = append(l.watchers, watcher{c: c})
return c
} | go | func (l *LeaderListener) Wait() <-chan struct{} {
l.mu.Lock()
defer l.mu.Unlock()
var c = make(chan struct{}, 1)
l.watchers = append(l.watchers, watcher{c: c})
return c
} | [
"func",
"(",
"l",
"*",
"LeaderListener",
")",
"Wait",
"(",
")",
"<-",
"chan",
"struct",
"{",
"}",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"var",
"c",
"=",
"make",
"(",
"chan",
... | // Wait enqueues a watcher that will be updated when a new leader is elected | [
"Wait",
"enqueues",
"a",
"watcher",
"that",
"will",
"be",
"updated",
"when",
"a",
"new",
"leader",
"is",
"elected"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/leader.go#L46-L52 |
139,579 | control-center/serviced | zzk/leader.go | broadcast | func (l *LeaderListener) broadcast() { // TODO: we may want to pass in a type
l.mu.Lock()
defer l.mu.Unlock()
for _, w := range l.watchers {
w.c <- struct{}{}
}
l.watchers = make([]watcher, 0)
} | go | func (l *LeaderListener) broadcast() { // TODO: we may want to pass in a type
l.mu.Lock()
defer l.mu.Unlock()
for _, w := range l.watchers {
w.c <- struct{}{}
}
l.watchers = make([]watcher, 0)
} | [
"func",
"(",
"l",
"*",
"LeaderListener",
")",
"broadcast",
"(",
")",
"{",
"// TODO: we may want to pass in a type",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"w",
":=",
"rang... | // broadcast alerts all the watchers that a new leader has been elected | [
"broadcast",
"alerts",
"all",
"the",
"watchers",
"that",
"a",
"new",
"leader",
"has",
"been",
"elected"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/leader.go#L55-L62 |
139,580 | control-center/serviced | zzk/leader.go | Run | func (l *LeaderListener) Run(cancel <-chan interface{}, conn client.Connection) {
logger := plog.WithField("path", l.path)
done := make(chan struct{})
defer func() { close(done) }()
for {
// check if the path exists
var ok, ev, err = conn.ExistsW(l.path, done)
if err != nil {
logger.WithError(err).Error... | go | func (l *LeaderListener) Run(cancel <-chan interface{}, conn client.Connection) {
logger := plog.WithField("path", l.path)
done := make(chan struct{})
defer func() { close(done) }()
for {
// check if the path exists
var ok, ev, err = conn.ExistsW(l.path, done)
if err != nil {
logger.WithError(err).Error... | [
"func",
"(",
"l",
"*",
"LeaderListener",
")",
"Run",
"(",
"cancel",
"<-",
"chan",
"interface",
"{",
"}",
",",
"conn",
"client",
".",
"Connection",
")",
"{",
"logger",
":=",
"plog",
".",
"WithField",
"(",
"\"",
"\"",
",",
"l",
".",
"path",
")",
"\n\... | // Run manages the event loop for this listener | [
"Run",
"manages",
"the",
"event",
"loop",
"for",
"this",
"listener"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/leader.go#L65-L128 |
139,581 | control-center/serviced | cli/api/imagemap.go | Set | func (m *ImageMap) Set(value string) error {
parts := strings.Split(value, ",")
if len(parts) != 2 {
return fmt.Errorf("bad format")
}
(*m)[parts[0]] = parts[1]
return nil
} | go | func (m *ImageMap) Set(value string) error {
parts := strings.Split(value, ",")
if len(parts) != 2 {
return fmt.Errorf("bad format")
}
(*m)[parts[0]] = parts[1]
return nil
} | [
"func",
"(",
"m",
"*",
"ImageMap",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"value",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"E... | // Set converts a docker image mapping into an ImageMap | [
"Set",
"converts",
"a",
"docker",
"image",
"mapping",
"into",
"an",
"ImageMap"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/imagemap.go#L25-L33 |
139,582 | control-center/serviced | cli/api/template.go | GetServiceTemplates | func (a *api) GetServiceTemplates() ([]template.ServiceTemplate, error) {
client, err := a.connectMaster()
if err != nil {
return nil, err
}
templateMap, err := client.GetServiceTemplates()
if err != nil {
return nil, err
}
templates := make([]template.ServiceTemplate, len(templateMap))
i := 0
for id, t ... | go | func (a *api) GetServiceTemplates() ([]template.ServiceTemplate, error) {
client, err := a.connectMaster()
if err != nil {
return nil, err
}
templateMap, err := client.GetServiceTemplates()
if err != nil {
return nil, err
}
templates := make([]template.ServiceTemplate, len(templateMap))
i := 0
for id, t ... | [
"func",
"(",
"a",
"*",
"api",
")",
"GetServiceTemplates",
"(",
")",
"(",
"[",
"]",
"template",
".",
"ServiceTemplate",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"a",
".",
"connectMaster",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"re... | // Gets all available service templates | [
"Gets",
"all",
"available",
"service",
"templates"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/template.go#L41-L60 |
139,583 | control-center/serviced | cli/api/template.go | GetServiceTemplate | func (a *api) GetServiceTemplate(id string) (*template.ServiceTemplate, error) {
client, err := a.connectMaster()
if err != nil {
return nil, err
}
templateMap, err := client.GetServiceTemplates()
if err != nil {
return nil, err
}
if _, ok := templateMap[id]; !ok {
return nil, fmt.Errorf("unable to find ... | go | func (a *api) GetServiceTemplate(id string) (*template.ServiceTemplate, error) {
client, err := a.connectMaster()
if err != nil {
return nil, err
}
templateMap, err := client.GetServiceTemplates()
if err != nil {
return nil, err
}
if _, ok := templateMap[id]; !ok {
return nil, fmt.Errorf("unable to find ... | [
"func",
"(",
"a",
"*",
"api",
")",
"GetServiceTemplate",
"(",
"id",
"string",
")",
"(",
"*",
"template",
".",
"ServiceTemplate",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"a",
".",
"connectMaster",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Gets a particular serviced template by its template ID | [
"Gets",
"a",
"particular",
"serviced",
"template",
"by",
"its",
"template",
"ID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/template.go#L63-L81 |
139,584 | control-center/serviced | cli/api/template.go | AddServiceTemplate | func (a *api) AddServiceTemplate(reader io.Reader) (*template.ServiceTemplate, error) {
// Unmarshal JSON from the reader
var t template.ServiceTemplate
if err := json.NewDecoder(reader).Decode(&t); err != nil {
return nil, fmt.Errorf("could not unmarshal json: %s", err)
}
// Connect to the client
client, err ... | go | func (a *api) AddServiceTemplate(reader io.Reader) (*template.ServiceTemplate, error) {
// Unmarshal JSON from the reader
var t template.ServiceTemplate
if err := json.NewDecoder(reader).Decode(&t); err != nil {
return nil, fmt.Errorf("could not unmarshal json: %s", err)
}
// Connect to the client
client, err ... | [
"func",
"(",
"a",
"*",
"api",
")",
"AddServiceTemplate",
"(",
"reader",
"io",
".",
"Reader",
")",
"(",
"*",
"template",
".",
"ServiceTemplate",
",",
"error",
")",
"{",
"// Unmarshal JSON from the reader",
"var",
"t",
"template",
".",
"ServiceTemplate",
"\n",
... | // Adds a new service template | [
"Adds",
"a",
"new",
"service",
"template"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/template.go#L84-L104 |
139,585 | control-center/serviced | cli/api/template.go | CompileServiceTemplate | func (a *api) CompileServiceTemplate(config CompileTemplateConfig) (*template.ServiceTemplate, error) {
st, err := template.BuildFromPath(config.Dir)
if err != nil {
return nil, err
}
var mapImageNames func(*servicedefinition.ServiceDefinition)
mapImageNames = func(svc *servicedefinition.ServiceDefinition) {
... | go | func (a *api) CompileServiceTemplate(config CompileTemplateConfig) (*template.ServiceTemplate, error) {
st, err := template.BuildFromPath(config.Dir)
if err != nil {
return nil, err
}
var mapImageNames func(*servicedefinition.ServiceDefinition)
mapImageNames = func(svc *servicedefinition.ServiceDefinition) {
... | [
"func",
"(",
"a",
"*",
"api",
")",
"CompileServiceTemplate",
"(",
"config",
"CompileTemplateConfig",
")",
"(",
"*",
"template",
".",
"ServiceTemplate",
",",
"error",
")",
"{",
"st",
",",
"err",
":=",
"template",
".",
"BuildFromPath",
"(",
"config",
".",
"D... | // CompileTemplate builds a template given a source path | [
"CompileTemplate",
"builds",
"a",
"template",
"given",
"a",
"source",
"path"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/template.go#L117-L136 |
139,586 | control-center/serviced | cli/api/template.go | DeployServiceTemplate | func (a *api) DeployServiceTemplate(config DeployTemplateConfig) ([]service.ServiceDetails, error) {
client, err := a.connectMaster()
if err != nil {
return nil, err
}
req := template.ServiceTemplateDeploymentRequest{
PoolID: config.PoolID,
TemplateID: config.ID,
DeploymentID: config.DeploymentID,
... | go | func (a *api) DeployServiceTemplate(config DeployTemplateConfig) ([]service.ServiceDetails, error) {
client, err := a.connectMaster()
if err != nil {
return nil, err
}
req := template.ServiceTemplateDeploymentRequest{
PoolID: config.PoolID,
TemplateID: config.ID,
DeploymentID: config.DeploymentID,
... | [
"func",
"(",
"a",
"*",
"api",
")",
"DeployServiceTemplate",
"(",
"config",
"DeployTemplateConfig",
")",
"(",
"[",
"]",
"service",
".",
"ServiceDetails",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"a",
".",
"connectMaster",
"(",
")",
"\n",
"if",
... | // DeployTemplate deploys a template given its template ID | [
"DeployTemplate",
"deploys",
"a",
"template",
"given",
"its",
"template",
"ID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/template.go#L139-L170 |
139,587 | control-center/serviced | domain/host/host.go | Equals | func (a *Host) Equals(b *Host) bool {
if a.ID != b.ID {
return false
}
if a.Name != b.Name {
return false
}
if a.PoolID != b.PoolID {
return false
}
if a.IPAddr != b.IPAddr {
return false
}
if a.RPCPort != b.RPCPort {
return false
}
if a.Cores != b.Cores {
return false
}
if a.Memory != b.Memory... | go | func (a *Host) Equals(b *Host) bool {
if a.ID != b.ID {
return false
}
if a.Name != b.Name {
return false
}
if a.PoolID != b.PoolID {
return false
}
if a.IPAddr != b.IPAddr {
return false
}
if a.RPCPort != b.RPCPort {
return false
}
if a.Cores != b.Cores {
return false
}
if a.Memory != b.Memory... | [
"func",
"(",
"a",
"*",
"Host",
")",
"Equals",
"(",
"b",
"*",
"Host",
")",
"bool",
"{",
"if",
"a",
".",
"ID",
"!=",
"b",
".",
"ID",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"a",
".",
"Name",
"!=",
"b",
".",
"Name",
"{",
"return",
"fals... | // Equals verifies whether two host objects are equal | [
"Equals",
"verifies",
"whether",
"two",
"host",
"objects",
"are",
"equal"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/host/host.go#L126-L177 |
139,588 | control-center/serviced | domain/host/host.go | Build | func Build(ip string, rpcport string, poolid string, memory string, ipAddrs ...string) (*Host, error) {
if strings.TrimSpace(poolid) == "" {
return nil, errors.New("empty poolid not allowed")
}
rpcPort, err := strconv.Atoi(rpcport)
if err != nil {
return nil, err
}
host, err := currentHost(ip, rpcPort, pooli... | go | func Build(ip string, rpcport string, poolid string, memory string, ipAddrs ...string) (*Host, error) {
if strings.TrimSpace(poolid) == "" {
return nil, errors.New("empty poolid not allowed")
}
rpcPort, err := strconv.Atoi(rpcport)
if err != nil {
return nil, err
}
host, err := currentHost(ip, rpcPort, pooli... | [
"func",
"Build",
"(",
"ip",
"string",
",",
"rpcport",
"string",
",",
"poolid",
"string",
",",
"memory",
"string",
",",
"ipAddrs",
"...",
"string",
")",
"(",
"*",
"Host",
",",
"error",
")",
"{",
"if",
"strings",
".",
"TrimSpace",
"(",
"poolid",
")",
"... | // Build creates a Host type from the current host machine, filling out fields using the current machines attributes.
// The IP param is a routable IP used to connect to to the Host, if empty an IP from the available IPs will be used.
// The poolid param is the pool the host should belong to. Optional list of IP addre... | [
"Build",
"creates",
"a",
"Host",
"type",
"from",
"the",
"current",
"host",
"machine",
"filling",
"out",
"fields",
"using",
"the",
"current",
"machines",
"attributes",
".",
"The",
"IP",
"param",
"is",
"a",
"routable",
"IP",
"used",
"to",
"connect",
"to",
"t... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/host/host.go#L198-L245 |
139,589 | control-center/serviced | domain/host/host.go | UpdateHostInfo | func UpdateHostInfo(h Host) (Host, error) {
currentHost, err := currentHost(h.IPAddr, h.RPCPort, h.PoolID)
if err != nil {
return Host{}, err
}
//update the passed in *copy* so we don't have to deal with new non hardware fields later on
h.Name = currentHost.Name
h.Memory = currentHost.Memory
h.Cores = current... | go | func UpdateHostInfo(h Host) (Host, error) {
currentHost, err := currentHost(h.IPAddr, h.RPCPort, h.PoolID)
if err != nil {
return Host{}, err
}
//update the passed in *copy* so we don't have to deal with new non hardware fields later on
h.Name = currentHost.Name
h.Memory = currentHost.Memory
h.Cores = current... | [
"func",
"UpdateHostInfo",
"(",
"h",
"Host",
")",
"(",
"Host",
",",
"error",
")",
"{",
"currentHost",
",",
"err",
":=",
"currentHost",
"(",
"h",
".",
"IPAddr",
",",
"h",
".",
"RPCPort",
",",
"h",
".",
"PoolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | //UpdateHostInfo returns a new host with updated hardware and software info. Does not update port or IP information | [
"UpdateHostInfo",
"returns",
"a",
"new",
"host",
"with",
"updated",
"hardware",
"and",
"software",
"info",
".",
"Does",
"not",
"update",
"port",
"or",
"IP",
"information"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/host/host.go#L248-L264 |
139,590 | control-center/serviced | volume/volume.go | InitIOStat | func InitIOStat(getter iostat.Getter, closeChannel <-chan interface{}) {
lastIOStat.Lock()
if lastIOStat.Running {
glog.Warning("Tried to start iostat watch, but it's already running")
lastIOStat.Unlock()
return
}
lastIOStat.Running = true
lastIOStat.Unlock()
defer func() {
glog.Infof("IOStat watcher ter... | go | func InitIOStat(getter iostat.Getter, closeChannel <-chan interface{}) {
lastIOStat.Lock()
if lastIOStat.Running {
glog.Warning("Tried to start iostat watch, but it's already running")
lastIOStat.Unlock()
return
}
lastIOStat.Running = true
lastIOStat.Unlock()
defer func() {
glog.Infof("IOStat watcher ter... | [
"func",
"InitIOStat",
"(",
"getter",
"iostat",
".",
"Getter",
",",
"closeChannel",
"<-",
"chan",
"interface",
"{",
"}",
")",
"{",
"lastIOStat",
".",
"Lock",
"(",
")",
"\n",
"if",
"lastIOStat",
".",
"Running",
"{",
"glog",
".",
"Warning",
"(",
"\"",
"\"... | // InitIOStat starts the iostat call and passes the close signal when sent | [
"InitIOStat",
"starts",
"the",
"iostat",
"call",
"and",
"passes",
"the",
"close",
"signal",
"when",
"sent"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/volume.go#L245-L302 |
139,591 | control-center/serviced | volume/volume.go | GetLastIOStat | func GetLastIOStat() map[string]iostat.DeviceUtilizationReport {
lastIOStat.RLock()
defer lastIOStat.RUnlock()
return lastIOStat.Data
} | go | func GetLastIOStat() map[string]iostat.DeviceUtilizationReport {
lastIOStat.RLock()
defer lastIOStat.RUnlock()
return lastIOStat.Data
} | [
"func",
"GetLastIOStat",
"(",
")",
"map",
"[",
"string",
"]",
"iostat",
".",
"DeviceUtilizationReport",
"{",
"lastIOStat",
".",
"RLock",
"(",
")",
"\n",
"defer",
"lastIOStat",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"lastIOStat",
".",
"Data",
"\n",
"}"
] | // GetLastIOStat returns the iostat device utilization reports | [
"GetLastIOStat",
"returns",
"the",
"iostat",
"device",
"utilization",
"reports"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/volume.go#L305-L309 |
139,592 | control-center/serviced | volume/volume.go | SplitPath | func SplitPath(volumePath string) (string, string, error) {
// Validate the path
rootDir := filepath.Clean(volumePath)
if !filepath.IsAbs(rootDir) {
// must be absolute
return "", "", ErrPathIsNotAbs
}
if _, ok := driversByRoot[rootDir]; ok {
return volumePath, "", nil
}
for {
rootDir = filepath.Dir(root... | go | func SplitPath(volumePath string) (string, string, error) {
// Validate the path
rootDir := filepath.Clean(volumePath)
if !filepath.IsAbs(rootDir) {
// must be absolute
return "", "", ErrPathIsNotAbs
}
if _, ok := driversByRoot[rootDir]; ok {
return volumePath, "", nil
}
for {
rootDir = filepath.Dir(root... | [
"func",
"SplitPath",
"(",
"volumePath",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"// Validate the path",
"rootDir",
":=",
"filepath",
".",
"Clean",
"(",
"volumePath",
")",
"\n",
"if",
"!",
"filepath",
".",
"IsAbs",
"(",
"rootDir... | // SplitPath splits a path by its driver and respective volume. Returns
// error if the driver is not initialized. | [
"SplitPath",
"splits",
"a",
"path",
"by",
"its",
"driver",
"and",
"respective",
"volume",
".",
"Returns",
"error",
"if",
"the",
"driver",
"is",
"not",
"initialized",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/volume.go#L313-L340 |
139,593 | control-center/serviced | volume/volume.go | FindMount | func FindMount(volumePath string) (Volume, error) {
rootDir, volumeName, err := SplitPath(volumePath)
if err != nil {
return nil, err
} else if rootDir == volumePath {
return nil, ErrPathIsDriver
}
return Mount(volumeName, rootDir)
} | go | func FindMount(volumePath string) (Volume, error) {
rootDir, volumeName, err := SplitPath(volumePath)
if err != nil {
return nil, err
} else if rootDir == volumePath {
return nil, ErrPathIsDriver
}
return Mount(volumeName, rootDir)
} | [
"func",
"FindMount",
"(",
"volumePath",
"string",
")",
"(",
"Volume",
",",
"error",
")",
"{",
"rootDir",
",",
"volumeName",
",",
"err",
":=",
"SplitPath",
"(",
"volumePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
... | // FindMount mounts a path based on the relative location of the nearest driver. | [
"FindMount",
"mounts",
"a",
"path",
"based",
"on",
"the",
"relative",
"location",
"of",
"the",
"nearest",
"driver",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/volume.go#L343-L351 |
139,594 | control-center/serviced | volume/volume.go | ShutdownDriver | func ShutdownDriver(rootDir string) error {
driver, ok := driversByRoot[rootDir]
if !ok {
glog.Errorf("Tried to shut down uninitialized driver: %s", rootDir)
return ErrDriverNotInit
}
glog.V(2).Infof("Shutting down %s driver for %s", driver.DriverType(), driver.Root())
if err := driver.Cleanup(); err != nil {
... | go | func ShutdownDriver(rootDir string) error {
driver, ok := driversByRoot[rootDir]
if !ok {
glog.Errorf("Tried to shut down uninitialized driver: %s", rootDir)
return ErrDriverNotInit
}
glog.V(2).Infof("Shutting down %s driver for %s", driver.DriverType(), driver.Root())
if err := driver.Cleanup(); err != nil {
... | [
"func",
"ShutdownDriver",
"(",
"rootDir",
"string",
")",
"error",
"{",
"driver",
",",
"ok",
":=",
"driversByRoot",
"[",
"rootDir",
"]",
"\n",
"if",
"!",
"ok",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rootDir",
")",
"\n",
"return",
"ErrDriverN... | // ShutdownDriver shuts down an existing driver and removes it from our internal map. | [
"ShutdownDriver",
"shuts",
"down",
"an",
"existing",
"driver",
"and",
"removes",
"it",
"from",
"our",
"internal",
"map",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/volume.go#L388-L401 |
139,595 | control-center/serviced | volume/volume.go | ShutdownAll | func ShutdownAll() error {
errs := []error{}
for root, _ := range driversByRoot {
if err := ShutdownDriver(root); err != nil {
errs = append(errs, err)
}
}
if len(errs) > 0 {
return ErrBadDriverShutdown
}
return nil
} | go | func ShutdownAll() error {
errs := []error{}
for root, _ := range driversByRoot {
if err := ShutdownDriver(root); err != nil {
errs = append(errs, err)
}
}
if len(errs) > 0 {
return ErrBadDriverShutdown
}
return nil
} | [
"func",
"ShutdownAll",
"(",
")",
"error",
"{",
"errs",
":=",
"[",
"]",
"error",
"{",
"}",
"\n",
"for",
"root",
",",
"_",
":=",
"range",
"driversByRoot",
"{",
"if",
"err",
":=",
"ShutdownDriver",
"(",
"root",
")",
";",
"err",
"!=",
"nil",
"{",
"errs... | // ShutdownAll shuts down all drivers that have been initialized | [
"ShutdownAll",
"shuts",
"down",
"all",
"drivers",
"that",
"have",
"been",
"initialized"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/volume.go#L404-L415 |
139,596 | control-center/serviced | dfs/ttl/snapshotttl.go | RunSnapshotTTL | func RunSnapshotTTL(client SnapshotTTLInterface, cancel <-chan interface{}, min, max time.Duration) {
utils.RunTTL(&SnapshotTTL{client}, cancel, min, max)
} | go | func RunSnapshotTTL(client SnapshotTTLInterface, cancel <-chan interface{}, min, max time.Duration) {
utils.RunTTL(&SnapshotTTL{client}, cancel, min, max)
} | [
"func",
"RunSnapshotTTL",
"(",
"client",
"SnapshotTTLInterface",
",",
"cancel",
"<-",
"chan",
"interface",
"{",
"}",
",",
"min",
",",
"max",
"time",
".",
"Duration",
")",
"{",
"utils",
".",
"RunTTL",
"(",
"&",
"SnapshotTTL",
"{",
"client",
"}",
",",
"can... | // RunSnapshotTTL runs the ttl for snapshots | [
"RunSnapshotTTL",
"runs",
"the",
"ttl",
"for",
"snapshots"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/ttl/snapshotttl.go#L47-L49 |
139,597 | control-center/serviced | dfs/ttl/snapshotttl.go | Purge | func (ttl *SnapshotTTL) Purge(age time.Duration) (time.Duration, error) {
ctx := datastore.Get()
defer ctx.Metrics().Stop(ctx.Metrics().Start("SnapshotTTL.Purge"))
logger := plog.WithField("age", int(age.Minutes()))
expire := time.Now().Add(-age)
var tenantIDs []string
var unused struct{}
if err := ttl.client.... | go | func (ttl *SnapshotTTL) Purge(age time.Duration) (time.Duration, error) {
ctx := datastore.Get()
defer ctx.Metrics().Stop(ctx.Metrics().Start("SnapshotTTL.Purge"))
logger := plog.WithField("age", int(age.Minutes()))
expire := time.Now().Add(-age)
var tenantIDs []string
var unused struct{}
if err := ttl.client.... | [
"func",
"(",
"ttl",
"*",
"SnapshotTTL",
")",
"Purge",
"(",
"age",
"time",
".",
"Duration",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"ctx",
":=",
"datastore",
".",
"Get",
"(",
")",
"\n",
"defer",
"ctx",
".",
"Metrics",
"(",
")",
... | // Purge deletes snapshots as they reach a particular age. Returns the time to
// wait til the next snapshot is to be deleted.
// Implements utils.TTL | [
"Purge",
"deletes",
"snapshots",
"as",
"they",
"reach",
"a",
"particular",
"age",
".",
"Returns",
"the",
"time",
"to",
"wait",
"til",
"the",
"next",
"snapshot",
"is",
"to",
"be",
"deleted",
".",
"Implements",
"utils",
".",
"TTL"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/ttl/snapshotttl.go#L59-L105 |
139,598 | control-center/serviced | utils/ttl.go | RunTTL | func RunTTL(ttl TTL, cancel <-chan interface{}, min, max time.Duration) {
logger := plog.WithFields(log.Fields{
"name": ttl.Name(),
"min": int(min.Minutes()),
"max": int(max.Minutes()),
})
logger.Debug("Start TTL routine")
original_min := min
for {
var repeatSooner bool
wait, err := ttl.Purge(max)
i... | go | func RunTTL(ttl TTL, cancel <-chan interface{}, min, max time.Duration) {
logger := plog.WithFields(log.Fields{
"name": ttl.Name(),
"min": int(min.Minutes()),
"max": int(max.Minutes()),
})
logger.Debug("Start TTL routine")
original_min := min
for {
var repeatSooner bool
wait, err := ttl.Purge(max)
i... | [
"func",
"RunTTL",
"(",
"ttl",
"TTL",
",",
"cancel",
"<-",
"chan",
"interface",
"{",
"}",
",",
"min",
",",
"max",
"time",
".",
"Duration",
")",
"{",
"logger",
":=",
"plog",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"ttl",
... | // RunTTL purges expired data based upon the time interval | [
"RunTTL",
"purges",
"expired",
"data",
"based",
"upon",
"the",
"time",
"interval"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/ttl.go#L36-L72 |
139,599 | control-center/serviced | rpc/master/service_client.go | ServiceUse | func (c *Client) ServiceUse(serviceID string, imageID string, registry string, replaceImgs []string, noOp bool) (string, error) {
svcUseRequest := &ServiceUseRequest{ServiceID: serviceID, ImageID: imageID, ReplaceImgs: replaceImgs, Registry: registry, NoOp: noOp}
result := ""
plog.WithFields(logrus.Fields{
"imagei... | go | func (c *Client) ServiceUse(serviceID string, imageID string, registry string, replaceImgs []string, noOp bool) (string, error) {
svcUseRequest := &ServiceUseRequest{ServiceID: serviceID, ImageID: imageID, ReplaceImgs: replaceImgs, Registry: registry, NoOp: noOp}
result := ""
plog.WithFields(logrus.Fields{
"imagei... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ServiceUse",
"(",
"serviceID",
"string",
",",
"imageID",
"string",
",",
"registry",
"string",
",",
"replaceImgs",
"[",
"]",
"string",
",",
"noOp",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"svcUseRequest",... | // ServiceUse will use a new image for a given service - this will pull the image and tag it | [
"ServiceUse",
"will",
"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_client.go#L25-L37 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.