Documentation
¶
Index ¶
- Constants
- func LoadMMapAlways(f lock.LockedFile) (*segment.Data, io.Closer, error)
- func LoadMMapNever(f lock.LockedFile) (*segment.Data, io.Closer, error)
- type Batch
- type Config
- func (config Config) DisableOptimizeConjunction() Config
- func (config Config) DisableOptimizeConjunctionUnadorned() Config
- func (config Config) DisableOptimizeDisjunctionUnadorned() Config
- func (config Config) WithNormCalc(calc func(field string, numTerms int) float32) Config
- func (config Config) WithPersisterNapTimeMSec(napTime int) Config
- func (config Config) WithSegmentPlugin(plugin *SegmentPlugin) Config
- func (config Config) WithSegmentType(typ string) Config
- func (config Config) WithSegmentVersion(ver uint32) Config
- func (config Config) WithUnsafeBatches() Config
- func (config Config) WithVirtualField(field segment.Field) Config
- type DeletionPolicy
- type Directory
- type Event
- type FileSystemDirectory
- func (d *FileSystemDirectory) List(kind string) ([]uint64, error)
- func (d *FileSystemDirectory) Load(kind string, id uint64) (*segment.Data, io.Closer, error)
- func (d *FileSystemDirectory) Lock() error
- func (d *FileSystemDirectory) Persist(kind string, id uint64, w WriterTo, closeCh chan struct{}) error
- func (d *FileSystemDirectory) Remove(kind string, id uint64) error
- func (d *FileSystemDirectory) SetLoadMMapFunc(f LoadMMapFunc)
- func (d *FileSystemDirectory) Setup(readOnly bool) error
- func (d *FileSystemDirectory) Stats() (numFilesOnDisk, numBytesUsedDisk uint64)
- func (d *FileSystemDirectory) Sync() error
- func (d *FileSystemDirectory) Unlock() error
- type InMemoryDirectory
- func (d *InMemoryDirectory) List(kind string) ([]uint64, error)
- func (d *InMemoryDirectory) Load(kind string, id uint64) (*segment.Data, io.Closer, error)
- func (d *InMemoryDirectory) Lock() error
- func (d *InMemoryDirectory) Persist(kind string, id uint64, w WriterTo, closeCh chan struct{}) error
- func (d *InMemoryDirectory) Remove(kind string, id uint64) error
- func (d *InMemoryDirectory) Setup(readOnly bool) error
- func (d *InMemoryDirectory) Stats() (numItems, numBytes uint64)
- func (d *InMemoryDirectory) Sync() error
- func (d *InMemoryDirectory) Unlock() error
- type KeepNLatestDeletionPolicy
- type LoadMMapFunc
- type SegmentPlugin
- type SegmentSnapshot
- type Snapshot
- func (i *Snapshot) Backup(remote Directory, cancel chan struct{}) error
- func (i *Snapshot) Close() error
- func (i *Snapshot) CollectionStats(field string) (segment.CollectionStats, error)
- func (i *Snapshot) Count() (uint64, error)
- func (i *Snapshot) DictionaryIterator(field string, automaton segment.Automaton, start, end []byte) (segment.DictionaryIterator, error)
- func (i *Snapshot) DictionaryLookup(field string) (segment.DictionaryLookup, error)
- func (i *Snapshot) DocumentValueReader(fields []string) (segment.DocumentValueReader, error)
- func (i *Snapshot) Fields() ([]string, error)
- func (i *Snapshot) PostingsIterator(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (segment.PostingsIterator, error)
- func (i *Snapshot) ReadFrom(r io.Reader) (int64, error)
- func (i *Snapshot) Segments() []SegmentSnapshot
- func (i *Snapshot) Size() int
- func (i *Snapshot) VisitStoredFields(number uint64, visitor segment.StoredFieldVisitor) error
- func (i *Snapshot) WriteTo(w io.Writer, _ chan struct{}) (int64, error)
- type Stats
- type Writer
- type WriterOffline
- type WriterTo
Constants ¶
View Source
const ( ItemKindSnapshot = ".snp" ItemKindSegment = ".seg" )
Kinds of items managed by a Directory
View Source
const ( EventKindCloseStart = 1 // when the index has started to close EventKindClose = 2 // when the index has been fully closed EventKindMergerProgress = 3 // when the index has completed a round of merge operations EventKindPersisterProgress = 4 // when the index has completed a round of persistence operations EventKindBatchIntroductionStart = 5 // when the index has started to introduce a new batch EventKindBatchIntroduction = 6 // when index has finished introducing a batch EventKindMergeTaskIntroductionStart = 7 // when the index has started to introduce a merge EventKindMergeTaskIntroduction = 8 // when the index has finished introdocing a merge )
Kinds of index events
Variables ¶
This section is empty.
Functions ¶
func LoadMMapAlways ¶ added in v0.1.6
func LoadMMapNever ¶ added in v0.1.6
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
func (*Batch) PersistedCallback ¶
func (*Batch) SetPersistedCallback ¶
type Config ¶
type Config struct {
SegmentType string
SegmentVersion uint32
UnsafeBatch bool
EventCallback func(Event)
AsyncError func(error)
MergePlanOptions mergeplan.Options
NumAnalysisWorkers int
AnalysisChan chan func()
GoFunc func(func())
DeletionPolicyFunc func() DeletionPolicy
DirectoryFunc func() Directory
NormCalc func(string, int) float32
MergeBufferSize int
// Optimizations
OptimizeConjunction bool
OptimizeConjunctionUnadorned bool
OptimizeDisjunctionUnadorned bool
// MinSegmentsForInMemoryMerge represents the number of
// in-memory zap segments that persistSnapshotMaybeMerge() needs to
// see in an Snapshot before it decides to merge and persist
// those segments
MinSegmentsForInMemoryMerge int
// PersisterNapTimeMSec controls the wait/delay injected into
// persistence workloop to improve the chances for
// a healthier and heavier in-memory merging
PersisterNapTimeMSec int
// PersisterNapTimeMSec > 0, and the number of files is less than
// PersisterNapUnderNumFiles, then the persister will sleep
// PersisterNapTimeMSec amount of time to improve the chances for
// a healthier and heavier in-memory merging
PersisterNapUnderNumFiles int
// MemoryPressurePauseThreshold let persister to have a better leeway
// for prudently performing the memory merge of segments on a memory
// pressure situation. Here the config value is an upper threshold
// for the number of paused application threads. The default value would
// be a very high number to always favor the merging of memory segments.
MemoryPressurePauseThreshold int
ValidateSnapshotCRC bool
// contains filtered or unexported fields
}
func DefaultConfig ¶
func DefaultConfigWithDirectory ¶ added in v0.1.3
func InMemoryOnlyConfig ¶
func InMemoryOnlyConfig() Config
func (Config) DisableOptimizeConjunction ¶
func (Config) DisableOptimizeConjunctionUnadorned ¶
func (Config) DisableOptimizeDisjunctionUnadorned ¶
func (Config) WithNormCalc ¶
func (Config) WithPersisterNapTimeMSec ¶
func (Config) WithSegmentPlugin ¶
func (config Config) WithSegmentPlugin(plugin *SegmentPlugin) Config
func (Config) WithSegmentType ¶
func (Config) WithSegmentVersion ¶
func (Config) WithUnsafeBatches ¶
type DeletionPolicy ¶
type Directory ¶
type Directory interface {
// Setup is called first, allowing a directory to
// perform additional set up, or return an error
// indicating this directory cannot be used
Setup(readOnly bool) error
// List the ids of all the items of the specified kind
// Items are returned in descending order by id
List(kind string) ([]uint64, error)
// Load the specified item
// Item data is accessible via the returned *segment.Data structure
// A io.Closer is returned, which must be called to release
// resources held by this open item.
// NOTE: care must be taken to handle a possible nil io.Closer
Load(kind string, id uint64) (*segment.Data, io.Closer, error)
// Persist a new item with data from the provided WriterTo
// Implementations should monitor the closeCh and return with error
// in the event it is closed before completion.
Persist(kind string, id uint64, w WriterTo, closeCh chan struct{}) error
// Remove the specified item
Remove(kind string, id uint64) error
// Stats returns total number of items and their cumulative size
Stats() (numItems uint64, numBytes uint64)
// Sync ensures directory metadata itself has been committed
Sync() error
// Lock ensures this process has exclusive access to write in this directory
Lock() error
// Unlock releases the lock held on this directory
Unlock() error
}
Directory abstracts over a collection of items An item has a kind (string) and an id (uint64)
type FileSystemDirectory ¶
type FileSystemDirectory struct {
// contains filtered or unexported fields
}
func NewFileSystemDirectory ¶
func NewFileSystemDirectory(path string) *FileSystemDirectory
func (*FileSystemDirectory) List ¶
func (d *FileSystemDirectory) List(kind string) ([]uint64, error)
func (*FileSystemDirectory) Lock ¶
func (d *FileSystemDirectory) Lock() error
func (*FileSystemDirectory) Persist ¶
func (d *FileSystemDirectory) Persist(kind string, id uint64, w WriterTo, closeCh chan struct{}) error
func (*FileSystemDirectory) Remove ¶
func (d *FileSystemDirectory) Remove(kind string, id uint64) error
func (*FileSystemDirectory) SetLoadMMapFunc ¶ added in v0.1.6
func (d *FileSystemDirectory) SetLoadMMapFunc(f LoadMMapFunc)
func (*FileSystemDirectory) Setup ¶
func (d *FileSystemDirectory) Setup(readOnly bool) error
func (*FileSystemDirectory) Stats ¶
func (d *FileSystemDirectory) Stats() (numFilesOnDisk, numBytesUsedDisk uint64)
func (*FileSystemDirectory) Sync ¶
func (d *FileSystemDirectory) Sync() error
func (*FileSystemDirectory) Unlock ¶
func (d *FileSystemDirectory) Unlock() error
type InMemoryDirectory ¶
type InMemoryDirectory struct {
// contains filtered or unexported fields
}
func NewInMemoryDirectory ¶
func NewInMemoryDirectory() *InMemoryDirectory
func (*InMemoryDirectory) Lock ¶
func (d *InMemoryDirectory) Lock() error
func (*InMemoryDirectory) Persist ¶
func (d *InMemoryDirectory) Persist(kind string, id uint64, w WriterTo, closeCh chan struct{}) error
func (*InMemoryDirectory) Setup ¶
func (d *InMemoryDirectory) Setup(readOnly bool) error
func (*InMemoryDirectory) Stats ¶
func (d *InMemoryDirectory) Stats() (numItems, numBytes uint64)
func (*InMemoryDirectory) Sync ¶
func (d *InMemoryDirectory) Sync() error
func (*InMemoryDirectory) Unlock ¶
func (d *InMemoryDirectory) Unlock() error
type KeepNLatestDeletionPolicy ¶
type KeepNLatestDeletionPolicy struct {
// contains filtered or unexported fields
}
func NewKeepNLatestDeletionPolicy ¶
func NewKeepNLatestDeletionPolicy(n int) *KeepNLatestDeletionPolicy
func (*KeepNLatestDeletionPolicy) Cleanup ¶
func (p *KeepNLatestDeletionPolicy) Cleanup(dir Directory) error
func (*KeepNLatestDeletionPolicy) Commit ¶
func (p *KeepNLatestDeletionPolicy) Commit(snapshot *Snapshot)
type LoadMMapFunc ¶ added in v0.1.6
type SegmentPlugin ¶
type SegmentSnapshot ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func OpenReader ¶
func (*Snapshot) CollectionStats ¶
func (i *Snapshot) CollectionStats(field string) (segment.CollectionStats, error)
func (*Snapshot) DictionaryIterator ¶
func (*Snapshot) DictionaryLookup ¶
func (i *Snapshot) DictionaryLookup(field string) (segment.DictionaryLookup, error)
func (*Snapshot) DocumentValueReader ¶
func (i *Snapshot) DocumentValueReader(fields []string) ( segment.DocumentValueReader, error)
func (*Snapshot) PostingsIterator ¶
func (*Snapshot) Segments ¶
func (i *Snapshot) Segments() []SegmentSnapshot
func (*Snapshot) VisitStoredFields ¶
func (i *Snapshot) VisitStoredFields(number uint64, visitor segment.StoredFieldVisitor) 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
TotFileMergeIntroductionsObsoleted uint64
CurFilesIneligibleForRemoval uint64
TotSnapshotsRemovedFromMetaStore uint64
TotMemMergeBeg uint64
TotMemMergeErr uint64
TotMemMergeDone uint64
TotMemMergeZapBeg uint64
TotMemMergeZapEnd uint64
TotMemMergeZapTime uint64
MaxMemMergeZapTime uint64
TotMemMergeSegments uint64
TotMemorySegmentsAtRoot uint64
TotEventFired uint64
TotEventReturned uint64
CurOnDiskBytes uint64
CurOnDiskBytesUsedByRoot uint64 // FIXME not currently supported
CurOnDiskFiles uint64
// contains filtered or unexported fields
}
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.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func OpenWriter ¶
func (*Writer) MemoryUsed ¶
type WriterOffline ¶
type WriterOffline struct {
// contains filtered or unexported fields
}
func OpenOfflineWriter ¶
func OpenOfflineWriter(config Config) (writer *WriterOffline, err error)
func (*WriterOffline) Batch ¶
func (s *WriterOffline) Batch(batch *Batch) (err error)
func (*WriterOffline) Close ¶
func (s *WriterOffline) Close() error
Source Files
¶
- batch.go
- communication.go
- config.go
- count.go
- deletion.go
- dictionary.go
- directory.go
- directory_fs.go
- directory_fs_nix.go
- directory_mem.go
- empty.go
- event.go
- introducer.go
- merge.go
- optimize.go
- persister.go
- postings.go
- postings_all.go
- segment.go
- segment_plugin.go
- sizes.go
- snapshot.go
- stats.go
- unadorned.go
- writer.go
- writer_offline.go
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 |
Click to show internal directories.
Click to hide internal directories.