id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
124,500
influxdata/influxdb
chronograf/organizations/organizations.go
Get
func (s *OrganizationsStore) Get(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { err := validOrganization(ctx) if err != nil { return nil, err } d, err := s.store.Get(ctx, q) if err != nil { return nil, err } if d.ID != s.organization { return nil, chronograf.ErrO...
go
func (s *OrganizationsStore) Get(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { err := validOrganization(ctx) if err != nil { return nil, err } d, err := s.store.Get(ctx, q) if err != nil { return nil, err } if d.ID != s.organization { return nil, chronograf.ErrO...
[ "func", "(", "s", "*", "OrganizationsStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "q", "chronograf", ".", "OrganizationQuery", ")", "(", "*", "chronograf", ".", "Organization", ",", "error", ")", "{", "err", ":=", "validOrganization", "(...
// Get returns a Organization if the id exists and belongs to the organization that is set.
[ "Get", "returns", "a", "Organization", "if", "the", "id", "exists", "and", "belongs", "to", "the", "organization", "that", "is", "set", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/organizations.go#L109-L125
124,501
influxdata/influxdb
gather/metrics.go
Points
func (ms MetricsSlice) Points() (models.Points, error) { ps := make([]models.Point, len(ms)) for mi, m := range ms { point, err := models.NewPoint(m.Name, models.NewTags(m.Tags), m.Fields, m.Timestamp) if err != nil { return ps, err } ps[mi] = point } return ps, nil }
go
func (ms MetricsSlice) Points() (models.Points, error) { ps := make([]models.Point, len(ms)) for mi, m := range ms { point, err := models.NewPoint(m.Name, models.NewTags(m.Tags), m.Fields, m.Timestamp) if err != nil { return ps, err } ps[mi] = point } return ps, nil }
[ "func", "(", "ms", "MetricsSlice", ")", "Points", "(", ")", "(", "models", ".", "Points", ",", "error", ")", "{", "ps", ":=", "make", "(", "[", "]", "models", ".", "Point", ",", "len", "(", "ms", ")", ")", "\n", "for", "mi", ",", "m", ":=", "...
// Points convert the MetricsSlice to model.Points
[ "Points", "convert", "the", "MetricsSlice", "to", "model", ".", "Points" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/gather/metrics.go#L33-L44
124,502
influxdata/influxdb
gather/metrics.go
Reader
func (ms MetricsSlice) Reader() (io.Reader, error) { buf := new(bytes.Buffer) for mi, m := range ms { point, err := models.NewPoint(m.Name, models.NewTags(m.Tags), m.Fields, m.Timestamp) if err != nil { return nil, err } _, err = buf.WriteString(point.String()) if err != nil { return nil, err } ...
go
func (ms MetricsSlice) Reader() (io.Reader, error) { buf := new(bytes.Buffer) for mi, m := range ms { point, err := models.NewPoint(m.Name, models.NewTags(m.Tags), m.Fields, m.Timestamp) if err != nil { return nil, err } _, err = buf.WriteString(point.String()) if err != nil { return nil, err } ...
[ "func", "(", "ms", "MetricsSlice", ")", "Reader", "(", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "for", "mi", ",", "m", ":=", "range", "ms", "{", "point", ",", "err", ":="...
// Reader returns an io.Reader that enumerates the metrics. // All metrics are allocated into the underlying buffer.
[ "Reader", "returns", "an", "io", ".", "Reader", "that", "enumerates", "the", "metrics", ".", "All", "metrics", "are", "allocated", "into", "the", "underlying", "buffer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/gather/metrics.go#L48-L69
124,503
influxdata/influxdb
gather/metrics.go
UnmarshalJSON
func (x *MetricType) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(metricTypeValue, data, "MetricType") if err != nil { return err } *x = MetricType(value) return nil }
go
func (x *MetricType) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(metricTypeValue, data, "MetricType") if err != nil { return err } *x = MetricType(value) return nil }
[ "func", "(", "x", "*", "MetricType", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "value", ",", "err", ":=", "proto", ".", "UnmarshalJSONEnum", "(", "metricTypeValue", ",", "data", ",", "\"", "\"", ")", "\n", "if", "err", "...
// UnmarshalJSON implements the unmarshaler interface.
[ "UnmarshalJSON", "implements", "the", "unmarshaler", "interface", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/gather/metrics.go#L109-L116
124,504
influxdata/influxdb
pkg/metrics/default_registry.go
MustRegisterCounter
func MustRegisterCounter(name string, opts ...descOption) ID { return defaultRegistry.MustRegisterCounter(name, opts...) }
go
func MustRegisterCounter(name string, opts ...descOption) ID { return defaultRegistry.MustRegisterCounter(name, opts...) }
[ "func", "MustRegisterCounter", "(", "name", "string", ",", "opts", "...", "descOption", ")", "ID", "{", "return", "defaultRegistry", ".", "MustRegisterCounter", "(", "name", ",", "opts", "...", ")", "\n", "}" ]
// MustRegisterCounter registers a new counter metric with the default registry // using the provided descriptor. // If the metric name is not unique, MustRegisterCounter will panic. // // MustRegisterCounter is not safe to call from multiple goroutines.
[ "MustRegisterCounter", "registers", "a", "new", "counter", "metric", "with", "the", "default", "registry", "using", "the", "provided", "descriptor", ".", "If", "the", "metric", "name", "is", "not", "unique", "MustRegisterCounter", "will", "panic", ".", "MustRegist...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/default_registry.go#L18-L20
124,505
influxdata/influxdb
pkg/metrics/default_registry.go
MustRegisterTimer
func MustRegisterTimer(name string, opts ...descOption) ID { return defaultRegistry.MustRegisterTimer(name, opts...) }
go
func MustRegisterTimer(name string, opts ...descOption) ID { return defaultRegistry.MustRegisterTimer(name, opts...) }
[ "func", "MustRegisterTimer", "(", "name", "string", ",", "opts", "...", "descOption", ")", "ID", "{", "return", "defaultRegistry", ".", "MustRegisterTimer", "(", "name", ",", "opts", "...", ")", "\n", "}" ]
// MustRegisterTimer registers a new timer metric with the default registry // using the provided descriptor. // If the metric name is not unique, MustRegisterTimer will panic. // // MustRegisterTimer is not safe to call from multiple goroutines.
[ "MustRegisterTimer", "registers", "a", "new", "timer", "metric", "with", "the", "default", "registry", "using", "the", "provided", "descriptor", ".", "If", "the", "metric", "name", "is", "not", "unique", "MustRegisterTimer", "will", "panic", ".", "MustRegisterTime...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/default_registry.go#L27-L29
124,506
influxdata/influxdb
chronograf/server/sources.go
NewSource
func (s *Service) NewSource(w http.ResponseWriter, r *http.Request) { var src chronograf.Source if err := json.NewDecoder(r.Body).Decode(&src); err != nil { invalidJSON(w, s.Logger) return } ctx := r.Context() defaultOrg, err := s.Store.Organizations(ctx).DefaultOrganization(ctx) if err != nil { unknownErr...
go
func (s *Service) NewSource(w http.ResponseWriter, r *http.Request) { var src chronograf.Source if err := json.NewDecoder(r.Body).Decode(&src); err != nil { invalidJSON(w, s.Logger) return } ctx := r.Context() defaultOrg, err := s.Store.Organizations(ctx).DefaultOrganization(ctx) if err != nil { unknownErr...
[ "func", "(", "s", "*", "Service", ")", "NewSource", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "src", "chronograf", ".", "Source", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", "...
// NewSource adds a new valid source to the store
[ "NewSource", "adds", "a", "new", "valid", "source", "to", "the", "store" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L111-L151
124,507
influxdata/influxdb
chronograf/server/sources.go
Sources
func (s *Service) Sources(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcs, err := s.Store.Sources(ctx).All(ctx) if err != nil { Error(w, http.StatusInternalServerError, "Error loading sources", s.Logger) return } res := getSourcesResponse{ Sources: make([]sourceResponse, len(srcs)), } s...
go
func (s *Service) Sources(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcs, err := s.Store.Sources(ctx).All(ctx) if err != nil { Error(w, http.StatusInternalServerError, "Error loading sources", s.Logger) return } res := getSourcesResponse{ Sources: make([]sourceResponse, len(srcs)), } s...
[ "func", "(", "s", "*", "Service", ")", "Sources", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "srcs", ",", "err", ":=", "s", ".", "Store", ".", "Sou...
// Sources returns all sources from the store.
[ "Sources", "returns", "all", "sources", "from", "the", "store", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L169-L189
124,508
influxdata/influxdb
chronograf/server/sources.go
SourcesID
func (s *Service) SourcesID(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } ctx := r.Context() src, err := s.Store.Sources(ctx).Get(ctx, id) if err != nil { notFound(w, id, s.Logger) return } ...
go
func (s *Service) SourcesID(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } ctx := r.Context() src, err := s.Store.Sources(ctx).Get(ctx, id) if err != nil { notFound(w, id, s.Logger) return } ...
[ "func", "(", "s", "*", "Service", ")", "SourcesID", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "id", ",", "err", ":=", "paramID", "(", "\"", "\"", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{"...
// SourcesID retrieves a source from the store
[ "SourcesID", "retrieves", "a", "source", "from", "the", "store" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L192-L208
124,509
influxdata/influxdb
chronograf/server/sources.go
RemoveSource
func (s *Service) RemoveSource(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } src := chronograf.Source{ID: id} ctx := r.Context() if err = s.Store.Sources(ctx).Delete(ctx, src); err != nil { if e...
go
func (s *Service) RemoveSource(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } src := chronograf.Source{ID: id} ctx := r.Context() if err = s.Store.Sources(ctx).Delete(ctx, src); err != nil { if e...
[ "func", "(", "s", "*", "Service", ")", "RemoveSource", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "id", ",", "err", ":=", "paramID", "(", "\"", "\"", ",", "r", ")", "\n", "if", "err", "!=", "nil", ...
// RemoveSource deletes the source from the store
[ "RemoveSource", "deletes", "the", "source", "from", "the", "store" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L211-L236
124,510
influxdata/influxdb
chronograf/server/sources.go
SourceHealth
func (s *Service) SourceHealth(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } // TODO(desa): add real support for a default source if id == 0 { w.WriteHeader(http.StatusNoContent) return } ct...
go
func (s *Service) SourceHealth(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } // TODO(desa): add real support for a default source if id == 0 { w.WriteHeader(http.StatusNoContent) return } ct...
[ "func", "(", "s", "*", "Service", ")", "SourceHealth", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "id", ",", "err", ":=", "paramID", "(", "\"", "\"", ",", "r", ")", "\n", "if", "err", "!=", "nil", ...
// SourceHealth determines if the tsdb is running
[ "SourceHealth", "determines", "if", "the", "tsdb", "is", "running" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L239-L274
124,511
influxdata/influxdb
chronograf/server/sources.go
removeSrcsKapa
func (s *Service) removeSrcsKapa(ctx context.Context, srcID int) error { kapas, err := s.Store.Servers(ctx).All(ctx) if err != nil { return err } // Filter the kapacitors to delete by matching the source id deleteKapa := []int{} for _, kapa := range kapas { if kapa.SrcID == srcID { deleteKapa = append(del...
go
func (s *Service) removeSrcsKapa(ctx context.Context, srcID int) error { kapas, err := s.Store.Servers(ctx).All(ctx) if err != nil { return err } // Filter the kapacitors to delete by matching the source id deleteKapa := []int{} for _, kapa := range kapas { if kapa.SrcID == srcID { deleteKapa = append(del...
[ "func", "(", "s", "*", "Service", ")", "removeSrcsKapa", "(", "ctx", "context", ".", "Context", ",", "srcID", "int", ")", "error", "{", "kapas", ",", "err", ":=", "s", ".", "Store", ".", "Servers", "(", "ctx", ")", ".", "All", "(", "ctx", ")", "\...
// removeSrcsKapa will remove all kapacitors and kapacitor rules from the stores. // However, it will not remove the kapacitor tickscript from kapacitor itself.
[ "removeSrcsKapa", "will", "remove", "all", "kapacitors", "and", "kapacitor", "rules", "from", "the", "stores", ".", "However", "it", "will", "not", "remove", "the", "kapacitor", "tickscript", "from", "kapacitor", "itself", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L278-L304
124,512
influxdata/influxdb
chronograf/server/sources.go
UpdateSource
func (s *Service) UpdateSource(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } ctx := r.Context() src, err := s.Store.Sources(ctx).Get(ctx, id) if err != nil { notFound(w, id, s.Logger) return ...
go
func (s *Service) UpdateSource(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } ctx := r.Context() src, err := s.Store.Sources(ctx).Get(ctx, id) if err != nil { notFound(w, id, s.Logger) return ...
[ "func", "(", "s", "*", "Service", ")", "UpdateSource", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "id", ",", "err", ":=", "paramID", "(", "\"", "\"", ",", "r", ")", "\n", "if", "err", "!=", "nil", ...
// UpdateSource handles incremental updates of a data source
[ "UpdateSource", "handles", "incremental", "updates", "of", "a", "data", "source" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L307-L378
124,513
influxdata/influxdb
chronograf/server/sources.go
ValidSourceRequest
func ValidSourceRequest(s *chronograf.Source, defaultOrgID string) error { if s == nil { return fmt.Errorf("source must be non-nil") } // Name and URL areq required if s.URL == "" { return fmt.Errorf("url required") } // Type must be influx or influx-enterprise if s.Type != "" { if s.Type != chronograf.Inf...
go
func ValidSourceRequest(s *chronograf.Source, defaultOrgID string) error { if s == nil { return fmt.Errorf("source must be non-nil") } // Name and URL areq required if s.URL == "" { return fmt.Errorf("url required") } // Type must be influx or influx-enterprise if s.Type != "" { if s.Type != chronograf.Inf...
[ "func", "ValidSourceRequest", "(", "s", "*", "chronograf", ".", "Source", ",", "defaultOrgID", "string", ")", "error", "{", "if", "s", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "// Name and URL areq required",...
// ValidSourceRequest checks if name, url, type, and role are valid
[ "ValidSourceRequest", "checks", "if", "name", "url", "type", "and", "role", "are", "valid" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L381-L409
124,514
influxdata/influxdb
chronograf/server/sources.go
HandleNewSources
func (s *Service) HandleNewSources(ctx context.Context, input string) error { if input == "" { return nil } s.Logger.Error("--new-sources is deprecated and will be removed in a future version.") var srcsKaps []struct { Source chronograf.Source `json:"influxdb"` Kapacitor chronograf.Server `json:"kapacito...
go
func (s *Service) HandleNewSources(ctx context.Context, input string) error { if input == "" { return nil } s.Logger.Error("--new-sources is deprecated and will be removed in a future version.") var srcsKaps []struct { Source chronograf.Source `json:"influxdb"` Kapacitor chronograf.Server `json:"kapacito...
[ "func", "(", "s", "*", "Service", ")", "HandleNewSources", "(", "ctx", "context", ".", "Context", ",", "input", "string", ")", "error", "{", "if", "input", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "s", ".", "Logger", ".", "Error", ...
// HandleNewSources parses and persists new sources passed in via server flag
[ "HandleNewSources", "parses", "and", "persists", "new", "sources", "passed", "in", "via", "server", "flag" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L412-L452
124,515
influxdata/influxdb
chronograf/server/sources.go
newSourceKapacitor
func (s *Service) newSourceKapacitor(ctx context.Context, src chronograf.Source, kapa chronograf.Server) error { srcs, err := s.Store.Sources(ctx).All(ctx) if err != nil { return err } for _, source := range srcs { // If source already exists, do nothing if source.Name == src.Name { s.Logger. WithFiel...
go
func (s *Service) newSourceKapacitor(ctx context.Context, src chronograf.Source, kapa chronograf.Server) error { srcs, err := s.Store.Sources(ctx).All(ctx) if err != nil { return err } for _, source := range srcs { // If source already exists, do nothing if source.Name == src.Name { s.Logger. WithFiel...
[ "func", "(", "s", "*", "Service", ")", "newSourceKapacitor", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ",", "kapa", "chronograf", ".", "Server", ")", "error", "{", "srcs", ",", "err", ":=", "s", ".", "Store", ".", ...
// newSourceKapacitor adds sources to BoltDB idempotently by name, as well as respective kapacitors
[ "newSourceKapacitor", "adds", "sources", "to", "BoltDB", "idempotently", "by", "name", "as", "well", "as", "respective", "kapacitors" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L455-L483
124,516
influxdata/influxdb
chronograf/server/sources.go
NewSourceUser
func (s *Service) NewSourceUser(w http.ResponseWriter, r *http.Request) { var req sourceUserRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidCreate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() srcID, t...
go
func (s *Service) NewSourceUser(w http.ResponseWriter, r *http.Request) { var req sourceUserRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidCreate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() srcID, t...
[ "func", "(", "s", "*", "Service", ")", "NewSourceUser", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "req", "sourceUserRequest", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", "B...
// NewSourceUser adds user to source
[ "NewSourceUser", "adds", "user", "to", "source" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L486-L529
124,517
influxdata/influxdb
chronograf/server/sources.go
SourceUsers
func (s *Service) SourceUsers(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } store := ts.Users(ctx) users, err := store.All(ctx) if err != nil { Error(w, http.StatusBadRequest, err.Error(), s.Logger) return } _, hasRole...
go
func (s *Service) SourceUsers(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } store := ts.Users(ctx) users, err := store.All(ctx) if err != nil { Error(w, http.StatusBadRequest, err.Error(), s.Logger) return } _, hasRole...
[ "func", "(", "s", "*", "Service", ")", "SourceUsers", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "srcID", ",", "ts", ",", "err", ":=", "s", ".", "s...
// SourceUsers retrieves all users from source.
[ "SourceUsers", "retrieves", "all", "users", "from", "source", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L532-L561
124,518
influxdata/influxdb
chronograf/server/sources.go
SourceUserID
func (s *Service) SourceUserID(w http.ResponseWriter, r *http.Request) { ctx := r.Context() uid := httprouter.GetParamFromContext(ctx, "uid") srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } store := ts.Users(ctx) u, err := store.Get(ctx, chronograf.UserQuery{Name: &uid}) if err != nil {...
go
func (s *Service) SourceUserID(w http.ResponseWriter, r *http.Request) { ctx := r.Context() uid := httprouter.GetParamFromContext(ctx, "uid") srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } store := ts.Users(ctx) u, err := store.Get(ctx, chronograf.UserQuery{Name: &uid}) if err != nil {...
[ "func", "(", "s", "*", "Service", ")", "SourceUserID", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "uid", ":=", "httprouter", ".", "GetParamFromContext", ...
// SourceUserID retrieves a user with ID from store. // In InfluxDB, a User's Name is their UID, hence the semantic below.
[ "SourceUserID", "retrieves", "a", "user", "with", "ID", "from", "store", ".", "In", "InfluxDB", "a", "User", "s", "Name", "is", "their", "UID", "hence", "the", "semantic", "below", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L565-L585
124,519
influxdata/influxdb
chronograf/server/sources.go
RemoveSourceUser
func (s *Service) RemoveSourceUser(w http.ResponseWriter, r *http.Request) { ctx := r.Context() uid := httprouter.GetParamFromContext(ctx, "uid") _, store, err := s.sourceUsersStore(ctx, w, r) if err != nil { return } if err := store.Delete(ctx, &chronograf.User{Name: uid}); err != nil { Error(w, http.Statu...
go
func (s *Service) RemoveSourceUser(w http.ResponseWriter, r *http.Request) { ctx := r.Context() uid := httprouter.GetParamFromContext(ctx, "uid") _, store, err := s.sourceUsersStore(ctx, w, r) if err != nil { return } if err := store.Delete(ctx, &chronograf.User{Name: uid}); err != nil { Error(w, http.Statu...
[ "func", "(", "s", "*", "Service", ")", "RemoveSourceUser", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "uid", ":=", "httprouter", ".", "GetParamFromContext"...
// RemoveSourceUser removes the user from the InfluxDB source
[ "RemoveSourceUser", "removes", "the", "user", "from", "the", "InfluxDB", "source" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L588-L603
124,520
influxdata/influxdb
chronograf/server/sources.go
UpdateSourceUser
func (s *Service) UpdateSourceUser(w http.ResponseWriter, r *http.Request) { var req sourceUserRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidUpdate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() uid :=...
go
func (s *Service) UpdateSourceUser(w http.ResponseWriter, r *http.Request) { var req sourceUserRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidUpdate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() uid :=...
[ "func", "(", "s", "*", "Service", ")", "UpdateSourceUser", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "req", "sourceUserRequest", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", ...
// UpdateSourceUser changes the password or permissions of a source user
[ "UpdateSourceUser", "changes", "the", "password", "or", "permissions", "of", "a", "source", "user" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L606-L649
124,521
influxdata/influxdb
chronograf/server/sources.go
hasRoles
func (s *Service) hasRoles(ctx context.Context, ts chronograf.TimeSeries) (chronograf.RolesStore, bool) { store, err := ts.Roles(ctx) if err != nil { return nil, false } return store, true }
go
func (s *Service) hasRoles(ctx context.Context, ts chronograf.TimeSeries) (chronograf.RolesStore, bool) { store, err := ts.Roles(ctx) if err != nil { return nil, false } return store, true }
[ "func", "(", "s", "*", "Service", ")", "hasRoles", "(", "ctx", "context", ".", "Context", ",", "ts", "chronograf", ".", "TimeSeries", ")", "(", "chronograf", ".", "RolesStore", ",", "bool", ")", "{", "store", ",", "err", ":=", "ts", ".", "Roles", "("...
// hasRoles checks if the influx source has roles or not
[ "hasRoles", "checks", "if", "the", "influx", "source", "has", "roles", "or", "not" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L690-L696
124,522
influxdata/influxdb
chronograf/server/sources.go
WithRoles
func (u *sourceUserResponse) WithRoles(srcID int, roles []chronograf.Role) *sourceUserResponse { u.hasRoles = true rr := make([]sourceRoleResponse, len(roles)) for i, role := range roles { rr[i] = newSourceRoleResponse(srcID, &role) } u.Roles = rr return u }
go
func (u *sourceUserResponse) WithRoles(srcID int, roles []chronograf.Role) *sourceUserResponse { u.hasRoles = true rr := make([]sourceRoleResponse, len(roles)) for i, role := range roles { rr[i] = newSourceRoleResponse(srcID, &role) } u.Roles = rr return u }
[ "func", "(", "u", "*", "sourceUserResponse", ")", "WithRoles", "(", "srcID", "int", ",", "roles", "[", "]", "chronograf", ".", "Role", ")", "*", "sourceUserResponse", "{", "u", ".", "hasRoles", "=", "true", "\n", "rr", ":=", "make", "(", "[", "]", "s...
// WithRoles adds roles to the HTTP JSON response for a user
[ "WithRoles", "adds", "roles", "to", "the", "HTTP", "JSON", "response", "for", "a", "user" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L768-L776
124,523
influxdata/influxdb
chronograf/server/sources.go
NewSourceRole
func (s *Service) NewSourceRole(w http.ResponseWriter, r *http.Request) { var req sourceRoleRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidCreate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() srcID, t...
go
func (s *Service) NewSourceRole(w http.ResponseWriter, r *http.Request) { var req sourceRoleRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidCreate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() srcID, t...
[ "func", "(", "s", "*", "Service", ")", "NewSourceRole", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "req", "sourceRoleRequest", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", "B...
// NewSourceRole adds role to source
[ "NewSourceRole", "adds", "role", "to", "source" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L792-L830
124,524
influxdata/influxdb
chronograf/server/sources.go
UpdateSourceRole
func (s *Service) UpdateSourceRole(w http.ResponseWriter, r *http.Request) { var req sourceRoleRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidUpdate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() srcID,...
go
func (s *Service) UpdateSourceRole(w http.ResponseWriter, r *http.Request) { var req sourceRoleRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } if err := req.ValidUpdate(); err != nil { invalidData(w, err, s.Logger) return } ctx := r.Context() srcID,...
[ "func", "(", "s", "*", "Service", ")", "UpdateSourceRole", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "req", "sourceRoleRequest", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", ...
// UpdateSourceRole changes the permissions or users of a role
[ "UpdateSourceRole", "changes", "the", "permissions", "or", "users", "of", "a", "role" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L833-L872
124,525
influxdata/influxdb
chronograf/server/sources.go
SourceRoleID
func (s *Service) SourceRoleID(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } roles, ok := s.hasRoles(ctx, ts) if !ok { Error(w, http.StatusNotFound, fmt.Sprintf("Source %d does not have role capability", srcID), s.Logger) ...
go
func (s *Service) SourceRoleID(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } roles, ok := s.hasRoles(ctx, ts) if !ok { Error(w, http.StatusNotFound, fmt.Sprintf("Source %d does not have role capability", srcID), s.Logger) ...
[ "func", "(", "s", "*", "Service", ")", "SourceRoleID", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "srcID", ",", "ts", ",", "err", ":=", "s", ".", "...
// SourceRoleID retrieves a role with ID from store.
[ "SourceRoleID", "retrieves", "a", "role", "with", "ID", "from", "store", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L875-L896
124,526
influxdata/influxdb
chronograf/server/sources.go
SourceRoles
func (s *Service) SourceRoles(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } store, ok := s.hasRoles(ctx, ts) if !ok { Error(w, http.StatusNotFound, fmt.Sprintf("Source %d does not have role capability", srcID), s.Logger) r...
go
func (s *Service) SourceRoles(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } store, ok := s.hasRoles(ctx, ts) if !ok { Error(w, http.StatusNotFound, fmt.Sprintf("Source %d does not have role capability", srcID), s.Logger) r...
[ "func", "(", "s", "*", "Service", ")", "SourceRoles", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "srcID", ",", "ts", ",", "err", ":=", "s", ".", "s...
// SourceRoles retrieves all roles from the store
[ "SourceRoles", "retrieves", "all", "roles", "from", "the", "store" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L899-L927
124,527
influxdata/influxdb
chronograf/server/sources.go
RemoveSourceRole
func (s *Service) RemoveSourceRole(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } roles, ok := s.hasRoles(ctx, ts) if !ok { Error(w, http.StatusNotFound, fmt.Sprintf("Source %d does not have role capability", srcID), s.Logger...
go
func (s *Service) RemoveSourceRole(w http.ResponseWriter, r *http.Request) { ctx := r.Context() srcID, ts, err := s.sourcesSeries(ctx, w, r) if err != nil { return } roles, ok := s.hasRoles(ctx, ts) if !ok { Error(w, http.StatusNotFound, fmt.Sprintf("Source %d does not have role capability", srcID), s.Logger...
[ "func", "(", "s", "*", "Service", ")", "RemoveSourceRole", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ctx", ":=", "r", ".", "Context", "(", ")", "\n", "srcID", ",", "ts", ",", "err", ":=", "s", ".",...
// RemoveSourceRole removes role from data source.
[ "RemoveSourceRole", "removes", "role", "from", "data", "source", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/sources.go#L930-L949
124,528
influxdata/influxdb
prometheus/influx.go
NewInfluxCollector
func NewInfluxCollector(procID platform.IDGenerator, build platform.BuildInfo) prometheus.Collector { id := procID.ID().String() return &influxCollector{ influxInfoDesc: prometheus.NewDesc( "influxdb_info", "Information about the influxdb environment.", nil, prometheus.Labels{ "version": build.Vers...
go
func NewInfluxCollector(procID platform.IDGenerator, build platform.BuildInfo) prometheus.Collector { id := procID.ID().String() return &influxCollector{ influxInfoDesc: prometheus.NewDesc( "influxdb_info", "Information about the influxdb environment.", nil, prometheus.Labels{ "version": build.Vers...
[ "func", "NewInfluxCollector", "(", "procID", "platform", ".", "IDGenerator", ",", "build", "platform", ".", "BuildInfo", ")", "prometheus", ".", "Collector", "{", "id", ":=", "procID", ".", "ID", "(", ")", ".", "String", "(", ")", "\n\n", "return", "&", ...
// NewInfluxCollector returns a collector which exports influxdb process metrics.
[ "NewInfluxCollector", "returns", "a", "collector", "which", "exports", "influxdb", "process", "metrics", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/influx.go#L19-L44
124,529
influxdata/influxdb
chronograf/multistore/layouts.go
Add
func (s *Layouts) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) { var err error for _, store := range s.Stores { var l chronograf.Layout l, err = store.Add(ctx, layout) if err == nil { return l, nil } } return chronograf.Layout{}, err }
go
func (s *Layouts) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) { var err error for _, store := range s.Stores { var l chronograf.Layout l, err = store.Add(ctx, layout) if err == nil { return l, nil } } return chronograf.Layout{}, err }
[ "func", "(", "s", "*", "Layouts", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "layout", "chronograf", ".", "Layout", ")", "(", "chronograf", ".", "Layout", ",", "error", ")", "{", "var", "err", "error", "\n", "for", "_", ",", "store", "...
// Add creates a new dashboard in the LayoutsStore. Tries each store sequentially until success.
[ "Add", "creates", "a", "new", "dashboard", "in", "the", "LayoutsStore", ".", "Tries", "each", "store", "sequentially", "until", "success", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/layouts.go#L46-L56
124,530
influxdata/influxdb
chronograf/multistore/layouts.go
Get
func (s *Layouts) Get(ctx context.Context, ID string) (chronograf.Layout, error) { var err error for _, store := range s.Stores { var l chronograf.Layout l, err = store.Get(ctx, ID) if err == nil { return l, nil } } return chronograf.Layout{}, err }
go
func (s *Layouts) Get(ctx context.Context, ID string) (chronograf.Layout, error) { var err error for _, store := range s.Stores { var l chronograf.Layout l, err = store.Get(ctx, ID) if err == nil { return l, nil } } return chronograf.Layout{}, err }
[ "func", "(", "s", "*", "Layouts", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "ID", "string", ")", "(", "chronograf", ".", "Layout", ",", "error", ")", "{", "var", "err", "error", "\n", "for", "_", ",", "store", ":=", "range", "s", "....
// Get retrieves Layout if `ID` exists. Searches through each store sequentially until success.
[ "Get", "retrieves", "Layout", "if", "ID", "exists", ".", "Searches", "through", "each", "store", "sequentially", "until", "success", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/layouts.go#L72-L82
124,531
influxdata/influxdb
chronograf/multistore/layouts.go
Update
func (s *Layouts) Update(ctx context.Context, layout chronograf.Layout) error { var err error for _, store := range s.Stores { err = store.Update(ctx, layout) if err == nil { return nil } } return err }
go
func (s *Layouts) Update(ctx context.Context, layout chronograf.Layout) error { var err error for _, store := range s.Stores { err = store.Update(ctx, layout) if err == nil { return nil } } return err }
[ "func", "(", "s", "*", "Layouts", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "layout", "chronograf", ".", "Layout", ")", "error", "{", "var", "err", "error", "\n", "for", "_", ",", "store", ":=", "range", "s", ".", "Stores", "{", "e...
// Update the dashboard in the store. Searches through each store sequentially until success.
[ "Update", "the", "dashboard", "in", "the", "store", ".", "Searches", "through", "each", "store", "sequentially", "until", "success", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/layouts.go#L85-L94
124,532
influxdata/influxdb
storage/readservice/service.go
AddControllerConfigDependencies
func AddControllerConfigDependencies( cc *control.Config, engine *storage.Engine, bucketSvc platform.BucketService, orgSvc platform.OrganizationService, ) error { bucketLookupSvc := query.FromBucketService(bucketSvc) orgLookupSvc := query.FromOrganizationService(orgSvc) err := influxdb.InjectFromDependencies(cc....
go
func AddControllerConfigDependencies( cc *control.Config, engine *storage.Engine, bucketSvc platform.BucketService, orgSvc platform.OrganizationService, ) error { bucketLookupSvc := query.FromBucketService(bucketSvc) orgLookupSvc := query.FromOrganizationService(orgSvc) err := influxdb.InjectFromDependencies(cc....
[ "func", "AddControllerConfigDependencies", "(", "cc", "*", "control", ".", "Config", ",", "engine", "*", "storage", ".", "Engine", ",", "bucketSvc", "platform", ".", "BucketService", ",", "orgSvc", "platform", ".", "OrganizationService", ",", ")", "error", "{", ...
// AddControllerConfigDependencies sets up the dependencies on cc // such that "from" and "to" flux functions will work correctly.
[ "AddControllerConfigDependencies", "sets", "up", "the", "dependencies", "on", "cc", "such", "that", "from", "and", "to", "flux", "functions", "will", "work", "correctly", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/readservice/service.go#L23-L49
124,533
influxdata/influxdb
flux/client.go
Ping
func (c *Client) Ping(ctx context.Context) error { t := 2 * time.Second if c.Timeout > 0 { t = c.Timeout } ctx, cancel := context.WithTimeout(ctx, t) defer cancel() err := c.pingTimeout(ctx) return err }
go
func (c *Client) Ping(ctx context.Context) error { t := 2 * time.Second if c.Timeout > 0 { t = c.Timeout } ctx, cancel := context.WithTimeout(ctx, t) defer cancel() err := c.pingTimeout(ctx) return err }
[ "func", "(", "c", "*", "Client", ")", "Ping", "(", "ctx", "context", ".", "Context", ")", "error", "{", "t", ":=", "2", "*", "time", ".", "Second", "\n", "if", "c", ".", "Timeout", ">", "0", "{", "t", "=", "c", ".", "Timeout", "\n", "}", "\n"...
// Ping checks the connection of a Flux.
[ "Ping", "checks", "the", "connection", "of", "a", "Flux", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/flux/client.go#L31-L40
124,534
influxdata/influxdb
internal/fs/influx_dir.go
InfluxDir
func InfluxDir() (string, error) { var dir string // By default, store meta and data files in current users home directory u, err := user.Current() if err == nil { dir = u.HomeDir } else if home := os.Getenv("HOME"); home != "" { dir = home } else { wd, err := os.Getwd() if err != nil { return "", err ...
go
func InfluxDir() (string, error) { var dir string // By default, store meta and data files in current users home directory u, err := user.Current() if err == nil { dir = u.HomeDir } else if home := os.Getenv("HOME"); home != "" { dir = home } else { wd, err := os.Getwd() if err != nil { return "", err ...
[ "func", "InfluxDir", "(", ")", "(", "string", ",", "error", ")", "{", "var", "dir", "string", "\n", "// By default, store meta and data files in current users home directory", "u", ",", "err", ":=", "user", ".", "Current", "(", ")", "\n", "if", "err", "==", "n...
// InfluxDir retrieves the influxdbv2 directory.
[ "InfluxDir", "retrieves", "the", "influxdbv2", "directory", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/internal/fs/influx_dir.go#L12-L30
124,535
influxdata/influxdb
internal/fs/influx_dir.go
BoltFile
func BoltFile() (string, error) { dir, err := InfluxDir() if err != nil { return "", err } var file string filepath.Walk(dir, func(p string, info os.FileInfo, err error) error { if err != nil { return err } if file != "" { return fmt.Errorf("bolt file found") } if strings.Contains(p, ".bolt") { ...
go
func BoltFile() (string, error) { dir, err := InfluxDir() if err != nil { return "", err } var file string filepath.Walk(dir, func(p string, info os.FileInfo, err error) error { if err != nil { return err } if file != "" { return fmt.Errorf("bolt file found") } if strings.Contains(p, ".bolt") { ...
[ "func", "BoltFile", "(", ")", "(", "string", ",", "error", ")", "{", "dir", ",", "err", ":=", "InfluxDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "var", "file", "string", "\n", "filepath"...
// BoltFile returns the path to the bolt file for influxdb
[ "BoltFile", "returns", "the", "path", "to", "the", "bolt", "file", "for", "influxdb" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/internal/fs/influx_dir.go#L33-L59
124,536
influxdata/influxdb
kv/bucket.go
CreateBucket
func (s *Service) CreateBucket(ctx context.Context, b *influxdb.Bucket) error { span, ctx := tracing.StartSpanFromContext(ctx) defer span.Finish() return s.kv.Update(ctx, func(tx Tx) error { return s.createBucket(ctx, tx, b) }) }
go
func (s *Service) CreateBucket(ctx context.Context, b *influxdb.Bucket) error { span, ctx := tracing.StartSpanFromContext(ctx) defer span.Finish() return s.kv.Update(ctx, func(tx Tx) error { return s.createBucket(ctx, tx, b) }) }
[ "func", "(", "s", "*", "Service", ")", "CreateBucket", "(", "ctx", "context", ".", "Context", ",", "b", "*", "influxdb", ".", "Bucket", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "ctx", ")", "\n", "defer",...
// CreateBucket creates a influxdb bucket and sets b.ID.
[ "CreateBucket", "creates", "a", "influxdb", "bucket", "and", "sets", "b", ".", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/bucket.go#L357-L364
124,537
influxdata/influxdb
kv/bucket.go
bucketIndexKey
func bucketIndexKey(b *influxdb.Bucket) ([]byte, error) { orgID, err := b.OrgID.Encode() if err != nil { return nil, &influxdb.Error{ Code: influxdb.EInvalid, Err: err, } } k := make([]byte, influxdb.IDLength+len(b.Name)) copy(k, orgID) copy(k[influxdb.IDLength:], []byte(b.Name)) return k, nil }
go
func bucketIndexKey(b *influxdb.Bucket) ([]byte, error) { orgID, err := b.OrgID.Encode() if err != nil { return nil, &influxdb.Error{ Code: influxdb.EInvalid, Err: err, } } k := make([]byte, influxdb.IDLength+len(b.Name)) copy(k, orgID) copy(k[influxdb.IDLength:], []byte(b.Name)) return k, nil }
[ "func", "bucketIndexKey", "(", "b", "*", "influxdb", ".", "Bucket", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "orgID", ",", "err", ":=", "b", ".", "OrgID", ".", "Encode", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// bucketIndexKey is a combination of the orgID and the bucket name.
[ "bucketIndexKey", "is", "a", "combination", "of", "the", "orgID", "and", "the", "bucket", "name", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/bucket.go#L488-L500
124,538
influxdata/influxdb
kv/bucket.go
GetBucketOperationLog
func (s *Service) GetBucketOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error) { // TODO(desa): might be worthwhile to allocate a slice of size opts.Limit log := []*influxdb.OperationLogEntry{} err := s.kv.View(ctx, func(tx Tx) error { key, err ...
go
func (s *Service) GetBucketOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error) { // TODO(desa): might be worthwhile to allocate a slice of size opts.Limit log := []*influxdb.OperationLogEntry{} err := s.kv.View(ctx, func(tx Tx) error { key, err ...
[ "func", "(", "s", "*", "Service", ")", "GetBucketOperationLog", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ",", "opts", "influxdb", ".", "FindOptions", ")", "(", "[", "]", "*", "influxdb", ".", "OperationLogEntry", ",", "int...
// GetBucketOperationLog retrieves a buckets operation log.
[ "GetBucketOperationLog", "retrieves", "a", "buckets", "operation", "log", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/bucket.go#L703-L731
124,539
influxdata/influxdb
kv/bucket.go
BucketAlreadyExistsError
func BucketAlreadyExistsError(b *influxdb.Bucket) error { return &influxdb.Error{ Code: influxdb.EConflict, Op: "kv/bucket", Msg: fmt.Sprintf("bucket with name %s already exists", b.Name), } }
go
func BucketAlreadyExistsError(b *influxdb.Bucket) error { return &influxdb.Error{ Code: influxdb.EConflict, Op: "kv/bucket", Msg: fmt.Sprintf("bucket with name %s already exists", b.Name), } }
[ "func", "BucketAlreadyExistsError", "(", "b", "*", "influxdb", ".", "Bucket", ")", "error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EConflict", ",", "Op", ":", "\"", "\"", ",", "Msg", ":", "fmt", ".", "Sprintf"...
// BucketAlreadyExistsError is used when creating a bucket with a name // that already exists within an organization.
[ "BucketAlreadyExistsError", "is", "used", "when", "creating", "a", "bucket", "with", "a", "name", "that", "already", "exists", "within", "an", "organization", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/bucket.go#L785-L791
124,540
influxdata/influxdb
http/auth_service.go
NewAuthorizationBackend
func NewAuthorizationBackend(b *APIBackend) *AuthorizationBackend { return &AuthorizationBackend{ Logger: b.Logger.With(zap.String("handler", "authorization")), AuthorizationService: b.AuthorizationService, OrganizationService: b.OrganizationService, UserService: b.UserService, LookupService: ...
go
func NewAuthorizationBackend(b *APIBackend) *AuthorizationBackend { return &AuthorizationBackend{ Logger: b.Logger.With(zap.String("handler", "authorization")), AuthorizationService: b.AuthorizationService, OrganizationService: b.OrganizationService, UserService: b.UserService, LookupService: ...
[ "func", "NewAuthorizationBackend", "(", "b", "*", "APIBackend", ")", "*", "AuthorizationBackend", "{", "return", "&", "AuthorizationBackend", "{", "Logger", ":", "b", ".", "Logger", ".", "With", "(", "zap", ".", "String", "(", "\"", "\"", ",", "\"", "\"", ...
// NewAuthorizationBackend returns a new instance of AuthorizationBackend.
[ "NewAuthorizationBackend", "returns", "a", "new", "instance", "of", "AuthorizationBackend", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/auth_service.go#L31-L40
124,541
influxdata/influxdb
http/auth_service.go
FindAuthorizationByID
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error) { u, err := newURL(s.Addr, authorizationIDPath(id)) if err != nil { return nil, err } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { return nil, err } SetToken(s.To...
go
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error) { u, err := newURL(s.Addr, authorizationIDPath(id)) if err != nil { return nil, err } req, err := http.NewRequest("GET", u.String(), nil) if err != nil { return nil, err } SetToken(s.To...
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizationByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "Authorization", ",", "error", ")", "{", "u", ",", "err", ":=", "newURL"...
// FindAuthorizationByID finds the authorization against a remote influx server.
[ "FindAuthorizationByID", "finds", "the", "authorization", "against", "a", "remote", "influx", "server", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/auth_service.go#L619-L648
124,542
influxdata/influxdb
http/auth_service.go
FindAuthorizationByToken
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, token string) (*platform.Authorization, error) { return nil, errors.New("not supported in HTTP authorization service") }
go
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, token string) (*platform.Authorization, error) { return nil, errors.New("not supported in HTTP authorization service") }
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizationByToken", "(", "ctx", "context", ".", "Context", ",", "token", "string", ")", "(", "*", "platform", ".", "Authorization", ",", "error", ")", "{", "return", "nil", ",", "errors", ".", "Ne...
// FindAuthorizationByToken returns a single authorization by Token.
[ "FindAuthorizationByToken", "returns", "a", "single", "authorization", "by", "Token", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/auth_service.go#L651-L653
124,543
influxdata/influxdb
http/auth_service.go
FindAuthorizations
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) ([]*platform.Authorization, int, error) { u, err := newURL(s.Addr, authorizationPath) if err != nil { return nil, 0, err } query := u.Query() req, err := http.NewRequest("GET...
go
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) ([]*platform.Authorization, int, error) { u, err := newURL(s.Addr, authorizationPath) if err != nil { return nil, 0, err } query := u.Query() req, err := http.NewRequest("GET...
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizations", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "AuthorizationFilter", ",", "opt", "...", "platform", ".", "FindOptions", ")", "(", "[", "]", "*", "platform", "....
// FindAuthorizations returns a list of authorizations that match filter and the total count of matching authorizations. // Additional options provide pagination & sorting.
[ "FindAuthorizations", "returns", "a", "list", "of", "authorizations", "that", "match", "filter", "and", "the", "total", "count", "of", "matching", "authorizations", ".", "Additional", "options", "provide", "pagination", "&", "sorting", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/auth_service.go#L657-L715
124,544
influxdata/influxdb
http/handler.go
PrometheusCollectors
func (h *Handler) PrometheusCollectors() []prometheus.Collector { return []prometheus.Collector{ h.requests, h.requestDur, } }
go
func (h *Handler) PrometheusCollectors() []prometheus.Collector { return []prometheus.Collector{ h.requests, h.requestDur, } }
[ "func", "(", "h", "*", "Handler", ")", "PrometheusCollectors", "(", ")", "[", "]", "prometheus", ".", "Collector", "{", "return", "[", "]", "prometheus", ".", "Collector", "{", "h", ".", "requests", ",", "h", ".", "requestDur", ",", "}", "\n", "}" ]
// PrometheusCollectors satisifies prom.PrometheusCollector.
[ "PrometheusCollectors", "satisifies", "prom", ".", "PrometheusCollector", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/handler.go#L156-L161
124,545
influxdata/influxdb
query/preauthorizer.go
RequiredPermissions
func (a *preAuthorizer) RequiredPermissions(ctx context.Context, ast *ast.Package, orgID *platform.ID) ([]platform.Permission, error) { readBuckets, writeBuckets, err := BucketsAccessed(ast, orgID) if err != nil { return nil, errors.Wrap(err, "could not retrieve buckets for query.Spec") } ps := make([]platform.P...
go
func (a *preAuthorizer) RequiredPermissions(ctx context.Context, ast *ast.Package, orgID *platform.ID) ([]platform.Permission, error) { readBuckets, writeBuckets, err := BucketsAccessed(ast, orgID) if err != nil { return nil, errors.Wrap(err, "could not retrieve buckets for query.Spec") } ps := make([]platform.P...
[ "func", "(", "a", "*", "preAuthorizer", ")", "RequiredPermissions", "(", "ctx", "context", ".", "Context", ",", "ast", "*", "ast", ".", "Package", ",", "orgID", "*", "platform", ".", "ID", ")", "(", "[", "]", "platform", ".", "Permission", ",", "error"...
// RequiredPermissions returns a slice of permissions required for the query contained in spec. // This method also validates that the buckets exist.
[ "RequiredPermissions", "returns", "a", "slice", "of", "permissions", "required", "for", "the", "query", "contained", "in", "spec", ".", "This", "method", "also", "validates", "that", "the", "buckets", "exist", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/preauthorizer.go#L77-L116
124,546
influxdata/influxdb
tsdb/cursors/cursor.go
Stats
func (a CursorIterators) Stats() CursorStats { var stats CursorStats for _, itr := range a { stats.Add(itr.Stats()) } return stats }
go
func (a CursorIterators) Stats() CursorStats { var stats CursorStats for _, itr := range a { stats.Add(itr.Stats()) } return stats }
[ "func", "(", "a", "CursorIterators", ")", "Stats", "(", ")", "CursorStats", "{", "var", "stats", "CursorStats", "\n", "for", "_", ",", "itr", ":=", "range", "a", "{", "stats", ".", "Add", "(", "itr", ".", "Stats", "(", ")", ")", "\n", "}", "\n", ...
// Stats returns the aggregate stats of all cursor iterators.
[ "Stats", "returns", "the", "aggregate", "stats", "of", "all", "cursor", "iterators", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/cursors/cursor.go#L59-L65
124,547
influxdata/influxdb
tsdb/cursors/cursor.go
Add
func (s *CursorStats) Add(other CursorStats) { s.ScannedValues += other.ScannedValues s.ScannedBytes += other.ScannedBytes }
go
func (s *CursorStats) Add(other CursorStats) { s.ScannedValues += other.ScannedValues s.ScannedBytes += other.ScannedBytes }
[ "func", "(", "s", "*", "CursorStats", ")", "Add", "(", "other", "CursorStats", ")", "{", "s", ".", "ScannedValues", "+=", "other", ".", "ScannedValues", "\n", "s", ".", "ScannedBytes", "+=", "other", ".", "ScannedBytes", "\n", "}" ]
// Add adds other to s and updates s.
[ "Add", "adds", "other", "to", "s", "and", "updates", "s", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/cursors/cursor.go#L74-L77
124,548
influxdata/influxdb
chronograf/dist/dist.go
Handler
func (d *DebugAssets) Handler() http.Handler { return http.FileServer(NewDir(d.Dir, d.Default)) }
go
func (d *DebugAssets) Handler() http.Handler { return http.FileServer(NewDir(d.Dir, d.Default)) }
[ "func", "(", "d", "*", "DebugAssets", ")", "Handler", "(", ")", "http", ".", "Handler", "{", "return", "http", ".", "FileServer", "(", "NewDir", "(", "d", ".", "Dir", ",", "d", ".", "Default", ")", ")", "\n", "}" ]
// Handler is an http.FileServer for the Dir
[ "Handler", "is", "an", "http", ".", "FileServer", "for", "the", "Dir" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/dist/dist.go#L19-L21
124,549
influxdata/influxdb
chronograf/dist/dist.go
addCacheHeaders
func (b *BindataAssets) addCacheHeaders(filename string, w http.ResponseWriter) error { w.Header().Add("Cache-Control", "public, max-age=3600") fi, err := AssetInfo(filename) if err != nil { return err } hour, minute, second := fi.ModTime().Clock() etag := fmt.Sprintf(`"%d%d%d%d%d"`, fi.Size(), fi.ModTime().Da...
go
func (b *BindataAssets) addCacheHeaders(filename string, w http.ResponseWriter) error { w.Header().Add("Cache-Control", "public, max-age=3600") fi, err := AssetInfo(filename) if err != nil { return err } hour, minute, second := fi.ModTime().Clock() etag := fmt.Sprintf(`"%d%d%d%d%d"`, fi.Size(), fi.ModTime().Da...
[ "func", "(", "b", "*", "BindataAssets", ")", "addCacheHeaders", "(", "filename", "string", ",", "w", "http", ".", "ResponseWriter", ")", "error", "{", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "fi", ",",...
// addCacheHeaders requests an hour of Cache-Control and sets an ETag based on file size and modtime
[ "addCacheHeaders", "requests", "an", "hour", "of", "Cache", "-", "Control", "and", "sets", "an", "ETag", "based", "on", "file", "size", "and", "modtime" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/dist/dist.go#L37-L49
124,550
influxdata/influxdb
chronograf/dist/dist.go
ServeHTTP
func (b *BindataAssets) ServeHTTP(w http.ResponseWriter, r *http.Request) { // def wraps the assets to return the default file if the file doesn't exist def := func(name string) ([]byte, error) { // If the named asset exists, then return it directly. octets, err := Asset(name) if err != nil { // If this is a...
go
func (b *BindataAssets) ServeHTTP(w http.ResponseWriter, r *http.Request) { // def wraps the assets to return the default file if the file doesn't exist def := func(name string) ([]byte, error) { // If the named asset exists, then return it directly. octets, err := Asset(name) if err != nil { // If this is a...
[ "func", "(", "b", "*", "BindataAssets", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// def wraps the assets to return the default file if the file doesn't exist", "def", ":=", "func", "(", "name", "s...
// ServeHTTP wraps http.FileServer by returning a default asset if the asset // doesn't exist. This supports single-page react-apps with its own // built-in router. Additionally, we override the content-type if the // Default file is used.
[ "ServeHTTP", "wraps", "http", ".", "FileServer", "by", "returning", "a", "default", "asset", "if", "the", "asset", "doesn", "t", "exist", ".", "This", "supports", "single", "-", "page", "react", "-", "apps", "with", "its", "own", "built", "-", "in", "rou...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/dist/dist.go#L55-L88
124,551
influxdata/influxdb
chronograf/organizations/users.go
NewUsersStore
func NewUsersStore(s chronograf.UsersStore, org string) *UsersStore { return &UsersStore{ store: s, organization: org, } }
go
func NewUsersStore(s chronograf.UsersStore, org string) *UsersStore { return &UsersStore{ store: s, organization: org, } }
[ "func", "NewUsersStore", "(", "s", "chronograf", ".", "UsersStore", ",", "org", "string", ")", "*", "UsersStore", "{", "return", "&", "UsersStore", "{", "store", ":", "s", ",", "organization", ":", "org", ",", "}", "\n", "}" ]
// NewUsersStore creates a new UsersStore from an existing // chronograf.UserStore and an organization string
[ "NewUsersStore", "creates", "a", "new", "UsersStore", "from", "an", "existing", "chronograf", ".", "UserStore", "and", "an", "organization", "string" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L28-L33
124,552
influxdata/influxdb
chronograf/organizations/users.go
validOrganizationRoles
func validOrganizationRoles(orgID string, u *chronograf.User) error { if u == nil || u.Roles == nil { return nil } for _, r := range u.Roles { if r.Organization == "" { return fmt.Errorf("user role must have an Organization") } if r.Organization != orgID { return fmt.Errorf("organizationID %s does not ...
go
func validOrganizationRoles(orgID string, u *chronograf.User) error { if u == nil || u.Roles == nil { return nil } for _, r := range u.Roles { if r.Organization == "" { return fmt.Errorf("user role must have an Organization") } if r.Organization != orgID { return fmt.Errorf("organizationID %s does not ...
[ "func", "validOrganizationRoles", "(", "orgID", "string", ",", "u", "*", "chronograf", ".", "User", ")", "error", "{", "if", "u", "==", "nil", "||", "u", ".", "Roles", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "for", "_", ",", "r", ":=", ...
// validOrganizationRoles ensures that each User Role has both an associated Organization and a Name
[ "validOrganizationRoles", "ensures", "that", "each", "User", "Role", "has", "both", "an", "associated", "Organization", "and", "a", "Name" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L36-L52
124,553
influxdata/influxdb
chronograf/organizations/users.go
Get
func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { err := validOrganization(ctx) if err != nil { return nil, err } usr, err := s.store.Get(ctx, q) if err != nil { return nil, err } // This filters a users roles so that the resulting struct only contains roles ...
go
func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { err := validOrganization(ctx) if err != nil { return nil, err } usr, err := s.store.Get(ctx, q) if err != nil { return nil, err } // This filters a users roles so that the resulting struct only contains roles ...
[ "func", "(", "s", "*", "UsersStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "q", "chronograf", ".", "UserQuery", ")", "(", "*", "chronograf", ".", "User", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n...
// Get searches the UsersStore for using the query. // The roles returned on the user are filtered to only contain roles that are for the organization // specified on the organization store.
[ "Get", "searches", "the", "UsersStore", "for", "using", "the", "query", ".", "The", "roles", "returned", "on", "the", "user", "are", "filtered", "to", "only", "contain", "roles", "that", "are", "for", "the", "organization", "specified", "on", "the", "organiz...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L57-L85
124,554
influxdata/influxdb
chronograf/organizations/users.go
Add
func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) { err := validOrganization(ctx) if err != nil { return nil, err } // Validates that the users roles are only for the current organization. if err := validOrganizationRoles(s.organization, u); err != nil { return nil, e...
go
func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) { err := validOrganization(ctx) if err != nil { return nil, err } // Validates that the users roles are only for the current organization. if err := validOrganizationRoles(s.organization, u); err != nil { return nil, e...
[ "func", "(", "s", "*", "UsersStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "u", "*", "chronograf", ".", "User", ")", "(", "*", "chronograf", ".", "User", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "...
// Add creates a new User in the UsersStore. It validates that the user provided only // has roles for the organization set on the UsersStore. // If a user is not found in the underlying, it calls the underlying UsersStore Add method. // If a user is found, it removes any existing roles a user has for an organization a...
[ "Add", "creates", "a", "new", "User", "in", "the", "UsersStore", ".", "It", "validates", "that", "the", "user", "provided", "only", "has", "roles", "for", "the", "organization", "set", "on", "the", "UsersStore", ".", "If", "a", "user", "is", "not", "foun...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L92-L167
124,555
influxdata/influxdb
chronograf/organizations/users.go
Delete
func (s *UsersStore) Delete(ctx context.Context, usr *chronograf.User) error { err := validOrganization(ctx) if err != nil { return err } // retrieve the user from the underlying store u, err := s.store.Get(ctx, chronograf.UserQuery{ID: &usr.ID}) if err != nil { return err } // Filter the retrieved users ...
go
func (s *UsersStore) Delete(ctx context.Context, usr *chronograf.User) error { err := validOrganization(ctx) if err != nil { return err } // retrieve the user from the underlying store u, err := s.store.Get(ctx, chronograf.UserQuery{ID: &usr.ID}) if err != nil { return err } // Filter the retrieved users ...
[ "func", "(", "s", "*", "UsersStore", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "usr", "*", "chronograf", ".", "User", ")", "error", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// Delete a user from the UsersStore. This is done by stripping a user of // any roles it has in the organization speicified on the UsersStore.
[ "Delete", "a", "user", "from", "the", "UsersStore", ".", "This", "is", "done", "by", "stripping", "a", "user", "of", "any", "roles", "it", "has", "in", "the", "organization", "speicified", "on", "the", "UsersStore", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L171-L193
124,556
influxdata/influxdb
chronograf/organizations/users.go
All
func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error) { err := validOrganization(ctx) if err != nil { return nil, err } // retrieve all users from the underlying UsersStore usrs, err := s.store.All(ctx) if err != nil { return nil, err } // Filter users to only contain users that have at...
go
func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error) { err := validOrganization(ctx) if err != nil { return nil, err } // retrieve all users from the underlying UsersStore usrs, err := s.store.All(ctx) if err != nil { return nil, err } // Filter users to only contain users that have at...
[ "func", "(", "s", "*", "UsersStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "User", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", ...
// All returns all users where roles have been filters to be exclusively for // the organization provided on the UsersStore.
[ "All", "returns", "all", "users", "where", "roles", "have", "been", "filters", "to", "be", "exclusively", "for", "the", "organization", "provided", "on", "the", "UsersStore", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L235-L267
124,557
influxdata/influxdb
chronograf/organizations/users.go
Num
func (s *UsersStore) Num(ctx context.Context) (int, error) { err := validOrganization(ctx) if err != nil { return 0, err } // retrieve all users from the underlying UsersStore usrs, err := s.All(ctx) if err != nil { return 0, err } return len(usrs), nil }
go
func (s *UsersStore) Num(ctx context.Context) (int, error) { err := validOrganization(ctx) if err != nil { return 0, err } // retrieve all users from the underlying UsersStore usrs, err := s.All(ctx) if err != nil { return 0, err } return len(usrs), nil }
[ "func", "(", "s", "*", "UsersStore", ")", "Num", "(", "ctx", "context", ".", "Context", ")", "(", "int", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\...
// Num returns the number of users in the UsersStore // This is unperformant, but should rarely be used.
[ "Num", "returns", "the", "number", "of", "users", "in", "the", "UsersStore", "This", "is", "unperformant", "but", "should", "rarely", "be", "used", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/users.go#L271-L284
124,558
influxdata/influxdb
chronograf/bolt/build.go
Get
func (s *BuildStore) Get(ctx context.Context) (chronograf.BuildInfo, error) { var build chronograf.BuildInfo if err := s.client.db.View(func(tx *bolt.Tx) error { var err error build, err = s.get(ctx, tx) if err != nil { return err } return nil }); err != nil { return chronograf.BuildInfo{}, err } r...
go
func (s *BuildStore) Get(ctx context.Context) (chronograf.BuildInfo, error) { var build chronograf.BuildInfo if err := s.client.db.View(func(tx *bolt.Tx) error { var err error build, err = s.get(ctx, tx) if err != nil { return err } return nil }); err != nil { return chronograf.BuildInfo{}, err } r...
[ "func", "(", "s", "*", "BuildStore", ")", "Get", "(", "ctx", "context", ".", "Context", ")", "(", "chronograf", ".", "BuildInfo", ",", "error", ")", "{", "var", "build", "chronograf", ".", "BuildInfo", "\n", "if", "err", ":=", "s", ".", "client", "."...
// Get retrieves Chronograf build information from the database
[ "Get", "retrieves", "Chronograf", "build", "information", "from", "the", "database" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/build.go#L26-L40
124,559
influxdata/influxdb
chronograf/bolt/build.go
Update
func (s *BuildStore) Update(ctx context.Context, build chronograf.BuildInfo) error { if err := s.client.db.Update(func(tx *bolt.Tx) error { return s.update(ctx, build, tx) }); err != nil { return err } return nil }
go
func (s *BuildStore) Update(ctx context.Context, build chronograf.BuildInfo) error { if err := s.client.db.Update(func(tx *bolt.Tx) error { return s.update(ctx, build, tx) }); err != nil { return err } return nil }
[ "func", "(", "s", "*", "BuildStore", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "build", "chronograf", ".", "BuildInfo", ")", "error", "{", "if", "err", ":=", "s", ".", "client", ".", "db", ".", "Update", "(", "func", "(", "tx", "*"...
// Update overwrites the current Chronograf build information in the database
[ "Update", "overwrites", "the", "current", "Chronograf", "build", "information", "in", "the", "database" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/build.go#L43-L51
124,560
influxdata/influxdb
chronograf/bolt/build.go
Migrate
func (s *BuildStore) Migrate(ctx context.Context, build chronograf.BuildInfo) error { return s.Update(ctx, build) }
go
func (s *BuildStore) Migrate(ctx context.Context, build chronograf.BuildInfo) error { return s.Update(ctx, build) }
[ "func", "(", "s", "*", "BuildStore", ")", "Migrate", "(", "ctx", "context", ".", "Context", ",", "build", "chronograf", ".", "BuildInfo", ")", "error", "{", "return", "s", ".", "Update", "(", "ctx", ",", "build", ")", "\n", "}" ]
// Migrate simply stores the current version in the database
[ "Migrate", "simply", "stores", "the", "current", "version", "in", "the", "database" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/build.go#L54-L56
124,561
influxdata/influxdb
chronograf/bolt/build.go
get
func (s *BuildStore) get(ctx context.Context, tx *bolt.Tx) (chronograf.BuildInfo, error) { var build chronograf.BuildInfo defaultBuild := chronograf.BuildInfo{ Version: "pre-1.4.0.0", Commit: "", } if bucket := tx.Bucket(BuildBucket); bucket == nil { return defaultBuild, nil } else if v := bucket.Get(Build...
go
func (s *BuildStore) get(ctx context.Context, tx *bolt.Tx) (chronograf.BuildInfo, error) { var build chronograf.BuildInfo defaultBuild := chronograf.BuildInfo{ Version: "pre-1.4.0.0", Commit: "", } if bucket := tx.Bucket(BuildBucket); bucket == nil { return defaultBuild, nil } else if v := bucket.Get(Build...
[ "func", "(", "s", "*", "BuildStore", ")", "get", "(", "ctx", "context", ".", "Context", ",", "tx", "*", "bolt", ".", "Tx", ")", "(", "chronograf", ".", "BuildInfo", ",", "error", ")", "{", "var", "build", "chronograf", ".", "BuildInfo", "\n", "defaul...
// get retrieves the current build, falling back to a default when missing
[ "get", "retrieves", "the", "current", "build", "falling", "back", "to", "a", "default", "when", "missing" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/build.go#L59-L74
124,562
influxdata/influxdb
chronograf/server/influx.go
ValidInfluxRequest
func ValidInfluxRequest(p chronograf.Query) error { if p.Command == "" { return fmt.Errorf("query field required") } return nil }
go
func ValidInfluxRequest(p chronograf.Query) error { if p.Command == "" { return fmt.Errorf("query field required") } return nil }
[ "func", "ValidInfluxRequest", "(", "p", "chronograf", ".", "Query", ")", "error", "{", "if", "p", ".", "Command", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ValidInfluxRequest checks if queries specify a command.
[ "ValidInfluxRequest", "checks", "if", "queries", "specify", "a", "command", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/influx.go#L18-L23
124,563
influxdata/influxdb
chronograf/server/influx.go
Influx
func (s *Service) Influx(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } var req chronograf.Query if err = json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } i...
go
func (s *Service) Influx(w http.ResponseWriter, r *http.Request) { id, err := paramID("id", r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger) return } var req chronograf.Query if err = json.NewDecoder(r.Body).Decode(&req); err != nil { invalidJSON(w, s.Logger) return } i...
[ "func", "(", "s", "*", "Service", ")", "Influx", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "id", ",", "err", ":=", "paramID", "(", "\"", "\"", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", ...
// Influx proxies requests to influxdb.
[ "Influx", "proxies", "requests", "to", "influxdb", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/influx.go#L30-L83
124,564
influxdata/influxdb
tsdb/tsm1/timestamp.go
NewTimeEncoder
func NewTimeEncoder(sz int) TimeEncoder { return &encoder{ ts: make([]uint64, 0, sz), enc: simple8b.NewEncoder(), } }
go
func NewTimeEncoder(sz int) TimeEncoder { return &encoder{ ts: make([]uint64, 0, sz), enc: simple8b.NewEncoder(), } }
[ "func", "NewTimeEncoder", "(", "sz", "int", ")", "TimeEncoder", "{", "return", "&", "encoder", "{", "ts", ":", "make", "(", "[", "]", "uint64", ",", "0", ",", "sz", ")", ",", "enc", ":", "simple8b", ".", "NewEncoder", "(", ")", ",", "}", "\n", "}...
// NewTimeEncoder returns a TimeEncoder with an initial buffer ready to hold sz bytes.
[ "NewTimeEncoder", "returns", "a", "TimeEncoder", "with", "an", "initial", "buffer", "ready", "to", "hold", "sz", "bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/timestamp.go#L66-L71
124,565
influxdata/influxdb
tsdb/tsm1/timestamp.go
Write
func (e *encoder) Write(t int64) { e.ts = append(e.ts, uint64(t)) }
go
func (e *encoder) Write(t int64) { e.ts = append(e.ts, uint64(t)) }
[ "func", "(", "e", "*", "encoder", ")", "Write", "(", "t", "int64", ")", "{", "e", ".", "ts", "=", "append", "(", "e", ".", "ts", ",", "uint64", "(", "t", ")", ")", "\n", "}" ]
// Write adds a timestamp to the compressed stream.
[ "Write", "adds", "a", "timestamp", "to", "the", "compressed", "stream", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/timestamp.go#L81-L83
124,566
influxdata/influxdb
tsdb/tsm1/timestamp.go
Bytes
func (e *encoder) Bytes() ([]byte, error) { if len(e.ts) == 0 { return e.bytes[:0], nil } // Maximum and largest common divisor. rle is true if dts (the delta timestamps), // are all the same. max, div, rle, dts := e.reduce() // The deltas are all the same, so we can run-length encode them if rle && len(e.t...
go
func (e *encoder) Bytes() ([]byte, error) { if len(e.ts) == 0 { return e.bytes[:0], nil } // Maximum and largest common divisor. rle is true if dts (the delta timestamps), // are all the same. max, div, rle, dts := e.reduce() // The deltas are all the same, so we can run-length encode them if rle && len(e.t...
[ "func", "(", "e", "*", "encoder", ")", "Bytes", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "len", "(", "e", ".", "ts", ")", "==", "0", "{", "return", "e", ".", "bytes", "[", ":", "0", "]", ",", "nil", "\n", "}", "\n\n"...
// Bytes returns the encoded bytes of all written times.
[ "Bytes", "returns", "the", "encoded", "bytes", "of", "all", "written", "times", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/timestamp.go#L119-L139
124,567
influxdata/influxdb
tsdb/tsm1/timestamp.go
Init
func (d *TimeDecoder) Init(b []byte) { d.v = 0 d.i = 0 d.ts = d.ts[:0] d.err = nil if len(b) > 0 { // Encoding type is stored in the 4 high bits of the first byte d.encoding = b[0] >> 4 } d.decode(b) }
go
func (d *TimeDecoder) Init(b []byte) { d.v = 0 d.i = 0 d.ts = d.ts[:0] d.err = nil if len(b) > 0 { // Encoding type is stored in the 4 high bits of the first byte d.encoding = b[0] >> 4 } d.decode(b) }
[ "func", "(", "d", "*", "TimeDecoder", ")", "Init", "(", "b", "[", "]", "byte", ")", "{", "d", ".", "v", "=", "0", "\n", "d", ".", "i", "=", "0", "\n", "d", ".", "ts", "=", "d", ".", "ts", "[", ":", "0", "]", "\n", "d", ".", "err", "="...
// Init initializes the decoder with bytes to read from.
[ "Init", "initializes", "the", "decoder", "with", "bytes", "to", "read", "from", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/timestamp.go#L233-L243
124,568
influxdata/influxdb
tsdb/tsm1/timestamp.go
Next
func (d *TimeDecoder) Next() bool { if d.err != nil { return false } if d.encoding == timeCompressedRLE { if d.i >= d.n { return false } d.i++ d.v += d.rleDelta return d.i < d.n } if d.i >= len(d.ts) { return false } d.v = int64(d.ts[d.i]) d.i++ return true }
go
func (d *TimeDecoder) Next() bool { if d.err != nil { return false } if d.encoding == timeCompressedRLE { if d.i >= d.n { return false } d.i++ d.v += d.rleDelta return d.i < d.n } if d.i >= len(d.ts) { return false } d.v = int64(d.ts[d.i]) d.i++ return true }
[ "func", "(", "d", "*", "TimeDecoder", ")", "Next", "(", ")", "bool", "{", "if", "d", ".", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "if", "d", ".", "encoding", "==", "timeCompressedRLE", "{", "if", "d", ".", "i", ">=", "d", ...
// Next returns true if there are any timestamps remaining to be decoded.
[ "Next", "returns", "true", "if", "there", "are", "any", "timestamps", "remaining", "to", "be", "decoded", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/timestamp.go#L246-L266
124,569
influxdata/influxdb
tsdb/tsm1/config.go
NewCacheConfig
func NewCacheConfig() CacheConfig { return CacheConfig{ MaxMemorySize: DefaultCacheMaxMemorySize, SnapshotMemorySize: DefaultCacheSnapshotMemorySize, SnapshotAgeDuration: DefaultCacheSnapshotAgeDuration, SnapshotWriteColdDuration: DefaultCacheSnapshotWriteColdDuration, } }
go
func NewCacheConfig() CacheConfig { return CacheConfig{ MaxMemorySize: DefaultCacheMaxMemorySize, SnapshotMemorySize: DefaultCacheSnapshotMemorySize, SnapshotAgeDuration: DefaultCacheSnapshotAgeDuration, SnapshotWriteColdDuration: DefaultCacheSnapshotWriteColdDuration, } }
[ "func", "NewCacheConfig", "(", ")", "CacheConfig", "{", "return", "CacheConfig", "{", "MaxMemorySize", ":", "DefaultCacheMaxMemorySize", ",", "SnapshotMemorySize", ":", "DefaultCacheSnapshotMemorySize", ",", "SnapshotAgeDuration", ":", "DefaultCacheSnapshotAgeDuration", ",", ...
// NewCacheConfig initialises a new CacheConfig with default values.
[ "NewCacheConfig", "initialises", "a", "new", "CacheConfig", "with", "default", "values", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/config.go#L119-L126
124,570
influxdata/influxdb
mock/org_service.go
NewOrganizationService
func NewOrganizationService() *OrganizationService { return &OrganizationService{ FindOrganizationByIDF: func(ctx context.Context, id platform.ID) (*platform.Organization, error) { return nil, nil }, FindOrganizationF: func(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error) { ...
go
func NewOrganizationService() *OrganizationService { return &OrganizationService{ FindOrganizationByIDF: func(ctx context.Context, id platform.ID) (*platform.Organization, error) { return nil, nil }, FindOrganizationF: func(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error) { ...
[ "func", "NewOrganizationService", "(", ")", "*", "OrganizationService", "{", "return", "&", "OrganizationService", "{", "FindOrganizationByIDF", ":", "func", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", "....
// NewOrganizationService returns a mock OrganizationService where its methods will return // zero values.
[ "NewOrganizationService", "returns", "a", "mock", "OrganizationService", "where", "its", "methods", "will", "return", "zero", "values", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L22-L37
124,571
influxdata/influxdb
mock/org_service.go
FindOrganizationByID
func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id platform.ID) (*platform.Organization, error) { return s.FindOrganizationByIDF(ctx, id) }
go
func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id platform.ID) (*platform.Organization, error) { return s.FindOrganizationByIDF(ctx, id) }
[ "func", "(", "s", "*", "OrganizationService", ")", "FindOrganizationByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "Organization", ",", "error", ")", "{", "return", "s", ".", "FindOrganizatio...
//FindOrganizationByID calls FindOrganizationByIDF.
[ "FindOrganizationByID", "calls", "FindOrganizationByIDF", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L40-L42
124,572
influxdata/influxdb
mock/org_service.go
FindOrganization
func (s *OrganizationService) FindOrganization(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error) { return s.FindOrganizationF(ctx, filter) }
go
func (s *OrganizationService) FindOrganization(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error) { return s.FindOrganizationF(ctx, filter) }
[ "func", "(", "s", "*", "OrganizationService", ")", "FindOrganization", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "OrganizationFilter", ")", "(", "*", "platform", ".", "Organization", ",", "error", ")", "{", "return", "s", ".", ...
//FindOrganization calls FindOrganizationF.
[ "FindOrganization", "calls", "FindOrganizationF", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L45-L47
124,573
influxdata/influxdb
mock/org_service.go
FindOrganizations
func (s *OrganizationService) FindOrganizations(ctx context.Context, filter platform.OrganizationFilter, opt ...platform.FindOptions) ([]*platform.Organization, int, error) { return s.FindOrganizationsF(ctx, filter, opt...) }
go
func (s *OrganizationService) FindOrganizations(ctx context.Context, filter platform.OrganizationFilter, opt ...platform.FindOptions) ([]*platform.Organization, int, error) { return s.FindOrganizationsF(ctx, filter, opt...) }
[ "func", "(", "s", "*", "OrganizationService", ")", "FindOrganizations", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "OrganizationFilter", ",", "opt", "...", "platform", ".", "FindOptions", ")", "(", "[", "]", "*", "platform", ".", ...
//FindOrganizations calls FindOrganizationsF.
[ "FindOrganizations", "calls", "FindOrganizationsF", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L50-L52
124,574
influxdata/influxdb
mock/org_service.go
CreateOrganization
func (s *OrganizationService) CreateOrganization(ctx context.Context, b *platform.Organization) error { return s.CreateOrganizationF(ctx, b) }
go
func (s *OrganizationService) CreateOrganization(ctx context.Context, b *platform.Organization) error { return s.CreateOrganizationF(ctx, b) }
[ "func", "(", "s", "*", "OrganizationService", ")", "CreateOrganization", "(", "ctx", "context", ".", "Context", ",", "b", "*", "platform", ".", "Organization", ")", "error", "{", "return", "s", ".", "CreateOrganizationF", "(", "ctx", ",", "b", ")", "\n", ...
// CreateOrganization calls CreateOrganizationF.
[ "CreateOrganization", "calls", "CreateOrganizationF", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L55-L57
124,575
influxdata/influxdb
mock/org_service.go
UpdateOrganization
func (s *OrganizationService) UpdateOrganization(ctx context.Context, id platform.ID, upd platform.OrganizationUpdate) (*platform.Organization, error) { return s.UpdateOrganizationF(ctx, id, upd) }
go
func (s *OrganizationService) UpdateOrganization(ctx context.Context, id platform.ID, upd platform.OrganizationUpdate) (*platform.Organization, error) { return s.UpdateOrganizationF(ctx, id, upd) }
[ "func", "(", "s", "*", "OrganizationService", ")", "UpdateOrganization", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "upd", "platform", ".", "OrganizationUpdate", ")", "(", "*", "platform", ".", "Organization", ",", "error",...
// UpdateOrganization calls UpdateOrganizationF.
[ "UpdateOrganization", "calls", "UpdateOrganizationF", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L60-L62
124,576
influxdata/influxdb
mock/org_service.go
DeleteOrganization
func (s *OrganizationService) DeleteOrganization(ctx context.Context, id platform.ID) error { return s.DeleteOrganizationF(ctx, id) }
go
func (s *OrganizationService) DeleteOrganization(ctx context.Context, id platform.ID) error { return s.DeleteOrganizationF(ctx, id) }
[ "func", "(", "s", "*", "OrganizationService", ")", "DeleteOrganization", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "error", "{", "return", "s", ".", "DeleteOrganizationF", "(", "ctx", ",", "id", ")", "\n", "}" ]
// DeleteOrganization calls DeleteOrganizationF.
[ "DeleteOrganization", "calls", "DeleteOrganizationF", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/org_service.go#L65-L67
124,577
influxdata/influxdb
kit/errors/errors.go
Errorf
func Errorf(ref int, format string, i ...interface{}) error { return Error{ Reference: ref, Err: fmt.Sprintf(format, i...), } }
go
func Errorf(ref int, format string, i ...interface{}) error { return Error{ Reference: ref, Err: fmt.Sprintf(format, i...), } }
[ "func", "Errorf", "(", "ref", "int", ",", "format", "string", ",", "i", "...", "interface", "{", "}", ")", "error", "{", "return", "Error", "{", "Reference", ":", "ref", ",", "Err", ":", "fmt", ".", "Sprintf", "(", "format", ",", "i", "...", ")", ...
// Errorf constructs an Error with the given reference code and format.
[ "Errorf", "constructs", "an", "Error", "with", "the", "given", "reference", "code", "and", "format", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/errors/errors.go#L36-L41
124,578
influxdata/influxdb
kit/errors/errors.go
New
func New(msg string, ref ...int) error { refCode := InternalError if len(ref) == 1 { refCode = ref[0] } return Error{ Reference: refCode, Err: msg, } }
go
func New(msg string, ref ...int) error { refCode := InternalError if len(ref) == 1 { refCode = ref[0] } return Error{ Reference: refCode, Err: msg, } }
[ "func", "New", "(", "msg", "string", ",", "ref", "...", "int", ")", "error", "{", "refCode", ":=", "InternalError", "\n", "if", "len", "(", "ref", ")", "==", "1", "{", "refCode", "=", "ref", "[", "0", "]", "\n", "}", "\n", "return", "Error", "{",...
// New creates a new error with a message and error code.
[ "New", "creates", "a", "new", "error", "with", "a", "message", "and", "error", "code", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/errors/errors.go#L44-L53
124,579
influxdata/influxdb
authorizer/user.go
FindUserByID
func (s *UserService) FindUserByID(ctx context.Context, id influxdb.ID) (*influxdb.User, error) { if err := authorizeReadUser(ctx, id); err != nil { return nil, err } return s.s.FindUserByID(ctx, id) }
go
func (s *UserService) FindUserByID(ctx context.Context, id influxdb.ID) (*influxdb.User, error) { if err := authorizeReadUser(ctx, id); err != nil { return nil, err } return s.s.FindUserByID(ctx, id) }
[ "func", "(", "s", "*", "UserService", ")", "FindUserByID", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "(", "*", "influxdb", ".", "User", ",", "error", ")", "{", "if", "err", ":=", "authorizeReadUser", "(", "ctx", ",...
// FindUserByID checks to see if the authorizer on context has read access to the id provided.
[ "FindUserByID", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "read", "access", "to", "the", "id", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/user.go#L63-L69
124,580
influxdata/influxdb
authorizer/user.go
FindUser
func (s *UserService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error) { o, err := s.s.FindUser(ctx, filter) if err != nil { return nil, err } if err := authorizeReadUser(ctx, o.ID); err != nil { return nil, err } return o, nil }
go
func (s *UserService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error) { o, err := s.s.FindUser(ctx, filter) if err != nil { return nil, err } if err := authorizeReadUser(ctx, o.ID); err != nil { return nil, err } return o, nil }
[ "func", "(", "s", "*", "UserService", ")", "FindUser", "(", "ctx", "context", ".", "Context", ",", "filter", "influxdb", ".", "UserFilter", ")", "(", "*", "influxdb", ".", "User", ",", "error", ")", "{", "o", ",", "err", ":=", "s", ".", "s", ".", ...
// FindUser retrieves the user and checks to see if the authorizer on context has read access to the user.
[ "FindUser", "retrieves", "the", "user", "and", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "read", "access", "to", "the", "user", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/user.go#L72-L83
124,581
influxdata/influxdb
authorizer/user.go
FindUsers
func (s *UserService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error) { // TODO: we'll likely want to push this operation into the database eventually since fetching the whole list of data // will likely be expensive. os, _, err := s.s.FindUsers(...
go
func (s *UserService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error) { // TODO: we'll likely want to push this operation into the database eventually since fetching the whole list of data // will likely be expensive. os, _, err := s.s.FindUsers(...
[ "func", "(", "s", "*", "UserService", ")", "FindUsers", "(", "ctx", "context", ".", "Context", ",", "filter", "influxdb", ".", "UserFilter", ",", "opt", "...", "influxdb", ".", "FindOptions", ")", "(", "[", "]", "*", "influxdb", ".", "User", ",", "int"...
// FindUsers retrieves all users that match the provided filter and then filters the list down to only the resources that are authorized.
[ "FindUsers", "retrieves", "all", "users", "that", "match", "the", "provided", "filter", "and", "then", "filters", "the", "list", "down", "to", "only", "the", "resources", "that", "are", "authorized", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/user.go#L86-L111
124,582
influxdata/influxdb
authorizer/user.go
CreateUser
func (s *UserService) CreateUser(ctx context.Context, o *influxdb.User) error { p, err := influxdb.NewGlobalPermission(influxdb.WriteAction, influxdb.UsersResourceType) if err != nil { return err } if err := IsAllowed(ctx, *p); err != nil { return err } return s.s.CreateUser(ctx, o) }
go
func (s *UserService) CreateUser(ctx context.Context, o *influxdb.User) error { p, err := influxdb.NewGlobalPermission(influxdb.WriteAction, influxdb.UsersResourceType) if err != nil { return err } if err := IsAllowed(ctx, *p); err != nil { return err } return s.s.CreateUser(ctx, o) }
[ "func", "(", "s", "*", "UserService", ")", "CreateUser", "(", "ctx", "context", ".", "Context", ",", "o", "*", "influxdb", ".", "User", ")", "error", "{", "p", ",", "err", ":=", "influxdb", ".", "NewGlobalPermission", "(", "influxdb", ".", "WriteAction",...
// CreateUser checks to see if the authorizer on context has write access to the global users resource.
[ "CreateUser", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "global", "users", "resource", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/user.go#L114-L125
124,583
influxdata/influxdb
authorizer/user.go
UpdateUser
func (s *UserService) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error) { if err := authorizeWriteUser(ctx, id); err != nil { return nil, err } return s.s.UpdateUser(ctx, id, upd) }
go
func (s *UserService) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error) { if err := authorizeWriteUser(ctx, id); err != nil { return nil, err } return s.s.UpdateUser(ctx, id, upd) }
[ "func", "(", "s", "*", "UserService", ")", "UpdateUser", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ",", "upd", "influxdb", ".", "UserUpdate", ")", "(", "*", "influxdb", ".", "User", ",", "error", ")", "{", "if", "err", ...
// UpdateUser checks to see if the authorizer on context has write access to the user provided.
[ "UpdateUser", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "user", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/user.go#L128-L134
124,584
influxdata/influxdb
authorizer/user.go
DeleteUser
func (s *UserService) DeleteUser(ctx context.Context, id influxdb.ID) error { if err := authorizeWriteUser(ctx, id); err != nil { return err } return s.s.DeleteUser(ctx, id) }
go
func (s *UserService) DeleteUser(ctx context.Context, id influxdb.ID) error { if err := authorizeWriteUser(ctx, id); err != nil { return err } return s.s.DeleteUser(ctx, id) }
[ "func", "(", "s", "*", "UserService", ")", "DeleteUser", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "error", "{", "if", "err", ":=", "authorizeWriteUser", "(", "ctx", ",", "id", ")", ";", "err", "!=", "nil", "{", ...
// DeleteUser checks to see if the authorizer on context has write access to the user provided.
[ "DeleteUser", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "user", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/user.go#L137-L143
124,585
influxdata/influxdb
zap/auth_service.go
FindAuthorizationByID
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (a *platform.Authorization, err error) { defer func() { if err != nil { s.Logger.Info("error finding authorization by id", zap.Error(err)) } }() return s.AuthorizationService.FindAuthorizationByID(ctx, id) }
go
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (a *platform.Authorization, err error) { defer func() { if err != nil { s.Logger.Info("error finding authorization by id", zap.Error(err)) } }() return s.AuthorizationService.FindAuthorizationByID(ctx, id) }
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizationByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "a", "*", "platform", ".", "Authorization", ",", "err", "error", ")", "{", "defer", "func", "(...
// FindAuthorizationByID returns an authorization given an id, and logs any errors.
[ "FindAuthorizationByID", "returns", "an", "authorization", "given", "an", "id", "and", "logs", "any", "errors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/zap/auth_service.go#L19-L27
124,586
influxdata/influxdb
zap/auth_service.go
FindAuthorizationByToken
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, t string) (a *platform.Authorization, err error) { defer func() { if err != nil { s.Logger.Info("error finding authorization by token", zap.Error(err)) } }() return s.AuthorizationService.FindAuthorizationByToken(ctx, t) }
go
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, t string) (a *platform.Authorization, err error) { defer func() { if err != nil { s.Logger.Info("error finding authorization by token", zap.Error(err)) } }() return s.AuthorizationService.FindAuthorizationByToken(ctx, t) }
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizationByToken", "(", "ctx", "context", ".", "Context", ",", "t", "string", ")", "(", "a", "*", "platform", ".", "Authorization", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{"...
// FindAuthorizationByToken returns an authorization given a token, and logs any errors.
[ "FindAuthorizationByToken", "returns", "an", "authorization", "given", "a", "token", "and", "logs", "any", "errors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/zap/auth_service.go#L30-L38
124,587
influxdata/influxdb
zap/auth_service.go
FindAuthorizations
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) (as []*platform.Authorization, i int, err error) { defer func() { if err != nil { s.Logger.Info("error finding authorizations", zap.Error(err)) } }() return s.Authorization...
go
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) (as []*platform.Authorization, i int, err error) { defer func() { if err != nil { s.Logger.Info("error finding authorizations", zap.Error(err)) } }() return s.Authorization...
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizations", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "AuthorizationFilter", ",", "opt", "...", "platform", ".", "FindOptions", ")", "(", "as", "[", "]", "*", "platfor...
// FindAuthorizations returns authorizations given a filter, and logs any errors.
[ "FindAuthorizations", "returns", "authorizations", "given", "a", "filter", "and", "logs", "any", "errors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/zap/auth_service.go#L41-L49
124,588
influxdata/influxdb
zap/auth_service.go
CreateAuthorization
func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *platform.Authorization) (err error) { defer func() { if err != nil { s.Logger.Info("error creating authorization", zap.Error(err)) } }() return s.AuthorizationService.CreateAuthorization(ctx, a) }
go
func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *platform.Authorization) (err error) { defer func() { if err != nil { s.Logger.Info("error creating authorization", zap.Error(err)) } }() return s.AuthorizationService.CreateAuthorization(ctx, a) }
[ "func", "(", "s", "*", "AuthorizationService", ")", "CreateAuthorization", "(", "ctx", "context", ".", "Context", ",", "a", "*", "platform", ".", "Authorization", ")", "(", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "err", "!=", "n...
// CreateAuthorization creates an authorization, and logs any errors.
[ "CreateAuthorization", "creates", "an", "authorization", "and", "logs", "any", "errors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/zap/auth_service.go#L52-L60
124,589
influxdata/influxdb
zap/auth_service.go
DeleteAuthorization
func (s *AuthorizationService) DeleteAuthorization(ctx context.Context, id platform.ID) (err error) { defer func() { if err != nil { s.Logger.Info("error deleting authorization", zap.Error(err)) } }() return s.AuthorizationService.DeleteAuthorization(ctx, id) }
go
func (s *AuthorizationService) DeleteAuthorization(ctx context.Context, id platform.ID) (err error) { defer func() { if err != nil { s.Logger.Info("error deleting authorization", zap.Error(err)) } }() return s.AuthorizationService.DeleteAuthorization(ctx, id) }
[ "func", "(", "s", "*", "AuthorizationService", ")", "DeleteAuthorization", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "err", "!=", "nil", "{", "s"...
// DeleteAuthorization deletes an authorization, and logs any errors.
[ "DeleteAuthorization", "deletes", "an", "authorization", "and", "logs", "any", "errors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/zap/auth_service.go#L63-L71
124,590
influxdata/influxdb
prometheus/metric_recorder.go
Record
func (r *EventRecorder) Record(ctx context.Context, e metric.Event) { labels := prometheus.Labels{ "org_id": e.OrgID.String(), "endpoint": e.Endpoint, "status": fmt.Sprintf("%d", e.Status), } r.count.With(labels).Inc() r.requestBytes.With(labels).Add(float64(e.RequestBytes)) r.responseBytes.With(labels)....
go
func (r *EventRecorder) Record(ctx context.Context, e metric.Event) { labels := prometheus.Labels{ "org_id": e.OrgID.String(), "endpoint": e.Endpoint, "status": fmt.Sprintf("%d", e.Status), } r.count.With(labels).Inc() r.requestBytes.With(labels).Add(float64(e.RequestBytes)) r.responseBytes.With(labels)....
[ "func", "(", "r", "*", "EventRecorder", ")", "Record", "(", "ctx", "context", ".", "Context", ",", "e", "metric", ".", "Event", ")", "{", "labels", ":=", "prometheus", ".", "Labels", "{", "\"", "\"", ":", "e", ".", "OrgID", ".", "String", "(", ")",...
// Record metric records the request count, response bytes, and request bytes with labels // for the org, endpoint, and status.
[ "Record", "metric", "records", "the", "request", "count", "response", "bytes", "and", "request", "bytes", "with", "labels", "for", "the", "org", "endpoint", "and", "status", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/metric_recorder.go#L63-L72
124,591
influxdata/influxdb
prometheus/metric_recorder.go
PrometheusCollectors
func (r *EventRecorder) PrometheusCollectors() []prometheus.Collector { return []prometheus.Collector{ r.count, r.requestBytes, r.responseBytes, } }
go
func (r *EventRecorder) PrometheusCollectors() []prometheus.Collector { return []prometheus.Collector{ r.count, r.requestBytes, r.responseBytes, } }
[ "func", "(", "r", "*", "EventRecorder", ")", "PrometheusCollectors", "(", ")", "[", "]", "prometheus", ".", "Collector", "{", "return", "[", "]", "prometheus", ".", "Collector", "{", "r", ".", "count", ",", "r", ".", "requestBytes", ",", "r", ".", "res...
// PrometheusCollectors exposes the prometheus collectors associated with a metric recorder.
[ "PrometheusCollectors", "exposes", "the", "prometheus", "collectors", "associated", "with", "a", "metric", "recorder", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/metric_recorder.go#L75-L81
124,592
influxdata/influxdb
authorizer/auth.go
FindAuthorizationByID
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Authorization, error) { a, err := s.s.FindAuthorizationByID(ctx, id) if err != nil { return nil, err } if err := authorizeReadAuthorization(ctx, a.UserID); err != nil { return nil, err } return a, nil }
go
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Authorization, error) { a, err := s.s.FindAuthorizationByID(ctx, id) if err != nil { return nil, err } if err := authorizeReadAuthorization(ctx, a.UserID); err != nil { return nil, err } return a, nil }
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizationByID", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "(", "*", "influxdb", ".", "Authorization", ",", "error", ")", "{", "a", ",", "err", ":=", "s", "...
// FindAuthorizationByID checks to see if the authorizer on context has read access to the id provided.
[ "FindAuthorizationByID", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "read", "access", "to", "the", "id", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L63-L74
124,593
influxdata/influxdb
authorizer/auth.go
FindAuthorizationByToken
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, t string) (*influxdb.Authorization, error) { a, err := s.s.FindAuthorizationByToken(ctx, t) if err != nil { return nil, err } if err := authorizeReadAuthorization(ctx, a.UserID); err != nil { return nil, err } return a, nil }
go
func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, t string) (*influxdb.Authorization, error) { a, err := s.s.FindAuthorizationByToken(ctx, t) if err != nil { return nil, err } if err := authorizeReadAuthorization(ctx, a.UserID); err != nil { return nil, err } return a, nil }
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizationByToken", "(", "ctx", "context", ".", "Context", ",", "t", "string", ")", "(", "*", "influxdb", ".", "Authorization", ",", "error", ")", "{", "a", ",", "err", ":=", "s", ".", "s", "....
// FindAuthorization retrieves the authorization and checks to see if the authorizer on context has read access to the authorization.
[ "FindAuthorization", "retrieves", "the", "authorization", "and", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "read", "access", "to", "the", "authorization", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L77-L88
124,594
influxdata/influxdb
authorizer/auth.go
FindAuthorizations
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter influxdb.AuthorizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Authorization, int, error) { // TODO: we'll likely want to push this operation into the database eventually since fetching the whole list of data // will likely be expe...
go
func (s *AuthorizationService) FindAuthorizations(ctx context.Context, filter influxdb.AuthorizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Authorization, int, error) { // TODO: we'll likely want to push this operation into the database eventually since fetching the whole list of data // will likely be expe...
[ "func", "(", "s", "*", "AuthorizationService", ")", "FindAuthorizations", "(", "ctx", "context", ".", "Context", ",", "filter", "influxdb", ".", "AuthorizationFilter", ",", "opt", "...", "influxdb", ".", "FindOptions", ")", "(", "[", "]", "*", "influxdb", "....
// FindAuthorizations retrieves all authorizations that match the provided filter and then filters the list down to only the resources that are authorized.
[ "FindAuthorizations", "retrieves", "all", "authorizations", "that", "match", "the", "provided", "filter", "and", "then", "filters", "the", "list", "down", "to", "only", "the", "resources", "that", "are", "authorized", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L91-L116
124,595
influxdata/influxdb
authorizer/auth.go
CreateAuthorization
func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *influxdb.Authorization) error { if err := authorizeWriteAuthorization(ctx, a.UserID); err != nil { return err } if err := VerifyPermissions(ctx, a.Permissions); err != nil { return err } return s.s.CreateAuthorization(ctx, a) }
go
func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *influxdb.Authorization) error { if err := authorizeWriteAuthorization(ctx, a.UserID); err != nil { return err } if err := VerifyPermissions(ctx, a.Permissions); err != nil { return err } return s.s.CreateAuthorization(ctx, a) }
[ "func", "(", "s", "*", "AuthorizationService", ")", "CreateAuthorization", "(", "ctx", "context", ".", "Context", ",", "a", "*", "influxdb", ".", "Authorization", ")", "error", "{", "if", "err", ":=", "authorizeWriteAuthorization", "(", "ctx", ",", "a", ".",...
// CreateAuthorization checks to see if the authorizer on context has write access to the global authorizations resource.
[ "CreateAuthorization", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "global", "authorizations", "resource", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L119-L129
124,596
influxdata/influxdb
authorizer/auth.go
VerifyPermissions
func VerifyPermissions(ctx context.Context, ps []influxdb.Permission) error { for _, p := range ps { if err := IsAllowed(ctx, p); err != nil { return &influxdb.Error{ Err: err, Msg: fmt.Sprintf("permission %s is not allowed", p), Code: influxdb.EForbidden, } } } return nil }
go
func VerifyPermissions(ctx context.Context, ps []influxdb.Permission) error { for _, p := range ps { if err := IsAllowed(ctx, p); err != nil { return &influxdb.Error{ Err: err, Msg: fmt.Sprintf("permission %s is not allowed", p), Code: influxdb.EForbidden, } } } return nil }
[ "func", "VerifyPermissions", "(", "ctx", "context", ".", "Context", ",", "ps", "[", "]", "influxdb", ".", "Permission", ")", "error", "{", "for", "_", ",", "p", ":=", "range", "ps", "{", "if", "err", ":=", "IsAllowed", "(", "ctx", ",", "p", ")", ";...
// VerifyPermission ensures that an authorization is allowed all of the appropriate permissions.
[ "VerifyPermission", "ensures", "that", "an", "authorization", "is", "allowed", "all", "of", "the", "appropriate", "permissions", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L132-L144
124,597
influxdata/influxdb
authorizer/auth.go
UpdateAuthorization
func (s *AuthorizationService) UpdateAuthorization(ctx context.Context, id influxdb.ID, upd *influxdb.AuthorizationUpdate) (*influxdb.Authorization, error) { a, err := s.s.FindAuthorizationByID(ctx, id) if err != nil { return nil, err } if err := authorizeWriteAuthorization(ctx, a.UserID); err != nil { return ...
go
func (s *AuthorizationService) UpdateAuthorization(ctx context.Context, id influxdb.ID, upd *influxdb.AuthorizationUpdate) (*influxdb.Authorization, error) { a, err := s.s.FindAuthorizationByID(ctx, id) if err != nil { return nil, err } if err := authorizeWriteAuthorization(ctx, a.UserID); err != nil { return ...
[ "func", "(", "s", "*", "AuthorizationService", ")", "UpdateAuthorization", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ",", "upd", "*", "influxdb", ".", "AuthorizationUpdate", ")", "(", "*", "influxdb", ".", "Authorization", ",",...
// UpdateAuthorization checks to see if the authorizer on context has write access to the authorization provided.
[ "UpdateAuthorization", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "authorization", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L147-L158
124,598
influxdata/influxdb
authorizer/auth.go
DeleteAuthorization
func (s *AuthorizationService) DeleteAuthorization(ctx context.Context, id influxdb.ID) error { a, err := s.s.FindAuthorizationByID(ctx, id) if err != nil { return err } if err := authorizeWriteAuthorization(ctx, a.UserID); err != nil { return err } return s.s.DeleteAuthorization(ctx, id) }
go
func (s *AuthorizationService) DeleteAuthorization(ctx context.Context, id influxdb.ID) error { a, err := s.s.FindAuthorizationByID(ctx, id) if err != nil { return err } if err := authorizeWriteAuthorization(ctx, a.UserID); err != nil { return err } return s.s.DeleteAuthorization(ctx, id) }
[ "func", "(", "s", "*", "AuthorizationService", ")", "DeleteAuthorization", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "error", "{", "a", ",", "err", ":=", "s", ".", "s", ".", "FindAuthorizationByID", "(", "ctx", ",", ...
// DeleteAuthorization checks to see if the authorizer on context has write access to the authorization provided.
[ "DeleteAuthorization", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "authorization", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/auth.go#L161-L172
124,599
influxdata/influxdb
chronograf/oauth2/generic.go
Config
func (g *Generic) Config() *oauth2.Config { return &oauth2.Config{ ClientID: g.ID(), ClientSecret: g.Secret(), Scopes: g.Scopes(), RedirectURL: g.RedirectURL, Endpoint: oauth2.Endpoint{ AuthURL: g.AuthURL, TokenURL: g.TokenURL, }, } }
go
func (g *Generic) Config() *oauth2.Config { return &oauth2.Config{ ClientID: g.ID(), ClientSecret: g.Secret(), Scopes: g.Scopes(), RedirectURL: g.RedirectURL, Endpoint: oauth2.Endpoint{ AuthURL: g.AuthURL, TokenURL: g.TokenURL, }, } }
[ "func", "(", "g", "*", "Generic", ")", "Config", "(", ")", "*", "oauth2", ".", "Config", "{", "return", "&", "oauth2", ".", "Config", "{", "ClientID", ":", "g", ".", "ID", "(", ")", ",", "ClientSecret", ":", "g", ".", "Secret", "(", ")", ",", "...
// Config is the Generic OAuth2 exchange information and endpoints
[ "Config", "is", "the", "Generic", "OAuth2", "exchange", "information", "and", "endpoints" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L67-L78