Documentation ¶
Overview ¶
Series:
╔══════Series List═════╗ ║ ┌───────────────────┐║ ║ │ Term List │║ ║ ├───────────────────┤║ ║ │ Series Data │║ ║ ├───────────────────┤║ ║ │ Trailer │║ ║ └───────────────────┘║ ╚══════════════════════╝ ╔══════════Term List═══════════╗ ║ ┌──────────────────────────┐ ║ ║ │ Term Count <uint32> │ ║ ║ └──────────────────────────┘ ║ ║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ║ ║ ┃ ┌──────────────────────┐ ┃ ║ ║ ┃ │ len(Term) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Term <byte...> │ ┃ ║ ║ ┃ └──────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ║ ║ ┃ ┌──────────────────────┐ ┃ ║ ║ ┃ │ len(Term) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Term <byte...> │ ┃ ║ ║ ┃ └──────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ╚══════════════════════════════╝ ╔═════════Series Data══════════╗ ║ ┌──────────────────────────┐ ║ ║ │ Series Count <uint32> │ ║ ║ └──────────────────────────┘ ║ ║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ║ ║ ┃ ┌──────────────────────┐ ┃ ║ ║ ┃ │ Flag <uint8> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ len(Series) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Series <byte...> │ ┃ ║ ║ ┃ └──────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ... ║ ╚══════════════════════════════╝ ╔════════════Trailer══════════════╗ ║ ┌─────────────────────────────┐ ║ ║ │ Term List Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Term List Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Series Data Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Series Data Pos <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Sketch Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Sketch Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Tomb Sketch Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Tomb Sketch Size <uint64> │ ║ ║ └─────────────────────────────┘ ║ ╚═════════════════════════════════╝
Tag Block:
╔═══════Tag Block════════╗ ║┌──────────────────────┐║ ║│ Tag Values Block │║ ║├──────────────────────┤║ ║│ ... │║ ║├──────────────────────┤║ ║│ Tag Keys Block │║ ║├──────────────────────┤║ ║│ Trailer │║ ║└──────────────────────┘║ ╚════════════════════════╝ ╔═══════Tag Values Block═══════╗ ║ ║ ║ ┏━━━━━━━━Value List━━━━━━━━┓ ║ ║ ┃ ┃ ║ ║ ┃┏━━━━━━━━━Value━━━━━━━━━━┓┃ ║ ║ ┃┃┌──────────────────────┐┃┃ ║ ║ ┃┃│ Flag <uint8> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│ len(Value) <varint> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│ Value <byte...> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│ len(Series) <varint> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│SeriesIDs <uint32...> │┃┃ ║ ║ ┃┃└──────────────────────┘┃┃ ║ ║ ┃┗━━━━━━━━━━━━━━━━━━━━━━━━┛┃ ║ ║ ┃ ... ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━Hash Index━━━━━━━━┓ ║ ║ ┃ ┌──────────────────────┐ ┃ ║ ║ ┃ │ len(Values) <uint32> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │Value Offset <uint64> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ ... │ ┃ ║ ║ ┃ └──────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ╚══════════════════════════════╝ ╔════════Tag Key Block═════════╗ ║ ║ ║ ┏━━━━━━━━━Key List━━━━━━━━━┓ ║ ║ ┃ ┃ ║ ║ ┃┏━━━━━━━━━━Key━━━━━━━━━━━┓┃ ║ ║ ┃┃┌──────────────────────┐┃┃ ║ ║ ┃┃│ Flag <uint8> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│Value Offset <uint64> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│ len(Key) <varint> │┃┃ ║ ║ ┃┃├──────────────────────┤┃┃ ║ ║ ┃┃│ Key <byte...> │┃┃ ║ ║ ┃┃└──────────────────────┘┃┃ ║ ║ ┃┗━━━━━━━━━━━━━━━━━━━━━━━━┛┃ ║ ║ ┃ ... ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━Hash Index━━━━━━━━┓ ║ ║ ┃ ┌──────────────────────┐ ┃ ║ ║ ┃ │ len(Keys) <uint32> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Key Offset <uint64> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ ... │ ┃ ║ ║ ┃ └──────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ╚══════════════════════════════╝ ╔════════════Trailer══════════════╗ ║ ┌─────────────────────────────┐ ║ ║ │ Hash Index Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Tag Set Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Tag Set Version <uint16> │ ║ ║ └─────────────────────────────┘ ║ ╚═════════════════════════════════╝
Measurements
╔══════════Measurements Block═══════════╗ ║ ║ ║ ┏━━━━━━━━━Measurement List━━━━━━━━━━┓ ║ ║ ┃ ┃ ║ ║ ┃┏━━━━━━━━━━Measurement━━━━━━━━━━━┓ ┃ ║ ║ ┃┃┌─────────────────────────────┐ ┃ ┃ ║ ║ ┃┃│ Flag <uint8> │ ┃ ┃ ║ ║ ┃┃├─────────────────────────────┤ ┃ ┃ ║ ║ ┃┃│ Tag Block Offset <uint64> │ ┃ ┃ ║ ║ ┃┃├─────────────────────────────┤ ┃ ┃ ║ ║ ┃┃│ len(Name) <varint> │ ┃ ┃ ║ ║ ┃┃├─────────────────────────────┤ ┃ ┃ ║ ║ ┃┃│ Name <byte...> │ ┃ ┃ ║ ║ ┃┃├─────────────────────────────┤ ┃ ┃ ║ ║ ┃┃│ len(Series) <uint32> │ ┃ ┃ ║ ║ ┃┃├─────────────────────────────┤ ┃ ┃ ║ ║ ┃┃│ SeriesIDs <uint32...> │ ┃ ┃ ║ ║ ┃┃└─────────────────────────────┘ ┃ ┃ ║ ║ ┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ ║ ║ ┃ ... ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━━━━━Hash Index━━━━━━━━━━━━━┓ ║ ║ ┃ ┌───────────────────────────────┐ ┃ ║ ║ ┃ │ len(Measurements) <uint32> │ ┃ ║ ║ ┃ ├───────────────────────────────┤ ┃ ║ ║ ┃ │ Measurement Offset <uint64> │ ┃ ║ ║ ┃ ├───────────────────────────────┤ ┃ ║ ║ ┃ │ ... │ ┃ ║ ║ ┃ └───────────────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ║ ║ ┃ Sketch ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ║ ║ ┃ Tombstone Sketch ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ║ ║ ┃ Trailer ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ╚═══════════════════════════════════════╝ ╔════════════Trailer══════════════╗ ║ ┌─────────────────────────────┐ ║ ║ │ Block Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Block Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Hash Index Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Hash Index Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Sketch Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Sketch Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Tomb Sketch Offset <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Tomb Sketch Size <uint64> │ ║ ║ ├─────────────────────────────┤ ║ ║ │ Block Version <uint16> │ ║ ║ └─────────────────────────────┘ ║ ╚═════════════════════════════════╝
WAL
╔═════════════WAL══════════════╗ ║ ║ ║ ┏━━━━━━━━━━Entry━━━━━━━━━━━┓ ║ ║ ┃ ┌──────────────────────┐ ┃ ║ ║ ┃ │ Flag <uint8> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ len(Name) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Name <byte...> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ len(Tags) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ len(Key0) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Key0 <byte...> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ len(Value0) <varint> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Value0 <byte...> │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ ... │ ┃ ║ ║ ┃ ├──────────────────────┤ ┃ ║ ║ ┃ │ Checksum <uint32> │ ┃ ║ ║ ┃ └──────────────────────┘ ┃ ║ ║ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ║ ║ ... ║ ╚══════════════════════════════╝
Index ¶
- Constants
- Variables
- func AppendSeriesElem(dst []byte, flag byte, name []byte, tags models.Tags) []byte
- func AppendSeriesKey(dst []byte, name []byte, tags models.Tags) []byte
- func CompareSeriesElem(a, b SeriesElem) int
- func CompareSeriesKeys(a, b []byte) int
- func FormatIndexFileName(i int) string
- func FormatLogFileName(i int) string
- func ParseFileID(name string) int
- func ReadSeriesKey(data []byte) []byte
- func SeriesElemKey(e SeriesElem) []byte
- func WriteManifestFile(path string, m *Manifest) error
- type File
- type FileSet
- func (fs FileSet) FilterNamesTags(names [][]byte, tagsSlice []models.Tags) ([][]byte, []models.Tags)
- func (fs FileSet) HasSeries(name []byte, tags models.Tags, buf []byte) bool
- func (fs FileSet) HasTagKey(name, key []byte) bool
- func (fs FileSet) HasTagValue(name, key, value []byte) bool
- func (fs FileSet) IndexFiles() []*IndexFile
- func (fs FileSet) LogFiles() []*LogFile
- func (fs FileSet) MatchTagValueSeriesIterator(name, key []byte, value *regexp.Regexp, matches bool) SeriesIterator
- func (fs FileSet) MaxID() int
- func (fs FileSet) Measurement(name []byte) MeasurementElem
- func (fs FileSet) MeasurementIterator() MeasurementIterator
- func (fs FileSet) MeasurementNamesByExpr(expr influxql.Expr) ([][]byte, error)
- func (fs FileSet) MeasurementSeriesByExprIterator(name []byte, expr influxql.Expr, fieldset *tsdb.MeasurementFieldSet) (SeriesIterator, error)
- func (fs FileSet) MeasurementSeriesIterator(name []byte) SeriesIterator
- func (fs FileSet) MeasurementSeriesKeysByExpr(name []byte, expr influxql.Expr, fieldset *tsdb.MeasurementFieldSet) ([][]byte, error)
- func (fs FileSet) MeasurementTagKeysByExpr(name []byte, expr influxql.Expr) (map[string]struct{}, error)
- func (fs FileSet) MeasurementsSketches() (estimator.Sketch, estimator.Sketch, error)
- func (p FileSet) MustReplace(oldFiles []File, newFile File) FileSet
- func (p FileSet) Release()
- func (p FileSet) Retain()
- func (fs FileSet) SeriesIterator() SeriesIterator
- func (fs FileSet) SeriesSketches() (estimator.Sketch, estimator.Sketch, error)
- func (fs FileSet) TagKeyIterator(name []byte) TagKeyIterator
- func (fs FileSet) TagKeySeriesIterator(name, key []byte) SeriesIterator
- func (fs FileSet) TagValueIterator(name, key []byte) TagValueIterator
- func (fs FileSet) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
- type Index
- func (i *Index) AssignShard(k string, shardID uint64)
- func (i *Index) CheckLogFile() error
- func (i *Index) Close() error
- func (i *Index) Compact()
- func (i *Index) CreateSeriesIfNotExists(key, name []byte, tags models.Tags) error
- func (i *Index) CreateSeriesListIfNotExists(_, names [][]byte, tagsSlice []models.Tags) error
- func (i *Index) DropMeasurement(name []byte) error
- func (i *Index) DropSeries(key []byte) error
- func (i *Index) FileN() int
- func (i *Index) ForEachMeasurementName(fn func(name []byte) error) error
- func (i *Index) ForEachMeasurementSeriesByExpr(name []byte, condition influxql.Expr, fn func(tags models.Tags) error) error
- func (i *Index) ForEachMeasurementTagKey(name []byte, fn func(key []byte) error) error
- func (i *Index) HasTagKey(name, key []byte) (bool, error)
- func (i *Index) InitializeSeries(key, name []byte, tags models.Tags) error
- func (i *Index) Manifest() *Manifest
- func (i *Index) ManifestPath() string
- func (i *Index) MeasurementExists(name []byte) (bool, error)
- func (i *Index) MeasurementNamesByExpr(expr influxql.Expr) ([][]byte, error)
- func (i *Index) MeasurementNamesByRegex(re *regexp.Regexp) ([][]byte, error)
- func (i *Index) MeasurementSeriesKeysByExpr(name []byte, expr influxql.Expr) ([][]byte, error)
- func (i *Index) MeasurementTagKeysByExpr(name []byte, expr influxql.Expr) (map[string]struct{}, error)
- func (i *Index) MeasurementsSketches() (estimator.Sketch, estimator.Sketch, error)
- func (i *Index) NextSequence() int
- func (i *Index) Open() error
- func (i *Index) RemoveShard(shardID uint64)
- func (i *Index) RetainFileSet() FileSet
- func (i *Index) SeriesN() int64
- func (i *Index) SeriesPointIterator(opt influxql.IteratorOptions) (influxql.Iterator, error)
- func (i *Index) SeriesSketches() (estimator.Sketch, estimator.Sketch, error)
- func (i *Index) SetFieldName(measurement, name string)
- func (i *Index) SetFieldSet(fs *tsdb.MeasurementFieldSet)
- func (i *Index) SnapshotTo(path string) error
- func (i *Index) TagKeyCardinality(name, key []byte) int
- func (i *Index) TagSets(name []byte, opt influxql.IteratorOptions) ([]*influxql.TagSet, error)
- func (i *Index) Type() string
- func (i *Index) UnassignShard(k string, shardID uint64) error
- type IndexFile
- func (f *IndexFile) Close() error
- func (f *IndexFile) Compacting() bool
- func (f *IndexFile) HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool)
- func (f *IndexFile) Measurement(name []byte) MeasurementElem
- func (f *IndexFile) MeasurementIterator() MeasurementIterator
- func (f *IndexFile) MeasurementSeriesIterator(name []byte) SeriesIterator
- func (f *IndexFile) MergeMeasurementsSketches(s, t estimator.Sketch) error
- func (f *IndexFile) MergeSeriesSketches(s, t estimator.Sketch) error
- func (f *IndexFile) Open() error
- func (f *IndexFile) Path() string
- func (f *IndexFile) Release()
- func (f *IndexFile) Retain()
- func (f *IndexFile) Series(name []byte, tags models.Tags) SeriesElem
- func (f *IndexFile) SeriesIterator() SeriesIterator
- func (f *IndexFile) SeriesN() uint64
- func (f *IndexFile) SetPath(path string)
- func (f *IndexFile) Size() int64
- func (f *IndexFile) TagKey(name, key []byte) TagKeyElem
- func (f *IndexFile) TagKeyIterator(name []byte) TagKeyIterator
- func (f *IndexFile) TagKeySeriesIterator(name, key []byte) SeriesIterator
- func (f *IndexFile) TagValue(name, key, value []byte) TagValueElem
- func (f *IndexFile) TagValueElem(name, key, value []byte) TagValueElem
- func (f *IndexFile) TagValueIterator(name, key []byte) TagValueIterator
- func (f *IndexFile) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
- func (f *IndexFile) UnmarshalBinary(data []byte) error
- type IndexFileTrailer
- type IndexFiles
- func (p IndexFiles) Files() []File
- func (p IndexFiles) IDs() []int
- func (p IndexFiles) MeasurementIterator() MeasurementIterator
- func (p *IndexFiles) MeasurementNames() [][]byte
- func (p IndexFiles) MeasurementSeriesIterator(name []byte) SeriesIterator
- func (p IndexFiles) Release()
- func (p IndexFiles) Retain()
- func (p IndexFiles) SeriesIterator() SeriesIterator
- func (p IndexFiles) Stat() (*IndexFilesInfo, error)
- func (p *IndexFiles) TagKeyIterator(name []byte) (TagKeyIterator, error)
- func (p IndexFiles) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
- func (p IndexFiles) WriteTo(w io.Writer) (n int64, err error)
- type IndexFilesInfo
- type LogEntry
- type LogFile
- func (f *LogFile) AddSeries(name []byte, tags models.Tags) error
- func (f *LogFile) AddSeriesList(names [][]byte, tagsSlice []models.Tags) error
- func (f *LogFile) Close() error
- func (f *LogFile) DeleteMeasurement(name []byte) error
- func (f *LogFile) DeleteSeries(name []byte, tags models.Tags) error
- func (f *LogFile) DeleteTagKey(name, key []byte) error
- func (f *LogFile) DeleteTagValue(name, key, value []byte) error
- func (f *LogFile) Flush() error
- func (f *LogFile) HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool)
- func (f *LogFile) Measurement(name []byte) MeasurementElem
- func (f *LogFile) MeasurementIterator() MeasurementIterator
- func (f *LogFile) MeasurementNames() []string
- func (f *LogFile) MeasurementSeriesIterator(name []byte) SeriesIterator
- func (f *LogFile) MergeMeasurementsSketches(sketch, tsketch estimator.Sketch) error
- func (f *LogFile) MergeSeriesSketches(sketch, tsketch estimator.Sketch) error
- func (f *LogFile) Open() error
- func (f *LogFile) Path() string
- func (f *LogFile) Release()
- func (f *LogFile) Retain()
- func (f *LogFile) Series(name []byte, tags models.Tags) SeriesElem
- func (f *LogFile) SeriesIterator() SeriesIterator
- func (f *LogFile) SeriesN() (n uint64)
- func (f *LogFile) SeriesWithBuffer(name []byte, tags models.Tags, buf []byte) SeriesElem
- func (f *LogFile) SetPath(path string)
- func (f *LogFile) Size() int64
- func (f *LogFile) Stat() (int64, time.Time)
- func (f *LogFile) TagKey(name, key []byte) TagKeyElem
- func (f *LogFile) TagKeyIterator(name []byte) TagKeyIterator
- func (f *LogFile) TagKeySeriesIterator(name, key []byte) SeriesIterator
- func (f *LogFile) TagValue(name, key, value []byte) TagValueElem
- func (f *LogFile) TagValueIterator(name, key []byte) TagValueIterator
- func (f *LogFile) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
- func (f *LogFile) WriteTo(w io.Writer) (n int64, err error)
- type Manifest
- type MeasurementBlock
- type MeasurementBlockElem
- func (e *MeasurementBlockElem) Deleted() bool
- func (e *MeasurementBlockElem) Name() []byte
- func (e *MeasurementBlockElem) SeriesID(i int) uint64
- func (e *MeasurementBlockElem) SeriesIDs() []uint64
- func (e *MeasurementBlockElem) TagBlockOffset() int64
- func (e *MeasurementBlockElem) TagBlockSize() int64
- func (e *MeasurementBlockElem) UnmarshalBinary(data []byte) error
- type MeasurementBlockTrailer
- type MeasurementBlockWriter
- type MeasurementElem
- type MeasurementElems
- type MeasurementIterator
- type SeriesBlock
- func (blk *SeriesBlock) HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool)
- func (blk *SeriesBlock) Offset(name []byte, tags models.Tags, buf []byte) (offset uint64, tombstoned bool)
- func (blk *SeriesBlock) Series(name []byte, tags models.Tags) SeriesElem
- func (blk *SeriesBlock) SeriesCount() uint64
- func (blk *SeriesBlock) SeriesIterator() SeriesIterator
- func (blk *SeriesBlock) UnmarshalBinary(data []byte) error
- type SeriesBlockElem
- type SeriesBlockEncoder
- type SeriesBlockTrailer
- type SeriesElem
- type SeriesIterator
- func DifferenceSeriesIterators(itr0, itr1 SeriesIterator) SeriesIterator
- func FilterUndeletedSeriesIterator(itr SeriesIterator) SeriesIterator
- func IntersectSeriesIterators(itr0, itr1 SeriesIterator) SeriesIterator
- func MergeSeriesIterators(itrs ...SeriesIterator) SeriesIterator
- func UnionSeriesIterators(itr0, itr1 SeriesIterator) SeriesIterator
- type TagBlock
- type TagBlockEncoder
- type TagBlockKeyElem
- type TagBlockTrailer
- type TagBlockValueElem
- type TagKeyElem
- type TagKeyIterator
- type TagValueElem
- type TagValueIterator
Constants ¶
const ( DefaultMaxLogFileSize = 5 * 1024 * 1024 DefaultCompactionFactor = 1.8 )
Default compaction thresholds.
const ( LogFileExt = ".tsl" IndexFileExt = ".tsi" CompactingExt = ".compacting" )
File extensions.
const ( // IndexFile trailer fields IndexFileVersionSize = 2 SeriesBlockOffsetSize = 8 SeriesBlockSizeSize = 8 MeasurementBlockOffsetSize = 8 MeasurementBlockSizeSize = 8 IndexFileTrailerSize = IndexFileVersionSize + SeriesBlockOffsetSize + SeriesBlockSizeSize + MeasurementBlockOffsetSize + MeasurementBlockSizeSize )
IndexFile field size constants.
const ( LogEntrySeriesTombstoneFlag = 0x01 LogEntryMeasurementTombstoneFlag = 0x02 LogEntryTagKeyTombstoneFlag = 0x04 LogEntryTagValueTombstoneFlag = 0x08 )
Log entry flag constants.
const ( // 1 byte offset for the block to ensure non-zero offsets. MeasurementFillSize = 1 // Measurement trailer fields MeasurementTrailerSize = 0 + 2 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 // tombstone measurement sketch offset/size // Measurement key block fields. MeasurementNSize = 8 MeasurementOffsetSize = 8 )
Measurement field size constants.
const ( // Series list trailer field sizes. SeriesBlockTrailerSize = 0 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 0 // Other field sizes SeriesCountSize = 8 SeriesIDSize = 8 )
Series list field size constants.
const ( // Marks the series as having been deleted. SeriesTombstoneFlag = 0x01 // Marks the following bytes as a hash index. // These bytes should be skipped by an iterator. SeriesHashIndexFlag = 0x02 )
Series flag constants.
const ( // TagBlock key block fields. TagKeyNSize = 8 TagKeyOffsetSize = 8 // TagBlock value block fields. TagValueNSize = 8 TagValueOffsetSize = 8 )
TagBlock variable size constants.
const FileSignature = "TSI1"
FileSignature represents a magic number at the header of the index file.
const IndexFileVersion = 1
IndexFileVersion is the current TSI1 index file version.
const IndexName = "tsi1"
IndexName is the name of the index.
const LoadFactor = 80
LoadFactor is the fill percent for RHH indexes.
const ManifestFileName = "MANIFEST"
ManifestFileName is the name of the index manifest file.
const MaxSeriesBlockHashSize = (65536 * LoadFactor) / 100
MaxSeriesBlockHashSize is the maximum number of series in a single hash.
const MeasurementBlockVersion = 1
MeasurementBlockVersion is the version of the measurement block.
const (
MeasurementTombstoneFlag = 0x01
)
Measurement flag constants.
const TagBlockTrailerSize = 0 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 2 // version
TagBlockTrailerSize is the total size of the on-disk trailer.
const TagBlockVersion = 1
TagBlockVersion is the version of the tag block.
const (
TagKeyTombstoneFlag = 0x01
)
Tag key flag constants.
const (
TagValueTombstoneFlag = 0x01
)
Tag value flag constants.
Variables ¶
var ( ErrInvalidIndexFile = errors.New("invalid index file") ErrUnsupportedIndexFileVersion = errors.New("unsupported index file version") )
IndexFile errors.
var ( ErrUnsupportedMeasurementBlockVersion = errors.New("unsupported measurement block version") ErrMeasurementBlockSizeMismatch = errors.New("measurement block size mismatch") )
Measurement errors.
var ( ErrUnsupportedTagBlockVersion = errors.New("unsupported tag block version") ErrTagBlockSizeMismatch = errors.New("tag block size mismatch") )
TagBlock errors.
var (
ErrLogEntryChecksumMismatch = errors.New("log entry checksum mismatch")
)
Log errors.
var ErrSeriesOverflow = errors.New("series overflow")
ErrSeriesOverflow is returned when too many series are added to a series writer.
Functions ¶
func AppendSeriesElem ¶
AppendSeriesElem serializes flag/name/tags to dst and returns the new buffer.
func AppendSeriesKey ¶
AppendSeriesKey serializes name and tags to a byte slice. The total length is prepended as a uvarint.
func CompareSeriesElem ¶
func CompareSeriesElem(a, b SeriesElem) int
CompareSeriesElem returns -1 if a < b, 1 if a > b, and 0 if equal.
func CompareSeriesKeys ¶
func FormatIndexFileName ¶
FormatIndexFileName generates an index filename for the given index.
func FormatLogFileName ¶
FormatLogFileName generates a log filename for the given index.
func ParseFileID ¶
ParseFileID extracts the numeric id from a log or index file path. Returns 0 if it cannot be parsed.
func ReadSeriesKey ¶
ReadSeriesKey returns the series key from the beginning of the buffer.
func SeriesElemKey ¶
func SeriesElemKey(e SeriesElem) []byte
SeriesElemKey encodes e as a series key.
func WriteManifestFile ¶
WriteManifestFile writes a manifest to a file path.
Types ¶
type File ¶
type File interface { Close() error Path() string Measurement(name []byte) MeasurementElem MeasurementIterator() MeasurementIterator HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool) Series(name []byte, tags models.Tags) SeriesElem SeriesN() uint64 TagKey(name, key []byte) TagKeyElem TagKeyIterator(name []byte) TagKeyIterator TagValue(name, key, value []byte) TagValueElem TagValueIterator(name, key []byte) TagValueIterator // Series iteration. SeriesIterator() SeriesIterator MeasurementSeriesIterator(name []byte) SeriesIterator TagKeySeriesIterator(name, key []byte) SeriesIterator TagValueSeriesIterator(name, key, value []byte) SeriesIterator // Sketches for cardinality estimation MergeSeriesSketches(s, t estimator.Sketch) error MergeMeasurementsSketches(s, t estimator.Sketch) error // Reference counting. Retain() Release() }
File represents a log or index file.
type FileSet ¶
type FileSet []File
FileSet represents a collection of files.
func (FileSet) FilterNamesTags ¶
func (fs FileSet) FilterNamesTags(names [][]byte, tagsSlice []models.Tags) ([][]byte, []models.Tags)
FilterNamesTags filters out any series which already exist. It modifies the provided slices of names and tags.
func (FileSet) HasTagValue ¶
HasTagValue returns true if the tag value exists.
func (FileSet) IndexFiles ¶
IndexFiles returns all index files from the file set.
func (FileSet) MatchTagValueSeriesIterator ¶
func (fs FileSet) MatchTagValueSeriesIterator(name, key []byte, value *regexp.Regexp, matches bool) SeriesIterator
MatchTagValueSeriesIterator returns a series iterator for tags which match value. If matches is false, returns iterators which do not match value.
func (FileSet) Measurement ¶
func (fs FileSet) Measurement(name []byte) MeasurementElem
Measurement returns a measurement by name.
func (FileSet) MeasurementIterator ¶
func (fs FileSet) MeasurementIterator() MeasurementIterator
MeasurementIterator returns an iterator over all measurements in the index.
func (FileSet) MeasurementNamesByExpr ¶
func (FileSet) MeasurementSeriesByExprIterator ¶
func (fs FileSet) MeasurementSeriesByExprIterator(name []byte, expr influxql.Expr, fieldset *tsdb.MeasurementFieldSet) (SeriesIterator, error)
MeasurementSeriesByExprIterator returns a series iterator for a measurement that is filtered by expr. If expr only contains time expressions then this call is equivalent to MeasurementSeriesIterator().
func (FileSet) MeasurementSeriesIterator ¶
func (fs FileSet) MeasurementSeriesIterator(name []byte) SeriesIterator
MeasurementSeriesIterator returns an iterator over all non-tombstoned series in the index for the provided measurement.
func (FileSet) MeasurementSeriesKeysByExpr ¶
func (fs FileSet) MeasurementSeriesKeysByExpr(name []byte, expr influxql.Expr, fieldset *tsdb.MeasurementFieldSet) ([][]byte, error)
MeasurementSeriesKeysByExpr returns a list of series keys matching expr.
func (FileSet) MeasurementTagKeysByExpr ¶
func (fs FileSet) MeasurementTagKeysByExpr(name []byte, expr influxql.Expr) (map[string]struct{}, error)
MeasurementTagKeysByExpr extracts the tag keys wanted by the expression.
func (FileSet) MeasurementsSketches ¶
MeasurementsSketches returns the merged measurement sketches for the FileSet.
func (FileSet) MustReplace ¶
MustReplace swaps a list of files for a single file and returns a new file set. The caller should always guarentee that the files exist and are contiguous.
func (FileSet) Release ¶
func (p FileSet) Release()
Release removes a reference count from all files.
func (FileSet) SeriesIterator ¶
func (fs FileSet) SeriesIterator() SeriesIterator
SeriesIterator returns an iterator over all series in the index.
func (FileSet) SeriesSketches ¶
SeriesSketches returns the merged series sketches for the FileSet.
func (FileSet) TagKeyIterator ¶
func (fs FileSet) TagKeyIterator(name []byte) TagKeyIterator
TagKeyIterator returns an iterator over all tag keys for a measurement.
func (FileSet) TagKeySeriesIterator ¶
func (fs FileSet) TagKeySeriesIterator(name, key []byte) SeriesIterator
TagKeySeriesIterator returns a series iterator for all values across a single key.
func (FileSet) TagValueIterator ¶
func (fs FileSet) TagValueIterator(name, key []byte) TagValueIterator
TagValueIterator returns a value iterator for a tag key.
func (FileSet) TagValueSeriesIterator ¶
func (fs FileSet) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
TagValueSeriesIterator returns a series iterator for a single tag value.
type Index ¶
type Index struct { // Associated shard info. ShardID uint64 // Root directory of the index files. Path string // Log file compaction thresholds. MaxLogFileSize int64 CompactionFactor float64 // Frequency of compaction checks. CompactionMonitorInterval time.Duration // contains filtered or unexported fields }
Index represents a collection of layered index files and WAL.
func (*Index) AssignShard ¶
func (*Index) CheckLogFile ¶
func (*Index) CreateSeriesIfNotExists ¶
CreateSeriesIfNotExists creates a series if it doesn't exist or is deleted.
func (*Index) CreateSeriesListIfNotExists ¶
CreateSeriesListIfNotExists creates a list of series if they doesn't exist in bulk.
func (*Index) DropMeasurement ¶
DropMeasurement deletes a measurement from the index.
func (*Index) DropSeries ¶
func (*Index) ForEachMeasurementName ¶
ForEachMeasurementName iterates over all measurement names in the index.
func (*Index) ForEachMeasurementSeriesByExpr ¶
func (i *Index) ForEachMeasurementSeriesByExpr(name []byte, condition influxql.Expr, fn func(tags models.Tags) error) error
ForEachMeasurementSeriesByExpr iterates over all series in a measurement filtered by an expression.
func (*Index) ForEachMeasurementTagKey ¶
ForEachMeasurementTagKey iterates over all tag keys in a measurement.
func (*Index) InitializeSeries ¶
InitializeSeries is a no-op. This only applies to the in-memory index.
func (*Index) ManifestPath ¶
ManifestPath returns the path to the index's manifest file.
func (*Index) MeasurementExists ¶
MeasurementExists returns true if a measurement exists.
func (*Index) MeasurementNamesByExpr ¶
func (*Index) MeasurementNamesByRegex ¶
func (*Index) MeasurementSeriesKeysByExpr ¶
MeasurementSeriesKeysByExpr returns a list of series keys matching expr.
func (*Index) MeasurementTagKeysByExpr ¶
func (i *Index) MeasurementTagKeysByExpr(name []byte, expr influxql.Expr) (map[string]struct{}, error)
MeasurementTagKeysByExpr extracts the tag keys wanted by the expression.
func (*Index) MeasurementsSketches ¶
MeasurementsSketches returns the two sketches for the index by merging all instances of the type sketch types in all the index files.
func (*Index) NextSequence ¶
NextSequence returns the next file identifier.
func (*Index) RemoveShard ¶
func (*Index) RetainFileSet ¶
RetainFileSet returns the current fileset and adds a reference count.
func (*Index) SeriesN ¶
SeriesN returns the number of unique non-tombstoned series in the index. Since indexes are not shared across shards, the count returned by SeriesN cannot be combined with other shard's results. If you need to count series across indexes then use SeriesSketches and merge the results from other indexes.
func (*Index) SeriesPointIterator ¶
SeriesPointIterator returns an influxql iterator over all series.
func (*Index) SeriesSketches ¶
SeriesSketches returns the two sketches for the index by merging all instances sketches from TSI files and the WAL.
func (*Index) SetFieldName ¶
func (*Index) SetFieldSet ¶
func (i *Index) SetFieldSet(fs *tsdb.MeasurementFieldSet)
SetFieldSet sets a shared field set from the engine.
func (*Index) SnapshotTo ¶
SnapshotTo creates hard links to the file set into path.
func (*Index) TagKeyCardinality ¶
TagKeyCardinality always returns zero. It is not possible to determine cardinality of tags across index files.
type IndexFile ¶
type IndexFile struct { // Sortable identifier & filepath to the log file. ID int // contains filtered or unexported fields }
IndexFile represents a collection of measurement, tag, and series data.
func NewIndexFile ¶
func NewIndexFile() *IndexFile
NewIndexFile returns a new instance of IndexFile.
func (*IndexFile) Compacting ¶
Compacting returns true if the file is being compacted.
func (*IndexFile) HasSeries ¶
HasSeries returns flags indicating if the series exists and if it is tombstoned.
func (*IndexFile) Measurement ¶
func (f *IndexFile) Measurement(name []byte) MeasurementElem
Measurement returns a measurement element.
func (*IndexFile) MeasurementIterator ¶
func (f *IndexFile) MeasurementIterator() MeasurementIterator
MeasurementIterator returns an iterator over all measurements.
func (*IndexFile) MeasurementSeriesIterator ¶
func (f *IndexFile) MeasurementSeriesIterator(name []byte) SeriesIterator
MeasurementSeriesIterator returns an iterator over a measurement's series.
func (*IndexFile) MergeMeasurementsSketches ¶
MergeMeasurementsSketches merges the index file's series sketches into the provided sketches.
func (*IndexFile) MergeSeriesSketches ¶
MergeSeriesSketches merges the index file's series sketches into the provided sketches.
func (*IndexFile) Release ¶
func (f *IndexFile) Release()
Release removes a reference count from the file.
func (*IndexFile) Series ¶
func (f *IndexFile) Series(name []byte, tags models.Tags) SeriesElem
Series returns the series and a flag indicating if the series has been tombstoned by the measurement.
func (*IndexFile) SeriesIterator ¶
func (f *IndexFile) SeriesIterator() SeriesIterator
SeriesIterator returns an iterator over all series.
func (*IndexFile) SeriesN ¶
SeriesN returns the total number of non-tombstoned series for the index file.
func (*IndexFile) TagKey ¶
func (f *IndexFile) TagKey(name, key []byte) TagKeyElem
TagKey returns a tag key.
func (*IndexFile) TagKeyIterator ¶
func (f *IndexFile) TagKeyIterator(name []byte) TagKeyIterator
TagKeyIterator returns an iterator over all tag keys for a measurement.
func (*IndexFile) TagKeySeriesIterator ¶
func (f *IndexFile) TagKeySeriesIterator(name, key []byte) SeriesIterator
TagKeySeriesIterator returns a series iterator for a tag key and a flag indicating if a tombstone exists on the measurement or key.
func (*IndexFile) TagValue ¶
func (f *IndexFile) TagValue(name, key, value []byte) TagValueElem
TagValue returns a tag value.
func (*IndexFile) TagValueElem ¶
func (f *IndexFile) TagValueElem(name, key, value []byte) TagValueElem
TagValueElem returns an element for a measurement/tag/value.
func (*IndexFile) TagValueIterator ¶
func (f *IndexFile) TagValueIterator(name, key []byte) TagValueIterator
TagValueIterator returns a value iterator for a tag key and a flag indicating if a tombstone exists on the measurement or key.
func (*IndexFile) TagValueSeriesIterator ¶
func (f *IndexFile) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
TagValueSeriesIterator returns a series iterator for a tag value and a flag indicating if a tombstone exists on the measurement, key, or value.
func (*IndexFile) UnmarshalBinary ¶
UnmarshalBinary opens an index from data. The byte slice is retained so it must be kept open.
type IndexFileTrailer ¶
type IndexFileTrailer struct { Version int SeriesBlock struct { Offset int64 Size int64 } MeasurementBlock struct { Offset int64 Size int64 } }
IndexFileTrailer represents meta data written to the end of the index file.
func ReadIndexFileTrailer ¶
func ReadIndexFileTrailer(data []byte) (IndexFileTrailer, error)
ReadIndexFileTrailer returns the index file trailer from data.
type IndexFiles ¶
type IndexFiles []*IndexFile
IndexFiles represents a layered set of index files.
func (IndexFiles) Files ¶
func (p IndexFiles) Files() []File
Files returns p as a list of File objects.
func (IndexFiles) MeasurementIterator ¶
func (p IndexFiles) MeasurementIterator() MeasurementIterator
MeasurementIterator returns an iterator that merges measurements across all files.
func (*IndexFiles) MeasurementNames ¶
func (p *IndexFiles) MeasurementNames() [][]byte
MeasurementNames returns a sorted list of all measurement names for all files.
func (IndexFiles) MeasurementSeriesIterator ¶
func (p IndexFiles) MeasurementSeriesIterator(name []byte) SeriesIterator
MeasurementSeriesIterator returns an iterator that merges series across all files.
func (IndexFiles) Release ¶
func (p IndexFiles) Release()
Release removes a reference count from all files.
func (IndexFiles) SeriesIterator ¶
func (p IndexFiles) SeriesIterator() SeriesIterator
SeriesIterator returns an iterator that merges series across all files.
func (IndexFiles) Stat ¶
func (p IndexFiles) Stat() (*IndexFilesInfo, error)
Stat returns the max index file size and the total file size for all index files.
func (*IndexFiles) TagKeyIterator ¶
func (p *IndexFiles) TagKeyIterator(name []byte) (TagKeyIterator, error)
TagKeyIterator returns an iterator that merges tag keys across all files.
func (IndexFiles) TagValueSeriesIterator ¶
func (p IndexFiles) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
TagValueSeriesIterator returns an iterator that merges series across all files.
type IndexFilesInfo ¶
type LogEntry ¶
type LogEntry struct { Flag byte // flag Name []byte // measurement name Tags models.Tags // tagset Checksum uint32 // checksum of flag/name/tags. Size int // total size of record, in bytes. }
LogEntry represents a single log entry in the write-ahead log.
func (*LogEntry) UnmarshalBinary ¶
UnmarshalBinary unmarshals data into e.
type LogFile ¶
type LogFile struct {
// contains filtered or unexported fields
}
LogFile represents an on-disk write-ahead log file.
func NewLogFile ¶
NewLogFile returns a new instance of LogFile.
func (*LogFile) AddSeriesList ¶
AddSeriesList adds a list of series to the log file in bulk.
func (*LogFile) DeleteMeasurement ¶
DeleteMeasurement adds a tombstone for a measurement to the log file.
func (*LogFile) DeleteSeries ¶
DeleteSeries adds a tombstone for a series to the log file.
func (*LogFile) DeleteTagKey ¶
DeleteTagKey adds a tombstone for a tag key to the log file.
func (*LogFile) DeleteTagValue ¶
DeleteTagValue adds a tombstone for a tag value to the log file.
func (*LogFile) HasSeries ¶
HasSeries returns flags indicating if the series exists and if it is tombstoned.
func (*LogFile) Measurement ¶
func (f *LogFile) Measurement(name []byte) MeasurementElem
Measurement returns a measurement element.
func (*LogFile) MeasurementIterator ¶
func (f *LogFile) MeasurementIterator() MeasurementIterator
MeasurementIterator returns an iterator over all the measurements in the file.
func (*LogFile) MeasurementNames ¶
MeasurementNames returns an ordered list of measurement names.
func (*LogFile) MeasurementSeriesIterator ¶
func (f *LogFile) MeasurementSeriesIterator(name []byte) SeriesIterator
MeasurementSeriesIterator returns an iterator over all series for a measurement.
func (*LogFile) MergeMeasurementsSketches ¶
MergeMeasurementsSketches merges the measurement sketches belonging to this LogFile into the provided sketches.
MergeMeasurementsSketches is safe for concurrent use by multiple goroutines.
func (*LogFile) MergeSeriesSketches ¶
MergeSeriesSketches merges the series sketches belonging to this LogFile into the provided sketches.
MergeSeriesSketches is safe for concurrent use by multiple goroutines.
func (*LogFile) Release ¶
func (f *LogFile) Release()
Release removes a reference count from the file.
func (*LogFile) Series ¶
func (f *LogFile) Series(name []byte, tags models.Tags) SeriesElem
Series returns a series by name/tags.
func (*LogFile) SeriesIterator ¶
func (f *LogFile) SeriesIterator() SeriesIterator
SeriesIterator returns an iterator over all series in the log file.
func (*LogFile) SeriesWithBuffer ¶
SeriesWithBuffer returns a series by name/tags.
func (*LogFile) TagKey ¶
func (f *LogFile) TagKey(name, key []byte) TagKeyElem
TagKey returns a tag key element.
func (*LogFile) TagKeyIterator ¶
func (f *LogFile) TagKeyIterator(name []byte) TagKeyIterator
TagKeyIterator returns a value iterator for a measurement.
func (*LogFile) TagKeySeriesIterator ¶
func (f *LogFile) TagKeySeriesIterator(name, key []byte) SeriesIterator
TagKeySeriesIterator returns a series iterator for a tag key.
func (*LogFile) TagValue ¶
func (f *LogFile) TagValue(name, key, value []byte) TagValueElem
TagValue returns a tag value element.
func (*LogFile) TagValueIterator ¶
func (f *LogFile) TagValueIterator(name, key []byte) TagValueIterator
TagValueIterator returns a value iterator for a tag key.
func (*LogFile) TagValueSeriesIterator ¶
func (f *LogFile) TagValueSeriesIterator(name, key, value []byte) SeriesIterator
TagValueSeriesIterator returns a series iterator for a tag value.
type Manifest ¶
type Manifest struct {
Files []string `json:"files,omitempty"`
}
Manifest represents the list of log & index files that make up the index. The files are listed in time order, not necessarily ID order.
func ReadManifestFile ¶
ReadManifestFile reads a manifest from a file path.
type MeasurementBlock ¶
type MeasurementBlock struct {
// contains filtered or unexported fields
}
MeasurementBlock represents a collection of all measurements in an index.
func (*MeasurementBlock) Elem ¶
func (blk *MeasurementBlock) Elem(name []byte) (e MeasurementBlockElem, ok bool)
Elem returns an element for a measurement.
func (*MeasurementBlock) Iterator ¶
func (blk *MeasurementBlock) Iterator() MeasurementIterator
Iterator returns an iterator over all measurements.
func (*MeasurementBlock) UnmarshalBinary ¶
func (blk *MeasurementBlock) UnmarshalBinary(data []byte) error
UnmarshalBinary unpacks data into the block. Block is not copied so data should be retained and unchanged after being passed into this function.
func (*MeasurementBlock) Version ¶
func (blk *MeasurementBlock) Version() int
Version returns the encoding version parsed from the data. Only valid after UnmarshalBinary() has been successfully invoked.
type MeasurementBlockElem ¶
type MeasurementBlockElem struct {
// contains filtered or unexported fields
}
MeasurementBlockElem represents an internal measurement element.
func (*MeasurementBlockElem) Deleted ¶
func (e *MeasurementBlockElem) Deleted() bool
Deleted returns true if the tombstone flag is set.
func (*MeasurementBlockElem) Name ¶
func (e *MeasurementBlockElem) Name() []byte
Name returns the measurement name.
func (*MeasurementBlockElem) SeriesID ¶
func (e *MeasurementBlockElem) SeriesID(i int) uint64
SeriesID returns series ID at an index.
func (*MeasurementBlockElem) SeriesIDs ¶
func (e *MeasurementBlockElem) SeriesIDs() []uint64
SeriesIDs returns a list of decoded series ids.
func (*MeasurementBlockElem) TagBlockOffset ¶
func (e *MeasurementBlockElem) TagBlockOffset() int64
TagBlockOffset returns the offset of the measurement's tag block.
func (*MeasurementBlockElem) TagBlockSize ¶
func (e *MeasurementBlockElem) TagBlockSize() int64
TagBlockSize returns the size of the measurement's tag block.
func (*MeasurementBlockElem) UnmarshalBinary ¶
func (e *MeasurementBlockElem) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshals data into e.
type MeasurementBlockTrailer ¶
type MeasurementBlockTrailer struct { Version int // Encoding version // Offset & size of data section. Data struct { Offset int64 Size int64 } // Offset & size of hash map section. HashIndex struct { Offset int64 Size int64 } // Offset and size of cardinality sketch for measurements. Sketch struct { Offset int64 Size int64 } // Offset and size of cardinality sketch for tombstoned measurements. TSketch struct { Offset int64 Size int64 } }
MeasurementBlockTrailer represents meta data at the end of a MeasurementBlock.
func ReadMeasurementBlockTrailer ¶
func ReadMeasurementBlockTrailer(data []byte) (MeasurementBlockTrailer, error)
ReadMeasurementBlockTrailer returns the block trailer from data.
type MeasurementBlockWriter ¶
type MeasurementBlockWriter struct {
// contains filtered or unexported fields
}
MeasurementBlockWriter writes a measurement block.
func NewMeasurementBlockWriter ¶
func NewMeasurementBlockWriter() *MeasurementBlockWriter
NewMeasurementBlockWriter returns a new MeasurementBlockWriter.
type MeasurementElem ¶
MeasurementElem represents a generic measurement element.
type MeasurementElems ¶
type MeasurementElems []MeasurementElem
MeasurementElems represents a list of MeasurementElem.
func (MeasurementElems) Len ¶
func (a MeasurementElems) Len() int
func (MeasurementElems) Less ¶
func (a MeasurementElems) Less(i, j int) bool
func (MeasurementElems) Swap ¶
func (a MeasurementElems) Swap(i, j int)
type MeasurementIterator ¶
type MeasurementIterator interface {
Next() MeasurementElem
}
MeasurementIterator represents a iterator over a list of measurements.
func FilterUndeletedMeasurementIterator ¶
func FilterUndeletedMeasurementIterator(itr MeasurementIterator) MeasurementIterator
FilterUndeletedMeasurementIterator returns an iterator which filters all deleted measurement.
func MergeMeasurementIterators ¶
func MergeMeasurementIterators(itrs ...MeasurementIterator) MeasurementIterator
MergeMeasurementIterators returns an iterator that merges a set of iterators. Iterators that are first in the list take precendence and a deletion by those early iterators will invalidate elements by later iterators.
type SeriesBlock ¶
type SeriesBlock struct {
// contains filtered or unexported fields
}
SeriesBlock represents the section of the index that holds series data.
func (*SeriesBlock) HasSeries ¶
func (blk *SeriesBlock) HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool)
HasSeries returns flags indicating if the series exists and if it is tombstoned.
func (*SeriesBlock) Offset ¶
func (blk *SeriesBlock) Offset(name []byte, tags models.Tags, buf []byte) (offset uint64, tombstoned bool)
Offset returns the byte offset of the series within the block.
func (*SeriesBlock) Series ¶
func (blk *SeriesBlock) Series(name []byte, tags models.Tags) SeriesElem
Series returns a series element.
func (*SeriesBlock) SeriesCount ¶
func (blk *SeriesBlock) SeriesCount() uint64
SeriesCount returns the number of series.
func (*SeriesBlock) SeriesIterator ¶
func (blk *SeriesBlock) SeriesIterator() SeriesIterator
SeriesIterator returns an iterator over all the series.
func (*SeriesBlock) UnmarshalBinary ¶
func (blk *SeriesBlock) UnmarshalBinary(data []byte) error
UnmarshalBinary unpacks data into the series list.
If data is an mmap then it should stay open until the series list is no longer used because data access is performed directly from the byte slice.
type SeriesBlockElem ¶
type SeriesBlockElem struct {
// contains filtered or unexported fields
}
SeriesBlockElem represents a series element in the series list.
func (*SeriesBlockElem) Deleted ¶
func (e *SeriesBlockElem) Deleted() bool
Deleted returns true if the tombstone flag is set.
func (*SeriesBlockElem) Expr ¶
func (e *SeriesBlockElem) Expr() influxql.Expr
Expr always returns a nil expression. This is only used by higher level query planning.
func (*SeriesBlockElem) Name ¶
func (e *SeriesBlockElem) Name() []byte
Name returns the measurement name.
func (*SeriesBlockElem) Tags ¶
func (e *SeriesBlockElem) Tags() models.Tags
Tags returns the tag set.
func (*SeriesBlockElem) UnmarshalBinary ¶
func (e *SeriesBlockElem) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshals data into e.
type SeriesBlockEncoder ¶
type SeriesBlockEncoder struct {
// contains filtered or unexported fields
}
SeriesBlockEncoder encodes series to a SeriesBlock in an underlying writer.
func NewSeriesBlockEncoder ¶
func NewSeriesBlockEncoder(w io.Writer) *SeriesBlockEncoder
NewSeriesBlockEncoder returns a new instance of SeriesBlockEncoder.
func (*SeriesBlockEncoder) Close ¶
func (enc *SeriesBlockEncoder) Close() error
Close writes the index and trailer. This should be called at the end once all series have been encoded.
func (*SeriesBlockEncoder) Encode ¶
Encode writes a series to the underlying writer. The series must be lexicographical sorted after the previous encoded series.
func (*SeriesBlockEncoder) N ¶
func (enc *SeriesBlockEncoder) N() int64
N returns the number of bytes written.
type SeriesBlockTrailer ¶
type SeriesBlockTrailer struct { Series struct { Data struct { Offset int64 Size int64 } Index struct { Offset int64 Size int64 N int64 } } // Offset and size of cardinality sketch for measurements. Sketch struct { Offset int64 Size int64 } // Offset and size of cardinality sketch for tombstoned measurements. TSketch struct { Offset int64 Size int64 } SeriesN int64 TombstoneN int64 }
SeriesBlockTrailer represents meta data written to the end of the series list.
func ReadSeriesBlockTrailer ¶
func ReadSeriesBlockTrailer(data []byte) SeriesBlockTrailer
ReadSeriesBlockTrailer returns the series list trailer from data.
type SeriesElem ¶
type SeriesElem interface { Name() []byte Tags() models.Tags Deleted() bool // InfluxQL expression associated with series during filtering. Expr() influxql.Expr }
SeriesElem represents a generic series element.
type SeriesIterator ¶
type SeriesIterator interface {
Next() SeriesElem
}
SeriesIterator represents a iterator over a list of series.
func DifferenceSeriesIterators ¶
func DifferenceSeriesIterators(itr0, itr1 SeriesIterator) SeriesIterator
DifferenceSeriesIterators returns an iterator that only returns series which occur the first iterator but not the second iterator.
func FilterUndeletedSeriesIterator ¶
func FilterUndeletedSeriesIterator(itr SeriesIterator) SeriesIterator
FilterUndeletedSeriesIterator returns an iterator which filters all deleted series.
func IntersectSeriesIterators ¶
func IntersectSeriesIterators(itr0, itr1 SeriesIterator) SeriesIterator
IntersectSeriesIterators returns an iterator that only returns series which occur in both iterators. If both series have associated expressions then they are combined together.
func MergeSeriesIterators ¶
func MergeSeriesIterators(itrs ...SeriesIterator) SeriesIterator
MergeSeriesIterators returns an iterator that merges a set of iterators. Iterators that are first in the list take precendence and a deletion by those early iterators will invalidate elements by later iterators.
func UnionSeriesIterators ¶
func UnionSeriesIterators(itr0, itr1 SeriesIterator) SeriesIterator
UnionSeriesIterators returns an iterator that returns series from both both iterators. If both series have associated expressions then they are combined together.
type TagBlock ¶
type TagBlock struct {
// contains filtered or unexported fields
}
TagBlock represents tag key/value block for a single measurement.
func (*TagBlock) TagKeyElem ¶
func (blk *TagBlock) TagKeyElem(key []byte) TagKeyElem
TagKeyElem returns an element for a tag key. Returns an element with a nil key if not found.
func (*TagBlock) TagKeyIterator ¶
func (blk *TagBlock) TagKeyIterator() TagKeyIterator
TagKeyIterator returns an iterator over all the keys in the block.
func (*TagBlock) TagValueElem ¶
func (blk *TagBlock) TagValueElem(key, value []byte) TagValueElem
TagValueElem returns an element for a tag value.
func (*TagBlock) UnmarshalBinary ¶
UnmarshalBinary unpacks data into the tag block. Tag block is not copied so data should be retained and unchanged after being passed into this function.
type TagBlockEncoder ¶
type TagBlockEncoder struct {
// contains filtered or unexported fields
}
TagBlockEncoder encodes a tags to a TagBlock section.
func NewTagBlockEncoder ¶
func NewTagBlockEncoder(w io.Writer) *TagBlockEncoder
NewTagBlockEncoder returns a new TagBlockEncoder.
func (*TagBlockEncoder) Close ¶
func (enc *TagBlockEncoder) Close() error
Close flushes the trailer of the encoder to the writer.
func (*TagBlockEncoder) EncodeKey ¶
func (enc *TagBlockEncoder) EncodeKey(key []byte, deleted bool) error
EncodeKey writes a tag key to the underlying writer.
func (*TagBlockEncoder) EncodeValue ¶
func (enc *TagBlockEncoder) EncodeValue(value []byte, deleted bool, seriesIDs []uint64) error
EncodeValue writes a tag value to the underlying writer. The tag key must be lexicographical sorted after the previous encoded tag key.
func (*TagBlockEncoder) N ¶
func (enc *TagBlockEncoder) N() int64
N returns the number of bytes written.
type TagBlockKeyElem ¶
type TagBlockKeyElem struct {
// contains filtered or unexported fields
}
TagBlockKeyElem represents a tag key element in a TagBlock.
func (*TagBlockKeyElem) Deleted ¶
func (e *TagBlockKeyElem) Deleted() bool
Deleted returns true if the key has been tombstoned.
func (*TagBlockKeyElem) Key ¶
func (e *TagBlockKeyElem) Key() []byte
Key returns the key name of the element.
func (*TagBlockKeyElem) TagValueIterator ¶
func (e *TagBlockKeyElem) TagValueIterator() TagValueIterator
TagValueIterator returns an iterator over the key's values.
type TagBlockTrailer ¶
type TagBlockTrailer struct { Version int // Encoding version Size int64 // Total size w/ trailer // Offset & size of value data section. ValueData struct { Offset int64 Size int64 } // Offset & size of key data section. KeyData struct { Offset int64 Size int64 } // Offset & size of hash map section. HashIndex struct { Offset int64 Size int64 } }
TagBlockTrailer represents meta data at the end of a TagBlock.
func ReadTagBlockTrailer ¶
func ReadTagBlockTrailer(data []byte) (TagBlockTrailer, error)
ReadTagBlockTrailer returns the tag block trailer from data.
type TagBlockValueElem ¶
type TagBlockValueElem struct {
// contains filtered or unexported fields
}
TagBlockValueElem represents a tag value element.
func (*TagBlockValueElem) Deleted ¶
func (e *TagBlockValueElem) Deleted() bool
Deleted returns true if the element has been tombstoned.
func (*TagBlockValueElem) SeriesID ¶
func (e *TagBlockValueElem) SeriesID(i int) uint64
SeriesID returns series ID at an index.
func (*TagBlockValueElem) SeriesIDs ¶
func (e *TagBlockValueElem) SeriesIDs() []uint64
SeriesIDs returns a list decoded series ids.
func (*TagBlockValueElem) SeriesN ¶
func (e *TagBlockValueElem) SeriesN() uint64
SeriesN returns the series count.
func (*TagBlockValueElem) Value ¶
func (e *TagBlockValueElem) Value() []byte
Value returns the value for the element.
type TagKeyElem ¶
type TagKeyElem interface { Key() []byte Deleted() bool TagValueIterator() TagValueIterator }
TagKeyElem represents a generic tag key element.
type TagKeyIterator ¶
type TagKeyIterator interface {
Next() TagKeyElem
}
TagKeyIterator represents a iterator over a list of tag keys.
func MergeTagKeyIterators ¶
func MergeTagKeyIterators(itrs ...TagKeyIterator) TagKeyIterator
MergeTagKeyIterators returns an iterator that merges a set of iterators. Iterators that are first in the list take precendence and a deletion by those early iterators will invalidate elements by later iterators.
type TagValueElem ¶
TagValueElem represents a generic tag value element.
type TagValueIterator ¶
type TagValueIterator interface {
Next() TagValueElem
}
TagValueIterator represents a iterator over a list of tag values.
func MergeTagValueIterators ¶
func MergeTagValueIterators(itrs ...TagValueIterator) TagValueIterator
MergeTagValueIterators returns an iterator that merges a set of iterators. Iterators that are first in the list take precendence and a deletion by those early iterators will invalidate elements by later iterators.