// ResolveFeed attempts to extract feed information out of the manifest, if provided
// If not, it attempts to extract the feed out of a set of key-value pairs
972406
func (a *API) ResolveFeed(ctx context.Context, uri *URI, values feed.Values) (*feed.Feed, error) {
	var fd *feed.Feed
	var err error
	if uri.Addr != "" {
		// resolve the content key.
		manifestAddr := uri.Address()
		if manifestAddr == nil {
			manifestAddr, err = a.Resolve(ctx, uri.Addr)
			if err != nil {
				return nil, ErrCannotResolveFeedURI
			}
		}

		// get the Swarm feed from the manifest
		fd, err = a.ResolveFeedManifest(ctx, manifestAddr)
		if err != nil {
			return nil, err
		}
		log.Debug("handle.get.feed: resolved", "manifestkey", manifestAddr, "feed", fd.Hex())
	} else {
		var f feed.Feed
		if err := f.FromValues(values); err != nil {
			return nil, ErrCannotResolveFeed

		}
		fd = &f
	}
	return fd, 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
}
1065615
func (prs *ResizeParser) Resolve(param string) string {
	if !strings.HasPrefix(param, resizeParam+".") {
		return ""
	}
	return strings.TrimPrefix(param, resizeParam+".")
}
368624
func (c *Client) QueryFeed(query *feed.Query, manifestAddressOrDomain string) (io.ReadCloser, error) {
	return c.queryFeed(query, manifestAddressOrDomain, false)
}
477939
func GetFeeds(ctxUser *User, actorID, afterID int64, isProfile bool) ([]*Action, error) {
	actions := make([]*Action, 0, setting.UI.User.NewsFeedPagingNum)
	sess := x.Limit(setting.UI.User.NewsFeedPagingNum).Where("user_id = ?", ctxUser.ID).Desc("id")
	if afterID > 0 {
		sess.And("id < ?", afterID)
	}
	if isProfile {
		sess.And("is_private = ?", false).And("act_user_id = ?", ctxUser.ID)
	} else if actorID != -1 && ctxUser.IsOrganization() {
		// FIXME: only need to get IDs here, not all fields of repository.
		repos, _, err := ctxUser.GetUserRepositories(actorID, 1, ctxUser.NumRepos)
		if err != nil {
			return nil, fmt.Errorf("GetUserRepositories: %v", err)
		}

		var repoIDs []int64
		for _, repo := range repos {
			repoIDs = append(repoIDs, repo.ID)
		}

		if len(repoIDs) > 0 {
			sess.In("repo_id", repoIDs)
		}
	}

	err := sess.Find(&actions)
	return actions, err
}
920419
func (r *PeerResolver) Resolve(peers []fab.Peer) (fab.Peer, error) {
	preferredPeers := r.getPreferredPeers(r.minBlockHeightResolver.Filter(peers))
	if len(preferredPeers) > 0 {
		// At least one of our preferred peers is suitable. Use the default balancer to balance between them.
		logger.Debugf("Choosing a peer from the list of preferred peers")
		return r.loadBalancePolicy.Choose(preferredPeers)
	}

	logger.Debugf("There are no suitable peers from the list of preferred peers [%s] so choosing another peer using the 'prefer org' resolver", r.preferredPeers)
	return r.preferOrgResolver.Resolve(peers)
}
165746
func (m *MockFeed) Get(arg0 content.FeedID, arg1 content.User) (content.Feed, error) {
	ret := m.ctrl.Call(m, "Get", arg0, arg1)
	ret0, _ := ret[0].(content.Feed)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
553134
func (r *Resolver) resolveOnce(domain string) (p string, err error) {
	r.setDefaults()

	if !isd.IsDomain(domain) {
		return "", ErrInvalidDomain
	}

	txt, err := r.lookupTXT(domain)
	if err != nil {
		return "", err
	}

	err = ErrResolveFailed
	for _, t := range txt {
		p, err = ParseTXT(t)
		if err == nil {
			return p, nil
		}
	}

	return "", err
}
919576
func ResolveFormat(req *Request) string {
	ext := strings.ToLower(filepath.Ext(req.GetPath()))
	switch ext {
	case ".html":
		return "html"
	case ".json":
		return "json"
	case ".xml":
		return "xml"
	case ".txt":
		return "txt"
	}

	accept := req.GetHttpHeader("accept")

	switch {
	case accept == "",
		strings.HasPrefix(accept, "*/*"), // */
		strings.Contains(accept, "application/xhtml"),
		strings.Contains(accept, "text/html"):
		return "html"
	case strings.Contains(accept, "application/json"),
		strings.Contains(accept, "text/javascript"),
		strings.Contains(accept, "application/javascript"):
		return "json"
	case strings.Contains(accept, "application/xml"),
		strings.Contains(accept, "text/xml"):
		return "xml"
	case strings.Contains(accept, "text/plain"):
		return "txt"
	}

	return "html"
}
992343
func (this *Promise) Resolve(v interface{}) (e error) {
	return this.setResult(&PromiseResult{v, RESULT_SUCCESS})
}
162655
func (t *DefaultAtomTranslator) Translate(feed interface{}) (*Feed, error) {
	atom, found := feed.(*atom.Feed)
	if !found {
		return nil, fmt.Errorf("Feed did not match expected type of *atom.Feed")
	}

	result := &Feed{}
	result.Title = t.translateFeedTitle(atom)
	result.Description = t.translateFeedDescription(atom)
	result.Link = t.translateFeedLink(atom)
	result.FeedLink = t.translateFeedFeedLink(atom)
	result.Updated = t.translateFeedUpdated(atom)
	result.UpdatedParsed = t.translateFeedUpdatedParsed(atom)
	result.Author = t.translateFeedAuthor(atom)
	result.Language = t.translateFeedLanguage(atom)
	result.Image = t.translateFeedImage(atom)
	result.Copyright = t.translateFeedCopyright(atom)
	result.Categories = t.translateFeedCategories(atom)
	result.Generator = t.translateFeedGenerator(atom)
	result.Items = t.translateFeedItems(atom)
	result.Extensions = atom.Extensions
	result.FeedVersion = atom.Version
	result.FeedType = "atom"
	return result, nil
}
778879
func (c *ConfigEntry) ResolveServiceConfig(args *structs.ServiceConfigRequest, reply *structs.ServiceConfigResponse) error {
	if done, err := c.srv.forward("ConfigEntry.ResolveServiceConfig", args, args, reply); done {
		return err
	}
	defer metrics.MeasureSince([]string{"config_entry", "resolve_service_config"}, time.Now())

	// Fetch the ACL token, if any.
	rule, err := c.srv.ResolveToken(args.Token)
	if err != nil {
		return err
	}
	if rule != nil && !rule.ServiceRead(args.Name) {
		return acl.ErrPermissionDenied
	}

	return c.srv.blockingQuery(
		&args.QueryOptions,
		&reply.QueryMeta,
		func(ws memdb.WatchSet, state *state.Store) error {
			// Pass the WatchSet to both the service and proxy config lookups. If either is updated
			// during the blocking query, this function will be rerun and these state store lookups
			// will both be current.
			index, serviceEntry, err := state.ConfigEntry(ws, structs.ServiceDefaults, args.Name)
			if err != nil {
				return err
			}
			var serviceConf *structs.ServiceConfigEntry
			var ok bool
			if serviceEntry != nil {
				serviceConf, ok = serviceEntry.(*structs.ServiceConfigEntry)
				if !ok {
					return fmt.Errorf("invalid service config type %T", serviceEntry)
				}
			}

			_, proxyEntry, err := state.ConfigEntry(ws, structs.ProxyDefaults, structs.ProxyConfigGlobal)
			if err != nil {
				return err
			}
			var proxyConf *structs.ProxyConfigEntry
			if proxyEntry != nil {
				proxyConf, ok = proxyEntry.(*structs.ProxyConfigEntry)
				if !ok {
					return fmt.Errorf("invalid proxy config type %T", proxyEntry)
				}
				// Apply the proxy defaults to the sidecar's proxy config
				reply.ProxyConfig = proxyConf.Config
			}

			reply.Index = index

			if serviceConf != nil && serviceConf.Protocol != "" {
				if reply.ProxyConfig == nil {
					reply.ProxyConfig = make(map[string]interface{})
				}
				reply.ProxyConfig["protocol"] = serviceConf.Protocol
			}

			// Apply the upstream protocols to the upstream configs
			for _, upstream := range args.Upstreams {
				_, upstreamEntry, err := state.ConfigEntry(ws, structs.ServiceDefaults, upstream)
				if err != nil {
					return err
				}
				var upstreamConf *structs.ServiceConfigEntry
				var ok bool
				if upstreamEntry != nil {
					upstreamConf, ok = upstreamEntry.(*structs.ServiceConfigEntry)
					if !ok {
						return fmt.Errorf("invalid service config type %T", upstreamEntry)
					}
				}

				// Nothing to configure if a protocol hasn't been set.
				if upstreamConf == nil || upstreamConf.Protocol == "" {
					continue
				}

				if reply.UpstreamConfigs == nil {
					reply.UpstreamConfigs = make(map[string]map[string]interface{})
				}
				reply.UpstreamConfigs[upstream] = map[string]interface{}{
					"protocol": upstreamConf.Protocol,
				}
			}

			return nil
		})
}
103777
func (c Configuration) Resolve() (string, error) {
	r, err := c.resolver()
	if err != nil {
		return "", err
	}
	return r.ID()
}
1072180
func (g *graph) ResolveAll() []reflect.Value {
	var values []reflect.Value
	for _, def := range g.definitions {
		values = append(values, def.Resolve(g))
	}
	return values
}
1371917
func ResolveSubnet(ctx types.Context) (string, error) {
	mac, err := getMAC(ctx)
	if err != nil {
		return "", err
	}
	return ResolveSubnetWithMAC(ctx, mac)
}
727892
func (r *RedisDriver) GetFetchedFeedMeta(url string) (*models.FeedMeta, error) {
	var result *redis.StringStringMapCmd
	if result = r.conn.HGetAll(hashKeyPrefix + "Meta"); result.Err() != nil {
		return nil, result.Err()
	}
	meta := &models.FeedMeta{}
	if s, ok := result.Val()[url]; ok {
		if err := json.Unmarshal([]byte(s), meta); err != nil {
			return nil, err
		}
		return meta, nil
	}
	return meta, nil
}
494979
func (o *orphanDeploymentResolver) Resolve() ([]*corev1.ReplicationController, error) {
	deployments, err := o.dataSet.ListDeployments()
	if err != nil {
		return nil, err
	}

	results := []*corev1.ReplicationController{}
	for _, deployment := range deployments {
		deploymentStatus := appsutil.DeploymentStatusFor(deployment)
		if !o.deploymentStatusFilter.Has(string(deploymentStatus)) {
			continue
		}
		_, exists, _ := o.dataSet.GetDeploymentConfig(deployment)
		if !exists {
			results = append(results, deployment)
		}
	}
	return results, nil
}