// Datastores returns list of all datastores in the system.
439269
func (c *Client) Datastores(ctx context.Context) ([]*mo.Datastore, error) {
	_, datacenter, err := c.finder(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	folders, err := datacenter.Folders(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}

	es, err := c.lister(folders.DatastoreFolder.Reference()).List(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var datastores []*mo.Datastore
	for _, e := range es {
		switch o := e.Object.(type) {
		case mo.Datastore:
			datastores = append(datastores, &o)
		}
	}
	return datastores, nil
}
1139575
func (api *DatastoresAPI) GetAll() (result *Datastores, err error) {
	res, err := api.client.restClient.Get(api.client.Endpoint+datastoresURL, api.client.options.TokenOptions)
	if err != nil {
		return
	}
	defer res.Body.Close()
	res, err = getError(res)
	if err != nil {
		return
	}
	result = &Datastores{}
	err = json.NewDecoder(res.Body).Decode(result)
	return result, err
}
1031933
func (sb *storageBackend) AllVolumes() ([]Volume, error) {
	volumes, err := sb.volumes(nil)
	if err != nil {
		return nil, errors.Annotate(err, "cannot get volumes")
	}
	return volumesToInterfaces(volumes), nil
}
975346
func (*badgerdsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
	return func(params map[string]interface{}) (fsrepo.DatastoreConfig, error) {
		var c datastoreConfig
		var ok bool

		c.path, ok = params["path"].(string)
		if !ok {
			return nil, fmt.Errorf("'path' field is missing or not string")
		}

		sw, ok := params["syncWrites"]
		if !ok {
			c.syncWrites = true
		} else {
			if swb, ok := sw.(bool); ok {
				c.syncWrites = swb
			} else {
				return nil, fmt.Errorf("'syncWrites' field was not a boolean")
			}
		}

		truncate, ok := params["truncate"]
		if !ok {
			c.truncate = true
		} else {
			if truncate, ok := truncate.(bool); ok {
				c.truncate = truncate
			} else {
				return nil, fmt.Errorf("'truncate' field was not a boolean")
			}
		}

		vls, ok := params["vlogFileSize"]
		if !ok {
			// default to 1GiB
			c.vlogFileSize = badgerds.DefaultOptions.ValueLogFileSize
		} else {
			if vlogSize, ok := vls.(string); ok {
				s, err := humanize.ParseBytes(vlogSize)
				if err != nil {
					return nil, err
				}
				c.vlogFileSize = int64(s)
			} else {
				return nil, fmt.Errorf("'vlogFileSize' field was not a string")
			}
		}

		return &c, nil
	}
}
1332741
func (w *WithDimensions) Datapoints() []*datapoint.Datapoint {
	return w.appendDimensions(w.Collector.Datapoints())
}
569415
func (ds *resourcesUnitDataStore) ListResources() (resource.ApplicationResources, error) {
	return ds.resources.ListResources(ds.unit.ApplicationName())
}
146028
func (s *GlobalStore) keys(addr *common.Address, startKey []byte, limit int) (keys mock.Keys, err error) {
	iter := s.db.NewIterator(nil, nil)
	defer iter.Release()

	if limit <= 0 {
		limit = mock.DefaultLimit
	}

	prefix := []byte{indexForHashesPrefix}
	if addr != nil {
		prefix = indexForHashesPerNodePrefix(*addr)
	}
	if startKey != nil {
		if addr != nil {
			startKey = indexForHashesPerNode(*addr, startKey)
		} else {
			startKey = indexForHashes(startKey)
		}
	} else {
		startKey = prefix
	}

	ok := iter.Seek(startKey)
	if !ok {
		return keys, iter.Error()
	}
	for ; ok; ok = iter.Next() {
		k := iter.Key()
		if !bytes.HasPrefix(k, prefix) {
			break
		}
		key := append([]byte(nil), bytes.TrimPrefix(k, prefix)...)

		if len(keys.Keys) >= limit {
			keys.Next = key
			break
		}

		keys.Keys = append(keys.Keys, key)
	}
	return keys, iter.Error()
}
1047489
func (c *Context) GetAll() Store {
	buf := Store{}
	for key, value := range c.getStore() {
		buf[key] = value
	}
	if c.Parent != nil {
		for key, value := range c.Parent.GetAll() {
			buf[key] = value
		}
	}
	return buf
}
299863
func (h *Heap) ListKeys() []string {
	h.lock.RLock()
	defer h.lock.RUnlock()
	list := make([]string, 0, len(h.data.items))
	for key := range h.data.items {
		list = append(list, key)
	}
	return list
}
1211006
func (h *Service) GetDatabases(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()

	srcID, err := paramID("id", r)
	if err != nil {
		Error(w, http.StatusUnprocessableEntity, err.Error(), h.Logger)
		return
	}

	src, err := h.Store.Sources(ctx).Get(ctx, srcID)
	if err != nil {
		notFound(w, srcID, h.Logger)
		return
	}

	dbsvc := h.Databases
	if err = dbsvc.Connect(ctx, &src); err != nil {
		msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err)
		Error(w, http.StatusBadRequest, msg, h.Logger)
		return
	}

	databases, err := dbsvc.AllDB(ctx)
	if err != nil {
		Error(w, http.StatusBadRequest, err.Error(), h.Logger)
		return
	}

	dbs := make([]dbResponse, len(databases))
	for i, d := range databases {
		rps, err := h.allRPs(ctx, dbsvc, srcID, d.Name)
		if err != nil {
			Error(w, http.StatusBadRequest, err.Error(), h.Logger)
			return
		}
		dbs[i] = newDBResponse(srcID, d.Name, rps)
	}

	res := dbsResponse{
		Databases: dbs,
	}

	encodeJSON(w, http.StatusOK, res, h.Logger)
}
1000372
func (m *MemoryStore) ListFiles() []string {
	names := make([]string, 0, len(m.data))
	for n := range m.data {
		names = append(names, n)
	}
	return names
}
296868
func (d *driver) Snapshots(
	ctx types.Context,
	opts types.Store) ([]*types.Snapshot, error) {
	// TODO Snapshots are not implemented yet
	return nil, types.ErrNotImplemented
	/*
		// Get all snapshots
		ec2snapshots, err := d.getSnapshot(ctx, "", "", "")
		if err != nil {
			return nil, goof.WithError("error getting snapshot", err)
		}
		if len(ec2snapshots) == 0 {
			return nil, goof.New("no snapshots returned")
		}
		// Convert to libStorage types.Snapshot
		snapshots := d.toTypesSnapshot(ec2snapshots)
		return snapshots, nil
	*/
}
935208
func (db *DB) Indexes() ([]string, error) {
	var names []string
	var err = db.View(func(tx *Tx) error {
		var err error
		names, err = tx.Indexes()
		return err
	})
	return names, err
}
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
}
217116
func (sb *storageBackend) AllStorageInstances() ([]StorageInstance, error) {
	storageInstances, err := sb.storageInstances(nil)
	if err != nil {
		return nil, errors.Trace(err)
	}
	out := make([]StorageInstance, len(storageInstances))
	for i, s := range storageInstances {
		out[i] = s
	}
	return out, nil
}
1115242
func NewLogDatastore(ds Datastore, name string) *LogDatastore {
	if len(name) < 1 {
		name = "LogDatastore"
	}
	return &LogDatastore{Name: name, child: ds}
}
966010
func (r *ListCAsRPC) ListCAs(c context.Context, _ *empty.Empty) (*admin.ListCAsResponse, error) {
	names, err := ListCAs(c)
	if err != nil {
		return nil, status.Errorf(codes.Internal, "transient datastore error - %s", err)
	}
	return &admin.ListCAsResponse{Cn: names}, nil
}