id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
124,700
influxdata/influxdb
tsdb/tsi1/index.go
DropSeries
func (i *Index) DropSeries(seriesID tsdb.SeriesID, key []byte, cascade bool) error { // Remove from partition. if err := i.partition(key).DropSeries(seriesID); err != nil { return err } if !cascade { return nil } // Extract measurement name & tags. name, tags := models.ParseKeyBytes(key) // If there are ...
go
func (i *Index) DropSeries(seriesID tsdb.SeriesID, key []byte, cascade bool) error { // Remove from partition. if err := i.partition(key).DropSeries(seriesID); err != nil { return err } if !cascade { return nil } // Extract measurement name & tags. name, tags := models.ParseKeyBytes(key) // If there are ...
[ "func", "(", "i", "*", "Index", ")", "DropSeries", "(", "seriesID", "tsdb", ".", "SeriesID", ",", "key", "[", "]", "byte", ",", "cascade", "bool", ")", "error", "{", "// Remove from partition.", "if", "err", ":=", "i", ".", "partition", "(", "key", ")"...
// DropSeries drops the provided series from the index. If cascade is true // and this is the last series to the measurement, the measurment will also be dropped.
[ "DropSeries", "drops", "the", "provided", "series", "from", "the", "index", ".", "If", "cascade", "is", "true", "and", "this", "is", "the", "last", "series", "to", "the", "measurement", "the", "measurment", "will", "also", "be", "dropped", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L728-L763
124,701
influxdata/influxdb
tsdb/tsi1/index.go
DropMeasurementIfSeriesNotExist
func (i *Index) DropMeasurementIfSeriesNotExist(name []byte) error { // Check if that was the last series for the measurement in the entire index. if ok, err := i.MeasurementHasSeries(name); err != nil { return err } else if ok { return nil } // If no more series exist in the measurement then delete the measu...
go
func (i *Index) DropMeasurementIfSeriesNotExist(name []byte) error { // Check if that was the last series for the measurement in the entire index. if ok, err := i.MeasurementHasSeries(name); err != nil { return err } else if ok { return nil } // If no more series exist in the measurement then delete the measu...
[ "func", "(", "i", "*", "Index", ")", "DropMeasurementIfSeriesNotExist", "(", "name", "[", "]", "byte", ")", "error", "{", "// Check if that was the last series for the measurement in the entire index.", "if", "ok", ",", "err", ":=", "i", ".", "MeasurementHasSeries", "...
// DropMeasurementIfSeriesNotExist drops a measurement only if there are no more // series for the measurment.
[ "DropMeasurementIfSeriesNotExist", "drops", "a", "measurement", "only", "if", "there", "are", "no", "more", "series", "for", "the", "measurment", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L770-L780
124,702
influxdata/influxdb
tsdb/tsi1/index.go
SeriesN
func (i *Index) SeriesN() int64 { var total int64 for _, p := range i.partitions { total += int64(p.seriesIDSet.Cardinality()) } return total }
go
func (i *Index) SeriesN() int64 { var total int64 for _, p := range i.partitions { total += int64(p.seriesIDSet.Cardinality()) } return total }
[ "func", "(", "i", "*", "Index", ")", "SeriesN", "(", ")", "int64", "{", "var", "total", "int64", "\n", "for", "_", ",", "p", ":=", "range", "i", ".", "partitions", "{", "total", "+=", "int64", "(", "p", ".", "seriesIDSet", ".", "Cardinality", "(", ...
// SeriesN returns the series cardinality in the index. It is the sum of all // partition cardinalities.
[ "SeriesN", "returns", "the", "series", "cardinality", "in", "the", "index", ".", "It", "is", "the", "sum", "of", "all", "partition", "cardinalities", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L784-L790
124,703
influxdata/influxdb
tsdb/tsi1/index.go
HasTagKey
func (i *Index) HasTagKey(name, key []byte) (bool, error) { n := i.availableThreads() // Store errors var found uint32 // Use this to signal we found the tag key. errC := make(chan error, i.PartitionN) // Check each partition for the tag key concurrently. var pidx uint32 // Index of maximum Partition being work...
go
func (i *Index) HasTagKey(name, key []byte) (bool, error) { n := i.availableThreads() // Store errors var found uint32 // Use this to signal we found the tag key. errC := make(chan error, i.PartitionN) // Check each partition for the tag key concurrently. var pidx uint32 // Index of maximum Partition being work...
[ "func", "(", "i", "*", "Index", ")", "HasTagKey", "(", "name", ",", "key", "[", "]", "byte", ")", "(", "bool", ",", "error", ")", "{", "n", ":=", "i", ".", "availableThreads", "(", ")", "\n\n", "// Store errors", "var", "found", "uint32", "// Use thi...
// HasTagKey returns true if tag key exists. It returns the first error // encountered if any.
[ "HasTagKey", "returns", "true", "if", "tag", "key", "exists", ".", "It", "returns", "the", "first", "error", "encountered", "if", "any", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L794-L836
124,704
influxdata/influxdb
tsdb/tsi1/index.go
tagKeySeriesIDIterator
func (i *Index) tagKeySeriesIDIterator(name, key []byte) (tsdb.SeriesIDIterator, error) { a := make([]tsdb.SeriesIDIterator, 0, len(i.partitions)) for _, p := range i.partitions { itr, err := p.TagKeySeriesIDIterator(name, key) if err != nil { for _, itr := range a { itr.Close() } return nil, err }...
go
func (i *Index) tagKeySeriesIDIterator(name, key []byte) (tsdb.SeriesIDIterator, error) { a := make([]tsdb.SeriesIDIterator, 0, len(i.partitions)) for _, p := range i.partitions { itr, err := p.TagKeySeriesIDIterator(name, key) if err != nil { for _, itr := range a { itr.Close() } return nil, err }...
[ "func", "(", "i", "*", "Index", ")", "tagKeySeriesIDIterator", "(", "name", ",", "key", "[", "]", "byte", ")", "(", "tsdb", ".", "SeriesIDIterator", ",", "error", ")", "{", "a", ":=", "make", "(", "[", "]", "tsdb", ".", "SeriesIDIterator", ",", "0", ...
// tagKeySeriesIDIterator returns a series iterator for all values across a single key.
[ "tagKeySeriesIDIterator", "returns", "a", "series", "iterator", "for", "all", "values", "across", "a", "single", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L927-L942
124,705
influxdata/influxdb
tsdb/tsi1/index.go
DiskSizeBytes
func (i *Index) DiskSizeBytes() int64 { fs, err := i.FileSet() if err != nil { i.logger.Warn("Index is closing down") return 0 } defer fs.Release() var manifestSize int64 // Get MANIFEST sizes from each partition. for _, p := range i.partitions { manifestSize += p.manifestSize } return fs.Size() + manif...
go
func (i *Index) DiskSizeBytes() int64 { fs, err := i.FileSet() if err != nil { i.logger.Warn("Index is closing down") return 0 } defer fs.Release() var manifestSize int64 // Get MANIFEST sizes from each partition. for _, p := range i.partitions { manifestSize += p.manifestSize } return fs.Size() + manif...
[ "func", "(", "i", "*", "Index", ")", "DiskSizeBytes", "(", ")", "int64", "{", "fs", ",", "err", ":=", "i", ".", "FileSet", "(", ")", "\n", "if", "err", "!=", "nil", "{", "i", ".", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "...
// DiskSizeBytes returns the size of the index on disk.
[ "DiskSizeBytes", "returns", "the", "size", "of", "the", "index", "on", "disk", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L1135-L1149
124,706
influxdata/influxdb
tsdb/tsi1/index.go
FileSet
func (i *Index) FileSet() (*FileSet, error) { i.mu.RLock() defer i.mu.RUnlock() // Keep track of all of the file sets returned from the partitions temporarily. // Keeping them alive keeps all of their underlying files alive. We release // whatever we have when we return. fss := make([]*FileSet, 0, len(i.partitio...
go
func (i *Index) FileSet() (*FileSet, error) { i.mu.RLock() defer i.mu.RUnlock() // Keep track of all of the file sets returned from the partitions temporarily. // Keeping them alive keeps all of their underlying files alive. We release // whatever we have when we return. fss := make([]*FileSet, 0, len(i.partitio...
[ "func", "(", "i", "*", "Index", ")", "FileSet", "(", ")", "(", "*", "FileSet", ",", "error", ")", "{", "i", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "// Keep track of all of the file sets ret...
// FileSet returns the set of all files across all partitions. It must be released.
[ "FileSet", "returns", "the", "set", "of", "all", "files", "across", "all", "partitions", ".", "It", "must", "be", "released", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L1159-L1188
124,707
influxdata/influxdb
tsdb/tsi1/index.go
ComputeMeasurementCardinalityStats
func (i *Index) ComputeMeasurementCardinalityStats() (MeasurementCardinalityStats, error) { i.mu.RLock() defer i.mu.RUnlock() stats := NewMeasurementCardinalityStats() for _, p := range i.partitions { pstats, err := p.ComputeMeasurementCardinalityStats() if err != nil { return nil, err } stats.Add(pstat...
go
func (i *Index) ComputeMeasurementCardinalityStats() (MeasurementCardinalityStats, error) { i.mu.RLock() defer i.mu.RUnlock() stats := NewMeasurementCardinalityStats() for _, p := range i.partitions { pstats, err := p.ComputeMeasurementCardinalityStats() if err != nil { return nil, err } stats.Add(pstat...
[ "func", "(", "i", "*", "Index", ")", "ComputeMeasurementCardinalityStats", "(", ")", "(", "MeasurementCardinalityStats", ",", "error", ")", "{", "i", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "s...
// ComputeMeasurementCardinalityStats computes the cardinality stats from raw index data.
[ "ComputeMeasurementCardinalityStats", "computes", "the", "cardinality", "stats", "from", "raw", "index", "data", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L1209-L1222
124,708
influxdata/influxdb
tsdb/tsi1/index.go
matchTagValueSeriesIDIterator
func (i *Index) matchTagValueSeriesIDIterator(name, key []byte, value *regexp.Regexp, matches bool) (tsdb.SeriesIDIterator, error) { matchEmpty := value.MatchString("") if matches { if matchEmpty { return i.matchTagValueEqualEmptySeriesIDIterator(name, key, value) } return i.matchTagValueEqualNotEmptySeriesI...
go
func (i *Index) matchTagValueSeriesIDIterator(name, key []byte, value *regexp.Regexp, matches bool) (tsdb.SeriesIDIterator, error) { matchEmpty := value.MatchString("") if matches { if matchEmpty { return i.matchTagValueEqualEmptySeriesIDIterator(name, key, value) } return i.matchTagValueEqualNotEmptySeriesI...
[ "func", "(", "i", "*", "Index", ")", "matchTagValueSeriesIDIterator", "(", "name", ",", "key", "[", "]", "byte", ",", "value", "*", "regexp", ".", "Regexp", ",", "matches", "bool", ")", "(", "tsdb", ".", "SeriesIDIterator", ",", "error", ")", "{", "mat...
// matchTagValueSeriesIDIterator returns a series iterator for tags which match // value. See MatchTagValueSeriesIDIterator for more details. // // It guarantees to never take any locks on the underlying series file.
[ "matchTagValueSeriesIDIterator", "returns", "a", "series", "iterator", "for", "tags", "which", "match", "value", ".", "See", "MatchTagValueSeriesIDIterator", "for", "more", "details", ".", "It", "guarantees", "to", "never", "take", "any", "locks", "on", "the", "un...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L1446-L1459
124,709
influxdata/influxdb
tsdb/tsi1/index.go
IsIndexDir
func IsIndexDir(path string) (bool, error) { fis, err := ioutil.ReadDir(path) if err != nil { return false, err } for _, fi := range fis { if !fi.IsDir() { continue } else if ok, err := IsPartitionDir(filepath.Join(path, fi.Name())); err != nil { return false, err } else if ok { return true, nil ...
go
func IsIndexDir(path string) (bool, error) { fis, err := ioutil.ReadDir(path) if err != nil { return false, err } for _, fi := range fis { if !fi.IsDir() { continue } else if ok, err := IsPartitionDir(filepath.Join(path, fi.Name())); err != nil { return false, err } else if ok { return true, nil ...
[ "func", "IsIndexDir", "(", "path", "string", ")", "(", "bool", ",", "error", ")", "{", "fis", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "for"...
// IsIndexDir returns true if directory contains at least one partition directory.
[ "IsIndexDir", "returns", "true", "if", "directory", "contains", "at", "least", "one", "partition", "directory", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L1606-L1621
124,710
influxdata/influxdb
query/influxql/dialect.go
AddDialectMappings
func AddDialectMappings(mappings flux.DialectMappings) error { return mappings.Add(DialectType, func() flux.Dialect { return new(Dialect) }) }
go
func AddDialectMappings(mappings flux.DialectMappings) error { return mappings.Add(DialectType, func() flux.Dialect { return new(Dialect) }) }
[ "func", "AddDialectMappings", "(", "mappings", "flux", ".", "DialectMappings", ")", "error", "{", "return", "mappings", ".", "Add", "(", "DialectType", ",", "func", "(", ")", "flux", ".", "Dialect", "{", "return", "new", "(", "Dialect", ")", "\n", "}", "...
// AddDialectMappings adds the influxql specific dialect mappings.
[ "AddDialectMappings", "adds", "the", "influxql", "specific", "dialect", "mappings", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/dialect.go#L12-L16
124,711
influxdata/influxdb
chronograf/server/mux.go
AuthAPI
func AuthAPI(opts MuxOpts, router chronograf.Router) (http.Handler, AuthRoutes) { routes := AuthRoutes{} for _, pf := range opts.ProviderFuncs { pf(func(p oauth2.Provider, m oauth2.Mux) { urlName := PathEscape(strings.ToLower(p.Name())) loginPath := path.Join("/oauth", urlName, "login") logoutPath := path...
go
func AuthAPI(opts MuxOpts, router chronograf.Router) (http.Handler, AuthRoutes) { routes := AuthRoutes{} for _, pf := range opts.ProviderFuncs { pf(func(p oauth2.Provider, m oauth2.Mux) { urlName := PathEscape(strings.ToLower(p.Name())) loginPath := path.Join("/oauth", urlName, "login") logoutPath := path...
[ "func", "AuthAPI", "(", "opts", "MuxOpts", ",", "router", "chronograf", ".", "Router", ")", "(", "http", ".", "Handler", ",", "AuthRoutes", ")", "{", "routes", ":=", "AuthRoutes", "{", "}", "\n", "for", "_", ",", "pf", ":=", "range", "opts", ".", "Pr...
// AuthAPI adds the OAuth routes if auth is enabled.
[ "AuthAPI", "adds", "the", "OAuth", "routes", "if", "auth", "is", "enabled", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/mux.go#L354-L394
124,712
influxdata/influxdb
chronograf/server/mux.go
Error
func Error(w http.ResponseWriter, code int, msg string, logger chronograf.Logger) { e := ErrorMessage{ Code: code, Message: msg, } b, err := json.Marshal(e) if err != nil { code = http.StatusInternalServerError b = []byte(`{"code": 500, "message":"server_error"}`) } logger. WithField("component", "s...
go
func Error(w http.ResponseWriter, code int, msg string, logger chronograf.Logger) { e := ErrorMessage{ Code: code, Message: msg, } b, err := json.Marshal(e) if err != nil { code = http.StatusInternalServerError b = []byte(`{"code": 500, "message":"server_error"}`) } logger. WithField("component", "s...
[ "func", "Error", "(", "w", "http", ".", "ResponseWriter", ",", "code", "int", ",", "msg", "string", ",", "logger", "chronograf", ".", "Logger", ")", "{", "e", ":=", "ErrorMessage", "{", "Code", ":", "code", ",", "Message", ":", "msg", ",", "}", "\n",...
// Error writes an JSON message
[ "Error", "writes", "an", "JSON", "message" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/mux.go#L405-L423
124,713
influxdata/influxdb
task/backend/inmem_store.go
NewInMemStore
func NewInMemStore() Store { return &inmem{ idgen: snowflake.NewIDGenerator(), meta: map[platform.ID]StoreTaskMeta{}, } }
go
func NewInMemStore() Store { return &inmem{ idgen: snowflake.NewIDGenerator(), meta: map[platform.ID]StoreTaskMeta{}, } }
[ "func", "NewInMemStore", "(", ")", "Store", "{", "return", "&", "inmem", "{", "idgen", ":", "snowflake", ".", "NewIDGenerator", "(", ")", ",", "meta", ":", "map", "[", "platform", ".", "ID", "]", "StoreTaskMeta", "{", "}", ",", "}", "\n", "}" ]
// NewInMemStore returns a new in-memory store. // This store is not designed to be efficient, it is here for testing purposes.
[ "NewInMemStore", "returns", "a", "new", "in", "-", "memory", "store", ".", "This", "store", "is", "not", "designed", "to", "be", "efficient", "it", "is", "here", "for", "testing", "purposes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/inmem_store.go#L32-L37
124,714
influxdata/influxdb
task/backend/inmem_store.go
DeleteOrg
func (s *inmem) DeleteOrg(ctx context.Context, id platform.ID) error { return s.delete(ctx, id, getOrg) }
go
func (s *inmem) DeleteOrg(ctx context.Context, id platform.ID) error { return s.delete(ctx, id, getOrg) }
[ "func", "(", "s", "*", "inmem", ")", "DeleteOrg", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "error", "{", "return", "s", ".", "delete", "(", "ctx", ",", "id", ",", "getOrg", ")", "\n", "}" ]
// DeleteOrg synchronously deletes an org and all their tasks from a from an in-mem store store.
[ "DeleteOrg", "synchronously", "deletes", "an", "org", "and", "all", "their", "tasks", "from", "a", "from", "an", "in", "-", "mem", "store", "store", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/inmem_store.go#L356-L358
124,715
influxdata/influxdb
prometheus/filter.go
Gather
func (f *Filter) Gather() ([]*dto.MetricFamily, error) { mfs, err := f.Gatherer.Gather() if err != nil { return nil, err } return f.Matcher.Match(mfs), nil }
go
func (f *Filter) Gather() ([]*dto.MetricFamily, error) { mfs, err := f.Gatherer.Gather() if err != nil { return nil, err } return f.Matcher.Match(mfs), nil }
[ "func", "(", "f", "*", "Filter", ")", "Gather", "(", ")", "(", "[", "]", "*", "dto", ".", "MetricFamily", ",", "error", ")", "{", "mfs", ",", "err", ":=", "f", ".", "Gatherer", ".", "Gather", "(", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// Gather filters all metrics to only those that match the Matcher.
[ "Gather", "filters", "all", "metrics", "to", "only", "those", "that", "match", "the", "Matcher", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/filter.go#L20-L26
124,716
influxdata/influxdb
prometheus/filter.go
Family
func (m Matcher) Family(name string, lps ...*dto.LabelPair) Matcher { // prometheus metrics labels are sorted by label name. sort.Slice(lps, func(i, j int) bool { return lps[i].GetName() < lps[j].GetName() }) pairs := &labelPairs{ Label: lps, } family, ok := m[name] if !ok { family = make(Labels) } fa...
go
func (m Matcher) Family(name string, lps ...*dto.LabelPair) Matcher { // prometheus metrics labels are sorted by label name. sort.Slice(lps, func(i, j int) bool { return lps[i].GetName() < lps[j].GetName() }) pairs := &labelPairs{ Label: lps, } family, ok := m[name] if !ok { family = make(Labels) } fa...
[ "func", "(", "m", "Matcher", ")", "Family", "(", "name", "string", ",", "lps", "...", "*", "dto", ".", "LabelPair", ")", "Matcher", "{", "// prometheus metrics labels are sorted by label name.", "sort", ".", "Slice", "(", "lps", ",", "func", "(", "i", ",", ...
// Family helps constuct match by adding a metric family to match to.
[ "Family", "helps", "constuct", "match", "by", "adding", "a", "metric", "family", "to", "match", "to", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/filter.go#L37-L55
124,717
influxdata/influxdb
prometheus/filter.go
Match
func (m Matcher) Match(mfs []*dto.MetricFamily) []*dto.MetricFamily { if len(mfs) == 0 { return mfs } filteredFamilies := []*dto.MetricFamily{} for _, mf := range mfs { labels, ok := m[mf.GetName()] if !ok { continue } metrics := []*dto.Metric{} match := false for _, metric := range mf.Metric { ...
go
func (m Matcher) Match(mfs []*dto.MetricFamily) []*dto.MetricFamily { if len(mfs) == 0 { return mfs } filteredFamilies := []*dto.MetricFamily{} for _, mf := range mfs { labels, ok := m[mf.GetName()] if !ok { continue } metrics := []*dto.Metric{} match := false for _, metric := range mf.Metric { ...
[ "func", "(", "m", "Matcher", ")", "Match", "(", "mfs", "[", "]", "*", "dto", ".", "MetricFamily", ")", "[", "]", "*", "dto", ".", "MetricFamily", "{", "if", "len", "(", "mfs", ")", "==", "0", "{", "return", "mfs", "\n", "}", "\n\n", "filteredFami...
// Match returns all metric families that match.
[ "Match", "returns", "all", "metric", "families", "that", "match", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/filter.go#L58-L90
124,718
influxdata/influxdb
prometheus/filter.go
L
func L(name, value string) *dto.LabelPair { return &dto.LabelPair{ Name: proto.String(name), Value: proto.String(value), } }
go
func L(name, value string) *dto.LabelPair { return &dto.LabelPair{ Name: proto.String(name), Value: proto.String(value), } }
[ "func", "L", "(", "name", ",", "value", "string", ")", "*", "dto", ".", "LabelPair", "{", "return", "&", "dto", ".", "LabelPair", "{", "Name", ":", "proto", ".", "String", "(", "name", ")", ",", "Value", ":", "proto", ".", "String", "(", "value", ...
// L is used with Family to create a series of label pairs for matching.
[ "L", "is", "used", "with", "Family", "to", "create", "a", "series", "of", "label", "pairs", "for", "matching", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/filter.go#L93-L98
124,719
influxdata/influxdb
prometheus/filter.go
Match
func (ls Labels) Match(metric *dto.Metric) bool { lp := &labelPairs{metric.Label} return ls[lp.String()] || ls[""] // match empty string so no labels can be matched. }
go
func (ls Labels) Match(metric *dto.Metric) bool { lp := &labelPairs{metric.Label} return ls[lp.String()] || ls[""] // match empty string so no labels can be matched. }
[ "func", "(", "ls", "Labels", ")", "Match", "(", "metric", "*", "dto", ".", "Metric", ")", "bool", "{", "lp", ":=", "&", "labelPairs", "{", "metric", ".", "Label", "}", "\n", "return", "ls", "[", "lp", ".", "String", "(", ")", "]", "||", "ls", "...
// Match checks if the metric's labels matches this set of labels.
[ "Match", "checks", "if", "the", "metric", "s", "labels", "matches", "this", "set", "of", "labels", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/filter.go#L105-L108
124,720
influxdata/influxdb
http/onboarding.go
NewSetupBackend
func NewSetupBackend(b *APIBackend) *SetupBackend { return &SetupBackend{ Logger: b.Logger.With(zap.String("handler", "setup")), OnboardingService: b.OnboardingService, } }
go
func NewSetupBackend(b *APIBackend) *SetupBackend { return &SetupBackend{ Logger: b.Logger.With(zap.String("handler", "setup")), OnboardingService: b.OnboardingService, } }
[ "func", "NewSetupBackend", "(", "b", "*", "APIBackend", ")", "*", "SetupBackend", "{", "return", "&", "SetupBackend", "{", "Logger", ":", "b", ".", "Logger", ".", "With", "(", "zap", ".", "String", "(", "\"", "\"", ",", "\"", "\"", ")", ")", ",", "...
// NewSetupBackend returns a new instance of SetupBackend.
[ "NewSetupBackend", "returns", "a", "new", "instance", "of", "SetupBackend", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/onboarding.go#L22-L27
124,721
influxdata/influxdb
gather/recorder.go
Record
func (s PointWriter) Record(collected MetricsCollection) error { ps, err := collected.MetricsSlice.Points() if err != nil { return err } ps, err = tsdb.ExplodePoints(collected.OrgID, collected.BucketID, ps) if err != nil { return err } return s.Writer.WritePoints(context.TODO(), ps) }
go
func (s PointWriter) Record(collected MetricsCollection) error { ps, err := collected.MetricsSlice.Points() if err != nil { return err } ps, err = tsdb.ExplodePoints(collected.OrgID, collected.BucketID, ps) if err != nil { return err } return s.Writer.WritePoints(context.TODO(), ps) }
[ "func", "(", "s", "PointWriter", ")", "Record", "(", "collected", "MetricsCollection", ")", "error", "{", "ps", ",", "err", ":=", "collected", ".", "MetricsSlice", ".", "Points", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}"...
// Record the metrics and write using storage.PointWriter interface.
[ "Record", "the", "metrics", "and", "write", "using", "storage", ".", "PointWriter", "interface", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/gather/recorder.go#L19-L30
124,722
influxdata/influxdb
gather/recorder.go
Process
func (h *RecorderHandler) Process(s nats.Subscription, m nats.Message) { defer m.Ack() collected := new(MetricsCollection) err := json.Unmarshal(m.Data(), &collected) if err != nil { h.Logger.Error("recorder handler error", zap.Error(err)) return } err = h.Recorder.Record(*collected) if err != nil { h.Logg...
go
func (h *RecorderHandler) Process(s nats.Subscription, m nats.Message) { defer m.Ack() collected := new(MetricsCollection) err := json.Unmarshal(m.Data(), &collected) if err != nil { h.Logger.Error("recorder handler error", zap.Error(err)) return } err = h.Recorder.Record(*collected) if err != nil { h.Logg...
[ "func", "(", "h", "*", "RecorderHandler", ")", "Process", "(", "s", "nats", ".", "Subscription", ",", "m", "nats", ".", "Message", ")", "{", "defer", "m", ".", "Ack", "(", ")", "\n", "collected", ":=", "new", "(", "MetricsCollection", ")", "\n", "err...
// Process consumes job queue, and use recorder to record.
[ "Process", "consumes", "job", "queue", "and", "use", "recorder", "to", "record", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/gather/recorder.go#L45-L57
124,723
influxdata/influxdb
kv/passwords.go
CompareAndSetPassword
func (s *Service) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error { return s.kv.Update(ctx, func(tx Tx) error { if err := s.comparePassword(ctx, tx, name, old); err != nil { return err } return s.setPassword(ctx, tx, name, new) }) }
go
func (s *Service) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error { return s.kv.Update(ctx, func(tx Tx) error { if err := s.comparePassword(ctx, tx, name, old); err != nil { return err } return s.setPassword(ctx, tx, name, new) }) }
[ "func", "(", "s", "*", "Service", ")", "CompareAndSetPassword", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "old", "string", ",", "new", "string", ")", "error", "{", "return", "s", ".", "kv", ".", "Update", "(", "ctx", ",", "fu...
// CompareAndSetPassword checks the password and if they match // updates to the new password.
[ "CompareAndSetPassword", "checks", "the", "password", "and", "if", "they", "match", "updates", "to", "the", "new", "password", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/passwords.go#L75-L82
124,724
influxdata/influxdb
kv/passwords.go
SetPassword
func (s *Service) SetPassword(ctx context.Context, name string, password string) error { return s.kv.Update(ctx, func(tx Tx) error { return s.setPassword(ctx, tx, name, password) }) }
go
func (s *Service) SetPassword(ctx context.Context, name string, password string) error { return s.kv.Update(ctx, func(tx Tx) error { return s.setPassword(ctx, tx, name, password) }) }
[ "func", "(", "s", "*", "Service", ")", "SetPassword", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "password", "string", ")", "error", "{", "return", "s", ".", "kv", ".", "Update", "(", "ctx", ",", "func", "(", "tx", "Tx", ")"...
// SetPassword overrides the password of a known user.
[ "SetPassword", "overrides", "the", "password", "of", "a", "known", "user", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/passwords.go#L85-L89
124,725
influxdata/influxdb
kv/passwords.go
ComparePassword
func (s *Service) ComparePassword(ctx context.Context, name string, password string) error { return s.kv.View(ctx, func(tx Tx) error { return s.comparePassword(ctx, tx, name, password) }) }
go
func (s *Service) ComparePassword(ctx context.Context, name string, password string) error { return s.kv.View(ctx, func(tx Tx) error { return s.comparePassword(ctx, tx, name, password) }) }
[ "func", "(", "s", "*", "Service", ")", "ComparePassword", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "password", "string", ")", "error", "{", "return", "s", ".", "kv", ".", "View", "(", "ctx", ",", "func", "(", "tx", "Tx", "...
// ComparePassword checks if the password matches the password recorded. // Passwords that do not match return errors.
[ "ComparePassword", "checks", "if", "the", "password", "matches", "the", "password", "recorded", ".", "Passwords", "that", "do", "not", "match", "return", "errors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/passwords.go#L93-L97
124,726
influxdata/influxdb
kv/passwords.go
CompareHashAndPassword
func (b *Bcrypt) CompareHashAndPassword(hashedPassword, password []byte) error { return bcrypt.CompareHashAndPassword(hashedPassword, password) }
go
func (b *Bcrypt) CompareHashAndPassword(hashedPassword, password []byte) error { return bcrypt.CompareHashAndPassword(hashedPassword, password) }
[ "func", "(", "b", "*", "Bcrypt", ")", "CompareHashAndPassword", "(", "hashedPassword", ",", "password", "[", "]", "byte", ")", "error", "{", "return", "bcrypt", ".", "CompareHashAndPassword", "(", "hashedPassword", ",", "password", ")", "\n", "}" ]
// CompareHashAndPassword compares a hashed password with its possible plaintext equivalent. // Returns nil on success, or an error on failure.
[ "CompareHashAndPassword", "compares", "a", "hashed", "password", "with", "its", "possible", "plaintext", "equivalent", ".", "Returns", "nil", "on", "success", "or", "an", "error", "on", "failure", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/passwords.go#L190-L192
124,727
influxdata/influxdb
kv/passwords.go
GenerateFromPassword
func (b *Bcrypt) GenerateFromPassword(password []byte, cost int) ([]byte, error) { if cost < bcrypt.MinCost { cost = DefaultCost } return bcrypt.GenerateFromPassword(password, cost) }
go
func (b *Bcrypt) GenerateFromPassword(password []byte, cost int) ([]byte, error) { if cost < bcrypt.MinCost { cost = DefaultCost } return bcrypt.GenerateFromPassword(password, cost) }
[ "func", "(", "b", "*", "Bcrypt", ")", "GenerateFromPassword", "(", "password", "[", "]", "byte", ",", "cost", "int", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "cost", "<", "bcrypt", ".", "MinCost", "{", "cost", "=", "DefaultCost", "...
// GenerateFromPassword returns the hash of the password at the given cost. // If the cost given is less than MinCost, the cost will be set to DefaultCost, instead.
[ "GenerateFromPassword", "returns", "the", "hash", "of", "the", "password", "at", "the", "given", "cost", ".", "If", "the", "cost", "given", "is", "less", "than", "MinCost", "the", "cost", "will", "be", "set", "to", "DefaultCost", "instead", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/passwords.go#L196-L201
124,728
influxdata/influxdb
chronograf/filestore/apps.go
NewApps
func NewApps(dir string, ids chronograf.ID, logger chronograf.Logger) chronograf.LayoutsStore { return &Apps{ Dir: dir, Load: loadFile, Filename: fileName, Create: createLayout, ReadDir: ioutil.ReadDir, Remove: os.Remove, IDs: ids, Logger: logger, } }
go
func NewApps(dir string, ids chronograf.ID, logger chronograf.Logger) chronograf.LayoutsStore { return &Apps{ Dir: dir, Load: loadFile, Filename: fileName, Create: createLayout, ReadDir: ioutil.ReadDir, Remove: os.Remove, IDs: ids, Logger: logger, } }
[ "func", "NewApps", "(", "dir", "string", ",", "ids", "chronograf", ".", "ID", ",", "logger", "chronograf", ".", "Logger", ")", "chronograf", ".", "LayoutsStore", "{", "return", "&", "Apps", "{", "Dir", ":", "dir", ",", "Load", ":", "loadFile", ",", "Fi...
// NewApps constructs a layout store wrapping a file system directory
[ "NewApps", "constructs", "a", "layout", "store", "wrapping", "a", "file", "system", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/apps.go#L30-L41
124,729
influxdata/influxdb
chronograf/filestore/apps.go
All
func (a *Apps) All(ctx context.Context) ([]chronograf.Layout, error) { files, err := a.ReadDir(a.Dir) if err != nil { return nil, err } layouts := []chronograf.Layout{} for _, file := range files { if path.Ext(file.Name()) != AppExt { continue } if layout, err := a.Load(path.Join(a.Dir, file.Name())); ...
go
func (a *Apps) All(ctx context.Context) ([]chronograf.Layout, error) { files, err := a.ReadDir(a.Dir) if err != nil { return nil, err } layouts := []chronograf.Layout{} for _, file := range files { if path.Ext(file.Name()) != AppExt { continue } if layout, err := a.Load(path.Join(a.Dir, file.Name())); ...
[ "func", "(", "a", "*", "Apps", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Layout", ",", "error", ")", "{", "files", ",", "err", ":=", "a", ".", "ReadDir", "(", "a", ".", "Dir", ")", "\n", "if", ...
// All returns all layouts from the directory
[ "All", "returns", "all", "layouts", "from", "the", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/apps.go#L76-L94
124,730
influxdata/influxdb
chronograf/filestore/apps.go
Add
func (a *Apps) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) { var err error layout.ID, err = a.IDs.Generate() if err != nil { a.Logger. WithField("component", "apps"). Error("Unable to generate ID") return chronograf.Layout{}, err } file := a.Filename(a.Dir, layout) if e...
go
func (a *Apps) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) { var err error layout.ID, err = a.IDs.Generate() if err != nil { a.Logger. WithField("component", "apps"). Error("Unable to generate ID") return chronograf.Layout{}, err } file := a.Filename(a.Dir, layout) if e...
[ "func", "(", "a", "*", "Apps", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "layout", "chronograf", ".", "Layout", ")", "(", "chronograf", ".", "Layout", ",", "error", ")", "{", "var", "err", "error", "\n", "layout", ".", "ID", ",", "err...
// Add creates a new layout within the directory
[ "Add", "creates", "a", "new", "layout", "within", "the", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/apps.go#L97-L122
124,731
influxdata/influxdb
chronograf/filestore/apps.go
Delete
func (a *Apps) Delete(ctx context.Context, layout chronograf.Layout) error { _, file, err := a.idToFile(layout.ID) if err != nil { return err } if err := a.Remove(file); err != nil { a.Logger. WithField("component", "apps"). WithField("name", file). Error("Unable to remove layout:", err) return err ...
go
func (a *Apps) Delete(ctx context.Context, layout chronograf.Layout) error { _, file, err := a.idToFile(layout.ID) if err != nil { return err } if err := a.Remove(file); err != nil { a.Logger. WithField("component", "apps"). WithField("name", file). Error("Unable to remove layout:", err) return err ...
[ "func", "(", "a", "*", "Apps", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "layout", "chronograf", ".", "Layout", ")", "error", "{", "_", ",", "file", ",", "err", ":=", "a", ".", "idToFile", "(", "layout", ".", "ID", ")", "\n", "if...
// Delete removes a layout file from the directory
[ "Delete", "removes", "a", "layout", "file", "from", "the", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/apps.go#L125-L139
124,732
influxdata/influxdb
chronograf/filestore/apps.go
Get
func (a *Apps) Get(ctx context.Context, ID string) (chronograf.Layout, error) { l, file, err := a.idToFile(ID) if err != nil { return chronograf.Layout{}, err } if err != nil { if err == chronograf.ErrLayoutNotFound { a.Logger. WithField("component", "apps"). WithField("name", file). Error("Unab...
go
func (a *Apps) Get(ctx context.Context, ID string) (chronograf.Layout, error) { l, file, err := a.idToFile(ID) if err != nil { return chronograf.Layout{}, err } if err != nil { if err == chronograf.ErrLayoutNotFound { a.Logger. WithField("component", "apps"). WithField("name", file). Error("Unab...
[ "func", "(", "a", "*", "Apps", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "ID", "string", ")", "(", "chronograf", ".", "Layout", ",", "error", ")", "{", "l", ",", "file", ",", "err", ":=", "a", ".", "idToFile", "(", "ID", ")", "\n"...
// Get returns an app file from the layout directory
[ "Get", "returns", "an", "app", "file", "from", "the", "layout", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/apps.go#L142-L163
124,733
influxdata/influxdb
chronograf/filestore/apps.go
Update
func (a *Apps) Update(ctx context.Context, layout chronograf.Layout) error { l, _, err := a.idToFile(layout.ID) if err != nil { return err } if err := a.Delete(ctx, l); err != nil { return err } file := a.Filename(a.Dir, layout) return a.Create(file, layout) }
go
func (a *Apps) Update(ctx context.Context, layout chronograf.Layout) error { l, _, err := a.idToFile(layout.ID) if err != nil { return err } if err := a.Delete(ctx, l); err != nil { return err } file := a.Filename(a.Dir, layout) return a.Create(file, layout) }
[ "func", "(", "a", "*", "Apps", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "layout", "chronograf", ".", "Layout", ")", "error", "{", "l", ",", "_", ",", "err", ":=", "a", ".", "idToFile", "(", "layout", ".", "ID", ")", "\n", "if", ...
// Update replaces a layout from the file system directory
[ "Update", "replaces", "a", "layout", "from", "the", "file", "system", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/apps.go#L166-L177
124,734
influxdata/influxdb
tsdb/tsm1/cache_entry.go
newEntryValues
func newEntryValues(values []Value) (*entry, error) { e := &entry{} e.values = make(Values, 0, len(values)) e.values = append(e.values, values...) // No values, don't check types and ordering if len(values) == 0 { return e, nil } et := valueType(values[0]) for _, v := range values { // Make sure all the v...
go
func newEntryValues(values []Value) (*entry, error) { e := &entry{} e.values = make(Values, 0, len(values)) e.values = append(e.values, values...) // No values, don't check types and ordering if len(values) == 0 { return e, nil } et := valueType(values[0]) for _, v := range values { // Make sure all the v...
[ "func", "newEntryValues", "(", "values", "[", "]", "Value", ")", "(", "*", "entry", ",", "error", ")", "{", "e", ":=", "&", "entry", "{", "}", "\n", "e", ".", "values", "=", "make", "(", "Values", ",", "0", ",", "len", "(", "values", ")", ")", ...
// newEntryValues returns a new instance of entry with the given values. If the // values are not valid, an error is returned.
[ "newEntryValues", "returns", "a", "new", "instance", "of", "entry", "with", "the", "given", "values", ".", "If", "the", "values", "are", "not", "valid", "an", "error", "is", "returned", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L21-L43
124,735
influxdata/influxdb
tsdb/tsm1/cache_entry.go
add
func (e *entry) add(values []Value) error { if len(values) == 0 { return nil // Nothing to do. } // Are any of the new values the wrong type? if e.vtype != 0 { for _, v := range values { if e.vtype != valueType(v) { return tsdb.ErrFieldTypeConflict } } } // entry currently has no values, so add ...
go
func (e *entry) add(values []Value) error { if len(values) == 0 { return nil // Nothing to do. } // Are any of the new values the wrong type? if e.vtype != 0 { for _, v := range values { if e.vtype != valueType(v) { return tsdb.ErrFieldTypeConflict } } } // entry currently has no values, so add ...
[ "func", "(", "e", "*", "entry", ")", "add", "(", "values", "[", "]", "Value", ")", "error", "{", "if", "len", "(", "values", ")", "==", "0", "{", "return", "nil", "// Nothing to do.", "\n", "}", "\n\n", "// Are any of the new values the wrong type?", "if",...
// add adds the given values to the entry.
[ "add", "adds", "the", "given", "values", "to", "the", "entry", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L46-L73
124,736
influxdata/influxdb
tsdb/tsm1/cache_entry.go
deduplicate
func (e *entry) deduplicate() { e.mu.Lock() defer e.mu.Unlock() if len(e.values) <= 1 { return } e.values = e.values.Deduplicate() }
go
func (e *entry) deduplicate() { e.mu.Lock() defer e.mu.Unlock() if len(e.values) <= 1 { return } e.values = e.values.Deduplicate() }
[ "func", "(", "e", "*", "entry", ")", "deduplicate", "(", ")", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "len", "(", "e", ".", "values", ")", "<=", "1", "{", "return", "...
// deduplicate sorts and orders the entry's values. If values are already deduped and sorted, // the function does no work and simply returns.
[ "deduplicate", "sorts", "and", "orders", "the", "entry", "s", "values", ".", "If", "values", "are", "already", "deduped", "and", "sorted", "the", "function", "does", "no", "work", "and", "simply", "returns", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L77-L85
124,737
influxdata/influxdb
tsdb/tsm1/cache_entry.go
count
func (e *entry) count() int { e.mu.RLock() n := len(e.values) e.mu.RUnlock() return n }
go
func (e *entry) count() int { e.mu.RLock() n := len(e.values) e.mu.RUnlock() return n }
[ "func", "(", "e", "*", "entry", ")", "count", "(", ")", "int", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\n", "n", ":=", "len", "(", "e", ".", "values", ")", "\n", "e", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "n", "\n", "...
// count returns the number of values in this entry.
[ "count", "returns", "the", "number", "of", "values", "in", "this", "entry", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L88-L93
124,738
influxdata/influxdb
tsdb/tsm1/cache_entry.go
filter
func (e *entry) filter(min, max int64) { e.mu.Lock() if len(e.values) > 1 { e.values = e.values.Deduplicate() } e.values = e.values.Exclude(min, max) e.mu.Unlock() }
go
func (e *entry) filter(min, max int64) { e.mu.Lock() if len(e.values) > 1 { e.values = e.values.Deduplicate() } e.values = e.values.Exclude(min, max) e.mu.Unlock() }
[ "func", "(", "e", "*", "entry", ")", "filter", "(", "min", ",", "max", "int64", ")", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "len", "(", "e", ".", "values", ")", ">", "1", "{", "e", ".", "values", "=", "e", ".", "values", ...
// filter removes all values with timestamps between min and max inclusive.
[ "filter", "removes", "all", "values", "with", "timestamps", "between", "min", "and", "max", "inclusive", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L96-L103
124,739
influxdata/influxdb
tsdb/tsm1/cache_entry.go
size
func (e *entry) size() int { e.mu.RLock() sz := e.values.Size() e.mu.RUnlock() return sz }
go
func (e *entry) size() int { e.mu.RLock() sz := e.values.Size() e.mu.RUnlock() return sz }
[ "func", "(", "e", "*", "entry", ")", "size", "(", ")", "int", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\n", "sz", ":=", "e", ".", "values", ".", "Size", "(", ")", "\n", "e", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "sz", ...
// size returns the size of this entry in bytes.
[ "size", "returns", "the", "size", "of", "this", "entry", "in", "bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L106-L111
124,740
influxdata/influxdb
tsdb/tsm1/cache_entry.go
InfluxQLType
func (e *entry) InfluxQLType() (influxql.DataType, error) { e.mu.RLock() defer e.mu.RUnlock() return e.values.InfluxQLType() }
go
func (e *entry) InfluxQLType() (influxql.DataType, error) { e.mu.RLock() defer e.mu.RUnlock() return e.values.InfluxQLType() }
[ "func", "(", "e", "*", "entry", ")", "InfluxQLType", "(", ")", "(", "influxql", ".", "DataType", ",", "error", ")", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "e", ".", ...
// InfluxQLType returns for the entry the data type of its values.
[ "InfluxQLType", "returns", "for", "the", "entry", "the", "data", "type", "of", "its", "values", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/cache_entry.go#L114-L118
124,741
influxdata/influxdb
models/points.go
ParsePointsString
func ParsePointsString(buf, mm string) ([]Point, error) { return ParsePoints([]byte(buf), []byte(mm)) }
go
func ParsePointsString(buf, mm string) ([]Point, error) { return ParsePoints([]byte(buf), []byte(mm)) }
[ "func", "ParsePointsString", "(", "buf", ",", "mm", "string", ")", "(", "[", "]", "Point", ",", "error", ")", "{", "return", "ParsePoints", "(", "[", "]", "byte", "(", "buf", ")", ",", "[", "]", "byte", "(", "mm", ")", ")", "\n", "}" ]
// ParsePointsString is identical to ParsePoints but accepts a string.
[ "ParsePointsString", "is", "identical", "to", "ParsePoints", "but", "accepts", "a", "string", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L300-L302
124,742
influxdata/influxdb
models/points.go
ParsePointsWithPrecisionV1
func ParsePointsWithPrecisionV1(buf []byte, mm []byte, defaultTime time.Time, precision string) (_ []Point, err error) { return parsePointsWithPrecision(buf, mm, defaultTime, precision, false) }
go
func ParsePointsWithPrecisionV1(buf []byte, mm []byte, defaultTime time.Time, precision string) (_ []Point, err error) { return parsePointsWithPrecision(buf, mm, defaultTime, precision, false) }
[ "func", "ParsePointsWithPrecisionV1", "(", "buf", "[", "]", "byte", ",", "mm", "[", "]", "byte", ",", "defaultTime", "time", ".", "Time", ",", "precision", "string", ")", "(", "_", "[", "]", "Point", ",", "err", "error", ")", "{", "return", "parsePoint...
// ParsePointsWithPrecisionV1 is similar to ParsePointsWithPrecision but does // not rewrite the measurement & field keys.
[ "ParsePointsWithPrecisionV1", "is", "similar", "to", "ParsePointsWithPrecision", "but", "does", "not", "rewrite", "the", "measurement", "&", "field", "keys", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L367-L369
124,743
influxdata/influxdb
models/points.go
newV2Key
func newV2Key(oldKey, mm, field []byte) []byte { newKey := make([]byte, len(mm)+1+len(MeasurementTagKey)+1+len(oldKey)+1+len(FieldKeyTagKey)+1+len(field)) buf := newKey copy(buf, mm) buf = buf[len(mm):] buf[0], buf[1], buf[2], buf = ',', MeasurementTagKeyBytes[0], '=', buf[3:] copy(buf, oldKey) buf = buf[len(o...
go
func newV2Key(oldKey, mm, field []byte) []byte { newKey := make([]byte, len(mm)+1+len(MeasurementTagKey)+1+len(oldKey)+1+len(FieldKeyTagKey)+1+len(field)) buf := newKey copy(buf, mm) buf = buf[len(mm):] buf[0], buf[1], buf[2], buf = ',', MeasurementTagKeyBytes[0], '=', buf[3:] copy(buf, oldKey) buf = buf[len(o...
[ "func", "newV2Key", "(", "oldKey", ",", "mm", ",", "field", "[", "]", "byte", ")", "[", "]", "byte", "{", "newKey", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "mm", ")", "+", "1", "+", "len", "(", "MeasurementTagKey", ")", "+", "1", ...
// newV2Key returns a new key by converting the old measurement & field into keys.
[ "newV2Key", "returns", "a", "new", "key", "by", "converting", "the", "old", "measurement", "&", "field", "into", "keys", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L524-L539
124,744
influxdata/influxdb
models/points.go
GetPrecisionMultiplier
func GetPrecisionMultiplier(precision string) int64 { d := time.Nanosecond switch precision { case "us": d = time.Microsecond case "ms": d = time.Millisecond case "s": d = time.Second } return int64(d) }
go
func GetPrecisionMultiplier(precision string) int64 { d := time.Nanosecond switch precision { case "us": d = time.Microsecond case "ms": d = time.Millisecond case "s": d = time.Second } return int64(d) }
[ "func", "GetPrecisionMultiplier", "(", "precision", "string", ")", "int64", "{", "d", ":=", "time", ".", "Nanosecond", "\n", "switch", "precision", "{", "case", "\"", "\"", ":", "d", "=", "time", ".", "Microsecond", "\n", "case", "\"", "\"", ":", "d", ...
// GetPrecisionMultiplier will return a multiplier for the precision specified.
[ "GetPrecisionMultiplier", "will", "return", "a", "multiplier", "for", "the", "precision", "specified", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L542-L553
124,745
influxdata/influxdb
models/points.go
scanKey
func scanKey(buf []byte, i int) (int, []byte, error) { start := skipWhitespace(buf, i) i = start // Determines whether the tags are sort, assume they are sorted := true // indices holds the indexes within buf of the start of each tag. For example, // a buf of 'cpu,host=a,region=b,zone=c' would have indices sl...
go
func scanKey(buf []byte, i int) (int, []byte, error) { start := skipWhitespace(buf, i) i = start // Determines whether the tags are sort, assume they are sorted := true // indices holds the indexes within buf of the start of each tag. For example, // a buf of 'cpu,host=a,region=b,zone=c' would have indices sl...
[ "func", "scanKey", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "[", "]", "byte", ",", "error", ")", "{", "start", ":=", "skipWhitespace", "(", "buf", ",", "i", ")", "\n\n", "i", "=", "start", "\n\n", "// Determines whether ...
// scanKey scans buf starting at i for the measurement and tag portion of the point. // It returns the ending position and the byte slice of key within buf. If there // are tags, they will be sorted if they are not already.
[ "scanKey", "scans", "buf", "starting", "at", "i", "for", "the", "measurement", "and", "tag", "portion", "of", "the", "point", ".", "It", "returns", "the", "ending", "position", "and", "the", "byte", "slice", "of", "key", "within", "buf", ".", "If", "ther...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L558-L652
124,746
influxdata/influxdb
models/points.go
scanMeasurement
func scanMeasurement(buf []byte, i int) (int, int, error) { // Check first byte of measurement, anything except a comma is fine. // It can't be a space, since whitespace is stripped prior to this // function call. if i >= len(buf) || buf[i] == ',' { return -1, i, fmt.Errorf("missing measurement") } for { i++...
go
func scanMeasurement(buf []byte, i int) (int, int, error) { // Check first byte of measurement, anything except a comma is fine. // It can't be a space, since whitespace is stripped prior to this // function call. if i >= len(buf) || buf[i] == ',' { return -1, i, fmt.Errorf("missing measurement") } for { i++...
[ "func", "scanMeasurement", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "int", ",", "error", ")", "{", "// Check first byte of measurement, anything except a comma is fine.", "// It can't be a space, since whitespace is stripped prior to this", "// f...
// scanMeasurement examines the measurement part of a Point, returning // the next state to move to, and the current location in the buffer.
[ "scanMeasurement", "examines", "the", "measurement", "part", "of", "a", "Point", "returning", "the", "next", "state", "to", "move", "to", "and", "the", "current", "location", "in", "the", "buffer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L664-L695
124,747
influxdata/influxdb
models/points.go
scanTags
func scanTags(buf []byte, i int, indices []int) (int, int, []int, error) { var ( err error commas int state = tagKeyState ) for { switch state { case tagKeyState: // Grow our indices slice if we have too many tags. if commas >= len(indices) { newIndics := make([]int, cap(indices)*2) copy...
go
func scanTags(buf []byte, i int, indices []int) (int, int, []int, error) { var ( err error commas int state = tagKeyState ) for { switch state { case tagKeyState: // Grow our indices slice if we have too many tags. if commas >= len(indices) { newIndics := make([]int, cap(indices)*2) copy...
[ "func", "scanTags", "(", "buf", "[", "]", "byte", ",", "i", "int", ",", "indices", "[", "]", "int", ")", "(", "int", ",", "int", ",", "[", "]", "int", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "commas", "int", "\n", "state", "...
// scanTags examines all the tags in a Point, keeping track of and // returning the updated indices slice, number of commas and location // in buf where to start examining the Point fields.
[ "scanTags", "examines", "all", "the", "tags", "in", "a", "Point", "keeping", "track", "of", "and", "returning", "the", "updated", "indices", "slice", "number", "of", "commas", "and", "location", "in", "buf", "where", "to", "start", "examining", "the", "Point...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L700-L732
124,748
influxdata/influxdb
models/points.go
scanTagsKey
func scanTagsKey(buf []byte, i int) (int, error) { // First character of the key. if i >= len(buf) || buf[i] == ' ' || buf[i] == ',' || buf[i] == '=' { // cpu,{'', ' ', ',', '='} return i, fmt.Errorf("missing tag key") } // Examine each character in the tag key until we hit an unescaped // equals (the tag val...
go
func scanTagsKey(buf []byte, i int) (int, error) { // First character of the key. if i >= len(buf) || buf[i] == ' ' || buf[i] == ',' || buf[i] == '=' { // cpu,{'', ' ', ',', '='} return i, fmt.Errorf("missing tag key") } // Examine each character in the tag key until we hit an unescaped // equals (the tag val...
[ "func", "scanTagsKey", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "error", ")", "{", "// First character of the key.", "if", "i", ">=", "len", "(", "buf", ")", "||", "buf", "[", "i", "]", "==", "' '", "||", "buf", "[", "...
// scanTagsKey scans each character in a tag key.
[ "scanTagsKey", "scans", "each", "character", "in", "a", "tag", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L735-L761
124,749
influxdata/influxdb
models/points.go
scanFields
func scanFields(buf []byte, i int) (int, []byte, error) { start := skipWhitespace(buf, i) i = start quoted := false // tracks how many '=' we've seen equals := 0 // tracks how many commas we've seen commas := 0 for { // reached the end of buf? if i >= len(buf) { break } // escaped characters? i...
go
func scanFields(buf []byte, i int) (int, []byte, error) { start := skipWhitespace(buf, i) i = start quoted := false // tracks how many '=' we've seen equals := 0 // tracks how many commas we've seen commas := 0 for { // reached the end of buf? if i >= len(buf) { break } // escaped characters? i...
[ "func", "scanFields", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "[", "]", "byte", ",", "error", ")", "{", "start", ":=", "skipWhitespace", "(", "buf", ",", "i", ")", "\n", "i", "=", "start", "\n", "quoted", ":=", "fal...
// scanFields scans buf, starting at i for the fields section of a point. It returns // the ending position and the byte slice of the fields within buf.
[ "scanFields", "scans", "buf", "starting", "at", "i", "for", "the", "fields", "section", "of", "a", "point", ".", "It", "returns", "the", "ending", "position", "and", "the", "byte", "slice", "of", "the", "fields", "within", "buf", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L817-L913
124,750
influxdata/influxdb
models/points.go
scanTime
func scanTime(buf []byte, i int) (int, []byte, error) { start := skipWhitespace(buf, i) i = start for { // reached the end of buf? if i >= len(buf) { break } // Reached end of block or trailing whitespace? if buf[i] == '\n' || buf[i] == ' ' { break } // Handle negative timestamps if i == sta...
go
func scanTime(buf []byte, i int) (int, []byte, error) { start := skipWhitespace(buf, i) i = start for { // reached the end of buf? if i >= len(buf) { break } // Reached end of block or trailing whitespace? if buf[i] == '\n' || buf[i] == ' ' { break } // Handle negative timestamps if i == sta...
[ "func", "scanTime", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "[", "]", "byte", ",", "error", ")", "{", "start", ":=", "skipWhitespace", "(", "buf", ",", "i", ")", "\n", "i", "=", "start", "\n\n", "for", "{", "// reac...
// scanTime scans buf, starting at i for the time section of a point. It // returns the ending position and the byte slice of the timestamp within buf // and and error if the timestamp is not in the correct numeric format.
[ "scanTime", "scans", "buf", "starting", "at", "i", "for", "the", "time", "section", "of", "a", "point", ".", "It", "returns", "the", "ending", "position", "and", "the", "byte", "slice", "of", "the", "timestamp", "within", "buf", "and", "and", "error", "i...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L918-L947
124,751
influxdata/influxdb
models/points.go
scanBoolean
func scanBoolean(buf []byte, i int) (int, []byte, error) { start := i if i < len(buf) && (buf[i] != 't' && buf[i] != 'f' && buf[i] != 'T' && buf[i] != 'F') { return i, buf[start:i], fmt.Errorf("invalid boolean") } i++ for { if i >= len(buf) { break } if buf[i] == ',' || buf[i] == ' ' { break } ...
go
func scanBoolean(buf []byte, i int) (int, []byte, error) { start := i if i < len(buf) && (buf[i] != 't' && buf[i] != 'f' && buf[i] != 'T' && buf[i] != 'F') { return i, buf[start:i], fmt.Errorf("invalid boolean") } i++ for { if i >= len(buf) { break } if buf[i] == ',' || buf[i] == ' ' { break } ...
[ "func", "scanBoolean", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "[", "]", "byte", ",", "error", ")", "{", "start", ":=", "i", "\n\n", "if", "i", "<", "len", "(", "buf", ")", "&&", "(", "buf", "[", "i", "]", "!=",...
// scanBoolean returns the end position within buf, start at i after // scanning over buf for boolean. Valid values for a boolean are // t, T, true, TRUE, f, F, false, FALSE. It returns an error if a invalid boolean // is scanned.
[ "scanBoolean", "returns", "the", "end", "position", "within", "buf", "start", "at", "i", "after", "scanning", "over", "buf", "for", "boolean", ".", "Valid", "values", "for", "a", "boolean", "are", "t", "T", "true", "TRUE", "f", "F", "false", "FALSE", "."...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1097-L1150
124,752
influxdata/influxdb
models/points.go
skipWhitespace
func skipWhitespace(buf []byte, i int) int { for i < len(buf) { if buf[i] != ' ' && buf[i] != '\t' && buf[i] != 0 { break } i++ } return i }
go
func skipWhitespace(buf []byte, i int) int { for i < len(buf) { if buf[i] != ' ' && buf[i] != '\t' && buf[i] != 0 { break } i++ } return i }
[ "func", "skipWhitespace", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "int", "{", "for", "i", "<", "len", "(", "buf", ")", "{", "if", "buf", "[", "i", "]", "!=", "' '", "&&", "buf", "[", "i", "]", "!=", "'\\t'", "&&", "buf", "[", "i...
// skipWhitespace returns the end position within buf, starting at i after // scanning over spaces in tags.
[ "skipWhitespace", "returns", "the", "end", "position", "within", "buf", "starting", "at", "i", "after", "scanning", "over", "spaces", "in", "tags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1154-L1162
124,753
influxdata/influxdb
models/points.go
scanLine
func scanLine(buf []byte, i int) (int, []byte) { start := i quoted := false fields := false // tracks how many '=' and commas we've seen // this duplicates some of the functionality in scanFields equals := 0 commas := 0 for { // reached the end of buf? if i >= len(buf) { break } // skip past escape...
go
func scanLine(buf []byte, i int) (int, []byte) { start := i quoted := false fields := false // tracks how many '=' and commas we've seen // this duplicates some of the functionality in scanFields equals := 0 commas := 0 for { // reached the end of buf? if i >= len(buf) { break } // skip past escape...
[ "func", "scanLine", "(", "buf", "[", "]", "byte", ",", "i", "int", ")", "(", "int", ",", "[", "]", "byte", ")", "{", "start", ":=", "i", "\n", "quoted", ":=", "false", "\n", "fields", ":=", "false", "\n\n", "// tracks how many '=' and commas we've seen",...
// scanLine returns the end position in buf and the next line found within // buf.
[ "scanLine", "returns", "the", "end", "position", "in", "buf", "and", "the", "next", "line", "found", "within", "buf", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1166-L1216
124,754
influxdata/influxdb
models/points.go
scanTo
func scanTo(buf []byte, i int, stop byte) (int, []byte) { start := i for { // reached the end of buf? if i >= len(buf) { break } // Reached unescaped stop value? if buf[i] == stop && (i == 0 || buf[i-1] != '\\') { break } i++ } return i, buf[start:i] }
go
func scanTo(buf []byte, i int, stop byte) (int, []byte) { start := i for { // reached the end of buf? if i >= len(buf) { break } // Reached unescaped stop value? if buf[i] == stop && (i == 0 || buf[i-1] != '\\') { break } i++ } return i, buf[start:i] }
[ "func", "scanTo", "(", "buf", "[", "]", "byte", ",", "i", "int", ",", "stop", "byte", ")", "(", "int", ",", "[", "]", "byte", ")", "{", "start", ":=", "i", "\n", "for", "{", "// reached the end of buf?", "if", "i", ">=", "len", "(", "buf", ")", ...
// scanTo returns the end position in buf and the next consecutive block // of bytes, starting from i and ending with stop byte, where stop byte // has not been escaped. // // If there are leading spaces, they are skipped.
[ "scanTo", "returns", "the", "end", "position", "in", "buf", "and", "the", "next", "consecutive", "block", "of", "bytes", "starting", "from", "i", "and", "ending", "with", "stop", "byte", "where", "stop", "byte", "has", "not", "been", "escaped", ".", "If", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1223-L1239
124,755
influxdata/influxdb
models/points.go
scanToSpaceOr
func scanToSpaceOr(buf []byte, i int, stop byte) (int, []byte) { start := i if buf[i] == stop || buf[i] == ' ' { return i, buf[start:i] } for { i++ if buf[i-1] == '\\' { continue } // reached the end of buf? if i >= len(buf) { return i, buf[start:i] } // reached end of block? if buf[i] ==...
go
func scanToSpaceOr(buf []byte, i int, stop byte) (int, []byte) { start := i if buf[i] == stop || buf[i] == ' ' { return i, buf[start:i] } for { i++ if buf[i-1] == '\\' { continue } // reached the end of buf? if i >= len(buf) { return i, buf[start:i] } // reached end of block? if buf[i] ==...
[ "func", "scanToSpaceOr", "(", "buf", "[", "]", "byte", ",", "i", "int", ",", "stop", "byte", ")", "(", "int", ",", "[", "]", "byte", ")", "{", "start", ":=", "i", "\n", "if", "buf", "[", "i", "]", "==", "stop", "||", "buf", "[", "i", "]", "...
// scanTo returns the end position in buf and the next consecutive block // of bytes, starting from i and ending with stop byte. If there are leading // spaces, they are skipped.
[ "scanTo", "returns", "the", "end", "position", "in", "buf", "and", "the", "next", "consecutive", "block", "of", "bytes", "starting", "from", "i", "and", "ending", "with", "stop", "byte", ".", "If", "there", "are", "leading", "spaces", "they", "are", "skipp...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1244-L1266
124,756
influxdata/influxdb
models/points.go
unescapeStringField
func unescapeStringField(in string) string { if strings.IndexByte(in, '\\') == -1 { return in } var out []byte i := 0 for { if i >= len(in) { break } // unescape backslashes if in[i] == '\\' && i+1 < len(in) && in[i+1] == '\\' { out = append(out, '\\') i += 2 continue } // unescape doubl...
go
func unescapeStringField(in string) string { if strings.IndexByte(in, '\\') == -1 { return in } var out []byte i := 0 for { if i >= len(in) { break } // unescape backslashes if in[i] == '\\' && i+1 < len(in) && in[i+1] == '\\' { out = append(out, '\\') i += 2 continue } // unescape doubl...
[ "func", "unescapeStringField", "(", "in", "string", ")", "string", "{", "if", "strings", ".", "IndexByte", "(", "in", ",", "'\\\\'", ")", "==", "-", "1", "{", "return", "in", "\n", "}", "\n\n", "var", "out", "[", "]", "byte", "\n", "i", ":=", "0", ...
// unescapeStringField returns a copy of in with any escaped double-quotes // or backslashes unescaped.
[ "unescapeStringField", "returns", "a", "copy", "of", "in", "with", "any", "escaped", "double", "-", "quotes", "or", "backslashes", "unescaped", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1373-L1401
124,757
influxdata/influxdb
models/points.go
NewPointFromSeries
func NewPointFromSeries(key []byte, fields Fields, t time.Time) Point { return &point{ key: key, time: t, fields: fields.MarshalBinary(), } }
go
func NewPointFromSeries(key []byte, fields Fields, t time.Time) Point { return &point{ key: key, time: t, fields: fields.MarshalBinary(), } }
[ "func", "NewPointFromSeries", "(", "key", "[", "]", "byte", ",", "fields", "Fields", ",", "t", "time", ".", "Time", ")", "Point", "{", "return", "&", "point", "{", "key", ":", "key", ",", "time", ":", "t", ",", "fields", ":", "fields", ".", "Marsha...
// NewPointFromSeries returns a Point given the serialized key, some fields, and a time.
[ "NewPointFromSeries", "returns", "a", "Point", "given", "the", "serialized", "key", "some", "fields", "and", "a", "time", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1420-L1426
124,758
influxdata/influxdb
models/points.go
pointKey
func pointKey(measurement string, tags Tags, fields Fields, t time.Time) ([]byte, error) { if len(fields) == 0 { return nil, ErrPointMustHaveAField } if !t.IsZero() { if err := CheckTime(t); err != nil { return nil, err } } for key, value := range fields { switch value := value.(type) { case float64...
go
func pointKey(measurement string, tags Tags, fields Fields, t time.Time) ([]byte, error) { if len(fields) == 0 { return nil, ErrPointMustHaveAField } if !t.IsZero() { if err := CheckTime(t); err != nil { return nil, err } } for key, value := range fields { switch value := value.(type) { case float64...
[ "func", "pointKey", "(", "measurement", "string", ",", "tags", "Tags", ",", "fields", "Fields", ",", "t", "time", ".", "Time", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "fields", ")", "==", "0", "{", "return", "nil", "...
// pointKey checks some basic requirements for valid points, and returns the // key, along with an possible error.
[ "pointKey", "checks", "some", "basic", "requirements", "for", "valid", "points", "and", "returns", "the", "key", "along", "with", "an", "possible", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1430-L1474
124,759
influxdata/influxdb
models/points.go
NewPointFromBytes
func NewPointFromBytes(b []byte) (Point, error) { p := &point{} if err := p.UnmarshalBinary(b); err != nil { return nil, err } // This does some basic validation to ensure there are fields and they // can be unmarshalled as well. iter := p.FieldIterator() var hasField bool for iter.Next() { if len(iter.Fie...
go
func NewPointFromBytes(b []byte) (Point, error) { p := &point{} if err := p.UnmarshalBinary(b); err != nil { return nil, err } // This does some basic validation to ensure there are fields and they // can be unmarshalled as well. iter := p.FieldIterator() var hasField bool for iter.Next() { if len(iter.Fie...
[ "func", "NewPointFromBytes", "(", "b", "[", "]", "byte", ")", "(", "Point", ",", "error", ")", "{", "p", ":=", "&", "point", "{", "}", "\n", "if", "err", ":=", "p", ".", "UnmarshalBinary", "(", "b", ")", ";", "err", "!=", "nil", "{", "return", ...
// NewPointFromBytes returns a new Point from a marshalled Point.
[ "NewPointFromBytes", "returns", "a", "new", "Point", "from", "a", "marshalled", "Point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1485-L1531
124,760
influxdata/influxdb
models/points.go
SetName
func (p *point) SetName(name string) { p.cachedName = "" p.key = MakeKey([]byte(name), p.Tags()) }
go
func (p *point) SetName(name string) { p.cachedName = "" p.key = MakeKey([]byte(name), p.Tags()) }
[ "func", "(", "p", "*", "point", ")", "SetName", "(", "name", "string", ")", "{", "p", ".", "cachedName", "=", "\"", "\"", "\n", "p", ".", "key", "=", "MakeKey", "(", "[", "]", "byte", "(", "name", ")", ",", "p", ".", "Tags", "(", ")", ")", ...
// SetName updates the measurement name for the point.
[ "SetName", "updates", "the", "measurement", "name", "for", "the", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1558-L1561
124,761
influxdata/influxdb
models/points.go
Round
func (p *point) Round(d time.Duration) { p.time = p.time.Round(d) }
go
func (p *point) Round(d time.Duration) { p.time = p.time.Round(d) }
[ "func", "(", "p", "*", "point", ")", "Round", "(", "d", "time", ".", "Duration", ")", "{", "p", ".", "time", "=", "p", ".", "time", ".", "Round", "(", "d", ")", "\n", "}" ]
// Round will round the timestamp of the point to the given duration.
[ "Round", "will", "round", "the", "timestamp", "of", "the", "point", "to", "the", "given", "duration", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1574-L1576
124,762
influxdata/influxdb
models/points.go
Tags
func (p *point) Tags() Tags { if p.cachedTags != nil { return p.cachedTags } p.cachedTags = parseTags(p.key, nil) return p.cachedTags }
go
func (p *point) Tags() Tags { if p.cachedTags != nil { return p.cachedTags } p.cachedTags = parseTags(p.key, nil) return p.cachedTags }
[ "func", "(", "p", "*", "point", ")", "Tags", "(", ")", "Tags", "{", "if", "p", ".", "cachedTags", "!=", "nil", "{", "return", "p", ".", "cachedTags", "\n", "}", "\n", "p", ".", "cachedTags", "=", "parseTags", "(", "p", ".", "key", ",", "nil", "...
// Tags returns the tag set for the point.
[ "Tags", "returns", "the", "tag", "set", "for", "the", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1579-L1585
124,763
influxdata/influxdb
models/points.go
walkFields
func walkFields(buf []byte, fn func(key, value, data []byte) bool) error { var i int var key, val []byte for len(buf) > 0 { data := buf i, key = scanTo(buf, 0, '=') if i > len(buf)-2 { return fmt.Errorf("invalid value: field-key=%s", key) } buf = buf[i+1:] i, val = scanFieldValue(buf, 0) buf = buf[...
go
func walkFields(buf []byte, fn func(key, value, data []byte) bool) error { var i int var key, val []byte for len(buf) > 0 { data := buf i, key = scanTo(buf, 0, '=') if i > len(buf)-2 { return fmt.Errorf("invalid value: field-key=%s", key) } buf = buf[i+1:] i, val = scanFieldValue(buf, 0) buf = buf[...
[ "func", "walkFields", "(", "buf", "[", "]", "byte", ",", "fn", "func", "(", "key", ",", "value", ",", "data", "[", "]", "byte", ")", "bool", ")", "error", "{", "var", "i", "int", "\n", "var", "key", ",", "val", "[", "]", "byte", "\n", "for", ...
// walkFields walks each field key and value via fn. If fn returns false, the iteration // is stopped. The values are the raw byte slices and not the converted types.
[ "walkFields", "walks", "each", "field", "key", "and", "value", "via", "fn", ".", "If", "fn", "returns", "false", "the", "iteration", "is", "stopped", ".", "The", "values", "are", "the", "raw", "byte", "slices", "and", "not", "the", "converted", "types", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1650-L1673
124,764
influxdata/influxdb
models/points.go
parseTags
func parseTags(buf []byte, dst Tags) Tags { if len(buf) == 0 { return nil } n := bytes.Count(buf, []byte(",")) if cap(dst) < n { dst = make(Tags, n) } else { dst = dst[:n] } // Ensure existing behaviour when point has no tags and nil slice passed in. if dst == nil { dst = Tags{} } // Series keys ca...
go
func parseTags(buf []byte, dst Tags) Tags { if len(buf) == 0 { return nil } n := bytes.Count(buf, []byte(",")) if cap(dst) < n { dst = make(Tags, n) } else { dst = dst[:n] } // Ensure existing behaviour when point has no tags and nil slice passed in. if dst == nil { dst = Tags{} } // Series keys ca...
[ "func", "parseTags", "(", "buf", "[", "]", "byte", ",", "dst", "Tags", ")", "Tags", "{", "if", "len", "(", "buf", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "n", ":=", "bytes", ".", "Count", "(", "buf", ",", "[", "]", "byte", "(...
// parseTags parses buf into the provided destination tags, returning destination // Tags, which may have a different length and capacity.
[ "parseTags", "parses", "buf", "into", "the", "provided", "destination", "tags", "returning", "destination", "Tags", "which", "may", "have", "a", "different", "length", "and", "capacity", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1677-L1704
124,765
influxdata/influxdb
models/points.go
MakeKey
func MakeKey(name []byte, tags Tags) []byte { return AppendMakeKey(nil, name, tags) }
go
func MakeKey(name []byte, tags Tags) []byte { return AppendMakeKey(nil, name, tags) }
[ "func", "MakeKey", "(", "name", "[", "]", "byte", ",", "tags", "Tags", ")", "[", "]", "byte", "{", "return", "AppendMakeKey", "(", "nil", ",", "name", ",", "tags", ")", "\n", "}" ]
// MakeKey creates a key for a set of tags.
[ "MakeKey", "creates", "a", "key", "for", "a", "set", "of", "tags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1707-L1709
124,766
influxdata/influxdb
models/points.go
AppendMakeKey
func AppendMakeKey(dst []byte, name []byte, tags Tags) []byte { // unescape the name and then re-escape it to avoid double escaping. // The key should always be stored in escaped form. dst = append(dst, EscapeMeasurement(UnescapeMeasurement(name))...) dst = tags.AppendHashKey(dst) return dst }
go
func AppendMakeKey(dst []byte, name []byte, tags Tags) []byte { // unescape the name and then re-escape it to avoid double escaping. // The key should always be stored in escaped form. dst = append(dst, EscapeMeasurement(UnescapeMeasurement(name))...) dst = tags.AppendHashKey(dst) return dst }
[ "func", "AppendMakeKey", "(", "dst", "[", "]", "byte", ",", "name", "[", "]", "byte", ",", "tags", "Tags", ")", "[", "]", "byte", "{", "// unescape the name and then re-escape it to avoid double escaping.", "// The key should always be stored in escaped form.", "dst", "...
// AppendMakeKey appends the key derived from name and tags to dst and returns the extended buffer.
[ "AppendMakeKey", "appends", "the", "key", "derived", "from", "name", "and", "tags", "to", "dst", "and", "returns", "the", "extended", "buffer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1712-L1718
124,767
influxdata/influxdb
models/points.go
SetTags
func (p *point) SetTags(tags Tags) { p.key = MakeKey(p.Name(), tags) p.cachedTags = tags }
go
func (p *point) SetTags(tags Tags) { p.key = MakeKey(p.Name(), tags) p.cachedTags = tags }
[ "func", "(", "p", "*", "point", ")", "SetTags", "(", "tags", "Tags", ")", "{", "p", ".", "key", "=", "MakeKey", "(", "p", ".", "Name", "(", ")", ",", "tags", ")", "\n", "p", ".", "cachedTags", "=", "tags", "\n", "}" ]
// SetTags replaces the tags for the point.
[ "SetTags", "replaces", "the", "tags", "for", "the", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1721-L1724
124,768
influxdata/influxdb
models/points.go
AddTag
func (p *point) AddTag(key, value string) { tags := p.Tags() tags = append(tags, Tag{Key: []byte(key), Value: []byte(value)}) sort.Sort(tags) p.cachedTags = tags p.key = MakeKey(p.Name(), tags) }
go
func (p *point) AddTag(key, value string) { tags := p.Tags() tags = append(tags, Tag{Key: []byte(key), Value: []byte(value)}) sort.Sort(tags) p.cachedTags = tags p.key = MakeKey(p.Name(), tags) }
[ "func", "(", "p", "*", "point", ")", "AddTag", "(", "key", ",", "value", "string", ")", "{", "tags", ":=", "p", ".", "Tags", "(", ")", "\n", "tags", "=", "append", "(", "tags", ",", "Tag", "{", "Key", ":", "[", "]", "byte", "(", "key", ")", ...
// AddTag adds or replaces a tag value for a point.
[ "AddTag", "adds", "or", "replaces", "a", "tag", "value", "for", "a", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1727-L1733
124,769
influxdata/influxdb
models/points.go
Fields
func (p *point) Fields() (Fields, error) { if p.cachedFields != nil { return p.cachedFields, nil } cf, err := p.unmarshalBinary() if err != nil { return nil, err } p.cachedFields = cf return p.cachedFields, nil }
go
func (p *point) Fields() (Fields, error) { if p.cachedFields != nil { return p.cachedFields, nil } cf, err := p.unmarshalBinary() if err != nil { return nil, err } p.cachedFields = cf return p.cachedFields, nil }
[ "func", "(", "p", "*", "point", ")", "Fields", "(", ")", "(", "Fields", ",", "error", ")", "{", "if", "p", ".", "cachedFields", "!=", "nil", "{", "return", "p", ".", "cachedFields", ",", "nil", "\n", "}", "\n", "cf", ",", "err", ":=", "p", ".",...
// Fields returns the fields for the point.
[ "Fields", "returns", "the", "fields", "for", "the", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1736-L1746
124,770
influxdata/influxdb
models/points.go
SetPrecision
func (p *point) SetPrecision(precision string) { switch precision { case "us": p.SetTime(p.Time().Truncate(time.Microsecond)) case "ms": p.SetTime(p.Time().Truncate(time.Millisecond)) case "s": p.SetTime(p.Time().Truncate(time.Second)) } }
go
func (p *point) SetPrecision(precision string) { switch precision { case "us": p.SetTime(p.Time().Truncate(time.Microsecond)) case "ms": p.SetTime(p.Time().Truncate(time.Millisecond)) case "s": p.SetTime(p.Time().Truncate(time.Second)) } }
[ "func", "(", "p", "*", "point", ")", "SetPrecision", "(", "precision", "string", ")", "{", "switch", "precision", "{", "case", "\"", "\"", ":", "p", ".", "SetTime", "(", "p", ".", "Time", "(", ")", ".", "Truncate", "(", "time", ".", "Microsecond", ...
// SetPrecision will round a time to the specified precision.
[ "SetPrecision", "will", "round", "a", "time", "to", "the", "specified", "precision", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1749-L1758
124,771
influxdata/influxdb
models/points.go
String
func (p *point) String() string { if p.Time().IsZero() { return string(p.Key()) + " " + string(p.fields) } return string(p.Key()) + " " + string(p.fields) + " " + strconv.FormatInt(p.UnixNano(), 10) }
go
func (p *point) String() string { if p.Time().IsZero() { return string(p.Key()) + " " + string(p.fields) } return string(p.Key()) + " " + string(p.fields) + " " + strconv.FormatInt(p.UnixNano(), 10) }
[ "func", "(", "p", "*", "point", ")", "String", "(", ")", "string", "{", "if", "p", ".", "Time", "(", ")", ".", "IsZero", "(", ")", "{", "return", "string", "(", "p", ".", "Key", "(", ")", ")", "+", "\"", "\"", "+", "string", "(", "p", ".", ...
// String returns the string representation of the point.
[ "String", "returns", "the", "string", "representation", "of", "the", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1761-L1766
124,772
influxdata/influxdb
models/points.go
AppendString
func (p *point) AppendString(buf []byte) []byte { buf = append(buf, p.key...) buf = append(buf, ' ') buf = append(buf, p.fields...) if !p.time.IsZero() { buf = append(buf, ' ') buf = strconv.AppendInt(buf, p.UnixNano(), 10) } return buf }
go
func (p *point) AppendString(buf []byte) []byte { buf = append(buf, p.key...) buf = append(buf, ' ') buf = append(buf, p.fields...) if !p.time.IsZero() { buf = append(buf, ' ') buf = strconv.AppendInt(buf, p.UnixNano(), 10) } return buf }
[ "func", "(", "p", "*", "point", ")", "AppendString", "(", "buf", "[", "]", "byte", ")", "[", "]", "byte", "{", "buf", "=", "append", "(", "buf", ",", "p", ".", "key", "...", ")", "\n", "buf", "=", "append", "(", "buf", ",", "' '", ")", "\n", ...
// AppendString appends the string representation of the point to buf.
[ "AppendString", "appends", "the", "string", "representation", "of", "the", "point", "to", "buf", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1769-L1780
124,773
influxdata/influxdb
models/points.go
MarshalBinary
func (p *point) MarshalBinary() ([]byte, error) { if len(p.fields) == 0 { return nil, ErrPointMustHaveAField } tb, err := p.time.MarshalBinary() if err != nil { return nil, err } b := make([]byte, 8+len(p.key)+len(p.fields)+len(tb)) i := 0 binary.BigEndian.PutUint32(b[i:], uint32(len(p.key))) i += 4 i...
go
func (p *point) MarshalBinary() ([]byte, error) { if len(p.fields) == 0 { return nil, ErrPointMustHaveAField } tb, err := p.time.MarshalBinary() if err != nil { return nil, err } b := make([]byte, 8+len(p.key)+len(p.fields)+len(tb)) i := 0 binary.BigEndian.PutUint32(b[i:], uint32(len(p.key))) i += 4 i...
[ "func", "(", "p", "*", "point", ")", "MarshalBinary", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "p", ".", "fields", ")", "==", "0", "{", "return", "nil", ",", "ErrPointMustHaveAField", "\n", "}", "\n\n", "tb", ","...
// MarshalBinary returns a binary representation of the point.
[ "MarshalBinary", "returns", "a", "binary", "representation", "of", "the", "point", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1805-L1830
124,774
influxdata/influxdb
models/points.go
UnmarshalBinary
func (p *point) UnmarshalBinary(b []byte) error { var n int // Read key length. if len(b) < 4 { return io.ErrShortBuffer } n, b = int(binary.BigEndian.Uint32(b[:4])), b[4:] // Read key. if len(b) < n { return io.ErrShortBuffer } p.key, b = b[:n], b[n:] // Read fields length. if len(b) < 4 { return i...
go
func (p *point) UnmarshalBinary(b []byte) error { var n int // Read key length. if len(b) < 4 { return io.ErrShortBuffer } n, b = int(binary.BigEndian.Uint32(b[:4])), b[4:] // Read key. if len(b) < n { return io.ErrShortBuffer } p.key, b = b[:n], b[n:] // Read fields length. if len(b) < 4 { return i...
[ "func", "(", "p", "*", "point", ")", "UnmarshalBinary", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "n", "int", "\n\n", "// Read key length.", "if", "len", "(", "b", ")", "<", "4", "{", "return", "io", ".", "ErrShortBuffer", "\n", "}", "\...
// UnmarshalBinary decodes a binary representation of the point into a point struct.
[ "UnmarshalBinary", "decodes", "a", "binary", "representation", "of", "the", "point", "into", "a", "point", "struct", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1833-L1862
124,775
influxdata/influxdb
models/points.go
PrecisionString
func (p *point) PrecisionString(precision string) string { if p.Time().IsZero() { return fmt.Sprintf("%s %s", p.Key(), string(p.fields)) } return fmt.Sprintf("%s %s %d", p.Key(), string(p.fields), p.UnixNano()/GetPrecisionMultiplier(precision)) }
go
func (p *point) PrecisionString(precision string) string { if p.Time().IsZero() { return fmt.Sprintf("%s %s", p.Key(), string(p.fields)) } return fmt.Sprintf("%s %s %d", p.Key(), string(p.fields), p.UnixNano()/GetPrecisionMultiplier(precision)) }
[ "func", "(", "p", "*", "point", ")", "PrecisionString", "(", "precision", "string", ")", "string", "{", "if", "p", ".", "Time", "(", ")", ".", "IsZero", "(", ")", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "Key", "(", ...
// PrecisionString returns a string representation of the point. If there // is a timestamp associated with the point then it will be specified in the // given unit.
[ "PrecisionString", "returns", "a", "string", "representation", "of", "the", "point", ".", "If", "there", "is", "a", "timestamp", "associated", "with", "the", "point", "then", "it", "will", "be", "specified", "in", "the", "given", "unit", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1867-L1873
124,776
influxdata/influxdb
models/points.go
RoundedString
func (p *point) RoundedString(d time.Duration) string { if p.Time().IsZero() { return fmt.Sprintf("%s %s", p.Key(), string(p.fields)) } return fmt.Sprintf("%s %s %d", p.Key(), string(p.fields), p.time.Round(d).UnixNano()) }
go
func (p *point) RoundedString(d time.Duration) string { if p.Time().IsZero() { return fmt.Sprintf("%s %s", p.Key(), string(p.fields)) } return fmt.Sprintf("%s %s %d", p.Key(), string(p.fields), p.time.Round(d).UnixNano()) }
[ "func", "(", "p", "*", "point", ")", "RoundedString", "(", "d", "time", ".", "Duration", ")", "string", "{", "if", "p", ".", "Time", "(", ")", ".", "IsZero", "(", ")", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "Key",...
// RoundedString returns a string representation of the point. If there // is a timestamp associated with the point, then it will be rounded to the // given duration.
[ "RoundedString", "returns", "a", "string", "representation", "of", "the", "point", ".", "If", "there", "is", "a", "timestamp", "associated", "with", "the", "point", "then", "it", "will", "be", "rounded", "to", "the", "given", "duration", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1878-L1884
124,777
influxdata/influxdb
models/points.go
HashID
func (p *point) HashID() uint64 { h := NewInlineFNV64a() h.Write(p.key) sum := h.Sum64() return sum }
go
func (p *point) HashID() uint64 { h := NewInlineFNV64a() h.Write(p.key) sum := h.Sum64() return sum }
[ "func", "(", "p", "*", "point", ")", "HashID", "(", ")", "uint64", "{", "h", ":=", "NewInlineFNV64a", "(", ")", "\n", "h", ".", "Write", "(", "p", ".", "key", ")", "\n", "sum", ":=", "h", ".", "Sum64", "(", ")", "\n", "return", "sum", "\n", "...
// HashID returns a non-cryptographic checksum of the point's key.
[ "HashID", "returns", "a", "non", "-", "cryptographic", "checksum", "of", "the", "point", "s", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1926-L1931
124,778
influxdata/influxdb
models/points.go
Split
func (p *point) Split(size int) []Point { if p.time.IsZero() || p.StringSize() <= size { return []Point{p} } // key string, timestamp string, spaces size -= len(p.key) + len(strconv.FormatInt(p.time.UnixNano(), 10)) + 2 var points []Point var start, cur int for cur < len(p.fields) { end, _ := scanTo(p.fie...
go
func (p *point) Split(size int) []Point { if p.time.IsZero() || p.StringSize() <= size { return []Point{p} } // key string, timestamp string, spaces size -= len(p.key) + len(strconv.FormatInt(p.time.UnixNano(), 10)) + 2 var points []Point var start, cur int for cur < len(p.fields) { end, _ := scanTo(p.fie...
[ "func", "(", "p", "*", "point", ")", "Split", "(", "size", "int", ")", "[", "]", "Point", "{", "if", "p", ".", "time", ".", "IsZero", "(", ")", "||", "p", ".", "StringSize", "(", ")", "<=", "size", "{", "return", "[", "]", "Point", "{", "p", ...
// Split will attempt to return multiple points with the same timestamp whose // string representations are no longer than size. Points with a single field or // a point without a timestamp may exceed the requested size.
[ "Split", "will", "attempt", "to", "return", "multiple", "points", "with", "the", "same", "timestamp", "whose", "string", "representations", "are", "no", "longer", "than", "size", ".", "Points", "with", "a", "single", "field", "or", "a", "point", "without", "...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1941-L1975
124,779
influxdata/influxdb
models/points.go
NewTag
func NewTag(key, value []byte) Tag { return Tag{ Key: key, Value: value, } }
go
func NewTag(key, value []byte) Tag { return Tag{ Key: key, Value: value, } }
[ "func", "NewTag", "(", "key", ",", "value", "[", "]", "byte", ")", "Tag", "{", "return", "Tag", "{", "Key", ":", "key", ",", "Value", ":", "value", ",", "}", "\n", "}" ]
// NewTag returns a new Tag.
[ "NewTag", "returns", "a", "new", "Tag", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1984-L1989
124,780
influxdata/influxdb
models/points.go
Clone
func (t Tag) Clone() Tag { other := Tag{ Key: make([]byte, len(t.Key)), Value: make([]byte, len(t.Value)), } copy(other.Key, t.Key) copy(other.Value, t.Value) return other }
go
func (t Tag) Clone() Tag { other := Tag{ Key: make([]byte, len(t.Key)), Value: make([]byte, len(t.Value)), } copy(other.Key, t.Key) copy(other.Value, t.Value) return other }
[ "func", "(", "t", "Tag", ")", "Clone", "(", ")", "Tag", "{", "other", ":=", "Tag", "{", "Key", ":", "make", "(", "[", "]", "byte", ",", "len", "(", "t", ".", "Key", ")", ")", ",", "Value", ":", "make", "(", "[", "]", "byte", ",", "len", "...
// Clone returns a shallow copy of Tag. // // Tags associated with a Point created by ParsePointsWithPrecision will hold references to the byte slice that was parsed. // Use Clone to create a Tag with new byte slices that do not refer to the argument to ParsePointsWithPrecision.
[ "Clone", "returns", "a", "shallow", "copy", "of", "Tag", ".", "Tags", "associated", "with", "a", "Point", "created", "by", "ParsePointsWithPrecision", "will", "hold", "references", "to", "the", "byte", "slice", "that", "was", "parsed", ".", "Use", "Clone", "...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L1998-L2008
124,781
influxdata/influxdb
models/points.go
String
func (t *Tag) String() string { var buf bytes.Buffer buf.WriteByte('{') buf.WriteString(string(t.Key)) buf.WriteByte(' ') buf.WriteString(string(t.Value)) buf.WriteByte('}') return buf.String() }
go
func (t *Tag) String() string { var buf bytes.Buffer buf.WriteByte('{') buf.WriteString(string(t.Key)) buf.WriteByte(' ') buf.WriteString(string(t.Value)) buf.WriteByte('}') return buf.String() }
[ "func", "(", "t", "*", "Tag", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "buf", ".", "WriteByte", "(", "'{'", ")", "\n", "buf", ".", "WriteString", "(", "string", "(", "t", ".", "Key", ")", ")", "\n", "b...
// String returns the string reprsentation of the tag.
[ "String", "returns", "the", "string", "reprsentation", "of", "the", "tag", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2011-L2019
124,782
influxdata/influxdb
models/points.go
NewTags
func NewTags(m map[string]string) Tags { if len(m) == 0 { return nil } a := make(Tags, 0, len(m)) for k, v := range m { a = append(a, NewTag([]byte(k), []byte(v))) } sort.Sort(a) return a }
go
func NewTags(m map[string]string) Tags { if len(m) == 0 { return nil } a := make(Tags, 0, len(m)) for k, v := range m { a = append(a, NewTag([]byte(k), []byte(v))) } sort.Sort(a) return a }
[ "func", "NewTags", "(", "m", "map", "[", "string", "]", "string", ")", "Tags", "{", "if", "len", "(", "m", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "a", ":=", "make", "(", "Tags", ",", "0", ",", "len", "(", "m", ")", ")", "\n"...
// NewTags returns a new Tags from a map.
[ "NewTags", "returns", "a", "new", "Tags", "from", "a", "map", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2025-L2035
124,783
influxdata/influxdb
models/points.go
Keys
func (a Tags) Keys() []string { if len(a) == 0 { return nil } keys := make([]string, len(a)) for i, tag := range a { keys[i] = string(tag.Key) } return keys }
go
func (a Tags) Keys() []string { if len(a) == 0 { return nil } keys := make([]string, len(a)) for i, tag := range a { keys[i] = string(tag.Key) } return keys }
[ "func", "(", "a", "Tags", ")", "Keys", "(", ")", "[", "]", "string", "{", "if", "len", "(", "a", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "keys", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "a", ")", ")", "\n", "...
// Keys returns the list of keys for a tag set.
[ "Keys", "returns", "the", "list", "of", "keys", "for", "a", "tag", "set", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2038-L2047
124,784
influxdata/influxdb
models/points.go
Values
func (a Tags) Values() []string { if len(a) == 0 { return nil } values := make([]string, len(a)) for i, tag := range a { values[i] = string(tag.Value) } return values }
go
func (a Tags) Values() []string { if len(a) == 0 { return nil } values := make([]string, len(a)) for i, tag := range a { values[i] = string(tag.Value) } return values }
[ "func", "(", "a", "Tags", ")", "Values", "(", ")", "[", "]", "string", "{", "if", "len", "(", "a", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "values", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "a", ")", ")", "\n",...
// Values returns the list of values for a tag set.
[ "Values", "returns", "the", "list", "of", "values", "for", "a", "tag", "set", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2050-L2059
124,785
influxdata/influxdb
models/points.go
String
func (a Tags) String() string { var buf bytes.Buffer buf.WriteByte('[') for i := range a { buf.WriteString(a[i].String()) if i < len(a)-1 { buf.WriteByte(' ') } } buf.WriteByte(']') return buf.String() }
go
func (a Tags) String() string { var buf bytes.Buffer buf.WriteByte('[') for i := range a { buf.WriteString(a[i].String()) if i < len(a)-1 { buf.WriteByte(' ') } } buf.WriteByte(']') return buf.String() }
[ "func", "(", "a", "Tags", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "buf", ".", "WriteByte", "(", "'['", ")", "\n", "for", "i", ":=", "range", "a", "{", "buf", ".", "WriteString", "(", "a", "[", "i", "]...
// String returns the string representation of the tags.
[ "String", "returns", "the", "string", "representation", "of", "the", "tags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2062-L2073
124,786
influxdata/influxdb
models/points.go
Size
func (a Tags) Size() int { var total int for i := range a { total += a[i].Size() } return total }
go
func (a Tags) Size() int { var total int for i := range a { total += a[i].Size() } return total }
[ "func", "(", "a", "Tags", ")", "Size", "(", ")", "int", "{", "var", "total", "int", "\n", "for", "i", ":=", "range", "a", "{", "total", "+=", "a", "[", "i", "]", ".", "Size", "(", ")", "\n", "}", "\n", "return", "total", "\n", "}" ]
// Size returns the number of bytes needed to store all tags. Note, this is // the number of bytes needed to store all keys and values and does not account // for data structures or delimiters for example.
[ "Size", "returns", "the", "number", "of", "bytes", "needed", "to", "store", "all", "tags", ".", "Note", "this", "is", "the", "number", "of", "bytes", "needed", "to", "store", "all", "keys", "and", "values", "and", "does", "not", "account", "for", "data",...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2078-L2084
124,787
influxdata/influxdb
models/points.go
Clone
func (a Tags) Clone() Tags { if len(a) == 0 { return nil } others := make(Tags, len(a)) for i := range a { others[i] = a[i].Clone() } return others }
go
func (a Tags) Clone() Tags { if len(a) == 0 { return nil } others := make(Tags, len(a)) for i := range a { others[i] = a[i].Clone() } return others }
[ "func", "(", "a", "Tags", ")", "Clone", "(", ")", "Tags", "{", "if", "len", "(", "a", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "others", ":=", "make", "(", "Tags", ",", "len", "(", "a", ")", ")", "\n", "for", "i", ":=", "ran...
// Clone returns a copy of the slice where the elements are a result of calling `Clone` on the original elements // // Tags associated with a Point created by ParsePointsWithPrecision will hold references to the byte slice that was parsed. // Use Clone to create Tags with new byte slices that do not refer to the argume...
[ "Clone", "returns", "a", "copy", "of", "the", "slice", "where", "the", "elements", "are", "a", "result", "of", "calling", "Clone", "on", "the", "original", "elements", "Tags", "associated", "with", "a", "Point", "created", "by", "ParsePointsWithPrecision", "wi...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2090-L2101
124,788
influxdata/influxdb
models/points.go
Equal
func (a Tags) Equal(other Tags) bool { if len(a) != len(other) { return false } for i := range a { if !bytes.Equal(a[i].Key, other[i].Key) || !bytes.Equal(a[i].Value, other[i].Value) { return false } } return true }
go
func (a Tags) Equal(other Tags) bool { if len(a) != len(other) { return false } for i := range a { if !bytes.Equal(a[i].Key, other[i].Key) || !bytes.Equal(a[i].Value, other[i].Value) { return false } } return true }
[ "func", "(", "a", "Tags", ")", "Equal", "(", "other", "Tags", ")", "bool", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "other", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ":=", "range", "a", "{", "if", "!", "bytes", ".",...
// Equal returns true if a equals other.
[ "Equal", "returns", "true", "if", "a", "equals", "other", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2108-L2118
124,789
influxdata/influxdb
models/points.go
Get
func (a Tags) Get(key []byte) []byte { // OPTIMIZE: Use sort.Search if tagset is large. for _, t := range a { if bytes.Equal(t.Key, key) { return t.Value } } return nil }
go
func (a Tags) Get(key []byte) []byte { // OPTIMIZE: Use sort.Search if tagset is large. for _, t := range a { if bytes.Equal(t.Key, key) { return t.Value } } return nil }
[ "func", "(", "a", "Tags", ")", "Get", "(", "key", "[", "]", "byte", ")", "[", "]", "byte", "{", "// OPTIMIZE: Use sort.Search if tagset is large.", "for", "_", ",", "t", ":=", "range", "a", "{", "if", "bytes", ".", "Equal", "(", "t", ".", "Key", ",",...
// Get returns the value for a key.
[ "Get", "returns", "the", "value", "for", "a", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2144-L2153
124,790
influxdata/influxdb
models/points.go
GetString
func (a Tags) GetString(key string) string { return string(a.Get([]byte(key))) }
go
func (a Tags) GetString(key string) string { return string(a.Get([]byte(key))) }
[ "func", "(", "a", "Tags", ")", "GetString", "(", "key", "string", ")", "string", "{", "return", "string", "(", "a", ".", "Get", "(", "[", "]", "byte", "(", "key", ")", ")", ")", "\n", "}" ]
// GetString returns the string value for a string key.
[ "GetString", "returns", "the", "string", "value", "for", "a", "string", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2156-L2158
124,791
influxdata/influxdb
models/points.go
Set
func (a *Tags) Set(key, value []byte) { for i, t := range *a { if bytes.Equal(t.Key, key) { (*a)[i].Value = value return } } *a = append(*a, Tag{Key: key, Value: value}) sort.Sort(*a) }
go
func (a *Tags) Set(key, value []byte) { for i, t := range *a { if bytes.Equal(t.Key, key) { (*a)[i].Value = value return } } *a = append(*a, Tag{Key: key, Value: value}) sort.Sort(*a) }
[ "func", "(", "a", "*", "Tags", ")", "Set", "(", "key", ",", "value", "[", "]", "byte", ")", "{", "for", "i", ",", "t", ":=", "range", "*", "a", "{", "if", "bytes", ".", "Equal", "(", "t", ".", "Key", ",", "key", ")", "{", "(", "*", "a", ...
// Set sets the value for a key.
[ "Set", "sets", "the", "value", "for", "a", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2161-L2170
124,792
influxdata/influxdb
models/points.go
SetString
func (a *Tags) SetString(key, value string) { a.Set([]byte(key), []byte(value)) }
go
func (a *Tags) SetString(key, value string) { a.Set([]byte(key), []byte(value)) }
[ "func", "(", "a", "*", "Tags", ")", "SetString", "(", "key", ",", "value", "string", ")", "{", "a", ".", "Set", "(", "[", "]", "byte", "(", "key", ")", ",", "[", "]", "byte", "(", "value", ")", ")", "\n", "}" ]
// SetString sets the string value for a string key.
[ "SetString", "sets", "the", "string", "value", "for", "a", "string", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2173-L2175
124,793
influxdata/influxdb
models/points.go
Delete
func (a *Tags) Delete(key []byte) { for i, t := range *a { if bytes.Equal(t.Key, key) { copy((*a)[i:], (*a)[i+1:]) (*a)[len(*a)-1] = Tag{} *a = (*a)[:len(*a)-1] return } } }
go
func (a *Tags) Delete(key []byte) { for i, t := range *a { if bytes.Equal(t.Key, key) { copy((*a)[i:], (*a)[i+1:]) (*a)[len(*a)-1] = Tag{} *a = (*a)[:len(*a)-1] return } } }
[ "func", "(", "a", "*", "Tags", ")", "Delete", "(", "key", "[", "]", "byte", ")", "{", "for", "i", ",", "t", ":=", "range", "*", "a", "{", "if", "bytes", ".", "Equal", "(", "t", ".", "Key", ",", "key", ")", "{", "copy", "(", "(", "*", "a",...
// Delete removes a tag by key.
[ "Delete", "removes", "a", "tag", "by", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2178-L2187
124,794
influxdata/influxdb
models/points.go
Map
func (a Tags) Map() map[string]string { m := make(map[string]string, len(a)) for _, t := range a { m[string(t.Key)] = string(t.Value) } return m }
go
func (a Tags) Map() map[string]string { m := make(map[string]string, len(a)) for _, t := range a { m[string(t.Key)] = string(t.Value) } return m }
[ "func", "(", "a", "Tags", ")", "Map", "(", ")", "map", "[", "string", "]", "string", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "a", ")", ")", "\n", "for", "_", ",", "t", ":=", "range", "a", "{", "m",...
// Map returns a map representation of the tags.
[ "Map", "returns", "a", "map", "representation", "of", "the", "tags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2190-L2196
124,795
influxdata/influxdb
models/points.go
Merge
func (a Tags) Merge(other map[string]string) Tags { merged := make(map[string]string, len(a)+len(other)) for _, t := range a { merged[string(t.Key)] = string(t.Value) } for k, v := range other { merged[k] = v } return NewTags(merged) }
go
func (a Tags) Merge(other map[string]string) Tags { merged := make(map[string]string, len(a)+len(other)) for _, t := range a { merged[string(t.Key)] = string(t.Value) } for k, v := range other { merged[k] = v } return NewTags(merged) }
[ "func", "(", "a", "Tags", ")", "Merge", "(", "other", "map", "[", "string", "]", "string", ")", "Tags", "{", "merged", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "a", ")", "+", "len", "(", "other", ")", ")", "\n", ...
// Merge merges the tags combining the two. If both define a tag with the // same key, the merged value overwrites the old value. // A new map is returned.
[ "Merge", "merges", "the", "tags", "combining", "the", "two", ".", "If", "both", "define", "a", "tag", "with", "the", "same", "key", "the", "merged", "value", "overwrites", "the", "old", "value", ".", "A", "new", "map", "is", "returned", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2201-L2210
124,796
influxdata/influxdb
models/points.go
AppendHashKey
func (a Tags) AppendHashKey(dst []byte) []byte { // Empty maps marshal to empty bytes. if len(a) == 0 { return dst } // Type invariant: Tags are sorted sz := 0 var escaped Tags if a.needsEscape() { var tmp [20]Tag if len(a) < len(tmp) { escaped = tmp[:len(a)] } else { escaped = make(Tags, len(a))...
go
func (a Tags) AppendHashKey(dst []byte) []byte { // Empty maps marshal to empty bytes. if len(a) == 0 { return dst } // Type invariant: Tags are sorted sz := 0 var escaped Tags if a.needsEscape() { var tmp [20]Tag if len(a) < len(tmp) { escaped = tmp[:len(a)] } else { escaped = make(Tags, len(a))...
[ "func", "(", "a", "Tags", ")", "AppendHashKey", "(", "dst", "[", "]", "byte", ")", "[", "]", "byte", "{", "// Empty maps marshal to empty bytes.", "if", "len", "(", "a", ")", "==", "0", "{", "return", "dst", "\n", "}", "\n\n", "// Type invariant: Tags are ...
// AppendHashKey appends the result of hashing all of a tag's keys and values to dst and returns the extended buffer.
[ "AppendHashKey", "appends", "the", "result", "of", "hashing", "all", "of", "a", "tag", "s", "keys", "and", "values", "to", "dst", "and", "returns", "the", "extended", "buffer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2231-L2286
124,797
influxdata/influxdb
models/points.go
CopyTags
func CopyTags(a Tags) Tags { other := make(Tags, len(a)) copy(other, a) return other }
go
func CopyTags(a Tags) Tags { other := make(Tags, len(a)) copy(other, a) return other }
[ "func", "CopyTags", "(", "a", "Tags", ")", "Tags", "{", "other", ":=", "make", "(", "Tags", ",", "len", "(", "a", ")", ")", "\n", "copy", "(", "other", ",", "a", ")", "\n", "return", "other", "\n", "}" ]
// CopyTags returns a shallow copy of tags.
[ "CopyTags", "returns", "a", "shallow", "copy", "of", "tags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2289-L2293
124,798
influxdata/influxdb
models/points.go
DeepCopyTags
func DeepCopyTags(a Tags) Tags { // Calculate size of keys/values in bytes. var n int for _, t := range a { n += len(t.Key) + len(t.Value) } // Build single allocation for all key/values. buf := make([]byte, n) // Copy tags to new set. other := make(Tags, len(a)) for i, t := range a { copy(buf, t.Key) ...
go
func DeepCopyTags(a Tags) Tags { // Calculate size of keys/values in bytes. var n int for _, t := range a { n += len(t.Key) + len(t.Value) } // Build single allocation for all key/values. buf := make([]byte, n) // Copy tags to new set. other := make(Tags, len(a)) for i, t := range a { copy(buf, t.Key) ...
[ "func", "DeepCopyTags", "(", "a", "Tags", ")", "Tags", "{", "// Calculate size of keys/values in bytes.", "var", "n", "int", "\n", "for", "_", ",", "t", ":=", "range", "a", "{", "n", "+=", "len", "(", "t", ".", "Key", ")", "+", "len", "(", "t", ".", ...
// DeepCopyTags returns a deep copy of tags.
[ "DeepCopyTags", "returns", "a", "deep", "copy", "of", "tags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2296-L2317
124,799
influxdata/influxdb
models/points.go
Next
func (p *point) Next() bool { p.it.start = p.it.end if p.it.start >= len(p.fields) { return false } p.it.end, p.it.key = scanTo(p.fields, p.it.start, '=') if escape.IsEscaped(p.it.key) { p.it.keybuf = escape.AppendUnescaped(p.it.keybuf[:0], p.it.key) p.it.key = p.it.keybuf } p.it.end, p.it.valueBuf = sca...
go
func (p *point) Next() bool { p.it.start = p.it.end if p.it.start >= len(p.fields) { return false } p.it.end, p.it.key = scanTo(p.fields, p.it.start, '=') if escape.IsEscaped(p.it.key) { p.it.keybuf = escape.AppendUnescaped(p.it.keybuf[:0], p.it.key) p.it.key = p.it.keybuf } p.it.end, p.it.valueBuf = sca...
[ "func", "(", "p", "*", "point", ")", "Next", "(", ")", "bool", "{", "p", ".", "it", ".", "start", "=", "p", ".", "it", ".", "end", "\n", "if", "p", ".", "it", ".", "start", ">=", "len", "(", "p", ".", "fields", ")", "{", "return", "false", ...
// Next indicates whether there any fields remaining.
[ "Next", "indicates", "whether", "there", "any", "fields", "remaining", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/points.go#L2338-L2381