// Get returns the ID which is allocated to a key in the kvstore
547928
func (a *Allocator) GetNoCache(ctx context.Context, key AllocatorKey) (idpool.ID, error) {
	// GetPrefix() will choose any "first" key with the same prefix as the
	// specified key. In the worst case this may alternate between
	// returning the prefix that is specified and returning a key with a
	// longer prefix (even if this exact prefix already exists in the
	// kvstore). In that case, we will potentially allocate duplicate
	// identities for the same set of labels. This is not efficient, but
	// should have the correct identity properties.
	prefix := path.Join(a.valuePrefix, key.GetKey())
	k, v, err := kvstore.GetPrefix(ctx, prefix)
	kvstore.Trace("AllocateGet", err, logrus.Fields{fieldPrefix: prefix, fieldKey: k, fieldValue: v})
	if err != nil || v == nil || !prefixMatchesKey(prefix, k) {
		return 0, err
	}

	id, err := strconv.ParseUint(string(v), 10, 64)
	if err != nil {
		return idpool.NoID, fmt.Errorf("unable to parse value '%s': %s", v, err)
	}

	return idpool.ID(id), nil
}
1086289
func (s *storage) Get(id []byte) ([]byte, error) {
	storage, closer := s.getStorage()
	defer closer()
	i, err := storage.Get(id)
	if err != nil {
		if err == bakery.ErrNotFound {
			return s.legacyGet(id)
		}
		return nil, err
	}
	return i, nil
}
554400
func (l *LRUNoTS) Get(key string) (interface{}, error) {
	res, err := l.cache.Get(key)
	if err != nil {
		return nil, err
	}

	elem := res.(*list.Element)
	// move found item to the head
	l.list.MoveToFront(elem)

	return elem.Value.(*kv).v, nil
}
1309362
func (s *MemcacheStore) Get(key interface{}) interface{} {
	s.lock.RLock()
	defer s.lock.RUnlock()

	return s.data[key]
}
1069260
func (store *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) {
	if store.Source == nil || store.Source.ID != id {
		return chronograf.Source{}, fmt.Errorf("unable to find Source with id %d", id)
	}
	return *store.Source, nil
}
391722
func (this *RedisStore) Get(id string) (*Session, error) {
	key := id
	if this.opts.KeyPrefix != "" {
		key = this.opts.KeyPrefix + ":" + id
	}
	b, err := redis.Bytes(this.conn.Do("GET", key))
	if err != nil {
		return nil, err
	}
	var sess Session
	err = json.Unmarshal(b, &sess)
	if err != nil {
		return nil, err
	}
	return &sess, nil
}
317838
func (m *MemoryStorer) Get(key string) (value string, err error) {
	m.mut.RLock()
	session, ok := m.sessions[key]
	m.mut.RUnlock()
	if !ok {
		return "", errNoSession{}
	}

	return session.value, nil
}
1058078
func Get(store string, key string) ([]byte, int, bool) {
	url := CONSUL_KV_BASE_URL + store + "/" + key

	resp, err := http.Get(url)

	if err != nil {
		glog.Errorf("Error (%v) in Get for %s\n", err, url)
		return nil, 0, false
	}

	defer resp.Body.Close()

	//glog.Infof("Status of Get %s for %s", resp.Status, url)

	if resp.StatusCode >= 200 && resp.StatusCode < 300 {
		var jsonBody []KVRespBody

		err = json.NewDecoder(resp.Body).Decode(&jsonBody)

		existingValue, err := b64.StdEncoding.DecodeString(jsonBody[0].Value)

		if err != nil {
			return nil, jsonBody[0].ModifyIndex, false
		}

		return existingValue, jsonBody[0].ModifyIndex, true

	}
	return nil, 0, false

}
1190178
func (s *LedisStore) Get(key interface{}) interface{} {
	s.lock.RLock()
	defer s.lock.RUnlock()

	return s.data[key]
}
1121944
func (rkv *KeyValue) Get(key string) (string, error) {
	conn := rkv.pool.Get(rkv.dbindex)
	result, err := redis.String(conn.Do("GET", rkv.id+":"+key))
	if err != nil {
		return "", err
	}
	return result, nil
}
482707
func (mk *MemKeystore) Get(name string) (ci.PrivKey, error) {
	if err := validateName(name); err != nil {
		return nil, err
	}

	k, ok := mk.keys[name]
	if !ok {
		return nil, ErrNoSuchKey
	}

	return k, nil
}
311757
func (s *FileStore) Get(key interface{}) interface{} {
	s.lock.RLock()
	defer s.lock.RUnlock()

	return s.data[key]
}
665937
func (s *Identify3State) Get(key keybase1.Identify3GUIID) (ret *Identify3Session, err error) {
	s.Lock()
	defer s.Unlock()
	return s.getLocked(key)
}
626166
func (c *Context) Get(key string) interface{} {
	if c.store == nil {
		return nil
	}
	if v, ok := c.store[key]; ok {
		return v
	}
	return nil
}
580164
func (s *MemStore) Get(key interface{}) interface{} {
	s.lock.RLock()
	defer s.lock.RUnlock()

	return s.data[key]
}
419414
func (kv *KeyValue) Get(key string) (string, error) {
	rows, err := kv.host.db.Query(fmt.Sprintf("SELECT attr -> %s FROM %s", singleQuote(key), pq.QuoteIdentifier(kvPrefix+kv.table)))
	if err != nil {
		return "", err
	}
	if rows == nil {
		return "", errors.New("KeyValue Get returned no rows for key " + key)
	}
	defer rows.Close()
	var value string
	// Get the value. Should only loop once.
	counter := 0
	for rows.Next() {
		err = rows.Scan(&value)
		if err != nil {
			return "", err
		}
		counter++
	}
	if err := rows.Err(); err != nil {
		return "", err
	}
	if counter != 1 {
		return "", errors.New("Wrong number of keys in KeyValue table: " + kvPrefix + kv.table)
	}
	if !kv.host.rawUTF8 {
		Decode(&value)
	}
	return value, nil
}
1093234
func (d *MapDatastore) Get(key Key) (value []byte, err error) {
	val, found := d.values[key]
	if !found {
		return nil, ErrNotFound
	}
	return val, nil
}