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,900
influxdata/influxdb
prometheus/auth_service.go
PrometheusCollectors
func (s *AuthorizationService) PrometheusCollectors() []prometheus.Collector { return []prometheus.Collector{ s.requestCount, s.requestDuration, } }
go
func (s *AuthorizationService) PrometheusCollectors() []prometheus.Collector { return []prometheus.Collector{ s.requestCount, s.requestDuration, } }
[ "func", "(", "s", "*", "AuthorizationService", ")", "PrometheusCollectors", "(", ")", "[", "]", "prometheus", ".", "Collector", "{", "return", "[", "]", "prometheus", ".", "Collector", "{", "s", ".", "requestCount", ",", "s", ".", "requestDuration", ",", "...
// PrometheusCollectors returns all authorization service prometheus collectors.
[ "PrometheusCollectors", "returns", "all", "authorization", "service", "prometheus", "collectors", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/auth_service.go#L127-L132
123,901
influxdata/influxdb
snowflake/id.go
SetGlobalMachineID
func SetGlobalMachineID(id int) error { if id > 1023 || id < 0 { return ErrGlobalIDBadVal } globalmachineID.Lock() globalmachineID.id = id globalmachineID.set = true globalmachineID.Unlock() return nil }
go
func SetGlobalMachineID(id int) error { if id > 1023 || id < 0 { return ErrGlobalIDBadVal } globalmachineID.Lock() globalmachineID.id = id globalmachineID.set = true globalmachineID.Unlock() return nil }
[ "func", "SetGlobalMachineID", "(", "id", "int", ")", "error", "{", "if", "id", ">", "1023", "||", "id", "<", "0", "{", "return", "ErrGlobalIDBadVal", "\n", "}", "\n", "globalmachineID", ".", "Lock", "(", ")", "\n", "globalmachineID", ".", "id", "=", "i...
// SetGlobalMachineID returns the global machine id. This number is limited to a number between 0 and 1023 inclusive.
[ "SetGlobalMachineID", "returns", "the", "global", "machine", "id", ".", "This", "number", "is", "limited", "to", "a", "number", "between", "0", "and", "1023", "inclusive", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/snowflake/id.go#L28-L37
123,902
influxdata/influxdb
snowflake/id.go
GlobalMachineID
func GlobalMachineID() int { var id int globalmachineID.RLock() id = int(globalmachineID.id) globalmachineID.RUnlock() return id }
go
func GlobalMachineID() int { var id int globalmachineID.RLock() id = int(globalmachineID.id) globalmachineID.RUnlock() return id }
[ "func", "GlobalMachineID", "(", ")", "int", "{", "var", "id", "int", "\n", "globalmachineID", ".", "RLock", "(", ")", "\n", "id", "=", "int", "(", "globalmachineID", ".", "id", ")", "\n", "globalmachineID", ".", "RUnlock", "(", ")", "\n", "return", "id...
// GlobalMachineID returns the global machine id. This number is limited to a number between 0 and 1023 inclusive.
[ "GlobalMachineID", "returns", "the", "global", "machine", "id", ".", "This", "number", "is", "limited", "to", "a", "number", "between", "0", "and", "1023", "inclusive", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/snowflake/id.go#L40-L46
123,903
influxdata/influxdb
snowflake/id.go
WithMachineID
func WithMachineID(machineID int) IDGeneratorOp { return func(g *IDGenerator) { g.Generator = snowflake.New(machineID & 1023) } }
go
func WithMachineID(machineID int) IDGeneratorOp { return func(g *IDGenerator) { g.Generator = snowflake.New(machineID & 1023) } }
[ "func", "WithMachineID", "(", "machineID", "int", ")", "IDGeneratorOp", "{", "return", "func", "(", "g", "*", "IDGenerator", ")", "{", "g", ".", "Generator", "=", "snowflake", ".", "New", "(", "machineID", "&", "1023", ")", "\n", "}", "\n", "}" ]
// WithMachineID uses the low 12 bits of machineID to set the machine ID for the snowflake ID.
[ "WithMachineID", "uses", "the", "low", "12", "bits", "of", "machineID", "to", "set", "the", "machine", "ID", "for", "the", "snowflake", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/snowflake/id.go#L68-L72
123,904
influxdata/influxdb
snowflake/id.go
NewIDGenerator
func NewIDGenerator(opts ...IDGeneratorOp) *IDGenerator { gen := &IDGenerator{} for _, f := range opts { f(gen) } if gen.Generator == nil { gen.Generator = snowflake.New(rand.Intn(1023)) } return gen }
go
func NewIDGenerator(opts ...IDGeneratorOp) *IDGenerator { gen := &IDGenerator{} for _, f := range opts { f(gen) } if gen.Generator == nil { gen.Generator = snowflake.New(rand.Intn(1023)) } return gen }
[ "func", "NewIDGenerator", "(", "opts", "...", "IDGeneratorOp", ")", "*", "IDGenerator", "{", "gen", ":=", "&", "IDGenerator", "{", "}", "\n", "for", "_", ",", "f", ":=", "range", "opts", "{", "f", "(", "gen", ")", "\n", "}", "\n", "if", "gen", ".",...
// NewIDGenerator returns a new IDGenerator. Optionally you can use an IDGeneratorOp. // to use a specific Generator
[ "NewIDGenerator", "returns", "a", "new", "IDGenerator", ".", "Optionally", "you", "can", "use", "an", "IDGeneratorOp", ".", "to", "use", "a", "specific", "Generator" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/snowflake/id.go#L76-L85
123,905
influxdata/influxdb
snowflake/id.go
ID
func (g *IDGenerator) ID() platform.ID { var id platform.ID for !id.Valid() { id = platform.ID(g.Generator.Next()) } return id }
go
func (g *IDGenerator) ID() platform.ID { var id platform.ID for !id.Valid() { id = platform.ID(g.Generator.Next()) } return id }
[ "func", "(", "g", "*", "IDGenerator", ")", "ID", "(", ")", "platform", ".", "ID", "{", "var", "id", "platform", ".", "ID", "\n", "for", "!", "id", ".", "Valid", "(", ")", "{", "id", "=", "platform", ".", "ID", "(", "g", ".", "Generator", ".", ...
// ID returns the next platform.ID from an IDGenerator.
[ "ID", "returns", "the", "next", "platform", ".", "ID", "from", "an", "IDGenerator", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/snowflake/id.go#L88-L94
123,906
influxdata/influxdb
kv/kvlog.go
AddLogEntry
func (s *Service) AddLogEntry(ctx context.Context, k, v []byte, t time.Time) error { return s.kv.Update(ctx, func(tx Tx) error { return s.addLogEntry(ctx, tx, k, v, t) }) }
go
func (s *Service) AddLogEntry(ctx context.Context, k, v []byte, t time.Time) error { return s.kv.Update(ctx, func(tx Tx) error { return s.addLogEntry(ctx, tx, k, v, t) }) }
[ "func", "(", "s", "*", "Service", ")", "AddLogEntry", "(", "ctx", "context", ".", "Context", ",", "k", ",", "v", "[", "]", "byte", ",", "t", "time", ".", "Time", ")", "error", "{", "return", "s", ".", "kv", ".", "Update", "(", "ctx", ",", "func...
// AddLogEntry logs an keyValue for a particular resource type ID pairing.
[ "AddLogEntry", "logs", "an", "keyValue", "for", "a", "particular", "resource", "type", "ID", "pairing", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/kvlog.go#L276-L280
123,907
influxdata/influxdb
bolt/bbolt.go
NewClient
func NewClient() *Client { return &Client{ Logger: zap.NewNop(), IDGenerator: snowflake.NewIDGenerator(), TokenGenerator: rand.NewTokenGenerator(64), time: time.Now, } }
go
func NewClient() *Client { return &Client{ Logger: zap.NewNop(), IDGenerator: snowflake.NewIDGenerator(), TokenGenerator: rand.NewTokenGenerator(64), time: time.Now, } }
[ "func", "NewClient", "(", ")", "*", "Client", "{", "return", "&", "Client", "{", "Logger", ":", "zap", ".", "NewNop", "(", ")", ",", "IDGenerator", ":", "snowflake", ".", "NewIDGenerator", "(", ")", ",", "TokenGenerator", ":", "rand", ".", "NewTokenGener...
// NewClient returns an instance of a Client.
[ "NewClient", "returns", "an", "instance", "of", "a", "Client", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/bbolt.go#L36-L43
123,908
influxdata/influxdb
http/variable_service.go
NewVariableBackend
func NewVariableBackend(b *APIBackend) *VariableBackend { return &VariableBackend{ Logger: b.Logger.With(zap.String("handler", "variable")), VariableService: b.VariableService, LabelService: b.LabelService, } }
go
func NewVariableBackend(b *APIBackend) *VariableBackend { return &VariableBackend{ Logger: b.Logger.With(zap.String("handler", "variable")), VariableService: b.VariableService, LabelService: b.LabelService, } }
[ "func", "NewVariableBackend", "(", "b", "*", "APIBackend", ")", "*", "VariableBackend", "{", "return", "&", "VariableBackend", "{", "Logger", ":", "b", ".", "Logger", ".", "With", "(", "zap", ".", "String", "(", "\"", "\"", ",", "\"", "\"", ")", ")", ...
// NewVariableBackend creates a backend used by the variable handler.
[ "NewVariableBackend", "creates", "a", "backend", "used", "by", "the", "variable", "handler", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/variable_service.go#L29-L35
123,909
influxdata/influxdb
http/variable_service.go
NewVariableHandler
func NewVariableHandler(b *VariableBackend) *VariableHandler { h := &VariableHandler{ Router: NewRouter(), Logger: b.Logger, VariableService: b.VariableService, LabelService: b.LabelService, } entityPath := fmt.Sprintf("%s/:id", variablePath) entityLabelsPath := fmt.Sprintf("%s/labels", entityPath) en...
go
func NewVariableHandler(b *VariableBackend) *VariableHandler { h := &VariableHandler{ Router: NewRouter(), Logger: b.Logger, VariableService: b.VariableService, LabelService: b.LabelService, } entityPath := fmt.Sprintf("%s/:id", variablePath) entityLabelsPath := fmt.Sprintf("%s/labels", entityPath) en...
[ "func", "NewVariableHandler", "(", "b", "*", "VariableBackend", ")", "*", "VariableHandler", "{", "h", ":=", "&", "VariableHandler", "{", "Router", ":", "NewRouter", "(", ")", ",", "Logger", ":", "b", ".", "Logger", ",", "VariableService", ":", "b", ".", ...
// NewVariableHandler creates a new VariableHandler
[ "NewVariableHandler", "creates", "a", "new", "VariableHandler" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/variable_service.go#L48-L78
123,910
influxdata/influxdb
http/variable_service.go
FindVariableByID
func (s *VariableService) FindVariableByID(ctx context.Context, id platform.ID) (*platform.Variable, error) { path := variableIDPath(id) url, err := newURL(s.Addr, path) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, err } SetToken(s.Tok...
go
func (s *VariableService) FindVariableByID(ctx context.Context, id platform.ID) (*platform.Variable, error) { path := variableIDPath(id) url, err := newURL(s.Addr, path) if err != nil { return nil, err } req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, err } SetToken(s.Tok...
[ "func", "(", "s", "*", "VariableService", ")", "FindVariableByID", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ")", "(", "*", "platform", ".", "Variable", ",", "error", ")", "{", "path", ":=", "variableIDPath", "(", "id", "...
// FindVariableByID finds a single variable from the store by its ID
[ "FindVariableByID", "finds", "a", "single", "variable", "from", "the", "store", "by", "its", "ID" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/variable_service.go#L453-L485
123,911
influxdata/influxdb
http/variable_service.go
FindVariables
func (s *VariableService) FindVariables(ctx context.Context, filter platform.VariableFilter, opts ...platform.FindOptions) ([]*platform.Variable, error) { url, err := newURL(s.Addr, variablePath) if err != nil { return nil, err } query := url.Query() if filter.OrganizationID != nil { query.Add("orgID", filter...
go
func (s *VariableService) FindVariables(ctx context.Context, filter platform.VariableFilter, opts ...platform.FindOptions) ([]*platform.Variable, error) { url, err := newURL(s.Addr, variablePath) if err != nil { return nil, err } query := url.Query() if filter.OrganizationID != nil { query.Add("orgID", filter...
[ "func", "(", "s", "*", "VariableService", ")", "FindVariables", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "VariableFilter", ",", "opts", "...", "platform", ".", "FindOptions", ")", "(", "[", "]", "*", "platform", ".", "Variable...
// FindVariables returns a list of variables that match filter. // // Additional options provide pagination & sorting.
[ "FindVariables", "returns", "a", "list", "of", "variables", "that", "match", "filter", ".", "Additional", "options", "provide", "pagination", "&", "sorting", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/variable_service.go#L490-L533
123,912
influxdata/influxdb
http/variable_service.go
CreateVariable
func (s *VariableService) CreateVariable(ctx context.Context, m *platform.Variable) error { if err := m.Valid(); err != nil { return &platform.Error{ Code: platform.EInvalid, Err: err, } } url, err := newURL(s.Addr, variablePath) if err != nil { return err } octets, err := json.Marshal(m) if err !...
go
func (s *VariableService) CreateVariable(ctx context.Context, m *platform.Variable) error { if err := m.Valid(); err != nil { return &platform.Error{ Code: platform.EInvalid, Err: err, } } url, err := newURL(s.Addr, variablePath) if err != nil { return err } octets, err := json.Marshal(m) if err !...
[ "func", "(", "s", "*", "VariableService", ")", "CreateVariable", "(", "ctx", "context", ".", "Context", ",", "m", "*", "platform", ".", "Variable", ")", "error", "{", "if", "err", ":=", "m", ".", "Valid", "(", ")", ";", "err", "!=", "nil", "{", "re...
// CreateVariable creates a new variable and assigns it an platform.ID
[ "CreateVariable", "creates", "a", "new", "variable", "and", "assigns", "it", "an", "platform", ".", "ID" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/variable_service.go#L536-L575
123,913
influxdata/influxdb
http/variable_service.go
UpdateVariable
func (s *VariableService) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) { u, err := newURL(s.Addr, variableIDPath(id)) if err != nil { return nil, err } octets, err := json.Marshal(update) if err != nil { return nil, err } req, err := http....
go
func (s *VariableService) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) { u, err := newURL(s.Addr, variableIDPath(id)) if err != nil { return nil, err } octets, err := json.Marshal(update) if err != nil { return nil, err } req, err := http....
[ "func", "(", "s", "*", "VariableService", ")", "UpdateVariable", "(", "ctx", "context", ".", "Context", ",", "id", "platform", ".", "ID", ",", "update", "*", "platform", ".", "VariableUpdate", ")", "(", "*", "platform", ".", "Variable", ",", "error", ")"...
// UpdateVariable updates a single variable with a changeset
[ "UpdateVariable", "updates", "a", "single", "variable", "with", "a", "changeset" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/variable_service.go#L578-L615
123,914
influxdata/influxdb
models/inline_strconv_parse.go
parseIntBytes
func parseIntBytes(b []byte, base int, bitSize int) (i int64, err error) { s := unsafeBytesToString(b) return strconv.ParseInt(s, base, bitSize) }
go
func parseIntBytes(b []byte, base int, bitSize int) (i int64, err error) { s := unsafeBytesToString(b) return strconv.ParseInt(s, base, bitSize) }
[ "func", "parseIntBytes", "(", "b", "[", "]", "byte", ",", "base", "int", ",", "bitSize", "int", ")", "(", "i", "int64", ",", "err", "error", ")", "{", "s", ":=", "unsafeBytesToString", "(", "b", ")", "\n", "return", "strconv", ".", "ParseInt", "(", ...
// parseIntBytes is a zero-alloc wrapper around strconv.ParseInt.
[ "parseIntBytes", "is", "a", "zero", "-", "alloc", "wrapper", "around", "strconv", ".", "ParseInt", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/inline_strconv_parse.go#L10-L13
123,915
influxdata/influxdb
models/inline_strconv_parse.go
parseUintBytes
func parseUintBytes(b []byte, base int, bitSize int) (i uint64, err error) { s := unsafeBytesToString(b) return strconv.ParseUint(s, base, bitSize) }
go
func parseUintBytes(b []byte, base int, bitSize int) (i uint64, err error) { s := unsafeBytesToString(b) return strconv.ParseUint(s, base, bitSize) }
[ "func", "parseUintBytes", "(", "b", "[", "]", "byte", ",", "base", "int", ",", "bitSize", "int", ")", "(", "i", "uint64", ",", "err", "error", ")", "{", "s", ":=", "unsafeBytesToString", "(", "b", ")", "\n", "return", "strconv", ".", "ParseUint", "("...
// parseUintBytes is a zero-alloc wrapper around strconv.ParseUint.
[ "parseUintBytes", "is", "a", "zero", "-", "alloc", "wrapper", "around", "strconv", ".", "ParseUint", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/inline_strconv_parse.go#L16-L19
123,916
influxdata/influxdb
models/inline_strconv_parse.go
parseFloatBytes
func parseFloatBytes(b []byte, bitSize int) (float64, error) { s := unsafeBytesToString(b) return strconv.ParseFloat(s, bitSize) }
go
func parseFloatBytes(b []byte, bitSize int) (float64, error) { s := unsafeBytesToString(b) return strconv.ParseFloat(s, bitSize) }
[ "func", "parseFloatBytes", "(", "b", "[", "]", "byte", ",", "bitSize", "int", ")", "(", "float64", ",", "error", ")", "{", "s", ":=", "unsafeBytesToString", "(", "b", ")", "\n", "return", "strconv", ".", "ParseFloat", "(", "s", ",", "bitSize", ")", "...
// parseFloatBytes is a zero-alloc wrapper around strconv.ParseFloat.
[ "parseFloatBytes", "is", "a", "zero", "-", "alloc", "wrapper", "around", "strconv", ".", "ParseFloat", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/inline_strconv_parse.go#L22-L25
123,917
influxdata/influxdb
tsdb/tsm1/engine.go
NewContextWithMetricsGroup
func NewContextWithMetricsGroup(ctx context.Context) context.Context { group := metrics.NewGroup(tsmGroup) return metrics.NewContextWithGroup(ctx, group) }
go
func NewContextWithMetricsGroup(ctx context.Context) context.Context { group := metrics.NewGroup(tsmGroup) return metrics.NewContextWithGroup(ctx, group) }
[ "func", "NewContextWithMetricsGroup", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "group", ":=", "metrics", ".", "NewGroup", "(", "tsmGroup", ")", "\n", "return", "metrics", ".", "NewContextWithGroup", "(", "ctx", ",", "group", ...
// NewContextWithMetricsGroup creates a new context with a tsm1 metrics.Group for tracking // various metrics when accessing TSM data.
[ "NewContextWithMetricsGroup", "creates", "a", "new", "context", "with", "a", "tsm1", "metrics", ".", "Group", "for", "tracking", "various", "metrics", "when", "accessing", "TSM", "data", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L52-L55
123,918
influxdata/influxdb
tsdb/tsm1/engine.go
SetEnabled
func (e *Engine) SetEnabled(enabled bool) { e.enableCompactionsOnOpen = enabled e.SetCompactionsEnabled(enabled) }
go
func (e *Engine) SetEnabled(enabled bool) { e.enableCompactionsOnOpen = enabled e.SetCompactionsEnabled(enabled) }
[ "func", "(", "e", "*", "Engine", ")", "SetEnabled", "(", "enabled", "bool", ")", "{", "e", ".", "enableCompactionsOnOpen", "=", "enabled", "\n", "e", ".", "SetCompactionsEnabled", "(", "enabled", ")", "\n", "}" ]
// SetEnabled sets whether the engine is enabled.
[ "SetEnabled", "sets", "whether", "the", "engine", "is", "enabled", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L259-L262
123,919
influxdata/influxdb
tsdb/tsm1/engine.go
SetCompactionsEnabled
func (e *Engine) SetCompactionsEnabled(enabled bool) { if enabled { e.enableSnapshotCompactions() e.enableLevelCompactions(false) } else { e.disableSnapshotCompactions() e.disableLevelCompactions(false) } }
go
func (e *Engine) SetCompactionsEnabled(enabled bool) { if enabled { e.enableSnapshotCompactions() e.enableLevelCompactions(false) } else { e.disableSnapshotCompactions() e.disableLevelCompactions(false) } }
[ "func", "(", "e", "*", "Engine", ")", "SetCompactionsEnabled", "(", "enabled", "bool", ")", "{", "if", "enabled", "{", "e", ".", "enableSnapshotCompactions", "(", ")", "\n", "e", ".", "enableLevelCompactions", "(", "false", ")", "\n", "}", "else", "{", "...
// SetCompactionsEnabled enables compactions on the engine. When disabled // all running compactions are aborted and new compactions stop running.
[ "SetCompactionsEnabled", "enables", "compactions", "on", "the", "engine", ".", "When", "disabled", "all", "running", "compactions", "are", "aborted", "and", "new", "compactions", "stop", "running", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L266-L274
123,920
influxdata/influxdb
tsdb/tsm1/engine.go
ScheduleFullCompaction
func (e *Engine) ScheduleFullCompaction(ctx context.Context) error { // Snapshot any data in the cache if err := e.WriteSnapshot(ctx); err != nil { return err } // Cancel running compactions e.SetCompactionsEnabled(false) // Ensure compactions are restarted defer e.SetCompactionsEnabled(true) // Force the ...
go
func (e *Engine) ScheduleFullCompaction(ctx context.Context) error { // Snapshot any data in the cache if err := e.WriteSnapshot(ctx); err != nil { return err } // Cancel running compactions e.SetCompactionsEnabled(false) // Ensure compactions are restarted defer e.SetCompactionsEnabled(true) // Force the ...
[ "func", "(", "e", "*", "Engine", ")", "ScheduleFullCompaction", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// Snapshot any data in the cache", "if", "err", ":=", "e", ".", "WriteSnapshot", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "ret...
// ScheduleFullCompaction will force the engine to fully compact all data stored. // This will cancel and running compactions and snapshot any data in the cache to // TSM files. This is an expensive operation.
[ "ScheduleFullCompaction", "will", "force", "the", "engine", "to", "fully", "compact", "all", "data", "stored", ".", "This", "will", "cancel", "and", "running", "compactions", "and", "snapshot", "any", "data", "in", "the", "cache", "to", "TSM", "files", ".", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L426-L441
123,921
influxdata/influxdb
tsdb/tsm1/engine.go
IsIdle
func (e *Engine) IsIdle() bool { cacheEmpty := e.Cache.Size() == 0 return cacheEmpty && e.compactionTracker.AllActive() == 0 && e.CompactionPlan.FullyCompacted() }
go
func (e *Engine) IsIdle() bool { cacheEmpty := e.Cache.Size() == 0 return cacheEmpty && e.compactionTracker.AllActive() == 0 && e.CompactionPlan.FullyCompacted() }
[ "func", "(", "e", "*", "Engine", ")", "IsIdle", "(", ")", "bool", "{", "cacheEmpty", ":=", "e", ".", "Cache", ".", "Size", "(", ")", "==", "0", "\n", "return", "cacheEmpty", "&&", "e", ".", "compactionTracker", ".", "AllActive", "(", ")", "==", "0"...
// IsIdle returns true if the cache is empty, there are no running compactions and the // shard is fully compacted.
[ "IsIdle", "returns", "true", "if", "the", "cache", "is", "empty", "there", "are", "no", "running", "compactions", "and", "the", "shard", "is", "fully", "compacted", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L579-L582
123,922
influxdata/influxdb
tsdb/tsm1/engine.go
WritePoints
func (e *Engine) WritePoints(points []models.Point) error { collection := tsdb.NewSeriesCollection(points) values, err := CollectionToValues(collection) if err != nil { return err } if err := e.WriteValues(values); err != nil { return err } return collection.PartialWriteError() }
go
func (e *Engine) WritePoints(points []models.Point) error { collection := tsdb.NewSeriesCollection(points) values, err := CollectionToValues(collection) if err != nil { return err } if err := e.WriteValues(values); err != nil { return err } return collection.PartialWriteError() }
[ "func", "(", "e", "*", "Engine", ")", "WritePoints", "(", "points", "[", "]", "models", ".", "Point", ")", "error", "{", "collection", ":=", "tsdb", ".", "NewSeriesCollection", "(", "points", ")", "\n\n", "values", ",", "err", ":=", "CollectionToValues", ...
// WritePoints saves the set of points in the engine.
[ "WritePoints", "saves", "the", "set", "of", "points", "in", "the", "engine", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L585-L598
123,923
influxdata/influxdb
tsdb/tsm1/engine.go
WriteValues
func (e *Engine) WriteValues(values map[string][]Value) error { e.mu.RLock() defer e.mu.RUnlock() if err := e.Cache.WriteMulti(values); err != nil { return err } return nil }
go
func (e *Engine) WriteValues(values map[string][]Value) error { e.mu.RLock() defer e.mu.RUnlock() if err := e.Cache.WriteMulti(values); err != nil { return err } return nil }
[ "func", "(", "e", "*", "Engine", ")", "WriteValues", "(", "values", "map", "[", "string", "]", "[", "]", "Value", ")", "error", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "if", ...
// WriteValues saves the set of values in the engine.
[ "WriteValues", "saves", "the", "set", "of", "values", "in", "the", "engine", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L601-L610
123,924
influxdata/influxdb
tsdb/tsm1/engine.go
ForEachMeasurementName
func (e *Engine) ForEachMeasurementName(fn func(name []byte) error) error { return e.index.ForEachMeasurementName(fn) }
go
func (e *Engine) ForEachMeasurementName(fn func(name []byte) error) error { return e.index.ForEachMeasurementName(fn) }
[ "func", "(", "e", "*", "Engine", ")", "ForEachMeasurementName", "(", "fn", "func", "(", "name", "[", "]", "byte", ")", "error", ")", "error", "{", "return", "e", ".", "index", ".", "ForEachMeasurementName", "(", "fn", ")", "\n", "}" ]
// ForEachMeasurementName iterates over each measurement name in the engine.
[ "ForEachMeasurementName", "iterates", "over", "each", "measurement", "name", "in", "the", "engine", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L613-L615
123,925
influxdata/influxdb
tsdb/tsm1/engine.go
AllActive
func (t *compactionTracker) AllActive() uint64 { var total uint64 for i := 0; i < len(t.active); i++ { total += atomic.LoadUint64(&t.active[i]) } return total }
go
func (t *compactionTracker) AllActive() uint64 { var total uint64 for i := 0; i < len(t.active); i++ { total += atomic.LoadUint64(&t.active[i]) } return total }
[ "func", "(", "t", "*", "compactionTracker", ")", "AllActive", "(", ")", "uint64", "{", "var", "total", "uint64", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "t", ".", "active", ")", ";", "i", "++", "{", "total", "+=", "atomic", ".", ...
// AllActive returns the number of active snapshots and compactions.
[ "AllActive", "returns", "the", "number", "of", "active", "snapshots", "and", "compactions", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L686-L692
123,926
influxdata/influxdb
tsdb/tsm1/engine.go
IncActive
func (t *compactionTracker) IncActive(level compactionLevel) { atomic.AddUint64(&t.active[level], 1) labels := t.Labels(level) t.metrics.CompactionsActive.With(labels).Inc() }
go
func (t *compactionTracker) IncActive(level compactionLevel) { atomic.AddUint64(&t.active[level], 1) labels := t.Labels(level) t.metrics.CompactionsActive.With(labels).Inc() }
[ "func", "(", "t", "*", "compactionTracker", ")", "IncActive", "(", "level", "compactionLevel", ")", "{", "atomic", ".", "AddUint64", "(", "&", "t", ".", "active", "[", "level", "]", ",", "1", ")", "\n\n", "labels", ":=", "t", ".", "Labels", "(", "lev...
// IncActive increments the number of active compactions for the provided level.
[ "IncActive", "increments", "the", "number", "of", "active", "compactions", "for", "the", "provided", "level", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L709-L714
123,927
influxdata/influxdb
tsdb/tsm1/engine.go
DecActive
func (t *compactionTracker) DecActive(level compactionLevel) { atomic.AddUint64(&t.active[level], ^uint64(0)) labels := t.Labels(level) t.metrics.CompactionsActive.With(labels).Dec() }
go
func (t *compactionTracker) DecActive(level compactionLevel) { atomic.AddUint64(&t.active[level], ^uint64(0)) labels := t.Labels(level) t.metrics.CompactionsActive.With(labels).Dec() }
[ "func", "(", "t", "*", "compactionTracker", ")", "DecActive", "(", "level", "compactionLevel", ")", "{", "atomic", ".", "AddUint64", "(", "&", "t", ".", "active", "[", "level", "]", ",", "^", "uint64", "(", "0", ")", ")", "\n\n", "labels", ":=", "t",...
// DecActive decrements the number of active compactions for the provided level.
[ "DecActive", "decrements", "the", "number", "of", "active", "compactions", "for", "the", "provided", "level", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L720-L725
123,928
influxdata/influxdb
tsdb/tsm1/engine.go
SetQueue
func (t *compactionTracker) SetQueue(level compactionLevel, length uint64) { atomic.StoreUint64(&t.queue[level], length) labels := t.Labels(level) t.metrics.CompactionQueue.With(labels).Set(float64(length)) }
go
func (t *compactionTracker) SetQueue(level compactionLevel, length uint64) { atomic.StoreUint64(&t.queue[level], length) labels := t.Labels(level) t.metrics.CompactionQueue.With(labels).Set(float64(length)) }
[ "func", "(", "t", "*", "compactionTracker", ")", "SetQueue", "(", "level", "compactionLevel", ",", "length", "uint64", ")", "{", "atomic", ".", "StoreUint64", "(", "&", "t", ".", "queue", "[", "level", "]", ",", "length", ")", "\n\n", "labels", ":=", "...
// SetQueue sets the compaction queue depth for the provided level.
[ "SetQueue", "sets", "the", "compaction", "queue", "depth", "for", "the", "provided", "level", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L759-L764
123,929
influxdata/influxdb
tsdb/tsm1/engine.go
compactCache
func (e *Engine) compactCache() { t := time.NewTicker(time.Second) defer t.Stop() for { e.mu.RLock() quit := e.snapDone e.mu.RUnlock() select { case <-quit: return case <-t.C: e.Cache.UpdateAge() status := e.ShouldCompactCache(time.Now()) if status == CacheStatusOkay { continue } ...
go
func (e *Engine) compactCache() { t := time.NewTicker(time.Second) defer t.Stop() for { e.mu.RLock() quit := e.snapDone e.mu.RUnlock() select { case <-quit: return case <-t.C: e.Cache.UpdateAge() status := e.ShouldCompactCache(time.Now()) if status == CacheStatusOkay { continue } ...
[ "func", "(", "e", "*", "Engine", ")", "compactCache", "(", ")", "{", "t", ":=", "time", ".", "NewTicker", "(", "time", ".", "Second", ")", "\n", "defer", "t", ".", "Stop", "(", ")", "\n", "for", "{", "e", ".", "mu", ".", "RLock", "(", ")", "\...
// compactCache checks once per second if the in-memory cache should be // snapshotted to a TSM file.
[ "compactCache", "checks", "once", "per", "second", "if", "the", "in", "-", "memory", "cache", "should", "be", "snapshotted", "to", "a", "TSM", "file", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L852-L884
123,930
influxdata/influxdb
tsdb/tsm1/engine.go
levelCompactionStrategy
func (e *Engine) levelCompactionStrategy(group CompactionGroup, fast bool, level compactionLevel) *compactionStrategy { return &compactionStrategy{ group: group, logger: e.logger.With(zap.Int("tsm1_level", int(level)), zap.String("tsm1_strategy", "level")), fileStore: e.FileStore, compactor: e.Compactor...
go
func (e *Engine) levelCompactionStrategy(group CompactionGroup, fast bool, level compactionLevel) *compactionStrategy { return &compactionStrategy{ group: group, logger: e.logger.With(zap.Int("tsm1_level", int(level)), zap.String("tsm1_strategy", "level")), fileStore: e.FileStore, compactor: e.Compactor...
[ "func", "(", "e", "*", "Engine", ")", "levelCompactionStrategy", "(", "group", "CompactionGroup", ",", "fast", "bool", ",", "level", "compactionLevel", ")", "*", "compactionStrategy", "{", "return", "&", "compactionStrategy", "{", "group", ":", "group", ",", "...
// levelCompactionStrategy returns a compactionStrategy for the given level. // It returns nil if there are no TSM files to compact.
[ "levelCompactionStrategy", "returns", "a", "compactionStrategy", "for", "the", "given", "level", ".", "It", "returns", "nil", "if", "there", "are", "no", "TSM", "files", "to", "compact", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L1180-L1191
123,931
influxdata/influxdb
tsdb/tsm1/engine.go
fullCompactionStrategy
func (e *Engine) fullCompactionStrategy(group CompactionGroup, optimize bool) *compactionStrategy { s := &compactionStrategy{ group: group, logger: e.logger.With(zap.String("tsm1_strategy", "full"), zap.Bool("tsm1_optimize", optimize)), fileStore: e.FileStore, compactor: e.Compactor, fast: optimi...
go
func (e *Engine) fullCompactionStrategy(group CompactionGroup, optimize bool) *compactionStrategy { s := &compactionStrategy{ group: group, logger: e.logger.With(zap.String("tsm1_strategy", "full"), zap.Bool("tsm1_optimize", optimize)), fileStore: e.FileStore, compactor: e.Compactor, fast: optimi...
[ "func", "(", "e", "*", "Engine", ")", "fullCompactionStrategy", "(", "group", "CompactionGroup", ",", "optimize", "bool", ")", "*", "compactionStrategy", "{", "s", ":=", "&", "compactionStrategy", "{", "group", ":", "group", ",", "logger", ":", "e", ".", "...
// fullCompactionStrategy returns a compactionStrategy for higher level generations of TSM files. // It returns nil if there are no TSM files to compact.
[ "fullCompactionStrategy", "returns", "a", "compactionStrategy", "for", "higher", "level", "generations", "of", "TSM", "files", ".", "It", "returns", "nil", "if", "there", "are", "no", "TSM", "files", "to", "compact", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L1195-L1211
123,932
influxdata/influxdb
tsdb/tsm1/engine.go
cleanup
func (e *Engine) cleanup() error { allfiles, err := ioutil.ReadDir(e.path) if os.IsNotExist(err) { return nil } else if err != nil { return err } ext := fmt.Sprintf(".%s", TmpTSMFileExtension) for _, f := range allfiles { // Check to see if there are any `.tmp` directories that were left over from failed s...
go
func (e *Engine) cleanup() error { allfiles, err := ioutil.ReadDir(e.path) if os.IsNotExist(err) { return nil } else if err != nil { return err } ext := fmt.Sprintf(".%s", TmpTSMFileExtension) for _, f := range allfiles { // Check to see if there are any `.tmp` directories that were left over from failed s...
[ "func", "(", "e", "*", "Engine", ")", "cleanup", "(", ")", "error", "{", "allfiles", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "e", ".", "path", ")", "\n", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "nil", "\n", "}", ...
// cleanup removes all temp files and dirs that exist on disk. This is should only be run at startup to avoid // removing tmp files that are still in use.
[ "cleanup", "removes", "all", "temp", "files", "and", "dirs", "that", "exist", "on", "disk", ".", "This", "is", "should", "only", "be", "run", "at", "startup", "to", "avoid", "removing", "tmp", "files", "that", "are", "still", "in", "use", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L1215-L1234
123,933
influxdata/influxdb
tsdb/tsm1/engine.go
KeyCursor
func (e *Engine) KeyCursor(ctx context.Context, key []byte, t int64, ascending bool) *KeyCursor { return e.FileStore.KeyCursor(ctx, key, t, ascending) }
go
func (e *Engine) KeyCursor(ctx context.Context, key []byte, t int64, ascending bool) *KeyCursor { return e.FileStore.KeyCursor(ctx, key, t, ascending) }
[ "func", "(", "e", "*", "Engine", ")", "KeyCursor", "(", "ctx", "context", ".", "Context", ",", "key", "[", "]", "byte", ",", "t", "int64", ",", "ascending", "bool", ")", "*", "KeyCursor", "{", "return", "e", ".", "FileStore", ".", "KeyCursor", "(", ...
// KeyCursor returns a KeyCursor for the given key starting at time t.
[ "KeyCursor", "returns", "a", "KeyCursor", "for", "the", "given", "key", "starting", "at", "time", "t", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L1251-L1253
123,934
influxdata/influxdb
tsdb/tsm1/engine.go
IteratorCost
func (e *Engine) IteratorCost(measurement string, opt query.IteratorOptions) (query.IteratorCost, error) { // Determine if this measurement exists. If it does not, then no shards are // accessed to begin with. if exists, err := e.index.MeasurementExists([]byte(measurement)); err != nil { return query.IteratorCost{...
go
func (e *Engine) IteratorCost(measurement string, opt query.IteratorOptions) (query.IteratorCost, error) { // Determine if this measurement exists. If it does not, then no shards are // accessed to begin with. if exists, err := e.index.MeasurementExists([]byte(measurement)); err != nil { return query.IteratorCost{...
[ "func", "(", "e", "*", "Engine", ")", "IteratorCost", "(", "measurement", "string", ",", "opt", "query", ".", "IteratorOptions", ")", "(", "query", ".", "IteratorCost", ",", "error", ")", "{", "// Determine if this measurement exists. If it does not, then no shards ar...
// IteratorCost produces the cost of an iterator.
[ "IteratorCost", "produces", "the", "cost", "of", "an", "iterator", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L1256-L1315
123,935
influxdata/influxdb
tsdb/tsm1/engine.go
AppendSeriesFieldKeyBytes
func AppendSeriesFieldKeyBytes(dst, seriesKey, field []byte) []byte { dst = append(dst, seriesKey...) dst = append(dst, KeyFieldSeparatorBytes...) return append(dst, field...) }
go
func AppendSeriesFieldKeyBytes(dst, seriesKey, field []byte) []byte { dst = append(dst, seriesKey...) dst = append(dst, KeyFieldSeparatorBytes...) return append(dst, field...) }
[ "func", "AppendSeriesFieldKeyBytes", "(", "dst", ",", "seriesKey", ",", "field", "[", "]", "byte", ")", "[", "]", "byte", "{", "dst", "=", "append", "(", "dst", ",", "seriesKey", "...", ")", "\n", "dst", "=", "append", "(", "dst", ",", "KeyFieldSeparat...
// AppendSeriesFieldKeyBytes combines seriesKey and field such // that can be used to search a TSM index. The value is appended to dst and // the extended buffer returned.
[ "AppendSeriesFieldKeyBytes", "combines", "seriesKey", "and", "field", "such", "that", "can", "be", "used", "to", "search", "a", "TSM", "index", ".", "The", "value", "is", "appended", "to", "dst", "and", "the", "extended", "buffer", "returned", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/engine.go#L1343-L1347
123,936
influxdata/influxdb
authorizer/task.go
NewTaskService
func NewTaskService(logger *zap.Logger, ts platform.TaskService, bs platform.BucketService) platform.TaskService { return &taskServiceValidator{ TaskService: ts, preAuth: query.NewPreAuthorizer(bs), logger: logger, } }
go
func NewTaskService(logger *zap.Logger, ts platform.TaskService, bs platform.BucketService) platform.TaskService { return &taskServiceValidator{ TaskService: ts, preAuth: query.NewPreAuthorizer(bs), logger: logger, } }
[ "func", "NewTaskService", "(", "logger", "*", "zap", ".", "Logger", ",", "ts", "platform", ".", "TaskService", ",", "bs", "platform", ".", "BucketService", ")", "platform", ".", "TaskService", "{", "return", "&", "taskServiceValidator", "{", "TaskService", ":"...
// TaskService wraps ts and checks appropriate permissions before calling requested methods on ts. // Authorization failures are logged to the logger.
[ "TaskService", "wraps", "ts", "and", "checks", "appropriate", "permissions", "before", "calling", "requested", "methods", "on", "ts", ".", "Authorization", "failures", "are", "logged", "to", "the", "logger", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/task.go#L36-L42
123,937
influxdata/influxdb
chronograf/server/server.go
UseGithub
func (s *Server) UseGithub() bool { return s.TokenSecret != "" && s.GithubClientID != "" && s.GithubClientSecret != "" }
go
func (s *Server) UseGithub() bool { return s.TokenSecret != "" && s.GithubClientID != "" && s.GithubClientSecret != "" }
[ "func", "(", "s", "*", "Server", ")", "UseGithub", "(", ")", "bool", "{", "return", "s", ".", "TokenSecret", "!=", "\"", "\"", "&&", "s", ".", "GithubClientID", "!=", "\"", "\"", "&&", "s", ".", "GithubClientSecret", "!=", "\"", "\"", "\n", "}" ]
// UseGithub validates the CLI parameters to enable github oauth support
[ "UseGithub", "validates", "the", "CLI", "parameters", "to", "enable", "github", "oauth", "support" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/server.go#L118-L120
123,938
influxdata/influxdb
chronograf/server/server.go
UseGoogle
func (s *Server) UseGoogle() bool { return s.TokenSecret != "" && s.GoogleClientID != "" && s.GoogleClientSecret != "" && s.PublicURL != "" }
go
func (s *Server) UseGoogle() bool { return s.TokenSecret != "" && s.GoogleClientID != "" && s.GoogleClientSecret != "" && s.PublicURL != "" }
[ "func", "(", "s", "*", "Server", ")", "UseGoogle", "(", ")", "bool", "{", "return", "s", ".", "TokenSecret", "!=", "\"", "\"", "&&", "s", ".", "GoogleClientID", "!=", "\"", "\"", "&&", "s", ".", "GoogleClientSecret", "!=", "\"", "\"", "&&", "s", "....
// UseGoogle validates the CLI parameters to enable google oauth support
[ "UseGoogle", "validates", "the", "CLI", "parameters", "to", "enable", "google", "oauth", "support" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/server.go#L123-L125
123,939
influxdata/influxdb
chronograf/server/server.go
UseHeroku
func (s *Server) UseHeroku() bool { return s.TokenSecret != "" && s.HerokuClientID != "" && s.HerokuSecret != "" }
go
func (s *Server) UseHeroku() bool { return s.TokenSecret != "" && s.HerokuClientID != "" && s.HerokuSecret != "" }
[ "func", "(", "s", "*", "Server", ")", "UseHeroku", "(", ")", "bool", "{", "return", "s", ".", "TokenSecret", "!=", "\"", "\"", "&&", "s", ".", "HerokuClientID", "!=", "\"", "\"", "&&", "s", ".", "HerokuSecret", "!=", "\"", "\"", "\n", "}" ]
// UseHeroku validates the CLI parameters to enable heroku oauth support
[ "UseHeroku", "validates", "the", "CLI", "parameters", "to", "enable", "heroku", "oauth", "support" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/server.go#L128-L130
123,940
influxdata/influxdb
chronograf/server/server.go
UseGenericOAuth2
func (s *Server) UseGenericOAuth2() bool { return s.TokenSecret != "" && s.GenericClientID != "" && s.GenericClientSecret != "" && s.GenericAuthURL != "" && s.GenericTokenURL != "" }
go
func (s *Server) UseGenericOAuth2() bool { return s.TokenSecret != "" && s.GenericClientID != "" && s.GenericClientSecret != "" && s.GenericAuthURL != "" && s.GenericTokenURL != "" }
[ "func", "(", "s", "*", "Server", ")", "UseGenericOAuth2", "(", ")", "bool", "{", "return", "s", ".", "TokenSecret", "!=", "\"", "\"", "&&", "s", ".", "GenericClientID", "!=", "\"", "\"", "&&", "s", ".", "GenericClientSecret", "!=", "\"", "\"", "&&", ...
// UseGenericOAuth2 validates the CLI parameters to enable generic oauth support
[ "UseGenericOAuth2", "validates", "the", "CLI", "parameters", "to", "enable", "generic", "oauth", "support" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/server.go#L138-L142
123,941
influxdata/influxdb
chronograf/server/server.go
reportUsageStats
func reportUsageStats(bi chronograf.BuildInfo, logger chronograf.Logger) { rand.Seed(time.Now().UTC().UnixNano()) serverID := strconv.FormatUint(uint64(rand.Int63()), 10) reporter := client.New("") values := client.Values{ "os": runtime.GOOS, "arch": runtime.GOARCH, "version": bi.Version, "...
go
func reportUsageStats(bi chronograf.BuildInfo, logger chronograf.Logger) { rand.Seed(time.Now().UTC().UnixNano()) serverID := strconv.FormatUint(uint64(rand.Int63()), 10) reporter := client.New("") values := client.Values{ "os": runtime.GOOS, "arch": runtime.GOARCH, "version": bi.Version, "...
[ "func", "reportUsageStats", "(", "bi", "chronograf", ".", "BuildInfo", ",", "logger", "chronograf", ".", "Logger", ")", "{", "rand", ".", "Seed", "(", "time", ".", "Now", "(", ")", ".", "UTC", "(", ")", ".", "UnixNano", "(", ")", ")", "\n", "serverID...
// reportUsageStats starts periodic server reporting.
[ "reportUsageStats", "starts", "periodic", "server", "reporting", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/server.go#L537-L563
123,942
influxdata/influxdb
logger/logger.go
IsTerminal
func IsTerminal(w io.Writer) bool { if f, ok := w.(interface { Fd() uintptr }); ok { return isatty.IsTerminal(f.Fd()) } return false }
go
func IsTerminal(w io.Writer) bool { if f, ok := w.(interface { Fd() uintptr }); ok { return isatty.IsTerminal(f.Fd()) } return false }
[ "func", "IsTerminal", "(", "w", "io", ".", "Writer", ")", "bool", "{", "if", "f", ",", "ok", ":=", "w", ".", "(", "interface", "{", "Fd", "(", ")", "uintptr", "\n", "}", ")", ";", "ok", "{", "return", "isatty", ".", "IsTerminal", "(", "f", ".",...
// IsTerminal checks if w is a file and whether it is an interactive terminal session.
[ "IsTerminal", "checks", "if", "w", "is", "a", "file", "and", "whether", "it", "is", "an", "interactive", "terminal", "session", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/logger/logger.go#L79-L86
123,943
influxdata/influxdb
tsdb/cursors/string.go
StringIteratorToSlice
func StringIteratorToSlice(i StringIterator) []string { if i == nil { return nil } if si, ok := i.(*StringSliceIterator); ok { return si.toSlice() } var a []string for i.Next() { a = append(a, i.Value()) } return a }
go
func StringIteratorToSlice(i StringIterator) []string { if i == nil { return nil } if si, ok := i.(*StringSliceIterator); ok { return si.toSlice() } var a []string for i.Next() { a = append(a, i.Value()) } return a }
[ "func", "StringIteratorToSlice", "(", "i", "StringIterator", ")", "[", "]", "string", "{", "if", "i", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "si", ",", "ok", ":=", "i", ".", "(", "*", "StringSliceIterator", ")", ";", "ok", "{", ...
// StringIteratorToSlice reads the remainder of i into a slice and // returns the result.
[ "StringIteratorToSlice", "reads", "the", "remainder", "of", "i", "into", "a", "slice", "and", "returns", "the", "result", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/cursors/string.go#L68-L81
123,944
influxdata/influxdb
bolt/user.go
FindUser
func (c *Client) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) { var u *platform.User var err error op := getOp(platform.OpFindUser) if filter.ID != nil { u, err = c.FindUserByID(ctx, *filter.ID) if err != nil { return nil, &platform.Error{ Op: op, Err: err, } ...
go
func (c *Client) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) { var u *platform.User var err error op := getOp(platform.OpFindUser) if filter.ID != nil { u, err = c.FindUserByID(ctx, *filter.ID) if err != nil { return nil, &platform.Error{ Op: op, Err: err, } ...
[ "func", "(", "c", "*", "Client", ")", "FindUser", "(", "ctx", "context", ".", "Context", ",", "filter", "platform", ".", "UserFilter", ")", "(", "*", "platform", ".", "User", ",", "error", ")", "{", "var", "u", "*", "platform", ".", "User", "\n", "...
// FindUser retrives a user using an arbitrary user filter.
[ "FindUser", "retrives", "a", "user", "using", "an", "arbitrary", "user", "filter", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/user.go#L121-L151
123,945
influxdata/influxdb
bolt/user.go
CreateUser
func (c *Client) CreateUser(ctx context.Context, u *platform.User) error { err := c.db.Update(func(tx *bolt.Tx) error { unique := c.uniqueUserName(ctx, tx, u) if !unique { return &platform.Error{ Code: platform.EConflict, Msg: fmt.Sprintf("user with name %s already exists", u.Name), } } u.ID =...
go
func (c *Client) CreateUser(ctx context.Context, u *platform.User) error { err := c.db.Update(func(tx *bolt.Tx) error { unique := c.uniqueUserName(ctx, tx, u) if !unique { return &platform.Error{ Code: platform.EConflict, Msg: fmt.Sprintf("user with name %s already exists", u.Name), } } u.ID =...
[ "func", "(", "c", "*", "Client", ")", "CreateUser", "(", "ctx", "context", ".", "Context", ",", "u", "*", "platform", ".", "User", ")", "error", "{", "err", ":=", "c", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")...
// CreateUser creates a platform user and sets b.ID.
[ "CreateUser", "creates", "a", "platform", "user", "and", "sets", "b", ".", "ID", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/user.go#L217-L243
123,946
influxdata/influxdb
authorizer/authorize.go
IsAllowed
func IsAllowed(ctx context.Context, p influxdb.Permission) error { a, err := influxdbcontext.GetAuthorizer(ctx) if err != nil { return err } if !a.Allowed(p) { return &influxdb.Error{ Code: influxdb.EUnauthorized, Msg: fmt.Sprintf("%s is unauthorized", p), } } return nil }
go
func IsAllowed(ctx context.Context, p influxdb.Permission) error { a, err := influxdbcontext.GetAuthorizer(ctx) if err != nil { return err } if !a.Allowed(p) { return &influxdb.Error{ Code: influxdb.EUnauthorized, Msg: fmt.Sprintf("%s is unauthorized", p), } } return nil }
[ "func", "IsAllowed", "(", "ctx", "context", ".", "Context", ",", "p", "influxdb", ".", "Permission", ")", "error", "{", "a", ",", "err", ":=", "influxdbcontext", ".", "GetAuthorizer", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err...
// IsAllowed checks to see if an action is authorized by retrieving the authorizer // off of context and authorizing the action appropriately.
[ "IsAllowed", "checks", "to", "see", "if", "an", "action", "is", "authorized", "by", "retrieving", "the", "authorizer", "off", "of", "context", "and", "authorizing", "the", "action", "appropriately", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/authorize.go#L13-L27
123,947
influxdata/influxdb
chronograf/mocks/roles.go
All
func (s *RolesStore) All(ctx context.Context) ([]chronograf.Role, error) { return s.AllF(ctx) }
go
func (s *RolesStore) All(ctx context.Context) ([]chronograf.Role, error) { return s.AllF(ctx) }
[ "func", "(", "s", "*", "RolesStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Role", ",", "error", ")", "{", "return", "s", ".", "AllF", "(", "ctx", ")", "\n", "}" ]
// All lists all Roles from the RolesStore
[ "All", "lists", "all", "Roles", "from", "the", "RolesStore" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/roles.go#L21-L23
123,948
influxdata/influxdb
chronograf/mocks/roles.go
Add
func (s *RolesStore) Add(ctx context.Context, u *chronograf.Role) (*chronograf.Role, error) { return s.AddF(ctx, u) }
go
func (s *RolesStore) Add(ctx context.Context, u *chronograf.Role) (*chronograf.Role, error) { return s.AddF(ctx, u) }
[ "func", "(", "s", "*", "RolesStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "u", "*", "chronograf", ".", "Role", ")", "(", "*", "chronograf", ".", "Role", ",", "error", ")", "{", "return", "s", ".", "AddF", "(", "ctx", ",", "u", ...
// Add a new Role in the RolesStore
[ "Add", "a", "new", "Role", "in", "the", "RolesStore" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/roles.go#L26-L28
123,949
influxdata/influxdb
chronograf/mocks/roles.go
Delete
func (s *RolesStore) Delete(ctx context.Context, u *chronograf.Role) error { return s.DeleteF(ctx, u) }
go
func (s *RolesStore) Delete(ctx context.Context, u *chronograf.Role) error { return s.DeleteF(ctx, u) }
[ "func", "(", "s", "*", "RolesStore", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "u", "*", "chronograf", ".", "Role", ")", "error", "{", "return", "s", ".", "DeleteF", "(", "ctx", ",", "u", ")", "\n", "}" ]
// Delete the Role from the RolesStore
[ "Delete", "the", "Role", "from", "the", "RolesStore" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/roles.go#L31-L33
123,950
influxdata/influxdb
chronograf/mocks/roles.go
Update
func (s *RolesStore) Update(ctx context.Context, u *chronograf.Role) error { return s.UpdateF(ctx, u) }
go
func (s *RolesStore) Update(ctx context.Context, u *chronograf.Role) error { return s.UpdateF(ctx, u) }
[ "func", "(", "s", "*", "RolesStore", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "u", "*", "chronograf", ".", "Role", ")", "error", "{", "return", "s", ".", "UpdateF", "(", "ctx", ",", "u", ")", "\n", "}" ]
// Update the Role's permissions or users
[ "Update", "the", "Role", "s", "permissions", "or", "users" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/roles.go#L41-L43
123,951
influxdata/influxdb
chronograf/server/swagger.go
Spec
func Spec() http.HandlerFunc { swagger, err := Asset("swagger.json") return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK)...
go
func Spec() http.HandlerFunc { swagger, err := Asset("swagger.json") return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK)...
[ "func", "Spec", "(", ")", "http", ".", "HandlerFunc", "{", "swagger", ",", "err", ":=", "Asset", "(", "\"", "\"", ")", "\n", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Re...
// Spec servers the swagger.json file from bindata
[ "Spec", "servers", "the", "swagger", ".", "json", "file", "from", "bindata" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/swagger.go#L8-L20
123,952
influxdata/influxdb
bolt/authorization.go
CreateAuthorization
func (c *Client) CreateAuthorization(ctx context.Context, a *platform.Authorization) error { op := getOp(platform.OpCreateAuthorization) if err := a.Valid(); err != nil { return &platform.Error{ Err: err, Op: op, } } return c.db.Update(func(tx *bolt.Tx) error { _, pErr := c.findUserByID(ctx, tx, a.Use...
go
func (c *Client) CreateAuthorization(ctx context.Context, a *platform.Authorization) error { op := getOp(platform.OpCreateAuthorization) if err := a.Valid(); err != nil { return &platform.Error{ Err: err, Op: op, } } return c.db.Update(func(tx *bolt.Tx) error { _, pErr := c.findUserByID(ctx, tx, a.Use...
[ "func", "(", "c", "*", "Client", ")", "CreateAuthorization", "(", "ctx", "context", ".", "Context", ",", "a", "*", "platform", ".", "Authorization", ")", "error", "{", "op", ":=", "getOp", "(", "platform", ".", "OpCreateAuthorization", ")", "\n", "if", "...
// CreateAuthorization creates a platform authorization and sets b.ID, and b.UserID if not provided.
[ "CreateAuthorization", "creates", "a", "platform", "authorization", "and", "sets", "b", ".", "ID", "and", "b", ".", "UserID", "if", "not", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/authorization.go#L225-L270
123,953
influxdata/influxdb
tsdb/tsi1/metrics.go
newCacheMetrics
func newCacheMetrics(labels prometheus.Labels) *cacheMetrics { var names []string for k := range labels { names = append(names, k) } sort.Strings(names) statusNames := append(append([]string(nil), names...), "status") sort.Strings(statusNames) return &cacheMetrics{ Size: prometheus.NewGaugeVec(prometheus.G...
go
func newCacheMetrics(labels prometheus.Labels) *cacheMetrics { var names []string for k := range labels { names = append(names, k) } sort.Strings(names) statusNames := append(append([]string(nil), names...), "status") sort.Strings(statusNames) return &cacheMetrics{ Size: prometheus.NewGaugeVec(prometheus.G...
[ "func", "newCacheMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "cacheMetrics", "{", "var", "names", "[", "]", "string", "\n", "for", "k", ":=", "range", "labels", "{", "names", "=", "append", "(", "names", ",", "k", ")", "\n", "}", ...
// newCacheMetrics initialises the prometheus metrics for tracking the Series File.
[ "newCacheMetrics", "initialises", "the", "prometheus", "metrics", "for", "tracking", "the", "Series", "File", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/metrics.go#L51-L93
123,954
influxdata/influxdb
tsdb/tsi1/metrics.go
newPartitionMetrics
func newPartitionMetrics(labels prometheus.Labels) *partitionMetrics { names := []string{"index_partition"} // All metrics have a partition for k := range labels { names = append(names, k) } sort.Strings(names) // type = {"index", "log"} fileNames := append(append([]string(nil), names...), "type") sort.String...
go
func newPartitionMetrics(labels prometheus.Labels) *partitionMetrics { names := []string{"index_partition"} // All metrics have a partition for k := range labels { names = append(names, k) } sort.Strings(names) // type = {"index", "log"} fileNames := append(append([]string(nil), names...), "type") sort.String...
[ "func", "newPartitionMetrics", "(", "labels", "prometheus", ".", "Labels", ")", "*", "partitionMetrics", "{", "names", ":=", "[", "]", "string", "{", "\"", "\"", "}", "// All metrics have a partition", "\n", "for", "k", ":=", "range", "labels", "{", "names", ...
// newPartitionMetrics initialises the prometheus metrics for tracking the TSI partitions.
[ "newPartitionMetrics", "initialises", "the", "prometheus", "metrics", "for", "tracking", "the", "TSI", "partitions", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/metrics.go#L127-L212
123,955
influxdata/influxdb
pkg/bytesutil/bytesutil.go
SortDedup
func SortDedup(a [][]byte) [][]byte { if len(a) < 2 { return a } Sort(a) i, j := 0, 1 for j < len(a) { if !bytes.Equal(a[j-1], a[j]) { a[i] = a[j-1] i++ } j++ } a[i] = a[j-1] i++ return a[:i] }
go
func SortDedup(a [][]byte) [][]byte { if len(a) < 2 { return a } Sort(a) i, j := 0, 1 for j < len(a) { if !bytes.Equal(a[j-1], a[j]) { a[i] = a[j-1] i++ } j++ } a[i] = a[j-1] i++ return a[:i] }
[ "func", "SortDedup", "(", "a", "[", "]", "[", "]", "byte", ")", "[", "]", "[", "]", "byte", "{", "if", "len", "(", "a", ")", "<", "2", "{", "return", "a", "\n", "}", "\n\n", "Sort", "(", "a", ")", "\n\n", "i", ",", "j", ":=", "0", ",", ...
// SortDedup sorts the byte slice a and removes duplicates. The ret
[ "SortDedup", "sorts", "the", "byte", "slice", "a", "and", "removes", "duplicates", ".", "The", "ret" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L15-L33
123,956
influxdata/influxdb
pkg/bytesutil/bytesutil.go
SearchBytes
func SearchBytes(a [][]byte, x []byte) int { // Define f(i) => bytes.Compare(a[i], x) < 0 // Define f(-1) == false and f(n) == true. // Invariant: f(i-1) == false, f(j) == true. i, j := 0, len(a) for i < j { h := int(uint(i+j) >> 1) // avoid overflow when computing h // i ≤ h < j if bytes.Compare(a[h], x) < ...
go
func SearchBytes(a [][]byte, x []byte) int { // Define f(i) => bytes.Compare(a[i], x) < 0 // Define f(-1) == false and f(n) == true. // Invariant: f(i-1) == false, f(j) == true. i, j := 0, len(a) for i < j { h := int(uint(i+j) >> 1) // avoid overflow when computing h // i ≤ h < j if bytes.Compare(a[h], x) < ...
[ "func", "SearchBytes", "(", "a", "[", "]", "[", "]", "byte", ",", "x", "[", "]", "byte", ")", "int", "{", "// Define f(i) => bytes.Compare(a[i], x) < 0", "// Define f(-1) == false and f(n) == true.", "// Invariant: f(i-1) == false, f(j) == true.", "i", ",", "j", ":=", ...
// SearchBytes performs a binary search for x in the sorted slice a.
[ "SearchBytes", "performs", "a", "binary", "search", "for", "x", "in", "the", "sorted", "slice", "a", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L40-L56
123,957
influxdata/influxdb
pkg/bytesutil/bytesutil.go
Contains
func Contains(a [][]byte, x []byte) bool { n := SearchBytes(a, x) return n < len(a) && bytes.Equal(a[n], x) }
go
func Contains(a [][]byte, x []byte) bool { n := SearchBytes(a, x) return n < len(a) && bytes.Equal(a[n], x) }
[ "func", "Contains", "(", "a", "[", "]", "[", "]", "byte", ",", "x", "[", "]", "byte", ")", "bool", "{", "n", ":=", "SearchBytes", "(", "a", ",", "x", ")", "\n", "return", "n", "<", "len", "(", "a", ")", "&&", "bytes", ".", "Equal", "(", "a"...
// Contains returns true if x is an element of the sorted slice a.
[ "Contains", "returns", "true", "if", "x", "is", "an", "element", "of", "the", "sorted", "slice", "a", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L59-L62
123,958
influxdata/influxdb
pkg/bytesutil/bytesutil.go
SearchBytesFixed
func SearchBytesFixed(a []byte, sz int, fn func(x []byte) bool) int { if len(a)%sz != 0 { panic(fmt.Sprintf("x is not a multiple of a: %d %d", len(a), sz)) } i, j := 0, len(a)-sz for i < j { h := int(uint(i+j) >> 1) h -= h % sz if !fn(a[h : h+sz]) { i = h + sz } else { j = h } } return i }
go
func SearchBytesFixed(a []byte, sz int, fn func(x []byte) bool) int { if len(a)%sz != 0 { panic(fmt.Sprintf("x is not a multiple of a: %d %d", len(a), sz)) } i, j := 0, len(a)-sz for i < j { h := int(uint(i+j) >> 1) h -= h % sz if !fn(a[h : h+sz]) { i = h + sz } else { j = h } } return i }
[ "func", "SearchBytesFixed", "(", "a", "[", "]", "byte", ",", "sz", "int", ",", "fn", "func", "(", "x", "[", "]", "byte", ")", "bool", ")", "int", "{", "if", "len", "(", "a", ")", "%", "sz", "!=", "0", "{", "panic", "(", "fmt", ".", "Sprintf",...
// SearchBytesFixed searches a for x using a binary search. The size of a must be a multiple of // of x or else the function panics. There returned value is the index within a where x should // exist. The caller should ensure that x does exist at this index.
[ "SearchBytesFixed", "searches", "a", "for", "x", "using", "a", "binary", "search", ".", "The", "size", "of", "a", "must", "be", "a", "multiple", "of", "of", "x", "or", "else", "the", "function", "panics", ".", "There", "returned", "value", "is", "the", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L67-L84
123,959
influxdata/influxdb
pkg/bytesutil/bytesutil.go
Union
func Union(a, b [][]byte) [][]byte { n := len(b) if len(a) > len(b) { n = len(a) } other := make([][]byte, 0, n) for { if len(a) > 0 && len(b) > 0 { if cmp := bytes.Compare(a[0], b[0]); cmp == 0 { other, a, b = append(other, a[0]), a[1:], b[1:] } else if cmp == -1 { other, a = append(other, a[0]...
go
func Union(a, b [][]byte) [][]byte { n := len(b) if len(a) > len(b) { n = len(a) } other := make([][]byte, 0, n) for { if len(a) > 0 && len(b) > 0 { if cmp := bytes.Compare(a[0], b[0]); cmp == 0 { other, a, b = append(other, a[0]), a[1:], b[1:] } else if cmp == -1 { other, a = append(other, a[0]...
[ "func", "Union", "(", "a", ",", "b", "[", "]", "[", "]", "byte", ")", "[", "]", "[", "]", "byte", "{", "n", ":=", "len", "(", "b", ")", "\n", "if", "len", "(", "a", ")", ">", "len", "(", "b", ")", "{", "n", "=", "len", "(", "a", ")", ...
// Union returns the union of a & b in sorted order.
[ "Union", "returns", "the", "union", "of", "a", "&", "b", "in", "sorted", "order", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L87-L111
123,960
influxdata/influxdb
pkg/bytesutil/bytesutil.go
Intersect
func Intersect(a, b [][]byte) [][]byte { n := len(b) if len(a) > len(b) { n = len(a) } other := make([][]byte, 0, n) for len(a) > 0 && len(b) > 0 { if cmp := bytes.Compare(a[0], b[0]); cmp == 0 { other, a, b = append(other, a[0]), a[1:], b[1:] } else if cmp == -1 { a = a[1:] } else { b = b[1:] ...
go
func Intersect(a, b [][]byte) [][]byte { n := len(b) if len(a) > len(b) { n = len(a) } other := make([][]byte, 0, n) for len(a) > 0 && len(b) > 0 { if cmp := bytes.Compare(a[0], b[0]); cmp == 0 { other, a, b = append(other, a[0]), a[1:], b[1:] } else if cmp == -1 { a = a[1:] } else { b = b[1:] ...
[ "func", "Intersect", "(", "a", ",", "b", "[", "]", "[", "]", "byte", ")", "[", "]", "[", "]", "byte", "{", "n", ":=", "len", "(", "b", ")", "\n", "if", "len", "(", "a", ")", ">", "len", "(", "b", ")", "{", "n", "=", "len", "(", "a", "...
// Intersect returns the intersection of a & b in sorted order.
[ "Intersect", "returns", "the", "intersection", "of", "a", "&", "b", "in", "sorted", "order", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L114-L131
123,961
influxdata/influxdb
pkg/bytesutil/bytesutil.go
Clone
func Clone(b []byte) []byte { if b == nil { return nil } buf := make([]byte, len(b)) copy(buf, b) return buf }
go
func Clone(b []byte) []byte { if b == nil { return nil } buf := make([]byte, len(b)) copy(buf, b) return buf }
[ "func", "Clone", "(", "b", "[", "]", "byte", ")", "[", "]", "byte", "{", "if", "b", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "buf", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "b", ")", ")", "\n", "copy", "(", "buf", ...
// Clone returns a copy of b.
[ "Clone", "returns", "a", "copy", "of", "b", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L134-L141
123,962
influxdata/influxdb
pkg/bytesutil/bytesutil.go
CloneSlice
func CloneSlice(a [][]byte) [][]byte { other := make([][]byte, len(a)) for i := range a { other[i] = Clone(a[i]) } return other }
go
func CloneSlice(a [][]byte) [][]byte { other := make([][]byte, len(a)) for i := range a { other[i] = Clone(a[i]) } return other }
[ "func", "CloneSlice", "(", "a", "[", "]", "[", "]", "byte", ")", "[", "]", "[", "]", "byte", "{", "other", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "a", ")", ")", "\n", "for", "i", ":=", "range", "a", "{", "other", ...
// CloneSlice returns a copy of a slice of byte slices.
[ "CloneSlice", "returns", "a", "copy", "of", "a", "slice", "of", "byte", "slices", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L144-L150
123,963
influxdata/influxdb
pkg/bytesutil/bytesutil.go
Pack
func Pack(a []byte, width int, val byte) []byte { var i, j, jStart, end int fill := make([]byte, width) for i := 0; i < len(fill); i++ { fill[i] = val } // Skip the first run that won't move for ; i < len(a) && a[i] != val; i += width { } end = i for i < len(a) { // Find the next gap to remove for i <...
go
func Pack(a []byte, width int, val byte) []byte { var i, j, jStart, end int fill := make([]byte, width) for i := 0; i < len(fill); i++ { fill[i] = val } // Skip the first run that won't move for ; i < len(a) && a[i] != val; i += width { } end = i for i < len(a) { // Find the next gap to remove for i <...
[ "func", "Pack", "(", "a", "[", "]", "byte", ",", "width", "int", ",", "val", "byte", ")", "[", "]", "byte", "{", "var", "i", ",", "j", ",", "jStart", ",", "end", "int", "\n\n", "fill", ":=", "make", "(", "[", "]", "byte", ",", "width", ")", ...
// Pack converts a sparse array to a dense one. It removes sections of a containing // runs of val of length width. The returned value is a subslice of a.
[ "Pack", "converts", "a", "sparse", "array", "to", "a", "dense", "one", ".", "It", "removes", "sections", "of", "a", "containing", "runs", "of", "val", "of", "length", "width", ".", "The", "returned", "value", "is", "a", "subslice", "of", "a", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/bytesutil/bytesutil.go#L154-L189
123,964
influxdata/influxdb
http/swagger_assets.go
asset
func (s *swaggerLoader) asset(swaggerData []byte, err error) ([]byte, error) { return swaggerData, err }
go
func (s *swaggerLoader) asset(swaggerData []byte, err error) ([]byte, error) { return swaggerData, err }
[ "func", "(", "s", "*", "swaggerLoader", ")", "asset", "(", "swaggerData", "[", "]", "byte", ",", "err", "error", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "swaggerData", ",", "err", "\n", "}" ]
// asset returns its input arguments. // // There is a separate definition of asset when not using the assets build tag.
[ "asset", "returns", "its", "input", "arguments", ".", "There", "is", "a", "separate", "definition", "of", "asset", "when", "not", "using", "the", "assets", "build", "tag", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/swagger_assets.go#L8-L10
123,965
influxdata/influxdb
kv/org.go
addOrgOwner
func (s *Service) addOrgOwner(ctx context.Context, tx Tx, orgID influxdb.ID) error { return s.addResourceOwner(ctx, tx, influxdb.OrgsResourceType, orgID) }
go
func (s *Service) addOrgOwner(ctx context.Context, tx Tx, orgID influxdb.ID) error { return s.addResourceOwner(ctx, tx, influxdb.OrgsResourceType, orgID) }
[ "func", "(", "s", "*", "Service", ")", "addOrgOwner", "(", "ctx", "context", ".", "Context", ",", "tx", "Tx", ",", "orgID", "influxdb", ".", "ID", ")", "error", "{", "return", "s", ".", "addResourceOwner", "(", "ctx", ",", "tx", ",", "influxdb", ".",...
// addOrgOwner attempts to create a user resource mapping for the user on the // authorizer found on context. If no authorizer is found on context if returns an error.
[ "addOrgOwner", "attempts", "to", "create", "a", "user", "resource", "mapping", "for", "the", "user", "on", "the", "authorizer", "found", "on", "context", ".", "If", "no", "authorizer", "is", "found", "on", "context", "if", "returns", "an", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/org.go#L245-L247
123,966
influxdata/influxdb
kv/org.go
FindResourceOrganizationID
func (s *Service) FindResourceOrganizationID(ctx context.Context, rt influxdb.ResourceType, id influxdb.ID) (influxdb.ID, error) { switch rt { case influxdb.AuthorizationsResourceType: r, err := s.FindAuthorizationByID(ctx, id) if err != nil { return influxdb.InvalidID(), err } return r.OrgID, nil case in...
go
func (s *Service) FindResourceOrganizationID(ctx context.Context, rt influxdb.ResourceType, id influxdb.ID) (influxdb.ID, error) { switch rt { case influxdb.AuthorizationsResourceType: r, err := s.FindAuthorizationByID(ctx, id) if err != nil { return influxdb.InvalidID(), err } return r.OrgID, nil case in...
[ "func", "(", "s", "*", "Service", ")", "FindResourceOrganizationID", "(", "ctx", "context", ".", "Context", ",", "rt", "influxdb", ".", "ResourceType", ",", "id", "influxdb", ".", "ID", ")", "(", "influxdb", ".", "ID", ",", "error", ")", "{", "switch", ...
// FindResourceOrganizationID is used to find the organization that a resource belongs to five the id of a resource and a resource type.
[ "FindResourceOrganizationID", "is", "used", "to", "find", "the", "organization", "that", "a", "resource", "belongs", "to", "five", "the", "id", "of", "a", "resource", "and", "a", "resource", "type", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/org.go#L580-L635
123,967
influxdata/influxdb
kv/org.go
OrgAlreadyExistsError
func OrgAlreadyExistsError(o *influxdb.Organization) error { return &influxdb.Error{ Code: influxdb.EConflict, Msg: fmt.Sprintf("organization with name %s already exists", o.Name), } }
go
func OrgAlreadyExistsError(o *influxdb.Organization) error { return &influxdb.Error{ Code: influxdb.EConflict, Msg: fmt.Sprintf("organization with name %s already exists", o.Name), } }
[ "func", "OrgAlreadyExistsError", "(", "o", "*", "influxdb", ".", "Organization", ")", "error", "{", "return", "&", "influxdb", ".", "Error", "{", "Code", ":", "influxdb", ".", "EConflict", ",", "Msg", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "...
// OrgAlreadyExistsError is used when creating a new organization with // a name that has already been used. Organization names must be unique.
[ "OrgAlreadyExistsError", "is", "used", "when", "creating", "a", "new", "organization", "with", "a", "name", "that", "has", "already", "been", "used", ".", "Organization", "names", "must", "be", "unique", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/org.go#L639-L644
123,968
influxdata/influxdb
chronograf/oauth2/mux.go
NewAuthMux
func NewAuthMux(p Provider, a Authenticator, t Tokenizer, basepath string, l chronograf.Logger, UseIDToken bool) *AuthMux { return &AuthMux{ Provider: p, Auth: a, Tokens: t, SuccessURL: path.Join(basepath, "/"), FailureURL: path.Join(basepath, "/login"), Now: DefaultNowTime, Logger: ...
go
func NewAuthMux(p Provider, a Authenticator, t Tokenizer, basepath string, l chronograf.Logger, UseIDToken bool) *AuthMux { return &AuthMux{ Provider: p, Auth: a, Tokens: t, SuccessURL: path.Join(basepath, "/"), FailureURL: path.Join(basepath, "/login"), Now: DefaultNowTime, Logger: ...
[ "func", "NewAuthMux", "(", "p", "Provider", ",", "a", "Authenticator", ",", "t", "Tokenizer", ",", "basepath", "string", ",", "l", "chronograf", ".", "Logger", ",", "UseIDToken", "bool", ")", "*", "AuthMux", "{", "return", "&", "AuthMux", "{", "Provider", ...
// NewAuthMux constructs a Mux handler that checks a cookie against the authenticator
[ "NewAuthMux", "constructs", "a", "Mux", "handler", "that", "checks", "a", "cookie", "against", "the", "authenticator" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/mux.go#L19-L30
123,969
influxdata/influxdb
chronograf/oauth2/mux.go
Login
func (j *AuthMux) Login() http.Handler { conf := j.Provider.Config() return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // We are creating a token with an encoded random string to prevent CSRF attacks // This token will be validated during the OAuth callback. // We'll give our users 10 minut...
go
func (j *AuthMux) Login() http.Handler { conf := j.Provider.Config() return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // We are creating a token with an encoded random string to prevent CSRF attacks // This token will be validated during the OAuth callback. // We'll give our users 10 minut...
[ "func", "(", "j", "*", "AuthMux", ")", "Login", "(", ")", "http", ".", "Handler", "{", "conf", ":=", "j", ".", "Provider", ".", "Config", "(", ")", "\n", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",...
// Login uses a Cookie with a random string as the state validation method. JWTs are // a good choice here for encoding because they can be validated without // storing state. Login returns a handler that redirects to the providers OAuth login.
[ "Login", "uses", "a", "Cookie", "with", "a", "random", "string", "as", "the", "state", "validation", "method", ".", "JWTs", "are", "a", "good", "choice", "here", "for", "encoding", "because", "they", "can", "be", "validated", "without", "storing", "state", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/mux.go#L51-L85
123,970
influxdata/influxdb
chronograf/oauth2/mux.go
Logout
func (j *AuthMux) Logout() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { j.Auth.Expire(w) http.Redirect(w, r, j.SuccessURL, http.StatusTemporaryRedirect) }) }
go
func (j *AuthMux) Logout() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { j.Auth.Expire(w) http.Redirect(w, r, j.SuccessURL, http.StatusTemporaryRedirect) }) }
[ "func", "(", "j", "*", "AuthMux", ")", "Logout", "(", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "j", ".", "Auth", ...
// Logout handler will expire our authentication cookie and redirect to the successURL
[ "Logout", "handler", "will", "expire", "our", "authentication", "cookie", "and", "redirect", "to", "the", "successURL" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/mux.go#L196-L201
123,971
influxdata/influxdb
pkg/mmap/mmap_windows.go
Map
func Map(path string, sz int64) ([]byte, error) { fi, err := os.Stat(path) if err != nil { return nil, err } // Truncate file to size if too small. if fi.Size() < sz { if err := os.Truncate(path, sz); err != nil { return nil, err } } else { sz = fi.Size() } if sz == 0 { return nil, nil } f, err...
go
func Map(path string, sz int64) ([]byte, error) { fi, err := os.Stat(path) if err != nil { return nil, err } // Truncate file to size if too small. if fi.Size() < sz { if err := os.Truncate(path, sz); err != nil { return nil, err } } else { sz = fi.Size() } if sz == 0 { return nil, nil } f, err...
[ "func", "Map", "(", "path", "string", ",", "sz", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "fi", ",", "err", ":=", "os", ".", "Stat", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n",...
// Map memory-maps a file.
[ "Map", "memory", "-", "maps", "a", "file", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/mmap/mmap_windows.go#L10-L48
123,972
influxdata/influxdb
http/authentication_middleware.go
NewAuthenticationHandler
func NewAuthenticationHandler() *AuthenticationHandler { return &AuthenticationHandler{ Logger: zap.NewNop(), Handler: http.DefaultServeMux, noAuthRouter: httprouter.New(), } }
go
func NewAuthenticationHandler() *AuthenticationHandler { return &AuthenticationHandler{ Logger: zap.NewNop(), Handler: http.DefaultServeMux, noAuthRouter: httprouter.New(), } }
[ "func", "NewAuthenticationHandler", "(", ")", "*", "AuthenticationHandler", "{", "return", "&", "AuthenticationHandler", "{", "Logger", ":", "zap", ".", "NewNop", "(", ")", ",", "Handler", ":", "http", ".", "DefaultServeMux", ",", "noAuthRouter", ":", "httproute...
// NewAuthenticationHandler creates an authentication handler.
[ "NewAuthenticationHandler", "creates", "an", "authentication", "handler", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/authentication_middleware.go#L30-L36
123,973
influxdata/influxdb
http/authentication_middleware.go
RegisterNoAuthRoute
func (h *AuthenticationHandler) RegisterNoAuthRoute(method, path string) { // the handler specified here does not matter. h.noAuthRouter.HandlerFunc(method, path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) }
go
func (h *AuthenticationHandler) RegisterNoAuthRoute(method, path string) { // the handler specified here does not matter. h.noAuthRouter.HandlerFunc(method, path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) }
[ "func", "(", "h", "*", "AuthenticationHandler", ")", "RegisterNoAuthRoute", "(", "method", ",", "path", "string", ")", "{", "// the handler specified here does not matter.", "h", ".", "noAuthRouter", ".", "HandlerFunc", "(", "method", ",", "path", ",", "http", "."...
// RegisterNoAuthRoute excludes routes from needing authentication.
[ "RegisterNoAuthRoute", "excludes", "routes", "from", "needing", "authentication", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/authentication_middleware.go#L39-L42
123,974
influxdata/influxdb
http/authentication_middleware.go
ProbeAuthScheme
func ProbeAuthScheme(r *http.Request) (string, error) { _, tokenErr := GetToken(r) _, sessErr := decodeCookieSession(r.Context(), r) if tokenErr != nil && sessErr != nil { return "", fmt.Errorf("token required") } if tokenErr == nil { return tokenAuthScheme, nil } return sessionAuthScheme, nil }
go
func ProbeAuthScheme(r *http.Request) (string, error) { _, tokenErr := GetToken(r) _, sessErr := decodeCookieSession(r.Context(), r) if tokenErr != nil && sessErr != nil { return "", fmt.Errorf("token required") } if tokenErr == nil { return tokenAuthScheme, nil } return sessionAuthScheme, nil }
[ "func", "ProbeAuthScheme", "(", "r", "*", "http", ".", "Request", ")", "(", "string", ",", "error", ")", "{", "_", ",", "tokenErr", ":=", "GetToken", "(", "r", ")", "\n", "_", ",", "sessErr", ":=", "decodeCookieSession", "(", "r", ".", "Context", "("...
// ProbeAuthScheme probes the http request for the requests for token or cookie session.
[ "ProbeAuthScheme", "probes", "the", "http", "request", "for", "the", "requests", "for", "token", "or", "cookie", "session", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/authentication_middleware.go#L50-L63
123,975
influxdata/influxdb
http/authentication_middleware.go
ServeHTTP
func (h *AuthenticationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if handler, _, _ := h.noAuthRouter.Lookup(r.Method, r.URL.Path); handler != nil { h.Handler.ServeHTTP(w, r) return } ctx := r.Context() scheme, err := ProbeAuthScheme(r) if err != nil { UnauthorizedError(ctx, w) return } ...
go
func (h *AuthenticationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if handler, _, _ := h.noAuthRouter.Lookup(r.Method, r.URL.Path); handler != nil { h.Handler.ServeHTTP(w, r) return } ctx := r.Context() scheme, err := ProbeAuthScheme(r) if err != nil { UnauthorizedError(ctx, w) return } ...
[ "func", "(", "h", "*", "AuthenticationHandler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "handler", ",", "_", ",", "_", ":=", "h", ".", "noAuthRouter", ".", "Lookup", "(", "r", ...
// ServeHTTP extracts the session or token from the http request and places the resulting authorizer on the request context.
[ "ServeHTTP", "extracts", "the", "session", "or", "token", "from", "the", "http", "request", "and", "places", "the", "resulting", "authorizer", "on", "the", "request", "context", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/authentication_middleware.go#L66-L99
123,976
influxdata/influxdb
chronograf/server/service.go
TimeSeries
func (s *Service) TimeSeries(src chronograf.Source) (chronograf.TimeSeries, error) { return s.TimeSeriesClient.New(src, s.Logger) }
go
func (s *Service) TimeSeries(src chronograf.Source) (chronograf.TimeSeries, error) { return s.TimeSeriesClient.New(src, s.Logger) }
[ "func", "(", "s", "*", "Service", ")", "TimeSeries", "(", "src", "chronograf", ".", "Source", ")", "(", "chronograf", ".", "TimeSeries", ",", "error", ")", "{", "return", "s", ".", "TimeSeriesClient", ".", "New", "(", "src", ",", "s", ".", "Logger", ...
// TimeSeries returns a new client connected to a time series database
[ "TimeSeries", "returns", "a", "new", "client", "connected", "to", "a", "time", "series", "database" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/service.go#L39-L41
123,977
influxdata/influxdb
chronograf/server/service.go
New
func (c *InfluxClient) New(src chronograf.Source, logger chronograf.Logger) (chronograf.TimeSeries, error) { client := &influx.Client{ Logger: logger, } if err := client.Connect(context.TODO(), &src); err != nil { return nil, err } if src.Type == chronograf.InfluxEnterprise && src.MetaURL != "" { tls := stri...
go
func (c *InfluxClient) New(src chronograf.Source, logger chronograf.Logger) (chronograf.TimeSeries, error) { client := &influx.Client{ Logger: logger, } if err := client.Connect(context.TODO(), &src); err != nil { return nil, err } if src.Type == chronograf.InfluxEnterprise && src.MetaURL != "" { tls := stri...
[ "func", "(", "c", "*", "InfluxClient", ")", "New", "(", "src", "chronograf", ".", "Source", ",", "logger", "chronograf", ".", "Logger", ")", "(", "chronograf", ".", "TimeSeries", ",", "error", ")", "{", "client", ":=", "&", "influx", ".", "Client", "{"...
// New creates a client to connect to OSS or enterprise
[ "New", "creates", "a", "client", "to", "connect", "to", "OSS", "or", "enterprise" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/service.go#L47-L60
123,978
influxdata/influxdb
models/statistic.go
NewStatistic
func NewStatistic(name string) Statistic { return Statistic{ Name: name, Tags: make(map[string]string), Values: make(map[string]interface{}), } }
go
func NewStatistic(name string) Statistic { return Statistic{ Name: name, Tags: make(map[string]string), Values: make(map[string]interface{}), } }
[ "func", "NewStatistic", "(", "name", "string", ")", "Statistic", "{", "return", "Statistic", "{", "Name", ":", "name", ",", "Tags", ":", "make", "(", "map", "[", "string", "]", "string", ")", ",", "Values", ":", "make", "(", "map", "[", "string", "]"...
// NewStatistic returns an initialized Statistic.
[ "NewStatistic", "returns", "an", "initialized", "Statistic", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/statistic.go#L11-L17
123,979
influxdata/influxdb
models/statistic.go
Merge
func (t StatisticTags) Merge(tags map[string]string) map[string]string { // Add everything in tags to the result. out := make(map[string]string, len(tags)) for k, v := range tags { out[k] = v } // Only add values from t that don't appear in tags. for k, v := range t { if _, ok := tags[k]; !ok { out[k] = v...
go
func (t StatisticTags) Merge(tags map[string]string) map[string]string { // Add everything in tags to the result. out := make(map[string]string, len(tags)) for k, v := range tags { out[k] = v } // Only add values from t that don't appear in tags. for k, v := range t { if _, ok := tags[k]; !ok { out[k] = v...
[ "func", "(", "t", "StatisticTags", ")", "Merge", "(", "tags", "map", "[", "string", "]", "string", ")", "map", "[", "string", "]", "string", "{", "// Add everything in tags to the result.", "out", ":=", "make", "(", "map", "[", "string", "]", "string", ","...
// Merge creates a new map containing the merged contents of tags and t. // If both tags and the receiver map contain the same key, the value in tags // is used in the resulting map. // // Merge always returns a usable map.
[ "Merge", "creates", "a", "new", "map", "containing", "the", "merged", "contents", "of", "tags", "and", "t", ".", "If", "both", "tags", "and", "the", "receiver", "map", "contain", "the", "same", "key", "the", "value", "in", "tags", "is", "used", "in", "...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/statistic.go#L28-L42
123,980
influxdata/influxdb
pkg/estimator/hll/hll.go
NewPlus
func NewPlus(p uint8) (*Plus, error) { if p > 18 || p < 4 { return nil, errors.New("precision must be between 4 and 18") } // p' = 25 is used in the Google paper. pp := uint8(25) hll := &Plus{ hash: xxhash.Sum64, p: p, pp: pp, m: 1 << p, mp: 1 << pp, tmpSet: set{}, sparse: tru...
go
func NewPlus(p uint8) (*Plus, error) { if p > 18 || p < 4 { return nil, errors.New("precision must be between 4 and 18") } // p' = 25 is used in the Google paper. pp := uint8(25) hll := &Plus{ hash: xxhash.Sum64, p: p, pp: pp, m: 1 << p, mp: 1 << pp, tmpSet: set{}, sparse: tru...
[ "func", "NewPlus", "(", "p", "uint8", ")", "(", "*", "Plus", ",", "error", ")", "{", "if", "p", ">", "18", "||", "p", "<", "4", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// p' = 25 is used in the G...
// NewPlus returns a new Plus with precision p. p must be between 4 and 18.
[ "NewPlus", "returns", "a", "new", "Plus", "with", "precision", "p", ".", "p", "must", "be", "between", "4", "and", "18", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L71-L103
123,981
influxdata/influxdb
pkg/estimator/hll/hll.go
Bytes
func (h *Plus) Bytes() int { var b int b += len(h.tmpSet) * 4 b += cap(h.denseList) if h.sparseList != nil { b += int(unsafe.Sizeof(*h.sparseList)) b += cap(h.sparseList.b) } b += int(unsafe.Sizeof(*h)) return b }
go
func (h *Plus) Bytes() int { var b int b += len(h.tmpSet) * 4 b += cap(h.denseList) if h.sparseList != nil { b += int(unsafe.Sizeof(*h.sparseList)) b += cap(h.sparseList.b) } b += int(unsafe.Sizeof(*h)) return b }
[ "func", "(", "h", "*", "Plus", ")", "Bytes", "(", ")", "int", "{", "var", "b", "int", "\n", "b", "+=", "len", "(", "h", ".", "tmpSet", ")", "*", "4", "\n", "b", "+=", "cap", "(", "h", ".", "denseList", ")", "\n", "if", "h", ".", "sparseList...
// Bytes estimates the memory footprint of this Plus, in bytes.
[ "Bytes", "estimates", "the", "memory", "footprint", "of", "this", "Plus", "in", "bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L106-L116
123,982
influxdata/influxdb
pkg/estimator/hll/hll.go
NewDefaultPlus
func NewDefaultPlus() *Plus { p, err := NewPlus(DefaultPrecision) if err != nil { panic(err) } return p }
go
func NewDefaultPlus() *Plus { p, err := NewPlus(DefaultPrecision) if err != nil { panic(err) } return p }
[ "func", "NewDefaultPlus", "(", ")", "*", "Plus", "{", "p", ",", "err", ":=", "NewPlus", "(", "DefaultPrecision", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "p", "\n", "}" ]
// NewDefaultPlus creates a new Plus with the default precision.
[ "NewDefaultPlus", "creates", "a", "new", "Plus", "with", "the", "default", "precision", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L119-L125
123,983
influxdata/influxdb
pkg/estimator/hll/hll.go
Clone
func (h *Plus) Clone() estimator.Sketch { var hll = &Plus{ hash: h.hash, p: h.p, pp: h.pp, m: h.m, mp: h.mp, alpha: h.alpha, sparse: h.sparse, tmpSet: h.tmpSet.Clone(), sparseList: h.sparseList.Clone(), } hll.denseList = make([]uint8, len(h.dens...
go
func (h *Plus) Clone() estimator.Sketch { var hll = &Plus{ hash: h.hash, p: h.p, pp: h.pp, m: h.m, mp: h.mp, alpha: h.alpha, sparse: h.sparse, tmpSet: h.tmpSet.Clone(), sparseList: h.sparseList.Clone(), } hll.denseList = make([]uint8, len(h.dens...
[ "func", "(", "h", "*", "Plus", ")", "Clone", "(", ")", "estimator", ".", "Sketch", "{", "var", "hll", "=", "&", "Plus", "{", "hash", ":", "h", ".", "hash", ",", "p", ":", "h", ".", "p", ",", "pp", ":", "h", ".", "pp", ",", "m", ":", "h", ...
// Clone returns a deep copy of h.
[ "Clone", "returns", "a", "deep", "copy", "of", "h", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L128-L144
123,984
influxdata/influxdb
pkg/estimator/hll/hll.go
Add
func (h *Plus) Add(v []byte) { x := h.hash(v) if h.sparse { h.tmpSet.add(h.encodeHash(x)) if uint32(len(h.tmpSet))*100 > h.m { h.mergeSparse() if uint32(h.sparseList.Len()) > h.m { h.toNormal() } } } else { i := bextr(x, 64-h.p, h.p) // {x63,...,x64-p} w := x<<h.p | 1<<(h.p-1) // {x63-p,......
go
func (h *Plus) Add(v []byte) { x := h.hash(v) if h.sparse { h.tmpSet.add(h.encodeHash(x)) if uint32(len(h.tmpSet))*100 > h.m { h.mergeSparse() if uint32(h.sparseList.Len()) > h.m { h.toNormal() } } } else { i := bextr(x, 64-h.p, h.p) // {x63,...,x64-p} w := x<<h.p | 1<<(h.p-1) // {x63-p,......
[ "func", "(", "h", "*", "Plus", ")", "Add", "(", "v", "[", "]", "byte", ")", "{", "x", ":=", "h", ".", "hash", "(", "v", ")", "\n", "if", "h", ".", "sparse", "{", "h", ".", "tmpSet", ".", "add", "(", "h", ".", "encodeHash", "(", "x", ")", ...
// Add adds a new value to the HLL.
[ "Add", "adds", "a", "new", "value", "to", "the", "HLL", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L147-L167
123,985
influxdata/influxdb
pkg/estimator/hll/hll.go
Count
func (h *Plus) Count() uint64 { if h == nil { return 0 // Nothing to do. } if h.sparse { h.mergeSparse() return uint64(h.linearCount(h.mp, h.mp-uint32(h.sparseList.count))) } sum := 0.0 m := float64(h.m) var count float64 for _, val := range h.denseList { sum += 1.0 / float64(uint32(1)<<val) if val =...
go
func (h *Plus) Count() uint64 { if h == nil { return 0 // Nothing to do. } if h.sparse { h.mergeSparse() return uint64(h.linearCount(h.mp, h.mp-uint32(h.sparseList.count))) } sum := 0.0 m := float64(h.m) var count float64 for _, val := range h.denseList { sum += 1.0 / float64(uint32(1)<<val) if val =...
[ "func", "(", "h", "*", "Plus", ")", "Count", "(", ")", "uint64", "{", "if", "h", "==", "nil", "{", "return", "0", "// Nothing to do.", "\n", "}", "\n\n", "if", "h", ".", "sparse", "{", "h", ".", "mergeSparse", "(", ")", "\n", "return", "uint64", ...
// Count returns a cardinality estimate.
[ "Count", "returns", "a", "cardinality", "estimate", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L170-L190
123,986
influxdata/influxdb
pkg/estimator/hll/hll.go
Merge
func (h *Plus) Merge(s estimator.Sketch) error { if s == nil { // Nothing to do return nil } other, ok := s.(*Plus) if !ok { return fmt.Errorf("wrong type for merging: %T", other) } if h.p != other.p { return errors.New("precisions must be equal") } if h.sparse { h.toNormal() } if other.sparse {...
go
func (h *Plus) Merge(s estimator.Sketch) error { if s == nil { // Nothing to do return nil } other, ok := s.(*Plus) if !ok { return fmt.Errorf("wrong type for merging: %T", other) } if h.p != other.p { return errors.New("precisions must be equal") } if h.sparse { h.toNormal() } if other.sparse {...
[ "func", "(", "h", "*", "Plus", ")", "Merge", "(", "s", "estimator", ".", "Sketch", ")", "error", "{", "if", "s", "==", "nil", "{", "// Nothing to do", "return", "nil", "\n", "}", "\n\n", "other", ",", "ok", ":=", "s", ".", "(", "*", "Plus", ")", ...
// Merge takes another HyperLogLogPlus and combines it with HyperLogLogPlus h. // If HyperLogLogPlus h is using the sparse representation, it will be converted // to the normal representation.
[ "Merge", "takes", "another", "HyperLogLogPlus", "and", "combines", "it", "with", "HyperLogLogPlus", "h", ".", "If", "HyperLogLogPlus", "h", "is", "using", "the", "sparse", "representation", "it", "will", "be", "converted", "to", "the", "normal", "representation", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L195-L236
123,987
influxdata/influxdb
pkg/estimator/hll/hll.go
toNormal
func (h *Plus) toNormal() { if len(h.tmpSet) > 0 { h.mergeSparse() } h.denseList = make([]uint8, h.m) for iter := h.sparseList.Iter(); iter.HasNext(); { i, r := h.decodeHash(iter.Next()) if h.denseList[i] < r { h.denseList[i] = r } } h.sparse = false h.tmpSet = nil h.sparseList = nil }
go
func (h *Plus) toNormal() { if len(h.tmpSet) > 0 { h.mergeSparse() } h.denseList = make([]uint8, h.m) for iter := h.sparseList.Iter(); iter.HasNext(); { i, r := h.decodeHash(iter.Next()) if h.denseList[i] < r { h.denseList[i] = r } } h.sparse = false h.tmpSet = nil h.sparseList = nil }
[ "func", "(", "h", "*", "Plus", ")", "toNormal", "(", ")", "{", "if", "len", "(", "h", ".", "tmpSet", ")", ">", "0", "{", "h", ".", "mergeSparse", "(", ")", "\n", "}", "\n\n", "h", ".", "denseList", "=", "make", "(", "[", "]", "uint8", ",", ...
// Convert from sparse representation to dense representation.
[ "Convert", "from", "sparse", "representation", "to", "dense", "representation", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/estimator/hll/hll.go#L379-L395
123,988
influxdata/influxdb
tsdb/tsi1/index_file.go
bytes
func (f *IndexFile) bytes() int { var b int // Do not count f.data contents because it is mmap'd b += int(unsafe.Sizeof(f.data)) b += int(unsafe.Sizeof(f.res)) b += int(unsafe.Sizeof(f.sfile)) b += int(unsafe.Sizeof(f.sfileref)) // Do not count SeriesFile because it belongs to the code that constructed this Inde...
go
func (f *IndexFile) bytes() int { var b int // Do not count f.data contents because it is mmap'd b += int(unsafe.Sizeof(f.data)) b += int(unsafe.Sizeof(f.res)) b += int(unsafe.Sizeof(f.sfile)) b += int(unsafe.Sizeof(f.sfileref)) // Do not count SeriesFile because it belongs to the code that constructed this Inde...
[ "func", "(", "f", "*", "IndexFile", ")", "bytes", "(", ")", "int", "{", "var", "b", "int", "\n", "// Do not count f.data contents because it is mmap'd", "b", "+=", "int", "(", "unsafe", ".", "Sizeof", "(", "f", ".", "data", ")", ")", "\n", "b", "+=", "...
// bytes estimates the memory footprint of this IndexFile, in bytes.
[ "bytes", "estimates", "the", "memory", "footprint", "of", "this", "IndexFile", "in", "bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L85-L108
123,989
influxdata/influxdb
tsdb/tsi1/index_file.go
Compacting
func (f *IndexFile) Compacting() bool { f.mu.RLock() v := f.compacting f.mu.RUnlock() return v }
go
func (f *IndexFile) Compacting() bool { f.mu.RLock() v := f.compacting f.mu.RUnlock() return v }
[ "func", "(", "f", "*", "IndexFile", ")", "Compacting", "(", ")", "bool", "{", "f", ".", "mu", ".", "RLock", "(", ")", "\n", "v", ":=", "f", ".", "compacting", "\n", "f", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "v", "\n", "}" ]
// Compacting returns true if the file is being compacted.
[ "Compacting", "returns", "true", "if", "the", "file", "is", "being", "compacted", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L183-L188
123,990
influxdata/influxdb
tsdb/tsi1/index_file.go
UnmarshalBinary
func (f *IndexFile) UnmarshalBinary(data []byte) error { // Ensure magic number exists at the beginning. if len(data) < len(FileSignature) { return io.ErrShortBuffer } else if !bytes.Equal(data[:len(FileSignature)], []byte(FileSignature)) { return ErrInvalidIndexFile } // Read index file trailer. t, err := R...
go
func (f *IndexFile) UnmarshalBinary(data []byte) error { // Ensure magic number exists at the beginning. if len(data) < len(FileSignature) { return io.ErrShortBuffer } else if !bytes.Equal(data[:len(FileSignature)], []byte(FileSignature)) { return ErrInvalidIndexFile } // Read index file trailer. t, err := R...
[ "func", "(", "f", "*", "IndexFile", ")", "UnmarshalBinary", "(", "data", "[", "]", "byte", ")", "error", "{", "// Ensure magic number exists at the beginning.", "if", "len", "(", "data", ")", "<", "len", "(", "FileSignature", ")", "{", "return", "io", ".", ...
// UnmarshalBinary opens an index from data. // The byte slice is retained so it must be kept open.
[ "UnmarshalBinary", "opens", "an", "index", "from", "data", ".", "The", "byte", "slice", "is", "retained", "so", "it", "must", "be", "kept", "open", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L192-L238
123,991
influxdata/influxdb
tsdb/tsi1/index_file.go
MeasurementN
func (f *IndexFile) MeasurementN() (n uint64) { mitr := f.mblk.Iterator() for me := mitr.Next(); me != nil; me = mitr.Next() { n++ } return n }
go
func (f *IndexFile) MeasurementN() (n uint64) { mitr := f.mblk.Iterator() for me := mitr.Next(); me != nil; me = mitr.Next() { n++ } return n }
[ "func", "(", "f", "*", "IndexFile", ")", "MeasurementN", "(", ")", "(", "n", "uint64", ")", "{", "mitr", ":=", "f", ".", "mblk", ".", "Iterator", "(", ")", "\n", "for", "me", ":=", "mitr", ".", "Next", "(", ")", ";", "me", "!=", "nil", ";", "...
// MeasurementN returns the number of measurements in the file.
[ "MeasurementN", "returns", "the", "number", "of", "measurements", "in", "the", "file", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L266-L272
123,992
influxdata/influxdb
tsdb/tsi1/index_file.go
MeasurementHasSeries
func (f *IndexFile) MeasurementHasSeries(ss *tsdb.SeriesIDSet, name []byte) (ok bool) { e, ok := f.mblk.Elem(name) if !ok { return false } var exists bool e.ForEachSeriesID(func(id tsdb.SeriesID) error { if ss.Contains(id) { exists = true return errors.New("done") } return nil }) return exists }
go
func (f *IndexFile) MeasurementHasSeries(ss *tsdb.SeriesIDSet, name []byte) (ok bool) { e, ok := f.mblk.Elem(name) if !ok { return false } var exists bool e.ForEachSeriesID(func(id tsdb.SeriesID) error { if ss.Contains(id) { exists = true return errors.New("done") } return nil }) return exists }
[ "func", "(", "f", "*", "IndexFile", ")", "MeasurementHasSeries", "(", "ss", "*", "tsdb", ".", "SeriesIDSet", ",", "name", "[", "]", "byte", ")", "(", "ok", "bool", ")", "{", "e", ",", "ok", ":=", "f", ".", "mblk", ".", "Elem", "(", "name", ")", ...
// MeasurementHasSeries returns true if a measurement has any non-tombstoned series.
[ "MeasurementHasSeries", "returns", "true", "if", "a", "measurement", "has", "any", "non", "-", "tombstoned", "series", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L275-L290
123,993
influxdata/influxdb
tsdb/tsi1/index_file.go
TagValueIterator
func (f *IndexFile) TagValueIterator(name, key []byte) TagValueIterator { tblk := f.tblks[string(name)] if tblk == nil { return nil } // Find key element. ke := tblk.TagKeyElem(key) if ke == nil { return nil } // Merge all value series iterators together. return ke.TagValueIterator() }
go
func (f *IndexFile) TagValueIterator(name, key []byte) TagValueIterator { tblk := f.tblks[string(name)] if tblk == nil { return nil } // Find key element. ke := tblk.TagKeyElem(key) if ke == nil { return nil } // Merge all value series iterators together. return ke.TagValueIterator() }
[ "func", "(", "f", "*", "IndexFile", ")", "TagValueIterator", "(", "name", ",", "key", "[", "]", "byte", ")", "TagValueIterator", "{", "tblk", ":=", "f", ".", "tblks", "[", "string", "(", "name", ")", "]", "\n", "if", "tblk", "==", "nil", "{", "retu...
// TagValueIterator returns a value iterator for a tag key and a flag // indicating if a tombstone exists on the measurement or key.
[ "TagValueIterator", "returns", "a", "value", "iterator", "for", "a", "tag", "key", "and", "a", "flag", "indicating", "if", "a", "tombstone", "exists", "on", "the", "measurement", "or", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L294-L308
123,994
influxdata/influxdb
tsdb/tsi1/index_file.go
TagKeySeriesIDIterator
func (f *IndexFile) TagKeySeriesIDIterator(name, key []byte) tsdb.SeriesIDIterator { tblk := f.tblks[string(name)] if tblk == nil { return nil } // Find key element. ke := tblk.TagKeyElem(key) if ke == nil { return nil } // Merge all value series iterators together. vitr := ke.TagValueIterator() var itr...
go
func (f *IndexFile) TagKeySeriesIDIterator(name, key []byte) tsdb.SeriesIDIterator { tblk := f.tblks[string(name)] if tblk == nil { return nil } // Find key element. ke := tblk.TagKeyElem(key) if ke == nil { return nil } // Merge all value series iterators together. vitr := ke.TagValueIterator() var itr...
[ "func", "(", "f", "*", "IndexFile", ")", "TagKeySeriesIDIterator", "(", "name", ",", "key", "[", "]", "byte", ")", "tsdb", ".", "SeriesIDIterator", "{", "tblk", ":=", "f", ".", "tblks", "[", "string", "(", "name", ")", "]", "\n", "if", "tblk", "==", ...
// TagKeySeriesIDIterator returns a series iterator for a tag key and a flag // indicating if a tombstone exists on the measurement or key.
[ "TagKeySeriesIDIterator", "returns", "a", "series", "iterator", "for", "a", "tag", "key", "and", "a", "flag", "indicating", "if", "a", "tombstone", "exists", "on", "the", "measurement", "or", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L312-L333
123,995
influxdata/influxdb
tsdb/tsi1/index_file.go
TagValueSeriesIDSet
func (f *IndexFile) TagValueSeriesIDSet(name, key, value []byte) (*tsdb.SeriesIDSet, error) { tblk := f.tblks[string(name)] if tblk == nil { return nil, nil } // Find value element. var valueElem TagBlockValueElem if !tblk.DecodeTagValueElem(key, value, &valueElem) { return nil, nil } else if valueElem.Seri...
go
func (f *IndexFile) TagValueSeriesIDSet(name, key, value []byte) (*tsdb.SeriesIDSet, error) { tblk := f.tblks[string(name)] if tblk == nil { return nil, nil } // Find value element. var valueElem TagBlockValueElem if !tblk.DecodeTagValueElem(key, value, &valueElem) { return nil, nil } else if valueElem.Seri...
[ "func", "(", "f", "*", "IndexFile", ")", "TagValueSeriesIDSet", "(", "name", ",", "key", ",", "value", "[", "]", "byte", ")", "(", "*", "tsdb", ".", "SeriesIDSet", ",", "error", ")", "{", "tblk", ":=", "f", ".", "tblks", "[", "string", "(", "name",...
// TagValueSeriesIDSet returns a series id set for a tag value.
[ "TagValueSeriesIDSet", "returns", "a", "series", "id", "set", "for", "a", "tag", "value", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L336-L350
123,996
influxdata/influxdb
tsdb/tsi1/index_file.go
TagKey
func (f *IndexFile) TagKey(name, key []byte) TagKeyElem { tblk := f.tblks[string(name)] if tblk == nil { return nil } return tblk.TagKeyElem(key) }
go
func (f *IndexFile) TagKey(name, key []byte) TagKeyElem { tblk := f.tblks[string(name)] if tblk == nil { return nil } return tblk.TagKeyElem(key) }
[ "func", "(", "f", "*", "IndexFile", ")", "TagKey", "(", "name", ",", "key", "[", "]", "byte", ")", "TagKeyElem", "{", "tblk", ":=", "f", ".", "tblks", "[", "string", "(", "name", ")", "]", "\n", "if", "tblk", "==", "nil", "{", "return", "nil", ...
// TagKey returns a tag key.
[ "TagKey", "returns", "a", "tag", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L353-L359
123,997
influxdata/influxdb
tsdb/tsi1/index_file.go
HasSeries
func (f *IndexFile) HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool) { return f.sfile.HasSeries(name, tags, buf), false // TODO(benbjohnson): series tombstone }
go
func (f *IndexFile) HasSeries(name []byte, tags models.Tags, buf []byte) (exists, tombstoned bool) { return f.sfile.HasSeries(name, tags, buf), false // TODO(benbjohnson): series tombstone }
[ "func", "(", "f", "*", "IndexFile", ")", "HasSeries", "(", "name", "[", "]", "byte", ",", "tags", "models", ".", "Tags", ",", "buf", "[", "]", "byte", ")", "(", "exists", ",", "tombstoned", "bool", ")", "{", "return", "f", ".", "sfile", ".", "Has...
// HasSeries returns flags indicating if the series exists and if it is tombstoned.
[ "HasSeries", "returns", "flags", "indicating", "if", "the", "series", "exists", "and", "if", "it", "is", "tombstoned", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L371-L373
123,998
influxdata/influxdb
tsdb/tsi1/index_file.go
MeasurementSeriesIDIterator
func (f *IndexFile) MeasurementSeriesIDIterator(name []byte) tsdb.SeriesIDIterator { return f.mblk.SeriesIDIterator(name) }
go
func (f *IndexFile) MeasurementSeriesIDIterator(name []byte) tsdb.SeriesIDIterator { return f.mblk.SeriesIDIterator(name) }
[ "func", "(", "f", "*", "IndexFile", ")", "MeasurementSeriesIDIterator", "(", "name", "[", "]", "byte", ")", "tsdb", ".", "SeriesIDIterator", "{", "return", "f", ".", "mblk", ".", "SeriesIDIterator", "(", "name", ")", "\n", "}" ]
// MeasurementSeriesIDIterator returns an iterator over a measurement's series.
[ "MeasurementSeriesIDIterator", "returns", "an", "iterator", "over", "a", "measurement", "s", "series", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L400-L402
123,999
influxdata/influxdb
tsdb/tsi1/index_file.go
ReadIndexFileTrailer
func ReadIndexFileTrailer(data []byte) (IndexFileTrailer, error) { var t IndexFileTrailer // Read version. t.Version = int(binary.BigEndian.Uint16(data[len(data)-IndexFileVersionSize:])) if t.Version != IndexFileVersion { return t, ErrUnsupportedIndexFileVersion } // Slice trailer data. buf := data[len(data)...
go
func ReadIndexFileTrailer(data []byte) (IndexFileTrailer, error) { var t IndexFileTrailer // Read version. t.Version = int(binary.BigEndian.Uint16(data[len(data)-IndexFileVersionSize:])) if t.Version != IndexFileVersion { return t, ErrUnsupportedIndexFileVersion } // Slice trailer data. buf := data[len(data)...
[ "func", "ReadIndexFileTrailer", "(", "data", "[", "]", "byte", ")", "(", "IndexFileTrailer", ",", "error", ")", "{", "var", "t", "IndexFileTrailer", "\n\n", "// Read version.", "t", ".", "Version", "=", "int", "(", "binary", ".", "BigEndian", ".", "Uint16", ...
// ReadIndexFileTrailer returns the index file trailer from data.
[ "ReadIndexFileTrailer", "returns", "the", "index", "file", "trailer", "from", "data", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L405-L436