Documentation ¶
Index ¶
- Constants
- Variables
- func NewScorch(storeName string, config map[string]interface{}, ...) (index.Index, error)
- func Rollback(path string, to *RollbackPoint) error
- type DocValueReader
- type Event
- type EventKind
- type IndexSnapshot
- func (i *IndexSnapshot) AddRef()
- func (i *IndexSnapshot) Close() error
- func (i *IndexSnapshot) DecRef() (err error)
- func (i *IndexSnapshot) DocCount() (uint64, error)
- func (i *IndexSnapshot) DocIDReaderAll() (index.DocIDReader, error)
- func (i *IndexSnapshot) DocIDReaderOnly(ids []string) (index.DocIDReader, error)
- func (i *IndexSnapshot) DocValueReader(fields []string) (index.DocValueReader, error)
- func (i *IndexSnapshot) Document(id string) (rv *document.Document, err error)
- func (i *IndexSnapshot) DocumentVisitFieldTerms(id index.IndexInternalID, fields []string, ...) error
- func (i *IndexSnapshot) DumpAll() chan interface{}
- func (i *IndexSnapshot) DumpDoc(id string) chan interface{}
- func (i *IndexSnapshot) DumpFields() chan interface{}
- func (i *IndexSnapshot) ExternalID(id index.IndexInternalID) (string, error)
- func (i *IndexSnapshot) FieldDict(field string) (index.FieldDict, error)
- func (i *IndexSnapshot) FieldDictContains(field string) (index.FieldDictContains, error)
- func (i *IndexSnapshot) FieldDictFuzzy(field string, term string, fuzziness int, prefix string) (index.FieldDict, error)
- func (i *IndexSnapshot) FieldDictOnly(field string, onlyTerms [][]byte, includeCount bool) (index.FieldDict, error)
- func (i *IndexSnapshot) FieldDictPrefix(field string, termPrefix []byte) (index.FieldDict, error)
- func (i *IndexSnapshot) FieldDictRange(field string, startTerm []byte, endTerm []byte) (index.FieldDict, error)
- func (i *IndexSnapshot) FieldDictRegexp(field string, termRegex string) (index.FieldDict, error)
- func (i *IndexSnapshot) Fields() ([]string, error)
- func (i *IndexSnapshot) GetInternal(key []byte) ([]byte, error)
- func (i *IndexSnapshot) Internal() map[string][]byte
- func (i *IndexSnapshot) InternalID(id string) (rv index.IndexInternalID, err error)
- func (i *IndexSnapshot) Segments() []*SegmentSnapshot
- func (i *IndexSnapshot) Size() int
- func (i *IndexSnapshot) TermFieldReader(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (index.TermFieldReader, error)
- type IndexSnapshotDocIDReader
- type IndexSnapshotFieldDict
- func (i *IndexSnapshotFieldDict) Close() error
- func (i *IndexSnapshotFieldDict) Contains(key []byte) (bool, error)
- func (i *IndexSnapshotFieldDict) Len() int
- func (i *IndexSnapshotFieldDict) Less(a, b int) bool
- func (i *IndexSnapshotFieldDict) Next() (*index.DictEntry, error)
- func (i *IndexSnapshotFieldDict) Pop() interface{}
- func (i *IndexSnapshotFieldDict) Push(x interface{})
- func (i *IndexSnapshotFieldDict) Swap(a, b int)
- type IndexSnapshotTermFieldReader
- func (i *IndexSnapshotTermFieldReader) Advance(ID index.IndexInternalID, preAlloced *index.TermFieldDoc) (*index.TermFieldDoc, error)
- func (i *IndexSnapshotTermFieldReader) Close() error
- func (i *IndexSnapshotTermFieldReader) Count() uint64
- func (i *IndexSnapshotTermFieldReader) Next(preAlloced *index.TermFieldDoc) (*index.TermFieldDoc, error)
- func (s *IndexSnapshotTermFieldReader) Optimize(kind string, octx index.OptimizableContext) (index.OptimizableContext, error)
- func (i *IndexSnapshotTermFieldReader) Size() int
- type OptimizeTFRConjunction
- type OptimizeTFRConjunctionUnadorned
- type OptimizeTFRDisjunctionUnadorned
- type RollbackPoint
- type Scorch
- func (s *Scorch) AddEligibleForRemoval(epoch uint64)
- func (s *Scorch) Advanced() (store.KVStore, error)
- func (s *Scorch) Analyze(d *document.Document) *index.AnalysisResult
- func (s *Scorch) Batch(batch *index.Batch) (err error)
- func (s *Scorch) Close() (err error)
- func (s *Scorch) Delete(id string) error
- func (s *Scorch) DeleteInternal(key []byte) error
- func (s *Scorch) LoadSnapshot(epoch uint64) (rv *IndexSnapshot, err error)
- func (s *Scorch) MemoryUsed() (memUsed uint64)
- func (s *Scorch) Open() error
- func (s *Scorch) Reader() (index.IndexReader, error)
- func (s *Scorch) ReportBytesWritten(bytesWritten uint64)
- func (s *Scorch) RootBoltSnapshotEpochs() ([]uint64, error)
- func (s *Scorch) SetInternal(key, val []byte) error
- func (s *Scorch) Stats() json.Marshaler
- func (s *Scorch) StatsMap() map[string]interface{}
- func (s *Scorch) Update(doc *document.Document) error
- type SegmentSnapshot
- func (s *SegmentSnapshot) Close() error
- func (s *SegmentSnapshot) Count() uint64
- func (s *SegmentSnapshot) Deleted() *roaring.Bitmap
- func (s *SegmentSnapshot) DocID(num uint64) ([]byte, error)
- func (s *SegmentSnapshot) DocNumbers(docIDs []string) (*roaring.Bitmap, error)
- func (s *SegmentSnapshot) DocNumbersLive() *roaring.Bitmap
- func (s *SegmentSnapshot) Fields() []string
- func (s *SegmentSnapshot) FullSize() int64
- func (s *SegmentSnapshot) Id() uint64
- func (s SegmentSnapshot) LiveSize() int64
- func (s *SegmentSnapshot) Segment() segment.Segment
- func (s *SegmentSnapshot) Size() (rv int)
- func (s *SegmentSnapshot) VisitDocument(num uint64, visitor segment.DocumentFieldValueVisitor) error
- type Stats
Constants ¶
const Name = "scorch"
const Version uint8 = 2
Variables ¶
var DefaultChunkFactor uint32 = 1024
var DefaultMemoryPressurePauseThreshold uint64 = math.MaxUint64
var DefaultMinSegmentsForInMemoryMerge = 2
DefaultMinSegmentsForInMemoryMerge represents the default number of in-memory zap segments that persistSnapshotMaybeMerge() needs to see in an IndexSnapshot before it decides to merge and persist those segments
var DefaultPersisterNapTimeMSec int = 0 // ms
DefaultPersisterNapTimeMSec is kept to zero as this helps in direct persistence of segments with the default safe batch option. If the default safe batch option results in high number of files on disk, then users may initialise this configuration parameter with higher values so that the persister will nap a bit within it's work loop to favour better in-memory merging of segments to result in fewer segment files on disk. But that may come with an indexing performance overhead. Unsafe batch users are advised to override this to higher value for better performance especially with high data density.
var DefaultPersisterNapUnderNumFiles int = 1000
DefaultPersisterNapUnderNumFiles helps in controlling the pace of persister. At times of a slow merger progress with heavy file merging operations, its better to pace down the persister for letting the merger to catch up within a range defined by this parameter. Fewer files on disk (as per the merge plan) would result in keeping the file handle usage under limit, faster disk merger and a healthier index. Its been observed that such a loosely sync'ed introducer-persister-merger trio results in better overall performance.
var ErrClosed = fmt.Errorf("scorch closed")
var EventKindBatchIntroduction = EventKind(6)
EventKindBatchIntroduction is fired when Batch() completes.
var EventKindBatchIntroductionStart = EventKind(5)
EventKindBatchIntroductionStart is fired when Batch() is invoked which introduces a new segment.
var EventKindClose = EventKind(2)
EventKindClose is fired when a scorch index has been fully closed.
var EventKindCloseStart = EventKind(1)
EventKindCloseStart is fired when a Scorch.Close() has begun.
var EventKindMergerProgress = EventKind(3)
EventKindMergerProgress is fired when the merger has completed a round of merge processing.
var EventKindPersisterProgress = EventKind(4)
EventKindPersisterProgress is fired when the persister has completed a round of persistence processing.
var NumSnapshotsToKeep = 1
NumSnapshotsToKeep represents how many recent, old snapshots to keep around per Scorch instance. Useful for apps that require rollback'ability.
var OptimizeConjunction = true
var OptimizeConjunctionUnadorned = true
var OptimizeDisjunctionUnadorned = true
var OptimizeDisjunctionUnadornedMinChildCardinality = uint64(256)
var OptimizeTFRConjunctionUnadornedField = "*"
var OptimizeTFRConjunctionUnadornedTerm = []byte("<conjunction:unadorned>")
var OptimizeTFRDisjunctionUnadornedField = "*"
var OptimizeTFRDisjunctionUnadornedTerm = []byte("<disjunction:unadorned>")
var RegistryAsyncErrorCallbacks = map[string]func(error){}
RegistryAsyncErrorCallbacks should be treated as read-only after process init()'ialization.
var RegistryEventCallbacks = map[string]func(Event){}
RegistryEventCallbacks should be treated as read-only after process init()'ialization.
var TermSeparator byte = 0xff
var TermSeparatorSplitSlice = []byte{TermSeparator}
Functions ¶
func Rollback ¶
func Rollback(path string, to *RollbackPoint) error
Rollback atomically and durably brings the store back to the point in time as represented by the RollbackPoint. Rollback() should only be passed a RollbackPoint that came from the same store using the RollbackPoints() API along with the index path.
Types ¶
type DocValueReader ¶
type DocValueReader struct {
// contains filtered or unexported fields
}
func (*DocValueReader) VisitDocValues ¶
func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, visitor index.DocumentFieldTermVisitor) (err error)
type IndexSnapshot ¶
type IndexSnapshot struct {
// contains filtered or unexported fields
}
func (*IndexSnapshot) AddRef ¶
func (i *IndexSnapshot) AddRef()
func (*IndexSnapshot) Close ¶
func (i *IndexSnapshot) Close() error
func (*IndexSnapshot) DecRef ¶
func (i *IndexSnapshot) DecRef() (err error)
func (*IndexSnapshot) DocCount ¶
func (i *IndexSnapshot) DocCount() (uint64, error)
func (*IndexSnapshot) DocIDReaderAll ¶
func (i *IndexSnapshot) DocIDReaderAll() (index.DocIDReader, error)
func (*IndexSnapshot) DocIDReaderOnly ¶
func (i *IndexSnapshot) DocIDReaderOnly(ids []string) (index.DocIDReader, error)
func (*IndexSnapshot) DocValueReader ¶
func (i *IndexSnapshot) DocValueReader(fields []string) ( index.DocValueReader, error)
func (*IndexSnapshot) Document ¶
func (i *IndexSnapshot) Document(id string) (rv *document.Document, err error)
func (*IndexSnapshot) DocumentVisitFieldTerms ¶
func (i *IndexSnapshot) DocumentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocumentFieldTermVisitor) error
func (*IndexSnapshot) DumpAll ¶
func (i *IndexSnapshot) DumpAll() chan interface{}
func (*IndexSnapshot) DumpDoc ¶
func (i *IndexSnapshot) DumpDoc(id string) chan interface{}
func (*IndexSnapshot) DumpFields ¶
func (i *IndexSnapshot) DumpFields() chan interface{}
func (*IndexSnapshot) ExternalID ¶
func (i *IndexSnapshot) ExternalID(id index.IndexInternalID) (string, error)
func (*IndexSnapshot) FieldDict ¶
func (i *IndexSnapshot) FieldDict(field string) (index.FieldDict, error)
func (*IndexSnapshot) FieldDictContains ¶
func (i *IndexSnapshot) FieldDictContains(field string) (index.FieldDictContains, error)
func (*IndexSnapshot) FieldDictFuzzy ¶
func (*IndexSnapshot) FieldDictOnly ¶
func (*IndexSnapshot) FieldDictPrefix ¶
func (*IndexSnapshot) FieldDictRange ¶
func (*IndexSnapshot) FieldDictRegexp ¶
func (*IndexSnapshot) Fields ¶
func (i *IndexSnapshot) Fields() ([]string, error)
func (*IndexSnapshot) GetInternal ¶
func (i *IndexSnapshot) GetInternal(key []byte) ([]byte, error)
func (*IndexSnapshot) Internal ¶
func (i *IndexSnapshot) Internal() map[string][]byte
func (*IndexSnapshot) InternalID ¶
func (i *IndexSnapshot) InternalID(id string) (rv index.IndexInternalID, err error)
func (*IndexSnapshot) Segments ¶
func (i *IndexSnapshot) Segments() []*SegmentSnapshot
func (*IndexSnapshot) Size ¶
func (i *IndexSnapshot) Size() int
func (*IndexSnapshot) TermFieldReader ¶
func (i *IndexSnapshot) TermFieldReader(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (index.TermFieldReader, error)
type IndexSnapshotDocIDReader ¶
type IndexSnapshotDocIDReader struct {
// contains filtered or unexported fields
}
func (*IndexSnapshotDocIDReader) Advance ¶
func (i *IndexSnapshotDocIDReader) Advance(ID index.IndexInternalID) (index.IndexInternalID, error)
func (*IndexSnapshotDocIDReader) Close ¶
func (i *IndexSnapshotDocIDReader) Close() error
func (*IndexSnapshotDocIDReader) Next ¶
func (i *IndexSnapshotDocIDReader) Next() (index.IndexInternalID, error)
func (*IndexSnapshotDocIDReader) Size ¶
func (i *IndexSnapshotDocIDReader) Size() int
type IndexSnapshotFieldDict ¶
type IndexSnapshotFieldDict struct {
// contains filtered or unexported fields
}
func (*IndexSnapshotFieldDict) Close ¶
func (i *IndexSnapshotFieldDict) Close() error
func (*IndexSnapshotFieldDict) Contains ¶
func (i *IndexSnapshotFieldDict) Contains(key []byte) (bool, error)
func (*IndexSnapshotFieldDict) Len ¶
func (i *IndexSnapshotFieldDict) Len() int
func (*IndexSnapshotFieldDict) Less ¶
func (i *IndexSnapshotFieldDict) Less(a, b int) bool
func (*IndexSnapshotFieldDict) Next ¶
func (i *IndexSnapshotFieldDict) Next() (*index.DictEntry, error)
func (*IndexSnapshotFieldDict) Pop ¶
func (i *IndexSnapshotFieldDict) Pop() interface{}
func (*IndexSnapshotFieldDict) Push ¶
func (i *IndexSnapshotFieldDict) Push(x interface{})
func (*IndexSnapshotFieldDict) Swap ¶
func (i *IndexSnapshotFieldDict) Swap(a, b int)
type IndexSnapshotTermFieldReader ¶
type IndexSnapshotTermFieldReader struct {
// contains filtered or unexported fields
}
func (*IndexSnapshotTermFieldReader) Advance ¶
func (i *IndexSnapshotTermFieldReader) Advance(ID index.IndexInternalID, preAlloced *index.TermFieldDoc) (*index.TermFieldDoc, error)
func (*IndexSnapshotTermFieldReader) Close ¶
func (i *IndexSnapshotTermFieldReader) Close() error
func (*IndexSnapshotTermFieldReader) Count ¶
func (i *IndexSnapshotTermFieldReader) Count() uint64
func (*IndexSnapshotTermFieldReader) Next ¶
func (i *IndexSnapshotTermFieldReader) Next(preAlloced *index.TermFieldDoc) (*index.TermFieldDoc, error)
func (*IndexSnapshotTermFieldReader) Optimize ¶
func (s *IndexSnapshotTermFieldReader) Optimize(kind string, octx index.OptimizableContext) (index.OptimizableContext, error)
func (*IndexSnapshotTermFieldReader) Size ¶
func (i *IndexSnapshotTermFieldReader) Size() int
type OptimizeTFRConjunction ¶
type OptimizeTFRConjunction struct {
// contains filtered or unexported fields
}
type OptimizeTFRConjunctionUnadorned ¶
type OptimizeTFRConjunctionUnadorned struct {
// contains filtered or unexported fields
}
func (*OptimizeTFRConjunctionUnadorned) Finish ¶
func (o *OptimizeTFRConjunctionUnadorned) Finish() (rv index.Optimized, err error)
Finish of an unadorned conjunction optimization will compute a termFieldReader with an "actual" bitmap that represents the constituent bitmaps AND'ed together. This termFieldReader cannot provide any freq-norm or termVector associated information.
type OptimizeTFRDisjunctionUnadorned ¶
type OptimizeTFRDisjunctionUnadorned struct {
// contains filtered or unexported fields
}
func (*OptimizeTFRDisjunctionUnadorned) Finish ¶
func (o *OptimizeTFRDisjunctionUnadorned) Finish() (rv index.Optimized, err error)
Finish of an unadorned disjunction optimization will compute a termFieldReader with an "actual" bitmap that represents the constituent bitmaps OR'ed together. This termFieldReader cannot provide any freq-norm or termVector associated information.
type RollbackPoint ¶
type RollbackPoint struct {
// contains filtered or unexported fields
}
func RollbackPoints ¶
func RollbackPoints(path string) ([]*RollbackPoint, error)
RollbackPoints returns an array of rollback points available for the application to rollback to, with more recent rollback points (higher epochs) coming first.
func (*RollbackPoint) GetInternal ¶
func (r *RollbackPoint) GetInternal(key []byte) []byte
type Scorch ¶
type Scorch struct {
// contains filtered or unexported fields
}
func (*Scorch) AddEligibleForRemoval ¶
func (*Scorch) DeleteInternal ¶
func (*Scorch) LoadSnapshot ¶
func (s *Scorch) LoadSnapshot(epoch uint64) (rv *IndexSnapshot, err error)
LoadSnapshot loads the segment with the specified epoch NOTE: this is currently ONLY intended to be used by the command-line tool
func (*Scorch) MemoryUsed ¶
func (*Scorch) Reader ¶
func (s *Scorch) Reader() (index.IndexReader, error)
Reader returns a low-level accessor on the index data. Close it to release associated resources.
func (*Scorch) ReportBytesWritten ¶
func (*Scorch) RootBoltSnapshotEpochs ¶
func (*Scorch) SetInternal ¶
type SegmentSnapshot ¶
type SegmentSnapshot struct {
// contains filtered or unexported fields
}
func (*SegmentSnapshot) Close ¶
func (s *SegmentSnapshot) Close() error
func (*SegmentSnapshot) Count ¶
func (s *SegmentSnapshot) Count() uint64
func (*SegmentSnapshot) Deleted ¶
func (s *SegmentSnapshot) Deleted() *roaring.Bitmap
func (*SegmentSnapshot) DocNumbers ¶
func (s *SegmentSnapshot) DocNumbers(docIDs []string) (*roaring.Bitmap, error)
func (*SegmentSnapshot) DocNumbersLive ¶
func (s *SegmentSnapshot) DocNumbersLive() *roaring.Bitmap
DocNumbersLive returns a bitmap containing doc numbers for all live docs
func (*SegmentSnapshot) Fields ¶
func (s *SegmentSnapshot) Fields() []string
func (*SegmentSnapshot) FullSize ¶
func (s *SegmentSnapshot) FullSize() int64
func (*SegmentSnapshot) Id ¶
func (s *SegmentSnapshot) Id() uint64
func (SegmentSnapshot) LiveSize ¶
func (s SegmentSnapshot) LiveSize() int64
func (*SegmentSnapshot) Segment ¶
func (s *SegmentSnapshot) Segment() segment.Segment
func (*SegmentSnapshot) Size ¶
func (s *SegmentSnapshot) Size() (rv int)
func (*SegmentSnapshot) VisitDocument ¶
func (s *SegmentSnapshot) VisitDocument(num uint64, visitor segment.DocumentFieldValueVisitor) error
type Stats ¶
type Stats struct { TotUpdates uint64 TotDeletes uint64 TotBatches uint64 TotBatchesEmpty uint64 TotBatchIntroTime uint64 MaxBatchIntroTime uint64 CurRootEpoch uint64 LastPersistedEpoch uint64 LastMergedEpoch uint64 TotOnErrors uint64 TotAnalysisTime uint64 TotIndexTime uint64 TotIndexedPlainTextBytes uint64 TotTermSearchersStarted uint64 TotTermSearchersFinished uint64 TotIntroduceLoop uint64 TotIntroduceSegmentBeg uint64 TotIntroduceSegmentEnd uint64 TotIntroducePersistBeg uint64 TotIntroducePersistEnd uint64 TotIntroduceMergeBeg uint64 TotIntroduceMergeEnd uint64 TotIntroduceRevertBeg uint64 TotIntroduceRevertEnd uint64 TotIntroducedItems uint64 TotIntroducedSegmentsBatch uint64 TotIntroducedSegmentsMerge uint64 TotPersistLoopBeg uint64 TotPersistLoopErr uint64 TotPersistLoopProgress uint64 TotPersistLoopWait uint64 TotPersistLoopWaitNotified uint64 TotPersistLoopEnd uint64 TotPersistedItems uint64 TotItemsToPersist uint64 TotPersistedSegments uint64 TotPersisterSlowMergerPause uint64 TotPersisterSlowMergerResume uint64 TotPersisterNapPauseCompleted uint64 TotPersisterMergerNapBreak uint64 TotFileMergeLoopBeg uint64 TotFileMergeLoopErr uint64 TotFileMergeLoopEnd uint64 TotFileMergePlan uint64 TotFileMergePlanErr uint64 TotFileMergePlanNone uint64 TotFileMergePlanOk uint64 TotFileMergePlanTasks uint64 TotFileMergePlanTasksDone uint64 TotFileMergePlanTasksErr uint64 TotFileMergePlanTasksSegments uint64 TotFileMergePlanTasksSegmentsEmpty uint64 TotFileMergeSegmentsEmpty uint64 TotFileMergeSegments uint64 TotFileSegmentsAtRoot uint64 TotFileMergeWrittenBytes uint64 TotFileMergeZapBeg uint64 TotFileMergeZapEnd uint64 TotFileMergeZapTime uint64 MaxFileMergeZapTime uint64 TotFileMergeZapIntroductionTime uint64 MaxFileMergeZapIntroductionTime uint64 TotFileMergeIntroductions uint64 TotFileMergeIntroductionsDone uint64 TotFileMergeIntroductionsSkipped uint64 CurFilesIneligibleForRemoval uint64 TotSnapshotsRemovedFromMetaStore uint64 TotMemMergeBeg uint64 TotMemMergeErr uint64 TotMemMergeDone uint64 TotMemMergeZapBeg uint64 TotMemMergeZapEnd uint64 TotMemMergeZapTime uint64 MaxMemMergeZapTime uint64 TotMemMergeSegments uint64 TotMemorySegmentsAtRoot uint64 }
Stats tracks statistics about the index, fields that are prefixed like CurXxxx are gauges (can go up and down), and fields that are prefixed like TotXxxx are monotonically increasing counters.
func (*Stats) MarshalJSON ¶
MarshalJSON implements json.Marshaler, and in contrast to standard json marshaling provides atomic safety
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mergeplan provides a segment merge planning approach that's inspired by Lucene's TieredMergePolicy.java and descriptions like http://blog.mikemccandless.com/2011/02/visualizing-lucenes-segment-merges.html
|
Package mergeplan provides a segment merge planning approach that's inspired by Lucene's TieredMergePolicy.java and descriptions like http://blog.mikemccandless.com/2011/02/visualizing-lucenes-segment-merges.html |