anchor
dict
positive
dict
negative
dict
{ "audio": "", "image": "", "text": "func (mr *MockGenerationMockRecorder) AssignedUnits() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,", "video": "" }
{ "audio": "", "image": "", "text": " \"AssignedUnits\", reflect.TypeOf((*MockGeneration)(nil).AssignedUnits))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChangeConnectionID\", reflect.TypeOf((*MockCryptoSetup)(nil).ChangeConnectionID), arg0)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockGeneration) Commit(arg0 string) (int, error) {\n\tret := m.ctrl.Call(m, \"Commit\", arg0)\n\tret0,", "video": "" }
{ "audio": "", "image": "", "text": " _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockGeneration) Created() int64 {\n\tret := m.ctrl.Call(m, \"Created\")\n", "video": "" }
{ "audio": "", "image": "", "text": "\tret0, _ := ret[0].(int64)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAckFrame\", arg0)\n\tret0, _ := ret[0].(*wire.AckFrame)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockGeneration) CreatedBy() string {\n\tret := m.ctrl.Call(m, \"CreatedBy\")\n", "video": "" }
{ "audio": "", "image": "", "text": "\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAckFrame\", arg0)\n\tret0, _ := ret[0].(*wire.AckFrame)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockApplication) DefaultCharmConfig() (charm_v6.Settings, error) {\n\tret := m.ctrl.Call(m, \"DefaultCharmConfig\")\n\tret0,", "video": "" }
{ "audio": "", "image": "", "text": " _ := ret[0].(charm_v6.Settings)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockApplication) UnitNames() ([]string, error) {\n\tret := m.ctrl.Call(m, \"UnitNames\")\n\tret0, _", "video": "" }
{ "audio": "", "image": "", "text": " := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tret := m.ctrl.Call(m, \"Detach\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (b block) invoke(ch chan<- block) error {\n\tfor {\n\t\tselect {\n\t\tcase <-b.stop:\n\t\t\treturn errStopped\n\t\tcase <-b.cancel:\n\t\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " lease.ErrWaitCancelled\n\t\tcase ch <- b:\n\t\t\tch = nil\n\t\tcase <-b.unblock:\n\t\t\treturn nil\n\t\t}\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " 10000)\n\t\tchannel = b.clients[name]\n\t}\n\tb.mutex.Unlock()\n\n\t// Wait for a new event or done is closed\n\tselect {\n\tcase <-channel:\n\t\treturn\n\tcase <-b.done:\n\t\treturn\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (b blocks) add(block block) {\n\tb[block.leaseKey]", "video": "" }
{ "audio": "", "image": "", "text": " = append(b[block.leaseKey], block.unblock)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tblock.mtx.RLock()\n\tdefer block.mtx.RUnlock()\n\treturn block.hash\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (b blocks) unblock(lease lease.Key) {\n\tunblocks := b[lease]", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdelete(b, lease)\n\tfor _, unblock := range unblocks {\n\t\tclose(unblock)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " := d.lease\n\td.m.RUnlock()\n\treturn lease\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewLock(agentConfig agent.Config) gate.Lock {\n\tlock := gate.NewLock()\n\n\tif wrench.IsActive(wrenchKey(agentConfig), \"always-try-upgrade\") {\n\t\t// Always enter upgrade mode. This allows test of upgrades\n\t\t// even when there's actually no upgrade steps to run.\n\...
{ "audio": "", "image": "", "text": " := agentConfig.UpgradedToVersion()\n\tupgradedToVersion.Build = 0\n\tcurrentVersion := jujuversion.Current\n\tcurrentVersion.Build = 0\n\tif upgradedToVersion == currentVersion {\n\t\tlogger.Infof(\n\t\t\t\"upgrade steps for %v have already been run.\",\n\t\t\tjujuversion.Cur...
{ "audio": "", "image": "", "text": " bootstrap-params configmap for controller pod.\n\tif err = c.ensureControllerConfigmapBootstrapParams(); err != nil {\n\t\treturn errors.Annotate(err, \"creating bootstrap-params configmap for controller\")\n\t}\n\n\t// Note: create agent config configmap for controller pod l...
{ "audio": "", "image": "", "text": "func NewWorker(\n\tupgradeComplete gate.Lock,\n\tagent agent.Agent,\n\tapiConn api.Connection,\n\tjobs []multiwatcher.MachineJob,\n\topenState func() (*state.StatePool, error),\n\tpreUpgradeSteps func(st *state.StatePool, agentConf agent.Config, isController, isMasterServer, i...
{ "audio": "", "image": "", "text": " apiConn,\n\t\tjobs: jobs,\n\t\topenState: openState,\n\t\tpreUpgradeSteps: preUpgradeSteps,\n\t\tmachine: machine,\n\t\ttag: agent.CurrentConfig().Tag(),\n\t\tisCaas: isCaas,\n\t}\n\tw.tomb.Go(w.run)\n\treturn w, nil\n}", ...
{ "audio": "", "image": "", "text": "\treturn nil, err\n\t}\n\n\tfn := func(p *Plan) (BlockingParamVal, interface{}, error) {\n\t\tagent := p.client.Agent()\n\t\topts := makeQueryOptionsWithContext(p, false)\n\t\tdefer p.cancelFunc()\n\n\t\tleaf, meta, err := agent.ConnectCALeaf(serviceName, &opts)\n\t\tif err !=...
{ "audio": "", "image": "", "text": "func (w *upgradesteps) runUpgrades() error {\n\tupgradeInfo, err := w.prepareForUpgrade()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif wrench.IsActive(w.wrenchKey(), \"fail-upgrade\") {\n\t\treturn errors.New(\"wrench\")\n\t}\n", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif err := w.agent.ChangeConfig(w.runUpgradeSteps); err != nil {\n\t\treturn err\n\t}\n\n\tif err := w.finaliseUpgrade(upgradeInfo); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tw.err = err\n\t\treturn\n\t}\n\tif _, w.err = wb.FlushTo(arg2Writer); w.err != nil {\n\t\treturn\n\t}\n\tif w.err = arg2Writer.Close(); w.err != nil {\n\t\treturn\n\t}\n\n\tw.arg3Writer, w.err = w.response.Arg3Writer()\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (w *upgradesteps) runUpgradeSteps(agentConfig agent.ConfigSetter) error {\n\tvar upgradeErr error\n\tw.machine.SetStatus(status.Started, fmt.Sprintf(\"upgrading to %v\", w.toVersion), nil)\n\n\tstBackend := upgrades.NewStateBackend(w.pool)\n\tcontext := upgrades.NewContex...
{ "audio": "", "image": "", "text": "\n\t\t}\n\t\tif cmdutil.ConnectionIsDead(logger, w.apiConn) {\n\t\t\t// API connection has gone away - abort!\n\t\t\treturn &apiLostDuringUpgrade{upgradeErr}\n\t\t}\n\t\tif attempt.HasNext() {\n\t\t\tw.reportUpgradeFailure(upgradeErr, true)\n\t\t}\n\t}\n\tif upgradeErr != nil ...
{ "audio": "", "image": "", "text": "\n\n\tunitServices, allConfirmed, err := w.compareUnitAgentServices(w.preparedUnits)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif !allConfirmed {\n\t\tw.logger.Debugf(\n\t\t\t\"waiting for units to complete series upgrade preparation; known unit agent services: ...
{ "audio": "", "image": "", "text": "func jobsToTargets(jobs []multiwatcher.MachineJob, isMaster bool) (targets []upgrades.Target) {\n\tif jobs == nil {\n\t\treturn\n\t}\n\tfor _, job := range jobs {\n\t\tswitch job {\n\t\tcase multiwatcher.JobManageModel:\n\t\t\ttargets = append(targets, upgrades.Controller)\n\t...
{ "audio": "", "image": "", "text": "\ttargets = append(targets, upgrades.DatabaseMaster)\n\t\t\t}\n\t\tcase multiwatcher.JobHostUnits:\n\t\t\ttargets = append(targets, upgrades.HostMachine)\n\t\t}\n\t}\n\treturn\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t// by exactly one worker\n\tfor _, job := range jobs {\n\t\tp.jobs <- job\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (config Config) Validate() error {\n\tif config.Facade == nil {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\treturn errors.NotValidf(\"nil Facade\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tif err = dec.Decode(&config); err != nil {\n\t\treturn\n\t}\n\n\tconfig.Info.Version = os.ExpandEnv(config.Info.Version)\n\terr = config.Validate()\n\treturn\n}", "video": "" }
{ "audio": "", "image": "", "text": "func New(config Config) (worker.Worker, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tswConfig := watcher.StringsConfig{\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tHandler: &handler{config},\n\t}\n\treturn watcher.NewStringsWorker(swConfig)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tclient, err := client.New(\n\t\tconfig.TritonURL,\n\t\tconfig.MantaURL,\n\t\tconfig.AccountName,\n\t\tconfig.Signers...,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newServiceGroupClient(client), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (handler *handler) Handle(_ <-chan struct{}, applications []string) error {\n", "video": "" }
{ "audio": "", "image": "", "text": "\treturn handler.config.Facade.Rescale(applications)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn func(h echo.Handler) echo.Handler {\n\t\treturn echo.HandlerFunc(func(c echo.Context) error {\n\t\t\tacquire() // before request\n\t\t\terr := h.Handle(c)\n\t\t\trelease() // after request\n\t\t\treturn err\n\t\t})\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func docIDInt64(modelUUID string, localID int64)", "video": "" }
{ "audio": "", "image": "", "text": " string {\n\treturn modelUUID + \":\" + strconv.FormatInt(localID, 10)\n}", "video": "" }
{ "audio": "", "image": "", "text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewDeadWatcher(err error) *Watcher {\n\tvar w Watcher", "video": "" }
{ "audio": "", "image": "", "text": "\n\tw.tomb.Kill(errors.Trace(err))\n\treturn &w\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\twatcher, err := w.getOrCreateWatcher(req.DeploymentID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn watcher.PromoteDeployment(req, resp)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewWatcher(base *mgo.Collection, modelTag names.ModelTag) *Watcher {\n\tw := &Watcher{\n\t\tmodelUUID: modelTag.Id(),\n\t\tbase: base,\n\t\tpings: pingsC(base),\n\t\tbeings: beingsC(base),\n\t\tbeingKey: make(map[int64]string),\n\t\tbeingSeq: mak...
{ "audio": "", "image": "", "text": "\t// tomb expects ErrDying or ErrStillAlive as\n\t\t// exact values, so we need to log and unwrap\n\t\t// the error first.\n\t\tif err != nil && cause != tomb.ErrDying {\n\t\t\tlogger.Infof(\"watcher loop failed: %v\", err)\n\t\t}\n\t\treturn cause\n\t})\n\treturn w\n}", "vi...
{ "audio": "", "image": "", "text": " = make([]Handler, 0)\n\tfor _, handler := range handlers {\n\t\tw.Use(handler)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (w *Watcher) Watch(key string, ch chan<- Change) {", "video": "" }
{ "audio": "", "image": "", "text": "\n\tw.sendReq(reqWatch{key, ch})\n}", "video": "" }
{ "audio": "", "image": "", "text": " mod Modifier) bool {\n\treturn kb.key == key && kb.ch == ch && kb.mod == mod\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (w *Watcher) Unwatch(key string, ch chan<- Change) {", "video": "" }
{ "audio": "", "image": "", "text": "\n\tw.sendReq(reqUnwatch{key, ch})\n}", "video": "" }
{ "audio": "", "image": "", "text": " mod Modifier) bool {\n\treturn kb.key == key && kb.ch == ch && kb.mod == mod\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (w *Watcher) Sync() {\n\tdone := make(chan bool)\n\tw.sendReq(reqSync{done})\n\tselect {", "video": "" }
{ "audio": "", "image": "", "text": "\n\tcase <-done:\n\tcase <-w.tomb.Dying():\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\t\tif err := w.sync(); err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\tw.flush()\n\t\t\tfor _, done := range syncDone {\n\t\t\t\tclose(done)\n\t\t\t}\n\t\t\tw.syncsSinceLastPrune++\n\t\t\tw.checkShouldPrune()\n\t\tcase req := <-w.request:\n\t\t\tw.handle(re...
{ "audio": "", "image": "", "text": "func (w *Watcher) Alive(key string) (bool, error) {\n\tresult := make(chan bool, 1)\n\tw.sendReq(reqAlive{key, result})\n\tvar alive bool\n\tselect {\n", "video": "" }
{ "audio": "", "image": "", "text": "\tcase alive = <-result:\n\tcase <-w.tomb.Dying():\n\t\treturn false, errors.Errorf(\"cannot check liveness: watcher is dying\")\n\t}\n\tlogger.Tracef(\"[%s] Alive(%q) -> %v\", w.modelUUID[:6], key, alive)\n\treturn alive, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " bufferSize,\n\t\tBuffer: make(chan *Package, bufferSize*2),\n\t\tflushStatus: make(chan chan bool, 1),\n\t\tflushCommand: make(chan bool, bufferSize*2),\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (w *Watcher) loop() error {\n\tvar err error\n\tif w.delta, err = clockDelta(w.base); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\t// Always sync before handling request.\n\tif err := w.sync(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tw.next = time.After(t...
{ "audio": "", "image": "", "text": "\n\t\t\tif err := w.sync(); err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\tw.flush()\n\t\t\tfor _, done := range syncDone {\n\t\t\t\tclose(done)\n\t\t\t}\n\t\t\tw.syncsSinceLastPrune++\n\t\t\tw.checkShouldPrune()\n\t\tcase req := <-w.request:\n\t\t\tw.handle(re...
{ "audio": "", "image": "", "text": "\n\n\tunitServices, allConfirmed, err := w.compareUnitAgentServices(w.preparedUnits)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif !allConfirmed {\n\t\tw.logger.Debugf(\n\t\t\t\"waiting for units to complete series upgrade preparation; known unit agent services: ...
{ "audio": "", "image": "", "text": "func (w *Watcher) checkShouldPrune() {\n\tchanceToPrune := float64(w.syncsSinceLastPrune) * psuedoRandomFactor\n\tif chanceToPrune < 1.0 && rand.Float64() > chanceToPrune {\n\t\treturn\n\t}\n\t// When we decide to prune, we also drop our old cached beings\n\tlogger.Debugf(\"wa...
{ "audio": "", "image": "", "text": "\n\tpruner := NewPruner(w.modelUUID, w.beings, w.pings, w.delta)\n\terr := pruner.Prune(w.ignoredSeqs)\n\tif err != nil {\n\t\tlogger.Warningf(\"error while pruning %q for %q: %v\", w.beings.Name, w.modelUUID, err)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " to encode\n\t// the literalEncoding and the offsetEncoding.\n\tw.generateCodegen(numLiterals, numOffsets, w.literalEncoding, w.offsetEncoding)\n\tw.codegenEncoding.generate(w.codegenFreq[:], 7)\n\tdynamicSize, numCodegens := w.dynamicSize(w.literalEncoding, w.offsetEncoding, ...
{ "audio": "", "image": "", "text": "func decompressPings(maps []map[string]int64) ([]int64, error) {\n\tif len(maps) == 0 {\n\t\treturn nil, nil\n\t}\n\t// First step, merge all value structures together.\n\t// Every ping has a bit field in an int64. However, bitwise-or preserves\n\t// everything that was ever a...
{ "audio": "", "image": "", "text": " range baseToBits {\n\t\tbase, err := strconv.ParseInt(hexbase, 16, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotatef(err, \"presence cannot parse alive key: %q\", base)\n\t\t}\n\t\tbase *= 63\n\t\tfor i := int64(0); i < 63 && bits > 0; i++ {\n\t\t\ton := (bits&1 ==...
{ "audio": "", "image": "", "text": " _, c := range actual {\n\t\t// remove value c from exp\n\t\tfor i := 0; i < len(exp); i++ {\n\t\t\tif exp[i] == c {\n\t\t\t\texp = removeListElement(exp, i)\n\t\t\t\tif len(exp) == 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn len(exp) == 0\n}", "vide...
{ "audio": "", "image": "", "text": "func (w *Watcher) sync() error {\n\tsession := w.pings.Database.Session.Copy()\n\tdefer session.Close()\n\tpings, err := w.lookupPings(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdead, err := w.lookForDead(pings)\n\tif err != nil {\n\t\treturn err\n\t}\n\talive, unknow...
{ "audio": "", "image": "", "text": " dead. Dispatch\n\t// the respective events and forget their sequences.\n\tfor seq, key := range w.beingKey {\n\t\tif dead[seq] || !alive[seq] {\n\t\t\tlogger.Tracef(\"[%s] removing seq=%d with key %q\", w.modelUUID[:6], seq, key)\n\t\t\tdelete(w.beingKey, seq)\n\t\t\tdelete(w...
{ "audio": "", "image": "", "text": "\tctx := context.Background()\n\t_, err := w.session.Execute(ctx, \"BEGIN\")\n\tif err != nil {\n\t\treturn false, 0, errors.Trace(err)\n\t}\n\tdoGC, safePoint, err := w.checkPrepare(ctx)\n\tif doGC {\n\t\t_, err = w.session.Execute(ctx, \"COMMIT\")\n\t\tif err != nil {\n\t\t\...
{ "audio": "", "image": "", "text": "func NewPinger(base *mgo.Collection, modelTag names.ModelTag, key string, recorderFunc func() PingRecorder) *Pinger {\n\treturn &Pinger{\n\t\tbase: base,\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\tpings: pingsC(base),\n\t\tbeingKey: key,\n\t\tmodelUUID: modelTag.Id(),\n\t\trecorderFunc: recorderFunc,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tBase: base,\n\t\tUploadType: JSON,\n\t\tErrorParser: DefaultErrorParser,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) Start() error {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif p.started {\n\t\treturn errors.Errorf(\"pinger already started\")\n\t}\n\tp.tomb = tomb.Tomb{}\n\tif err := p.prepare(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tlogger.Tracef(\"[%s] startin...
{ "audio": "", "image": "", "text": "\t\t// tomb expects ErrDying or ErrStillAlive as\n\t\t// exact values, so we need to log and unwrap\n\t\t// the error first.\n\t\tif err != nil && cause != tomb.ErrDying {\n\t\t\tlogger.Infof(\"pinger loop failed: %v\", err)\n\t\t}\n\t\treturn cause\n\t})\n\treturn nil\n}", ...
{ "audio": "", "image": "", "text": " error {\n\tp.mu.Lock()\n\tp.Points = append(p.Points, points...)\n\terr := p.Err\n\tp.mu.Unlock()\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) Stop() error {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif p.started {\n\t\tlogger.Tracef(\"[%s] stopping pinger for %q with seq=%d\", p.modelUUID[:6], p.beingKey, p.beingSeq)\n\t}\n\tp.tomb.Kill(nil)\n", "video": "" }
{ "audio": "", "image": "", "text": "\terr := p.tomb.Wait()\n\t// TODO ping one more time to guarantee a late timeout.\n\tp.started = false\n\treturn errors.Trace(err)\n\n}", "video": "" }
{ "audio": "", "image": "", "text": " error {\n\tp.mu.Lock()\n\tp.Points = append(p.Points, points...)\n\terr := p.Err\n\tp.mu.Unlock()\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) killStarted() error {\n\tp.tomb.Kill(nil)\n\tkillErr := p.tomb.Wait()\n\tp.started = false\n\n\tslot := p.lastSlot\n\tudoc := bson.D{\n\t\t{\"$set\", bson.D{{\"slot\", slot}}},\n\t\t{\"$inc\", bson.D{{\"dead.\" + p.fieldKey, p.fieldBit}}}}\n\tsession := p.ping...
{ "audio": "", "image": "", "text": " session.Close()\n\tpings := p.pings.With(session)\n\tif _, err := pings.UpsertId(docIDInt64(p.modelUUID, slot), udoc); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\treturn errors.Trace(killErr)\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tp := &DeleteProjectParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) killStopped() error {\n\tif err := p.prepare(); err != nil {\n\t\treturn err\n\t}\n\t// TODO(perrito666) 2016-05-02 lp:1558657\n\tslot := timeSlot(time.Now(), p.delta)\n\tudoc := bson.D{\n\t\t{\"$set\", bson.D{{\"slot\", slot}}},\n\t\t{\"$inc\", bson.D{\n\t\t\...
{ "audio": "", "image": "", "text": " p.fieldBit},\n\t\t}}}\n\tsession := p.pings.Database.Session.Copy()\n\tdefer session.Close()\n\tpings := p.pings.With(session)\n\t_, err := pings.UpsertId(docIDInt64(p.modelUUID, slot), udoc)\n\treturn errors.Trace(err)\n}", "video": "" }
{ "audio": "", "image": "", "text": " + \" \" + p.LastName)\n\tif fname == \"\" {\n\t\treturn p.Email\n\t}\n\n\treturn fname\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) loop() error {\n\tfor {\n\t\tselect {\n\t\tcase <-p.tomb.Dying():\n\t\t\treturn errors.Trace(tomb.ErrDying)\n\t\tcase <-time.After(time.Duration(float64(period+1)*0.75)", "video": "" }
{ "audio": "", "image": "", "text": " * time.Second):\n\t\t\tif err := p.ping(); err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t}\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tcase <-time.After(randStagger):\n\tcase <-stop:\n\t\treturn\n\t}\n\tfor {\n\t\tselect {\n\t\tcase <-C:\n\t\t\tf()\n\t\tcase <-stop:\n\t\t\treturn\n\t\t}\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) prepare() error {\n\tchange := mgo.Change{\n\t\tUpdate: bson.D{{\"$inc\", bson.D{{\"seq\", int64(1)}}}},\n\t\tUpsert: true,\n\t\tReturnNew: true,\n\t}\n\tsession := p.base.Database.Session.Copy()\n\tdefer session.Close()\n\tbase := p.base.With(session)\n...
{ "audio": "", "image": "", "text": "\tseqID := docIDStr(p.modelUUID, \"beings\")\n\tif _, err := seqs.FindId(seqID).Apply(change, &seq); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tp.beingSeq = seq.Seq\n\tp.fieldKey = fmt.Sprintf(\"%x\", p.beingSeq/63)\n\tp.fieldBit = 1 << uint64(p.beingSeq%63)\n\tp.lastS...
{ "audio": "", "image": "", "text": "\tm += MEDIAL_BASE\n\tif t != 0 {\n\t\tt += TAIL_BASE - 1\n\t}\n\n\treturn\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *Pinger) ping() (err error) {\n\tlogger.Tracef(\"[%s] pinging %q with seq=%d\", p.modelUUID[:6], p.beingKey, p.beingSeq)\n\tdefer func() {\n\t\t// If the session is killed from underneath us, it panics when we\n\t\t// try to copy it, so deal with that here.\n\t\tif v :...
{ "audio": "", "image": "", "text": " delta\n\t}\n\t// TODO(perrito666) 2016-05-02 lp:1558657\n\tslot := timeSlot(time.Now(), p.delta)\n\tif slot == p.lastSlot {\n\t\t// Never, ever, ping the same slot twice.\n\t\t// The increment below would corrupt the slot.\n\t\treturn nil\n\t}\n\tp.lastSlot = slot\n\tp.record...
{ "audio": "", "image": "", "text": "\t\tp := ProtocolWithName(name)\n\t\tif p.Code == 0 {\n\t\t\treturn nil, fmt.Errorf(\"no protocol with name: %s\", name)\n\t\t}\n\t\tt[i] = p\n\t}\n\treturn t, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func clockDelta(c *mgo.Collection) (time.Duration, error) {\n\tvar server struct {\n\t\ttime.Time `bson:\"retval\"`\n\t}\n\tvar isMaster struct {\n\t\tLocalTime time.Time `bson:\"localTime\"`\n\t}\n\tvar after time.Time\n\tvar before time.Time\n\tvar serverDelay time.Duration\...
{ "audio": "", "image": "", "text": " a busy server.\n\t\t\t// TODO(perrito666) 2016-05-02 lp:1558657\n\t\t\tbefore = time.Now()\n\t\t\terr := db.Run(bson.D{{\"$eval\", \"function() { return new Date(); }\"}}, &server)\n\t\t\t// TODO(perrito666) 2016-05-02 lp:1558657\n\t\t\tafter = time.Now()\n\t\t\tif err != nil...
{ "audio": "", "image": "", "text": "\t} else {\n\t\t\t// Compute the time the ackTimer should fire, based\n\t\t\t// on the given next expiration time and now.\n\t\t\tfireIn := (nextExpirationTime - now)\n\t\t\tsub.ackTimer.Reset(time.Duration(fireIn))\n\t\t}\n\t} else {\n\t\t// No more pending acks, clear the ti...
{ "audio": "", "image": "", "text": "func timeSlot(now time.Time, delta time.Duration) int64 {\n\tfakeMutex.Lock()\n\tfake := !fakeNow.IsZero()\n\tif fake {\n\t\tnow = fakeNow\n\t}\n\tslot := now.Add(delta).Unix()\n\tslot -= slot % period", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif fake {\n\t\tslot += int64(fakeOffset) * period\n\t}\n\tfakeMutex.Unlock()\n\treturn slot\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tswitch d {\n\t\t\t\tcase time.Millisecond:\n\t\t\t\t\tts = time.Unix(int64(i/1000), 1000000*int64(i%1000))\n\t\t\t\tcase time.Second:\n\t\t\t\t\tts = time.Unix(int64(i), 0)\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(\"invalid time unit (d). Fixme!\")\n\t\t\t\t}\n\t\t\t\tnow := m.now...
{ "audio": "", "image": "", "text": "func realTimeSlot() {\n\tfakeMutex.Lock()\n\tfakeNow = time.Time{}\n\tfakeOffset = 0\n\tfakeMutex.Unlock()", "video": "" }
{ "audio": "", "image": "", "text": "\n\tlogger.Infof(\"not faking presence time. Real time slot in use.\")\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tah.timer = time.AfterFunc(timeout, func() {\n\t\tm.ackLock.Lock()\n\t\tdelete(m.ackHandlers, seqNo)\n\t\tm.ackLock.Unlock()\n\t})\n}", "video": "" }
{ "audio": "", "image": "", "text": "func RemovePresenceForModel(base *mgo.Collection, modelTag names.ModelTag) error {\n\terrs := make([]error, 0)\n\tfor _, f := range []func(*mgo.Collection) *mgo.Collection{pingsC, beingsC, seqsC} {\n\t\terr := removeModelFromCollection(f(base), modelTag.Id())\n\t\tif err != ni...
{ "audio": "", "image": "", "text": "\t\terrs = append(errs, err)\n\t\t}\n\t}\n\tif len(errs) != 0 {\n\t\treturn errors.Errorf(\"errors removing presence for model %q: %v\", modelTag.Id(), errs)\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t} else {\n\t\tfmt.Printf(\"FAIL [%s]\\n\", F.Name)\n\t\tfor _, e := range F.Errs {\n\t\t\tfmt.Println(\" - \", e)\n\t\t}\n\t}\n\n\treturn F\n}", "video": "" }
{ "audio": "", "image": "", "text": "func CheckName(name string) (string, error) {\n\t// Validate given name.\n\tif !names.IsValidSpace(name) {\n\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " \"\", errors.Errorf(\"%q is not a valid space name\", name)\n\t}\n\treturn name, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " tg.Name == name {\n\t\t\treturn tg\n\t\t}\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func CheckCIDRs(args []string, cidrsOptional bool) (set.Strings, error) {\n\t// Validate any given CIDRs.\n\tCIDRs := set.NewStrings()\n\tfor _, arg := range args {\n\t\t_, ipNet, err := net.ParseCIDR(arg)\n\t\tif err != nil {\n\t\t\tlogger.Debugf(\"cannot parse %q: %v\", arg,...
{ "audio": "", "image": "", "text": " %q specified\", cidr)\n\t\t\t}\n\t\t\treturn CIDRs, errors.Errorf(\"subnet %q overlaps with %q\", arg, cidr)\n\t\t}\n\t\tCIDRs.Add(cidr)\n\t}\n\n\tif CIDRs.IsEmpty() && !cidrsOptional {\n\t\treturn CIDRs, errors.New(\"CIDRs required but not provided\")\n\t}\n\n\treturn CIDRs,...
{ "audio": "", "image": "", "text": " cidr := range strings.Split(value, \",\") {\n\t\t_, ipnet, err := net.ParseCIDR(cidr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.ipn.Insert(ipnet)\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c *SpaceCommandBase) NewAPI() (SpaceAPI, error) {\n\tif c.api != nil {\n\t\t// Already addd.\n\t\treturn c.api, nil\n\t}\n\troot, err := c.NewAPIRoot()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\t// This is", "video": "" }
{ "audio": "", "image": "", "text": " tested with a feature test.\n\tshim := &mvpAPIShim{\n\t\tapiState: root,\n\t\tfacade: spaces.NewAPI(root),\n\t}\n\treturn shim, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn api.ExportInspect(ctx, c.API, id)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func updateCharmDir(opState operation.State, guard fortress.Guard, abort fortress.Abort) error {\n\tvar changing bool\n\n\t// Determine if the charm content is changing.\n\tif opState.Kind == operation.Install || opState.Kind == operation.Upgrade {\n\t\tchanging = true\n\t} el...
{ "audio": "", "image": "", "text": "\n\n\tavailable := opState.Started && !opState.Stopped && !changing\n\tlogger.Tracef(\"charmdir: available=%v opState: started=%v stopped=%v changing=%v\",\n\t\tavailable, opState.Started, opState.Stopped, changing)\n\tif available {\n\t\treturn guard.Unlock()\n\t} else {\n\t\...
{ "audio": "", "image": "", "text": " upgrade is\n\t\t// fixed we can't fail the validation if it does.\n\t\tif hasHook {\n\t\t\tlogger.Errorf(\"unexpected hook info with Kind Continue\")\n\t\t}\n\t\tswitch {\n\t\tcase hasCharm:\n\t\t\treturn errors.New(\"unexpected charm URL\")\n\t\tcase hasActionId:\n\t\t\tretu...
{ "audio": "", "image": "", "text": "func NewMockStorageV1Interface(ctrl *gomock.Controller) *MockStorageV1Interface {\n\tmock := &MockStorageV1Interface{ctrl:", "video": "" }
{ "audio": "", "image": "", "text": " ctrl}\n\tmock.recorder = &MockStorageV1InterfaceMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " sync,\n\t}\n\n\tcontroller.logger.Log(\"info\", \"setting up event handlers\")\n\n\t// ----- EVENT HANDLERS for HelmRelease resources change ---------\n\tfhrInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(new interface{}) {\n...
{ "audio": "", "image": "", "text": "func (m *MockStorageV1Interface) StorageClasses() v11.StorageClassInterface", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tret := m.ctrl.Call(m, \"StorageClasses\")\n\tret0, _ := ret[0].(v11.StorageClassInterface)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tret := m.ctrl.Call(m, \"StatefulSets\", arg0)\n\tret0, _ := ret[0].(v11.StatefulSetInterface)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockStorageClassInterface(ctrl *gomock.Controller) *MockStorageClassInterface", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockStorageClassInterface{ctrl: ctrl}\n\tmock.recorder = &MockStorageClassInterfaceMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn \"\", errors.Annotate(err, \"resolving controller name\")\n\t}\n\treturn ctrl.ControllerUUID, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mig *modelMigration) Phase() (migration.Phase, error) {\n\tphase, ok := migration.ParsePhase(mig.statusDoc.Phase)", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif !ok {\n\t\treturn phase, errors.Errorf(\"invalid phase in DB: %v\", mig.statusDoc.Phase)\n\t}\n\treturn phase, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tupdates := getMigrations(versions, curVersion)\n\treturn t.db.Update(func(tx *bbolt.Tx) error {\n\t\tfor _, update := range updates {\n\t\t\tif update.migration == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Infof(\"Applying migration #%d\", update.number)\n\n\t\t\terr := ...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) TargetInfo() (*migration.TargetInfo, error) {\n\tauthTag, err := names.ParseUserTag(mig.doc.TargetAuthTag)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tmacs, err := jsonToMacaroons(mig.doc.TargetMacaroons)\n\tif err != nil {\n\t\tret...
{ "audio": "", "image": "", "text": "\t\tControllerAlias: mig.doc.TargetControllerAlias,\n\t\tAddrs: mig.doc.TargetAddrs,\n\t\tCACert: mig.doc.TargetCACert,\n\t\tAuthTag: authTag,\n\t\tPassword: mig.doc.TargetPassword,\n\t\tMacaroons: macs,\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " doc.DocID,\n\t\t\t\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.M{\"$set\": bson.M{\"settings\": doc.Settings}},\n\t\t\t})\n\t\t}\n\t}\n\tif err := iter.Close(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif len(ops) > 0 {\n\t\treturn errors.Trace(st.runRawTransactio...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) SetPhase(nextPhase migration.Phase) error {\n\tnow := mig.st.clock().Now().UnixNano()\n\n\tphase, err := mig.Phase()\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\tif nextPhase == phase {\n\t\treturn nil // Already at that phase. Nothing ...
{ "audio": "", "image": "", "text": "\treturn errors.Trace(err)\n\t}\n\n\t// If the migration aborted, make the model active again.\n\tif nextPhase == migration.ABORTDONE {\n\t\tops = append(ops, txn.Op{\n\t\t\tC: modelsC,\n\t\t\tId: mig.doc.ModelUUID,\n\t\t\tAssert: txn.DocExists,\n\t\t\tUpdate: bson.M{...
{ "audio": "", "image": "", "text": "\t\tif c.support.IsSystemChannel() {\n\t\t\tif c.support.SharedConfig().ConsensusMigrationState() == orderer.ConsensusType_MIG_STATE_COMMIT {\n\t\t\t\tstartOfChain = true\n\t\t\t}\n\t\t} else {\n\t\t\tif c.support.SharedConfig().ConsensusMigrationState() == orderer.ConsensusTy...
{ "audio": "", "image": "", "text": "func migStatusHistoryAndOps(st *State, phase migration.Phase, now int64, msg string) ([]txn.Op, error) {\n\tswitch phase {\n\tcase migration.REAP, migration.DONE:\n\t\t// if we're reaping/have reaped the model, setting status on it is both\n\t\t// pointless and potentially pro...
{ "audio": "", "image": "", "text": " \"\" {\n\t\tmsg = \"migrating: \" + msg\n\t}\n\tdoc := statusDoc{\n\t\tStatus: modelStatus,\n\t\tStatusInfo: msg,\n\t\tUpdated: now,\n\t}\n\n\tops, err := statusSetOps(st.db(), doc, globalKey)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tprobablyUpdate...
{ "audio": "", "image": "", "text": "\n\t}\n\n\tmodel, err := st.Model()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tif model.Type() == state.ModelTypeCAAS {\n\t\treturn nil, errors.NotSupportedf(\"high availability on kubernetes controllers\")\n\t}\n\n\treturn &HighAvailabilityAPI{\n\t\tstate: ...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) SetStatusMessage(text string) error {\n\tphase, err := mig.Phase()\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\tops, err := migStatusHistoryAndOps(mig.st, phase, mig.st.clock().Now().UnixNano(), text)\n\tif err != nil {\n\t\treturn erro...
{ "audio": "", "image": "", "text": " txn.DocExists,\n\t})\n\tif err := mig.st.db().RunTransaction(ops); err != nil {\n\t\treturn errors.Annotate(err, \"failed to set migration status\")\n\t}\n\tmig.statusDoc.StatusMessage = text\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\n\t\tops = append(ops, txn.Op{\n\t\t\tC: permissionsC,\n\t\t\tId: id,\n\t\t\tAssert: txn.DocExists,\n\t\t\tUpdate: bson.D{{\"$set\", bson.D{{\"access\", \"add-model\"}}}},\n\t\t})\n\t}\n\tif err := iter.Close(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tre...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) SubmitMinionReport(tag names.Tag, phase migration.Phase, success bool) error {\n\tglobalKey, err := agentTagToGlobalKey(tag)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tdocID := mig.minionReportId(phase, globalKey)\n\tdoc := modelMigMini...
{ "audio": "", "image": "", "text": " {\n\t\tcoll, closer := mig.st.db().GetCollection(migrationsMinionSyncC)\n\t\tdefer closer()\n\t\tvar existingDoc modelMigMinionSyncDoc\n\t\terr := coll.FindId(docID).Select(bson.M{\"success\": 1}).One(&existingDoc)\n\t\tif err != nil {\n\t\t\treturn errors.Annotate(err, \"che...
{ "audio": "", "image": "", "text": "\tC: firewallRulesC,\n\t\t\t\tId: serviceStr,\n\t\t\t\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.D{\n\t\t\t\t\t{\"$set\", bson.D{{\"whitelist-cidrs\", rule.WhitelistCIDRs}}},\n\t\t\t\t},\n\t\t\t}, model.assertActiveOp()}\n\t\t} else {\n\t\t\tdoc.WhitelistCIDRS = ru...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) MinionReports() (*MinionReports, error) {\n\tall, err := mig.getAllAgents()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tphase, err := mig.Phase()\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"retrieving phase\")\n\t}\...
{ "audio": "", "image": "", "text": "\n\t\treturn nil, errors.Annotate(err, \"retrieving minion reports\")\n\t}\n\n\tsucceeded := names.NewSet()\n\tfailed := names.NewSet()\n\tfor _, doc := range docs {\n\t\tentityKey, ok := doc[\"entity-key\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"unexpected ...
{ "audio": "", "image": "", "text": " doc.DocID,\n\t\t\t\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.M{\"$set\": bson.M{\"settings\": doc.Settings}},\n\t\t\t})\n\t\t}\n\t}\n\tif err := iter.Close(); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif len(ops) > 0 {\n\t\treturn errors.Trace(st.runRawTransactio...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) WatchMinionReports() (NotifyWatcher, error) {\n\tphase, err := mig.Phase()\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"retrieving phase\")\n\t}\n\tprefix := mig.minionReportId(phase, \"\")\n\tfilter := func(rawId interface{}) bool {\n\...
{ "audio": "", "image": "", "text": " rawId.(string)\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\treturn strings.HasPrefix(id, prefix)\n\t}\n\treturn newNotifyCollWatcher(mig.st, migrationsMinionSyncC, filter), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " err != nil {\n\t\treturn empty, errors.Annotate(err, \"retrieving model owner\")\n\t}\n\n\tvers, err := api.backend.AgentVersion()\n\tif err != nil {\n\t\treturn empty, errors.Annotate(err, \"retrieving agent version\")\n\t}\n\n\treturn params.MigrationModelInfo{\n\t\tUUID: ...
{ "audio": "", "image": "", "text": "func (mig *modelMigration) Refresh() error {\n\t// Only the status document is updated. The modelMigDoc is static\n\t// after creation.\n\tstatusColl, closer := mig.st.db().GetCollection(migrationsStatusC)\n\tdefer closer()\n\tvar statusDoc modelMigStatusDoc\n\terr := statusCo...
{ "audio": "", "image": "", "text": " errors.NotFoundf(\"migration status\")\n\t} else if err != nil {\n\t\treturn errors.Annotate(err, \"migration status lookup failed\")\n\t}\n\n\tmig.statusDoc = statusDoc\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " = conn.Repository().FindId(name).One(&r)\n\tif err == mgo.ErrNotFound {\n\t\treturn r, ErrRepositoryNotFound\n\t}\n\treturn r, err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (mig *modelMigration) ModelUserAccess(tag names.Tag) permission.Access {\n\tid := tag.Id()\n\tfor _, user := range mig.doc.ModelUsers {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tif user.UserID == id {\n\t\t\treturn user.Access\n\t\t}\n\t}\n\n\treturn permission.NoAccess\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn newrelationNetworksWatcher(r.st, r.Tag().Id(), ingress)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (spec *MigrationSpec) Validate() error {\n\tif !names.IsValidUser(spec.InitiatedBy.Id()) {\n\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " errors.NotValidf(\"InitiatedBy\")\n\t}\n\treturn spec.TargetInfo.Validate()\n}", "video": "" }
{ "audio": "", "image": "", "text": " i := range b.Spec.Steps {\n\t\tif b.Spec.Steps[i].WorkingDir != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tb.Spec.Steps[i].WorkingDir = wd.Value\n\t}\n\tif b.Spec.Template != nil {\n\t\t// Best we can do for a template is to set WORKDIR\n\t\tb.Spec.Template.Arguments = append(b.Spec....
{ "audio": "", "image": "", "text": "func (st *State) Migration(id string) (ModelMigration, error) {\n\tmigColl, closer := st.db().GetCollection(migrationsC)", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdefer closer()\n\tmig, err := st.migrationFromQuery(migColl.FindId(id))\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn mig, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\top := addr.st.networkEntityGlobalKeyRemoveOp(\"address\", addr.ProviderID())\n\t\tops = append(ops, op)\n\t}\n\treturn addr.st.db().RunTransaction(ops)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func IsMigrationActive(st *State, modelUUID string) (bool, error) {\n\tactive, closer := st.db().GetCollection(migrationsActiveC)", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdefer closer()\n\tn, err := active.FindId(modelUUID).Count()\n\tif err != nil {\n\t\treturn false, errors.Trace(err)\n\t}\n\treturn n > 0, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\top := addr.st.networkEntityGlobalKeyRemoveOp(\"address\", addr.ProviderID())\n\t\tops = append(ops, op)\n\t}\n\treturn addr.st.db().RunTransaction(ops)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (housing Housing) Decorate(base dependency.Manifold) dependency.Manifold {\n\tmanifold := base\n\t// Apply Occupy wrapping first, so that it will be the last\n\t// wrapper to execute before calling the original Start func, so\n\t// as to minimise the time we hold the fort...
{ "audio": "", "image": "", "text": " housing.Occupy)\n\t}\n\tfor _, name := range housing.Flags {\n\t\tmanifold.Inputs = maybeAdd(manifold.Inputs, name)\n\t\tmanifold.Start = flagStart(manifold.Start, name)\n\t}\n\tif housing.Filter != nil {\n\t\tmanifold.Filter = housing.Filter\n\t}\n\treturn manifold\n}", "v...
{ "audio": "", "image": "", "text": "\t// the monitoring goroutine may be in a select on the lockCh, so we need to\n\t// wait for it to return before changing the value.\n\tc.monitorWG.Wait()\n\tc.lockCh = nil\n\n\t// This is only cleanup, and will fail if the lock was immediately taken by\n\t// another client, s...
{ "audio": "", "image": "", "text": "func (a API) List(args params.PayloadListArgs) (params.PayloadListResults, error) {\n\tvar r params.PayloadListResults\n\n\tpayloads, err := a.backend.ListAll()\n\tif err != nil {\n\t\treturn r, errors.Trace(err)\n\t}\n\n\tfilters, err := payload.BuildPredicatesFor(args.Patter...
{ "audio": "", "image": "", "text": " errors.Trace(err)\n\t}\n\tpayloads = payload.Filter(payloads, filters...)\n\n\tfor _, payload := range payloads {\n\t\tapiInfo := api.Payload2api(payload)\n\t\tr.Results = append(r.Results, apiInfo)\n\t}\n\treturn r, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " *ole.VARIANT) {\n\tr, err := GetProperty(disp, name, params...)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn r\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m ManagerConfig) PopValue(key string)", "video": "" }
{ "audio": "", "image": "", "text": " string {\n\tvalue := m[key]\n\tdelete(m, key)\n\treturn value\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tvalue(&meta)\n\tm.Key = meta.Key\n\tm.ValueKind = meta.ValueKind\n\tm.ValueString = meta.ValueString\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m ManagerConfig) WarnAboutUnused() {\n\tfor key, value", "video": "" }
{ "audio": "", "image": "", "text": " := range m {\n\t\tlogger.Infof(\"unused config option: %q -> %q\", key, value)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " interface{}) {\n\tfor key, value := range serializers {\n\t\tl.serializers[string(key)] = value\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (h *RestHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvar err error\n\tswitch r.Method {\n\tcase \"GET\":\n\t\terr = errors.Annotate(h.GetHandler(w, r), \"cannot retrieve model data\")\n\tdefault:\n\t\terr = emitUnsupportedMethodErr(r.Method)\n\t}\n\...
{ "audio": "", "image": "", "text": " nil {\n\t\tif err := sendJSONError(w, r, errors.Trace(err)); err != nil {\n\t\t\tlogger.Errorf(\"%v\", errors.Annotate(err, \"cannot return error to user\"))\n\t\t}\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " *http.Request) {\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\tw = &autoOptionsProxy{c: c, w: w}\n\t\t}\n\n\t\th.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (h *modelRestHandler) ServeGet(w http.ResponseWriter, r *http.Request) error {\n\tif r.Method != \"GET\" {\n\t\treturn errors.Trace(emitUnsupportedMethodErr(r.Method))\n", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\n\tst, _, err := h.ctxt.stateForRequestAuthenticated(r)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tdefer st.Release()\n\n\treturn errors.Trace(h.processGet(r, w, st.State))\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\treturn http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\thandleTimeout(timeout, rw, func() { h.ServeHTTP(rw, r) })\n\t\t})\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (h *modelRestHandler) processGet(r *http.Request, w http.ResponseWriter, st *state.State) error {\n\tquery := r.URL.Query()\n\tentity := query.Get(\":entity\")\n", "video": "" }
{ "audio": "", "image": "", "text": "\t// TODO(wallyworld) - support more than just \"remote-application\"\n\tswitch entity {\n\tcase \"remote-application\":\n\t\treturn h.processRemoteApplication(r, w, st)\n\tdefault:\n\t\treturn errors.NotSupportedf(\"entity %v\", entity)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " func(responseWriter http.ResponseWriter, request *http.Request) {\n\t\thttp.ServeFile(responseWriter, request, filePath)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (h *modelRestHandler) processRemoteApplication(r *http.Request, w http.ResponseWriter, st *state.State) error {\n\tquery := r.URL.Query()\n\tname := query.Get(\":name\")\n\tremoteApp, err := st.RemoteApplication(name)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\...
{ "audio": "", "image": "", "text": "\n\tstore := storage.NewStorage(sourceSt.ModelUUID(), sourceSt.MongoSession())\n\t// Use the storage to retrieve and save the charm archive.\n\tcharmPath, err := common.ReadCharmFromStorage(store, h.dataDir, ch.StoragePath())\n\tif errors.IsNotFound(err) {\n\t\treturn h.byteSe...
{ "audio": "", "image": "", "text": "\tif n := len(modelUUIDs) - 1; n > 0 {\n\t\t\treturn errors.Trace(hasHostedModelsError(n))\n\t\t}\n\t}\n\n\tmodelEntityRefsDoc, err := model.getEntityRefs()\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif _, err := checkModelEntityRefsEmpty(modelEntityRefsDoc); err...
{ "audio": "", "image": "", "text": "func NewMockNotifyWatcher(ctrl *gomock.Controller) *MockNotifyWatcher {\n\tmock := &MockNotifyWatcher{ctrl: ctrl}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tmock.recorder = &MockNotifyWatcherMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockDockerMetadataClient{ctrl: ctrl}\n\tmock.recorder = &MockDockerMetadataClientMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockStringsWatcher(ctrl *gomock.Controller) *MockStringsWatcher {\n\tmock := &MockStringsWatcher{ctrl:", "video": "" }
{ "audio": "", "image": "", "text": " ctrl}\n\tmock.recorder = &MockStringsWatcherMockRecorder{mock}\n\treturn mock\n}", "video": "" }
{ "audio": "", "image": "", "text": " sync,\n\t}\n\n\tcontroller.logger.Log(\"info\", \"setting up event handlers\")\n\n\t// ----- EVENT HANDLERS for HelmRelease resources change ---------\n\tfhrInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(new interface{}) {\n...
{ "audio": "", "image": "", "text": "func checkImageList(c EnvironAPI) ([]*imagemetadata.ImageMetadata, error) {\n\tif c == nil {\n\t\treturn nil, errors.NotFoundf(\"oracle client\")\n\t}\n\n\t// take a list of all images that are in the oracle cloud account\n\tresp, err := c.AllImageLists(nil)\n\tif err != nil {...
{ "audio": "", "image": "", "text": " under the current client username are\",\n\t\t)\n\t}\n\n\timages := make([]*imagemetadata.ImageMetadata, 0, n)\n\tfor _, val := range resp.Result {\n\t\turi, err := url.Parse(val.Uri)\n\t\tif err != nil {\n\t\t\tlogger.Warningf(\"image with ID %q had invalid resource URI %q\"...
{ "audio": "", "image": "", "text": "\treturn nil, errors.New(\"chart illegally contains empty path\")\n\t\t}\n\t\tif strings.HasPrefix(n, \"..\") {\n\t\t\treturn nil, errors.New(\"chart illegally references parent directory\")\n\t\t}\n\n\t\t// In some particularly arcane acts of path creativity, it is possible t...
{ "audio": "", "image": "", "text": "func getImageName(c EnvironAPI, id string) (string, error) {\n\tif id == \"\" {\n\t\treturn \"\", errors.NotFoundf(\"empty id\")\n\t}\n\n\tresp, err := c.AllImageLists(nil)\n\tif err != nil {\n\t\treturn \"\", errors.Trace(err)\n\t}\n\n\t// if we don't have any images that are...
{ "audio": "", "image": "", "text": " images from the oracle market\",\n\t\t)\n\t}\n\n\tfor _, val := range resp.Result {\n\t\tif strings.Contains(val.Name, id) {\n\t\t\ts := strings.Split(val.Name, \"/\")\n\t\t\treturn s[len(s)-1], nil\n\t\t}\n\t}\n\n\treturn \"\", errors.NotFoundf(\"image not found: %q\", id)\n...
{ "audio": "", "image": "", "text": "\n\t\t\t// NotFound if item was deleted since Scan started\n\t\t\tif errors.GetErrType(err) == errors.NotFound {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// TxFailedError is returned if the item was changed by a concurrent process.\n\t\t\t// If it was a parallel migration, we don't...
{ "audio": "", "image": "", "text": "func (config StringsConfig) Validate() error {\n\tif config.Handler == nil {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\treturn errors.NotValidf(\"nil Handler\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\t\treturn fmt.Errorf(\"missing handler for '%s' capability\", c)\n\t\t}\n\t}\n\tif config.ResourceGroup == \"\" {\n\t\treturn fmt.Errorf(\"missing resource group\")\n\t}\n\tif config.Token == \"\" {\n\t\tconfig.Token = os.Getenv(\"ATLAS_TOKEN\")\n\t}\n\tif config.Token ==...
{ "audio": "", "image": "", "text": "func NewStringsWorker(config StringsConfig) (*StringsWorker, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tsw := &StringsWorker{\n\t\tconfig: config,\n\t}\n\terr := catacomb.Invoke(catacomb.Plan{\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\tSite: &sw.catacomb,\n\t\tWork: sw.loop,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn sw, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " err := catacomb.Invoke(catacomb.Plan{\n\t\tSite: &w.catacomb,\n\t\tWork: w.loop,\n\t\tInit: []worker.Worker{w.controller},\n\t}); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn w, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewManagedFilesystemSource(\n\tvolumeBlockDevices map[names.VolumeTag]storage.BlockDevice,\n\tfilesystems map[names.FilesystemTag]storage.Filesystem,\n) storage.FilesystemSource {\n", "video": "" }
{ "audio": "", "image": "", "text": "\treturn &managedFilesystemSource{\n\t\tlogAndExec,\n\t\t&osDirFuncs{logAndExec},\n\t\tvolumeBlockDevices, filesystems,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tgc.ExtraChannels = []storage.ExtraChannel{}\n\tfor _, ec := range req.GatewayProfile.ExtraChannels {\n\t\tc := storage.ExtraChannel{\n\t\t\tFrequency: int(ec.Frequency),\n\t\t\tBandwidth: int(ec.Bandwidth),\n\t\t\tBitrate: int(ec.Bitrate),\n\t\t}\n\n\t\tswitch ec.Modulat...
{ "audio": "", "image": "", "text": "func isDiskDevice(devicePath string) bool {\n\tvar last rune\n\tfor _, r := range devicePath {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\tlast = r\n\t}\n\treturn !unicode.IsDigit(last)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\t}\n\t\t\tfor _, uv := range uvs {\n\t\t\t\timpAdminsMap[uv.String()] = uv\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}, teamID, \"implicitAdminsAncestor\", func(keybase1.TeamSigChainState) bool { return true })\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, uv := range i...
{ "audio": "", "image": "", "text": "func watchMachine(ctx *context, tag names.MachineTag) {\n\t_, ok := ctx.machines[tag]\n\tif ok {\n\t\treturn\n\t}\n\tw, err := newMachineWatcher(ctx.config.Machines, tag,", "video": "" }
{ "audio": "", "image": "", "text": " ctx.machineChanges)\n\tif err != nil {\n\t\tctx.kill(errors.Trace(err))\n\t} else if err := ctx.addWorker(w); err != nil {\n\t\tctx.kill(errors.Trace(err))\n\t} else {\n\t\tctx.machines[tag] = w\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\treturn func(req *http.Request, ctx *ProxyCtx) bool {\n\t\t_, ok := hostSet[req.URL.Host]\n\t\treturn ok\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func refreshMachine(ctx *context, tag names.MachineTag) error {\n\tw, ok := ctx.machines[tag]\n\tif !ok {\n\t\treturn errors.Errorf(\"machine %s is not being watched\", tag.Id())\n\t}\n\tstopAndRemove := func() error {\n\t\tworker.Stop(w)\n\t\tdelete(ctx.machines, tag)\n\t\tre...
{ "audio": "", "image": "", "text": " else if params.IsCodeNotFound(err) {\n\t\t\t// Machine is gone, so stop watching.\n\t\t\treturn stopAndRemove()\n\t\t}\n\t\treturn errors.Annotate(err, \"getting machine instance ID\")\n\t}\n\tmachineProvisioned(ctx, tag, instance.Id(results[0].Result))\n\t// machine provisio...
{ "audio": "", "image": "", "text": "\n\tif len(results.Results) != 1 {\n\t\treturn jujucloud.Cloud{}, errors.Errorf(\"expected 1 result, got %d\", len(results.Results))\n\t}\n\tif err := results.Results[0].Error; err != nil {\n\t\tif params.IsCodeNotFound(err) {\n\t\t\treturn jujucloud.Cloud{}, errors.NotFoundf(...
{ "audio": "", "image": "", "text": "func machineProvisioned(ctx *context, tag names.MachineTag, instanceId instance.Id) {\n\tfor _, params := range ctx.incompleteVolumeParams {\n\t\tif params.Attachment.Machine != tag || params.Attachment.InstanceId != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tparams.Attachment.Instanc...
{ "audio": "", "image": "", "text": " id, params)\n\t}\n\tfor id, params := range ctx.incompleteFilesystemAttachmentParams {\n\t\tif params.Machine != tag || params.InstanceId != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tparams.InstanceId = instanceId\n\t\tupdatePendingFilesystemAttachment(ctx, id, params)\n\t}\n}", "...
{ "audio": "", "image": "", "text": " bridge,\n\t\tMemory: params.Memory,\n\t\tCpuCores: params.CpuCores,\n\t\tRootDisk: params.RootDisk,\n\t\tInterfaces: interfaces,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Debugf(\"Set machine %s to autostart\", c.name)\n\tif para...
{ "audio": "", "image": "", "text": "func Manifold(config ManifoldConfig) dependency.Manifold {\n\tinputs := []string{config.ClockName}\n\tif config.StateName != \"\" {\n\t\tinputs = append(inputs, config.StateName)\n\t} else {\n\t\tinputs = append(inputs, config.LeaseManagerName)\n\t}\n\tif config.RaftName != \"...
{ "audio": "", "image": "", "text": "\n\t\tinputs = append(inputs, config.RaftName)\n\t}\n\treturn dependency.Manifold{\n\t\tInputs: inputs,\n\t\tStart: config.start,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\t\treturn fmt.Errorf(\"missing handler for '%s' capability\", c)\n\t\t}\n\t}\n\tif config.ResourceGroup == \"\" {\n\t\treturn fmt.Errorf(\"missing resource group\")\n\t}\n\tif config.Token == \"\" {\n\t\tconfig.Token = os.Getenv(\"ATLAS_TOKEN\")\n\t}\n\tif config.Token ==...
{ "audio": "", "image": "", "text": "func (w *MachineLXDProfileWatcher) init(machine *Machine) error {\n\tunits, err := machine.Units()\n\tif err != nil {\n\t\treturn errors.Annotatef(err, \"failed to get units to start MachineLXDProfileWatcher\")\n\t}\n\n\tfor _, unit := range units {\n\t\tappName := unit.Applic...
{ "audio": "", "image": "", "text": " application, nor machine id, start watching when machine id assigned.\", unitName)\n\t\t\tw.metrics.LXDProfileChangeError.Inc()\n\t\t\tcontinue\n\t\t}\n\n\t\tchURL := app.CharmURL()\n\t\tinfo := appInfo{\n\t\t\tcharmURL: chURL,\n\t\t\tunits: set.NewStrings(unitName),\n\t\t...
{ "audio": "", "image": "", "text": "\tif !ok {\n\t\tw.logError(\"programming error, value not of type unitLXDProfileRemove\")\n\t\treturn\n\t}\n\n\tapp, ok := w.applications[rUnit.appName]\n\tif !ok {\n\t\tw.logError(\"programming error, unit removed before being added, application name not found\")\n\t\treturn\...
{ "audio": "", "image": "", "text": "func (w *MachineLXDProfileWatcher) applicationCharmURLChange(topic string, value interface{}) {\n\t// We don't want to respond to any events until we have been fully initialized.\n\tselect {\n\tcase <-w.initialized:\n\tcase <-w.tomb.Dying():\n\t\treturn\n\t}\n\tvar notify bool...
{ "audio": "", "image": "", "text": "\t\tlxdProfile := ch.LXDProfile()\n\t\tif (!info.charmProfile.Empty() && lxdProfile.Empty()) || !lxdProfile.Empty() {\n\t\t\tlogger.Tracef(\"notifying due to change of charm lxd profile for %s, machine-%s\", appName, w.machineId)\n\t\t\tnotify = true\n\t\t} else {\n\t\t\tlogge...
{ "audio": "", "image": "", "text": "\tif !ok {\n\t\tw.logError(\"programming error, value not of type unitLXDProfileRemove\")\n\t\treturn\n\t}\n\n\tapp, ok := w.applications[rUnit.appName]\n\tif !ok {\n\t\tw.logError(\"programming error, unit removed before being added, application name not found\")\n\t\treturn\...
{ "audio": "", "image": "", "text": "func (w *MachineLXDProfileWatcher) addUnit(topic string, value interface{}) {\n\t// We don't want to respond to any events until we have been fully initialized.\n\tselect {\n\tcase <-w.initialized:\n\tcase <-w.tomb.Dying():\n\t\treturn\n\t}\n\tvar notify bool\n\tdefer func(not...
{ "audio": "", "image": "", "text": "\t\t\treturn\n\t\t}\n\t\tif w.machineId != principal.MachineId() {\n\t\t\tlogger.Tracef(\"watching unit changes on machine-%s not machine-%s\", w.machineId, unitMachineId)\n\t\t\treturn\n\t\t}\n\tcase w.machineId != unitMachineId:\n\t\tlogger.Tracef(\"watching unit changes on ...
{ "audio": "", "image": "", "text": "\tif !ok {\n\t\tw.logError(\"programming error, value not of type unitLXDProfileRemove\")\n\t\treturn\n\t}\n\n\tapp, ok := w.applications[rUnit.appName]\n\tif !ok {\n\t\tw.logError(\"programming error, unit removed before being added, application name not found\")\n\t\treturn\...
{ "audio": "", "image": "", "text": "func (w *MachineLXDProfileWatcher) removeUnit(topic string, value interface{}) {\n\t// We don't want to respond to any events until we have been fully initialized.\n\tselect {\n\tcase <-w.initialized:\n\tcase <-w.tomb.Dying():\n\t\treturn\n\t}\n\tvar notify bool\n\tdefer func(...
{ "audio": "", "image": "", "text": "\tif !ok {\n\t\tw.logError(\"programming error, value not of type unitLXDProfileRemove\")\n\t\treturn\n\t}\n\n\tapp, ok := w.applications[rUnit.appName]\n\tif !ok {\n\t\tw.logError(\"programming error, unit removed before being added, application name not found\")\n\t\treturn\...
{ "audio": "", "image": "", "text": "\n\t\t\t\t} else if w.isAllowedPerRobotsPolicies(ctx.url) {\n\t\t\t\t\tw.requestURL(ctx, ctx.HeadBeforeGet)\n\t\t\t\t} else {\n\t\t\t\t\t// Must still notify Crawler that this URL was processed, although not visited\n\t\t\t\t\tw.opts.Extender.Disallowed(ctx)\n\t\t\t\t\tw.sendR...
{ "audio": "", "image": "", "text": "func (w *MachineLXDProfileWatcher) provisionedChange(topic string, _ interface{}) {\n\t// We don't want to respond to any events until we have been fully initialized.\n\tselect {\n\tcase <-w.initialized:\n\tcase <-w.tomb.Dying():\n\t\treturn\n\t}\n\n", "video": "" }
{ "audio": "", "image": "", "text": "\tlogger.Tracef(\"notifying due to machine-%s now provisioned\", w.machineId)\n\tw.metrics.LXDProfileChangeHit.Inc()\n\tw.notify()\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tcase <-done:\n\tcase <-w.tomb.Dying():\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (job MachineJob) ToParams() multiwatcher.MachineJob {\n\tif jujuJob, ok := jobNames[job]; ok {\n\t\treturn jujuJob\n\t}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn multiwatcher.MachineJob(fmt.Sprintf(\"<unknown job %d>\", int(job)))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\treturn func(req *http.Request, ctx *ProxyCtx) bool {\n\t\t_, ok := hostSet[req.URL.Host]\n\t\treturn ok\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func paramsJobsFromJobs(jobs []MachineJob) []multiwatcher.MachineJob {\n\tjujuJobs := make([]multiwatcher.MachineJob,", "video": "" }
{ "audio": "", "image": "", "text": " len(jobs))\n\tfor i, machineJob := range jobs {\n\t\tjujuJobs[i] = machineJob.ToParams()\n\t}\n\treturn jujuJobs\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t// by exactly one worker\n\tfor _, job := range jobs {\n\t\tp.jobs <- job\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (job MachineJob) MigrationValue() string {\n\tif value, ok := jobMigrationValue[job]; ok", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\treturn value\n\t}\n\treturn \"unknown\"\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tm.mtx.Unlock()\n\n\tif !found {\n\t\treturn nil, false\n\t}\n\tvalue, ok = state[key]\n\treturn value, ok\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Machine) ContainerType() instance.ContainerType", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn instance.ContainerType(m.doc.ContainerType)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tinstance := s.instances[id]\n\t\tif instance != nil {\n\t\t\tm[id] = instance\n\t\t}\n\t}\n\treturn m\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Machine) SetKeepInstance(keepInstance bool) error {\n\tops := []txn.Op{{\n\t\tC: instanceDataC,\n\t\tId: m.doc.DocID,\n\t\tAssert: txn.DocExists,\n\t\tUpdate: bson.D{{\"$set\", bson.D{{\"keep-instance\", keepInstance}}}},\n\t}}\n\tif err := m.st.db().RunTrans...
{ "audio": "", "image": "", "text": " doesn't exist, that's ok; there's nothing to keep,\n\t\t// but that's not an error we care about.\n\t\treturn errors.Annotatef(onAbort(err, nil), \"cannot set KeepInstance on machine %v\", m)\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tfor _, n := range unit.SubordinateNames() {\n\t\t\t\tapp, err := a.st.Application(unitAppName(n))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\terr = app.VerifySupportedSeries(series, force)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\...
{ "audio": "", "image": "", "text": "func (m *Machine) KeepInstance() (bool, error) {\n\tinstData, err := getInstanceData(m.st, m.Id())\n\tif err != nil {\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\treturn false, err\n\t}\n\treturn instData.KeepInstance, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " URLs {\n\tm.Error = err\n\treturn m\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Machine) CharmProfiles() ([]string, error) {\n\tinstData, err := getInstanceData(m.st, m.Id())\n\tif errors.IsNotFound(err) {\n\t\terr = errors.NotProvisionedf(\"machine %v\", m.Id())", "video": "" }
{ "audio": "", "image": "", "text": "\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn instData.CharmProfiles, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " m.Id(), subnetID)\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn ports, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Machine) SetCharmProfiles(profiles []string) error {\n\tif len(profiles) == 0 {\n\t\treturn nil\n\t}\n\tbuildTxn := func(attempt int) ([]txn.Op, error) {\n\t\tif attempt > 0 {\n\t\t\tif err := m.Refresh(); err != nil {\n\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t}\n...
{ "audio": "", "image": "", "text": "\tops := []txn.Op{{\n\t\t\tC: instanceDataC,\n\t\t\tId: m.doc.DocID,\n\t\t\tAssert: txn.DocExists,\n\t\t\tUpdate: bson.D{{\"$set\", bson.D{{\"charm-profiles\", profiles}}}},\n\t\t}}\n\n\t\treturn ops, nil\n\t}\n\terr := m.st.db().Run(buildTxn)\n\treturn errors.Annotat...
{ "audio": "", "image": "", "text": "\n\t\treturn nil, nil\n\t}\n\n\tprofiles, err := b.VirtualServerProfiles(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvs.Profiles = profiles.Profiles\n\n\tpolicy_names, err := b.VirtualServerPolicyNames(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvs.Policies...
{ "audio": "", "image": "", "text": "func (m *Machine) WantsVote() bool", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn wantsVote(m.doc.Jobs, m.doc.NoVote)\n}", "video": "" }
{ "audio": "", "image": "", "text": " bool {\n\treturn func(err error) bool {\n\t\treturn Cause(err) == cause\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Machine) SetHasVote(hasVote bool) error {\n\top := m.UpdateOperation()\n\top.HasVote = &hasVote\n\tif err := m.st.ApplyOperation(op); err !=", "video": "" }
{ "audio": "", "image": "", "text": " nil {\n\t\treturn errors.Trace(err)\n\t}\n\tm.doc.HasVote = hasVote\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif n := len(cleanupArgs); n != 2 {\n\t\treturn errors.Errorf(\"expected 2 arguments, got %d\", n)\n\t}\n\tif err := cleanupArgs[0].Unmarshal(&destroyStorage); err != nil {\n\t\treturn errors.Annotate(err, \"unmarshalling cleanup args\")\n\t}\n\tif err := cleanupArgs[1].Unm...
{ "audio": "", "image": "", "text": "func (m *Machine) SetStopMongoUntilVersion(v mongo.Version) error {\n\tops := []txn.Op{{\n\t\tC: machinesC,\n\t\tId: m.doc.DocID,\n\t\tUpdate: bson.D{{\"$set\", bson.D{{\"stopmongountilversion\", v.String()}}}},", "video": "" }
{ "audio": "", "image": "", "text": "\n\t}}\n\tif err := m.st.db().RunTransaction(ops); err != nil {\n\t\treturn fmt.Errorf(\"cannot set StopMongoUntilVersion %v: %v\", m, onAbort(err, ErrDead))\n\t}\n\tm.doc.StopMongoUntilVersion = v.String()\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tfor _, n := range unit.SubordinateNames() {\n\t\t\t\tapp, err := a.st.Application(unitAppName(n))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\terr = app.VerifySupportedSeries(series, force)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\...
{ "audio": "", "image": "", "text": "func (m *Machine) StopMongoUntilVersion() (mongo.Version, error) {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mongo.NewVersion(m.doc.StopMongoUntilVersion)\n}", "video": "" }
{ "audio": "", "image": "", "text": " \"\", errors.Annotate(err, \"cannot obtain mongo build info\")\n\t}\n\treturn binfo.Version, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *Machine) IsManual() (bool, error) {\n\t// Apart from the bootstrap machine, manually provisioned\n\t// machines have a nonce prefixed with \"manual:\". This is\n\t// unique to manual provisioning.\n\tif strings.HasPrefix(m.doc.Nonce, manualMachinePrefix) {\n\t\treturn...
{ "audio": "", "image": "", "text": " \"0\" {\n\t\tmodel, err := m.st.Model()\n\t\tif err != nil {\n\t\t\treturn false, errors.Trace(err)\n\t\t}\n\n\t\tcfg, err := model.ModelConfig()\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tt := cfg.Type()\n\t\treturn t == \"null\" || t == \"manual\", nil\n\t}\n...
{ "audio": "", "image": "", "text": " be \"planned\", but we'll\n\t\t\t\t\t// do this anyway for the sake of completeness.\n\t\t\t\t\tif obj.Status == ObjectPlanned {\n\t\t\t\t\t\tms.ForgetResourceInstanceDeposed(instAddr, dk)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We may have deleted some objects, whi...
{ "audio": "", "image": "", "text": "func (m *Machine) AgentTools() (*tools.Tools, error) {\n\tif m.doc.Tools == nil", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\treturn nil, errors.NotFoundf(\"agent binaries for machine %v\", m)\n\t}\n\ttools := *m.doc.Tools\n\treturn &tools, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn func(p *Prompt) error {\n\t\tp.keyBindMode = m\n\t\treturn nil\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func checkVersionValidity(v version.Binary) error {\n\tif v.Series == \"\" || v.Arch == \"\" {\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\treturn fmt.Errorf(\"empty series or arch\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " == k {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}", "video": "" }