engine

package
v0.0.0-...-7b3ddb2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

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
	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 RTReader

type RTReader interface {
	RTReadDoc(ctx context.Context, docID string) *response.DocResult
}

RTReader is a real time reader, only used by ps or engine for update document

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

	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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL