// ManifestStore returns a store for local manifests
181829
func (cli *DockerCli) ManifestStore() manifeststore.Store {
	// TODO: support override default location from config file
	return manifeststore.NewStore(filepath.Join(config.Dir(), "manifests"))
}
56334
func (ts *tagStore) All(ctx context.Context) ([]string, error) {
	var tags []string

	pathSpec, err := pathFor(manifestTagPathSpec{
		name: ts.repository.Named().Name(),
	})
	if err != nil {
		return tags, err
	}

	entries, err := ts.blobStore.driver.List(ctx, pathSpec)
	if err != nil {
		switch err := err.(type) {
		case storagedriver.PathNotFoundError:
			return tags, distribution.ErrRepositoryUnknown{Name: ts.repository.Named().Name()}
		default:
			return tags, err
		}
	}

	for _, entry := range entries {
		_, filename := path.Split(entry)
		tags = append(tags, filename)
	}

	return tags, nil
}
939339
func (r *Registry) Manifest(ctx context.Context, repository, ref string) (distribution.Manifest, error) {
	uri := r.url("/v2/%s/manifests/%s", repository, ref)
	r.Logf("registry.manifests uri=%s repository=%s ref=%s", uri, repository, ref)

	req, err := http.NewRequest("GET", uri, nil)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Accept", fmt.Sprintf("%s;q=0.9", schema2.MediaTypeManifest))

	resp, err := r.Client.Do(req.WithContext(ctx))
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	r.Logf("registry.manifests resp.Status=%s, body=%s", resp.Status, body)

	m, _, err := distribution.UnmarshalManifest(resp.Header.Get("Content-Type"), body)
	if err != nil {
		return nil, err
	}

	return m, nil
}
22941
func (api UsersAPI) GetKeyStore(w http.ResponseWriter, r *http.Request) {
	username := mux.Vars(r)["username"]
	globalid := context.Get(r, "client_id").(string)

	mgr := keystore.NewManager(r)
	keys, err := mgr.ListKeyStoreKeys(username, globalid)
	if err != nil && !db.IsNotFound(err) {
		log.Error("Failed to get keystore keys: ", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(keys)
}
669523
func Manifest(f io.ReadSeeker) (*schema.ImageManifest, error) {
	m, err := specaci.ManifestFromImage(f)
	if err != nil {
		return nil, err
	}
	return m, nil
}
80778
func NewStoreConfig() *StoreConfig {
	return &StoreConfig{
		Enabled:                  true,
		Addrs:                    "localhost",
		Keyspace:                 "metrictank",
		Consistency:              "one",
		HostSelectionPolicy:      "tokenaware,hostpool-epsilon-greedy",
		Timeout:                  "1s",
		ReadConcurrency:          20,
		WriteConcurrency:         10,
		ReadQueueSize:            200000,
		WriteQueueSize:           100000,
		Retries:                  0,
		WindowFactor:             20,
		OmitReadTimeout:          "60s",
		CqlProtocolVersion:       4,
		CreateKeyspace:           true,
		DisableInitialHostLookup: false,
		SSL:                      false,
		CaPath:                   "/etc/metrictank/ca.pem",
		HostVerification:         true,
		Auth:                     false,
		Username:                 "cassandra",
		Password:                 "cassandra",
		SchemaFile:               "/etc/metrictank/schema-store-cassandra.toml",
	}
}
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
}
1289325
func DirStore(dirname string) TokenStore {
	return &dirStore{
		cache: cache.FileCacheWithNameFn(dirname, filename),
	}
}
927817
func getStore(configuration *viper.Viper, hRegister healthRegister, doBootstrap bool) (
	storage.MetaStore, error) {
	var store storage.MetaStore
	backend := configuration.GetString("storage.backend")
	logrus.Infof("Using %s backend", backend)

	switch backend {
	case notary.MemoryBackend:
		return storage.NewMemStorage(), nil
	case notary.MySQLBackend, notary.SQLiteBackend, notary.PostgresBackend:
		storeConfig, err := utils.ParseSQLStorage(configuration)
		if err != nil {
			return nil, err
		}
		s, err := storage.NewSQLStorage(storeConfig.Backend, storeConfig.Source)
		if err != nil {
			return nil, fmt.Errorf("Error starting %s driver: %s", backend, err.Error())
		}
		store = *storage.NewTUFMetaStorage(s)
		hRegister("DB operational", 10*time.Second, s.CheckHealth)
	case notary.RethinkDBBackend:
		var sess *gorethink.Session
		storeConfig, err := utils.ParseRethinkDBStorage(configuration)
		if err != nil {
			return nil, err
		}
		tlsOpts := tlsconfig.Options{
			CAFile:             storeConfig.CA,
			CertFile:           storeConfig.Cert,
			KeyFile:            storeConfig.Key,
			ExclusiveRootPools: true,
		}
		if doBootstrap {
			sess, err = rethinkdb.AdminConnection(tlsOpts, storeConfig.Source)
		} else {
			sess, err = rethinkdb.UserConnection(tlsOpts, storeConfig.Source, storeConfig.Username, storeConfig.Password)
		}
		if err != nil {
			return nil, fmt.Errorf("Error starting %s driver: %s", backend, err.Error())
		}
		s := storage.NewRethinkDBStorage(storeConfig.DBName, storeConfig.Username, storeConfig.Password, sess)
		store = *storage.NewTUFMetaStorage(s)
		hRegister("DB operational", 10*time.Second, s.CheckHealth)
	default:
		return nil, fmt.Errorf("%s is not a supported storage backend", backend)
	}
	return store, nil
}
1235458
func newStore() *store {
	return &store{
		root: &node{
			static:    true,
			children:  make([]*node, 256),
			pchildren: make([]*node, 0),
			pindex:    -1,
			pnames:    []string{},
		},
	}
}
115863
func NewTTLStore(duration time.Duration, hardLimit bool) types.Store {
	return newKeyValueStore(map[string]interface{}{}, duration, hardLimit)
}
128113
func (s *CertFileUserStore) Store(user *msp.UserData) error {
	key := storeKeyFromUserIdentifier(msp.IdentityIdentifier{MSPID: user.MSPID, ID: user.ID})
	return s.store.Store(key, user.EnrollmentCertificate)
}
590915
func (r *Registry) ManifestV1(ctx context.Context, repository, ref string) (schema1.SignedManifest, error) {
	uri := r.url("/v2/%s/manifests/%s", repository, ref)
	r.Logf("registry.manifests uri=%s repository=%s ref=%s", uri, repository, ref)

	var m schema1.SignedManifest
	if _, err := r.getJSON(ctx, uri, &m); err != nil {
		r.Logf("registry.manifests response=%v", m)
		return m, err
	}

	if m.Versioned.SchemaVersion != 1 {
		return m, ErrUnexpectedSchemaVersion
	}

	return m, nil
}
849058
func (c *ModelCommandBase) ClientStore() jujuclient.ClientStore {
	// c.store is set in maybeInitModel() below.
	if c.store == nil && !c.runStarted {
		panic("inappropriate method called before init finished")
	}
	return c.store
}
830811
func (r *Registry) ManifestList(ctx context.Context, repository, ref string) (manifestlist.ManifestList, error) {
	uri := r.url("/v2/%s/manifests/%s", repository, ref)
	r.Logf("registry.manifests uri=%s repository=%s ref=%s", uri, repository, ref)

	var m manifestlist.ManifestList
	if _, err := r.getJSON(ctx, uri, &m); err != nil {
		r.Logf("registry.manifests response=%v", m)
		return m, err
	}

	return m, nil
}
947924
func (r *s3Repository) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
	return &s3ManifestService{r: r}, nil
}
1183197
func (c *Pre182StoreConfig) StoreConfig() *StoreConfig {
	sc := &StoreConfig{
		AskForMore:     c.AskForMore,
		AutoClip:       c.AutoClip,
		AutoImport:     c.AutoImport,
		AutoSync:       c.AutoSync,
		CheckRecpHash:  c.CheckRecpHash,
		ClipTimeout:    c.ClipTimeout,
		Concurrency:    c.Concurrency,
		EditRecipients: c.EditRecipients,
		NoColor:        c.NoColor,
		NoConfirm:      c.NoConfirm,
		NoPager:        c.NoPager,
		Notifications:  c.Notifications,
		Path:           c.Path,
		RecipientHash:  c.RecipientHash,
		SafeContent:    c.SafeContent,
		UseSymbols:     c.UseSymbols,
	}
	return sc
}