Documentation ¶
Overview ¶
Package index is a generated GoMock package.
Index ¶
- Variables
- func IsBatchPartialError(err error) bool
- type Batch
- type BatchError
- type BatchMatcher
- type BatchOption
- type BatchPartialError
- type CompiledRegex
- type DocRetriever
- type IDDocIterator
- type Index
- type MockDocRetriever
- type MockDocRetrieverMockRecorder
- type MockReader
- func (m *MockReader) AllDocs() (IDDocIterator, error)
- func (m *MockReader) Close() error
- func (m *MockReader) Doc(arg0 postings.ID) (doc.Document, error)
- func (m *MockReader) Docs(arg0 postings.List) (doc.Iterator, error)
- func (m *MockReader) EXPECT() *MockReaderMockRecorder
- func (m *MockReader) MatchAll() (postings.MutableList, error)
- func (m *MockReader) MatchRegexp(arg0 []byte, arg1 CompiledRegex) (postings.List, error)
- func (m *MockReader) MatchTerm(arg0, arg1 []byte) (postings.List, error)
- type MockReaderMockRecorder
- func (mr *MockReaderMockRecorder) AllDocs() *gomock.Call
- func (mr *MockReaderMockRecorder) Close() *gomock.Call
- func (mr *MockReaderMockRecorder) Doc(arg0 interface{}) *gomock.Call
- func (mr *MockReaderMockRecorder) Docs(arg0 interface{}) *gomock.Call
- func (mr *MockReaderMockRecorder) MatchAll() *gomock.Call
- func (mr *MockReaderMockRecorder) MatchRegexp(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockReaderMockRecorder) MatchTerm(arg0, arg1 interface{}) *gomock.Call
- type Readable
- type Reader
- type Readers
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ErrDocNotFound = errors.New("no document with given postings ID")
ErrDocNotFound is the error returned when there is no document for a given postings ID.
var ( // ErrDuplicateID is the error returned when a batch contains duplicate IDs. ErrDuplicateID = errors.New("a batch cannot contain duplicate IDs") )
Functions ¶
func IsBatchPartialError ¶
IsBatchPartialError returns a bool indicating whether err is a BatchPartialError or not.
Types ¶
type Batch ¶
type Batch struct { Docs []doc.Document // If AllowPartialUpdates is true the index will continue to index documents in the batch // even if it encounters an error attempting to index a previous document in the batch. // If true, on the other hand, then any errors encountered indexing a document will cause // the entire batch to fail and none of the documents in the batch will be indexed. AllowPartialUpdates bool }
Batch represents a batch of documents that should be inserted into the index.
type BatchError ¶
BatchError is an error that occurred for a document being inserted.
type BatchMatcher ¶
BatchMatcher matches a `Batch`.
func NewBatchMatcher ¶
func NewBatchMatcher(b Batch) BatchMatcher
NewBatchMatcher returns a new BatchMatcher.
type BatchOption ¶
type BatchOption interface {
// contains filtered or unexported methods
}
BatchOption is an option for a Batch.
func AllowPartialUpdates ¶
func AllowPartialUpdates() BatchOption
AllowPartialUpdates permits an index to continue indexing documents in a batch even if it encountered an error inserting a prior document.
type BatchPartialError ¶
type BatchPartialError struct {
// contains filtered or unexported fields
}
BatchPartialError indicates an error was encountered inserting some documents in a batch. It is not safe for concurrent use.
func NewBatchPartialError ¶
func NewBatchPartialError() *BatchPartialError
NewBatchPartialError returns a new BatchPartialError.
func (*BatchPartialError) Add ¶
func (e *BatchPartialError) Add(err BatchError)
Add adds an error to e. Any nil errors are ignored.
func (*BatchPartialError) Error ¶
func (e *BatchPartialError) Error() string
func (*BatchPartialError) Errs ¶
func (e *BatchPartialError) Errs() []BatchError
Errs returns the errors with the indexes of the documents in the batch which were not indexed.
func (*BatchPartialError) FilterDuplicateIDErrors ¶
func (e *BatchPartialError) FilterDuplicateIDErrors() error
FilterDuplicateIDErrors returns a new BatchPartialError (or nil), without any DuplicateIDError(s). NB(prateek): it mutates the order of errors in the original error to avoid allocations.
func (*BatchPartialError) IsEmpty ¶
func (e *BatchPartialError) IsEmpty() bool
IsEmpty returns a bool indicating whether e is empty or not.
type CompiledRegex ¶ added in v0.4.1
type CompiledRegex struct { Simple *regexp.Regexp FST *vregex.Regexp PrefixBegin []byte PrefixEnd []byte }
CompiledRegex is a collection of regexp compiled structs to allow amortisation of regexp construction costs.
func CompileRegex ¶ added in v0.4.4
func CompileRegex(r []byte) (CompiledRegex, error)
CompileRegex compiles the provided regexp into an object that can be used to query the various segment implementations.
type DocRetriever ¶
DocRetriever returns the document associated with a postings ID. It returns ErrDocNotFound if there is no document corresponding to the given postings ID.
type IDDocIterator ¶
IDDocIterator is an extented documents Iterator which can also return the postings ID of the current document.
func NewIDDocIterator ¶
func NewIDDocIterator(r DocRetriever, pi postings.Iterator) IDDocIterator
NewIDDocIterator returns a new NewIDDocIterator.
type Index ¶
type Index interface { Writer // Readers returns a set of readers representing a point-in-time snapshot of the index. Readers() (Readers, error) // Close closes the index and releases any internal resources. Close() error }
Index is a collection of searchable documents.
type MockDocRetriever ¶
type MockDocRetriever struct {
// contains filtered or unexported fields
}
MockDocRetriever is a mock of DocRetriever interface
func NewMockDocRetriever ¶
func NewMockDocRetriever(ctrl *gomock.Controller) *MockDocRetriever
NewMockDocRetriever creates a new mock instance
func (*MockDocRetriever) EXPECT ¶
func (m *MockDocRetriever) EXPECT() *MockDocRetrieverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockDocRetrieverMockRecorder ¶
type MockDocRetrieverMockRecorder struct {
// contains filtered or unexported fields
}
MockDocRetrieverMockRecorder is the mock recorder for MockDocRetriever
func (*MockDocRetrieverMockRecorder) Doc ¶
func (mr *MockDocRetrieverMockRecorder) Doc(arg0 interface{}) *gomock.Call
Doc indicates an expected call of Doc
type MockReader ¶
type MockReader struct {
// contains filtered or unexported fields
}
MockReader is a mock of Reader interface
func NewMockReader ¶
func NewMockReader(ctrl *gomock.Controller) *MockReader
NewMockReader creates a new mock instance
func (*MockReader) AllDocs ¶
func (m *MockReader) AllDocs() (IDDocIterator, error)
AllDocs mocks base method
func (*MockReader) EXPECT ¶
func (m *MockReader) EXPECT() *MockReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockReader) MatchAll ¶
func (m *MockReader) MatchAll() (postings.MutableList, error)
MatchAll mocks base method
func (*MockReader) MatchRegexp ¶
func (m *MockReader) MatchRegexp(arg0 []byte, arg1 CompiledRegex) (postings.List, error)
MatchRegexp mocks base method
type MockReaderMockRecorder ¶
type MockReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockReaderMockRecorder is the mock recorder for MockReader
func (*MockReaderMockRecorder) AllDocs ¶
func (mr *MockReaderMockRecorder) AllDocs() *gomock.Call
AllDocs indicates an expected call of AllDocs
func (*MockReaderMockRecorder) Close ¶
func (mr *MockReaderMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockReaderMockRecorder) Doc ¶
func (mr *MockReaderMockRecorder) Doc(arg0 interface{}) *gomock.Call
Doc indicates an expected call of Doc
func (*MockReaderMockRecorder) Docs ¶
func (mr *MockReaderMockRecorder) Docs(arg0 interface{}) *gomock.Call
Docs indicates an expected call of Docs
func (*MockReaderMockRecorder) MatchAll ¶
func (mr *MockReaderMockRecorder) MatchAll() *gomock.Call
MatchAll indicates an expected call of MatchAll
func (*MockReaderMockRecorder) MatchRegexp ¶
func (mr *MockReaderMockRecorder) MatchRegexp(arg0, arg1 interface{}) *gomock.Call
MatchRegexp indicates an expected call of MatchRegexp
func (*MockReaderMockRecorder) MatchTerm ¶
func (mr *MockReaderMockRecorder) MatchTerm(arg0, arg1 interface{}) *gomock.Call
MatchTerm indicates an expected call of MatchTerm
type Readable ¶
type Readable interface { DocRetriever // MatchTerm returns a postings list over all documents which match the given term. MatchTerm(field, term []byte) (postings.List, error) // MatchRegexp returns a postings list over all documents which match the given // regular expression. MatchRegexp(field []byte, c CompiledRegex) (postings.List, error) // MatchAll returns a postings list for all documents known to the Reader. MatchAll() (postings.MutableList, error) // Docs returns an iterator over the documents whose IDs are in the provided // postings list. Docs(pl postings.List) (doc.Iterator, error) // AllDocs returns an iterator over the documents known to the Reader. AllDocs() (IDDocIterator, error) }
Readable provides a point-in-time accessor to the documents in an index.
type Reader ¶
type Reader interface { Readable // Close closes the reader and releases any internal resources. Close() error }
Reader provides a point-in-time accessor to the documents in an index.
type Writer ¶
type Writer interface { // Insert inserts the given document into the index and returns its ID. The document // is guaranteed to be searchable once the Insert method returns. Insert(d doc.Document) ([]byte, error) // InsertBatch inserts a batch of metrics into the index. The documents are guaranteed // to be searchable all at once when the Batch method returns. If the batch supports // partial updates and any errors are encountered on individual documents then a // BatchPartialError is returned. InsertBatch(b Batch) error }
Writer is used to insert documents into an index.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package segment is a generated GoMock package.
|
Package segment is a generated GoMock package. |
fst
Package fst is a generated GoMock package.
|
Package fst is a generated GoMock package. |
mem
Package mem is a generated GoMock package.
|
Package mem is a generated GoMock package. |