// This method inquire about OID subtrees by repeatedly using GetBulkRequest.
// Returned PDU contains the varbind list of all subtrees.
// however, if the ErrorStatus of PDU is not the NoError, return only the last query result.
191695
func (s *SNMP) GetBulkWalk(oids Oids, nonRepeaters, maxRepetitions int) (result Pdu, err error) {
	var nonRepBinds, resBinds VarBinds

	oids = append(oids[:nonRepeaters], oids[nonRepeaters:].Sort().UniqBase()...)
	reqOids := make(Oids, len(oids))
	copy(reqOids, oids)

	for len(reqOids) > 0 {
		pdu, err := s.GetBulkRequest(reqOids, nonRepeaters, maxRepetitions)
		if err != nil {
			return nil, err
		}
		if s := pdu.ErrorStatus(); s != NoError &&
			(s != NoSuchName || pdu.ErrorIndex() <= nonRepeaters) {
			return pdu, nil
		}

		varBinds := pdu.VarBinds()

		if nonRepeaters > 0 {
			nonRepBinds = append(nonRepBinds, varBinds[:nonRepeaters]...)
			varBinds = varBinds[nonRepeaters:]
			oids = oids[nonRepeaters:]
			reqOids = reqOids[nonRepeaters:]
			nonRepeaters = 0
		}

		filled := len(varBinds) == len(reqOids)*maxRepetitions
		varBinds = varBinds.Sort().Uniq()

		for i, _ := range reqOids {
			matched := varBinds.MatchBaseOids(oids[i])
			mLength := len(matched)

			if mLength == 0 || resBinds.MatchOid(matched[mLength-1].Oid) != nil {
				reqOids[i] = nil
				continue
			}

			hasError := false
			for _, val := range matched {
				switch val.Variable.(type) {
				case *NoSucheObject, *NoSucheInstance, *EndOfMibView:
					hasError = true
				default:
					resBinds = append(resBinds, val)
					reqOids[i] = val.Oid
				}
			}

			if hasError || (filled && mLength < maxRepetitions) {
				reqOids[i] = nil
			}
		}

		// sweep completed oids
		for i := len(reqOids) - 1; i >= 0; i-- {
			if reqOids[i] == nil {
				reqOids = append(reqOids[:i], reqOids[i+1:]...)
				oids = append(oids[:i], oids[i+1:]...)
			}
		}
	}

	resBinds = append(nonRepBinds, resBinds.Sort().Uniq()...)
	return NewPduWithVarBinds(s.args.Version, GetResponse, resBinds), nil
}
939827
func (s *storeImpl) GetAllPublicEndpoints(ctx datastore.Context) ([]PublicEndpoint, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetAllPublicEndpoints"))
	searchRequest := newServiceDetailsElasticRequest(map[string]interface{}{
		"query": map[string]interface{}{
			"bool": map[string]interface{}{
				"should": []map[string]interface{}{
					map[string]interface{}{
						"regexp": map[string]interface{}{
							"Endpoints.VHostList.Name": ".+",
						},
					},
					map[string]interface{}{
						"regexp": map[string]interface{}{
							"Endpoints.PortList.PortAddr": ".+",
						},
					},
				},
			},
		},
		"fields": serviceEndpointFields,
		"size":   serviceDetailsLimit,
	})

	results, err := datastore.NewQuery(ctx).Execute(searchRequest)
	if err != nil {
		return nil, err
	}

	peps := []PublicEndpoint{}
	for results.HasNext() {
		var result EndpointQueryResult
		err := results.Next(&result)
		if err != nil {
			return nil, err
		}
		endpoints := createPublicEndpoints(result)
		peps = append(peps, endpoints...)
	}

	return peps, nil
}
871576
func (c UnitFacadeClient) LookUp(fullIDs ...string) ([]payload.Result, error) {
	if len(fullIDs) == 0 {
		// Unlike List(), LookUp doesn't fall back to looking up all IDs.
		return nil, nil
	}
	args := internal.FullIDs2LookUpArgs(fullIDs)

	var rs params.PayloadResults
	if err := c.FacadeCall("LookUp", &args, &rs); err != nil {
		return nil, err
	}

	return api2results(rs)
}
1284294
func (_class VMPPClass) GetAllRecords(sessionID SessionRef) (_retval map[VMPPRef]VMPPRecord, _err error) {
	_method := "VMPP.get_all_records"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVMPPRefToVMPPRecordMapToGo(_method + " -> ", _result.Value)
	return
}
1144381
func (_class PGPUClass) GetAll(sessionID SessionRef) (_retval []PGPURef, _err error) {
	_method := "PGPU.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPGPURefSetToGo(_method + " -> ", _result.Value)
	return
}
190444
func (obj *Doc) GetAllInfos(ctx context.Context) ([]*NxInfo, error) {
	result := &struct {
		Infos []*NxInfo	`json:"qInfos"`
	} {}
	err := obj.rpc(ctx, "GetAllInfos", result)
	return result.Infos, err 
}
682448
func (c *Client) GetBulk(vb uint16, keys []string) (map[string]*gomemcached.MCResponse, error) {
	rv := map[string]*gomemcached.MCResponse{}
	going := true

	defer func() {
		going = false
	}()

	errch := make(chan error, 2)

	go func() {
		defer func() { errch <- nil }()
		for going {
			res, err := c.Receive()
			if err != nil {
				errch <- err
				return
			}
			switch res.Opcode {
			case gomemcached.GET:
				going = false
			case gomemcached.GETQ:
			default:
				log.Panicf("Unexpected opcode in GETQ response: %+v",
					res)
			}
			rv[keys[res.Opaque]] = res
		}
	}()

	for i, k := range keys {
		op := gomemcached.GETQ
		if i == len(keys)-1 {
			op = gomemcached.GET
		}
		err := c.Transmit(&gomemcached.MCRequest{
			Opcode:  op,
			VBucket: vb,
			Key:     []byte(k),
			Opaque:  uint32(i),
		})
		if err != nil {
			return rv, err
		}
	}

	return rv, <-errch
}
1083598
func (p *Pod) GetAppsTreeStoreIDs() ([]string, error) {
	var treeStoreIDs []string
	apps, err := p.getApps()
	if err != nil {
		return nil, err
	}
	for _, a := range apps {
		id, err := p.GetAppTreeStoreID(a.Name)
		if err != nil {
			return nil, err
		}
		if id != "" {
			treeStoreIDs = append(treeStoreIDs, id)
		}
	}
	return treeStoreIDs, nil
}
951302
func (_class PoolUpdateClass) GetAllRecords(sessionID SessionRef) (_retval map[PoolUpdateRef]PoolUpdateRecord, _err error) {
	_method := "pool_update.get_all_records"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPoolUpdateRefToPoolUpdateRecordMapToGo(_method + " -> ", _result.Value)
	return
}
1313372
func (obj *Doc) GetAllInfosRaw(ctx context.Context) (json.RawMessage, error) {
	result := &struct {
		Infos json.RawMessage	`json:"qInfos"`
	} {}
	err := obj.rpc(ctx, "GetAllInfos", result)
	return result.Infos, err 
}
1242985
func (m *Msg) GetLastPlugin(db *sqlx.DB) (string, string, error) {
	var res struct {
		Plugin string
		Route  string
	}
	var err error
	if m.User.ID > 0 {
		q := `SELECT route, plugin FROM messages
		      WHERE userid=$1 AND abotsent IS FALSE
		      ORDER BY createdat DESC`
		err = db.Get(&res, q, m.User.ID)
	} else {
		q := `SELECT route, plugin FROM messages
		      WHERE flexid=$1 AND flexidtype=$2 AND abotsent IS FALSE
		      ORDER BY createdat DESC`
		err = db.Get(&res, q, m.User.FlexID, m.User.FlexIDType)
	}
	if err != nil && err != sql.ErrNoRows {
		return "", "", err
	}
	return res.Plugin, res.Route, nil
}
1047489
func (c *Context) GetAll() Store {
	buf := Store{}
	for key, value := range c.getStore() {
		buf[key] = value
	}
	if c.Parent != nil {
		for key, value := range c.Parent.GetAll() {
			buf[key] = value
		}
	}
	return buf
}
904551
func (c *sioClient) GetVolumeRefs(volID sioVolumeID) (refs int, err error) {
	files, err := c.getSioDiskPaths()
	if err != nil {
		return 0, err
	}
	for _, file := range files {
		if strings.Contains(file.Name(), string(volID)) {
			refs++
		}
	}
	return
}
593948
func (_class PBDClass) GetAllRecords(sessionID SessionRef) (_retval map[PBDRef]PBDRecord, _err error) {
	_method := "PBD.get_all_records"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPBDRefToPBDRecordMapToGo(_method + " -> ", _result.Value)
	return
}
691103
func (_class BlobClass) GetAllRecords(sessionID SessionRef) (_retval map[BlobRef]BlobRecord, _err error) {
	_method := "blob.get_all_records"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertBlobRefToBlobRecordMapToGo(_method + " -> ", _result.Value)
	return
}
1015610
func (c *InternalClient) RetrieveShardFromURI(ctx context.Context, index, field, view string, shard uint64, uri pilosa.URI) (io.ReadCloser, error) {
	span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.RetrieveShardFromURI")
	defer span.Finish()

	node := &pilosa.Node{
		URI: uri,
	}

	u := nodePathToURL(node, "/internal/fragment/data")
	u.RawQuery = url.Values{
		"index": {index},
		"field": {field},
		"view":  {view},
		"shard": {strconv.FormatUint(shard, 10)},
	}.Encode()

	// Build request.
	req, err := http.NewRequest("GET", u.String(), nil)
	if err != nil {
		return nil, errors.Wrap(err, "creating request")
	}

	req.Header.Set("User-Agent", "pilosa/"+pilosa.Version)

	// Execute request.
	resp, err := c.executeRequest(req.WithContext(ctx))
	if err != nil {
		if resp != nil && resp.StatusCode == http.StatusNotFound {
			return nil, pilosa.ErrFragmentNotFound
		}
		return nil, err
	}

	return resp.Body, nil
}
611414
func (d *domainClient) GetSearchResults(ctx context.Context, args *GetSearchResultsArgs) (reply *GetSearchResultsReply, err error) {
	reply = new(GetSearchResultsReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.getSearchResults", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.getSearchResults", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "GetSearchResults", Err: err}
	}
	return
}