// Resolve implements the KeybaseService interface for KeybaseServiceBase.
179746
func (k *KeybaseServiceBase) Resolve(
	ctx context.Context, assertion string,
	offline keybase1.OfflineAvailability) (
	kbname.NormalizedUsername, keybase1.UserOrTeamID, error) {
	res, err := k.identifyClient.Resolve3(
		ctx, keybase1.Resolve3Arg{
			Assertion: assertion,
			Oa:        offline,
		})
	if err != nil {
		return kbname.NormalizedUsername(""), keybase1.UserOrTeamID(""),
			ConvertIdentifyError(assertion, err)
	}
	return kbname.NewNormalizedUsername(res.Name), res.Id, nil
}
209082
func (d DestinationShard) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
	return addShard(string(d))
}
1261613
func (m *MockJobResolver) Resolve(arg0, arg1 string) (job.Job, error) {
	ret := m.ctrl.Call(m, "Resolve", arg0, arg1)
	ret0, _ := ret[0].(job.Job)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1324671
func Resolve(fn func(name string) (string, error)) Option {
	return func(o *options) {
		o.resolvers = append(o.resolvers, fn)
	}
}
188920
func (d DestinationKeyspaceID) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
	shard, err := GetShardForKeyspaceID(allShards, d)
	if err != nil {
		return err
	}
	return addShard(shard)
}
617965
func (b *Box) Resolve(key string) (file.File, error) {
	key = strings.TrimPrefix(key, "/")

	var r resolver.Resolver

	b.resolvers.Range(func(k string, vr resolver.Resolver) bool {
		lk := strings.ToLower(resolver.Key(k))
		lkey := strings.ToLower(resolver.Key(key))
		if lk == lkey {
			r = vr
			return false
		}
		return true
	})

	if r == nil {
		r = b.DefaultResolver
		if r == nil {
			r = resolver.DefaultResolver
			if r == nil {
				return nil, errors.New("resolver.DefaultResolver is nil")
			}
		}
	}
	plog.Debug(r, "Resolve", "box", b.Name, "key", key)

	f, err := r.Resolve(b.Name, key)
	if err != nil {
		z := filepath.Join(resolver.OsPath(b.ResolutionDir), resolver.OsPath(key))
		f, err = r.Resolve(b.Name, z)
		if err != nil {
			plog.Debug(r, "Resolve", "box", b.Name, "key", z, "err", err)
			return f, err
		}
		b, err := ioutil.ReadAll(f)
		if err != nil {
			return f, err
		}
		f, err = file.NewFile(key, b)
		if err != nil {
			return f, err
		}
	}
	plog.Debug(r, "Resolve", "box", b.Name, "key", key, "file", f.Name())
	return f, nil
}
113639
func (b *Block) resolve(ctx context.Context) (*types.Block, error) {
	if b.block != nil {
		return b.block, nil
	}

	var err error
	if b.hash != (common.Hash{}) {
		b.block, err = b.backend.GetBlock(ctx, b.hash)
	} else {
		b.block, err = b.backend.BlockByNumber(ctx, *b.num)
	}
	if b.block != nil {
		b.header = b.block.Header()
	}
	return b.block, err
}
154386
func (d DestinationExactKeyRanges) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
	for _, kr := range d {
		if err := processExactKeyRange(allShards, kr, addShard); err != nil {
			return err
		}
	}
	return nil
}
982767
func (prs *Parser) Resolve(p string) (httpParam string) {
	if p == param || strings.HasPrefix(p, param+".") {
		return param
	}
	return ""
}
974229
func (r PerfectMatchWeightedResolver) Resolve(value string) (*ComponentMatch, error) {
	var errs []error
	types := []string{}
	candidates := ScoredComponentMatches{}
	var group MultiSimpleSearcher
	var groupWeight float32 = 0.0
	for i, resolver := range r {
		// lump all resolvers with the same weight into a single group
		if len(group) == 0 || resolver.Weight == groupWeight {
			group = append(group, resolver.Searcher)
			groupWeight = resolver.Weight
			if i != len(r)-1 && r[i+1].Weight == groupWeight {
				continue
			}
		}
		matches, err := group.Search(true, value)
		if err != nil {
			klog.V(5).Infof("Error from resolver: %v\n", err)
			errs = append(errs, err...)
		}
		types = append(types, group.Type())

		sort.Sort(ScoredComponentMatches(matches))
		if len(matches) > 0 && matches[0].Score == 0.0 && (len(matches) == 1 || matches[1].Score != 0.0) {
			return matches[0], errors.NewAggregate(errs)
		}
		for _, m := range matches {
			if groupWeight != 0.0 {
				m.Score = groupWeight * m.Score
			}
			candidates = append(candidates, m)
		}
		group = nil
	}

	switch len(candidates) {
	case 0:
		return nil, ErrNoMatch{Value: value, Errs: errs, Type: strings.Join(types, ", ")}
	case 1:
		if candidates[0].Score != 0.0 {
			if candidates[0].NoTagsFound {
				return nil, ErrNoTagsFound{Value: value, Match: candidates[0], Errs: errs}
			}
			return nil, ErrPartialMatch{Value: value, Match: candidates[0], Errs: errs}
		}
		return candidates[0], errors.NewAggregate(errs)
	default:
		sort.Sort(candidates)
		if candidates[0].Score < candidates[1].Score {
			if candidates[0].Score != 0.0 {
				return nil, ErrPartialMatch{Value: value, Match: candidates[0], Errs: errs}
			}
			return candidates[0], errors.NewAggregate(errs)
		}
		return nil, ErrMultipleMatches{Value: value, Matches: candidates, Errs: errs}
	}
}
535179
func (txc *TxConn) Resolve(ctx context.Context, dtid string) error {
	mmShard, err := dtids.ShardSession(dtid)
	if err != nil {
		return err
	}

	transaction, err := txc.gateway.ReadTransaction(ctx, mmShard.Target, dtid)
	if err != nil {
		return err
	}
	if transaction == nil || transaction.Dtid == "" {
		// It was already resolved.
		return nil
	}
	switch transaction.State {
	case querypb.TransactionState_PREPARE:
		// If state is PREPARE, make a decision to rollback and
		// fallthrough to the rollback workflow.
		if err := txc.gateway.SetRollback(ctx, mmShard.Target, transaction.Dtid, mmShard.TransactionId); err != nil {
			return err
		}
		fallthrough
	case querypb.TransactionState_ROLLBACK:
		if err := txc.resumeRollback(ctx, mmShard.Target, transaction); err != nil {
			return err
		}
	case querypb.TransactionState_COMMIT:
		if err := txc.resumeCommit(ctx, mmShard.Target, transaction); err != nil {
			return err
		}
	default:
		// Should never happen.
		return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "invalid state: %v", transaction.State)
	}
	return nil
}
570308
func (r *ReferenceConstraint) Resolved() (c Constraint, err error) {
	if pdebug.Enabled {
		g := pdebug.IPrintf("START ReferenceConstraint.Resolved '%s'", r.reference)
		defer func() {
			if err == nil {
				g.IRelease("END ReferenceConstraint.Resolved '%s' (OK)", r.reference)
			} else {
				g.IRelease("END ReferenceConstraint.Resolved '%s' (FAIL): %s", r.reference, err)
			}
		}()
	}
	r.lock.Lock()
	defer r.lock.Unlock()

	if r.resolved != nil {
		if pdebug.Enabled {
			pdebug.Printf("Reference is already resolved")
		}
		return r.resolved, nil
	}

	c, err = r.resolver.GetReference(r.reference)
	if err != nil {
		return nil, err
	}
	r.resolved = c
	return c, nil
}
100058
func (rb *route) Resolve() *route {
	for rb.Redirect != nil {
		rb = rb.Redirect
	}
	return rb
}
402581
func (r Repository) Resolve(ref *charm.URL) (canonRef *charm.URL, supportedSeries []string, err error) {
	return r.addRevision(ref), []string{"trusty", "wily", "quantal"}, nil
}
776124
func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (coreiface.Path, error) {
	results, err := api.Search(ctx, name, opts...)
	if err != nil {
		return nil, err
	}

	err = coreiface.ErrResolveFailed
	var p coreiface.Path

	for res := range results {
		p, err = res.Path, res.Err
		if err != nil {
			break
		}
	}

	return p, err
}
610581
func (r *CharmStoreResolver) Resolve(client *httpbakery.Client, charmURL string) (string, error) {
	repo := charmrepo.NewCharmStore(charmrepo.NewCharmStoreParams{
		BakeryClient: client,
		URL:          r.csURL,
	})

	curl, err := charm.ParseURL(charmURL)
	if err != nil {
		return "", errors.Annotate(err, "could not parse charm url")
	}
	// ignore local charm urls
	if curl.Schema == "local" {
		return charmURL, nil
	}
	resolvedURL, _, err := repo.Resolve(curl)
	if err != nil {
		return "", errors.Trace(err)
	}
	return resolvedURL.String(), nil
}
103777
func (c Configuration) Resolve() (string, error) {
	r, err := c.resolver()
	if err != nil {
		return "", err
	}
	return r.ID()
}