id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
124,600
influxdata/influxdb
chronograf/oauth2/generic.go
PrincipalID
func (g *Generic) PrincipalID(provider *http.Client) (string, error) { res := map[string]interface{}{} r, err := provider.Get(g.APIURL) if err != nil { return "", err } defer r.Body.Close() if err = json.NewDecoder(r.Body).Decode(&res); err != nil { return "", err } email := "" value := res[g.APIKey] i...
go
func (g *Generic) PrincipalID(provider *http.Client) (string, error) { res := map[string]interface{}{} r, err := provider.Get(g.APIURL) if err != nil { return "", err } defer r.Body.Close() if err = json.NewDecoder(r.Body).Decode(&res); err != nil { return "", err } email := "" value := res[g.APIKey] i...
[ "func", "(", "g", "*", "Generic", ")", "PrincipalID", "(", "provider", "*", "http", ".", "Client", ")", "(", "string", ",", "error", ")", "{", "res", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n\n", "r", ",", "err", ":=",...
// PrincipalID returns the email address of the user.
[ "PrincipalID", "returns", "the", "email", "address", "of", "the", "user", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L81-L120
124,601
influxdata/influxdb
chronograf/oauth2/generic.go
Group
func (g *Generic) Group(provider *http.Client) (string, error) { res := map[string]interface{}{} r, err := provider.Get(g.APIURL) if err != nil { return "", err } defer r.Body.Close() if err = json.NewDecoder(r.Body).Decode(&res); err != nil { return "", err } email := "" value := res[g.APIKey] if e, o...
go
func (g *Generic) Group(provider *http.Client) (string, error) { res := map[string]interface{}{} r, err := provider.Get(g.APIURL) if err != nil { return "", err } defer r.Body.Close() if err = json.NewDecoder(r.Body).Decode(&res); err != nil { return "", err } email := "" value := res[g.APIKey] if e, o...
[ "func", "(", "g", "*", "Generic", ")", "Group", "(", "provider", "*", "http", ".", "Client", ")", "(", "string", ",", "error", ")", "{", "res", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n\n", "r", ",", "err", ":=", "pr...
// Group returns the domain that a user belongs to in the // the generic OAuth.
[ "Group", "returns", "the", "domain", "that", "a", "user", "belongs", "to", "in", "the", "the", "generic", "OAuth", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L124-L158
124,602
influxdata/influxdb
chronograf/oauth2/generic.go
getPrimaryEmail
func (g *Generic) getPrimaryEmail(client *http.Client) (string, error) { emailsEndpoint := g.APIURL + "/emails" r, err := client.Get(emailsEndpoint) if err != nil { return "", err } defer r.Body.Close() emails := []*UserEmail{} if err = json.NewDecoder(r.Body).Decode(&emails); err != nil { return "", err }...
go
func (g *Generic) getPrimaryEmail(client *http.Client) (string, error) { emailsEndpoint := g.APIURL + "/emails" r, err := client.Get(emailsEndpoint) if err != nil { return "", err } defer r.Body.Close() emails := []*UserEmail{} if err = json.NewDecoder(r.Body).Decode(&emails); err != nil { return "", err }...
[ "func", "(", "g", "*", "Generic", ")", "getPrimaryEmail", "(", "client", "*", "http", ".", "Client", ")", "(", "string", ",", "error", ")", "{", "emailsEndpoint", ":=", "g", ".", "APIURL", "+", "\"", "\"", "\n", "r", ",", "err", ":=", "client", "."...
// getPrimaryEmail gets the private email account for the authenticated user.
[ "getPrimaryEmail", "gets", "the", "private", "email", "account", "for", "the", "authenticated", "user", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L168-L187
124,603
influxdata/influxdb
chronograf/oauth2/generic.go
ofDomain
func ofDomain(requiredDomains []string, email string) bool { for _, domain := range requiredDomains { emailDomain := fmt.Sprintf("@%s", domain) if strings.HasSuffix(email, emailDomain) { return true } } return false }
go
func ofDomain(requiredDomains []string, email string) bool { for _, domain := range requiredDomains { emailDomain := fmt.Sprintf("@%s", domain) if strings.HasSuffix(email, emailDomain) { return true } } return false }
[ "func", "ofDomain", "(", "requiredDomains", "[", "]", "string", ",", "email", "string", ")", "bool", "{", "for", "_", ",", "domain", ":=", "range", "requiredDomains", "{", "emailDomain", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "domain", ")", ...
// ofDomain makes sure that the email is in one of the required domains
[ "ofDomain", "makes", "sure", "that", "the", "email", "is", "in", "one", "of", "the", "required", "domains" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L199-L207
124,604
influxdata/influxdb
chronograf/oauth2/generic.go
PrincipalIDFromClaims
func (g *Generic) PrincipalIDFromClaims(claims gojwt.MapClaims) (string, error) { if id, ok := claims[g.APIKey].(string); ok { return id, nil } return "", fmt.Errorf("no claim for %s", g.APIKey) }
go
func (g *Generic) PrincipalIDFromClaims(claims gojwt.MapClaims) (string, error) { if id, ok := claims[g.APIKey].(string); ok { return id, nil } return "", fmt.Errorf("no claim for %s", g.APIKey) }
[ "func", "(", "g", "*", "Generic", ")", "PrincipalIDFromClaims", "(", "claims", "gojwt", ".", "MapClaims", ")", "(", "string", ",", "error", ")", "{", "if", "id", ",", "ok", ":=", "claims", "[", "g", ".", "APIKey", "]", ".", "(", "string", ")", ";",...
// PrincipalIDFromClaims verifies an optional id_token and extracts email address of the user
[ "PrincipalIDFromClaims", "verifies", "an", "optional", "id_token", "and", "extracts", "email", "address", "of", "the", "user" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L210-L215
124,605
influxdata/influxdb
chronograf/oauth2/generic.go
GroupFromClaims
func (g *Generic) GroupFromClaims(claims gojwt.MapClaims) (string, error) { if id, ok := claims[g.APIKey].(string); ok { email := strings.Split(id, "@") if len(email) != 2 { g.Logger.Error("malformed email address, expected %q to contain @ symbol", id) return "DEFAULT", nil } return email[1], nil } r...
go
func (g *Generic) GroupFromClaims(claims gojwt.MapClaims) (string, error) { if id, ok := claims[g.APIKey].(string); ok { email := strings.Split(id, "@") if len(email) != 2 { g.Logger.Error("malformed email address, expected %q to contain @ symbol", id) return "DEFAULT", nil } return email[1], nil } r...
[ "func", "(", "g", "*", "Generic", ")", "GroupFromClaims", "(", "claims", "gojwt", ".", "MapClaims", ")", "(", "string", ",", "error", ")", "{", "if", "id", ",", "ok", ":=", "claims", "[", "g", ".", "APIKey", "]", ".", "(", "string", ")", ";", "ok...
// GroupFromClaims verifies an optional id_token, extracts the email address of the user and splits off the domain part
[ "GroupFromClaims", "verifies", "an", "optional", "id_token", "extracts", "the", "email", "address", "of", "the", "user", "and", "splits", "off", "the", "domain", "part" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/oauth2/generic.go#L218-L230
124,606
influxdata/influxdb
chronograf/organizations/sources.go
NewSourcesStore
func NewSourcesStore(s chronograf.SourcesStore, org string) *SourcesStore { return &SourcesStore{ store: s, organization: org, } }
go
func NewSourcesStore(s chronograf.SourcesStore, org string) *SourcesStore { return &SourcesStore{ store: s, organization: org, } }
[ "func", "NewSourcesStore", "(", "s", "chronograf", ".", "SourcesStore", ",", "org", "string", ")", "*", "SourcesStore", "{", "return", "&", "SourcesStore", "{", "store", ":", "s", ",", "organization", ":", "org", ",", "}", "\n", "}" ]
// NewSourcesStore creates a new SourcesStore from an existing // chronograf.SourceStore and an organization string
[ "NewSourcesStore", "creates", "a", "new", "SourcesStore", "from", "an", "existing", "chronograf", ".", "SourceStore", "and", "an", "organization", "string" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/sources.go#L21-L26
124,607
influxdata/influxdb
chronograf/organizations/sources.go
All
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) { err := validOrganization(ctx) if err != nil { return nil, err } ds, err := s.store.All(ctx) if err != nil { return nil, err } // This filters sources without allocating // https://github.com/golang/go/wiki/SliceTricks#filtering...
go
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) { err := validOrganization(ctx) if err != nil { return nil, err } ds, err := s.store.All(ctx) if err != nil { return nil, err } // This filters sources without allocating // https://github.com/golang/go/wiki/SliceTricks#filtering...
[ "func", "(", "s", "*", "SourcesStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Source", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{...
// All retrieves all sources from the underlying SourceStore and filters them // by organization.
[ "All", "retrieves", "all", "sources", "from", "the", "underlying", "SourceStore", "and", "filters", "them", "by", "organization", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/sources.go#L30-L51
124,608
influxdata/influxdb
chronograf/organizations/sources.go
Add
func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error) { err := validOrganization(ctx) if err != nil { return chronograf.Source{}, err } d.Organization = s.organization return s.store.Add(ctx, d) }
go
func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error) { err := validOrganization(ctx) if err != nil { return chronograf.Source{}, err } d.Organization = s.organization return s.store.Add(ctx, d) }
[ "func", "(", "s", "*", "SourcesStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "d", "chronograf", ".", "Source", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "...
// Add creates a new Source in the SourcesStore with source.Organization set to be the // organization from the source store.
[ "Add", "creates", "a", "new", "Source", "in", "the", "SourcesStore", "with", "source", ".", "Organization", "set", "to", "be", "the", "organization", "from", "the", "source", "store", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/sources.go#L55-L63
124,609
influxdata/influxdb
chronograf/organizations/sources.go
Delete
func (s *SourcesStore) Delete(ctx context.Context, d chronograf.Source) error { err := validOrganization(ctx) if err != nil { return err } d, err = s.store.Get(ctx, d.ID) if err != nil { return err } return s.store.Delete(ctx, d) }
go
func (s *SourcesStore) Delete(ctx context.Context, d chronograf.Source) error { err := validOrganization(ctx) if err != nil { return err } d, err = s.store.Get(ctx, d.ID) if err != nil { return err } return s.store.Delete(ctx, d) }
[ "func", "(", "s", "*", "SourcesStore", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "d", "chronograf", ".", "Source", ")", "error", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "...
// Delete the source from SourcesStore
[ "Delete", "the", "source", "from", "SourcesStore" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/sources.go#L66-L78
124,610
influxdata/influxdb
chronograf/organizations/sources.go
Get
func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) { err := validOrganization(ctx) if err != nil { return chronograf.Source{}, err } d, err := s.store.Get(ctx, id) if err != nil { return chronograf.Source{}, err } if d.Organization != s.organization { return chronograf.Sou...
go
func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) { err := validOrganization(ctx) if err != nil { return chronograf.Source{}, err } d, err := s.store.Get(ctx, id) if err != nil { return chronograf.Source{}, err } if d.Organization != s.organization { return chronograf.Sou...
[ "func", "(", "s", "*", "SourcesStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "int", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "...
// Get returns a Source if the id exists and belongs to the organization that is set.
[ "Get", "returns", "a", "Source", "if", "the", "id", "exists", "and", "belongs", "to", "the", "organization", "that", "is", "set", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/sources.go#L81-L97
124,611
influxdata/influxdb
chronograf/organizations/servers.go
NewServersStore
func NewServersStore(s chronograf.ServersStore, org string) *ServersStore { return &ServersStore{ store: s, organization: org, } }
go
func NewServersStore(s chronograf.ServersStore, org string) *ServersStore { return &ServersStore{ store: s, organization: org, } }
[ "func", "NewServersStore", "(", "s", "chronograf", ".", "ServersStore", ",", "org", "string", ")", "*", "ServersStore", "{", "return", "&", "ServersStore", "{", "store", ":", "s", ",", "organization", ":", "org", ",", "}", "\n", "}" ]
// NewServersStore creates a new ServersStore from an existing // chronograf.ServerStore and an organization string
[ "NewServersStore", "creates", "a", "new", "ServersStore", "from", "an", "existing", "chronograf", ".", "ServerStore", "and", "an", "organization", "string" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/servers.go#L21-L26
124,612
influxdata/influxdb
chronograf/organizations/servers.go
All
func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error) { err := validOrganization(ctx) if err != nil { return nil, err } ds, err := s.store.All(ctx) if err != nil { return nil, err } // This filters servers without allocating // https://github.com/golang/go/wiki/SliceTricks#filtering-...
go
func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error) { err := validOrganization(ctx) if err != nil { return nil, err } ds, err := s.store.All(ctx) if err != nil { return nil, err } // This filters servers without allocating // https://github.com/golang/go/wiki/SliceTricks#filtering-...
[ "func", "(", "s", "*", "ServersStore", ")", "All", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "chronograf", ".", "Server", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{...
// All retrieves all servers from the underlying ServerStore and filters them // by organization.
[ "All", "retrieves", "all", "servers", "from", "the", "underlying", "ServerStore", "and", "filters", "them", "by", "organization", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/servers.go#L30-L50
124,613
influxdata/influxdb
chronograf/organizations/servers.go
Add
func (s *ServersStore) Add(ctx context.Context, d chronograf.Server) (chronograf.Server, error) { err := validOrganization(ctx) if err != nil { return chronograf.Server{}, err } d.Organization = s.organization return s.store.Add(ctx, d) }
go
func (s *ServersStore) Add(ctx context.Context, d chronograf.Server) (chronograf.Server, error) { err := validOrganization(ctx) if err != nil { return chronograf.Server{}, err } d.Organization = s.organization return s.store.Add(ctx, d) }
[ "func", "(", "s", "*", "ServersStore", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "d", "chronograf", ".", "Server", ")", "(", "chronograf", ".", "Server", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "...
// Add creates a new Server in the ServersStore with server.Organization set to be the // organization from the server store.
[ "Add", "creates", "a", "new", "Server", "in", "the", "ServersStore", "with", "server", ".", "Organization", "set", "to", "be", "the", "organization", "from", "the", "server", "store", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/servers.go#L54-L62
124,614
influxdata/influxdb
chronograf/organizations/servers.go
Get
func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error) { err := validOrganization(ctx) if err != nil { return chronograf.Server{}, err } d, err := s.store.Get(ctx, id) if err != nil { return chronograf.Server{}, err } if d.Organization != s.organization { return chronograf.Ser...
go
func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error) { err := validOrganization(ctx) if err != nil { return chronograf.Server{}, err } d, err := s.store.Get(ctx, id) if err != nil { return chronograf.Server{}, err } if d.Organization != s.organization { return chronograf.Ser...
[ "func", "(", "s", "*", "ServersStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "int", ")", "(", "chronograf", ".", "Server", ",", "error", ")", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "...
// Get returns a Server if the id exists and belongs to the organization that is set.
[ "Get", "returns", "a", "Server", "if", "the", "id", "exists", "and", "belongs", "to", "the", "organization", "that", "is", "set", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/servers.go#L80-L96
124,615
influxdata/influxdb
chronograf/organizations/servers.go
Update
func (s *ServersStore) Update(ctx context.Context, d chronograf.Server) error { err := validOrganization(ctx) if err != nil { return err } _, err = s.store.Get(ctx, d.ID) if err != nil { return err } return s.store.Update(ctx, d) }
go
func (s *ServersStore) Update(ctx context.Context, d chronograf.Server) error { err := validOrganization(ctx) if err != nil { return err } _, err = s.store.Get(ctx, d.ID) if err != nil { return err } return s.store.Update(ctx, d) }
[ "func", "(", "s", "*", "ServersStore", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "d", "chronograf", ".", "Server", ")", "error", "{", "err", ":=", "validOrganization", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "...
// Update the server in ServersStore.
[ "Update", "the", "server", "in", "ServersStore", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/servers.go#L99-L111
124,616
influxdata/influxdb
tsdb/tsi1/stats.go
Dec
func (s MeasurementCardinalityStats) Dec(name []byte) { v := s[string(name)] if v <= 1 { delete(s, string(name)) } else { s[string(name)] = v - 1 } }
go
func (s MeasurementCardinalityStats) Dec(name []byte) { v := s[string(name)] if v <= 1 { delete(s, string(name)) } else { s[string(name)] = v - 1 } }
[ "func", "(", "s", "MeasurementCardinalityStats", ")", "Dec", "(", "name", "[", "]", "byte", ")", "{", "v", ":=", "s", "[", "string", "(", "name", ")", "]", "\n", "if", "v", "<=", "1", "{", "delete", "(", "s", ",", "string", "(", "name", ")", ")...
// Dec decrements a measurement count by 1. Deleted if zero.
[ "Dec", "decrements", "a", "measurement", "count", "by", "1", ".", "Deleted", "if", "zero", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/stats.go#L47-L54
124,617
influxdata/influxdb
tsdb/tsi1/stats.go
Clone
func (s MeasurementCardinalityStats) Clone() MeasurementCardinalityStats { other := make(MeasurementCardinalityStats, len(s)) for k, v := range s { other[k] = v } return other }
go
func (s MeasurementCardinalityStats) Clone() MeasurementCardinalityStats { other := make(MeasurementCardinalityStats, len(s)) for k, v := range s { other[k] = v } return other }
[ "func", "(", "s", "MeasurementCardinalityStats", ")", "Clone", "(", ")", "MeasurementCardinalityStats", "{", "other", ":=", "make", "(", "MeasurementCardinalityStats", ",", "len", "(", "s", ")", ")", "\n", "for", "k", ",", "v", ":=", "range", "s", "{", "ot...
// Clone returns a copy of s.
[ "Clone", "returns", "a", "copy", "of", "s", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/stats.go#L71-L77
124,618
influxdata/influxdb
tsdb/tsi1/stats.go
ReadFrom
func (s MeasurementCardinalityStats) ReadFrom(r io.Reader) (n int64, err error) { br, ok := r.(io.ByteReader) if !ok { return 0, fmt.Errorf("tsm1.MeasurementCardinalityStats.ReadFrom: ByteReader required") } // Read & verify magic. magic := make([]byte, 4) nn, err := io.ReadFull(r, magic) if n += int64(nn); e...
go
func (s MeasurementCardinalityStats) ReadFrom(r io.Reader) (n int64, err error) { br, ok := r.(io.ByteReader) if !ok { return 0, fmt.Errorf("tsm1.MeasurementCardinalityStats.ReadFrom: ByteReader required") } // Read & verify magic. magic := make([]byte, 4) nn, err := io.ReadFull(r, magic) if n += int64(nn); e...
[ "func", "(", "s", "MeasurementCardinalityStats", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "br", ",", "ok", ":=", "r", ".", "(", "io", ".", "ByteReader", ")", "\n", "if", "!", "ok", "{"...
// ReadFrom reads stats from r in a binary format. Reader must also be an io.ByteReader.
[ "ReadFrom", "reads", "stats", "from", "r", "in", "a", "binary", "format", ".", "Reader", "must", "also", "be", "an", "io", ".", "ByteReader", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/stats.go#L80-L133
124,619
influxdata/influxdb
tsdb/tsi1/stats.go
readMeasurementFrom
func (s MeasurementCardinalityStats) readMeasurementFrom(r io.Reader) (n int64, err error) { br, ok := r.(io.ByteReader) if !ok { return 0, fmt.Errorf("tsm1.MeasurementCardinalityStats.readMeasurementFrom: ByteReader required") } // Read measurement name length. nameLen, err := binary.ReadVarint(br) if err != ...
go
func (s MeasurementCardinalityStats) readMeasurementFrom(r io.Reader) (n int64, err error) { br, ok := r.(io.ByteReader) if !ok { return 0, fmt.Errorf("tsm1.MeasurementCardinalityStats.readMeasurementFrom: ByteReader required") } // Read measurement name length. nameLen, err := binary.ReadVarint(br) if err != ...
[ "func", "(", "s", "MeasurementCardinalityStats", ")", "readMeasurementFrom", "(", "r", "io", ".", "Reader", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "br", ",", "ok", ":=", "r", ".", "(", "io", ".", "ByteReader", ")", "\n", "if", "!", ...
// readMeasurementFrom reads a measurement stat from r in a binary format.
[ "readMeasurementFrom", "reads", "a", "measurement", "stat", "from", "r", "in", "a", "binary", "format", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/stats.go#L136-L168
124,620
influxdata/influxdb
tsdb/tsi1/stats.go
WriteTo
func (s MeasurementCardinalityStats) WriteTo(w io.Writer) (n int64, err error) { // Write magic & version. nn, err := io.WriteString(w, MeasurementCardinalityStatsMagicNumber) if n += int64(nn); err != nil { return n, err } nn, err = w.Write([]byte{MeasurementCardinalityStatsVersion}) if n += int64(nn); err != ...
go
func (s MeasurementCardinalityStats) WriteTo(w io.Writer) (n int64, err error) { // Write magic & version. nn, err := io.WriteString(w, MeasurementCardinalityStatsMagicNumber) if n += int64(nn); err != nil { return n, err } nn, err = w.Write([]byte{MeasurementCardinalityStatsVersion}) if n += int64(nn); err != ...
[ "func", "(", "s", "MeasurementCardinalityStats", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "// Write magic & version.", "nn", ",", "err", ":=", "io", ".", "WriteString", "(", "w", ",", "Measurem...
// WriteTo writes stats to w in a binary format.
[ "WriteTo", "writes", "stats", "to", "w", "in", "a", "binary", "format", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/stats.go#L171-L210
124,621
influxdata/influxdb
chronograf/memdb/sources.go
Delete
func (store *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error { if store.Source == nil || store.Source.ID != src.ID { return fmt.Errorf("unable to find Source with id %d", src.ID) } store.Source = nil return nil }
go
func (store *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error { if store.Source == nil || store.Source.ID != src.ID { return fmt.Errorf("unable to find Source with id %d", src.ID) } store.Source = nil return nil }
[ "func", "(", "store", "*", "SourcesStore", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "src", "chronograf", ".", "Source", ")", "error", "{", "if", "store", ".", "Source", "==", "nil", "||", "store", ".", "Source", ".", "ID", "!=", "sr...
// Delete removes the SourcesStore.Soruce if it matches the provided Source
[ "Delete", "removes", "the", "SourcesStore", ".", "Soruce", "if", "it", "matches", "the", "provided", "Source" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/memdb/sources.go#L32-L38
124,622
influxdata/influxdb
chronograf/memdb/sources.go
Get
func (store *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) { if store.Source == nil || store.Source.ID != id { return chronograf.Source{}, fmt.Errorf("unable to find Source with id %d", id) } return *store.Source, nil }
go
func (store *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) { if store.Source == nil || store.Source.ID != id { return chronograf.Source{}, fmt.Errorf("unable to find Source with id %d", id) } return *store.Source, nil }
[ "func", "(", "store", "*", "SourcesStore", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "int", ")", "(", "chronograf", ".", "Source", ",", "error", ")", "{", "if", "store", ".", "Source", "==", "nil", "||", "store", ".", "Source", ...
// Get returns the configured source if the id matches
[ "Get", "returns", "the", "configured", "source", "if", "the", "id", "matches" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/memdb/sources.go#L41-L46
124,623
influxdata/influxdb
http/proxy_query_service.go
handlePing
func (h *ProxyQueryHandler) handlePing(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusNoContent) }
go
func (h *ProxyQueryHandler) handlePing(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusNoContent) }
[ "func", "(", "h", "*", "ProxyQueryHandler", ")", "handlePing", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "w", ...
// handlePing returns a simple response to let the client know the server is running.
[ "handlePing", "returns", "a", "simple", "response", "to", "let", "the", "client", "know", "the", "server", "is", "running", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/proxy_query_service.go#L54-L57
124,624
influxdata/influxdb
http/proxy_query_service.go
Ping
func (s *ProxyQueryService) Ping(ctx context.Context) error { u, err := newURL(s.Addr, "/ping") if err != nil { return err } hreq, err := http.NewRequest("GET", u.String(), nil) if err != nil { return err } SetToken(s.Token, hreq) hreq = hreq.WithContext(ctx) hc := newClient(u.Scheme, s.InsecureSkipVerif...
go
func (s *ProxyQueryService) Ping(ctx context.Context) error { u, err := newURL(s.Addr, "/ping") if err != nil { return err } hreq, err := http.NewRequest("GET", u.String(), nil) if err != nil { return err } SetToken(s.Token, hreq) hreq = hreq.WithContext(ctx) hc := newClient(u.Scheme, s.InsecureSkipVerif...
[ "func", "(", "s", "*", "ProxyQueryService", ")", "Ping", "(", "ctx", "context", ".", "Context", ")", "error", "{", "u", ",", "err", ":=", "newURL", "(", "s", ".", "Addr", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err",...
// Ping checks to see if the server is responding to a ping request.
[ "Ping", "checks", "to", "see", "if", "the", "server", "is", "responding", "to", "a", "ping", "request", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/proxy_query_service.go#L163-L183
124,625
influxdata/influxdb
prometheus/codec.go
Encode
func (e *Expfmt) Encode(mfs []*dto.MetricFamily) ([]byte, error) { return EncodeExpfmt(mfs, e.Format) }
go
func (e *Expfmt) Encode(mfs []*dto.MetricFamily) ([]byte, error) { return EncodeExpfmt(mfs, e.Format) }
[ "func", "(", "e", "*", "Expfmt", ")", "Encode", "(", "mfs", "[", "]", "*", "dto", ".", "MetricFamily", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "EncodeExpfmt", "(", "mfs", ",", "e", ".", "Format", ")", "\n", "}" ]
// Encode encodes metrics into prometheus exposition format bytes.
[ "Encode", "encodes", "metrics", "into", "prometheus", "exposition", "format", "bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/codec.go#L28-L30
124,626
influxdata/influxdb
prometheus/codec.go
DecodeExpfmt
func DecodeExpfmt(r io.Reader, format expfmt.Format) ([]*dto.MetricFamily, error) { dec := expfmt.NewDecoder(r, format) mfs := []*dto.MetricFamily{} for { var mf dto.MetricFamily if err := dec.Decode(&mf); err != nil { if err == io.EOF { break } if err != nil { return nil, err } } mfs = a...
go
func DecodeExpfmt(r io.Reader, format expfmt.Format) ([]*dto.MetricFamily, error) { dec := expfmt.NewDecoder(r, format) mfs := []*dto.MetricFamily{} for { var mf dto.MetricFamily if err := dec.Decode(&mf); err != nil { if err == io.EOF { break } if err != nil { return nil, err } } mfs = a...
[ "func", "DecodeExpfmt", "(", "r", "io", ".", "Reader", ",", "format", "expfmt", ".", "Format", ")", "(", "[", "]", "*", "dto", ".", "MetricFamily", ",", "error", ")", "{", "dec", ":=", "expfmt", ".", "NewDecoder", "(", "r", ",", "format", ")", "\n"...
// DecodeExpfmt decodes the reader of format into metric families.
[ "DecodeExpfmt", "decodes", "the", "reader", "of", "format", "into", "metric", "families", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/codec.go#L33-L49
124,627
influxdata/influxdb
prometheus/codec.go
Encode
func (j *JSON) Encode(mfs []*dto.MetricFamily) ([]byte, error) { return EncodeJSON(mfs) }
go
func (j *JSON) Encode(mfs []*dto.MetricFamily) ([]byte, error) { return EncodeJSON(mfs) }
[ "func", "(", "j", "*", "JSON", ")", "Encode", "(", "mfs", "[", "]", "*", "dto", ".", "MetricFamily", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "EncodeJSON", "(", "mfs", ")", "\n", "}" ]
// Encode encodes metrics JSON bytes. This not always works // as some prometheus values are NaN or Inf.
[ "Encode", "encodes", "metrics", "JSON", "bytes", ".", "This", "not", "always", "works", "as", "some", "prometheus", "values", "are", "NaN", "or", "Inf", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/codec.go#L72-L74
124,628
influxdata/influxdb
prometheus/codec.go
DecodeJSON
func DecodeJSON(r io.Reader) ([]*dto.MetricFamily, error) { dec := json.NewDecoder(r) families := []*dto.MetricFamily{} for { mfs := []*dto.MetricFamily{} if err := dec.Decode(&mfs); err == io.EOF { break } else if err != nil { return nil, err } families = append(families, mfs...) } return familie...
go
func DecodeJSON(r io.Reader) ([]*dto.MetricFamily, error) { dec := json.NewDecoder(r) families := []*dto.MetricFamily{} for { mfs := []*dto.MetricFamily{} if err := dec.Decode(&mfs); err == io.EOF { break } else if err != nil { return nil, err } families = append(families, mfs...) } return familie...
[ "func", "DecodeJSON", "(", "r", "io", ".", "Reader", ")", "(", "[", "]", "*", "dto", ".", "MetricFamily", ",", "error", ")", "{", "dec", ":=", "json", ".", "NewDecoder", "(", "r", ")", "\n", "families", ":=", "[", "]", "*", "dto", ".", "MetricFam...
// DecodeJSON decodes a JSON array of metrics families.
[ "DecodeJSON", "decodes", "a", "JSON", "array", "of", "metrics", "families", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/codec.go#L77-L91
124,629
influxdata/influxdb
prometheus/codec.go
Encode
func (l *LineProtocol) Encode(mfs []*dto.MetricFamily) ([]byte, error) { return EncodeLineProtocol(mfs) }
go
func (l *LineProtocol) Encode(mfs []*dto.MetricFamily) ([]byte, error) { return EncodeLineProtocol(mfs) }
[ "func", "(", "l", "*", "LineProtocol", ")", "Encode", "(", "mfs", "[", "]", "*", "dto", ".", "MetricFamily", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "EncodeLineProtocol", "(", "mfs", ")", "\n", "}" ]
// Encode encodes metrics into line protocol format bytes.
[ "Encode", "encodes", "metrics", "into", "line", "protocol", "format", "bytes", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/codec.go#L107-L109
124,630
influxdata/influxdb
prometheus/codec.go
EncodeLineProtocol
func EncodeLineProtocol(mfs []*dto.MetricFamily) ([]byte, error) { var b bytes.Buffer pts := points(mfs) for _, p := range pts { if _, err := b.WriteString(p.String()); err != nil { return nil, err } if err := b.WriteByte('\n'); err != nil { return nil, err } } return b.Bytes(), nil }
go
func EncodeLineProtocol(mfs []*dto.MetricFamily) ([]byte, error) { var b bytes.Buffer pts := points(mfs) for _, p := range pts { if _, err := b.WriteString(p.String()); err != nil { return nil, err } if err := b.WriteByte('\n'); err != nil { return nil, err } } return b.Bytes(), nil }
[ "func", "EncodeLineProtocol", "(", "mfs", "[", "]", "*", "dto", ".", "MetricFamily", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "b", "bytes", ".", "Buffer", "\n\n", "pts", ":=", "points", "(", "mfs", ")", "\n", "for", "_", ",", "p...
// EncodeLineProtocol converts prometheus metrics into line protocol.
[ "EncodeLineProtocol", "converts", "prometheus", "metrics", "into", "line", "protocol", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/prometheus/codec.go#L112-L125
124,631
influxdata/influxdb
chronograf/bolt/base.go
IsMigrationComplete
func IsMigrationComplete(db *bolt.DB, id string) (bool, error) { complete := false if err := db.View(func(tx *bolt.Tx) error { migration := tx.Bucket(SchemaVersionBucket).Get([]byte(id)) if migration != nil { complete = true } return nil }); err != nil { return true, err } return complete, nil }
go
func IsMigrationComplete(db *bolt.DB, id string) (bool, error) { complete := false if err := db.View(func(tx *bolt.Tx) error { migration := tx.Bucket(SchemaVersionBucket).Get([]byte(id)) if migration != nil { complete = true } return nil }); err != nil { return true, err } return complete, nil }
[ "func", "IsMigrationComplete", "(", "db", "*", "bolt", ".", "DB", ",", "id", "string", ")", "(", "bool", ",", "error", ")", "{", "complete", ":=", "false", "\n", "if", "err", ":=", "db", ".", "View", "(", "func", "(", "tx", "*", "bolt", ".", "Tx"...
// IsMigrationComplete checks for the presence of a particular migration id
[ "IsMigrationComplete", "checks", "for", "the", "presence", "of", "a", "particular", "migration", "id" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/base.go#L13-L26
124,632
influxdata/influxdb
chronograf/bolt/base.go
MarkMigrationAsComplete
func MarkMigrationAsComplete(db *bolt.DB, id string) error { if err := db.Update(func(tx *bolt.Tx) error { now := time.Now().UTC().Format(time.RFC3339) return tx.Bucket(SchemaVersionBucket).Put([]byte(id), []byte(now)) }); err != nil { return err } return nil }
go
func MarkMigrationAsComplete(db *bolt.DB, id string) error { if err := db.Update(func(tx *bolt.Tx) error { now := time.Now().UTC().Format(time.RFC3339) return tx.Bucket(SchemaVersionBucket).Put([]byte(id), []byte(now)) }); err != nil { return err } return nil }
[ "func", "MarkMigrationAsComplete", "(", "db", "*", "bolt", ".", "DB", ",", "id", "string", ")", "error", "{", "if", "err", ":=", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{", "now", ":=", "time", ".", "No...
// MarkMigrationAsComplete adds the migration id to the schema bucket
[ "MarkMigrationAsComplete", "adds", "the", "migration", "id", "to", "the", "schema", "bucket" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/base.go#L29-L38
124,633
influxdata/influxdb
chronograf/bolt/base.go
MigrateAll
func MigrateAll(client *Client) error { for _, m := range migrations { err := m.Migrate(client) if err != nil { return err } } return nil }
go
func MigrateAll(client *Client) error { for _, m := range migrations { err := m.Migrate(client) if err != nil { return err } } return nil }
[ "func", "MigrateAll", "(", "client", "*", "Client", ")", "error", "{", "for", "_", ",", "m", ":=", "range", "migrations", "{", "err", ":=", "m", ".", "Migrate", "(", "client", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", ...
// MigrateAll iterates through all known migrations and runs them in order
[ "MigrateAll", "iterates", "through", "all", "known", "migrations", "and", "runs", "them", "in", "order" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/base.go#L80-L90
124,634
influxdata/influxdb
pkg/rhh/metrics.go
NewMetrics
func NewMetrics(namespace, subsystem string, labels prometheus.Labels) *Metrics { var names []string for k := range labels { names = append(names, k) } sort.Strings(names) getPutNames := append(append([]string(nil), names...), "status") sort.Strings(getPutNames) return &Metrics{ LoadFactor: prometheus.NewG...
go
func NewMetrics(namespace, subsystem string, labels prometheus.Labels) *Metrics { var names []string for k := range labels { names = append(names, k) } sort.Strings(names) getPutNames := append(append([]string(nil), names...), "status") sort.Strings(getPutNames) return &Metrics{ LoadFactor: prometheus.NewG...
[ "func", "NewMetrics", "(", "namespace", ",", "subsystem", "string", ",", "labels", "prometheus", ".", "Labels", ")", "*", "Metrics", "{", "var", "names", "[", "]", "string", "\n", "for", "k", ":=", "range", "labels", "{", "names", "=", "append", "(", "...
// NewMetrics initialises prometheus metrics for tracking an RHH hashmap.
[ "NewMetrics", "initialises", "prometheus", "metrics", "for", "tracking", "an", "RHH", "hashmap", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/rhh/metrics.go#L25-L102
124,635
influxdata/influxdb
internal/yaml2json/main.go
main
func main() { in, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatal(err) } out, err := yaml.YAMLToJSON(in) if err != nil { log.Fatal(err) } _, err = os.Stdout.Write(out) if err != nil { log.Fatal(err) } }
go
func main() { in, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatal(err) } out, err := yaml.YAMLToJSON(in) if err != nil { log.Fatal(err) } _, err = os.Stdout.Write(out) if err != nil { log.Fatal(err) } }
[ "func", "main", "(", ")", "{", "in", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "os", ".", "Stdin", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "out", ",", "err", ":=", "yaml", ".", ...
// yaml2json reads yaml data from stdin and outputs json to stdout. // There are no arguments or flags.
[ "yaml2json", "reads", "yaml", "data", "from", "stdin", "and", "outputs", "json", "to", "stdout", ".", "There", "are", "no", "arguments", "or", "flags", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/internal/yaml2json/main.go#L13-L26
124,636
influxdata/influxdb
authorizer/variable.go
FindVariableByID
func (s *VariableService) FindVariableByID(ctx context.Context, id influxdb.ID) (*influxdb.Variable, error) { m, err := s.s.FindVariableByID(ctx, id) if err != nil { return nil, err } if err := authorizeReadVariable(ctx, m.OrganizationID, id); err != nil { return nil, err } return m, nil }
go
func (s *VariableService) FindVariableByID(ctx context.Context, id influxdb.ID) (*influxdb.Variable, error) { m, err := s.s.FindVariableByID(ctx, id) if err != nil { return nil, err } if err := authorizeReadVariable(ctx, m.OrganizationID, id); err != nil { return nil, err } return m, nil }
[ "func", "(", "s", "*", "VariableService", ")", "FindVariableByID", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "(", "*", "influxdb", ".", "Variable", ",", "error", ")", "{", "m", ",", "err", ":=", "s", ".", "s", "....
// FindVariableByID checks to see if the authorizer on context has read access to the id provided.
[ "FindVariableByID", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "read", "access", "to", "the", "id", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/variable.go#L55-L66
124,637
influxdata/influxdb
authorizer/variable.go
FindVariables
func (s *VariableService) FindVariables(ctx context.Context, filter influxdb.VariableFilter, opt ...influxdb.FindOptions) ([]*influxdb.Variable, error) { // TODO: we'll likely want to push this operation into the database since fetching the whole list of data will likely be expensive. ms, err := s.s.FindVariables(ctx...
go
func (s *VariableService) FindVariables(ctx context.Context, filter influxdb.VariableFilter, opt ...influxdb.FindOptions) ([]*influxdb.Variable, error) { // TODO: we'll likely want to push this operation into the database since fetching the whole list of data will likely be expensive. ms, err := s.s.FindVariables(ctx...
[ "func", "(", "s", "*", "VariableService", ")", "FindVariables", "(", "ctx", "context", ".", "Context", ",", "filter", "influxdb", ".", "VariableFilter", ",", "opt", "...", "influxdb", ".", "FindOptions", ")", "(", "[", "]", "*", "influxdb", ".", "Variable"...
// FindVariables retrieves all variables that match the provided filter and then filters the list down to only the resources that are authorized.
[ "FindVariables", "retrieves", "all", "variables", "that", "match", "the", "provided", "filter", "and", "then", "filters", "the", "list", "down", "to", "only", "the", "resources", "that", "are", "authorized", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/variable.go#L69-L93
124,638
influxdata/influxdb
authorizer/variable.go
CreateVariable
func (s *VariableService) CreateVariable(ctx context.Context, m *influxdb.Variable) error { p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.VariablesResourceType, m.OrganizationID) if err != nil { return err } if err := IsAllowed(ctx, *p); err != nil { return err } return s.s.CreateVariable(...
go
func (s *VariableService) CreateVariable(ctx context.Context, m *influxdb.Variable) error { p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.VariablesResourceType, m.OrganizationID) if err != nil { return err } if err := IsAllowed(ctx, *p); err != nil { return err } return s.s.CreateVariable(...
[ "func", "(", "s", "*", "VariableService", ")", "CreateVariable", "(", "ctx", "context", ".", "Context", ",", "m", "*", "influxdb", ".", "Variable", ")", "error", "{", "p", ",", "err", ":=", "influxdb", ".", "NewPermission", "(", "influxdb", ".", "WriteAc...
// CreateVariable checks to see if the authorizer on context has write access to the global variable resource.
[ "CreateVariable", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "global", "variable", "resource", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/variable.go#L96-L107
124,639
influxdata/influxdb
authorizer/variable.go
UpdateVariable
func (s *VariableService) UpdateVariable(ctx context.Context, id influxdb.ID, upd *influxdb.VariableUpdate) (*influxdb.Variable, error) { m, err := s.FindVariableByID(ctx, id) if err != nil { return nil, err } if err := authorizeWriteVariable(ctx, m.OrganizationID, id); err != nil { return nil, err } return...
go
func (s *VariableService) UpdateVariable(ctx context.Context, id influxdb.ID, upd *influxdb.VariableUpdate) (*influxdb.Variable, error) { m, err := s.FindVariableByID(ctx, id) if err != nil { return nil, err } if err := authorizeWriteVariable(ctx, m.OrganizationID, id); err != nil { return nil, err } return...
[ "func", "(", "s", "*", "VariableService", ")", "UpdateVariable", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ",", "upd", "*", "influxdb", ".", "VariableUpdate", ")", "(", "*", "influxdb", ".", "Variable", ",", "error", ")", ...
// UpdateVariable checks to see if the authorizer on context has write access to the variable provided.
[ "UpdateVariable", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "variable", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/variable.go#L110-L121
124,640
influxdata/influxdb
authorizer/variable.go
ReplaceVariable
func (s *VariableService) ReplaceVariable(ctx context.Context, m *influxdb.Variable) error { m, err := s.FindVariableByID(ctx, m.ID) if err != nil { return err } if err := authorizeWriteVariable(ctx, m.OrganizationID, m.ID); err != nil { return err } return s.s.ReplaceVariable(ctx, m) }
go
func (s *VariableService) ReplaceVariable(ctx context.Context, m *influxdb.Variable) error { m, err := s.FindVariableByID(ctx, m.ID) if err != nil { return err } if err := authorizeWriteVariable(ctx, m.OrganizationID, m.ID); err != nil { return err } return s.s.ReplaceVariable(ctx, m) }
[ "func", "(", "s", "*", "VariableService", ")", "ReplaceVariable", "(", "ctx", "context", ".", "Context", ",", "m", "*", "influxdb", ".", "Variable", ")", "error", "{", "m", ",", "err", ":=", "s", ".", "FindVariableByID", "(", "ctx", ",", "m", ".", "I...
// ReplaceVariable checks to see if the authorizer on context has write access to the variable provided.
[ "ReplaceVariable", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "variable", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/variable.go#L124-L135
124,641
influxdata/influxdb
authorizer/variable.go
DeleteVariable
func (s *VariableService) DeleteVariable(ctx context.Context, id influxdb.ID) error { m, err := s.FindVariableByID(ctx, id) if err != nil { return err } if err := authorizeWriteVariable(ctx, m.OrganizationID, id); err != nil { return err } return s.s.DeleteVariable(ctx, id) }
go
func (s *VariableService) DeleteVariable(ctx context.Context, id influxdb.ID) error { m, err := s.FindVariableByID(ctx, id) if err != nil { return err } if err := authorizeWriteVariable(ctx, m.OrganizationID, id); err != nil { return err } return s.s.DeleteVariable(ctx, id) }
[ "func", "(", "s", "*", "VariableService", ")", "DeleteVariable", "(", "ctx", "context", ".", "Context", ",", "id", "influxdb", ".", "ID", ")", "error", "{", "m", ",", "err", ":=", "s", ".", "FindVariableByID", "(", "ctx", ",", "id", ")", "\n", "if", ...
// DeleteVariable checks to see if the authorizer on context has write access to the variable provided.
[ "DeleteVariable", "checks", "to", "see", "if", "the", "authorizer", "on", "context", "has", "write", "access", "to", "the", "variable", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/variable.go#L138-L149
124,642
influxdata/influxdb
document.go
IncludeContent
func IncludeContent(_ DocumentIndex, dd DocumentDecorator) ([]ID, error) { return nil, dd.IncludeContent() }
go
func IncludeContent(_ DocumentIndex, dd DocumentDecorator) ([]ID, error) { return nil, dd.IncludeContent() }
[ "func", "IncludeContent", "(", "_", "DocumentIndex", ",", "dd", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "nil", ",", "dd", ".", "IncludeContent", "(", ")", "\n", "}" ]
// IncludeContent signals to the DocumentStore that the content of the document // should be included.
[ "IncludeContent", "signals", "to", "the", "DocumentStore", "that", "the", "content", "of", "the", "document", "should", "be", "included", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L82-L84
124,643
influxdata/influxdb
document.go
IncludeLabels
func IncludeLabels(_ DocumentIndex, dd DocumentDecorator) ([]ID, error) { return nil, dd.IncludeLabels() }
go
func IncludeLabels(_ DocumentIndex, dd DocumentDecorator) ([]ID, error) { return nil, dd.IncludeLabels() }
[ "func", "IncludeLabels", "(", "_", "DocumentIndex", ",", "dd", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "nil", ",", "dd", ".", "IncludeLabels", "(", ")", "\n", "}" ]
// IncludeLabels signals to the DocumentStore that the documents labels // should be included.
[ "IncludeLabels", "signals", "to", "the", "DocumentStore", "that", "the", "documents", "labels", "should", "be", "included", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L88-L90
124,644
influxdata/influxdb
document.go
WithOrg
func WithOrg(org string) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { oid, err := idx.FindOrganizationByName(org) if err != nil { return err } return idx.AddDocumentOwner(id, "org", oid) } }
go
func WithOrg(org string) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { oid, err := idx.FindOrganizationByName(org) if err != nil { return err } return idx.AddDocumentOwner(id, "org", oid) } }
[ "func", "WithOrg", "(", "org", "string", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "oid", ",", "err", ":=", "idx", ".", "FindOrganizationByName", ...
// WithOrg adds the provided org as an owner of the document.
[ "WithOrg", "adds", "the", "provided", "org", "as", "an", "owner", "of", "the", "document", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L104-L113
124,645
influxdata/influxdb
document.go
AuthorizedWithOrg
func AuthorizedWithOrg(a Authorizer, org string) func(ID, DocumentIndex) error { switch t := a.(type) { case *Authorization: return TokenAuthorizedWithOrg(t, org) } return func(id ID, idx DocumentIndex) error { oid, err := idx.FindOrganizationByName(org) if err != nil { return err } if err := idx.IsO...
go
func AuthorizedWithOrg(a Authorizer, org string) func(ID, DocumentIndex) error { switch t := a.(type) { case *Authorization: return TokenAuthorizedWithOrg(t, org) } return func(id ID, idx DocumentIndex) error { oid, err := idx.FindOrganizationByName(org) if err != nil { return err } if err := idx.IsO...
[ "func", "AuthorizedWithOrg", "(", "a", "Authorizer", ",", "org", "string", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "switch", "t", ":=", "a", ".", "(", "type", ")", "{", "case", "*", "Authorization", ":", "return", "TokenAuthorize...
// AuthorizedWithOrg adds the provided org as an owner of the document if // the authorizer is allowed to access the org in being added.
[ "AuthorizedWithOrg", "adds", "the", "provided", "org", "as", "an", "owner", "of", "the", "document", "if", "the", "authorizer", "is", "allowed", "to", "access", "the", "org", "in", "being", "added", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L117-L135
124,646
influxdata/influxdb
document.go
TokenAuthorizedWithOrg
func TokenAuthorizedWithOrg(a *Authorization, org string) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { if !a.IsActive() { return &Error{ Code: EUnauthorized, Msg: "authorization cannot add org as document owner", } } oid, err := idx.FindOrganizationByName(org) i...
go
func TokenAuthorizedWithOrg(a *Authorization, org string) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { if !a.IsActive() { return &Error{ Code: EUnauthorized, Msg: "authorization cannot add org as document owner", } } oid, err := idx.FindOrganizationByName(org) i...
[ "func", "TokenAuthorizedWithOrg", "(", "a", "*", "Authorization", ",", "org", "string", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "if", "!", "a", ...
// TokenAuthorizedWithOrg ensures that the authorization provided is allowed to perform // write actions against the org provided.
[ "TokenAuthorizedWithOrg", "ensures", "that", "the", "authorization", "provided", "is", "allowed", "to", "perform", "write", "actions", "against", "the", "org", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L139-L170
124,647
influxdata/influxdb
document.go
WithOrgID
func WithOrgID(orgID ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { return idx.AddDocumentOwner(id, "org", orgID) } }
go
func WithOrgID(orgID ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { return idx.AddDocumentOwner(id, "org", orgID) } }
[ "func", "WithOrgID", "(", "orgID", "ID", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "return", "idx", ".", "AddDocumentOwner", "(", "id", ",", "\"",...
// WithOrgID adds the provided org as an owner of the document.
[ "WithOrgID", "adds", "the", "provided", "org", "as", "an", "owner", "of", "the", "document", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L173-L177
124,648
influxdata/influxdb
document.go
AuthorizedWithOrgID
func AuthorizedWithOrgID(a Authorizer, orgID ID) func(ID, DocumentIndex) error { switch t := a.(type) { case *Authorization: return TokenAuthorizedWithOrgID(t, orgID) } return func(id ID, idx DocumentIndex) error { if err := idx.IsOrgAccessor(a.GetUserID(), orgID); err != nil { return err } return idx....
go
func AuthorizedWithOrgID(a Authorizer, orgID ID) func(ID, DocumentIndex) error { switch t := a.(type) { case *Authorization: return TokenAuthorizedWithOrgID(t, orgID) } return func(id ID, idx DocumentIndex) error { if err := idx.IsOrgAccessor(a.GetUserID(), orgID); err != nil { return err } return idx....
[ "func", "AuthorizedWithOrgID", "(", "a", "Authorizer", ",", "orgID", "ID", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "switch", "t", ":=", "a", ".", "(", "type", ")", "{", "case", "*", "Authorization", ":", "return", "TokenAuthorize...
// AuthorizedWithOrgID adds the provided org as an owner of the document if // the authorizer is allowed to access the org in being added.
[ "AuthorizedWithOrgID", "adds", "the", "provided", "org", "as", "an", "owner", "of", "the", "document", "if", "the", "authorizer", "is", "allowed", "to", "access", "the", "org", "in", "being", "added", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L181-L194
124,649
influxdata/influxdb
document.go
TokenAuthorizedWithOrgID
func TokenAuthorizedWithOrgID(a *Authorization, orgID ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { if !a.IsActive() { return &Error{ Code: EUnauthorized, Msg: "authorization cannot add org as document owner", } } p := Permission{ Action: WriteAction, Res...
go
func TokenAuthorizedWithOrgID(a *Authorization, orgID ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { if !a.IsActive() { return &Error{ Code: EUnauthorized, Msg: "authorization cannot add org as document owner", } } p := Permission{ Action: WriteAction, Res...
[ "func", "TokenAuthorizedWithOrgID", "(", "a", "*", "Authorization", ",", "orgID", "ID", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "if", "!", "a", ...
// TokenAuthorizedWithOrgID ensures that the authorization provided is allowed to perform // write actions against the org provided.
[ "TokenAuthorizedWithOrgID", "ensures", "that", "the", "authorization", "provided", "is", "allowed", "to", "perform", "write", "actions", "against", "the", "org", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L198-L224
124,650
influxdata/influxdb
document.go
WithLabel
func WithLabel(lid ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { // TODO(desa): turns out that labels are application global, at somepoint we'll // want to scope these by org. We should add auth at that point. err := idx.FindLabelByID(lid) if err != nil { return err } ...
go
func WithLabel(lid ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { // TODO(desa): turns out that labels are application global, at somepoint we'll // want to scope these by org. We should add auth at that point. err := idx.FindLabelByID(lid) if err != nil { return err } ...
[ "func", "WithLabel", "(", "lid", "ID", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "// TODO(desa): turns out that labels are application global, at somepoint we'l...
// WithLabel adds a label to the documents where it is applied.
[ "WithLabel", "adds", "a", "label", "to", "the", "documents", "where", "it", "is", "applied", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L227-L238
124,651
influxdata/influxdb
document.go
WithoutLabel
func WithoutLabel(lid ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { // TODO(desa): turns out that labels are application global, at somepoint we'll // want to scope these by org. We should add auth at that point. err := idx.FindLabelByID(lid) if err != nil { return err ...
go
func WithoutLabel(lid ID) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { // TODO(desa): turns out that labels are application global, at somepoint we'll // want to scope these by org. We should add auth at that point. err := idx.FindLabelByID(lid) if err != nil { return err ...
[ "func", "WithoutLabel", "(", "lid", "ID", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "// TODO(desa): turns out that labels are application global, at somepoint w...
// WithoutLabel removes a label to the documents where it is applied.
[ "WithoutLabel", "removes", "a", "label", "to", "the", "documents", "where", "it", "is", "applied", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L241-L252
124,652
influxdata/influxdb
document.go
Authorized
func Authorized(a Authorizer) func(ID, DocumentIndex) error { switch t := a.(type) { case *Authorization: return TokenAuthorized(t) } return func(docID ID, idx DocumentIndex) error { oids, err := idx.GetDocumentsAccessors(docID) if err != nil { return err } for _, oid := range oids { if err := idx...
go
func Authorized(a Authorizer) func(ID, DocumentIndex) error { switch t := a.(type) { case *Authorization: return TokenAuthorized(t) } return func(docID ID, idx DocumentIndex) error { oids, err := idx.GetDocumentsAccessors(docID) if err != nil { return err } for _, oid := range oids { if err := idx...
[ "func", "Authorized", "(", "a", "Authorizer", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "switch", "t", ":=", "a", ".", "(", "type", ")", "{", "case", "*", "Authorization", ":", "return", "TokenAuthorized", "(", "t", ")", "\n", ...
// Authorized checks to see if the user is authorized to access the document provided. // If the authorizer is a token, then it checks the tokens permissions. Otherwise, // it checks to see if the user associated with the authorizer is an accessor // of the of the org that owns the document.
[ "Authorized", "checks", "to", "see", "if", "the", "user", "is", "authorized", "to", "access", "the", "document", "provided", ".", "If", "the", "authorizer", "is", "a", "token", "then", "it", "checks", "the", "tokens", "permissions", ".", "Otherwise", "it", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L258-L281
124,653
influxdata/influxdb
document.go
TokenAuthorized
func TokenAuthorized(a *Authorization) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { if !a.IsActive() { return &Error{ Code: EUnauthorized, Msg: "authorizer cannot access document", } } oids, err := idx.GetDocumentsAccessors(id) if err != nil { return err } ...
go
func TokenAuthorized(a *Authorization) func(ID, DocumentIndex) error { return func(id ID, idx DocumentIndex) error { if !a.IsActive() { return &Error{ Code: EUnauthorized, Msg: "authorizer cannot access document", } } oids, err := idx.GetDocumentsAccessors(id) if err != nil { return err } ...
[ "func", "TokenAuthorized", "(", "a", "*", "Authorization", ")", "func", "(", "ID", ",", "DocumentIndex", ")", "error", "{", "return", "func", "(", "id", "ID", ",", "idx", "DocumentIndex", ")", "error", "{", "if", "!", "a", ".", "IsActive", "(", ")", ...
// TokenAuthorized checks to see if the authorization provided is allowed access the orgs documents.
[ "TokenAuthorized", "checks", "to", "see", "if", "the", "authorization", "provided", "is", "allowed", "access", "the", "orgs", "documents", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L284-L327
124,654
influxdata/influxdb
document.go
WhereOrg
func WhereOrg(org string) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { oid, err := idx.FindOrganizationByName(org) if err != nil { return nil, err } return idx.GetAccessorsDocuments("org", oid) } }
go
func WhereOrg(org string) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { oid, err := idx.FindOrganizationByName(org) if err != nil { return nil, err } return idx.GetAccessorsDocuments("org", oid) } }
[ "func", "WhereOrg", "(", "org", "string", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "func", "(", "idx", "DocumentIndex", ",", "_", "DocumentDecorator", ")", "(", "[", "]", "...
// WhereOrg retrieves a list of the ids of the documents that belong to the provided org.
[ "WhereOrg", "retrieves", "a", "list", "of", "the", "ids", "of", "the", "documents", "that", "belong", "to", "the", "provided", "org", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L330-L338
124,655
influxdata/influxdb
document.go
AuthorizedWhereOrgID
func AuthorizedWhereOrgID(a Authorizer, id ID) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { if err := idx.FindOrganizationByID(id); err != nil { return nil, err } return authorizedWhereOrgID(a, id, idx) } }
go
func AuthorizedWhereOrgID(a Authorizer, id ID) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { if err := idx.FindOrganizationByID(id); err != nil { return nil, err } return authorizedWhereOrgID(a, id, idx) } }
[ "func", "AuthorizedWhereOrgID", "(", "a", "Authorizer", ",", "id", "ID", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "func", "(", "idx", "DocumentIndex", ",", "_", "DocumentDecora...
// AuthorizedWhereOrgID ensures that the authorizer is allowed to access the org provideds documents and then // retrieves a list of the ids of the documents that belong to the provided orgID.
[ "AuthorizedWhereOrgID", "ensures", "that", "the", "authorizer", "is", "allowed", "to", "access", "the", "org", "provideds", "documents", "and", "then", "retrieves", "a", "list", "of", "the", "ids", "of", "the", "documents", "that", "belong", "to", "the", "prov...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L342-L349
124,656
influxdata/influxdb
document.go
AuthorizedWhereOrg
func AuthorizedWhereOrg(a Authorizer, org string) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { oid, err := idx.FindOrganizationByName(org) if err != nil { return nil, err } return authorizedWhereOrgID(a, oid, idx) } }
go
func AuthorizedWhereOrg(a Authorizer, org string) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { oid, err := idx.FindOrganizationByName(org) if err != nil { return nil, err } return authorizedWhereOrgID(a, oid, idx) } }
[ "func", "AuthorizedWhereOrg", "(", "a", "Authorizer", ",", "org", "string", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "func", "(", "idx", "DocumentIndex", ",", "_", "DocumentDec...
// AuthorizedWhereOrg ensures that the authorizer is allowed to access the org provideds documents and then // retrieves a list of the ids of the documents that belong to the provided org.
[ "AuthorizedWhereOrg", "ensures", "that", "the", "authorizer", "is", "allowed", "to", "access", "the", "org", "provideds", "documents", "and", "then", "retrieves", "a", "list", "of", "the", "ids", "of", "the", "documents", "that", "belong", "to", "the", "provid...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L382-L390
124,657
influxdata/influxdb
document.go
TokenAuthorizedWhereOrg
func TokenAuthorizedWhereOrg(a *Authorization, org string) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { oid, err := idx.FindOrganizationByName(org) if err != nil { return nil, err } return authorizedWhereOrgID(a, oid, idx) } }
go
func TokenAuthorizedWhereOrg(a *Authorization, org string) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { oid, err := idx.FindOrganizationByName(org) if err != nil { return nil, err } return authorizedWhereOrgID(a, oid, idx) } }
[ "func", "TokenAuthorizedWhereOrg", "(", "a", "*", "Authorization", ",", "org", "string", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "func", "(", "idx", "DocumentIndex", ",", "_",...
// TokenAuthorizedWhereOrg ensures that the authorization is allowed to access the org provideds documents and then // retrieves a list of the ids of the documents that belong to the provided org.
[ "TokenAuthorizedWhereOrg", "ensures", "that", "the", "authorization", "is", "allowed", "to", "access", "the", "org", "provideds", "documents", "and", "then", "retrieves", "a", "list", "of", "the", "ids", "of", "the", "documents", "that", "belong", "to", "the", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L394-L402
124,658
influxdata/influxdb
document.go
AuthorizedWhere
func AuthorizedWhere(a Authorizer) func(DocumentIndex, DocumentDecorator) ([]ID, error) { switch t := a.(type) { case *Authorization: return TokenAuthorizedWhere(t) } var ids []ID return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { dids, err := idx.GetAccessorsDocuments("user", a.GetUserID()) ...
go
func AuthorizedWhere(a Authorizer) func(DocumentIndex, DocumentDecorator) ([]ID, error) { switch t := a.(type) { case *Authorization: return TokenAuthorizedWhere(t) } var ids []ID return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { dids, err := idx.GetAccessorsDocuments("user", a.GetUserID()) ...
[ "func", "AuthorizedWhere", "(", "a", "Authorizer", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "switch", "t", ":=", "a", ".", "(", "type", ")", "{", "case", "*", "Authorization", ":", ...
// AuthorizedWhere retrieves all documents that the user is authorized to access. This is done by // retrieving the list of all orgs where the user is an accessor and the retrieving all of their // documents.
[ "AuthorizedWhere", "retrieves", "all", "documents", "that", "the", "user", "is", "authorized", "to", "access", ".", "This", "is", "done", "by", "retrieving", "the", "list", "of", "all", "orgs", "where", "the", "user", "is", "an", "accessor", "and", "the", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L407-L439
124,659
influxdata/influxdb
document.go
TokenAuthorizedWhere
func TokenAuthorizedWhere(a *Authorization) func(DocumentIndex, DocumentDecorator) ([]ID, error) { // TODO(desa): what to do about retrieving all documents using auth? (e.g. write/read:documents/*) var ids []ID return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { if !a.IsActive() { return nil, &E...
go
func TokenAuthorizedWhere(a *Authorization) func(DocumentIndex, DocumentDecorator) ([]ID, error) { // TODO(desa): what to do about retrieving all documents using auth? (e.g. write/read:documents/*) var ids []ID return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { if !a.IsActive() { return nil, &E...
[ "func", "TokenAuthorizedWhere", "(", "a", "*", "Authorization", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "// TODO(desa): what to do about retrieving all documents using auth? (e.g. write/read:documents/*)...
// TokenAuthorizedWhere retrieves all documents that the authorization is allowed to access.
[ "TokenAuthorizedWhere", "retrieves", "all", "documents", "that", "the", "authorization", "is", "allowed", "to", "access", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L442-L469
124,660
influxdata/influxdb
document.go
WhereID
func WhereID(docID ID) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { return []ID{docID}, nil } }
go
func WhereID(docID ID) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { return []ID{docID}, nil } }
[ "func", "WhereID", "(", "docID", "ID", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "func", "(", "idx", "DocumentIndex", ",", "_", "DocumentDecorator", ")", "(", "[", "]", "ID"...
// WhereID passes through the id provided.
[ "WhereID", "passes", "through", "the", "id", "provided", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L472-L476
124,661
influxdata/influxdb
document.go
TokenAuthorizedWhereID
func TokenAuthorizedWhereID(a *Authorization, docID ID) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { if !a.IsActive() { return nil, &Error{ Code: EUnauthorized, Msg: "authorizer cannot access documents", } } oids, err :...
go
func TokenAuthorizedWhereID(a *Authorization, docID ID) func(DocumentIndex, DocumentDecorator) ([]ID, error) { return func(idx DocumentIndex, _ DocumentDecorator) ([]ID, error) { if !a.IsActive() { return nil, &Error{ Code: EUnauthorized, Msg: "authorizer cannot access documents", } } oids, err :...
[ "func", "TokenAuthorizedWhereID", "(", "a", "*", "Authorization", ",", "docID", "ID", ")", "func", "(", "DocumentIndex", ",", "DocumentDecorator", ")", "(", "[", "]", "ID", ",", "error", ")", "{", "return", "func", "(", "idx", "DocumentIndex", ",", "_", ...
// TokenAuthorizedWhereID ensures that the authorization provided has the permission to access the document.
[ "TokenAuthorizedWhereID", "ensures", "that", "the", "authorization", "provided", "has", "the", "permission", "to", "access", "the", "document", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/document.go#L506-L544
124,662
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
NewEncoder
func NewEncoder() *Encoder { return &Encoder{ buf: make([]uint64, 240), b: make([]byte, 8), bytes: make([]byte, 128), } }
go
func NewEncoder() *Encoder { return &Encoder{ buf: make([]uint64, 240), b: make([]byte, 8), bytes: make([]byte, 128), } }
[ "func", "NewEncoder", "(", ")", "*", "Encoder", "{", "return", "&", "Encoder", "{", "buf", ":", "make", "(", "[", "]", "uint64", ",", "240", ")", ",", "b", ":", "make", "(", "[", "]", "byte", ",", "8", ")", ",", "bytes", ":", "make", "(", "["...
// NewEncoder returns an Encoder able to convert uint64s to compressed byte slices
[ "NewEncoder", "returns", "an", "Encoder", "able", "to", "convert", "uint64s", "to", "compressed", "byte", "slices" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L54-L60
124,663
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
Next
func (d *Decoder) Next() bool { d.i += 1 if d.i >= d.n { d.read() } return len(d.bytes) >= 8 || (d.i >= 0 && d.i < d.n) }
go
func (d *Decoder) Next() bool { d.i += 1 if d.i >= d.n { d.read() } return len(d.bytes) >= 8 || (d.i >= 0 && d.i < d.n) }
[ "func", "(", "d", "*", "Decoder", ")", "Next", "(", ")", "bool", "{", "d", ".", "i", "+=", "1", "\n\n", "if", "d", ".", "i", ">=", "d", ".", "n", "{", "d", ".", "read", "(", ")", "\n", "}", "\n\n", "return", "len", "(", "d", ".", "bytes",...
// Next returns true if there are remaining values to be read. Successive // calls to Next advance the current element pointer.
[ "Next", "returns", "true", "if", "there", "are", "remaining", "values", "to", "be", "read", ".", "Successive", "calls", "to", "Next", "advance", "the", "current", "element", "pointer", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L156-L164
124,664
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
Read
func (d *Decoder) Read() uint64 { v := d.buf[d.i] return v }
go
func (d *Decoder) Read() uint64 { v := d.buf[d.i] return v }
[ "func", "(", "d", "*", "Decoder", ")", "Read", "(", ")", "uint64", "{", "v", ":=", "d", ".", "buf", "[", "d", ".", "i", "]", "\n", "return", "v", "\n", "}" ]
// Read returns the current value. Successive calls to Read return the same // value.
[ "Read", "returns", "the", "current", "value", ".", "Successive", "calls", "to", "Read", "return", "the", "same", "value", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L174-L177
124,665
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
CountBytes
func CountBytes(b []byte) (int, error) { var count int for len(b) >= 8 { v := binary.BigEndian.Uint64(b[:8]) b = b[8:] sel := v >> 60 if sel >= 16 { return 0, fmt.Errorf("invalid selector value: %v", sel) } count += selector[sel].n } if len(b) > 0 { return 0, fmt.Errorf("invalid slice len remaini...
go
func CountBytes(b []byte) (int, error) { var count int for len(b) >= 8 { v := binary.BigEndian.Uint64(b[:8]) b = b[8:] sel := v >> 60 if sel >= 16 { return 0, fmt.Errorf("invalid selector value: %v", sel) } count += selector[sel].n } if len(b) > 0 { return 0, fmt.Errorf("invalid slice len remaini...
[ "func", "CountBytes", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "var", "count", "int", "\n", "for", "len", "(", "b", ")", ">=", "8", "{", "v", ":=", "binary", ".", "BigEndian", ".", "Uint64", "(", "b", "[", ":", "8"...
// Count returns the number of integers encoded in the byte slice
[ "Count", "returns", "the", "number", "of", "integers", "encoded", "in", "the", "byte", "slice" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L216-L233
124,666
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
Count
func Count(v uint64) (int, error) { sel := v >> 60 if sel >= 16 { return 0, fmt.Errorf("invalid selector value: %v", sel) } return selector[sel].n, nil }
go
func Count(v uint64) (int, error) { sel := v >> 60 if sel >= 16 { return 0, fmt.Errorf("invalid selector value: %v", sel) } return selector[sel].n, nil }
[ "func", "Count", "(", "v", "uint64", ")", "(", "int", ",", "error", ")", "{", "sel", ":=", "v", ">>", "60", "\n", "if", "sel", ">=", "16", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "sel", ")", "\n", "}", "\n", "re...
// Count returns the number of integers encoded within an uint64
[ "Count", "returns", "the", "number", "of", "integers", "encoded", "within", "an", "uint64" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L236-L242
124,667
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
Encode
func Encode(src []uint64) (value uint64, n int, err error) { if canPack(src, 240, 0) { return uint64(0), 240, nil } else if canPack(src, 120, 0) { return 1 << 60, 120, nil } else if canPack(src, 60, 1) { return pack60(src[:60]), 60, nil } else if canPack(src, 30, 2) { return pack30(src[:30]), 30, nil } els...
go
func Encode(src []uint64) (value uint64, n int, err error) { if canPack(src, 240, 0) { return uint64(0), 240, nil } else if canPack(src, 120, 0) { return 1 << 60, 120, nil } else if canPack(src, 60, 1) { return pack60(src[:60]), 60, nil } else if canPack(src, 30, 2) { return pack30(src[:30]), 30, nil } els...
[ "func", "Encode", "(", "src", "[", "]", "uint64", ")", "(", "value", "uint64", ",", "n", "int", ",", "err", "error", ")", "{", "if", "canPack", "(", "src", ",", "240", ",", "0", ")", "{", "return", "uint64", "(", "0", ")", ",", "240", ",", "n...
// Encode packs as many values into a single uint64. It returns the packed // uint64, how many values from src were packed, or an error if the values exceed // the maximum value range.
[ "Encode", "packs", "as", "many", "values", "into", "a", "single", "uint64", ".", "It", "returns", "the", "packed", "uint64", "how", "many", "values", "from", "src", "were", "packed", "or", "an", "error", "if", "the", "values", "exceed", "the", "maximum", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L309-L348
124,668
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
EncodeAll
func EncodeAll(src []uint64) ([]uint64, error) { i := 0 // Re-use the input slice and write encoded values back in place dst := src j := 0 NEXTVALUE: for i < len(src) { remaining := src[i:] // try to pack run of 240 or 120 1s if len(remaining) >= 120 { // Invariant: len(a) is fixed to 120 or 240 values...
go
func EncodeAll(src []uint64) ([]uint64, error) { i := 0 // Re-use the input slice and write encoded values back in place dst := src j := 0 NEXTVALUE: for i < len(src) { remaining := src[i:] // try to pack run of 240 or 120 1s if len(remaining) >= 120 { // Invariant: len(a) is fixed to 120 or 240 values...
[ "func", "EncodeAll", "(", "src", "[", "]", "uint64", ")", "(", "[", "]", "uint64", ",", "error", ")", "{", "i", ":=", "0", "\n\n", "// Re-use the input slice and write encoded values back in place", "dst", ":=", "src", "\n", "j", ":=", "0", "\n\n", "NEXTVALU...
// Encode returns a packed slice of the values from src. If a value is over // 1 << 60, an error is returned. The input src is modified to avoid extra // allocations. If you need to re-use, use a copy.
[ "Encode", "returns", "a", "packed", "slice", "of", "the", "values", "from", "src", ".", "If", "a", "value", "is", "over", "1", "<<", "60", "an", "error", "is", "returned", ".", "The", "input", "src", "is", "modified", "to", "avoid", "extra", "allocatio...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L378-L458
124,669
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
DecodeBytesBigEndian
func DecodeBytesBigEndian(dst []uint64, src []byte) (value int, err error) { if len(src)&7 != 0 { return 0, errors.New("src length is not multiple of 8") } i := 0 j := 0 for i < len(src) { v := binary.BigEndian.Uint64(src[i:]) sel := (v >> 60) & 0xf selector[sel].unpack(v, (*[240]uint64)(unsafe.Pointer(&d...
go
func DecodeBytesBigEndian(dst []uint64, src []byte) (value int, err error) { if len(src)&7 != 0 { return 0, errors.New("src length is not multiple of 8") } i := 0 j := 0 for i < len(src) { v := binary.BigEndian.Uint64(src[i:]) sel := (v >> 60) & 0xf selector[sel].unpack(v, (*[240]uint64)(unsafe.Pointer(&d...
[ "func", "DecodeBytesBigEndian", "(", "dst", "[", "]", "uint64", ",", "src", "[", "]", "byte", ")", "(", "value", "int", ",", "err", "error", ")", "{", "if", "len", "(", "src", ")", "&", "7", "!=", "0", "{", "return", "0", ",", "errors", ".", "N...
// DecodeBytesBigEndian writes the compressed, big-endian values from src to dst. It returns the number // of values written or an error.
[ "DecodeBytesBigEndian", "writes", "the", "compressed", "big", "-", "endian", "values", "from", "src", "to", "dst", ".", "It", "returns", "the", "number", "of", "values", "written", "or", "an", "error", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L483-L498
124,670
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
canPack
func canPack(src []uint64, n, bits int) bool { if len(src) < n { return false } end := len(src) if n < end { end = n } // Selector 0,1 are special and use 0 bits to encode runs of 1's if bits == 0 { for _, v := range src { if v != 1 { return false } } return true } max := uint64((1 << ui...
go
func canPack(src []uint64, n, bits int) bool { if len(src) < n { return false } end := len(src) if n < end { end = n } // Selector 0,1 are special and use 0 bits to encode runs of 1's if bits == 0 { for _, v := range src { if v != 1 { return false } } return true } max := uint64((1 << ui...
[ "func", "canPack", "(", "src", "[", "]", "uint64", ",", "n", ",", "bits", "int", ")", "bool", "{", "if", "len", "(", "src", ")", "<", "n", "{", "return", "false", "\n", "}", "\n\n", "end", ":=", "len", "(", "src", ")", "\n", "if", "n", "<", ...
// canPack returs true if n elements from in can be stored using bits per element
[ "canPack", "returs", "true", "if", "n", "elements", "from", "in", "can", "be", "stored", "using", "bits", "per", "element" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L501-L530
124,671
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack60
func pack60(src []uint64) uint64 { return 2<<60 | src[0] | src[1]<<1 | src[2]<<2 | src[3]<<3 | src[4]<<4 | src[5]<<5 | src[6]<<6 | src[7]<<7 | src[8]<<8 | src[9]<<9 | src[10]<<10 | src[11]<<11 | src[12]<<12 | src[13]<<13 | src[14]<<14 | src[15]<<15 | src[16]<<16 | src[17]<<17 | sr...
go
func pack60(src []uint64) uint64 { return 2<<60 | src[0] | src[1]<<1 | src[2]<<2 | src[3]<<3 | src[4]<<4 | src[5]<<5 | src[6]<<6 | src[7]<<7 | src[8]<<8 | src[9]<<9 | src[10]<<10 | src[11]<<11 | src[12]<<12 | src[13]<<13 | src[14]<<14 | src[15]<<15 | src[16]<<16 | src[17]<<17 | sr...
[ "func", "pack60", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "2", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "1", "|", "src", "[", "2", "]", "<<", "2", "|", "src", "[", "3", "]", "<<", "3", ...
// pack60 packs 60 values from in using 1 bit each
[ "pack60", "packs", "60", "values", "from", "in", "using", "1", "bit", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L543-L606
124,672
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack30
func pack30(src []uint64) uint64 { return 3<<60 | src[0] | src[1]<<2 | src[2]<<4 | src[3]<<6 | src[4]<<8 | src[5]<<10 | src[6]<<12 | src[7]<<14 | src[8]<<16 | src[9]<<18 | src[10]<<20 | src[11]<<22 | src[12]<<24 | src[13]<<26 | src[14]<<28 | src[15]<<30 | src[16]<<32 | src[17]<<34 |...
go
func pack30(src []uint64) uint64 { return 3<<60 | src[0] | src[1]<<2 | src[2]<<4 | src[3]<<6 | src[4]<<8 | src[5]<<10 | src[6]<<12 | src[7]<<14 | src[8]<<16 | src[9]<<18 | src[10]<<20 | src[11]<<22 | src[12]<<24 | src[13]<<26 | src[14]<<28 | src[15]<<30 | src[16]<<32 | src[17]<<34 |...
[ "func", "pack30", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "3", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "2", "|", "src", "[", "2", "]", "<<", "4", "|", "src", "[", "3", "]", "<<", "6", ...
// pack30 packs 30 values from in using 2 bits each
[ "pack30", "packs", "30", "values", "from", "in", "using", "2", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L609-L641
124,673
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack20
func pack20(src []uint64) uint64 { return 4<<60 | src[0] | src[1]<<3 | src[2]<<6 | src[3]<<9 | src[4]<<12 | src[5]<<15 | src[6]<<18 | src[7]<<21 | src[8]<<24 | src[9]<<27 | src[10]<<30 | src[11]<<33 | src[12]<<36 | src[13]<<39 | src[14]<<42 | src[15]<<45 | src[16]<<48 | src[17]<<51 ...
go
func pack20(src []uint64) uint64 { return 4<<60 | src[0] | src[1]<<3 | src[2]<<6 | src[3]<<9 | src[4]<<12 | src[5]<<15 | src[6]<<18 | src[7]<<21 | src[8]<<24 | src[9]<<27 | src[10]<<30 | src[11]<<33 | src[12]<<36 | src[13]<<39 | src[14]<<42 | src[15]<<45 | src[16]<<48 | src[17]<<51 ...
[ "func", "pack20", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "4", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "3", "|", "src", "[", "2", "]", "<<", "6", "|", "src", "[", "3", "]", "<<", "9", ...
// pack20 packs 20 values from in using 3 bits each
[ "pack20", "packs", "20", "values", "from", "in", "using", "3", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L644-L666
124,674
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack15
func pack15(src []uint64) uint64 { return 5<<60 | src[0] | src[1]<<4 | src[2]<<8 | src[3]<<12 | src[4]<<16 | src[5]<<20 | src[6]<<24 | src[7]<<28 | src[8]<<32 | src[9]<<36 | src[10]<<40 | src[11]<<44 | src[12]<<48 | src[13]<<52 | src[14]<<56 }
go
func pack15(src []uint64) uint64 { return 5<<60 | src[0] | src[1]<<4 | src[2]<<8 | src[3]<<12 | src[4]<<16 | src[5]<<20 | src[6]<<24 | src[7]<<28 | src[8]<<32 | src[9]<<36 | src[10]<<40 | src[11]<<44 | src[12]<<48 | src[13]<<52 | src[14]<<56 }
[ "func", "pack15", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "5", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "4", "|", "src", "[", "2", "]", "<<", "8", "|", "src", "[", "3", "]", "<<", "12",...
// pack15 packs 15 values from in using 3 bits each
[ "pack15", "packs", "15", "values", "from", "in", "using", "3", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L669-L686
124,675
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack12
func pack12(src []uint64) uint64 { return 6<<60 | src[0] | src[1]<<5 | src[2]<<10 | src[3]<<15 | src[4]<<20 | src[5]<<25 | src[6]<<30 | src[7]<<35 | src[8]<<40 | src[9]<<45 | src[10]<<50 | src[11]<<55 }
go
func pack12(src []uint64) uint64 { return 6<<60 | src[0] | src[1]<<5 | src[2]<<10 | src[3]<<15 | src[4]<<20 | src[5]<<25 | src[6]<<30 | src[7]<<35 | src[8]<<40 | src[9]<<45 | src[10]<<50 | src[11]<<55 }
[ "func", "pack12", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "6", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "5", "|", "src", "[", "2", "]", "<<", "10", "|", "src", "[", "3", "]", "<<", "15"...
// pack12 packs 12 values from in using 5 bits each
[ "pack12", "packs", "12", "values", "from", "in", "using", "5", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L689-L703
124,676
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack10
func pack10(src []uint64) uint64 { return 7<<60 | src[0] | src[1]<<6 | src[2]<<12 | src[3]<<18 | src[4]<<24 | src[5]<<30 | src[6]<<36 | src[7]<<42 | src[8]<<48 | src[9]<<54 }
go
func pack10(src []uint64) uint64 { return 7<<60 | src[0] | src[1]<<6 | src[2]<<12 | src[3]<<18 | src[4]<<24 | src[5]<<30 | src[6]<<36 | src[7]<<42 | src[8]<<48 | src[9]<<54 }
[ "func", "pack10", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "7", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "6", "|", "src", "[", "2", "]", "<<", "12", "|", "src", "[", "3", "]", "<<", "18"...
// pack10 packs 10 values from in using 6 bits each
[ "pack10", "packs", "10", "values", "from", "in", "using", "6", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L706-L718
124,677
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack8
func pack8(src []uint64) uint64 { return 8<<60 | src[0] | src[1]<<7 | src[2]<<14 | src[3]<<21 | src[4]<<28 | src[5]<<35 | src[6]<<42 | src[7]<<49 }
go
func pack8(src []uint64) uint64 { return 8<<60 | src[0] | src[1]<<7 | src[2]<<14 | src[3]<<21 | src[4]<<28 | src[5]<<35 | src[6]<<42 | src[7]<<49 }
[ "func", "pack8", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "8", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "7", "|", "src", "[", "2", "]", "<<", "14", "|", "src", "[", "3", "]", "<<", "21",...
// pack8 packs 8 values from in using 7 bits each
[ "pack8", "packs", "8", "values", "from", "in", "using", "7", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L721-L731
124,678
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack7
func pack7(src []uint64) uint64 { return 9<<60 | src[0] | src[1]<<8 | src[2]<<16 | src[3]<<24 | src[4]<<32 | src[5]<<40 | src[6]<<48 }
go
func pack7(src []uint64) uint64 { return 9<<60 | src[0] | src[1]<<8 | src[2]<<16 | src[3]<<24 | src[4]<<32 | src[5]<<40 | src[6]<<48 }
[ "func", "pack7", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "9", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "8", "|", "src", "[", "2", "]", "<<", "16", "|", "src", "[", "3", "]", "<<", "24",...
// pack7 packs 7 values from in using 8 bits each
[ "pack7", "packs", "7", "values", "from", "in", "using", "8", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L734-L743
124,679
influxdata/influxdb
pkg/encoding/simple8b/encoding.go
pack6
func pack6(src []uint64) uint64 { return 10<<60 | src[0] | src[1]<<10 | src[2]<<20 | src[3]<<30 | src[4]<<40 | src[5]<<50 }
go
func pack6(src []uint64) uint64 { return 10<<60 | src[0] | src[1]<<10 | src[2]<<20 | src[3]<<30 | src[4]<<40 | src[5]<<50 }
[ "func", "pack6", "(", "src", "[", "]", "uint64", ")", "uint64", "{", "return", "10", "<<", "60", "|", "src", "[", "0", "]", "|", "src", "[", "1", "]", "<<", "10", "|", "src", "[", "2", "]", "<<", "20", "|", "src", "[", "3", "]", "<<", "30...
// pack6 packs 6 values from in using 10 bits each
[ "pack6", "packs", "6", "values", "from", "in", "using", "10", "bits", "each" ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/encoding/simple8b/encoding.go#L746-L754
124,680
influxdata/influxdb
http/status.go
WriteHeader
func (w *statusResponseWriter) WriteHeader(statusCode int) { w.statusCode = statusCode w.ResponseWriter.WriteHeader(statusCode) }
go
func (w *statusResponseWriter) WriteHeader(statusCode int) { w.statusCode = statusCode w.ResponseWriter.WriteHeader(statusCode) }
[ "func", "(", "w", "*", "statusResponseWriter", ")", "WriteHeader", "(", "statusCode", "int", ")", "{", "w", ".", "statusCode", "=", "statusCode", "\n", "w", ".", "ResponseWriter", ".", "WriteHeader", "(", "statusCode", ")", "\n", "}" ]
// WriteHeader writes the header and captures the status code.
[ "WriteHeader", "writes", "the", "header", "and", "captures", "the", "status", "code", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/status.go#L24-L27
124,681
influxdata/influxdb
task/mock/scheduler.go
FailNextCallToExecute
func (e *Executor) FailNextCallToExecute(err error) { e.mu.Lock() e.nextExecuteErr = err e.mu.Unlock() }
go
func (e *Executor) FailNextCallToExecute(err error) { e.mu.Lock() e.nextExecuteErr = err e.mu.Unlock() }
[ "func", "(", "e", "*", "Executor", ")", "FailNextCallToExecute", "(", "err", "error", ")", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "e", ".", "nextExecuteErr", "=", "err", "\n", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
// FailNextCallToExecute causes the next call to e.Execute to unconditionally return err.
[ "FailNextCallToExecute", "causes", "the", "next", "call", "to", "e", ".", "Execute", "to", "unconditionally", "return", "err", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/mock/scheduler.go#L203-L207
124,682
influxdata/influxdb
task/mock/scheduler.go
RunningFor
func (e *Executor) RunningFor(taskID platform.ID) []*RunPromise { e.mu.Lock() defer e.mu.Unlock() var rps []*RunPromise for _, rp := range e.running { if rp.Run().TaskID == taskID { rps = append(rps, rp) } } return rps }
go
func (e *Executor) RunningFor(taskID platform.ID) []*RunPromise { e.mu.Lock() defer e.mu.Unlock() var rps []*RunPromise for _, rp := range e.running { if rp.Run().TaskID == taskID { rps = append(rps, rp) } } return rps }
[ "func", "(", "e", "*", "Executor", ")", "RunningFor", "(", "taskID", "platform", ".", "ID", ")", "[", "]", "*", "RunPromise", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "rp...
// RunningFor returns the run promises for the given task.
[ "RunningFor", "returns", "the", "run", "promises", "for", "the", "given", "task", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/mock/scheduler.go#L214-L226
124,683
influxdata/influxdb
task/mock/scheduler.go
Finish
func (p *RunPromise) Finish(r backend.RunResult, err error) { p.setResultOnce.Do(func() { p.res, p.err = r, err p.mu.Unlock() }) }
go
func (p *RunPromise) Finish(r backend.RunResult, err error) { p.setResultOnce.Do(func() { p.res, p.err = r, err p.mu.Unlock() }) }
[ "func", "(", "p", "*", "RunPromise", ")", "Finish", "(", "r", "backend", ".", "RunResult", ",", "err", "error", ")", "{", "p", ".", "setResultOnce", ".", "Do", "(", "func", "(", ")", "{", "p", ".", "res", ",", "p", ".", "err", "=", "r", ",", ...
// Finish unblocks any call to Wait, to return r and err. // Only the first call to Finish has any effect.
[ "Finish", "unblocks", "any", "call", "to", "Wait", "to", "return", "r", "and", "err", ".", "Only", "the", "first", "call", "to", "Finish", "has", "any", "effect", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/mock/scheduler.go#L301-L306
124,684
influxdata/influxdb
tsdb/tsm1/batch_string.go
StringArrayEncodeAll
func StringArrayEncodeAll(src []string, b []byte) ([]byte, error) { srcSz := 2 + len(src)*binary.MaxVarintLen32 // strings should't be longer than 64kb for i := range src { srcSz += len(src[i]) } // determine the maximum possible length needed for the buffer, which // includes the compressed size var compresse...
go
func StringArrayEncodeAll(src []string, b []byte) ([]byte, error) { srcSz := 2 + len(src)*binary.MaxVarintLen32 // strings should't be longer than 64kb for i := range src { srcSz += len(src[i]) } // determine the maximum possible length needed for the buffer, which // includes the compressed size var compresse...
[ "func", "StringArrayEncodeAll", "(", "src", "[", "]", "string", ",", "b", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "srcSz", ":=", "2", "+", "len", "(", "src", ")", "*", "binary", ".", "MaxVarintLen32", "// strings should'...
// StringArrayEncodeAll encodes src into b, returning b and any error encountered. // The returned slice may be of a different length and capactity to b. // // Currently only the string compression scheme used snappy.
[ "StringArrayEncodeAll", "encodes", "src", "into", "b", "returning", "b", "and", "any", "error", "encountered", ".", "The", "returned", "slice", "may", "be", "of", "a", "different", "length", "and", "capactity", "to", "b", ".", "Currently", "only", "the", "st...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/batch_string.go#L25-L70
124,685
influxdata/influxdb
tsdb/tsi1/index.go
SetDefaultMetricLabels
func (i *Index) SetDefaultMetricLabels(labels prometheus.Labels) { i.defaultLabels = make(prometheus.Labels, len(labels)) for k, v := range labels { i.defaultLabels[k] = v } }
go
func (i *Index) SetDefaultMetricLabels(labels prometheus.Labels) { i.defaultLabels = make(prometheus.Labels, len(labels)) for k, v := range labels { i.defaultLabels[k] = v } }
[ "func", "(", "i", "*", "Index", ")", "SetDefaultMetricLabels", "(", "labels", "prometheus", ".", "Labels", ")", "{", "i", ".", "defaultLabels", "=", "make", "(", "prometheus", ".", "Labels", ",", "len", "(", "labels", ")", ")", "\n", "for", "k", ",", ...
// SetDefaultMetricLabels sets the default labels on the trackers.
[ "SetDefaultMetricLabels", "sets", "the", "default", "labels", "on", "the", "trackers", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L159-L164
124,686
influxdata/influxdb
tsdb/tsi1/index.go
WithLogger
func (i *Index) WithLogger(l *zap.Logger) { i.logger = l.With(zap.String("index", "tsi")) }
go
func (i *Index) WithLogger(l *zap.Logger) { i.logger = l.With(zap.String("index", "tsi")) }
[ "func", "(", "i", "*", "Index", ")", "WithLogger", "(", "l", "*", "zap", ".", "Logger", ")", "{", "i", ".", "logger", "=", "l", ".", "With", "(", "zap", ".", "String", "(", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "}" ]
// WithLogger sets the logger on the index after it's been created. // // It's not safe to call WithLogger after the index has been opened, or before // it has been closed.
[ "WithLogger", "sets", "the", "logger", "on", "the", "index", "after", "it", "s", "been", "created", ".", "It", "s", "not", "safe", "to", "call", "WithLogger", "after", "the", "index", "has", "been", "opened", "or", "before", "it", "has", "been", "closed"...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L192-L194
124,687
influxdata/influxdb
tsdb/tsi1/index.go
SeriesIDSet
func (i *Index) SeriesIDSet() *tsdb.SeriesIDSet { seriesIDSet := tsdb.NewSeriesIDSet() others := make([]*tsdb.SeriesIDSet, 0, i.PartitionN) for _, p := range i.partitions { others = append(others, p.seriesIDSet) } seriesIDSet.Merge(others...) return seriesIDSet }
go
func (i *Index) SeriesIDSet() *tsdb.SeriesIDSet { seriesIDSet := tsdb.NewSeriesIDSet() others := make([]*tsdb.SeriesIDSet, 0, i.PartitionN) for _, p := range i.partitions { others = append(others, p.seriesIDSet) } seriesIDSet.Merge(others...) return seriesIDSet }
[ "func", "(", "i", "*", "Index", ")", "SeriesIDSet", "(", ")", "*", "tsdb", ".", "SeriesIDSet", "{", "seriesIDSet", ":=", "tsdb", ".", "NewSeriesIDSet", "(", ")", "\n", "others", ":=", "make", "(", "[", "]", "*", "tsdb", ".", "SeriesIDSet", ",", "0", ...
// SeriesIDSet returns the set of series ids associated with series in this // index. Any series IDs for series no longer present in the index are filtered out.
[ "SeriesIDSet", "returns", "the", "set", "of", "series", "ids", "associated", "with", "series", "in", "this", "index", ".", "Any", "series", "IDs", "for", "series", "no", "longer", "present", "in", "the", "index", "are", "filtered", "out", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L201-L209
124,688
influxdata/influxdb
tsdb/tsi1/index.go
Compact
func (i *Index) Compact() { i.mu.Lock() defer i.mu.Unlock() for _, p := range i.partitions { p.Compact() } }
go
func (i *Index) Compact() { i.mu.Lock() defer i.mu.Unlock() for _, p := range i.partitions { p.Compact() } }
[ "func", "(", "i", "*", "Index", ")", "Compact", "(", ")", "{", "i", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "p", ":=", "range", "i", ".", "partitions", "{", "p", ".", ...
// Compact requests a compaction of partitions.
[ "Compact", "requests", "a", "compaction", "of", "partitions", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L313-L319
124,689
influxdata/influxdb
tsdb/tsi1/index.go
partition
func (i *Index) partition(key []byte) *Partition { return i.partitions[int(xxhash.Sum64(key)&(i.PartitionN-1))] }
go
func (i *Index) partition(key []byte) *Partition { return i.partitions[int(xxhash.Sum64(key)&(i.PartitionN-1))] }
[ "func", "(", "i", "*", "Index", ")", "partition", "(", "key", "[", "]", "byte", ")", "*", "Partition", "{", "return", "i", ".", "partitions", "[", "int", "(", "xxhash", ".", "Sum64", "(", "key", ")", "&", "(", "i", ".", "PartitionN", "-", "1", ...
// partition returns the appropriate Partition for a provided series key.
[ "partition", "returns", "the", "appropriate", "Partition", "for", "a", "provided", "series", "key", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L370-L372
124,690
influxdata/influxdb
tsdb/tsi1/index.go
partitionIdx
func (i *Index) partitionIdx(key []byte) int { return int(xxhash.Sum64(key) & (i.PartitionN - 1)) }
go
func (i *Index) partitionIdx(key []byte) int { return int(xxhash.Sum64(key) & (i.PartitionN - 1)) }
[ "func", "(", "i", "*", "Index", ")", "partitionIdx", "(", "key", "[", "]", "byte", ")", "int", "{", "return", "int", "(", "xxhash", ".", "Sum64", "(", "key", ")", "&", "(", "i", ".", "PartitionN", "-", "1", ")", ")", "\n", "}" ]
// partitionIdx returns the index of the partition that key belongs in.
[ "partitionIdx", "returns", "the", "index", "of", "the", "partition", "that", "key", "belongs", "in", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L375-L377
124,691
influxdata/influxdb
tsdb/tsi1/index.go
availableThreads
func (i *Index) availableThreads() int { n := runtime.GOMAXPROCS(0) if len(i.partitions) < n { return len(i.partitions) } return n }
go
func (i *Index) availableThreads() int { n := runtime.GOMAXPROCS(0) if len(i.partitions) < n { return len(i.partitions) } return n }
[ "func", "(", "i", "*", "Index", ")", "availableThreads", "(", ")", "int", "{", "n", ":=", "runtime", ".", "GOMAXPROCS", "(", "0", ")", "\n", "if", "len", "(", "i", ".", "partitions", ")", "<", "n", "{", "return", "len", "(", "i", ".", "partitions...
// availableThreads returns the minimum of GOMAXPROCS and the number of // partitions in the Index.
[ "availableThreads", "returns", "the", "minimum", "of", "GOMAXPROCS", "and", "the", "number", "of", "partitions", "in", "the", "Index", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L381-L387
124,692
influxdata/influxdb
tsdb/tsi1/index.go
ForEachMeasurementName
func (i *Index) ForEachMeasurementName(fn func(name []byte) error) error { itr, err := i.MeasurementIterator() if err != nil { return err } else if itr == nil { return nil } defer itr.Close() // Iterate over all measurements. for { e, err := itr.Next() if err != nil { return err } else if e == nil ...
go
func (i *Index) ForEachMeasurementName(fn func(name []byte) error) error { itr, err := i.MeasurementIterator() if err != nil { return err } else if itr == nil { return nil } defer itr.Close() // Iterate over all measurements. for { e, err := itr.Next() if err != nil { return err } else if e == nil ...
[ "func", "(", "i", "*", "Index", ")", "ForEachMeasurementName", "(", "fn", "func", "(", "name", "[", "]", "byte", ")", "error", ")", "error", "{", "itr", ",", "err", ":=", "i", ".", "MeasurementIterator", "(", ")", "\n", "if", "err", "!=", "nil", "{...
// ForEachMeasurementName iterates over all measurement names in the index, // applying fn. It returns the first error encountered, if any. // // ForEachMeasurementName does not call fn on each partition concurrently so the // call may provide a non-goroutine safe fn.
[ "ForEachMeasurementName", "iterates", "over", "all", "measurement", "names", "in", "the", "index", "applying", "fn", ".", "It", "returns", "the", "first", "error", "encountered", "if", "any", ".", "ForEachMeasurementName", "does", "not", "call", "fn", "on", "eac...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L394-L417
124,693
influxdata/influxdb
tsdb/tsi1/index.go
MeasurementHasSeries
func (i *Index) MeasurementHasSeries(name []byte) (bool, error) { for _, p := range i.partitions { if v, err := p.MeasurementHasSeries(name); err != nil { return false, err } else if v { return true, nil } } return false, nil }
go
func (i *Index) MeasurementHasSeries(name []byte) (bool, error) { for _, p := range i.partitions { if v, err := p.MeasurementHasSeries(name); err != nil { return false, err } else if v { return true, nil } } return false, nil }
[ "func", "(", "i", "*", "Index", ")", "MeasurementHasSeries", "(", "name", "[", "]", "byte", ")", "(", "bool", ",", "error", ")", "{", "for", "_", ",", "p", ":=", "range", "i", ".", "partitions", "{", "if", "v", ",", "err", ":=", "p", ".", "Meas...
// MeasurementHasSeries returns true if a measurement has non-tombstoned series.
[ "MeasurementHasSeries", "returns", "true", "if", "a", "measurement", "has", "non", "-", "tombstoned", "series", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L465-L474
124,694
influxdata/influxdb
tsdb/tsi1/index.go
fetchByteValues
func (i *Index) fetchByteValues(fn func(idx int) ([][]byte, error)) ([][]byte, error) { n := i.availableThreads() // Store results. names := make([][][]byte, i.PartitionN) errC := make(chan error, i.PartitionN) var pidx uint32 // Index of maximum Partition being worked on. for k := 0; k < n; k++ { go func() {...
go
func (i *Index) fetchByteValues(fn func(idx int) ([][]byte, error)) ([][]byte, error) { n := i.availableThreads() // Store results. names := make([][][]byte, i.PartitionN) errC := make(chan error, i.PartitionN) var pidx uint32 // Index of maximum Partition being worked on. for k := 0; k < n; k++ { go func() {...
[ "func", "(", "i", "*", "Index", ")", "fetchByteValues", "(", "fn", "func", "(", "idx", "int", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "n", ":=", "i", ".", "avail...
// fetchByteValues is a helper for gathering values from each partition in the index, // based on some criteria. // // fn is a function that works on partition idx and calls into some method on // the partition that returns some ordered values.
[ "fetchByteValues", "is", "a", "helper", "for", "gathering", "values", "from", "each", "partition", "in", "the", "index", "based", "on", "some", "criteria", ".", "fn", "is", "a", "function", "that", "works", "on", "partition", "idx", "and", "calls", "into", ...
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L481-L516
124,695
influxdata/influxdb
tsdb/tsi1/index.go
MeasurementIterator
func (i *Index) MeasurementIterator() (tsdb.MeasurementIterator, error) { itrs := make([]tsdb.MeasurementIterator, 0, len(i.partitions)) for _, p := range i.partitions { itr, err := p.MeasurementIterator() if err != nil { tsdb.MeasurementIterators(itrs).Close() return nil, err } else if itr != nil { it...
go
func (i *Index) MeasurementIterator() (tsdb.MeasurementIterator, error) { itrs := make([]tsdb.MeasurementIterator, 0, len(i.partitions)) for _, p := range i.partitions { itr, err := p.MeasurementIterator() if err != nil { tsdb.MeasurementIterators(itrs).Close() return nil, err } else if itr != nil { it...
[ "func", "(", "i", "*", "Index", ")", "MeasurementIterator", "(", ")", "(", "tsdb", ".", "MeasurementIterator", ",", "error", ")", "{", "itrs", ":=", "make", "(", "[", "]", "tsdb", ".", "MeasurementIterator", ",", "0", ",", "len", "(", "i", ".", "part...
// MeasurementIterator returns an iterator over all measurements.
[ "MeasurementIterator", "returns", "an", "iterator", "over", "all", "measurements", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L519-L531
124,696
influxdata/influxdb
tsdb/tsi1/index.go
measurementSeriesIDIterator
func (i *Index) measurementSeriesIDIterator(name []byte) (tsdb.SeriesIDIterator, error) { itrs := make([]tsdb.SeriesIDIterator, 0, len(i.partitions)) for _, p := range i.partitions { itr, err := p.MeasurementSeriesIDIterator(name) if err != nil { tsdb.SeriesIDIterators(itrs).Close() return nil, err } else...
go
func (i *Index) measurementSeriesIDIterator(name []byte) (tsdb.SeriesIDIterator, error) { itrs := make([]tsdb.SeriesIDIterator, 0, len(i.partitions)) for _, p := range i.partitions { itr, err := p.MeasurementSeriesIDIterator(name) if err != nil { tsdb.SeriesIDIterators(itrs).Close() return nil, err } else...
[ "func", "(", "i", "*", "Index", ")", "measurementSeriesIDIterator", "(", "name", "[", "]", "byte", ")", "(", "tsdb", ".", "SeriesIDIterator", ",", "error", ")", "{", "itrs", ":=", "make", "(", "[", "]", "tsdb", ".", "SeriesIDIterator", ",", "0", ",", ...
// measurementSeriesIDIterator returns an iterator over all series in a measurement.
[ "measurementSeriesIDIterator", "returns", "an", "iterator", "over", "all", "series", "in", "a", "measurement", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L571-L583
124,697
influxdata/influxdb
tsdb/tsi1/index.go
MeasurementNamesByRegex
func (i *Index) MeasurementNamesByRegex(re *regexp.Regexp) ([][]byte, error) { return i.fetchByteValues(func(idx int) ([][]byte, error) { return i.partitions[idx].MeasurementNamesByRegex(re) }) }
go
func (i *Index) MeasurementNamesByRegex(re *regexp.Regexp) ([][]byte, error) { return i.fetchByteValues(func(idx int) ([][]byte, error) { return i.partitions[idx].MeasurementNamesByRegex(re) }) }
[ "func", "(", "i", "*", "Index", ")", "MeasurementNamesByRegex", "(", "re", "*", "regexp", ".", "Regexp", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "return", "i", ".", "fetchByteValues", "(", "func", "(", "idx", "int", ")", "(", ...
// MeasurementNamesByRegex returns measurement names for the provided regex.
[ "MeasurementNamesByRegex", "returns", "measurement", "names", "for", "the", "provided", "regex", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L586-L590
124,698
influxdata/influxdb
tsdb/tsi1/index.go
DropMeasurement
func (i *Index) DropMeasurement(name []byte) error { n := i.availableThreads() // Store results. errC := make(chan error, i.PartitionN) var pidx uint32 // Index of maximum Partition being worked on. for k := 0; k < n; k++ { go func() { for { idx := int(atomic.AddUint32(&pidx, 1) - 1) // Get next partiti...
go
func (i *Index) DropMeasurement(name []byte) error { n := i.availableThreads() // Store results. errC := make(chan error, i.PartitionN) var pidx uint32 // Index of maximum Partition being worked on. for k := 0; k < n; k++ { go func() { for { idx := int(atomic.AddUint32(&pidx, 1) - 1) // Get next partiti...
[ "func", "(", "i", "*", "Index", ")", "DropMeasurement", "(", "name", "[", "]", "byte", ")", "error", "{", "n", ":=", "i", ".", "availableThreads", "(", ")", "\n\n", "// Store results.", "errC", ":=", "make", "(", "chan", "error", ",", "i", ".", "Part...
// DropMeasurement deletes a measurement from the index. It returns the first // error encountered, if any.
[ "DropMeasurement", "deletes", "a", "measurement", "from", "the", "index", ".", "It", "returns", "the", "first", "error", "encountered", "if", "any", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L594-L623
124,699
influxdata/influxdb
tsdb/tsi1/index.go
CreateSeriesListIfNotExists
func (i *Index) CreateSeriesListIfNotExists(collection *tsdb.SeriesCollection) error { // Create the series list on the series file first. This validates all of the types for // the collection. err := i.sfile.CreateSeriesListIfNotExists(collection) if err != nil { return err } // We need to move different seri...
go
func (i *Index) CreateSeriesListIfNotExists(collection *tsdb.SeriesCollection) error { // Create the series list on the series file first. This validates all of the types for // the collection. err := i.sfile.CreateSeriesListIfNotExists(collection) if err != nil { return err } // We need to move different seri...
[ "func", "(", "i", "*", "Index", ")", "CreateSeriesListIfNotExists", "(", "collection", "*", "tsdb", ".", "SeriesCollection", ")", "error", "{", "// Create the series list on the series file first. This validates all of the types for", "// the collection.", "err", ":=", "i", ...
// CreateSeriesListIfNotExists creates a list of series if they doesn't exist in bulk.
[ "CreateSeriesListIfNotExists", "creates", "a", "list", "of", "series", "if", "they", "doesn", "t", "exist", "in", "bulk", "." ]
16d0bbb0cd468fd51f412021a76ae5c4b450dea8
https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index.go#L626-L719