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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
aarzilli/nucular | nucular.go | LayoutAvailableHeight | func (win *Window) LayoutAvailableHeight() int {
return win.layout.Clip.H - (win.layout.AtY - win.layout.Bounds.Y) - win.style().Spacing.Y - win.layout.Row.Height
} | go | func (win *Window) LayoutAvailableHeight() int {
return win.layout.Clip.H - (win.layout.AtY - win.layout.Bounds.Y) - win.style().Spacing.Y - win.layout.Row.Height
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"LayoutAvailableHeight",
"(",
")",
"int",
"{",
"return",
"win",
".",
"layout",
".",
"Clip",
".",
"H",
"-",
"(",
"win",
".",
"layout",
".",
"AtY",
"-",
"win",
".",
"layout",
".",
"Bounds",
".",
"Y",
")",
"-"... | // Returns remaining available height of win in scaled units. | [
"Returns",
"remaining",
"available",
"height",
"of",
"win",
"in",
"scaled",
"units",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1314-L1316 | train |
aarzilli/nucular | nucular.go | TreePushNamed | func (win *Window) TreePushNamed(type_ TreeType, name, title string, initial_open bool) bool {
labelBounds, _, ok := win.TreePushCustom(type_, name, initial_open)
style := win.style()
z := &win.ctx.Style
out := &win.cmds
var text textWidget
if type_ == TreeTab {
var background *nstyle.Item = &z.Tab.Background... | go | func (win *Window) TreePushNamed(type_ TreeType, name, title string, initial_open bool) bool {
labelBounds, _, ok := win.TreePushCustom(type_, name, initial_open)
style := win.style()
z := &win.ctx.Style
out := &win.cmds
var text textWidget
if type_ == TreeTab {
var background *nstyle.Item = &z.Tab.Background... | [
"func",
"(",
"win",
"*",
"Window",
")",
"TreePushNamed",
"(",
"type_",
"TreeType",
",",
"name",
",",
"title",
"string",
",",
"initial_open",
"bool",
")",
"bool",
"{",
"labelBounds",
",",
"_",
",",
"ok",
":=",
"win",
".",
"TreePushCustom",
"(",
"type_",
... | // Creates a new collapsable section inside win. Returns true
// when the section is open. Widgets that are inside this collapsable
// section should be added to win only when this function returns true.
// Once you are done adding elements to the collapsable section
// call TreePop.
// Initial_open will determine whet... | [
"Creates",
"a",
"new",
"collapsable",
"section",
"inside",
"win",
".",
"Returns",
"true",
"when",
"the",
"section",
"is",
"open",
".",
"Widgets",
"that",
"are",
"inside",
"this",
"collapsable",
"section",
"should",
"be",
"added",
"to",
"win",
"only",
"when",... | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1362-L1385 | train |
aarzilli/nucular | nucular.go | TreeIsOpen | func (win *Window) TreeIsOpen(name string) bool {
node := win.curNode.Children[name]
if node != nil {
return node.Open
}
return false
} | go | func (win *Window) TreeIsOpen(name string) bool {
node := win.curNode.Children[name]
if node != nil {
return node.Open
}
return false
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"TreeIsOpen",
"(",
"name",
"string",
")",
"bool",
"{",
"node",
":=",
"win",
".",
"curNode",
".",
"Children",
"[",
"name",
"]",
"\n",
"if",
"node",
"!=",
"nil",
"{",
"return",
"node",
".",
"Open",
"\n",
"}",
... | // Returns true if the specified node is open | [
"Returns",
"true",
"if",
"the",
"specified",
"node",
"is",
"open"
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1492-L1498 | train |
aarzilli/nucular | nucular.go | TreePop | func (win *Window) TreePop() {
layout := win.layout
panel_padding := win.style().Padding
layout.AtX -= panel_padding.X + win.ctx.Style.Tab.Indent
layout.Width += panel_padding.X + win.ctx.Style.Tab.Indent
if layout.Row.TreeDepth == 0 {
panic("TreePop called without opened tree nodes")
}
win.curNode = win.curNo... | go | func (win *Window) TreePop() {
layout := win.layout
panel_padding := win.style().Padding
layout.AtX -= panel_padding.X + win.ctx.Style.Tab.Indent
layout.Width += panel_padding.X + win.ctx.Style.Tab.Indent
if layout.Row.TreeDepth == 0 {
panic("TreePop called without opened tree nodes")
}
win.curNode = win.curNo... | [
"func",
"(",
"win",
"*",
"Window",
")",
"TreePop",
"(",
")",
"{",
"layout",
":=",
"win",
".",
"layout",
"\n",
"panel_padding",
":=",
"win",
".",
"style",
"(",
")",
".",
"Padding",
"\n",
"layout",
".",
"AtX",
"-=",
"panel_padding",
".",
"X",
"+",
"w... | // TreePop signals that the program is done adding elements to the
// current collapsable section. | [
"TreePop",
"signals",
"that",
"the",
"program",
"is",
"done",
"adding",
"elements",
"to",
"the",
"current",
"collapsable",
"section",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1502-L1512 | train |
aarzilli/nucular | nucular.go | LabelWrapColored | func (win *Window) LabelWrapColored(str string, color color.RGBA) {
var bounds rect.Rect
var text textWidget
style := &win.ctx.Style
panelAllocSpace(&bounds, win)
item_padding := style.Text.Padding
text.Padding.X = item_padding.X
text.Padding.Y = item_padding.Y
text.Background = win.style().Background
text.T... | go | func (win *Window) LabelWrapColored(str string, color color.RGBA) {
var bounds rect.Rect
var text textWidget
style := &win.ctx.Style
panelAllocSpace(&bounds, win)
item_padding := style.Text.Padding
text.Padding.X = item_padding.X
text.Padding.Y = item_padding.Y
text.Background = win.style().Background
text.T... | [
"func",
"(",
"win",
"*",
"Window",
")",
"LabelWrapColored",
"(",
"str",
"string",
",",
"color",
"color",
".",
"RGBA",
")",
"{",
"var",
"bounds",
"rect",
".",
"Rect",
"\n",
"var",
"text",
"textWidget",
"\n\n",
"style",
":=",
"&",
"win",
".",
"ctx",
".... | // LabelWrapColored draws a text label with the specified background
// color autowrappping the text. | [
"LabelWrapColored",
"draws",
"a",
"text",
"label",
"with",
"the",
"specified",
"background",
"color",
"autowrappping",
"the",
"text",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1541-L1555 | train |
aarzilli/nucular | nucular.go | Label | func (win *Window) Label(str string, alignment label.Align) {
win.LabelColored(str, alignment, win.ctx.Style.Text.Color)
} | go | func (win *Window) Label(str string, alignment label.Align) {
win.LabelColored(str, alignment, win.ctx.Style.Text.Color)
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"Label",
"(",
"str",
"string",
",",
"alignment",
"label",
".",
"Align",
")",
"{",
"win",
".",
"LabelColored",
"(",
"str",
",",
"alignment",
",",
"win",
".",
"ctx",
".",
"Style",
".",
"Text",
".",
"Color",
")"... | // Label draws a text label. | [
"Label",
"draws",
"a",
"text",
"label",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1558-L1560 | train |
aarzilli/nucular | nucular.go | LabelWrap | func (win *Window) LabelWrap(str string) {
win.LabelWrapColored(str, win.ctx.Style.Text.Color)
} | go | func (win *Window) LabelWrap(str string) {
win.LabelWrapColored(str, win.ctx.Style.Text.Color)
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"LabelWrap",
"(",
"str",
"string",
")",
"{",
"win",
".",
"LabelWrapColored",
"(",
"str",
",",
"win",
".",
"ctx",
".",
"Style",
".",
"Text",
".",
"Color",
")",
"\n",
"}"
] | // LabelWrap draws a text label, autowrapping its contents. | [
"LabelWrap",
"draws",
"a",
"text",
"label",
"autowrapping",
"its",
"contents",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1563-L1565 | train |
aarzilli/nucular | nucular.go | Image | func (win *Window) Image(img *image.RGBA) {
s, bounds, fitting := win.widget()
if fitting != nil {
fitting(img.Bounds().Dx())
}
if !s {
return
}
win.widgets.Add(nstyle.WidgetStateInactive, bounds)
win.cmds.DrawImage(bounds, img)
} | go | func (win *Window) Image(img *image.RGBA) {
s, bounds, fitting := win.widget()
if fitting != nil {
fitting(img.Bounds().Dx())
}
if !s {
return
}
win.widgets.Add(nstyle.WidgetStateInactive, bounds)
win.cmds.DrawImage(bounds, img)
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"Image",
"(",
"img",
"*",
"image",
".",
"RGBA",
")",
"{",
"s",
",",
"bounds",
",",
"fitting",
":=",
"win",
".",
"widget",
"(",
")",
"\n",
"if",
"fitting",
"!=",
"nil",
"{",
"fitting",
"(",
"img",
".",
"Bo... | // Image draws an image. | [
"Image",
"draws",
"an",
"image",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1568-L1578 | train |
aarzilli/nucular | nucular.go | Spacing | func (win *Window) Spacing(cols int) {
for i := 0; i < cols; i++ {
win.widget()
}
} | go | func (win *Window) Spacing(cols int) {
for i := 0; i < cols; i++ {
win.widget()
}
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"Spacing",
"(",
"cols",
"int",
")",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"cols",
";",
"i",
"++",
"{",
"win",
".",
"widget",
"(",
")",
"\n",
"}",
"\n",
"}"
] | // Spacing adds empty space | [
"Spacing",
"adds",
"empty",
"space"
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1581-L1585 | train |
aarzilli/nucular | nucular.go | CustomState | func (win *Window) CustomState() nstyle.WidgetStates {
bounds := win.WidgetBounds()
s := true
if !win.layout.Clip.Intersect(&bounds) {
s = false
}
ws := win.widgets.PrevState(bounds)
basicWidgetStateControl(&ws, win.inputMaybe(s), bounds)
return ws
} | go | func (win *Window) CustomState() nstyle.WidgetStates {
bounds := win.WidgetBounds()
s := true
if !win.layout.Clip.Intersect(&bounds) {
s = false
}
ws := win.widgets.PrevState(bounds)
basicWidgetStateControl(&ws, win.inputMaybe(s), bounds)
return ws
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"CustomState",
"(",
")",
"nstyle",
".",
"WidgetStates",
"{",
"bounds",
":=",
"win",
".",
"WidgetBounds",
"(",
")",
"\n",
"s",
":=",
"true",
"\n",
"if",
"!",
"win",
".",
"layout",
".",
"Clip",
".",
"Intersect",
... | // CustomState returns the widget state of a custom widget. | [
"CustomState",
"returns",
"the",
"widget",
"state",
"of",
"a",
"custom",
"widget",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1588-L1598 | train |
aarzilli/nucular | nucular.go | Custom | func (win *Window) Custom(state nstyle.WidgetStates) (bounds rect.Rect, out *command.Buffer) {
var s bool
if s, bounds, _ = win.widget(); !s {
return
}
prevstate := win.widgets.PrevState(bounds)
exitstate := basicWidgetStateControl(&prevstate, win.inputMaybe(s), bounds)
if state != nstyle.WidgetStateActive {
... | go | func (win *Window) Custom(state nstyle.WidgetStates) (bounds rect.Rect, out *command.Buffer) {
var s bool
if s, bounds, _ = win.widget(); !s {
return
}
prevstate := win.widgets.PrevState(bounds)
exitstate := basicWidgetStateControl(&prevstate, win.inputMaybe(s), bounds)
if state != nstyle.WidgetStateActive {
... | [
"func",
"(",
"win",
"*",
"Window",
")",
"Custom",
"(",
"state",
"nstyle",
".",
"WidgetStates",
")",
"(",
"bounds",
"rect",
".",
"Rect",
",",
"out",
"*",
"command",
".",
"Buffer",
")",
"{",
"var",
"s",
"bool",
"\n\n",
"if",
"s",
",",
"bounds",
",",
... | // Custom adds a custom widget. | [
"Custom",
"adds",
"a",
"custom",
"widget",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1601-L1614 | train |
aarzilli/nucular | nucular.go | Button | func (win *Window) Button(lbl label.Label, repeat bool) bool {
style := &win.ctx.Style
state, bounds, fitting := win.widget()
if fitting != nil {
buttonWidth(lbl, &style.Button, style.Font)
}
if !state {
return false
}
in := win.inputMaybe(state)
return doButton(win, lbl, bounds, &style.Button, in, repeat)
... | go | func (win *Window) Button(lbl label.Label, repeat bool) bool {
style := &win.ctx.Style
state, bounds, fitting := win.widget()
if fitting != nil {
buttonWidth(lbl, &style.Button, style.Font)
}
if !state {
return false
}
in := win.inputMaybe(state)
return doButton(win, lbl, bounds, &style.Button, in, repeat)
... | [
"func",
"(",
"win",
"*",
"Window",
")",
"Button",
"(",
"lbl",
"label",
".",
"Label",
",",
"repeat",
"bool",
")",
"bool",
"{",
"style",
":=",
"&",
"win",
".",
"ctx",
".",
"Style",
"\n",
"state",
",",
"bounds",
",",
"fitting",
":=",
"win",
".",
"wi... | // Button adds a button | [
"Button",
"adds",
"a",
"button"
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1774-L1785 | train |
aarzilli/nucular | nucular.go | SelectableLabel | func (win *Window) SelectableLabel(str string, align label.Align, value *bool) bool {
style := &win.ctx.Style
state, bounds, fitting := win.widget()
if fitting != nil {
fitting(selectableWidth(str, &style.Selectable, style.Font))
}
if !state {
return false
}
in := win.inputMaybe(state)
return doSelectable(w... | go | func (win *Window) SelectableLabel(str string, align label.Align, value *bool) bool {
style := &win.ctx.Style
state, bounds, fitting := win.widget()
if fitting != nil {
fitting(selectableWidth(str, &style.Selectable, style.Font))
}
if !state {
return false
}
in := win.inputMaybe(state)
return doSelectable(w... | [
"func",
"(",
"win",
"*",
"Window",
")",
"SelectableLabel",
"(",
"str",
"string",
",",
"align",
"label",
".",
"Align",
",",
"value",
"*",
"bool",
")",
"bool",
"{",
"style",
":=",
"&",
"win",
".",
"ctx",
".",
"Style",
"\n",
"state",
",",
"bounds",
",... | // SelectableLabel adds a selectable label. Value is a pointer
// to a flag that will be changed to reflect the selected state of
// this label.
// Returns true when the label is clicked. | [
"SelectableLabel",
"adds",
"a",
"selectable",
"label",
".",
"Value",
"is",
"a",
"pointer",
"to",
"a",
"flag",
"that",
"will",
"be",
"changed",
"to",
"reflect",
"the",
"selected",
"state",
"of",
"this",
"label",
".",
"Returns",
"true",
"when",
"the",
"label... | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L1827-L1838 | train |
aarzilli/nucular | nucular.go | OptionText | func (win *Window) OptionText(text string, is_active bool) bool {
style := &win.ctx.Style
state, bounds, fitting := win.widget()
if fitting != nil {
fitting(toggleWidth(text, toggleOption, &style.Option, style.Font))
}
if !state {
return false
}
in := win.inputMaybe(state)
is_active = doToggle(win, bounds, ... | go | func (win *Window) OptionText(text string, is_active bool) bool {
style := &win.ctx.Style
state, bounds, fitting := win.widget()
if fitting != nil {
fitting(toggleWidth(text, toggleOption, &style.Option, style.Font))
}
if !state {
return false
}
in := win.inputMaybe(state)
is_active = doToggle(win, bounds, ... | [
"func",
"(",
"win",
"*",
"Window",
")",
"OptionText",
"(",
"text",
"string",
",",
"is_active",
"bool",
")",
"bool",
"{",
"style",
":=",
"&",
"win",
".",
"ctx",
".",
"Style",
"\n",
"state",
",",
"bounds",
",",
"fitting",
":=",
"win",
".",
"widget",
... | // OptionText adds a radio button to win. If is_active is true the
// radio button will be drawn selected. Returns true when the button
// is clicked once.
// You are responsible for ensuring that only one radio button is selected at once. | [
"OptionText",
"adds",
"a",
"radio",
"button",
"to",
"win",
".",
"If",
"is_active",
"is",
"true",
"the",
"radio",
"button",
"will",
"be",
"drawn",
"selected",
".",
"Returns",
"true",
"when",
"the",
"button",
"is",
"clicked",
"once",
".",
"You",
"are",
"re... | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2178-L2190 | train |
aarzilli/nucular | nucular.go | CheckboxText | func (win *Window) CheckboxText(text string, active *bool) bool {
state, bounds, fitting := win.widget()
if fitting != nil {
fitting(toggleWidth(text, toggleCheck, &win.ctx.Style.Checkbox, win.ctx.Style.Font))
}
if !state {
return false
}
in := win.inputMaybe(state)
old_active := *active
*active = doToggle(... | go | func (win *Window) CheckboxText(text string, active *bool) bool {
state, bounds, fitting := win.widget()
if fitting != nil {
fitting(toggleWidth(text, toggleCheck, &win.ctx.Style.Checkbox, win.ctx.Style.Font))
}
if !state {
return false
}
in := win.inputMaybe(state)
old_active := *active
*active = doToggle(... | [
"func",
"(",
"win",
"*",
"Window",
")",
"CheckboxText",
"(",
"text",
"string",
",",
"active",
"*",
"bool",
")",
"bool",
"{",
"state",
",",
"bounds",
",",
"fitting",
":=",
"win",
".",
"widget",
"(",
")",
"\n",
"if",
"fitting",
"!=",
"nil",
"{",
"fit... | // CheckboxText adds a checkbox button to win. Active will contain
// the checkbox value.
// Returns true when value changes. | [
"CheckboxText",
"adds",
"a",
"checkbox",
"button",
"to",
"win",
".",
"Active",
"will",
"contain",
"the",
"checkbox",
"value",
".",
"Returns",
"true",
"when",
"value",
"changes",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2195-L2207 | train |
aarzilli/nucular | nucular.go | SliderFloat | func (win *Window) SliderFloat(min_value float64, value *float64, max_value float64, value_step float64) bool {
style := &win.ctx.Style
state, bounds, _ := win.widget()
if !state {
return false
}
in := win.inputMaybe(state)
old_value := *value
*value = doSlider(win, bounds, min_value, old_value, max_value, va... | go | func (win *Window) SliderFloat(min_value float64, value *float64, max_value float64, value_step float64) bool {
style := &win.ctx.Style
state, bounds, _ := win.widget()
if !state {
return false
}
in := win.inputMaybe(state)
old_value := *value
*value = doSlider(win, bounds, min_value, old_value, max_value, va... | [
"func",
"(",
"win",
"*",
"Window",
")",
"SliderFloat",
"(",
"min_value",
"float64",
",",
"value",
"*",
"float64",
",",
"max_value",
"float64",
",",
"value_step",
"float64",
")",
"bool",
"{",
"style",
":=",
"&",
"win",
".",
"ctx",
".",
"Style",
"\n",
"s... | // Adds a slider with a floating point value to win.
// Returns true when the slider's value is changed. | [
"Adds",
"a",
"slider",
"with",
"a",
"floating",
"point",
"value",
"to",
"win",
".",
"Returns",
"true",
"when",
"the",
"slider",
"s",
"value",
"is",
"changed",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2301-L2312 | train |
aarzilli/nucular | nucular.go | SliderInt | func (win *Window) SliderInt(min int, val *int, max int, step int) bool {
value := float64(*val)
ret := win.SliderFloat(float64(min), &value, float64(max), float64(step))
*val = int(value)
return ret
} | go | func (win *Window) SliderInt(min int, val *int, max int, step int) bool {
value := float64(*val)
ret := win.SliderFloat(float64(min), &value, float64(max), float64(step))
*val = int(value)
return ret
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"SliderInt",
"(",
"min",
"int",
",",
"val",
"*",
"int",
",",
"max",
"int",
",",
"step",
"int",
")",
"bool",
"{",
"value",
":=",
"float64",
"(",
"*",
"val",
")",
"\n",
"ret",
":=",
"win",
".",
"SliderFloat",... | // Adds a slider with an integer value to win.
// Returns true when the slider's value changes. | [
"Adds",
"a",
"slider",
"with",
"an",
"integer",
"value",
"to",
"win",
".",
"Returns",
"true",
"when",
"the",
"slider",
"s",
"value",
"changes",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2316-L2321 | train |
aarzilli/nucular | nucular.go | Progress | func (win *Window) Progress(cur *int, maxval int, is_modifiable bool) bool {
style := &win.ctx.Style
state, bounds, _ := win.widget()
if !state {
return false
}
in := win.inputMaybe(state)
old_value := *cur
*cur = doProgress(win, bounds, *cur, maxval, is_modifiable, &style.Progress, in)
return *cur != old_va... | go | func (win *Window) Progress(cur *int, maxval int, is_modifiable bool) bool {
style := &win.ctx.Style
state, bounds, _ := win.widget()
if !state {
return false
}
in := win.inputMaybe(state)
old_value := *cur
*cur = doProgress(win, bounds, *cur, maxval, is_modifiable, &style.Progress, in)
return *cur != old_va... | [
"func",
"(",
"win",
"*",
"Window",
")",
"Progress",
"(",
"cur",
"*",
"int",
",",
"maxval",
"int",
",",
"is_modifiable",
"bool",
")",
"bool",
"{",
"style",
":=",
"&",
"win",
".",
"ctx",
".",
"Style",
"\n",
"state",
",",
"bounds",
",",
"_",
":=",
"... | // Adds a progress bar to win. if is_modifiable is true the progress
// bar will be user modifiable through click-and-drag.
// Returns true when the progress bar values is modified. | [
"Adds",
"a",
"progress",
"bar",
"to",
"win",
".",
"if",
"is_modifiable",
"is",
"true",
"the",
"progress",
"bar",
"will",
"be",
"user",
"modifiable",
"through",
"click",
"-",
"and",
"-",
"drag",
".",
"Returns",
"true",
"when",
"the",
"progress",
"bar",
"v... | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2378-L2389 | train |
aarzilli/nucular | nucular.go | PropertyInt | func (win *Window) PropertyInt(name string, min int, val *int, max, step, inc_per_pixel int) (changed bool) {
s, bounds, fitting := win.widget()
if fitting != nil {
fitting(propertyWidth(max, &win.ctx.Style.Property, win.ctx.Style.Font))
}
if !s {
return
}
in := win.inputMaybe(s)
text := strconv.Itoa(*val)
... | go | func (win *Window) PropertyInt(name string, min int, val *int, max, step, inc_per_pixel int) (changed bool) {
s, bounds, fitting := win.widget()
if fitting != nil {
fitting(propertyWidth(max, &win.ctx.Style.Property, win.ctx.Style.Font))
}
if !s {
return
}
in := win.inputMaybe(s)
text := strconv.Itoa(*val)
... | [
"func",
"(",
"win",
"*",
"Window",
")",
"PropertyInt",
"(",
"name",
"string",
",",
"min",
"int",
",",
"val",
"*",
"int",
",",
"max",
",",
"step",
",",
"inc_per_pixel",
"int",
")",
"(",
"changed",
"bool",
")",
"{",
"s",
",",
"bounds",
",",
"fitting"... | // Same as PropertyFloat but with integer values. | [
"Same",
"as",
"PropertyFloat",
"but",
"with",
"integer",
"values",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2599-L2625 | train |
aarzilli/nucular | nucular.go | MenuItem | func (win *Window) MenuItem(lbl label.Label) bool {
style := &win.ctx.Style
state, bounds := win.widgetFitting(style.ContextualButton.Padding)
if !state {
return false
}
if win.flags&windowHDynamic != 0 {
w := FontWidth(style.Font, lbl.Text) + 2*style.ContextualButton.Padding.X
if w > win.menuItemWidth {
... | go | func (win *Window) MenuItem(lbl label.Label) bool {
style := &win.ctx.Style
state, bounds := win.widgetFitting(style.ContextualButton.Padding)
if !state {
return false
}
if win.flags&windowHDynamic != 0 {
w := FontWidth(style.Font, lbl.Text) + 2*style.ContextualButton.Padding.X
if w > win.menuItemWidth {
... | [
"func",
"(",
"win",
"*",
"Window",
")",
"MenuItem",
"(",
"lbl",
"label",
".",
"Label",
")",
"bool",
"{",
"style",
":=",
"&",
"win",
".",
"ctx",
".",
"Style",
"\n",
"state",
",",
"bounds",
":=",
"win",
".",
"widgetFitting",
"(",
"style",
".",
"Conte... | // MenuItem adds a menu item | [
"MenuItem",
"adds",
"a",
"menu",
"item"
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2745-L2766 | train |
aarzilli/nucular | nucular.go | TooltipOpen | func (win *Window) TooltipOpen(width int, scale bool, updateFn UpdateFn) {
in := &win.ctx.Input
if scale {
width = win.ctx.scale(width)
}
var bounds rect.Rect
bounds.W = width
bounds.H = nk_null_rect.H
bounds.X = (in.Mouse.Pos.X + 1)
bounds.Y = (in.Mouse.Pos.Y + 1)
win.ctx.popupOpen(tooltipWindowTitle, Wi... | go | func (win *Window) TooltipOpen(width int, scale bool, updateFn UpdateFn) {
in := &win.ctx.Input
if scale {
width = win.ctx.scale(width)
}
var bounds rect.Rect
bounds.W = width
bounds.H = nk_null_rect.H
bounds.X = (in.Mouse.Pos.X + 1)
bounds.Y = (in.Mouse.Pos.Y + 1)
win.ctx.popupOpen(tooltipWindowTitle, Wi... | [
"func",
"(",
"win",
"*",
"Window",
")",
"TooltipOpen",
"(",
"width",
"int",
",",
"scale",
"bool",
",",
"updateFn",
"UpdateFn",
")",
"{",
"in",
":=",
"&",
"win",
".",
"ctx",
".",
"Input",
"\n\n",
"if",
"scale",
"{",
"width",
"=",
"win",
".",
"ctx",
... | // Displays a tooltip window. | [
"Displays",
"a",
"tooltip",
"window",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2775-L2789 | train |
aarzilli/nucular | nucular.go | Tooltip | func (win *Window) Tooltip(text string) {
if text == "" {
return
}
/* fetch configuration data */
padding := win.ctx.Style.TooltipWindow.Padding
item_spacing := win.ctx.Style.TooltipWindow.Spacing
/* calculate size of the text and tooltip */
text_width := FontWidth(win.ctx.Style.Font, text) + win.ctx.scale(4... | go | func (win *Window) Tooltip(text string) {
if text == "" {
return
}
/* fetch configuration data */
padding := win.ctx.Style.TooltipWindow.Padding
item_spacing := win.ctx.Style.TooltipWindow.Spacing
/* calculate size of the text and tooltip */
text_width := FontWidth(win.ctx.Style.Font, text) + win.ctx.scale(4... | [
"func",
"(",
"win",
"*",
"Window",
")",
"Tooltip",
"(",
"text",
"string",
")",
"{",
"if",
"text",
"==",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n\n",
"/* fetch configuration data */",
"padding",
":=",
"win",
".",
"ctx",
".",
"Style",
".",
"TooltipWindow"... | // Shows a tooltip window containing the specified text. | [
"Shows",
"a",
"tooltip",
"window",
"containing",
"the",
"specified",
"text",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2792-L2809 | train |
aarzilli/nucular | nucular.go | ComboSimple | func (win *Window) ComboSimple(items []string, selected int, item_height int) int {
if len(items) == 0 {
return selected
}
item_height = win.ctx.scale(item_height)
item_padding := win.ctx.Style.Combo.ButtonPadding.Y
window_padding := win.style().Padding.Y
max_height := (len(items)+1)*item_height + item_padding... | go | func (win *Window) ComboSimple(items []string, selected int, item_height int) int {
if len(items) == 0 {
return selected
}
item_height = win.ctx.scale(item_height)
item_padding := win.ctx.Style.Combo.ButtonPadding.Y
window_padding := win.style().Padding.Y
max_height := (len(items)+1)*item_height + item_padding... | [
"func",
"(",
"win",
"*",
"Window",
")",
"ComboSimple",
"(",
"items",
"[",
"]",
"string",
",",
"selected",
"int",
",",
"item_height",
"int",
")",
"int",
"{",
"if",
"len",
"(",
"items",
")",
"==",
"0",
"{",
"return",
"selected",
"\n",
"}",
"\n\n",
"i... | // Adds a drop-down list to win. The contents are specified by items,
// with selected being the index of the selected item. | [
"Adds",
"a",
"drop",
"-",
"down",
"list",
"to",
"win",
".",
"The",
"contents",
"are",
"specified",
"by",
"items",
"with",
"selected",
"being",
"the",
"index",
"of",
"the",
"selected",
"item",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2869-L2887 | train |
aarzilli/nucular | nucular.go | GroupEnd | func (win *Window) GroupEnd() {
panelEnd(win.ctx, win)
win.parent.usingSub = false
// immediate drawing
win.parent.cmds.Commands = append(win.parent.cmds.Commands, win.cmds.Commands...)
} | go | func (win *Window) GroupEnd() {
panelEnd(win.ctx, win)
win.parent.usingSub = false
// immediate drawing
win.parent.cmds.Commands = append(win.parent.cmds.Commands, win.cmds.Commands...)
} | [
"func",
"(",
"win",
"*",
"Window",
")",
"GroupEnd",
"(",
")",
"{",
"panelEnd",
"(",
"win",
".",
"ctx",
",",
"win",
")",
"\n",
"win",
".",
"parent",
".",
"usingSub",
"=",
"false",
"\n\n",
"// immediate drawing",
"win",
".",
"parent",
".",
"cmds",
".",... | // Signals that you are done adding widgets to a group. | [
"Signals",
"that",
"you",
"are",
"done",
"adding",
"widgets",
"to",
"a",
"group",
"."
] | 64ec1eba91814ebb417978927206070dd1fc44e1 | https://github.com/aarzilli/nucular/blob/64ec1eba91814ebb417978927206070dd1fc44e1/nucular.go#L2989-L2995 | train |
goadapp/goad | lambda/lambda.go | newLambda | func newLambda(s LambdaSettings) *goadLambda {
setLambdaExecTimeout(&s)
setDefaultConcurrencyCount(&s)
l := &goadLambda{}
l.Settings = s
l.Metrics = NewRequestMetric(s.LambdaRegion, s.RunnerID)
remainingRequestCount := s.MaxRequestCount - s.CompletedRequestCount
if remainingRequestCount < 0 {
remainingReques... | go | func newLambda(s LambdaSettings) *goadLambda {
setLambdaExecTimeout(&s)
setDefaultConcurrencyCount(&s)
l := &goadLambda{}
l.Settings = s
l.Metrics = NewRequestMetric(s.LambdaRegion, s.RunnerID)
remainingRequestCount := s.MaxRequestCount - s.CompletedRequestCount
if remainingRequestCount < 0 {
remainingReques... | [
"func",
"newLambda",
"(",
"s",
"LambdaSettings",
")",
"*",
"goadLambda",
"{",
"setLambdaExecTimeout",
"(",
"&",
"s",
")",
"\n",
"setDefaultConcurrencyCount",
"(",
"&",
"s",
")",
"\n\n",
"l",
":=",
"&",
"goadLambda",
"{",
"}",
"\n",
"l",
".",
"Settings",
... | // newLambda creates a new Lambda to execute a load test from a given
// LambdaSettings | [
"newLambda",
"creates",
"a",
"new",
"Lambda",
"to",
"execute",
"a",
"load",
"test",
"from",
"a",
"given",
"LambdaSettings"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/lambda/lambda.go#L200-L218 | train |
goadapp/goad | result/result.go | Regions | func (r *LambdaResults) Regions() []string {
regions := make([]string, 0)
for _, lambda := range r.Lambdas {
if lambda.Region != "" {
regions = append(regions, lambda.Region)
}
}
regions = util.RemoveDuplicates(regions)
sort.Strings(regions)
return regions
} | go | func (r *LambdaResults) Regions() []string {
regions := make([]string, 0)
for _, lambda := range r.Lambdas {
if lambda.Region != "" {
regions = append(regions, lambda.Region)
}
}
regions = util.RemoveDuplicates(regions)
sort.Strings(regions)
return regions
} | [
"func",
"(",
"r",
"*",
"LambdaResults",
")",
"Regions",
"(",
")",
"[",
"]",
"string",
"{",
"regions",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"_",
",",
"lambda",
":=",
"range",
"r",
".",
"Lambdas",
"{",
"if",
"lambda",
... | // Regions the LambdaResults were collected from | [
"Regions",
"the",
"LambdaResults",
"were",
"collected",
"from"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/result/result.go#L37-L47 | train |
goadapp/goad | result/result.go | RegionsData | func (r *LambdaResults) RegionsData() map[string]AggData {
regionsMap := make(map[string]AggData)
for _, region := range r.Regions() {
regionsMap[region] = sumAggData(r.ResultsForRegion(region))
}
return regionsMap
} | go | func (r *LambdaResults) RegionsData() map[string]AggData {
regionsMap := make(map[string]AggData)
for _, region := range r.Regions() {
regionsMap[region] = sumAggData(r.ResultsForRegion(region))
}
return regionsMap
} | [
"func",
"(",
"r",
"*",
"LambdaResults",
")",
"RegionsData",
"(",
")",
"map",
"[",
"string",
"]",
"AggData",
"{",
"regionsMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"AggData",
")",
"\n",
"for",
"_",
",",
"region",
":=",
"range",
"r",
".",
"... | // RegionsData aggregates the individual lambda functions results per region | [
"RegionsData",
"aggregates",
"the",
"individual",
"lambda",
"functions",
"results",
"per",
"region"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/result/result.go#L50-L56 | train |
goadapp/goad | result/result.go | ResultsForRegion | func (r *LambdaResults) ResultsForRegion(region string) []AggData {
lambdasOfRegion := make([]AggData, 0)
for _, lambda := range r.Lambdas {
if lambda.Region == region {
lambdasOfRegion = append(lambdasOfRegion, lambda)
}
}
return lambdasOfRegion
} | go | func (r *LambdaResults) ResultsForRegion(region string) []AggData {
lambdasOfRegion := make([]AggData, 0)
for _, lambda := range r.Lambdas {
if lambda.Region == region {
lambdasOfRegion = append(lambdasOfRegion, lambda)
}
}
return lambdasOfRegion
} | [
"func",
"(",
"r",
"*",
"LambdaResults",
")",
"ResultsForRegion",
"(",
"region",
"string",
")",
"[",
"]",
"AggData",
"{",
"lambdasOfRegion",
":=",
"make",
"(",
"[",
"]",
"AggData",
",",
"0",
")",
"\n",
"for",
"_",
",",
"lambda",
":=",
"range",
"r",
".... | //ResultsForRegion return the sum of results for a given regions | [
"ResultsForRegion",
"return",
"the",
"sum",
"of",
"results",
"for",
"a",
"given",
"regions"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/result/result.go#L64-L72 | train |
goadapp/goad | cli/cli.go | Run | func Run() {
app.HelpFlag.Short('h')
app.Version(version.String())
app.VersionFlag.Short('V')
config := aggregateConfiguration()
err := config.Check()
goad.HandleErr(err)
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) // but interrupts from kbd are blocked by termbo... | go | func Run() {
app.HelpFlag.Short('h')
app.Version(version.String())
app.VersionFlag.Short('V')
config := aggregateConfiguration()
err := config.Check()
goad.HandleErr(err)
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) // but interrupts from kbd are blocked by termbo... | [
"func",
"Run",
"(",
")",
"{",
"app",
".",
"HelpFlag",
".",
"Short",
"(",
"'h'",
")",
"\n",
"app",
".",
"Version",
"(",
"version",
".",
"String",
"(",
")",
")",
"\n",
"app",
".",
"VersionFlag",
".",
"Short",
"(",
"'V'",
")",
"\n\n",
"config",
":="... | // Run the goad cli | [
"Run",
"the",
"goad",
"cli"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/cli/cli.go#L77-L94 | train |
goadapp/goad | cli/cli.go | clearLogo | func clearLogo() {
w, h := termbox.Size()
clearStr := strings.Repeat(" ", w)
for i := 0; i < h-1; i++ {
renderString(0, i, clearStr, coldef, coldef)
}
} | go | func clearLogo() {
w, h := termbox.Size()
clearStr := strings.Repeat(" ", w)
for i := 0; i < h-1; i++ {
renderString(0, i, clearStr, coldef, coldef)
}
} | [
"func",
"clearLogo",
"(",
")",
"{",
"w",
",",
"h",
":=",
"termbox",
".",
"Size",
"(",
")",
"\n",
"clearStr",
":=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"w",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"h",
"-",
"1",
";",
"i"... | // Also clears loading message | [
"Also",
"clears",
"loading",
"message"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/cli/cli.go#L381-L387 | train |
goadapp/goad | cli/cli.go | renderRegion | func renderRegion(data result.AggData, y int) int {
x := 0
renderString(x, y, "Region: ", termbox.ColorWhite, termbox.ColorBlue)
x += 8
regionStr := fmt.Sprintf("%s", data.Region)
renderString(x, y, regionStr, termbox.ColorWhite|termbox.AttrBold, termbox.ColorBlue)
x = 0
y++
headingStr := " TotReqs TotBytes... | go | func renderRegion(data result.AggData, y int) int {
x := 0
renderString(x, y, "Region: ", termbox.ColorWhite, termbox.ColorBlue)
x += 8
regionStr := fmt.Sprintf("%s", data.Region)
renderString(x, y, regionStr, termbox.ColorWhite|termbox.AttrBold, termbox.ColorBlue)
x = 0
y++
headingStr := " TotReqs TotBytes... | [
"func",
"renderRegion",
"(",
"data",
"result",
".",
"AggData",
",",
"y",
"int",
")",
"int",
"{",
"x",
":=",
"0",
"\n",
"renderString",
"(",
"x",
",",
"y",
",",
"\"",
"\"",
",",
"termbox",
".",
"ColorWhite",
",",
"termbox",
".",
"ColorBlue",
")",
"\... | // renderRegion returns the y for the next empty line | [
"renderRegion",
"returns",
"the",
"y",
"for",
"the",
"next",
"empty",
"line"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/cli/cli.go#L390-L412 | train |
goadapp/goad | goad/goad.go | Start | func Start(t *types.TestConfig) (<-chan *result.LambdaResults, func()) {
var infra infrastructure.Infrastructure
if t.RunDocker {
infra = dockerinfra.New(t)
} else {
infra = awsinfra.New(t)
}
teardown, err := infra.Setup()
HandleErr(err)
t.Lambdas = numberOfLambdas(t.Concurrency, len(t.Regions))
infrastruc... | go | func Start(t *types.TestConfig) (<-chan *result.LambdaResults, func()) {
var infra infrastructure.Infrastructure
if t.RunDocker {
infra = dockerinfra.New(t)
} else {
infra = awsinfra.New(t)
}
teardown, err := infra.Setup()
HandleErr(err)
t.Lambdas = numberOfLambdas(t.Concurrency, len(t.Regions))
infrastruc... | [
"func",
"Start",
"(",
"t",
"*",
"types",
".",
"TestConfig",
")",
"(",
"<-",
"chan",
"*",
"result",
".",
"LambdaResults",
",",
"func",
"(",
")",
")",
"{",
"var",
"infra",
"infrastructure",
".",
"Infrastructure",
"\n",
"if",
"t",
".",
"RunDocker",
"{",
... | // Start a test | [
"Start",
"a",
"test"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/goad/goad.go#L12-L35 | train |
goadapp/goad | infrastructure/aws/sqsadapter/sqsadapter.go | New | func New(awsConfig *aws.Config, queueURL string) *Adapter {
return &Adapter{getClient(awsConfig), queueURL}
} | go | func New(awsConfig *aws.Config, queueURL string) *Adapter {
return &Adapter{getClient(awsConfig), queueURL}
} | [
"func",
"New",
"(",
"awsConfig",
"*",
"aws",
".",
"Config",
",",
"queueURL",
"string",
")",
"*",
"Adapter",
"{",
"return",
"&",
"Adapter",
"{",
"getClient",
"(",
"awsConfig",
")",
",",
"queueURL",
"}",
"\n",
"}"
] | // NewSQSAdapter returns a new sqs adator object | [
"NewSQSAdapter",
"returns",
"a",
"new",
"sqs",
"adator",
"object"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/infrastructure/aws/sqsadapter/sqsadapter.go#L26-L28 | train |
goadapp/goad | infrastructure/aws/sqsadapter/sqsadapter.go | Receive | func (adaptor Adapter) Receive() []*api.RunnerResult {
params := &sqs.ReceiveMessageInput{
QueueUrl: aws.String(adaptor.QueueURL),
MaxNumberOfMessages: aws.Int64(10),
VisibilityTimeout: aws.Int64(1),
WaitTimeSeconds: aws.Int64(1),
}
resp, err := adaptor.Client.ReceiveMessage(params)
if err... | go | func (adaptor Adapter) Receive() []*api.RunnerResult {
params := &sqs.ReceiveMessageInput{
QueueUrl: aws.String(adaptor.QueueURL),
MaxNumberOfMessages: aws.Int64(10),
VisibilityTimeout: aws.Int64(1),
WaitTimeSeconds: aws.Int64(1),
}
resp, err := adaptor.Client.ReceiveMessage(params)
if err... | [
"func",
"(",
"adaptor",
"Adapter",
")",
"Receive",
"(",
")",
"[",
"]",
"*",
"api",
".",
"RunnerResult",
"{",
"params",
":=",
"&",
"sqs",
".",
"ReceiveMessageInput",
"{",
"QueueUrl",
":",
"aws",
".",
"String",
"(",
"adaptor",
".",
"QueueURL",
")",
",",
... | // Receive a result, or timeout in 1 second | [
"Receive",
"a",
"result",
"or",
"timeout",
"in",
"1",
"second"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/infrastructure/aws/sqsadapter/sqsadapter.go#L41-L87 | train |
goadapp/goad | infrastructure/aws/sqsadapter/sqsadapter.go | SendResult | func (adaptor Adapter) SendResult(result api.RunnerResult) error {
str, jsonerr := jsonFromResult(result)
if jsonerr != nil {
fmt.Println(jsonerr)
panic(jsonerr)
}
params := &sqs.SendMessageInput{
MessageBody: aws.String(str),
MessageGroupId: aws.String("goad-lambda"),
MessageDeduplicat... | go | func (adaptor Adapter) SendResult(result api.RunnerResult) error {
str, jsonerr := jsonFromResult(result)
if jsonerr != nil {
fmt.Println(jsonerr)
panic(jsonerr)
}
params := &sqs.SendMessageInput{
MessageBody: aws.String(str),
MessageGroupId: aws.String("goad-lambda"),
MessageDeduplicat... | [
"func",
"(",
"adaptor",
"Adapter",
")",
"SendResult",
"(",
"result",
"api",
".",
"RunnerResult",
")",
"error",
"{",
"str",
",",
"jsonerr",
":=",
"jsonFromResult",
"(",
"result",
")",
"\n",
"if",
"jsonerr",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
... | // SendResult adds a result to the queue | [
"SendResult",
"adds",
"a",
"result",
"to",
"the",
"queue"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/infrastructure/aws/sqsadapter/sqsadapter.go#L109-L124 | train |
goadapp/goad | infrastructure/aws/sqsadapter/sqsadapter.go | SendResult | func (adaptor DummyAdapter) SendResult(result api.RunnerResult) {
str, jsonerr := jsonFromResult(result)
if jsonerr != nil {
fmt.Println(jsonerr)
return
}
fmt.Println("\n" + str)
} | go | func (adaptor DummyAdapter) SendResult(result api.RunnerResult) {
str, jsonerr := jsonFromResult(result)
if jsonerr != nil {
fmt.Println(jsonerr)
return
}
fmt.Println("\n" + str)
} | [
"func",
"(",
"adaptor",
"DummyAdapter",
")",
"SendResult",
"(",
"result",
"api",
".",
"RunnerResult",
")",
"{",
"str",
",",
"jsonerr",
":=",
"jsonFromResult",
"(",
"result",
")",
"\n",
"if",
"jsonerr",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"jsone... | // SendResult prints the result | [
"SendResult",
"prints",
"the",
"result"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/infrastructure/aws/sqsadapter/sqsadapter.go#L127-L134 | train |
goadapp/goad | webapi/webapi.go | Serve | func Serve() {
http.HandleFunc("/goad", serveResults)
http.HandleFunc("/_health", health)
err := http.ListenAndServe(*addr, nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
} | go | func Serve() {
http.HandleFunc("/goad", serveResults)
http.HandleFunc("/_health", health)
err := http.ListenAndServe(*addr, nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
} | [
"func",
"Serve",
"(",
")",
"{",
"http",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"serveResults",
")",
"\n",
"http",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"health",
")",
"\n",
"err",
":=",
"http",
".",
"ListenAndServe",
"(",
"*",
"addr",
",",
"ni... | // Serve waits for connections and serves the results | [
"Serve",
"waits",
"for",
"connections",
"and",
"serves",
"the",
"results"
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/webapi/webapi.go#L141-L148 | train |
goadapp/goad | infrastructure/aws/aws.go | New | func New(config *types.TestConfig) infrastructure.Infrastructure {
awsConfig := aws.NewConfig().WithRegion(config.Regions[0])
infra := &AwsInfrastructure{config: config, awsConfig: awsConfig}
return infra
} | go | func New(config *types.TestConfig) infrastructure.Infrastructure {
awsConfig := aws.NewConfig().WithRegion(config.Regions[0])
infra := &AwsInfrastructure{config: config, awsConfig: awsConfig}
return infra
} | [
"func",
"New",
"(",
"config",
"*",
"types",
".",
"TestConfig",
")",
"infrastructure",
".",
"Infrastructure",
"{",
"awsConfig",
":=",
"aws",
".",
"NewConfig",
"(",
")",
".",
"WithRegion",
"(",
"config",
".",
"Regions",
"[",
"0",
"]",
")",
"\n",
"infra",
... | // New creates the required infrastructure to run the load tests in Lambda
// functions. | [
"New",
"creates",
"the",
"required",
"infrastructure",
"to",
"run",
"the",
"load",
"tests",
"in",
"Lambda",
"functions",
"."
] | 612187f4fd0d04b18f7181e8434717a175341ada | https://github.com/goadapp/goad/blob/612187f4fd0d04b18f7181e8434717a175341ada/infrastructure/aws/aws.go#L43-L47 | train |
opencontainers/image-spec | schema/validator.go | Validate | func (v Validator) Validate(src io.Reader) error {
buf, err := ioutil.ReadAll(src)
if err != nil {
return errors.Wrap(err, "unable to read the document file")
}
if f, ok := mapValidate[v]; ok {
if f == nil {
return fmt.Errorf("internal error: mapValidate[%q] is nil", v)
}
err = f(bytes.NewReader(buf))
... | go | func (v Validator) Validate(src io.Reader) error {
buf, err := ioutil.ReadAll(src)
if err != nil {
return errors.Wrap(err, "unable to read the document file")
}
if f, ok := mapValidate[v]; ok {
if f == nil {
return fmt.Errorf("internal error: mapValidate[%q] is nil", v)
}
err = f(bytes.NewReader(buf))
... | [
"func",
"(",
"v",
"Validator",
")",
"Validate",
"(",
"src",
"io",
".",
"Reader",
")",
"error",
"{",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"er... | // Validate validates the given reader against the schema of the wrapped media type. | [
"Validate",
"validates",
"the",
"given",
"reader",
"against",
"the",
"schema",
"of",
"the",
"wrapped",
"media",
"type",
"."
] | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/schema/validator.go#L54-L92 | train |
opencontainers/image-spec | identity/chainid.go | ChainID | func ChainID(dgsts []digest.Digest) digest.Digest {
chainIDs := make([]digest.Digest, len(dgsts))
copy(chainIDs, dgsts)
ChainIDs(chainIDs)
if len(chainIDs) == 0 {
return ""
}
return chainIDs[len(chainIDs)-1]
} | go | func ChainID(dgsts []digest.Digest) digest.Digest {
chainIDs := make([]digest.Digest, len(dgsts))
copy(chainIDs, dgsts)
ChainIDs(chainIDs)
if len(chainIDs) == 0 {
return ""
}
return chainIDs[len(chainIDs)-1]
} | [
"func",
"ChainID",
"(",
"dgsts",
"[",
"]",
"digest",
".",
"Digest",
")",
"digest",
".",
"Digest",
"{",
"chainIDs",
":=",
"make",
"(",
"[",
"]",
"digest",
".",
"Digest",
",",
"len",
"(",
"dgsts",
")",
")",
"\n",
"copy",
"(",
"chainIDs",
",",
"dgsts"... | // ChainID takes a slice of digests and returns the ChainID corresponding to
// the last entry. Typically, these are a list of layer DiffIDs, with the
// result providing the ChainID identifying the result of sequential
// application of the preceding layers. | [
"ChainID",
"takes",
"a",
"slice",
"of",
"digests",
"and",
"returns",
"the",
"ChainID",
"corresponding",
"to",
"the",
"last",
"entry",
".",
"Typically",
"these",
"are",
"a",
"list",
"of",
"layer",
"DiffIDs",
"with",
"the",
"result",
"providing",
"the",
"Chain... | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/identity/chainid.go#L30-L39 | train |
opencontainers/image-spec | identity/helpers.go | FromReader | func FromReader(rd io.Reader) (digest.Digest, error) {
return digest.Canonical.FromReader(rd)
} | go | func FromReader(rd io.Reader) (digest.Digest, error) {
return digest.Canonical.FromReader(rd)
} | [
"func",
"FromReader",
"(",
"rd",
"io",
".",
"Reader",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"return",
"digest",
".",
"Canonical",
".",
"FromReader",
"(",
"rd",
")",
"\n",
"}"
] | // FromReader consumes the content of rd until io.EOF, returning canonical
// digest. | [
"FromReader",
"consumes",
"the",
"content",
"of",
"rd",
"until",
"io",
".",
"EOF",
"returning",
"canonical",
"digest",
"."
] | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/identity/helpers.go#L28-L30 | train |
opencontainers/image-spec | schema/loader.go | newFSLoaderFactory | func newFSLoaderFactory(namespaces []string, fs http.FileSystem) *fsLoaderFactory {
return &fsLoaderFactory{
namespaces: namespaces,
fs: fs,
}
} | go | func newFSLoaderFactory(namespaces []string, fs http.FileSystem) *fsLoaderFactory {
return &fsLoaderFactory{
namespaces: namespaces,
fs: fs,
}
} | [
"func",
"newFSLoaderFactory",
"(",
"namespaces",
"[",
"]",
"string",
",",
"fs",
"http",
".",
"FileSystem",
")",
"*",
"fsLoaderFactory",
"{",
"return",
"&",
"fsLoaderFactory",
"{",
"namespaces",
":",
"namespaces",
",",
"fs",
":",
"fs",
",",
"}",
"\n",
"}"
] | // newFSLoaderFactory returns a fsLoaderFactory reading files under the specified namespaces from the root of fs. | [
"newFSLoaderFactory",
"returns",
"a",
"fsLoaderFactory",
"reading",
"files",
"under",
"the",
"specified",
"namespaces",
"from",
"the",
"root",
"of",
"fs",
"."
] | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/schema/loader.go#L37-L42 | train |
opencontainers/image-spec | schema/loader.go | refContents | func (factory *fsLoaderFactory) refContents(ref gojsonreference.JsonReference) ([]byte, error) {
refStr := ref.String()
path := ""
for _, ns := range factory.namespaces {
if strings.HasPrefix(refStr, ns) {
path = "/" + strings.TrimPrefix(refStr, ns)
break
}
}
if path == "" {
return nil, fmt.Errorf("Sch... | go | func (factory *fsLoaderFactory) refContents(ref gojsonreference.JsonReference) ([]byte, error) {
refStr := ref.String()
path := ""
for _, ns := range factory.namespaces {
if strings.HasPrefix(refStr, ns) {
path = "/" + strings.TrimPrefix(refStr, ns)
break
}
}
if path == "" {
return nil, fmt.Errorf("Sch... | [
"func",
"(",
"factory",
"*",
"fsLoaderFactory",
")",
"refContents",
"(",
"ref",
"gojsonreference",
".",
"JsonReference",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"refStr",
":=",
"ref",
".",
"String",
"(",
")",
"\n",
"path",
":=",
"\"",
"\"",... | // refContents returns the contents of ref, if available in fsLoaderFactory. | [
"refContents",
"returns",
"the",
"contents",
"of",
"ref",
"if",
"available",
"in",
"fsLoaderFactory",
"."
] | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/schema/loader.go#L52-L72 | train |
opencontainers/image-spec | schema/loader.go | decodeJSONUsingNumber | func decodeJSONUsingNumber(r io.Reader) (interface{}, error) {
// Copied from gojsonschema.
var document interface{}
decoder := json.NewDecoder(r)
decoder.UseNumber()
err := decoder.Decode(&document)
if err != nil {
return nil, err
}
return document, nil
} | go | func decodeJSONUsingNumber(r io.Reader) (interface{}, error) {
// Copied from gojsonschema.
var document interface{}
decoder := json.NewDecoder(r)
decoder.UseNumber()
err := decoder.Decode(&document)
if err != nil {
return nil, err
}
return document, nil
} | [
"func",
"decodeJSONUsingNumber",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// Copied from gojsonschema.",
"var",
"document",
"interface",
"{",
"}",
"\n\n",
"decoder",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
... | // decodeJSONUsingNumber returns JSON parsed from an io.Reader | [
"decodeJSONUsingNumber",
"returns",
"JSON",
"parsed",
"from",
"an",
"io",
".",
"Reader"
] | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/schema/loader.go#L104-L117 | train |
opencontainers/image-spec | schema/loader.go | JsonReference | func (l *fsLoader) JsonReference() (gojsonreference.JsonReference, error) { // nolint: golint
return gojsonreference.NewJsonReference(l.JsonSource().(string))
} | go | func (l *fsLoader) JsonReference() (gojsonreference.JsonReference, error) { // nolint: golint
return gojsonreference.NewJsonReference(l.JsonSource().(string))
} | [
"func",
"(",
"l",
"*",
"fsLoader",
")",
"JsonReference",
"(",
")",
"(",
"gojsonreference",
".",
"JsonReference",
",",
"error",
")",
"{",
"// nolint: golint",
"return",
"gojsonreference",
".",
"NewJsonReference",
"(",
"l",
".",
"JsonSource",
"(",
")",
".",
"(... | // JsonReference implements gojsonschema.JSONLoader.JsonReference. The "Json" capitalization needs to be maintained to conform to the interface. | [
"JsonReference",
"implements",
"gojsonschema",
".",
"JSONLoader",
".",
"JsonReference",
".",
"The",
"Json",
"capitalization",
"needs",
"to",
"be",
"maintained",
"to",
"conform",
"to",
"the",
"interface",
"."
] | da296dcb1e473a9b4e2d148941d7faa9ac8fea3f | https://github.com/opencontainers/image-spec/blob/da296dcb1e473a9b4e2d148941d7faa9ac8fea3f/schema/loader.go#L120-L122 | train |
gocraft/work | enqueue.go | NewEnqueuer | func NewEnqueuer(namespace string, pool *redis.Pool) *Enqueuer {
if pool == nil {
panic("NewEnqueuer needs a non-nil *redis.Pool")
}
return &Enqueuer{
Namespace: namespace,
Pool: pool,
queuePrefix: redisKeyJobsPrefix(namespace),
knownJobs: make(map[string... | go | func NewEnqueuer(namespace string, pool *redis.Pool) *Enqueuer {
if pool == nil {
panic("NewEnqueuer needs a non-nil *redis.Pool")
}
return &Enqueuer{
Namespace: namespace,
Pool: pool,
queuePrefix: redisKeyJobsPrefix(namespace),
knownJobs: make(map[string... | [
"func",
"NewEnqueuer",
"(",
"namespace",
"string",
",",
"pool",
"*",
"redis",
".",
"Pool",
")",
"*",
"Enqueuer",
"{",
"if",
"pool",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Enqueuer",
"{",
"Namespace",
":",
... | // NewEnqueuer creates a new enqueuer with the specified Redis namespace and Redis pool. | [
"NewEnqueuer",
"creates",
"a",
"new",
"enqueuer",
"with",
"the",
"specified",
"Redis",
"namespace",
"and",
"Redis",
"pool",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/enqueue.go#L23-L36 | train |
gocraft/work | enqueue.go | EnqueueIn | func (e *Enqueuer) EnqueueIn(jobName string, secondsFromNow int64, args map[string]interface{}) (*ScheduledJob, error) {
job := &Job{
Name: jobName,
ID: makeIdentifier(),
EnqueuedAt: nowEpochSeconds(),
Args: args,
}
rawJSON, err := job.serialize()
if err != nil {
return nil, err
}
... | go | func (e *Enqueuer) EnqueueIn(jobName string, secondsFromNow int64, args map[string]interface{}) (*ScheduledJob, error) {
job := &Job{
Name: jobName,
ID: makeIdentifier(),
EnqueuedAt: nowEpochSeconds(),
Args: args,
}
rawJSON, err := job.serialize()
if err != nil {
return nil, err
}
... | [
"func",
"(",
"e",
"*",
"Enqueuer",
")",
"EnqueueIn",
"(",
"jobName",
"string",
",",
"secondsFromNow",
"int64",
",",
"args",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"*",
"ScheduledJob",
",",
"error",
")",
"{",
"job",
":=",
"&",
"Jo... | // EnqueueIn enqueues a job in the scheduled job queue for execution in secondsFromNow seconds. | [
"EnqueueIn",
"enqueues",
"a",
"job",
"in",
"the",
"scheduled",
"job",
"queue",
"for",
"execution",
"in",
"secondsFromNow",
"seconds",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/enqueue.go#L68-L99 | train |
gocraft/work | enqueue.go | EnqueueUniqueIn | func (e *Enqueuer) EnqueueUniqueIn(jobName string, secondsFromNow int64, args map[string]interface{}) (*ScheduledJob, error) {
return e.EnqueueUniqueInByKey(jobName, secondsFromNow, args, nil)
} | go | func (e *Enqueuer) EnqueueUniqueIn(jobName string, secondsFromNow int64, args map[string]interface{}) (*ScheduledJob, error) {
return e.EnqueueUniqueInByKey(jobName, secondsFromNow, args, nil)
} | [
"func",
"(",
"e",
"*",
"Enqueuer",
")",
"EnqueueUniqueIn",
"(",
"jobName",
"string",
",",
"secondsFromNow",
"int64",
",",
"args",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"*",
"ScheduledJob",
",",
"error",
")",
"{",
"return",
"e",
".... | // EnqueueUniqueIn enqueues a unique job in the scheduled job queue for execution in secondsFromNow seconds. See EnqueueUnique for the semantics of unique jobs. | [
"EnqueueUniqueIn",
"enqueues",
"a",
"unique",
"job",
"in",
"the",
"scheduled",
"job",
"queue",
"for",
"execution",
"in",
"secondsFromNow",
"seconds",
".",
"See",
"EnqueueUnique",
"for",
"the",
"semantics",
"of",
"unique",
"jobs",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/enqueue.go#L112-L114 | train |
gocraft/work | enqueue.go | EnqueueUniqueInByKey | func (e *Enqueuer) EnqueueUniqueInByKey(jobName string, secondsFromNow int64, args map[string]interface{}, keyMap map[string]interface{}) (*ScheduledJob, error) {
enqueue, job, err := e.uniqueJobHelper(jobName, args, keyMap)
if err != nil {
return nil, err
}
scheduledJob := &ScheduledJob{
RunAt: nowEpochSecond... | go | func (e *Enqueuer) EnqueueUniqueInByKey(jobName string, secondsFromNow int64, args map[string]interface{}, keyMap map[string]interface{}) (*ScheduledJob, error) {
enqueue, job, err := e.uniqueJobHelper(jobName, args, keyMap)
if err != nil {
return nil, err
}
scheduledJob := &ScheduledJob{
RunAt: nowEpochSecond... | [
"func",
"(",
"e",
"*",
"Enqueuer",
")",
"EnqueueUniqueInByKey",
"(",
"jobName",
"string",
",",
"secondsFromNow",
"int64",
",",
"args",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"keyMap",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",... | // EnqueueUniqueInByKey enqueues a job in the scheduled job queue that is unique on specified key for execution in secondsFromNow seconds. See EnqueueUnique for the semantics of unique jobs.
// Subsequent calls with same key will update arguments | [
"EnqueueUniqueInByKey",
"enqueues",
"a",
"job",
"in",
"the",
"scheduled",
"job",
"queue",
"that",
"is",
"unique",
"on",
"specified",
"key",
"for",
"execution",
"in",
"secondsFromNow",
"seconds",
".",
"See",
"EnqueueUnique",
"for",
"the",
"semantics",
"of",
"uniq... | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/enqueue.go#L138-L154 | train |
gocraft/work | client.go | NewClient | func NewClient(namespace string, pool *redis.Pool) *Client {
return &Client{
namespace: namespace,
pool: pool,
}
} | go | func NewClient(namespace string, pool *redis.Pool) *Client {
return &Client{
namespace: namespace,
pool: pool,
}
} | [
"func",
"NewClient",
"(",
"namespace",
"string",
",",
"pool",
"*",
"redis",
".",
"Pool",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"namespace",
":",
"namespace",
",",
"pool",
":",
"pool",
",",
"}",
"\n",
"}"
] | // NewClient creates a new Client with the specified redis namespace and connection pool. | [
"NewClient",
"creates",
"a",
"new",
"Client",
"with",
"the",
"specified",
"redis",
"namespace",
"and",
"connection",
"pool",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L27-L32 | train |
gocraft/work | client.go | WorkerObservations | func (c *Client) WorkerObservations() ([]*WorkerObservation, error) {
conn := c.pool.Get()
defer conn.Close()
hbs, err := c.WorkerPoolHeartbeats()
if err != nil {
logError("worker_observations.worker_pool_heartbeats", err)
return nil, err
}
var workerIDs []string
for _, hb := range hbs {
workerIDs = appe... | go | func (c *Client) WorkerObservations() ([]*WorkerObservation, error) {
conn := c.pool.Get()
defer conn.Close()
hbs, err := c.WorkerPoolHeartbeats()
if err != nil {
logError("worker_observations.worker_pool_heartbeats", err)
return nil, err
}
var workerIDs []string
for _, hb := range hbs {
workerIDs = appe... | [
"func",
"(",
"c",
"*",
"Client",
")",
"WorkerObservations",
"(",
")",
"(",
"[",
"]",
"*",
"WorkerObservation",
",",
"error",
")",
"{",
"conn",
":=",
"c",
".",
"pool",
".",
"Get",
"(",
")",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"h... | // WorkerObservations returns all of the WorkerObservation's it finds for all worker pools' workers. | [
"WorkerObservations",
"returns",
"all",
"of",
"the",
"WorkerObservation",
"s",
"it",
"finds",
"for",
"all",
"worker",
"pools",
"workers",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L135-L203 | train |
gocraft/work | client.go | Queues | func (c *Client) Queues() ([]*Queue, error) {
conn := c.pool.Get()
defer conn.Close()
key := redisKeyKnownJobs(c.namespace)
jobNames, err := redis.Strings(conn.Do("SMEMBERS", key))
if err != nil {
return nil, err
}
sort.Strings(jobNames)
for _, jobName := range jobNames {
conn.Send("LLEN", redisKeyJobs(c.... | go | func (c *Client) Queues() ([]*Queue, error) {
conn := c.pool.Get()
defer conn.Close()
key := redisKeyKnownJobs(c.namespace)
jobNames, err := redis.Strings(conn.Do("SMEMBERS", key))
if err != nil {
return nil, err
}
sort.Strings(jobNames)
for _, jobName := range jobNames {
conn.Send("LLEN", redisKeyJobs(c.... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Queues",
"(",
")",
"(",
"[",
"]",
"*",
"Queue",
",",
"error",
")",
"{",
"conn",
":=",
"c",
".",
"pool",
".",
"Get",
"(",
")",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"key",
":=",
"redisKey... | // Queues returns the Queue's it finds. | [
"Queues",
"returns",
"the",
"Queue",
"s",
"it",
"finds",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L213-L280 | train |
gocraft/work | client.go | DeleteDeadJob | func (c *Client) DeleteDeadJob(diedAt int64, jobID string) error {
ok, _, err := c.deleteZsetJob(redisKeyDead(c.namespace), diedAt, jobID)
if err != nil {
return err
}
if !ok {
return ErrNotDeleted
}
return nil
} | go | func (c *Client) DeleteDeadJob(diedAt int64, jobID string) error {
ok, _, err := c.deleteZsetJob(redisKeyDead(c.namespace), diedAt, jobID)
if err != nil {
return err
}
if !ok {
return ErrNotDeleted
}
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteDeadJob",
"(",
"diedAt",
"int64",
",",
"jobID",
"string",
")",
"error",
"{",
"ok",
",",
"_",
",",
"err",
":=",
"c",
".",
"deleteZsetJob",
"(",
"redisKeyDead",
"(",
"c",
".",
"namespace",
")",
",",
"diedAt"... | // DeleteDeadJob deletes a dead job from Redis. | [
"DeleteDeadJob",
"deletes",
"a",
"dead",
"job",
"from",
"Redis",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L355-L364 | train |
gocraft/work | client.go | RetryDeadJob | func (c *Client) RetryDeadJob(diedAt int64, jobID string) error {
// Get queues for job names
queues, err := c.Queues()
if err != nil {
logError("client.retry_all_dead_jobs.queues", err)
return err
}
// Extract job names
var jobNames []string
for _, q := range queues {
jobNames = append(jobNames, q.JobNam... | go | func (c *Client) RetryDeadJob(diedAt int64, jobID string) error {
// Get queues for job names
queues, err := c.Queues()
if err != nil {
logError("client.retry_all_dead_jobs.queues", err)
return err
}
// Extract job names
var jobNames []string
for _, q := range queues {
jobNames = append(jobNames, q.JobNam... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RetryDeadJob",
"(",
"diedAt",
"int64",
",",
"jobID",
"string",
")",
"error",
"{",
"// Get queues for job names",
"queues",
",",
"err",
":=",
"c",
".",
"Queues",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logE... | // RetryDeadJob retries a dead job. The job will be re-queued on the normal work queue for eventual processing by a worker. | [
"RetryDeadJob",
"retries",
"a",
"dead",
"job",
".",
"The",
"job",
"will",
"be",
"re",
"-",
"queued",
"on",
"the",
"normal",
"work",
"queue",
"for",
"eventual",
"processing",
"by",
"a",
"worker",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L367-L407 | train |
gocraft/work | client.go | RetryAllDeadJobs | func (c *Client) RetryAllDeadJobs() error {
// Get queues for job names
queues, err := c.Queues()
if err != nil {
logError("client.retry_all_dead_jobs.queues", err)
return err
}
// Extract job names
var jobNames []string
for _, q := range queues {
jobNames = append(jobNames, q.JobName)
}
script := redi... | go | func (c *Client) RetryAllDeadJobs() error {
// Get queues for job names
queues, err := c.Queues()
if err != nil {
logError("client.retry_all_dead_jobs.queues", err)
return err
}
// Extract job names
var jobNames []string
for _, q := range queues {
jobNames = append(jobNames, q.JobName)
}
script := redi... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RetryAllDeadJobs",
"(",
")",
"error",
"{",
"// Get queues for job names",
"queues",
",",
"err",
":=",
"c",
".",
"Queues",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logError",
"(",
"\"",
"\"",
",",
"err",
"... | // RetryAllDeadJobs requeues all dead jobs. In other words, it puts them all back on the normal work queue for workers to pull from and process. | [
"RetryAllDeadJobs",
"requeues",
"all",
"dead",
"jobs",
".",
"In",
"other",
"words",
"it",
"puts",
"them",
"all",
"back",
"on",
"the",
"normal",
"work",
"queue",
"for",
"workers",
"to",
"pull",
"from",
"and",
"process",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L410-L453 | train |
gocraft/work | client.go | DeleteAllDeadJobs | func (c *Client) DeleteAllDeadJobs() error {
conn := c.pool.Get()
defer conn.Close()
_, err := conn.Do("DEL", redisKeyDead(c.namespace))
if err != nil {
logError("client.delete_all_dead_jobs", err)
return err
}
return nil
} | go | func (c *Client) DeleteAllDeadJobs() error {
conn := c.pool.Get()
defer conn.Close()
_, err := conn.Do("DEL", redisKeyDead(c.namespace))
if err != nil {
logError("client.delete_all_dead_jobs", err)
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteAllDeadJobs",
"(",
")",
"error",
"{",
"conn",
":=",
"c",
".",
"pool",
".",
"Get",
"(",
")",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"_",
",",
"err",
":=",
"conn",
".",
"Do",
"(",
"\"",
... | // DeleteAllDeadJobs deletes all dead jobs. | [
"DeleteAllDeadJobs",
"deletes",
"all",
"dead",
"jobs",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L456-L466 | train |
gocraft/work | client.go | DeleteScheduledJob | func (c *Client) DeleteScheduledJob(scheduledFor int64, jobID string) error {
ok, jobBytes, err := c.deleteZsetJob(redisKeyScheduled(c.namespace), scheduledFor, jobID)
if err != nil {
return err
}
// If we get a job back, parse it and see if it's a unique job. If it is, we need to delete the unique key.
if len(... | go | func (c *Client) DeleteScheduledJob(scheduledFor int64, jobID string) error {
ok, jobBytes, err := c.deleteZsetJob(redisKeyScheduled(c.namespace), scheduledFor, jobID)
if err != nil {
return err
}
// If we get a job back, parse it and see if it's a unique job. If it is, we need to delete the unique key.
if len(... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteScheduledJob",
"(",
"scheduledFor",
"int64",
",",
"jobID",
"string",
")",
"error",
"{",
"ok",
",",
"jobBytes",
",",
"err",
":=",
"c",
".",
"deleteZsetJob",
"(",
"redisKeyScheduled",
"(",
"c",
".",
"namespace",
... | // DeleteScheduledJob deletes a job in the scheduled queue. | [
"DeleteScheduledJob",
"deletes",
"a",
"job",
"in",
"the",
"scheduled",
"queue",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L469-L504 | train |
gocraft/work | client.go | DeleteRetryJob | func (c *Client) DeleteRetryJob(retryAt int64, jobID string) error {
ok, _, err := c.deleteZsetJob(redisKeyRetry(c.namespace), retryAt, jobID)
if err != nil {
return err
}
if !ok {
return ErrNotDeleted
}
return nil
} | go | func (c *Client) DeleteRetryJob(retryAt int64, jobID string) error {
ok, _, err := c.deleteZsetJob(redisKeyRetry(c.namespace), retryAt, jobID)
if err != nil {
return err
}
if !ok {
return ErrNotDeleted
}
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteRetryJob",
"(",
"retryAt",
"int64",
",",
"jobID",
"string",
")",
"error",
"{",
"ok",
",",
"_",
",",
"err",
":=",
"c",
".",
"deleteZsetJob",
"(",
"redisKeyRetry",
"(",
"c",
".",
"namespace",
")",
",",
"retr... | // DeleteRetryJob deletes a job in the retry queue. | [
"DeleteRetryJob",
"deletes",
"a",
"job",
"in",
"the",
"retry",
"queue",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/client.go#L507-L516 | train |
gocraft/work | job.go | setArg | func (j *Job) setArg(key string, val interface{}) {
if j.Args == nil {
j.Args = make(map[string]interface{})
}
j.Args[key] = val
} | go | func (j *Job) setArg(key string, val interface{}) {
if j.Args == nil {
j.Args = make(map[string]interface{})
}
j.Args[key] = val
} | [
"func",
"(",
"j",
"*",
"Job",
")",
"setArg",
"(",
"key",
"string",
",",
"val",
"interface",
"{",
"}",
")",
"{",
"if",
"j",
".",
"Args",
"==",
"nil",
"{",
"j",
".",
"Args",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")... | // setArg sets a single named argument on the job. | [
"setArg",
"sets",
"a",
"single",
"named",
"argument",
"on",
"the",
"job",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/job.go#L53-L58 | train |
gocraft/work | job.go | Checkin | func (j *Job) Checkin(msg string) {
if j.observer != nil {
j.observer.observeCheckin(j.Name, j.ID, msg)
}
} | go | func (j *Job) Checkin(msg string) {
if j.observer != nil {
j.observer.observeCheckin(j.Name, j.ID, msg)
}
} | [
"func",
"(",
"j",
"*",
"Job",
")",
"Checkin",
"(",
"msg",
"string",
")",
"{",
"if",
"j",
".",
"observer",
"!=",
"nil",
"{",
"j",
".",
"observer",
".",
"observeCheckin",
"(",
"j",
".",
"Name",
",",
"j",
".",
"ID",
",",
"msg",
")",
"\n",
"}",
"... | // Checkin will update the status of the executing job to the specified messages. This message is visible within the web UI. This is useful for indicating some sort of progress on very long running jobs. For instance, on a job that has to process a million records over the course of an hour, the job could call Checkin ... | [
"Checkin",
"will",
"update",
"the",
"status",
"of",
"the",
"executing",
"job",
"to",
"the",
"specified",
"messages",
".",
"This",
"message",
"is",
"visible",
"within",
"the",
"web",
"UI",
".",
"This",
"is",
"useful",
"for",
"indicating",
"some",
"sort",
"o... | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/job.go#L67-L71 | train |
gocraft/work | worker.go | defaultBackoffCalculator | func defaultBackoffCalculator(job *Job) int64 {
fails := job.Fails
return (fails * fails * fails * fails) + 15 + (rand.Int63n(30) * (fails + 1))
} | go | func defaultBackoffCalculator(job *Job) int64 {
fails := job.Fails
return (fails * fails * fails * fails) + 15 + (rand.Int63n(30) * (fails + 1))
} | [
"func",
"defaultBackoffCalculator",
"(",
"job",
"*",
"Job",
")",
"int64",
"{",
"fails",
":=",
"job",
".",
"Fails",
"\n",
"return",
"(",
"fails",
"*",
"fails",
"*",
"fails",
"*",
"fails",
")",
"+",
"15",
"+",
"(",
"rand",
".",
"Int63n",
"(",
"30",
"... | // Default algorithm returns an fastly increasing backoff counter which grows in an unbounded fashion | [
"Default",
"algorithm",
"returns",
"an",
"fastly",
"increasing",
"backoff",
"counter",
"which",
"grows",
"in",
"an",
"unbounded",
"fashion"
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker.go#L324-L327 | train |
gocraft/work | webui/webui.go | NewServer | func NewServer(namespace string, pool *redis.Pool, hostPort string) *Server {
router := web.New(context{})
server := &Server{
namespace: namespace,
pool: pool,
client: work.NewClient(namespace, pool),
hostPort: hostPort,
server: manners.NewWithServer(&http.Server{Addr: hostPort, Handler: router}... | go | func NewServer(namespace string, pool *redis.Pool, hostPort string) *Server {
router := web.New(context{})
server := &Server{
namespace: namespace,
pool: pool,
client: work.NewClient(namespace, pool),
hostPort: hostPort,
server: manners.NewWithServer(&http.Server{Addr: hostPort, Handler: router}... | [
"func",
"NewServer",
"(",
"namespace",
"string",
",",
"pool",
"*",
"redis",
".",
"Pool",
",",
"hostPort",
"string",
")",
"*",
"Server",
"{",
"router",
":=",
"web",
".",
"New",
"(",
"context",
"{",
"}",
")",
"\n",
"server",
":=",
"&",
"Server",
"{",
... | // NewServer creates and returns a new server. The 'namespace' param is the redis namespace to use. The hostPort param is the address to bind on to expose the API. | [
"NewServer",
"creates",
"and",
"returns",
"a",
"new",
"server",
".",
"The",
"namespace",
"param",
"is",
"the",
"redis",
"namespace",
"to",
"use",
".",
"The",
"hostPort",
"param",
"is",
"the",
"address",
"to",
"bind",
"on",
"to",
"expose",
"the",
"API",
"... | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/webui/webui.go#L33-L77 | train |
gocraft/work | webui/webui.go | Start | func (w *Server) Start() {
w.wg.Add(1)
go func(w *Server) {
w.server.ListenAndServe()
w.wg.Done()
}(w)
} | go | func (w *Server) Start() {
w.wg.Add(1)
go func(w *Server) {
w.server.ListenAndServe()
w.wg.Done()
}(w)
} | [
"func",
"(",
"w",
"*",
"Server",
")",
"Start",
"(",
")",
"{",
"w",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"w",
"*",
"Server",
")",
"{",
"w",
".",
"server",
".",
"ListenAndServe",
"(",
")",
"\n",
"w",
".",
"wg",
".",
... | // Start starts the server listening for requests on the hostPort specified in NewServer. | [
"Start",
"starts",
"the",
"server",
"listening",
"for",
"requests",
"on",
"the",
"hostPort",
"specified",
"in",
"NewServer",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/webui/webui.go#L80-L86 | train |
gocraft/work | run.go | runJob | func runJob(job *Job, ctxType reflect.Type, middleware []*middlewareHandler, jt *jobType) (returnCtx reflect.Value, returnError error) {
returnCtx = reflect.New(ctxType)
currentMiddleware := 0
maxMiddleware := len(middleware)
var next NextMiddlewareFunc
next = func() error {
if currentMiddleware < maxMiddleware... | go | func runJob(job *Job, ctxType reflect.Type, middleware []*middlewareHandler, jt *jobType) (returnCtx reflect.Value, returnError error) {
returnCtx = reflect.New(ctxType)
currentMiddleware := 0
maxMiddleware := len(middleware)
var next NextMiddlewareFunc
next = func() error {
if currentMiddleware < maxMiddleware... | [
"func",
"runJob",
"(",
"job",
"*",
"Job",
",",
"ctxType",
"reflect",
".",
"Type",
",",
"middleware",
"[",
"]",
"*",
"middlewareHandler",
",",
"jt",
"*",
"jobType",
")",
"(",
"returnCtx",
"reflect",
".",
"Value",
",",
"returnError",
"error",
")",
"{",
"... | // returns an error if the job fails, or there's a panic, or we couldn't reflect correctly.
// if we return an error, it signals we want the job to be retried. | [
"returns",
"an",
"error",
"if",
"the",
"job",
"fails",
"or",
"there",
"s",
"a",
"panic",
"or",
"we",
"couldn",
"t",
"reflect",
"correctly",
".",
"if",
"we",
"return",
"an",
"error",
"it",
"signals",
"we",
"want",
"the",
"job",
"to",
"be",
"retried",
... | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/run.go#L10-L54 | train |
gocraft/work | worker_pool.go | NewWorkerPool | func NewWorkerPool(ctx interface{}, concurrency uint, namespace string, pool *redis.Pool) *WorkerPool {
return NewWorkerPoolWithOptions(ctx, concurrency, namespace, pool, WorkerPoolOptions{})
} | go | func NewWorkerPool(ctx interface{}, concurrency uint, namespace string, pool *redis.Pool) *WorkerPool {
return NewWorkerPoolWithOptions(ctx, concurrency, namespace, pool, WorkerPoolOptions{})
} | [
"func",
"NewWorkerPool",
"(",
"ctx",
"interface",
"{",
"}",
",",
"concurrency",
"uint",
",",
"namespace",
"string",
",",
"pool",
"*",
"redis",
".",
"Pool",
")",
"*",
"WorkerPool",
"{",
"return",
"NewWorkerPoolWithOptions",
"(",
"ctx",
",",
"concurrency",
","... | // NewWorkerPool creates a new worker pool. ctx should be a struct literal whose type will be used for middleware and handlers.
// concurrency specifies how many workers to spin up - each worker can process jobs concurrently. | [
"NewWorkerPool",
"creates",
"a",
"new",
"worker",
"pool",
".",
"ctx",
"should",
"be",
"a",
"struct",
"literal",
"whose",
"type",
"will",
"be",
"used",
"for",
"middleware",
"and",
"handlers",
".",
"concurrency",
"specifies",
"how",
"many",
"workers",
"to",
"s... | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker_pool.go#L88-L90 | train |
gocraft/work | worker_pool.go | NewWorkerPoolWithOptions | func NewWorkerPoolWithOptions(ctx interface{}, concurrency uint, namespace string, pool *redis.Pool, workerPoolOpts WorkerPoolOptions) *WorkerPool {
if pool == nil {
panic("NewWorkerPool needs a non-nil *redis.Pool")
}
ctxType := reflect.TypeOf(ctx)
validateContextType(ctxType)
wp := &WorkerPool{
workerPoolID... | go | func NewWorkerPoolWithOptions(ctx interface{}, concurrency uint, namespace string, pool *redis.Pool, workerPoolOpts WorkerPoolOptions) *WorkerPool {
if pool == nil {
panic("NewWorkerPool needs a non-nil *redis.Pool")
}
ctxType := reflect.TypeOf(ctx)
validateContextType(ctxType)
wp := &WorkerPool{
workerPoolID... | [
"func",
"NewWorkerPoolWithOptions",
"(",
"ctx",
"interface",
"{",
"}",
",",
"concurrency",
"uint",
",",
"namespace",
"string",
",",
"pool",
"*",
"redis",
".",
"Pool",
",",
"workerPoolOpts",
"WorkerPoolOptions",
")",
"*",
"WorkerPool",
"{",
"if",
"pool",
"==",
... | // NewWorkerPoolWithOptions creates a new worker pool as per the NewWorkerPool function, but permits you to specify
// additional options such as sleep backoffs. | [
"NewWorkerPoolWithOptions",
"creates",
"a",
"new",
"worker",
"pool",
"as",
"per",
"the",
"NewWorkerPool",
"function",
"but",
"permits",
"you",
"to",
"specify",
"additional",
"options",
"such",
"as",
"sleep",
"backoffs",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker_pool.go#L94-L117 | train |
gocraft/work | worker_pool.go | JobWithOptions | func (wp *WorkerPool) JobWithOptions(name string, jobOpts JobOptions, fn interface{}) *WorkerPool {
jobOpts = applyDefaultsAndValidate(jobOpts)
vfn := reflect.ValueOf(fn)
validateHandlerType(wp.contextType, vfn)
jt := &jobType{
Name: name,
DynamicHandler: vfn,
JobOptions: jobOpts,
}
if gh, ok... | go | func (wp *WorkerPool) JobWithOptions(name string, jobOpts JobOptions, fn interface{}) *WorkerPool {
jobOpts = applyDefaultsAndValidate(jobOpts)
vfn := reflect.ValueOf(fn)
validateHandlerType(wp.contextType, vfn)
jt := &jobType{
Name: name,
DynamicHandler: vfn,
JobOptions: jobOpts,
}
if gh, ok... | [
"func",
"(",
"wp",
"*",
"WorkerPool",
")",
"JobWithOptions",
"(",
"name",
"string",
",",
"jobOpts",
"JobOptions",
",",
"fn",
"interface",
"{",
"}",
")",
"*",
"WorkerPool",
"{",
"jobOpts",
"=",
"applyDefaultsAndValidate",
"(",
"jobOpts",
")",
"\n\n",
"vfn",
... | // JobWithOptions adds a handler for 'name' jobs as per the Job function, but permits you specify additional options
// such as a job's priority, retry count, and whether to send dead jobs to the dead job queue or trash them. | [
"JobWithOptions",
"adds",
"a",
"handler",
"for",
"name",
"jobs",
"as",
"per",
"the",
"Job",
"function",
"but",
"permits",
"you",
"specify",
"additional",
"options",
"such",
"as",
"a",
"job",
"s",
"priority",
"retry",
"count",
"and",
"whether",
"to",
"send",
... | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker_pool.go#L154-L176 | train |
gocraft/work | worker_pool.go | Start | func (wp *WorkerPool) Start() {
if wp.started {
return
}
wp.started = true
// TODO: we should cleanup stale keys on startup from previously registered jobs
wp.writeConcurrencyControlsToRedis()
go wp.writeKnownJobsToRedis()
for _, w := range wp.workers {
go w.start()
}
wp.heartbeater = newWorkerPoolHeart... | go | func (wp *WorkerPool) Start() {
if wp.started {
return
}
wp.started = true
// TODO: we should cleanup stale keys on startup from previously registered jobs
wp.writeConcurrencyControlsToRedis()
go wp.writeKnownJobsToRedis()
for _, w := range wp.workers {
go w.start()
}
wp.heartbeater = newWorkerPoolHeart... | [
"func",
"(",
"wp",
"*",
"WorkerPool",
")",
"Start",
"(",
")",
"{",
"if",
"wp",
".",
"started",
"{",
"return",
"\n",
"}",
"\n",
"wp",
".",
"started",
"=",
"true",
"\n\n",
"// TODO: we should cleanup stale keys on startup from previously registered jobs",
"wp",
".... | // Start starts the workers and associated processes. | [
"Start",
"starts",
"the",
"workers",
"and",
"associated",
"processes",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker_pool.go#L194-L213 | train |
gocraft/work | worker_pool.go | Stop | func (wp *WorkerPool) Stop() {
if !wp.started {
return
}
wp.started = false
wg := sync.WaitGroup{}
for _, w := range wp.workers {
wg.Add(1)
go func(w *worker) {
w.stop()
wg.Done()
}(w)
}
wg.Wait()
wp.heartbeater.stop()
wp.retrier.stop()
wp.scheduler.stop()
wp.deadPoolReaper.stop()
wp.periodic... | go | func (wp *WorkerPool) Stop() {
if !wp.started {
return
}
wp.started = false
wg := sync.WaitGroup{}
for _, w := range wp.workers {
wg.Add(1)
go func(w *worker) {
w.stop()
wg.Done()
}(w)
}
wg.Wait()
wp.heartbeater.stop()
wp.retrier.stop()
wp.scheduler.stop()
wp.deadPoolReaper.stop()
wp.periodic... | [
"func",
"(",
"wp",
"*",
"WorkerPool",
")",
"Stop",
"(",
")",
"{",
"if",
"!",
"wp",
".",
"started",
"{",
"return",
"\n",
"}",
"\n",
"wp",
".",
"started",
"=",
"false",
"\n\n",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"for",
"_",
","... | // Stop stops the workers and associated processes. | [
"Stop",
"stops",
"the",
"workers",
"and",
"associated",
"processes",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker_pool.go#L216-L236 | train |
gocraft/work | worker_pool.go | Drain | func (wp *WorkerPool) Drain() {
wg := sync.WaitGroup{}
for _, w := range wp.workers {
wg.Add(1)
go func(w *worker) {
w.drain()
wg.Done()
}(w)
}
wg.Wait()
} | go | func (wp *WorkerPool) Drain() {
wg := sync.WaitGroup{}
for _, w := range wp.workers {
wg.Add(1)
go func(w *worker) {
w.drain()
wg.Done()
}(w)
}
wg.Wait()
} | [
"func",
"(",
"wp",
"*",
"WorkerPool",
")",
"Drain",
"(",
")",
"{",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"for",
"_",
",",
"w",
":=",
"range",
"wp",
".",
"workers",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",... | // Drain drains all jobs in the queue before returning. Note that if jobs are added faster than we can process them, this function wouldn't return. | [
"Drain",
"drains",
"all",
"jobs",
"in",
"the",
"queue",
"before",
"returning",
".",
"Note",
"that",
"if",
"jobs",
"are",
"added",
"faster",
"than",
"we",
"can",
"process",
"them",
"this",
"function",
"wouldn",
"t",
"return",
"."
] | c85b71e20062f3ab71d4749604faf956d364614f | https://github.com/gocraft/work/blob/c85b71e20062f3ab71d4749604faf956d364614f/worker_pool.go#L239-L249 | train |
pilosa/pilosa | api.go | NewAPI | func NewAPI(opts ...apiOption) (*API, error) {
api := &API{}
for _, opt := range opts {
err := opt(api)
if err != nil {
return nil, errors.Wrap(err, "applying option")
}
}
return api, nil
} | go | func NewAPI(opts ...apiOption) (*API, error) {
api := &API{}
for _, opt := range opts {
err := opt(api)
if err != nil {
return nil, errors.Wrap(err, "applying option")
}
}
return api, nil
} | [
"func",
"NewAPI",
"(",
"opts",
"...",
"apiOption",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"api",
":=",
"&",
"API",
"{",
"}",
"\n\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"err",
":=",
"opt",
"(",
"api",
")",
"\n",
"if",
"... | // NewAPI returns a new API instance. | [
"NewAPI",
"returns",
"a",
"new",
"API",
"instance",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L62-L72 | train |
pilosa/pilosa | api.go | Query | func (api *API) Query(ctx context.Context, req *QueryRequest) (QueryResponse, error) {
span, ctx := tracing.StartSpanFromContext(ctx, "API.Query")
defer span.Finish()
if err := api.validate(apiQuery); err != nil {
return QueryResponse{}, errors.Wrap(err, "validating api method")
}
q, err := pql.NewParser(strin... | go | func (api *API) Query(ctx context.Context, req *QueryRequest) (QueryResponse, error) {
span, ctx := tracing.StartSpanFromContext(ctx, "API.Query")
defer span.Finish()
if err := api.validate(apiQuery); err != nil {
return QueryResponse{}, errors.Wrap(err, "validating api method")
}
q, err := pql.NewParser(strin... | [
"func",
"(",
"api",
"*",
"API",
")",
"Query",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"QueryRequest",
")",
"(",
"QueryResponse",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
... | // Query parses a PQL query out of the request and executes it. | [
"Query",
"parses",
"a",
"PQL",
"query",
"out",
"of",
"the",
"request",
"and",
"executes",
"it",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L103-L127 | train |
pilosa/pilosa | api.go | CreateIndex | func (api *API) CreateIndex(ctx context.Context, indexName string, options IndexOptions) (*Index, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.CreateIndex")
defer span.Finish()
if err := api.validate(apiCreateIndex); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
// Create i... | go | func (api *API) CreateIndex(ctx context.Context, indexName string, options IndexOptions) (*Index, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.CreateIndex")
defer span.Finish()
if err := api.validate(apiCreateIndex); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
// Create i... | [
"func",
"(",
"api",
"*",
"API",
")",
"CreateIndex",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"options",
"IndexOptions",
")",
"(",
"*",
"Index",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFro... | // CreateIndex makes a new Pilosa index. | [
"CreateIndex",
"makes",
"a",
"new",
"Pilosa",
"index",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L130-L154 | train |
pilosa/pilosa | api.go | Index | func (api *API) Index(ctx context.Context, indexName string) (*Index, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.Index")
defer span.Finish()
if err := api.validate(apiIndex); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
index := api.holder.Index(indexName)
if index == n... | go | func (api *API) Index(ctx context.Context, indexName string) (*Index, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.Index")
defer span.Finish()
if err := api.validate(apiIndex); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
index := api.holder.Index(indexName)
if index == n... | [
"func",
"(",
"api",
"*",
"API",
")",
"Index",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
")",
"(",
"*",
"Index",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
... | // Index retrieves the named index. | [
"Index",
"retrieves",
"the",
"named",
"index",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L157-L170 | train |
pilosa/pilosa | api.go | DeleteIndex | func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteIndex")
defer span.Finish()
if err := api.validate(apiDeleteIndex); err != nil {
return errors.Wrap(err, "validating api method")
}
// Delete index from the holder.
err := api.hol... | go | func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteIndex")
defer span.Finish()
if err := api.validate(apiDeleteIndex); err != nil {
return errors.Wrap(err, "validating api method")
}
// Delete index from the holder.
err := api.hol... | [
"func",
"(",
"api",
"*",
"API",
")",
"DeleteIndex",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
")",
"error",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
... | // DeleteIndex removes the named index. If the index is not found it does
// nothing and returns no error. | [
"DeleteIndex",
"removes",
"the",
"named",
"index",
".",
"If",
"the",
"index",
"is",
"not",
"found",
"it",
"does",
"nothing",
"and",
"returns",
"no",
"error",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L174-L198 | train |
pilosa/pilosa | api.go | CreateField | func (api *API) CreateField(ctx context.Context, indexName string, fieldName string, opts ...FieldOption) (*Field, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.CreateField")
defer span.Finish()
if err := api.validate(apiCreateField); err != nil {
return nil, errors.Wrap(err, "validating api method")... | go | func (api *API) CreateField(ctx context.Context, indexName string, fieldName string, opts ...FieldOption) (*Field, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.CreateField")
defer span.Finish()
if err := api.validate(apiCreateField); err != nil {
return nil, errors.Wrap(err, "validating api method")... | [
"func",
"(",
"api",
"*",
"API",
")",
"CreateField",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"fieldName",
"string",
",",
"opts",
"...",
"FieldOption",
")",
"(",
"*",
"Field",
",",
"error",
")",
"{",
"span",
",",
"_",
":... | // CreateField makes the named field in the named index with the given options.
// This method currently only takes a single functional option, but that may be
// changed in the future to support multiple options. | [
"CreateField",
"makes",
"the",
"named",
"field",
"in",
"the",
"named",
"index",
"with",
"the",
"given",
"options",
".",
"This",
"method",
"currently",
"only",
"takes",
"a",
"single",
"functional",
"option",
"but",
"that",
"may",
"be",
"changed",
"in",
"the",... | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L203-L245 | train |
pilosa/pilosa | api.go | Field | func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.Field")
defer span.Finish()
if err := api.validate(apiField); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
field := api.holder.Field(indexName, fie... | go | func (api *API) Field(ctx context.Context, indexName, fieldName string) (*Field, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.Field")
defer span.Finish()
if err := api.validate(apiField); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
field := api.holder.Field(indexName, fie... | [
"func",
"(",
"api",
"*",
"API",
")",
"Field",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
",",
"fieldName",
"string",
")",
"(",
"*",
"Field",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"c... | // Field retrieves the named field. | [
"Field",
"retrieves",
"the",
"named",
"field",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L248-L261 | train |
pilosa/pilosa | api.go | DeleteField | func (api *API) DeleteField(ctx context.Context, indexName string, fieldName string) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteField")
defer span.Finish()
if err := api.validate(apiDeleteField); err != nil {
return errors.Wrap(err, "validating api method")
}
// Find index.
index := api.h... | go | func (api *API) DeleteField(ctx context.Context, indexName string, fieldName string) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteField")
defer span.Finish()
if err := api.validate(apiDeleteField); err != nil {
return errors.Wrap(err, "validating api method")
}
// Find index.
index := api.h... | [
"func",
"(",
"api",
"*",
"API",
")",
"DeleteField",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"fieldName",
"string",
")",
"error",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
... | // DeleteField removes the named field from the named index. If the index is not
// found, an error is returned. If the field is not found, it is ignored and no
// action is taken. | [
"DeleteField",
"removes",
"the",
"named",
"field",
"from",
"the",
"named",
"index",
".",
"If",
"the",
"index",
"is",
"not",
"found",
"an",
"error",
"is",
"returned",
".",
"If",
"the",
"field",
"is",
"not",
"found",
"it",
"is",
"ignored",
"and",
"no",
"... | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L360-L391 | train |
pilosa/pilosa | api.go | DeleteAvailableShard | func (api *API) DeleteAvailableShard(_ context.Context, indexName, fieldName string, shardID uint64) error {
if err := api.validate(apiDeleteAvailableShard); err != nil {
return errors.Wrap(err, "validating api method")
}
// Find field.
field := api.holder.Field(indexName, fieldName)
if field == nil {
return ... | go | func (api *API) DeleteAvailableShard(_ context.Context, indexName, fieldName string, shardID uint64) error {
if err := api.validate(apiDeleteAvailableShard); err != nil {
return errors.Wrap(err, "validating api method")
}
// Find field.
field := api.holder.Field(indexName, fieldName)
if field == nil {
return ... | [
"func",
"(",
"api",
"*",
"API",
")",
"DeleteAvailableShard",
"(",
"_",
"context",
".",
"Context",
",",
"indexName",
",",
"fieldName",
"string",
",",
"shardID",
"uint64",
")",
"error",
"{",
"if",
"err",
":=",
"api",
".",
"validate",
"(",
"apiDeleteAvailable... | // DeleteAvailableShard a shard ID from the available shard set cache. | [
"DeleteAvailableShard",
"a",
"shard",
"ID",
"from",
"the",
"available",
"shard",
"set",
"cache",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L394-L423 | train |
pilosa/pilosa | api.go | ShardNodes | func (api *API) ShardNodes(ctx context.Context, indexName string, shard uint64) ([]*Node, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.ShardNodes")
defer span.Finish()
if err := api.validate(apiShardNodes); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
return api.cluster.sh... | go | func (api *API) ShardNodes(ctx context.Context, indexName string, shard uint64) ([]*Node, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.ShardNodes")
defer span.Finish()
if err := api.validate(apiShardNodes); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
return api.cluster.sh... | [
"func",
"(",
"api",
"*",
"API",
")",
"ShardNodes",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"shard",
"uint64",
")",
"(",
"[",
"]",
"*",
"Node",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpa... | // ShardNodes returns the node and all replicas which should contain a shard's data. | [
"ShardNodes",
"returns",
"the",
"node",
"and",
"all",
"replicas",
"which",
"should",
"contain",
"a",
"shard",
"s",
"data",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L504-L513 | train |
pilosa/pilosa | api.go | FragmentBlockData | func (api *API) FragmentBlockData(ctx context.Context, body io.Reader) ([]byte, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FragmentBlockData")
defer span.Finish()
if err := api.validate(apiFragmentBlockData); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
reqBytes, err := ... | go | func (api *API) FragmentBlockData(ctx context.Context, body io.Reader) ([]byte, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FragmentBlockData")
defer span.Finish()
if err := api.validate(apiFragmentBlockData); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
reqBytes, err := ... | [
"func",
"(",
"api",
"*",
"API",
")",
"FragmentBlockData",
"(",
"ctx",
"context",
".",
"Context",
",",
"body",
"io",
".",
"Reader",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"("... | // FragmentBlockData is an endpoint for internal usage. It is not guaranteed to
// return anything useful. Currently it returns protobuf encoded row and column
// ids from a "block" which is a subdivision of a fragment. | [
"FragmentBlockData",
"is",
"an",
"endpoint",
"for",
"internal",
"usage",
".",
"It",
"is",
"not",
"guaranteed",
"to",
"return",
"anything",
"useful",
".",
"Currently",
"it",
"returns",
"protobuf",
"encoded",
"row",
"and",
"column",
"ids",
"from",
"a",
"block",
... | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L518-L551 | train |
pilosa/pilosa | api.go | FragmentBlocks | func (api *API) FragmentBlocks(ctx context.Context, indexName, fieldName, viewName string, shard uint64) ([]FragmentBlock, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FragmentBlocks")
defer span.Finish()
if err := api.validate(apiFragmentBlocks); err != nil {
return nil, errors.Wrap(err, "validatin... | go | func (api *API) FragmentBlocks(ctx context.Context, indexName, fieldName, viewName string, shard uint64) ([]FragmentBlock, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FragmentBlocks")
defer span.Finish()
if err := api.validate(apiFragmentBlocks); err != nil {
return nil, errors.Wrap(err, "validatin... | [
"func",
"(",
"api",
"*",
"API",
")",
"FragmentBlocks",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
",",
"fieldName",
",",
"viewName",
"string",
",",
"shard",
"uint64",
")",
"(",
"[",
"]",
"FragmentBlock",
",",
"error",
")",
"{",
"span",
",... | // FragmentBlocks returns the checksums and block ids for all blocks in the specified fragment. | [
"FragmentBlocks",
"returns",
"the",
"checksums",
"and",
"block",
"ids",
"for",
"all",
"blocks",
"in",
"the",
"specified",
"fragment",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L554-L571 | train |
pilosa/pilosa | api.go | FragmentData | func (api *API) FragmentData(ctx context.Context, indexName, fieldName, viewName string, shard uint64) (io.WriterTo, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FragmentData")
defer span.Finish()
if err := api.validate(apiFragmentData); err != nil {
return nil, errors.Wrap(err, "validating api meth... | go | func (api *API) FragmentData(ctx context.Context, indexName, fieldName, viewName string, shard uint64) (io.WriterTo, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FragmentData")
defer span.Finish()
if err := api.validate(apiFragmentData); err != nil {
return nil, errors.Wrap(err, "validating api meth... | [
"func",
"(",
"api",
"*",
"API",
")",
"FragmentData",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
",",
"fieldName",
",",
"viewName",
"string",
",",
"shard",
"uint64",
")",
"(",
"io",
".",
"WriterTo",
",",
"error",
")",
"{",
"span",
",",
"... | // FragmentData returns all data in the specified fragment. | [
"FragmentData",
"returns",
"all",
"data",
"in",
"the",
"specified",
"fragment",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L574-L588 | train |
pilosa/pilosa | api.go | Hosts | func (api *API) Hosts(ctx context.Context) []*Node {
span, _ := tracing.StartSpanFromContext(ctx, "API.Hosts")
defer span.Finish()
return api.cluster.Nodes()
} | go | func (api *API) Hosts(ctx context.Context) []*Node {
span, _ := tracing.StartSpanFromContext(ctx, "API.Hosts")
defer span.Finish()
return api.cluster.Nodes()
} | [
"func",
"(",
"api",
"*",
"API",
")",
"Hosts",
"(",
"ctx",
"context",
".",
"Context",
")",
"[",
"]",
"*",
"Node",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"F... | // Hosts returns a list of the hosts in the cluster including their ID,
// URL, and which is the coordinator. | [
"Hosts",
"returns",
"a",
"list",
"of",
"the",
"hosts",
"in",
"the",
"cluster",
"including",
"their",
"ID",
"URL",
"and",
"which",
"is",
"the",
"coordinator",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L592-L596 | train |
pilosa/pilosa | api.go | RecalculateCaches | func (api *API) RecalculateCaches(ctx context.Context) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.RecalculateCaches")
defer span.Finish()
if err := api.validate(apiRecalculateCaches); err != nil {
return errors.Wrap(err, "validating api method")
}
err := api.server.SendSync(&RecalculateCaches{})... | go | func (api *API) RecalculateCaches(ctx context.Context) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.RecalculateCaches")
defer span.Finish()
if err := api.validate(apiRecalculateCaches); err != nil {
return errors.Wrap(err, "validating api method")
}
err := api.server.SendSync(&RecalculateCaches{})... | [
"func",
"(",
"api",
"*",
"API",
")",
"RecalculateCaches",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
... | // RecalculateCaches forces all TopN caches to be updated. Used mainly for integration tests. | [
"RecalculateCaches",
"forces",
"all",
"TopN",
"caches",
"to",
"be",
"updated",
".",
"Used",
"mainly",
"for",
"integration",
"tests",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L605-L619 | train |
pilosa/pilosa | api.go | ClusterMessage | func (api *API) ClusterMessage(ctx context.Context, reqBody io.Reader) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.ClusterMessage")
defer span.Finish()
if err := api.validate(apiClusterMessage); err != nil {
return errors.Wrap(err, "validating api method")
}
// Read entire body.
body, err := iou... | go | func (api *API) ClusterMessage(ctx context.Context, reqBody io.Reader) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.ClusterMessage")
defer span.Finish()
if err := api.validate(apiClusterMessage); err != nil {
return errors.Wrap(err, "validating api method")
}
// Read entire body.
body, err := iou... | [
"func",
"(",
"api",
"*",
"API",
")",
"ClusterMessage",
"(",
"ctx",
"context",
".",
"Context",
",",
"reqBody",
"io",
".",
"Reader",
")",
"error",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\... | // ClusterMessage is for internal use. It decodes a protobuf message out of
// the body and forwards it to the BroadcastHandler. | [
"ClusterMessage",
"is",
"for",
"internal",
"use",
".",
"It",
"decodes",
"a",
"protobuf",
"message",
"out",
"of",
"the",
"body",
"and",
"forwards",
"it",
"to",
"the",
"BroadcastHandler",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L623-L649 | train |
pilosa/pilosa | api.go | Schema | func (api *API) Schema(ctx context.Context) []*IndexInfo {
span, _ := tracing.StartSpanFromContext(ctx, "API.Schema")
defer span.Finish()
return api.holder.limitedSchema()
} | go | func (api *API) Schema(ctx context.Context) []*IndexInfo {
span, _ := tracing.StartSpanFromContext(ctx, "API.Schema")
defer span.Finish()
return api.holder.limitedSchema()
} | [
"func",
"(",
"api",
"*",
"API",
")",
"Schema",
"(",
"ctx",
"context",
".",
"Context",
")",
"[",
"]",
"*",
"IndexInfo",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
"."... | // Schema returns information about each index in Pilosa including which fields
// they contain. | [
"Schema",
"returns",
"information",
"about",
"each",
"index",
"in",
"Pilosa",
"including",
"which",
"fields",
"they",
"contain",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L653-L657 | train |
pilosa/pilosa | api.go | Views | func (api *API) Views(ctx context.Context, indexName string, fieldName string) ([]*view, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.Views")
defer span.Finish()
if err := api.validate(apiViews); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
// Retrieve views.
f := api.hol... | go | func (api *API) Views(ctx context.Context, indexName string, fieldName string) ([]*view, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.Views")
defer span.Finish()
if err := api.validate(apiViews); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
// Retrieve views.
f := api.hol... | [
"func",
"(",
"api",
"*",
"API",
")",
"Views",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"fieldName",
"string",
")",
"(",
"[",
"]",
"*",
"view",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpan... | // Views returns the views in the given field. | [
"Views",
"returns",
"the",
"views",
"in",
"the",
"given",
"field",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L687-L704 | train |
pilosa/pilosa | api.go | DeleteView | func (api *API) DeleteView(ctx context.Context, indexName string, fieldName string, viewName string) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteView")
defer span.Finish()
if err := api.validate(apiDeleteView); err != nil {
return errors.Wrap(err, "validating api method")
}
// Retrieve fiel... | go | func (api *API) DeleteView(ctx context.Context, indexName string, fieldName string, viewName string) error {
span, _ := tracing.StartSpanFromContext(ctx, "API.DeleteView")
defer span.Finish()
if err := api.validate(apiDeleteView); err != nil {
return errors.Wrap(err, "validating api method")
}
// Retrieve fiel... | [
"func",
"(",
"api",
"*",
"API",
")",
"DeleteView",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"fieldName",
"string",
",",
"viewName",
"string",
")",
"error",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
... | // DeleteView removes the given view. | [
"DeleteView",
"removes",
"the",
"given",
"view",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L707-L741 | train |
pilosa/pilosa | api.go | IndexAttrDiff | func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.IndexAttrDiff")
defer span.Finish()
if err := api.validate(apiIndexAttrDiff); err != nil {
return nil, errors.Wrap(err, "validatin... | go | func (api *API) IndexAttrDiff(ctx context.Context, indexName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.IndexAttrDiff")
defer span.Finish()
if err := api.validate(apiIndexAttrDiff); err != nil {
return nil, errors.Wrap(err, "validatin... | [
"func",
"(",
"api",
"*",
"API",
")",
"IndexAttrDiff",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"blocks",
"[",
"]",
"AttrBlock",
")",
"(",
"map",
"[",
"uint64",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",... | // IndexAttrDiff determines the local column attribute data blocks which differ from those provided. | [
"IndexAttrDiff",
"determines",
"the",
"local",
"column",
"attribute",
"data",
"blocks",
"which",
"differ",
"from",
"those",
"provided",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L744-L779 | train |
pilosa/pilosa | api.go | FieldAttrDiff | func (api *API) FieldAttrDiff(ctx context.Context, indexName string, fieldName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FieldAttrDiff")
defer span.Finish()
if err := api.validate(apiFieldAttrDiff); err != nil {
return nil, errors.Wr... | go | func (api *API) FieldAttrDiff(ctx context.Context, indexName string, fieldName string, blocks []AttrBlock) (map[uint64]map[string]interface{}, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.FieldAttrDiff")
defer span.Finish()
if err := api.validate(apiFieldAttrDiff); err != nil {
return nil, errors.Wr... | [
"func",
"(",
"api",
"*",
"API",
")",
"FieldAttrDiff",
"(",
"ctx",
"context",
".",
"Context",
",",
"indexName",
"string",
",",
"fieldName",
"string",
",",
"blocks",
"[",
"]",
"AttrBlock",
")",
"(",
"map",
"[",
"uint64",
"]",
"map",
"[",
"string",
"]",
... | // FieldAttrDiff determines the local row attribute data blocks which differ from those provided. | [
"FieldAttrDiff",
"determines",
"the",
"local",
"row",
"attribute",
"data",
"blocks",
"which",
"differ",
"from",
"those",
"provided",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L782-L817 | train |
pilosa/pilosa | api.go | OptImportOptionsClear | func OptImportOptionsClear(c bool) ImportOption {
return func(o *ImportOptions) error {
o.Clear = c
return nil
}
} | go | func OptImportOptionsClear(c bool) ImportOption {
return func(o *ImportOptions) error {
o.Clear = c
return nil
}
} | [
"func",
"OptImportOptionsClear",
"(",
"c",
"bool",
")",
"ImportOption",
"{",
"return",
"func",
"(",
"o",
"*",
"ImportOptions",
")",
"error",
"{",
"o",
".",
"Clear",
"=",
"c",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // OptImportOptionsClear is a functional option on ImportOption
// used to specify whether the import is a set or clear operation. | [
"OptImportOptionsClear",
"is",
"a",
"functional",
"option",
"on",
"ImportOption",
"used",
"to",
"specify",
"whether",
"the",
"import",
"is",
"a",
"set",
"or",
"clear",
"operation",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L830-L835 | train |
pilosa/pilosa | api.go | OptImportOptionsIgnoreKeyCheck | func OptImportOptionsIgnoreKeyCheck(b bool) ImportOption {
return func(o *ImportOptions) error {
o.IgnoreKeyCheck = b
return nil
}
} | go | func OptImportOptionsIgnoreKeyCheck(b bool) ImportOption {
return func(o *ImportOptions) error {
o.IgnoreKeyCheck = b
return nil
}
} | [
"func",
"OptImportOptionsIgnoreKeyCheck",
"(",
"b",
"bool",
")",
"ImportOption",
"{",
"return",
"func",
"(",
"o",
"*",
"ImportOptions",
")",
"error",
"{",
"o",
".",
"IgnoreKeyCheck",
"=",
"b",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // OptImportOptionsIgnoreKeyCheck is a functional option on ImportOption
// used to specify whether key check should be ignored. | [
"OptImportOptionsIgnoreKeyCheck",
"is",
"a",
"functional",
"option",
"on",
"ImportOption",
"used",
"to",
"specify",
"whether",
"key",
"check",
"should",
"be",
"ignored",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L839-L844 | train |
pilosa/pilosa | api.go | AvailableShardsByIndex | func (api *API) AvailableShardsByIndex(ctx context.Context) map[string]*roaring.Bitmap {
span, _ := tracing.StartSpanFromContext(ctx, "API.AvailableShardsByIndex")
defer span.Finish()
return api.holder.availableShardsByIndex()
} | go | func (api *API) AvailableShardsByIndex(ctx context.Context) map[string]*roaring.Bitmap {
span, _ := tracing.StartSpanFromContext(ctx, "API.AvailableShardsByIndex")
defer span.Finish()
return api.holder.availableShardsByIndex()
} | [
"func",
"(",
"api",
"*",
"API",
")",
"AvailableShardsByIndex",
"(",
"ctx",
"context",
".",
"Context",
")",
"map",
"[",
"string",
"]",
"*",
"roaring",
".",
"Bitmap",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"... | // AvailableShardsByIndex returns bitmaps of shards with available by index name. | [
"AvailableShardsByIndex",
"returns",
"bitmaps",
"of",
"shards",
"with",
"available",
"by",
"index",
"name",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1064-L1068 | train |
pilosa/pilosa | api.go | StatsWithTags | func (api *API) StatsWithTags(tags []string) stats.StatsClient {
if api.holder == nil || api.cluster == nil {
return nil
}
return api.holder.Stats.WithTags(tags...)
} | go | func (api *API) StatsWithTags(tags []string) stats.StatsClient {
if api.holder == nil || api.cluster == nil {
return nil
}
return api.holder.Stats.WithTags(tags...)
} | [
"func",
"(",
"api",
"*",
"API",
")",
"StatsWithTags",
"(",
"tags",
"[",
"]",
"string",
")",
"stats",
".",
"StatsClient",
"{",
"if",
"api",
".",
"holder",
"==",
"nil",
"||",
"api",
".",
"cluster",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
... | // StatsWithTags returns an instance of whatever implementation of StatsClient
// pilosa is using with the given tags. | [
"StatsWithTags",
"returns",
"an",
"instance",
"of",
"whatever",
"implementation",
"of",
"StatsClient",
"pilosa",
"is",
"using",
"with",
"the",
"given",
"tags",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1072-L1077 | train |
pilosa/pilosa | api.go | SetCoordinator | func (api *API) SetCoordinator(ctx context.Context, id string) (oldNode, newNode *Node, err error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.SetCoordinator")
defer span.Finish()
if err := api.validate(apiSetCoordinator); err != nil {
return nil, nil, errors.Wrap(err, "validating api method")
}
oldNod... | go | func (api *API) SetCoordinator(ctx context.Context, id string) (oldNode, newNode *Node, err error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.SetCoordinator")
defer span.Finish()
if err := api.validate(apiSetCoordinator); err != nil {
return nil, nil, errors.Wrap(err, "validating api method")
}
oldNod... | [
"func",
"(",
"api",
"*",
"API",
")",
"SetCoordinator",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"oldNode",
",",
"newNode",
"*",
"Node",
",",
"err",
"error",
")",
"{",
"span",
",",
"_",
":=",
"tracing",
".",
"StartSpanFrom... | // SetCoordinator makes a new Node the cluster coordinator. | [
"SetCoordinator",
"makes",
"a",
"new",
"Node",
"the",
"cluster",
"coordinator",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1117-L1146 | train |
pilosa/pilosa | api.go | RemoveNode | func (api *API) RemoveNode(id string) (*Node, error) {
if err := api.validate(apiRemoveNode); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
removeNode := api.cluster.nodeByID(id)
if removeNode == nil {
if !api.cluster.topologyContainsNode(id) {
return nil, errors.Wrap(ErrNodeIDNotExis... | go | func (api *API) RemoveNode(id string) (*Node, error) {
if err := api.validate(apiRemoveNode); err != nil {
return nil, errors.Wrap(err, "validating api method")
}
removeNode := api.cluster.nodeByID(id)
if removeNode == nil {
if !api.cluster.topologyContainsNode(id) {
return nil, errors.Wrap(ErrNodeIDNotExis... | [
"func",
"(",
"api",
"*",
"API",
")",
"RemoveNode",
"(",
"id",
"string",
")",
"(",
"*",
"Node",
",",
"error",
")",
"{",
"if",
"err",
":=",
"api",
".",
"validate",
"(",
"apiRemoveNode",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"erro... | // RemoveNode puts the cluster into the "RESIZING" state and begins the job of
// removing the given node. | [
"RemoveNode",
"puts",
"the",
"cluster",
"into",
"the",
"RESIZING",
"state",
"and",
"begins",
"the",
"job",
"of",
"removing",
"the",
"given",
"node",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1150-L1171 | train |
pilosa/pilosa | api.go | ResizeAbort | func (api *API) ResizeAbort() error {
if err := api.validate(apiResizeAbort); err != nil {
return errors.Wrap(err, "validating api method")
}
err := api.cluster.completeCurrentJob(resizeJobStateAborted)
return errors.Wrap(err, "complete current job")
} | go | func (api *API) ResizeAbort() error {
if err := api.validate(apiResizeAbort); err != nil {
return errors.Wrap(err, "validating api method")
}
err := api.cluster.completeCurrentJob(resizeJobStateAborted)
return errors.Wrap(err, "complete current job")
} | [
"func",
"(",
"api",
"*",
"API",
")",
"ResizeAbort",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"api",
".",
"validate",
"(",
"apiResizeAbort",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\... | // ResizeAbort stops the current resize job. | [
"ResizeAbort",
"stops",
"the",
"current",
"resize",
"job",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1174-L1181 | train |
pilosa/pilosa | api.go | GetTranslateData | func (api *API) GetTranslateData(ctx context.Context, offset int64) (io.ReadCloser, error) {
span, ctx := tracing.StartSpanFromContext(ctx, "API.GetTranslateData")
defer span.Finish()
rc, err := api.holder.translateFile.Reader(ctx, offset)
if err != nil {
return nil, errors.Wrap(err, "read from translate store")... | go | func (api *API) GetTranslateData(ctx context.Context, offset int64) (io.ReadCloser, error) {
span, ctx := tracing.StartSpanFromContext(ctx, "API.GetTranslateData")
defer span.Finish()
rc, err := api.holder.translateFile.Reader(ctx, offset)
if err != nil {
return nil, errors.Wrap(err, "read from translate store")... | [
"func",
"(",
"api",
"*",
"API",
")",
"GetTranslateData",
"(",
"ctx",
"context",
".",
"Context",
",",
"offset",
"int64",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"tracing",
".",
"StartSpanFromContext",
"(",
"c... | // GetTranslateData provides a reader for key translation logs starting at offset. | [
"GetTranslateData",
"provides",
"a",
"reader",
"for",
"key",
"translation",
"logs",
"starting",
"at",
"offset",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1184-L1197 | train |
pilosa/pilosa | api.go | Info | func (api *API) Info() serverInfo {
si := api.server.systemInfo
// we don't report errors on failures to get this information
physicalCores, logicalCores, _ := si.CPUCores()
mhz, _ := si.CPUMHz()
mem, _ := si.MemTotal()
return serverInfo{
ShardWidth: ShardWidth,
CPUPhysicalCores: physicalCores,
CPULog... | go | func (api *API) Info() serverInfo {
si := api.server.systemInfo
// we don't report errors on failures to get this information
physicalCores, logicalCores, _ := si.CPUCores()
mhz, _ := si.CPUMHz()
mem, _ := si.MemTotal()
return serverInfo{
ShardWidth: ShardWidth,
CPUPhysicalCores: physicalCores,
CPULog... | [
"func",
"(",
"api",
"*",
"API",
")",
"Info",
"(",
")",
"serverInfo",
"{",
"si",
":=",
"api",
".",
"server",
".",
"systemInfo",
"\n",
"// we don't report errors on failures to get this information",
"physicalCores",
",",
"logicalCores",
",",
"_",
":=",
"si",
".",... | // Info returns information about this server instance. | [
"Info",
"returns",
"information",
"about",
"this",
"server",
"instance",
"."
] | 67d53f6b48a43f7fe090f48e35518ca8d024747c | https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1212-L1226 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.