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,900
control-center/serviced
auth/rpc.go
WriteLengthAndBytes
func WriteLengthAndBytes(b []byte, writer io.Writer) error { // write length var pl payloadLength = payloadLength(len(b)) if err := binary.Write(writer, byteOrder, pl); err != nil { return err } if err := binary.Write(writer, byteOrder, b); err != nil { return err } return nil }
go
func WriteLengthAndBytes(b []byte, writer io.Writer) error { // write length var pl payloadLength = payloadLength(len(b)) if err := binary.Write(writer, byteOrder, pl); err != nil { return err } if err := binary.Write(writer, byteOrder, b); err != nil { return err } return nil }
[ "func", "WriteLengthAndBytes", "(", "b", "[", "]", "byte", ",", "writer", "io", ".", "Writer", ")", "error", "{", "// write length", "var", "pl", "payloadLength", "=", "payloadLength", "(", "len", "(", "b", ")", ")", "\n", "if", "err", ":=", "binary", ...
// WriteLengthAndBytes writes the length of a byte array and then the bytes // themselves. It is the inverse of ReadLengthAndBytes.
[ "WriteLengthAndBytes", "writes", "the", "length", "of", "a", "byte", "array", "and", "then", "the", "bytes", "themselves", ".", "It", "is", "the", "inverse", "of", "ReadLengthAndBytes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rpc.go#L60-L70
139,901
control-center/serviced
auth/rpc.go
ReadLengthAndBytes
func ReadLengthAndBytes(reader io.Reader) ([]byte, error) { // Read the length of the data var payloadLen payloadLength if err := binary.Read(reader, byteOrder, &payloadLen); err != nil { return nil, err } // Now read the data b := make([]byte, payloadLen) if err := binary.Read(reader, byteOrder, &b); err != ...
go
func ReadLengthAndBytes(reader io.Reader) ([]byte, error) { // Read the length of the data var payloadLen payloadLength if err := binary.Read(reader, byteOrder, &payloadLen); err != nil { return nil, err } // Now read the data b := make([]byte, payloadLen) if err := binary.Read(reader, byteOrder, &b); err != ...
[ "func", "ReadLengthAndBytes", "(", "reader", "io", ".", "Reader", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Read the length of the data", "var", "payloadLen", "payloadLength", "\n", "if", "err", ":=", "binary", ".", "Read", "(", "reader", ",", ...
// ReadLengthAndBytes reads the length of a byte array and then the bytes // themselves. It is the inverse of WriteLengthAndBytes.
[ "ReadLengthAndBytes", "reads", "the", "length", "of", "a", "byte", "array", "and", "then", "the", "bytes", "themselves", ".", "It", "is", "the", "inverse", "of", "WriteLengthAndBytes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rpc.go#L74-L87
139,902
control-center/serviced
auth/rpc.go
WriteHeader
func (r *RPCHeaderHandler) WriteHeader(w io.Writer, req []byte, writeAuth bool) error { var ( token string err error err2 error ) binary.Write(w, byteOrder, RPCMagicNumber) if writeAuth { binary.Write(w, byteOrder, uint8(1)) // get current host token var signer Signer = &delegateKeys token, err = A...
go
func (r *RPCHeaderHandler) WriteHeader(w io.Writer, req []byte, writeAuth bool) error { var ( token string err error err2 error ) binary.Write(w, byteOrder, RPCMagicNumber) if writeAuth { binary.Write(w, byteOrder, uint8(1)) // get current host token var signer Signer = &delegateKeys token, err = A...
[ "func", "(", "r", "*", "RPCHeaderHandler", ")", "WriteHeader", "(", "w", "io", ".", "Writer", ",", "req", "[", "]", "byte", ",", "writeAuth", "bool", ")", "error", "{", "var", "(", "token", "string", "\n", "err", "error", "\n", "err2", "error", "\n",...
// WriteHeader writes an RPC header to the provided writer. Optionally, it // writes an authentication header as part of the RPC header.
[ "WriteHeader", "writes", "an", "RPC", "header", "to", "the", "provided", "writer", ".", "Optionally", "it", "writes", "an", "authentication", "header", "as", "part", "of", "the", "RPC", "header", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rpc.go#L91-L121
139,903
control-center/serviced
auth/rpc.go
ReadHeader
func (r *RPCHeaderHandler) ReadHeader(reader io.Reader) (Identity, []byte, error) { // Read and verify the first three bytes are the magic number var ( m = make([]byte, 3) sender Identity payload []byte ) if err := binary.Read(reader, byteOrder, &m); err != nil { return nil, nil, err } if !bytes.Eq...
go
func (r *RPCHeaderHandler) ReadHeader(reader io.Reader) (Identity, []byte, error) { // Read and verify the first three bytes are the magic number var ( m = make([]byte, 3) sender Identity payload []byte ) if err := binary.Read(reader, byteOrder, &m); err != nil { return nil, nil, err } if !bytes.Eq...
[ "func", "(", "r", "*", "RPCHeaderHandler", ")", "ReadHeader", "(", "reader", "io", ".", "Reader", ")", "(", "Identity", ",", "[", "]", "byte", ",", "error", ")", "{", "// Read and verify the first three bytes are the magic number", "var", "(", "m", "=", "make"...
// ReadHeader reads an RPC header from a reader, parsing the authentication // header, if any.
[ "ReadHeader", "reads", "an", "RPC", "header", "from", "a", "reader", "parsing", "the", "authentication", "header", "if", "any", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/rpc.go#L125-L155
139,904
control-center/serviced
domain/serviceconfigfile/ServiceConfigFile.go
New
func New(tenantID string, svcPath string, conf servicedefinition.ConfigFile) (*SvcConfigFile, error) { uuid, err := utils.NewUUID() if err != nil { return nil, err } svcCF := &SvcConfigFile{ID: uuid, ServiceTenantID: tenantID, ServicePath: svcPath, ConfFile: conf} if err = svcCF.ValidEntity(); err != nil { ret...
go
func New(tenantID string, svcPath string, conf servicedefinition.ConfigFile) (*SvcConfigFile, error) { uuid, err := utils.NewUUID() if err != nil { return nil, err } svcCF := &SvcConfigFile{ID: uuid, ServiceTenantID: tenantID, ServicePath: svcPath, ConfFile: conf} if err = svcCF.ValidEntity(); err != nil { ret...
[ "func", "New", "(", "tenantID", "string", ",", "svcPath", "string", ",", "conf", "servicedefinition", ".", "ConfigFile", ")", "(", "*", "SvcConfigFile", ",", "error", ")", "{", "uuid", ",", "err", ":=", "utils", ".", "NewUUID", "(", ")", "\n", "if", "e...
//New creates a SvcConfigFile
[ "New", "creates", "a", "SvcConfigFile" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/serviceconfigfile/ServiceConfigFile.go#L36-L46
139,905
control-center/serviced
stats/storagestatsreporter.go
NewStorageStatsReporter
func NewStorageStatsReporter(destination string, interval time.Duration) (*StorageStatsReporter, error) { hostID, err := utils.HostID() if err != nil { plog.WithError(err).Debug("Could not determine host ID") return nil, err } sr := StorageStatsReporter{ statsReporter: statsReporter{ destination: destina...
go
func NewStorageStatsReporter(destination string, interval time.Duration) (*StorageStatsReporter, error) { hostID, err := utils.HostID() if err != nil { plog.WithError(err).Debug("Could not determine host ID") return nil, err } sr := StorageStatsReporter{ statsReporter: statsReporter{ destination: destina...
[ "func", "NewStorageStatsReporter", "(", "destination", "string", ",", "interval", "time", ".", "Duration", ")", "(", "*", "StorageStatsReporter", ",", "error", ")", "{", "hostID", ",", "err", ":=", "utils", ".", "HostID", "(", ")", "\n", "if", "err", "!=",...
// NewStorageStatsReporter creates a new NewStorageStatsReporter and kicks off the reporting goroutine.
[ "NewStorageStatsReporter", "creates", "a", "new", "NewStorageStatsReporter", "and", "kicks", "off", "the", "reporting", "goroutine", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/stats/storagestatsreporter.go#L36-L56
139,906
control-center/serviced
zzk/registry/vhost.go
NewVHostListener
func NewVHostListener(hostID string, handler VHostHandler) *VHostListener { return &VHostListener{ hostID: hostID, handler: handler, } }
go
func NewVHostListener(hostID string, handler VHostHandler) *VHostListener { return &VHostListener{ hostID: hostID, handler: handler, } }
[ "func", "NewVHostListener", "(", "hostID", "string", ",", "handler", "VHostHandler", ")", "*", "VHostListener", "{", "return", "&", "VHostListener", "{", "hostID", ":", "hostID", ",", "handler", ":", "handler", ",", "}", "\n", "}" ]
// NewVHostListener instantiates a new vhost listener
[ "NewVHostListener", "instantiates", "a", "new", "vhost", "listener" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/vhost.go#L56-L61
139,907
control-center/serviced
zzk/zzk.go
GetHostID
func GetHostID(leader client.Leader) (string, error) { var hl HostLeader if err := leader.Current(&hl); err != nil { return "", err } return hl.HostID, nil }
go
func GetHostID(leader client.Leader) (string, error) { var hl HostLeader if err := leader.Current(&hl); err != nil { return "", err } return hl.HostID, nil }
[ "func", "GetHostID", "(", "leader", "client", ".", "Leader", ")", "(", "string", ",", "error", ")", "{", "var", "hl", "HostLeader", "\n", "if", "err", ":=", "leader", ".", "Current", "(", "&", "hl", ")", ";", "err", "!=", "nil", "{", "return", "\""...
// GetHostID finds the host of a led node
[ "GetHostID", "finds", "the", "host", "of", "a", "led", "node" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/zzk.go#L47-L53
139,908
control-center/serviced
zzk/zzk.go
PathExists
func PathExists(conn client.Connection, p string) (bool, error) { exists, err := conn.Exists(p) if err == client.ErrNoNode { return false, nil } return exists, err }
go
func PathExists(conn client.Connection, p string) (bool, error) { exists, err := conn.Exists(p) if err == client.ErrNoNode { return false, nil } return exists, err }
[ "func", "PathExists", "(", "conn", "client", ".", "Connection", ",", "p", "string", ")", "(", "bool", ",", "error", ")", "{", "exists", ",", "err", ":=", "conn", ".", "Exists", "(", "p", ")", "\n", "if", "err", "==", "client", ".", "ErrNoNode", "{"...
// PathExists verifies if a path exists and does not raise an exception if the // path does not exist
[ "PathExists", "verifies", "if", "a", "path", "exists", "and", "does", "not", "raise", "an", "exception", "if", "the", "path", "does", "not", "exist" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/zzk.go#L120-L126
139,909
control-center/serviced
zzk/zzk.go
Ready
func Ready(shutdown <-chan interface{}, conn client.Connection, p string) error { ok, err := conn.Exists("/") if err != nil { return err } else if !ok { return client.ErrNoNode } done := make(chan struct{}) defer func() { close(done) }() for { ok, ev, err := conn.ExistsW(p, done) if err != nil { retu...
go
func Ready(shutdown <-chan interface{}, conn client.Connection, p string) error { ok, err := conn.Exists("/") if err != nil { return err } else if !ok { return client.ErrNoNode } done := make(chan struct{}) defer func() { close(done) }() for { ok, ev, err := conn.ExistsW(p, done) if err != nil { retu...
[ "func", "Ready", "(", "shutdown", "<-", "chan", "interface", "{", "}", ",", "conn", "client", ".", "Connection", ",", "p", "string", ")", "error", "{", "ok", ",", "err", ":=", "conn", ".", "Exists", "(", "\"", "\"", ")", "\n", "if", "err", "!=", ...
// Ready waits for a node to be available for watching
[ "Ready", "waits", "for", "a", "node", "to", "be", "available", "for", "watching" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/zzk.go#L129-L155
139,910
control-center/serviced
zzk/zzk.go
Start
func Start(shutdown <-chan interface{}, conn client.Connection, master Listener, listeners ...Listener) { // shutdown the parent and child listeners _shutdown := make(chan interface{}) // start the master masterDone := make(chan struct{}) defer func() { <-masterDone }() masterReady := make(chan error, 1) go fun...
go
func Start(shutdown <-chan interface{}, conn client.Connection, master Listener, listeners ...Listener) { // shutdown the parent and child listeners _shutdown := make(chan interface{}) // start the master masterDone := make(chan struct{}) defer func() { <-masterDone }() masterReady := make(chan error, 1) go fun...
[ "func", "Start", "(", "shutdown", "<-", "chan", "interface", "{", "}", ",", "conn", "client", ".", "Connection", ",", "master", "Listener", ",", "listeners", "...", "Listener", ")", "{", "// shutdown the parent and child listeners", "_shutdown", ":=", "make", "(...
// Start starts a group of listeners that are governed by a master listener. // When the master exits, it shuts down all of the child listeners and waits // for all of the subprocesses to exit
[ "Start", "starts", "a", "group", "of", "listeners", "that", "are", "governed", "by", "a", "master", "listener", ".", "When", "the", "master", "exits", "it", "shuts", "down", "all", "of", "the", "child", "listeners", "and", "waits", "for", "all", "of", "t...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/zzk.go#L246-L298
139,911
control-center/serviced
rpc/master/endpoint_server.go
GetServiceEndpoints
func (s *Server) GetServiceEndpoints(request *EndpointRequest, reply *[]applicationendpoint.EndpointReport) error { endpoints, err := s.f.GetServiceEndpoints(s.context(), request.ServiceIDs[0], request.ReportImports, request.ReportExports, request.Validate) if err != nil { return err } *reply = endpoints return...
go
func (s *Server) GetServiceEndpoints(request *EndpointRequest, reply *[]applicationendpoint.EndpointReport) error { endpoints, err := s.f.GetServiceEndpoints(s.context(), request.ServiceIDs[0], request.ReportImports, request.ReportExports, request.Validate) if err != nil { return err } *reply = endpoints return...
[ "func", "(", "s", "*", "Server", ")", "GetServiceEndpoints", "(", "request", "*", "EndpointRequest", ",", "reply", "*", "[", "]", "applicationendpoint", ".", "EndpointReport", ")", "error", "{", "endpoints", ",", "err", ":=", "s", ".", "f", ".", "GetServic...
// Get the endpoints for one or more services
[ "Get", "the", "endpoints", "for", "one", "or", "more", "services" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/endpoint_server.go#L29-L37
139,912
control-center/serviced
rpc/master/instance_client.go
StopServiceInstance
func (c *Client) StopServiceInstance(serviceID string, instanceID int) error { req := ServiceInstanceRequest{ ServiceID: serviceID, InstanceID: instanceID, } err := c.call("StopServiceInstance", req, new(string)) return err }
go
func (c *Client) StopServiceInstance(serviceID string, instanceID int) error { req := ServiceInstanceRequest{ ServiceID: serviceID, InstanceID: instanceID, } err := c.call("StopServiceInstance", req, new(string)) return err }
[ "func", "(", "c", "*", "Client", ")", "StopServiceInstance", "(", "serviceID", "string", ",", "instanceID", "int", ")", "error", "{", "req", ":=", "ServiceInstanceRequest", "{", "ServiceID", ":", "serviceID", ",", "InstanceID", ":", "instanceID", ",", "}", "...
// StopServiceInstance stops a service instance.
[ "StopServiceInstance", "stops", "a", "service", "instance", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/instance_client.go#L30-L37
139,913
control-center/serviced
rpc/master/instance_client.go
LocateServiceInstance
func (c *Client) LocateServiceInstance(serviceID string, instanceID int) (*service.LocationInstance, error) { req := ServiceInstanceRequest{ ServiceID: serviceID, InstanceID: instanceID, } resp := &service.LocationInstance{} err := c.call("LocateServiceInstance", req, resp) if err != nil { return nil, err ...
go
func (c *Client) LocateServiceInstance(serviceID string, instanceID int) (*service.LocationInstance, error) { req := ServiceInstanceRequest{ ServiceID: serviceID, InstanceID: instanceID, } resp := &service.LocationInstance{} err := c.call("LocateServiceInstance", req, resp) if err != nil { return nil, err ...
[ "func", "(", "c", "*", "Client", ")", "LocateServiceInstance", "(", "serviceID", "string", ",", "instanceID", "int", ")", "(", "*", "service", ".", "LocationInstance", ",", "error", ")", "{", "req", ":=", "ServiceInstanceRequest", "{", "ServiceID", ":", "ser...
// LocateServiceInstance returns the location of a service instance
[ "LocateServiceInstance", "returns", "the", "location", "of", "a", "service", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/instance_client.go#L40-L52
139,914
control-center/serviced
servicedversion/servicedversion.go
GetPackageRelease
func GetPackageRelease(pkg string) (string, error) { if utils.Platform == utils.Darwin { return "", nil } command := getCommandToGetPackageRelease(pkg) thecmd := exec.Command(command[0], command[1:]...) output, err := thecmd.CombinedOutput() if err != nil { e := fmt.Errorf("unable to retrieve release of pack...
go
func GetPackageRelease(pkg string) (string, error) { if utils.Platform == utils.Darwin { return "", nil } command := getCommandToGetPackageRelease(pkg) thecmd := exec.Command(command[0], command[1:]...) output, err := thecmd.CombinedOutput() if err != nil { e := fmt.Errorf("unable to retrieve release of pack...
[ "func", "GetPackageRelease", "(", "pkg", "string", ")", "(", "string", ",", "error", ")", "{", "if", "utils", ".", "Platform", "==", "utils", ".", "Darwin", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "command", ":=", "getCommandToGetPackag...
// GetPackageRelease returns the release version of the installed package
[ "GetPackageRelease", "returns", "the", "release", "version", "of", "the", "installed", "package" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/servicedversion/servicedversion.go#L73-L88
139,915
control-center/serviced
servicedversion/servicedversion.go
getCommandToGetPackageRelease
func getCommandToGetPackageRelease(pkg string) []string { command := []string{} if utils.Platform == utils.Rhel { command = []string{"bash", "-c", fmt.Sprintf("rpm -q --qf '%%{VERSION}-%%{Release}\n' %s", pkg)} } else { command = []string{"bash", "-o", "pipefail", "-c", fmt.Sprintf("dpkg -s %s | awk '/^Version/{...
go
func getCommandToGetPackageRelease(pkg string) []string { command := []string{} if utils.Platform == utils.Rhel { command = []string{"bash", "-c", fmt.Sprintf("rpm -q --qf '%%{VERSION}-%%{Release}\n' %s", pkg)} } else { command = []string{"bash", "-o", "pipefail", "-c", fmt.Sprintf("dpkg -s %s | awk '/^Version/{...
[ "func", "getCommandToGetPackageRelease", "(", "pkg", "string", ")", "[", "]", "string", "{", "command", ":=", "[", "]", "string", "{", "}", "\n", "if", "utils", ".", "Platform", "==", "utils", ".", "Rhel", "{", "command", "=", "[", "]", "string", "{", ...
// getCommandToGetPackageRelease returns the command to get the package release
[ "getCommandToGetPackageRelease", "returns", "the", "command", "to", "get", "the", "package", "release" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/servicedversion/servicedversion.go#L91-L100
139,916
control-center/serviced
web/crypt.go
crypt
func crypt(key, salt string) string { cdata := C.struct_crypt_data{} ckey := C.CString(key) csalt := C.CString(salt) result := C.GoString(C.crypt_r(ckey, csalt, &cdata)) C.free(unsafe.Pointer(ckey)) C.free(unsafe.Pointer(csalt)) return result }
go
func crypt(key, salt string) string { cdata := C.struct_crypt_data{} ckey := C.CString(key) csalt := C.CString(salt) result := C.GoString(C.crypt_r(ckey, csalt, &cdata)) C.free(unsafe.Pointer(ckey)) C.free(unsafe.Pointer(csalt)) return result }
[ "func", "crypt", "(", "key", ",", "salt", "string", ")", "string", "{", "cdata", ":=", "C", ".", "struct_crypt_data", "{", "}", "\n", "ckey", ":=", "C", ".", "CString", "(", "key", ")", "\n", "csalt", ":=", "C", ".", "CString", "(", "salt", ")", ...
// Wrapper for C library crypt_r // This function is here to support creating users with known passwords for integration tests.
[ "Wrapper", "for", "C", "library", "crypt_r", "This", "function", "is", "here", "to", "support", "creating", "users", "with", "known", "passwords", "for", "integration", "tests", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/crypt.go#L30-L38
139,917
control-center/serviced
zzk/registry/exportdetails.go
RegisterExport
func RegisterExport(shutdown <-chan struct{}, conn client.Connection, tenantID string, export ExportDetails) { logger := plog.WithFields(log.Fields{ "TenantID": tenantID, "Application": export.Application, "InstanceID": export.InstanceID, }) basepth := path.Join("/net/export", tenantID, export.Application...
go
func RegisterExport(shutdown <-chan struct{}, conn client.Connection, tenantID string, export ExportDetails) { logger := plog.WithFields(log.Fields{ "TenantID": tenantID, "Application": export.Application, "InstanceID": export.InstanceID, }) basepth := path.Join("/net/export", tenantID, export.Application...
[ "func", "RegisterExport", "(", "shutdown", "<-", "chan", "struct", "{", "}", ",", "conn", "client", ".", "Connection", ",", "tenantID", "string", ",", "export", "ExportDetails", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields"...
// RegisterExport exposes an exported endpoint
[ "RegisterExport", "exposes", "an", "exported", "endpoint" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/exportdetails.go#L47-L99
139,918
control-center/serviced
zzk/registry/exportdetails.go
TrackExports
func TrackExports(shutdown <-chan struct{}, conn client.Connection, tenantID, application string) <-chan []ExportDetails { exportsChan := make(chan []ExportDetails) go func() { defer close(exportsChan) // lets keep track of the binds that we have already looked up exportMap := make(map[string]ExportDetails) ...
go
func TrackExports(shutdown <-chan struct{}, conn client.Connection, tenantID, application string) <-chan []ExportDetails { exportsChan := make(chan []ExportDetails) go func() { defer close(exportsChan) // lets keep track of the binds that we have already looked up exportMap := make(map[string]ExportDetails) ...
[ "func", "TrackExports", "(", "shutdown", "<-", "chan", "struct", "{", "}", ",", "conn", "client", ".", "Connection", ",", "tenantID", ",", "application", "string", ")", "<-", "chan", "[", "]", "ExportDetails", "{", "exportsChan", ":=", "make", "(", "chan",...
// TrackExports keeps track of changes to the list of exports for given import
[ "TrackExports", "keeps", "track", "of", "changes", "to", "the", "list", "of", "exports", "for", "given", "import" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/registry/exportdetails.go#L102-L195
139,919
control-center/serviced
datastore/util.go
SafeUnmarshal
func SafeUnmarshal(data []byte, v interface{}) error { d := json.NewDecoder(bytes.NewReader(data)) d.UseNumber() return d.Decode(v) }
go
func SafeUnmarshal(data []byte, v interface{}) error { d := json.NewDecoder(bytes.NewReader(data)) d.UseNumber() return d.Decode(v) }
[ "func", "SafeUnmarshal", "(", "data", "[", "]", "byte", ",", "v", "interface", "{", "}", ")", "error", "{", "d", ":=", "json", ".", "NewDecoder", "(", "bytes", ".", "NewReader", "(", "data", ")", ")", "\n", "d", ".", "UseNumber", "(", ")", "\n", ...
//SafeUnmarshal sets the json decoder to use number types
[ "SafeUnmarshal", "sets", "the", "json", "decoder", "to", "use", "number", "types" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/datastore/util.go#L22-L26
139,920
control-center/serviced
rpc/agent/agent_client.go
NewClient
func NewClient(addr string) (*Client, error) { client, err := rpcutils.GetCachedClient(addr) if err != nil { return nil, err } s := new(Client) s.addr = addr s.rpcClient = client return s, nil }
go
func NewClient(addr string) (*Client, error) { client, err := rpcutils.GetCachedClient(addr) if err != nil { return nil, err } s := new(Client) s.addr = addr s.rpcClient = client return s, nil }
[ "func", "NewClient", "(", "addr", "string", ")", "(", "*", "Client", ",", "error", ")", "{", "client", ",", "err", ":=", "rpcutils", ".", "GetCachedClient", "(", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "...
// NewClient Create a new Client.
[ "NewClient", "Create", "a", "new", "Client", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/agent/agent_client.go#L30-L39
139,921
control-center/serviced
rpc/agent/agent_client.go
GetDockerLogs
func (c *Client) GetDockerLogs(dockerID string) (string, error) { var logs string err := c.rpcClient.Call("Agent.GetDockerLogs", dockerID, &logs, 0) return logs, err }
go
func (c *Client) GetDockerLogs(dockerID string) (string, error) { var logs string err := c.rpcClient.Call("Agent.GetDockerLogs", dockerID, &logs, 0) return logs, err }
[ "func", "(", "c", "*", "Client", ")", "GetDockerLogs", "(", "dockerID", "string", ")", "(", "string", ",", "error", ")", "{", "var", "logs", "string", "\n", "err", ":=", "c", ".", "rpcClient", ".", "Call", "(", "\"", "\"", ",", "dockerID", ",", "&"...
// GetDockerLogs returns the last 10k worth of logs from the docker container
[ "GetDockerLogs", "returns", "the", "last", "10k", "worth", "of", "logs", "from", "the", "docker", "container" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/agent/agent_client.go#L56-L60
139,922
control-center/serviced
rpc/agent/agent_client.go
PullImage
func (c *Client) PullImage(registry, image string, timeout time.Duration) (string, error) { req := PullImageRequest{ Registry: registry, Image: image, Timeout: timeout, } imageTag := "" err := c.rpcClient.Call("Agent.PullImage", req, &imageTag, 0) return imageTag, err }
go
func (c *Client) PullImage(registry, image string, timeout time.Duration) (string, error) { req := PullImageRequest{ Registry: registry, Image: image, Timeout: timeout, } imageTag := "" err := c.rpcClient.Call("Agent.PullImage", req, &imageTag, 0) return imageTag, err }
[ "func", "(", "c", "*", "Client", ")", "PullImage", "(", "registry", ",", "image", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "string", ",", "error", ")", "{", "req", ":=", "PullImageRequest", "{", "Registry", ":", "registry", ",", "Im...
// PullImage pulls the image from the provided registry and returns the local // image tag.
[ "PullImage", "pulls", "the", "image", "from", "the", "provided", "registry", "and", "returns", "the", "local", "image", "tag", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/agent/agent_client.go#L64-L73
139,923
control-center/serviced
cli/api/instance.go
StopServiceInstance
func (a *api) StopServiceInstance(serviceID string, instanceID int) error { client, err := a.connectMaster() if err != nil { return err } return client.StopServiceInstance(serviceID, instanceID) }
go
func (a *api) StopServiceInstance(serviceID string, instanceID int) error { client, err := a.connectMaster() if err != nil { return err } return client.StopServiceInstance(serviceID, instanceID) }
[ "func", "(", "a", "*", "api", ")", "StopServiceInstance", "(", "serviceID", "string", ",", "instanceID", "int", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", ...
// StopServiceInstance stops a running instance of a service.
[ "StopServiceInstance", "stops", "a", "running", "instance", "of", "a", "service", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/instance.go#L38-L44
139,924
control-center/serviced
cli/api/instance.go
AttachServiceInstance
func (a *api) AttachServiceInstance(serviceID string, instanceID int, command string, args []string) error { var ( targetHost string targetContainer string ) hostID, err := utils.HostID() if err != nil { return err } client, err := a.connectMaster() if err != nil { return err } // get the locat...
go
func (a *api) AttachServiceInstance(serviceID string, instanceID int, command string, args []string) error { var ( targetHost string targetContainer string ) hostID, err := utils.HostID() if err != nil { return err } client, err := a.connectMaster() if err != nil { return err } // get the locat...
[ "func", "(", "a", "*", "api", ")", "AttachServiceInstance", "(", "serviceID", "string", ",", "instanceID", "int", ",", "command", "string", ",", "args", "[", "]", "string", ")", "error", "{", "var", "(", "targetHost", "string", "\n", "targetContainer", "st...
// AttachServiceInstance locates and attaches to a running instance of a service
[ "AttachServiceInstance", "locates", "and", "attaches", "to", "a", "running", "instance", "of", "a", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/instance.go#L47-L92
139,925
control-center/serviced
cli/api/instance.go
LogsForServiceInstance
func (a *api) LogsForServiceInstance(serviceID string, instanceID int, command string, args []string) error { client, err := a.connectMaster() if err != nil { return err } // get the location of the running instance location, err := client.LocateServiceInstance(serviceID, instanceID) if err != nil { return e...
go
func (a *api) LogsForServiceInstance(serviceID string, instanceID int, command string, args []string) error { client, err := a.connectMaster() if err != nil { return err } // get the location of the running instance location, err := client.LocateServiceInstance(serviceID, instanceID) if err != nil { return e...
[ "func", "(", "a", "*", "api", ")", "LogsForServiceInstance", "(", "serviceID", "string", ",", "instanceID", "int", ",", "command", "string", ",", "args", "[", "]", "string", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ...
// LogsForServiceInstance returns the logs for the service instance
[ "LogsForServiceInstance", "returns", "the", "logs", "for", "the", "service", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/instance.go#L95-L134
139,926
control-center/serviced
cli/api/instance.go
SendDockerAction
func (a *api) SendDockerAction(serviceID string, instanceID int, action string, args []string) error { client, err := a.connectMaster() if err != nil { return err } return client.SendDockerAction(serviceID, instanceID, action, args) }
go
func (a *api) SendDockerAction(serviceID string, instanceID int, action string, args []string) error { client, err := a.connectMaster() if err != nil { return err } return client.SendDockerAction(serviceID, instanceID, action, args) }
[ "func", "(", "a", "*", "api", ")", "SendDockerAction", "(", "serviceID", "string", ",", "instanceID", "int", ",", "action", "string", ",", "args", "[", "]", "string", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", ...
// SendDockerAction submits an action to a running service instance
[ "SendDockerAction", "submits", "an", "action", "to", "a", "running", "service", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/instance.go#L137-L144
139,927
control-center/serviced
proxy/registry.go
NewProxyRegistry
func NewProxyRegistry(factory ProxyFactory) ProxyRegistry { return &proxyRegistry{ registry: make(map[string]Proxy), proxyFactory: factory, } }
go
func NewProxyRegistry(factory ProxyFactory) ProxyRegistry { return &proxyRegistry{ registry: make(map[string]Proxy), proxyFactory: factory, } }
[ "func", "NewProxyRegistry", "(", "factory", "ProxyFactory", ")", "ProxyRegistry", "{", "return", "&", "proxyRegistry", "{", "registry", ":", "make", "(", "map", "[", "string", "]", "Proxy", ")", ",", "proxyFactory", ":", "factory", ",", "}", "\n", "}" ]
// NewProxyRegistry Create a new ProxyRegistry using the supplied ProxyFactory
[ "NewProxyRegistry", "Create", "a", "new", "ProxyRegistry", "using", "the", "supplied", "ProxyFactory" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/proxy/registry.go#L57-L62
139,928
control-center/serviced
proxy/registry.go
proxyFactory
func proxyFactory(protocol string, frontend ProxyAddress, backends ...ProxyAddress) (Proxy, error) { if len(backends) == 0 { return nil, errors.New("default proxy only requies one backend") } if len(backends) > 1 { return nil, errors.New("default proxy only supports one backend") } backendIP := net.ParseIP(b...
go
func proxyFactory(protocol string, frontend ProxyAddress, backends ...ProxyAddress) (Proxy, error) { if len(backends) == 0 { return nil, errors.New("default proxy only requies one backend") } if len(backends) > 1 { return nil, errors.New("default proxy only supports one backend") } backendIP := net.ParseIP(b...
[ "func", "proxyFactory", "(", "protocol", "string", ",", "frontend", "ProxyAddress", ",", "backends", "...", "ProxyAddress", ")", "(", "Proxy", ",", "error", ")", "{", "if", "len", "(", "backends", ")", "==", "0", "{", "return", "nil", ",", "errors", ".",...
//proxyFactory creates docker proxy implementations
[ "proxyFactory", "creates", "docker", "proxy", "implementations" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/proxy/registry.go#L110-L149
139,929
control-center/serviced
domain/logfilter/store.go
Get
func (s *storeImpl) Get(ctx datastore.Context, name, version string) (*LogFilter, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("LogFilterStore.Get")) val := &LogFilter{} if err := s.ds.Get(ctx, Key(name, version), val); err != nil { return nil, err } return val, nil }
go
func (s *storeImpl) Get(ctx datastore.Context, name, version string) (*LogFilter, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("LogFilterStore.Get")) val := &LogFilter{} if err := s.ds.Get(ctx, Key(name, version), val); err != nil { return nil, err } return val, nil }
[ "func", "(", "s", "*", "storeImpl", ")", "Get", "(", "ctx", "datastore", ".", "Context", ",", "name", ",", "version", "string", ")", "(", "*", "LogFilter", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ...
// Get a LogFilter by id. Return ErrNoSuchEntity if not found
[ "Get", "a", "LogFilter", "by", "id", ".", "Return", "ErrNoSuchEntity", "if", "not", "found" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/logfilter/store.go#L50-L57
139,930
control-center/serviced
domain/logfilter/store.go
Key
func Key(name, version string) datastore.Key { name = strings.TrimSpace(name) version = strings.TrimSpace(version) return datastore.NewKey(kind, buildID(name, version)) }
go
func Key(name, version string) datastore.Key { name = strings.TrimSpace(name) version = strings.TrimSpace(version) return datastore.NewKey(kind, buildID(name, version)) }
[ "func", "Key", "(", "name", ",", "version", "string", ")", "datastore", ".", "Key", "{", "name", "=", "strings", ".", "TrimSpace", "(", "name", ")", "\n", "version", "=", "strings", ".", "TrimSpace", "(", "version", ")", "\n", "return", "datastore", "....
//Key creates a Key suitable for getting, putting and deleting LogFilters
[ "Key", "creates", "a", "Key", "suitable", "for", "getting", "putting", "and", "deleting", "LogFilters" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/logfilter/store.go#L84-L88
139,931
control-center/serviced
dfs/override.go
Override
func (dfs *DistributedFilesystem) Override(newimg, oldimg string) error { // make sure the old image exists oldImage, err := dfs.index.FindImage(oldimg) if err != nil { glog.Errorf("Could not find image %s in registry: %s", oldimg, err) return err } // make sure the new image exists newImage, err := dfs.doc...
go
func (dfs *DistributedFilesystem) Override(newimg, oldimg string) error { // make sure the old image exists oldImage, err := dfs.index.FindImage(oldimg) if err != nil { glog.Errorf("Could not find image %s in registry: %s", oldimg, err) return err } // make sure the new image exists newImage, err := dfs.doc...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "Override", "(", "newimg", ",", "oldimg", "string", ")", "error", "{", "// make sure the old image exists", "oldImage", ",", "err", ":=", "dfs", ".", "index", ".", "FindImage", "(", "oldimg", ")", "\n", ...
// Override replaces an image in the docker registry with a new image // and updates the registry.
[ "Override", "replaces", "an", "image", "in", "the", "docker", "registry", "with", "a", "new", "image", "and", "updates", "the", "registry", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/override.go#L22-L50
139,932
control-center/serviced
domain/properties/properties.go
CCVersion
func (s *StoredProperties) CCVersion() (string, bool) { val, ok := s.Props[CCVERSION] return val, ok }
go
func (s *StoredProperties) CCVersion() (string, bool) { val, ok := s.Props[CCVERSION] return val, ok }
[ "func", "(", "s", "*", "StoredProperties", ")", "CCVersion", "(", ")", "(", "string", ",", "bool", ")", "{", "val", ",", "ok", ":=", "s", ".", "Props", "[", "CCVERSION", "]", "\n", "return", "val", ",", "ok", "\n", "}" ]
// CCVersion returns the CC version property
[ "CCVersion", "returns", "the", "CC", "version", "property" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/properties/properties.go#L40-L43
139,933
control-center/serviced
cli/cmd/pool.go
pools
func (c *ServicedCli) pools() (data []string) { pools, err := c.driver.GetResourcePools() if err != nil || pools == nil || len(pools) == 0 { return } data = make([]string, len(pools)) for i, p := range pools { data[i] = p.ID } return }
go
func (c *ServicedCli) pools() (data []string) { pools, err := c.driver.GetResourcePools() if err != nil || pools == nil || len(pools) == 0 { return } data = make([]string, len(pools)) for i, p := range pools { data[i] = p.ID } return }
[ "func", "(", "c", "*", "ServicedCli", ")", "pools", "(", ")", "(", "data", "[", "]", "string", ")", "{", "pools", ",", "err", ":=", "c", ".", "driver", ".", "GetResourcePools", "(", ")", "\n", "if", "err", "!=", "nil", "||", "pools", "==", "nil",...
// Returns a list of available pools
[ "Returns", "a", "list", "of", "available", "pools" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L133-L145
139,934
control-center/serviced
cli/cmd/pool.go
printPoolsFirst
func (c *ServicedCli) printPoolsFirst(ctx *cli.Context) { if len(ctx.Args()) > 0 { return } fmt.Println(strings.Join(c.pools(), "\n")) }
go
func (c *ServicedCli) printPoolsFirst(ctx *cli.Context) { if len(ctx.Args()) > 0 { return } fmt.Println(strings.Join(c.pools(), "\n")) }
[ "func", "(", "c", "*", "ServicedCli", ")", "printPoolsFirst", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "0", "{", "return", "\n", "}", "\n", "fmt", ".", "Println", "(", "strings", ...
// Bash-completion command that prints the list of available pools as the // first argument
[ "Bash", "-", "completion", "command", "that", "prints", "the", "list", "of", "available", "pools", "as", "the", "first", "argument" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L149-L154
139,935
control-center/serviced
cli/cmd/pool.go
printPoolsAll
func (c *ServicedCli) printPoolsAll(ctx *cli.Context) { args := ctx.Args() pools := c.pools() for _, p := range pools { for _, a := range args { if p == a { goto next } } fmt.Println(p) next: } }
go
func (c *ServicedCli) printPoolsAll(ctx *cli.Context) { args := ctx.Args() pools := c.pools() for _, p := range pools { for _, a := range args { if p == a { goto next } } fmt.Println(p) next: } }
[ "func", "(", "c", "*", "ServicedCli", ")", "printPoolsAll", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "pools", ":=", "c", ".", "pools", "(", ")", "\n\n", "for", "_", ",", "p", ":=", "ran...
// Bash-completion command that prints the list of available pools as all // arguments
[ "Bash", "-", "completion", "command", "that", "prints", "the", "list", "of", "available", "pools", "as", "all", "arguments" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L158-L171
139,936
control-center/serviced
cli/cmd/pool.go
cmdPoolAdd
func (c *ServicedCli) cmdPoolAdd(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "add") return } cfg := api.PoolConfig{} cfg.PoolID = args[0] /* Disabled until enforced. See ZEN-11450 cfg.CoreLimit, err = strconv.Atoi(args[1]) if err ...
go
func (c *ServicedCli) cmdPoolAdd(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "add") return } cfg := api.PoolConfig{} cfg.PoolID = args[0] /* Disabled until enforced. See ZEN-11450 cfg.CoreLimit, err = strconv.Atoi(args[1]) if err ...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdPoolAdd", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "<", "1", "{", "fmt", ".", "Printf", "(", "\"", "\\n", ...
// serviced pool add POOLID
[ "serviced", "pool", "add", "POOLID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L225-L271
139,937
control-center/serviced
cli/cmd/pool.go
cmdPoolRemove
func (c *ServicedCli) cmdPoolRemove(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "remove") } for _, id := range args { if p, err := c.driver.GetResourcePool(id); err != nil { fmt.Fprintf(os.Stderr, "%s: %s\n", id, err) } else if p ...
go
func (c *ServicedCli) cmdPoolRemove(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "remove") } for _, id := range args { if p, err := c.driver.GetResourcePool(id); err != nil { fmt.Fprintf(os.Stderr, "%s: %s\n", id, err) } else if p ...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdPoolRemove", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "<", "1", "{", "fmt", ".", "Printf", "(", "\"", "\\n"...
// serviced pool remove POOLID ...
[ "serviced", "pool", "remove", "POOLID", "..." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L274-L292
139,938
control-center/serviced
cli/cmd/pool.go
cmdPoolListIPs
func (c *ServicedCli) cmdPoolListIPs(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "list-ips") return } if poolIps, err := c.driver.GetPoolIPs(args[0]); err != nil { fmt.Fprintln(os.Stderr, err) return } else if poolIps.HostIPs == n...
go
func (c *ServicedCli) cmdPoolListIPs(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "list-ips") return } if poolIps, err := c.driver.GetPoolIPs(args[0]); err != nil { fmt.Fprintln(os.Stderr, err) return } else if poolIps.HostIPs == n...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdPoolListIPs", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "<", "1", "{", "fmt", ".", "Printf", "(", "\"", "\\n...
// serviced pool list-ips POOLID
[ "serviced", "pool", "list", "-", "ips", "POOLID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L295-L334
139,939
control-center/serviced
cli/cmd/pool.go
cmdAddVirtualIP
func (c *ServicedCli) cmdAddVirtualIP(ctx *cli.Context) { args := ctx.Args() if len(args) != 4 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "add-virtual-ip") return } requestVirtualIP := pool.VirtualIP{PoolID: args[0], IP: args[1], Netmask: args[2], BindInterface: args[3]} if err := c.drive...
go
func (c *ServicedCli) cmdAddVirtualIP(ctx *cli.Context) { args := ctx.Args() if len(args) != 4 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "add-virtual-ip") return } requestVirtualIP := pool.VirtualIP{PoolID: args[0], IP: args[1], Netmask: args[2], BindInterface: args[3]} if err := c.drive...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdAddVirtualIP", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "!=", "4", "{", "fmt", ".", "Printf", "(", "\"", "\...
// serviced pool add-virtual-ip POOLID IPADDRESS NETMASK BINDINTERFACE
[ "serviced", "pool", "add", "-", "virtual", "-", "ip", "POOLID", "IPADDRESS", "NETMASK", "BINDINTERFACE" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L337-L352
139,940
control-center/serviced
cli/cmd/pool.go
cmdSetConnTimeout
func (c *ServicedCli) cmdSetConnTimeout(ctx *cli.Context) { args := ctx.Args() if len(args) != 2 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "set-conn-timeout") return } connTimeout, err := time.ParseDuration(args[1]) if err != nil { fmt.Fprintf(os.Stderr, "could not parse duration: %s\n...
go
func (c *ServicedCli) cmdSetConnTimeout(ctx *cli.Context) { args := ctx.Args() if len(args) != 2 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "set-conn-timeout") return } connTimeout, err := time.ParseDuration(args[1]) if err != nil { fmt.Fprintf(os.Stderr, "could not parse duration: %s\n...
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdSetConnTimeout", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "!=", "2", "{", "fmt", ".", "Printf", "(", "\"", ...
// serviced pool set-conn-timeout POOLID TIMEOUT
[ "serviced", "pool", "set", "-", "conn", "-", "timeout", "POOLID", "TIMEOUT" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/pool.go#L373-L404
139,941
control-center/serviced
tools/serviced-storage/volume.go
Execute
func (c *DriverSync) Execute(args []string) error { App.initializeLogging() destinationPath := string(c.Args.DestinationPath) sourcePath := string(c.Args.SourcePath) logger := log.WithFields(log.Fields{ "destination": destinationPath, "source": sourcePath}) if c.Create { logger = logger.WithFields(log.F...
go
func (c *DriverSync) Execute(args []string) error { App.initializeLogging() destinationPath := string(c.Args.DestinationPath) sourcePath := string(c.Args.SourcePath) logger := log.WithFields(log.Fields{ "destination": destinationPath, "source": sourcePath}) if c.Create { logger = logger.WithFields(log.F...
[ "func", "(", "c", "*", "DriverSync", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "destinationPath", ":=", "string", "(", "c", ".", "Args", ".", "DestinationPath", ")", "\n", "sour...
//Execute syncs to volume
[ "Execute", "syncs", "to", "volume" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/volume.go#L61-L120
139,942
control-center/serviced
tools/serviced-storage/volume.go
createVolume
func createVolume(path string, name string) { directory := GetDefaultDriver(path) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger := log.WithFields(log.Fields{ "directory": driver.Root(), "type": driver.DriverType(), "volume": name, }) logger.Info("Creating vo...
go
func createVolume(path string, name string) { directory := GetDefaultDriver(path) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger := log.WithFields(log.Fields{ "directory": driver.Root(), "type": driver.DriverType(), "volume": name, }) logger.Info("Creating vo...
[ "func", "createVolume", "(", "path", "string", ",", "name", "string", ")", "{", "directory", ":=", "GetDefaultDriver", "(", "path", ")", "\n", "driver", ",", "err", ":=", "InitDriverIfExists", "(", "directory", ")", "\n", "if", "err", "!=", "nil", "{", "...
//CreateVolume creates a volume at path with name of name
[ "CreateVolume", "creates", "a", "volume", "at", "path", "with", "name", "of", "name" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/volume.go#L136-L155
139,943
control-center/serviced
tools/serviced-storage/volume.go
Execute
func (c *VolumeCreate) Execute(args []string) error { App.initializeLogging() createVolume(string(c.Path), c.Args.Name) return nil }
go
func (c *VolumeCreate) Execute(args []string) error { App.initializeLogging() createVolume(string(c.Path), c.Args.Name) return nil }
[ "func", "(", "c", "*", "VolumeCreate", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "createVolume", "(", "string", "(", "c", ".", "Path", ")", ",", "c", ".", "Args", ".", "Name...
// Execute creates a new volume on a driver
[ "Execute", "creates", "a", "new", "volume", "on", "a", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/volume.go#L167-L171
139,944
control-center/serviced
tools/serviced-storage/volume.go
Execute
func (c *VolumeMount) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Path)) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger := log.WithFields(log.Fields{ "directory": driver.Root(), "type": driver.DriverType(), "volum...
go
func (c *VolumeMount) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Path)) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger := log.WithFields(log.Fields{ "directory": driver.Root(), "type": driver.DriverType(), "volum...
[ "func", "(", "c", "*", "VolumeMount", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "directory", ":=", "GetDefaultDriver", "(", "string", "(", "c", ".", "Path", ")", ")", "\n", "d...
// Execute mounts an existing volume from a driver
[ "Execute", "mounts", "an", "existing", "volume", "from", "a", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/volume.go#L174-L195
139,945
control-center/serviced
tools/serviced-storage/volume.go
Execute
func (c *VolumeResize) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Path)) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger := log.WithFields(log.Fields{ "directory": driver.Root(), "volume": c.Args.Name, "type": ...
go
func (c *VolumeResize) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Path)) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger := log.WithFields(log.Fields{ "directory": driver.Root(), "volume": c.Args.Name, "type": ...
[ "func", "(", "c", "*", "VolumeResize", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "directory", ":=", "GetDefaultDriver", "(", "string", "(", "c", ".", "Path", ")", ")", "\n", "...
// Resize increases the space available to an existing volume
[ "Resize", "increases", "the", "space", "available", "to", "an", "existing", "volume" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/volume.go#L222-L249
139,946
control-center/serviced
dfs/commit.go
Commit
func (dfs *DistributedFilesystem) Commit(ctrID string) (string, error) { ctr, err := dfs.docker.FindContainer(ctrID) if err != nil { glog.Errorf("Could not find container %s: %s", ctrID, err) return "", err } // do not commit if the container is running if ctr.State.Running { return "", ErrRunningContainer ...
go
func (dfs *DistributedFilesystem) Commit(ctrID string) (string, error) { ctr, err := dfs.docker.FindContainer(ctrID) if err != nil { glog.Errorf("Could not find container %s: %s", ctrID, err) return "", err } // do not commit if the container is running if ctr.State.Running { return "", ErrRunningContainer ...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "Commit", "(", "ctrID", "string", ")", "(", "string", ",", "error", ")", "{", "ctr", ",", "err", ":=", "dfs", ".", "docker", ".", "FindContainer", "(", "ctrID", ")", "\n", "if", "err", "!=", "nil...
// Commit commits a container spawned from the latest docker registry image // and updates the registry. Returns the affected registry image.
[ "Commit", "commits", "a", "container", "spawned", "from", "the", "latest", "docker", "registry", "image", "and", "updates", "the", "registry", ".", "Returns", "the", "affected", "registry", "image", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/commit.go#L33-L71
139,947
control-center/serviced
datastore/elastic/driver.go
New
func New(host string, port uint16, index string) ElasticDriver { return newDriver(host, port, index) }
go
func New(host string, port uint16, index string) ElasticDriver { return newDriver(host, port, index) }
[ "func", "New", "(", "host", "string", ",", "port", "uint16", ",", "index", "string", ")", "ElasticDriver", "{", "return", "newDriver", "(", "host", ",", "port", ",", "index", ")", "\n", "}" ]
// New creates a new ElasticDriver
[ "New", "creates", "a", "new", "ElasticDriver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/datastore/elastic/driver.go#L41-L43
139,948
control-center/serviced
cli/api/pool.go
GetResourcePools
func (a *api) GetResourcePools() ([]pool.ResourcePool, error) { client, err := a.connectMaster() if err != nil { return nil, err } return client.GetResourcePools() }
go
func (a *api) GetResourcePools() ([]pool.ResourcePool, error) { client, err := a.connectMaster() if err != nil { return nil, err } return client.GetResourcePools() }
[ "func", "(", "a", "*", "api", ")", "GetResourcePools", "(", ")", "(", "[", "]", "pool", ".", "ResourcePool", ",", "error", ")", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "...
// Returns a list of all pools
[ "Returns", "a", "list", "of", "all", "pools" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L34-L41
139,949
control-center/serviced
cli/api/pool.go
GetResourcePool
func (a *api) GetResourcePool(id string) (*pool.ResourcePool, error) { client, err := a.connectMaster() if err != nil { return nil, err } return client.GetResourcePool(id) }
go
func (a *api) GetResourcePool(id string) (*pool.ResourcePool, error) { client, err := a.connectMaster() if err != nil { return nil, err } return client.GetResourcePool(id) }
[ "func", "(", "a", "*", "api", ")", "GetResourcePool", "(", "id", "string", ")", "(", "*", "pool", ".", "ResourcePool", ",", "error", ")", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "...
// Gets information about a pool given a PoolID
[ "Gets", "information", "about", "a", "pool", "given", "a", "PoolID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L44-L51
139,950
control-center/serviced
cli/api/pool.go
AddResourcePool
func (a *api) AddResourcePool(config PoolConfig) (*pool.ResourcePool, error) { client, err := a.connectMaster() if err != nil { return nil, err } p := pool.ResourcePool{ ID: config.PoolID, Realm: config.Realm, CoreLimit: config.CoreLimit, MemoryLimit: config.MemoryLimit, Permissions: c...
go
func (a *api) AddResourcePool(config PoolConfig) (*pool.ResourcePool, error) { client, err := a.connectMaster() if err != nil { return nil, err } p := pool.ResourcePool{ ID: config.PoolID, Realm: config.Realm, CoreLimit: config.CoreLimit, MemoryLimit: config.MemoryLimit, Permissions: c...
[ "func", "(", "a", "*", "api", ")", "AddResourcePool", "(", "config", "PoolConfig", ")", "(", "*", "pool", ".", "ResourcePool", ",", "error", ")", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", ...
// Adds a new pool
[ "Adds", "a", "new", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L54-L73
139,951
control-center/serviced
cli/api/pool.go
RemoveResourcePool
func (a *api) RemoveResourcePool(id string) error { client, err := a.connectMaster() if err != nil { return err } return client.RemoveResourcePool(id) }
go
func (a *api) RemoveResourcePool(id string) error { client, err := a.connectMaster() if err != nil { return err } return client.RemoveResourcePool(id) }
[ "func", "(", "a", "*", "api", ")", "RemoveResourcePool", "(", "id", "string", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "cl...
// Removes an existing pool
[ "Removes", "an", "existing", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L76-L83
139,952
control-center/serviced
cli/api/pool.go
UpdateResourcePool
func (a *api) UpdateResourcePool(pool pool.ResourcePool) error { client, err := a.connectMaster() if err != nil { return err } return client.UpdateResourcePool(pool) }
go
func (a *api) UpdateResourcePool(pool pool.ResourcePool) error { client, err := a.connectMaster() if err != nil { return err } return client.UpdateResourcePool(pool) }
[ "func", "(", "a", "*", "api", ")", "UpdateResourcePool", "(", "pool", "pool", ".", "ResourcePool", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", ...
// Updates an existing pool
[ "Updates", "an", "existing", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L86-L93
139,953
control-center/serviced
cli/api/pool.go
GetPoolIPs
func (a *api) GetPoolIPs(id string) (*pool.PoolIPs, error) { client, err := a.connectMaster() if err != nil { return nil, err } return client.GetPoolIPs(id) }
go
func (a *api) GetPoolIPs(id string) (*pool.PoolIPs, error) { client, err := a.connectMaster() if err != nil { return nil, err } return client.GetPoolIPs(id) }
[ "func", "(", "a", "*", "api", ")", "GetPoolIPs", "(", "id", "string", ")", "(", "*", "pool", ".", "PoolIPs", ",", "error", ")", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// Returns a list of Host IPs for a given pool
[ "Returns", "a", "list", "of", "Host", "IPs", "for", "a", "given", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L96-L103
139,954
control-center/serviced
cli/api/pool.go
AddVirtualIP
func (a *api) AddVirtualIP(requestVirtualIP pool.VirtualIP) error { client, err := a.connectMaster() if err != nil { return err } return client.AddVirtualIP(requestVirtualIP) }
go
func (a *api) AddVirtualIP(requestVirtualIP pool.VirtualIP) error { client, err := a.connectMaster() if err != nil { return err } return client.AddVirtualIP(requestVirtualIP) }
[ "func", "(", "a", "*", "api", ")", "AddVirtualIP", "(", "requestVirtualIP", "pool", ".", "VirtualIP", ")", "error", "{", "client", ",", "err", ":=", "a", ".", "connectMaster", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}",...
// Add a VirtualIP to a specific pool
[ "Add", "a", "VirtualIP", "to", "a", "specific", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/pool.go#L106-L113
139,955
control-center/serviced
cli/cmd/config.go
initConfig
func (c *ServicedCli) initConfig() { c.app.Commands = append(c.app.Commands, cli.Command{ Name: "config", Usage: "Reports on serviced configuration", Description: "serviced config", Action: c.cmdConfig, }) }
go
func (c *ServicedCli) initConfig() { c.app.Commands = append(c.app.Commands, cli.Command{ Name: "config", Usage: "Reports on serviced configuration", Description: "serviced config", Action: c.cmdConfig, }) }
[ "func", "(", "c", "*", "ServicedCli", ")", "initConfig", "(", ")", "{", "c", ".", "app", ".", "Commands", "=", "append", "(", "c", ".", "app", ".", "Commands", ",", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "...
// Initializer for serviced config subcommands
[ "Initializer", "for", "serviced", "config", "subcommands" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/config.go#L24-L31
139,956
control-center/serviced
utils/valuechangepublisher.go
NewValueChangePublisher
func NewValueChangePublisher(initialValue interface{}) ValueChangePublisher { return ValueChangePublisher{ value: initialValue, mutex: sync.RWMutex{}, notify: make(chan struct{}), } }
go
func NewValueChangePublisher(initialValue interface{}) ValueChangePublisher { return ValueChangePublisher{ value: initialValue, mutex: sync.RWMutex{}, notify: make(chan struct{}), } }
[ "func", "NewValueChangePublisher", "(", "initialValue", "interface", "{", "}", ")", "ValueChangePublisher", "{", "return", "ValueChangePublisher", "{", "value", ":", "initialValue", ",", "mutex", ":", "sync", ".", "RWMutex", "{", "}", ",", "notify", ":", "make",...
// Returns a new ValueChangePublisher
[ "Returns", "a", "new", "ValueChangePublisher" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/valuechangepublisher.go#L27-L33
139,957
control-center/serviced
utils/valuechangepublisher.go
Set
func (v *ValueChangePublisher) Set(value interface{}) { v.mutex.Lock() defer v.mutex.Unlock() v.value = value close(v.notify) v.notify = make(chan struct{}) }
go
func (v *ValueChangePublisher) Set(value interface{}) { v.mutex.Lock() defer v.mutex.Unlock() v.value = value close(v.notify) v.notify = make(chan struct{}) }
[ "func", "(", "v", "*", "ValueChangePublisher", ")", "Set", "(", "value", "interface", "{", "}", ")", "{", "v", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "mutex", ".", "Unlock", "(", ")", "\n", "v", ".", "value", "=", "value", ...
// Set closes the current channel notifying current subscribers of a change // and stores the value.
[ "Set", "closes", "the", "current", "channel", "notifying", "current", "subscribers", "of", "a", "change", "and", "stores", "the", "value", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/valuechangepublisher.go#L37-L43
139,958
control-center/serviced
utils/valuechangepublisher.go
Get
func (v *ValueChangePublisher) Get() (interface{}, <-chan struct{}) { v.mutex.RLock() defer v.mutex.RUnlock() return v.value, v.notify }
go
func (v *ValueChangePublisher) Get() (interface{}, <-chan struct{}) { v.mutex.RLock() defer v.mutex.RUnlock() return v.value, v.notify }
[ "func", "(", "v", "*", "ValueChangePublisher", ")", "Get", "(", ")", "(", "interface", "{", "}", ",", "<-", "chan", "struct", "{", "}", ")", "{", "v", ".", "mutex", ".", "RLock", "(", ")", "\n", "defer", "v", ".", "mutex", ".", "RUnlock", "(", ...
// Get returns the current value of the publisher and a channel that will // be closed when the value changes.
[ "Get", "returns", "the", "current", "value", "of", "the", "publisher", "and", "a", "channel", "that", "will", "be", "closed", "when", "the", "value", "changes", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/valuechangepublisher.go#L47-L51
139,959
control-center/serviced
facade/registry.go
GetRegistryImages
func (f *Facade) GetRegistryImages(ctx datastore.Context) ([]registry.Image, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetRegistryImages")) rImages, err := f.registryStore.GetImages(ctx) if err != nil { return nil, err } return rImages, nil }
go
func (f *Facade) GetRegistryImages(ctx datastore.Context) ([]registry.Image, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetRegistryImages")) rImages, err := f.registryStore.GetImages(ctx) if err != nil { return nil, err } return rImages, nil }
[ "func", "(", "f", "*", "Facade", ")", "GetRegistryImages", "(", "ctx", "datastore", ".", "Context", ")", "(", "[", "]", "registry", ".", "Image", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metri...
// GetRegistryImages returns all the image that are in the docker registry // index.
[ "GetRegistryImages", "returns", "all", "the", "image", "that", "are", "in", "the", "docker", "registry", "index", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/registry.go#L63-L70
139,960
control-center/serviced
facade/registry.go
SyncRegistryImages
func (f *Facade) SyncRegistryImages(ctx datastore.Context, force bool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.SyncRegistryImages")) if err := f.DFSLock(ctx).LockWithTimeout("sync registry images", userLockTimeout); err != nil { glog.Warningf("Cannot sync registry images: %s", err) return err...
go
func (f *Facade) SyncRegistryImages(ctx datastore.Context, force bool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.SyncRegistryImages")) if err := f.DFSLock(ctx).LockWithTimeout("sync registry images", userLockTimeout); err != nil { glog.Warningf("Cannot sync registry images: %s", err) return err...
[ "func", "(", "f", "*", "Facade", ")", "SyncRegistryImages", "(", "ctx", "datastore", ".", "Context", ",", "force", "bool", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", ...
// SyncRegistryImages makes sure images on es are in sync with zk. If force is // enabled, all images are reset.
[ "SyncRegistryImages", "makes", "sure", "images", "on", "es", "are", "in", "sync", "with", "zk", ".", "If", "force", "is", "enabled", "all", "images", "are", "reset", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/registry.go#L86-L117
139,961
control-center/serviced
shell/server.go
NewProcessExecutorServer
func NewProcessExecutorServer(masterAddress, agentAddress, dockerRegistry, controllerBinary string) *ProcessServer { server := &ProcessServer{ sio: socketio.NewSocketIOServer(&socketio.Config{}), actor: &Executor{masterAddress: masterAddress, agentAddress: agentAddress, dockerRegistry: dockerRegistry, controller...
go
func NewProcessExecutorServer(masterAddress, agentAddress, dockerRegistry, controllerBinary string) *ProcessServer { server := &ProcessServer{ sio: socketio.NewSocketIOServer(&socketio.Config{}), actor: &Executor{masterAddress: masterAddress, agentAddress: agentAddress, dockerRegistry: dockerRegistry, controller...
[ "func", "NewProcessExecutorServer", "(", "masterAddress", ",", "agentAddress", ",", "dockerRegistry", ",", "controllerBinary", "string", ")", "*", "ProcessServer", "{", "server", ":=", "&", "ProcessServer", "{", "sio", ":", "socketio", ".", "NewSocketIOServer", "(",...
// NewProcessExecutorServer - Create and return a processServer instance
[ "NewProcessExecutorServer", "-", "Create", "and", "return", "a", "processServer", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/shell/server.go#L64-L75
139,962
control-center/serviced
shell/server.go
StartDocker
func StartDocker(cfg *ProcessConfig, masterAddress, workerAddress, dockerRegistry, controller string) (*exec.Cmd, error) { logger := plog.WithFields(log.Fields{ "masteraddress": masterAddress, "delegateaddress": workerAddress, "serviceid": cfg.ServiceID, }) // look up the service on the master master...
go
func StartDocker(cfg *ProcessConfig, masterAddress, workerAddress, dockerRegistry, controller string) (*exec.Cmd, error) { logger := plog.WithFields(log.Fields{ "masteraddress": masterAddress, "delegateaddress": workerAddress, "serviceid": cfg.ServiceID, }) // look up the service on the master master...
[ "func", "StartDocker", "(", "cfg", "*", "ProcessConfig", ",", "masterAddress", ",", "workerAddress", ",", "dockerRegistry", ",", "controller", "string", ")", "(", "*", "exec", ".", "Cmd", ",", "error", ")", "{", "logger", ":=", "plog", ".", "WithFields", "...
// StartDocker - Start a docker container
[ "StartDocker", "-", "Start", "a", "docker", "container" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/shell/server.go#L319-L381
139,963
control-center/serviced
container/endpoint.go
NewContainerEndpoints
func NewContainerEndpoints(svc *service.Service, opts ContainerEndpointsOptions) (*ContainerEndpoints, error) { ce := &ContainerEndpoints{ opts: opts, ports: make(map[uint16]struct{}), vifs: NewVIFRegistry(), } // load the state object allowDirect, err := ce.loadState(svc) if err != nil { return nil, e...
go
func NewContainerEndpoints(svc *service.Service, opts ContainerEndpointsOptions) (*ContainerEndpoints, error) { ce := &ContainerEndpoints{ opts: opts, ports: make(map[uint16]struct{}), vifs: NewVIFRegistry(), } // load the state object allowDirect, err := ce.loadState(svc) if err != nil { return nil, e...
[ "func", "NewContainerEndpoints", "(", "svc", "*", "service", ".", "Service", ",", "opts", "ContainerEndpointsOptions", ")", "(", "*", "ContainerEndpoints", ",", "error", ")", "{", "ce", ":=", "&", "ContainerEndpoints", "{", "opts", ":", "opts", ",", "ports", ...
// NewContainerEndpoints loads the service state and manages port bindings // for the instance.
[ "NewContainerEndpoints", "loads", "the", "service", "state", "and", "manages", "port", "bindings", "for", "the", "instance", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/endpoint.go#L54-L77
139,964
control-center/serviced
container/endpoint.go
Run
func (ce *ContainerEndpoints) Run(cancel <-chan struct{}) { // register all of the exports for _, bind := range ce.state.Exports { ce.ports[bind.PortNumber] = struct{}{} go ce.AddExport(cancel, bind) } // track all of the imports // TODO: set up another tracker for cc exports go ce.RunImportListener(cancel,...
go
func (ce *ContainerEndpoints) Run(cancel <-chan struct{}) { // register all of the exports for _, bind := range ce.state.Exports { ce.ports[bind.PortNumber] = struct{}{} go ce.AddExport(cancel, bind) } // track all of the imports // TODO: set up another tracker for cc exports go ce.RunImportListener(cancel,...
[ "func", "(", "ce", "*", "ContainerEndpoints", ")", "Run", "(", "cancel", "<-", "chan", "struct", "{", "}", ")", "{", "// register all of the exports", "for", "_", ",", "bind", ":=", "range", "ce", ".", "state", ".", "Exports", "{", "ce", ".", "ports", ...
// Run manages the container endpoints
[ "Run", "manages", "the", "container", "endpoints" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/endpoint.go#L187-L198
139,965
control-center/serviced
container/endpoint.go
AddExport
func (ce *ContainerEndpoints) AddExport(cancel <-chan struct{}, bind zkservice.ExportBinding) { logger := plog.WithFields(log.Fields{ "application": bind.Application, "portnumber": bind.PortNumber, "protocol": bind.Protocol, }) exp := registry.ExportDetails{ ExportBinding: bind, PrivateIP: ce.stat...
go
func (ce *ContainerEndpoints) AddExport(cancel <-chan struct{}, bind zkservice.ExportBinding) { logger := plog.WithFields(log.Fields{ "application": bind.Application, "portnumber": bind.PortNumber, "protocol": bind.Protocol, }) exp := registry.ExportDetails{ ExportBinding: bind, PrivateIP: ce.stat...
[ "func", "(", "ce", "*", "ContainerEndpoints", ")", "AddExport", "(", "cancel", "<-", "chan", "struct", "{", "}", ",", "bind", "zkservice", ".", "ExportBinding", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", ...
// AddExport ensures that an export is registered for other services to bind
[ "AddExport", "ensures", "that", "an", "export", "is", "registered", "for", "other", "services", "to", "bind" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/endpoint.go#L201-L236
139,966
control-center/serviced
container/endpoint.go
AddImport
func (ce *ContainerEndpoints) AddImport(cancel <-chan struct{}, application string, bind zkservice.ImportBinding) { logger := plog.WithFields(log.Fields{ "application": application, "applicationglob": bind.Application, "purpose": bind.Purpose, }) logger.Debug("Tracking exports for endpoint") defer...
go
func (ce *ContainerEndpoints) AddImport(cancel <-chan struct{}, application string, bind zkservice.ImportBinding) { logger := plog.WithFields(log.Fields{ "application": application, "applicationglob": bind.Application, "purpose": bind.Purpose, }) logger.Debug("Tracking exports for endpoint") defer...
[ "func", "(", "ce", "*", "ContainerEndpoints", ")", "AddImport", "(", "cancel", "<-", "chan", "struct", "{", "}", ",", "application", "string", ",", "bind", "zkservice", ".", "ImportBinding", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ...
// AddImport tracks exports for a given import binding
[ "AddImport", "tracks", "exports", "for", "a", "given", "import", "binding" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/endpoint.go#L287-L319
139,967
control-center/serviced
container/endpoint.go
Set
func (c *proxyCache) Set(application string, portNumber uint16, exports ...registry.ExportDetails) (bool, error) { logger := plog.WithFields(log.Fields{ "application": application, "portnumber": portNumber, }) c.mu.Lock() defer c.mu.Unlock() key := proxyKey{ Application: application, PortNumber: portNu...
go
func (c *proxyCache) Set(application string, portNumber uint16, exports ...registry.ExportDetails) (bool, error) { logger := plog.WithFields(log.Fields{ "application": application, "portnumber": portNumber, }) c.mu.Lock() defer c.mu.Unlock() key := proxyKey{ Application: application, PortNumber: portNu...
[ "func", "(", "c", "*", "proxyCache", ")", "Set", "(", "application", "string", ",", "portNumber", "uint16", ",", "exports", "...", "registry", ".", "ExportDetails", ")", "(", "bool", ",", "error", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(",...
// Set returns true if the key was created and an error
[ "Set", "returns", "true", "if", "the", "key", "was", "created", "and", "an", "error" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/container/endpoint.go#L493-L554
139,968
control-center/serviced
domain/service/service.go
DesiredCancelsPending
func DesiredCancelsPending(pendingState ServiceCurrentState, desiredState DesiredState) bool { switch pendingState { case SVCCSPendingStart, SVCCSPendingRestart: return desiredState == SVCRun case SVCCSPendingStop, SVCCSPendingPause: return desiredState == SVCStop } return false }
go
func DesiredCancelsPending(pendingState ServiceCurrentState, desiredState DesiredState) bool { switch pendingState { case SVCCSPendingStart, SVCCSPendingRestart: return desiredState == SVCRun case SVCCSPendingStop, SVCCSPendingPause: return desiredState == SVCStop } return false }
[ "func", "DesiredCancelsPending", "(", "pendingState", "ServiceCurrentState", ",", "desiredState", "DesiredState", ")", "bool", "{", "switch", "pendingState", "{", "case", "SVCCSPendingStart", ",", "SVCCSPendingRestart", ":", "return", "desiredState", "==", "SVCRun", "\n...
// Determines whether the desiredState acts as a "cancel" to a pending state.
[ "Determines", "whether", "the", "desiredState", "acts", "as", "a", "cancel", "to", "a", "pending", "state", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L179-L187
139,969
control-center/serviced
domain/service/service.go
DesiredStateIsRedundant
func DesiredStateIsRedundant(desiredState DesiredState, emergency bool, currentState ServiceCurrentState) bool { switch desiredState { case SVCRun: return currentState == SVCCSRunning || currentState == SVCCSStarting || currentState == SVCCSPendingStart case SVCRestart: return currentState == SVCCSRestarting || ...
go
func DesiredStateIsRedundant(desiredState DesiredState, emergency bool, currentState ServiceCurrentState) bool { switch desiredState { case SVCRun: return currentState == SVCCSRunning || currentState == SVCCSStarting || currentState == SVCCSPendingStart case SVCRestart: return currentState == SVCCSRestarting || ...
[ "func", "DesiredStateIsRedundant", "(", "desiredState", "DesiredState", ",", "emergency", "bool", ",", "currentState", "ServiceCurrentState", ")", "bool", "{", "switch", "desiredState", "{", "case", "SVCRun", ":", "return", "currentState", "==", "SVCCSRunning", "||", ...
// Determines whether setting the desired state would be unnecessary
[ "Determines", "whether", "setting", "the", "desired", "state", "would", "be", "unnecessary" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L190-L207
139,970
control-center/serviced
domain/service/service.go
IsConfigurable
func (endpoint ServiceEndpoint) IsConfigurable() bool { return endpoint.AddressConfig.Port > 0 && endpoint.AddressConfig.Protocol != "" }
go
func (endpoint ServiceEndpoint) IsConfigurable() bool { return endpoint.AddressConfig.Port > 0 && endpoint.AddressConfig.Protocol != "" }
[ "func", "(", "endpoint", "ServiceEndpoint", ")", "IsConfigurable", "(", ")", "bool", "{", "return", "endpoint", ".", "AddressConfig", ".", "Port", ">", "0", "&&", "endpoint", ".", "AddressConfig", ".", "Protocol", "!=", "\"", "\"", "\n", "}" ]
// IsConfigurable returns true if the endpoint is configurable
[ "IsConfigurable", "returns", "true", "if", "the", "endpoint", "is", "configurable" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L293-L295
139,971
control-center/serviced
domain/service/service.go
NewService
func NewService() (s *Service, err error) { s = &Service{} s.ID, err = utils.NewUUID36() return s, err }
go
func NewService() (s *Service, err error) { s = &Service{} s.ID, err = utils.NewUUID36() return s, err }
[ "func", "NewService", "(", ")", "(", "s", "*", "Service", ",", "err", "error", ")", "{", "s", "=", "&", "Service", "{", "}", "\n", "s", ".", "ID", ",", "err", "=", "utils", ".", "NewUUID36", "(", ")", "\n", "return", "s", ",", "err", "\n", "}...
// NewService Create a new Service.
[ "NewService", "Create", "a", "new", "Service", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L298-L302
139,972
control-center/serviced
domain/service/service.go
HasEndpointsFor
func (s *Service) HasEndpointsFor(purpose string) bool { if s.Endpoints == nil { return false } for _, ep := range s.Endpoints { if ep.Purpose == purpose { return true } } return false }
go
func (s *Service) HasEndpointsFor(purpose string) bool { if s.Endpoints == nil { return false } for _, ep := range s.Endpoints { if ep.Purpose == purpose { return true } } return false }
[ "func", "(", "s", "*", "Service", ")", "HasEndpointsFor", "(", "purpose", "string", ")", "bool", "{", "if", "s", ".", "Endpoints", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "for", "_", ",", "ep", ":=", "range", "s", ".", "Endpoints", ...
// HasEndpointsFor determines if the service has any imports // for the specified purpose, eg import
[ "HasEndpointsFor", "determines", "if", "the", "service", "has", "any", "imports", "for", "the", "specified", "purpose", "eg", "import" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L306-L317
139,973
control-center/serviced
domain/service/service.go
BuildServiceEndpoint
func BuildServiceEndpoint(epd servicedefinition.EndpointDefinition) ServiceEndpoint { sep := ServiceEndpoint{} sep.Name = epd.Name sep.Purpose = epd.Purpose sep.Protocol = epd.Protocol sep.PortNumber = epd.PortNumber sep.PortTemplate = epd.PortTemplate sep.VirtualAddress = epd.VirtualAddress sep.Application = e...
go
func BuildServiceEndpoint(epd servicedefinition.EndpointDefinition) ServiceEndpoint { sep := ServiceEndpoint{} sep.Name = epd.Name sep.Purpose = epd.Purpose sep.Protocol = epd.Protocol sep.PortNumber = epd.PortNumber sep.PortTemplate = epd.PortTemplate sep.VirtualAddress = epd.VirtualAddress sep.Application = e...
[ "func", "BuildServiceEndpoint", "(", "epd", "servicedefinition", ".", "EndpointDefinition", ")", "ServiceEndpoint", "{", "sep", ":=", "ServiceEndpoint", "{", "}", "\n", "sep", ".", "Name", "=", "epd", ".", "Name", "\n", "sep", ".", "Purpose", "=", "epd", "."...
//BuildServiceEndpoint build a ServiceEndpoint from a EndpointDefinition
[ "BuildServiceEndpoint", "build", "a", "ServiceEndpoint", "from", "a", "EndpointDefinition" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L320-L340
139,974
control-center/serviced
domain/service/service.go
CloneService
func CloneService(fromSvc *Service, suffix string) (*Service, error) { svcuuid, err := utils.NewUUID36() if err != nil { return nil, err } svc := *fromSvc svc.ID = svcuuid svc.DesiredState = int(SVCStop) now := time.Now() svc.CreatedAt = now svc.UpdatedAt = now // add suffix to make certain things unique...
go
func CloneService(fromSvc *Service, suffix string) (*Service, error) { svcuuid, err := utils.NewUUID36() if err != nil { return nil, err } svc := *fromSvc svc.ID = svcuuid svc.DesiredState = int(SVCStop) now := time.Now() svc.CreatedAt = now svc.UpdatedAt = now // add suffix to make certain things unique...
[ "func", "CloneService", "(", "fromSvc", "*", "Service", ",", "suffix", "string", ")", "(", "*", "Service", ",", "error", ")", "{", "svcuuid", ",", "err", ":=", "utils", ".", "NewUUID36", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil",...
//CloneService copies a service and mutates id and names
[ "CloneService", "copies", "a", "service", "and", "mutates", "id", "and", "names" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L417-L475
139,975
control-center/serviced
domain/service/service.go
GetServiceImports
func (s *Service) GetServiceImports() []ServiceEndpoint { result := []ServiceEndpoint{} if s.Endpoints != nil { for _, ep := range s.Endpoints { if ep.Purpose == "import" || ep.Purpose == "import_all" { result = append(result, ep) } } } return result }
go
func (s *Service) GetServiceImports() []ServiceEndpoint { result := []ServiceEndpoint{} if s.Endpoints != nil { for _, ep := range s.Endpoints { if ep.Purpose == "import" || ep.Purpose == "import_all" { result = append(result, ep) } } } return result }
[ "func", "(", "s", "*", "Service", ")", "GetServiceImports", "(", ")", "[", "]", "ServiceEndpoint", "{", "result", ":=", "[", "]", "ServiceEndpoint", "{", "}", "\n\n", "if", "s", ".", "Endpoints", "!=", "nil", "{", "for", "_", ",", "ep", ":=", "range"...
// GetServiceImports retrieves service endpoints whose purpose is "import"
[ "GetServiceImports", "retrieves", "service", "endpoints", "whose", "purpose", "is", "import" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L478-L490
139,976
control-center/serviced
domain/service/service.go
GetServiceVHosts
func (s *Service) GetServiceVHosts() []ServiceEndpoint { result := []ServiceEndpoint{} if s.Endpoints != nil { for _, ep := range s.Endpoints { if len(ep.VHostList) > 0 { result = append(result, ep) } } } return result }
go
func (s *Service) GetServiceVHosts() []ServiceEndpoint { result := []ServiceEndpoint{} if s.Endpoints != nil { for _, ep := range s.Endpoints { if len(ep.VHostList) > 0 { result = append(result, ep) } } } return result }
[ "func", "(", "s", "*", "Service", ")", "GetServiceVHosts", "(", ")", "[", "]", "ServiceEndpoint", "{", "result", ":=", "[", "]", "ServiceEndpoint", "{", "}", "\n\n", "if", "s", ".", "Endpoints", "!=", "nil", "{", "for", "_", ",", "ep", ":=", "range",...
// GetServiceVHosts retrieves service endpoints that specify a virtual HostPort
[ "GetServiceVHosts", "retrieves", "service", "endpoints", "that", "specify", "a", "virtual", "HostPort" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L508-L520
139,977
control-center/serviced
domain/service/service.go
AddVirtualHost
func (s *Service) AddVirtualHost(application, vhostName string, isEnabled bool) (*servicedefinition.VHost, error) { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { _vhostName := strings....
go
func (s *Service) AddVirtualHost(application, vhostName string, isEnabled bool) (*servicedefinition.VHost, error) { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { _vhostName := strings....
[ "func", "(", "s", "*", "Service", ")", "AddVirtualHost", "(", "application", ",", "vhostName", "string", ",", "isEnabled", "bool", ")", "(", "*", "servicedefinition", ".", "VHost", ",", "error", ")", "{", "if", "s", ".", "Endpoints", "!=", "nil", "{", ...
// AddVirtualHost Add a virtual host for given service, this method avoids duplicates vhosts
[ "AddVirtualHost", "Add", "a", "virtual", "host", "for", "given", "service", "this", "method", "avoids", "duplicates", "vhosts" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L538-L561
139,978
control-center/serviced
domain/service/service.go
GetVirtualHost
func (s *Service) GetVirtualHost(application, vhostName string) *servicedefinition.VHost { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { vhostNameLower := strings.ToLower(vhostName) ...
go
func (s *Service) GetVirtualHost(application, vhostName string) *servicedefinition.VHost { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { vhostNameLower := strings.ToLower(vhostName) ...
[ "func", "(", "s", "*", "Service", ")", "GetVirtualHost", "(", "application", ",", "vhostName", "string", ")", "*", "servicedefinition", ".", "VHost", "{", "if", "s", ".", "Endpoints", "!=", "nil", "{", "//find the matching endpoint", "for", "i", ":=", "range...
// Returns the matching VHost entry or nil if not found.
[ "Returns", "the", "matching", "VHost", "entry", "or", "nil", "if", "not", "found", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L564-L582
139,979
control-center/serviced
domain/service/service.go
AddPort
func (s *Service) AddPort(application string, portAddr string, usetls bool, protocol string, isEnabled bool) (*servicedefinition.Port, error) { portAddr = ScrubPortString(portAddr) if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == a...
go
func (s *Service) AddPort(application string, portAddr string, usetls bool, protocol string, isEnabled bool) (*servicedefinition.Port, error) { portAddr = ScrubPortString(portAddr) if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == a...
[ "func", "(", "s", "*", "Service", ")", "AddPort", "(", "application", "string", ",", "portAddr", "string", ",", "usetls", "bool", ",", "protocol", "string", ",", "isEnabled", "bool", ")", "(", "*", "servicedefinition", ".", "Port", ",", "error", ")", "{"...
// AddPort Add a port for given service, this method avoids duplicate ports
[ "AddPort", "Add", "a", "port", "for", "given", "service", "this", "method", "avoids", "duplicate", "ports" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L585-L608
139,980
control-center/serviced
domain/service/service.go
GetPort
func (s *Service) GetPort(application, portAddr string) *servicedefinition.Port { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { portAddrLower := strings.ToLower(portAddr) for _, por...
go
func (s *Service) GetPort(application, portAddr string) *servicedefinition.Port { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { portAddrLower := strings.ToLower(portAddr) for _, por...
[ "func", "(", "s", "*", "Service", ")", "GetPort", "(", "application", ",", "portAddr", "string", ")", "*", "servicedefinition", ".", "Port", "{", "if", "s", ".", "Endpoints", "!=", "nil", "{", "//find the matching endpoint", "for", "i", ":=", "range", "s",...
// Returns the matching Port entry or nil if not found.
[ "Returns", "the", "matching", "Port", "entry", "or", "nil", "if", "not", "found", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L611-L629
139,981
control-center/serviced
domain/service/service.go
RemovePort
func (s *Service) RemovePort(application string, portAddr string) error { if s.Endpoints == nil { return fmt.Errorf("Service %s has no Endpoints", s.Name) } //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { if len(...
go
func (s *Service) RemovePort(application string, portAddr string) error { if s.Endpoints == nil { return fmt.Errorf("Service %s has no Endpoints", s.Name) } //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { if len(...
[ "func", "(", "s", "*", "Service", ")", "RemovePort", "(", "application", "string", ",", "portAddr", "string", ")", "error", "{", "if", "s", ".", "Endpoints", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ".", "Name", ...
// RemovePort Remove a port for given service
[ "RemovePort", "Remove", "a", "port", "for", "given", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L632-L667
139,982
control-center/serviced
domain/service/service.go
EnablePort
func (s *Service) EnablePort(application string, portAddr string, enable bool) error { appFound := false portFound := false for _, ep := range s.GetServicePorts() { if ep.Application == application { appFound = true for i, port := range ep.PortList { if port.PortAddr == portAddr { portFound = true ...
go
func (s *Service) EnablePort(application string, portAddr string, enable bool) error { appFound := false portFound := false for _, ep := range s.GetServicePorts() { if ep.Application == application { appFound = true for i, port := range ep.PortList { if port.PortAddr == portAddr { portFound = true ...
[ "func", "(", "s", "*", "Service", ")", "EnablePort", "(", "application", "string", ",", "portAddr", "string", ",", "enable", "bool", ")", "error", "{", "appFound", ":=", "false", "\n", "portFound", ":=", "false", "\n", "for", "_", ",", "ep", ":=", "ran...
// EnablePort enables or disables a port for given service
[ "EnablePort", "enables", "or", "disables", "a", "port", "for", "given", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L670-L698
139,983
control-center/serviced
domain/service/service.go
ScrubPortString
func ScrubPortString(port string) string { // remove possible protocol at string beginning scrubbed := protocolPrefixRegex.ReplaceAllString(port, "") matched, _ := regexp.MatchString("^[0-9]+$", scrubbed) if matched { scrubbed = fmt.Sprintf(":%s", scrubbed) } return scrubbed }
go
func ScrubPortString(port string) string { // remove possible protocol at string beginning scrubbed := protocolPrefixRegex.ReplaceAllString(port, "") matched, _ := regexp.MatchString("^[0-9]+$", scrubbed) if matched { scrubbed = fmt.Sprintf(":%s", scrubbed) } return scrubbed }
[ "func", "ScrubPortString", "(", "port", "string", ")", "string", "{", "// remove possible protocol at string beginning", "scrubbed", ":=", "protocolPrefixRegex", ".", "ReplaceAllString", "(", "port", ",", "\"", "\"", ")", "\n\n", "matched", ",", "_", ":=", "regexp",...
// Make best effort to make a port address valid
[ "Make", "best", "effort", "to", "make", "a", "port", "address", "valid" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L701-L711
139,984
control-center/serviced
domain/service/service.go
EnableVirtualHost
func (s *Service) EnableVirtualHost(application, vhostName string, enable bool) error { appFound := false vhostFound := false for _, ep := range s.GetServiceVHosts() { if ep.Application == application { appFound = true for i, vhost := range ep.VHostList { if vhost.Name == vhostName { vhostFound = tr...
go
func (s *Service) EnableVirtualHost(application, vhostName string, enable bool) error { appFound := false vhostFound := false for _, ep := range s.GetServiceVHosts() { if ep.Application == application { appFound = true for i, vhost := range ep.VHostList { if vhost.Name == vhostName { vhostFound = tr...
[ "func", "(", "s", "*", "Service", ")", "EnableVirtualHost", "(", "application", ",", "vhostName", "string", ",", "enable", "bool", ")", "error", "{", "appFound", ":=", "false", "\n", "vhostFound", ":=", "false", "\n", "for", "_", ",", "ep", ":=", "range"...
// EnableVirtualHost enable or disable a virtual host for given service
[ "EnableVirtualHost", "enable", "or", "disable", "a", "virtual", "host", "for", "given", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L714-L742
139,985
control-center/serviced
domain/service/service.go
RemoveVirtualHost
func (s *Service) RemoveVirtualHost(application, vhostName string) error { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { if len(ep.VHostList) == 0 { break } _vhostName :=...
go
func (s *Service) RemoveVirtualHost(application, vhostName string) error { if s.Endpoints != nil { //find the matching endpoint for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == application && ep.Purpose == "export" { if len(ep.VHostList) == 0 { break } _vhostName :=...
[ "func", "(", "s", "*", "Service", ")", "RemoveVirtualHost", "(", "application", ",", "vhostName", "string", ")", "error", "{", "if", "s", ".", "Endpoints", "!=", "nil", "{", "//find the matching endpoint", "for", "i", ":=", "range", "s", ".", "Endpoints", ...
// RemoveVirtualHost Remove a virtual host for given service
[ "RemoveVirtualHost", "Remove", "a", "virtual", "host", "for", "given", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L745-L779
139,986
control-center/serviced
domain/service/service.go
SetAssignment
func (se *ServiceEndpoint) SetAssignment(aa addressassignment.AddressAssignment) error { if se.AddressConfig.Port == 0 { return errors.New("cannot assign address to endpoint without AddressResourceConfig") } se.AddressAssignment = aa return nil }
go
func (se *ServiceEndpoint) SetAssignment(aa addressassignment.AddressAssignment) error { if se.AddressConfig.Port == 0 { return errors.New("cannot assign address to endpoint without AddressResourceConfig") } se.AddressAssignment = aa return nil }
[ "func", "(", "se", "*", "ServiceEndpoint", ")", "SetAssignment", "(", "aa", "addressassignment", ".", "AddressAssignment", ")", "error", "{", "if", "se", ".", "AddressConfig", ".", "Port", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ...
//SetAssignment sets the AddressAssignment for the endpoint
[ "SetAssignment", "sets", "the", "AddressAssignment", "for", "the", "endpoint" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L797-L803
139,987
control-center/serviced
domain/service/service.go
SetAddressConfig
func (s Service) SetAddressConfig(endpointName string, sa servicedefinition.AddressResourceConfig) error { if s.Endpoints == nil { return errors.New("service has no endpoints: " + s.Name) } for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == endpointName { ep.AddressConfig = sa retu...
go
func (s Service) SetAddressConfig(endpointName string, sa servicedefinition.AddressResourceConfig) error { if s.Endpoints == nil { return errors.New("service has no endpoints: " + s.Name) } for i := range s.Endpoints { ep := &s.Endpoints[i] if ep.Application == endpointName { ep.AddressConfig = sa retu...
[ "func", "(", "s", "Service", ")", "SetAddressConfig", "(", "endpointName", "string", ",", "sa", "servicedefinition", ".", "AddressResourceConfig", ")", "error", "{", "if", "s", ".", "Endpoints", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", ...
//SetAddressConfig sets the AddressConfig for the endpoint
[ "SetAddressConfig", "sets", "the", "AddressConfig", "for", "the", "endpoint" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L806-L821
139,988
control-center/serviced
domain/service/service.go
GetAssignment
func (se *ServiceEndpoint) GetAssignment() *addressassignment.AddressAssignment { if se.AddressAssignment.ID == "" { return nil } //return reference to copy result := se.AddressAssignment return &result }
go
func (se *ServiceEndpoint) GetAssignment() *addressassignment.AddressAssignment { if se.AddressAssignment.ID == "" { return nil } //return reference to copy result := se.AddressAssignment return &result }
[ "func", "(", "se", "*", "ServiceEndpoint", ")", "GetAssignment", "(", ")", "*", "addressassignment", ".", "AddressAssignment", "{", "if", "se", ".", "AddressAssignment", ".", "ID", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "//return reference ...
//GetAssignment Returns nil if no assignment set
[ "GetAssignment", "Returns", "nil", "if", "no", "assignment", "set" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L830-L837
139,989
control-center/serviced
domain/service/service.go
Equals
func (s *Service) Equals(b *Service) bool { if s.ID != b.ID { return false } if s.Name != b.Name { return false } if s.Version != b.Version { return false } if !reflect.DeepEqual(s.Context, b.Context) { return false } if s.Startup != b.Startup { return false } if s.Description != b.Description { ...
go
func (s *Service) Equals(b *Service) bool { if s.ID != b.ID { return false } if s.Name != b.Name { return false } if s.Version != b.Version { return false } if !reflect.DeepEqual(s.Context, b.Context) { return false } if s.Startup != b.Startup { return false } if s.Description != b.Description { ...
[ "func", "(", "s", "*", "Service", ")", "Equals", "(", "b", "*", "Service", ")", "bool", "{", "if", "s", ".", "ID", "!=", "b", ".", "ID", "{", "return", "false", "\n", "}", "\n", "if", "s", ".", "Name", "!=", "b", ".", "Name", "{", "return", ...
//Equals are they the same
[ "Equals", "are", "they", "the", "same" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/service/service.go#L859-L912
139,990
control-center/serviced
zzk/service/hoststate.go
NewHostStateListener
func NewHostStateListener(handler HostStateHandler, hostID string, shutdown <-chan interface{}) *HostStateListener { l := &HostStateListener{ handler: handler, hostID: hostID, shutdown: shutdown, mu: &sync.RWMutex{}, threads: make(map[string]struct { data *ServiceState exited <-chan time.Tim...
go
func NewHostStateListener(handler HostStateHandler, hostID string, shutdown <-chan interface{}) *HostStateListener { l := &HostStateListener{ handler: handler, hostID: hostID, shutdown: shutdown, mu: &sync.RWMutex{}, threads: make(map[string]struct { data *ServiceState exited <-chan time.Tim...
[ "func", "NewHostStateListener", "(", "handler", "HostStateHandler", ",", "hostID", "string", ",", "shutdown", "<-", "chan", "interface", "{", "}", ")", "*", "HostStateListener", "{", "l", ":=", "&", "HostStateListener", "{", "handler", ":", "handler", ",", "ho...
// NewHostStateListener instantiates a HostStateListener object
[ "NewHostStateListener", "instantiates", "a", "HostStateListener", "object" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hoststate.go#L74-L88
139,991
control-center/serviced
zzk/service/hoststate.go
PostProcess
func (l *HostStateListener) PostProcess(p map[string]struct{}) { // We are running all of the containers we are supposed to, now // shut down any containers we are not supposed to be running l.mu.Lock() defer l.mu.Unlock() stateIDs := l.getExistingThreadStateIDs() var orphanedStates []string for _, s := range st...
go
func (l *HostStateListener) PostProcess(p map[string]struct{}) { // We are running all of the containers we are supposed to, now // shut down any containers we are not supposed to be running l.mu.Lock() defer l.mu.Unlock() stateIDs := l.getExistingThreadStateIDs() var orphanedStates []string for _, s := range st...
[ "func", "(", "l", "*", "HostStateListener", ")", "PostProcess", "(", "p", "map", "[", "string", "]", "struct", "{", "}", ")", "{", "// We are running all of the containers we are supposed to, now", "// shut down any containers we are not supposed to be running", "l", ".", ...
// PostProcess implements zzk.Listener // This is always called after all threads have been spawned
[ "PostProcess", "implements", "zzk", ".", "Listener", "This", "is", "always", "called", "after", "all", "threads", "have", "been", "spawned" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hoststate.go#L110-L128
139,992
control-center/serviced
zzk/service/hoststate.go
shutDownContainer
func (l *HostStateListener) shutDownContainer(stateID string, containerExit <-chan time.Time) { logger := plog.WithFields(log.Fields{ "hostid": l.hostID, "stateid": stateID, }) // Parse the stateID hostID, serviceID, instanceID, err := ParseStateID(stateID) if err != nil || hostID != l.hostID { logger.With...
go
func (l *HostStateListener) shutDownContainer(stateID string, containerExit <-chan time.Time) { logger := plog.WithFields(log.Fields{ "hostid": l.hostID, "stateid": stateID, }) // Parse the stateID hostID, serviceID, instanceID, err := ParseStateID(stateID) if err != nil || hostID != l.hostID { logger.With...
[ "func", "(", "l", "*", "HostStateListener", ")", "shutDownContainer", "(", "stateID", "string", ",", "containerExit", "<-", "chan", "time", ".", "Time", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":",...
// Shuts down a running container and removes the state from zookeeper // Blocks until the container is stopped // Does NOT require a lock. Does NOT remove the thread from the internal thread list
[ "Shuts", "down", "a", "running", "container", "and", "removes", "the", "state", "from", "zookeeper", "Blocks", "until", "the", "container", "is", "stopped", "Does", "NOT", "require", "a", "lock", ".", "Does", "NOT", "remove", "the", "thread", "from", "the", ...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hoststate.go#L555-L593
139,993
control-center/serviced
commons/proc/stat.go
ReapZombies
func ReapZombies() { pids, err := GetAllPids() if err != nil { return } var done sync.WaitGroup for _, pid := range pids { stat, err := GetProcStat(pid) glog.V(8).Infof("found pid %d procstat %s", pid, err) if err != nil || stat.State != "Z" { continue } done.Add(1) go func(p int) { defer done....
go
func ReapZombies() { pids, err := GetAllPids() if err != nil { return } var done sync.WaitGroup for _, pid := range pids { stat, err := GetProcStat(pid) glog.V(8).Infof("found pid %d procstat %s", pid, err) if err != nil || stat.State != "Z" { continue } done.Add(1) go func(p int) { defer done....
[ "func", "ReapZombies", "(", ")", "{", "pids", ",", "err", ":=", "GetAllPids", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "var", "done", "sync", ".", "WaitGroup", "\n", "for", "_", ",", "pid", ":=", "range", "pids", ...
// ReapZombies will call wait on zombie pids in order to reap them.
[ "ReapZombies", "will", "call", "wait", "on", "zombie", "pids", "in", "order", "to", "reap", "them", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/proc/stat.go#L71-L94
139,994
control-center/serviced
commons/proc/stat.go
KillGroup
func KillGroup(pgrp int, timeout time.Duration) error { pids, err := GetAllPids() if err != nil { return err } timedout := make(chan struct{}) var done sync.WaitGroup for _, pid := range pids { stat, err := GetProcStat(pid) glog.V(8).Infof("found pid %d procstat %s", pid, err) if err != nil || stat.Pgrp !...
go
func KillGroup(pgrp int, timeout time.Duration) error { pids, err := GetAllPids() if err != nil { return err } timedout := make(chan struct{}) var done sync.WaitGroup for _, pid := range pids { stat, err := GetProcStat(pid) glog.V(8).Infof("found pid %d procstat %s", pid, err) if err != nil || stat.Pgrp !...
[ "func", "KillGroup", "(", "pgrp", "int", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "pids", ",", "err", ":=", "GetAllPids", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "timedout", ":=", "make", ...
// KillGroup will send a SIGTERM to all the processes in the pgrp processs group. If the processes don't // shutdown within 10 seconds
[ "KillGroup", "will", "send", "a", "SIGTERM", "to", "all", "the", "processes", "in", "the", "pgrp", "processs", "group", ".", "If", "the", "processes", "don", "t", "shutdown", "within", "10", "seconds" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/proc/stat.go#L98-L143
139,995
control-center/serviced
dfs/registry/utils.go
GetRegistryImage
func GetRegistryImage(conn client.Connection, id string) (*registry.Image, error) { rimagepath := path.Join(zkregistrytags, id) var node RegistryImageNode if err := conn.Get(rimagepath, &node); err != nil { return nil, err } return &node.Image, nil }
go
func GetRegistryImage(conn client.Connection, id string) (*registry.Image, error) { rimagepath := path.Join(zkregistrytags, id) var node RegistryImageNode if err := conn.Get(rimagepath, &node); err != nil { return nil, err } return &node.Image, nil }
[ "func", "GetRegistryImage", "(", "conn", "client", ".", "Connection", ",", "id", "string", ")", "(", "*", "registry", ".", "Image", ",", "error", ")", "{", "rimagepath", ":=", "path", ".", "Join", "(", "zkregistrytags", ",", "id", ")", "\n", "var", "no...
// GetRegistryImage returns the registry image from the coordinator index.
[ "GetRegistryImage", "returns", "the", "registry", "image", "from", "the", "coordinator", "index", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/utils.go#L28-L35
139,996
control-center/serviced
dfs/registry/utils.go
SetRegistryImage
func SetRegistryImage(conn client.Connection, rImage registry.Image) error { leaderpath := path.Join(zkregistryrepos, rImage.Library, rImage.Repo) leadernode := &RegistryImageLeader{HostID: "master"} if err := conn.CreateDir(leaderpath); err != nil && err != client.ErrNodeExists { glog.Errorf("Could not create rep...
go
func SetRegistryImage(conn client.Connection, rImage registry.Image) error { leaderpath := path.Join(zkregistryrepos, rImage.Library, rImage.Repo) leadernode := &RegistryImageLeader{HostID: "master"} if err := conn.CreateDir(leaderpath); err != nil && err != client.ErrNodeExists { glog.Errorf("Could not create rep...
[ "func", "SetRegistryImage", "(", "conn", "client", ".", "Connection", ",", "rImage", "registry", ".", "Image", ")", "error", "{", "leaderpath", ":=", "path", ".", "Join", "(", "zkregistryrepos", ",", "rImage", ".", "Library", ",", "rImage", ".", "Repo", ")...
// SetRegistryImage inserts a registry image into the coordinator index.
[ "SetRegistryImage", "inserts", "a", "registry", "image", "into", "the", "coordinator", "index", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/utils.go#L38-L72
139,997
control-center/serviced
dfs/registry/utils.go
DeleteRegistryImage
func DeleteRegistryImage(conn client.Connection, id string) error { rimagepath := path.Join(zkregistrytags, id) var node RegistryImageNode if err := conn.Get(rimagepath, &node); err != nil { return err } if node.Image.Tag == docker.Latest { leaderpath := path.Join(zkregistryrepos, node.Image.Library, node.Imag...
go
func DeleteRegistryImage(conn client.Connection, id string) error { rimagepath := path.Join(zkregistrytags, id) var node RegistryImageNode if err := conn.Get(rimagepath, &node); err != nil { return err } if node.Image.Tag == docker.Latest { leaderpath := path.Join(zkregistryrepos, node.Image.Library, node.Imag...
[ "func", "DeleteRegistryImage", "(", "conn", "client", ".", "Connection", ",", "id", "string", ")", "error", "{", "rimagepath", ":=", "path", ".", "Join", "(", "zkregistrytags", ",", "id", ")", "\n", "var", "node", "RegistryImageNode", "\n", "if", "err", ":...
// DeleteRegistryImage removes a registry image from the coordinator index.
[ "DeleteRegistryImage", "removes", "a", "registry", "image", "from", "the", "coordinator", "index", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/utils.go#L99-L110
139,998
control-center/serviced
dfs/registry/utils.go
DeleteRegistryLibrary
func DeleteRegistryLibrary(conn client.Connection, library string) error { leaderpath := path.Join(zkregistryrepos, library) return conn.Delete(leaderpath) }
go
func DeleteRegistryLibrary(conn client.Connection, library string) error { leaderpath := path.Join(zkregistryrepos, library) return conn.Delete(leaderpath) }
[ "func", "DeleteRegistryLibrary", "(", "conn", "client", ".", "Connection", ",", "library", "string", ")", "error", "{", "leaderpath", ":=", "path", ".", "Join", "(", "zkregistryrepos", ",", "library", ")", "\n", "return", "conn", ".", "Delete", "(", "leaderp...
// DeleteRegistryLibrary removes all of the leader nodes in the registry // library.
[ "DeleteRegistryLibrary", "removes", "all", "of", "the", "leader", "nodes", "in", "the", "registry", "library", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/utils.go#L114-L117
139,999
control-center/serviced
coordinator/storage/server.go
NewServer
func NewServer(driver StorageDriver, host *host.Host, volumesPath string) (*Server, error) { if len(driver.ExportPath()) < 9 { return nil, fmt.Errorf("export path can not be empty") } s := &Server{ host: host, driver: driver, } return s, nil }
go
func NewServer(driver StorageDriver, host *host.Host, volumesPath string) (*Server, error) { if len(driver.ExportPath()) < 9 { return nil, fmt.Errorf("export path can not be empty") } s := &Server{ host: host, driver: driver, } return s, nil }
[ "func", "NewServer", "(", "driver", "StorageDriver", ",", "host", "*", "host", ".", "Host", ",", "volumesPath", "string", ")", "(", "*", "Server", ",", "error", ")", "{", "if", "len", "(", "driver", ".", "ExportPath", "(", ")", ")", "<", "9", "{", ...
// NewServer returns a Server object to manage the exported file system
[ "NewServer", "returns", "a", "Server", "object", "to", "manage", "the", "exported", "file", "system" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/storage/server.go#L59-L70