id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
124,000 | influxdata/influxdb | tsdb/tsi1/index_file.go | FormatIndexFileName | func FormatIndexFileName(id, level int) string {
return fmt.Sprintf("L%d-%08d%s", level, id, IndexFileExt)
} | go | func FormatIndexFileName(id, level int) string {
return fmt.Sprintf("L%d-%08d%s", level, id, IndexFileExt)
} | [
"func",
"FormatIndexFileName",
"(",
"id",
",",
"level",
"int",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"level",
",",
"id",
",",
"IndexFileExt",
")",
"\n",
"}"
] | // FormatIndexFileName generates an index filename for the given index. | [
"FormatIndexFileName",
"generates",
"an",
"index",
"filename",
"for",
"the",
"given",
"index",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsi1/index_file.go#L497-L499 |
124,001 | influxdata/influxdb | http/redoc.go | Redoc | func Redoc(swagger string) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(fmt.Sprintf(index, swagger)))
})
} | go | func Redoc(swagger string) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(fmt.Sprintf(index, swagger)))
})
} | [
"func",
"Redoc",
"(",
"swagger",
"string",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"w",
".",
"Header",
"(",
")"... | // Redoc servers the swagger JSON using the redoc package. | [
"Redoc",
"servers",
"the",
"swagger",
"JSON",
"using",
"the",
"redoc",
"package",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/redoc.go#L32-L39 |
124,002 | influxdata/influxdb | chronograf/server/env.go | Environment | func (s *Service) Environment(w http.ResponseWriter, r *http.Request) {
res := newEnvResponse(s.Env)
encodeJSON(w, http.StatusOK, res, s.Logger)
} | go | func (s *Service) Environment(w http.ResponseWriter, r *http.Request) {
res := newEnvResponse(s.Env)
encodeJSON(w, http.StatusOK, res, s.Logger)
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Environment",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"res",
":=",
"newEnvResponse",
"(",
"s",
".",
"Env",
")",
"\n",
"encodeJSON",
"(",
"w",
",",
"http",
"."... | // Environment retrieves the global application configuration | [
"Environment",
"retrieves",
"the",
"global",
"application",
"configuration"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/env.go#L24-L27 |
124,003 | influxdata/influxdb | chronograf/server/logger.go | Logger | func Logger(logger chronograf.Logger, next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
now := time.Now()
logger.WithField("component", "server").
WithField("remote_addr", r.RemoteAddr).
WithField("method", r.Method).
WithField("url", r.URL).
Debug("Request")
sw ... | go | func Logger(logger chronograf.Logger, next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
now := time.Now()
logger.WithField("component", "server").
WithField("remote_addr", r.RemoteAddr).
WithField("method", r.Method).
WithField("url", r.URL).
Debug("Request")
sw ... | [
"func",
"Logger",
"(",
"logger",
"chronograf",
".",
"Logger",
",",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"fn",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"now",
... | // Logger is middleware that logs the request | [
"Logger",
"is",
"middleware",
"that",
"logs",
"the",
"request"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/logger.go#L35-L63 |
124,004 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | comparePrefix | func comparePrefix(a, b prefix) int {
au, bu := binary.BigEndian.Uint64(a[:8]), binary.BigEndian.Uint64(b[:8])
if au == bu {
return 0
} else if au < bu {
return -1
}
return 1
} | go | func comparePrefix(a, b prefix) int {
au, bu := binary.BigEndian.Uint64(a[:8]), binary.BigEndian.Uint64(b[:8])
if au == bu {
return 0
} else if au < bu {
return -1
}
return 1
} | [
"func",
"comparePrefix",
"(",
"a",
",",
"b",
"prefix",
")",
"int",
"{",
"au",
",",
"bu",
":=",
"binary",
".",
"BigEndian",
".",
"Uint64",
"(",
"a",
"[",
":",
"8",
"]",
")",
",",
"binary",
".",
"BigEndian",
".",
"Uint64",
"(",
"b",
"[",
":",
"8"... | // comparePrefix is like bytes.Compare but for a prefix. | [
"comparePrefix",
"is",
"like",
"bytes",
".",
"Compare",
"but",
"for",
"a",
"prefix",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L30-L38 |
124,005 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | keyPrefix | func keyPrefix(key []byte) (pre prefix) {
if len(key) >= prefixSize {
return *(*prefix)(unsafe.Pointer(&key[0]))
}
copy(pre[:], key)
return pre
} | go | func keyPrefix(key []byte) (pre prefix) {
if len(key) >= prefixSize {
return *(*prefix)(unsafe.Pointer(&key[0]))
}
copy(pre[:], key)
return pre
} | [
"func",
"keyPrefix",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"pre",
"prefix",
")",
"{",
"if",
"len",
"(",
"key",
")",
">=",
"prefixSize",
"{",
"return",
"*",
"(",
"*",
"prefix",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"key",
"[",
"0",
"]"... | // keyPrefix returns a prefix that can be used with compare
// to sort the same way the bytes would. | [
"keyPrefix",
"returns",
"a",
"prefix",
"that",
"can",
"be",
"used",
"with",
"compare",
"to",
"sort",
"the",
"same",
"way",
"the",
"bytes",
"would",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L42-L48 |
124,006 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | searchPrefix | func (r *readerOffsets) searchPrefix(n int) int {
i, j := 0, len(r.prefixes)
for i < j {
h := int(uint(i+j) >> 1)
if n >= r.prefixes[h].total {
i = h + 1
} else {
j = h
}
}
return i
} | go | func (r *readerOffsets) searchPrefix(n int) int {
i, j := 0, len(r.prefixes)
for i < j {
h := int(uint(i+j) >> 1)
if n >= r.prefixes[h].total {
i = h + 1
} else {
j = h
}
}
return i
} | [
"func",
"(",
"r",
"*",
"readerOffsets",
")",
"searchPrefix",
"(",
"n",
"int",
")",
"int",
"{",
"i",
",",
"j",
":=",
"0",
",",
"len",
"(",
"r",
".",
"prefixes",
")",
"\n",
"for",
"i",
"<",
"j",
"{",
"h",
":=",
"int",
"(",
"uint",
"(",
"i",
"... | // searchPrefix returns the index of the prefixEntry for the nth offset. | [
"searchPrefix",
"returns",
"the",
"index",
"of",
"the",
"prefixEntry",
"for",
"the",
"nth",
"offset",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L51-L62 |
124,007 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | AddKey | func (r *readerOffsets) AddKey(offset uint32, key []byte) {
r.offsets = append(r.offsets, offset)
pre := keyPrefix(key)
if r.entry.pre != pre && r.entry.total != 0 {
r.prefixes = append(r.prefixes, r.entry)
}
r.entry.pre = pre
r.entry.total++
} | go | func (r *readerOffsets) AddKey(offset uint32, key []byte) {
r.offsets = append(r.offsets, offset)
pre := keyPrefix(key)
if r.entry.pre != pre && r.entry.total != 0 {
r.prefixes = append(r.prefixes, r.entry)
}
r.entry.pre = pre
r.entry.total++
} | [
"func",
"(",
"r",
"*",
"readerOffsets",
")",
"AddKey",
"(",
"offset",
"uint32",
",",
"key",
"[",
"]",
"byte",
")",
"{",
"r",
".",
"offsets",
"=",
"append",
"(",
"r",
".",
"offsets",
",",
"offset",
")",
"\n",
"pre",
":=",
"keyPrefix",
"(",
"key",
... | // AddKey tracks the key in the readerOffsets at the given offset. | [
"AddKey",
"tracks",
"the",
"key",
"in",
"the",
"readerOffsets",
"at",
"the",
"given",
"offset",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L65-L73 |
124,008 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Done | func (r *readerOffsets) Done() {
r.prefixes = append(r.prefixes, r.entry)
} | go | func (r *readerOffsets) Done() {
r.prefixes = append(r.prefixes, r.entry)
} | [
"func",
"(",
"r",
"*",
"readerOffsets",
")",
"Done",
"(",
")",
"{",
"r",
".",
"prefixes",
"=",
"append",
"(",
"r",
".",
"prefixes",
",",
"r",
".",
"entry",
")",
"\n",
"}"
] | // done signals that we are done adding keys. | [
"done",
"signals",
"that",
"we",
"are",
"done",
"adding",
"keys",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L76-L78 |
124,009 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | setIndex | func (ri *readerOffsetsIterator) setIndex(i, pi int) {
ri.i, ri.pi, ri.ks = i, pi, rOIKeyState{}
} | go | func (ri *readerOffsetsIterator) setIndex(i, pi int) {
ri.i, ri.pi, ri.ks = i, pi, rOIKeyState{}
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"setIndex",
"(",
"i",
",",
"pi",
"int",
")",
"{",
"ri",
".",
"i",
",",
"ri",
".",
"pi",
",",
"ri",
".",
"ks",
"=",
"i",
",",
"pi",
",",
"rOIKeyState",
"{",
"}",
"\n",
"}"
] | // setIndex sets the reader to the given index and clears any cached state. | [
"setIndex",
"sets",
"the",
"reader",
"to",
"the",
"given",
"index",
"and",
"clears",
"any",
"cached",
"state",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L109-L111 |
124,010 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Length | func (ri *readerOffsetsIterator) Length(b *faultBuffer) uint16 {
if ri.ks.length == 0 {
buf := b.access(ri.Offset(), 2)
ri.ks.length = uint16(buf[0])<<8 | uint16(buf[1])
}
return ri.ks.length
} | go | func (ri *readerOffsetsIterator) Length(b *faultBuffer) uint16 {
if ri.ks.length == 0 {
buf := b.access(ri.Offset(), 2)
ri.ks.length = uint16(buf[0])<<8 | uint16(buf[1])
}
return ri.ks.length
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Length",
"(",
"b",
"*",
"faultBuffer",
")",
"uint16",
"{",
"if",
"ri",
".",
"ks",
".",
"length",
"==",
"0",
"{",
"buf",
":=",
"b",
".",
"access",
"(",
"ri",
".",
"Offset",
"(",
")",
",",
"2",... | // Length returns the length of the current pointed at key. | [
"Length",
"returns",
"the",
"length",
"of",
"the",
"current",
"pointed",
"at",
"key",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L114-L120 |
124,011 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Key | func (ri *readerOffsetsIterator) Key(b *faultBuffer) []byte {
if ri.ks.key == nil {
ri.ks.key = b.access(ri.KeyOffset(), uint32(ri.Length(b)))
}
return ri.ks.key
} | go | func (ri *readerOffsetsIterator) Key(b *faultBuffer) []byte {
if ri.ks.key == nil {
ri.ks.key = b.access(ri.KeyOffset(), uint32(ri.Length(b)))
}
return ri.ks.key
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Key",
"(",
"b",
"*",
"faultBuffer",
")",
"[",
"]",
"byte",
"{",
"if",
"ri",
".",
"ks",
".",
"key",
"==",
"nil",
"{",
"ri",
".",
"ks",
".",
"key",
"=",
"b",
".",
"access",
"(",
"ri",
".",
... | // Key returns the current pointed at key. | [
"Key",
"returns",
"the",
"current",
"pointed",
"at",
"key",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L123-L128 |
124,012 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Prefix | func (ri *readerOffsetsIterator) Prefix() prefix {
return ri.r.prefixes[ri.pi].pre
} | go | func (ri *readerOffsetsIterator) Prefix() prefix {
return ri.r.prefixes[ri.pi].pre
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Prefix",
"(",
")",
"prefix",
"{",
"return",
"ri",
".",
"r",
".",
"prefixes",
"[",
"ri",
".",
"pi",
"]",
".",
"pre",
"\n",
"}"
] | // Prefix returns the current pointed at prefix. | [
"Prefix",
"returns",
"the",
"current",
"pointed",
"at",
"prefix",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L141-L143 |
124,013 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Offset | func (ri *readerOffsetsIterator) Offset() uint32 {
return atomic.LoadUint32(&ri.r.offsets[ri.i]) &^ (1 << 31)
} | go | func (ri *readerOffsetsIterator) Offset() uint32 {
return atomic.LoadUint32(&ri.r.offsets[ri.i]) &^ (1 << 31)
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Offset",
"(",
")",
"uint32",
"{",
"return",
"atomic",
".",
"LoadUint32",
"(",
"&",
"ri",
".",
"r",
".",
"offsets",
"[",
"ri",
".",
"i",
"]",
")",
"&^",
"(",
"1",
"<<",
"31",
")",
"\n",
"}"
] | // Offset returns the current pointed at offset. | [
"Offset",
"returns",
"the",
"current",
"pointed",
"at",
"offset",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L146-L148 |
124,014 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Next | func (ri *readerOffsetsIterator) Next() bool {
if ri.i >= len(ri.r.offsets) {
return false
} else if ri.first {
ri.first = false
return true
}
ri.i++
ri.ks = rOIKeyState{}
for ri.pi < len(ri.r.prefixes) && ri.i >= ri.r.prefixes[ri.pi].total {
ri.pi++
}
return ri.i < len(ri.r.offsets)
} | go | func (ri *readerOffsetsIterator) Next() bool {
if ri.i >= len(ri.r.offsets) {
return false
} else if ri.first {
ri.first = false
return true
}
ri.i++
ri.ks = rOIKeyState{}
for ri.pi < len(ri.r.prefixes) && ri.i >= ri.r.prefixes[ri.pi].total {
ri.pi++
}
return ri.i < len(ri.r.offsets)
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Next",
"(",
")",
"bool",
"{",
"if",
"ri",
".",
"i",
">=",
"len",
"(",
"ri",
".",
"r",
".",
"offsets",
")",
"{",
"return",
"false",
"\n",
"}",
"else",
"if",
"ri",
".",
"first",
"{",
"ri",
".... | // Next advances the iterator and returns true if it points at a value. | [
"Next",
"advances",
"the",
"iterator",
"and",
"returns",
"true",
"if",
"it",
"points",
"at",
"a",
"value",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L151-L167 |
124,015 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Done | func (ri *readerOffsetsIterator) Done() {
if !ri.del {
return
}
ri.del = false
j, psub, pi := 0, 0, 0
for i, v := range ri.r.offsets {
for pi < len(ri.r.prefixes) && i >= ri.r.prefixes[pi].total {
ri.r.prefixes[pi].total -= psub
pi++
}
if v&(1<<31) > 0 {
psub++
continue
}
if i != j {
... | go | func (ri *readerOffsetsIterator) Done() {
if !ri.del {
return
}
ri.del = false
j, psub, pi := 0, 0, 0
for i, v := range ri.r.offsets {
for pi < len(ri.r.prefixes) && i >= ri.r.prefixes[pi].total {
ri.r.prefixes[pi].total -= psub
pi++
}
if v&(1<<31) > 0 {
psub++
continue
}
if i != j {
... | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Done",
"(",
")",
"{",
"if",
"!",
"ri",
".",
"del",
"{",
"return",
"\n",
"}",
"\n",
"ri",
".",
"del",
"=",
"false",
"\n\n",
"j",
",",
"psub",
",",
"pi",
":=",
"0",
",",
"0",
",",
"0",
"\n"... | // Done should be called to finalize up any deletes. Must be called under a write lock. | [
"Done",
"should",
"be",
"called",
"to",
"finalize",
"up",
"any",
"deletes",
".",
"Must",
"be",
"called",
"under",
"a",
"write",
"lock",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L170-L195 |
124,016 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Delete | func (ri *readerOffsetsIterator) Delete() {
ri.del = true
if offset := ri.Offset(); offset&(1<<31) == 0 {
atomic.StoreUint32(&ri.r.offsets[ri.i], offset|(1<<31))
}
} | go | func (ri *readerOffsetsIterator) Delete() {
ri.del = true
if offset := ri.Offset(); offset&(1<<31) == 0 {
atomic.StoreUint32(&ri.r.offsets[ri.i], offset|(1<<31))
}
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Delete",
"(",
")",
"{",
"ri",
".",
"del",
"=",
"true",
"\n",
"if",
"offset",
":=",
"ri",
".",
"Offset",
"(",
")",
";",
"offset",
"&",
"(",
"1",
"<<",
"31",
")",
"==",
"0",
"{",
"atomic",
".... | // Delete flags the entry to be deleted on the next call to Done. Is safe for
// concurrent use under a read lock, but Done must be called under a write lock. | [
"Delete",
"flags",
"the",
"entry",
"to",
"be",
"deleted",
"on",
"the",
"next",
"call",
"to",
"Done",
".",
"Is",
"safe",
"for",
"concurrent",
"use",
"under",
"a",
"read",
"lock",
"but",
"Done",
"must",
"be",
"called",
"under",
"a",
"write",
"lock",
"."
... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L199-L204 |
124,017 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | SetIndex | func (ri *readerOffsetsIterator) SetIndex(n int) {
ri.setIndex(n, ri.r.searchPrefix(n))
} | go | func (ri *readerOffsetsIterator) SetIndex(n int) {
ri.setIndex(n, ri.r.searchPrefix(n))
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"SetIndex",
"(",
"n",
"int",
")",
"{",
"ri",
".",
"setIndex",
"(",
"n",
",",
"ri",
".",
"r",
".",
"searchPrefix",
"(",
"n",
")",
")",
"\n",
"}"
] | // SetIndex sets the iterator to point at the nth element. | [
"SetIndex",
"sets",
"the",
"iterator",
"to",
"point",
"at",
"the",
"nth",
"element",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L245-L247 |
124,018 | influxdata/influxdb | tsdb/tsm1/reader_offsets.go | Compare | func (ri *readerOffsetsIterator) Compare(key []byte, pre prefix, b *faultBuffer) int {
if cmp := comparePrefix(ri.Prefix(), pre); cmp != 0 {
return cmp
}
return bytes.Compare(ri.Key(b), key)
} | go | func (ri *readerOffsetsIterator) Compare(key []byte, pre prefix, b *faultBuffer) int {
if cmp := comparePrefix(ri.Prefix(), pre); cmp != 0 {
return cmp
}
return bytes.Compare(ri.Key(b), key)
} | [
"func",
"(",
"ri",
"*",
"readerOffsetsIterator",
")",
"Compare",
"(",
"key",
"[",
"]",
"byte",
",",
"pre",
"prefix",
",",
"b",
"*",
"faultBuffer",
")",
"int",
"{",
"if",
"cmp",
":=",
"comparePrefix",
"(",
"ri",
".",
"Prefix",
"(",
")",
",",
"pre",
... | // Compare is like bytes.Compare with the pointed at key, but reduces the amount of faults. | [
"Compare",
"is",
"like",
"bytes",
".",
"Compare",
"with",
"the",
"pointed",
"at",
"key",
"but",
"reduces",
"the",
"amount",
"of",
"faults",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/reader_offsets.go#L250-L255 |
124,019 | influxdata/influxdb | authorizer/bucket.go | FindBucketByID | func (s *BucketService) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error) {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
b, err := s.s.FindBucketByID(ctx, id)
if err != nil {
return nil, err
}
if err := authorizeReadBucket(ctx, b.OrgID, id); err != nil {
ret... | go | func (s *BucketService) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error) {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
b, err := s.s.FindBucketByID(ctx, id)
if err != nil {
return nil, err
}
if err := authorizeReadBucket(ctx, b.OrgID, id); err != nil {
ret... | [
"func",
"(",
"s",
"*",
"BucketService",
")",
"FindBucketByID",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"influxdb",
".",
"ID",
")",
"(",
"*",
"influxdb",
".",
"Bucket",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"tracing",
".",
"Start... | // FindBucketByID checks to see if the authorizer on context has read access to the id provided. | [
"FindBucketByID",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"read",
"access",
"to",
"the",
"id",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/bucket.go#L59-L73 |
124,020 | influxdata/influxdb | authorizer/bucket.go | FindBucket | func (s *BucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error) {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
b, err := s.s.FindBucket(ctx, filter)
if err != nil {
return nil, err
}
if err := authorizeReadBucket(ctx, b.OrgID, b.ID); err !=... | go | func (s *BucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error) {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
b, err := s.s.FindBucket(ctx, filter)
if err != nil {
return nil, err
}
if err := authorizeReadBucket(ctx, b.OrgID, b.ID); err !=... | [
"func",
"(",
"s",
"*",
"BucketService",
")",
"FindBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"influxdb",
".",
"BucketFilter",
")",
"(",
"*",
"influxdb",
".",
"Bucket",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"tracing",
"."... | // FindBucket retrieves the bucket and checks to see if the authorizer on context has read access to the bucket. | [
"FindBucket",
"retrieves",
"the",
"bucket",
"and",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"read",
"access",
"to",
"the",
"bucket",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/bucket.go#L76-L90 |
124,021 | influxdata/influxdb | authorizer/bucket.go | FindBuckets | func (s *BucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error) {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
// TODO: we'll likely want to push this operation into the database eventually since fetching the ... | go | func (s *BucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error) {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
// TODO: we'll likely want to push this operation into the database eventually since fetching the ... | [
"func",
"(",
"s",
"*",
"BucketService",
")",
"FindBuckets",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"influxdb",
".",
"BucketFilter",
",",
"opt",
"...",
"influxdb",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"influxdb",
".",
"Bucket",
",",... | // FindBuckets retrieves all buckets that match the provided filter and then filters the list down to only the resources that are authorized. | [
"FindBuckets",
"retrieves",
"all",
"buckets",
"that",
"match",
"the",
"provided",
"filter",
"and",
"then",
"filters",
"the",
"list",
"down",
"to",
"only",
"the",
"resources",
"that",
"are",
"authorized",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/bucket.go#L93-L121 |
124,022 | influxdata/influxdb | authorizer/bucket.go | CreateBucket | func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.BucketsResourceType, b.OrgID)
if err != nil {
return err
}
if err := IsAllowed(ctx, *p); err ... | go | func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error {
span, ctx := tracing.StartSpanFromContext(ctx)
defer span.Finish()
p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.BucketsResourceType, b.OrgID)
if err != nil {
return err
}
if err := IsAllowed(ctx, *p); err ... | [
"func",
"(",
"s",
"*",
"BucketService",
")",
"CreateBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"b",
"*",
"influxdb",
".",
"Bucket",
")",
"error",
"{",
"span",
",",
"ctx",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
")",
"\n",
"d... | // CreateBucket checks to see if the authorizer on context has write access to the global buckets resource. | [
"CreateBucket",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"global",
"buckets",
"resource",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/bucket.go#L124-L138 |
124,023 | influxdata/influxdb | authorizer/bucket.go | UpdateBucket | func (s *BucketService) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error) {
b, err := s.s.FindBucketByID(ctx, id)
if err != nil {
return nil, err
}
if err := authorizeWriteBucket(ctx, b.OrgID, id); err != nil {
return nil, err
}
return s.s.UpdateBucket(ct... | go | func (s *BucketService) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error) {
b, err := s.s.FindBucketByID(ctx, id)
if err != nil {
return nil, err
}
if err := authorizeWriteBucket(ctx, b.OrgID, id); err != nil {
return nil, err
}
return s.s.UpdateBucket(ct... | [
"func",
"(",
"s",
"*",
"BucketService",
")",
"UpdateBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"influxdb",
".",
"ID",
",",
"upd",
"influxdb",
".",
"BucketUpdate",
")",
"(",
"*",
"influxdb",
".",
"Bucket",
",",
"error",
")",
"{",
"b",
... | // UpdateBucket checks to see if the authorizer on context has write access to the bucket provided. | [
"UpdateBucket",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"bucket",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/bucket.go#L141-L152 |
124,024 | influxdata/influxdb | authorizer/bucket.go | DeleteBucket | func (s *BucketService) DeleteBucket(ctx context.Context, id influxdb.ID) error {
b, err := s.s.FindBucketByID(ctx, id)
if err != nil {
return err
}
if err := authorizeWriteBucket(ctx, b.OrgID, id); err != nil {
return err
}
return s.s.DeleteBucket(ctx, id)
} | go | func (s *BucketService) DeleteBucket(ctx context.Context, id influxdb.ID) error {
b, err := s.s.FindBucketByID(ctx, id)
if err != nil {
return err
}
if err := authorizeWriteBucket(ctx, b.OrgID, id); err != nil {
return err
}
return s.s.DeleteBucket(ctx, id)
} | [
"func",
"(",
"s",
"*",
"BucketService",
")",
"DeleteBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"influxdb",
".",
"ID",
")",
"error",
"{",
"b",
",",
"err",
":=",
"s",
".",
"s",
".",
"FindBucketByID",
"(",
"ctx",
",",
"id",
")",
"\n",
... | // DeleteBucket checks to see if the authorizer on context has write access to the bucket provided. | [
"DeleteBucket",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"bucket",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/bucket.go#L155-L166 |
124,025 | influxdata/influxdb | tsdb/tsm1/stats.go | MeasurementNames | func (s MeasurementStats) MeasurementNames() []string {
a := make([]string, 0, len(s))
for name := range s {
a = append(a, name)
}
sort.Strings(a)
return a
} | go | func (s MeasurementStats) MeasurementNames() []string {
a := make([]string, 0, len(s))
for name := range s {
a = append(a, name)
}
sort.Strings(a)
return a
} | [
"func",
"(",
"s",
"MeasurementStats",
")",
"MeasurementNames",
"(",
")",
"[",
"]",
"string",
"{",
"a",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"s",
")",
")",
"\n",
"for",
"name",
":=",
"range",
"s",
"{",
"a",
"=",
"app... | // MeasurementNames returns a list of sorted measurement names. | [
"MeasurementNames",
"returns",
"a",
"list",
"of",
"sorted",
"measurement",
"names",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/stats.go#L33-L40 |
124,026 | influxdata/influxdb | tsdb/tsm1/stats.go | StatsFilename | func StatsFilename(tsmPath string) string {
if strings.HasSuffix(tsmPath, "."+TmpTSMFileExtension) {
tsmPath = strings.TrimSuffix(tsmPath, "."+TmpTSMFileExtension)
}
if strings.HasSuffix(tsmPath, "."+TSMFileExtension) {
tsmPath = strings.TrimSuffix(tsmPath, "."+TSMFileExtension)
}
return tsmPath + "." + TSSFil... | go | func StatsFilename(tsmPath string) string {
if strings.HasSuffix(tsmPath, "."+TmpTSMFileExtension) {
tsmPath = strings.TrimSuffix(tsmPath, "."+TmpTSMFileExtension)
}
if strings.HasSuffix(tsmPath, "."+TSMFileExtension) {
tsmPath = strings.TrimSuffix(tsmPath, "."+TSMFileExtension)
}
return tsmPath + "." + TSSFil... | [
"func",
"StatsFilename",
"(",
"tsmPath",
"string",
")",
"string",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"tsmPath",
",",
"\"",
"\"",
"+",
"TmpTSMFileExtension",
")",
"{",
"tsmPath",
"=",
"strings",
".",
"TrimSuffix",
"(",
"tsmPath",
",",
"\"",
"\"",
... | // StatsFilename returns the path to the stats file for a given TSM file path. | [
"StatsFilename",
"returns",
"the",
"path",
"to",
"the",
"stats",
"file",
"for",
"a",
"given",
"TSM",
"file",
"path",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/stats.go#L213-L221 |
124,027 | influxdata/influxdb | chronograf/bolt/util.go | itob | func itob(v int) []byte {
b := make([]byte, 8)
binary.BigEndian.PutUint64(b, uint64(v))
return b
} | go | func itob(v int) []byte {
b := make([]byte, 8)
binary.BigEndian.PutUint64(b, uint64(v))
return b
} | [
"func",
"itob",
"(",
"v",
"int",
")",
"[",
"]",
"byte",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"8",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint64",
"(",
"b",
",",
"uint64",
"(",
"v",
")",
")",
"\n",
"return",
"b",
"\n",
... | // itob returns an 8-byte big endian representation of v. | [
"itob",
"returns",
"an",
"8",
"-",
"byte",
"big",
"endian",
"representation",
"of",
"v",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/util.go#L8-L12 |
124,028 | influxdata/influxdb | inmem/dbrp_mapping_service.go | FindBy | func (s *Service) FindBy(ctx context.Context, cluster, db, rp string) (*platform.DBRPMapping, error) {
return s.loadDBRPMapping(ctx, cluster, db, rp)
} | go | func (s *Service) FindBy(ctx context.Context, cluster, db, rp string) (*platform.DBRPMapping, error) {
return s.loadDBRPMapping(ctx, cluster, db, rp)
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"FindBy",
"(",
"ctx",
"context",
".",
"Context",
",",
"cluster",
",",
"db",
",",
"rp",
"string",
")",
"(",
"*",
"platform",
".",
"DBRPMapping",
",",
"error",
")",
"{",
"return",
"s",
".",
"loadDBRPMapping",
"(",... | // FindBy returns a single dbrp mapping by cluster, db and rp. | [
"FindBy",
"returns",
"a",
"single",
"dbrp",
"mapping",
"by",
"cluster",
"db",
"and",
"rp",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/dbrp_mapping_service.go#L35-L37 |
124,029 | influxdata/influxdb | inmem/dbrp_mapping_service.go | Find | func (s *Service) Find(ctx context.Context, filter platform.DBRPMappingFilter) (*platform.DBRPMapping, error) {
if filter.Cluster == nil && filter.Database == nil && filter.RetentionPolicy == nil {
return nil, fmt.Errorf("no filter parameters provided")
}
// filter by dbrpMapping id
if filter.Cluster != nil && f... | go | func (s *Service) Find(ctx context.Context, filter platform.DBRPMappingFilter) (*platform.DBRPMapping, error) {
if filter.Cluster == nil && filter.Database == nil && filter.RetentionPolicy == nil {
return nil, fmt.Errorf("no filter parameters provided")
}
// filter by dbrpMapping id
if filter.Cluster != nil && f... | [
"func",
"(",
"s",
"*",
"Service",
")",
"Find",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"platform",
".",
"DBRPMappingFilter",
")",
"(",
"*",
"platform",
".",
"DBRPMapping",
",",
"error",
")",
"{",
"if",
"filter",
".",
"Cluster",
"==",
"nil... | // Find returns the first dbrp mapping that matches filter. | [
"Find",
"returns",
"the",
"first",
"dbrp",
"mapping",
"that",
"matches",
"filter",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/dbrp_mapping_service.go#L70-L90 |
124,030 | influxdata/influxdb | inmem/dbrp_mapping_service.go | FindMany | func (s *Service) FindMany(ctx context.Context, filter platform.DBRPMappingFilter, opt ...platform.FindOptions) ([]*platform.DBRPMapping, int, error) {
// filter by dbrpMapping id
if filter.Cluster != nil && filter.Database != nil && filter.RetentionPolicy != nil {
m, err := s.FindBy(ctx, *filter.Cluster, *filter.D... | go | func (s *Service) FindMany(ctx context.Context, filter platform.DBRPMappingFilter, opt ...platform.FindOptions) ([]*platform.DBRPMapping, int, error) {
// filter by dbrpMapping id
if filter.Cluster != nil && filter.Database != nil && filter.RetentionPolicy != nil {
m, err := s.FindBy(ctx, *filter.Cluster, *filter.D... | [
"func",
"(",
"s",
"*",
"Service",
")",
"FindMany",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"platform",
".",
"DBRPMappingFilter",
",",
"opt",
"...",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"DBRPMapping",
","... | // FindMany returns a list of dbrpMappings that match filter and the total count of matching dbrp mappings.
// Additional options provide pagination & sorting. | [
"FindMany",
"returns",
"a",
"list",
"of",
"dbrpMappings",
"that",
"match",
"filter",
"and",
"the",
"total",
"count",
"of",
"matching",
"dbrp",
"mappings",
".",
"Additional",
"options",
"provide",
"pagination",
"&",
"sorting",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/dbrp_mapping_service.go#L94-L117 |
124,031 | influxdata/influxdb | inmem/dbrp_mapping_service.go | Create | func (s *Service) Create(ctx context.Context, m *platform.DBRPMapping) error {
if err := m.Validate(); err != nil {
return nil
}
existing, err := s.loadDBRPMapping(ctx, m.Cluster, m.Database, m.RetentionPolicy)
if err != nil {
if err == errDBRPMappingNotFound {
return s.PutDBRPMapping(ctx, m)
}
return er... | go | func (s *Service) Create(ctx context.Context, m *platform.DBRPMapping) error {
if err := m.Validate(); err != nil {
return nil
}
existing, err := s.loadDBRPMapping(ctx, m.Cluster, m.Database, m.RetentionPolicy)
if err != nil {
if err == errDBRPMappingNotFound {
return s.PutDBRPMapping(ctx, m)
}
return er... | [
"func",
"(",
"s",
"*",
"Service",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"*",
"platform",
".",
"DBRPMapping",
")",
"error",
"{",
"if",
"err",
":=",
"m",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"... | // Create creates a new dbrp mapping. | [
"Create",
"creates",
"a",
"new",
"dbrp",
"mapping",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/dbrp_mapping_service.go#L120-L137 |
124,032 | influxdata/influxdb | inmem/dbrp_mapping_service.go | PutDBRPMapping | func (s *Service) PutDBRPMapping(ctx context.Context, m *platform.DBRPMapping) error {
k := encodeDBRPMappingKey(m.Cluster, m.Database, m.RetentionPolicy)
s.dbrpMappingKV.Store(k, *m)
return nil
} | go | func (s *Service) PutDBRPMapping(ctx context.Context, m *platform.DBRPMapping) error {
k := encodeDBRPMappingKey(m.Cluster, m.Database, m.RetentionPolicy)
s.dbrpMappingKV.Store(k, *m)
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"PutDBRPMapping",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"*",
"platform",
".",
"DBRPMapping",
")",
"error",
"{",
"k",
":=",
"encodeDBRPMappingKey",
"(",
"m",
".",
"Cluster",
",",
"m",
".",
"Database",
",... | // PutDBRPMapping sets dbrpMapping with the current ID. | [
"PutDBRPMapping",
"sets",
"dbrpMapping",
"with",
"the",
"current",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/dbrp_mapping_service.go#L140-L144 |
124,033 | influxdata/influxdb | inmem/dbrp_mapping_service.go | Delete | func (s *Service) Delete(ctx context.Context, cluster, db, rp string) error {
s.dbrpMappingKV.Delete(encodeDBRPMappingKey(cluster, db, rp))
return nil
} | go | func (s *Service) Delete(ctx context.Context, cluster, db, rp string) error {
s.dbrpMappingKV.Delete(encodeDBRPMappingKey(cluster, db, rp))
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"cluster",
",",
"db",
",",
"rp",
"string",
")",
"error",
"{",
"s",
".",
"dbrpMappingKV",
".",
"Delete",
"(",
"encodeDBRPMappingKey",
"(",
"cluster",
",",
"db",... | // Delete removes a dbrp mapping | [
"Delete",
"removes",
"a",
"dbrp",
"mapping"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/dbrp_mapping_service.go#L147-L150 |
124,034 | influxdata/influxdb | bolt/id.go | ID | func (c *Client) ID() platform.ID {
// if any error occurs return a random number
id := platform.ID(rand.Int63())
err := c.db.View(func(tx *bolt.Tx) error {
val, err := c.getID(tx)
if err != nil {
return err
}
id = val
return nil
})
if err != nil {
c.Logger.Error("unable to load id", zap.Error(err... | go | func (c *Client) ID() platform.ID {
// if any error occurs return a random number
id := platform.ID(rand.Int63())
err := c.db.View(func(tx *bolt.Tx) error {
val, err := c.getID(tx)
if err != nil {
return err
}
id = val
return nil
})
if err != nil {
c.Logger.Error("unable to load id", zap.Error(err... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ID",
"(",
")",
"platform",
".",
"ID",
"{",
"// if any error occurs return a random number",
"id",
":=",
"platform",
".",
"ID",
"(",
"rand",
".",
"Int63",
"(",
")",
")",
"\n",
"err",
":=",
"c",
".",
"db",
".",
"V... | // ID retrieves the unique ID for this influx instance. | [
"ID",
"retrieves",
"the",
"unique",
"ID",
"for",
"this",
"influx",
"instance",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/bolt/id.go#L41-L59 |
124,035 | influxdata/influxdb | kv/urm.go | ErrUnprocessableMapping | func ErrUnprocessableMapping(err error) *influxdb.Error {
return &influxdb.Error{
Code: influxdb.EUnprocessableEntity,
Msg: fmt.Sprintf("unable to convert mapping of user to resource into JSON; Err %v", err),
}
} | go | func ErrUnprocessableMapping(err error) *influxdb.Error {
return &influxdb.Error{
Code: influxdb.EUnprocessableEntity,
Msg: fmt.Sprintf("unable to convert mapping of user to resource into JSON; Err %v", err),
}
} | [
"func",
"ErrUnprocessableMapping",
"(",
"err",
"error",
")",
"*",
"influxdb",
".",
"Error",
"{",
"return",
"&",
"influxdb",
".",
"Error",
"{",
"Code",
":",
"influxdb",
".",
"EUnprocessableEntity",
",",
"Msg",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
... | // ErrUnprocessableMapping is used when a user resource mapping is not able to be converted to JSON. | [
"ErrUnprocessableMapping",
"is",
"used",
"when",
"a",
"user",
"resource",
"mapping",
"is",
"not",
"able",
"to",
"be",
"converted",
"to",
"JSON",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/urm.go#L51-L56 |
124,036 | influxdata/influxdb | kv/urm.go | NonUniqueMappingError | func NonUniqueMappingError(userID influxdb.ID) error {
return &influxdb.Error{
Code: influxdb.EInternal,
Msg: fmt.Sprintf("Unexpected error when assigning user to a resource: mapping for user %s already exists", userID.String()),
}
} | go | func NonUniqueMappingError(userID influxdb.ID) error {
return &influxdb.Error{
Code: influxdb.EInternal,
Msg: fmt.Sprintf("Unexpected error when assigning user to a resource: mapping for user %s already exists", userID.String()),
}
} | [
"func",
"NonUniqueMappingError",
"(",
"userID",
"influxdb",
".",
"ID",
")",
"error",
"{",
"return",
"&",
"influxdb",
".",
"Error",
"{",
"Code",
":",
"influxdb",
".",
"EInternal",
",",
"Msg",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"userID",
"... | // NonUniqueMappingError is an internal error when a user already has
// been mapped to a resource | [
"NonUniqueMappingError",
"is",
"an",
"internal",
"error",
"when",
"a",
"user",
"already",
"has",
"been",
"mapped",
"to",
"a",
"resource"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/urm.go#L60-L65 |
124,037 | influxdata/influxdb | kv/urm.go | CreateUserResourceMapping | func (s *Service) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error {
return s.kv.Update(ctx, func(tx Tx) error {
return s.createUserResourceMapping(ctx, tx, m)
})
} | go | func (s *Service) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error {
return s.kv.Update(ctx, func(tx Tx) error {
return s.createUserResourceMapping(ctx, tx, m)
})
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"CreateUserResourceMapping",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"*",
"influxdb",
".",
"UserResourceMapping",
")",
"error",
"{",
"return",
"s",
".",
"kv",
".",
"Update",
"(",
"ctx",
",",
"func",
"(",
... | // CreateUserResourceMapping associates a user to a resource either as a member
// or owner. | [
"CreateUserResourceMapping",
"associates",
"a",
"user",
"to",
"a",
"resource",
"either",
"as",
"a",
"member",
"or",
"owner",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kv/urm.go#L127-L131 |
124,038 | influxdata/influxdb | query/query.go | SeekTime | func (opt IteratorOptions) SeekTime() int64 {
if opt.Ascending {
return opt.StartTime
}
return opt.EndTime
} | go | func (opt IteratorOptions) SeekTime() int64 {
if opt.Ascending {
return opt.StartTime
}
return opt.EndTime
} | [
"func",
"(",
"opt",
"IteratorOptions",
")",
"SeekTime",
"(",
")",
"int64",
"{",
"if",
"opt",
".",
"Ascending",
"{",
"return",
"opt",
".",
"StartTime",
"\n",
"}",
"\n",
"return",
"opt",
".",
"EndTime",
"\n",
"}"
] | // SeekTime returns the time the iterator should start from.
// For ascending iterators this is the start time, for descending iterators it's the end time. | [
"SeekTime",
"returns",
"the",
"time",
"the",
"iterator",
"should",
"start",
"from",
".",
"For",
"ascending",
"iterators",
"this",
"is",
"the",
"start",
"time",
"for",
"descending",
"iterators",
"it",
"s",
"the",
"end",
"time",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/query.go#L82-L87 |
124,039 | influxdata/influxdb | query/query.go | StopTime | func (opt IteratorOptions) StopTime() int64 {
if opt.Ascending {
return opt.EndTime
}
return opt.StartTime
} | go | func (opt IteratorOptions) StopTime() int64 {
if opt.Ascending {
return opt.EndTime
}
return opt.StartTime
} | [
"func",
"(",
"opt",
"IteratorOptions",
")",
"StopTime",
"(",
")",
"int64",
"{",
"if",
"opt",
".",
"Ascending",
"{",
"return",
"opt",
".",
"EndTime",
"\n",
"}",
"\n",
"return",
"opt",
".",
"StartTime",
"\n",
"}"
] | // StopTime returns the time the iterator should end at.
// For ascending iterators this is the end time, for descending iterators it's the start time. | [
"StopTime",
"returns",
"the",
"time",
"the",
"iterator",
"should",
"end",
"at",
".",
"For",
"ascending",
"iterators",
"this",
"is",
"the",
"end",
"time",
"for",
"descending",
"iterators",
"it",
"s",
"the",
"start",
"time",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/query.go#L91-L96 |
124,040 | influxdata/influxdb | query/query.go | AddFilter | func (t *TagSet) AddFilter(key string, filter influxql.Expr) {
t.SeriesKeys = append(t.SeriesKeys, key)
t.Filters = append(t.Filters, filter)
} | go | func (t *TagSet) AddFilter(key string, filter influxql.Expr) {
t.SeriesKeys = append(t.SeriesKeys, key)
t.Filters = append(t.Filters, filter)
} | [
"func",
"(",
"t",
"*",
"TagSet",
")",
"AddFilter",
"(",
"key",
"string",
",",
"filter",
"influxql",
".",
"Expr",
")",
"{",
"t",
".",
"SeriesKeys",
"=",
"append",
"(",
"t",
".",
"SeriesKeys",
",",
"key",
")",
"\n",
"t",
".",
"Filters",
"=",
"append"... | // AddFilter adds a series-level filter to the Tagset. | [
"AddFilter",
"adds",
"a",
"series",
"-",
"level",
"filter",
"to",
"the",
"Tagset",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/query.go#L165-L168 |
124,041 | influxdata/influxdb | query/query.go | Reverse | func (t *TagSet) Reverse() {
for i, j := 0, len(t.Filters)-1; i < j; i, j = i+1, j-1 {
t.Filters[i], t.Filters[j] = t.Filters[j], t.Filters[i]
t.SeriesKeys[i], t.SeriesKeys[j] = t.SeriesKeys[j], t.SeriesKeys[i]
}
} | go | func (t *TagSet) Reverse() {
for i, j := 0, len(t.Filters)-1; i < j; i, j = i+1, j-1 {
t.Filters[i], t.Filters[j] = t.Filters[j], t.Filters[i]
t.SeriesKeys[i], t.SeriesKeys[j] = t.SeriesKeys[j], t.SeriesKeys[i]
}
} | [
"func",
"(",
"t",
"*",
"TagSet",
")",
"Reverse",
"(",
")",
"{",
"for",
"i",
",",
"j",
":=",
"0",
",",
"len",
"(",
"t",
".",
"Filters",
")",
"-",
"1",
";",
"i",
"<",
"j",
";",
"i",
",",
"j",
"=",
"i",
"+",
"1",
",",
"j",
"-",
"1",
"{",... | // Reverse reverses the order of series keys and filters in the TagSet. | [
"Reverse",
"reverses",
"the",
"order",
"of",
"series",
"keys",
"and",
"filters",
"in",
"the",
"TagSet",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/query.go#L178-L183 |
124,042 | influxdata/influxdb | query/query.go | Combine | func (c IteratorCost) Combine(other IteratorCost) IteratorCost {
return IteratorCost{
NumShards: c.NumShards + other.NumShards,
NumSeries: c.NumSeries + other.NumSeries,
CachedValues: c.CachedValues + other.CachedValues,
NumFiles: c.NumFiles + other.NumFiles,
BlocksRead: c.BlocksRead + other.Bloc... | go | func (c IteratorCost) Combine(other IteratorCost) IteratorCost {
return IteratorCost{
NumShards: c.NumShards + other.NumShards,
NumSeries: c.NumSeries + other.NumSeries,
CachedValues: c.CachedValues + other.CachedValues,
NumFiles: c.NumFiles + other.NumFiles,
BlocksRead: c.BlocksRead + other.Bloc... | [
"func",
"(",
"c",
"IteratorCost",
")",
"Combine",
"(",
"other",
"IteratorCost",
")",
"IteratorCost",
"{",
"return",
"IteratorCost",
"{",
"NumShards",
":",
"c",
".",
"NumShards",
"+",
"other",
".",
"NumShards",
",",
"NumSeries",
":",
"c",
".",
"NumSeries",
... | // Combine combines the results of two IteratorCost structures into one. | [
"Combine",
"combines",
"the",
"results",
"of",
"two",
"IteratorCost",
"structures",
"into",
"one",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/query.go#L213-L222 |
124,043 | influxdata/influxdb | query/query.go | AuthorizeSeriesWrite | func (a openAuthorizer) AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool {
return true
} | go | func (a openAuthorizer) AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool {
return true
} | [
"func",
"(",
"a",
"openAuthorizer",
")",
"AuthorizeSeriesWrite",
"(",
"database",
"string",
",",
"measurement",
"[",
"]",
"byte",
",",
"tags",
"models",
".",
"Tags",
")",
"bool",
"{",
"return",
"true",
"\n",
"}"
] | // AuthorizeSeriesWrite allows access to any series. | [
"AuthorizeSeriesWrite",
"allows",
"access",
"to",
"any",
"series",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/query/query.go#L498-L500 |
124,044 | influxdata/influxdb | kit/tracing/tracing.go | InjectToHTTPRequest | func InjectToHTTPRequest(span opentracing.Span, req *http.Request) {
err := opentracing.GlobalTracer().Inject(span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))
if err != nil {
LogError(span, err)
}
} | go | func InjectToHTTPRequest(span opentracing.Span, req *http.Request) {
err := opentracing.GlobalTracer().Inject(span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))
if err != nil {
LogError(span, err)
}
} | [
"func",
"InjectToHTTPRequest",
"(",
"span",
"opentracing",
".",
"Span",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"err",
":=",
"opentracing",
".",
"GlobalTracer",
"(",
")",
".",
"Inject",
"(",
"span",
".",
"Context",
"(",
")",
",",
"opentracing"... | // InjectToHTTPRequest adds tracing headers to an HTTP request.
// Easier than adding this boilerplate everywhere. | [
"InjectToHTTPRequest",
"adds",
"tracing",
"headers",
"to",
"an",
"HTTP",
"request",
".",
"Easier",
"than",
"adding",
"this",
"boilerplate",
"everywhere",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/tracing/tracing.go#L36-L41 |
124,045 | influxdata/influxdb | kit/tracing/tracing.go | ExtractFromHTTPRequest | func ExtractFromHTTPRequest(req *http.Request, handlerName string) (opentracing.Span, *http.Request) {
spanContext, err := opentracing.GlobalTracer().Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))
if err != nil {
span, ctx := opentracing.StartSpanFromContext(req.Context(), handlerName+... | go | func ExtractFromHTTPRequest(req *http.Request, handlerName string) (opentracing.Span, *http.Request) {
spanContext, err := opentracing.GlobalTracer().Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))
if err != nil {
span, ctx := opentracing.StartSpanFromContext(req.Context(), handlerName+... | [
"func",
"ExtractFromHTTPRequest",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"handlerName",
"string",
")",
"(",
"opentracing",
".",
"Span",
",",
"*",
"http",
".",
"Request",
")",
"{",
"spanContext",
",",
"err",
":=",
"opentracing",
".",
"GlobalTracer",
... | // ExtractFromHTTPRequest gets a child span of the parent referenced in HTTP request headers.
// Returns the request with updated tracing context.
// Easier than adding this boilerplate everywhere. | [
"ExtractFromHTTPRequest",
"gets",
"a",
"child",
"span",
"of",
"the",
"parent",
"referenced",
"in",
"HTTP",
"request",
"headers",
".",
"Returns",
"the",
"request",
"with",
"updated",
"tracing",
"context",
".",
"Easier",
"than",
"adding",
"this",
"boilerplate",
"e... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/tracing/tracing.go#L46-L58 |
124,046 | influxdata/influxdb | kit/tracing/tracing.go | StartSpanFromContextWithOperationName | func StartSpanFromContextWithOperationName(ctx context.Context, operationName string) (opentracing.Span, context.Context) {
if ctx == nil {
panic("StartSpanFromContextWithOperationName called with nil context")
}
// Get caller frame.
var pcs [1]uintptr
n := runtime.Callers(2, pcs[:])
if n < 1 {
span, ctx := ... | go | func StartSpanFromContextWithOperationName(ctx context.Context, operationName string) (opentracing.Span, context.Context) {
if ctx == nil {
panic("StartSpanFromContextWithOperationName called with nil context")
}
// Get caller frame.
var pcs [1]uintptr
n := runtime.Callers(2, pcs[:])
if n < 1 {
span, ctx := ... | [
"func",
"StartSpanFromContextWithOperationName",
"(",
"ctx",
"context",
".",
"Context",
",",
"operationName",
"string",
")",
"(",
"opentracing",
".",
"Span",
",",
"context",
".",
"Context",
")",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
... | // StartSpanFromContextWithOperationName is like StartSpanFromContext, but the caller determines the operation name. | [
"StartSpanFromContextWithOperationName",
"is",
"like",
"StartSpanFromContext",
"but",
"the",
"caller",
"determines",
"the",
"operation",
"name",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/kit/tracing/tracing.go#L122-L151 |
124,047 | influxdata/influxdb | authz.go | PermissionAllowed | func PermissionAllowed(perm Permission, ps []Permission) bool {
for _, p := range ps {
if p.Matches(perm) {
return true
}
}
return false
} | go | func PermissionAllowed(perm Permission, ps []Permission) bool {
for _, p := range ps {
if p.Matches(perm) {
return true
}
}
return false
} | [
"func",
"PermissionAllowed",
"(",
"perm",
"Permission",
",",
"ps",
"[",
"]",
"Permission",
")",
"bool",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"ps",
"{",
"if",
"p",
".",
"Matches",
"(",
"perm",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
... | // PermissionAllowed determines if a permission is allowed. | [
"PermissionAllowed",
"determines",
"if",
"a",
"permission",
"is",
"allowed",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L34-L41 |
124,048 | influxdata/influxdb | authz.go | Valid | func (a Action) Valid() (err error) {
switch a {
case ReadAction: // 1
case WriteAction: // 2
default:
err = ErrInvalidAction
}
return err
} | go | func (a Action) Valid() (err error) {
switch a {
case ReadAction: // 1
case WriteAction: // 2
default:
err = ErrInvalidAction
}
return err
} | [
"func",
"(",
"a",
"Action",
")",
"Valid",
"(",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"a",
"{",
"case",
"ReadAction",
":",
"// 1",
"case",
"WriteAction",
":",
"// 2",
"default",
":",
"err",
"=",
"ErrInvalidAction",
"\n",
"}",
"\n\n",
"return",
... | // Valid checks if the action is a member of the Action enum | [
"Valid",
"checks",
"if",
"the",
"action",
"is",
"a",
"member",
"of",
"the",
"Action",
"enum"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L59-L68 |
124,049 | influxdata/influxdb | authz.go | String | func (r Resource) String() string {
if r.OrgID != nil && r.ID != nil {
return filepath.Join(string(OrgsResourceType), r.OrgID.String(), string(r.Type), r.ID.String())
}
if r.OrgID != nil {
return filepath.Join(string(OrgsResourceType), r.OrgID.String(), string(r.Type))
}
if r.ID != nil {
return filepath.Jo... | go | func (r Resource) String() string {
if r.OrgID != nil && r.ID != nil {
return filepath.Join(string(OrgsResourceType), r.OrgID.String(), string(r.Type), r.ID.String())
}
if r.OrgID != nil {
return filepath.Join(string(OrgsResourceType), r.OrgID.String(), string(r.Type))
}
if r.ID != nil {
return filepath.Jo... | [
"func",
"(",
"r",
"Resource",
")",
"String",
"(",
")",
"string",
"{",
"if",
"r",
".",
"OrgID",
"!=",
"nil",
"&&",
"r",
".",
"ID",
"!=",
"nil",
"{",
"return",
"filepath",
".",
"Join",
"(",
"string",
"(",
"OrgsResourceType",
")",
",",
"r",
".",
"Or... | // String stringifies a resource | [
"String",
"stringifies",
"a",
"resource"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L81-L95 |
124,050 | influxdata/influxdb | authz.go | Valid | func (t ResourceType) Valid() (err error) {
switch t {
case AuthorizationsResourceType: // 0
case BucketsResourceType: // 1
case DashboardsResourceType: // 2
case OrgsResourceType: // 3
case TasksResourceType: // 4
case TelegrafsResourceType: // 5
case SourcesResourceType: // 6
case UsersResourceType: // 7
ca... | go | func (t ResourceType) Valid() (err error) {
switch t {
case AuthorizationsResourceType: // 0
case BucketsResourceType: // 1
case DashboardsResourceType: // 2
case OrgsResourceType: // 3
case TasksResourceType: // 4
case TelegrafsResourceType: // 5
case SourcesResourceType: // 6
case UsersResourceType: // 7
ca... | [
"func",
"(",
"t",
"ResourceType",
")",
"Valid",
"(",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"t",
"{",
"case",
"AuthorizationsResourceType",
":",
"// 0",
"case",
"BucketsResourceType",
":",
"// 1",
"case",
"DashboardsResourceType",
":",
"// 2",
"case",
... | // Valid checks if the resource type is a member of the ResourceType enum. | [
"Valid",
"checks",
"if",
"the",
"resource",
"type",
"is",
"a",
"member",
"of",
"the",
"ResourceType",
"enum",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L165-L186 |
124,051 | influxdata/influxdb | authz.go | Matches | func (p Permission) Matches(perm Permission) bool {
if p.Action != perm.Action {
return false
}
if p.Resource.Type != perm.Resource.Type {
return false
}
if p.Resource.OrgID == nil && p.Resource.ID == nil {
return true
}
if p.Resource.OrgID != nil && p.Resource.ID == nil {
pOrgID := *p.Resource.OrgID
... | go | func (p Permission) Matches(perm Permission) bool {
if p.Action != perm.Action {
return false
}
if p.Resource.Type != perm.Resource.Type {
return false
}
if p.Resource.OrgID == nil && p.Resource.ID == nil {
return true
}
if p.Resource.OrgID != nil && p.Resource.ID == nil {
pOrgID := *p.Resource.OrgID
... | [
"func",
"(",
"p",
"Permission",
")",
"Matches",
"(",
"perm",
"Permission",
")",
"bool",
"{",
"if",
"p",
".",
"Action",
"!=",
"perm",
".",
"Action",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"p",
".",
"Resource",
".",
"Type",
"!=",
"perm",
".... | // Matches returns whether or not one permission matches the other. | [
"Matches",
"returns",
"whether",
"or",
"not",
"one",
"permission",
"matches",
"the",
"other",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L195-L229 |
124,052 | influxdata/influxdb | authz.go | Valid | func (p *Permission) Valid() error {
if err := p.Resource.Valid(); err != nil {
return &Error{
Code: EInvalid,
Err: err,
Msg: "invalid resource type for permission",
}
}
if err := p.Action.Valid(); err != nil {
return &Error{
Code: EInvalid,
Err: err,
Msg: "invalid action type for permis... | go | func (p *Permission) Valid() error {
if err := p.Resource.Valid(); err != nil {
return &Error{
Code: EInvalid,
Err: err,
Msg: "invalid resource type for permission",
}
}
if err := p.Action.Valid(); err != nil {
return &Error{
Code: EInvalid,
Err: err,
Msg: "invalid action type for permis... | [
"func",
"(",
"p",
"*",
"Permission",
")",
"Valid",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"Resource",
".",
"Valid",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Code",
":",
"EInvalid",
",",
"Err",
":",
"er... | // Valid checks if there the resource and action provided is known. | [
"Valid",
"checks",
"if",
"there",
"the",
"resource",
"and",
"action",
"provided",
"is",
"known",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L236-L270 |
124,053 | influxdata/influxdb | authz.go | NewGlobalPermission | func NewGlobalPermission(a Action, rt ResourceType) (*Permission, error) {
p := &Permission{
Action: a,
Resource: Resource{
Type: rt,
},
}
return p, p.Valid()
} | go | func NewGlobalPermission(a Action, rt ResourceType) (*Permission, error) {
p := &Permission{
Action: a,
Resource: Resource{
Type: rt,
},
}
return p, p.Valid()
} | [
"func",
"NewGlobalPermission",
"(",
"a",
"Action",
",",
"rt",
"ResourceType",
")",
"(",
"*",
"Permission",
",",
"error",
")",
"{",
"p",
":=",
"&",
"Permission",
"{",
"Action",
":",
"a",
",",
"Resource",
":",
"Resource",
"{",
"Type",
":",
"rt",
",",
"... | // NewGlobalPermission constructs a global permission capable of accessing any resource of type rt. | [
"NewGlobalPermission",
"constructs",
"a",
"global",
"permission",
"capable",
"of",
"accessing",
"any",
"resource",
"of",
"type",
"rt",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L286-L294 |
124,054 | influxdata/influxdb | authz.go | OwnerPermissions | func OwnerPermissions(orgID ID) []Permission {
ps := []Permission{}
for _, r := range AllResourceTypes {
for _, a := range actions {
if r == OrgsResourceType {
ps = append(ps, Permission{Action: a, Resource: Resource{Type: r, ID: &orgID}})
continue
}
ps = append(ps, Permission{Action: a, Resource: ... | go | func OwnerPermissions(orgID ID) []Permission {
ps := []Permission{}
for _, r := range AllResourceTypes {
for _, a := range actions {
if r == OrgsResourceType {
ps = append(ps, Permission{Action: a, Resource: Resource{Type: r, ID: &orgID}})
continue
}
ps = append(ps, Permission{Action: a, Resource: ... | [
"func",
"OwnerPermissions",
"(",
"orgID",
"ID",
")",
"[",
"]",
"Permission",
"{",
"ps",
":=",
"[",
"]",
"Permission",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"AllResourceTypes",
"{",
"for",
"_",
",",
"a",
":=",
"range",
"actions",
"{",
... | // OwnerPermissions are the default permissions for those who own a resource. | [
"OwnerPermissions",
"are",
"the",
"default",
"permissions",
"for",
"those",
"who",
"own",
"a",
"resource",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L323-L335 |
124,055 | influxdata/influxdb | authz.go | MemberPermissions | func MemberPermissions(orgID ID) []Permission {
ps := []Permission{}
for _, r := range AllResourceTypes {
if r == OrgsResourceType {
ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r, ID: &orgID}})
continue
}
ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r... | go | func MemberPermissions(orgID ID) []Permission {
ps := []Permission{}
for _, r := range AllResourceTypes {
if r == OrgsResourceType {
ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r, ID: &orgID}})
continue
}
ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r... | [
"func",
"MemberPermissions",
"(",
"orgID",
"ID",
")",
"[",
"]",
"Permission",
"{",
"ps",
":=",
"[",
"]",
"Permission",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"AllResourceTypes",
"{",
"if",
"r",
"==",
"OrgsResourceType",
"{",
"ps",
"=",
... | // MemberPermissions are the default permissions for those who can see a resource. | [
"MemberPermissions",
"are",
"the",
"default",
"permissions",
"for",
"those",
"who",
"can",
"see",
"a",
"resource",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authz.go#L348-L359 |
124,056 | influxdata/influxdb | chronograf/bolt/users.go | get | func (s *UsersStore) get(ctx context.Context, id uint64) (*chronograf.User, error) {
var u chronograf.User
err := s.client.db.View(func(tx *bolt.Tx) error {
v := tx.Bucket(UsersBucket).Get(u64tob(id))
if v == nil {
return chronograf.ErrUserNotFound
}
return internal.UnmarshalUser(v, &u)
})
if err != nil... | go | func (s *UsersStore) get(ctx context.Context, id uint64) (*chronograf.User, error) {
var u chronograf.User
err := s.client.db.View(func(tx *bolt.Tx) error {
v := tx.Bucket(UsersBucket).Get(u64tob(id))
if v == nil {
return chronograf.ErrUserNotFound
}
return internal.UnmarshalUser(v, &u)
})
if err != nil... | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"get",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"uint64",
")",
"(",
"*",
"chronograf",
".",
"User",
",",
"error",
")",
"{",
"var",
"u",
"chronograf",
".",
"User",
"\n",
"err",
":=",
"s",
".",
"cl... | // get searches the UsersStore for user with id and returns the bolt representation | [
"get",
"searches",
"the",
"UsersStore",
"for",
"user",
"with",
"id",
"and",
"returns",
"the",
"bolt",
"representation"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/users.go#L24-L39 |
124,057 | influxdata/influxdb | chronograf/bolt/users.go | Get | func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) {
if q.ID != nil {
return s.get(ctx, *q.ID)
}
if q.Name != nil && q.Provider != nil && q.Scheme != nil {
var user *chronograf.User
err := s.each(ctx, func(u *chronograf.User) {
if user != nil {
return
}
... | go | func (s *UsersStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) {
if q.ID != nil {
return s.get(ctx, *q.ID)
}
if q.Name != nil && q.Provider != nil && q.Scheme != nil {
var user *chronograf.User
err := s.each(ctx, func(u *chronograf.User) {
if user != nil {
return
}
... | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"chronograf",
".",
"UserQuery",
")",
"(",
"*",
"chronograf",
".",
"User",
",",
"error",
")",
"{",
"if",
"q",
".",
"ID",
"!=",
"nil",
"{",
"return",
... | // Get searches the UsersStore for user with name | [
"Get",
"searches",
"the",
"UsersStore",
"for",
"user",
"with",
"name"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/users.go#L73-L101 |
124,058 | influxdata/influxdb | chronograf/bolt/users.go | Add | func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) {
if u == nil {
return nil, fmt.Errorf("user provided is nil")
}
userExists, err := s.userExists(ctx, u)
if err != nil {
return nil, err
}
if userExists {
return nil, chronograf.ErrUserAlreadyExists
}
if err := s.c... | go | func (s *UsersStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.User, error) {
if u == nil {
return nil, fmt.Errorf("user provided is nil")
}
userExists, err := s.userExists(ctx, u)
if err != nil {
return nil, err
}
if userExists {
return nil, chronograf.ErrUserAlreadyExists
}
if err := s.c... | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"Add",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"chronograf",
".",
"User",
")",
"(",
"*",
"chronograf",
".",
"User",
",",
"error",
")",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
",",... | // Add a new User to the UsersStore. | [
"Add",
"a",
"new",
"User",
"to",
"the",
"UsersStore",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/users.go#L121-L150 |
124,059 | influxdata/influxdb | chronograf/bolt/users.go | Delete | func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error {
_, err := s.get(ctx, u.ID)
if err != nil {
return err
}
return s.client.db.Update(func(tx *bolt.Tx) error {
return tx.Bucket(UsersBucket).Delete(u64tob(u.ID))
})
} | go | func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error {
_, err := s.get(ctx, u.ID)
if err != nil {
return err
}
return s.client.db.Update(func(tx *bolt.Tx) error {
return tx.Bucket(UsersBucket).Delete(u64tob(u.ID))
})
} | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"chronograf",
".",
"User",
")",
"error",
"{",
"_",
",",
"err",
":=",
"s",
".",
"get",
"(",
"ctx",
",",
"u",
".",
"ID",
")",
"\n",
"if",
... | // Delete a user from the UsersStore | [
"Delete",
"a",
"user",
"from",
"the",
"UsersStore"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/users.go#L153-L161 |
124,060 | influxdata/influxdb | chronograf/bolt/users.go | All | func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error) {
var users []chronograf.User
if err := s.client.db.View(func(tx *bolt.Tx) error {
return tx.Bucket(UsersBucket).ForEach(func(k, v []byte) error {
var user chronograf.User
if err := internal.UnmarshalUser(v, &user); err != nil {
retu... | go | func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error) {
var users []chronograf.User
if err := s.client.db.View(func(tx *bolt.Tx) error {
return tx.Bucket(UsersBucket).ForEach(func(k, v []byte) error {
var user chronograf.User
if err := internal.UnmarshalUser(v, &user); err != nil {
retu... | [
"func",
"(",
"s",
"*",
"UsersStore",
")",
"All",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"chronograf",
".",
"User",
",",
"error",
")",
"{",
"var",
"users",
"[",
"]",
"chronograf",
".",
"User",
"\n",
"if",
"err",
":=",
"s",
".",... | // All returns all users | [
"All",
"returns",
"all",
"users"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/bolt/users.go#L180-L196 |
124,061 | influxdata/influxdb | http/debug.go | DebugFlush | func DebugFlush(ctx context.Context, next http.Handler, f Flusher) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/debug/flush" {
f.Flush(ctx)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusOK)
return
}
... | go | func DebugFlush(ctx context.Context, next http.Handler, f Flusher) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/debug/flush" {
f.Flush(ctx)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusOK)
return
}
... | [
"func",
"DebugFlush",
"(",
"ctx",
"context",
".",
"Context",
",",
"next",
"http",
".",
"Handler",
",",
"f",
"Flusher",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
... | // DebugFlush clears all services for testing. | [
"DebugFlush",
"clears",
"all",
"services",
"for",
"testing",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/debug.go#L14-L24 |
124,062 | influxdata/influxdb | inmem/onboarding.go | PutOnboardingStatus | func (s *Service) PutOnboardingStatus(ctx context.Context, v bool) error {
s.onboardingKV.Store(onboardingKey, v)
return nil
} | go | func (s *Service) PutOnboardingStatus(ctx context.Context, v bool) error {
s.onboardingKV.Store(onboardingKey, v)
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"PutOnboardingStatus",
"(",
"ctx",
"context",
".",
"Context",
",",
"v",
"bool",
")",
"error",
"{",
"s",
".",
"onboardingKV",
".",
"Store",
"(",
"onboardingKey",
",",
"v",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // PutOnboardingStatus will put the isOnboarding to storage | [
"PutOnboardingStatus",
"will",
"put",
"the",
"isOnboarding",
"to",
"storage"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/onboarding.go#L24-L27 |
124,063 | influxdata/influxdb | mock/session_service.go | FindSession | func (s *SessionService) FindSession(ctx context.Context, key string) (*platform.Session, error) {
return s.FindSessionFn(ctx, key)
} | go | func (s *SessionService) FindSession(ctx context.Context, key string) (*platform.Session, error) {
return s.FindSessionFn(ctx, key)
} | [
"func",
"(",
"s",
"*",
"SessionService",
")",
"FindSession",
"(",
"ctx",
"context",
".",
"Context",
",",
"key",
"string",
")",
"(",
"*",
"platform",
".",
"Session",
",",
"error",
")",
"{",
"return",
"s",
".",
"FindSessionFn",
"(",
"ctx",
",",
"key",
... | // FindSession returns the session found at the provided key. | [
"FindSession",
"returns",
"the",
"session",
"found",
"at",
"the",
"provided",
"key",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/session_service.go#L34-L36 |
124,064 | influxdata/influxdb | mock/session_service.go | CreateSession | func (s *SessionService) CreateSession(ctx context.Context, user string) (*platform.Session, error) {
return s.CreateSessionFn(ctx, user)
} | go | func (s *SessionService) CreateSession(ctx context.Context, user string) (*platform.Session, error) {
return s.CreateSessionFn(ctx, user)
} | [
"func",
"(",
"s",
"*",
"SessionService",
")",
"CreateSession",
"(",
"ctx",
"context",
".",
"Context",
",",
"user",
"string",
")",
"(",
"*",
"platform",
".",
"Session",
",",
"error",
")",
"{",
"return",
"s",
".",
"CreateSessionFn",
"(",
"ctx",
",",
"use... | // CreateSession creates a sesion for a user with the users maximal privileges. | [
"CreateSession",
"creates",
"a",
"sesion",
"for",
"a",
"user",
"with",
"the",
"users",
"maximal",
"privileges",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/session_service.go#L39-L41 |
124,065 | influxdata/influxdb | mock/session_service.go | ExpireSession | func (s *SessionService) ExpireSession(ctx context.Context, key string) error {
return s.ExpireSessionFn(ctx, key)
} | go | func (s *SessionService) ExpireSession(ctx context.Context, key string) error {
return s.ExpireSessionFn(ctx, key)
} | [
"func",
"(",
"s",
"*",
"SessionService",
")",
"ExpireSession",
"(",
"ctx",
"context",
".",
"Context",
",",
"key",
"string",
")",
"error",
"{",
"return",
"s",
".",
"ExpireSessionFn",
"(",
"ctx",
",",
"key",
")",
"\n",
"}"
] | // ExpireSession exires the session provided at key. | [
"ExpireSession",
"exires",
"the",
"session",
"provided",
"at",
"key",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/session_service.go#L44-L46 |
124,066 | influxdata/influxdb | http/swagger_noassets.go | findSwaggerPath | func findSwaggerPath(logger *zap.Logger) string {
// First, look for environment variable pointing at swagger.
path := os.Getenv("INFLUXDB_VALID_SWAGGER_PATH")
if path != "" {
// Environment variable set.
return path
}
logger.Info("INFLUXDB_VALID_SWAGGER_PATH not set; falling back to checking relative paths")... | go | func findSwaggerPath(logger *zap.Logger) string {
// First, look for environment variable pointing at swagger.
path := os.Getenv("INFLUXDB_VALID_SWAGGER_PATH")
if path != "" {
// Environment variable set.
return path
}
logger.Info("INFLUXDB_VALID_SWAGGER_PATH not set; falling back to checking relative paths")... | [
"func",
"findSwaggerPath",
"(",
"logger",
"*",
"zap",
".",
"Logger",
")",
"string",
"{",
"// First, look for environment variable pointing at swagger.",
"path",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"path",
"!=",
"\"",
"\"",
"{",
"// Env... | // findSwaggerPath makes a best-effort to find the path of the swagger file on disk.
// If it can't find the path, it returns the empty string. | [
"findSwaggerPath",
"makes",
"a",
"best",
"-",
"effort",
"to",
"find",
"the",
"path",
"of",
"the",
"swagger",
"file",
"on",
"disk",
".",
"If",
"it",
"can",
"t",
"find",
"the",
"path",
"it",
"returns",
"the",
"empty",
"string",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/swagger_noassets.go#L46-L92 |
124,067 | influxdata/influxdb | authorizer/secret.go | LoadSecret | func (s *SecretService) LoadSecret(ctx context.Context, orgID influxdb.ID, key string) (string, error) {
if err := authorizeReadSecret(ctx, orgID); err != nil {
return "", err
}
secret, err := s.s.LoadSecret(ctx, orgID, key)
if err != nil {
return "", err
}
return secret, nil
} | go | func (s *SecretService) LoadSecret(ctx context.Context, orgID influxdb.ID, key string) (string, error) {
if err := authorizeReadSecret(ctx, orgID); err != nil {
return "", err
}
secret, err := s.s.LoadSecret(ctx, orgID, key)
if err != nil {
return "", err
}
return secret, nil
} | [
"func",
"(",
"s",
"*",
"SecretService",
")",
"LoadSecret",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"influxdb",
".",
"ID",
",",
"key",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"authorizeReadSecret",
"(",
"ctx... | // LoadSecret checks to see if the authorizer on context has read access to the secret key provided. | [
"LoadSecret",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"read",
"access",
"to",
"the",
"secret",
"key",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/secret.go#L55-L66 |
124,068 | influxdata/influxdb | authorizer/secret.go | GetSecretKeys | func (s *SecretService) GetSecretKeys(ctx context.Context, orgID influxdb.ID) ([]string, error) {
if err := authorizeReadSecret(ctx, orgID); err != nil {
return []string{}, err
}
secrets, err := s.s.GetSecretKeys(ctx, orgID)
if err != nil {
return []string{}, err
}
return secrets, nil
} | go | func (s *SecretService) GetSecretKeys(ctx context.Context, orgID influxdb.ID) ([]string, error) {
if err := authorizeReadSecret(ctx, orgID); err != nil {
return []string{}, err
}
secrets, err := s.s.GetSecretKeys(ctx, orgID)
if err != nil {
return []string{}, err
}
return secrets, nil
} | [
"func",
"(",
"s",
"*",
"SecretService",
")",
"GetSecretKeys",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"influxdb",
".",
"ID",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"authorizeReadSecret",
"(",
"ctx",
",",
... | // GetSecretKeys checks to see if the authorizer on context has read access to all the secrets belonging to orgID. | [
"GetSecretKeys",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"read",
"access",
"to",
"all",
"the",
"secrets",
"belonging",
"to",
"orgID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/secret.go#L69-L80 |
124,069 | influxdata/influxdb | authorizer/secret.go | PutSecret | func (s *SecretService) PutSecret(ctx context.Context, orgID influxdb.ID, key string, val string) error {
if err := authorizeWriteSecret(ctx, orgID); err != nil {
return err
}
err := s.s.PutSecret(ctx, orgID, key, val)
if err != nil {
return err
}
return nil
} | go | func (s *SecretService) PutSecret(ctx context.Context, orgID influxdb.ID, key string, val string) error {
if err := authorizeWriteSecret(ctx, orgID); err != nil {
return err
}
err := s.s.PutSecret(ctx, orgID, key, val)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"s",
"*",
"SecretService",
")",
"PutSecret",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"influxdb",
".",
"ID",
",",
"key",
"string",
",",
"val",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"authorizeWriteSecret",
"(",
"ctx",
... | // PutSecret checks to see if the authorizer on context has write access to the secret key provided. | [
"PutSecret",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"secret",
"key",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/secret.go#L83-L94 |
124,070 | influxdata/influxdb | authorizer/secret.go | PutSecrets | func (s *SecretService) PutSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error {
// PutSecrets operates on intersection between m and keys beloging to orgID.
// We need to have read access to those secrets since it deletes the secrets (within the intersection) that have not be overridden.
if e... | go | func (s *SecretService) PutSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error {
// PutSecrets operates on intersection between m and keys beloging to orgID.
// We need to have read access to those secrets since it deletes the secrets (within the intersection) that have not be overridden.
if e... | [
"func",
"(",
"s",
"*",
"SecretService",
")",
"PutSecrets",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"influxdb",
".",
"ID",
",",
"m",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"// PutSecrets operates on intersection between m and keys be... | // PutSecrets checks to see if the authorizer on context has read and write access to the secret keys provided. | [
"PutSecrets",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"read",
"and",
"write",
"access",
"to",
"the",
"secret",
"keys",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/secret.go#L97-L114 |
124,071 | influxdata/influxdb | authorizer/secret.go | DeleteSecret | func (s *SecretService) DeleteSecret(ctx context.Context, orgID influxdb.ID, keys ...string) error {
if err := authorizeWriteSecret(ctx, orgID); err != nil {
return err
}
err := s.s.DeleteSecret(ctx, orgID, keys...)
if err != nil {
return err
}
return nil
} | go | func (s *SecretService) DeleteSecret(ctx context.Context, orgID influxdb.ID, keys ...string) error {
if err := authorizeWriteSecret(ctx, orgID); err != nil {
return err
}
err := s.s.DeleteSecret(ctx, orgID, keys...)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"s",
"*",
"SecretService",
")",
"DeleteSecret",
"(",
"ctx",
"context",
".",
"Context",
",",
"orgID",
"influxdb",
".",
"ID",
",",
"keys",
"...",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"authorizeWriteSecret",
"(",
"ctx",
",",
"orgID",... | // DeleteSecret checks to see if the authorizer on context has write access to the secret keys provided. | [
"DeleteSecret",
"checks",
"to",
"see",
"if",
"the",
"authorizer",
"on",
"context",
"has",
"write",
"access",
"to",
"the",
"secret",
"keys",
"provided",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/authorizer/secret.go#L131-L142 |
124,072 | influxdata/influxdb | inmem/user_service.go | FindUserByID | func (s *Service) FindUserByID(ctx context.Context, id platform.ID) (u *platform.User, err error) {
var pe *platform.Error
u, pe = s.loadUser(id)
if pe != nil {
err = &platform.Error{
Op: OpPrefix + platform.OpFindUserByID,
Err: pe,
}
}
return u, err
} | go | func (s *Service) FindUserByID(ctx context.Context, id platform.ID) (u *platform.User, err error) {
var pe *platform.Error
u, pe = s.loadUser(id)
if pe != nil {
err = &platform.Error{
Op: OpPrefix + platform.OpFindUserByID,
Err: pe,
}
}
return u, err
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"FindUserByID",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"(",
"u",
"*",
"platform",
".",
"User",
",",
"err",
"error",
")",
"{",
"var",
"pe",
"*",
"platform",
".",
"Error",
... | // FindUserByID returns a single user by ID. | [
"FindUserByID",
"returns",
"a",
"single",
"user",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L47-L57 |
124,073 | influxdata/influxdb | inmem/user_service.go | FindUser | func (s *Service) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) {
op := OpPrefix + platform.OpFindUser
if filter.ID != nil {
u, err := s.FindUserByID(ctx, *filter.ID)
if err != nil {
return nil, &platform.Error{
Op: op,
Err: err,
}
}
return u, nil
}
if fil... | go | func (s *Service) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error) {
op := OpPrefix + platform.OpFindUser
if filter.ID != nil {
u, err := s.FindUserByID(ctx, *filter.ID)
if err != nil {
return nil, &platform.Error{
Op: op,
Err: err,
}
}
return u, nil
}
if fil... | [
"func",
"(",
"s",
"*",
"Service",
")",
"FindUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"platform",
".",
"UserFilter",
")",
"(",
"*",
"platform",
".",
"User",
",",
"error",
")",
"{",
"op",
":=",
"OpPrefix",
"+",
"platform",
".",
"OpF... | // FindUser returns the first user that matches a filter. | [
"FindUser",
"returns",
"the",
"first",
"user",
"that",
"matches",
"a",
"filter",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L64-L108 |
124,074 | influxdata/influxdb | inmem/user_service.go | FindUsers | func (s *Service) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error) {
op := OpPrefix + platform.OpFindUsers
if filter.ID != nil {
u, err := s.FindUserByID(ctx, *filter.ID)
if err != nil {
return nil, 0, &platform.Error{
Err: err,
Op: ... | go | func (s *Service) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error) {
op := OpPrefix + platform.OpFindUsers
if filter.ID != nil {
u, err := s.FindUserByID(ctx, *filter.ID)
if err != nil {
return nil, 0, &platform.Error{
Err: err,
Op: ... | [
"func",
"(",
"s",
"*",
"Service",
")",
"FindUsers",
"(",
"ctx",
"context",
".",
"Context",
",",
"filter",
"platform",
".",
"UserFilter",
",",
"opt",
"...",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"User",
",",
"int",
... | // FindUsers will retrieve a list of users from storage. | [
"FindUsers",
"will",
"retrieve",
"a",
"list",
"of",
"users",
"from",
"storage",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L111-L148 |
124,075 | influxdata/influxdb | inmem/user_service.go | CreateUser | func (s *Service) CreateUser(ctx context.Context, u *platform.User) error {
if _, err := s.FindUser(ctx, platform.UserFilter{Name: &u.Name}); err == nil {
return &platform.Error{
Code: platform.EConflict,
Op: OpPrefix + platform.OpCreateUser,
Msg: fmt.Sprintf("user with name %s already exists", u.Name),
... | go | func (s *Service) CreateUser(ctx context.Context, u *platform.User) error {
if _, err := s.FindUser(ctx, platform.UserFilter{Name: &u.Name}); err == nil {
return &platform.Error{
Code: platform.EConflict,
Op: OpPrefix + platform.OpCreateUser,
Msg: fmt.Sprintf("user with name %s already exists", u.Name),
... | [
"func",
"(",
"s",
"*",
"Service",
")",
"CreateUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"platform",
".",
"User",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"s",
".",
"FindUser",
"(",
"ctx",
",",
"platform",
".",
"UserFilter"... | // CreateUser will create an user into storage. | [
"CreateUser",
"will",
"create",
"an",
"user",
"into",
"storage",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L151-L162 |
124,076 | influxdata/influxdb | inmem/user_service.go | PutUser | func (s *Service) PutUser(ctx context.Context, o *platform.User) error {
s.userKV.Store(o.ID.String(), o)
return nil
} | go | func (s *Service) PutUser(ctx context.Context, o *platform.User) error {
s.userKV.Store(o.ID.String(), o)
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"PutUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"o",
"*",
"platform",
".",
"User",
")",
"error",
"{",
"s",
".",
"userKV",
".",
"Store",
"(",
"o",
".",
"ID",
".",
"String",
"(",
")",
",",
"o",
")",
... | // PutUser put a user into storage. | [
"PutUser",
"put",
"a",
"user",
"into",
"storage",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L165-L168 |
124,077 | influxdata/influxdb | inmem/user_service.go | UpdateUser | func (s *Service) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) {
o, err := s.FindUserByID(ctx, id)
if err != nil {
return nil, &platform.Error{
Err: err,
Op: OpPrefix + platform.OpUpdateUser,
}
}
if upd.Name != nil {
o.Name = *upd.Name
}
s.userKV.... | go | func (s *Service) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) {
o, err := s.FindUserByID(ctx, id)
if err != nil {
return nil, &platform.Error{
Err: err,
Op: OpPrefix + platform.OpUpdateUser,
}
}
if upd.Name != nil {
o.Name = *upd.Name
}
s.userKV.... | [
"func",
"(",
"s",
"*",
"Service",
")",
"UpdateUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
",",
"upd",
"platform",
".",
"UserUpdate",
")",
"(",
"*",
"platform",
".",
"User",
",",
"error",
")",
"{",
"o",
",",
"err"... | // UpdateUser update a user in storage. | [
"UpdateUser",
"update",
"a",
"user",
"in",
"storage",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L171-L187 |
124,078 | influxdata/influxdb | inmem/user_service.go | DeleteUser | func (s *Service) DeleteUser(ctx context.Context, id platform.ID) error {
if _, err := s.FindUserByID(ctx, id); err != nil {
return &platform.Error{
Err: err,
Op: OpPrefix + platform.OpDeleteUser,
}
}
s.userKV.Delete(id.String())
return nil
} | go | func (s *Service) DeleteUser(ctx context.Context, id platform.ID) error {
if _, err := s.FindUserByID(ctx, id); err != nil {
return &platform.Error{
Err: err,
Op: OpPrefix + platform.OpDeleteUser,
}
}
s.userKV.Delete(id.String())
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"DeleteUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"s",
".",
"FindUserByID",
"(",
"ctx",
",",
"id",
")",
";",
"err",
"!=",
... | // DeleteUser remove a user from storage. | [
"DeleteUser",
"remove",
"a",
"user",
"from",
"storage",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/inmem/user_service.go#L190-L199 |
124,079 | influxdata/influxdb | mock/telegraf_service.go | CreateUserResourceMapping | func (s *TelegrafConfigStore) CreateUserResourceMapping(ctx context.Context, m *platform.UserResourceMapping) error {
return s.CreateUserResourceMappingF(ctx, m)
} | go | func (s *TelegrafConfigStore) CreateUserResourceMapping(ctx context.Context, m *platform.UserResourceMapping) error {
return s.CreateUserResourceMappingF(ctx, m)
} | [
"func",
"(",
"s",
"*",
"TelegrafConfigStore",
")",
"CreateUserResourceMapping",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"*",
"platform",
".",
"UserResourceMapping",
")",
"error",
"{",
"return",
"s",
".",
"CreateUserResourceMappingF",
"(",
"ctx",
",",
... | // CreateUserResourceMapping creates a user resource mapping | [
"CreateUserResourceMapping",
"creates",
"a",
"user",
"resource",
"mapping"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/telegraf_service.go#L30-L32 |
124,080 | influxdata/influxdb | mock/telegraf_service.go | DeleteUserResourceMapping | func (s *TelegrafConfigStore) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error {
return s.DeleteUserResourceMappingF(ctx, resourceID, userID)
} | go | func (s *TelegrafConfigStore) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error {
return s.DeleteUserResourceMappingF(ctx, resourceID, userID)
} | [
"func",
"(",
"s",
"*",
"TelegrafConfigStore",
")",
"DeleteUserResourceMapping",
"(",
"ctx",
"context",
".",
"Context",
",",
"resourceID",
"platform",
".",
"ID",
",",
"userID",
"platform",
".",
"ID",
")",
"error",
"{",
"return",
"s",
".",
"DeleteUserResourceMap... | // DeleteUserResourceMapping deletes a user resource mapping | [
"DeleteUserResourceMapping",
"deletes",
"a",
"user",
"resource",
"mapping"
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/mock/telegraf_service.go#L35-L37 |
124,081 | influxdata/influxdb | label.go | Validate | func (l *LabelMapping) Validate() error {
if !l.LabelID.Valid() {
return &Error{
Code: EInvalid,
Msg: "label id is required",
}
}
if !l.ResourceID.Valid() {
return &Error{
Code: EInvalid,
Msg: "resource id is required",
}
}
if err := l.ResourceType.Valid(); err != nil {
return &Error{
Co... | go | func (l *LabelMapping) Validate() error {
if !l.LabelID.Valid() {
return &Error{
Code: EInvalid,
Msg: "label id is required",
}
}
if !l.ResourceID.Valid() {
return &Error{
Code: EInvalid,
Msg: "resource id is required",
}
}
if err := l.ResourceType.Valid(); err != nil {
return &Error{
Co... | [
"func",
"(",
"l",
"*",
"LabelMapping",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"!",
"l",
".",
"LabelID",
".",
"Valid",
"(",
")",
"{",
"return",
"&",
"Error",
"{",
"Code",
":",
"EInvalid",
",",
"Msg",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",... | // Validate returns an error if the mapping is invalid. | [
"Validate",
"returns",
"an",
"error",
"if",
"the",
"mapping",
"is",
"invalid",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/label.go#L84-L105 |
124,082 | influxdata/influxdb | tsdb/tsm1/array_encoding.go | DecodeBooleanArrayBlock | func DecodeBooleanArrayBlock(block []byte, a *tsdb.BooleanArray) error {
blockType := block[0]
if blockType != BlockBoolean {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockBoolean, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDe... | go | func DecodeBooleanArrayBlock(block []byte, a *tsdb.BooleanArray) error {
blockType := block[0]
if blockType != BlockBoolean {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockBoolean, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDe... | [
"func",
"DecodeBooleanArrayBlock",
"(",
"block",
"[",
"]",
"byte",
",",
"a",
"*",
"tsdb",
".",
"BooleanArray",
")",
"error",
"{",
"blockType",
":=",
"block",
"[",
"0",
"]",
"\n",
"if",
"blockType",
"!=",
"BlockBoolean",
"{",
"return",
"fmt",
".",
"Errorf... | // DecodeBooleanArrayBlock decodes the boolean block from the byte slice
// and writes the values to a. | [
"DecodeBooleanArrayBlock",
"decodes",
"the",
"boolean",
"block",
"from",
"the",
"byte",
"slice",
"and",
"writes",
"the",
"values",
"to",
"a",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_encoding.go#L11-L28 |
124,083 | influxdata/influxdb | tsdb/tsm1/array_encoding.go | DecodeFloatArrayBlock | func DecodeFloatArrayBlock(block []byte, a *tsdb.FloatArray) error {
blockType := block[0]
if blockType != BlockFloat64 {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockFloat64, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDecode... | go | func DecodeFloatArrayBlock(block []byte, a *tsdb.FloatArray) error {
blockType := block[0]
if blockType != BlockFloat64 {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockFloat64, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDecode... | [
"func",
"DecodeFloatArrayBlock",
"(",
"block",
"[",
"]",
"byte",
",",
"a",
"*",
"tsdb",
".",
"FloatArray",
")",
"error",
"{",
"blockType",
":=",
"block",
"[",
"0",
"]",
"\n",
"if",
"blockType",
"!=",
"BlockFloat64",
"{",
"return",
"fmt",
".",
"Errorf",
... | // DecodeFloatArrayBlock decodes the float block from the byte slice
// and writes the values to a. | [
"DecodeFloatArrayBlock",
"decodes",
"the",
"float",
"block",
"from",
"the",
"byte",
"slice",
"and",
"writes",
"the",
"values",
"to",
"a",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_encoding.go#L32-L49 |
124,084 | influxdata/influxdb | tsdb/tsm1/array_encoding.go | DecodeIntegerArrayBlock | func DecodeIntegerArrayBlock(block []byte, a *tsdb.IntegerArray) error {
blockType := block[0]
if blockType != BlockInteger {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockInteger, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDe... | go | func DecodeIntegerArrayBlock(block []byte, a *tsdb.IntegerArray) error {
blockType := block[0]
if blockType != BlockInteger {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockInteger, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDe... | [
"func",
"DecodeIntegerArrayBlock",
"(",
"block",
"[",
"]",
"byte",
",",
"a",
"*",
"tsdb",
".",
"IntegerArray",
")",
"error",
"{",
"blockType",
":=",
"block",
"[",
"0",
"]",
"\n",
"if",
"blockType",
"!=",
"BlockInteger",
"{",
"return",
"fmt",
".",
"Errorf... | // DecodeIntegerArrayBlock decodes the integer block from the byte slice
// and writes the values to a. | [
"DecodeIntegerArrayBlock",
"decodes",
"the",
"integer",
"block",
"from",
"the",
"byte",
"slice",
"and",
"writes",
"the",
"values",
"to",
"a",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_encoding.go#L53-L70 |
124,085 | influxdata/influxdb | tsdb/tsm1/array_encoding.go | DecodeUnsignedArrayBlock | func DecodeUnsignedArrayBlock(block []byte, a *tsdb.UnsignedArray) error {
blockType := block[0]
if blockType != BlockUnsigned {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockUnsigned, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArr... | go | func DecodeUnsignedArrayBlock(block []byte, a *tsdb.UnsignedArray) error {
blockType := block[0]
if blockType != BlockUnsigned {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockUnsigned, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArr... | [
"func",
"DecodeUnsignedArrayBlock",
"(",
"block",
"[",
"]",
"byte",
",",
"a",
"*",
"tsdb",
".",
"UnsignedArray",
")",
"error",
"{",
"blockType",
":=",
"block",
"[",
"0",
"]",
"\n",
"if",
"blockType",
"!=",
"BlockUnsigned",
"{",
"return",
"fmt",
".",
"Err... | // DecodeUnsignedArrayBlock decodes the unsigned integer block from the byte slice
// and writes the values to a. | [
"DecodeUnsignedArrayBlock",
"decodes",
"the",
"unsigned",
"integer",
"block",
"from",
"the",
"byte",
"slice",
"and",
"writes",
"the",
"values",
"to",
"a",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_encoding.go#L74-L91 |
124,086 | influxdata/influxdb | tsdb/tsm1/array_encoding.go | DecodeStringArrayBlock | func DecodeStringArrayBlock(block []byte, a *tsdb.StringArray) error {
blockType := block[0]
if blockType != BlockString {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockString, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDecode... | go | func DecodeStringArrayBlock(block []byte, a *tsdb.StringArray) error {
blockType := block[0]
if blockType != BlockString {
return fmt.Errorf("invalid block type: exp %d, got %d", BlockString, blockType)
}
tb, vb, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDecode... | [
"func",
"DecodeStringArrayBlock",
"(",
"block",
"[",
"]",
"byte",
",",
"a",
"*",
"tsdb",
".",
"StringArray",
")",
"error",
"{",
"blockType",
":=",
"block",
"[",
"0",
"]",
"\n",
"if",
"blockType",
"!=",
"BlockString",
"{",
"return",
"fmt",
".",
"Errorf",
... | // DecodeStringArrayBlock decodes the string block from the byte slice
// and writes the values to a. | [
"DecodeStringArrayBlock",
"decodes",
"the",
"string",
"block",
"from",
"the",
"byte",
"slice",
"and",
"writes",
"the",
"values",
"to",
"a",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_encoding.go#L95-L112 |
124,087 | influxdata/influxdb | tsdb/tsm1/array_encoding.go | DecodeTimestampArrayBlock | func DecodeTimestampArrayBlock(block []byte, a *tsdb.TimestampArray) error {
tb, _, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDecodeAll(tb, a.Timestamps)
return err
} | go | func DecodeTimestampArrayBlock(block []byte, a *tsdb.TimestampArray) error {
tb, _, err := unpackBlock(block[1:])
if err != nil {
return err
}
a.Timestamps, err = TimeArrayDecodeAll(tb, a.Timestamps)
return err
} | [
"func",
"DecodeTimestampArrayBlock",
"(",
"block",
"[",
"]",
"byte",
",",
"a",
"*",
"tsdb",
".",
"TimestampArray",
")",
"error",
"{",
"tb",
",",
"_",
",",
"err",
":=",
"unpackBlock",
"(",
"block",
"[",
"1",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"... | // DecodeTimestampArrayBlock decodes the timestamps from the specified
// block, ignoring the block type and the values. | [
"DecodeTimestampArrayBlock",
"decodes",
"the",
"timestamps",
"from",
"the",
"specified",
"block",
"ignoring",
"the",
"block",
"type",
"and",
"the",
"values",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/tsdb/tsm1/array_encoding.go#L116-L124 |
124,088 | influxdata/influxdb | task/mock/task_control_service.go | SetTask | func (d *TaskControlService) SetTask(task *influxdb.Task) {
d.mu.Lock()
defer d.mu.Unlock()
d.tasks[task.ID] = task
} | go | func (d *TaskControlService) SetTask(task *influxdb.Task) {
d.mu.Lock()
defer d.mu.Unlock()
d.tasks[task.ID] = task
} | [
"func",
"(",
"d",
"*",
"TaskControlService",
")",
"SetTask",
"(",
"task",
"*",
"influxdb",
".",
"Task",
")",
"{",
"d",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"d",
".",
"tasks",
"[",
"ta... | // SetTask sets the task.
// SetTask must be called before CreateNextRun, for a given task ID. | [
"SetTask",
"sets",
"the",
"task",
".",
"SetTask",
"must",
"be",
"called",
"before",
"CreateNextRun",
"for",
"a",
"given",
"task",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/mock/task_control_service.go#L50-L55 |
124,089 | influxdata/influxdb | task/mock/task_control_service.go | TotalRunsCreatedForTask | func (d *TaskControlService) TotalRunsCreatedForTask(taskID influxdb.ID) int {
d.mu.Lock()
defer d.mu.Unlock()
return d.totalRunsCreated[taskID]
} | go | func (d *TaskControlService) TotalRunsCreatedForTask(taskID influxdb.ID) int {
d.mu.Lock()
defer d.mu.Unlock()
return d.totalRunsCreated[taskID]
} | [
"func",
"(",
"d",
"*",
"TaskControlService",
")",
"TotalRunsCreatedForTask",
"(",
"taskID",
"influxdb",
".",
"ID",
")",
"int",
"{",
"d",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"d",
... | // TotalRunsCreatedForTask returns the number of runs created for taskID. | [
"TotalRunsCreatedForTask",
"returns",
"the",
"number",
"of",
"runs",
"created",
"for",
"taskID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/mock/task_control_service.go#L308-L313 |
124,090 | influxdata/influxdb | task/mock/task_control_service.go | PollForNumberCreated | func (d *TaskControlService) PollForNumberCreated(taskID influxdb.ID, count int) ([]backend.QueuedRun, error) {
const numAttempts = 50
actualCount := 0
var created []backend.QueuedRun
for i := 0; i < numAttempts; i++ {
time.Sleep(2 * time.Millisecond) // we sleep even on first so it becomes more likely that we ca... | go | func (d *TaskControlService) PollForNumberCreated(taskID influxdb.ID, count int) ([]backend.QueuedRun, error) {
const numAttempts = 50
actualCount := 0
var created []backend.QueuedRun
for i := 0; i < numAttempts; i++ {
time.Sleep(2 * time.Millisecond) // we sleep even on first so it becomes more likely that we ca... | [
"func",
"(",
"d",
"*",
"TaskControlService",
")",
"PollForNumberCreated",
"(",
"taskID",
"influxdb",
".",
"ID",
",",
"count",
"int",
")",
"(",
"[",
"]",
"backend",
".",
"QueuedRun",
",",
"error",
")",
"{",
"const",
"numAttempts",
"=",
"50",
"\n",
"actual... | // PollForNumberCreated blocks for a small amount of time waiting for exactly the given count of created and unfinished runs for the given task ID.
// If the expected number isn't found in time, it returns an error.
//
// Because the scheduler and executor do a lot of state changes asynchronously, this is useful in tes... | [
"PollForNumberCreated",
"blocks",
"for",
"a",
"small",
"amount",
"of",
"time",
"waiting",
"for",
"exactly",
"the",
"given",
"count",
"of",
"created",
"and",
"unfinished",
"runs",
"for",
"the",
"given",
"task",
"ID",
".",
"If",
"the",
"expected",
"number",
"i... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/mock/task_control_service.go#L319-L332 |
124,091 | influxdata/influxdb | task/backend/bolt/bolt.go | CreateTask | func (s *Store) CreateTask(ctx context.Context, req backend.CreateTaskRequest) (platform.ID, error) {
o, err := backend.StoreValidator.CreateArgs(req)
if err != nil {
return platform.InvalidID(), err
}
// Get ID
id := s.idGen.ID()
err = s.db.Update(func(tx *bolt.Tx) error {
// get the root bucket
b := tx.Bu... | go | func (s *Store) CreateTask(ctx context.Context, req backend.CreateTaskRequest) (platform.ID, error) {
o, err := backend.StoreValidator.CreateArgs(req)
if err != nil {
return platform.InvalidID(), err
}
// Get ID
id := s.idGen.ID()
err = s.db.Update(func(tx *bolt.Tx) error {
// get the root bucket
b := tx.Bu... | [
"func",
"(",
"s",
"*",
"Store",
")",
"CreateTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"backend",
".",
"CreateTaskRequest",
")",
"(",
"platform",
".",
"ID",
",",
"error",
")",
"{",
"o",
",",
"err",
":=",
"backend",
".",
"StoreValidator",... | // CreateTask creates a task in the boltdb task store. | [
"CreateTask",
"creates",
"a",
"task",
"in",
"the",
"boltdb",
"task",
"store",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/task/backend/bolt/bolt.go#L107-L172 |
124,092 | influxdata/influxdb | http/document_service.go | NewDocumentBackend | func NewDocumentBackend(b *APIBackend) *DocumentBackend {
return &DocumentBackend{
Logger: b.Logger.With(zap.String("handler", "document")),
DocumentService: b.DocumentService,
LabelService: b.LabelService,
}
} | go | func NewDocumentBackend(b *APIBackend) *DocumentBackend {
return &DocumentBackend{
Logger: b.Logger.With(zap.String("handler", "document")),
DocumentService: b.DocumentService,
LabelService: b.LabelService,
}
} | [
"func",
"NewDocumentBackend",
"(",
"b",
"*",
"APIBackend",
")",
"*",
"DocumentBackend",
"{",
"return",
"&",
"DocumentBackend",
"{",
"Logger",
":",
"b",
".",
"Logger",
".",
"With",
"(",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
... | // NewDocumentBackend returns a new instance of DocumentBackend. | [
"NewDocumentBackend",
"returns",
"a",
"new",
"instance",
"of",
"DocumentBackend",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/document_service.go#L25-L31 |
124,093 | influxdata/influxdb | http/document_service.go | handleDeleteDocumentLabel | func (h *DocumentHandler) handleDeleteDocumentLabel(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeDeleteLabelMappingRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
_, _, err = h.getDocument(w, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
_, err... | go | func (h *DocumentHandler) handleDeleteDocumentLabel(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
req, err := decodeDeleteLabelMappingRequest(ctx, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
_, _, err = h.getDocument(w, r)
if err != nil {
EncodeError(ctx, err, w)
return
}
_, err... | [
"func",
"(",
"h",
"*",
"DocumentHandler",
")",
"handleDeleteDocumentLabel",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n",
"req",
",",
"err",
":=",
"decodeDele... | // handleDeleteDocumentLabel will first remove the label from the document,
// then remove that label. | [
"handleDeleteDocumentLabel",
"will",
"first",
"remove",
"the",
"label",
"from",
"the",
"document",
"then",
"remove",
"that",
"label",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/document_service.go#L307-L339 |
124,094 | influxdata/influxdb | http/source_service.go | NewSourceBackend | func NewSourceBackend(b *APIBackend) *SourceBackend {
return &SourceBackend{
Logger: b.Logger.With(zap.String("handler", "source")),
SourceService: b.SourceService,
LabelService: b.LabelService,
BucketService: b.BucketService,
NewQueryService: b.NewQueryService,
}
} | go | func NewSourceBackend(b *APIBackend) *SourceBackend {
return &SourceBackend{
Logger: b.Logger.With(zap.String("handler", "source")),
SourceService: b.SourceService,
LabelService: b.LabelService,
BucketService: b.BucketService,
NewQueryService: b.NewQueryService,
}
} | [
"func",
"NewSourceBackend",
"(",
"b",
"*",
"APIBackend",
")",
"*",
"SourceBackend",
"{",
"return",
"&",
"SourceBackend",
"{",
"Logger",
":",
"b",
".",
"Logger",
".",
"With",
"(",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
",",
... | // NewSourceBackend returns a new instance of SourceBackend. | [
"NewSourceBackend",
"returns",
"a",
"new",
"instance",
"of",
"SourceBackend",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/source_service.go#L90-L99 |
124,095 | influxdata/influxdb | http/source_service.go | FindSources | func (s *SourceService) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error) {
u, err := newURL(s.Addr, sourcePath)
if err != nil {
return nil, 0, err
}
req, err := http.NewRequest("GET", u.String(), nil)
if err != nil {
return nil, 0, err
}
SetToken(s.Token, req)
h... | go | func (s *SourceService) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error) {
u, err := newURL(s.Addr, sourcePath)
if err != nil {
return nil, 0, err
}
req, err := http.NewRequest("GET", u.String(), nil)
if err != nil {
return nil, 0, err
}
SetToken(s.Token, req)
h... | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"FindSources",
"(",
"ctx",
"context",
".",
"Context",
",",
"opt",
"platform",
".",
"FindOptions",
")",
"(",
"[",
"]",
"*",
"platform",
".",
"Source",
",",
"int",
",",
"error",
")",
"{",
"u",
",",
"err",
... | // FindSources returns a list of sources that match filter and the total count of matching sources.
// Additional options provide pagination & sorting. | [
"FindSources",
"returns",
"a",
"list",
"of",
"sources",
"that",
"match",
"filter",
"and",
"the",
"total",
"count",
"of",
"matching",
"sources",
".",
"Additional",
"options",
"provide",
"pagination",
"&",
"sorting",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/source_service.go#L553-L583 |
124,096 | influxdata/influxdb | http/source_service.go | CreateSource | func (s *SourceService) CreateSource(ctx context.Context, b *platform.Source) error {
u, err := newURL(s.Addr, sourcePath)
if err != nil {
return err
}
octets, err := json.Marshal(b)
if err != nil {
return err
}
req, err := http.NewRequest("POST", u.String(), bytes.NewReader(octets))
if err != nil {
ret... | go | func (s *SourceService) CreateSource(ctx context.Context, b *platform.Source) error {
u, err := newURL(s.Addr, sourcePath)
if err != nil {
return err
}
octets, err := json.Marshal(b)
if err != nil {
return err
}
req, err := http.NewRequest("POST", u.String(), bytes.NewReader(octets))
if err != nil {
ret... | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"CreateSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"b",
"*",
"platform",
".",
"Source",
")",
"error",
"{",
"u",
",",
"err",
":=",
"newURL",
"(",
"s",
".",
"Addr",
",",
"sourcePath",
")",
"\n",
"... | // CreateSource creates a new source and sets b.ID with the new identifier. | [
"CreateSource",
"creates",
"a",
"new",
"source",
"and",
"sets",
"b",
".",
"ID",
"with",
"the",
"new",
"identifier",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/source_service.go#L586-L623 |
124,097 | influxdata/influxdb | http/source_service.go | DeleteSource | func (s *SourceService) DeleteSource(ctx context.Context, id platform.ID) error {
u, err := newURL(s.Addr, sourceIDPath(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.InsecureSkipVerif... | go | func (s *SourceService) DeleteSource(ctx context.Context, id platform.ID) error {
u, err := newURL(s.Addr, sourceIDPath(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.InsecureSkipVerif... | [
"func",
"(",
"s",
"*",
"SourceService",
")",
"DeleteSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"platform",
".",
"ID",
")",
"error",
"{",
"u",
",",
"err",
":=",
"newURL",
"(",
"s",
".",
"Addr",
",",
"sourceIDPath",
"(",
"id",
")",
")... | // DeleteSource removes a source by ID. | [
"DeleteSource",
"removes",
"a",
"source",
"by",
"ID",
"."
] | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/http/source_service.go#L667-L687 |
124,098 | influxdata/influxdb | chronograf/server/auth.go | HasAuthorizedToken | func HasAuthorizedToken(auth oauth2.Authenticator, r *http.Request) (oauth2.Principal, error) {
ctx := r.Context()
return auth.Validate(ctx, r)
} | go | func HasAuthorizedToken(auth oauth2.Authenticator, r *http.Request) (oauth2.Principal, error) {
ctx := r.Context()
return auth.Validate(ctx, r)
} | [
"func",
"HasAuthorizedToken",
"(",
"auth",
"oauth2",
".",
"Authenticator",
",",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"oauth2",
".",
"Principal",
",",
"error",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n",
"return",
"auth",
".",
"... | // HasAuthorizedToken extracts the token from a request and validates it using the authenticator.
// It is used by routes that need access to the token to populate links request. | [
"HasAuthorizedToken",
"extracts",
"the",
"token",
"from",
"a",
"request",
"and",
"validates",
"it",
"using",
"the",
"authenticator",
".",
"It",
"is",
"used",
"by",
"routes",
"that",
"need",
"access",
"to",
"the",
"token",
"to",
"populate",
"links",
"request",
... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/auth.go#L16-L19 |
124,099 | influxdata/influxdb | chronograf/server/auth.go | AuthorizedToken | func AuthorizedToken(auth oauth2.Authenticator, logger chronograf.Logger, next http.Handler) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log := logger.
WithField("component", "token_auth").
WithField("remote_addr", r.RemoteAddr).
WithField("method", r.Method).
... | go | func AuthorizedToken(auth oauth2.Authenticator, logger chronograf.Logger, next http.Handler) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log := logger.
WithField("component", "token_auth").
WithField("remote_addr", r.RemoteAddr).
WithField("method", r.Method).
... | [
"func",
"AuthorizedToken",
"(",
"auth",
"oauth2",
".",
"Authenticator",
",",
"logger",
"chronograf",
".",
"Logger",
",",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"htt... | // AuthorizedToken extracts the token and validates; if valid the next handler
// will be run. The principal will be sent to the next handler via the request's
// Context. It is up to the next handler to determine if the principal has access.
// On failure, will return http.StatusForbidden. | [
"AuthorizedToken",
"extracts",
"the",
"token",
"and",
"validates",
";",
"if",
"valid",
"the",
"next",
"handler",
"will",
"be",
"run",
".",
"The",
"principal",
"will",
"be",
"sent",
"to",
"the",
"next",
"handler",
"via",
"the",
"request",
"s",
"Context",
".... | 16d0bbb0cd468fd51f412021a76ae5c4b450dea8 | https://github.com/influxdata/influxdb/blob/16d0bbb0cd468fd51f412021a76ae5c4b450dea8/chronograf/server/auth.go#L25-L56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.