// int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit);
336656
func (image *Image) GetStripeUnit() (stripe_unit uint64, err error) {
	if image.image == nil {
		return 0, RbdErrorImageNotOpen
	}

	ret := C.rbd_get_stripe_unit(image.image, (*C.uint64_t)(&stripe_unit))
	if ret < 0 {
		return 0, RBDError(int(ret))
	}

	return stripe_unit, nil
}
911308
func (opts ScheduledImageStreamControllerOptions) GetRateLimiter() flowcontrol.RateLimiter {
	if opts.MaxImageImportsPerMinute <= 0 {
		return flowcontrol.NewFakeAlwaysRateLimiter()
	}

	importRate := float32(opts.MaxImageImportsPerMinute) / float32(time.Minute/time.Second)
	importBurst := opts.MaxImageImportsPerMinute * 2
	return flowcontrol.NewTokenBucketRateLimiter(importRate, importBurst)
}
1253258
func (st *State) UnitsInError() ([]*Unit, error) {
	// First, find the agents in error state.
	agentGlobalKeys, err := getEntityKeysForStatus(st, "u", status.Error)
	if err != nil {
		return nil, errors.Trace(err)
	}
	// Extract the unit names.
	unitNames := make([]string, len(agentGlobalKeys))
	for i, key := range agentGlobalKeys {
		// agent key prefix is "u#"
		if !strings.HasPrefix(key, "u#") {
			return nil, errors.NotValidf("unit agent global key %q", key)
		}
		unitNames[i] = key[2:]
	}

	// Query the units with the names of units in error.
	units, closer := st.db().GetCollection(unitsC)
	defer closer()

	var docs []unitDoc
	err = units.Find(bson.D{{"name", bson.D{{"$in", unitNames}}}}).All(&docs)
	if err != nil {
		return nil, errors.Trace(err)
	}
	model, err := st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}

	result := make([]*Unit, len(docs))
	for i, doc := range docs {
		result[i] = &Unit{st: st, doc: doc, modelType: model.Type()}
	}
	return result, nil
}
1281170
func (c Client) Get(id string, params *stripe.FileParams) (*stripe.File, error) {
	path := stripe.FormatURLPath("/v1/files/%s", id)
	file := &stripe.File{}
	err := c.B.Call(http.MethodGet, path, c.Key, params, file)
	return file, err
}
540115
func (f *Facade) CheckRemoveRegistryImage(ctx datastore.Context, imageID string) error {
	if len(imageID) > 0 {
		logger := log.WithField("imageid", imageID)
		if count, err := f.serviceStore.GetServiceCountByImage(ctx, imageID); err != nil {
			logger.WithError(err).Error("Error getting service count by imageID")
			return err
		} else if count == 0 {
			logger.Info("Removing image from the image registry")
			if err := f.registryStore.Delete(ctx, imageID); err != nil {
				logger.WithError(err).Error("Unable to remove unused image from the image registry")
				return err
			}
		}
	}
	return nil
}
592328
func (rb *Bitmap) GetSizeInBytes() uint64 {
	size := uint64(8)
	for _, c := range rb.highlowcontainer.containers {
		size += uint64(2) + uint64(c.getSizeInBytes())
	}
	return size
}
196713
func (_class PIFClass) GetPCI(sessionID SessionRef, self PIFRef) (_retval PCIRef, _err error) {
	_method := "PIF.get_PCI"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPIFRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPCIRefToGo(_method + " -> ", _result.Value)
	return
}
1240027
func (surface *ImageSurface) GetStride() int {
	ret := int(C.cairo_image_surface_get_stride(surface.Ptr))
	if err := surface.status(); err != nil {
		panic(err)
	}
	return ret
}
223354
func (sbc StackedBarChart) GetDPI(defaults ...float64) float64 {
	if sbc.DPI == 0 {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return DefaultDPI
	}
	return sbc.DPI
}
1169597
func (r Virtual_Storage_Repository) GetArchiveDiskUsageRatePerGb() (resp datatypes.Float64, err error) {
	err = r.Session.DoRequest("SoftLayer_Virtual_Storage_Repository", "getArchiveDiskUsageRatePerGb", nil, &r.Options, &resp)
	return
}
60462
func ParseByteUnit(str string) (uint64, error) {
	str = strings.TrimSpace(str)
	str = strings.ToLower(str)

	if u, ok := bytesTable[str]; ok {
		return u, nil
	}
	return 0, errors.Errorf("unknown unit: %q", str)
}
63665
func GetRBDImages(
	ctx types.Context,
	pool *string) ([]*RBDImage, error) {

	cmd := exec.Command(rbdCmd, "ls", "-p", *pool, "-l", formatOpt, jsonArg)
	out, _, err := RunCommand(ctx, cmd)
	if err != nil {
		return nil, goof.WithError("unable to get rbd images", err)
	}

	var rbdList []*RBDImage

	err = json.Unmarshal(out, &rbdList)
	if err != nil {
		return nil, goof.WithError(
			"unable to parse rbd ls", err)
	}

	for _, info := range rbdList {
		info.Pool = *pool
	}

	return rbdList, nil
}
217204
func (r Hardware_Server) GetPublicBandwidthTotal(startTime *int, endTime *int) (resp uint, err error) {
	params := []interface{}{
		startTime,
		endTime,
	}
	err = r.Session.DoRequest("SoftLayer_Hardware_Server", "getPublicBandwidthTotal", params, &r.Options, &resp)
	return
}
85143
func PullImage(ctx context.Context, client client.ImageAPIClient, serviceName string, authLookup auth.Lookup, image string) error {
	fmt.Fprintf(os.Stderr, "Pulling %s (%s)...\n", serviceName, image)
	distributionRef, err := reference.ParseNormalizedNamed(image)
	if err != nil {
		return err
	}

	repoInfo, err := registry.ParseRepositoryInfo(distributionRef)
	if err != nil {
		return err
	}

	authConfig := authLookup.Lookup(repoInfo)

	// Use ConfigFile.SaveToWriter to not re-define encodeAuthToBase64
	encodedAuth, err := encodeAuthToBase64(authConfig)
	if err != nil {
		return err
	}

	options := types.ImagePullOptions{
		RegistryAuth: encodedAuth,
	}
	responseBody, err := client.ImagePull(ctx, distributionRef.String(), options)
	if err != nil {
		logrus.Errorf("Failed to pull image %s: %v", image, err)
		return err
	}
	defer responseBody.Close()

	var writeBuff io.Writer = os.Stderr

	outFd, isTerminalOut := term.GetFdInfo(os.Stderr)

	err = jsonmessage.DisplayJSONMessagesStream(responseBody, writeBuff, outFd, isTerminalOut, nil)
	if err != nil {
		if jerr, ok := err.(*jsonmessage.JSONError); ok {
			// If no error code is set, default to 1
			if jerr.Code == 0 {
				jerr.Code = 1
			}
			fmt.Fprintf(os.Stderr, "%s", writeBuff)
			return fmt.Errorf("Status: %s, Code: %d", jerr.Message, jerr.Code)
		}
	}
	return err
}
1109931
func GetnCompressedTexImage(target uint32, lod int32, bufSize int32, pixels unsafe.Pointer) {
	C.glowGetnCompressedTexImage(gpGetnCompressedTexImage, (C.GLenum)(target), (C.GLint)(lod), (C.GLsizei)(bufSize), pixels)
}
504853
func (m *kubeGenericRuntimeManager) GetImageRef(image kubecontainer.ImageSpec) (string, error) {
	status, err := m.imageService.ImageStatus(&runtimeapi.ImageSpec{Image: image.Image})
	if err != nil {
		klog.Errorf("ImageStatus for image %q failed: %v", image, err)
		return "", err
	}
	if status == nil {
		return "", nil
	}
	return status.Id, nil
}
917366
func getImageRef(client libdocker.Interface, image string) (string, error) {
	img, err := client.InspectImageByRef(image)
	if err != nil {
		return "", err
	}
	if img == nil {
		return "", fmt.Errorf("unable to inspect image %s", image)
	}

	// Returns the digest if it exist.
	if len(img.RepoDigests) > 0 {
		return img.RepoDigests[0], nil
	}

	return img.ID, nil
}