// GetBundle fetches and validates the bundle given a tail transaction hash by calling TraverseBundle
// and traversing through trunk transactions.
18161
func (api *API) GetBundle(tailTxHash Hash) (bundle.Bundle, error) {
	if err := Validate(ValidateTransactionHashes(tailTxHash)); err != nil {
		return nil, err
	}
	var err error
	bndl := bundle.Bundle{}
	bndl, err = api.TraverseBundle(tailTxHash, bndl)
	if err != nil {
		return nil, err
	}
	if err := bundle.ValidBundle(bndl); err != nil {
		return nil, err
	}
	return bndl, err
}
846143
func (cifs *CCInfoFSImpl) GetChaincode(ccname string, ccversion string) (CCPackage, error) {
	return cifs.GetChaincodeFromPath(ccname, ccversion, chaincodeInstallPath)
}
118684
func (k *KeyBundleCacheStandard) GetTLFWriterKeyBundle(
	bundleID TLFWriterKeyBundleID) (*TLFWriterKeyBundleV3, error) {
	if entry, ok := k.cache.Get(bundleID); ok {
		if wkb, ok := entry.(TLFWriterKeyBundleV3); ok {
			return &wkb, nil
		}
		// Shouldn't be possible.
		return nil, errors.New("Invalid key bundle type")
	}
	return nil, nil
}
982117
func LoadCertBundle(filename string) ([]*x509.Certificate, error) {
	bundleBytes, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	var bundle []*x509.Certificate
	var block *pem.Block
	rest := bundleBytes
	for {
		block, rest = pem.Decode(rest)
		if block == nil {
			break
		}
		if block.Type != "CERTIFICATE" {
			return nil, fmt.Errorf("Block has invalid type: %s", block.Type)
		}
		cert, err := x509.ParseCertificate(block.Bytes)
		if err != nil {
			return nil, err
		}
		bundle = append(bundle, cert)
	}

	if len(bundle) == 0 {
		return nil, fmt.Errorf("Bundle doesn't contain any certificates")
	}

	return bundle, nil
}
1046588
func serializeBundle(b ConfigBundle) ([]byte, error) {
	keys := make([]string, 0, len(b))
	for k := range b {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	items := make([]blobWithType, 0, len(b))
	for _, k := range keys {
		v := b[k]
		blob, err := proto.Marshal(v)
		if err != nil {
			return nil, err
		}
		items = append(items, blobWithType{
			Path: k,
			Kind: proto.MessageName(v),
			Blob: blob,
		})
	}

	out := bytes.Buffer{}
	if err := gob.NewEncoder(&out).Encode(items); err != nil {
		return nil, err
	}
	return out.Bytes(), nil
}
1340449
func (p *Packfile) Get(h plumbing.Hash) (plumbing.EncodedObject, error) {
	offset, err := p.FindOffset(h)
	if err != nil {
		return nil, err
	}

	return p.objectAtOffset(offset, h)
}
1065651
func TailTransactionHash(bndl Bundle) Hash {
	if bndl == nil || len(bndl) == 0 {
		return ""
	}
	for i := range bndl {
		tx := &bndl[i]
		if tx.CurrentIndex != 0 {
			continue
		}
		if len(tx.Hash) > 0 {
			return tx.Hash
		}
		return transaction.TransactionHash(tx)
	}
	return ""
}
570066
func (md *MDServerMemory) GetKeyBundles(ctx context.Context,
	tlfID tlf.ID, wkbID kbfsmd.TLFWriterKeyBundleID, rkbID kbfsmd.TLFReaderKeyBundleID) (
	*kbfsmd.TLFWriterKeyBundleV3, *kbfsmd.TLFReaderKeyBundleV3, error) {
	if err := checkContext(ctx); err != nil {
		return nil, nil, err
	}

	md.lock.RLock()
	defer md.lock.RUnlock()

	wkb, rkb, err := md.getKeyBundlesRLocked(tlfID, wkbID, rkbID)
	if err != nil {
		return nil, nil, kbfsmd.ServerError{Err: err}
	}
	return wkb, rkb, nil
}
576466
func (l *SigChainLoader) GetMerkleTriple() (ret *MerkleTriple) {
	if l.leaf != nil {
		ret = l.chainType.GetMerkleTriple(l.leaf)
	}
	return
}
438741
func (r Repository) GetBundle(id *charm.URL) (charm.Bundle, error) {
	bundleData := r.bundles[r.channel][*id]
	if bundleData == nil {
		return nil, errors.NotFoundf(id.String())
	}
	return bundleData, nil
}
526721
func (_m *ChainGetter) GetChain(chainID string) *multichannel.ChainSupport {
	ret := _m.Called(chainID)

	var r0 *multichannel.ChainSupport
	if rf, ok := ret.Get(0).(func(string) *multichannel.ChainSupport); ok {
		r0 = rf(chainID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*multichannel.ChainSupport)
		}
	}

	return r0
}
1149037
func (t *Transaction) Get(i interface{}, keys ...interface{}) (interface{}, error) {
	return get(t.dbmap, t, i, keys...)
}
214278
func (r Marketplace_Partner) GetFile(name *string) (resp datatypes.Marketplace_Partner_File, err error) {
	params := []interface{}{
		name,
	}
	err = r.Session.DoRequest("SoftLayer_Marketplace_Partner", "getFile", params, &r.Options, &resp)
	return
}
1149939
func ReadBundleRoots(ctx context.Context, store storage.Store, txn storage.Transaction) ([]string, error) {

	value, err := store.Read(ctx, txn, rootsPath)
	if err != nil {
		return nil, err
	}

	sl, ok := value.([]interface{})
	if !ok {
		return nil, fmt.Errorf("corrupt manifest roots")
	}

	roots := make([]string, len(sl))

	for i := range sl {
		roots[i], ok = sl[i].(string)
		if !ok {
			return nil, fmt.Errorf("corrupt manifest root")
		}
	}

	return roots, nil
}
959456
func (s *Sprocket) GetAsset(assetPath string) ([]byte, error) {
	return s.getAsset(assetPath, false)
}
861704
func loadBundle(id, path, workdir string) *bundle {
	return &bundle{
		id:      id,
		path:    path,
		workDir: workdir,
	}
}
1055905
func getBundlePath(fullKiteName string) (string, error) {
	kiteHome, err := kitekey.KiteHome()
	if err != nil {
		return "", err
	}
	return filepath.Join(kiteHome, "kites", fullKiteName), nil
}