id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
139,600
control-center/serviced
rpc/master/service_client.go
WaitService
func (c *Client) WaitService(serviceIDs []string, state service.DesiredState, timeout time.Duration, recursive bool) error { waitSvcRequest := &WaitServiceRequest{ ServiceIDs: serviceIDs, State: state, Timeout: timeout, Recursive: recursive, } throwaway := "" err := c.call("WaitService", waitSvcReq...
go
func (c *Client) WaitService(serviceIDs []string, state service.DesiredState, timeout time.Duration, recursive bool) error { waitSvcRequest := &WaitServiceRequest{ ServiceIDs: serviceIDs, State: state, Timeout: timeout, Recursive: recursive, } throwaway := "" err := c.call("WaitService", waitSvcReq...
[ "func", "(", "c", "*", "Client", ")", "WaitService", "(", "serviceIDs", "[", "]", "string", ",", "state", "service", ".", "DesiredState", ",", "timeout", "time", ".", "Duration", ",", "recursive", "bool", ")", "error", "{", "waitSvcRequest", ":=", "&", "...
// WaitService will wait for the specified services to reach the specified // state, within the given timeout
[ "WaitService", "will", "wait", "for", "the", "specified", "services", "to", "reach", "the", "specified", "state", "within", "the", "given", "timeout" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_client.go#L41-L51
139,601
control-center/serviced
rpc/master/service_client.go
GetService
func (c *Client) GetService(serviceID string) (*service.Service, error) { svc := &service.Service{} err := c.call("GetService", serviceID, svc) return svc, err }
go
func (c *Client) GetService(serviceID string) (*service.Service, error) { svc := &service.Service{} err := c.call("GetService", serviceID, svc) return svc, err }
[ "func", "(", "c", "*", "Client", ")", "GetService", "(", "serviceID", "string", ")", "(", "*", "service", ".", "Service", ",", "error", ")", "{", "svc", ":=", "&", "service", ".", "Service", "{", "}", "\n", "err", ":=", "c", ".", "call", "(", "\"...
// GetService returns a service with a particular service id.
[ "GetService", "returns", "a", "service", "with", "a", "particular", "service", "id", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_client.go#L75-L79
139,602
control-center/serviced
rpc/master/service_client.go
RemoveIPs
func (c *Client) RemoveIPs(args []string) error { return c.call("RemoveIPs", args, new(string)) }
go
func (c *Client) RemoveIPs(args []string) error { return c.call("RemoveIPs", args, new(string)) }
[ "func", "(", "c", "*", "Client", ")", "RemoveIPs", "(", "args", "[", "]", "string", ")", "error", "{", "return", "c", ".", "call", "(", "\"", "\"", ",", "args", ",", "new", "(", "string", ")", ")", "\n", "}" ]
// Remove the IP assignment of a service's endpoints
[ "Remove", "the", "IP", "assignment", "of", "a", "service", "s", "endpoints" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_client.go#L128-L130
139,603
control-center/serviced
rpc/master/service_client.go
SetIPs
func (c *Client) SetIPs(r addressassignment.AssignmentRequest) error { return c.call("SetIPs", r, new(string)) }
go
func (c *Client) SetIPs(r addressassignment.AssignmentRequest) error { return c.call("SetIPs", r, new(string)) }
[ "func", "(", "c", "*", "Client", ")", "SetIPs", "(", "r", "addressassignment", ".", "AssignmentRequest", ")", "error", "{", "return", "c", ".", "call", "(", "\"", "\"", ",", "r", ",", "new", "(", "string", ")", ")", "\n", "}" ]
// Assigns an IP address to a services that haven't IP Assignment by default
[ "Assigns", "an", "IP", "address", "to", "a", "services", "that", "haven", "t", "IP", "Assignment", "by", "default" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/service_client.go#L133-L135
139,604
control-center/serviced
utils/uuid.go
NewUUID
func NewUUID() (string, error) { b := make([]byte, 16) _, err := randSource.Read(b) if err != nil { return "", err } return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]), nil }
go
func NewUUID() (string, error) { b := make([]byte, 16) _, err := randSource.Read(b) if err != nil { return "", err } return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]), nil }
[ "func", "NewUUID", "(", ")", "(", "string", ",", "error", ")", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "16", ")", "\n", "_", ",", "err", ":=", "randSource", ".", "Read", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// NewUUID generate a new UUID
[ "NewUUID", "generate", "a", "new", "UUID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/uuid.go#L61-L68
139,605
control-center/serviced
utils/uuid.go
NewUUID62
func NewUUID62() (string, error) { b := make([]byte, 16) _, err := randSource.Read(b) if err != nil { return "", err } s := fmt.Sprintf("%x", b) return ConvertUp(s, base62alphabet), nil }
go
func NewUUID62() (string, error) { b := make([]byte, 16) _, err := randSource.Read(b) if err != nil { return "", err } s := fmt.Sprintf("%x", b) return ConvertUp(s, base62alphabet), nil }
[ "func", "NewUUID62", "(", ")", "(", "string", ",", "error", ")", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "16", ")", "\n", "_", ",", "err", ":=", "randSource", ".", "Read", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// NewUUID62 returns a base-36 UUID with no dashes.
[ "NewUUID62", "returns", "a", "base", "-", "36", "UUID", "with", "no", "dashes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/uuid.go#L71-L79
139,606
control-center/serviced
utils/uuid.go
NewUUID36
func NewUUID36() (string, error) { b := make([]byte, 16) _, err := randSource.Read(b) if err != nil { return "", err } s := fmt.Sprintf("%x", b) return ConvertUp(s, base36alphabet), nil }
go
func NewUUID36() (string, error) { b := make([]byte, 16) _, err := randSource.Read(b) if err != nil { return "", err } s := fmt.Sprintf("%x", b) return ConvertUp(s, base36alphabet), nil }
[ "func", "NewUUID36", "(", ")", "(", "string", ",", "error", ")", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "16", ")", "\n", "_", ",", "err", ":=", "randSource", ".", "Read", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// NewUUID36 returns a base-36 UUID with no dashes.
[ "NewUUID36", "returns", "a", "base", "-", "36", "UUID", "with", "no", "dashes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/uuid.go#L82-L90
139,607
control-center/serviced
utils/uuid.go
intLength
func intLength(bits, base int) int { return int(math.Ceil(float64(bits) * math.Log10(2.0) / math.Log10(float64(base)))) }
go
func intLength(bits, base int) int { return int(math.Ceil(float64(bits) * math.Log10(2.0) / math.Log10(float64(base)))) }
[ "func", "intLength", "(", "bits", ",", "base", "int", ")", "int", "{", "return", "int", "(", "math", ".", "Ceil", "(", "float64", "(", "bits", ")", "*", "math", ".", "Log10", "(", "2.0", ")", "/", "math", ".", "Log10", "(", "float64", "(", "base"...
// intLength returns the length of a integer represented by the given // bits in the given base.
[ "intLength", "returns", "the", "length", "of", "a", "integer", "represented", "by", "the", "given", "bits", "in", "the", "given", "base", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/uuid.go#L94-L96
139,608
control-center/serviced
utils/uuid.go
ConvertUp
func ConvertUp(oldNumber string, baseAlphabet string) string { n := big.NewInt(0) n.SetString(oldNumber, 16) base := big.NewInt(int64(len(baseAlphabet))) newNumber := make([]byte, intLength(16*8, len(baseAlphabet))) i := len(newNumber) for n.Int64() != 0 { i-- _, r := n.DivMod(n, base, big.NewInt(0)) new...
go
func ConvertUp(oldNumber string, baseAlphabet string) string { n := big.NewInt(0) n.SetString(oldNumber, 16) base := big.NewInt(int64(len(baseAlphabet))) newNumber := make([]byte, intLength(16*8, len(baseAlphabet))) i := len(newNumber) for n.Int64() != 0 { i-- _, r := n.DivMod(n, base, big.NewInt(0)) new...
[ "func", "ConvertUp", "(", "oldNumber", "string", ",", "baseAlphabet", "string", ")", "string", "{", "n", ":=", "big", ".", "NewInt", "(", "0", ")", "\n", "n", ".", "SetString", "(", "oldNumber", ",", "16", ")", "\n\n", "base", ":=", "big", ".", "NewI...
// ConvertUp converts a hexadecimal UUID string to a base alphabet greater than 16.
[ "ConvertUp", "converts", "a", "hexadecimal", "UUID", "string", "to", "a", "base", "alphabet", "greater", "than", "16", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/uuid.go#L99-L114
139,609
control-center/serviced
stats/servicedstatsreporter.go
NewServicedStatsReporter
func NewServicedStatsReporter(destination string, interval time.Duration, conn coordclient.Connection, dockerClient docker.Docker) (*ServicedStatsReporter, error) { hostID, err := utils.HostID() if err != nil { plog.WithError(err).Debug("Could not determine host ID") return nil, err } if conn == nil { plog.De...
go
func NewServicedStatsReporter(destination string, interval time.Duration, conn coordclient.Connection, dockerClient docker.Docker) (*ServicedStatsReporter, error) { hostID, err := utils.HostID() if err != nil { plog.WithError(err).Debug("Could not determine host ID") return nil, err } if conn == nil { plog.De...
[ "func", "NewServicedStatsReporter", "(", "destination", "string", ",", "interval", "time", ".", "Duration", ",", "conn", "coordclient", ".", "Connection", ",", "dockerClient", "docker", ".", "Docker", ")", "(", "*", "ServicedStatsReporter", ",", "error", ")", "{...
// NewServicedStatsReporter creates a new ServicedStatsReporter and kicks off the reporting goroutine.
[ "NewServicedStatsReporter", "creates", "a", "new", "ServicedStatsReporter", "and", "kicks", "off", "the", "reporting", "goroutine", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/stats/servicedstatsreporter.go#L51-L78
139,610
control-center/serviced
stats/servicedstatsreporter.go
getOrCreateContainerRegistry
func (sr *ServicedStatsReporter) getOrCreateContainerRegistry(serviceID string, instanceID int) metrics.Registry { key := registryKey{serviceID, instanceID} if registry, ok := sr.containerRegistries[key]; ok { return registry } sr.Lock() defer sr.Unlock() sr.containerRegistries[key] = metrics.NewRegistry() ret...
go
func (sr *ServicedStatsReporter) getOrCreateContainerRegistry(serviceID string, instanceID int) metrics.Registry { key := registryKey{serviceID, instanceID} if registry, ok := sr.containerRegistries[key]; ok { return registry } sr.Lock() defer sr.Unlock() sr.containerRegistries[key] = metrics.NewRegistry() ret...
[ "func", "(", "sr", "*", "ServicedStatsReporter", ")", "getOrCreateContainerRegistry", "(", "serviceID", "string", ",", "instanceID", "int", ")", "metrics", ".", "Registry", "{", "key", ":=", "registryKey", "{", "serviceID", ",", "instanceID", "}", "\n", "if", ...
// getOrCreateContainerRegistry returns a registry for a given service id or creates it // if it doesn't exist.
[ "getOrCreateContainerRegistry", "returns", "a", "registry", "for", "a", "given", "service", "id", "or", "creates", "it", "if", "it", "doesn", "t", "exist", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/stats/servicedstatsreporter.go#L82-L91
139,611
control-center/serviced
cli/api/shell.go
getServiceBindMounts
func getServiceBindMounts(lbClientPort string, serviceID string) (map[string]string, error) { log := log.WithFields(logrus.Fields{ "address": lbClientPort, "serviceid": serviceID, }) client, err := node.NewLBClient(lbClientPort) if err != nil { log.WithError(err).Error("Unable to connect to RPC server") r...
go
func getServiceBindMounts(lbClientPort string, serviceID string) (map[string]string, error) { log := log.WithFields(logrus.Fields{ "address": lbClientPort, "serviceid": serviceID, }) client, err := node.NewLBClient(lbClientPort) if err != nil { log.WithError(err).Error("Unable to connect to RPC server") r...
[ "func", "getServiceBindMounts", "(", "lbClientPort", "string", ",", "serviceID", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "log", ":=", "log", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", ...
// getServiceBindMounts retrieves a service's bindmounts
[ "getServiceBindMounts", "retrieves", "a", "service", "s", "bindmounts" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/shell.go#L50-L76
139,612
control-center/serviced
cli/api/shell.go
StartShell
func (a *api) StartShell(config ShellConfig) error { mounts, err := buildMounts(config.ServicedEndpoint, config.ServiceID, config.Mounts) if err != nil { return err } command := append([]string{config.Command}, config.Args...) cfg := shell.ProcessConfig{ ServiceID: config.ServiceID, IsTTY: config.IsTTY...
go
func (a *api) StartShell(config ShellConfig) error { mounts, err := buildMounts(config.ServicedEndpoint, config.ServiceID, config.Mounts) if err != nil { return err } command := append([]string{config.Command}, config.Args...) cfg := shell.ProcessConfig{ ServiceID: config.ServiceID, IsTTY: config.IsTTY...
[ "func", "(", "a", "*", "api", ")", "StartShell", "(", "config", "ShellConfig", ")", "error", "{", "mounts", ",", "err", ":=", "buildMounts", "(", "config", ".", "ServicedEndpoint", ",", "config", ".", "ServiceID", ",", "config", ".", "Mounts", ")", "\n",...
// StartShell runs a command for a given service
[ "StartShell", "runs", "a", "command", "for", "a", "given", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/shell.go#L107-L133
139,613
control-center/serviced
cli/api/portmap.go
Set
func (m *PortMap) Set(value string) error { parts := strings.Split(value, ":") if len(parts) != 3 { return fmt.Errorf("bad format: %s; must be PROTOCOL:PORTNUM:PORTNAME", value) } protocol := parts[0] switch protocol { case "tcp", "udp": default: return fmt.Errorf("unsupported protocol: %s (udp|tcp)", protoc...
go
func (m *PortMap) Set(value string) error { parts := strings.Split(value, ":") if len(parts) != 3 { return fmt.Errorf("bad format: %s; must be PROTOCOL:PORTNUM:PORTNAME", value) } protocol := parts[0] switch protocol { case "tcp", "udp": default: return fmt.Errorf("unsupported protocol: %s (udp|tcp)", protoc...
[ "func", "(", "m", "*", "PortMap", ")", "Set", "(", "value", "string", ")", "error", "{", "parts", ":=", "strings", ".", "Split", "(", "value", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "!=", "3", "{", "return", "fmt", ".", "Er...
// Set converts a port mapping string from the command line to a PortMap object
[ "Set", "converts", "a", "port", "mapping", "string", "from", "the", "command", "line", "to", "a", "PortMap", "object" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/portmap.go#L28-L50
139,614
control-center/serviced
cli/cmd/publicendpoint.go
cmdPublicEndpointsListAll
func (c *ServicedCli) cmdPublicEndpointsListAll(ctx *cli.Context) { // If they specify only vhosts/ports, return those. If they didn't specify // either then both are returned. cmdPublicEndpointsList( c, ctx, ctx.Bool("vhosts") || (!ctx.Bool("vhosts") && !ctx.Bool("ports")), ctx.Bool("ports") || (!ctx.Bool(...
go
func (c *ServicedCli) cmdPublicEndpointsListAll(ctx *cli.Context) { // If they specify only vhosts/ports, return those. If they didn't specify // either then both are returned. cmdPublicEndpointsList( c, ctx, ctx.Bool("vhosts") || (!ctx.Bool("vhosts") && !ctx.Bool("ports")), ctx.Bool("ports") || (!ctx.Bool(...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdPublicEndpointsListAll", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "// If they specify only vhosts/ports, return those. If they didn't specify", "// either then both are returned.", "cmdPublicEndpointsList", "(", "c", ",...
// serviced service public-endpoints
[ "serviced", "service", "public", "-", "endpoints" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/publicendpoint.go#L53-L62
139,615
control-center/serviced
cli/cmd/publicendpoint.go
createPublicEndpoints
func (c *ServicedCli) createPublicEndpoints(ctx *cli.Context, services []service.Service, showVHosts bool, showPorts bool) ([]PublicEndpoint, error) { publicEndpoints := []PublicEndpoint{} // See if they provided the endpoint name epName := "" epFound := false if len(ctx.Args()) > 1 { epName = ctx.Args()[1] }...
go
func (c *ServicedCli) createPublicEndpoints(ctx *cli.Context, services []service.Service, showVHosts bool, showPorts bool) ([]PublicEndpoint, error) { publicEndpoints := []PublicEndpoint{} // See if they provided the endpoint name epName := "" epFound := false if len(ctx.Args()) > 1 { epName = ctx.Args()[1] }...
[ "func", "(", "c", "*", "ServicedCli", ")", "createPublicEndpoints", "(", "ctx", "*", "cli", ".", "Context", ",", "services", "[", "]", "service", ".", "Service", ",", "showVHosts", "bool", ",", "showPorts", "bool", ")", "(", "[", "]", "PublicEndpoint", "...
// Create a unified list of vhosts and port based public endpoints.
[ "Create", "a", "unified", "list", "of", "vhosts", "and", "port", "based", "public", "endpoints", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/publicendpoint.go#L178-L240
139,616
control-center/serviced
facade/pendingdeployment.go
NewPendingDeployment
func NewPendingDeployment(deploymentID, templateID, poolID string) PendingDeployment { return PendingDeployment{ status: utils.NewValueChangePublisher("Starting"), templateID: templateID, deploymentID: deploymentID, poolID: poolID, mutex: sync.RWMutex{}, } }
go
func NewPendingDeployment(deploymentID, templateID, poolID string) PendingDeployment { return PendingDeployment{ status: utils.NewValueChangePublisher("Starting"), templateID: templateID, deploymentID: deploymentID, poolID: poolID, mutex: sync.RWMutex{}, } }
[ "func", "NewPendingDeployment", "(", "deploymentID", ",", "templateID", ",", "poolID", "string", ")", "PendingDeployment", "{", "return", "PendingDeployment", "{", "status", ":", "utils", ".", "NewValueChangePublisher", "(", "\"", "\"", ")", ",", "templateID", ":"...
// NewPendingDeployment returns a new PendingDeployment object.
[ "NewPendingDeployment", "returns", "a", "new", "PendingDeployment", "object", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L41-L49
139,617
control-center/serviced
facade/pendingdeployment.go
UpdateStatus
func (d *PendingDeployment) UpdateStatus(status string) { d.mutex.Lock() defer d.mutex.Unlock() d.status.Set(status) }
go
func (d *PendingDeployment) UpdateStatus(status string) { d.mutex.Lock() defer d.mutex.Unlock() d.status.Set(status) }
[ "func", "(", "d", "*", "PendingDeployment", ")", "UpdateStatus", "(", "status", "string", ")", "{", "d", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mutex", ".", "Unlock", "(", ")", "\n", "d", ".", "status", ".", "Set", "(", "s...
// UpdateStatus updates the status of a PendingDeployment.
[ "UpdateStatus", "updates", "the", "status", "of", "a", "PendingDeployment", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L52-L56
139,618
control-center/serviced
facade/pendingdeployment.go
SetTemplateName
func (d *PendingDeployment) SetTemplateName(name string) { d.mutex.Lock() defer d.mutex.Unlock() d.templateName = name }
go
func (d *PendingDeployment) SetTemplateName(name string) { d.mutex.Lock() defer d.mutex.Unlock() d.templateName = name }
[ "func", "(", "d", "*", "PendingDeployment", ")", "SetTemplateName", "(", "name", "string", ")", "{", "d", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mutex", ".", "Unlock", "(", ")", "\n", "d", ".", "templateName", "=", "name", "...
// SetTemplateName sets the template name of a PendingDeployment.
[ "SetTemplateName", "sets", "the", "template", "name", "of", "a", "PendingDeployment", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L59-L63
139,619
control-center/serviced
facade/pendingdeployment.go
GetStatus
func (d *PendingDeployment) GetStatus() (string, <-chan struct{}) { // mutex lock not necessary; d.status.Get is protected status, notify := d.status.Get() return status.(string), notify }
go
func (d *PendingDeployment) GetStatus() (string, <-chan struct{}) { // mutex lock not necessary; d.status.Get is protected status, notify := d.status.Get() return status.(string), notify }
[ "func", "(", "d", "*", "PendingDeployment", ")", "GetStatus", "(", ")", "(", "string", ",", "<-", "chan", "struct", "{", "}", ")", "{", "// mutex lock not necessary; d.status.Get is protected", "status", ",", "notify", ":=", "d", ".", "status", ".", "Get", "...
// GetStatus returns the current status of a PendingDeployment and a // channel which will be closewhen the status changes.
[ "GetStatus", "returns", "the", "current", "status", "of", "a", "PendingDeployment", "and", "a", "channel", "which", "will", "be", "closewhen", "the", "status", "changes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L67-L71
139,620
control-center/serviced
facade/pendingdeployment.go
GetInfo
func (d *PendingDeployment) GetInfo() map[string]string { d.mutex.RLock() defer d.mutex.RUnlock() status, _ := d.status.Get() return map[string]string{ "TemplateID": d.templateID, "templateName": d.templateName, "PoolID": d.poolID, "DeploymentID": d.deploymentID, "status": status.(string), ...
go
func (d *PendingDeployment) GetInfo() map[string]string { d.mutex.RLock() defer d.mutex.RUnlock() status, _ := d.status.Get() return map[string]string{ "TemplateID": d.templateID, "templateName": d.templateName, "PoolID": d.poolID, "DeploymentID": d.deploymentID, "status": status.(string), ...
[ "func", "(", "d", "*", "PendingDeployment", ")", "GetInfo", "(", ")", "map", "[", "string", "]", "string", "{", "d", ".", "mutex", ".", "RLock", "(", ")", "\n", "defer", "d", ".", "mutex", ".", "RUnlock", "(", ")", "\n", "status", ",", "_", ":=",...
// GetInfo returns all information about a pending deployment in the // form of a map, appropriate for json serialization.
[ "GetInfo", "returns", "all", "information", "about", "a", "pending", "deployment", "in", "the", "form", "of", "a", "map", "appropriate", "for", "json", "serialization", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L75-L86
139,621
control-center/serviced
facade/pendingdeployment.go
NewPendingDeploymentMgr
func NewPendingDeploymentMgr() *PendingDeploymentMgr { return &PendingDeploymentMgr{ deployments: make(map[string]*PendingDeployment), mutex: sync.RWMutex{}, } }
go
func NewPendingDeploymentMgr() *PendingDeploymentMgr { return &PendingDeploymentMgr{ deployments: make(map[string]*PendingDeployment), mutex: sync.RWMutex{}, } }
[ "func", "NewPendingDeploymentMgr", "(", ")", "*", "PendingDeploymentMgr", "{", "return", "&", "PendingDeploymentMgr", "{", "deployments", ":", "make", "(", "map", "[", "string", "]", "*", "PendingDeployment", ")", ",", "mutex", ":", "sync", ".", "RWMutex", "{"...
// NewPendingDeploymentMgr returns a new PendingDeploymentMgr
[ "NewPendingDeploymentMgr", "returns", "a", "new", "PendingDeploymentMgr" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L96-L101
139,622
control-center/serviced
facade/pendingdeployment.go
NewPendingDeployment
func (dm *PendingDeploymentMgr) NewPendingDeployment(deploymentID, templateID, poolID string) (*PendingDeployment, error) { dm.mutex.Lock() defer dm.mutex.Unlock() if _, ok := dm.deployments[deploymentID]; ok { return nil, ErrPendingDeploymentConflict } deployment := NewPendingDeployment(deploymentID, templateID...
go
func (dm *PendingDeploymentMgr) NewPendingDeployment(deploymentID, templateID, poolID string) (*PendingDeployment, error) { dm.mutex.Lock() defer dm.mutex.Unlock() if _, ok := dm.deployments[deploymentID]; ok { return nil, ErrPendingDeploymentConflict } deployment := NewPendingDeployment(deploymentID, templateID...
[ "func", "(", "dm", "*", "PendingDeploymentMgr", ")", "NewPendingDeployment", "(", "deploymentID", ",", "templateID", ",", "poolID", "string", ")", "(", "*", "PendingDeployment", ",", "error", ")", "{", "dm", ".", "mutex", ".", "Lock", "(", ")", "\n", "defe...
// NewPendingDeployment allocates a new PendingDeployment with the given attributes // and associates it with the PendingDeploymentMgr
[ "NewPendingDeployment", "allocates", "a", "new", "PendingDeployment", "with", "the", "given", "attributes", "and", "associates", "it", "with", "the", "PendingDeploymentMgr" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L105-L114
139,623
control-center/serviced
facade/pendingdeployment.go
GetPendingDeployment
func (dm *PendingDeploymentMgr) GetPendingDeployment(deploymentID string) *PendingDeployment { dm.mutex.RLock() defer dm.mutex.RUnlock() return dm.deployments[deploymentID] }
go
func (dm *PendingDeploymentMgr) GetPendingDeployment(deploymentID string) *PendingDeployment { dm.mutex.RLock() defer dm.mutex.RUnlock() return dm.deployments[deploymentID] }
[ "func", "(", "dm", "*", "PendingDeploymentMgr", ")", "GetPendingDeployment", "(", "deploymentID", "string", ")", "*", "PendingDeployment", "{", "dm", ".", "mutex", ".", "RLock", "(", ")", "\n", "defer", "dm", ".", "mutex", ".", "RUnlock", "(", ")", "\n", ...
// GetPendingDeployment returns the PendingDeployment associated with the // given deploymentID if one exists; nil otherwise.
[ "GetPendingDeployment", "returns", "the", "PendingDeployment", "associated", "with", "the", "given", "deploymentID", "if", "one", "exists", ";", "nil", "otherwise", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L118-L122
139,624
control-center/serviced
facade/pendingdeployment.go
DeletePendingDeployment
func (dm *PendingDeploymentMgr) DeletePendingDeployment(deploymentID string) { dm.mutex.Lock() delete(dm.deployments, deploymentID) dm.mutex.Unlock() }
go
func (dm *PendingDeploymentMgr) DeletePendingDeployment(deploymentID string) { dm.mutex.Lock() delete(dm.deployments, deploymentID) dm.mutex.Unlock() }
[ "func", "(", "dm", "*", "PendingDeploymentMgr", ")", "DeletePendingDeployment", "(", "deploymentID", "string", ")", "{", "dm", ".", "mutex", ".", "Lock", "(", ")", "\n", "delete", "(", "dm", ".", "deployments", ",", "deploymentID", ")", "\n", "dm", ".", ...
// DeletePendingDeployment removes the PendingDeployment associated with the // given deploymentID from the PendingDeploymentMgr.
[ "DeletePendingDeployment", "removes", "the", "PendingDeployment", "associated", "with", "the", "given", "deploymentID", "from", "the", "PendingDeploymentMgr", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pendingdeployment.go#L126-L130
139,625
control-center/serviced
zzk/service/selection.go
Select
func (s *RandomHostSelectionStrategy) Select(hosts []h.Host) (h.Host, error) { n := len(hosts) if n == 0 { return h.Host{}, ErrNoHosts } return hosts[rand.Intn(n)], nil }
go
func (s *RandomHostSelectionStrategy) Select(hosts []h.Host) (h.Host, error) { n := len(hosts) if n == 0 { return h.Host{}, ErrNoHosts } return hosts[rand.Intn(n)], nil }
[ "func", "(", "s", "*", "RandomHostSelectionStrategy", ")", "Select", "(", "hosts", "[", "]", "h", ".", "Host", ")", "(", "h", ".", "Host", ",", "error", ")", "{", "n", ":=", "len", "(", "hosts", ")", "\n", "if", "n", "==", "0", "{", "return", "...
// Select will randomly pick of the provided hosts. If no hosts are given, // ErrNoHosts will be returned.
[ "Select", "will", "randomly", "pick", "of", "the", "provided", "hosts", ".", "If", "no", "hosts", "are", "given", "ErrNoHosts", "will", "be", "returned", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/selection.go#L36-L42
139,626
control-center/serviced
logging/hooks.go
Fire
func (hook ContextHook) Fire(entry *logrus.Entry) error { pc := make([]uintptr, 3, 3) count := runtime.Callers(6, pc) for i := 0; i < count; i++ { fu := runtime.FuncForPC(pc[i] - 1) name := fu.Name() if strings.HasPrefix(name, prefix) && !strings.HasPrefix(name, vendorprefix) { file, line := fu.FileLine(pc[...
go
func (hook ContextHook) Fire(entry *logrus.Entry) error { pc := make([]uintptr, 3, 3) count := runtime.Callers(6, pc) for i := 0; i < count; i++ { fu := runtime.FuncForPC(pc[i] - 1) name := fu.Name() if strings.HasPrefix(name, prefix) && !strings.HasPrefix(name, vendorprefix) { file, line := fu.FileLine(pc[...
[ "func", "(", "hook", "ContextHook", ")", "Fire", "(", "entry", "*", "logrus", ".", "Entry", ")", "error", "{", "pc", ":=", "make", "(", "[", "]", "uintptr", ",", "3", ",", "3", ")", "\n", "count", ":=", "runtime", ".", "Callers", "(", "6", ",", ...
// Fire satisfies the logrus.Hook interface. This impl figures out the file and // line number of the caller and adds them to the data.
[ "Fire", "satisfies", "the", "logrus", ".", "Hook", "interface", ".", "This", "impl", "figures", "out", "the", "file", "and", "line", "number", "of", "the", "caller", "and", "adds", "them", "to", "the", "data", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/logging/hooks.go#L27-L40
139,627
control-center/serviced
utils/sysctl.go
SetSysctl
func SetSysctl(key string, value string) ([]byte, error) { command := []string{"/sbin/sysctl", "-w", fmt.Sprintf("%s=%s", key, value)} thecmd := exec.Command(command[0], command[1:]...) output, err := thecmd.CombinedOutput() if err != nil { glog.Errorf("Error running command:'%s' output: %s error: %s\n", command...
go
func SetSysctl(key string, value string) ([]byte, error) { command := []string{"/sbin/sysctl", "-w", fmt.Sprintf("%s=%s", key, value)} thecmd := exec.Command(command[0], command[1:]...) output, err := thecmd.CombinedOutput() if err != nil { glog.Errorf("Error running command:'%s' output: %s error: %s\n", command...
[ "func", "SetSysctl", "(", "key", "string", ",", "value", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "command", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key...
// SetSysctl tries to set sysctl settings
[ "SetSysctl", "tries", "to", "set", "sysctl", "settings" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/sysctl.go#L25-L39
139,628
control-center/serviced
domain/pool/pool.go
Equals
func (a *ResourcePool) Equals(b *ResourcePool) bool { if a.ID != b.ID { return false } if a.Realm != b.Realm { return false } if a.Description != b.Description { return false } if !a.VirtualIPsEqual(b) { return false } if a.CoreLimit != b.CoreLimit { return false } if a.MemoryLimit != b.MemoryLimit...
go
func (a *ResourcePool) Equals(b *ResourcePool) bool { if a.ID != b.ID { return false } if a.Realm != b.Realm { return false } if a.Description != b.Description { return false } if !a.VirtualIPsEqual(b) { return false } if a.CoreLimit != b.CoreLimit { return false } if a.MemoryLimit != b.MemoryLimit...
[ "func", "(", "a", "*", "ResourcePool", ")", "Equals", "(", "b", "*", "ResourcePool", ")", "bool", "{", "if", "a", ".", "ID", "!=", "b", ".", "ID", "{", "return", "false", "\n", "}", "\n", "if", "a", ".", "Realm", "!=", "b", ".", "Realm", "{", ...
// Equal returns true if two resource pools are equal
[ "Equal", "returns", "true", "if", "two", "resource", "pools", "are", "equal" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/pool/pool.go#L100-L139
139,629
control-center/serviced
domain/pool/pool.go
New
func New(id string) *ResourcePool { pool := &ResourcePool{} pool.ID = id return pool }
go
func New(id string) *ResourcePool { pool := &ResourcePool{} pool.ID = id return pool }
[ "func", "New", "(", "id", "string", ")", "*", "ResourcePool", "{", "pool", ":=", "&", "ResourcePool", "{", "}", "\n", "pool", ".", "ID", "=", "id", "\n\n", "return", "pool", "\n", "}" ]
// New creates new ResourcePool
[ "New", "creates", "new", "ResourcePool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/pool/pool.go#L142-L147
139,630
control-center/serviced
commons/docker/api.go
FindContainer
func FindContainer(id string) (*Container, error) { dc, err := getDockerClient() if err != nil { return nil, err } ctr, err := dc.InspectContainer(id) if err != nil { if _, ok := err.(*dockerclient.NoSuchContainer); ok { return nil, ErrNoSuchContainer } return nil, err } return &Container{ctr}, nil }
go
func FindContainer(id string) (*Container, error) { dc, err := getDockerClient() if err != nil { return nil, err } ctr, err := dc.InspectContainer(id) if err != nil { if _, ok := err.(*dockerclient.NoSuchContainer); ok { return nil, ErrNoSuchContainer } return nil, err } return &Container{ctr}, nil }
[ "func", "FindContainer", "(", "id", "string", ")", "(", "*", "Container", ",", "error", ")", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ctr", ",", ...
// FindContainer looks up a container using its id or name.
[ "FindContainer", "looks", "up", "a", "container", "using", "its", "id", "or", "name", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L206-L220
139,631
control-center/serviced
commons/docker/api.go
Logs
func Logs(dockerID string, args []string) error { if _, err := FindContainer(dockerID); err != nil { return err } var command []string = []string{"/usr/bin/docker", "logs"} if len(args) > 0 { command = append(command, args...) } command = append(command, dockerID) glog.V(1).Infof("exec logs command for con...
go
func Logs(dockerID string, args []string) error { if _, err := FindContainer(dockerID); err != nil { return err } var command []string = []string{"/usr/bin/docker", "logs"} if len(args) > 0 { command = append(command, args...) } command = append(command, dockerID) glog.V(1).Infof("exec logs command for con...
[ "func", "Logs", "(", "dockerID", "string", ",", "args", "[", "]", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "FindContainer", "(", "dockerID", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "var", "command", "...
// Logs calls docker logs for a running service container
[ "Logs", "calls", "docker", "logs", "for", "a", "running", "service", "container" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L223-L236
139,632
control-center/serviced
commons/docker/api.go
Containers
func Containers() ([]*Container, error) { dc, err := getDockerClient() if err != nil { return nil, err } apictrs, err := dc.ListContainers(dockerclient.ListContainersOptions{All: true}) if err != nil { return nil, err } resp := []*Container{} for _, apictr := range apictrs { ctr, err := dc.InspectContaine...
go
func Containers() ([]*Container, error) { dc, err := getDockerClient() if err != nil { return nil, err } apictrs, err := dc.ListContainers(dockerclient.ListContainersOptions{All: true}) if err != nil { return nil, err } resp := []*Container{} for _, apictr := range apictrs { ctr, err := dc.InspectContaine...
[ "func", "Containers", "(", ")", "(", "[", "]", "*", "Container", ",", "error", ")", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "apictrs", ",", "err"...
// Containers retrieves a list of all the Docker containers.
[ "Containers", "retrieves", "a", "list", "of", "all", "the", "Docker", "containers", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L239-L257
139,633
control-center/serviced
commons/docker/api.go
CancelOnEvent
func (c *Container) CancelOnEvent(event string) error { return cancelOnContainerEvent(event, c.ID) }
go
func (c *Container) CancelOnEvent(event string) error { return cancelOnContainerEvent(event, c.ID) }
[ "func", "(", "c", "*", "Container", ")", "CancelOnEvent", "(", "event", "string", ")", "error", "{", "return", "cancelOnContainerEvent", "(", "event", ",", "c", ".", "ID", ")", "\n", "}" ]
// CancelOnEvent cancels the action associated with the specified event.
[ "CancelOnEvent", "cancels", "the", "action", "associated", "with", "the", "specified", "event", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L260-L262
139,634
control-center/serviced
commons/docker/api.go
Commit
func (c *Container) Commit(iidstr string, push bool) (*Image, error) { dc, err := getDockerClient() if err != nil { return nil, err } iid, err := commons.ParseImageID(iidstr) if err != nil { return nil, err } img, err := dc.CommitContainer( dockerclient.CommitContainerOptions{ Container: c.ID, Repo...
go
func (c *Container) Commit(iidstr string, push bool) (*Image, error) { dc, err := getDockerClient() if err != nil { return nil, err } iid, err := commons.ParseImageID(iidstr) if err != nil { return nil, err } img, err := dc.CommitContainer( dockerclient.CommitContainerOptions{ Container: c.ID, Repo...
[ "func", "(", "c", "*", "Container", ")", "Commit", "(", "iidstr", "string", ",", "push", "bool", ")", "(", "*", "Image", ",", "error", ")", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "...
// Commit creates a new Image from the containers changes.
[ "Commit", "creates", "a", "new", "Image", "from", "the", "containers", "changes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L265-L289
139,635
control-center/serviced
commons/docker/api.go
Delete
func (c *Container) Delete(volumes bool) error { dc, err := getDockerClient() if err != nil { return err } err = dc.RemoveContainer(dockerclient.RemoveContainerOptions{ID: c.ID, RemoveVolumes: volumes}) if _, ok := err.(*dockerclient.NoSuchContainer); ok { return ErrNoSuchContainer } return err }
go
func (c *Container) Delete(volumes bool) error { dc, err := getDockerClient() if err != nil { return err } err = dc.RemoveContainer(dockerclient.RemoveContainerOptions{ID: c.ID, RemoveVolumes: volumes}) if _, ok := err.(*dockerclient.NoSuchContainer); ok { return ErrNoSuchContainer } return err }
[ "func", "(", "c", "*", "Container", ")", "Delete", "(", "volumes", "bool", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "dc", ".", "Remo...
// Delete removes the container.
[ "Delete", "removes", "the", "container", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L292-L302
139,636
control-center/serviced
commons/docker/api.go
Export
func (c *Container) Export(outfile *os.File) error { dc, err := getDockerClient() if err != nil { return err } return dc.ExportContainer(dockerclient.ExportContainerOptions{c.ID, outfile}) }
go
func (c *Container) Export(outfile *os.File) error { dc, err := getDockerClient() if err != nil { return err } return dc.ExportContainer(dockerclient.ExportContainerOptions{c.ID, outfile}) }
[ "func", "(", "c", "*", "Container", ")", "Export", "(", "outfile", "*", "os", ".", "File", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "d...
// Export writes the contents of the container's filesystem as a tar archive to outfile.
[ "Export", "writes", "the", "contents", "of", "the", "container", "s", "filesystem", "as", "a", "tar", "archive", "to", "outfile", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L305-L311
139,637
control-center/serviced
commons/docker/api.go
Kill
func (c *Container) Kill() error { dc, err := getDockerClient() if err != nil { return err } return dc.KillContainer(dockerclient.KillContainerOptions{ID: c.ID, Signal: dockerclient.SIGKILL}) }
go
func (c *Container) Kill() error { dc, err := getDockerClient() if err != nil { return err } return dc.KillContainer(dockerclient.KillContainerOptions{ID: c.ID, Signal: dockerclient.SIGKILL}) }
[ "func", "(", "c", "*", "Container", ")", "Kill", "(", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "dc", ".", "KillContainer", "(", "dockerc...
// Kill sends a SIGKILL signal to the container. If the container is not started // no action is taken.
[ "Kill", "sends", "a", "SIGKILL", "signal", "to", "the", "container", ".", "If", "the", "container", "is", "not", "started", "no", "action", "is", "taken", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L315-L321
139,638
control-center/serviced
commons/docker/api.go
Inspect
func (c *Container) Inspect() (*dockerclient.Container, error) { dc, err := getDockerClient() if err != nil { return nil, err } return dc.InspectContainer(c.ID) }
go
func (c *Container) Inspect() (*dockerclient.Container, error) { dc, err := getDockerClient() if err != nil { return nil, err } return dc.InspectContainer(c.ID) }
[ "func", "(", "c", "*", "Container", ")", "Inspect", "(", ")", "(", "*", "dockerclient", ".", "Container", ",", "error", ")", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err",...
// Inspect returns information about the container specified by id.
[ "Inspect", "returns", "information", "about", "the", "container", "specified", "by", "id", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L324-L330
139,639
control-center/serviced
commons/docker/api.go
IsRunning
func (c *Container) IsRunning() bool { cc, err := c.Inspect() if err != nil { return false } return cc.State.Running }
go
func (c *Container) IsRunning() bool { cc, err := c.Inspect() if err != nil { return false } return cc.State.Running }
[ "func", "(", "c", "*", "Container", ")", "IsRunning", "(", ")", "bool", "{", "cc", ",", "err", ":=", "c", ".", "Inspect", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "return", "cc", ".", "State", ".", "R...
// IsRunning inspects the container and returns true if it is running
[ "IsRunning", "inspects", "the", "container", "and", "returns", "true", "if", "it", "is", "running" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L333-L340
139,640
control-center/serviced
commons/docker/api.go
OnEvent
func (c *Container) OnEvent(event string, action ContainerActionFunc) error { return onContainerEvent(event, c.ID, action) }
go
func (c *Container) OnEvent(event string, action ContainerActionFunc) error { return onContainerEvent(event, c.ID, action) }
[ "func", "(", "c", "*", "Container", ")", "OnEvent", "(", "event", "string", ",", "action", "ContainerActionFunc", ")", "error", "{", "return", "onContainerEvent", "(", "event", ",", "c", ".", "ID", ",", "action", ")", "\n", "}" ]
// OnEvent adds an action for the specified event.
[ "OnEvent", "adds", "an", "action", "for", "the", "specified", "event", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L343-L345
139,641
control-center/serviced
commons/docker/api.go
Restart
func (c *Container) Restart(timeout time.Duration) error { dc, err := getDockerClient() if err != nil { return err } return dc.RestartContainer(c.ID, uint(timeout.Seconds())) }
go
func (c *Container) Restart(timeout time.Duration) error { dc, err := getDockerClient() if err != nil { return err } return dc.RestartContainer(c.ID, uint(timeout.Seconds())) }
[ "func", "(", "c", "*", "Container", ")", "Restart", "(", "timeout", "time", ".", "Duration", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", ...
// Restart stops and then restarts a container.
[ "Restart", "stops", "and", "then", "restarts", "a", "container", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L348-L356
139,642
control-center/serviced
commons/docker/api.go
Stop
func (c *Container) Stop(timeout time.Duration) error { dc, err := getDockerClient() if err != nil { return err } return dc.StopContainer(c.ID, uint(timeout.Seconds())) }
go
func (c *Container) Stop(timeout time.Duration) error { dc, err := getDockerClient() if err != nil { return err } return dc.StopContainer(c.ID, uint(timeout.Seconds())) }
[ "func", "(", "c", "*", "Container", ")", "Stop", "(", "timeout", "time", ".", "Duration", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "dc",...
// Stop stops the container specified by the id. If the container can't be stopped before the timeout // expires an error is returned.
[ "Stop", "stops", "the", "container", "specified", "by", "the", "id", ".", "If", "the", "container", "can", "t", "be", "stopped", "before", "the", "timeout", "expires", "an", "error", "is", "returned", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L406-L412
139,643
control-center/serviced
commons/docker/api.go
Wait
func (c *Container) Wait(timeout time.Duration) (int, error) { dc, err := getDockerClient() if err != nil { return -127, err } type waitResult struct { rc int err error } errc := make(chan waitResult, 1) go func() { defer func() { if r := recover(); r != nil { var ok bool err, ok = r.(error)...
go
func (c *Container) Wait(timeout time.Duration) (int, error) { dc, err := getDockerClient() if err != nil { return -127, err } type waitResult struct { rc int err error } errc := make(chan waitResult, 1) go func() { defer func() { if r := recover(); r != nil { var ok bool err, ok = r.(error)...
[ "func", "(", "c", "*", "Container", ")", "Wait", "(", "timeout", "time", ".", "Duration", ")", "(", "int", ",", "error", ")", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "127", ","...
// Wait blocks until the container stops or the timeout expires and then returns its exit code.
[ "Wait", "blocks", "until", "the", "container", "stops", "or", "the", "timeout", "expires", "and", "then", "returns", "its", "exit", "code", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L415-L449
139,644
control-center/serviced
commons/docker/api.go
Images
func Images() ([]*Image, error) { dc, err := getDockerClient() if err != nil { return nil, err } opts := dockerclient.ListImagesOptions{All: false} imgs, err := dc.ListImages(opts) if err != nil { return nil, err } re := regexp.MustCompile("<none>:<none>") resp := []*Image{} for _, img := range imgs { ...
go
func Images() ([]*Image, error) { dc, err := getDockerClient() if err != nil { return nil, err } opts := dockerclient.ListImagesOptions{All: false} imgs, err := dc.ListImages(opts) if err != nil { return nil, err } re := regexp.MustCompile("<none>:<none>") resp := []*Image{} for _, img := range imgs { ...
[ "func", "Images", "(", ")", "(", "[", "]", "*", "Image", ",", "error", ")", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "opts", ":=", "dockerclient",...
// Images returns a list of all the named images in the local repository
[ "Images", "returns", "a", "list", "of", "all", "the", "named", "images", "in", "the", "local", "repository" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L458-L486
139,645
control-center/serviced
commons/docker/api.go
ImportImage
func ImportImage(repotag, filename string) error { dc, err := getDockerClient() if err != nil { return err } glog.V(1).Infof("importing image %s from %s", repotag, filename) f, err := os.Open(filename) if err != nil { return err } defer f.Close() iid, err := commons.ParseImageID(repotag) if err != nil { ...
go
func ImportImage(repotag, filename string) error { dc, err := getDockerClient() if err != nil { return err } glog.V(1).Infof("importing image %s from %s", repotag, filename) f, err := os.Open(filename) if err != nil { return err } defer f.Close() iid, err := commons.ParseImageID(repotag) if err != nil { ...
[ "func", "ImportImage", "(", "repotag", ",", "filename", "string", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "glog", ".", "V", "(", "1", ")", ".", ...
// ImportImage creates a new image in the local repository from a file system archive.
[ "ImportImage", "creates", "a", "new", "image", "in", "the", "local", "repository", "from", "a", "file", "system", "archive", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L489-L518
139,646
control-center/serviced
commons/docker/api.go
Delete
func (img *Image) Delete() error { dc, err := getDockerClient() if err != nil { return err } return dc.RemoveImage(img.ID.String()) }
go
func (img *Image) Delete() error { dc, err := getDockerClient() if err != nil { return err } return dc.RemoveImage(img.ID.String()) }
[ "func", "(", "img", "*", "Image", ")", "Delete", "(", ")", "error", "{", "dc", ",", "err", ":=", "getDockerClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "dc", ".", "RemoveImage", "(", "img", "...
// Delete remove the image from the local repository
[ "Delete", "remove", "the", "image", "from", "the", "local", "repository" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L533-L539
139,647
control-center/serviced
commons/docker/api.go
Tag
func (img *Image) Tag(tag string, push bool) (*Image, error) { iid, err := commons.ParseImageID(tag) if err != nil { return nil, err } dc, err := getDockerClient() if err != nil { return nil, err } args := struct { uuid string name string repo string registry string tag string ...
go
func (img *Image) Tag(tag string, push bool) (*Image, error) { iid, err := commons.ParseImageID(tag) if err != nil { return nil, err } dc, err := getDockerClient() if err != nil { return nil, err } args := struct { uuid string name string repo string registry string tag string ...
[ "func", "(", "img", "*", "Image", ")", "Tag", "(", "tag", "string", ",", "push", "bool", ")", "(", "*", "Image", ",", "error", ")", "{", "iid", ",", "err", ":=", "commons", ".", "ParseImageID", "(", "tag", ")", "\n", "if", "err", "!=", "nil", "...
// Tag tags an image in the local repository
[ "Tag", "tags", "an", "image", "in", "the", "local", "repository" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/docker/api.go#L542-L580
139,648
control-center/serviced
cli/api/servicemap.go
NewServiceMap
func NewServiceMap(services []service.ServiceDetails) ServiceMap { var smap = make(ServiceMap) for _, s := range services { smap.Add(s) } return smap }
go
func NewServiceMap(services []service.ServiceDetails) ServiceMap { var smap = make(ServiceMap) for _, s := range services { smap.Add(s) } return smap }
[ "func", "NewServiceMap", "(", "services", "[", "]", "service", ".", "ServiceDetails", ")", "ServiceMap", "{", "var", "smap", "=", "make", "(", "ServiceMap", ")", "\n", "for", "_", ",", "s", ":=", "range", "services", "{", "smap", ".", "Add", "(", "s", ...
// NewServiceMap creates a new service map from a slice of services
[ "NewServiceMap", "creates", "a", "new", "service", "map", "from", "a", "slice", "of", "services" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/servicemap.go#L26-L32
139,649
control-center/serviced
cli/api/servicemap.go
Add
func (m ServiceMap) Add(service service.ServiceDetails) error { if _, ok := m[service.ID]; ok { return fmt.Errorf("service already exists") } m[service.ID] = service return nil }
go
func (m ServiceMap) Add(service service.ServiceDetails) error { if _, ok := m[service.ID]; ok { return fmt.Errorf("service already exists") } m[service.ID] = service return nil }
[ "func", "(", "m", "ServiceMap", ")", "Add", "(", "service", "service", ".", "ServiceDetails", ")", "error", "{", "if", "_", ",", "ok", ":=", "m", "[", "service", ".", "ID", "]", ";", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")"...
// Add appends a service to the service map
[ "Add", "appends", "a", "service", "to", "the", "service", "map" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/servicemap.go#L38-L44
139,650
control-center/serviced
cli/api/servicemap.go
Update
func (m ServiceMap) Update(service service.ServiceDetails) { m[service.ID] = service }
go
func (m ServiceMap) Update(service service.ServiceDetails) { m[service.ID] = service }
[ "func", "(", "m", "ServiceMap", ")", "Update", "(", "service", "service", ".", "ServiceDetails", ")", "{", "m", "[", "service", ".", "ID", "]", "=", "service", "\n", "}" ]
// Update updates an existing service within the ServiceMap. If the service // not exist, it gets created.
[ "Update", "updates", "an", "existing", "service", "within", "the", "ServiceMap", ".", "If", "the", "service", "not", "exist", "it", "gets", "created", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/servicemap.go#L48-L50
139,651
control-center/serviced
cli/api/servicemap.go
Remove
func (m ServiceMap) Remove(serviceID string) error { if _, ok := m[serviceID]; !ok { return fmt.Errorf("service not found") } delete(m, serviceID) return nil }
go
func (m ServiceMap) Remove(serviceID string) error { if _, ok := m[serviceID]; !ok { return fmt.Errorf("service not found") } delete(m, serviceID) return nil }
[ "func", "(", "m", "ServiceMap", ")", "Remove", "(", "serviceID", "string", ")", "error", "{", "if", "_", ",", "ok", ":=", "m", "[", "serviceID", "]", ";", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "d...
// Remove removes a service from the service map
[ "Remove", "removes", "a", "service", "from", "the", "service", "map" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/servicemap.go#L53-L59
139,652
control-center/serviced
cli/api/servicemap.go
Tree
func (m ServiceMap) Tree() map[string][]string { tree := make(map[string][]string) for id, svc := range m { children := tree[svc.ParentServiceID] tree[svc.ParentServiceID] = append(children, id) } return tree }
go
func (m ServiceMap) Tree() map[string][]string { tree := make(map[string][]string) for id, svc := range m { children := tree[svc.ParentServiceID] tree[svc.ParentServiceID] = append(children, id) } return tree }
[ "func", "(", "m", "ServiceMap", ")", "Tree", "(", ")", "map", "[", "string", "]", "[", "]", "string", "{", "tree", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", "\n", "for", "id", ",", "svc", ":=", "range", "m", "{", ...
// Tree returns a map of parent services and its list of children
[ "Tree", "returns", "a", "map", "of", "parent", "services", "and", "its", "list", "of", "children" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/servicemap.go#L62-L69
139,653
control-center/serviced
zzk/service/assignment.go
NewZKAssignmentHandler
func NewZKAssignmentHandler(strategy HostSelectionStrategy, handler RegisteredHostHandler, connection client.Connection) *ZKAssignmentHandler { return &ZKAssignmentHandler{ hostSelectionStrategy: strategy, hostHandler: handler, connection: connection, mu: &sync.Mutex{}...
go
func NewZKAssignmentHandler(strategy HostSelectionStrategy, handler RegisteredHostHandler, connection client.Connection) *ZKAssignmentHandler { return &ZKAssignmentHandler{ hostSelectionStrategy: strategy, hostHandler: handler, connection: connection, mu: &sync.Mutex{}...
[ "func", "NewZKAssignmentHandler", "(", "strategy", "HostSelectionStrategy", ",", "handler", "RegisteredHostHandler", ",", "connection", "client", ".", "Connection", ")", "*", "ZKAssignmentHandler", "{", "return", "&", "ZKAssignmentHandler", "{", "hostSelectionStrategy", "...
// NewZKAssignmentHandler returns a new ZKAssignmentHandler with the provided // dependencies.
[ "NewZKAssignmentHandler", "returns", "a", "new", "ZKAssignmentHandler", "with", "the", "provided", "dependencies", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/assignment.go#L62-L73
139,654
control-center/serviced
zzk/service/assignment.go
Assign
func (h *ZKAssignmentHandler) Assign(poolID, ipAddress, netmask, binding string) error { _, err := h.getAssignedHostID(poolID, ipAddress) if err == ErrNoAssignedHost { return h.assignToHost(poolID, ipAddress, netmask, binding) } else if err == nil { return ErrAlreadyAssigned } return err }
go
func (h *ZKAssignmentHandler) Assign(poolID, ipAddress, netmask, binding string) error { _, err := h.getAssignedHostID(poolID, ipAddress) if err == ErrNoAssignedHost { return h.assignToHost(poolID, ipAddress, netmask, binding) } else if err == nil { return ErrAlreadyAssigned } return err }
[ "func", "(", "h", "*", "ZKAssignmentHandler", ")", "Assign", "(", "poolID", ",", "ipAddress", ",", "netmask", ",", "binding", "string", ")", "error", "{", "_", ",", "err", ":=", "h", ".", "getAssignedHostID", "(", "poolID", ",", "ipAddress", ")", "\n", ...
// Assign will assign the provided virtual IP to a host. If an IP is assigned to host there is a 10s timeout until that // IP can be assigned to the host again. This prevents spamming of errors. If a IP address is already assigned to a host, // ErrAlreadyAssigned will be returned. If no hosts are availd, ErrNoHosts w...
[ "Assign", "will", "assign", "the", "provided", "virtual", "IP", "to", "a", "host", ".", "If", "an", "IP", "is", "assigned", "to", "host", "there", "is", "a", "10s", "timeout", "until", "that", "IP", "can", "be", "assigned", "to", "the", "host", "again"...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/assignment.go#L78-L86
139,655
control-center/serviced
zzk/service/assignment.go
Unassign
func (h *ZKAssignmentHandler) Unassign(poolID, ipAddress string) error { assignedHost, err := h.getAssignedHostID(poolID, ipAddress) if err != nil { return err } plog.WithFields(log.Fields{ "poolid": poolID, "ipaddress": ipAddress, "host": assignedHost, }).Debug("Unassigning IP") request := IPRe...
go
func (h *ZKAssignmentHandler) Unassign(poolID, ipAddress string) error { assignedHost, err := h.getAssignedHostID(poolID, ipAddress) if err != nil { return err } plog.WithFields(log.Fields{ "poolid": poolID, "ipaddress": ipAddress, "host": assignedHost, }).Debug("Unassigning IP") request := IPRe...
[ "func", "(", "h", "*", "ZKAssignmentHandler", ")", "Unassign", "(", "poolID", ",", "ipAddress", "string", ")", "error", "{", "assignedHost", ",", "err", ":=", "h", ".", "getAssignedHostID", "(", "poolID", ",", "ipAddress", ")", "\n", "if", "err", "!=", "...
// Unassign will unassign a virtual IP if it is currently assigned to a host. ErrNoHostAssigned will be // returned if there is no host for the virtual IP when Unassign is called.
[ "Unassign", "will", "unassign", "a", "virtual", "IP", "if", "it", "is", "currently", "assigned", "to", "a", "host", ".", "ErrNoHostAssigned", "will", "be", "returned", "if", "there", "is", "no", "host", "for", "the", "virtual", "IP", "when", "Unassign", "i...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/assignment.go#L90-L104
139,656
control-center/serviced
datastore/datastore.go
Put
func (ds *DataStore) Put(ctx Context, key Key, entity ValidEntity) error { if ctx.Metrics().Enabled { defer ctx.Metrics().Stop(ctx.Metrics().Start(fmt.Sprintf("%s EntityStore.Put", key.Kind()))) } if ctx == nil { return ErrNilContext } if key == nil { return ErrNilKey } if entity == nil { return ErrNilEn...
go
func (ds *DataStore) Put(ctx Context, key Key, entity ValidEntity) error { if ctx.Metrics().Enabled { defer ctx.Metrics().Stop(ctx.Metrics().Start(fmt.Sprintf("%s EntityStore.Put", key.Kind()))) } if ctx == nil { return ErrNilContext } if key == nil { return ErrNilKey } if entity == nil { return ErrNilEn...
[ "func", "(", "ds", "*", "DataStore", ")", "Put", "(", "ctx", "Context", ",", "key", "Key", ",", "entity", "ValidEntity", ")", "error", "{", "if", "ctx", ".", "Metrics", "(", ")", ".", "Enabled", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", ...
// Put adds or updates an entity
[ "Put", "adds", "or", "updates", "an", "entity" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/datastore/datastore.go#L76-L106
139,657
control-center/serviced
datastore/datastore.go
Delete
func (ds *DataStore) Delete(ctx Context, key Key) error { if ctx.Metrics().Enabled { defer ctx.Metrics().Stop(ctx.Metrics().Start(fmt.Sprintf("%s EntityStore.Delete", key.Kind()))) } if ctx == nil { return ErrNilContext } if key == nil { return ErrNilKey } if err := validKey(key); err != nil { return err...
go
func (ds *DataStore) Delete(ctx Context, key Key) error { if ctx.Metrics().Enabled { defer ctx.Metrics().Stop(ctx.Metrics().Start(fmt.Sprintf("%s EntityStore.Delete", key.Kind()))) } if ctx == nil { return ErrNilContext } if key == nil { return ErrNilKey } if err := validKey(key); err != nil { return err...
[ "func", "(", "ds", "*", "DataStore", ")", "Delete", "(", "ctx", "Context", ",", "key", "Key", ")", "error", "{", "if", "ctx", ".", "Metrics", "(", ")", ".", "Enabled", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", ...
// Delete removes the entity
[ "Delete", "removes", "the", "entity" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/datastore/datastore.go#L140-L158
139,658
control-center/serviced
domain/properties/store.go
Get
func (s *storeImpl) Get(ctx datastore.Context) (*StoredProperties, error) { val := &StoredProperties{} if err := s.ds.Get(ctx, Key(propsID), val); err != nil { return nil, err } return val, nil }
go
func (s *storeImpl) Get(ctx datastore.Context) (*StoredProperties, error) { val := &StoredProperties{} if err := s.ds.Get(ctx, Key(propsID), val); err != nil { return nil, err } return val, nil }
[ "func", "(", "s", "*", "storeImpl", ")", "Get", "(", "ctx", "datastore", ".", "Context", ")", "(", "*", "StoredProperties", ",", "error", ")", "{", "val", ":=", "&", "StoredProperties", "{", "}", "\n", "if", "err", ":=", "s", ".", "ds", ".", "Get",...
// Get the single instance of StoredProperties. Return ErrNoSuchEntity if not found
[ "Get", "the", "single", "instance", "of", "StoredProperties", ".", "Return", "ErrNoSuchEntity", "if", "not", "found" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/properties/store.go#L40-L46
139,659
control-center/serviced
zzk/service/lock.go
ServiceLock
func ServiceLock(conn client.Connection) (client.Lock, error) { return conn.NewLock(zkServiceLock) }
go
func ServiceLock(conn client.Connection) (client.Lock, error) { return conn.NewLock(zkServiceLock) }
[ "func", "ServiceLock", "(", "conn", "client", ".", "Connection", ")", "(", "client", ".", "Lock", ",", "error", ")", "{", "return", "conn", ".", "NewLock", "(", "zkServiceLock", ")", "\n", "}" ]
// ServiceLock initializes a new lock for services
[ "ServiceLock", "initializes", "a", "new", "lock", "for", "services" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/lock.go#L48-L50
139,660
control-center/serviced
zzk/service/lock.go
IsServiceLocked
func IsServiceLocked(conn client.Connection) (bool, error) { locks, err := conn.Children(zkServiceLock) if err == client.ErrNoNode { return false, nil } return len(locks) > 0, err }
go
func IsServiceLocked(conn client.Connection) (bool, error) { locks, err := conn.Children(zkServiceLock) if err == client.ErrNoNode { return false, nil } return len(locks) > 0, err }
[ "func", "IsServiceLocked", "(", "conn", "client", ".", "Connection", ")", "(", "bool", ",", "error", ")", "{", "locks", ",", "err", ":=", "conn", ".", "Children", "(", "zkServiceLock", ")", "\n", "if", "err", "==", "client", ".", "ErrNoNode", "{", "ret...
// IsServiceLocked verifies whether services are locked
[ "IsServiceLocked", "verifies", "whether", "services", "are", "locked" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/lock.go#L53-L59
139,661
control-center/serviced
zzk/service/lock.go
Path
func (l ServiceLockNode) Path() string { return path.Join("/pools", l.PoolID, "/services", l.ServiceID) }
go
func (l ServiceLockNode) Path() string { return path.Join("/pools", l.PoolID, "/services", l.ServiceID) }
[ "func", "(", "l", "ServiceLockNode", ")", "Path", "(", ")", "string", "{", "return", "path", ".", "Join", "(", "\"", "\"", ",", "l", ".", "PoolID", ",", "\"", "\"", ",", "l", ".", "ServiceID", ")", "\n", "}" ]
// Path returns the path to the service
[ "Path", "returns", "the", "path", "to", "the", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/lock.go#L68-L70
139,662
control-center/serviced
zzk/service/lock.go
LockServices
func LockServices(conn client.Connection, svcs []ServiceLockNode) error { tx := conn.NewTransaction() for _, svc := range svcs { node, err := NewServiceNodeFromService(&service.Service{}) if err != nil { return NewLockServiceFailure(svc.ServiceID, svc.PoolID, err) } if err := conn.Get(svc.Path(), node); er...
go
func LockServices(conn client.Connection, svcs []ServiceLockNode) error { tx := conn.NewTransaction() for _, svc := range svcs { node, err := NewServiceNodeFromService(&service.Service{}) if err != nil { return NewLockServiceFailure(svc.ServiceID, svc.PoolID, err) } if err := conn.Get(svc.Path(), node); er...
[ "func", "LockServices", "(", "conn", "client", ".", "Connection", ",", "svcs", "[", "]", "ServiceLockNode", ")", "error", "{", "tx", ":=", "conn", ".", "NewTransaction", "(", ")", "\n", "for", "_", ",", "svc", ":=", "range", "svcs", "{", "node", ",", ...
// LockServices locks a group of services
[ "LockServices", "locks", "a", "group", "of", "services" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/lock.go#L73-L87
139,663
control-center/serviced
zzk/service/lock.go
UnlockServices
func UnlockServices(conn client.Connection, svcs []ServiceLockNode) error { tx := conn.NewTransaction() for _, svc := range svcs { node, err := NewServiceNodeFromService(&service.Service{}) if err != nil { return NewUnlockServiceFailure(svc.ServiceID, svc.PoolID, err) } if err := conn.Get(svc.Path(), node)...
go
func UnlockServices(conn client.Connection, svcs []ServiceLockNode) error { tx := conn.NewTransaction() for _, svc := range svcs { node, err := NewServiceNodeFromService(&service.Service{}) if err != nil { return NewUnlockServiceFailure(svc.ServiceID, svc.PoolID, err) } if err := conn.Get(svc.Path(), node)...
[ "func", "UnlockServices", "(", "conn", "client", ".", "Connection", ",", "svcs", "[", "]", "ServiceLockNode", ")", "error", "{", "tx", ":=", "conn", ".", "NewTransaction", "(", ")", "\n", "for", "_", ",", "svc", ":=", "range", "svcs", "{", "node", ",",...
// UnlockServices unlocks a group of services
[ "UnlockServices", "unlocks", "a", "group", "of", "services" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/lock.go#L90-L106
139,664
control-center/serviced
web/poolresource.go
restGetPool
func restGetPool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for PUT")) return } facade := ctx.getFa...
go
func restGetPool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for PUT")) return } facade := ctx.getFa...
[ "func", "restGetPool", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "poolID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", "...
//restGetPool retrieves a Resource Pools. Response is ResourcePool
[ "restGetPool", "retrieves", "a", "Resource", "Pools", ".", "Response", "is", "ResourcePool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/poolresource.go#L51-L83
139,665
control-center/serviced
web/poolresource.go
restAddPool
func restAddPool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { var payload pool.ResourcePool err := r.DecodeJsonPayload(&payload) if err != nil { glog.V(1).Info("Could not decode pool payload: ", err) restBadRequest(w, err) return } facade := ctx.getFacade() err = facade.AddResourcePool(c...
go
func restAddPool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { var payload pool.ResourcePool err := r.DecodeJsonPayload(&payload) if err != nil { glog.V(1).Info("Could not decode pool payload: ", err) restBadRequest(w, err) return } facade := ctx.getFacade() err = facade.AddResourcePool(c...
[ "func", "restAddPool", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "var", "payload", "pool", ".", "ResourcePool", "\n", "err", ":=", "r", ".", "DecodeJsonPayload", "(",...
//restAddPool add a resource pool. Request input is pool.ResourcePool
[ "restAddPool", "add", "a", "resource", "pool", ".", "Request", "input", "is", "pool", ".", "ResourcePool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/poolresource.go#L86-L105
139,666
control-center/serviced
web/poolresource.go
restUpdatePool
func restUpdatePool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for PUT")) return } var payload pool...
go
func restUpdatePool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for PUT")) return } var payload pool...
[ "func", "restUpdatePool", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "poolID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", ...
//restUpdatePool updates a resource pool. Request input is pool.ResourcePool
[ "restUpdatePool", "updates", "a", "resource", "pool", ".", "Request", "input", "is", "pool", ".", "ResourcePool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/poolresource.go#L108-L135
139,667
control-center/serviced
web/poolresource.go
restRemovePool
func restRemovePool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for DELETE")) return } facade := ctx...
go
func restRemovePool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for DELETE")) return } facade := ctx...
[ "func", "restRemovePool", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "poolID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", ...
//restRemovePool removes a resource pool using pool-id
[ "restRemovePool", "removes", "a", "resource", "pool", "using", "pool", "-", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/poolresource.go#L138-L157
139,668
control-center/serviced
web/poolresource.go
restGetPoolIps
func restGetPoolIps(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for GET")) return } facade := ctx.ge...
go
func restGetPoolIps(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { poolID, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { restBadRequest(w, err) return } else if len(poolID) == 0 { restBadRequest(w, fmt.Errorf("poolID must be specified for GET")) return } facade := ctx.ge...
[ "func", "restGetPoolIps", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "poolID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", ...
//restGetPoolIps retrieves a Resource Pools. Response is ResourcePool
[ "restGetPoolIps", "retrieves", "a", "Resource", "Pools", ".", "Response", "is", "ResourcePool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/poolresource.go#L192-L212
139,669
control-center/serviced
domain/service/servicedetails_store.go
GetServiceDetails
func (s *storeImpl) GetServiceDetails(ctx datastore.Context, serviceID string) (*ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetails")) id := strings.TrimSpace(serviceID) if id == "" { return nil, errors.New("empty service id not allowed") } searchRequest := new...
go
func (s *storeImpl) GetServiceDetails(ctx datastore.Context, serviceID string) (*ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetails")) id := strings.TrimSpace(serviceID) if id == "" { return nil, errors.New("empty service id not allowed") } searchRequest := new...
[ "func", "(", "s", "*", "storeImpl", ")", "GetServiceDetails", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "*", "ServiceDetails", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx...
// GetServiceDetails returns service details for an id
[ "GetServiceDetails", "returns", "service", "details", "for", "an", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/servicedetails_store.go#L112-L153
139,670
control-center/serviced
domain/service/servicedetails_store.go
GetServiceDetailsByParentID
func (s *storeImpl) GetServiceDetailsByParentID(ctx datastore.Context, parentID string, since time.Duration) ([]ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetailsByParentID")) query := map[string]interface{}{} termQuery := map[string]string{ "ParentServiceID": par...
go
func (s *storeImpl) GetServiceDetailsByParentID(ctx datastore.Context, parentID string, since time.Duration) ([]ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetailsByParentID")) query := map[string]interface{}{} termQuery := map[string]string{ "ParentServiceID": par...
[ "func", "(", "s", "*", "storeImpl", ")", "GetServiceDetailsByParentID", "(", "ctx", "datastore", ".", "Context", ",", "parentID", "string", ",", "since", "time", ".", "Duration", ")", "(", "[", "]", "ServiceDetails", ",", "error", ")", "{", "defer", "ctx",...
// GetChildServiceDetailsByParentID returns service details given parent service id
[ "GetChildServiceDetailsByParentID", "returns", "service", "details", "given", "parent", "service", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/servicedetails_store.go#L156-L212
139,671
control-center/serviced
domain/service/servicedetails_store.go
GetServiceDetailsByIDOrName
func (s *storeImpl) GetServiceDetailsByIDOrName(ctx datastore.Context, query string, noprefix bool) ([]ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetailsByIDOrName")) // Because we don't analyze any of our fields, we have to do this extremely // idiotic regular exp...
go
func (s *storeImpl) GetServiceDetailsByIDOrName(ctx datastore.Context, query string, noprefix bool) ([]ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServiceDetailsByIDOrName")) // Because we don't analyze any of our fields, we have to do this extremely // idiotic regular exp...
[ "func", "(", "s", "*", "storeImpl", ")", "GetServiceDetailsByIDOrName", "(", "ctx", "datastore", ".", "Context", ",", "query", "string", ",", "noprefix", "bool", ")", "(", "[", "]", "ServiceDetails", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", ...
// GetServiceDetailsByIDOrName returns the service details for any services // whose serviceID matches the query exactly or whose names contain the query // as a substring
[ "GetServiceDetailsByIDOrName", "returns", "the", "service", "details", "for", "any", "services", "whose", "serviceID", "matches", "the", "query", "exactly", "or", "whose", "names", "contain", "the", "query", "as", "a", "substring" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/servicedetails_store.go#L217-L297
139,672
control-center/serviced
domain/service/servicedetails_store.go
GetAllExportedEndpoints
func (s *storeImpl) GetAllExportedEndpoints(ctx datastore.Context) ([]ExportedEndpoint, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetAllExportedEndpoints")) searchRequest := newServiceDetailsElasticRequest(map[string]interface{}{ "query": map[string]interface{}{ "term": map[string]inter...
go
func (s *storeImpl) GetAllExportedEndpoints(ctx datastore.Context) ([]ExportedEndpoint, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetAllExportedEndpoints")) searchRequest := newServiceDetailsElasticRequest(map[string]interface{}{ "query": map[string]interface{}{ "term": map[string]inter...
[ "func", "(", "s", "*", "storeImpl", ")", "GetAllExportedEndpoints", "(", "ctx", "datastore", ".", "Context", ")", "(", "[", "]", "ExportedEndpoint", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metric...
// GetAllExportedEndpoints returns all the exported endpoints in the system
[ "GetAllExportedEndpoints", "returns", "all", "the", "exported", "endpoints", "in", "the", "system" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/servicedetails_store.go#L343-L372
139,673
control-center/serviced
facade/pool.go
AddResourcePool
func (f *Facade) AddResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddResourcePool")) glog.Infof("Adding Resource Pool %s", entity.ID) alog := f.auditLogger.Message(ctx, "Adding Resource Pool"). Action(audit.Add).Entity(entity) if err...
go
func (f *Facade) AddResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddResourcePool")) glog.Infof("Adding Resource Pool %s", entity.ID) alog := f.auditLogger.Message(ctx, "Adding Resource Pool"). Action(audit.Add).Entity(entity) if err...
[ "func", "(", "f", "*", "Facade", ")", "AddResourcePool", "(", "ctx", "datastore", ".", "Context", ",", "entity", "*", "pool", ".", "ResourcePool", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "...
// AddResourcePool adds a new resource pool
[ "AddResourcePool", "adds", "a", "new", "resource", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L48-L63
139,674
control-center/serviced
facade/pool.go
UpdateResourcePool
func (f *Facade) UpdateResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.UpdateResourcePool")) alog := f.auditLogger.Message(ctx, "Updating Resource Pool"). Action(audit.Update).Entity(entity) if err := f.DFSLock(ctx).LockWithTimeout("update...
go
func (f *Facade) UpdateResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.UpdateResourcePool")) alog := f.auditLogger.Message(ctx, "Updating Resource Pool"). Action(audit.Update).Entity(entity) if err := f.DFSLock(ctx).LockWithTimeout("update...
[ "func", "(", "f", "*", "Facade", ")", "UpdateResourcePool", "(", "ctx", "datastore", ".", "Context", ",", "entity", "*", "pool", ".", "ResourcePool", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", ...
// UpdateResourcePool updates an existing resource pool
[ "UpdateResourcePool", "updates", "an", "existing", "resource", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L105-L116
139,675
control-center/serviced
facade/pool.go
RestoreResourcePools
func (f *Facade) RestoreResourcePools(ctx datastore.Context, pools []pool.ResourcePool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RestoreResourcePools")) // Do not DFSLock here, ControlPlaneDao does that var alog audit.Logger for _, pool := range pools { alog = f.auditLogger.Message(ctx, "Addin...
go
func (f *Facade) RestoreResourcePools(ctx datastore.Context, pools []pool.ResourcePool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RestoreResourcePools")) // Do not DFSLock here, ControlPlaneDao does that var alog audit.Logger for _, pool := range pools { alog = f.auditLogger.Message(ctx, "Addin...
[ "func", "(", "f", "*", "Facade", ")", "RestoreResourcePools", "(", "ctx", "datastore", ".", "Context", ",", "pools", "[", "]", "pool", ".", "ResourcePool", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Me...
// RestoreResourcePools restores a bulk of resource pools, usually from a backup.
[ "RestoreResourcePools", "restores", "a", "bulk", "of", "resource", "pools", "usually", "from", "a", "backup", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L197-L218
139,676
control-center/serviced
facade/pool.go
HasIP
func (f *Facade) HasIP(ctx datastore.Context, poolID string, ipAddr string) (bool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.HasIP")) if exists, err := f.poolStore.HasVirtualIP(ctx, poolID, ipAddr); err != nil { glog.Errorf("Could not look up ip %s for pool %s: %s", ipAddr, poolID, err) return...
go
func (f *Facade) HasIP(ctx datastore.Context, poolID string, ipAddr string) (bool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.HasIP")) if exists, err := f.poolStore.HasVirtualIP(ctx, poolID, ipAddr); err != nil { glog.Errorf("Could not look up ip %s for pool %s: %s", ipAddr, poolID, err) return...
[ "func", "(", "f", "*", "Facade", ")", "HasIP", "(", "ctx", "datastore", ".", "Context", ",", "poolID", "string", ",", "ipAddr", "string", ")", "(", "bool", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ...
// HasIP checks if a pool uses a particular IP address
[ "HasIP", "checks", "if", "a", "pool", "uses", "a", "particular", "IP", "address" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L221-L238
139,677
control-center/serviced
facade/pool.go
AddVirtualIP
func (f *Facade) AddVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddVirtualIP")) entity, err := f.GetResourcePool(ctx, vip.PoolID) alog := f.auditLogger.Message(ctx, "Adding VirtualIP"). Action(audit.Update).WithField("virtualip", vip.IP) if err...
go
func (f *Facade) AddVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddVirtualIP")) entity, err := f.GetResourcePool(ctx, vip.PoolID) alog := f.auditLogger.Message(ctx, "Adding VirtualIP"). Action(audit.Update).WithField("virtualip", vip.IP) if err...
[ "func", "(", "f", "*", "Facade", ")", "AddVirtualIP", "(", "ctx", "datastore", ".", "Context", ",", "vip", "pool", ".", "VirtualIP", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", "."...
// AddVirtualIP adds a virtual IP to a pool
[ "AddVirtualIP", "adds", "a", "virtual", "IP", "to", "a", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L241-L271
139,678
control-center/serviced
facade/pool.go
RemoveVirtualIP
func (f *Facade) RemoveVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveVirtualIP")) alog := f.auditLogger.Message(ctx, "Removing VirtualIP").Action(audit.Update). WithField("virtualip", vip.IP) entity, err := f.GetResourcePool(ctx, vip.PoolID)...
go
func (f *Facade) RemoveVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveVirtualIP")) alog := f.auditLogger.Message(ctx, "Removing VirtualIP").Action(audit.Update). WithField("virtualip", vip.IP) entity, err := f.GetResourcePool(ctx, vip.PoolID)...
[ "func", "(", "f", "*", "Facade", ")", "RemoveVirtualIP", "(", "ctx", "datastore", ".", "Context", ",", "vip", "pool", ".", "VirtualIP", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ...
// RemoveVirtualIP removes a virtual IP from a pool
[ "RemoveVirtualIP", "removes", "a", "virtual", "IP", "from", "a", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L301-L355
139,679
control-center/serviced
facade/pool.go
RemoveResourcePool
func (f *Facade) RemoveResourcePool(ctx datastore.Context, id string) error { alog := f.auditLogger. Message(ctx, "Removing Resource Pool"). Action(audit.Remove).ID(id).Type(pool.GetType()) defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveResourcePool")) glog.V(2).Infof("Facade.RemoveResourcePool: %s"...
go
func (f *Facade) RemoveResourcePool(ctx datastore.Context, id string) error { alog := f.auditLogger. Message(ctx, "Removing Resource Pool"). Action(audit.Remove).ID(id).Type(pool.GetType()) defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveResourcePool")) glog.V(2).Infof("Facade.RemoveResourcePool: %s"...
[ "func", "(", "f", "*", "Facade", ")", "RemoveResourcePool", "(", "ctx", "datastore", ".", "Context", ",", "id", "string", ")", "error", "{", "alog", ":=", "f", ".", "auditLogger", ".", "Message", "(", "ctx", ",", "\"", "\"", ")", ".", "Action", "(", ...
// RemoveResourcePool removes a resource pool
[ "RemoveResourcePool", "removes", "a", "resource", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L368-L406
139,680
control-center/serviced
facade/pool.go
GetResourcePools
func (f *Facade) GetResourcePools(ctx datastore.Context) ([]pool.ResourcePool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetResourcePools")) pools, err := f.poolStore.GetResourcePools(ctx) if err != nil { return nil, fmt.Errorf("Could not load pools: %v", err) } for i := range pools { f.c...
go
func (f *Facade) GetResourcePools(ctx datastore.Context) ([]pool.ResourcePool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetResourcePools")) pools, err := f.poolStore.GetResourcePools(ctx) if err != nil { return nil, fmt.Errorf("Could not load pools: %v", err) } for i := range pools { f.c...
[ "func", "(", "f", "*", "Facade", ")", "GetResourcePools", "(", "ctx", "datastore", ".", "Context", ")", "(", "[", "]", "pool", ".", "ResourcePool", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Met...
// GetResourcePools returns a list of all resource pools
[ "GetResourcePools", "returns", "a", "list", "of", "all", "resource", "pools" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L409-L423
139,681
control-center/serviced
facade/pool.go
GetResourcePool
func (f *Facade) GetResourcePool(ctx datastore.Context, id string) (*pool.ResourcePool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetResourcePool")) glog.V(2).Infof("Facade.GetResourcePool: id=%s", id) var entity pool.ResourcePool err := f.poolStore.Get(ctx, pool.Key(id), &entity) if datastore....
go
func (f *Facade) GetResourcePool(ctx datastore.Context, id string) (*pool.ResourcePool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetResourcePool")) glog.V(2).Infof("Facade.GetResourcePool: id=%s", id) var entity pool.ResourcePool err := f.poolStore.Get(ctx, pool.Key(id), &entity) if datastore....
[ "func", "(", "f", "*", "Facade", ")", "GetResourcePool", "(", "ctx", "datastore", ".", "Context", ",", "id", "string", ")", "(", "*", "pool", ".", "ResourcePool", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "...
// GetResourcePool returns a resource pool, or nil if not found
[ "GetResourcePool", "returns", "a", "resource", "pool", "or", "nil", "if", "not", "found" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L443-L458
139,682
control-center/serviced
facade/pool.go
CreateDefaultPool
func (f *Facade) CreateDefaultPool(ctx datastore.Context, id string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.CreateDefaultPool")) alog := f.auditLogger.Message(ctx, "Adding ResourcePool"). ID(id).Type(pool.GetType()).Action(audit.Add) entity, err := f.GetResourcePool(ctx, id) if err != nil { ...
go
func (f *Facade) CreateDefaultPool(ctx datastore.Context, id string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.CreateDefaultPool")) alog := f.auditLogger.Message(ctx, "Adding ResourcePool"). ID(id).Type(pool.GetType()).Action(audit.Add) entity, err := f.GetResourcePool(ctx, id) if err != nil { ...
[ "func", "(", "f", "*", "Facade", ")", "CreateDefaultPool", "(", "ctx", "datastore", ".", "Context", ",", "id", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "...
// CreateDefaultPool creates the default pool if it does not exist. It is idempotent.
[ "CreateDefaultPool", "creates", "the", "default", "pool", "if", "it", "does", "not", "exist", ".", "It", "is", "idempotent", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L461-L486
139,683
control-center/serviced
facade/pool.go
GetPoolIPs
func (f *Facade) GetPoolIPs(ctx datastore.Context, poolID string) (*pool.PoolIPs, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetPoolIPs")) glog.V(0).Infof("Facade.GetPoolIPs: %+v", poolID) hosts, err := f.FindHostsInPool(ctx, poolID) if err != nil { return nil, err } glog.V(0).Infof("Facade.G...
go
func (f *Facade) GetPoolIPs(ctx datastore.Context, poolID string) (*pool.PoolIPs, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetPoolIPs")) glog.V(0).Infof("Facade.GetPoolIPs: %+v", poolID) hosts, err := f.FindHostsInPool(ctx, poolID) if err != nil { return nil, err } glog.V(0).Infof("Facade.G...
[ "func", "(", "f", "*", "Facade", ")", "GetPoolIPs", "(", "ctx", "datastore", ".", "Context", ",", "poolID", "string", ")", "(", "*", "pool", ".", "PoolIPs", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ...
// GetPoolIPs gets all IPs available to a resource pool
[ "GetPoolIPs", "gets", "all", "IPs", "available", "to", "a", "resource", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L526-L554
139,684
control-center/serviced
facade/pool.go
GetReadPools
func (f *Facade) GetReadPools(ctx datastore.Context) ([]pool.ReadPool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetReadPools")) var getPoolsFunc GetPoolsFunc = func() ([]pool.ReadPool, error) { pools, err := f.poolStore.GetResourcePools(ctx) if err != nil { return nil, fmt.Errorf("Could ...
go
func (f *Facade) GetReadPools(ctx datastore.Context) ([]pool.ReadPool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetReadPools")) var getPoolsFunc GetPoolsFunc = func() ([]pool.ReadPool, error) { pools, err := f.poolStore.GetResourcePools(ctx) if err != nil { return nil, fmt.Errorf("Could ...
[ "func", "(", "f", "*", "Facade", ")", "GetReadPools", "(", "ctx", "datastore", ".", "Context", ")", "(", "[", "]", "pool", ".", "ReadPool", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", ...
// GetReadPools returns a list of simplified resource pools
[ "GetReadPools", "returns", "a", "list", "of", "simplified", "resource", "pools" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool.go#L559-L591
139,685
control-center/serviced
cli/api/logs.go
buildExporter
func buildExporter(configParam ExportLogsConfig, startTime time.Time, timeLabel string, getServices func() ([]service.ServiceDetails, error), getHostMap func() (map[string]host.Host, error)) (exporter *logExporter, err error) { exporter = &logExporter{ ExportLogsConfig: configParam, startTime: startTime, ...
go
func buildExporter(configParam ExportLogsConfig, startTime time.Time, timeLabel string, getServices func() ([]service.ServiceDetails, error), getHostMap func() (map[string]host.Host, error)) (exporter *logExporter, err error) { exporter = &logExporter{ ExportLogsConfig: configParam, startTime: startTime, ...
[ "func", "buildExporter", "(", "configParam", "ExportLogsConfig", ",", "startTime", "time", ".", "Time", ",", "timeLabel", "string", ",", "getServices", "func", "(", ")", "(", "[", "]", "service", ".", "ServiceDetails", ",", "error", ")", ",", "getHostMap", "...
// Builds an instance of logExporter to use for the current export operation.
[ "Builds", "an", "instance", "of", "logExporter", "to", "use", "for", "the", "current", "export", "operation", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L345-L398
139,686
control-center/serviced
cli/api/logs.go
buildQuery
func (exporter *logExporter) buildQuery(getServices func() ([]service.ServiceDetails, error)) (string, error) { query := "*" if len(exporter.ServiceIDs) > 0 { services, e := getServices() if e != nil { return "", e } serviceMap := make(map[string]service.ServiceDetails) for _, service := range services {...
go
func (exporter *logExporter) buildQuery(getServices func() ([]service.ServiceDetails, error)) (string, error) { query := "*" if len(exporter.ServiceIDs) > 0 { services, e := getServices() if e != nil { return "", e } serviceMap := make(map[string]service.ServiceDetails) for _, service := range services {...
[ "func", "(", "exporter", "*", "logExporter", ")", "buildQuery", "(", "getServices", "func", "(", ")", "(", "[", "]", "service", ".", "ServiceDetails", ",", "error", ")", ")", "(", "string", ",", "error", ")", "{", "query", ":=", "\"", "\"", "\n", "if...
// Builds an ES-logstash query string based on the list of service IDs requested.
[ "Builds", "an", "ES", "-", "logstash", "query", "string", "based", "on", "the", "list", "of", "service", "IDs", "requested", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L442-L508
139,687
control-center/serviced
cli/api/logs.go
getHostName
func (exporter *logExporter) getHostName(hostID string) string { if hostID == "" { // Probably a message that was logged before we added the 'ccWorkerID' field return "" } else if host, ok := exporter.hostMap[hostID]; !ok { // either the CC worker node was retired or // the hostID of the worker node was chang...
go
func (exporter *logExporter) getHostName(hostID string) string { if hostID == "" { // Probably a message that was logged before we added the 'ccWorkerID' field return "" } else if host, ok := exporter.hostMap[hostID]; !ok { // either the CC worker node was retired or // the hostID of the worker node was chang...
[ "func", "(", "exporter", "*", "logExporter", ")", "getHostName", "(", "hostID", "string", ")", "string", "{", "if", "hostID", "==", "\"", "\"", "{", "// Probably a message that was logged before we added the 'ccWorkerID' field", "return", "\"", "\"", "\n", "}", "els...
// Finds a host name based on a hostID.
[ "Finds", "a", "host", "name", "based", "on", "a", "hostID", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L819-L830
139,688
control-center/serviced
cli/api/logs.go
getMinValue
func getMinValue(values []uint64) uint64 { result := uint64(math.MaxUint64) for _, value := range values { if value < result { result = value } } return result }
go
func getMinValue(values []uint64) uint64 { result := uint64(math.MaxUint64) for _, value := range values { if value < result { result = value } } return result }
[ "func", "getMinValue", "(", "values", "[", "]", "uint64", ")", "uint64", "{", "result", ":=", "uint64", "(", "math", ".", "MaxUint64", ")", "\n", "for", "_", ",", "value", ":=", "range", "values", "{", "if", "value", "<", "result", "{", "result", "="...
// getMinValue returns the minimum value in an array of uint64
[ "getMinValue", "returns", "the", "minimum", "value", "in", "an", "array", "of", "uint64" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L947-L955
139,689
control-center/serviced
cli/api/logs.go
generateOffsets
func generateOffsets(messages []string, offsets []uint64) []uint64 { result := make([]uint64, len(messages)) minOffset := getMinValue(offsets) if minOffset == uint64(math.MaxUint64) { minOffset = 0 } for i, _ := range result { result[i] = minOffset + uint64(i) } return result }
go
func generateOffsets(messages []string, offsets []uint64) []uint64 { result := make([]uint64, len(messages)) minOffset := getMinValue(offsets) if minOffset == uint64(math.MaxUint64) { minOffset = 0 } for i, _ := range result { result[i] = minOffset + uint64(i) } return result }
[ "func", "generateOffsets", "(", "messages", "[", "]", "string", ",", "offsets", "[", "]", "uint64", ")", "[", "]", "uint64", "{", "result", ":=", "make", "(", "[", "]", "uint64", ",", "len", "(", "messages", ")", ")", "\n", "minOffset", ":=", "getMin...
// generateOffsets uses the minimum offset in the array as a base returns an array of offsets where // each offset is the base + index
[ "generateOffsets", "uses", "the", "minimum", "offset", "in", "the", "array", "as", "a", "base", "returns", "an", "array", "of", "offsets", "where", "each", "offset", "is", "the", "base", "+", "index" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L959-L969
139,690
control-center/serviced
cli/api/logs.go
convertWorkerID
func convertWorkerID(id interface{}) (string, error) { if id == nil { return "", nil } switch id.(type) { case int: num := id.(int) return fmt.Sprintf("%v",num), nil case uint64: num := id.(uint64) return fmt.Sprintf("%v",num), nil case float64: num := id.(float64) return fmt.Sprintf("%.0f",num), n...
go
func convertWorkerID(id interface{}) (string, error) { if id == nil { return "", nil } switch id.(type) { case int: num := id.(int) return fmt.Sprintf("%v",num), nil case uint64: num := id.(uint64) return fmt.Sprintf("%v",num), nil case float64: num := id.(float64) return fmt.Sprintf("%.0f",num), n...
[ "func", "convertWorkerID", "(", "id", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "if", "id", "==", "nil", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "switch", "id", ".", "(", "type", ")", "{", "case", "int",...
// The ccworkerid is a number on some systems that didn't have // the filter mutate, and the hostid was a numeric value. We need // to handle both cases.
[ "The", "ccworkerid", "is", "a", "number", "on", "some", "systems", "that", "didn", "t", "have", "the", "filter", "mutate", "and", "the", "hostid", "was", "a", "numeric", "value", ".", "We", "need", "to", "handle", "both", "cases", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L974-L999
139,691
control-center/serviced
cli/api/logs.go
convertMessage
func convertMessage(data interface{}) (string, error) { switch data.(type) { case string: return data.(string), nil } // An unexpected type. We'll get the type name for the error, but this // will fail the export.. so it only uses reflect once. name := reflect.TypeOf(data) return "", &UnknownElasticStructErro...
go
func convertMessage(data interface{}) (string, error) { switch data.(type) { case string: return data.(string), nil } // An unexpected type. We'll get the type name for the error, but this // will fail the export.. so it only uses reflect once. name := reflect.TypeOf(data) return "", &UnknownElasticStructErro...
[ "func", "convertMessage", "(", "data", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "switch", "data", ".", "(", "type", ")", "{", "case", "string", ":", "return", "data", ".", "(", "string", ")", ",", "nil", "\n", "}", "\n\n",...
// convert a single message
[ "convert", "a", "single", "message" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L1071-L1081
139,692
control-center/serviced
cli/api/logs.go
convertMultiLineSource
func convertMultiLineSource(source []byte) (logMultiLine, error) { var multiLine logMultiLine var multiLineGeneric logMultiLineGeneric if err := json.Unmarshal(source, &multiLineGeneric); err == nil { multiLine.Type = multiLineGeneric.Type multiLine.File = multiLineGeneric.File multiLine.Timestamp = multiLine...
go
func convertMultiLineSource(source []byte) (logMultiLine, error) { var multiLine logMultiLine var multiLineGeneric logMultiLineGeneric if err := json.Unmarshal(source, &multiLineGeneric); err == nil { multiLine.Type = multiLineGeneric.Type multiLine.File = multiLineGeneric.File multiLine.Timestamp = multiLine...
[ "func", "convertMultiLineSource", "(", "source", "[", "]", "byte", ")", "(", "logMultiLine", ",", "error", ")", "{", "var", "multiLine", "logMultiLine", "\n", "var", "multiLineGeneric", "logMultiLineGeneric", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", ...
// Converts the elastic log into a generic type and converts that into a // common format to use in the export.
[ "Converts", "the", "elastic", "log", "into", "a", "generic", "type", "and", "converts", "that", "into", "a", "common", "format", "to", "use", "in", "the", "export", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L1112-L1139
139,693
control-center/serviced
cli/api/logs.go
NormalizeYYYYMMDD
func NormalizeYYYYMMDD(s string) (string, error) { match := yyyymmddMatcher.FindStringSubmatch(s) if match == nil { return "", fmt.Errorf("could not parse '%s' as yyyymmdd", s) } return fmt.Sprintf("%s.%s.%s", match[1], match[2], match[3]), nil }
go
func NormalizeYYYYMMDD(s string) (string, error) { match := yyyymmddMatcher.FindStringSubmatch(s) if match == nil { return "", fmt.Errorf("could not parse '%s' as yyyymmdd", s) } return fmt.Sprintf("%s.%s.%s", match[1], match[2], match[3]), nil }
[ "func", "NormalizeYYYYMMDD", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "match", ":=", "yyyymmddMatcher", ".", "FindStringSubmatch", "(", "s", ")", "\n", "if", "match", "==", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Erro...
// NormalizeYYYYMMDD matches optional non-digits, 4 digits, optional non-digits, // 2 digits, optional non-digits, 2 digits, optional non-digits // Returns those 8 digits formatted as "dddd.dd.dd", or error if unparseable.
[ "NormalizeYYYYMMDD", "matches", "optional", "non", "-", "digits", "4", "digits", "optional", "non", "-", "digits", "2", "digits", "optional", "non", "-", "digits", "2", "digits", "optional", "non", "-", "digits", "Returns", "those", "8", "digits", "formatted",...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/logs.go#L1254-L1260
139,694
control-center/serviced
rpc/master/hosts_server.go
GetHost
func (s *Server) GetHost(hostID string, reply *host.Host) error { response, err := s.f.GetHost(s.context(), hostID) if err != nil { return err } if response == nil { return facade.ErrHostDoesNotExist } *reply = *response return nil }
go
func (s *Server) GetHost(hostID string, reply *host.Host) error { response, err := s.f.GetHost(s.context(), hostID) if err != nil { return err } if response == nil { return facade.ErrHostDoesNotExist } *reply = *response return nil }
[ "func", "(", "s", "*", "Server", ")", "GetHost", "(", "hostID", "string", ",", "reply", "*", "host", ".", "Host", ")", "error", "{", "response", ",", "err", ":=", "s", ".", "f", ".", "GetHost", "(", "s", ".", "context", "(", ")", ",", "hostID", ...
// GetHost gets the host
[ "GetHost", "gets", "the", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_server.go#L34-L44
139,695
control-center/serviced
rpc/master/hosts_server.go
GetHosts
func (s *Server) GetHosts(empty struct{}, hostReply *[]host.Host) error { hosts, err := s.f.GetHosts(s.context()) if err != nil { return err } *hostReply = hosts return nil }
go
func (s *Server) GetHosts(empty struct{}, hostReply *[]host.Host) error { hosts, err := s.f.GetHosts(s.context()) if err != nil { return err } *hostReply = hosts return nil }
[ "func", "(", "s", "*", "Server", ")", "GetHosts", "(", "empty", "struct", "{", "}", ",", "hostReply", "*", "[", "]", "host", ".", "Host", ")", "error", "{", "hosts", ",", "err", ":=", "s", ".", "f", ".", "GetHosts", "(", "s", ".", "context", "(...
// GetHosts returns all Hosts
[ "GetHosts", "returns", "all", "Hosts" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_server.go#L47-L54
139,696
control-center/serviced
rpc/master/hosts_server.go
GetActiveHostIDs
func (s *Server) GetActiveHostIDs(empty struct{}, hostReply *[]string) error { hosts, err := s.f.GetActiveHostIDs(s.context()) if err != nil { return err } *hostReply = hosts return nil }
go
func (s *Server) GetActiveHostIDs(empty struct{}, hostReply *[]string) error { hosts, err := s.f.GetActiveHostIDs(s.context()) if err != nil { return err } *hostReply = hosts return nil }
[ "func", "(", "s", "*", "Server", ")", "GetActiveHostIDs", "(", "empty", "struct", "{", "}", ",", "hostReply", "*", "[", "]", "string", ")", "error", "{", "hosts", ",", "err", ":=", "s", ".", "f", ".", "GetActiveHostIDs", "(", "s", ".", "context", "...
// GetActiveHosts returns all active host ids
[ "GetActiveHosts", "returns", "all", "active", "host", "ids" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_server.go#L57-L64
139,697
control-center/serviced
rpc/master/hosts_server.go
AddHost
func (s *Server) AddHost(host host.Host, hostReply *[]byte) error { privateKey, err := s.f.AddHost(s.context(), &host) if err != nil { return err } *hostReply = privateKey return nil }
go
func (s *Server) AddHost(host host.Host, hostReply *[]byte) error { privateKey, err := s.f.AddHost(s.context(), &host) if err != nil { return err } *hostReply = privateKey return nil }
[ "func", "(", "s", "*", "Server", ")", "AddHost", "(", "host", "host", ".", "Host", ",", "hostReply", "*", "[", "]", "byte", ")", "error", "{", "privateKey", ",", "err", ":=", "s", ".", "f", ".", "AddHost", "(", "s", ".", "context", "(", ")", ",...
// AddHost adds the host
[ "AddHost", "adds", "the", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_server.go#L67-L74
139,698
control-center/serviced
rpc/master/hosts_server.go
AddHostPrivate
func (s *Server) AddHostPrivate(host host.Host, hostReply *[]byte) error { masterPublicKey, err := s.f.AddHostPrivate(s.context(), &host) if err != nil { return err } *hostReply = masterPublicKey return nil }
go
func (s *Server) AddHostPrivate(host host.Host, hostReply *[]byte) error { masterPublicKey, err := s.f.AddHostPrivate(s.context(), &host) if err != nil { return err } *hostReply = masterPublicKey return nil }
[ "func", "(", "s", "*", "Server", ")", "AddHostPrivate", "(", "host", "host", ".", "Host", ",", "hostReply", "*", "[", "]", "byte", ")", "error", "{", "masterPublicKey", ",", "err", ":=", "s", ".", "f", ".", "AddHostPrivate", "(", "s", ".", "context",...
//AddHostPrivate adds the host using a shared key approved of beforehand and returns the master's public key.
[ "AddHostPrivate", "adds", "the", "host", "using", "a", "shared", "key", "approved", "of", "beforehand", "and", "returns", "the", "master", "s", "public", "key", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_server.go#L77-L84
139,699
control-center/serviced
rpc/master/hosts_server.go
UpdateHost
func (s *Server) UpdateHost(host host.Host, _ *struct{}) error { return s.f.UpdateHost(s.context(), &host) }
go
func (s *Server) UpdateHost(host host.Host, _ *struct{}) error { return s.f.UpdateHost(s.context(), &host) }
[ "func", "(", "s", "*", "Server", ")", "UpdateHost", "(", "host", "host", ".", "Host", ",", "_", "*", "struct", "{", "}", ")", "error", "{", "return", "s", ".", "f", ".", "UpdateHost", "(", "s", ".", "context", "(", ")", ",", "&", "host", ")", ...
// UpdateHost updates the host
[ "UpdateHost", "updates", "the", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_server.go#L87-L89