// GetBlockStorages returns a list of all active block storages on Vultr account
422308
func (c *Client) GetBlockStorages() (storages []BlockStorage, err error) {
	if err := c.get(`block/list`, &storages); err != nil {
		return nil, err
	}
	sort.Sort(blockstorages(storages))
	return storages, nil
}
753579
func (v *Vibranium) GetContainers(ctx context.Context, cids *pb.ContainerIDs) (*pb.Containers, error) {
	containers, err := v.cluster.GetContainers(ctx, cids.GetIds())
	if err != nil {
		return nil, err
	}

	return &pb.Containers{Containers: toRPCContainers(ctx, containers, nil)}, nil
}
779093
func (lc *LedgerCommitter) GetBlocks(blockSeqs []uint64) []*common.Block {
	var blocks []*common.Block

	for _, seqNum := range blockSeqs {
		if blck, err := lc.GetBlockByNumber(seqNum); err != nil {
			logger.Errorf("Not able to acquire block num %d, from the ledger skipping...", seqNum)
			continue
		} else {
			logger.Debug("Appending next block with seqNum = ", seqNum, " to the resulting set")
			blocks = append(blocks, blck)
		}
	}

	return blocks
}
920329
func (dd *DirData) GetChildren(ctx context.Context) (
	children map[string]EntryInfo, err error) {
	topBlock, err := dd.GetTopBlock(ctx, BlockRead)
	if err != nil {
		return nil, err
	}

	_, blocks, _, err := dd.tree.getBlocksForOffsetRange(
		ctx, dd.rootBlockPointer(), topBlock, topBlock.FirstOffset(), nil,
		false, true)
	if err != nil {
		return nil, err
	}

	numEntries := 0
	for _, b := range blocks {
		numEntries += len(b.(*DirBlock).Children)
	}
	children = make(map[string]EntryInfo, numEntries)
	for _, b := range blocks {
		for k, de := range b.(*DirBlock).Children {
			if hiddenEntries[k] {
				continue
			}
			children[k] = de.EntryInfo
		}
	}
	return children, nil
}
186280
func (l *kvLedger) GetBlockByHash(blockHash []byte) (*common.Block, error) {
	block, err := l.blockStore.RetrieveBlockByHash(blockHash)
	l.blockAPIsRWLock.RLock()
	l.blockAPIsRWLock.RUnlock()
	return block, err
}
1149453
func ParseGetBlockRes(res keybase1.GetBlockRes, resErr error) (
	buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error) {
	if resErr != nil {
		return nil, kbfscrypto.BlockCryptKeyServerHalf{}, resErr
	}
	serverHalf, err = kbfscrypto.ParseBlockCryptKeyServerHalf(res.BlockKey)
	if err != nil {
		return nil, kbfscrypto.BlockCryptKeyServerHalf{}, err
	}
	return res.Buf, serverHalf, nil
}
746402
func (c *Calcium) GetContainers(ctx context.Context, IDs []string) ([]*types.Container, error) {
	return c.store.GetContainers(ctx, IDs)
}
1032734
func (l BlockSpanList) GetMissingBlocks(maxBlock uint) (sorted BlockSpanList) {
	// it's difficult to know how many spans we will need
	sorted = make(BlockSpanList, 0)

	lastBlockSpanIndex := -1
	for _, blockSpan := range l {
		if int(blockSpan.StartBlock) > lastBlockSpanIndex+1 {
			sorted = append(
				sorted,
				BlockSpan{
					StartBlock: uint(lastBlockSpanIndex + 1),
					EndBlock:   blockSpan.StartBlock - 1,
				},
			)
		}

		lastBlockSpanIndex = int(blockSpan.EndBlock)
	}

	if lastBlockSpanIndex == -1 {
		sorted = append(
			sorted,
			BlockSpan{
				StartBlock: 0,
				EndBlock:   maxBlock,
			},
		)
	} else if uint(lastBlockSpanIndex) < maxBlock {
		sorted = append(
			sorted,
			BlockSpan{
				StartBlock: uint(lastBlockSpanIndex + 1),
				EndBlock:   maxBlock,
			},
		)
	}

	return sorted
}
614008
func getDevices(pool, block, metadatadev string) (map[int]*DeviceBlockStats, error) {
	cmd := exec.Command("thin_dump", "-f", "xml", metadatadev, "-m", block)
	stdout, err := cmd.StdoutPipe()
	cmd.Stderr = os.Stderr
	if err != nil {
		return nil, err
	}
	if err := cmd.Start(); err != nil {
		return nil, err
	}
	devices, err := parseMetadata(stdout)
	if err != nil {
		return nil, err
	}
	if err := cmd.Wait(); err != nil {
		return nil, err
	}
	return devices, nil
}
487234
func (u *FakeVolumeUtil) GetBlockCapacityByte(fullPath string) (int64, error) {
	return u.getDirEntryCapacity(fullPath, FakeEntryBlock)
}
1326057
func (p *iscsiProvisioner) getAccessModes() []v1.PersistentVolumeAccessMode {
	return []v1.PersistentVolumeAccessMode{
		v1.ReadWriteOnce,
		v1.ReadOnlyMany,
	}
}
497709
func (c *Client) ListBlobStorages(i *ListBlobStoragesInput) ([]*BlobStorage, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/logging/azureblob", i.Service, i.Version)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var as []*BlobStorage
	if err := decodeJSON(&as, resp.Body); err != nil {
		return nil, err
	}
	sort.Stable(blobStorageByName(as))
	return as, nil
}
527983
func (lc *LightChain) GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash {
	return lc.hc.GetBlockHashesFromHash(hash, max)
}
380287
func (d *DeviceMapperDriver) GetTenantStorageStats() ([]volume.TenantStorageStats, error) {
	var result []volume.TenantStorageStats
	status := d.DeviceSet.Status()
	// If this is loop-lvm, the metadata device will be in status.MetadataFile
	mdDevice := status.MetadataFile
	if mdDevice == "" {
		// It's direct-lvm, so build the metadata device from the pool name
		mdDevice = fmt.Sprintf("/dev/mapper/%s_tmeta", status.PoolName)
	}
	// CC-2418: Disabling block stats gathering until a kernel bug in dm-thin
	// is fixed
	/*
		blockstats, err := d.getDeviceBlockStats(status.PoolName, mdDevice)
		if err != nil {
			return nil, err
		}
	*/

	for _, tenant := range d.ListTenants() {
		var devInfo devInfo
		vol, err := d.getVolume(tenant, false)
		if err != nil {
			return nil, err
		}
		if err := d.readDeviceInfo(vol.Metadata.CurrentDevice(), &devInfo); err != nil {
			return nil, err
		}
		// CC-2417
		//if stats, ok := blockstats[devInfo.DeviceID]; ok {
		tss := volume.TenantStorageStats{TenantID: tenant, VolumePath: vol.Path()}
		// CC-2417
		//tss.DeviceAllocatedBlocks = stats.diet.Total()
		tss.NumberSnapshots = len(vol.Metadata.snapshotMetadata.Snapshots)
		dev := vol.Metadata.CurrentDevice()
		// This will activate the device
		if _, err := d.DeviceSet.GetDeviceStatus(dev); err != nil {
			return nil, err
		}
		devicename := fmt.Sprintf("/dev/mapper/%s-%s", d.DevicePrefix, dev)
		total, used, free, err := getFilesystemStats(devicename)
		if err != nil {
			return nil, err
		}
		size, err := getDeviceSize(devicename)
		if err != nil {
			return nil, err
		}
		tss.FilesystemTotal = total
		tss.FilesystemAvailable = free
		tss.FilesystemUsed = used
		tss.DeviceTotalBlocks = volume.BytesToBlocks(size)
		tss.DeviceName = devicename

		//tss.DeviceUnallocatedBlocks = tss.DeviceTotalBlocks - tss.DeviceAllocatedBlocks
		/* CC-2417
				last := stats
				for _, device := range vol.Metadata.snapshotMetadata.Snapshots {
					if err := d.readDeviceInfo(device, &devInfo); err != nil {
						return nil, err
					}
					if snapstats, ok := blockstats[devInfo.DeviceID]; ok {
						tss.SnapshotAllocatedBlocks += snapstats.UniqueBlocks(last)
						last = snapstats
					}
				}
				/*
				if volume.BytesToBlocks(tss.FilesystemUsed) < tss.DeviceAllocatedBlocks {
					tss.Errors = append(tss.Errors, fmt.Sprintf(` !	Note: %s of blocks are allocated to an application virtual device but
		are unused by the filesystem. This is not a problem; however, if you want
		the thin pool to reclaim the space for use by snapshots or another
		application, run:

			$ fstrim %s`, volume.BlocksToBytes(tss.DeviceAllocatedBlocks-volume.BytesToBlocks(tss.FilesystemUsed)), vol.Path()))
				}
		*/
		result = append(result, tss)
		/* CC-2417
		} else {
			// There is no device matching the tenant
			return nil, fmt.Errorf("Tenant %s DFS has not yet been initialized", tenant)
		}
		*/
	}
	return result, nil
}
93486
func (r Network_Storage_Schedule) GetProperties() (resp []datatypes.Network_Storage_Schedule_Property, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Storage_Schedule", "getProperties", nil, &r.Options, &resp)
	return
}
374044
func (l *kvLedger) GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error) {
	return l.blockStore.GetMissingPvtDataInfoForMostRecentBlocks(maxBlock)
}
159100
func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) {
	blocks := api.eth.BlockChain().BadBlocks()
	results := make([]*BadBlockArgs, len(blocks))

	var err error
	for i, block := range blocks {
		results[i] = &BadBlockArgs{
			Hash: block.Hash(),
		}
		if rlpBytes, err := rlp.EncodeToBytes(block); err != nil {
			results[i].RLP = err.Error() // Hacky, but hey, it works
		} else {
			results[i].RLP = fmt.Sprintf("0x%x", rlpBytes)
		}
		if results[i].Block, err = ethapi.RPCMarshalBlock(block, true, true); err != nil {
			results[i].Block = map[string]interface{}{"error": err.Error()}
		}
	}
	return results, nil
}