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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
140,000 | control-center/serviced | tools/serviced-storage/driver_linux.go | Execute | func (c *CheckOrphans) Execute(args []string) error {
App.initializeLogging()
directory := GetDefaultDriver(string(c.Args.Path))
if err := verifyOptions(App.Options.Options); err != nil {
log.Fatal(err.Error())
}
dmd, err := InitDriverIfExists(directory)
if err != nil {
return err
}
drv, ok := dmd.(*devicem... | go | func (c *CheckOrphans) Execute(args []string) error {
App.initializeLogging()
directory := GetDefaultDriver(string(c.Args.Path))
if err := verifyOptions(App.Options.Options); err != nil {
log.Fatal(err.Error())
}
dmd, err := InitDriverIfExists(directory)
if err != nil {
return err
}
drv, ok := dmd.(*devicem... | [
"func",
"(",
"c",
"*",
"CheckOrphans",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"App",
".",
"initializeLogging",
"(",
")",
"\n",
"directory",
":=",
"GetDefaultDriver",
"(",
"string",
"(",
"c",
".",
"Args",
".",
"Path",
")",
... | // Execute displays orphaned volumes | [
"Execute",
"displays",
"orphaned",
"volumes"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver_linux.go#L36-L102 |
140,001 | control-center/serviced | rpc/master/volume_server.go | GetVolumeStatus | func (s *Server) GetVolumeStatus(empty struct{}, reply *volume.Statuses) error {
response := volume.GetStatus()
if response == nil {
return errors.New("volume_server.go GetStatus failed")
}
*reply = *response
return nil
} | go | func (s *Server) GetVolumeStatus(empty struct{}, reply *volume.Statuses) error {
response := volume.GetStatus()
if response == nil {
return errors.New("volume_server.go GetStatus failed")
}
*reply = *response
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetVolumeStatus",
"(",
"empty",
"struct",
"{",
"}",
",",
"reply",
"*",
"volume",
".",
"Statuses",
")",
"error",
"{",
"response",
":=",
"volume",
".",
"GetStatus",
"(",
")",
"\n",
"if",
"response",
"==",
"nil",
"... | // GetVolumeStatus gets the volume status | [
"GetVolumeStatus",
"gets",
"the",
"volume",
"status"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/volume_server.go#L23-L30 |
140,002 | control-center/serviced | utils/net.go | Set | func (u *URL) Set(value string) error {
parts := strings.Split(value, ":")
if len(parts) != 2 {
return fmt.Errorf("bad format: %s; must be formatted as HOST:PORT", value)
}
u.Host = parts[0]
if port, err := strconv.Atoi(parts[1]); err != nil {
return fmt.Errorf("port does not parse as an integer")
} else {
... | go | func (u *URL) Set(value string) error {
parts := strings.Split(value, ":")
if len(parts) != 2 {
return fmt.Errorf("bad format: %s; must be formatted as HOST:PORT", value)
}
u.Host = parts[0]
if port, err := strconv.Atoi(parts[1]); err != nil {
return fmt.Errorf("port does not parse as an integer")
} else {
... | [
"func",
"(",
"u",
"*",
"URL",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"value",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf... | // Set converts a URL string to a URL object | [
"Set",
"converts",
"a",
"URL",
"string",
"to",
"a",
"URL",
"object"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/net.go#L19-L32 |
140,003 | control-center/serviced | utils/net.go | GetGateway | func GetGateway(defaultRPCPort int) string {
cmd := exec.Command("ip", "route")
output, err := cmd.Output()
localhost := URL{"127.0.0.1", defaultRPCPort}
if err != nil {
glog.V(2).Info("Error checking gateway: ", err)
glog.V(1).Info("Could not get gateway using ", localhost.Host)
return localhost.String()
}... | go | func GetGateway(defaultRPCPort int) string {
cmd := exec.Command("ip", "route")
output, err := cmd.Output()
localhost := URL{"127.0.0.1", defaultRPCPort}
if err != nil {
glog.V(2).Info("Error checking gateway: ", err)
glog.V(1).Info("Could not get gateway using ", localhost.Host)
return localhost.String()
}... | [
"func",
"GetGateway",
"(",
"defaultRPCPort",
"int",
")",
"string",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"output",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"localhost",
":=",
"URL",
"{... | // GetGateway returns the default gateway | [
"GetGateway",
"returns",
"the",
"default",
"gateway"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/net.go#L39-L59 |
140,004 | control-center/serviced | utils/host_utils.go | GetIPAddress | func GetIPAddress() (ip string, err error) {
ip, err = getIPAddrFromOutGoingConnection()
switch {
case err != nil:
return "", err
case err == nil && strings.HasPrefix(ip, "127"):
return "", fmt.Errorf("unable to identify local ip address")
default:
return ip, err
}
} | go | func GetIPAddress() (ip string, err error) {
ip, err = getIPAddrFromOutGoingConnection()
switch {
case err != nil:
return "", err
case err == nil && strings.HasPrefix(ip, "127"):
return "", fmt.Errorf("unable to identify local ip address")
default:
return ip, err
}
} | [
"func",
"GetIPAddress",
"(",
")",
"(",
"ip",
"string",
",",
"err",
"error",
")",
"{",
"ip",
",",
"err",
"=",
"getIPAddrFromOutGoingConnection",
"(",
")",
"\n",
"switch",
"{",
"case",
"err",
"!=",
"nil",
":",
"return",
"\"",
"\"",
",",
"err",
"\n",
"c... | // GetIPAddress attempts to find the IP address to the default outbound interface. | [
"GetIPAddress",
"attempts",
"to",
"find",
"the",
"IP",
"address",
"to",
"the",
"default",
"outbound",
"interface",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/host_utils.go#L40-L50 |
140,005 | control-center/serviced | utils/host_utils.go | GetIPv4Addresses | func GetIPv4Addresses() (ips []string, err error) {
ips = []string{}
addrs, err := net.InterfaceAddrs()
if err != nil {
return nil, fmt.Errorf("unable to use InterfaceAddrs to find local ipv4 addresses: %v", err)
}
for _, a := range addrs {
if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() && nil ... | go | func GetIPv4Addresses() (ips []string, err error) {
ips = []string{}
addrs, err := net.InterfaceAddrs()
if err != nil {
return nil, fmt.Errorf("unable to use InterfaceAddrs to find local ipv4 addresses: %v", err)
}
for _, a := range addrs {
if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() && nil ... | [
"func",
"GetIPv4Addresses",
"(",
")",
"(",
"ips",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"ips",
"=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"addrs",
",",
"err",
":=",
"net",
".",
"InterfaceAddrs",
"(",
")",
"\n",
"if",
"err",
"!=",
"ni... | // GetIPAddresses returns a list of all IPv4 interface addresses | [
"GetIPAddresses",
"returns",
"a",
"list",
"of",
"all",
"IPv4",
"interface",
"addresses"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/host_utils.go#L53-L72 |
140,006 | control-center/serviced | utils/host_utils.go | getIPAddrFromHostname | func getIPAddrFromHostname() (ip string, err error) {
output, err := exec.Command("hostname", "-i").Output()
if err != nil {
return ip, err
}
return strings.TrimSpace(string(output)), err
} | go | func getIPAddrFromHostname() (ip string, err error) {
output, err := exec.Command("hostname", "-i").Output()
if err != nil {
return ip, err
}
return strings.TrimSpace(string(output)), err
} | [
"func",
"getIPAddrFromHostname",
"(",
")",
"(",
"ip",
"string",
",",
"err",
"error",
")",
"{",
"output",
",",
"err",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
".",
"Output",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // getIPAddrFromHostname returns the ip address associated with hostname -i. | [
"getIPAddrFromHostname",
"returns",
"the",
"ip",
"address",
"associated",
"with",
"hostname",
"-",
"i",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/host_utils.go#L97-L103 |
140,007 | control-center/serviced | utils/host_utils.go | getIPAddrFromOutGoingConnection | func getIPAddrFromOutGoingConnection() (ip string, err error) {
addr, err := net.ResolveUDPAddr("udp4", "8.8.8.8:53")
if err != nil {
return "", err
}
conn, err := net.DialUDP("udp4", nil, addr)
if err != nil {
return "", err
}
localAddr := conn.LocalAddr()
parts := strings.Split(localAddr.String(), ":")
... | go | func getIPAddrFromOutGoingConnection() (ip string, err error) {
addr, err := net.ResolveUDPAddr("udp4", "8.8.8.8:53")
if err != nil {
return "", err
}
conn, err := net.DialUDP("udp4", nil, addr)
if err != nil {
return "", err
}
localAddr := conn.LocalAddr()
parts := strings.Split(localAddr.String(), ":")
... | [
"func",
"getIPAddrFromOutGoingConnection",
"(",
")",
"(",
"ip",
"string",
",",
"err",
"error",
")",
"{",
"addr",
",",
"err",
":=",
"net",
".",
"ResolveUDPAddr",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"... | // getIPAddrFromOutGoingConnection get the IP bound to the interface which
// handles the default route traffic. | [
"getIPAddrFromOutGoingConnection",
"get",
"the",
"IP",
"bound",
"to",
"the",
"interface",
"which",
"handles",
"the",
"default",
"route",
"traffic",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/host_utils.go#L107-L121 |
140,008 | control-center/serviced | coordinator/client/client.go | newOpClientRequest | func newOpClientRequest(reqType opClientRequestType, args interface{}) opClientRequest {
return opClientRequest{
op: reqType,
args: args,
response: make(chan interface{}),
}
} | go | func newOpClientRequest(reqType opClientRequestType, args interface{}) opClientRequest {
return opClientRequest{
op: reqType,
args: args,
response: make(chan interface{}),
}
} | [
"func",
"newOpClientRequest",
"(",
"reqType",
"opClientRequestType",
",",
"args",
"interface",
"{",
"}",
")",
"opClientRequest",
"{",
"return",
"opClientRequest",
"{",
"op",
":",
"reqType",
",",
"args",
":",
"args",
",",
"response",
":",
"make",
"(",
"chan",
... | // newOpClientRequest create a client request object. | [
"newOpClientRequest",
"create",
"a",
"client",
"request",
"object",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/client.go#L129-L135 |
140,009 | control-center/serviced | coordinator/client/client.go | New | func New(driverName, connectionString, basePath string, retryPolicy retry.Policy) (client *Client, err error) {
var driver Driver
var exists bool
if driver, exists = registeredDrivers[driverName]; !exists {
return nil, ErrDriverDoesNotExist
}
if retryPolicy == nil {
retryPolicy = DefaultRetryPolicy()
}
clie... | go | func New(driverName, connectionString, basePath string, retryPolicy retry.Policy) (client *Client, err error) {
var driver Driver
var exists bool
if driver, exists = registeredDrivers[driverName]; !exists {
return nil, ErrDriverDoesNotExist
}
if retryPolicy == nil {
retryPolicy = DefaultRetryPolicy()
}
clie... | [
"func",
"New",
"(",
"driverName",
",",
"connectionString",
",",
"basePath",
"string",
",",
"retryPolicy",
"retry",
".",
"Policy",
")",
"(",
"client",
"*",
"Client",
",",
"err",
"error",
")",
"{",
"var",
"driver",
"Driver",
"\n",
"var",
"exists",
"bool",
... | // New returns a client that will create connections using the given driver and
// connection string. Any retryable operations will use the given retry policy. | [
"New",
"returns",
"a",
"client",
"that",
"will",
"create",
"connections",
"using",
"the",
"given",
"driver",
"and",
"connection",
"string",
".",
"Any",
"retryable",
"operations",
"will",
"use",
"the",
"given",
"retry",
"policy",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/client.go#L164-L184 |
140,010 | control-center/serviced | coordinator/client/client.go | EnsurePath | func EnsurePath(client *Client, path string, makeLastNode bool) error {
pp := strings.Split(path, "/")
last := len(pp)
if last == 0 {
return ErrInvalidPath
}
if makeLastNode {
pp = pp[1:last]
} else {
pp = pp[1 : last-1]
}
return client.NewRetryLoop(
func(cancelChan chan chan error) chan error {
err... | go | func EnsurePath(client *Client, path string, makeLastNode bool) error {
pp := strings.Split(path, "/")
last := len(pp)
if last == 0 {
return ErrInvalidPath
}
if makeLastNode {
pp = pp[1:last]
} else {
pp = pp[1 : last-1]
}
return client.NewRetryLoop(
func(cancelChan chan chan error) chan error {
err... | [
"func",
"EnsurePath",
"(",
"client",
"*",
"Client",
",",
"path",
"string",
",",
"makeLastNode",
"bool",
")",
"error",
"{",
"pp",
":=",
"strings",
".",
"Split",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"last",
":=",
"len",
"(",
"pp",
")",
"\n",
"if"... | // EnsurePath creates the given path with empty nodes if they don't exist; the
// last node in the path is only created if makeLastNode is true. | [
"EnsurePath",
"creates",
"the",
"given",
"path",
"with",
"empty",
"nodes",
"if",
"they",
"don",
"t",
"exist",
";",
"the",
"last",
"node",
"in",
"the",
"path",
"is",
"only",
"created",
"if",
"makeLastNode",
"is",
"true",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/client.go#L188-L222 |
140,011 | control-center/serviced | coordinator/client/client.go | closeConnection | func (client *Client) closeConnection(connectionID int) error {
request := newOpClientRequest(opClientCloseConnection, connectionID)
client.opRequests <- request
response := <-request.response
if val, ok := response.(error); ok {
return val
}
return nil
} | go | func (client *Client) closeConnection(connectionID int) error {
request := newOpClientRequest(opClientCloseConnection, connectionID)
client.opRequests <- request
response := <-request.response
if val, ok := response.(error); ok {
return val
}
return nil
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"closeConnection",
"(",
"connectionID",
"int",
")",
"error",
"{",
"request",
":=",
"newOpClientRequest",
"(",
"opClientCloseConnection",
",",
"connectionID",
")",
"\n",
"client",
".",
"opRequests",
"<-",
"request",
"\n"... | // closeConnection will request that the main loop close the given connection. | [
"closeConnection",
"will",
"request",
"that",
"the",
"main",
"loop",
"close",
"the",
"given",
"connection",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/client.go#L298-L306 |
140,012 | control-center/serviced | coordinator/client/client.go | SetRetryPolicy | func (client *Client) SetRetryPolicy(policy retry.Policy) error {
if policy == nil {
return ErrInvalidRetryPolicy
}
client.retryPolicy = policy
return nil
} | go | func (client *Client) SetRetryPolicy(policy retry.Policy) error {
if policy == nil {
return ErrInvalidRetryPolicy
}
client.retryPolicy = policy
return nil
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"SetRetryPolicy",
"(",
"policy",
"retry",
".",
"Policy",
")",
"error",
"{",
"if",
"policy",
"==",
"nil",
"{",
"return",
"ErrInvalidRetryPolicy",
"\n",
"}",
"\n",
"client",
".",
"retryPolicy",
"=",
"policy",
"\n",
... | // SetRetryPolicy sets the given policy on the client | [
"SetRetryPolicy",
"sets",
"the",
"given",
"policy",
"on",
"the",
"client"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/client.go#L354-L360 |
140,013 | control-center/serviced | dfs/destroy.go | Destroy | func (dfs *DistributedFilesystem) Destroy(tenantID string) error {
vol, err := dfs.disk.Get(tenantID)
if err != nil {
glog.Errorf("Error destroying DFS: Could not get volume for tenant %s: %s", tenantID, err)
} else {
// Remove all the stuff we need a volume object for
snapshots, err := vol.Snapshots()
if e... | go | func (dfs *DistributedFilesystem) Destroy(tenantID string) error {
vol, err := dfs.disk.Get(tenantID)
if err != nil {
glog.Errorf("Error destroying DFS: Could not get volume for tenant %s: %s", tenantID, err)
} else {
// Remove all the stuff we need a volume object for
snapshots, err := vol.Snapshots()
if e... | [
"func",
"(",
"dfs",
"*",
"DistributedFilesystem",
")",
"Destroy",
"(",
"tenantID",
"string",
")",
"error",
"{",
"vol",
",",
"err",
":=",
"dfs",
".",
"disk",
".",
"Get",
"(",
"tenantID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Errorf",... | // Destroy destroys all application data from the dfs and docker registry | [
"Destroy",
"destroys",
"all",
"application",
"data",
"from",
"the",
"dfs",
"and",
"docker",
"registry"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/destroy.go#L22-L54 |
140,014 | control-center/serviced | dfs/destroy.go | unexport | func (dfs *DistributedFilesystem) unexport(path string) error {
if err := dfs.net.RemoveVolume(path); err != nil {
glog.Errorf("Could not unexport volume %s: %s", path, err)
return err
} else if err := dfs.net.Stop(); err != nil {
glog.Errorf("Could not stop nfs server: %s", err)
return err
} else if err := ... | go | func (dfs *DistributedFilesystem) unexport(path string) error {
if err := dfs.net.RemoveVolume(path); err != nil {
glog.Errorf("Could not unexport volume %s: %s", path, err)
return err
} else if err := dfs.net.Stop(); err != nil {
glog.Errorf("Could not stop nfs server: %s", err)
return err
} else if err := ... | [
"func",
"(",
"dfs",
"*",
"DistributedFilesystem",
")",
"unexport",
"(",
"path",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"dfs",
".",
"net",
".",
"RemoveVolume",
"(",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
... | // unexport removes an exported path from the network file share | [
"unexport",
"removes",
"an",
"exported",
"path",
"from",
"the",
"network",
"file",
"share"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/destroy.go#L57-L69 |
140,015 | control-center/serviced | dfs/registry/listener.go | NewRegistryListener | func NewRegistryListener(docker docker.Docker, address, hostid string) *RegistryListener {
return &RegistryListener{docker: docker, address: address, hostid: hostid}
} | go | func NewRegistryListener(docker docker.Docker, address, hostid string) *RegistryListener {
return &RegistryListener{docker: docker, address: address, hostid: hostid}
} | [
"func",
"NewRegistryListener",
"(",
"docker",
"docker",
".",
"Docker",
",",
"address",
",",
"hostid",
"string",
")",
"*",
"RegistryListener",
"{",
"return",
"&",
"RegistryListener",
"{",
"docker",
":",
"docker",
",",
"address",
":",
"address",
",",
"hostid",
... | // NewRegistryListener instantiates a new registry listener | [
"NewRegistryListener",
"instantiates",
"a",
"new",
"registry",
"listener"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/listener.go#L80-L82 |
140,016 | control-center/serviced | dfs/registry/listener.go | FindImage | func (l *RegistryListener) FindImage(rImg *registry.Image) (*dockerclient.Image, error) {
regaddr := path.Join(l.address, rImg.String())
glog.V(1).Infof("Searching for image %s", regaddr)
// check for UUID
if img, err := l.docker.FindImage(rImg.UUID); err == nil {
return img, nil
}
// check by repo and tag, a... | go | func (l *RegistryListener) FindImage(rImg *registry.Image) (*dockerclient.Image, error) {
regaddr := path.Join(l.address, rImg.String())
glog.V(1).Infof("Searching for image %s", regaddr)
// check for UUID
if img, err := l.docker.FindImage(rImg.UUID); err == nil {
return img, nil
}
// check by repo and tag, a... | [
"func",
"(",
"l",
"*",
"RegistryListener",
")",
"FindImage",
"(",
"rImg",
"*",
"registry",
".",
"Image",
")",
"(",
"*",
"dockerclient",
".",
"Image",
",",
"error",
")",
"{",
"regaddr",
":=",
"path",
".",
"Join",
"(",
"l",
".",
"address",
",",
"rImg",... | // findImage looks for the registry image locally and in the local registry. It firsts checks locally by UUID,
// then by repo, tag, and hash, then it checks if the image is already in the registry, and finally it searches by hash | [
"findImage",
"looks",
"for",
"the",
"registry",
"image",
"locally",
"and",
"in",
"the",
"local",
"registry",
".",
"It",
"firsts",
"checks",
"locally",
"by",
"UUID",
"then",
"by",
"repo",
"tag",
"and",
"hash",
"then",
"it",
"checks",
"if",
"the",
"image",
... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/listener.go#L203-L255 |
140,017 | control-center/serviced | zzk/registry/import.go | NewImportListener | func NewImportListener(tenantID string) *ImportListener {
return &ImportListener{
tenantID: tenantID,
apps: make(map[string]struct{}),
}
} | go | func NewImportListener(tenantID string) *ImportListener {
return &ImportListener{
tenantID: tenantID,
apps: make(map[string]struct{}),
}
} | [
"func",
"NewImportListener",
"(",
"tenantID",
"string",
")",
"*",
"ImportListener",
"{",
"return",
"&",
"ImportListener",
"{",
"tenantID",
":",
"tenantID",
",",
"apps",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
",",
"}",
"\n",... | // NewImportListener instantiates a new listener for a given tenant id. | [
"NewImportListener",
"instantiates",
"a",
"new",
"listener",
"for",
"a",
"given",
"tenant",
"id",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/import.go#L44-L49 |
140,018 | control-center/serviced | zzk/registry/import.go | AddTerm | func (l *ImportListener) AddTerm(matcher StringMatcher) <-chan string {
send := make(chan string)
t := Term{
matcher: matcher,
send: send,
}
l.terms = append(l.terms, t)
return send
} | go | func (l *ImportListener) AddTerm(matcher StringMatcher) <-chan string {
send := make(chan string)
t := Term{
matcher: matcher,
send: send,
}
l.terms = append(l.terms, t)
return send
} | [
"func",
"(",
"l",
"*",
"ImportListener",
")",
"AddTerm",
"(",
"matcher",
"StringMatcher",
")",
"<-",
"chan",
"string",
"{",
"send",
":=",
"make",
"(",
"chan",
"string",
")",
"\n",
"t",
":=",
"Term",
"{",
"matcher",
":",
"matcher",
",",
"send",
":",
"... | // AddTerm adds a search term to the listener and returns a channel receiever
// with the applicable matches. | [
"AddTerm",
"adds",
"a",
"search",
"term",
"to",
"the",
"listener",
"and",
"returns",
"a",
"channel",
"receiever",
"with",
"the",
"applicable",
"matches",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/import.go#L53-L62 |
140,019 | control-center/serviced | zzk/registry/import.go | Run | func (l *ImportListener) Run(cancel <-chan struct{}, conn client.Connection) {
logger := plog.WithField("tenantid", l.tenantID)
pth := path.Join("/net/export", l.tenantID)
done := make(chan struct{})
defer func() { close(done) }()
for {
// set a watcher to alert when the path is available
ok, ev, err := con... | go | func (l *ImportListener) Run(cancel <-chan struct{}, conn client.Connection) {
logger := plog.WithField("tenantid", l.tenantID)
pth := path.Join("/net/export", l.tenantID)
done := make(chan struct{})
defer func() { close(done) }()
for {
// set a watcher to alert when the path is available
ok, ev, err := con... | [
"func",
"(",
"l",
"*",
"ImportListener",
")",
"Run",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
",",
"conn",
"client",
".",
"Connection",
")",
"{",
"logger",
":=",
"plog",
".",
"WithField",
"(",
"\"",
"\"",
",",
"l",
".",
"tenantID",
")",
"\n... | // Run starts the export listener for the given tenant | [
"Run",
"starts",
"the",
"export",
"listener",
"for",
"the",
"given",
"tenant"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/import.go#L65-L125 |
140,020 | control-center/serviced | cli/cmd/host.go | initHost | func (c *ServicedCli) initHost() {
c.app.Commands = append(c.app.Commands, cli.Command{
Name: "host",
Usage: "Administers host data",
Description: "",
Subcommands: []cli.Command{
{
Name: "list",
Usage: "Lists all hosts",
Description: "serviced host list [SERVICEID]",... | go | func (c *ServicedCli) initHost() {
c.app.Commands = append(c.app.Commands, cli.Command{
Name: "host",
Usage: "Administers host data",
Description: "",
Subcommands: []cli.Command{
{
Name: "list",
Usage: "Lists all hosts",
Description: "serviced host list [SERVICEID]",... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"initHost",
"(",
")",
"{",
"c",
".",
"app",
".",
"Commands",
"=",
"append",
"(",
"c",
".",
"app",
".",
"Commands",
",",
"cli",
".",
"Command",
"{",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"... | // Initializer for serviced host subcommands | [
"Initializer",
"for",
"serviced",
"host",
"subcommands"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/host.go#L31-L121 |
140,021 | control-center/serviced | cli/cmd/host.go | hosts | func (c *ServicedCli) hosts() (data []string) {
hosts, err := c.driver.GetHosts()
if err != nil || hosts == nil || len(hosts) == 0 {
return
}
data = make([]string, len(hosts))
for i, h := range hosts {
data[i] = h.ID
}
return
} | go | func (c *ServicedCli) hosts() (data []string) {
hosts, err := c.driver.GetHosts()
if err != nil || hosts == nil || len(hosts) == 0 {
return
}
data = make([]string, len(hosts))
for i, h := range hosts {
data[i] = h.ID
}
return
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"hosts",
"(",
")",
"(",
"data",
"[",
"]",
"string",
")",
"{",
"hosts",
",",
"err",
":=",
"c",
".",
"driver",
".",
"GetHosts",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"hosts",
"==",
"nil",
"||",... | // Returns a list of all available host IDs | [
"Returns",
"a",
"list",
"of",
"all",
"available",
"host",
"IDs"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/host.go#L124-L136 |
140,022 | control-center/serviced | cli/cmd/host.go | printHostsFirst | func (c *ServicedCli) printHostsFirst(ctx *cli.Context) {
if len(ctx.Args()) > 0 {
return
}
fmt.Println(strings.Join(c.hosts(), "\n"))
} | go | func (c *ServicedCli) printHostsFirst(ctx *cli.Context) {
if len(ctx.Args()) > 0 {
return
}
fmt.Println(strings.Join(c.hosts(), "\n"))
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"printHostsFirst",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"if",
"len",
"(",
"ctx",
".",
"Args",
"(",
")",
")",
">",
"0",
"{",
"return",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"strings",
... | // Bash-completion command that prints a list of available hosts as the first
// argument | [
"Bash",
"-",
"completion",
"command",
"that",
"prints",
"a",
"list",
"of",
"available",
"hosts",
"as",
"the",
"first",
"argument"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/host.go#L140-L145 |
140,023 | control-center/serviced | cli/cmd/host.go | printHostsAll | func (c *ServicedCli) printHostsAll(ctx *cli.Context) {
args := ctx.Args()
hosts := c.hosts()
// If arg is a host, don't add to the list
for _, h := range hosts {
for _, a := range args {
if h == a {
goto next
}
}
fmt.Println(h)
next:
}
} | go | func (c *ServicedCli) printHostsAll(ctx *cli.Context) {
args := ctx.Args()
hosts := c.hosts()
// If arg is a host, don't add to the list
for _, h := range hosts {
for _, a := range args {
if h == a {
goto next
}
}
fmt.Println(h)
next:
}
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"printHostsAll",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"hosts",
":=",
"c",
".",
"hosts",
"(",
")",
"\n\n",
"// If arg is a host, don't add to the lis... | // Bash-completion command that prints a list of available hosts as all
// arguments | [
"Bash",
"-",
"completion",
"command",
"that",
"prints",
"a",
"list",
"of",
"available",
"hosts",
"as",
"all",
"arguments"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/host.go#L149-L163 |
140,024 | control-center/serviced | cli/cmd/host.go | printHostAddPrivate | func (c *ServicedCli) printHostAddPrivate(ctx *cli.Context) {
var output []string
args := ctx.Args()
switch len(args) {
case 1:
output = c.pools()
}
fmt.Println(strings.Join(output, "\n"))
} | go | func (c *ServicedCli) printHostAddPrivate(ctx *cli.Context) {
var output []string
args := ctx.Args()
switch len(args) {
case 1:
output = c.pools()
}
fmt.Println(strings.Join(output, "\n"))
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"printHostAddPrivate",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"var",
"output",
"[",
"]",
"string",
"\n\n",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"switch",
"len",
"(",
"args",
")",
"{... | // Bash-completion command that completes the POOLID as the first argument | [
"Bash",
"-",
"completion",
"command",
"that",
"completes",
"the",
"POOLID",
"as",
"the",
"first",
"argument"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/host.go#L178-L187 |
140,025 | control-center/serviced | cli/cmd/host.go | cmdHostSetMemory | func (c *ServicedCli) cmdHostSetMemory(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 2 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "set-memory")
return
}
if err := c.driver.SetHostMemory(api.HostUpdateConfig{args[0], args[1]}); err != nil {
fmt.Fprintln(os.Stderr, err)
}
} | go | func (c *ServicedCli) cmdHostSetMemory(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 2 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "set-memory")
return
}
if err := c.driver.SetHostMemory(api.HostUpdateConfig{args[0], args[1]}); err != nil {
fmt.Fprintln(os.Stderr, err)
}
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdHostSetMemory",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"2",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\... | // serviced host set-memory HOSTID MEMALLOC | [
"serviced",
"host",
"set",
"-",
"memory",
"HOSTID",
"MEMALLOC"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/host.go#L409-L420 |
140,026 | control-center/serviced | zzk/service/service.go | RemoveService | func RemoveService(conn client.Connection, poolID, serviceID string) error {
basepth := ""
if poolID != "" {
basepth = path.Join("/pools", poolID)
}
pth := path.Join(basepth, "/services", serviceID)
logger := plog.WithFields(log.Fields{
"serviceid": serviceID,
"zkpath": pth,
})
// clean any bad servic... | go | func RemoveService(conn client.Connection, poolID, serviceID string) error {
basepth := ""
if poolID != "" {
basepth = path.Join("/pools", poolID)
}
pth := path.Join(basepth, "/services", serviceID)
logger := plog.WithFields(log.Fields{
"serviceid": serviceID,
"zkpath": pth,
})
// clean any bad servic... | [
"func",
"RemoveService",
"(",
"conn",
"client",
".",
"Connection",
",",
"poolID",
",",
"serviceID",
"string",
")",
"error",
"{",
"basepth",
":=",
"\"",
"\"",
"\n",
"if",
"poolID",
"!=",
"\"",
"\"",
"{",
"basepth",
"=",
"path",
".",
"Join",
"(",
"\"",
... | // RemoveService deletes a service if the service has no running states | [
"RemoveService",
"deletes",
"a",
"service",
"if",
"the",
"service",
"has",
"no",
"running",
"states"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/service.go#L219-L267 |
140,027 | control-center/serviced | zzk/service/service.go | WaitService | func WaitService(cancel <-chan struct{}, conn client.Connection, poolID, serviceID string, checkCount func(count int) bool, checkState func(s *State, exists bool) bool) error {
basepth := ""
if poolID != "" {
basepth = path.Join("/pools", poolID)
}
pth := path.Join(basepth, "/services", serviceID)
logger := plo... | go | func WaitService(cancel <-chan struct{}, conn client.Connection, poolID, serviceID string, checkCount func(count int) bool, checkState func(s *State, exists bool) bool) error {
basepth := ""
if poolID != "" {
basepth = path.Join("/pools", poolID)
}
pth := path.Join(basepth, "/services", serviceID)
logger := plo... | [
"func",
"WaitService",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
",",
"conn",
"client",
".",
"Connection",
",",
"poolID",
",",
"serviceID",
"string",
",",
"checkCount",
"func",
"(",
"count",
"int",
")",
"bool",
",",
"checkState",
"func",
"(",
"s",... | // WaitService waits for all of a service's instances to satisfy a particular
// state. | [
"WaitService",
"waits",
"for",
"all",
"of",
"a",
"service",
"s",
"instances",
"to",
"satisfy",
"a",
"particular",
"state",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/service.go#L321-L406 |
140,028 | control-center/serviced | zzk/service/service.go | WaitInstance | func WaitInstance(cancel <-chan struct{}, conn client.Connection, poolID, serviceID string, instanceID int, checkState func(s *State, exists bool) bool) error {
hostID, err := GetServiceStateHostID(conn, poolID, serviceID, instanceID)
if err != nil {
return err
}
logger := plog.WithFields(log.Fields{
"servicei... | go | func WaitInstance(cancel <-chan struct{}, conn client.Connection, poolID, serviceID string, instanceID int, checkState func(s *State, exists bool) bool) error {
hostID, err := GetServiceStateHostID(conn, poolID, serviceID, instanceID)
if err != nil {
return err
}
logger := plog.WithFields(log.Fields{
"servicei... | [
"func",
"WaitInstance",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
",",
"conn",
"client",
".",
"Connection",
",",
"poolID",
",",
"serviceID",
"string",
",",
"instanceID",
"int",
",",
"checkState",
"func",
"(",
"s",
"*",
"State",
",",
"exists",
"boo... | // WaitInstance waits for an instance of a service to satisfy a particular state | [
"WaitInstance",
"waits",
"for",
"an",
"instance",
"of",
"a",
"service",
"to",
"satisfy",
"a",
"particular",
"state"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/service.go#L409-L433 |
140,029 | control-center/serviced | rpc/master/servicetemplate_master.go | RemoveServiceTemplate | func (s *Server) RemoveServiceTemplate(templateID string, _ *struct{}) error {
return s.f.RemoveServiceTemplate(s.context(), templateID)
} | go | func (s *Server) RemoveServiceTemplate(templateID string, _ *struct{}) error {
return s.f.RemoveServiceTemplate(s.context(), templateID)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"RemoveServiceTemplate",
"(",
"templateID",
"string",
",",
"_",
"*",
"struct",
"{",
"}",
")",
"error",
"{",
"return",
"s",
".",
"f",
".",
"RemoveServiceTemplate",
"(",
"s",
".",
"context",
"(",
")",
",",
"templateI... | // Remove a service template | [
"Remove",
"a",
"service",
"template"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/servicetemplate_master.go#L42-L44 |
140,030 | control-center/serviced | rpc/master/servicetemplate_master.go | DeployTemplate | func (s *Server) DeployTemplate(request servicetemplate.ServiceTemplateDeploymentRequest, response *[]string) error {
tenantIDs, err := s.f.DeployTemplate(s.context(), request.PoolID, request.TemplateID, request.DeploymentID)
if err != nil {
return err
}
*response = tenantIDs
return nil
} | go | func (s *Server) DeployTemplate(request servicetemplate.ServiceTemplateDeploymentRequest, response *[]string) error {
tenantIDs, err := s.f.DeployTemplate(s.context(), request.PoolID, request.TemplateID, request.DeploymentID)
if err != nil {
return err
}
*response = tenantIDs
return nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"DeployTemplate",
"(",
"request",
"servicetemplate",
".",
"ServiceTemplateDeploymentRequest",
",",
"response",
"*",
"[",
"]",
"string",
")",
"error",
"{",
"tenantIDs",
",",
"err",
":=",
"s",
".",
"f",
".",
"DeployTemplat... | // Deploy a service template | [
"Deploy",
"a",
"service",
"template"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/servicetemplate_master.go#L47-L54 |
140,031 | control-center/serviced | utils/cond.go | Broadcast | func (c *ChannelCond) Broadcast() {
var old chan struct{}
c.Lock()
defer c.Unlock()
c.c, old = make(chan struct{}), c.c
close(old)
} | go | func (c *ChannelCond) Broadcast() {
var old chan struct{}
c.Lock()
defer c.Unlock()
c.c, old = make(chan struct{}), c.c
close(old)
} | [
"func",
"(",
"c",
"*",
"ChannelCond",
")",
"Broadcast",
"(",
")",
"{",
"var",
"old",
"chan",
"struct",
"{",
"}",
"\n",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"c",
",",
"old",
"=",
"make",
"(",... | // Broadcast notifies all waiting goroutines that this condition has been
// satisfied | [
"Broadcast",
"notifies",
"all",
"waiting",
"goroutines",
"that",
"this",
"condition",
"has",
"been",
"satisfied"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/cond.go#L28-L34 |
140,032 | control-center/serviced | volume/nfs/nfs.go | WriteMetadata | func (v *NFSVolume) WriteMetadata(label, name string) (io.WriteCloser, error) {
return nil, ErrNotSupported
} | go | func (v *NFSVolume) WriteMetadata(label, name string) (io.WriteCloser, error) {
return nil, ErrNotSupported
} | [
"func",
"(",
"v",
"*",
"NFSVolume",
")",
"WriteMetadata",
"(",
"label",
",",
"name",
"string",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotSupported",
"\n",
"}"
] | // WriteMetadata implements volume.Volume.WriteMetadata | [
"WriteMetadata",
"implements",
"volume",
".",
"Volume",
".",
"WriteMetadata"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/nfs/nfs.go#L197-L199 |
140,033 | control-center/serviced | volume/nfs/nfs.go | ReadMetadata | func (v *NFSVolume) ReadMetadata(label, name string) (io.ReadCloser, error) {
return nil, ErrNotSupported
} | go | func (v *NFSVolume) ReadMetadata(label, name string) (io.ReadCloser, error) {
return nil, ErrNotSupported
} | [
"func",
"(",
"v",
"*",
"NFSVolume",
")",
"ReadMetadata",
"(",
"label",
",",
"name",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotSupported",
"\n",
"}"
] | // ReadMetadata implements volume.Volume.ReadMetadata | [
"ReadMetadata",
"implements",
"volume",
".",
"Volume",
".",
"ReadMetadata"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/nfs/nfs.go#L202-L204 |
140,034 | control-center/serviced | volume/nfs/nfs.go | SnapshotInfo | func (v *NFSVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) {
return nil, ErrNotSupported
} | go | func (v *NFSVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) {
return nil, ErrNotSupported
} | [
"func",
"(",
"v",
"*",
"NFSVolume",
")",
"SnapshotInfo",
"(",
"label",
"string",
")",
"(",
"*",
"volume",
".",
"SnapshotInfo",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotSupported",
"\n",
"}"
] | // SnapshotInfo implements volume.Volume.SnapshotInfo | [
"SnapshotInfo",
"implements",
"volume",
".",
"Volume",
".",
"SnapshotInfo"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/nfs/nfs.go#L227-L229 |
140,035 | control-center/serviced | container/logstash.go | createFields | func createFields(hostID string, hostIPs string, svcPath string, service *service.Service, instanceID string, logConfig *servicedefinition.LogConfig) map[string]string {
fields := make(map[string]string)
fields["type"] = logConfig.Type
fields["service"] = service.ID
fields["instance"] = instanceID
fields["hostips"... | go | func createFields(hostID string, hostIPs string, svcPath string, service *service.Service, instanceID string, logConfig *servicedefinition.LogConfig) map[string]string {
fields := make(map[string]string)
fields["type"] = logConfig.Type
fields["service"] = service.ID
fields["instance"] = instanceID
fields["hostips"... | [
"func",
"createFields",
"(",
"hostID",
"string",
",",
"hostIPs",
"string",
",",
"svcPath",
"string",
",",
"service",
"*",
"service",
".",
"Service",
",",
"instanceID",
"string",
",",
"logConfig",
"*",
"servicedefinition",
".",
"LogConfig",
")",
"map",
"[",
"... | //createFields makes the map of tags for the logstash config including the type | [
"createFields",
"makes",
"the",
"map",
"of",
"tags",
"for",
"the",
"logstash",
"config",
"including",
"the",
"type"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/logstash.go#L29-L47 |
140,036 | control-center/serviced | container/logstash.go | formatTagsForConfFile | func formatTagsForConfFile(tags map[string]string) string {
if len(tags) == 0 {
return ""
}
var buffer bytes.Buffer
buffer.WriteString("{")
for k, v := range tags {
buffer.WriteString(k + ": " + v + ", ")
}
buffer.WriteString("}")
return buffer.String()
} | go | func formatTagsForConfFile(tags map[string]string) string {
if len(tags) == 0 {
return ""
}
var buffer bytes.Buffer
buffer.WriteString("{")
for k, v := range tags {
buffer.WriteString(k + ": " + v + ", ")
}
buffer.WriteString("}")
return buffer.String()
} | [
"func",
"formatTagsForConfFile",
"(",
"tags",
"map",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"tags",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"buffer",
".",... | //formatTagsForConfFile takes the set of tags for a LogConfig and return json representing the tags | [
"formatTagsForConfFile",
"takes",
"the",
"set",
"of",
"tags",
"for",
"a",
"LogConfig",
"and",
"return",
"json",
"representing",
"the",
"tags"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/logstash.go#L50-L61 |
140,037 | control-center/serviced | container/logstash.go | writeLogstashAgentConfig | func writeLogstashAgentConfig(hostID string, hostIPs string, svcPath string, service *service.Service,
instanceID string, logforwarderOptions LogforwarderOptions) error {
// generate a prospector configuration for each service log file
prospectorsConf := ``
for _, logConfig := range service.LogConfigs {
prospect... | go | func writeLogstashAgentConfig(hostID string, hostIPs string, svcPath string, service *service.Service,
instanceID string, logforwarderOptions LogforwarderOptions) error {
// generate a prospector configuration for each service log file
prospectorsConf := ``
for _, logConfig := range service.LogConfigs {
prospect... | [
"func",
"writeLogstashAgentConfig",
"(",
"hostID",
"string",
",",
"hostIPs",
"string",
",",
"svcPath",
"string",
",",
"service",
"*",
"service",
".",
"Service",
",",
"instanceID",
"string",
",",
"logforwarderOptions",
"LogforwarderOptions",
")",
"error",
"{",
"// ... | // writeLogstashAgentConfig creates the logstash forwarder config file | [
"writeLogstashAgentConfig",
"creates",
"the",
"logstash",
"forwarder",
"config",
"file"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/logstash.go#L64-L109 |
140,038 | control-center/serviced | stats/statsreporter.go | report | func (sr *statsReporter) report(d time.Duration) {
tc := time.Tick(d)
for {
select {
case _ = <-sr.closeChannel:
plog.WithField("destination", sr.destination).
Info("Stopped collection of internal metrics")
return
case t := <-tc:
sr.updateStatsFunc()
stats := sr.gatherStatsFunc(t)
err := Post... | go | func (sr *statsReporter) report(d time.Duration) {
tc := time.Tick(d)
for {
select {
case _ = <-sr.closeChannel:
plog.WithField("destination", sr.destination).
Info("Stopped collection of internal metrics")
return
case t := <-tc:
sr.updateStatsFunc()
stats := sr.gatherStatsFunc(t)
err := Post... | [
"func",
"(",
"sr",
"*",
"statsReporter",
")",
"report",
"(",
"d",
"time",
".",
"Duration",
")",
"{",
"tc",
":=",
"time",
".",
"Tick",
"(",
"d",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"_",
"=",
"<-",
"sr",
".",
"closeChannel",
":",
"plog",
... | // Updates the default registry, fills out the metric consumer format, and posts
// the data to the TSDB. Stops when close signal is received on closeChannel. | [
"Updates",
"the",
"default",
"registry",
"fills",
"out",
"the",
"metric",
"consumer",
"format",
"and",
"posts",
"the",
"data",
"to",
"the",
"TSDB",
".",
"Stops",
"when",
"close",
"signal",
"is",
"received",
"on",
"closeChannel",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/stats/statsreporter.go#L64-L82 |
140,039 | control-center/serviced | stats/statsreporter.go | Post | func Post(destination string, stats []Sample) error {
payload := map[string][]Sample{"metrics": stats}
data, err := json.Marshal(payload)
if err != nil {
plog.WithField("numstats", len(stats)).WithError(err).
Warn("Unable to convert internal metrics to JSON for posting to OpenTSDB")
return nil
}
statsReq, e... | go | func Post(destination string, stats []Sample) error {
payload := map[string][]Sample{"metrics": stats}
data, err := json.Marshal(payload)
if err != nil {
plog.WithField("numstats", len(stats)).WithError(err).
Warn("Unable to convert internal metrics to JSON for posting to OpenTSDB")
return nil
}
statsReq, e... | [
"func",
"Post",
"(",
"destination",
"string",
",",
"stats",
"[",
"]",
"Sample",
")",
"error",
"{",
"payload",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"Sample",
"{",
"\"",
"\"",
":",
"stats",
"}",
"\n",
"data",
",",
"err",
":=",
"json",
".",
"M... | // Post sends the list of stats to the TSDB. | [
"Post",
"sends",
"the",
"list",
"of",
"stats",
"to",
"the",
"TSDB",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/stats/statsreporter.go#L91-L124 |
140,040 | control-center/serviced | cli/cmd/service.go | services | func (c *ServicedCli) services() (data []string) {
svcs, err := c.driver.GetAllServiceDetails()
if err != nil || svcs == nil || len(svcs) == 0 {
c.exit(1)
return
}
data = make([]string, len(svcs))
for i, s := range svcs {
data[i] = s.ID
}
return
} | go | func (c *ServicedCli) services() (data []string) {
svcs, err := c.driver.GetAllServiceDetails()
if err != nil || svcs == nil || len(svcs) == 0 {
c.exit(1)
return
}
data = make([]string, len(svcs))
for i, s := range svcs {
data[i] = s.ID
}
return
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"services",
"(",
")",
"(",
"data",
"[",
"]",
"string",
")",
"{",
"svcs",
",",
"err",
":=",
"c",
".",
"driver",
".",
"GetAllServiceDetails",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"svcs",
"==",
"... | // Returns a list of all the available service IDs | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"available",
"service",
"IDs"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L776-L789 |
140,041 | control-center/serviced | cli/cmd/service.go | serviceCommands | func (c *ServicedCli) serviceCommands(id string) (data []string) {
svc, err := c.driver.GetService(id)
if err != nil || svc == nil {
c.exit(1)
return
}
data = make([]string, len(svc.Commands))
i := 0
for r := range svc.Commands {
data[i] = r
i++
}
return
} | go | func (c *ServicedCli) serviceCommands(id string) (data []string) {
svc, err := c.driver.GetService(id)
if err != nil || svc == nil {
c.exit(1)
return
}
data = make([]string, len(svc.Commands))
i := 0
for r := range svc.Commands {
data[i] = r
i++
}
return
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"serviceCommands",
"(",
"id",
"string",
")",
"(",
"data",
"[",
"]",
"string",
")",
"{",
"svc",
",",
"err",
":=",
"c",
".",
"driver",
".",
"GetService",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||... | // Returns a list of runnable commands for a particular service | [
"Returns",
"a",
"list",
"of",
"runnable",
"commands",
"for",
"a",
"particular",
"service"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L792-L807 |
140,042 | control-center/serviced | cli/cmd/service.go | serviceActions | func (c *ServicedCli) serviceActions(id string) (data []string) {
svc, err := c.driver.GetService(id)
if err != nil || svc == nil {
c.exit(1)
return
}
data = make([]string, len(svc.Actions))
i := 0
for a := range svc.Actions {
data[i] = a
i++
}
return
} | go | func (c *ServicedCli) serviceActions(id string) (data []string) {
svc, err := c.driver.GetService(id)
if err != nil || svc == nil {
c.exit(1)
return
}
data = make([]string, len(svc.Actions))
i := 0
for a := range svc.Actions {
data[i] = a
i++
}
return
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"serviceActions",
"(",
"id",
"string",
")",
"(",
"data",
"[",
"]",
"string",
")",
"{",
"svc",
",",
"err",
":=",
"c",
".",
"driver",
".",
"GetService",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||"... | // Returns a list of actionable commands for a particular service | [
"Returns",
"a",
"list",
"of",
"actionable",
"commands",
"for",
"a",
"particular",
"service"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L810-L825 |
140,043 | control-center/serviced | cli/cmd/service.go | printServicesFirst | func (c *ServicedCli) printServicesFirst(ctx *cli.Context) {
if len(ctx.Args()) > 0 {
return
}
fmt.Println(strings.Join(c.services(), "\n"))
} | go | func (c *ServicedCli) printServicesFirst(ctx *cli.Context) {
if len(ctx.Args()) > 0 {
return
}
fmt.Println(strings.Join(c.services(), "\n"))
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"printServicesFirst",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"if",
"len",
"(",
"ctx",
".",
"Args",
"(",
")",
")",
">",
"0",
"{",
"return",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"strings... | // Bash-completion command that prints a list of available services as the
// first argument | [
"Bash",
"-",
"completion",
"command",
"that",
"prints",
"a",
"list",
"of",
"available",
"services",
"as",
"the",
"first",
"argument"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L829-L834 |
140,044 | control-center/serviced | cli/cmd/service.go | printServicesAll | func (c *ServicedCli) printServicesAll(ctx *cli.Context) {
args := ctx.Args()
svcs := c.services()
// If arg is a service don't add to the list
for _, s := range svcs {
for _, a := range args {
if s == a {
goto next
}
}
fmt.Println(s)
next:
}
return
} | go | func (c *ServicedCli) printServicesAll(ctx *cli.Context) {
args := ctx.Args()
svcs := c.services()
// If arg is a service don't add to the list
for _, s := range svcs {
for _, a := range args {
if s == a {
goto next
}
}
fmt.Println(s)
next:
}
return
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"printServicesAll",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"svcs",
":=",
"c",
".",
"services",
"(",
")",
"\n\n",
"// If arg is a service don't add to ... | // Bash-completion command that prints a list of available services as all
// arguments | [
"Bash",
"-",
"completion",
"command",
"that",
"prints",
"a",
"list",
"of",
"available",
"services",
"as",
"all",
"arguments"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L838-L853 |
140,045 | control-center/serviced | cli/cmd/service.go | printServiceRun | func (c *ServicedCli) printServiceRun(ctx *cli.Context) {
var output []string
args := ctx.Args()
switch len(args) {
case 0:
output = c.services()
case 1:
output = c.serviceCommands(args[0])
}
fmt.Println(strings.Join(output, "\n"))
} | go | func (c *ServicedCli) printServiceRun(ctx *cli.Context) {
var output []string
args := ctx.Args()
switch len(args) {
case 0:
output = c.services()
case 1:
output = c.serviceCommands(args[0])
}
fmt.Println(strings.Join(output, "\n"))
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"printServiceRun",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"var",
"output",
"[",
"]",
"string",
"\n\n",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"switch",
"len",
"(",
"args",
")",
"{",
... | // Bash-completion command that completes the service ID as the first argument
// and runnable commands as the second argument | [
"Bash",
"-",
"completion",
"command",
"that",
"completes",
"the",
"service",
"ID",
"as",
"the",
"first",
"argument",
"and",
"runnable",
"commands",
"as",
"the",
"second",
"argument"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L896-L907 |
140,046 | control-center/serviced | cli/cmd/service.go | cmdServiceEdit | func (c *ServicedCli) cmdServiceEdit(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "edit")
c.exit(1)
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err... | go | func (c *ServicedCli) cmdServiceEdit(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "edit")
c.exit(1)
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceEdit",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"1",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n... | // serviced service edit SERVICEID | [
"serviced",
"service",
"edit",
"SERVICEID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1320-L1368 |
140,047 | control-center/serviced | cli/cmd/service.go | cmdServiceVariableList | func (c *ServicedCli) cmdServiceVariableList(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "list")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
... | go | func (c *ServicedCli) cmdServiceVariableList(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "list")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceVariableList",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"1",
"{",
"fmt",
".",
"Printf",
"(",
"\""... | // serviced service variables list SERVICEID | [
"serviced",
"service",
"variables",
"list",
"SERVICEID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1491-L1521 |
140,048 | control-center/serviced | cli/cmd/service.go | cmdServiceVariableGet | func (c *ServicedCli) cmdServiceVariableGet(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 2 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "get")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
re... | go | func (c *ServicedCli) cmdServiceVariableGet(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 2 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "get")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
re... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceVariableGet",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"2",
"{",
"fmt",
".",
"Printf",
"(",
"\"",... | // serviced service variables get SERVICEID VARIABLE | [
"serviced",
"service",
"variables",
"get",
"SERVICEID",
"VARIABLE"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1524-L1571 |
140,049 | control-center/serviced | cli/cmd/service.go | cmdServiceVariableSet | func (c *ServicedCli) cmdServiceVariableSet(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 3 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "set")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
re... | go | func (c *ServicedCli) cmdServiceVariableSet(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 3 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "set")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
re... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceVariableSet",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"3",
"{",
"fmt",
".",
"Printf",
"(",
"\"",... | // serviced service variables set SERVICEID VARIABLE VALUE | [
"serviced",
"service",
"variables",
"set",
"SERVICEID",
"VARIABLE",
"VALUE"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1574-L1607 |
140,050 | control-center/serviced | cli/cmd/service.go | cmdServiceVariableUnset | func (c *ServicedCli) cmdServiceVariableUnset(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 2 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "unset")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
... | go | func (c *ServicedCli) cmdServiceVariableUnset(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 2 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "unset")
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceVariableUnset",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"2",
"{",
"fmt",
".",
"Printf",
"(",
"\"... | // serviced service variables unset SERVICEID VARIABLE | [
"serviced",
"service",
"variables",
"unset",
"SERVICEID",
"VARIABLE"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1610-L1652 |
140,051 | control-center/serviced | cli/cmd/service.go | cmdServiceRestart | func (c *ServicedCli) cmdServiceRestart(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "restart")
c.exit(1)
return
}
var sIds []string
var instances []struct {
Service string
Instance int
}
for _, arg := range args {
svc, ins... | go | func (c *ServicedCli) cmdServiceRestart(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "restart")
c.exit(1)
return
}
var sIds []string
var instances []struct {
Service string
Instance int
}
for _, arg := range args {
svc, ins... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceRestart",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"1",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"... | // serviced service restart SERVICEID | [
"serviced",
"service",
"restart",
"SERVICEID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1812-L1877 |
140,052 | control-center/serviced | cli/cmd/service.go | cmdServiceStop | func (c *ServicedCli) cmdServiceStop(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "stop")
c.exit(1)
return
}
serviceIDs := make([]string, len(args))
for i, svcID := range args {
svc, _, err := c.searchForService(svcID, ctx.Bool("no... | go | func (c *ServicedCli) cmdServiceStop(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "stop")
c.exit(1)
return
}
serviceIDs := make([]string, len(args))
for i, svcID := range args {
svc, _, err := c.searchForService(svcID, ctx.Bool("no... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceStop",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"1",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n... | // serviced service stop SERVICEID | [
"serviced",
"service",
"stop",
"SERVICEID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L1880-L1910 |
140,053 | control-center/serviced | cli/cmd/service.go | cmdServiceEndpoints | func (c *ServicedCli) cmdServiceEndpoints(ctx *cli.Context) {
nArgs := len(ctx.Args())
if nArgs < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "endpoints")
c.exit(1)
return
}
svc, _, err := c.searchForService(ctx.Args().First(), ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintl... | go | func (c *ServicedCli) cmdServiceEndpoints(ctx *cli.Context) {
nArgs := len(ctx.Args())
if nArgs < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "endpoints")
c.exit(1)
return
}
svc, _, err := c.searchForService(ctx.Args().First(), ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintl... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceEndpoints",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"nArgs",
":=",
"len",
"(",
"ctx",
".",
"Args",
"(",
")",
")",
"\n",
"if",
"nArgs",
"<",
"1",
"{",
"fmt",
".",
"Printf",
"(",
"\"",... | // serviced service endpoints SERVICEID | [
"serviced",
"service",
"endpoints",
"SERVICEID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L2360-L2437 |
140,054 | control-center/serviced | cli/cmd/service.go | cmdServiceTune | func (c *ServicedCli) cmdServiceTune(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "tune")
c.exit(1)
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err... | go | func (c *ServicedCli) cmdServiceTune(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
fmt.Printf("Incorrect Usage.\n\n")
cli.ShowCommandHelp(ctx, "tune")
c.exit(1)
return
}
svcDetails, _, err := c.searchForService(args[0], ctx.Bool("no-prefix-match"))
if err != nil {
fmt.Fprintln(os.Stderr, err... | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdServiceTune",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"args",
":=",
"ctx",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"<",
"1",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n... | // serviced service tune SERVICEID | [
"serviced",
"service",
"tune",
"SERVICEID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/service.go#L2469-L2564 |
140,055 | control-center/serviced | domain/service/servicedetails.go | Equals | func (s *ServiceDetails) Equals(b *ServiceDetails) bool {
if s.ID != b.ID {
return false
}
if s.Name != b.Name {
return false
}
if s.Startup != b.Startup {
return false
}
if s.Description != b.Description {
return false
}
if s.Instances != b.Instances {
return false
}
if s.ImageID != b.ImageID {
... | go | func (s *ServiceDetails) Equals(b *ServiceDetails) bool {
if s.ID != b.ID {
return false
}
if s.Name != b.Name {
return false
}
if s.Startup != b.Startup {
return false
}
if s.Description != b.Description {
return false
}
if s.Instances != b.Instances {
return false
}
if s.ImageID != b.ImageID {
... | [
"func",
"(",
"s",
"*",
"ServiceDetails",
")",
"Equals",
"(",
"b",
"*",
"ServiceDetails",
")",
"bool",
"{",
"if",
"s",
".",
"ID",
"!=",
"b",
".",
"ID",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"s",
".",
"Name",
"!=",
"b",
".",
"Name",
"{",... | // Equals returns true if two instances of ServiceDetails are the same | [
"Equals",
"returns",
"true",
"if",
"two",
"instances",
"of",
"ServiceDetails",
"are",
"the",
"same"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/servicedetails.go#L78-L113 |
140,056 | control-center/serviced | domain/service/evaluate.go | EvaluateActionsTemplate | func (service *Service) EvaluateActionsTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
for key, value := range service.Actions {
err, result := service.evaluateTemplate(gs, fc, instanceID, value)
if err != nil {
return err
}
if result != "" {
service.Actions[key] = result
}
... | go | func (service *Service) EvaluateActionsTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
for key, value := range service.Actions {
err, result := service.evaluateTemplate(gs, fc, instanceID, value)
if err != nil {
return err
}
if result != "" {
service.Actions[key] = result
}
... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateActionsTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"for",
"key",
",",
"value",
":=",
"range",
"service",
".",
"Action... | // EvaluateActionsTemplate parses and evaluates the Actions string of a service. | [
"EvaluateActionsTemplate",
"parses",
"and",
"evaluates",
"the",
"Actions",
"string",
"of",
"a",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L115-L127 |
140,057 | control-center/serviced | domain/service/evaluate.go | EvaluateHostnameTemplate | func (service *Service) EvaluateHostnameTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
err, result := service.evaluateTemplate(gs, fc, instanceID, service.Hostname)
if err == nil {
service.Hostname = result
}
return
} | go | func (service *Service) EvaluateHostnameTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
err, result := service.evaluateTemplate(gs, fc, instanceID, service.Hostname)
if err == nil {
service.Hostname = result
}
return
} | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateHostnameTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"err",
",",
"result",
":=",
"service",
".",
"evaluateTemplate",
"("... | // EvaluateHostnameTemplate parses and evaluates the Hostname string of a service. | [
"EvaluateHostnameTemplate",
"parses",
"and",
"evaluates",
"the",
"Hostname",
"string",
"of",
"a",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L130-L136 |
140,058 | control-center/serviced | domain/service/evaluate.go | EvaluateVolumesTemplate | func (service *Service) EvaluateVolumesTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
for i, vol := range service.Volumes {
err, result := service.evaluateTemplate(gs, fc, instanceID, vol.ResourcePath)
if err != nil {
return err
}
if result != "" {
vol.ResourcePath = result
... | go | func (service *Service) EvaluateVolumesTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
for i, vol := range service.Volumes {
err, result := service.evaluateTemplate(gs, fc, instanceID, vol.ResourcePath)
if err != nil {
return err
}
if result != "" {
vol.ResourcePath = result
... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateVolumesTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"for",
"i",
",",
"vol",
":=",
"range",
"service",
".",
"Volumes",
... | // EvaluateVolumesTemplate parses and evaluates the ResourcePath string in
// volumes of a service | [
"EvaluateVolumesTemplate",
"parses",
"and",
"evaluates",
"the",
"ResourcePath",
"string",
"in",
"volumes",
"of",
"a",
"service"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L140-L153 |
140,059 | control-center/serviced | domain/service/evaluate.go | EvaluateStartupTemplate | func (service *Service) EvaluateStartupTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
err, result := service.evaluateTemplate(gs, fc, instanceID, service.Startup)
if err == nil && result != "" {
service.Startup = result
}
return
} | go | func (service *Service) EvaluateStartupTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
err, result := service.evaluateTemplate(gs, fc, instanceID, service.Startup)
if err == nil && result != "" {
service.Startup = result
}
return
} | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateStartupTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"err",
",",
"result",
":=",
"service",
".",
"evaluateTemplate",
"(",... | // EvaluateStartupTemplate parses and evaluates the StartUp string of a service. | [
"EvaluateStartupTemplate",
"parses",
"and",
"evaluates",
"the",
"StartUp",
"string",
"of",
"a",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L156-L162 |
140,060 | control-center/serviced | domain/service/evaluate.go | EvaluateRunsTemplate | func (service *Service) EvaluateRunsTemplate(gs GetService, fc FindChildService) (err error) {
for key, value := range service.Runs {
err, result := service.evaluateTemplate(gs, fc, 0, value)
if err != nil {
return err
}
if result != "" {
service.Runs[key] = result
}
}
for key, value := range service... | go | func (service *Service) EvaluateRunsTemplate(gs GetService, fc FindChildService) (err error) {
for key, value := range service.Runs {
err, result := service.evaluateTemplate(gs, fc, 0, value)
if err != nil {
return err
}
if result != "" {
service.Runs[key] = result
}
}
for key, value := range service... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateRunsTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
")",
"(",
"err",
"error",
")",
"{",
"for",
"key",
",",
"value",
":=",
"range",
"service",
".",
"Runs",
"{",
"err",
",",
"result",... | // EvaluateRunsTemplate parses and evaluates the Runs string of a service. | [
"EvaluateRunsTemplate",
"parses",
"and",
"evaluates",
"the",
"Runs",
"string",
"of",
"a",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L165-L186 |
140,061 | control-center/serviced | domain/service/evaluate.go | evaluateTemplate | func (service *Service) evaluateTemplate(gs GetService, fc FindChildService, instanceID int, serviceTemplate string) (err error, result string) {
defer func() {
if r := recover(); r != nil {
if _, ok := r.(runtime.Error); ok {
panic(r)
}
err = r.(error)
result = ""
}
}()
functions := template.Fu... | go | func (service *Service) evaluateTemplate(gs GetService, fc FindChildService, instanceID int, serviceTemplate string) (err error, result string) {
defer func() {
if r := recover(); r != nil {
if _, ok := r.(runtime.Error); ok {
panic(r)
}
err = r.(error)
result = ""
}
}()
functions := template.Fu... | [
"func",
"(",
"service",
"*",
"Service",
")",
"evaluateTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
",",
"serviceTemplate",
"string",
")",
"(",
"err",
"error",
",",
"result",
"string",
")",
"{",
"defer",
"func",... | // evaluateTemplate takes a control center client and template string and evaluates
// the template using the service as the context. If the template is invalid or there is an error
// then an empty string is returned. | [
"evaluateTemplate",
"takes",
"a",
"control",
"center",
"client",
"and",
"template",
"string",
"and",
"evaluates",
"the",
"template",
"using",
"the",
"service",
"as",
"the",
"context",
".",
"If",
"the",
"template",
"is",
"invalid",
"or",
"there",
"is",
"an",
... | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L191-L230 |
140,062 | control-center/serviced | domain/service/evaluate.go | EvaluateLogConfigTemplate | func (service *Service) EvaluateLogConfigTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating LogConfig Files")
// evaluate the template for the LogConfig as we... | go | func (service *Service) EvaluateLogConfigTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating LogConfig Files")
// evaluate the template for the LogConfig as we... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateLogConfigTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
... | // EvaluateLogConfigTemplate parses and evals the Path, Type and all the values for the tags of the log
// configs. This happens for each LogConfig on the service. | [
"EvaluateLogConfigTemplate",
"parses",
"and",
"evals",
"the",
"Path",
"Type",
"and",
"all",
"the",
"values",
"for",
"the",
"tags",
"of",
"the",
"log",
"configs",
".",
"This",
"happens",
"for",
"each",
"LogConfig",
"on",
"the",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L234-L273 |
140,063 | control-center/serviced | domain/service/evaluate.go | EvaluateConfigFilesTemplate | func (service *Service) EvaluateConfigFilesTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating Config Files")
for key, configFile := range service.ConfigFiles ... | go | func (service *Service) EvaluateConfigFilesTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating Config Files")
for key, configFile := range service.ConfigFiles ... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateConfigFilesTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\""... | // EvaluateConfigFilesTemplate parses and evals the Filename and Content. This happens for each
// ConfigFile on the service. | [
"EvaluateConfigFilesTemplate",
"parses",
"and",
"evals",
"the",
"Filename",
"and",
"Content",
".",
"This",
"happens",
"for",
"each",
"ConfigFile",
"on",
"the",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L277-L304 |
140,064 | control-center/serviced | domain/service/evaluate.go | EvaluatePrereqsTemplate | func (service *Service) EvaluatePrereqsTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating Prereq scripts")
for i, prereq := range service.Prereqs {
err, res... | go | func (service *Service) EvaluatePrereqsTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating Prereq scripts")
for i, prereq := range service.Prereqs {
err, res... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluatePrereqsTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
... | // EvaluatePrereqsTemplate parses and evals the Script field for each Prereq. | [
"EvaluatePrereqsTemplate",
"parses",
"and",
"evals",
"the",
"Script",
"field",
"for",
"each",
"Prereq",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L307-L325 |
140,065 | control-center/serviced | domain/service/evaluate.go | EvaluateHealthCheckTemplate | func (service *Service) EvaluateHealthCheckTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating HealthCheck scripts")
for key, healthcheck := range service.Heal... | go | func (service *Service) EvaluateHealthCheckTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
log.WithFields(log.Fields{
"servicename": service.Name,
"serviceid": service.ID,
"instanceid": instanceID,
}).Debug("Evaluating HealthCheck scripts")
for key, healthcheck := range service.Heal... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateHealthCheckTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\""... | // EvaluateHealthCheckTemplate parses and evals the Script field for each HealthCheck. | [
"EvaluateHealthCheckTemplate",
"parses",
"and",
"evals",
"the",
"Script",
"field",
"for",
"each",
"HealthCheck",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L328-L346 |
140,066 | control-center/serviced | domain/service/evaluate.go | EvaluateEndpointTemplates | func (service *Service) EvaluateEndpointTemplates(gs GetService, fc FindChildService, instanceID int) (err error) {
for i, ep := range service.Endpoints {
//cache the application template (assumes this is called after service creation from svc definition)
if ep.Application != "" && ep.ApplicationTemplate == "" {
... | go | func (service *Service) EvaluateEndpointTemplates(gs GetService, fc FindChildService, instanceID int) (err error) {
for i, ep := range service.Endpoints {
//cache the application template (assumes this is called after service creation from svc definition)
if ep.Application != "" && ep.ApplicationTemplate == "" {
... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateEndpointTemplates",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"for",
"i",
",",
"ep",
":=",
"range",
"service",
".",
"Endpoints... | // EvaluateEndpointTemplates parses and evaluates the "ApplicationTemplate" property
// of each of the service endpoints for this service. | [
"EvaluateEndpointTemplates",
"parses",
"and",
"evaluates",
"the",
"ApplicationTemplate",
"property",
"of",
"each",
"of",
"the",
"service",
"endpoints",
"for",
"this",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L384-L421 |
140,067 | control-center/serviced | domain/service/evaluate.go | EvaluateEnvironmentTemplate | func (service *Service) EvaluateEnvironmentTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
for i, envvar := range service.Environment {
err, result := service.evaluateTemplate(gs, fc, instanceID, envvar)
if err != nil {
return err
}
if result != "" {
service.Environment[i] = re... | go | func (service *Service) EvaluateEnvironmentTemplate(gs GetService, fc FindChildService, instanceID int) (err error) {
for i, envvar := range service.Environment {
err, result := service.evaluateTemplate(gs, fc, instanceID, envvar)
if err != nil {
return err
}
if result != "" {
service.Environment[i] = re... | [
"func",
"(",
"service",
"*",
"Service",
")",
"EvaluateEnvironmentTemplate",
"(",
"gs",
"GetService",
",",
"fc",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"for",
"i",
",",
"envvar",
":=",
"range",
"service",
".",
"Env... | // EvaluateEndpointTemplates parses and evaluates the "Environment" property of
// this service. | [
"EvaluateEndpointTemplates",
"parses",
"and",
"evaluates",
"the",
"Environment",
"property",
"of",
"this",
"service",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L425-L436 |
140,068 | control-center/serviced | domain/service/evaluate.go | Evaluate | func (service *Service) Evaluate(getSvc GetService, findChild FindChildService, instanceID int) (err error) {
if err = service.EvaluateEndpointTemplates(getSvc, findChild, instanceID); err != nil {
plog.WithError(err).Error()
return err
}
if err = service.EvaluateLogConfigTemplate(getSvc, findChild, instanceID);... | go | func (service *Service) Evaluate(getSvc GetService, findChild FindChildService, instanceID int) (err error) {
if err = service.EvaluateEndpointTemplates(getSvc, findChild, instanceID); err != nil {
plog.WithError(err).Error()
return err
}
if err = service.EvaluateLogConfigTemplate(getSvc, findChild, instanceID);... | [
"func",
"(",
"service",
"*",
"Service",
")",
"Evaluate",
"(",
"getSvc",
"GetService",
",",
"findChild",
"FindChildService",
",",
"instanceID",
"int",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"service",
".",
"EvaluateEndpointTemplates",
"(",
"get... | // Evaluate evaluates all the fields of the Service that we care about, using
// a runtimeContext with the current Service embedded, and adding instanceID
// as an extra attribute. | [
"Evaluate",
"evaluates",
"all",
"the",
"fields",
"of",
"the",
"Service",
"that",
"we",
"care",
"about",
"using",
"a",
"runtimeContext",
"with",
"the",
"current",
"Service",
"embedded",
"and",
"adding",
"instanceID",
"as",
"an",
"extra",
"attribute",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/evaluate.go#L461-L507 |
140,069 | control-center/serviced | utils/docker_exec.go | ExecDockerExec | func ExecDockerExec(containerID string, bashcmd []string) error {
command, err := generateDockerExecCommand(containerID, bashcmd, false)
if err != nil {
return err
}
glog.V(1).Infof("exec command for container:%v command: %v\n", containerID, command)
return syscall.Exec(command[0], command[0:], os.Environ())
} | go | func ExecDockerExec(containerID string, bashcmd []string) error {
command, err := generateDockerExecCommand(containerID, bashcmd, false)
if err != nil {
return err
}
glog.V(1).Infof("exec command for container:%v command: %v\n", containerID, command)
return syscall.Exec(command[0], command[0:], os.Environ())
} | [
"func",
"ExecDockerExec",
"(",
"containerID",
"string",
",",
"bashcmd",
"[",
"]",
"string",
")",
"error",
"{",
"command",
",",
"err",
":=",
"generateDockerExecCommand",
"(",
"containerID",
",",
"bashcmd",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // ExecDockerExec execs the command using docker exec | [
"ExecDockerExec",
"execs",
"the",
"command",
"using",
"docker",
"exec"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/docker_exec.go#L37-L44 |
140,070 | control-center/serviced | utils/docker_exec.go | RunDockerExec | func RunDockerExec(containerID string, bashcmd []string) ([]byte, error) {
oldStdin := os.Stdin
os.Stdin = nil // temporary stdin=nil https://github.com/docker/docker/pull/9537
command, err := generateDockerExecCommand(containerID, bashcmd, true)
os.Stdin = oldStdin
if err != nil {
return nil, err
}
thecmd := ... | go | func RunDockerExec(containerID string, bashcmd []string) ([]byte, error) {
oldStdin := os.Stdin
os.Stdin = nil // temporary stdin=nil https://github.com/docker/docker/pull/9537
command, err := generateDockerExecCommand(containerID, bashcmd, true)
os.Stdin = oldStdin
if err != nil {
return nil, err
}
thecmd := ... | [
"func",
"RunDockerExec",
"(",
"containerID",
"string",
",",
"bashcmd",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"oldStdin",
":=",
"os",
".",
"Stdin",
"\n",
"os",
".",
"Stdin",
"=",
"nil",
"// temporary stdin=nil https://githu... | // RunDockerExec runs the command using docker exec | [
"RunDockerExec",
"runs",
"the",
"command",
"using",
"docker",
"exec"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/docker_exec.go#L47-L63 |
140,071 | control-center/serviced | utils/docker_exec.go | generateDockerExecCommand | func generateDockerExecCommand(containerID string, bashcmd []string, prependBash bool) ([]string, error) {
if containerID == "" {
return []string{}, fmt.Errorf("will not attach to container with empty containerID")
}
exeMap, err := exePaths([]string{"docker"})
if err != nil {
return []string{}, err
}
// TOD... | go | func generateDockerExecCommand(containerID string, bashcmd []string, prependBash bool) ([]string, error) {
if containerID == "" {
return []string{}, fmt.Errorf("will not attach to container with empty containerID")
}
exeMap, err := exePaths([]string{"docker"})
if err != nil {
return []string{}, err
}
// TOD... | [
"func",
"generateDockerExecCommand",
"(",
"containerID",
"string",
",",
"bashcmd",
"[",
"]",
"string",
",",
"prependBash",
"bool",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"containerID",
"==",
"\"",
"\"",
"{",
"return",
"[",
"]",
"stri... | // generateDockerExecCommand returns a slice containing docker exec command to exec | [
"generateDockerExecCommand",
"returns",
"a",
"slice",
"containing",
"docker",
"exec",
"command",
"to",
"exec"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/docker_exec.go#L66-L95 |
140,072 | control-center/serviced | utils/docker_exec.go | hasFeatureDockerExec | func hasFeatureDockerExec() bool {
command := []string{"docker", "exec"}
thecmd := exec.Command(command[0], command[1:]...)
output, err := thecmd.CombinedOutput()
// when docker exec is supported, we expect above 'docker exec' to fail,
// but provide usage
glog.V(1).Infof("Successfully ran command:'%s' err: %s ... | go | func hasFeatureDockerExec() bool {
command := []string{"docker", "exec"}
thecmd := exec.Command(command[0], command[1:]...)
output, err := thecmd.CombinedOutput()
// when docker exec is supported, we expect above 'docker exec' to fail,
// but provide usage
glog.V(1).Infof("Successfully ran command:'%s' err: %s ... | [
"func",
"hasFeatureDockerExec",
"(",
")",
"bool",
"{",
"command",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n\n",
"thecmd",
":=",
"exec",
".",
"Command",
"(",
"command",
"[",
"0",
"]",
",",
"command",
"[",
"1",
":",
"]",
... | // hasFeatureDockerExec returns true if docker exec is supported | [
"hasFeatureDockerExec",
"returns",
"true",
"if",
"docker",
"exec",
"is",
"supported"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/docker_exec.go#L98-L108 |
140,073 | control-center/serviced | utils/docker_exec.go | AttachAndRun | func AttachAndRun(containerID string, bashcmd []string) ([]byte, error) {
return RunDockerExec(containerID, bashcmd)
} | go | func AttachAndRun(containerID string, bashcmd []string) ([]byte, error) {
return RunDockerExec(containerID, bashcmd)
} | [
"func",
"AttachAndRun",
"(",
"containerID",
"string",
",",
"bashcmd",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"RunDockerExec",
"(",
"containerID",
",",
"bashcmd",
")",
"\n",
"}"
] | // AttachAndRun attaches to a container and runs the command | [
"AttachAndRun",
"attaches",
"to",
"a",
"container",
"and",
"runs",
"the",
"command"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/docker_exec.go#L111-L113 |
140,074 | control-center/serviced | utils/docker_exec.go | exePaths | func exePaths(exes []string) (map[string]string, error) {
exeMap := map[string]string{}
for _, exe := range exes {
path, err := exec.LookPath(exe)
if err != nil {
glog.Errorf("exe:'%v' not found error:%v\n", exe, err)
return nil, err
}
exeMap[exe] = path
}
return exeMap, nil
} | go | func exePaths(exes []string) (map[string]string, error) {
exeMap := map[string]string{}
for _, exe := range exes {
path, err := exec.LookPath(exe)
if err != nil {
glog.Errorf("exe:'%v' not found error:%v\n", exe, err)
return nil, err
}
exeMap[exe] = path
}
return exeMap, nil
} | [
"func",
"exePaths",
"(",
"exes",
"[",
"]",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"exeMap",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"_",
",",
"exe",
":=",
"range",
"exes",
"{",... | // exePaths returns the full path to the given executables in a map | [
"exePaths",
"returns",
"the",
"full",
"path",
"to",
"the",
"given",
"executables",
"in",
"a",
"map"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/docker_exec.go#L121-L135 |
140,075 | control-center/serviced | cli/cmd/volume.go | cmdVolumeStatus | func (c *ServicedCli) cmdVolumeStatus(ctx *cli.Context) {
response, err := c.driver.GetVolumeStatus()
if err != nil {
log.WithError(err).Error("Unable to get volume status")
return
}
if ctx.Bool("verbose") {
printStatusesJson(response)
} else {
printStatuses(response)
}
return
} | go | func (c *ServicedCli) cmdVolumeStatus(ctx *cli.Context) {
response, err := c.driver.GetVolumeStatus()
if err != nil {
log.WithError(err).Error("Unable to get volume status")
return
}
if ctx.Bool("verbose") {
printStatusesJson(response)
} else {
printStatuses(response)
}
return
} | [
"func",
"(",
"c",
"*",
"ServicedCli",
")",
"cmdVolumeStatus",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"response",
",",
"err",
":=",
"c",
".",
"driver",
".",
"GetVolumeStatus",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Wi... | // serviced volume status | [
"serviced",
"volume",
"status"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/volume.go#L49-L61 |
140,076 | control-center/serviced | auth/rsa.go | RSAPrivateKeyFromPEM | func RSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
parsed, err := parsePEM(key)
if err != nil {
return nil, err
}
var parsedKey crypto.PrivateKey
if parsedKey, err = x509.ParsePKCS1PrivateKey(parsed); err != nil {
if parsedKey, err = x509.ParsePKCS8PrivateKey(parsed); err != nil {
return nil, ... | go | func RSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
parsed, err := parsePEM(key)
if err != nil {
return nil, err
}
var parsedKey crypto.PrivateKey
if parsedKey, err = x509.ParsePKCS1PrivateKey(parsed); err != nil {
if parsedKey, err = x509.ParsePKCS8PrivateKey(parsed); err != nil {
return nil, ... | [
"func",
"RSAPrivateKeyFromPEM",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"*",
"rsa",
".",
"PrivateKey",
",",
"error",
")",
"{",
"parsed",
",",
"err",
":=",
"parsePEM",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err"... | // RSAPrivateKeyFromPEM decodes a PEM-encoded RSA private key | [
"RSAPrivateKeyFromPEM",
"decodes",
"a",
"PEM",
"-",
"encoded",
"RSA",
"private",
"key"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L84-L96 |
140,077 | control-center/serviced | auth/rsa.go | RSAPublicKeyFromPEM | func RSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
parsed, err := parsePEM(key)
if err != nil {
return nil, err
}
var parsedKey crypto.PublicKey
if parsedKey, err = x509.ParsePKIXPublicKey(parsed); err != nil {
cert, err := x509.ParseCertificate(parsed)
if err != nil {
return nil, ErrNotRSAPub... | go | func RSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
parsed, err := parsePEM(key)
if err != nil {
return nil, err
}
var parsedKey crypto.PublicKey
if parsedKey, err = x509.ParsePKIXPublicKey(parsed); err != nil {
cert, err := x509.ParseCertificate(parsed)
if err != nil {
return nil, ErrNotRSAPub... | [
"func",
"RSAPublicKeyFromPEM",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"*",
"rsa",
".",
"PublicKey",
",",
"error",
")",
"{",
"parsed",
",",
"err",
":=",
"parsePEM",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // RSAPublicKeyFromPEM decodes a PEM-encoded RSA public key | [
"RSAPublicKeyFromPEM",
"decodes",
"a",
"PEM",
"-",
"encoded",
"RSA",
"public",
"key"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L99-L113 |
140,078 | control-center/serviced | auth/rsa.go | RSASigner | func RSASigner(key crypto.PrivateKey) (Signer, error) {
pkey, err := verifyRSAPrivateKey(key)
if err != nil {
return nil, err
}
return &rsaSigner{pkey}, nil
} | go | func RSASigner(key crypto.PrivateKey) (Signer, error) {
pkey, err := verifyRSAPrivateKey(key)
if err != nil {
return nil, err
}
return &rsaSigner{pkey}, nil
} | [
"func",
"RSASigner",
"(",
"key",
"crypto",
".",
"PrivateKey",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"pkey",
",",
"err",
":=",
"verifyRSAPrivateKey",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
... | // RSASigner creates a Signer from a key, validating that it is an RSA private
// key first | [
"RSASigner",
"creates",
"a",
"Signer",
"from",
"a",
"key",
"validating",
"that",
"it",
"is",
"an",
"RSA",
"private",
"key",
"first"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L133-L139 |
140,079 | control-center/serviced | auth/rsa.go | RSASignerFromPEM | func RSASignerFromPEM(key []byte) (Signer, error) {
pkey, err := RSAPrivateKeyFromPEM(key)
if err != nil {
return nil, err
}
return RSASigner(pkey)
} | go | func RSASignerFromPEM(key []byte) (Signer, error) {
pkey, err := RSAPrivateKeyFromPEM(key)
if err != nil {
return nil, err
}
return RSASigner(pkey)
} | [
"func",
"RSASignerFromPEM",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"pkey",
",",
"err",
":=",
"RSAPrivateKeyFromPEM",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\... | // RSASignerFromPEM creates a Signer from a PEM-encoded key, validating that it
// is an RSA private key first | [
"RSASignerFromPEM",
"creates",
"a",
"Signer",
"from",
"a",
"PEM",
"-",
"encoded",
"key",
"validating",
"that",
"it",
"is",
"an",
"RSA",
"private",
"key",
"first"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L143-L149 |
140,080 | control-center/serviced | auth/rsa.go | RSAVerifier | func RSAVerifier(key crypto.PublicKey) (Verifier, error) {
pkey, err := verifyRSAPublicKey(key)
if err != nil {
return nil, err
}
return &rsaVerifier{pkey}, nil
} | go | func RSAVerifier(key crypto.PublicKey) (Verifier, error) {
pkey, err := verifyRSAPublicKey(key)
if err != nil {
return nil, err
}
return &rsaVerifier{pkey}, nil
} | [
"func",
"RSAVerifier",
"(",
"key",
"crypto",
".",
"PublicKey",
")",
"(",
"Verifier",
",",
"error",
")",
"{",
"pkey",
",",
"err",
":=",
"verifyRSAPublicKey",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",... | // RSAVerifier creates a Verifier from a key, verifying that it is an RSA
// public key first | [
"RSAVerifier",
"creates",
"a",
"Verifier",
"from",
"a",
"key",
"verifying",
"that",
"it",
"is",
"an",
"RSA",
"public",
"key",
"first"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L153-L159 |
140,081 | control-center/serviced | auth/rsa.go | RSAVerifierFromPEM | func RSAVerifierFromPEM(key []byte) (Verifier, error) {
pkey, err := RSAPublicKeyFromPEM(key)
if err != nil {
return nil, err
}
return RSAVerifier(pkey)
} | go | func RSAVerifierFromPEM(key []byte) (Verifier, error) {
pkey, err := RSAPublicKeyFromPEM(key)
if err != nil {
return nil, err
}
return RSAVerifier(pkey)
} | [
"func",
"RSAVerifierFromPEM",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"Verifier",
",",
"error",
")",
"{",
"pkey",
",",
"err",
":=",
"RSAPublicKeyFromPEM",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
... | // RSAVerifierFromPEM creates a Verifier from a PEM-encoded key, verifying that
// it is an RSA public key first | [
"RSAVerifierFromPEM",
"creates",
"a",
"Verifier",
"from",
"a",
"PEM",
"-",
"encoded",
"key",
"verifying",
"that",
"it",
"is",
"an",
"RSA",
"public",
"key",
"first"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L163-L169 |
140,082 | control-center/serviced | auth/rsa.go | PEMFromRSAPublicKey | func PEMFromRSAPublicKey(key crypto.PublicKey, headers map[string]string) ([]byte, error) {
pkey, err := verifyRSAPublicKey(key)
if err != nil {
return nil, err
}
marshalled, err := x509.MarshalPKIXPublicKey(pkey)
if err != nil {
return []byte{}, err
}
block := pem.Block{
Type: "PUBLIC KEY",
Headers: ... | go | func PEMFromRSAPublicKey(key crypto.PublicKey, headers map[string]string) ([]byte, error) {
pkey, err := verifyRSAPublicKey(key)
if err != nil {
return nil, err
}
marshalled, err := x509.MarshalPKIXPublicKey(pkey)
if err != nil {
return []byte{}, err
}
block := pem.Block{
Type: "PUBLIC KEY",
Headers: ... | [
"func",
"PEMFromRSAPublicKey",
"(",
"key",
"crypto",
".",
"PublicKey",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pkey",
",",
"err",
":=",
"verifyRSAPublicKey",
"(",
"key",
")",
"\n",
"if",... | // PEMFromRSAPublicKey creates a PEM block from an RSA public key | [
"PEMFromRSAPublicKey",
"creates",
"a",
"PEM",
"block",
"from",
"an",
"RSA",
"public",
"key"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L172-L188 |
140,083 | control-center/serviced | auth/rsa.go | PEMFromRSAPrivateKey | func PEMFromRSAPrivateKey(key crypto.PrivateKey, headers map[string]string) ([]byte, error) {
pkey, err := verifyRSAPrivateKey(key)
if err != nil {
return nil, err
}
marshalled := x509.MarshalPKCS1PrivateKey(pkey)
block := pem.Block{
Type: "RSA PRIVATE KEY",
Headers: headers,
Bytes: marshalled,
}
by... | go | func PEMFromRSAPrivateKey(key crypto.PrivateKey, headers map[string]string) ([]byte, error) {
pkey, err := verifyRSAPrivateKey(key)
if err != nil {
return nil, err
}
marshalled := x509.MarshalPKCS1PrivateKey(pkey)
block := pem.Block{
Type: "RSA PRIVATE KEY",
Headers: headers,
Bytes: marshalled,
}
by... | [
"func",
"PEMFromRSAPrivateKey",
"(",
"key",
"crypto",
".",
"PrivateKey",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pkey",
",",
"err",
":=",
"verifyRSAPrivateKey",
"(",
"key",
")",
"\n",
"i... | // PEMFromRSAPrivateKey creates a PEM block from an RSA public key | [
"PEMFromRSAPrivateKey",
"creates",
"a",
"PEM",
"block",
"from",
"an",
"RSA",
"public",
"key"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L191-L204 |
140,084 | control-center/serviced | auth/rsa.go | GenerateRSAKeyPairPEM | func GenerateRSAKeyPairPEM(headers map[string]string) (public []byte, private []byte, err error) {
privateKey, err := rsa.GenerateKey(rand.Reader, rsaKeyLength)
if err != nil {
return nil, nil, err
}
if private, err = PEMFromRSAPrivateKey(privateKey, headers); err != nil {
return nil, nil, err
}
publicKey := ... | go | func GenerateRSAKeyPairPEM(headers map[string]string) (public []byte, private []byte, err error) {
privateKey, err := rsa.GenerateKey(rand.Reader, rsaKeyLength)
if err != nil {
return nil, nil, err
}
if private, err = PEMFromRSAPrivateKey(privateKey, headers); err != nil {
return nil, nil, err
}
publicKey := ... | [
"func",
"GenerateRSAKeyPairPEM",
"(",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"public",
"[",
"]",
"byte",
",",
"private",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"privateKey",
",",
"err",
":=",
"rsa",
".",
"GenerateKey",
"(",... | // GenerateKey generates an RSA key pair and returns the public and private
// PEM blocks for that key. | [
"GenerateKey",
"generates",
"an",
"RSA",
"key",
"pair",
"and",
"returns",
"the",
"public",
"and",
"private",
"PEM",
"blocks",
"for",
"that",
"key",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L208-L221 |
140,085 | control-center/serviced | auth/rsa.go | DumpRSAPEMKeyPair | func DumpRSAPEMKeyPair(public, private []byte) ([]byte, error) {
// Do some validation first. These don't have to be a matched pair,
// but they do have to be PEM, and they have to be a public and
// private key, respectively
if _, err := RSAPublicKeyFromPEM(public); err != nil {
return nil, err
}
if _, er... | go | func DumpRSAPEMKeyPair(public, private []byte) ([]byte, error) {
// Do some validation first. These don't have to be a matched pair,
// but they do have to be PEM, and they have to be a public and
// private key, respectively
if _, err := RSAPublicKeyFromPEM(public); err != nil {
return nil, err
}
if _, er... | [
"func",
"DumpRSAPEMKeyPair",
"(",
"public",
",",
"private",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Do some validation first. These don't have to be a matched pair,",
"// but they do have to be PEM, and they have to be a public and",
"//\t... | // DumpRSAPEMKeyPair dumps PEM-encoded public and private keys to a single byte array | [
"DumpRSAPEMKeyPair",
"dumps",
"PEM",
"-",
"encoded",
"public",
"and",
"private",
"keys",
"to",
"a",
"single",
"byte",
"array"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rsa.go#L236-L257 |
140,086 | control-center/serviced | coordinator/client/zookeeper/connection.go | isClosed | func (c *Connection) isClosed() error {
if c.conn == nil {
return client.ErrConnectionClosed
}
return nil
} | go | func (c *Connection) isClosed() error {
if c.conn == nil {
return client.ErrConnectionClosed
}
return nil
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"isClosed",
"(",
")",
"error",
"{",
"if",
"c",
".",
"conn",
"==",
"nil",
"{",
"return",
"client",
".",
"ErrConnectionClosed",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // IsClosed returns connection closed error if true, otherwise returns nil. | [
"IsClosed",
"returns",
"connection",
"closed",
"error",
"if",
"true",
"otherwise",
"returns",
"nil",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L38-L43 |
140,087 | control-center/serviced | coordinator/client/zookeeper/connection.go | Close | func (c *Connection) Close() {
c.Lock()
defer c.Unlock()
if c.conn != nil {
c.conn.Close()
c.conn = nil
if c.onClose != nil {
c.onClose(c.id)
c.onClose = nil
}
}
} | go | func (c *Connection) Close() {
c.Lock()
defer c.Unlock()
if c.conn != nil {
c.conn.Close()
c.conn = nil
if c.onClose != nil {
c.onClose(c.id)
c.onClose = nil
}
}
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"Close",
"(",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"if",
"c",
".",
"conn",
"!=",
"nil",
"{",
"c",
".",
"conn",
".",
"Close",
"(",
")",
"\n",
"c",
... | // Close closes the client connection to zookeeper. Calling close twice will
// result in a no-op. | [
"Close",
"closes",
"the",
"client",
"connection",
"to",
"zookeeper",
".",
"Calling",
"close",
"twice",
"will",
"result",
"in",
"a",
"no",
"-",
"op",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L47-L58 |
140,088 | control-center/serviced | coordinator/client/zookeeper/connection.go | SetID | func (c *Connection) SetID(i int) {
c.Lock()
defer c.Unlock()
c.id = i
} | go | func (c *Connection) SetID(i int) {
c.Lock()
defer c.Unlock()
c.id = i
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"SetID",
"(",
"i",
"int",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"id",
"=",
"i",
"\n",
"}"
] | // SetID sets the connection ID | [
"SetID",
"sets",
"the",
"connection",
"ID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L61-L65 |
140,089 | control-center/serviced | coordinator/client/zookeeper/connection.go | ID | func (c *Connection) ID() int {
c.RLock()
defer c.RUnlock()
return c.id
} | go | func (c *Connection) ID() int {
c.RLock()
defer c.RUnlock()
return c.id
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"ID",
"(",
")",
"int",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"id",
"\n",
"}"
] | // ID gets the connection ID | [
"ID",
"gets",
"the",
"connection",
"ID"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L68-L72 |
140,090 | control-center/serviced | coordinator/client/zookeeper/connection.go | SetOnClose | func (c *Connection) SetOnClose(onClose func(int)) {
c.Lock()
defer c.Unlock()
if err := c.isClosed(); err == nil {
c.onClose = onClose
}
} | go | func (c *Connection) SetOnClose(onClose func(int)) {
c.Lock()
defer c.Unlock()
if err := c.isClosed(); err == nil {
c.onClose = onClose
}
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"SetOnClose",
"(",
"onClose",
"func",
"(",
"int",
")",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"isClosed",
"(",
")",
";",
... | // SetOnClose performs cleanup when a connection is closed | [
"SetOnClose",
"performs",
"cleanup",
"when",
"a",
"connection",
"is",
"closed"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L75-L81 |
140,091 | control-center/serviced | coordinator/client/zookeeper/connection.go | NewTransaction | func (c *Connection) NewTransaction() client.Transaction {
return &Transaction{
conn: c,
ops: []multiReq{},
}
} | go | func (c *Connection) NewTransaction() client.Transaction {
return &Transaction{
conn: c,
ops: []multiReq{},
}
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"NewTransaction",
"(",
")",
"client",
".",
"Transaction",
"{",
"return",
"&",
"Transaction",
"{",
"conn",
":",
"c",
",",
"ops",
":",
"[",
"]",
"multiReq",
"{",
"}",
",",
"}",
"\n",
"}"
] | // NewTransaction creates a new transaction object | [
"NewTransaction",
"creates",
"a",
"new",
"transaction",
"object"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L84-L89 |
140,092 | control-center/serviced | coordinator/client/zookeeper/connection.go | NewLock | func (c *Connection) NewLock(p string) (client.Lock, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return nil, err
}
lock := &Lock{
lock: zklib.NewLock(c.conn, path.Join(c.basePath, p), zklib.WorldACL(zklib.PermAll)),
}
return lock, nil
} | go | func (c *Connection) NewLock(p string) (client.Lock, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return nil, err
}
lock := &Lock{
lock: zklib.NewLock(c.conn, path.Join(c.basePath, p), zklib.WorldACL(zklib.PermAll)),
}
return lock, nil
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"NewLock",
"(",
"p",
"string",
")",
"(",
"client",
".",
"Lock",
",",
"error",
")",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"i... | // NewLock creates a new lock object | [
"NewLock",
"creates",
"a",
"new",
"lock",
"object"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L92-L102 |
140,093 | control-center/serviced | coordinator/client/zookeeper/connection.go | NewLeader | func (c *Connection) NewLeader(p string) (client.Leader, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return nil, err
}
return NewLeader(c.conn, path.Join(path.Join(c.basePath, p))), nil
} | go | func (c *Connection) NewLeader(p string) (client.Leader, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return nil, err
}
return NewLeader(c.conn, path.Join(path.Join(c.basePath, p))), nil
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"NewLeader",
"(",
"p",
"string",
")",
"(",
"client",
".",
"Leader",
",",
"error",
")",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
... | // NewLeader returns a managed leader object at the given path bound to the
// current connection. | [
"NewLeader",
"returns",
"a",
"managed",
"leader",
"object",
"at",
"the",
"given",
"path",
"bound",
"to",
"the",
"current",
"connection",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L106-L113 |
140,094 | control-center/serviced | coordinator/client/zookeeper/connection.go | Create | func (c *Connection) Create(path string, node client.Node) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
if err := c.ensurePath(path); err != nil {
return err
}
return c.create(path, node)
} | go | func (c *Connection) Create(path string, node client.Node) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
if err := c.ensurePath(path); err != nil {
return err
}
return c.create(path, node)
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"Create",
"(",
"path",
"string",
",",
"node",
"client",
".",
"Node",
")",
"error",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"isC... | // Create adds a node at the specified path | [
"Create",
"adds",
"a",
"node",
"at",
"the",
"specified",
"path"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L116-L126 |
140,095 | control-center/serviced | coordinator/client/zookeeper/connection.go | CreateDir | func (c *Connection) CreateDir(path string) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
if err := c.ensurePath(path); err != nil {
return err
}
return c.createDir(path)
} | go | func (c *Connection) CreateDir(path string) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
if err := c.ensurePath(path); err != nil {
return err
}
return c.createDir(path)
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"CreateDir",
"(",
"path",
"string",
")",
"error",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"isClosed",
"(",
")",
";",
"err",
"!=... | // CreateDir adds a dir at the specified path | [
"CreateDir",
"adds",
"a",
"dir",
"at",
"the",
"specified",
"path"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L153-L163 |
140,096 | control-center/serviced | coordinator/client/zookeeper/connection.go | CreateEphemeral | func (c *Connection) CreateEphemeral(path string, node client.Node) (string, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return "", err
}
if err := c.ensurePath(path); err != nil {
return "", err
}
return c.createEphemeral(path, node)
} | go | func (c *Connection) CreateEphemeral(path string, node client.Node) (string, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return "", err
}
if err := c.ensurePath(path); err != nil {
return "", err
}
return c.createEphemeral(path, node)
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"CreateEphemeral",
"(",
"path",
"string",
",",
"node",
"client",
".",
"Node",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"... | // CreateEphemeral creates a node whose existance depends on the persistence of
// the connection. | [
"CreateEphemeral",
"creates",
"a",
"node",
"whose",
"existance",
"depends",
"on",
"the",
"persistence",
"of",
"the",
"connection",
"."
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L194-L204 |
140,097 | control-center/serviced | coordinator/client/zookeeper/connection.go | Set | func (c *Connection) Set(path string, node client.Node) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
return c.set(path, node)
} | go | func (c *Connection) Set(path string, node client.Node) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
return c.set(path, node)
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"Set",
"(",
"path",
"string",
",",
"node",
"client",
".",
"Node",
")",
"error",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"isClos... | // Set assigns a value to an existing node at a given path | [
"Set",
"assigns",
"a",
"value",
"to",
"an",
"existing",
"node",
"at",
"a",
"given",
"path"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L228-L235 |
140,098 | control-center/serviced | coordinator/client/zookeeper/connection.go | Delete | func (c *Connection) Delete(path string) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
return c.delete(path)
} | go | func (c *Connection) Delete(path string) error {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return err
}
return c.delete(path)
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"Delete",
"(",
"path",
"string",
")",
"error",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"isClosed",
"(",
")",
";",
"err",
"!=",
... | // Delete recursively removes a path and its children | [
"Delete",
"recursively",
"removes",
"a",
"path",
"and",
"its",
"children"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L257-L264 |
140,099 | control-center/serviced | coordinator/client/zookeeper/connection.go | Exists | func (c *Connection) Exists(path string) (bool, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return false, err
}
return c.exists(path)
} | go | func (c *Connection) Exists(path string) (bool, error) {
c.RLock()
defer c.RUnlock()
if err := c.isClosed(); err != nil {
return false, err
}
return c.exists(path)
} | [
"func",
"(",
"c",
"*",
"Connection",
")",
"Exists",
"(",
"path",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"isClosed",
"(",
... | // Exists returns true if the path exists | [
"Exists",
"returns",
"true",
"if",
"the",
"path",
"exists"
] | 7028f598e6a224b4d421e09cb9b582ad7d000304 | https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/connection.go#L285-L292 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.