anchor dict | positive dict | negative dict |
|---|---|---|
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetMongoPassword(password string) error {\n\tif !m.IsManager() {\n\t\treturn errors.NotSupportedf(\"setting mongo password for non-controller machine %v\", m)\n\t}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn mongo.SetAdminMongoPassword(m.st.session, m.Tag().String(), password)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tif !m.Contains(p) {\n\t\t\tm.Add(p)\n\t\t}\n\t}\n\treturn m.ToSlice()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) PasswordValid(password string) bool {\n\tagentHash",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := utils.AgentPasswordHash(password)\n\treturn agentHash == m.doc.PasswordHash\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) ForceDestroy(maxWait time.Duration) error {\n\tops, err := m.forceDestroyOps(maxWait)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tif err := m.st.db().RunTransaction(ops); err",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != txn.ErrAborted {\n\t\treturn errors.Annotatef(err, \"failed to run transaction: %s\", pretty.Sprint(ops))\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\tsuspendOps, err := st.suspendRevokedRelationsOps(offerUUID, user.Id())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t}\n\t\t\tops = append(ops, suspendOps...)\n\t\t}\n\t\treturn ops, nil\n\t}\n\n\terr = st.db().Run(buildTxn)\n\treturn errors.Trac... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) ParentId() (string, bool) {\n\tparentId := ParentId(m.Id())",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn parentId, parentId != \"\"\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn m.SpaceID == spaceID && len(m.Path) == 1 && m.Path[0] == m.ID\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func IsHasContainersError(err error) bool {\n\t_, ok :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " errors.Cause(err).(*HasContainersError)\n\treturn ok\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 IsHasAttachmentsError(err error) bool {\n\t_, ok :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " errors.Cause(err).(*HasAttachmentsError)\n\treturn ok\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 (m *Machine) Remove() (err error) {\n\tdefer errors.DeferredAnnotatef(&err, \"cannot remove machine %s\", m.doc.Id)\n\tlogger.Tracef(\"removing machine %q\", m.Id())\n\t// Local variable so we can re-get the machine without disrupting\n\t// the caller.\n\tmachine := m\n\t... | {
"audio": "",
"image": "",
"text": "\t\t\t\treturn nil, jujutxn.ErrNoOperations\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t}\n\t\t}\n\t\tops, err := machine.removeOps()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\treturn ops, nil\n\t}\n\treturn m.st.db(... | {
"audio": "",
"image": "",
"text": " new(getMachineIDResponse)\n\terr := vb.send(req1, rsp1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmachine.id = rsp1.Returnval\n\n\t// get machine name\n\treq2 := getMachineNameRequest{Mobref: machine.mobref}\n\trsp2 := new(getMachineNameResponse)\n\terr = vb.send(req2, rsp2)... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) Refresh() error {\n\tmdoc, err := m.st.getMachineDoc(m.Id())\n\tif err != nil {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif errors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn errors.Annotatef(err, \"cannot refresh machine %v\", m)\n\t}\n\tm.doc = *mdoc\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " URLs {\n\tm.Error = err\n\treturn m\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetAgentPresence() (*presence.Pinger, error) {\n\tpresenceCollection := m.st.getPresenceCollection()\n\trecorder := m.st.getPingBatcher()\n\tp := presence.NewPinger(presenceCollection, m.st.modelTag, m.globalKey(),\n\t\tfunc() presence.PingRecorder { return m... | {
"audio": "",
"image": "",
"text": "\n\t// starts. This ensures that commands run immediately after bootstrap\n\t// like status or enable-ha will have an accurate values\n\t// for agent-state.\n\t//\n\t// TODO: Does not work for multiple controllers. Trigger a sync across all controllers.\n\tif m.IsManager() {\n... | {
"audio": "",
"image": "",
"text": " {\n\t\t\treturn err\n\t\t}\n\n\t\t// Wait for leadership.\n\t\tif err := m.waitForLeader(60 * time.Second); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Wait for store to catchup\n\t\tfor m.store.LastIndex() < targetLogIndex.LastIndex {\n\t\t\tm.logger.Println(\"Waiting fo... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) InstanceId() (instance.Id,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error) {\n\tinstId, _, err := m.InstanceNames()\n\treturn instId, err\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) InstanceNames() (instance.Id, string, error) {\n\tinstData, err := getInstanceData(m.st, m.Id())\n\tif errors.IsNotFound(err) {\n\t\terr = errors.NotProvisionedf(\"machine %v\", m.Id())\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn instData.InstanceId, instData.DisplayName, 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) InstanceStatus() (status.StatusInfo, error) {\n\tmachineStatus, err := getStatus(m.st.db(), m.globalInstanceKey(), \"instance\")",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif err != nil {\n\t\tlogger.Warningf(\"error when retrieving instance status for machine: %s, %v\", m.Id(), err)\n\t\treturn status.StatusInfo{}, err\n\t}\n\treturn machineStatus, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " WHERE id=$2`\n\tif _, err := db.Exec(q, m.NeedsTraining, m.ID); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetInstanceStatus(sInfo status.StatusInfo) (err error) {\n\treturn setStatus(m.st.db(), setStatusParams{\n\t\tbadge: \"instance\",\n\t\tglobalKey: m.globalInstanceKey(),\n\t\tstatus: sInfo.Status,\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tmessage: sInfo.Message,\n\t\trawData: sInfo.Data,\n\t\tupdated: timeOrNow(sInfo.Since, m.st.clock()),\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " shouldBeAssigned {\n\t\t\treturn errors.Errorf(\"cannot set invalid status %q\", unitAgentStatus.Status)\n\t\t}\n\tcase status.Lost:\n\t\treturn errors.Errorf(\"cannot set status %q\", unitAgentStatus.Status)\n\tdefault:\n\t\treturn errors.Errorf(\"cannot set invalid status %... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) ModificationStatus() (status.StatusInfo, error) {\n\tmachineStatus, err := getStatus(m.st.db(), m.globalModificationKey(), \"modification\")\n\tif err != nil {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tlogger.Warningf(\"error when retrieving instance status for machine: %s, %v\", m.Id(), err)\n\t\treturn status.StatusInfo{}, err\n\t}\n\treturn machineStatus, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " WHERE id=$2`\n\tif _, err := db.Exec(q, m.NeedsTraining, m.ID); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) AvailabilityZone() (string, error) {\n\tinstData, err := getInstanceData(m.st, m.Id())\n\tif errors.IsNotFound(err) {\n\t\treturn \"\", errors.Trace(errors.NotProvisionedf(\"machine",
"video": ""
} | {
"audio": "",
"image": "",
"text": " %v\", m.Id()))\n\t}\n\tif err != nil {\n\t\treturn \"\", errors.Trace(err)\n\t}\n\tvar zone string\n\tif instData.AvailZone != nil {\n\t\tzone = *instData.AvailZone\n\t}\n\treturn zone, 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) ApplicationNames() ([]string, error) {\n\tunits, err := m.Units()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tapps := set.NewStrings()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfor _, unit := range units {\n\t\tapps.Add(unit.ApplicationName())\n\t}\n\treturn apps.SortedValues(), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\tif err := m.txn.HDel(mDBs, dbKey); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) Units() (units []*Unit, err error) {\n\tdefer errors.DeferredAnnotatef(&err, \"cannot get units assigned to machine %v\", m)\n\tunitsCollection, closer := m.st.db().GetCollection(unitsC)\n\tdefer closer()\n\n\tpudocs := []unitDoc{}\n\terr = unitsCollection.Fi... | {
"audio": "",
"image": "",
"text": " range pudocs {\n\t\tunits = append(units, newUnit(m.st, model.Type(), &pudoc))\n\t\tdocs := []unitDoc{}\n\t\terr = unitsCollection.Find(bson.D{{\"principal\", pudoc.Name}}).All(&docs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, doc := range docs {\n\t\t\tun... | {
"audio": "",
"image": "",
"text": "\n\t\t\tId: m.doc.DocID,\n\t\t\tAssert: notDeadDoc,\n\t\t\tUpdate: bson.D{\n\t\t\t\t{\"$set\", bson.D{\n\t\t\t\t\t{\"supportedcontainers\", supportedContainers},\n\t\t\t\t\t{\"supportedcontainersknown\", true},\n\t\t\t\t}}},\n\t\t},\n\t}\n\tif err = m.st.db().RunTransactio... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) DesiredSpaces() (set.Strings, error) {\n\tspaces := set.NewStrings()\n\tunits, err := m.Units()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tconstraints, err := m.Constraints()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\t// ... | {
"audio": "",
"image": "",
"text": " nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tendpointBindings, err := app.EndpointBindings()\n\t\tfor _, space := range endpointBindings {\n\t\t\tif space != \"\" {\n\t\t\t\tbindings.Add(space)\n\t\t\t}\n\t\t}\n\t}\n\tlogger.Tracef(\"machine %q found constraints %s ... | {
"audio": "",
"image": "",
"text": "\n\tif err := st.db().RunTransaction(ops); err == txn.ErrAborted {\n\t\tif _, err := st.Space(name); err == nil {\n\t\t\treturn nil, errors.AlreadyExistsf(\"space %q\", name)\n\t\t}\n\t\tfor _, subnetId := range subnets {\n\t\t\tsubnet, err := st.Subnet(subnetId)\n\t\t\tif err... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetInstanceInfo(\n\tid instance.Id, displayName string, nonce string, characteristics *instance.HardwareCharacteristics,\n\tdevicesArgs []LinkLayerDeviceArgs, devicesAddrs []LinkLayerDeviceAddress,\n\tvolumes map[names.VolumeTag]VolumeInfo,\n\tvolumeAttachmen... | {
"audio": "",
"image": "",
"text": " range volumes {\n\t\tvolumeStatus[tag] = status.Attaching\n\t}\n\tfor tag := range volumeAttachments {\n\t\tvolumeStatus[tag] = status.Attached\n\t}\n\tfor tag, volStatus := range volumeStatus {\n\t\tvol, err := sb.Volume(tag)\n\t\tif err != nil {\n\t\t\treturn errors.Trace(e... | {
"audio": "",
"image": "",
"text": " err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\tif err := m.txn.HDel(mDBs, dbKey); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) Addresses() (addresses []network.Address) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " network.MergedAddresses(networkAddresses(m.doc.MachineAddresses), networkAddresses(m.doc.Addresses))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\treturn \"\", errors.New(\"No addresses found, please configure one.\")\n\tcase 1:\n\t\treturn ips[0], nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Multiple addresses found (%q), please configure one.\", out)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func maybeGetNewAddress(\n\taddr address,\n\tproviderAddresses,\n\tmachineAddresses []address,\n\tgetAddr func([]address) network.Address,\n\tcheckScope func(address) bool,\n) (address, bool) {\n\t// For picking the best address, try provider addresses first.\n\tvar newAddr ad... | {
"audio": "",
"image": "",
"text": " == \"\" {\n\t\treturn newAddr, newAddr.Value != \"\"\n\t}\n\tif !containsAddress(providerAddresses, addr) && !containsAddress(machineAddresses, addr) {\n\t\treturn newAddr, true\n\t}\n\tif Origin(addr.Origin) != OriginProvider && Origin(newAddr.Origin) == OriginProvider {\n\t... | {
"audio": "",
"image": "",
"text": " the following:\n\t//\n\t// \"X-Forwarded-For\": [\n\t// \"204.28.121.211, 49.228.250.246, 10.128.21.180\"\n\t// ]\n\t//\n\t// This will look at each ip from right to left, and use the first\n\t// \"untrusted\" address as the real ip.\n\t//\n\t// 1. The first ip, 10.12... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetProviderAddresses(addresses ...network.Address) error {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\terr := m.setAddresses(nil, &addresses)\n\treturn errors.Annotatef(err, \"cannot set addresses of machine %v\", m)\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 (m *Machine) ProviderAddresses() (addresses []network.Address) {\n\tfor _, address := range m.doc.Addresses {\n\t\taddresses",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = append(addresses, address.networkAddress())\n\t}\n\treturn\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := range addresses {\n\t\terr := r.ConnectToNSQLookupd(addr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) MachineAddresses() (addresses []network.Address) {\n\tfor _, address := range m.doc.MachineAddresses {\n\t\taddresses =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(addresses, address.networkAddress())\n\t}\n\treturn\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tif word, ok := m.(*Word); ok {\n\t\t\tif word.Address == address {\n\t\t\t\tres = append(res, word.Command)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) CheckProvisioned(nonce string) bool {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn nonce == m.doc.Nonce && nonce != \"\"\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " invalids types.Transactions\n\n\tif l.strict && len(removed) > 0 {\n\t\tlowest := uint64(math.MaxUint64)\n\t\tfor _, tx := range removed {\n\t\t\tif nonce := tx.Nonce(); lowest > nonce {\n\t\t\t\tlowest = nonce\n\t\t\t}\n\t\t}\n\t\tinvalids = l.txs.Filter(func(tx *types.Trans... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) Constraints() (constraints.Value, error) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " readConstraints(m.st, m.globalKey())\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a match\n\tcache := ctx.VersionConstraintCache()\n\tconstraints := cache[constraintStr]\n\n\t// Parse the constraints\n\tif constraints == nil {\n\t\tconstraints, err = version.NewConstraint(constraintStr)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tcache[constraintS... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetConstraints(cons constraints.Value) (err error) {\n\top :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " m.UpdateOperation()\n\top.Constraints = &cons\n\treturn m.st.ApplyOperation(op)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a match\n\tcache := ctx.VersionConstraintCache()\n\tconstraints := cache[constraintStr]\n\n\t// Parse the constraints\n\tif constraints == nil {\n\t\tconstraints, err = version.NewConstraint(constraintStr)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tcache[constraintS... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) Status() (status.StatusInfo, error) {\n\tmStatus, err := getStatus(m.st.db(), m.globalKey(), \"machine\")\n\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " err != nil {\n\t\treturn mStatus, err\n\t}\n\treturn mStatus, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " WHERE id=$2`\n\tif _, err := db.Exec(q, m.NeedsTraining, m.ID); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetStatus(statusInfo status.StatusInfo) error {\n\tswitch statusInfo.Status {\n\tcase status.Started, status.Stopped:\n\tcase status.Error:\n\t\tif statusInfo.Message == \"\" {\n\t\t\treturn errors.Errorf(\"cannot set status %q without info\", statusInfo.Stat... | {
"audio": "",
"image": "",
"text": "\treturn errors.Errorf(\"cannot set status %q\", statusInfo.Status)\n\tdefault:\n\t\treturn errors.Errorf(\"cannot set invalid status %q\", statusInfo.Status)\n\t}\n\treturn setStatus(m.st.db(), setStatusParams{\n\t\tbadge: \"machine\",\n\t\tglobalKey: m.globalKey(),\n\t\t... | {
"audio": "",
"image": "",
"text": "\t\tif statusInfo.Status != status.Error && statusInfo.Status != status.ProvisioningError {\n\t\t\tcontinue\n\t\t}\n\t\t// Transient errors are marked as such in the status data.\n\t\tif transient, ok := result.Data[\"transient\"].(bool); !ok || !transient {\n\t\t\tcontinue\n\... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SupportedContainers() ([]instance.ContainerType, bool) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " m.doc.SupportedContainers, m.doc.SupportedContainersKnown\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) SupportsNoContainers() (err error) {\n\tif err = m.updateSupportedContainers([]instance.ContainerType{}); err !=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil {\n\t\treturn err\n\t}\n\treturn m.markInvalidContainers()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " URLs {\n\tm.Error = err\n\treturn m\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetSupportedContainers(containers []instance.ContainerType) (err error) {\n\tif len(containers) == 0 {\n\t\treturn fmt.Errorf(\"at least one valid container type is required\")\n\t}\n\tfor _, container := range containers {\n\t\tif container == instance.NONE ... | {
"audio": "",
"image": "",
"text": "\t\t\treturn fmt.Errorf(\"%q is not a valid container type\", container)\n\t\t}\n\t}\n\tif err = m.updateSupportedContainers(containers); err != nil {\n\t\treturn err\n\t}\n\treturn m.markInvalidContainers()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " dead. We don't want anybody to be restarting it.\n\tcontainer.Lock()\n\tcontainer.Dead = true\n\n\t// Save container state to disk. So that if error happens before\n\t// container meta file got removed from disk, then a restart of\n\t// docker should not make a dead container... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) updateSupportedContainers(supportedContainers []instance.ContainerType) (err error) {\n\tif m.doc.SupportedContainersKnown {\n\t\tif len(m.doc.SupportedContainers) == len(supportedContainers) {\n\t\t\tequal := true\n\t\t\ttypes := make(map[instance.ContainerT... | {
"audio": "",
"image": "",
"text": "\n\t\t\tId: m.doc.DocID,\n\t\t\tAssert: notDeadDoc,\n\t\t\tUpdate: bson.D{\n\t\t\t\t{\"$set\", bson.D{\n\t\t\t\t\t{\"supportedcontainers\", supportedContainers},\n\t\t\t\t\t{\"supportedcontainersknown\", true},\n\t\t\t\t}}},\n\t\t},\n\t}\n\tif err = m.st.db().RunTransactio... | {
"audio": "",
"image": "",
"text": "\tfor _, tg := range job.TaskGroups {\n\t\t\tif _, ok := m[tg.Name]; !ok {\n\t\t\t\tm[tg.Name] = make(map[string]*structs.Allocation)\n\t\t\t}\n\t\t}\n\t}\n\treturn m\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) markInvalidContainers() error {\n\tcurrentContainers, err := m.Containers()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, containerId := range currentContainers {\n\t\tif !isSupportedContainer(ContainerTypeFromId(containerId), m.doc.SupportedContainers) {... | {
"audio": "",
"image": "",
"text": "\n\t\t\t\tnow := m.st.clock().Now()\n\t\t\t\ts := status.StatusInfo{\n\t\t\t\t\tStatus: status.Error,\n\t\t\t\t\tMessage: \"unsupported container\",\n\t\t\t\t\tData: map[string]interface{}{\"type\": containerType},\n\t\t\t\t\tSince: &now,\n\t\t\t\t}\n\t\t\t\tcontainer.Se... | {
"audio": "",
"image": "",
"text": " to\n\t// allow users to stop containers that may have been started outside of\n\t// Empire.\n\tif _, ok := container.Config.Labels[runLabel]; !ok {\n\t\treturn &docker.NoSuchContainer{\n\t\t\tID: containerID,\n\t\t}\n\t}\n\n\tif err := s.docker.StopContainer(ctx, containerID,... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) SetMachineBlockDevices(info ...BlockDeviceInfo) error {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " setMachineBlockDevices(m.st, m.Id(), info)\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 (m *Machine) VolumeAttachments() ([]VolumeAttachment, error) {\n\tsb, err := NewStorageBackend(m.st)\n\tif err != nil {\n\t\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil, errors.Trace(err)\n\t}\n\treturn sb.MachineVolumeAttachments(m.MachineTag())\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " URLs {\n\tm.Error = err\n\treturn m\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) AddAction(name string, payload map[string]interface{}) (Action, error) {\n\tspec, ok := actions.PredefinedActionsSpec[name]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"cannot add action %q to a machine; only predefined actions allowed\", name)\n\t}\n\n",
"... | {
"audio": "",
"image": "",
"text": "\t// Reject bad payloads before attempting to insert defaults.\n\terr := spec.ValidateParams(payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpayloadWithDefaults, err := spec.InsertDefaults(payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmodel, err := m.st.M... | {
"audio": "",
"image": "",
"text": " errors.Errorf(\"invalid action parameters\")\n\t}\n\n\tswitch name {\n\tcase actions.JujuRunActionName:\n\t\treturn handleJujuRunAction(params)\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unexpected action %s\", name)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) CancelAction(action Action) (Action, error) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " action.Finish(ActionResults{Status: ActionCancelled})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " data.BlockCacheLifetime, action BlockRequestAction) <-chan error {\n\tif brq.config.IsSyncedTlf(kmd.TlfID()) {\n\t\taction = action.AddSync()\n\t}\n\treturn brq.request(ctx, priority, kmd, ptr, block, lifetime, action)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *Machine) UpdateMachineSeries(series string, force bool) error {\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\t\t}\n\t\t// Exit early if the Machi... | {
"audio": "",
"image": "",
"text": "\tcurl, _ := unit.CharmURL()\n\t\t\tops = append(ops, txn.Op{\n\t\t\t\tC: unitsC,\n\t\t\t\tId: unit.doc.DocID,\n\t\t\t\tAssert: bson.D{{\"life\", Alive},\n\t\t\t\t\t{\"charmurl\", curl},\n\t\t\t\t\t{\"subordinates\", unit.SubordinateNames()}},\n\t\t\t\tUpdate: bson.D{{\"$set\... | {
"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) VerifyUnitsSeries(unitNames []string, series string, force bool) ([]*Unit, error) {\n\tvar results []*Unit\n\tfor _, u := range unitNames {\n\t\tunit, err := m.st.Unit(u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tapp, err := unit.Application()\n... | {
"audio": "",
"image": "",
"text": "\t\t}\n\n\t\tsubordinates := unit.SubordinateNames()\n\t\tsubUnits, err := m.VerifyUnitsSeries(subordinates, series, force)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresults = append(results, unit)\n\t\tresults = append(results, subUnits...)\n\t}\n\treturn result... | {
"audio": "",
"image": "",
"text": "\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"metadata\":\n\t\tu.Metadata, err = IsMediaMetadataFromJSON(body)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn ... |
{
"audio": "",
"image": "",
"text": "func (m *Machine) UpdateOperation() *UpdateMachineOperation",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn &UpdateMachineOperation{m: &Machine{st: m.st, doc: m.doc}}\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 NewLifeGetter(st state.EntityFinder, getCanRead GetAuthFunc)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *LifeGetter {\n\treturn &LifeGetter{\n\t\tst: st,\n\t\tgetCanRead: getCanRead,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " s.VoiceConnections[st.GuildID]\n\ts.RUnlock()\n\tif !exists {\n\t\treturn\n\t}\n\n\t// We only care about events that are about us.\n\tif s.State.User.ID != st.UserID {\n\t\treturn\n\t}\n\n\t// Store the SessionID for later use.\n\tvoice.Lock()\n\tvoice.UserID = st.UserID\n\t... |
{
"audio": "",
"image": "",
"text": "func (lg *LifeGetter) Life(args params.Entities) (params.LifeResults, error) {\n\tresult := params.LifeResults{\n\t\tResults: make([]params.LifeResult, len(args.Entities)),\n\t}\n\tif len(args.Entities) == 0 {\n\t\treturn result, nil\n\t}\n\tcanRead, err := lg.getCanRead()\n\t... | {
"audio": "",
"image": "",
"text": " = ServerError(ErrPerm)\n\t\t\tcontinue\n\t\t}\n\t\terr = ErrPerm\n\t\tif canRead(tag) {\n\t\t\tresult.Results[i].Life, err = lg.oneLife(tag)\n\t\t}\n\t\tresult.Results[i].Error = ServerError(err)\n\t}\n\treturn result, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " len(args.Models)),\n\t}\n\tfor i, arg := range args.Models {\n\t\terr := f.setModelEnvironVersion(arg)\n\t\tif err != nil {\n\t\t\tresult.Results[i].Error = common.ServerError(err)\n\t\t}\n\t}\n\treturn result, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (doc leaseDoc) entry() (string, entry, error) {\n\tif err := doc.validate(); err != nil {\n\t\treturn \"\", entry{}, errors.Trace(err)\n\t}\n\tentry := entry{\n\t\tholder: doc.Holder,\n\t\tstart: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " toTime(doc.Start),\n\t\tduration: doc.Duration,\n\t\twriter: doc.Writer,\n\t}\n\treturn doc.Name, entry, 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 newLeaseDoc(namespace, name string, entry entry) (*leaseDoc, error) {\n\tdoc := &leaseDoc{\n\t\tId: leaseDocId(namespace, name),\n\t\tNamespace: namespace,\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tName: name,\n\t\tHolder: entry.holder,\n\t\tStart: toInt64(entry.start),\n\t\tDuration: entry.duration,\n\t\tWriter: entry.writer,\n\t}\n\tif err := doc.validate(); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn doc, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (res Resource) Validate() error {\n\t// TODO(ericsnow) Ensure that the \"placeholder\" fields are not set\n\t// if IsLocalPlaceholder() returns true (and that they *are* set\n\t// otherwise)? Also ensure an \"upload\" origin in the \"placeholder\"\n\t// case?\n\n\tif",
... | {
"audio": "",
"image": "",
"text": " err := res.Resource.Validate(); err != nil {\n\t\treturn errors.Annotate(err, \"bad info\")\n\t}\n\n\tif res.ApplicationID == \"\" {\n\t\treturn errors.NewNotValid(nil, \"missing application ID\")\n\t}\n\n\t// TODO(ericsnow) Require that Username be set if timestamp is?\n\n\t... | {
"audio": "",
"image": "",
"text": " ensure that (1) the Accumulator\n\t// cannot be used any more after Close() has been called and (2)\n\t// information about the key is not retained in memory\n\t// indefinitely.\n\tacc.gen.reset()\n\n\treturn err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (res Resource) TimestampGranular() time.Time {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " time.Unix(res.Timestamp.Unix(), 0)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tnowFunc: func() time.Time { return time.Now().In(time.UTC) },\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (res Resource) RevisionString() string {\n\tswitch res.Origin {\n\tcase resource.OriginUpload:\n\t\tif res.IsPlaceholder() {\n\t\t\treturn \"-\"\n\t\t}\n\t\treturn res.TimestampGranular().UTC().String()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tcase resource.OriginStore:\n\t\treturn fmt.Sprintf(\"%d\", res.Revision)\n\tdefault:\n\t\t// note: this should probably never happen.\n\t\treturn \"-\"\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := c.c.Post().Resource(clusterPath + SchedPath).Body(request)\n\tres := req.Do()\n\tif res.Error() != nil {\n\t\treturn res.FormatError()\n\t}\n\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func AsMap(resources []Resource) map[string]Resource {\n\tresults := make(map[string]Resource,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " len(resources))\n\tfor _, res := range resources {\n\t\tresults[res.Name] = res\n\t}\n\treturn results\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " func(i int) bool {\n\t\treturn !results.vertices[i].less(results.config, result)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func newSender(client metricsmanager.MetricsManagerClient, notify chan string) worker.Worker {\n\tf := func(stopCh <-chan struct{}) error {\n\t\terr := client.SendMetrics()\n\t\tif err !=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil {\n\t\t\tsenderLogger.Warningf(\"failed to send metrics %v - will retry later\", err)\n\t\t\treturn nil\n\t\t}\n\t\tselect {\n\t\tcase notify <- \"senderCalled\":\n\t\tdefault:\n\t\t}\n\t\treturn nil\n\t}\n\treturn jworker.NewPeriodicWorker(f, senderPeriod, jworker.NewTim... | {
"audio": "",
"image": "",
"text": " {\n\t\tch <- err\n\t\tclient.wg.Done()\n\t\treturn\n\t}\n\n\tif packet.Release == \"\" {\n\t\tpacket.Release = release\n\t}\n\n\tif packet.Environment == \"\" {\n\t\tpacket.Environment = environment\n\t}\n\n\toutgoingPacket := &outgoingPacket{packet, ch}\n\n\t// Lazily start ... |
{
"audio": "",
"image": "",
"text": "func TabWriter(writer io.Writer) *ansiterm.TabWriter {\n\tconst (\n\t\t// To format things into columns.\n\t\tminwidth = 0",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\ttabwidth = 1\n\t\tpadding = 2\n\t\tpadchar = ' '\n\t\tflags = 0\n\t)\n\treturn ansiterm.NewTabWriter(writer, minwidth, tabwidth, padding, padchar, flags)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\te := err.(map[string]interface{})\n\t\t\twriter.WriteByte(io.TagError)\n\t\t\twriter.WriteString(e[\"message\"].(string))\n\t\t} else {\n\t\t\twriter.WriteByte(io.TagResult)\n\t\t\twriter.Serialize(response[\"result\"])\n\t\t}\n\t\twriter.WriteByte(io.TagEnd)\n\t\tdata = wri... |
{
"audio": "",
"image": "",
"text": "func (w *Wrapper) Print(values ...interface{}) {\n\tfor _, v := range values {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tfmt.Fprintf(w, \"%v\\t\", v)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\ted.writeUint16(uint16(len(values)))\n\t\tfor _, v := range values {\n\t\t\ted.writeInt64(v)\n\t\t}\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (w *Wrapper) Printf(format string, values",
"video": ""
} | {
"audio": "",
"image": "",
"text": " ...interface{}) {\n\tfmt.Fprintf(w, format+\"\\t\", values...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " mean default format.\n\t}\n\t_, err := w.Write([]byte(v.format(\"\", c)))\n\treturn err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (w *Wrapper) Println(values ...interface{}) {\n\tfor i, v := range values {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tif i != len(values)-1 {\n\t\t\tfmt.Fprintf(w, \"%v\\t\", v)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%v\", v)\n\t\t}\n\t}\n\tfmt.Fprintln(w)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tcase *ast.AssignStmt:\n\t\t\tfor _, v := range decl.Rhs {\n\t\t\t\tvalue, err := GetString(v)\n\t\t\t\tif err == nil {\n\t\t\t\t\tvalues = append(values, value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn values\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (w *Wrapper) PrintColor(ctx *ansiterm.Context, value interface{}) {\n\tif ctx != nil {\n\t\tctx.Fprintf(w.TabWriter,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"%v\\t\", value)\n\t} else {\n\t\tfmt.Fprintf(w, \"%v\\t\", value)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Context {\n\tfmt.Fprintf(ctx.Writer(), format, args...)\n\treturn ctx\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (w *Wrapper) PrintStatus(status status.Status) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tw.PrintColor(statusColors[status], status)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _, cat := range *raw.Categories {\n\t\t\tdst.Categories = append(dst.Categories, tech.Category(cat))\n\t\t}\n\t}\n\tif raw.Status != \"\" && (raw.Status == tech.StatusCorrect ||\n\t\traw.Status == tech.StatusIncorrect ||\n\t\traw.Status == tech.StatusUnknown) {\n\n\t\tdst.Sta... |
{
"audio": "",
"image": "",
"text": "func (c *debugHooksCommand) Run(ctx *cmd.Context) error {\n\terr := c.initRun()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.cleanupRun()\n\terr = c.validateHooksOrActions()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdebugctx := unitdebug.NewHooksContext(c.Target)",
"v... | {
"audio": "",
"image": "",
"text": "\n\tscript := base64.StdEncoding.EncodeToString([]byte(unitdebug.ClientScript(debugctx, c.hooks)))\n\tinnercmd := fmt.Sprintf(`F=$(mktemp); echo %s | base64 -d > $F; . $F`, script)\n\targs := []string{fmt.Sprintf(\"sudo /bin/bash -c '%s'\", innercmd)}\n\tc.Args = args\n\tretur... | {
"audio": "",
"image": "",
"text": " < c.burst; i++ {\n\t\t\tbefore := time.Now()\n\t\t\terr := c.requester.Request()\n\t\t\tlatency := time.Since(before).Nanoseconds()\n\t\t\tif err != nil {\n\t\t\t\tif err := c.errorHistogram.RecordCorrectedValue(latency, interval); err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\... |
{
"audio": "",
"image": "",
"text": "func DestroyController(\n\tst ModelManagerBackend,\n\tdestroyHostedModels bool,\n\tdestroyStorage *bool,\n) error {\n\tmodelTag := st.ModelTag()\n\tcontrollerModelTag := st.ControllerModelTag()\n\tif modelTag != controllerModelTag {\n\t\treturn errors.Errorf(\n\t\t\t\"expected... | {
"audio": "",
"image": "",
"text": "\t\tdefer release()\n\n\t\t\tcheck := NewBlockChecker(modelSt)\n\t\t\tif err = check.DestroyAllowed(); err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\terr = sendMetrics(modelSt)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"failed to send leftover metrics: %v\... | {
"audio": "",
"image": "",
"text": "\n\tif err := st.db().RunTransaction(ops); err == txn.ErrAborted {\n\t\tif _, err := st.Space(name); err == nil {\n\t\t\treturn nil, errors.AlreadyExistsf(\"space %q\", name)\n\t\t}\n\t\tfor _, subnetId := range subnets {\n\t\t\tsubnet, err := st.Subnet(subnetId)\n\t\t\tif err... |
{
"audio": "",
"image": "",
"text": "func DestroyModel(\n\tst ModelManagerBackend,\n\tdestroyStorage *bool,\n\tforce *bool,\n\tmaxWait *time.Duration,\n) error {\n\treturn destroyModel(st, state.DestroyModelParams{\n\t\tDestroyStorage:",
"video": ""
} | {
"audio": "",
"image": "",
"text": " destroyStorage,\n\t\tForce: force,\n\t\tMaxWait: MaxWait(maxWait),\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tdefer release()\n\n\t\t\tcheck := NewBlockChecker(modelSt)\n\t\t\tif err = check.DestroyAllowed(); err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\terr = sendMetrics(modelSt)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"failed to send leftover metrics: %v\... |
{
"audio": "",
"image": "",
"text": "func CAASManifolds(config ManifoldsConfig) dependency.Manifolds {\n\tagentConfig := config.Agent.CurrentConfig()\n\tmodelTag := agentConfig.Model()\n\tmanifolds := dependency.Manifolds{\n\t\t// The undertaker is currently the only ifNotAlive worker.\n\t\tundertakerName: ifNotU... | {
"audio": "",
"image": "",
"text": " caasenvironupgrader.Manifold(caasenvironupgrader.ManifoldConfig{\n\t\t\tAPICallerName: apiCallerName,\n\t\t\tGateName: environUpgradeGateName,\n\t\t\tModelTag: modelTag,\n\t\t\tNewFacade: caasenvironupgrader.NewFacade,\n\t\t\tNewWorker: caasenvironupgrader.N... | {
"audio": "",
"image": "",
"text": "\n\t\tDeleteFunc: func(o interface{}) {\n\t\t\teventCount.WithLabelValues(\"node\", \"delete\").Inc()\n\t\t\tn.enqueue(o)\n\t\t},\n\t\tUpdateFunc: func(_, o interface{}) {\n\t\t\teventCount.WithLabelValues(\"node\", \"update\").Inc()\n\t\t\tn.enqueue(o)\n\t\t},\n\t})\n\treturn... |
{
"audio": "",
"image": "",
"text": "func NewWorker(config Config) (worker.Worker, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tw := &Worker{\n\t\tconfig: config,\n\t\tserverDetails: make(chan apiserver.Details),\n\t}\n\t// Subscribe to API server address... | {
"audio": "",
"image": "",
"text": " err := config.Hub.Publish(apiserver.DetailsRequestTopic, req); err != nil {\n\t\treturn nil, errors.Annotate(err, \"requesting current apiserver details\")\n\t}\n\n\tif err := catacomb.Invoke(catacomb.Plan{\n\t\tSite: &w.catacomb,\n\t\tWork: func() error {\n\t\t\tdefer unsubs... | {
"audio": "",
"image": "",
"text": " *APIServer, s conversion.Scope) error {\n\treturn autoConvert_kubeadm_APIServer_To_v1beta2_APIServer(in, out, s)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m MeterStatusCode) String() string {\n\ts, ok :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " meterString[m]\n\tif !ok {\n\t\treturn MeterNotAvailable.String()\n\t}\n\treturn s\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string {\n\treturn idToName(s, c.hash)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func MeterStatusFromString(str string) MeterStatusCode {\n\tfor m, s := range meterString {\n\t\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " s == str {\n\t\t\treturn m\n\t\t}\n\t}\n\treturn MeterNotAvailable\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string {\n\tfor _, fn := range funcs {\n\t\ts = fn(s)\n\t}\n\treturn s\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (u *Unit) SetMeterStatus(codeStr, info string) error {\n\tcode, err := isValidMeterStatusCode(codeStr)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tmeterDoc, err := u.getMeterStatusDoc()\n\tif err != nil {\n\t\treturn errors.Annotatef(err, \"cannot update mete... | {
"audio": "",
"image": "",
"text": "\t}\n\t\treturn []txn.Op{\n\t\t\t{\n\t\t\t\tC: unitsC,\n\t\t\t\tId: u.doc.DocID,\n\t\t\t\tAssert: isAliveDoc,\n\t\t\t}, {\n\t\t\t\tC: meterStatusC,\n\t\t\t\tId: u.st.docID(u.globalMeterStatusKey()),\n\t\t\t\tAssert: txn.DocExists,\n\t\t\t\tUpdate: bson.D{{\"$... | {
"audio": "",
"image": "",
"text": " {\n\t\treturn string(r)\n\t}\n\tif u.User != nil {\n\t\tu.User = url.User(u.User.Username())\n\t}\n\treturn u.String()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func createMeterStatusOp(mb modelBackend, globalKey string, doc *meterStatusDoc) txn.Op {\n\tdoc.ModelUUID =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " mb.modelUUID()\n\treturn txn.Op{\n\t\tC: meterStatusC,\n\t\tId: mb.docID(globalKey),\n\t\tAssert: txn.DocMissing,\n\t\tInsert: doc,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn applicationCharmConfigKey(a.doc.Name, a.doc.CharmURL)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func removeMeterStatusOp(mb modelBackend, globalKey string) txn.Op {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn txn.Op{\n\t\tC: meterStatusC,\n\t\tId: mb.docID(globalKey),\n\t\tRemove: true,\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn OutPoint(fmt.Sprintf(\"%s:%d\", op.TxidStr, op.OutputIndex))\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (u *Unit) GetMeterStatus() (MeterStatus, error) {\n\tmm, err := u.st.MetricsManager()\n\tif err != nil {\n\t\treturn MeterStatus{MeterNotAvailable, \"\"}, errors.Annotatef(err, \"cannot retrieve meter status for metrics manager\")\n\t}\n\n\tmmStatus := mm.MeterStatus()\n\... | {
"audio": "",
"image": "",
"text": " MeterRed {\n\t\treturn mmStatus, nil\n\t}\n\n\tstatus, err := u.getMeterStatusDoc()\n\tif err != nil {\n\t\treturn MeterStatus{MeterNotAvailable, \"\"}, errors.Annotatef(err, \"cannot retrieve meter status for unit %s\", u.Name())\n\t}\n\n\tcode := MeterStatusFromString(statu... | {
"audio": "",
"image": "",
"text": " shouldBeAssigned {\n\t\t\treturn errors.Errorf(\"cannot set invalid status %q\", unitAgentStatus.Status)\n\t\t}\n\tcase status.Lost:\n\t\treturn errors.Errorf(\"cannot set status %q\", unitAgentStatus.Status)\n\tdefault:\n\t\treturn errors.Errorf(\"cannot set invalid status %... |
{
"audio": "",
"image": "",
"text": "func (dlr Downloader) Start(req Request) *Download {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " StartDownload(req, dlr.OpenBlob)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " req.RawGet}}\n\tcase CmdRawBatchGet:\n\t\treturn &tikvpb.BatchCommandsRequest_Request{Cmd: &tikvpb.BatchCommandsRequest_Request_RawBatchGet{RawBatchGet: req.RawBatchGet}}\n\tcase CmdRawPut:\n\t\treturn &tikvpb.BatchCommandsRequest_Request{Cmd: &tikvpb.BatchCommandsRequest_Req... |
{
"audio": "",
"image": "",
"text": "func (dlr Downloader) Download(req Request) (string, error) {\n\tif err := os.MkdirAll(req.TargetDir, 0755);",
"video": ""
} | {
"audio": "",
"image": "",
"text": " err != nil {\n\t\treturn \"\", errors.Trace(err)\n\t}\n\tdl := dlr.Start(req)\n\tfilename, err := dl.Wait()\n\treturn filename, errors.Trace(err)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " req.onlyMultipartForm() {\n\t\tbody, err := marshalMultipartForm(req.multipartForm, req.multipartFormBoundary)\n\t\tif err != nil {\n\t\t\treturn []byte(err.Error())\n\t\t}\n\t\treturn body\n\t}\n\treturn req.bodyBytes()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewMockMachineProvisioner(ctrl *gomock.Controller) *MockMachineProvisioner {\n\tmock := &MockMachineProvisioner{ctrl:",
"video": ""
} | {
"audio": "",
"image": "",
"text": " ctrl}\n\tmock.recorder = &MockMachineProvisionerMockRecorder{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 *MockMachineProvisioner) AvailabilityZone() (string, error) {\n\tret := m.ctrl.Call(m, \"AvailabilityZone\")\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 (m *MockMachineProvisioner) InstanceStatus() (status.Status, string, error) {\n\tret := m.ctrl.Call(m, \"InstanceStatus\")\n\tret0, _ := ret[0].(status.Status)\n\tret1, _",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error) {\n\tret := m.ctrl.Call(m, \"CompilePackage\", packageSource, compiledPackageDependencies)\n\tret0, _ := ret[0].(agentclient.BlobRef)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) KeepInstance() (bool, error) {\n\tret := m.ctrl.Call(m, \"KeepInstance\")\n\tret0,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error {\n\tret := m.ctrl.Call(m, \"RunScript\", scriptName, options)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) MachineTag() names_v2.MachineTag",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\tret := m.ctrl.Call(m, \"MachineTag\")\n\tret0, _ := ret[0].(names_v2.MachineTag)\n\treturn ret0\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tret0, _ := ret[0].(names_v2.Tag)\n\treturn ret0\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) ModelAgentVersion() (*version.Number, error) {\n\tret",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := m.ctrl.Call(m, \"ModelAgentVersion\")\n\tret0, _ := ret[0].(*version.Number)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.ConfigMap))\n\t})\n\treturn ret, err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) ProvisioningInfo() (*params.ProvisioningInfo, error) {\n\tret",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := m.ctrl.Call(m, \"ProvisioningInfo\")\n\tret0, _ := ret[0].(*params.ProvisioningInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.ConfigMap))\n\t})\n\treturn ret, err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) SetCharmProfiles(arg0 []string) error {\n\tret :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " m.ctrl.Call(m, \"SetCharmProfiles\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.Deployment))\n\t})\n\treturn ret, err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) SetInstanceInfo(arg0 instance.Id, arg1, arg2 string, arg3 *instance.HardwareCharacteristics, arg4 []params.NetworkConfig, arg5 []params.Volume, arg6 map[string]params.VolumeAttachmentInfo, arg7 []string) error {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tret := m.ctrl.Call(m, \"SetInstanceInfo\", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " arg2 fosite.AuthorizeResponder) error {\n\tret := m.ctrl.Call(m, \"HandleAuthorizeEndpointRequest\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *MockMachineProvisionerMockRecorder) SetInstanceInfo(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"SetInstanceInfo\", reflect.TypeOf((*MockMachineProvisioner)(nil).SetInstanceInfo), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateAuthorizeCodeSession\", reflect.TypeOf((*MockAuthorizeCodeStorage)(nil).CreateAuthorizeCodeSession), arg0, arg1, arg2)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) SetStatus(arg0 status.Status, arg1 string, arg2 map[string]interface{}) error {\n\tret",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := m.ctrl.Call(m, \"SetStatus\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " arg2 fosite.AuthorizeResponder) error {\n\tret := m.ctrl.Call(m, \"HandleAuthorizeEndpointRequest\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *MockMachineProvisionerMockRecorder) SetStatus(arg0, arg1, arg2 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"SetStatus\", reflect.TypeOf((*MockMachineProvisioner)(nil).SetStatus), arg0, arg1, arg2)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateAuthorizeCodeSession\", reflect.TypeOf((*MockAuthorizeCodeStorage)(nil).CreateAuthorizeCodeSession), arg0, arg1, arg2)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockMachineProvisioner) SetSupportedContainers(arg0 ...instance.ContainerType) error {\n\tvarargs := []interface{}{}\n\tfor _, a := range arg0 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := m.ctrl.Call(m, \"SetSupportedContainers\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListVersionsByFunctionWithContext\", varargs...)\n\tret0, _ := ret[0].(*lambda.ListVersionsByFunctionOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *MockMachineProvisionerMockRecorder) SetSupportedContainers(arg0 ...interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetSupportedContainers\",",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reflect.TypeOf((*MockMachineProvisioner)(nil).SetSupportedContainers), arg0...)\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 *MockMachineProvisioner) SupportedContainers() ([]instance.ContainerType, bool, error) {\n\tret := m.ctrl.Call(m, \"SupportedContainers\")\n\tret0, _",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := ret[0].([]instance.ContainerType)\n\tret1, _ := ret[1].(bool)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\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 *MockMachineProvisioner) WatchAllContainers() (watcher.StringsWatcher, error) {\n\tret",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := m.ctrl.Call(m, \"WatchAllContainers\")\n\tret0, _ := ret[0].(watcher.StringsWatcher)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.ConfigMap))\n\t})\n\treturn ret, err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *MockMachineProvisionerMockRecorder) WatchAllContainers() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"WatchAllContainers\", reflect.TypeOf((*MockMachineProvisioner)(nil).WatchAllContainers))\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 TokenResource(uri string) string {\n\tresource := uri\n\tif !strings.HasSuffix(resource, \"/\")",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tresource += \"/\"\n\t}\n\treturn resource\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif uri.Port() == \"\" {\n\t\turi.Host = fmt.Sprintf(\"%s:%d\", uri.Host, defaultPort)\n\t}\n\treturn uri.String(), nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func run(dir, command string, args ...string) (string, error) {\n\tlogger.Debugf(\"(%s) %s %v\", dir, command, args)\n\n\tcmd := exec.Command(command, args...)\n\tif dir != \"\" {\n\t\tcmd.Dir = dir\n\t}\n\n\tout, err",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := cmd.CombinedOutput()\n\toutput := string(out)\n\n\tlogger.Debugf(\"output: %v\", output)\n\treturn output, err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != \"\" {\n\t\targs = append(args, r.ID)\n\t}\n\n\tcmd := exec.Command(r.RuntimeCommand, args...)\n\treturn execWithStderrFallbackToStdout(cmd)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (m *MockInterface) GetBundle(arg0 *charm_v6.URL) (charm_v6.Bundle, error) {\n\tret",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := m.ctrl.Call(m, \"GetBundle\", arg0)\n\tret0, _ := ret[0].(charm_v6.Bundle)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.ConfigMap))\n\t})\n\treturn ret, err\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func stringKeysFromMap(m interface{}) (keys []string) {\n\tfor",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _, k := range reflect.ValueOf(m).MapKeys() {\n\t\tkeys = append(keys, k.String())\n\t}\n\treturn\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " errors.Annotate(err, \"failed to unmarshal JobConfig\").Err()\n\t}\n\treturn func(c context.Context, keys []*datastore.Key) error {\n\t\treturn m.Func(c, j.ID, cfg, keys)\n\t}, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func indent(prepend string, level int, append string) string {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " fmt.Sprintf(\"%s%*s%s\", prepend, level, \"\", append)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, va ...interface{}) error {\n\treturn l.logMsg(attrs, LEVEL_EMERG, format, va...)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (fsm *SimpleFSM) Logs() [][]byte {\n\tfsm.mu.Lock()\n\tdefer fsm.mu.Unlock()\n\tcopied := make([][]byte,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " len(fsm.logs))\n\tcopy(copied, fsm.logs)\n\treturn copied\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " NewTimeTable(timeTableGranularity, timeTableLimit),\n\t\tenterpriseAppliers: make(map[structs.MessageType]LogApplier, 8),\n\t\tenterpriseRestorers: make(map[SnapshotType]SnapshotRestorer, 8),\n\t}\n\n\t// Register all the log applier functions\n\tfsm.registerLogAppliers()\n\... |
{
"audio": "",
"image": "",
"text": "func (fsm *SimpleFSM) Apply(log *raft.Log) interface{} {\n\tfsm.mu.Lock()\n\tdefer fsm.mu.Unlock()\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfsm.logs = append(fsm.logs, log.Data)\n\treturn len(fsm.logs)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " NewTimeTable(timeTableGranularity, timeTableLimit),\n\t\tenterpriseAppliers: make(map[structs.MessageType]LogApplier, 8),\n\t\tenterpriseRestorers: make(map[SnapshotType]SnapshotRestorer, 8),\n\t}\n\n\t// Register all the log applier functions\n\tfsm.registerLogAppliers()\n\... |
{
"audio": "",
"image": "",
"text": "func (fsm *SimpleFSM) Snapshot() (raft.FSMSnapshot, error) {\n\tfsm.mu.Lock()\n\tdefer fsm.mu.Unlock()\n\tcopied := make([][]byte,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " len(fsm.logs))\n\tcopy(copied, fsm.logs)\n\treturn &SimpleSnapshot{copied, len(copied)}, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " NewTimeTable(timeTableGranularity, timeTableLimit),\n\t\tenterpriseAppliers: make(map[structs.MessageType]LogApplier, 8),\n\t\tenterpriseRestorers: make(map[SnapshotType]SnapshotRestorer, 8),\n\t}\n\n\t// Register all the log applier functions\n\tfsm.registerLogAppliers()\n\... |
{
"audio": "",
"image": "",
"text": "func (fsm *SimpleFSM) Restore(rc io.ReadCloser) error {\n\tdefer rc.Close()\n\tvar logs [][]byte\n\tif err := gob.NewDecoder(rc).Decode(&logs); err != nil {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn err\n\t}\n\tfsm.mu.Lock()\n\tfsm.logs = logs\n\tfsm.mu.Unlock()\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdefer rc.Close()\n\terr = to.Put(rc)\n\tif err != nil {\n\t\treturn\n\t}\n\tfrom.Delete()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (snap *SimpleSnapshot) Persist(sink raft.SnapshotSink) error {\n\tif err := gob.NewEncoder(sink).Encode(snap.logs[:snap.n]); err != nil {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tsink.Cancel()\n\t\treturn err\n\t}\n\tsink.Close()\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor i := range snap.Nodes {\n\t\tsnap.Nodes[i].Node.Config.EnableMsgEvents = true\n\t\tsnap.Nodes[i].Node.Config.Services = s.serviceNames\n\t\tfor _, o := range opts {\n\t\t\to(snap.Nodes[i].Node.Config)\n\t\t}\n\t}\n\n\tif err := s.Net.Load(&snap); err != nil {\n\t\tretu... |
{
"audio": "",
"image": "",
"text": "func NewAPIAuthenticator(st *apiprovisioner.State) (AuthenticationProvider, error) {\n\tstateAddresses, err := st.StateAddresses()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tapiAddresses, err := st.APIAddresses()\n\tif err != nil {\n\t\treturn nil, errors.Tr... | {
"audio": "",
"image": "",
"text": " &mongo.MongoInfo{\n\t\tInfo: mongo.Info{\n\t\t\tAddrs: stateAddresses,\n\t\t\tCACert: caCert,\n\t\t},\n\t}\n\tapiInfo := &api.Info{\n\t\tAddrs: apiAddresses,\n\t\tCACert: caCert,\n\t\tModelTag: names.NewModelTag(modelUUID),\n\t}\n\treturn &simpleAuth{stateInfo, apiInfo}... | {
"audio": "",
"image": "",
"text": "\n\t\t\tsuspendOps, err := st.suspendRevokedRelationsOps(offerUUID, user.Id())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t}\n\t\t\tops = append(ops, suspendOps...)\n\t\t}\n\t\treturn ops, nil\n\t}\n\n\terr = st.db().Run(buildTxn)\n\treturn errors.Trac... |
{
"audio": "",
"image": "",
"text": "func SetupAuthentication(\n\tmachine TaggedPasswordChanger,\n\tstateInfo *mongo.MongoInfo,\n\tapiInfo *api.Info,\n) (*mongo.MongoInfo, *api.Info, error) {\n\tauth :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " simpleAuth{stateInfo, apiInfo}\n\treturn auth.SetupAuthentication(machine)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *api.Container) (*int64, error) {\n\treturn nil, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewAPI(\n\tbackend Backend,\n\tauthorizer facade.Authorizer,\n\tblockChecker BlockChecker,\n) (*API, error) {\n\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " !authorizer.AuthClient() {\n\t\treturn nil, common.ErrPerm\n\t}\n\treturn &API{\n\t\tbackend: backend,\n\t\tauthorizer: authorizer,\n\t\tcheck: blockChecker,\n\t}, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\treturn authorizer.AuthOwner(tag)\n\t\t}, nil\n\t}\n\taccessUnit := func() (common.AuthFunc, error) {\n\t\treturn func(tag names.Tag) bool {\n\t\t\treturn false\n\t\t}, nil\n\t}\n\n\treturn &API{\n\t\tst: st,\n\t\tresources: resources,\n\t\t... |
{
"audio": "",
"image": "",
"text": "func (api *API) SetFirewallRules(args params.FirewallRuleArgs) (params.ErrorResults, error) {\n\tvar errResults params.ErrorResults\n\tif err := api.checkAdmin(); err != nil {\n\t\treturn errResults, errors.Trace(err)\n\t}\n\tif err := api.check.ChangeAllowed(); err != nil {\n... | {
"audio": "",
"image": "",
"text": "\tlogger.Debugf(\"saving firewall rule %+v\", arg)\n\t\terr := api.backend.SaveFirewallRule(state.FirewallRule{\n\t\t\tWellKnownService: state.WellKnownServiceType(arg.KnownService),\n\t\t\tWhitelistCIDRs: arg.WhitelistCIDRS,\n\t\t})\n\t\tresults[i].Error = common.ServerErro... | {
"audio": "",
"image": "",
"text": " unit)\n\t\t\t}\n\t\t\tentities[i].Tag = names.NewUnitTag(unit).String()\n\t\t}\n\t\targs.Tags = params.Entities{Entities: entities}\n\t}\n\n\tresults := new(params.ErrorResults)\n\terr := c.facade.FacadeCall(\"ResolveUnitErrors\", args, results)\n\tif err != nil {\n\t\treturn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.