Documentation ¶
Overview ¶
Package docstore provides an indexed JSON document store.
It is used by various services to store their data instead of implementing yet-another persistence layer. It uses a combination of Bolt for storage and Bleve for indexation.
Index ¶
- func Migrate(f dao.DAO, t dao.DAO, dryRun bool, status chan dao.MigratorStatus) (map[string]int, error)
- func NewDAO(ctx context.Context, o dao.DAO) (dao.DAO, error)
- type BleveServer
- func (s *BleveServer) CloseConn(ctx context.Context) error
- func (s *BleveServer) CountDocuments(storeId string, query *docstore.DocumentQuery) (int, error)
- func (s *BleveServer) DeleteDocument(storeID string, docID string) error
- func (s *BleveServer) DeleteDocuments(storeID string, query *docstore.DocumentQuery) (int, error)
- func (s *BleveServer) PutDocument(storeID string, doc *docstore.Document) error
- func (s *BleveServer) QueryDocuments(storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, error)
- func (s *BleveServer) Reset() error
- type BoltStore
- func (s *BoltStore) DeleteDocument(storeID string, docID string) error
- func (s *BoltStore) GetDocument(storeID string, docId string) (*docstore.Document, error)
- func (s *BoltStore) GetStore(tx *bolt.Tx, storeID string, mode string) (*bolt.Bucket, error)
- func (s *BoltStore) ListDocuments(storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, error)
- func (s *BoltStore) ListStores() ([]string, error)
- func (s *BoltStore) PutDocument(storeID string, doc *docstore.Document) error
- type DAO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BleveServer ¶
type BleveServer struct { boltdb2.DAO // Internal Bolt *BoltStore // Internal Bleve database Engine bleve.Index // For Testing purpose : delete file after closing DeleteOnClose bool // Path to the DB file IndexPath string }
func NewBleveEngine ¶
func NewBleveEngine(dao boltdb2.DAO, deleteOnClose ...bool) (*BleveServer, error)
func (*BleveServer) CloseConn ¶ added in v4.0.1
func (s *BleveServer) CloseConn(ctx context.Context) error
CloseConn overrides internal DAO.CloseConn method to close Bleve index at the same time
func (*BleveServer) CountDocuments ¶
func (s *BleveServer) CountDocuments(storeId string, query *docstore.DocumentQuery) (int, error)
func (*BleveServer) DeleteDocument ¶
func (s *BleveServer) DeleteDocument(storeID string, docID string) error
func (*BleveServer) DeleteDocuments ¶
func (s *BleveServer) DeleteDocuments(storeID string, query *docstore.DocumentQuery) (int, error)
func (*BleveServer) PutDocument ¶
func (s *BleveServer) PutDocument(storeID string, doc *docstore.Document) error
func (*BleveServer) QueryDocuments ¶
func (s *BleveServer) QueryDocuments(storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, error)
func (*BleveServer) Reset ¶
func (s *BleveServer) Reset() error
type BoltStore ¶
type BoltStore struct { // Path to the DB file DbPath string // contains filtered or unexported fields }
func NewBoltStore ¶
func (*BoltStore) DeleteDocument ¶
func (*BoltStore) GetDocument ¶
func (*BoltStore) ListDocuments ¶
func (*BoltStore) ListStores ¶
ListStores list all buckets
type DAO ¶
type DAO interface { dao.DAO PutDocument(storeID string, doc *docstore.Document) error GetDocument(storeID string, docId string) (*docstore.Document, error) DeleteDocument(storeID string, docID string) error DeleteDocuments(storeID string, query *docstore.DocumentQuery) (int, error) QueryDocuments(storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, error) CountDocuments(storeID string, query *docstore.DocumentQuery) (int, error) ListStores() ([]string, error) Reset() error }
Click to show internal directories.
Click to hide internal directories.