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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
153,800
juju/juju
utils/stringforwarder/stringforwarder.go
invokeCallback
func (f *StringForwarder) invokeCallback(callback func(string), msg string) { f.mu.Unlock() defer f.mu.Lock() callback(msg) }
go
func (f *StringForwarder) invokeCallback(callback func(string), msg string) { f.mu.Unlock() defer f.mu.Lock() callback(msg) }
[ "func", "(", "f", "*", "StringForwarder", ")", "invokeCallback", "(", "callback", "func", "(", "string", ")", ",", "msg", "string", ")", "{", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "ca...
// invokeCallback invokes the given callback with a message, // unlocking the forwarder's mutex for the duration of the // callback.
[ "invokeCallback", "invokes", "the", "given", "callback", "with", "a", "message", "unlocking", "the", "forwarder", "s", "mutex", "for", "the", "duration", "of", "the", "callback", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/utils/stringforwarder/stringforwarder.go#L89-L93
153,801
juju/juju
worker/uniter/runner/jujuc/credential-get.go
NewCredentialGetCommand
func NewCredentialGetCommand(ctx Context) (cmd.Command, error) { return &CredentialGetCommand{ctx: ctx}, nil }
go
func NewCredentialGetCommand(ctx Context) (cmd.Command, error) { return &CredentialGetCommand{ctx: ctx}, nil }
[ "func", "NewCredentialGetCommand", "(", "ctx", "Context", ")", "(", "cmd", ".", "Command", ",", "error", ")", "{", "return", "&", "CredentialGetCommand", "{", "ctx", ":", "ctx", "}", ",", "nil", "\n", "}" ]
// NewCredentialGetCommand returns a new CredentialGetCommand with the given context.
[ "NewCredentialGetCommand", "returns", "a", "new", "CredentialGetCommand", "with", "the", "given", "context", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/credential-get.go#L22-L24
153,802
juju/juju
service/snap/snap.go
Validate
func (backgroundService *BackgroundService) Validate() error { name := backgroundService.Name if name == "" { return errors.NotValidf("backgroundService.Name must be non-empty -") } if !snapNameRe.MatchString(name) { return errors.NotValidf("backgroundService.Name (%s) fails validation check -", name) } ret...
go
func (backgroundService *BackgroundService) Validate() error { name := backgroundService.Name if name == "" { return errors.NotValidf("backgroundService.Name must be non-empty -") } if !snapNameRe.MatchString(name) { return errors.NotValidf("backgroundService.Name (%s) fails validation check -", name) } ret...
[ "func", "(", "backgroundService", "*", "BackgroundService", ")", "Validate", "(", ")", "error", "{", "name", ":=", "backgroundService", ".", "Name", "\n", "if", "name", "==", "\"", "\"", "{", "return", "errors", ".", "NotValidf", "(", "\"", "\"", ")", "\...
// Validate checks that the construction parameters of // backgroundService are valid. Successful validation // returns nil.
[ "Validate", "checks", "that", "the", "construction", "parameters", "of", "backgroundService", "are", "valid", ".", "Successful", "validation", "returns", "nil", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L53-L64
153,803
juju/juju
service/snap/snap.go
SetSnapConfig
func SetSnapConfig(snap string, key string, value string) error { if key == "" { return errors.NotValidf("key must not be empty") } cmd := exec.Command(Command, "set", snap, fmt.Sprintf("%s=%s", key, value)) _, err := cmd.Output() if err != nil { return errors.Annotate(err, fmt.Sprintf("setting snap %s config...
go
func SetSnapConfig(snap string, key string, value string) error { if key == "" { return errors.NotValidf("key must not be empty") } cmd := exec.Command(Command, "set", snap, fmt.Sprintf("%s=%s", key, value)) _, err := cmd.Output() if err != nil { return errors.Annotate(err, fmt.Sprintf("setting snap %s config...
[ "func", "SetSnapConfig", "(", "snap", "string", ",", "key", "string", ",", "value", "string", ")", "error", "{", "if", "key", "==", "\"", "\"", "{", "return", "errors", ".", "NotValidf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cmd", ":=", "exec", ...
// SetSnapConfig sets a snap's key to value.
[ "SetSnapConfig", "sets", "a", "snap", "s", "key", "to", "value", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L151-L163
153,804
juju/juju
service/snap/snap.go
ListServices
func ListServices() ([]string, error) { fullCommand := strings.Fields(ListCommand()) services, err := utils.RunCommand(fullCommand[0], fullCommand[1:]...) if err != nil { return []string{}, errors.Trace(err) } return strings.Split(services, "\n"), nil }
go
func ListServices() ([]string, error) { fullCommand := strings.Fields(ListCommand()) services, err := utils.RunCommand(fullCommand[0], fullCommand[1:]...) if err != nil { return []string{}, errors.Trace(err) } return strings.Split(services, "\n"), nil }
[ "func", "ListServices", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "fullCommand", ":=", "strings", ".", "Fields", "(", "ListCommand", "(", ")", ")", "\n", "services", ",", "err", ":=", "utils", ".", "RunCommand", "(", "fullCommand", "["...
// ListServices returns a list of services that are being managed by snap.
[ "ListServices", "returns", "a", "list", "of", "services", "that", "are", "being", "managed", "by", "snap", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L173-L180
153,805
juju/juju
service/snap/snap.go
Validate
func (s Service) Validate() error { var validationErrors = []error{} err := s.app.Validate() if err != nil { validationErrors = append(validationErrors, err) } for _, prerequisite := range s.app.Prerequisites { err = prerequisite.Validate() if err != nil { validationErrors = append(validationErrors, err...
go
func (s Service) Validate() error { var validationErrors = []error{} err := s.app.Validate() if err != nil { validationErrors = append(validationErrors, err) } for _, prerequisite := range s.app.Prerequisites { err = prerequisite.Validate() if err != nil { validationErrors = append(validationErrors, err...
[ "func", "(", "s", "Service", ")", "Validate", "(", ")", "error", "{", "var", "validationErrors", "=", "[", "]", "error", "{", "}", "\n\n", "err", ":=", "s", ".", "app", ".", "Validate", "(", ")", "\n", "if", "err", "!=", "nil", "{", "validationErro...
// Validate validates that snap.Service has been correctly configured. // Validate returns nil when successful and an error when successful.
[ "Validate", "validates", "that", "snap", ".", "Service", "has", "been", "correctly", "configured", ".", "Validate", "returns", "nil", "when", "successful", "and", "an", "error", "when", "successful", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L255-L275
153,806
juju/juju
service/snap/snap.go
Install
func (s Service) Install() error { commands, err := s.InstallCommands() if err != nil { return errors.Trace(err) } for _, cmd := range commands { if cmd == "" { continue } logger.Infof("command: %v", cmd) cmdParts := strings.Fields(cmd) executable := cmdParts[0] args := cmdParts[1:] out, err := u...
go
func (s Service) Install() error { commands, err := s.InstallCommands() if err != nil { return errors.Trace(err) } for _, cmd := range commands { if cmd == "" { continue } logger.Infof("command: %v", cmd) cmdParts := strings.Fields(cmd) executable := cmdParts[0] args := cmdParts[1:] out, err := u...
[ "func", "(", "s", "Service", ")", "Install", "(", ")", "error", "{", "commands", ",", "err", ":=", "s", ".", "InstallCommands", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Trace", "(", "err", ")", "\n", "}", "\n", "fo...
// Install installs the snap and its background services. // // Install is part of the service.Service interface.
[ "Install", "installs", "the", "snap", "and", "its", "background", "services", ".", "Install", "is", "part", "of", "the", "service", ".", "Service", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L316-L336
153,807
juju/juju
service/snap/snap.go
Installed
func (s Service) Installed() (bool, error) { installed, _, _, err := s.status() if err != nil { return false, errors.Trace(err) } return installed, nil }
go
func (s Service) Installed() (bool, error) { installed, _, _, err := s.status() if err != nil { return false, errors.Trace(err) } return installed, nil }
[ "func", "(", "s", "Service", ")", "Installed", "(", ")", "(", "bool", ",", "error", ")", "{", "installed", ",", "_", ",", "_", ",", "err", ":=", "s", ".", "status", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "errors"...
// Installed returns true if the service has been successfully installed. // // Installed is part of the service.Service interface.
[ "Installed", "returns", "true", "if", "the", "service", "has", "been", "successfully", "installed", ".", "Installed", "is", "part", "of", "the", "service", ".", "Service", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L341-L347
153,808
juju/juju
service/snap/snap.go
InstallCommands
func (s Service) InstallCommands() ([]string, error) { commands := make([]string, 0, 1+len(s.app.Prerequisites)) confinementPolicy := confimentParameterAsString(s.app.ConfinementPolicy) for _, prerequisite := range s.app.Prerequisites { command := fmt.Sprintf("%v install --channel=%v %v %v", s.executable, p...
go
func (s Service) InstallCommands() ([]string, error) { commands := make([]string, 0, 1+len(s.app.Prerequisites)) confinementPolicy := confimentParameterAsString(s.app.ConfinementPolicy) for _, prerequisite := range s.app.Prerequisites { command := fmt.Sprintf("%v install --channel=%v %v %v", s.executable, p...
[ "func", "(", "s", "Service", ")", "InstallCommands", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "commands", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "1", "+", "len", "(", "s", ".", "app", ".", "Prerequisites", ")", ...
// InstallCommands returns a slice of shell commands that is // executed independently, in serial, by a shell. When the // final command returns with a 0 exit code, the installation // will be deemed to have been successful. // // InstallCommands is part of the service.Service interface
[ "InstallCommands", "returns", "a", "slice", "of", "shell", "commands", "that", "is", "executed", "independently", "in", "serial", "by", "a", "shell", ".", "When", "the", "final", "command", "returns", "with", "a", "0", "exit", "code", "the", "installation", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L355-L379
153,809
juju/juju
service/snap/snap.go
StartCommands
func (s Service) StartCommands() ([]string, error) { commands := make([]string, 0, 1+len(s.app.Prerequisites)) for _, prerequisite := range s.app.Prerequisites { commands = append(commands, prerequisite.StartCommands(s.executable)...) } commands = append(commands, s.app.StartCommands(s.executable)...) return com...
go
func (s Service) StartCommands() ([]string, error) { commands := make([]string, 0, 1+len(s.app.Prerequisites)) for _, prerequisite := range s.app.Prerequisites { commands = append(commands, prerequisite.StartCommands(s.executable)...) } commands = append(commands, s.app.StartCommands(s.executable)...) return com...
[ "func", "(", "s", "Service", ")", "StartCommands", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "commands", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "1", "+", "len", "(", "s", ".", "app", ".", "Prerequisites", ")", ")...
// StartCommands returns a slice of strings. that are // shell commands to be executed by a shell which start the service.
[ "StartCommands", "returns", "a", "slice", "of", "strings", ".", "that", "are", "shell", "commands", "to", "be", "executed", "by", "a", "shell", "which", "start", "the", "service", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L390-L397
153,810
juju/juju
service/snap/snap.go
Start
func (s Service) Start() error { running, err := s.Running() if err != nil { return errors.Trace(err) } if running { return nil } commands, err := s.StartCommands() if err != nil { return errors.Trace(err) } for _, command := range commands { commandParts := strings.Fields(command) out, err := utils...
go
func (s Service) Start() error { running, err := s.Running() if err != nil { return errors.Trace(err) } if running { return nil } commands, err := s.StartCommands() if err != nil { return errors.Trace(err) } for _, command := range commands { commandParts := strings.Fields(command) out, err := utils...
[ "func", "(", "s", "Service", ")", "Start", "(", ")", "error", "{", "running", ",", "err", ":=", "s", ".", "Running", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Trace", "(", "err", ")", "\n", "}", "\n", "if", "runni...
// Start starts the service, returning nil when successful. // If the service is already running, Start does not restart it. // // Start is part of the service.ServiceActions interface
[ "Start", "starts", "the", "service", "returning", "nil", "when", "successful", ".", "If", "the", "service", "is", "already", "running", "Start", "does", "not", "restart", "it", ".", "Start", "is", "part", "of", "the", "service", ".", "ServiceActions", "inter...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L429-L454
153,811
juju/juju
service/snap/snap.go
Restart
func (s *Service) Restart() error { args := []string{"restart", s.Name()} return s.execThenExpect(args, "Restarted.") }
go
func (s *Service) Restart() error { args := []string{"restart", s.Name()} return s.execThenExpect(args, "Restarted.") }
[ "func", "(", "s", "*", "Service", ")", "Restart", "(", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "s", ".", "Name", "(", ")", "}", "\n", "return", "s", ".", "execThenExpect", "(", "args", ",", "\"", "\"", ")", ...
// Restart restarts the service, or starts if it's not currently // running. // // Restart is part of the service.RestartableService interface
[ "Restart", "restarts", "the", "service", "or", "starts", "if", "it", "s", "not", "currently", "running", ".", "Restart", "is", "part", "of", "the", "service", ".", "RestartableService", "interface" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/snap/snap.go#L491-L494
153,812
juju/juju
worker/lease/manager.go
NewDeadManager
func NewDeadManager(err error) *Manager { var secretary dummySecretary m := Manager{ config: ManagerConfig{ Secretary: func(_ string) (Secretary, error) { return secretary, nil }, }, } _ = catacomb.Invoke(catacomb.Plan{ Site: &m.catacomb, Work: func() error { return errors.Trace(err) }, }) ...
go
func NewDeadManager(err error) *Manager { var secretary dummySecretary m := Manager{ config: ManagerConfig{ Secretary: func(_ string) (Secretary, error) { return secretary, nil }, }, } _ = catacomb.Invoke(catacomb.Plan{ Site: &m.catacomb, Work: func() error { return errors.Trace(err) }, }) ...
[ "func", "NewDeadManager", "(", "err", "error", ")", "*", "Manager", "{", "var", "secretary", "dummySecretary", "\n", "m", ":=", "Manager", "{", "config", ":", "ManagerConfig", "{", "Secretary", ":", "func", "(", "_", "string", ")", "(", "Secretary", ",", ...
// NewDeadManager returns a manager that's already dead // and always returns the given error.
[ "NewDeadManager", "returns", "a", "manager", "that", "s", "already", "dead", "and", "always", "returns", "the", "given", "error", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L48-L64
153,813
juju/juju
worker/lease/manager.go
loop
func (manager *Manager) loop() error { if collector, ok := manager.config.Store.(prometheus.Collector); ok && manager.config.PrometheusRegisterer != nil { // The store implements the collector interface, but the lease.Store // does not expose those. _ = manager.config.PrometheusRegisterer.Register(collector) d...
go
func (manager *Manager) loop() error { if collector, ok := manager.config.Store.(prometheus.Collector); ok && manager.config.PrometheusRegisterer != nil { // The store implements the collector interface, but the lease.Store // does not expose those. _ = manager.config.PrometheusRegisterer.Register(collector) d...
[ "func", "(", "manager", "*", "Manager", ")", "loop", "(", ")", "error", "{", "if", "collector", ",", "ok", ":=", "manager", ".", "config", ".", "Store", ".", "(", "prometheus", ".", "Collector", ")", ";", "ok", "&&", "manager", ".", "config", ".", ...
// loop runs until the manager is stopped.
[ "loop", "runs", "until", "the", "manager", "is", "stopped", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L153-L170
153,814
juju/juju
worker/lease/manager.go
choose
func (manager *Manager) choose(blocks blocks) error { select { case <-manager.catacomb.Dying(): return manager.catacomb.ErrDying() case check := <-manager.checks: return manager.handleCheck(check) case now := <-manager.timer.Chan(): manager.tick(now, blocks) case <-manager.expireDone: manager.checkBlocks(b...
go
func (manager *Manager) choose(blocks blocks) error { select { case <-manager.catacomb.Dying(): return manager.catacomb.ErrDying() case check := <-manager.checks: return manager.handleCheck(check) case now := <-manager.timer.Chan(): manager.tick(now, blocks) case <-manager.expireDone: manager.checkBlocks(b...
[ "func", "(", "manager", "*", "Manager", ")", "choose", "(", "blocks", "blocks", ")", "error", "{", "select", "{", "case", "<-", "manager", ".", "catacomb", ".", "Dying", "(", ")", ":", "return", "manager", ".", "catacomb", ".", "ErrDying", "(", ")", ...
// choose breaks the select out of loop to make the blocking logic clearer.
[ "choose", "breaks", "the", "select", "out", "of", "loop", "to", "make", "the", "blocking", "logic", "clearer", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L178-L206
153,815
juju/juju
worker/lease/manager.go
Checker
func (manager *Manager) Checker(namespace, modelUUID string) (lease.Checker, error) { return manager.bind(namespace, modelUUID) }
go
func (manager *Manager) Checker(namespace, modelUUID string) (lease.Checker, error) { return manager.bind(namespace, modelUUID) }
[ "func", "(", "manager", "*", "Manager", ")", "Checker", "(", "namespace", ",", "modelUUID", "string", ")", "(", "lease", ".", "Checker", ",", "error", ")", "{", "return", "manager", ".", "bind", "(", "namespace", ",", "modelUUID", ")", "\n", "}" ]
// Checker returns a lease.Checker for the specified namespace and model.
[ "Checker", "returns", "a", "lease", ".", "Checker", "for", "the", "specified", "namespace", "and", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L222-L224
153,816
juju/juju
worker/lease/manager.go
retryingClaim
func (manager *Manager) retryingClaim(claim claim) { defer manager.wg.Done() var ( err error success bool ) for a := manager.startRetry(); a.Next(); { success, err = manager.handleClaim(claim) if !lease.IsTimeout(err) && !lease.IsInvalid(err) { break } if a.More() { if lease.IsInvalid(err) { ...
go
func (manager *Manager) retryingClaim(claim claim) { defer manager.wg.Done() var ( err error success bool ) for a := manager.startRetry(); a.Next(); { success, err = manager.handleClaim(claim) if !lease.IsTimeout(err) && !lease.IsInvalid(err) { break } if a.More() { if lease.IsInvalid(err) { ...
[ "func", "(", "manager", "*", "Manager", ")", "retryingClaim", "(", "claim", "claim", ")", "{", "defer", "manager", ".", "wg", ".", "Done", "(", ")", "\n", "var", "(", "err", "error", "\n", "success", "bool", "\n", ")", "\n", "for", "a", ":=", "mana...
// retryingClaim handles timeouts when claiming, and responds to the // claiming party when it eventually succeeds or fails, or if it times // out after a number of retries.
[ "retryingClaim", "handles", "timeouts", "when", "claiming", "and", "responds", "to", "the", "claiming", "party", "when", "it", "eventually", "succeeds", "or", "fails", "or", "if", "it", "times", "out", "after", "a", "number", "of", "retries", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L244-L295
153,817
juju/juju
worker/lease/manager.go
handleCheck
func (manager *Manager) handleCheck(check check) error { key := check.leaseKey store := manager.config.Store manager.config.Logger.Tracef("[%s] handling Check for lease %s on behalf of %s", manager.logContext, key.Lease, check.holderName) info, found := manager.lookupLease(key) if !found || info.Holder != check...
go
func (manager *Manager) handleCheck(check check) error { key := check.leaseKey store := manager.config.Store manager.config.Logger.Tracef("[%s] handling Check for lease %s on behalf of %s", manager.logContext, key.Lease, check.holderName) info, found := manager.lookupLease(key) if !found || info.Holder != check...
[ "func", "(", "manager", "*", "Manager", ")", "handleCheck", "(", "check", "check", ")", "error", "{", "key", ":=", "check", ".", "leaseKey", "\n", "store", ":=", "manager", ".", "config", ".", "Store", "\n", "manager", ".", "config", ".", "Logger", "."...
// handleCheck processes and responds to the supplied check. It will only return // unrecoverable errors; mere untruth of the assertion just indicates a bad // request, and is communicated back to the check's originator.
[ "handleCheck", "processes", "and", "responds", "to", "the", "supplied", "check", ".", "It", "will", "only", "return", "unrecoverable", "errors", ";", "mere", "untruth", "of", "the", "assertion", "just", "indicates", "a", "bad", "request", "and", "is", "communi...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L344-L385
153,818
juju/juju
worker/lease/manager.go
tick
func (manager *Manager) tick(now time.Time, blocks blocks) { manager.config.Logger.Tracef("[%s] tick at %v, running expiry checks\n", manager.logContext, now) // If we need to expire leases we should do it, otherwise this // is just an opportunity to check for blocks that need to be // notified. if !manager.config...
go
func (manager *Manager) tick(now time.Time, blocks blocks) { manager.config.Logger.Tracef("[%s] tick at %v, running expiry checks\n", manager.logContext, now) // If we need to expire leases we should do it, otherwise this // is just an opportunity to check for blocks that need to be // notified. if !manager.config...
[ "func", "(", "manager", "*", "Manager", ")", "tick", "(", "now", "time", ".", "Time", ",", "blocks", "blocks", ")", "{", "manager", ".", "config", ".", "Logger", ".", "Tracef", "(", "\"", "\\n", "\"", ",", "manager", ".", "logContext", ",", "now", ...
// tick triggers when we think a lease might be expiring, so we check if there // are leases to expire, and then unblock anything that is no longer blocked, // and then compute the next time we should wake up.
[ "tick", "triggers", "when", "we", "think", "a", "lease", "might", "be", "expiring", "so", "we", "check", "if", "there", "are", "leases", "to", "expire", "and", "then", "unblock", "anything", "that", "is", "no", "longer", "blocked", "and", "then", "compute"...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L390-L402
153,819
juju/juju
worker/lease/manager.go
computeNextTimeout
func (manager *Manager) computeNextTimeout(lastTick time.Time, leases map[lease.Key]lease.Info) { now := manager.config.Clock.Now() nextTick := now.Add(manager.config.MaxSleep) for _, info := range leases { if !info.Expiry.After(lastTick) { // The previous expire will expire this lease eventually, or // the ...
go
func (manager *Manager) computeNextTimeout(lastTick time.Time, leases map[lease.Key]lease.Info) { now := manager.config.Clock.Now() nextTick := now.Add(manager.config.MaxSleep) for _, info := range leases { if !info.Expiry.After(lastTick) { // The previous expire will expire this lease eventually, or // the ...
[ "func", "(", "manager", "*", "Manager", ")", "computeNextTimeout", "(", "lastTick", "time", ".", "Time", ",", "leases", "map", "[", "lease", ".", "Key", "]", "lease", ".", "Info", ")", "{", "now", ":=", "manager", ".", "config", ".", "Clock", ".", "N...
// computeNextTimeout iterates the leases and finds out what the next time we // want to wake up, expire any leases and then handle any unblocks that happen. // It is based on the MaxSleep time, and on any expire that is going to expire // after now but before MaxSleep. // it's worth checking for stalled collaborators.
[ "computeNextTimeout", "iterates", "the", "leases", "and", "finds", "out", "what", "the", "next", "time", "we", "want", "to", "wake", "up", "expire", "any", "leases", "and", "then", "handle", "any", "unblocks", "that", "happen", ".", "It", "is", "based", "o...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L422-L441
153,820
juju/juju
worker/lease/manager.go
ensureNextTimeout
func (manager *Manager) ensureNextTimeout(d time.Duration) { manager.muNextTimeout.Lock() next := manager.nextTimeout proposed := manager.config.Clock.Now().Add(d) if next.After(proposed) { manager.config.Logger.Tracef("[%s] ensuring we wake up before %v at %v\n", manager.logContext, d, proposed) manager.nex...
go
func (manager *Manager) ensureNextTimeout(d time.Duration) { manager.muNextTimeout.Lock() next := manager.nextTimeout proposed := manager.config.Clock.Now().Add(d) if next.After(proposed) { manager.config.Logger.Tracef("[%s] ensuring we wake up before %v at %v\n", manager.logContext, d, proposed) manager.nex...
[ "func", "(", "manager", "*", "Manager", ")", "ensureNextTimeout", "(", "d", "time", ".", "Duration", ")", "{", "manager", ".", "muNextTimeout", ".", "Lock", "(", ")", "\n", "next", ":=", "manager", ".", "nextTimeout", "\n", "proposed", ":=", "manager", "...
// ensureNextTimeout makes sure that the next timeout happens no-later than // duration from now.
[ "ensureNextTimeout", "makes", "sure", "that", "the", "next", "timeout", "happens", "no", "-", "later", "than", "duration", "from", "now", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L473-L484
153,821
juju/juju
worker/lease/manager.go
retryingExpire
func (manager *Manager) retryingExpire(now time.Time) { manager.config.Logger.Tracef("[%s] expire looking for leases to expire\n", manager.logContext) defer manager.wg.Done() var err error for a := manager.startRetry(); a.Next(); { err = manager.expire(now) if !lease.IsTimeout(err) { break } if a.More() ...
go
func (manager *Manager) retryingExpire(now time.Time) { manager.config.Logger.Tracef("[%s] expire looking for leases to expire\n", manager.logContext) defer manager.wg.Done() var err error for a := manager.startRetry(); a.Next(); { err = manager.expire(now) if !lease.IsTimeout(err) { break } if a.More() ...
[ "func", "(", "manager", "*", "Manager", ")", "retryingExpire", "(", "now", "time", ".", "Time", ")", "{", "manager", ".", "config", ".", "Logger", ".", "Tracef", "(", "\"", "\\n", "\"", ",", "manager", ".", "logContext", ")", "\n", "defer", "manager", ...
// retryingExpire runs expire and retries any timeouts.
[ "retryingExpire", "runs", "expire", "and", "retries", "any", "timeouts", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/lease/manager.go#L487-L524
153,822
juju/juju
state/relationnetworks.go
Save
func (rin *relationNetworksState) Save(relationKey string, adminOverride bool, cidrs []string) (RelationNetworks, error) { logger.Debugf("save %v networks for %v: %v", rin.direction, relationKey, cidrs) for _, cidr := range cidrs { if _, _, err := net.ParseCIDR(cidr); err != nil { return nil, errors.NotValidf("C...
go
func (rin *relationNetworksState) Save(relationKey string, adminOverride bool, cidrs []string) (RelationNetworks, error) { logger.Debugf("save %v networks for %v: %v", rin.direction, relationKey, cidrs) for _, cidr := range cidrs { if _, _, err := net.ParseCIDR(cidr); err != nil { return nil, errors.NotValidf("C...
[ "func", "(", "rin", "*", "relationNetworksState", ")", "Save", "(", "relationKey", "string", ",", "adminOverride", "bool", ",", "cidrs", "[", "]", "string", ")", "(", "RelationNetworks", ",", "error", ")", "{", "logger", ".", "Debugf", "(", "\"", "\"", "...
// Save stores the specified networks for the relation.
[ "Save", "stores", "the", "specified", "networks", "for", "the", "relation", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relationnetworks.go#L96-L163
153,823
juju/juju
state/relationnetworks.go
Networks
func (rin *relationNetworksState) Networks(relationKey string) (RelationNetworks, error) { coll, closer := rin.st.db().GetCollection(relationNetworksC) defer closer() var doc relationNetworksDoc err := coll.FindId(relationNetworkDocID(relationKey, rin.direction, relationNetworkAdmin)).One(&doc) if err == mgo.ErrN...
go
func (rin *relationNetworksState) Networks(relationKey string) (RelationNetworks, error) { coll, closer := rin.st.db().GetCollection(relationNetworksC) defer closer() var doc relationNetworksDoc err := coll.FindId(relationNetworkDocID(relationKey, rin.direction, relationNetworkAdmin)).One(&doc) if err == mgo.ErrN...
[ "func", "(", "rin", "*", "relationNetworksState", ")", "Networks", "(", "relationKey", "string", ")", "(", "RelationNetworks", ",", "error", ")", "{", "coll", ",", "closer", ":=", "rin", ".", "st", ".", "db", "(", ")", ".", "GetCollection", "(", "relatio...
// Networks returns the networks for the specified relation.
[ "Networks", "returns", "the", "networks", "for", "the", "specified", "relation", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relationnetworks.go#L166-L185
153,824
juju/juju
provider/maas/maas2instance.go
OpenPorts
func (mi *maas2Instance) OpenPorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error { logger.Debugf("unimplemented OpenPorts() called") return nil }
go
func (mi *maas2Instance) OpenPorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error { logger.Debugf("unimplemented OpenPorts() called") return nil }
[ "func", "(", "mi", "*", "maas2Instance", ")", "OpenPorts", "(", "ctx", "context", ".", "ProviderCallContext", ",", "machineId", "string", ",", "rules", "[", "]", "network", ".", "IngressRule", ")", "error", "{", "logger", ".", "Debugf", "(", "\"", "\"", ...
// MAAS does not do firewalling so these port methods do nothing.
[ "MAAS", "does", "not", "do", "firewalling", "so", "these", "port", "methods", "do", "nothing", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/maas2instance.go#L104-L107
153,825
juju/juju
state/mocks/clock_mock.go
NewMockClock
func NewMockClock(ctrl *gomock.Controller) *MockClock { mock := &MockClock{ctrl: ctrl} mock.recorder = &MockClockMockRecorder{mock} return mock }
go
func NewMockClock(ctrl *gomock.Controller) *MockClock { mock := &MockClock{ctrl: ctrl} mock.recorder = &MockClockMockRecorder{mock} return mock }
[ "func", "NewMockClock", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockClock", "{", "mock", ":=", "&", "MockClock", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockClockMockRecorder", "{", "mock", "}", "\n", ...
// NewMockClock creates a new mock instance
[ "NewMockClock", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/mocks/clock_mock.go#L26-L30
153,826
juju/juju
state/mocks/clock_mock.go
After
func (mr *MockClockMockRecorder) After(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "After", reflect.TypeOf((*MockClock)(nil).After), arg0) }
go
func (mr *MockClockMockRecorder) After(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "After", reflect.TypeOf((*MockClock)(nil).After), arg0) }
[ "func", "(", "mr", "*", "MockClockMockRecorder", ")", "After", "(", "arg0", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"",...
// After indicates an expected call of After
[ "After", "indicates", "an", "expected", "call", "of", "After" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/mocks/clock_mock.go#L45-L47
153,827
juju/juju
state/mocks/clock_mock.go
AfterFunc
func (m *MockClock) AfterFunc(arg0 time.Duration, arg1 func()) clock.Timer { ret := m.ctrl.Call(m, "AfterFunc", arg0, arg1) ret0, _ := ret[0].(clock.Timer) return ret0 }
go
func (m *MockClock) AfterFunc(arg0 time.Duration, arg1 func()) clock.Timer { ret := m.ctrl.Call(m, "AfterFunc", arg0, arg1) ret0, _ := ret[0].(clock.Timer) return ret0 }
[ "func", "(", "m", "*", "MockClock", ")", "AfterFunc", "(", "arg0", "time", ".", "Duration", ",", "arg1", "func", "(", ")", ")", "clock", ".", "Timer", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",",...
// AfterFunc mocks base method
[ "AfterFunc", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/mocks/clock_mock.go#L50-L54
153,828
juju/juju
state/mocks/clock_mock.go
Now
func (mr *MockClockMockRecorder) Now() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Now", reflect.TypeOf((*MockClock)(nil).Now)) }
go
func (mr *MockClockMockRecorder) Now() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Now", reflect.TypeOf((*MockClock)(nil).Now)) }
[ "func", "(", "mr", "*", "MockClockMockRecorder", ")", "Now", "(", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", ...
// Now indicates an expected call of Now
[ "Now", "indicates", "an", "expected", "call", "of", "Now" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/mocks/clock_mock.go#L81-L83
153,829
juju/juju
environs/simplestreams/json.go
UnmarshalJSON
func (c *ItemCollection) UnmarshalJSON(b []byte) error { var raw itemCollection if err := json.Unmarshal(b, &raw); err != nil { return err } c.rawItems = raw.Items c.Items = make(map[string]interface{}, len(raw.Items)) c.Arch = raw.Arch c.Version = raw.Version c.Series = raw.Series c.RegionName = raw.RegionN...
go
func (c *ItemCollection) UnmarshalJSON(b []byte) error { var raw itemCollection if err := json.Unmarshal(b, &raw); err != nil { return err } c.rawItems = raw.Items c.Items = make(map[string]interface{}, len(raw.Items)) c.Arch = raw.Arch c.Version = raw.Version c.Series = raw.Series c.RegionName = raw.RegionN...
[ "func", "(", "c", "*", "ItemCollection", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "raw", "itemCollection", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "raw", ")", ";", "err", "!=", "nil"...
// ItemsCollection.UnmarshalJSON unmarshals the ItemCollection, // storing the raw bytes for each item. These can later be // unmarshalled again into product-specific types.
[ "ItemsCollection", ".", "UnmarshalJSON", "unmarshals", "the", "ItemCollection", "storing", "the", "raw", "bytes", "for", "each", "item", ".", "These", "can", "later", "be", "unmarshalled", "again", "into", "product", "-", "specific", "types", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/simplestreams/json.go#L25-L45
153,830
juju/juju
cmd/juju/storage/pooldelete.go
NewPoolRemoveCommand
func NewPoolRemoveCommand() cmd.Command { cmd := &poolRemoveCommand{} cmd.newAPIFunc = func() (PoolRemoveAPI, error) { return cmd.NewStorageAPI() } return modelcmd.Wrap(cmd) }
go
func NewPoolRemoveCommand() cmd.Command { cmd := &poolRemoveCommand{} cmd.newAPIFunc = func() (PoolRemoveAPI, error) { return cmd.NewStorageAPI() } return modelcmd.Wrap(cmd) }
[ "func", "NewPoolRemoveCommand", "(", ")", "cmd", ".", "Command", "{", "cmd", ":=", "&", "poolRemoveCommand", "{", "}", "\n", "cmd", ".", "newAPIFunc", "=", "func", "(", ")", "(", "PoolRemoveAPI", ",", "error", ")", "{", "return", "cmd", ".", "NewStorageA...
// NewPoolRemoveCommand returns a command that removes the named storage pool.
[ "NewPoolRemoveCommand", "returns", "a", "command", "that", "removes", "the", "named", "storage", "pool", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/storage/pooldelete.go#L36-L42
153,831
juju/juju
worker/machineactions/worker.go
NewMachineActionsWorker
func NewMachineActionsWorker(config WorkerConfig) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } swConfig := watcher.StringsConfig{ Handler: &handler{config}, } return watcher.NewStringsWorker(swConfig) }
go
func NewMachineActionsWorker(config WorkerConfig) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } swConfig := watcher.StringsConfig{ Handler: &handler{config}, } return watcher.NewStringsWorker(swConfig) }
[ "func", "NewMachineActionsWorker", "(", "config", "WorkerConfig", ")", "(", "worker", ".", "Worker", ",", "error", ")", "{", "if", "err", ":=", "config", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Tra...
// NewMachineActionsWorker returns a worker.Worker that watches for actions // enqueued on this machine and tries to execute them.
[ "NewMachineActionsWorker", "returns", "a", "worker", ".", "Worker", "that", "watches", "for", "actions", "enqueued", "on", "this", "machine", "and", "tries", "to", "execute", "them", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/machineactions/worker.go#L53-L61
153,832
juju/juju
worker/machineactions/worker.go
Handle
func (h *handler) Handle(_ <-chan struct{}, actionsSlice []string) error { for _, actionId := range actionsSlice { ok := names.IsValidAction(actionId) if !ok { return errors.Errorf("got invalid action id %s", actionId) } actionTag := names.NewActionTag(actionId) action, err := h.config.Facade.Action(acti...
go
func (h *handler) Handle(_ <-chan struct{}, actionsSlice []string) error { for _, actionId := range actionsSlice { ok := names.IsValidAction(actionId) if !ok { return errors.Errorf("got invalid action id %s", actionId) } actionTag := names.NewActionTag(actionId) action, err := h.config.Facade.Action(acti...
[ "func", "(", "h", "*", "handler", ")", "Handle", "(", "_", "<-", "chan", "struct", "{", "}", ",", "actionsSlice", "[", "]", "string", ")", "error", "{", "for", "_", ",", "actionId", ":=", "range", "actionsSlice", "{", "ok", ":=", "names", ".", "IsV...
// Handle is part of the watcher.StringsHandler interface. // It should give us any actions currently enqueued for this machine. // We try to execute every action before returning
[ "Handle", "is", "part", "of", "the", "watcher", ".", "StringsHandler", "interface", ".", "It", "should", "give", "us", "any", "actions", "currently", "enqueued", "for", "this", "machine", ".", "We", "try", "to", "execute", "every", "action", "before", "retur...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/machineactions/worker.go#L94-L126
153,833
juju/juju
state/applicationoffers.go
ApplicationOfferEndpoint
func ApplicationOfferEndpoint(offer crossmodel.ApplicationOffer, relationName string) (Endpoint, error) { for _, ep := range offer.Endpoints { if ep.Name == relationName { return Endpoint{ ApplicationName: offer.ApplicationName, Relation: ep, }, nil } } return Endpoint{}, errors.NotFoundf("r...
go
func ApplicationOfferEndpoint(offer crossmodel.ApplicationOffer, relationName string) (Endpoint, error) { for _, ep := range offer.Endpoints { if ep.Name == relationName { return Endpoint{ ApplicationName: offer.ApplicationName, Relation: ep, }, nil } } return Endpoint{}, errors.NotFoundf("r...
[ "func", "ApplicationOfferEndpoint", "(", "offer", "crossmodel", ".", "ApplicationOffer", ",", "relationName", "string", ")", "(", "Endpoint", ",", "error", ")", "{", "for", "_", ",", "ep", ":=", "range", "offer", ".", "Endpoints", "{", "if", "ep", ".", "Na...
// ApplicationOfferEndpoint returns from the specified offer, the relation endpoint // with the supplied name, if it exists.
[ "ApplicationOfferEndpoint", "returns", "from", "the", "specified", "offer", "the", "relation", "endpoint", "with", "the", "supplied", "name", "if", "it", "exists", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L71-L81
153,834
juju/juju
state/applicationoffers.go
ApplicationOfferForUUID
func (s *applicationOffers) ApplicationOfferForUUID(offerUUID string) (*crossmodel.ApplicationOffer, error) { offerDoc, err := s.offerQuery(bson.D{{"offer-uuid", offerUUID}}) if err != nil { if err == mgo.ErrNotFound { return nil, errors.NotFoundf("application offer %q", offerUUID) } return nil, errors.Annot...
go
func (s *applicationOffers) ApplicationOfferForUUID(offerUUID string) (*crossmodel.ApplicationOffer, error) { offerDoc, err := s.offerQuery(bson.D{{"offer-uuid", offerUUID}}) if err != nil { if err == mgo.ErrNotFound { return nil, errors.NotFoundf("application offer %q", offerUUID) } return nil, errors.Annot...
[ "func", "(", "s", "*", "applicationOffers", ")", "ApplicationOfferForUUID", "(", "offerUUID", "string", ")", "(", "*", "crossmodel", ".", "ApplicationOffer", ",", "error", ")", "{", "offerDoc", ",", "err", ":=", "s", ".", "offerQuery", "(", "bson", ".", "D...
// ApplicationOfferForUUID returns the application offer for the UUID.
[ "ApplicationOfferForUUID", "returns", "the", "application", "offer", "for", "the", "UUID", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L115-L124
153,835
juju/juju
state/applicationoffers.go
AllApplicationOffers
func (s *applicationOffers) AllApplicationOffers() (offers []*crossmodel.ApplicationOffer, _ error) { applicationOffersCollection, closer := s.st.db().GetCollection(applicationOffersC) defer closer() var docs []applicationOfferDoc err := applicationOffersCollection.Find(bson.D{}).All(&docs) if err != nil { retu...
go
func (s *applicationOffers) AllApplicationOffers() (offers []*crossmodel.ApplicationOffer, _ error) { applicationOffersCollection, closer := s.st.db().GetCollection(applicationOffersC) defer closer() var docs []applicationOfferDoc err := applicationOffersCollection.Find(bson.D{}).All(&docs) if err != nil { retu...
[ "func", "(", "s", "*", "applicationOffers", ")", "AllApplicationOffers", "(", ")", "(", "offers", "[", "]", "*", "crossmodel", ".", "ApplicationOffer", ",", "_", "error", ")", "{", "applicationOffersCollection", ",", "closer", ":=", "s", ".", "st", ".", "d...
// AllApplicationOffers returns all application offers in the model.
[ "AllApplicationOffers", "returns", "all", "application", "offers", "in", "the", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L127-L144
153,836
juju/juju
state/applicationoffers.go
RemoveOfferOperation
func (s *applicationOffers) RemoveOfferOperation(offerName string, force bool) *RemoveOfferOperation { return &RemoveOfferOperation{ offers: &applicationOffers{s.st}, offerName: offerName, ForcedOperation: ForcedOperation{Force: force}, } }
go
func (s *applicationOffers) RemoveOfferOperation(offerName string, force bool) *RemoveOfferOperation { return &RemoveOfferOperation{ offers: &applicationOffers{s.st}, offerName: offerName, ForcedOperation: ForcedOperation{Force: force}, } }
[ "func", "(", "s", "*", "applicationOffers", ")", "RemoveOfferOperation", "(", "offerName", "string", ",", "force", "bool", ")", "*", "RemoveOfferOperation", "{", "return", "&", "RemoveOfferOperation", "{", "offers", ":", "&", "applicationOffers", "{", "s", ".", ...
// RemoveOfferOperation returns a model operation that will allow relation to leave scope.
[ "RemoveOfferOperation", "returns", "a", "model", "operation", "that", "will", "allow", "relation", "to", "leave", "scope", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L147-L153
153,837
juju/juju
state/applicationoffers.go
Remove
func (s *applicationOffers) Remove(offerName string, force bool) error { op := s.RemoveOfferOperation(offerName, force) err := s.st.ApplyOperation(op) // TODO (anastasiamac 2019-04-10) we can surfacing these errors to the user. // These are non-fatal operational errors that occurred during force and are // collect...
go
func (s *applicationOffers) Remove(offerName string, force bool) error { op := s.RemoveOfferOperation(offerName, force) err := s.st.ApplyOperation(op) // TODO (anastasiamac 2019-04-10) we can surfacing these errors to the user. // These are non-fatal operational errors that occurred during force and are // collect...
[ "func", "(", "s", "*", "applicationOffers", ")", "Remove", "(", "offerName", "string", ",", "force", "bool", ")", "error", "{", "op", ":=", "s", ".", "RemoveOfferOperation", "(", "offerName", ",", "force", ")", "\n", "err", ":=", "s", ".", "st", ".", ...
// Remove deletes the application offer for offerName immediately.
[ "Remove", "deletes", "the", "application", "offer", "for", "offerName", "immediately", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L207-L214
153,838
juju/juju
state/applicationoffers.go
removeApplicationOffersOps
func removeApplicationOffersOps(st *State, application string) ([]txn.Op, error) { // Check how many offer refs there are. If there are none, there's // nothing more to do. If there are refs, we assume that the number // if refs is the same as what we find below. If there is a // discrepancy, then it'll result in a...
go
func removeApplicationOffersOps(st *State, application string) ([]txn.Op, error) { // Check how many offer refs there are. If there are none, there's // nothing more to do. If there are refs, we assume that the number // if refs is the same as what we find below. If there is a // discrepancy, then it'll result in a...
[ "func", "removeApplicationOffersOps", "(", "st", "*", "State", ",", "application", "string", ")", "(", "[", "]", "txn", ".", "Op", ",", "error", ")", "{", "// Check how many offer refs there are. If there are none, there's", "// nothing more to do. If there are refs, we ass...
// removeApplicationOffersOps returns txn.Ops that will remove all offers for // the specified application. No assertions on the application or the offer // connections are made; the caller is responsible for ensuring that offer // connections have already been removed, or will be removed along with the // offers.
[ "removeApplicationOffersOps", "returns", "txn", ".", "Ops", "that", "will", "remove", "all", "offers", "for", "the", "specified", "application", ".", "No", "assertions", "on", "the", "application", "or", "the", "offer", "connections", "are", "made", ";", "the", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L320-L354
153,839
juju/juju
state/applicationoffers.go
AddOffer
func (s *applicationOffers) AddOffer(offerArgs crossmodel.AddApplicationOfferArgs) (_ *crossmodel.ApplicationOffer, err error) { defer errors.DeferredAnnotatef(&err, "cannot add application offer %q", offerArgs.OfferName) if err := s.validateOfferArgs(offerArgs); err != nil { return nil, err } model, err := s.st...
go
func (s *applicationOffers) AddOffer(offerArgs crossmodel.AddApplicationOfferArgs) (_ *crossmodel.ApplicationOffer, err error) { defer errors.DeferredAnnotatef(&err, "cannot add application offer %q", offerArgs.OfferName) if err := s.validateOfferArgs(offerArgs); err != nil { return nil, err } model, err := s.st...
[ "func", "(", "s", "*", "applicationOffers", ")", "AddOffer", "(", "offerArgs", "crossmodel", ".", "AddApplicationOfferArgs", ")", "(", "_", "*", "crossmodel", ".", "ApplicationOffer", ",", "err", "error", ")", "{", "defer", "errors", ".", "DeferredAnnotatef", ...
// AddOffer adds a new application offering to the directory.
[ "AddOffer", "adds", "a", "new", "application", "offering", "to", "the", "directory", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L379-L449
153,840
juju/juju
state/applicationoffers.go
UpdateOffer
func (s *applicationOffers) UpdateOffer(offerArgs crossmodel.AddApplicationOfferArgs) (_ *crossmodel.ApplicationOffer, err error) { defer errors.DeferredAnnotatef(&err, "cannot update application offer %q", offerArgs.ApplicationName) if err := s.validateOfferArgs(offerArgs); err != nil { return nil, err } model,...
go
func (s *applicationOffers) UpdateOffer(offerArgs crossmodel.AddApplicationOfferArgs) (_ *crossmodel.ApplicationOffer, err error) { defer errors.DeferredAnnotatef(&err, "cannot update application offer %q", offerArgs.ApplicationName) if err := s.validateOfferArgs(offerArgs); err != nil { return nil, err } model,...
[ "func", "(", "s", "*", "applicationOffers", ")", "UpdateOffer", "(", "offerArgs", "crossmodel", ".", "AddApplicationOfferArgs", ")", "(", "_", "*", "crossmodel", ".", "ApplicationOffer", ",", "err", "error", ")", "{", "defer", "errors", ".", "DeferredAnnotatef",...
// UpdateOffer replaces an existing offer at the same URL.
[ "UpdateOffer", "replaces", "an", "existing", "offer", "at", "the", "same", "URL", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L452-L515
153,841
juju/juju
state/applicationoffers.go
ListOffers
func (s *applicationOffers) ListOffers(filters ...crossmodel.ApplicationOfferFilter) ([]crossmodel.ApplicationOffer, error) { applicationOffersCollection, closer := s.st.db().GetCollection(applicationOffersC) defer closer() var offerDocs []applicationOfferDoc if len(filters) == 0 { err := applicationOffersCollec...
go
func (s *applicationOffers) ListOffers(filters ...crossmodel.ApplicationOfferFilter) ([]crossmodel.ApplicationOffer, error) { applicationOffersCollection, closer := s.st.db().GetCollection(applicationOffersC) defer closer() var offerDocs []applicationOfferDoc if len(filters) == 0 { err := applicationOffersCollec...
[ "func", "(", "s", "*", "applicationOffers", ")", "ListOffers", "(", "filters", "...", "crossmodel", ".", "ApplicationOfferFilter", ")", "(", "[", "]", "crossmodel", ".", "ApplicationOffer", ",", "error", ")", "{", "applicationOffersCollection", ",", "closer", ":...
// ListOffers returns the application offers matching any one of the filter terms.
[ "ListOffers", "returns", "the", "application", "offers", "matching", "any", "one", "of", "the", "filter", "terms", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L547-L586
153,842
juju/juju
state/applicationoffers.go
filterOffers
func (s *applicationOffers) filterOffers( in []applicationOfferDoc, filter crossmodel.ApplicationOfferFilter, ) ([]applicationOfferDoc, error) { out, err := s.filterOffersByEndpoint(in, filter.Endpoints) if err != nil { return nil, errors.Trace(err) } out, err = s.filterOffersByConnectedUser(out, filter.Connec...
go
func (s *applicationOffers) filterOffers( in []applicationOfferDoc, filter crossmodel.ApplicationOfferFilter, ) ([]applicationOfferDoc, error) { out, err := s.filterOffersByEndpoint(in, filter.Endpoints) if err != nil { return nil, errors.Trace(err) } out, err = s.filterOffersByConnectedUser(out, filter.Connec...
[ "func", "(", "s", "*", "applicationOffers", ")", "filterOffers", "(", "in", "[", "]", "applicationOfferDoc", ",", "filter", "crossmodel", ".", "ApplicationOfferFilter", ",", ")", "(", "[", "]", "applicationOfferDoc", ",", "error", ")", "{", "out", ",", "err"...
// filterOffers takes a list of offers resulting from a db query // and performs additional filtering which cannot be done via mongo.
[ "filterOffers", "takes", "a", "list", "of", "offers", "resulting", "from", "a", "db", "query", "and", "performs", "additional", "filtering", "which", "cannot", "be", "done", "via", "mongo", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L590-L604
153,843
juju/juju
state/applicationoffers.go
WatchOfferStatus
func (st *State) WatchOfferStatus(offerUUID string) (NotifyWatcher, error) { oa := NewApplicationOffers(st) offer, err := oa.ApplicationOfferForUUID(offerUUID) if err != nil { return nil, errors.Trace(err) } filter := func(id interface{}) bool { k, err := st.strictLocalID(id.(string)) if err != nil { retu...
go
func (st *State) WatchOfferStatus(offerUUID string) (NotifyWatcher, error) { oa := NewApplicationOffers(st) offer, err := oa.ApplicationOfferForUUID(offerUUID) if err != nil { return nil, errors.Trace(err) } filter := func(id interface{}) bool { k, err := st.strictLocalID(id.(string)) if err != nil { retu...
[ "func", "(", "st", "*", "State", ")", "WatchOfferStatus", "(", "offerUUID", "string", ")", "(", "NotifyWatcher", ",", "error", ")", "{", "oa", ":=", "NewApplicationOffers", "(", "st", ")", "\n", "offer", ",", "err", ":=", "oa", ".", "ApplicationOfferForUUI...
// WatchOfferStatus returns a NotifyWatcher that notifies of changes // to the offer's status.
[ "WatchOfferStatus", "returns", "a", "NotifyWatcher", "that", "notifies", "of", "changes", "to", "the", "offer", "s", "status", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/applicationoffers.go#L749-L779
153,844
juju/juju
apiserver/facades/client/usermanager/usermanager.go
NewUserManagerAPI
func NewUserManagerAPI( st *state.State, resources facade.Resources, authorizer facade.Authorizer, ) (*UserManagerAPI, error) { if !authorizer.AuthClient() { return nil, common.ErrPerm } // Since we know this is a user tag (because AuthClient is true), // we just do the type assertion to the UserTag. apiUser...
go
func NewUserManagerAPI( st *state.State, resources facade.Resources, authorizer facade.Authorizer, ) (*UserManagerAPI, error) { if !authorizer.AuthClient() { return nil, common.ErrPerm } // Since we know this is a user tag (because AuthClient is true), // we just do the type assertion to the UserTag. apiUser...
[ "func", "NewUserManagerAPI", "(", "st", "*", "state", ".", "State", ",", "resources", "facade", ".", "Resources", ",", "authorizer", "facade", ".", "Authorizer", ",", ")", "(", "*", "UserManagerAPI", ",", "error", ")", "{", "if", "!", "authorizer", ".", ...
// NewUserManagerAPI provides the signature required for facade registration.
[ "NewUserManagerAPI", "provides", "the", "signature", "required", "for", "facade", "registration", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/usermanager/usermanager.go#L33-L59
153,845
juju/juju
apiserver/facades/client/usermanager/usermanager.go
AddUser
func (api *UserManagerAPI) AddUser(args params.AddUsers) (params.AddUserResults, error) { var result params.AddUserResults if err := api.check.ChangeAllowed(); err != nil { return result, errors.Trace(err) } if len(args.Users) == 0 { return result, nil } // Create the results list to populate. result.Resu...
go
func (api *UserManagerAPI) AddUser(args params.AddUsers) (params.AddUserResults, error) { var result params.AddUserResults if err := api.check.ChangeAllowed(); err != nil { return result, errors.Trace(err) } if len(args.Users) == 0 { return result, nil } // Create the results list to populate. result.Resu...
[ "func", "(", "api", "*", "UserManagerAPI", ")", "AddUser", "(", "args", "params", ".", "AddUsers", ")", "(", "params", ".", "AddUserResults", ",", "error", ")", "{", "var", "result", "params", ".", "AddUserResults", "\n\n", "if", "err", ":=", "api", ".",...
// AddUser adds a user with a username, and either a password or // a randomly generated secret key which will be returned.
[ "AddUser", "adds", "a", "user", "with", "a", "username", "and", "either", "a", "password", "or", "a", "randomly", "generated", "secret", "key", "which", "will", "be", "returned", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/usermanager/usermanager.go#L71-L114
153,846
juju/juju
apiserver/facades/client/usermanager/usermanager.go
EnableUser
func (api *UserManagerAPI) EnableUser(users params.Entities) (params.ErrorResults, error) { isSuperUser, err := api.hasControllerAdminAccess() if err != nil { return params.ErrorResults{}, errors.Trace(err) } if !isSuperUser { return params.ErrorResults{}, common.ErrPerm } if err := api.check.ChangeAllowed()...
go
func (api *UserManagerAPI) EnableUser(users params.Entities) (params.ErrorResults, error) { isSuperUser, err := api.hasControllerAdminAccess() if err != nil { return params.ErrorResults{}, errors.Trace(err) } if !isSuperUser { return params.ErrorResults{}, common.ErrPerm } if err := api.check.ChangeAllowed()...
[ "func", "(", "api", "*", "UserManagerAPI", ")", "EnableUser", "(", "users", "params", ".", "Entities", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "isSuperUser", ",", "err", ":=", "api", ".", "hasControllerAdminAccess", "(", ")", "\n",...
// EnableUser enables one or more users. If the user is already enabled, // the action is considered a success.
[ "EnableUser", "enables", "one", "or", "more", "users", ".", "If", "the", "user", "is", "already", "enabled", "the", "action", "is", "considered", "a", "success", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/usermanager/usermanager.go#L186-L199
153,847
juju/juju
apiserver/facades/client/usermanager/usermanager.go
SetPassword
func (api *UserManagerAPI) SetPassword(args params.EntityPasswords) (params.ErrorResults, error) { if err := api.check.ChangeAllowed(); err != nil { return params.ErrorResults{}, errors.Trace(err) } var result params.ErrorResults if len(args.Changes) == 0 { return result, nil } // Create the results list t...
go
func (api *UserManagerAPI) SetPassword(args params.EntityPasswords) (params.ErrorResults, error) { if err := api.check.ChangeAllowed(); err != nil { return params.ErrorResults{}, errors.Trace(err) } var result params.ErrorResults if len(args.Changes) == 0 { return result, nil } // Create the results list t...
[ "func", "(", "api", "*", "UserManagerAPI", ")", "SetPassword", "(", "args", "params", ".", "EntityPasswords", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "if", "err", ":=", "api", ".", "check", ".", "ChangeAllowed", "(", ")", ";", ...
// SetPassword changes the stored password for the specified users.
[ "SetPassword", "changes", "the", "stored", "password", "for", "the", "specified", "users", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/usermanager/usermanager.go#L348-L367
153,848
juju/juju
api/retrystrategy/retrystrategy.go
RetryStrategy
func (c *Client) RetryStrategy(agentTag names.Tag) (params.RetryStrategy, error) { var results params.RetryStrategyResults args := params.Entities{ Entities: []params.Entity{{Tag: agentTag.String()}}, } err := c.facade.FacadeCall("RetryStrategy", args, &results) if err != nil { return params.RetryStrategy{}, e...
go
func (c *Client) RetryStrategy(agentTag names.Tag) (params.RetryStrategy, error) { var results params.RetryStrategyResults args := params.Entities{ Entities: []params.Entity{{Tag: agentTag.String()}}, } err := c.facade.FacadeCall("RetryStrategy", args, &results) if err != nil { return params.RetryStrategy{}, e...
[ "func", "(", "c", "*", "Client", ")", "RetryStrategy", "(", "agentTag", "names", ".", "Tag", ")", "(", "params", ".", "RetryStrategy", ",", "error", ")", "{", "var", "results", "params", ".", "RetryStrategyResults", "\n", "args", ":=", "params", ".", "En...
// RetryStrategy returns the configuration for the agent specified by the agentTag.
[ "RetryStrategy", "returns", "the", "configuration", "for", "the", "agent", "specified", "by", "the", "agentTag", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/retrystrategy/retrystrategy.go#L30-L47
153,849
juju/juju
api/retrystrategy/retrystrategy.go
WatchRetryStrategy
func (c *Client) WatchRetryStrategy(agentTag names.Tag) (watcher.NotifyWatcher, error) { var results params.NotifyWatchResults args := params.Entities{ Entities: []params.Entity{{Tag: agentTag.String()}}, } err := c.facade.FacadeCall("WatchRetryStrategy", args, &results) if err != nil { return nil, errors.Trac...
go
func (c *Client) WatchRetryStrategy(agentTag names.Tag) (watcher.NotifyWatcher, error) { var results params.NotifyWatchResults args := params.Entities{ Entities: []params.Entity{{Tag: agentTag.String()}}, } err := c.facade.FacadeCall("WatchRetryStrategy", args, &results) if err != nil { return nil, errors.Trac...
[ "func", "(", "c", "*", "Client", ")", "WatchRetryStrategy", "(", "agentTag", "names", ".", "Tag", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "var", "results", "params", ".", "NotifyWatchResults", "\n", "args", ":=", "params", ".", ...
// WatchRetryStrategy returns a notify watcher that looks for changes in the // retry strategy config for the agent specified by agentTag // Right now only the boolean that decides whether we retry can be modified.
[ "WatchRetryStrategy", "returns", "a", "notify", "watcher", "that", "looks", "for", "changes", "in", "the", "retry", "strategy", "config", "for", "the", "agent", "specified", "by", "agentTag", "Right", "now", "only", "the", "boolean", "that", "decides", "whether"...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/retrystrategy/retrystrategy.go#L52-L70
153,850
juju/juju
api/lifeflag/facade.go
NewFacade
func NewFacade(caller base.APICaller, newWatcher NewWatcherFunc) *Facade { return &Facade{ caller: base.NewFacadeCaller(caller, "LifeFlag"), newWatcher: newWatcher, } }
go
func NewFacade(caller base.APICaller, newWatcher NewWatcherFunc) *Facade { return &Facade{ caller: base.NewFacadeCaller(caller, "LifeFlag"), newWatcher: newWatcher, } }
[ "func", "NewFacade", "(", "caller", "base", ".", "APICaller", ",", "newWatcher", "NewWatcherFunc", ")", "*", "Facade", "{", "return", "&", "Facade", "{", "caller", ":", "base", ".", "NewFacadeCaller", "(", "caller", ",", "\"", "\"", ")", ",", "newWatcher",...
// NewFacade returns a new Facade using the supplied caller.
[ "NewFacade", "returns", "a", "new", "Facade", "using", "the", "supplied", "caller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/lifeflag/facade.go#L26-L31
153,851
juju/juju
api/lifeflag/facade.go
Watch
func (facade *Facade) Watch(entity names.Tag) (watcher.NotifyWatcher, error) { args := params.Entities{ Entities: []params.Entity{{Tag: entity.String()}}, } var results params.NotifyWatchResults err := facade.caller.FacadeCall("Watch", args, &results) if err != nil { return nil, errors.Trace(err) } if count ...
go
func (facade *Facade) Watch(entity names.Tag) (watcher.NotifyWatcher, error) { args := params.Entities{ Entities: []params.Entity{{Tag: entity.String()}}, } var results params.NotifyWatchResults err := facade.caller.FacadeCall("Watch", args, &results) if err != nil { return nil, errors.Trace(err) } if count ...
[ "func", "(", "facade", "*", "Facade", ")", "Watch", "(", "entity", "names", ".", "Tag", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "args", ":=", "params", ".", "Entities", "{", "Entities", ":", "[", "]", "params", ".", "Entity...
// Watch returns a NotifyWatcher that sends a value whenever the // entity's life value may have changed; or ErrNotFound; or some // other error.
[ "Watch", "returns", "a", "NotifyWatcher", "that", "sends", "a", "value", "whenever", "the", "entity", "s", "life", "value", "may", "have", "changed", ";", "or", "ErrNotFound", ";", "or", "some", "other", "error", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/lifeflag/facade.go#L49-L70
153,852
juju/juju
api/lifeflag/facade.go
Life
func (facade *Facade) Life(entity names.Tag) (life.Value, error) { args := params.Entities{ Entities: []params.Entity{{Tag: entity.String()}}, } var results params.LifeResults err := facade.caller.FacadeCall("Life", args, &results) if err != nil { return "", errors.Trace(err) } if count := len(results.Result...
go
func (facade *Facade) Life(entity names.Tag) (life.Value, error) { args := params.Entities{ Entities: []params.Entity{{Tag: entity.String()}}, } var results params.LifeResults err := facade.caller.FacadeCall("Life", args, &results) if err != nil { return "", errors.Trace(err) } if count := len(results.Result...
[ "func", "(", "facade", "*", "Facade", ")", "Life", "(", "entity", "names", ".", "Tag", ")", "(", "life", ".", "Value", ",", "error", ")", "{", "args", ":=", "params", ".", "Entities", "{", "Entities", ":", "[", "]", "params", ".", "Entity", "{", ...
// Life returns the entity's life value; or ErrNotFound; or some // other error.
[ "Life", "returns", "the", "entity", "s", "life", "value", ";", "or", "ErrNotFound", ";", "or", "some", "other", "error", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/lifeflag/facade.go#L74-L98
153,853
juju/juju
core/constraints/constraints.go
resolveAlias
func resolveAlias(key string) string { if canonical, ok := rawAliases[key]; ok { return canonical } return key }
go
func resolveAlias(key string) string { if canonical, ok := rawAliases[key]; ok { return canonical } return key }
[ "func", "resolveAlias", "(", "key", "string", ")", "string", "{", "if", "canonical", ",", "ok", ":=", "rawAliases", "[", "key", "]", ";", "ok", "{", "return", "canonical", "\n", "}", "\n", "return", "key", "\n", "}" ]
// resolveAlias returns the canonical representation of the given key, if it'a // an alias listed in aliases, otherwise it returns the original key.
[ "resolveAlias", "returns", "the", "canonical", "representation", "of", "the", "given", "key", "if", "it", "a", "an", "alias", "listed", "in", "aliases", "otherwise", "it", "returns", "the", "original", "key", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L108-L113
153,854
juju/juju
core/constraints/constraints.go
IncludeSpaces
func (v *Value) IncludeSpaces() []string { if v.Spaces == nil { return nil } return v.extractItems(*v.Spaces, true) }
go
func (v *Value) IncludeSpaces() []string { if v.Spaces == nil { return nil } return v.extractItems(*v.Spaces, true) }
[ "func", "(", "v", "*", "Value", ")", "IncludeSpaces", "(", ")", "[", "]", "string", "{", "if", "v", ".", "Spaces", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "v", ".", "extractItems", "(", "*", "v", ".", "Spaces", ",", "true", ...
// IncludeSpaces returns a list of spaces to include when starting a // machine, if specified.
[ "IncludeSpaces", "returns", "a", "list", "of", "spaces", "to", "include", "when", "starting", "a", "machine", "if", "specified", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L174-L179
153,855
juju/juju
core/constraints/constraints.go
ExcludeSpaces
func (v *Value) ExcludeSpaces() []string { if v.Spaces == nil { return nil } return v.extractItems(*v.Spaces, false) }
go
func (v *Value) ExcludeSpaces() []string { if v.Spaces == nil { return nil } return v.extractItems(*v.Spaces, false) }
[ "func", "(", "v", "*", "Value", ")", "ExcludeSpaces", "(", ")", "[", "]", "string", "{", "if", "v", ".", "Spaces", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "v", ".", "extractItems", "(", "*", "v", ".", "Spaces", ",", "false",...
// ExcludeSpaces returns a list of spaces to exclude when starting a // machine, if specified. They are given in the spaces constraint with // a "^" prefix to the name, which is stripped before returning.
[ "ExcludeSpaces", "returns", "a", "list", "of", "spaces", "to", "exclude", "when", "starting", "a", "machine", "if", "specified", ".", "They", "are", "given", "in", "the", "spaces", "constraint", "with", "a", "^", "prefix", "to", "the", "name", "which", "is...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L184-L189
153,856
juju/juju
core/constraints/constraints.go
HasSpaces
func (v *Value) HasSpaces() bool { return v.Spaces != nil && len(*v.Spaces) > 0 }
go
func (v *Value) HasSpaces() bool { return v.Spaces != nil && len(*v.Spaces) > 0 }
[ "func", "(", "v", "*", "Value", ")", "HasSpaces", "(", ")", "bool", "{", "return", "v", ".", "Spaces", "!=", "nil", "&&", "len", "(", "*", "v", ".", "Spaces", ")", ">", "0", "\n", "}" ]
// HasSpaces returns whether any spaces constraints were specified.
[ "HasSpaces", "returns", "whether", "any", "spaces", "constraints", "were", "specified", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L192-L194
153,857
juju/juju
core/constraints/constraints.go
HasZones
func (v *Value) HasZones() bool { return v.Zones != nil && len(*v.Zones) > 0 }
go
func (v *Value) HasZones() bool { return v.Zones != nil && len(*v.Zones) > 0 }
[ "func", "(", "v", "*", "Value", ")", "HasZones", "(", ")", "bool", "{", "return", "v", ".", "Zones", "!=", "nil", "&&", "len", "(", "*", "v", ".", "Zones", ")", ">", "0", "\n", "}" ]
// HasZones returns whether any zone constraints were specified.
[ "HasZones", "returns", "whether", "any", "zone", "constraints", "were", "specified", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L202-L204
153,858
juju/juju
core/constraints/constraints.go
String
func (v Value) String() string { var strs []string if v.Arch != nil { strs = append(strs, "arch="+*v.Arch) } if v.Container != nil { strs = append(strs, "container="+string(*v.Container)) } if v.CpuCores != nil { strs = append(strs, "cores="+uintStr(*v.CpuCores)) } if v.CpuPower != nil { strs = append(s...
go
func (v Value) String() string { var strs []string if v.Arch != nil { strs = append(strs, "arch="+*v.Arch) } if v.Container != nil { strs = append(strs, "container="+string(*v.Container)) } if v.CpuCores != nil { strs = append(strs, "cores="+uintStr(*v.CpuCores)) } if v.CpuPower != nil { strs = append(s...
[ "func", "(", "v", "Value", ")", "String", "(", ")", "string", "{", "var", "strs", "[", "]", "string", "\n", "if", "v", ".", "Arch", "!=", "nil", "{", "strs", "=", "append", "(", "strs", ",", "\"", "\"", "+", "*", "v", ".", "Arch", ")", "\n", ...
// String expresses a constraints.Value in the language in which it was specified.
[ "String", "expresses", "a", "constraints", ".", "Value", "in", "the", "language", "in", "which", "it", "was", "specified", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L207-L258
153,859
juju/juju
core/constraints/constraints.go
GoString
func (v Value) GoString() string { var values []string if v.Arch != nil { values = append(values, fmt.Sprintf("Arch: %q", *v.Arch)) } if v.CpuCores != nil { values = append(values, fmt.Sprintf("Cores: %v", *v.CpuCores)) } if v.CpuPower != nil { values = append(values, fmt.Sprintf("CpuPower: %v", *v.CpuPower...
go
func (v Value) GoString() string { var values []string if v.Arch != nil { values = append(values, fmt.Sprintf("Arch: %q", *v.Arch)) } if v.CpuCores != nil { values = append(values, fmt.Sprintf("Cores: %v", *v.CpuCores)) } if v.CpuPower != nil { values = append(values, fmt.Sprintf("CpuPower: %v", *v.CpuPower...
[ "func", "(", "v", "Value", ")", "GoString", "(", ")", "string", "{", "var", "values", "[", "]", "string", "\n", "if", "v", ".", "Arch", "!=", "nil", "{", "values", "=", "append", "(", "values", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", ...
// GoString allows printing a constraints.Value nicely with the fmt // package, especially when nested inside other types.
[ "GoString", "allows", "printing", "a", "constraints", ".", "Value", "nicely", "with", "the", "fmt", "package", "especially", "when", "nested", "inside", "other", "types", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L262-L304
153,860
juju/juju
core/constraints/constraints.go
Parse
func Parse(args ...string) (Value, error) { v, _, err := ParseWithAliases(args...) return v, err }
go
func Parse(args ...string) (Value, error) { v, _, err := ParseWithAliases(args...) return v, err }
[ "func", "Parse", "(", "args", "...", "string", ")", "(", "Value", ",", "error", ")", "{", "v", ",", "_", ",", "err", ":=", "ParseWithAliases", "(", "args", "...", ")", "\n", "return", "v", ",", "err", "\n", "}" ]
// Parse constructs a constraints.Value from the supplied arguments, // each of which must contain only spaces and name=value pairs. If any // name is specified more than once, an error is returned.
[ "Parse", "constructs", "a", "constraints", ".", "Value", "from", "the", "supplied", "arguments", "each", "of", "which", "must", "contain", "only", "spaces", "and", "name", "=", "value", "pairs", ".", "If", "any", "name", "is", "specified", "more", "than", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L316-L319
153,861
juju/juju
core/constraints/constraints.go
ParseWithAliases
func ParseWithAliases(args ...string) (cons Value, aliases map[string]string, err error) { aliases = make(map[string]string) for _, arg := range args { raws := strings.Split(strings.TrimSpace(arg), " ") for _, raw := range raws { if raw == "" { continue } name, val, err := splitRaw(raw) if err != ...
go
func ParseWithAliases(args ...string) (cons Value, aliases map[string]string, err error) { aliases = make(map[string]string) for _, arg := range args { raws := strings.Split(strings.TrimSpace(arg), " ") for _, raw := range raws { if raw == "" { continue } name, val, err := splitRaw(raw) if err != ...
[ "func", "ParseWithAliases", "(", "args", "...", "string", ")", "(", "cons", "Value", ",", "aliases", "map", "[", "string", "]", "string", ",", "err", "error", ")", "{", "aliases", "=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for...
// ParseWithAliases constructs a constraints.Value from the supplied arguments, each // of which must contain only spaces and name=value pairs. If any name is // specified more than once, an error is returned. The aliases map returned // contains a map of aliases used, and their canonical values.
[ "ParseWithAliases", "constructs", "a", "constraints", ".", "Value", "from", "the", "supplied", "arguments", "each", "of", "which", "must", "contain", "only", "spaces", "and", "name", "=", "value", "pairs", ".", "If", "any", "name", "is", "specified", "more", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L325-L347
153,862
juju/juju
core/constraints/constraints.go
Merge
func Merge(values ...Value) (Value, error) { var args []string for _, value := range values { args = append(args, value.String()) } return Parse(args...) }
go
func Merge(values ...Value) (Value, error) { var args []string for _, value := range values { args = append(args, value.String()) } return Parse(args...) }
[ "func", "Merge", "(", "values", "...", "Value", ")", "(", "Value", ",", "error", ")", "{", "var", "args", "[", "]", "string", "\n", "for", "_", ",", "value", ":=", "range", "values", "{", "args", "=", "append", "(", "args", ",", "value", ".", "St...
// Merge returns the effective constraints after merging any given // existing values.
[ "Merge", "returns", "the", "effective", "constraints", "after", "merging", "any", "given", "existing", "values", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L351-L357
153,863
juju/juju
core/constraints/constraints.go
MustParse
func MustParse(args ...string) Value { v, err := Parse(args...) if err != nil { panic(err) } return v }
go
func MustParse(args ...string) Value { v, err := Parse(args...) if err != nil { panic(err) } return v }
[ "func", "MustParse", "(", "args", "...", "string", ")", "Value", "{", "v", ",", "err", ":=", "Parse", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "v", "\n", "}" ]
// MustParse constructs a constraints.Value from the supplied arguments, // as Parse, but panics on failure.
[ "MustParse", "constructs", "a", "constraints", ".", "Value", "from", "the", "supplied", "arguments", "as", "Parse", "but", "panics", "on", "failure", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L361-L367
153,864
juju/juju
core/constraints/constraints.go
attributesWithValues
func (v *Value) attributesWithValues() map[string]interface{} { // These can never fail, so we ignore the error for the sake of keeping our // API clean. I'm sorry (but not that sorry). b, _ := json.Marshal(v) result := map[string]interface{}{} _ = json.Unmarshal(b, &result) return result }
go
func (v *Value) attributesWithValues() map[string]interface{} { // These can never fail, so we ignore the error for the sake of keeping our // API clean. I'm sorry (but not that sorry). b, _ := json.Marshal(v) result := map[string]interface{}{} _ = json.Unmarshal(b, &result) return result }
[ "func", "(", "v", "*", "Value", ")", "attributesWithValues", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "// These can never fail, so we ignore the error for the sake of keeping our", "// API clean. I'm sorry (but not that sorry).", "b", ",", "_", ":...
// attributesWithValues returns the non-zero attribute tags and their values from the constraint.
[ "attributesWithValues", "returns", "the", "non", "-", "zero", "attribute", "tags", "and", "their", "values", "from", "the", "constraint", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L388-L395
153,865
juju/juju
core/constraints/constraints.go
hasAny
func (v *Value) hasAny(attrTags ...string) []string { attributes := v.attributesWithValues() var result []string for _, tag := range attrTags { _, ok := attributes[resolveAlias(tag)] if ok { result = append(result, tag) } } return result }
go
func (v *Value) hasAny(attrTags ...string) []string { attributes := v.attributesWithValues() var result []string for _, tag := range attrTags { _, ok := attributes[resolveAlias(tag)] if ok { result = append(result, tag) } } return result }
[ "func", "(", "v", "*", "Value", ")", "hasAny", "(", "attrTags", "...", "string", ")", "[", "]", "string", "{", "attributes", ":=", "v", ".", "attributesWithValues", "(", ")", "\n", "var", "result", "[", "]", "string", "\n", "for", "_", ",", "tag", ...
// hasAny returns any attrTags for which the constraint has a non-nil value.
[ "hasAny", "returns", "any", "attrTags", "for", "which", "the", "constraint", "has", "a", "non", "-", "nil", "value", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L405-L415
153,866
juju/juju
core/constraints/constraints.go
without
func (v *Value) without(attrTags ...string) Value { attributes := v.attributesWithValues() for _, tag := range attrTags { delete(attributes, resolveAlias(tag)) } return fromAttributes(attributes) }
go
func (v *Value) without(attrTags ...string) Value { attributes := v.attributesWithValues() for _, tag := range attrTags { delete(attributes, resolveAlias(tag)) } return fromAttributes(attributes) }
[ "func", "(", "v", "*", "Value", ")", "without", "(", "attrTags", "...", "string", ")", "Value", "{", "attributes", ":=", "v", ".", "attributesWithValues", "(", ")", "\n", "for", "_", ",", "tag", ":=", "range", "attrTags", "{", "delete", "(", "attribute...
// without returns a copy of the constraint without values for // the specified attributes.
[ "without", "returns", "a", "copy", "of", "the", "constraint", "without", "values", "for", "the", "specified", "attributes", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L419-L425
153,867
juju/juju
core/constraints/constraints.go
HasContainer
func (v *Value) HasContainer() bool { return v.Container != nil && *v.Container != "" && *v.Container != instance.NONE }
go
func (v *Value) HasContainer() bool { return v.Container != nil && *v.Container != "" && *v.Container != instance.NONE }
[ "func", "(", "v", "*", "Value", ")", "HasContainer", "(", ")", "bool", "{", "return", "v", ".", "Container", "!=", "nil", "&&", "*", "v", ".", "Container", "!=", "\"", "\"", "&&", "*", "v", ".", "Container", "!=", "instance", ".", "NONE", "\n", "...
// HasContainer returns true if the constraints.Value specifies a container.
[ "HasContainer", "returns", "true", "if", "the", "constraints", ".", "Value", "specifies", "a", "container", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L558-L560
153,868
juju/juju
core/constraints/constraints.go
parseCommaDelimited
func parseCommaDelimited(s string) *[]string { if s == "" { return &[]string{} } t := strings.Split(s, ",") return &t }
go
func parseCommaDelimited(s string) *[]string { if s == "" { return &[]string{} } t := strings.Split(s, ",") return &t }
[ "func", "parseCommaDelimited", "(", "s", "string", ")", "*", "[", "]", "string", "{", "if", "s", "==", "\"", "\"", "{", "return", "&", "[", "]", "string", "{", "}", "\n", "}", "\n", "t", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"",...
// parseCommaDelimited returns the items in the value s. We expect the // items to be comma delimited strings.
[ "parseCommaDelimited", "returns", "the", "items", "in", "the", "value", "s", ".", "We", "expect", "the", "items", "to", "be", "comma", "delimited", "strings", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/constraints/constraints.go#L702-L708
153,869
juju/juju
provider/common/disk.go
MinRootDiskSizeGiB
func MinRootDiskSizeGiB(series string) uint64 { // See comment below that explains why we're ignoring the error os, _ := jujuseries.GetOSFromSeries(series) switch os { case jujuos.Ubuntu, jujuos.CentOS, jujuos.OpenSUSE: return 8 case jujuos.Windows: return 40 // By default we just return a "sane" default, sin...
go
func MinRootDiskSizeGiB(series string) uint64 { // See comment below that explains why we're ignoring the error os, _ := jujuseries.GetOSFromSeries(series) switch os { case jujuos.Ubuntu, jujuos.CentOS, jujuos.OpenSUSE: return 8 case jujuos.Windows: return 40 // By default we just return a "sane" default, sin...
[ "func", "MinRootDiskSizeGiB", "(", "series", "string", ")", "uint64", "{", "// See comment below that explains why we're ignoring the error", "os", ",", "_", ":=", "jujuseries", ".", "GetOSFromSeries", "(", "series", ")", "\n", "switch", "os", "{", "case", "jujuos", ...
// MinRootDiskSizeGiB is the minimum size for the root disk of an // instance, in Gigabytes. This value accommodates the anticipated // size of the initial image, any updates, and future application // data.
[ "MinRootDiskSizeGiB", "is", "the", "minimum", "size", "for", "the", "root", "disk", "of", "an", "instance", "in", "Gigabytes", ".", "This", "value", "accommodates", "the", "anticipated", "size", "of", "the", "initial", "image", "any", "updates", "and", "future...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/common/disk.go#L15-L28
153,870
juju/juju
state/errors.go
IsCharmAlreadyUploadedError
func IsCharmAlreadyUploadedError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrCharmAlreadyUploaded) return ok }
go
func IsCharmAlreadyUploadedError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrCharmAlreadyUploaded) return ok }
[ "func", "IsCharmAlreadyUploadedError", "(", "err", "interface", "{", "}", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "// In case of a wrapped error, check the cause first.", "value", ":=", "err", "\n", "cause", ":=", "er...
// IsCharmAlreadyUploadedError returns if the given error is // ErrCharmAlreadyUploaded.
[ "IsCharmAlreadyUploadedError", "returns", "if", "the", "given", "error", "is", "ErrCharmAlreadyUploaded", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/errors.go#L30-L42
153,871
juju/juju
state/errors.go
IsNotAlive
func IsNotAlive(err error) bool { _, ok := errors.Cause(err).(notAliveError) return ok }
go
func IsNotAlive(err error) bool { _, ok := errors.Cause(err).(notAliveError) return ok }
[ "func", "IsNotAlive", "(", "err", "error", ")", "bool", "{", "_", ",", "ok", ":=", "errors", ".", "Cause", "(", "err", ")", ".", "(", "notAliveError", ")", "\n", "return", "ok", "\n", "}" ]
// IsNotAlive returns true if err is cause by a not alive error.
[ "IsNotAlive", "returns", "true", "if", "err", "is", "cause", "by", "a", "not", "alive", "error", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/errors.go#L63-L66
153,872
juju/juju
state/errors.go
NewProviderIDNotUniqueError
func NewProviderIDNotUniqueError(providerIDs ...network.Id) error { stringIDs := make([]string, len(providerIDs)) for i, providerID := range providerIDs { stringIDs[i] = string(providerID) } return newProviderIDNotUniqueErrorFromStrings(stringIDs) }
go
func NewProviderIDNotUniqueError(providerIDs ...network.Id) error { stringIDs := make([]string, len(providerIDs)) for i, providerID := range providerIDs { stringIDs[i] = string(providerID) } return newProviderIDNotUniqueErrorFromStrings(stringIDs) }
[ "func", "NewProviderIDNotUniqueError", "(", "providerIDs", "...", "network", ".", "Id", ")", "error", "{", "stringIDs", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "providerIDs", ")", ")", "\n", "for", "i", ",", "providerID", ":=", "range", "...
// NewProviderIDNotUniqueError returns an instance of ErrProviderIDNotUnique // initialized with the given duplicate provider IDs.
[ "NewProviderIDNotUniqueError", "returns", "an", "instance", "of", "ErrProviderIDNotUnique", "initialized", "with", "the", "given", "duplicate", "provider", "IDs", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/errors.go#L98-L104
153,873
juju/juju
state/errors.go
IsProviderIDNotUniqueError
func IsProviderIDNotUniqueError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrProviderIDNotUnique) return ok }
go
func IsProviderIDNotUniqueError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrProviderIDNotUnique) return ok }
[ "func", "IsProviderIDNotUniqueError", "(", "err", "interface", "{", "}", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "// In case of a wrapped error, check the cause first.", "value", ":=", "err", "\n", "cause", ":=", "err...
// IsProviderIDNotUniqueError returns if the given error or its cause is // ErrProviderIDNotUnique.
[ "IsProviderIDNotUniqueError", "returns", "if", "the", "given", "error", "or", "its", "cause", "is", "ErrProviderIDNotUnique", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/errors.go#L114-L126
153,874
juju/juju
state/errors.go
IsParentDeviceHasChildrenError
func IsParentDeviceHasChildrenError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrParentDeviceHasChildren) return ok }
go
func IsParentDeviceHasChildrenError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrParentDeviceHasChildren) return ok }
[ "func", "IsParentDeviceHasChildrenError", "(", "err", "interface", "{", "}", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "// In case of a wrapped error, check the cause first.", "value", ":=", "err", "\n", "cause", ":=", ...
// IsParentDeviceHasChildrenError returns if the given error or its cause is // ErrParentDeviceHasChildren.
[ "IsParentDeviceHasChildrenError", "returns", "if", "the", "given", "error", "or", "its", "cause", "is", "ErrParentDeviceHasChildren", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/errors.go#L149-L161
153,875
juju/juju
state/errors.go
IsIncompatibleSeriesError
func IsIncompatibleSeriesError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrIncompatibleSeries) return ok }
go
func IsIncompatibleSeriesError(err interface{}) bool { if err == nil { return false } // In case of a wrapped error, check the cause first. value := err cause := errors.Cause(err.(error)) if cause != nil { value = cause } _, ok := value.(*ErrIncompatibleSeries) return ok }
[ "func", "IsIncompatibleSeriesError", "(", "err", "interface", "{", "}", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "// In case of a wrapped error, check the cause first.", "value", ":=", "err", "\n", "cause", ":=", "erro...
// IsIncompatibleSeriesError returns if the given error or its cause is // ErrIncompatibleSeries.
[ "IsIncompatibleSeriesError", "returns", "if", "the", "given", "error", "or", "its", "cause", "is", "ErrIncompatibleSeries", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/errors.go#L178-L190
153,876
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
NewMockInstanceMutaterState
func NewMockInstanceMutaterState(ctrl *gomock.Controller) *MockInstanceMutaterState { mock := &MockInstanceMutaterState{ctrl: ctrl} mock.recorder = &MockInstanceMutaterStateMockRecorder{mock} return mock }
go
func NewMockInstanceMutaterState(ctrl *gomock.Controller) *MockInstanceMutaterState { mock := &MockInstanceMutaterState{ctrl: ctrl} mock.recorder = &MockInstanceMutaterStateMockRecorder{mock} return mock }
[ "func", "NewMockInstanceMutaterState", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockInstanceMutaterState", "{", "mock", ":=", "&", "MockInstanceMutaterState", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockInstanceM...
// NewMockInstanceMutaterState creates a new mock instance
[ "NewMockInstanceMutaterState", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L28-L32
153,877
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
ControllerTimestamp
func (m *MockInstanceMutaterState) ControllerTimestamp() (*time.Time, error) { ret := m.ctrl.Call(m, "ControllerTimestamp") ret0, _ := ret[0].(*time.Time) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockInstanceMutaterState) ControllerTimestamp() (*time.Time, error) { ret := m.ctrl.Call(m, "ControllerTimestamp") ret0, _ := ret[0].(*time.Time) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockInstanceMutaterState", ")", "ControllerTimestamp", "(", ")", "(", "*", "time", ".", "Time", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":...
// ControllerTimestamp mocks base method
[ "ControllerTimestamp", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L40-L45
153,878
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
ControllerTimestamp
func (mr *MockInstanceMutaterStateMockRecorder) ControllerTimestamp() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ControllerTimestamp", reflect.TypeOf((*MockInstanceMutaterState)(nil).ControllerTimestamp)) }
go
func (mr *MockInstanceMutaterStateMockRecorder) ControllerTimestamp() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ControllerTimestamp", reflect.TypeOf((*MockInstanceMutaterState)(nil).ControllerTimestamp)) }
[ "func", "(", "mr", "*", "MockInstanceMutaterStateMockRecorder", ")", "ControllerTimestamp", "(", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", ...
// ControllerTimestamp indicates an expected call of ControllerTimestamp
[ "ControllerTimestamp", "indicates", "an", "expected", "call", "of", "ControllerTimestamp" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L48-L50
153,879
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
FindEntity
func (m *MockInstanceMutaterState) FindEntity(arg0 names_v2.Tag) (state.Entity, error) { ret := m.ctrl.Call(m, "FindEntity", arg0) ret0, _ := ret[0].(state.Entity) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockInstanceMutaterState) FindEntity(arg0 names_v2.Tag) (state.Entity, error) { ret := m.ctrl.Call(m, "FindEntity", arg0) ret0, _ := ret[0].(state.Entity) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockInstanceMutaterState", ")", "FindEntity", "(", "arg0", "names_v2", ".", "Tag", ")", "(", "state", ".", "Entity", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0",...
// FindEntity mocks base method
[ "FindEntity", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L53-L58
153,880
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
NewMockMachine
func NewMockMachine(ctrl *gomock.Controller) *MockMachine { mock := &MockMachine{ctrl: ctrl} mock.recorder = &MockMachineMockRecorder{mock} return mock }
go
func NewMockMachine(ctrl *gomock.Controller) *MockMachine { mock := &MockMachine{ctrl: ctrl} mock.recorder = &MockMachineMockRecorder{mock} return mock }
[ "func", "NewMockMachine", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockMachine", "{", "mock", ":=", "&", "MockMachine", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockMachineMockRecorder", "{", "mock", "}", ...
// NewMockMachine creates a new mock instance
[ "NewMockMachine", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L77-L81
153,881
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
SetModificationStatus
func (m *MockMachine) SetModificationStatus(arg0 status.StatusInfo) error { ret := m.ctrl.Call(m, "SetModificationStatus", arg0) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockMachine) SetModificationStatus(arg0 status.StatusInfo) error { ret := m.ctrl.Call(m, "SetModificationStatus", arg0) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockMachine", ")", "SetModificationStatus", "(", "arg0", "status", ".", "StatusInfo", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", ...
// SetModificationStatus mocks base method
[ "SetModificationStatus", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L101-L105
153,882
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
NewMockLXDProfile
func NewMockLXDProfile(ctrl *gomock.Controller) *MockLXDProfile { mock := &MockLXDProfile{ctrl: ctrl} mock.recorder = &MockLXDProfileMockRecorder{mock} return mock }
go
func NewMockLXDProfile(ctrl *gomock.Controller) *MockLXDProfile { mock := &MockLXDProfile{ctrl: ctrl} mock.recorder = &MockLXDProfileMockRecorder{mock} return mock }
[ "func", "NewMockLXDProfile", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockLXDProfile", "{", "mock", ":=", "&", "MockLXDProfile", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockLXDProfileMockRecorder", "{", "mock...
// NewMockLXDProfile creates a new mock instance
[ "NewMockLXDProfile", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L124-L128
153,883
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
Devices
func (m *MockLXDProfile) Devices() map[string]map[string]string { ret := m.ctrl.Call(m, "Devices") ret0, _ := ret[0].(map[string]map[string]string) return ret0 }
go
func (m *MockLXDProfile) Devices() map[string]map[string]string { ret := m.ctrl.Call(m, "Devices") ret0, _ := ret[0].(map[string]map[string]string) return ret0 }
[ "func", "(", "m", "*", "MockLXDProfile", ")", "Devices", "(", ")", "map", "[", "string", "]", "map", "[", "string", "]", "string", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", ...
// Devices mocks base method
[ "Devices", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L160-L164
153,884
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
Empty
func (m *MockLXDProfile) Empty() bool { ret := m.ctrl.Call(m, "Empty") ret0, _ := ret[0].(bool) return ret0 }
go
func (m *MockLXDProfile) Empty() bool { ret := m.ctrl.Call(m, "Empty") ret0, _ := ret[0].(bool) return ret0 }
[ "func", "(", "m", "*", "MockLXDProfile", ")", "Empty", "(", ")", "bool", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "bool", ")", "\n", "retu...
// Empty mocks base method
[ "Empty", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L172-L176
153,885
juju/juju
apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go
ValidateConfigDevices
func (m *MockLXDProfile) ValidateConfigDevices() error { ret := m.ctrl.Call(m, "ValidateConfigDevices") ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockLXDProfile) ValidateConfigDevices() error { ret := m.ctrl.Call(m, "ValidateConfigDevices") ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockLXDProfile", ")", "ValidateConfigDevices", "(", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")...
// ValidateConfigDevices mocks base method
[ "ValidateConfigDevices", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/instancemutater_mock.go#L184-L188
153,886
juju/juju
worker/retrystrategy/worker.go
NewRetryStrategyWorker
func NewRetryStrategyWorker(config WorkerConfig) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } w, err := watcher.NewNotifyWorker(watcher.NotifyConfig{ Handler: retryStrategyHandler{config}, }) if err != nil { return nil, errors.Trace(err) } return &Retry...
go
func NewRetryStrategyWorker(config WorkerConfig) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } w, err := watcher.NewNotifyWorker(watcher.NotifyConfig{ Handler: retryStrategyHandler{config}, }) if err != nil { return nil, errors.Trace(err) } return &Retry...
[ "func", "NewRetryStrategyWorker", "(", "config", "WorkerConfig", ")", "(", "worker", ".", "Worker", ",", "error", ")", "{", "if", "err", ":=", "config", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Trac...
// NewRetryStrategyWorker returns a worker.Worker that returns the current // retry strategy and bounces when it changes.
[ "NewRetryStrategyWorker", "returns", "a", "worker", ".", "Worker", "that", "returns", "the", "current", "retry", "strategy", "and", "bounces", "when", "it", "changes", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/retrystrategy/worker.go#L53-L64
153,887
juju/juju
worker/retrystrategy/worker.go
SetUp
func (h retryStrategyHandler) SetUp() (watcher.NotifyWatcher, error) { return h.config.Facade.WatchRetryStrategy(h.config.AgentTag) }
go
func (h retryStrategyHandler) SetUp() (watcher.NotifyWatcher, error) { return h.config.Facade.WatchRetryStrategy(h.config.AgentTag) }
[ "func", "(", "h", "retryStrategyHandler", ")", "SetUp", "(", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "return", "h", ".", "config", ".", "Facade", ".", "WatchRetryStrategy", "(", "h", ".", "config", ".", "AgentTag", ")", "\n", ...
// SetUp is part of the watcher.NotifyHandler interface.
[ "SetUp", "is", "part", "of", "the", "watcher", ".", "NotifyHandler", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/retrystrategy/worker.go#L77-L79
153,888
juju/juju
worker/retrystrategy/worker.go
Handle
func (h retryStrategyHandler) Handle(_ <-chan struct{}) error { newRetryStrategy, err := h.config.Facade.RetryStrategy(h.config.AgentTag) if err != nil { return errors.Trace(err) } if newRetryStrategy != h.config.RetryStrategy { return errors.Errorf("bouncing retrystrategy worker to get new values") } return ...
go
func (h retryStrategyHandler) Handle(_ <-chan struct{}) error { newRetryStrategy, err := h.config.Facade.RetryStrategy(h.config.AgentTag) if err != nil { return errors.Trace(err) } if newRetryStrategy != h.config.RetryStrategy { return errors.Errorf("bouncing retrystrategy worker to get new values") } return ...
[ "func", "(", "h", "retryStrategyHandler", ")", "Handle", "(", "_", "<-", "chan", "struct", "{", "}", ")", "error", "{", "newRetryStrategy", ",", "err", ":=", "h", ".", "config", ".", "Facade", ".", "RetryStrategy", "(", "h", ".", "config", ".", "AgentT...
// Handle is part of the watcher.NotifyHandler interface. // Whenever a valid change is encountered the worker bounces, // making the dependents bounce and get the new value
[ "Handle", "is", "part", "of", "the", "watcher", ".", "NotifyHandler", "interface", ".", "Whenever", "a", "valid", "change", "is", "encountered", "the", "worker", "bounces", "making", "the", "dependents", "bounce", "and", "get", "the", "new", "value" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/retrystrategy/worker.go#L84-L93
153,889
juju/juju
cmd/juju/controller/kill.go
NewKillCommand
func NewKillCommand() modelcmd.Command { cmd := killCommand{clock: clock.WallClock} cmd.environsDestroy = environs.Destroy return wrapKillCommand(&cmd) }
go
func NewKillCommand() modelcmd.Command { cmd := killCommand{clock: clock.WallClock} cmd.environsDestroy = environs.Destroy return wrapKillCommand(&cmd) }
[ "func", "NewKillCommand", "(", ")", "modelcmd", ".", "Command", "{", "cmd", ":=", "killCommand", "{", "clock", ":", "clock", ".", "WallClock", "}", "\n", "cmd", ".", "environsDestroy", "=", "environs", ".", "Destroy", "\n", "return", "wrapKillCommand", "(", ...
// NewKillCommand returns a command to kill a controller. Killing is a // forceful destroy.
[ "NewKillCommand", "returns", "a", "command", "to", "kill", "a", "controller", ".", "Killing", "is", "a", "forceful", "destroy", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/kill.go#L47-L51
153,890
juju/juju
cmd/juju/controller/kill.go
wrapKillCommand
func wrapKillCommand(kill *killCommand) modelcmd.Command { return modelcmd.WrapController( kill, modelcmd.WrapControllerSkipControllerFlags, modelcmd.WrapControllerSkipDefaultController, ) }
go
func wrapKillCommand(kill *killCommand) modelcmd.Command { return modelcmd.WrapController( kill, modelcmd.WrapControllerSkipControllerFlags, modelcmd.WrapControllerSkipDefaultController, ) }
[ "func", "wrapKillCommand", "(", "kill", "*", "killCommand", ")", "modelcmd", ".", "Command", "{", "return", "modelcmd", ".", "WrapController", "(", "kill", ",", "modelcmd", ".", "WrapControllerSkipControllerFlags", ",", "modelcmd", ".", "WrapControllerSkipDefaultContr...
// wrapKillCommand provides the common wrapping used by tests and // the default NewKillCommand above.
[ "wrapKillCommand", "provides", "the", "common", "wrapping", "used", "by", "tests", "and", "the", "default", "NewKillCommand", "above", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/kill.go#L55-L61
153,891
juju/juju
cmd/juju/controller/kill.go
DirectDestroyRemaining
func (c *killCommand) DirectDestroyRemaining(ctx *cmd.Context, api destroyControllerAPI) { hasErrors := false hostedConfig, err := api.HostedModelConfigs() if err != nil { hasErrors = true logger.Errorf("unable to retrieve hosted model config: %v", err) } ctrlUUID := "" // try to get controller UUID or just i...
go
func (c *killCommand) DirectDestroyRemaining(ctx *cmd.Context, api destroyControllerAPI) { hasErrors := false hostedConfig, err := api.HostedModelConfigs() if err != nil { hasErrors = true logger.Errorf("unable to retrieve hosted model config: %v", err) } ctrlUUID := "" // try to get controller UUID or just i...
[ "func", "(", "c", "*", "killCommand", ")", "DirectDestroyRemaining", "(", "ctx", "*", "cmd", ".", "Context", ",", "api", "destroyControllerAPI", ")", "{", "hasErrors", ":=", "false", "\n", "hostedConfig", ",", "err", ":=", "api", ".", "HostedModelConfigs", "...
// DirectDestroyRemaining will attempt to directly destroy any remaining // models that have machines left.
[ "DirectDestroyRemaining", "will", "attempt", "to", "directly", "destroy", "any", "remaining", "models", "that", "have", "machines", "left", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/kill.go#L180-L244
153,892
juju/juju
cmd/juju/controller/kill.go
WaitForModels
func (c *killCommand) WaitForModels(ctx *cmd.Context, api destroyControllerAPI, uuid string) error { thirtySeconds := (time.Second * 30) updateStatus := newTimedStatusUpdater(ctx, api, uuid, c.clock) envStatus := updateStatus(0) lastStatus := envStatus.controller lastChange := c.clock.Now().Truncate(time.Second) ...
go
func (c *killCommand) WaitForModels(ctx *cmd.Context, api destroyControllerAPI, uuid string) error { thirtySeconds := (time.Second * 30) updateStatus := newTimedStatusUpdater(ctx, api, uuid, c.clock) envStatus := updateStatus(0) lastStatus := envStatus.controller lastChange := c.clock.Now().Truncate(time.Second) ...
[ "func", "(", "c", "*", "killCommand", ")", "WaitForModels", "(", "ctx", "*", "cmd", ".", "Context", ",", "api", "destroyControllerAPI", ",", "uuid", "string", ")", "error", "{", "thirtySeconds", ":=", "(", "time", ".", "Second", "*", "30", ")", "\n", "...
// WaitForModels will wait for the models to bring themselves down nicely. // It will return the UUIDs of any models that need to be removed forceably.
[ "WaitForModels", "will", "wait", "for", "the", "models", "to", "bring", "themselves", "down", "nicely", ".", "It", "will", "return", "the", "UUIDs", "of", "any", "models", "that", "need", "to", "be", "removed", "forceably", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/kill.go#L261-L297
153,893
juju/juju
resource/context/internal/context.go
ContextDownload
func ContextDownload(deps ContextDownloadDeps) (path string, err error) { // TODO(katco): Potential race-condition: two commands running at // once. Solve via collision using os.Mkdir() with a uniform // temp dir name (e.g. "<datadir>/.<res name>.download")? resDirSpec := deps.NewContextDirectorySpec() remote, e...
go
func ContextDownload(deps ContextDownloadDeps) (path string, err error) { // TODO(katco): Potential race-condition: two commands running at // once. Solve via collision using os.Mkdir() with a uniform // temp dir name (e.g. "<datadir>/.<res name>.download")? resDirSpec := deps.NewContextDirectorySpec() remote, e...
[ "func", "ContextDownload", "(", "deps", "ContextDownloadDeps", ")", "(", "path", "string", ",", "err", "error", ")", "{", "// TODO(katco): Potential race-condition: two commands running at", "// once. Solve via collision using os.Mkdir() with a uniform", "// temp dir name (e.g. \"<da...
// ContextDownload downloads the named resource and returns the path // to which it was downloaded. If the resource does not exist or has // not been uploaded yet then errors.NotFound is returned. // // Note that the downloaded file is checked for correctness.
[ "ContextDownload", "downloads", "the", "named", "resource", "and", "returns", "the", "path", "to", "which", "it", "was", "downloaded", ".", "If", "the", "resource", "does", "not", "exist", "or", "has", "not", "been", "uploaded", "yet", "then", "errors", ".",...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/context.go#L17-L45
153,894
juju/juju
resource/context/internal/context.go
NewContextDirectorySpec
func NewContextDirectorySpec(dataDir, name string, deps DirectorySpecDeps) ContextDirectorySpec { return &contextDirectorySpec{ DirectorySpec: NewDirectorySpec(dataDir, name, deps), } }
go
func NewContextDirectorySpec(dataDir, name string, deps DirectorySpecDeps) ContextDirectorySpec { return &contextDirectorySpec{ DirectorySpec: NewDirectorySpec(dataDir, name, deps), } }
[ "func", "NewContextDirectorySpec", "(", "dataDir", ",", "name", "string", ",", "deps", "DirectorySpecDeps", ")", "ContextDirectorySpec", "{", "return", "&", "contextDirectorySpec", "{", "DirectorySpec", ":", "NewDirectorySpec", "(", "dataDir", ",", "name", ",", "dep...
// NewContextDirectorySpec returns a new directory spec for the context.
[ "NewContextDirectorySpec", "returns", "a", "new", "directory", "spec", "for", "the", "context", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/context.go#L80-L84
153,895
juju/juju
api/instancemutater/mocks/caller_mock.go
NewMockAPICaller
func NewMockAPICaller(ctrl *gomock.Controller) *MockAPICaller { mock := &MockAPICaller{ctrl: ctrl} mock.recorder = &MockAPICallerMockRecorder{mock} return mock }
go
func NewMockAPICaller(ctrl *gomock.Controller) *MockAPICaller { mock := &MockAPICaller{ctrl: ctrl} mock.recorder = &MockAPICallerMockRecorder{mock} return mock }
[ "func", "NewMockAPICaller", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockAPICaller", "{", "mock", ":=", "&", "MockAPICaller", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockAPICallerMockRecorder", "{", "mock", ...
// NewMockAPICaller creates a new mock instance
[ "NewMockAPICaller", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/instancemutater/mocks/caller_mock.go#L30-L34
153,896
juju/juju
api/instancemutater/mocks/caller_mock.go
BakeryClient
func (m *MockAPICaller) BakeryClient() *httpbakery.Client { ret := m.ctrl.Call(m, "BakeryClient") ret0, _ := ret[0].(*httpbakery.Client) return ret0 }
go
func (m *MockAPICaller) BakeryClient() *httpbakery.Client { ret := m.ctrl.Call(m, "BakeryClient") ret0, _ := ret[0].(*httpbakery.Client) return ret0 }
[ "func", "(", "m", "*", "MockAPICaller", ")", "BakeryClient", "(", ")", "*", "httpbakery", ".", "Client", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", ...
// BakeryClient mocks base method
[ "BakeryClient", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/instancemutater/mocks/caller_mock.go#L54-L58
153,897
juju/juju
api/instancemutater/mocks/caller_mock.go
BestFacadeVersion
func (mr *MockAPICallerMockRecorder) BestFacadeVersion(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BestFacadeVersion", reflect.TypeOf((*MockAPICaller)(nil).BestFacadeVersion), arg0) }
go
func (mr *MockAPICallerMockRecorder) BestFacadeVersion(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BestFacadeVersion", reflect.TypeOf((*MockAPICaller)(nil).BestFacadeVersion), arg0) }
[ "func", "(", "mr", "*", "MockAPICallerMockRecorder", ")", "BestFacadeVersion", "(", "arg0", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",",...
// BestFacadeVersion indicates an expected call of BestFacadeVersion
[ "BestFacadeVersion", "indicates", "an", "expected", "call", "of", "BestFacadeVersion" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/instancemutater/mocks/caller_mock.go#L73-L75
153,898
juju/juju
api/instancemutater/mocks/caller_mock.go
ConnectControllerStream
func (m *MockAPICaller) ConnectControllerStream(arg0 string, arg1 url.Values, arg2 http.Header) (base.Stream, error) { ret := m.ctrl.Call(m, "ConnectControllerStream", arg0, arg1, arg2) ret0, _ := ret[0].(base.Stream) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockAPICaller) ConnectControllerStream(arg0 string, arg1 url.Values, arg2 http.Header) (base.Stream, error) { ret := m.ctrl.Call(m, "ConnectControllerStream", arg0, arg1, arg2) ret0, _ := ret[0].(base.Stream) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockAPICaller", ")", "ConnectControllerStream", "(", "arg0", "string", ",", "arg1", "url", ".", "Values", ",", "arg2", "http", ".", "Header", ")", "(", "base", ".", "Stream", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctr...
// ConnectControllerStream mocks base method
[ "ConnectControllerStream", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/instancemutater/mocks/caller_mock.go#L78-L83
153,899
juju/juju
api/instancemutater/mocks/caller_mock.go
ConnectStream
func (m *MockAPICaller) ConnectStream(arg0 string, arg1 url.Values) (base.Stream, error) { ret := m.ctrl.Call(m, "ConnectStream", arg0, arg1) ret0, _ := ret[0].(base.Stream) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockAPICaller) ConnectStream(arg0 string, arg1 url.Values) (base.Stream, error) { ret := m.ctrl.Call(m, "ConnectStream", arg0, arg1) ret0, _ := ret[0].(base.Stream) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockAPICaller", ")", "ConnectStream", "(", "arg0", "string", ",", "arg1", "url", ".", "Values", ")", "(", "base", ".", "Stream", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\""...
// ConnectStream mocks base method
[ "ConnectStream", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/instancemutater/mocks/caller_mock.go#L91-L96