// getMirrorInfo returns the mirror metadata for the specified content and cloud.
332863
func (mirrorMetadata *MirrorMetadata) getMirrorInfo(contentId string, cloud CloudSpec) (*MirrorInfo, error) {
	var candidates MirrorInfoSlice
	for id, m := range mirrorMetadata.Mirrors {
		if id == contentId {
			candidates = m
			break
		}
	}
	if len(candidates) == 0 {
		return nil, errors.NotFoundf("mirror info for %q", contentId)
	}

	// Restrict by cloud spec.
	hasRightCloud := func(mirrorInfo *MirrorInfo) bool {
		return mirrorInfo.hasCloud(cloud)
	}
	candidates = candidates.filter(hasRightCloud)
	if len(candidates) == 0 {
		return nil, errors.NotFoundf("mirror info with cloud %v", cloud)
	}

	// Pick arbitrary match.
	return &candidates[0], nil
}
1123173
func GetInfoWithDeferred(name string) (*Info, error) {
	task, err := TaskCreateNamed(deviceInfo, name)
	if task == nil {
		return nil, err
	}
	if err := task.run(); err != nil {
		return nil, err
	}
	return task.getInfoWithDeferred()
}
435913
func (p *Pget) CheckMirrors(ctx context.Context, url string, ch *Ch) {

	res, err := ctxhttp.Head(ctx, http.DefaultClient, url)
	if err != nil {
		ch.Err <- errors.Wrap(err, "failed to head request: "+url)
		return
	}

	if res.Header.Get("Accept-Ranges") != "bytes" {
		ch.Err <- errors.Errorf("not supported range access: %s", url)
		return
	}

	// To perform with the correct "range access"
	// get the last url in the redirect
	_url := res.Request.URL.String()
	if isNotLastURL(_url, url) {
		p.TargetURLs = append(p.TargetURLs, _url)
	} else {
		p.TargetURLs = append(p.TargetURLs, url)
	}

	// get of ContentLength
	if res.ContentLength <= 0 {
		ch.Err <- errors.New("invalid content length")
		return
	}
	ch.Size <- uint(res.ContentLength)
}
1321613
func (renderer *Renderer) GetMetalLayer() (layer unsafe.Pointer, err error) {
	layer = C.SDL_RenderGetMetalLayer(renderer.cptr())
	if layer == nil {
		err = GetError()
	}
	return
}
302641
func (c *Client) GetInfo() (info Info, err error) {
	r := c.NewRequest("GET", "/info")
	resp, err := c.DoRequest(r)

	if err != nil {
		log.Printf("Error requesting info %v", err)
		return
	}
	defer resp.Body.Close()

	resBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Printf("Error reading info request %v", resBody)
		return
	}
	err = json.Unmarshal(resBody, &info)
	if err != nil {
		log.Printf("Error unmarshaling info %v", err)
		return
	}
	return
}
1048853
func mainMirror(ctx *cli.Context) error {
	// Parse encryption keys per command.
	encKeyDB, err := getEncKeys(ctx)
	fatalIf(err, "Unable to parse encryption keys.")

	// check 'mirror' cli arguments.
	checkMirrorSyntax(ctx, encKeyDB)

	// Additional command specific theme customization.
	console.SetColor("Mirror", color.New(color.FgGreen, color.Bold))

	args := ctx.Args()

	srcURL := args[0]
	tgtURL := args[1]

	if errorDetected := runMirror(srcURL, tgtURL, ctx, encKeyDB); errorDetected {
		return exitStatus(globalErrorExitStatus)
	}

	return nil
}
1333756
func (o *L2DomainTemplate) OverlayMirrorDestinationTemplates(info *bambou.FetchingInfo) (OverlayMirrorDestinationTemplatesList, *bambou.Error) {

	var list OverlayMirrorDestinationTemplatesList
	err := bambou.CurrentSession().FetchChildren(o, OverlayMirrorDestinationTemplateIdentity, &list, info)
	return list, err
}
761964
func GetMajorFormatInfo(format int) (oformat int, name string, extension string, ok bool) {
	var o C.SF_FORMAT_INFO
	o.format = C.int(format)
	ok = (0 == C.sf_command(nil, C.SFC_GET_FORMAT_MAJOR, unsafe.Pointer(&o), C.int(unsafe.Sizeof(o))))
	oformat = int(o.format)
	name = C.GoString(o.name)
	extension = C.GoString(o.extension)
	return
}
729995
func (c *ContentSpec) getMmarkHTMLRenderer(defaultFlags int, ctx *RenderingContext) mmark.Renderer {
	renderParameters := mmark.HtmlRendererParameters{
		FootnoteAnchorPrefix:       c.footnoteAnchorPrefix,
		FootnoteReturnLinkContents: c.footnoteReturnLinkContents,
	}

	b := len(ctx.DocumentID) != 0

	if ctx.Config == nil {
		panic(fmt.Sprintf("RenderingContext of %q doesn't have a config", ctx.DocumentID))
	}

	if b && !ctx.Config.PlainIDAnchors {
		renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix
		// renderParameters.HeaderIDSuffix = ":" + ctx.DocumentId
	}

	htmlFlags := defaultFlags
	htmlFlags |= mmark.HTML_FOOTNOTE_RETURN_LINKS

	return &HugoMmarkHTMLRenderer{
		cs:       c,
		Renderer: mmark.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters),
		Cfg:      c.Cfg,
	}
}
52154
func (mj *mirrorJob) monitorMirrorStatus() (errDuringMirror bool) {
	// now we want to start the progress bar
	mj.status.Start()
	defer mj.status.Finish()

	for sURLs := range mj.statusCh {
		if sURLs.Error != nil {
			switch {
			case sURLs.SourceContent != nil:
				if !isErrIgnored(sURLs.Error) {
					errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()),
						fmt.Sprintf("Failed to copy `%s`.", sURLs.SourceContent.URL.String()))
					errDuringMirror = true
				}
			case sURLs.TargetContent != nil:
				// When sURLs.SourceContent is nil, we know that we have an error related to removing
				errorIf(sURLs.Error.Trace(sURLs.TargetContent.URL.String()),
					fmt.Sprintf("Failed to remove `%s`.", sURLs.TargetContent.URL.String()))
				errDuringMirror = true
			default:
				errorIf(sURLs.Error.Trace(), "Failed to perform mirroring action.")
				errDuringMirror = true
			}
		}

		if sURLs.SourceContent != nil {
		} else if sURLs.TargetContent != nil {
			// Construct user facing message and path.
			targetPath := filepath.ToSlash(filepath.Join(sURLs.TargetAlias, sURLs.TargetContent.URL.Path))
			size := sURLs.TargetContent.Size
			mj.status.PrintMsg(rmMessage{Key: targetPath, Size: size})
		}
	}

	return
}
1193445
func GetUserMirrorRepositories(userID int64) ([]*Repository, error) {
	repos := make([]*Repository, 0, 10)
	return repos, x.Where("owner_id = ?", userID).And("is_mirror = ?", true).Find(&repos)
}
824821
func (b *BlogRef) GetInfo() (*Blog, error) {
	return GetBlogInfo(b.client, b.Name)
}
119878
func getMarshalInfo(t reflect.Type) *marshalInfo {
	marshalInfoLock.Lock()
	u, ok := marshalInfoMap[t]
	if !ok {
		u = &marshalInfo{typ: t}
		marshalInfoMap[t] = u
	}
	marshalInfoLock.Unlock()
	return u
}
580460
func (r *Store) GetRevision(ctx context.Context, name, revision string) (store.Secret, error) {
	ctx, store, name := r.getStore(ctx, name)
	return store.GetRevision(ctx, name, revision)
}
1323518
func (l *s3EncObjects) GetObjectNInfo(ctx context.Context, bucket, object string, rs *minio.HTTPRangeSpec, h http.Header, lockType minio.LockType, o minio.ObjectOptions) (gr *minio.GetObjectReader, err error) {
	var opts minio.ObjectOptions
	if minio.GlobalGatewaySSE.SSEC() {
		opts = o
	}
	objInfo, err := l.GetObjectInfo(ctx, bucket, object, opts)
	if err != nil {
		return l.s3Objects.GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts)
	}
	objInfo.UserDefined = minio.CleanMinioInternalMetadataKeys(objInfo.UserDefined)
	fn, off, length, err := minio.NewGetObjectReader(rs, objInfo, o.CheckCopyPrecondFn)
	if err != nil {
		return nil, minio.ErrorRespToObjectError(err)
	}
	if l.isGWEncrypted(ctx, bucket, object) {
		object = getGWContentPath(object)
	}
	pr, pw := io.Pipe()
	go func() {
		err := l.getObject(ctx, bucket, object, off, length, pw, objInfo.ETag, opts)
		pw.CloseWithError(err)
	}()

	// Setup cleanup function to cause the above go-routine to
	// exit in case of partial read
	pipeCloser := func() { pr.Close() }
	return fn(pr, h, o.CheckCopyPrecondFn, pipeCloser)
}
93781
func isMirrorPod(pod *v1.Pod) bool {
	_, found := pod.ObjectMeta.Annotations[types.ConfigMirrorAnnotationKey]
	return found
}
972311
func (client *Client) GetInfo() (Info, ResourceLinks, Warnings, error) {
	rootResponse, warnings, err := client.rootResponse()
	if err != nil {
		return Info{}, ResourceLinks{}, warnings, err
	}

	request, err := client.newHTTPRequest(requestOptions{
		Method: http.MethodGet,
		URL:    rootResponse.ccV3Link(),
	})
	if err != nil {
		return Info{}, ResourceLinks{}, warnings, err
	}

	info := ResourceLinks{} // Explicitly initializing
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &info,
	}

	err = client.connection.Make(request, &response)
	warnings = append(warnings, response.Warnings...)

	if err != nil {
		return Info{}, ResourceLinks{}, warnings, err
	}

	return rootResponse, info, warnings, nil
}