// NewDocumentStore returns a mock of DocumentStore where its methods will return zero values.
420180
func NewDocumentStore() *DocumentStore {
	return &DocumentStore{
		CreateDocumentFn: func(ctx context.Context, d *influxdb.Document, opts ...influxdb.DocumentOptions) error {
			return nil
		},
		UpdateDocumentFn: func(ctx context.Context, d *influxdb.Document, opts ...influxdb.DocumentOptions) error {
			return nil
		},
		FindDocumentsFn: func(ctx context.Context, opts ...influxdb.DocumentFindOptions) ([]*influxdb.Document, error) {
			return nil, nil
		},
		DeleteDocumentsFn: func(ctx context.Context, opts ...influxdb.DocumentFindOptions) error {
			return nil
		},
	}
}
589402
func NewEventStore() *EventStore {
	s := &EventStore{
		db: map[string]map[uuid.UUID]aggregateRecord{},
	}
	return s
}
849473
func NewDocumentID(collection, key string) DocumentID {
	return DocumentID(pathEscape(collection) + "/" + pathEscape(key))
}
700731
func (s *DocumentService) FindDocumentStore(ctx context.Context, name string) (influxdb.DocumentStore, error) {
	return s.FindDocumentStoreFn(ctx, name)
}
686123
func NewDocumentShare(chatID int64, fileID string) DocumentConfig {
	return DocumentConfig{
		BaseFile: BaseFile{
			BaseChat:    BaseChat{ChatID: chatID},
			FileID:      fileID,
			UseExisting: true,
		},
	}
}
319886
func (l *Result) Store() (storage.Store, error) {
	return inmem.NewFromObject(l.Documents), nil
}
571864
func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore {
	keydir, _ = filepath.Abs(keydir)
	ks := &KeyStore{storage: &keyStorePassphrase{keydir, scryptN, scryptP, false}}
	ks.init(keydir)
	return ks
}
10620
func NewCodeStore(idStore *IDStore, options CodeStoreOptions) (*CodeStore, error) {
	return newCodeStore(idStore, options)
}
640958
func NewLocalFileStore(datadir string, basekey []byte) (*FileStore, error) {
	params := NewDefaultLocalStoreParams()
	params.Init(datadir)
	localStore, err := NewLocalStore(params, nil)
	if err != nil {
		return nil, err
	}
	localStore.Validators = append(localStore.Validators, NewContentAddressValidator(MakeHashFunc(DefaultHash)))
	return NewFileStore(localStore, NewFileStoreParams()), nil
}
1130546
func (s *Service) CreateDocumentStore(ctx context.Context, ns string) (influxdb.DocumentStore, error) {
	// TODO(desa): keep track of which namespaces exist.
	var ds influxdb.DocumentStore

	err := s.kv.Update(ctx, func(tx Tx) error {
		store, err := s.createDocumentStore(ctx, tx, ns)
		if err != nil {
			return err
		}

		ds = store
		return nil
	})

	if err != nil {
		return nil, err
	}

	return ds, nil
}
502638
func (m *mongoStore) New(r *http.Request, name string) (*gSessions.Session, error) {
	session := gSessions.NewSession(m, name)
	session.Options = &gSessions.Options{
		Path:   m.options.Path,
		MaxAge: m.options.MaxAge,
	}
	session.IsNew = true
	var err error
	if cook, errToken := m.Token.GetToken(r, name); errToken == nil {
		err = securecookie.DecodeMulti(name, cook, &session.ID, m.Codecs...)
		if err == nil {
			ok, err := m.load(session)
			session.IsNew = !(err == nil && ok) // not new if no error and data available
		}
	}
	return session, err
}
986335
func NewMemoryStore(limit uint16) *MemoryStore {
	if limit == 0 || limit > maxStoreLimit {
		limit = maxStoreLimit
	}
	memoryStore := &MemoryStore{
		events: make(map[string]event.Event),
		limit:  limit,
	}
	return memoryStore
}
224156
func NewImageStore(fs StoreBackend, lss map[string]LayerGetReleaser) (Store, error) {
	is := &store{
		lss:       lss,
		images:    make(map[ID]*imageMeta),
		fs:        fs,
		digestSet: digestset.NewSet(),
	}

	// load all current images and retain layers
	if err := is.restore(); err != nil {
		return nil, err
	}

	return is, nil
}
468105
func NewDocument(p unsafe.Pointer, contentLen int, inEncoding, outEncoding []byte) (doc *HtmlDocument) {
	doc = &HtmlDocument{}
	doc.XmlDocument = xml.NewDocument(p, contentLen, inEncoding, outEncoding)
	doc.Me = doc
	node := doc.Node.(*xml.XmlNode)
	node.Document = doc
	//runtime.SetFinalizer(doc, (*HtmlDocument).Free)
	return
}
1259371
func NewNodbStore(c *nodb.DB, sid string, expire int64, kv map[interface{}]interface{}) *NodbStore {
	return &NodbStore{
		c:      c,
		expire: expire,
		sid:    sid,
		data:   kv,
	}
}
1279836
func NewObjectStorage(base, temporal storer.EncodedObjectStorer) *ObjectStorage {
	return &ObjectStorage{EncodedObjectStorer: base, temporal: temporal}
}
36422
func createStore(ns walletdb.ReadWriteBucket) error {
	// Ensure that nothing currently exists in the namespace bucket.
	ck, cv := ns.ReadCursor().First()
	if ck != nil || cv != nil {
		const str = "namespace is not empty"
		return storeError(ErrAlreadyExists, str, nil)
	}

	// Write the latest store version.
	if err := putVersion(ns, getLatestVersion()); err != nil {
		return err
	}

	// Save the creation date of the store.
	var v [8]byte
	byteOrder.PutUint64(v[:], uint64(time.Now().Unix()))
	err := ns.Put(rootCreateDate, v[:])
	if err != nil {
		str := "failed to store database creation time"
		return storeError(ErrDatabase, str, err)
	}

	// Write a zero balance.
	byteOrder.PutUint64(v[:], 0)
	err = ns.Put(rootMinedBalance, v[:])
	if err != nil {
		str := "failed to write zero balance"
		return storeError(ErrDatabase, str, err)
	}

	// Finally, create all of our required descendant buckets.
	return createBuckets(ns)
}