id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
26,200 | cloudfoundry/cli | api/cloudcontroller/ccv3/organization.go | GetIsolationSegmentOrganizations | func (client *Client) GetIsolationSegmentOrganizations(isolationSegmentGUID string) ([]Organization, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetIsolationSegmentOrganizationsRequest,
URIParams: map[string]string{"isolation_segment_guid": isolationSegmentGUID}... | go | func (client *Client) GetIsolationSegmentOrganizations(isolationSegmentGUID string) ([]Organization, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetIsolationSegmentOrganizationsRequest,
URIParams: map[string]string{"isolation_segment_guid": isolationSegmentGUID}... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetIsolationSegmentOrganizations",
"(",
"isolationSegmentGUID",
"string",
")",
"(",
"[",
"]",
"Organization",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"("... | // GetIsolationSegmentOrganizations lists organizations
// entitled to an isolation segment. | [
"GetIsolationSegmentOrganizations",
"lists",
"organizations",
"entitled",
"to",
"an",
"isolation",
"segment",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/organization.go#L25-L48 |
26,201 | cloudfoundry/cli | api/cloudcontroller/ccv3/organization.go | GetOrganizations | func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetOrganizationsRequest,
Query: query,
})
if err != nil {
return nil, nil, err
}
var fullOrgsList []Organization
warnings, err := clie... | go | func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetOrganizationsRequest,
Query: query,
})
if err != nil {
return nil, nil, err
}
var fullOrgsList []Organization
warnings, err := clie... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetOrganizations",
"(",
"query",
"...",
"Query",
")",
"(",
"[",
"]",
"Organization",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
... | // GetOrganizations lists organizations with optional filters. | [
"GetOrganizations",
"lists",
"organizations",
"with",
"optional",
"filters",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/organization.go#L51-L74 |
26,202 | cloudfoundry/cli | api/cloudcontroller/ccv3/droplet.go | GetApplicationDropletCurrent | func (client *Client) GetApplicationDropletCurrent(appGUID string) (Droplet, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetApplicationDropletCurrentRequest,
URIParams: map[string]string{"app_guid": appGUID},
})
if err != nil {
return Droplet{}, nil, err
}
... | go | func (client *Client) GetApplicationDropletCurrent(appGUID string) (Droplet, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetApplicationDropletCurrentRequest,
URIParams: map[string]string{"app_guid": appGUID},
})
if err != nil {
return Droplet{}, nil, err
}
... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetApplicationDropletCurrent",
"(",
"appGUID",
"string",
")",
"(",
"Droplet",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"Requ... | // GetApplicationDropletCurrent returns the current droplet for a given
// application. | [
"GetApplicationDropletCurrent",
"returns",
"the",
"current",
"droplet",
"for",
"a",
"given",
"application",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/droplet.go#L38-L53 |
26,203 | cloudfoundry/cli | api/cloudcontroller/ccv3/droplet.go | GetDroplet | func (client *Client) GetDroplet(dropletGUID string) (Droplet, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetDropletRequest,
URIParams: map[string]string{"droplet_guid": dropletGUID},
})
if err != nil {
return Droplet{}, nil, err
}
var responseDroplet Dr... | go | func (client *Client) GetDroplet(dropletGUID string) (Droplet, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetDropletRequest,
URIParams: map[string]string{"droplet_guid": dropletGUID},
})
if err != nil {
return Droplet{}, nil, err
}
var responseDroplet Dr... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetDroplet",
"(",
"dropletGUID",
"string",
")",
"(",
"Droplet",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"RequestName",
":... | // GetDroplet returns a droplet with the given GUID. | [
"GetDroplet",
"returns",
"a",
"droplet",
"with",
"the",
"given",
"GUID",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/droplet.go#L56-L72 |
26,204 | cloudfoundry/cli | api/cloudcontroller/ccv3/droplet.go | GetDroplets | func (client *Client) GetDroplets(query ...Query) ([]Droplet, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetDropletsRequest,
Query: query,
})
if err != nil {
return nil, nil, err
}
var responseDroplets []Droplet
warnings, err := client.paginate(requ... | go | func (client *Client) GetDroplets(query ...Query) ([]Droplet, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetDropletsRequest,
Query: query,
})
if err != nil {
return nil, nil, err
}
var responseDroplets []Droplet
warnings, err := client.paginate(requ... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetDroplets",
"(",
"query",
"...",
"Query",
")",
"(",
"[",
"]",
"Droplet",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"R... | // GetDroplets lists droplets with optional filters. | [
"GetDroplets",
"lists",
"droplets",
"with",
"optional",
"filters",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/droplet.go#L75-L98 |
26,205 | cloudfoundry/cli | types/null_int.go | IsValidValue | func (n *NullInt) IsValidValue(val string) error {
_, err := strconv.Atoi(val)
return err
} | go | func (n *NullInt) IsValidValue(val string) error {
_, err := strconv.Atoi(val)
return err
} | [
"func",
"(",
"n",
"*",
"NullInt",
")",
"IsValidValue",
"(",
"val",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"val",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // IsValidValue returns an error if the input value is not an integer. | [
"IsValidValue",
"returns",
"an",
"error",
"if",
"the",
"input",
"value",
"is",
"not",
"an",
"integer",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/types/null_int.go#L34-L37 |
26,206 | cloudfoundry/cli | api/cloudcontroller/ccv3/service_instance.go | GetServiceInstances | func (client *Client) GetServiceInstances(query ...Query) ([]ServiceInstance, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetServiceInstancesRequest,
Query: query,
})
if err != nil {
return nil, nil, err
}
var fullServiceInstanceList []ServiceInstance... | go | func (client *Client) GetServiceInstances(query ...Query) ([]ServiceInstance, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetServiceInstancesRequest,
Query: query,
})
if err != nil {
return nil, nil, err
}
var fullServiceInstanceList []ServiceInstance... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetServiceInstances",
"(",
"query",
"...",
"Query",
")",
"(",
"[",
"]",
"ServiceInstance",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptio... | // GetServiceInstances lists service instances with optional filters. | [
"GetServiceInstances",
"lists",
"service",
"instances",
"with",
"optional",
"filters",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/service_instance.go#L17-L40 |
26,207 | cloudfoundry/cli | api/cloudcontroller/ccv2/route_mapping.go | UnmarshalJSON | func (routeMapping *RouteMapping) UnmarshalJSON(data []byte) error {
var ccRouteMapping struct {
Metadata internal.Metadata `json:"metadata"`
Entity struct {
AppGUID string `json:"app_guid"`
RouteGUID string `json:"route_guid"`
} `json:"entity"`
}
err := cloudcontroller.DecodeJSON(data, &ccRouteMapp... | go | func (routeMapping *RouteMapping) UnmarshalJSON(data []byte) error {
var ccRouteMapping struct {
Metadata internal.Metadata `json:"metadata"`
Entity struct {
AppGUID string `json:"app_guid"`
RouteGUID string `json:"route_guid"`
} `json:"entity"`
}
err := cloudcontroller.DecodeJSON(data, &ccRouteMapp... | [
"func",
"(",
"routeMapping",
"*",
"RouteMapping",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"ccRouteMapping",
"struct",
"{",
"Metadata",
"internal",
".",
"Metadata",
"`json:\"metadata\"`",
"\n",
"Entity",
"struct",
"{",
"Ap... | // UnmarshalJSON helps unmarshal a Cloud Controller Route Mapping | [
"UnmarshalJSON",
"helps",
"unmarshal",
"a",
"Cloud",
"Controller",
"Route",
"Mapping"
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/route_mapping.go#L22-L40 |
26,208 | cloudfoundry/cli | api/cloudcontroller/ccv2/route_mapping.go | GetRouteMapping | func (client *Client) GetRouteMapping(guid string) (RouteMapping, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetRouteMappingRequest,
URIParams: Params{"route_mapping_guid": guid},
})
if err != nil {
return RouteMapping{}, nil, err
}
var routeMapping Rout... | go | func (client *Client) GetRouteMapping(guid string) (RouteMapping, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetRouteMappingRequest,
URIParams: Params{"route_mapping_guid": guid},
})
if err != nil {
return RouteMapping{}, nil, err
}
var routeMapping Rout... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRouteMapping",
"(",
"guid",
"string",
")",
"(",
"RouteMapping",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"RequestName",
... | // GetRouteMapping returns a route mapping with the provided guid. | [
"GetRouteMapping",
"returns",
"a",
"route",
"mapping",
"with",
"the",
"provided",
"guid",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/route_mapping.go#L43-L59 |
26,209 | cloudfoundry/cli | api/cloudcontroller/ccv2/route_mapping.go | GetRouteMappings | func (client *Client) GetRouteMappings(filters ...Filter) ([]RouteMapping, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetRouteMappingsRequest,
Query: ConvertFilterParameters(filters),
})
if err != nil {
return nil, nil, err
}
var fullRouteMappingsLis... | go | func (client *Client) GetRouteMappings(filters ...Filter) ([]RouteMapping, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetRouteMappingsRequest,
Query: ConvertFilterParameters(filters),
})
if err != nil {
return nil, nil, err
}
var fullRouteMappingsLis... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetRouteMappings",
"(",
"filters",
"...",
"Filter",
")",
"(",
"[",
"]",
"RouteMapping",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions"... | // GetRouteMappings returns a list of RouteMappings based off of the provided queries. | [
"GetRouteMappings",
"returns",
"a",
"list",
"of",
"RouteMappings",
"based",
"off",
"of",
"the",
"provided",
"queries",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/route_mapping.go#L62-L85 |
26,210 | cloudfoundry/cli | api/uaa/refresh_token.go | AuthorizationToken | func (refreshTokenResponse RefreshedTokens) AuthorizationToken() string {
return fmt.Sprintf("%s %s", refreshTokenResponse.Type, refreshTokenResponse.AccessToken)
} | go | func (refreshTokenResponse RefreshedTokens) AuthorizationToken() string {
return fmt.Sprintf("%s %s", refreshTokenResponse.Type, refreshTokenResponse.AccessToken)
} | [
"func",
"(",
"refreshTokenResponse",
"RefreshedTokens",
")",
"AuthorizationToken",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"refreshTokenResponse",
".",
"Type",
",",
"refreshTokenResponse",
".",
"AccessToken",
")",
"\n",
"}... | // AuthorizationToken returns formatted authorization header. | [
"AuthorizationToken",
"returns",
"formatted",
"authorization",
"header",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/refresh_token.go#L21-L23 |
26,211 | cloudfoundry/cli | api/uaa/refresh_token.go | RefreshAccessToken | func (client *Client) RefreshAccessToken(refreshToken string) (RefreshedTokens, error) {
var values url.Values
switch client.config.UAAGrantType() {
case string(constant.GrantTypeClientCredentials):
values = client.clientCredentialRefreshBody()
case "", string(constant.GrantTypePassword): // CLI used to write em... | go | func (client *Client) RefreshAccessToken(refreshToken string) (RefreshedTokens, error) {
var values url.Values
switch client.config.UAAGrantType() {
case string(constant.GrantTypeClientCredentials):
values = client.clientCredentialRefreshBody()
case "", string(constant.GrantTypePassword): // CLI used to write em... | [
"func",
"(",
"client",
"*",
"Client",
")",
"RefreshAccessToken",
"(",
"refreshToken",
"string",
")",
"(",
"RefreshedTokens",
",",
"error",
")",
"{",
"var",
"values",
"url",
".",
"Values",
"\n\n",
"switch",
"client",
".",
"config",
".",
"UAAGrantType",
"(",
... | // RefreshAccessToken refreshes the current access token. | [
"RefreshAccessToken",
"refreshes",
"the",
"current",
"access",
"token",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/refresh_token.go#L26-L62 |
26,212 | cloudfoundry/cli | util/ui/table.go | DisplayKeyValueTable | func (ui *UI) DisplayKeyValueTable(prefix string, table [][]string, padding int) {
rows := len(table)
if rows == 0 {
return
}
var displayTable [][]string
for _, row := range table {
if len(row) > 0 {
displayTable = append(displayTable, row)
}
}
columns := len(displayTable[0])
if columns < 2 || !ui.Is... | go | func (ui *UI) DisplayKeyValueTable(prefix string, table [][]string, padding int) {
rows := len(table)
if rows == 0 {
return
}
var displayTable [][]string
for _, row := range table {
if len(row) > 0 {
displayTable = append(displayTable, row)
}
}
columns := len(displayTable[0])
if columns < 2 || !ui.Is... | [
"func",
"(",
"ui",
"*",
"UI",
")",
"DisplayKeyValueTable",
"(",
"prefix",
"string",
",",
"table",
"[",
"]",
"[",
"]",
"string",
",",
"padding",
"int",
")",
"{",
"rows",
":=",
"len",
"(",
"table",
")",
"\n",
"if",
"rows",
"==",
"0",
"{",
"return",
... | // DisplayKeyValueTable outputs a matrix of strings as a table to UI.Out.
// Prefix will be prepended to each row and padding adds the specified number
// of spaces between columns. The final columns may wrap to multiple lines but
// will still be confined to the last column. Wrapping will occur on word
// boundaries. | [
"DisplayKeyValueTable",
"outputs",
"a",
"matrix",
"of",
"strings",
"as",
"a",
"table",
"to",
"UI",
".",
"Out",
".",
"Prefix",
"will",
"be",
"prepended",
"to",
"each",
"row",
"and",
"padding",
"adds",
"the",
"specified",
"number",
"of",
"spaces",
"between",
... | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/table.go#L20-L40 |
26,213 | cloudfoundry/cli | util/ui/table.go | DisplayNonWrappingTable | func (ui *UI) DisplayNonWrappingTable(prefix string, table [][]string, padding int) {
ui.terminalLock.Lock()
defer ui.terminalLock.Unlock()
if len(table) == 0 {
return
}
var columnPadding []int
rows := len(table)
columns := len(table[0])
for col := 0; col < columns; col++ {
var max int
for row := 0; ro... | go | func (ui *UI) DisplayNonWrappingTable(prefix string, table [][]string, padding int) {
ui.terminalLock.Lock()
defer ui.terminalLock.Unlock()
if len(table) == 0 {
return
}
var columnPadding []int
rows := len(table)
columns := len(table[0])
for col := 0; col < columns; col++ {
var max int
for row := 0; ro... | [
"func",
"(",
"ui",
"*",
"UI",
")",
"DisplayNonWrappingTable",
"(",
"prefix",
"string",
",",
"table",
"[",
"]",
"[",
"]",
"string",
",",
"padding",
"int",
")",
"{",
"ui",
".",
"terminalLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ui",
".",
"terminalL... | // DisplayNonWrappingTable outputs a matrix of strings as a table to UI.Out.
// Prefix will be prepended to each row and padding adds the specified number
// of spaces between columns. | [
"DisplayNonWrappingTable",
"outputs",
"a",
"matrix",
"of",
"strings",
"as",
"a",
"table",
"to",
"UI",
".",
"Out",
".",
"Prefix",
"will",
"be",
"prepended",
"to",
"each",
"row",
"and",
"padding",
"adds",
"the",
"specified",
"number",
"of",
"spaces",
"between"... | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/table.go#L45-L79 |
26,214 | cloudfoundry/cli | util/ui/table.go | DisplayTableWithHeader | func (ui *UI) DisplayTableWithHeader(prefix string, table [][]string, padding int) {
if len(table) == 0 {
return
}
for i, str := range table[0] {
table[0][i] = ui.modifyColor(str, color.New(color.Bold))
}
ui.DisplayNonWrappingTable(prefix, table, padding)
} | go | func (ui *UI) DisplayTableWithHeader(prefix string, table [][]string, padding int) {
if len(table) == 0 {
return
}
for i, str := range table[0] {
table[0][i] = ui.modifyColor(str, color.New(color.Bold))
}
ui.DisplayNonWrappingTable(prefix, table, padding)
} | [
"func",
"(",
"ui",
"*",
"UI",
")",
"DisplayTableWithHeader",
"(",
"prefix",
"string",
",",
"table",
"[",
"]",
"[",
"]",
"string",
",",
"padding",
"int",
")",
"{",
"if",
"len",
"(",
"table",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"for",
"... | // DisplayTableWithHeader outputs a simple non-wrapping table with bolded
// headers. | [
"DisplayTableWithHeader",
"outputs",
"a",
"simple",
"non",
"-",
"wrapping",
"table",
"with",
"bolded",
"headers",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/table.go#L83-L92 |
26,215 | cloudfoundry/cli | api/cloudcontroller/ccv2/application_instance.go | GetApplicationApplicationInstances | func (client *Client) GetApplicationApplicationInstances(guid string) (map[int]ApplicationInstance, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetAppInstancesRequest,
URIParams: Params{"app_guid": guid},
})
if err != nil {
return nil, nil, err
}
var inst... | go | func (client *Client) GetApplicationApplicationInstances(guid string) (map[int]ApplicationInstance, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetAppInstancesRequest,
URIParams: Params{"app_guid": guid},
})
if err != nil {
return nil, nil, err
}
var inst... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetApplicationApplicationInstances",
"(",
"guid",
"string",
")",
"(",
"map",
"[",
"int",
"]",
"ApplicationInstance",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequ... | // GetApplicationApplicationInstances returns a list of ApplicationInstance for
// a given application. Depending on the state of an application, it might skip
// some application instances. | [
"GetApplicationApplicationInstances",
"returns",
"a",
"list",
"of",
"ApplicationInstance",
"for",
"a",
"given",
"application",
".",
"Depending",
"on",
"the",
"state",
"of",
"an",
"application",
"it",
"might",
"skip",
"some",
"application",
"instances",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/application_instance.go#L50-L80 |
26,216 | cloudfoundry/cli | api/cloudcontroller/ccv2/service_plan_visibility.go | UnmarshalJSON | func (servicePlanVisibility *ServicePlanVisibility) UnmarshalJSON(data []byte) error {
var ccServicePlanVisibility struct {
Metadata internal.Metadata
Entity struct {
ServicePlanGUID string `json:"service_plan_guid"`
OrganizationGUID string `json:"organization_guid"`
} `json:"entity"`
}
err := cloudco... | go | func (servicePlanVisibility *ServicePlanVisibility) UnmarshalJSON(data []byte) error {
var ccServicePlanVisibility struct {
Metadata internal.Metadata
Entity struct {
ServicePlanGUID string `json:"service_plan_guid"`
OrganizationGUID string `json:"organization_guid"`
} `json:"entity"`
}
err := cloudco... | [
"func",
"(",
"servicePlanVisibility",
"*",
"ServicePlanVisibility",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"ccServicePlanVisibility",
"struct",
"{",
"Metadata",
"internal",
".",
"Metadata",
"\n",
"Entity",
"struct",
"{",
"... | // UnmarshalJSON helps unmarshal a Cloud Controller Service Plan Visibilities
// response. | [
"UnmarshalJSON",
"helps",
"unmarshal",
"a",
"Cloud",
"Controller",
"Service",
"Plan",
"Visibilities",
"response",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/service_plan_visibility.go#L24-L41 |
26,217 | cloudfoundry/cli | api/cloudcontroller/ccv2/service_plan_visibility.go | GetServicePlanVisibilities | func (client *Client) GetServicePlanVisibilities(filters ...Filter) ([]ServicePlanVisibility, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetServicePlanVisibilitiesRequest,
Query: ConvertFilterParameters(filters),
})
if err != nil {
return nil, nil, err... | go | func (client *Client) GetServicePlanVisibilities(filters ...Filter) ([]ServicePlanVisibility, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetServicePlanVisibilitiesRequest,
Query: ConvertFilterParameters(filters),
})
if err != nil {
return nil, nil, err... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetServicePlanVisibilities",
"(",
"filters",
"...",
"Filter",
")",
"(",
"[",
"]",
"ServicePlanVisibility",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",... | // GetServicePlanVisibilities returns back a list of Service Plan Visibilities
// given the provided filters. | [
"GetServicePlanVisibilities",
"returns",
"back",
"a",
"list",
"of",
"Service",
"Plan",
"Visibilities",
"given",
"the",
"provided",
"filters",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/service_plan_visibility.go#L93-L117 |
26,218 | cloudfoundry/cli | api/uaa/wrapper/request_logger.go | Make | func (logger *RequestLogger) Make(request *http.Request, passedResponse *uaa.Response) error {
err := logger.displayRequest(request)
if err != nil {
logger.output.HandleInternalError(err)
}
err = logger.connection.Make(request, passedResponse)
if passedResponse.HTTPResponse != nil {
displayErr := logger.disp... | go | func (logger *RequestLogger) Make(request *http.Request, passedResponse *uaa.Response) error {
err := logger.displayRequest(request)
if err != nil {
logger.output.HandleInternalError(err)
}
err = logger.connection.Make(request, passedResponse)
if passedResponse.HTTPResponse != nil {
displayErr := logger.disp... | [
"func",
"(",
"logger",
"*",
"RequestLogger",
")",
"Make",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"passedResponse",
"*",
"uaa",
".",
"Response",
")",
"error",
"{",
"err",
":=",
"logger",
".",
"displayRequest",
"(",
"request",
")",
"\n",
"if",
... | // Make records the request and the response to UI | [
"Make",
"records",
"the",
"request",
"and",
"the",
"response",
"to",
"UI"
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/wrapper/request_logger.go#L44-L60 |
26,219 | cloudfoundry/cli | api/cloudcontroller/ccv2/space_quota.go | UnmarshalJSON | func (spaceQuota *SpaceQuota) UnmarshalJSON(data []byte) error {
var ccSpaceQuota struct {
Metadata internal.Metadata `json:"metadata"`
Entity struct {
Name string `json:"name"`
} `json:"entity"`
}
err := cloudcontroller.DecodeJSON(data, &ccSpaceQuota)
if err != nil {
return err
}
spaceQuota.GUID = ... | go | func (spaceQuota *SpaceQuota) UnmarshalJSON(data []byte) error {
var ccSpaceQuota struct {
Metadata internal.Metadata `json:"metadata"`
Entity struct {
Name string `json:"name"`
} `json:"entity"`
}
err := cloudcontroller.DecodeJSON(data, &ccSpaceQuota)
if err != nil {
return err
}
spaceQuota.GUID = ... | [
"func",
"(",
"spaceQuota",
"*",
"SpaceQuota",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"ccSpaceQuota",
"struct",
"{",
"Metadata",
"internal",
".",
"Metadata",
"`json:\"metadata\"`",
"\n",
"Entity",
"struct",
"{",
"Name",
... | // UnmarshalJSON helps unmarshal a Cloud Controller Space Quota response. | [
"UnmarshalJSON",
"helps",
"unmarshal",
"a",
"Cloud",
"Controller",
"Space",
"Quota",
"response",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L21-L36 |
26,220 | cloudfoundry/cli | api/cloudcontroller/ccv2/space_quota.go | GetSpaceQuotaDefinition | func (client *Client) GetSpaceQuotaDefinition(guid string) (SpaceQuota, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetSpaceQuotaDefinitionRequest,
URIParams: Params{"space_quota_guid": guid},
})
if err != nil {
return SpaceQuota{}, nil, err
}
var spaceQu... | go | func (client *Client) GetSpaceQuotaDefinition(guid string) (SpaceQuota, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetSpaceQuotaDefinitionRequest,
URIParams: Params{"space_quota_guid": guid},
})
if err != nil {
return SpaceQuota{}, nil, err
}
var spaceQu... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetSpaceQuotaDefinition",
"(",
"guid",
"string",
")",
"(",
"SpaceQuota",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"RequestNa... | // GetSpaceQuotaDefinition returns a Space Quota. | [
"GetSpaceQuotaDefinition",
"returns",
"a",
"Space",
"Quota",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L39-L55 |
26,221 | cloudfoundry/cli | api/cloudcontroller/ccv2/space_quota.go | GetSpaceQuotas | func (client *Client) GetSpaceQuotas(orgGUID string) ([]SpaceQuota, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetOrganizationSpaceQuotasRequest,
URIParams: Params{"organization_guid": orgGUID},
})
if err != nil {
return nil, nil, err
}
var spaceQuotas ... | go | func (client *Client) GetSpaceQuotas(orgGUID string) ([]SpaceQuota, Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.GetOrganizationSpaceQuotasRequest,
URIParams: Params{"organization_guid": orgGUID},
})
if err != nil {
return nil, nil, err
}
var spaceQuotas ... | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetSpaceQuotas",
"(",
"orgGUID",
"string",
")",
"(",
"[",
"]",
"SpaceQuota",
",",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"R... | // GetSpaceQuotas returns all the space quotas for the org | [
"GetSpaceQuotas",
"returns",
"all",
"the",
"space",
"quotas",
"for",
"the",
"org"
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L58-L82 |
26,222 | cloudfoundry/cli | api/cloudcontroller/ccv2/space_quota.go | SetSpaceQuota | func (client *Client) SetSpaceQuota(spaceGUID string, quotaGUID string) (Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.PutSpaceQuotaRequest,
URIParams: Params{"space_quota_guid": quotaGUID, "space_guid": spaceGUID},
})
if err != nil {
return nil, err
}
res... | go | func (client *Client) SetSpaceQuota(spaceGUID string, quotaGUID string) (Warnings, error) {
request, err := client.newHTTPRequest(requestOptions{
RequestName: internal.PutSpaceQuotaRequest,
URIParams: Params{"space_quota_guid": quotaGUID, "space_guid": spaceGUID},
})
if err != nil {
return nil, err
}
res... | [
"func",
"(",
"client",
"*",
"Client",
")",
"SetSpaceQuota",
"(",
"spaceGUID",
"string",
",",
"quotaGUID",
"string",
")",
"(",
"Warnings",
",",
"error",
")",
"{",
"request",
",",
"err",
":=",
"client",
".",
"newHTTPRequest",
"(",
"requestOptions",
"{",
"Req... | // SetSpaceQuota should set the quota for the space and returns the warnings | [
"SetSpaceQuota",
"should",
"set",
"the",
"quota",
"for",
"the",
"space",
"and",
"returns",
"the",
"warnings"
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L85-L99 |
26,223 | cloudfoundry/cli | actor/v2action/organization.go | GetOrganization | func (actor Actor) GetOrganization(guid string) (Organization, Warnings, error) {
org, warnings, err := actor.CloudControllerClient.GetOrganization(guid)
if _, ok := err.(ccerror.ResourceNotFoundError); ok {
return Organization{}, Warnings(warnings), actionerror.OrganizationNotFoundError{GUID: guid}
}
return Or... | go | func (actor Actor) GetOrganization(guid string) (Organization, Warnings, error) {
org, warnings, err := actor.CloudControllerClient.GetOrganization(guid)
if _, ok := err.(ccerror.ResourceNotFoundError); ok {
return Organization{}, Warnings(warnings), actionerror.OrganizationNotFoundError{GUID: guid}
}
return Or... | [
"func",
"(",
"actor",
"Actor",
")",
"GetOrganization",
"(",
"guid",
"string",
")",
"(",
"Organization",
",",
"Warnings",
",",
"error",
")",
"{",
"org",
",",
"warnings",
",",
"err",
":=",
"actor",
".",
"CloudControllerClient",
".",
"GetOrganization",
"(",
"... | // GetOrganization returns an Organization based on the provided guid. | [
"GetOrganization",
"returns",
"an",
"Organization",
"based",
"on",
"the",
"provided",
"guid",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L15-L23 |
26,224 | cloudfoundry/cli | actor/v2action/organization.go | GetOrganizationByName | func (actor Actor) GetOrganizationByName(orgName string) (Organization, Warnings, error) {
orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{
Type: constant.NameFilter,
Operator: constant.EqualOperator,
Values: []string{orgName},
})
if err != nil {
return Organization{}, W... | go | func (actor Actor) GetOrganizationByName(orgName string) (Organization, Warnings, error) {
orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{
Type: constant.NameFilter,
Operator: constant.EqualOperator,
Values: []string{orgName},
})
if err != nil {
return Organization{}, W... | [
"func",
"(",
"actor",
"Actor",
")",
"GetOrganizationByName",
"(",
"orgName",
"string",
")",
"(",
"Organization",
",",
"Warnings",
",",
"error",
")",
"{",
"orgs",
",",
"warnings",
",",
"err",
":=",
"actor",
".",
"CloudControllerClient",
".",
"GetOrganizations",... | // GetOrganizationByName returns an Organization based off of the name given. | [
"GetOrganizationByName",
"returns",
"an",
"Organization",
"based",
"off",
"of",
"the",
"name",
"given",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L26-L49 |
26,225 | cloudfoundry/cli | actor/v2action/organization.go | GrantOrgManagerByUsername | func (actor Actor) GrantOrgManagerByUsername(guid string, username string) (Warnings, error) {
var warnings ccv2.Warnings
var err error
if actor.Config.UAAGrantType() != string(uaaconst.GrantTypeClientCredentials) {
warnings, err = actor.CloudControllerClient.UpdateOrganizationManagerByUsername(guid, username)
}... | go | func (actor Actor) GrantOrgManagerByUsername(guid string, username string) (Warnings, error) {
var warnings ccv2.Warnings
var err error
if actor.Config.UAAGrantType() != string(uaaconst.GrantTypeClientCredentials) {
warnings, err = actor.CloudControllerClient.UpdateOrganizationManagerByUsername(guid, username)
}... | [
"func",
"(",
"actor",
"Actor",
")",
"GrantOrgManagerByUsername",
"(",
"guid",
"string",
",",
"username",
"string",
")",
"(",
"Warnings",
",",
"error",
")",
"{",
"var",
"warnings",
"ccv2",
".",
"Warnings",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"actor",... | // GrantOrgManagerByUsername gives the Org Manager role to the provided user. | [
"GrantOrgManagerByUsername",
"gives",
"the",
"Org",
"Manager",
"role",
"to",
"the",
"provided",
"user",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L52-L63 |
26,226 | cloudfoundry/cli | actor/v2action/organization.go | CreateOrganization | func (actor Actor) CreateOrganization(orgName string, quotaName string) (Organization, Warnings, error) {
var quotaGUID string
var allWarnings Warnings
if quotaName != "" {
quota, warnings, err := actor.GetOrganizationQuotaByName(quotaName)
allWarnings = append(allWarnings, warnings...)
if err != nil {
re... | go | func (actor Actor) CreateOrganization(orgName string, quotaName string) (Organization, Warnings, error) {
var quotaGUID string
var allWarnings Warnings
if quotaName != "" {
quota, warnings, err := actor.GetOrganizationQuotaByName(quotaName)
allWarnings = append(allWarnings, warnings...)
if err != nil {
re... | [
"func",
"(",
"actor",
"Actor",
")",
"CreateOrganization",
"(",
"orgName",
"string",
",",
"quotaName",
"string",
")",
"(",
"Organization",
",",
"Warnings",
",",
"error",
")",
"{",
"var",
"quotaGUID",
"string",
"\n",
"var",
"allWarnings",
"Warnings",
"\n\n",
"... | // CreateOrganization creates an Organization based on the provided orgName. | [
"CreateOrganization",
"creates",
"an",
"Organization",
"based",
"on",
"the",
"provided",
"orgName",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L66-L91 |
26,227 | cloudfoundry/cli | actor/v2action/organization.go | DeleteOrganization | func (actor Actor) DeleteOrganization(orgName string) (Warnings, error) {
var allWarnings Warnings
org, warnings, err := actor.GetOrganizationByName(orgName)
allWarnings = append(allWarnings, warnings...)
if err != nil {
return allWarnings, err
}
job, deleteWarnings, err := actor.CloudControllerClient.DeleteO... | go | func (actor Actor) DeleteOrganization(orgName string) (Warnings, error) {
var allWarnings Warnings
org, warnings, err := actor.GetOrganizationByName(orgName)
allWarnings = append(allWarnings, warnings...)
if err != nil {
return allWarnings, err
}
job, deleteWarnings, err := actor.CloudControllerClient.DeleteO... | [
"func",
"(",
"actor",
"Actor",
")",
"DeleteOrganization",
"(",
"orgName",
"string",
")",
"(",
"Warnings",
",",
"error",
")",
"{",
"var",
"allWarnings",
"Warnings",
"\n\n",
"org",
",",
"warnings",
",",
"err",
":=",
"actor",
".",
"GetOrganizationByName",
"(",
... | // DeleteOrganization deletes the Organization associated with the provided
// GUID. Once the deletion request is sent, it polls the deletion job until
// it's finished. | [
"DeleteOrganization",
"deletes",
"the",
"Organization",
"associated",
"with",
"the",
"provided",
"GUID",
".",
"Once",
"the",
"deletion",
"request",
"is",
"sent",
"it",
"polls",
"the",
"deletion",
"job",
"until",
"it",
"s",
"finished",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L96-L117 |
26,228 | cloudfoundry/cli | actor/v2action/organization.go | GetOrganizations | func (actor Actor) GetOrganizations() ([]Organization, Warnings, error) {
var returnedOrgs []Organization
orgs, warnings, err := actor.CloudControllerClient.GetOrganizations()
for _, org := range orgs {
returnedOrgs = append(returnedOrgs, Organization(org))
}
return returnedOrgs, Warnings(warnings), err
} | go | func (actor Actor) GetOrganizations() ([]Organization, Warnings, error) {
var returnedOrgs []Organization
orgs, warnings, err := actor.CloudControllerClient.GetOrganizations()
for _, org := range orgs {
returnedOrgs = append(returnedOrgs, Organization(org))
}
return returnedOrgs, Warnings(warnings), err
} | [
"func",
"(",
"actor",
"Actor",
")",
"GetOrganizations",
"(",
")",
"(",
"[",
"]",
"Organization",
",",
"Warnings",
",",
"error",
")",
"{",
"var",
"returnedOrgs",
"[",
"]",
"Organization",
"\n",
"orgs",
",",
"warnings",
",",
"err",
":=",
"actor",
".",
"C... | // GetOrganizations returns all the available organizations. | [
"GetOrganizations",
"returns",
"all",
"the",
"available",
"organizations",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L120-L127 |
26,229 | cloudfoundry/cli | actor/v2action/organization.go | OrganizationExistsWithName | func (actor Actor) OrganizationExistsWithName(orgName string) (bool, Warnings, error) {
orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{
Type: constant.NameFilter,
Operator: constant.EqualOperator,
Values: []string{orgName},
})
if err != nil {
return false, Warnings(warn... | go | func (actor Actor) OrganizationExistsWithName(orgName string) (bool, Warnings, error) {
orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{
Type: constant.NameFilter,
Operator: constant.EqualOperator,
Values: []string{orgName},
})
if err != nil {
return false, Warnings(warn... | [
"func",
"(",
"actor",
"Actor",
")",
"OrganizationExistsWithName",
"(",
"orgName",
"string",
")",
"(",
"bool",
",",
"Warnings",
",",
"error",
")",
"{",
"orgs",
",",
"warnings",
",",
"err",
":=",
"actor",
".",
"CloudControllerClient",
".",
"GetOrganizations",
... | // OrganizationExistsWithName returns true if there is an Organization with the
// provided name, otherwise false. | [
"OrganizationExistsWithName",
"returns",
"true",
"if",
"there",
"is",
"an",
"Organization",
"with",
"the",
"provided",
"name",
"otherwise",
"false",
"."
] | 5010c000047f246b870475e2c299556078cdad30 | https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L131-L146 |
26,230 | google/seesaw | ncc/client/ncc_client.go | call | func (nc *nccClient) call(name string, in interface{}, out interface{}) error {
nc.lock.RLock()
client := nc.client
nc.lock.RUnlock()
if client == nil {
return fmt.Errorf("Not connected")
}
ch := make(chan error, 1)
go func() {
ch <- client.Call(name, in, out)
}()
select {
case err := <-ch:
return err
... | go | func (nc *nccClient) call(name string, in interface{}, out interface{}) error {
nc.lock.RLock()
client := nc.client
nc.lock.RUnlock()
if client == nil {
return fmt.Errorf("Not connected")
}
ch := make(chan error, 1)
go func() {
ch <- client.Call(name, in, out)
}()
select {
case err := <-ch:
return err
... | [
"func",
"(",
"nc",
"*",
"nccClient",
")",
"call",
"(",
"name",
"string",
",",
"in",
"interface",
"{",
"}",
",",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"nc",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"client",
":=",
"nc",
".",
"client",... | // call performs an RPC call to the Seesaw v2 nccClient. | [
"call",
"performs",
"an",
"RPC",
"call",
"to",
"the",
"Seesaw",
"v2",
"nccClient",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/client/ncc_client.go#L159-L176 |
26,231 | google/seesaw | healthcheck/core.go | String | func (s State) String() string {
if name, ok := stateNames[s]; ok {
return name
}
return "<unknown>"
} | go | func (s State) String() string {
if name, ok := stateNames[s]; ok {
return name
}
return "<unknown>"
} | [
"func",
"(",
"s",
"State",
")",
"String",
"(",
")",
"string",
"{",
"if",
"name",
",",
"ok",
":=",
"stateNames",
"[",
"s",
"]",
";",
"ok",
"{",
"return",
"name",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // String returns the string representation for the given healthcheck state. | [
"String",
"returns",
"the",
"string",
"representation",
"for",
"the",
"given",
"healthcheck",
"state",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L67-L72 |
26,232 | google/seesaw | healthcheck/core.go | String | func (t Target) String() string {
var via string
if t.Mode == seesaw.HCModeDSR {
via = fmt.Sprintf(" (via %s mark %d)", t.Host, t.Mark)
}
return fmt.Sprintf("%s %s%s", t.addr(), t.Mode, via)
} | go | func (t Target) String() string {
var via string
if t.Mode == seesaw.HCModeDSR {
via = fmt.Sprintf(" (via %s mark %d)", t.Host, t.Mark)
}
return fmt.Sprintf("%s %s%s", t.addr(), t.Mode, via)
} | [
"func",
"(",
"t",
"Target",
")",
"String",
"(",
")",
"string",
"{",
"var",
"via",
"string",
"\n",
"if",
"t",
".",
"Mode",
"==",
"seesaw",
".",
"HCModeDSR",
"{",
"via",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Host",
",",
"t"... | // String returns the string representation of a healthcheck target. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"healthcheck",
"target",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L91-L97 |
26,233 | google/seesaw | healthcheck/core.go | addr | func (t *Target) addr() string {
if t.IP.To4() != nil {
return fmt.Sprintf("%v:%d", t.IP, t.Port)
}
return fmt.Sprintf("[%v]:%d", t.IP, t.Port)
} | go | func (t *Target) addr() string {
if t.IP.To4() != nil {
return fmt.Sprintf("%v:%d", t.IP, t.Port)
}
return fmt.Sprintf("[%v]:%d", t.IP, t.Port)
} | [
"func",
"(",
"t",
"*",
"Target",
")",
"addr",
"(",
")",
"string",
"{",
"if",
"t",
".",
"IP",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"IP",
",",
"t",
".",
"Port",
")",
"\n",
... | // addr returns the address string for the healthcheck target. | [
"addr",
"returns",
"the",
"address",
"string",
"for",
"the",
"healthcheck",
"target",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L100-L105 |
26,234 | google/seesaw | healthcheck/core.go | network | func (t *Target) network() string {
version := 4
if t.IP.To4() == nil {
version = 6
}
var network string
switch t.Proto {
case seesaw.IPProtoICMP:
network = "ip4:icmp"
case seesaw.IPProtoICMPv6:
network = "ip6:ipv6-icmp"
case seesaw.IPProtoTCP:
network = fmt.Sprintf("tcp%d", version)
case seesaw.IPPro... | go | func (t *Target) network() string {
version := 4
if t.IP.To4() == nil {
version = 6
}
var network string
switch t.Proto {
case seesaw.IPProtoICMP:
network = "ip4:icmp"
case seesaw.IPProtoICMPv6:
network = "ip6:ipv6-icmp"
case seesaw.IPProtoTCP:
network = fmt.Sprintf("tcp%d", version)
case seesaw.IPPro... | [
"func",
"(",
"t",
"*",
"Target",
")",
"network",
"(",
")",
"string",
"{",
"version",
":=",
"4",
"\n",
"if",
"t",
".",
"IP",
".",
"To4",
"(",
")",
"==",
"nil",
"{",
"version",
"=",
"6",
"\n",
"}",
"\n\n",
"var",
"network",
"string",
"\n",
"switc... | // network returns the network name for the healthcheck target. | [
"network",
"returns",
"the",
"network",
"name",
"for",
"the",
"healthcheck",
"target",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L108-L129 |
26,235 | google/seesaw | healthcheck/core.go | String | func (r *Result) String() string {
if r.Err != nil {
return r.Err.Error()
}
return r.Message
} | go | func (r *Result) String() string {
if r.Err != nil {
return r.Err.Error()
}
return r.Message
} | [
"func",
"(",
"r",
"*",
"Result",
")",
"String",
"(",
")",
"string",
"{",
"if",
"r",
".",
"Err",
"!=",
"nil",
"{",
"return",
"r",
".",
"Err",
".",
"Error",
"(",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"Message",
"\n",
"}"
] | // String returns the string representation of a healthcheck result. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"healthcheck",
"result",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L140-L145 |
26,236 | google/seesaw | healthcheck/core.go | complete | func complete(start time.Time, msg string, success bool, err error) *Result {
// TODO(jsing): Make this clock skew safe.
duration := time.Since(start)
return &Result{msg, success, duration, err}
} | go | func complete(start time.Time, msg string, success bool, err error) *Result {
// TODO(jsing): Make this clock skew safe.
duration := time.Since(start)
return &Result{msg, success, duration, err}
} | [
"func",
"complete",
"(",
"start",
"time",
".",
"Time",
",",
"msg",
"string",
",",
"success",
"bool",
",",
"err",
"error",
")",
"*",
"Result",
"{",
"// TODO(jsing): Make this clock skew safe.",
"duration",
":=",
"time",
".",
"Since",
"(",
"start",
")",
"\n",
... | // complete returns a Result for a completed healthcheck. | [
"complete",
"returns",
"a",
"Result",
"for",
"a",
"completed",
"healthcheck",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L148-L152 |
26,237 | google/seesaw | healthcheck/core.go | String | func (n *Notification) String() string {
return fmt.Sprintf("ID 0x%x %v", n.Id, n.State)
} | go | func (n *Notification) String() string {
return fmt.Sprintf("ID 0x%x %v", n.Id, n.State)
} | [
"func",
"(",
"n",
"*",
"Notification",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"n",
".",
"Id",
",",
"n",
".",
"State",
")",
"\n",
"}"
] | // String returns the string representation for the given notification. | [
"String",
"returns",
"the",
"string",
"representation",
"for",
"the",
"given",
"notification",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L161-L163 |
26,238 | google/seesaw | healthcheck/core.go | NewConfig | func NewConfig(id Id, checker Checker) *Config {
return &Config{
Id: id,
Interval: 5 * time.Second,
Timeout: 30 * time.Second,
Retries: 0,
Checker: checker,
}
} | go | func NewConfig(id Id, checker Checker) *Config {
return &Config{
Id: id,
Interval: 5 * time.Second,
Timeout: 30 * time.Second,
Retries: 0,
Checker: checker,
}
} | [
"func",
"NewConfig",
"(",
"id",
"Id",
",",
"checker",
"Checker",
")",
"*",
"Config",
"{",
"return",
"&",
"Config",
"{",
"Id",
":",
"id",
",",
"Interval",
":",
"5",
"*",
"time",
".",
"Second",
",",
"Timeout",
":",
"30",
"*",
"time",
".",
"Second",
... | // NewConfig returns an initialised Config. | [
"NewConfig",
"returns",
"an",
"initialised",
"Config",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L186-L194 |
26,239 | google/seesaw | healthcheck/core.go | NewCheck | func NewCheck(notify chan<- *Notification) *Check {
return &Check{
state: StateUnknown,
notify: notify,
update: make(chan Config, 1),
quit: make(chan bool, 1),
}
} | go | func NewCheck(notify chan<- *Notification) *Check {
return &Check{
state: StateUnknown,
notify: notify,
update: make(chan Config, 1),
quit: make(chan bool, 1),
}
} | [
"func",
"NewCheck",
"(",
"notify",
"chan",
"<-",
"*",
"Notification",
")",
"*",
"Check",
"{",
"return",
"&",
"Check",
"{",
"state",
":",
"StateUnknown",
",",
"notify",
":",
"notify",
",",
"update",
":",
"make",
"(",
"chan",
"Config",
",",
"1",
")",
"... | // NewCheck returns an initialised Check. | [
"NewCheck",
"returns",
"an",
"initialised",
"Check",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L225-L232 |
26,240 | google/seesaw | healthcheck/core.go | Status | func (hc *Check) Status() Status {
hc.lock.RLock()
defer hc.lock.RUnlock()
status := Status{
LastCheck: hc.start,
Failures: hc.failures,
Successes: hc.successes,
State: hc.state,
}
if hc.result != nil {
status.Duration = hc.result.Duration
status.Message = hc.result.String()
}
return status
} | go | func (hc *Check) Status() Status {
hc.lock.RLock()
defer hc.lock.RUnlock()
status := Status{
LastCheck: hc.start,
Failures: hc.failures,
Successes: hc.successes,
State: hc.state,
}
if hc.result != nil {
status.Duration = hc.result.Duration
status.Message = hc.result.String()
}
return status
} | [
"func",
"(",
"hc",
"*",
"Check",
")",
"Status",
"(",
")",
"Status",
"{",
"hc",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"hc",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"status",
":=",
"Status",
"{",
"LastCheck",
":",
"hc",
".",
"s... | // Status returns the current status for this healthcheck instance. | [
"Status",
"returns",
"the",
"current",
"status",
"for",
"this",
"healthcheck",
"instance",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L235-L249 |
26,241 | google/seesaw | healthcheck/core.go | Run | func (hc *Check) Run(start <-chan time.Time) {
// Wait for initial configuration.
select {
case config := <-hc.update:
hc.Config = config
case <-hc.quit:
return
}
// Wait for a tick to avoid a thundering herd at startup and to
// stagger healthchecks that have the same interval.
if start != nil {
<-star... | go | func (hc *Check) Run(start <-chan time.Time) {
// Wait for initial configuration.
select {
case config := <-hc.update:
hc.Config = config
case <-hc.quit:
return
}
// Wait for a tick to avoid a thundering herd at startup and to
// stagger healthchecks that have the same interval.
if start != nil {
<-star... | [
"func",
"(",
"hc",
"*",
"Check",
")",
"Run",
"(",
"start",
"<-",
"chan",
"time",
".",
"Time",
")",
"{",
"// Wait for initial configuration.",
"select",
"{",
"case",
"config",
":=",
"<-",
"hc",
".",
"update",
":",
"hc",
".",
"Config",
"=",
"config",
"\n... | // Run invokes a healthcheck. It waits for the initial configuration to be
// provided via the configuration channel, after which the configured
// healthchecker is invoked at the given interval. If a new configuration
// is provided the healthchecker is updated and checks are scheduled at the
// new interval. Notifica... | [
"Run",
"invokes",
"a",
"healthcheck",
".",
"It",
"waits",
"for",
"the",
"initial",
"configuration",
"to",
"be",
"provided",
"via",
"the",
"configuration",
"channel",
"after",
"which",
"the",
"configured",
"healthchecker",
"is",
"invoked",
"at",
"the",
"given",
... | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L258-L298 |
26,242 | google/seesaw | healthcheck/core.go | healthcheck | func (hc *Check) healthcheck() {
if hc.Checker == nil {
return
}
start := time.Now()
result := hc.execute()
status := "SUCCESS"
if !result.Success {
status = "FAILURE"
}
log.Infof("%d: (%s) %s: %v", hc.Id, hc, status, result)
hc.lock.Lock()
hc.start = start
hc.result = result
var state State
if res... | go | func (hc *Check) healthcheck() {
if hc.Checker == nil {
return
}
start := time.Now()
result := hc.execute()
status := "SUCCESS"
if !result.Success {
status = "FAILURE"
}
log.Infof("%d: (%s) %s: %v", hc.Id, hc, status, result)
hc.lock.Lock()
hc.start = start
hc.result = result
var state State
if res... | [
"func",
"(",
"hc",
"*",
"Check",
")",
"healthcheck",
"(",
")",
"{",
"if",
"hc",
".",
"Checker",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"result",
":=",
"hc",
".",
"execute",
"(",
")",
"\n\... | // healthcheck executes the given checker. | [
"healthcheck",
"executes",
"the",
"given",
"checker",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L301-L342 |
26,243 | google/seesaw | healthcheck/core.go | Notify | func (hc *Check) Notify() {
hc.notify <- &Notification{
Id: hc.Id,
Status: hc.Status(),
}
} | go | func (hc *Check) Notify() {
hc.notify <- &Notification{
Id: hc.Id,
Status: hc.Status(),
}
} | [
"func",
"(",
"hc",
"*",
"Check",
")",
"Notify",
"(",
")",
"{",
"hc",
".",
"notify",
"<-",
"&",
"Notification",
"{",
"Id",
":",
"hc",
".",
"Id",
",",
"Status",
":",
"hc",
".",
"Status",
"(",
")",
",",
"}",
"\n",
"}"
] | // Notify generates a healthcheck notification for this checker. | [
"Notify",
"generates",
"a",
"healthcheck",
"notification",
"for",
"this",
"checker",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L345-L350 |
26,244 | google/seesaw | healthcheck/core.go | execute | func (hc *Check) execute() *Result {
ch := make(chan *Result, 1)
checker := hc.Checker
go func() {
// TODO(jsing): Determine a way to ensure that this go routine
// does not linger.
ch <- checker.Check(hc.Timeout)
}()
select {
case result := <-ch:
return result
case <-time.After(hc.Timeout):
return &Re... | go | func (hc *Check) execute() *Result {
ch := make(chan *Result, 1)
checker := hc.Checker
go func() {
// TODO(jsing): Determine a way to ensure that this go routine
// does not linger.
ch <- checker.Check(hc.Timeout)
}()
select {
case result := <-ch:
return result
case <-time.After(hc.Timeout):
return &Re... | [
"func",
"(",
"hc",
"*",
"Check",
")",
"execute",
"(",
")",
"*",
"Result",
"{",
"ch",
":=",
"make",
"(",
"chan",
"*",
"Result",
",",
"1",
")",
"\n",
"checker",
":=",
"hc",
".",
"Checker",
"\n",
"go",
"func",
"(",
")",
"{",
"// TODO(jsing): Determine... | // execute invokes the given healthcheck checker with the configured timeout. | [
"execute",
"invokes",
"the",
"given",
"healthcheck",
"checker",
"with",
"the",
"configured",
"timeout",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L353-L367 |
26,245 | google/seesaw | healthcheck/core.go | Blocking | func (hc *Check) Blocking(block bool) {
len := 0
if !block {
len = 1
}
hc.blocking = block
hc.update = make(chan Config, len)
} | go | func (hc *Check) Blocking(block bool) {
len := 0
if !block {
len = 1
}
hc.blocking = block
hc.update = make(chan Config, len)
} | [
"func",
"(",
"hc",
"*",
"Check",
")",
"Blocking",
"(",
"block",
"bool",
")",
"{",
"len",
":=",
"0",
"\n",
"if",
"!",
"block",
"{",
"len",
"=",
"1",
"\n",
"}",
"\n",
"hc",
".",
"blocking",
"=",
"block",
"\n",
"hc",
".",
"update",
"=",
"make",
... | // Blocking enables or disables blocking updates for a healthcheck. | [
"Blocking",
"enables",
"or",
"disables",
"blocking",
"updates",
"for",
"a",
"healthcheck",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L378-L385 |
26,246 | google/seesaw | healthcheck/core.go | Update | func (hc *Check) Update(config *Config) {
if hc.blocking {
hc.update <- *config
return
}
select {
case hc.update <- *config:
default:
log.Warningf("Unable to update %d (%s), last update still queued", hc.Id, hc)
}
} | go | func (hc *Check) Update(config *Config) {
if hc.blocking {
hc.update <- *config
return
}
select {
case hc.update <- *config:
default:
log.Warningf("Unable to update %d (%s), last update still queued", hc.Id, hc)
}
} | [
"func",
"(",
"hc",
"*",
"Check",
")",
"Update",
"(",
"config",
"*",
"Config",
")",
"{",
"if",
"hc",
".",
"blocking",
"{",
"hc",
".",
"update",
"<-",
"*",
"config",
"\n",
"return",
"\n",
"}",
"\n",
"select",
"{",
"case",
"hc",
".",
"update",
"<-",... | // Update queues a healthcheck configuration update for processing. | [
"Update",
"queues",
"a",
"healthcheck",
"configuration",
"update",
"for",
"processing",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L388-L398 |
26,247 | google/seesaw | healthcheck/core.go | NewServer | func NewServer(cfg *ServerConfig) *Server {
if cfg == nil {
defaultCfg := DefaultServerConfig()
cfg = &defaultCfg
}
return &Server{
config: cfg,
healthchecks: make(map[Id]*Check),
notify: make(chan *Notification, cfg.ChannelSize),
configs: make(chan map[Id]*Config),
batch: make([]*No... | go | func NewServer(cfg *ServerConfig) *Server {
if cfg == nil {
defaultCfg := DefaultServerConfig()
cfg = &defaultCfg
}
return &Server{
config: cfg,
healthchecks: make(map[Id]*Check),
notify: make(chan *Notification, cfg.ChannelSize),
configs: make(chan map[Id]*Config),
batch: make([]*No... | [
"func",
"NewServer",
"(",
"cfg",
"*",
"ServerConfig",
")",
"*",
"Server",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"defaultCfg",
":=",
"DefaultServerConfig",
"(",
")",
"\n",
"cfg",
"=",
"&",
"defaultCfg",
"\n",
"}",
"\n",
"return",
"&",
"Server",
"{",
"conf... | // NewServer returns an initialised healthcheck server. | [
"NewServer",
"returns",
"an",
"initialised",
"healthcheck",
"server",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L439-L454 |
26,248 | google/seesaw | healthcheck/core.go | Run | func (s *Server) Run() {
go s.updater()
go s.notifier()
go s.manager()
<-s.quit
} | go | func (s *Server) Run() {
go s.updater()
go s.notifier()
go s.manager()
<-s.quit
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Run",
"(",
")",
"{",
"go",
"s",
".",
"updater",
"(",
")",
"\n",
"go",
"s",
".",
"notifier",
"(",
")",
"\n",
"go",
"s",
".",
"manager",
"(",
")",
"\n\n",
"<-",
"s",
".",
"quit",
"\n",
"}"
] | // Run runs a healthcheck server. | [
"Run",
"runs",
"a",
"healthcheck",
"server",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L465-L471 |
26,249 | google/seesaw | healthcheck/core.go | getHealthchecks | func (s *Server) getHealthchecks() (*Checks, error) {
engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout)
if err != nil {
return nil, fmt.Errorf("Dial failed: %v", err)
}
engineConn.SetDeadline(time.Now().Add(engineTimeout))
engine := rpc.NewClient(engineConn)
defer engine.Close()
... | go | func (s *Server) getHealthchecks() (*Checks, error) {
engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout)
if err != nil {
return nil, fmt.Errorf("Dial failed: %v", err)
}
engineConn.SetDeadline(time.Now().Add(engineTimeout))
engine := rpc.NewClient(engineConn)
defer engine.Close()
... | [
"func",
"(",
"s",
"*",
"Server",
")",
"getHealthchecks",
"(",
")",
"(",
"*",
"Checks",
",",
"error",
")",
"{",
"engineConn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"s",
".",
"config",
".",
"EngineSocket",
",",
"engineTimeo... | // getHealthchecks attempts to get the current healthcheck configurations from
// the Seesaw Engine. | [
"getHealthchecks",
"attempts",
"to",
"get",
"the",
"current",
"healthcheck",
"configurations",
"from",
"the",
"Seesaw",
"Engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L475-L491 |
26,250 | google/seesaw | healthcheck/core.go | updater | func (s *Server) updater() {
for {
log.Info("Getting healthchecks from engine...")
checks, err := s.getHealthchecks()
if err != nil {
log.Error(err)
time.Sleep(5 * time.Second)
} else {
log.Infof("Engine returned %d healthchecks", len(checks.Configs))
s.configs <- checks.Configs
time.Sleep(15 * ... | go | func (s *Server) updater() {
for {
log.Info("Getting healthchecks from engine...")
checks, err := s.getHealthchecks()
if err != nil {
log.Error(err)
time.Sleep(5 * time.Second)
} else {
log.Infof("Engine returned %d healthchecks", len(checks.Configs))
s.configs <- checks.Configs
time.Sleep(15 * ... | [
"func",
"(",
"s",
"*",
"Server",
")",
"updater",
"(",
")",
"{",
"for",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"checks",
",",
"err",
":=",
"s",
".",
"getHealthchecks",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"E... | // updater attempts to fetch healthcheck configurations at regular intervals.
// When configurations are successfully retrieved they are provided to the
// manager via the configs channel. | [
"updater",
"attempts",
"to",
"fetch",
"healthcheck",
"configurations",
"at",
"regular",
"intervals",
".",
"When",
"configurations",
"are",
"successfully",
"retrieved",
"they",
"are",
"provided",
"to",
"the",
"manager",
"via",
"the",
"configs",
"channel",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L496-L509 |
26,251 | google/seesaw | healthcheck/core.go | manager | func (s *Server) manager() {
checkTicker := time.NewTicker(50 * time.Millisecond)
notifyTicker := time.NewTicker(s.config.NotifyInterval)
for {
select {
case configs := <-s.configs:
// Remove healthchecks that have been deleted.
for id, hc := range s.healthchecks {
if configs[id] == nil {
hc.Stop... | go | func (s *Server) manager() {
checkTicker := time.NewTicker(50 * time.Millisecond)
notifyTicker := time.NewTicker(s.config.NotifyInterval)
for {
select {
case configs := <-s.configs:
// Remove healthchecks that have been deleted.
for id, hc := range s.healthchecks {
if configs[id] == nil {
hc.Stop... | [
"func",
"(",
"s",
"*",
"Server",
")",
"manager",
"(",
")",
"{",
"checkTicker",
":=",
"time",
".",
"NewTicker",
"(",
"50",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"notifyTicker",
":=",
"time",
".",
"NewTicker",
"(",
"s",
".",
"config",
".",
"Notif... | // manager is responsible for controlling the healthchecks that are currently
// running. When healthcheck configurations become available, the manager will
// stop and remove deleted healthchecks, spawn new healthchecks and provide
// the current configurations to each of the running healthchecks. | [
"manager",
"is",
"responsible",
"for",
"controlling",
"the",
"healthchecks",
"that",
"are",
"currently",
"running",
".",
"When",
"healthcheck",
"configurations",
"become",
"available",
"the",
"manager",
"will",
"stop",
"and",
"remove",
"deleted",
"healthchecks",
"sp... | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L515-L550 |
26,252 | google/seesaw | healthcheck/core.go | notifier | func (s *Server) notifier() {
var timer <-chan time.Time
for {
var err error
select {
case notification := <-s.notify:
s.batch = append(s.batch, notification)
// Collect until BatchDelay passes, or BatchSize are queued.
switch len(s.batch) {
case 1:
timer = time.After(s.config.BatchDelay)
cas... | go | func (s *Server) notifier() {
var timer <-chan time.Time
for {
var err error
select {
case notification := <-s.notify:
s.batch = append(s.batch, notification)
// Collect until BatchDelay passes, or BatchSize are queued.
switch len(s.batch) {
case 1:
timer = time.After(s.config.BatchDelay)
cas... | [
"func",
"(",
"s",
"*",
"Server",
")",
"notifier",
"(",
")",
"{",
"var",
"timer",
"<-",
"chan",
"time",
".",
"Time",
"\n",
"for",
"{",
"var",
"err",
"error",
"\n",
"select",
"{",
"case",
"notification",
":=",
"<-",
"s",
".",
"notify",
":",
"s",
".... | // notifier batches healthcheck notifications and sends them to the Seesaw
// Engine. | [
"notifier",
"batches",
"healthcheck",
"notifications",
"and",
"sends",
"them",
"to",
"the",
"Seesaw",
"Engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L554-L578 |
26,253 | google/seesaw | healthcheck/core.go | send | func (s *Server) send() error {
failures := 0
for {
err := s.sendBatch(s.batch)
if err == nil {
break
}
failures++
log.Errorf("Send failed %d times: %v", failures, err)
if failures >= s.config.MaxFailures {
return fmt.Errorf("send: %d errors, giving up", failures)
}
time.Sleep(s.config.RetryDe... | go | func (s *Server) send() error {
failures := 0
for {
err := s.sendBatch(s.batch)
if err == nil {
break
}
failures++
log.Errorf("Send failed %d times: %v", failures, err)
if failures >= s.config.MaxFailures {
return fmt.Errorf("send: %d errors, giving up", failures)
}
time.Sleep(s.config.RetryDe... | [
"func",
"(",
"s",
"*",
"Server",
")",
"send",
"(",
")",
"error",
"{",
"failures",
":=",
"0",
"\n",
"for",
"{",
"err",
":=",
"s",
".",
"sendBatch",
"(",
"s",
".",
"batch",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n\n",
"... | // send sends a batch of notifications to the Seesaw Engine, retrying on any
// error and giving up after MaxFailures. | [
"send",
"sends",
"a",
"batch",
"of",
"notifications",
"to",
"the",
"Seesaw",
"Engine",
"retrying",
"on",
"any",
"error",
"and",
"giving",
"up",
"after",
"MaxFailures",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L582-L601 |
26,254 | google/seesaw | healthcheck/core.go | sendBatch | func (s *Server) sendBatch(batch []*Notification) error {
engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout)
if err != nil {
return err
}
engineConn.SetDeadline(time.Now().Add(engineTimeout))
engine := rpc.NewClient(engineConn)
defer engine.Close()
var reply int
ctx := ipc.NewTr... | go | func (s *Server) sendBatch(batch []*Notification) error {
engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout)
if err != nil {
return err
}
engineConn.SetDeadline(time.Now().Add(engineTimeout))
engine := rpc.NewClient(engineConn)
defer engine.Close()
var reply int
ctx := ipc.NewTr... | [
"func",
"(",
"s",
"*",
"Server",
")",
"sendBatch",
"(",
"batch",
"[",
"]",
"*",
"Notification",
")",
"error",
"{",
"engineConn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"s",
".",
"config",
".",
"EngineSocket",
",",
"engineT... | // sendBatch sends a batch of notifications to the Seesaw Engine. | [
"sendBatch",
"sends",
"a",
"batch",
"of",
"notifications",
"to",
"the",
"Seesaw",
"Engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L604-L616 |
26,255 | google/seesaw | ecu/stats.go | newECUStats | func newECUStats(ecu *ECU) *ecuStats {
return &ecuStats{
ecu: ecu,
stats: &stats{
lastUpdate: time.Unix(0, 0),
lastSuccess: time.Unix(0, 0),
},
}
} | go | func newECUStats(ecu *ECU) *ecuStats {
return &ecuStats{
ecu: ecu,
stats: &stats{
lastUpdate: time.Unix(0, 0),
lastSuccess: time.Unix(0, 0),
},
}
} | [
"func",
"newECUStats",
"(",
"ecu",
"*",
"ECU",
")",
"*",
"ecuStats",
"{",
"return",
"&",
"ecuStats",
"{",
"ecu",
":",
"ecu",
",",
"stats",
":",
"&",
"stats",
"{",
"lastUpdate",
":",
"time",
".",
"Unix",
"(",
"0",
",",
"0",
")",
",",
"lastSuccess",
... | // newECUStats returns an initialised ecuStats struct. | [
"newECUStats",
"returns",
"an",
"initialised",
"ecuStats",
"struct",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L63-L71 |
26,256 | google/seesaw | ecu/stats.go | notify | func (e *ecuStats) notify(p publisher) {
e.publishers = append(e.publishers, p)
} | go | func (e *ecuStats) notify(p publisher) {
e.publishers = append(e.publishers, p)
} | [
"func",
"(",
"e",
"*",
"ecuStats",
")",
"notify",
"(",
"p",
"publisher",
")",
"{",
"e",
".",
"publishers",
"=",
"append",
"(",
"e",
".",
"publishers",
",",
"p",
")",
"\n",
"}"
] | // notify registers a publisher for update notifications. | [
"notify",
"registers",
"a",
"publisher",
"for",
"update",
"notifications",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L74-L76 |
26,257 | google/seesaw | ecu/stats.go | run | func (e *ecuStats) run() {
ticker := time.NewTicker(e.ecu.cfg.UpdateInterval)
for {
e.stats.lock.Lock()
e.stats.lastUpdate = time.Now()
e.stats.lock.Unlock()
log.Info("Updating ECU statistics from Seesaw Engine...")
if err := e.update(); err != nil {
log.Warning(err)
} else {
e.stats.lock.Lock()
... | go | func (e *ecuStats) run() {
ticker := time.NewTicker(e.ecu.cfg.UpdateInterval)
for {
e.stats.lock.Lock()
e.stats.lastUpdate = time.Now()
e.stats.lock.Unlock()
log.Info("Updating ECU statistics from Seesaw Engine...")
if err := e.update(); err != nil {
log.Warning(err)
} else {
e.stats.lock.Lock()
... | [
"func",
"(",
"e",
"*",
"ecuStats",
")",
"run",
"(",
")",
"{",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"e",
".",
"ecu",
".",
"cfg",
".",
"UpdateInterval",
")",
"\n",
"for",
"{",
"e",
".",
"stats",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",... | // run attempts to update the cached statistics from the Seesaw Engine at
// regular intervals. | [
"run",
"attempts",
"to",
"update",
"the",
"cached",
"statistics",
"from",
"the",
"Seesaw",
"Engine",
"at",
"regular",
"intervals",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L80-L100 |
26,258 | google/seesaw | ecu/stats.go | update | func (e *ecuStats) update() error {
// TODO(jsing): Make this untrusted.
ctx := ipc.NewTrustedContext(seesaw.SCECU)
seesawConn, err := conn.NewSeesawIPC(ctx)
if err != nil {
return fmt.Errorf("Failed to connect to engine: %v", err)
}
if err := seesawConn.Dial(e.ecu.cfg.EngineSocket); err != nil {
return fmt.E... | go | func (e *ecuStats) update() error {
// TODO(jsing): Make this untrusted.
ctx := ipc.NewTrustedContext(seesaw.SCECU)
seesawConn, err := conn.NewSeesawIPC(ctx)
if err != nil {
return fmt.Errorf("Failed to connect to engine: %v", err)
}
if err := seesawConn.Dial(e.ecu.cfg.EngineSocket); err != nil {
return fmt.E... | [
"func",
"(",
"e",
"*",
"ecuStats",
")",
"update",
"(",
")",
"error",
"{",
"// TODO(jsing): Make this untrusted.",
"ctx",
":=",
"ipc",
".",
"NewTrustedContext",
"(",
"seesaw",
".",
"SCECU",
")",
"\n",
"seesawConn",
",",
"err",
":=",
"conn",
".",
"NewSeesawIPC... | // update attempts to update the cached statistics from the Seesaw Engine. | [
"update",
"attempts",
"to",
"update",
"the",
"cached",
"statistics",
"from",
"the",
"Seesaw",
"Engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L103-L164 |
26,259 | google/seesaw | engine/healthcheck.go | newHealthcheckManager | func newHealthcheckManager(e *Engine) *healthcheckManager {
return &healthcheckManager{
engine: e,
marks: make(map[seesaw.IP]uint32),
markAlloc: newMarkAllocator(dsrMarkBase, dsrMarkSize),
ncc: ncclient.NewNCC(e.config.NCCSocket),
next: healthcheck.Id((uint64(os.Getpid()... | go | func newHealthcheckManager(e *Engine) *healthcheckManager {
return &healthcheckManager{
engine: e,
marks: make(map[seesaw.IP]uint32),
markAlloc: newMarkAllocator(dsrMarkBase, dsrMarkSize),
ncc: ncclient.NewNCC(e.config.NCCSocket),
next: healthcheck.Id((uint64(os.Getpid()... | [
"func",
"newHealthcheckManager",
"(",
"e",
"*",
"Engine",
")",
"*",
"healthcheckManager",
"{",
"return",
"&",
"healthcheckManager",
"{",
"engine",
":",
"e",
",",
"marks",
":",
"make",
"(",
"map",
"[",
"seesaw",
".",
"IP",
"]",
"uint32",
")",
",",
"markAl... | // newHealthcheckManager creates a new healthcheckManager. | [
"newHealthcheckManager",
"creates",
"a",
"new",
"healthcheckManager",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L68-L80 |
26,260 | google/seesaw | engine/healthcheck.go | configs | func (h *healthcheckManager) configs() map[healthcheck.Id]*healthcheck.Config {
h.lock.RLock()
defer h.lock.RUnlock()
if !h.enabled {
return nil
}
return h.cfgs
} | go | func (h *healthcheckManager) configs() map[healthcheck.Id]*healthcheck.Config {
h.lock.RLock()
defer h.lock.RUnlock()
if !h.enabled {
return nil
}
return h.cfgs
} | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"configs",
"(",
")",
"map",
"[",
"healthcheck",
".",
"Id",
"]",
"*",
"healthcheck",
".",
"Config",
"{",
"h",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"h",
".",
"lock",
".",
"RUnlock",
"("... | // configs returns the healthcheck Configs for a Seesaw Engine. The returned
// map should only be read, not mutated. If the healthcheckManager is disabled,
// then nil is returned. | [
"configs",
"returns",
"the",
"healthcheck",
"Configs",
"for",
"a",
"Seesaw",
"Engine",
".",
"The",
"returned",
"map",
"should",
"only",
"be",
"read",
"not",
"mutated",
".",
"If",
"the",
"healthcheckManager",
"is",
"disabled",
"then",
"nil",
"is",
"returned",
... | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L85-L92 |
26,261 | google/seesaw | engine/healthcheck.go | update | func (h *healthcheckManager) update(vserverName string, checks map[checkKey]*check) {
if checks == nil {
delete(h.vserverChecks, vserverName)
} else {
h.vserverChecks[vserverName] = checks
}
h.buildMaps()
} | go | func (h *healthcheckManager) update(vserverName string, checks map[checkKey]*check) {
if checks == nil {
delete(h.vserverChecks, vserverName)
} else {
h.vserverChecks[vserverName] = checks
}
h.buildMaps()
} | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"update",
"(",
"vserverName",
"string",
",",
"checks",
"map",
"[",
"checkKey",
"]",
"*",
"check",
")",
"{",
"if",
"checks",
"==",
"nil",
"{",
"delete",
"(",
"h",
".",
"vserverChecks",
",",
"vserverName",
... | // update updates the healthchecks for a vserver. | [
"update",
"updates",
"the",
"healthchecks",
"for",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L95-L102 |
26,262 | google/seesaw | engine/healthcheck.go | enable | func (h *healthcheckManager) enable() {
h.lock.Lock()
defer h.lock.Unlock()
h.enabled = true
} | go | func (h *healthcheckManager) enable() {
h.lock.Lock()
defer h.lock.Unlock()
h.enabled = true
} | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"enable",
"(",
")",
"{",
"h",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"h",
".",
"enabled",
"=",
"true",
"\n",
"}"
] | // enable enables the healthcheck manager for the Seesaw Engine. | [
"enable",
"enables",
"the",
"healthcheck",
"manager",
"for",
"the",
"Seesaw",
"Engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L105-L109 |
26,263 | google/seesaw | engine/healthcheck.go | disable | func (h *healthcheckManager) disable() {
h.lock.Lock()
defer h.lock.Unlock()
h.enabled = false
} | go | func (h *healthcheckManager) disable() {
h.lock.Lock()
defer h.lock.Unlock()
h.enabled = false
} | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"disable",
"(",
")",
"{",
"h",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"h",
".",
"enabled",
"=",
"false",
"\n",
"}"
] | // disable disables the healthcheck manager for the Seesaw Engine. | [
"disable",
"disables",
"the",
"healthcheck",
"manager",
"for",
"the",
"Seesaw",
"Engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L112-L116 |
26,264 | google/seesaw | engine/healthcheck.go | buildMaps | func (h *healthcheckManager) buildMaps() {
allChecks := make(map[checkKey]*check)
for _, vchecks := range h.vserverChecks {
for k, c := range vchecks {
if allChecks[k] == nil {
allChecks[k] = c
} else {
log.Warningf("Duplicate key: %v", k)
}
}
}
h.lock.RLock()
ids := h.ids
cfgs := h.cfgs
ch... | go | func (h *healthcheckManager) buildMaps() {
allChecks := make(map[checkKey]*check)
for _, vchecks := range h.vserverChecks {
for k, c := range vchecks {
if allChecks[k] == nil {
allChecks[k] = c
} else {
log.Warningf("Duplicate key: %v", k)
}
}
}
h.lock.RLock()
ids := h.ids
cfgs := h.cfgs
ch... | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"buildMaps",
"(",
")",
"{",
"allChecks",
":=",
"make",
"(",
"map",
"[",
"checkKey",
"]",
"*",
"check",
")",
"\n",
"for",
"_",
",",
"vchecks",
":=",
"range",
"h",
".",
"vserverChecks",
"{",
"for",
"k",... | // buildMaps builds the cfgs, checks, and ids maps based on the vserverChecks. | [
"buildMaps",
"builds",
"the",
"cfgs",
"checks",
"and",
"ids",
"maps",
"based",
"on",
"the",
"vserverChecks",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L125-L177 |
26,265 | google/seesaw | engine/healthcheck.go | healthState | func (h *healthcheckManager) healthState(n *healthcheck.Notification) error {
log.V(1).Infof("Received healthcheck notification: %v", n)
h.lock.RLock()
enabled := h.enabled
h.lock.RUnlock()
if !enabled {
log.Warningf("Healthcheck manager is disabled; ignoring healthcheck notification %v", n)
return nil
}
... | go | func (h *healthcheckManager) healthState(n *healthcheck.Notification) error {
log.V(1).Infof("Received healthcheck notification: %v", n)
h.lock.RLock()
enabled := h.enabled
h.lock.RUnlock()
if !enabled {
log.Warningf("Healthcheck manager is disabled; ignoring healthcheck notification %v", n)
return nil
}
... | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"healthState",
"(",
"n",
"*",
"healthcheck",
".",
"Notification",
")",
"error",
"{",
"log",
".",
"V",
"(",
"1",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"n",
")",
"\n\n",
"h",
".",
"lock",
".",
"R... | // healthState handles Notifications from the healthcheck component. | [
"healthState",
"handles",
"Notifications",
"from",
"the",
"healthcheck",
"component",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L180-L195 |
26,266 | google/seesaw | engine/healthcheck.go | queueHealthState | func (h *healthcheckManager) queueHealthState(n *healthcheck.Notification) error {
h.lock.RLock()
cfg := h.cfgs[n.Id]
check := h.checks[n.Id]
h.lock.RUnlock()
if cfg == nil || check == nil {
log.Warningf("Unknown healthcheck ID %v", n.Id)
return nil
}
note := &checkNotification{
key: check.key,
... | go | func (h *healthcheckManager) queueHealthState(n *healthcheck.Notification) error {
h.lock.RLock()
cfg := h.cfgs[n.Id]
check := h.checks[n.Id]
h.lock.RUnlock()
if cfg == nil || check == nil {
log.Warningf("Unknown healthcheck ID %v", n.Id)
return nil
}
note := &checkNotification{
key: check.key,
... | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"queueHealthState",
"(",
"n",
"*",
"healthcheck",
".",
"Notification",
")",
"error",
"{",
"h",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"cfg",
":=",
"h",
".",
"cfgs",
"[",
"n",
".",
"Id",
"]",
"\n... | // queueHealthState queues a health state Notification for processing by a
// vserver. | [
"queueHealthState",
"queues",
"a",
"health",
"state",
"Notification",
"for",
"processing",
"by",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L199-L218 |
26,267 | google/seesaw | engine/healthcheck.go | run | func (h *healthcheckManager) run() {
for {
select {
case <-h.quit:
h.unmarkAllBackends()
h.stopped <- true
case vc := <-h.vcc:
h.update(vc.vserverName, vc.checks)
}
}
} | go | func (h *healthcheckManager) run() {
for {
select {
case <-h.quit:
h.unmarkAllBackends()
h.stopped <- true
case vc := <-h.vcc:
h.update(vc.vserverName, vc.checks)
}
}
} | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"run",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"h",
".",
"quit",
":",
"h",
".",
"unmarkAllBackends",
"(",
")",
"\n",
"h",
".",
"stopped",
"<-",
"true",
"\n",
"case",
"vc",
":=",
"<... | // run runs the healthcheck manager and processes incoming vserver checks. | [
"run",
"runs",
"the",
"healthcheck",
"manager",
"and",
"processes",
"incoming",
"vserver",
"checks",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L345-L355 |
26,268 | google/seesaw | engine/healthcheck.go | expire | func (h *healthcheckManager) expire() {
h.lock.RLock()
ids := h.ids
h.lock.RUnlock()
status := healthcheck.Status{State: healthcheck.StateUnknown}
for _, id := range ids {
h.queueHealthState(&healthcheck.Notification{id, status})
}
} | go | func (h *healthcheckManager) expire() {
h.lock.RLock()
ids := h.ids
h.lock.RUnlock()
status := healthcheck.Status{State: healthcheck.StateUnknown}
for _, id := range ids {
h.queueHealthState(&healthcheck.Notification{id, status})
}
} | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"expire",
"(",
")",
"{",
"h",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"ids",
":=",
"h",
".",
"ids",
"\n",
"h",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"status",
":=",
"healthcheck",
".",... | // expire invalidates the state of all configured healthchecks. | [
"expire",
"invalidates",
"the",
"state",
"of",
"all",
"configured",
"healthchecks",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L358-L367 |
26,269 | google/seesaw | engine/healthcheck.go | markBackend | func (h *healthcheckManager) markBackend(backend seesaw.IP) uint32 {
mark, ok := h.marks[backend]
if ok {
return mark
}
mark, err := h.markAlloc.get()
if err != nil {
log.Fatalf("Failed to get mark: %v", err)
}
h.marks[backend] = mark
ip := net.IPv6zero
if backend.AF() == seesaw.IPv4 {
ip = net.IPv4zer... | go | func (h *healthcheckManager) markBackend(backend seesaw.IP) uint32 {
mark, ok := h.marks[backend]
if ok {
return mark
}
mark, err := h.markAlloc.get()
if err != nil {
log.Fatalf("Failed to get mark: %v", err)
}
h.marks[backend] = mark
ip := net.IPv6zero
if backend.AF() == seesaw.IPv4 {
ip = net.IPv4zer... | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"markBackend",
"(",
"backend",
"seesaw",
".",
"IP",
")",
"uint32",
"{",
"mark",
",",
"ok",
":=",
"h",
".",
"marks",
"[",
"backend",
"]",
"\n",
"if",
"ok",
"{",
"return",
"mark",
"\n",
"}",
"\n\n",
"... | // markBackend returns a mark for the specified backend and sets up the IPVS
// service entry if it does not exist. | [
"markBackend",
"returns",
"a",
"mark",
"for",
"the",
"specified",
"backend",
"and",
"sets",
"up",
"the",
"IPVS",
"service",
"entry",
"if",
"it",
"does",
"not",
"exist",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L371-L415 |
26,270 | google/seesaw | engine/healthcheck.go | pruneMarks | func (h *healthcheckManager) pruneMarks() {
h.lock.RLock()
checks := h.checks
h.lock.RUnlock()
backends := make(map[seesaw.IP]bool)
for _, check := range checks {
if check.key.healthcheckMode != seesaw.HCModeDSR {
continue
}
backends[check.key.backendIP] = true
}
for ip := range h.marks {
if _, ok :... | go | func (h *healthcheckManager) pruneMarks() {
h.lock.RLock()
checks := h.checks
h.lock.RUnlock()
backends := make(map[seesaw.IP]bool)
for _, check := range checks {
if check.key.healthcheckMode != seesaw.HCModeDSR {
continue
}
backends[check.key.backendIP] = true
}
for ip := range h.marks {
if _, ok :... | [
"func",
"(",
"h",
"*",
"healthcheckManager",
")",
"pruneMarks",
"(",
")",
"{",
"h",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"checks",
":=",
"h",
".",
"checks",
"\n",
"h",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"backends",
":=",
"make",
... | // pruneMarks unmarks backends that no longer have DSR healthchecks configured. | [
"pruneMarks",
"unmarks",
"backends",
"that",
"no",
"longer",
"have",
"DSR",
"healthchecks",
"configured",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L461-L479 |
26,271 | google/seesaw | engine/config/notifier.go | NewNotifier | func NewNotifier(ec *EngineConfig) (*Notifier, error) {
outgoing := make(chan Notification, 1)
n := &Notifier{
C: outgoing,
outgoing: outgoing,
reload: make(chan bool, 1),
shutdown: make(chan bool, 1),
engineCfg: ec,
source: SourcePeer,
}
note, err := n.bootstrap()
if err != nil {
re... | go | func NewNotifier(ec *EngineConfig) (*Notifier, error) {
outgoing := make(chan Notification, 1)
n := &Notifier{
C: outgoing,
outgoing: outgoing,
reload: make(chan bool, 1),
shutdown: make(chan bool, 1),
engineCfg: ec,
source: SourcePeer,
}
note, err := n.bootstrap()
if err != nil {
re... | [
"func",
"NewNotifier",
"(",
"ec",
"*",
"EngineConfig",
")",
"(",
"*",
"Notifier",
",",
"error",
")",
"{",
"outgoing",
":=",
"make",
"(",
"chan",
"Notification",
",",
"1",
")",
"\n",
"n",
":=",
"&",
"Notifier",
"{",
"C",
":",
"outgoing",
",",
"outgoin... | // NewNotifier creates a new Notifier. | [
"NewNotifier",
"creates",
"a",
"new",
"Notifier",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L57-L88 |
26,272 | google/seesaw | engine/config/notifier.go | Source | func (n *Notifier) Source() Source {
n.lock.RLock()
defer n.lock.RUnlock()
return n.source
} | go | func (n *Notifier) Source() Source {
n.lock.RLock()
defer n.lock.RUnlock()
return n.source
} | [
"func",
"(",
"n",
"*",
"Notifier",
")",
"Source",
"(",
")",
"Source",
"{",
"n",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"n",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"n",
".",
"source",
"\n",
"}"
] | // Source returns the current configuration source. | [
"Source",
"returns",
"the",
"current",
"configuration",
"source",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L91-L95 |
26,273 | google/seesaw | engine/config/notifier.go | SetSource | func (n *Notifier) SetSource(source Source) {
n.lock.Lock()
n.source = source
n.lock.Unlock()
if err := n.Reload(); err != nil {
log.Warningf("Reload failed after setting source: %v", err)
}
} | go | func (n *Notifier) SetSource(source Source) {
n.lock.Lock()
n.source = source
n.lock.Unlock()
if err := n.Reload(); err != nil {
log.Warningf("Reload failed after setting source: %v", err)
}
} | [
"func",
"(",
"n",
"*",
"Notifier",
")",
"SetSource",
"(",
"source",
"Source",
")",
"{",
"n",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"n",
".",
"source",
"=",
"source",
"\n",
"n",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"err",
":=",
... | // SetSource sets the configuration Source for a Notifier. | [
"SetSource",
"sets",
"the",
"configuration",
"Source",
"for",
"a",
"Notifier",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L98-L105 |
26,274 | google/seesaw | engine/config/notifier.go | Reload | func (n *Notifier) Reload() error {
select {
case n.reload <- true:
default:
return errors.New("reload request already queued")
}
return nil
} | go | func (n *Notifier) Reload() error {
select {
case n.reload <- true:
default:
return errors.New("reload request already queued")
}
return nil
} | [
"func",
"(",
"n",
"*",
"Notifier",
")",
"Reload",
"(",
")",
"error",
"{",
"select",
"{",
"case",
"n",
".",
"reload",
"<-",
"true",
":",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
... | // Reload requests an immediate reload from the configuration source. | [
"Reload",
"requests",
"an",
"immediate",
"reload",
"from",
"the",
"configuration",
"source",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L108-L115 |
26,275 | google/seesaw | engine/config/notifier.go | configCheck | func (n *Notifier) configCheck() {
log.Infof("Checking for config changes...")
s := n.Source()
last := n.last
note, err := n.pullConfig(s)
if err != nil && s == SourcePeer {
log.Errorf("Failed to pull configuration from peer: %v", err)
n.peerFailures++
if n.peerFailures < n.engineCfg.MaxPeerConfigSyncErrors... | go | func (n *Notifier) configCheck() {
log.Infof("Checking for config changes...")
s := n.Source()
last := n.last
note, err := n.pullConfig(s)
if err != nil && s == SourcePeer {
log.Errorf("Failed to pull configuration from peer: %v", err)
n.peerFailures++
if n.peerFailures < n.engineCfg.MaxPeerConfigSyncErrors... | [
"func",
"(",
"n",
"*",
"Notifier",
")",
"configCheck",
"(",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"s",
":=",
"n",
".",
"Source",
"(",
")",
"\n",
"last",
":=",
"n",
".",
"last",
"\n",
"note",
",",
"err",
":=",
"n",
".",
... | // configCheck checks for configuration changes. | [
"configCheck",
"checks",
"for",
"configuration",
"changes",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L138-L194 |
26,276 | google/seesaw | common/conn/conn.go | RegisterEngineConn | func RegisterEngineConn(connType string, connFunc func(ctx *ipc.Context) EngineConn) {
engineConns[connType] = connFunc
} | go | func RegisterEngineConn(connType string, connFunc func(ctx *ipc.Context) EngineConn) {
engineConns[connType] = connFunc
} | [
"func",
"RegisterEngineConn",
"(",
"connType",
"string",
",",
"connFunc",
"func",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
")",
"EngineConn",
")",
"{",
"engineConns",
"[",
"connType",
"]",
"=",
"connFunc",
"\n",
"}"
] | // RegisterEngineConn registers the given connection type. | [
"RegisterEngineConn",
"registers",
"the",
"given",
"connection",
"type",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/conn.go#L59-L61 |
26,277 | google/seesaw | common/conn/conn.go | NewSeesawIPC | func NewSeesawIPC(ctx *ipc.Context) (*Seesaw, error) {
if newConn, ok := engineConns["ipc"]; ok {
return &Seesaw{newConn(ctx)}, nil
}
return nil, errors.New("No Seesaw IPC connection type registered")
} | go | func NewSeesawIPC(ctx *ipc.Context) (*Seesaw, error) {
if newConn, ok := engineConns["ipc"]; ok {
return &Seesaw{newConn(ctx)}, nil
}
return nil, errors.New("No Seesaw IPC connection type registered")
} | [
"func",
"NewSeesawIPC",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
")",
"(",
"*",
"Seesaw",
",",
"error",
")",
"{",
"if",
"newConn",
",",
"ok",
":=",
"engineConns",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"return",
"&",
"Seesaw",
"{",
"newConn",
"(",
... | // NewSeesawIPC returns a new Seesaw IPC connection. | [
"NewSeesawIPC",
"returns",
"a",
"new",
"Seesaw",
"IPC",
"connection",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/conn.go#L69-L74 |
26,278 | google/seesaw | binaries/seesaw_watchdog/main.go | svcOpt | func svcOpt(cfg *conf.ConfigFile, service, option string, required bool) string {
// TODO(jsing): Add support for defaults.
opt := cfgOpt(cfg, service, option)
if opt == "" && required {
log.Fatalf("Service %s has missing %s option", service, option)
}
return opt
} | go | func svcOpt(cfg *conf.ConfigFile, service, option string, required bool) string {
// TODO(jsing): Add support for defaults.
opt := cfgOpt(cfg, service, option)
if opt == "" && required {
log.Fatalf("Service %s has missing %s option", service, option)
}
return opt
} | [
"func",
"svcOpt",
"(",
"cfg",
"*",
"conf",
".",
"ConfigFile",
",",
"service",
",",
"option",
"string",
",",
"required",
"bool",
")",
"string",
"{",
"// TODO(jsing): Add support for defaults.",
"opt",
":=",
"cfgOpt",
"(",
"cfg",
",",
"service",
",",
"option",
... | // svcOpt returns the specified configuration option for a service. | [
"svcOpt",
"returns",
"the",
"specified",
"configuration",
"option",
"for",
"a",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/binaries/seesaw_watchdog/main.go#L53-L60 |
26,279 | google/seesaw | engine/ipc.go | Failover | func (s *SeesawEngine) Failover(ctx *ipc.Context, reply *int) error {
s.trace("Failover", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
return s.engine.haManager.requestFailover(false)
} | go | func (s *SeesawEngine) Failover(ctx *ipc.Context, reply *int) error {
s.trace("Failover", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
return s.engine.haManager.requestFailover(false)
} | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"Failover",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
",",
"reply",
"*",
"int",
")",
"error",
"{",
"s",
".",
"trace",
"(",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"if",
"ctx",
"==",
"nil",
"{",
"return",
"er... | // Failover requests the Seesaw Engine to relinquish master state. | [
"Failover",
"requests",
"the",
"Seesaw",
"Engine",
"to",
"relinquish",
"master",
"state",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L51-L62 |
26,280 | google/seesaw | engine/ipc.go | HAConfig | func (s *SeesawEngine) HAConfig(ctx *ipc.Context, reply *seesaw.HAConfig) error {
s.trace("HAConfig", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
c, err := s.engine.haConfig()
if err != nil {
return err
}
if reply != nil {
... | go | func (s *SeesawEngine) HAConfig(ctx *ipc.Context, reply *seesaw.HAConfig) error {
s.trace("HAConfig", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
c, err := s.engine.haConfig()
if err != nil {
return err
}
if reply != nil {
... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"HAConfig",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
",",
"reply",
"*",
"seesaw",
".",
"HAConfig",
")",
"error",
"{",
"s",
".",
"trace",
"(",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"if",
"ctx",
"==",
"nil",
... | // HAConfig returns the high-availability configuration for this node as
// determined by the engine. | [
"HAConfig",
"returns",
"the",
"high",
"-",
"availability",
"configuration",
"for",
"this",
"node",
"as",
"determined",
"by",
"the",
"engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L66-L84 |
26,281 | google/seesaw | engine/ipc.go | HAUpdate | func (s *SeesawEngine) HAUpdate(args *ipc.HAStatus, failover *bool) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("HAUpdate", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
s.engine.setHAS... | go | func (s *SeesawEngine) HAUpdate(args *ipc.HAStatus, failover *bool) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("HAUpdate", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
s.engine.setHAS... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"HAUpdate",
"(",
"args",
"*",
"ipc",
".",
"HAStatus",
",",
"failover",
"*",
"bool",
")",
"error",
"{",
"if",
"args",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\... | // HAUpdate advises the Engine of the current high-availability status for
// the Seesaw HA component. The Seesaw Engine may also request a failover
// in response. | [
"HAUpdate",
"advises",
"the",
"Engine",
"of",
"the",
"current",
"high",
"-",
"availability",
"status",
"for",
"the",
"Seesaw",
"HA",
"component",
".",
"The",
"Seesaw",
"Engine",
"may",
"also",
"request",
"a",
"failover",
"in",
"response",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L89-L108 |
26,282 | google/seesaw | engine/ipc.go | HAState | func (s *SeesawEngine) HAState(args *ipc.HAState, reply *int) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("HAState", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
s.engine.setHAState(ar... | go | func (s *SeesawEngine) HAState(args *ipc.HAState, reply *int) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("HAState", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
s.engine.setHAState(ar... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"HAState",
"(",
"args",
"*",
"ipc",
".",
"HAState",
",",
"reply",
"*",
"int",
")",
"error",
"{",
"if",
"args",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
... | // HAState advises the Engine of the current high-availability state as
// determined by the Seesaw HA component. | [
"HAState",
"advises",
"the",
"Engine",
"of",
"the",
"current",
"high",
"-",
"availability",
"state",
"as",
"determined",
"by",
"the",
"Seesaw",
"HA",
"component",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L112-L128 |
26,283 | google/seesaw | engine/ipc.go | Healthchecks | func (s *SeesawEngine) Healthchecks(ctx *ipc.Context, reply *healthcheck.Checks) error {
s.trace("Healthchecks", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
configs := s.engine.hcManager.configs()
if reply != nil {
reply.Conf... | go | func (s *SeesawEngine) Healthchecks(ctx *ipc.Context, reply *healthcheck.Checks) error {
s.trace("Healthchecks", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
configs := s.engine.hcManager.configs()
if reply != nil {
reply.Conf... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"Healthchecks",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
",",
"reply",
"*",
"healthcheck",
".",
"Checks",
")",
"error",
"{",
"s",
".",
"trace",
"(",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"if",
"ctx",
"==",
... | // Healthchecks returns a list of currently configured healthchecks that
// should be performed by the Seesaw Healthcheck component. | [
"Healthchecks",
"returns",
"a",
"list",
"of",
"currently",
"configured",
"healthchecks",
"that",
"should",
"be",
"performed",
"by",
"the",
"Seesaw",
"Healthcheck",
"component",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L149-L164 |
26,284 | google/seesaw | engine/ipc.go | HealthState | func (s *SeesawEngine) HealthState(args *healthcheck.HealthState, reply *int) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("HealthState", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
fo... | go | func (s *SeesawEngine) HealthState(args *healthcheck.HealthState, reply *int) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("HealthState", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
fo... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"HealthState",
"(",
"args",
"*",
"healthcheck",
".",
"HealthState",
",",
"reply",
"*",
"int",
")",
"error",
"{",
"if",
"args",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
... | // HealthState advises the Seesaw Engine of state transitions for a set of
// healthchecks that are being performed by the Seesaw Healthcheck component. | [
"HealthState",
"advises",
"the",
"Seesaw",
"Engine",
"of",
"state",
"transitions",
"for",
"a",
"set",
"of",
"healthchecks",
"that",
"are",
"being",
"performed",
"by",
"the",
"Seesaw",
"Healthcheck",
"component",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L168-L189 |
26,285 | google/seesaw | engine/ipc.go | ClusterStatus | func (s *SeesawEngine) ClusterStatus(ctx *ipc.Context, reply *seesaw.ClusterStatus) error {
s.trace("ClusterStatus", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
s.engine.clusterLock.RLock()
cluster := s.engine.cluster
s.engine... | go | func (s *SeesawEngine) ClusterStatus(ctx *ipc.Context, reply *seesaw.ClusterStatus) error {
s.trace("ClusterStatus", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
s.engine.clusterLock.RLock()
cluster := s.engine.cluster
s.engine... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"ClusterStatus",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
",",
"reply",
"*",
"seesaw",
".",
"ClusterStatus",
")",
"error",
"{",
"s",
".",
"trace",
"(",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"if",
"ctx",
"==",... | // ClusterStatus returns status information about this Seesaw Cluster. | [
"ClusterStatus",
"returns",
"status",
"information",
"about",
"this",
"Seesaw",
"Cluster",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L192-L217 |
26,286 | google/seesaw | engine/ipc.go | VLANs | func (s *SeesawEngine) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error {
s.trace("VLANs", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
if reply == nil {
return errors.New("VLANs is nil")
}
reply.VLANs = make([]*seesaw.VLAN... | go | func (s *SeesawEngine) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error {
s.trace("VLANs", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
if reply == nil {
return errors.New("VLANs is nil")
}
reply.VLANs = make([]*seesaw.VLAN... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"VLANs",
"(",
"ctx",
"*",
"ipc",
".",
"Context",
",",
"reply",
"*",
"seesaw",
".",
"VLANs",
")",
"error",
"{",
"s",
".",
"trace",
"(",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"if",
"ctx",
"==",
"nil",
"{",... | // VLANs returns a list of VLANs configured for this cluster. | [
"VLANs",
"returns",
"a",
"list",
"of",
"VLANs",
"configured",
"for",
"this",
"cluster",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L318-L338 |
26,287 | google/seesaw | engine/ipc.go | OverrideBackend | func (s *SeesawEngine) OverrideBackend(args *ipc.Override, reply *int) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("OverrideBackend", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
if ar... | go | func (s *SeesawEngine) OverrideBackend(args *ipc.Override, reply *int) error {
if args == nil {
return errors.New("args is nil")
}
ctx := args.Ctx
s.trace("OverrideBackend", ctx)
if ctx == nil {
return errors.New("context is nil")
}
if !ctx.IsTrusted() {
return errors.New("insufficient access")
}
if ar... | [
"func",
"(",
"s",
"*",
"SeesawEngine",
")",
"OverrideBackend",
"(",
"args",
"*",
"ipc",
".",
"Override",
",",
"reply",
"*",
"int",
")",
"error",
"{",
"if",
"args",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
... | // OverrideBackend passes a BackendOverride to the engine. | [
"OverrideBackend",
"passes",
"a",
"BackendOverride",
"to",
"the",
"engine",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L364-L383 |
26,288 | google/seesaw | common/conn/rpc.go | ClusterStatus | func (c *engineRPC) ClusterStatus() (*seesaw.ClusterStatus, error) {
var cs seesaw.ClusterStatus
if err := c.client.Call("SeesawECU.ClusterStatus", c.ctx, &cs); err != nil {
return nil, err
}
return &cs, nil
} | go | func (c *engineRPC) ClusterStatus() (*seesaw.ClusterStatus, error) {
var cs seesaw.ClusterStatus
if err := c.client.Call("SeesawECU.ClusterStatus", c.ctx, &cs); err != nil {
return nil, err
}
return &cs, nil
} | [
"func",
"(",
"c",
"*",
"engineRPC",
")",
"ClusterStatus",
"(",
")",
"(",
"*",
"seesaw",
".",
"ClusterStatus",
",",
"error",
")",
"{",
"var",
"cs",
"seesaw",
".",
"ClusterStatus",
"\n",
"if",
"err",
":=",
"c",
".",
"client",
".",
"Call",
"(",
"\"",
... | // ClusterStatus requests the status of the Seesaw Cluster. | [
"ClusterStatus",
"requests",
"the",
"status",
"of",
"the",
"Seesaw",
"Cluster",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L77-L83 |
26,289 | google/seesaw | common/conn/rpc.go | Backends | func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) {
var bm seesaw.BackendMap
if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil {
return nil, err
}
return bm.Backends, nil
} | go | func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) {
var bm seesaw.BackendMap
if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil {
return nil, err
}
return bm.Backends, nil
} | [
"func",
"(",
"c",
"*",
"engineRPC",
")",
"Backends",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"seesaw",
".",
"Backend",
",",
"error",
")",
"{",
"var",
"bm",
"seesaw",
".",
"BackendMap",
"\n",
"if",
"err",
":=",
"c",
".",
"client",
".",
"Cal... | // Backends requests a list of all backends that are configured on the cluster. | [
"Backends",
"requests",
"a",
"list",
"of",
"all",
"backends",
"that",
"are",
"configured",
"on",
"the",
"cluster",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L148-L154 |
26,290 | google/seesaw | common/conn/rpc.go | OverrideBackend | func (c *engineRPC) OverrideBackend(backend *seesaw.BackendOverride) error {
override := &ipc.Override{Ctx: c.ctx, Backend: backend}
return c.client.Call("SeesawECU.OverrideBackend", override, nil)
} | go | func (c *engineRPC) OverrideBackend(backend *seesaw.BackendOverride) error {
override := &ipc.Override{Ctx: c.ctx, Backend: backend}
return c.client.Call("SeesawECU.OverrideBackend", override, nil)
} | [
"func",
"(",
"c",
"*",
"engineRPC",
")",
"OverrideBackend",
"(",
"backend",
"*",
"seesaw",
".",
"BackendOverride",
")",
"error",
"{",
"override",
":=",
"&",
"ipc",
".",
"Override",
"{",
"Ctx",
":",
"c",
".",
"ctx",
",",
"Backend",
":",
"backend",
"}",
... | // OverrideBackend requests that the specified VserverOverride be applied. | [
"OverrideBackend",
"requests",
"that",
"the",
"specified",
"VserverOverride",
"be",
"applied",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L157-L160 |
26,291 | google/seesaw | healthcheck/ping.go | NewPingChecker | func NewPingChecker(ip net.IP) *PingChecker {
proto := seesaw.IPProtoICMP
if ip.To4() == nil {
proto = seesaw.IPProtoICMPv6
}
id := nextPingCheckerID
nextPingCheckerID++
return &PingChecker{
Target: Target{
IP: ip,
Proto: proto,
},
ID: id,
}
} | go | func NewPingChecker(ip net.IP) *PingChecker {
proto := seesaw.IPProtoICMP
if ip.To4() == nil {
proto = seesaw.IPProtoICMPv6
}
id := nextPingCheckerID
nextPingCheckerID++
return &PingChecker{
Target: Target{
IP: ip,
Proto: proto,
},
ID: id,
}
} | [
"func",
"NewPingChecker",
"(",
"ip",
"net",
".",
"IP",
")",
"*",
"PingChecker",
"{",
"proto",
":=",
"seesaw",
".",
"IPProtoICMP",
"\n",
"if",
"ip",
".",
"To4",
"(",
")",
"==",
"nil",
"{",
"proto",
"=",
"seesaw",
".",
"IPProtoICMPv6",
"\n",
"}",
"\n",... | // NewPingChecker returns an initialised PingChecker. | [
"NewPingChecker",
"returns",
"an",
"initialised",
"PingChecker",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/ping.go#L51-L65 |
26,292 | google/seesaw | healthcheck/ping.go | Check | func (hc *PingChecker) Check(timeout time.Duration) *Result {
msg := fmt.Sprintf("ICMP ping to host %v", hc.IP)
seq := hc.Seqnum
hc.Seqnum++
echo := newICMPEchoRequest(hc.Proto, hc.ID, seq, 64, []byte("Healthcheck"))
start := time.Now()
if timeout == time.Duration(0) {
timeout = defaultPingTimeout
}
err := ex... | go | func (hc *PingChecker) Check(timeout time.Duration) *Result {
msg := fmt.Sprintf("ICMP ping to host %v", hc.IP)
seq := hc.Seqnum
hc.Seqnum++
echo := newICMPEchoRequest(hc.Proto, hc.ID, seq, 64, []byte("Healthcheck"))
start := time.Now()
if timeout == time.Duration(0) {
timeout = defaultPingTimeout
}
err := ex... | [
"func",
"(",
"hc",
"*",
"PingChecker",
")",
"Check",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"Result",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hc",
".",
"IP",
")",
"\n",
"seq",
":=",
"hc",
".",
"Seqnum",
"\n",
... | // Check executes a ping healthcheck. | [
"Check",
"executes",
"a",
"ping",
"healthcheck",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/ping.go#L73-L85 |
26,293 | google/seesaw | ha/net.go | NewIPHAConn | func NewIPHAConn(laddr, raddr net.IP) (HAConn, error) {
sendConn, err := IPConn(laddr, raddr)
if err != nil {
return nil, err
}
// For IPv6 unicast and multicast, and for IPv4 unicast, we can use the same IPConn for both
// sending and receiving. For IPv4 multicast, we need a separate listener for receiving.
r... | go | func NewIPHAConn(laddr, raddr net.IP) (HAConn, error) {
sendConn, err := IPConn(laddr, raddr)
if err != nil {
return nil, err
}
// For IPv6 unicast and multicast, and for IPv4 unicast, we can use the same IPConn for both
// sending and receiving. For IPv4 multicast, we need a separate listener for receiving.
r... | [
"func",
"NewIPHAConn",
"(",
"laddr",
",",
"raddr",
"net",
".",
"IP",
")",
"(",
"HAConn",
",",
"error",
")",
"{",
"sendConn",
",",
"err",
":=",
"IPConn",
"(",
"laddr",
",",
"raddr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"... | // NewIPHAConn creates a new IPHAConn. | [
"NewIPHAConn",
"creates",
"a",
"new",
"IPHAConn",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L143-L172 |
26,294 | google/seesaw | ha/net.go | ListenMulticastIPv4 | func ListenMulticastIPv4(gaddr, laddr net.IP) (*net.IPConn, error) {
gaddr = gaddr.To4()
laddr = laddr.To4()
c, err := net.ListenIP("ip4:112", &net.IPAddr{IP: gaddr})
if err != nil {
return nil, err
}
f, err := c.File()
if err != nil {
return nil, err
}
defer f.Close()
mreq := &syscall.IPMreq{
Multiad... | go | func ListenMulticastIPv4(gaddr, laddr net.IP) (*net.IPConn, error) {
gaddr = gaddr.To4()
laddr = laddr.To4()
c, err := net.ListenIP("ip4:112", &net.IPAddr{IP: gaddr})
if err != nil {
return nil, err
}
f, err := c.File()
if err != nil {
return nil, err
}
defer f.Close()
mreq := &syscall.IPMreq{
Multiad... | [
"func",
"ListenMulticastIPv4",
"(",
"gaddr",
",",
"laddr",
"net",
".",
"IP",
")",
"(",
"*",
"net",
".",
"IPConn",
",",
"error",
")",
"{",
"gaddr",
"=",
"gaddr",
".",
"To4",
"(",
")",
"\n",
"laddr",
"=",
"laddr",
".",
"To4",
"(",
")",
"\n",
"c",
... | // ListenMulticastIPv4 creates a net.IPConn to receive multicast messages for the given group
// address. laddr specifies which network interface to use when joining the group. | [
"ListenMulticastIPv4",
"creates",
"a",
"net",
".",
"IPConn",
"to",
"receive",
"multicast",
"messages",
"for",
"the",
"given",
"group",
"address",
".",
"laddr",
"specifies",
"which",
"network",
"interface",
"to",
"use",
"when",
"joining",
"the",
"group",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L176-L201 |
26,295 | google/seesaw | ha/net.go | JoinMulticastIPv6 | func JoinMulticastIPv6(c *net.IPConn, gaddr, laddr net.IP) error {
f, err := c.File()
if err != nil {
return err
}
defer f.Close()
mreq := &syscall.IPv6Mreq{}
copy(mreq.Multiaddr[:], gaddr.To16())
iface, err := findInterface(laddr)
if err != nil {
return err
}
mreq.Interface = uint32(iface.Index)
err =... | go | func JoinMulticastIPv6(c *net.IPConn, gaddr, laddr net.IP) error {
f, err := c.File()
if err != nil {
return err
}
defer f.Close()
mreq := &syscall.IPv6Mreq{}
copy(mreq.Multiaddr[:], gaddr.To16())
iface, err := findInterface(laddr)
if err != nil {
return err
}
mreq.Interface = uint32(iface.Index)
err =... | [
"func",
"JoinMulticastIPv6",
"(",
"c",
"*",
"net",
".",
"IPConn",
",",
"gaddr",
",",
"laddr",
"net",
".",
"IP",
")",
"error",
"{",
"f",
",",
"err",
":=",
"c",
".",
"File",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}... | // JoinMulticastIPv6 joins the multicast group address given by gaddr. laddr specifies which
// network interface to use when joining the group. | [
"JoinMulticastIPv6",
"joins",
"the",
"multicast",
"group",
"address",
"given",
"by",
"gaddr",
".",
"laddr",
"specifies",
"which",
"network",
"interface",
"to",
"use",
"when",
"joining",
"the",
"group",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L205-L225 |
26,296 | google/seesaw | ha/net.go | af | func (c *IPHAConn) af() int {
if c.laddr.To4() != nil {
return syscall.AF_INET
}
return syscall.AF_INET6
} | go | func (c *IPHAConn) af() int {
if c.laddr.To4() != nil {
return syscall.AF_INET
}
return syscall.AF_INET6
} | [
"func",
"(",
"c",
"*",
"IPHAConn",
")",
"af",
"(",
")",
"int",
"{",
"if",
"c",
".",
"laddr",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"return",
"syscall",
".",
"AF_INET",
"\n",
"}",
"\n",
"return",
"syscall",
".",
"AF_INET6",
"\n",
"}"
] | // af returns the address family for an IPHAConn. | [
"af",
"returns",
"the",
"address",
"family",
"for",
"an",
"IPHAConn",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L248-L253 |
26,297 | google/seesaw | ha/net.go | readPacket | func (c *IPHAConn) readPacket() (*packet, error) {
switch c.af() {
case syscall.AF_INET:
return c.readIPv4Packet()
case syscall.AF_INET6:
return c.readIPv6Packet()
}
panic("unreachable")
} | go | func (c *IPHAConn) readPacket() (*packet, error) {
switch c.af() {
case syscall.AF_INET:
return c.readIPv4Packet()
case syscall.AF_INET6:
return c.readIPv6Packet()
}
panic("unreachable")
} | [
"func",
"(",
"c",
"*",
"IPHAConn",
")",
"readPacket",
"(",
")",
"(",
"*",
"packet",
",",
"error",
")",
"{",
"switch",
"c",
".",
"af",
"(",
")",
"{",
"case",
"syscall",
".",
"AF_INET",
":",
"return",
"c",
".",
"readIPv4Packet",
"(",
")",
"\n",
"ca... | // readPacket reads a packet from this IPHAConn's recvConn. | [
"readPacket",
"reads",
"a",
"packet",
"from",
"this",
"IPHAConn",
"s",
"recvConn",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L329-L337 |
26,298 | google/seesaw | watchdog/core.go | NewWatchdog | func NewWatchdog() *Watchdog {
return &Watchdog{
services: make(map[string]*Service),
shutdown: make(chan bool),
}
} | go | func NewWatchdog() *Watchdog {
return &Watchdog{
services: make(map[string]*Service),
shutdown: make(chan bool),
}
} | [
"func",
"NewWatchdog",
"(",
")",
"*",
"Watchdog",
"{",
"return",
"&",
"Watchdog",
"{",
"services",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Service",
")",
",",
"shutdown",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n",
"}"
] | // NewWatchdog returns an initialised watchdog. | [
"NewWatchdog",
"returns",
"an",
"initialised",
"watchdog",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/core.go#L37-L42 |
26,299 | google/seesaw | watchdog/core.go | AddService | func (w *Watchdog) AddService(name, binary string) (*Service, error) {
if _, ok := w.services[name]; ok {
return nil, fmt.Errorf("Service %q already exists", name)
}
svc := newService(name, binary)
w.services[name] = svc
return svc, nil
} | go | func (w *Watchdog) AddService(name, binary string) (*Service, error) {
if _, ok := w.services[name]; ok {
return nil, fmt.Errorf("Service %q already exists", name)
}
svc := newService(name, binary)
w.services[name] = svc
return svc, nil
} | [
"func",
"(",
"w",
"*",
"Watchdog",
")",
"AddService",
"(",
"name",
",",
"binary",
"string",
")",
"(",
"*",
"Service",
",",
"error",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"w",
".",
"services",
"[",
"name",
"]",
";",
"ok",
"{",
"return",
"nil",
"... | // AddService adds a service that is to be run by the watchdog. | [
"AddService",
"adds",
"a",
"service",
"that",
"is",
"to",
"be",
"run",
"by",
"the",
"watchdog",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/core.go#L53-L62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.