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
123,400
influxdata/influxdb
task/backend/meta.go
CreateNextRun
func (stm *StoreTaskMeta) CreateNextRun(now int64, makeID func() (platform.ID, error)) (RunCreation, error) { if len(stm.CurrentlyRunning) >= int(stm.MaxConcurrency) { return RunCreation{}, errors.New("cannot create next run when max concurrency already reached") } // Not calling stm.DueAt here because we reuse s...
go
func (stm *StoreTaskMeta) CreateNextRun(now int64, makeID func() (platform.ID, error)) (RunCreation, error) { if len(stm.CurrentlyRunning) >= int(stm.MaxConcurrency) { return RunCreation{}, errors.New("cannot create next run when max concurrency already reached") } // Not calling stm.DueAt here because we reuse s...
[ "func", "(", "stm", "*", "StoreTaskMeta", ")", "CreateNextRun", "(", "now", "int64", ",", "makeID", "func", "(", ")", "(", "platform", ".", "ID", ",", "error", ")", ")", "(", "RunCreation", ",", "error", ")", "{", "if", "len", "(", "stm", ".", "Cur...
// CreateNextRun attempts to update stm's CurrentlyRunning slice with a new run. // The new run's now is assigned the earliest possible time according to stm.EffectiveCron, // that is later than any in-progress run and stm's LatestCompleted timestamp. // If the run's now would be later than the passed-in now, CreateNex...
[ "CreateNextRun", "attempts", "to", "update", "stm", "s", "CurrentlyRunning", "slice", "with", "a", "new", "run", ".", "The", "new", "run", "s", "now", "is", "assigned", "the", "earliest", "possible", "time", "according", "to", "stm", ".", "EffectiveCron", "t...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/meta.go#L119-L179
123,401
influxdata/influxdb
task/backend/meta.go
createNextRunFromQueue
func (stm *StoreTaskMeta) createNextRunFromQueue(now, nextDue int64, sch cron.Schedule, makeID func() (platform.ID, error)) (RunCreation, error) { if len(stm.ManualRuns) == 0 { return RunCreation{}, errors.New("cannot create run from empty queue") } q := stm.ManualRuns[0] latest := q.LatestCompleted for _, r :=...
go
func (stm *StoreTaskMeta) createNextRunFromQueue(now, nextDue int64, sch cron.Schedule, makeID func() (platform.ID, error)) (RunCreation, error) { if len(stm.ManualRuns) == 0 { return RunCreation{}, errors.New("cannot create run from empty queue") } q := stm.ManualRuns[0] latest := q.LatestCompleted for _, r :=...
[ "func", "(", "stm", "*", "StoreTaskMeta", ")", "createNextRunFromQueue", "(", "now", ",", "nextDue", "int64", ",", "sch", "cron", ".", "Schedule", ",", "makeID", "func", "(", ")", "(", "platform", ".", "ID", ",", "error", ")", ")", "(", "RunCreation", ...
// createNextRunFromQueue creates the next run from a queue. // This should only be called when the queue is not empty.
[ "createNextRunFromQueue", "creates", "the", "next", "run", "from", "a", "queue", ".", "This", "should", "only", "be", "called", "when", "the", "queue", "is", "not", "empty", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/meta.go#L183-L237
123,402
influxdata/influxdb
task/backend/meta.go
NextDueRun
func (stm *StoreTaskMeta) NextDueRun() (int64, error) { sch, err := cron.Parse(stm.EffectiveCron) if err != nil { return 0, err } latest := stm.LatestCompleted currRun := make([]*StoreTaskMetaRun, len(stm.CurrentlyRunning)) copy(currRun, stm.CurrentlyRunning) for _, cr := range currRun { if cr.Now > latest ...
go
func (stm *StoreTaskMeta) NextDueRun() (int64, error) { sch, err := cron.Parse(stm.EffectiveCron) if err != nil { return 0, err } latest := stm.LatestCompleted currRun := make([]*StoreTaskMetaRun, len(stm.CurrentlyRunning)) copy(currRun, stm.CurrentlyRunning) for _, cr := range currRun { if cr.Now > latest ...
[ "func", "(", "stm", "*", "StoreTaskMeta", ")", "NextDueRun", "(", ")", "(", "int64", ",", "error", ")", "{", "sch", ",", "err", ":=", "cron", ".", "Parse", "(", "stm", ".", "EffectiveCron", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ...
// NextDueRun returns the Unix timestamp of when the next call to CreateNextRun will be ready. // The returned timestamp reflects the task's delay, so it does not necessarily exactly match the schedule time.
[ "NextDueRun", "returns", "the", "Unix", "timestamp", "of", "when", "the", "next", "call", "to", "CreateNextRun", "will", "be", "ready", ".", "The", "returned", "timestamp", "reflects", "the", "task", "s", "delay", "so", "it", "does", "not", "necessarily", "e...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/meta.go#L241-L264
123,403
influxdata/influxdb
task/backend/meta.go
ManuallyRunTimeRange
func (stm *StoreTaskMeta) ManuallyRunTimeRange(start, end, requestedAt int64, makeID func() (platform.ID, error)) error { // Arbitrarily chosen upper limit that seems unlikely to be reached except in pathological cases. const maxQueueSize = 32 if len(stm.ManualRuns) >= maxQueueSize { return ErrManualQueueFull } ...
go
func (stm *StoreTaskMeta) ManuallyRunTimeRange(start, end, requestedAt int64, makeID func() (platform.ID, error)) error { // Arbitrarily chosen upper limit that seems unlikely to be reached except in pathological cases. const maxQueueSize = 32 if len(stm.ManualRuns) >= maxQueueSize { return ErrManualQueueFull } ...
[ "func", "(", "stm", "*", "StoreTaskMeta", ")", "ManuallyRunTimeRange", "(", "start", ",", "end", ",", "requestedAt", "int64", ",", "makeID", "func", "(", ")", "(", "platform", ".", "ID", ",", "error", ")", ")", "error", "{", "// Arbitrarily chosen upper limi...
// ManuallyRunTimeRange requests a manual run covering the approximate range specified by the Unix timestamps start and end. // More specifically, it requests runs scheduled no earlier than start, but possibly later than start, // if start does not land on the task's schedule; and as late as, but not necessarily equal ...
[ "ManuallyRunTimeRange", "requests", "a", "manual", "run", "covering", "the", "approximate", "range", "specified", "by", "the", "Unix", "timestamps", "start", "and", "end", ".", "More", "specifically", "it", "requests", "runs", "scheduled", "no", "earlier", "than",...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/meta.go#L275-L307
123,404
influxdata/influxdb
task/backend/meta.go
Equal
func (stm StoreTaskMeta) Equal(other StoreTaskMeta) bool { if stm.MaxConcurrency != other.MaxConcurrency || stm.LatestCompleted != other.LatestCompleted || stm.Status != other.Status || stm.EffectiveCron != other.EffectiveCron || stm.Offset != other.Offset || len(stm.CurrentlyRunning) != len(other.CurrentlyR...
go
func (stm StoreTaskMeta) Equal(other StoreTaskMeta) bool { if stm.MaxConcurrency != other.MaxConcurrency || stm.LatestCompleted != other.LatestCompleted || stm.Status != other.Status || stm.EffectiveCron != other.EffectiveCron || stm.Offset != other.Offset || len(stm.CurrentlyRunning) != len(other.CurrentlyR...
[ "func", "(", "stm", "StoreTaskMeta", ")", "Equal", "(", "other", "StoreTaskMeta", ")", "bool", "{", "if", "stm", ".", "MaxConcurrency", "!=", "other", ".", "MaxConcurrency", "||", "stm", ".", "LatestCompleted", "!=", "other", ".", "LatestCompleted", "||", "s...
// Equal returns true if all of stm's fields compare equal to other. // Note that this method operates on values, unlike the other methods which operate on pointers. // // Equal is probably not very useful outside of test.
[ "Equal", "returns", "true", "if", "all", "of", "stm", "s", "fields", "compare", "equal", "to", "other", ".", "Note", "that", "this", "method", "operates", "on", "values", "unlike", "the", "other", "methods", "which", "operate", "on", "pointers", ".", "Equa...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/meta.go#L313-L349
123,405
influxdata/influxdb
tsdb/tsm1/report.go
sortKeys
func sortKeys(vals map[string]counter) (keys []string) { for k := range vals { keys = append(keys, k) } sort.Strings(keys) return keys }
go
func sortKeys(vals map[string]counter) (keys []string) { for k := range vals { keys = append(keys, k) } sort.Strings(keys) return keys }
[ "func", "sortKeys", "(", "vals", "map", "[", "string", "]", "counter", ")", "(", "keys", "[", "]", "string", ")", "{", "for", "k", ":=", "range", "vals", "{", "keys", "=", "append", "(", "keys", ",", "k", ")", "\n", "}", "\n", "sort", ".", "Str...
// sortKeys is a quick helper to return the sorted set of a map's keys
[ "sortKeys", "is", "a", "quick", "helper", "to", "return", "the", "sorted", "set", "of", "a", "map", "s", "keys" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/report.go#L304-L311
123,406
influxdata/influxdb
tsdb/series_collection.go
NewSeriesCollection
func NewSeriesCollection(points []models.Point) *SeriesCollection { out := &SeriesCollection{ Points: append([]models.Point(nil), points...), Keys: make([][]byte, 0, len(points)), Names: make([][]byte, 0, len(points)), Tags: make([]models.Tags, 0, len(points)), Types: make([]models.FieldType, 0, len(po...
go
func NewSeriesCollection(points []models.Point) *SeriesCollection { out := &SeriesCollection{ Points: append([]models.Point(nil), points...), Keys: make([][]byte, 0, len(points)), Names: make([][]byte, 0, len(points)), Tags: make([]models.Tags, 0, len(points)), Types: make([]models.FieldType, 0, len(po...
[ "func", "NewSeriesCollection", "(", "points", "[", "]", "models", ".", "Point", ")", "*", "SeriesCollection", "{", "out", ":=", "&", "SeriesCollection", "{", "Points", ":", "append", "(", "[", "]", "models", ".", "Point", "(", "nil", ")", ",", "points", ...
// NewSeriesCollection builds a SeriesCollection from a slice of points. It does some filtering // of invalid points.
[ "NewSeriesCollection", "builds", "a", "SeriesCollection", "from", "a", "slice", "of", "points", ".", "It", "does", "some", "filtering", "of", "invalid", "points", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L42-L62
123,407
influxdata/influxdb
tsdb/series_collection.go
Length
func (s *SeriesCollection) Length() int { switch { case s.Points != nil: return len(s.Points) case s.Keys != nil: return len(s.Keys) case s.SeriesKeys != nil: return len(s.SeriesKeys) case s.Names != nil: return len(s.Names) case s.Tags != nil: return len(s.Tags) case s.Types != nil: return len(s.Typ...
go
func (s *SeriesCollection) Length() int { switch { case s.Points != nil: return len(s.Points) case s.Keys != nil: return len(s.Keys) case s.SeriesKeys != nil: return len(s.SeriesKeys) case s.Names != nil: return len(s.Names) case s.Tags != nil: return len(s.Tags) case s.Types != nil: return len(s.Typ...
[ "func", "(", "s", "*", "SeriesCollection", ")", "Length", "(", ")", "int", "{", "switch", "{", "case", "s", ".", "Points", "!=", "nil", ":", "return", "len", "(", "s", ".", "Points", ")", "\n", "case", "s", ".", "Keys", "!=", "nil", ":", "return"...
// Length returns the length of the first non-nil slice in the collection, or 0 if there is no // non-nil slice.
[ "Length", "returns", "the", "length", "of", "the", "first", "non", "-", "nil", "slice", "in", "the", "collection", "or", "0", "if", "there", "is", "no", "non", "-", "nil", "slice", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L70-L89
123,408
influxdata/influxdb
tsdb/series_collection.go
InvalidateAll
func (s *SeriesCollection) InvalidateAll(reason string) { if s.Reason == "" { s.Reason = reason } s.Dropped += uint64(len(s.Keys)) s.DroppedKeys = append(s.DroppedKeys, s.Keys...) s.Truncate(0) }
go
func (s *SeriesCollection) InvalidateAll(reason string) { if s.Reason == "" { s.Reason = reason } s.Dropped += uint64(len(s.Keys)) s.DroppedKeys = append(s.DroppedKeys, s.Keys...) s.Truncate(0) }
[ "func", "(", "s", "*", "SeriesCollection", ")", "InvalidateAll", "(", "reason", "string", ")", "{", "if", "s", ".", "Reason", "==", "\"", "\"", "{", "s", ".", "Reason", "=", "reason", "\n", "}", "\n", "s", ".", "Dropped", "+=", "uint64", "(", "len"...
// InvalidateAll causes all of the entries to become invalid.
[ "InvalidateAll", "causes", "all", "of", "the", "entries", "to", "become", "invalid", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L202-L209
123,409
influxdata/influxdb
tsdb/series_collection.go
ApplyConcurrentDrops
func (s *SeriesCollection) ApplyConcurrentDrops() { state := s.getState(false) if state == nil { return } length, j := s.Length(), 0 for i := 0; i < length; i++ { if _, ok := state.index[i]; ok { s.Dropped++ if i < len(s.Keys) { s.DroppedKeys = append(s.DroppedKeys, s.Keys[i]) } continue }...
go
func (s *SeriesCollection) ApplyConcurrentDrops() { state := s.getState(false) if state == nil { return } length, j := s.Length(), 0 for i := 0; i < length; i++ { if _, ok := state.index[i]; ok { s.Dropped++ if i < len(s.Keys) { s.DroppedKeys = append(s.DroppedKeys, s.Keys[i]) } continue }...
[ "func", "(", "s", "*", "SeriesCollection", ")", "ApplyConcurrentDrops", "(", ")", "{", "state", ":=", "s", ".", "getState", "(", "false", ")", "\n", "if", "state", "==", "nil", "{", "return", "\n", "}", "\n\n", "length", ",", "j", ":=", "s", ".", "...
// ApplyConcurrentDrops will remove all of the dropped values during concurrent iteration. It should // not be called concurrently with any calls to Invalid.
[ "ApplyConcurrentDrops", "will", "remove", "all", "of", "the", "dropped", "values", "during", "concurrent", "iteration", ".", "It", "should", "not", "be", "called", "concurrently", "with", "any", "calls", "to", "Invalid", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L213-L242
123,410
influxdata/influxdb
tsdb/series_collection.go
getState
func (s *SeriesCollection) getState(alloc bool) *seriesCollectionState { addr := (*unsafe.Pointer)(unsafe.Pointer(&s.state)) // fast path: load pointer and it already exists. always return the result if we can't alloc. if ptr := atomic.LoadPointer(addr); ptr != nil || !alloc { return (*seriesCollectionState)(ptr)...
go
func (s *SeriesCollection) getState(alloc bool) *seriesCollectionState { addr := (*unsafe.Pointer)(unsafe.Pointer(&s.state)) // fast path: load pointer and it already exists. always return the result if we can't alloc. if ptr := atomic.LoadPointer(addr); ptr != nil || !alloc { return (*seriesCollectionState)(ptr)...
[ "func", "(", "s", "*", "SeriesCollection", ")", "getState", "(", "alloc", "bool", ")", "*", "seriesCollectionState", "{", "addr", ":=", "(", "*", "unsafe", ".", "Pointer", ")", "(", "unsafe", ".", "Pointer", "(", "&", "s", ".", "state", ")", ")", "\n...
// getState returns the SeriesCollection's concurrent state. If alloc is true and there // is no state, it will attempt to allocate one and set it. It is safe to call concurrently, but // not with ApplyConcurrentDrops.
[ "getState", "returns", "the", "SeriesCollection", "s", "concurrent", "state", ".", "If", "alloc", "is", "true", "and", "there", "is", "no", "state", "it", "will", "attempt", "to", "allocate", "one", "and", "set", "it", ".", "It", "is", "safe", "to", "cal...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L247-L260
123,411
influxdata/influxdb
tsdb/series_collection.go
invalidIndex
func (s *SeriesCollection) invalidIndex(index int, reason string) { state := s.getState(true) state.mu.Lock() if state.index == nil { state.index = make(map[int]struct{}) } state.index[index] = struct{}{} if state.reason == "" { state.reason = reason } state.mu.Unlock() }
go
func (s *SeriesCollection) invalidIndex(index int, reason string) { state := s.getState(true) state.mu.Lock() if state.index == nil { state.index = make(map[int]struct{}) } state.index[index] = struct{}{} if state.reason == "" { state.reason = reason } state.mu.Unlock() }
[ "func", "(", "s", "*", "SeriesCollection", ")", "invalidIndex", "(", "index", "int", ",", "reason", "string", ")", "{", "state", ":=", "s", ".", "getState", "(", "true", ")", "\n\n", "state", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "state", "...
// invalidIndex stages the index as invalid with the reason. It will be removed when // ApplyConcurrentDrops is called.
[ "invalidIndex", "stages", "the", "index", "as", "invalid", "with", "the", "reason", ".", "It", "will", "be", "removed", "when", "ApplyConcurrentDrops", "is", "called", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L264-L276
123,412
influxdata/influxdb
tsdb/series_collection.go
Next
func (i *SeriesCollectionIterator) Next() bool { i.index++ return i.index < i.length }
go
func (i *SeriesCollectionIterator) Next() bool { i.index++ return i.index < i.length }
[ "func", "(", "i", "*", "SeriesCollectionIterator", ")", "Next", "(", ")", "bool", "{", "i", ".", "index", "++", "\n", "return", "i", ".", "index", "<", "i", ".", "length", "\n", "}" ]
// Next advances the iterator and returns false if it's done.
[ "Next", "advances", "the", "iterator", "and", "returns", "false", "if", "it", "s", "done", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L311-L314
123,413
influxdata/influxdb
tsdb/series_collection.go
Invalid
func (i *SeriesCollectionIterator) Invalid(reason string) { i.s.invalidIndex(i.index, reason) }
go
func (i *SeriesCollectionIterator) Invalid(reason string) { i.s.invalidIndex(i.index, reason) }
[ "func", "(", "i", "*", "SeriesCollectionIterator", ")", "Invalid", "(", "reason", "string", ")", "{", "i", ".", "s", ".", "invalidIndex", "(", "i", ".", "index", ",", "reason", ")", "\n", "}" ]
// Invalid flags the current entry as invalid, including it in the set of dropped keys and // recording a reason. Only the first reason is kept. This is safe for concurrent callers, // but ApplyConcurrentDrops must be called after all iterators are finished.
[ "Invalid", "flags", "the", "current", "entry", "as", "invalid", "including", "it", "in", "the", "set", "of", "dropped", "keys", "and", "recording", "a", "reason", ".", "Only", "the", "first", "reason", "is", "kept", ".", "This", "is", "safe", "for", "con...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/series_collection.go#L331-L333
123,414
influxdata/influxdb
chronograf/bolt/dashboards.go
AddIDs
func (d *DashboardsStore) AddIDs(ctx context.Context, boards []chronograf.Dashboard) error { for _, board := range boards { update := false for i, cell := range board.Cells { // If there are is no id set, we generate one and update the dashboard if cell.ID == "" { id, err := d.IDs.Generate() if err !...
go
func (d *DashboardsStore) AddIDs(ctx context.Context, boards []chronograf.Dashboard) error { for _, board := range boards { update := false for i, cell := range board.Cells { // If there are is no id set, we generate one and update the dashboard if cell.ID == "" { id, err := d.IDs.Generate() if err !...
[ "func", "(", "d", "*", "DashboardsStore", ")", "AddIDs", "(", "ctx", "context", ".", "Context", ",", "boards", "[", "]", "chronograf", ".", "Dashboard", ")", "error", "{", "for", "_", ",", "board", ":=", "range", "boards", "{", "update", ":=", "false",...
// AddIDs is a migration function that adds ID information to existing dashboards
[ "AddIDs", "is", "a", "migration", "function", "that", "adds", "ID", "information", "to", "existing", "dashboards" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/dashboards.go#L25-L48
123,415
influxdata/influxdb
chronograf/bolt/dashboards.go
Migrate
func (d *DashboardsStore) Migrate(ctx context.Context) error { // 1. Add UUIDs to cells without one boards, err := d.All(ctx) if err != nil { return err } if err := d.AddIDs(ctx, boards); err != nil { return nil } defaultOrg, err := d.client.OrganizationsStore.DefaultOrganization(ctx) if err != nil { ret...
go
func (d *DashboardsStore) Migrate(ctx context.Context) error { // 1. Add UUIDs to cells without one boards, err := d.All(ctx) if err != nil { return err } if err := d.AddIDs(ctx, boards); err != nil { return nil } defaultOrg, err := d.client.OrganizationsStore.DefaultOrganization(ctx) if err != nil { ret...
[ "func", "(", "d", "*", "DashboardsStore", ")", "Migrate", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// 1. Add UUIDs to cells without one", "boards", ",", "err", ":=", "d", ".", "All", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{",...
// Migrate updates the dashboards at runtime
[ "Migrate", "updates", "the", "dashboards", "at", "runtime" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/dashboards.go#L51-L76
123,416
influxdata/influxdb
chronograf/bolt/dashboards.go
All
func (d *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error) { var srcs []chronograf.Dashboard if err := d.client.db.View(func(tx *bolt.Tx) error { if err := tx.Bucket(DashboardsBucket).ForEach(func(k, v []byte) error { var src chronograf.Dashboard if err := internal.UnmarshalDashboard(v...
go
func (d *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error) { var srcs []chronograf.Dashboard if err := d.client.db.View(func(tx *bolt.Tx) error { if err := tx.Bucket(DashboardsBucket).ForEach(func(k, v []byte) error { var src chronograf.Dashboard if err := internal.UnmarshalDashboard(v...
[ "func", "(", "d", "*", "DashboardsStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Dashboard", ",", "error", ")", "{", "var", "srcs", "[", "]", "chronograf", ".", "Dashboard", "\n", "if", "err", ":=",...
// All returns all known dashboards
[ "All", "returns", "all", "known", "dashboards" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/dashboards.go#L79-L98
123,417
influxdata/influxdb
chronograf/bolt/dashboards.go
Add
func (d *DashboardsStore) Add(ctx context.Context, src chronograf.Dashboard) (chronograf.Dashboard, error) { if err := d.client.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(DashboardsBucket) id, _ := b.NextSequence() src.ID = chronograf.DashboardID(id) // TODO: use FormatInt strID := strconv.Itoa(int(...
go
func (d *DashboardsStore) Add(ctx context.Context, src chronograf.Dashboard) (chronograf.Dashboard, error) { if err := d.client.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(DashboardsBucket) id, _ := b.NextSequence() src.ID = chronograf.DashboardID(id) // TODO: use FormatInt strID := strconv.Itoa(int(...
[ "func", "(", "d", "*", "DashboardsStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Dashboard", ")", "(", "chronograf", ".", "Dashboard", ",", "error", ")", "{", "if", "err", ":=", "d", ".", "client", ".", "db...
// Add creates a new Dashboard in the DashboardsStore
[ "Add", "creates", "a", "new", "Dashboard", "in", "the", "DashboardsStore" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/dashboards.go#L101-L127
123,418
influxdata/influxdb
chronograf/bolt/dashboards.go
Get
func (d *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error) { var src chronograf.Dashboard if err := d.client.db.View(func(tx *bolt.Tx) error { strID := strconv.Itoa(int(id)) if v := tx.Bucket(DashboardsBucket).Get([]byte(strID)); v == nil { return chronograf.Err...
go
func (d *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error) { var src chronograf.Dashboard if err := d.client.db.View(func(tx *bolt.Tx) error { strID := strconv.Itoa(int(id)) if v := tx.Bucket(DashboardsBucket).Get([]byte(strID)); v == nil { return chronograf.Err...
[ "func", "(", "d", "*", "DashboardsStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "chronograf", ".", "DashboardID", ")", "(", "chronograf", ".", "Dashboard", ",", "error", ")", "{", "var", "src", "chronograf", ".", "Dashboard", "\n"...
// Get returns a Dashboard if the id exists.
[ "Get", "returns", "a", "Dashboard", "if", "the", "id", "exists", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/dashboards.go#L130-L145
123,419
influxdata/influxdb
chronograf/bolt/dashboards.go
Update
func (d *DashboardsStore) Update(ctx context.Context, dash chronograf.Dashboard) error { if err := d.client.db.Update(func(tx *bolt.Tx) error { // Get an existing dashboard with the same ID. b := tx.Bucket(DashboardsBucket) strID := strconv.Itoa(int(dash.ID)) if v := b.Get([]byte(strID)); v == nil { return ...
go
func (d *DashboardsStore) Update(ctx context.Context, dash chronograf.Dashboard) error { if err := d.client.db.Update(func(tx *bolt.Tx) error { // Get an existing dashboard with the same ID. b := tx.Bucket(DashboardsBucket) strID := strconv.Itoa(int(dash.ID)) if v := b.Get([]byte(strID)); v == nil { return ...
[ "func", "(", "d", "*", "DashboardsStore", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "dash", "chronograf", ".", "Dashboard", ")", "error", "{", "if", "err", ":=", "d", ".", "client", ".", "db", ".", "Update", "(", "func", "(", "tx", ...
// Update the dashboard in DashboardsStore
[ "Update", "the", "dashboard", "in", "DashboardsStore" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/dashboards.go#L163-L194
123,420
influxdata/influxdb
kv/service.go
NewService
func NewService(kv Store) *Service { return &Service{ Logger: zap.NewNop(), IDGenerator: snowflake.NewIDGenerator(), TokenGenerator: rand.NewTokenGenerator(64), Hash: &Bcrypt{}, kv: kv, time: time.Now, } }
go
func NewService(kv Store) *Service { return &Service{ Logger: zap.NewNop(), IDGenerator: snowflake.NewIDGenerator(), TokenGenerator: rand.NewTokenGenerator(64), Hash: &Bcrypt{}, kv: kv, time: time.Now, } }
[ "func", "NewService", "(", "kv", "Store", ")", "*", "Service", "{", "return", "&", "Service", "{", "Logger", ":", "zap", ".", "NewNop", "(", ")", ",", "IDGenerator", ":", "snowflake", ".", "NewIDGenerator", "(", ")", ",", "TokenGenerator", ":", "rand", ...
// NewService returns an instance of a Service.
[ "NewService", "returns", "an", "instance", "of", "a", "Service", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/service.go#L34-L43
123,421
influxdata/influxdb
kv/service.go
Initialize
func (s *Service) Initialize(ctx context.Context) error { return s.kv.Update(ctx, func(tx Tx) error { if err := s.initializeAuths(ctx, tx); err != nil { return err } if err := s.initializeDocuments(ctx, tx); err != nil { return err } if err := s.initializeBuckets(ctx, tx); err != nil { return err ...
go
func (s *Service) Initialize(ctx context.Context) error { return s.kv.Update(ctx, func(tx Tx) error { if err := s.initializeAuths(ctx, tx); err != nil { return err } if err := s.initializeDocuments(ctx, tx); err != nil { return err } if err := s.initializeBuckets(ctx, tx); err != nil { return err ...
[ "func", "(", "s", "*", "Service", ")", "Initialize", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "s", ".", "kv", ".", "Update", "(", "ctx", ",", "func", "(", "tx", "Tx", ")", "error", "{", "if", "err", ":=", "s", ".", "i...
// Initialize creates Buckets needed.
[ "Initialize", "creates", "Buckets", "needed", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/service.go#L46-L118
123,422
influxdata/influxdb
storage/reads/eval.go
evalExpr
func evalExpr(expr influxql.Expr, m Valuer) interface{} { if expr == nil { return nil } switch expr := expr.(type) { case *influxql.BinaryExpr: return evalBinaryExpr(expr, m) case *influxql.BooleanLiteral: return expr.Val case *influxql.IntegerLiteral: return expr.Val case *influxql.UnsignedLiteral: r...
go
func evalExpr(expr influxql.Expr, m Valuer) interface{} { if expr == nil { return nil } switch expr := expr.(type) { case *influxql.BinaryExpr: return evalBinaryExpr(expr, m) case *influxql.BooleanLiteral: return expr.Val case *influxql.IntegerLiteral: return expr.Val case *influxql.UnsignedLiteral: r...
[ "func", "evalExpr", "(", "expr", "influxql", ".", "Expr", ",", "m", "Valuer", ")", "interface", "{", "}", "{", "if", "expr", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "switch", "expr", ":=", "expr", ".", "(", "type", ")", "{", "case", ...
// evalExpr evaluates expr against a map.
[ "evalExpr", "evaluates", "expr", "against", "a", "map", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/reads/eval.go#L11-L39
123,423
influxdata/influxdb
telemetry/push.go
NewPusher
func NewPusher(g prometheus.Gatherer) *Pusher { return &Pusher{ URL: "https://telemetry.influxdata.com/metrics/job/influxdb", Gather: &pr.Filter{ Gatherer: g, Matcher: telemetryMatcher, }, Client: &http.Client{ Transport: http.DefaultTransport, Timeout: 10 * time.Second, }, PushFormat: expfm...
go
func NewPusher(g prometheus.Gatherer) *Pusher { return &Pusher{ URL: "https://telemetry.influxdata.com/metrics/job/influxdb", Gather: &pr.Filter{ Gatherer: g, Matcher: telemetryMatcher, }, Client: &http.Client{ Transport: http.DefaultTransport, Timeout: 10 * time.Second, }, PushFormat: expfm...
[ "func", "NewPusher", "(", "g", "prometheus", ".", "Gatherer", ")", "*", "Pusher", "{", "return", "&", "Pusher", "{", "URL", ":", "\"", "\"", ",", "Gather", ":", "&", "pr", ".", "Filter", "{", "Gatherer", ":", "g", ",", "Matcher", ":", "telemetryMatch...
// NewPusher sends usage metrics to a prometheus push gateway.
[ "NewPusher", "sends", "usage", "metrics", "to", "a", "prometheus", "push", "gateway", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/telemetry/push.go#L26-L39
123,424
influxdata/influxdb
telemetry/push.go
Push
func (p *Pusher) Push(ctx context.Context) error { if p.PushFormat == "" { p.PushFormat = expfmt.FmtText } resps := make(chan (error)) go func() { resps <- p.push(ctx) }() select { case err := <-resps: return err case <-ctx.Done(): return ctx.Err() } }
go
func (p *Pusher) Push(ctx context.Context) error { if p.PushFormat == "" { p.PushFormat = expfmt.FmtText } resps := make(chan (error)) go func() { resps <- p.push(ctx) }() select { case err := <-resps: return err case <-ctx.Done(): return ctx.Err() } }
[ "func", "(", "p", "*", "Pusher", ")", "Push", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "p", ".", "PushFormat", "==", "\"", "\"", "{", "p", ".", "PushFormat", "=", "expfmt", ".", "FmtText", "\n", "}", "\n\n", "resps", ":=", ...
// Push POSTs prometheus metrics in protobuf delimited format to a push gateway.
[ "Push", "POSTs", "prometheus", "metrics", "in", "protobuf", "delimited", "format", "to", "a", "push", "gateway", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/telemetry/push.go#L42-L58
123,425
influxdata/influxdb
task/backend/scheduler_metrics.go
StartRun
func (sm *schedulerMetrics) StartRun(tid string) { sm.totalRunsActive.Inc() sm.runsActive.WithLabelValues(tid).Inc() }
go
func (sm *schedulerMetrics) StartRun(tid string) { sm.totalRunsActive.Inc() sm.runsActive.WithLabelValues(tid).Inc() }
[ "func", "(", "sm", "*", "schedulerMetrics", ")", "StartRun", "(", "tid", "string", ")", "{", "sm", ".", "totalRunsActive", ".", "Inc", "(", ")", "\n", "sm", ".", "runsActive", ".", "WithLabelValues", "(", "tid", ")", ".", "Inc", "(", ")", "\n", "}" ]
// StartRun adjusts the metrics to indicate a run is in progress for the given task ID.
[ "StartRun", "adjusts", "the", "metrics", "to", "indicate", "a", "run", "is", "in", "progress", "for", "the", "given", "task", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler_metrics.go#L78-L81
123,426
influxdata/influxdb
task/backend/scheduler_metrics.go
FinishRun
func (sm *schedulerMetrics) FinishRun(tid string, succeeded bool) { status := statusString(succeeded) sm.totalRunsActive.Dec() sm.totalRunsComplete.WithLabelValues(status).Inc() sm.runsActive.WithLabelValues(tid).Dec() sm.runsComplete.WithLabelValues(tid, status).Inc() }
go
func (sm *schedulerMetrics) FinishRun(tid string, succeeded bool) { status := statusString(succeeded) sm.totalRunsActive.Dec() sm.totalRunsComplete.WithLabelValues(status).Inc() sm.runsActive.WithLabelValues(tid).Dec() sm.runsComplete.WithLabelValues(tid, status).Inc() }
[ "func", "(", "sm", "*", "schedulerMetrics", ")", "FinishRun", "(", "tid", "string", ",", "succeeded", "bool", ")", "{", "status", ":=", "statusString", "(", "succeeded", ")", "\n\n", "sm", ".", "totalRunsActive", ".", "Dec", "(", ")", "\n", "sm", ".", ...
// FinishRun adjusts the metrics to indicate a run is no longer in progress for the given task ID.
[ "FinishRun", "adjusts", "the", "metrics", "to", "indicate", "a", "run", "is", "no", "longer", "in", "progress", "for", "the", "given", "task", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler_metrics.go#L84-L92
123,427
influxdata/influxdb
task/backend/scheduler_metrics.go
ClaimTask
func (sm *schedulerMetrics) ClaimTask(succeeded bool) { status := statusString(succeeded) sm.claimsComplete.WithLabelValues(status).Inc() if succeeded { sm.claimsActive.Inc() } }
go
func (sm *schedulerMetrics) ClaimTask(succeeded bool) { status := statusString(succeeded) sm.claimsComplete.WithLabelValues(status).Inc() if succeeded { sm.claimsActive.Inc() } }
[ "func", "(", "sm", "*", "schedulerMetrics", ")", "ClaimTask", "(", "succeeded", "bool", ")", "{", "status", ":=", "statusString", "(", "succeeded", ")", "\n\n", "sm", ".", "claimsComplete", ".", "WithLabelValues", "(", "status", ")", ".", "Inc", "(", ")", ...
// ClaimTask adjusts the metrics to indicate the result of an attempted claim.
[ "ClaimTask", "adjusts", "the", "metrics", "to", "indicate", "the", "result", "of", "an", "attempted", "claim", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler_metrics.go#L95-L102
123,428
influxdata/influxdb
chronograf/oauth2/heroku.go
Config
func (h *Heroku) Config() *oauth2.Config { return &oauth2.Config{ ClientID: h.ID(), ClientSecret: h.Secret(), Scopes: h.Scopes(), Endpoint: hrk.Endpoint, } }
go
func (h *Heroku) Config() *oauth2.Config { return &oauth2.Config{ ClientID: h.ID(), ClientSecret: h.Secret(), Scopes: h.Scopes(), Endpoint: hrk.Endpoint, } }
[ "func", "(", "h", "*", "Heroku", ")", "Config", "(", ")", "*", "oauth2", ".", "Config", "{", "return", "&", "oauth2", ".", "Config", "{", "ClientID", ":", "h", ".", "ID", "(", ")", ",", "ClientSecret", ":", "h", ".", "Secret", "(", ")", ",", "S...
// Config returns the OAuth2 exchange information and endpoints
[ "Config", "returns", "the", "OAuth2", "exchange", "information", "and", "endpoints" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/heroku.go#L34-L41
123,429
influxdata/influxdb
chronograf/oauth2/heroku.go
PrincipalID
func (h *Heroku) PrincipalID(provider *http.Client) (string, error) { type DefaultOrg struct { ID string `json:"id"` Name string `json:"name"` } type Account struct { Email string `json:"email"` DefaultOrganization DefaultOrg `json:"default_organization"` } req, err := http.NewRequest(...
go
func (h *Heroku) PrincipalID(provider *http.Client) (string, error) { type DefaultOrg struct { ID string `json:"id"` Name string `json:"name"` } type Account struct { Email string `json:"email"` DefaultOrganization DefaultOrg `json:"default_organization"` } req, err := http.NewRequest(...
[ "func", "(", "h", "*", "Heroku", ")", "PrincipalID", "(", "provider", "*", "http", ".", "Client", ")", "(", "string", ",", "error", ")", "{", "type", "DefaultOrg", "struct", "{", "ID", "string", "`json:\"id\"`", "\n", "Name", "string", "`json:\"name\"`", ...
// PrincipalID returns the Heroku email address of the user.
[ "PrincipalID", "returns", "the", "Heroku", "email", "address", "of", "the", "user", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/heroku.go#L54-L105
123,430
influxdata/influxdb
chronograf/oauth2/heroku.go
Group
func (h *Heroku) Group(provider *http.Client) (string, error) { type DefaultOrg struct { ID string `json:"id"` Name string `json:"name"` } type Account struct { Email string `json:"email"` DefaultOrganization DefaultOrg `json:"default_organization"` } resp, err := provider.Get(HerokuAc...
go
func (h *Heroku) Group(provider *http.Client) (string, error) { type DefaultOrg struct { ID string `json:"id"` Name string `json:"name"` } type Account struct { Email string `json:"email"` DefaultOrganization DefaultOrg `json:"default_organization"` } resp, err := provider.Get(HerokuAc...
[ "func", "(", "h", "*", "Heroku", ")", "Group", "(", "provider", "*", "http", ".", "Client", ")", "(", "string", ",", "error", ")", "{", "type", "DefaultOrg", "struct", "{", "ID", "string", "`json:\"id\"`", "\n", "Name", "string", "`json:\"name\"`", "\n",...
// Group returns the Heroku organization that user belongs to.
[ "Group", "returns", "the", "Heroku", "organization", "that", "user", "belongs", "to", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/heroku.go#L108-L133
123,431
influxdata/influxdb
chronograf/enterprise/meta.go
NewMetaClient
func NewMetaClient(url *url.URL, InsecureSkipVerify bool, authorizer influx.Authorizer) *MetaClient { return &MetaClient{ URL: url, client: &defaultClient{ InsecureSkipVerify: InsecureSkipVerify, }, authorizer: authorizer, } }
go
func NewMetaClient(url *url.URL, InsecureSkipVerify bool, authorizer influx.Authorizer) *MetaClient { return &MetaClient{ URL: url, client: &defaultClient{ InsecureSkipVerify: InsecureSkipVerify, }, authorizer: authorizer, } }
[ "func", "NewMetaClient", "(", "url", "*", "url", ".", "URL", ",", "InsecureSkipVerify", "bool", ",", "authorizer", "influx", ".", "Authorizer", ")", "*", "MetaClient", "{", "return", "&", "MetaClient", "{", "URL", ":", "url", ",", "client", ":", "&", "de...
// NewMetaClient represents a meta node in an Influx Enterprise cluster
[ "NewMetaClient", "represents", "a", "meta", "node", "in", "an", "Influx", "Enterprise", "cluster" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L40-L48
123,432
influxdata/influxdb
chronograf/enterprise/meta.go
GetLDAPConfig
func (m *MetaClient) GetLDAPConfig(ctx context.Context) (*LDAPConfig, error) { ctxt, cancel := context.WithTimeout(ctx, 2*time.Second) defer cancel() errorCh := make(chan error, 1) responseChannel := m.requestLDAPChannel(ctxt, errorCh) select { case res := <-responseChannel: result, err := ioutil.ReadAll(res....
go
func (m *MetaClient) GetLDAPConfig(ctx context.Context) (*LDAPConfig, error) { ctxt, cancel := context.WithTimeout(ctx, 2*time.Second) defer cancel() errorCh := make(chan error, 1) responseChannel := m.requestLDAPChannel(ctxt, errorCh) select { case res := <-responseChannel: result, err := ioutil.ReadAll(res....
[ "func", "(", "m", "*", "MetaClient", ")", "GetLDAPConfig", "(", "ctx", "context", ".", "Context", ")", "(", "*", "LDAPConfig", ",", "error", ")", "{", "ctxt", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "ctx", ",", "2", "*", "time", ".",...
// GetLDAPConfig get the current ldap config response from influxdb enterprise
[ "GetLDAPConfig", "get", "the", "current", "ldap", "config", "response", "from", "influxdb", "enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L74-L100
123,433
influxdata/influxdb
chronograf/enterprise/meta.go
Users
func (m *MetaClient) Users(ctx context.Context, name *string) (*Users, error) { params := map[string]string{} if name != nil { params["name"] = *name } res, err := m.Do(ctx, "/user", "GET", m.authorizer, params, nil) if err != nil { return nil, err } defer res.Body.Close() dec := json.NewDecoder(res.Body) ...
go
func (m *MetaClient) Users(ctx context.Context, name *string) (*Users, error) { params := map[string]string{} if name != nil { params["name"] = *name } res, err := m.Do(ctx, "/user", "GET", m.authorizer, params, nil) if err != nil { return nil, err } defer res.Body.Close() dec := json.NewDecoder(res.Body) ...
[ "func", "(", "m", "*", "MetaClient", ")", "Users", "(", "ctx", "context", ".", "Context", ",", "name", "*", "string", ")", "(", "*", "Users", ",", "error", ")", "{", "params", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "if", "name...
// Users gets all the users. If name is not nil it filters for a single user
[ "Users", "gets", "all", "the", "users", ".", "If", "name", "is", "not", "nil", "it", "filters", "for", "a", "single", "user" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L120-L138
123,434
influxdata/influxdb
chronograf/enterprise/meta.go
User
func (m *MetaClient) User(ctx context.Context, name string) (*User, error) { users, err := m.Users(ctx, &name) if err != nil { return nil, err } for _, user := range users.Users { return &user, nil } return nil, fmt.Errorf("no user found") }
go
func (m *MetaClient) User(ctx context.Context, name string) (*User, error) { users, err := m.Users(ctx, &name) if err != nil { return nil, err } for _, user := range users.Users { return &user, nil } return nil, fmt.Errorf("no user found") }
[ "func", "(", "m", "*", "MetaClient", ")", "User", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "*", "User", ",", "error", ")", "{", "users", ",", "err", ":=", "m", ".", "Users", "(", "ctx", ",", "&", "name", ")", "\n"...
// User returns a single Influx Enterprise user
[ "User", "returns", "a", "single", "Influx", "Enterprise", "user" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L141-L151
123,435
influxdata/influxdb
chronograf/enterprise/meta.go
CreateUser
func (m *MetaClient) CreateUser(ctx context.Context, name, passwd string) error { return m.CreateUpdateUser(ctx, "create", name, passwd) }
go
func (m *MetaClient) CreateUser(ctx context.Context, name, passwd string) error { return m.CreateUpdateUser(ctx, "create", name, passwd) }
[ "func", "(", "m", "*", "MetaClient", ")", "CreateUser", "(", "ctx", "context", ".", "Context", ",", "name", ",", "passwd", "string", ")", "error", "{", "return", "m", ".", "CreateUpdateUser", "(", "ctx", ",", "\"", "\"", ",", "name", ",", "passwd", "...
// CreateUser adds a user to Influx Enterprise
[ "CreateUser", "adds", "a", "user", "to", "Influx", "Enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L154-L156
123,436
influxdata/influxdb
chronograf/enterprise/meta.go
DeleteUser
func (m *MetaClient) DeleteUser(ctx context.Context, name string) error { a := &UserAction{ Action: "delete", User: &User{ Name: name, }, } return m.Post(ctx, "/user", a, nil) }
go
func (m *MetaClient) DeleteUser(ctx context.Context, name string) error { a := &UserAction{ Action: "delete", User: &User{ Name: name, }, } return m.Post(ctx, "/user", a, nil) }
[ "func", "(", "m", "*", "MetaClient", ")", "DeleteUser", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "a", ":=", "&", "UserAction", "{", "Action", ":", "\"", "\"", ",", "User", ":", "&", "User", "{", "Name", ":", ...
// DeleteUser removes a user from Influx Enterprise
[ "DeleteUser", "removes", "a", "user", "from", "Influx", "Enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L176-L185
123,437
influxdata/influxdb
chronograf/enterprise/meta.go
RemoveUserPerms
func (m *MetaClient) RemoveUserPerms(ctx context.Context, name string, perms Permissions) error { a := &UserAction{ Action: "remove-permissions", User: &User{ Name: name, Permissions: perms, }, } return m.Post(ctx, "/user", a, nil) }
go
func (m *MetaClient) RemoveUserPerms(ctx context.Context, name string, perms Permissions) error { a := &UserAction{ Action: "remove-permissions", User: &User{ Name: name, Permissions: perms, }, } return m.Post(ctx, "/user", a, nil) }
[ "func", "(", "m", "*", "MetaClient", ")", "RemoveUserPerms", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "perms", "Permissions", ")", "error", "{", "a", ":=", "&", "UserAction", "{", "Action", ":", "\"", "\"", ",", "User", ":", ...
// RemoveUserPerms revokes permissions for a user in Influx Enterprise
[ "RemoveUserPerms", "revokes", "permissions", "for", "a", "user", "in", "Influx", "Enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L188-L197
123,438
influxdata/influxdb
chronograf/enterprise/meta.go
SetUserPerms
func (m *MetaClient) SetUserPerms(ctx context.Context, name string, perms Permissions) error { user, err := m.User(ctx, name) if err != nil { return err } revoke, add := permissionsDifference(perms, user.Permissions) // first, revoke all the permissions the user currently has, but, // shouldn't... if len(rev...
go
func (m *MetaClient) SetUserPerms(ctx context.Context, name string, perms Permissions) error { user, err := m.User(ctx, name) if err != nil { return err } revoke, add := permissionsDifference(perms, user.Permissions) // first, revoke all the permissions the user currently has, but, // shouldn't... if len(rev...
[ "func", "(", "m", "*", "MetaClient", ")", "SetUserPerms", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "perms", "Permissions", ")", "error", "{", "user", ",", "err", ":=", "m", ".", "User", "(", "ctx", ",", "name", ")", "\n", ...
// SetUserPerms removes permissions not in set and then adds the requested perms
[ "SetUserPerms", "removes", "permissions", "not", "in", "set", "and", "then", "adds", "the", "requested", "perms" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L200-L229
123,439
influxdata/influxdb
chronograf/enterprise/meta.go
UserRoles
func (m *MetaClient) UserRoles(ctx context.Context) (map[string]Roles, error) { res, err := m.Roles(ctx, nil) if err != nil { return nil, err } userRoles := make(map[string]Roles) for _, role := range res.Roles { for _, u := range role.Users { ur, ok := userRoles[u] if !ok { ur = Roles{} } ur....
go
func (m *MetaClient) UserRoles(ctx context.Context) (map[string]Roles, error) { res, err := m.Roles(ctx, nil) if err != nil { return nil, err } userRoles := make(map[string]Roles) for _, role := range res.Roles { for _, u := range role.Users { ur, ok := userRoles[u] if !ok { ur = Roles{} } ur....
[ "func", "(", "m", "*", "MetaClient", ")", "UserRoles", "(", "ctx", "context", ".", "Context", ")", "(", "map", "[", "string", "]", "Roles", ",", "error", ")", "{", "res", ",", "err", ":=", "m", ".", "Roles", "(", "ctx", ",", "nil", ")", "\n", "...
// UserRoles returns a map of users to all of their current roles
[ "UserRoles", "returns", "a", "map", "of", "users", "to", "all", "of", "their", "current", "roles" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L232-L250
123,440
influxdata/influxdb
chronograf/enterprise/meta.go
Role
func (m *MetaClient) Role(ctx context.Context, name string) (*Role, error) { roles, err := m.Roles(ctx, &name) if err != nil { return nil, err } for _, role := range roles.Roles { return &role, nil } return nil, fmt.Errorf("no role found") }
go
func (m *MetaClient) Role(ctx context.Context, name string) (*Role, error) { roles, err := m.Roles(ctx, &name) if err != nil { return nil, err } for _, role := range roles.Roles { return &role, nil } return nil, fmt.Errorf("no role found") }
[ "func", "(", "m", "*", "MetaClient", ")", "Role", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "*", "Role", ",", "error", ")", "{", "roles", ",", "err", ":=", "m", ".", "Roles", "(", "ctx", ",", "&", "name", ")", "\n"...
// Role returns a single named role
[ "Role", "returns", "a", "single", "named", "role" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L274-L283
123,441
influxdata/influxdb
chronograf/enterprise/meta.go
CreateRole
func (m *MetaClient) CreateRole(ctx context.Context, name string) error { a := &RoleAction{ Action: "create", Role: &Role{ Name: name, }, } return m.Post(ctx, "/role", a, nil) }
go
func (m *MetaClient) CreateRole(ctx context.Context, name string) error { a := &RoleAction{ Action: "create", Role: &Role{ Name: name, }, } return m.Post(ctx, "/role", a, nil) }
[ "func", "(", "m", "*", "MetaClient", ")", "CreateRole", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "a", ":=", "&", "RoleAction", "{", "Action", ":", "\"", "\"", ",", "Role", ":", "&", "Role", "{", "Name", ":", ...
// CreateRole adds a role to Influx Enterprise
[ "CreateRole", "adds", "a", "role", "to", "Influx", "Enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L286-L294
123,442
influxdata/influxdb
chronograf/enterprise/meta.go
RemoveRolePerms
func (m *MetaClient) RemoveRolePerms(ctx context.Context, name string, perms Permissions) error { a := &RoleAction{ Action: "remove-permissions", Role: &Role{ Name: name, Permissions: perms, }, } return m.Post(ctx, "/role", a, nil) }
go
func (m *MetaClient) RemoveRolePerms(ctx context.Context, name string, perms Permissions) error { a := &RoleAction{ Action: "remove-permissions", Role: &Role{ Name: name, Permissions: perms, }, } return m.Post(ctx, "/role", a, nil) }
[ "func", "(", "m", "*", "MetaClient", ")", "RemoveRolePerms", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "perms", "Permissions", ")", "error", "{", "a", ":=", "&", "RoleAction", "{", "Action", ":", "\"", "\"", ",", "Role", ":", ...
// RemoveRolePerms revokes permissions from a role
[ "RemoveRolePerms", "revokes", "permissions", "from", "a", "role" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L308-L317
123,443
influxdata/influxdb
chronograf/enterprise/meta.go
SetRolePerms
func (m *MetaClient) SetRolePerms(ctx context.Context, name string, perms Permissions) error { role, err := m.Role(ctx, name) if err != nil { return err } revoke, add := permissionsDifference(perms, role.Permissions) // first, revoke all the permissions the role currently has, but, // shouldn't... if len(rev...
go
func (m *MetaClient) SetRolePerms(ctx context.Context, name string, perms Permissions) error { role, err := m.Role(ctx, name) if err != nil { return err } revoke, add := permissionsDifference(perms, role.Permissions) // first, revoke all the permissions the role currently has, but, // shouldn't... if len(rev...
[ "func", "(", "m", "*", "MetaClient", ")", "SetRolePerms", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "perms", "Permissions", ")", "error", "{", "role", ",", "err", ":=", "m", ".", "Role", "(", "ctx", ",", "name", ")", "\n", ...
// SetRolePerms removes permissions not in set and then adds the requested perms to role
[ "SetRolePerms", "removes", "permissions", "not", "in", "set", "and", "then", "adds", "the", "requested", "perms", "to", "role" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L320-L349
123,444
influxdata/influxdb
chronograf/enterprise/meta.go
SetRoleUsers
func (m *MetaClient) SetRoleUsers(ctx context.Context, name string, users []string) error { role, err := m.Role(ctx, name) if err != nil { return err } revoke, add := Difference(users, role.Users) if err := m.RemoveRoleUsers(ctx, name, revoke); err != nil { return err } return m.AddRoleUsers(ctx, name, add)...
go
func (m *MetaClient) SetRoleUsers(ctx context.Context, name string, users []string) error { role, err := m.Role(ctx, name) if err != nil { return err } revoke, add := Difference(users, role.Users) if err := m.RemoveRoleUsers(ctx, name, revoke); err != nil { return err } return m.AddRoleUsers(ctx, name, add)...
[ "func", "(", "m", "*", "MetaClient", ")", "SetRoleUsers", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "users", "[", "]", "string", ")", "error", "{", "role", ",", "err", ":=", "m", ".", "Role", "(", "ctx", ",", "name", ")", ...
// SetRoleUsers removes users not in role and then adds the requested users to role
[ "SetRoleUsers", "removes", "users", "not", "in", "role", "and", "then", "adds", "the", "requested", "users", "to", "role" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L352-L363
123,445
influxdata/influxdb
chronograf/enterprise/meta.go
Difference
func Difference(wants []string, haves []string) (revoke []string, add []string) { for _, want := range wants { found := false for _, got := range haves { if want != got { continue } found = true } if !found { add = append(add, want) } } for _, got := range haves { found := false for _, ...
go
func Difference(wants []string, haves []string) (revoke []string, add []string) { for _, want := range wants { found := false for _, got := range haves { if want != got { continue } found = true } if !found { add = append(add, want) } } for _, got := range haves { found := false for _, ...
[ "func", "Difference", "(", "wants", "[", "]", "string", ",", "haves", "[", "]", "string", ")", "(", "revoke", "[", "]", "string", ",", "add", "[", "]", "string", ")", "{", "for", "_", ",", "want", ":=", "range", "wants", "{", "found", ":=", "fals...
// Difference compares two sets and returns a set to be removed and a set to be added
[ "Difference", "compares", "two", "sets", "and", "returns", "a", "set", "to", "be", "removed", "and", "a", "set", "to", "be", "added" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L366-L393
123,446
influxdata/influxdb
chronograf/enterprise/meta.go
AddRoleUsers
func (m *MetaClient) AddRoleUsers(ctx context.Context, name string, users []string) error { // No permissions to add, so, role is in the right state if len(users) == 0 { return nil } a := &RoleAction{ Action: "add-users", Role: &Role{ Name: name, Users: users, }, } return m.Post(ctx, "/role", a, n...
go
func (m *MetaClient) AddRoleUsers(ctx context.Context, name string, users []string) error { // No permissions to add, so, role is in the right state if len(users) == 0 { return nil } a := &RoleAction{ Action: "add-users", Role: &Role{ Name: name, Users: users, }, } return m.Post(ctx, "/role", a, n...
[ "func", "(", "m", "*", "MetaClient", ")", "AddRoleUsers", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "users", "[", "]", "string", ")", "error", "{", "// No permissions to add, so, role is in the right state", "if", "len", "(", "users", ...
// AddRoleUsers updates a role to have additional users.
[ "AddRoleUsers", "updates", "a", "role", "to", "have", "additional", "users", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L419-L433
123,447
influxdata/influxdb
chronograf/enterprise/meta.go
Post
func (m *MetaClient) Post(ctx context.Context, path string, action interface{}, params map[string]string) error { b, err := json.Marshal(action) if err != nil { return err } body := bytes.NewReader(b) _, err = m.Do(ctx, path, "POST", m.authorizer, params, body) if err != nil { return err } return nil }
go
func (m *MetaClient) Post(ctx context.Context, path string, action interface{}, params map[string]string) error { b, err := json.Marshal(action) if err != nil { return err } body := bytes.NewReader(b) _, err = m.Do(ctx, path, "POST", m.authorizer, params, body) if err != nil { return err } return nil }
[ "func", "(", "m", "*", "MetaClient", ")", "Post", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "action", "interface", "{", "}", ",", "params", "map", "[", "string", "]", "string", ")", "error", "{", "b", ",", "err", ":=", "jso...
// Post is a helper function to POST to Influx Enterprise
[ "Post", "is", "a", "helper", "function", "to", "POST", "to", "Influx", "Enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L453-L464
123,448
influxdata/influxdb
chronograf/enterprise/meta.go
Do
func (d *defaultClient) Do(URL *url.URL, path, method string, authorizer influx.Authorizer, params map[string]string, body io.Reader) (*http.Response, error) { p := url.Values{} for k, v := range params { p.Add(k, v) } URL.Path = path URL.RawQuery = p.Encode() if d.Leader == "" { d.Leader = URL.Host } else ...
go
func (d *defaultClient) Do(URL *url.URL, path, method string, authorizer influx.Authorizer, params map[string]string, body io.Reader) (*http.Response, error) { p := url.Values{} for k, v := range params { p.Add(k, v) } URL.Path = path URL.RawQuery = p.Encode() if d.Leader == "" { d.Leader = URL.Host } else ...
[ "func", "(", "d", "*", "defaultClient", ")", "Do", "(", "URL", "*", "url", ".", "URL", ",", "path", ",", "method", "string", ",", "authorizer", "influx", ".", "Authorizer", ",", "params", "map", "[", "string", "]", "string", ",", "body", "io", ".", ...
// Do is a helper function to interface with Influx Enterprise's Meta API
[ "Do", "is", "a", "helper", "function", "to", "interface", "with", "Influx", "Enterprise", "s", "Meta", "API" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L472-L531
123,449
influxdata/influxdb
chronograf/enterprise/meta.go
AuthedCheckRedirect
func (d *defaultClient) AuthedCheckRedirect(req *http.Request, via []*http.Request) error { if len(via) >= 10 { return errors.New("too many redirects") } else if len(via) == 0 { return nil } preserve := "Authorization" if auth, ok := via[0].Header[preserve]; ok { req.Header[preserve] = auth } d.Leader = re...
go
func (d *defaultClient) AuthedCheckRedirect(req *http.Request, via []*http.Request) error { if len(via) >= 10 { return errors.New("too many redirects") } else if len(via) == 0 { return nil } preserve := "Authorization" if auth, ok := via[0].Header[preserve]; ok { req.Header[preserve] = auth } d.Leader = re...
[ "func", "(", "d", "*", "defaultClient", ")", "AuthedCheckRedirect", "(", "req", "*", "http", ".", "Request", ",", "via", "[", "]", "*", "http", ".", "Request", ")", "error", "{", "if", "len", "(", "via", ")", ">=", "10", "{", "return", "errors", "....
// AuthedCheckRedirect tries to follow the Influx Enterprise pattern of // redirecting to the leader but preserving authentication headers.
[ "AuthedCheckRedirect", "tries", "to", "follow", "the", "Influx", "Enterprise", "pattern", "of", "redirecting", "to", "the", "leader", "but", "preserving", "authentication", "headers", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L535-L547
123,450
influxdata/influxdb
chronograf/enterprise/meta.go
Do
func (m *MetaClient) Do(ctx context.Context, path, method string, authorizer influx.Authorizer, params map[string]string, body io.Reader) (*http.Response, error) { type result struct { Response *http.Response Err error } resps := make(chan (result)) go func() { resp, err := m.client.Do(m.URL, path, meth...
go
func (m *MetaClient) Do(ctx context.Context, path, method string, authorizer influx.Authorizer, params map[string]string, body io.Reader) (*http.Response, error) { type result struct { Response *http.Response Err error } resps := make(chan (result)) go func() { resp, err := m.client.Do(m.URL, path, meth...
[ "func", "(", "m", "*", "MetaClient", ")", "Do", "(", "ctx", "context", ".", "Context", ",", "path", ",", "method", "string", ",", "authorizer", "influx", ".", "Authorizer", ",", "params", "map", "[", "string", "]", "string", ",", "body", "io", ".", "...
// Do is a cancelable function to interface with Influx Enterprise's Meta API
[ "Do", "is", "a", "cancelable", "function", "to", "interface", "with", "Influx", "Enterprise", "s", "Meta", "API" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/enterprise/meta.go#L550-L568
123,451
influxdata/influxdb
kv/auth.go
CreateAuthorization
func (s *Service) CreateAuthorization(ctx context.Context, a *influxdb.Authorization) error { return s.kv.Update(ctx, func(tx Tx) error { return s.createAuthorization(ctx, tx, a) }) }
go
func (s *Service) CreateAuthorization(ctx context.Context, a *influxdb.Authorization) error { return s.kv.Update(ctx, func(tx Tx) error { return s.createAuthorization(ctx, tx, a) }) }
[ "func", "(", "s", "*", "Service", ")", "CreateAuthorization", "(", "ctx", "context", ".", "Context", ",", "a", "*", "influxdb", ".", "Authorization", ")", "error", "{", "return", "s", ".", "kv", ".", "Update", "(", "ctx", ",", "func", "(", "tx", "Tx"...
// CreateAuthorization creates a influxdb authorization and sets b.ID, and b.UserID if not provided.
[ "CreateAuthorization", "creates", "a", "influxdb", "authorization", "and", "sets", "b", ".", "ID", "and", "b", ".", "UserID", "if", "not", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/auth.go#L244-L248
123,452
influxdata/influxdb
kv/user.go
initializeUsers
func (s *Service) initializeUsers(ctx context.Context, tx Tx) error { if _, err := s.userBucket(tx); err != nil { return err } if _, err := s.userIndexBucket(tx); err != nil { return err } return nil }
go
func (s *Service) initializeUsers(ctx context.Context, tx Tx) error { if _, err := s.userBucket(tx); err != nil { return err } if _, err := s.userIndexBucket(tx); err != nil { return err } return nil }
[ "func", "(", "s", "*", "Service", ")", "initializeUsers", "(", "ctx", "context", ".", "Context", ",", "tx", "Tx", ")", "error", "{", "if", "_", ",", "err", ":=", "s", ".", "userBucket", "(", "tx", ")", ";", "err", "!=", "nil", "{", "return", "err...
// Initialize creates the buckets for the user service.
[ "Initialize", "creates", "the", "buckets", "for", "the", "user", "service", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L22-L31
123,453
influxdata/influxdb
kv/user.go
CreateUser
func (s *Service) CreateUser(ctx context.Context, u *influxdb.User) error { return s.kv.Update(ctx, func(tx Tx) error { return s.createUser(ctx, tx, u) }) }
go
func (s *Service) CreateUser(ctx context.Context, u *influxdb.User) error { return s.kv.Update(ctx, func(tx Tx) error { return s.createUser(ctx, tx, u) }) }
[ "func", "(", "s", "*", "Service", ")", "CreateUser", "(", "ctx", "context", ".", "Context", ",", "u", "*", "influxdb", ".", "User", ")", "error", "{", "return", "s", ".", "kv", ".", "Update", "(", "ctx", ",", "func", "(", "tx", "Tx", ")", "error"...
// CreateUser creates a influxdb user and sets b.ID.
[ "CreateUser", "creates", "a", "influxdb", "user", "and", "sets", "b", ".", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L227-L231
123,454
influxdata/influxdb
kv/user.go
ErrInternalUserServiceError
func ErrInternalUserServiceError(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInternal, Err: err, } }
go
func ErrInternalUserServiceError(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInternal, Err: err, } }
[ "func", "ErrInternalUserServiceError", "(", "err", "error", ")", "*", "influxdb", ".", "Error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EInternal", ",", "Err", ":", "err", ",", "}", "\n", "}" ]
// ErrInternalUserServiceError is used when the error comes from an internal system.
[ "ErrInternalUserServiceError", "is", "used", "when", "the", "error", "comes", "from", "an", "internal", "system", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L530-L535
123,455
influxdata/influxdb
kv/user.go
UserAlreadyExistsError
func UserAlreadyExistsError(n string) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EConflict, Msg: fmt.Sprintf("user with name %s already exists", n), } }
go
func UserAlreadyExistsError(n string) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EConflict, Msg: fmt.Sprintf("user with name %s already exists", n), } }
[ "func", "UserAlreadyExistsError", "(", "n", "string", ")", "*", "influxdb", ".", "Error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EConflict", ",", "Msg", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ...
// UserAlreadyExistsError is used when attempting to create a user with a name // that already exists.
[ "UserAlreadyExistsError", "is", "used", "when", "attempting", "to", "create", "a", "user", "with", "a", "name", "that", "already", "exists", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L539-L544
123,456
influxdata/influxdb
kv/user.go
UnexpectedUserBucketError
func UnexpectedUserBucketError(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInternal, Msg: fmt.Sprintf("unexpected error retrieving user bucket; Err: %v", err), Op: "kv/userBucket", } }
go
func UnexpectedUserBucketError(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInternal, Msg: fmt.Sprintf("unexpected error retrieving user bucket; Err: %v", err), Op: "kv/userBucket", } }
[ "func", "UnexpectedUserBucketError", "(", "err", "error", ")", "*", "influxdb", ".", "Error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EInternal", ",", "Msg", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e...
// UnexpectedUserBucketError is used when the error comes from an internal system.
[ "UnexpectedUserBucketError", "is", "used", "when", "the", "error", "comes", "from", "an", "internal", "system", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L547-L553
123,457
influxdata/influxdb
kv/user.go
InvalidUserIDError
func InvalidUserIDError(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInvalid, Msg: "user id provided is invalid", Err: err, } }
go
func InvalidUserIDError(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInvalid, Msg: "user id provided is invalid", Err: err, } }
[ "func", "InvalidUserIDError", "(", "err", "error", ")", "*", "influxdb", ".", "Error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EInvalid", ",", "Msg", ":", "\"", "\"", ",", "Err", ":", "err", ",", "}", "\n", ...
// InvalidUserIDError is used when a service was provided an invalid ID. // This is some sort of internal server error.
[ "InvalidUserIDError", "is", "used", "when", "a", "service", "was", "provided", "an", "invalid", "ID", ".", "This", "is", "some", "sort", "of", "internal", "server", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L566-L572
123,458
influxdata/influxdb
kv/user.go
ErrCorruptUser
func ErrCorruptUser(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInternal, Msg: "user could not be unmarshalled", Err: err, Op: "kv/UnmarshalUser", } }
go
func ErrCorruptUser(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EInternal, Msg: "user could not be unmarshalled", Err: err, Op: "kv/UnmarshalUser", } }
[ "func", "ErrCorruptUser", "(", "err", "error", ")", "*", "influxdb", ".", "Error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EInternal", ",", "Msg", ":", "\"", "\"", ",", "Err", ":", "err", ",", "Op", ":", "\...
// ErrCorruptUser is used when the user cannot be unmarshalled from the bytes // stored in the kv.
[ "ErrCorruptUser", "is", "used", "when", "the", "user", "cannot", "be", "unmarshalled", "from", "the", "bytes", "stored", "in", "the", "kv", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L585-L592
123,459
influxdata/influxdb
kv/user.go
ErrUnprocessableUser
func ErrUnprocessableUser(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EUnprocessableEntity, Msg: "user could not be marshalled", Err: err, Op: "kv/MarshalUser", } }
go
func ErrUnprocessableUser(err error) *influxdb.Error { return &influxdb.Error{ Code: influxdb.EUnprocessableEntity, Msg: "user could not be marshalled", Err: err, Op: "kv/MarshalUser", } }
[ "func", "ErrUnprocessableUser", "(", "err", "error", ")", "*", "influxdb", ".", "Error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EUnprocessableEntity", ",", "Msg", ":", "\"", "\"", ",", "Err", ":", "err", ",", ...
// ErrUnprocessableUser is used when a user is not able to be processed.
[ "ErrUnprocessableUser", "is", "used", "when", "a", "user", "is", "not", "able", "to", "be", "processed", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/user.go#L595-L602
123,460
influxdata/influxdb
build.go
SetBuildInfo
func SetBuildInfo(version, commit, date string) { buildInfo.Version = version buildInfo.Commit = commit buildInfo.Date = date }
go
func SetBuildInfo(version, commit, date string) { buildInfo.Version = version buildInfo.Commit = commit buildInfo.Date = date }
[ "func", "SetBuildInfo", "(", "version", ",", "commit", ",", "date", "string", ")", "{", "buildInfo", ".", "Version", "=", "version", "\n", "buildInfo", ".", "Commit", "=", "commit", "\n", "buildInfo", ".", "Date", "=", "date", "\n", "}" ]
// SetBuildInfo sets the build information for the binary.
[ "SetBuildInfo", "sets", "the", "build", "information", "for", "the", "binary", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/build.go#L13-L17
123,461
influxdata/influxdb
pkg/rhh/rhh.go
NewHashMap
func NewHashMap(opt Options) *HashMap { if opt.Metrics == nil { opt.Metrics = NewMetrics("", "", nil) } m := &HashMap{ capacity: pow2(opt.Capacity), // Limited to 2^64. loadFactor: opt.LoadFactor, tracker: newRHHTracker(opt.Metrics, opt.Labels), } m.tracker.enabled = opt.MetricsEnabled m.alloc() r...
go
func NewHashMap(opt Options) *HashMap { if opt.Metrics == nil { opt.Metrics = NewMetrics("", "", nil) } m := &HashMap{ capacity: pow2(opt.Capacity), // Limited to 2^64. loadFactor: opt.LoadFactor, tracker: newRHHTracker(opt.Metrics, opt.Labels), } m.tracker.enabled = opt.MetricsEnabled m.alloc() r...
[ "func", "NewHashMap", "(", "opt", "Options", ")", "*", "HashMap", "{", "if", "opt", ".", "Metrics", "==", "nil", "{", "opt", ".", "Metrics", "=", "NewMetrics", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ")", "\n", "}", "\n\n", "m", ":=", "&", ...
// NewHashMap initialises a new Hashmap with the provided options.
[ "NewHashMap", "initialises", "a", "new", "Hashmap", "with", "the", "provided", "options", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L32-L46
123,462
influxdata/influxdb
pkg/rhh/rhh.go
Reset
func (m *HashMap) Reset() { for i := int64(0); i < m.capacity; i++ { m.hashes[i] = 0 m.elems[i].reset() } m.n = 0 m.tracker.SetSize(0) }
go
func (m *HashMap) Reset() { for i := int64(0); i < m.capacity; i++ { m.hashes[i] = 0 m.elems[i].reset() } m.n = 0 m.tracker.SetSize(0) }
[ "func", "(", "m", "*", "HashMap", ")", "Reset", "(", ")", "{", "for", "i", ":=", "int64", "(", "0", ")", ";", "i", "<", "m", ".", "capacity", ";", "i", "++", "{", "m", ".", "hashes", "[", "i", "]", "=", "0", "\n", "m", ".", "elems", "[", ...
// Reset clears the values in the map without deallocating the space.
[ "Reset", "clears", "the", "values", "in", "the", "map", "without", "deallocating", "the", "space", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L49-L56
123,463
influxdata/influxdb
pkg/rhh/rhh.go
Get
func (m *HashMap) Get(key []byte) interface{} { var now time.Time var sample bool if rand.Float64() < 0.1 { now = time.Now() sample = true } i := m.index(key) if sample { m.tracker.ObserveGet(time.Since(now)) } if i == -1 { m.tracker.IncGetMiss() return nil } m.tracker.IncGetHit() return m.elems...
go
func (m *HashMap) Get(key []byte) interface{} { var now time.Time var sample bool if rand.Float64() < 0.1 { now = time.Now() sample = true } i := m.index(key) if sample { m.tracker.ObserveGet(time.Since(now)) } if i == -1 { m.tracker.IncGetMiss() return nil } m.tracker.IncGetHit() return m.elems...
[ "func", "(", "m", "*", "HashMap", ")", "Get", "(", "key", "[", "]", "byte", ")", "interface", "{", "}", "{", "var", "now", "time", ".", "Time", "\n", "var", "sample", "bool", "\n", "if", "rand", ".", "Float64", "(", ")", "<", "0.1", "{", "now",...
// Get returns the value for a key from the Hashmap, or nil if no key exists.
[ "Get", "returns", "the", "value", "for", "a", "key", "from", "the", "Hashmap", "or", "nil", "if", "no", "key", "exists", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L61-L81
123,464
influxdata/influxdb
pkg/rhh/rhh.go
Put
func (m *HashMap) Put(key []byte, val interface{}) { m.put(key, val, true) }
go
func (m *HashMap) Put(key []byte, val interface{}) { m.put(key, val, true) }
[ "func", "(", "m", "*", "HashMap", ")", "Put", "(", "key", "[", "]", "byte", ",", "val", "interface", "{", "}", ")", "{", "m", ".", "put", "(", "key", ",", "val", ",", "true", ")", "\n", "}" ]
// Put stores the value at key in the Hashmap, overwriting an existing value if // one exists. If the maximum load of the Hashmap is reached, the Hashmap will // first resize itself.
[ "Put", "stores", "the", "value", "at", "key", "in", "the", "Hashmap", "overwriting", "an", "existing", "value", "if", "one", "exists", ".", "If", "the", "maximum", "load", "of", "the", "Hashmap", "is", "reached", "the", "Hashmap", "will", "first", "resize"...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L119-L121
123,465
influxdata/influxdb
pkg/rhh/rhh.go
PutQuiet
func (m *HashMap) PutQuiet(key []byte, val interface{}) { m.put(key, val, false) }
go
func (m *HashMap) PutQuiet(key []byte, val interface{}) { m.put(key, val, false) }
[ "func", "(", "m", "*", "HashMap", ")", "PutQuiet", "(", "key", "[", "]", "byte", ",", "val", "interface", "{", "}", ")", "{", "m", ".", "put", "(", "key", ",", "val", ",", "false", ")", "\n", "}" ]
// PutQuiet is equivalent to Put, but no instrumentation code is executed. It can // be faster when many keys are being inserted into the Hashmap.
[ "PutQuiet", "is", "equivalent", "to", "Put", "but", "no", "instrumentation", "code", "is", "executed", ".", "It", "can", "be", "faster", "when", "many", "keys", "are", "being", "inserted", "into", "the", "Hashmap", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L125-L127
123,466
influxdata/influxdb
pkg/rhh/rhh.go
alloc
func (m *HashMap) alloc() { m.elems = make([]hashElem, m.capacity) m.hashes = make([]int64, m.capacity) m.threshold = (m.capacity * int64(m.loadFactor)) / 100 m.mask = int64(m.capacity - 1) }
go
func (m *HashMap) alloc() { m.elems = make([]hashElem, m.capacity) m.hashes = make([]int64, m.capacity) m.threshold = (m.capacity * int64(m.loadFactor)) / 100 m.mask = int64(m.capacity - 1) }
[ "func", "(", "m", "*", "HashMap", ")", "alloc", "(", ")", "{", "m", ".", "elems", "=", "make", "(", "[", "]", "hashElem", ",", "m", ".", "capacity", ")", "\n", "m", ".", "hashes", "=", "make", "(", "[", "]", "int64", ",", "m", ".", "capacity"...
// alloc elems according to currently set capacity.
[ "alloc", "elems", "according", "to", "currently", "set", "capacity", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L179-L184
123,467
influxdata/influxdb
pkg/rhh/rhh.go
Grow
func (m *HashMap) Grow(sz int64) { // Ensure new capacity is a power of two and greater than current capacity. sz = pow2(sz) if sz <= m.capacity { return } // Copy old elements and hashes. elems, hashes := m.elems, m.hashes capacity := m.capacity // Increase capacity & reallocate. m.capacity = sz m.alloc(...
go
func (m *HashMap) Grow(sz int64) { // Ensure new capacity is a power of two and greater than current capacity. sz = pow2(sz) if sz <= m.capacity { return } // Copy old elements and hashes. elems, hashes := m.elems, m.hashes capacity := m.capacity // Increase capacity & reallocate. m.capacity = sz m.alloc(...
[ "func", "(", "m", "*", "HashMap", ")", "Grow", "(", "sz", "int64", ")", "{", "// Ensure new capacity is a power of two and greater than current capacity.", "sz", "=", "pow2", "(", "sz", ")", "\n", "if", "sz", "<=", "m", ".", "capacity", "{", "return", "\n", ...
// Grow increases the capacity and reinserts all existing hashes & elements.
[ "Grow", "increases", "the", "capacity", "and", "reinserts", "all", "existing", "hashes", "&", "elements", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L187-L210
123,468
influxdata/influxdb
pkg/rhh/rhh.go
index
func (m *HashMap) index(key []byte) int64 { hash := HashKey(key) pos := hash & m.mask var dist int64 for { if m.hashes[pos] == 0 { return -1 } else if dist > Dist(m.hashes[pos], pos, m.capacity) { return -1 } else if m.hashes[pos] == hash && bytes.Equal(m.elems[pos].key, key) { return pos } pos...
go
func (m *HashMap) index(key []byte) int64 { hash := HashKey(key) pos := hash & m.mask var dist int64 for { if m.hashes[pos] == 0 { return -1 } else if dist > Dist(m.hashes[pos], pos, m.capacity) { return -1 } else if m.hashes[pos] == hash && bytes.Equal(m.elems[pos].key, key) { return pos } pos...
[ "func", "(", "m", "*", "HashMap", ")", "index", "(", "key", "[", "]", "byte", ")", "int64", "{", "hash", ":=", "HashKey", "(", "key", ")", "\n", "pos", ":=", "hash", "&", "m", ".", "mask", "\n\n", "var", "dist", "int64", "\n", "for", "{", "if",...
// index returns the position of key in the hash map.
[ "index", "returns", "the", "position", "of", "key", "in", "the", "hash", "map", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L213-L230
123,469
influxdata/influxdb
pkg/rhh/rhh.go
AverageProbeCount
func (m *HashMap) AverageProbeCount() float64 { var sum float64 for i := int64(0); i < m.capacity; i++ { hash := m.hashes[i] if hash == 0 { continue } sum += float64(Dist(hash, i, m.capacity)) } return sum / (float64(m.n) + 1.0) }
go
func (m *HashMap) AverageProbeCount() float64 { var sum float64 for i := int64(0); i < m.capacity; i++ { hash := m.hashes[i] if hash == 0 { continue } sum += float64(Dist(hash, i, m.capacity)) } return sum / (float64(m.n) + 1.0) }
[ "func", "(", "m", "*", "HashMap", ")", "AverageProbeCount", "(", ")", "float64", "{", "var", "sum", "float64", "\n", "for", "i", ":=", "int64", "(", "0", ")", ";", "i", "<", "m", ".", "capacity", ";", "i", "++", "{", "hash", ":=", "m", ".", "ha...
// AverageProbeCount returns the average number of probes for each element.
[ "AverageProbeCount", "returns", "the", "average", "number", "of", "probes", "for", "each", "element", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L249-L259
123,470
influxdata/influxdb
pkg/rhh/rhh.go
Keys
func (m *HashMap) Keys() [][]byte { a := make([][]byte, 0, m.Len()) for i := int64(0); i < m.Cap(); i++ { k, v := m.Elem(i) if v == nil { continue } a = append(a, k) } sort.Sort(byteSlices(a)) return a }
go
func (m *HashMap) Keys() [][]byte { a := make([][]byte, 0, m.Len()) for i := int64(0); i < m.Cap(); i++ { k, v := m.Elem(i) if v == nil { continue } a = append(a, k) } sort.Sort(byteSlices(a)) return a }
[ "func", "(", "m", "*", "HashMap", ")", "Keys", "(", ")", "[", "]", "[", "]", "byte", "{", "a", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "0", ",", "m", ".", "Len", "(", ")", ")", "\n", "for", "i", ":=", "int64", "(", "0", ")",...
// Keys returns a list of sorted keys.
[ "Keys", "returns", "a", "list", "of", "sorted", "keys", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L262-L273
123,471
influxdata/influxdb
pkg/rhh/rhh.go
reset
func (e *hashElem) reset() { e.key = e.key[:0] e.value = nil e.hash = 0 }
go
func (e *hashElem) reset() { e.key = e.key[:0] e.value = nil e.hash = 0 }
[ "func", "(", "e", "*", "hashElem", ")", "reset", "(", ")", "{", "e", ".", "key", "=", "e", ".", "key", "[", ":", "0", "]", "\n", "e", ".", "value", "=", "nil", "\n", "e", ".", "hash", "=", "0", "\n", "}" ]
// reset clears the values in the element.
[ "reset", "clears", "the", "values", "in", "the", "element", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L390-L394
123,472
influxdata/influxdb
pkg/rhh/rhh.go
setKey
func (e *hashElem) setKey(v []byte) { e.key = assign(e.key, v) }
go
func (e *hashElem) setKey(v []byte) { e.key = assign(e.key, v) }
[ "func", "(", "e", "*", "hashElem", ")", "setKey", "(", "v", "[", "]", "byte", ")", "{", "e", ".", "key", "=", "assign", "(", "e", ".", "key", ",", "v", ")", "\n", "}" ]
// setKey copies v to a key on e.
[ "setKey", "copies", "v", "to", "a", "key", "on", "e", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L397-L399
123,473
influxdata/influxdb
pkg/rhh/rhh.go
HashKey
func HashKey(key []byte) int64 { h := int64(xxhash.Sum64(key)) if h == 0 { h = 1 } else if h < 0 { h = 0 - h } return h }
go
func HashKey(key []byte) int64 { h := int64(xxhash.Sum64(key)) if h == 0 { h = 1 } else if h < 0 { h = 0 - h } return h }
[ "func", "HashKey", "(", "key", "[", "]", "byte", ")", "int64", "{", "h", ":=", "int64", "(", "xxhash", ".", "Sum64", "(", "key", ")", ")", "\n", "if", "h", "==", "0", "{", "h", "=", "1", "\n", "}", "else", "if", "h", "<", "0", "{", "h", "...
// HashKey computes a hash of key. Hash is always non-zero.
[ "HashKey", "computes", "a", "hash", "of", "key", ".", "Hash", "is", "always", "non", "-", "zero", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L418-L426
123,474
influxdata/influxdb
pkg/rhh/rhh.go
HashUint64
func HashUint64(key uint64) int64 { buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, key) return HashKey(buf) }
go
func HashUint64(key uint64) int64 { buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, key) return HashKey(buf) }
[ "func", "HashUint64", "(", "key", "uint64", ")", "int64", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "8", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint64", "(", "buf", ",", "key", ")", "\n", "return", "HashKey", "(", "buf", ")", ...
// HashUint64 computes a hash of an int64. Hash is always non-zero.
[ "HashUint64", "computes", "a", "hash", "of", "an", "int64", ".", "Hash", "is", "always", "non", "-", "zero", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L429-L433
123,475
influxdata/influxdb
pkg/rhh/rhh.go
pow2
func pow2(v int64) int64 { for i := int64(2); i < 1<<62; i *= 2 { if i >= v { return i } } panic("unreachable") }
go
func pow2(v int64) int64 { for i := int64(2); i < 1<<62; i *= 2 { if i >= v { return i } } panic("unreachable") }
[ "func", "pow2", "(", "v", "int64", ")", "int64", "{", "for", "i", ":=", "int64", "(", "2", ")", ";", "i", "<", "1", "<<", "62", ";", "i", "*=", "2", "{", "if", "i", ">=", "v", "{", "return", "i", "\n", "}", "\n", "}", "\n", "panic", "(", ...
// pow2 returns the number that is the next highest power of 2. // Returns v if it is a power of 2.
[ "pow2", "returns", "the", "number", "that", "is", "the", "next", "highest", "power", "of", "2", ".", "Returns", "v", "if", "it", "is", "a", "power", "of", "2", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/rhh.go#L445-L452
123,476
influxdata/influxdb
chronograf/multistore/sources.go
All
func (multi *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) { all := []chronograf.Source{} sourceSet := map[int]struct{}{} ok := false var err error for _, store := range multi.Stores { var sources []chronograf.Source sources, err = store.All(ctx) if err != nil { // If this Store is ...
go
func (multi *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) { all := []chronograf.Source{} sourceSet := map[int]struct{}{} ok := false var err error for _, store := range multi.Stores { var sources []chronograf.Source sources, err = store.All(ctx) if err != nil { // If this Store is ...
[ "func", "(", "multi", "*", "SourcesStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Source", ",", "error", ")", "{", "all", ":=", "[", "]", "chronograf", ".", "Source", "{", "}", "\n", "sourceSet", ...
// All concatenates the Sources of all contained Stores
[ "All", "concatenates", "the", "Sources", "of", "all", "contained", "Stores" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/sources.go#L18-L46
123,477
influxdata/influxdb
chronograf/multistore/sources.go
Add
func (multi *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) { var err error for _, store := range multi.Stores { var s chronograf.Source s, err = store.Add(ctx, src) if err == nil { return s, nil } } return chronograf.Source{}, nil }
go
func (multi *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) { var err error for _, store := range multi.Stores { var s chronograf.Source s, err = store.Add(ctx, src) if err == nil { return s, nil } } return chronograf.Source{}, nil }
[ "func", "(", "multi", "*", "SourcesStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "var", "err", "error", "\n", "for", "_", ",", "store...
// Add the src to the first Store to respond successfully
[ "Add", "the", "src", "to", "the", "first", "Store", "to", "respond", "successfully" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/sources.go#L49-L59
123,478
influxdata/influxdb
chronograf/multistore/sources.go
Update
func (multi *SourcesStore) Update(ctx context.Context, src chronograf.Source) error { var err error for _, store := range multi.Stores { err = store.Update(ctx, src) if err == nil { return nil } } return err }
go
func (multi *SourcesStore) Update(ctx context.Context, src chronograf.Source) error { var err error for _, store := range multi.Stores { err = store.Update(ctx, src) if err == nil { return nil } } return err }
[ "func", "(", "multi", "*", "SourcesStore", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ")", "error", "{", "var", "err", "error", "\n", "for", "_", ",", "store", ":=", "range", "multi", ".", "Stores", ...
// Update the first store to return a successful response
[ "Update", "the", "first", "store", "to", "return", "a", "successful", "response" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/sources.go#L87-L96
123,479
influxdata/influxdb
pkg/metrics/context.go
NewContextWithGroup
func NewContextWithGroup(ctx context.Context, c *Group) context.Context { return context.WithValue(ctx, groupKey, c) }
go
func NewContextWithGroup(ctx context.Context, c *Group) context.Context { return context.WithValue(ctx, groupKey, c) }
[ "func", "NewContextWithGroup", "(", "ctx", "context", ".", "Context", ",", "c", "*", "Group", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "groupKey", ",", "c", ")", "\n", "}" ]
// NewContextWithGroup returns a new context with the given Group added.
[ "NewContextWithGroup", "returns", "a", "new", "context", "with", "the", "given", "Group", "added", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/context.go#L12-L14
123,480
influxdata/influxdb
pkg/metrics/context.go
GroupFromContext
func GroupFromContext(ctx context.Context) *Group { c, _ := ctx.Value(groupKey).(*Group) return c }
go
func GroupFromContext(ctx context.Context) *Group { c, _ := ctx.Value(groupKey).(*Group) return c }
[ "func", "GroupFromContext", "(", "ctx", "context", ".", "Context", ")", "*", "Group", "{", "c", ",", "_", ":=", "ctx", ".", "Value", "(", "groupKey", ")", ".", "(", "*", "Group", ")", "\n", "return", "c", "\n", "}" ]
// GroupFromContext returns the Group associated with ctx or nil if no Group has been assigned.
[ "GroupFromContext", "returns", "the", "Group", "associated", "with", "ctx", "or", "nil", "if", "no", "Group", "has", "been", "assigned", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/context.go#L17-L20
123,481
influxdata/influxdb
models/time.go
SafeCalcTime
func SafeCalcTime(timestamp int64, precision string) (time.Time, error) { mult := GetPrecisionMultiplier(precision) if t, ok := safeSignedMult(timestamp, mult); ok { tme := time.Unix(0, t).UTC() return tme, CheckTime(tme) } return time.Time{}, ErrTimeOutOfRange }
go
func SafeCalcTime(timestamp int64, precision string) (time.Time, error) { mult := GetPrecisionMultiplier(precision) if t, ok := safeSignedMult(timestamp, mult); ok { tme := time.Unix(0, t).UTC() return tme, CheckTime(tme) } return time.Time{}, ErrTimeOutOfRange }
[ "func", "SafeCalcTime", "(", "timestamp", "int64", ",", "precision", "string", ")", "(", "time", ".", "Time", ",", "error", ")", "{", "mult", ":=", "GetPrecisionMultiplier", "(", "precision", ")", "\n", "if", "t", ",", "ok", ":=", "safeSignedMult", "(", ...
// SafeCalcTime safely calculates the time given. Will return error if the time is outside the // supported range.
[ "SafeCalcTime", "safely", "calculates", "the", "time", "given", ".", "Will", "return", "error", "if", "the", "time", "is", "outside", "the", "supported", "range", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/time.go#L46-L54
123,482
influxdata/influxdb
models/time.go
CheckTime
func CheckTime(t time.Time) error { if t.Before(minNanoTime) || t.After(maxNanoTime) { return ErrTimeOutOfRange } return nil }
go
func CheckTime(t time.Time) error { if t.Before(minNanoTime) || t.After(maxNanoTime) { return ErrTimeOutOfRange } return nil }
[ "func", "CheckTime", "(", "t", "time", ".", "Time", ")", "error", "{", "if", "t", ".", "Before", "(", "minNanoTime", ")", "||", "t", ".", "After", "(", "maxNanoTime", ")", "{", "return", "ErrTimeOutOfRange", "\n", "}", "\n", "return", "nil", "\n", "}...
// CheckTime checks that a time is within the safe range.
[ "CheckTime", "checks", "that", "a", "time", "is", "within", "the", "safe", "range", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/time.go#L57-L62
123,483
influxdata/influxdb
models/time.go
safeSignedMult
func safeSignedMult(a, b int64) (int64, bool) { if a == 0 || b == 0 || a == 1 || b == 1 { return a * b, true } if a == MinNanoTime || b == MaxNanoTime { return 0, false } c := a * b return c, c/b == a }
go
func safeSignedMult(a, b int64) (int64, bool) { if a == 0 || b == 0 || a == 1 || b == 1 { return a * b, true } if a == MinNanoTime || b == MaxNanoTime { return 0, false } c := a * b return c, c/b == a }
[ "func", "safeSignedMult", "(", "a", ",", "b", "int64", ")", "(", "int64", ",", "bool", ")", "{", "if", "a", "==", "0", "||", "b", "==", "0", "||", "a", "==", "1", "||", "b", "==", "1", "{", "return", "a", "*", "b", ",", "true", "\n", "}", ...
// Perform the multiplication and check to make sure it didn't overflow.
[ "Perform", "the", "multiplication", "and", "check", "to", "make", "sure", "it", "didn", "t", "overflow", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/time.go#L65-L74
123,484
influxdata/influxdb
storage/engine.go
WithTSMFilenameFormatter
func WithTSMFilenameFormatter(fn tsm1.FormatFileNameFunc) Option { return func(e *Engine) { e.engine.WithFormatFileNameFunc(fn) } }
go
func WithTSMFilenameFormatter(fn tsm1.FormatFileNameFunc) Option { return func(e *Engine) { e.engine.WithFormatFileNameFunc(fn) } }
[ "func", "WithTSMFilenameFormatter", "(", "fn", "tsm1", ".", "FormatFileNameFunc", ")", "Option", "{", "return", "func", "(", "e", "*", "Engine", ")", "{", "e", ".", "engine", ".", "WithFormatFileNameFunc", "(", "fn", ")", "\n", "}", "\n", "}" ]
// WithTSMFilenameFormatter sets a function on the underlying tsm1.Engine to specify // how TSM files are named.
[ "WithTSMFilenameFormatter", "sets", "a", "function", "on", "the", "underlying", "tsm1", ".", "Engine", "to", "specify", "how", "TSM", "files", "are", "named", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L60-L64
123,485
influxdata/influxdb
storage/engine.go
WithEngineID
func WithEngineID(id int) Option { return func(e *Engine) { e.engineID = &id e.defaultMetricLabels["engine_id"] = fmt.Sprint(*e.engineID) } }
go
func WithEngineID(id int) Option { return func(e *Engine) { e.engineID = &id e.defaultMetricLabels["engine_id"] = fmt.Sprint(*e.engineID) } }
[ "func", "WithEngineID", "(", "id", "int", ")", "Option", "{", "return", "func", "(", "e", "*", "Engine", ")", "{", "e", ".", "engineID", "=", "&", "id", "\n", "e", ".", "defaultMetricLabels", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", ...
// WithEngineID sets an engine id, which can be useful for logging when multiple // engines are in use.
[ "WithEngineID", "sets", "an", "engine", "id", "which", "can", "be", "useful", "for", "logging", "when", "multiple", "engines", "are", "in", "use", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L68-L73
123,486
influxdata/influxdb
storage/engine.go
WithNodeID
func WithNodeID(id int) Option { return func(e *Engine) { e.nodeID = &id e.defaultMetricLabels["node_id"] = fmt.Sprint(*e.nodeID) } }
go
func WithNodeID(id int) Option { return func(e *Engine) { e.nodeID = &id e.defaultMetricLabels["node_id"] = fmt.Sprint(*e.nodeID) } }
[ "func", "WithNodeID", "(", "id", "int", ")", "Option", "{", "return", "func", "(", "e", "*", "Engine", ")", "{", "e", ".", "nodeID", "=", "&", "id", "\n", "e", ".", "defaultMetricLabels", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "*",...
// WithNodeID sets a node id on the engine, which can be useful for logging // when a system has engines running on multiple nodes.
[ "WithNodeID", "sets", "a", "node", "id", "on", "the", "engine", "which", "can", "be", "useful", "for", "logging", "when", "a", "system", "has", "engines", "running", "on", "multiple", "nodes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L77-L82
123,487
influxdata/influxdb
storage/engine.go
WithRetentionEnforcer
func WithRetentionEnforcer(finder BucketFinder) Option { return func(e *Engine) { e.retentionEnforcer = newRetentionEnforcer(e, finder) } }
go
func WithRetentionEnforcer(finder BucketFinder) Option { return func(e *Engine) { e.retentionEnforcer = newRetentionEnforcer(e, finder) } }
[ "func", "WithRetentionEnforcer", "(", "finder", "BucketFinder", ")", "Option", "{", "return", "func", "(", "e", "*", "Engine", ")", "{", "e", ".", "retentionEnforcer", "=", "newRetentionEnforcer", "(", "e", ",", "finder", ")", "\n", "}", "\n", "}" ]
// WithRetentionEnforcer initialises a retention enforcer on the engine. // WithRetentionEnforcer must be called after other options to ensure that all // metrics are labelled correctly.
[ "WithRetentionEnforcer", "initialises", "a", "retention", "enforcer", "on", "the", "engine", ".", "WithRetentionEnforcer", "must", "be", "called", "after", "other", "options", "to", "ensure", "that", "all", "metrics", "are", "labelled", "correctly", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L87-L91
123,488
influxdata/influxdb
storage/engine.go
WithFileStoreObserver
func WithFileStoreObserver(obs tsm1.FileStoreObserver) Option { return func(e *Engine) { e.engine.WithFileStoreObserver(obs) } }
go
func WithFileStoreObserver(obs tsm1.FileStoreObserver) Option { return func(e *Engine) { e.engine.WithFileStoreObserver(obs) } }
[ "func", "WithFileStoreObserver", "(", "obs", "tsm1", ".", "FileStoreObserver", ")", "Option", "{", "return", "func", "(", "e", "*", "Engine", ")", "{", "e", ".", "engine", ".", "WithFileStoreObserver", "(", "obs", ")", "\n", "}", "\n", "}" ]
// WithFileStoreObserver makes the engine have the provided file store observer.
[ "WithFileStoreObserver", "makes", "the", "engine", "have", "the", "provided", "file", "store", "observer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L94-L98
123,489
influxdata/influxdb
storage/engine.go
WithCompactionPlanner
func WithCompactionPlanner(planner tsm1.CompactionPlanner) Option { return func(e *Engine) { e.engine.WithCompactionPlanner(planner) } }
go
func WithCompactionPlanner(planner tsm1.CompactionPlanner) Option { return func(e *Engine) { e.engine.WithCompactionPlanner(planner) } }
[ "func", "WithCompactionPlanner", "(", "planner", "tsm1", ".", "CompactionPlanner", ")", "Option", "{", "return", "func", "(", "e", "*", "Engine", ")", "{", "e", ".", "engine", ".", "WithCompactionPlanner", "(", "planner", ")", "\n", "}", "\n", "}" ]
// WithCompactionPlanner makes the engine have the provided compaction planner.
[ "WithCompactionPlanner", "makes", "the", "engine", "have", "the", "provided", "compaction", "planner", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L101-L105
123,490
influxdata/influxdb
storage/engine.go
replayWAL
func (e *Engine) replayWAL() error { if !e.config.WAL.Enabled { return nil } now := time.Now() walPaths, err := wal.SegmentFileNames(e.wal.Path()) if err != nil { return err } // TODO(jeff): we should just do snapshots and wait for them so that we don't hit // OOM situations when reloading huge WALs. //...
go
func (e *Engine) replayWAL() error { if !e.config.WAL.Enabled { return nil } now := time.Now() walPaths, err := wal.SegmentFileNames(e.wal.Path()) if err != nil { return err } // TODO(jeff): we should just do snapshots and wait for them so that we don't hit // OOM situations when reloading huge WALs. //...
[ "func", "(", "e", "*", "Engine", ")", "replayWAL", "(", ")", "error", "{", "if", "!", "e", ".", "config", ".", "WAL", ".", "Enabled", "{", "return", "nil", "\n", "}", "\n", "now", ":=", "time", ".", "Now", "(", ")", "\n\n", "walPaths", ",", "er...
// replayWAL reads the WAL segment files and replays them.
[ "replayWAL", "reads", "the", "WAL", "segment", "files", "and", "replays", "them", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L221-L266
123,491
influxdata/influxdb
storage/engine.go
runRetentionEnforcer
func (e *Engine) runRetentionEnforcer() { interval := time.Duration(e.config.RetentionInterval) if interval == 0 { e.logger.Info("Retention enforcer disabled") return // Enforcer disabled. } else if interval < 0 { e.logger.Error("Negative retention interval", logger.DurationLiteral("check_interval", interval)...
go
func (e *Engine) runRetentionEnforcer() { interval := time.Duration(e.config.RetentionInterval) if interval == 0 { e.logger.Info("Retention enforcer disabled") return // Enforcer disabled. } else if interval < 0 { e.logger.Error("Negative retention interval", logger.DurationLiteral("check_interval", interval)...
[ "func", "(", "e", "*", "Engine", ")", "runRetentionEnforcer", "(", ")", "{", "interval", ":=", "time", ".", "Duration", "(", "e", ".", "config", ".", "RetentionInterval", ")", "\n\n", "if", "interval", "==", "0", "{", "e", ".", "logger", ".", "Info", ...
// runRetentionEnforcer runs the retention enforcer in a separate goroutine. // // Currently this just runs on an interval, but in the future we will add the // ability to reschedule the retention enforcement if there are not enough // resources available.
[ "runRetentionEnforcer", "runs", "the", "retention", "enforcer", "in", "a", "separate", "goroutine", ".", "Currently", "this", "just", "runs", "on", "an", "interval", "but", "in", "the", "future", "we", "will", "add", "the", "ability", "to", "reschedule", "the"...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L273-L303
123,492
influxdata/influxdb
storage/engine.go
CreateSeriesCursor
func (e *Engine) CreateSeriesCursor(ctx context.Context, req SeriesCursorRequest, cond influxql.Expr) (SeriesCursor, error) { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return nil, ErrEngineClosed } return newSeriesCursor(req, e.index, e.sfile, cond) }
go
func (e *Engine) CreateSeriesCursor(ctx context.Context, req SeriesCursorRequest, cond influxql.Expr) (SeriesCursor, error) { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return nil, ErrEngineClosed } return newSeriesCursor(req, e.index, e.sfile, cond) }
[ "func", "(", "e", "*", "Engine", ")", "CreateSeriesCursor", "(", "ctx", "context", ".", "Context", ",", "req", "SeriesCursorRequest", ",", "cond", "influxql", ".", "Expr", ")", "(", "SeriesCursor", ",", "error", ")", "{", "e", ".", "mu", ".", "RLock", ...
// CreateSeriesCursor creates a SeriesCursor for usage with the read service.
[ "CreateSeriesCursor", "creates", "a", "SeriesCursor", "for", "usage", "with", "the", "read", "service", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L332-L340
123,493
influxdata/influxdb
storage/engine.go
CreateCursorIterator
func (e *Engine) CreateCursorIterator(ctx context.Context) (tsdb.CursorIterator, error) { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return nil, ErrEngineClosed } return e.engine.CreateCursorIterator(ctx) }
go
func (e *Engine) CreateCursorIterator(ctx context.Context) (tsdb.CursorIterator, error) { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return nil, ErrEngineClosed } return e.engine.CreateCursorIterator(ctx) }
[ "func", "(", "e", "*", "Engine", ")", "CreateCursorIterator", "(", "ctx", "context", ".", "Context", ")", "(", "tsdb", ".", "CursorIterator", ",", "error", ")", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "RUnlo...
// CreateCursorIterator creates a CursorIterator for usage with the read service.
[ "CreateCursorIterator", "creates", "a", "CursorIterator", "for", "usage", "with", "the", "read", "service", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L343-L350
123,494
influxdata/influxdb
storage/engine.go
WritePoints
func (e *Engine) WritePoints(ctx context.Context, points []models.Point) error { span, ctx := tracing.StartSpanFromContext(ctx) defer span.Finish() collection, j := tsdb.NewSeriesCollection(points), 0 // dropPoint should be called whenever there is reason to drop a point from // the batch. dropPoint := func(key...
go
func (e *Engine) WritePoints(ctx context.Context, points []models.Point) error { span, ctx := tracing.StartSpanFromContext(ctx) defer span.Finish() collection, j := tsdb.NewSeriesCollection(points), 0 // dropPoint should be called whenever there is reason to drop a point from // the batch. dropPoint := func(key...
[ "func", "(", "e", "*", "Engine", ")", "WritePoints", "(", "ctx", "context", ".", "Context", ",", "points", "[", "]", "models", ".", "Point", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "ctx", ")", "\n", "...
// WritePoints writes the provided points to the engine. // // The Engine expects all points to have been correctly validated by the caller. // However, WritePoints will determine if any tag key-pairs are missing, or if // there are any field type conflicts. // // Appropriate errors are returned in those cases.
[ "WritePoints", "writes", "the", "provided", "points", "to", "the", "engine", ".", "The", "Engine", "expects", "all", "points", "to", "have", "been", "correctly", "validated", "by", "the", "caller", ".", "However", "WritePoints", "will", "determine", "if", "any...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L359-L441
123,495
influxdata/influxdb
storage/engine.go
writePointsLocked
func (e *Engine) writePointsLocked(ctx context.Context, collection *tsdb.SeriesCollection, values map[string][]value.Value) error { span, _ := tracing.StartSpanFromContext(ctx) defer span.Finish() // TODO(jeff): keep track of the values in the collection so that partial write // errors get tracked all the way. Rig...
go
func (e *Engine) writePointsLocked(ctx context.Context, collection *tsdb.SeriesCollection, values map[string][]value.Value) error { span, _ := tracing.StartSpanFromContext(ctx) defer span.Finish() // TODO(jeff): keep track of the values in the collection so that partial write // errors get tracked all the way. Rig...
[ "func", "(", "e", "*", "Engine", ")", "writePointsLocked", "(", "ctx", "context", ".", "Context", ",", "collection", "*", "tsdb", ".", "SeriesCollection", ",", "values", "map", "[", "string", "]", "[", "]", "value", ".", "Value", ")", "error", "{", "sp...
// writePointsLocked does the work of writing points and must be called under some sort of lock.
[ "writePointsLocked", "does", "the", "work", "of", "writing", "points", "and", "must", "be", "called", "under", "some", "sort", "of", "lock", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L444-L473
123,496
influxdata/influxdb
storage/engine.go
AcquireSegments
func (e *Engine) AcquireSegments(ctx context.Context, fn func(segs []string) error) error { span, _ := tracing.StartSpanFromContext(ctx) defer span.Finish() e.mu.Lock() defer e.mu.Unlock() if err := e.wal.CloseSegment(); err != nil { return err } segments, err := e.wal.ClosedSegments() if err != nil { re...
go
func (e *Engine) AcquireSegments(ctx context.Context, fn func(segs []string) error) error { span, _ := tracing.StartSpanFromContext(ctx) defer span.Finish() e.mu.Lock() defer e.mu.Unlock() if err := e.wal.CloseSegment(); err != nil { return err } segments, err := e.wal.ClosedSegments() if err != nil { re...
[ "func", "(", "e", "*", "Engine", ")", "AcquireSegments", "(", "ctx", "context", ".", "Context", ",", "fn", "func", "(", "segs", "[", "]", "string", ")", "error", ")", "error", "{", "span", ",", "_", ":=", "tracing", ".", "StartSpanFromContext", "(", ...
// AcquireSegments closes the current WAL segment, gets the set of all the currently closed // segments, and calls the callback. It does all of this under the lock on the engine.
[ "AcquireSegments", "closes", "the", "current", "WAL", "segment", "gets", "the", "set", "of", "all", "the", "currently", "closed", "segments", "and", "calls", "the", "callback", ".", "It", "does", "all", "of", "this", "under", "the", "lock", "on", "the", "e...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L477-L494
123,497
influxdata/influxdb
storage/engine.go
CommitSegments
func (e *Engine) CommitSegments(ctx context.Context, segs []string, fn func() error) error { e.mu.Lock() defer e.mu.Unlock() if err := fn(); err != nil { return err } return e.wal.Remove(ctx, segs) }
go
func (e *Engine) CommitSegments(ctx context.Context, segs []string, fn func() error) error { e.mu.Lock() defer e.mu.Unlock() if err := fn(); err != nil { return err } return e.wal.Remove(ctx, segs) }
[ "func", "(", "e", "*", "Engine", ")", "CommitSegments", "(", "ctx", "context", ".", "Context", ",", "segs", "[", "]", "string", ",", "fn", "func", "(", ")", "error", ")", "error", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ...
// CommitSegments calls the callback and if that does not return an error, removes the segment // files from the WAL. It does all of this under the lock on the engine.
[ "CommitSegments", "calls", "the", "callback", "and", "if", "that", "does", "not", "return", "an", "error", "removes", "the", "segment", "files", "from", "the", "WAL", ".", "It", "does", "all", "of", "this", "under", "the", "lock", "on", "the", "engine", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L498-L507
123,498
influxdata/influxdb
storage/engine.go
DeleteBucketRange
func (e *Engine) DeleteBucketRange(orgID, bucketID platform.ID, min, max int64) error { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return ErrEngineClosed } // Add the delete to the WAL to be replayed if there is a crash or shutdown. if _, err := e.wal.DeleteBucketRange(orgID, bucketID, min, max); ...
go
func (e *Engine) DeleteBucketRange(orgID, bucketID platform.ID, min, max int64) error { e.mu.RLock() defer e.mu.RUnlock() if e.closing == nil { return ErrEngineClosed } // Add the delete to the WAL to be replayed if there is a crash or shutdown. if _, err := e.wal.DeleteBucketRange(orgID, bucketID, min, max); ...
[ "func", "(", "e", "*", "Engine", ")", "DeleteBucketRange", "(", "orgID", ",", "bucketID", "platform", ".", "ID", ",", "min", ",", "max", "int64", ")", "error", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "RUnl...
// DeleteBucketRange deletes an entire bucket from the storage engine.
[ "DeleteBucketRange", "deletes", "an", "entire", "bucket", "from", "the", "storage", "engine", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L515-L528
123,499
influxdata/influxdb
storage/engine.go
deleteBucketRangeLocked
func (e *Engine) deleteBucketRangeLocked(orgID, bucketID platform.ID, min, max int64) error { // TODO(edd): we need to clean up how we're encoding the prefix so that we // don't have to remember to get it right everywhere we need to touch TSM data. encoded := tsdb.EncodeName(orgID, bucketID) name := models.EscapeMe...
go
func (e *Engine) deleteBucketRangeLocked(orgID, bucketID platform.ID, min, max int64) error { // TODO(edd): we need to clean up how we're encoding the prefix so that we // don't have to remember to get it right everywhere we need to touch TSM data. encoded := tsdb.EncodeName(orgID, bucketID) name := models.EscapeMe...
[ "func", "(", "e", "*", "Engine", ")", "deleteBucketRangeLocked", "(", "orgID", ",", "bucketID", "platform", ".", "ID", ",", "min", ",", "max", "int64", ")", "error", "{", "// TODO(edd): we need to clean up how we're encoding the prefix so that we", "// don't have to rem...
// deleteBucketRangeLocked does the work of deleting a bucket range and must be called under // some sort of lock.
[ "deleteBucketRangeLocked", "does", "the", "work", "of", "deleting", "a", "bucket", "range", "and", "must", "be", "called", "under", "some", "sort", "of", "lock", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine.go#L532-L539