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,200
control-center/serviced
node/agent_proxy.go
addLogstashEndpoint
func (a *HostAgent) addLogstashEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { tcp_endpoint := applicationendpoint.ApplicationEndpoint{ ServiceID: "controlplane_logstash_tcp", Application: "controlplane_logstash_tcp", ContainerIP: "127.0.0.1", ContainerPort: 5042, HostPort:...
go
func (a *HostAgent) addLogstashEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { tcp_endpoint := applicationendpoint.ApplicationEndpoint{ ServiceID: "controlplane_logstash_tcp", Application: "controlplane_logstash_tcp", ContainerIP: "127.0.0.1", ContainerPort: 5042, HostPort:...
[ "func", "(", "a", "*", "HostAgent", ")", "addLogstashEndpoint", "(", "endpoints", "map", "[", "string", "]", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", ")", "{", "tcp_endpoint", ":=", "applicationendpoint", ".", "ApplicationEndpoint", "{", "Servi...
// addLogstashEndpoint adds an application endpoint mapping for the master control center api
[ "addLogstashEndpoint", "adds", "an", "application", "endpoint", "mapping", "for", "the", "master", "control", "center", "api" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L171-L195
139,201
control-center/serviced
node/agent_proxy.go
addKibanaEndpoint
func (a *HostAgent) addKibanaEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { tcp_endpoint := applicationendpoint.ApplicationEndpoint{ ServiceID: "controlplane_kibana_tcp", Application: "controlplane_kibana_tcp", ContainerIP: "127.0.0.1", ContainerPort: 5601, HostPort: ...
go
func (a *HostAgent) addKibanaEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { tcp_endpoint := applicationendpoint.ApplicationEndpoint{ ServiceID: "controlplane_kibana_tcp", Application: "controlplane_kibana_tcp", ContainerIP: "127.0.0.1", ContainerPort: 5601, HostPort: ...
[ "func", "(", "a", "*", "HostAgent", ")", "addKibanaEndpoint", "(", "endpoints", "map", "[", "string", "]", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", ")", "{", "tcp_endpoint", ":=", "applicationendpoint", ".", "ApplicationEndpoint", "{", "Service...
// addKibanaEndpoint adds an application endpoint mapping for the master control center api
[ "addKibanaEndpoint", "adds", "an", "application", "endpoint", "mapping", "for", "the", "master", "control", "center", "api" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L198-L210
139,202
control-center/serviced
node/agent_proxy.go
addEndpoint
func (a *HostAgent) addEndpoint(key string, endpoint applicationendpoint.ApplicationEndpoint, endpoints map[string][]applicationendpoint.ApplicationEndpoint) { if _, ok := endpoints[key]; !ok { endpoints[key] = make([]applicationendpoint.ApplicationEndpoint, 0) } else { if len(endpoints[key]) > 0 { glog.Warnin...
go
func (a *HostAgent) addEndpoint(key string, endpoint applicationendpoint.ApplicationEndpoint, endpoints map[string][]applicationendpoint.ApplicationEndpoint) { if _, ok := endpoints[key]; !ok { endpoints[key] = make([]applicationendpoint.ApplicationEndpoint, 0) } else { if len(endpoints[key]) > 0 { glog.Warnin...
[ "func", "(", "a", "*", "HostAgent", ")", "addEndpoint", "(", "key", "string", ",", "endpoint", "applicationendpoint", ".", "ApplicationEndpoint", ",", "endpoints", "map", "[", "string", "]", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", ")", "{", ...
// addEndpoint adds a mapping to defined application, if a mapping does not exist this method creates the list and adds the first element
[ "addEndpoint", "adds", "a", "mapping", "to", "defined", "application", "if", "a", "mapping", "does", "not", "exist", "this", "method", "creates", "the", "list", "and", "adds", "the", "first", "element" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L213-L225
139,203
control-center/serviced
node/agent_proxy.go
GetZkInfo
func (a *HostAgent) GetZkInfo(_ string, zkInfo *ZkInfo) error { localDSN := a.zkClient.ConnectionString() zkInfo.ZkDSN = strings.Replace(localDSN, "127.0.0.1", strings.Split(a.master, ":")[0], -1) zkInfo.PoolID = a.poolID glog.V(4).Infof("ControlCenterAgent.GetZkInfo(): %+v", zkInfo) return nil }
go
func (a *HostAgent) GetZkInfo(_ string, zkInfo *ZkInfo) error { localDSN := a.zkClient.ConnectionString() zkInfo.ZkDSN = strings.Replace(localDSN, "127.0.0.1", strings.Split(a.master, ":")[0], -1) zkInfo.PoolID = a.poolID glog.V(4).Infof("ControlCenterAgent.GetZkInfo(): %+v", zkInfo) return nil }
[ "func", "(", "a", "*", "HostAgent", ")", "GetZkInfo", "(", "_", "string", ",", "zkInfo", "*", "ZkInfo", ")", "error", "{", "localDSN", ":=", "a", ".", "zkClient", ".", "ConnectionString", "(", ")", "\n", "zkInfo", ".", "ZkDSN", "=", "strings", ".", "...
// GetZkInfo returns the agent's zookeeper connection string and its poolID
[ "GetZkInfo", "returns", "the", "agent", "s", "zookeeper", "connection", "string", "and", "its", "poolID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L235-L241
139,204
control-center/serviced
node/agent_proxy.go
GetServiceBindMounts
func (a *HostAgent) GetServiceBindMounts(serviceID string, bindmounts *map[string]string) error { glog.V(4).Infof("ControlCenterAgent.GetServiceBindMounts(serviceID:%s)", serviceID) *bindmounts = make(map[string]string, 0) var evaluatedServiceResponse EvaluateServiceResponse if err := a.GetEvaluatedService(Evaluat...
go
func (a *HostAgent) GetServiceBindMounts(serviceID string, bindmounts *map[string]string) error { glog.V(4).Infof("ControlCenterAgent.GetServiceBindMounts(serviceID:%s)", serviceID) *bindmounts = make(map[string]string, 0) var evaluatedServiceResponse EvaluateServiceResponse if err := a.GetEvaluatedService(Evaluat...
[ "func", "(", "a", "*", "HostAgent", ")", "GetServiceBindMounts", "(", "serviceID", "string", ",", "bindmounts", "*", "map", "[", "string", "]", "string", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ",", "service...
// GetServiceBindMounts returns the service bindmounts
[ "GetServiceBindMounts", "returns", "the", "service", "bindmounts" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L244-L272
139,205
control-center/serviced
coordinator/storage/client.go
NewClient
func NewClient(host *host.Host, localPath string) (*Client, error) { if err := mkdirAll(localPath, 0755); err != nil { return nil, err } c := &Client{ host: host, localPath: localPath, mounted: make(chan chan<- string), closing: make(chan struct{}), // conn: nil, // commented out on purpo...
go
func NewClient(host *host.Host, localPath string) (*Client, error) { if err := mkdirAll(localPath, 0755); err != nil { return nil, err } c := &Client{ host: host, localPath: localPath, mounted: make(chan chan<- string), closing: make(chan struct{}), // conn: nil, // commented out on purpo...
[ "func", "NewClient", "(", "host", "*", "host", ".", "Host", ",", "localPath", "string", ")", "(", "*", "Client", ",", "error", ")", "{", "if", "err", ":=", "mkdirAll", "(", "localPath", ",", "0755", ")", ";", "err", "!=", "nil", "{", "return", "nil...
// NewClient returns a Client that manages remote mounts
[ "NewClient", "returns", "a", "Client", "that", "manages", "remote", "mounts" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/storage/client.go#L62-L76
139,206
control-center/serviced
coordinator/storage/client.go
Mount
func (c *Client) Mount(source, destination string) error { return nfsMount(&nfs.NFSDriver{}, path.Join(c.exportedPath, source), destination) }
go
func (c *Client) Mount(source, destination string) error { return nfsMount(&nfs.NFSDriver{}, path.Join(c.exportedPath, source), destination) }
[ "func", "(", "c", "*", "Client", ")", "Mount", "(", "source", ",", "destination", "string", ")", "error", "{", "return", "nfsMount", "(", "&", "nfs", ".", "NFSDriver", "{", "}", ",", "path", ".", "Join", "(", "c", ".", "exportedPath", ",", "source", ...
// Mount source to local destination path. The source is relative to the exported path
[ "Mount", "source", "to", "local", "destination", "path", ".", "The", "source", "is", "relative", "to", "the", "exported", "path" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/storage/client.go#L121-L123
139,207
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
Less
func (s ByEmergencyShutdown) Less(i, j int) bool { if s.CancellableServices[i].EmergencyShutdownLevel == s.CancellableServices[j].EmergencyShutdownLevel { // If emergency shutdown level is the same, order by reverse start level return s.CancellableServices[i].StartLevel-1 > s.CancellableServices[j].StartLevel-1 }...
go
func (s ByEmergencyShutdown) Less(i, j int) bool { if s.CancellableServices[i].EmergencyShutdownLevel == s.CancellableServices[j].EmergencyShutdownLevel { // If emergency shutdown level is the same, order by reverse start level return s.CancellableServices[i].StartLevel-1 > s.CancellableServices[j].StartLevel-1 }...
[ "func", "(", "s", "ByEmergencyShutdown", ")", "Less", "(", "i", ",", "j", "int", ")", "bool", "{", "if", "s", ".", "CancellableServices", "[", "i", "]", ".", "EmergencyShutdownLevel", "==", "s", ".", "CancellableServices", "[", "j", "]", ".", "EmergencyS...
// Sort by EmergencyShutdownLevel - 1, to ensure level of 0 is last
[ "Sort", "by", "EmergencyShutdownLevel", "-", "1", "to", "ensure", "level", "of", "0", "is", "last" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L91-L98
139,208
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
NewBatchServiceStateManager
func NewBatchServiceStateManager(facade Facade, ctx datastore.Context, runLevelTimeout time.Duration) *BatchServiceStateManager { return &BatchServiceStateManager{ lock: &sync.RWMutex{}, currentStateLock: &sync.Mutex{}, Facade: facade, ctx: ctx, ServiceRunLevelTimeout: runL...
go
func NewBatchServiceStateManager(facade Facade, ctx datastore.Context, runLevelTimeout time.Duration) *BatchServiceStateManager { return &BatchServiceStateManager{ lock: &sync.RWMutex{}, currentStateLock: &sync.Mutex{}, Facade: facade, ctx: ctx, ServiceRunLevelTimeout: runL...
[ "func", "NewBatchServiceStateManager", "(", "facade", "Facade", ",", "ctx", "datastore", ".", "Context", ",", "runLevelTimeout", "time", ".", "Duration", ")", "*", "BatchServiceStateManager", "{", "return", "&", "BatchServiceStateManager", "{", "lock", ":", "&", "...
// NewBatchServiceStateManager creates a new, initialized ServiceStateManager
[ "NewBatchServiceStateManager", "creates", "a", "new", "initialized", "ServiceStateManager" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L222-L233
139,209
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
Shutdown
func (s *BatchServiceStateManager) Shutdown() { s.lock.Lock() defer s.lock.Unlock() close(s.shutdown) for tenantID, _ := range s.TenantShutDowns { s.removeTenant(tenantID) } s.currentStateLock.Lock() defer s.currentStateLock.Unlock() for _, thread := range s.currentStateWaits { thread.Cancel() } // Clea...
go
func (s *BatchServiceStateManager) Shutdown() { s.lock.Lock() defer s.lock.Unlock() close(s.shutdown) for tenantID, _ := range s.TenantShutDowns { s.removeTenant(tenantID) } s.currentStateLock.Lock() defer s.currentStateLock.Unlock() for _, thread := range s.currentStateWaits { thread.Cancel() } // Clea...
[ "func", "(", "s", "*", "BatchServiceStateManager", ")", "Shutdown", "(", ")", "{", "s", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "lock", ".", "Unlock", "(", ")", "\n", "close", "(", "s", ".", "shutdown", ")", "\n", "for", "ten...
// Shutdown properly cancels pending services in queueLoop
[ "Shutdown", "properly", "cancels", "pending", "services", "in", "queueLoop" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L236-L252
139,210
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
Start
func (s *BatchServiceStateManager) Start() error { s.lock.Lock() if s.shutdown != nil { select { case <-s.shutdown: default: s.lock.Unlock() return ErrAlreadyStarted } } s.shutdown = make(chan struct{}) s.lock.Unlock() tenantIDs, err := s.Facade.GetTenantIDs(s.ctx) if err != nil { return err ...
go
func (s *BatchServiceStateManager) Start() error { s.lock.Lock() if s.shutdown != nil { select { case <-s.shutdown: default: s.lock.Unlock() return ErrAlreadyStarted } } s.shutdown = make(chan struct{}) s.lock.Unlock() tenantIDs, err := s.Facade.GetTenantIDs(s.ctx) if err != nil { return err ...
[ "func", "(", "s", "*", "BatchServiceStateManager", ")", "Start", "(", ")", "error", "{", "s", ".", "lock", ".", "Lock", "(", ")", "\n", "if", "s", ".", "shutdown", "!=", "nil", "{", "select", "{", "case", "<-", "s", ".", "shutdown", ":", "default",...
// Start gets tenants from the facade and adds them to the service state manager
[ "Start", "gets", "tenants", "from", "the", "facade", "and", "adds", "them", "to", "the", "service", "state", "manager" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L255-L283
139,211
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
AddTenant
func (s *BatchServiceStateManager) AddTenant(tenantID string) error { s.lock.Lock() defer s.lock.Unlock() // We can't start the queue loop if we have been shutdown, so don't allow adding a tenant if s.shutdown == nil { return ErrNotRunning } select { case <-s.shutdown: return ErrNotRunning default: } i...
go
func (s *BatchServiceStateManager) AddTenant(tenantID string) error { s.lock.Lock() defer s.lock.Unlock() // We can't start the queue loop if we have been shutdown, so don't allow adding a tenant if s.shutdown == nil { return ErrNotRunning } select { case <-s.shutdown: return ErrNotRunning default: } i...
[ "func", "(", "s", "*", "BatchServiceStateManager", ")", "AddTenant", "(", "tenantID", "string", ")", "error", "{", "s", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "// We can't start the queue loop ...
// AddTenant adds a queue for a tenant and starts the processing loop for it
[ "AddTenant", "adds", "a", "queue", "for", "a", "tenant", "and", "starts", "the", "processing", "loop", "for", "it" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L286-L317
139,212
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
RemoveTenant
func (s *BatchServiceStateManager) RemoveTenant(tenantID string) error { defer plog.WithField("tenantid", tenantID).Debug("Tenant removed from service state manager") s.lock.Lock() defer s.lock.Unlock() return s.removeTenant(tenantID) }
go
func (s *BatchServiceStateManager) RemoveTenant(tenantID string) error { defer plog.WithField("tenantid", tenantID).Debug("Tenant removed from service state manager") s.lock.Lock() defer s.lock.Unlock() return s.removeTenant(tenantID) }
[ "func", "(", "s", "*", "BatchServiceStateManager", ")", "RemoveTenant", "(", "tenantID", "string", ")", "error", "{", "defer", "plog", ".", "WithField", "(", "\"", "\"", ",", "tenantID", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "s", ".", "lock", ...
// RemoveTenant cancels the pending batches in queue for the tenant and deletes it from the service state manager
[ "RemoveTenant", "cancels", "the", "pending", "batches", "in", "queue", "for", "the", "tenant", "and", "deletes", "it", "from", "the", "service", "state", "manager" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L320-L325
139,213
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
reconcileWithCurrentState
func (s *BatchServiceStateManager) reconcileWithCurrentState(new ServiceStateChangeBatch) (ServiceStateChangeBatch, []string) { newSvcs := make(map[string]*CancellableService) var cancelledIDs []string for id, newSvc := range new.Services { if service.DesiredStateIsRedundant(new.DesiredState, new.Emergency, servic...
go
func (s *BatchServiceStateManager) reconcileWithCurrentState(new ServiceStateChangeBatch) (ServiceStateChangeBatch, []string) { newSvcs := make(map[string]*CancellableService) var cancelledIDs []string for id, newSvc := range new.Services { if service.DesiredStateIsRedundant(new.DesiredState, new.Emergency, servic...
[ "func", "(", "s", "*", "BatchServiceStateManager", ")", "reconcileWithCurrentState", "(", "new", "ServiceStateChangeBatch", ")", "(", "ServiceStateChangeBatch", ",", "[", "]", "string", ")", "{", "newSvcs", ":=", "make", "(", "map", "[", "string", "]", "*", "C...
// reconcileWithCurrentState will compare the desired state to the services' current states and return a new batch // with unnecessary services removed. It also returns a list of IDs of the services it omitted
[ "reconcileWithCurrentState", "will", "compare", "the", "desired", "state", "to", "the", "services", "current", "states", "and", "return", "a", "new", "batch", "with", "unnecessary", "services", "removed", ".", "It", "also", "returns", "a", "list", "of", "IDs", ...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L594-L610
139,214
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
MergeBatches
func MergeBatches(batches []ServiceStateChangeBatch) ([]ServiceStateChangeBatch, error) { if len(batches) < 1 { return batches, nil } var fullServiceList []*CancellableService // Make sure all of the batches we're merging have the same desiredState // and emergency status desiredState := batches[0].DesiredSta...
go
func MergeBatches(batches []ServiceStateChangeBatch) ([]ServiceStateChangeBatch, error) { if len(batches) < 1 { return batches, nil } var fullServiceList []*CancellableService // Make sure all of the batches we're merging have the same desiredState // and emergency status desiredState := batches[0].DesiredSta...
[ "func", "MergeBatches", "(", "batches", "[", "]", "ServiceStateChangeBatch", ")", "(", "[", "]", "ServiceStateChangeBatch", ",", "error", ")", "{", "if", "len", "(", "batches", ")", "<", "1", "{", "return", "batches", ",", "nil", "\n", "}", "\n\n", "var"...
// MergeBatches sorts the services is batches by StartLevel, desiredState, and emergency, // creates a new batch from the services and returns is
[ "MergeBatches", "sorts", "the", "services", "is", "batches", "by", "StartLevel", "desiredState", "and", "emergency", "creates", "a", "new", "batch", "from", "the", "services", "and", "returns", "is" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L838-L931
139,215
control-center/serviced
scheduler/servicestatemanager/servicestatemanager.go
Wait
func (s *BatchServiceStateManager) Wait(tenantID string) { s.lock.RLock() var wg sync.WaitGroup for _, queue := range s.TenantQueues[tenantID] { wg.Add(1) go func(q *ServiceStateQueue) { s.drainQueue(q) wg.Done() }(queue) } s.lock.RUnlock() wg.Wait() }
go
func (s *BatchServiceStateManager) Wait(tenantID string) { s.lock.RLock() var wg sync.WaitGroup for _, queue := range s.TenantQueues[tenantID] { wg.Add(1) go func(q *ServiceStateQueue) { s.drainQueue(q) wg.Done() }(queue) } s.lock.RUnlock() wg.Wait() }
[ "func", "(", "s", "*", "BatchServiceStateManager", ")", "Wait", "(", "tenantID", "string", ")", "{", "s", ".", "lock", ".", "RLock", "(", ")", "\n", "var", "wg", "sync", ".", "WaitGroup", "\n", "for", "_", ",", "queue", ":=", "range", "s", ".", "Te...
// Wait blocks until the queues are empty for tenantID
[ "Wait", "blocks", "until", "the", "queues", "are", "empty", "for", "tenantID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/scheduler/servicestatemanager/servicestatemanager.go#L934-L946
139,216
control-center/serviced
zzk/service/binding.go
GetPortNumber
func (i ImportBinding) GetPortNumber(instanceID int) (uint16, error) { t := template.Must(template.New(i.Application).Funcs(funcs).Parse(i.PortTemplate)) var buffer bytes.Buffer if err := t.Execute(&buffer, struct{ InstanceID int }{instanceID}); err != nil { return 0, &TemplateError{ Application: i.Application...
go
func (i ImportBinding) GetPortNumber(instanceID int) (uint16, error) { t := template.Must(template.New(i.Application).Funcs(funcs).Parse(i.PortTemplate)) var buffer bytes.Buffer if err := t.Execute(&buffer, struct{ InstanceID int }{instanceID}); err != nil { return 0, &TemplateError{ Application: i.Application...
[ "func", "(", "i", "ImportBinding", ")", "GetPortNumber", "(", "instanceID", "int", ")", "(", "uint16", ",", "error", ")", "{", "t", ":=", "template", ".", "Must", "(", "template", ".", "New", "(", "i", ".", "Application", ")", ".", "Funcs", "(", "fun...
// GetPortNumber retrieves a port number for a given instance ID
[ "GetPortNumber", "retrieves", "a", "port", "number", "for", "a", "given", "instance", "ID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/binding.go#L48-L79
139,217
control-center/serviced
zzk/service/binding.go
GetVirtualAddress
func (i ImportBinding) GetVirtualAddress(instanceID int) (string, error) { t := template.Must(template.New(i.Application).Funcs(funcs).Parse(i.VirtualAddress)) var buffer bytes.Buffer if err := t.Execute(&buffer, struct{ InstanceID int }{instanceID}); err != nil { return "", &TemplateError{ Application: i.Appl...
go
func (i ImportBinding) GetVirtualAddress(instanceID int) (string, error) { t := template.Must(template.New(i.Application).Funcs(funcs).Parse(i.VirtualAddress)) var buffer bytes.Buffer if err := t.Execute(&buffer, struct{ InstanceID int }{instanceID}); err != nil { return "", &TemplateError{ Application: i.Appl...
[ "func", "(", "i", "ImportBinding", ")", "GetVirtualAddress", "(", "instanceID", "int", ")", "(", "string", ",", "error", ")", "{", "t", ":=", "template", ".", "Must", "(", "template", ".", "New", "(", "i", ".", "Application", ")", ".", "Funcs", "(", ...
// GetVirtualAddress retrieves the virtual address for a given instance ID
[ "GetVirtualAddress", "retrieves", "the", "virtual", "address", "for", "a", "given", "instance", "ID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/binding.go#L82-L95
139,218
control-center/serviced
domain/registry/store.go
Delete
func (s *storeImpl) Delete(ctx datastore.Context, id string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.Delete")) return s.ds.Delete(ctx, Key(id)) }
go
func (s *storeImpl) Delete(ctx datastore.Context, id string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.Delete")) return s.ds.Delete(ctx, Key(id)) }
[ "func", "(", "s", "*", "storeImpl", ")", "Delete", "(", "ctx", "datastore", ".", "Context", ",", "id", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(", "\...
// Delete removes an image from the registry
[ "Delete", "removes", "an", "image", "from", "the", "registry" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/registry/store.go#L68-L71
139,219
control-center/serviced
domain/registry/store.go
GetImages
func (s *storeImpl) GetImages(ctx datastore.Context) ([]Image, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.GetImages")) query := search.Query().Search("_exists_:Library") search := search.Search("controlplane").Type(kind).Size("50000").Query(query) q := datastore.NewQuery(ctx) results...
go
func (s *storeImpl) GetImages(ctx datastore.Context) ([]Image, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.GetImages")) query := search.Query().Search("_exists_:Library") search := search.Search("controlplane").Type(kind).Size("50000").Query(query) q := datastore.NewQuery(ctx) results...
[ "func", "(", "s", "*", "storeImpl", ")", "GetImages", "(", "ctx", "datastore", ".", "Context", ")", "(", "[", "]", "Image", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", ...
// GetImages returns all the images that are in the registry
[ "GetImages", "returns", "all", "the", "images", "that", "are", "in", "the", "registry" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/registry/store.go#L74-L84
139,220
control-center/serviced
domain/registry/store.go
SearchLibraryByTag
func (s *storeImpl) SearchLibraryByTag(ctx datastore.Context, library, tag string) ([]Image, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.SearchLibraryByTag")) if library = strings.TrimSpace(library); library == "" { return nil, errors.New("empty library not allowed") } else if tag = s...
go
func (s *storeImpl) SearchLibraryByTag(ctx datastore.Context, library, tag string) ([]Image, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("ImageRegistryStore.SearchLibraryByTag")) if library = strings.TrimSpace(library); library == "" { return nil, errors.New("empty library not allowed") } else if tag = s...
[ "func", "(", "s", "*", "storeImpl", ")", "SearchLibraryByTag", "(", "ctx", "datastore", ".", "Context", ",", "library", ",", "tag", "string", ")", "(", "[", "]", "Image", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", ...
// SearchLibraryByTag looks for repos that are registered under a library and tag
[ "SearchLibraryByTag", "looks", "for", "repos", "that", "are", "registered", "under", "a", "library", "and", "tag" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/registry/store.go#L87-L105
139,221
control-center/serviced
domain/servicedefinition/utils.go
getFiltersFromDirectory
func getFiltersFromDirectory(path string) (filters map[string]string, err error) { filters = make(map[string]string) subpaths, err := ioutil.ReadDir(path) if err != nil { return nil, err } for _, subpath := range subpaths { filterName := subpath.Name() // make sure it is a valid filter if !strings.HasSuff...
go
func getFiltersFromDirectory(path string) (filters map[string]string, err error) { filters = make(map[string]string) subpaths, err := ioutil.ReadDir(path) if err != nil { return nil, err } for _, subpath := range subpaths { filterName := subpath.Name() // make sure it is a valid filter if !strings.HasSuff...
[ "func", "getFiltersFromDirectory", "(", "path", "string", ")", "(", "filters", "map", "[", "string", "]", "string", ",", "err", "error", ")", "{", "filters", "=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "subpaths", ",", "err", ":="...
// this function takes a filter directory and creates a map // of filters by looking at the content in that directory. // it is assumed the filter name is the name of the file minus // the .conf part. So test.conf would be a filter named "test"
[ "this", "function", "takes", "a", "filter", "directory", "and", "creates", "a", "map", "of", "filters", "by", "looking", "at", "the", "content", "in", "that", "directory", ".", "it", "is", "assumed", "the", "filter", "name", "is", "the", "name", "of", "t...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/servicedefinition/utils.go#L157-L191
139,222
control-center/serviced
node/lbClient.go
Ping
func (a *LBClient) Ping(waitFor time.Duration, timestamp *time.Time) error { glog.V(4).Infof("ControlCenterAgent.Ping()") return a.rpcClient.Call("ControlCenterAgent.Ping", waitFor, timestamp, 0) }
go
func (a *LBClient) Ping(waitFor time.Duration, timestamp *time.Time) error { glog.V(4).Infof("ControlCenterAgent.Ping()") return a.rpcClient.Call("ControlCenterAgent.Ping", waitFor, timestamp, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "Ping", "(", "waitFor", "time", ".", "Duration", ",", "timestamp", "*", "time", ".", "Time", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "a", "....
// Ping waits for the specified time then returns the server time
[ "Ping", "waits", "for", "the", "specified", "time", "then", "returns", "the", "server", "time" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L51-L54
139,223
control-center/serviced
node/lbClient.go
SendLogMessage
func (a *LBClient) SendLogMessage(serviceLogInfo ServiceLogInfo, _ *struct{}) error { glog.V(4).Infof("ControlCenterAgent.SendLogMessage()") return a.rpcClient.Call("ControlCenterAgent.SendLogMessage", serviceLogInfo, nil, 0) }
go
func (a *LBClient) SendLogMessage(serviceLogInfo ServiceLogInfo, _ *struct{}) error { glog.V(4).Infof("ControlCenterAgent.SendLogMessage()") return a.rpcClient.Call("ControlCenterAgent.SendLogMessage", serviceLogInfo, nil, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "SendLogMessage", "(", "serviceLogInfo", "ServiceLogInfo", ",", "_", "*", "struct", "{", "}", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "a", ".", ...
// SendLogMessage simply outputs the ServiceLogInfo on the serviced master
[ "SendLogMessage", "simply", "outputs", "the", "ServiceLogInfo", "on", "the", "serviced", "master" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L57-L60
139,224
control-center/serviced
node/lbClient.go
GetISvcEndpoints
func (a *LBClient) GetISvcEndpoints(serviceId string, endpoints *map[string][]applicationendpoint.ApplicationEndpoint) error { glog.V(4).Infof("ControlCenterAgent.GetISvcEndpoints()") return a.rpcClient.Call("ControlCenterAgent.GetISvcEndpoints", serviceId, endpoints, 0) }
go
func (a *LBClient) GetISvcEndpoints(serviceId string, endpoints *map[string][]applicationendpoint.ApplicationEndpoint) error { glog.V(4).Infof("ControlCenterAgent.GetISvcEndpoints()") return a.rpcClient.Call("ControlCenterAgent.GetISvcEndpoints", serviceId, endpoints, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "GetISvcEndpoints", "(", "serviceId", "string", ",", "endpoints", "*", "map", "[", "string", "]", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", ")", "error", "{", "glog", ".", "V", "(", "4", ")", "."...
// GetISvcEndpoints returns a list of controlplane endpoints for the given service endpoint request.
[ "GetISvcEndpoints", "returns", "a", "list", "of", "controlplane", "endpoints", "for", "the", "given", "service", "endpoint", "request", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L63-L66
139,225
control-center/serviced
node/lbClient.go
ReportHealthStatus
func (a *LBClient) ReportHealthStatus(req master.HealthStatusRequest, unused *int) error { glog.V(4).Infof("ControlCenterAgent.ReportHealthStatus()") return a.rpcClient.Call("ControlCenterAgent.ReportHealthStatus", req, unused, 0) }
go
func (a *LBClient) ReportHealthStatus(req master.HealthStatusRequest, unused *int) error { glog.V(4).Infof("ControlCenterAgent.ReportHealthStatus()") return a.rpcClient.Call("ControlCenterAgent.ReportHealthStatus", req, unused, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "ReportHealthStatus", "(", "req", "master", ".", "HealthStatusRequest", ",", "unused", "*", "int", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "a", ...
// ReportHealthStatus stores a health check result.
[ "ReportHealthStatus", "stores", "a", "health", "check", "result", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L88-L91
139,226
control-center/serviced
node/lbClient.go
ReportInstanceDead
func (a *LBClient) ReportInstanceDead(req master.ServiceInstanceRequest, unused *int) error { glog.V(4).Infof("ControlCenterAgent.ReportInstanceDead()") return a.rpcClient.Call("ControlCenterAgent.ReportInstanceDead", req, unused, 0) }
go
func (a *LBClient) ReportInstanceDead(req master.ServiceInstanceRequest, unused *int) error { glog.V(4).Infof("ControlCenterAgent.ReportInstanceDead()") return a.rpcClient.Call("ControlCenterAgent.ReportInstanceDead", req, unused, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "ReportInstanceDead", "(", "req", "master", ".", "ServiceInstanceRequest", ",", "unused", "*", "int", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "a",...
// ReportInstanceDead removes health check results for an instance.
[ "ReportInstanceDead", "removes", "health", "check", "results", "for", "an", "instance", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L94-L97
139,227
control-center/serviced
node/lbClient.go
GetZkInfo
func (a *LBClient) GetZkInfo(zkInfo *ZkInfo) error { glog.V(4).Infof("ControlCenterAgent.GetZkInfo()") return a.rpcClient.Call("ControlCenterAgent.GetZkInfo", "na", zkInfo, 0) }
go
func (a *LBClient) GetZkInfo(zkInfo *ZkInfo) error { glog.V(4).Infof("ControlCenterAgent.GetZkInfo()") return a.rpcClient.Call("ControlCenterAgent.GetZkInfo", "na", zkInfo, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "GetZkInfo", "(", "zkInfo", "*", "ZkInfo", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "a", ".", "rpcClient", ".", "Call", "(", "\"", "\"", ",",...
// GetZkInfo returns the agent's zookeeper connection string
[ "GetZkInfo", "returns", "the", "agent", "s", "zookeeper", "connection", "string" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L106-L109
139,228
control-center/serviced
node/lbClient.go
GetServiceBindMounts
func (a *LBClient) GetServiceBindMounts(serviceID string, bindmounts *map[string]string) error { glog.V(4).Infof("ControlCenterAgent.GetServiceBindMounts(serviceID:%s)", serviceID) return a.rpcClient.Call("ControlCenterAgent.GetServiceBindMounts", serviceID, bindmounts, 0) }
go
func (a *LBClient) GetServiceBindMounts(serviceID string, bindmounts *map[string]string) error { glog.V(4).Infof("ControlCenterAgent.GetServiceBindMounts(serviceID:%s)", serviceID) return a.rpcClient.Call("ControlCenterAgent.GetServiceBindMounts", serviceID, bindmounts, 0) }
[ "func", "(", "a", "*", "LBClient", ")", "GetServiceBindMounts", "(", "serviceID", "string", ",", "bindmounts", "*", "map", "[", "string", "]", "string", ")", "error", "{", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", "\"", "\"", ",", "serviceI...
// GetServiceBindMounts returns the service
[ "GetServiceBindMounts", "returns", "the", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/lbClient.go#L112-L115
139,229
control-center/serviced
domain/hostkey/store.go
Get
func (s *storeImpl) Get(ctx datastore.Context, id string) (*HostKey, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("HostKeyStore.Get")) val := &HostKey{} if err := s.ds.Get(ctx, Key(id), val); err != nil { return nil, err } return val, nil }
go
func (s *storeImpl) Get(ctx datastore.Context, id string) (*HostKey, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("HostKeyStore.Get")) val := &HostKey{} if err := s.ds.Get(ctx, Key(id), val); err != nil { return nil, err } return val, nil }
[ "func", "(", "s", "*", "storeImpl", ")", "Get", "(", "ctx", "datastore", ".", "Context", ",", "id", "string", ")", "(", "*", "HostKey", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "("...
// Get an RSA Key by host id. Return ErrNoSuchEntity if not found
[ "Get", "an", "RSA", "Key", "by", "host", "id", ".", "Return", "ErrNoSuchEntity", "if", "not", "found" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/hostkey/store.go#L42-L49
139,230
control-center/serviced
utils/utils_darwin.go
getHostID
func getHostID() (hostid string, err error) { var mib []C.int = []C.int{ C.CTL_KERN, C.KERN_HOSTID } var value C.int64_t = 0 var length C.size_t = 8 var unused unsafe.Pointer if rc, errno := C.sysctl(&mib[0], 2, unsafe.Pointer(&value), &length, unused, 0); rc == -1 { return "", fmt.Errorf("unable to get hostID:...
go
func getHostID() (hostid string, err error) { var mib []C.int = []C.int{ C.CTL_KERN, C.KERN_HOSTID } var value C.int64_t = 0 var length C.size_t = 8 var unused unsafe.Pointer if rc, errno := C.sysctl(&mib[0], 2, unsafe.Pointer(&value), &length, unused, 0); rc == -1 { return "", fmt.Errorf("unable to get hostID:...
[ "func", "getHostID", "(", ")", "(", "hostid", "string", ",", "err", "error", ")", "{", "var", "mib", "[", "]", "C", ".", "int", "=", "[", "]", "C", ".", "int", "{", "C", ".", "CTL_KERN", ",", "C", ".", "KERN_HOSTID", "}", "\n", "var", "value", ...
// getHostID retrieves the system's unique id
[ "getHostID", "retrieves", "the", "system", "s", "unique", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/utils_darwin.go#L36-L63
139,231
control-center/serviced
dfs/registry/index.go
NewRegistryIndexClient
func NewRegistryIndexClient(f facade) *RegistryIndexClient { return &RegistryIndexClient{ ctx: datastore.Get(), facade: f, } }
go
func NewRegistryIndexClient(f facade) *RegistryIndexClient { return &RegistryIndexClient{ ctx: datastore.Get(), facade: f, } }
[ "func", "NewRegistryIndexClient", "(", "f", "facade", ")", "*", "RegistryIndexClient", "{", "return", "&", "RegistryIndexClient", "{", "ctx", ":", "datastore", ".", "Get", "(", ")", ",", "facade", ":", "f", ",", "}", "\n", "}" ]
// NewRegistryIndexClient creates a new client for the registry index.
[ "NewRegistryIndexClient", "creates", "a", "new", "client", "for", "the", "registry", "index", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/index.go#L53-L58
139,232
control-center/serviced
dfs/registry/index.go
FindImage
func (client *RegistryIndexClient) FindImage(image string) (*registry.Image, error) { image, err := client.parseImage(image) if err != nil { return nil, err } rImage, err := client.facade.GetRegistryImage(client.ctx, image) if datastore.IsErrNoSuchEntity(err) { return nil, ErrImageNotFound } return rImage, e...
go
func (client *RegistryIndexClient) FindImage(image string) (*registry.Image, error) { image, err := client.parseImage(image) if err != nil { return nil, err } rImage, err := client.facade.GetRegistryImage(client.ctx, image) if datastore.IsErrNoSuchEntity(err) { return nil, ErrImageNotFound } return rImage, e...
[ "func", "(", "client", "*", "RegistryIndexClient", ")", "FindImage", "(", "image", "string", ")", "(", "*", "registry", ".", "Image", ",", "error", ")", "{", "image", ",", "err", ":=", "client", ".", "parseImage", "(", "image", ")", "\n", "if", "err", ...
// FindImage implements RegistryIndex
[ "FindImage", "implements", "RegistryIndex" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/index.go#L78-L88
139,233
control-center/serviced
dfs/registry/index.go
PushImage
func (client *RegistryIndexClient) PushImage(image, uuid string, hash string) error { imageID, err := commons.ParseImageID(image) if err != nil { return err } if imageID.IsLatest() { imageID.Tag = docker.Latest } rImage := &registry.Image{ Library: imageID.User, Repo: imageID.Repo, Tag: imageID....
go
func (client *RegistryIndexClient) PushImage(image, uuid string, hash string) error { imageID, err := commons.ParseImageID(image) if err != nil { return err } if imageID.IsLatest() { imageID.Tag = docker.Latest } rImage := &registry.Image{ Library: imageID.User, Repo: imageID.Repo, Tag: imageID....
[ "func", "(", "client", "*", "RegistryIndexClient", ")", "PushImage", "(", "image", ",", "uuid", "string", ",", "hash", "string", ")", "error", "{", "imageID", ",", "err", ":=", "commons", ".", "ParseImageID", "(", "image", ")", "\n", "if", "err", "!=", ...
// PushImage implements RegistryIndex
[ "PushImage", "implements", "RegistryIndex" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/index.go#L91-L108
139,234
control-center/serviced
dfs/registry/index.go
RemoveImage
func (client *RegistryIndexClient) RemoveImage(image string) error { var err error if image, err = client.parseImage(image); err != nil { return err } return client.facade.DeleteRegistryImage(client.ctx, image) }
go
func (client *RegistryIndexClient) RemoveImage(image string) error { var err error if image, err = client.parseImage(image); err != nil { return err } return client.facade.DeleteRegistryImage(client.ctx, image) }
[ "func", "(", "client", "*", "RegistryIndexClient", ")", "RemoveImage", "(", "image", "string", ")", "error", "{", "var", "err", "error", "\n", "if", "image", ",", "err", "=", "client", ".", "parseImage", "(", "image", ")", ";", "err", "!=", "nil", "{",...
// RemoveImage implements RegistryIndex
[ "RemoveImage", "implements", "RegistryIndex" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/index.go#L111-L117
139,235
control-center/serviced
dfs/registry/index.go
SearchLibraryByTag
func (client *RegistryIndexClient) SearchLibraryByTag(library, tag string) ([]registry.Image, error) { return client.facade.SearchRegistryLibraryByTag(client.ctx, library, tag) }
go
func (client *RegistryIndexClient) SearchLibraryByTag(library, tag string) ([]registry.Image, error) { return client.facade.SearchRegistryLibraryByTag(client.ctx, library, tag) }
[ "func", "(", "client", "*", "RegistryIndexClient", ")", "SearchLibraryByTag", "(", "library", ",", "tag", "string", ")", "(", "[", "]", "registry", ".", "Image", ",", "error", ")", "{", "return", "client", ".", "facade", ".", "SearchRegistryLibraryByTag", "(...
// SearchLibraryByTag implements RegistryIndex
[ "SearchLibraryByTag", "implements", "RegistryIndex" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/registry/index.go#L120-L122
139,236
control-center/serviced
zzk/service/hostregistry.go
NewHostRegistryListener
func NewHostRegistryListener(poolid string, handler VirtualIPUnassignmentHandler) *HostRegistryListener { return &HostRegistryListener{ poolid: poolid, handler: handler, isOnline: make(chan struct{}), } }
go
func NewHostRegistryListener(poolid string, handler VirtualIPUnassignmentHandler) *HostRegistryListener { return &HostRegistryListener{ poolid: poolid, handler: handler, isOnline: make(chan struct{}), } }
[ "func", "NewHostRegistryListener", "(", "poolid", "string", ",", "handler", "VirtualIPUnassignmentHandler", ")", "*", "HostRegistryListener", "{", "return", "&", "HostRegistryListener", "{", "poolid", ":", "poolid", ",", "handler", ":", "handler", ",", "isOnline", "...
// NewHostRegistryListener instantiates a new host registry listener
[ "NewHostRegistryListener", "instantiates", "a", "new", "host", "registry", "listener" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostregistry.go#L44-L50
139,237
control-center/serviced
zzk/service/hostregistry.go
getTimeout
func (h *HostRegistryListener) getTimeout() time.Duration { logger := plog.WithField("poolid", h.poolid) var p PoolNode if err := h.conn.Get("/pools/"+h.poolid, &p); err != nil { logger.WithError(err).Warn("Could not look up resource pool for connection timeout") return 0 } return p.GetConnectionTimeout() }
go
func (h *HostRegistryListener) getTimeout() time.Duration { logger := plog.WithField("poolid", h.poolid) var p PoolNode if err := h.conn.Get("/pools/"+h.poolid, &p); err != nil { logger.WithError(err).Warn("Could not look up resource pool for connection timeout") return 0 } return p.GetConnectionTimeout() }
[ "func", "(", "h", "*", "HostRegistryListener", ")", "getTimeout", "(", ")", "time", ".", "Duration", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ",", "h", ".", "poolid", ")", "\n\n", "var", "p", "PoolNode", "\n", "if", "err", ":="...
// getTimeout returns the pool connection timeout. Returns 0 if data cannot be // acquired.
[ "getTimeout", "returns", "the", "pool", "connection", "timeout", ".", "Returns", "0", "if", "data", "cannot", "be", "acquired", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostregistry.go#L328-L338
139,238
control-center/serviced
zzk/service/hostregistry.go
GetRegisteredHosts
func (h *HostRegistryListener) GetRegisteredHosts(cancel <-chan interface{}) ([]host.Host, error) { logger := plog.WithField("poolid", h.poolid) var conn client.Connection if conn = h.conn; conn == nil { return nil, errors.New("connection is not initialized") } for { hosts, err := GetRegisteredHostsForPool(c...
go
func (h *HostRegistryListener) GetRegisteredHosts(cancel <-chan interface{}) ([]host.Host, error) { logger := plog.WithField("poolid", h.poolid) var conn client.Connection if conn = h.conn; conn == nil { return nil, errors.New("connection is not initialized") } for { hosts, err := GetRegisteredHostsForPool(c...
[ "func", "(", "h", "*", "HostRegistryListener", ")", "GetRegisteredHosts", "(", "cancel", "<-", "chan", "interface", "{", "}", ")", "(", "[", "]", "host", ".", "Host", ",", "error", ")", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ...
// GetRegisteredHosts returns a list of hosts that are active. If there are // zero active hosts, then it will wait until at least one host is available.
[ "GetRegisteredHosts", "returns", "a", "list", "of", "hosts", "that", "are", "active", ".", "If", "there", "are", "zero", "active", "hosts", "then", "it", "will", "wait", "until", "at", "least", "one", "host", "is", "available", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostregistry.go#L342-L369
139,239
control-center/serviced
zzk/service/hostregistry.go
RegisterHost
func RegisterHost(cancel <-chan interface{}, conn client.Connection, hostid string) error { logger := plog.WithField("hostid", hostid) pth := path.Join("/hosts", hostid, "online") // clean up ephemeral nodes on exit defer func() { ch, _ := conn.Children(pth) for _, n := range ch { conn.Delete(path.Join(pth...
go
func RegisterHost(cancel <-chan interface{}, conn client.Connection, hostid string) error { logger := plog.WithField("hostid", hostid) pth := path.Join("/hosts", hostid, "online") // clean up ephemeral nodes on exit defer func() { ch, _ := conn.Children(pth) for _, n := range ch { conn.Delete(path.Join(pth...
[ "func", "RegisterHost", "(", "cancel", "<-", "chan", "interface", "{", "}", ",", "conn", "client", ".", "Connection", ",", "hostid", "string", ")", "error", "{", "logger", ":=", "plog", ".", "WithField", "(", "\"", "\"", ",", "hostid", ")", "\n\n", "pt...
// RegisterHost persists a registered host to the coordinator. This is managed // by the worker node, so it is expected that the connection will be pre-loaded // with the path to the resource pool.
[ "RegisterHost", "persists", "a", "registered", "host", "to", "the", "coordinator", ".", "This", "is", "managed", "by", "the", "worker", "node", "so", "it", "is", "expected", "that", "the", "connection", "will", "be", "pre", "-", "loaded", "with", "the", "p...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostregistry.go#L420-L524
139,240
control-center/serviced
zzk/sync.go
Sync
func Sync(conn client.Connection, data []Node, zkpath string) error { var current []string if exists, err := PathExists(conn, zkpath); err != nil { return err } else if !exists { // pass } else if current, err = conn.Children(zkpath); err != nil { return err } datamap := make(map[string]Node) for i, node ...
go
func Sync(conn client.Connection, data []Node, zkpath string) error { var current []string if exists, err := PathExists(conn, zkpath); err != nil { return err } else if !exists { // pass } else if current, err = conn.Children(zkpath); err != nil { return err } datamap := make(map[string]Node) for i, node ...
[ "func", "Sync", "(", "conn", "client", ".", "Connection", ",", "data", "[", "]", "Node", ",", "zkpath", "string", ")", "error", "{", "var", "current", "[", "]", "string", "\n", "if", "exists", ",", "err", ":=", "PathExists", "(", "conn", ",", "zkpath...
// Sync synchronizes zookeeper data with what is in elastic or any other storage facility
[ "Sync", "synchronizes", "zookeeper", "data", "with", "what", "is", "in", "elastic", "or", "any", "other", "storage", "facility" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/sync.go#L67-L105
139,241
control-center/serviced
zzk/sync.go
PostProcess
func (l *Synchronizer) PostProcess(processing map[string]struct{}) { // Get all locally stored data nodes, err := l.GetAll() if err != nil { glog.Warningf("Could not access locally stored data: %s", err) return } // Delete any local nodes that do not exist remotely and are not in process for _, node := range...
go
func (l *Synchronizer) PostProcess(processing map[string]struct{}) { // Get all locally stored data nodes, err := l.GetAll() if err != nil { glog.Warningf("Could not access locally stored data: %s", err) return } // Delete any local nodes that do not exist remotely and are not in process for _, node := range...
[ "func", "(", "l", "*", "Synchronizer", ")", "PostProcess", "(", "processing", "map", "[", "string", "]", "struct", "{", "}", ")", "{", "// Get all locally stored data", "nodes", ",", "err", ":=", "l", ".", "GetAll", "(", ")", "\n", "if", "err", "!=", "...
// PostProcess deletes any orphaned data that exists locally
[ "PostProcess", "deletes", "any", "orphaned", "data", "that", "exists", "locally" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/sync.go#L126-L142
139,242
control-center/serviced
zzk/sync.go
Spawn
func (l *Synchronizer) Spawn(shutdown <-chan interface{}, nodeID string) { // Start dependent listeners var ( wg sync.WaitGroup _shutdown = make(chan interface{}) stopping = make(chan interface{}) ) defer func() { close(_shutdown) wg.Wait() }() var id string var wait <-chan time.Time done :=...
go
func (l *Synchronizer) Spawn(shutdown <-chan interface{}, nodeID string) { // Start dependent listeners var ( wg sync.WaitGroup _shutdown = make(chan interface{}) stopping = make(chan interface{}) ) defer func() { close(_shutdown) wg.Wait() }() var id string var wait <-chan time.Time done :=...
[ "func", "(", "l", "*", "Synchronizer", ")", "Spawn", "(", "shutdown", "<-", "chan", "interface", "{", "}", ",", "nodeID", "string", ")", "{", "// Start dependent listeners", "var", "(", "wg", "sync", ".", "WaitGroup", "\n", "_shutdown", "=", "make", "(", ...
// Spawn starts the remote Synchronizer based on nodeID
[ "Spawn", "starts", "the", "remote", "Synchronizer", "based", "on", "nodeID" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/sync.go#L145-L208
139,243
control-center/serviced
utils/utils_linux.go
getRoutes
func getRoutes() (routes []RouteEntry, err error) { output, err := exec.Command("/sbin/route", "-A", "inet").Output() if err != nil { return routes, err } columnMap := make(map[string]int) lines := strings.Split(strings.TrimSpace(string(output)), "\n") if len(lines) < 2 { return routes, fmt.Errorf("no routes...
go
func getRoutes() (routes []RouteEntry, err error) { output, err := exec.Command("/sbin/route", "-A", "inet").Output() if err != nil { return routes, err } columnMap := make(map[string]int) lines := strings.Split(strings.TrimSpace(string(output)), "\n") if len(lines) < 2 { return routes, fmt.Errorf("no routes...
[ "func", "getRoutes", "(", ")", "(", "routes", "[", "]", "RouteEntry", ",", "err", "error", ")", "{", "output", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ".", "Output", "(", ")", "\n", "if"...
// Returns a list of network routes
[ "Returns", "a", "list", "of", "network", "routes" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/utils_linux.go#L85-L135
139,244
control-center/serviced
commons/proc/nfsd.go
Equals
func (a *ProcNFSDExports) Equals(b *ProcNFSDExports) bool { if a.MountPoint != b.MountPoint { return false } if !reflect.DeepEqual(a.ClientOptions, b.ClientOptions) { return false } return true }
go
func (a *ProcNFSDExports) Equals(b *ProcNFSDExports) bool { if a.MountPoint != b.MountPoint { return false } if !reflect.DeepEqual(a.ClientOptions, b.ClientOptions) { return false } return true }
[ "func", "(", "a", "*", "ProcNFSDExports", ")", "Equals", "(", "b", "*", "ProcNFSDExports", ")", "bool", "{", "if", "a", ".", "MountPoint", "!=", "b", ".", "MountPoint", "{", "return", "false", "\n", "}", "\n", "if", "!", "reflect", ".", "DeepEqual", ...
// Equals checks the equality of two ProcNFSDExports
[ "Equals", "checks", "the", "equality", "of", "two", "ProcNFSDExports" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/proc/nfsd.go#L41-L49
139,245
control-center/serviced
commons/proc/nfsd.go
parseOptions
func parseOptions(line string) map[string]string { options := map[string]string{} optionParts := strings.Split(line, ",") for _, option := range optionParts { pairs := strings.SplitN(option, "=", 2) switch len(pairs) { case 1: glog.V(4).Infof("option: %s", pairs[0]) options[pairs[0]] = "" continue c...
go
func parseOptions(line string) map[string]string { options := map[string]string{} optionParts := strings.Split(line, ",") for _, option := range optionParts { pairs := strings.SplitN(option, "=", 2) switch len(pairs) { case 1: glog.V(4).Infof("option: %s", pairs[0]) options[pairs[0]] = "" continue c...
[ "func", "parseOptions", "(", "line", "string", ")", "map", "[", "string", "]", "string", "{", "options", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "optionParts", ":=", "strings", ".", "Split", "(", "line", ",", "\"", "\"", ")", "\n",...
// parseOptions generates a map from a line specifying options
[ "parseOptions", "generates", "a", "map", "from", "a", "line", "specifying", "options" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/proc/nfsd.go#L125-L143
139,246
control-center/serviced
cli/api/options.go
ValidateCommonOptions
func ValidateCommonOptions(opts config.Options) error { var err error rpcutils.RPCCertVerify, err = strconv.ParseBool(opts.RPCCertVerify) if err != nil { return fmt.Errorf("error parsing rpc-cert-verify value %v", err) } rpcutils.RPCDisableTLS, err = strconv.ParseBool(opts.RPCDisableTLS) if err != nil { retu...
go
func ValidateCommonOptions(opts config.Options) error { var err error rpcutils.RPCCertVerify, err = strconv.ParseBool(opts.RPCCertVerify) if err != nil { return fmt.Errorf("error parsing rpc-cert-verify value %v", err) } rpcutils.RPCDisableTLS, err = strconv.ParseBool(opts.RPCDisableTLS) if err != nil { retu...
[ "func", "ValidateCommonOptions", "(", "opts", "config", ".", "Options", ")", "error", "{", "var", "err", "error", "\n\n", "rpcutils", ".", "RPCCertVerify", ",", "err", "=", "strconv", ".", "ParseBool", "(", "opts", ".", "RPCCertVerify", ")", "\n", "if", "e...
// Validate options which are common to all CLI commands
[ "Validate", "options", "which", "are", "common", "to", "all", "CLI", "commands" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/options.go#L41-L63
139,247
control-center/serviced
cli/api/options.go
ValidateServerOptions
func ValidateServerOptions(options *config.Options) error { if err := validateStorageArgs(options); err != nil { return err } // Make sure we have an endpoint to work with if len(options.Endpoint) == 0 { if options.Master { outboundIP, err := getOutboundIP() if err != nil { log.WithError(err).Fatal("...
go
func ValidateServerOptions(options *config.Options) error { if err := validateStorageArgs(options); err != nil { return err } // Make sure we have an endpoint to work with if len(options.Endpoint) == 0 { if options.Master { outboundIP, err := getOutboundIP() if err != nil { log.WithError(err).Fatal("...
[ "func", "ValidateServerOptions", "(", "options", "*", "config", ".", "Options", ")", "error", "{", "if", "err", ":=", "validateStorageArgs", "(", "options", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Make sure we have an endpoin...
// Validate options which are specific to running as a server
[ "Validate", "options", "which", "are", "specific", "to", "running", "as", "a", "server" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/options.go#L66-L90
139,248
control-center/serviced
cli/api/options.go
getOutboundIP
func getOutboundIP() (string, error) { var outboundIP string var err error timeout := time.After(outboundIPMaxWait * time.Second) for { if outboundIP, err = utils.GetIPAddress(); err == nil { // Success return outboundIP, nil } select { case <-timeout: // Give up return "", fmt.Errorf("Gave up w...
go
func getOutboundIP() (string, error) { var outboundIP string var err error timeout := time.After(outboundIPMaxWait * time.Second) for { if outboundIP, err = utils.GetIPAddress(); err == nil { // Success return outboundIP, nil } select { case <-timeout: // Give up return "", fmt.Errorf("Gave up w...
[ "func", "getOutboundIP", "(", ")", "(", "string", ",", "error", ")", "{", "var", "outboundIP", "string", "\n", "var", "err", "error", "\n", "timeout", ":=", "time", ".", "After", "(", "outboundIPMaxWait", "*", "time", ".", "Second", ")", "\n", "for", "...
// getOutboundIP queries the network configuration for an IP address suitable for reaching the outside world. // Will retry for a while if a path to the outside world is not yet available.
[ "getOutboundIP", "queries", "the", "network", "configuration", "for", "an", "IP", "address", "suitable", "for", "reaching", "the", "outside", "world", ".", "Will", "retry", "for", "a", "while", "if", "a", "path", "to", "the", "outside", "world", "is", "not",...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/api/options.go#L252-L271
139,249
control-center/serviced
zzk/service/servicestate.go
NewServiceListener
func NewServiceListener(poolid string, handler ServiceHandler) *ServiceListener { return &ServiceListener{poolid: poolid, handler: handler, mu: &sync.Mutex{}} }
go
func NewServiceListener(poolid string, handler ServiceHandler) *ServiceListener { return &ServiceListener{poolid: poolid, handler: handler, mu: &sync.Mutex{}} }
[ "func", "NewServiceListener", "(", "poolid", "string", ",", "handler", "ServiceHandler", ")", "*", "ServiceListener", "{", "return", "&", "ServiceListener", "{", "poolid", ":", "poolid", ",", "handler", ":", "handler", ",", "mu", ":", "&", "sync", ".", "Mute...
// NewServiceListener instantiates a new ServiceListener
[ "NewServiceListener", "instantiates", "a", "new", "ServiceListener" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/servicestate.go#L41-L43
139,250
control-center/serviced
zzk/service/servicestate.go
getStateRequests
func (l *ServiceListener) getStateRequests(logger *log.Entry, stateIDs []string) ([]StateRequest, bool) { reqs := make([]StateRequest, len(stateIDs)) ok := true for i, stateID := range stateIDs { hostID, serviceID, instanceID, err := ParseStateID(stateID) if err != nil { // This shouldn't happen logger....
go
func (l *ServiceListener) getStateRequests(logger *log.Entry, stateIDs []string) ([]StateRequest, bool) { reqs := make([]StateRequest, len(stateIDs)) ok := true for i, stateID := range stateIDs { hostID, serviceID, instanceID, err := ParseStateID(stateID) if err != nil { // This shouldn't happen logger....
[ "func", "(", "l", "*", "ServiceListener", ")", "getStateRequests", "(", "logger", "*", "log", ".", "Entry", ",", "stateIDs", "[", "]", "string", ")", "(", "[", "]", "StateRequest", ",", "bool", ")", "{", "reqs", ":=", "make", "(", "[", "]", "StateReq...
// getStateRequests returns a list of state requests
[ "getStateRequests", "returns", "a", "list", "of", "state", "requests" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/servicestate.go#L175-L199
139,251
control-center/serviced
zzk/service/servicestate.go
Start
func (l *ServiceListener) Start(sn *ServiceNode, instanceID int) bool { l.mu.Lock() defer l.mu.Unlock() logger := plog.WithFields(log.Fields{ "serviceid": sn.ID, "servicename": sn.Name, "shouldhaveaddressassignment": sn.ShouldHaveAddressAssignment, "instanceid": ...
go
func (l *ServiceListener) Start(sn *ServiceNode, instanceID int) bool { l.mu.Lock() defer l.mu.Unlock() logger := plog.WithFields(log.Fields{ "serviceid": sn.ID, "servicename": sn.Name, "shouldhaveaddressassignment": sn.ShouldHaveAddressAssignment, "instanceid": ...
[ "func", "(", "l", "*", "ServiceListener", ")", "Start", "(", "sn", "*", "ServiceNode", ",", "instanceID", "int", ")", "bool", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "logger", ":...
// Start schedules a service instance
[ "Start", "schedules", "a", "service", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/servicestate.go#L281-L329
139,252
control-center/serviced
zzk/service/servicestate.go
Stop
func (l *ServiceListener) Stop(reqs []StateRequest) (int, bool) { delta := 0 ok := true for _, req := range reqs { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "serviceid": req.ServiceID, "instanceid": req.InstanceID, }) isOnline, err := IsHostOnline(l.conn, req.PoolID, req.Host...
go
func (l *ServiceListener) Stop(reqs []StateRequest) (int, bool) { delta := 0 ok := true for _, req := range reqs { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "serviceid": req.ServiceID, "instanceid": req.InstanceID, }) isOnline, err := IsHostOnline(l.conn, req.PoolID, req.Host...
[ "func", "(", "l", "*", "ServiceListener", ")", "Stop", "(", "reqs", "[", "]", "StateRequest", ")", "(", "int", ",", "bool", ")", "{", "delta", ":=", "0", "\n", "ok", ":=", "true", "\n\n", "for", "_", ",", "req", ":=", "range", "reqs", "{", "logge...
// Stop unschedules the list of service instances and returns the number of // instances successfully stopped.
[ "Stop", "unschedules", "the", "list", "of", "service", "instances", "and", "returns", "the", "number", "of", "instances", "successfully", "stopped", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/servicestate.go#L333-L384
139,253
control-center/serviced
zzk/service/servicestate.go
Pause
func (l *ServiceListener) Pause(reqs []StateRequest) (int, bool) { delta := 0 ok := true for _, req := range reqs { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "serviceid": req.ServiceID, "instanceid": req.InstanceID, }) // ONLY pause services with a desired state of run if e...
go
func (l *ServiceListener) Pause(reqs []StateRequest) (int, bool) { delta := 0 ok := true for _, req := range reqs { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "serviceid": req.ServiceID, "instanceid": req.InstanceID, }) // ONLY pause services with a desired state of run if e...
[ "func", "(", "l", "*", "ServiceListener", ")", "Pause", "(", "reqs", "[", "]", "StateRequest", ")", "(", "int", ",", "bool", ")", "{", "delta", ":=", "0", "\n", "ok", ":=", "true", "\n\n", "for", "_", ",", "req", ":=", "range", "reqs", "{", "logg...
// Pause schedules the service instance as paused and returns the number of // affected instances.
[ "Pause", "schedules", "the", "service", "instance", "as", "paused", "and", "returns", "the", "number", "of", "affected", "instances", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/servicestate.go#L388-L417
139,254
control-center/serviced
facade/service.go
AddService
func (f *Facade) AddService(ctx datastore.Context, svc service.Service) (err error) { var tenantID string defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddService")) alog := f.auditLogger.Action(audit.Add).Message(ctx, "Adding new Service ").WithField("servicename", svc.Name).Entity(&svc) if svc.ParentServi...
go
func (f *Facade) AddService(ctx datastore.Context, svc service.Service) (err error) { var tenantID string defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddService")) alog := f.auditLogger.Action(audit.Add).Message(ctx, "Adding new Service ").WithField("servicename", svc.Name).Entity(&svc) if svc.ParentServi...
[ "func", "(", "f", "*", "Facade", ")", "AddService", "(", "ctx", "datastore", ".", "Context", ",", "svc", "service", ".", "Service", ")", "(", "err", "error", ")", "{", "var", "tenantID", "string", "\n", "defer", "ctx", ".", "Metrics", "(", ")", ".", ...
// AddService adds a service; return error if service already exists
[ "AddService", "adds", "a", "service", ";", "return", "error", "if", "service", "already", "exists" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L82-L96
139,255
control-center/serviced
facade/service.go
validateServiceOptions
func validateServiceOptions(svc *service.Service) error { // ChangeOption RestartAllOnInstanceChanged and HostPolicy RequireSeparate are invalid together. if svc.HostPolicy == servicedefinition.RequireSeparate && servicedefinition.ChangeOptions(svc.ChangeOptions).Contains(servicedefinition.RestartAllOnInstanceChang...
go
func validateServiceOptions(svc *service.Service) error { // ChangeOption RestartAllOnInstanceChanged and HostPolicy RequireSeparate are invalid together. if svc.HostPolicy == servicedefinition.RequireSeparate && servicedefinition.ChangeOptions(svc.ChangeOptions).Contains(servicedefinition.RestartAllOnInstanceChang...
[ "func", "validateServiceOptions", "(", "svc", "*", "service", ".", "Service", ")", "error", "{", "// ChangeOption RestartAllOnInstanceChanged and HostPolicy RequireSeparate are invalid together.", "if", "svc", ".", "HostPolicy", "==", "servicedefinition", ".", "RequireSeparate"...
// Validates that the service doesn't have invalid options specified. This is called when adding, // updating, or trying to start services.
[ "Validates", "that", "the", "service", "doesn", "t", "have", "invalid", "options", "specified", ".", "This", "is", "called", "when", "adding", "updating", "or", "trying", "to", "start", "services", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L250-L259
139,256
control-center/serviced
facade/service.go
getChanges
func (f * Facade) getChanges(ctx datastore.Context, svc service.Service) string { var updates string store := f.serviceStore cursvc, err := store.Get(ctx, svc.ID) if err != nil { glog.Errorf("Could not load service %s (%s) from database: %s", svc.Name, svc.ID, err) return updates } if !reflect.DeepEqua...
go
func (f * Facade) getChanges(ctx datastore.Context, svc service.Service) string { var updates string store := f.serviceStore cursvc, err := store.Get(ctx, svc.ID) if err != nil { glog.Errorf("Could not load service %s (%s) from database: %s", svc.Name, svc.ID, err) return updates } if !reflect.DeepEqua...
[ "func", "(", "f", "*", "Facade", ")", "getChanges", "(", "ctx", "datastore", ".", "Context", ",", "svc", "service", ".", "Service", ")", "string", "{", "var", "updates", "string", "\n", "store", ":=", "f", ".", "serviceStore", "\n", "cursvc", ",", "err...
//Get changes made by "serviced service edit" call
[ "Get", "changes", "made", "by", "serviced", "service", "edit", "call" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L262-L292
139,257
control-center/serviced
facade/service.go
UpdateService
func (f *Facade) UpdateService(ctx datastore.Context, svc service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.UpdateService")) alog := f.auditLogger.Action(audit.Update).Message(ctx, "Update Service").WithField("servicename", svc.Name).Entity(&svc) tenantID, err := f.GetTenantID(ctx, svc.ID...
go
func (f *Facade) UpdateService(ctx datastore.Context, svc service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.UpdateService")) alog := f.auditLogger.Action(audit.Update).Message(ctx, "Update Service").WithField("servicename", svc.Name).Entity(&svc) tenantID, err := f.GetTenantID(ctx, svc.ID...
[ "func", "(", "f", "*", "Facade", ")", "UpdateService", "(", "ctx", "datastore", ".", "Context", ",", "svc", "service", ".", "Service", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", "...
// UpdateService updates an existing service; return error if the service does // not exist.
[ "UpdateService", "updates", "an", "existing", "service", ";", "return", "error", "if", "the", "service", "does", "not", "exist", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L296-L309
139,258
control-center/serviced
facade/service.go
validateServiceName
func (f *Facade) validateServiceName(ctx datastore.Context, svc *service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceName")) store := f.serviceStore if svc.ParentServiceID != "" { psvc, err := store.Get(ctx, svc.ParentServiceID) if err != nil { glog.Errorf("Could not v...
go
func (f *Facade) validateServiceName(ctx datastore.Context, svc *service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceName")) store := f.serviceStore if svc.ParentServiceID != "" { psvc, err := store.Get(ctx, svc.ParentServiceID) if err != nil { glog.Errorf("Could not v...
[ "func", "(", "f", "*", "Facade", ")", "validateServiceName", "(", "ctx", "datastore", ".", "Context", ",", "svc", "*", "service", ".", "Service", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(...
// validateServiceName ensures that the service does not collide with a // service at the same path
[ "validateServiceName", "ensures", "that", "the", "service", "does", "not", "collide", "with", "a", "service", "at", "the", "same", "path" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L509-L529
139,259
control-center/serviced
facade/service.go
validateServiceTenant
func (f *Facade) validateServiceTenant(ctx datastore.Context, serviceA, serviceB string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceTenant")) if serviceA == "" || serviceB == "" { return ErrTenantDoesNotMatch } tenantA, err := f.GetTenantID(ctx, serviceA) if err != nil { glog.E...
go
func (f *Facade) validateServiceTenant(ctx datastore.Context, serviceA, serviceB string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceTenant")) if serviceA == "" || serviceB == "" { return ErrTenantDoesNotMatch } tenantA, err := f.GetTenantID(ctx, serviceA) if err != nil { glog.E...
[ "func", "(", "f", "*", "Facade", ")", "validateServiceTenant", "(", "ctx", "datastore", ".", "Context", ",", "serviceA", ",", "serviceB", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(...
// validateServiceTenant ensures the services are on the same tenant
[ "validateServiceTenant", "ensures", "the", "services", "are", "on", "the", "same", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L532-L551
139,260
control-center/serviced
facade/service.go
validateServiceStart
func (f *Facade) validateServiceStart(ctx datastore.Context, svc *service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceStart")) logger := plog.WithFields(log.Fields{ "service": svc.Name, "id": svc.ID, "parentserviceid": svc.ParentServiceID, }) if svc.EmergencyShut...
go
func (f *Facade) validateServiceStart(ctx datastore.Context, svc *service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceStart")) logger := plog.WithFields(log.Fields{ "service": svc.Name, "id": svc.ID, "parentserviceid": svc.ParentServiceID, }) if svc.EmergencyShut...
[ "func", "(", "f", "*", "Facade", ")", "validateServiceStart", "(", "ctx", "datastore", ".", "Context", ",", "svc", "*", "service", ".", "Service", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "...
// validateServiceStart determines whether the service can actually be set to // start.
[ "validateServiceStart", "determines", "whether", "the", "service", "can", "actually", "be", "set", "to", "start", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L555-L593
139,261
control-center/serviced
facade/service.go
verifyTenantMounts
func (f *Facade) verifyTenantMounts(ctx datastore.Context, svc *service.Service) error { logger := plog.WithFields(log.Fields{ "service": svc.Name, "id": svc.ID, }) // If the pool doesn't have dfs access, we can go ahead and start the service regardless // of what condition the mount points are in. pool,...
go
func (f *Facade) verifyTenantMounts(ctx datastore.Context, svc *service.Service) error { logger := plog.WithFields(log.Fields{ "service": svc.Name, "id": svc.ID, }) // If the pool doesn't have dfs access, we can go ahead and start the service regardless // of what condition the mount points are in. pool,...
[ "func", "(", "f", "*", "Facade", ")", "verifyTenantMounts", "(", "ctx", "datastore", ".", "Context", ",", "svc", "*", "service", ".", "Service", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ...
// Check the tenant mount and dfs export to verify that they're pointing to the // same device.
[ "Check", "the", "tenant", "mount", "and", "dfs", "export", "to", "verify", "that", "they", "re", "pointing", "to", "the", "same", "device", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L597-L625
139,262
control-center/serviced
facade/service.go
validateServiceStop
func (f *Facade) validateServiceStop(ctx datastore.Context, svc *service.Service, emergency bool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceStop")) // svc.EmergencyShutdown is set when the service is pending emergency shutdown, // but we validate again when we actually perform the s...
go
func (f *Facade) validateServiceStop(ctx datastore.Context, svc *service.Service, emergency bool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.validateServiceStop")) // svc.EmergencyShutdown is set when the service is pending emergency shutdown, // but we validate again when we actually perform the s...
[ "func", "(", "f", "*", "Facade", ")", "validateServiceStop", "(", "ctx", "datastore", ".", "Context", ",", "svc", "*", "service", ".", "Service", ",", "emergency", "bool", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", ...
// validateServiceStop determines whether the service can actually be set to stop.
[ "validateServiceStop", "determines", "whether", "the", "service", "can", "actually", "be", "set", "to", "stop", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L628-L637
139,263
control-center/serviced
facade/service.go
syncService
func (f *Facade) syncService(ctx datastore.Context, tenantID, serviceID string, setLockOnCreate, setLockOnUpdate bool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.syncService")) svc, err := f.GetService(ctx, serviceID) if err != nil { glog.Errorf("Could not get service %s to sync: %s", serviceID, ...
go
func (f *Facade) syncService(ctx datastore.Context, tenantID, serviceID string, setLockOnCreate, setLockOnUpdate bool) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.syncService")) svc, err := f.GetService(ctx, serviceID) if err != nil { glog.Errorf("Could not get service %s to sync: %s", serviceID, ...
[ "func", "(", "f", "*", "Facade", ")", "syncService", "(", "ctx", "datastore", ".", "Context", ",", "tenantID", ",", "serviceID", "string", ",", "setLockOnCreate", ",", "setLockOnUpdate", "bool", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ...
// syncService syncs service data from the database into the coordinator.
[ "syncService", "syncs", "service", "data", "from", "the", "database", "into", "the", "coordinator", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L640-L652
139,264
control-center/serviced
facade/service.go
RestoreServices
func (f *Facade) RestoreServices(ctx datastore.Context, tenantID string, svcs []service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RestoreServices")) // get pools pools, err := f.GetResourcePools(ctx) if err != nil { glog.Errorf("Could not look up resource pools: %s", err) return err ...
go
func (f *Facade) RestoreServices(ctx datastore.Context, tenantID string, svcs []service.Service) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RestoreServices")) // get pools pools, err := f.GetResourcePools(ctx) if err != nil { glog.Errorf("Could not look up resource pools: %s", err) return err ...
[ "func", "(", "f", "*", "Facade", ")", "RestoreServices", "(", "ctx", "datastore", ".", "Context", ",", "tenantID", "string", ",", "svcs", "[", "]", "service", ".", "Service", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "...
// RestoreServices reverts service data
[ "RestoreServices", "reverts", "service", "data" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L655-L709
139,265
control-center/serviced
facade/service.go
validateServiceDeployment
func (f *Facade) validateServiceDeployment(ctx datastore.Context, parentID string, sd *servicedefinition.ServiceDefinition) ([]service.Service, error) { store := f.serviceStore parent, err := store.Get(ctx, parentID) if err != nil { glog.Errorf("Could not get parent service %s: %s", parentID, err) return nil, er...
go
func (f *Facade) validateServiceDeployment(ctx datastore.Context, parentID string, sd *servicedefinition.ServiceDefinition) ([]service.Service, error) { store := f.serviceStore parent, err := store.Get(ctx, parentID) if err != nil { glog.Errorf("Could not get parent service %s: %s", parentID, err) return nil, er...
[ "func", "(", "f", "*", "Facade", ")", "validateServiceDeployment", "(", "ctx", "datastore", ".", "Context", ",", "parentID", "string", ",", "sd", "*", "servicedefinition", ".", "ServiceDefinition", ")", "(", "[", "]", "service", ".", "Service", ",", "error",...
// validateServiceDeployment returns the services that will be deployed
[ "validateServiceDeployment", "returns", "the", "services", "that", "will", "be", "deployed" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L834-L866
139,266
control-center/serviced
facade/service.go
CheckRemoveRegistryImage
func (f *Facade) CheckRemoveRegistryImage(ctx datastore.Context, imageID string) error { if len(imageID) > 0 { logger := log.WithField("imageid", imageID) if count, err := f.serviceStore.GetServiceCountByImage(ctx, imageID); err != nil { logger.WithError(err).Error("Error getting service count by imageID") r...
go
func (f *Facade) CheckRemoveRegistryImage(ctx datastore.Context, imageID string) error { if len(imageID) > 0 { logger := log.WithField("imageid", imageID) if count, err := f.serviceStore.GetServiceCountByImage(ctx, imageID); err != nil { logger.WithError(err).Error("Error getting service count by imageID") r...
[ "func", "(", "f", "*", "Facade", ")", "CheckRemoveRegistryImage", "(", "ctx", "datastore", ".", "Context", ",", "imageID", "string", ")", "error", "{", "if", "len", "(", "imageID", ")", ">", "0", "{", "logger", ":=", "log", ".", "WithField", "(", "\"",...
// Checks the service.
[ "Checks", "the", "service", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1056-L1071
139,267
control-center/serviced
facade/service.go
evaluateService
func (f *Facade) evaluateService(ctx datastore.Context, svc *service.Service, instanceID int) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.evaluatedService")) // service lookup getService := func(serviceID string) (service.Service, error) { svc := service.Service{} result, err := f.GetService(ct...
go
func (f *Facade) evaluateService(ctx datastore.Context, svc *service.Service, instanceID int) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.evaluatedService")) // service lookup getService := func(serviceID string) (service.Service, error) { svc := service.Service{} result, err := f.GetService(ct...
[ "func", "(", "f", "*", "Facade", ")", "evaluateService", "(", "ctx", "datastore", ".", "Context", ",", "svc", "*", "service", ".", "Service", ",", "instanceID", "int", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ct...
// evaluateService translates the service template fields
[ "evaluateService", "translates", "the", "service", "template", "fields" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1132-L1155
139,268
control-center/serviced
facade/service.go
GetServicesByPool
func (f *Facade) GetServicesByPool(ctx datastore.Context, poolID string) ([]service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicesByPool")) glog.V(3).Infof("Facade.GetServicesByPool") store := f.serviceStore results, err := store.GetServicesByPool(ctx, poolID) if err != nil { ...
go
func (f *Facade) GetServicesByPool(ctx datastore.Context, poolID string) ([]service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicesByPool")) glog.V(3).Infof("Facade.GetServicesByPool") store := f.serviceStore results, err := store.GetServicesByPool(ctx, poolID) if err != nil { ...
[ "func", "(", "f", "*", "Facade", ")", "GetServicesByPool", "(", "ctx", "datastore", ".", "Context", ",", "poolID", "string", ")", "(", "[", "]", "service", ".", "Service", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop",...
// GetServicesByPool looks up all services in a particular pool
[ "GetServicesByPool", "looks", "up", "all", "services", "in", "a", "particular", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1244-L1262
139,269
control-center/serviced
facade/service.go
GetServiceEndpoints
func (f *Facade) GetServiceEndpoints(ctx datastore.Context, serviceID string, reportImports, reportExports, validate bool) ([]applicationendpoint.EndpointReport, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceEndpoints")) logger := plog.WithFields(log.Fields{ "serviceID": serviceID, "...
go
func (f *Facade) GetServiceEndpoints(ctx datastore.Context, serviceID string, reportImports, reportExports, validate bool) ([]applicationendpoint.EndpointReport, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceEndpoints")) logger := plog.WithFields(log.Fields{ "serviceID": serviceID, "...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceEndpoints", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ",", "reportImports", ",", "reportExports", ",", "validate", "bool", ")", "(", "[", "]", "applicationendpoint", ".", "EndpointRepo...
// Get the exported endpoints for a service
[ "Get", "the", "exported", "endpoints", "for", "a", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1363-L1397
139,270
control-center/serviced
facade/service.go
getEndpointsFromServiceDefinition
func getEndpointsFromServiceDefinition(service *service.Service, reportImports, reportExports bool) []applicationendpoint.ApplicationEndpoint { var endpoints []applicationendpoint.ApplicationEndpoint for _, serviceEndpoint := range service.Endpoints { if !reportImports && strings.HasPrefix(serviceEndpoint.Purpose, ...
go
func getEndpointsFromServiceDefinition(service *service.Service, reportImports, reportExports bool) []applicationendpoint.ApplicationEndpoint { var endpoints []applicationendpoint.ApplicationEndpoint for _, serviceEndpoint := range service.Endpoints { if !reportImports && strings.HasPrefix(serviceEndpoint.Purpose, ...
[ "func", "getEndpointsFromServiceDefinition", "(", "service", "*", "service", ".", "Service", ",", "reportImports", ",", "reportExports", "bool", ")", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", "{", "var", "endpoints", "[", "]", "applicationendpoint",...
// Get a list of exported endpoints defined for the service
[ "Get", "a", "list", "of", "exported", "endpoints", "defined", "for", "the", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1400-L1419
139,271
control-center/serviced
facade/service.go
getEndpointsFromState
func getEndpointsFromState(state zkservice.State, reportImports, reportExports bool) []applicationendpoint.ApplicationEndpoint { var endpoints []applicationendpoint.ApplicationEndpoint if reportImports { for _, ep := range state.Imports { endpoint := applicationendpoint.ApplicationEndpoint{ ServiceID: s...
go
func getEndpointsFromState(state zkservice.State, reportImports, reportExports bool) []applicationendpoint.ApplicationEndpoint { var endpoints []applicationendpoint.ApplicationEndpoint if reportImports { for _, ep := range state.Imports { endpoint := applicationendpoint.ApplicationEndpoint{ ServiceID: s...
[ "func", "getEndpointsFromState", "(", "state", "zkservice", ".", "State", ",", "reportImports", ",", "reportExports", "bool", ")", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", "{", "var", "endpoints", "[", "]", "applicationendpoint", ".", "Applicatio...
// Get a list of exported endpoints for all service instances based just on the current ServiceState
[ "Get", "a", "list", "of", "exported", "endpoints", "for", "all", "service", "instances", "based", "just", "on", "the", "current", "ServiceState" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1422-L1460
139,272
control-center/serviced
facade/service.go
FindChildService
func (f *Facade) FindChildService(ctx datastore.Context, parentServiceID string, childName string) (*service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindChildService")) logger := plog.WithFields(log.Fields{ "parentServiceID": parentServiceID, "childName": childName, }) logge...
go
func (f *Facade) FindChildService(ctx datastore.Context, parentServiceID string, childName string) (*service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindChildService")) logger := plog.WithFields(log.Fields{ "parentServiceID": parentServiceID, "childName": childName, }) logge...
[ "func", "(", "f", "*", "Facade", ")", "FindChildService", "(", "ctx", "datastore", ".", "Context", ",", "parentServiceID", "string", ",", "childName", "string", ")", "(", "*", "service", ".", "Service", ",", "error", ")", "{", "defer", "ctx", ".", "Metri...
// FindChildService walks services below the service specified by serviceId, checking to see // if childName matches the service's name. If so, it returns it.
[ "FindChildService", "walks", "services", "below", "the", "service", "specified", "by", "serviceId", "checking", "to", "see", "if", "childName", "matches", "the", "service", "s", "name", ".", "If", "so", "it", "returns", "it", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1464-L1484
139,273
control-center/serviced
facade/service.go
ScheduleServices
func (f *Facade) ScheduleServices(ctx datastore.Context, serviceIDs []string, autoLaunch bool, synchronous bool, desiredState service.DesiredState, emergency bool) (int, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ScheduleService")) if len(serviceIDs) < 1 { return 0, nil } tenantServices := mak...
go
func (f *Facade) ScheduleServices(ctx datastore.Context, serviceIDs []string, autoLaunch bool, synchronous bool, desiredState service.DesiredState, emergency bool) (int, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ScheduleService")) if len(serviceIDs) < 1 { return 0, nil } tenantServices := mak...
[ "func", "(", "f", "*", "Facade", ")", "ScheduleServices", "(", "ctx", "datastore", ".", "Context", ",", "serviceIDs", "[", "]", "string", ",", "autoLaunch", "bool", ",", "synchronous", "bool", ",", "desiredState", "service", ".", "DesiredState", ",", "emerge...
// ScheduleService changes a services' desired state and returns the number of affected services
[ "ScheduleService", "changes", "a", "services", "desired", "state", "and", "returns", "the", "number", "of", "affected", "services" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1487-L1515
139,274
control-center/serviced
facade/service.go
UpdateServiceCache
func (f *Facade) UpdateServiceCache(ctx datastore.Context) error { svcNodes, err := f.zzk.GetServiceNodes() if err != nil { return err } for _, svcNode := range svcNodes { f.serviceStore.UpdateDesiredState(ctx, svcNode.ID, svcNode.DesiredState) } return nil }
go
func (f *Facade) UpdateServiceCache(ctx datastore.Context) error { svcNodes, err := f.zzk.GetServiceNodes() if err != nil { return err } for _, svcNode := range svcNodes { f.serviceStore.UpdateDesiredState(ctx, svcNode.ID, svcNode.DesiredState) } return nil }
[ "func", "(", "f", "*", "Facade", ")", "UpdateServiceCache", "(", "ctx", "datastore", ".", "Context", ")", "error", "{", "svcNodes", ",", "err", ":=", "f", ".", "zzk", ".", "GetServiceNodes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "e...
// Update the serviceCache with values from ZK.
[ "Update", "the", "serviceCache", "with", "values", "from", "ZK", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L1983-L1992
139,275
control-center/serviced
facade/service.go
ClearEmergencyStopFlag
func (f *Facade) ClearEmergencyStopFlag(ctx datastore.Context, serviceID string) (int, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ClearEmergencyStopFlag")) alog := f.auditLogger.Message(ctx, "Clearing Emergency Stop Flag"). Action(audit.Update).ID(serviceID).Type(service.GetType()) tenantID, err...
go
func (f *Facade) ClearEmergencyStopFlag(ctx datastore.Context, serviceID string) (int, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ClearEmergencyStopFlag")) alog := f.auditLogger.Message(ctx, "Clearing Emergency Stop Flag"). Action(audit.Update).ID(serviceID).Type(service.GetType()) tenantID, err...
[ "func", "(", "f", "*", "Facade", ")", "ClearEmergencyStopFlag", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "int", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Met...
// ClearEmergencyStopFlag sets EmergencyStop to false for all services on the tenant that have it set to true
[ "ClearEmergencyStopFlag", "sets", "EmergencyStop", "to", "false", "for", "all", "services", "on", "the", "tenant", "that", "have", "it", "set", "to", "true" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2165-L2179
139,276
control-center/serviced
facade/service.go
getService
func (f *Facade) getService(ctx datastore.Context, id string) (service.Service, error) { glog.V(3).Infof("Facade.getService: id=%s", id) store := f.serviceStore svc, err := store.Get(ctx, id) if err != nil || svc == nil { return service.Service{}, err } return *svc, err }
go
func (f *Facade) getService(ctx datastore.Context, id string) (service.Service, error) { glog.V(3).Infof("Facade.getService: id=%s", id) store := f.serviceStore svc, err := store.Get(ctx, id) if err != nil || svc == nil { return service.Service{}, err } return *svc, err }
[ "func", "(", "f", "*", "Facade", ")", "getService", "(", "ctx", "datastore", ".", "Context", ",", "id", "string", ")", "(", "service", ".", "Service", ",", "error", ")", "{", "glog", ".", "V", "(", "3", ")", ".", "Infof", "(", "\"", "\"", ",", ...
//getService is an internal method that returns a Service without filling in all related service data like address assignments //and modified config files
[ "getService", "is", "an", "internal", "method", "that", "returns", "a", "Service", "without", "filling", "in", "all", "related", "service", "data", "like", "address", "assignments", "and", "modified", "config", "files" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2587-L2595
139,277
control-center/serviced
facade/service.go
getServices
func (f *Facade) getServices(ctx datastore.Context) ([]service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.getServices")) plog.Debug("Started Facade.getServices") defer plog.Debug("Finished Facade.getServices") store := f.serviceStore results, err := store.GetServices(ctx) if err != ni...
go
func (f *Facade) getServices(ctx datastore.Context) ([]service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.getServices")) plog.Debug("Started Facade.getServices") defer plog.Debug("Finished Facade.getServices") store := f.serviceStore results, err := store.GetServices(ctx) if err != ni...
[ "func", "(", "f", "*", "Facade", ")", "getServices", "(", "ctx", "datastore", ".", "Context", ")", "(", "[", "]", "service", ".", "Service", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", ...
//getServices is an internal method that returns all Services without filling in all related service data like address assignments //and modified config files
[ "getServices", "is", "an", "internal", "method", "that", "returns", "all", "Services", "without", "filling", "in", "all", "related", "service", "data", "like", "address", "assignments", "and", "modified", "config", "files" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2617-L2629
139,278
control-center/serviced
facade/service.go
GetServiceList
func (f *Facade) GetServiceList(ctx datastore.Context, serviceID string) ([]*service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceList")) svcs := make([]*service.Service, 0, 1) err := f.walkServices(ctx, serviceID, true, func(childService *service.Service) error { // Populate s...
go
func (f *Facade) GetServiceList(ctx datastore.Context, serviceID string) ([]*service.Service, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceList")) svcs := make([]*service.Service, 0, 1) err := f.walkServices(ctx, serviceID, true, func(childService *service.Service) error { // Populate s...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceList", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "[", "]", "*", "service", ".", "Service", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", ...
// GetServiceList gets all child services of the service specified by the // given service ID, and returns them in a slice
[ "GetServiceList", "gets", "all", "child", "services", "of", "the", "service", "specified", "by", "the", "given", "service", "ID", "and", "returns", "them", "in", "a", "slice" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2718-L2737
139,279
control-center/serviced
facade/service.go
GetServiceDetails
func (f *Facade) GetServiceDetails(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetails")) return f.serviceStore.GetServiceDetails(ctx, serviceID) }
go
func (f *Facade) GetServiceDetails(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetails")) return f.serviceStore.GetServiceDetails(ctx, serviceID) }
[ "func", "(", "f", "*", "Facade", ")", "GetServiceDetails", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "*", "service", ".", "ServiceDetails", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Sto...
// GetServiceDetails returns the details of a particular service
[ "GetServiceDetails", "returns", "the", "details", "of", "a", "particular", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2788-L2791
139,280
control-center/serviced
facade/service.go
GetServiceDetailsAncestry
func (f *Facade) GetServiceDetailsAncestry(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsAncestry")) s, err := f.serviceStore.GetServiceDetails(ctx, serviceID) if err != nil { return nil, err } if s.ParentService...
go
func (f *Facade) GetServiceDetailsAncestry(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsAncestry")) s, err := f.serviceStore.GetServiceDetails(ctx, serviceID) if err != nil { return nil, err } if s.ParentService...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceDetailsAncestry", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "*", "service", ".", "ServiceDetails", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", "."...
// GetServiceDetailsAncestry returns a service and its ancestors
[ "GetServiceDetailsAncestry", "returns", "a", "service", "and", "its", "ancestors" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2794-L2810
139,281
control-center/serviced
facade/service.go
GetServiceDetailsByParentID
func (f *Facade) GetServiceDetailsByParentID(ctx datastore.Context, parentID string, since time.Duration) ([]service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsByParentID")) return f.serviceStore.GetServiceDetailsByParentID(ctx, parentID, since) }
go
func (f *Facade) GetServiceDetailsByParentID(ctx datastore.Context, parentID string, since time.Duration) ([]service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsByParentID")) return f.serviceStore.GetServiceDetailsByParentID(ctx, parentID, since) }
[ "func", "(", "f", "*", "Facade", ")", "GetServiceDetailsByParentID", "(", "ctx", "datastore", ".", "Context", ",", "parentID", "string", ",", "since", "time", ".", "Duration", ")", "(", "[", "]", "service", ".", "ServiceDetails", ",", "error", ")", "{", ...
// Get the details of the child services for the given parent
[ "Get", "the", "details", "of", "the", "child", "services", "for", "the", "given", "parent" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2813-L2816
139,282
control-center/serviced
facade/service.go
GetServiceDetailsByTenantID
func (f *Facade) GetServiceDetailsByTenantID(ctx datastore.Context, tenantID string) ([]service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsByTenantID")) svcs, err := f.serviceStore.Query(ctx, service.Query{}) if err != nil { return nil, err } return f.filterDet...
go
func (f *Facade) GetServiceDetailsByTenantID(ctx datastore.Context, tenantID string) ([]service.ServiceDetails, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceDetailsByTenantID")) svcs, err := f.serviceStore.Query(ctx, service.Query{}) if err != nil { return nil, err } return f.filterDet...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceDetailsByTenantID", "(", "ctx", "datastore", ".", "Context", ",", "tenantID", "string", ")", "(", "[", "]", "service", ".", "ServiceDetails", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")...
// Get the details of all services for the specified tenant
[ "Get", "the", "details", "of", "all", "services", "for", "the", "specified", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2819-L2826
139,283
control-center/serviced
facade/service.go
GetServiceMonitoringProfile
func (f *Facade) GetServiceMonitoringProfile(ctx datastore.Context, serviceID string) (*domain.MonitorProfile, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceMonitoringProfile")) svc, err := f.serviceStore.Get(ctx, serviceID) if err != nil { return nil, err } return &svc.MonitoringProfil...
go
func (f *Facade) GetServiceMonitoringProfile(ctx datastore.Context, serviceID string) (*domain.MonitorProfile, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceMonitoringProfile")) svc, err := f.serviceStore.Get(ctx, serviceID) if err != nil { return nil, err } return &svc.MonitoringProfil...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceMonitoringProfile", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "*", "domain", ".", "MonitorProfile", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", "....
// Get the monitoring profile of a given service
[ "Get", "the", "monitoring", "profile", "of", "a", "given", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2829-L2836
139,284
control-center/serviced
facade/service.go
GetServiceExportedEndpoints
func (f *Facade) GetServiceExportedEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.ExportedEndpoint, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceExportedEndpoints")) // get all the exported endpoints and map them to their service alleps, err := f.serviceStore...
go
func (f *Facade) GetServiceExportedEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.ExportedEndpoint, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceExportedEndpoints")) // get all the exported endpoints and map them to their service alleps, err := f.serviceStore...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceExportedEndpoints", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ",", "children", "bool", ")", "(", "[", "]", "service", ".", "ExportedEndpoint", ",", "error", ")", "{", "defer", "ctx...
// GetServiceExportedEndpoints returns all the exported endpoints for a service // and its children if enabled.
[ "GetServiceExportedEndpoints", "returns", "all", "the", "exported", "endpoints", "for", "a", "service", "and", "its", "children", "if", "enabled", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2840-L2881
139,285
control-center/serviced
facade/service.go
GetServicePublicEndpoints
func (f *Facade) GetServicePublicEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.PublicEndpoint, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicePublicEndpoints")) pubeps := []service.PublicEndpoint{} if children { allPeps, err := f.GetAllPublicEndpoints(ctx) ...
go
func (f *Facade) GetServicePublicEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.PublicEndpoint, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicePublicEndpoints")) pubeps := []service.PublicEndpoint{} if children { allPeps, err := f.GetAllPublicEndpoints(ctx) ...
[ "func", "(", "f", "*", "Facade", ")", "GetServicePublicEndpoints", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ",", "children", "bool", ")", "(", "[", "]", "service", ".", "PublicEndpoint", ",", "error", ")", "{", "defer", "ctx", ...
// GetServicePublicEndpoints returns all the endpoints for a service and its // children if enabled.
[ "GetServicePublicEndpoints", "returns", "all", "the", "endpoints", "for", "a", "service", "and", "its", "children", "if", "enabled", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/service.go#L2885-L2922
139,286
control-center/serviced
auth/jwt.go
ParseJWTIdentity
func ParseJWTIdentity(token string) (Identity, error) { claims := &jwtIdentity{} parsed, err := jwt.ParseWithClaims(token, claims, func(token *jwt.Token) (interface{}, error) { // Validate the algorithm matches the key if _, ok := token.Method.(*jwt.SigningMethodRSAPSS); !ok { return nil, ErrInvalidSigningMeth...
go
func ParseJWTIdentity(token string) (Identity, error) { claims := &jwtIdentity{} parsed, err := jwt.ParseWithClaims(token, claims, func(token *jwt.Token) (interface{}, error) { // Validate the algorithm matches the key if _, ok := token.Method.(*jwt.SigningMethodRSAPSS); !ok { return nil, ErrInvalidSigningMeth...
[ "func", "ParseJWTIdentity", "(", "token", "string", ")", "(", "Identity", ",", "error", ")", "{", "claims", ":=", "&", "jwtIdentity", "{", "}", "\n", "parsed", ",", "err", ":=", "jwt", ".", "ParseWithClaims", "(", "token", ",", "claims", ",", "func", "...
// ParseJWTIdentity parses a JSON Web Token string, verifying that it was signed by the master.
[ "ParseJWTIdentity", "parses", "a", "JSON", "Web", "Token", "string", "verifying", "that", "it", "was", "signed", "by", "the", "master", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/jwt.go#L56-L84
139,287
control-center/serviced
auth/jwt.go
CreateJWTIdentity
func CreateJWTIdentity(hostID, poolID string, admin, dfs bool, pubKeyPEM []byte, expiration time.Duration) (string, int64, error) { now := jwt.TimeFunc().UTC() claims := &jwtIdentity{ Host: hostID, Pool: poolID, ExpiresAt: now.Add(expiration).Unix(), IssuedAt: now.Unix(), AdminAccess: adm...
go
func CreateJWTIdentity(hostID, poolID string, admin, dfs bool, pubKeyPEM []byte, expiration time.Duration) (string, int64, error) { now := jwt.TimeFunc().UTC() claims := &jwtIdentity{ Host: hostID, Pool: poolID, ExpiresAt: now.Add(expiration).Unix(), IssuedAt: now.Unix(), AdminAccess: adm...
[ "func", "CreateJWTIdentity", "(", "hostID", ",", "poolID", "string", ",", "admin", ",", "dfs", "bool", ",", "pubKeyPEM", "[", "]", "byte", ",", "expiration", "time", ".", "Duration", ")", "(", "string", ",", "int64", ",", "error", ")", "{", "now", ":="...
// CreateJWTIdentity returns a signed string
[ "CreateJWTIdentity", "returns", "a", "signed", "string" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/jwt.go#L87-L105
139,288
control-center/serviced
coordinator/client/retry/once.go
Once
func Once(sleepBetweenRetry time.Duration) Policy { return once{ sleepBetweenRetry: sleepBetweenRetry, done: make(chan struct{}), } }
go
func Once(sleepBetweenRetry time.Duration) Policy { return once{ sleepBetweenRetry: sleepBetweenRetry, done: make(chan struct{}), } }
[ "func", "Once", "(", "sleepBetweenRetry", "time", ".", "Duration", ")", "Policy", "{", "return", "once", "{", "sleepBetweenRetry", ":", "sleepBetweenRetry", ",", "done", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "}" ]
// Once returns a policy that retries only once.
[ "Once", "returns", "a", "policy", "that", "retries", "only", "once", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/retry/once.go#L26-L31
139,289
control-center/serviced
coordinator/client/retry/once.go
AllowRetry
func (u once) AllowRetry(retryCount int, elapsed time.Duration) (bool, time.Duration) { if retryCount == 0 { return true, u.sleepBetweenRetry } return false, time.Duration(0) }
go
func (u once) AllowRetry(retryCount int, elapsed time.Duration) (bool, time.Duration) { if retryCount == 0 { return true, u.sleepBetweenRetry } return false, time.Duration(0) }
[ "func", "(", "u", "once", ")", "AllowRetry", "(", "retryCount", "int", ",", "elapsed", "time", ".", "Duration", ")", "(", "bool", ",", "time", ".", "Duration", ")", "{", "if", "retryCount", "==", "0", "{", "return", "true", ",", "u", ".", "sleepBetwe...
// AllowRetry returns true if the retry count is 0.
[ "AllowRetry", "returns", "true", "if", "the", "retry", "count", "is", "0", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/retry/once.go#L38-L43
139,290
control-center/serviced
facade/user.go
hashPassword
func hashPassword(password string) string { h := sha1.New() io.WriteString(h, password) return fmt.Sprintf("% x", h.Sum(nil)) }
go
func hashPassword(password string) string { h := sha1.New() io.WriteString(h, password) return fmt.Sprintf("% x", h.Sum(nil)) }
[ "func", "hashPassword", "(", "password", "string", ")", "string", "{", "h", ":=", "sha1", ".", "New", "(", ")", "\n", "io", ".", "WriteString", "(", "h", ",", "password", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "h", ".", ...
//hashPassword returns the sha-1 of a password
[ "hashPassword", "returns", "the", "sha", "-", "1", "of", "a", "password" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/user.go#L40-L44
139,291
control-center/serviced
facade/user.go
AddUser
func (f *Facade) AddUser(ctx datastore.Context, newUser userdomain.User) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddUser")) var err error logger := plog.WithFields(log.Fields{ "newUserName": newUser.Name, }) logger.Debug("Started Facade.AddUser") defer logger.WithError(err).Debug("Finished ...
go
func (f *Facade) AddUser(ctx datastore.Context, newUser userdomain.User) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddUser")) var err error logger := plog.WithFields(log.Fields{ "newUserName": newUser.Name, }) logger.Debug("Started Facade.AddUser") defer logger.WithError(err).Debug("Finished ...
[ "func", "(", "f", "*", "Facade", ")", "AddUser", "(", "ctx", "datastore", ".", "Context", ",", "newUser", "userdomain", ".", "User", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", "."...
// AddUser adds a new user record
[ "AddUser", "adds", "a", "new", "user", "record" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/user.go#L47-L65
139,292
control-center/serviced
facade/user.go
RemoveUser
func (f *Facade) RemoveUser(ctx datastore.Context, userName string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveUser")) var err error logger := plog.WithField("userName", userName) logger.Debug("Started Facade.RemoveUser") defer logger.WithError(err).Debug("Finished Facade.RemoveUser") err...
go
func (f *Facade) RemoveUser(ctx datastore.Context, userName string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveUser")) var err error logger := plog.WithField("userName", userName) logger.Debug("Started Facade.RemoveUser") defer logger.WithError(err).Debug("Finished Facade.RemoveUser") err...
[ "func", "(", "f", "*", "Facade", ")", "RemoveUser", "(", "ctx", "datastore", ".", "Context", ",", "userName", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(...
// RemoveUser removes the user specified by the userName string
[ "RemoveUser", "removes", "the", "user", "specified", "by", "the", "userName", "string" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/user.go#L101-L110
139,293
control-center/serviced
facade/user.go
ValidateCredentials
func (f *Facade) ValidateCredentials(ctx datastore.Context, user userdomain.User) (bool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ValidateCredentials")) var err error logger := plog.WithField("userName", user.Name) logger.Debug("Started Facade.ValidateCredentials") defer logger.WithError(err)....
go
func (f *Facade) ValidateCredentials(ctx datastore.Context, user userdomain.User) (bool, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ValidateCredentials")) var err error logger := plog.WithField("userName", user.Name) logger.Debug("Started Facade.ValidateCredentials") defer logger.WithError(err)....
[ "func", "(", "f", "*", "Facade", ")", "ValidateCredentials", "(", "ctx", "datastore", ".", "Context", ",", "user", "userdomain", ".", "User", ")", "(", "bool", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx",...
// ValidateCredentials takes a user name and password and validates them against a stored user
[ "ValidateCredentials", "takes", "a", "user", "name", "and", "password", "and", "validates", "them", "against", "a", "stored", "user" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/user.go#L113-L136
139,294
control-center/serviced
facade/user.go
GetSystemUser
func (f *Facade) GetSystemUser(ctx datastore.Context) (userdomain.User, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetSystemUser")) plog.Debug("Started Facade.GetSystemUser") defer plog.Debug("Finished Facade.GetSystemUser") systemUser := userdomain.User{ Name: SYSTEM_USER_NAME, Password...
go
func (f *Facade) GetSystemUser(ctx datastore.Context) (userdomain.User, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetSystemUser")) plog.Debug("Started Facade.GetSystemUser") defer plog.Debug("Finished Facade.GetSystemUser") systemUser := userdomain.User{ Name: SYSTEM_USER_NAME, Password...
[ "func", "(", "f", "*", "Facade", ")", "GetSystemUser", "(", "ctx", "datastore", ".", "Context", ")", "(", "userdomain", ".", "User", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")"...
// GetSystemUser returns the system user's credentials.
[ "GetSystemUser", "returns", "the", "system", "user", "s", "credentials", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/user.go#L139-L149
139,295
control-center/serviced
facade/user.go
CreateSystemUser
func (f *Facade) CreateSystemUser(ctx datastore.Context) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.CreateSystemUser")) user, err := f.GetUser(ctx, SYSTEM_USER_NAME) if err != nil { plog.WithError(err).Warning("Default user not found; creating one.") // create the system user user := userdom...
go
func (f *Facade) CreateSystemUser(ctx datastore.Context) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.CreateSystemUser")) user, err := f.GetUser(ctx, SYSTEM_USER_NAME) if err != nil { plog.WithError(err).Warning("Default user not found; creating one.") // create the system user user := userdom...
[ "func", "(", "f", "*", "Facade", ")", "CreateSystemUser", "(", "ctx", "datastore", ".", "Context", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(", "\"", "\"", ")", ...
// createSystemUser updates the running instance password as well as the user record in elastic
[ "createSystemUser", "updates", "the", "running", "instance", "password", "as", "well", "as", "the", "user", "record", "in", "elastic" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/user.go#L152-L176
139,296
control-center/serviced
dao/elasticsearch/controlplanedao.go
NewControlPlaneDao
func NewControlPlaneDao(hostName string, port int, rpcPort int) (*ControlPlaneDao, error) { glog.V(0).Infof("Opening ElasticSearch ControlPlane Dao: hostName=%s, port=%d", hostName, port) api.Domain = hostName api.Port = strconv.Itoa(port) dao := &ControlPlaneDao{ hostName: hostName, port: port, rpcPort:...
go
func NewControlPlaneDao(hostName string, port int, rpcPort int) (*ControlPlaneDao, error) { glog.V(0).Infof("Opening ElasticSearch ControlPlane Dao: hostName=%s, port=%d", hostName, port) api.Domain = hostName api.Port = strconv.Itoa(port) dao := &ControlPlaneDao{ hostName: hostName, port: port, rpcPort:...
[ "func", "NewControlPlaneDao", "(", "hostName", "string", ",", "port", "int", ",", "rpcPort", "int", ")", "(", "*", "ControlPlaneDao", ",", "error", ")", "{", "glog", ".", "V", "(", "0", ")", ".", "Infof", "(", "\"", "\"", ",", "hostName", ",", "port"...
// Create a elastic search control center data access object
[ "Create", "a", "elastic", "search", "control", "center", "data", "access", "object" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dao/elasticsearch/controlplanedao.go#L123-L135
139,297
control-center/serviced
facade/serviceconfig.go
GetServiceConfigs
func (f *Facade) GetServiceConfigs(ctx datastore.Context, serviceID string) ([]service.Config, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceConfigs")) logger := plog.WithField("serviceid", serviceID) tenantID, servicePath, err := f.getServicePath(ctx, serviceID) if err != nil { logger....
go
func (f *Facade) GetServiceConfigs(ctx datastore.Context, serviceID string) ([]service.Config, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceConfigs")) logger := plog.WithField("serviceid", serviceID) tenantID, servicePath, err := f.getServicePath(ctx, serviceID) if err != nil { logger....
[ "func", "(", "f", "*", "Facade", ")", "GetServiceConfigs", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "[", "]", "service", ".", "Config", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop...
// GetServiceConfigs returns the config files for a service
[ "GetServiceConfigs", "returns", "the", "config", "files", "for", "a", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/serviceconfig.go#L32-L63
139,298
control-center/serviced
facade/serviceconfig.go
GetServiceConfig
func (f *Facade) GetServiceConfig(ctx datastore.Context, fileID string) (*servicedefinition.ConfigFile, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceConfig")) logger := plog.WithField("fileid", fileID) file := &serviceconfigfile.SvcConfigFile{} if err := f.configStore.Get(ctx, servicecon...
go
func (f *Facade) GetServiceConfig(ctx datastore.Context, fileID string) (*servicedefinition.ConfigFile, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceConfig")) logger := plog.WithField("fileid", fileID) file := &serviceconfigfile.SvcConfigFile{} if err := f.configStore.Get(ctx, servicecon...
[ "func", "(", "f", "*", "Facade", ")", "GetServiceConfig", "(", "ctx", "datastore", ".", "Context", ",", "fileID", "string", ")", "(", "*", "servicedefinition", ".", "ConfigFile", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "S...
// GetServiceConfig returns a config file
[ "GetServiceConfig", "returns", "a", "config", "file" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/serviceconfig.go#L66-L77
139,299
control-center/serviced
facade/serviceconfig.go
AddServiceConfig
func (f *Facade) AddServiceConfig(ctx datastore.Context, serviceID string, conf servicedefinition.ConfigFile) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddServiceConfig")) logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "filename": conf.Filename, }) alog := f.auditLogger.Messa...
go
func (f *Facade) AddServiceConfig(ctx datastore.Context, serviceID string, conf servicedefinition.ConfigFile) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddServiceConfig")) logger := plog.WithFields(log.Fields{ "serviceid": serviceID, "filename": conf.Filename, }) alog := f.auditLogger.Messa...
[ "func", "(", "f", "*", "Facade", ")", "AddServiceConfig", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ",", "conf", "servicedefinition", ".", "ConfigFile", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", ...
// AddServiceConfig creates a config file for a service
[ "AddServiceConfig", "creates", "a", "config", "file", "for", "a", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/serviceconfig.go#L80-L132