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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
134,800
influxdata/platform
http/label_service.go
FindLabels
func (s *LabelService) FindLabels(ctx context.Context, filter plat.LabelFilter, opt ...plat.FindOptions) ([]*plat.Label, error) { url, err := newURL(s.Addr, resourceIDPath(s.BasePath, filter.ResourceID)) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { re...
go
func (s *LabelService) FindLabels(ctx context.Context, filter plat.LabelFilter, opt ...plat.FindOptions) ([]*plat.Label, error) { url, err := newURL(s.Addr, resourceIDPath(s.BasePath, filter.ResourceID)) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { re...
[ "func", "(", "s", "*", "LabelService", ")", "FindLabels", "(", "ctx", "context", ".", "Context", ",", "filter", "plat", ".", "LabelFilter", ",", "opt", "...", "plat", ".", "FindOptions", ")", "(", "[", "]", "*", "plat", ".", "Label", ",", "error", ")...
// FindLabels returns a slice of labels
[ "FindLabels", "returns", "a", "slice", "of", "labels" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/label_service.go#L299-L329
134,801
influxdata/platform
http/query.go
Validate
func (r QueryRequest) Validate() error { if r.Query == "" && r.Spec == nil && r.AST == nil { return errors.New(`request body requires either query, spec, or AST`) } if r.Type != "flux" { return fmt.Errorf(`unknown query type: %s`, r.Type) } if len(r.Dialect.CommentPrefix) > 1 { return fmt.Errorf("invalid d...
go
func (r QueryRequest) Validate() error { if r.Query == "" && r.Spec == nil && r.AST == nil { return errors.New(`request body requires either query, spec, or AST`) } if r.Type != "flux" { return fmt.Errorf(`unknown query type: %s`, r.Type) } if len(r.Dialect.CommentPrefix) > 1 { return fmt.Errorf("invalid d...
[ "func", "(", "r", "QueryRequest", ")", "Validate", "(", ")", "error", "{", "if", "r", ".", "Query", "==", "\"", "\"", "&&", "r", ".", "Spec", "==", "nil", "&&", "r", ".", "AST", "==", "nil", "{", "return", "errors", ".", "New", "(", "`request bod...
// Validate checks the query request and returns an error if the request is invalid.
[ "Validate", "checks", "the", "query", "request", "and", "returns", "an", "error", "if", "the", "request", "is", "invalid", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query.go#L65-L102
134,802
influxdata/platform
http/query.go
QueryRequestFromProxyRequest
func QueryRequestFromProxyRequest(req *query.ProxyRequest) (*QueryRequest, error) { qr := new(QueryRequest) switch c := req.Request.Compiler.(type) { case lang.FluxCompiler: qr.Type = "flux" qr.Query = c.Query case lang.SpecCompiler: qr.Type = "flux" qr.Spec = c.Spec default: return nil, fmt.Errorf("unsu...
go
func QueryRequestFromProxyRequest(req *query.ProxyRequest) (*QueryRequest, error) { qr := new(QueryRequest) switch c := req.Request.Compiler.(type) { case lang.FluxCompiler: qr.Type = "flux" qr.Query = c.Query case lang.SpecCompiler: qr.Type = "flux" qr.Spec = c.Spec default: return nil, fmt.Errorf("unsu...
[ "func", "QueryRequestFromProxyRequest", "(", "req", "*", "query", ".", "ProxyRequest", ")", "(", "*", "QueryRequest", ",", "error", ")", "{", "qr", ":=", "new", "(", "QueryRequest", ")", "\n", "switch", "c", ":=", "req", ".", "Request", ".", "Compiler", ...
// QueryRequestFromProxyRequest converts a query.ProxyRequest into a QueryRequest. // The ProxyRequest must contain supported compilers and dialects otherwise an error occurs.
[ "QueryRequestFromProxyRequest", "converts", "a", "query", ".", "ProxyRequest", "into", "a", "QueryRequest", ".", "The", "ProxyRequest", "must", "contain", "supported", "compilers", "and", "dialects", "otherwise", "an", "error", "occurs", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query.go#L288-L313
134,803
influxdata/platform
tsdb/tsi1/file_set.go
Close
func (fs FileSet) Close() error { var err error for _, f := range fs.files { if e := f.Close(); e != nil && err == nil { err = e } } return err }
go
func (fs FileSet) Close() error { var err error for _, f := range fs.files { if e := f.Close(); e != nil && err == nil { err = e } } return err }
[ "func", "(", "fs", "FileSet", ")", "Close", "(", ")", "error", "{", "var", "err", "error", "\n", "for", "_", ",", "f", ":=", "range", "fs", ".", "files", "{", "if", "e", ":=", "f", ".", "Close", "(", ")", ";", "e", "!=", "nil", "&&", "err", ...
// Close closes all the files in the file set.
[ "Close", "closes", "all", "the", "files", "in", "the", "file", "set", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/file_set.go#L46-L54
134,804
influxdata/platform
http/scraper_service.go
GetTargetByID
func (s *ScraperService) GetTargetByID(ctx context.Context, id platform.ID) (*platform.ScraperTarget, error) { url, err := newURL(s.Addr, targetIDPath(id)) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, err } SetToken(s.Token, req) hc :=...
go
func (s *ScraperService) GetTargetByID(ctx context.Context, id platform.ID) (*platform.ScraperTarget, error) { url, err := newURL(s.Addr, targetIDPath(id)) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, err } SetToken(s.Token, req) hc :=...
[ "func", "(", "s", "*", "ScraperService", ")", "GetTargetByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "ScraperTarget", ",", "error", ")", "{", "url", ",", "err", ":=", "newURL", "(", "...
// GetTargetByID returns a single target by ID.
[ "GetTargetByID", "returns", "a", "single", "target", "by", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/scraper_service.go#L329-L358
134,805
influxdata/platform
task/mock/scheduler.go
SetTaskMeta
func (d *DesiredState) SetTaskMeta(taskID platform.ID, meta backend.StoreTaskMeta) { d.mu.Lock() defer d.mu.Unlock() d.meta[taskID.String()] = meta }
go
func (d *DesiredState) SetTaskMeta(taskID platform.ID, meta backend.StoreTaskMeta) { d.mu.Lock() defer d.mu.Unlock() d.meta[taskID.String()] = meta }
[ "func", "(", "d", "*", "DesiredState", ")", "SetTaskMeta", "(", "taskID", "platform", ".", "ID", ",", "meta", "backend", ".", "StoreTaskMeta", ")", "{", "d", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "mu", ".", "Unlock", "(", ")", ...
// SetTaskMeta sets the task meta for the given task ID. // SetTaskMeta must be called before CreateNextRun, for a given task ID.
[ "SetTaskMeta", "sets", "the", "task", "meta", "for", "the", "given", "task", "ID", ".", "SetTaskMeta", "must", "be", "called", "before", "CreateNextRun", "for", "a", "given", "task", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/mock/scheduler.go#L189-L194
134,806
influxdata/platform
task/mock/scheduler.go
PollForNumberCreated
func (d *DesiredState) PollForNumberCreated(taskID platform.ID, count int) ([]scheduler.QueuedRun, error) { const numAttempts = 50 actualCount := 0 var created []scheduler.QueuedRun for i := 0; i < numAttempts; i++ { time.Sleep(2 * time.Millisecond) // we sleep even on first so it becomes more likely that we catc...
go
func (d *DesiredState) PollForNumberCreated(taskID platform.ID, count int) ([]scheduler.QueuedRun, error) { const numAttempts = 50 actualCount := 0 var created []scheduler.QueuedRun for i := 0; i < numAttempts; i++ { time.Sleep(2 * time.Millisecond) // we sleep even on first so it becomes more likely that we catc...
[ "func", "(", "d", "*", "DesiredState", ")", "PollForNumberCreated", "(", "taskID", "platform", ".", "ID", ",", "count", "int", ")", "(", "[", "]", "scheduler", ".", "QueuedRun", ",", "error", ")", "{", "const", "numAttempts", "=", "50", "\n", "actualCoun...
// PollForNumberCreated blocks for a small amount of time waiting for exactly the given count of created runs for the given task ID. // If the expected number isn't found in time, it returns an error. // // Because the scheduler and executor do a lot of state changes asynchronously, this is useful in test.
[ "PollForNumberCreated", "blocks", "for", "a", "small", "amount", "of", "time", "waiting", "for", "exactly", "the", "given", "count", "of", "created", "runs", "for", "the", "given", "task", "ID", ".", "If", "the", "expected", "number", "isn", "t", "found", ...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/mock/scheduler.go#L264-L277
134,807
influxdata/platform
task/mock/scheduler.go
PollForNumberRunning
func (e *Executor) PollForNumberRunning(taskID platform.ID, count int) ([]*RunPromise, error) { const numAttempts = 20 var running []*RunPromise for i := 0; i < numAttempts; i++ { if i > 0 { time.Sleep(10 * time.Millisecond) } running = e.RunningFor(taskID) if len(running) == count { return running, ni...
go
func (e *Executor) PollForNumberRunning(taskID platform.ID, count int) ([]*RunPromise, error) { const numAttempts = 20 var running []*RunPromise for i := 0; i < numAttempts; i++ { if i > 0 { time.Sleep(10 * time.Millisecond) } running = e.RunningFor(taskID) if len(running) == count { return running, ni...
[ "func", "(", "e", "*", "Executor", ")", "PollForNumberRunning", "(", "taskID", "platform", ".", "ID", ",", "count", "int", ")", "(", "[", "]", "*", "RunPromise", ",", "error", ")", "{", "const", "numAttempts", "=", "20", "\n", "var", "running", "[", ...
// PollForNumberRunning blocks for a small amount of time waiting for exactly the given count of active runs for the given task ID. // If the expected number isn't found in time, it returns an error. // // Because the scheduler and executor do a lot of state changes asynchronously, this is useful in test.
[ "PollForNumberRunning", "blocks", "for", "a", "small", "amount", "of", "time", "waiting", "for", "exactly", "the", "given", "count", "of", "active", "runs", "for", "the", "given", "task", "ID", ".", "If", "the", "expected", "number", "isn", "t", "found", "...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/mock/scheduler.go#L347-L360
134,808
influxdata/platform
http/errors.go
CheckError
func CheckError(resp *http.Response, isPlatformError ...bool) (err error) { switch resp.StatusCode / 100 { case 4, 5: // We will attempt to parse this error outside of this block. case 2: return nil default: // TODO(jsternberg): Figure out what to do here? return kerrors.InternalErrorf("unexpected status co...
go
func CheckError(resp *http.Response, isPlatformError ...bool) (err error) { switch resp.StatusCode / 100 { case 4, 5: // We will attempt to parse this error outside of this block. case 2: return nil default: // TODO(jsternberg): Figure out what to do here? return kerrors.InternalErrorf("unexpected status co...
[ "func", "CheckError", "(", "resp", "*", "http", ".", "Response", ",", "isPlatformError", "...", "bool", ")", "(", "err", "error", ")", "{", "switch", "resp", ".", "StatusCode", "/", "100", "{", "case", "4", ",", "5", ":", "// We will attempt to parse this ...
// CheckError reads the http.Response and returns an error if one exists. // It will automatically recognize the errors returned by Influx services // and decode the error into an internal error type. If the error cannot // be determined in that way, it will create a generic error message. // // If there is no error, t...
[ "CheckError", "reads", "the", "http", ".", "Response", "and", "returns", "an", "error", "if", "one", "exists", ".", "It", "will", "automatically", "recognize", "the", "errors", "returned", "by", "Influx", "services", "and", "decode", "the", "error", "into", ...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/errors.go#L62-L107
134,809
influxdata/platform
http/errors.go
EncodeError
func EncodeError(ctx context.Context, err error, w http.ResponseWriter) { if err == nil { return } if pe, ok := err.(*platform.Error); ok { code := platform.ErrorCode(pe) httpCode, ok := statusCodePlatformError[code] if !ok { httpCode = http.StatusBadRequest } w.Header().Set(PlatformErrorCodeHeader, ...
go
func EncodeError(ctx context.Context, err error, w http.ResponseWriter) { if err == nil { return } if pe, ok := err.(*platform.Error); ok { code := platform.ErrorCode(pe) httpCode, ok := statusCodePlatformError[code] if !ok { httpCode = http.StatusBadRequest } w.Header().Set(PlatformErrorCodeHeader, ...
[ "func", "EncodeError", "(", "ctx", "context", ".", "Context", ",", "err", "error", ",", "w", "http", ".", "ResponseWriter", ")", "{", "if", "err", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "pe", ",", "ok", ":=", "err", ".", "(", "*", "...
// EncodeError encodes err with the appropriate status code and format, // sets the X-Influx-Error and X-Influx-Reference headers on the response, // and sets the response status to the corresponding status code.
[ "EncodeError", "encodes", "err", "with", "the", "appropriate", "status", "code", "and", "format", "sets", "the", "X", "-", "Influx", "-", "Error", "and", "X", "-", "Influx", "-", "Reference", "headers", "on", "the", "response", "and", "sets", "the", "respo...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/errors.go#L112-L143
134,810
influxdata/platform
http/errors.go
ForbiddenError
func ForbiddenError(ctx context.Context, err error, w http.ResponseWriter) { EncodeError(ctx, &platform.Error{ Code: platform.EForbidden, Err: err, }, w) }
go
func ForbiddenError(ctx context.Context, err error, w http.ResponseWriter) { EncodeError(ctx, &platform.Error{ Code: platform.EForbidden, Err: err, }, w) }
[ "func", "ForbiddenError", "(", "ctx", "context", ".", "Context", ",", "err", "error", ",", "w", "http", ".", "ResponseWriter", ")", "{", "EncodeError", "(", "ctx", ",", "&", "platform", ".", "Error", "{", "Code", ":", "platform", ".", "EForbidden", ",", ...
// ForbiddenError encodes error with a forbidden status code.
[ "ForbiddenError", "encodes", "error", "with", "a", "forbidden", "status", "code", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/errors.go#L160-L165
134,811
influxdata/platform
http/errors.go
statusCode
func statusCode(e kerrors.Error) int { if e.Code > 0 { return e.Code } switch e.Reference { case kerrors.InternalError: return http.StatusInternalServerError case kerrors.InvalidData: return http.StatusUnprocessableEntity case kerrors.MalformedData: return http.StatusBadRequest case kerrors.Forbidden: ...
go
func statusCode(e kerrors.Error) int { if e.Code > 0 { return e.Code } switch e.Reference { case kerrors.InternalError: return http.StatusInternalServerError case kerrors.InvalidData: return http.StatusUnprocessableEntity case kerrors.MalformedData: return http.StatusBadRequest case kerrors.Forbidden: ...
[ "func", "statusCode", "(", "e", "kerrors", ".", "Error", ")", "int", "{", "if", "e", ".", "Code", ">", "0", "{", "return", "e", ".", "Code", "\n", "}", "\n", "switch", "e", ".", "Reference", "{", "case", "kerrors", ".", "InternalError", ":", "retur...
// statusCode returns the http status code for an error.
[ "statusCode", "returns", "the", "http", "status", "code", "for", "an", "error", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/errors.go#L168-L186
134,812
influxdata/platform
task/backend/bolt/bolt.go
DeleteTask
func (s *Store) DeleteTask(ctx context.Context, id platform.ID) (deleted bool, err error) { encodedID, err := id.Encode() if err != nil { return false, err } err = s.db.Batch(func(tx *bolt.Tx) error { b := tx.Bucket(s.bucket) if check := b.Bucket(tasksPath).Get(encodedID); check == nil { return backend.Err...
go
func (s *Store) DeleteTask(ctx context.Context, id platform.ID) (deleted bool, err error) { encodedID, err := id.Encode() if err != nil { return false, err } err = s.db.Batch(func(tx *bolt.Tx) error { b := tx.Bucket(s.bucket) if check := b.Bucket(tasksPath).Get(encodedID); check == nil { return backend.Err...
[ "func", "(", "s", "*", "Store", ")", "DeleteTask", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "deleted", "bool", ",", "err", "error", ")", "{", "encodedID", ",", "err", ":=", "id", ".", "Encode", "(", ")", ...
// DeleteTask deletes the task.
[ "DeleteTask", "deletes", "the", "task", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/backend/bolt/bolt.go#L556-L600
134,813
influxdata/platform
task/backend/bolt/bolt.go
DeleteUser
func (s *Store) DeleteUser(ctx context.Context, id platform.ID) error { userID, err := id.Encode() if err != nil { return err } err = s.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(s.bucket) ub := b.Bucket(usersPath).Bucket(userID) if ub == nil { return backend.ErrUserNotFound } c := ub.Cursor...
go
func (s *Store) DeleteUser(ctx context.Context, id platform.ID) error { userID, err := id.Encode() if err != nil { return err } err = s.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(s.bucket) ub := b.Bucket(usersPath).Bucket(userID) if ub == nil { return backend.ErrUserNotFound } c := ub.Cursor...
[ "func", "(", "s", "*", "Store", ")", "DeleteUser", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "error", "{", "userID", ",", "err", ":=", "id", ".", "Encode", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return...
// DeleteUser syncronously deletes a user and all their tasks from a bolt store.
[ "DeleteUser", "syncronously", "deletes", "a", "user", "and", "all", "their", "tasks", "from", "a", "bolt", "store", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/backend/bolt/bolt.go#L708-L769
134,814
influxdata/platform
macro.go
Valid
func (m *Macro) Valid() error { if m.Name == "" { return fmt.Errorf("name empty") } validTypes := map[string]bool{ "constant": true, "map": true, "query": true, } if _, prs := validTypes[m.Arguments.Type]; !prs { return fmt.Errorf("invalid arguments type") } if len(m.Selected) == 0 { retur...
go
func (m *Macro) Valid() error { if m.Name == "" { return fmt.Errorf("name empty") } validTypes := map[string]bool{ "constant": true, "map": true, "query": true, } if _, prs := validTypes[m.Arguments.Type]; !prs { return fmt.Errorf("invalid arguments type") } if len(m.Selected) == 0 { retur...
[ "func", "(", "m", "*", "Macro", ")", "Valid", "(", ")", "error", "{", "if", "m", ".", "Name", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "validTypes", ":=", "map", "[", "string", "]", "bool",...
// Valid returns an error if a Macro contains invalid data
[ "Valid", "returns", "an", "error", "if", "a", "Macro", "contains", "invalid", "data" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/macro.go#L75-L95
134,815
influxdata/platform
macro.go
Valid
func (u *MacroUpdate) Valid() error { if u.Name == "" && u.Selected == nil && u.Arguments == nil { return fmt.Errorf("no fields supplied in update") } return nil }
go
func (u *MacroUpdate) Valid() error { if u.Name == "" && u.Selected == nil && u.Arguments == nil { return fmt.Errorf("no fields supplied in update") } return nil }
[ "func", "(", "u", "*", "MacroUpdate", ")", "Valid", "(", ")", "error", "{", "if", "u", ".", "Name", "==", "\"", "\"", "&&", "u", ".", "Selected", "==", "nil", "&&", "u", ".", "Arguments", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "...
// Valid returns an error if a Macro changeset is not valid
[ "Valid", "returns", "an", "error", "if", "a", "Macro", "changeset", "is", "not", "valid" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/macro.go#L98-L104
134,816
influxdata/platform
macro.go
Apply
func (u *MacroUpdate) Apply(m *Macro) error { if u.Name != "" { m.Name = u.Name } if u.Selected != nil { m.Selected = u.Selected } if u.Arguments != nil { m.Arguments = u.Arguments } return nil }
go
func (u *MacroUpdate) Apply(m *Macro) error { if u.Name != "" { m.Name = u.Name } if u.Selected != nil { m.Selected = u.Selected } if u.Arguments != nil { m.Arguments = u.Arguments } return nil }
[ "func", "(", "u", "*", "MacroUpdate", ")", "Apply", "(", "m", "*", "Macro", ")", "error", "{", "if", "u", ".", "Name", "!=", "\"", "\"", "{", "m", ".", "Name", "=", "u", ".", "Name", "\n", "}", "\n\n", "if", "u", ".", "Selected", "!=", "nil",...
// Apply applies non-zero fields from a MacroUpdate to a Macro
[ "Apply", "applies", "non", "-", "zero", "fields", "from", "a", "MacroUpdate", "to", "a", "Macro" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/macro.go#L107-L121
134,817
influxdata/platform
macro.go
UnmarshalJSON
func (a *MacroArguments) UnmarshalJSON(data []byte) error { type Alias MacroArguments aux := struct{ *Alias }{Alias: (*Alias)(a)} err := json.Unmarshal(data, &aux) if err != nil { return err } // Decode the polymorphic MacroArguments.Values field into the approriate struct switch aux.Type { case "constant":...
go
func (a *MacroArguments) UnmarshalJSON(data []byte) error { type Alias MacroArguments aux := struct{ *Alias }{Alias: (*Alias)(a)} err := json.Unmarshal(data, &aux) if err != nil { return err } // Decode the polymorphic MacroArguments.Values field into the approriate struct switch aux.Type { case "constant":...
[ "func", "(", "a", "*", "MacroArguments", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "type", "Alias", "MacroArguments", "\n", "aux", ":=", "struct", "{", "*", "Alias", "}", "{", "Alias", ":", "(", "*", "Alias", ")", "(", ...
// UnmarshalJSON unmarshals json into a MacroArguments struct, using the `Type` // field to assign the approriate struct to the `Values` field
[ "UnmarshalJSON", "unmarshals", "json", "into", "a", "MacroArguments", "struct", "using", "the", "Type", "field", "to", "assign", "the", "approriate", "struct", "to", "the", "Values", "field" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/macro.go#L125-L198
134,818
influxdata/platform
bolt/view.go
FindViewByID
func (c *Client) FindViewByID(ctx context.Context, id platform.ID) (*platform.View, error) { var d *platform.View err := c.db.View(func(tx *bolt.Tx) error { dash, err := c.findViewByID(ctx, tx, id) if err != nil { return &platform.Error{ Err: err, Op: getOp(platform.OpFindViewByID), } } d = da...
go
func (c *Client) FindViewByID(ctx context.Context, id platform.ID) (*platform.View, error) { var d *platform.View err := c.db.View(func(tx *bolt.Tx) error { dash, err := c.findViewByID(ctx, tx, id) if err != nil { return &platform.Error{ Err: err, Op: getOp(platform.OpFindViewByID), } } d = da...
[ "func", "(", "c", "*", "Client", ")", "FindViewByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "View", ",", "error", ")", "{", "var", "d", "*", "platform", ".", "View", "\n\n", "err", ...
// FindViewByID retrieves a view by id.
[ "FindViewByID", "retrieves", "a", "view", "by", "id", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L24-L40
134,819
influxdata/platform
bolt/view.go
FindView
func (c *Client) FindView(ctx context.Context, filter platform.ViewFilter) (*platform.View, error) { if filter.ID != nil { return c.FindViewByID(ctx, *filter.ID) } var d *platform.View err := c.db.View(func(tx *bolt.Tx) error { filterFn := filterViewsFn(filter) return c.forEachView(ctx, tx, func(dash *platfo...
go
func (c *Client) FindView(ctx context.Context, filter platform.ViewFilter) (*platform.View, error) { if filter.ID != nil { return c.FindViewByID(ctx, *filter.ID) } var d *platform.View err := c.db.View(func(tx *bolt.Tx) error { filterFn := filterViewsFn(filter) return c.forEachView(ctx, tx, func(dash *platfo...
[ "func", "(", "c", "*", "Client", ")", "FindView", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "ViewFilter", ")", "(", "*", "platform", ".", "View", ",", "error", ")", "{", "if", "filter", ".", "ID", "!=", "nil", "{", "ret...
// FindView retrieves a view using an arbitrary view filter.
[ "FindView", "retrieves", "a", "view", "using", "an", "arbitrary", "view", "filter", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L70-L101
134,820
influxdata/platform
bolt/view.go
FindViews
func (c *Client) FindViews(ctx context.Context, filter platform.ViewFilter) ([]*platform.View, int, error) { ds := []*platform.View{} op := getOp(platform.OpFindViews) if filter.ID != nil { d, err := c.FindViewByID(ctx, *filter.ID) if err != nil && platform.ErrorCode(err) != platform.ENotFound { return nil, 0...
go
func (c *Client) FindViews(ctx context.Context, filter platform.ViewFilter) ([]*platform.View, int, error) { ds := []*platform.View{} op := getOp(platform.OpFindViews) if filter.ID != nil { d, err := c.FindViewByID(ctx, *filter.ID) if err != nil && platform.ErrorCode(err) != platform.ENotFound { return nil, 0...
[ "func", "(", "c", "*", "Client", ")", "FindViews", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "ViewFilter", ")", "(", "[", "]", "*", "platform", ".", "View", ",", "int", ",", "error", ")", "{", "ds", ":=", "[", "]", "*...
// FindViews retrives all views that match an arbitrary view filter.
[ "FindViews", "retrives", "all", "views", "that", "match", "an", "arbitrary", "view", "filter", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L125-L156
134,821
influxdata/platform
bolt/view.go
CreateView
func (c *Client) CreateView(ctx context.Context, d *platform.View) error { return c.db.Update(func(tx *bolt.Tx) error { if pe := c.createView(ctx, tx, d); pe != nil { return &platform.Error{ Op: getOp(platform.OpCreateView), Err: pe, } } return nil }) }
go
func (c *Client) CreateView(ctx context.Context, d *platform.View) error { return c.db.Update(func(tx *bolt.Tx) error { if pe := c.createView(ctx, tx, d); pe != nil { return &platform.Error{ Op: getOp(platform.OpCreateView), Err: pe, } } return nil }) }
[ "func", "(", "c", "*", "Client", ")", "CreateView", "(", "ctx", "context", ".", "Context", ",", "d", "*", "platform", ".", "View", ")", "error", "{", "return", "c", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", ...
// CreateView creates a platform view and sets d.ID.
[ "CreateView", "creates", "a", "platform", "view", "and", "sets", "d", ".", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L177-L187
134,822
influxdata/platform
bolt/view.go
PutView
func (c *Client) PutView(ctx context.Context, d *platform.View) error { return c.db.Update(func(tx *bolt.Tx) error { if pe := c.putView(ctx, tx, d); pe != nil { return pe } return nil }) }
go
func (c *Client) PutView(ctx context.Context, d *platform.View) error { return c.db.Update(func(tx *bolt.Tx) error { if pe := c.putView(ctx, tx, d); pe != nil { return pe } return nil }) }
[ "func", "(", "c", "*", "Client", ")", "PutView", "(", "ctx", "context", ".", "Context", ",", "d", "*", "platform", ".", "View", ")", "error", "{", "return", "c", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "er...
// PutView will put a view without setting an ID.
[ "PutView", "will", "put", "a", "view", "without", "setting", "an", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L195-L202
134,823
influxdata/platform
bolt/view.go
UpdateView
func (c *Client) UpdateView(ctx context.Context, id platform.ID, upd platform.ViewUpdate) (*platform.View, error) { var d *platform.View err := c.db.Update(func(tx *bolt.Tx) error { dash, pe := c.updateView(ctx, tx, id, upd) if pe != nil { return &platform.Error{ Err: pe, Op: getOp(platform.OpUpdateVi...
go
func (c *Client) UpdateView(ctx context.Context, id platform.ID, upd platform.ViewUpdate) (*platform.View, error) { var d *platform.View err := c.db.Update(func(tx *bolt.Tx) error { dash, pe := c.updateView(ctx, tx, id, upd) if pe != nil { return &platform.Error{ Err: pe, Op: getOp(platform.OpUpdateVi...
[ "func", "(", "c", "*", "Client", ")", "UpdateView", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "upd", "platform", ".", "ViewUpdate", ")", "(", "*", "platform", ".", "View", ",", "error", ")", "{", "var", "d", "*",...
// UpdateView updates a view according the parameters set on upd.
[ "UpdateView", "updates", "a", "view", "according", "the", "parameters", "set", "on", "upd", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L242-L257
134,824
influxdata/platform
bolt/view.go
DeleteView
func (c *Client) DeleteView(ctx context.Context, id platform.ID) error { return c.db.Update(func(tx *bolt.Tx) error { if pe := c.deleteView(ctx, tx, id); pe != nil { return &platform.Error{ Err: pe, Op: getOp(platform.OpDeleteView), } } return nil }) }
go
func (c *Client) DeleteView(ctx context.Context, id platform.ID) error { return c.db.Update(func(tx *bolt.Tx) error { if pe := c.deleteView(ctx, tx, id); pe != nil { return &platform.Error{ Err: pe, Op: getOp(platform.OpDeleteView), } } return nil }) }
[ "func", "(", "c", "*", "Client", ")", "DeleteView", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "error", "{", "return", "c", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error",...
// DeleteView deletes a view and prunes it from the index.
[ "DeleteView", "deletes", "a", "view", "and", "prunes", "it", "from", "the", "index", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/view.go#L281-L291
134,825
influxdata/platform
http/client.go
NewService
func NewService(addr, token string) *Service { return &Service{ Addr: addr, Token: token, AuthorizationService: &AuthorizationService{ Addr: addr, Token: token, }, OrganizationService: &OrganizationService{ Addr: addr, Token: token, }, UserService: &UserService{ Addr: addr, Token: t...
go
func NewService(addr, token string) *Service { return &Service{ Addr: addr, Token: token, AuthorizationService: &AuthorizationService{ Addr: addr, Token: token, }, OrganizationService: &OrganizationService{ Addr: addr, Token: token, }, UserService: &UserService{ Addr: addr, Token: t...
[ "func", "NewService", "(", "addr", ",", "token", "string", ")", "*", "Service", "{", "return", "&", "Service", "{", "Addr", ":", "addr", ",", "Token", ":", "token", ",", "AuthorizationService", ":", "&", "AuthorizationService", "{", "Addr", ":", "addr", ...
// NewService returns a service that is an HTTP // client to a remote
[ "NewService", "returns", "a", "service", "that", "is", "an", "HTTP", "client", "to", "a", "remote" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/client.go#L26-L59
134,826
influxdata/platform
http/query_handler.go
postFluxSpec
func (h *FluxHandler) postFluxSpec(w http.ResponseWriter, r *http.Request) { var req langRequest ctx := r.Context() err := json.NewDecoder(r.Body).Decode(&req) if err != nil { EncodeError(ctx, errors.MalformedDataf("invalid json: %v", err), w) return } spec, err := flux.Compile(ctx, req.Query, h.Now()) if ...
go
func (h *FluxHandler) postFluxSpec(w http.ResponseWriter, r *http.Request) { var req langRequest ctx := r.Context() err := json.NewDecoder(r.Body).Decode(&req) if err != nil { EncodeError(ctx, errors.MalformedDataf("invalid json: %v", err), w) return } spec, err := flux.Compile(ctx, req.Query, h.Now()) if ...
[ "func", "(", "h", "*", "FluxHandler", ")", "postFluxSpec", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "req", "langRequest", "\n", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "err", ":=", ...
// postFluxSpec returns a flux Spec for provided flux string
[ "postFluxSpec", "returns", "a", "flux", "Spec", "for", "provided", "flux", "string" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_handler.go#L158-L182
134,827
influxdata/platform
http/query_handler.go
getFluxSuggestion
func (h *FluxHandler) getFluxSuggestion(w http.ResponseWriter, r *http.Request) { ctx := r.Context() name := httprouter.ParamsFromContext(ctx).ByName("name") completer := complete.DefaultCompleter() suggestion, err := completer.FunctionSuggestion(name) if err != nil { EncodeError(ctx, err, w) return } res ...
go
func (h *FluxHandler) getFluxSuggestion(w http.ResponseWriter, r *http.Request) { ctx := r.Context() name := httprouter.ParamsFromContext(ctx).ByName("name") completer := complete.DefaultCompleter() suggestion, err := completer.FunctionSuggestion(name) if err != nil { EncodeError(ctx, err, w) return } res ...
[ "func", "(", "h", "*", "FluxHandler", ")", "getFluxSuggestion", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "name", ":=", "httprouter", ".", "ParamsFromCont...
// getFluxSuggestion returns the function parameters for the requested function
[ "getFluxSuggestion", "returns", "the", "function", "parameters", "for", "the", "requested", "function" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_handler.go#L234-L250
134,828
influxdata/platform
http/query_handler.go
Query
func (s *FluxService) Query(ctx context.Context, w io.Writer, r *query.ProxyRequest) (int64, error) { u, err := newURL(s.Addr, fluxPath) if err != nil { return 0, err } qreq, err := QueryRequestFromProxyRequest(r) if err != nil { return 0, err } var body bytes.Buffer if err := json.NewEncoder(&body).Encode...
go
func (s *FluxService) Query(ctx context.Context, w io.Writer, r *query.ProxyRequest) (int64, error) { u, err := newURL(s.Addr, fluxPath) if err != nil { return 0, err } qreq, err := QueryRequestFromProxyRequest(r) if err != nil { return 0, err } var body bytes.Buffer if err := json.NewEncoder(&body).Encode...
[ "func", "(", "s", "*", "FluxService", ")", "Query", "(", "ctx", "context", ".", "Context", ",", "w", "io", ".", "Writer", ",", "r", "*", "query", ".", "ProxyRequest", ")", "(", "int64", ",", "error", ")", "{", "u", ",", "err", ":=", "newURL", "("...
// Query runs a flux query against a influx server and sends the results to the io.Writer. // Will use the token from the context over the token within the service struct.
[ "Query", "runs", "a", "flux", "query", "against", "a", "influx", "server", "and", "sends", "the", "results", "to", "the", "io", ".", "Writer", ".", "Will", "use", "the", "token", "from", "the", "context", "over", "the", "token", "within", "the", "service...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_handler.go#L269-L309
134,829
influxdata/platform
http/query_handler.go
Query
func (s *FluxQueryService) Query(ctx context.Context, r *query.Request) (flux.ResultIterator, error) { u, err := newURL(s.Addr, fluxPath) if err != nil { return nil, err } params := url.Values{} params.Set(OrgID, r.OrganizationID.String()) u.RawQuery = params.Encode() preq := &query.ProxyRequest{ Request: *...
go
func (s *FluxQueryService) Query(ctx context.Context, r *query.Request) (flux.ResultIterator, error) { u, err := newURL(s.Addr, fluxPath) if err != nil { return nil, err } params := url.Values{} params.Set(OrgID, r.OrganizationID.String()) u.RawQuery = params.Encode() preq := &query.ProxyRequest{ Request: *...
[ "func", "(", "s", "*", "FluxQueryService", ")", "Query", "(", "ctx", "context", ".", "Context", ",", "r", "*", "query", ".", "Request", ")", "(", "flux", ".", "ResultIterator", ",", "error", ")", "{", "u", ",", "err", ":=", "newURL", "(", "s", ".",...
// Query runs a flux query against a influx server and decodes the result
[ "Query", "runs", "a", "flux", "query", "against", "a", "influx", "server", "and", "decodes", "the", "result" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_handler.go#L321-L366
134,830
influxdata/platform
mock/proto.go
FindProtos
func (s *ProtoService) FindProtos(ctx context.Context) ([]*platform.Proto, error) { if s.FindProtosFn == nil { return nil, errors.New("not implemented") } return s.FindProtosFn(ctx) }
go
func (s *ProtoService) FindProtos(ctx context.Context) ([]*platform.Proto, error) { if s.FindProtosFn == nil { return nil, errors.New("not implemented") } return s.FindProtosFn(ctx) }
[ "func", "(", "s", "*", "ProtoService", ")", "FindProtos", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "platform", ".", "Proto", ",", "error", ")", "{", "if", "s", ".", "FindProtosFn", "==", "nil", "{", "return", "nil", ",", "err...
// FindProtos returns a list of protos.
[ "FindProtos", "returns", "a", "list", "of", "protos", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/mock/proto.go#L18-L23
134,831
influxdata/platform
mock/proto.go
CreateDashboardsFromProto
func (s *ProtoService) CreateDashboardsFromProto(ctx context.Context, protoID, orgID platform.ID) ([]*platform.Dashboard, error) { if s.CreateDashboardsFromProtoFn == nil { return nil, errors.New("not implemented") } return s.CreateDashboardsFromProtoFn(ctx, protoID, orgID) }
go
func (s *ProtoService) CreateDashboardsFromProto(ctx context.Context, protoID, orgID platform.ID) ([]*platform.Dashboard, error) { if s.CreateDashboardsFromProtoFn == nil { return nil, errors.New("not implemented") } return s.CreateDashboardsFromProtoFn(ctx, protoID, orgID) }
[ "func", "(", "s", "*", "ProtoService", ")", "CreateDashboardsFromProto", "(", "ctx", "context", ".", "Context", ",", "protoID", ",", "orgID", "platform", ".", "ID", ")", "(", "[", "]", "*", "platform", ".", "Dashboard", ",", "error", ")", "{", "if", "s...
// CreateDashboardsFromProto creates a new set of dashboards for a proto
[ "CreateDashboardsFromProto", "creates", "a", "new", "set", "of", "dashboards", "for", "a", "proto" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/mock/proto.go#L26-L31
134,832
influxdata/platform
task/backend/scheduler.go
Work
func (ts *taskScheduler) Work() { for _, r := range ts.runners { r.Start() if r.IsIdle() { // Ran out of jobs to start. break } } }
go
func (ts *taskScheduler) Work() { for _, r := range ts.runners { r.Start() if r.IsIdle() { // Ran out of jobs to start. break } } }
[ "func", "(", "ts", "*", "taskScheduler", ")", "Work", "(", ")", "{", "for", "_", ",", "r", ":=", "range", "ts", ".", "runners", "{", "r", ".", "Start", "(", ")", "\n", "if", "r", ".", "IsIdle", "(", ")", "{", "// Ran out of jobs to start.", "break"...
// Work begins a work cycle on the taskScheduler. // As many runners are started as possible.
[ "Work", "begins", "a", "work", "cycle", "on", "the", "taskScheduler", ".", "As", "many", "runners", "are", "started", "as", "possible", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/backend/scheduler.go#L442-L450
134,833
influxdata/platform
task/backend/scheduler.go
RestartRun
func (r *runner) RestartRun(qr QueuedRun) bool { if !atomic.CompareAndSwapUint32(r.state, runnerIdle, runnerWorking) { // already working return false } // create a QueuedRun because we cant stm.CreateNextRun runLogger := r.logger.With(zap.String("run_id", qr.RunID.String()), zap.Int64("now", qr.Now)) r.wg.Add...
go
func (r *runner) RestartRun(qr QueuedRun) bool { if !atomic.CompareAndSwapUint32(r.state, runnerIdle, runnerWorking) { // already working return false } // create a QueuedRun because we cant stm.CreateNextRun runLogger := r.logger.With(zap.String("run_id", qr.RunID.String()), zap.Int64("now", qr.Now)) r.wg.Add...
[ "func", "(", "r", "*", "runner", ")", "RestartRun", "(", "qr", "QueuedRun", ")", "bool", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "r", ".", "state", ",", "runnerIdle", ",", "runnerWorking", ")", "{", "// already working", "return", "fals...
// RestartRun attempts to restart a queued run if the runner is available to do the work. // If the runner was already busy we return false.
[ "RestartRun", "attempts", "to", "restart", "a", "queued", "run", "if", "the", "runner", "is", "available", "to", "do", "the", "work", ".", "If", "the", "runner", "was", "already", "busy", "we", "return", "false", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/backend/scheduler.go#L567-L587
134,834
influxdata/platform
task/backend/scheduler.go
startFromWorking
func (r *runner) startFromWorking(now int64) { if nextDue, hasQueue := r.ts.NextDue(); now < nextDue && !hasQueue { // Not ready for a new run. Go idle again. atomic.StoreUint32(r.state, runnerIdle) return } ctx, cancel := context.WithCancel(r.ctx) rc, err := r.desiredState.CreateNextRun(ctx, r.task.ID, now) ...
go
func (r *runner) startFromWorking(now int64) { if nextDue, hasQueue := r.ts.NextDue(); now < nextDue && !hasQueue { // Not ready for a new run. Go idle again. atomic.StoreUint32(r.state, runnerIdle) return } ctx, cancel := context.WithCancel(r.ctx) rc, err := r.desiredState.CreateNextRun(ctx, r.task.ID, now) ...
[ "func", "(", "r", "*", "runner", ")", "startFromWorking", "(", "now", "int64", ")", "{", "if", "nextDue", ",", "hasQueue", ":=", "r", ".", "ts", ".", "NextDue", "(", ")", ";", "now", "<", "nextDue", "&&", "!", "hasQueue", "{", "// Not ready for a new r...
// startFromWorking attempts to create a run if one is due, and then begins execution on a separate goroutine. // r.state must be runnerWorking when this is called.
[ "startFromWorking", "attempts", "to", "create", "a", "run", "if", "one", "is", "due", "and", "then", "begins", "execution", "on", "a", "separate", "goroutine", ".", "r", ".", "state", "must", "be", "runnerWorking", "when", "this", "is", "called", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/backend/scheduler.go#L591-L621
134,835
influxdata/platform
mock/basic_auth.go
NewBasicAuthService
func NewBasicAuthService(user, password string) *BasicAuthService { return &BasicAuthService{ SetPasswordFn: func(context.Context, string, string) error { return fmt.Errorf("mock error") }, ComparePasswordFn: func(context.Context, string, string) error { return fmt.Errorf("mock error") }, Compare...
go
func NewBasicAuthService(user, password string) *BasicAuthService { return &BasicAuthService{ SetPasswordFn: func(context.Context, string, string) error { return fmt.Errorf("mock error") }, ComparePasswordFn: func(context.Context, string, string) error { return fmt.Errorf("mock error") }, Compare...
[ "func", "NewBasicAuthService", "(", "user", ",", "password", "string", ")", "*", "BasicAuthService", "{", "return", "&", "BasicAuthService", "{", "SetPasswordFn", ":", "func", "(", "context", ".", "Context", ",", "string", ",", "string", ")", "error", "{", "...
// NewBasicAuthService returns a mock BasicAuthService where its methods will return // zero values.
[ "NewBasicAuthService", "returns", "a", "mock", "BasicAuthService", "where", "its", "methods", "will", "return", "zero", "values", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/mock/basic_auth.go#L18-L24
134,836
influxdata/platform
mock/basic_auth.go
CompareAndSetPassword
func (s *BasicAuthService) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error { return s.CompareAndSetPasswordFn(ctx, name, old, new) }
go
func (s *BasicAuthService) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error { return s.CompareAndSetPasswordFn(ctx, name, old, new) }
[ "func", "(", "s", "*", "BasicAuthService", ")", "CompareAndSetPassword", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "old", "string", ",", "new", "string", ")", "error", "{", "return", "s", ".", "CompareAndSetPasswordFn", "(", "ctx", ...
// CompareAndSetPassword compares the provided password and sets it to the new password.
[ "CompareAndSetPassword", "compares", "the", "provided", "password", "and", "sets", "it", "to", "the", "new", "password", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/mock/basic_auth.go#L37-L39
134,837
influxdata/platform
fs/proto.go
NewProtoService
func NewProtoService(dir string, logger *zap.Logger, s platform.DashboardService) *ProtoService { return &ProtoService{ Dir: dir, Logger: logger.With(zap.String("service", "proto")), DashboardService: s, } }
go
func NewProtoService(dir string, logger *zap.Logger, s platform.DashboardService) *ProtoService { return &ProtoService{ Dir: dir, Logger: logger.With(zap.String("service", "proto")), DashboardService: s, } }
[ "func", "NewProtoService", "(", "dir", "string", ",", "logger", "*", "zap", ".", "Logger", ",", "s", "platform", ".", "DashboardService", ")", "*", "ProtoService", "{", "return", "&", "ProtoService", "{", "Dir", ":", "dir", ",", "Logger", ":", "logger", ...
// NewProtoService creates an instance of a ProtoService.
[ "NewProtoService", "creates", "an", "instance", "of", "a", "ProtoService", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/fs/proto.go#L28-L34
134,838
influxdata/platform
fs/proto.go
Open
func (s *ProtoService) Open(ctx context.Context) error { if _, err := os.Stat(s.Dir); os.IsNotExist(err) { if err := os.Mkdir(s.Dir, 0600); err != nil { return err } } files, err := ioutil.ReadDir(s.Dir) if err != nil { return err } protos := []*platform.Proto{} for _, file := range files { filename...
go
func (s *ProtoService) Open(ctx context.Context) error { if _, err := os.Stat(s.Dir); os.IsNotExist(err) { if err := os.Mkdir(s.Dir, 0600); err != nil { return err } } files, err := ioutil.ReadDir(s.Dir) if err != nil { return err } protos := []*platform.Proto{} for _, file := range files { filename...
[ "func", "(", "s", "*", "ProtoService", ")", "Open", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "s", ".", "Dir", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", ...
// Open loads the protos from the file system and sets them on the service.
[ "Open", "loads", "the", "protos", "from", "the", "file", "system", "and", "sets", "them", "on", "the", "service", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/fs/proto.go#L42-L82
134,839
influxdata/platform
fs/proto.go
FindProtos
func (s *ProtoService) FindProtos(ctx context.Context) ([]*platform.Proto, error) { protos := []*platform.Proto{} for _, proto := range s.protos { // easy way to make a deep copy octets, err := json.Marshal(proto) if err != nil { return nil, err } p := &platform.Proto{} if err := json.Unmarshal(octets...
go
func (s *ProtoService) FindProtos(ctx context.Context) ([]*platform.Proto, error) { protos := []*platform.Proto{} for _, proto := range s.protos { // easy way to make a deep copy octets, err := json.Marshal(proto) if err != nil { return nil, err } p := &platform.Proto{} if err := json.Unmarshal(octets...
[ "func", "(", "s", "*", "ProtoService", ")", "FindProtos", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "platform", ".", "Proto", ",", "error", ")", "{", "protos", ":=", "[", "]", "*", "platform", ".", "Proto", "{", "}", "\n", "...
// FindProtos returns a list of protos from the file system.
[ "FindProtos", "returns", "a", "list", "of", "protos", "from", "the", "file", "system", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/fs/proto.go#L85-L103
134,840
influxdata/platform
fs/proto.go
CreateDashboardsFromProto
func (s *ProtoService) CreateDashboardsFromProto(ctx context.Context, protoID platform.ID, orgID platform.ID) ([]*platform.Dashboard, error) { // TODO(desa): this should be done transactionally. proto, err := s.findProto(ctx, protoID) if err != nil { return nil, err } dashes := []*platform.Dashboard{} for _, ...
go
func (s *ProtoService) CreateDashboardsFromProto(ctx context.Context, protoID platform.ID, orgID platform.ID) ([]*platform.Dashboard, error) { // TODO(desa): this should be done transactionally. proto, err := s.findProto(ctx, protoID) if err != nil { return nil, err } dashes := []*platform.Dashboard{} for _, ...
[ "func", "(", "s", "*", "ProtoService", ")", "CreateDashboardsFromProto", "(", "ctx", "context", ".", "Context", ",", "protoID", "platform", ".", "ID", ",", "orgID", "platform", ".", "ID", ")", "(", "[", "]", "*", "platform", ".", "Dashboard", ",", "error...
// CreateDashboardsFromProtos creates instances of each dashboard in a proto.
[ "CreateDashboardsFromProtos", "creates", "instances", "of", "each", "dashboard", "in", "a", "proto", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/fs/proto.go#L116-L161
134,841
influxdata/platform
gather/scheduler.go
NewScheduler
func NewScheduler( numScrapers int, l *zap.Logger, targets platform.ScraperTargetStoreService, p nats.Publisher, s nats.Subscriber, interval time.Duration, timeout time.Duration, ) (*Scheduler, error) { if interval == 0 { interval = 60 * time.Second } if timeout == 0 { timeout = 30 * time.Second } sched...
go
func NewScheduler( numScrapers int, l *zap.Logger, targets platform.ScraperTargetStoreService, p nats.Publisher, s nats.Subscriber, interval time.Duration, timeout time.Duration, ) (*Scheduler, error) { if interval == 0 { interval = 60 * time.Second } if timeout == 0 { timeout = 30 * time.Second } sched...
[ "func", "NewScheduler", "(", "numScrapers", "int", ",", "l", "*", "zap", ".", "Logger", ",", "targets", "platform", ".", "ScraperTargetStoreService", ",", "p", "nats", ".", "Publisher", ",", "s", "nats", ".", "Subscriber", ",", "interval", "time", ".", "Du...
// NewScheduler creates a new Scheduler and subscriptions for scraper jobs.
[ "NewScheduler", "creates", "a", "new", "Scheduler", "and", "subscriptions", "for", "scraper", "jobs", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/gather/scheduler.go#L38-L74
134,842
influxdata/platform
http/view_service.go
NewViewHandler
func NewViewHandler(mappingService platform.UserResourceMappingService, labelService platform.LabelService, userService platform.UserService) *ViewHandler { h := &ViewHandler{ Router: NewRouter(), Logger: zap.NewNop(), UserResourceMappingService: mappingService, LabelSer...
go
func NewViewHandler(mappingService platform.UserResourceMappingService, labelService platform.LabelService, userService platform.UserService) *ViewHandler { h := &ViewHandler{ Router: NewRouter(), Logger: zap.NewNop(), UserResourceMappingService: mappingService, LabelSer...
[ "func", "NewViewHandler", "(", "mappingService", "platform", ".", "UserResourceMappingService", ",", "labelService", "platform", ".", "LabelService", ",", "userService", "platform", ".", "UserService", ")", "*", "ViewHandler", "{", "h", ":=", "&", "ViewHandler", "{"...
// NewViewHandler returns a new instance of ViewHandler.
[ "NewViewHandler", "returns", "a", "new", "instance", "of", "ViewHandler", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L41-L71
134,843
influxdata/platform
http/view_service.go
handleGetViews
func (h *ViewHandler) handleGetViews(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req := decodeGetViewsRequest(ctx, r) views, _, err := h.ViewService.FindViews(ctx, req.filter) if err != nil { EncodeError(ctx, err, w) return } if err := encodeResponse(ctx, w, http.StatusOK, newGetViewsRespo...
go
func (h *ViewHandler) handleGetViews(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req := decodeGetViewsRequest(ctx, r) views, _, err := h.ViewService.FindViews(ctx, req.filter) if err != nil { EncodeError(ctx, err, w) return } if err := encodeResponse(ctx, w, http.StatusOK, newGetViewsRespo...
[ "func", "(", "h", "*", "ViewHandler", ")", "handleGetViews", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "req", ":=", "decodeGetViewsRequest", "(", "ctx",...
// handleGetViews returns all views within the store.
[ "handleGetViews", "returns", "all", "views", "within", "the", "store", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L109-L124
134,844
influxdata/platform
http/view_service.go
handlePostViews
func (h *ViewHandler) handlePostViews(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodePostViewRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } if err := h.ViewService.CreateView(ctx, req.View); err != nil { EncodeError(ctx, err, w) return } if err := enco...
go
func (h *ViewHandler) handlePostViews(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodePostViewRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } if err := h.ViewService.CreateView(ctx, req.View); err != nil { EncodeError(ctx, err, w) return } if err := enco...
[ "func", "(", "h", "*", "ViewHandler", ")", "handlePostViews", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "req", ",", "err", ":=", "decodePostViewRequest"...
// handlePostViews creates a new view.
[ "handlePostViews", "creates", "a", "new", "view", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L165-L182
134,845
influxdata/platform
http/view_service.go
handleGetView
func (h *ViewHandler) handleGetView(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodeGetViewRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } view, err := h.ViewService.FindViewByID(ctx, req.ViewID) if err != nil { EncodeError(ctx, err, w) return } if err...
go
func (h *ViewHandler) handleGetView(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodeGetViewRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } view, err := h.ViewService.FindViewByID(ctx, req.ViewID) if err != nil { EncodeError(ctx, err, w) return } if err...
[ "func", "(", "h", "*", "ViewHandler", ")", "handleGetView", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "req", ",", "err", ":=", "decodeGetViewRequest", ...
// hanldeGetView retrieves a view by ID.
[ "hanldeGetView", "retrieves", "a", "view", "by", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L199-L218
134,846
influxdata/platform
http/view_service.go
handleDeleteView
func (h *ViewHandler) handleDeleteView(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodeDeleteViewRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } if err := h.ViewService.DeleteView(ctx, req.ViewID); err != nil { EncodeError(ctx, err, w) return } w.WriteH...
go
func (h *ViewHandler) handleDeleteView(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, err := decodeDeleteViewRequest(ctx, r) if err != nil { EncodeError(ctx, err, w) return } if err := h.ViewService.DeleteView(ctx, req.ViewID); err != nil { EncodeError(ctx, err, w) return } w.WriteH...
[ "func", "(", "h", "*", "ViewHandler", ")", "handleDeleteView", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "req", ",", "err", ":=", "decodeDeleteViewReque...
// handleDeleteView removes a view by ID.
[ "handleDeleteView", "removes", "a", "view", "by", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L245-L260
134,847
influxdata/platform
http/view_service.go
handlePatchView
func (h *ViewHandler) handlePatchView(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, pe := decodePatchViewRequest(ctx, r) if pe != nil { EncodeError(ctx, pe, w) return } view, err := h.ViewService.UpdateView(ctx, req.ViewID, req.Upd) if err != nil { EncodeError(ctx, err, w) return } ...
go
func (h *ViewHandler) handlePatchView(w http.ResponseWriter, r *http.Request) { ctx := r.Context() req, pe := decodePatchViewRequest(ctx, r) if pe != nil { EncodeError(ctx, pe, w) return } view, err := h.ViewService.UpdateView(ctx, req.ViewID, req.Upd) if err != nil { EncodeError(ctx, err, w) return } ...
[ "func", "(", "h", "*", "ViewHandler", ")", "handlePatchView", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n\n", "req", ",", "pe", ":=", "decodePatchViewRequest"...
// handlePatchView updates a view.
[ "handlePatchView", "updates", "a", "view", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L287-L305
134,848
influxdata/platform
http/view_service.go
Valid
func (r *patchViewRequest) Valid() *platform.Error { if !r.ViewID.Valid() { return &platform.Error{ Code: platform.EInvalid, Msg: "missing view ID", } } return r.Upd.Valid() }
go
func (r *patchViewRequest) Valid() *platform.Error { if !r.ViewID.Valid() { return &platform.Error{ Code: platform.EInvalid, Msg: "missing view ID", } } return r.Upd.Valid() }
[ "func", "(", "r", "*", "patchViewRequest", ")", "Valid", "(", ")", "*", "platform", ".", "Error", "{", "if", "!", "r", ".", "ViewID", ".", "Valid", "(", ")", "{", "return", "&", "platform", ".", "Error", "{", "Code", ":", "platform", ".", "EInvalid...
// Valid validates that the view ID is non zero valued and update has expected values set.
[ "Valid", "validates", "that", "the", "view", "ID", "is", "non", "zero", "valued", "and", "update", "has", "expected", "values", "set", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/view_service.go#L351-L360
134,849
influxdata/platform
mock/scraper_service.go
ListTargets
func (s *ScraperTargetStoreService) ListTargets(ctx context.Context) ([]platform.ScraperTarget, error) { return s.ListTargetsF(ctx) }
go
func (s *ScraperTargetStoreService) ListTargets(ctx context.Context) ([]platform.ScraperTarget, error) { return s.ListTargetsF(ctx) }
[ "func", "(", "s", "*", "ScraperTargetStoreService", ")", "ListTargets", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "platform", ".", "ScraperTarget", ",", "error", ")", "{", "return", "s", ".", "ListTargetsF", "(", "ctx", ")", "\n", "}" ]
// ListTargets lists all the scraper targets.
[ "ListTargets", "lists", "all", "the", "scraper", "targets", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/mock/scraper_service.go#L21-L23
134,850
influxdata/platform
mock/scraper_service.go
AddTarget
func (s *ScraperTargetStoreService) AddTarget(ctx context.Context, t *platform.ScraperTarget) error { return s.AddTargetF(ctx, t) }
go
func (s *ScraperTargetStoreService) AddTarget(ctx context.Context, t *platform.ScraperTarget) error { return s.AddTargetF(ctx, t) }
[ "func", "(", "s", "*", "ScraperTargetStoreService", ")", "AddTarget", "(", "ctx", "context", ".", "Context", ",", "t", "*", "platform", ".", "ScraperTarget", ")", "error", "{", "return", "s", ".", "AddTargetF", "(", "ctx", ",", "t", ")", "\n", "}" ]
// AddTarget adds a scraper target.
[ "AddTarget", "adds", "a", "scraper", "target", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/mock/scraper_service.go#L26-L28
134,851
influxdata/platform
storage/retention.go
Next
func (s *seriesIteratorAdapter) Next() (tsdb.SeriesElem, error) { if s.itr == nil { return nil, nil } row, err := s.itr.Next() if err != nil { return nil, err } if row == nil { return nil, nil } s.ea.name = row.Name s.ea.tags = row.Tags return s.elem, nil }
go
func (s *seriesIteratorAdapter) Next() (tsdb.SeriesElem, error) { if s.itr == nil { return nil, nil } row, err := s.itr.Next() if err != nil { return nil, err } if row == nil { return nil, nil } s.ea.name = row.Name s.ea.tags = row.Tags return s.elem, nil }
[ "func", "(", "s", "*", "seriesIteratorAdapter", ")", "Next", "(", ")", "(", "tsdb", ".", "SeriesElem", ",", "error", ")", "{", "if", "s", ".", "itr", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "row", ",", "err", ":=", "s", ...
// Next returns the next tsdb.SeriesElem. // // The returned tsdb.SeriesElem is valid for use until Next is called again.
[ "Next", "returns", "the", "next", "tsdb", ".", "SeriesElem", ".", "The", "returned", "tsdb", ".", "SeriesElem", "is", "valid", "for", "use", "until", "Next", "is", "called", "again", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/storage/retention.go#L210-L227
134,852
influxdata/platform
tsdb/tsi1/partition.go
deleteNonManifestFiles
func (p *Partition) deleteNonManifestFiles(m *Manifest) error { dir, err := os.Open(p.path) if err != nil { return err } defer dir.Close() fis, err := dir.Readdir(-1) if err != nil { return err } // Loop over all files and remove any not in the manifest. for _, fi := range fis { filename := filepath.Ba...
go
func (p *Partition) deleteNonManifestFiles(m *Manifest) error { dir, err := os.Open(p.path) if err != nil { return err } defer dir.Close() fis, err := dir.Readdir(-1) if err != nil { return err } // Loop over all files and remove any not in the manifest. for _, fi := range fis { filename := filepath.Ba...
[ "func", "(", "p", "*", "Partition", ")", "deleteNonManifestFiles", "(", "m", "*", "Manifest", ")", "error", "{", "dir", ",", "err", ":=", "os", ".", "Open", "(", "p", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "...
// deleteNonManifestFiles removes all files not in the manifest.
[ "deleteNonManifestFiles", "removes", "all", "files", "not", "in", "the", "manifest", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L291-L316
134,853
influxdata/platform
tsdb/tsi1/partition.go
Manifest
func (p *Partition) Manifest() *Manifest { m := &Manifest{ Levels: p.levels, Files: make([]string, len(p.fileSet.files)), Version: p.version, path: p.ManifestPath(), } for j, f := range p.fileSet.files { m.Files[j] = filepath.Base(f.Path()) } return m }
go
func (p *Partition) Manifest() *Manifest { m := &Manifest{ Levels: p.levels, Files: make([]string, len(p.fileSet.files)), Version: p.version, path: p.ManifestPath(), } for j, f := range p.fileSet.files { m.Files[j] = filepath.Base(f.Path()) } return m }
[ "func", "(", "p", "*", "Partition", ")", "Manifest", "(", ")", "*", "Manifest", "{", "m", ":=", "&", "Manifest", "{", "Levels", ":", "p", ".", "levels", ",", "Files", ":", "make", "(", "[", "]", "string", ",", "len", "(", "p", ".", "fileSet", "...
// Manifest returns a manifest for the index.
[ "Manifest", "returns", "a", "manifest", "for", "the", "index", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L411-L424
134,854
influxdata/platform
tsdb/tsi1/partition.go
RetainFileSet
func (p *Partition) RetainFileSet() (*FileSet, error) { select { case <-p.closing: return nil, errors.New("index is closing") default: p.mu.RLock() defer p.mu.RUnlock() return p.retainFileSet(), nil } }
go
func (p *Partition) RetainFileSet() (*FileSet, error) { select { case <-p.closing: return nil, errors.New("index is closing") default: p.mu.RLock() defer p.mu.RUnlock() return p.retainFileSet(), nil } }
[ "func", "(", "p", "*", "Partition", ")", "RetainFileSet", "(", ")", "(", "*", "FileSet", ",", "error", ")", "{", "select", "{", "case", "<-", "p", ".", "closing", ":", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "defau...
// RetainFileSet returns the current fileset and adds a reference count.
[ "RetainFileSet", "returns", "the", "current", "fileset", "and", "adds", "a", "reference", "count", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L437-L446
134,855
influxdata/platform
tsdb/tsi1/partition.go
ForEachMeasurementName
func (p *Partition) ForEachMeasurementName(fn func(name []byte) error) error { fs, err := p.RetainFileSet() if err != nil { return err } defer fs.Release() itr := fs.MeasurementIterator() if itr == nil { return nil } for e := itr.Next(); e != nil; e = itr.Next() { if err := fn(e.Name()); err != nil { ...
go
func (p *Partition) ForEachMeasurementName(fn func(name []byte) error) error { fs, err := p.RetainFileSet() if err != nil { return err } defer fs.Release() itr := fs.MeasurementIterator() if itr == nil { return nil } for e := itr.Next(); e != nil; e = itr.Next() { if err := fn(e.Name()); err != nil { ...
[ "func", "(", "p", "*", "Partition", ")", "ForEachMeasurementName", "(", "fn", "func", "(", "name", "[", "]", "byte", ")", "error", ")", "error", "{", "fs", ",", "err", ":=", "p", ".", "RetainFileSet", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// ForEachMeasurementName iterates over all measurement names in the index.
[ "ForEachMeasurementName", "iterates", "over", "all", "measurement", "names", "in", "the", "index", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L495-L514
134,856
influxdata/platform
tsdb/tsi1/partition.go
MeasurementHasSeries
func (p *Partition) MeasurementHasSeries(name []byte) (bool, error) { fs, err := p.RetainFileSet() if err != nil { return false, err } defer fs.Release() for _, f := range fs.files { if f.MeasurementHasSeries(p.seriesIDSet, name) { return true, nil } } return false, nil }
go
func (p *Partition) MeasurementHasSeries(name []byte) (bool, error) { fs, err := p.RetainFileSet() if err != nil { return false, err } defer fs.Release() for _, f := range fs.files { if f.MeasurementHasSeries(p.seriesIDSet, name) { return true, nil } } return false, nil }
[ "func", "(", "p", "*", "Partition", ")", "MeasurementHasSeries", "(", "name", "[", "]", "byte", ")", "(", "bool", ",", "error", ")", "{", "fs", ",", "err", ":=", "p", ".", "RetainFileSet", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// MeasurementHasSeries returns true if a measurement has at least one non-tombstoned series.
[ "MeasurementHasSeries", "returns", "true", "if", "a", "measurement", "has", "at", "least", "one", "non", "-", "tombstoned", "series", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L517-L531
134,857
influxdata/platform
tsdb/tsi1/partition.go
createSeriesListIfNotExists
func (p *Partition) createSeriesListIfNotExists(collection *tsdb.SeriesCollection) ([]tsdb.SeriesID, error) { // Is there anything to do? The partition may have been sent an empty batch. if collection.Length() == 0 { return nil, nil } else if len(collection.Names) != len(collection.Tags) { return nil, fmt.Errorf...
go
func (p *Partition) createSeriesListIfNotExists(collection *tsdb.SeriesCollection) ([]tsdb.SeriesID, error) { // Is there anything to do? The partition may have been sent an empty batch. if collection.Length() == 0 { return nil, nil } else if len(collection.Names) != len(collection.Tags) { return nil, fmt.Errorf...
[ "func", "(", "p", "*", "Partition", ")", "createSeriesListIfNotExists", "(", "collection", "*", "tsdb", ".", "SeriesCollection", ")", "(", "[", "]", "tsdb", ".", "SeriesID", ",", "error", ")", "{", "// Is there anything to do? The partition may have been sent an empty...
// createSeriesListIfNotExists creates a list of series if they doesn't exist in // bulk.
[ "createSeriesListIfNotExists", "creates", "a", "list", "of", "series", "if", "they", "doesn", "t", "exist", "in", "bulk", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L666-L712
134,858
influxdata/platform
tsdb/tsi1/partition.go
TagValueSeriesIDIterator
func (p *Partition) TagValueSeriesIDIterator(name, key, value []byte) (tsdb.SeriesIDIterator, error) { fs, err := p.RetainFileSet() if err != nil { return nil, err } itr, err := fs.TagValueSeriesIDIterator(name, key, value) if err != nil { return nil, err } else if itr == nil { fs.Release() return nil, n...
go
func (p *Partition) TagValueSeriesIDIterator(name, key, value []byte) (tsdb.SeriesIDIterator, error) { fs, err := p.RetainFileSet() if err != nil { return nil, err } itr, err := fs.TagValueSeriesIDIterator(name, key, value) if err != nil { return nil, err } else if itr == nil { fs.Release() return nil, n...
[ "func", "(", "p", "*", "Partition", ")", "TagValueSeriesIDIterator", "(", "name", ",", "key", ",", "value", "[", "]", "byte", ")", "(", "tsdb", ".", "SeriesIDIterator", ",", "error", ")", "{", "fs", ",", "err", ":=", "p", ".", "RetainFileSet", "(", "...
// TagValueSeriesIDIterator returns a series iterator for a single key value.
[ "TagValueSeriesIDIterator", "returns", "a", "series", "iterator", "for", "a", "single", "key", "value", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L803-L817
134,859
influxdata/platform
tsdb/tsi1/partition.go
ForEachMeasurementTagKey
func (p *Partition) ForEachMeasurementTagKey(name []byte, fn func(key []byte) error) error { fs, err := p.RetainFileSet() if err != nil { return err } defer fs.Release() itr := fs.TagKeyIterator(name) if itr == nil { return nil } for e := itr.Next(); e != nil; e = itr.Next() { if err := fn(e.Key()); err...
go
func (p *Partition) ForEachMeasurementTagKey(name []byte, fn func(key []byte) error) error { fs, err := p.RetainFileSet() if err != nil { return err } defer fs.Release() itr := fs.TagKeyIterator(name) if itr == nil { return nil } for e := itr.Next(); e != nil; e = itr.Next() { if err := fn(e.Key()); err...
[ "func", "(", "p", "*", "Partition", ")", "ForEachMeasurementTagKey", "(", "name", "[", "]", "byte", ",", "fn", "func", "(", "key", "[", "]", "byte", ")", "error", ")", "error", "{", "fs", ",", "err", ":=", "p", ".", "RetainFileSet", "(", ")", "\n",...
// ForEachMeasurementTagKey iterates over all tag keys in a measurement.
[ "ForEachMeasurementTagKey", "iterates", "over", "all", "tag", "keys", "in", "a", "measurement", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L831-L850
134,860
influxdata/platform
tsdb/tsi1/partition.go
Compact
func (p *Partition) Compact() { p.mu.Lock() defer p.mu.Unlock() p.compact() }
go
func (p *Partition) Compact() { p.mu.Lock() defer p.mu.Unlock() p.compact() }
[ "func", "(", "p", "*", "Partition", ")", "Compact", "(", ")", "{", "p", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mu", ".", "Unlock", "(", ")", "\n", "p", ".", "compact", "(", ")", "\n", "}" ]
// Compact requests a compaction of log files.
[ "Compact", "requests", "a", "compaction", "of", "log", "files", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L863-L867
134,861
influxdata/platform
tsdb/tsi1/partition.go
readStatsFile
func (p *Partition) readStatsFile() error { p.stats = NewMeasurementCardinalityStats() f, err := os.Open(p.StatsPath()) if os.IsNotExist(err) { p.statsSize = 0 return nil } else if err != nil { return err } defer f.Close() n, err := p.stats.ReadFrom(bufio.NewReader(f)) if err != nil { return err } p...
go
func (p *Partition) readStatsFile() error { p.stats = NewMeasurementCardinalityStats() f, err := os.Open(p.StatsPath()) if os.IsNotExist(err) { p.statsSize = 0 return nil } else if err != nil { return err } defer f.Close() n, err := p.stats.ReadFrom(bufio.NewReader(f)) if err != nil { return err } p...
[ "func", "(", "p", "*", "Partition", ")", "readStatsFile", "(", ")", "error", "{", "p", ".", "stats", "=", "NewMeasurementCardinalityStats", "(", ")", "\n\n", "f", ",", "err", ":=", "os", ".", "Open", "(", "p", ".", "StatsPath", "(", ")", ")", "\n", ...
// readStatsFile reads the stats file into memory and updates the stats size.
[ "readStatsFile", "reads", "the", "stats", "file", "into", "memory", "and", "updates", "the", "stats", "size", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L1236-L1255
134,862
influxdata/platform
tsdb/tsi1/partition.go
writeStatsFile
func (p *Partition) writeStatsFile() error { tmpPath := p.StatsPath() + ".tmp" f, err := os.Create(tmpPath) if err != nil { return err } defer f.Close() n, err := p.stats.WriteTo(f) if err != nil { return err } if err := f.Close(); err != nil { return err } else if err := os.Rename(tmpPath, p.StatsPat...
go
func (p *Partition) writeStatsFile() error { tmpPath := p.StatsPath() + ".tmp" f, err := os.Create(tmpPath) if err != nil { return err } defer f.Close() n, err := p.stats.WriteTo(f) if err != nil { return err } if err := f.Close(); err != nil { return err } else if err := os.Rename(tmpPath, p.StatsPat...
[ "func", "(", "p", "*", "Partition", ")", "writeStatsFile", "(", ")", "error", "{", "tmpPath", ":=", "p", ".", "StatsPath", "(", ")", "+", "\"", "\"", "\n", "f", ",", "err", ":=", "os", ".", "Create", "(", "tmpPath", ")", "\n", "if", "err", "!=", ...
// writeStatsFile writes the stats file and updates the stats size.
[ "writeStatsFile", "writes", "the", "stats", "file", "and", "updates", "the", "stats", "size", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsi1/partition.go#L1258-L1279
134,863
influxdata/platform
storage/engine.go
WithLogger
func (e *Engine) WithLogger(log *zap.Logger) { fields := []zap.Field{} if e.nodeID != nil { fields = append(fields, zap.Int("node_id", *e.nodeID)) } if e.engineID != nil { fields = append(fields, zap.Int("engine_id", *e.engineID)) } fields = append(fields, zap.String("service", "storage-engine")) e.logger ...
go
func (e *Engine) WithLogger(log *zap.Logger) { fields := []zap.Field{} if e.nodeID != nil { fields = append(fields, zap.Int("node_id", *e.nodeID)) } if e.engineID != nil { fields = append(fields, zap.Int("engine_id", *e.engineID)) } fields = append(fields, zap.String("service", "storage-engine")) e.logger ...
[ "func", "(", "e", "*", "Engine", ")", "WithLogger", "(", "log", "*", "zap", ".", "Logger", ")", "{", "fields", ":=", "[", "]", "zap", ".", "Field", "{", "}", "\n", "if", "e", ".", "nodeID", "!=", "nil", "{", "fields", "=", "append", "(", "field...
// WithLogger sets the logger on the Store. It must be called before Open.
[ "WithLogger", "sets", "the", "logger", "on", "the", "Store", ".", "It", "must", "be", "called", "before", "Open", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/storage/engine.go#L148-L164
134,864
influxdata/platform
storage/engine.go
WritePoints
func (e *Engine) WritePoints(points []models.Point) error { collection := tsdb.NewSeriesCollection(points) j := 0 for iter := collection.Iterator(); iter.Next(); { tags := iter.Tags() if tags.Len() > 0 && bytes.Equal(tags[0].Key, tsdb.FieldKeyTagKeyBytes) && bytes.Equal(tags[0].Value, timeBytes) { // Field ...
go
func (e *Engine) WritePoints(points []models.Point) error { collection := tsdb.NewSeriesCollection(points) j := 0 for iter := collection.Iterator(); iter.Next(); { tags := iter.Tags() if tags.Len() > 0 && bytes.Equal(tags[0].Key, tsdb.FieldKeyTagKeyBytes) && bytes.Equal(tags[0].Value, timeBytes) { // Field ...
[ "func", "(", "e", "*", "Engine", ")", "WritePoints", "(", "points", "[", "]", "models", ".", "Point", ")", "error", "{", "collection", ":=", "tsdb", ".", "NewSeriesCollection", "(", "points", ")", "\n\n", "j", ":=", "0", "\n", "for", "iter", ":=", "c...
// WritePoints writes the provided points to the engine. // // The Engine expects all points to have been correctly validated by the caller. // WritePoints will however determine if there are any field type conflicts, and // return an appropriate error in that case.
[ "WritePoints", "writes", "the", "provided", "points", "to", "the", "engine", ".", "The", "Engine", "expects", "all", "points", "to", "have", "been", "correctly", "validated", "by", "the", "caller", ".", "WritePoints", "will", "however", "determine", "if", "the...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/storage/engine.go#L304-L367
134,865
influxdata/platform
storage/engine.go
DeleteSeriesRangeWithPredicate
func (e *Engine) DeleteSeriesRangeWithPredicate(itr tsdb.SeriesIterator, fn func([]byte, models.Tags) (int64, int64, bool)) error { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return ErrEngineClosed } return e.engine.DeleteSeriesRangeWithPredicate(itr, fn) }
go
func (e *Engine) DeleteSeriesRangeWithPredicate(itr tsdb.SeriesIterator, fn func([]byte, models.Tags) (int64, int64, bool)) error { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return ErrEngineClosed } return e.engine.DeleteSeriesRangeWithPredicate(itr, fn) }
[ "func", "(", "e", "*", "Engine", ")", "DeleteSeriesRangeWithPredicate", "(", "itr", "tsdb", ".", "SeriesIterator", ",", "fn", "func", "(", "[", "]", "byte", ",", "models", ".", "Tags", ")", "(", "int64", ",", "int64", ",", "bool", ")", ")", "error", ...
// DeleteSeriesRangeWithPredicate deletes all series data iterated over if fn returns // true for that series.
[ "DeleteSeriesRangeWithPredicate", "deletes", "all", "series", "data", "iterated", "over", "if", "fn", "returns", "true", "for", "that", "series", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/storage/engine.go#L387-L394
134,866
influxdata/platform
kv/example.go
NewExampleService
func NewExampleService(kv Store, idGen platform.IDGenerator) *ExampleService { return &ExampleService{ kv: kv, idGenerator: idGen, } }
go
func NewExampleService(kv Store, idGen platform.IDGenerator) *ExampleService { return &ExampleService{ kv: kv, idGenerator: idGen, } }
[ "func", "NewExampleService", "(", "kv", "Store", ",", "idGen", "platform", ".", "IDGenerator", ")", "*", "ExampleService", "{", "return", "&", "ExampleService", "{", "kv", ":", "kv", ",", "idGenerator", ":", "idGen", ",", "}", "\n", "}" ]
// NewExampleService creates an instance of an example service.
[ "NewExampleService", "creates", "an", "instance", "of", "an", "example", "service", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L25-L30
134,867
influxdata/platform
kv/example.go
Initialize
func (c *ExampleService) Initialize() error { return c.kv.Update(func(tx Tx) error { if _, err := tx.Bucket([]byte(exampleBucket)); err != nil { return err } if _, err := tx.Bucket([]byte(exampleIndex)); err != nil { return err } return nil }) }
go
func (c *ExampleService) Initialize() error { return c.kv.Update(func(tx Tx) error { if _, err := tx.Bucket([]byte(exampleBucket)); err != nil { return err } if _, err := tx.Bucket([]byte(exampleIndex)); err != nil { return err } return nil }) }
[ "func", "(", "c", "*", "ExampleService", ")", "Initialize", "(", ")", "error", "{", "return", "c", ".", "kv", ".", "Update", "(", "func", "(", "tx", "Tx", ")", "error", "{", "if", "_", ",", "err", ":=", "tx", ".", "Bucket", "(", "[", "]", "byte...
// Initialize creates the buckets for the example service
[ "Initialize", "creates", "the", "buckets", "for", "the", "example", "service" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L33-L43
134,868
influxdata/platform
kv/example.go
FindUserByID
func (c *ExampleService) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error) { var u *platform.User err := c.kv.View(func(tx Tx) error { usr, err := c.findUserByID(ctx, tx, id) if err != nil { return err } u = usr return nil }) if err != nil { return nil, &platform.Error{ O...
go
func (c *ExampleService) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error) { var u *platform.User err := c.kv.View(func(tx Tx) error { usr, err := c.findUserByID(ctx, tx, id) if err != nil { return err } u = usr return nil }) if err != nil { return nil, &platform.Error{ O...
[ "func", "(", "c", "*", "ExampleService", ")", "FindUserByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "User", ",", "error", ")", "{", "var", "u", "*", "platform", ".", "User", "\n\n", ...
// FindUserByID retrieves a example by id.
[ "FindUserByID", "retrieves", "a", "example", "by", "id", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L46-L66
134,869
influxdata/platform
kv/example.go
FindUserByName
func (c *ExampleService) FindUserByName(ctx context.Context, n string) (*platform.User, error) { var u *platform.User err := c.kv.View(func(tx Tx) error { usr, err := c.findUserByName(ctx, tx, n) if err != nil { return err } u = usr return nil }) return u, err }
go
func (c *ExampleService) FindUserByName(ctx context.Context, n string) (*platform.User, error) { var u *platform.User err := c.kv.View(func(tx Tx) error { usr, err := c.findUserByName(ctx, tx, n) if err != nil { return err } u = usr return nil }) return u, err }
[ "func", "(", "c", "*", "ExampleService", ")", "FindUserByName", "(", "ctx", "context", ".", "Context", ",", "n", "string", ")", "(", "*", "platform", ".", "User", ",", "error", ")", "{", "var", "u", "*", "platform", ".", "User", "\n\n", "err", ":=", ...
// FindUserByName returns a example by name for a particular example.
[ "FindUserByName", "returns", "a", "example", "by", "name", "for", "a", "particular", "example", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L99-L112
134,870
influxdata/platform
kv/example.go
FindUser
func (c *ExampleService) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) { if filter.ID != nil { u, err := c.FindUserByID(ctx, *filter.ID) if err != nil { return nil, &platform.Error{ Op: "kv/" + platform.OpFindUser, Err: err, } } return u, nil } if filter.Na...
go
func (c *ExampleService) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) { if filter.ID != nil { u, err := c.FindUserByID(ctx, *filter.ID) if err != nil { return nil, &platform.Error{ Op: "kv/" + platform.OpFindUser, Err: err, } } return u, nil } if filter.Na...
[ "func", "(", "c", "*", "ExampleService", ")", "FindUser", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "UserFilter", ")", "(", "*", "platform", ".", "User", ",", "error", ")", "{", "if", "filter", ".", "ID", "!=", "nil", "{"...
// FindUser retrives a example using an arbitrary example filter. // Filters using ID, or Name should be efficient. // Other filters will do a linear scan across examples until it finds a match.
[ "FindUser", "retrives", "a", "example", "using", "an", "arbitrary", "example", "filter", ".", "Filters", "using", "ID", "or", "Name", "should", "be", "efficient", ".", "Other", "filters", "will", "do", "a", "linear", "scan", "across", "examples", "until", "i...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L141-L182
134,871
influxdata/platform
kv/example.go
FindUsers
func (c *ExampleService) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error) { op := platform.OpFindUsers if filter.ID != nil { u, err := c.FindUserByID(ctx, *filter.ID) if err != nil { return nil, 0, &platform.Error{ Err: err, Op: "kv...
go
func (c *ExampleService) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error) { op := platform.OpFindUsers if filter.ID != nil { u, err := c.FindUserByID(ctx, *filter.ID) if err != nil { return nil, 0, &platform.Error{ Err: err, Op: "kv...
[ "func", "(", "c", "*", "ExampleService", ")", "FindUsers", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "UserFilter", ",", "opt", "...", "platform", ".", "FindOptions", ")", "(", "[", "]", "*", "platform", ".", "User", ",", "i...
// FindUsers retrives all examples that match an arbitrary example filter. // Filters using ID, or Name should be efficient. // Other filters will do a linear scan across all examples searching for a match.
[ "FindUsers", "retrives", "all", "examples", "that", "match", "an", "arbitrary", "example", "filter", ".", "Filters", "using", "ID", "or", "Name", "should", "be", "efficient", ".", "Other", "filters", "will", "do", "a", "linear", "scan", "across", "all", "exa...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L203-L245
134,872
influxdata/platform
kv/example.go
CreateUser
func (c *ExampleService) CreateUser(ctx context.Context, u *platform.User) error { err := c.kv.Update(func(tx Tx) error { unique := c.uniqueExampleName(ctx, tx, u) if !unique { // TODO: make standard error return &platform.Error{ Code: platform.EConflict, Msg: fmt.Sprintf("user with name %s already...
go
func (c *ExampleService) CreateUser(ctx context.Context, u *platform.User) error { err := c.kv.Update(func(tx Tx) error { unique := c.uniqueExampleName(ctx, tx, u) if !unique { // TODO: make standard error return &platform.Error{ Code: platform.EConflict, Msg: fmt.Sprintf("user with name %s already...
[ "func", "(", "c", "*", "ExampleService", ")", "CreateUser", "(", "ctx", "context", ".", "Context", ",", "u", "*", "platform", ".", "User", ")", "error", "{", "err", ":=", "c", ".", "kv", ".", "Update", "(", "func", "(", "tx", "Tx", ")", "error", ...
// CreateUser creates a platform example and sets b.ID.
[ "CreateUser", "creates", "a", "platform", "example", "and", "sets", "b", ".", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L248-L273
134,873
influxdata/platform
kv/example.go
PutUser
func (c *ExampleService) PutUser(ctx context.Context, u *platform.User) error { return c.kv.Update(func(tx Tx) error { return c.putUser(ctx, tx, u) }) }
go
func (c *ExampleService) PutUser(ctx context.Context, u *platform.User) error { return c.kv.Update(func(tx Tx) error { return c.putUser(ctx, tx, u) }) }
[ "func", "(", "c", "*", "ExampleService", ")", "PutUser", "(", "ctx", "context", ".", "Context", ",", "u", "*", "platform", ".", "User", ")", "error", "{", "return", "c", ".", "kv", ".", "Update", "(", "func", "(", "tx", "Tx", ")", "error", "{", "...
// PutUser will put a example without setting an ID.
[ "PutUser", "will", "put", "a", "example", "without", "setting", "an", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L276-L280
134,874
influxdata/platform
kv/example.go
forEachExample
func forEachExample(ctx context.Context, tx Tx, fn func(*platform.User) bool) error { b, err := tx.Bucket(exampleBucket) if err != nil { return err } cur, err := b.Cursor() if err != nil { return err } for k, v := cur.First(); k != nil; k, v = cur.Next() { u := &platform.User{} if err := json.Unmarshal...
go
func forEachExample(ctx context.Context, tx Tx, fn func(*platform.User) bool) error { b, err := tx.Bucket(exampleBucket) if err != nil { return err } cur, err := b.Cursor() if err != nil { return err } for k, v := cur.First(); k != nil; k, v = cur.Next() { u := &platform.User{} if err := json.Unmarshal...
[ "func", "forEachExample", "(", "ctx", "context", ".", "Context", ",", "tx", "Tx", ",", "fn", "func", "(", "*", "platform", ".", "User", ")", "bool", ")", "error", "{", "b", ",", "err", ":=", "tx", ".", "Bucket", "(", "exampleBucket", ")", "\n", "if...
// forEachExample will iterate through all examples while fn returns true.
[ "forEachExample", "will", "iterate", "through", "all", "examples", "while", "fn", "returns", "true", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L314-L336
134,875
influxdata/platform
kv/example.go
UpdateUser
func (c *ExampleService) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) { var u *platform.User err := c.kv.Update(func(tx Tx) error { usr, err := c.updateUser(ctx, tx, id, upd) if err != nil { return err } u = usr return nil }) if err != nil { return...
go
func (c *ExampleService) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) { var u *platform.User err := c.kv.Update(func(tx Tx) error { usr, err := c.updateUser(ctx, tx, id, upd) if err != nil { return err } u = usr return nil }) if err != nil { return...
[ "func", "(", "c", "*", "ExampleService", ")", "UpdateUser", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "upd", "platform", ".", "UserUpdate", ")", "(", "*", "platform", ".", "User", ",", "error", ")", "{", "var", "u"...
// UpdateUser updates a example according the parameters set on upd.
[ "UpdateUser", "updates", "a", "example", "according", "the", "parameters", "set", "on", "upd", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L351-L370
134,876
influxdata/platform
kv/example.go
DeleteUser
func (c *ExampleService) DeleteUser(ctx context.Context, id platform.ID) error { err := c.kv.Update(func(tx Tx) error { return c.deleteUser(ctx, tx, id) }) if err != nil { return &platform.Error{ Op: "kv/" + platform.OpDeleteUser, Err: err, } } return nil }
go
func (c *ExampleService) DeleteUser(ctx context.Context, id platform.ID) error { err := c.kv.Update(func(tx Tx) error { return c.deleteUser(ctx, tx, id) }) if err != nil { return &platform.Error{ Op: "kv/" + platform.OpDeleteUser, Err: err, } } return nil }
[ "func", "(", "c", "*", "ExampleService", ")", "DeleteUser", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "error", "{", "err", ":=", "c", ".", "kv", ".", "Update", "(", "func", "(", "tx", "Tx", ")", "error", "{", "...
// DeleteUser deletes a example and prunes it from the index.
[ "DeleteUser", "deletes", "a", "example", "and", "prunes", "it", "from", "the", "index", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/kv/example.go#L400-L413
134,877
influxdata/platform
http/dashboard_service.go
FindDashboards
func (s *DashboardService) FindDashboards(ctx context.Context, filter platform.DashboardFilter, opts platform.FindOptions) ([]*platform.Dashboard, int, error) { dashboards := []*platform.Dashboard{} url, err := newURL(s.Addr, dashboardsPath) if err != nil { return dashboards, 0, err } qp := url.Query() qp.Add...
go
func (s *DashboardService) FindDashboards(ctx context.Context, filter platform.DashboardFilter, opts platform.FindOptions) ([]*platform.Dashboard, int, error) { dashboards := []*platform.Dashboard{} url, err := newURL(s.Addr, dashboardsPath) if err != nil { return dashboards, 0, err } qp := url.Query() qp.Add...
[ "func", "(", "s", "*", "DashboardService", ")", "FindDashboards", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "DashboardFilter", ",", "opts", "platform", ".", "FindOptions", ")", "(", "[", "]", "*", "platform", ".", "Dashboard", ...
// FindDashboards returns a list of dashboards that match filter and the total count of matching dashboards. // Additional options provide pagination & sorting.
[ "FindDashboards", "returns", "a", "list", "of", "dashboards", "that", "match", "filter", "and", "the", "total", "count", "of", "matching", "dashboards", ".", "Additional", "options", "provide", "pagination", "&", "sorting", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/dashboard_service.go#L951-L990
134,878
influxdata/platform
http/dashboard_service.go
CreateDashboard
func (s *DashboardService) CreateDashboard(ctx context.Context, d *platform.Dashboard) error { url, err := newURL(s.Addr, dashboardsPath) if err != nil { return err } b, err := json.Marshal(d) if err != nil { return err } req, err := http.NewRequest("POST", url.String(), bytes.NewReader(b)) if err != nil ...
go
func (s *DashboardService) CreateDashboard(ctx context.Context, d *platform.Dashboard) error { url, err := newURL(s.Addr, dashboardsPath) if err != nil { return err } b, err := json.Marshal(d) if err != nil { return err } req, err := http.NewRequest("POST", url.String(), bytes.NewReader(b)) if err != nil ...
[ "func", "(", "s", "*", "DashboardService", ")", "CreateDashboard", "(", "ctx", "context", ".", "Context", ",", "d", "*", "platform", ".", "Dashboard", ")", "error", "{", "url", ",", "err", ":=", "newURL", "(", "s", ".", "Addr", ",", "dashboardsPath", "...
// CreateDashboard creates a new dashboard and sets b.ID with the new identifier.
[ "CreateDashboard", "creates", "a", "new", "dashboard", "and", "sets", "b", ".", "ID", "with", "the", "new", "identifier", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/dashboard_service.go#L993-L1028
134,879
influxdata/platform
http/dashboard_service.go
AddDashboardCell
func (s *DashboardService) AddDashboardCell(ctx context.Context, id platform.ID, c *platform.Cell, opts platform.AddDashboardCellOptions) error { url, err := newURL(s.Addr, cellPath(id)) if err != nil { return err } // fixme > in case c does not contain a valid ID this errors out b, err := json.Marshal(c) if e...
go
func (s *DashboardService) AddDashboardCell(ctx context.Context, id platform.ID, c *platform.Cell, opts platform.AddDashboardCellOptions) error { url, err := newURL(s.Addr, cellPath(id)) if err != nil { return err } // fixme > in case c does not contain a valid ID this errors out b, err := json.Marshal(c) if e...
[ "func", "(", "s", "*", "DashboardService", ")", "AddDashboardCell", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "c", "*", "platform", ".", "Cell", ",", "opts", "platform", ".", "AddDashboardCellOptions", ")", "error", "{",...
// AddDashboardCell adds a cell to a dashboard.
[ "AddDashboardCell", "adds", "a", "cell", "to", "a", "dashboard", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/dashboard_service.go#L1097-L1129
134,880
influxdata/platform
http/dashboard_service.go
UpdateDashboardCell
func (s *DashboardService) UpdateDashboardCell(ctx context.Context, dashboardID, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error) { op := s.OpPrefix + platform.OpUpdateDashboardCell if err := upd.Valid(); err != nil { return nil, &platform.Error{ Op: op, Err: err, } } u, err := newUR...
go
func (s *DashboardService) UpdateDashboardCell(ctx context.Context, dashboardID, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error) { op := s.OpPrefix + platform.OpUpdateDashboardCell if err := upd.Valid(); err != nil { return nil, &platform.Error{ Op: op, Err: err, } } u, err := newUR...
[ "func", "(", "s", "*", "DashboardService", ")", "UpdateDashboardCell", "(", "ctx", "context", ".", "Context", ",", "dashboardID", ",", "cellID", "platform", ".", "ID", ",", "upd", "platform", ".", "CellUpdate", ")", "(", "*", "platform", ".", "Cell", ",", ...
// UpdateDashboardCell replaces the dashboard cell with the provided ID.
[ "UpdateDashboardCell", "replaces", "the", "dashboard", "cell", "with", "the", "provided", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/dashboard_service.go#L1153-L1198
134,881
influxdata/platform
http/dashboard_service.go
ReplaceDashboardCells
func (s *DashboardService) ReplaceDashboardCells(ctx context.Context, id platform.ID, cs []*platform.Cell) error { u, err := newURL(s.Addr, cellPath(id)) if err != nil { return err } // TODO(goller): I think this should be {"cells":[]} b, err := json.Marshal(cs) if err != nil { return err } req, err := ht...
go
func (s *DashboardService) ReplaceDashboardCells(ctx context.Context, id platform.ID, cs []*platform.Cell) error { u, err := newURL(s.Addr, cellPath(id)) if err != nil { return err } // TODO(goller): I think this should be {"cells":[]} b, err := json.Marshal(cs) if err != nil { return err } req, err := ht...
[ "func", "(", "s", "*", "DashboardService", ")", "ReplaceDashboardCells", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "cs", "[", "]", "*", "platform", ".", "Cell", ")", "error", "{", "u", ",", "err", ":=", "newURL", "...
// ReplaceDashboardCells replaces all cells in a dashboard
[ "ReplaceDashboardCells", "replaces", "all", "cells", "in", "a", "dashboard" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/dashboard_service.go#L1276-L1314
134,882
influxdata/platform
chronograf/influx/influx.go
Query
func (c *Client) Query(ctx context.Context, q chronograf.Query) (chronograf.Response, error) { resps := make(chan (result)) go func() { resp, err := c.query(c.URL, q) resps <- result{resp, err} }() select { case resp := <-resps: return resp.Response, resp.Err case <-ctx.Done(): return nil, chronograf.Err...
go
func (c *Client) Query(ctx context.Context, q chronograf.Query) (chronograf.Response, error) { resps := make(chan (result)) go func() { resp, err := c.query(c.URL, q) resps <- result{resp, err} }() select { case resp := <-resps: return resp.Response, resp.Err case <-ctx.Done(): return nil, chronograf.Err...
[ "func", "(", "c", "*", "Client", ")", "Query", "(", "ctx", "context", ".", "Context", ",", "q", "chronograf", ".", "Query", ")", "(", "chronograf", ".", "Response", ",", "error", ")", "{", "resps", ":=", "make", "(", "chan", "(", "result", ")", ")"...
// Query issues a request to a configured InfluxDB instance for time series // information specified by query. Queries must be "fully-qualified," and // include both the database and retention policy. In-flight requests can be // cancelled using the provided context.
[ "Query", "issues", "a", "request", "to", "a", "configured", "InfluxDB", "instance", "for", "time", "series", "information", "specified", "by", "query", ".", "Queries", "must", "be", "fully", "-", "qualified", "and", "include", "both", "the", "database", "and",...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/chronograf/influx/influx.go#L136-L149
134,883
influxdata/platform
storage/reads/table.go
hasPoints
func hasPoints(cur cursors.Cursor) bool { if cur == nil { return false } res := false switch cur := cur.(type) { case cursors.IntegerArrayCursor: a := cur.Next() res = a.Len() > 0 case cursors.FloatArrayCursor: a := cur.Next() res = a.Len() > 0 case cursors.UnsignedArrayCursor: a := cur.Next() res...
go
func hasPoints(cur cursors.Cursor) bool { if cur == nil { return false } res := false switch cur := cur.(type) { case cursors.IntegerArrayCursor: a := cur.Next() res = a.Len() > 0 case cursors.FloatArrayCursor: a := cur.Next() res = a.Len() > 0 case cursors.UnsignedArrayCursor: a := cur.Next() res...
[ "func", "hasPoints", "(", "cur", "cursors", ".", "Cursor", ")", "bool", "{", "if", "cur", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "res", ":=", "false", "\n", "switch", "cur", ":=", "cur", ".", "(", "type", ")", "{", "case", "cursors...
// hasPoints returns true if the next block from cur has data. If cur is not // nil, it will be closed.
[ "hasPoints", "returns", "true", "if", "the", "next", "block", "from", "cur", "has", "data", ".", "If", "cur", "is", "not", "nil", "it", "will", "be", "closed", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/storage/reads/table.go#L163-L190
134,884
influxdata/platform
query/influxql/compiler.go
Compile
func (c *Compiler) Compile(ctx context.Context) (*flux.Spec, error) { transpiler := NewTranspilerWithConfig( c.dbrpMappingSvc, Config{ Cluster: c.Cluster, DefaultDatabase: c.DB, DefaultRetentionPolicy: c.RP, }, ) return transpiler.Transpile(ctx, c.Query) }
go
func (c *Compiler) Compile(ctx context.Context) (*flux.Spec, error) { transpiler := NewTranspilerWithConfig( c.dbrpMappingSvc, Config{ Cluster: c.Cluster, DefaultDatabase: c.DB, DefaultRetentionPolicy: c.RP, }, ) return transpiler.Transpile(ctx, c.Query) }
[ "func", "(", "c", "*", "Compiler", ")", "Compile", "(", "ctx", "context", ".", "Context", ")", "(", "*", "flux", ".", "Spec", ",", "error", ")", "{", "transpiler", ":=", "NewTranspilerWithConfig", "(", "c", ".", "dbrpMappingSvc", ",", "Config", "{", "C...
// Compile tranpiles the query into a specification.
[ "Compile", "tranpiles", "the", "query", "into", "a", "specification", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/query/influxql/compiler.go#L36-L46
134,885
influxdata/platform
task/backend/inmem_store.go
DeleteUser
func (s *inmem) DeleteUser(ctx context.Context, id platform.ID) error { return s.delete(ctx, id, getUser) }
go
func (s *inmem) DeleteUser(ctx context.Context, id platform.ID) error { return s.delete(ctx, id, getUser) }
[ "func", "(", "s", "*", "inmem", ")", "DeleteUser", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "error", "{", "return", "s", ".", "delete", "(", "ctx", ",", "id", ",", "getUser", ")", "\n", "}" ]
// DeleteUser synchronously deletes a user and all their tasks from a from an in-mem store store.
[ "DeleteUser", "synchronously", "deletes", "a", "user", "and", "all", "their", "tasks", "from", "a", "from", "an", "in", "-", "mem", "store", "store", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/task/backend/inmem_store.go#L364-L366
134,886
influxdata/platform
inmem/auth_service.go
CreateAuthorization
func (s *Service) CreateAuthorization(ctx context.Context, a *platform.Authorization) error { op := OpPrefix + platform.OpCreateAuthorization _, pErr := s.FindUserByID(ctx, a.UserID) if pErr != nil { return platform.ErrUnableToCreateToken } _, pErr = s.FindOrganizationByID(ctx, a.OrgID) if pErr != nil { ret...
go
func (s *Service) CreateAuthorization(ctx context.Context, a *platform.Authorization) error { op := OpPrefix + platform.OpCreateAuthorization _, pErr := s.FindUserByID(ctx, a.UserID) if pErr != nil { return platform.ErrUnableToCreateToken } _, pErr = s.FindOrganizationByID(ctx, a.OrgID) if pErr != nil { ret...
[ "func", "(", "s", "*", "Service", ")", "CreateAuthorization", "(", "ctx", "context", ".", "Context", ",", "a", "*", "platform", ".", "Authorization", ")", "error", "{", "op", ":=", "OpPrefix", "+", "platform", ".", "OpCreateAuthorization", "\n\n", "_", ","...
// CreateAuthorization sets a.Token and a.ID and creates an platform.Authorization
[ "CreateAuthorization", "sets", "a", ".", "Token", "and", "a", ".", "ID", "and", "creates", "an", "platform", ".", "Authorization" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/inmem/auth_service.go#L152-L178
134,887
influxdata/platform
inmem/auth_service.go
SetAuthorizationStatus
func (s *Service) SetAuthorizationStatus(ctx context.Context, id platform.ID, status platform.Status) error { op := OpPrefix + platform.OpSetAuthorizationStatus a, err := s.FindAuthorizationByID(ctx, id) if err != nil { return &platform.Error{ Err: err, Op: op, } } switch status { case platform.Active...
go
func (s *Service) SetAuthorizationStatus(ctx context.Context, id platform.ID, status platform.Status) error { op := OpPrefix + platform.OpSetAuthorizationStatus a, err := s.FindAuthorizationByID(ctx, id) if err != nil { return &platform.Error{ Err: err, Op: op, } } switch status { case platform.Active...
[ "func", "(", "s", "*", "Service", ")", "SetAuthorizationStatus", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "status", "platform", ".", "Status", ")", "error", "{", "op", ":=", "OpPrefix", "+", "platform", ".", "OpSetAut...
// SetAuthorizationStatus updates the status of an authorization associated with id.
[ "SetAuthorizationStatus", "updates", "the", "status", "of", "an", "authorization", "associated", "with", "id", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/inmem/auth_service.go#L194-L220
134,888
influxdata/platform
http/macro_service.go
NewMacroHandler
func NewMacroHandler() *MacroHandler { h := &MacroHandler{ Router: NewRouter(), Logger: zap.NewNop(), } h.HandlerFunc("GET", "/api/v2/macros", h.handleGetMacros) h.HandlerFunc("POST", "/api/v2/macros", h.handlePostMacro) h.HandlerFunc("GET", "/api/v2/macros/:id", h.handleGetMacro) h.HandlerFunc("PATCH", "/ap...
go
func NewMacroHandler() *MacroHandler { h := &MacroHandler{ Router: NewRouter(), Logger: zap.NewNop(), } h.HandlerFunc("GET", "/api/v2/macros", h.handleGetMacros) h.HandlerFunc("POST", "/api/v2/macros", h.handlePostMacro) h.HandlerFunc("GET", "/api/v2/macros/:id", h.handleGetMacro) h.HandlerFunc("PATCH", "/ap...
[ "func", "NewMacroHandler", "(", ")", "*", "MacroHandler", "{", "h", ":=", "&", "MacroHandler", "{", "Router", ":", "NewRouter", "(", ")", ",", "Logger", ":", "zap", ".", "NewNop", "(", ")", ",", "}", "\n\n", "h", ".", "HandlerFunc", "(", "\"", "\"", ...
// NewMacroHandler creates a new MacroHandler
[ "NewMacroHandler", "creates", "a", "new", "MacroHandler" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/macro_service.go#L31-L45
134,889
influxdata/platform
http/macro_service.go
FindMacroByID
func (s *MacroService) FindMacroByID(ctx context.Context, id platform.ID) (*platform.Macro, error) { path := macroIDPath(id) url, err := newURL(s.Addr, path) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, err } SetToken(s.Token, req) hc...
go
func (s *MacroService) FindMacroByID(ctx context.Context, id platform.ID) (*platform.Macro, error) { path := macroIDPath(id) url, err := newURL(s.Addr, path) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, err } SetToken(s.Token, req) hc...
[ "func", "(", "s", "*", "MacroService", ")", "FindMacroByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "Macro", ",", "error", ")", "{", "path", ":=", "macroIDPath", "(", "id", ")", "\n", ...
// FindMacroByID finds a single macro from the store by its ID
[ "FindMacroByID", "finds", "a", "single", "macro", "from", "the", "store", "by", "its", "ID" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/macro_service.go#L333-L364
134,890
influxdata/platform
http/macro_service.go
CreateMacro
func (s *MacroService) CreateMacro(ctx context.Context, m *platform.Macro) error { if err := m.Valid(); err != nil { return kerrors.InvalidDataf(err.Error()) } url, err := newURL(s.Addr, macroPath) if err != nil { return err } octets, err := json.Marshal(m) if err != nil { return err } req, err := htt...
go
func (s *MacroService) CreateMacro(ctx context.Context, m *platform.Macro) error { if err := m.Valid(); err != nil { return kerrors.InvalidDataf(err.Error()) } url, err := newURL(s.Addr, macroPath) if err != nil { return err } octets, err := json.Marshal(m) if err != nil { return err } req, err := htt...
[ "func", "(", "s", "*", "MacroService", ")", "CreateMacro", "(", "ctx", "context", ".", "Context", ",", "m", "*", "platform", ".", "Macro", ")", "error", "{", "if", "err", ":=", "m", ".", "Valid", "(", ")", ";", "err", "!=", "nil", "{", "return", ...
// CreateMacro creates a new macro and assigns it an platform.ID
[ "CreateMacro", "creates", "a", "new", "macro", "and", "assigns", "it", "an", "platform", ".", "ID" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/macro_service.go#L400-L435
134,891
influxdata/platform
http/macro_service.go
UpdateMacro
func (s *MacroService) UpdateMacro(ctx context.Context, id platform.ID, update *platform.MacroUpdate) (*platform.Macro, error) { u, err := newURL(s.Addr, macroIDPath(id)) if err != nil { return nil, err } octets, err := json.Marshal(update) if err != nil { return nil, err } req, err := http.NewRequest("PAT...
go
func (s *MacroService) UpdateMacro(ctx context.Context, id platform.ID, update *platform.MacroUpdate) (*platform.Macro, error) { u, err := newURL(s.Addr, macroIDPath(id)) if err != nil { return nil, err } octets, err := json.Marshal(update) if err != nil { return nil, err } req, err := http.NewRequest("PAT...
[ "func", "(", "s", "*", "MacroService", ")", "UpdateMacro", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "update", "*", "platform", ".", "MacroUpdate", ")", "(", "*", "platform", ".", "Macro", ",", "error", ")", "{", "...
// UpdateMacro updates a single macro with a changeset
[ "UpdateMacro", "updates", "a", "single", "macro", "with", "a", "changeset" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/macro_service.go#L438-L475
134,892
influxdata/platform
tsdb/series_set.go
AndNot
func (s *SeriesIDSet) AndNot(other *SeriesIDSet) *SeriesIDSet { s.RLock() defer s.RUnlock() other.RLock() defer other.RUnlock() return &SeriesIDSet{bitmap: roaring.AndNot(s.bitmap, other.bitmap)} }
go
func (s *SeriesIDSet) AndNot(other *SeriesIDSet) *SeriesIDSet { s.RLock() defer s.RUnlock() other.RLock() defer other.RUnlock() return &SeriesIDSet{bitmap: roaring.AndNot(s.bitmap, other.bitmap)} }
[ "func", "(", "s", "*", "SeriesIDSet", ")", "AndNot", "(", "other", "*", "SeriesIDSet", ")", "*", "SeriesIDSet", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "other", ".", "RLock", "(", ")", "\n", "defer", ...
// AndNot returns a new SeriesIDSet containing elements that were present in s, // but not present in other.
[ "AndNot", "returns", "a", "new", "SeriesIDSet", "containing", "elements", "that", "were", "present", "in", "s", "but", "not", "present", "in", "other", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/series_set.go#L175-L182
134,893
influxdata/platform
tsdb/tsm1/engine.go
NewEngine
func NewEngine(path string, idx *tsi1.Index, config Config, options ...EngineOption) *Engine { fs := NewFileStore(path) fs.openLimiter = limiter.NewFixed(config.MaxConcurrentOpens) fs.tsmMMAPWillNeed = config.MADVWillNeed cache := NewCache(uint64(config.Cache.MaxMemorySize)) c := NewCompactor() c.Dir = path c....
go
func NewEngine(path string, idx *tsi1.Index, config Config, options ...EngineOption) *Engine { fs := NewFileStore(path) fs.openLimiter = limiter.NewFixed(config.MaxConcurrentOpens) fs.tsmMMAPWillNeed = config.MADVWillNeed cache := NewCache(uint64(config.Cache.MaxMemorySize)) c := NewCompactor() c.Dir = path c....
[ "func", "NewEngine", "(", "path", "string", ",", "idx", "*", "tsi1", ".", "Index", ",", "config", "Config", ",", "options", "...", "EngineOption", ")", "*", "Engine", "{", "fs", ":=", "NewFileStore", "(", "path", ")", "\n", "fs", ".", "openLimiter", "=...
// NewEngine returns a new instance of Engine.
[ "NewEngine", "returns", "a", "new", "instance", "of", "Engine", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L168-L231
134,894
influxdata/platform
tsdb/tsm1/engine.go
LastModified
func (e *Engine) LastModified() time.Time { fsTime := e.FileStore.LastModified() if e.WAL.LastWriteTime().After(fsTime) { return e.WAL.LastWriteTime() } return fsTime }
go
func (e *Engine) LastModified() time.Time { fsTime := e.FileStore.LastModified() if e.WAL.LastWriteTime().After(fsTime) { return e.WAL.LastWriteTime() } return fsTime }
[ "func", "(", "e", "*", "Engine", ")", "LastModified", "(", ")", "time", ".", "Time", "{", "fsTime", ":=", "e", ".", "FileStore", ".", "LastModified", "(", ")", "\n\n", "if", "e", ".", "WAL", ".", "LastWriteTime", "(", ")", ".", "After", "(", "fsTim...
// LastModified returns the time when this shard was last modified.
[ "LastModified", "returns", "the", "time", "when", "this", "shard", "was", "last", "modified", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L481-L488
134,895
influxdata/platform
tsdb/tsm1/engine.go
DiskSize
func (e *Engine) DiskSize() int64 { walDiskSizeBytes := e.WAL.DiskSizeBytes() return e.FileStore.DiskSizeBytes() + walDiskSizeBytes }
go
func (e *Engine) DiskSize() int64 { walDiskSizeBytes := e.WAL.DiskSizeBytes() return e.FileStore.DiskSizeBytes() + walDiskSizeBytes }
[ "func", "(", "e", "*", "Engine", ")", "DiskSize", "(", ")", "int64", "{", "walDiskSizeBytes", ":=", "e", ".", "WAL", ".", "DiskSizeBytes", "(", ")", "\n", "return", "e", ".", "FileStore", ".", "DiskSizeBytes", "(", ")", "+", "walDiskSizeBytes", "\n", "...
// DiskSize returns the total size in bytes of all TSM and WAL segments on disk.
[ "DiskSize", "returns", "the", "total", "size", "in", "bytes", "of", "all", "TSM", "and", "WAL", "segments", "on", "disk", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L496-L499
134,896
influxdata/platform
tsdb/tsm1/engine.go
Free
func (e *Engine) Free() error { e.Cache.Free() return e.FileStore.Free() }
go
func (e *Engine) Free() error { e.Cache.Free() return e.FileStore.Free() }
[ "func", "(", "e", "*", "Engine", ")", "Free", "(", ")", "error", "{", "e", ".", "Cache", ".", "Free", "(", ")", "\n", "return", "e", ".", "FileStore", ".", "Free", "(", ")", "\n", "}" ]
// Free releases any resources held by the engine to free up memory or CPU.
[ "Free", "releases", "any", "resources", "held", "by", "the", "engine", "to", "free", "up", "memory", "or", "CPU", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L593-L596
134,897
influxdata/platform
tsdb/tsm1/engine.go
WritePoints
func (e *Engine) WritePoints(points []models.Point) error { values := make(map[string][]Value, len(points)) var ( keyBuf []byte baseLen int ) for _, p := range points { keyBuf = append(keyBuf[:0], p.Key()...) keyBuf = append(keyBuf, keyFieldSeparator...) baseLen = len(keyBuf) iter := p.FieldIterator()...
go
func (e *Engine) WritePoints(points []models.Point) error { values := make(map[string][]Value, len(points)) var ( keyBuf []byte baseLen int ) for _, p := range points { keyBuf = append(keyBuf[:0], p.Key()...) keyBuf = append(keyBuf, keyFieldSeparator...) baseLen = len(keyBuf) iter := p.FieldIterator()...
[ "func", "(", "e", "*", "Engine", ")", "WritePoints", "(", "points", "[", "]", "models", ".", "Point", ")", "error", "{", "values", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "Value", ",", "len", "(", "points", ")", ")", "\n", "var", ...
// WritePoints writes metadata and point data into the engine. // It returns an error if new points are added to an existing key.
[ "WritePoints", "writes", "metadata", "and", "point", "data", "into", "the", "engine", ".", "It", "returns", "an", "error", "if", "new", "points", "are", "added", "to", "an", "existing", "key", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L600-L665
134,898
influxdata/platform
tsdb/tsm1/engine.go
Attempted
func (t *compactionTracker) Attempted(level compactionLevel, success bool, duration time.Duration) { if success { atomic.AddUint64(&t.ok[level], 1) labels := t.Labels(level) t.metrics.CompactionDuration.With(labels).Observe(duration.Seconds()) labels["status"] = "ok" t.metrics.Compactions.With(labels).Inc...
go
func (t *compactionTracker) Attempted(level compactionLevel, success bool, duration time.Duration) { if success { atomic.AddUint64(&t.ok[level], 1) labels := t.Labels(level) t.metrics.CompactionDuration.With(labels).Observe(duration.Seconds()) labels["status"] = "ok" t.metrics.Compactions.With(labels).Inc...
[ "func", "(", "t", "*", "compactionTracker", ")", "Attempted", "(", "level", "compactionLevel", ",", "success", "bool", ",", "duration", "time", ".", "Duration", ")", "{", "if", "success", "{", "atomic", ".", "AddUint64", "(", "&", "t", ".", "ok", "[", ...
// Attempted updates the number of compactions attempted for the provided level.
[ "Attempted", "updates", "the", "number", "of", "compactions", "attempted", "for", "the", "provided", "level", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L1141-L1160
134,899
influxdata/platform
tsdb/tsm1/engine.go
compactCache
func (e *Engine) compactCache() { t := time.NewTicker(time.Second) defer t.Stop() for { e.mu.RLock() quit := e.snapDone e.mu.RUnlock() select { case <-quit: return case <-t.C: e.Cache.UpdateAge() if e.ShouldCompactCache(time.Now()) { start := time.Now() e.traceLogger.Info("Compacting c...
go
func (e *Engine) compactCache() { t := time.NewTicker(time.Second) defer t.Stop() for { e.mu.RLock() quit := e.snapDone e.mu.RUnlock() select { case <-quit: return case <-t.C: e.Cache.UpdateAge() if e.ShouldCompactCache(time.Now()) { start := time.Now() e.traceLogger.Info("Compacting c...
[ "func", "(", "e", "*", "Engine", ")", "compactCache", "(", ")", "{", "t", ":=", "time", ".", "NewTicker", "(", "time", ".", "Second", ")", "\n", "defer", "t", ".", "Stop", "(", ")", "\n", "for", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\...
// compactCache continually checks if the WAL cache should be written to disk.
[ "compactCache", "continually", "checks", "if", "the", "WAL", "cache", "should", "be", "written", "to", "disk", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/engine.go#L1270-L1295