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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
137,800 | choria-io/go-choria | choria/framework.go | FederationCollectives | func (fw *Framework) FederationCollectives() (collectives []string) {
var found []string
env := os.Getenv("CHORIA_FED_COLLECTIVE")
if env != "" {
found = strings.Split(env, ",")
}
if len(found) == 0 {
found = fw.Config.Choria.FederationCollectives
}
for _, collective := range found {
collectives = appe... | go | func (fw *Framework) FederationCollectives() (collectives []string) {
var found []string
env := os.Getenv("CHORIA_FED_COLLECTIVE")
if env != "" {
found = strings.Split(env, ",")
}
if len(found) == 0 {
found = fw.Config.Choria.FederationCollectives
}
for _, collective := range found {
collectives = appe... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"FederationCollectives",
"(",
")",
"(",
"collectives",
"[",
"]",
"string",
")",
"{",
"var",
"found",
"[",
"]",
"string",
"\n\n",
"env",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"env",
... | // FederationCollectives determines the known Federation Member
// Collectives based on the CHORIA_FED_COLLECTIVE environment
// variable or the choria.federation.collectives config item | [
"FederationCollectives",
"determines",
"the",
"known",
"Federation",
"Member",
"Collectives",
"based",
"on",
"the",
"CHORIA_FED_COLLECTIVE",
"environment",
"variable",
"or",
"the",
"choria",
".",
"federation",
".",
"collectives",
"config",
"item"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L164-L182 |
137,801 | choria-io/go-choria | choria/framework.go | ProvisioningServers | func (fw *Framework) ProvisioningServers(ctx context.Context) ([]srvcache.Server, error) {
return provtarget.Targets(ctx, fw.Logger("provtarget"))
} | go | func (fw *Framework) ProvisioningServers(ctx context.Context) ([]srvcache.Server, error) {
return provtarget.Targets(ctx, fw.Logger("provtarget"))
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"ProvisioningServers",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"srvcache",
".",
"Server",
",",
"error",
")",
"{",
"return",
"provtarget",
".",
"Targets",
"(",
"ctx",
",",
"fw",
".",
"Logger",... | // ProvisioningServers determines the build time provisioning servers
// when it's unset or results in an empty server list this will return
// an error | [
"ProvisioningServers",
"determines",
"the",
"build",
"time",
"provisioning",
"servers",
"when",
"it",
"s",
"unset",
"or",
"results",
"in",
"an",
"empty",
"server",
"list",
"this",
"will",
"return",
"an",
"error"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L220-L222 |
137,802 | choria-io/go-choria | choria/framework.go | SetupLogging | func (fw *Framework) SetupLogging(debug bool) (err error) {
fw.log = log.New()
fw.log.Out = os.Stdout
if fw.Config.LogFile != "" {
fw.log.Formatter = &log.JSONFormatter{}
file, err := os.OpenFile(fw.Config.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
return fmt.Errorf("Could not se... | go | func (fw *Framework) SetupLogging(debug bool) (err error) {
fw.log = log.New()
fw.log.Out = os.Stdout
if fw.Config.LogFile != "" {
fw.log.Formatter = &log.JSONFormatter{}
file, err := os.OpenFile(fw.Config.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
return fmt.Errorf("Could not se... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"SetupLogging",
"(",
"debug",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"fw",
".",
"log",
"=",
"log",
".",
"New",
"(",
")",
"\n\n",
"fw",
".",
"log",
".",
"Out",
"=",
"os",
".",
"Stdout",
"\n\n",
"if"... | // SetupLogging configures logging based on choria config directives
// currently only file and console behaviours are supported | [
"SetupLogging",
"configures",
"logging",
"based",
"on",
"choria",
"config",
"directives",
"currently",
"only",
"file",
"and",
"console",
"behaviours",
"are",
"supported"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L268-L308 |
137,803 | choria-io/go-choria | choria/framework.go | TrySrvLookup | func (fw *Framework) TrySrvLookup(names []string, defaultSrv srvcache.Server) (srvcache.Server, error) {
if !fw.Config.Choria.UseSRVRecords {
return defaultSrv, nil
}
for _, q := range names {
a, err := fw.QuerySrvRecords([]string{q})
if err == nil {
log.Infof("Found %s:%d from %s SRV lookups", a[0].Host, ... | go | func (fw *Framework) TrySrvLookup(names []string, defaultSrv srvcache.Server) (srvcache.Server, error) {
if !fw.Config.Choria.UseSRVRecords {
return defaultSrv, nil
}
for _, q := range names {
a, err := fw.QuerySrvRecords([]string{q})
if err == nil {
log.Infof("Found %s:%d from %s SRV lookups", a[0].Host, ... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"TrySrvLookup",
"(",
"names",
"[",
"]",
"string",
",",
"defaultSrv",
"srvcache",
".",
"Server",
")",
"(",
"srvcache",
".",
"Server",
",",
"error",
")",
"{",
"if",
"!",
"fw",
".",
"Config",
".",
"Choria",
".",... | // TrySrvLookup will attempt to lookup a series of names returning the first found
// if SRV lookups are disabled or nothing is found the default will be returned | [
"TrySrvLookup",
"will",
"attempt",
"to",
"lookup",
"a",
"series",
"of",
"names",
"returning",
"the",
"first",
"found",
"if",
"SRV",
"lookups",
"are",
"disabled",
"or",
"nothing",
"is",
"found",
"the",
"default",
"will",
"be",
"returned"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L312-L329 |
137,804 | choria-io/go-choria | choria/framework.go | QuerySrvRecords | func (fw *Framework) QuerySrvRecords(records []string) ([]srvcache.Server, error) {
servers := []srvcache.Server{}
if !fw.Config.Choria.UseSRVRecords {
return servers, errors.New("SRV lookups are disabled in the configuration file")
}
domain := fw.Config.Choria.SRVDomain
var err error
if fw.Config.Choria.SRV... | go | func (fw *Framework) QuerySrvRecords(records []string) ([]srvcache.Server, error) {
servers := []srvcache.Server{}
if !fw.Config.Choria.UseSRVRecords {
return servers, errors.New("SRV lookups are disabled in the configuration file")
}
domain := fw.Config.Choria.SRVDomain
var err error
if fw.Config.Choria.SRV... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"QuerySrvRecords",
"(",
"records",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"srvcache",
".",
"Server",
",",
"error",
")",
"{",
"servers",
":=",
"[",
"]",
"srvcache",
".",
"Server",
"{",
"}",
"\n\n",
"if",
"!... | // QuerySrvRecords looks for SRV records within the right domain either
// thanks to facter domain or the configured domain.
//
// If the config disables SRV then a error is returned. | [
"QuerySrvRecords",
"looks",
"for",
"SRV",
"records",
"within",
"the",
"right",
"domain",
"either",
"thanks",
"to",
"facter",
"domain",
"or",
"the",
"configured",
"domain",
".",
"If",
"the",
"config",
"disables",
"SRV",
"then",
"a",
"error",
"is",
"returned",
... | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L335-L373 |
137,805 | choria-io/go-choria | choria/framework.go | NetworkBrokerPeers | func (fw *Framework) NetworkBrokerPeers() (servers []srvcache.Server, err error) {
servers, err = fw.QuerySrvRecords([]string{"_mcollective-broker._tcp"})
if err != nil {
log.Errorf("SRV lookup for _mcollective-broker._tcp failed: %s", err)
err = nil
}
if len(servers) == 0 {
for _, server := range fw.Config.... | go | func (fw *Framework) NetworkBrokerPeers() (servers []srvcache.Server, err error) {
servers, err = fw.QuerySrvRecords([]string{"_mcollective-broker._tcp"})
if err != nil {
log.Errorf("SRV lookup for _mcollective-broker._tcp failed: %s", err)
err = nil
}
if len(servers) == 0 {
for _, server := range fw.Config.... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NetworkBrokerPeers",
"(",
")",
"(",
"servers",
"[",
"]",
"srvcache",
".",
"Server",
",",
"err",
"error",
")",
"{",
"servers",
",",
"err",
"=",
"fw",
".",
"QuerySrvRecords",
"(",
"[",
"]",
"string",
"{",
"\""... | // NetworkBrokerPeers are peers in the broker cluster resolved from
// _mcollective-broker._tcp or from the plugin config | [
"NetworkBrokerPeers",
"are",
"peers",
"in",
"the",
"broker",
"cluster",
"resolved",
"from",
"_mcollective",
"-",
"broker",
".",
"_tcp",
"or",
"from",
"the",
"plugin",
"config"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L377-L417 |
137,806 | choria-io/go-choria | choria/framework.go | DiscoveryServer | func (fw *Framework) DiscoveryServer() (srvcache.Server, error) {
s := srvcache.Server{
Host: fw.Config.Choria.DiscoveryHost,
Port: fw.Config.Choria.DiscoveryPort,
}
if !fw.ProxiedDiscovery() {
return s, errors.New("Proxy discovery is not enabled")
}
result, err := fw.TrySrvLookup([]string{"_mcollective-di... | go | func (fw *Framework) DiscoveryServer() (srvcache.Server, error) {
s := srvcache.Server{
Host: fw.Config.Choria.DiscoveryHost,
Port: fw.Config.Choria.DiscoveryPort,
}
if !fw.ProxiedDiscovery() {
return s, errors.New("Proxy discovery is not enabled")
}
result, err := fw.TrySrvLookup([]string{"_mcollective-di... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"DiscoveryServer",
"(",
")",
"(",
"srvcache",
".",
"Server",
",",
"error",
")",
"{",
"s",
":=",
"srvcache",
".",
"Server",
"{",
"Host",
":",
"fw",
".",
"Config",
".",
"Choria",
".",
"DiscoveryHost",
",",
"Por... | // DiscoveryServer is the server configured as a discovery proxy | [
"DiscoveryServer",
"is",
"the",
"server",
"configured",
"as",
"a",
"discovery",
"proxy"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L420-L433 |
137,807 | choria-io/go-choria | choria/framework.go | ProxiedDiscovery | func (fw *Framework) ProxiedDiscovery() bool {
if fw.Config.HasOption("plugin.choria.discovery_host") || fw.Config.HasOption("plugin.choria.discovery_port") {
return true
}
return fw.Config.Choria.DiscoveryProxy
} | go | func (fw *Framework) ProxiedDiscovery() bool {
if fw.Config.HasOption("plugin.choria.discovery_host") || fw.Config.HasOption("plugin.choria.discovery_port") {
return true
}
return fw.Config.Choria.DiscoveryProxy
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"ProxiedDiscovery",
"(",
")",
"bool",
"{",
"if",
"fw",
".",
"Config",
".",
"HasOption",
"(",
"\"",
"\"",
")",
"||",
"fw",
".",
"Config",
".",
"HasOption",
"(",
"\"",
"\"",
")",
"{",
"return",
"true",
"\n",
... | // ProxiedDiscovery determines if a client is configured for proxied discover | [
"ProxiedDiscovery",
"determines",
"if",
"a",
"client",
"is",
"configured",
"for",
"proxied",
"discover"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L436-L442 |
137,808 | choria-io/go-choria | choria/framework.go | PuppetAIOCmd | func (fw *Framework) PuppetAIOCmd(command string, def string) string {
return PuppetAIOCmd(command, def)
} | go | func (fw *Framework) PuppetAIOCmd(command string, def string) string {
return PuppetAIOCmd(command, def)
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"PuppetAIOCmd",
"(",
"command",
"string",
",",
"def",
"string",
")",
"string",
"{",
"return",
"PuppetAIOCmd",
"(",
"command",
",",
"def",
")",
"\n",
"}"
] | // PuppetAIOCmd looks up a command in the AIO paths, if it's not there
// it will try PATH and finally return a default if not in PATH | [
"PuppetAIOCmd",
"looks",
"up",
"a",
"command",
"in",
"the",
"AIO",
"paths",
"if",
"it",
"s",
"not",
"there",
"it",
"will",
"try",
"PATH",
"and",
"finally",
"return",
"a",
"default",
"if",
"not",
"in",
"PATH"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L476-L478 |
137,809 | choria-io/go-choria | choria/framework.go | HasCollective | func (fw *Framework) HasCollective(collective string) bool {
for _, c := range fw.Config.Collectives {
if c == collective {
return true
}
}
return false
} | go | func (fw *Framework) HasCollective(collective string) bool {
for _, c := range fw.Config.Collectives {
if c == collective {
return true
}
}
return false
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"HasCollective",
"(",
"collective",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"fw",
".",
"Config",
".",
"Collectives",
"{",
"if",
"c",
"==",
"collective",
"{",
"return",
"true",
"\n",
"... | // HasCollective determines if a collective is known in the configuration | [
"HasCollective",
"determines",
"if",
"a",
"collective",
"is",
"known",
"in",
"the",
"configuration"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/framework.go#L491-L499 |
137,810 | choria-io/go-choria | server/discovery/facts/facts.go | Match | func Match(filters [][3]string, fw *choria.Framework, log *logrus.Entry) bool {
matched := false
var err error
for _, filter := range filters {
matched, err = HasFact(filter[0], filter[1], filter[2], fw.Config.FactSourceFile, log)
if err != nil {
log.Warnf("Failed to match fact '%#v': %s", filter, err)
re... | go | func Match(filters [][3]string, fw *choria.Framework, log *logrus.Entry) bool {
matched := false
var err error
for _, filter := range filters {
matched, err = HasFact(filter[0], filter[1], filter[2], fw.Config.FactSourceFile, log)
if err != nil {
log.Warnf("Failed to match fact '%#v': %s", filter, err)
re... | [
"func",
"Match",
"(",
"filters",
"[",
"]",
"[",
"3",
"]",
"string",
",",
"fw",
"*",
"choria",
".",
"Framework",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"bool",
"{",
"matched",
":=",
"false",
"\n",
"var",
"err",
"error",
"\n\n",
"for",
"_",
... | // Match match fact filters in a OR manner, only nodes that have all
// the matching facts will be true here | [
"Match",
"match",
"fact",
"filters",
"in",
"a",
"OR",
"manner",
"only",
"nodes",
"that",
"have",
"all",
"the",
"matching",
"facts",
"will",
"be",
"true",
"here"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/facts/facts.go#L19-L37 |
137,811 | choria-io/go-choria | server/discovery/facts/facts.go | JSON | func JSON(file string, log *logrus.Entry) (json.RawMessage, error) {
out := make(map[string]interface{})
for _, f := range strings.Split(file, string(os.PathListSeparator)) {
if f == "" {
continue
}
if _, err := os.Stat(f); os.IsNotExist(err) {
log.Warnf("Fact file %s does not exist", f)
continue
}... | go | func JSON(file string, log *logrus.Entry) (json.RawMessage, error) {
out := make(map[string]interface{})
for _, f := range strings.Split(file, string(os.PathListSeparator)) {
if f == "" {
continue
}
if _, err := os.Stat(f); os.IsNotExist(err) {
log.Warnf("Fact file %s does not exist", f)
continue
}... | [
"func",
"JSON",
"(",
"file",
"string",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"(",
"json",
".",
"RawMessage",
",",
"error",
")",
"{",
"out",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"for",
"_",
",",... | // JSON parses the data, including doing any conversions needed, and returns JSON text | [
"JSON",
"parses",
"the",
"data",
"including",
"doing",
"any",
"conversions",
"needed",
"and",
"returns",
"JSON",
"text"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/facts/facts.go#L40-L91 |
137,812 | choria-io/go-choria | server/discovery/facts/facts.go | GetFact | func GetFact(fact string, file string, log *logrus.Entry) ([]byte, gjson.Result, error) {
j, err := JSON(file, log)
if err != nil {
return nil, gjson.Result{}, err
}
found := gjson.GetBytes(j, fact)
if !found.Exists() {
return nil, gjson.Result{}, nil
}
return j, found, nil
} | go | func GetFact(fact string, file string, log *logrus.Entry) ([]byte, gjson.Result, error) {
j, err := JSON(file, log)
if err != nil {
return nil, gjson.Result{}, err
}
found := gjson.GetBytes(j, fact)
if !found.Exists() {
return nil, gjson.Result{}, nil
}
return j, found, nil
} | [
"func",
"GetFact",
"(",
"fact",
"string",
",",
"file",
"string",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"(",
"[",
"]",
"byte",
",",
"gjson",
".",
"Result",
",",
"error",
")",
"{",
"j",
",",
"err",
":=",
"JSON",
"(",
"file",
",",
"log",
"... | // GetFact looks up a single fact from the facts file, errors reading
// the file is reported but an absent fact is handled as empty result
// and no error | [
"GetFact",
"looks",
"up",
"a",
"single",
"fact",
"from",
"the",
"facts",
"file",
"errors",
"reading",
"the",
"file",
"is",
"reported",
"but",
"an",
"absent",
"fact",
"is",
"handled",
"as",
"empty",
"result",
"and",
"no",
"error"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/facts/facts.go#L96-L108 |
137,813 | choria-io/go-choria | server/discovery/facts/facts.go | HasFact | func HasFact(fact string, operator string, value string, file string, log *logrus.Entry) (bool, error) {
j, found, err := GetFact(fact, file, log)
if err != nil {
return false, err
}
if !found.Exists() {
return false, nil
}
switch operator {
case "==":
return eqMatch(found, value, &j)
case "=~":
retur... | go | func HasFact(fact string, operator string, value string, file string, log *logrus.Entry) (bool, error) {
j, found, err := GetFact(fact, file, log)
if err != nil {
return false, err
}
if !found.Exists() {
return false, nil
}
switch operator {
case "==":
return eqMatch(found, value, &j)
case "=~":
retur... | [
"func",
"HasFact",
"(",
"fact",
"string",
",",
"operator",
"string",
",",
"value",
"string",
",",
"file",
"string",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"(",
"bool",
",",
"error",
")",
"{",
"j",
",",
"found",
",",
"err",
":=",
"GetFact",
"... | // HasFact evaluates the expression against facts in the file | [
"HasFact",
"evaluates",
"the",
"expression",
"against",
"facts",
"in",
"the",
"file"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/facts/facts.go#L111-L139 |
137,814 | choria-io/go-choria | aagent/machine/notifications.go | RegisterNotifier | func (m *Machine) RegisterNotifier(services ...NotificationService) {
for _, service := range services {
m.notifiers = append(m.notifiers, service)
}
} | go | func (m *Machine) RegisterNotifier(services ...NotificationService) {
for _, service := range services {
m.notifiers = append(m.notifiers, service)
}
} | [
"func",
"(",
"m",
"*",
"Machine",
")",
"RegisterNotifier",
"(",
"services",
"...",
"NotificationService",
")",
"{",
"for",
"_",
",",
"service",
":=",
"range",
"services",
"{",
"m",
".",
"notifiers",
"=",
"append",
"(",
"m",
".",
"notifiers",
",",
"servic... | // RegisterNotifier adds a new NotificationService to the list of ones to receive notifications | [
"RegisterNotifier",
"adds",
"a",
"new",
"NotificationService",
"to",
"the",
"list",
"of",
"ones",
"to",
"receive",
"notifications"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/machine/notifications.go#L60-L64 |
137,815 | choria-io/go-choria | aagent/machine/notifications.go | Warnf | func (m *Machine) Warnf(watcher string, format string, args ...interface{}) {
for _, n := range m.notifiers {
n.Warnf(m, watcher, format, args...)
}
} | go | func (m *Machine) Warnf(watcher string, format string, args ...interface{}) {
for _, n := range m.notifiers {
n.Warnf(m, watcher, format, args...)
}
} | [
"func",
"(",
"m",
"*",
"Machine",
")",
"Warnf",
"(",
"watcher",
"string",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"m",
".",
"notifiers",
"{",
"n",
".",
"Warnf",
"(",
"m",
... | // Warnf implements NotificationService | [
"Warnf",
"implements",
"NotificationService"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/machine/notifications.go#L81-L85 |
137,816 | choria-io/go-choria | aagent/machine/notifications.go | NotifyWatcherState | func (m *Machine) NotifyWatcherState(watcher string, state interface{}) {
notification, ok := state.(WatcherStateNotification)
if !ok {
m.Errorf(watcher, "Could not notify watcher state: state does not implement WatcherStateNotification: %#v", state)
}
for _, n := range m.notifiers {
err := n.NotifyWatcherStat... | go | func (m *Machine) NotifyWatcherState(watcher string, state interface{}) {
notification, ok := state.(WatcherStateNotification)
if !ok {
m.Errorf(watcher, "Could not notify watcher state: state does not implement WatcherStateNotification: %#v", state)
}
for _, n := range m.notifiers {
err := n.NotifyWatcherStat... | [
"func",
"(",
"m",
"*",
"Machine",
")",
"NotifyWatcherState",
"(",
"watcher",
"string",
",",
"state",
"interface",
"{",
"}",
")",
"{",
"notification",
",",
"ok",
":=",
"state",
".",
"(",
"WatcherStateNotification",
")",
"\n",
"if",
"!",
"ok",
"{",
"m",
... | // NotifyWatcherState implements NotificationService | [
"NotifyWatcherState",
"implements",
"NotificationService"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/machine/notifications.go#L95-L107 |
137,817 | choria-io/go-choria | server/discovery/agents/agents.go | Match | func Match(needles []string, knownAgents []string) bool {
matched := 0
failed := 0
for _, needle := range needles {
if strings.HasPrefix(needle, "/") && strings.HasSuffix(needle, "/") {
needle = strings.TrimPrefix(needle, "/")
needle = strings.TrimSuffix(needle, "/")
if hasAgentMatching(needle, knownAge... | go | func Match(needles []string, knownAgents []string) bool {
matched := 0
failed := 0
for _, needle := range needles {
if strings.HasPrefix(needle, "/") && strings.HasSuffix(needle, "/") {
needle = strings.TrimPrefix(needle, "/")
needle = strings.TrimSuffix(needle, "/")
if hasAgentMatching(needle, knownAge... | [
"func",
"Match",
"(",
"needles",
"[",
"]",
"string",
",",
"knownAgents",
"[",
"]",
"string",
")",
"bool",
"{",
"matched",
":=",
"0",
"\n",
"failed",
":=",
"0",
"\n\n",
"for",
"_",
",",
"needle",
":=",
"range",
"needles",
"{",
"if",
"strings",
".",
... | // Match agents on a AND basis | [
"Match",
"agents",
"on",
"a",
"AND",
"basis"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/agents/agents.go#L9-L35 |
137,818 | choria-io/go-choria | server/agents/agents.go | New | func New(requests chan *choria.ConnectorMessage, fw *choria.Framework, conn choria.ConnectorInfo, srv ServerInfoSource, log *logrus.Entry) *Manager {
return &Manager{
agents: make(map[string]Agent),
subs: make(map[string][]string),
fw: fw,
log: log.WithFields(logrus.Fields{"subsystem":... | go | func New(requests chan *choria.ConnectorMessage, fw *choria.Framework, conn choria.ConnectorInfo, srv ServerInfoSource, log *logrus.Entry) *Manager {
return &Manager{
agents: make(map[string]Agent),
subs: make(map[string][]string),
fw: fw,
log: log.WithFields(logrus.Fields{"subsystem":... | [
"func",
"New",
"(",
"requests",
"chan",
"*",
"choria",
".",
"ConnectorMessage",
",",
"fw",
"*",
"choria",
".",
"Framework",
",",
"conn",
"choria",
".",
"ConnectorInfo",
",",
"srv",
"ServerInfoSource",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"*",
"M... | // New creates a new Agent Manager | [
"New",
"creates",
"a",
"new",
"Agent",
"Manager"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/agents.go#L79-L90 |
137,819 | choria-io/go-choria | server/agents/agents.go | DenyAgent | func (a *Manager) DenyAgent(agent string) {
a.denylist = append(a.denylist, agent)
} | go | func (a *Manager) DenyAgent(agent string) {
a.denylist = append(a.denylist, agent)
} | [
"func",
"(",
"a",
"*",
"Manager",
")",
"DenyAgent",
"(",
"agent",
"string",
")",
"{",
"a",
".",
"denylist",
"=",
"append",
"(",
"a",
".",
"denylist",
",",
"agent",
")",
"\n",
"}"
] | // DenyAgent adds an agent to the list of agent names not allowed to start | [
"DenyAgent",
"adds",
"an",
"agent",
"to",
"the",
"list",
"of",
"agent",
"names",
"not",
"allowed",
"to",
"start"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/agents.go#L93-L95 |
137,820 | choria-io/go-choria | server/agents/agents.go | RegisterAgent | func (a *Manager) RegisterAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error {
a.mu.Lock()
defer a.mu.Unlock()
if a.agentDenied(name) {
a.log.Infof("Denying agent %s based on agent deny list", name)
return nil
}
a.log.Infof("Registering new agent %s of type %s", name, agen... | go | func (a *Manager) RegisterAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error {
a.mu.Lock()
defer a.mu.Unlock()
if a.agentDenied(name) {
a.log.Infof("Denying agent %s based on agent deny list", name)
return nil
}
a.log.Infof("Registering new agent %s of type %s", name, agen... | [
"func",
"(",
"a",
"*",
"Manager",
")",
"RegisterAgent",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"agent",
"Agent",
",",
"conn",
"choria",
".",
"AgentConnector",
")",
"error",
"{",
"a",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",... | // RegisterAgent connects a new agent to the server instance, subscribe to all its targets etc | [
"RegisterAgent",
"connects",
"a",
"new",
"agent",
"to",
"the",
"server",
"instance",
"subscribe",
"to",
"all",
"its",
"targets",
"etc"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/agents.go#L98-L123 |
137,821 | choria-io/go-choria | server/agents/agents.go | KnownAgents | func (a *Manager) KnownAgents() []string {
a.mu.Lock()
defer a.mu.Unlock()
known := make([]string, 0, len(a.agents))
for agent := range a.agents {
known = append(known, agent)
}
sort.Strings(known)
return known
} | go | func (a *Manager) KnownAgents() []string {
a.mu.Lock()
defer a.mu.Unlock()
known := make([]string, 0, len(a.agents))
for agent := range a.agents {
known = append(known, agent)
}
sort.Strings(known)
return known
} | [
"func",
"(",
"a",
"*",
"Manager",
")",
"KnownAgents",
"(",
")",
"[",
"]",
"string",
"{",
"a",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"known",
":=",
"make",
"(",
"[",
"]",
"string",
",... | // KnownAgents retrieves a list of known agents | [
"KnownAgents",
"retrieves",
"a",
"list",
"of",
"known",
"agents"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/agents.go#L126-L139 |
137,822 | choria-io/go-choria | server/agents/agents.go | subscribeAgent | func (a *Manager) subscribeAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error {
if _, found := a.subs[name]; found {
return fmt.Errorf("Could not subscribe agent %s, it's already subscribed", name)
}
a.subs[name] = []string{}
for _, collective := range a.fw.Config.Collectives... | go | func (a *Manager) subscribeAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error {
if _, found := a.subs[name]; found {
return fmt.Errorf("Could not subscribe agent %s, it's already subscribed", name)
}
a.subs[name] = []string{}
for _, collective := range a.fw.Config.Collectives... | [
"func",
"(",
"a",
"*",
"Manager",
")",
"subscribeAgent",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"agent",
"Agent",
",",
"conn",
"choria",
".",
"AgentConnector",
")",
"error",
"{",
"if",
"_",
",",
"found",
":=",
"a",
".",
"s... | // Subscribes an agent to all its targets on the connector. Should any subscription fail
// all the preceding subscriptions for this agents is unsubscribed and an error returned.
// Errors during the unsub is just ignored because it's quite possible that they would fail
// too but this avoids problems of messages arri... | [
"Subscribes",
"an",
"agent",
"to",
"all",
"its",
"targets",
"on",
"the",
"connector",
".",
"Should",
"any",
"subscription",
"fail",
"all",
"the",
"preceding",
"subscriptions",
"for",
"this",
"agents",
"is",
"unsubscribed",
"and",
"an",
"error",
"returned",
"."... | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agents/agents.go#L158-L184 |
137,823 | choria-io/go-choria | cmd/ping.go | sparkline | func (p *pingCommand) sparkline() string {
ticks := []string{"▁", "▂", "▃", "▄", "▅", "▆", "▇"}
sort.Float64s(p.times)
latest := p.times[len(p.times)-1]
bcount := int(latest/50) + 1
buckets := make([]int, bcount)
for _, t := range p.times {
b := int(t / 50.0)
buckets[b]++
}
max := 0
for _, cnt := range... | go | func (p *pingCommand) sparkline() string {
ticks := []string{"▁", "▂", "▃", "▄", "▅", "▆", "▇"}
sort.Float64s(p.times)
latest := p.times[len(p.times)-1]
bcount := int(latest/50) + 1
buckets := make([]int, bcount)
for _, t := range p.times {
b := int(t / 50.0)
buckets[b]++
}
max := 0
for _, cnt := range... | [
"func",
"(",
"p",
"*",
"pingCommand",
")",
"sparkline",
"(",
")",
"string",
"{",
"ticks",
":=",
"[",
"]",
"string",
"{",
"\"",
" ",
"\"",
"\"",
"▃",
"\"",
" ",
",",
" ",
"▅",
"\"",
"▆",
",",
"\"",
"}",
"",
"",
"",
"",
"",
"",
"\n\n",
"sor... | // sparkline takes all the received time stamps and put them
// in buckets of 50ms time brackets, it then use the amount
// of messages received in each bucket as the height | [
"sparkline",
"takes",
"all",
"the",
"received",
"time",
"stamps",
"and",
"put",
"them",
"in",
"buckets",
"of",
"50ms",
"time",
"brackets",
"it",
"then",
"use",
"the",
"amount",
"of",
"messages",
"received",
"in",
"each",
"bucket",
"as",
"the",
"height"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/cmd/ping.go#L206-L240 |
137,824 | choria-io/go-choria | provtarget/builddefaults/default.go | Targets | func (b *Resolver) Targets(ctx context.Context, log *logrus.Entry) []string {
if build.ProvisionBrokerURLs != "" {
return strings.Split(build.ProvisionBrokerURLs, ",")
}
return []string{}
} | go | func (b *Resolver) Targets(ctx context.Context, log *logrus.Entry) []string {
if build.ProvisionBrokerURLs != "" {
return strings.Split(build.ProvisionBrokerURLs, ",")
}
return []string{}
} | [
"func",
"(",
"b",
"*",
"Resolver",
")",
"Targets",
"(",
"ctx",
"context",
".",
"Context",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"[",
"]",
"string",
"{",
"if",
"build",
".",
"ProvisionBrokerURLs",
"!=",
"\"",
"\"",
"{",
"return",
"strings",
".... | // Targets are the build time configured provisioners | [
"Targets",
"are",
"the",
"build",
"time",
"configured",
"provisioners"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/provtarget/builddefaults/default.go#L25-L31 |
137,825 | choria-io/go-choria | provtarget/provtarget.go | RegisterTargetResolver | func RegisterTargetResolver(r TargetResolver) error {
mu.Lock()
defer mu.Unlock()
resolver = r
return nil
} | go | func RegisterTargetResolver(r TargetResolver) error {
mu.Lock()
defer mu.Unlock()
resolver = r
return nil
} | [
"func",
"RegisterTargetResolver",
"(",
"r",
"TargetResolver",
")",
"error",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"resolver",
"=",
"r",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // RegisterTargetResolver registers a custom target resolver, else the default will be used | [
"RegisterTargetResolver",
"registers",
"a",
"custom",
"target",
"resolver",
"else",
"the",
"default",
"will",
"be",
"used"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/provtarget/provtarget.go#L27-L34 |
137,826 | choria-io/go-choria | provtarget/provtarget.go | Targets | func Targets(ctx context.Context, log *logrus.Entry) ([]srvcache.Server, error) {
mu.Lock()
defer mu.Unlock()
if resolver == nil {
return []srvcache.Server{}, fmt.Errorf("no Provisioning Target Resolver registered")
}
s := resolver.Targets(ctx, log)
if len(s) == 0 {
return []srvcache.Server{}, fmt.Errorf("... | go | func Targets(ctx context.Context, log *logrus.Entry) ([]srvcache.Server, error) {
mu.Lock()
defer mu.Unlock()
if resolver == nil {
return []srvcache.Server{}, fmt.Errorf("no Provisioning Target Resolver registered")
}
s := resolver.Targets(ctx, log)
if len(s) == 0 {
return []srvcache.Server{}, fmt.Errorf("... | [
"func",
"Targets",
"(",
"ctx",
"context",
".",
"Context",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"(",
"[",
"]",
"srvcache",
".",
"Server",
",",
"error",
")",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
... | // Targets is a list of brokers to connect to | [
"Targets",
"is",
"a",
"list",
"of",
"brokers",
"to",
"connect",
"to"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/provtarget/provtarget.go#L37-L61 |
137,827 | choria-io/go-choria | config/config.go | NewDefaultConfig | func NewDefaultConfig() (*Config, error) {
c := newConfig()
err := normalize(c)
if err != nil {
return nil, err
}
return c, nil
} | go | func NewDefaultConfig() (*Config, error) {
c := newConfig()
err := normalize(c)
if err != nil {
return nil, err
}
return c, nil
} | [
"func",
"NewDefaultConfig",
"(",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"c",
":=",
"newConfig",
"(",
")",
"\n\n",
"err",
":=",
"normalize",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\... | // NewDefaultConfig creates a empty configuration | [
"NewDefaultConfig",
"creates",
"a",
"empty",
"configuration"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/config.go#L176-L185 |
137,828 | choria-io/go-choria | config/config.go | NewConfig | func NewConfig(path string) (*Config, error) {
c := newConfig()
c.ConfigFile = path
err := parseConfig(path, c, "", c.rawOpts)
if err != nil {
return nil, err
}
err = parseConfig(c.ConfigFile, c.Choria, "", c.rawOpts)
if err != nil {
return nil, err
}
c.parseAllDotCfg()
err = normalize(c)
if err != n... | go | func NewConfig(path string) (*Config, error) {
c := newConfig()
c.ConfigFile = path
err := parseConfig(path, c, "", c.rawOpts)
if err != nil {
return nil, err
}
err = parseConfig(c.ConfigFile, c.Choria, "", c.rawOpts)
if err != nil {
return nil, err
}
c.parseAllDotCfg()
err = normalize(c)
if err != n... | [
"func",
"NewConfig",
"(",
"path",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"c",
":=",
"newConfig",
"(",
")",
"\n",
"c",
".",
"ConfigFile",
"=",
"path",
"\n\n",
"err",
":=",
"parseConfig",
"(",
"path",
",",
"c",
",",
"\"",
"\"",
... | // NewConfig parses a config file and return the config | [
"NewConfig",
"parses",
"a",
"config",
"file",
"and",
"return",
"the",
"config"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/config.go#L188-L210 |
137,829 | choria-io/go-choria | config/config.go | HasOption | func (conf *Config) HasOption(option string) bool {
_, ok := conf.rawOpts[option]
return ok
} | go | func (conf *Config) HasOption(option string) bool {
_, ok := conf.rawOpts[option]
return ok
} | [
"func",
"(",
"conf",
"*",
"Config",
")",
"HasOption",
"(",
"option",
"string",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"conf",
".",
"rawOpts",
"[",
"option",
"]",
"\n\n",
"return",
"ok",
"\n",
"}"
] | // HasOption determines if a specific option was set from a config key.
// The option given would be something like `plugin.choria.use_srv`
// and true would indicate that it was set by config vs using defaults | [
"HasOption",
"determines",
"if",
"a",
"specific",
"option",
"was",
"set",
"from",
"a",
"config",
"key",
".",
"The",
"option",
"given",
"would",
"be",
"something",
"like",
"plugin",
".",
"choria",
".",
"use_srv",
"and",
"true",
"would",
"indicate",
"that",
... | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/config.go#L264-L268 |
137,830 | choria-io/go-choria | config/config.go | Option | func (conf *Config) Option(option string, deflt string) string {
v, ok := conf.rawOpts[option]
if !ok {
return deflt
}
return v
} | go | func (conf *Config) Option(option string, deflt string) string {
v, ok := conf.rawOpts[option]
if !ok {
return deflt
}
return v
} | [
"func",
"(",
"conf",
"*",
"Config",
")",
"Option",
"(",
"option",
"string",
",",
"deflt",
"string",
")",
"string",
"{",
"v",
",",
"ok",
":=",
"conf",
".",
"rawOpts",
"[",
"option",
"]",
"\n\n",
"if",
"!",
"ok",
"{",
"return",
"deflt",
"\n",
"}",
... | // Option retrieves the raw string representation of a given option
// from that was loaded from the configuration | [
"Option",
"retrieves",
"the",
"raw",
"string",
"representation",
"of",
"a",
"given",
"option",
"from",
"that",
"was",
"loaded",
"from",
"the",
"configuration"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/config.go#L272-L280 |
137,831 | choria-io/go-choria | config/config.go | parseConfig | func parseConfig(path string, config interface{}, prefix string, found map[string]string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
parseConfigContents(file, config, prefix, found)
return nil
} | go | func parseConfig(path string, config interface{}, prefix string, found map[string]string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
parseConfigContents(file, config, prefix, found)
return nil
} | [
"func",
"parseConfig",
"(",
"path",
"string",
",",
"config",
"interface",
"{",
"}",
",",
"prefix",
"string",
",",
"found",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
... | // parse a config file and fill in the given config structure based on its tags | [
"parse",
"a",
"config",
"file",
"and",
"fill",
"in",
"the",
"given",
"config",
"structure",
"based",
"on",
"its",
"tags"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/config/config.go#L332-L342 |
137,832 | choria-io/go-choria | server/discovery/classes/classes.go | Match | func Match(needles []string, source string, log *logrus.Entry) bool {
classes, err := ReadClasses(source)
if err != nil {
log.Warnf("Could not parse classes file %s: %s", source, err)
return false
}
matched := 0
failed := 0
for _, needle := range needles {
if strings.HasPrefix(needle, "/") && strings.HasS... | go | func Match(needles []string, source string, log *logrus.Entry) bool {
classes, err := ReadClasses(source)
if err != nil {
log.Warnf("Could not parse classes file %s: %s", source, err)
return false
}
matched := 0
failed := 0
for _, needle := range needles {
if strings.HasPrefix(needle, "/") && strings.HasS... | [
"func",
"Match",
"(",
"needles",
"[",
"]",
"string",
",",
"source",
"string",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"bool",
"{",
"classes",
",",
"err",
":=",
"ReadClasses",
"(",
"source",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
"."... | // Match classes on a AND basis | [
"Match",
"classes",
"on",
"a",
"AND",
"basis"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/classes/classes.go#L13-L45 |
137,833 | choria-io/go-choria | server/discovery/classes/classes.go | ReadClasses | func ReadClasses(file string) ([]string, error) {
classes := []string{}
fh, err := os.Open(file)
if err != nil {
return classes, err
}
defer fh.Close()
scanner := bufio.NewScanner(fh)
for scanner.Scan() {
classes = append(classes, scanner.Text())
}
return classes, nil
} | go | func ReadClasses(file string) ([]string, error) {
classes := []string{}
fh, err := os.Open(file)
if err != nil {
return classes, err
}
defer fh.Close()
scanner := bufio.NewScanner(fh)
for scanner.Scan() {
classes = append(classes, scanner.Text())
}
return classes, nil
} | [
"func",
"ReadClasses",
"(",
"file",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"classes",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"fh",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"ni... | // ReadClasses reads a given file and attempts to parse it as a typical classes file | [
"ReadClasses",
"reads",
"a",
"given",
"file",
"and",
"attempts",
"to",
"parse",
"it",
"as",
"a",
"typical",
"classes",
"file"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/classes/classes.go#L68-L84 |
137,834 | choria-io/go-choria | server/discovery/discovery.go | New | func New(framework *choria.Framework, logger *logrus.Entry) *Manager {
return &Manager{
fw: framework,
cfg: framework.Config,
log: logger.WithFields(logrus.Fields{"subsystem": "discovery"}),
}
} | go | func New(framework *choria.Framework, logger *logrus.Entry) *Manager {
return &Manager{
fw: framework,
cfg: framework.Config,
log: logger.WithFields(logrus.Fields{"subsystem": "discovery"}),
}
} | [
"func",
"New",
"(",
"framework",
"*",
"choria",
".",
"Framework",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"*",
"Manager",
"{",
"return",
"&",
"Manager",
"{",
"fw",
":",
"framework",
",",
"cfg",
":",
"framework",
".",
"Config",
",",
"log",
":... | // New creates a new discovery Manager | [
"New",
"creates",
"a",
"new",
"discovery",
"Manager"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/discovery.go#L23-L29 |
137,835 | choria-io/go-choria | server/discovery/discovery.go | ShouldProcess | func (mgr *Manager) ShouldProcess(request protocol.Request, knownAgents []string) bool {
filter, _ := request.Filter()
passed := 0
if filter.Empty() {
mgr.log.Debugf("Matching request %s with empty filter", request.RequestID())
passed++
}
if len(filter.ClassFilters()) > 0 {
if classes.Match(filter.ClassFil... | go | func (mgr *Manager) ShouldProcess(request protocol.Request, knownAgents []string) bool {
filter, _ := request.Filter()
passed := 0
if filter.Empty() {
mgr.log.Debugf("Matching request %s with empty filter", request.RequestID())
passed++
}
if len(filter.ClassFilters()) > 0 {
if classes.Match(filter.ClassFil... | [
"func",
"(",
"mgr",
"*",
"Manager",
")",
"ShouldProcess",
"(",
"request",
"protocol",
".",
"Request",
",",
"knownAgents",
"[",
"]",
"string",
")",
"bool",
"{",
"filter",
",",
"_",
":=",
"request",
".",
"Filter",
"(",
")",
"\n",
"passed",
":=",
"0",
"... | // ShouldProcess checks all filters against methods for filtering
// and returns boolean if it matches | [
"ShouldProcess",
"checks",
"all",
"filters",
"against",
"methods",
"for",
"filtering",
"and",
"returns",
"boolean",
"if",
"it",
"matches"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/discovery.go#L33-L88 |
137,836 | choria-io/go-choria | server/agent_provider_mock.go | NewMockAgentProvider | func NewMockAgentProvider(ctrl *gomock.Controller) *MockAgentProvider {
mock := &MockAgentProvider{ctrl: ctrl}
mock.recorder = &MockAgentProviderMockRecorder{mock}
return mock
} | go | func NewMockAgentProvider(ctrl *gomock.Controller) *MockAgentProvider {
mock := &MockAgentProvider{ctrl: ctrl}
mock.recorder = &MockAgentProviderMockRecorder{mock}
return mock
} | [
"func",
"NewMockAgentProvider",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAgentProvider",
"{",
"mock",
":=",
"&",
"MockAgentProvider",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAgentProviderMockRecorder",
... | // NewMockAgentProvider creates a new mock instance | [
"NewMockAgentProvider",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agent_provider_mock.go#L27-L31 |
137,837 | choria-io/go-choria | server/agent_provider_mock.go | Initialize | func (mr *MockAgentProviderMockRecorder) Initialize(fw, log interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*MockAgentProvider)(nil).Initialize), fw, log)
} | go | func (mr *MockAgentProviderMockRecorder) Initialize(fw, log interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*MockAgentProvider)(nil).Initialize), fw, log)
} | [
"func",
"(",
"mr",
"*",
"MockAgentProviderMockRecorder",
")",
"Initialize",
"(",
"fw",
",",
"log",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mo... | // Initialize indicates an expected call of Initialize | [
"Initialize",
"indicates",
"an",
"expected",
"call",
"of",
"Initialize"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agent_provider_mock.go#L44-L46 |
137,838 | choria-io/go-choria | server/agent_provider_mock.go | RegisterAgents | func (m *MockAgentProvider) RegisterAgents(ctx context.Context, mgr AgentManager, connector choria.InstanceConnector, log *logrus.Entry) error {
ret := m.ctrl.Call(m, "RegisterAgents", ctx, mgr, connector, log)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockAgentProvider) RegisterAgents(ctx context.Context, mgr AgentManager, connector choria.InstanceConnector, log *logrus.Entry) error {
ret := m.ctrl.Call(m, "RegisterAgents", ctx, mgr, connector, log)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAgentProvider",
")",
"RegisterAgents",
"(",
"ctx",
"context",
".",
"Context",
",",
"mgr",
"AgentManager",
",",
"connector",
"choria",
".",
"InstanceConnector",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"error",
"{",
"ret",
"... | // RegisterAgents mocks base method | [
"RegisterAgents",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agent_provider_mock.go#L49-L53 |
137,839 | choria-io/go-choria | server/agent_provider_mock.go | RegisterAgents | func (mr *MockAgentProviderMockRecorder) RegisterAgents(ctx, mgr, connector, log interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterAgents", reflect.TypeOf((*MockAgentProvider)(nil).RegisterAgents), ctx, mgr, connector, log)
} | go | func (mr *MockAgentProviderMockRecorder) RegisterAgents(ctx, mgr, connector, log interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterAgents", reflect.TypeOf((*MockAgentProvider)(nil).RegisterAgents), ctx, mgr, connector, log)
} | [
"func",
"(",
"mr",
"*",
"MockAgentProviderMockRecorder",
")",
"RegisterAgents",
"(",
"ctx",
",",
"mgr",
",",
"connector",
",",
"log",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallW... | // RegisterAgents indicates an expected call of RegisterAgents | [
"RegisterAgents",
"indicates",
"an",
"expected",
"call",
"of",
"RegisterAgents"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agent_provider_mock.go#L56-L58 |
137,840 | choria-io/go-choria | server/agent_provider_mock.go | Version | func (mr *MockAgentProviderMockRecorder) Version() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockAgentProvider)(nil).Version))
} | go | func (mr *MockAgentProviderMockRecorder) Version() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockAgentProvider)(nil).Version))
} | [
"func",
"(",
"mr",
"*",
"MockAgentProviderMockRecorder",
")",
"Version",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
... | // Version indicates an expected call of Version | [
"Version",
"indicates",
"an",
"expected",
"call",
"of",
"Version"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/agent_provider_mock.go#L68-L70 |
137,841 | choria-io/go-choria | aagent/notifiers/console/console.go | Debugf | func (n *Notifier) Debugf(m machine.InfoSource, name string, format string, args ...interface{}) {
logrus.Debugf("%s#%s: %s", m.Name(), name, fmt.Sprintf(format, args...))
} | go | func (n *Notifier) Debugf(m machine.InfoSource, name string, format string, args ...interface{}) {
logrus.Debugf("%s#%s: %s", m.Name(), name, fmt.Sprintf(format, args...))
} | [
"func",
"(",
"n",
"*",
"Notifier",
")",
"Debugf",
"(",
"m",
"machine",
".",
"InfoSource",
",",
"name",
"string",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"m",
".",
... | // Debugf implements machine.NotificationService | [
"Debugf",
"implements",
"machine",
".",
"NotificationService"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/notifiers/console/console.go#L15-L17 |
137,842 | choria-io/go-choria | choria/connection_mock.go | NewMockConnectionManager | func NewMockConnectionManager(ctrl *gomock.Controller) *MockConnectionManager {
mock := &MockConnectionManager{ctrl: ctrl}
mock.recorder = &MockConnectionManagerMockRecorder{mock}
return mock
} | go | func NewMockConnectionManager(ctrl *gomock.Controller) *MockConnectionManager {
mock := &MockConnectionManager{ctrl: ctrl}
mock.recorder = &MockConnectionManagerMockRecorder{mock}
return mock
} | [
"func",
"NewMockConnectionManager",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockConnectionManager",
"{",
"mock",
":=",
"&",
"MockConnectionManager",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockConnectionManagerM... | // NewMockConnectionManager creates a new mock instance | [
"NewMockConnectionManager",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L28-L32 |
137,843 | choria-io/go-choria | choria/connection_mock.go | NewConnector | func (m *MockConnectionManager) NewConnector(ctx context.Context, servers func() ([]srvcache.Server, error), name string, logger *logrus.Entry) (Connector, error) {
ret := m.ctrl.Call(m, "NewConnector", ctx, servers, name, logger)
ret0, _ := ret[0].(Connector)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockConnectionManager) NewConnector(ctx context.Context, servers func() ([]srvcache.Server, error), name string, logger *logrus.Entry) (Connector, error) {
ret := m.ctrl.Call(m, "NewConnector", ctx, servers, name, logger)
ret0, _ := ret[0].(Connector)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockConnectionManager",
")",
"NewConnector",
"(",
"ctx",
"context",
".",
"Context",
",",
"servers",
"func",
"(",
")",
"(",
"[",
"]",
"srvcache",
".",
"Server",
",",
"error",
")",
",",
"name",
"string",
",",
"logger",
"*",
"logru... | // NewConnector mocks base method | [
"NewConnector",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L40-L45 |
137,844 | choria-io/go-choria | choria/connection_mock.go | NewConnector | func (mr *MockConnectionManagerMockRecorder) NewConnector(ctx, servers, name, logger interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConnector", reflect.TypeOf((*MockConnectionManager)(nil).NewConnector), ctx, servers, name, logger)
} | go | func (mr *MockConnectionManagerMockRecorder) NewConnector(ctx, servers, name, logger interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewConnector", reflect.TypeOf((*MockConnectionManager)(nil).NewConnector), ctx, servers, name, logger)
} | [
"func",
"(",
"mr",
"*",
"MockConnectionManagerMockRecorder",
")",
"NewConnector",
"(",
"ctx",
",",
"servers",
",",
"name",
",",
"logger",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordC... | // NewConnector indicates an expected call of NewConnector | [
"NewConnector",
"indicates",
"an",
"expected",
"call",
"of",
"NewConnector"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L48-L50 |
137,845 | choria-io/go-choria | choria/connection_mock.go | NewMockPublishableConnector | func NewMockPublishableConnector(ctrl *gomock.Controller) *MockPublishableConnector {
mock := &MockPublishableConnector{ctrl: ctrl}
mock.recorder = &MockPublishableConnectorMockRecorder{mock}
return mock
} | go | func NewMockPublishableConnector(ctrl *gomock.Controller) *MockPublishableConnector {
mock := &MockPublishableConnector{ctrl: ctrl}
mock.recorder = &MockPublishableConnectorMockRecorder{mock}
return mock
} | [
"func",
"NewMockPublishableConnector",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockPublishableConnector",
"{",
"mock",
":=",
"&",
"MockPublishableConnector",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockPublishab... | // NewMockPublishableConnector creates a new mock instance | [
"NewMockPublishableConnector",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L64-L68 |
137,846 | choria-io/go-choria | choria/connection_mock.go | NewMockRawPublishableConnector | func NewMockRawPublishableConnector(ctrl *gomock.Controller) *MockRawPublishableConnector {
mock := &MockRawPublishableConnector{ctrl: ctrl}
mock.recorder = &MockRawPublishableConnectorMockRecorder{mock}
return mock
} | go | func NewMockRawPublishableConnector(ctrl *gomock.Controller) *MockRawPublishableConnector {
mock := &MockRawPublishableConnector{ctrl: ctrl}
mock.recorder = &MockRawPublishableConnectorMockRecorder{mock}
return mock
} | [
"func",
"NewMockRawPublishableConnector",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockRawPublishableConnector",
"{",
"mock",
":=",
"&",
"MockRawPublishableConnector",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"Mock... | // NewMockRawPublishableConnector creates a new mock instance | [
"NewMockRawPublishableConnector",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L99-L103 |
137,847 | choria-io/go-choria | choria/connection_mock.go | NewMockAgentConnector | func NewMockAgentConnector(ctrl *gomock.Controller) *MockAgentConnector {
mock := &MockAgentConnector{ctrl: ctrl}
mock.recorder = &MockAgentConnectorMockRecorder{mock}
return mock
} | go | func NewMockAgentConnector(ctrl *gomock.Controller) *MockAgentConnector {
mock := &MockAgentConnector{ctrl: ctrl}
mock.recorder = &MockAgentConnectorMockRecorder{mock}
return mock
} | [
"func",
"NewMockAgentConnector",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAgentConnector",
"{",
"mock",
":=",
"&",
"MockAgentConnector",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAgentConnectorMockRecorder"... | // NewMockAgentConnector creates a new mock instance | [
"NewMockAgentConnector",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L134-L138 |
137,848 | choria-io/go-choria | choria/connection_mock.go | QueueSubscribe | func (m *MockAgentConnector) QueueSubscribe(ctx context.Context, name, subject, group string, output chan *ConnectorMessage) error {
ret := m.ctrl.Call(m, "QueueSubscribe", ctx, name, subject, group, output)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockAgentConnector) QueueSubscribe(ctx context.Context, name, subject, group string, output chan *ConnectorMessage) error {
ret := m.ctrl.Call(m, "QueueSubscribe", ctx, name, subject, group, output)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAgentConnector",
")",
"QueueSubscribe",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"subject",
",",
"group",
"string",
",",
"output",
"chan",
"*",
"ConnectorMessage",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctr... | // QueueSubscribe mocks base method | [
"QueueSubscribe",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L182-L186 |
137,849 | choria-io/go-choria | choria/connection_mock.go | NewMockClientConnector | func NewMockClientConnector(ctrl *gomock.Controller) *MockClientConnector {
mock := &MockClientConnector{ctrl: ctrl}
mock.recorder = &MockClientConnectorMockRecorder{mock}
return mock
} | go | func NewMockClientConnector(ctrl *gomock.Controller) *MockClientConnector {
mock := &MockClientConnector{ctrl: ctrl}
mock.recorder = &MockClientConnectorMockRecorder{mock}
return mock
} | [
"func",
"NewMockClientConnector",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockClientConnector",
"{",
"mock",
":=",
"&",
"MockClientConnector",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockClientConnectorMockRecor... | // NewMockClientConnector creates a new mock instance | [
"NewMockClientConnector",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L229-L233 |
137,850 | choria-io/go-choria | choria/connection_mock.go | NewMockConnectorInfo | func NewMockConnectorInfo(ctrl *gomock.Controller) *MockConnectorInfo {
mock := &MockConnectorInfo{ctrl: ctrl}
mock.recorder = &MockConnectorInfoMockRecorder{mock}
return mock
} | go | func NewMockConnectorInfo(ctrl *gomock.Controller) *MockConnectorInfo {
mock := &MockConnectorInfo{ctrl: ctrl}
mock.recorder = &MockConnectorInfoMockRecorder{mock}
return mock
} | [
"func",
"NewMockConnectorInfo",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockConnectorInfo",
"{",
"mock",
":=",
"&",
"MockConnectorInfo",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockConnectorInfoMockRecorder",
... | // NewMockConnectorInfo creates a new mock instance | [
"NewMockConnectorInfo",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L289-L293 |
137,851 | choria-io/go-choria | choria/connection_mock.go | ConnectionOptions | func (m *MockConnectorInfo) ConnectionOptions() go_nats.Options {
ret := m.ctrl.Call(m, "ConnectionOptions")
ret0, _ := ret[0].(go_nats.Options)
return ret0
} | go | func (m *MockConnectorInfo) ConnectionOptions() go_nats.Options {
ret := m.ctrl.Call(m, "ConnectionOptions")
ret0, _ := ret[0].(go_nats.Options)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnectorInfo",
")",
"ConnectionOptions",
"(",
")",
"go_nats",
".",
"Options",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
... | // ConnectionOptions mocks base method | [
"ConnectionOptions",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L313-L317 |
137,852 | choria-io/go-choria | choria/connection_mock.go | NewMockInstanceConnector | func NewMockInstanceConnector(ctrl *gomock.Controller) *MockInstanceConnector {
mock := &MockInstanceConnector{ctrl: ctrl}
mock.recorder = &MockInstanceConnectorMockRecorder{mock}
return mock
} | go | func NewMockInstanceConnector(ctrl *gomock.Controller) *MockInstanceConnector {
mock := &MockInstanceConnector{ctrl: ctrl}
mock.recorder = &MockInstanceConnectorMockRecorder{mock}
return mock
} | [
"func",
"NewMockInstanceConnector",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockInstanceConnector",
"{",
"mock",
":=",
"&",
"MockInstanceConnector",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockInstanceConnectorM... | // NewMockInstanceConnector creates a new mock instance | [
"NewMockInstanceConnector",
"creates",
"a",
"new",
"mock",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L348-L352 |
137,853 | choria-io/go-choria | choria/connection_mock.go | ConnectedServer | func (m *MockInstanceConnector) ConnectedServer() string {
ret := m.ctrl.Call(m, "ConnectedServer")
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockInstanceConnector) ConnectedServer() string {
ret := m.ctrl.Call(m, "ConnectedServer")
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockInstanceConnector",
")",
"ConnectedServer",
"(",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
... | // ConnectedServer mocks base method | [
"ConnectedServer",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L360-L364 |
137,854 | choria-io/go-choria | choria/connection_mock.go | Unsubscribe | func (m *MockInstanceConnector) Unsubscribe(name string) error {
ret := m.ctrl.Call(m, "Unsubscribe", name)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockInstanceConnector) Unsubscribe(name string) error {
ret := m.ctrl.Call(m, "Unsubscribe", name)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockInstanceConnector",
")",
"Unsubscribe",
"(",
"name",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
... | // Unsubscribe mocks base method | [
"Unsubscribe",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L408-L412 |
137,855 | choria-io/go-choria | choria/connection_mock.go | AgentBroadcastTarget | func (m *MockInstanceConnector) AgentBroadcastTarget(collective, agent string) string {
ret := m.ctrl.Call(m, "AgentBroadcastTarget", collective, agent)
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockInstanceConnector) AgentBroadcastTarget(collective, agent string) string {
ret := m.ctrl.Call(m, "AgentBroadcastTarget", collective, agent)
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockInstanceConnector",
")",
"AgentBroadcastTarget",
"(",
"collective",
",",
"agent",
"string",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"collective",
",",
"agent",
")",
"\n... | // AgentBroadcastTarget mocks base method | [
"AgentBroadcastTarget",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L420-L424 |
137,856 | choria-io/go-choria | choria/connection_mock.go | NodeDirectedTarget | func (m *MockInstanceConnector) NodeDirectedTarget(collective, identity string) string {
ret := m.ctrl.Call(m, "NodeDirectedTarget", collective, identity)
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockInstanceConnector) NodeDirectedTarget(collective, identity string) string {
ret := m.ctrl.Call(m, "NodeDirectedTarget", collective, identity)
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockInstanceConnector",
")",
"NodeDirectedTarget",
"(",
"collective",
",",
"identity",
"string",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"collective",
",",
"identity",
")",
... | // NodeDirectedTarget mocks base method | [
"NodeDirectedTarget",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L456-L460 |
137,857 | choria-io/go-choria | choria/connection_mock.go | ConnectionStats | func (m *MockConnector) ConnectionStats() go_nats.Statistics {
ret := m.ctrl.Call(m, "ConnectionStats")
ret0, _ := ret[0].(go_nats.Statistics)
return ret0
} | go | func (m *MockConnector) ConnectionStats() go_nats.Statistics {
ret := m.ctrl.Call(m, "ConnectionStats")
ret0, _ := ret[0].(go_nats.Statistics)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"ConnectionStats",
"(",
")",
"go_nats",
".",
"Statistics",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(... | // ConnectionStats mocks base method | [
"ConnectionStats",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L525-L529 |
137,858 | choria-io/go-choria | choria/connection_mock.go | Publish | func (m *MockConnector) Publish(msg *Message) error {
ret := m.ctrl.Call(m, "Publish", msg)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockConnector) Publish(msg *Message) error {
ret := m.ctrl.Call(m, "Publish", msg)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"Publish",
"(",
"msg",
"*",
"Message",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"msg",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",... | // Publish mocks base method | [
"Publish",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L573-L577 |
137,859 | choria-io/go-choria | choria/connection_mock.go | PublishRaw | func (m *MockConnector) PublishRaw(target string, data []byte) error {
ret := m.ctrl.Call(m, "PublishRaw", target, data)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockConnector) PublishRaw(target string, data []byte) error {
ret := m.ctrl.Call(m, "PublishRaw", target, data)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"PublishRaw",
"(",
"target",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"target",
",",
"data",
")",
"\n",
... | // PublishRaw mocks base method | [
"PublishRaw",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L585-L589 |
137,860 | choria-io/go-choria | choria/connection_mock.go | ReplyTarget | func (m *MockConnector) ReplyTarget(msg *Message) string {
ret := m.ctrl.Call(m, "ReplyTarget", msg)
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockConnector) ReplyTarget(msg *Message) string {
ret := m.ctrl.Call(m, "ReplyTarget", msg)
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"ReplyTarget",
"(",
"msg",
"*",
"Message",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"msg",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
... | // ReplyTarget mocks base method | [
"ReplyTarget",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L619-L623 |
137,861 | choria-io/go-choria | choria/connection_mock.go | ReplyTarget | func (mr *MockConnectorMockRecorder) ReplyTarget(msg interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplyTarget", reflect.TypeOf((*MockConnector)(nil).ReplyTarget), msg)
} | go | func (mr *MockConnectorMockRecorder) ReplyTarget(msg interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplyTarget", reflect.TypeOf((*MockConnector)(nil).ReplyTarget), msg)
} | [
"func",
"(",
"mr",
"*",
"MockConnectorMockRecorder",
")",
"ReplyTarget",
"(",
"msg",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\""... | // ReplyTarget indicates an expected call of ReplyTarget | [
"ReplyTarget",
"indicates",
"an",
"expected",
"call",
"of",
"ReplyTarget"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L626-L628 |
137,862 | choria-io/go-choria | choria/connection_mock.go | ChanQueueSubscribe | func (m *MockConnector) ChanQueueSubscribe(name, subject, group string, capacity int) (chan *ConnectorMessage, error) {
ret := m.ctrl.Call(m, "ChanQueueSubscribe", name, subject, group, capacity)
ret0, _ := ret[0].(chan *ConnectorMessage)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockConnector) ChanQueueSubscribe(name, subject, group string, capacity int) (chan *ConnectorMessage, error) {
ret := m.ctrl.Call(m, "ChanQueueSubscribe", name, subject, group, capacity)
ret0, _ := ret[0].(chan *ConnectorMessage)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"ChanQueueSubscribe",
"(",
"name",
",",
"subject",
",",
"group",
"string",
",",
"capacity",
"int",
")",
"(",
"chan",
"*",
"ConnectorMessage",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call... | // ChanQueueSubscribe mocks base method | [
"ChanQueueSubscribe",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L631-L636 |
137,863 | choria-io/go-choria | choria/connection_mock.go | Connect | func (m *MockConnector) Connect(ctx context.Context) error {
ret := m.ctrl.Call(m, "Connect", ctx)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockConnector) Connect(ctx context.Context) error {
ret := m.ctrl.Call(m, "Connect", ctx)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"Connect",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
... | // Connect mocks base method | [
"Connect",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L644-L648 |
137,864 | choria-io/go-choria | choria/connection_mock.go | Connect | func (mr *MockConnectorMockRecorder) Connect(ctx interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connect", reflect.TypeOf((*MockConnector)(nil).Connect), ctx)
} | go | func (mr *MockConnectorMockRecorder) Connect(ctx interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connect", reflect.TypeOf((*MockConnector)(nil).Connect), ctx)
} | [
"func",
"(",
"mr",
"*",
"MockConnectorMockRecorder",
")",
"Connect",
"(",
"ctx",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
... | // Connect indicates an expected call of Connect | [
"Connect",
"indicates",
"an",
"expected",
"call",
"of",
"Connect"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L651-L653 |
137,865 | choria-io/go-choria | choria/connection_mock.go | Nats | func (m *MockConnector) Nats() *go_nats.Conn {
ret := m.ctrl.Call(m, "Nats")
ret0, _ := ret[0].(*go_nats.Conn)
return ret0
} | go | func (m *MockConnector) Nats() *go_nats.Conn {
ret := m.ctrl.Call(m, "Nats")
ret0, _ := ret[0].(*go_nats.Conn)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockConnector",
")",
"Nats",
"(",
")",
"*",
"go_nats",
".",
"Conn",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
... | // Nats mocks base method | [
"Nats",
"mocks",
"base",
"method"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L656-L660 |
137,866 | choria-io/go-choria | choria/connection_mock.go | Nats | func (mr *MockConnectorMockRecorder) Nats() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nats", reflect.TypeOf((*MockConnector)(nil).Nats))
} | go | func (mr *MockConnectorMockRecorder) Nats() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nats", reflect.TypeOf((*MockConnector)(nil).Nats))
} | [
"func",
"(",
"mr",
"*",
"MockConnectorMockRecorder",
")",
"Nats",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeO... | // Nats indicates an expected call of Nats | [
"Nats",
"indicates",
"an",
"expected",
"call",
"of",
"Nats"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/connection_mock.go#L663-L665 |
137,867 | choria-io/go-choria | aagent/notifiers/choria/choria.go | New | func New(fw ChoriaProvider) (n *Notifier, err error) {
n = &Notifier{
fw: fw,
logger: fw.Logger("machine"),
}
return n, nil
} | go | func New(fw ChoriaProvider) (n *Notifier, err error) {
n = &Notifier{
fw: fw,
logger: fw.Logger("machine"),
}
return n, nil
} | [
"func",
"New",
"(",
"fw",
"ChoriaProvider",
")",
"(",
"n",
"*",
"Notifier",
",",
"err",
"error",
")",
"{",
"n",
"=",
"&",
"Notifier",
"{",
"fw",
":",
"fw",
",",
"logger",
":",
"fw",
".",
"Logger",
"(",
"\"",
"\"",
")",
",",
"}",
"\n\n",
"return... | // New creates a new choria notifier | [
"New",
"creates",
"a",
"new",
"choria",
"notifier"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/notifiers/choria/choria.go#L25-L32 |
137,868 | choria-io/go-choria | srvcache/server.go | URL | func (s *Server) URL() (u *url.URL, err error) {
if s.Scheme == "" {
return u, fmt.Errorf("Server %s:%d has no scheme, cannot make a URL", s.Host, s.Port)
}
ustring := fmt.Sprintf("%s://%s:%d", s.Scheme, s.Host, s.Port)
u, err = url.Parse(ustring)
if err != nil {
return u, fmt.Errorf("Could not parse %s: %s"... | go | func (s *Server) URL() (u *url.URL, err error) {
if s.Scheme == "" {
return u, fmt.Errorf("Server %s:%d has no scheme, cannot make a URL", s.Host, s.Port)
}
ustring := fmt.Sprintf("%s://%s:%d", s.Scheme, s.Host, s.Port)
u, err = url.Parse(ustring)
if err != nil {
return u, fmt.Errorf("Could not parse %s: %s"... | [
"func",
"(",
"s",
"*",
"Server",
")",
"URL",
"(",
")",
"(",
"u",
"*",
"url",
".",
"URL",
",",
"err",
"error",
")",
"{",
"if",
"s",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"return",
"u",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
... | // URL creates a correct url from the server if scheme is known | [
"URL",
"creates",
"a",
"correct",
"url",
"from",
"the",
"server",
"if",
"scheme",
"is",
"known"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/srvcache/server.go#L16-L29 |
137,869 | choria-io/go-choria | aagent/aagent.go | New | func New(dir string, fw ChoriaProvider) (aa *AAgent, err error) {
notifier, err := notifier.New(fw)
if err != nil {
return nil, errors.Wrapf(err, "could not create notifier")
}
return &AAgent{
fw: fw,
logger: fw.Logger("aagent"),
source: dir,
machines: []*managedMachine{},
notifier: notifier,... | go | func New(dir string, fw ChoriaProvider) (aa *AAgent, err error) {
notifier, err := notifier.New(fw)
if err != nil {
return nil, errors.Wrapf(err, "could not create notifier")
}
return &AAgent{
fw: fw,
logger: fw.Logger("aagent"),
source: dir,
machines: []*managedMachine{},
notifier: notifier,... | [
"func",
"New",
"(",
"dir",
"string",
",",
"fw",
"ChoriaProvider",
")",
"(",
"aa",
"*",
"AAgent",
",",
"err",
"error",
")",
"{",
"notifier",
",",
"err",
":=",
"notifier",
".",
"New",
"(",
"fw",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // New creates a new instance of the choria autonomous agent host | [
"New",
"creates",
"a",
"new",
"instance",
"of",
"the",
"choria",
"autonomous",
"agent",
"host"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/aagent.go#L46-L59 |
137,870 | choria-io/go-choria | aagent/aagent.go | ManageMachines | func (a *AAgent) ManageMachines(ctx context.Context, wg *sync.WaitGroup) error {
wg.Add(1)
go a.watchSource(ctx, wg)
return nil
} | go | func (a *AAgent) ManageMachines(ctx context.Context, wg *sync.WaitGroup) error {
wg.Add(1)
go a.watchSource(ctx, wg)
return nil
} | [
"func",
"(",
"a",
"*",
"AAgent",
")",
"ManageMachines",
"(",
"ctx",
"context",
".",
"Context",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
")",
"error",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"a",
".",
"watchSource",
"(",
"ctx",
",",
"wg... | // ManageMachines start observing the | [
"ManageMachines",
"start",
"observing",
"the"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/aagent.go#L62-L67 |
137,871 | choria-io/go-choria | aagent/aagent.go | Transition | func (a *AAgent) Transition(name string, version string, path string, id string, transition string) error {
m := a.findMachine(name, version, path, id)
if m == nil {
return fmt.Errorf("could not find machine with id %s", id)
}
if !m.machine.Can(transition) {
return fmt.Errorf("transition %s is not valid while ... | go | func (a *AAgent) Transition(name string, version string, path string, id string, transition string) error {
m := a.findMachine(name, version, path, id)
if m == nil {
return fmt.Errorf("could not find machine with id %s", id)
}
if !m.machine.Can(transition) {
return fmt.Errorf("transition %s is not valid while ... | [
"func",
"(",
"a",
"*",
"AAgent",
")",
"Transition",
"(",
"name",
"string",
",",
"version",
"string",
",",
"path",
"string",
",",
"id",
"string",
",",
"transition",
"string",
")",
"error",
"{",
"m",
":=",
"a",
".",
"findMachine",
"(",
"name",
",",
"ve... | // Transition transitions a running machine using a supplied transition event. Success is not guaranteed as the machine might be in a state that does not allow the transition | [
"Transition",
"transitions",
"a",
"running",
"machine",
"using",
"a",
"supplied",
"transition",
"event",
".",
"Success",
"is",
"not",
"guaranteed",
"as",
"the",
"machine",
"might",
"be",
"in",
"a",
"state",
"that",
"does",
"not",
"allow",
"the",
"transition"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/aagent/aagent.go#L70-L86 |
137,872 | choria-io/go-choria | server/infosource.go | NewEvent | func (srv *Instance) NewEvent(t lifecycle.Type, opts ...lifecycle.Option) error {
opts = append(opts, lifecycle.Component(srv.eventComponent()))
opts = append(opts, lifecycle.Identity(srv.cfg.Identity))
opts = append(opts, lifecycle.Version(build.Version))
e, err := lifecycle.New(t, opts...)
if err != nil {
ret... | go | func (srv *Instance) NewEvent(t lifecycle.Type, opts ...lifecycle.Option) error {
opts = append(opts, lifecycle.Component(srv.eventComponent()))
opts = append(opts, lifecycle.Identity(srv.cfg.Identity))
opts = append(opts, lifecycle.Version(build.Version))
e, err := lifecycle.New(t, opts...)
if err != nil {
ret... | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"NewEvent",
"(",
"t",
"lifecycle",
".",
"Type",
",",
"opts",
"...",
"lifecycle",
".",
"Option",
")",
"error",
"{",
"opts",
"=",
"append",
"(",
"opts",
",",
"lifecycle",
".",
"Component",
"(",
"srv",
".",
"eve... | // NewEvent creates a new event with the server component and identity set and publishes it | [
"NewEvent",
"creates",
"a",
"new",
"event",
"with",
"the",
"server",
"component",
"and",
"identity",
"set",
"and",
"publishes",
"it"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L37-L48 |
137,873 | choria-io/go-choria | server/infosource.go | PublishRaw | func (srv *Instance) PublishRaw(target string, data []byte) error {
return srv.connector.PublishRaw(target, data)
} | go | func (srv *Instance) PublishRaw(target string, data []byte) error {
return srv.connector.PublishRaw(target, data)
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"PublishRaw",
"(",
"target",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"srv",
".",
"connector",
".",
"PublishRaw",
"(",
"target",
",",
"data",
")",
"\n",
"}"
] | // PublishRaw allows publishing to the connected middleware | [
"PublishRaw",
"allows",
"publishing",
"to",
"the",
"connected",
"middleware"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L61-L63 |
137,874 | choria-io/go-choria | server/infosource.go | MachinesStatus | func (srv *Instance) MachinesStatus() ([]aagent.MachineState, error) {
if srv.machines == nil {
return []aagent.MachineState{}, nil
}
return srv.machines.AllMachineStates()
} | go | func (srv *Instance) MachinesStatus() ([]aagent.MachineState, error) {
if srv.machines == nil {
return []aagent.MachineState{}, nil
}
return srv.machines.AllMachineStates()
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"MachinesStatus",
"(",
")",
"(",
"[",
"]",
"aagent",
".",
"MachineState",
",",
"error",
")",
"{",
"if",
"srv",
".",
"machines",
"==",
"nil",
"{",
"return",
"[",
"]",
"aagent",
".",
"MachineState",
"{",
"}",
... | // MachinesStatus returns the status of all loaded autonomous agents | [
"MachinesStatus",
"returns",
"the",
"status",
"of",
"all",
"loaded",
"autonomous",
"agents"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L76-L82 |
137,875 | choria-io/go-choria | server/infosource.go | MachineTransition | func (srv *Instance) MachineTransition(name string, version string, path string, id string, transition string) error {
if srv.machines == nil {
return fmt.Errorf("Autonomous Agent host not initialized")
}
return srv.machines.Transition(name, version, path, id, transition)
} | go | func (srv *Instance) MachineTransition(name string, version string, path string, id string, transition string) error {
if srv.machines == nil {
return fmt.Errorf("Autonomous Agent host not initialized")
}
return srv.machines.Transition(name, version, path, id, transition)
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"MachineTransition",
"(",
"name",
"string",
",",
"version",
"string",
",",
"path",
"string",
",",
"id",
"string",
",",
"transition",
"string",
")",
"error",
"{",
"if",
"srv",
".",
"machines",
"==",
"nil",
"{",
... | // MachineTransition sends a transition event to a specific running machine instance | [
"MachineTransition",
"sends",
"a",
"transition",
"event",
"to",
"a",
"specific",
"running",
"machine",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L85-L91 |
137,876 | choria-io/go-choria | server/infosource.go | AgentMetadata | func (srv *Instance) AgentMetadata(agent string) (agents.Metadata, bool) {
a, found := srv.agents.Get(agent)
if !found {
return agents.Metadata{}, false
}
return *a.Metadata(), true
} | go | func (srv *Instance) AgentMetadata(agent string) (agents.Metadata, bool) {
a, found := srv.agents.Get(agent)
if !found {
return agents.Metadata{}, false
}
return *a.Metadata(), true
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"AgentMetadata",
"(",
"agent",
"string",
")",
"(",
"agents",
".",
"Metadata",
",",
"bool",
")",
"{",
"a",
",",
"found",
":=",
"srv",
".",
"agents",
".",
"Get",
"(",
"agent",
")",
"\n",
"if",
"!",
"found",
... | // AgentMetadata looks up the metadata for a specific agent | [
"AgentMetadata",
"looks",
"up",
"the",
"metadata",
"for",
"a",
"specific",
"agent"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L99-L106 |
137,877 | choria-io/go-choria | server/infosource.go | Classes | func (srv *Instance) Classes() []string {
classes, err := classes.ReadClasses(srv.cfg.ClassesFile)
if err != nil {
return []string{}
}
return classes
} | go | func (srv *Instance) Classes() []string {
classes, err := classes.ReadClasses(srv.cfg.ClassesFile)
if err != nil {
return []string{}
}
return classes
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"Classes",
"(",
")",
"[",
"]",
"string",
"{",
"classes",
",",
"err",
":=",
"classes",
".",
"ReadClasses",
"(",
"srv",
".",
"cfg",
".",
"ClassesFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",... | // Classes is a list of classification classes this node matches | [
"Classes",
"is",
"a",
"list",
"of",
"classification",
"classes",
"this",
"node",
"matches"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L114-L121 |
137,878 | choria-io/go-choria | server/infosource.go | Facts | func (srv *Instance) Facts() json.RawMessage {
j, _ := facts.JSON(srv.cfg.FactSourceFile, srv.log)
return j
} | go | func (srv *Instance) Facts() json.RawMessage {
j, _ := facts.JSON(srv.cfg.FactSourceFile, srv.log)
return j
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"Facts",
"(",
")",
"json",
".",
"RawMessage",
"{",
"j",
",",
"_",
":=",
"facts",
".",
"JSON",
"(",
"srv",
".",
"cfg",
".",
"FactSourceFile",
",",
"srv",
".",
"log",
")",
"\n\n",
"return",
"j",
"\n",
"}"
] | // Facts are all the known facts to this instance | [
"Facts",
"are",
"all",
"the",
"known",
"facts",
"to",
"this",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L124-L128 |
137,879 | choria-io/go-choria | server/infosource.go | UpTime | func (srv *Instance) UpTime() int64 {
return int64(time.Now().Sub(srv.startTime).Seconds())
} | go | func (srv *Instance) UpTime() int64 {
return int64(time.Now().Sub(srv.startTime).Seconds())
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"UpTime",
"(",
")",
"int64",
"{",
"return",
"int64",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"srv",
".",
"startTime",
")",
".",
"Seconds",
"(",
")",
")",
"\n",
"}"
] | // UpTime returns how long the server has been running | [
"UpTime",
"returns",
"how",
"long",
"the",
"server",
"has",
"been",
"running"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L136-L138 |
137,880 | choria-io/go-choria | server/infosource.go | Stats | func (srv *Instance) Stats() agents.ServerStats {
return agents.ServerStats{
Total: srv.getPromCtrValue(totalCtr),
Valid: srv.getPromCtrValue(validatedCtr),
Invalid: srv.getPromCtrValue(unvalidatedCtr),
Passed: srv.getPromCtrValue(passedCtr),
Filtered: srv.getPromCtrValue(filteredCtr),
R... | go | func (srv *Instance) Stats() agents.ServerStats {
return agents.ServerStats{
Total: srv.getPromCtrValue(totalCtr),
Valid: srv.getPromCtrValue(validatedCtr),
Invalid: srv.getPromCtrValue(unvalidatedCtr),
Passed: srv.getPromCtrValue(passedCtr),
Filtered: srv.getPromCtrValue(filteredCtr),
R... | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"Stats",
"(",
")",
"agents",
".",
"ServerStats",
"{",
"return",
"agents",
".",
"ServerStats",
"{",
"Total",
":",
"srv",
".",
"getPromCtrValue",
"(",
"totalCtr",
")",
",",
"Valid",
":",
"srv",
".",
"getPromCtrValu... | // Stats expose server statistics | [
"Stats",
"expose",
"server",
"statistics"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L146-L156 |
137,881 | choria-io/go-choria | server/infosource.go | Status | func (srv *Instance) Status() *InstanceStatus {
stats := srv.Stats()
return &InstanceStatus{
Identity: srv.cfg.Identity,
Uptime: srv.UpTime(),
ConnectedServer: srv.ConnectedServer(),
LastMessage: srv.LastProcessedMessage().Unix(),
Provisioning: srv.Provisioning(),
Stats: ... | go | func (srv *Instance) Status() *InstanceStatus {
stats := srv.Stats()
return &InstanceStatus{
Identity: srv.cfg.Identity,
Uptime: srv.UpTime(),
ConnectedServer: srv.ConnectedServer(),
LastMessage: srv.LastProcessedMessage().Unix(),
Provisioning: srv.Provisioning(),
Stats: ... | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"Status",
"(",
")",
"*",
"InstanceStatus",
"{",
"stats",
":=",
"srv",
".",
"Stats",
"(",
")",
"\n\n",
"return",
"&",
"InstanceStatus",
"{",
"Identity",
":",
"srv",
".",
"cfg",
".",
"Identity",
",",
"Uptime",
... | // Status calculates the current server status | [
"Status",
"calculates",
"the",
"current",
"server",
"status"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L159-L170 |
137,882 | choria-io/go-choria | server/infosource.go | WriteServerStatus | func (srv *Instance) WriteServerStatus(ctx context.Context, wg *sync.WaitGroup) {
defer wg.Done()
target := srv.cfg.Choria.StatusFilePath
freq := srv.cfg.Choria.StatusUpdateSeconds
writer := func() error {
if target == "" || freq == 0 {
srv.log.Debug("Server status writing has been disabled")
return nil
... | go | func (srv *Instance) WriteServerStatus(ctx context.Context, wg *sync.WaitGroup) {
defer wg.Done()
target := srv.cfg.Choria.StatusFilePath
freq := srv.cfg.Choria.StatusUpdateSeconds
writer := func() error {
if target == "" || freq == 0 {
srv.log.Debug("Server status writing has been disabled")
return nil
... | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"WriteServerStatus",
"(",
"ctx",
"context",
".",
"Context",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"target",
":=",
"srv",
".",
"cfg",
".",
"Choria",
... | // WriteServerStatus periodically writes the server status to a file | [
"WriteServerStatus",
"periodically",
"writes",
"the",
"server",
"status",
"to",
"a",
"file"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/infosource.go#L173-L219 |
137,883 | choria-io/go-choria | server/instance.go | NewInstance | func NewInstance(fw *choria.Framework) (i *Instance, err error) {
i = &Instance{
fw: fw,
cfg: fw.Config,
requests: make(chan *choria.ConnectorMessage),
mu: &sync.Mutex{},
startTime: time.Now(),
lastMsgProcessed: time.Unix(0, 0),
agentDenyList: []... | go | func NewInstance(fw *choria.Framework) (i *Instance, err error) {
i = &Instance{
fw: fw,
cfg: fw.Config,
requests: make(chan *choria.ConnectorMessage),
mu: &sync.Mutex{},
startTime: time.Now(),
lastMsgProcessed: time.Unix(0, 0),
agentDenyList: []... | [
"func",
"NewInstance",
"(",
"fw",
"*",
"choria",
".",
"Framework",
")",
"(",
"i",
"*",
"Instance",
",",
"err",
"error",
")",
"{",
"i",
"=",
"&",
"Instance",
"{",
"fw",
":",
"fw",
",",
"cfg",
":",
"fw",
".",
"Config",
",",
"requests",
":",
"make",... | // NewInstance creates a new choria server instance | [
"NewInstance",
"creates",
"a",
"new",
"choria",
"server",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/instance.go#L43-L58 |
137,884 | choria-io/go-choria | server/instance.go | Logger | func (srv *Instance) Logger(component string) *log.Entry {
return srv.fw.Logger(component)
} | go | func (srv *Instance) Logger(component string) *log.Entry {
return srv.fw.Logger(component)
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"Logger",
"(",
"component",
"string",
")",
"*",
"log",
".",
"Entry",
"{",
"return",
"srv",
".",
"fw",
".",
"Logger",
"(",
"component",
")",
"\n",
"}"
] | // Logger creates a new logger instance | [
"Logger",
"creates",
"a",
"new",
"logger",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/instance.go#L61-L63 |
137,885 | choria-io/go-choria | server/instance.go | RegisterRegistrationProvider | func (srv *Instance) RegisterRegistrationProvider(ctx context.Context, wg *sync.WaitGroup, provider registration.RegistrationDataProvider) error {
return srv.registration.RegisterProvider(ctx, wg, provider)
} | go | func (srv *Instance) RegisterRegistrationProvider(ctx context.Context, wg *sync.WaitGroup, provider registration.RegistrationDataProvider) error {
return srv.registration.RegisterProvider(ctx, wg, provider)
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"RegisterRegistrationProvider",
"(",
"ctx",
"context",
".",
"Context",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
",",
"provider",
"registration",
".",
"RegistrationDataProvider",
")",
"error",
"{",
"return",
"srv",
"."... | // RegisterRegistrationProvider adds a new provider for registration data to the registration subsystem | [
"RegisterRegistrationProvider",
"adds",
"a",
"new",
"provider",
"for",
"registration",
"data",
"to",
"the",
"registration",
"subsystem"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/instance.go#L134-L136 |
137,886 | choria-io/go-choria | server/instance.go | RegisterAgent | func (srv *Instance) RegisterAgent(ctx context.Context, name string, agent agents.Agent) error {
return srv.agents.RegisterAgent(ctx, name, agent, srv.connector)
} | go | func (srv *Instance) RegisterAgent(ctx context.Context, name string, agent agents.Agent) error {
return srv.agents.RegisterAgent(ctx, name, agent, srv.connector)
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"RegisterAgent",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"agent",
"agents",
".",
"Agent",
")",
"error",
"{",
"return",
"srv",
".",
"agents",
".",
"RegisterAgent",
"(",
"ctx",
",",
"na... | // RegisterAgent adds a new agent to the running instance | [
"RegisterAgent",
"adds",
"a",
"new",
"agent",
"to",
"the",
"running",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/instance.go#L139-L141 |
137,887 | choria-io/go-choria | server/instance.go | DenyAgent | func (srv *Instance) DenyAgent(agent string) {
srv.mu.Lock()
defer srv.mu.Unlock()
srv.agentDenyList = append(srv.agentDenyList, agent)
} | go | func (srv *Instance) DenyAgent(agent string) {
srv.mu.Lock()
defer srv.mu.Unlock()
srv.agentDenyList = append(srv.agentDenyList, agent)
} | [
"func",
"(",
"srv",
"*",
"Instance",
")",
"DenyAgent",
"(",
"agent",
"string",
")",
"{",
"srv",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"srv",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"srv",
".",
"agentDenyList",
"=",
"append",
"(",
"... | // DenyAgent prevents an agent from being loaded, if it was already loaded this has no effect | [
"DenyAgent",
"prevents",
"an",
"agent",
"from",
"being",
"loaded",
"if",
"it",
"was",
"already",
"loaded",
"this",
"has",
"no",
"effect"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/instance.go#L144-L149 |
137,888 | choria-io/go-choria | server/discovery/identity/identity.go | Match | func Match(needles []string, certname string) bool {
for _, needle := range needles {
if strings.HasPrefix(needle, "/") && strings.HasSuffix(needle, "/") {
needle = strings.TrimPrefix(needle, "/")
needle = strings.TrimSuffix(needle, "/")
if matched, _ := regexp.MatchString(needle, certname); matched {
r... | go | func Match(needles []string, certname string) bool {
for _, needle := range needles {
if strings.HasPrefix(needle, "/") && strings.HasSuffix(needle, "/") {
needle = strings.TrimPrefix(needle, "/")
needle = strings.TrimSuffix(needle, "/")
if matched, _ := regexp.MatchString(needle, certname); matched {
r... | [
"func",
"Match",
"(",
"needles",
"[",
"]",
"string",
",",
"certname",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"needle",
":=",
"range",
"needles",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"needle",
",",
"\"",
"\"",
")",
"&&",
"strings",
".",
... | // Match identities on a OR basis, since nodes have only 1 identity | [
"Match",
"identities",
"on",
"a",
"OR",
"basis",
"since",
"nodes",
"have",
"only",
"1",
"identity"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/server/discovery/identity/identity.go#L9-L27 |
137,889 | choria-io/go-choria | choria/protocol.go | NewMessage | func (fw *Framework) NewMessage(payload string, agent string, collective string, msgType string, request *Message) (msg *Message, err error) {
msg, err = NewMessage(payload, agent, collective, msgType, request, fw)
return
} | go | func (fw *Framework) NewMessage(payload string, agent string, collective string, msgType string, request *Message) (msg *Message, err error) {
msg, err = NewMessage(payload, agent, collective, msgType, request, fw)
return
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewMessage",
"(",
"payload",
"string",
",",
"agent",
"string",
",",
"collective",
"string",
",",
"msgType",
"string",
",",
"request",
"*",
"Message",
")",
"(",
"msg",
"*",
"Message",
",",
"err",
"error",
")",
... | // NewMessage creates a new Message associated with this Choria instance | [
"NewMessage",
"creates",
"a",
"new",
"Message",
"associated",
"with",
"this",
"Choria",
"instance"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L13-L17 |
137,890 | choria-io/go-choria | choria/protocol.go | NewRequestMessageFromTransportJSON | func (fw *Framework) NewRequestMessageFromTransportJSON(payload []byte) (msg *Message, err error) {
transport, err := fw.NewTransportFromJSON(string(payload))
if err != nil {
return nil, err
}
srequest, err := fw.NewSecureRequestFromTransport(transport, false)
if err != nil {
return nil, err
}
request, err... | go | func (fw *Framework) NewRequestMessageFromTransportJSON(payload []byte) (msg *Message, err error) {
transport, err := fw.NewTransportFromJSON(string(payload))
if err != nil {
return nil, err
}
srequest, err := fw.NewSecureRequestFromTransport(transport, false)
if err != nil {
return nil, err
}
request, err... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewRequestMessageFromTransportJSON",
"(",
"payload",
"[",
"]",
"byte",
")",
"(",
"msg",
"*",
"Message",
",",
"err",
"error",
")",
"{",
"transport",
",",
"err",
":=",
"fw",
".",
"NewTransportFromJSON",
"(",
"string... | // NewRequestMessageFromTransportJSON creates a Message from a Transport JSON that holds a Request | [
"NewRequestMessageFromTransportJSON",
"creates",
"a",
"Message",
"from",
"a",
"Transport",
"JSON",
"that",
"holds",
"a",
"Request"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L20-L44 |
137,891 | choria-io/go-choria | choria/protocol.go | NewReplyFromTransportJSON | func (fw *Framework) NewReplyFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Reply, err error) {
transport, err := fw.NewTransportFromJSON(string(payload))
if err != nil {
return nil, err
}
sreply, err := fw.NewSecureReplyFromTransport(transport, skipvalidate)
if err != nil {
return nil, er... | go | func (fw *Framework) NewReplyFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Reply, err error) {
transport, err := fw.NewTransportFromJSON(string(payload))
if err != nil {
return nil, err
}
sreply, err := fw.NewSecureReplyFromTransport(transport, skipvalidate)
if err != nil {
return nil, er... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewReplyFromTransportJSON",
"(",
"payload",
"[",
"]",
"byte",
",",
"skipvalidate",
"bool",
")",
"(",
"msg",
"protocol",
".",
"Reply",
",",
"err",
"error",
")",
"{",
"transport",
",",
"err",
":=",
"fw",
".",
"N... | // NewReplyFromTransportJSON creates a new Reply from a transport JSON | [
"NewReplyFromTransportJSON",
"creates",
"a",
"new",
"Reply",
"from",
"a",
"transport",
"JSON"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L47-L66 |
137,892 | choria-io/go-choria | choria/protocol.go | NewRequestFromTransportJSON | func (fw *Framework) NewRequestFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Request, err error) {
transport, err := fw.NewTransportFromJSON(string(payload))
if err != nil {
return nil, err
}
sreq, err := fw.NewSecureRequestFromTransport(transport, skipvalidate)
if err != nil {
return nil... | go | func (fw *Framework) NewRequestFromTransportJSON(payload []byte, skipvalidate bool) (msg protocol.Request, err error) {
transport, err := fw.NewTransportFromJSON(string(payload))
if err != nil {
return nil, err
}
sreq, err := fw.NewSecureRequestFromTransport(transport, skipvalidate)
if err != nil {
return nil... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewRequestFromTransportJSON",
"(",
"payload",
"[",
"]",
"byte",
",",
"skipvalidate",
"bool",
")",
"(",
"msg",
"protocol",
".",
"Request",
",",
"err",
"error",
")",
"{",
"transport",
",",
"err",
":=",
"fw",
".",
... | // NewRequestFromTransportJSON creates a new Request from transport JSON | [
"NewRequestFromTransportJSON",
"creates",
"a",
"new",
"Request",
"from",
"transport",
"JSON"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L69-L88 |
137,893 | choria-io/go-choria | choria/protocol.go | NewRequest | func (fw *Framework) NewRequest(version string, agent string, senderid string, callerid string, ttl int, requestid string, collective string) (request protocol.Request, err error) {
switch version {
case protocol.RequestV1:
request, err = v1.NewRequest(agent, senderid, callerid, ttl, requestid, collective)
default... | go | func (fw *Framework) NewRequest(version string, agent string, senderid string, callerid string, ttl int, requestid string, collective string) (request protocol.Request, err error) {
switch version {
case protocol.RequestV1:
request, err = v1.NewRequest(agent, senderid, callerid, ttl, requestid, collective)
default... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewRequest",
"(",
"version",
"string",
",",
"agent",
"string",
",",
"senderid",
"string",
",",
"callerid",
"string",
",",
"ttl",
"int",
",",
"requestid",
"string",
",",
"collective",
"string",
")",
"(",
"request",... | // NewRequest creates a new Request complying with a specific protocol version like protocol.RequestV1 | [
"NewRequest",
"creates",
"a",
"new",
"Request",
"complying",
"with",
"a",
"specific",
"protocol",
"version",
"like",
"protocol",
".",
"RequestV1"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L91-L100 |
137,894 | choria-io/go-choria | choria/protocol.go | NewRequestFromMessage | func (fw *Framework) NewRequestFromMessage(version string, msg *Message) (req protocol.Request, err error) {
if !(msg.Type() == "request" || msg.Type() == "direct_request") {
err = fmt.Errorf("Cannot use `%s` message to construct a Request", msg.Type())
return
}
req, err = fw.NewRequest(version, msg.Agent, msg.... | go | func (fw *Framework) NewRequestFromMessage(version string, msg *Message) (req protocol.Request, err error) {
if !(msg.Type() == "request" || msg.Type() == "direct_request") {
err = fmt.Errorf("Cannot use `%s` message to construct a Request", msg.Type())
return
}
req, err = fw.NewRequest(version, msg.Agent, msg.... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewRequestFromMessage",
"(",
"version",
"string",
",",
"msg",
"*",
"Message",
")",
"(",
"req",
"protocol",
".",
"Request",
",",
"err",
"error",
")",
"{",
"if",
"!",
"(",
"msg",
".",
"Type",
"(",
")",
"==",
... | // NewRequestFromMessage creates a new Request with the Message settings preloaded complying with a specific protocol version like protocol.RequestV1 | [
"NewRequestFromMessage",
"creates",
"a",
"new",
"Request",
"with",
"the",
"Message",
"settings",
"preloaded",
"complying",
"with",
"a",
"specific",
"protocol",
"version",
"like",
"protocol",
".",
"RequestV1"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L103-L123 |
137,895 | choria-io/go-choria | choria/protocol.go | NewReply | func (fw *Framework) NewReply(request protocol.Request) (reply protocol.Reply, err error) {
switch request.Version() {
case protocol.RequestV1:
reply, err = v1.NewReply(request, fw.Config.Identity)
default:
err = fmt.Errorf("Do not know how to create a Reply version %s", request.Version())
}
return
} | go | func (fw *Framework) NewReply(request protocol.Request) (reply protocol.Reply, err error) {
switch request.Version() {
case protocol.RequestV1:
reply, err = v1.NewReply(request, fw.Config.Identity)
default:
err = fmt.Errorf("Do not know how to create a Reply version %s", request.Version())
}
return
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewReply",
"(",
"request",
"protocol",
".",
"Request",
")",
"(",
"reply",
"protocol",
".",
"Reply",
",",
"err",
"error",
")",
"{",
"switch",
"request",
".",
"Version",
"(",
")",
"{",
"case",
"protocol",
".",
... | // NewReply creates a new Reply, the version will match that of the given request | [
"NewReply",
"creates",
"a",
"new",
"Reply",
"the",
"version",
"will",
"match",
"that",
"of",
"the",
"given",
"request"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L126-L135 |
137,896 | choria-io/go-choria | choria/protocol.go | NewReplyFromMessage | func (fw *Framework) NewReplyFromMessage(version string, msg *Message) (rep protocol.Reply, err error) {
if msg.Type() != "reply" {
err = fmt.Errorf("Cannot use `%s` message to construct a Reply", msg.Type())
return
}
if msg.Request == nil {
err = fmt.Errorf("Cannot create a Reply from Messages without Reques... | go | func (fw *Framework) NewReplyFromMessage(version string, msg *Message) (rep protocol.Reply, err error) {
if msg.Type() != "reply" {
err = fmt.Errorf("Cannot use `%s` message to construct a Reply", msg.Type())
return
}
if msg.Request == nil {
err = fmt.Errorf("Cannot create a Reply from Messages without Reques... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewReplyFromMessage",
"(",
"version",
"string",
",",
"msg",
"*",
"Message",
")",
"(",
"rep",
"protocol",
".",
"Reply",
",",
"err",
"error",
")",
"{",
"if",
"msg",
".",
"Type",
"(",
")",
"!=",
"\"",
"\"",
"... | // NewReplyFromMessage creates a new Reply with the Message settings preloaded complying with a specific protocol version like protocol.ReplyV1 | [
"NewReplyFromMessage",
"creates",
"a",
"new",
"Reply",
"with",
"the",
"Message",
"settings",
"preloaded",
"complying",
"with",
"a",
"specific",
"protocol",
"version",
"like",
"protocol",
".",
"ReplyV1"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L138-L158 |
137,897 | choria-io/go-choria | choria/protocol.go | NewReplyFromSecureReply | func (fw *Framework) NewReplyFromSecureReply(sr protocol.SecureReply) (reply protocol.Reply, err error) {
switch sr.Version() {
case protocol.SecureReplyV1:
reply, err = v1.NewReplyFromSecureReply(sr)
default:
err = fmt.Errorf("Do not know how to create a Reply version %s", sr.Version())
}
return
} | go | func (fw *Framework) NewReplyFromSecureReply(sr protocol.SecureReply) (reply protocol.Reply, err error) {
switch sr.Version() {
case protocol.SecureReplyV1:
reply, err = v1.NewReplyFromSecureReply(sr)
default:
err = fmt.Errorf("Do not know how to create a Reply version %s", sr.Version())
}
return
} | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewReplyFromSecureReply",
"(",
"sr",
"protocol",
".",
"SecureReply",
")",
"(",
"reply",
"protocol",
".",
"Reply",
",",
"err",
"error",
")",
"{",
"switch",
"sr",
".",
"Version",
"(",
")",
"{",
"case",
"protocol",... | // NewReplyFromSecureReply creates a new Reply from the JSON payload of SecureReply, the version will match what is in the JSON payload | [
"NewReplyFromSecureReply",
"creates",
"a",
"new",
"Reply",
"from",
"the",
"JSON",
"payload",
"of",
"SecureReply",
"the",
"version",
"will",
"match",
"what",
"is",
"in",
"the",
"JSON",
"payload"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L161-L170 |
137,898 | choria-io/go-choria | choria/protocol.go | NewRequestFromSecureRequest | func (fw *Framework) NewRequestFromSecureRequest(sr protocol.SecureRequest) (request protocol.Request, err error) {
switch sr.Version() {
case protocol.SecureRequestV1:
request, err = v1.NewRequestFromSecureRequest(sr)
default:
err = fmt.Errorf("Do not know how to create a Reply version %s", sr.Version())
}
r... | go | func (fw *Framework) NewRequestFromSecureRequest(sr protocol.SecureRequest) (request protocol.Request, err error) {
switch sr.Version() {
case protocol.SecureRequestV1:
request, err = v1.NewRequestFromSecureRequest(sr)
default:
err = fmt.Errorf("Do not know how to create a Reply version %s", sr.Version())
}
r... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewRequestFromSecureRequest",
"(",
"sr",
"protocol",
".",
"SecureRequest",
")",
"(",
"request",
"protocol",
".",
"Request",
",",
"err",
"error",
")",
"{",
"switch",
"sr",
".",
"Version",
"(",
")",
"{",
"case",
"... | // NewRequestFromSecureRequest creates a new Request from a SecureRequest, the version will match what is in the JSON payload | [
"NewRequestFromSecureRequest",
"creates",
"a",
"new",
"Request",
"from",
"a",
"SecureRequest",
"the",
"version",
"will",
"match",
"what",
"is",
"in",
"the",
"JSON",
"payload"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L173-L182 |
137,899 | choria-io/go-choria | choria/protocol.go | NewSecureReply | func (fw *Framework) NewSecureReply(reply protocol.Reply) (secure protocol.SecureReply, err error) {
switch reply.Version() {
case protocol.ReplyV1:
secure, err = v1.NewSecureReply(reply, fw.security)
default:
err = fmt.Errorf("Do not know how to create a SecureReply based on a Reply version %s", reply.Version()... | go | func (fw *Framework) NewSecureReply(reply protocol.Reply) (secure protocol.SecureReply, err error) {
switch reply.Version() {
case protocol.ReplyV1:
secure, err = v1.NewSecureReply(reply, fw.security)
default:
err = fmt.Errorf("Do not know how to create a SecureReply based on a Reply version %s", reply.Version()... | [
"func",
"(",
"fw",
"*",
"Framework",
")",
"NewSecureReply",
"(",
"reply",
"protocol",
".",
"Reply",
")",
"(",
"secure",
"protocol",
".",
"SecureReply",
",",
"err",
"error",
")",
"{",
"switch",
"reply",
".",
"Version",
"(",
")",
"{",
"case",
"protocol",
... | // NewSecureReply creates a new SecureReply with the given Reply message as payload | [
"NewSecureReply",
"creates",
"a",
"new",
"SecureReply",
"with",
"the",
"given",
"Reply",
"message",
"as",
"payload"
] | 2c773ed36498f426852fd294ebb832c6a2625eba | https://github.com/choria-io/go-choria/blob/2c773ed36498f426852fd294ebb832c6a2625eba/choria/protocol.go#L185-L194 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.