// NewStore creates a new instance of memory store with defaults.
345637
func NewStore() limiter.Store {
	return NewStoreWithOptions(limiter.StoreOptions{
		Prefix:          limiter.DefaultPrefix,
		CleanUpInterval: limiter.DefaultCleanUpInterval,
	})
}
196519
func NewSourcesStore(s chronograf.SourcesStore, role string) *SourcesStore {
	return &SourcesStore{
		store: s,
		role:  role,
	}
}
569189
func NewStorage() *Storage {
	return &Storage{
		ReferenceStorage: make(ReferenceStorage),
		ConfigStorage:    ConfigStorage{},
		ShallowStorage:   ShallowStorage{},
		ObjectStorage: ObjectStorage{
			Objects: make(map[plumbing.Hash]plumbing.EncodedObject),
			Commits: make(map[plumbing.Hash]plumbing.EncodedObject),
			Trees:   make(map[plumbing.Hash]plumbing.EncodedObject),
			Blobs:   make(map[plumbing.Hash]plumbing.EncodedObject),
			Tags:    make(map[plumbing.Hash]plumbing.EncodedObject),
		},
		ModuleStorage: make(ModuleStorage),
	}
}
669763
func NewMemoryStore() *MemoryStore {
	store := &MemoryStore{
		messages: make(map[string]packets.ControlPacket),
		opened:   false,
	}
	return store
}
176012
func NewStore(conf *Config) (Store, error) {

	if conf.Type == "" {
		return nil, fmt.Errorf("Type is required on Config")
	}
	registryMu.RLock()
	st, ok := storeProviders[conf.Type]
	registryMu.RUnlock()
	if !ok {
		return nil, fmt.Errorf("config.Type=%q was not found", conf.Type)
	}

	if conf.PageSize == 0 {
		conf.PageSize = MaxResults
	}

	if conf.TmpDir == "" {
		conf.TmpDir = os.TempDir()
	}
	return st(conf)
}
7300
func NewStorageProviderRegistry(reg storage.ProviderRegistry) storage.ProviderRegistry {
	return storage.ChainedProviderRegistry{reg, provider.CommonStorageProviders()}
}
1362834
func NewStore(pg getter.PluginGetter) *Store {
	return &Store{
		extensions:   make(map[string]volume.Driver),
		driverLock:   locker.New(),
		pluginGetter: pg,
	}
}
1299947
func NewStorageBackend(st *State) (*storageBackend, error) {
	// TODO(wallyworld) - we should be passing in a Model not a State
	// (but need to move stuff off State first)
	m, err := st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}
	registry, err := st.storageProviderRegistry()
	if err != nil {
		return nil, errors.Annotate(err, "getting storage provider registry")
	}

	return &storageBackend{
		mb:              st,
		registry:        registry,
		settings:        NewStateSettings(st),
		modelType:       m.Type(),
		config:          m.ModelConfig,
		application:     st.Application,
		allApplications: st.AllApplications,
		unit:            st.Unit,
		machine:         st.Machine,
	}, nil
}
10620
func NewCodeStore(idStore *IDStore, options CodeStoreOptions) (*CodeStore, error) {
	return newCodeStore(idStore, options)
}
566523
func NewCachedAnnouncementStore(store Store, options CacheOptions) Store {
	serviceCache := gcache.New(options.ServiceCacheSize).Expiration(options.ServiceCacheExpiration).LRU().
		LoaderFunc(func(k interface{}) (interface{}, error) {
			key := strings.Split(k.(string), ":")
			return store.Get(key[0], key[1])
		}).Build()

	listCache := gcache.New(options.ListCacheSize).Expiration(options.ListCacheExpiration).LRU().
		LoaderFunc(func(k interface{}) (interface{}, error) {
			key := k.(string)
			announcements, err := store.ListService(key, nil)
			if err != nil {
				return nil, err
			}
			go func(announcements []*Announcement) {
				for _, announcement := range announcements {
					serviceCache.Set(serviceCacheKey(announcement.ServiceName, announcement.ID), announcement)
				}
			}(announcements)
			return announcements, nil
		}).Build()

	return &cachedAnnouncementStore{
		backingStore: store,
		serviceCache: serviceCache,
		listCache:    listCache,
	}
}
937744
func NewServersStore(s chronograf.ServersStore, org string) *ServersStore {
	return &ServersStore{
		store:        s,
		organization: org,
	}
}
30266
func NewMemStore(sid string) *MemStore {
	return &MemStore{
		sid:        sid,
		data:       make(map[interface{}]interface{}),
		lastAccess: time.Now(),
	}
}
1158562
func NewMemoryStore(proposer state.Proposer) *MemoryStore {
	memDB, err := memdb.NewMemDB(schema)
	if err != nil {
		// This shouldn't fail
		panic(err)
	}

	return &MemoryStore{
		memDB:    memDB,
		queue:    watch.NewQueue(),
		proposer: proposer,
	}
}
722303
func NewStore(robot *Robot) (Store, error) {
	name := Config.StoreName
	if _, ok := Stores[name]; !ok {
		return nil, fmt.Errorf("%s is not a registered store", Config.StoreName)
	}

	store, err := Stores[name].newFunc(robot)
	if err != nil {
		return nil, err
	}
	return store, nil
}
1273950
func NewScraperTargetStoreService(s influxdb.ScraperTargetStoreService,
	urm influxdb.UserResourceMappingService,
	org influxdb.OrganizationService,
) *ScraperTargetStoreService {
	return &ScraperTargetStoreService{
		UserResourceMappingService: urm,
		s:                          s,
	}
}
848561
func NewMemoryStore(expiration time.Duration, cleanupInterval time.Duration) (KVStore, error) {
	return &MemoryStore{
		cache:           cache.New(expiration, cleanupInterval),
		expiration:      time.Duration(expiration) * time.Second,
		cleanupInterval: cleanupInterval,
	}, nil
}
527724
func NewSnapshotStore(
	dir string,
	retain int,
	logger Logger,
) (raft.SnapshotStore, error) {
	const logPrefix = "[snapshot] "
	if err := os.MkdirAll(dir, 0700); err != nil {
		return nil, errors.Trace(err)
	}
	logWriter := &raftutil.LoggoWriter{logger, loggo.DEBUG}
	logLogger := log.New(logWriter, logPrefix, 0)

	snaps, err := raft.NewFileSnapshotStoreWithLogger(dir, retain, logLogger)
	if err != nil {
		return nil, errors.Annotate(err, "failed to create file snapshot store")
	}
	return snaps, nil
}