// Resolved implements the server side of Client.Resolved.
164302
func (c *Client) Resolved(p params.Resolved) error {
	if err := c.checkCanWrite(); err != nil {
		return err
	}
	if err := c.check.ChangeAllowed(); err != nil {
		return errors.Trace(err)
	}
	unit, err := c.api.stateAccessor.Unit(p.UnitName)
	if err != nil {
		return err
	}
	return unit.Resolve(p.Retry)
}
382000
func (d DestinationKeyspaceIDs) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
	for _, ksid := range d {
		shard, err := GetShardForKeyspaceID(allShards, ksid)
		if err != nil {
			return err
		}
		if err := addShard(shard); err != nil {
			return err
		}
	}
	return nil
}
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
}
1070606
func (t *Task) IsResolved() bool {
	t.resolvedMu.Lock()
	defer t.resolvedMu.Unlock()

	return t.resolved
}
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
}
763630
func (r FirstMatchResolver) Resolve(value string) (*ComponentMatch, error) {
	matches, err := r.Searcher.Search(true, value)
	if len(matches) == 0 {
		return nil, ErrNoMatch{Value: value, Errs: err, Type: r.Searcher.Type()}
	}
	return matches[0], errors.NewAggregate(err)
}
53943
func (m *MockInterface) Resolve(arg0 *charm_v6.URL) (*charm_v6.URL, []string, error) {
	ret := m.ctrl.Call(m, "Resolve", arg0)
	ret0, _ := ret[0].(*charm_v6.URL)
	ret1, _ := ret[1].([]string)
	ret2, _ := ret[2].(error)
	return ret0, ret1, ret2
}
1144637
func (r *PeerResolver) Resolve(peers []fab.Peer) (fab.Peer, error) {
	filteredPeers := r.blockHeightResolver.Filter(peers)

	var orgPeers []fab.Peer
	for _, p := range filteredPeers {
		if p.MSPID() == r.mspID {
			orgPeers = append(orgPeers, p)
		}
	}

	if len(orgPeers) > 0 {
		// Our org is in the list. Use the default balancer to balance between them.
		logger.Debugf("Choosing a peer from [%s]", r.mspID)
		return r.loadBalancePolicy.Choose(orgPeers)
	}

	logger.Debugf("Choosing a peer from another org since there are no peers from [%s] in the list of peers", r.mspID)
	return r.loadBalancePolicy.Choose(filteredPeers)
}
915901
func (r *CacheResolver) Resolve(host string) ([]net.IP, error) {
	r.mu.RLock()
	if item, ok := r.cache[host]; ok {
		if item.ttl.IsZero() || timeNow().Before(item.ttl) {
			r.mu.RUnlock()
			ips := make([]net.IP, len(item.ips))
			copy(ips, item.ips)
			return ips, nil
		}
	}
	r.mu.RUnlock()

	resolver := r.Resolver
	if resolver == nil {
		resolver = DefaultResolver
	}
	ips, err := resolver.Resolve(host)
	if err != nil {
		return nil, err
	}

	var ttl time.Time
	if r.TTL > 0 {
		ttl = timeNow().Add(r.TTL)
	}
	item := &cacheItem{ips, ttl}
	r.mu.Lock()
	if r.cache == nil {
		r.cache = make(map[string]*cacheItem)
	}
	r.cache[host] = item
	r.mu.Unlock()

	ips = make([]net.IP, len(item.ips))
	copy(ips, item.ips)
	return ips, err
}
367640
func (cr *ConflictResolver) Resolve(ctx context.Context,
	unmerged kbfsmd.Revision, merged kbfsmd.Revision) {
	cr.inputChanLock.RLock()
	defer cr.inputChanLock.RUnlock()

	// CR can end up trying to cancel itself via the SyncAll call, so
	// prevent that from happening.
	if crOpID := ctx.Value(CtxCRIDKey); crOpID != nil {
		cr.log.CDebugf(ctx, "Ignoring self-resolve during CR")
		return
	}

	if cr.inputChan == nil {
		return
	}

	// Call Add before cancelling existing CR in order to prevent the
	// resolveGroup from becoming briefly empty and allowing things waiting
	// on it to believe that CR has finished.
	cr.resolveGroup.Add(1)

	ci := conflictInput{unmerged, merged}
	func() {
		cr.inputLock.Lock()
		defer cr.inputLock.Unlock()
		// Cancel any running CR before we return, so the caller can be
		// confident any ongoing CR superseded by this new input will be
		// canceled before it releases any locks it holds.
		//
		// TODO: return early if this returns false, and log something
		// using a newly-pass-in context.
		_ = cr.cancelExistingLocked(ci)
	}()

	cr.inputChan <- ci
}
998026
func (c Configuration) Resolve() (string, error) {
	listenAddrType := c.ListenAddressType

	var listenAddress string
	switch listenAddrType {
	case ConfigResolver:
		if c.Value == nil {
			err := fmt.Errorf("missing listen address value using: resolver=%s",
				string(listenAddrType))
			return "", err
		}
		listenAddress = *c.Value

	case EnvironmentResolver:
		// environment variable for port is required
		if c.EnvVarListenPort == nil {
			err := fmt.Errorf("missing port env var name using: resolver=%s",
				string(listenAddrType))
			return "", err
		}
		portStr := os.Getenv(*c.EnvVarListenPort)
		port, err := strconv.Atoi(portStr)
		if err != nil {
			err := fmt.Errorf("invalid port env var value using: resolver=%s, name=%s",
				string(listenAddrType), *c.EnvVarListenPort)
			return "", err
		}
		// if environment variable for hostname is not set, use the default
		if c.EnvVarListenHost == nil {
			listenAddress = fmt.Sprintf("%s:%d", defaultHostname, port)
		} else {
			envHost := os.Getenv(*c.EnvVarListenHost)
			listenAddress = fmt.Sprintf("%s:%d", envHost, port)
		}

	default:
		return "", fmt.Errorf("unknown listen address type: resolver=%s",
			string(listenAddrType))
	}

	return listenAddress, nil
}
1065615
func (prs *ResizeParser) Resolve(param string) string {
	if !strings.HasPrefix(param, resizeParam+".") {
		return ""
	}
	return strings.TrimPrefix(param, resizeParam+".")
}
220684
func Resolve(ctx context.Context, nsys namesys.NameSystem, r *resolver.Resolver, p path.Path) (ipld.Node, error) {
	p, err := ResolveIPNS(ctx, nsys, p)
	if err != nil {
		return nil, err
	}

	// ok, we have an IPFS path now (or what we'll treat as one)
	return r.ResolvePath(ctx, p)
}
312431
func (lp ListParser) Resolve(param string) string {
	for _, subParser := range lp {
		httpParam := subParser.Resolve(param)
		if httpParam != "" {
			return httpParam
		}
	}
	return ""
}
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
}
438294
func (m *MultiResolver) Resolve(addr string) (h common.Hash, err error) {
	rs, err := m.getResolveValidator(addr)
	if err != nil {
		return h, err
	}
	for _, r := range rs {
		h, err = r.Resolve(addr)
		if err == nil {
			return
		}
	}
	return
}
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
}