Back to godoc.org

Package docstore

v1.6.1
Latest Go to latest

The latest major version is .

Published: Jul 9, 2019 | License: AGPL-3.0 | Module: github.com/EngineerIG/cells

Overview

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 is also used directly by the php frontend to store and retrieve some specific data.

It uses a combination of Bolt for storage and Bleve for indexation.

Index

type BleveServer

type BleveServer struct {
	// 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(bleveIndexPath string, deleteOnClose ...bool) (*BleveServer, error)

func (*BleveServer) Close

func (s *BleveServer) Close() error

func (*BleveServer) DeleteDocument

func (s *BleveServer) DeleteDocument(storeID string, docID string) error

func (*BleveServer) IndexDocument

func (s *BleveServer) IndexDocument(storeID string, doc *docstore.Document) error

func (*BleveServer) Reset

func (s *BleveServer) Reset() error

func (*BleveServer) SearchDocuments

func (s *BleveServer) SearchDocuments(storeID string, query *docstore.DocumentQuery, countOnly bool) ([]string, int64, error)

type BoltStore

type BoltStore struct {

	// For Testing purpose : delete file after closing
	DeleteOnClose bool
	// Path to the DB file
	DbPath string
	// contains filtered or unexported fields
}

func NewBoltStore

func NewBoltStore(fileName string, deleteOnClose ...bool) (*BoltStore, error)

func (*BoltStore) Close

func (b *BoltStore) Close() error

func (*BoltStore) DeleteDocument

func (s *BoltStore) DeleteDocument(storeID string, docID string) error

func (*BoltStore) GetDocument

func (s *BoltStore) GetDocument(storeID string, docId string) (*docstore.Document, error)

func (*BoltStore) GetStore

func (s *BoltStore) GetStore(tx *bolt.Tx, storeID string, mode string) (*bolt.Bucket, error)

func (*BoltStore) ListDocuments

func (s *BoltStore) ListDocuments(storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, chan bool, error)

func (*BoltStore) ListStores

func (s *BoltStore) ListStores() ([]string, error)

ListStores list all buckets

func (*BoltStore) PutDocument

func (s *BoltStore) PutDocument(storeID string, doc *docstore.Document) error

type Indexer

type Indexer interface {
	IndexDocument(storeID string, doc *docstore.Document) error
	DeleteDocument(storeID string, docID string) error
	SearchDocuments(storeID string, query *docstore.DocumentQuery, countOnly bool) ([]string, int64, error)
	Reset() error
	Close() error
}

type Store

type Store interface {
	PutDocument(storeID string, doc *docstore.Document) error
	GetDocument(storeID string, docId string) (*docstore.Document, error)
	DeleteDocument(storeID string, docID string) error
	ListDocuments(storeID string, query *docstore.DocumentQuery) (chan *docstore.Document, chan bool, error)
	ListStores() ([]string, error)
	Close() error
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier