// binaryGet restores the current instance from the information contained in the passed slice
544451
func (u *ID) binaryGet(serializedData []byte) error {
	if len(serializedData) != idLength {
		return NewErrorf(ErrInvalidValue, "Incorrect slice size to read ID. Expected %d, got %d", idLength, len(serializedData))
	}

	var cursor int
	if err := u.Feed.binaryGet(serializedData[cursor : cursor+feedLength]); err != nil {
		return err
	}
	cursor += feedLength

	if err := u.Epoch.UnmarshalBinary(serializedData[cursor : cursor+lookup.EpochLength]); err != nil {
		return err
	}
	cursor += lookup.EpochLength

	return nil
}
605909
func (s Slice) get(attribute string) (Slice, error) {
	if !s.IsObject() {
		return nil, InvalidTypeError{"Expecting Object"}
	}

	h := s.head()
	if h == 0x0a {
		// special case, empty object
		return nil, nil
	}

	if h == 0x14 {
		// compact Object
		value, err := s.getFromCompactObject(attribute)
		return value, WithStack(err)
	}

	offsetSize := indexEntrySize(h)
	vpackAssert(offsetSize > 0)
	end := ValueLength(readIntegerNonEmpty(s[1:], offsetSize))

	// read number of items
	var n ValueLength
	var ieBase ValueLength
	if offsetSize < 8 {
		n = ValueLength(readIntegerNonEmpty(s[1+offsetSize:], offsetSize))
		ieBase = end - n*ValueLength(offsetSize)
	} else {
		n = ValueLength(readIntegerNonEmpty(s[end-ValueLength(offsetSize):], offsetSize))
		ieBase = end - n*ValueLength(offsetSize) - ValueLength(offsetSize)
	}

	if n == 1 {
		// Just one attribute, there is no index table!
		key := Slice(s[s.findDataOffset(h):])

		if key.IsString() {
			if eq, err := key.IsEqualString(attribute); err != nil {
				return nil, WithStack(err)
			} else if eq {
				value, err := key.Next()
				return value, WithStack(err)
			}
			// fall through to returning None Slice below
		} else if key.IsSmallInt() || key.IsUInt() {
			// translate key
			if attributeTranslator == nil {
				return nil, WithStack(NeedAttributeTranslatorError)
			}
			if eq, err := key.translateUnchecked().IsEqualString(attribute); err != nil {
				return nil, WithStack(err)
			} else if eq {
				value, err := key.Next()
				return value, WithStack(err)
			}
		}

		// no match or invalid key type
		return nil, nil
	}

	// only use binary search for attributes if we have at least this many entries
	// otherwise we'll always use the linear search
	const SortedSearchEntriesThreshold = ValueLength(4)

	// bool const isSorted = (h >= 0x0b && h <= 0x0e);
	if n >= SortedSearchEntriesThreshold && (h >= 0x0b && h <= 0x0e) {
		// This means, we have to handle the special case n == 1 only
		// in the linear search!
		switch offsetSize {
		case 1:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 1)
			return result, WithStack(err)
		case 2:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 2)
			return result, WithStack(err)
		case 4:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 4)
			return result, WithStack(err)
		case 8:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 8)
			return result, WithStack(err)
		}
	}

	result, err := s.searchObjectKeyLinear(attribute, ieBase, ValueLength(offsetSize), n)
	return result, WithStack(err)
}
990064
func BinaryName(runtime string) string {
	// runtime name should format like $prefix.name.version
	parts := strings.Split(runtime, ".")
	if len(parts) < 2 {
		return ""
	}

	return fmt.Sprintf(shimBinaryFormat, parts[len(parts)-2], parts[len(parts)-1])
}
376180
func (f *File) IsBinary() (bin bool, err error) {
	reader, err := f.Reader()
	if err != nil {
		return false, err
	}
	defer ioutil.CheckClose(reader, &err)

	return binary.IsBinary(reader)
}
726019
func (ls *LState) RawGet(tb *LTable, key LValue) LValue {
	return tb.RawGet(key)
}
108567
func (c *Client) SnapshotGet(repository string) *SnapshotGetService {
	return NewSnapshotGetService(c).Repository(repository)
}
1263832
func (s *MerkleStoreImpl) dbGet(m libkb.MetaContext, hash keybase1.MerkleStoreKitHash) *keybase1.MerkleStoreKit {
	db := m.G().LocalDb
	if db == nil {
		return nil
	}
	var entry dbKit
	if found, err := db.GetInto(&entry, s.dbKey()); err != nil {
		m.Debug("MerkleStore: error reading from db: %s", err)
		return nil
	} else if !found {
		return nil
	}
	if entry.DBVersion != dbVersion {
		return nil
	}
	if entry.Hash == hash {
		return &entry.Kit
	}
	return nil
}
458419
func (bj BinaryJSON) Copy() BinaryJSON {
	buf := make([]byte, len(bj.Value))
	copy(buf, bj.Value)
	return BinaryJSON{TypeCode: bj.TypeCode, Value: buf}
}
1343873
func (st *TxnState) BatchGet(keys []kv.Key) (map[string][]byte, error) {
	bufferValues := make([][]byte, len(keys))
	shrinkKeys := make([]kv.Key, 0, len(keys))
	for i, key := range keys {
		val, err := st.buf.Get(key)
		if kv.IsErrNotFound(err) {
			shrinkKeys = append(shrinkKeys, key)
			continue
		}
		if err != nil {
			return nil, err
		}
		if len(val) != 0 {
			bufferValues[i] = val
		}
	}
	storageValues, err := st.Transaction.BatchGet(shrinkKeys)
	if err != nil {
		return nil, err
	}
	for i, key := range keys {
		if bufferValues[i] == nil {
			continue
		}
		storageValues[string(key)] = bufferValues[i]
	}
	return storageValues, nil
}
1165711
func (r *Update) binaryGet(serializedData []byte) error {
	if len(serializedData) < minimumUpdateDataLength {
		return NewErrorf(ErrNothingToReturn, "chunk less than %d bytes cannot be a feed update chunk", minimumUpdateDataLength)
	}
	dataLength := len(serializedData) - idLength - headerLength
	// at this point we can be satisfied that we have the correct data length to read

	var cursor int

	// deserialize Header
	r.Header.Version = serializedData[cursor]                                      // extract the protocol version
	copy(r.Header.Padding[:headerLength-1], serializedData[cursor+1:headerLength]) // extract the padding
	cursor += headerLength

	if err := r.ID.binaryGet(serializedData[cursor : cursor+idLength]); err != nil {
		return err
	}
	cursor += idLength

	data := serializedData[cursor : cursor+dataLength]
	cursor += dataLength

	// now that all checks have passed, copy data into structure
	r.data = make([]byte, dataLength)
	copy(r.data, data)

	return nil

}
1255174
func (c *Client) IndexGet(indices ...string) *IndicesGetService {
	return NewIndicesGetService(c).Index(indices...)
}
564011
func (b *Bitset) Get(index int) int {
	if index < b.size {
		return b.bits[index]
	}
	return -1
}
45491
func (s *Store) SessionGet(ws memdb.WatchSet, sessionID string) (uint64, *structs.Session, error) {
	tx := s.db.Txn(false)
	defer tx.Abort()

	// Get the table index.
	idx := maxIndexTxn(tx, "sessions")

	// Look up the session by its ID
	watchCh, session, err := tx.FirstWatch("sessions", "id", sessionID)
	if err != nil {
		return 0, nil, fmt.Errorf("failed session lookup: %s", err)
	}
	ws.Add(watchCh)
	if session != nil {
		return idx, session.(*structs.Session), nil
	}
	return idx, nil, nil
}
1326728
func (b *bufp) Get() *bytes.Buffer {
	buffer := b.Pool.Get().(*bytes.Buffer)
	buffer.Reset()

	return buffer
}
1073472
func CacheBinariesForBootstrapper(version string, clusterBootstrapper string) error {
	binaries := bootstrapper.GetCachedBinaryList(clusterBootstrapper)

	var g errgroup.Group
	for _, bin := range binaries {
		bin := bin
		g.Go(func() error {
			if _, err := CacheBinary(bin, version, "linux", runtime.GOARCH); err != nil {
				return errors.Wrapf(err, "caching image %s", bin)
			}
			return nil
		})
	}
	return g.Wait()
}
601386
func (h *LangHandler) cacheGet(ctx context.Context, conn jsonrpc2.JSONRPC2, key string, v interface{}) bool {
	if !h.init.Capabilities.XCacheProvider {
		return false
	}

	var r json.RawMessage
	err := conn.Call(ctx, "xcache/get", lspext.CacheGetParams{Key: key}, &r)
	if err != nil {
		return false
	}
	b := []byte(r)
	if bytes.Equal(b, []byte("null")) {
		return false
	}
	err = json.Unmarshal(b, &v)
	return err == nil
}
1139758
func (scope *Scope) InstanceGet(name string) (interface{}, bool) {
	return scope.Get(name + scope.InstanceID())
}