// OpenStore returns a handle to a store
421958
func (p *provider) OpenStore(ledgerid string) (Store, error) {
	dbHandle := p.dbProvider.GetDBHandle(ledgerid)
	s := &store{db: dbHandle, ledgerid: ledgerid,
		collElgProcSync: &collElgProcSync{
			notification: make(chan bool, 1),
			procComplete: make(chan bool, 1),
		},
	}
	if err := s.initState(); err != nil {
		return nil, err
	}
	s.launchCollElgProc()
	logger.Debugf("Pvtdata store opened. Initial state: isEmpty [%t], lastCommittedBlock [%d], batchPending [%t]",
		s.isEmpty, s.lastCommittedBlock, s.batchPending)
	return s, nil
}
1351978
func NewNodeStore(addr common.Address, store GlobalStorer) *NodeStore {
	return &NodeStore{
		store: store,
		addr:  addr,
	}
}
52365
func (l *SigChainLoader) Store() (err error) {
	err = l.StoreTail()
	if err == nil {
		err = l.chain.Store(l.M())
	}
	return
}
140279
func (c *asyncClient) Sunionstore(arg0 string, arg1 []string) (stat FutureBool, err Error) {
	//	arg0bytes := []byte(arg0)
	//	arg1bytes := concatAndGetBytes(arg1, " ")
	args := appendAndConvert(arg0, arg1...)

	//	resp, err := c.conn.QueueRequest(&SUNIONSTORE, [][]byte{arg0bytes, arg1bytes})
	resp, err := c.conn.QueueRequest(&SUNIONSTORE, args)
	if err == nil {
		stat = resp.future.(FutureBool)
	}

	return
}
1236355
func (c *Cluster) RemoveStore(storeID uint64) {
	c.Lock()
	defer c.Unlock()

	delete(c.stores, storeID)
}
1362834
func NewStore(pg getter.PluginGetter) *Store {
	return &Store{
		extensions:   make(map[string]volume.Driver),
		driverLock:   locker.New(),
		pluginGetter: pg,
	}
}
975072
func NewFileStore(directory string) *FileStore {
	store := &FileStore{
		directory: directory,
		opened:    false,
	}
	return store
}
774977
func (o *ClientOptions) SetStore(s Store) *ClientOptions {
	o.Store = s
	return o
}
1370387
func (c *Call) Store(retvalues ...interface{}) error {
	if c.Err != nil {
		return c.Err
	}

	return Store(c.Body, retvalues...)
}
1093885
func (session *Session) StoreEngine(storeEngine string) *Session {
	session.statement.StoreEngine = storeEngine
	return session
}
1372979
func NewStore() *Store {
	return &Store{
		plugins:  make(map[string]*v2.Plugin),
		specOpts: make(map[string][]SpecOpt),
		handlers: make(map[string][]func(string, *plugins.Client)),
	}
}
45995
func (w *Worker) LogStore() (raft.LogStore, error) {
	select {
	case <-w.catacomb.Dying():
		err := w.catacomb.Err()
		if err != nil {
			return nil, err
		}
		return nil, ErrWorkerStopped
	case logStore := <-w.logStoreCh:
		return logStore, nil
	}
}
477602
func (m *Main) openStore() error {
	// If the advertised address is not in the peer list then we should proxy.

	// Resolve advertised address.
	addr, err := net.ResolveTCPAddr("tcp", m.advertiseAddr)
	if err != nil {
		return err
	}

	// Listen via mux
	storeLn := m.mux.Listen([]byte{server.StoreHdr})

	// Initialize store.
	s := server.NewStore(m.dataDir)
	s.Listener = storeLn
	s.Advertise = addr

	// Allow single node if there's no peers set.
	s.EnableSingleNode = len(m.peers) <= 1

	// Open store.
	if err := s.Open(); err != nil {
		return err
	}
	m.store = s

	// If peers then set peer set.
	if len(m.peers) > 0 {
		if err := s.SetPeers(m.peers); err != nil {
			return fmt.Errorf("set peers: %s", err)
		}
	}

	return nil
}
1160656
func Store(s storage.Store) func(r *Rego) {
	return func(r *Rego) {
		r.store = s
	}
}
699482
func (c *Client) ContentStore() content.Store {
	if c.contentStore != nil {
		return c.contentStore
	}
	c.connMu.Lock()
	defer c.connMu.Unlock()
	return contentproxy.NewContentStore(contentapi.NewContentClient(c.conn))
}
460523
func (c *Cluster) GetStore(storeID uint64) *metapb.Store {
	c.RLock()
	defer c.RUnlock()

	if store := c.stores[storeID]; store != nil {
		return proto.Clone(store.meta).(*metapb.Store)
	}
	return nil
}
1187814
func NewStore(dir string, store *imagestore.Store) (*Store, error) {
	// TODO(sgotti) backward compatibility with the current tree store paths. Needs a migration path to better paths.
	ts := &Store{dir: filepath.Join(dir, "tree"), store: store}

	ts.lockDir = filepath.Join(dir, "treestorelocks")
	if err := os.MkdirAll(ts.lockDir, 0755); err != nil {
		return nil, err
	}
	return ts, nil
}