Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
Reader() Reader
RTReader() RTReader
Writer() Writer
//return three value, field to pspb.Field , new Schema info , error
MapDocument(doc *pspb.DocCmd) ([]*pspb.Field, map[string]pspb.FieldType, error)
NewSnapshot() (proto.Snapshot, error)
ApplySnapshot(peers []proto.Peer, iter proto.SnapIterator) error
Optimize() error
IndexStatus() int
Close()
UpdateMapping(space *entity.Space) error
GetMapping() *mapping.IndexMapping
GetSpace() *entity.Space
GetPartitionID() entity.PartitionID
}
Engine is the interface that wraps the core operations of a document store.
type Reader ¶
type Reader interface {
GetDoc(ctx context.Context, docID string) *response.DocResult
GetDocs(ctx context.Context, docIDs []string) []*response.DocResult
Search(ctx context.Context, req *request.SearchRequest) *response.SearchResponse
MSearchIDs(ctx context.Context, request *request.SearchRequest) ([]byte, error)
MSearch(ctx context.Context, request *request.SearchRequest) response.SearchResponses
//you can use ctx to cancel the stream , when this function returned will close resultChan
StreamSearch(ctx context.Context, req *request.SearchRequest, resultChan chan *response.DocResult) error
ReadSN(ctx context.Context) (int64, error)
DocCount(ctx context.Context) (uint64, error)
Capacity(ctx context.Context) (int64, error)
}
Reader is the read interface to an engine's data.
type Writer ¶
type Writer interface {
// use do by single cmd , support create update replace or delete
Write(ctx context.Context, docCmd *pspb.DocCmd) *response.DocResult
// if you not set id , suggest use it to create
Create(ctx context.Context, docCmd *pspb.DocCmd) *response.DocResult
//this update will merge documents
Update(ctx context.Context, docCmd *pspb.DocCmd) *response.DocResult
//delete documents
Delete(ctx context.Context, docCmd *pspb.DocCmd) *response.DocResult
// flush memory to segment, new reader will read the newest data
Flush(ctx context.Context, sn int64) error
// commit is renew a memory block, return a chan to client, client get the chan to wait the old memory flush to segment
Commit(ctx context.Context, sn int64) (chan error, error)
}
Writer is the write interface to an engine's data.
Click to show internal directories.
Click to hide internal directories.