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,300 | influxdata/influxdb | chronograf/server/stores.go | hasSuperAdminContext | func hasSuperAdminContext(ctx context.Context) bool {
u, ok := hasUserContext(ctx)
if !ok {
return false
}
return u.SuperAdmin
} | go | func hasSuperAdminContext(ctx context.Context) bool {
u, ok := hasUserContext(ctx)
if !ok {
return false
}
return u.SuperAdmin
} | [
"func",
"hasSuperAdminContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"u",
",",
"ok",
":=",
"hasUserContext",
"(",
"ctx",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"u",
".",
"SuperAdmin",
"\n",
... | // hasSuperAdminContext speficies if the context contains
// the UserContextKey user is a super admin | [
"hasSuperAdminContext",
"speficies",
"if",
"the",
"context",
"contains",
"the",
"UserContextKey",
"user",
"is",
"a",
"super",
"admin"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/stores.go#L75-L81 |
124,301 | influxdata/influxdb | chronograf/server/stores.go | Layouts | func (s *DirectStore) Layouts(ctx context.Context) chronograf.LayoutsStore {
return s.LayoutsStore
} | go | func (s *DirectStore) Layouts(ctx context.Context) chronograf.LayoutsStore {
return s.LayoutsStore
} | [
"func",
"(",
"s",
"*",
"DirectStore",
")",
"Layouts",
"(",
"ctx",
"context",
".",
"Context",
")",
"chronograf",
".",
"LayoutsStore",
"{",
"return",
"s",
".",
"LayoutsStore",
"\n",
"}"
] | // Layouts returns all layouts in the underlying layouts store. | [
"Layouts",
"returns",
"all",
"layouts",
"in",
"the",
"underlying",
"layouts",
"store",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/stores.go#L250-L252 |
124,302 | influxdata/influxdb | inmem/bucket_service.go | PutBucket | func (s *Service) PutBucket(ctx context.Context, b *platform.Bucket) error {
s.bucketKV.Store(b.ID.String(), *b)
return nil
} | go | func (s *Service) PutBucket(ctx context.Context, b *platform.Bucket) error {
s.bucketKV.Store(b.ID.String(), *b)
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"PutBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"b",
"*",
"platform",
".",
"Bucket",
")",
"error",
"{",
"s",
".",
"bucketKV",
".",
"Store",
"(",
"b",
".",
"ID",
".",
"String",
"(",
")",
",",
"*",
... | // PutBucket sets bucket with the current ID. | [
"PutBucket",
"sets",
"bucket",
"with",
"the",
"current",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/bucket_service.go#L249-L252 |
124,303 | influxdata/influxdb | inmem/bucket_service.go | DeleteOrganizationBuckets | func (s *Service) DeleteOrganizationBuckets(ctx context.Context, id platform.ID) error {
bucks, err := s.findBuckets(ctx, platform.BucketFilter{
OrganizationID: &id,
})
if err != nil {
return err
}
for _, buck := range bucks {
s.bucketKV.Delete(buck.ID.String())
}
return nil
} | go | func (s *Service) DeleteOrganizationBuckets(ctx context.Context, id platform.ID) error {
bucks, err := s.findBuckets(ctx, platform.BucketFilter{
OrganizationID: &id,
})
if err != nil {
return err
}
for _, buck := range bucks {
s.bucketKV.Delete(buck.ID.String())
}
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"DeleteOrganizationBuckets",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"error",
"{",
"bucks",
",",
"err",
":=",
"s",
".",
"findBuckets",
"(",
"ctx",
",",
"platform",
".",
"Bucke... | // DeleteOrganizationBuckets removes all the buckets for a given org | [
"DeleteOrganizationBuckets",
"removes",
"all",
"the",
"buckets",
"for",
"a",
"given",
"org"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/bucket_service.go#L307-L318 |
124,304 | influxdata/influxdb | kv/onboarding.go | IsOnboarding | func (s *Service) IsOnboarding(ctx context.Context) (bool, error) {
notSetup := true
err := s.kv.View(ctx, func(tx Tx) error {
bucket, err := tx.Bucket(onboardingBucket)
if err != nil {
return err
}
v, err := bucket.Get(onboardingKey)
// If the sentinel onboarding key is not found, then, setup
// has n... | go | func (s *Service) IsOnboarding(ctx context.Context) (bool, error) {
notSetup := true
err := s.kv.View(ctx, func(tx Tx) error {
bucket, err := tx.Bucket(onboardingBucket)
if err != nil {
return err
}
v, err := bucket.Get(onboardingKey)
// If the sentinel onboarding key is not found, then, setup
// has n... | [
"func",
"(",
"s",
"*",
"Service",
")",
"IsOnboarding",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"bool",
",",
"error",
")",
"{",
"notSetup",
":=",
"true",
"\n",
"err",
":=",
"s",
".",
"kv",
".",
"View",
"(",
"ctx",
",",
"func",
"(",
"tx",
... | // IsOnboarding means if the initial setup of influxdb has happened.
// true means that the onboarding setup has not yet happened.
// false means that the onboarding has been completed. | [
"IsOnboarding",
"means",
"if",
"the",
"initial",
"setup",
"of",
"influxdb",
"has",
"happened",
".",
"true",
"means",
"that",
"the",
"onboarding",
"setup",
"has",
"not",
"yet",
"happened",
".",
"false",
"means",
"that",
"the",
"onboarding",
"has",
"been",
"co... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/onboarding.go#L26-L50 |
124,305 | influxdata/influxdb | kv/onboarding.go | PutOnboardingStatus | func (s *Service) PutOnboardingStatus(ctx context.Context, hasBeenOnboarded bool) error {
return s.kv.Update(ctx, func(tx Tx) error {
return s.putOnboardingStatus(ctx, tx, hasBeenOnboarded)
})
} | go | func (s *Service) PutOnboardingStatus(ctx context.Context, hasBeenOnboarded bool) error {
return s.kv.Update(ctx, func(tx Tx) error {
return s.putOnboardingStatus(ctx, tx, hasBeenOnboarded)
})
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"PutOnboardingStatus",
"(",
"ctx",
"context",
".",
"Context",
",",
"hasBeenOnboarded",
"bool",
")",
"error",
"{",
"return",
"s",
".",
"kv",
".",
"Update",
"(",
"ctx",
",",
"func",
"(",
"tx",
"Tx",
")",
"error",
... | // PutOnboardingStatus will update the flag,
// so future onboarding request will be denied.
// true means that onboarding is NOT needed.
// false means that onboarding is needed. | [
"PutOnboardingStatus",
"will",
"update",
"the",
"flag",
"so",
"future",
"onboarding",
"request",
"will",
"be",
"denied",
".",
"true",
"means",
"that",
"onboarding",
"is",
"NOT",
"needed",
".",
"false",
"means",
"that",
"onboarding",
"is",
"needed",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/onboarding.go#L56-L60 |
124,306 | influxdata/influxdb | cmd/influx/main.go | walk | func walk(c *cobra.Command, f func(*cobra.Command)) {
f(c)
for _, c := range c.Commands() {
walk(c, f)
}
} | go | func walk(c *cobra.Command, f func(*cobra.Command)) {
f(c)
for _, c := range c.Commands() {
walk(c, f)
}
} | [
"func",
"walk",
"(",
"c",
"*",
"cobra",
".",
"Command",
",",
"f",
"func",
"(",
"*",
"cobra",
".",
"Command",
")",
")",
"{",
"f",
"(",
"c",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"c",
".",
"Commands",
"(",
")",
"{",
"walk",
"(",
"c"... | // walk calls f for c and all of its children. | [
"walk",
"calls",
"f",
"for",
"c",
"and",
"all",
"of",
"its",
"children",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/cmd/influx/main.go#L156-L161 |
124,307 | influxdata/influxdb | user_resource_mapping.go | Valid | func (ut UserType) Valid() (err error) {
switch ut {
case Owner: // 1
case Member: // 2
default:
err = ErrInvalidUserType
}
return err
} | go | func (ut UserType) Valid() (err error) {
switch ut {
case Owner: // 1
case Member: // 2
default:
err = ErrInvalidUserType
}
return err
} | [
"func",
"(",
"ut",
"UserType",
")",
"Valid",
"(",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"ut",
"{",
"case",
"Owner",
":",
"// 1",
"case",
"Member",
":",
"// 2",
"default",
":",
"err",
"=",
"ErrInvalidUserType",
"\n",
"}",
"\n\n",
"return",
"er... | // Valid checks if the UserType is a member of the UserType enum | [
"Valid",
"checks",
"if",
"the",
"UserType",
"is",
"a",
"member",
"of",
"the",
"UserType",
"enum"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/user_resource_mapping.go#L31-L40 |
124,308 | influxdata/influxdb | user_resource_mapping.go | ToPermissions | func (m *UserResourceMapping) ToPermissions() ([]Permission, error) {
switch m.UserType {
case Owner:
return m.ownerPerms()
case Member:
return m.memberPerms()
default:
return nil, ErrInvalidUserType
}
} | go | func (m *UserResourceMapping) ToPermissions() ([]Permission, error) {
switch m.UserType {
case Owner:
return m.ownerPerms()
case Member:
return m.memberPerms()
default:
return nil, ErrInvalidUserType
}
} | [
"func",
"(",
"m",
"*",
"UserResourceMapping",
")",
"ToPermissions",
"(",
")",
"(",
"[",
"]",
"Permission",
",",
"error",
")",
"{",
"switch",
"m",
".",
"UserType",
"{",
"case",
"Owner",
":",
"return",
"m",
".",
"ownerPerms",
"(",
")",
"\n",
"case",
"M... | // ToPermissions converts a user resource mapping into a set of permissions. | [
"ToPermissions",
"converts",
"a",
"user",
"resource",
"mapping",
"into",
"a",
"set",
"of",
"permissions",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/user_resource_mapping.go#L168-L177 |
124,309 | influxdata/influxdb | authorizer/source.go | DefaultSource | func (s *SourceService) DefaultSource(ctx context.Context) (*influxdb.Source, error) {
src, err := s.s.DefaultSource(ctx)
if err != nil {
return nil, err
}
if err := authorizeReadSource(ctx, src.OrganizationID, src.ID); err != nil {
return nil, err
}
return src, nil
} | go | func (s *SourceService) DefaultSource(ctx context.Context) (*influxdb.Source, error) {
src, err := s.s.DefaultSource(ctx)
if err != nil {
return nil, err
}
if err := authorizeReadSource(ctx, src.OrganizationID, src.ID); err != nil {
return nil, err
}
return src, nil
} | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"DefaultSource",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"influxdb",
".",
"Source",
",",
"error",
")",
"{",
"src",
",",
"err",
":=",
"s",
".",
"s",
".",
"DefaultSource",
"(",
"ctx",
")",
"\... | // DefaultSource checks to see if the authorizer on context has read access to the default source. | [
"DefaultSource",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"read",
"access",
"to",
"the",
"default",
"source",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/source.go#L56-L67 |
124,310 | influxdata/influxdb | authorizer/source.go | FindSources | func (s *SourceService) FindSources(ctx context.Context, opts influxdb.FindOptions) ([]*influxdb.Source, int, error) {
// TODO: we'll likely want to push this operation into the database since fetching the whole list of data will likely be expensive.
ss, _, err := s.s.FindSources(ctx, opts)
if err != nil {
return ... | go | func (s *SourceService) FindSources(ctx context.Context, opts influxdb.FindOptions) ([]*influxdb.Source, int, error) {
// TODO: we'll likely want to push this operation into the database since fetching the whole list of data will likely be expensive.
ss, _, err := s.s.FindSources(ctx, opts)
if err != nil {
return ... | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"FindSources",
"(",
"ctx",
"context",
".",
"Context",
",",
"opts",
"influxdb",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"influxdb",
".",
"Source",
",",
"int",
",",
"error",
")",
"{",
"// TODO: we'll likely... | // FindSources retrieves all sources that match the provided options and then filters the list down to only the resources that are authorized. | [
"FindSources",
"retrieves",
"all",
"sources",
"that",
"match",
"the",
"provided",
"options",
"and",
"then",
"filters",
"the",
"list",
"down",
"to",
"only",
"the",
"resources",
"that",
"are",
"authorized",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/source.go#L84-L115 |
124,311 | influxdata/influxdb | authorizer/source.go | CreateSource | func (s *SourceService) CreateSource(ctx context.Context, src *influxdb.Source) error {
p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.SourcesResourceType, src.OrganizationID)
if err != nil {
return err
}
if err := IsAllowed(ctx, *p); err != nil {
return err
}
return s.s.CreateSource(ctx, s... | go | func (s *SourceService) CreateSource(ctx context.Context, src *influxdb.Source) error {
p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.SourcesResourceType, src.OrganizationID)
if err != nil {
return err
}
if err := IsAllowed(ctx, *p); err != nil {
return err
}
return s.s.CreateSource(ctx, s... | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"CreateSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"src",
"*",
"influxdb",
".",
"Source",
")",
"error",
"{",
"p",
",",
"err",
":=",
"influxdb",
".",
"NewPermission",
"(",
"influxdb",
".",
"WriteAction... | // CreateSource checks to see if the authorizer on context has write access to the global source resource. | [
"CreateSource",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"global",
"source",
"resource",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/source.go#L118-L129 |
124,312 | influxdata/influxdb | authorizer/source.go | UpdateSource | func (s *SourceService) UpdateSource(ctx context.Context, id influxdb.ID, upd influxdb.SourceUpdate) (*influxdb.Source, error) {
src, err := s.s.FindSourceByID(ctx, id)
if err != nil {
return nil, err
}
if err := authorizeWriteSource(ctx, src.OrganizationID, id); err != nil {
return nil, err
}
return s.s.Up... | go | func (s *SourceService) UpdateSource(ctx context.Context, id influxdb.ID, upd influxdb.SourceUpdate) (*influxdb.Source, error) {
src, err := s.s.FindSourceByID(ctx, id)
if err != nil {
return nil, err
}
if err := authorizeWriteSource(ctx, src.OrganizationID, id); err != nil {
return nil, err
}
return s.s.Up... | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"UpdateSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"influxdb",
".",
"ID",
",",
"upd",
"influxdb",
".",
"SourceUpdate",
")",
"(",
"*",
"influxdb",
".",
"Source",
",",
"error",
")",
"{",
"src",
... | // UpdateSource checks to see if the authorizer on context has write access to the source provided. | [
"UpdateSource",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"source",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/source.go#L132-L143 |
124,313 | influxdata/influxdb | authorizer/source.go | DeleteSource | func (s *SourceService) DeleteSource(ctx context.Context, id influxdb.ID) error {
m, err := s.s.FindSourceByID(ctx, id)
if err != nil {
return err
}
if err := authorizeWriteSource(ctx, m.OrganizationID, id); err != nil {
return err
}
return s.s.DeleteSource(ctx, id)
} | go | func (s *SourceService) DeleteSource(ctx context.Context, id influxdb.ID) error {
m, err := s.s.FindSourceByID(ctx, id)
if err != nil {
return err
}
if err := authorizeWriteSource(ctx, m.OrganizationID, id); err != nil {
return err
}
return s.s.DeleteSource(ctx, id)
} | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"DeleteSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"influxdb",
".",
"ID",
")",
"error",
"{",
"m",
",",
"err",
":=",
"s",
".",
"s",
".",
"FindSourceByID",
"(",
"ctx",
",",
"id",
")",
"\n",
... | // DeleteSource checks to see if the authorizer on context has write access to the source provided. | [
"DeleteSource",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"source",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/source.go#L146-L157 |
124,314 | influxdata/influxdb | storage/engine_schema.go | TagKeys | func (e *Engine) TagKeys(ctx context.Context, orgID, bucketID influxdb.ID, start, end int64, predicate influxql.Expr) (cursors.StringIterator, error) {
e.mu.RLock()
defer e.mu.RUnlock()
if e.closing == nil {
return cursors.EmptyStringIterator, nil
}
return e.engine.TagKeys(ctx, orgID, bucketID, start, end, pred... | go | func (e *Engine) TagKeys(ctx context.Context, orgID, bucketID influxdb.ID, start, end int64, predicate influxql.Expr) (cursors.StringIterator, error) {
e.mu.RLock()
defer e.mu.RUnlock()
if e.closing == nil {
return cursors.EmptyStringIterator, nil
}
return e.engine.TagKeys(ctx, orgID, bucketID, start, end, pred... | [
"func",
"(",
"e",
"*",
"Engine",
")",
"TagKeys",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
",",
"bucketID",
"influxdb",
".",
"ID",
",",
"start",
",",
"end",
"int64",
",",
"predicate",
"influxql",
".",
"Expr",
")",
"(",
"cursors",
".",
"Str... | // TagKeys returns an iterator where the values are tag keys for the bucket
// matching the predicate within the time range (start, end].
//
// TagKeys will always return a StringIterator if there is no error. | [
"TagKeys",
"returns",
"an",
"iterator",
"where",
"the",
"values",
"are",
"tag",
"keys",
"for",
"the",
"bucket",
"matching",
"the",
"predicate",
"within",
"the",
"time",
"range",
"(",
"start",
"end",
"]",
".",
"TagKeys",
"will",
"always",
"return",
"a",
"St... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/engine_schema.go#L15-L23 |
124,315 | influxdata/influxdb | tsdb/tsm1/reader_block_iterator.go | Next | func (b *BlockIterator) Next() bool {
if b.iter.Err() != nil {
return false
}
if len(b.entries) > 0 {
b.entries = b.entries[1:]
if len(b.entries) > 0 {
return true
}
}
if !b.iter.Next() {
return false
}
b.entries = b.iter.Entries()
return len(b.entries) > 0
} | go | func (b *BlockIterator) Next() bool {
if b.iter.Err() != nil {
return false
}
if len(b.entries) > 0 {
b.entries = b.entries[1:]
if len(b.entries) > 0 {
return true
}
}
if !b.iter.Next() {
return false
}
b.entries = b.iter.Entries()
return len(b.entries) > 0
} | [
"func",
"(",
"b",
"*",
"BlockIterator",
")",
"Next",
"(",
")",
"bool",
"{",
"if",
"b",
".",
"iter",
".",
"Err",
"(",
")",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"b",
".",
"entries",
")",
">",
"0",
"{",
"b",
... | // Next returns true if there are more blocks to iterate through. | [
"Next",
"returns",
"true",
"if",
"there",
"are",
"more",
"blocks",
"to",
"iterate",
"through",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_block_iterator.go#L17-L35 |
124,316 | influxdata/influxdb | tsdb/tsm1/reader_block_iterator.go | Read | func (b *BlockIterator) Read() (key []byte, minTime int64, maxTime int64, typ byte, checksum uint32, buf []byte, err error) {
if err := b.iter.Err(); err != nil {
return nil, 0, 0, 0, 0, nil, err
}
checksum, buf, err = b.r.ReadBytes(&b.entries[0], nil)
if err != nil {
return nil, 0, 0, 0, 0, nil, err
}
return... | go | func (b *BlockIterator) Read() (key []byte, minTime int64, maxTime int64, typ byte, checksum uint32, buf []byte, err error) {
if err := b.iter.Err(); err != nil {
return nil, 0, 0, 0, 0, nil, err
}
checksum, buf, err = b.r.ReadBytes(&b.entries[0], nil)
if err != nil {
return nil, 0, 0, 0, 0, nil, err
}
return... | [
"func",
"(",
"b",
"*",
"BlockIterator",
")",
"Read",
"(",
")",
"(",
"key",
"[",
"]",
"byte",
",",
"minTime",
"int64",
",",
"maxTime",
"int64",
",",
"typ",
"byte",
",",
"checksum",
"uint32",
",",
"buf",
"[",
"]",
"byte",
",",
"err",
"error",
")",
... | // Read reads information about the next block to be iterated. | [
"Read",
"reads",
"information",
"about",
"the",
"next",
"block",
"to",
"be",
"iterated",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_block_iterator.go#L38-L47 |
124,317 | influxdata/influxdb | mock/nats.go | initSubject | func (s *NatsServer) initSubject(subject string) (chan io.Reader, error) {
s.Lock()
defer s.Unlock()
if _, ok := s.queue[subject]; !ok {
s.queue[subject] = make(chan io.Reader)
}
return s.queue[subject], nil
} | go | func (s *NatsServer) initSubject(subject string) (chan io.Reader, error) {
s.Lock()
defer s.Unlock()
if _, ok := s.queue[subject]; !ok {
s.queue[subject] = make(chan io.Reader)
}
return s.queue[subject], nil
} | [
"func",
"(",
"s",
"*",
"NatsServer",
")",
"initSubject",
"(",
"subject",
"string",
")",
"(",
"chan",
"io",
".",
"Reader",
",",
"error",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"ok... | // create an empty channel for a subject | [
"create",
"an",
"empty",
"channel",
"for",
"a",
"subject"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/nats.go#L18-L25 |
124,318 | influxdata/influxdb | mock/nats.go | NewNats | func NewNats() (nats.Publisher, nats.Subscriber) {
server := &NatsServer{
queue: make(map[string]chan io.Reader),
}
publisher := &NatsPublisher{
server: server,
}
subcriber := &NatsSubscriber{
server: server,
}
return publisher, subcriber
} | go | func NewNats() (nats.Publisher, nats.Subscriber) {
server := &NatsServer{
queue: make(map[string]chan io.Reader),
}
publisher := &NatsPublisher{
server: server,
}
subcriber := &NatsSubscriber{
server: server,
}
return publisher, subcriber
} | [
"func",
"NewNats",
"(",
")",
"(",
"nats",
".",
"Publisher",
",",
"nats",
".",
"Subscriber",
")",
"{",
"server",
":=",
"&",
"NatsServer",
"{",
"queue",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"chan",
"io",
".",
"Reader",
")",
",",
"}",
"\n\n",
... | // NewNats returns a mocked version of publisher, subscriber | [
"NewNats",
"returns",
"a",
"mocked",
"version",
"of",
"publisher",
"subscriber"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/nats.go#L28-L42 |
124,319 | influxdata/influxdb | mock/nats.go | Publish | func (p *NatsPublisher) Publish(subject string, r io.Reader) error {
_, err := p.server.initSubject(subject)
p.server.queue[subject] <- r
return err
} | go | func (p *NatsPublisher) Publish(subject string, r io.Reader) error {
_, err := p.server.initSubject(subject)
p.server.queue[subject] <- r
return err
} | [
"func",
"(",
"p",
"*",
"NatsPublisher",
")",
"Publish",
"(",
"subject",
"string",
",",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"_",
",",
"err",
":=",
"p",
".",
"server",
".",
"initSubject",
"(",
"subject",
")",
"\n",
"p",
".",
"server",
".",
... | // Publish add subject and msg to server. | [
"Publish",
"add",
"subject",
"and",
"msg",
"to",
"server",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/nats.go#L50-L54 |
124,320 | influxdata/influxdb | mock/nats.go | Subscribe | func (s *NatsSubscriber) Subscribe(subject, group string, handler nats.Handler) error {
ch, err := s.server.initSubject(subject)
if err != nil {
return err
}
go func(s *NatsSubscriber, subject string, handler nats.Handler) {
for r := range ch {
handler.Process(&natsSubscription{subject: subject},
&natsM... | go | func (s *NatsSubscriber) Subscribe(subject, group string, handler nats.Handler) error {
ch, err := s.server.initSubject(subject)
if err != nil {
return err
}
go func(s *NatsSubscriber, subject string, handler nats.Handler) {
for r := range ch {
handler.Process(&natsSubscription{subject: subject},
&natsM... | [
"func",
"(",
"s",
"*",
"NatsSubscriber",
")",
"Subscribe",
"(",
"subject",
",",
"group",
"string",
",",
"handler",
"nats",
".",
"Handler",
")",
"error",
"{",
"ch",
",",
"err",
":=",
"s",
".",
"server",
".",
"initSubject",
"(",
"subject",
")",
"\n",
"... | // Subscribe implements nats.Subscriber inteferface. | [
"Subscribe",
"implements",
"nats",
".",
"Subscriber",
"inteferface",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/nats.go#L62-L78 |
124,321 | influxdata/influxdb | tsdb/tsm1/array_cursor_iterator.go | Stats | func (q *arrayCursorIterator) Stats() cursors.CursorStats {
var stats cursors.CursorStats
if cur := q.asc.Float; cur != nil {
stats.Add(cur.Stats())
} else if cur := q.asc.Integer; cur != nil {
stats.Add(cur.Stats())
} else if cur := q.asc.Unsigned; cur != nil {
stats.Add(cur.Stats())
} else if cur := q.asc.... | go | func (q *arrayCursorIterator) Stats() cursors.CursorStats {
var stats cursors.CursorStats
if cur := q.asc.Float; cur != nil {
stats.Add(cur.Stats())
} else if cur := q.asc.Integer; cur != nil {
stats.Add(cur.Stats())
} else if cur := q.asc.Unsigned; cur != nil {
stats.Add(cur.Stats())
} else if cur := q.asc.... | [
"func",
"(",
"q",
"*",
"arrayCursorIterator",
")",
"Stats",
"(",
")",
"cursors",
".",
"CursorStats",
"{",
"var",
"stats",
"cursors",
".",
"CursorStats",
"\n",
"if",
"cur",
":=",
"q",
".",
"asc",
".",
"Float",
";",
"cur",
"!=",
"nil",
"{",
"stats",
".... | // Stats returns the cumulative stats for all cursors. | [
"Stats",
"returns",
"the",
"cumulative",
"stats",
"for",
"all",
"cursors",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_cursor_iterator.go#L76-L101 |
124,322 | influxdata/influxdb | chronograf/server/path.go | PathEscape | func PathEscape(str string) string {
u := &url.URL{Path: str}
return u.String()
} | go | func PathEscape(str string) string {
u := &url.URL{Path: str}
return u.String()
} | [
"func",
"PathEscape",
"(",
"str",
"string",
")",
"string",
"{",
"u",
":=",
"&",
"url",
".",
"URL",
"{",
"Path",
":",
"str",
"}",
"\n",
"return",
"u",
".",
"String",
"(",
")",
"\n",
"}"
] | // PathEscape escapes the string so it can be safely placed inside a URL path segment.
// Change to url.PathEscape for go 1.8 | [
"PathEscape",
"escapes",
"the",
"string",
"so",
"it",
"can",
"be",
"safely",
"placed",
"inside",
"a",
"URL",
"path",
"segment",
".",
"Change",
"to",
"url",
".",
"PathEscape",
"for",
"go",
"1",
".",
"8"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/path.go#L7-L10 |
124,323 | influxdata/influxdb | models/tagkeysset.go | Clear | func (set *TagKeysSet) Clear() {
set.clear(set.keys[0])
set.clear(set.keys[1])
set.clear(set.tmp)
set.i = 0
set.keys[0] = set.keys[0][:0]
} | go | func (set *TagKeysSet) Clear() {
set.clear(set.keys[0])
set.clear(set.keys[1])
set.clear(set.tmp)
set.i = 0
set.keys[0] = set.keys[0][:0]
} | [
"func",
"(",
"set",
"*",
"TagKeysSet",
")",
"Clear",
"(",
")",
"{",
"set",
".",
"clear",
"(",
"set",
".",
"keys",
"[",
"0",
"]",
")",
"\n",
"set",
".",
"clear",
"(",
"set",
".",
"keys",
"[",
"1",
"]",
")",
"\n",
"set",
".",
"clear",
"(",
"s... | // Clear removes all the elements of TagKeysSet and ensures all internal
// buffers are reset. | [
"Clear",
"removes",
"all",
"the",
"elements",
"of",
"TagKeysSet",
"and",
"ensures",
"all",
"internal",
"buffers",
"are",
"reset",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/tagkeysset.go#L17-L23 |
124,324 | influxdata/influxdb | models/tagkeysset.go | Keys | func (set *TagKeysSet) Keys() []string {
keys := set.KeysBytes()
s := make([]string, 0, len(keys))
for i := range keys {
s = append(s, string(keys[i]))
}
return s
} | go | func (set *TagKeysSet) Keys() []string {
keys := set.KeysBytes()
s := make([]string, 0, len(keys))
for i := range keys {
s = append(s, string(keys[i]))
}
return s
} | [
"func",
"(",
"set",
"*",
"TagKeysSet",
")",
"Keys",
"(",
")",
"[",
"]",
"string",
"{",
"keys",
":=",
"set",
".",
"KeysBytes",
"(",
")",
"\n",
"s",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"keys",
")",
")",
"\n",
"for"... | // Keys returns a copy of the merged keys in lexicographical order. | [
"Keys",
"returns",
"a",
"copy",
"of",
"the",
"merged",
"keys",
"in",
"lexicographical",
"order",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/tagkeysset.go#L39-L46 |
124,325 | influxdata/influxdb | models/tagkeysset.go | IsSupersetKeys | func (set *TagKeysSet) IsSupersetKeys(other Tags) bool {
keys := set.keys[set.i&1]
i, j := 0, 0
for i < len(keys) && j < len(other) {
if cmp := bytes.Compare(keys[i], other[j].Key); cmp > 0 {
return false
} else if cmp == 0 {
j++
}
i++
}
return j == len(other)
} | go | func (set *TagKeysSet) IsSupersetKeys(other Tags) bool {
keys := set.keys[set.i&1]
i, j := 0, 0
for i < len(keys) && j < len(other) {
if cmp := bytes.Compare(keys[i], other[j].Key); cmp > 0 {
return false
} else if cmp == 0 {
j++
}
i++
}
return j == len(other)
} | [
"func",
"(",
"set",
"*",
"TagKeysSet",
")",
"IsSupersetKeys",
"(",
"other",
"Tags",
")",
"bool",
"{",
"keys",
":=",
"set",
".",
"keys",
"[",
"set",
".",
"i",
"&",
"1",
"]",
"\n",
"i",
",",
"j",
":=",
"0",
",",
"0",
"\n",
"for",
"i",
"<",
"len... | // IsSupersetKeys returns true if the TagKeysSet is a superset of all the keys
// contained in other. | [
"IsSupersetKeys",
"returns",
"true",
"if",
"the",
"TagKeysSet",
"is",
"a",
"superset",
"of",
"all",
"the",
"keys",
"contained",
"in",
"other",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/tagkeysset.go#L58-L71 |
124,326 | influxdata/influxdb | models/tagkeysset.go | IsSupersetBytes | func (set *TagKeysSet) IsSupersetBytes(other [][]byte) bool {
keys := set.keys[set.i&1]
i, j := 0, 0
for i < len(keys) && j < len(other) {
if cmp := bytes.Compare(keys[i], other[j]); cmp > 0 {
return false
} else if cmp == 0 {
j++
}
i++
}
return j == len(other)
} | go | func (set *TagKeysSet) IsSupersetBytes(other [][]byte) bool {
keys := set.keys[set.i&1]
i, j := 0, 0
for i < len(keys) && j < len(other) {
if cmp := bytes.Compare(keys[i], other[j]); cmp > 0 {
return false
} else if cmp == 0 {
j++
}
i++
}
return j == len(other)
} | [
"func",
"(",
"set",
"*",
"TagKeysSet",
")",
"IsSupersetBytes",
"(",
"other",
"[",
"]",
"[",
"]",
"byte",
")",
"bool",
"{",
"keys",
":=",
"set",
".",
"keys",
"[",
"set",
".",
"i",
"&",
"1",
"]",
"\n",
"i",
",",
"j",
":=",
"0",
",",
"0",
"\n",
... | // IsSupersetBytes returns true if the TagKeysSet is a superset of all the keys
// in other.
// Other must be lexicographically sorted or the results are undefined. | [
"IsSupersetBytes",
"returns",
"true",
"if",
"the",
"TagKeysSet",
"is",
"a",
"superset",
"of",
"all",
"the",
"keys",
"in",
"other",
".",
"Other",
"must",
"be",
"lexicographically",
"sorted",
"or",
"the",
"results",
"are",
"undefined",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/tagkeysset.go#L76-L89 |
124,327 | influxdata/influxdb | models/tagkeysset.go | UnionKeys | func (set *TagKeysSet) UnionKeys(other Tags) {
if set.IsSupersetKeys(other) {
return
}
if l := len(other); cap(set.tmp) < l {
set.tmp = make([][]byte, l)
} else {
set.tmp = set.tmp[:l]
}
for i := range other {
set.tmp[i] = other[i].Key
}
set.merge(set.tmp)
} | go | func (set *TagKeysSet) UnionKeys(other Tags) {
if set.IsSupersetKeys(other) {
return
}
if l := len(other); cap(set.tmp) < l {
set.tmp = make([][]byte, l)
} else {
set.tmp = set.tmp[:l]
}
for i := range other {
set.tmp[i] = other[i].Key
}
set.merge(set.tmp)
} | [
"func",
"(",
"set",
"*",
"TagKeysSet",
")",
"UnionKeys",
"(",
"other",
"Tags",
")",
"{",
"if",
"set",
".",
"IsSupersetKeys",
"(",
"other",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"l",
":=",
"len",
"(",
"other",
")",
";",
"cap",
"(",
"set",
"... | // UnionKeys updates the set so that it is the union of itself and all the
// keys contained in other. | [
"UnionKeys",
"updates",
"the",
"set",
"so",
"that",
"it",
"is",
"the",
"union",
"of",
"itself",
"and",
"all",
"the",
"keys",
"contained",
"in",
"other",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/tagkeysset.go#L93-L109 |
124,328 | influxdata/influxdb | models/tagkeysset.go | UnionBytes | func (set *TagKeysSet) UnionBytes(other [][]byte) {
if set.IsSupersetBytes(other) {
return
}
set.merge(other)
} | go | func (set *TagKeysSet) UnionBytes(other [][]byte) {
if set.IsSupersetBytes(other) {
return
}
set.merge(other)
} | [
"func",
"(",
"set",
"*",
"TagKeysSet",
")",
"UnionBytes",
"(",
"other",
"[",
"]",
"[",
"]",
"byte",
")",
"{",
"if",
"set",
".",
"IsSupersetBytes",
"(",
"other",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"set",
".",
"merge",
"(",
"other",
")",
"\n",
... | // UnionBytes updates the set so that it is the union of itself and all the
// keys contained in other.
// Other must be lexicographically sorted or the results are undefined. | [
"UnionBytes",
"updates",
"the",
"set",
"so",
"that",
"it",
"is",
"the",
"union",
"of",
"itself",
"and",
"all",
"the",
"keys",
"contained",
"in",
"other",
".",
"Other",
"must",
"be",
"lexicographically",
"sorted",
"or",
"the",
"results",
"are",
"undefined",
... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/tagkeysset.go#L114-L120 |
124,329 | influxdata/influxdb | mock/user_service.go | NewUserService | func NewUserService() *UserService {
return &UserService{
FindUserByIDFn: func(context.Context, platform.ID) (*platform.User, error) { return nil, nil },
FindUserFn: func(context.Context, platform.UserFilter) (*platform.User, error) { return nil, nil },
CreateUserFn: func(context.Context, *platform.User) e... | go | func NewUserService() *UserService {
return &UserService{
FindUserByIDFn: func(context.Context, platform.ID) (*platform.User, error) { return nil, nil },
FindUserFn: func(context.Context, platform.UserFilter) (*platform.User, error) { return nil, nil },
CreateUserFn: func(context.Context, *platform.User) e... | [
"func",
"NewUserService",
"(",
")",
"*",
"UserService",
"{",
"return",
"&",
"UserService",
"{",
"FindUserByIDFn",
":",
"func",
"(",
"context",
".",
"Context",
",",
"platform",
".",
"ID",
")",
"(",
"*",
"platform",
".",
"User",
",",
"error",
")",
"{",
"... | // NewUserService returns a mock of UserService where its methods will return zero values. | [
"NewUserService",
"returns",
"a",
"mock",
"of",
"UserService",
"where",
"its",
"methods",
"will",
"return",
"zero",
"values",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L24-L35 |
124,330 | influxdata/influxdb | mock/user_service.go | FindUserByID | func (s *UserService) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error) {
return s.FindUserByIDFn(ctx, id)
} | go | func (s *UserService) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error) {
return s.FindUserByIDFn(ctx, id)
} | [
"func",
"(",
"s",
"*",
"UserService",
")",
"FindUserByID",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"(",
"*",
"platform",
".",
"User",
",",
"error",
")",
"{",
"return",
"s",
".",
"FindUserByIDFn",
"(",
"ctx",
",",... | // FindUserByID returns a single User by ID. | [
"FindUserByID",
"returns",
"a",
"single",
"User",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L38-L40 |
124,331 | influxdata/influxdb | mock/user_service.go | FindUsers | func (s *UserService) FindUsers(ctx context.Context, filter platform.UserFilter, opts ...platform.FindOptions) ([]*platform.User, int, error) {
return s.FindUsersFn(ctx, filter, opts...)
} | go | func (s *UserService) FindUsers(ctx context.Context, filter platform.UserFilter, opts ...platform.FindOptions) ([]*platform.User, int, error) {
return s.FindUsersFn(ctx, filter, opts...)
} | [
"func",
"(",
"s",
"*",
"UserService",
")",
"FindUsers",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"platform",
".",
"UserFilter",
",",
"opts",
"...",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"User",
",",
"int... | // FindUsers returns a list of Users that match filter and the total count of matching Users. | [
"FindUsers",
"returns",
"a",
"list",
"of",
"Users",
"that",
"match",
"filter",
"and",
"the",
"total",
"count",
"of",
"matching",
"Users",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L43-L45 |
124,332 | influxdata/influxdb | mock/user_service.go | CreateUser | func (s *UserService) CreateUser(ctx context.Context, User *platform.User) error {
return s.CreateUserFn(ctx, User)
} | go | func (s *UserService) CreateUser(ctx context.Context, User *platform.User) error {
return s.CreateUserFn(ctx, User)
} | [
"func",
"(",
"s",
"*",
"UserService",
")",
"CreateUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"User",
"*",
"platform",
".",
"User",
")",
"error",
"{",
"return",
"s",
".",
"CreateUserFn",
"(",
"ctx",
",",
"User",
")",
"\n",
"}"
] | // CreateUser creates a new User and sets b.ID with the new identifier. | [
"CreateUser",
"creates",
"a",
"new",
"User",
"and",
"sets",
"b",
".",
"ID",
"with",
"the",
"new",
"identifier",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L48-L50 |
124,333 | influxdata/influxdb | mock/user_service.go | DeleteUser | func (s *UserService) DeleteUser(ctx context.Context, id platform.ID) error {
return s.DeleteUserFn(ctx, id)
} | go | func (s *UserService) DeleteUser(ctx context.Context, id platform.ID) error {
return s.DeleteUserFn(ctx, id)
} | [
"func",
"(",
"s",
"*",
"UserService",
")",
"DeleteUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"error",
"{",
"return",
"s",
".",
"DeleteUserFn",
"(",
"ctx",
",",
"id",
")",
"\n",
"}"
] | // DeleteUser removes a User by ID. | [
"DeleteUser",
"removes",
"a",
"User",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L53-L55 |
124,334 | influxdata/influxdb | mock/user_service.go | FindUser | func (s *UserService) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) {
return s.FindUserFn(ctx, filter)
} | go | func (s *UserService) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) {
return s.FindUserFn(ctx, filter)
} | [
"func",
"(",
"s",
"*",
"UserService",
")",
"FindUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"platform",
".",
"UserFilter",
")",
"(",
"*",
"platform",
".",
"User",
",",
"error",
")",
"{",
"return",
"s",
".",
"FindUserFn",
"(",
"ctx",
... | // FindUser finds the first user that matches a filter | [
"FindUser",
"finds",
"the",
"first",
"user",
"that",
"matches",
"a",
"filter"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L58-L60 |
124,335 | influxdata/influxdb | mock/user_service.go | UpdateUser | func (s *UserService) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) {
return s.UpdateUserFn(ctx, id, upd)
} | go | func (s *UserService) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) {
return s.UpdateUserFn(ctx, id, upd)
} | [
"func",
"(",
"s",
"*",
"UserService",
")",
"UpdateUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"upd",
"platform",
".",
"UserUpdate",
")",
"(",
"*",
"platform",
".",
"User",
",",
"error",
")",
"{",
"return",
"s"... | // UpdateUser updates a user | [
"UpdateUser",
"updates",
"a",
"user"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/user_service.go#L63-L65 |
124,336 | influxdata/influxdb | chronograf/mocks/databases.go | AllDB | func (d *Databases) AllDB(ctx context.Context) ([]chronograf.Database, error) {
return d.AllDBF(ctx)
} | go | func (d *Databases) AllDB(ctx context.Context) ([]chronograf.Database, error) {
return d.AllDBF(ctx)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"AllDB",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"chronograf",
".",
"Database",
",",
"error",
")",
"{",
"return",
"d",
".",
"AllDBF",
"(",
"ctx",
")",
"\n",
"}"
] | // AllDB lists all databases in the current data source | [
"AllDB",
"lists",
"all",
"databases",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L27-L29 |
124,337 | influxdata/influxdb | chronograf/mocks/databases.go | Connect | func (d *Databases) Connect(ctx context.Context, src *chronograf.Source) error {
return d.ConnectF(ctx, src)
} | go | func (d *Databases) Connect(ctx context.Context, src *chronograf.Source) error {
return d.ConnectF(ctx, src)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"Connect",
"(",
"ctx",
"context",
".",
"Context",
",",
"src",
"*",
"chronograf",
".",
"Source",
")",
"error",
"{",
"return",
"d",
".",
"ConnectF",
"(",
"ctx",
",",
"src",
")",
"\n",
"}"
] | // Connect connects to a database in the current data source | [
"Connect",
"connects",
"to",
"a",
"database",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L32-L34 |
124,338 | influxdata/influxdb | chronograf/mocks/databases.go | CreateDB | func (d *Databases) CreateDB(ctx context.Context, db *chronograf.Database) (*chronograf.Database, error) {
return d.CreateDBF(ctx, db)
} | go | func (d *Databases) CreateDB(ctx context.Context, db *chronograf.Database) (*chronograf.Database, error) {
return d.CreateDBF(ctx, db)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"CreateDB",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"chronograf",
".",
"Database",
")",
"(",
"*",
"chronograf",
".",
"Database",
",",
"error",
")",
"{",
"return",
"d",
".",
"CreateDBF",
"(",
"ct... | // CreateDB creates a database in the current data source | [
"CreateDB",
"creates",
"a",
"database",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L37-L39 |
124,339 | influxdata/influxdb | chronograf/mocks/databases.go | DropDB | func (d *Databases) DropDB(ctx context.Context, db string) error {
return d.DropDBF(ctx, db)
} | go | func (d *Databases) DropDB(ctx context.Context, db string) error {
return d.DropDBF(ctx, db)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"DropDB",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"string",
")",
"error",
"{",
"return",
"d",
".",
"DropDBF",
"(",
"ctx",
",",
"db",
")",
"\n",
"}"
] | // DropDB drops a database in the current data source | [
"DropDB",
"drops",
"a",
"database",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L42-L44 |
124,340 | influxdata/influxdb | chronograf/mocks/databases.go | AllRP | func (d *Databases) AllRP(ctx context.Context, rpX string) ([]chronograf.RetentionPolicy, error) {
return d.AllRPF(ctx, rpX)
} | go | func (d *Databases) AllRP(ctx context.Context, rpX string) ([]chronograf.RetentionPolicy, error) {
return d.AllRPF(ctx, rpX)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"AllRP",
"(",
"ctx",
"context",
".",
"Context",
",",
"rpX",
"string",
")",
"(",
"[",
"]",
"chronograf",
".",
"RetentionPolicy",
",",
"error",
")",
"{",
"return",
"d",
".",
"AllRPF",
"(",
"ctx",
",",
"rpX",
"... | // AllRP lists all retention policies in the current data source | [
"AllRP",
"lists",
"all",
"retention",
"policies",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L47-L49 |
124,341 | influxdata/influxdb | chronograf/mocks/databases.go | CreateRP | func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) {
return d.CreateRPF(ctx, rpX, rp)
} | go | func (d *Databases) CreateRP(ctx context.Context, rpX string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) {
return d.CreateRPF(ctx, rpX, rp)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"CreateRP",
"(",
"ctx",
"context",
".",
"Context",
",",
"rpX",
"string",
",",
"rp",
"*",
"chronograf",
".",
"RetentionPolicy",
")",
"(",
"*",
"chronograf",
".",
"RetentionPolicy",
",",
"error",
")",
"{",
"return",... | // CreateRP creates a retention policy in the current data source | [
"CreateRP",
"creates",
"a",
"retention",
"policy",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L52-L54 |
124,342 | influxdata/influxdb | chronograf/mocks/databases.go | UpdateRP | func (d *Databases) UpdateRP(ctx context.Context, rpX string, rpY string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) {
return d.UpdateRPF(ctx, rpX, rpY, rp)
} | go | func (d *Databases) UpdateRP(ctx context.Context, rpX string, rpY string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) {
return d.UpdateRPF(ctx, rpX, rpY, rp)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"UpdateRP",
"(",
"ctx",
"context",
".",
"Context",
",",
"rpX",
"string",
",",
"rpY",
"string",
",",
"rp",
"*",
"chronograf",
".",
"RetentionPolicy",
")",
"(",
"*",
"chronograf",
".",
"RetentionPolicy",
",",
"error... | // UpdateRP updates a retention policy in the current data source | [
"UpdateRP",
"updates",
"a",
"retention",
"policy",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L57-L59 |
124,343 | influxdata/influxdb | chronograf/mocks/databases.go | DropRP | func (d *Databases) DropRP(ctx context.Context, rpX string, rpY string) error {
return d.DropRPF(ctx, rpX, rpY)
} | go | func (d *Databases) DropRP(ctx context.Context, rpX string, rpY string) error {
return d.DropRPF(ctx, rpX, rpY)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"DropRP",
"(",
"ctx",
"context",
".",
"Context",
",",
"rpX",
"string",
",",
"rpY",
"string",
")",
"error",
"{",
"return",
"d",
".",
"DropRPF",
"(",
"ctx",
",",
"rpX",
",",
"rpY",
")",
"\n",
"}"
] | // DropRP drops a retention policy in the current data source | [
"DropRP",
"drops",
"a",
"retention",
"policy",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L62-L64 |
124,344 | influxdata/influxdb | chronograf/mocks/databases.go | GetMeasurements | func (d *Databases) GetMeasurements(ctx context.Context, db string, limit, offset int) ([]chronograf.Measurement, error) {
return d.GetMeasurementsF(ctx, db, limit, offset)
} | go | func (d *Databases) GetMeasurements(ctx context.Context, db string, limit, offset int) ([]chronograf.Measurement, error) {
return d.GetMeasurementsF(ctx, db, limit, offset)
} | [
"func",
"(",
"d",
"*",
"Databases",
")",
"GetMeasurements",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"string",
",",
"limit",
",",
"offset",
"int",
")",
"(",
"[",
"]",
"chronograf",
".",
"Measurement",
",",
"error",
")",
"{",
"return",
"d",
"... | // GetMeasurements lists measurements in the current data source | [
"GetMeasurements",
"lists",
"measurements",
"in",
"the",
"current",
"data",
"source"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/databases.go#L67-L69 |
124,345 | influxdata/influxdb | task/backend/scheduler.go | WithLogger | func WithLogger(logger *zap.Logger) TickSchedulerOption {
return func(s *TickScheduler) {
s.logger = logger.With(zap.String("svc", "taskd/scheduler"))
}
} | go | func WithLogger(logger *zap.Logger) TickSchedulerOption {
return func(s *TickScheduler) {
s.logger = logger.With(zap.String("svc", "taskd/scheduler"))
}
} | [
"func",
"WithLogger",
"(",
"logger",
"*",
"zap",
".",
"Logger",
")",
"TickSchedulerOption",
"{",
"return",
"func",
"(",
"s",
"*",
"TickScheduler",
")",
"{",
"s",
".",
"logger",
"=",
"logger",
".",
"With",
"(",
"zap",
".",
"String",
"(",
"\"",
"\"",
"... | // WithLogger sets the logger for the scheduler.
// If not set, the scheduler will use a no-op logger. | [
"WithLogger",
"sets",
"the",
"logger",
"for",
"the",
"scheduler",
".",
"If",
"not",
"set",
"the",
"scheduler",
"will",
"use",
"a",
"no",
"-",
"op",
"logger",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler.go#L148-L152 |
124,346 | influxdata/influxdb | task/backend/scheduler.go | CancelRun | func (s *TickScheduler) CancelRun(_ context.Context, taskID, runID platform.ID) error {
s.schedulerMu.Lock()
defer s.schedulerMu.Unlock()
ts, ok := s.taskSchedulers[taskID]
if !ok {
return ErrTaskNotFound
}
ts.runningMu.Lock()
c, ok := ts.running[runID]
if !ok {
ts.runningMu.Unlock()
return ErrRunNotFound... | go | func (s *TickScheduler) CancelRun(_ context.Context, taskID, runID platform.ID) error {
s.schedulerMu.Lock()
defer s.schedulerMu.Unlock()
ts, ok := s.taskSchedulers[taskID]
if !ok {
return ErrTaskNotFound
}
ts.runningMu.Lock()
c, ok := ts.running[runID]
if !ok {
ts.runningMu.Unlock()
return ErrRunNotFound... | [
"func",
"(",
"s",
"*",
"TickScheduler",
")",
"CancelRun",
"(",
"_",
"context",
".",
"Context",
",",
"taskID",
",",
"runID",
"platform",
".",
"ID",
")",
"error",
"{",
"s",
".",
"schedulerMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"schedulerM... | // CancelRun cancels a run, it has the unused Context argument so that it can implement a task.RunController | [
"CancelRun",
"cancels",
"a",
"run",
"it",
"has",
"the",
"unused",
"Context",
"argument",
"so",
"that",
"it",
"can",
"implement",
"a",
"task",
".",
"RunController"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler.go#L191-L209 |
124,347 | influxdata/influxdb | task/backend/scheduler.go | Tick | func (s *TickScheduler) Tick(now int64) {
s.schedulerMu.Lock()
defer s.schedulerMu.Unlock()
if s.ctx == nil {
return
}
select {
case <-s.ctx.Done():
return
default:
// do nothing and allow ticks
}
atomic.StoreInt64(&s.now, now)
affected := 0
for _, ts := range s.taskSchedulers {
if nextDue, hasQu... | go | func (s *TickScheduler) Tick(now int64) {
s.schedulerMu.Lock()
defer s.schedulerMu.Unlock()
if s.ctx == nil {
return
}
select {
case <-s.ctx.Done():
return
default:
// do nothing and allow ticks
}
atomic.StoreInt64(&s.now, now)
affected := 0
for _, ts := range s.taskSchedulers {
if nextDue, hasQu... | [
"func",
"(",
"s",
"*",
"TickScheduler",
")",
"Tick",
"(",
"now",
"int64",
")",
"{",
"s",
".",
"schedulerMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"schedulerMu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"ctx",
"==",
"nil",
"{",
... | // Tick updates the time of the scheduler.
// Any owned tasks who are due to execute and who have a free concurrency slot,
// will begin a new execution. | [
"Tick",
"updates",
"the",
"time",
"of",
"the",
"scheduler",
".",
"Any",
"owned",
"tasks",
"who",
"are",
"due",
"to",
"execute",
"and",
"who",
"have",
"a",
"free",
"concurrency",
"slot",
"will",
"begin",
"a",
"new",
"execution",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler.go#L214-L240 |
124,348 | influxdata/influxdb | task/backend/scheduler.go | NextDue | func (ts *taskScheduler) NextDue() (int64, bool) {
ts.nextDueMu.RLock()
defer ts.nextDueMu.RUnlock()
return ts.nextDue, ts.hasQueue
} | go | func (ts *taskScheduler) NextDue() (int64, bool) {
ts.nextDueMu.RLock()
defer ts.nextDueMu.RUnlock()
return ts.nextDue, ts.hasQueue
} | [
"func",
"(",
"ts",
"*",
"taskScheduler",
")",
"NextDue",
"(",
")",
"(",
"int64",
",",
"bool",
")",
"{",
"ts",
".",
"nextDueMu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"ts",
".",
"nextDueMu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"ts",
".",
"n... | // NextDue returns the next due timestamp, and whether there is a queue. | [
"NextDue",
"returns",
"the",
"next",
"due",
"timestamp",
"and",
"whether",
"there",
"is",
"a",
"queue",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler.go#L534-L538 |
124,349 | influxdata/influxdb | task/backend/scheduler.go | Start | func (r *runner) Start() {
if !atomic.CompareAndSwapUint32(r.state, runnerIdle, runnerWorking) {
// Already working. Cannot start.
return
}
r.startFromWorking(atomic.LoadInt64(r.ts.now))
} | go | func (r *runner) Start() {
if !atomic.CompareAndSwapUint32(r.state, runnerIdle, runnerWorking) {
// Already working. Cannot start.
return
}
r.startFromWorking(atomic.LoadInt64(r.ts.now))
} | [
"func",
"(",
"r",
"*",
"runner",
")",
"Start",
"(",
")",
"{",
"if",
"!",
"atomic",
".",
"CompareAndSwapUint32",
"(",
"r",
".",
"state",
",",
"runnerIdle",
",",
"runnerWorking",
")",
"{",
"// Already working. Cannot start.",
"return",
"\n",
"}",
"\n\n",
"r"... | // Start checks if a new run is ready to be scheduled, and if so,
// creates a run on this goroutine and begins executing it on a separate goroutine. | [
"Start",
"checks",
"if",
"a",
"new",
"run",
"is",
"ready",
"to",
"be",
"scheduled",
"and",
"if",
"so",
"creates",
"a",
"run",
"on",
"this",
"goroutine",
"and",
"begins",
"executing",
"it",
"on",
"a",
"separate",
"goroutine",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler.go#L610-L617 |
124,350 | influxdata/influxdb | task/backend/scheduler.go | fail | func (r *runner) fail(qr QueuedRun, runLogger *zap.Logger, stage string, reason error) {
if err := r.taskControlService.AddRunLog(r.ts.authCtx, r.task.ID, qr.RunID, time.Now(), stage+": "+reason.Error()); err != nil {
runLogger.Info("Failed to update run log", zap.Error(err))
}
r.updateRunState(qr, RunFail, runLo... | go | func (r *runner) fail(qr QueuedRun, runLogger *zap.Logger, stage string, reason error) {
if err := r.taskControlService.AddRunLog(r.ts.authCtx, r.task.ID, qr.RunID, time.Now(), stage+": "+reason.Error()); err != nil {
runLogger.Info("Failed to update run log", zap.Error(err))
}
r.updateRunState(qr, RunFail, runLo... | [
"func",
"(",
"r",
"*",
"runner",
")",
"fail",
"(",
"qr",
"QueuedRun",
",",
"runLogger",
"*",
"zap",
".",
"Logger",
",",
"stage",
"string",
",",
"reason",
"error",
")",
"{",
"if",
"err",
":=",
"r",
".",
"taskControlService",
".",
"AddRunLog",
"(",
"r"... | // fail sets r's state to failed, and marks this runner as idle. | [
"fail",
"sets",
"r",
"s",
"state",
"to",
"failed",
"and",
"marks",
"this",
"runner",
"as",
"idle",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/scheduler.go#L688-L695 |
124,351 | influxdata/influxdb | query/dependency.go | Lookup | func (b *BucketLookup) Lookup(ctx context.Context, orgID platform.ID, name string) (platform.ID, bool) {
oid := platform.ID(orgID)
filter := platform.BucketFilter{
OrganizationID: &oid,
Name: &name,
}
bucket, err := b.BucketService.FindBucket(ctx, filter)
if err != nil {
return platform.InvalidID()... | go | func (b *BucketLookup) Lookup(ctx context.Context, orgID platform.ID, name string) (platform.ID, bool) {
oid := platform.ID(orgID)
filter := platform.BucketFilter{
OrganizationID: &oid,
Name: &name,
}
bucket, err := b.BucketService.FindBucket(ctx, filter)
if err != nil {
return platform.InvalidID()... | [
"func",
"(",
"b",
"*",
"BucketLookup",
")",
"Lookup",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"platform",
".",
"ID",
",",
"name",
"string",
")",
"(",
"platform",
".",
"ID",
",",
"bool",
")",
"{",
"oid",
":=",
"platform",
".",
"ID",
"("... | // Lookup returns the bucket id and its existence given an org id and bucket name. | [
"Lookup",
"returns",
"the",
"bucket",
"id",
"and",
"its",
"existence",
"given",
"an",
"org",
"id",
"and",
"bucket",
"name",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/dependency.go#L22-L33 |
124,352 | influxdata/influxdb | query/dependency.go | Lookup | func (o *OrganizationLookup) Lookup(ctx context.Context, name string) (platform.ID, bool) {
org, err := o.OrganizationService.FindOrganization(
ctx,
platform.OrganizationFilter{Name: &name},
)
if err != nil {
return platform.InvalidID(), false
}
return org.ID, true
} | go | func (o *OrganizationLookup) Lookup(ctx context.Context, name string) (platform.ID, bool) {
org, err := o.OrganizationService.FindOrganization(
ctx,
platform.OrganizationFilter{Name: &name},
)
if err != nil {
return platform.InvalidID(), false
}
return org.ID, true
} | [
"func",
"(",
"o",
"*",
"OrganizationLookup",
")",
"Lookup",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"platform",
".",
"ID",
",",
"bool",
")",
"{",
"org",
",",
"err",
":=",
"o",
".",
"OrganizationService",
".",
"FindOrgani... | // Lookup returns the organization ID and its existence given an organization name. | [
"Lookup",
"returns",
"the",
"organization",
"ID",
"and",
"its",
"existence",
"given",
"an",
"organization",
"name",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/dependency.go#L59-L69 |
124,353 | influxdata/influxdb | session.go | Allowed | func (s *Session) Allowed(p Permission) bool {
if err := s.Expired(); err != nil {
return false
}
return PermissionAllowed(p, s.Permissions)
} | go | func (s *Session) Allowed(p Permission) bool {
if err := s.Expired(); err != nil {
return false
}
return PermissionAllowed(p, s.Permissions)
} | [
"func",
"(",
"s",
"*",
"Session",
")",
"Allowed",
"(",
"p",
"Permission",
")",
"bool",
"{",
"if",
"err",
":=",
"s",
".",
"Expired",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"PermissionAllowed",
"(",
"p... | // Allowed returns true if the authorization is unexpired and request permission
// exists in the sessions list of permissions. | [
"Allowed",
"returns",
"true",
"if",
"the",
"authorization",
"is",
"unexpired",
"and",
"request",
"permission",
"exists",
"in",
"the",
"sessions",
"list",
"of",
"permissions",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/session.go#L56-L62 |
124,354 | influxdata/influxdb | session.go | EphemeralAuth | func (s *Session) EphemeralAuth(orgID ID) *Authorization {
return &Authorization{
ID: s.ID,
OrgID: orgID,
Status: Active,
UserID: s.UserID,
Permissions: s.Permissions,
}
} | go | func (s *Session) EphemeralAuth(orgID ID) *Authorization {
return &Authorization{
ID: s.ID,
OrgID: orgID,
Status: Active,
UserID: s.UserID,
Permissions: s.Permissions,
}
} | [
"func",
"(",
"s",
"*",
"Session",
")",
"EphemeralAuth",
"(",
"orgID",
"ID",
")",
"*",
"Authorization",
"{",
"return",
"&",
"Authorization",
"{",
"ID",
":",
"s",
".",
"ID",
",",
"OrgID",
":",
"orgID",
",",
"Status",
":",
"Active",
",",
"UserID",
":",
... | // EphemeralAuth generates an Authorization that is not stored
// but at the user's max privs. | [
"EphemeralAuth",
"generates",
"an",
"Authorization",
"that",
"is",
"not",
"stored",
"but",
"at",
"the",
"user",
"s",
"max",
"privs",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/session.go#L77-L85 |
124,355 | influxdata/influxdb | kit/check/helpers.go | Named | func Named(name string, checker Checker) Checker {
return CheckerFunc(func(ctx context.Context) Response {
resp := checker.Check(ctx)
resp.Name = name
return resp
})
} | go | func Named(name string, checker Checker) Checker {
return CheckerFunc(func(ctx context.Context) Response {
resp := checker.Check(ctx)
resp.Name = name
return resp
})
} | [
"func",
"Named",
"(",
"name",
"string",
",",
"checker",
"Checker",
")",
"Checker",
"{",
"return",
"CheckerFunc",
"(",
"func",
"(",
"ctx",
"context",
".",
"Context",
")",
"Response",
"{",
"resp",
":=",
"checker",
".",
"Check",
"(",
"ctx",
")",
"\n",
"re... | // Named returns a Checker that will attach a name to the Response from the check.
// This way, it is possible to augment a Response with a human-readable name, but not have to encode
// that logic in the actual check itself. | [
"Named",
"returns",
"a",
"Checker",
"that",
"will",
"attach",
"a",
"name",
"to",
"the",
"Response",
"from",
"the",
"check",
".",
"This",
"way",
"it",
"is",
"possible",
"to",
"augment",
"a",
"Response",
"with",
"a",
"human",
"-",
"readable",
"name",
"but"... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/check/helpers.go#L27-L33 |
124,356 | influxdata/influxdb | kit/check/helpers.go | Info | func Info(msg string, args ...interface{}) Response {
return Response{
Status: StatusPass,
Message: fmt.Sprintf(msg, args...),
}
} | go | func Info(msg string, args ...interface{}) Response {
return Response{
Status: StatusPass,
Message: fmt.Sprintf(msg, args...),
}
} | [
"func",
"Info",
"(",
"msg",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"Response",
"{",
"return",
"Response",
"{",
"Status",
":",
"StatusPass",
",",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"msg",
",",
"args",
"...",
")",
",",
"}",
... | // Info is a utility function to generate a healthy status with a printf message. | [
"Info",
"is",
"a",
"utility",
"function",
"to",
"generate",
"a",
"healthy",
"status",
"with",
"a",
"printf",
"message",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/check/helpers.go#L60-L65 |
124,357 | influxdata/influxdb | kit/check/helpers.go | Error | func Error(err error) Response {
return Response{
Status: StatusFail,
Message: err.Error(),
}
} | go | func Error(err error) Response {
return Response{
Status: StatusFail,
Message: err.Error(),
}
} | [
"func",
"Error",
"(",
"err",
"error",
")",
"Response",
"{",
"return",
"Response",
"{",
"Status",
":",
"StatusFail",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}"
] | // Error is a utility function for creating a response from an error message. | [
"Error",
"is",
"a",
"utility",
"function",
"for",
"creating",
"a",
"response",
"from",
"an",
"error",
"message",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/check/helpers.go#L68-L73 |
124,358 | influxdata/influxdb | pkg/metrics/timer.go | Time | func (t *Timer) Time(f func()) {
s := time.Now()
f()
t.UpdateSince(s)
} | go | func (t *Timer) Time(f func()) {
s := time.Now()
f()
t.UpdateSince(s)
} | [
"func",
"(",
"t",
"*",
"Timer",
")",
"Time",
"(",
"f",
"func",
"(",
")",
")",
"{",
"s",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"f",
"(",
")",
"\n",
"t",
".",
"UpdateSince",
"(",
"s",
")",
"\n",
"}"
] | // Time updates the timer to the duration it takes to call f. | [
"Time",
"updates",
"the",
"timer",
"to",
"the",
"duration",
"it",
"takes",
"to",
"call",
"f",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/metrics/timer.go#L30-L34 |
124,359 | influxdata/influxdb | tsdb/tsm1/float.go | NewFloatEncoder | func NewFloatEncoder() *FloatEncoder {
s := FloatEncoder{
first: true,
leading: ^uint64(0),
}
s.bw = bitstream.NewWriter(&s.buf)
s.buf.WriteByte(floatCompressedGorilla << 4)
return &s
} | go | func NewFloatEncoder() *FloatEncoder {
s := FloatEncoder{
first: true,
leading: ^uint64(0),
}
s.bw = bitstream.NewWriter(&s.buf)
s.buf.WriteByte(floatCompressedGorilla << 4)
return &s
} | [
"func",
"NewFloatEncoder",
"(",
")",
"*",
"FloatEncoder",
"{",
"s",
":=",
"FloatEncoder",
"{",
"first",
":",
"true",
",",
"leading",
":",
"^",
"uint64",
"(",
"0",
")",
",",
"}",
"\n\n",
"s",
".",
"bw",
"=",
"bitstream",
".",
"NewWriter",
"(",
"&",
... | // NewFloatEncoder returns a new FloatEncoder. | [
"NewFloatEncoder",
"returns",
"a",
"new",
"FloatEncoder",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/float.go#L44-L54 |
124,360 | influxdata/influxdb | tsdb/tsm1/float.go | Bytes | func (s *FloatEncoder) Bytes() ([]byte, error) {
return s.buf.Bytes(), s.err
} | go | func (s *FloatEncoder) Bytes() ([]byte, error) {
return s.buf.Bytes(), s.err
} | [
"func",
"(",
"s",
"*",
"FloatEncoder",
")",
"Bytes",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"s",
".",
"buf",
".",
"Bytes",
"(",
")",
",",
"s",
".",
"err",
"\n",
"}"
] | // Bytes returns a copy of the underlying byte buffer used in the encoder. | [
"Bytes",
"returns",
"a",
"copy",
"of",
"the",
"underlying",
"byte",
"buffer",
"used",
"in",
"the",
"encoder",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/float.go#L72-L74 |
124,361 | influxdata/influxdb | tsdb/tsm1/float.go | Flush | func (s *FloatEncoder) Flush() {
if !s.finished {
// write an end-of-stream record
s.finished = true
s.Write(math.NaN())
s.bw.Flush(bitstream.Zero)
}
} | go | func (s *FloatEncoder) Flush() {
if !s.finished {
// write an end-of-stream record
s.finished = true
s.Write(math.NaN())
s.bw.Flush(bitstream.Zero)
}
} | [
"func",
"(",
"s",
"*",
"FloatEncoder",
")",
"Flush",
"(",
")",
"{",
"if",
"!",
"s",
".",
"finished",
"{",
"// write an end-of-stream record",
"s",
".",
"finished",
"=",
"true",
"\n",
"s",
".",
"Write",
"(",
"math",
".",
"NaN",
"(",
")",
")",
"\n",
... | // Flush indicates there are no more values to encode. | [
"Flush",
"indicates",
"there",
"are",
"no",
"more",
"values",
"to",
"encode",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/float.go#L77-L84 |
124,362 | influxdata/influxdb | tsdb/tsm1/float.go | Write | func (s *FloatEncoder) Write(v float64) {
// Only allow NaN as a sentinel value
if math.IsNaN(v) && !s.finished {
s.err = fmt.Errorf("unsupported value: NaN")
return
}
if s.first {
// first point
s.val = v
s.first = false
s.bw.WriteBits(math.Float64bits(v), 64)
return
}
vDelta := math.Float64bits(v... | go | func (s *FloatEncoder) Write(v float64) {
// Only allow NaN as a sentinel value
if math.IsNaN(v) && !s.finished {
s.err = fmt.Errorf("unsupported value: NaN")
return
}
if s.first {
// first point
s.val = v
s.first = false
s.bw.WriteBits(math.Float64bits(v), 64)
return
}
vDelta := math.Float64bits(v... | [
"func",
"(",
"s",
"*",
"FloatEncoder",
")",
"Write",
"(",
"v",
"float64",
")",
"{",
"// Only allow NaN as a sentinel value",
"if",
"math",
".",
"IsNaN",
"(",
"v",
")",
"&&",
"!",
"s",
".",
"finished",
"{",
"s",
".",
"err",
"=",
"fmt",
".",
"Errorf",
... | // Write encodes v to the underlying buffer. | [
"Write",
"encodes",
"v",
"to",
"the",
"underlying",
"buffer",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/float.go#L87-L139 |
124,363 | influxdata/influxdb | tsdb/tsm1/float.go | Next | func (it *FloatDecoder) Next() bool {
if it.err != nil || it.finished {
return false
}
if it.first {
it.first = false
// mark as finished if there were no values.
if it.val == uvnan { // IsNaN
it.finished = true
return false
}
return true
}
// read compressed value
var bit bool
if it.br.Can... | go | func (it *FloatDecoder) Next() bool {
if it.err != nil || it.finished {
return false
}
if it.first {
it.first = false
// mark as finished if there were no values.
if it.val == uvnan { // IsNaN
it.finished = true
return false
}
return true
}
// read compressed value
var bit bool
if it.br.Can... | [
"func",
"(",
"it",
"*",
"FloatDecoder",
")",
"Next",
"(",
")",
"bool",
"{",
"if",
"it",
".",
"err",
"!=",
"nil",
"||",
"it",
".",
"finished",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"it",
".",
"first",
"{",
"it",
".",
"first",
"=",
"fa... | // Next returns true if there are remaining values to read. | [
"Next",
"returns",
"true",
"if",
"there",
"are",
"remaining",
"values",
"to",
"read",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/float.go#L187-L270 |
124,364 | influxdata/influxdb | kv/task.go | findTasksByUser | func (s *Service) findTasksByUser(ctx context.Context, tx Tx, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error) {
if filter.User == nil {
return nil, 0, ErrTaskNotFound
}
var org *influxdb.Organization
var err error
if filter.OrganizationID != nil {
org, err = s.findOrganizationByID(ctx, tx, *filter.O... | go | func (s *Service) findTasksByUser(ctx context.Context, tx Tx, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error) {
if filter.User == nil {
return nil, 0, ErrTaskNotFound
}
var org *influxdb.Organization
var err error
if filter.OrganizationID != nil {
org, err = s.findOrganizationByID(ctx, tx, *filter.O... | [
"func",
"(",
"s",
"*",
"Service",
")",
"findTasksByUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"tx",
"Tx",
",",
"filter",
"influxdb",
".",
"TaskFilter",
")",
"(",
"[",
"]",
"*",
"influxdb",
".",
"Task",
",",
"int",
",",
"error",
")",
"{",
"i... | // findTasksByUser is a subset of the find tasks function. Used for cleanliness | [
"findTasksByUser",
"is",
"a",
"subset",
"of",
"the",
"find",
"tasks",
"function",
".",
"Used",
"for",
"cleanliness"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L263-L313 |
124,365 | influxdata/influxdb | kv/task.go | findAllTasks | func (s *Service) findAllTasks(ctx context.Context, tx Tx, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error) {
var ts []*influxdb.Task
taskBucket, err := tx.Bucket(taskBucket)
if err != nil {
return nil, 0, ErrUnexpectedTaskBucketErr(err)
}
c, err := taskBucket.Cursor()
if err != nil {
return nil, ... | go | func (s *Service) findAllTasks(ctx context.Context, tx Tx, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error) {
var ts []*influxdb.Task
taskBucket, err := tx.Bucket(taskBucket)
if err != nil {
return nil, 0, ErrUnexpectedTaskBucketErr(err)
}
c, err := taskBucket.Cursor()
if err != nil {
return nil, ... | [
"func",
"(",
"s",
"*",
"Service",
")",
"findAllTasks",
"(",
"ctx",
"context",
".",
"Context",
",",
"tx",
"Tx",
",",
"filter",
"influxdb",
".",
"TaskFilter",
")",
"(",
"[",
"]",
"*",
"influxdb",
".",
"Task",
",",
"int",
",",
"error",
")",
"{",
"var"... | // findAllTasks is a subset of the find tasks function. Used for cleanliness.
// This function should only be executed internally because it doesn't force organization or user filtering.
// Enforcing filters should be done in a validation layer. | [
"findAllTasks",
"is",
"a",
"subset",
"of",
"the",
"find",
"tasks",
"function",
".",
"Used",
"for",
"cleanliness",
".",
"This",
"function",
"should",
"only",
"be",
"executed",
"internally",
"because",
"it",
"doesn",
"t",
"force",
"organization",
"or",
"user",
... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L419-L496 |
124,366 | influxdata/influxdb | kv/task.go | CreateTask | func (s *Service) CreateTask(ctx context.Context, tc influxdb.TaskCreate) (*influxdb.Task, error) {
var t *influxdb.Task
err := s.kv.Update(ctx, func(tx Tx) error {
task, err := s.createTask(ctx, tx, tc)
if err != nil {
return err
}
t = task
return nil
})
if err != nil {
return nil, err
}
return t... | go | func (s *Service) CreateTask(ctx context.Context, tc influxdb.TaskCreate) (*influxdb.Task, error) {
var t *influxdb.Task
err := s.kv.Update(ctx, func(tx Tx) error {
task, err := s.createTask(ctx, tx, tc)
if err != nil {
return err
}
t = task
return nil
})
if err != nil {
return nil, err
}
return t... | [
"func",
"(",
"s",
"*",
"Service",
")",
"CreateTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"tc",
"influxdb",
".",
"TaskCreate",
")",
"(",
"*",
"influxdb",
".",
"Task",
",",
"error",
")",
"{",
"var",
"t",
"*",
"influxdb",
".",
"Task",
"\n",
"e... | // CreateTask creates a new task.
// The owner of the task is inferred from the authorizer associated with ctx. | [
"CreateTask",
"creates",
"a",
"new",
"task",
".",
"The",
"owner",
"of",
"the",
"task",
"is",
"inferred",
"from",
"the",
"authorizer",
"associated",
"with",
"ctx",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L500-L515 |
124,367 | influxdata/influxdb | kv/task.go | UpdateTask | func (s *Service) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*influxdb.Task, error) {
var t *influxdb.Task
err := s.kv.Update(ctx, func(tx Tx) error {
task, err := s.updateTask(ctx, tx, id, upd)
if err != nil {
return err
}
t = task
return nil
})
if err != nil {
return ... | go | func (s *Service) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*influxdb.Task, error) {
var t *influxdb.Task
err := s.kv.Update(ctx, func(tx Tx) error {
task, err := s.updateTask(ctx, tx, id, upd)
if err != nil {
return err
}
t = task
return nil
})
if err != nil {
return ... | [
"func",
"(",
"s",
"*",
"Service",
")",
"UpdateTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"influxdb",
".",
"ID",
",",
"upd",
"influxdb",
".",
"TaskUpdate",
")",
"(",
"*",
"influxdb",
".",
"Task",
",",
"error",
")",
"{",
"var",
"t",
"*"... | // UpdateTask updates a single task with changeset. | [
"UpdateTask",
"updates",
"a",
"single",
"task",
"with",
"changeset",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L628-L643 |
124,368 | influxdata/influxdb | kv/task.go | FindRunByID | func (s *Service) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error) {
var run *influxdb.Run
err := s.kv.View(ctx, func(tx Tx) error {
r, err := s.findRunByID(ctx, tx, taskID, runID)
if err != nil {
return err
}
run = r
return nil
})
if err != nil {
return nil, err
}
... | go | func (s *Service) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error) {
var run *influxdb.Run
err := s.kv.View(ctx, func(tx Tx) error {
r, err := s.findRunByID(ctx, tx, taskID, runID)
if err != nil {
return err
}
run = r
return nil
})
if err != nil {
return nil, err
}
... | [
"func",
"(",
"s",
"*",
"Service",
")",
"FindRunByID",
"(",
"ctx",
"context",
".",
"Context",
",",
"taskID",
",",
"runID",
"influxdb",
".",
"ID",
")",
"(",
"*",
"influxdb",
".",
"Run",
",",
"error",
")",
"{",
"var",
"run",
"*",
"influxdb",
".",
"Run... | // FindRunByID returns a single run. | [
"FindRunByID",
"returns",
"a",
"single",
"run",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L889-L904 |
124,369 | influxdata/influxdb | kv/task.go | CancelRun | func (s *Service) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error {
err := s.kv.Update(ctx, func(tx Tx) error {
err := s.cancelRun(ctx, tx, taskID, runID)
if err != nil {
return err
}
return nil
})
return err
} | go | func (s *Service) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error {
err := s.kv.Update(ctx, func(tx Tx) error {
err := s.cancelRun(ctx, tx, taskID, runID)
if err != nil {
return err
}
return nil
})
return err
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"CancelRun",
"(",
"ctx",
"context",
".",
"Context",
",",
"taskID",
",",
"runID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"err",
":=",
"s",
".",
"kv",
".",
"Update",
"(",
"ctx",
",",
"func",
"(",
"tx",
"Tx"... | // CancelRun cancels a currently running run. | [
"CancelRun",
"cancels",
"a",
"currently",
"running",
"run",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L933-L942 |
124,370 | influxdata/influxdb | kv/task.go | ForceRun | func (s *Service) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error) {
var r *influxdb.Run
err := s.kv.Update(ctx, func(tx Tx) error {
run, err := s.forceRun(ctx, tx, taskID, scheduledFor)
if err != nil {
return err
}
r = run
return nil
})
return r, err
} | go | func (s *Service) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error) {
var r *influxdb.Run
err := s.kv.Update(ctx, func(tx Tx) error {
run, err := s.forceRun(ctx, tx, taskID, scheduledFor)
if err != nil {
return err
}
r = run
return nil
})
return r, err
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"ForceRun",
"(",
"ctx",
"context",
".",
"Context",
",",
"taskID",
"influxdb",
".",
"ID",
",",
"scheduledFor",
"int64",
")",
"(",
"*",
"influxdb",
".",
"Run",
",",
"error",
")",
"{",
"var",
"r",
"*",
"influxdb",
... | // ForceRun forces a run to occur with unix timestamp scheduledFor, to be executed as soon as possible.
// The value of scheduledFor may or may not align with the task's schedule. | [
"ForceRun",
"forces",
"a",
"run",
"to",
"occur",
"with",
"unix",
"timestamp",
"scheduledFor",
"to",
"be",
"executed",
"as",
"soon",
"as",
"possible",
".",
"The",
"value",
"of",
"scheduledFor",
"may",
"or",
"may",
"not",
"align",
"with",
"the",
"task",
"s",... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L1048-L1059 |
124,371 | influxdata/influxdb | kv/task.go | CreateNextRun | func (s *Service) CreateNextRun(ctx context.Context, taskID influxdb.ID, now int64) (backend.RunCreation, error) {
var rc backend.RunCreation
err := s.kv.Update(ctx, func(tx Tx) error {
runCreate, err := s.createNextRun(ctx, tx, taskID, now)
if err != nil {
return err
}
rc = runCreate
return nil
})
ret... | go | func (s *Service) CreateNextRun(ctx context.Context, taskID influxdb.ID, now int64) (backend.RunCreation, error) {
var rc backend.RunCreation
err := s.kv.Update(ctx, func(tx Tx) error {
runCreate, err := s.createNextRun(ctx, tx, taskID, now)
if err != nil {
return err
}
rc = runCreate
return nil
})
ret... | [
"func",
"(",
"s",
"*",
"Service",
")",
"CreateNextRun",
"(",
"ctx",
"context",
".",
"Context",
",",
"taskID",
"influxdb",
".",
"ID",
",",
"now",
"int64",
")",
"(",
"backend",
".",
"RunCreation",
",",
"error",
")",
"{",
"var",
"rc",
"backend",
".",
"R... | // CreateNextRun creates the earliest needed run scheduled no later than the given Unix timestamp now.
// Internally, the Store should rely on the underlying task's StoreTaskMeta to create the next run. | [
"CreateNextRun",
"creates",
"the",
"earliest",
"needed",
"run",
"scheduled",
"no",
"later",
"than",
"the",
"given",
"Unix",
"timestamp",
"now",
".",
"Internally",
"the",
"Store",
"should",
"rely",
"on",
"the",
"underlying",
"task",
"s",
"StoreTaskMeta",
"to",
... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/task.go#L1112-L1123 |
124,372 | influxdata/influxdb | chronograf/bolt/org_config.go | Get | func (s *OrganizationConfigStore) Get(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error) {
var c chronograf.OrganizationConfig
err := s.client.db.View(func(tx *bolt.Tx) error {
return s.get(ctx, tx, orgID, &c)
})
if err != nil {
return nil, err
}
return &c, nil
} | go | func (s *OrganizationConfigStore) Get(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error) {
var c chronograf.OrganizationConfig
err := s.client.db.View(func(tx *bolt.Tx) error {
return s.get(ctx, tx, orgID, &c)
})
if err != nil {
return nil, err
}
return &c, nil
} | [
"func",
"(",
"s",
"*",
"OrganizationConfigStore",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"string",
")",
"(",
"*",
"chronograf",
".",
"OrganizationConfig",
",",
"error",
")",
"{",
"var",
"c",
"chronograf",
".",
"OrganizationConfig",
... | // Get retrieves an OrganizationConfig from the store | [
"Get",
"retrieves",
"an",
"OrganizationConfig",
"from",
"the",
"store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/org_config.go#L28-L40 |
124,373 | influxdata/influxdb | chronograf/bolt/org_config.go | FindOrCreate | func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error) {
var c chronograf.OrganizationConfig
err := s.client.db.Update(func(tx *bolt.Tx) error {
err := s.get(ctx, tx, orgID, &c)
if err == chronograf.ErrOrganizationConfigNotFound {
c = newOrgani... | go | func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error) {
var c chronograf.OrganizationConfig
err := s.client.db.Update(func(tx *bolt.Tx) error {
err := s.get(ctx, tx, orgID, &c)
if err == chronograf.ErrOrganizationConfigNotFound {
c = newOrgani... | [
"func",
"(",
"s",
"*",
"OrganizationConfigStore",
")",
"FindOrCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"string",
")",
"(",
"*",
"chronograf",
".",
"OrganizationConfig",
",",
"error",
")",
"{",
"var",
"c",
"chronograf",
".",
"Organization... | // FindOrCreate gets an OrganizationConfig from the store or creates one if none exists for this organization | [
"FindOrCreate",
"gets",
"an",
"OrganizationConfig",
"from",
"the",
"store",
"or",
"creates",
"one",
"if",
"none",
"exists",
"for",
"this",
"organization"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/org_config.go#L51-L66 |
124,374 | influxdata/influxdb | chronograf/bolt/org_config.go | Put | func (s *OrganizationConfigStore) Put(ctx context.Context, c *chronograf.OrganizationConfig) error {
return s.client.db.Update(func(tx *bolt.Tx) error {
return s.put(ctx, tx, c)
})
} | go | func (s *OrganizationConfigStore) Put(ctx context.Context, c *chronograf.OrganizationConfig) error {
return s.client.db.Update(func(tx *bolt.Tx) error {
return s.put(ctx, tx, c)
})
} | [
"func",
"(",
"s",
"*",
"OrganizationConfigStore",
")",
"Put",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"chronograf",
".",
"OrganizationConfig",
")",
"error",
"{",
"return",
"s",
".",
"client",
".",
"db",
".",
"Update",
"(",
"func",
"(",
"t... | // Put replaces the OrganizationConfig in the store | [
"Put",
"replaces",
"the",
"OrganizationConfig",
"in",
"the",
"store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/org_config.go#L69-L73 |
124,375 | influxdata/influxdb | mock/operation_log_service.go | NewBucketOperationLogService | func NewBucketOperationLogService() *BucketOperationLogService {
return &BucketOperationLogService{
GetBucketOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | go | func NewBucketOperationLogService() *BucketOperationLogService {
return &BucketOperationLogService{
GetBucketOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | [
"func",
"NewBucketOperationLogService",
"(",
")",
"*",
"BucketOperationLogService",
"{",
"return",
"&",
"BucketOperationLogService",
"{",
"GetBucketOperationLogFn",
":",
"func",
"(",
"context",
".",
"Context",
",",
"platform",
".",
"ID",
",",
"platform",
".",
"FindO... | // NewBucketOperationLogService returns a mock of BucketOperationLogService. | [
"NewBucketOperationLogService",
"returns",
"a",
"mock",
"of",
"BucketOperationLogService",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L15-L21 |
124,376 | influxdata/influxdb | mock/operation_log_service.go | NewDashboardOperationLogService | func NewDashboardOperationLogService() *DashboardOperationLogService {
return &DashboardOperationLogService{
GetDashboardOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | go | func NewDashboardOperationLogService() *DashboardOperationLogService {
return &DashboardOperationLogService{
GetDashboardOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | [
"func",
"NewDashboardOperationLogService",
"(",
")",
"*",
"DashboardOperationLogService",
"{",
"return",
"&",
"DashboardOperationLogService",
"{",
"GetDashboardOperationLogFn",
":",
"func",
"(",
"context",
".",
"Context",
",",
"platform",
".",
"ID",
",",
"platform",
"... | // NewDashboardOperationLogService returns a mock of DashboardOperationLogService. | [
"NewDashboardOperationLogService",
"returns",
"a",
"mock",
"of",
"DashboardOperationLogService",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L24-L30 |
124,377 | influxdata/influxdb | mock/operation_log_service.go | NewOrganizationOperationLogService | func NewOrganizationOperationLogService() *OrganizationOperationLogService {
return &OrganizationOperationLogService{
GetOrganizationOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | go | func NewOrganizationOperationLogService() *OrganizationOperationLogService {
return &OrganizationOperationLogService{
GetOrganizationOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | [
"func",
"NewOrganizationOperationLogService",
"(",
")",
"*",
"OrganizationOperationLogService",
"{",
"return",
"&",
"OrganizationOperationLogService",
"{",
"GetOrganizationOperationLogFn",
":",
"func",
"(",
"context",
".",
"Context",
",",
"platform",
".",
"ID",
",",
"pl... | // NewOrganizationOperationLogService returns a mock of OrganizationOperationLogService. | [
"NewOrganizationOperationLogService",
"returns",
"a",
"mock",
"of",
"OrganizationOperationLogService",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L33-L39 |
124,378 | influxdata/influxdb | mock/operation_log_service.go | NewUserOperationLogService | func NewUserOperationLogService() *UserOperationLogService {
return &UserOperationLogService{
GetUserOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | go | func NewUserOperationLogService() *UserOperationLogService {
return &UserOperationLogService{
GetUserOperationLogFn: func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return nil, 0, nil
},
}
} | [
"func",
"NewUserOperationLogService",
"(",
")",
"*",
"UserOperationLogService",
"{",
"return",
"&",
"UserOperationLogService",
"{",
"GetUserOperationLogFn",
":",
"func",
"(",
"context",
".",
"Context",
",",
"platform",
".",
"ID",
",",
"platform",
".",
"FindOptions",... | // NewUserOperationLogService returns a mock of UserOperationLogService. | [
"NewUserOperationLogService",
"returns",
"a",
"mock",
"of",
"UserOperationLogService",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L42-L48 |
124,379 | influxdata/influxdb | mock/operation_log_service.go | GetBucketOperationLog | func (s *BucketOperationLogService) GetBucketOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetBucketOperationLogFn(ctx, id, opts)
} | go | func (s *BucketOperationLogService) GetBucketOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetBucketOperationLogFn(ctx, id, opts)
} | [
"func",
"(",
"s",
"*",
"BucketOperationLogService",
")",
"GetBucketOperationLog",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"opts",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"OperationLogEnt... | // GetBucketOperationLog retrieves the operation log for the bucket with the provided id. | [
"GetBucketOperationLog",
"retrieves",
"the",
"operation",
"log",
"for",
"the",
"bucket",
"with",
"the",
"provided",
"id",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L71-L73 |
124,380 | influxdata/influxdb | mock/operation_log_service.go | GetDashboardOperationLog | func (s *DashboardOperationLogService) GetDashboardOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetDashboardOperationLogFn(ctx, id, opts)
} | go | func (s *DashboardOperationLogService) GetDashboardOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetDashboardOperationLogFn(ctx, id, opts)
} | [
"func",
"(",
"s",
"*",
"DashboardOperationLogService",
")",
"GetDashboardOperationLog",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"opts",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"Operation... | // GetDashboardOperationLog retrieves the operation log for the dashboard with the provided id. | [
"GetDashboardOperationLog",
"retrieves",
"the",
"operation",
"log",
"for",
"the",
"dashboard",
"with",
"the",
"provided",
"id",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L76-L78 |
124,381 | influxdata/influxdb | mock/operation_log_service.go | GetOrganizationOperationLog | func (s *OrganizationOperationLogService) GetOrganizationOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetOrganizationOperationLogFn(ctx, id, opts)
} | go | func (s *OrganizationOperationLogService) GetOrganizationOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetOrganizationOperationLogFn(ctx, id, opts)
} | [
"func",
"(",
"s",
"*",
"OrganizationOperationLogService",
")",
"GetOrganizationOperationLog",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"opts",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"Ope... | // GetOrganizationOperationLog retrieves the operation log for the org with the provided id. | [
"GetOrganizationOperationLog",
"retrieves",
"the",
"operation",
"log",
"for",
"the",
"org",
"with",
"the",
"provided",
"id",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L81-L83 |
124,382 | influxdata/influxdb | mock/operation_log_service.go | GetUserOperationLog | func (s *UserOperationLogService) GetUserOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetUserOperationLogFn(ctx, id, opts)
} | go | func (s *UserOperationLogService) GetUserOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
return s.GetUserOperationLogFn(ctx, id, opts)
} | [
"func",
"(",
"s",
"*",
"UserOperationLogService",
")",
"GetUserOperationLog",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"opts",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"OperationLogEntry",... | // GetUserOperationLog retrieves the operation log for the user with the provided id. | [
"GetUserOperationLog",
"retrieves",
"the",
"operation",
"log",
"for",
"the",
"user",
"with",
"the",
"provided",
"id",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/operation_log_service.go#L86-L88 |
124,383 | influxdata/influxdb | chronograf/roles/sources.go | NewSourcesStore | func NewSourcesStore(s chronograf.SourcesStore, role string) *SourcesStore {
return &SourcesStore{
store: s,
role: role,
}
} | go | func NewSourcesStore(s chronograf.SourcesStore, role string) *SourcesStore {
return &SourcesStore{
store: s,
role: role,
}
} | [
"func",
"NewSourcesStore",
"(",
"s",
"chronograf",
".",
"SourcesStore",
",",
"role",
"string",
")",
"*",
"SourcesStore",
"{",
"return",
"&",
"SourcesStore",
"{",
"store",
":",
"s",
",",
"role",
":",
"role",
",",
"}",
"\n",
"}"
] | // NewSourcesStore creates a new SourcesStore from an existing
// chronograf.SourceStore and an role string | [
"NewSourcesStore",
"creates",
"a",
"new",
"SourcesStore",
"from",
"an",
"existing",
"chronograf",
".",
"SourceStore",
"and",
"an",
"role",
"string"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/roles/sources.go#L29-L34 |
124,384 | influxdata/influxdb | chronograf/roles/sources.go | All | func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) {
err := validRole(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-without... | go | func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) {
err := validRole(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-without... | [
"func",
"(",
"s",
"*",
"SourcesStore",
")",
"All",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"chronograf",
".",
"Source",
",",
"error",
")",
"{",
"err",
":=",
"validRole",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"re... | // All retrieves all sources from the underlying SourceStore and filters them
// by role. | [
"All",
"retrieves",
"all",
"sources",
"from",
"the",
"underlying",
"SourceStore",
"and",
"filters",
"them",
"by",
"role",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/roles/sources.go#L38-L59 |
124,385 | influxdata/influxdb | chronograf/roles/sources.go | Add | func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error) {
err := validRole(ctx)
if err != nil {
return chronograf.Source{}, err
}
return s.store.Add(ctx, d)
} | go | func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error) {
err := validRole(ctx)
if err != nil {
return chronograf.Source{}, err
}
return s.store.Add(ctx, d)
} | [
"func",
"(",
"s",
"*",
"SourcesStore",
")",
"Add",
"(",
"ctx",
"context",
".",
"Context",
",",
"d",
"chronograf",
".",
"Source",
")",
"(",
"chronograf",
".",
"Source",
",",
"error",
")",
"{",
"err",
":=",
"validRole",
"(",
"ctx",
")",
"\n",
"if",
"... | // Add creates a new Source in the SourcesStore with source.Role set to be the
// role from the source store. | [
"Add",
"creates",
"a",
"new",
"Source",
"in",
"the",
"SourcesStore",
"with",
"source",
".",
"Role",
"set",
"to",
"be",
"the",
"role",
"from",
"the",
"source",
"store",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/roles/sources.go#L63-L70 |
124,386 | influxdata/influxdb | chronograf/roles/sources.go | Get | func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) {
err := validRole(ctx)
if err != nil {
return chronograf.Source{}, err
}
d, err := s.store.Get(ctx, id)
if err != nil {
return chronograf.Source{}, err
}
if !hasAuthorizedRole(d.Role, s.role) {
return chronograf.Source{},... | go | func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) {
err := validRole(ctx)
if err != nil {
return chronograf.Source{}, err
}
d, err := s.store.Get(ctx, id)
if err != nil {
return chronograf.Source{}, err
}
if !hasAuthorizedRole(d.Role, s.role) {
return chronograf.Source{},... | [
"func",
"(",
"s",
"*",
"SourcesStore",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"int",
")",
"(",
"chronograf",
".",
"Source",
",",
"error",
")",
"{",
"err",
":=",
"validRole",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Get returns a Source if the id exists and belongs to the role that is set. | [
"Get",
"returns",
"a",
"Source",
"if",
"the",
"id",
"exists",
"and",
"belongs",
"to",
"the",
"role",
"that",
"is",
"set",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/roles/sources.go#L88-L104 |
124,387 | influxdata/influxdb | chronograf/roles/sources.go | hasAuthorizedRole | func hasAuthorizedRole(sourceRole, providedRole string) bool {
switch sourceRole {
case ViewerRoleName:
switch providedRole {
case ViewerRoleName, EditorRoleName, AdminRoleName:
return true
}
case EditorRoleName:
switch providedRole {
case EditorRoleName, AdminRoleName:
return true
}
case AdminRol... | go | func hasAuthorizedRole(sourceRole, providedRole string) bool {
switch sourceRole {
case ViewerRoleName:
switch providedRole {
case ViewerRoleName, EditorRoleName, AdminRoleName:
return true
}
case EditorRoleName:
switch providedRole {
case EditorRoleName, AdminRoleName:
return true
}
case AdminRol... | [
"func",
"hasAuthorizedRole",
"(",
"sourceRole",
",",
"providedRole",
"string",
")",
"bool",
"{",
"switch",
"sourceRole",
"{",
"case",
"ViewerRoleName",
":",
"switch",
"providedRole",
"{",
"case",
"ViewerRoleName",
",",
"EditorRoleName",
",",
"AdminRoleName",
":",
... | // hasAuthorizedRole checks that the role provided has at least
// the minimum role required. | [
"hasAuthorizedRole",
"checks",
"that",
"the",
"role",
"provided",
"has",
"at",
"least",
"the",
"minimum",
"role",
"required",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/roles/sources.go#L123-L143 |
124,388 | influxdata/influxdb | storage/opener.go | Open | func (o *openHelper) Open(ctx context.Context, op opener) {
if o.err != nil {
return
}
o.err = op.Open(ctx)
if o.err == nil {
o.opened = append(o.opened, op)
}
} | go | func (o *openHelper) Open(ctx context.Context, op opener) {
if o.err != nil {
return
}
o.err = op.Open(ctx)
if o.err == nil {
o.opened = append(o.opened, op)
}
} | [
"func",
"(",
"o",
"*",
"openHelper",
")",
"Open",
"(",
"ctx",
"context",
".",
"Context",
",",
"op",
"opener",
")",
"{",
"if",
"o",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"o",
".",
"err",
"=",
"op",
".",
"Open",
"(",
"ctx",
"... | // Open attempts to open the opener. If an error has happened already
// then no calls are made to the opener. | [
"Open",
"attempts",
"to",
"open",
"the",
"opener",
".",
"If",
"an",
"error",
"has",
"happened",
"already",
"then",
"no",
"calls",
"are",
"made",
"to",
"the",
"opener",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/opener.go#L24-L32 |
124,389 | influxdata/influxdb | storage/opener.go | Done | func (o *openHelper) Done() error {
if o.err == nil {
return nil
}
for i := len(o.opened) - 1; i >= 0; i-- {
o.opened[i].Close()
}
return o.err
} | go | func (o *openHelper) Done() error {
if o.err == nil {
return nil
}
for i := len(o.opened) - 1; i >= 0; i-- {
o.opened[i].Close()
}
return o.err
} | [
"func",
"(",
"o",
"*",
"openHelper",
")",
"Done",
"(",
")",
"error",
"{",
"if",
"o",
".",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"i",
":=",
"len",
"(",
"o",
".",
"opened",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
... | // Done returns the error of the first open and closes in reverse
// order any opens that have already happened if there was an error. | [
"Done",
"returns",
"the",
"error",
"of",
"the",
"first",
"open",
"and",
"closes",
"in",
"reverse",
"order",
"any",
"opens",
"that",
"have",
"already",
"happened",
"if",
"there",
"was",
"an",
"error",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/opener.go#L36-L44 |
124,390 | influxdata/influxdb | storage/opener.go | Close | func (c *closeHelper) Close(cl io.Closer) {
if err := cl.Close(); c.err == nil {
c.err = err
}
} | go | func (c *closeHelper) Close(cl io.Closer) {
if err := cl.Close(); c.err == nil {
c.err = err
}
} | [
"func",
"(",
"c",
"*",
"closeHelper",
")",
"Close",
"(",
"cl",
"io",
".",
"Closer",
")",
"{",
"if",
"err",
":=",
"cl",
".",
"Close",
"(",
")",
";",
"c",
".",
"err",
"==",
"nil",
"{",
"c",
".",
"err",
"=",
"err",
"\n",
"}",
"\n",
"}"
] | // Close closes the closer and keeps track of the first error. | [
"Close",
"closes",
"the",
"closer",
"and",
"keeps",
"track",
"of",
"the",
"first",
"error",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/opener.go#L53-L57 |
124,391 | influxdata/influxdb | kv/dashboard.go | CreateDashboard | func (s *Service) CreateDashboard(ctx context.Context, d *influxdb.Dashboard) error {
err := s.kv.Update(ctx, func(tx Tx) error {
d.ID = s.IDGenerator.ID()
for _, cell := range d.Cells {
cell.ID = s.IDGenerator.ID()
if err := s.createCellView(ctx, tx, d.ID, cell.ID, nil); err != nil {
return err
}
... | go | func (s *Service) CreateDashboard(ctx context.Context, d *influxdb.Dashboard) error {
err := s.kv.Update(ctx, func(tx Tx) error {
d.ID = s.IDGenerator.ID()
for _, cell := range d.Cells {
cell.ID = s.IDGenerator.ID()
if err := s.createCellView(ctx, tx, d.ID, cell.ID, nil); err != nil {
return err
}
... | [
"func",
"(",
"s",
"*",
"Service",
")",
"CreateDashboard",
"(",
"ctx",
"context",
".",
"Context",
",",
"d",
"*",
"influxdb",
".",
"Dashboard",
")",
"error",
"{",
"err",
":=",
"s",
".",
"kv",
".",
"Update",
"(",
"ctx",
",",
"func",
"(",
"tx",
"Tx",
... | // CreateDashboard creates a influxdb dashboard and sets d.ID. | [
"CreateDashboard",
"creates",
"a",
"influxdb",
"dashboard",
"and",
"sets",
"d",
".",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/dashboard.go#L283-L322 |
124,392 | influxdata/influxdb | kv/dashboard.go | addDashboardOwner | func (s *Service) addDashboardOwner(ctx context.Context, tx Tx, orgID influxdb.ID) error {
return s.addResourceOwner(ctx, tx, influxdb.DashboardsResourceType, orgID)
} | go | func (s *Service) addDashboardOwner(ctx context.Context, tx Tx, orgID influxdb.ID) error {
return s.addResourceOwner(ctx, tx, influxdb.DashboardsResourceType, orgID)
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"addDashboardOwner",
"(",
"ctx",
"context",
".",
"Context",
",",
"tx",
"Tx",
",",
"orgID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"return",
"s",
".",
"addResourceOwner",
"(",
"ctx",
",",
"tx",
",",
"influxdb",
... | // addDashboardOwner attempts to create a user resource mapping for the user on the
// authorizer found on context. If no authorizer is found on context if returns an error. | [
"addDashboardOwner",
"attempts",
"to",
"create",
"a",
"user",
"resource",
"mapping",
"for",
"the",
"user",
"on",
"the",
"authorizer",
"found",
"on",
"context",
".",
"If",
"no",
"authorizer",
"is",
"found",
"on",
"context",
"if",
"returns",
"an",
"error",
"."... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/dashboard.go#L326-L328 |
124,393 | influxdata/influxdb | context/token.go | SetAuthorizer | func SetAuthorizer(ctx context.Context, a platform.Authorizer) context.Context {
return context.WithValue(ctx, authorizerCtxKey, a)
} | go | func SetAuthorizer(ctx context.Context, a platform.Authorizer) context.Context {
return context.WithValue(ctx, authorizerCtxKey, a)
} | [
"func",
"SetAuthorizer",
"(",
"ctx",
"context",
".",
"Context",
",",
"a",
"platform",
".",
"Authorizer",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"authorizerCtxKey",
",",
"a",
")",
"\n",
"}"
] | // SetAuthorizer sets an authorizer on context. | [
"SetAuthorizer",
"sets",
"an",
"authorizer",
"on",
"context",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/context/token.go#L17-L19 |
124,394 | influxdata/influxdb | context/token.go | GetAuthorizer | func GetAuthorizer(ctx context.Context) (platform.Authorizer, error) {
a, ok := ctx.Value(authorizerCtxKey).(platform.Authorizer)
if !ok {
return nil, &platform.Error{
Msg: "authorizer not found on context",
Code: platform.EInternal,
}
}
return a, nil
} | go | func GetAuthorizer(ctx context.Context) (platform.Authorizer, error) {
a, ok := ctx.Value(authorizerCtxKey).(platform.Authorizer)
if !ok {
return nil, &platform.Error{
Msg: "authorizer not found on context",
Code: platform.EInternal,
}
}
return a, nil
} | [
"func",
"GetAuthorizer",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"platform",
".",
"Authorizer",
",",
"error",
")",
"{",
"a",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"authorizerCtxKey",
")",
".",
"(",
"platform",
".",
"Authorizer",
")",
"\n"... | // GetAuthorizer retrieves an authorizer from context. | [
"GetAuthorizer",
"retrieves",
"an",
"authorizer",
"from",
"context",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/context/token.go#L22-L32 |
124,395 | influxdata/influxdb | context/token.go | GetToken | func GetToken(ctx context.Context) (string, error) {
a, ok := ctx.Value(authorizerCtxKey).(platform.Authorizer)
if !ok {
return "", &platform.Error{
Msg: "authorizer not found on context",
Code: platform.EInternal,
}
}
auth, ok := a.(*platform.Authorization)
if !ok {
return "", &platform.Error{
Ms... | go | func GetToken(ctx context.Context) (string, error) {
a, ok := ctx.Value(authorizerCtxKey).(platform.Authorizer)
if !ok {
return "", &platform.Error{
Msg: "authorizer not found on context",
Code: platform.EInternal,
}
}
auth, ok := a.(*platform.Authorization)
if !ok {
return "", &platform.Error{
Ms... | [
"func",
"GetToken",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"a",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"authorizerCtxKey",
")",
".",
"(",
"platform",
".",
"Authorizer",
")",
"\n",
"if",
"!",
"ok",
"{"... | // GetToken retrieves a token from the context; errors if no token. | [
"GetToken",
"retrieves",
"a",
"token",
"from",
"the",
"context",
";",
"errors",
"if",
"no",
"token",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/context/token.go#L35-L53 |
124,396 | influxdata/influxdb | chronograf/server/middle.go | RouteMatchesPrincipal | func RouteMatchesPrincipal(
store DataStore,
useAuth bool,
logger chronograf.Logger,
next http.HandlerFunc,
) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
if !useAuth {
next(w, r)
return
}
log := logger.
WithField("component", "org_match").
WithFi... | go | func RouteMatchesPrincipal(
store DataStore,
useAuth bool,
logger chronograf.Logger,
next http.HandlerFunc,
) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
if !useAuth {
next(w, r)
return
}
log := logger.
WithField("component", "org_match").
WithFi... | [
"func",
"RouteMatchesPrincipal",
"(",
"store",
"DataStore",
",",
"useAuth",
"bool",
",",
"logger",
"chronograf",
".",
"Logger",
",",
"next",
"http",
".",
"HandlerFunc",
",",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"Re... | // RouteMatchesPrincipal checks that the organization on context matches the organization
// in the route. | [
"RouteMatchesPrincipal",
"checks",
"that",
"the",
"organization",
"on",
"context",
"matches",
"the",
"organization",
"in",
"the",
"route",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/middle.go#L12-L57 |
124,397 | influxdata/influxdb | http/usage_service.go | NewUsageHandler | func NewUsageHandler() *UsageHandler {
h := &UsageHandler{
Router: NewRouter(),
Logger: zap.NewNop(),
}
h.HandlerFunc("GET", "/api/v2/usage", h.handleGetUsage)
return h
} | go | func NewUsageHandler() *UsageHandler {
h := &UsageHandler{
Router: NewRouter(),
Logger: zap.NewNop(),
}
h.HandlerFunc("GET", "/api/v2/usage", h.handleGetUsage)
return h
} | [
"func",
"NewUsageHandler",
"(",
")",
"*",
"UsageHandler",
"{",
"h",
":=",
"&",
"UsageHandler",
"{",
"Router",
":",
"NewRouter",
"(",
")",
",",
"Logger",
":",
"zap",
".",
"NewNop",
"(",
")",
",",
"}",
"\n\n",
"h",
".",
"HandlerFunc",
"(",
"\"",
"\"",
... | // NewUsageHandler returns a new instance of UsageHandler. | [
"NewUsageHandler",
"returns",
"a",
"new",
"instance",
"of",
"UsageHandler",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/usage_service.go#L24-L32 |
124,398 | influxdata/influxdb | chronograf/organizations/org_config.go | NewOrganizationConfigStore | func NewOrganizationConfigStore(s chronograf.OrganizationConfigStore, orgID string) *OrganizationConfigStore {
return &OrganizationConfigStore{
store: s,
organization: orgID,
}
} | go | func NewOrganizationConfigStore(s chronograf.OrganizationConfigStore, orgID string) *OrganizationConfigStore {
return &OrganizationConfigStore{
store: s,
organization: orgID,
}
} | [
"func",
"NewOrganizationConfigStore",
"(",
"s",
"chronograf",
".",
"OrganizationConfigStore",
",",
"orgID",
"string",
")",
"*",
"OrganizationConfigStore",
"{",
"return",
"&",
"OrganizationConfigStore",
"{",
"store",
":",
"s",
",",
"organization",
":",
"orgID",
",",
... | // NewOrganizationConfigStore creates a new OrganizationConfigStore from an existing
// chronograf.OrganizationConfigStore and an organization string | [
"NewOrganizationConfigStore",
"creates",
"a",
"new",
"OrganizationConfigStore",
"from",
"an",
"existing",
"chronograf",
".",
"OrganizationConfigStore",
"and",
"an",
"organization",
"string"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/org_config.go#L20-L25 |
124,399 | influxdata/influxdb | chronograf/organizations/org_config.go | FindOrCreate | func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error) {
var err = validOrganization(ctx)
if err != nil {
return nil, err
}
oc, err := s.store.FindOrCreate(ctx, orgID)
if err != nil {
return nil, err
}
return oc, nil
} | go | func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, orgID string) (*chronograf.OrganizationConfig, error) {
var err = validOrganization(ctx)
if err != nil {
return nil, err
}
oc, err := s.store.FindOrCreate(ctx, orgID)
if err != nil {
return nil, err
}
return oc, nil
} | [
"func",
"(",
"s",
"*",
"OrganizationConfigStore",
")",
"FindOrCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"string",
")",
"(",
"*",
"chronograf",
".",
"OrganizationConfig",
",",
"error",
")",
"{",
"var",
"err",
"=",
"validOrganization",
"(",... | // FindOrCreate gets an organization's config or creates one if none exists | [
"FindOrCreate",
"gets",
"an",
"organization",
"s",
"config",
"or",
"creates",
"one",
"if",
"none",
"exists"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/organizations/org_config.go#L28-L41 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.