id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
123,700 | influxdata/influxdb | chronograf/mocks/timeseries.go | New | func (t *TimeSeries) New(chronograf.Source, chronograf.Logger) (chronograf.TimeSeries, error) {
return t, nil
} | go | func (t *TimeSeries) New(chronograf.Source, chronograf.Logger) (chronograf.TimeSeries, error) {
return t, nil
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"New",
"(",
"chronograf",
".",
"Source",
",",
"chronograf",
".",
"Logger",
")",
"(",
"chronograf",
".",
"TimeSeries",
",",
"error",
")",
"{",
"return",
"t",
",",
"nil",
"\n",
"}"
] | // New implements TimeSeriesClient | [
"New",
"implements",
"TimeSeriesClient"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L28-L30 |
123,701 | influxdata/influxdb | chronograf/mocks/timeseries.go | Connect | func (t *TimeSeries) Connect(ctx context.Context, src *chronograf.Source) error {
return t.ConnectF(ctx, src)
} | go | func (t *TimeSeries) Connect(ctx context.Context, src *chronograf.Source) error {
return t.ConnectF(ctx, src)
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"Connect",
"(",
"ctx",
"context",
".",
"Context",
",",
"src",
"*",
"chronograf",
".",
"Source",
")",
"error",
"{",
"return",
"t",
".",
"ConnectF",
"(",
"ctx",
",",
"src",
")",
"\n",
"}"
] | // Connect will connect to the time series using the information in `Source`. | [
"Connect",
"will",
"connect",
"to",
"the",
"time",
"series",
"using",
"the",
"information",
"in",
"Source",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L33-L35 |
123,702 | influxdata/influxdb | chronograf/mocks/timeseries.go | Query | func (t *TimeSeries) Query(ctx context.Context, query chronograf.Query) (chronograf.Response, error) {
return t.QueryF(ctx, query)
} | go | func (t *TimeSeries) Query(ctx context.Context, query chronograf.Query) (chronograf.Response, error) {
return t.QueryF(ctx, query)
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"Query",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"chronograf",
".",
"Query",
")",
"(",
"chronograf",
".",
"Response",
",",
"error",
")",
"{",
"return",
"t",
".",
"QueryF",
"(",
"ctx",
",",
"query... | // Query retrieves time series data from the database. | [
"Query",
"retrieves",
"time",
"series",
"data",
"from",
"the",
"database",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L38-L40 |
123,703 | influxdata/influxdb | chronograf/mocks/timeseries.go | Write | func (t *TimeSeries) Write(ctx context.Context, points []chronograf.Point) error {
return t.WriteF(ctx, points)
} | go | func (t *TimeSeries) Write(ctx context.Context, points []chronograf.Point) error {
return t.WriteF(ctx, points)
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"Write",
"(",
"ctx",
"context",
".",
"Context",
",",
"points",
"[",
"]",
"chronograf",
".",
"Point",
")",
"error",
"{",
"return",
"t",
".",
"WriteF",
"(",
"ctx",
",",
"points",
")",
"\n",
"}"
] | // Write records a point into the time series | [
"Write",
"records",
"a",
"point",
"into",
"the",
"time",
"series"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L43-L45 |
123,704 | influxdata/influxdb | chronograf/mocks/timeseries.go | Users | func (t *TimeSeries) Users(ctx context.Context) chronograf.UsersStore {
return t.UsersF(ctx)
} | go | func (t *TimeSeries) Users(ctx context.Context) chronograf.UsersStore {
return t.UsersF(ctx)
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"Users",
"(",
"ctx",
"context",
".",
"Context",
")",
"chronograf",
".",
"UsersStore",
"{",
"return",
"t",
".",
"UsersF",
"(",
"ctx",
")",
"\n",
"}"
] | // Users represents the user accounts within the TimeSeries database | [
"Users",
"represents",
"the",
"user",
"accounts",
"within",
"the",
"TimeSeries",
"database"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L48-L50 |
123,705 | influxdata/influxdb | chronograf/mocks/timeseries.go | Roles | func (t *TimeSeries) Roles(ctx context.Context) (chronograf.RolesStore, error) {
return t.RolesF(ctx)
} | go | func (t *TimeSeries) Roles(ctx context.Context) (chronograf.RolesStore, error) {
return t.RolesF(ctx)
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"Roles",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"chronograf",
".",
"RolesStore",
",",
"error",
")",
"{",
"return",
"t",
".",
"RolesF",
"(",
"ctx",
")",
"\n",
"}"
] | // Roles represents the roles. Roles group permissions and Users | [
"Roles",
"represents",
"the",
"roles",
".",
"Roles",
"group",
"permissions",
"and",
"Users"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L53-L55 |
123,706 | influxdata/influxdb | chronograf/mocks/timeseries.go | Permissions | func (t *TimeSeries) Permissions(ctx context.Context) chronograf.Permissions {
return t.PermissionsF(ctx)
} | go | func (t *TimeSeries) Permissions(ctx context.Context) chronograf.Permissions {
return t.PermissionsF(ctx)
} | [
"func",
"(",
"t",
"*",
"TimeSeries",
")",
"Permissions",
"(",
"ctx",
"context",
".",
"Context",
")",
"chronograf",
".",
"Permissions",
"{",
"return",
"t",
".",
"PermissionsF",
"(",
"ctx",
")",
"\n",
"}"
] | // Permissions returns all valid names permissions in this database | [
"Permissions",
"returns",
"all",
"valid",
"names",
"permissions",
"in",
"this",
"database"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/timeseries.go#L58-L60 |
123,707 | influxdata/influxdb | tsdb/tsm1/bool.go | Reset | func (e *BooleanEncoder) Reset() {
e.bytes = e.bytes[:0]
e.b = 0
e.i = 0
e.n = 0
} | go | func (e *BooleanEncoder) Reset() {
e.bytes = e.bytes[:0]
e.b = 0
e.i = 0
e.n = 0
} | [
"func",
"(",
"e",
"*",
"BooleanEncoder",
")",
"Reset",
"(",
")",
"{",
"e",
".",
"bytes",
"=",
"e",
".",
"bytes",
"[",
":",
"0",
"]",
"\n",
"e",
".",
"b",
"=",
"0",
"\n",
"e",
".",
"i",
"=",
"0",
"\n",
"e",
".",
"n",
"=",
"0",
"\n",
"}"
... | // Reset sets the encoder to its initial state. | [
"Reset",
"sets",
"the",
"encoder",
"to",
"its",
"initial",
"state",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bool.go#L40-L45 |
123,708 | influxdata/influxdb | tsdb/tsm1/bool.go | Bytes | func (e *BooleanEncoder) Bytes() ([]byte, error) {
// Ensure the current byte is flushed
e.flush()
b := make([]byte, 10+1)
// Store the encoding type in the 4 high bits of the first byte
b[0] = byte(booleanCompressedBitPacked) << 4
i := 1
// Encode the number of booleans written
i += binary.PutUvarint(b[i:], ... | go | func (e *BooleanEncoder) Bytes() ([]byte, error) {
// Ensure the current byte is flushed
e.flush()
b := make([]byte, 10+1)
// Store the encoding type in the 4 high bits of the first byte
b[0] = byte(booleanCompressedBitPacked) << 4
i := 1
// Encode the number of booleans written
i += binary.PutUvarint(b[i:], ... | [
"func",
"(",
"e",
"*",
"BooleanEncoder",
")",
"Bytes",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Ensure the current byte is flushed",
"e",
".",
"flush",
"(",
")",
"\n",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"10",
"+",
"1... | // Bytes returns a new byte slice containing the encoded booleans from previous calls to Write. | [
"Bytes",
"returns",
"a",
"new",
"byte",
"slice",
"containing",
"the",
"encoded",
"booleans",
"from",
"previous",
"calls",
"to",
"Write",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bool.go#L86-L100 |
123,709 | influxdata/influxdb | tsdb/tsm1/bool.go | SetBytes | func (e *BooleanDecoder) SetBytes(b []byte) {
if len(b) == 0 {
return
}
// First byte stores the encoding type, only have 1 bit-packet format
// currently ignore for now.
b = b[1:]
count, n := binary.Uvarint(b)
if n <= 0 {
e.err = fmt.Errorf("booleanDecoder: invalid count")
return
}
e.b = b[n:]
e.i = ... | go | func (e *BooleanDecoder) SetBytes(b []byte) {
if len(b) == 0 {
return
}
// First byte stores the encoding type, only have 1 bit-packet format
// currently ignore for now.
b = b[1:]
count, n := binary.Uvarint(b)
if n <= 0 {
e.err = fmt.Errorf("booleanDecoder: invalid count")
return
}
e.b = b[n:]
e.i = ... | [
"func",
"(",
"e",
"*",
"BooleanDecoder",
")",
"SetBytes",
"(",
"b",
"[",
"]",
"byte",
")",
"{",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"// First byte stores the encoding type, only have 1 bit-packet format",
"// currently ignore... | // SetBytes initializes the decoder with a new set of bytes to read from.
// This must be called before calling any other methods. | [
"SetBytes",
"initializes",
"the",
"decoder",
"with",
"a",
"new",
"set",
"of",
"bytes",
"to",
"read",
"from",
".",
"This",
"must",
"be",
"called",
"before",
"calling",
"any",
"other",
"methods",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bool.go#L112-L134 |
123,710 | influxdata/influxdb | tsdb/tsm1/bool.go | Next | func (e *BooleanDecoder) Next() bool {
if e.err != nil {
return false
}
e.i++
return e.i < e.n
} | go | func (e *BooleanDecoder) Next() bool {
if e.err != nil {
return false
}
e.i++
return e.i < e.n
} | [
"func",
"(",
"e",
"*",
"BooleanDecoder",
")",
"Next",
"(",
")",
"bool",
"{",
"if",
"e",
".",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"e",
".",
"i",
"++",
"\n",
"return",
"e",
".",
"i",
"<",
"e",
".",
"n",
"\n",
"}"
] | // Next returns whether there are any bits remaining in the decoder.
// It returns false if there was an error decoding.
// The error is available on the Error method. | [
"Next",
"returns",
"whether",
"there",
"are",
"any",
"bits",
"remaining",
"in",
"the",
"decoder",
".",
"It",
"returns",
"false",
"if",
"there",
"was",
"an",
"error",
"decoding",
".",
"The",
"error",
"is",
"available",
"on",
"the",
"Error",
"method",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bool.go#L139-L146 |
123,711 | influxdata/influxdb | tsdb/tsm1/bool.go | Read | func (e *BooleanDecoder) Read() bool {
// Index into the byte slice
idx := e.i >> 3 // integer division by 8
// Bit position
pos := 7 - (e.i & 0x7)
// The mask to select the bit
mask := byte(1 << uint(pos))
// The packed byte
v := e.b[idx]
// Returns true if the bit is set
return v&mask == mask
} | go | func (e *BooleanDecoder) Read() bool {
// Index into the byte slice
idx := e.i >> 3 // integer division by 8
// Bit position
pos := 7 - (e.i & 0x7)
// The mask to select the bit
mask := byte(1 << uint(pos))
// The packed byte
v := e.b[idx]
// Returns true if the bit is set
return v&mask == mask
} | [
"func",
"(",
"e",
"*",
"BooleanDecoder",
")",
"Read",
"(",
")",
"bool",
"{",
"// Index into the byte slice",
"idx",
":=",
"e",
".",
"i",
">>",
"3",
"// integer division by 8",
"\n\n",
"// Bit position",
"pos",
":=",
"7",
"-",
"(",
"e",
".",
"i",
"&",
"0x... | // Read returns the next bit from the decoder. | [
"Read",
"returns",
"the",
"next",
"bit",
"from",
"the",
"decoder",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bool.go#L149-L164 |
123,712 | influxdata/influxdb | http/paging.go | newPagingLinks | func newPagingLinks(basePath string, opts platform.FindOptions, f platform.PagingFilter, num int) *platform.PagingLinks {
u := url.URL{
Path: basePath,
}
values := url.Values{}
for k, vs := range f.QueryParams() {
for _, v := range vs {
if v != "" {
values.Add(k, v)
}
}
}
var self, next, prev st... | go | func newPagingLinks(basePath string, opts platform.FindOptions, f platform.PagingFilter, num int) *platform.PagingLinks {
u := url.URL{
Path: basePath,
}
values := url.Values{}
for k, vs := range f.QueryParams() {
for _, v := range vs {
if v != "" {
values.Add(k, v)
}
}
}
var self, next, prev st... | [
"func",
"newPagingLinks",
"(",
"basePath",
"string",
",",
"opts",
"platform",
".",
"FindOptions",
",",
"f",
"platform",
".",
"PagingFilter",
",",
"num",
"int",
")",
"*",
"platform",
".",
"PagingLinks",
"{",
"u",
":=",
"url",
".",
"URL",
"{",
"Path",
":",... | // newPagingLinks returns a PagingLinks.
// num is the number of returned results. | [
"newPagingLinks",
"returns",
"a",
"PagingLinks",
".",
"num",
"is",
"the",
"number",
"of",
"returned",
"results",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/paging.go#L63-L113 |
123,713 | influxdata/influxdb | kv/document.go | CreateDocumentStore | func (s *Service) CreateDocumentStore(ctx context.Context, ns string) (influxdb.DocumentStore, error) {
// TODO(desa): keep track of which namespaces exist.
var ds influxdb.DocumentStore
err := s.kv.Update(ctx, func(tx Tx) error {
store, err := s.createDocumentStore(ctx, tx, ns)
if err != nil {
return err
... | go | func (s *Service) CreateDocumentStore(ctx context.Context, ns string) (influxdb.DocumentStore, error) {
// TODO(desa): keep track of which namespaces exist.
var ds influxdb.DocumentStore
err := s.kv.Update(ctx, func(tx Tx) error {
store, err := s.createDocumentStore(ctx, tx, ns)
if err != nil {
return err
... | [
"func",
"(",
"s",
"*",
"Service",
")",
"CreateDocumentStore",
"(",
"ctx",
"context",
".",
"Context",
",",
"ns",
"string",
")",
"(",
"influxdb",
".",
"DocumentStore",
",",
"error",
")",
"{",
"// TODO(desa): keep track of which namespaces exist.",
"var",
"ds",
"in... | // CreateDocumentStore creates an instance of a document store by instantiating the buckets for the store. | [
"CreateDocumentStore",
"creates",
"an",
"instance",
"of",
"a",
"document",
"store",
"by",
"instantiating",
"the",
"buckets",
"for",
"the",
"store",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L26-L45 |
123,714 | influxdata/influxdb | kv/document.go | AddDocumentLabel | func (i *DocumentIndex) AddDocumentLabel(docID, labelID influxdb.ID) error {
m := &influxdb.LabelMapping{
LabelID: labelID,
ResourceType: influxdb.DocumentsResourceType,
ResourceID: docID,
}
if err := i.service.createLabelMapping(i.ctx, i.tx, m); err != nil {
return err
}
return nil
} | go | func (i *DocumentIndex) AddDocumentLabel(docID, labelID influxdb.ID) error {
m := &influxdb.LabelMapping{
LabelID: labelID,
ResourceType: influxdb.DocumentsResourceType,
ResourceID: docID,
}
if err := i.service.createLabelMapping(i.ctx, i.tx, m); err != nil {
return err
}
return nil
} | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"AddDocumentLabel",
"(",
"docID",
",",
"labelID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"m",
":=",
"&",
"influxdb",
".",
"LabelMapping",
"{",
"LabelID",
":",
"labelID",
",",
"ResourceType",
":",
"influxdb",
... | // AddDocumentLabel creates a label mapping for the label provided. | [
"AddDocumentLabel",
"creates",
"a",
"label",
"mapping",
"for",
"the",
"label",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L133-L144 |
123,715 | influxdata/influxdb | kv/document.go | FindLabelByID | func (i *DocumentIndex) FindLabelByID(id influxdb.ID) error {
_, err := i.service.findLabelByID(i.ctx, i.tx, id)
return err
} | go | func (i *DocumentIndex) FindLabelByID(id influxdb.ID) error {
_, err := i.service.findLabelByID(i.ctx, i.tx, id)
return err
} | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"FindLabelByID",
"(",
"id",
"influxdb",
".",
"ID",
")",
"error",
"{",
"_",
",",
"err",
":=",
"i",
".",
"service",
".",
"findLabelByID",
"(",
"i",
".",
"ctx",
",",
"i",
".",
"tx",
",",
"id",
")",
"\n",
... | // FindLabelByID retrieves a label by id. | [
"FindLabelByID",
"retrieves",
"a",
"label",
"by",
"id",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L161-L164 |
123,716 | influxdata/influxdb | kv/document.go | AddDocumentOwner | func (i *DocumentIndex) AddDocumentOwner(id influxdb.ID, ownerType string, ownerID influxdb.ID) error {
if err := i.ownerExists(ownerType, ownerID); err != nil {
return err
}
// TODO(desa): support users owning resources.
m := &influxdb.UserResourceMapping{
UserID: ownerID,
UserType: influxdb.Owner,
// ... | go | func (i *DocumentIndex) AddDocumentOwner(id influxdb.ID, ownerType string, ownerID influxdb.ID) error {
if err := i.ownerExists(ownerType, ownerID); err != nil {
return err
}
// TODO(desa): support users owning resources.
m := &influxdb.UserResourceMapping{
UserID: ownerID,
UserType: influxdb.Owner,
// ... | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"AddDocumentOwner",
"(",
"id",
"influxdb",
".",
"ID",
",",
"ownerType",
"string",
",",
"ownerID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"if",
"err",
":=",
"i",
".",
"ownerExists",
"(",
"ownerType",
",",
... | // AddDocumentOwner creates a urm for the document id and owner id provided. | [
"AddDocumentOwner",
"creates",
"a",
"urm",
"for",
"the",
"document",
"id",
"and",
"owner",
"id",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L167-L183 |
123,717 | influxdata/influxdb | kv/document.go | RemoveDocumentOwner | func (i *DocumentIndex) RemoveDocumentOwner(id influxdb.ID, ownerType string, ownerID influxdb.ID) error {
return i.service.removeDocumentOwner(i.ctx, i.tx, ownerID, id)
} | go | func (i *DocumentIndex) RemoveDocumentOwner(id influxdb.ID, ownerType string, ownerID influxdb.ID) error {
return i.service.removeDocumentOwner(i.ctx, i.tx, ownerID, id)
} | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"RemoveDocumentOwner",
"(",
"id",
"influxdb",
".",
"ID",
",",
"ownerType",
"string",
",",
"ownerID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"return",
"i",
".",
"service",
".",
"removeDocumentOwner",
"(",
"i",... | // RemoveDocumentOwner deletes the urm for the document id and owner id provided. | [
"RemoveDocumentOwner",
"deletes",
"the",
"urm",
"for",
"the",
"document",
"id",
"and",
"owner",
"id",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L186-L188 |
123,718 | influxdata/influxdb | kv/document.go | WithoutOwners | func WithoutOwners(id influxdb.ID, idx influxdb.DocumentIndex) error {
ownerIDs, err := idx.GetDocumentsAccessors(id)
if err != nil {
return err
}
for _, ownerID := range ownerIDs {
if err := idx.RemoveDocumentOwner(id, "org", ownerID); err != nil {
return err
}
}
return nil
} | go | func WithoutOwners(id influxdb.ID, idx influxdb.DocumentIndex) error {
ownerIDs, err := idx.GetDocumentsAccessors(id)
if err != nil {
return err
}
for _, ownerID := range ownerIDs {
if err := idx.RemoveDocumentOwner(id, "org", ownerID); err != nil {
return err
}
}
return nil
} | [
"func",
"WithoutOwners",
"(",
"id",
"influxdb",
".",
"ID",
",",
"idx",
"influxdb",
".",
"DocumentIndex",
")",
"error",
"{",
"ownerIDs",
",",
"err",
":=",
"idx",
".",
"GetDocumentsAccessors",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // WithoutOwners removes all owners from a document. In particular it is used to cleanup urms on document delete. | [
"WithoutOwners",
"removes",
"all",
"owners",
"from",
"a",
"document",
".",
"In",
"particular",
"it",
"is",
"used",
"to",
"cleanup",
"urms",
"on",
"document",
"delete",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L191-L204 |
123,719 | influxdata/influxdb | kv/document.go | UsersOrgs | func (i *DocumentIndex) UsersOrgs(userID influxdb.ID) ([]influxdb.ID, error) {
f := influxdb.UserResourceMappingFilter{
UserID: userID,
ResourceType: influxdb.OrgsResourceType,
}
ms, err := i.service.findUserResourceMappings(i.ctx, i.tx, f)
if err != nil {
return nil, err
}
ids := make([]influxdb.ID... | go | func (i *DocumentIndex) UsersOrgs(userID influxdb.ID) ([]influxdb.ID, error) {
f := influxdb.UserResourceMappingFilter{
UserID: userID,
ResourceType: influxdb.OrgsResourceType,
}
ms, err := i.service.findUserResourceMappings(i.ctx, i.tx, f)
if err != nil {
return nil, err
}
ids := make([]influxdb.ID... | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"UsersOrgs",
"(",
"userID",
"influxdb",
".",
"ID",
")",
"(",
"[",
"]",
"influxdb",
".",
"ID",
",",
"error",
")",
"{",
"f",
":=",
"influxdb",
".",
"UserResourceMappingFilter",
"{",
"UserID",
":",
"userID",
",... | // UsersOrgs retrieves a list of all orgs that a user is an accessor of. | [
"UsersOrgs",
"retrieves",
"a",
"list",
"of",
"all",
"orgs",
"that",
"a",
"user",
"is",
"an",
"accessor",
"of",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L207-L224 |
123,720 | influxdata/influxdb | kv/document.go | IsOrgAccessor | func (i *DocumentIndex) IsOrgAccessor(userID influxdb.ID, orgID influxdb.ID) error {
f := influxdb.UserResourceMappingFilter{
UserID: userID,
ResourceType: influxdb.OrgsResourceType,
ResourceID: orgID,
}
if i.writable {
f.UserType = influxdb.Owner
}
ms, err := i.service.findUserResourceMappings(i... | go | func (i *DocumentIndex) IsOrgAccessor(userID influxdb.ID, orgID influxdb.ID) error {
f := influxdb.UserResourceMappingFilter{
UserID: userID,
ResourceType: influxdb.OrgsResourceType,
ResourceID: orgID,
}
if i.writable {
f.UserType = influxdb.Owner
}
ms, err := i.service.findUserResourceMappings(i... | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"IsOrgAccessor",
"(",
"userID",
"influxdb",
".",
"ID",
",",
"orgID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"f",
":=",
"influxdb",
".",
"UserResourceMappingFilter",
"{",
"UserID",
":",
"userID",
",",
"Resourc... | // IsOrgAccessor checks to see if the user is an accessor of the org provided. If the operation
// is writable it ensures that the user is owner. | [
"IsOrgAccessor",
"checks",
"to",
"see",
"if",
"the",
"user",
"is",
"an",
"accessor",
"of",
"the",
"org",
"provided",
".",
"If",
"the",
"operation",
"is",
"writable",
"it",
"ensures",
"that",
"the",
"user",
"is",
"owner",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L228-L257 |
123,721 | influxdata/influxdb | kv/document.go | FindOrganizationByName | func (i *DocumentIndex) FindOrganizationByName(org string) (influxdb.ID, error) {
o, err := i.service.findOrganizationByName(i.ctx, i.tx, org)
if err != nil {
return influxdb.InvalidID(), err
}
return o.ID, nil
} | go | func (i *DocumentIndex) FindOrganizationByName(org string) (influxdb.ID, error) {
o, err := i.service.findOrganizationByName(i.ctx, i.tx, org)
if err != nil {
return influxdb.InvalidID(), err
}
return o.ID, nil
} | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"FindOrganizationByName",
"(",
"org",
"string",
")",
"(",
"influxdb",
".",
"ID",
",",
"error",
")",
"{",
"o",
",",
"err",
":=",
"i",
".",
"service",
".",
"findOrganizationByName",
"(",
"i",
".",
"ctx",
",",
... | // FindOrganizationByName retrieves the organization ID of the org provided. | [
"FindOrganizationByName",
"retrieves",
"the",
"organization",
"ID",
"of",
"the",
"org",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L280-L286 |
123,722 | influxdata/influxdb | kv/document.go | FindOrganizationByID | func (i *DocumentIndex) FindOrganizationByID(id influxdb.ID) error {
_, err := i.service.findOrganizationByID(i.ctx, i.tx, id)
if err != nil {
return err
}
return nil
} | go | func (i *DocumentIndex) FindOrganizationByID(id influxdb.ID) error {
_, err := i.service.findOrganizationByID(i.ctx, i.tx, id)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"FindOrganizationByID",
"(",
"id",
"influxdb",
".",
"ID",
")",
"error",
"{",
"_",
",",
"err",
":=",
"i",
".",
"service",
".",
"findOrganizationByID",
"(",
"i",
".",
"ctx",
",",
"i",
".",
"tx",
",",
"id",
... | // FindOrganizationByID checks if the org existence by the org id provided. | [
"FindOrganizationByID",
"checks",
"if",
"the",
"org",
"existence",
"by",
"the",
"org",
"id",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L289-L295 |
123,723 | influxdata/influxdb | kv/document.go | GetDocumentsAccessors | func (i *DocumentIndex) GetDocumentsAccessors(docID influxdb.ID) ([]influxdb.ID, error) {
f := influxdb.UserResourceMappingFilter{
ResourceType: influxdb.DocumentsResourceType,
ResourceID: docID,
}
if i.writable {
f.UserType = influxdb.Owner
}
ms, err := i.service.findUserResourceMappings(i.ctx, i.tx, f)
... | go | func (i *DocumentIndex) GetDocumentsAccessors(docID influxdb.ID) ([]influxdb.ID, error) {
f := influxdb.UserResourceMappingFilter{
ResourceType: influxdb.DocumentsResourceType,
ResourceID: docID,
}
if i.writable {
f.UserType = influxdb.Owner
}
ms, err := i.service.findUserResourceMappings(i.ctx, i.tx, f)
... | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"GetDocumentsAccessors",
"(",
"docID",
"influxdb",
".",
"ID",
")",
"(",
"[",
"]",
"influxdb",
".",
"ID",
",",
"error",
")",
"{",
"f",
":=",
"influxdb",
".",
"UserResourceMappingFilter",
"{",
"ResourceType",
":",... | // GetDocumentsAccessors retrieves the list of accessors of a document. | [
"GetDocumentsAccessors",
"retrieves",
"the",
"list",
"of",
"accessors",
"of",
"a",
"document",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L298-L321 |
123,724 | influxdata/influxdb | kv/document.go | GetAccessorsDocuments | func (i *DocumentIndex) GetAccessorsDocuments(ownerType string, ownerID influxdb.ID) ([]influxdb.ID, error) {
if err := i.ownerExists(ownerType, ownerID); err != nil {
return nil, err
}
f := influxdb.UserResourceMappingFilter{
UserID: ownerID,
ResourceType: influxdb.DocumentsResourceType,
}
if i.writa... | go | func (i *DocumentIndex) GetAccessorsDocuments(ownerType string, ownerID influxdb.ID) ([]influxdb.ID, error) {
if err := i.ownerExists(ownerType, ownerID); err != nil {
return nil, err
}
f := influxdb.UserResourceMappingFilter{
UserID: ownerID,
ResourceType: influxdb.DocumentsResourceType,
}
if i.writa... | [
"func",
"(",
"i",
"*",
"DocumentIndex",
")",
"GetAccessorsDocuments",
"(",
"ownerType",
"string",
",",
"ownerID",
"influxdb",
".",
"ID",
")",
"(",
"[",
"]",
"influxdb",
".",
"ID",
",",
"error",
")",
"{",
"if",
"err",
":=",
"i",
".",
"ownerExists",
"(",... | // GetAccessorsDocuments retrieves the list of documents a user is allowed to access. | [
"GetAccessorsDocuments",
"retrieves",
"the",
"list",
"of",
"documents",
"a",
"user",
"is",
"allowed",
"to",
"access",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L324-L347 |
123,725 | influxdata/influxdb | kv/document.go | IncludeContent | func (d *DocumentDecorator) IncludeContent() error {
if d.writable {
return &influxdb.Error{
Code: influxdb.EInternal,
Msg: "cannot include data in document",
}
}
d.data = true
return nil
} | go | func (d *DocumentDecorator) IncludeContent() error {
if d.writable {
return &influxdb.Error{
Code: influxdb.EInternal,
Msg: "cannot include data in document",
}
}
d.data = true
return nil
} | [
"func",
"(",
"d",
"*",
"DocumentDecorator",
")",
"IncludeContent",
"(",
")",
"error",
"{",
"if",
"d",
".",
"writable",
"{",
"return",
"&",
"influxdb",
".",
"Error",
"{",
"Code",
":",
"influxdb",
".",
"EInternal",
",",
"Msg",
":",
"\"",
"\"",
",",
"}"... | // IncludeContent signals that the document should include its content when returned. | [
"IncludeContent",
"signals",
"that",
"the",
"document",
"should",
"include",
"its",
"content",
"when",
"returned",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L490-L501 |
123,726 | influxdata/influxdb | kv/document.go | IncludeLabels | func (d *DocumentDecorator) IncludeLabels() error {
if d.writable {
return &influxdb.Error{
Code: influxdb.EInternal,
Msg: "cannot include labels in document",
}
}
d.labels = true
return nil
} | go | func (d *DocumentDecorator) IncludeLabels() error {
if d.writable {
return &influxdb.Error{
Code: influxdb.EInternal,
Msg: "cannot include labels in document",
}
}
d.labels = true
return nil
} | [
"func",
"(",
"d",
"*",
"DocumentDecorator",
")",
"IncludeLabels",
"(",
")",
"error",
"{",
"if",
"d",
".",
"writable",
"{",
"return",
"&",
"influxdb",
".",
"Error",
"{",
"Code",
":",
"influxdb",
".",
"EInternal",
",",
"Msg",
":",
"\"",
"\"",
",",
"}",... | // IncludeLabels signals that the document should include its labels when returned. | [
"IncludeLabels",
"signals",
"that",
"the",
"document",
"should",
"include",
"its",
"labels",
"when",
"returned",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L504-L515 |
123,727 | influxdata/influxdb | kv/document.go | FindDocuments | func (s *DocumentStore) FindDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) ([]*influxdb.Document, error) {
var ds []*influxdb.Document
err := s.service.kv.View(ctx, func(tx Tx) error {
if len(opts) == 0 {
// TODO(desa): might be a better way to do get all.
if err := s.service.findDocumen... | go | func (s *DocumentStore) FindDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) ([]*influxdb.Document, error) {
var ds []*influxdb.Document
err := s.service.kv.View(ctx, func(tx Tx) error {
if len(opts) == 0 {
// TODO(desa): might be a better way to do get all.
if err := s.service.findDocumen... | [
"func",
"(",
"s",
"*",
"DocumentStore",
")",
"FindDocuments",
"(",
"ctx",
"context",
".",
"Context",
",",
"opts",
"...",
"influxdb",
".",
"DocumentFindOptions",
")",
"(",
"[",
"]",
"*",
"influxdb",
".",
"Document",
",",
"error",
")",
"{",
"var",
"ds",
... | // FindDocuments retrieves all documenst returned by the document find options. | [
"FindDocuments",
"retrieves",
"all",
"documenst",
"returned",
"by",
"the",
"document",
"find",
"options",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L518-L588 |
123,728 | influxdata/influxdb | kv/document.go | DeleteDocuments | func (s *DocumentStore) DeleteDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) error {
return s.service.kv.Update(ctx, func(tx Tx) error {
idx := &DocumentIndex{
service: s.service,
tx: tx,
ctx: ctx,
writable: true,
}
dd := &DocumentDecorator{writable: true}
ids := ... | go | func (s *DocumentStore) DeleteDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) error {
return s.service.kv.Update(ctx, func(tx Tx) error {
idx := &DocumentIndex{
service: s.service,
tx: tx,
ctx: ctx,
writable: true,
}
dd := &DocumentDecorator{writable: true}
ids := ... | [
"func",
"(",
"s",
"*",
"DocumentStore",
")",
"DeleteDocuments",
"(",
"ctx",
"context",
".",
"Context",
",",
"opts",
"...",
"influxdb",
".",
"DocumentFindOptions",
")",
"error",
"{",
"return",
"s",
".",
"service",
".",
"kv",
".",
"Update",
"(",
"ctx",
","... | // DeleteDocuments removes all documents returned by the options. | [
"DeleteDocuments",
"removes",
"all",
"documents",
"returned",
"by",
"the",
"options",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L618-L650 |
123,729 | influxdata/influxdb | kv/document.go | UpdateDocument | func (s *DocumentStore) UpdateDocument(ctx context.Context, d *influxdb.Document, opts ...influxdb.DocumentOptions) error {
return s.service.kv.Update(ctx, func(tx Tx) error {
idx := &DocumentIndex{
service: s.service,
tx: tx,
ctx: ctx,
writable: true,
}
for _, opt := range opts {
if e... | go | func (s *DocumentStore) UpdateDocument(ctx context.Context, d *influxdb.Document, opts ...influxdb.DocumentOptions) error {
return s.service.kv.Update(ctx, func(tx Tx) error {
idx := &DocumentIndex{
service: s.service,
tx: tx,
ctx: ctx,
writable: true,
}
for _, opt := range opts {
if e... | [
"func",
"(",
"s",
"*",
"DocumentStore",
")",
"UpdateDocument",
"(",
"ctx",
"context",
".",
"Context",
",",
"d",
"*",
"influxdb",
".",
"Document",
",",
"opts",
"...",
"influxdb",
".",
"DocumentOptions",
")",
"error",
"{",
"return",
"s",
".",
"service",
".... | // UpdateDocument updates the document. | [
"UpdateDocument",
"updates",
"the",
"document",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/document.go#L710-L734 |
123,730 | influxdata/influxdb | storage/reads/merge.go | NewSequenceResultSet | func NewSequenceResultSet(results []ResultSet) ResultSet {
if len(results) == 0 {
return nil
} else if len(results) == 1 {
return results[0]
}
rs := &sequenceResultSet{items: results}
rs.pop()
return rs
} | go | func NewSequenceResultSet(results []ResultSet) ResultSet {
if len(results) == 0 {
return nil
} else if len(results) == 1 {
return results[0]
}
rs := &sequenceResultSet{items: results}
rs.pop()
return rs
} | [
"func",
"NewSequenceResultSet",
"(",
"results",
"[",
"]",
"ResultSet",
")",
"ResultSet",
"{",
"if",
"len",
"(",
"results",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"else",
"if",
"len",
"(",
"results",
")",
"==",
"1",
"{",
"return",
"results",
... | // NewSequenceResultSet combines results into a single ResultSet,
// draining each ResultSet in order before moving to the next. | [
"NewSequenceResultSet",
"combines",
"results",
"into",
"a",
"single",
"ResultSet",
"draining",
"each",
"ResultSet",
"in",
"order",
"before",
"moving",
"to",
"the",
"next",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/reads/merge.go#L19-L29 |
123,731 | influxdata/influxdb | storage/reads/merge.go | NewMergedResultSet | func NewMergedResultSet(results []ResultSet) ResultSet {
if len(results) == 0 {
return nil
} else if len(results) == 1 {
return results[0]
}
mrs := &mergedResultSet{first: true}
mrs.heap.init(results)
return mrs
} | go | func NewMergedResultSet(results []ResultSet) ResultSet {
if len(results) == 0 {
return nil
} else if len(results) == 1 {
return results[0]
}
mrs := &mergedResultSet{first: true}
mrs.heap.init(results)
return mrs
} | [
"func",
"NewMergedResultSet",
"(",
"results",
"[",
"]",
"ResultSet",
")",
"ResultSet",
"{",
"if",
"len",
"(",
"results",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"else",
"if",
"len",
"(",
"results",
")",
"==",
"1",
"{",
"return",
"results",
"... | // NewMergedResultSet combines the results into a single ResultSet,
// producing keys in ascending lexicographical order. It requires
// all input results are ordered. | [
"NewMergedResultSet",
"combines",
"the",
"results",
"into",
"a",
"single",
"ResultSet",
"producing",
"keys",
"in",
"ascending",
"lexicographical",
"order",
".",
"It",
"requires",
"all",
"input",
"results",
"are",
"ordered",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/storage/reads/merge.go#L108-L118 |
123,732 | influxdata/influxdb | task/backend/store.go | validate | func (s TaskStatus) validate(allowEmpty bool) error {
if allowEmpty && s == "" {
return nil
}
if s == TaskActive || s == TaskInactive {
return nil
}
return fmt.Errorf("invalid task status: %q", s)
} | go | func (s TaskStatus) validate(allowEmpty bool) error {
if allowEmpty && s == "" {
return nil
}
if s == TaskActive || s == TaskInactive {
return nil
}
return fmt.Errorf("invalid task status: %q", s)
} | [
"func",
"(",
"s",
"TaskStatus",
")",
"validate",
"(",
"allowEmpty",
"bool",
")",
"error",
"{",
"if",
"allowEmpty",
"&&",
"s",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"s",
"==",
"TaskActive",
"||",
"s",
"==",
"TaskInactive",
"... | // validate returns an error if s is not a known task status. | [
"validate",
"returns",
"an",
"error",
"if",
"s",
"is",
"not",
"a",
"known",
"task",
"status",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/store.go#L48-L58 |
123,733 | influxdata/influxdb | task/backend/store.go | ParseRequestStillQueuedError | func ParseRequestStillQueuedError(msg string) *RequestStillQueuedError {
var s, e string
n, err := fmt.Sscanf(msg, fmtRequestStillQueued, &s, &e)
if err != nil || n != 2 {
return nil
}
start, err := time.Parse(time.RFC3339, s)
if err != nil {
return nil
}
end, err := time.Parse(time.RFC3339, e)
if err !=... | go | func ParseRequestStillQueuedError(msg string) *RequestStillQueuedError {
var s, e string
n, err := fmt.Sscanf(msg, fmtRequestStillQueued, &s, &e)
if err != nil || n != 2 {
return nil
}
start, err := time.Parse(time.RFC3339, s)
if err != nil {
return nil
}
end, err := time.Parse(time.RFC3339, e)
if err !=... | [
"func",
"ParseRequestStillQueuedError",
"(",
"msg",
"string",
")",
"*",
"RequestStillQueuedError",
"{",
"var",
"s",
",",
"e",
"string",
"\n",
"n",
",",
"err",
":=",
"fmt",
".",
"Sscanf",
"(",
"msg",
",",
"fmtRequestStillQueued",
",",
"&",
"s",
",",
"&",
... | // ParseRequestStillQueuedError attempts to parse a RequestStillQueuedError from msg.
// If msg is formatted correctly, the resultant error is returned; otherwise it returns nil. | [
"ParseRequestStillQueuedError",
"attempts",
"to",
"parse",
"a",
"RequestStillQueuedError",
"from",
"msg",
".",
"If",
"msg",
"is",
"formatted",
"correctly",
"the",
"resultant",
"error",
"is",
"returned",
";",
"otherwise",
"it",
"returns",
"nil",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/store.go#L113-L131 |
123,734 | influxdata/influxdb | models/inline_fnv.go | Write | func (s *InlineFNV64a) Write(data []byte) (int, error) {
hash := uint64(*s)
for _, c := range data {
hash ^= uint64(c)
hash *= prime64
}
*s = InlineFNV64a(hash)
return len(data), nil
} | go | func (s *InlineFNV64a) Write(data []byte) (int, error) {
hash := uint64(*s)
for _, c := range data {
hash ^= uint64(c)
hash *= prime64
}
*s = InlineFNV64a(hash)
return len(data), nil
} | [
"func",
"(",
"s",
"*",
"InlineFNV64a",
")",
"Write",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"hash",
":=",
"uint64",
"(",
"*",
"s",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"data",
"{",
"hash",
"^=",
"ui... | // Write adds data to the running hash. | [
"Write",
"adds",
"data",
"to",
"the",
"running",
"hash",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/models/inline_fnv.go#L19-L27 |
123,735 | influxdata/influxdb | chronograf/filestore/templates.go | templated | func templated(data interface{}, filenames ...string) ([]byte, error) {
t, err := template.ParseFiles(filenames...)
if err != nil {
return nil, err
}
var b bytes.Buffer
// If a key in the file exists but is not in the data we
// immediately fail with a missing key error
err = t.Option("missingkey=error").Execu... | go | func templated(data interface{}, filenames ...string) ([]byte, error) {
t, err := template.ParseFiles(filenames...)
if err != nil {
return nil, err
}
var b bytes.Buffer
// If a key in the file exists but is not in the data we
// immediately fail with a missing key error
err = t.Option("missingkey=error").Execu... | [
"func",
"templated",
"(",
"data",
"interface",
"{",
"}",
",",
"filenames",
"...",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"t",
",",
"err",
":=",
"template",
".",
"ParseFiles",
"(",
"filenames",
"...",
")",
"\n",
"if",
"err",
"... | // templated returns all files templated using data | [
"templated",
"returns",
"all",
"files",
"templated",
"using",
"data"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/filestore/templates.go#L9-L23 |
123,736 | influxdata/influxdb | chronograf/multistore/dashboards.go | All | func (multi *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error) {
all := []chronograf.Dashboard{}
boardSet := map[chronograf.DashboardID]struct{}{}
ok := false
var err error
for _, store := range multi.Stores {
var boards []chronograf.Dashboard
boards, err = store.All(ctx)
if err != n... | go | func (multi *DashboardsStore) All(ctx context.Context) ([]chronograf.Dashboard, error) {
all := []chronograf.Dashboard{}
boardSet := map[chronograf.DashboardID]struct{}{}
ok := false
var err error
for _, store := range multi.Stores {
var boards []chronograf.Dashboard
boards, err = store.All(ctx)
if err != n... | [
"func",
"(",
"multi",
"*",
"DashboardsStore",
")",
"All",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"chronograf",
".",
"Dashboard",
",",
"error",
")",
"{",
"all",
":=",
"[",
"]",
"chronograf",
".",
"Dashboard",
"{",
"}",
"\n",
"board... | // All concatenates the Dashboards of all contained Stores | [
"All",
"concatenates",
"the",
"Dashboards",
"of",
"all",
"contained",
"Stores"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/dashboards.go#L19-L47 |
123,737 | influxdata/influxdb | chronograf/multistore/dashboards.go | Add | func (multi *DashboardsStore) Add(ctx context.Context, dashboard chronograf.Dashboard) (chronograf.Dashboard, error) {
var err error
for _, store := range multi.Stores {
var d chronograf.Dashboard
d, err = store.Add(ctx, dashboard)
if err == nil {
return d, nil
}
}
return chronograf.Dashboard{}, nil
} | go | func (multi *DashboardsStore) Add(ctx context.Context, dashboard chronograf.Dashboard) (chronograf.Dashboard, error) {
var err error
for _, store := range multi.Stores {
var d chronograf.Dashboard
d, err = store.Add(ctx, dashboard)
if err == nil {
return d, nil
}
}
return chronograf.Dashboard{}, nil
} | [
"func",
"(",
"multi",
"*",
"DashboardsStore",
")",
"Add",
"(",
"ctx",
"context",
".",
"Context",
",",
"dashboard",
"chronograf",
".",
"Dashboard",
")",
"(",
"chronograf",
".",
"Dashboard",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"for",
"_",
... | // Add the dashboard to the first responsive Store | [
"Add",
"the",
"dashboard",
"to",
"the",
"first",
"responsive",
"Store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/dashboards.go#L50-L60 |
123,738 | influxdata/influxdb | chronograf/multistore/dashboards.go | Get | func (multi *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error) {
var err error
for _, store := range multi.Stores {
var d chronograf.Dashboard
d, err = store.Get(ctx, id)
if err == nil {
return d, nil
}
}
return chronograf.Dashboard{}, nil
} | go | func (multi *DashboardsStore) Get(ctx context.Context, id chronograf.DashboardID) (chronograf.Dashboard, error) {
var err error
for _, store := range multi.Stores {
var d chronograf.Dashboard
d, err = store.Get(ctx, id)
if err == nil {
return d, nil
}
}
return chronograf.Dashboard{}, nil
} | [
"func",
"(",
"multi",
"*",
"DashboardsStore",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"chronograf",
".",
"DashboardID",
")",
"(",
"chronograf",
".",
"Dashboard",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"for",
"_",
","... | // Get finds the Dashboard by id among all contained Stores | [
"Get",
"finds",
"the",
"Dashboard",
"by",
"id",
"among",
"all",
"contained",
"Stores"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/multistore/dashboards.go#L75-L85 |
123,739 | influxdata/influxdb | tsdb/tsm1/bit_reader.go | NewBitReader | func NewBitReader(data []byte) *BitReader {
b := new(BitReader)
b.Reset(data)
return b
} | go | func NewBitReader(data []byte) *BitReader {
b := new(BitReader)
b.Reset(data)
return b
} | [
"func",
"NewBitReader",
"(",
"data",
"[",
"]",
"byte",
")",
"*",
"BitReader",
"{",
"b",
":=",
"new",
"(",
"BitReader",
")",
"\n",
"b",
".",
"Reset",
"(",
"data",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // NewBitReader returns a new instance of BitReader that reads from data. | [
"NewBitReader",
"returns",
"a",
"new",
"instance",
"of",
"BitReader",
"that",
"reads",
"from",
"data",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bit_reader.go#L16-L20 |
123,740 | influxdata/influxdb | tsdb/tsm1/bit_reader.go | Reset | func (r *BitReader) Reset(data []byte) {
r.data = data
r.buf.v, r.buf.n = 0, 0
r.readBuf()
} | go | func (r *BitReader) Reset(data []byte) {
r.data = data
r.buf.v, r.buf.n = 0, 0
r.readBuf()
} | [
"func",
"(",
"r",
"*",
"BitReader",
")",
"Reset",
"(",
"data",
"[",
"]",
"byte",
")",
"{",
"r",
".",
"data",
"=",
"data",
"\n",
"r",
".",
"buf",
".",
"v",
",",
"r",
".",
"buf",
".",
"n",
"=",
"0",
",",
"0",
"\n",
"r",
".",
"readBuf",
"(",... | // Reset sets the underlying reader on b and reinitializes. | [
"Reset",
"sets",
"the",
"underlying",
"reader",
"on",
"b",
"and",
"reinitializes",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bit_reader.go#L23-L27 |
123,741 | influxdata/influxdb | tsdb/tsm1/bit_reader.go | ReadBit | func (r *BitReader) ReadBit() (bool, error) {
v, err := r.ReadBits(1)
return v != 0, err
} | go | func (r *BitReader) ReadBit() (bool, error) {
v, err := r.ReadBits(1)
return v != 0, err
} | [
"func",
"(",
"r",
"*",
"BitReader",
")",
"ReadBit",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"v",
",",
"err",
":=",
"r",
".",
"ReadBits",
"(",
"1",
")",
"\n",
"return",
"v",
"!=",
"0",
",",
"err",
"\n",
"}"
] | // ReadBit returns the next bit from the underlying data. | [
"ReadBit",
"returns",
"the",
"next",
"bit",
"from",
"the",
"underlying",
"data",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bit_reader.go#L45-L48 |
123,742 | influxdata/influxdb | tsdb/tsm1/bit_reader.go | ReadBits | func (r *BitReader) ReadBits(nbits uint) (uint64, error) {
// Return EOF if there is no more data.
if r.buf.n == 0 {
return 0, io.EOF
}
// Return bits from buffer if less than available bits.
if nbits <= r.buf.n {
// Return all bits, if requested.
if nbits == 64 {
v := r.buf.v
r.buf.v, r.buf.n = 0, 0
... | go | func (r *BitReader) ReadBits(nbits uint) (uint64, error) {
// Return EOF if there is no more data.
if r.buf.n == 0 {
return 0, io.EOF
}
// Return bits from buffer if less than available bits.
if nbits <= r.buf.n {
// Return all bits, if requested.
if nbits == 64 {
v := r.buf.v
r.buf.v, r.buf.n = 0, 0
... | [
"func",
"(",
"r",
"*",
"BitReader",
")",
"ReadBits",
"(",
"nbits",
"uint",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"// Return EOF if there is no more data.",
"if",
"r",
".",
"buf",
".",
"n",
"==",
"0",
"{",
"return",
"0",
",",
"io",
".",
"EOF",
"... | // ReadBits reads nbits from the underlying data into a uint64.
// nbits must be from 1 to 64, inclusive. | [
"ReadBits",
"reads",
"nbits",
"from",
"the",
"underlying",
"data",
"into",
"a",
"uint64",
".",
"nbits",
"must",
"be",
"from",
"1",
"to",
"64",
"inclusive",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/bit_reader.go#L52-L103 |
123,743 | influxdata/influxdb | errors.go | NewError | func NewError(options ...func(*Error)) *Error {
err := &Error{}
for _, o := range options {
o(err)
}
return err
} | go | func NewError(options ...func(*Error)) *Error {
err := &Error{}
for _, o := range options {
o(err)
}
return err
} | [
"func",
"NewError",
"(",
"options",
"...",
"func",
"(",
"*",
"Error",
")",
")",
"*",
"Error",
"{",
"err",
":=",
"&",
"Error",
"{",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"options",
"{",
"o",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return"... | // NewError returns an instance of an error. | [
"NewError",
"returns",
"an",
"instance",
"of",
"an",
"error",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L64-L71 |
123,744 | influxdata/influxdb | errors.go | Error | func (e *Error) Error() string {
var b strings.Builder
// Print the current operation in our stack, if any.
if e.Op != "" {
fmt.Fprintf(&b, "%s: ", e.Op)
}
// If wrapping an error, print its Error() message.
// Otherwise print the error code & message.
if e.Err != nil {
b.WriteString(e.Err.Error())
} else... | go | func (e *Error) Error() string {
var b strings.Builder
// Print the current operation in our stack, if any.
if e.Op != "" {
fmt.Fprintf(&b, "%s: ", e.Op)
}
// If wrapping an error, print its Error() message.
// Otherwise print the error code & message.
if e.Err != nil {
b.WriteString(e.Err.Error())
} else... | [
"func",
"(",
"e",
"*",
"Error",
")",
"Error",
"(",
")",
"string",
"{",
"var",
"b",
"strings",
".",
"Builder",
"\n\n",
"// Print the current operation in our stack, if any.",
"if",
"e",
".",
"Op",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintf",
"(",
"&",
"b... | // Error implement the error interface by outputing the Code and Err. | [
"Error",
"implement",
"the",
"error",
"interface",
"by",
"outputing",
"the",
"Code",
"and",
"Err",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L102-L124 |
123,745 | influxdata/influxdb | errors.go | ErrorCode | func ErrorCode(err error) string {
if err == nil {
return ""
}
e, ok := err.(*Error)
if !ok {
return EInternal
}
if e == nil {
return ""
}
if e.Code != "" {
return e.Code
}
if e.Err != nil {
return ErrorCode(e.Err)
}
return EInternal
} | go | func ErrorCode(err error) string {
if err == nil {
return ""
}
e, ok := err.(*Error)
if !ok {
return EInternal
}
if e == nil {
return ""
}
if e.Code != "" {
return e.Code
}
if e.Err != nil {
return ErrorCode(e.Err)
}
return EInternal
} | [
"func",
"ErrorCode",
"(",
"err",
"error",
")",
"string",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"Error",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"EInternal",
"... | // ErrorCode returns the code of the root error, if available; otherwise returns EINTERNAL. | [
"ErrorCode",
"returns",
"the",
"code",
"of",
"the",
"root",
"error",
"if",
"available",
";",
"otherwise",
"returns",
"EINTERNAL",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L127-L150 |
123,746 | influxdata/influxdb | errors.go | ErrorOp | func ErrorOp(err error) string {
if err == nil {
return ""
}
e, ok := err.(*Error)
if !ok {
return ""
}
if e == nil {
return ""
}
if e.Op != "" {
return e.Op
}
if e.Err != nil {
return ErrorOp(e.Err)
}
return ""
} | go | func ErrorOp(err error) string {
if err == nil {
return ""
}
e, ok := err.(*Error)
if !ok {
return ""
}
if e == nil {
return ""
}
if e.Op != "" {
return e.Op
}
if e.Err != nil {
return ErrorOp(e.Err)
}
return ""
} | [
"func",
"ErrorOp",
"(",
"err",
"error",
")",
"string",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"Error",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\... | // ErrorOp returns the op of the error, if available; otherwise return empty string. | [
"ErrorOp",
"returns",
"the",
"op",
"of",
"the",
"error",
"if",
"available",
";",
"otherwise",
"return",
"empty",
"string",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L153-L176 |
123,747 | influxdata/influxdb | errors.go | ErrorMessage | func ErrorMessage(err error) string {
if err == nil {
return ""
}
e, ok := err.(*Error)
if !ok {
return "An internal error has occurred."
}
if e == nil {
return ""
}
if e.Msg != "" {
return e.Msg
}
if e.Err != nil {
return ErrorMessage(e.Err)
}
return "An internal error has occurred."
} | go | func ErrorMessage(err error) string {
if err == nil {
return ""
}
e, ok := err.(*Error)
if !ok {
return "An internal error has occurred."
}
if e == nil {
return ""
}
if e.Msg != "" {
return e.Msg
}
if e.Err != nil {
return ErrorMessage(e.Err)
}
return "An internal error has occurred."
} | [
"func",
"ErrorMessage",
"(",
"err",
"error",
")",
"string",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"Error",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",... | // ErrorMessage returns the human-readable message of the error, if available.
// Otherwise returns a generic error message. | [
"ErrorMessage",
"returns",
"the",
"human",
"-",
"readable",
"message",
"of",
"the",
"error",
"if",
"available",
".",
"Otherwise",
"returns",
"a",
"generic",
"error",
"message",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L180-L203 |
123,748 | influxdata/influxdb | errors.go | MarshalJSON | func (e *Error) MarshalJSON() (result []byte, err error) {
ee := errEncode{
Code: e.Code,
Msg: e.Msg,
Op: e.Op,
}
if e.Err != nil {
if _, ok := e.Err.(*Error); ok {
_, err := e.Err.(*Error).MarshalJSON()
if err != nil {
return result, err
}
ee.Err = e.Err
} else {
ee.Err = e.Err.Error... | go | func (e *Error) MarshalJSON() (result []byte, err error) {
ee := errEncode{
Code: e.Code,
Msg: e.Msg,
Op: e.Op,
}
if e.Err != nil {
if _, ok := e.Err.(*Error); ok {
_, err := e.Err.(*Error).MarshalJSON()
if err != nil {
return result, err
}
ee.Err = e.Err
} else {
ee.Err = e.Err.Error... | [
"func",
"(",
"e",
"*",
"Error",
")",
"MarshalJSON",
"(",
")",
"(",
"result",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"ee",
":=",
"errEncode",
"{",
"Code",
":",
"e",
".",
"Code",
",",
"Msg",
":",
"e",
".",
"Msg",
",",
"Op",
":",
"e",
... | // MarshalJSON recursively marshals the stack of Err. | [
"MarshalJSON",
"recursively",
"marshals",
"the",
"stack",
"of",
"Err",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L214-L232 |
123,749 | influxdata/influxdb | errors.go | UnmarshalJSON | func (e *Error) UnmarshalJSON(b []byte) (err error) {
ee := new(errEncode)
err = json.Unmarshal(b, ee)
e.Code = ee.Code
e.Msg = ee.Msg
e.Op = ee.Op
e.Err = decodeInternalError(ee.Err)
return err
} | go | func (e *Error) UnmarshalJSON(b []byte) (err error) {
ee := new(errEncode)
err = json.Unmarshal(b, ee)
e.Code = ee.Code
e.Msg = ee.Msg
e.Op = ee.Op
e.Err = decodeInternalError(ee.Err)
return err
} | [
"func",
"(",
"e",
"*",
"Error",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"ee",
":=",
"new",
"(",
"errEncode",
")",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"ee",
")",
"\n",
"e",
"... | // UnmarshalJSON recursively unmarshals the error stack. | [
"UnmarshalJSON",
"recursively",
"unmarshals",
"the",
"error",
"stack",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/errors.go#L235-L243 |
123,750 | influxdata/influxdb | chronograf/influx/authorization.go | DefaultAuthorization | func DefaultAuthorization(src *chronograf.Source) Authorizer {
// Optionally, add the shared secret JWT token creation
if src.Username != "" && src.SharedSecret != "" {
return &BearerJWT{
Username: src.Username,
SharedSecret: src.SharedSecret,
}
} else if src.Username != "" && src.Password != "" {
re... | go | func DefaultAuthorization(src *chronograf.Source) Authorizer {
// Optionally, add the shared secret JWT token creation
if src.Username != "" && src.SharedSecret != "" {
return &BearerJWT{
Username: src.Username,
SharedSecret: src.SharedSecret,
}
} else if src.Username != "" && src.Password != "" {
re... | [
"func",
"DefaultAuthorization",
"(",
"src",
"*",
"chronograf",
".",
"Source",
")",
"Authorizer",
"{",
"// Optionally, add the shared secret JWT token creation",
"if",
"src",
".",
"Username",
"!=",
"\"",
"\"",
"&&",
"src",
".",
"SharedSecret",
"!=",
"\"",
"\"",
"{"... | // DefaultAuthorization creates either a shared JWT builder, basic auth or Noop | [
"DefaultAuthorization",
"creates",
"either",
"a",
"shared",
"JWT",
"builder",
"basic",
"auth",
"or",
"Noop"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/influx/authorization.go#L25-L39 |
123,751 | influxdata/influxdb | chronograf/influx/authorization.go | Set | func (b *BasicAuth) Set(r *http.Request) error {
r.SetBasicAuth(b.Username, b.Password)
return nil
} | go | func (b *BasicAuth) Set(r *http.Request) error {
r.SetBasicAuth(b.Username, b.Password)
return nil
} | [
"func",
"(",
"b",
"*",
"BasicAuth",
")",
"Set",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"r",
".",
"SetBasicAuth",
"(",
"b",
".",
"Username",
",",
"b",
".",
"Password",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Set adds the basic auth headers to the request | [
"Set",
"adds",
"the",
"basic",
"auth",
"headers",
"to",
"the",
"request"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/influx/authorization.go#L48-L51 |
123,752 | influxdata/influxdb | chronograf/influx/authorization.go | Set | func (b *BearerJWT) Set(r *http.Request) error {
if b.SharedSecret != "" && b.Username != "" {
token, err := b.Token(b.Username)
if err != nil {
return fmt.Errorf("unable to create token")
}
r.Header.Set("Authorization", "Bearer "+token)
}
return nil
} | go | func (b *BearerJWT) Set(r *http.Request) error {
if b.SharedSecret != "" && b.Username != "" {
token, err := b.Token(b.Username)
if err != nil {
return fmt.Errorf("unable to create token")
}
r.Header.Set("Authorization", "Bearer "+token)
}
return nil
} | [
"func",
"(",
"b",
"*",
"BearerJWT",
")",
"Set",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"if",
"b",
".",
"SharedSecret",
"!=",
"\"",
"\"",
"&&",
"b",
".",
"Username",
"!=",
"\"",
"\"",
"{",
"token",
",",
"err",
":=",
"b",
".",
... | // Set adds an Authorization Bearer to the request if has a shared secret | [
"Set",
"adds",
"an",
"Authorization",
"Bearer",
"to",
"the",
"request",
"if",
"has",
"a",
"shared",
"secret"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/influx/authorization.go#L61-L70 |
123,753 | influxdata/influxdb | chronograf/influx/authorization.go | Token | func (b *BearerJWT) Token(username string) (string, error) {
if b.Now == nil {
b.Now = time.Now
}
return JWT(username, b.SharedSecret, b.Now)
} | go | func (b *BearerJWT) Token(username string) (string, error) {
if b.Now == nil {
b.Now = time.Now
}
return JWT(username, b.SharedSecret, b.Now)
} | [
"func",
"(",
"b",
"*",
"BearerJWT",
")",
"Token",
"(",
"username",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"b",
".",
"Now",
"==",
"nil",
"{",
"b",
".",
"Now",
"=",
"time",
".",
"Now",
"\n",
"}",
"\n",
"return",
"JWT",
"(",
... | // Token returns the expected InfluxDB JWT signed with the sharedSecret | [
"Token",
"returns",
"the",
"expected",
"InfluxDB",
"JWT",
"signed",
"with",
"the",
"sharedSecret"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/influx/authorization.go#L73-L78 |
123,754 | influxdata/influxdb | chronograf/mocks/users.go | All | func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error) {
return s.AllF(ctx)
} | go | func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error) {
return s.AllF(ctx)
} | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"All",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"chronograf",
".",
"User",
",",
"error",
")",
"{",
"return",
"s",
".",
"AllF",
"(",
"ctx",
")",
"\n",
"}"
] | // All lists all users from the UsersStore | [
"All",
"lists",
"all",
"users",
"from",
"the",
"UsersStore"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/users.go#L22-L24 |
123,755 | influxdata/influxdb | chronograf/mocks/users.go | Add | func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) {
return s.AddF(ctx, u)
} | go | func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) {
return s.AddF(ctx, u)
} | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"Add",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"chronograf",
".",
"User",
")",
"(",
"*",
"chronograf",
".",
"User",
",",
"error",
")",
"{",
"return",
"s",
".",
"AddF",
"(",
"ctx",
",",
"u",
... | // Add a new User in the UsersStore | [
"Add",
"a",
"new",
"User",
"in",
"the",
"UsersStore"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/users.go#L32-L34 |
123,756 | influxdata/influxdb | chronograf/mocks/users.go | Delete | func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error {
return s.DeleteF(ctx, u)
} | go | func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error {
return s.DeleteF(ctx, u)
} | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"chronograf",
".",
"User",
")",
"error",
"{",
"return",
"s",
".",
"DeleteF",
"(",
"ctx",
",",
"u",
")",
"\n",
"}"
] | // Delete the User from the UsersStore | [
"Delete",
"the",
"User",
"from",
"the",
"UsersStore"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/mocks/users.go#L37-L39 |
123,757 | influxdata/influxdb | chronograf/server/users.go | UserID | func (s *Service) UserID(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
idStr := httprouter.GetParamFromContext(ctx, "id")
id, err := strconv.ParseUint(idStr, 10, 64)
if err != nil {
Error(w, http.StatusBadRequest, fmt.Sprintf("invalid user id: %s", err.Error()), s.Logger)
return
}
user, err :=... | go | func (s *Service) UserID(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
idStr := httprouter.GetParamFromContext(ctx, "id")
id, err := strconv.ParseUint(idStr, 10, 64)
if err != nil {
Error(w, http.StatusBadRequest, fmt.Sprintf("invalid user id: %s", err.Error()), s.Logger)
return
}
user, err :=... | [
"func",
"(",
"s",
"*",
"Service",
")",
"UserID",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"idStr",
":=",
"httprouter",
".",
"GetParamFromContext",
"(... | // UserID retrieves a Chronograf user with ID from store | [
"UserID",
"retrieves",
"a",
"Chronograf",
"user",
"with",
"ID",
"from",
"store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/users.go#L137-L156 |
123,758 | influxdata/influxdb | chronograf/server/users.go | NewUser | func (s *Service) NewUser(w http.ResponseWriter, r *http.Request) {
var req userRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
invalidJSON(w, s.Logger)
return
}
if err := req.ValidCreate(); err != nil {
invalidData(w, err, s.Logger)
return
}
ctx := r.Context()
serverCtx := server... | go | func (s *Service) NewUser(w http.ResponseWriter, r *http.Request) {
var req userRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
invalidJSON(w, s.Logger)
return
}
if err := req.ValidCreate(); err != nil {
invalidData(w, err, s.Logger)
return
}
ctx := r.Context()
serverCtx := server... | [
"func",
"(",
"s",
"*",
"Service",
")",
"NewUser",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"req",
"userRequest",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",... | // NewUser adds a new Chronograf user to store | [
"NewUser",
"adds",
"a",
"new",
"Chronograf",
"user",
"to",
"store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/users.go#L159-L211 |
123,759 | influxdata/influxdb | chronograf/server/users.go | RemoveUser | func (s *Service) RemoveUser(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
idStr := httprouter.GetParamFromContext(ctx, "id")
id, err := strconv.ParseUint(idStr, 10, 64)
if err != nil {
Error(w, http.StatusBadRequest, fmt.Sprintf("invalid user id: %s", err.Error()), s.Logger)
return
}
u, err :... | go | func (s *Service) RemoveUser(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
idStr := httprouter.GetParamFromContext(ctx, "id")
id, err := strconv.ParseUint(idStr, 10, 64)
if err != nil {
Error(w, http.StatusBadRequest, fmt.Sprintf("invalid user id: %s", err.Error()), s.Logger)
return
}
u, err :... | [
"func",
"(",
"s",
"*",
"Service",
")",
"RemoveUser",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n",
"idStr",
":=",
"httprouter",
".",
"GetParamFromContext",
... | // RemoveUser deletes a Chronograf user from store | [
"RemoveUser",
"deletes",
"a",
"Chronograf",
"user",
"from",
"store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/users.go#L214-L234 |
123,760 | influxdata/influxdb | chronograf/server/users.go | Users | func (s *Service) Users(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
users, err := s.Store.Users(ctx).All(ctx)
if err != nil {
Error(w, http.StatusBadRequest, err.Error(), s.Logger)
return
}
orgID := httprouter.GetParamFromContext(ctx, "oid")
res := newUsersResponse(users, orgID)
encodeJSON... | go | func (s *Service) Users(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
users, err := s.Store.Users(ctx).All(ctx)
if err != nil {
Error(w, http.StatusBadRequest, err.Error(), s.Logger)
return
}
orgID := httprouter.GetParamFromContext(ctx, "oid")
res := newUsersResponse(users, orgID)
encodeJSON... | [
"func",
"(",
"s",
"*",
"Service",
")",
"Users",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"users",
",",
"err",
":=",
"s",
".",
"Store",
".",
"Us... | // Users retrieves all Chronograf users from store | [
"Users",
"retrieves",
"all",
"Chronograf",
"users",
"from",
"store"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/users.go#L327-L339 |
123,761 | influxdata/influxdb | pkg/lifecycle/resource.go | Open | func (res *Resource) Open() {
res.stmu.Lock()
defer res.stmu.Unlock()
res.chmu.Lock()
res.ch = make(chan struct{})
res.chmu.Unlock()
} | go | func (res *Resource) Open() {
res.stmu.Lock()
defer res.stmu.Unlock()
res.chmu.Lock()
res.ch = make(chan struct{})
res.chmu.Unlock()
} | [
"func",
"(",
"res",
"*",
"Resource",
")",
"Open",
"(",
")",
"{",
"res",
".",
"stmu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"res",
".",
"stmu",
".",
"Unlock",
"(",
")",
"\n\n",
"res",
".",
"chmu",
".",
"Lock",
"(",
")",
"\n",
"res",
".",
"ch",... | // Open marks the resource as open. | [
"Open",
"marks",
"the",
"resource",
"as",
"open",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource.go#L16-L23 |
123,762 | influxdata/influxdb | pkg/lifecycle/resource.go | Close | func (res *Resource) Close() {
res.stmu.Lock()
defer res.stmu.Unlock()
res.chmu.Lock()
if res.ch != nil {
close(res.ch) // signal any references.
res.ch = nil // stop future Acquires
}
res.chmu.Unlock()
res.wg.Wait() // wait for any acquired references
} | go | func (res *Resource) Close() {
res.stmu.Lock()
defer res.stmu.Unlock()
res.chmu.Lock()
if res.ch != nil {
close(res.ch) // signal any references.
res.ch = nil // stop future Acquires
}
res.chmu.Unlock()
res.wg.Wait() // wait for any acquired references
} | [
"func",
"(",
"res",
"*",
"Resource",
")",
"Close",
"(",
")",
"{",
"res",
".",
"stmu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"res",
".",
"stmu",
".",
"Unlock",
"(",
")",
"\n\n",
"res",
".",
"chmu",
".",
"Lock",
"(",
")",
"\n",
"if",
"res",
"."... | // Close waits for any outstanding references and marks the resource as closed
// so that Acquire returns an error. | [
"Close",
"waits",
"for",
"any",
"outstanding",
"references",
"and",
"marks",
"the",
"resource",
"as",
"closed",
"so",
"that",
"Acquire",
"returns",
"an",
"error",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource.go#L27-L39 |
123,763 | influxdata/influxdb | pkg/lifecycle/resource.go | Opened | func (res *Resource) Opened() bool {
res.chmu.RLock()
opened := res.ch != nil
res.chmu.RUnlock()
return opened
} | go | func (res *Resource) Opened() bool {
res.chmu.RLock()
opened := res.ch != nil
res.chmu.RUnlock()
return opened
} | [
"func",
"(",
"res",
"*",
"Resource",
")",
"Opened",
"(",
")",
"bool",
"{",
"res",
".",
"chmu",
".",
"RLock",
"(",
")",
"\n",
"opened",
":=",
"res",
".",
"ch",
"!=",
"nil",
"\n",
"res",
".",
"chmu",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"o... | // Opened returns true if the resource is currently open. It may be immediately
// false in the presence of concurrent Open and Close calls. | [
"Opened",
"returns",
"true",
"if",
"the",
"resource",
"is",
"currently",
"open",
".",
"It",
"may",
"be",
"immediately",
"false",
"in",
"the",
"presence",
"of",
"concurrent",
"Open",
"and",
"Close",
"calls",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource.go#L43-L49 |
123,764 | influxdata/influxdb | pkg/lifecycle/resource.go | Acquire | func (res *Resource) Acquire() (*Reference, error) {
res.chmu.RLock()
defer res.chmu.RUnlock()
ch := res.ch
if ch == nil {
return nil, resourceClosed()
}
res.wg.Add(1)
return live.track(&Reference{wg: &res.wg, ch: ch}), nil
} | go | func (res *Resource) Acquire() (*Reference, error) {
res.chmu.RLock()
defer res.chmu.RUnlock()
ch := res.ch
if ch == nil {
return nil, resourceClosed()
}
res.wg.Add(1)
return live.track(&Reference{wg: &res.wg, ch: ch}), nil
} | [
"func",
"(",
"res",
"*",
"Resource",
")",
"Acquire",
"(",
")",
"(",
"*",
"Reference",
",",
"error",
")",
"{",
"res",
".",
"chmu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"res",
".",
"chmu",
".",
"RUnlock",
"(",
")",
"\n\n",
"ch",
":=",
"res",
".... | // Acquire returns a Reference used to keep alive some resource. | [
"Acquire",
"returns",
"a",
"Reference",
"used",
"to",
"keep",
"alive",
"some",
"resource",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource.go#L52-L63 |
123,765 | influxdata/influxdb | pkg/lifecycle/resource.go | Release | func (ref *Reference) Release() {
ref.once.Do(func() {
live.untrack(ref)
ref.wg.Done()
})
} | go | func (ref *Reference) Release() {
ref.once.Do(func() {
live.untrack(ref)
ref.wg.Done()
})
} | [
"func",
"(",
"ref",
"*",
"Reference",
")",
"Release",
"(",
")",
"{",
"ref",
".",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"live",
".",
"untrack",
"(",
"ref",
")",
"\n",
"ref",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
")",
"\n",
"}... | // Release causes the Reference to be freed. It is safe to call multiple times. | [
"Release",
"causes",
"the",
"Reference",
"to",
"be",
"freed",
".",
"It",
"is",
"safe",
"to",
"call",
"multiple",
"times",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/pkg/lifecycle/resource.go#L77-L82 |
123,766 | influxdata/influxdb | chronograf/server/queries.go | Queries | func (s *Service) Queries(w http.ResponseWriter, r *http.Request) {
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
src, err := s.Store.Sources(ctx).Get(ctx, srcID)
if err != nil {
notFound(w, srcID, s.Logger)
retu... | go | func (s *Service) Queries(w http.ResponseWriter, r *http.Request) {
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
src, err := s.Store.Sources(ctx).Get(ctx, srcID)
if err != nil {
notFound(w, srcID, s.Logger)
retu... | [
"func",
"(",
"s",
"*",
"Service",
")",
"Queries",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"srcID",
",",
"err",
":=",
"paramID",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // Queries analyzes InfluxQL to produce front-end friendly QueryConfig | [
"Queries",
"analyzes",
"InfluxQL",
"to",
"produce",
"front",
"-",
"end",
"friendly",
"QueryConfig"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/queries.go#L46-L101 |
123,767 | influxdata/influxdb | chronograf/server/queries.go | DefaultRP | func (s *Service) DefaultRP(ctx context.Context, qc *chronograf.QueryConfig, src *chronograf.Source) error {
// Only need to find the default RP IFF the qc's rp is empty
if qc.RetentionPolicy != "" {
return nil
}
// For queries without databases, measurements, or fields we will not
// be able to find an RP
if ... | go | func (s *Service) DefaultRP(ctx context.Context, qc *chronograf.QueryConfig, src *chronograf.Source) error {
// Only need to find the default RP IFF the qc's rp is empty
if qc.RetentionPolicy != "" {
return nil
}
// For queries without databases, measurements, or fields we will not
// be able to find an RP
if ... | [
"func",
"(",
"s",
"*",
"Service",
")",
"DefaultRP",
"(",
"ctx",
"context",
".",
"Context",
",",
"qc",
"*",
"chronograf",
".",
"QueryConfig",
",",
"src",
"*",
"chronograf",
".",
"Source",
")",
"error",
"{",
"// Only need to find the default RP IFF the qc's rp is ... | // DefaultRP will add the default retention policy to the QC if one has not been specified | [
"DefaultRP",
"will",
"add",
"the",
"default",
"retention",
"policy",
"to",
"the",
"QC",
"if",
"one",
"has",
"not",
"been",
"specified"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/queries.go#L104-L134 |
123,768 | influxdata/influxdb | bolt/kv.go | NewKVStore | func NewKVStore(path string) *KVStore {
return &KVStore{
path: path,
logger: zap.NewNop(),
}
} | go | func NewKVStore(path string) *KVStore {
return &KVStore{
path: path,
logger: zap.NewNop(),
}
} | [
"func",
"NewKVStore",
"(",
"path",
"string",
")",
"*",
"KVStore",
"{",
"return",
"&",
"KVStore",
"{",
"path",
":",
"path",
",",
"logger",
":",
"zap",
".",
"NewNop",
"(",
")",
",",
"}",
"\n",
"}"
] | // NewKVStore returns an instance of KVStore with the file at
// the provided path. | [
"NewKVStore",
"returns",
"an",
"instance",
"of",
"KVStore",
"with",
"the",
"file",
"at",
"the",
"provided",
"path",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L26-L31 |
123,769 | influxdata/influxdb | bolt/kv.go | Flush | func (s *KVStore) Flush(ctx context.Context) {
_ = s.db.Update(
func(tx *bolt.Tx) error {
return tx.ForEach(func(name []byte, b *bolt.Bucket) error {
s.cleanBucket(tx, b)
return nil
})
},
)
} | go | func (s *KVStore) Flush(ctx context.Context) {
_ = s.db.Update(
func(tx *bolt.Tx) error {
return tx.ForEach(func(name []byte, b *bolt.Bucket) error {
s.cleanBucket(tx, b)
return nil
})
},
)
} | [
"func",
"(",
"s",
"*",
"KVStore",
")",
"Flush",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"_",
"=",
"s",
".",
"db",
".",
"Update",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"return",
"tx",
".",
"ForEach",
"(",
... | // Flush removes all bolt keys within each bucket. | [
"Flush",
"removes",
"all",
"bolt",
"keys",
"within",
"each",
"bucket",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L67-L76 |
123,770 | influxdata/influxdb | bolt/kv.go | createBucketIfNotExists | func (tx *Tx) createBucketIfNotExists(b []byte) (*Bucket, error) {
bkt, err := tx.tx.CreateBucketIfNotExists(b)
if err != nil {
return nil, err
}
return &Bucket{
bucket: bkt,
}, nil
} | go | func (tx *Tx) createBucketIfNotExists(b []byte) (*Bucket, error) {
bkt, err := tx.tx.CreateBucketIfNotExists(b)
if err != nil {
return nil, err
}
return &Bucket{
bucket: bkt,
}, nil
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"createBucketIfNotExists",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"*",
"Bucket",
",",
"error",
")",
"{",
"bkt",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"CreateBucketIfNotExists",
"(",
"b",
")",
"\n",
"if",
"err",
... | // createBucketIfNotExists creates a bucket with the provided byte slice. | [
"createBucketIfNotExists",
"creates",
"a",
"bucket",
"with",
"the",
"provided",
"byte",
"slice",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L146-L154 |
123,771 | influxdata/influxdb | bolt/kv.go | Bucket | func (tx *Tx) Bucket(b []byte) (kv.Bucket, error) {
bkt := tx.tx.Bucket(b)
if bkt == nil {
return tx.createBucketIfNotExists(b)
}
return &Bucket{
bucket: bkt,
}, nil
} | go | func (tx *Tx) Bucket(b []byte) (kv.Bucket, error) {
bkt := tx.tx.Bucket(b)
if bkt == nil {
return tx.createBucketIfNotExists(b)
}
return &Bucket{
bucket: bkt,
}, nil
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"Bucket",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"kv",
".",
"Bucket",
",",
"error",
")",
"{",
"bkt",
":=",
"tx",
".",
"tx",
".",
"Bucket",
"(",
"b",
")",
"\n",
"if",
"bkt",
"==",
"nil",
"{",
"return",
"tx",... | // Bucket retrieves the bucket named b. | [
"Bucket",
"retrieves",
"the",
"bucket",
"named",
"b",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L157-L165 |
123,772 | influxdata/influxdb | bolt/kv.go | Put | func (b *Bucket) Put(key []byte, value []byte) error {
err := b.bucket.Put(key, value)
if err == bolt.ErrTxNotWritable {
return kv.ErrTxNotWritable
}
return err
} | go | func (b *Bucket) Put(key []byte, value []byte) error {
err := b.bucket.Put(key, value)
if err == bolt.ErrTxNotWritable {
return kv.ErrTxNotWritable
}
return err
} | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"Put",
"(",
"key",
"[",
"]",
"byte",
",",
"value",
"[",
"]",
"byte",
")",
"error",
"{",
"err",
":=",
"b",
".",
"bucket",
".",
"Put",
"(",
"key",
",",
"value",
")",
"\n",
"if",
"err",
"==",
"bolt",
".",
... | // Put sets the value at the provided key. | [
"Put",
"sets",
"the",
"value",
"at",
"the",
"provided",
"key",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L183-L189 |
123,773 | influxdata/influxdb | bolt/kv.go | Delete | func (b *Bucket) Delete(key []byte) error {
err := b.bucket.Delete(key)
if err == bolt.ErrTxNotWritable {
return kv.ErrTxNotWritable
}
return err
} | go | func (b *Bucket) Delete(key []byte) error {
err := b.bucket.Delete(key)
if err == bolt.ErrTxNotWritable {
return kv.ErrTxNotWritable
}
return err
} | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"Delete",
"(",
"key",
"[",
"]",
"byte",
")",
"error",
"{",
"err",
":=",
"b",
".",
"bucket",
".",
"Delete",
"(",
"key",
")",
"\n",
"if",
"err",
"==",
"bolt",
".",
"ErrTxNotWritable",
"{",
"return",
"kv",
".",
... | // Delete removes the provided key. | [
"Delete",
"removes",
"the",
"provided",
"key",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L192-L198 |
123,774 | influxdata/influxdb | bolt/kv.go | Cursor | func (b *Bucket) Cursor() (kv.Cursor, error) {
return &Cursor{
cursor: b.bucket.Cursor(),
}, nil
} | go | func (b *Bucket) Cursor() (kv.Cursor, error) {
return &Cursor{
cursor: b.bucket.Cursor(),
}, nil
} | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"Cursor",
"(",
")",
"(",
"kv",
".",
"Cursor",
",",
"error",
")",
"{",
"return",
"&",
"Cursor",
"{",
"cursor",
":",
"b",
".",
"bucket",
".",
"Cursor",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] | // Cursor retrieves a cursor for iterating through the entries
// in the key value store. | [
"Cursor",
"retrieves",
"a",
"cursor",
"for",
"iterating",
"through",
"the",
"entries",
"in",
"the",
"key",
"value",
"store",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L202-L206 |
123,775 | influxdata/influxdb | bolt/kv.go | First | func (c *Cursor) First() ([]byte, []byte) {
k, v := c.cursor.First()
if len(k) == 0 && len(v) == 0 {
return nil, nil
}
return k, v
} | go | func (c *Cursor) First() ([]byte, []byte) {
k, v := c.cursor.First()
if len(k) == 0 && len(v) == 0 {
return nil, nil
}
return k, v
} | [
"func",
"(",
"c",
"*",
"Cursor",
")",
"First",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"byte",
")",
"{",
"k",
",",
"v",
":=",
"c",
".",
"cursor",
".",
"First",
"(",
")",
"\n",
"if",
"len",
"(",
"k",
")",
"==",
"0",
"&&",
"len",
... | // First retrieves the first key value pair in the bucket. | [
"First",
"retrieves",
"the",
"first",
"key",
"value",
"pair",
"in",
"the",
"bucket",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/kv.go#L224-L230 |
123,776 | influxdata/influxdb | query/influxql/response_iterator.go | More | func (r *responseIterator) More() bool {
return r.resultIdx < len(r.response.Results)
} | go | func (r *responseIterator) More() bool {
return r.resultIdx < len(r.response.Results)
} | [
"func",
"(",
"r",
"*",
"responseIterator",
")",
"More",
"(",
")",
"bool",
"{",
"return",
"r",
".",
"resultIdx",
"<",
"len",
"(",
"r",
".",
"response",
".",
"Results",
")",
"\n",
"}"
] | // More returns true if there are results left to iterate through.
// It is used to implement flux.ResultIterator. | [
"More",
"returns",
"true",
"if",
"there",
"are",
"results",
"left",
"to",
"iterate",
"through",
".",
"It",
"is",
"used",
"to",
"implement",
"flux",
".",
"ResultIterator",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/response_iterator.go#L32-L34 |
123,777 | influxdata/influxdb | query/influxql/response_iterator.go | Next | func (r *responseIterator) Next() flux.Result {
res := r.response.Results[r.resultIdx]
r.resultIdx++
return newQueryResult(&res)
} | go | func (r *responseIterator) Next() flux.Result {
res := r.response.Results[r.resultIdx]
r.resultIdx++
return newQueryResult(&res)
} | [
"func",
"(",
"r",
"*",
"responseIterator",
")",
"Next",
"(",
")",
"flux",
".",
"Result",
"{",
"res",
":=",
"r",
".",
"response",
".",
"Results",
"[",
"r",
".",
"resultIdx",
"]",
"\n",
"r",
".",
"resultIdx",
"++",
"\n",
"return",
"newQueryResult",
"("... | // Next retrieves the next flux.Result.
// It is used to implement flux.ResultIterator. | [
"Next",
"retrieves",
"the",
"next",
"flux",
".",
"Result",
".",
"It",
"is",
"used",
"to",
"implement",
"flux",
".",
"ResultIterator",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/response_iterator.go#L38-L42 |
123,778 | influxdata/influxdb | query/influxql/response_iterator.go | Err | func (r *responseIterator) Err() error {
if r.response.Err != "" {
return fmt.Errorf(r.response.Err)
}
return nil
} | go | func (r *responseIterator) Err() error {
if r.response.Err != "" {
return fmt.Errorf(r.response.Err)
}
return nil
} | [
"func",
"(",
"r",
"*",
"responseIterator",
")",
"Err",
"(",
")",
"error",
"{",
"if",
"r",
".",
"response",
".",
"Err",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"r",
".",
"response",
".",
"Err",
")",
"\n",
"}",
"\n\n",
"return",... | // Err returns an error if the response contained an error.
// It is used to implement flux.ResultIterator. | [
"Err",
"returns",
"an",
"error",
"if",
"the",
"response",
"contained",
"an",
"error",
".",
"It",
"is",
"used",
"to",
"implement",
"flux",
".",
"ResultIterator",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/response_iterator.go#L50-L56 |
123,779 | influxdata/influxdb | query/influxql/response_iterator.go | Do | func (r *seriesIterator) Do(f func(flux.Table) error) error {
for _, row := range r.result.Series {
t, err := newQueryTable(row)
if err != nil {
return err
}
if err := f(t); err != nil {
return err
}
}
return nil
} | go | func (r *seriesIterator) Do(f func(flux.Table) error) error {
for _, row := range r.result.Series {
t, err := newQueryTable(row)
if err != nil {
return err
}
if err := f(t); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"r",
"*",
"seriesIterator",
")",
"Do",
"(",
"f",
"func",
"(",
"flux",
".",
"Table",
")",
"error",
")",
"error",
"{",
"for",
"_",
",",
"row",
":=",
"range",
"r",
".",
"result",
".",
"Series",
"{",
"t",
",",
"err",
":=",
"newQueryTable... | // Do iterates through the series of a Result.
// It is used to implement flux.TableIterator. | [
"Do",
"iterates",
"through",
"the",
"series",
"of",
"a",
"Result",
".",
"It",
"is",
"used",
"to",
"implement",
"flux",
".",
"TableIterator",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/response_iterator.go#L87-L99 |
123,780 | influxdata/influxdb | query/influxql/response_iterator.go | Key | func (r *queryTable) Key() flux.GroupKey {
if r.groupKey == nil {
cols := make([]flux.ColMeta, len(r.row.Tags)+1) // plus one is for measurement
vs := make([]values.Value, len(r.row.Tags)+1)
kvs := make([]interface{}, len(r.row.Tags)+1)
colMeta := r.Cols()
labels := append(r.tagKeys(), "_measurement")
for ... | go | func (r *queryTable) Key() flux.GroupKey {
if r.groupKey == nil {
cols := make([]flux.ColMeta, len(r.row.Tags)+1) // plus one is for measurement
vs := make([]values.Value, len(r.row.Tags)+1)
kvs := make([]interface{}, len(r.row.Tags)+1)
colMeta := r.Cols()
labels := append(r.tagKeys(), "_measurement")
for ... | [
"func",
"(",
"r",
"*",
"queryTable",
")",
"Key",
"(",
")",
"flux",
".",
"GroupKey",
"{",
"if",
"r",
".",
"groupKey",
"==",
"nil",
"{",
"cols",
":=",
"make",
"(",
"[",
"]",
"flux",
".",
"ColMeta",
",",
"len",
"(",
"r",
".",
"row",
".",
"Tags",
... | // Key constructs the flux.GroupKey for a Row from the rows
// tags and measurement.
// It is used to implement flux.Table and flux.ColReader. | [
"Key",
"constructs",
"the",
"flux",
".",
"GroupKey",
"for",
"a",
"Row",
"from",
"the",
"rows",
"tags",
"and",
"measurement",
".",
"It",
"is",
"used",
"to",
"implement",
"flux",
".",
"Table",
"and",
"flux",
".",
"ColReader",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/response_iterator.go#L243-L267 |
123,781 | influxdata/influxdb | query/influxql/response_iterator.go | tagKeys | func (r *queryTable) tagKeys() []string {
tags := []string{}
for t := range r.row.Tags {
tags = append(tags, t)
}
sort.Strings(tags)
return tags
} | go | func (r *queryTable) tagKeys() []string {
tags := []string{}
for t := range r.row.Tags {
tags = append(tags, t)
}
sort.Strings(tags)
return tags
} | [
"func",
"(",
"r",
"*",
"queryTable",
")",
"tagKeys",
"(",
")",
"[",
"]",
"string",
"{",
"tags",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"t",
":=",
"range",
"r",
".",
"row",
".",
"Tags",
"{",
"tags",
"=",
"append",
"(",
"tags",
",",
"... | // tags returns the tag keys for a Row. | [
"tags",
"returns",
"the",
"tag",
"keys",
"for",
"a",
"Row",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/influxql/response_iterator.go#L270-L277 |
123,782 | influxdata/influxdb | tsdb/tsm1/batch_boolean.go | BooleanArrayEncodeAll | func BooleanArrayEncodeAll(src []bool, b []byte) ([]byte, error) {
sz := 1 + 8 + ((len(src) + 7) / 8) // Header + Num bools + bool data.
if len(b) < sz && cap(b) > sz {
b = b[:sz]
} else if len(b) < sz {
b = append(b, make([]byte, sz)...)
}
// Store the encoding type in the 4 high bits of the first byte
b[0]... | go | func BooleanArrayEncodeAll(src []bool, b []byte) ([]byte, error) {
sz := 1 + 8 + ((len(src) + 7) / 8) // Header + Num bools + bool data.
if len(b) < sz && cap(b) > sz {
b = b[:sz]
} else if len(b) < sz {
b = append(b, make([]byte, sz)...)
}
// Store the encoding type in the 4 high bits of the first byte
b[0]... | [
"func",
"BooleanArrayEncodeAll",
"(",
"src",
"[",
"]",
"bool",
",",
"b",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"sz",
":=",
"1",
"+",
"8",
"+",
"(",
"(",
"len",
"(",
"src",
")",
"+",
"7",
")",
"/",
"8",
")",
... | // BooleanArrayEncodeAll encodes src into b, returning b and any error encountered.
// The returned slice may be of a different length and capactity to b. | [
"BooleanArrayEncodeAll",
"encodes",
"src",
"into",
"b",
"returning",
"b",
"and",
"any",
"error",
"encountered",
".",
"The",
"returned",
"slice",
"may",
"be",
"of",
"a",
"different",
"length",
"and",
"capactity",
"to",
"b",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/batch_boolean.go#L10-L40 |
123,783 | influxdata/influxdb | tsdb/tsm1/array_cursor_iterator.gen.go | buildFloatArrayCursor | func (q *arrayCursorIterator) buildFloatArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.FloatArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.Ascend... | go | func (q *arrayCursorIterator) buildFloatArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.FloatArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.Ascend... | [
"func",
"(",
"q",
"*",
"arrayCursorIterator",
")",
"buildFloatArrayCursor",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"[",
"]",
"byte",
",",
"tags",
"models",
".",
"Tags",
",",
"field",
"string",
",",
"opt",
"query",
".",
"IteratorOptions",
")",
... | // buildFloatArrayCursor creates an array cursor for a float field. | [
"buildFloatArrayCursor",
"creates",
"an",
"array",
"cursor",
"for",
"a",
"float",
"field",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_cursor_iterator.gen.go#L18-L35 |
123,784 | influxdata/influxdb | tsdb/tsm1/array_cursor_iterator.gen.go | buildIntegerArrayCursor | func (q *arrayCursorIterator) buildIntegerArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.IntegerArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.As... | go | func (q *arrayCursorIterator) buildIntegerArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.IntegerArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.As... | [
"func",
"(",
"q",
"*",
"arrayCursorIterator",
")",
"buildIntegerArrayCursor",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"[",
"]",
"byte",
",",
"tags",
"models",
".",
"Tags",
",",
"field",
"string",
",",
"opt",
"query",
".",
"IteratorOptions",
")"... | // buildIntegerArrayCursor creates an array cursor for a integer field. | [
"buildIntegerArrayCursor",
"creates",
"an",
"array",
"cursor",
"for",
"a",
"integer",
"field",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_cursor_iterator.gen.go#L38-L55 |
123,785 | influxdata/influxdb | tsdb/tsm1/array_cursor_iterator.gen.go | buildUnsignedArrayCursor | func (q *arrayCursorIterator) buildUnsignedArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.UnsignedArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.... | go | func (q *arrayCursorIterator) buildUnsignedArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.UnsignedArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.... | [
"func",
"(",
"q",
"*",
"arrayCursorIterator",
")",
"buildUnsignedArrayCursor",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"[",
"]",
"byte",
",",
"tags",
"models",
".",
"Tags",
",",
"field",
"string",
",",
"opt",
"query",
".",
"IteratorOptions",
")... | // buildUnsignedArrayCursor creates an array cursor for a unsigned field. | [
"buildUnsignedArrayCursor",
"creates",
"an",
"array",
"cursor",
"for",
"a",
"unsigned",
"field",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_cursor_iterator.gen.go#L58-L75 |
123,786 | influxdata/influxdb | tsdb/tsm1/array_cursor_iterator.gen.go | buildStringArrayCursor | func (q *arrayCursorIterator) buildStringArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.StringArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.Asce... | go | func (q *arrayCursorIterator) buildStringArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.StringArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.Asce... | [
"func",
"(",
"q",
"*",
"arrayCursorIterator",
")",
"buildStringArrayCursor",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"[",
"]",
"byte",
",",
"tags",
"models",
".",
"Tags",
",",
"field",
"string",
",",
"opt",
"query",
".",
"IteratorOptions",
")",... | // buildStringArrayCursor creates an array cursor for a string field. | [
"buildStringArrayCursor",
"creates",
"an",
"array",
"cursor",
"for",
"a",
"string",
"field",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_cursor_iterator.gen.go#L78-L95 |
123,787 | influxdata/influxdb | tsdb/tsm1/array_cursor_iterator.gen.go | buildBooleanArrayCursor | func (q *arrayCursorIterator) buildBooleanArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.BooleanArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.As... | go | func (q *arrayCursorIterator) buildBooleanArrayCursor(ctx context.Context, name []byte, tags models.Tags, field string, opt query.IteratorOptions) tsdb.BooleanArrayCursor {
key := q.seriesFieldKeyBytes(name, tags, field)
cacheValues := q.e.Cache.Values(key)
keyCursor := q.e.KeyCursor(ctx, key, opt.SeekTime(), opt.As... | [
"func",
"(",
"q",
"*",
"arrayCursorIterator",
")",
"buildBooleanArrayCursor",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"[",
"]",
"byte",
",",
"tags",
"models",
".",
"Tags",
",",
"field",
"string",
",",
"opt",
"query",
".",
"IteratorOptions",
")"... | // buildBooleanArrayCursor creates an array cursor for a boolean field. | [
"buildBooleanArrayCursor",
"creates",
"an",
"array",
"cursor",
"for",
"a",
"boolean",
"field",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_cursor_iterator.gen.go#L98-L115 |
123,788 | influxdata/influxdb | chronograf/server/logout.go | Logout | func Logout(nextURL, basepath string, routes AuthRoutes) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
principal, err := getPrincipal(ctx)
if err != nil {
http.Redirect(w, r, path.Join(basepath, nextURL), http.StatusTemporaryRedirect)
return
}
route, ok := ... | go | func Logout(nextURL, basepath string, routes AuthRoutes) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
principal, err := getPrincipal(ctx)
if err != nil {
http.Redirect(w, r, path.Join(basepath, nextURL), http.StatusTemporaryRedirect)
return
}
route, ok := ... | [
"func",
"Logout",
"(",
"nextURL",
",",
"basepath",
"string",
",",
"routes",
"AuthRoutes",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r"... | // Logout chooses the correct provider logout route and redirects to it | [
"Logout",
"chooses",
"the",
"correct",
"provider",
"logout",
"route",
"and",
"redirects",
"to",
"it"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/logout.go#L9-L24 |
123,789 | influxdata/influxdb | http/dashboard_service.go | NewDashboardBackend | func NewDashboardBackend(b *APIBackend) *DashboardBackend {
return &DashboardBackend{
Logger: b.Logger.With(zap.String("handler", "dashboard")),
DashboardService: b.DashboardService,
DashboardOperationLogService: b.DashboardOperationLogService,
UserResourceMappingService: b.UserResourceMappingSe... | go | func NewDashboardBackend(b *APIBackend) *DashboardBackend {
return &DashboardBackend{
Logger: b.Logger.With(zap.String("handler", "dashboard")),
DashboardService: b.DashboardService,
DashboardOperationLogService: b.DashboardOperationLogService,
UserResourceMappingService: b.UserResourceMappingSe... | [
"func",
"NewDashboardBackend",
"(",
"b",
"*",
"APIBackend",
")",
"*",
"DashboardBackend",
"{",
"return",
"&",
"DashboardBackend",
"{",
"Logger",
":",
"b",
".",
"Logger",
".",
"With",
"(",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")"... | // NewDashboardBackend creates a backend used by the dashboard handler. | [
"NewDashboardBackend",
"creates",
"a",
"backend",
"used",
"by",
"the",
"dashboard",
"handler",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L30-L40 |
123,790 | influxdata/influxdb | http/dashboard_service.go | handleGetDashboard | func (h *DashboardHandler) handleGetDashboard(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeGetDashboardRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
dashboard, err := h.DashboardService.FindDashboardByID(ctx, req.DashboardID)
if err != nil {
EncodeErro... | go | func (h *DashboardHandler) handleGetDashboard(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeGetDashboardRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
dashboard, err := h.DashboardService.FindDashboardByID(ctx, req.DashboardID)
if err != nil {
EncodeErro... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handleGetDashboard",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodeGetDashb... | // hanldeGetDashboard retrieves a dashboard by ID. | [
"hanldeGetDashboard",
"retrieves",
"a",
"dashboard",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L463-L488 |
123,791 | influxdata/influxdb | http/dashboard_service.go | handleGetDashboardLog | func (h *DashboardHandler) handleGetDashboardLog(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeGetDashboardLogRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
log, _, err := h.DashboardOperationLogService.GetDashboardOperationLog(ctx, req.DashboardID, req.opt... | go | func (h *DashboardHandler) handleGetDashboardLog(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeGetDashboardLogRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
log, _, err := h.DashboardOperationLogService.GetDashboardOperationLog(ctx, req.DashboardID, req.opt... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handleGetDashboardLog",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodeGetDa... | // hanldeGetDashboardLog retrieves a dashboard log by the dashboards ID. | [
"hanldeGetDashboardLog",
"retrieves",
"a",
"dashboard",
"log",
"by",
"the",
"dashboards",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L515-L534 |
123,792 | influxdata/influxdb | http/dashboard_service.go | handleDeleteDashboard | func (h *DashboardHandler) handleDeleteDashboard(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeDeleteDashboardRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.DeleteDashboard(ctx, req.DashboardID); err != nil {
EncodeError(ctx, ... | go | func (h *DashboardHandler) handleDeleteDashboard(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeDeleteDashboardRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.DeleteDashboard(ctx, req.DashboardID); err != nil {
EncodeError(ctx, ... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handleDeleteDashboard",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodeDelet... | // handleDeleteDashboard removes a dashboard by ID. | [
"handleDeleteDashboard",
"removes",
"a",
"dashboard",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L568-L583 |
123,793 | influxdata/influxdb | http/dashboard_service.go | handlePostDashboardCell | func (h *DashboardHandler) handlePostDashboardCell(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodePostDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.AddDashboardCell(ctx, req.dashboardID, req.cell, req.opts); err != n... | go | func (h *DashboardHandler) handlePostDashboardCell(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodePostDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.AddDashboardCell(ctx, req.dashboardID, req.cell, req.opts); err != n... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handlePostDashboardCell",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodePos... | // handlePostDashboardCell creates a dashboard cell. | [
"handlePostDashboardCell",
"creates",
"a",
"dashboard",
"cell",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L730-L747 |
123,794 | influxdata/influxdb | http/dashboard_service.go | handlePutDashboardCells | func (h *DashboardHandler) handlePutDashboardCells(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodePutDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.ReplaceDashboardCells(ctx, req.dashboardID, req.cells); err != nil {... | go | func (h *DashboardHandler) handlePutDashboardCells(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodePutDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.ReplaceDashboardCells(ctx, req.dashboardID, req.cells); err != nil {... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handlePutDashboardCells",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodePut... | // handlePutDashboardCells replaces a dashboards cells. | [
"handlePutDashboardCells",
"replaces",
"a",
"dashboards",
"cells",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L778-L796 |
123,795 | influxdata/influxdb | http/dashboard_service.go | handleDeleteDashboardCell | func (h *DashboardHandler) handleDeleteDashboardCell(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeDeleteDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.RemoveDashboardCell(ctx, req.dashboardID, req.cellID); err != ni... | go | func (h *DashboardHandler) handleDeleteDashboardCell(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeDeleteDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
if err := h.DashboardService.RemoveDashboardCell(ctx, req.dashboardID, req.cellID); err != ni... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handleDeleteDashboardCell",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodeD... | // handleDeleteDashboardCell deletes a dashboard cell. | [
"handleDeleteDashboardCell",
"deletes",
"a",
"dashboard",
"cell",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L936-L950 |
123,796 | influxdata/influxdb | http/dashboard_service.go | handlePatchDashboardCell | func (h *DashboardHandler) handlePatchDashboardCell(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodePatchDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
cell, err := h.DashboardService.UpdateDashboardCell(ctx, req.dashboardID, req.cellID, req.upd)
... | go | func (h *DashboardHandler) handlePatchDashboardCell(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodePatchDashboardCellRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
cell, err := h.DashboardService.UpdateDashboardCell(ctx, req.dashboardID, req.cellID, req.upd)
... | [
"func",
"(",
"h",
"*",
"DashboardHandler",
")",
"handlePatchDashboardCell",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"decodePa... | // handlePatchDashboardCell updates a dashboard cell. | [
"handlePatchDashboardCell",
"updates",
"a",
"dashboard",
"cell",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L999-L1017 |
123,797 | influxdata/influxdb | http/dashboard_service.go | UpdateDashboard | func (s *DashboardService) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error) {
//op := s.OpPrefix + platform.OpUpdateDashboard
u, err := newURL(s.Addr, dashboardIDPath(id))
if err != nil {
return nil, err
}
b, err := json.Marshal(upd)
if err != nil ... | go | func (s *DashboardService) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error) {
//op := s.OpPrefix + platform.OpUpdateDashboard
u, err := newURL(s.Addr, dashboardIDPath(id))
if err != nil {
return nil, err
}
b, err := json.Marshal(upd)
if err != nil ... | [
"func",
"(",
"s",
"*",
"DashboardService",
")",
"UpdateDashboard",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"upd",
"platform",
".",
"DashboardUpdate",
")",
"(",
"*",
"platform",
".",
"Dashboard",
",",
"error",
")",
"{... | // UpdateDashboard updates a single dashboard with changeset.
// Returns the new dashboard state after update. | [
"UpdateDashboard",
"updates",
"a",
"single",
"dashboard",
"with",
"changeset",
".",
"Returns",
"the",
"new",
"dashboard",
"state",
"after",
"update",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L1158-L1199 |
123,798 | influxdata/influxdb | http/dashboard_service.go | DeleteDashboard | func (s *DashboardService) DeleteDashboard(ctx context.Context, id platform.ID) error {
u, err := newURL(s.Addr, dashboardIDPath(id))
if err != nil {
return err
}
req, err := http.NewRequest("DELETE", u.String(), nil)
if err != nil {
return err
}
SetToken(s.Token, req)
hc := newClient(u.Scheme, s.Insecure... | go | func (s *DashboardService) DeleteDashboard(ctx context.Context, id platform.ID) error {
u, err := newURL(s.Addr, dashboardIDPath(id))
if err != nil {
return err
}
req, err := http.NewRequest("DELETE", u.String(), nil)
if err != nil {
return err
}
SetToken(s.Token, req)
hc := newClient(u.Scheme, s.Insecure... | [
"func",
"(",
"s",
"*",
"DashboardService",
")",
"DeleteDashboard",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"error",
"{",
"u",
",",
"err",
":=",
"newURL",
"(",
"s",
".",
"Addr",
",",
"dashboardIDPath",
"(",
"id",
... | // DeleteDashboard removes a dashboard by ID. | [
"DeleteDashboard",
"removes",
"a",
"dashboard",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/dashboard_service.go#L1202-L1222 |
123,799 | influxdata/influxdb | task/options/options.go | Parse | func (a *Duration) Parse(s string) error {
q, err := parseSignedDuration(s)
if err != nil {
return err
}
a.Node = *q
return nil
} | go | func (a *Duration) Parse(s string) error {
q, err := parseSignedDuration(s)
if err != nil {
return err
}
a.Node = *q
return nil
} | [
"func",
"(",
"a",
"*",
"Duration",
")",
"Parse",
"(",
"s",
"string",
")",
"error",
"{",
"q",
",",
"err",
":=",
"parseSignedDuration",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"a",
".",
"Node",
"=",
"... | // Parse parses a string into a Duration. | [
"Parse",
"parses",
"a",
"string",
"into",
"a",
"Duration",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/options/options.go#L68-L75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.