anchor
dict
positive
dict
negative
dict
{ "audio": "", "image": "", "text": "func NewSocketListener(socketPath string, handler ConnectionHandler) (*socketListener, error) {\n\tlistener, err := sockets.Listen(socketPath)\n", "video": "" }
{ "audio": "", "image": "", "text": "\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tsListener := &socketListener{listener: listener, handler: handler}\n\tsListener.t.Go(sListener.loop)\n\treturn sListener, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " rlf.queue.Pop(func(_ interface{}) error {\n\t\treturn rlf.Handler()\n\t}); err != nil {\n\t\tutilruntime.HandleError(err)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (l *socketListener) Stop() error {\n\tl.t.Kill(nil)\n\terr := l.listener.Close()\n\tif err != nil {\n\t\tlogger.Errorf(\"failed", "video": "" }
{ "audio": "", "image": "", "text": " to close the collect-metrics listener: %v\", err)\n\t}\n\treturn l.t.Wait()\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\tl.open = false\n\treturn l.listener.Close()\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewPeriodicWorker(do jworker.PeriodicWorkerCall, period time.Duration, newTimer func(time.Duration) jworker.PeriodicTimer, stop func()) worker.Worker {\n\treturn &periodicWorker{\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\tWorker: jworker.NewPeriodicWorker(do, period, newTimer, jworker.Jitter(0.2)),\n\t\tstop: stop,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " nil {\n\t\tworker.TimeInfo = &timeoutInfo{worker: worker, started: time.Now(), state: StartJob}\n\t\tworker.TimeoutChannel <- worker.TimeInfo\n\t}\n\tworker.workInfo.Work(job, worker)\n\tif worker.TimeoutChannel != nil {\n\t\tworker.TimeInfo.state = EndJob\n\t\tworker.Timeout...
{ "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\n\tmc, err := modelCredential(config.Facade)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\t// This worker needs to mo...
{ "audio": "", "image": "", "text": " Watchers that are added using catacomb.Add method\n\t// miss out on a first call of Worker's Plan.Work method and can, thus,\n\t// be missing out on an initial change.\n\tplan := catacomb.Plan{\n\t\tSite: &v.catacomb,\n\t\tWork: v.loop,\n\t\tInit: []worker.Worker{v.modelCrede...
{ "audio": "", "image": "", "text": "\t\t// If this edge doesn't extend to the source node, we'll\n\t\t// terminate our search as we can now conclude that the node is\n\t\t// publicly advertised within the graph due to the local node\n\t\t// knowing of the current edge.\n\t\tif !bytes.Equal(info.NodeKey1Bytes[:],...
{ "audio": "", "image": "", "text": "func FilesystemParams(\n\tf state.Filesystem,\n\tstorageInstance state.StorageInstance,\n\tmodelUUID, controllerUUID string,\n\tenvironConfig *config.Config,\n\tpoolManager poolmanager.PoolManager,\n\tregistry storage.ProviderRegistry,\n) (params.FilesystemParams, error) {\n\n...
{ "audio": "", "image": "", "text": "\n\tproviderType, cfg, err := StoragePoolConfig(pool, poolManager, registry)\n\tif err != nil {\n\t\treturn params.FilesystemParams{}, errors.Trace(err)\n\t}\n\tresult := params.FilesystemParams{\n\t\tf.Tag().String(),\n\t\t\"\", // volume tag\n\t\tsize,\n\t\tstring(providerTy...
{ "audio": "", "image": "", "text": "\t\t}\n\t}\n\tfor filesystemTag := range params.filesystemAttachments {\n\t\tfilesystem, err := sb.Filesystem(filesystemTag)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tif params, ok := filesystem.Params(); ok {\n\t\t\tpools.Add(params.Pool)\n\t\t} el...
{ "audio": "", "image": "", "text": "func FilesystemToState(v params.Filesystem) (names.FilesystemTag, state.FilesystemInfo, error) {\n\tfilesystemTag, err := names.ParseFilesystemTag(v.FilesystemTag)\n", "video": "" }
{ "audio": "", "image": "", "text": "\tif err != nil {\n\t\treturn names.FilesystemTag{}, state.FilesystemInfo{}, errors.Trace(err)\n\t}\n\treturn filesystemTag, state.FilesystemInfo{\n\t\tv.Info.Size,\n\t\t\"\", // pool is set by state\n\t\tv.Info.FilesystemId,\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn names.StorageTag{}, errors.NewNotAssigned(nil, msg)\n\t}\n\treturn names.NewStorageTag(v.doc.StorageId), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func FilesystemFromState(f state.Filesystem) (params.Filesystem, error) {\n\tinfo, err := f.Info()\n\tif err != nil {\n\t\treturn params.Filesystem{}, errors.Trace(err)\n\t}\n\tresult := params.Filesystem{\n\t\tf.FilesystemTag().String(),\n\t\t\"\",\n\t\tFilesystemInfoFromStat...
{ "audio": "", "image": "", "text": " err == nil {\n\t\tresult.VolumeTag = volumeTag.String()\n\t} else if err != state.ErrNoBackingVolume {\n\t\treturn params.Filesystem{}, errors.Trace(err)\n\t}\n\treturn result, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t}\n\t}\n\tfor filesystemTag := range params.filesystemAttachments {\n\t\tfilesystem, err := sb.Filesystem(filesystemTag)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tif params, ok := filesystem.Params(); ok {\n\t\t\tpools.Add(params.Pool)\n\t\t} el...
{ "audio": "", "image": "", "text": "func FilesystemInfoFromState(info state.FilesystemInfo) params.FilesystemInfo {\n\treturn params.FilesystemInfo{", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tinfo.FilesystemId,\n\t\tinfo.Pool,\n\t\tinfo.Size,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tif err != nil {\n\t\treturn names.FilesystemTag{}, state.FilesystemInfo{}, errors.Trace(err)\n\t}\n\treturn filesystemTag, state.FilesystemInfo{\n\t\tv.Info.Size,\n\t\t\"\", // pool is set by state\n\t\tv.Info.FilesystemId,\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func FilesystemAttachmentToState(in params.FilesystemAttachment) (names.MachineTag, names.FilesystemTag, state.FilesystemAttachmentInfo, error) {\n\tmachineTag, err := names.ParseMachineTag(in.MachineTag)\n\tif err != nil {\n\t\treturn names.MachineTag{}, names.FilesystemTag{}...
{ "audio": "", "image": "", "text": "\treturn names.MachineTag{}, names.FilesystemTag{}, state.FilesystemAttachmentInfo{}, err\n\t}\n\tinfo := state.FilesystemAttachmentInfo{\n\t\tin.Info.MountPoint,\n\t\tin.Info.ReadOnly,\n\t}\n\treturn machineTag, filesystemTag, info, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tif err != nil {\n\t\treturn names.FilesystemTag{}, state.FilesystemInfo{}, errors.Trace(err)\n\t}\n\treturn filesystemTag, state.FilesystemInfo{\n\t\tv.Info.Size,\n\t\t\"\", // pool is set by state\n\t\tv.Info.FilesystemId,\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func FilesystemAttachmentFromState(v state.FilesystemAttachment) (params.FilesystemAttachment, error) {\n\tinfo, err := v.Info()\n\tif err != nil {\n\t\treturn params.FilesystemAttachment{}, errors.Trace(err)\n\t}", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn params.FilesystemAttachment{\n\t\tv.Filesystem().String(),\n\t\tv.Host().String(),\n\t\tFilesystemAttachmentInfoFromState(info),\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t}\n\t}\n\tfor filesystemTag := range params.filesystemAttachments {\n\t\tfilesystem, err := sb.Filesystem(filesystemTag)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tif params, ok := filesystem.Params(); ok {\n\t\t\tpools.Add(params.Pool)\n\t\t} el...
{ "audio": "", "image": "", "text": "func FilesystemAttachmentInfoFromState(info state.FilesystemAttachmentInfo) params.FilesystemAttachmentInfo", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn params.FilesystemAttachmentInfo{\n\t\tinfo.MountPoint,\n\t\tinfo.ReadOnly,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tif unitInfo.MachineId == machineId {\n\t\t\t\t\tfilesystemAttachmentInfo.UnitId = unitId\n\t\t\t\t\tfilesystemAttachmentInfo.UnitStorageAttachment = unitInfo\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\thaveMachines = true\n\t\t\tfilesystemAttachmentInfos = append(filesystemA...
{ "audio": "", "image": "", "text": "func ParseFilesystemAttachmentIds(stringIds []string) ([]params.MachineStorageId, error) {\n\tids := make([]params.MachineStorageId, len(stringIds))\n\tfor i, s := range stringIds {\n\t\tm, f, err := state.ParseFilesystemAttachmentId(s)\n\t\tif err != nil {", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\t\treturn nil, err\n\t\t}\n\t\tids[i] = params.MachineStorageId{\n\t\t\tMachineTag: m.String(),\n\t\t\tAttachmentTag: f.String(),\n\t\t}\n\t}\n\treturn ids, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " s.packer.PackRetransmission(retransmitPacket)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tackhandlerPackets := make([]*ackhandler.Packet, len(packets))\n\tfor i, packet := range packets {\n\t\tackhandlerPackets[i] = packet.ToAckHandlerPacket()\n\t}\n\ts.sentPacketHandle...
{ "audio": "", "image": "", "text": "func API2Result(r params.PayloadResult) (payload.Result, error) {\n\tresult := payload.Result{\n\t\tNotFound: r.NotFound,\n\t}\n\n\tid, err := api.API2ID(r.Tag)\n\tif err != nil {\n\t\treturn result, errors.Trace(err)\n\t}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tresult.ID = id\n\n\tif r.Payload != nil {\n\t\tpl, err := api.API2Payload(*r.Payload)\n\t\tif err != nil {\n\t\t\treturn result, errors.Trace(err)\n\t\t}\n\t\tresult.Payload = &pl\n\t}\n\n\tif r.Error != nil {\n\t\tresult.Error = common.RestoreError(r.Error)\n\t}\n\n\tretu...
{ "audio": "", "image": "", "text": "\t}\n\tif len(results.Results) != 1 {\n\t\treturn params.ControllersChanges{}, errors.Errorf(\"expected 1 result, got %d\", len(results.Results))\n\t}\n\tresult := results.Results[0]\n\tif result.Error != nil {\n\t\treturn params.ControllersChanges{}, result.Error\n\t}\n\tretu...
{ "audio": "", "image": "", "text": "func Payloads2TrackArgs(payloads []payload.Payload) params.TrackPayloadArgs {\n\tvar args params.TrackPayloadArgs\n\tfor _, pl", "video": "" }
{ "audio": "", "image": "", "text": " := range payloads {\n\t\tfullPayload := payload.FullPayloadInfo{Payload: pl}\n\t\targ := api.Payload2api(fullPayload)\n\t\targs.Payloads = append(args.Payloads, arg)\n\t}\n\treturn args\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tvar info jujuclient.RegistrationInfo\n\tif _, err := asn1.Unmarshal(decodedData, &info); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tparams.controllerAddrs = info.Addrs\n\tparams.userTag = names.NewUser...
{ "audio": "", "image": "", "text": "func FullIDs2LookUpArgs(fullIDs []string) params.LookUpPayloadArgs {\n\tvar args params.LookUpPayloadArgs\n\tfor _, fullID := range fullIDs {\n\t\tname, rawID :=", "video": "" }
{ "audio": "", "image": "", "text": " payload.ParseID(fullID)\n\t\targs.Args = append(args.Args, params.LookUpPayloadArg{\n\t\t\tName: name,\n\t\t\tID: rawID,\n\t\t})\n\t}\n\treturn args\n}", "video": "" }
{ "audio": "", "image": "", "text": " []string\n\tfor _, h := range hosts {\n\t\tfor _, p := range paths {\n\t\t\tpatterns = append(patterns, h+p)\n\t\t}\n\t}\n\treturn patterns, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func IDs2SetStatusArgs(ids []string, status string) params.SetPayloadStatusArgs {\n\tvar args params.SetPayloadStatusArgs\n\tfor _, id := range ids {\n\t\targ := params.SetPayloadStatusArg{\n\t\t\tStatus: status,\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\t\targ.Tag = names.NewPayloadTag(id).String()\n\t\targs.Args = append(args.Args, arg)\n\t}\n\treturn args\n}", "video": "" }
{ "audio": "", "image": "", "text": " storagecommon.BlockDeviceFromState(stateBlockDevice), nil\n\t}\n\tfor i, arg := range args.Ids {\n\t\tvar result params.BlockDeviceResult\n\t\tblockDevice, err := one(arg)\n\t\tif err != nil {\n\t\t\tresult.Error = common.ServerError(err)\n\t\t} else {\n\t\t\tresult.Result = ...
{ "audio": "", "image": "", "text": "func stateStepsFor221() []Step {\n\treturn []Step{\n\t\t&upgradeStep{\n\t\t\tdescription: \"add update-status hook config settings\",\n\t\t\ttargets: []Target{DatabaseMaster},\n\t\t\trun: func(context Context) error {\n\t\t\t\treturn context.State().AddUpdateStatusHookSett...
{ "audio": "", "image": "", "text": "\t\t\tdescription: \"correct relation unit counts for subordinates\",\n\t\t\ttargets: []Target{DatabaseMaster},\n\t\t\trun: func(context Context) error {\n\t\t\t\treturn context.State().CorrectRelationUnitCounts()\n\t\t\t},\n\t\t},\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tOnStop: func(_ context.Context) error {\n\t\t\treturn p.Close()\n\t\t},\n\t})\n\treturn p\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (e *environ) Subnets(ctx context.ProviderCallContext, inst instance.Id, subnetIds []network.Id) ([]network.SubnetInfo, error) {\n\t// In GCE all the subnets are in all AZs.\n\tzones, err := e.zoneNames(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tids...
{ "audio": "", "image": "", "text": "\n\t} else {\n\t\tresults, err = e.getInstanceSubnets(ctx, inst, ids, zones)\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tif missing := ids.Missing(); len(missing) != 0 {\n\t\treturn nil, errors.NotFoundf(\"subnets %v\", formatMissing(missing))\n\t}\n\n...
{ "audio": "", "image": "", "text": " {\n\t\tnf.E = err // store first instance of non-fatal error\n\t}\n\treturn true\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (e *environ) NetworkInterfaces(ctx context.ProviderCallContext, instId instance.Id) ([]network.InterfaceInfo, error) {\n\tinsts, err := e.Instances(ctx, []instance.Id{instId})\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tenvInst, ok := insts[0].(*environI...
{ "audio": "", "image": "", "text": " err != nil {\n\t\t\treturn nil, errors.Annotatef(err, \"instance %q\", instId)\n\t\t}\n\t\tresults = append(results, network.InterfaceInfo{\n\t\t\tDeviceIndex: i,\n\t\t\tCIDR: details.cidr,\n\t\t\t// The network interface has no id in GCE so it's\n\t\t\t// identified b...
{ "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 findNetworkDetails(iface compute.NetworkInterface, subnets subnetMap, networks networkMap) (networkDetails, error) {\n\tvar result networkDetails\n\tif iface.Subnetwork == \"\" {\n\t\t// This interface is on a legacy network.\n\t\tnetwk, ok := networks[iface.Network]\n\t\...
{ "audio": "", "image": "", "text": " %q\", iface.Network)\n\t\t}\n\t\tresult.cidr = netwk.IPv4Range\n\t\tresult.subnet = \"\"\n\t\tresult.network = network.Id(netwk.Name)\n\t} else {\n\t\tsubnet, ok := subnets[iface.Subnetwork]\n\t\tif !ok {\n\t\t\treturn result, errors.NotFoundf(\"subnet %q\", iface.Subnetwork)...
{ "audio": "", "image": "", "text": " err != nil {\n\t\t\treturn nil, errors.Annotatef(maybeConvertCredentialError(err, ctx), \"failed to retrieve subnet %q info\", iface.SubnetId)\n\t\t}\n\t\tif len(resp.Subnets) != 1 {\n\t\t\treturn nil, errors.Errorf(\"expected 1 subnet, got %d\", len(resp.Subnets))\n\t\t}\n\t...
{ "audio": "", "image": "", "text": "func (e *environ) AllocateContainerAddresses(context.ProviderCallContext, instance.Id, names.MachineTag, []network.InterfaceInfo) ([]network.InterfaceInfo,", "video": "" }
{ "audio": "", "image": "", "text": " error) {\n\treturn nil, errors.NotSupportedf(\"container addresses\")\n}", "video": "" }
{ "audio": "", "image": "", "text": " and adding %s\",\n\t\t\t\tname, string(val.ProviderId))\n\t\t\texchanges[name] = network.SpaceInfo{\n\t\t\t\tName: name,\n\t\t\t\tProviderId: val.SpaceProviderId,\n\t\t\t\tSubnets: []network.SubnetInfo{\n\t\t\t\t\tval,\n\t\t\t\t},\n\t\t\t}\n\t\t} else {\n\t\t\tlogger.In...
{ "audio": "", "image": "", "text": "func (*environ) SSHAddresses(ctx context.ProviderCallContext, addresses []network.Address) ([]network.Address, error) {\n\tbestAddress, ok := network.SelectPublicAddress(addresses)\n\tif ok", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\treturn []network.Address{bestAddress}, nil\n\t} else {\n\t\t// fallback\n\t\treturn addresses, nil\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " func(ctx context.Context) error {\n\t\treturn UpdateTenant(ctx, config)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (s *includeSet) Include(item string) bool {\n\tif s.items.Contains(item)", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\ts.items.Remove(item)\n\t\treturn true\n\t}\n\treturn false\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif item.id != \"\" {\n\t\tout[\"id\"] = item.id\n\t}\n\tif item.prevId != \"\" {\n\t\tout[\"prev-id\"] = item.prevId\n\t}\n\tfor _, format := range item.formats {\n\t\tout[format.Name()] = format.Export()\n\t}\n\treturn out, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (v KnownServiceValue) Validate() error {\n\tswitch v {\n\tcase SSHRule, JujuControllerRule, JujuApplicationOfferRule:\n\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " nil\n\t}\n\treturn errors.NotValidf(\"known service %q\", v)\n}", "video": "" }
{ "audio": "", "image": "", "text": " err error) {\n\tresult.V = v\n\tswitch int32(v) {\n\tcase 0:\n\t\t// void\n\t}\n\treturn\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (d datastore) Get(path string, data interface{}) error {\n\tcurrent := d[path]\n\tif current == nil {\n", "video": "" }
{ "audio": "", "image": "", "text": "\t\treturn errors.NotFoundf(path)\n\t}\n\tdata = current\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " w.current\n\t}\n\twt := w.gen()\n\twt.Then().WhenOnly(func(_ interface{}) {\n\t\tw.current = nil\n\t})\n\treturn wt\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (d datastore) Put(path string, data interface{}) error {\n", "video": "" }
{ "audio": "", "image": "", "text": "\td[path] = data\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tfilepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error {\n\t\t\t\tmatched, err := filepath.Match(\"*.json\", info.Name())\n\t\t\t\tif err != nil {\n\t\t\t\t\twarn(err)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif matched {\n\t\t\t\t\tc <- path\n\t\t\t...
{ "audio": "", "image": "", "text": "func (d *datastore) PutReader(path string, data io.Reader) error {\n\tbuffer := []byte{}\n\t_, err := data.Read(buffer)\n\tif err", "video": "" }
{ "audio": "", "image": "", "text": " != nil {\n\t\treturn errors.Trace(err)\n\t}\n\treturn d.Put(path, buffer)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdata := i.Data()\n\tbuffer := bytes.NewBuffer(data)\n\treturn image.Decode(buffer)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (c FakeClient) WithChannel(channel params.Channel)", "video": "" }
{ "audio": "", "image": "", "text": " *ChannelAwareFakeClient {\n\treturn &ChannelAwareFakeClient{channel, c}\n}", "video": "" }
{ "audio": "", "image": "", "text": " go to recover, we'll present this in order to derive the private\n\t// key.\n\t_, shaChainPoint := btcec.PrivKeyFromBytes(btcec.S256(), b.Bytes())\n\n\treturn Single{\n\t\tVersion: DefaultSingleVersion,\n\t\tIsInitiator: channel.IsInitiator,\n\t\tChainHash: ...
{ "audio": "", "image": "", "text": "func (c ChannelAwareFakeClient) Get(path string, value interface{}) error {", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn c.charmstore.Get(path, value)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\tfilepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error {\n\t\t\t\tmatched, err := filepath.Match(\"*.json\", info.Name())\n\t\t\t\tif err != nil {\n\t\t\t\t\twarn(err)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif matched {\n\t\t\t\t\tc <- path\n\t\t\t...
{ "audio": "", "image": "", "text": "func (r Repository) AddCharm(id *charm.URL, channel params.Channel, force bool) error {\n\twithRevision := r.addRevision(id)\n\talreadyAdded := r.added[string(channel)]\n\n\tfor _, charm := range alreadyAdded {\n\t\tif *withRevision == charm {\n\t\t\treturn nil\n\t\t\t// TODO(...
{ "audio": "", "image": "", "text": "\t\t// } else {\n\t\t\t// \treturn errors.NewAlreadyExists(errors.NewErr(\"%v already added in channel %v\", id, channel))\n\t\t\t// }\n\t\t}\n\t}\n\tr.added[string(channel)] = append(alreadyAdded, *withRevision)\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t// Check prohibited\n\tfor _, r := range out {\n\t\tif p.runeIsProhibited(r) {\n\t\t\treturn \"\", Error{Msg: errProhibited, Rune: r}\n\t\t}\n\t}\n\n\t// Check BiDi allowed\n\tif p.CheckBiDi {\n\t\tif err := passesBiDiRules(out); err != nil {\n\t\t\treturn \"\", err\n\t\t}...
{ "audio": "", "image": "", "text": "func (r Repository) AddCharmWithAuthorization(id *charm.URL, channel params.Channel,", "video": "" }
{ "audio": "", "image": "", "text": " macaroon *macaroon.Macaroon, force bool) error {\n\treturn r.AddCharm(id, channel, force)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\treturn nil, fmt.Errorf(\"error reading channel %q: %v\", resolved, err)\n\t}\n\tchannel, err := ParseChannel(channelBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing channel %q: %v\", resolved, err)\n\t}\n\tglog.V(4).Infof(\"Channel contents: %s\", stri...
{ "audio": "", "image": "", "text": "func (r Repository) AddLocalCharm(id *charm.URL, details charm.Charm, force bool) (*charm.URL, error)", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn id, r.AddCharm(id, params.NoChannel, force)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\treturn url, true\n\t\t}\n\t\treturn \"\", false\n\t}\n\treturn url, true\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (r Repository) CharmInfo(charmURL string) (*charms.CharmInfo, error) {\n\tcharmId, err := charm.ParseURL(charmURL)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tcharmDetails, err := r.Get(charmId)\n\tif", "video": "" }
{ "audio": "", "image": "", "text": " err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tinfo := charms.CharmInfo{\n\t\tRevision: charmDetails.Revision(),\n\t\tURL: charmId.String(),\n\t\tConfig: charmDetails.Config(),\n\t\tMeta: charmDetails.Meta(),\n\t\tActions: charmDetails.Actions(),\n\t\tM...
{ "audio": "", "image": "", "text": "\n\t\t}\n\t\tbatch.Metrics, err = decodeMetrics(filepath.Join(r.dir, batch.UUID))\n\t\tif err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t\tif len(batch.Metrics) > 0 {\n\t\t\tbatches = append(batches, batch)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := filepath.Walk(r.dir, ...
{ "audio": "", "image": "", "text": "func (r Repository) Resolve(ref *charm.URL) (canonRef *charm.URL, supportedSeries []string, err error) {", "video": "" }
{ "audio": "", "image": "", "text": "\n\treturn r.addRevision(ref), []string{\"trusty\", \"wily\", \"quantal\"}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " an internal server error\n\t\tif err != nil {\n\t\t\tj.Logger.\n\t\t\t\tWithField(\"component\", \"auth\").\n\t\t\t\tWithField(\"remote_addr\", r.RemoteAddr).\n\t\t\t\tWithField(\"method\", r.Method).\n\t\t\t\tWithField(\"url\", r.URL).\n\t\t\t\tError(\"Internal authenticatio...
{ "audio": "", "image": "", "text": "func (r Repository) Get(id *charm.URL) (charm.Charm, error) {\n\twithRevision := r.addRevision(id)\n\tcharmData := r.charms[r.channel][*withRevision]\n\tif charmData == nil {\n\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " charmData, errors.NotFoundf(\"cannot retrieve \\\"%v\\\": charm\", id.String())\n\t}\n\treturn charmData, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn newrelationNetworksWatcher(r.st, r.Tag().Id(), ingress)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (r Repository) GetBundle(id *charm.URL) (charm.Bundle, error) {\n\tbundleData := r.bundles[r.channel][*id]\n\tif bundleData == nil {\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\treturn nil, errors.NotFoundf(id.String())\n\t}\n\treturn bundleData, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\tspan.SetTag(\"http.url\", r.HTTPRequest.URL.Hostname()+r.HTTPRequest.URL.EscapedPath())\n\t\t\tspan.SetTag(\"out.host\", r.HTTPRequest.URL.Hostname())\n\t\t\tspan.SetTag(\"out.port\", r.HTTPRequest.URL.Port())\n\n\t\t\th.Fn(r)\n\n\t\t\tif r.HTTPResponse != nil {\n\t\t\t\...
{ "audio": "", "image": "", "text": "func (r Repository) Publish(id *charm.URL, channels []params.Channel, resources map[string]int) error {\n", "video": "" }
{ "audio": "", "image": "", "text": "\tfor _, channel := range channels {\n\t\tpublished := r.published[channel]\n\t\tpublished.Add(id.String())\n\t\tr.published[channel] = published\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " s.Resources {\n\t\tif r.NeedJWT() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "video": "" }
{ "audio": "", "image": "", "text": "func signature(r io.Reader) (hash []byte, err error) {\n\th := sha512.New384()\n\t_, err = io.Copy(h, r)\n\tif err != nil {\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\treturn nil, errors.Trace(err)\n\t}\n\thash = []byte(fmt.Sprintf(\"%x\", h.Sum(nil)))\n\treturn hash, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\n\tif !hash.Available() {\n\t\treturn MessageImprint{}, protocol.ErrUnsupported\n\t}\n\th := hash.New()\n\tif _, err := io.Copy(h, r); err != nil {\n\t\treturn MessageImprint{}, err\n\t}\n\n\treturn MessageImprint{\n\t\tHashAlgorithm: pkix.AlgorithmIdentifier{Algorithm: dig...
{ "audio": "", "image": "", "text": "func New(\n\tmodelUUID string,\n\tmanagedStorage blobstore.ManagedStorage,\n\tmetadataCollection mongo.Collection,\n\trunner jujutxn.Runner,\n) Storage {\n\treturn &binaryStorage{\n\t\tmodelUUID: ", "video": "" }
{ "audio": "", "image": "", "text": " modelUUID,\n\t\tmanagedStorage: managedStorage,\n\t\tmetadataCollection: metadataCollection,\n\t\ttxnRunner: runner,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (s *binaryStorage) Add(r io.Reader, metadata Metadata) (resultErr error) {\n\t// Add the binary file to storage.\n\tpath := fmt.Sprintf(\"tools/%s-%s\", metadata.Version, metadata.SHA256)\n\tif err := s.managedStorage.PutForBucket(s.modelUUID, path, r, metadata.Size); err...
{ "audio": "", "image": "", "text": "\t\t\top.Update = bson.D{{\n\t\t\t\t\t\"$set\", bson.D{\n\t\t\t\t\t\t{\"size\", metadata.Size},\n\t\t\t\t\t\t{\"sha256\", metadata.SHA256},\n\t\t\t\t\t\t{\"path\", path},\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t}\n\t\t}\n\t\treturn []txn.Op{op}, nil\n\t}\n\terr := s.txnRunner.Run(bui...
{ "audio": "", "image": "", "text": "\t\tni := \"\"\n\t\tif chi != nil && chi.Metadata != nil {\n\t\t\tni = chi.Metadata.Name\n\t\t}\n\n\t\tnj := \"\"\n\t\tif chj != nil && chj.Metadata != nil {\n\t\t\tnj = chj.Metadata.Name\n\t\t}\n\n\t\treturn ni < nj\n\t}\n\tsort.Sort(s)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func createFirewallRuleVm(envName string, machineId string, portRange network.IngressRule) string {\n\tports := []string{}\n\tfor p := portRange.FromPort; p <= portRange.ToPort; p++ {\n\t\tports = append(ports, fmt.Sprintf(\"PORT %d\", p))\n\t}\n\tvar portList string\n\tif len...
{ "audio": "", "image": "", "text": " = fmt.Sprintf(\"( %s )\", strings.Join(ports, \" AND \"))\n\t} else if len(ports) == 1 {\n\t\tportList = ports[0]\n\t}\n\treturn fmt.Sprintf(firewallRuleVm, envName, machineId, strings.ToLower(portRange.Protocol), portList)\n}", "video": "" }
{ "audio": "", "image": "", "text": " port+uint16(numPorts-1) {\n\t\treturn 0, errors.New(\"insufficient ports available\")\n\t}\n\n\tp.nextPort = p.nextPort + uint16(numPorts)\n\treturn uint16(port), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (b BakeryServicePublicKeyLocator) PublicKeyForLocation(string)", "video": "" }
{ "audio": "", "image": "", "text": " (*bakery.PublicKey, error) {\n\treturn b.Service.PublicKey(), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " nil\n\t}\n\n\treturn filter(rawResolved, func(a, b ast.Ref) bool {\n\t\treturn b.HasPrefix(a)\n\t}), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewBakeryService(\n\tst *state.State,\n\tstore bakerystorage.ExpirableStorage,\n\tlocator bakery.PublicKeyLocator,\n) (*bakery.Service, *bakery.KeyPair, error) {\n\tkey, err := bakery.GenerateKey()\n\tif err != nil {\n\t\treturn nil, nil, errors.Annotate(err, \"generating...
{ "audio": "", "image": "", "text": " \"juju model \" + st.ModelUUID(),\n\t\tStore: store,\n\t\tKey: key,\n\t\tLocator: locator,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, errors.Trace(err)\n\t}\n\treturn service, key, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\t\t\treturn nil, bakery.ErrNotFound\n\t\t}\n\t\treturn nil, errors.Annotatef(err, \"cannot get item for location %q\", location)\n\t}\n\tvar rootKey legacyRootKey\n\terr = json.Unmarshal([]byte(i.Item), &rootKey)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"was ...
{ "audio": "", "image": "", "text": "func (s *ExpirableStorageBakeryService) ExpireStorageAfter(t time.Duration) (authentication.ExpirableStorageBakeryService, error) {\n\tstore := s.Store.ExpireAfter(t)\n\tservice, err := bakery.NewService(bakery.NewServiceParams{\n\t\tLocation: s.Location(),\n\t\tStore: stor...
{ "audio": "", "image": "", "text": " s.Key,\n\t\tLocator: s.Locator,\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn &ExpirableStorageBakeryService{service, s.Key, store, s.Locator}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\t\tstore.MaxRetry = 1\n\t}\n\n\t_, err := store.ping()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn store, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewContainerSetupHandler(params ContainerSetupParams) watcher.StringsHandler {\n\treturn &ContainerSetup{\n\t\trunner: params.Runner,\n\t\tmachine: params.Machine,\n\t\tsupportedContainers: params.SupportedContainers,\n\t\tprovisioner: par...
{ "audio": "", "image": "", "text": " params.WorkerName,\n\t\tmachineLock: params.MachineLock,\n\t\tcredentialAPI: params.CredentialAPI,\n\t\tgetNetConfig: common.GetObservedNetworkConfig,\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\t\tsize = params.Rng.Intn(params.MaxSize-params.MinSize) + params.MinSize\n\t\t}\n\t\treturn f(size)(params)\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (cs *ContainerSetup) SetUp() (watcher watcher.StringsWatcher, err error) {\n\t// Set up the semaphores for each container type.\n\tcs.setupDone = make(map[instance.ContainerType]*int32, len(instance.ContainerTypes))\n\tfor _, containerType := range instance.ContainerTypes...
{ "audio": "", "image": "", "text": "\n\t}\n\t// Listen to all container lifecycle events on our machine.\n\tif watcher, err = cs.machine.WatchAllContainers(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn watcher, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tcs.Client, cs.Conn, cs.Server)\n\t_, err := conn.ExecuteFetch(sql, 1, false)\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (cs *ContainerSetup) Handle(abort <-chan struct{}, containerIds []string) (resultError error) {\n\t// Consume the initial watcher event.\n\tif len(containerIds) == 0 {\n\t\treturn nil\n\t}\n\n\tlogger.Infof(\"initial container setup with ids: %v\", containerIds)\n\tfor _,...
{ "audio": "", "image": "", "text": " containerType, err)\n\t\t\t// Just because dealing with one type of container fails, we won't\n\t\t\t// exit the entire function because we still want to try and start\n\t\t\t// other container types. So we take note of and return the first\n\t\t\t// such error.\n\t\t\tif res...
{ "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 (cs *ContainerSetup) initContainerDependencies(abort <-chan struct{}, containerType instance.ContainerType) error {\n\tinitialiser := getContainerInitialiser(containerType)\n\n\treleaser, err := cs.acquireLock(fmt.Sprintf(\"%s container initialisation\", containerType), a...
{ "audio": "", "image": "", "text": "\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"cannot discover observed network config\")\n\t}\n\tif len(observedConfig) > 0 {\n\t\tmachineTag := cs.machine.MachineTag()\n\t\tlogger.Tracef(\"updating observed network config for %q %s containers to %#v\",\n\t\t\tmachine...
{ "audio": "", "image": "", "text": " s.cs.async {\n\t\tb, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)\n\t\tif err != nil {\n\t\t\tif err == AsyncTimeoutErr {\n\t\t\t\treturn &r, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := json.Unmarshal(b, &r); err != nil {\n\t\t\treturn nil, err\n\t\t}\...
{ "audio": "", "image": "", "text": "func startProvisionerWorker(\n\trunner *worker.Runner,\n\tcontainerType instance.ContainerType,\n\tprovisioner *apiprovisioner.State,\n\tconfig agent.Config,\n\tbroker environs.InstanceBroker,\n\ttoolsFinder ToolsFinder,\n\tdistributionGroupFinder DistributionGroupFinder,\n\tc...
{ "audio": "", "image": "", "text": " create one.\n\treturn runner.StartWorker(workerName, func() (worker.Worker, error) {\n\t\tw, err := NewContainerProvisioner(containerType,\n\t\t\tprovisioner,\n\t\t\tconfig,\n\t\t\tbroker,\n\t\t\ttoolsFinder,\n\t\t\tdistributionGroupFinder,\n\t\t\tcredentialAPI,\n\t\t)\n\t\ti...
{ "audio": "", "image": "", "text": " has been already logged.\n\n\t\tif err == nil {\n\t\t\t// This will check if the channel has MaxInactivity defined,\n\t\t\t// if so and there is no active subscription, it will start the\n\t\t\t// delete timer.\n\t\t\ts.channels.maybeStartChannelDeleteTimer(req.Subject, nil)\...
{ "audio": "", "image": "", "text": "func (config Config) Validate() error {\n\tif config.ModelWatcher == nil {\n\t\treturn errors.NotValidf(\"nil ModelWatcher\")\n\t}\n\tif config.ModelGetter == nil {\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\treturn errors.NotValidf(\"nil ModelGetter\")\n\t}\n\tif config.NewModelWorker == nil {\n\t\treturn errors.NotValidf(\"nil NewModelWorker\")\n\t}\n\tif config.ErrorDelay <= 0 {\n\t\treturn errors.NotValidf(\"non-positive ErrorDelay\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " config.Topic == \"\" {\n\t\treturn errors.NotValidf(\"empty Topic\")\n\t}\n\tif config.Target == nil {\n\t\treturn errors.NotValidf(\"nil Target\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func StreamDebugLog(source base.StreamConnector, args DebugLogParams) (<-chan LogMessage, error) {\n\t// TODO(babbageclunk): this isn't cancellable - if the caller stops\n\t// reading from the channel (because it has an error, for example),\n\t// the goroutine will be leaked. ...
{ "audio": "", "image": "", "text": "\n\t// it. https://pad.lv/1644084\n\n\t// Prepare URL query attributes.\n\tattrs := args.URLQuery()\n\n\tconnection, err := source.ConnectStream(\"/log\", attrs)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tmessages := make(chan LogMessage)\n\tgo func() {\n\...
{ "audio": "", "image": "", "text": " has been already logged.\n\n\t\tif err == nil {\n\t\t\t// This will check if the channel has MaxInactivity defined,\n\t\t\t// if so and there is no active subscription, it will start the\n\t\t\t// delete timer.\n\t\t\ts.channels.maybeStartChannelDeleteTimer(req.Subject, nil)\...
{ "audio": "", "image": "", "text": "func (d *deploy) Prepare(state State) (*State, error) {\n\tif err := d.checkAlreadyDone(state); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tinfo, err := d.callbacks.GetArchiveInfo(d.charmURL)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tif err := d...
{ "audio": "", "image": "", "text": " the controller. If we neglected to do so, the operation could\n\t// race with a new application-charm-url change on the controller, and lead to\n\t// failures on resume in which we try to obtain archive info for a charm that\n\t// has already been removed from the controller....
{ "audio": "", "image": "", "text": "\tstate := deploymentCopy.TaskGroups[alloc.TaskGroup]\n\tstate.PlacedAllocs += placed\n\tstate.HealthyAllocs += healthy\n\tstate.UnhealthyAllocs += unhealthy\n\n\t// Update the progress deadline\n\tif pd := state.ProgressDeadline; pd != 0 {\n\t\t// If we are the first placed a...
{ "audio": "", "image": "", "text": "func (d *deploy) Execute(state State) (*State, error) {\n\tif err := d.deployer.Deploy(); err == charm.ErrConflict {\n\t\treturn nil, NewDeployConflictError(d.charmURL)\n\t} else", "video": "" }
{ "audio": "", "image": "", "text": " if err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\treturn d.getState(state, Done), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdi := diskInfo{&hi.ChangeVersion, hi.Kind == hooks.RelationJoined}\n\tif err := utils.WriteYaml(path, &di); err != nil {\n\t\treturn err\n\t}\n\t// If write was successful, update own state.\n\td.state.Members[hi.RemoteUnit] = hi.ChangeVersion\n\tif hi.Kind == hooks.Relati...
{ "audio": "", "image": "", "text": "func (d *deploy) Commit(state State) (*State, error) {\n\tchange := &stateChange{\n\t\tKind: RunHook,\n\t}\n\tif hookInfo := d.interruptedHook(state); hookInfo != nil {\n\t\tchange.Hook = hookInfo\n\t\tchange.Step = Pending\n\t} else {", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tchange.Hook = &hook.Info{Kind: deployHookKinds[d.kind]}\n\t\tchange.Step = Queued\n\t}\n\treturn change.apply(state), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tdi := diskInfo{&hi.ChangeVersion, hi.Kind == hooks.RelationJoined}\n\tif err := utils.WriteYaml(path, &di); err != nil {\n\t\treturn err\n\t}\n\t// If write was successful, update own state.\n\td.state.Members[hi.RemoteUnit] = hi.ChangeVersion\n\tif hi.Kind == hooks.Relati...
{ "audio": "", "image": "", "text": "func (sr ApplicationResources) Updates() ([]resource.Resource, error) {\n\tstoreResources, err := sr.alignStoreResources()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tvar updates []resource.Resource\n\tfor", "video": "" }
{ "audio": "", "image": "", "text": " i, res := range sr.Resources {\n\t\tif res.Origin != resource.OriginStore {\n\t\t\tcontinue\n\t\t}\n\t\tcsRes := storeResources[i]\n\t\t// If the revision is the same then all the other info must be.\n\t\tif res.Revision == csRes.Revision {\n\t\t\tcontinue\n\t\t}\n\t\tupdates...
{ "audio": "", "image": "", "text": " i.By,\n\t\t\t\"region\": i.Region,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar sr *StatsResponse\n\tif err := decodeJSON(&sr, r.Body); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sr, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockApiextensionsV1beta1Interface(ctrl *gomock.Controller) *MockApiextensionsV1beta1Interface", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockApiextensionsV1beta1Interface{ctrl: ctrl}\n\tmock.recorder = &MockApiextensionsV1beta1InterfaceMockRecorder{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 (m *MockApiextensionsV1beta1Interface) CustomResourceDefinitions() v1beta10.CustomResourceDefinitionInterface", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tret := m.ctrl.Call(m, \"CustomResourceDefinitions\")\n\tret0, _ := ret[0].(v1beta10.CustomResourceDefinitionInterface)\n\treturn ret0\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 (mr *MockApiextensionsV1beta1InterfaceMockRecorder) CustomResourceDefinitions() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock,", "video": "" }
{ "audio": "", "image": "", "text": " \"CustomResourceDefinitions\", reflect.TypeOf((*MockApiextensionsV1beta1Interface)(nil).CustomResourceDefinitions))\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 *MockApiextensionsV1beta1Interface) RESTClient() rest.Interface", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tret := m.ctrl.Call(m, \"RESTClient\")\n\tret0, _ := ret[0].(rest.Interface)\n\treturn ret0\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\t\tm.opts = append(m.opts, option{opID, iv.Index(i).Interface()})\n\t\t}\n\t\treturn\n\t}\n\tm.opts = append(m.opts, option{opID, val})\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewMockCustomResourceDefinitionInterface(ctrl *gomock.Controller) *MockCustomResourceDefinitionInterface", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tmock := &MockCustomResourceDefinitionInterface{ctrl: ctrl}\n\tmock.recorder = &MockCustomResourceDefinitionInterfaceMockRecorder{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 (a Access) Validate() error {\n\tswitch a {\n\tcase NoAccess, AdminAccess, ReadAccess,", "video": "" }
{ "audio": "", "image": "", "text": " WriteAccess,\n\t\tLoginAccess, AddModelAccess, SuperuserAccess:\n\t\treturn nil\n\t}\n\treturn errors.NotValidf(\"access level %s\", a)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tdrone: client.New(),\n\t\tconnect: func(a *Adaptor) error {\n\t\t\treturn a.drone.Connect()\n\t\t},\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func ValidateModelAccess(access Access) error {\n\tswitch access {\n\tcase ReadAccess,", "video": "" }
{ "audio": "", "image": "", "text": " WriteAccess, AdminAccess:\n\t\treturn nil\n\t}\n\treturn errors.NotValidf(\"%q model access\", access)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn err\n\t}\n\n\tif _, err = sess.ID(collaboration.ID).AllCols().Update(collaboration); err != nil {\n\t\treturn fmt.Errorf(\"update collaboration: %v\", err)\n\t}\n\n\taccess := &Access{\n\t\tUserID: userID,\n\t\tRepoID: repo.ID,\n\t}\n\thas, err = sess.Get(access)\...
{ "audio": "", "image": "", "text": "func ValidateOfferAccess(access Access) error {\n\tswitch access {\n\tcase ReadAccess,", "video": "" }
{ "audio": "", "image": "", "text": " ConsumeAccess, AdminAccess:\n\t\treturn nil\n\t}\n\treturn errors.NotValidf(\"%q offer access\", access)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn err\n\t}\n\n\tif _, err = sess.ID(collaboration.ID).AllCols().Update(collaboration); err != nil {\n\t\treturn fmt.Errorf(\"update collaboration: %v\", err)\n\t}\n\n\taccess := &Access{\n\t\tUserID: userID,\n\t\tRepoID: repo.ID,\n\t}\n\thas, err = sess.Get(access)\...
{ "audio": "", "image": "", "text": "func ValidateCloudAccess(access Access) error {\n\tswitch access {\n\tcase AddModelAccess, AdminAccess:\n\t\treturn nil\n\t}\n", "video": "" }
{ "audio": "", "image": "", "text": "\treturn errors.NotValidf(\"%q cloud access\", access)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tcontinue\n\t\t}\n\t\tif !allowsConsolidation(existingRule) && !allowsConsolidation(rule) {\n\t\t\tif !strings.EqualFold(to.String(existingRule.DestinationAddressPrefix), to.String(rule.DestinationAddressPrefix)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif existingRule.Access...
{ "audio": "", "image": "", "text": "func ValidateControllerAccess(access Access) error {\n\tswitch access {\n\tcase LoginAccess, SuperuserAccess:\n\t\treturn nil\n\t}\n", "video": "" }
{ "audio": "", "image": "", "text": "\treturn errors.NotValidf(\"%q controller access\", access)\n}", "video": "" }
{ "audio": "", "image": "", "text": "\tcontinue\n\t\t}\n\t\tif !allowsConsolidation(existingRule) && !allowsConsolidation(rule) {\n\t\t\tif !strings.EqualFold(to.String(existingRule.DestinationAddressPrefix), to.String(rule.DestinationAddressPrefix)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif existingRule.Access...
{ "audio": "", "image": "", "text": "func (a Access) EqualOrGreaterModelAccessThan(access Access) bool {\n\tv1,", "video": "" }
{ "audio": "", "image": "", "text": " v2 := a.modelValue(), access.modelValue()\n\tif v1 < 0 || v2 < 0 {\n\t\treturn false\n\t}\n\treturn v1 >= v2\n}", "video": "" }
{ "audio": "", "image": "", "text": "\treturn repo.getUsersWithAccesMode(e, ACCESS_MODE_READ)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (a Access) EqualOrGreaterControllerAccessThan(access Access) bool {\n\tv1, v2 := a.controllerValue(), access.controllerValue()", "video": "" }
{ "audio": "", "image": "", "text": "\n\tif v1 < 0 || v2 < 0 {\n\t\treturn false\n\t}\n\treturn v1 >= v2\n}", "video": "" }
{ "audio": "", "image": "", "text": "\treturn repo.getUsersWithAccesMode(e, ACCESS_MODE_READ)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (a Access) EqualOrGreaterCloudAccessThan(access Access) bool {\n\tv1,", "video": "" }
{ "audio": "", "image": "", "text": " v2 := a.cloudValue(), access.cloudValue()\n\tif v1 < 0 || v2 < 0 {\n\t\treturn false\n\t}\n\treturn v1 >= v2\n}", "video": "" }
{ "audio": "", "image": "", "text": "\treturn repo.getUsersWithAccesMode(e, ACCESS_MODE_READ)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (a Access) EqualOrGreaterOfferAccessThan(access Access) bool {\n\tv1,", "video": "" }
{ "audio": "", "image": "", "text": " v2 := a.offerValue(), access.offerValue()\n\tif v1 < 0 || v2 < 0 {\n\t\treturn false\n\t}\n\treturn v1 >= v2\n}", "video": "" }
{ "audio": "", "image": "", "text": "\treturn repo.getUsersWithAccesMode(e, ACCESS_MODE_READ)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func NewShowCommand() cmd.Command {\n\tcmd := &showCommand{}\n\tcmd.newAPIFunc", "video": "" }
{ "audio": "", "image": "", "text": " = func() (StorageShowAPI, error) {\n\t\treturn cmd.NewStorageAPI()\n\t}\n\treturn modelcmd.Wrap(cmd)\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tvar cmd ZSliceCmd\n\tcmd.val = val\n\tcmd.setErr(err)\n\treturn &cmd\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (api *API) ListSpaces() ([]params.Space, error) {\n\tvar response params.ListSpacesResults\n\terr := api.facade.FacadeCall(\"ListSpaces\", nil, &response)\n\tif params.IsCodeNotSupported(err) {\n\t\treturn", "video": "" }
{ "audio": "", "image": "", "text": " response.Results, errors.NewNotSupported(nil, err.Error())\n\t}\n\treturn response.Results, err\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t}\n\tvar results params.ErrorResults\n\terr := st.facade.FacadeCall(\"SetMachineBlockDevices\", args, &results)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn results.OneError()\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (api *API) ReloadSpaces() error {\n\tif api.facade.BestAPIVersion() < 3 {\n\t\treturn errors.NewNotSupported(nil, \"Controller does not support reloading spaces\")\n\t}\n\terr :=", "video": "" }
{ "audio": "", "image": "", "text": " api.facade.FacadeCall(\"ReloadSpaces\", nil, nil)\n\tif params.IsCodeNotSupported(err) {\n\t\treturn errors.NewNotSupported(nil, err.Error())\n\t}\n\treturn err\n}", "video": "" }
{ "audio": "", "image": "", "text": " nil, errors.Errorf(\"expected one result, got %d\", len(results.Results))\n\t}\n\tresult := results.Results[0]\n\tif err := result.Error; err != nil {\n\t\treturn nil, errors.Trace(result.Error)\n\t}\n\tw := api.newWatcher(api.facade.RawAPICaller(), result)\n\treturn w, nil\n...
{ "audio": "", "image": "", "text": "func newAPIContext(ctxt *cmd.Context, opts *AuthOpts, store jujuclient.CookieStore, controllerName string) (*apiContext, error) {\n\tjar0, err := store.CookieJar(controllerName)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\t// The JUJU_USER_DOMAIN environment v...
{ "audio": "", "image": "", "text": " know where the third party might be.\n\tjar := &domainCookieJar{\n\t\tCookieJar: jar0,\n\t\tdomain: os.Getenv(\"JUJU_USER_DOMAIN\"),\n\t}\n\tvar visitors []httpbakery.Visitor\n\tif ctxt != nil && opts != nil && opts.NoBrowser {\n\t\tfiller := &form.IOFiller{\n\t\t\tIn: ct...
{ "audio": "", "image": "", "text": " not a user.Info object: %#v\", user)\n\t\t\t\tuser = &kuser.DefaultInfo{} // set non-nil so we always try to invalidate\n\t\t\t}\n\n\t\t\tif err := c.ExtraOAuthConfig.SessionAuth.InvalidateAuthentication(w, user); err != nil {\n\t\t\t\tklog.V(5).Infof(\"error invaliding cooki...
{ "audio": "", "image": "", "text": "func (ctx *apiContext) NewBakeryClient() *httpbakery.Client {\n\tclient := httpbakery.NewClient()\n\tclient.Jar =", "video": "" }
{ "audio": "", "image": "", "text": " ctx.jar\n\tclient.WebPageVisitor = ctx.webPageVisitor\n\treturn client\n}", "video": "" }
{ "audio": "", "image": "", "text": " func(c *Client) {\n\t\tc.client = client\n\t}\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (ctxt *apiContext) Close() error {\n\tif err := ctxt.jar.Save();", "video": "" }
{ "audio": "", "image": "", "text": " err != nil {\n\t\treturn errors.Annotatef(err, \"cannot save cookie jar\")\n\t}\n\treturn nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " string) {\n\thttp.ServeFile(ctxt, ctxt.Request, path)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (j *domainCookieJar) Cookies(u *url.URL) []*http.Cookie {\n\tcookies := j.CookieJar.Cookies(u)\n\tif j.domain == \"\" {\n\t\treturn cookies\n\t}\n\t// Allow the site to override if it wants to.\n\tfor _, c := range cookies {\n\t", "video": "" }
{ "audio": "", "image": "", "text": "\tif c.Name == domainCookieName {\n\t\t\treturn cookies\n\t\t}\n\t}\n\treturn append(cookies, &http.Cookie{\n\t\tName: domainCookieName,\n\t\tValue: j.domain,\n\t})\n}", "video": "" }
{ "audio": "", "image": "", "text": " []*http.Cookie {\n\treturn j.underlying.Cookies(u)\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (h *charmsHandler) manifestSender(w http.ResponseWriter, r *http.Request, bundle *charm.CharmArchive) error {\n\tmanifest, err := bundle.Manifest()\n\tif err != nil {\n\t\treturn errors.Annotatef(err, \"unable to read manifest in %q\", bundle.Path)\n", "video": "" }
{ "audio": "", "image": "", "text": "\t}\n\treturn errors.Trace(sendStatusAndJSON(w, http.StatusOK, &params.CharmsResponse{\n\t\tFiles: manifest.SortedValues(),\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 *charmsHandler) archiveEntrySender(filePath string, serveIcon bool) bundleContentSenderFunc {\n\treturn func(w http.ResponseWriter, r *http.Request, bundle *charm.CharmArchive) error {\n\t\tcontents, err := common.CharmArchiveEntry(bundle.Path, filePath, serveIcon)\n\t...
{ "audio": "", "image": "", "text": "\n\t\t\tif ctype == params.ContentTypeXJS {\n\t\t\t\tctype = params.ContentTypeJS\n\t\t\t}\n\t\t\tw.Header().Set(\"Content-Type\", ctype)\n\t\t}\n\t\tw.Header().Set(\"Content-Length\", strconv.Itoa(len(contents)))\n\t\tw.WriteHeader(http.StatusOK)\n\t\tio.Copy(w, bytes.NewRead...
{ "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 *charmsHandler) archiveSender(w http.ResponseWriter, r *http.Request, bundle *charm.CharmArchive) error {\n\t// Note that http.ServeFile's error responses are not our standard JSON\n\t// responses (they are the usual textual error messages as produced\n\t// by http.Err...
{ "audio": "", "image": "", "text": " can do about that,\n\t// except accept non-JSON error responses in the client, because\n\t// http.ServeFile does not provide a way of customizing its\n\t// error responses.\n\thttp.ServeFile(w, r, bundle.Path)\n\treturn nil\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 *charmsHandler) processUploadedArchive(path string) error {\n\t// Open the archive as a zip.\n\tf, err := os.OpenFile(path, os.O_RDWR, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tzip...
{ "audio": "", "image": "", "text": "\tdefer os.RemoveAll(tempDir)\n\tif err := ziputil.Extract(zipr, tempDir, rootDir); err != nil {\n\t\treturn errors.Annotate(err, \"cannot extract charm archive\")\n\t}\n\tdir, err := charm.ReadCharmDir(tempDir)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"cannot read...
{ "audio": "", "image": "", "text": "\t\tcontinue\n\t\t}\n\t\tpath := filepath.Join(tempDir, hdr.Name)\n\t\tinfo := hdr.FileInfo()\n\t\tif info.IsDir() {\n\t\t\tif err := os.MkdirAll(path, info.Mode()); err != nil {\n\t\t\t\treturn errors.Annotate(err, \"cannot create directory\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\...
{ "audio": "", "image": "", "text": "func (h *charmsHandler) findArchiveRootDir(zipr *zip.Reader) (string, error) {\n\tpaths, err := ziputil.Find(zipr, \"metadata.yaml\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tswitch len(paths) {\n\tcase 0:\n\t\treturn \"\", errors.Errorf(\"invalid charm archive: missin...
{ "audio": "", "image": "", "text": "\n\t\tif depth(paths[0]) == depth(paths[1]) {\n\t\t\treturn \"\", errors.Errorf(\"invalid charm archive: ambiguous root directory\")\n\t\t}\n\t}\n\treturn filepath.Dir(paths[0]), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\tif !existing {\n\t\t\tfs.paths = append(fs.paths, pth)\n\t\t}\n\t\treturn nil\n\t}\n\treturn errors.New(\"not found\")\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (h *charmsHandler) repackageAndUploadCharm(st *state.State, archive *charm.CharmArchive, curl *charm.URL) error {\n\t// Create a temp dir to contain the extracted charm dir.\n\ttempDir, err := ioutil.TempDir(\"\", \"charm-download\")\n\tif err != nil {\n\t\treturn errors....
{ "audio": "", "image": "", "text": "\n\t\tversion = fmt.Sprintf(\"%.100s\", revLine)\n\t} else if !os.IsNotExist(err) {\n\t\treturn errors.Annotate(err, \"cannot open version file\")\n\t}\n\n\t// Bundle the charm and calculate its sha256 hash at the same time.\n\tvar repackagedArchive bytes.Buffer\n\thash := sha...
{ "audio": "", "image": "", "text": "\t\tcontinue\n\t\t}\n\t\tpath := filepath.Join(tempDir, hdr.Name)\n\t\tinfo := hdr.FileInfo()\n\t\tif info.IsDir() {\n\t\t\tif err := os.MkdirAll(path, info.Mode()); err != nil {\n\t\t\t\treturn errors.Annotate(err, \"cannot create directory\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\...
{ "audio": "", "image": "", "text": "func sendJSONError(w http.ResponseWriter, req *http.Request, err error) error {\n\tlogger.Errorf(\"returning error from %s %s: %s\", req.Method, req.URL, errors.Details(err))", "video": "" }
{ "audio": "", "image": "", "text": "\n\tperr, status := common.ServerErrorAndStatus(err)\n\treturn errors.Trace(sendStatusAndJSON(w, status, &params.CharmsResponse{\n\t\tError: perr.Message,\n\t\tErrorCode: perr.Code,\n\t\tErrorInfo: perr.Info,\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 sendBundleContent(\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tarchivePath string,\n\tsender bundleContentSenderFunc,\n) error {\n\tbundle, err := charm.ReadCharmArchive(archivePath)\n\tif err != nil {\n\t\treturn errors.Annotatef(err, \"unable to read archive in %q\...
{ "audio": "", "image": "", "text": "\t}\n\t// The bundleContentSenderFunc will set up and send an appropriate response.\n\tif err := sender(w, r, bundle); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\treturn nil\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 (c *StorageCommandBase) NewStorageAPI() (*storage.Client, error) {\n\troot, err := c.NewAPIRoot()\n\tif err !=", "video": "" }
{ "audio": "", "image": "", "text": " nil {\n\t\treturn nil, err\n\t}\n\treturn storage.NewClient(root), nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\treturn c.withRetry(ctx, func(conn *zk.Conn) error {\n\t\terr := conn.AddAuth(scheme, auth)\n\t\treturn err\n\t})\n}", "video": "" }
{ "audio": "", "image": "", "text": "func formatStorageDetails(storages []params.StorageDetails) (map[string]StorageInfo, error) {\n\tif len(storages) == 0 {\n\t\treturn nil, nil\n\t}\n\toutput := make(map[string]StorageInfo)\n", "video": "" }
{ "audio": "", "image": "", "text": "\tfor _, details := range storages {\n\t\tstorageTag, storageInfo, err := createStorageInfo(details)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\toutput[storageTag.Id()] = storageInfo\n\t}\n\treturn output, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %v\", strings.Join(args, \" \"), err)\n\t}\n\tvar d describe\n\tif yaml.Unmarshal(data, &d); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal gcloud: %v\", err)\n\t}\n\n\tif d.Endpoint == \"\" {\n\t\...
{ "audio": "", "image": "", "text": "func NewMockBaseWatcher(ctrl *gomock.Controller) *MockBaseWatcher {\n\tmock := &MockBaseWatcher{ctrl: ctrl}", "video": "" }
{ "audio": "", "image": "", "text": "\n\tmock.recorder = &MockBaseWatcherMockRecorder{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 (m *MockBaseWatcher) Dead() <-chan struct{} {\n\tret", "video": "" }
{ "audio": "", "image": "", "text": " := m.ctrl.Call(m, \"Dead\")\n\tret0, _ := ret[0].(<-chan struct{})\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 (mr *MockBaseWatcherMockRecorder) Dead() *gomock.Call {\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Dead\", reflect.TypeOf((*MockBaseWatcher)(nil).Dead))\n}", "video": "" }
{ "audio": "", "image": "", "text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockBaseWatcher) WatchCollection(arg0 string, arg1 chan<- watcher.Change) {", "video": "" }
{ "audio": "", "image": "", "text": "\n\tm.ctrl.Call(m, \"WatchCollection\", arg0, arg1)\n}", "video": "" }
{ "audio": "", "image": "", "text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (m *MockBaseWatcher) WatchCollectionWithFilter(arg0 string, arg1 chan<- watcher.Change, arg2 func(interface{}) bool)", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tm.ctrl.Call(m, \"WatchCollectionWithFilter\", arg0, arg1, arg2)\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 (mr *MockBaseWatcherMockRecorder) WatchCollectionWithFilter(arg0, arg1, arg2 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"WatchCollectionWithFilter\",", "video": "" }
{ "audio": "", "image": "", "text": " reflect.TypeOf((*MockBaseWatcher)(nil).WatchCollectionWithFilter), 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 *MockBaseWatcher) WatchMulti(arg0 string, arg1 []interface{}, arg2 chan<-", "video": "" }
{ "audio": "", "image": "", "text": " watcher.Change) error {\n\tret := m.ctrl.Call(m, \"WatchMulti\", 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 New(config Config) (ExpirableStorage, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, errors.Annotate(err, \"validating config\")\n\t}\n\treturn", "video": "" }
{ "audio": "", "image": "", "text": " &storage{\n\t\tconfig: config,\n\t\trootKeys: mgostorage.NewRootKeys(5),\n\t}, nil\n}", "video": "" }
{ "audio": "", "image": "", "text": " \"\", 0)\n\n\tmaybeOverrideDuration := func(d time.Duration, target *time.Duration) {\n\t\tif d != 0 {\n\t\t\t*target = d\n\t\t}\n\t}\n\tmaybeOverrideDuration(config.ElectionTimeout, &raftConfig.ElectionTimeout)\n\tmaybeOverrideDuration(config.HeartbeatTimeout, &raftConfig.He...
{ "audio": "", "image": "", "text": "func (info *peerGroupInfo) getLogMessage() string {\n\tlines := []string{\n\t\tfmt.Sprintf(\"calculating desired peer group\\ndesired voting members: (maxId: %d)\", info.maxMemberId),\n\t}\n\n\ttemplate := \"\\n %#v: rs_id=%d, rs_addr=%s\"\n\tids := make([]string, 0, len(inf...
{ "audio": "", "image": "", "text": "\t\tlines = append(lines, \"\\nother members:\")\n\n\t\ttemplate := \"\\n rs_id=%d, rs_addr=%s, tags=%v, vote=%t\"\n\t\tfor _, em := range info.extra {\n\t\t\tvote := em.Votes != nil && *em.Votes > 0\n\t\t\tlines = append(lines, fmt.Sprintf(template, em.Id, em.Address, em.Ta...
{ "audio": "", "image": "", "text": " managedNetwork.Info().IpamInfo()\n\t\tfor _, info := range v4infos {\n\t\t\tif info.IPAMData.Pool != nil {\n\t\t\t\tv4Subnets = append(v4Subnets, *info.IPAMData.Pool)\n\t\t\t}\n\t\t}\n\t\tfor _, info := range v6infos {\n\t\t\tif info.IPAMData.Pool != nil {\n\t\t\t\tv6Subnets ...
{ "audio": "", "image": "", "text": "func (p *peerGroupChanges) initNewReplicaSet() map[string]*replicaset.Member {\n\trs := make(map[string]*replicaset.Member, len(p.info.recognised))\n\tfor id := range p.info.recognised {\n\t\t// Local-scoped variable required here,\n\t\t// or", "video": "" }
{ "audio": "", "image": "", "text": " the same pointer to the loop variable is used each time.\n\t\tm := p.info.recognised[id]\n\t\trs[id] = &m\n\t}\n\treturn rs\n}", "video": "" }
{ "audio": "", "image": "", "text": " {\n\tp := &DeleteRolePermissionParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "video": "" }
{ "audio": "", "image": "", "text": "func (p *peerGroupChanges) checkExtraMembers() error {\n\t// Note: (jam 2018-04-18) With the new \"juju remove-machine --force\" it is much easier to get into this situation\n\t// because an active controller that is in the replicaset would get removed while it still had votin...
{ "audio": "", "image": "", "text": " I think the right answer is probably to downgrade unknown members from voting.\n\tfor _, member := range p.info.extra {\n\t\tif isVotingMember(&member) {\n\t\t\treturn fmt.Errorf(\"voting non-machine member %v found in peer group\", member)\n\t\t}\n\t}\n\tif len(p.info.extra)...
{ "audio": "", "image": "", "text": " the state of the charm. So returning an error\n\t\t// here in the \"missing\" case makes less sense than in other\n\t\t// places. We could simply ignore any error that surfaces for\n\t\t// that case. However, returning the error communicates to the\n\t\t// charm author that w...
{ "audio": "", "image": "", "text": "func (p *peerGroupChanges) reviewPeerGroupChanges() {\n\tcurrVoters := 0\n\tfor _, m := range p.desired.members {\n\t\tif isVotingMember(m) {\n\t\t\tcurrVoters += 1\n\t\t}\n\t}\n\tkeptVoters := currVoters - len(p.toRemoveVote)\n\tif keptVoters == 0 {\n\t\t// to keep no voters ...
{ "audio": "", "image": "", "text": " number of voters\n\t\treturn\n\t}\n\tif len(p.toAddVote) > 0 {\n\t\tlast := p.toAddVote[len(p.toAddVote)-1]\n\t\tlogger.Debugf(\"number of voters would be even, not adding %q to maintain odd\", last)\n\t\tp.toAddVote = p.toAddVote[:len(p.toAddVote)-1]\n\t\treturn\n\t}\n\t// w...
{ "audio": "", "image": "", "text": " Truncate msg to terminal length\n\tmsg = \"\\r\" + p.truncate(msg)\n\n\t// Don't print if empty and never printed\n\tif len(msg) == 1 && p.maxLength == 0 {\n\t\treturn\n\t}\n\n\tif len(msg) > p.maxLength {\n\t\tp.maxLength = len(msg)\n\t} else {\n\t\tfmt.Printf(\"\\r%s\", str...
{ "audio": "", "image": "", "text": "func (p *peerGroupChanges) adjustVotes() {\n\tsetVoting := func(memberIds []string, voting bool) {\n\t\tfor _, id := range memberIds {\n\t\t\tsetMemberVoting(p.desired.members[id], voting)\n\t\t\tp.desired.machineVoting[id] = voting\n\t\t}\n\t}\n\n\tif len(p.toAddVote) > 0 ||\...
{ "audio": "", "image": "", "text": " 0 ||\n\t\tlen(p.toKeepCreateNonVotingMember) > 0 {\n\t\tp.desired.isChanged = true\n\t}\n\tsetVoting(p.toAddVote, true)\n\tsetVoting(p.toRemoveVote, false)\n\tsetVoting(p.toKeepCreateNonVotingMember, false)\n}", "video": "" }
{ "audio": "", "image": "", "text": " if len(comment) == 3 {\n\t\t\t_ = p.googleBot()\n\t\t}\n\t} else if len(comment) > 0 {\n\t\tif len(comment) > 3 {\n\t\t\tp.localization = comment[3]\n\t\t}\n\t\tif strings.HasPrefix(comment[0], \"Windows NT\") {\n\t\t\tp.os = normalizeOS(comment[0])\n\t\t} else if len(comment...
{ "audio": "", "image": "", "text": "func (p *peerGroupChanges) createNonVotingMember() {\n\tfor _, id := range p.toKeepCreateNonVotingMember {\n\t\tlogger.Debugf(\"create member with id %q\", id)\n\t\tp.info.maxMemberId++\n\t\tmember := &replicaset.Member{\n\t\t\tTags: map[string]string{\n\t\t\t\tjujuMachineKey:...
{ "audio": "", "image": "", "text": "\n\t\tlogger.Debugf(\"create member with id %q\", id)\n\t\tp.info.maxMemberId++\n\t\tmember := &replicaset.Member{\n\t\t\tTags: map[string]string{\n\t\t\t\tjujuMachineKey: id,\n\t\t\t},\n\t\t\tId: p.info.maxMemberId,\n\t\t}\n\t\tsetMemberVoting(member, false)\n\t\tp.desired.me...
{ "audio": "", "image": "", "text": " {\n\tp := &StopVirtualMachineParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "video": "" }