// BatchGet returns an error if cfg.getError is set.
510336
func (t *InjectedSnapshot) BatchGet(keys []Key) (map[string][]byte, error) {
	t.cfg.RLock()
	defer t.cfg.RUnlock()
	if t.cfg.getError != nil {
		return nil, t.cfg.getError
	}
	return t.Snapshot.BatchGet(keys)
}
1151121
func (v *OrderedValues) StringGet(key string) string {
	if len(key) == 0 {
		return ""
	}
	return string(v.Get([]byte(key)))
}
241192
func (db *RedisDB) hashGet(key, field string) string {
	return db.hashKeys[key][field]
}
102852
func (g *NamespaceGetter) Get(key uint64, setFunc func() (size int, value Value)) *Handle {
	return g.Cache.Get(g.NS, key, setFunc)
}
778217
func (f FakeGetter) Get(name string) (*api.Service, error) {
	return f.Svc, f.Err
}
418835
func (c *RawKVClient) BatchGet(keys [][]byte) ([][]byte, error) {
	start := time.Now()
	defer func() {
		tikvRawkvCmdHistogramWithBatchGet.Observe(time.Since(start).Seconds())
	}()

	bo := NewBackoffer(context.Background(), rawkvMaxBackoff)
	resp, err := c.sendBatchReq(bo, keys, tikvrpc.CmdRawBatchGet)
	if err != nil {
		return nil, errors.Trace(err)
	}

	cmdResp := resp.RawBatchGet
	if cmdResp == nil {
		return nil, errors.Trace(ErrBodyMissing)
	}

	keyToValue := make(map[string][]byte, len(keys))
	for _, pair := range cmdResp.Pairs {
		keyToValue[string(pair.Key)] = pair.Value
	}

	values := make([][]byte, len(keys))
	for i, key := range keys {
		values[i] = keyToValue[string(key)]
	}
	return values, nil
}
583225
func (s *tikvSnapshot) BatchGet(keys []kv.Key) (map[string][]byte, error) {
	m := make(map[string][]byte)
	if len(keys) == 0 {
		return m, nil
	}
	tikvTxnCmdCounterWithBatchGet.Inc()
	start := time.Now()
	defer func() { tikvTxnCmdHistogramWithBatchGet.Observe(time.Since(start).Seconds()) }()

	// We want [][]byte instead of []kv.Key, use some magic to save memory.
	bytesKeys := *(*[][]byte)(unsafe.Pointer(&keys))
	ctx := context.WithValue(context.Background(), txnStartKey, s.version.Ver)
	bo := NewBackoffer(ctx, batchGetMaxBackoff).WithVars(s.vars)

	// Create a map to collect key-values from region servers.
	var mu sync.Mutex
	err := s.batchGetKeysByRegions(bo, bytesKeys, func(k, v []byte) {
		if len(v) == 0 {
			return
		}
		mu.Lock()
		m[string(k)] = v
		mu.Unlock()
	})
	if err != nil {
		return nil, errors.Trace(err)
	}

	err = s.store.CheckVisibility(s.version.Ver)
	if err != nil {
		return nil, errors.Trace(err)
	}

	return m, nil
}
154032
func (b *basicBatcher) Get() ([]interface{}, error) {
	// Don't check disposed yet so any items remaining in the queue
	// will be returned properly.

	var timeout <-chan time.Time
	if b.maxTime > 0 {
		timeout = time.After(b.maxTime)
	}

	select {
	case items, ok := <-b.batchChan:
		// If there's something on the batch channel, we definitely want that.
		if !ok {
			return nil, ErrDisposed
		}
		return items, nil
	case <-timeout:
		// It's possible something was added to the channel after something
		// was received on the timeout channel, in which case that must
		// be returned first to satisfy our ordering guarantees.
		// We can't just grab the lock here in case the batch channel is full,
		// in which case a Put or Flush will be blocked and holding
		// onto the lock. In that case, there should be something on the
		// batch channel
		for {
			if b.lock.TryLock() {
				// We have a lock, try to read from channel first in case
				// something snuck in
				select {
				case items, ok := <-b.batchChan:
					b.lock.Unlock()
					if !ok {
						return nil, ErrDisposed
					}
					return items, nil
				default:
				}

				// If that is unsuccessful, nothing was added to the channel,
				// and the temp buffer can't have changed because of the lock,
				// so grab that
				items := b.items
				b.items = make([]interface{}, 0, b.maxItems)
				b.availableBytes = 0
				b.lock.Unlock()
				return items, nil
			} else {
				// If we didn't get a lock, there are two cases:
				// 1) The batch chan is full.
				// 2) A Put or Flush temporarily has the lock.
				// In either case, trying to read something off the batch chan,
				// and going back to trying to get a lock if unsuccessful
				// works.
				select {
				case items, ok := <-b.batchChan:
					if !ok {
						return nil, ErrDisposed
					}
					return items, nil
				default:
				}
			}
		}
	}
}
1173128
func NewBatchError(code, message string, err []Error) awserr.Error {
	return &BatchError{
		Errors:  err,
		code:    code,
		message: message,
	}
}
527837
func (s *URLScriptHandler) Get(script string) *api.InstallResult {
	if len(s.URL) == 0 {
		return nil
	}
	scriptURL, err := url.ParseRequestURI(s.URL + "/" + script)
	if err != nil {
		glog.Infof("invalid script url %q: %v", s.URL, err)
		return nil
	}
	return &api.InstallResult{
		Script: script,
		URL:    scriptURL.String(),
	}
}
1029334
func (rl *MemoryReplayLog) Get(hash *HashPrefix) (uint32, error) {
	if rl.entries == nil || rl.batches == nil {
		return 0, errReplayLogNotStarted
	}

	cltv, exists := rl.entries[*hash]
	if !exists {
		return 0, ErrLogEntryNotFound
	}

	return cltv, nil
}
769271
func (c *Client) ModelGet() (map[string]interface{}, error) {
	result := params.ModelConfigResults{}
	err := c.facade.FacadeCall("ModelGet", nil, &result)
	if err != nil {
		return nil, errors.Trace(err)
	}
	values := make(map[string]interface{})
	for name, val := range result.Config {
		values[name] = val.Value
	}
	return values, nil
}
533802
func (m *MockIndex) Get(arg0 string) interface{} {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Get", arg0)
	ret0, _ := ret[0].(interface{})
	return ret0
}
236370
func (bow *Browser) httpGET(u *url.URL, ref *url.URL) error {
	req, err := bow.buildRequest("GET", u.String(), ref, nil)
	if err != nil {
		return err
	}
	return bow.httpRequest(req)
}
1179342
func (c *Client) HMGet(key string, field ...string) ([]string, error) {
	v, err := c.execWithKey(true, "HMGET", key, vstr2iface(field)...)
	if err != nil {
		return nil, err
	}
	return iface2vstr(v), nil
}
956247
func callGet(apiMethod string, params *apiParams, args map[string]interface{}, result interface{}, rules P) (err error) {
	urlParams := url.Values{}
	urlParams.Add("method", apiMethod)
	urlParams.Add("api_key", params.apikey)

	formated, err := formatArgs(args, rules)
	if err != nil {
		return
	}
	for k, v := range formated {
		urlParams.Add(k, v)
	}

	uri := constructUrl(UriApiSecBase, urlParams)

	client := &http.Client{}
	req, err := http.NewRequest("GET", uri, nil)
	if err != nil {
		return
	}
	if params.useragent != "" {
		req.Header.Set("User-Agent", params.useragent)
	}

	res, err := client.Do(req)
	if err != nil {
		return
	}
	if res.StatusCode/100 == 5 { // only 5xx class errors
		err = newLibError(res.StatusCode, res.Status)
		return
	}
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return
	}
	err = parseResponse(body, result)
	return
}
93989
func httpGET(url string) ([]byte, error) {
	resp, err := httpClient.Get(url)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("%s: %s", url, resp.Status)
	}
	b, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("%s: %v", url, err)
	}
	return b, nil
}