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,100
control-center/serviced
coordinator/client/retry/ntimes.go
NTimes
func NTimes(n int, sleepBetweenRetries time.Duration) Policy { return nTimes{ n: n, sleepBetweenRetries: sleepBetweenRetries, } }
go
func NTimes(n int, sleepBetweenRetries time.Duration) Policy { return nTimes{ n: n, sleepBetweenRetries: sleepBetweenRetries, } }
[ "func", "NTimes", "(", "n", "int", ",", "sleepBetweenRetries", "time", ".", "Duration", ")", "Policy", "{", "return", "nTimes", "{", "n", ":", "n", ",", "sleepBetweenRetries", ":", "sleepBetweenRetries", ",", "}", "\n", "}" ]
// NTimes returns a retry policy that retries up to n times.
[ "NTimes", "returns", "a", "retry", "policy", "that", "retries", "up", "to", "n", "times", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/retry/ntimes.go#L26-L31
139,101
control-center/serviced
web/cpserver.go
NewServiceConfig
func NewServiceConfig(bindPort string, agentPort string, stats bool, hostaliases []string, muxTLS bool, muxPort int, aGroup string, certPEMFile string, keyPEMFile string, pollFrequency int, configuredSnapshotSpacePercent int, facade facade.FacadeInterface) *ServiceConfig { logger := plog.WithFields(logrus.Fields{ ...
go
func NewServiceConfig(bindPort string, agentPort string, stats bool, hostaliases []string, muxTLS bool, muxPort int, aGroup string, certPEMFile string, keyPEMFile string, pollFrequency int, configuredSnapshotSpacePercent int, facade facade.FacadeInterface) *ServiceConfig { logger := plog.WithFields(logrus.Fields{ ...
[ "func", "NewServiceConfig", "(", "bindPort", "string", ",", "agentPort", "string", ",", "stats", "bool", ",", "hostaliases", "[", "]", "string", ",", "muxTLS", "bool", ",", "muxPort", "int", ",", "aGroup", "string", ",", "certPEMFile", "string", ",", "keyPEM...
// NewServiceConfig creates a new ServiceConfig
[ "NewServiceConfig", "creates", "a", "new", "ServiceConfig" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/cpserver.go#L75-L116
139,102
control-center/serviced
web/cpserver.go
startPublicPortListener
func (sc *ServiceConfig) startPublicPortListener(shutdown <-chan interface{}) { // set up the public port manager pubmgr := NewPublicPortManager("", sc.certPEMFile, sc.keyPEMFile, func(portAddress string, err error) { logger := plog.WithField("portaddress", portAddress).WithError(err) // connect to zookeeper c...
go
func (sc *ServiceConfig) startPublicPortListener(shutdown <-chan interface{}) { // set up the public port manager pubmgr := NewPublicPortManager("", sc.certPEMFile, sc.keyPEMFile, func(portAddress string, err error) { logger := plog.WithField("portaddress", portAddress).WithError(err) // connect to zookeeper c...
[ "func", "(", "sc", "*", "ServiceConfig", ")", "startPublicPortListener", "(", "shutdown", "<-", "chan", "interface", "{", "}", ")", "{", "// set up the public port manager", "pubmgr", ":=", "NewPublicPortManager", "(", "\"", "\"", ",", "sc", ".", "certPEMFile", ...
// startPublicPortListener starts sets up the port servers and watches for // changes in state
[ "startPublicPortListener", "starts", "sets", "up", "the", "port", "servers", "and", "watches", "for", "changes", "in", "state" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/cpserver.go#L436-L489
139,103
control-center/serviced
web/cpserver.go
startVHostListener
func (sc *ServiceConfig) startVHostListener(shutdown <-chan interface{}) { // set up the vhost manager sc.vhostmgr = NewVHostManager(sc.muxTLS) // set up the vhost listener listener := registry.NewVHostListener("master", sc.vhostmgr) // start the listener go func() { for { select { case conn := <-zzk.Co...
go
func (sc *ServiceConfig) startVHostListener(shutdown <-chan interface{}) { // set up the vhost manager sc.vhostmgr = NewVHostManager(sc.muxTLS) // set up the vhost listener listener := registry.NewVHostListener("master", sc.vhostmgr) // start the listener go func() { for { select { case conn := <-zzk.Co...
[ "func", "(", "sc", "*", "ServiceConfig", ")", "startVHostListener", "(", "shutdown", "<-", "chan", "interface", "{", "}", ")", "{", "// set up the vhost manager", "sc", ".", "vhostmgr", "=", "NewVHostManager", "(", "sc", ".", "muxTLS", ")", "\n\n", "// set up ...
// startVHostListener manages proxies for all vhosts
[ "startVHostListener", "manages", "proxies", "for", "all", "vhosts" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/cpserver.go#L492-L517
139,104
control-center/serviced
web/cpserver.go
restGetAuth0Config
func restGetAuth0Config(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { opts := config.GetOptions() auth0Config := Auth0Config{ Auth0Scope: opts.Auth0Scope, Auth0ClientID: opts.Auth0ClientID, Auth0Audience: opts.Auth0Audience, Auth0Domain: opts.Auth0Domain, } w.Write([]byte("var Auth0Co...
go
func restGetAuth0Config(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { opts := config.GetOptions() auth0Config := Auth0Config{ Auth0Scope: opts.Auth0Scope, Auth0ClientID: opts.Auth0ClientID, Auth0Audience: opts.Auth0Audience, Auth0Domain: opts.Auth0Domain, } w.Write([]byte("var Auth0Co...
[ "func", "restGetAuth0Config", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "opts", ":=", "config", ".", "GetOptions", "(", ")", "\n", "auth0Config", ":=", "Auth0Config", ...
// Get Auth0 Config info for UI
[ "Get", "Auth0", "Config", "info", "for", "UI" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/cpserver.go#L520-L531
139,105
control-center/serviced
tools/serviced-storage/driver.go
Execute
func (c *DriverInit) Execute(args []string) error { App.initializeLogging() driverType, err := volume.StringToDriverType(c.Args.Type) if err != nil { log.Fatal(err) } path := string(c.Args.Path) logger := log.WithFields(log.Fields{ "directory": path, "type": driverType, }) logger.Info("Initializing s...
go
func (c *DriverInit) Execute(args []string) error { App.initializeLogging() driverType, err := volume.StringToDriverType(c.Args.Type) if err != nil { log.Fatal(err) } path := string(c.Args.Path) logger := log.WithFields(log.Fields{ "directory": path, "type": driverType, }) logger.Info("Initializing s...
[ "func", "(", "c", "*", "DriverInit", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "driverType", ",", "err", ":=", "volume", ".", "StringToDriverType", "(", "c", ".", "Args", ".", ...
// Execute initializes a new storage driver
[ "Execute", "initializes", "a", "new", "storage", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L77-L94
139,106
control-center/serviced
tools/serviced-storage/driver.go
Execute
func (c *DriverSet) Execute(args []string) error { App.initializeLogging() path := string(c.Args.Path) if _, err := InitDriverIfExists(path); err == volume.ErrDriverNotInit { log.Fatalf("Driver not initialized. Use `%s driver init %s TYPE [OPTIONS]`", "."+App.name, path) } usr, err := user.Current() if err != n...
go
func (c *DriverSet) Execute(args []string) error { App.initializeLogging() path := string(c.Args.Path) if _, err := InitDriverIfExists(path); err == volume.ErrDriverNotInit { log.Fatalf("Driver not initialized. Use `%s driver init %s TYPE [OPTIONS]`", "."+App.name, path) } usr, err := user.Current() if err != n...
[ "func", "(", "c", "*", "DriverSet", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "path", ":=", "string", "(", "c", ".", "Args", ".", "Path", ")", "\n", "if", "_", ",", "err",...
// Execute sets the default driver for all proceeding commands
[ "Execute", "sets", "the", "default", "driver", "for", "all", "proceeding", "commands" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L97-L111
139,107
control-center/serviced
tools/serviced-storage/driver.go
Execute
func (c *DriverUnset) Execute(args []string) error { App.initializeLogging() usr, err := user.Current() if err != nil { log.Fatal(err) } if err := os.RemoveAll(filepath.Join(usr.HomeDir, App.name)); err != nil && !os.IsNotExist(err) { log.Fatal(err) } return nil }
go
func (c *DriverUnset) Execute(args []string) error { App.initializeLogging() usr, err := user.Current() if err != nil { log.Fatal(err) } if err := os.RemoveAll(filepath.Join(usr.HomeDir, App.name)); err != nil && !os.IsNotExist(err) { log.Fatal(err) } return nil }
[ "func", "(", "c", "*", "DriverUnset", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "usr", ",", "err", ":=", "user", ".", "Current", "(", ")", "\n", "if", "err", "!=", "nil", ...
// Execute unsets the default driver
[ "Execute", "unsets", "the", "default", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L114-L124
139,108
control-center/serviced
tools/serviced-storage/driver.go
Execute
func (c *DriverDisable) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Args.Path)) logger := log.WithFields(log.Fields{ "directory": directory, }) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger = logger.WithFields(log.Field...
go
func (c *DriverDisable) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Args.Path)) logger := log.WithFields(log.Fields{ "directory": directory, }) driver, err := InitDriverIfExists(directory) if err != nil { log.Fatal(err) } logger = logger.WithFields(log.Field...
[ "func", "(", "c", "*", "DriverDisable", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "directory", ":=", "GetDefaultDriver", "(", "string", "(", "c", ".", "Args", ".", "Path", ")", ...
// Execute disables a driver
[ "Execute", "disables", "a", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L127-L145
139,109
control-center/serviced
tools/serviced-storage/driver.go
Execute
func (c *DriverStatus) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Args.Path)) logger := log.WithFields(log.Fields{ "directory": directory, }) driver, err := InitDriverIfExists(directory) if err != nil { logger.Fatal(err) } logger = logger.WithFields(log.Fie...
go
func (c *DriverStatus) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Args.Path)) logger := log.WithFields(log.Fields{ "directory": directory, }) driver, err := InitDriverIfExists(directory) if err != nil { logger.Fatal(err) } logger = logger.WithFields(log.Fie...
[ "func", "(", "c", "*", "DriverStatus", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "directory", ":=", "GetDefaultDriver", "(", "string", "(", "c", ".", "Args", ".", "Path", ")", ...
// Execute displays the status of a driver
[ "Execute", "displays", "the", "status", "of", "a", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L148-L168
139,110
control-center/serviced
tools/serviced-storage/driver.go
Execute
func (c *DriverList) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Args.Path)) logger := log.WithFields(log.Fields{ "directory": directory, }) driver, err := InitDriverIfExists(directory) if err != nil { logger.Fatal(err) } for _, volname := range driver.List(...
go
func (c *DriverList) Execute(args []string) error { App.initializeLogging() directory := GetDefaultDriver(string(c.Args.Path)) logger := log.WithFields(log.Fields{ "directory": directory, }) driver, err := InitDriverIfExists(directory) if err != nil { logger.Fatal(err) } for _, volname := range driver.List(...
[ "func", "(", "c", "*", "DriverList", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "App", ".", "initializeLogging", "(", ")", "\n", "directory", ":=", "GetDefaultDriver", "(", "string", "(", "c", ".", "Args", ".", "Path", ")", "...
// Execute displays the volumes on a driver
[ "Execute", "displays", "the", "volumes", "on", "a", "driver" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L171-L185
139,111
control-center/serviced
tools/serviced-storage/driver.go
InitDriverIfExists
func InitDriverIfExists(directory string) (volume.Driver, error) { log.WithFields(log.Fields{ "directory": directory, }).Debug("Checking driver") driverType, err := volume.DetectDriverType(directory) if err != nil { return nil, err } logger := log.WithFields(log.Fields{ "directory": directory, "type": ...
go
func InitDriverIfExists(directory string) (volume.Driver, error) { log.WithFields(log.Fields{ "directory": directory, }).Debug("Checking driver") driverType, err := volume.DetectDriverType(directory) if err != nil { return nil, err } logger := log.WithFields(log.Fields{ "directory": directory, "type": ...
[ "func", "InitDriverIfExists", "(", "directory", "string", ")", "(", "volume", ".", "Driver", ",", "error", ")", "{", "log", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "directory", ",", "}", ")", ".", "Debug", "(", "\"", "\"",...
// InitDriverIfExists returns a driver if it has been initialized in the given // directory.
[ "InitDriverIfExists", "returns", "a", "driver", "if", "it", "has", "been", "initialized", "in", "the", "given", "directory", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L191-L209
139,112
control-center/serviced
tools/serviced-storage/driver.go
GetDefaultDriver
func GetDefaultDriver(path string) string { if path != "" { return path } if usr, err := user.Current(); err == nil { state, _ := ioutil.ReadFile(filepath.Join(usr.HomeDir, "."+App.name)) return string(state) } return "" }
go
func GetDefaultDriver(path string) string { if path != "" { return path } if usr, err := user.Current(); err == nil { state, _ := ioutil.ReadFile(filepath.Join(usr.HomeDir, "."+App.name)) return string(state) } return "" }
[ "func", "GetDefaultDriver", "(", "path", "string", ")", "string", "{", "if", "path", "!=", "\"", "\"", "{", "return", "path", "\n", "}", "\n", "if", "usr", ",", "err", ":=", "user", ".", "Current", "(", ")", ";", "err", "==", "nil", "{", "state", ...
// GetDefaultDriver returns the path of the default directory as written in the // state file.
[ "GetDefaultDriver", "returns", "the", "path", "of", "the", "default", "directory", "as", "written", "in", "the", "state", "file", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/tools/serviced-storage/driver.go#L213-L222
139,113
control-center/serviced
facade/facade.go
New
func New() *Facade { return &Facade{ auditLogger: audit.NewLogger(), hostStore: host.NewStore(), hostkeyStore: hostkey.NewStore(), registryStore: registry.NewStore(), poolStore: pool.NewStore(), serviceStore: service.NewStore(), configStore: serviceconfigfile.NewStore(), templateSt...
go
func New() *Facade { return &Facade{ auditLogger: audit.NewLogger(), hostStore: host.NewStore(), hostkeyStore: hostkey.NewStore(), registryStore: registry.NewStore(), poolStore: pool.NewStore(), serviceStore: service.NewStore(), configStore: serviceconfigfile.NewStore(), templateSt...
[ "func", "New", "(", ")", "*", "Facade", "{", "return", "&", "Facade", "{", "auditLogger", ":", "audit", ".", "NewLogger", "(", ")", ",", "hostStore", ":", "host", ".", "NewStore", "(", ")", ",", "hostkeyStore", ":", "hostkey", ".", "NewStore", "(", "...
// New creates an initialized Facade instance
[ "New", "creates", "an", "initialized", "Facade", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/facade.go#L49-L67
139,114
control-center/serviced
facade/common.go
delete
func (f *Facade) delete(ctx datastore.Context, ds datastore.EntityStore, key datastore.Key, be beforeEvent, ae afterEvent) error { glog.V(2).Infof("Facade.delete: %s:%s", key.Kind(), key.ID()) ec := newEventCtx() err := f.beforeEvent(be, ec, key.ID()) if err == nil { err = ds.Delete(ctx, key) } defer f.afterEve...
go
func (f *Facade) delete(ctx datastore.Context, ds datastore.EntityStore, key datastore.Key, be beforeEvent, ae afterEvent) error { glog.V(2).Infof("Facade.delete: %s:%s", key.Kind(), key.ID()) ec := newEventCtx() err := f.beforeEvent(be, ec, key.ID()) if err == nil { err = ds.Delete(ctx, key) } defer f.afterEve...
[ "func", "(", "f", "*", "Facade", ")", "delete", "(", "ctx", "datastore", ".", "Context", ",", "ds", "datastore", ".", "EntityStore", ",", "key", "datastore", ".", "Key", ",", "be", "beforeEvent", ",", "ae", "afterEvent", ")", "error", "{", "glog", ".",...
// delete common code for removing an entity and publishes events
[ "delete", "common", "code", "for", "removing", "an", "entity", "and", "publishes", "events" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/common.go#L46-L55
139,115
control-center/serviced
dfs/info.go
Info
func (dfs *DistributedFilesystem) Info(snapshotID string) (*SnapshotInfo, error) { vol, info, err := dfs.getSnapshotVolumeAndInfo(snapshotID) if err != nil { return nil, err } return readSnapshotInfo(vol, info) }
go
func (dfs *DistributedFilesystem) Info(snapshotID string) (*SnapshotInfo, error) { vol, info, err := dfs.getSnapshotVolumeAndInfo(snapshotID) if err != nil { return nil, err } return readSnapshotInfo(vol, info) }
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "Info", "(", "snapshotID", "string", ")", "(", "*", "SnapshotInfo", ",", "error", ")", "{", "vol", ",", "info", ",", "err", ":=", "dfs", ".", "getSnapshotVolumeAndInfo", "(", "snapshotID", ")", "\n", ...
// Info returns information about an existing snapshot.
[ "Info", "returns", "information", "about", "an", "existing", "snapshot", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/info.go#L22-L28
139,116
control-center/serviced
dfs/info.go
getSnapshotVolumeAndInfo
func (dfs *DistributedFilesystem) getSnapshotVolumeAndInfo(snapshotID string) (volume.Volume, *volume.SnapshotInfo, error) { vol, err := dfs.disk.GetTenant(snapshotID) if err != nil { glog.Errorf("Could not get tenant of snapshot %s: %s", snapshotID, err) return nil, nil, err } info, err := vol.SnapshotInfo(sna...
go
func (dfs *DistributedFilesystem) getSnapshotVolumeAndInfo(snapshotID string) (volume.Volume, *volume.SnapshotInfo, error) { vol, err := dfs.disk.GetTenant(snapshotID) if err != nil { glog.Errorf("Could not get tenant of snapshot %s: %s", snapshotID, err) return nil, nil, err } info, err := vol.SnapshotInfo(sna...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "getSnapshotVolumeAndInfo", "(", "snapshotID", "string", ")", "(", "volume", ".", "Volume", ",", "*", "volume", ".", "SnapshotInfo", ",", "error", ")", "{", "vol", ",", "err", ":=", "dfs", ".", "disk",...
// getSnapshotVolumeAndInfo returns the parent volume and info about a snapshot.
[ "getSnapshotVolumeAndInfo", "returns", "the", "parent", "volume", "and", "info", "about", "a", "snapshot", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/info.go#L31-L43
139,117
control-center/serviced
web/publicendpointresource.go
restAddVirtualHost
func restAddVirtualHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { glog.V(1).Infof("Add VHost with %s %#v", r.URL.Path, r) serviceid, application, vhostname, err := getVHostContext(r) if err != nil { restServerError(w, err) return } // Disallow adding a vhost with the same name as the ho...
go
func restAddVirtualHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { glog.V(1).Infof("Add VHost with %s %#v", r.URL.Path, r) serviceid, application, vhostname, err := getVHostContext(r) if err != nil { restServerError(w, err) return } // Disallow adding a vhost with the same name as the ho...
[ "func", "restAddVirtualHost", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "r", ".", "URL", ...
// restAddVirtualHost parses payload, adds the vhost to the service, then updates the service
[ "restAddVirtualHost", "parses", "payload", "adds", "the", "vhost", "to", "the", "service", "then", "updates", "the", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/publicendpointresource.go#L44-L79
139,118
control-center/serviced
web/publicendpointresource.go
restRemoveVirtualHost
func restRemoveVirtualHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { serviceid, application, vhost, err := getVHostContext(r) if err != nil { restServerError(w, err) return } glog.V(2).Info("Removing vhost %d from service (%s)", vhost, serviceid) facade := ctx.getFacade() dataCtx := ct...
go
func restRemoveVirtualHost(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { serviceid, application, vhost, err := getVHostContext(r) if err != nil { restServerError(w, err) return } glog.V(2).Info("Removing vhost %d from service (%s)", vhost, serviceid) facade := ctx.getFacade() dataCtx := ct...
[ "func", "restRemoveVirtualHost", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "serviceid", ",", "application", ",", "vhost", ",", "err", ":=", "getVHostContext", "(", "r",...
// restRemoveVirtualHost removes a vhost name from provided service and endpoint. Parameters are defined in path.
[ "restRemoveVirtualHost", "removes", "a", "vhost", "name", "from", "provided", "service", "and", "endpoint", ".", "Parameters", "are", "defined", "in", "path", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/publicendpointresource.go#L82-L102
139,119
control-center/serviced
web/publicendpointresource.go
getVHostContext
func getVHostContext(r *rest.Request) (string, string, string, error) { serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { glog.Errorf("Failed getting serviceID: %v", err) return "", "", "", err } application, err := url.QueryUnescape(r.PathParam("application")) if err != nil { gl...
go
func getVHostContext(r *rest.Request) (string, string, string, error) { serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { glog.Errorf("Failed getting serviceID: %v", err) return "", "", "", err } application, err := url.QueryUnescape(r.PathParam("application")) if err != nil { gl...
[ "func", "getVHostContext", "(", "r", "*", "rest", ".", "Request", ")", "(", "string", ",", "string", ",", "string", ",", "error", ")", "{", "serviceID", ",", "err", ":=", "url", ".", "QueryUnescape", "(", "r", ".", "PathParam", "(", "\"", "\"", ")", ...
// return serviceID, application and vhostname from the URL path
[ "return", "serviceID", "application", "and", "vhostname", "from", "the", "URL", "path" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/publicendpointresource.go#L105-L125
139,120
control-center/serviced
web/publicendpointresource.go
restVirtualHostEnable
func restVirtualHostEnable(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { glog.V(1).Infof("Enable/Disable VHOST with %s %#v", r.URL.Path, r) serviceid, application, vhostname, err := getVHostContext(r) if err != nil { restServerError(w, err) return } var request endpointRequest err = r.Deco...
go
func restVirtualHostEnable(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { glog.V(1).Infof("Enable/Disable VHOST with %s %#v", r.URL.Path, r) serviceid, application, vhostname, err := getVHostContext(r) if err != nil { restServerError(w, err) return } var request endpointRequest err = r.Deco...
[ "func", "restVirtualHostEnable", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "r", ".", "URL",...
// restVirtualHostEnable enables or disables a virtual host endpoint
[ "restVirtualHostEnable", "enables", "or", "disables", "a", "virtual", "host", "endpoint" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/publicendpointresource.go#L128-L155
139,121
control-center/serviced
web/publicendpointresource.go
getPortContext
func getPortContext(r *rest.Request) (string, string, string, error) { glog.V(1).Infof("in getPortContext()") serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { glog.Errorf("Failed getting serviceID: %v", err) return "", "", "", err } application, err := url.QueryUnescape(r.PathPar...
go
func getPortContext(r *rest.Request) (string, string, string, error) { glog.V(1).Infof("in getPortContext()") serviceID, err := url.QueryUnescape(r.PathParam("serviceId")) if err != nil { glog.Errorf("Failed getting serviceID: %v", err) return "", "", "", err } application, err := url.QueryUnescape(r.PathPar...
[ "func", "getPortContext", "(", "r", "*", "rest", ".", "Request", ")", "(", "string", ",", "string", ",", "string", ",", "error", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "serviceID", ",", "err", ":=",...
// Returns the service, application, and portnumber from the request
[ "Returns", "the", "service", "application", "and", "portnumber", "from", "the", "request" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/publicendpointresource.go#L158-L188
139,122
control-center/serviced
web/publicendpointresource.go
restAddPort
func restAddPort(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { glog.V(1).Infof("Add PORT with %s %#v", r.URL.Path, r) serviceid, application, port, err := getPortContext(r) if err != nil { err := fmt.Errorf("Error removing port from service (%s): %v", serviceid, err) glog.Error(err) restServ...
go
func restAddPort(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) { glog.V(1).Infof("Add PORT with %s %#v", r.URL.Path, r) serviceid, application, port, err := getPortContext(r) if err != nil { err := fmt.Errorf("Error removing port from service (%s): %v", serviceid, err) glog.Error(err) restServ...
[ "func", "restAddPort", "(", "w", "*", "rest", ".", "ResponseWriter", ",", "r", "*", "rest", ".", "Request", ",", "ctx", "*", "requestContext", ")", "{", "glog", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "r", ".", "URL", ".", ...
// restAddPort parses payload, adds the port to the service, then updates the service
[ "restAddPort", "parses", "payload", "adds", "the", "port", "to", "the", "service", "then", "updates", "the", "service" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/publicendpointresource.go#L191-L226
139,123
control-center/serviced
web/utils.go
GetCertFiles
func GetCertFiles(certFile, keyFile string) (string, string) { // set the cert file if it doesn't exist if certFile == "" { var err error certFile, err = proxy.TempCertFile() if err != nil { plog.WithError(err).Fatal("Could not create temp cert file") } } // set the key file if it doesn't exist if key...
go
func GetCertFiles(certFile, keyFile string) (string, string) { // set the cert file if it doesn't exist if certFile == "" { var err error certFile, err = proxy.TempCertFile() if err != nil { plog.WithError(err).Fatal("Could not create temp cert file") } } // set the key file if it doesn't exist if key...
[ "func", "GetCertFiles", "(", "certFile", ",", "keyFile", "string", ")", "(", "string", ",", "string", ")", "{", "// set the cert file if it doesn't exist", "if", "certFile", "==", "\"", "\"", "{", "var", "err", "error", "\n", "certFile", ",", "err", "=", "pr...
// GetCertFiles returns the cert and key file if none is specified
[ "GetCertFiles", "returns", "the", "cert", "and", "key", "file", "if", "none", "is", "specified" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/utils.go#L54-L75
139,124
control-center/serviced
web/utils.go
GetRemoteConnection
func GetRemoteConnection(useTLS bool, export *registry.ExportDetails) (remote net.Conn, err error) { var dialer dialerInterface if useTLS && !IsLocalAddress(export.HostIP) { config := tls.Config{InsecureSkipVerify: true} dialer = newTlsDialer(&config) } else { dialer = newNetDialer() } return getRemoteConnec...
go
func GetRemoteConnection(useTLS bool, export *registry.ExportDetails) (remote net.Conn, err error) { var dialer dialerInterface if useTLS && !IsLocalAddress(export.HostIP) { config := tls.Config{InsecureSkipVerify: true} dialer = newTlsDialer(&config) } else { dialer = newNetDialer() } return getRemoteConnec...
[ "func", "GetRemoteConnection", "(", "useTLS", "bool", ",", "export", "*", "registry", ".", "ExportDetails", ")", "(", "remote", "net", ".", "Conn", ",", "err", "error", ")", "{", "var", "dialer", "dialerInterface", "\n", "if", "useTLS", "&&", "!", "IsLocal...
// GetRemoteConnection returns a connection to a remote address
[ "GetRemoteConnection", "returns", "a", "connection", "to", "a", "remote", "address" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/utils.go#L105-L114
139,125
control-center/serviced
web/utils.go
Accept
func (ln TCPKeepAliveListener) Accept() (c net.Conn, err error) { for { ln.SetDeadline(time.Now().Add(time.Second)) select { case <-ln.cancel: return nil, errors.New("port closed") default: } conn, err := ln.AcceptTCP() if err != nil { switch err := err.(type) { case net.Error: if err.Timeo...
go
func (ln TCPKeepAliveListener) Accept() (c net.Conn, err error) { for { ln.SetDeadline(time.Now().Add(time.Second)) select { case <-ln.cancel: return nil, errors.New("port closed") default: } conn, err := ln.AcceptTCP() if err != nil { switch err := err.(type) { case net.Error: if err.Timeo...
[ "func", "(", "ln", "TCPKeepAliveListener", ")", "Accept", "(", ")", "(", "c", "net", ".", "Conn", ",", "err", "error", ")", "{", "for", "{", "ln", ".", "SetDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "time", ".", "Second", ")",...
// Accept returns the connection to the listener
[ "Accept", "returns", "the", "connection", "to", "the", "listener" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/utils.go#L168-L193
139,126
control-center/serviced
utils/directory.go
ServiceDHome
func ServiceDHome() string { homeDir := config.GetOptions().HomePath if len(homeDir) == 0 { // This fallback is used in unit-tests, but in actual practice, // we should not hit this case, because there is a default // value defined via code in cli/api/options.go. But just in // case that somehow get's undone...
go
func ServiceDHome() string { homeDir := config.GetOptions().HomePath if len(homeDir) == 0 { // This fallback is used in unit-tests, but in actual practice, // we should not hit this case, because there is a default // value defined via code in cli/api/options.go. But just in // case that somehow get's undone...
[ "func", "ServiceDHome", "(", ")", "string", "{", "homeDir", ":=", "config", ".", "GetOptions", "(", ")", ".", "HomePath", "\n", "if", "len", "(", "homeDir", ")", "==", "0", "{", "// This fallback is used in unit-tests, but in actual practice,", "// we should not hit...
//ServiceDHome gets the home location of serviced by looking at the environment
[ "ServiceDHome", "gets", "the", "home", "location", "of", "serviced", "by", "looking", "at", "the", "environment" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/directory.go#L46-L59
139,127
control-center/serviced
utils/directory.go
LocalDir
func LocalDir(p string) string { homeDir := ServiceDHome() return path.Join(homeDir, p) }
go
func LocalDir(p string) string { homeDir := ServiceDHome() return path.Join(homeDir, p) }
[ "func", "LocalDir", "(", "p", "string", ")", "string", "{", "homeDir", ":=", "ServiceDHome", "(", ")", "\n", "return", "path", ".", "Join", "(", "homeDir", ",", "p", ")", "\n", "}" ]
//LocalDir gets the absolute path to a particular directory under ServiceDHome // if SERVICED_HOME is not defined then we use the location of the caller
[ "LocalDir", "gets", "the", "absolute", "path", "to", "a", "particular", "directory", "under", "ServiceDHome", "if", "SERVICED_HOME", "is", "not", "defined", "then", "we", "use", "the", "location", "of", "the", "caller" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/directory.go#L63-L66
139,128
control-center/serviced
utils/directory.go
TempDir
func TempDir(p string) string { var tmp string if user, err := user.Current(); err == nil { tmp = path.Join(os.TempDir(), fmt.Sprintf("serviced-%s", user.Username), p) } else { tmp = path.Join(os.TempDir(), fmt.Sprintf("serviced"), p) glog.Warningf("Defaulting home to %s", tmp) } return tmp }
go
func TempDir(p string) string { var tmp string if user, err := user.Current(); err == nil { tmp = path.Join(os.TempDir(), fmt.Sprintf("serviced-%s", user.Username), p) } else { tmp = path.Join(os.TempDir(), fmt.Sprintf("serviced"), p) glog.Warningf("Defaulting home to %s", tmp) } return tmp }
[ "func", "TempDir", "(", "p", "string", ")", "string", "{", "var", "tmp", "string", "\n\n", "if", "user", ",", "err", ":=", "user", ".", "Current", "(", ")", ";", "err", "==", "nil", "{", "tmp", "=", "path", ".", "Join", "(", "os", ".", "TempDir",...
// TempDir gets the temp serviced directory
[ "TempDir", "gets", "the", "temp", "serviced", "directory" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/directory.go#L74-L85
139,129
control-center/serviced
utils/directory.go
ServicedLogDir
func ServicedLogDir() string { if config.GetOptions().LogPath != "" { return config.GetOptions().LogPath } else{ return os.Getenv("SERVICED_LOG_PATH") } }
go
func ServicedLogDir() string { if config.GetOptions().LogPath != "" { return config.GetOptions().LogPath } else{ return os.Getenv("SERVICED_LOG_PATH") } }
[ "func", "ServicedLogDir", "(", ")", "string", "{", "if", "config", ".", "GetOptions", "(", ")", ".", "LogPath", "!=", "\"", "\"", "{", "return", "config", ".", "GetOptions", "(", ")", ".", "LogPath", "\n", "}", "else", "{", "return", "os", ".", "Gete...
// ServicedLogDir gets the serviced log directory
[ "ServicedLogDir", "gets", "the", "serviced", "log", "directory" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/directory.go#L88-L94
139,130
control-center/serviced
dfs/download.go
Download
func (dfs *DistributedFilesystem) Download(image, tenantID string, upgrade bool) (string, error) { if !upgrade { // Is this an image that has already been deployed? if rImage, err := dfs.findImage(image, tenantID); err != nil { return "", err } else if rImage != "" { return rImage, nil } } // Figure ou...
go
func (dfs *DistributedFilesystem) Download(image, tenantID string, upgrade bool) (string, error) { if !upgrade { // Is this an image that has already been deployed? if rImage, err := dfs.findImage(image, tenantID); err != nil { return "", err } else if rImage != "" { return rImage, nil } } // Figure ou...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "Download", "(", "image", ",", "tenantID", "string", ",", "upgrade", "bool", ")", "(", "string", ",", "error", ")", "{", "if", "!", "upgrade", "{", "// Is this an image that has already been deployed?", "if"...
// Download will download the image from upstream and save the image to the // registry.
[ "Download", "will", "download", "the", "image", "from", "upstream", "and", "save", "the", "image", "to", "the", "registry", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/download.go#L33-L85
139,131
control-center/serviced
dfs/download.go
findImage
func (dfs *DistributedFilesystem) findImage(image, tenantID string) (string, error) { // Is the image in the index? rImage, err := dfs.index.FindImage(image) if err != nil { if err == index.ErrImageNotFound { return "", nil } glog.Errorf("Could not look up image %s from the registry: %s", image, err) retu...
go
func (dfs *DistributedFilesystem) findImage(image, tenantID string) (string, error) { // Is the image in the index? rImage, err := dfs.index.FindImage(image) if err != nil { if err == index.ErrImageNotFound { return "", nil } glog.Errorf("Could not look up image %s from the registry: %s", image, err) retu...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "findImage", "(", "image", ",", "tenantID", "string", ")", "(", "string", ",", "error", ")", "{", "// Is the image in the index?", "rImage", ",", "err", ":=", "dfs", ".", "index", ".", "FindImage", "(", ...
// findImage will verify whether the image has already been deployed with the // application.
[ "findImage", "will", "verify", "whether", "the", "image", "has", "already", "been", "deployed", "with", "the", "application", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/download.go#L89-L104
139,132
control-center/serviced
dfs/download.go
parseRegistryImage
func (dfs *DistributedFilesystem) parseRegistryImage(image, tenantID string) (string, error) { // Is this a proper docker image? imageID, err := commons.ParseImageID(image) if err != nil { glog.Errorf("Could not parse image %s: %s", image, err) return "", err } // Get the registry path rImage := (&registry.Im...
go
func (dfs *DistributedFilesystem) parseRegistryImage(image, tenantID string) (string, error) { // Is this a proper docker image? imageID, err := commons.ParseImageID(image) if err != nil { glog.Errorf("Could not parse image %s: %s", image, err) return "", err } // Get the registry path rImage := (&registry.Im...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "parseRegistryImage", "(", "image", ",", "tenantID", "string", ")", "(", "string", ",", "error", ")", "{", "// Is this a proper docker image?", "imageID", ",", "err", ":=", "commons", ".", "ParseImageID", "(...
// parseRegistryImage formats the image as it will be written into the docker // registry.
[ "parseRegistryImage", "formats", "the", "image", "as", "it", "will", "be", "written", "into", "the", "docker", "registry", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/download.go#L108-L122
139,133
control-center/serviced
dfs/download.go
pullImage
func (dfs *DistributedFilesystem) pullImage(image string) (*dockerclient.Image, error) { // Find (or download) the image img, err := dfs.docker.FindImage(image) if docker.IsImageNotFound(err) { glog.Infof("Image %s not found locally, pulling", image) if err := dfs.docker.PullImage(image); err != nil { glog.Er...
go
func (dfs *DistributedFilesystem) pullImage(image string) (*dockerclient.Image, error) { // Find (or download) the image img, err := dfs.docker.FindImage(image) if docker.IsImageNotFound(err) { glog.Infof("Image %s not found locally, pulling", image) if err := dfs.docker.PullImage(image); err != nil { glog.Er...
[ "func", "(", "dfs", "*", "DistributedFilesystem", ")", "pullImage", "(", "image", "string", ")", "(", "*", "dockerclient", ".", "Image", ",", "error", ")", "{", "// Find (or download) the image", "img", ",", "err", ":=", "dfs", ".", "docker", ".", "FindImage...
// pullImage pulls the image from the upstream if it doesn't already exist // locally
[ "pullImage", "pulls", "the", "image", "from", "the", "upstream", "if", "it", "doesn", "t", "already", "exist", "locally" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/download.go#L126-L143
139,134
control-center/serviced
metrics/client.go
NewClient
func NewClient(endpoint string) (*Client, error) { u, err := parseEndpoint(endpoint) if err != nil { return nil, err } return &Client{ HTTPClient: &http.Client{Timeout: time.Duration(5 * time.Second)}, endpoint: endpoint, endpointURL: u, }, nil }
go
func NewClient(endpoint string) (*Client, error) { u, err := parseEndpoint(endpoint) if err != nil { return nil, err } return &Client{ HTTPClient: &http.Client{Timeout: time.Duration(5 * time.Second)}, endpoint: endpoint, endpointURL: u, }, nil }
[ "func", "NewClient", "(", "endpoint", "string", ")", "(", "*", "Client", ",", "error", ")", "{", "u", ",", "err", ":=", "parseEndpoint", "(", "endpoint", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ret...
// NewClient returns a Client instance ready for communication with the given // server endpoint.
[ "NewClient", "returns", "a", "Client", "instance", "ready", "for", "communication", "with", "the", "given", "server", "endpoint", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/metrics/client.go#L42-L53
139,135
control-center/serviced
zzk/service/hostip.go
IPID
func (req IPRequest) IPID() string { return fmt.Sprintf("%s-%s", req.HostID, req.IPAddress) }
go
func (req IPRequest) IPID() string { return fmt.Sprintf("%s-%s", req.HostID, req.IPAddress) }
[ "func", "(", "req", "IPRequest", ")", "IPID", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "req", ".", "HostID", ",", "req", ".", "IPAddress", ")", "\n", "}" ]
// IPID is the string identifier of the node in zookeeper
[ "IPID", "is", "the", "string", "identifier", "of", "the", "node", "in", "zookeeper" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L80-L82
139,136
control-center/serviced
zzk/service/hostip.go
ParseIPID
func ParseIPID(ipid string) (hostid string, ipaddress string, err error) { parts := strings.SplitN(ipid, "-", 2) if len(parts) != 2 { // TODO: error return "", "", ErrInvalidIPID } return parts[0], parts[1], nil }
go
func ParseIPID(ipid string) (hostid string, ipaddress string, err error) { parts := strings.SplitN(ipid, "-", 2) if len(parts) != 2 { // TODO: error return "", "", ErrInvalidIPID } return parts[0], parts[1], nil }
[ "func", "ParseIPID", "(", "ipid", "string", ")", "(", "hostid", "string", ",", "ipaddress", "string", ",", "err", "error", ")", "{", "parts", ":=", "strings", ".", "SplitN", "(", "ipid", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "part...
// ParseIPID returns the host and ip address from a given IP id
[ "ParseIPID", "returns", "the", "host", "and", "ip", "address", "from", "a", "given", "IP", "id" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L85-L92
139,137
control-center/serviced
zzk/service/hostip.go
GetHostID
func GetHostID(conn client.Connection, poolID string, address string) (string, error) { hostIPs, _ := conn.Children(Base().Pools().ID(poolID).IPs().Path()) for _, hostIP := range hostIPs { host, ip, err := ParseIPID(hostIP) if err != nil { return "", err } if ip == address { return host, nil } } re...
go
func GetHostID(conn client.Connection, poolID string, address string) (string, error) { hostIPs, _ := conn.Children(Base().Pools().ID(poolID).IPs().Path()) for _, hostIP := range hostIPs { host, ip, err := ParseIPID(hostIP) if err != nil { return "", err } if ip == address { return host, nil } } re...
[ "func", "GetHostID", "(", "conn", "client", ".", "Connection", ",", "poolID", "string", ",", "address", "string", ")", "(", "string", ",", "error", ")", "{", "hostIPs", ",", "_", ":=", "conn", ".", "Children", "(", "Base", "(", ")", ".", "Pools", "("...
// GetHostID returns the signed host ID for a virtual IP or and err if it is not // assigned.
[ "GetHostID", "returns", "the", "signed", "host", "ID", "for", "a", "virtual", "IP", "or", "and", "err", "if", "it", "is", "not", "assigned", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L96-L109
139,138
control-center/serviced
zzk/service/hostip.go
GetIP
func GetIP(conn client.Connection, req IPRequest) (*IP, error) { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } // Get the current pool ip ppth := path.Join(basepth, "/ips", req...
go
func GetIP(conn client.Connection, req IPRequest) (*IP, error) { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } // Get the current pool ip ppth := path.Join(basepth, "/ips", req...
[ "func", "GetIP", "(", "conn", "client", ".", "Connection", ",", "req", "IPRequest", ")", "(", "*", "IP", ",", "error", ")", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "req", ".", "HostID", ",", ...
// GetIP returns the ip data for a given virtual ip
[ "GetIP", "returns", "the", "ip", "data", "for", "a", "given", "virtual", "ip" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L112-L149
139,139
control-center/serviced
zzk/service/hostip.go
CreateIP
func CreateIP(conn client.Connection, req IPRequest, netmask, iface string) error { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } t := conn.NewTransaction() // Prepare the poo...
go
func CreateIP(conn client.Connection, req IPRequest, netmask, iface string) error { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } t := conn.NewTransaction() // Prepare the poo...
[ "func", "CreateIP", "(", "conn", "client", ".", "Connection", ",", "req", "IPRequest", ",", "netmask", ",", "iface", "string", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "req", ".", ...
// CreateIP adds a new ip for pool and the host
[ "CreateIP", "adds", "a", "new", "ip", "for", "pool", "and", "the", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L152-L201
139,140
control-center/serviced
zzk/service/hostip.go
UpdateIP
func UpdateIP(conn client.Connection, req IPRequest, mutate func(*IP) bool) error { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } // Get the current pool ip ppth := path.Join(b...
go
func UpdateIP(conn client.Connection, req IPRequest, mutate func(*IP) bool) error { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } // Get the current pool ip ppth := path.Join(b...
[ "func", "UpdateIP", "(", "conn", "client", ".", "Connection", ",", "req", "IPRequest", ",", "mutate", "func", "(", "*", "IP", ")", "bool", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", ...
// UpdateIP updates the ip for the pool and the host
[ "UpdateIP", "updates", "the", "ip", "for", "the", "pool", "and", "the", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L204-L261
139,141
control-center/serviced
zzk/service/hostip.go
DeleteIP
func DeleteIP(conn client.Connection, req IPRequest) error { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } t := conn.NewTransaction() // Delete the pool ip ppth := path.Join(...
go
func DeleteIP(conn client.Connection, req IPRequest) error { logger := plog.WithFields(log.Fields{ "hostid": req.HostID, "ipaddress": req.IPAddress, }) basepth := "/" if req.PoolID != "" { basepth = path.Join("/pools", req.PoolID) } t := conn.NewTransaction() // Delete the pool ip ppth := path.Join(...
[ "func", "DeleteIP", "(", "conn", "client", ".", "Connection", ",", "req", "IPRequest", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "req", ".", "HostID", ",", "\"", "\"", ":", "req", ...
// DeleteIP removes the ip from the pool and the host
[ "DeleteIP", "removes", "the", "ip", "from", "the", "pool", "and", "the", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/zzk/service/hostip.go#L264-L308
139,142
control-center/serviced
facade/dfs.go
BackupInfo
func (f *Facade) BackupInfo(ctx datastore.Context, r io.Reader) (*dfs.BackupInfo, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.BackupInfo")) info, err := f.dfs.BackupInfo(r) if err != nil { plog.WithError(err).Debug("Could not get info for backup") return nil, err } return info, nil }
go
func (f *Facade) BackupInfo(ctx datastore.Context, r io.Reader) (*dfs.BackupInfo, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.BackupInfo")) info, err := f.dfs.BackupInfo(r) if err != nil { plog.WithError(err).Debug("Could not get info for backup") return nil, err } return info, nil }
[ "func", "(", "f", "*", "Facade", ")", "BackupInfo", "(", "ctx", "datastore", ".", "Context", ",", "r", "io", ".", "Reader", ")", "(", "*", "dfs", ".", "BackupInfo", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(...
// BackupInfo returns metadata info about a backup
[ "BackupInfo", "returns", "metadata", "info", "about", "a", "backup" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L236-L244
139,143
control-center/serviced
facade/dfs.go
Commit
func (f *Facade) Commit(ctx datastore.Context, ctrID, message string, tags []string, snapshotSpacePercent int) (string, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.Commit")) logger := plog.WithField("containerid", ctrID) tenantID, err := f.dfs.Commit(ctrID) if err != nil { logger.WithError(err)....
go
func (f *Facade) Commit(ctx datastore.Context, ctrID, message string, tags []string, snapshotSpacePercent int) (string, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.Commit")) logger := plog.WithField("containerid", ctrID) tenantID, err := f.dfs.Commit(ctrID) if err != nil { logger.WithError(err)....
[ "func", "(", "f", "*", "Facade", ")", "Commit", "(", "ctx", "datastore", ".", "Context", ",", "ctrID", ",", "message", "string", ",", "tags", "[", "]", "string", ",", "snapshotSpacePercent", "int", ")", "(", "string", ",", "error", ")", "{", "defer", ...
// Commit commits a container to the docker registry and takes a snapshot.
[ "Commit", "commits", "a", "container", "to", "the", "docker", "registry", "and", "takes", "a", "snapshot", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L247-L262
139,144
control-center/serviced
facade/dfs.go
DeleteSnapshot
func (f *Facade) DeleteSnapshot(ctx datastore.Context, snapshotID string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DeleteSnapshot")) // Do not DFSLock here, ControlPlaneDao does that if err := f.dfs.Delete(snapshotID); err != nil { plog.WithField("snapshotid", snapshotID).WithError(err).Debug("...
go
func (f *Facade) DeleteSnapshot(ctx datastore.Context, snapshotID string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DeleteSnapshot")) // Do not DFSLock here, ControlPlaneDao does that if err := f.dfs.Delete(snapshotID); err != nil { plog.WithField("snapshotid", snapshotID).WithError(err).Debug("...
[ "func", "(", "f", "*", "Facade", ")", "DeleteSnapshot", "(", "ctx", "datastore", ".", "Context", ",", "snapshotID", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start"...
// DeleteSnapshot removes a snapshot from an application.
[ "DeleteSnapshot", "removes", "a", "snapshot", "from", "an", "application", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L265-L273
139,145
control-center/serviced
facade/dfs.go
DeleteSnapshots
func (f *Facade) DeleteSnapshots(ctx datastore.Context, serviceID string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DeleteSnapshots")) // Do not DFSLock here, ControlPlaneDao does that snapshots, err := f.ListSnapshots(ctx, serviceID) if err != nil { return err } for _, snapshotID := range sn...
go
func (f *Facade) DeleteSnapshots(ctx datastore.Context, serviceID string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DeleteSnapshots")) // Do not DFSLock here, ControlPlaneDao does that snapshots, err := f.ListSnapshots(ctx, serviceID) if err != nil { return err } for _, snapshotID := range sn...
[ "func", "(", "f", "*", "Facade", ")", "DeleteSnapshots", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start"...
// DeleteSnapshots removes all snapshots for an application.
[ "DeleteSnapshots", "removes", "all", "snapshots", "for", "an", "application", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L276-L289
139,146
control-center/serviced
facade/dfs.go
DFSLock
func (f *Facade) DFSLock(ctx datastore.Context) dfs.DFSLocker { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DFSLock")) return f.dfs }
go
func (f *Facade) DFSLock(ctx datastore.Context) dfs.DFSLocker { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DFSLock")) return f.dfs }
[ "func", "(", "f", "*", "Facade", ")", "DFSLock", "(", "ctx", "datastore", ".", "Context", ")", "dfs", ".", "DFSLocker", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(", "\"", "\"...
// DFSLock returns the locker for the dfs
[ "DFSLock", "returns", "the", "locker", "for", "the", "dfs" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L292-L295
139,147
control-center/serviced
facade/dfs.go
GetSnapshotInfo
func (f *Facade) GetSnapshotInfo(ctx datastore.Context, snapshotID string) (*dfs.SnapshotInfo, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetSnapshotInfo")) info, err := f.dfs.Info(snapshotID) if err != nil { plog.WithField("snapshotid", snapshotID).WithError(err).Debug("Could not get info for s...
go
func (f *Facade) GetSnapshotInfo(ctx datastore.Context, snapshotID string) (*dfs.SnapshotInfo, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetSnapshotInfo")) info, err := f.dfs.Info(snapshotID) if err != nil { plog.WithField("snapshotid", snapshotID).WithError(err).Debug("Could not get info for s...
[ "func", "(", "f", "*", "Facade", ")", "GetSnapshotInfo", "(", "ctx", "datastore", ".", "Context", ",", "snapshotID", "string", ")", "(", "*", "dfs", ".", "SnapshotInfo", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "...
// GetSnapshotInfo returns information about a snapshot.
[ "GetSnapshotInfo", "returns", "information", "about", "a", "snapshot", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L298-L306
139,148
control-center/serviced
facade/dfs.go
ListSnapshots
func (f *Facade) ListSnapshots(ctx datastore.Context, serviceID string) ([]string, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ListSnapshots")) logger := plog.WithField("serviceid", serviceID) tenantID, err := f.GetTenantID(ctx, serviceID) if err != nil { logger.WithError(err).Debug("Could not f...
go
func (f *Facade) ListSnapshots(ctx datastore.Context, serviceID string) ([]string, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ListSnapshots")) logger := plog.WithField("serviceid", serviceID) tenantID, err := f.GetTenantID(ctx, serviceID) if err != nil { logger.WithError(err).Debug("Could not f...
[ "func", "(", "f", "*", "Facade", ")", "ListSnapshots", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", "."...
// ListSnapshots returns a list of strings that describes the snapshots for the // given application.
[ "ListSnapshots", "returns", "a", "list", "of", "strings", "that", "describes", "the", "snapshots", "for", "the", "given", "application", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L310-L325
139,149
control-center/serviced
facade/dfs.go
TagSnapshot
func (f *Facade) TagSnapshot(snapshotID string, tagName string) error { logger := plog.WithFields(logrus.Fields{ "snapshotid": snapshotID, "tagname": tagName, }) if err := f.dfs.Tag(snapshotID, tagName); err != nil { logger.WithError(err).Debug("Could not add tag to snapshot") return err } return nil }
go
func (f *Facade) TagSnapshot(snapshotID string, tagName string) error { logger := plog.WithFields(logrus.Fields{ "snapshotid": snapshotID, "tagname": tagName, }) if err := f.dfs.Tag(snapshotID, tagName); err != nil { logger.WithError(err).Debug("Could not add tag to snapshot") return err } return nil }
[ "func", "(", "f", "*", "Facade", ")", "TagSnapshot", "(", "snapshotID", "string", ",", "tagName", "string", ")", "error", "{", "logger", ":=", "plog", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "snapshotID", ",", "\"", "\"",...
// TagSnapshot adds tags to an existing snapshot
[ "TagSnapshot", "adds", "tags", "to", "an", "existing", "snapshot" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L328-L338
139,150
control-center/serviced
facade/dfs.go
GetSnapshotByServiceIDAndTag
func (f *Facade) GetSnapshotByServiceIDAndTag(ctx datastore.Context, serviceID, tagName string) (*dfs.SnapshotInfo, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetSnapshotByServiceIDAndTag")) logger := plog.WithFields(logrus.Fields{ "serviceid": serviceID, "tagname": tagName, }) tenantID, e...
go
func (f *Facade) GetSnapshotByServiceIDAndTag(ctx datastore.Context, serviceID, tagName string) (*dfs.SnapshotInfo, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetSnapshotByServiceIDAndTag")) logger := plog.WithFields(logrus.Fields{ "serviceid": serviceID, "tagname": tagName, }) tenantID, e...
[ "func", "(", "f", "*", "Facade", ")", "GetSnapshotByServiceIDAndTag", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", ",", "tagName", "string", ")", "(", "*", "dfs", ".", "SnapshotInfo", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics", ...
// GetSnapshotByServiceIDAndTag finds the existing snapshot for a given service with a specific tag
[ "GetSnapshotByServiceIDAndTag", "finds", "the", "existing", "snapshot", "for", "a", "given", "service", "with", "a", "specific", "tag" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L362-L381
139,151
control-center/serviced
facade/dfs.go
ResetLock
func (f *Facade) ResetLock(ctx datastore.Context, serviceID string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetLock")) logger := plog.WithField("serviceid", serviceID) tenantID, err := f.GetTenantID(ctx, serviceID) if err != nil { logger.WithError(err).Debug("Could not find tenant for servi...
go
func (f *Facade) ResetLock(ctx datastore.Context, serviceID string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetLock")) logger := plog.WithField("serviceid", serviceID) tenantID, err := f.GetTenantID(ctx, serviceID) if err != nil { logger.WithError(err).Debug("Could not find tenant for servi...
[ "func", "(", "f", "*", "Facade", ")", "ResetLock", "(", "ctx", "datastore", ".", "Context", ",", "serviceID", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(...
// ResetLock resets locks for a specific tenant
[ "ResetLock", "resets", "locks", "for", "a", "specific", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L384-L398
139,152
control-center/serviced
facade/dfs.go
ResetLocks
func (f *Facade) ResetLocks(ctx datastore.Context) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetLocks")) tenantIDs, err := f.GetTenantIDs(ctx) if err != nil { plog.WithError(err).Debug("Could not get tenants") return err } for _, tenantID := range tenantIDs { if err := f.ResetLock(ctx, t...
go
func (f *Facade) ResetLocks(ctx datastore.Context) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.ResetLocks")) tenantIDs, err := f.GetTenantIDs(ctx) if err != nil { plog.WithError(err).Debug("Could not get tenants") return err } for _, tenantID := range tenantIDs { if err := f.ResetLock(ctx, t...
[ "func", "(", "f", "*", "Facade", ")", "ResetLocks", "(", "ctx", "datastore", ".", "Context", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(", "\"", "\"", ")", ")", ...
// ResetLocks resets all tenant locks
[ "ResetLocks", "resets", "all", "tenant", "locks" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L401-L414
139,153
control-center/serviced
facade/dfs.go
Download
func (f *Facade) Download(imageID, tenantID string) error { if _, err := f.dfs.Download(imageID, tenantID, true); err != nil { return err } return nil }
go
func (f *Facade) Download(imageID, tenantID string) error { if _, err := f.dfs.Download(imageID, tenantID, true); err != nil { return err } return nil }
[ "func", "(", "f", "*", "Facade", ")", "Download", "(", "imageID", ",", "tenantID", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "f", ".", "dfs", ".", "Download", "(", "imageID", ",", "tenantID", ",", "true", ")", ";", "err", "!=", "n...
// Download will push a specified image into the registry for the specified // tenant
[ "Download", "will", "push", "a", "specified", "image", "into", "the", "registry", "for", "the", "specified", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L418-L423
139,154
control-center/serviced
facade/dfs.go
RepairRegistry
func (f *Facade) RepairRegistry(ctx datastore.Context) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RepairRegistry")) if err := f.DFSLock(ctx).LockWithTimeout("reset registry", userLockTimeout); err != nil { plog.WithError(err).Debug("Cannot reset registry") return err } defer f.DFSLock(ctx).Unl...
go
func (f *Facade) RepairRegistry(ctx datastore.Context) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RepairRegistry")) if err := f.DFSLock(ctx).LockWithTimeout("reset registry", userLockTimeout); err != nil { plog.WithError(err).Debug("Cannot reset registry") return err } defer f.DFSLock(ctx).Unl...
[ "func", "(", "f", "*", "Facade", ")", "RepairRegistry", "(", "ctx", "datastore", ".", "Context", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")", ".", "Start", "(", "\"", "\"", ")", "...
// RepairRegistry will load "latest" from the docker registry and save it to the // database.
[ "RepairRegistry", "will", "load", "latest", "from", "the", "docker", "registry", "and", "save", "it", "to", "the", "database", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L427-L456
139,155
control-center/serviced
facade/dfs.go
startDockerRegistry
func (f *Facade) startDockerRegistry(version int, port string) (*docker.Container, error) { versionInfo := registryVersionInfos[version] return versionInfo.start(f.isvcsPath, port) }
go
func (f *Facade) startDockerRegistry(version int, port string) (*docker.Container, error) { versionInfo := registryVersionInfos[version] return versionInfo.start(f.isvcsPath, port) }
[ "func", "(", "f", "*", "Facade", ")", "startDockerRegistry", "(", "version", "int", ",", "port", "string", ")", "(", "*", "docker", ".", "Container", ",", "error", ")", "{", "versionInfo", ":=", "registryVersionInfos", "[", "version", "]", "\n", "return", ...
// startDockerRegistry returns the old docker registry container.
[ "startDockerRegistry", "returns", "the", "old", "docker", "registry", "container", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L528-L531
139,156
control-center/serviced
facade/dfs.go
getPreviousRegistryVersion
func (f *Facade) getPreviousRegistryVersion() (isMigrated bool, version int, err error) { for i := currentRegistryVersion - 1; i > 0; i-- { logger := plog.WithField("version", i) plog.Info("Checking docker registry") versionInfo := registryVersionInfos[i] registryPath := versionInfo.getStoragePath(f.isvcsPath)...
go
func (f *Facade) getPreviousRegistryVersion() (isMigrated bool, version int, err error) { for i := currentRegistryVersion - 1; i > 0; i-- { logger := plog.WithField("version", i) plog.Info("Checking docker registry") versionInfo := registryVersionInfos[i] registryPath := versionInfo.getStoragePath(f.isvcsPath)...
[ "func", "(", "f", "*", "Facade", ")", "getPreviousRegistryVersion", "(", ")", "(", "isMigrated", "bool", ",", "version", "int", ",", "err", "error", ")", "{", "for", "i", ":=", "currentRegistryVersion", "-", "1", ";", "i", ">", "0", ";", "i", "--", "...
// getPreviousRegistryVersion returns the next previous version of the docker // registry that needs migration and whether it has been previously migrated.
[ "getPreviousRegistryVersion", "returns", "the", "next", "previous", "version", "of", "the", "docker", "registry", "that", "needs", "migration", "and", "whether", "it", "has", "been", "previously", "migrated", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L535-L559
139,157
control-center/serviced
facade/dfs.go
markLocalDockerRegistryUpgraded
func (f *Facade) markLocalDockerRegistryUpgraded(version int) error { versionInfo := registryVersionInfos[version] markerFilePath := versionInfo.getUpgradedMarkerPath(f.isvcsPath) logger := plog.WithFields(logrus.Fields{ "version": version, "markerfilepath": markerFilePath, }) if err := ioutil.WriteFile...
go
func (f *Facade) markLocalDockerRegistryUpgraded(version int) error { versionInfo := registryVersionInfos[version] markerFilePath := versionInfo.getUpgradedMarkerPath(f.isvcsPath) logger := plog.WithFields(logrus.Fields{ "version": version, "markerfilepath": markerFilePath, }) if err := ioutil.WriteFile...
[ "func", "(", "f", "*", "Facade", ")", "markLocalDockerRegistryUpgraded", "(", "version", "int", ")", "error", "{", "versionInfo", ":=", "registryVersionInfos", "[", "version", "]", "\n", "markerFilePath", ":=", "versionInfo", ".", "getUpgradedMarkerPath", "(", "f"...
// markLocalDockerRegistryUpgraded sets a marker file that will indicate // whether a registry has been previously migrated.
[ "markLocalDockerRegistryUpgraded", "sets", "a", "marker", "file", "that", "will", "indicate", "whether", "a", "registry", "has", "been", "previously", "migrated", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L563-L575
139,158
control-center/serviced
facade/dfs.go
DockerOverride
func (f *Facade) DockerOverride(ctx datastore.Context, newImageName, oldImageName string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DockerOverride")) return f.dfs.Override(newImageName, oldImageName) }
go
func (f *Facade) DockerOverride(ctx datastore.Context, newImageName, oldImageName string) error { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DockerOverride")) return f.dfs.Override(newImageName, oldImageName) }
[ "func", "(", "f", "*", "Facade", ")", "DockerOverride", "(", "ctx", "datastore", ".", "Context", ",", "newImageName", ",", "oldImageName", "string", ")", "error", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "...
// DockerOverride will replace a docker image in the registry with a new image
[ "DockerOverride", "will", "replace", "a", "docker", "image", "in", "the", "registry", "with", "a", "new", "image" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L905-L908
139,159
control-center/serviced
facade/dfs.go
PredictStorageAvailability
func (f *Facade) PredictStorageAvailability(ctx datastore.Context, lookahead time.Duration) (map[string]float64, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.PredictStorageAvailability")) options := config.GetOptions() // First, get a list of all tenant IDs tenantIDs, err := f.ListTenants(ctx) if...
go
func (f *Facade) PredictStorageAvailability(ctx datastore.Context, lookahead time.Duration) (map[string]float64, error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.PredictStorageAvailability")) options := config.GetOptions() // First, get a list of all tenant IDs tenantIDs, err := f.ListTenants(ctx) if...
[ "func", "(", "f", "*", "Facade", ")", "PredictStorageAvailability", "(", "ctx", "datastore", ".", "Context", ",", "lookahead", "time", ".", "Duration", ")", "(", "map", "[", "string", "]", "float64", ",", "error", ")", "{", "defer", "ctx", ".", "Metrics"...
// PredictStorageAvailability returns the predicted available storage after // a given period for the thin pool data device, the thin pool metadata device, // and each tenant filesystem.
[ "PredictStorageAvailability", "returns", "the", "predicted", "available", "storage", "after", "a", "given", "period", "for", "the", "thin", "pool", "data", "device", "the", "thin", "pool", "metadata", "device", "and", "each", "tenant", "filesystem", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/dfs.go#L913-L945
139,160
control-center/serviced
dfs/nfs/common.go
Mount
func Mount(driver Driver, remotePath, localPath string) error { // check if the driver is installed if err := driver.Installed(); err != nil { return err } // validate that the remote path if ok := func(remotePath string) bool { parts := strings.Split(remotePath, ":") if len(parts) != 2 { return false ...
go
func Mount(driver Driver, remotePath, localPath string) error { // check if the driver is installed if err := driver.Installed(); err != nil { return err } // validate that the remote path if ok := func(remotePath string) bool { parts := strings.Split(remotePath, ":") if len(parts) != 2 { return false ...
[ "func", "Mount", "(", "driver", "Driver", ",", "remotePath", ",", "localPath", "string", ")", "error", "{", "// check if the driver is installed", "if", "err", ":=", "driver", ".", "Installed", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", ...
// Mount attempts to mount the nfsPath to the localPath
[ "Mount", "attempts", "to", "mount", "the", "nfsPath", "to", "the", "localPath" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/common.go#L127-L207
139,161
control-center/serviced
dfs/nfs/common.go
Unmount
func Unmount(driver Driver, localPath string) error { // check if the driver is installed if err := driver.Installed(); err != nil { return err } // verify mount var mountInfo proc.NFSMountInfo if err := driver.Info(localPath, &mountInfo); err != nil { glog.Errorf("Could not get volume info for %s: %s", loca...
go
func Unmount(driver Driver, localPath string) error { // check if the driver is installed if err := driver.Installed(); err != nil { return err } // verify mount var mountInfo proc.NFSMountInfo if err := driver.Info(localPath, &mountInfo); err != nil { glog.Errorf("Could not get volume info for %s: %s", loca...
[ "func", "Unmount", "(", "driver", "Driver", ",", "localPath", "string", ")", "error", "{", "// check if the driver is installed", "if", "err", ":=", "driver", ".", "Installed", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "//...
// Unmount attempts to unmount the localPath
[ "Unmount", "attempts", "to", "unmount", "the", "localPath" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/nfs/common.go#L210-L229
139,162
control-center/serviced
facade/pool_cache.go
NewPoolCache
func NewPoolCache() *poolCache { return &poolCache{ mutex: sync.RWMutex{}, dirty: true, pools: make([]pool.ReadPool, 0), } }
go
func NewPoolCache() *poolCache { return &poolCache{ mutex: sync.RWMutex{}, dirty: true, pools: make([]pool.ReadPool, 0), } }
[ "func", "NewPoolCache", "(", ")", "*", "poolCache", "{", "return", "&", "poolCache", "{", "mutex", ":", "sync", ".", "RWMutex", "{", "}", ",", "dirty", ":", "true", ",", "pools", ":", "make", "(", "[", "]", "pool", ".", "ReadPool", ",", "0", ")", ...
// NewPoolCache creates a new poolCache, which is dirty and empty by default
[ "NewPoolCache", "creates", "a", "new", "poolCache", "which", "is", "dirty", "and", "empty", "by", "default" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool_cache.go#L33-L39
139,163
control-center/serviced
facade/pool_cache.go
GetPools
func (pc *poolCache) GetPools(getPoolsFunc GetPoolsFunc) ([]pool.ReadPool, error) { pc.mutex.Lock() defer pc.mutex.Unlock() var err error if pc.dirty { pc.pools, err = getPoolsFunc() if err == nil { pc.dirty = false } } return pc.pools, err }
go
func (pc *poolCache) GetPools(getPoolsFunc GetPoolsFunc) ([]pool.ReadPool, error) { pc.mutex.Lock() defer pc.mutex.Unlock() var err error if pc.dirty { pc.pools, err = getPoolsFunc() if err == nil { pc.dirty = false } } return pc.pools, err }
[ "func", "(", "pc", "*", "poolCache", ")", "GetPools", "(", "getPoolsFunc", "GetPoolsFunc", ")", "(", "[", "]", "pool", ".", "ReadPool", ",", "error", ")", "{", "pc", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "pc", ".", "mutex", ".", "Unlo...
// GetPools caches the result of getPoolsFunc if the cache is dirty // then returns the cached ReadPools.
[ "GetPools", "caches", "the", "result", "of", "getPoolsFunc", "if", "the", "cache", "is", "dirty", "then", "returns", "the", "cached", "ReadPools", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool_cache.go#L43-L55
139,164
control-center/serviced
facade/pool_cache.go
SetDirty
func (pc *poolCache) SetDirty() { pc.mutex.Lock() defer pc.mutex.Unlock() pc.dirty = true }
go
func (pc *poolCache) SetDirty() { pc.mutex.Lock() defer pc.mutex.Unlock() pc.dirty = true }
[ "func", "(", "pc", "*", "poolCache", ")", "SetDirty", "(", ")", "{", "pc", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "pc", ".", "mutex", ".", "Unlock", "(", ")", "\n", "pc", ".", "dirty", "=", "true", "\n", "}" ]
// SetDirty sets poolCache.dirty to true, meaning it will call a GetPoolsFunc // next time GetPools is called.
[ "SetDirty", "sets", "poolCache", ".", "dirty", "to", "true", "meaning", "it", "will", "call", "a", "GetPoolsFunc", "next", "time", "GetPools", "is", "called", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/pool_cache.go#L59-L63
139,165
control-center/serviced
volume/rsync/rsync.go
Init
func Init(root string, _ []string) (volume.Driver, error) { driver := &RsyncDriver{ root: root, } if err := os.MkdirAll(driver.MetadataDir(), 0755); err != nil && !os.IsExist(err) { return nil, err } if err := volume.TouchFlagFile(driver.poolDir()); err != nil { return nil, err } return driver, nil }
go
func Init(root string, _ []string) (volume.Driver, error) { driver := &RsyncDriver{ root: root, } if err := os.MkdirAll(driver.MetadataDir(), 0755); err != nil && !os.IsExist(err) { return nil, err } if err := volume.TouchFlagFile(driver.poolDir()); err != nil { return nil, err } return driver, nil }
[ "func", "Init", "(", "root", "string", ",", "_", "[", "]", "string", ")", "(", "volume", ".", "Driver", ",", "error", ")", "{", "driver", ":=", "&", "RsyncDriver", "{", "root", ":", "root", ",", "}", "\n", "if", "err", ":=", "os", ".", "MkdirAll"...
// Rsync driver intialization
[ "Rsync", "driver", "intialization" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L71-L82
139,166
control-center/serviced
volume/rsync/rsync.go
runcmd
func runcmd(args ...string) ([]byte, error) { cmd := append([]string{}, args...) glog.V(4).Infof("Executing: %v", cmd) output, err := exec.Command(cmd[0], cmd[1:]...).CombinedOutput() if err != nil { glog.Errorf("unable to run cmd:%s output:%s error:%s", cmd, string(output), err) return output, ErrRsyncDfComm...
go
func runcmd(args ...string) ([]byte, error) { cmd := append([]string{}, args...) glog.V(4).Infof("Executing: %v", cmd) output, err := exec.Command(cmd[0], cmd[1:]...).CombinedOutput() if err != nil { glog.Errorf("unable to run cmd:%s output:%s error:%s", cmd, string(output), err) return output, ErrRsyncDfComm...
[ "func", "runcmd", "(", "args", "...", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cmd", ":=", "append", "(", "[", "]", "string", "{", "}", ",", "args", "...", ")", "\n", "glog", ".", "V", "(", "4", ")", ".", "Infof", "(", ...
// runcmd runs the command
[ "runcmd", "runs", "the", "command" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L150-L159
139,167
control-center/serviced
volume/rsync/rsync.go
parseDFCommand
func parseDFCommand(volname string, bytes []byte) ([]volume.Usage, error) { outString := strings.TrimSpace(string(bytes)) lines := strings.Split(outString, "\n") result := []volume.Usage{} first := true for _, line := range lines { // skip first (header) line if first { first = false continue } field...
go
func parseDFCommand(volname string, bytes []byte) ([]volume.Usage, error) { outString := strings.TrimSpace(string(bytes)) lines := strings.Split(outString, "\n") result := []volume.Usage{} first := true for _, line := range lines { // skip first (header) line if first { first = false continue } field...
[ "func", "parseDFCommand", "(", "volname", "string", ",", "bytes", "[", "]", "byte", ")", "(", "[", "]", "volume", ".", "Usage", ",", "error", ")", "{", "outString", ":=", "strings", ".", "TrimSpace", "(", "string", "(", "bytes", ")", ")", "\n", "line...
// parseDFCommand parses output of df to get volume.Usage information for Status command
[ "parseDFCommand", "parses", "output", "of", "df", "to", "get", "volume", ".", "Usage", "information", "for", "Status", "command" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L166-L188
139,168
control-center/serviced
volume/rsync/rsync.go
Status
func (d *RsyncDriver) Status() (volume.Status, error) { glog.V(2).Info("rsync.Status()") outBytes, err := runcmd("df", "--output=source,size,used,avail", "-B1", d.root) glog.V(2).Infof("Result of running df command: (%q,%q)", outBytes, err) dfResult, err2 := parseDFCommand(d.root, outBytes) if err2 != nil { re...
go
func (d *RsyncDriver) Status() (volume.Status, error) { glog.V(2).Info("rsync.Status()") outBytes, err := runcmd("df", "--output=source,size,used,avail", "-B1", d.root) glog.V(2).Infof("Result of running df command: (%q,%q)", outBytes, err) dfResult, err2 := parseDFCommand(d.root, outBytes) if err2 != nil { re...
[ "func", "(", "d", "*", "RsyncDriver", ")", "Status", "(", ")", "(", "volume", ".", "Status", ",", "error", ")", "{", "glog", ".", "V", "(", "2", ")", ".", "Info", "(", "\"", "\"", ")", "\n\n", "outBytes", ",", "err", ":=", "runcmd", "(", "\"", ...
// Status implements volume.Driver.Status
[ "Status", "implements", "volume", ".", "Driver", ".", "Status" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L201-L219
139,169
control-center/serviced
volume/rsync/rsync.go
ReadMetadata
func (v *RsyncVolume) ReadMetadata(label, name string) (io.ReadCloser, error) { // check the metadata directory first label = v.rawSnapshotLabel(label) filename := filepath.Join(v.driver.MetadataDir(), label, name) return os.Open(filename) }
go
func (v *RsyncVolume) ReadMetadata(label, name string) (io.ReadCloser, error) { // check the metadata directory first label = v.rawSnapshotLabel(label) filename := filepath.Join(v.driver.MetadataDir(), label, name) return os.Open(filename) }
[ "func", "(", "v", "*", "RsyncVolume", ")", "ReadMetadata", "(", "label", ",", "name", "string", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "// check the metadata directory first", "label", "=", "v", ".", "rawSnapshotLabel", "(", "label", ")",...
// ReadMetadata reads the metadata info from a snapshot.
[ "ReadMetadata", "reads", "the", "metadata", "info", "from", "a", "snapshot", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L320-L326
139,170
control-center/serviced
volume/rsync/rsync.go
TagSnapshot
func (v *RsyncVolume) TagSnapshot(label, tagName string) error { v.Lock() defer v.Unlock() // get the snapshot info, err := v.SnapshotInfo(label) if err != nil { glog.Errorf("Could not look up snapshot %s: %s", label, err) return err } // verify the tag doesn't already exist if tagInfo, err := v.getSnapshot...
go
func (v *RsyncVolume) TagSnapshot(label, tagName string) error { v.Lock() defer v.Unlock() // get the snapshot info, err := v.SnapshotInfo(label) if err != nil { glog.Errorf("Could not look up snapshot %s: %s", label, err) return err } // verify the tag doesn't already exist if tagInfo, err := v.getSnapshot...
[ "func", "(", "v", "*", "RsyncVolume", ")", "TagSnapshot", "(", "label", ",", "tagName", "string", ")", "error", "{", "v", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "Unlock", "(", ")", "\n", "// get the snapshot", "info", ",", "err", ":=", "v", ...
// TagSnapshot implements volume.Volume.TagSnapshot
[ "TagSnapshot", "implements", "volume", ".", "Volume", ".", "TagSnapshot" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L490-L516
139,171
control-center/serviced
volume/rsync/rsync.go
UntagSnapshot
func (v *RsyncVolume) UntagSnapshot(tagName string) (string, error) { v.Lock() defer v.Unlock() // find the snapshot with the provided tag info, err := v.getSnapshotWithTag(tagName, false) if err != nil { glog.Errorf("Could not find snapshot with tag %s: %s", tagName, err) return "", err } // remove the tag ...
go
func (v *RsyncVolume) UntagSnapshot(tagName string) (string, error) { v.Lock() defer v.Unlock() // find the snapshot with the provided tag info, err := v.getSnapshotWithTag(tagName, false) if err != nil { glog.Errorf("Could not find snapshot with tag %s: %s", tagName, err) return "", err } // remove the tag ...
[ "func", "(", "v", "*", "RsyncVolume", ")", "UntagSnapshot", "(", "tagName", "string", ")", "(", "string", ",", "error", ")", "{", "v", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "Unlock", "(", ")", "\n", "// find the snapshot with the provided tag", ...
// UntagSnapshot implements volume.Volume.UntagSnapshot
[ "UntagSnapshot", "implements", "volume", ".", "Volume", ".", "UntagSnapshot" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L519-L541
139,172
control-center/serviced
volume/rsync/rsync.go
getSnapshotWithTag
func (v *RsyncVolume) getSnapshotWithTag(tagName string, lock bool) (*volume.SnapshotInfo, error) { // Get all snapshots on the volume var err error var snapshotLabels []string if lock { snapshotLabels, err = v.Snapshots() } else { snapshotLabels, err = v.getSnapshotList() } if err != nil { glog.Errorf("C...
go
func (v *RsyncVolume) getSnapshotWithTag(tagName string, lock bool) (*volume.SnapshotInfo, error) { // Get all snapshots on the volume var err error var snapshotLabels []string if lock { snapshotLabels, err = v.Snapshots() } else { snapshotLabels, err = v.getSnapshotList() } if err != nil { glog.Errorf("C...
[ "func", "(", "v", "*", "RsyncVolume", ")", "getSnapshotWithTag", "(", "tagName", "string", ",", "lock", "bool", ")", "(", "*", "volume", ".", "SnapshotInfo", ",", "error", ")", "{", "// Get all snapshots on the volume", "var", "err", "error", "\n", "var", "s...
// getSnapshotWithTag internal impl without locking calls
[ "getSnapshotWithTag", "internal", "impl", "without", "locking", "calls" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L557-L586
139,173
control-center/serviced
volume/rsync/rsync.go
getSnapshotList
func (v *RsyncVolume) getSnapshotList() ([]string, error) { files, err := ioutil.ReadDir(v.driver.MetadataDir()) if err != nil { return nil, err } var labels []string for _, file := range files { fh, err := os.Stat(v.snapshotPath(file.Name())) if err != nil { glog.Info(err) continue } if file.IsDir...
go
func (v *RsyncVolume) getSnapshotList() ([]string, error) { files, err := ioutil.ReadDir(v.driver.MetadataDir()) if err != nil { return nil, err } var labels []string for _, file := range files { fh, err := os.Stat(v.snapshotPath(file.Name())) if err != nil { glog.Info(err) continue } if file.IsDir...
[ "func", "(", "v", "*", "RsyncVolume", ")", "getSnapshotList", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "files", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "v", ".", "driver", ".", "MetadataDir", "(", ")", ")", "\n", "if", ...
// Internal method for retrieving the snapshot list without obtaining a lock. Assumes caller has already obtained a lock on the volume.
[ "Internal", "method", "for", "retrieving", "the", "snapshot", "list", "without", "obtaining", "a", "lock", ".", "Assumes", "caller", "has", "already", "obtained", "a", "lock", "on", "the", "volume", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/rsync/rsync.go#L589-L607
139,174
control-center/serviced
volume/devicemapper/stats.go
UniqueBlocks
func (d *DeviceBlockStats) UniqueBlocks(other *DeviceBlockStats) uint64 { return d.diet.Total() - d.diet.IntersectionAll(other.diet) }
go
func (d *DeviceBlockStats) UniqueBlocks(other *DeviceBlockStats) uint64 { return d.diet.Total() - d.diet.IntersectionAll(other.diet) }
[ "func", "(", "d", "*", "DeviceBlockStats", ")", "UniqueBlocks", "(", "other", "*", "DeviceBlockStats", ")", "uint64", "{", "return", "d", ".", "diet", ".", "Total", "(", ")", "-", "d", ".", "diet", ".", "IntersectionAll", "(", "other", ".", "diet", ")"...
// UniqueBlocks returns the number of unique blocks that this device has // allocated compared to another device
[ "UniqueBlocks", "returns", "the", "number", "of", "unique", "blocks", "that", "this", "device", "has", "allocated", "compared", "to", "another", "device" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/devicemapper/stats.go#L65-L67
139,175
control-center/serviced
volume/devicemapper/stats.go
reserveMetadataSnap
func (d *DeviceMapperDriver) reserveMetadataSnap(pool string) error { d.DeviceSet.Lock() defer d.DeviceSet.Unlock() cmd := exec.Command("dmsetup", "message", pool, "0", "reserve_metadata_snap") if err := cmd.Run(); err != nil { return err } return nil }
go
func (d *DeviceMapperDriver) reserveMetadataSnap(pool string) error { d.DeviceSet.Lock() defer d.DeviceSet.Unlock() cmd := exec.Command("dmsetup", "message", pool, "0", "reserve_metadata_snap") if err := cmd.Run(); err != nil { return err } return nil }
[ "func", "(", "d", "*", "DeviceMapperDriver", ")", "reserveMetadataSnap", "(", "pool", "string", ")", "error", "{", "d", ".", "DeviceSet", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "DeviceSet", ".", "Unlock", "(", ")", "\n", "cmd", ":=", "exec", ...
// reserveMetadataSnap reserves a userspace snapshot of a thin pool's metadata. // We shell out to send the message to the device-mapper subsystem, but we lock // our internal DeviceSet to avoid any complications with creating or removing // devices simultaneously.
[ "reserveMetadataSnap", "reserves", "a", "userspace", "snapshot", "of", "a", "thin", "pool", "s", "metadata", ".", "We", "shell", "out", "to", "send", "the", "message", "to", "the", "device", "-", "mapper", "subsystem", "but", "we", "lock", "our", "internal",...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/devicemapper/stats.go#L91-L99
139,176
control-center/serviced
volume/devicemapper/stats.go
getDevices
func getDevices(pool, block, metadatadev string) (map[int]*DeviceBlockStats, error) { cmd := exec.Command("thin_dump", "-f", "xml", metadatadev, "-m", block) stdout, err := cmd.StdoutPipe() cmd.Stderr = os.Stderr if err != nil { return nil, err } if err := cmd.Start(); err != nil { return nil, err } devices...
go
func getDevices(pool, block, metadatadev string) (map[int]*DeviceBlockStats, error) { cmd := exec.Command("thin_dump", "-f", "xml", metadatadev, "-m", block) stdout, err := cmd.StdoutPipe() cmd.Stderr = os.Stderr if err != nil { return nil, err } if err := cmd.Start(); err != nil { return nil, err } devices...
[ "func", "getDevices", "(", "pool", ",", "block", ",", "metadatadev", "string", ")", "(", "map", "[", "int", "]", "*", "DeviceBlockStats", ",", "error", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\""...
// getDevices acts on an existing userspace metadata snapshot, and has no // potential devicemapper conflicts. It simply dumps the XML and parses it.
[ "getDevices", "acts", "on", "an", "existing", "userspace", "metadata", "snapshot", "and", "has", "no", "potential", "devicemapper", "conflicts", ".", "It", "simply", "dumps", "the", "XML", "and", "parses", "it", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/devicemapper/stats.go#L117-L135
139,177
control-center/serviced
volume/devicemapper/stats.go
getDeviceSize
func getDeviceSize(dev string) (uint64, error) { cmd := exec.Command("lsblk", "-dbno", "SIZE", dev) out, err := cmd.Output() if err != nil { return 0, err } var size uint64 if size, err = strconv.ParseUint(strings.TrimSpace(string(out)), 10, 64); err != nil { return 0, err } return size, nil }
go
func getDeviceSize(dev string) (uint64, error) { cmd := exec.Command("lsblk", "-dbno", "SIZE", dev) out, err := cmd.Output() if err != nil { return 0, err } var size uint64 if size, err = strconv.ParseUint(strings.TrimSpace(string(out)), 10, 64); err != nil { return 0, err } return size, nil }
[ "func", "getDeviceSize", "(", "dev", "string", ")", "(", "uint64", ",", "error", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "dev", ")", "\n", "out", ",", "err", ":=", "cmd", ".", "Outp...
// getDeviceSize calls lsblk in a subprocess to retrieve the size in bytes of // a given device.
[ "getDeviceSize", "calls", "lsblk", "in", "a", "subprocess", "to", "retrieve", "the", "size", "in", "bytes", "of", "a", "given", "device", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/devicemapper/stats.go#L198-L209
139,178
control-center/serviced
volume/devicemapper/stats.go
getFilesystemStats
func getFilesystemStats(dev string) (uint64, uint64, uint64, error) { totalBlocks, usedBlocks, freeBlocks, err := getMountedFilesystemStats(dev) // Catch the errFilesystemNotMounted and try getUnmountedFilesystemStats if err == errFilesystemNotMounted { totalBlocks, usedBlocks, freeBlocks, err = getUnmountedFilesy...
go
func getFilesystemStats(dev string) (uint64, uint64, uint64, error) { totalBlocks, usedBlocks, freeBlocks, err := getMountedFilesystemStats(dev) // Catch the errFilesystemNotMounted and try getUnmountedFilesystemStats if err == errFilesystemNotMounted { totalBlocks, usedBlocks, freeBlocks, err = getUnmountedFilesy...
[ "func", "getFilesystemStats", "(", "dev", "string", ")", "(", "uint64", ",", "uint64", ",", "uint64", ",", "error", ")", "{", "totalBlocks", ",", "usedBlocks", ",", "freeBlocks", ",", "err", ":=", "getMountedFilesystemStats", "(", "dev", ")", "\n", "// Catch...
// getFilesystemStats calls df to see if the filesystem is mounted and // gets the parsed info for it if it is. // If it is not mounted, it calls getUnmountedFilesystemStats for the info.
[ "getFilesystemStats", "calls", "df", "to", "see", "if", "the", "filesystem", "is", "mounted", "and", "gets", "the", "parsed", "info", "for", "it", "if", "it", "is", ".", "If", "it", "is", "not", "mounted", "it", "calls", "getUnmountedFilesystemStats", "for",...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/devicemapper/stats.go#L227-L239
139,179
control-center/serviced
volume/devicemapper/stats.go
getMountedFilesystemStats
func getMountedFilesystemStats(dev string) (uint64, uint64, uint64, error) { // Specify 1 byte "blocks" for ease cmd := exec.Command("df", "-B 1") defer cmd.Wait() out, err := cmd.StdoutPipe() if err != nil { return 0, 0, 0, err } defer out.Close() if err = cmd.Start(); err != nil { return 0, 0, 0, err } ...
go
func getMountedFilesystemStats(dev string) (uint64, uint64, uint64, error) { // Specify 1 byte "blocks" for ease cmd := exec.Command("df", "-B 1") defer cmd.Wait() out, err := cmd.StdoutPipe() if err != nil { return 0, 0, 0, err } defer out.Close() if err = cmd.Start(); err != nil { return 0, 0, 0, err } ...
[ "func", "getMountedFilesystemStats", "(", "dev", "string", ")", "(", "uint64", ",", "uint64", ",", "uint64", ",", "error", ")", "{", "// Specify 1 byte \"blocks\" for ease", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", ...
// getMountedFilesystemStats calls df to get filesystem stats for a mounted dev
[ "getMountedFilesystemStats", "calls", "df", "to", "get", "filesystem", "stats", "for", "a", "mounted", "dev" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/volume/devicemapper/stats.go#L242-L274
139,180
control-center/serviced
dfs/dfs.go
NewDistributedFilesystem
func NewDistributedFilesystem(docker docker.Docker, index registry.RegistryIndex, reg registry.Registry, disk volume.Driver, net storage.StorageDriver, timeout time.Duration) *DistributedFilesystem { return &DistributedFilesystem{ docker: docker, index: index, reg: reg, disk: disk, net: net, ...
go
func NewDistributedFilesystem(docker docker.Docker, index registry.RegistryIndex, reg registry.Registry, disk volume.Driver, net storage.StorageDriver, timeout time.Duration) *DistributedFilesystem { return &DistributedFilesystem{ docker: docker, index: index, reg: reg, disk: disk, net: net, ...
[ "func", "NewDistributedFilesystem", "(", "docker", "docker", ".", "Docker", ",", "index", "registry", ".", "RegistryIndex", ",", "reg", "registry", ".", "Registry", ",", "disk", "volume", ".", "Driver", ",", "net", "storage", ".", "StorageDriver", ",", "timeou...
// NewDistributedFilesystem instantiates a new DistributedFilsystem object
[ "NewDistributedFilesystem", "instantiates", "a", "new", "DistributedFilsystem", "object" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/dfs/dfs.go#L127-L137
139,181
control-center/serviced
rpc/master/server.go
NewServer
func NewServer(f *facade.Facade, tokenExpiration time.Duration) *Server { return &Server{f, tokenExpiration} }
go
func NewServer(f *facade.Facade, tokenExpiration time.Duration) *Server { return &Server{f, tokenExpiration} }
[ "func", "NewServer", "(", "f", "*", "facade", ".", "Facade", ",", "tokenExpiration", "time", ".", "Duration", ")", "*", "Server", "{", "return", "&", "Server", "{", "f", ",", "tokenExpiration", "}", "\n", "}" ]
// NewServer creates a new serviced master rpc server
[ "NewServer", "creates", "a", "new", "serviced", "master", "rpc", "server" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/server.go#L28-L30
139,182
control-center/serviced
utils/cmd.go
GetExitStatus
func GetExitStatus(err error) (int, bool) { if err != nil { if e, ok := err.(*exec.ExitError); ok { if status, ok := e.Sys().(syscall.WaitStatus); ok { return status.ExitStatus(), true } } return 0, false } return 0, true }
go
func GetExitStatus(err error) (int, bool) { if err != nil { if e, ok := err.(*exec.ExitError); ok { if status, ok := e.Sys().(syscall.WaitStatus); ok { return status.ExitStatus(), true } } return 0, false } return 0, true }
[ "func", "GetExitStatus", "(", "err", "error", ")", "(", "int", ",", "bool", ")", "{", "if", "err", "!=", "nil", "{", "if", "e", ",", "ok", ":=", "err", ".", "(", "*", "exec", ".", "ExitError", ")", ";", "ok", "{", "if", "status", ",", "ok", "...
// GetExitStatus tries to extract the exit code from an error
[ "GetExitStatus", "tries", "to", "extract", "the", "exit", "code", "from", "an", "error" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/cmd.go#L22-L32
139,183
control-center/serviced
commons/circular/buffer.go
writebyte
func (b *Buffer) writebyte(bbyte byte) { b.buffer[b.end] = bbyte b.end = (b.end + 1) % b.size if b.end == b.start { b.start = (b.start + 1) % b.size } }
go
func (b *Buffer) writebyte(bbyte byte) { b.buffer[b.end] = bbyte b.end = (b.end + 1) % b.size if b.end == b.start { b.start = (b.start + 1) % b.size } }
[ "func", "(", "b", "*", "Buffer", ")", "writebyte", "(", "bbyte", "byte", ")", "{", "b", ".", "buffer", "[", "b", ".", "end", "]", "=", "bbyte", "\n", "b", ".", "end", "=", "(", "b", ".", "end", "+", "1", ")", "%", "b", ".", "size", "\n", ...
// writebyte writes bbyte to the buffer
[ "writebyte", "writes", "bbyte", "to", "the", "buffer" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/circular/buffer.go#L64-L70
139,184
control-center/serviced
commons/circular/buffer.go
IsFull
func (b *Buffer) IsFull() bool { return (b.end+1)%b.size == b.start }
go
func (b *Buffer) IsFull() bool { return (b.end+1)%b.size == b.start }
[ "func", "(", "b", "*", "Buffer", ")", "IsFull", "(", ")", "bool", "{", "return", "(", "b", ".", "end", "+", "1", ")", "%", "b", ".", "size", "==", "b", ".", "start", "\n", "}" ]
// IsFull will return true if the buffer is full
[ "IsFull", "will", "return", "true", "if", "the", "buffer", "is", "full" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/commons/circular/buffer.go#L86-L88
139,185
control-center/serviced
utils/cache/simple_lru.go
Get
func (c *SimpleLRUCache) Get(key string) (interface{}, bool) { data, ok := c.lruCache.Get(key) if data != nil && ok { var item cacheItem item, _ = data.(cacheItem) item.expires = timeFunc().Add(c.expiration) // update the expiration c.lruCache.Add(key, item) return item.value, true } return nil, false }
go
func (c *SimpleLRUCache) Get(key string) (interface{}, bool) { data, ok := c.lruCache.Get(key) if data != nil && ok { var item cacheItem item, _ = data.(cacheItem) item.expires = timeFunc().Add(c.expiration) // update the expiration c.lruCache.Add(key, item) return item.value, true } return nil, false }
[ "func", "(", "c", "*", "SimpleLRUCache", ")", "Get", "(", "key", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "data", ",", "ok", ":=", "c", ".", "lruCache", ".", "Get", "(", "key", ")", "\n", "if", "data", "!=", "nil", "&&"...
// Gets the value for key; returns the value and true if found, nil and false otherwise.
[ "Gets", "the", "value", "for", "key", ";", "returns", "the", "value", "and", "true", "if", "found", "nil", "and", "false", "otherwise", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/cache/simple_lru.go#L98-L108
139,186
control-center/serviced
utils/cache/simple_lru.go
Set
func (c *SimpleLRUCache) Set(key string, value interface{}) { item := cacheItem{ key: key, value: value, expires: timeFunc().Add(c.expiration), } c.lruCache.Add(key, item) }
go
func (c *SimpleLRUCache) Set(key string, value interface{}) { item := cacheItem{ key: key, value: value, expires: timeFunc().Add(c.expiration), } c.lruCache.Add(key, item) }
[ "func", "(", "c", "*", "SimpleLRUCache", ")", "Set", "(", "key", "string", ",", "value", "interface", "{", "}", ")", "{", "item", ":=", "cacheItem", "{", "key", ":", "key", ",", "value", ":", "value", ",", "expires", ":", "timeFunc", "(", ")", ".",...
// Add a value to the cache for the specified key. // If the key already exists in the cache, it's value will be replaced.
[ "Add", "a", "value", "to", "the", "cache", "for", "the", "specified", "key", ".", "If", "the", "key", "already", "exists", "in", "the", "cache", "it", "s", "value", "will", "be", "replaced", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/cache/simple_lru.go#L112-L120
139,187
control-center/serviced
cli/cmd/utils.go
isInstanceID
func isInstanceID(serviceID string) bool { slash := strings.LastIndexAny(serviceID, "/") if slash >= 0 && slash < len(serviceID)-1 { if isInstance, _ := regexp.MatchString("^[0-9]+$", serviceID[slash+1:]); isInstance { return true } } return false }
go
func isInstanceID(serviceID string) bool { slash := strings.LastIndexAny(serviceID, "/") if slash >= 0 && slash < len(serviceID)-1 { if isInstance, _ := regexp.MatchString("^[0-9]+$", serviceID[slash+1:]); isInstance { return true } } return false }
[ "func", "isInstanceID", "(", "serviceID", "string", ")", "bool", "{", "slash", ":=", "strings", ".", "LastIndexAny", "(", "serviceID", ",", "\"", "\"", ")", "\n", "if", "slash", ">=", "0", "&&", "slash", "<", "len", "(", "serviceID", ")", "-", "1", "...
// isInstanceID determines whether a service ID specifies an individual instance
[ "isInstanceID", "determines", "whether", "a", "service", "ID", "specifies", "an", "individual", "instance" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/utils.go#L98-L106
139,188
control-center/serviced
domain/common.go
Validate
func (minmax *MinMax) Validate() error { // Instances["min"] and Instances["max"] must be positive if minmax.Min < 0 || minmax.Max < 0 { return fmt.Errorf("Instances constraints must be positive: Min=%v; Max=%v", minmax.Min, minmax.Max) } // If "min" and "max" are both declared Instances["min"] < Instances["max"...
go
func (minmax *MinMax) Validate() error { // Instances["min"] and Instances["max"] must be positive if minmax.Min < 0 || minmax.Max < 0 { return fmt.Errorf("Instances constraints must be positive: Min=%v; Max=%v", minmax.Min, minmax.Max) } // If "min" and "max" are both declared Instances["min"] < Instances["max"...
[ "func", "(", "minmax", "*", "MinMax", ")", "Validate", "(", ")", "error", "{", "// Instances[\"min\"] and Instances[\"max\"] must be positive", "if", "minmax", ".", "Min", "<", "0", "||", "minmax", ".", "Max", "<", "0", "{", "return", "fmt", ".", "Errorf", "...
//Validate ensure that the values in min max are valid. Max >= Min >=0 returns error otherwise
[ "Validate", "ensure", "that", "the", "values", "in", "min", "max", "are", "valid", ".", "Max", ">", "=", "Min", ">", "=", "0", "returns", "error", "otherwise" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/common.go#L43-L67
139,189
control-center/serviced
domain/logfilter/logfilter.go
Equals
func (a *LogFilter) Equals(b *LogFilter) bool { if a.Name != b.Name { return false } if a.Version != b.Version { return false } if a.Filter != b.Filter { return false } return true }
go
func (a *LogFilter) Equals(b *LogFilter) bool { if a.Name != b.Name { return false } if a.Version != b.Version { return false } if a.Filter != b.Filter { return false } return true }
[ "func", "(", "a", "*", "LogFilter", ")", "Equals", "(", "b", "*", "LogFilter", ")", "bool", "{", "if", "a", ".", "Name", "!=", "b", ".", "Name", "{", "return", "false", "\n", "}", "\n", "if", "a", ".", "Version", "!=", "b", ".", "Version", "{",...
// Equals checks the equality of two log filters
[ "Equals", "checks", "the", "equality", "of", "two", "log", "filters" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/domain/logfilter/logfilter.go#L33-L44
139,190
control-center/serviced
web/metrics.go
newOpenFileDescriptorsGraph
func newOpenFileDescriptorsGraph(tags map[string][]string) domain.GraphConfig { return domain.GraphConfig{ DataPoints: []domain.DataPoint{ domain.DataPoint{ ID: "ofd", Aggregator: "avg", Color: "#aec7e8", Fill: false, Format: "%4.2f", Legend: "Service...
go
func newOpenFileDescriptorsGraph(tags map[string][]string) domain.GraphConfig { return domain.GraphConfig{ DataPoints: []domain.DataPoint{ domain.DataPoint{ ID: "ofd", Aggregator: "avg", Color: "#aec7e8", Fill: false, Format: "%4.2f", Legend: "Service...
[ "func", "newOpenFileDescriptorsGraph", "(", "tags", "map", "[", "string", "]", "[", "]", "string", ")", "domain", ".", "GraphConfig", "{", "return", "domain", ".", "GraphConfig", "{", "DataPoints", ":", "[", "]", "domain", ".", "DataPoint", "{", "domain", ...
//Open File Descriptors
[ "Open", "File", "Descriptors" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/web/metrics.go#L170-L202
139,191
control-center/serviced
auth/header.go
WriteTo
func (h *authHeaderWriterTo) WriteTo(w io.Writer) (n int64, err error) { var ( signedContent bytes.Buffer bytesWritten int64 ) // Timestamp ts := jwt.TimeFunc().UTC().Unix() if err = binary.Write(&signedContent, byteOrder, timestamp(ts)); err != nil { return 0, err } // Token len tokenLen := len(h.tok...
go
func (h *authHeaderWriterTo) WriteTo(w io.Writer) (n int64, err error) { var ( signedContent bytes.Buffer bytesWritten int64 ) // Timestamp ts := jwt.TimeFunc().UTC().Unix() if err = binary.Write(&signedContent, byteOrder, timestamp(ts)); err != nil { return 0, err } // Token len tokenLen := len(h.tok...
[ "func", "(", "h", "*", "authHeaderWriterTo", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "var", "(", "signedContent", "bytes", ".", "Buffer", "\n", "bytesWritten", "int64", "\n", ")", "\n\n", ...
// WriteTo satisfies the io.WriterTo interface. It builds an auth header // according to the spec, signs it, and writes it to the specified writer.
[ "WriteTo", "satisfies", "the", "io", ".", "WriterTo", "interface", ".", "It", "builds", "an", "auth", "header", "according", "to", "the", "spec", "signs", "it", "and", "writes", "it", "to", "the", "specified", "writer", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/header.go#L135-L217
139,192
control-center/serviced
auth/header.go
NewAuthHeaderWriterTo
func NewAuthHeaderWriterTo(token, payload []byte, signer Signer) io.WriterTo { return &authHeaderWriterTo{token, payload, signer} }
go
func NewAuthHeaderWriterTo(token, payload []byte, signer Signer) io.WriterTo { return &authHeaderWriterTo{token, payload, signer} }
[ "func", "NewAuthHeaderWriterTo", "(", "token", ",", "payload", "[", "]", "byte", ",", "signer", "Signer", ")", "io", ".", "WriterTo", "{", "return", "&", "authHeaderWriterTo", "{", "token", ",", "payload", ",", "signer", "}", "\n", "}" ]
// NewAuthHeaderWriterTo returns an io.WriterTo that can write an // authentication header with the given parameters to a Writer.
[ "NewAuthHeaderWriterTo", "returns", "an", "io", ".", "WriterTo", "that", "can", "write", "an", "authentication", "header", "with", "the", "given", "parameters", "to", "a", "Writer", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/header.go#L221-L223
139,193
control-center/serviced
auth/header.go
ReadAuthHeader
func ReadAuthHeader(r io.Reader) (sender Identity, timestamp time.Time, payload []byte, err error) { // Read and verify the first three bytes are the magic number var m magicNumber err = binary.Read(r, byteOrder, &m) if err != nil { return } if m != MagicNumber { err = ErrInvalidAuthHeader return } // R...
go
func ReadAuthHeader(r io.Reader) (sender Identity, timestamp time.Time, payload []byte, err error) { // Read and verify the first three bytes are the magic number var m magicNumber err = binary.Read(r, byteOrder, &m) if err != nil { return } if m != MagicNumber { err = ErrInvalidAuthHeader return } // R...
[ "func", "ReadAuthHeader", "(", "r", "io", ".", "Reader", ")", "(", "sender", "Identity", ",", "timestamp", "time", ".", "Time", ",", "payload", "[", "]", "byte", ",", "err", "error", ")", "{", "// Read and verify the first three bytes are the magic number", "var...
// ReadAuthHeader reads an authentication header from the reader given. If // there's a non-EOF error, it will read to the payload and return an // AuthHeaderError with the contents of the payload and the original error. // This allows us to support protocols that require the payload for bookkeeping // purposes, like R...
[ "ReadAuthHeader", "reads", "an", "authentication", "header", "from", "the", "reader", "given", ".", "If", "there", "s", "a", "non", "-", "EOF", "error", "it", "will", "read", "to", "the", "payload", "and", "return", "an", "AuthHeaderError", "with", "the", ...
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/header.go#L230-L258
139,194
control-center/serviced
auth/header.go
readAuthHeaderV1
func readAuthHeaderV1(r io.Reader) (sender Identity, tstamp time.Time, payload []byte, err error) { // Read in the length of everything up to the payload length var allLen uint32 if err = binary.Read(r, byteOrder, &allLen); err != nil { return } // Read the signature var sig = make([]byte, 256) if err = bina...
go
func readAuthHeaderV1(r io.Reader) (sender Identity, tstamp time.Time, payload []byte, err error) { // Read in the length of everything up to the payload length var allLen uint32 if err = binary.Read(r, byteOrder, &allLen); err != nil { return } // Read the signature var sig = make([]byte, 256) if err = bina...
[ "func", "readAuthHeaderV1", "(", "r", "io", ".", "Reader", ")", "(", "sender", "Identity", ",", "tstamp", "time", ".", "Time", ",", "payload", "[", "]", "byte", ",", "err", "error", ")", "{", "// Read in the length of everything up to the payload length", "var",...
// readAuthHeaderV1 implements version 1 of the authentication header protocol.
[ "readAuthHeaderV1", "implements", "version", "1", "of", "the", "authentication", "header", "protocol", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/header.go#L261-L336
139,195
control-center/serviced
auth/header.go
eatBytesAndGetPayloadError
func eatBytesAndGetPayloadError(r io.Reader, n uint32, e error) error { written, err := io.CopyN(ioutil.Discard, r, int64(n)) if err != nil { return ErrReadingBody } if written != int64(n) { return ErrReadingBody } payload, err := ReadLengthAndBytes(r) if err != nil { return err } return &AuthHeaderError...
go
func eatBytesAndGetPayloadError(r io.Reader, n uint32, e error) error { written, err := io.CopyN(ioutil.Discard, r, int64(n)) if err != nil { return ErrReadingBody } if written != int64(n) { return ErrReadingBody } payload, err := ReadLengthAndBytes(r) if err != nil { return err } return &AuthHeaderError...
[ "func", "eatBytesAndGetPayloadError", "(", "r", "io", ".", "Reader", ",", "n", "uint32", ",", "e", "error", ")", "error", "{", "written", ",", "err", ":=", "io", ".", "CopyN", "(", "ioutil", ".", "Discard", ",", "r", ",", "int64", "(", "n", ")", ")...
// eatBytesAndGetPayloadError fast-forwards the reader to the payload, reads // off the payload, and wraps the provided error with the payload in an // AuthHeaderError.
[ "eatBytesAndGetPayloadError", "fast", "-", "forwards", "the", "reader", "to", "the", "payload", "reads", "off", "the", "payload", "and", "wraps", "the", "provided", "error", "with", "the", "payload", "in", "an", "AuthHeaderError", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/auth/header.go#L341-L354
139,196
control-center/serviced
node/agent_proxy.go
ReportHealthStatus
func (a *HostAgent) ReportHealthStatus(req master.HealthStatusRequest, unused *int) error { masterClient, err := master.NewClient(a.master) if err != nil { glog.Errorf("Could not start Control Center client: %s", err) return err } defer masterClient.Close() return masterClient.ReportHealthStatus(req.Key, req.V...
go
func (a *HostAgent) ReportHealthStatus(req master.HealthStatusRequest, unused *int) error { masterClient, err := master.NewClient(a.master) if err != nil { glog.Errorf("Could not start Control Center client: %s", err) return err } defer masterClient.Close() return masterClient.ReportHealthStatus(req.Key, req.V...
[ "func", "(", "a", "*", "HostAgent", ")", "ReportHealthStatus", "(", "req", "master", ".", "HealthStatusRequest", ",", "unused", "*", "int", ")", "error", "{", "masterClient", ",", "err", ":=", "master", ".", "NewClient", "(", "a", ".", "master", ")", "\n...
// ReportHealthStatus proxies ReportHealthStatus to the master server.
[ "ReportHealthStatus", "proxies", "ReportHealthStatus", "to", "the", "master", "server", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L105-L113
139,197
control-center/serviced
node/agent_proxy.go
ReportInstanceDead
func (a *HostAgent) ReportInstanceDead(req master.ServiceInstanceRequest, unused *int) error { masterClient, err := master.NewClient(a.master) if err != nil { glog.Errorf("Could not start Control Center client; %s", err) return err } defer masterClient.Close() return masterClient.ReportInstanceDead(req.Service...
go
func (a *HostAgent) ReportInstanceDead(req master.ServiceInstanceRequest, unused *int) error { masterClient, err := master.NewClient(a.master) if err != nil { glog.Errorf("Could not start Control Center client; %s", err) return err } defer masterClient.Close() return masterClient.ReportInstanceDead(req.Service...
[ "func", "(", "a", "*", "HostAgent", ")", "ReportInstanceDead", "(", "req", "master", ".", "ServiceInstanceRequest", ",", "unused", "*", "int", ")", "error", "{", "masterClient", ",", "err", ":=", "master", ".", "NewClient", "(", "a", ".", "master", ")", ...
// ReportInstanceDead proxies ReportInstanceDead to the master server.
[ "ReportInstanceDead", "proxies", "ReportInstanceDead", "to", "the", "master", "server", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L116-L124
139,198
control-center/serviced
node/agent_proxy.go
addControlPlaneEndpoint
func (a *HostAgent) addControlPlaneEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { key := "tcp" + a.uiport endpoint := applicationendpoint.ApplicationEndpoint{} endpoint.ServiceID = "controlplane" endpoint.Application = "controlplane" hoststr := strings.Split(a.uiport, ":")[0] if len(ho...
go
func (a *HostAgent) addControlPlaneEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { key := "tcp" + a.uiport endpoint := applicationendpoint.ApplicationEndpoint{} endpoint.ServiceID = "controlplane" endpoint.Application = "controlplane" hoststr := strings.Split(a.uiport, ":")[0] if len(ho...
[ "func", "(", "a", "*", "HostAgent", ")", "addControlPlaneEndpoint", "(", "endpoints", "map", "[", "string", "]", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", ")", "{", "key", ":=", "\"", "\"", "+", "a", ".", "uiport", "\n", "endpoint", ":="...
// addControlPlaneEndpoint adds an application endpoint mapping for the master control center api
[ "addControlPlaneEndpoint", "adds", "an", "application", "endpoint", "mapping", "for", "the", "master", "control", "center", "api" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L127-L153
139,199
control-center/serviced
node/agent_proxy.go
addControlPlaneConsumerEndpoint
func (a *HostAgent) addControlPlaneConsumerEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { key := "tcp:8444" endpoint := applicationendpoint.ApplicationEndpoint{} endpoint.ServiceID = "controlplane_consumer" endpoint.Application = "controlplane_consumer" endpoint.ContainerIP = "127.0.0.1...
go
func (a *HostAgent) addControlPlaneConsumerEndpoint(endpoints map[string][]applicationendpoint.ApplicationEndpoint) { key := "tcp:8444" endpoint := applicationendpoint.ApplicationEndpoint{} endpoint.ServiceID = "controlplane_consumer" endpoint.Application = "controlplane_consumer" endpoint.ContainerIP = "127.0.0.1...
[ "func", "(", "a", "*", "HostAgent", ")", "addControlPlaneConsumerEndpoint", "(", "endpoints", "map", "[", "string", "]", "[", "]", "applicationendpoint", ".", "ApplicationEndpoint", ")", "{", "key", ":=", "\"", "\"", "\n", "endpoint", ":=", "applicationendpoint"...
// addControlPlaneConsumerEndpoint adds an application endpoint mapping for the master control center api
[ "addControlPlaneConsumerEndpoint", "adds", "an", "application", "endpoint", "mapping", "for", "the", "master", "control", "center", "api" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/agent_proxy.go#L156-L168