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,200
influxdata/influxdb
tsdb/tsi1/index_files.go
CompactTo
func (p IndexFiles) CompactTo(w io.Writer, sfile *tsdb.SeriesFile, m, k uint64, cancel <-chan struct{}) (n int64, err error) { var t IndexFileTrailer // Check for cancellation. select { case <-cancel: return n, ErrCompactionInterrupted default: } // Wrap writer in buffered I/O. bw := bufio.NewWriter(w) //...
go
func (p IndexFiles) CompactTo(w io.Writer, sfile *tsdb.SeriesFile, m, k uint64, cancel <-chan struct{}) (n int64, err error) { var t IndexFileTrailer // Check for cancellation. select { case <-cancel: return n, ErrCompactionInterrupted default: } // Wrap writer in buffered I/O. bw := bufio.NewWriter(w) //...
[ "func", "(", "p", "IndexFiles", ")", "CompactTo", "(", "w", "io", ".", "Writer", ",", "sfile", "*", "tsdb", ".", "SeriesFile", ",", "m", ",", "k", "uint64", ",", "cancel", "<-", "chan", "struct", "{", "}", ")", "(", "n", "int64", ",", "err", "err...
// CompactTo merges all index files and writes them to w.
[ "CompactTo", "merges", "all", "index", "files", "and", "writes", "them", "to", "w", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_files.go#L157-L239
124,201
influxdata/influxdb
tsdb/tsi1/index_files.go
Stat
func (p IndexFiles) Stat() (*IndexFilesInfo, error) { var info IndexFilesInfo for _, f := range p { fi, err := os.Stat(f.Path()) if os.IsNotExist(err) { continue } else if err != nil { return nil, err } if fi.Size() > info.MaxSize { info.MaxSize = fi.Size() } if fi.ModTime().After(info.ModTime...
go
func (p IndexFiles) Stat() (*IndexFilesInfo, error) { var info IndexFilesInfo for _, f := range p { fi, err := os.Stat(f.Path()) if os.IsNotExist(err) { continue } else if err != nil { return nil, err } if fi.Size() > info.MaxSize { info.MaxSize = fi.Size() } if fi.ModTime().After(info.ModTime...
[ "func", "(", "p", "IndexFiles", ")", "Stat", "(", ")", "(", "*", "IndexFilesInfo", ",", "error", ")", "{", "var", "info", "IndexFilesInfo", "\n", "for", "_", ",", "f", ":=", "range", "p", "{", "fi", ",", "err", ":=", "os", ".", "Stat", "(", "f", ...
// Stat returns the max index file size and the total file size for all index files.
[ "Stat", "returns", "the", "max", "index", "file", "size", "and", "the", "total", "file", "size", "for", "all", "index", "files", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_files.go#L383-L403
124,202
influxdata/influxdb
storage/readservice/cursor.go
Next
func (c *indexSeriesCursor) Next() *reads.SeriesRow { if c.eof { return nil } // next series key sr, err := c.sqry.Next() if err != nil { c.err = err c.Close() return nil } else if sr == nil { c.Close() return nil } if len(sr.Tags) < 2 { // Invariant broken. c.err = fmt.Errorf("attempted to em...
go
func (c *indexSeriesCursor) Next() *reads.SeriesRow { if c.eof { return nil } // next series key sr, err := c.sqry.Next() if err != nil { c.err = err c.Close() return nil } else if sr == nil { c.Close() return nil } if len(sr.Tags) < 2 { // Invariant broken. c.err = fmt.Errorf("attempted to em...
[ "func", "(", "c", "*", "indexSeriesCursor", ")", "Next", "(", ")", "*", "reads", ".", "SeriesRow", "{", "if", "c", ".", "eof", "{", "return", "nil", "\n", "}", "\n\n", "// next series key", "sr", ",", "err", ":=", "c", ".", "sqry", ".", "Next", "("...
// Next emits a series row containing a series key and possible predicate on that series.
[ "Next", "emits", "a", "series", "row", "containing", "a", "series", "key", "and", "possible", "predicate", "on", "that", "series", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/readservice/cursor.go#L106-L152
124,203
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
Run
func (tl *TestLauncher) Run(ctx context.Context, args ...string) error { args = append(args, "--bolt-path", filepath.Join(tl.Path, "influxd.bolt")) args = append(args, "--engine-path", filepath.Join(tl.Path, "engine")) args = append(args, "--http-bind-address", "127.0.0.1:0") args = append(args, "--log-level", "deb...
go
func (tl *TestLauncher) Run(ctx context.Context, args ...string) error { args = append(args, "--bolt-path", filepath.Join(tl.Path, "influxd.bolt")) args = append(args, "--engine-path", filepath.Join(tl.Path, "engine")) args = append(args, "--http-bind-address", "127.0.0.1:0") args = append(args, "--log-level", "deb...
[ "func", "(", "tl", "*", "TestLauncher", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "args", "...", "string", ")", "error", "{", "args", "=", "append", "(", "args", ",", "\"", "\"", ",", "filepath", ".", "Join", "(", "tl", ".", "Path", ...
// Run executes the program with additional arguments to set paths and ports.
[ "Run", "executes", "the", "program", "with", "additional", "arguments", "to", "set", "paths", "and", "ports", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L74-L80
124,204
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
Shutdown
func (tl *TestLauncher) Shutdown(ctx context.Context) error { tl.Cancel() tl.Launcher.Shutdown(ctx) return os.RemoveAll(tl.Path) }
go
func (tl *TestLauncher) Shutdown(ctx context.Context) error { tl.Cancel() tl.Launcher.Shutdown(ctx) return os.RemoveAll(tl.Path) }
[ "func", "(", "tl", "*", "TestLauncher", ")", "Shutdown", "(", "ctx", "context", ".", "Context", ")", "error", "{", "tl", ".", "Cancel", "(", ")", "\n", "tl", ".", "Launcher", ".", "Shutdown", "(", "ctx", ")", "\n", "return", "os", ".", "RemoveAll", ...
// Shutdown stops the program and cleans up temporary paths.
[ "Shutdown", "stops", "the", "program", "and", "cleans", "up", "temporary", "paths", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L83-L87
124,205
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
ShutdownOrFail
func (tl *TestLauncher) ShutdownOrFail(tb testing.TB, ctx context.Context) { tb.Helper() if err := tl.Shutdown(ctx); err != nil { tb.Fatal(err) } }
go
func (tl *TestLauncher) ShutdownOrFail(tb testing.TB, ctx context.Context) { tb.Helper() if err := tl.Shutdown(ctx); err != nil { tb.Fatal(err) } }
[ "func", "(", "tl", "*", "TestLauncher", ")", "ShutdownOrFail", "(", "tb", "testing", ".", "TB", ",", "ctx", "context", ".", "Context", ")", "{", "tb", ".", "Helper", "(", ")", "\n", "if", "err", ":=", "tl", ".", "Shutdown", "(", "ctx", ")", ";", ...
// ShutdownOrFail stops the program and cleans up temporary paths. Fail on error.
[ "ShutdownOrFail", "stops", "the", "program", "and", "cleans", "up", "temporary", "paths", ".", "Fail", "on", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L90-L95
124,206
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
SetupOrFail
func (tl *TestLauncher) SetupOrFail(tb testing.TB) { results := tl.OnBoardOrFail(tb, &platform.OnboardingRequest{ User: "USER", Password: "PASSWORD", Org: "ORG", Bucket: "BUCKET", }) tl.User = results.User tl.Org = results.Org tl.Bucket = results.Bucket tl.Auth = results.Auth }
go
func (tl *TestLauncher) SetupOrFail(tb testing.TB) { results := tl.OnBoardOrFail(tb, &platform.OnboardingRequest{ User: "USER", Password: "PASSWORD", Org: "ORG", Bucket: "BUCKET", }) tl.User = results.User tl.Org = results.Org tl.Bucket = results.Bucket tl.Auth = results.Auth }
[ "func", "(", "tl", "*", "TestLauncher", ")", "SetupOrFail", "(", "tb", "testing", ".", "TB", ")", "{", "results", ":=", "tl", ".", "OnBoardOrFail", "(", "tb", ",", "&", "platform", ".", "OnboardingRequest", "{", "User", ":", "\"", "\"", ",", "Password"...
// SetupOrFail creates a new user, bucket, org, and auth token. Fail on error.
[ "SetupOrFail", "creates", "a", "new", "user", "bucket", "org", "and", "auth", "token", ".", "Fail", "on", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L98-L110
124,207
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
WriteOrFail
func (tl *TestLauncher) WriteOrFail(tb testing.TB, to *platform.OnboardingResults, data string) { tb.Helper() resp, err := nethttp.DefaultClient.Do(tl.NewHTTPRequestOrFail(tb, "POST", fmt.Sprintf("/api/v2/write?org=%s&bucket=%s", to.Org.ID, to.Bucket.ID), to.Auth.Token, data)) if err != nil { tb.Fatal(err) } bo...
go
func (tl *TestLauncher) WriteOrFail(tb testing.TB, to *platform.OnboardingResults, data string) { tb.Helper() resp, err := nethttp.DefaultClient.Do(tl.NewHTTPRequestOrFail(tb, "POST", fmt.Sprintf("/api/v2/write?org=%s&bucket=%s", to.Org.ID, to.Bucket.ID), to.Auth.Token, data)) if err != nil { tb.Fatal(err) } bo...
[ "func", "(", "tl", "*", "TestLauncher", ")", "WriteOrFail", "(", "tb", "testing", ".", "TB", ",", "to", "*", "platform", ".", "OnboardingResults", ",", "data", "string", ")", "{", "tb", ".", "Helper", "(", ")", "\n", "resp", ",", "err", ":=", "nethtt...
// WriteOrFail attempts a write to the organization and bucket identified by to or fails if there is an error.
[ "WriteOrFail", "attempts", "a", "write", "to", "the", "organization", "and", "bucket", "identified", "by", "to", "or", "fails", "if", "there", "is", "an", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L130-L149
124,208
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
MustExecuteQuery
func (tl *TestLauncher) MustExecuteQuery(query string) *QueryResults { results, err := tl.ExecuteQuery(query) if err != nil { panic(err) } return results }
go
func (tl *TestLauncher) MustExecuteQuery(query string) *QueryResults { results, err := tl.ExecuteQuery(query) if err != nil { panic(err) } return results }
[ "func", "(", "tl", "*", "TestLauncher", ")", "MustExecuteQuery", "(", "query", "string", ")", "*", "QueryResults", "{", "results", ",", "err", ":=", "tl", ".", "ExecuteQuery", "(", "query", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err",...
// MustExecuteQuery executes the provided query panicking if an error is encountered. // Callers of MustExecuteQuery must call Done on the returned QueryResults.
[ "MustExecuteQuery", "executes", "the", "provided", "query", "panicking", "if", "an", "error", "is", "encountered", ".", "Callers", "of", "MustExecuteQuery", "must", "call", "Done", "on", "the", "returned", "QueryResults", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L180-L186
124,209
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
ExecuteQuery
func (tl *TestLauncher) ExecuteQuery(q string) (*QueryResults, error) { fq, err := tl.QueryController().Query(context.Background(), &query.Request{ Authorization: tl.Auth, OrganizationID: tl.Auth.OrgID, Compiler: lang.FluxCompiler{ Query: q, }}) if err != nil { return nil, err } results := make([]flu...
go
func (tl *TestLauncher) ExecuteQuery(q string) (*QueryResults, error) { fq, err := tl.QueryController().Query(context.Background(), &query.Request{ Authorization: tl.Auth, OrganizationID: tl.Auth.OrgID, Compiler: lang.FluxCompiler{ Query: q, }}) if err != nil { return nil, err } results := make([]flu...
[ "func", "(", "tl", "*", "TestLauncher", ")", "ExecuteQuery", "(", "q", "string", ")", "(", "*", "QueryResults", ",", "error", ")", "{", "fq", ",", "err", ":=", "tl", ".", "QueryController", "(", ")", ".", "Query", "(", "context", ".", "Background", "...
// ExecuteQuery executes the provided query against the ith query node. // Callers of ExecuteQuery must call Done on the returned QueryResults.
[ "ExecuteQuery", "executes", "the", "provided", "query", "against", "the", "ith", "query", "node", ".", "Callers", "of", "ExecuteQuery", "must", "call", "Done", "on", "the", "returned", "QueryResults", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L190-L215
124,210
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
QueryAndConsume
func (tl *TestLauncher) QueryAndConsume(ctx context.Context, req *query.Request, fn func(r flux.Result) error) error { res, err := tl.FluxQueryService().Query(ctx, req) if err != nil { return err } // iterate over results to populate res.Err() var gotErr error for res.More() { if err := fn(res.Next()); gotErr...
go
func (tl *TestLauncher) QueryAndConsume(ctx context.Context, req *query.Request, fn func(r flux.Result) error) error { res, err := tl.FluxQueryService().Query(ctx, req) if err != nil { return err } // iterate over results to populate res.Err() var gotErr error for res.More() { if err := fn(res.Next()); gotErr...
[ "func", "(", "tl", "*", "TestLauncher", ")", "QueryAndConsume", "(", "ctx", "context", ".", "Context", ",", "req", "*", "query", ".", "Request", ",", "fn", "func", "(", "r", "flux", ".", "Result", ")", "error", ")", "error", "{", "res", ",", "err", ...
// QueryAndConsume queries InfluxDB using the request provided. It uses a function to consume the results obtained. // It returns the first error encountered when requesting the query, consuming the results, or executing the query.
[ "QueryAndConsume", "queries", "InfluxDB", "using", "the", "request", "provided", ".", "It", "uses", "a", "function", "to", "consume", "the", "results", "obtained", ".", "It", "returns", "the", "first", "error", "encountered", "when", "requesting", "the", "query"...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L219-L235
124,211
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
QueryAndNopConsume
func (tl *TestLauncher) QueryAndNopConsume(ctx context.Context, req *query.Request) error { return tl.QueryAndConsume(ctx, req, func(r flux.Result) error { return r.Tables().Do(func(table flux.Table) error { return nil }) }) }
go
func (tl *TestLauncher) QueryAndNopConsume(ctx context.Context, req *query.Request) error { return tl.QueryAndConsume(ctx, req, func(r flux.Result) error { return r.Tables().Do(func(table flux.Table) error { return nil }) }) }
[ "func", "(", "tl", "*", "TestLauncher", ")", "QueryAndNopConsume", "(", "ctx", "context", ".", "Context", ",", "req", "*", "query", ".", "Request", ")", "error", "{", "return", "tl", ".", "QueryAndConsume", "(", "ctx", ",", "req", ",", "func", "(", "r"...
// QueryAndNopConsume does the same as QueryAndConsume but consumes results with a nop function.
[ "QueryAndNopConsume", "does", "the", "same", "as", "QueryAndConsume", "but", "consumes", "results", "with", "a", "nop", "function", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L238-L244
124,212
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
FluxQueryOrFail
func (tl *TestLauncher) FluxQueryOrFail(tb testing.TB, org *platform.Organization, token string, query string) string { tb.Helper() b, err := http.SimpleQuery(tl.URL(), query, org.Name, token) if err != nil { tb.Fatal(err) } return string(b) }
go
func (tl *TestLauncher) FluxQueryOrFail(tb testing.TB, org *platform.Organization, token string, query string) string { tb.Helper() b, err := http.SimpleQuery(tl.URL(), query, org.Name, token) if err != nil { tb.Fatal(err) } return string(b) }
[ "func", "(", "tl", "*", "TestLauncher", ")", "FluxQueryOrFail", "(", "tb", "testing", ".", "TB", ",", "org", "*", "platform", ".", "Organization", ",", "token", "string", ",", "query", "string", ")", "string", "{", "tb", ".", "Helper", "(", ")", "\n\n"...
// FluxQueryOrFail performs a query to the specified organization and returns the results // or fails if there is an error.
[ "FluxQueryOrFail", "performs", "a", "query", "to", "the", "specified", "organization", "and", "returns", "the", "results", "or", "fails", "if", "there", "is", "an", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L248-L257
124,213
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
HasTablesWithCols
func (r *QueryResult) HasTablesWithCols(want []int) { r.t.Helper() // _start, _stop, _time, _f systemCols := 4 got := []int{} if err := r.q.Tables().Do(func(b flux.Table) error { got = append(got, len(b.Cols())-systemCols) b.Do(func(c flux.ColReader) error { return nil }) return nil }); err != nil { r.t....
go
func (r *QueryResult) HasTablesWithCols(want []int) { r.t.Helper() // _start, _stop, _time, _f systemCols := 4 got := []int{} if err := r.q.Tables().Do(func(b flux.Table) error { got = append(got, len(b.Cols())-systemCols) b.Do(func(c flux.ColReader) error { return nil }) return nil }); err != nil { r.t....
[ "func", "(", "r", "*", "QueryResult", ")", "HasTablesWithCols", "(", "want", "[", "]", "int", ")", "{", "r", ".", "t", ".", "Helper", "(", ")", "\n\n", "// _start, _stop, _time, _f", "systemCols", ":=", "4", "\n", "got", ":=", "[", "]", "int", "{", "...
// HasTableWithCols checks if the desired number of tables and columns exist, // ignoring any system columns. // // If the result is not as expected then the testing.T fails.
[ "HasTableWithCols", "checks", "if", "the", "desired", "number", "of", "tables", "and", "columns", "exist", "ignoring", "any", "system", "columns", ".", "If", "the", "result", "is", "not", "as", "expected", "then", "the", "testing", ".", "T", "fails", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L314-L331
124,214
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
TablesN
func (r *QueryResult) TablesN() int { var total int r.q.Tables().Do(func(b flux.Table) error { total++ b.Do(func(c flux.ColReader) error { return nil }) return nil }) return total }
go
func (r *QueryResult) TablesN() int { var total int r.q.Tables().Do(func(b flux.Table) error { total++ b.Do(func(c flux.ColReader) error { return nil }) return nil }) return total }
[ "func", "(", "r", "*", "QueryResult", ")", "TablesN", "(", ")", "int", "{", "var", "total", "int", "\n", "r", ".", "q", ".", "Tables", "(", ")", ".", "Do", "(", "func", "(", "b", "flux", ".", "Table", ")", "error", "{", "total", "++", "\n", "...
// TablesN returns the number of tables for the result.
[ "TablesN", "returns", "the", "number", "of", "tables", "for", "the", "result", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L334-L342
124,215
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
First
func (r *QueryResults) First(t *testing.T) *QueryResult { r.HasTableCount(t, 1) for _, result := range r.Results { return &QueryResult{t: t, q: result} } return nil }
go
func (r *QueryResults) First(t *testing.T) *QueryResult { r.HasTableCount(t, 1) for _, result := range r.Results { return &QueryResult{t: t, q: result} } return nil }
[ "func", "(", "r", "*", "QueryResults", ")", "First", "(", "t", "*", "testing", ".", "T", ")", "*", "QueryResult", "{", "r", ".", "HasTableCount", "(", "t", ",", "1", ")", "\n", "for", "_", ",", "result", ":=", "range", "r", ".", "Results", "{", ...
// First returns the first QueryResult. When there are not exactly 1 table First // will fail.
[ "First", "returns", "the", "first", "QueryResult", ".", "When", "there", "are", "not", "exactly", "1", "table", "First", "will", "fail", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L356-L362
124,216
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
HasTableCount
func (r *QueryResults) HasTableCount(t *testing.T, n int) { if got, exp := len(r.Results), n; got != exp { t.Fatalf("result has %d tables, expected %d. Tables: %s", got, exp, r.Names()) } }
go
func (r *QueryResults) HasTableCount(t *testing.T, n int) { if got, exp := len(r.Results), n; got != exp { t.Fatalf("result has %d tables, expected %d. Tables: %s", got, exp, r.Names()) } }
[ "func", "(", "r", "*", "QueryResults", ")", "HasTableCount", "(", "t", "*", "testing", ".", "T", ",", "n", "int", ")", "{", "if", "got", ",", "exp", ":=", "len", "(", "r", ".", "Results", ")", ",", "n", ";", "got", "!=", "exp", "{", "t", ".",...
// HasTableCount asserts that there are n tables in the result.
[ "HasTableCount", "asserts", "that", "there", "are", "n", "tables", "in", "the", "result", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L365-L369
124,217
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
Names
func (r *QueryResults) Names() []string { if len(r.Results) == 0 { return nil } names := make([]string, len(r.Results), 0) for _, r := range r.Results { names = append(names, r.Name()) } return names }
go
func (r *QueryResults) Names() []string { if len(r.Results) == 0 { return nil } names := make([]string, len(r.Results), 0) for _, r := range r.Results { names = append(names, r.Name()) } return names }
[ "func", "(", "r", "*", "QueryResults", ")", "Names", "(", ")", "[", "]", "string", "{", "if", "len", "(", "r", ".", "Results", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "names", ":=", "make", "(", "[", "]", "string", ",", "len", ...
// Names returns the sorted set of result names for the query results.
[ "Names", "returns", "the", "sorted", "set", "of", "result", "names", "for", "the", "query", "results", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L372-L381
124,218
influxdata/influxdb
cmd/influxd/launcher/launcher_helpers.go
SortedNames
func (r *QueryResults) SortedNames() []string { names := r.Names() sort.Strings(names) return names }
go
func (r *QueryResults) SortedNames() []string { names := r.Names() sort.Strings(names) return names }
[ "func", "(", "r", "*", "QueryResults", ")", "SortedNames", "(", ")", "[", "]", "string", "{", "names", ":=", "r", ".", "Names", "(", ")", "\n", "sort", ".", "Strings", "(", "names", ")", "\n", "return", "names", "\n", "}" ]
// SortedNames returns the sorted set of table names for the query results.
[ "SortedNames", "returns", "the", "sorted", "set", "of", "table", "names", "for", "the", "query", "results", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/launcher/launcher_helpers.go#L384-L388
124,219
influxdata/influxdb
pkg/pool/generic.go
NewGeneric
func NewGeneric(max int, fn func(sz int) interface{}) *Generic { return &Generic{ pool: make(chan interface{}, max), fn: fn, } }
go
func NewGeneric(max int, fn func(sz int) interface{}) *Generic { return &Generic{ pool: make(chan interface{}, max), fn: fn, } }
[ "func", "NewGeneric", "(", "max", "int", ",", "fn", "func", "(", "sz", "int", ")", "interface", "{", "}", ")", "*", "Generic", "{", "return", "&", "Generic", "{", "pool", ":", "make", "(", "chan", "interface", "{", "}", ",", "max", ")", ",", "fn"...
// NewGeneric returns a Generic pool with capacity for max items // to be pool.
[ "NewGeneric", "returns", "a", "Generic", "pool", "with", "capacity", "for", "max", "items", "to", "be", "pool", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/pool/generic.go#L12-L17
124,220
influxdata/influxdb
pkg/pool/generic.go
Get
func (p *Generic) Get(sz int) interface{} { var c interface{} select { case c = <-p.pool: default: c = p.fn(sz) } return c }
go
func (p *Generic) Get(sz int) interface{} { var c interface{} select { case c = <-p.pool: default: c = p.fn(sz) } return c }
[ "func", "(", "p", "*", "Generic", ")", "Get", "(", "sz", "int", ")", "interface", "{", "}", "{", "var", "c", "interface", "{", "}", "\n", "select", "{", "case", "c", "=", "<-", "p", ".", "pool", ":", "default", ":", "c", "=", "p", ".", "fn", ...
// Get returns a item from the pool or a new instance if the pool // is empty. Items returned may not be in the zero state and should // be reset by the caller.
[ "Get", "returns", "a", "item", "from", "the", "pool", "or", "a", "new", "instance", "if", "the", "pool", "is", "empty", ".", "Items", "returned", "may", "not", "be", "in", "the", "zero", "state", "and", "should", "be", "reset", "by", "the", "caller", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/pool/generic.go#L22-L31
124,221
influxdata/influxdb
tsdb/tsm1/encoding.gen.go
Include
func (a Values) Include(min, max int64) Values { rmin, rmax := a.FindRange(min, max) if rmin == -1 && rmax == -1 { return nil } // a[rmin].UnixNano() ≥ min // a[rmax].UnixNano() ≥ max if rmax < len(a) && a[rmax].UnixNano() == max { rmax++ } if rmin > -1 { b := a[:rmax-rmin] copy(b, a[rmin:rmax]) re...
go
func (a Values) Include(min, max int64) Values { rmin, rmax := a.FindRange(min, max) if rmin == -1 && rmax == -1 { return nil } // a[rmin].UnixNano() ≥ min // a[rmax].UnixNano() ≥ max if rmax < len(a) && a[rmax].UnixNano() == max { rmax++ } if rmin > -1 { b := a[:rmax-rmin] copy(b, a[rmin:rmax]) re...
[ "func", "(", "a", "Values", ")", "Include", "(", "min", ",", "max", "int64", ")", "Values", "{", "rmin", ",", "rmax", ":=", "a", ".", "FindRange", "(", "min", ",", "max", ")", "\n", "if", "rmin", "==", "-", "1", "&&", "rmax", "==", "-", "1", ...
// Include returns the subset values between min and max inclusive. The values must // be deduplicated and sorted before calling Exclude or the results are undefined.
[ "Include", "returns", "the", "subset", "values", "between", "min", "and", "max", "inclusive", ".", "The", "values", "must", "be", "deduplicated", "and", "sorted", "before", "calling", "Exclude", "or", "the", "results", "are", "undefined", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/encoding.gen.go#L96-L116
124,222
influxdata/influxdb
tsdb/tsm1/encoding.gen.go
Deduplicate
func (a UnsignedValues) Deduplicate() UnsignedValues { if len(a) <= 1 { return a } // See if we're already sorted and deduped var needSort bool for i := 1; i < len(a); i++ { if a[i-1].UnixNano() >= a[i].UnixNano() { needSort = true break } } if !needSort { return a } sort.Stable(a) var i int ...
go
func (a UnsignedValues) Deduplicate() UnsignedValues { if len(a) <= 1 { return a } // See if we're already sorted and deduped var needSort bool for i := 1; i < len(a); i++ { if a[i-1].UnixNano() >= a[i].UnixNano() { needSort = true break } } if !needSort { return a } sort.Stable(a) var i int ...
[ "func", "(", "a", "UnsignedValues", ")", "Deduplicate", "(", ")", "UnsignedValues", "{", "if", "len", "(", "a", ")", "<=", "1", "{", "return", "a", "\n", "}", "\n\n", "// See if we're already sorted and deduped", "var", "needSort", "bool", "\n", "for", "i", ...
// Deduplicate returns a new slice with any values that have the same timestamp removed. // The Value that appears last in the slice is the one that is kept. The returned // Values are sorted if necessary.
[ "Deduplicate", "returns", "a", "new", "slice", "with", "any", "values", "that", "have", "the", "same", "timestamp", "removed", ".", "The", "Value", "that", "appears", "last", "in", "the", "slice", "is", "the", "one", "that", "is", "kept", ".", "The", "re...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/encoding.gen.go#L780-L809
124,223
influxdata/influxdb
telemetry/timestamps.go
Transform
func (a *AddTimestamps) Transform(mfs []*dto.MetricFamily) []*dto.MetricFamily { now := a.now if now == nil { now = time.Now } nowMilliseconds := now().UnixNano() / nsPerMillisecond for i := range mfs { for j := range mfs[i].Metric { mfs[i].Metric[j].TimestampMs = &nowMilliseconds } } return mfs }
go
func (a *AddTimestamps) Transform(mfs []*dto.MetricFamily) []*dto.MetricFamily { now := a.now if now == nil { now = time.Now } nowMilliseconds := now().UnixNano() / nsPerMillisecond for i := range mfs { for j := range mfs[i].Metric { mfs[i].Metric[j].TimestampMs = &nowMilliseconds } } return mfs }
[ "func", "(", "a", "*", "AddTimestamps", ")", "Transform", "(", "mfs", "[", "]", "*", "dto", ".", "MetricFamily", ")", "[", "]", "*", "dto", ".", "MetricFamily", "{", "now", ":=", "a", ".", "now", "\n", "if", "now", "==", "nil", "{", "now", "=", ...
// Transform adds now as a timestamp to all metrics.
[ "Transform", "adds", "now", "as", "a", "timestamp", "to", "all", "metrics", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/telemetry/timestamps.go#L23-L36
124,224
influxdata/influxdb
tsdb/metrics.go
newSeriesFileMetrics
func newSeriesFileMetrics(labels prometheus.Labels) *seriesFileMetrics { names := []string{"series_file_partition"} // All metrics have this label. for k := range labels { names = append(names, k) } sort.Strings(names) totalCompactions := append(append([]string(nil), names...), "status") sort.Strings(totalComp...
go
func newSeriesFileMetrics(labels prometheus.Labels) *seriesFileMetrics { names := []string{"series_file_partition"} // All metrics have this label. for k := range labels { names = append(names, k) } sort.Strings(names) totalCompactions := append(append([]string(nil), names...), "status") sort.Strings(totalComp...
[ "func", "newSeriesFileMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "seriesFileMetrics", "{", "names", ":=", "[", "]", "string", "{", "\"", "\"", "}", "// All metrics have this label.", "\n", "for", "k", ":=", "range", "labels", "{", "names",...
// newSeriesFileMetrics initialises the prometheus metrics for tracking the Series File.
[ "newSeriesFileMetrics", "initialises", "the", "prometheus", "metrics", "for", "tracking", "the", "Series", "File", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/metrics.go#L54-L113
124,225
influxdata/influxdb
mock/bucket_service.go
NewBucketService
func NewBucketService() *BucketService { return &BucketService{ OpenFn: func() error { return nil }, CloseFn: func() error { return nil }, WithLoggerFn: func(l *zap.Logger) {}, FindBucketByIDFn: func(context.Context, platform.ID) (*platform.Bucket, error) { return nil, nil }, FindBucke...
go
func NewBucketService() *BucketService { return &BucketService{ OpenFn: func() error { return nil }, CloseFn: func() error { return nil }, WithLoggerFn: func(l *zap.Logger) {}, FindBucketByIDFn: func(context.Context, platform.ID) (*platform.Bucket, error) { return nil, nil }, FindBucke...
[ "func", "NewBucketService", "(", ")", "*", "BucketService", "{", "return", "&", "BucketService", "{", "OpenFn", ":", "func", "(", ")", "error", "{", "return", "nil", "}", ",", "CloseFn", ":", "func", "(", ")", "error", "{", "return", "nil", "}", ",", ...
// NewBucketService returns a mock BucketService where its methods will return // zero values.
[ "NewBucketService", "returns", "a", "mock", "BucketService", "where", "its", "methods", "will", "return", "zero", "values", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/bucket_service.go#L29-L43
124,226
influxdata/influxdb
mock/bucket_service.go
FindBuckets
func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketFilter, opts ...platform.FindOptions) ([]*platform.Bucket, int, error) { return s.FindBucketsFn(ctx, filter, opts...) }
go
func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketFilter, opts ...platform.FindOptions) ([]*platform.Bucket, int, error) { return s.FindBucketsFn(ctx, filter, opts...) }
[ "func", "(", "s", "*", "BucketService", ")", "FindBuckets", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "BucketFilter", ",", "opts", "...", "platform", ".", "FindOptions", ")", "(", "[", "]", "*", "platform", ".", "Bucket", ","...
// FindBuckets returns a list of buckets that match filter and the total count of matching buckets.
[ "FindBuckets", "returns", "a", "list", "of", "buckets", "that", "match", "filter", "and", "the", "total", "count", "of", "matching", "buckets", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/bucket_service.go#L65-L67
124,227
influxdata/influxdb
mock/bucket_service.go
UpdateBucket
func (s *BucketService) UpdateBucket(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error) { return s.UpdateBucketFn(ctx, id, upd) }
go
func (s *BucketService) UpdateBucket(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error) { return s.UpdateBucketFn(ctx, id, upd) }
[ "func", "(", "s", "*", "BucketService", ")", "UpdateBucket", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "upd", "platform", ".", "BucketUpdate", ")", "(", "*", "platform", ".", "Bucket", ",", "error", ")", "{", "return...
// UpdateBucket updates a single bucket with changeset.
[ "UpdateBucket", "updates", "a", "single", "bucket", "with", "changeset", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/bucket_service.go#L75-L77
124,228
influxdata/influxdb
mock/kv.go
View
func (s *Store) View(ctx context.Context, fn func(kv.Tx) error) error { return s.ViewFn(fn) }
go
func (s *Store) View(ctx context.Context, fn func(kv.Tx) error) error { return s.ViewFn(fn) }
[ "func", "(", "s", "*", "Store", ")", "View", "(", "ctx", "context", ".", "Context", ",", "fn", "func", "(", "kv", ".", "Tx", ")", "error", ")", "error", "{", "return", "s", ".", "ViewFn", "(", "fn", ")", "\n", "}" ]
// View opens up a transaction that will not write to any data. Implementing interfaces // should take care to ensure that all view transactions do not mutate any data.
[ "View", "opens", "up", "a", "transaction", "that", "will", "not", "write", "to", "any", "data", ".", "Implementing", "interfaces", "should", "take", "care", "to", "ensure", "that", "all", "view", "transactions", "do", "not", "mutate", "any", "data", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/kv.go#L19-L21
124,229
influxdata/influxdb
mock/kv.go
Update
func (s *Store) Update(ctx context.Context, fn func(kv.Tx) error) error { return s.UpdateFn(fn) }
go
func (s *Store) Update(ctx context.Context, fn func(kv.Tx) error) error { return s.UpdateFn(fn) }
[ "func", "(", "s", "*", "Store", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "fn", "func", "(", "kv", ".", "Tx", ")", "error", ")", "error", "{", "return", "s", ".", "UpdateFn", "(", "fn", ")", "\n", "}" ]
// Update opens up a transaction that will mutate data.
[ "Update", "opens", "up", "a", "transaction", "that", "will", "mutate", "data", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/kv.go#L24-L26
124,230
influxdata/influxdb
mock/kv.go
Bucket
func (t *Tx) Bucket(b []byte) (kv.Bucket, error) { return t.BucketFn(b) }
go
func (t *Tx) Bucket(b []byte) (kv.Bucket, error) { return t.BucketFn(b) }
[ "func", "(", "t", "*", "Tx", ")", "Bucket", "(", "b", "[", "]", "byte", ")", "(", "kv", ".", "Bucket", ",", "error", ")", "{", "return", "t", ".", "BucketFn", "(", "b", ")", "\n", "}" ]
// Bucket possibly creates and returns bucket, b.
[ "Bucket", "possibly", "creates", "and", "returns", "bucket", "b", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/kv.go#L38-L40
124,231
influxdata/influxdb
mock/kv.go
Get
func (b *Bucket) Get(key []byte) ([]byte, error) { return b.GetFn(key) }
go
func (b *Bucket) Get(key []byte) ([]byte, error) { return b.GetFn(key) }
[ "func", "(", "b", "*", "Bucket", ")", "Get", "(", "key", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "b", ".", "GetFn", "(", "key", ")", "\n", "}" ]
// Get returns a key within this bucket. Errors if key does not exist.
[ "Get", "returns", "a", "key", "within", "this", "bucket", ".", "Errors", "if", "key", "does", "not", "exist", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/kv.go#L64-L66
124,232
influxdata/influxdb
mock/kv.go
Put
func (b *Bucket) Put(key, value []byte) error { return b.PutFn(key, value) }
go
func (b *Bucket) Put(key, value []byte) error { return b.PutFn(key, value) }
[ "func", "(", "b", "*", "Bucket", ")", "Put", "(", "key", ",", "value", "[", "]", "byte", ")", "error", "{", "return", "b", ".", "PutFn", "(", "key", ",", "value", ")", "\n", "}" ]
// Put should error if the transaction it was called in is not writable.
[ "Put", "should", "error", "if", "the", "transaction", "it", "was", "called", "in", "is", "not", "writable", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/kv.go#L74-L76
124,233
influxdata/influxdb
mock/kv.go
Seek
func (c *Cursor) Seek(prefix []byte) (k []byte, v []byte) { return c.SeekFn(prefix) }
go
func (c *Cursor) Seek(prefix []byte) (k []byte, v []byte) { return c.SeekFn(prefix) }
[ "func", "(", "c", "*", "Cursor", ")", "Seek", "(", "prefix", "[", "]", "byte", ")", "(", "k", "[", "]", "byte", ",", "v", "[", "]", "byte", ")", "{", "return", "c", ".", "SeekFn", "(", "prefix", ")", "\n", "}" ]
// Seek moves the cursor forward until reaching prefix in the key name.
[ "Seek", "moves", "the", "cursor", "forward", "until", "reaching", "prefix", "in", "the", "key", "name", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/kv.go#L96-L98
124,234
influxdata/influxdb
tsdb/tsm1/tombstone.go
NewTombstoner
func NewTombstoner(path string, filterFn func(k []byte) bool) *Tombstoner { return &Tombstoner{ Path: path, FilterFn: filterFn, obs: noFileStoreObserver{}, } }
go
func NewTombstoner(path string, filterFn func(k []byte) bool) *Tombstoner { return &Tombstoner{ Path: path, FilterFn: filterFn, obs: noFileStoreObserver{}, } }
[ "func", "NewTombstoner", "(", "path", "string", ",", "filterFn", "func", "(", "k", "[", "]", "byte", ")", "bool", ")", "*", "Tombstoner", "{", "return", "&", "Tombstoner", "{", "Path", ":", "path", ",", "FilterFn", ":", "filterFn", ",", "obs", ":", "...
// NewTombstoner constructs a Tombstoner for the given path. FilterFn can be nil.
[ "NewTombstoner", "constructs", "a", "Tombstoner", "for", "the", "given", "path", ".", "FilterFn", "can", "be", "nil", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L101-L107
124,235
influxdata/influxdb
tsdb/tsm1/tombstone.go
WithObserver
func (t *Tombstoner) WithObserver(obs FileStoreObserver) { if obs == nil { obs = noFileStoreObserver{} } t.obs = obs }
go
func (t *Tombstoner) WithObserver(obs FileStoreObserver) { if obs == nil { obs = noFileStoreObserver{} } t.obs = obs }
[ "func", "(", "t", "*", "Tombstoner", ")", "WithObserver", "(", "obs", "FileStoreObserver", ")", "{", "if", "obs", "==", "nil", "{", "obs", "=", "noFileStoreObserver", "{", "}", "\n", "}", "\n", "t", ".", "obs", "=", "obs", "\n", "}" ]
// WithObserver sets a FileStoreObserver for when the tombstone file is written.
[ "WithObserver", "sets", "a", "FileStoreObserver", "for", "when", "the", "tombstone", "file", "is", "written", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L132-L137
124,236
influxdata/influxdb
tsdb/tsm1/tombstone.go
AddPrefix
func (t *Tombstoner) AddPrefix(key []byte) error { return t.AddPrefixRange(key, math.MinInt64, math.MaxInt64) }
go
func (t *Tombstoner) AddPrefix(key []byte) error { return t.AddPrefixRange(key, math.MinInt64, math.MaxInt64) }
[ "func", "(", "t", "*", "Tombstoner", ")", "AddPrefix", "(", "key", "[", "]", "byte", ")", "error", "{", "return", "t", ".", "AddPrefixRange", "(", "key", ",", "math", ".", "MinInt64", ",", "math", ".", "MaxInt64", ")", "\n", "}" ]
// AddPrefix adds a prefix-based tombstone key.
[ "AddPrefix", "adds", "a", "prefix", "-", "based", "tombstone", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L140-L142
124,237
influxdata/influxdb
tsdb/tsm1/tombstone.go
AddPrefixRange
func (t *Tombstoner) AddPrefixRange(key []byte, min, max int64) error { t.mu.Lock() defer t.mu.Unlock() // If this TSMFile has not been written (mainly in tests), don't write a // tombstone because the keys will not be written when it's actually saved. if t.Path == "" { return nil } t.statsLoaded = false i...
go
func (t *Tombstoner) AddPrefixRange(key []byte, min, max int64) error { t.mu.Lock() defer t.mu.Unlock() // If this TSMFile has not been written (mainly in tests), don't write a // tombstone because the keys will not be written when it's actually saved. if t.Path == "" { return nil } t.statsLoaded = false i...
[ "func", "(", "t", "*", "Tombstoner", ")", "AddPrefixRange", "(", "key", "[", "]", "byte", ",", "min", ",", "max", "int64", ")", "error", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n",...
// AddPrefixRange adds a prefix-based tombstone key with an explicit range.
[ "AddPrefixRange", "adds", "a", "prefix", "-", "based", "tombstone", "key", "with", "an", "explicit", "range", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L145-L167
124,238
influxdata/influxdb
tsdb/tsm1/tombstone.go
Add
func (t *Tombstoner) Add(keys [][]byte) error { return t.AddRange(keys, math.MinInt64, math.MaxInt64) }
go
func (t *Tombstoner) Add(keys [][]byte) error { return t.AddRange(keys, math.MinInt64, math.MaxInt64) }
[ "func", "(", "t", "*", "Tombstoner", ")", "Add", "(", "keys", "[", "]", "[", "]", "byte", ")", "error", "{", "return", "t", ".", "AddRange", "(", "keys", ",", "math", ".", "MinInt64", ",", "math", ".", "MaxInt64", ")", "\n", "}" ]
// Add adds the all keys, across all timestamps, to the tombstone.
[ "Add", "adds", "the", "all", "keys", "across", "all", "timestamps", "to", "the", "tombstone", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L170-L172
124,239
influxdata/influxdb
tsdb/tsm1/tombstone.go
AddRange
func (t *Tombstoner) AddRange(keys [][]byte, min, max int64) error { for t.FilterFn != nil && len(keys) > 0 && !t.FilterFn(keys[0]) { keys = keys[1:] } if len(keys) == 0 { return nil } t.mu.Lock() defer t.mu.Unlock() // If this TSMFile has not been written (mainly in tests), don't write a // tombstone be...
go
func (t *Tombstoner) AddRange(keys [][]byte, min, max int64) error { for t.FilterFn != nil && len(keys) > 0 && !t.FilterFn(keys[0]) { keys = keys[1:] } if len(keys) == 0 { return nil } t.mu.Lock() defer t.mu.Unlock() // If this TSMFile has not been written (mainly in tests), don't write a // tombstone be...
[ "func", "(", "t", "*", "Tombstoner", ")", "AddRange", "(", "keys", "[", "]", "[", "]", "byte", ",", "min", ",", "max", "int64", ")", "error", "{", "for", "t", ".", "FilterFn", "!=", "nil", "&&", "len", "(", "keys", ")", ">", "0", "&&", "!", "...
// AddRange adds all keys to the tombstone specifying only the data between min and max to be removed.
[ "AddRange", "adds", "all", "keys", "to", "the", "tombstone", "specifying", "only", "the", "data", "between", "min", "and", "max", "to", "be", "removed", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L175-L214
124,240
influxdata/influxdb
tsdb/tsm1/tombstone.go
Delete
func (t *Tombstoner) Delete() error { t.mu.Lock() defer t.mu.Unlock() if err := os.RemoveAll(t.tombstonePath()); err != nil { return err } t.statsLoaded = false t.lastAppliedOffset = 0 return nil }
go
func (t *Tombstoner) Delete() error { t.mu.Lock() defer t.mu.Unlock() if err := os.RemoveAll(t.tombstonePath()); err != nil { return err } t.statsLoaded = false t.lastAppliedOffset = 0 return nil }
[ "func", "(", "t", "*", "Tombstoner", ")", "Delete", "(", ")", "error", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", "os", ".", "RemoveAll", "(", "t", ".", "tombst...
// Delete removes all the tombstone files from disk.
[ "Delete", "removes", "all", "the", "tombstone", "files", "from", "disk", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L235-L245
124,241
influxdata/influxdb
tsdb/tsm1/tombstone.go
TombstoneFiles
func (t *Tombstoner) TombstoneFiles() []FileStat { t.mu.RLock() if t.statsLoaded { stats := t.fileStats t.mu.RUnlock() return stats } t.mu.RUnlock() stat, err := os.Stat(t.tombstonePath()) if os.IsNotExist(err) || err != nil { t.mu.Lock() // The file doesn't exist so record that we tried to load it so ...
go
func (t *Tombstoner) TombstoneFiles() []FileStat { t.mu.RLock() if t.statsLoaded { stats := t.fileStats t.mu.RUnlock() return stats } t.mu.RUnlock() stat, err := os.Stat(t.tombstonePath()) if os.IsNotExist(err) || err != nil { t.mu.Lock() // The file doesn't exist so record that we tried to load it so ...
[ "func", "(", "t", "*", "Tombstoner", ")", "TombstoneFiles", "(", ")", "[", "]", "FileStat", "{", "t", ".", "mu", ".", "RLock", "(", ")", "\n", "if", "t", ".", "statsLoaded", "{", "stats", ":=", "t", ".", "fileStats", "\n", "t", ".", "mu", ".", ...
// TombstoneFiles returns any tombstone files associated with Tombstoner's TSM file.
[ "TombstoneFiles", "returns", "any", "tombstone", "files", "associated", "with", "Tombstoner", "s", "TSM", "file", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L258-L289
124,242
influxdata/influxdb
tsdb/tsm1/tombstone.go
Walk
func (t *Tombstoner) Walk(fn func(t Tombstone) error) error { t.mu.Lock() defer t.mu.Unlock() f, err := os.Open(t.tombstonePath()) if os.IsNotExist(err) { return nil } else if err != nil { return err } defer f.Close() var b [4]byte if _, err := f.Read(b[:]); err != nil { return errors.New("unable to re...
go
func (t *Tombstoner) Walk(fn func(t Tombstone) error) error { t.mu.Lock() defer t.mu.Unlock() f, err := os.Open(t.tombstonePath()) if os.IsNotExist(err) { return nil } else if err != nil { return err } defer f.Close() var b [4]byte if _, err := f.Read(b[:]); err != nil { return errors.New("unable to re...
[ "func", "(", "t", "*", "Tombstoner", ")", "Walk", "(", "fn", "func", "(", "t", "Tombstone", ")", "error", ")", "error", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "f", ",", "err...
// Walk calls fn for every Tombstone under the Tombstoner.
[ "Walk", "calls", "fn", "for", "every", "Tombstone", "under", "the", "Tombstoner", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/tombstone.go#L292-L318
124,243
influxdata/influxdb
task/backend/executor/executor.go
NewAsyncQueryServiceExecutor
func NewAsyncQueryServiceExecutor(logger *zap.Logger, qs query.AsyncQueryService, as influxdb.AuthorizationService, ts influxdb.TaskService) backend.Executor { return &asyncQueryServiceExecutor{logger: logger, qs: qs, as: as, ts: ts} }
go
func NewAsyncQueryServiceExecutor(logger *zap.Logger, qs query.AsyncQueryService, as influxdb.AuthorizationService, ts influxdb.TaskService) backend.Executor { return &asyncQueryServiceExecutor{logger: logger, qs: qs, as: as, ts: ts} }
[ "func", "NewAsyncQueryServiceExecutor", "(", "logger", "*", "zap", ".", "Logger", ",", "qs", "query", ".", "AsyncQueryService", ",", "as", "influxdb", ".", "AuthorizationService", ",", "ts", "influxdb", ".", "TaskService", ")", "backend", ".", "Executor", "{", ...
// NewAsyncQueryServiceExecutor returns a new executor based on the given AsyncQueryService.
[ "NewAsyncQueryServiceExecutor", "returns", "a", "new", "executor", "based", "on", "the", "given", "AsyncQueryService", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/executor/executor.go#L222-L224
124,244
influxdata/influxdb
task/backend/executor/executor.go
exhaustResultIterators
func exhaustResultIterators(res flux.Result) error { return res.Tables().Do(func(tbl flux.Table) error { return tbl.Do(func(flux.ColReader) error { return nil }) }) }
go
func exhaustResultIterators(res flux.Result) error { return res.Tables().Do(func(tbl flux.Table) error { return tbl.Do(func(flux.ColReader) error { return nil }) }) }
[ "func", "exhaustResultIterators", "(", "res", "flux", ".", "Result", ")", "error", "{", "return", "res", ".", "Tables", "(", ")", ".", "Do", "(", "func", "(", "tbl", "flux", ".", "Table", ")", "error", "{", "return", "tbl", ".", "Do", "(", "func", ...
// exhaustResultIterators drains all the iterators from a flux query Result.
[ "exhaustResultIterators", "drains", "all", "the", "iterators", "from", "a", "flux", "query", "Result", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/executor/executor.go#L395-L401
124,245
influxdata/influxdb
chronograf/dist/dir.go
NewDir
func NewDir(dir, def string) Dir { return Dir{ Default: def, dir: http.Dir(dir), } }
go
func NewDir(dir, def string) Dir { return Dir{ Default: def, dir: http.Dir(dir), } }
[ "func", "NewDir", "(", "dir", ",", "def", "string", ")", "Dir", "{", "return", "Dir", "{", "Default", ":", "def", ",", "dir", ":", "http", ".", "Dir", "(", "dir", ")", ",", "}", "\n", "}" ]
// NewDir constructs a Dir with a default file
[ "NewDir", "constructs", "a", "Dir", "with", "a", "default", "file" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/dist/dir.go#L15-L20
124,246
influxdata/influxdb
chronograf/dist/dir.go
Open
func (d Dir) Open(name string) (http.File, error) { f, err := d.dir.Open(name) if err != nil { f, err = os.Open(d.Default) if err != nil { return nil, err } return f, nil } return f, err }
go
func (d Dir) Open(name string) (http.File, error) { f, err := d.dir.Open(name) if err != nil { f, err = os.Open(d.Default) if err != nil { return nil, err } return f, nil } return f, err }
[ "func", "(", "d", "Dir", ")", "Open", "(", "name", "string", ")", "(", "http", ".", "File", ",", "error", ")", "{", "f", ",", "err", ":=", "d", ".", "dir", ".", "Open", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "f", ",", "err",...
// Open will return the file in the dir if it exists, or, the Default file otherwise.
[ "Open", "will", "return", "the", "file", "in", "the", "dir", "if", "it", "exists", "or", "the", "Default", "file", "otherwise", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/dist/dir.go#L23-L33
124,247
influxdata/influxdb
tsdb/explode.go
DecodeName
func DecodeName(name [16]byte) (org, bucket platform.ID) { org = platform.ID(binary.BigEndian.Uint64(name[0:8])) bucket = platform.ID(binary.BigEndian.Uint64(name[8:16])) return }
go
func DecodeName(name [16]byte) (org, bucket platform.ID) { org = platform.ID(binary.BigEndian.Uint64(name[0:8])) bucket = platform.ID(binary.BigEndian.Uint64(name[8:16])) return }
[ "func", "DecodeName", "(", "name", "[", "16", "]", "byte", ")", "(", "org", ",", "bucket", "platform", ".", "ID", ")", "{", "org", "=", "platform", ".", "ID", "(", "binary", ".", "BigEndian", ".", "Uint64", "(", "name", "[", "0", ":", "8", "]", ...
// DecodeName converts tsdb internal serialization back to organization and bucket IDs.
[ "DecodeName", "converts", "tsdb", "internal", "serialization", "back", "to", "organization", "and", "bucket", "IDs", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/explode.go#L11-L15
124,248
influxdata/influxdb
tsdb/tsm1/reader_index_iterator.go
Peek
func (t *TSMIndexIterator) Peek() []byte { if !t.ok || t.err != nil { return nil } if !t.peeked { t.ok = t.iter.Next() t.peeked = true } if !t.ok { return nil } return t.iter.Key(t.b) }
go
func (t *TSMIndexIterator) Peek() []byte { if !t.ok || t.err != nil { return nil } if !t.peeked { t.ok = t.iter.Next() t.peeked = true } if !t.ok { return nil } return t.iter.Key(t.b) }
[ "func", "(", "t", "*", "TSMIndexIterator", ")", "Peek", "(", ")", "[", "]", "byte", "{", "if", "!", "t", ".", "ok", "||", "t", ".", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "!", "t", ".", "peeked", "{", "t", ".", "ok...
// Peek reports the next key or nil if there is not one or an error happened.
[ "Peek", "reports", "the", "next", "key", "or", "nil", "if", "there", "is", "not", "one", "or", "an", "error", "happened", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_index_iterator.go#L98-L112
124,249
influxdata/influxdb
tsdb/tsm1/reader_index_iterator.go
Key
func (t *TSMIndexIterator) Key() []byte { if t.key == nil { buf := t.b.access(t.offset, 0) t.key = readKey(buf) t.typ = buf[2+len(t.key)] } return t.key }
go
func (t *TSMIndexIterator) Key() []byte { if t.key == nil { buf := t.b.access(t.offset, 0) t.key = readKey(buf) t.typ = buf[2+len(t.key)] } return t.key }
[ "func", "(", "t", "*", "TSMIndexIterator", ")", "Key", "(", ")", "[", "]", "byte", "{", "if", "t", ".", "key", "==", "nil", "{", "buf", ":=", "t", ".", "b", ".", "access", "(", "t", ".", "offset", ",", "0", ")", "\n", "t", ".", "key", "=", ...
// Key reports the current key.
[ "Key", "reports", "the", "current", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_index_iterator.go#L115-L122
124,250
influxdata/influxdb
tsdb/tsm1/reader_index_iterator.go
Entries
func (t *TSMIndexIterator) Entries() []IndexEntry { if len(t.entries) == 0 { buf := t.b.access(t.eoffset, 0) t.entries, t.err = readEntries(buf, t.entries) } if t.err != nil { return nil } return t.entries }
go
func (t *TSMIndexIterator) Entries() []IndexEntry { if len(t.entries) == 0 { buf := t.b.access(t.eoffset, 0) t.entries, t.err = readEntries(buf, t.entries) } if t.err != nil { return nil } return t.entries }
[ "func", "(", "t", "*", "TSMIndexIterator", ")", "Entries", "(", ")", "[", "]", "IndexEntry", "{", "if", "len", "(", "t", ".", "entries", ")", "==", "0", "{", "buf", ":=", "t", ".", "b", ".", "access", "(", "t", ".", "eoffset", ",", "0", ")", ...
// Entries reports the current list of entries.
[ "Entries", "reports", "the", "current", "list", "of", "entries", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_index_iterator.go#L135-L144
124,251
influxdata/influxdb
http/org_service.go
NewOrgBackend
func NewOrgBackend(b *APIBackend) *OrgBackend { return &OrgBackend{ Logger: b.Logger.With(zap.String("handler", "org")), OrganizationService: b.OrganizationService, OrganizationOperationLogService: b.OrganizationOperationLogService, UserResourceMappingService: b.UserResourceMappingService, ...
go
func NewOrgBackend(b *APIBackend) *OrgBackend { return &OrgBackend{ Logger: b.Logger.With(zap.String("handler", "org")), OrganizationService: b.OrganizationService, OrganizationOperationLogService: b.OrganizationOperationLogService, UserResourceMappingService: b.UserResourceMappingService, ...
[ "func", "NewOrgBackend", "(", "b", "*", "APIBackend", ")", "*", "OrgBackend", "{", "return", "&", "OrgBackend", "{", "Logger", ":", "b", ".", "Logger", ".", "With", "(", "zap", ".", "String", "(", "\"", "\"", ",", "\"", "\"", ")", ")", ",", "Organi...
// NewOrgBackend is a datasource used by the org handler.
[ "NewOrgBackend", "is", "a", "datasource", "used", "by", "the", "org", "handler", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/org_service.go#L32-L43
124,252
influxdata/influxdb
http/org_service.go
FindOrganizationByID
func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Organization, error) { filter := influxdb.OrganizationFilter{ID: &id} o, err := s.FindOrganization(ctx, filter) if err != nil { return nil, &influxdb.Error{ Err: err, Op: s.OpPrefix + influxdb.OpFindOrganizati...
go
func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Organization, error) { filter := influxdb.OrganizationFilter{ID: &id} o, err := s.FindOrganization(ctx, filter) if err != nil { return nil, &influxdb.Error{ Err: err, Op: s.OpPrefix + influxdb.OpFindOrganizati...
[ "func", "(", "s", "*", "OrganizationService", ")", "FindOrganizationByID", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "(", "*", "influxdb", ".", "Organization", ",", "error", ")", "{", "filter", ":=", "influxdb", ".", "...
// FindOrganizationByID gets a single organization with a given id using HTTP.
[ "FindOrganizationByID", "gets", "a", "single", "organization", "with", "a", "given", "id", "using", "HTTP", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/org_service.go#L581-L591
124,253
influxdata/influxdb
http/org_service.go
handleGetOrgLog
func (h *OrgHandler) handleGetOrgLog(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodeGetOrganizationLogRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } log, _, err := h.OrganizationOperationLogService.GetOrganizationOperationLog(ctx, req.OrganizationID, req.opt...
go
func (h *OrgHandler) handleGetOrgLog(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodeGetOrganizationLogRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } log, _, err := h.OrganizationOperationLogService.GetOrganizationOperationLog(ctx, req.OrganizationID, req.opt...
[ "func", "(", "h", "*", "OrgHandler", ")", "handleGetOrgLog", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "req", ",", "err", ":=", "decodeGetOrganizationLo...
// hanldeGetOrganizationLog retrieves a organization log by the organizations ID.
[ "hanldeGetOrganizationLog", "retrieves", "a", "organization", "log", "by", "the", "organizations", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/org_service.go#L823-L842
124,254
influxdata/influxdb
pkg/lifecycle/resource_debug.go
init
func init() { if !resourceDebugEnabled { return } // This goroutine will dump all live references and where they were created // when SIGUSR2 is sent to the process. go func() { ch := make(chan os.Signal, 1) signal.Notify(ch, syscall.SIGUSR2) for range ch { live.mu.Lock() for id, pcs := range live.l...
go
func init() { if !resourceDebugEnabled { return } // This goroutine will dump all live references and where they were created // when SIGUSR2 is sent to the process. go func() { ch := make(chan os.Signal, 1) signal.Notify(ch, syscall.SIGUSR2) for range ch { live.mu.Lock() for id, pcs := range live.l...
[ "func", "init", "(", ")", "{", "if", "!", "resourceDebugEnabled", "{", "return", "\n", "}", "\n\n", "// This goroutine will dump all live references and where they were created", "// when SIGUSR2 is sent to the process.", "go", "func", "(", ")", "{", "ch", ":=", "make", ...
// When in debug mode, we associate each reference an id and with that id the // stack trace that created it. We can't directly refer to the reference here // because we also associate a finalizer to print to stderr if a reference is // leaked, including where it came from if possible.
[ "When", "in", "debug", "mode", "we", "associate", "each", "reference", "an", "id", "and", "with", "that", "id", "the", "stack", "trace", "that", "created", "it", ".", "We", "can", "t", "directly", "refer", "to", "the", "reference", "here", "because", "we...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource_debug.go#L22-L43
124,255
influxdata/influxdb
pkg/lifecycle/resource_debug.go
resourceClosed
func resourceClosed() error { if !resourceDebugEnabled { return errors.New("resource closed") } var buf [4096]byte return fmt.Errorf("resource closed:\n%s", buf[:runtime.Stack(buf[:], false)]) }
go
func resourceClosed() error { if !resourceDebugEnabled { return errors.New("resource closed") } var buf [4096]byte return fmt.Errorf("resource closed:\n%s", buf[:runtime.Stack(buf[:], false)]) }
[ "func", "resourceClosed", "(", ")", "error", "{", "if", "!", "resourceDebugEnabled", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "buf", "[", "4096", "]", "byte", "\n", "return", "fmt", ".", "Errorf", "(", "\""...
// resourceClosed returns an error stating that some resource is closed with the // stack trace of the caller embedded.
[ "resourceClosed", "returns", "an", "error", "stating", "that", "some", "resource", "is", "closed", "with", "the", "stack", "trace", "of", "the", "caller", "embedded", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource_debug.go#L47-L54
124,256
influxdata/influxdb
pkg/lifecycle/resource_debug.go
untrack
func (l *liveReferences) untrack(r *Reference) { if !resourceDebugEnabled { return } l.mu.Lock() delete(l.live, r.id) runtime.SetFinalizer(r, nil) l.mu.Unlock() }
go
func (l *liveReferences) untrack(r *Reference) { if !resourceDebugEnabled { return } l.mu.Lock() delete(l.live, r.id) runtime.SetFinalizer(r, nil) l.mu.Unlock() }
[ "func", "(", "l", "*", "liveReferences", ")", "untrack", "(", "r", "*", "Reference", ")", "{", "if", "!", "resourceDebugEnabled", "{", "return", "\n", "}", "\n\n", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "delete", "(", "l", ".", "live", ",", ...
// finishId informs the liveReferences that the id is no longer in use.
[ "finishId", "informs", "the", "liveReferences", "that", "the", "id", "is", "no", "longer", "in", "use", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource_debug.go#L68-L77
124,257
influxdata/influxdb
pkg/lifecycle/resource_debug.go
track
func (l *liveReferences) track(r *Reference) *Reference { if !resourceDebugEnabled { return r } var buf [32]uintptr pcs := append([]uintptr(nil), buf[:runtime.Callers(3, buf[:])]...) l.mu.Lock() r.id, l.id = l.id, l.id+1 l.live[r.id] = pcs l.mu.Unlock() runtime.SetFinalizer(r, func(r *Reference) { l.lea...
go
func (l *liveReferences) track(r *Reference) *Reference { if !resourceDebugEnabled { return r } var buf [32]uintptr pcs := append([]uintptr(nil), buf[:runtime.Callers(3, buf[:])]...) l.mu.Lock() r.id, l.id = l.id, l.id+1 l.live[r.id] = pcs l.mu.Unlock() runtime.SetFinalizer(r, func(r *Reference) { l.lea...
[ "func", "(", "l", "*", "liveReferences", ")", "track", "(", "r", "*", "Reference", ")", "*", "Reference", "{", "if", "!", "resourceDebugEnabled", "{", "return", "r", "\n", "}", "\n\n", "var", "buf", "[", "32", "]", "uintptr", "\n", "pcs", ":=", "appe...
// withFinalizer associates a finalizer with the Reference that will cause it // to print a leak message if it is not closed before it is garbage collected.
[ "withFinalizer", "associates", "a", "finalizer", "with", "the", "Reference", "that", "will", "cause", "it", "to", "print", "a", "leak", "message", "if", "it", "is", "not", "closed", "before", "it", "is", "garbage", "collected", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource_debug.go#L81-L100
124,258
influxdata/influxdb
pkg/lifecycle/resource_debug.go
leaked
func (l *liveReferences) leaked(r *Reference) { if !resourceDebugEnabled { return } l.mu.Lock() pcs, ok := l.live[r.id] l.mu.Unlock() if !ok { fmt.Fprintln(os.Stderr, "=====================================================") fmt.Fprintln(os.Stderr, "=== Leaked a reference with no stack associated!? ===") ...
go
func (l *liveReferences) leaked(r *Reference) { if !resourceDebugEnabled { return } l.mu.Lock() pcs, ok := l.live[r.id] l.mu.Unlock() if !ok { fmt.Fprintln(os.Stderr, "=====================================================") fmt.Fprintln(os.Stderr, "=== Leaked a reference with no stack associated!? ===") ...
[ "func", "(", "l", "*", "liveReferences", ")", "leaked", "(", "r", "*", "Reference", ")", "{", "if", "!", "resourceDebugEnabled", "{", "return", "\n", "}", "\n\n", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "pcs", ",", "ok", ":=", "l", ".", "liv...
// leaked prints a loud message on stderr that the Reference was leaked and // what was responsible for calling it.
[ "leaked", "prints", "a", "loud", "message", "on", "stderr", "that", "the", "Reference", "was", "leaked", "and", "what", "was", "responsible", "for", "calling", "it", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource_debug.go#L104-L124
124,259
influxdata/influxdb
pkg/lifecycle/resource_debug.go
summarizeStack
func summarizeStack(w io.Writer, pcs []uintptr) { frames := runtime.CallersFrames(pcs) for { frame, more := frames.Next() if !more { break } fmt.Fprintf(w, " %s:%s:%d\n", frame.Function, filepath.Base(frame.File), frame.Line) } }
go
func summarizeStack(w io.Writer, pcs []uintptr) { frames := runtime.CallersFrames(pcs) for { frame, more := frames.Next() if !more { break } fmt.Fprintf(w, " %s:%s:%d\n", frame.Function, filepath.Base(frame.File), frame.Line) } }
[ "func", "summarizeStack", "(", "w", "io", ".", "Writer", ",", "pcs", "[", "]", "uintptr", ")", "{", "frames", ":=", "runtime", ".", "CallersFrames", "(", "pcs", ")", "\n", "for", "{", "frame", ",", "more", ":=", "frames", ".", "Next", "(", ")", "\n...
// summarizeStack prints a line for each stack entry in the pcs to the writer.
[ "summarizeStack", "prints", "a", "line", "for", "each", "stack", "entry", "in", "the", "pcs", "to", "the", "writer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource_debug.go#L127-L139
124,260
influxdata/influxdb
telegraf.go
TOML
func (tc TelegrafConfig) TOML() string { plugins := "" for _, p := range tc.Plugins { plugins += p.Config.TOML() } interval := time.Duration(tc.Agent.Interval * 1000000) return fmt.Sprintf(`# Configuration for telegraf agent [agent] ## Default data collection interval for all inputs interval = "%s" ## Roun...
go
func (tc TelegrafConfig) TOML() string { plugins := "" for _, p := range tc.Plugins { plugins += p.Config.TOML() } interval := time.Duration(tc.Agent.Interval * 1000000) return fmt.Sprintf(`# Configuration for telegraf agent [agent] ## Default data collection interval for all inputs interval = "%s" ## Roun...
[ "func", "(", "tc", "TelegrafConfig", ")", "TOML", "(", ")", "string", "{", "plugins", ":=", "\"", "\"", "\n", "for", "_", ",", "p", ":=", "range", "tc", ".", "Plugins", "{", "plugins", "+=", "p", ".", "Config", ".", "TOML", "(", ")", "\n", "}", ...
// TOML returns the telegraf toml config string.
[ "TOML", "returns", "the", "telegraf", "toml", "config", "string", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/telegraf.go#L73-L134
124,261
influxdata/influxdb
telegraf.go
UnmarshalTOML
func (tc *TelegrafConfig) UnmarshalTOML(data interface{}) error { dataOk, ok := data.(map[string]interface{}) if !ok { return errors.New("blank string") } agent, ok := dataOk["agent"].(map[string]interface{}) if !ok { return errors.New("agent is missing") } intervalStr, ok := agent["interval"].(string) if ...
go
func (tc *TelegrafConfig) UnmarshalTOML(data interface{}) error { dataOk, ok := data.(map[string]interface{}) if !ok { return errors.New("blank string") } agent, ok := dataOk["agent"].(map[string]interface{}) if !ok { return errors.New("agent is missing") } intervalStr, ok := agent["interval"].(string) if ...
[ "func", "(", "tc", "*", "TelegrafConfig", ")", "UnmarshalTOML", "(", "data", "interface", "{", "}", ")", "error", "{", "dataOk", ",", "ok", ":=", "data", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "!", "ok", "{", ...
// UnmarshalTOML implements toml.Unmarshaler interface.
[ "UnmarshalTOML", "implements", "toml", ".", "Unmarshaler", "interface", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/telegraf.go#L221-L270
124,262
influxdata/influxdb
cmd/influxd/main.go
find
func find(args []string) *cobra.Command { cmd, _, err := rootCmd.Find(args) if err == nil && cmd == rootCmd { // Execute the run command if no sub-command is specified return launcher.NewCommand() } return rootCmd }
go
func find(args []string) *cobra.Command { cmd, _, err := rootCmd.Find(args) if err == nil && cmd == rootCmd { // Execute the run command if no sub-command is specified return launcher.NewCommand() } return rootCmd }
[ "func", "find", "(", "args", "[", "]", "string", ")", "*", "cobra", ".", "Command", "{", "cmd", ",", "_", ",", "err", ":=", "rootCmd", ".", "Find", "(", "args", ")", "\n", "if", "err", "==", "nil", "&&", "cmd", "==", "rootCmd", "{", "// Execute t...
// find determines the default behavior when running influxd. // Specifically, find will return the influxd run command if no sub-command // was specified.
[ "find", "determines", "the", "default", "behavior", "when", "running", "influxd", ".", "Specifically", "find", "will", "return", "the", "influxd", "run", "command", "if", "no", "sub", "-", "command", "was", "specified", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influxd/main.go#L45-L53
124,263
influxdata/influxdb
query/influxql/compiler.go
AddCompilerMappings
func AddCompilerMappings(mappings flux.CompilerMappings, dbrpMappingSvc platform.DBRPMappingService) error { return mappings.Add(CompilerType, func() flux.Compiler { return NewCompiler(dbrpMappingSvc) }) }
go
func AddCompilerMappings(mappings flux.CompilerMappings, dbrpMappingSvc platform.DBRPMappingService) error { return mappings.Add(CompilerType, func() flux.Compiler { return NewCompiler(dbrpMappingSvc) }) }
[ "func", "AddCompilerMappings", "(", "mappings", "flux", ".", "CompilerMappings", ",", "dbrpMappingSvc", "platform", ".", "DBRPMappingService", ")", "error", "{", "return", "mappings", ".", "Add", "(", "CompilerType", ",", "func", "(", ")", "flux", ".", "Compiler...
// AddCompilerMappings adds the influxql specific compiler mappings.
[ "AddCompilerMappings", "adds", "the", "influxql", "specific", "compiler", "mappings", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/compiler.go#L16-L20
124,264
influxdata/influxdb
query/influxql/compiler.go
Compile
func (c *Compiler) Compile(ctx context.Context) (flux.Program, error) { var now time.Time if c.Now != nil { now = *c.Now } else { now = time.Now() } transpiler := NewTranspilerWithConfig( c.dbrpMappingSvc, Config{ Cluster: c.Cluster, DefaultDatabase: c.DB, DefaultRetentionPol...
go
func (c *Compiler) Compile(ctx context.Context) (flux.Program, error) { var now time.Time if c.Now != nil { now = *c.Now } else { now = time.Now() } transpiler := NewTranspilerWithConfig( c.dbrpMappingSvc, Config{ Cluster: c.Cluster, DefaultDatabase: c.DB, DefaultRetentionPol...
[ "func", "(", "c", "*", "Compiler", ")", "Compile", "(", "ctx", "context", ".", "Context", ")", "(", "flux", ".", "Program", ",", "error", ")", "{", "var", "now", "time", ".", "Time", "\n", "if", "c", ".", "Now", "!=", "nil", "{", "now", "=", "*...
// Compile transpiles the query into a Program.
[ "Compile", "transpiles", "the", "query", "into", "a", "Program", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/compiler.go#L44-L66
124,265
influxdata/influxdb
chronograf/influx/databases.go
CreateDB
func (c *Client) CreateDB(ctx context.Context, db *chronograf.Database) (*chronograf.Database, error) { span, ctx := tracing.StartSpanFromContext(ctx) defer span.Finish() _, err := c.Query(ctx, chronograf.Query{ Command: fmt.Sprintf(`CREATE DATABASE "%s"`, db.Name), }) if err != nil { return nil, err } res...
go
func (c *Client) CreateDB(ctx context.Context, db *chronograf.Database) (*chronograf.Database, error) { span, ctx := tracing.StartSpanFromContext(ctx) defer span.Finish() _, err := c.Query(ctx, chronograf.Query{ Command: fmt.Sprintf(`CREATE DATABASE "%s"`, db.Name), }) if err != nil { return nil, err } res...
[ "func", "(", "c", "*", "Client", ")", "CreateDB", "(", "ctx", "context", ".", "Context", ",", "db", "*", "chronograf", ".", "Database", ")", "(", "*", "chronograf", ".", "Database", ",", "error", ")", "{", "span", ",", "ctx", ":=", "tracing", ".", ...
// CreateDB creates a database within Influx
[ "CreateDB", "creates", "a", "database", "within", "Influx" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/influx/databases.go#L22-L36
124,266
influxdata/influxdb
chronograf/mocks/sources.go
All
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) { return s.AllF(ctx) }
go
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) { return s.AllF(ctx) }
[ "func", "(", "s", "*", "SourcesStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Source", ",", "error", ")", "{", "return", "s", ".", "AllF", "(", "ctx", ")", "\n", "}" ]
// All returns all sources in the store
[ "All", "returns", "all", "sources", "in", "the", "store" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/sources.go#L21-L23
124,267
influxdata/influxdb
chronograf/mocks/sources.go
Add
func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) { return s.AddF(ctx, src) }
go
func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) { return s.AddF(ctx, src) }
[ "func", "(", "s", "*", "SourcesStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "return", "s", ".", "AddF", "(", "ctx", ",", "src", ")...
// Add creates a new source in the SourcesStore and returns Source with ID
[ "Add", "creates", "a", "new", "source", "in", "the", "SourcesStore", "and", "returns", "Source", "with", "ID" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/sources.go#L26-L28
124,268
influxdata/influxdb
chronograf/mocks/sources.go
Delete
func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error { return s.DeleteF(ctx, src) }
go
func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error { return s.DeleteF(ctx, src) }
[ "func", "(", "s", "*", "SourcesStore", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ")", "error", "{", "return", "s", ".", "DeleteF", "(", "ctx", ",", "src", ")", "\n", "}" ]
// Delete the Source from the store
[ "Delete", "the", "Source", "from", "the", "store" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/sources.go#L31-L33
124,269
influxdata/influxdb
chronograf/mocks/sources.go
Get
func (s *SourcesStore) Get(ctx context.Context, ID int) (chronograf.Source, error) { return s.GetF(ctx, ID) }
go
func (s *SourcesStore) Get(ctx context.Context, ID int) (chronograf.Source, error) { return s.GetF(ctx, ID) }
[ "func", "(", "s", "*", "SourcesStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "ID", "int", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "return", "s", ".", "GetF", "(", "ctx", ",", "ID", ")", "\n", "}" ]
// Get retrieves Source if `ID` exists
[ "Get", "retrieves", "Source", "if", "ID", "exists" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/sources.go#L36-L38
124,270
influxdata/influxdb
chronograf/mocks/sources.go
Update
func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error { return s.UpdateF(ctx, src) }
go
func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error { return s.UpdateF(ctx, src) }
[ "func", "(", "s", "*", "SourcesStore", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ")", "error", "{", "return", "s", ".", "UpdateF", "(", "ctx", ",", "src", ")", "\n", "}" ]
// Update the Source in the store.
[ "Update", "the", "Source", "in", "the", "store", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/sources.go#L41-L43
124,271
influxdata/influxdb
chronograf/server/assets.go
Assets
func Assets(opts AssetsOpts) http.Handler { var assets chronograf.Assets if opts.Develop { assets = &dist.DebugAssets{ Dir: DebugDir, Default: DebugDefault, } } else { assets = &dist.BindataAssets{ Prefix: Dir, Default: Default, DefaultContentType: DefaultContentType, ...
go
func Assets(opts AssetsOpts) http.Handler { var assets chronograf.Assets if opts.Develop { assets = &dist.DebugAssets{ Dir: DebugDir, Default: DebugDefault, } } else { assets = &dist.BindataAssets{ Prefix: Dir, Default: Default, DefaultContentType: DefaultContentType, ...
[ "func", "Assets", "(", "opts", "AssetsOpts", ")", "http", ".", "Handler", "{", "var", "assets", "chronograf", ".", "Assets", "\n", "if", "opts", ".", "Develop", "{", "assets", "=", "&", "dist", ".", "DebugAssets", "{", "Dir", ":", "DebugDir", ",", "Def...
// Assets creates a middleware that will serve a single page app.
[ "Assets", "creates", "a", "middleware", "that", "will", "serve", "a", "single", "page", "app", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/assets.go#L32-L58
124,272
influxdata/influxdb
pkg/escape/bytes.go
Bytes
func Bytes(in []byte) []byte { for b, esc := range Codes { in = bytes.Replace(in, []byte{b}, esc, -1) } return in }
go
func Bytes(in []byte) []byte { for b, esc := range Codes { in = bytes.Replace(in, []byte{b}, esc, -1) } return in }
[ "func", "Bytes", "(", "in", "[", "]", "byte", ")", "[", "]", "byte", "{", "for", "b", ",", "esc", ":=", "range", "Codes", "{", "in", "=", "bytes", ".", "Replace", "(", "in", ",", "[", "]", "byte", "{", "b", "}", ",", "esc", ",", "-", "1", ...
// Bytes escapes characters on the input slice, as defined by Codes.
[ "Bytes", "escapes", "characters", "on", "the", "input", "slice", "as", "defined", "by", "Codes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/escape/bytes.go#L19-L24
124,273
influxdata/influxdb
pkg/escape/bytes.go
IsEscaped
func IsEscaped(b []byte) bool { for len(b) > 0 { i := bytes.IndexByte(b, '\\') if i < 0 { return false } if i+1 < len(b) && strings.IndexByte(escapeChars, b[i+1]) >= 0 { return true } b = b[i+1:] } return false }
go
func IsEscaped(b []byte) bool { for len(b) > 0 { i := bytes.IndexByte(b, '\\') if i < 0 { return false } if i+1 < len(b) && strings.IndexByte(escapeChars, b[i+1]) >= 0 { return true } b = b[i+1:] } return false }
[ "func", "IsEscaped", "(", "b", "[", "]", "byte", ")", "bool", "{", "for", "len", "(", "b", ")", ">", "0", "{", "i", ":=", "bytes", ".", "IndexByte", "(", "b", ",", "'\\\\'", ")", "\n", "if", "i", "<", "0", "{", "return", "false", "\n", "}", ...
// IsEscaped returns whether b has any escaped characters, // i.e. whether b seems to have been processed by Bytes.
[ "IsEscaped", "returns", "whether", "b", "has", "any", "escaped", "characters", "i", ".", "e", ".", "whether", "b", "seems", "to", "have", "been", "processed", "by", "Bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/escape/bytes.go#L30-L43
124,274
influxdata/influxdb
pkg/escape/bytes.go
AppendUnescaped
func AppendUnescaped(dst, src []byte) []byte { var pos int for len(src) > 0 { next := bytes.IndexByte(src[pos:], '\\') if next < 0 || pos+next+1 >= len(src) { return append(dst, src...) } if pos+next+1 < len(src) && strings.IndexByte(escapeChars, src[pos+next+1]) >= 0 { if pos+next > 0 { dst = appe...
go
func AppendUnescaped(dst, src []byte) []byte { var pos int for len(src) > 0 { next := bytes.IndexByte(src[pos:], '\\') if next < 0 || pos+next+1 >= len(src) { return append(dst, src...) } if pos+next+1 < len(src) && strings.IndexByte(escapeChars, src[pos+next+1]) >= 0 { if pos+next > 0 { dst = appe...
[ "func", "AppendUnescaped", "(", "dst", ",", "src", "[", "]", "byte", ")", "[", "]", "byte", "{", "var", "pos", "int", "\n", "for", "len", "(", "src", ")", ">", "0", "{", "next", ":=", "bytes", ".", "IndexByte", "(", "src", "[", "pos", ":", "]",...
// AppendUnescaped appends the unescaped version of src to dst // and returns the resulting slice.
[ "AppendUnescaped", "appends", "the", "unescaped", "version", "of", "src", "to", "dst", "and", "returns", "the", "resulting", "slice", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/escape/bytes.go#L47-L67
124,275
influxdata/influxdb
pkg/escape/bytes.go
Unescape
func Unescape(in []byte) []byte { if len(in) == 0 { return nil } if bytes.IndexByte(in, '\\') == -1 { return in } i := 0 inLen := len(in) // The output size will be no more than inLen. Preallocating the // capacity of the output is faster and uses less memory than // letting append() do its own (over)al...
go
func Unescape(in []byte) []byte { if len(in) == 0 { return nil } if bytes.IndexByte(in, '\\') == -1 { return in } i := 0 inLen := len(in) // The output size will be no more than inLen. Preallocating the // capacity of the output is faster and uses less memory than // letting append() do its own (over)al...
[ "func", "Unescape", "(", "in", "[", "]", "byte", ")", "[", "]", "byte", "{", "if", "len", "(", "in", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "if", "bytes", ".", "IndexByte", "(", "in", ",", "'\\\\'", ")", "==", "-", "1", "{",...
// Unescape returns a new slice containing the unescaped version of in.
[ "Unescape", "returns", "a", "new", "slice", "containing", "the", "unescaped", "version", "of", "in", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/escape/bytes.go#L70-L115
124,276
influxdata/influxdb
pkg/metrics/group_registry.go
mustRegisterCounter
func (g *groupRegistry) mustRegisterCounter(desc *desc) ID { desc.mt = counterMetricType g.mustRegister(desc) desc.id = newID(len(g.group.counters), g.desc.id) g.group.counters = append(g.group.counters, Counter{desc: desc}) return desc.id }
go
func (g *groupRegistry) mustRegisterCounter(desc *desc) ID { desc.mt = counterMetricType g.mustRegister(desc) desc.id = newID(len(g.group.counters), g.desc.id) g.group.counters = append(g.group.counters, Counter{desc: desc}) return desc.id }
[ "func", "(", "g", "*", "groupRegistry", ")", "mustRegisterCounter", "(", "desc", "*", "desc", ")", "ID", "{", "desc", ".", "mt", "=", "counterMetricType", "\n", "g", ".", "mustRegister", "(", "desc", ")", "\n\n", "desc", ".", "id", "=", "newID", "(", ...
// MustRegisterCounter registers a new counter metric using the provided descriptor. // If the metric name is not unique, MustRegisterCounter will panic. // // MustRegisterCounter is not safe to call from multiple goroutines.
[ "MustRegisterCounter", "registers", "a", "new", "counter", "metric", "using", "the", "provided", "descriptor", ".", "If", "the", "metric", "name", "is", "not", "unique", "MustRegisterCounter", "will", "panic", ".", "MustRegisterCounter", "is", "not", "safe", "to",...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/group_registry.go#L42-L50
124,277
influxdata/influxdb
pkg/metrics/group_registry.go
mustRegisterTimer
func (g *groupRegistry) mustRegisterTimer(desc *desc) ID { desc.mt = timerMetricType g.mustRegister(desc) desc.id = newID(len(g.group.timers), g.desc.id) g.group.timers = append(g.group.timers, Timer{desc: desc}) return desc.id }
go
func (g *groupRegistry) mustRegisterTimer(desc *desc) ID { desc.mt = timerMetricType g.mustRegister(desc) desc.id = newID(len(g.group.timers), g.desc.id) g.group.timers = append(g.group.timers, Timer{desc: desc}) return desc.id }
[ "func", "(", "g", "*", "groupRegistry", ")", "mustRegisterTimer", "(", "desc", "*", "desc", ")", "ID", "{", "desc", ".", "mt", "=", "timerMetricType", "\n", "g", ".", "mustRegister", "(", "desc", ")", "\n\n", "desc", ".", "id", "=", "newID", "(", "le...
// MustRegisterTimer registers a new timer metric using the provided descriptor. // If the metric name is not unique, MustRegisterTimer will panic. // // MustRegisterTimer is not safe to call from multiple goroutines.
[ "MustRegisterTimer", "registers", "a", "new", "timer", "metric", "using", "the", "provided", "descriptor", ".", "If", "the", "metric", "name", "is", "not", "unique", "MustRegisterTimer", "will", "panic", ".", "MustRegisterTimer", "is", "not", "safe", "to", "call...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/group_registry.go#L56-L64
124,278
influxdata/influxdb
pkg/metrics/group_registry.go
newGroup
func (g *groupRegistry) newGroup() *Group { c := &Group{ g: g, counters: make([]Counter, len(g.group.counters)), timers: make([]Timer, len(g.group.timers)), } copy(c.counters, g.group.counters) copy(c.timers, g.group.timers) return c }
go
func (g *groupRegistry) newGroup() *Group { c := &Group{ g: g, counters: make([]Counter, len(g.group.counters)), timers: make([]Timer, len(g.group.timers)), } copy(c.counters, g.group.counters) copy(c.timers, g.group.timers) return c }
[ "func", "(", "g", "*", "groupRegistry", ")", "newGroup", "(", ")", "*", "Group", "{", "c", ":=", "&", "Group", "{", "g", ":", "g", ",", "counters", ":", "make", "(", "[", "]", "Counter", ",", "len", "(", "g", ".", "group", ".", "counters", ")",...
// newCollector returns a Collector with a copy of all the registered counters. // // newCollector is safe to call from multiple goroutines.
[ "newCollector", "returns", "a", "Collector", "with", "a", "copy", "of", "all", "the", "registered", "counters", ".", "newCollector", "is", "safe", "to", "call", "from", "multiple", "goroutines", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/group_registry.go#L69-L79
124,279
influxdata/influxdb
http/query.go
WithDefaults
func (r QueryRequest) WithDefaults() QueryRequest { if r.Type == "" { r.Type = "flux" } if r.Dialect.Delimiter == "" { r.Dialect.Delimiter = "," } if r.Dialect.DateTimeFormat == "" { r.Dialect.DateTimeFormat = "RFC3339" } if r.Dialect.Header == nil { header := true r.Dialect.Header = &header } return...
go
func (r QueryRequest) WithDefaults() QueryRequest { if r.Type == "" { r.Type = "flux" } if r.Dialect.Delimiter == "" { r.Dialect.Delimiter = "," } if r.Dialect.DateTimeFormat == "" { r.Dialect.DateTimeFormat = "RFC3339" } if r.Dialect.Header == nil { header := true r.Dialect.Header = &header } return...
[ "func", "(", "r", "QueryRequest", ")", "WithDefaults", "(", ")", "QueryRequest", "{", "if", "r", ".", "Type", "==", "\"", "\"", "{", "r", ".", "Type", "=", "\"", "\"", "\n", "}", "\n", "if", "r", ".", "Dialect", ".", "Delimiter", "==", "\"", "\""...
// WithDefaults adds default values to the request.
[ "WithDefaults", "adds", "default", "values", "to", "the", "request", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/query.go#L50-L65
124,280
influxdata/influxdb
http/query.go
Analyze
func (r QueryRequest) Analyze() (*QueryAnalysis, error) { switch r.Type { case "flux": return r.analyzeFluxQuery() case "influxql": return r.analyzeInfluxQLQuery() } return nil, fmt.Errorf("unknown query request type %s", r.Type) }
go
func (r QueryRequest) Analyze() (*QueryAnalysis, error) { switch r.Type { case "flux": return r.analyzeFluxQuery() case "influxql": return r.analyzeInfluxQLQuery() } return nil, fmt.Errorf("unknown query request type %s", r.Type) }
[ "func", "(", "r", "QueryRequest", ")", "Analyze", "(", ")", "(", "*", "QueryAnalysis", ",", "error", ")", "{", "switch", "r", ".", "Type", "{", "case", "\"", "\"", ":", "return", "r", ".", "analyzeFluxQuery", "(", ")", "\n", "case", "\"", "\"", ":"...
// Analyze attempts to parse the query request and returns any errors // encountered in a structured way.
[ "Analyze", "attempts", "to", "parse", "the", "query", "request", "and", "returns", "any", "errors", "encountered", "in", "a", "structured", "way", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/query.go#L130-L139
124,281
influxdata/influxdb
http/query.go
ProxyRequest
func (r QueryRequest) ProxyRequest() (*query.ProxyRequest, error) { return r.proxyRequest(time.Now) }
go
func (r QueryRequest) ProxyRequest() (*query.ProxyRequest, error) { return r.proxyRequest(time.Now) }
[ "func", "(", "r", "QueryRequest", ")", "ProxyRequest", "(", ")", "(", "*", "query", ".", "ProxyRequest", ",", "error", ")", "{", "return", "r", ".", "proxyRequest", "(", "time", ".", "Now", ")", "\n", "}" ]
// ProxyRequest returns a request to proxy from the flux.
[ "ProxyRequest", "returns", "a", "request", "to", "proxy", "from", "the", "flux", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/query.go#L219-L221
124,282
influxdata/influxdb
chronograf/mocks/response.go
NewResponse
func NewResponse(res string, err error) *Response { return &Response{ res: res, err: err, } }
go
func NewResponse(res string, err error) *Response { return &Response{ res: res, err: err, } }
[ "func", "NewResponse", "(", "res", "string", ",", "err", "error", ")", "*", "Response", "{", "return", "&", "Response", "{", "res", ":", "res", ",", "err", ":", "err", ",", "}", "\n", "}" ]
// NewResponse returns a mocked chronograf.Response
[ "NewResponse", "returns", "a", "mocked", "chronograf", ".", "Response" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/response.go#L4-L9
124,283
influxdata/influxdb
chronograf/mocks/response.go
MarshalJSON
func (r *Response) MarshalJSON() ([]byte, error) { return []byte(r.res), r.err }
go
func (r *Response) MarshalJSON() ([]byte, error) { return []byte(r.res), r.err }
[ "func", "(", "r", "*", "Response", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "[", "]", "byte", "(", "r", ".", "res", ")", ",", "r", ".", "err", "\n", "}" ]
// MarshalJSON returns the res and err as the fake response.
[ "MarshalJSON", "returns", "the", "res", "and", "err", "as", "the", "fake", "response", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/response.go#L18-L20
124,284
influxdata/influxdb
chronograf/id/time.go
Generate
func (i *tm) Generate() (string, error) { return strconv.Itoa(int(i.Now().Unix())), nil }
go
func (i *tm) Generate() (string, error) { return strconv.Itoa(int(i.Now().Unix())), nil }
[ "func", "(", "i", "*", "tm", ")", "Generate", "(", ")", "(", "string", ",", "error", ")", "{", "return", "strconv", ".", "Itoa", "(", "int", "(", "i", ".", "Now", "(", ")", ".", "Unix", "(", ")", ")", ")", ",", "nil", "\n", "}" ]
// Generate creates a string based on the current time as an integer
[ "Generate", "creates", "a", "string", "based", "on", "the", "current", "time", "as", "an", "integer" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/id/time.go#L23-L25
124,285
influxdata/influxdb
tsdb/value/value.go
NewValue
func NewValue(t int64, value interface{}) Value { switch v := value.(type) { case int64: return IntegerValue{unixnano: t, value: v} case uint64: return UnsignedValue{unixnano: t, value: v} case float64: return FloatValue{unixnano: t, value: v} case bool: return BooleanValue{unixnano: t, value: v} case str...
go
func NewValue(t int64, value interface{}) Value { switch v := value.(type) { case int64: return IntegerValue{unixnano: t, value: v} case uint64: return UnsignedValue{unixnano: t, value: v} case float64: return FloatValue{unixnano: t, value: v} case bool: return BooleanValue{unixnano: t, value: v} case str...
[ "func", "NewValue", "(", "t", "int64", ",", "value", "interface", "{", "}", ")", "Value", "{", "switch", "v", ":=", "value", ".", "(", "type", ")", "{", "case", "int64", ":", "return", "IntegerValue", "{", "unixnano", ":", "t", ",", "value", ":", "...
// NewValue returns a new Value with the underlying type dependent on value.
[ "NewValue", "returns", "a", "new", "Value", "with", "the", "underlying", "type", "dependent", "on", "value", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/value/value.go#L30-L44
124,286
influxdata/influxdb
chronograf/filestore/sources.go
NewSources
func NewSources(dir string, ids chronograf.ID, logger chronograf.Logger) chronograf.SourcesStore { return &Sources{ Dir: dir, Load: load, Create: create, ReadDir: ioutil.ReadDir, Remove: os.Remove, IDs: ids, Logger: logger, } }
go
func NewSources(dir string, ids chronograf.ID, logger chronograf.Logger) chronograf.SourcesStore { return &Sources{ Dir: dir, Load: load, Create: create, ReadDir: ioutil.ReadDir, Remove: os.Remove, IDs: ids, Logger: logger, } }
[ "func", "NewSources", "(", "dir", "string", ",", "ids", "chronograf", ".", "ID", ",", "logger", "chronograf", ".", "Logger", ")", "chronograf", ".", "SourcesStore", "{", "return", "&", "Sources", "{", "Dir", ":", "dir", ",", "Load", ":", "load", ",", "...
// NewSources constructs a source store wrapping a file system directory
[ "NewSources", "constructs", "a", "source", "store", "wrapping", "a", "file", "system", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/sources.go#L31-L41
124,287
influxdata/influxdb
chronograf/filestore/sources.go
All
func (d *Sources) All(ctx context.Context) ([]chronograf.Source, error) { files, err := d.ReadDir(d.Dir) if err != nil { return nil, err } sources := []chronograf.Source{} for _, file := range files { if path.Ext(file.Name()) != SrcExt { continue } var source chronograf.Source if err := d.Load(path.J...
go
func (d *Sources) All(ctx context.Context) ([]chronograf.Source, error) { files, err := d.ReadDir(d.Dir) if err != nil { return nil, err } sources := []chronograf.Source{} for _, file := range files { if path.Ext(file.Name()) != SrcExt { continue } var source chronograf.Source if err := d.Load(path.J...
[ "func", "(", "d", "*", "Sources", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Source", ",", "error", ")", "{", "files", ",", "err", ":=", "d", ".", "ReadDir", "(", "d", ".", "Dir", ")", "\n", "if",...
// All returns all sources from the directory
[ "All", "returns", "all", "sources", "from", "the", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/sources.go#L49-L70
124,288
influxdata/influxdb
chronograf/filestore/sources.go
Add
func (d *Sources) Add(ctx context.Context, source chronograf.Source) (chronograf.Source, error) { genID, err := d.IDs.Generate() if err != nil { d.Logger. WithField("component", "source"). Error("Unable to generate ID") return chronograf.Source{}, err } id, err := strconv.Atoi(genID) if err != nil { d...
go
func (d *Sources) Add(ctx context.Context, source chronograf.Source) (chronograf.Source, error) { genID, err := d.IDs.Generate() if err != nil { d.Logger. WithField("component", "source"). Error("Unable to generate ID") return chronograf.Source{}, err } id, err := strconv.Atoi(genID) if err != nil { d...
[ "func", "(", "d", "*", "Sources", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "source", "chronograf", ".", "Source", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "genID", ",", "err", ":=", "d", ".", "IDs", ".", "Genera...
// Add creates a new source within the directory
[ "Add", "creates", "a", "new", "source", "within", "the", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/sources.go#L73-L108
124,289
influxdata/influxdb
chronograf/filestore/sources.go
Delete
func (d *Sources) Delete(ctx context.Context, source chronograf.Source) error { _, file, err := d.idToFile(source.ID) if err != nil { return err } if err := d.Remove(file); err != nil { d.Logger. WithField("component", "source"). WithField("name", file). Error("Unable to remove source:", err) return...
go
func (d *Sources) Delete(ctx context.Context, source chronograf.Source) error { _, file, err := d.idToFile(source.ID) if err != nil { return err } if err := d.Remove(file); err != nil { d.Logger. WithField("component", "source"). WithField("name", file). Error("Unable to remove source:", err) return...
[ "func", "(", "d", "*", "Sources", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "source", "chronograf", ".", "Source", ")", "error", "{", "_", ",", "file", ",", "err", ":=", "d", ".", "idToFile", "(", "source", ".", "ID", ")", "\n", ...
// Delete removes a source file from the directory
[ "Delete", "removes", "a", "source", "file", "from", "the", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/sources.go#L111-L125
124,290
influxdata/influxdb
chronograf/filestore/sources.go
Get
func (d *Sources) Get(ctx context.Context, id int) (chronograf.Source, error) { board, file, err := d.idToFile(id) if err != nil { if err == chronograf.ErrSourceNotFound { d.Logger. WithField("component", "source"). WithField("name", file). Error("Unable to read file") } else if err == chronograf.E...
go
func (d *Sources) Get(ctx context.Context, id int) (chronograf.Source, error) { board, file, err := d.idToFile(id) if err != nil { if err == chronograf.ErrSourceNotFound { d.Logger. WithField("component", "source"). WithField("name", file). Error("Unable to read file") } else if err == chronograf.E...
[ "func", "(", "d", "*", "Sources", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "int", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "board", ",", "file", ",", "err", ":=", "d", ".", "idToFile", "(", "id", ")", ...
// Get returns a source file from the source directory
[ "Get", "returns", "a", "source", "file", "from", "the", "source", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/sources.go#L128-L145
124,291
influxdata/influxdb
chronograf/filestore/sources.go
Update
func (d *Sources) Update(ctx context.Context, source chronograf.Source) error { board, _, err := d.idToFile(source.ID) if err != nil { return err } if err := d.Delete(ctx, board); err != nil { return err } file := sourceFile(d.Dir, source) return d.Create(file, source) }
go
func (d *Sources) Update(ctx context.Context, source chronograf.Source) error { board, _, err := d.idToFile(source.ID) if err != nil { return err } if err := d.Delete(ctx, board); err != nil { return err } file := sourceFile(d.Dir, source) return d.Create(file, source) }
[ "func", "(", "d", "*", "Sources", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "source", "chronograf", ".", "Source", ")", "error", "{", "board", ",", "_", ",", "err", ":=", "d", ".", "idToFile", "(", "source", ".", "ID", ")", "\n", ...
// Update replaces a source from the file system directory
[ "Update", "replaces", "a", "source", "from", "the", "file", "system", "directory" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/sources.go#L148-L159
124,292
influxdata/influxdb
tsdb/tsm1/metrics.go
newBlockMetrics
func newBlockMetrics(labels prometheus.Labels) *blockMetrics { return &blockMetrics{ labels: labels, compactionMetrics: newCompactionMetrics(labels), fileMetrics: newFileMetrics(labels), cacheMetrics: newCacheMetrics(labels), } }
go
func newBlockMetrics(labels prometheus.Labels) *blockMetrics { return &blockMetrics{ labels: labels, compactionMetrics: newCompactionMetrics(labels), fileMetrics: newFileMetrics(labels), cacheMetrics: newCacheMetrics(labels), } }
[ "func", "newBlockMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "blockMetrics", "{", "return", "&", "blockMetrics", "{", "labels", ":", "labels", ",", "compactionMetrics", ":", "newCompactionMetrics", "(", "labels", ")", ",", "fileMetrics", ":",...
// newBlockMetrics initialises the prometheus metrics for the block subsystem.
[ "newBlockMetrics", "initialises", "the", "prometheus", "metrics", "for", "the", "block", "subsystem", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/metrics.go#L48-L55
124,293
influxdata/influxdb
tsdb/tsm1/metrics.go
newCompactionMetrics
func newCompactionMetrics(labels prometheus.Labels) *compactionMetrics { names := []string{"level"} // All compaction metrics have a `level` label. for k := range labels { names = append(names, k) } sort.Strings(names) totalCompactionsNames := append(append([]string(nil), names...), []string{"reason", "status"}...
go
func newCompactionMetrics(labels prometheus.Labels) *compactionMetrics { names := []string{"level"} // All compaction metrics have a `level` label. for k := range labels { names = append(names, k) } sort.Strings(names) totalCompactionsNames := append(append([]string(nil), names...), []string{"reason", "status"}...
[ "func", "newCompactionMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "compactionMetrics", "{", "names", ":=", "[", "]", "string", "{", "\"", "\"", "}", "// All compaction metrics have a `level` label.", "\n", "for", "k", ":=", "range", "labels", ...
// newCompactionMetrics initialises the prometheus metrics for compactions.
[ "newCompactionMetrics", "initialises", "the", "prometheus", "metrics", "for", "compactions", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/metrics.go#L77-L115
124,294
influxdata/influxdb
tsdb/tsm1/metrics.go
newFileMetrics
func newFileMetrics(labels prometheus.Labels) *fileMetrics { var names []string for k := range labels { names = append(names, k) } names = append(names, "level") sort.Strings(names) return &fileMetrics{ DiskSize: prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: fileStoreSub...
go
func newFileMetrics(labels prometheus.Labels) *fileMetrics { var names []string for k := range labels { names = append(names, k) } names = append(names, "level") sort.Strings(names) return &fileMetrics{ DiskSize: prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: fileStoreSub...
[ "func", "newFileMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "fileMetrics", "{", "var", "names", "[", "]", "string", "\n", "for", "k", ":=", "range", "labels", "{", "names", "=", "append", "(", "names", ",", "k", ")", "\n", "}", "\...
// newFileMetrics initialises the prometheus metrics for tracking files on disk.
[ "newFileMetrics", "initialises", "the", "prometheus", "metrics", "for", "tracking", "files", "on", "disk", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/metrics.go#L134-L156
124,295
influxdata/influxdb
tsdb/tsm1/metrics.go
newCacheMetrics
func newCacheMetrics(labels prometheus.Labels) *cacheMetrics { var names []string for k := range labels { names = append(names, k) } sort.Strings(names) writeNames := append(append([]string(nil), names...), "status") sort.Strings(writeNames) return &cacheMetrics{ MemSize: prometheus.NewGaugeVec(prometheus....
go
func newCacheMetrics(labels prometheus.Labels) *cacheMetrics { var names []string for k := range labels { names = append(names, k) } sort.Strings(names) writeNames := append(append([]string(nil), names...), "status") sort.Strings(writeNames) return &cacheMetrics{ MemSize: prometheus.NewGaugeVec(prometheus....
[ "func", "newCacheMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "cacheMetrics", "{", "var", "names", "[", "]", "string", "\n", "for", "k", ":=", "range", "labels", "{", "names", "=", "append", "(", "names", ",", "k", ")", "\n", "}", ...
// newCacheMetrics initialises the prometheus metrics for compactions.
[ "newCacheMetrics", "initialises", "the", "prometheus", "metrics", "for", "compactions", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/metrics.go#L180-L234
124,296
influxdata/influxdb
cmd/influx/internal/errorfmt.go
ErrorFmt
func ErrorFmt(err error) error { if err == nil { return nil } s := err.Error() s = strings.Trim(s, "\n .!?") count := 0 s = strings.Map( func(r rune) rune { defer func() { count++ }() if count == 0 { return unicode.ToUpper(r) } return r }, s, ) s = s + "." return errors.New(s) }
go
func ErrorFmt(err error) error { if err == nil { return nil } s := err.Error() s = strings.Trim(s, "\n .!?") count := 0 s = strings.Map( func(r rune) rune { defer func() { count++ }() if count == 0 { return unicode.ToUpper(r) } return r }, s, ) s = s + "." return errors.New(s) }
[ "func", "ErrorFmt", "(", "err", "error", ")", "error", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "s", ":=", "err", ".", "Error", "(", ")", "\n\n", "s", "=", "strings", ".", "Trim", "(", "s", ",", "\"", "\\n", "\"",...
// ErrorFmt formats errors presented to the user such that the first letter in the error // is capitalized and ends with an appropriate punctuation.
[ "ErrorFmt", "formats", "errors", "presented", "to", "the", "user", "such", "that", "the", "first", "letter", "in", "the", "error", "is", "capitalized", "and", "ends", "with", "an", "appropriate", "punctuation", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influx/internal/errorfmt.go#L11-L35
124,297
influxdata/influxdb
chronograf/server/stores.go
hasOrganizationContext
func hasOrganizationContext(ctx context.Context) (string, bool) { // prevents panic in case of nil context if ctx == nil { return "", false } orgID, ok := ctx.Value(organizations.ContextKey).(string) // should never happen if !ok { return "", false } if orgID == "" { return "", false } return orgID, tru...
go
func hasOrganizationContext(ctx context.Context) (string, bool) { // prevents panic in case of nil context if ctx == nil { return "", false } orgID, ok := ctx.Value(organizations.ContextKey).(string) // should never happen if !ok { return "", false } if orgID == "" { return "", false } return orgID, tru...
[ "func", "hasOrganizationContext", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "bool", ")", "{", "// prevents panic in case of nil context", "if", "ctx", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "orgID", ",", ...
// hasOrganizationContext retrieves organization specified on context // under the organizations.ContextKey
[ "hasOrganizationContext", "retrieves", "organization", "specified", "on", "context", "under", "the", "organizations", ".", "ContextKey" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/stores.go#L14-L28
124,298
influxdata/influxdb
chronograf/server/stores.go
hasRoleContext
func hasRoleContext(ctx context.Context) (string, bool) { // prevents panic in case of nil context if ctx == nil { return "", false } role, ok := ctx.Value(roles.ContextKey).(string) // should never happen if !ok { return "", false } switch role { case roles.MemberRoleName, roles.ViewerRoleName, roles.Edit...
go
func hasRoleContext(ctx context.Context) (string, bool) { // prevents panic in case of nil context if ctx == nil { return "", false } role, ok := ctx.Value(roles.ContextKey).(string) // should never happen if !ok { return "", false } switch role { case roles.MemberRoleName, roles.ViewerRoleName, roles.Edit...
[ "func", "hasRoleContext", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "bool", ")", "{", "// prevents panic in case of nil context", "if", "ctx", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "role", ",", "ok", ...
// hasRoleContext retrieves organization specified on context // under the organizations.ContextKey
[ "hasRoleContext", "retrieves", "organization", "specified", "on", "context", "under", "the", "organizations", ".", "ContextKey" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/stores.go#L32-L48
124,299
influxdata/influxdb
chronograf/server/stores.go
hasUserContext
func hasUserContext(ctx context.Context) (*chronograf.User, bool) { // prevents panic in case of nil context if ctx == nil { return nil, false } u, ok := ctx.Value(UserContextKey).(*chronograf.User) // should never happen if !ok { return nil, false } if u == nil { return nil, false } return u, true }
go
func hasUserContext(ctx context.Context) (*chronograf.User, bool) { // prevents panic in case of nil context if ctx == nil { return nil, false } u, ok := ctx.Value(UserContextKey).(*chronograf.User) // should never happen if !ok { return nil, false } if u == nil { return nil, false } return u, true }
[ "func", "hasUserContext", "(", "ctx", "context", ".", "Context", ")", "(", "*", "chronograf", ".", "User", ",", "bool", ")", "{", "// prevents panic in case of nil context", "if", "ctx", "==", "nil", "{", "return", "nil", ",", "false", "\n", "}", "\n", "u"...
// hasUserContext speficies if the context contains // the UserContextKey and that the value stored there is chronograf.User
[ "hasUserContext", "speficies", "if", "the", "context", "contains", "the", "UserContextKey", "and", "that", "the", "value", "stored", "there", "is", "chronograf", ".", "User" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/stores.go#L57-L71